Get a parser that is able to parse program arguments.
    :return: instance of arparse.ArgumentParser
502939
def get_argument_parser():
    
    parser = argparse.ArgumentParser(description=project.get_description(),
                                     epilog=_('Visit us at {website}.').format(website=project.WEBSITE_MAIN))

    parser.add_argument('--version', action='version',
                        version='{project} {version}'.format(project=project.PROJECT_TITLE,
                                                             version=project.PROJECT_VERSION_STR))
    parser.add_argument('-T', '--test', dest='test',
                        action='store_true', default=False,
                        help=argparse.SUPPRESS)
    parser.add_argument('-V', '--video', dest='video_path', default=None, metavar='PATH',
                        nargs=argparse.ONE_OR_MORE, action=PathsAction,
                        help=_('Full path to your video(s).'))
    parser.add_argument('-s', '--settings', dest='settings_path', type=Path, default=None, metavar='FILE',
                        help=_('Set the settings file.'))
    parser.add_argument('-l', '--lang', dest='languages', metavar='LANGUAGE',
                        default=[UnknownLanguage.create_generic()],
                        nargs=argparse.ONE_OR_MORE, action=LanguagesAction,
                        help=_('Set the preferred subtitle language(s) for download and upload.'))

    # interface options
    interface_group = parser.add_argument_group(_('interface'), _('Change settings of the interface'))
    guicli = interface_group.add_mutually_exclusive_group()
    guicli.add_argument('-g', '--gui', dest='client_type',
                        action='store_const', const=ClientType.GUI,
                        help=_('Run application in GUI mode. This is the default.'))
    guicli.add_argument('-c', '--cli', dest='client_type',
                        action='store_const', const=ClientType.CLI,
                        help=_('Run application in CLI mode.'))
    parser.set_defaults(client_type=ClientType.GUI)

    # logger options
    loggroup = parser.add_argument_group(_('logging'), _('Change the amount of logging done.'))
    loglvlex = loggroup.add_mutually_exclusive_group()
    loglvlex.add_argument('-d', '--debug', dest='loglevel',
                          action='store_const', const=logging.DEBUG,
                          help=_('Print log messages of debug severity and higher to stderr.'))
    loglvlex.add_argument('-w', '--warning', dest='loglevel',
                          action='store_const', const=logging.WARNING,
                          help=_('Print log messages of warning severity and higher to stderr. This is the default.'))
    loglvlex.add_argument('-e', '--error', dest='loglevel',
                          action='store_const', const=logging.ERROR,
                          help=_('Print log messages of error severity and higher to stderr.'))
    loglvlex.add_argument('-q', '--quiet', dest='loglevel',
                          action='store_const', const=LOGGING_LOGNOTHING,
                          help=_('Don\'t log anything to stderr.'))
    loggroup.set_defaults(loglevel=logging.WARNING)

    loggroup.add_argument('--log', dest='logfile', metavar='FILE', type=Path,
                          default=None, help=_('Path name of the log file.'))

    # cli options
    cli_group = parser.add_argument_group(_('cli'), _('Change the behavior of the command line interface.'))
    cli_group.add_argument('-i', '--interactive', dest='interactive',
                           action='store_true', default=False,
                           help=_('Prompt user when decisions need to be done.'))
    cli_group.add_argument('-r', '--recursive', dest='recursive',
                           action='store_true', default=False,
                           help=_('Search for subtitles recursively.'))

    operation_group = cli_group.add_mutually_exclusive_group()
    operation_group.add_argument('-D', '--download', dest='operation', action='store_const', const=CliAction.DOWNLOAD,
                                 help=_('Download subtitle(s). This is the default.'))
    operation_group.add_argument('-U', '--upload', dest='operation', action='store_const', const=CliAction.UPLOAD,
                                 help=_('Upload subtitle(s).'))
    # operation_group.add_argument('-L', '--list', dest='operation', action='store_const', const=CliAction.LIST,
    #                              help=_('List available subtitle(s) without downloading.'))
    parser.set_defaults(operation=CliAction.DOWNLOAD)

    rename_group = cli_group.add_mutually_exclusive_group()
    rename_group.add_argument('--rename-online', dest='rename_strategy', action='store_const',
                              const=SubtitleRenameStrategy.ONLINE,
                              help=_('Use the on-line subtitle filename as name for the downloaded subtitles. '
                                     'This is the default.'))
    rename_group.add_argument('--rename-video', dest='rename_strategy', action='store_const',
                              const=SubtitleRenameStrategy.VIDEO,
                              help=_('Use the local video filename as name for the downloaded subtitle.'))
    rename_group.add_argument('--rename-lang', dest='rename_strategy', action='store_const',
                              const=SubtitleRenameStrategy.VIDEO_LANG,
                              help=_('Use the local video filename + language as name for the downloaded subtitle.'))
    rename_group.add_argument('--rename-uploader', dest='rename_strategy', action='store_const',
                              const=SubtitleRenameStrategy.VIDEO_LANG_UPLOADER,
                              help=_('Use the local video filename + uploader + language '
                                     'as name for the downloaded subtitle.'))
    parser.set_defaults(rename_strategy=SubtitleRenameStrategy.ONLINE)

    # online options
    online_group = parser.add_argument_group('online', 'Change parameters related to the online provider.')
    online_group.add_argument('-P', '--proxy', dest='proxy', default=None, action=ProxyAction,
                              help=_('Proxy to use on internet connections.'))
    online_group.add_argument('--provider', dest='providers', metavar='NAME [KEY1=VALUE1 [KEY2=VALUE2 [...]]]',
                              nargs=argparse.ONE_OR_MORE, default=None, action=ProviderAction,
                              help=_('Enable and configure a provider.'))

    return parser
