mirror of
https://github.com/aiogram/aiogram.git
synced 2026-04-08 16:37:47 +00:00
update __eq__ method
Co-authored-by: Oleg A. <t0rr@mail.ru>
This commit is contained in:
parent
cc0bbd8983
commit
7c18036af0
1 changed files with 5 additions and 1 deletions
|
|
@ -55,7 +55,11 @@ class State:
|
|||
return raw_state == self.state
|
||||
|
||||
def __eq__(self, other):
|
||||
return self.state == other.state
|
||||
if isinstance(other, self.__class__):
|
||||
return self.state == other.state
|
||||
if isinstance(other, str):
|
||||
return self.state == other
|
||||
raise ValueError(f"Comparing {type(self)} and {type(other)} is not supported")
|
||||
|
||||
def __hash__(self):
|
||||
return hash(self.state)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue