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


Python argparse.SUPPRESS属性代码示例

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


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

示例1: _format_action

# 需要导入模块: import argparse [as 别名]
# 或者: from argparse import SUPPRESS [as 别名]
def _format_action(action):
    """Get an invocation string/help from an argparse action."""
    if action.help == argparse.SUPPRESS:
        return None
    if not action.option_strings:
        invocation = '*{}*::'.format(_get_action_metavar(action))
    else:
        parts = []
        if action.nargs == 0:
            # Doesn't take a value, so the syntax is -s, --long
            parts += ['*{}*'.format(s) for s in action.option_strings]
        else:
            # Takes a value, so the syntax is -s ARGS or --long ARGS.
            args_string = _format_action_args(action)
            for opt in action.option_strings:
                parts.append('*{}* {}'.format(opt, args_string))
        invocation = ', '.join(parts) + '::'
    return '{}\n    {}\n'.format(invocation, action.help) 
开发者ID:qutebrowser,项目名称:qutebrowser,代码行数:20,代码来源:src2asciidoc.py

示例2: add_command_args

# 需要导入模块: import argparse [as 别名]
# 或者: from argparse import SUPPRESS [as 别名]
def add_command_args(parser):
    group = parser.add_mutually_exclusive_group()
    group.add_argument("--watch", action="store_true", help="Monitor submitted job, stream log until job completes")
    group.add_argument("--wait", action="store_true",
                       help="Block on job. Exit with code 0 if job succeeded, 1 if failed")
    group = parser.add_mutually_exclusive_group()
    group.add_argument("--command", nargs="+", help="Run these commands as the job (using " + BOLD("bash -c") + ")")
    group.add_argument("--execute", type=argparse.FileType("rb"), metavar="EXECUTABLE",
                       help="Read this executable file and run it as the job")
    group.add_argument("--wdl", type=argparse.FileType("rb"), metavar="WDL_WORKFLOW",
                       help="Read this WDL workflow file and run it as the job")
    parser.add_argument("--wdl-input", type=argparse.FileType("r"), metavar="WDL_INPUT_JSON", default=sys.stdin,
                        help="With --wdl, use this JSON file as the WDL job input (default: stdin)")
    parser.add_argument("--environment", nargs="+", metavar="NAME=VALUE",
                        type=lambda x: dict(zip(["name", "value"], x.split("=", 1))), default=[])
    parser.add_argument("--staging-s3-bucket", help=argparse.SUPPRESS) 
开发者ID:kislyuk,项目名称:aegea,代码行数:18,代码来源:batch.py

示例3: init_argparser_source_registry

# 需要导入模块: import argparse [as 别名]
# 或者: from argparse import SUPPRESS [as 别名]
def init_argparser_source_registry(
            self, argparser, default=None, help=(
                'comma separated list of registries to use for gathering '
                'JavaScript sources from the given Python packages'
            )):
        """
        For setting up the source registry flag.
        """

        argparser.add_argument(
            '--source-registry', default=default,
            dest=CALMJS_MODULE_REGISTRY_NAMES, action=StoreDelimitedList,
            metavar='<registry>[,<registry>[...]]',
            help=help,
        )

        argparser.add_argument(
            '--source-registries', default=default,
            dest=CALMJS_MODULE_REGISTRY_NAMES, action=StoreDelimitedList,
            help=SUPPRESS,
        ) 
开发者ID:calmjs,项目名称:calmjs,代码行数:23,代码来源:runtime.py

示例4: __init__

