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


Python Option.__init__方法代码示例

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


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

示例1: __init__

# 需要导入模块: from optparse import Option [as 别名]
# 或者: from optparse.Option import __init__ [as 别名]
  def __init__(self, *opt_str, **attrs):
    """
      *opt_str: Same meaning as in twitter.common.options.Option, at least one is required.
      **attrs: See twitter.common.options.Option, with the following caveats:

      Exactly one of the following must be provided:

      clusters: A static Clusters object from which to pick clusters.
      cluster_provider: A function that takes a cluster name and returns a Cluster object.
    """
    self.clusters = attrs.pop('clusters', None)
    self.cluster_provider = attrs.pop('cluster_provider', None)
    if not (self.clusters is not None) ^ (self.cluster_provider is not None):
      raise ValueError('Must specify exactly one of clusters and cluster_provider.')

    default_attrs = dict(
      default=None,
      action='store',
      type='mesos_cluster',
      help='Mesos cluster to use (Default: %%default)'
    )

    combined_attrs = default_attrs
    combined_attrs.update(attrs)  # Defensive copy
    Option.__init__(self, *opt_str, **combined_attrs)  # old-style superclass
开发者ID:MustafaOrkunAcar,项目名称:incubator-aurora,代码行数:27,代码来源:cluster_option.py

示例2: __init__

# 需要导入模块: from optparse import Option [as 别名]
# 或者: from optparse.Option import __init__ [as 别名]
 def __init__( self, *args, **kwargs ):
     try:
         ltype = kwargs.pop('ltype')
     except:
         ltype = None
     Option.__init__( self, *args, **kwargs )
     self.ltype = ltype
开发者ID:abhijitbendale,项目名称:rls-lab,代码行数:9,代码来源:OptParserExtended.py

示例3: __init__

# 需要导入模块: from optparse import Option [as 别名]
# 或者: from optparse.Option import __init__ [as 别名]
    def __init__(self, opt, *args, **kwargs):
        if 'dest' not in kwargs:
            # Override default dest, which would strip first two characters:
            kwargs['dest'] = opt.replace('-', '_')

        self.group = kwargs['group']
        del kwargs['group']

        Option.__init__(self, opt, *args, **kwargs)
开发者ID:wadoon,项目名称:pytagsfs,代码行数:11,代码来源:optgroup.py

示例4: __init__

# 需要导入模块: from optparse import Option [as 别名]
# 或者: from optparse.Option import __init__ [as 别名]
    def __init__(self, *opts, **attrs):

       self.subopt_map = {}

       if "subopt" in attrs:
           self._short_opts = []
           self._long_opts = []
           self._set_opt_strings(opts)
           self.baseopt = self._short_opts[0] or self._long_opts[0]
           opts = ()

       Option.__init__(self, *opts, **attrs)
开发者ID:p-static,项目名称:tahoe-lafs,代码行数:14,代码来源:subbedopts.py

示例5: __init__

# 需要导入模块: from optparse import Option [as 别名]
# 或者: from optparse.Option import __init__ [as 别名]
    def __init__(self, *args, **kwargs):
        if 'group' in kwargs:
            self.group = kwargs['group']
            del kwargs['group']
        else:
            self.group = None

        if 'option' in kwargs:
            self.option = kwargs['option']
            del kwargs['option']
        else:
            self.option = None

        if 'conflict_group' in kwargs:
            self.conflict_group = kwargs['conflict_group']
            del kwargs['conflict_group']
        else:
            self.conflict_group = None

        Option.__init__(self, *args, **kwargs)
开发者ID:gak,项目名称:pysty,代码行数:22,代码来源:configopt.py

示例6: __init__

# 需要导入模块: from optparse import Option [as 别名]
# 或者: from optparse.Option import __init__ [as 别名]
 def __init__(self, *opts, **attrs):
     if 'choices' in attrs:
         attrs['choices'] = [ attr.lower() for attr in attrs['choices'] ]
     CustomOption.__init__(self, *opts, **attrs)
开发者ID:dannykopping,项目名称:deploi,代码行数:6,代码来源:options.py

示例7: __init__

# 需要导入模块: from optparse import Option [as 别名]
# 或者: from optparse.Option import __init__ [as 别名]
 def __init__(self, *opts, **attrs):
     BaseOption.__init__(self, *opts, **attrs)
     if hasattr(self, "hide") and self.hide:
         self.help = SUPPRESS_HELP
开发者ID:173210,项目名称:depot_tools,代码行数:6,代码来源:optik_ext.py

示例8: __init__

# 需要导入模块: from optparse import Option [as 别名]
# 或者: from optparse.Option import __init__ [as 别名]
 def __init__(self, *args, **kwargs):
     completer = kwargs.pop('completer', None)
     Option.__init__(self, *args, **kwargs)
     if completer:
         self.completer = completer
开发者ID:oubiwann,项目名称:optcomplete,代码行数:7,代码来源:optcomplete_timo.py

示例9: __init__

# 需要导入模块: from optparse import Option [as 别名]
# 或者: from optparse.Option import __init__ [as 别名]
 def __init__(self, *args, **kwargs):
     kwargs['type'] = 'float'
     Option.__init__(self, *args, **kwargs)  # Option is old-style class
开发者ID:cblp,项目名称:tabkit,代码行数:5,代码来源:regroup.py

示例10: __init__

# 需要导入模块: from optparse import Option [as 别名]
# 或者: from optparse.Option import __init__ [as 别名]
 def __init__(self, *opts, **attrs):
     Option.__init__(self, *opts, **attrs)
开发者ID:BackupTheBerlios,项目名称:tel-svn,代码行数:4,代码来源:tel.py

示例11: __init__

# 需要导入模块: from optparse import Option [as 别名]
# 或者: from optparse.Option import __init__ [as 别名]
 def __init__(self, *args, **kwargs):
     self.deprecated = False
     self.required = False
     Option.__init__(self, *args, **kwargs)
开发者ID:puiterwijk,项目名称:pykickstart,代码行数:6,代码来源:options.py

示例12: __init__

# 需要导入模块: from optparse import Option [as 别名]
# 或者: from optparse.Option import __init__ [as 别名]
 def __init__(self, *opts, **attrs):
     Option.__init__(self, *opts, **attrs)
     self._look_for_config_value()
     self._look_for_env_var()
开发者ID:jwhitlark,项目名称:ConfigurationManager,代码行数:6,代码来源:ConfigManager.py


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