home *** CD-ROM | disk | FTP | other *** search
/ Maximum CD 2011 January / maximum-cd-2011-01.iso / DiscContents / calibre-0.7.26.msi / file_2347 (.txt) < prev    next >
Encoding:
Python Compiled Bytecode  |  2010-10-31  |  1.8 KB  |  46 lines

  1. # Source Generated with Decompyle++
  2. # File: in.pyc (Python 2.6)
  3.  
  4. import codecs
  5. from pygments.util import get_bool_opt
  6. from pygments.styles import get_style_by_name
  7. __all__ = [
  8.     'Formatter']
  9.  
  10. def _lookup_style(style):
  11.     if isinstance(style, basestring):
  12.         return get_style_by_name(style)
  13.     return style
  14.  
  15.  
  16. class Formatter(object):
  17.     name = None
  18.     aliases = []
  19.     filenames = []
  20.     unicodeoutput = True
  21.     
  22.     def __init__(self, **options):
  23.         self.style = _lookup_style(options.get('style', 'default'))
  24.         self.full = get_bool_opt(options, 'full', False)
  25.         self.title = options.get('title', '')
  26.         if not options.get('encoding', None):
  27.             pass
  28.         self.encoding = None
  29.         if not options.get('outencoding', None):
  30.             pass
  31.         self.encoding = self.encoding
  32.         self.options = options
  33.  
  34.     
  35.     def get_style_defs(self, arg = ''):
  36.         return ''
  37.  
  38.     
  39.     def format(self, tokensource, outfile):
  40.         if self.encoding:
  41.             outfile = codecs.lookup(self.encoding)[3](outfile)
  42.         
  43.         return self.format_unencoded(tokensource, outfile)
  44.  
  45.  
  46.