当前位置: 首页>>代码示例>>Python>>正文


Python argparse.RawDescriptionHelpFormatter方法代码示例

本文整理汇总了Python中argparse.RawDescriptionHelpFormatter方法的典型用法代码示例。如果您正苦于以下问题:Python argparse.RawDescriptionHelpFormatter方法的具体用法?Python argparse.RawDescriptionHelpFormatter怎么用?Python argparse.RawDescriptionHelpFormatter使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在argparse的用法示例。


在下文中一共展示了argparse.RawDescriptionHelpFormatter方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: build_arg_parser

# 需要导入模块: import argparse [as 别名]
# 或者: from argparse import RawDescriptionHelpFormatter [as 别名]
def build_arg_parser(description, env_vars={}):
    from argparse import ArgumentParser, RawDescriptionHelpFormatter
    from textwrap import dedent

    base_env_vars = {
        'MONO_SOURCE_ROOT': 'Overrides default value for --mono-sources',
    }

    env_vars_text = '\n'.join(['    %s: %s' % (var, desc) for var, desc in env_vars.items()])
    base_env_vars_text = '\n'.join(['    %s: %s' % (var, desc) for var, desc in base_env_vars.items()])

    epilog=dedent('''\
environment variables:
%s
%s
''' % (env_vars_text, base_env_vars_text))

    return ArgumentParser(
        description=description,
        formatter_class=RawDescriptionHelpFormatter,
        epilog=epilog
    ) 
开发者ID:godotengine,项目名称:godot-mono-builds,代码行数:24,代码来源:cmd_utils.py

示例2: parse_args

# 需要导入模块: import argparse [as 别名]
# 或者: from argparse import RawDescriptionHelpFormatter [as 别名]
def parse_args(self):
        parser = argparse.ArgumentParser(
            description = self._description,
            epilog = self._epilog, 
            formatter_class = argparse.RawDescriptionHelpFormatter,
            usage = self._usage)

        self._add_flags(parser)
        self._add_export(parser)

        ### Print help message if no arguments are present.
        if len(sys.argv[1:]) == 0:
            parser.print_help()
            raise SystemExit

        args = parser.parse_args()
        return args, parser 
开发者ID:JosephLai241,项目名称:URS,代码行数:19,代码来源:Cli.py

示例3: create_parser

# 需要导入模块: import argparse [as 别名]
# 或者: from argparse import RawDescriptionHelpFormatter [as 别名]
def create_parser():
    parser = ArgumentParser(description=__doc__,
                            formatter_class=RawDescriptionHelpFormatter)
    parser.add_argument('--debug', action='store_true')
    parser.add_argument('--delimiter')
    parser.add_argument('--embedding-size', default=200, type=int)
    parser.add_argument('--graph-path')
    parser.add_argument('--has-header', action='store_true')
    parser.add_argument('--input', '-i', dest='infile', required=True)
    parser.add_argument('--log-level', '-l', type=str.upper, default='INFO')
    parser.add_argument('--num-walks', default=1, type=int)
    parser.add_argument('--model', '-m', dest='model_path')
    parser.add_argument('--output', '-o', dest='outfile', required=True)
    parser.add_argument('--stats', action='store_true')
    parser.add_argument('--undirected', action='store_true')
    parser.add_argument('--walk-length', default=10, type=int)
    parser.add_argument('--window-size', default=5, type=int)
    parser.add_argument('--workers', default=multiprocessing.cpu_count(),
                        type=int)
    return parser 
开发者ID:jwplayer,项目名称:jwalk,代码行数:22,代码来源:__main__.py

示例4: create_parser

