translate.storage.statsdb.StatsCache

Package translate :: Package storage :: Module statsdb :: Class StatsCache |
[hide private]
[frames] | no frames]

# Class StatsCache

source code

An object instantiated as a singleton for each statsfile that provides access to the database cache from a pool of StatsCache objects.

Instance Methods | [hide private]
a new object with type S, a subtype of T |
__new__(cls, statsfile=None) | source code
create(self) Create all tables and indexes. | source code
_getfileid(self, filename, check_mod_info=True, store=None) return fileid representing the given file in the statscache. | source code
_getstoredcheckerconfig(self, checker) See if this checker configuration has been used before. | source code
_cacheunitstats(self, units, fileid, unitindex=None, file_totals_record=FileTotals.new_record()) Cache the statistics for the supplied unit(s). | source code
_cachestore(self, store, realpath, mod_info) Calculates and caches the statistics of the given store unconditionally. | source code
filetotals(self, filename, store=None) Retrieves the statistics for the given file if possible, otherwise delegates to cachestore(). | source code
_cacheunitschecks(self, units, fileid, configid, checker, unitindex=None) Helper method for cachestorechecks() and recacheunit() | source code
_cachestorechecks(self, fileid, store, checker, configid) Calculates and caches the error statistics of the given store unconditionally. | source code
get_unit_stats(self, fileid, unitid) | source code
recacheunit(self, filename, checker, unit) Recalculate all information for a specific unit. | source code
_checkerrors(self, filename, fileid, configid, checker, store) | source code
_geterrors(self, filename, fileid, configid, checker, store) | source code
_get_config_id(self, fileid, checker) | source code
filechecks(self, filename, checker, store=None) Retrieves the error statistics for the given file if possible, otherwise delegates to cachestorechecks(). | source code
file_fails_test(self, filename, checker, name) | source code
filestatestats(self, filename, store=None) Return a dictionary of unit stats mapping sets of unit indices with those states | source code
filestats(self, filename, checker, store=None) Return a dictionary of property names mapping sets of unit indices with those properties. | source code
unitstats(self, filename, _lang=None, store=None) Return a dictionary of property names mapping to arrays which map unit indices to property values. | source code
Inherited from `object`: `__delattr__`, `__getattribute__`, `__hash__`, `__init__`, `__reduce__`, `__reduce_ex__`, `__repr__`, `__setattr__`, `__str__`

Class Variables | [hide private]
| _caches = `{}`
| defaultfile = `None` Parse an instance of this class from the start of the given string.
| con = `None` This cache's connection
| cur = `None` The current cursor

Properties | [hide private]
Inherited from `object`: `__class__`

Method Details | [hide private]

### __new__(cls, statsfile=None) | source code
Returns: a new object with type S, a subtype of T Overrides: object.__new__ (inherited documentation)

### create(self) | source code
Create all tables and indexes. Decorators: `@transaction`

### _getfileid(self, filename, check_mod_info=True, store=None) | source code
return fileid representing the given file in the statscache. if file not in cache or has been updated since last record update, recalculate stats. optional argument store can be used to avoid unnessecary reparsing of already loaded translation files. store can be a TranslationFile object or a callback that returns one. Decorators: `@transaction`

### _cacheunitstats(self, units, fileid, unitindex=None, file_totals_record=FileTotals.new_record()) | source code
Cache the statistics for the supplied unit(s). Decorators: `@transaction`

### _cachestore(self, store, realpath, mod_info) | source code
Calculates and caches the statistics of the given store unconditionally. Decorators: `@transaction`

### _cacheunitschecks(self, units, fileid, configid, checker, unitindex=None) | source code
Helper method for cachestorechecks() and recacheunit() Decorators: `@transaction`

### _cachestorechecks(self, fileid, store, checker, configid) | source code
Calculates and caches the error statistics of the given store unconditionally. Decorators: `@transaction`

### recacheunit(self, filename, checker, unit) | source code
Recalculate all information for a specific unit. This is necessary for updating all statistics when a translation of a unit took place, for example. This method assumes that everything was up to date before (file totals, checks, checker config, etc. Decorators: `@transaction`

### _get_config_id(self, fileid, checker) | source code
Decorators: `@transaction`

### unitstats(self, filename, _lang=None, store=None) | source code
Return a dictionary of property names mapping to arrays which map unit indices to property values. Please note that this is different from filestats, since filestats supplies sets of unit indices with a given property, whereas this method supplies arrays which map unit indices to given values.