本文整理汇总了Python中pygments.filter.Filter.__init__方法的典型用法代码示例。如果您正苦于以下问题:Python Filter.__init__方法的具体用法?Python Filter.__init__怎么用?Python Filter.__init__使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pygments.filter.Filter
的用法示例。
在下文中一共展示了Filter.__init__方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from pygments.filter import Filter [as 别名]
# 或者: from pygments.filter.Filter import __init__ [as 别名]
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__
# 需要导入模块: from pygments.filter import Filter [as 别名]
# 或者: from pygments.filter.Filter import __init__ [as 别名]
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__
# 需要导入模块: from pygments.filter import Filter [as 别名]
# 或者: from pygments.filter.Filter import __init__ [as 别名]
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__
# 需要导入模块: from pygments.filter import Filter [as 别名]
# 或者: from pygments.filter.Filter import __init__ [as 别名]
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__
# 需要导入模块: from pygments.filter import Filter [as 别名]
# 或者: from pygments.filter.Filter import __init__ [as 别名]
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__
# 需要导入模块: from pygments.filter import Filter [as 别名]
# 或者: from pygments.filter.Filter import __init__ [as 别名]
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__
# 需要导入模块: from pygments.filter import Filter [as 别名]
# 或者: from pygments.filter.Filter import __init__ [as 别名]
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__
# 需要导入模块: from pygments.filter import Filter [as 别名]
# 或者: from pygments.filter.Filter import __init__ [as 别名]
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__
# 需要导入模块: from pygments.filter import Filter [as 别名]
# 或者: from pygments.filter.Filter import __init__ [as 别名]
def __init__(self, srcdir, depsearchpath):
self.srcdir = srcdir
self.dependencypath = depsearchpath
Filter.__init__(self)
示例10: __init__
# 需要导入模块: from pygments.filter import Filter [as 别名]
# 或者: from pygments.filter.Filter import __init__ [as 别名]
def __init__(self, **options):
Filter.__init__(self, **options)
self.tabsize = get_int_opt(options, 'tabsize', 4)
self.repl = re.compile(r'^\t+')