summaryrefslogtreecommitdiff
path: root/pylint/checkers/deprecated.py
diff options
context:
space:
mode:
authorDaniƫl van Noord <13665637+DanielNoord@users.noreply.github.com>2021-09-03 13:47:23 +0200
committerGitHub <noreply@github.com>2021-09-03 13:47:23 +0200
commitbaaa81a2994cdd517fbde8693b0a4b0a67f5a4e3 (patch)
treec8b26e345fb3c7377a6c8e3a2b7afca28e1806e5 /pylint/checkers/deprecated.py
parent0981d8bec52f0917168e0e89947fe164f58be683 (diff)
downloadpylint-git-baaa81a2994cdd517fbde8693b0a4b0a67f5a4e3.tar.gz
Refactor various typing related issues (#4940)
* Add type annotations to ``visit`` & ``leave`` calls This adds typing to most calls that visit nodes. All other changes are due to mypy errors resulting from introduction of typing. * Fix outstanding mypy issues This removes some of the `type: ignore` comments in favour of solving the mypy issues these comments were surpressing. * Fix remaining references to node_classes Except for two references to node_classes in the changelog this should be the last of them Co-authored-by: Marc Mueller <30130371+cdce8p@users.noreply.github.com> Co-authored-by: Pierre Sassoulas <pierre.sassoulas@gmail.com>
Diffstat (limited to 'pylint/checkers/deprecated.py')
-rw-r--r--pylint/checkers/deprecated.py9
1 files changed, 5 insertions, 4 deletions
diff --git a/pylint/checkers/deprecated.py b/pylint/checkers/deprecated.py
index 381d5dac6..ac1cd6425 100644
--- a/pylint/checkers/deprecated.py
+++ b/pylint/checkers/deprecated.py
@@ -9,6 +9,7 @@ import astroid
from astroid import nodes
from pylint.checkers import utils
+from pylint.checkers.base_checker import BaseChecker
from pylint.checkers.utils import get_import_name, infer_all, safe_infer
ACCEPTABLE_NODES = (
@@ -19,7 +20,7 @@ ACCEPTABLE_NODES = (
)
-class DeprecatedMixin:
+class DeprecatedMixin(BaseChecker):
"""A mixin implementing logic for checking deprecated symbols.
A class implementing mixin must define "deprecated-method" Message.
"""
@@ -68,7 +69,7 @@ class DeprecatedMixin:
"deprecated-module",
"deprecated-class",
)
- def visit_import(self, node):
+ def visit_import(self, node: nodes.Import) -> None:
"""triggered when an import statement is seen"""
for name in (name for name, _ in node.names):
self.check_deprecated_module(node, name)
@@ -87,7 +88,7 @@ class DeprecatedMixin:
return ()
@utils.check_messages("deprecated-decorator")
- def visit_decorators(self, node):
+ def visit_decorators(self, node: nodes.Decorators) -> None:
"""Triggered when a decorator statement is seen"""
children = list(node.get_children())
if not children:
@@ -104,7 +105,7 @@ class DeprecatedMixin:
"deprecated-module",
"deprecated-class",
)
- def visit_importfrom(self, node):
+ def visit_importfrom(self, node: nodes.ImportFrom) -> None:
"""triggered when a from statement is seen"""
basename = node.modname
basename = get_import_name(node, basename)