Returns *argparse.ArgumentParser* for ``phydms_prepalignment``.
558314
def PhyDMSPrepAlignmentParser():
    """"""
    parser = ArgumentParserNoArgHelp(formatter_class=ArgumentDefaultsRawDescriptionFormatter,
            description='\n'.join([
            "Prepare alignment of protein-coding DNA sequences.\n",
            "Steps:",
            " * Any sequences specified by '--purgeseqs' are removed.",
            " * Sequences not of length divisible by 3 are removed.",
            " * Sequences with ambiguous nucleotides are removed.",
            " * Sequences with non-terminal stop codons are removed;",
            "   terminal stop codons are trimmed.",
            " * Sequences that do not encode unique proteins are removed",
            "   unless they are specified for retention by '--keepseqs'.",
            " * A multiple sequence alignment is built using MAFFT.",
            "   This step is skipped if you specify '--prealigned'.",
            " * Sites gapped in reference sequence are stripped.",
            " * Sequences with too little protein identity to reference",
            "   sequence are removed, counting both mismatches and unstripped",
            "   gaps as differences. Identity cutoff set by '--minidentity'.",
            " * Sequences too similar to other sequences are removed. An",
            "   effort is made to keep one representative of sequences found",
            "   many times in input set. Uniqueness threshold set ",
            "   by '--minuniqueness'. You can specify sequences to not",
            "   remove via '--keepseqs'.",
            " * Problematic characters in header names are replaced by",
            "   underscores. This is any space, comma, colon, semicolon",
            "   parenthesis, bracket, single quote, or double quote.",
            " * An alignment is written, as well as a plot with same root",
            "   but extension '.pdf' that shows divergence from reference",
            "   of all sequences retained and purged due to identity or",
            "   uniqueness.\n",
            phydmslib.__acknowledgments__,
            'Version {0}'.format(phydmslib.__version__),
            'Full documentation at {0}'.format(phydmslib.__url__),
            ]))
    parser.add_argument('inseqs', type=ExistingFile, help="FASTA file giving input coding sequences.")
    parser.add_argument('alignment', help="Name of created output FASTA alignment. PDF plot has same root, but extension '.pdf'.")
    parser.add_argument('refseq', help="Reference sequence in 'inseqs': specify substring found ONLY in header for that sequence.")
    parser.set_defaults(prealigned=False)
    parser.add_argument('--prealigned', action='store_true', dest='prealigned', help="Sequences in 'inseqs' are already aligned, do NOT re-align.")
    parser.add_argument('--mafft', help="Path to MAFFT (http://mafft.cbrc.jp/alignment/software/).", default='mafft')
    parser.add_argument('--minidentity', type=FloatBetweenZeroAndOne, help="Purge sequences with <= this protein identity to 'refseq'.", default=0.7)
    parser.add_argument('--minuniqueness', type=IntGreaterThanZero, default=2, help="Require each sequence to have >= this many protein differences relative to other sequences.")
    parser.add_argument('--purgeseqs', nargs='*', help="Specify sequences to always purge. Any sequences with any of the substrings specified here are always removed. The substrings can either be passed as repeated arguments here, or as the name of an existing file which has one substring per line.")
    parser.add_argument('--keepseqs', nargs='*', help="Do not purge any of these sequences for lack of identity or uniqueness. Specified in the same fashion as for '--purgeseqs'.")
    parser.add_argument('-v', '--version', action='version', version='%(prog)s {version}'.format(version=phydmslib.__version__))
    return parser
145064
def create_argparser(self):
        
        if self.desc:
            if self.title:
                fulldesc = '%s\n\n%s' % (self.title, self.desc)
            else:
                fulldesc = self.desc
        else:
            fulldesc = self.title
        return self.ArgumentParser(command=self, prog=self.name,
                                   description=fulldesc)
