Module config :: Class Mapping
[show private | hide private]
[frames | no frames]

Type Mapping

object --+    
         |    
 Container --+
             |
            Mapping

Known Subclasses:
Config

This internal class implements key-value mappings in configurations.
Method Summary
  __init__(self, parent)
Initialize an instance.
  __contains__(self, item)
  __delitem__(self, key)
Remove an item
  __getattr__(self, key)
  __getattribute__(self, name)
  __getitem__(self, key)
  __iter__(self)
  __len__(self)
  __repr__(self)
  __setattr__(self, name, value)
  __setitem__(self, name, value)
  __str__(self)
  addMapping(self, key, value, comment, setting)
Add a key-value mapping with a comment.
  get(self, key, default)
Allows a dictionary-style get operation.
  iteritems(self)
  iterkeys(self)
  keys(self)
Return the keys in a similar way to a dictionary.
  save(self, stream, indent)
Save this configuration to the specified stream.
  writeToStream(self, stream, indent, container)
Write this instance to a stream at the specified indentation level.
    Inherited from Container
  evaluate(self, item)
Evaluate items which are instances of Reference or Expression.
  setPath(self, path)
Set the path for this instance.
  writeValue(self, value, stream, indent)
    Inherited from object
  __delattr__(...)
x.__delattr__('name') <==> del x.name
  __hash__(x)
Return hash(x)...
  __new__(T, S, ...)
Return a new object with type S, a subtype of T...
  __reduce__(...)
helper for pickle
  __reduce_ex__(...)
helper for pickle

Instance Variable Summary
    Inherited from Container
  path: A string which describes how to get to this instance from the root of the hierarchy.

Method Details

__init__(self, parent=None)
(Constructor)

Initialize an instance.
Parameters:
parent - The parent of this instance in the hierarchy.
           (type=A Container instance.)
Overrides:
config.Container.__init__

__contains__(self, item)
(In operator)

__delitem__(self, key)
(Index deletion operator)

Remove an item

__getattr__(self, key)
(Qualification operator)

__getattribute__(self, name)

Overrides:
__builtin__.object.__getattribute__

__getitem__(self, key)
(Indexing operator)

__iter__(self)

__len__(self)
(Length operator)

__repr__(self)
(Representation operator)

Overrides:
__builtin__.object.__repr__

__setattr__(self, name, value)

Overrides:
__builtin__.object.__setattr__

__setitem__(self, name, value)
(Index assignment operator)

Overrides:
__builtin__.object.__setattr__

__str__(self)
(Informal representation operator)

Overrides:
__builtin__.object.__str__

addMapping(self, key, value, comment, setting=False)

Add a key-value mapping with a comment.
Parameters:
key - The key for the mapping.
           (type=str)
value - The value for the mapping.
           (type=any)
comment - The comment for the key (can be None).
           (type=str)
setting - If True, ignore clashes. This is set to true when called from __setattr__.
Raises:
ConfigFormatError - If an existing key is seen again and setting is False.

get(self, key, default=None)

Allows a dictionary-style get operation.

iteritems(self)

iterkeys(self)

keys(self)

Return the keys in a similar way to a dictionary.

save(self, stream, indent=0)

Save this configuration to the specified stream.
Parameters:
stream - A stream to which the configuration is written.
           (type=A write-only stream (file-like object).)
indent - The indentation level for the output.
           (type=int)

writeToStream(self, stream, indent, container)

Write this instance to a stream at the specified indentation level.

Should be redefined in subclasses.
Parameters:
stream - The stream to write to
           (type=A writable stream (file-like object))
indent - The indentation level
           (type=int)
container - The container of this instance
           (type=Container)
Overrides:
config.Container.writeToStream