pylint/checkers/imports.py
def visit_import(self, node):
        """triggered when an import statement is seen"""
        self._check_reimport(node)
        self._check_import_as_rename(node)

        modnode = node.root()
        names = [name for name, _ in node.names]
        if len(names) >= 2:
            self.add_message("multiple-imports", args=", ".join(names), node=node)

        for name in names:
            self._check_deprecated_module(node, name)
            self._check_preferred_module(node, name)
            imported_module = self._get_imported_module(node, name)
            if isinstance(node.parent, astroid.Module):
                # Allow imports nested
                self._check_position(node)
            if isinstance(node.scope(), astroid.Module):
                self._record_import(node, imported_module)

            if imported_module is None:
                continue

            self._check_relative_import(modnode, node, imported_module, name)
            self._add_imported_module(node, imported_module.name)
def visit_import(self, node):
        self._check_reimport(node)
        self._check_import_as_rename(node)

        modnode = node.root()
        names = [name for name, _ in node.names]
        if len(names) >= 2:
            self.add_message("multiple-imports", args=", ".join(names), node=node)

        for name in names:
            self._check_deprecated_module(node, name)
            self._check_preferred_module(node, name)
            imported_module = self._get_imported_module(node, name)
            if isinstance(node.parent, astroid.Module):
                # Allow imports nested
                self._check_position(node)
            if isinstance(node.scope(), astroid.Module):
                self._record_import(node, imported_module)

            if imported_module is None:
                continue

            self._check_relative_import(modnode, node, imported_module, name)
            self._add_imported_module(node, imported_module.name)
def visit_import ( self , node ) : self . _check_reimport ( node ) self . _check_import_as_rename ( node ) modnode = node . root ( ) names = [ name for name , _ in node . names ] if len ( names ) >= 2 : self . add_message ( "multiple-imports" , args = ", " . join ( names ) , node = node ) for name in names : self . _check_deprecated_module ( node , name ) self . _check_preferred_module ( node , name ) imported_module = self . _get_imported_module ( node , name ) if isinstance ( node . parent , astroid . Module ) : # Allow imports nested self . _check_position ( node ) if isinstance ( node . scope ( ) , astroid . Module ) : self . _record_import ( node , imported_module ) if imported_module is None : continue self . _check_relative_import ( modnode , node , imported_module , name ) self . _add_imported_module ( node , imported_module . name )
triggered when an import statement is seen
triggered when an import statement is seen