Package jazzparser :: Package data :: Module assignments :: Class EquivalenceAssignment
[hide private]
[frames] | no frames]

Class EquivalenceAssignment

source code

object --+    
         |    
      dict --+
             |
            EquivalenceAssignment

A special kind of dict that stores not only a mapping from keys to values, but also equivalence classes of keys. Manages the equivalence classes so that values get assigned to all the keys as soon as one of them is given a value.

Nested Classes [hide private]
  IncompatibleAssignmentError
Instance Methods [hide private]
new empty dictionary

__init__(self, *args, **kwargs)
x.__init__(...) initializes x; see help(type(x)) for signature
source code
 
_pop_class(self, key)
Return the equivalence class including the key, if one exists, removing from the list of classes.
source code
 
_get_class(self, key) source code
 
__setitem__(self, key, value)
x[i]=y
source code
 
add_equivalence(self, key1, key2)
Asserts the equivalence of the two keys.
source code
 
resolve_conflict(self, old_value, new_value)
When two values are fighting for the same key, this method decides which to pick, or raises an exception if the conflict cannot be resolved (i.e.
source code
None
update(self, ass)
Update D from dict/iterable E and F.
source code
 
__str__(self)
str(x)
source code

Inherited from dict: __cmp__, __contains__, __delitem__, __eq__, __ge__, __getattribute__, __getitem__, __gt__, __iter__, __le__, __len__, __lt__, __ne__, __new__, __repr__, __sizeof__, clear, copy, fromkeys, get, has_key, items, iteritems, iterkeys, itervalues, keys, pop, popitem, setdefault, values, viewitems, viewkeys, viewvalues

Inherited from object: __delattr__, __format__, __reduce__, __reduce_ex__, __setattr__, __subclasshook__

Class Variables [hide private]

Inherited from dict: __hash__

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, *args, **kwargs)
(Constructor)

source code 

x.__init__(...) initializes x; see help(type(x)) for signature

Returns:
new empty dictionary

Overrides: object.__init__
(inherited documentation)

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

source code 

x[i]=y

Overrides: dict.__setitem__
(inherited documentation)

resolve_conflict(self, old_value, new_value)

source code 

When two values are fighting for the same key, this method decides which to pick, or raises an exception if the conflict cannot be resolved (i.e. incompatible values). By default this raises an exception if the values are not equal. Should be overridden by subclasses.

update(self, ass)

source code 

Update D from dict/iterable E and F. If E present and has a .keys() method, does: for k in E: D[k] = E[k] If E present and lacks .keys() method, does: for (k, v) in E: D[k] = v In either case, this is followed by: for k in F: D[k] = F[k]

Returns: None
Overrides: dict.update
(inherited documentation)

__str__(self)
(Informal representation operator)

source code 

str(x)

Overrides: object.__str__
(inherited documentation)