diff options
author | danieleades <33452915+danieleades@users.noreply.github.com> | 2023-01-02 09:21:32 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-01-02 09:21:32 +0000 |
commit | cc8f697a9ba15e9556e86a8375a75dc905381c1a (patch) | |
tree | ec409bd01fcd6b6cea1656f51f2322899aa72075 /sphinx/ext/autodoc/__init__.py | |
parent | dbf36f8b379f1e60232ecbf85a67e6ab9b096f24 (diff) | |
download | sphinx-git-cc8f697a9ba15e9556e86a8375a75dc905381c1a.tar.gz |
Address SIM103 lints (#11052)
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
Diffstat (limited to 'sphinx/ext/autodoc/__init__.py')
-rw-r--r-- | sphinx/ext/autodoc/__init__.py | 10 |
1 files changed, 2 insertions, 8 deletions
diff --git a/sphinx/ext/autodoc/__init__.py b/sphinx/ext/autodoc/__init__.py index 35b16673e..d9c0cd09a 100644 --- a/sphinx/ext/autodoc/__init__.py +++ b/sphinx/ext/autodoc/__init__.py @@ -2353,10 +2353,7 @@ class SlotsMixin(DataDocumenterMixinBase): """Check the subject is an attribute in __slots__.""" try: __slots__ = inspect.getslots(self.parent) - if __slots__ and self.objpath[-1] in __slots__: - return True - else: - return False + return bool(__slots__) and self.objpath[-1] in __slots__ except (ValueError, TypeError): return False @@ -2484,10 +2481,7 @@ class UninitializedInstanceAttributeMixin(DataDocumenterMixinBase): def is_uninitialized_instance_attribute(self, parent: Any) -> bool: """Check the subject is an annotation only attribute.""" annotations = get_type_hints(parent, None, self.config.autodoc_type_aliases) - if self.objpath[-1] in annotations: - return True - else: - return False + return self.objpath[-1] in annotations def import_object(self, raiseerror: bool = False) -> bool: """Check the exisitence of uninitialized instance attribute when failed to import |