Ejemplo n.º 1
0
  def __init__(self, *args, **kw):
    if kw.get('action') not in self.STORE_ACTIONS:
      raise ValueError('Invalid action: %s' % (kw['action'],))

    self.__compatible_with_option = kw.pop('compatible_with_option', False)
    self.__action = kw.pop('action')
    try:
      self.__dest = kw.pop('dest')
    except KeyError:
      opt = args[0]
      if not opt.startswith('--'):
        raise ValueError
      self.__dest = opt[2:].replace('-', '_')
    if 'const' in kw:
      self.__const = kw.pop('const')

    kw['action'] = 'callback'
    kw['callback'] = self.__callback

    ManOption.__init__(self, *args, **kw)
Ejemplo n.º 2
0
    def __init__(self, *args, **kw):
        if kw.get("action") not in self.STORE_ACTIONS:
            raise ValueError("Invalid action: %s" % (kw["action"],))

        self.__compatible_with_option = kw.pop("compatible_with_option", False)
        self.__action = kw.pop("action")
        try:
            self.__dest = kw.pop("dest")
        except KeyError:
            opt = args[0]
            if not opt.startswith("--"):
                raise ValueError
            self.__dest = opt[2:].replace("-", "_")
        if "const" in kw:
            self.__const = kw.pop("const")

        kw["action"] = "callback"
        kw["callback"] = self.__callback

        ManOption.__init__(self, *args, **kw)
Ejemplo n.º 3
0
 def __init__(self, *args, **kw):
   ManOption.__init__(self, *args, **kw)