From 24e7b3304a8a6dd8404ae569346fa1b33f2e4755 Mon Sep 17 00:00:00 2001 From: "d.kovalenko" Date: Mon, 23 Mar 2026 11:02:08 +0300 Subject: [PATCH] InvalidOperationException is updated (typing) - source returns typing.Optional[str] - __repr__ uses assert type(self) is InvalidOperationException - suppression of E721 is deleted --- src/exceptions.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/exceptions.py b/src/exceptions.py index f745074..dccdba1 100644 --- a/src/exceptions.py +++ b/src/exceptions.py @@ -40,13 +40,13 @@ def message(self) -> str: return self._message @property - def source(self) -> str: + def source(self) -> typing.Optional[str]: assert self._source is None or type(self._source) is str return self._source def __repr__(self) -> str: # It must be overrided! - assert type(self) == InvalidOperationException # noqa: E721 + assert type(self) is InvalidOperationException r = "{}({}, {})".format( __class__.__name__, repr(self._message),