Return the command-line parser
187113
def get_parser():
    '''  '''
    parser = argparse.ArgumentParser(
        description="Reverse, undo, and calculate CRC32 checksums")
    subparsers = parser.add_subparsers(metavar='action')

    poly_flip_parser = argparse.ArgumentParser(add_help=False)
    subparser_group = poly_flip_parser.add_mutually_exclusive_group()
    subparser_group.add_argument(
        '-m', '--msbit', dest="msb", action='store_true',
        help='treat the polynomial as normal (msbit-first)')
    subparser_group.add_argument('-l', '--lsbit', action='store_false',
                                 help='treat the polynomial as reversed (lsbit-first) [default]')

    desired_poly_parser = argparse.ArgumentParser(add_help=False)
    desired_poly_parser.add_argument(
        'desired', type=str, help='[int] desired checksum')

    default_poly_parser = argparse.ArgumentParser(add_help=False)
    default_poly_parser.add_argument(
        'poly', default='0xEDB88320', type=str, nargs='?',
        help='[int] polynomial [default: 0xEDB88320]')

    accum_parser = argparse.ArgumentParser(add_help=False)
    accum_parser.add_argument(
        'accum', type=str, help='[int] accumulator (final checksum)')

    default_accum_parser = argparse.ArgumentParser(add_help=False)
    default_accum_parser.add_argument(
        'accum', default='0', type=str, nargs='?',
        help='[int] starting accumulator [default: 0]')

    outfile_parser = argparse.ArgumentParser(add_help=False)
    outfile_parser.add_argument('-o', '--outfile',
                                metavar="f",
                                type=argparse.FileType('w'),
                                default=sys.stdout,
                                help="Output to a file instead of stdout")

    infile_parser = argparse.ArgumentParser(add_help=False)
    subparser_group = infile_parser.add_mutually_exclusive_group()
    subparser_group.add_argument('-i', '--infile',
                                 metavar="f",
                                 type=argparse.FileType('rb'),
                                 default=sys.stdin,
                                 help="Input from a file instead of stdin")
    subparser_group.add_argument('-s', '--str',
                                 metavar="s",
                                 type=str,
                                 default='',
                                 dest='instr',
                                 help="Use a string as input")

    subparser = subparsers.add_parser('flip', parents=[outfile_parser],
                                      help="flip the bits to convert normal(msbit-first) polynomials to reversed (lsbit-first) and vice versa")
    subparser.add_argument('poly', type=str, help='[int] polynomial')
    subparser.set_defaults(
        func=lambda: print_num(reverseBits(parse_dword(args.poly))))

    subparser = subparsers.add_parser('reciprocal', parents=[outfile_parser],
                                      help="find the reciprocal (Koopman notation) of a reversed (lsbit-first) polynomial and vice versa")
    subparser.add_argument('poly', type=str, help='[int] polynomial')
    subparser.set_defaults(func=reciprocal_callback)

    subparser = subparsers.add_parser('table', parents=[outfile_parser,
                                                        poly_flip_parser,
                                                        default_poly_parser],
                                      help="generate a lookup table for a polynomial")
    subparser.set_defaults(func=table_callback)

    subparser = subparsers.add_parser('reverse', parents=[
        outfile_parser,
        poly_flip_parser,
        desired_poly_parser,
        default_accum_parser,
        default_poly_parser],
        help="find a patch that causes the CRC32 checksum to become a desired value")
    subparser.set_defaults(func=reverse_callback)

    subparser = subparsers.add_parser('undo', parents=[
        outfile_parser,
        poly_flip_parser,
        accum_parser,
        default_poly_parser,
        infile_parser],
        help="rewind a CRC32 checksum")
    subparser.add_argument('-n', '--len', metavar='l', type=str,
                           default='0', help='[int] number of bytes to rewind [default: 0]')
    subparser.set_defaults(func=undo_callback)

    subparser = subparsers.add_parser('calc', parents=[
        outfile_parser,
        poly_flip_parser,
        default_accum_parser,
        default_poly_parser,
        infile_parser],
        help="calculate the CRC32 checksum")
    subparser.set_defaults(func=calc_callback)

    return parser
1334959
def get_parser():
    """"""
    from argparse import ArgumentParser, ArgumentDefaultsHelpFormatter
    parser = ArgumentParser(description=__doc__,
                            formatter_class=ArgumentDefaultsHelpFormatter)
    parser.add_argument('--version',
                        action='version',
                        version='mpu {}'.format(mpu.__version__))
    subparsers = parser.add_subparsers(help='Python package commands')
    package_parser = subparsers.add_parser('package')
    mpu.package.cli.get_parser(package_parser)
    return parser
834686
def get_cli():
    """"""
    parser = argparse.ArgumentParser(
        prog="auto_version",
        description="auto version v%s: a tool to control version numbers" % __version__,
    )
    parser.add_argument(
        "--target",
        action="append",
        default=[],
        help="Files containing version info. "
        "Assumes unique variable names between files. (default: %s)."
        % (config.targets,),
    )
    parser.add_argument(
        "--bump",
        choices=SemVerSigFig,
        help="Bumps the specified part of SemVer string. "
        "Use this locally to correctly modify the version file.",
    )
    parser.add_argument(
        "--news",
        "--file-triggers",
        action="store_true",
        dest="file_triggers",
        help="Detects need to bump based on presence of files (as specified in config).",
    )
    parser.add_argument(
        "--set",
        help="Set the SemVer string. Use this locally to set the project version explicitly.",
    )
    parser.add_argument(
        "--set-patch-count",
        action="store_true",
        help="Sets the patch number to the commit count.",
    )
    parser.add_argument(
        "--lock",
        action="store_true",
        help="Locks the SemVer string. "
        "Lock will remain for another call to autoversion before being cleared.",
    )
    parser.add_argument(
        "--release",
        action="store_true",
        default=False,
        help="Marks as a release build, which flags the build as released.",
    )
    parser.add_argument(
        "--version",
        action="store_true",
        default=False,
        help="Prints the version of auto_version itself (self-version).",
    )
    parser.add_argument("--config", help="Configuration file path.")
    parser.add_argument(
        "-v",
        "--verbosity",
        action="count",
        default=0,
        help="increase output verbosity. " "can be specified multiple times",
    )
    return parser.parse_known_args()
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
361411
def _parser():
    """"""
    launcher = 'pip%s-utils' % sys.version_info.major

    parser = argparse.ArgumentParser(
        description='%s.' % __description__,
        epilog='See `%s COMMAND --help` for help '
               'on a specific subcommand.' % launcher,
        prog=launcher)
    parser.add_argument(
        '--version',
        action='version',
        version='%(prog)s ' + __version__)

    subparsers = parser.add_subparsers()

    # dependants
    parser_dependants = subparsers.add_parser(
        'dependants',
        add_help=False,
        help='list dependants of package')
    parser_dependants.add_argument(
        'package',
        metavar='PACKAGE',
        type=_distribution)
    parser_dependants.add_argument(
        '-h', '--help',
        action='help',
        help=argparse.SUPPRESS)
    parser_dependants.set_defaults(
        func=command_dependants)

    # dependents
    parser_dependents = subparsers.add_parser(
        'dependents',
        add_help=False,
        help='list dependents of package')
    parser_dependents.add_argument(
        'package',
        metavar='PACKAGE',
        type=_distribution)
    parser_dependents.add_argument(
        '-i', '--info',
        action='store_true',
        help='show version requirements')
    parser_dependents.add_argument(
        '-r', '--recursive',
        action='store_true',
        help='list dependencies recursively')
    parser_dependents.add_argument(
        '-h', '--help',
        action='help',
        help=argparse.SUPPRESS)
    parser_dependents.set_defaults(
        func=command_dependents)

    # locate
    parser_locate = subparsers.add_parser(
        'locate',
        add_help=False,
        help='identify packages that file belongs to')
    parser_locate.add_argument(
        'file',
        metavar='FILE',
        type=argparse.FileType('r'))
    parser_locate.add_argument(
        '-h', '--help',
        action='help',
        help=argparse.SUPPRESS)
    parser_locate.set_defaults(
        func=command_locate)

    # outdated
    parser_outdated = subparsers.add_parser(
        'outdated',
        add_help=False,
        help='list outdated packages that may be updated')
    parser_outdated.add_argument(
        '-b', '--brief',
        action='store_true',
        help='show package name only')
    group = parser_outdated.add_mutually_exclusive_group()
    group.add_argument(
        '-a', '--all',
        action='store_true',
        help='list all outdated packages')
    group.add_argument(
        '-p', '--pinned',
        action='store_true',
        help='list outdated packages unable to be updated')
    group.add_argument(
        '-U', '--upgrade',
        action='store_true',
        dest='update',
        help='update packages that can be updated'
    )
    parser_outdated.add_argument(
        '-h', '--help',
        action='help',
        help=argparse.SUPPRESS)
    parser_outdated.set_defaults(
        func=command_outdated)

    # parents
    parser_parents = subparsers.add_parser(
        'parents',
        add_help=False,
        help='list packages lacking dependants')
    parser_parents.add_argument(
        '-h', '--help',
        action='help',
        help=argparse.SUPPRESS)
    parser_parents.set_defaults(
        func=command_parents)

    return parser
925127
def get_command(self, ctx, cmd_name):
        """"""
        path = "%s.%s" % (__name__, cmd_name)
        path = path.replace("-", "_")
        module = importlib.import_module(path)
        return getattr(module, 'cli')
427996
def get_parser(func, parent):
    
    parser = parent.add_parser(func.__cmd_name__, help=func.__doc__)
    for args, kwargs in func.__arguments__:
        parser.add_argument(*args, **kwargs)
    return parser
234670
def create_parser(self, prog_name, subcommand):
        
        parser = OptionParser(prog=prog_name,
                              usage=self.usage(subcommand),
                              option_list=self.option_list)
        return parser
74423
def get_parser():
    """"""
    from argparse import ArgumentParser, ArgumentDefaultsHelpFormatter
    parser = ArgumentParser(description=__doc__,
                            formatter_class=ArgumentDefaultsHelpFormatter)
    parser.add_argument("-m", "--model",
                        dest="model",
                        help="where is the model folder (with a info.yml)?",
                        metavar="FOLDER",
                        type=lambda x: utils.is_valid_folder(parser, x),
                        default=utils.default_model())
    return parser
680514
def command_line_parsed(
            self,
            available_plugins: Set[Type[Plugin]],
            args_command_list: Any,
            malformed_servers: List[ServerStringParsingError]
    ) -> None:
        
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
1012577
def parser():
    """"""
    query_parser = current_app.config['COLLECTIONS_QUERY_PARSER']
    if isinstance(query_parser, six.string_types):
        query_parser = import_string(query_parser)
        return query_parser
988226
def get_parser():
    
    parser = argparse.ArgumentParser(description='Converts HTML from file or url to a clean text version')
    parser.add_argument('input', nargs='?', default=None, help='Html input either from a file or an url (default:stdin)')
    parser.add_argument('-o', '--output', type=str, help='Output file (default:stdout).')
    parser.add_argument('-e', '--encoding', type=str, help='Content encoding for files (default:utf-8)', default='utf-8')
    parser.add_argument('-i', '--display-image-captions', action='store_true', default=False, help='Display image captions (default:false).')
    parser.add_argument('-l', '--display-link-targets', action='store_true', default=False, help='Display link targets (default:false).')
    parser.add_argument('-d', '--deduplicate-image-captions', action='store_true', default=False, help='Deduplicate image captions (default:false).')
    return parser
207709
def get_parser():
    """"""
    from argparse import ArgumentParser, ArgumentDefaultsHelpFormatter
    parser = ArgumentParser(description=__doc__,
                            formatter_class=ArgumentDefaultsHelpFormatter)
    parser.add_argument("-n",
                        dest="n", default=10, type=int,
                        help="Show TOP-N results")
    parser.add_argument("--port",
                        dest="port", default=5000, type=int,
                        help="where should the webserver run")
    parser.add_argument("--use_segmenter",
                        dest="use_segmenter",
                        default=False,
                        action='store_true',
                        help=("try to segment the input for multiple symbol "
                              "recognition"))
    return parser
862818
def getParser():
    ""
    parser = argparse.ArgumentParser(formatter_class=argparse.RawDescriptionHelpFormatter, description=__description__)
    parser.add_argument('input', help='the input image')
    parser.add_argument('output', help='the output image')
    parser.add_argument('shape', type=argparseu.sequenceOfIntegersGt, help='the desired shape in colon-separated values, e.g. 255,255,32')

    parser.add_argument('-v', '--verbose', dest='verbose', action='store_true', help='verbose output')
    parser.add_argument('-d', dest='debug', action='store_true', help='Display debug information.')
    parser.add_argument('-f', '--force', dest='force', action='store_true', help='overwrite existing files')
    return parser
