Package python-module-logilab-mtconverter-0 :: Package 8 :: Package 4
[frames] | no frames]

Package 4

source code

Mime type conversion package.

2006-2012 LOGILAB S.A. (Paris, FRANCE), all rights reserved.

http://www.logilab.org/project/logilab-mtconverter -- mailto:python-projects@logilab.org

Lesser General Public License version 2

Submodules

Classes
  TransformData
wrapper arround transformed data to add extra infos such as MIME type and encoding in case it applies
  MtConverterError
base class for this package's errors
  MissingBinary
raised when a system binary on whic rely a transform has not been found
  TransformError
raised when something can't be transformed due to missing necessary transforms
Functions
 
need_guess(mimetype, encoding)
return True if we can complete given mimetype / encoding information
source code
 
is_text_mimetype(mimetype) source code
 
guess_encoding(buffer, fallbackencoding=None)
try to guess encoding from a buffer
source code
 
guess_mimetype_and_encoding(format=None, encoding=None, data=None, filename=None, fallbackencoding=None, fallbackmimetype=u'application/octet-stream') source code
 
html_escape(data) source code
 
xml_escape(data)
escapes XML forbidden characters in attributes and PCDATA
source code
 
html_unescape(data)
unescapes XML/HTML entities
source code
 
register_pil_transforms(engine, verb=True) source code
 
register_pygments_transforms(engine, verb=True) source code
 
register_base_transforms(engine, verb=True) source code
Variables
  chardet = None
hash(x)
  DEFAULT_ENCODING = locale.getpreferredencoding(do_setlocale= F...
  BINARY_ENCODINGS = set(('gzip', 'bzip2', 'base64'))
  TEXT_MIMETYPES = set(('application/xml', 'application/xhtml+xm...
  UNICODE_POLICY = 'strict'
  CHARSET_DECL_RGX = re.compile('(?:charset|(?:(?:en)?coding))[=...
  CHARSET_DECL_SEARCH_SIZE = 512
  CHARDET_MIN_SIZE = 20
  CHARDET_CONFIDENCE_THRESHOLD = 0.75
  CONTROL_CHARS = [chr(ci) for ci in range(32)]
  TR_CONTROL_CHARS = [' ']* len(CONTROL_CHARS)
  ESC_CAR_TABLE = string.maketrans(''.join(CONTROL_CHARS), ''.jo...
  ESC_UCAR_TABLE = unicode(ESC_CAR_TABLE, 'latin1')
Variables Details

DEFAULT_ENCODING

Value:
locale.getpreferredencoding(do_setlocale= False)

TEXT_MIMETYPES

Value:
set(('application/xml', 'application/xhtml+xml'))

CHARSET_DECL_RGX

Value:
re.compile('(?:charset|(?:(?:en)?coding))[=:\s"\']*([^\s"\']*)', re.I \
| re.S | re.U)

ESC_CAR_TABLE

Value:
string.maketrans(''.join(CONTROL_CHARS), ''.join(TR_CONTROL_CHARS))