Method: pylint.checkers.classes.class_checker.ClassChecker._check_typing_final
Calls: 1519, Exceptions: 0, Paths: 7Back
Path 1: 972 calls (0.64)
ClassDef (972)
1def _check_typing_final(self, node: nodes.ClassDef) -> None:
2 """Detect that a class does not subclass a class decorated with
3 `typing.final`.
4 """
5 if not self._py38_plus:
6 return
7 for base in node.bases:
8 ancestor = safe_infer(base)
9 if not ancestor:
10 continue
11
12 if isinstance(ancestor, nodes.ClassDef) and (
13 decorated_with(ancestor, ["typing.final"])
14 or uninferable_final_decorators(ancestor.decorators)
15 ):
16 self.add_message(
17 "subclassed-final-class",
18 args=(node.name, ancestor.name),
19 node=node,
20 )
Path 2: 481 calls (0.32)
ClassDef (481)
1def _check_typing_final(self, node: nodes.ClassDef) -> None:
2 """Detect that a class does not subclass a class decorated with
3 `typing.final`.
4 """
5 if not self._py38_plus:
6 return
7 for base in node.bases:
8 ancestor = safe_infer(base)
9 if not ancestor:
10 continue
11
12 if isinstance(ancestor, nodes.ClassDef) and (
13 decorated_with(ancestor, ["typing.final"])
14 or uninferable_final_decorators(ancestor.decorators)
15 ):
16 self.add_message(
17 "subclassed-final-class",
18 args=(node.name, ancestor.name),
19 node=node,
20 )
Path 3: 52 calls (0.03)
ClassDef (52)
1def _check_typing_final(self, node: nodes.ClassDef) -> None:
2 """Detect that a class does not subclass a class decorated with
3 `typing.final`.
4 """
5 if not self._py38_plus:
6 return
7 for base in node.bases:
8 ancestor = safe_infer(base)
9 if not ancestor:
10 continue
11
12 if isinstance(ancestor, nodes.ClassDef) and (
13 decorated_with(ancestor, ["typing.final"])
14 or uninferable_final_decorators(ancestor.decorators)
15 ):
16 self.add_message(
17 "subclassed-final-class",
18 args=(node.name, ancestor.name),
19 node=node,
20 )
Path 4: 7 calls (0.0)
ClassDef (7)
1def _check_typing_final(self, node: nodes.ClassDef) -> None:
2 """Detect that a class does not subclass a class decorated with
3 `typing.final`.
4 """
5 if not self._py38_plus:
6 return
7 for base in node.bases:
8 ancestor = safe_infer(base)
9 if not ancestor:
10 continue
11
12 if isinstance(ancestor, nodes.ClassDef) and (
13 decorated_with(ancestor, ["typing.final"])
14 or uninferable_final_decorators(ancestor.decorators)
15 ):
16 self.add_message(
17 "subclassed-final-class",
18 args=(node.name, ancestor.name),
19 node=node,
20 )
Path 5: 4 calls (0.0)
ClassDef (4)
None (4)
1def _check_typing_final(self, node: nodes.ClassDef) -> None:
2 """Detect that a class does not subclass a class decorated with
3 `typing.final`.
4 """
5 if not self._py38_plus:
6 return
7 for base in node.bases:
8 ancestor = safe_infer(base)
9 if not ancestor:
10 continue
11
12 if isinstance(ancestor, nodes.ClassDef) and (
13 decorated_with(ancestor, ["typing.final"])
14 or uninferable_final_decorators(ancestor.decorators)
15 ):
16 self.add_message(
17 "subclassed-final-class",
18 args=(node.name, ancestor.name),
19 node=node,
20 )
Path 6: 2 calls (0.0)
ClassDef (2)
1def _check_typing_final(self, node: nodes.ClassDef) -> None:
2 """Detect that a class does not subclass a class decorated with
3 `typing.final`.
4 """
5 if not self._py38_plus:
6 return
7 for base in node.bases:
8 ancestor = safe_infer(base)
9 if not ancestor:
10 continue
11
12 if isinstance(ancestor, nodes.ClassDef) and (
13 decorated_with(ancestor, ["typing.final"])
14 or uninferable_final_decorators(ancestor.decorators)
15 ):
16 self.add_message(
17 "subclassed-final-class",
18 args=(node.name, ancestor.name),
19 node=node,
20 )
Path 7: 1 calls (0.0)
ClassDef (1)
1def _check_typing_final(self, node: nodes.ClassDef) -> None:
2 """Detect that a class does not subclass a class decorated with
3 `typing.final`.
4 """
5 if not self._py38_plus:
6 return
7 for base in node.bases:
8 ancestor = safe_infer(base)
9 if not ancestor:
10 continue
11
12 if isinstance(ancestor, nodes.ClassDef) and (
13 decorated_with(ancestor, ["typing.final"])
14 or uninferable_final_decorators(ancestor.decorators)
15 ):
16 self.add_message(
17 "subclassed-final-class",
18 args=(node.name, ancestor.name),
19 node=node,
20 )