pylint/checkers/imports.py
def _record_import(self, node, importedmodnode):
        """Record the package `node` imports from"""
        if isinstance(node, astroid.ImportFrom):
            importedname = node.modname
        else:
            importedname = importedmodnode.name if importedmodnode else None
        if not importedname:
            importedname = node.names[0][0].split(".")[0]

        if isinstance(node, astroid.ImportFrom) and (node.level or 0) >= 1:
            # We need the importedname with first point to detect local package
            # Example of node:
            #  'from .my_package1 import MyClass1'
            #  the output should be '.my_package1' instead of 'my_package1'
            # Example of node:
            #  'from . import my_package2'
            #  the output should be '.my_package2' instead of '{pyfile}'
            importedname = "." + importedname

        self._imports_stack.append((node, importedname))
def _record_import(self, node, importedmodnode):
        if isinstance(node, astroid.ImportFrom):
            importedname = node.modname
        else:
            importedname = importedmodnode.name if importedmodnode else None
        if not importedname:
            importedname = node.names[0][0].split(".")[0]

        if isinstance(node, astroid.ImportFrom) and (node.level or 0) >= 1:
            # We need the importedname with first point to detect local package
            # Example of node:
            #  'from .my_package1 import MyClass1'
            #  the output should be '.my_package1' instead of 'my_package1'
            # Example of node:
            #  'from . import my_package2'
            #  the output should be '.my_package2' instead of '{pyfile}'
            importedname = "." + importedname

        self._imports_stack.append((node, importedname))
def _record_import ( self , node , importedmodnode ) : if isinstance ( node , astroid . ImportFrom ) : importedname = node . modname else : importedname = importedmodnode . name if importedmodnode else None if not importedname : importedname = node . names [ 0 ] [ 0 ] . split ( "." ) [ 0 ] if isinstance ( node , astroid . ImportFrom ) and ( node . level or 0 ) >= 1 : # We need the importedname with first point to detect local package # Example of node: #  'from .my_package1 import MyClass1' #  the output should be '.my_package1' instead of 'my_package1' # Example of node: #  'from . import my_package2' #  the output should be '.my_package2' instead of '{pyfile}' importedname = "." + importedname self . _imports_stack . append ( ( node , importedname ) )
Record the package `node` imports from
Record the package node imports from