# 需要导入模块: import argparse [as 别名]
# 或者: from argparse import SUPPRESS [as 别名]
def __init__(self, vm_type_name, short_vm_type_name=None, default_vm=None, known_host_registries=None):
        """

        :param str vm_type_name: full VM type name (e.g., "Java")
        :param str short_vm_type_name:
        :param default_vm: a callable which, given a config name gives a default VM name
        :param list[VmRegistry] known_host_registries: a list of known host VM registries
        """
        self.vm_type_name = vm_type_name + " VM"
        self.short_vm_type_name = short_vm_type_name if short_vm_type_name else vm_type_name.lower() + "-vm"
        assert default_vm is None or callable(default_vm)
        self.default_vm = default_vm
        assert re.compile(r"\A[a-z-]+\Z").match(self.short_vm_type_name)
        self._vms = OrderedDict()
        self._vms_suite = {}
        self._vms_priority = {}
        self._known_host_registries = known_host_registries or []
        add_parser(self.get_parser_name(), ParserEntry(
            ArgumentParser(add_help=False, usage=_mx_benchmark_usage_example + " -- <options> -- ..."),
            "\n\n{} selection flags, specified in the benchmark suite arguments:\n".format(self.vm_type_name)
        ))
        get_parser(self.get_parser_name()).add_argument("--{}".format(self.short_vm_type_name), default=None, help="{vm} to run the benchmark with.".format(vm=self.vm_type_name))
        get_parser(self.get_parser_name()).add_argument("--{}-config".format(self.short_vm_type_name), default=None, help="{vm} configuration for the selected {vm}.".format(vm=self.vm_type_name))
        # Separator to stack guest and host VM options. Though ignored, must be consumed by the parser.
        get_parser(self.get_parser_name()).add_argument('--guest', action='store_true', dest=SUPPRESS, default=None, help='Separator for --{vm}=host --guest --{vm}=guest VM configurations.'.format(vm=self.short_vm_type_name)) 
开发者ID:graalvm,项目名称:mx,代码行数:27,代码来源:mx_benchmark.py

示例5: parser

# 需要导入模块: import argparse [as 别名]
# 或者: from argparse import SUPPRESS [as 别名]
def parser(self):
        kwargs = {
            "usage": self.usage,
            "prog": self.prog
        }
        parser = argparse.ArgumentParser(**kwargs)
        parser.add_argument("-v", "--version",
                action="version", default=argparse.SUPPRESS,
                version="%(prog)s (version " + __version__ + ")\n",
                help="show program's version number and exit")
        parser.add_argument("args", nargs="*", help=argparse.SUPPRESS)

        keys = sorted(self.settings, key=self.settings.__getitem__)
        for k in keys:
            self.settings[k].add_option(parser)

        return parser 
开发者ID:jpush,项目名称:jbox,代码行数:19,代码来源:config.py

示例6: add_args

# 需要导入模块: import argparse [as 别名]
# 或者: from argparse import SUPPRESS [as 别名]
def add_args(self, parser):
        self.progress.add_args(parser)
        self.data_reader.add_args(parser)
        rgroup = parser.add_argument_group('runtime options')
        rgroup.add_argument('--analysis-only', '-ao', dest='analysis_mode', action='store_true',
                             help='''Use this flag to run the analysis and return to the terminal.''')
        rgroup.add_argument('--reanalyze', '-ra', dest='reanalyze', action='store_true',
                             help='''Use this flag to delete the existing files and reanalyze.''')
        rgroup.add_argument('--ignore-hash', '-ih', dest='ignore_hash', action='store_true',
                             help='''Ignore hash and don't regenerate files.''')
        rgroup.add_argument('--debug', '-d', dest='debug_mode', action='store_true',
                             help='''Debug output largely intended for development.''')
        rgroup.add_argument('--terminal', '-t', dest='plotting', action='store_true',
                             help='''Plot output in terminal.''')
        # There is almost certainly a better way to handle this, but we'll sort that later.
        import argparse
        rgroup.add_argument('--f', '-f', dest='extra', default='blah',
                             help=argparse.SUPPRESS)
        
        parser.set_defaults(compression=True) 
开发者ID:westpa,项目名称:westpa,代码行数:22,代码来源:w_ipa.py

示例7: __init__

# 需要导入模块: import argparse [as 别名]
# 或者: from argparse import SUPPRESS [as 别名]
def __init__(self):
        self.parser = argparse.ArgumentParser()

        # People will still be able to use the old --provider syntax
        self.parser.add_argument("--provider",
                                 action='store_true',
                                 dest='sinkhole',
                                 help=argparse.SUPPRESS)

        self.parser.add_argument('-v', '--version',
                                 action='version',
                                 version='Scout Suite {}'.format(__version__))

        self.common_providers_args_parser = argparse.ArgumentParser(add_help=False)

        self.subparsers = self.parser.add_subparsers(title="The provider you want to run scout against",
                                                     dest="provider")

        self._init_common_args_parser()

        self._init_aws_parser()
        self._init_gcp_parser()
        self._init_azure_parser()
        self._init_aliyun_parser()
        self._init_oci_parser() 
