From e40854494fe2b899f507a13c565169550ac5809f Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Tue, 14 Nov 2023 17:10:54 +0000 Subject: [PATCH] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- pyfakefs/mox3_stubout.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/pyfakefs/mox3_stubout.py b/pyfakefs/mox3_stubout.py index eb304266..9015fb9b 100644 --- a/pyfakefs/mox3_stubout.py +++ b/pyfakefs/mox3_stubout.py @@ -50,10 +50,10 @@ def universal_getattr(obj: Any, attr_name: str) -> tuple[Any, AccessMethod]: attr_value = getattr(obj, attr_name) access_method = AccessMethod.GETATTR except AttributeError as e: - if hasattr(obj, '__dict__') and attr_name in obj.__dict__: + if hasattr(obj, "__dict__") and attr_name in obj.__dict__: attr_value = obj.__dict__[attr_name] access_method = AccessMethod.DICT - elif hasattr(obj, '__slot__') and attr_name in obj.__slot__: + elif hasattr(obj, "__slot__") and attr_name in obj.__slot__: attr_value = obj.__slot__[attr_name] access_method = AccessMethod.SLOT else: @@ -62,7 +62,9 @@ def universal_getattr(obj: Any, attr_name: str) -> tuple[Any, AccessMethod]: return attr_value, access_method -def universal_setattr(obj: Any, attr_name: str, attr_value: Any, access_method: AccessMethod): +def universal_setattr( + obj: Any, attr_name: str, attr_value: Any, access_method: AccessMethod +): """Set an attribute's value in a universal way Can set any normal attributes, as well as attributes stored in `obj.__dict__` @@ -81,7 +83,9 @@ def universal_setattr(obj: Any, attr_name: str, attr_value: Any, access_method: except KeyError: raise AttributeError(f"Attribute {attr_name} not found in __slot__") else: - raise NotImplementedError(f'Unknown {access_method = } has not been implemented') + raise NotImplementedError( + f"Unknown {access_method = } has not been implemented" + ) class StubOutForTesting: