python类make_option()的实例源码

oc_jstree.py 文件源码 项目:oc-pyang 作者: openconfig 项目源码 文件源码 阅读 27 收藏 0 点赞 0 评论 0
def add_opts(self, optparser):
        optlist = [
            optparse.make_option("--oc-jstree-no-path",
                                 dest="jstree_no_path",
                                 action="store_true",
                                 help="""Do not include paths to make
                                       page less wide"""),
            optparse.make_option("--oc-jstree-strip",
                              dest="strip_namespace",
                              action="store_true",
                              help="""Strip namespace prefixes from
                                path components"""),
            ]

        g = optparser.add_option_group("OpenConfig JSTree output specific options")
        g.add_options(optlist)
json-schema.py 文件源码 项目:pyang-json-schema-plugin 作者: cmoberg 项目源码 文件源码 阅读 19 收藏 0 点赞 0 评论 0
def add_opts(self, optparser):
        optlist = [
            optparse.make_option('--json-schema-debug',
                                 dest='schema_debug',
                                 action="store_true",
                                 help='JSON Schema debug'),
            optparse.make_option('--json-schema-path',
                                 dest='schema_path',
                                 help='JSON Schema path'),
            optparse.make_option('--json-schema-title',
                                 dest='schema_title',
                                 help='JSON Schema title'),
            ]

        group = optparser.add_option_group("JSON Schema-specific options")
        group.add_options(optlist)
conftest.py 文件源码 项目:pyangext 作者: abravalheri 项目源码 文件源码 阅读 28 收藏 0 点赞 0 评论 0
def dummy_plugin_content():
    """Dummy pyang content that dumps the contents of a parameter"""
    return dedent("""\
        import optparse
        from pyang import plugin

        def pyang_plugin_init():
            plugin.register_plugin(FakeFixturePlugin())

        class FakeFixturePlugin(plugin.PyangPlugin):
            def add_opts(self, optparser):
                g = optparser.add_option_group("FakeFixture Plugin Options")
                g.add_options([
                    optparse.make_option(
                        "--fake-fixture-option", default="Hello World!")
                ])

            def add_output_format(self, fmts):
                    self.multiple_modules = True
                    fmts['fake-fixture'] = self

            def emit(self, ctx, modules, fd):
                fd.write(ctx.opts.fake_fixture_option)""")
git_p4.py 文件源码 项目:python-zulip-api 作者: zulip 项目源码 文件源码 阅读 22 收藏 0 点赞 0 评论 0
def __init__(self):
        P4Sync.__init__(self)
        self.description = "Creates a new git repository and imports from Perforce into it"
        self.usage = "usage: %prog [options] //depot/path[@revRange]"
        self.options += [
            optparse.make_option("--destination", dest="cloneDestination",
                                 action='store', default=None,
                                 help="where to leave result of the clone"),
            optparse.make_option("-/", dest="cloneExclude",
                                 action="append", type="string",
                                 help="exclude depot path"),
            optparse.make_option("--bare", dest="cloneBare",
                                 action="store_true", default=False),
        ]
        self.cloneDestination = None
        self.needsGit = False
        self.cloneBare = False

    # This is required for the "append" cloneExclude action
openconfig.py 文件源码 项目:oc-pyang 作者: openconfig 项目源码 文件源码 阅读 21 收藏 0 点赞 0 评论 0
def add_opts(self, optparser):
    optlist = [
        optparse.make_option("--openconfig",
                             dest="openconfig",
                             action="store_true",
                             help="""Validate the module(s) according to
                             OpenConfig conventions"""),
        optparse.make_option("--oc-only",
                             dest="openconfig_only",
                             action="store_true",
                             help="""Do not include standard lint (RFC 6087)
                             checking"""),
        ]
    g = optparser.add_option_group("OpenConfig specific options")
    g.add_options(optlist)
yangdoc.py 文件源码 项目:oc-pyang 作者: openconfig 项目源码 文件源码 阅读 21 收藏 0 点赞 0 评论 0
def add_opts(self, optparser):
    optlist = [
        optparse.make_option("--meta-only",
                              dest="meta_only",
                              action="store_true",
                              help="""Only produce documentation based on the
                              module metadata"""),
        optparse.make_option("--doc-format",
                              dest="doc_format",
                              action="store",
                              type="string",
                              default="markdown",
                              help="""Doc output format: markdown, html"""),
        optparse.make_option("--strip-ns",
                              dest="strip_namespace",
                              action="store_true",
                              help="""Strip namespace prefixes from
                                displayed paths"""),
        optparse.make_option("--no-structure",
                              dest="no_structure",
                              action="store_true",
                              help="""Do not generate docs for structure-only nodes (e.g., containers)"""),
        optparse.make_option("--doc-title",
                              dest="doc_title",
                              action="store",
                              type="string",
                              help="""Set the title of the output documentation page"""),
                ]
    g = optparser.add_option_group("docs output specific options")
    g.add_options(optlist)
plugin_base.py 文件源码 项目:midip-sslyze 作者: soukupa5 项目源码 文件源码 阅读 44 收藏 0 点赞 0 评论 0
def add_option(self, option, help, dest=None):
        """Options are settings specific to one single plugin; they will passed to process_task() in the options_dict.
        """
        # If dest is something, store it, otherwise just use store_true
        action="store_true"
        if dest is not None:
            action="store"

        self._options.append(make_option('--{}'.format(option), action=action, help=help, dest=dest))
plugin_base.py 文件源码 项目:midip-sslyze 作者: soukupa5 项目源码 文件源码 阅读 25 收藏 0 点赞 0 评论 0
def add_command(self, command, help, aggressive=False):
        """Commands are actions/scans the plugin implements, with PluginXXX.process_task().

        Setting aggressive to True is a warning that the command will open many simultaneous connections to the server
        and should therefore not be run concurrently with other `aggressive` commands against a given server.
        """

        self._commands.append(make_option('--{}'.format(command), action='store_true', help=help))
        self._commands_as_text.append((command, aggressive))
plugin_base.py 文件源码 项目:midip-sslyze 作者: soukupa5 项目源码 文件源码 阅读 28 收藏 0 点赞 0 评论 0
def _make_option(command, help, dest):
        # If dest is something, store it, otherwise just use store_true
        action="store_true"
        if dest is not None:
            action="store"

        return make_option('--' + command, action=action, help=help, dest=dest)
run_gunicorn.py 文件源码 项目:flasky 作者: RoseOu 项目源码 文件源码 阅读 23 收藏 0 点赞 0 评论 0
def make_options():
    opts = [
        make_option('--adminmedia', dest='admin_media_path', default='',
        help='Specifies the directory from which to serve admin media.')
    ]

    g_settings = make_settings(ignore=("version"))
    keys = g_settings.keys()
    for k in keys:
        if k in ('pythonpath', 'django_settings',):
            continue

        setting = g_settings[k]
        if not setting.cli:
            continue

        args = tuple(setting.cli)

        kwargs = {
            "dest": setting.name,
            "metavar": setting.meta or None,
            "action": setting.action or "store",
            "type": setting.type or "string",
            "default": None,
            "help": "%s [%s]" % (setting.short, setting.default)
        }
        if kwargs["action"] != "store":
            kwargs.pop("type")

        opts.append(make_option(*args, **kwargs))

    return tuple(opts)
run_gunicorn.py 文件源码 项目:chihu 作者: yelongyu 项目源码 文件源码 阅读 22 收藏 0 点赞 0 评论 0
def make_options():
    opts = [
        make_option('--adminmedia', dest='admin_media_path', default='',
        help='Specifies the directory from which to serve admin media.')
    ]

    g_settings = make_settings(ignore=("version"))
    keys = g_settings.keys()
    for k in keys:
        if k in ('pythonpath', 'django_settings',):
            continue

        setting = g_settings[k]
        if not setting.cli:
            continue

        args = tuple(setting.cli)

        kwargs = {
            "dest": setting.name,
            "metavar": setting.meta or None,
            "action": setting.action or "store",
            "type": setting.type or "string",
            "default": None,
            "help": "%s [%s]" % (setting.short, setting.default)
        }
        if kwargs["action"] != "store":
            kwargs.pop("type")

        opts.append(make_option(*args, **kwargs))

    return tuple(opts)
run_gunicorn.py 文件源码 项目:Price-Comparator 作者: Thejas-1 项目源码 文件源码 阅读 20 收藏 0 点赞 0 评论 0
def make_options():
    opts = [
        make_option('--adminmedia', dest='admin_media_path', default='',
        help='Specifies the directory from which to serve admin media.')
    ]

    g_settings = make_settings(ignore=("version"))
    keys = g_settings.keys()
    for k in keys:
        if k in ('pythonpath', 'django_settings',):
            continue

        setting = g_settings[k]
        if not setting.cli:
            continue

        args = tuple(setting.cli)

        kwargs = {
            "dest": setting.name,
            "metavar": setting.meta or None,
            "action": setting.action or "store",
            "type": setting.type or "string",
            "default": None,
            "help": "%s [%s]" % (setting.short, setting.default)
        }
        if kwargs["action"] != "store":
            kwargs.pop("type")

        opts.append(make_option(*args, **kwargs))

    return tuple(opts)
run_gunicorn.py 文件源码 项目:tabmaster 作者: NicolasMinghetti 项目源码 文件源码 阅读 21 收藏 0 点赞 0 评论 0
def make_options():
    opts = [
        make_option('--adminmedia', dest='admin_media_path', default='',
        help='Specifies the directory from which to serve admin media.')
    ]

    g_settings = make_settings(ignore=("version"))
    keys = g_settings.keys()
    for k in keys:
        if k in ('pythonpath', 'django_settings',):
            continue

        setting = g_settings[k]
        if not setting.cli:
            continue

        args = tuple(setting.cli)

        kwargs = {
            "dest": setting.name,
            "metavar": setting.meta or None,
            "action": setting.action or "store",
            "type": setting.type or "string",
            "default": None,
            "help": "%s [%s]" % (setting.short, setting.default)
        }
        if kwargs["action"] != "store":
            kwargs.pop("type")

        opts.append(make_option(*args, **kwargs))

    return tuple(opts)
run_gunicorn.py 文件源码 项目:infiblog 作者: RajuKoushik 项目源码 文件源码 阅读 24 收藏 0 点赞 0 评论 0
def make_options():
    opts = [
        make_option('--adminmedia', dest='admin_media_path', default='',
        help='Specifies the directory from which to serve admin media.')
    ]

    g_settings = make_settings(ignore=("version"))
    keys = g_settings.keys()
    for k in keys:
        if k in ('pythonpath', 'django_settings',):
            continue

        setting = g_settings[k]
        if not setting.cli:
            continue

        args = tuple(setting.cli)

        kwargs = {
            "dest": setting.name,
            "metavar": setting.meta or None,
            "action": setting.action or "store",
            "type": setting.type or "string",
            "default": None,
            "help": "%s [%s]" % (setting.short, setting.default)
        }
        if kwargs["action"] != "store":
            kwargs.pop("type")

        opts.append(make_option(*args, **kwargs))

    return tuple(opts)
argparse.py 文件源码 项目:stgit 作者: ctmarinas 项目源码 文件源码 阅读 24 收藏 0 点赞 0 评论 0
def get_option(self):
        kwargs = dict(self.kwargs)
        kwargs['help'] = kwargs['short']
        for k in ['short', 'long', 'args']:
            kwargs.pop(k, None)
        return optparse.make_option(*self.pargs, **kwargs)
run_gunicorn.py 文件源码 项目:metrics 作者: Jeremy-Friedman 项目源码 文件源码 阅读 21 收藏 0 点赞 0 评论 0
def make_options():
    opts = [
        make_option('--adminmedia', dest='admin_media_path', default='',
        help='Specifies the directory from which to serve admin media.')
    ]

    g_settings = make_settings(ignore=("version"))
    keys = g_settings.keys()
    for k in keys:
        if k in ('pythonpath', 'django_settings',):
            continue

        setting = g_settings[k]
        if not setting.cli:
            continue

        args = tuple(setting.cli)

        kwargs = {
            "dest": setting.name,
            "metavar": setting.meta or None,
            "action": setting.action or "store",
            "type": setting.type or "string",
            "default": None,
            "help": "%s [%s]" % (setting.short, setting.default)
        }
        if kwargs["action"] != "store":
            kwargs.pop("type")

        opts.append(make_option(*args, **kwargs))

    return tuple(opts)