600052
def parse_args(self, args=None, namespace=None):
        """"""
        # load the config_manager within the scope of the method that uses it
        # so that we avoid circular references in the outer scope
        from configman.config_manager import ConfigurationManager

        configuration_manager = ConfigurationManager(
            definition_source=[self.get_required_config()],
            values_source_list=self.value_source_list,
            argv_source=args,
            app_name=self.prog,
            app_version=self.version,
            app_description=self.description,
            use_auto_help=False,
        )

        # it is apparent a common idiom that commandline options may have
        # embedded '-' characters in them.  Configman requires that option
        # follow the Python Identifier rules.  Fortunately, Configman has a
        # class that will perform dynamic translation of keys.  In this
        # code fragment, we fetch the final configuration from configman
        # using a Mapping that will translate keys with '-' into keys with
        # '_' instead.
        conf = configuration_manager.get_config(
            mapping_class=create_key_translating_dot_dict(
                "HyphenUnderscoreDict",
                (('-', '_'),)
            )
        )

        # here is where we add the values given to "set_defaults" method
        # of argparse.
        if self.configman_subparsers_option:
            subparser_name = conf[self.configman_subparsers_option.name]
            try:
                conf.update(
                    self.configman_subparsers_option.foreign_data.argparse
                    .subparsers[subparser_name].subparser
                    .extra_defaults
                )
            except (AttributeError, KeyError):
                # no extra_defaults skip on
                pass

        if hasattr(self, 'extra_defaults'):
            conf.update(self.extra_defaults)

        return conf
938401
def check_args_order(func):
    '''
    '''
    argspec = inspect.getargspec(func)
    parsed_data = parse_numpydoc_variables_units(func)
    # compare the parsed arguments with those actually defined
    parsed_units = parsed_data['Parameters']['units']
    parsed_parameters = parsed_data['Parameters']['vars']
    if 'Other Parameters' in parsed_data:
        parsed_parameters += parsed_data['Other Parameters']['vars']
        parsed_units += parsed_data['Other Parameters']['units']
    
    if argspec.args != parsed_parameters: # pragma: no cover
        raise Exception('Function %s signature is not the same as the documentation'
                        ' signature = %s; documentation = %s' %(func.__name__, argspec.args, parsed_parameters))
976199
def get_arg_parse():
    """"""
    # Create parser object:
    objParser = argparse.ArgumentParser()

    # Add argument to namespace -config file path:
    objParser.add_argument('-config', required=True,
                           metavar='/path/to/config.csv',
                           help='Absolute file path of config file with \
                                 parameters for pRF analysis. Ignored if in \
                                 testing mode.'
                           )

    # Add argument to namespace -prior results file path:
    objParser.add_argument('-strPthPrior', required=True,
                           metavar='/path/to/my_prior_res',
                           help='Absolute file path of prior pRF results. \
                                 Ignored if in testing mode.'
                           )

    # Add argument to namespace -varNumOpt1 flag:
    objParser.add_argument('-varNumOpt1', required=True, type=int,
                           metavar='N1',
                           help='Number of radial positions.'
                           )

    # Add argument to namespace -varNumOpt2 flag:
    objParser.add_argument('-varNumOpt2', required=True, type=int,
                           metavar='N2',
                           help='Number of angular positions.'
                           )

    # Add argument to namespace -varNumOpt3 flag:
    objParser.add_argument('-varNumOpt3', default=None, metavar='N3',
                           help='Max displacement in radial direction.'
                           )

    # Add argument to namespace -lgcRstrCentre flag:
    objParser.add_argument('-lgcRstrCentre', dest='lgcRstrCentre',
                           action='store_true', default=False,
                           help='Restrict fitted models to stimulated area.')

    objParser.add_argument('-strPathHrf', default=None, required=False,
                           metavar='/path/to/custom_hrf_parameter.npy',
                           help='Path to npy file with custom hrf parameters. \
                           Ignored if in testing mode.')

    objParser.add_argument('-supsur', nargs='+',
                           help='List of floats that represent the ratio of \
                                 size neg surround to size pos center.',
                           type=float, default=None)

    # Namespace object containign arguments and values:
    objNspc = objParser.parse_args()

    return objNspc
868130
def _parse_arg(self, arg):
        """"""
        match = self.SPECIAL_RE.search(arg)
        if match:
            raise KatcpSyntaxError("Unescaped special %r." % (match.group(),))
        return self.UNESCAPE_RE.sub(self._unescape_match, arg)
914031
def default_parser() -> argparse.ArgumentParser:
    """"""
    parser = argparse.ArgumentParser(
        prog=CONSOLE_SCRIPT,
        formatter_class=argparse.ArgumentDefaultsHelpFormatter,
    )
    build_parser(parser)
    return parser
