Skip to content

Commit 5879989

Browse files
committed
chore: add warning about hash for RoborockModeEnum
1 parent 131b9c8 commit 5879989

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

roborock/data/code_mappings.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,11 @@ def __eq__(self, other: Any) -> bool:
113113
return super().__eq__(other)
114114

115115
def __hash__(self) -> int:
116+
"""Hash a RoborockModeEnum.
117+
118+
It is critical that you do not mix RoborockModeEnums with raw strings or ints in hashed situations
119+
(i.e. sets or keys in dictionaries)
120+
"""
116121
return hash((self.code, self._value_))
117122

118123

0 commit comments

Comments
 (0)