summaryrefslogtreecommitdiff
path: root/pylint/extensions/overlapping_exceptions.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/extensions/overlapping_exceptions.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/extensions/overlapping_exceptions.py')
-rw-r--r--pylint/extensions/overlapping_exceptions.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/pylint/extensions/overlapping_exceptions.py b/pylint/extensions/overlapping_exceptions.py
index 891dde59f..2ed9038e3 100644
--- a/pylint/extensions/overlapping_exceptions.py
+++ b/pylint/extensions/overlapping_exceptions.py
@@ -3,7 +3,10 @@
"""Looks for overlapping exceptions."""
+from typing import Any, List, Tuple
+
import astroid
+from astroid import nodes
from pylint import checkers, interfaces
from pylint.checkers import utils
@@ -29,7 +32,7 @@ class OverlappingExceptionsChecker(checkers.BaseChecker):
options = ()
@utils.check_messages("overlapping-except")
- def visit_tryexcept(self, node):
+ def visit_tryexcept(self, node: nodes.TryExcept) -> None:
"""check for empty except"""
for handler in node.handlers:
if handler.type is None:
@@ -41,7 +44,7 @@ class OverlappingExceptionsChecker(checkers.BaseChecker):
except astroid.InferenceError:
continue
- handled_in_clause = []
+ handled_in_clause: List[Tuple[Any, Any]] = []
for part, exc in excs:
if exc is astroid.Uninferable:
continue