1317181
def parse_args():
    ''''''
    parser = argparse.ArgumentParser(
        description='Morphology feature plotter',
        epilog='Note: Makes plots of various features and superimposes\
        input distributions. Plots are saved to PDF file.',
        formatter_class=argparse.ArgumentDefaultsHelpFormatter)

    parser.add_argument('datapath',
                        help='Morphology data directory path')

    parser.add_argument('--mtypeconfig',
                        required=True,
                        help='Get mtype JSON configuration file')

    parser.add_argument('--output',
                        default='plots.pdf',
                        help='Output PDF file name')
    return parser.parse_args()
1302838
def create_parser(description):
    
    parser = argparse.ArgumentParser(description=description,
        formatter_class=argparse.ArgumentDefaultsHelpFormatter)

    display_types = get_display_types()
    display_choices = [display for k, v in display_types.items() for display in v]
    interface_types = get_interface_types()
    framebuffer_choices = get_choices('luma.core.framebuffer')
    rotation_choices = [0, 1, 2, 3]
    block_orientation_choices = [0, 90, -90, 180]
    color_choices = ['1', 'RGB', 'RGBA']

    general_group = parser.add_argument_group('General')
    general_group.add_argument('--config', '-f', type=str, help='Load configuration settings from a file')
    general_group.add_argument('--display', '-d', type=str, default=display_choices[0], help='Display type, supports real devices or emulators. Allowed values are: {0}'.format(', '.join(display_choices)), choices=display_choices, metavar='DISPLAY')
    general_group.add_argument('--width', type=int, default=128, help='Width of the device in pixels')
    general_group.add_argument('--height', type=int, default=64, help='Height of the device in pixels')
    general_group.add_argument('--rotate', '-r', type=int, default=0, help='Rotation factor. Allowed values are: {0}'.format(', '.join([str(x) for x in rotation_choices])), choices=rotation_choices, metavar='ROTATION')
    general_group.add_argument('--interface', '-i', type=str, default=interface_types[0], help='Serial interface type. Allowed values are: {0}'.format(', '.join(interface_types)), choices=interface_types, metavar='INTERFACE')

    i2c_group = parser.add_argument_group('I2C')
    i2c_group.add_argument('--i2c-port', type=int, default=1, help='I2C bus number')
    i2c_group.add_argument('--i2c-address', type=str, default='0x3C', help='I2C display address')

    spi_group = parser.add_argument_group('SPI')
    spi_group.add_argument('--spi-port', type=int, default=0, help='SPI port number')
    spi_group.add_argument('--spi-device', type=int, default=0, help='SPI device')
    spi_group.add_argument('--spi-bus-speed', type=int, default=8000000, help='SPI max bus speed (Hz)')
    spi_group.add_argument('--spi-cs-high', type=bool, default=False, help='SPI chip select is high')
    spi_group.add_argument('--spi-transfer-size', type=int, default=4096, help='SPI bus max transfer unit (bytes)')

    gpio_group = parser.add_argument_group('GPIO')
    gpio_group.add_argument('--gpio', type=str, default=None, help='Alternative RPi.GPIO compatible implementation (SPI devices only)')
    gpio_group.add_argument('--gpio-mode', type=str, default=None, help='Alternative pin mapping mode (SPI devices only)')
    gpio_group.add_argument('--gpio-data-command', type=int, default=24, help='GPIO pin for D/C RESET (SPI devices only)')
    gpio_group.add_argument('--gpio-reset', type=int, default=25, help='GPIO pin for RESET (SPI devices only)')
    gpio_group.add_argument('--gpio-backlight', type=int, default=18, help='GPIO pin for backlight (PCD8544, ST7735 devices only)')

    misc_group = parser.add_argument_group('Misc')
    misc_group.add_argument('--block-orientation', type=int, default=0, help='Fix 90° phase error (MAX7219 LED matrix only). Allowed values are: {0}'.format(', '.join([str(x) for x in block_orientation_choices])), choices=block_orientation_choices, metavar='ORIENTATION')
    misc_group.add_argument('--mode', type=str, default='RGB', help='Colour mode (SSD1322, SSD1325 and emulator only). Allowed values are: {0}'.format(', '.join(color_choices)), choices=color_choices, metavar='MODE')
    misc_group.add_argument('--framebuffer', type=str, default=framebuffer_choices[0], help='Framebuffer implementation (SSD1331, SSD1322, ST7735 displays only). Allowed values are: {0}'.format(', '.join(framebuffer_choices)), choices=framebuffer_choices, metavar='FRAMEBUFFER')
    misc_group.add_argument('--bgr', dest='bgr', action='store_true', help='Set if LCD pixels laid out in BGR (ST7735 displays only).')
    misc_group.set_defaults(bgr=False)
    misc_group.add_argument('--h-offset', type=int, default=0, help='Horizontal offset (in pixels) of screen to display memory (ST7735 displays only)')
    misc_group.add_argument('--v-offset', type=int, default=0, help='Vertical offset (in pixels) of screen to display memory (ST7735 displays only)')
    misc_group.add_argument('--backlight-active', type=str, default='low', help='Set to \"low\" if LCD backlight is active low, else \"high\" otherwise (PCD8544, ST7735 displays only). Allowed values are: low, high', choices=["low", "high"], metavar='VALUE')

    if len(display_types['emulator']) > 0:
        transformer_choices = get_transformer_choices()

        emulator_group = parser.add_argument_group('Emulator')
        emulator_group.add_argument('--transform', type=str, default='scale2x', help='Scaling transform to apply (emulator only). Allowed values are: {0}'.format(', '.join(transformer_choices)), choices=transformer_choices, metavar='TRANSFORM')
        emulator_group.add_argument('--scale', type=int, default=2, help='Scaling factor to apply (emulator only)')
        emulator_group.add_argument('--duration', type=float, default=0.01, help='Animation frame duration (gifanim emulator only)')
        emulator_group.add_argument('--loop', type=int, default=0, help='Repeat loop, zero=forever (gifanim emulator only)')
        emulator_group.add_argument('--max-frames', type=int, help='Maximum frames to record (gifanim emulator only)')

    try:  # pragma: no cover
        import argcomplete
        argcomplete.autocomplete(parser)
    except ImportError:
        pass

    return parser
