當前位置: 首頁>>代碼示例>>Python>>正文


Python scoped_nodes.Module方法代碼示例

本文整理匯總了Python中astroid.scoped_nodes.Module方法的典型用法代碼示例。如果您正苦於以下問題:Python scoped_nodes.Module方法的具體用法?Python scoped_nodes.Module怎麽用?Python scoped_nodes.Module使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在astroid.scoped_nodes的用法示例。


在下文中一共展示了scoped_nodes.Module方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: _object_type

# 需要導入模塊: from astroid import scoped_nodes [as 別名]
# 或者: from astroid.scoped_nodes import Module [as 別名]
def _object_type(node, context=None):
    astroid_manager = manager.AstroidManager()
    builtins = astroid_manager.astroid_cache[BUILTINS]
    context = context or contextmod.InferenceContext()

    for inferred in node.infer(context=context):
        if isinstance(inferred, scoped_nodes.ClassDef):
            if inferred.newstyle:
                metaclass = inferred.metaclass()
                if metaclass:
                    yield metaclass
                    continue
            yield builtins.getattr('type')[0]
        elif isinstance(inferred, (scoped_nodes.Lambda, bases.UnboundMethod)):
            yield _function_type(inferred, builtins)
        elif isinstance(inferred, scoped_nodes.Module):
            yield _build_proxy_class('module', builtins)
        else:
            yield inferred._proxied 
開發者ID:AtomLinter,項目名稱:linter-pylama,代碼行數:21,代碼來源:helpers.py

示例2: _object_type

# 需要導入模塊: from astroid import scoped_nodes [as 別名]
# 或者: from astroid.scoped_nodes import Module [as 別名]
def _object_type(node, context=None):
    astroid_manager = manager.AstroidManager()
    builtins = astroid_manager.builtins_module
    context = context or contextmod.InferenceContext()

    for inferred in node.infer(context=context):
        if isinstance(inferred, scoped_nodes.ClassDef):
            if inferred.newstyle:
                metaclass = inferred.metaclass()
                if metaclass:
                    yield metaclass
                    continue
            yield builtins.getattr("type")[0]
        elif isinstance(inferred, (scoped_nodes.Lambda, bases.UnboundMethod)):
            yield _function_type(inferred, builtins)
        elif isinstance(inferred, scoped_nodes.Module):
            yield _build_proxy_class("module", builtins)
        else:
            yield inferred._proxied 
開發者ID:sofia-netsurv,項目名稱:python-netsurv,代碼行數:21,代碼來源:helpers.py

示例3: _object_type

# 需要導入模塊: from astroid import scoped_nodes [as 別名]
# 或者: from astroid.scoped_nodes import Module [as 別名]
def _object_type(node, context=None):
    astroid_manager = manager.AstroidManager()
    builtins = astroid_manager.astroid_cache[BUILTINS]
    context = context or contextmod.InferenceContext()

    for inferred in node.infer(context=context):
        if isinstance(inferred, scoped_nodes.ClassDef):
            if inferred.newstyle:
                metaclass = inferred.metaclass()
                if metaclass:
                    yield metaclass
                    continue
            yield builtins.getattr("type")[0]
        elif isinstance(inferred, (scoped_nodes.Lambda, bases.UnboundMethod)):
            yield _function_type(inferred, builtins)
        elif isinstance(inferred, scoped_nodes.Module):
            yield _build_proxy_class("module", builtins)
        else:
            yield inferred._proxied 
開發者ID:luckystarufo,項目名稱:pySINDy,代碼行數:21,代碼來源:helpers.py

示例4: leave_module

# 需要導入模塊: from astroid import scoped_nodes [as 別名]
# 或者: from astroid.scoped_nodes import Module [as 別名]
def leave_module(self, node):
        # type: (scoped_nodes.Module) -> None
        """
        We perform the actual check just before we leave the module since that's when the file has
        been fully processed.
        """
        node_file_path = self._get_file_path_for_node(node=node)

        third_party_nodes = list(
            self._third_party_import_nodes.get(node_file_path, [])
        )  # type: List[node_classes.Import]
        scalyr_init_node = self._scalyr_init_nodes.get(node_file_path, None)

        for import_node in third_party_nodes:
            self._verify_import_node_comes_after_scalyr_init(
                scalyr_init_node=scalyr_init_node, import_node=import_node
            ) 
開發者ID:scalyr,項目名稱:scalyr-agent-2,代碼行數:19,代碼來源:bundled_imports_checker.py

示例5: visit_module

# 需要導入模塊: from astroid import scoped_nodes [as 別名]
# 或者: from astroid.scoped_nodes import Module [as 別名]
def visit_module(self, node):
        # type: (scoped_nodes.Module) -> None
        self.__current_module = node.name 
開發者ID:scalyr,項目名稱:scalyr-agent-2,代碼行數:5,代碼來源:py2exe_checker.py

示例6: leave_module

# 需要導入模塊: from astroid import scoped_nodes [as 別名]
# 或者: from astroid.scoped_nodes import Module [as 別名]
def leave_module(self, _node):
        # type: (scoped_nodes.Module) -> None
        self.__current_module = None 
開發者ID:scalyr,項目名稱:scalyr-agent-2,代碼行數:5,代碼來源:py2exe_checker.py


注:本文中的astroid.scoped_nodes.Module方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。