I parse arguments in sys.argv and return the args object.  The parser
    itself is available as args.parser.

    Adds the following members to args:
        parser    = the parser object
        store_opt = the StoreOpt object
2669
def parseArguments(argv=None):  # pragma: no cover
    
    store_opt = StoreOpt()
    parser = argparse.ArgumentParser(
            prog='green',
            usage='%(prog)s [options] [target [target2 ...]]',
            add_help=False,
            description=dedent(
                """
                Green is a clean, colorful, fast test runner for Python unit tests.
                """.rstrip()),
            epilog=dedent(
                """
                ENABLING SHELL COMPLETION

                  To enable bash- or zsh-completion, add the line below to the end of your
                  .bashrc or .zshrc file (or equivalent config file):

                    which green >& /dev/null && source "$( green --completion-file )"

                  Warning!  Generating a completion list actually discovers and loads tests
                  -- this can be very slow if you run it in huge directories!

                SETUP.PY RUNNER

                  To run green as a setup.py command, simply add green to the 'setup_requires'
                  section in the setup.py file, and specify a target as the 'test_suite'
                  parameter if you do not want green to load all the tests:

                     setup(
                         setup_requires = ['green'],
                         install_requires = 'myproject.tests'
                     )

                  Then simply run green as any other setup.py command (it accepts the same
                  parameters as the 'green' executable):

                     python setup.py green
                     python setup.py green -r   # to run with coverage, etc.


                CONFIG FILES

                  For documentation on config files, please see
                  https://github.com/CleanCut/green#config-files
                """.rstrip()),
            formatter_class=argparse.RawDescriptionHelpFormatter)

    target_args = parser.add_argument_group("Target Specification")
    target_args.add_argument('targets', action='store', nargs='*',
        metavar='target',
        help=("""Targets to test.  Any number of targets may be specified.  If
        blank, then discover all testcases in the current directory tree.  Can
        be a directory (or package), file (or module), or fully-qualified
        'dotted name' like proj.tests.test_things.TestStuff.  If a directory
        (or package) is specified, then we will attempt to discover all tests
        under the directory (even if the directory is a package and the tests
        would not be accessible through the package's scope).  In all other
        cases, only tests accessible from introspection of the object will
        be loaded."""),
        default=argparse.SUPPRESS)

    concurrency_args = parser.add_argument_group("Concurrency Options")
    store_opt(
        concurrency_args.add_argument('-s', '--processes', action='store',
            type=int, metavar='NUM',
            help="Number of processes to use to run tests.  Note that your "
            "tests need to be written to avoid using the same resources (temp "
            "files, sockets, ports, etc.) for the multi-process mode to work "
            "well (--initializer and --finalizer can help provision "
            "per-process resources). Default is to run the same number of "
            "processes as your machine has logical CPUs. Note that for a "
            "small number of trivial tests, running everything in a single "
            "process may be faster than the overhead of initializing all the "
            "processes.",
            default=argparse.SUPPRESS))
    store_opt(
        concurrency_args.add_argument('-i', '--initializer', action='store',
            metavar='DOTTED_FUNCTION',
            help="Python function to run inside of a single worker process "
            "before it starts running tests.  This is the way to provision "
            "external resources that each concurrent worker process needs to "
            "have exclusive access to. Specify the function in dotted "
            "notation in a way that will be importable from the location you "
            "are running green from.",
            default=argparse.SUPPRESS))
    store_opt(
        concurrency_args.add_argument('-z', '--finalizer', action='store',
            metavar='DOTTED_FUNCTION',
            help="Same as --initializer, only run at the end of a worker "
            "process's lifetime.  Used to unprovision resources provisioned by "
            "the initializer.",
            default=argparse.SUPPRESS))

    format_args = parser.add_argument_group("Format Options")
    store_opt(format_args.add_argument('-t', '--termcolor', action='store_true',
        help="Force terminal colors on.  Default is to autodetect.",
        default=argparse.SUPPRESS))
    store_opt(
        format_args.add_argument('-T', '--notermcolor', action='store_true',
        help="Force terminal colors off.  Default is to autodetect.",
        default=argparse.SUPPRESS))
    store_opt(
        format_args.add_argument('-W', '--disable-windows', action='store_true',
        help="Disable Windows support by turning off Colorama",
        default=argparse.SUPPRESS))

    out_args = parser.add_argument_group("Output Options")
    store_opt(out_args.add_argument('-a', '--allow-stdout', action='store_true',
        help=("Instead of capturing the stdout and stderr and presenting it "
        "in the summary of results, let it come through."),
        default=argparse.SUPPRESS))
    store_opt(out_args.add_argument('-q', '--quiet-stdout', action='store_true',
        help=("Instead of capturing the stdout and stderr and presenting it "
        "in the summary of results, discard it completly for successful "
        "tests. --allow-stdout option overrides it."),
        default=argparse.SUPPRESS))
    store_opt(out_args.add_argument('-k', '--no-skip-report',
        action='store_true', help=("Don't print the report of skipped tests "
        "after testing is done.  Skips will still show up in the progress "
        "report and summary count."),
        default=argparse.SUPPRESS))
    store_opt(out_args.add_argument('-e', '--no-tracebacks',
        action='store_true', help=("Don't print tracebacks for failures and "
        "errors."),
        default=argparse.SUPPRESS))
    store_opt(out_args.add_argument('-h', '--help', action='store_true',
        help="Show this help message and exit.",
        default=argparse.SUPPRESS))
    store_opt(out_args.add_argument('-V', '--version', action='store_true',
        help="Print the version of Green and Python and exit.",
        default=argparse.SUPPRESS))
    store_opt(out_args.add_argument('-l', '--logging', action='store_true',
        help="Don't configure the root logger to redirect to /dev/null, "
        "enabling internal debugging output, as well as any output test (or "
        "tested) code may be sending via the root logger.",
        default=argparse.SUPPRESS))
    store_opt(out_args.add_argument('-d', '--debug', action='count',
        help=("Enable internal debugging statements.  Implies --logging.  Can "
        "be specified up to three times for more debug output."),
        default=argparse.SUPPRESS))
    store_opt(out_args.add_argument('-v', '--verbose', action='count',
        help=("Verbose. Can be specified up to three times for more "
        "verbosity. Recommended levels are -v and -vv."),
        default=argparse.SUPPRESS))
    store_opt(out_args.add_argument('-U', '--disable-unidecode', action='store_true',
        help=("Disable unidecode which converts test output from unicode to"
            "ascii by default on Windows to avoid hard-to-debug crashes."),
        default=argparse.SUPPRESS))

    other_args = parser.add_argument_group("Other Options")
    store_opt(other_args.add_argument('-f', '--failfast', action='store_true',
        help=("Stop execution at the first test that fails or errors."),
        default=argparse.SUPPRESS))
    store_opt(other_args.add_argument('-c', '--config', action='store',
        metavar='FILE', help="Use this config file to override any values from "
        "the config file specified by environment variable GREEN_CONFIG, "
        "~/.green, and .green in the current working directory.",
        default=argparse.SUPPRESS))
    store_opt(other_args.add_argument('-p', '--file-pattern', action='store',
        metavar='PATTERN',
        help="Pattern to match test files. Default is test*.py",
        default=argparse.SUPPRESS))
    store_opt(other_args.add_argument('-n', '--test-pattern', action='store',
        metavar='PATTERN', help="Pattern to match test method names after "
        "'test'.  Default is '*', meaning match methods named 'test*'.",
        default=argparse.SUPPRESS))
    store_opt(other_args.add_argument('-j', '--junit-report',
                                      action='store',
                                      metavar="FILENAME",
                                      help=("Generate a JUnit XML report."),
                                      default=argparse.SUPPRESS))

    cov_args = parser.add_argument_group(
        "Coverage Options ({})".format(coverage_version))
    store_opt(cov_args.add_argument('-r', '--run-coverage', action='store_true',
        help=("Produce coverage output."), default=argparse.SUPPRESS))
    store_opt(cov_args.add_argument('-g', '--cov-config-file',
        action='store', metavar='FILE', help=("Specify a coverage config file. "
            "Implies --run-coverage See the coverage documentation "
            "at https://coverage.readthedocs.io/en/v4.5.x/config.html "
            "for coverage config file syntax. The [run] and [report] sections "
            "are most relevant."),
        default=argparse.SUPPRESS)),
    store_opt(cov_args.add_argument('-R', '--quiet-coverage', action='store_true',
        help=("Do not print coverage report to stdout (coverage files will "
            "still be created). Implies --run-coverage"),
        default=argparse.SUPPRESS))
    store_opt(cov_args.add_argument('-O', '--clear-omit', action='store_true',
        help=("Green tries really hard to set up a good list of patterns of "
            "files to omit from coverage reports.  If the default list "
            "catches files that you DO want to cover you can specify this "
            "flag to leave the default list empty to start with.  You can "
            "then add patterns back in with --omit-add. The default list is "
            "something like '*/test*,*/mock*,*(temp dir)*,*(python system "
            "packages)*' -- only longer."),
        default=argparse.SUPPRESS))
    store_opt(cov_args.add_argument('-u', '--include-patterns', action='store',
        metavar='PATTERN',
        help=("Comma-separated file-patterns to include in coverage.  This "
            "implies that anything that does not match the include pattern is "
            "omitted from coverage reporting."),
        default=argparse.SUPPRESS))
    store_opt(cov_args.add_argument('-o', '--omit-patterns', action='store',
        metavar='PATTERN',
        help=("Comma-separated file-patterns to omit from coverage.  For "
            "example, if coverage reported a file mypackage/foo/bar you could "
            "omit it from coverage with 'mypackage*', '*/foo/*', or '*bar'"),
        default=argparse.SUPPRESS))
    store_opt(cov_args.add_argument('-m', '--minimum-coverage', action='store',
        metavar='X', type=int, help=("Integer. A minimum coverage value.  If "
            "not met, then we will print a message and exit with a nonzero "
            "status. Implies --run-coverage"),
        default=argparse.SUPPRESS))

    integration_args = parser.add_argument_group("Integration Options")
    store_opt(integration_args.add_argument('--completion-file',
        action='store_true', help=("Location of the bash- and zsh-completion "
            "file.  To enable bash- or zsh-completion, see ENABLING SHELL "
            "COMPLETION below."), default=argparse.SUPPRESS))
    store_opt(integration_args.add_argument('--completions',
        action='store_true',
        help=("Output possible completions of the given target.  Used by "
        "bash- and zsh-completion."), default=argparse.SUPPRESS))
    store_opt(integration_args.add_argument('--options', action='store_true',
        help="Output all options.  Used by bash- and zsh-completion.",
        default=argparse.SUPPRESS))

    args = parser.parse_args(argv)

    # Add additional members
    args.parser    = parser
    args.store_opt = store_opt

    return args
