當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。