summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNao Pross <np@0hm.ch>2024-05-04 18:23:12 +0200
committerNao Pross <np@0hm.ch>2024-05-04 18:23:12 +0200
commit6c87b4df295796f61a9a0212d4dc41cb53f3384b (patch)
tree93ae9681391e63e9b2c7cefc7d8005c21f77338b
parentFix AdditionExprMixin (diff)
downloadpolymatrix-6c87b4df295796f61a9a0212d4dc41cb53f3384b.tar.gz
polymatrix-6c87b4df295796f61a9a0212d4dc41cb53f3384b.zip
Reintroduce PolyMatrixDict.__getitem__ to make the typechecker shut up
Diffstat (limited to '')
-rw-r--r--polymatrix/polymatrix/typing.py3
1 files changed, 3 insertions, 0 deletions
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()