Skip to content

Commit

Permalink
small fix
Browse files Browse the repository at this point in the history
  • Loading branch information
matthiasdiener committed Mar 14, 2023
1 parent 76d8a0c commit 71cadf4
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions pytools/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -485,6 +485,8 @@ def __setstate__(self, valuedict: Dict[str, Any]) -> None:
def __eq__(self, other: Any) -> bool:
if self is other:
return True
if not isinstance(other, Record):
return False
return (self.__class__ == other.__class__
and self.__getstate__() == other.__getstate__())

Expand All @@ -505,8 +507,8 @@ def __hash__(self) -> int:
(type(self),) + tuple(getattr(self, field)
for field in self.__class__.fields))

assert self._cached_hash
return self._cached_hash
from typing import cast
return cast(int, self._cached_hash)


class ImmutableRecord(ImmutableRecordWithoutPickling, Record):
Expand Down

0 comments on commit 71cadf4

Please sign in to comment.