Back to index

python3.2  3.2.2
Public Member Functions | Public Attributes | Static Public Attributes
test.test_optparse.TestExtendAddActions.MyOption Class Reference
Inheritance diagram for test.test_optparse.TestExtendAddActions.MyOption:
Inheritance graph
[legend]
Collaboration diagram for test.test_optparse.TestExtendAddActions.MyOption:
Collaboration graph
[legend]

List of all members.

Public Member Functions

def take_action
def __str__
def takes_value
def get_opt_string
def check_value
def convert_value
def process

Public Attributes

 action
 type
 dest
 nargs

Static Public Attributes

tuple ACTIONS = Option.ACTIONS+("extend",)
tuple STORE_ACTIONS = Option.STORE_ACTIONS+("extend",)
tuple TYPED_ACTIONS = Option.TYPED_ACTIONS+("extend",)
list ATTRS
tuple ALWAYS_TYPED_ACTIONS
tuple CONST_ACTIONS
tuple TYPES = ("string", "int", "long", "float", "complex", "choice")
dictionary TYPE_CHECKER
 CHECK_METHODS = None
list CHECK_METHODS

Detailed Description

Definition at line 1049 of file test_optparse.py.


Member Function Documentation

def optparse.Option.__str__ (   self) [inherited]

Definition at line 745 of file optparse.py.

00745 
00746     def __str__(self):
00747         return "/".join(self._short_opts + self._long_opts)

def optparse.Option.check_value (   self,
  opt,
  value 
) [inherited]

Definition at line 762 of file optparse.py.

00762 
00763     def check_value(self, opt, value):
00764         checker = self.TYPE_CHECKER.get(self.type)
00765         if checker is None:
00766             return value
00767         else:
00768             return checker(self, opt, value)

Here is the call graph for this function:

Here is the caller graph for this function:

def optparse.Option.convert_value (   self,
  opt,
  value 
) [inherited]

Definition at line 769 of file optparse.py.

00769 
00770     def convert_value(self, opt, value):
00771         if value is not None:
00772             if self.nargs == 1:
00773                 return self.check_value(opt, value)
00774             else:
00775                 return tuple([self.check_value(opt, v) for v in value])

Here is the call graph for this function:

Here is the caller graph for this function:

def optparse.Option.get_opt_string (   self) [inherited]

Definition at line 753 of file optparse.py.

00753 
00754     def get_opt_string(self):
00755         if self._long_opts:
00756             return self._long_opts[0]
00757         else:
00758             return self._short_opts[0]
00759 

def optparse.Option.process (   self,
  opt,
  value,
  values,
  parser 
) [inherited]

Definition at line 776 of file optparse.py.

00776 
00777     def process(self, opt, value, values, parser):
00778 
00779         # First, convert the value(s) to the right type.  Howl if any
00780         # value(s) are bogus.
00781         value = self.convert_value(opt, value)
00782 
00783         # And then take whatever action is expected of us.
00784         # This is a separate method to make life easier for
00785         # subclasses to add new actions.
00786         return self.take_action(
00787             self.action, self.dest, opt, value, values, parser)

Here is the call graph for this function:

def test.test_optparse.TestExtendAddActions.MyOption.take_action (   self,
  action,
  dest,
  opt,
  value,
  values,
  parser 
)

Reimplemented from optparse.Option.

Definition at line 1054 of file test_optparse.py.

01054 
01055         def take_action(self, action, dest, opt, value, values, parser):
01056             if action == "extend":
01057                 lvalue = value.split(",")
01058                 values.ensure_value(dest, []).extend(lvalue)
01059             else:
01060                 Option.take_action(self, action, dest, opt, parser, value,
01061                                    values)
01062 
    def test_extend_add_action(self):
def optparse.Option.takes_value (   self) [inherited]

Definition at line 750 of file optparse.py.

00750 
00751     def takes_value(self):
00752         return self.type is not None


Member Data Documentation

Definition at line 629 of file optparse.py.

Reimplemented from optparse.Option.

Definition at line 1050 of file test_optparse.py.

tuple optparse.Option.ALWAYS_TYPED_ACTIONS [static, inherited]
Initial value:
("store",
                            "append")

Definition at line 511 of file optparse.py.

list optparse.Option.ATTRS [static, inherited]
Initial value:
['action',
             'type',
             'dest',
             'default',
             'nargs',
             'const',
             'choices',
             'callback',
             'callback_args',
             'callback_kwargs',
             'help',
             'metavar']

Definition at line 466 of file optparse.py.

optparse.Option.CHECK_METHODS = None [static, inherited]

Definition at line 554 of file optparse.py.

list optparse.Option.CHECK_METHODS [static, inherited]
Initial value:
[_check_action,
                     _check_type,
                     _check_choice,
                     _check_dest,
                     _check_const,
                     _check_nargs,
                     _check_callback]

Definition at line 734 of file optparse.py.

tuple optparse.Option.CONST_ACTIONS [static, inherited]
Initial value:
("store_const",
                     "append_const")

Definition at line 515 of file optparse.py.

optparse.Option.dest [inherited]

Definition at line 687 of file optparse.py.

optparse.Option.nargs [inherited]

Definition at line 700 of file optparse.py.

Reimplemented from optparse.Option.

Definition at line 1051 of file test_optparse.py.

optparse.Option.type [inherited]

Definition at line 638 of file optparse.py.

Initial value:
{ "int"    : check_builtin,
                     "long"   : check_builtin,
                     "float"  : check_builtin,
                     "complex": check_builtin,
                     "choice" : check_choice,
                   }

Reimplemented in test.test_optparse.TestExtendAddTypes.MyOption, and test.test_optparse.DurationOption.

Definition at line 538 of file optparse.py.

Reimplemented from optparse.Option.

Definition at line 1052 of file test_optparse.py.

tuple optparse.Option.TYPES = ("string", "int", "long", "float", "complex", "choice") [static, inherited]

The documentation for this class was generated from the following file: