diff options
Diffstat (limited to 'pylint/checkers/imports.py')
-rw-r--r-- | pylint/checkers/imports.py | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/pylint/checkers/imports.py b/pylint/checkers/imports.py index ddec800e0..528f7d80c 100644 --- a/pylint/checkers/imports.py +++ b/pylint/checkers/imports.py @@ -52,7 +52,7 @@ import copy import os import sys from distutils import sysconfig -from typing import Any, Dict, List, Optional, Set, Tuple, Union +from typing import TYPE_CHECKING, Any, Dict, List, Optional, Set, Tuple, Union import astroid from astroid import nodes @@ -69,10 +69,12 @@ from pylint.checkers.utils import ( from pylint.exceptions import EmptyReportError from pylint.graph import DotBackend, get_cycles from pylint.interfaces import IAstroidChecker -from pylint.lint import PyLinter from pylint.reporters.ureports.nodes import Paragraph, Section, VerbatimText from pylint.utils import IsortDriver, get_global_option +if TYPE_CHECKING: + from pylint.lint import PyLinter + def _qualified_names(modname): """Split the names of the given module into subparts @@ -426,7 +428,7 @@ class ImportsChecker(DeprecatedMixin, BaseChecker): ) def __init__( - self, linter: Optional[PyLinter] = None + self, linter: Optional["PyLinter"] = None ): # pylint: disable=super-init-not-called # See https://github.com/PyCQA/pylint/issues/4941 BaseChecker.__init__(self, linter) self.import_graph: collections.defaultdict = collections.defaultdict(set) @@ -1018,6 +1020,5 @@ class ImportsChecker(DeprecatedMixin, BaseChecker): ) -def register(linter): - """required method to auto register this checker""" +def register(linter: "PyLinter") -> None: linter.register_checker(ImportsChecker(linter)) |