diff options
author | danieleades <33452915+danieleades@users.noreply.github.com> | 2023-01-02 04:52:46 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-01-02 04:52:46 +0000 |
commit | 2759c2c76b5cd09e9dfffbd88ea1b200dcd8d6ae (patch) | |
tree | a1ffe3ce69c2fbf2dd457906622fb6ca6cc08501 /sphinx/util/inspect.py | |
parent | da6a20d50b725f6c33f0f940e2a59c9a4e7edc15 (diff) | |
download | sphinx-git-2759c2c76b5cd09e9dfffbd88ea1b200dcd8d6ae.tar.gz |
Use ``any`` to find elements in iterable (#11053)
Diffstat (limited to 'sphinx/util/inspect.py')
-rw-r--r-- | sphinx/util/inspect.py | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/sphinx/util/inspect.py b/sphinx/util/inspect.py index 10673ca57..8bea91e96 100644 --- a/sphinx/util/inspect.py +++ b/sphinx/util/inspect.py @@ -220,10 +220,10 @@ def isstaticmethod(obj: Any, cls: Any = None, name: str | None = None) -> bool: def isdescriptor(x: Any) -> bool: """Check if the object is some kind of descriptor.""" - for item in '__get__', '__set__', '__delete__': - if callable(safe_getattr(x, item, None)): - return True - return False + return any( + callable(safe_getattr(x, item, None)) + for item in ['__get__', '__set__', '__delete__'] + ) def isabstractmethod(obj: Any) -> bool: |