1181673
def PhyDMSParser():
    """"""
    parser = ArgumentParserNoArgHelp(description=('Phylogenetic analysis '
            'informed by deep mutational scanning data. {0} Version {1}. Full'
            ' documentation at {2}').format(phydmslib.__acknowledgments__,
            phydmslib.__version__, phydmslib.__url__),
            formatter_class=argparse.ArgumentDefaultsHelpFormatter)
    parser.add_argument('alignment', type=ExistingFile,
            help='Existing FASTA file with aligned codon sequences.')
    parser.add_argument('tree', type=ExistingFile,
            help="Existing Newick file giving input tree.")
    parser.add_argument('model', type=ModelOption,
            help=("Substitution model: ExpCM_<prefsfile> or YNGKP_<m> ("
            "where <m> is {0}). For ExpCM, <prefsfile> has first "
            "column labeled 'site' and others labeled by 1-letter "
            "amino-acid code.").format(', '.join(yngkp_modelvariants)))
    parser.add_argument('outprefix', help='Output file prefix.', type=str)
    parser.add_argument('--brlen', choices=['scale', 'optimize'],
            default='optimize', help=("How to handle branch lengths: "
            "scale by single parameter or optimize each one"))
    parser.set_defaults(gammaomega=False)
    parser.add_argument('--gammaomega', action='store_true',
            dest='gammaomega', help="Omega for ExpCM from gamma "
            "distribution rather than single value. To achieve "
            "same for YNGKP, use 'model' of YNGKP_M5.")
    parser.set_defaults(gammabeta=False)
    parser.add_argument('--gammabeta', action='store_true',
            dest='gammabeta', help="Beta for ExpCM from gamma "
            "distribution rather than single value.")
    parser.set_defaults(omegabysite=False)
    parser.add_argument('--omegabysite', dest='omegabysite',
            action='store_true', help="Fit omega (dN/dS) for each site.")
    parser.set_defaults(omegabysite_fixsyn=False)
    parser.add_argument('--omegabysite_fixsyn', dest='omegabysite_fixsyn',
            action='store_true', help="For '--omegabysite', assign all "
            "sites same dS rather than fit for each site.")
    parser.set_defaults(diffprefsbysite=False)
    parser.add_argument('--diffprefsbysite', dest='diffprefsbysite',
            action='store_true', help="Fit differential preferences "
            "for each site.")
    parser.add_argument('--diffprefsprior', default='invquadratic,150,0.5',
            type=diffPrefsPrior, help="Regularizing prior for "
            "'--diffprefsbysite': 'invquadratic,C1,C2' is prior in "
            "Bloom, Biology Direct, 12:1.")
    parser.set_defaults(fitphi=False)
    parser.add_argument('--fitphi', action='store_true', dest='fitphi',
            help='Fit ExpCM phi rather than setting so stationary '
            'state matches alignment frequencies.')
    parser.set_defaults(randprefs=False)
    parser.add_argument('--randprefs', dest='randprefs', action='store_true',
            help="Randomize preferences among sites for ExpCM.")
    parser.set_defaults(avgprefs=False)
    parser.add_argument('--avgprefs', dest='avgprefs', action='store_true',
            help="Average preferences across sites for ExpCM.")
    parser.add_argument('--divpressure', type=ExistingFileOrNone,
            help=("Known diversifying pressure at sites: file with column 1 "
            "= position, column 2 = diversification pressure; columns space-, "
            "tab-, or comma-delimited."))
    parser.add_argument('--ncpus', default=1, type=int,
            help='Use this many CPUs; -1 means all available.')
    parser.add_argument('--fitprefsmethod', choices=[1, 2], default=2,
            help='Implementation to we use when fitting prefs.', type=int)
    parser.add_argument('--ncats', default=4, type=IntGreaterThanOne,
            help='Number of categories for gamma-distribution.')
    parser.add_argument('--minbrlen', type=FloatGreaterThanZero,
            default=phydmslib.constants.ALMOST_ZERO,
            help="Adjust all branch lengths in starting 'tree' to >= this.")
    parser.add_argument('--minpref', default=0.002, type=FloatGreaterThanZero,
            help="Adjust all preferences in ExpCM 'prefsfile' to >= this.")
    parser.add_argument('--seed', type=int, default=1, help="Random number seed.")
    parser.add_argument('--initparams', type=ExistingFile, help="Initialize "
            "model params from this file, which should be format of "
            "'*_modelparams.txt' file created by 'phydms' with this model.")
    parser.set_defaults(profile=False)
    parser.add_argument('--profile', dest='profile', action='store_true',
            help="Profile likelihood maximization, write pstats files. "
            "For code-development purposes.")
    parser.set_defaults(opt_details=False)
    parser.add_argument('--opt_details', dest='opt_details',
            action='store_true', help='Print details about optimization')
    parser.set_defaults(nograd=False)
    parser.add_argument('--nograd', dest='nograd', action='store_true',
            help="Do not use gradients for likelihood maximization.")
    parser.add_argument('-v', '--version', action='version', version=(
            ('%(prog)s {version}'.format(version=phydmslib.__version__))))
    return parser
