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

@ -18,7 +18,7 @@ include lrparser.mk
wheel: dist/lrparsers-$(VERSION)-py3-none-any.whl wheel: dist/lrparsers-$(VERSION)-py3-none-any.whl
dist/lrparsers-$(VERSION).tar.gz dist/lrparsers-$(VERSION)-py3-none-any.whl: pyproject.toml $(PYTHON_SOURCES) dist/lrparsers-$(VERSION).tar.gz dist/lrparsers-$(VERSION)-py3-none-any.whl: pyproject.toml $(PYTHON_SOURCES)
uv build --no-clean uv build --offline #--no-clean
.PHONY: clean .PHONY: clean
clean: clean:

View file

@ -236,6 +236,20 @@ class ItemSet:
def __init__(self, items=None): def __init__(self, items=None):
self.items = items or {} 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: def weakly_compatible(self, other: "ItemSet") -> bool:
a = self.items a = self.items