Fix mypy errors in batch 2 part 3 (#1282)#1365
Conversation
plane_wave_hamiltonian: annotate spins as list[Optional[int]]. physical_costing: MagicStateFactory rounds and failure_rate are floats at runtime.
There was a problem hiding this comment.
Code Review
This pull request updates type annotations across two files, changing the types of rounds and failure_rate from int to float in physical_costing.py, and adding a type annotation for spins in plane_wave_hamiltonian.py. The reviewer pointed out that using lowercase list for type subscripting in plane_wave_hamiltonian.py could lead to a runtime TypeError on Python versions older than 3.9, and suggested using List from the typing module instead to ensure compatibility and consistency.
mhucka
left a comment
There was a problem hiding this comment.
Please check the type annotation in plane_wave_hamiltonians.py
Per review: use list[...] instead of typing.List (3.10+).
|
@mhucka thanks and agreed, switched back to |
plane_wave_hamiltonian: annotate spins as list[Optional[int]]. physical_costing: MagicStateFactory rounds and failure_rate are floats at runtime.