当前位置: 首页>>代码示例>>Python>>正文


Python MANAGER.register_transformer方法代码示例

本文整理汇总了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)
开发者ID:Bcfg2,项目名称:bcfg2,代码行数:15,代码来源:ssl_protocols.py

示例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
开发者ID:OddBloke,项目名称:pylint-nose-checker,代码行数:31,代码来源:nose_checker.py

示例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)
开发者ID:EnDe,项目名称:w3af,代码行数:7,代码来源:httpretty_fix.py

示例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)
开发者ID:armandomeeuwenoord,项目名称:pylint_flask_ext,代码行数:7,代码来源:flask_ext_clean.py

示例5: register

# 需要导入模块: from logilab.astng import MANAGER [as 别名]
# 或者: from logilab.astng.MANAGER import register_transformer [as 别名]
def register(linter):
    MANAGER.register_transformer(web2py_transform)
开发者ID:dsludwig,项目名称:pylint-web2py,代码行数:4,代码来源:__init__.py

示例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)
开发者ID:schae234,项目名称:pypeline,代码行数:4,代码来源:create_customizable_cli_parameters.py


注:本文中的logilab.astng.MANAGER.register_transformer方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。