summaryrefslogtreecommitdiff
path: root/pylint/interfaces.py
diff options
context:
space:
mode:
authorNick Drozd <nicholasdrozd@gmail.com>2021-10-25 09:36:39 -0500
committerGitHub <noreply@github.com>2021-10-25 16:36:39 +0200
commitb6ca3b9d6f7ad42accdf90044628521bd711d1ec (patch)
tree493df3452dc727f4bfce142e4d856471d8abbeb4 /pylint/interfaces.py
parent8cfce138e9519f63e969e89359e86e140b2f0f13 (diff)
downloadpylint-git-b6ca3b9d6f7ad42accdf90044628521bd711d1ec.tar.gz
Enable for_any_all check (#5206)
* Enable for_any_all check, reword a few docstrings, shorten some loop variable names, and add typing on modified functions. Co-authored-by: Pierre Sassoulas <pierre.sassoulas@gmail.com> Co-authored-by: Daniƫl van Noord <13665637+DanielNoord@users.noreply.github.com>
Diffstat (limited to 'pylint/interfaces.py')
-rw-r--r--pylint/interfaces.py7
1 files changed, 2 insertions, 5 deletions
diff --git a/pylint/interfaces.py b/pylint/interfaces.py
index e657e7115..5b813c7b7 100644
--- a/pylint/interfaces.py
+++ b/pylint/interfaces.py
@@ -46,16 +46,13 @@ class Interface:
def implements(obj: "Interface", interface: Tuple[type, type]) -> bool:
- """Return true if the give object (maybe an instance or class) implements
+ """Return whether the given object (maybe an instance or class) implements
the interface.
"""
kimplements = getattr(obj, "__implements__", ())
if not isinstance(kimplements, (list, tuple)):
kimplements = (kimplements,)
- for implementedinterface in kimplements:
- if issubclass(implementedinterface, interface):
- return True
- return False
+ return any(issubclass(i, interface) for i in kimplements)
class IChecker(Interface):