Main function when running as a program.
340801
def main():
    
    global args
    args = parse_args()

    if not args:
        return 1

    state = MyState(args)

    for path in args.paths:
        if os.path.isdir(path):
            walk_dir(path, args, state)
        else:
            safe_process_files(os.path.dirname(path), [os.path.basename(path)], args, state)
        if state.should_quit():
            break
    if state.failed_files:
        sys.stderr.write("error: %i/%i AEADs failed\n" % (len(state.failed_files), state.file_count))
        return 1
    if args.debug:
        sys.stderr.write("Successfully processed %i AEADs\n" % (state.file_count))
223372
def main():
    """"""

    cleanup_and_exit = sys.exit # Function to do cleanup and exit before the import.
    exit_code = 0

    # Imports are done here inside the try block so some ugly (and useless)
    # traceback info is avoided on user's ^C (KeyboardInterrupt, EOFError on Windows).
    try:
        from . import external_program_calls as ex # Creates tmp dir as side effect.
        cleanup_and_exit = ex.cleanup_and_exit # Switch to the real one, deletes temp dir.

        from . import main_pdfCropMargins # Imports external_program_calls, don't do first.
        main_pdfCropMargins.main_crop() # Run the actual program.

    except (KeyboardInterrupt, EOFError): # Windows raises EOFError on ^C.
        print("\nGot a KeyboardInterrupt, cleaning up and exiting...\n",
              file=sys.stderr)

    except SystemExit:
        exit_code = sys.exc_info()[1]
        print()

    except:
        # Echo back the unexpected error so the user can see it.
        print("\nCaught an unexpected exception in the pdfCropMargins program.",
                                                               file=sys.stderr)
        print("Unexpected error: ", sys.exc_info()[0], file=sys.stderr)
        print("Error message   : ", sys.exc_info()[1], file=sys.stderr)
        print()
        exit_code = 1
        import traceback
        max_traceback_length = 30
        traceback.print_tb(sys.exc_info()[2], limit=max_traceback_length)
        # raise # Re-raise the error.

    finally:
        # Some people like to hit multiple ^C chars, which kills cleanup.
        # Call cleanup again each time.
        for i in range(30): # Give up after 30 tries.
            try:
                cleanup_and_exit(exit_code)
            except (KeyboardInterrupt, EOFError):
                continue
363346
def main():
    # type: () -> typing.Any
    
    colorama.init(wrap=six.PY3)
    doc = usage.get_primary_command_usage()
    allow_subcommands = '<command>' in doc
    args = docopt(doc, version=settings.version,
                  options_first=allow_subcommands)
    if sys.excepthook is sys.__excepthook__:
        sys.excepthook = log.excepthook
    try:
        log.enable_logging(log.get_log_level(args))
        default_args = sys.argv[2 if args.get('<command>') else 1:]
        if (args.get('<command>') == 'help' and
                None not in settings.subcommands):
            subcommand = next(iter(args.get('<args>', default_args)), None)
            return usage.get_help_usage(subcommand)
        argv = [args.get('<command>')] + args.get('<args>', default_args)
        return _run_command(argv)
    except exc.InvalidCliValueError as e:
        return str(e)
950183
def main():
    """"""
    logging.basicConfig(format=LOGGING_FORMAT)
    log = logging.getLogger(__name__)

    parser = argparse.ArgumentParser()
    add_debug(parser)
    add_app(parser)
    add_properties(parser)
    add_env(parser)
    add_region(parser)
    args = parser.parse_args()

    logging.getLogger(__package__.split('.')[0]).setLevel(args.debug)

    log.debug('Parsed arguments: %s', args)

    asgpolicy = AutoScalingPolicy(app=args.app, prop_path=args.properties, env=args.env, region=args.region)

    asgpolicy.create_policy()
924222
function main(program) {
  program || (program = { args: [] });
  if(program.args.length === 0) {
    program.outputHelp();
    return process.exit(1);
  }

  return Promise
    .map(program.args, _.partial(exports.downloadPosting, program))
    .map(function(html) {
      return cheerio.load(html);
    })
    .map(exports.extractInfo)
    .then(_.partial(exports.outputInfo, program));
}
974217
def main(argv):
    """"""
    del argv  # Unused
    flags.mark_flag_as_required('load_file')

    run_game(
        load_file=FLAGS.load_file,
        selfplay_dir=FLAGS.selfplay_dir,
        holdout_dir=FLAGS.holdout_dir,
        holdout_pct=FLAGS.holdout_pct,
        sgf_dir=FLAGS.sgf_dir)