1099305
def parse(self, arguments=None):
        
        arguments = self.arguments or arguments
        # FIXME: prep/normalize arguments in __init__
        # Split arguments if given as string and run the parser
        if isinstance(arguments, basestring):
            arguments = utils.split(arguments)

        # run the wrapped argparser command to gather user set arg values
        # FROM: https://docs.python.org/3/library/argparse.html
        # Sometimes a script may only parse a few of the command-line
        # arguments, passing the remaining arguments on to another script or
        # program.  In these cases, the parse_known_args() method can be
        # useful. It works much like parse_args() except that it does not
        # produce an error when extra arguments are present. Instead, it
        # returns a two item tuple containing the populated namespace and
        # the list of remaining argument strings.
        opts, _arguments = self.parser.parse_known_args(arguments)

        if not opts.config_file:
            opts.config_file = os.path.expanduser(DEFAULT_IDID_CONFIG)
        opts.config = Configuration().from_file(opts.config_file)
        # alias shortcut
        self.config = opts.config

        # if we're passing arguments in as a string we might get \n's or null
        # strings '' that we want to be sure to ignore
        _arguments = filter(
            lambda x: x if x else None, [_.strip() for _ in _arguments if _])

        # Now let the subclass parse the remaining special opts that
        # weren't consumed by default argparser
        opts = self._parse(opts, _arguments)

        return opts
222641
def get_parser(self):
        
        parser = self.parser_cls(prog=self.prog_name, usage=self.get_usage(),
            stream=self.stderr)
        subparsers = parser.add_subparsers(
            title='subcommands',
        )
        for name, command in self.registry.items():
            cmdparser = subparsers.add_parser(name, help=command.help)
            for argument in command.get_args():
                cmdparser.add_argument(*argument.args, **argument.kwargs)
            command.setup_parser(parser, cmdparser)
            cmdparser.set_defaults(func=command.handle)

        return parser
692076
def parse_args(args=None):
    """"""
    parser = argparse.ArgumentParser()

    parser.add_argument(
        '-w', '--window',
        default="pyqt5",
        choices=find_window_classes(),
        help='Name for the window type to use',
    )
    parser.add_argument(
        '-fs', '--fullscreen',
        action="store_true",
        help='Open the window in fullscreen mode',
    )
    parser.add_argument(
        '-vs', '--vsync',
        type=str2bool,
        default="1",
        help="Enable or disable vsync",
    )
    parser.add_argument(
        '-s', '--samples',
        type=int,
        default=4,
        help="Specify the desired number of samples to use for multisampling",
    )
    parser.add_argument(
        '-c', '--cursor',
        type=str2bool,
        default="true",
        help="Enable or disable displaying the mouse cursor",
    )

    return parser.parse_args(args or sys.argv[1:])