开发者ID:nccgroup,项目名称:ScoutSuite,代码行数:27,代码来源:cli_parser.py

示例8: get_arguments

# 需要导入模块: import argparse [as 别名]
# 或者: from argparse import SUPPRESS [as 别名]
def get_arguments(self):
        ''' Returns parser.args() containing all program arguments '''

        parser = argparse.ArgumentParser(usage=argparse.SUPPRESS,
                formatter_class=lambda prog: argparse.HelpFormatter(
                    prog, max_help_position=80, width=130))

        self._add_global_args(parser.add_argument_group(Color.s('{C}SETTINGS{W}')))
        self._add_wep_args(parser.add_argument_group(Color.s('{C}WEP{W}')))
        self._add_wpa_args(parser.add_argument_group(Color.s('{C}WPA{W}')))
        self._add_wps_args(parser.add_argument_group(Color.s('{C}WPS{W}')))
        self._add_pmkid_args(parser.add_argument_group(Color.s('{C}PMKID{W}')))
        self._add_eviltwin_args(parser.add_argument_group(Color.s('{C}EVIL TWIN{W}')))
        self._add_command_args(parser.add_argument_group(Color.s('{C}COMMANDS{W}')))

        return parser.parse_args() 
开发者ID:nuncan,项目名称:wifite2mod,代码行数:18,代码来源:args.py

示例9: _add_pmkid_args

# 需要导入模块: import argparse [as 别名]
# 或者: from argparse import SUPPRESS [as 别名]
def _add_pmkid_args(self, pmkid):
        pmkid.add_argument('--pmkid',
                         action='store_true',
                         dest='use_pmkid_only',
                         help=Color.s('{O}Only{W} use {C}PMKID capture{W}, avoids other WPS & ' +
                                      'WPA attacks (default: {G}off{W})'))
        pmkid.add_argument('--no-pmkid',
                         action='store_true',
                         dest='dont_use_pmkid',
                         help=Color.s('{O}Don\'t{W} use {C}PMKID capture{W} ' +
                                      '(default: {G}off{W})'))
        # Alias
        pmkid.add_argument('-pmkid', help=argparse.SUPPRESS, action='store_true', dest='use_pmkid_only')

        pmkid.add_argument('--pmkid-timeout',
                         action='store',
                         dest='pmkid_timeout',
                         metavar='[sec]',
                         type=int,
                         help=Color.s('Time to wait for PMKID capture ' +
                                      '(default: {G}%d{W} seconds)' % self.config.pmkid_timeout)) 
开发者ID:nuncan,项目名称:wifite2mod,代码行数:23,代码来源:args.py

示例10: _add_command_args

# 需要导入模块: import argparse [as 别名]
# 或者: from argparse import SUPPRESS [as 别名]
def _add_command_args(self, commands):
        commands.add_argument('--cracked',
            action='store_true',
            dest='cracked',
            help=Color.s('Print previously-cracked access points'))
        commands.add_argument('-cracked', help=argparse.SUPPRESS, action='store_true',
                dest='cracked')

        commands.add_argument('--check',
            action='store',
            metavar='file',
            nargs='?',
            const='<all>',
            dest='check_handshake',
            help=Color.s('Check a {C}.cap file{W} (or all {C}hs/*.cap{W} files) ' +
                'for WPA handshakes'))
        commands.add_argument('-check', help=argparse.SUPPRESS, action='store',
                nargs='?', const='<all>', dest='check_handshake')

        commands.add_argument('--crack',
            action='store_true',
            dest='crack_handshake',
            help=Color.s('Show commands to crack a captured handshake')) 
开发者ID:nuncan,项目名称:wifite2mod,代码行数:25,代码来源:args.py

示例11: set_defaults

