diff options
author | Nick Drozd <nicholasdrozd@gmail.com> | 2021-10-25 09:36:39 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-10-25 16:36:39 +0200 |
commit | b6ca3b9d6f7ad42accdf90044628521bd711d1ec (patch) | |
tree | 493df3452dc727f4bfce142e4d856471d8abbeb4 /pylint/interfaces.py | |
parent | 8cfce138e9519f63e969e89359e86e140b2f0f13 (diff) | |
download | pylint-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.py | 7 |
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): |