コード例 #1
0
  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
コード例 #2
0
ファイル: OptParserExtended.py プロジェクト: cadieu/v1like
 def __init__( self, *args, **kwargs ):
     try:
         ltype = kwargs.pop('ltype')
     except:
         ltype = None
     Option.__init__( self, *args, **kwargs )
     self.ltype = ltype
コード例 #3
0
    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
コード例 #4
0
ファイル: optgroup.py プロジェクト: wadoon/pytagsfs
    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)
コード例 #5
0
ファイル: optgroup.py プロジェクト: wadoon/pytagsfs
    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)
コード例 #6
0
    def __init__(self, *args, **kwds):
        try:
            self.config_key = kwds["config_key"]
            del kwds["config_key"]
        except KeyError:
            self.config_key = None

        Option.__init__(self, *args, **kwds)
        self._seen = False
コード例 #7
0
ファイル: subbedopts.py プロジェクト: L3I-2021/roomdrop-dev
    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)
コード例 #8
0
ファイル: subbedopts.py プロジェクト: p-static/tahoe-lafs
    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)
コード例 #9
0
ファイル: optgroup.py プロジェクト: wadoon/pytagsfs
    def __init__(self, *args, **kwargs):
        self.group_parser = kwargs['group_parser']
        del kwargs['group_parser']

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

        if 'metavar' not in kwargs:
            kwargs['metavar'] = 'opt,opt,...'

        Option.__init__(self, *args, **kwargs)

        self._check_dest()
コード例 #10
0
ファイル: optgroup.py プロジェクト: wadoon/pytagsfs
    def __init__(self, *args, **kwargs):
        self.group_parser = kwargs['group_parser']
        del kwargs['group_parser']

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

        if 'metavar' not in kwargs:
            kwargs['metavar'] = 'opt,opt,...'

        Option.__init__(self, *args, **kwargs)

        self._check_dest()
コード例 #11
0
ファイル: configopt.py プロジェクト: gak/pysty
    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)
 def __init__(self, *opts, **attrs):
     BaseOption.__init__(self, *opts, **attrs)
     if hasattr(self, "hide") and self.hide:
         self.help = SUPPRESS_HELP
コード例 #13
0
 def __init__(self, *opts, **attrs):
     Option.__init__(self, *opts, **attrs)
     self._look_for_config_value()
     self._look_for_env_var()
コード例 #14
0
 def __init__(self, *args, **kwargs):
     completer = kwargs.pop('completer', None)
     Option.__init__(self, *args, **kwargs)
     if completer:
         self.completer = completer
コード例 #15
0
ファイル: optik_ext.py プロジェクト: iqbalamr/tubes-basdat
 def __init__(self, *opts: str, **attrs: Any) -> None:
     BaseOption.__init__(self, *opts, **attrs)
     # mypy: "Option" has no attribute "hide"
     # we test that in the if
     if hasattr(self, "hide") and self.hide:  # type: ignore
         self.help = SUPPRESS_HELP
コード例 #16
0
ファイル: optik_ext.py プロジェクト: 173210/depot_tools
 def __init__(self, *opts, **attrs):
     BaseOption.__init__(self, *opts, **attrs)
     if hasattr(self, "hide") and self.hide:
         self.help = SUPPRESS_HELP
コード例 #17
0
ファイル: regroup.py プロジェクト: cblp/tabkit
 def __init__(self, *args, **kwargs):
     kwargs['type'] = 'float'
     Option.__init__(self, *args, **kwargs)  # Option is old-style class
コード例 #18
0
ファイル: options.py プロジェクト: molihuadba/dbatools-1
 def __init__(self, *opts, **attrs):
     if 'choices' in attrs:
         attrs['choices'] = [attr.lower() for attr in attrs['choices']]
     CustomOption.__init__(self, *opts, **attrs)
コード例 #19
0
ファイル: tel.py プロジェクト: BackupTheBerlios/tel-svn
 def __init__(self, *opts, **attrs):
     Option.__init__(self, *opts, **attrs)
コード例 #20
0
ファイル: options.py プロジェクト: puiterwijk/pykickstart
 def __init__(self, *args, **kwargs):
     self.deprecated = False
     self.required = False
     Option.__init__(self, *args, **kwargs)
コード例 #21
0
 def __init__(self, *args, **kwargs):
     self.deprecated = False
     self.required = False
     Option.__init__(self, *args, **kwargs)
コード例 #22
0
ファイル: optcomplete.py プロジェクト: fagan2888/optcomplete
 def __init__(self, *args, **kwargs):
     completer = kwargs.pop('completer', None)
     Option.__init__(self, *args, **kwargs)
     if completer:
         self.completer = completer
コード例 #23
0
ファイル: options.py プロジェクト: dannykopping/deploi
 def __init__(self, *opts, **attrs):
     if 'choices' in attrs:
         attrs['choices'] = [ attr.lower() for attr in attrs['choices'] ]
     CustomOption.__init__(self, *opts, **attrs)
コード例 #24
0
ファイル: tel.py プロジェクト: BackupTheBerlios/tel-svn
 def __init__(self, *opts, **attrs):
     Option.__init__(self, *opts, **attrs)