本文整理汇总了Python中logilab.astng.MANAGER.register_transformer方法的典型用法代码示例。如果您正苦于以下问题:Python MANAGER.register_transformer方法的具体用法?Python MANAGER.register_transformer怎么用?Python MANAGER.register_transformer使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类logilab.astng.MANAGER
的用法示例。
在下文中一共展示了MANAGER.register_transformer方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: register
# 需要导入模块: from logilab.astng import MANAGER [as 别名]
# 或者: from logilab.astng.MANAGER import register_transformer [as 别名]
def register(linter):
if PYLINT == 0:
if hasattr(MANAGER, 'register_transformer'):
MANAGER.register_transformer(ssl_transform)
else:
safe = builder.ASTNGBuilder.string_build
def _string_build(self, data, modname='', path=None):
if modname == 'ssl':
data += '\n\nPROTOCOL_SSLv23 = 0\nPROTOCOL_TLSv1 = 0'
return safe(self, data, modname, path)
builder.ASTNGBuilder.string_build = _string_build
else:
MANAGER.register_transform(scoped_nodes.Module, ssl_transform)
示例2: nose_transform
# 需要导入模块: from logilab.astng import MANAGER [as 别名]
# 或者: from logilab.astng.MANAGER import register_transformer [as 别名]
from nose import tools
function_template = """
def {}(*args, **kwargs):
pass
"""
def nose_transform(module):
funcs = ''.join(function_template.format(func_name)
for func_name in tools.__all__)
fake = ASTNGBuilder(MANAGER).string_build(funcs)
for func_name in tools.__all__:
if func_name not in module.locals:
module.locals[func_name] = fake[func_name]
def transform(module):
if module.name == 'nose.tools':
nose_transform(module)
from logilab.astng import MANAGER
MANAGER.register_transformer(transform)
def register(linter):
pass
示例3: register
# 需要导入模块: from logilab.astng import MANAGER [as 别名]
# 或者: from logilab.astng.MANAGER import register_transformer [as 别名]
def register(linter):
"""called when loaded by pylint --load-plugins, register our tranformation
function here
"""
MANAGER.register_transformer(httpretty_transform)
示例4: register
# 需要导入模块: from logilab.astng import MANAGER [as 别名]
# 或者: from logilab.astng.MANAGER import register_transformer [as 别名]
def register(linter): #pylint: disable=W0613
"""Pylint calls this hook to actually activate the plugin"""
walker = PyLintASTWalker(linter)
walker.add_checker(ImportRewriterVisitor())
MANAGER.register_transformer(walker.walk)
示例5: register
# 需要导入模块: from logilab.astng import MANAGER [as 别名]
# 或者: from logilab.astng.MANAGER import register_transformer [as 别名]
def register(linter):
MANAGER.register_transformer(web2py_transform)
示例6: register
# 需要导入模块: from logilab.astng import MANAGER [as 别名]
# 或者: from logilab.astng.MANAGER import register_transformer [as 别名]
def register(*_args, **_kwargs):
MANAGER.register_transformer(atomiccmd_builder_transform)