539490
def get_parser(self, **kwargs):
        
        self.parser = argparse.ArgumentParser(prog=self.prog_name,
                                              description=self._desc,
                                              add_help=False, **kwargs)
        # help is removed because parser.parse_known_args() show help,
        # often partial help. help action will be added during
        # reloading step for parser.parse_args()
        if self.use_config_file:
            self.parser.add_argument('--config-file',
                                     action="store",
                                     help="Other configuration file.")
        return self.parser
1097715
def parse(self, args=None):
        '''
        '''
        opts = dict()

        if args is None:
            import sys
            # skip over the program name with the [1:] slice
            args = sys.argv[1:]

        # arglist is a tuple of (is_flag, name) pairs
        arglist = peekable(parse_tokens(args))
        for is_flag, name in arglist:
            if is_flag is True:
                # .peek will return the default argument iff there are no more entries
                next_is_flag, next_name = arglist.peek(default=(None, None))
                # next_is_flag will be None if there are no more items, but True/False if there is a next item

                # if this argument looks for a subsequent (is set as boolean),
                #   and the subsequent is not a flag, consume it
                if next_is_flag is False:
                    opts[name] = next_name
                    # finally, advance our iterator, but since we already have the next values, just discard it
                    arglist.next()
                else:
                    # if there is no next thing, or the next thing is a flag,
                    #   all the boolean=False's in the world can't save you then
                    opts[name] = True
            else:
                # add positional argument
                opts.setdefault('_', []).append(name)

        return opts
