Skip to content

Fix mypy errors in batch 2 part 3 (#1282)#1365

Open
rosspeili wants to merge 2 commits into
quantumlib:mainfrom
rosspeili:fix/issue-1282-mypy-batch2-part3
Open

Fix mypy errors in batch 2 part 3 (#1282)#1365
rosspeili wants to merge 2 commits into
quantumlib:mainfrom
rosspeili:fix/issue-1282-mypy-batch2-part3

Conversation

@rosspeili

Copy link
Copy Markdown
Contributor

plane_wave_hamiltonian: annotate spins as list[Optional[int]]. physical_costing: MagicStateFactory rounds and failure_rate are floats at runtime.

plane_wave_hamiltonian: annotate spins as list[Optional[int]]. physical_costing: MagicStateFactory rounds and failure_rate are floats at runtime.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread src/openfermion/hamiltonians/plane_wave_hamiltonian.py Outdated
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant