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

Class DateIndex

source code

object --+    
         |    
 BaseIndex --+
             |
            DateIndex
Known Subclasses:

Instance Methods [hide private]
 
__init__(self, name, target, container=None, granularity=None)
Base class for date based inde handlers.
source code
 
update(self, member)
Updates the index based on the dates of the provided member.
source code
 
prune(self, member)
Removes a member from the index.
source code
set
between(self, start, end)
Returns member which have been indexed between the two provided dates.
source code
set
ibetween(self, start, end)
Yields member which have been indexed between the two provided dates.
source code

Inherited from BaseIndex: clear, iiterindex, iload, iterindex, keys, load, store

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

Class Methods [hide private]
 
year(cls, dt) source code
 
month(cls, dt) source code
 
day(cls, dt) source code
 
hour(cls, dt) source code
 
minute(cls, dt) source code
Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

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

source code 

Base class for date based inde handlers.

Parameters:
  • name (string) - an internal identifier used to reference the indexer.
  • target (string) - qualified XML name of the element within the atom entry to search for.
  • container (object) - instance of a class implementing the dictionnary interface.
  • granularity (callable) - one of the classmethods of this class that indicates what will be the granularity of the key of the index. The lower the finer but also the more keys you will have. It defaults to hour.
Overrides: object.__init__

update(self, member)

source code 

Updates the index based on the dates of the provided member.

Parameters:
Overrides: BaseIndex.update

prune(self, member)

source code 

Removes a member from the index.

Parameters:
Overrides: BaseIndex.prune

between(self, start, end)

source code 

Returns member which have been indexed between the two provided dates.

Parameters:
  • start (datetime) - left boundary of the allowed range (inclusive)
  • end (datetime) - right boundary of the allowed range (inclusive)
Returns: set
set of items belonging to the provided range (may be an empty set).

ibetween(self, start, end)

source code 

Yields member which have been indexed between the two provided dates.

Parameters:
  • start (datetime) - left boundary of the allowed range (inclusive)
  • end (datetime) - right boundary of the allowed range (inclusive)
Returns: set
set of items belonging to the provided range (may be an empty set).