Fix errors

This commit is contained in:
John Doty 2025-02-14 19:09:35 -08:00
parent 1aa85cc295
commit ed5baefd5d
2 changed files with 15 additions and 1 deletions

View file

@ -236,6 +236,20 @@ class ItemSet:
def __init__(self, items=None):
self.items = items or {}
self._hash = None
def __hash__(self):
# TODO: FREEZE
if self._hash is None:
self._hash = hash(tuple((key, frozenset(value)) for key, value in self.items.items()))
return self._hash
def __eq__(self, other):
if not isinstance(other, ItemSet):
return False
return self.items == other.items
def weakly_compatible(self, other: "ItemSet") -> bool:
a = self.items