Skip to content

Commit f8756ed

Browse files
Emit fewer DeprecationWarnings in pyreverse (#6869)
1 parent 6f896b9 commit f8756ed

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

pylint/pyreverse/inspector.py

+8-7
Original file line numberDiff line numberDiff line change
@@ -187,13 +187,14 @@ def visit_classdef(self, node: nodes.ClassDef) -> None:
187187
ifaces = interfaces(node)
188188
if ifaces is not None:
189189
node.implements = list(ifaces)
190-
# TODO: 3.0: Remove support for __implements__
191-
warnings.warn(
192-
"pyreverse will drop support for resolving and displaying implemented interfaces in pylint 3.0. "
193-
"The implementation relies on the '__implements__' attribute proposed in PEP 245, which was rejected "
194-
"in 2006.",
195-
DeprecationWarning,
196-
)
190+
if node.implements:
191+
# TODO: 3.0: Remove support for __implements__
192+
warnings.warn(
193+
"pyreverse will drop support for resolving and displaying implemented interfaces in pylint 3.0. "
194+
"The implementation relies on the '__implements__' attribute proposed in PEP 245, which was rejected "
195+
"in 2006.",
196+
DeprecationWarning,
197+
)
197198
else:
198199
node.implements = []
199200
except astroid.InferenceError:

0 commit comments

Comments
 (0)