Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions pylint_absolute_imports/checker.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
"""Strict check of the import."""
from astroid import ImportFrom # type: ignore
from pylint.interfaces import IAstroidChecker # type: ignore
from pylint.checkers import BaseChecker # type: ignore
import pylint

PYLINT_VERSION_MAJOR = int(pylint.__version__.split(".", maxsplit=1)[0])


def is_relative(node: ImportFrom) -> bool:
Expand All @@ -13,7 +15,11 @@ class AbsoluteImportChecker(BaseChecker):

"""Pylint checker for imports."""

__implements__ = IAstroidChecker
if PYLINT_VERSION_MAJOR < 3:
# pylint: disable-next=import-outside-toplevel,no-name-in-module
from pylint.interfaces import IAstroidChecker

__implements__ = IAstroidChecker

name = 'relative-import'
priority = -1
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,6 @@
'Programming Language :: Python :: 3',
),
install_requires=(
'pylint>=2.5.0,<3',
'pylint>=2.5.0,<4',
)
)