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

Module factory

source code

factory methods to build real storage objects that conform to base.py

Functions [hide private]
 
_examine_txt(storefile)
Determine the true filetype for a .txt file
source code
 
_guessextention(storefile)
Guesses the type of a file object by looking at the first few characters.
source code
 
_getdummyname(storefile)
Provides a dummy name for a file object without a name attribute, by guessing the file type.
source code
 
_getname(storefile)
returns the filename
source code
 
getclass(storefile, ignore=None, classes=classes, hiddenclasses=hiddenclasses)
Factory that returns the applicable class for the type of file presented.
source code
 
getobject(storefile, ignore=None, classes=classes, hiddenclasses=hiddenclasses)
Factory that returns a usable object for the type of file presented.
source code
list
supported_files()
Returns data about all supported files
source code
Variables [hide private]
  BZ2File = None
Parse an instance of this class from the start of the given string.
  support_xml = False
Parse an instance of this class from the start of the given string.
  classes = {"csv": csvl10n.csvfile, "tab": omegat.OmegaTFileTab...
Dictionary of file extensions and their associated class.
  decompressclass = {'gz': GzipFile,}
  hiddenclasses = {"txt": _examine_txt}

Imports: os, GzipFile, sys, base, csvl10n, mo, omegat, po, qm, wordfast, poxliff, qph, tbx, tmx, ts, xliff


Function Details [hide private]

_guessextention(storefile)

source code 

Guesses the type of a file object by looking at the first few characters. The return value is a file extention .

getclass(storefile, ignore=None, classes=classes, hiddenclasses=hiddenclasses)

source code 

Factory that returns the applicable class for the type of file presented. Specify ignore to ignore some part at the back of the name (like .gz).

getobject(storefile, ignore=None, classes=classes, hiddenclasses=hiddenclasses)

source code 

Factory that returns a usable object for the type of file presented.

Parameters:
  • storefile (file or str) - File object or file name.

    Specify ignore to ignore some part at the back of the name (like .gz).

supported_files()

source code 

Returns data about all supported files

Returns: list
list of type that include (name, extensions, mimetypes)

Variables Details [hide private]

classes

Dictionary of file extensions and their associated class.

_ext is a pseudo extension, that is their is no real extension by that name.

Value:
{"csv": csvl10n.csvfile, "tab": omegat.OmegaTFileTab, "utf8": omegat.O\
megaTFile, "po": po.pofile, "pot": po.pofile, "mo": mo.mofile, "gmo": \
mo.mofile, "qm": qm.qmfile, "_wftm": wordfast.WordfastTMFile,}