QueryableList
index

QueryableList - Add support for ORM-style filtering to any list of items.
 
 
Use through one of the list-type extending classes:
 
 
    QueryableListObjs - This assumes each item is an object [or implements __getattribute__].
 
    QueryableListDicts - This assumes that each item is a dict [or implements __getitem__].
 
 
You can filter these objects by using the method "filterAnd" (or its alias, "filter"), or "filterOr".
 
filterAnd returns a QueryableList where each item matches ALL of the provided criteria.
filterOr returns a QueryableList where each item matches ANY of the provided criteria.
 
You specify the filter operations by passing arguments of $fieldName__$operation (e.x. results = objs.filter(name__ne='Tim') ), where "$fieldName" matches the name of an attribute/key and "$operation" is one of the following:
 
 
    * eq - Test equality ( = operator )
 
    * ieq - Test equality, ignoring case (must be strings, or at least implement the .lower() method)
 
    * ne  - Test inequality ( != operator )
 
    * ine - Test inequality, ignoring case (must be strings, or at least implement the .lower() method)
 
    * lt  - The item's field value must be less than the provided value
 
    * lte - The item's field value must be less than or equal to the provided value
 
    * gt  - The item's field value must be greater than the provided value
 
    * gte - The item's field value must be greater than or equal to the provided value
 
    * isnull - Provided value must be True/False. If True, the item's field value must be None, otherwise it must not be None.
 
    * is  - Test identity equality ( is operator )
 
    * isnot - Test identity inequality ( is not operator )
 
    * in - Test that the item's field value is contained in the provided list of items
 
    * notin - Test that the item's field value is not contained in the provided list of items
 
    * contains - Test that the item's field value contains the provided value ( using "in" )
 
    * notcontains - Test that the item's field value does not contain the provided value ( using "not in" )
 
    * containsAny - Test that the item's field value contains any of the items in the provided list ( using "in" )
 
    * notcontainsAny - Test that the item's field value does not contain any of the items in the provided list ( using "not in" )

 
Package Contents
       
Base

 
Classes
       
__builtin__.list(__builtin__.object)
QueryableList.Base.QueryableListBase
QueryableListDicts
QueryableListObjs

 
class QueryableListBase(__builtin__.list)
    QueryableListBase - The base implementation of a QueryableList. 
 
Any implementing classes should only have to implement the "_get_item_value(item, fieldName)" method, to return the value of a given field on an item.
 
You cannot use this directly, instead use one of the implementing classes (like QueryableListDicts or QueryableListObjs), or your own implementing class.
 
 
Method resolution order:
QueryableListBase
__builtin__.list
__builtin__.object

Methods defined here:
filter = filterAnd(self, **kwargs)
filterAnd(self, **kwargs)
filter/filterAnd - Performs a filter and returns a QueryableList object of the same type.
 
    All the provided filters must match for the item to be returned.
 
@params are in the format of fieldName__operation=value  where fieldName is the name of the field on any given item, "operation" is one of the given operations (@see main documentation) (e.x. eq, ne, isnull), and value is what is used in the operation.
 
@return - A QueryableList object of the same type, with only the matching objects returned.
filterOr(self, **kwargs)
filterOr - Performs a filter and returns a QueryableList object of the same type.
 
    Anythe provided filters can match for the item to be returned.
 
@params are in the format of fieldName__operation=value  where fieldName is the name of the field on any given item, "operation" is one of the given operations (@see main documentation) (e.x. eq, ne, isnull), and value is what is used in the operation.
 
@return - A QueryableList object of the same type, with only the matching objects returned.

Data descriptors defined here:
__dict__
dictionary for instance variables (if defined)
__weakref__
list of weak references to the object (if defined)

 
class QueryableListDicts(QueryableList.Base.QueryableListBase)
    QueryableListDicts - QueryableList where each item is or extends dict (or implements __getitem__)
 
 
Method resolution order:
QueryableListDicts
QueryableList.Base.QueryableListBase
__builtin__.list
__builtin__.object

Methods inherited from QueryableList.Base.QueryableListBase:
filter = filterAnd(self, **kwargs)
filter/filterAnd - Performs a filter and returns a QueryableList object of the same type.
 
    All the provided filters must match for the item to be returned.
 
@params are in the format of fieldName__operation=value  where fieldName is the name of the field on any given item, "operation" is one of the given operations (@see main documentation) (e.x. eq, ne, isnull), and value is what is used in the operation.
 
@return - A QueryableList object of the same type, with only the matching objects returned.
filterAnd(self, **kwargs)
filter/filterAnd - Performs a filter and returns a QueryableList object of the same type.
 
    All the provided filters must match for the item to be returned.
 
@params are in the format of fieldName__operation=value  where fieldName is the name of the field on any given item, "operation" is one of the given operations (@see main documentation) (e.x. eq, ne, isnull), and value is what is used in the operation.
 
@return - A QueryableList object of the same type, with only the matching objects returned.
filterOr(self, **kwargs)
filterOr - Performs a filter and returns a QueryableList object of the same type.
 
    Anythe provided filters can match for the item to be returned.
 
@params are in the format of fieldName__operation=value  where fieldName is the name of the field on any given item, "operation" is one of the given operations (@see main documentation) (e.x. eq, ne, isnull), and value is what is used in the operation.
 
@return - A QueryableList object of the same type, with only the matching objects returned.

Data descriptors inherited from QueryableList.Base.QueryableListBase:
__dict__
dictionary for instance variables (if defined)
__weakref__
list of weak references to the object (if defined)

 
class QueryableListObjs(QueryableList.Base.QueryableListBase)
    QueryableListObjs - QueryableList where each item extends object (or implements __getattribute__)
 
 
Method resolution order:
QueryableListObjs
QueryableList.Base.QueryableListBase
__builtin__.list
__builtin__.object

Methods inherited from QueryableList.Base.QueryableListBase:
filter = filterAnd(self, **kwargs)
filter/filterAnd - Performs a filter and returns a QueryableList object of the same type.
 
    All the provided filters must match for the item to be returned.
 
@params are in the format of fieldName__operation=value  where fieldName is the name of the field on any given item, "operation" is one of the given operations (@see main documentation) (e.x. eq, ne, isnull), and value is what is used in the operation.
 
@return - A QueryableList object of the same type, with only the matching objects returned.
filterAnd(self, **kwargs)
filter/filterAnd - Performs a filter and returns a QueryableList object of the same type.
 
    All the provided filters must match for the item to be returned.
 
@params are in the format of fieldName__operation=value  where fieldName is the name of the field on any given item, "operation" is one of the given operations (@see main documentation) (e.x. eq, ne, isnull), and value is what is used in the operation.
 
@return - A QueryableList object of the same type, with only the matching objects returned.
filterOr(self, **kwargs)
filterOr - Performs a filter and returns a QueryableList object of the same type.
 
    Anythe provided filters can match for the item to be returned.
 
@params are in the format of fieldName__operation=value  where fieldName is the name of the field on any given item, "operation" is one of the given operations (@see main documentation) (e.x. eq, ne, isnull), and value is what is used in the operation.
 
@return - A QueryableList object of the same type, with only the matching objects returned.

Data descriptors inherited from QueryableList.Base.QueryableListBase:
__dict__
dictionary for instance variables (if defined)
__weakref__
list of weak references to the object (if defined)

 
Data
        FILTER_TYPES = set(['contains', 'containsAny', 'eq', 'gt', 'gte', 'ieq', ...])
__all__ = ('FILTER_TYPES', 'QueryableListObjs', 'QueryableListDicts', 'QueryableListBase')