예제 #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
     ]))
예제 #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
예제 #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
예제 #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')
예제 #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')
예제 #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)
예제 #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)
예제 #8
0
 def __init__(self, **options):
     Filter.__init__(self, **options)
예제 #9
0
 def __init__(self, **options):
     Filter.__init__(self, **options)
     self.n = get_int_opt(options, 'n', 0)
예제 #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)
예제 #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]))
예제 #12
0
 def __init__(self, **options):
     Filter.__init__(self, **options)
예제 #13
0
 def __init__(self, **options):
     Filter.__init__(self, **options)
     self.n = get_int_opt(options, 'n', 0)
예제 #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)