Exemplo n.º 1
0
 def __init__(self, **options):
     Filter.__init__(self, **options)
     tags = get_list_opt(options, 'codetags',
                         ['XXX', 'TODO', 'BUG', 'NOTE'])
     self.tag_re = re.compile(r'\b(%s)\b' % '|'.join([
         re.escape(tag) for tag in tags if tag
     ]))
Exemplo n.º 2
0
 def __init__(self, **options):
     Filter.__init__(self, **options)
     self.names = set(get_list_opt(options, 'names', []))
     tokentype = options.get('tokentype')
     if tokentype:
         self.tokentype = string_to_tokentype(tokentype)
     else:
         self.tokentype = Name.Function
Exemplo n.º 3
0
 def __init__(self, **options):
     Filter.__init__(self, **options)
     self.exception = options.get('excclass', ErrorToken)
     try:
         # issubclass() will raise TypeError if first argument is not a class
         if not issubclass(self.exception, Exception):
             raise TypeError
     except TypeError:
         raise OptionError('excclass option is not an exception class')
Exemplo n.º 4
0
 def __init__(self, **options):
     Filter.__init__(self, **options)
     for name, default in [('spaces',   '·'),
                           ('tabs',     '»'),
                           ('newlines', '¶')]:
         opt = options.get(name, False)
         if isinstance(opt, str) and len(opt) == 1:
             setattr(self, name, opt)
         else:
             setattr(self, name, (opt and default or ''))
     tabsize = get_int_opt(options, 'tabsize', 8)
     if self.tabs:
         self.tabs += ' ' * (tabsize - 1)
     if self.newlines:
         self.newlines += '\n'
     self.wstt = get_bool_opt(options, 'wstokentype', True)
Exemplo n.º 5
0
 def __init__(self, **options):
     Filter.__init__(self, **options)
Exemplo n.º 6
0
 def __init__(self, **options):
     Filter.__init__(self, **options)
     self.n = get_int_opt(options, 'n', 0)
Exemplo n.º 7
0
 def __init__(self, **options):
     Filter.__init__(self, **options)
     case = get_choice_opt(options, 'case',
                           ['lower', 'upper', 'capitalize'], 'lower')
     self.convert = getattr(str, case)
Exemplo n.º 8
0
 def __init__(self, **options):
     Filter.__init__(self, **options)
     lang = get_choice_opt(options, 'lang',
                           ['isabelle', 'latex'], 'isabelle')
     self.symbols = self.lang_map[lang]