Module configobj :: Class InterpolationEngine
[hide private]
[frames] | no frames]

Class InterpolationEngine

source code

object --+
         |
        InterpolationEngine
Known Subclasses:


A helper class to help perform string interpolation.

This class is an abstract base class; its descendants perform
the actual work.

Instance Methods [hide private]
 
__init__(self, section)
x.__init__(...) initializes x; see x.__class__.__doc__ for signature
source code
 
interpolate(self, key, value) source code
 
_fetch(self, key)
Helper function to fetch values from owning section.
source code
 
_parse_match(self, match)
Implementation-dependent helper function.
source code

Inherited from object: __delattr__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __str__

Class Variables [hide private]
  _KEYCRE = re.compile(r'%\(([^\)]*)\)s')
Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, section)
(Constructor)

source code 

x.__init__(...) initializes x; see x.__class__.__doc__ for signature

Overrides: object.__init__
(inherited documentation)

_fetch(self, key)

source code 
Helper function to fetch values from owning section.

Returns a 2-tuple: the value, and the section where it was found.

_parse_match(self, match)

source code 
Implementation-dependent helper function.

Will be passed a match object corresponding to the interpolation
key we just found (e.g., "%(foo)s" or "$foo"). Should look up that
key in the appropriate config file section (using the ``_fetch()``
helper function) and return a 3-tuple: (key, value, section)

``key`` is the name of the key we're looking for
``value`` is the value found for that key
``section`` is a reference to the section where it was found

``key`` and ``section`` should be None if no further
interpolation should be performed on the resulting value
(e.g., if we interpolated "$$" and returned "$").