Back to index

python3.2  3.2.2
Public Member Functions | Private Member Functions | Private Attributes | Static Private Attributes
optparse.Values Class Reference

List of all members.

Public Member Functions

def __init__
def __str__
def __eq__
def read_module
def read_file
def ensure_value

Private Member Functions

def _update_careful
def _update_loose
def _update

Private Attributes

 __dict__

Static Private Attributes

 __repr__ = _repr

Detailed Description

Definition at line 824 of file optparse.py.


Constructor & Destructor Documentation

def optparse.Values.__init__ (   self,
  defaults = None 
)

Definition at line 826 of file optparse.py.

00826 
00827     def __init__(self, defaults=None):
00828         if defaults:
00829             for (attr, val) in defaults.items():
00830                 setattr(self, attr, val)

Here is the caller graph for this function:


Member Function Documentation

def optparse.Values.__eq__ (   self,
  other 
)

Definition at line 836 of file optparse.py.

00836 
00837     def __eq__(self, other):
00838         if isinstance(other, Values):
00839             return self.__dict__ == other.__dict__
00840         elif isinstance(other, dict):
00841             return self.__dict__ == other
00842         else:
00843             return NotImplemented

def optparse.Values.__str__ (   self)

Definition at line 831 of file optparse.py.

00831 
00832     def __str__(self):
00833         return str(self.__dict__)

def optparse.Values._update (   self,
  dict,
  mode 
) [private]

Definition at line 865 of file optparse.py.

00865 
00866     def _update(self, dict, mode):
00867         if mode == "careful":
00868             self._update_careful(dict)
00869         elif mode == "loose":
00870             self._update_loose(dict)
00871         else:
00872             raise ValueError("invalid update mode: %r" % mode)

Here is the call graph for this function:

Here is the caller graph for this function:

def optparse.Values._update_careful (   self,
  dict 
) [private]
Update the option values from an arbitrary dictionary, but only
use keys from dict that already have a corresponding attribute
in self.  Any keys in dict without a corresponding attribute
are silently ignored.

Definition at line 844 of file optparse.py.

00844 
00845     def _update_careful(self, dict):
00846         """
00847         Update the option values from an arbitrary dictionary, but only
00848         use keys from dict that already have a corresponding attribute
00849         in self.  Any keys in dict without a corresponding attribute
00850         are silently ignored.
00851         """
00852         for attr in dir(self):
00853             if attr in dict:
00854                 dval = dict[attr]
00855                 if dval is not None:
00856                     setattr(self, attr, dval)

Here is the caller graph for this function:

def optparse.Values._update_loose (   self,
  dict 
) [private]
Update the option values from an arbitrary dictionary,
using all keys from the dictionary regardless of whether
they have a corresponding attribute in self or not.

Definition at line 857 of file optparse.py.

00857 
00858     def _update_loose(self, dict):
00859         """
00860         Update the option values from an arbitrary dictionary,
00861         using all keys from the dictionary regardless of whether
00862         they have a corresponding attribute in self or not.
00863         """
00864         self.__dict__.update(dict)

Here is the caller graph for this function:

def optparse.Values.ensure_value (   self,
  attr,
  value 
)

Definition at line 883 of file optparse.py.

00883 
00884     def ensure_value(self, attr, value):
00885         if not hasattr(self, attr) or getattr(self, attr) is None:
00886             setattr(self, attr, value)
00887         return getattr(self, attr)
00888 

Here is the call graph for this function:

def optparse.Values.read_file (   self,
  filename,
  mode = "careful" 
)

Definition at line 878 of file optparse.py.

00878 
00879     def read_file(self, filename, mode="careful"):
00880         vars = {}
00881         exec(open(filename).read(), vars)
00882         self._update(vars, mode)

Here is the call graph for this function:

def optparse.Values.read_module (   self,
  modname,
  mode = "careful" 
)

Definition at line 873 of file optparse.py.

00873 
00874     def read_module(self, modname, mode="careful"):
00875         __import__(modname)
00876         mod = sys.modules[modname]
00877         self._update(vars(mod), mode)

Here is the call graph for this function:


Member Data Documentation

Definition at line 838 of file optparse.py.

optparse.Values.__repr__ = _repr [static, private]

Definition at line 834 of file optparse.py.


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