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

Module statsdb

source code

Module to provide a cache of statistics in a database.


Organization: Zuza Software Foundation

Copyright: 2007 Zuza Software Foundation

License: GPL

Classes [hide private]
  Record
  FileTotals
  StatsCache
An object instantiated as a singleton for each statsfile that provides access to the database cache from a pool of StatsCache objects.
Functions [hide private]
 
wordcount(string) source code
 
wordsinunit(unit)
Counts the words in the unit's source and target, taking plurals into account.
source code
 
transaction(f)
Modifies f to commit database changes if it executes without exceptions.
source code
 
statefordb(unit)
Returns the numeric database state for the unit.
source code
 
emptyfiletotals()
Returns a dictionary with all statistics initalised to 0.
source code
 
emptyfilechecks() source code
 
emptyfilestats() source code
 
emptyunitstats() source code
 
get_mod_info(file_path) source code
 
suggestion_extension() source code
 
suggestion_filename(filename) source code
Variables [hide private]
  brtagre = re.compile(r'<br\s*?/?>')
  xmltagre = re.compile(r'<[^>]+>')
  numberre = re.compile(r'\D\.\D')
  extended_state_strings = {0: 'empty', 30: 'needs-work', 60: 'r...
  UNTRANSLATED = 0
  FUZZY = 30
  TRANSLATED = 100
  state_strings = {0: 'untranslated', 30: 'fuzzy', 100: 'transla...
  __package__ = 'translate.storage'

Imports: dbapi2, os, re, sys, stat, thread, UserDict, toolkitversion, Common, multistring, factory, StateEnum


Function Details [hide private]

wordsinunit(unit)

source code 

Counts the words in the unit's source and target, taking plurals into account. The target words are only counted if the unit is translated.

transaction(f)

source code 

Modifies f to commit database changes if it executes without exceptions. Otherwise it rolls back the database.

ALL publicly accessible methods in StatsCache MUST be decorated with this decorator.


Variables Details [hide private]

extended_state_strings

Value:
{0: 'empty',
 30: 'needs-work',
 60: 'rejected',
 80: 'needs-review',
 100: 'unreviewed',
 120: 'final'}

state_strings

Value:
{0: 'untranslated', 30: 'fuzzy', 100: 'translated'}