769216
def _parse_args(cls):
        
        cls.parser = argparse.ArgumentParser()
        cls.parser.add_argument(
            "symbol", help="Symbol for horizontal line", nargs="*")
        cls.parser.add_argument(
            "--color", "-c", help="Color of the line", default=None, nargs=1)
        cls.parser.add_argument(
            "--version", "-v", action="version", version="0.13")

        return cls.parser
816241
def get_parser(self, prog_name, subcommand):
        
        parser = OptionParser(
            prog=prog_name,
            usage=self.usage(subcommand),
            version=self.get_version(),
            option_list=sorted(self.get_option_list()))
        return parser
1024405
def getParser():
    ""
    parser = argparse.ArgumentParser(formatter_class=argparse.RawDescriptionHelpFormatter,
                                     description=__description__)
    parser.add_argument('output', help='Target volume.')
    parser.add_argument('inputs', nargs='+', help='Source volume(s).')
    parser.add_argument('-o', '--operation', dest='operation', choices=['sum', 'avg', 'max', 'min'], default='avg', help='Combinatorial operation to conduct.')
    parser.add_argument('-v', dest='verbose', action='store_true', help='Display more information.')
    parser.add_argument('-d', dest='debug', action='store_true', help='Display debug information.')
    parser.add_argument('-f', dest='force', action='store_true', help='Silently override existing output images.')
    return parser
87487
def get_parser(self):
        
        self.path = None
        self.anony_defs = []
        self.exhausted = False
        return self
214302
def _create_argument_parser(self):
        
        parser = self._new_argument_parser()
        self._add_base_arguments(parser)
        self._add_required_arguments(parser)
        return parser
939861
def get_parser():
    
    parser = argparse.ArgumentParser(
        formatter_class=argparse.RawTextHelpFormatter,
        description=__doc__,
    )

    # connection to redis server
    parser.add_argument('--host', default='localhost')
    parser.add_argument('--port', default=6379, type=int)
    parser.add_argument('--db', default=0, type=int)

    # tools
    parser.add_argument('command', choices=(str('follow'), str('lock'),
                                            str('reset'), str('status')))
    parser.add_argument('resources', nargs='*', metavar='RESOURCE')

    return parser
61695
def _get_arguments():  # pragma: no cover
    
    LOG.debug('Parse command line argument')
    parser = argparse.ArgumentParser(
        description='Command line interface for the MQ² program')

    parser.add_argument(
        '-z', '--zipfile', dest='inputzip', default=None,
        help='Zip file containing the input files.')
    parser.add_argument(
        '-d', '--dir', dest='inputdir', default=None,
        help='Path to a local folder containing the input files.')
    parser.add_argument(
        '-f', '--file', dest='inputfile', default=None,
        help='Path to a local input file.')

    parser.add_argument(
        '--lod', default=3,
        help='LOD threshold to use to assess the significance of a LOD \
        value for a QTL.')

    parser.add_argument(
        '--session', default=None,
        help='Session to analyze if required.')

    parser.add_argument(
        '--verbose', action='store_true',
        help="Gives more info about what's going on")
    parser.add_argument(
        '--debug', action='store_true',
        help="Outputs debugging information")
    parser.add_argument(
        '--version', action='version',
        version='MQ² version: %s' % __version__)
    return parser.parse_args()
986689
def _get_args(self, *args) -> (Exception, str):
        
        ex = None
        msg = None
        for arg in args:
            if isinstance(arg, str):
                msg = arg
            elif isinstance(arg, Exception):
                ex = arg
        return ex, msg