1241850
def get_parser(parser=None):
    """"""
    from argparse import ArgumentParser, ArgumentDefaultsHelpFormatter
    if parser is None:
        parser = ArgumentParser(description=__doc__,
                                formatter_class=ArgumentDefaultsHelpFormatter)
    subparsers = parser.add_subparsers()
    pkg_init_parser = subparsers.add_parser('init')
    pkg_init_parser.add_argument("root",
                                 nargs='?',
                                 help="project root - should be empty")
    pkg_init_parser.set_defaults(func=run_init)
    return parser
12221
def get_arg_parse():
    """"""
    # Create parser object:
    objParser = argparse.ArgumentParser()

    # Add argument to namespace -strCsvPrf results file path:
    objParser.add_argument('-strCsvPrf', required=True,
                           metavar='/path/to/my_prior_res',
                           help='Absolute file path of prior pRF results. \
                                 Ignored if in testing mode.'
                           )

    # Add argument to namespace -strStmApr results file path:
    objParser.add_argument('-strStmApr', required=True,
                           metavar='/path/to/my_prior_res',
                           help='Absolute file path to npy file with \
                                 stimulus apertures. Ignored if in testing \
                                 mode.'
                           )

    # Add argument to namespace -lgcNoise flag:
    objParser.add_argument('-lgcNoise', dest='lgcNoise',
                           action='store_true', default=False,
                           help='Should noise be added to the simulated pRF\
                                 time course?')

    # Add argument to namespace -lgcRtnNrl flag:
    objParser.add_argument('-lgcRtnNrl', dest='lgcRtnNrl',
                           action='store_true', default=False,
                           help='Should neural time course, unconvolved with \
                                 hrf, be returned as well?')

    objParser.add_argument('-supsur', nargs='+',
                           help='List of floats that represent the ratio of \
                                 size neg surround to size pos center.',
                           type=float, default=None)

    # Namespace object containign arguments and values:
    objNspc = objParser.parse_args()

    return objNspc
