summaryrefslogtreecommitdiff
path: root/pylint/checkers/design_analysis.py
diff options
context:
space:
mode:
authorDaniël van Noord <13665637+DanielNoord@users.noreply.github.com>2022-04-14 11:33:42 +0200
committerDaniël van Noord <13665637+DanielNoord@users.noreply.github.com>2022-04-14 11:53:57 +0200
commita818e281703b613bfafe6acce9821f5efe89ba3f (patch)
treed34408bbc1a156564da90822031260238f3b1e30 /pylint/checkers/design_analysis.py
parent05e50e20d55c898685684e91ea7cb82bba7349b0 (diff)
downloadpylint-git-a818e281703b613bfafe6acce9821f5efe89ba3f.tar.gz
Use ``python-typing-update`` on ``pylint/checkers`` directory
Diffstat (limited to 'pylint/checkers/design_analysis.py')
-rw-r--r--pylint/checkers/design_analysis.py14
1 files changed, 8 insertions, 6 deletions
diff --git a/pylint/checkers/design_analysis.py b/pylint/checkers/design_analysis.py
index eb1477ccb..f5eca5afc 100644
--- a/pylint/checkers/design_analysis.py
+++ b/pylint/checkers/design_analysis.py
@@ -4,10 +4,12 @@
"""Check for signs of poor design."""
+from __future__ import annotations
+
import re
import sys
from collections import defaultdict
-from typing import TYPE_CHECKING, FrozenSet, Iterator, List, Set, cast
+from typing import TYPE_CHECKING, Iterator, List, cast
import astroid
from astroid import nodes
@@ -229,7 +231,7 @@ def _count_methods_in_class(node):
def _get_parents_iter(
- node: nodes.ClassDef, ignored_parents: FrozenSet[str]
+ node: nodes.ClassDef, ignored_parents: frozenset[str]
) -> Iterator[nodes.ClassDef]:
r"""Get parents of ``node``, excluding ancestors of ``ignored_parents``.
@@ -246,7 +248,7 @@ def _get_parents_iter(
And ``ignored_parents`` is ``{"E"}``, then this function will return
``{A, B, C, D}`` -- both ``E`` and its ancestors are excluded.
"""
- parents: Set[nodes.ClassDef] = set()
+ parents: set[nodes.ClassDef] = set()
to_explore = cast(List[nodes.ClassDef], list(node.ancestors(recurs=False)))
while to_explore:
parent = to_explore.pop()
@@ -265,8 +267,8 @@ def _get_parents_iter(
def _get_parents(
- node: nodes.ClassDef, ignored_parents: FrozenSet[str]
-) -> Set[nodes.ClassDef]:
+ node: nodes.ClassDef, ignored_parents: frozenset[str]
+) -> set[nodes.ClassDef]:
return set(_get_parents_iter(node, ignored_parents))
@@ -649,5 +651,5 @@ class MisdesignChecker(BaseChecker):
self._branches[node.scope()] += branchesnum
-def register(linter: "PyLinter") -> None:
+def register(linter: PyLinter) -> None:
linter.register_checker(MisdesignChecker(linter))