169361
def _create_option_parser(cls):
        """"""
        from optparse import OptionParser, OptionGroup

        parser = OptionParser(
            version=__version__,
            usage='Usage: pydocstyle [options] [<file|dir>...]')

        option = parser.add_option

        # Run configuration options
        option('-e', '--explain', action='store_true', default=False,
               help='show explanation of each error')
        option('-s', '--source', action='store_true', default=False,
               help='show source for each error')
        option('-d', '--debug', action='store_true', default=False,
               help='print debug information')
        option('-v', '--verbose', action='store_true', default=False,
               help='print status information')
        option('--count', action='store_true', default=False,
               help='print total number of errors to stdout')
        option('--config', metavar='<path>', default=None,
               help='use given config file and disable config discovery')

        parser.add_option_group(OptionGroup(
            parser,
            'Note',
            'When using --match, --match-dir or --ignore-decorators consider '
            'whether you should use a single quote (\') or a double quote ("), '
            'depending on your OS, Shell, etc.'))

        check_group = OptionGroup(
            parser,
            'Error Check Options',
            'Only one of --select, --ignore or --convention can be '
            'specified. If none is specified, defaults to '
            '`--convention=pep257`. These three options select the "basic '
            'list" of error codes to check. If you wish to change that list '
            '(for example, if you selected a known convention but wish to '
            'ignore a specific error from it or add a new one) you can '
            'use `--add-[ignore/select]` in order to do so.')
        add_check = check_group.add_option

        # Error check options
        add_check('--select', metavar='<codes>', default=None,
                  help='choose the basic list of checked errors by '
                       'specifying which errors to check for (with a list of '
                       'comma-separated error codes or prefixes). '
                       'for example: --select=D101,D2')
        add_check('--ignore', metavar='<codes>', default=None,
                  help='choose the basic list of checked errors by '
                       'specifying which errors to ignore out of all of the '
                       'available error codes (with a list of '
                       'comma-separated error codes or prefixes). '
                       'for example: --ignore=D101,D2')
        add_check('--convention', metavar='<name>', default=None,
                  help='choose the basic list of checked errors by specifying '
                       'an existing convention. Possible conventions: {}.'
                       .format(', '.join(conventions)))
        add_check('--add-select', metavar='<codes>', default=None,
                  help='add extra error codes to check to the basic list of '
                       'errors previously set by --select, --ignore or '
                       '--convention.')
        add_check('--add-ignore', metavar='<codes>', default=None,
                  help='ignore extra error codes by removing them from the '
                       'basic list previously set by --select, --ignore '
                       'or --convention.')

        parser.add_option_group(check_group)

        # Match clauses
        option('--match', metavar='<pattern>', default=None,
               help=("check only files that exactly match <pattern> regular "
                     "expression; default is --match='{}' which matches "
                     "files that don't start with 'test_' but end with "
                     "'.py'").format(cls.DEFAULT_MATCH_RE))
        option('--match-dir', metavar='<pattern>', default=None,
               help=("search only dirs that exactly match <pattern> regular "
                     "expression; default is --match-dir='{}', which "
                     "matches all dirs that don't start with "
                     "a dot").format(cls.DEFAULT_MATCH_DIR_RE))

        # Decorators
        option('--ignore-decorators', metavar='<decorators>', default=None,
               help=("ignore any functions or methods that are decorated "
                     "by a function with a name fitting the <decorators> "
                     "regular expression; default is --ignore-decorators='{}'"
                     " which does not ignore any decorated functions."
                     .format(cls.DEFAULT_IGNORE_DECORATORS_RE)))

        return parser
