summaryrefslogtreecommitdiff
path: root/pylint/extensions/overlapping_exceptions.py
diff options
context:
space:
mode:
authorPierre Sassoulas <pierre.sassoulas@gmail.com>2021-12-27 21:30:34 +0100
committerGitHub <noreply@github.com>2021-12-27 21:30:34 +0100
commit7d2584251552283bf95893019e74dad0390dc65c (patch)
tree7b5b8fa573a94d73b97741789a3e1fe35c7e7824 /pylint/extensions/overlapping_exceptions.py
parent691b41b3ddd3b533bce4d6a1f03ebc1e5cacf508 (diff)
downloadpylint-git-7d2584251552283bf95893019e74dad0390dc65c.tar.gz
Add typing and uniformize the checker registering in Pylinter (#5558)
Remove verbose docstring in code, keep them in example and doc Co-authored-by: Marc Mueller <30130371+cdce8p@users.noreply.github.com>
Diffstat (limited to 'pylint/extensions/overlapping_exceptions.py')
-rw-r--r--pylint/extensions/overlapping_exceptions.py8
1 files changed, 5 insertions, 3 deletions
diff --git a/pylint/extensions/overlapping_exceptions.py b/pylint/extensions/overlapping_exceptions.py
index 470582b68..ef6afefea 100644
--- a/pylint/extensions/overlapping_exceptions.py
+++ b/pylint/extensions/overlapping_exceptions.py
@@ -3,7 +3,7 @@
"""Looks for overlapping exceptions."""
-from typing import Any, List, Tuple
+from typing import TYPE_CHECKING, Any, List, Tuple
import astroid
from astroid import nodes
@@ -12,6 +12,9 @@ from pylint import checkers, interfaces
from pylint.checkers import utils
from pylint.checkers.exceptions import _annotated_unpack_infer
+if TYPE_CHECKING:
+ from pylint.lint import PyLinter
+
class OverlappingExceptionsChecker(checkers.BaseChecker):
"""Checks for two or more exceptions in the same exception handler
@@ -81,6 +84,5 @@ class OverlappingExceptionsChecker(checkers.BaseChecker):
handled_in_clause += [(part, exc)]
-def register(linter):
- """Required method to auto register this checker."""
+def register(linter: "PyLinter") -> None:
linter.register_checker(OverlappingExceptionsChecker(linter))