# 需要导入模块: import argparse [as 别名]
# 或者: from argparse import SUPPRESS [as 别名]
def set_defaults(args, cls):
    """Helper to set default arguments based on *add_args*."""
    if not hasattr(cls, 'add_args'):
        return
    parser = argparse.ArgumentParser(argument_default=argparse.SUPPRESS, allow_abbrev=False)
    cls.add_args(parser)
    # copied from argparse.py:
    defaults = argparse.Namespace()
    for action in parser._actions:
        if action.dest is not argparse.SUPPRESS:
            if not hasattr(defaults, action.dest):
                if action.default is not argparse.SUPPRESS:
                    setattr(defaults, action.dest, action.default)
    for key, default_value in vars(defaults).items():
        if not hasattr(args, key):
            setattr(args, key, default_value) 
开发者ID:pytorch,项目名称:fairseq,代码行数:18,代码来源:registry.py

示例12: _print_ones

# 需要导入模块: import argparse [as 别名]
# 或者: from argparse import SUPPRESS [as 别名]
def _print_ones(self, args, screen_info=None):
    ap = argparse.ArgumentParser(
        description="Print all-one matrix.", usage=argparse.SUPPRESS)
    ap.add_argument(
        "-s",
        "--size",
        dest="size",
        type=int,
        default=3,
        help="Size of the matrix. For example, of the value is 3, "
        "the matrix will have shape (3, 3)")

    parsed = ap.parse_args(args)

    m = np.ones([parsed.size, parsed.size])

    return tensor_format.format_tensor(m, "m") 
开发者ID:abhisuri97,项目名称:auto-alt-text-lambda-api,代码行数:19,代码来源:curses_ui_test.py

示例13: setup_flex_args

# 需要导入模块: import argparse [as 别名]
# 或者: from argparse import SUPPRESS [as 别名]
def setup_flex_args(argParser):
        """
        Add flex specific arguments to other default args used by ngraph
        """
        # use fixed point for flex backend
        argParser.add_argument('--fixed_point',
                               action="store_true",
                               help=argparse.SUPPRESS)
        # turn on flex verbosity for debug
        argParser.add_argument('--flex_verbose',
                               action="store_true",
                               help=argparse.SUPPRESS)
        # collect flex data and save it to h5py File
        argParser.add_argument('--collect_flex_data',
                               action="store_true",
                               default=argparse.SUPPRESS) 
开发者ID:NervanaSystems,项目名称:ngraph-python,代码行数:18,代码来源:flexargparser.py

示例14: get_params_parser

# 需要导入模块: import argparse [as 别名]
# 或者: from argparse import SUPPRESS [as 别名]
def get_params_parser():
    """Parse command line arguments"""

    parser = argparse.ArgumentParser(add_help=False)

    parser.add_argument('-g', '--debug', dest='debug',
                        action='store_true',
                        help=argparse.SUPPRESS)

    parser.add_argument("--cfg", dest='cfg_path',
                        help="Configuration file path")
    parser.add_argument("--dashboards", action='store_true', dest='dashboards',
                        help="Upload dashboards")
    parser.add_argument("--menu", action='store_true', dest='menu',
                        help="Upload menu")

    if len(sys.argv) == 1:
        parser.print_help()
        sys.exit(1)

    return parser 
开发者ID:chaoss,项目名称:grimoirelab-sirmordred,代码行数:23,代码来源:panels_config.py

示例15: add_bless_and_passthrough_opts

# 需要导入模块: import argparse [as 别名]
# 或者: from argparse import SUPPRESS [as 别名]
def add_bless_and_passthrough_opts(parser, program):
    parser.add_argument("--bless-config", default=os.environ.get("BLESS_CONFIG"),
                        help="Path to a Bless configuration file (or pass via the BLESS_CONFIG environment variable)")
    parser.add_argument("--use-kms-auth", help=argparse.SUPPRESS)
    for opt in opts_by_nargs[program][0]:
        parser.add_argument("-" + opt, action="store_true", help=argparse.SUPPRESS)
    for opt in opts_by_nargs[program][1]:
        parser.add_argument("-" + opt, action="append", help=argparse.SUPPRESS) 
开发者ID:kislyuk,项目名称:aegea,代码行数:10,代码来源:ssh.py


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