68944
def parser(self):
        
        if self._parser is None:
            apkw = {
                'description': self.description,
                'epilog':      self.epilog,
            }
            self._parser = argparse.ArgumentParser(**apkw)

            # For Python 3 add version as a default command
            if self.version:
                self._parser.add_argument(
                    '-v', '--version', action='version',
                    version="%(prog)s {}".format(self.version),
                )

        return self._parser
352270
def parse_arguments():
    
    parser = argparse.ArgumentParser()

    parser.add_argument('file', metavar="FILE", nargs='+',
                        help='file to be made executable')
    parser.add_argument("-p", "--python", metavar="VERSION",
                        help="python version (2 or 3)")
    parser.add_argument('-v', '--version', action='version',
                        version='%(prog)s ' + __version__, help='show version')
    parser.add_argument('-r', '--recursive', action='store_true',
                        help='recursively iterate the directories')

    args = parser.parse_args()
    return args
45855
function(opts, argv, error)
    {
        var parser = new Parser(opts, argv, error);
        return parser.parse();
    }
1087965
def parse_args(argv=None):
    
    parent_parser = get_parent_parser()

    # Main parser
    desc = "Data Version Control"
    parser = DvcParser(
        prog="dvc",
        description=desc,
        parents=[parent_parser],
        formatter_class=argparse.RawTextHelpFormatter,
    )

    # NOTE: On some python versions action='version' prints to stderr
    # instead of stdout https://bugs.python.org/issue18920
    parser.add_argument(
        "-V",
        "--version",
        action=VersionAction,
        nargs=0,
        help="Show program's version.",
    )

    # Sub commands
    subparsers = parser.add_subparsers(
        title="Available Commands",
        metavar="COMMAND",
        dest="cmd",
        help="Use dvc COMMAND --help for command-specific help.",
    )

    fix_subparsers(subparsers)

    for cmd in COMMANDS:
        cmd.add_parser(subparsers, parent_parser)

    args = parser.parse_args(argv)

    return args
