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


Python ASTNGManager.infer_astng_from_something方法代码示例

本文整理汇总了Python中logilab.astng.manager.ASTNGManager.infer_astng_from_something方法的典型用法代码示例。如果您正苦于以下问题:Python ASTNGManager.infer_astng_from_something方法的具体用法?Python ASTNGManager.infer_astng_from_something怎么用?Python ASTNGManager.infer_astng_from_something使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在logilab.astng.manager.ASTNGManager的用法示例。


在下文中一共展示了ASTNGManager.infer_astng_from_something方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: astng_boot_strapping

# 需要导入模块: from logilab.astng.manager import ASTNGManager [as 别名]
# 或者: from logilab.astng.manager.ASTNGManager import infer_astng_from_something [as 别名]
def astng_boot_strapping():
    """astng boot strapping the builtins module"""
    # this boot strapping is necessary since we need the Const nodes to
    # inspect_build builtins, and then we can proxy Const
    builder = InspectBuilder()
    from logilab.common.compat import builtins
    astng_builtin = builder.inspect_build(builtins)
    for cls, node_cls in CONST_CLS.items():
        if cls is type(None):
            proxy = build_class('NoneType')
            proxy.parent = astng_builtin
        else:
            proxy = astng_builtin.getattr(cls.__name__)[0] # XXX
        if cls in (dict, list, set, tuple):
            node_cls._proxied = proxy
        else:
            _CONST_PROXY[cls] = proxy

astng_boot_strapping()

# TODO : find a nicer way to handle this situation;
# However __proxied introduced an
# infinite recursion (see https://bugs.launchpad.net/pylint/+bug/456870)
def _set_proxied(const):
    return _CONST_PROXY[const.value.__class__]
Const._proxied = property(_set_proxied)

# FIXME : is it alright that Generator._proxied is not a astng node?
Generator._proxied = MANAGER.infer_astng_from_something(type(a for a in ()))

开发者ID:daviewales,项目名称:pylint-mode,代码行数:31,代码来源:raw_building.py


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