from argparse import ArgumentParser

from . import app
from . import build


parser = ArgumentParser()
parser.add_argument('action', nargs='?', default='build',
                    choices=['build', 'display'])
args = parser.parse_args()

if args.action == 'build':
    build.save_all_plots()

if args.action in ('build', 'display'):
    app.main()

import argparse

from . import app
from . import build


def main():
    formatter = argparse.ArgumentDefaultsHelpFormatter
    parser = argparse.ArgumentParser(description=__doc__,
                                     formatter_class=formatter)
    parser.add_argument('-s', '--skip-build', action='store_true',
                        help="If set, skip plot-generation step.")

    args = parser.parse_args()

    if not args.skip_build:
        build.save_all_plots()

    app.main()


if __name__ == '__main__':
    main()

Clean up API for main module
Clean up API for main module

- from argparse import ArgumentParser
+ import argparse
  
  from . import app
  from . import build
  
  
- parser = ArgumentParser()
- parser.add_argument('action', nargs='?', default='build',
-                     choices=['build', 'display'])
- args = parser.parse_args()
+ def main():
+     formatter = argparse.ArgumentDefaultsHelpFormatter
+     parser = argparse.ArgumentParser(description=__doc__,
+                                      formatter_class=formatter)
+     parser.add_argument('-s', '--skip-build', action='store_true',
+                         help="If set, skip plot-generation step.")
  
+     args = parser.parse_args()
- if args.action == 'build':
-     build.save_all_plots()
  
- if args.action in ('build', 'display'):
+     if not args.skip_build:
+         build.save_all_plots()
+ 
      app.main()
  
+ 
+ if __name__ == '__main__':
+     main()
+ 
Clean up API for main module
## Code Before:
from argparse import ArgumentParser

from . import app
from . import build


parser = ArgumentParser()
parser.add_argument('action', nargs='?', default='build',
                    choices=['build', 'display'])
args = parser.parse_args()

if args.action == 'build':
    build.save_all_plots()

if args.action in ('build', 'display'):
    app.main()

## Instruction:
Clean up API for main module
## Code After:
import argparse

from . import app
from . import build


def main():
    formatter = argparse.ArgumentDefaultsHelpFormatter
    parser = argparse.ArgumentParser(description=__doc__,
                                     formatter_class=formatter)
    parser.add_argument('-s', '--skip-build', action='store_true',
                        help="If set, skip plot-generation step.")

    args = parser.parse_args()

    if not args.skip_build:
        build.save_all_plots()

    app.main()


if __name__ == '__main__':
    main()