334984
def args_parser(self, parser_func: CommandHandler_T) -> CommandHandler_T:
        
        self.cmd.args_parser_func = parser_func
        return parser_func
89491
def parse_command_line_parameters(argv=None):
    
    usage =\
        'usage: %prog [options] input_sequences_filepath'
    version = 'Version: %prog ' + __version__
    parser = OptionParser(usage=usage, version=version)

    parser.add_option('-o', '--output_fp', action='store',
                      type='string', dest='output_fp', help='Path to store ' +
                      'output file [default: generated from input_sequences_filepath]')

    parser.add_option('-c', '--min_confidence', action='store',
                      type='float', dest='min_confidence', help='minimum confidence ' +
                      'level to return a classification [default: %default]')

    parser.set_defaults(verbose=False, min_confidence=0.80)

    opts, args = parser.parse_args(argv)
    if len(args) != 1:
        parser.error('Exactly one argument is required.')

    return opts, args
545945
def parse_known_args():
    
    parser = ArgumentParser()
    parser.add_argument("-l", "--loop", type=int, help="Loop every X seconds")
    parser.add_argument('-V', '--version',
                        action='store_true',
                        dest='version',
                        help='Print the version number and exit')
    parser.add_argument("-u", "--update",
                        action='store_true',
                        dest="update",
                        help="Update the software from online repo")
    parser.add_argument("-p", "--problem",
                        action='store_true',
                        dest="problem",
                        help="Report a problem")
    parser.add_argument("-m", "--memory",
                        action='store_true',
                        dest="memory",
                        help="Run memory tests")
    args, otherthings = parser.parse_known_args()
    return args, otherthings, parser
