From 6c87b4df295796f61a9a0212d4dc41cb53f3384b Mon Sep 17 00:00:00 2001 From: Nao Pross Date: Sat, 4 May 2024 18:23:12 +0200 Subject: Reintroduce PolyMatrixDict.__getitem__ to make the typechecker shut up --- polymatrix/polymatrix/typing.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/polymatrix/polymatrix/typing.py b/polymatrix/polymatrix/typing.py index 8626cf3..79b8161 100644 --- a/polymatrix/polymatrix/typing.py +++ b/polymatrix/polymatrix/typing.py @@ -169,6 +169,9 @@ class PolyMatrixDict(UserDict[MatrixIndex, PolyDict]): return super().__setitem__(key, value) + def __getitem__(self, key: tuple[int, int] | MatrixIndex) -> PolyDict: + return super().__getitem__(cast(MatrixIndex, key)) + def entries(self) -> Iterable[tuple[MatrixIndex, PolyDict]]: yield from self.items() -- cgit v1.2.1