diff --git a/Utils.py b/Utils.py index f6e4a9ab6052..b5e8c62e6daf 100644 --- a/Utils.py +++ b/Utils.py @@ -789,13 +789,13 @@ def __init__(self, message, error: bool = False) -> None: self.should_error = error super().__init__() - def __getitem__(self, item: Any) -> Any: - if self.should_error: - deprecate(self.log_message) - elif __debug__: + if __debug__: + def __getitem__(self, item: Any) -> Any: + if self.should_error: + deprecate(self.log_message) import warnings warnings.warn(self.log_message) - return super().__getitem__(item) + return super().__getitem__(item) def _extend_freeze_support() -> None: