| | |
- __builtin__.dict(__builtin__.object)
-
- ReadOnlyDict
- __builtin__.object
-
- BaseConfig
- optparse.Option
-
- ExtendOption
- optparse.OptionParser(optparse.OptionContainer)
-
- ExtendedOptionParser
class BaseConfig(__builtin__.object) |
| |
Basic config setting/getting. |
| |
Methods defined here:
- __init__(self, config=None, initial_config_file=None, config_options=None, all_actions=None, default_actions=None, volatile_config=None, require_config_file=False, usage='usage: %prog [options]')
- get_actions(self)
- get_read_only_config(self)
- list_actions(self)
- parse_args(self, args=None)
- Parse command line arguments in a generic way.
Return the parser object after adding the basic options, so
child objects can manipulate it.
- set_config(self, config, overwrite=False)
- This is probably doable some other way.
- verify_actions(self, action_list, quiet=False)
Data descriptors defined here:
- __dict__
- dictionary for instance variables (if defined)
- __weakref__
- list of weak references to the object (if defined)
|
class ExtendOption(optparse.Option) |
| |
from http://docs.python.org/library/optparse.html?highlight=optparse#adding-new-actions |
| |
Methods defined here:
- take_action(self, action, dest, opt, value, values, parser)
Data and other attributes defined here:
- ACTIONS = ('store', 'store_const', 'store_true', 'store_false', 'append', 'append_const', 'count', 'callback', 'help', 'version', 'extend')
- ALWAYS_TYPED_ACTIONS = ('store', 'append', 'extend')
- STORE_ACTIONS = ('store', 'store_const', 'store_true', 'store_false', 'append', 'append_const', 'count', 'extend')
- TYPED_ACTIONS = ('store', 'append', 'callback', 'extend')
Methods inherited from optparse.Option:
- __init__(self, *opts, **attrs)
- __repr__ = _repr(self)
- __str__(self)
- check_value(self, opt, value)
- convert_value(self, opt, value)
- get_opt_string(self)
- process(self, opt, value, values, parser)
- takes_value(self)
Data and other attributes inherited from optparse.Option:
- ATTRS = ['action', 'type', 'dest', 'default', 'nargs', 'const', 'choices', 'callback', 'callback_args', 'callback_kwargs', 'help', 'metavar']
- CHECK_METHODS = [<function _check_action at 0xb7daca3c>, <function _check_type at 0xb7daca74>, <function _check_choice at 0xb7dacaac>, <function _check_dest at 0xb7dacae4>, <function _check_const at 0xb7dacb1c>, <function _check_nargs at 0xb7dacb54>, <function _check_callback at 0xb7dacb8c>]
- CONST_ACTIONS = ('store_const', 'append_const')
- TYPES = ('string', 'int', 'long', 'float', 'complex', 'choice')
- TYPE_CHECKER = {'choice': <function check_choice at 0xb7dac8ec>, 'complex': <function check_builtin at 0xb7dac8b4>, 'float': <function check_builtin at 0xb7dac8b4>, 'int': <function check_builtin at 0xb7dac8b4>, 'long': <function check_builtin at 0xb7dac8b4>}
|
class ExtendedOptionParser(optparse.OptionParser) |
| |
OptionParser, but with ExtendOption as the option_class. |
| |
- Method resolution order:
- ExtendedOptionParser
- optparse.OptionParser
- optparse.OptionContainer
Methods defined here:
- __init__(self, **kwargs)
Methods inherited from optparse.OptionParser:
- add_option_group(self, *args, **kwargs)
- check_values(self, values, args)
- check_values(values : Values, args : [string])
-> (values : Values, args : [string])
Check that the supplied option values and leftover arguments are
valid. Returns the option values and leftover arguments
(possibly adjusted, possibly completely new -- whatever you
like). Default implementation just returns the passed-in
values; subclasses may override as desired.
- destroy(self)
- Declare that you are done with this OptionParser. This cleans up
reference cycles so the OptionParser (and all objects referenced by
it) can be garbage-collected promptly. After calling destroy(), the
OptionParser is unusable.
- disable_interspersed_args(self)
- Set parsing to stop on the first non-option. Use this if
you have a command processor which runs another command that
has options of its own and you want to make sure these options
don't get confused.
- enable_interspersed_args(self)
- Set parsing to not stop on the first non-option, allowing
interspersing switches with command arguments. This is the
default behavior. See also disable_interspersed_args() and the
class documentation description of the attribute
allow_interspersed_args.
- error(self, msg)
- error(msg : string)
Print a usage message incorporating 'msg' to stderr and exit.
If you override this in a subclass, it should not return -- it
should either exit or raise an exception.
- exit(self, status=0, msg=None)
- expand_prog_name(self, s)
- format_epilog(self, formatter)
- format_help(self, formatter=None)
- format_option_help(self, formatter=None)
- get_default_values(self)
- get_description(self)
- get_option_group(self, opt_str)
- get_prog_name(self)
- get_usage(self)
- get_version(self)
- parse_args(self, args=None, values=None)
- parse_args(args : [string] = sys.argv[1:],
values : Values = None)
-> (values : Values, args : [string])
Parse the command-line options found in 'args' (default:
sys.argv[1:]). Any errors result in a call to 'error()', which
by default prints the usage message to stderr and calls
sys.exit() with an error message. On success returns a pair
(values, args) where 'values' is an Values instance (with all
your option values) and 'args' is the list of arguments left
over after parsing options.
- print_help(self, file=None)
- print_help(file : file = stdout)
Print an extended help message, listing all options and any
help text provided with them, to 'file' (default stdout).
- print_usage(self, file=None)
- print_usage(file : file = stdout)
Print the usage message for the current program (self.usage) to
'file' (default stdout). Any occurence of the string "%prog" in
self.usage is replaced with the name of the current program
(basename of sys.argv[0]). Does nothing if self.usage is empty
or not defined.
- print_version(self, file=None)
- print_version(file : file = stdout)
Print the version message for this program (self.version) to
'file' (default stdout). As with print_usage(), any occurence
of "%prog" in self.version is replaced by the current program's
name. Does nothing if self.version is empty or undefined.
- set_default(self, dest, value)
- set_defaults(self, **kwargs)
- set_process_default_values(self, process)
- set_usage(self, usage)
Data and other attributes inherited from optparse.OptionParser:
- standard_option_list = []
Methods inherited from optparse.OptionContainer:
- add_option(self, *args, **kwargs)
- add_option(Option)
add_option(opt_str, ..., kwarg=val, ...)
- add_options(self, option_list)
- format_description(self, formatter)
- get_option(self, opt_str)
- has_option(self, opt_str)
- remove_option(self, opt_str)
- set_conflict_handler(self, handler)
- set_description(self, description)
|
class ReadOnlyDict(__builtin__.dict) |
| |
# ReadOnlyDict {{{1 |
| |
- Method resolution order:
- ReadOnlyDict
- __builtin__.dict
- __builtin__.object
Methods defined here:
- __delitem__(self, *args)
- __init__(self, dictionary)
- __setitem__(self, *args)
- clear(self, *args)
- lock(self)
- pop(self, *args)
- popitem(self, *args)
- setdefault(self, *args)
- update(self, *args)
Data descriptors defined here:
- __dict__
- dictionary for instance variables (if defined)
- __weakref__
- list of weak references to the object (if defined)
Methods inherited from __builtin__.dict:
- __cmp__(...)
- x.__cmp__(y) <==> cmp(x,y)
- __contains__(...)
- D.__contains__(k) -> True if D has a key k, else False
- __eq__(...)
- x.__eq__(y) <==> x==y
- __ge__(...)
- x.__ge__(y) <==> x>=y
- __getattribute__(...)
- x.__getattribute__('name') <==> x.name
- __getitem__(...)
- x.__getitem__(y) <==> x[y]
- __gt__(...)
- x.__gt__(y) <==> x>y
- __iter__(...)
- x.__iter__() <==> iter(x)
- __le__(...)
- x.__le__(y) <==> x<=y
- __len__(...)
- x.__len__() <==> len(x)
- __lt__(...)
- x.__lt__(y) <==> x<y
- __ne__(...)
- x.__ne__(y) <==> x!=y
- __repr__(...)
- x.__repr__() <==> repr(x)
- __sizeof__(...)
- D.__sizeof__() -> size of D in memory, in bytes
- copy(...)
- D.copy() -> a shallow copy of D
- get(...)
- D.get(k[,d]) -> D[k] if k in D, else d. d defaults to None.
- has_key(...)
- D.has_key(k) -> True if D has a key k, else False
- items(...)
- D.items() -> list of D's (key, value) pairs, as 2-tuples
- iteritems(...)
- D.iteritems() -> an iterator over the (key, value) items of D
- iterkeys(...)
- D.iterkeys() -> an iterator over the keys of D
- itervalues(...)
- D.itervalues() -> an iterator over the values of D
- keys(...)
- D.keys() -> list of D's keys
- values(...)
- D.values() -> list of D's values
Data and other attributes inherited from __builtin__.dict:
- __hash__ = None
- __new__ = <built-in method __new__ of type object at 0x8169060>
- T.__new__(S, ...) -> a new object with type S, a subtype of T
- fromkeys = <built-in method fromkeys of type object at 0x8243cf4>
- dict.fromkeys(S[,v]) -> New dict with keys from S and values equal to v.
v defaults to None.
| |