Returns an argparse.ArgumentParser instance to parse the command line
    arguments for lk
348018
def build_parser():
    
    import argparse
    description = "A programmer's search tool, parallel and fast"
    parser = argparse.ArgumentParser(description=description)
    parser.add_argument('pattern', metavar='PATTERN', action='store',
                        help='a python re regular expression')
    parser.add_argument('--ignore-case', '-i',  dest='ignorecase', action='store_true',
                        default=False, help='ignore case when searching')
    parser.add_argument('--no-unicode', '-u', dest='unicode', action='store_false',
                        default=True, help='unicode-unfriendly searching')
    parser.add_argument('--no-multiline', '-l', dest='multiline',
                        action='store_false', default=True,
                        help='don\'t search over multiple lines')
    parser.add_argument('--dot-all', '-a', dest='dot_all',
                        action='store_true', default=False,
                        help='dot in PATTERN matches newline')
    parser.add_argument('--escape', '-e', dest='escape',
                        action='store_true', default=False,
                        help='treat PATTERN as a string instead of a regex')

    if sys.version_info >= (2, 6):
        parser.add_argument('--follow-links', '-s', dest='follow_links',
                            action='store_true', default=False,
                            help='follow symlinks (Python >= 2.6 only)')
    parser.add_argument('--hidden', '-n', dest='search_hidden',
                        action='store_true', default=False,
                        help='search hidden files and directories')
    parser.add_argument('--binary', '-b', dest='search_binary',
                        action='store_true', default=False,
                        help='search binary files')
    parser.add_argument('--no-colors', '-c', dest='use_ansi_colors',
                        action='store_false', default=True,
                        help="don't print ANSI colors")
    parser.add_argument('--stats', '-t', dest='print_stats',
                        action='store_true', default=False,
                        help='print statistics')
    parser.add_argument('--num-processes', '-p', dest='number_processes',
                        action='store', default=10, type=int,
                        help='number of child processes to concurrently search with')
    parser.add_argument('--exclude', '-x', metavar='PATH_PATTERN', dest='exclude_path_patterns',
                        action='append', default=[], type=str,
                        help='exclude paths matching PATH_PATTERN')
    parser.add_argument('--open-with', '-o', metavar='COMMAND',
                        dest='command_strings', action='append', default=[],
                        type=str,
                        help='run each COMMAND where COMMAND is a string with a placeholder, %%s, for the absolute path of the matched file')
    parser.add_argument('directory', metavar='DIRECTORY', nargs='?',
                        default=getcwd(), help='a directory to search in (default cwd)')
    return parser
1025511
def _parse_args(arg):
    '''
    
    '''
    yaml_args = salt.utils.args.yamlify_arg(arg)

    if yaml_args is None:
        return []
    elif not isinstance(yaml_args, list):
        return [yaml_args]
    else:
        return yaml_args
1035375
def parse_command_line():
    

    import argparse

    parser = argparse.ArgumentParser(description=__doc__.split("\n")[0])
    parser.add_argument('-v',
                        '--version',
                        action='version',
                        version='%(prog)s ' + __version__,
                        help="Show version number and exit.")
    parser.add_argument('input_filename',
                        metavar='INPUT_FILE',
                        type=str,
                        help='Path of the input file to be preprocessed')
    parser.add_argument('-q',
                        '--quiet',
                        dest='should_be_quiet',
                        action='store_true',
                        default=False,
                        help="Disables verbose logging")
    parser.add_argument('-L',
                        '--log-level',
                        '--logging-level',
                        dest='logging_level',
                        choices=[
                            'DEBUG',
                            'INFO',
                            'WARNING',
                            'ERROR',
                            'CRITICAL',
                            'NONE',
                            ],
                        default='INFO',
                        help="Logging level.")
    parser.add_argument('-o',
                        '--output',
                        metavar="OUTPUT_FILE",
                        dest='output_filename',
                        default=None,
                        help='Output file name (default STDOUT)')
    parser.add_argument('-f',
                        '--force',
                        dest='should_force_overwrite',
                        action='store_true',
                        default=False,
                        help='Force overwrite existing output file.')
    parser.add_argument('-D',
                        '--define',
                        metavar="EXPR",
                        dest='definitions',
                        action='append',
                        help="""\
Define a variable for preprocessing. <define>
can simply be a variable name (in which case it
will be true) or it can be of the form
<var>=<val>. An attempt will be made to convert
<val> to an integer so -D 'FOO=0' will create a
false value.""")
    parser.add_argument('-I',
                        '--include',
                        metavar="DIR_PATH",
                        dest='include_paths',
                        action='append',
                        default=['.'],
                        help='Add a directory to the include path for #include directives.')
    parser.add_argument('-k',
                        '--keep-lines',
                        dest='should_keep_lines',
                        action='store_true',
                        default=False,
                        help='''\
Emit empty lines for preprocessor statement
lines and skipped output lines. This allows line
numbers to stay constant.''')
    parser.add_argument('-s',
                        '--substitute',
                        dest='should_substitute',
                        action='store_true',
                        default=False,
                        help='''\
Substitute #defines into emitted lines.
(Disabled by default to avoid polluting strings)''')
    parser.add_argument('--default-content-type',
                        metavar="CONTENT_TYPE",
                        dest='default_content_type',
                        default=None,
                        help='If the content type of the file cannot be determined this will be used. (Default: an error is raised)')
    parser.add_argument('-c',
                        '--content-types-path',
                        '--content-types-config',
                        metavar="PATH",
                        dest='content_types_config_files',
                        default=[],
                        action='append',
                        help="""\
Specify a path to a content.types file to assist
with file type determination. Use the -p or -P flags
to display content types as read by pepe.""")
    parser.add_argument('-p',
                        '--print-content-types',
                        dest='should_print_content_types',
                        action='store_true',
                        default=False,
                        help='Display content types and exit.')
    parser.add_argument('-P',
                        '--print-content-types-config',
                        dest='should_print_content_types_config',
                        action='store_true',
                        default=False,
                        help='Display content types configuration and exit.')
    return parser.parse_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
540121
def parse(self, *args, **kwargs):  # pylint: disable=unused-argument
        
        # pylint: disable=W0703
        cmd = args[0]
        resp = args[1]
        if cmd in self.parsers:
            try:
                return self.parsers[cmd](resp)
            except Exception as err:
                print(err)
        return {}
684273
def argparser():
    
    parser = argparse.ArgumentParser(description=__description__)
    sparser = parser.add_subparsers()
    add_cookbook_mgmt_options(sparser)
    add_role_options(sparser)
    add_github_hook_options(sparser)
    add_jenkins_job_options(sparser)
    return parser
531015
def parse_arguments():
    

    parser = argparse.ArgumentParser()

    # Add options
    parser.add_argument(
        "-n", "--number", action="store", default=1000000, type=int,
        help="number of items")
    parser.add_argument(
        "-p", "--pause", action="store_true", help="pause after execution")

    # Parse command line
    return parser.parse_args(), parser
1153882
def parse_arguments(args=None):
    
    parser = get_argument_parser()

    # Autocomplete arguments
    autocomplete(parser)

    ns = parser.parse_args(args=args)
    return ArgumentSettings(
        program=ArgumentProgramSettings(
            log=ArgumentLogSettings(
                path=None,
                level=ns.loglevel,
            ),
            settings=ArgumentSettingsSettings(
                path=ns.settings_path,
            ),
            client=ArgumentClientSettings(
                type=ns.client_type,
                cli=ArgumentClientCliSettings(
                    interactive=False,
                ),
                gui=ArgumentClientGuiSettings(
                ),
            ),
        ),
        search=ArgumentSearchSettings(
            recursive=ns.recursive,
            working_directory=ns.video_path,
        ),
        filter=FilterSettings(
            languages=ns.languages,
        ),
        download=DownloadSettings(
            rename_strategy=ns.rename_strategy,
        ),
        providers=ns.providers,
        proxy=ns.proxy,
        test=ns.test,
    )
1255202
def _parse_args():
    """"""
    import argparse
    parser = argparse.ArgumentParser(description='Keylogger for Linux + X11')
    arg = parser.add_argument
    arg('-s', '--sleep-time', type=float, help='seconds between iterations')
    arg('-t', '--transform', choices=['spanish', 'english_usa', 'pt_br'])
    arg('-f', '--file')
    arg('-l', '--line-buffering', action='store_true')
    args = parser.parse_args()
    return args
584424
def default_tool_argparser(description, example_parameters):
    
    import argparse
    epilog = '\n'
    for k, v in sorted(example_parameters.items()):
        epilog += '  ' + k + '\n'
    p = argparse.ArgumentParser(
        description=description,
        add_help=False,
        formatter_class=argparse.RawDescriptionHelpFormatter,
        epilog=('available values for examples (exkey):'+epilog))
    return p
