pylint/checkers/imports.py
def _check_reimport(self, node, basename=None, level=None):
        """check if the import is necessary (i.e. not already done)"""
        if not self.linter.is_message_enabled("reimported"):
            return

        frame = node.frame()
        root = node.root()
        contexts = [(frame, level)]
        if root is not frame:
            contexts.append((root, None))

        for known_context, known_level in contexts:
            for name, alias in node.names:
                first = _get_first_import(
                    node, known_context, name, basename, known_level, alias
                )
                if first is not None:
                    self.add_message(
                        "reimported", node=node, args=(name, first.fromlineno)
                    )
def _check_reimport(self, node, basename=None, level=None):
        """check if the import is necessary (i.e. not already done)"""
        if not self.linter.is_message_enabled("reimported"):
            return

        frame = node.frame()
        root = node.root()
        contexts = [(frame, level)]
        if root is not frame:
            contexts.append((root, None))

        for known_context, known_level in contexts:
            for name, alias in node.names:
                first = _get_first_import(
                    node, known_context, name, basename, known_level, alias
                )
                if first is not None:
                    self.add_message(
                        "reimported", node=node, args=(name, first.fromlineno)
                    )
def _check_reimport ( self , node , basename = None , level = None ) : if not self . linter . is_message_enabled ( "reimported" ) : return frame = node . frame ( ) root = node . root ( ) contexts = [ ( frame , level ) ] if root is not frame : contexts . append ( ( root , None ) ) for known_context , known_level in contexts : for name , alias in node . names : first = _get_first_import ( node , known_context , name , basename , known_level , alias ) if first is not None : self . add_message ( "reimported" , node = node , args = ( name , first . fromlineno ) )
check if the import is necessary (i.e. not already done)
check if the import is necessary ( i . e . not already done )