本文整理汇总了Python中pygments.filter.Filter类的典型用法代码示例。如果您正苦于以下问题:Python Filter类的具体用法?Python Filter怎么用?Python Filter使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Filter类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
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: __init__
def __init__(self, options):
Filter.__init__(self)
self.options = options
self.js_locals = []
self.vars = []
self.errors = []
self.br_count = 0 # count { braces
示例3: __init__
def __init__(self, **options):
Filter.__init__(self, **options)
self.method_name = options["method_name"]
#self.descriptor = options["descriptor"]
self.present = False
self.get_desc = True #False
示例4: __init__
def __init__(self, **options):
"""
Filter Method Code from a whole class
:param options:
"""
Filter.__init__(self, **options)
self.method_name = options["method_name"]
# self.descriptor = options["descriptor"]
self.present = False
self.get_desc = True # False
示例5: __init__
def __init__(self, **options):
Filter.__init__(self, **options)
for name, default in list({"spaces": "·", "tabs": "»", "newlines": "¶"}.items()):
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)
示例6: __init__
def __init__(self, **options):
Filter.__init__(self, **options)
for name, default in [("spaces", u"·"), ("tabs", u"»"), ("newlines", u"¶")]:
opt = options.get(name, False)
if isinstance(opt, string_types) 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: __init__
def __init__(self, **options):
Filter.__init__(self, **options)
for name, default in [('spaces', u'·'),
('tabs', u'»'),
('newlines', u'¶')]:
opt = options.get(name, False)
if isinstance(opt, string_types) 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: __init__
def __init__(self, **options):
Filter.__init__(self, **options)
self.annotations = options["annotations"]
# Make sure the annotations are sorted by line, then char- we then only
# Need to check the first annotation, not all of them.
self.annotations.sort(
key=lambda anno: (anno["line"], anno["range"][0])
)
self.escape_html = {
ord('&'): '&',
ord('<'): '<',
ord('>'): '>',
ord('"'): '"',
ord("'"): ''',
}
示例9: __init__
def __init__(self, srcdir, depsearchpath):
self.srcdir = srcdir
self.dependencypath = depsearchpath
Filter.__init__(self)
示例10: __init__
def __init__(self, **options):
Filter.__init__(self, **options)
self.tabsize = get_int_opt(options, 'tabsize', 4)
self.repl = re.compile(r'^\t+')