本文整理汇总了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 ()))