Package amplee :: Package indexer :: Class BaseIndex
[hide private]
[frames] | no frames]

Class BaseIndex

source code

object --+
         |
        BaseIndex
Known Subclasses:
AtomIDIndexer, AuthorIndex, CategoryIndex, DateIndex, KeywordIndex

Instance Methods [hide private]
 
__init__(self, name, container=None)
Base class of your index handler.
source code
 
update(self, member) source code
 
store(self, key, value)
Stores a value within the index container.
source code
set
load(self, key)
Returns the value associated with the key as a set of one element.
source code
set
iload(self, key)
Yields the value associated with the key as a set of one element.
source code
set
iterindex(self, func)
Iterates through the keys of the container and apply for each one the provided func with the key and the data associated.
source code
set
iiterindex(self, func)
Iterates through the keys of the container and yields each result of applying the provided func with the key and the data associated.
source code
list
keys(self)
Return all the existing keys in the container as a list.
source code

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

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, name, container=None)
(Constructor)

source code 

Base class of your index handler.

Built-in index handlers will always inherit from this class but your own handlers don't need to as long as they implement a method named update() and taking the member as its unique parameter.
Parameters:
  • name (string) - an internal identifier used to reference the indexer.
  • container (object) - instance of a class implementing the dictionnary interface.
Overrides: object.__init__

store(self, key, value)

source code 
Stores a value within the index container.
Parameters:
  • key (object) - used to reference of the indexed value.
  • value (object) - what is being indexed

load(self, key)

source code 
Returns the value associated with the key as a set of one element. The set is empty of the key is not found.
Returns: set
an empty or a one item set referenced by the key

iload(self, key)

source code 
Yields the value associated with the key as a set of one element. The set is empty of the key is not found.
Returns: set
an empty or a one item set referenced by the key

iterindex(self, func)

source code 

Iterates through the keys of the container and apply for each one the provided func with the key and the data associated.

If you want to stop the iteration you can simply raise StopIteration from the function.
Parameters:
  • func (callable) - function applied to each element found in the container.
Returns: set
the result set after func has been applied

iiterindex(self, func)

source code 

Iterates through the keys of the container and yields each result of applying the provided func with the key and the data associated.

If you want to stop the iteration you can simply raise StopIteration from the function.
Parameters:
  • func (callable) - function applied to each element found in the container.
Returns: set
the result set after func has been applied

keys(self)

source code 
Return all the existing keys in the container as a list. Not all containers support that features and should therefore be used carefully.
Returns: list
the list of all the keys of the container