268753
def get_parser():
    """"""

    main_parser = argparse.ArgumentParser(
        formatter_class=argparse.RawTextHelpFormatter)

    main_parser.add_argument(
        '-c', '--config',
        dest='config',
        type=str,
        nargs='?',
        help='Pull the latest repositories from config(s)'
    ).completer = argcomplete.completers.FilesCompleter(
        allowednames=('.yaml', '.yml', '.json'), directories=False
    )

    main_parser.add_argument(
        '-p', '--push',
        dest='do_push',
        action='store_true', default=False,
        help='Push result to target',
    )

    main_parser.add_argument(
        '-d', '--dirmatch',
        dest='dirmatch',
        type=str,
        nargs='?',
        help='Pull only from the directories. Accepts fnmatch(1)'
             'by commands'
    )
    main_parser.add_argument(
        '--log-level',
        default='INFO',
        dest='log_level',
        type=_log_level_string_to_int,
        nargs='?',
        help='Set the logging output level. {0}'.format(_LOG_LEVEL_STRINGS))

    main_parser.add_argument(
        '-e', '--expand-env',
        dest='expand_env',
        default=False,
        action='store_true',
        help='Expand environment variables in configuration file',
    )
    main_parser.add_argument(
        '-f', '--force',
        dest='force',
        default=False,
        action='store_true',
        help='Force cleanup and aggregation on dirty repositories.',
    )

    main_parser.add_argument(
        '-j', '--jobs',
        dest='jobs',
        default=1,
        type=int,
        help='Amount of processes to use when aggregating repos. '
             'This is useful when there are a lot of large repos. '
             'Set `1` or less to disable multiprocessing (default).',
    )

    main_parser.add_argument(
        'command',
        nargs='?',
        default='aggregate',
        help='aggregate (default): run the aggregation process.\n'
             'show-all-prs: show GitHub pull requests in merge sections\n'
             '              such pull requests are indentified as having\n'
             '              a github.com remote and a\n'
             '              refs/pull/NNN/head ref in the merge section.\n'
             'show-closed-prs: show pull requests that are not open anymore.\n'
    )

    return main_parser
775644
def new_parser(self):
        

        parser = argparse.ArgumentParser(description=self.description)
        parser.add_argument(
            '--version', help='show version and exit',
            default=False, action='store_true')
        parser.add_argument(
            '--debug', help='enable debugging',
            default=False, action='store_true')
        return parser
872961
def get_parser():
    """"""
    parser = argparse.ArgumentParser(
        allow_abbrev=True,
        description='pypyr pipeline runner')
    parser.add_argument('pipeline_name',
                        help='Name of pipeline to run. It should exist in the '
                        './pipelines directory.')
    parser.add_argument(dest='pipeline_context',
                        nargs='?',
                        help='String for context values. Parsed by the '
                        'pipeline\'s context_parser function.')
    parser.add_argument('--dir', dest='working_dir', default=os.getcwd(),
                        help='Working directory. Use if your pipelines '
                        'directory is elsewhere. Defaults to cwd.')
    parser.add_argument('--log', '--loglevel', dest='log_level', type=int,
                        default=20,
                        help='Integer log level. Defaults to 20 (INFO). '
                        '10=DEBUG\n20=INFO\n30=WARNING\n40=ERROR\n50=CRITICAL'
                        '.\n Log Level < 10 gives full traceback on errors.')
    parser.add_argument('--logpath', dest='log_path',
                        help='Log-file path. Append log output to this path')
    parser.add_argument('--version', action='version',
                        help='Echo version number.',
                        version=f'{pypyr.version.get_version()}')
    return parser
334984
def args_parser(self, parser_func: CommandHandler_T) -> CommandHandler_T:
        
        self.cmd.args_parser_func = parser_func
        return parser_func
937318
def get_args():
        

        parser = build_parser()
        args = vars(parser.parse_args())

        # Overwrite the deprecated "-l" option into the link variable
        if args['link_deprecated'] and args['link'] is None:
            args['link'] = args['link_deprecated']
        args.pop('link_deprecated', None)

        # Filter out argument values that weren't supplied
        return {key: val for key, val in args.items() if val is not None}