1252858
def main():
    """"""
    # Create command line parser.
    parser = argparse.ArgumentParser()
    # Adding command line arguments.
    parser.add_argument("-o", "--out", help="Output file", default=None)
    parser.add_argument(
        "pyfile", help="Python file to be profiled", default=None
    )
    # Parse command line arguments.
    arguments = parser.parse_args()
    if arguments.pyfile is not None:
        # Core functionality.
        pyheat = PyHeat(arguments.pyfile)
        pyheat.create_heatmap()
        pyheat.show_heatmap(output_file=arguments.out, enable_scroll=True)
        pyheat.close_heatmap()
    else:
        # Print command help
        parser.print_help()
315839
def run(main=None, argv=None):
    """"""
    flags_obj = flags.FLAGS
    absl_flags_obj = absl_flags.FLAGS

    # Extract the args from the optional `argv` list.
    args = argv[1:] if argv else None

    # Parse the known flags from that list, or from the command
    # line otherwise.
    # pylint: disable=protected-access
    flags_passthrough = flags_obj._parse_flags(args=args)
    # pylint: enable=protected-access

    # Immediately after flags are parsed, bump verbosity to INFO if the flag has
    # not been set.
    if absl_flags_obj["verbosity"].using_default_value:
        absl_flags_obj.verbosity = 0

    main = main or sys.modules['__main__'].main

    # Call the main function, passing through any arguments
    # to the final program.
    sys.exit(main(sys.argv[:1] + flags_passthrough))
1077903
def main():
    
    setup_main_logger(console=True, file_logging=False)
    params = argparse.ArgumentParser(description="Extract specific parameters.")
    arguments.add_extract_args(params)
    args = params.parse_args()
    extract_parameters(args)
796009
def run_program(program, *args):
    """"""
    real_args = [program]
    real_args.extend(args)
    logging.debug(_('check_output arguments: %s'), real_args)
    check_output(real_args, universal_newlines=True)
1323319
def main():
    """"""
    args = parse_input()
    args.lock = True
    args.question = []
    args.all = False
    args.timeout = 0
    args.verbose = False
    args.interactive = False

    try:
        assign = assignment.load_assignment(args.config, args)

        msgs = messages.Messages()

        lock.protocol(args, assign).run(msgs)
    except (ex.LoadingException, ex.SerializeException) as e:
        log.warning('Assignment could not instantiate', exc_info=True)
        print('Error: ' + str(e).strip())
        exit(1)
    except (KeyboardInterrupt, EOFError):
        log.info('Quitting...')
    else:
        assign.dump_tests()
824079
def main():
    """"""
    logging.basicConfig(level=logging.INFO)
    app = RunSnakeRunApp(0)
    app.MainLoop()
213026
def main():
    """"""
    logger = setup_logger()

    logger.debug('a debug message')
    logger.info('an info message')
    logger.warning('a warning message')
    logger.error('an error message')
    logger.critical('a critical message')
553309
def main():
    
    args = parser.parse_args()
    try:
        function = args.func
    except AttributeError:
        parser.print_usage()
        parser.exit(1)
    function(vars(args))
467307
def main():
    
    if sys.argv[1:]:  # called with input arguments
        copy(' '.join(sys.argv[1:]))
    elif not sys.stdin.isatty():  # piped in input
        copy(''.join(sys.stdin.readlines()).rstrip('\n'))
    else:  # paste output
        print(paste())
1335519
def main():
    """"""
    args = parse_arguments()
    print(args)
    print("action" + args.action)
    print("pid" + args.pid)
    print("directory" + args.directory)
    print("fileprefix" + args.fileprefix)
619113
def main():
    """"""
    from docopt import docopt
    args = docopt(__doc__)
    infile = args['INFILE']
    outfile = args['OUTFILE']
    i3extract(infile, outfile)