diff options
author | Pierre Sassoulas <pierre.sassoulas@gmail.com> | 2023-03-08 21:39:23 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-03-08 21:39:23 +0100 |
commit | 358264aaf622505f6d2e8bc699618382981a078c (patch) | |
tree | 0395141b74b097cd0f55b1b97d26b9e2a7d20175 /pylint/pyreverse | |
parent | 3318aa0c5877abd9e9d2361f8a21b8880b7a052d (diff) | |
download | pylint-git-358264aaf622505f6d2e8bc699618382981a078c.tar.gz |
[__implements__] Remove everything related to the rejected PEP245 (#8404)
Diffstat (limited to 'pylint/pyreverse')
-rw-r--r-- | pylint/pyreverse/diagrams.py | 7 | ||||
-rw-r--r-- | pylint/pyreverse/inspector.py | 45 |
2 files changed, 2 insertions, 50 deletions
diff --git a/pylint/pyreverse/diagrams.py b/pylint/pyreverse/diagrams.py index 4437d3c4e..54b138752 100644 --- a/pylint/pyreverse/diagrams.py +++ b/pylint/pyreverse/diagrams.py @@ -207,13 +207,6 @@ class ClassDiagram(Figure, FilterMixIn): self.add_relationship(obj, par_obj, "specialization") except KeyError: continue - # implements link - for impl_node in node.implements: - try: - impl_obj = self.object_from_node(impl_node) - self.add_relationship(obj, impl_obj, "implements") - except KeyError: - continue # associations & aggregations links for name, values in list(node.aggregations_type.items()): diff --git a/pylint/pyreverse/inspector.py b/pylint/pyreverse/inspector.py index 523ff8171..aa52845b4 100644 --- a/pylint/pyreverse/inspector.py +++ b/pylint/pyreverse/inspector.py @@ -12,13 +12,11 @@ from __future__ import annotations import collections import os import traceback -import warnings from abc import ABC, abstractmethod -from collections.abc import Generator -from typing import Any, Callable, Optional +from typing import Callable, Optional import astroid -from astroid import nodes, util +from astroid import nodes from pylint import constants from pylint.pyreverse import utils @@ -39,27 +37,6 @@ def _astroid_wrapper( return None -def interfaces(node: nodes.ClassDef) -> Generator[Any, None, None]: - """Return an iterator on interfaces implemented by the given class node.""" - try: - implements = astroid.bases.Instance(node).getattr("__implements__")[0] - except astroid.exceptions.NotFoundError: - return - if implements.frame(future=True) is not node: - return - found = set() - missing = False - for iface in nodes.unpack_infer(implements): - if isinstance(iface, util.UninferableBase): - missing = True - continue - if iface not in found: - found.add(iface) - yield iface - if missing: - raise astroid.exceptions.InferenceError() - - class IdGeneratorMixIn: """Mixin adding the ability to generate integer uid.""" @@ -194,24 +171,6 @@ class Linker(IdGeneratorMixIn, utils.LocalsVisitor): if not isinstance(assignattr, nodes.Unknown): self.associations_handler.handle(assignattr, node) self.handle_assignattr_type(assignattr, node) - # resolve implemented interface - try: - ifaces = interfaces(node) - if ifaces is not None: - node.implements = list(ifaces) - if node.implements: - # TODO: 3.0: Remove support for __implements__ - warnings.warn( - "pyreverse will drop support for resolving and displaying " - "implemented interfaces in pylint 3.0. The implementation " - "relies on the '__implements__' attribute proposed in PEP 245" - ", which was rejected in 2006.", - DeprecationWarning, - ) - else: - node.implements = [] - except astroid.InferenceError: - node.implements = [] def visit_functiondef(self, node: nodes.FunctionDef) -> None: """Visit an astroid.Function node. |