qognitive / fast-pauli

Python/C++ library for optimized operations on Pauli matrices and Pauli strings
https://qognitive-fast-pauli.readthedocs-hosted.com/en/latest/
BSD 2-Clause "Simplified" License
9 stars 0 forks source link

Fixing Type Signatures from Nanobind #32

Open jamesETsmith opened 1 month ago

jamesETsmith commented 1 month ago

General

There is sometimes a disconnect between the function signatures from nanobind that cause mypy to complain.

Details

Here's an example I saw recently, as of now, these have been crudely addressed by adding # type: ignore[...]

tests/fast_pauli/test_pauli_string.py:86: error: Argument 1 to "PauliString" has incompatible type "Sequence[Any]"; expected "str"  [arg-type]
tests/fast_pauli/test_pauli_string.py:99: error: Argument 1 to "PauliString" has incompatible type "Sequence[Any]"; expected "str"  [arg-type]
tests/fast_pauli/test_pauli_op.py:532: error: Unsupported operand types for + ("PauliString" and "PauliOp")  [operator]
tests/fast_pauli/test_pauli_op.py:532: note: Both left and right operands are unions
tests/fast_pauli/test_pauli_op.py:537: error: Unsupported operand types for + ("PauliString" and "PauliOp")  [operator]
tests/fast_pauli/test_pauli_op.py:537: note: Both left and right operands are unions
tests/fast_pauli/test_pauli_op.py:593: error: Unsupported operand types for + ("PauliString" and "PauliOp")  [operator]
tests/fast_pauli/test_pauli_op.py:593: note: Both left and right operands are unions
tests/fast_pauli/test_pauli_op.py:599: error: Unsupported operand types for - ("PauliString" and "PauliOp")  [operator]
tests/fast_pauli/test_pauli_op.py:599: note: Both left and right operands are unions
tests/fast_pauli/test_pauli_op.py:604: error: Unsupported operand types for + ("PauliString" and "PauliOp")  [operator]
tests/fast_pauli/test_pauli_op.py:604: note: Both left and right operands are unions
Found 7 errors in 2 files (checked 18 source files)
jamesETsmith commented 1 month ago

We may have to do something like they outline in the nanobind docs here