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 ]))
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
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')
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)
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)
def __init__(self, **options): Filter.__init__(self, **options)
def __init__(self, **options): Filter.__init__(self, **options) self.n = get_int_opt(options, 'n', 0)
def __init__(self, **options): Filter.__init__(self, **options) case = get_choice_opt(options, 'case', ['lower', 'upper', 'capitalize'], 'lower') self.convert = getattr(unicode, case)
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]))