469635
def _get_parser():
    

    usage_string = ("%(prog)s [options]\n\n"
                    "Some examples:\n\n"
                    "enable dlm plugin only and collect dlm lockdumps:\n"
                    "  # sosreport -o dlm -k dlm.lockdump\n\n"
                    "disable memory and samba plugins, turn off rpm "
                    "-Va collection:\n"
                    "  # sosreport -n memory,samba -k rpm.rpmva=off")

    parser = ArgumentParser(usage=usage_string)
    parser.register('action', 'extend', SosListOption)
    parser.add_argument("-a", "--alloptions", action="store_true",
                        dest="alloptions", default=False,
                        help="enable all options for loaded plugins")
    parser.add_argument("--all-logs", action="store_true",
                        dest="all_logs", default=False,
                        help="collect all available logs regardless "
                             "of size")
    parser.add_argument("--batch", action="store_true",
                        dest="batch", default=False,
                        help="batch mode - do not prompt interactively")
    parser.add_argument("--build", action="store_true",
                        dest="build", default=False,
                        help="preserve the temporary directory and do not "
                             "package results")
    parser.add_argument("--case-id", action="store",
                        dest="case_id",
                        help="specify case identifier")
    parser.add_argument("-c", "--chroot", action="store", dest="chroot",
                        help="chroot executed commands to SYSROOT "
                             "[auto, always, never] (default=auto)",
                        default=_arg_defaults["chroot"])
    parser.add_argument("--config-file", type=str, action="store",
                        dest="config_file", default="/etc/sos.conf",
                        help="specify alternate configuration file")
    parser.add_argument("--debug", action="store_true", dest="debug",
                        help="enable interactive debugging using the "
                             "python debugger")
    parser.add_argument("--desc", "--description", type=str, action="store",
                        help="Description for a new preset", default="")
    parser.add_argument("--dry-run", action="store_true",
                        help="Run plugins but do not collect data")
    parser.add_argument("--experimental", action="store_true",
                        dest="experimental", default=False,
                        help="enable experimental plugins")
    parser.add_argument("-e", "--enable-plugins", action="extend",
                        dest="enableplugins", type=str,
                        help="enable these plugins", default=[])
    parser.add_argument("-k", "--plugin-option", action="extend",
                        dest="plugopts", type=str,
                        help="plugin options in plugname.option=value "
                             "format (see -l)", default=[])
    parser.add_argument("--label", "--name", action="store", dest="label",
                        help="specify an additional report label")
    parser.add_argument("-l", "--list-plugins", action="store_true",
                        dest="list_plugins", default=False,
                        help="list plugins and available plugin options")
    parser.add_argument("--list-presets", action="store_true",
                        help="display a list of available presets")
    parser.add_argument("--list-profiles", action="store_true",
                        dest="list_profiles", default=False,
                        help="display a list of available profiles and "
                             "plugins that they include")
    parser.add_argument("--log-size", action="store", dest="log_size",
                        type=int, default=_arg_defaults["log_size"],
                        help="limit the size of collected logs (in MiB)")
    parser.add_argument("-n", "--skip-plugins", action="extend",
                        dest="noplugins", type=str,
                        help="disable these plugins", default=[])
    parser.add_argument("--no-report", action="store_true",
                        dest="noreport",
                        help="disable plaintext/HTML reporting", default=False)
    parser.add_argument("--note", type=str, action="store", default="",
                        help="Behaviour notes for new preset")
    parser.add_argument("-o", "--only-plugins", action="extend",
                        dest="onlyplugins", type=str,
                        help="enable these plugins only", default=[])
    parser.add_argument("--preset", action="store", type=str,
                        help="A preset identifier", default="auto")
    parser.add_argument("--plugin-timeout", default=None,
                        help="set a timeout for all plugins")
    parser.add_argument("-p", "--profile", action="extend",
                        dest="profiles", type=str, default=[],
                        help="enable plugins used by the given profiles")
    parser.add_argument("-q", "--quiet", action="store_true",
                        dest="quiet", default=False,
                        help="only print fatal errors")
    parser.add_argument("-s", "--sysroot", action="store", dest="sysroot",
                        help="system root directory path (default='/')",
                        default=None)
    parser.add_argument("--ticket-number", action="store",
                        dest="case_id",
                        help="specify ticket number")
    parser.add_argument("--tmp-dir", action="store",
                        dest="tmp_dir",
                        help="specify alternate temporary directory",
                        default=None)
    parser.add_argument("-v", "--verbose", action="count", dest="verbosity",
                        default=_arg_defaults["verbosity"],
                        help="increase verbosity"),
    parser.add_argument("--verify", action="store_true",
                        dest="verify", default=False,
                        help="perform data verification during collection")
    parser.add_argument("-z", "--compression-type", dest="compression_type",
                        default=_arg_defaults["compression_type"],
                        help="compression technology to use [auto, "
                             "gzip, bzip2, xz] (default=auto)")
    parser.add_argument("-t", "--threads", action="store", dest="threads",
                        help="specify number of concurrent plugins to run"
                        " (default=4)", default=4, type=int)

    # Group to make add/del preset exclusive
    preset_grp = parser.add_mutually_exclusive_group()
    preset_grp.add_argument("--add-preset", type=str, action="store",
                            help="Add a new named command line preset")
    preset_grp.add_argument("--del-preset", type=str, action="store",
                            help="Delete the named command line preset")

    # Group to make tarball encryption (via GPG/password) exclusive
    encrypt_grp = parser.add_mutually_exclusive_group()
    encrypt_grp.add_argument("--encrypt-key",
                             help="Encrypt the final archive using a GPG "
                                  "key-pair")
    encrypt_grp.add_argument("--encrypt-pass",
                             help="Encrypt the final archive using a password")

    return parser
277202
def parser(self):
        '''
        
        '''
        if not hasattr(self, '_parser'):
            self._parser = self._compile()
        return self._parser