# 需要导入模块: import argparse [as 别名]
# 或者: from argparse import RawDescriptionHelpFormatter [as 别名]
def create_parser():
    """Set up parsing for command-line arguments
    """
    parser = argparse.ArgumentParser(description=__doc__,  # Use text from file summary up top
                        formatter_class=argparse.RawDescriptionHelpFormatter)
    parser.add_argument('--reference-cluster-path',
                    dest='ref_cluster_path',
                    help='Path to SCP cluster file to use as reference ' +
                    '(i.e. normal, control) cells')
    parser.add_argument('--reference-group-name',
                    dest='ref_group_name',
                    help='Name of cell group in SCP cluster file to use as ' +
                    'label for inferCNV references')
    parser.add_argument('--metadata-path',
                    help='Path to SCP metadata file that contains all cells')
    parser.add_argument('--observation-group-name',
                    dest='obs_group_name',
                    help='Name of the cell group in SCP metadata file to ' +
                    'use as label for observations')
    parser.add_argument('--delimiter',
                    help='Delimiter in SCP cluster file',
                    default="\t")
    parser.add_argument('--output-dir',
                    help='Path to write output')
    return parser 
开发者ID:broadinstitute,项目名称:single_cell_portal,代码行数:27,代码来源:scp_to_infercnv.py

示例5: _create_parser

# 需要导入模块: import argparse [as 别名]
# 或者: from argparse import RawDescriptionHelpFormatter [as 别名]
def _create_parser():
    parser = ArgumentParser(description="Compare two tempest xml results",
                            formatter_class=RawDescriptionHelpFormatter)
    parser.add_argument("result_1",
                        help="path to xml result 1")
    parser.add_argument("result_2",
                        help="path to xml result 2")
    '''TODO future functionality
    parser.add_argument("-c", "--csv", dest="output_csv",
                        action="store_true",
                        help="output csv")
    parser.add_argument("-m", "--html", dest="output_html",
                        action="store_true",
                        help="output html")
    parser.add_argument("-n", "--json", dest="output_json",
                        action="store_true",
                        help="output json")
    parser.add_argument("-o", "--output-file", dest="output_file",
                        type=str, required=False,
                        help="If specified, output will be saved to given "
                        "file")
    '''
    return parser 
开发者ID:dsp-jetpack,项目名称:JetPack,代码行数:25,代码来源:tempest_results_processor.py

示例6: __init__

# 需要导入模块: import argparse [as 别名]
# 或者: from argparse import RawDescriptionHelpFormatter [as 别名]
def __init__(self, config='config.yaml', description=None):
        super(BaseOptions, self).__init__()
        logging.debug('BaseOptions.__init__')
        self._ordered_keys = []
        self._exclude_keys = set()

        self._parent = argparse.ArgumentParser(add_help=False)
        self._parser = argparse.ArgumentParser(parents=[self._parent],
                                               description=description,
                                               formatter_class=argparse.RawDescriptionHelpFormatter)

        # config file option
        self.config = config

        # config file
        self._parent.add_argument('--config', type=str, default=self.config, metavar=self.config,
                                  help='configuration file name') 
开发者ID:AdamGagorik,项目名称:pydarkstar,代码行数:19,代码来源:base.py

示例7: create_parser

# 需要导入模块: import argparse [as 别名]
# 或者: from argparse import RawDescriptionHelpFormatter [as 别名]
def create_parser(prog):
  """Create an argument parser, adding in the list of providers."""
  parser = argparse.ArgumentParser(
      prog=prog, formatter_class=argparse.RawDescriptionHelpFormatter)

  parser.add_argument(
      '--provider',
      default='google-v2',
      choices=['local', 'google-v2', 'google-cls-v2', 'test-fails'],
      help="""Job service provider. Valid values are "google-v2" (Google's
        Pipeline API v2alpha1), "google-cls-v2" (Google's Pipelines API v2beta)
        and "local" (local Docker execution).
        "test-*" providers are for testing purposes only.
        (default: google-v2)""",
      metavar='PROVIDER')

  return parser 
开发者ID:DataBiosphere,项目名称:dsub,代码行数:19,代码来源:provider_base.py

示例8: _parse_cli_options