634053
def parse_options(arguments=None):
    
    if arguments is None:
        arguments = sys.argv[1:]
    if isinstance(arguments, str):
        arguments = arguments.split()
    if isinstance(arguments, argparse.Namespace):
        return arguments
    parser = create_args_parser()
    args = parser.parse_args(arguments)
    # pprint(args.__dict__)

    args.dialect = args.dialect.lower()
    if args.dialect not in ['lisp', 'newlisp', 'clojure', 'scheme', 'all', '']:
        parser.error("`{0}' is not a recognized dialect".format(args.dialect))

    args.backup_dir = os.path.expanduser(args.backup_dir)
    if not os.path.exists(args.backup_dir):
        parser.error("Directory `{0}' does not exist".format(args.backup_dir))

    if len(args.files) > 1 and args.output_file:
        parser.error('Cannot use the -o flag when more than one file is specified')

    if not args.files:
        # Indentation from standard input
        if args.modify and not args.output_file:
            args.modify = False
        args.backup = False
        args.warning = False

    if args.output_diff:
        # If someone requests a diff we assume he/she doesn't want the file to be
        # modified
        args.modify = False

    return args
345604
def make_argparser():
    
    parser = argparse.ArgumentParser(prog='mypolr',
                                     description="Interacts with the Polr Project's API.\n\n"
                                                 "User Guide and documentation: https://mypolr.readthedocs.io",
                                     formatter_class=argparse.ArgumentDefaultsHelpFormatter,
                                     epilog="NOTE: if configurations are saved, they are stored as plain text on disk, "
                                            "and can be read by anyone with access to the file.")
    parser.add_argument("-v", "--version", action="store_true", help="Print version and exit.")

    parser.add_argument("url", nargs='?', default=None, help="The url to process.")

    api_group = parser.add_argument_group('API server arguments',
                                          'Use these for configure the API. Can be stored locally with --save.')

    api_group.add_argument("-s", "--server", default=None, help="Server hosting the API.")
    api_group.add_argument("-k", "--key", default=None, help="API_KEY to authenticate against server.")
    api_group.add_argument("--api-root", default=DEFAULT_API_ROOT,
                           help="API endpoint root.")

    option_group = parser.add_argument_group('Action options',
                                             'Configure the API action to use.')

    option_group.add_argument("-c", "--custom", default=None,
                              help="Custom short url ending.")
    option_group.add_argument("--secret", action="store_true",
                              help="Set option if using secret url.")
    option_group.add_argument("-l", "--lookup", action="store_true",
                              help="Perform lookup action instead of shorten action.")

    manage_group = parser.add_argument_group('Manage credentials',
                                             'Use these to save, delete or update SERVER, KEY and/or '
                                             'API_ROOT locally in ~/.mypolr/config.ini.')

    manage_group.add_argument("--save", action="store_true",
                              help="Save configuration (including credentials) in plaintext(!).")
    manage_group.add_argument("--clear", action="store_true",
                              help="Clear configuration.")
    return parser
775650
def parse_options():
    

    try:
        opts, args = getopt.getopt(sys.argv[1:], 'hms:v', ['help', 'model', 'solver=', 'verbose'])
    except getopt.GetoptError as err:
        sys.stderr.write(str(err).capitalize())
        print_usage()
        sys.exit(1)

    solver = 'g4'
    verbose = 1
    print_model = False

    for opt, arg in opts:
        if opt in ('-h', '--help'):
            print_usage()
            sys.exit(0)
        elif opt in ('-m', '--model'):
            print_model = True
        elif opt in ('-s', '--solver'):
            solver = str(arg)
        elif opt in ('-v', '--verbose'):
            verbose += 1
        else:
            assert False, 'Unhandled option: {0} {1}'.format(opt, arg)

    return print_model, solver, verbose, args