run_gunicorn.py 文件源码 项目:metrics 作者: Jeremy-Friedman 项目源码 文件源码 阅读 20 收藏 0 点赞 0 评论 0
def make_options():
    opts = [
        make_option('--adminmedia', dest='admin_media_path', default='',
        help='Specifies the directory from which to serve admin media.')
    ]

    g_settings = make_settings(ignore=("version"))
    keys = g_settings.keys()
    for k in keys:
        if k in ('pythonpath', 'django_settings',):
            continue

        setting = g_settings[k]
        if not setting.cli:
            continue

        args = tuple(setting.cli)

        kwargs = {
            "dest": setting.name,
            "metavar": setting.meta or None,
            "action": setting.action or "store",
            "type": setting.type or "string",
            "default": None,
            "help": "%s [%s]" % (setting.short, setting.default)
        }
        if kwargs["action"] != "store":
            kwargs.pop("type")

        opts.append(make_option(*args, **kwargs))

    return tuple(opts)
run_gunicorn.py 文件源码 项目:logo-gen 作者: jellene4eva 项目源码 文件源码 阅读 19 收藏 0 点赞 0 评论 0
def make_options():
    opts = [
        make_option('--adminmedia', dest='admin_media_path', default='',
        help='Specifies the directory from which to serve admin media.')
    ]

    g_settings = make_settings(ignore=("version"))
    keys = g_settings.keys()
    for k in keys:
        if k in ('pythonpath', 'django_settings',):
            continue

        setting = g_settings[k]
        if not setting.cli:
            continue

        args = tuple(setting.cli)

        kwargs = {
            "dest": setting.name,
            "metavar": setting.meta or None,
            "action": setting.action or "store",
            "type": setting.type or "string",
            "default": None,
            "help": "%s [%s]" % (setting.short, setting.default)
        }
        if kwargs["action"] != "store":
            kwargs.pop("type")

        opts.append(make_option(*args, **kwargs))

    return tuple(opts)
run_gunicorn.py 文件源码 项目:liberator 作者: libscie 项目源码 文件源码 阅读 22 收藏 0 点赞 0 评论 0
def make_options():
    opts = [
        make_option('--adminmedia', dest='admin_media_path', default='',
        help='Specifies the directory from which to serve admin media.')
    ]

    g_settings = make_settings(ignore=("version"))
    keys = g_settings.keys()
    for k in keys:
        if k in ('pythonpath', 'django_settings',):
            continue

        setting = g_settings[k]
        if not setting.cli:
            continue

        args = tuple(setting.cli)

        kwargs = {
            "dest": setting.name,
            "metavar": setting.meta or None,
            "action": setting.action or "store",
            "type": setting.type or "string",
            "default": None,
            "help": "%s [%s]" % (setting.short, setting.default)
        }
        if kwargs["action"] != "store":
            kwargs.pop("type")

        opts.append(make_option(*args, **kwargs))

    return tuple(opts)
run_gunicorn.py 文件源码 项目:compatify 作者: hatooku 项目源码 文件源码 阅读 22 收藏 0 点赞 0 评论 0
def make_options():
    opts = [
        make_option('--adminmedia', dest='admin_media_path', default='',
        help='Specifies the directory from which to serve admin media.')
    ]

    g_settings = make_settings(ignore=("version"))
    keys = g_settings.keys()
    for k in keys:
        if k in ('pythonpath', 'django_settings',):
            continue

        setting = g_settings[k]
        if not setting.cli:
            continue

        args = tuple(setting.cli)

        kwargs = {
            "dest": setting.name,
            "metavar": setting.meta or None,
            "action": setting.action or "store",
            "type": setting.type or "string",
            "default": None,
            "help": "%s [%s]" % (setting.short, setting.default)
        }
        if kwargs["action"] != "store":
            kwargs.pop("type")

        opts.append(make_option(*args, **kwargs))

    return tuple(opts)
run_gunicorn.py 文件源码 项目:djanoDoc 作者: JustinChavez 项目源码 文件源码 阅读 21 收藏 0 点赞 0 评论 0
def make_options():
    opts = [
        make_option('--adminmedia', dest='admin_media_path', default='',
        help='Specifies the directory from which to serve admin media.')
    ]

    g_settings = make_settings(ignore=("version"))
    keys = g_settings.keys()
    for k in keys:
        if k in ('pythonpath', 'django_settings',):
            continue

        setting = g_settings[k]
        if not setting.cli:
            continue

        args = tuple(setting.cli)

        kwargs = {
            "dest": setting.name,
            "metavar": setting.meta or None,
            "action": setting.action or "store",
            "type": setting.type or "string",
            "default": None,
            "help": "%s [%s]" % (setting.short, setting.default)
        }
        if kwargs["action"] != "store":
            kwargs.pop("type")

        opts.append(make_option(*args, **kwargs))

    return tuple(opts)
run_gunicorn.py 文件源码 项目:Data-visualization 作者: insta-code1 项目源码 文件源码 阅读 25 收藏 0 点赞 0 评论 0
def make_options():
    opts = [
        make_option('--adminmedia', dest='admin_media_path', default='',
        help='Specifies the directory from which to serve admin media.')
    ]

    g_settings = make_settings(ignore=("version"))
    keys = g_settings.keys()
    for k in keys:
        if k in ('pythonpath', 'django_settings',):
            continue

        setting = g_settings[k]
        if not setting.cli:
            continue

        args = tuple(setting.cli)

        kwargs = {
            "dest": setting.name,
            "metavar": setting.meta or None,
            "action": setting.action or "store",
            "type": setting.type or "string",
            "default": None,
            "help": "%s [%s]" % (setting.short, setting.default)
        }
        if kwargs["action"] != "store":
            kwargs.pop("type")

        opts.append(make_option(*args, **kwargs))

    return tuple(opts)
ogrinspect.py 文件源码 项目:tissuelab 作者: VirtualPlants 项目源码 文件源码 阅读 23 收藏 0 点赞 0 评论 0
def layer_option(option, opt, value, parser):
    """
    Callback for `make_option` for the `ogrinspect` `layer_key`
    keyword option which may be an integer or a string.
    """
    try:
        dest = int(value)
    except ValueError:
        dest = value
    setattr(parser.values, option.dest, dest)
ogrinspect.py 文件源码 项目:tissuelab 作者: VirtualPlants 项目源码 文件源码 阅读 24 收藏 0 点赞 0 评论 0
def list_option(option, opt, value, parser):
    """
    Callback for `make_option` for `ogrinspect` keywords that require
    a string list.  If the string is 'True'/'true' then the option
    value will be a boolean instead.
    """
    if value.lower() == 'true':
        dest = True
    else:
        dest = [s for s in value.split(',')]
    setattr(parser.values, option.dest, dest)
run_gunicorn.py 文件源码 项目:django-next-train 作者: bitpixdigital 项目源码 文件源码 阅读 25 收藏 0 点赞 0 评论 0
def make_options():
    opts = [
        make_option('--adminmedia', dest='admin_media_path', default='',
        help='Specifies the directory from which to serve admin media.')
    ]

    g_settings = make_settings(ignore=("version"))
    keys = g_settings.keys()
    for k in keys:
        if k in ('pythonpath', 'django_settings',):
            continue

        setting = g_settings[k]
        if not setting.cli:
            continue

        args = tuple(setting.cli)

        kwargs = {
            "dest": setting.name,
            "metavar": setting.meta or None,
            "action": setting.action or "store",
            "type": setting.type or "string",
            "default": None,
            "help": "%s [%s]" % (setting.short, setting.default)
        }
        if kwargs["action"] != "store":
            kwargs.pop("type")

        opts.append(make_option(*args, **kwargs))

    return tuple(opts)
run_gunicorn.py 文件源码 项目:Lixiang_zhaoxin 作者: hejaxian 项目源码 文件源码 阅读 26 收藏 0 点赞 0 评论 0
def make_options():
    opts = [
        make_option('--adminmedia', dest='admin_media_path', default='',
        help='Specifies the directory from which to serve admin media.')
    ]

    g_settings = make_settings(ignore=("version"))
    keys = g_settings.keys()
    for k in keys:
        if k in ('pythonpath', 'django_settings',):
            continue

        setting = g_settings[k]
        if not setting.cli:
            continue

        args = tuple(setting.cli)

        kwargs = {
            "dest": setting.name,
            "metavar": setting.meta or None,
            "action": setting.action or "store",
            "type": setting.type or "string",
            "default": None,
            "help": "%s [%s]" % (setting.short, setting.default)
        }
        if kwargs["action"] != "store":
            kwargs.pop("type")

        opts.append(make_option(*args, **kwargs))

    return tuple(opts)
git_p4.py 文件源码 项目:python-zulip-api 作者: zulip 项目源码 文件源码 阅读 20 收藏 0 点赞 0 评论 0
def __init__(self):
        Command.__init__(self)
        self.options = [
            optparse.make_option("--local", dest="rollbackLocalBranches", action="store_true")
        ]
        self.description = "A tool to debug the multi-branch import. Don't use :)"
        self.rollbackLocalBranches = False
git_p4.py 文件源码 项目:python-zulip-api 作者: zulip 项目源码 文件源码 阅读 22 收藏 0 点赞 0 评论 0
def __init__(self):
        Command.__init__(self)
        P4UserMap.__init__(self)
        self.options = [
                optparse.make_option("--origin", dest="origin"),
                optparse.make_option("-M", dest="detectRenames", action="store_true"),
                # preserve the user, requires relevant p4 permissions
                optparse.make_option("--preserve-user", dest="preserveUser", action="store_true"),
                optparse.make_option("--export-labels", dest="exportLabels", action="store_true"),
                optparse.make_option("--dry-run", "-n", dest="dry_run", action="store_true"),
                optparse.make_option("--prepare-p4-only", dest="prepare_p4_only", action="store_true"),
                optparse.make_option("--conflict", dest="conflict_behavior",
                                     choices=self.conflict_behavior_choices),
                optparse.make_option("--branch", dest="branch"),
        ]
        self.description = "Submit changes from git to the perforce depot."
        self.usage += " [name of git branch to submit into perforce depot]"
        self.origin = ""
        self.detectRenames = False
        self.preserveUser = gitConfigBool("git-p4.preserveUser")
        self.dry_run = False
        self.prepare_p4_only = False
        self.conflict_behavior = None
        self.isWindows = (platform.system() == "Windows")
        self.exportLabels = False
        self.p4HasMoveCommand = p4_has_move_command()
        self.branch = None
git_p4.py 文件源码 项目:python-zulip-api 作者: zulip 项目源码 文件源码 阅读 23 收藏 0 点赞 0 评论 0
def __init__(self):
        Command.__init__(self)
        self.options = [
                optparse.make_option("--import-labels", dest="importLabels", action="store_true"),
        ]
        self.importLabels = False
        self.description = ("Fetches the latest revision from perforce and "
                            + "rebases the current work (branch) against it")
run_gunicorn.py 文件源码 项目:Alfred 作者: jkachhadia 项目源码 文件源码 阅读 22 收藏 0 点赞 0 评论 0
def make_options():
    opts = [
        make_option('--adminmedia', dest='admin_media_path', default='',
        help='Specifies the directory from which to serve admin media.')
    ]

    g_settings = make_settings(ignore=("version"))
    keys = g_settings.keys()
    for k in keys:
        if k in ('pythonpath', 'django_settings',):
            continue

        setting = g_settings[k]
        if not setting.cli:
            continue

        args = tuple(setting.cli)

        kwargs = {
            "dest": setting.name,
            "metavar": setting.meta or None,
            "action": setting.action or "store",
            "type": setting.type or "string",
            "default": None,
            "help": "%s [%s]" % (setting.short, setting.default)
        }
        if kwargs["action"] != "store":
            kwargs.pop("type")

        opts.append(make_option(*args, **kwargs))

    return tuple(opts)


问题


面经


文章

微信
公众号

扫码关注公众号