Exemple #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
     ]))
Exemple #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
Exemple #3
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
Exemple #4
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')
Exemple #5
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')
Exemple #6
0
 def __init__(self, **options):
     Filter.__init__(self, **options)
     for name, default in {'spaces': u'·', 'tabs': u'»', 'newlines': u'¶'}.items():
         opt = options.get(name, False)
         if isinstance(opt, basestring) 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)
Exemple #7
0
 def __init__(self, **options):
     Filter.__init__(self, **options)
     for name, default in {
             'spaces': u'·',
             'tabs': u'»',
             'newlines': u'¶'
     }.items():
         opt = options.get(name, False)
         if isinstance(opt, basestring) 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)
Exemple #8
0
 def __init__(self, **options):
     Filter.__init__(self, **options)
Exemple #9
0
 def __init__(self, **options):
     Filter.__init__(self, **options)
     self.n = get_int_opt(options, 'n', 0)
Exemple #10
0
 def __init__(self, **options):
     Filter.__init__(self, **options)
     case = get_choice_opt(options, 'case', ['lower', 'upper', 'capitalize'], 'lower')
     self.convert = getattr(unicode, case)
Exemple #11
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]))
Exemple #12
0
 def __init__(self, **options):
     Filter.__init__(self, **options)
Exemple #13
0
 def __init__(self, **options):
     Filter.__init__(self, **options)
     self.n = get_int_opt(options, 'n', 0)
Exemple #14
0
 def __init__(self, **options):
     Filter.__init__(self, **options)
     case = get_choice_opt(options, 'case',
                           ['lower', 'upper', 'capitalize'], 'lower')
     self.convert = getattr(unicode, case)