# 需要导入模块: import argparse [as 别名]
# 或者: from argparse import RawDescriptionHelpFormatter [as 别名]
def _parse_cli_options():
    """
    Parse command line options, returning `parse_args` from `ArgumentParser`.
    """
    parser = ArgumentParser(formatter_class=RawDescriptionHelpFormatter,
                            usage="python %(prog)s <options>",
                            epilog="example:\n"
                                   "python %(prog)s -w workflow1 workflow2 -l my_panel_label\n"
                                   "Christophe Antoniewski <drosofff@gmail.com>\n"
                                   "https://github.com/ARTbio/ansible-artimed/tree/master/scritps/galaxykickstart_from_workflow.py")
    parser.add_argument('-w', '--workflow',
                        dest="workflow_files",
                        required=True,
                        nargs='+',
                        help='A space-separated list of galaxy workflow description files in json format', )
    parser.add_argument('-l', '--panel_label',
                        dest='panel_label',
                        default='Tools from workflows',
                        help='The name of the panel where the tools will show up in Galaxy.'
                             'If not specified: "Tools from workflows"')
    return parser.parse_args() 
开发者ID:ARTbio,项目名称:GalaxyKickStart,代码行数:23,代码来源:galaxykickstart_from_workflow.py

示例9: create_parser

# 需要导入模块: import argparse [as 别名]
# 或者: from argparse import RawDescriptionHelpFormatter [as 别名]
def create_parser():
    parser = argparse.ArgumentParser(
        formatter_class=argparse.RawDescriptionHelpFormatter,
        description="learn BPE-based word segmentation")

    parser.add_argument(
        '--input', '-i', type=argparse.FileType('r'), default=sys.stdin,
        metavar='PATH',
        help="Input file (default: standard input).")
    parser.add_argument(
        '--codes', '-c', type=argparse.FileType('r'), metavar='PATH',
        required=True,
        help="File with BPE codes (created by learn_bpe.py).")
    parser.add_argument(
        '--output', '-o', type=argparse.FileType('w'), default=sys.stdout,
        metavar='PATH',
        help="Output file (default: standard output)")
    parser.add_argument(
        '--separator', '-s', type=str, default='@@', metavar='STR',
        help="Separator between non-final subword units (default: '%(default)s'))")

    return parser 
开发者ID:nusnlp,项目名称:crosentgec,代码行数:24,代码来源:apply_bpe.py

示例10: create_parser

# 需要导入模块: import argparse [as 别名]
# 或者: from argparse import RawDescriptionHelpFormatter [as 别名]
def create_parser():
    parser = argparse.ArgumentParser(
        formatter_class=argparse.RawDescriptionHelpFormatter,
        description="learn BPE-based word segmentation")

    parser.add_argument(
        '--input', '-i', type=argparse.FileType('r'), default=sys.stdin,
        metavar='PATH',
        help="Input text (default: standard input).")
    parser.add_argument(
        '--output', '-o', type=argparse.FileType('w'), default=sys.stdout,
        metavar='PATH',
        help="Output file for BPE codes (default: standard output)")
    parser.add_argument(
        '--symbols', '-s', type=int, default=10000,
        help="Create this many new symbols (each representing a character n-gram) (default: %(default)s))")
    parser.add_argument(
        '--min-frequency', type=int, default=2, metavar='FREQ',
        help='Stop if no symbol pair has frequency >= FREQ (default: %(default)s))')
    parser.add_argument(
        '--verbose', '-v', action="store_true",
        help="verbose mode.")

    return parser 
开发者ID:fabiencro,项目名称:knmt,代码行数:26,代码来源:learn_bpe.py

示例11: add_list_blocks_parser

# 需要导入模块: import argparse [as 别名]
# 或者: from argparse import RawDescriptionHelpFormatter [as 别名]
def add_list_blocks_parser(subparsers, parent_parser):
    """Creates the arg parsers needed for the compare command.
    """
    parser = subparsers.add_parser(
        'list-blocks',
        help='List blocks from different nodes.',
        formatter_class=argparse.RawDescriptionHelpFormatter,
        epilog='',
        parents=[parent_parser, base_multinode_parser()])

    parser.add_argument(
        '-n',
        '--count',
        default=10,
        type=int,
        help='the number of blocks to list') 
开发者ID:hyperledger,项目名称:sawtooth-core,代码行数:18,代码来源:list_blocks.py

示例12: doArchive

