diff options
author | Nao Pross <np@0hm.ch> | 2024-05-04 18:23:12 +0200 |
---|---|---|
committer | Nao Pross <np@0hm.ch> | 2024-05-04 18:23:12 +0200 |
commit | 6c87b4df295796f61a9a0212d4dc41cb53f3384b (patch) | |
tree | 93ae9681391e63e9b2c7cefc7d8005c21f77338b | |
parent | Fix AdditionExprMixin (diff) | |
download | polymatrix-6c87b4df295796f61a9a0212d4dc41cb53f3384b.tar.gz polymatrix-6c87b4df295796f61a9a0212d4dc41cb53f3384b.zip |
Reintroduce PolyMatrixDict.__getitem__ to make the typechecker shut up
-rw-r--r-- | polymatrix/polymatrix/typing.py | 3 |
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() |