Package dbf :: Module ver_2 :: Class Index
[hide private]
[frames] | no frames]

Class Index

source code

 object --+    
          |    
_Navigation --+
              |
             Index

non-persistent index for a table

Instance Methods [hide private]
 
__init__(self, table, key)
x.__init__(...) initializes x; see help(type(x)) for signature
source code
 
__call__(self, record) source code
 
__contains__(self, data) source code
 
__getitem__(self, key)
if key is an integer, returns the matching record; if key is a [slice | string | tuple | record] returns a List; raises NotFoundError on failure
source code
 
__enter__(self) source code
 
__exit__(self, *exc_info) source code
 
__iter__(self) source code
 
__len__(self) source code
 
_clear(self)
removes all entries from index
source code
 
_key(self, record)
table_name, record_number
source code
 
_nav_check(self)
raises error if table is closed
source code
 
_partial_match(self, target, match) source code
 
_purge(self, rec_num) source code
 
_reindex(self)
reindexes all records
source code
 
_search(self, match, lo=0, hi=None, where=None) source code
 
index(self, record, start=None, stop=None)
returns the index of record between start and stop start and stop default to the first and last record
source code
 
index_search(self, match, start=None, stop=None, nearest=False, partial=False)
returns the index of match between start and stop start and stop default to the first and last record.
source code
 
key(self, record) source code
 
query(self, criteria)
criteria is a callback that returns a truthy value for matching record
source code
 
search(self, match, partial=False)
returns dbf.List of all (partially) matching records
source code

Inherited from _Navigation: bottom, goto, skip, top

Inherited from _Navigation (private): _get_index

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

Class Variables [hide private]

Inherited from _Navigation (private): _index

Properties [hide private]

Inherited from _Navigation: bof, current, current_record, eof, first_record, last_record, next_record, prev_record

Inherited from object: __class__

Method Details [hide private]

__init__(self, table, key)
(Constructor)

source code 

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

Overrides: object.__init__
(inherited documentation)

_nav_check(self)

source code 

raises error if table is closed

Overrides: _Navigation._nav_check

index_search(self, match, start=None, stop=None, nearest=False, partial=False)

source code 

returns the index of match between start and stop start and stop default to the first and last record. if nearest is true returns the location of where the match should be otherwise raises NotFoundError