# 需要导入模块: import argparse [as 别名]
# 或者: from argparse import RawDescriptionHelpFormatter [as 别名]
def doArchive(argv, bobRoot):
    subHelp = "\n          ... ".join(sorted(
        [ "{:8} {}".format(c, d[1]) for (c, d) in availableArchiveCmds.items() ]))
    parser = argparse.ArgumentParser(prog="bob archive",
        formatter_class=argparse.RawDescriptionHelpFormatter,
        description="""Manage binary artifacts archive. The following subcommands are available:

  bob archive {}
""".format(subHelp))
    parser.add_argument('subcommand', help="Subcommand")
    parser.add_argument('args', nargs=argparse.REMAINDER,
                        help="Arguments for subcommand")

    args = parser.parse_args(argv)

    if args.subcommand in availableArchiveCmds:
        availableArchiveCmds[args.subcommand][0](args.args)
    else:
        parser.error("Unknown subcommand '{}'".format(args.subcommand)) 
开发者ID:BobBuildTool,项目名称:bob,代码行数:21,代码来源:archive.py

示例13: run

# 需要导入模块: import argparse [as 别名]
# 或者: from argparse import RawDescriptionHelpFormatter [as 别名]
def run():
    parser = argparse.ArgumentParser(description="""
    The SafeLife command-line tool can be used to interactively play
    a game of SafeLife, print procedurally generated SafeLife boards,
    or convert saved boards to images for easy viewing.

    Please select one of the available commands to run the program.
    You can run `safelife <command> --help` to get more help on a
    particular command.
    """, formatter_class=argparse.RawDescriptionHelpFormatter)
    subparsers = parser.add_subparsers(dest="cmd", help="Top-level command.")
    interactive_game._make_cmd_args(subparsers)
    render_graphics._make_cmd_args(subparsers)
    args = parser.parse_args()
    if args.cmd is None:
        parser.print_help()
    else:
        args.run_cmd(args) 
开发者ID:PartnershipOnAI,项目名称:safelife,代码行数:20,代码来源:__main__.py

示例14: main

# 需要导入模块: import argparse [as 别名]
# 或者: from argparse import RawDescriptionHelpFormatter [as 别名]
def main():
    """ Parse command line arguments and start exploit """
    parser = argparse.ArgumentParser(
            add_help=False,
            formatter_class=argparse.RawDescriptionHelpFormatter,
            epilog="Examples: %(prog)s -t http://192.168.0.1/ -u username -p password -c whoami")

    # Adds arguments to help menu
    parser.add_argument("-h", action="help", help="Print this help message then exit")
    parser.add_argument("-t", dest="target", required="yes", help="Target URL address like: https://localhost:443/")
    parser.add_argument("-u", dest="username", required="yes", help="Username to authenticate")
    parser.add_argument("-p", dest="password", required="yes", help="Password to authenticate")
    parser.add_argument("-c", dest="command", required="yes", help="Shell command to execute")

    # Assigns the arguments to various variables
    args = parser.parse_args()

    run(args.target, args.username, args.password, args.command)


#
# Main
# 
开发者ID:tenable,项目名称:poc,代码行数:25,代码来源:poc_nuuo_upgrade_handle.py

示例15: main

# 需要导入模块: import argparse [as 别名]
# 或者: from argparse import RawDescriptionHelpFormatter [as 别名]
def main():
	import argparse
	
	parser = argparse.ArgumentParser(description='Polls the kerberos service for a TGT for the sepcified user', formatter_class=argparse.RawDescriptionHelpFormatter, epilog = kerberos_url_help_epilog)
	parser.add_argument('kerberos_connection_url', help='the kerberos target string. ')
	parser.add_argument('ccache', help='ccache file to store the TGT ticket in')
	parser.add_argument('-v', '--verbose', action='count', default=0)
	
	args = parser.parse_args()
	if args.verbose == 0:
		logging.basicConfig(level=logging.INFO)
	elif args.verbose == 1:
		logging.basicConfig(level=logging.DEBUG)
	else:
		logging.basicConfig(level=1)
	
	asyncio.run(amain(args)) 
开发者ID:skelsec,项目名称:minikerberos,代码行数:19,代码来源:getTGT.py


注:本文中的argparse.RawDescriptionHelpFormatter方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。