Package obitools :: Package graph :: Class Indexer
[hide private]
[frames] | no frames]

Class Indexer

source code


Allow to manage convertion between an arbitrarly hashable python value and an unique integer key

Instance Methods [hide private]
new empty dictionary

__init__(self)
Constructor
source code
 
getLabel(self, index)
Return the python value associated to an integer index.
source code
 
getIndex(self, key, strict=False) source code
int
__getitem__(self, key)
Return the integer key associated to a python value.
source code
bool
__equal__(self, index)
Implement equa operator.
source code

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

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

Class Variables [hide private]

Inherited from dict: __hash__

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self)
(Constructor)

source code 

Constructor

Returns:
new empty dictionary

Overrides: object.__init__

getLabel(self, index)

source code 

Return the python value associated to an integer index.

Parameters:
  • index (integer) - an index value
Raises:
  • IndexError - if the index is not used in this Indexer instance

__getitem__(self, key)
(Indexing operator)

source code 

Return the integer key associated to a python value.

Parameters:
  • key (an hashable python value) - the value to index
Returns: int
an unique integer value associated to the key
Overrides: dict.__getitem__

__equal__(self, index)

source code 

Implement equa operator. Two Indexer instances are equals if they are physically the same instance

Parameters:
  • index (an Indexer instance) - the seconde Indexer
Returns: bool
True is the two instances are the same