本文整理匯總了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 ()))