460696
def parse_args_kwargs(self, *args, **kwargs):
        ''''''
        # unpack the arginfo
        keys, defdict = self.arginfo
        assigned = keys[:len(args)]
        not_assigned = keys[len(args):]

        # validate kwargs
        for key in kwargs:
            assert key not in assigned
            assert key in keys

        # integrate args and kwargs
        knowns = dict(defdict, **kwargs)
        parsed_args = args + tuple([knowns[key] for key in not_assigned])
        return parsed_args
1110330
def parse_args(args=None):
    
    parser = argparse.ArgumentParser(description="Main script to run LIVVkit.",
                                     formatter_class=argparse.ArgumentDefaultsHelpFormatter,
                                     fromfile_prefix_chars='@')

    parser.add_argument('-o', '--out-dir',
                        default=os.path.join(os.getcwd(), "vv_" + time.strftime("%Y-%m-%d")),
                        help='Location to output the LIVVkit webpages.'
                        )

    parser.add_argument('-v', '--verify',
                        nargs=2,
                        default=None,
                        help=' '.join(['Specify the locations of the test and bench bundle to',
                                       'compare (respectively).'
                                       ])
                        )

    parser.add_argument('-V', '--validate',
                        action='store',
                        nargs='+',
                        default=None,
                        help=' '.join(['Specify the location of the configuration files for',
                                       'validation tests.'
                                       ])
                        )

    # FIXME: this just short-circuits to the validation option, and should become its own module
    parser.add_argument('-e', '--extension',
                        action='store',
                        nargs='+',
                        default=None,
                        dest='validate',
                        metavar='EXTENSION',
                        help=' '.join(['Specify the location of the configuration files for',
                                       'LIVVkit extensions.'
                                       ])
                        )

    parser.add_argument('-p', '--publish',
                        action='store_true',
                        help=' '.join(['Also produce a publication quality copy of the figure in',
                                       'the output directory (eps, 600d pi).'
                                       ])
                        )

    parser.add_argument('-s', '--serve',
                        nargs='?', type=int, const=8000,
                        help=' '.join(['Start a simple HTTP server for the output website specified',
                                       'by OUT_DIR on port SERVE.'
                                       ])
                        )

    parser.add_argument('--version',
                        action='version',
                        version='LIVVkit {}'.format(livvkit.__version__),
                        help="Show LIVVkit's version number and exit"
                        )

    return init(parser.parse_args(args))
671169
def args(self):
        """"""
        if self._args is None:
            parser = self._build_parser()
            self._args = parser.parse_args()
        return self._args
475897
def _parse_args(args, cls):
    
    
    d = _create_djset(args, cls)
    
    key_value_pair = args.get('<key>=<value>')
    key = args.get('<key>')
    func = None
    if args.get('add') and key_value_pair:
        fargs = tuple(args.get('<key>=<value>').split('='))
        if fargs[1]:
            func = d.set
    elif args.get('remove') and key:
        func = d.remove
        fargs = (args.get('<key>'),)
    kwargs = {'glob': args.get('--global')}
    if func:
        return func, fargs, kwargs
    else:
        return None, None, None
1194816
def parse_arguments():
    """"""
    parser = create_parser()
    args = parser.parse_args()
    if not args.role_requirements_old_commit:
        args.role_requirements_old_commit = args.role_requirements
    if not args.rpc_product_old_commit:
        args.rpc_product_old_commit = args.rpc_product
    return args
304987
def parse_args():
    
    parser = argparse.ArgumentParser()
    parser.add_argument('--lint',
                        help='Path to the ADT lint tool. If not specified it assumes lint tool is in your path',
                        default='lint')
    parser.add_argument('--app',
                        help='Path to the Android app. If not specifies it assumes current directory is your Android '
                             'app directory',
                        default='.')
    parser.add_argument('--xml',
                        help='Path to the lint result. If not specifies linting will be done by the script',
                        default=None)
    parser.add_argument('--ignore-layouts',
                        help='Should ignore layouts',
                        action='store_true')
    args = parser.parse_args()
    return args.lint, args.app, args.xml, args.ignore_layouts
1355935
def parse_args(argv):
    """"""
    parser = make_parser()

    opts, args = parser.parse_args(argv[1:])

    # Use APPENGINEPY_SDK_VERSION if set.
    if not args and (sdk_version_key in os.environ):
        args = (os.environ[sdk_version_key],)

    return opts, args