415496
def PhyDMSLogoPlotParser():
    """"""
    parser = ArgumentParserNoArgHelp(description=
            "Make logo plot of preferences or differential preferences. "
            "Uses weblogo (http://weblogo.threeplusone.com/). "
            "{0} Version {1}. Full documentation at {2}".format(
            phydmslib.__acknowledgments__,
            phydmslib.__version__, phydmslib.__url__),
            formatter_class=argparse.ArgumentDefaultsHelpFormatter)
    group = parser.add_mutually_exclusive_group(required=True)
    group.add_argument('--prefs', type=ExistingFile, help="File with "
            "amino-acid preferences; same format as input to 'phydms'.")
    group.add_argument('--diffprefs', type=ExistingFile, help="File with "
            "differential preferences; in format output by 'phydms'.")
    parser.add_argument('outfile', help='Name of created PDF logo plot.')
    parser.add_argument('--stringency', type=FloatGreaterThanEqualToZero,
            default=1, help="Stringency parameter to re-scale prefs.")
    parser.add_argument('--nperline', type=IntGreaterThanZero, default=70,
            help="Number of sites per line.")
    parser.add_argument('--numberevery', type=IntGreaterThanZero, default=10,
            help="Number sites at this interval.")
    parser.add_argument('--mapmetric', default='functionalgroup', choices=['kd',
            'mw', 'charge', 'functionalgroup'], help='Metric used to color '
            'amino-acid letters. kd = Kyte-Doolittle hydrophobicity; '
            'mw = molecular weight; functionalgroup = divide in 7 '
            'groups; charge = charge at neutral pH.')
    parser.add_argument('--colormap', type=str, default='jet',
            help="Name of `matplotlib` color map for amino acids "
            "when `--mapmetric` is 'kd' or 'mw'.")
    parser.add_argument('--diffprefheight', type=FloatGreaterThanZero,
            default=1.0, help="Height of diffpref logo in each direction.")
    parser.add_argument('--omegabysite', help="Overlay omega on "
            "logo plot. Specify '*_omegabysite.txt' file from 'phydms'.",
            type=ExistingFileOrNone)
    parser.add_argument('--minP', type=FloatGreaterThanZero, default=1e-4,
            help="Min plotted P-value for '--omegabysite' overlay.")
    parser.add_argument('-v', '--version', action='version',
            version='%(prog)s {version}'.format(version=phydmslib.__version__))
    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
469692
def parser(description=None, usage=None):
    """"""

    class ArgNamespace(object):
        def __init__(self, result):
            self._result = result

        def __getattr__(self, name):
            try:
                super(ArgNamespace, self).__getattr__(name)
            except AttributeError:
                return getattr(self._result, name)

        def arg_strings(self, name=None):
            if not self._result:
                return None
            return extract_strings(self._result.__dict__, name)

    class ArgParser(object):

        def __init__(self, argument_parser):
            self.parser = argument_parser
            self.parse = self.parse_args
            self._parsed = None

            self.arg = self.parser.add_argument
            self.opt = self.true = partial(self.arg, action='store_true')
            self.int = partial(self.arg, type=int)

        def parse_args(self):
            return ArgNamespace(self.parser.parse_args())

        def sub(self, name, help=''):
            self.arg(name, metavar=name, help=help, type=str)

        def args(self, name, help='', many='*'):
            self.arg(name, metavar=name, help=help, type=str, nargs=many)

        def answer(self, answers=None):
            yes_no = {
                'n': ('-n', '--no', 'Answer no'),
                'y': ('-y', '--yes', 'Answer yes'),
            }
            options = yes_no
            options.update(answers)
            [self.true(options[o]) for o in options]

    lines = description.splitlines()
    if not usage:
        if len(lines) > 1 and not lines[1]:
            usage, epilog = lines[0], '\n\n'.join(lines[2:])
    else:
        usage = description = lines[0]
        epilog = None
    return ArgParser(
        argparse.ArgumentParser(usage=description))
1014158
def doc_parser():
    """"""

    parser = argparse.ArgumentParser(
        prog='ambry',
        description='Ambry {}. Management interface for ambry, libraries '
                    'and repositories. '.format(ambry._meta.__version__))

    return parser
455614
def get_module_parser(mod, modname, parents=[], add_help=True):
    
    return argparse.ArgumentParser(
        usage=configuration.EXECUTABLE_NAME + ' ' + modname + ' [options]',
        description=mod.get_description(), parents=parents,
        add_help=add_help)