335393
def argv(self, module, argv=sys.argv[1:]):
        '''
        
        '''
        kwargs = {'enabled': False}
        last_priority = {}
        parser = argparse.ArgumentParser(add_help=False)
        # Hack: This allows the ListActionParser class to correllate short options to long options.
        # There is probably a built-in way to do this in the
        # argparse.ArgumentParser class?
        parser.short_to_long = {}

        # Must build arguments from all modules so that:
        #
        #    1) Any conflicting arguments will raise an exception
        #    2) The only unknown arguments will be the target files, making them
        #       easy to identify
        for m in self.list(attribute="CLI"):

            for module_option in m.CLI:

                parser_args = []
                parser_kwargs = {}

                if not module_option.long:
                    continue

                if module_option.short:
                    parser_args.append('-' + module_option.short)
                parser_args.append('--' + module_option.long)
                parser_kwargs['dest'] = module_option.long

                if module_option.type is None:
                    parser_kwargs['action'] = 'store_true'
                elif module_option.type is list:
                    parser_kwargs['action'] = 'append'
                    parser.short_to_long[
                        module_option.short] = module_option.long

                parser.add_argument(*parser_args, **parser_kwargs)

        args, unknown = parser.parse_known_args(argv)
        args = args.__dict__

        # Only add parsed options pertinent to the requested module
        for module_option in module.CLI:

            if module_option.type == binwalk.core.common.BlockFile:

                for k in get_keys(module_option.kwargs):
                    kwargs[k] = []
                    for unk in unknown:
                        kwargs[k].append(unk)

            elif has_key(args, module_option.long) and args[module_option.long] not in [None, False]:

                # Loop through all the kwargs for this command line option
                for (name, default_value) in iterator(module_option.kwargs):

                    # If this kwarg has not been previously processed, or if its priority is equal to or
                    # greater than the previously processed kwarg's priority,
                    # then let's process it.
                    if not has_key(last_priority, name) or last_priority[name] <= module_option.priority:

                        # Track the priority for future iterations that may
                        # process the same kwarg name
                        last_priority[name] = module_option.priority

                        try:
                            kwargs[name] = module_option.convert(args[module_option.long], default_value)
                        except KeyboardInterrupt as e:
                            raise e
                        except Exception as e:
                            raise ModuleException("Invalid usage: %s" % str(e))

        binwalk.core.common.debug("%s :: %s => %s" % (module.TITLE, str(argv), str(kwargs)))
        return kwargs
639117
def parse_args
      options = { :verbose => false, :status => false, :immediately => false }
      parser = Trollop::Parser.new do
        opt :reboot
        opt :stop
        opt :terminate
        opt :immediately
        opt :deferred
        opt :verbose
        version ""
        conflicts :deferred, :immediately
      end

      parse do
        options.merge!(parser.parse)
        options[:level] = ::RightScale::ShutdownRequest::REBOOT if options[:reboot]
        options[:level] = ::RightScale::ShutdownRequest::STOP if options[:stop]
        options[:level] = ::RightScale::ShutdownRequest::TERMINATE if options[:terminate]
        options[:immediately] = false if options[:deferred]
      end
      options
    end
1175269
def parse_args(self, args=None, namespace=None):
        
        if not namespace:  # use the new Namespace class for handling _config
            namespace = Namespace(self)
        namespace = super(ArgumentParser, self).parse_args(args, namespace)
        if len(self._reparse_args['pos']) > 0 or \
           len(self._reparse_args['opt']) > 0 or \
           len(self._reparse_args['sub']) > 0:
            args = self._reset_args()
            namespace = super(ArgumentParser, self).parse_args(args, namespace)
        # process "-hh..." here, after having parsed the arguments
        help_level = getattr(namespace, "help", 0)
        if help_level > 0:
            self.print_help()
            self.print_extended_help(help_level)
            self.exit()
        return namespace