Skip to content

Fix mypy errors in batch 2 part 2 (#1282)#1362

Merged
mhucka merged 2 commits into
quantumlib:mainfrom
rosspeili:fix/issue-1282-mypy-batch2-part2
Jun 15, 2026
Merged

Fix mypy errors in batch 2 part 2 (#1282)#1362
mhucka merged 2 commits into
quantumlib:mainfrom
rosspeili:fix/issue-1282-mypy-batch2-part2

Conversation

@rosspeili

Copy link
Copy Markdown
Contributor

Mechanical typing fixes in four files: numpy int casts, local annotations, and loop variable renaming. No behavior changes.

Mechanical typing fixes in four files: numpy int casts, local annotations, and loop variable renaming. No behavior changes.

@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 introduces minor bug fixes, type annotations, and variable renaming to avoid shadowing. Specifically, it resolves potential type issues by casting numpy outputs to integers and adds type annotations in bksf.py. The review feedback highlights two key optimization opportunities: replacing inefficient numpy operations with native Python list operations in binary_code_transform.py to avoid performance bottlenecks, and simplifying the calculation of ny in ffft.py by directly accessing the first element of the list instead of using np.prod.

Comment thread src/openfermion/transforms/opconversions/binary_code_transform.py Outdated
Comment thread src/openfermion/circuits/primitives/ffft.py Outdated
Use native Python lists in the parity loop and factors[0] instead of np.prod for clearer typing and better performance.
@rosspeili

rosspeili commented Jun 13, 2026

Copy link
Copy Markdown
Contributor Author

@mhucka pushed new commit addressing gemini suggestions (binary_code_transform list-based loop, ffft uses factors[0]). Mypy + tests still pass on all 4 files.

@mhucka mhucka left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM

@mhucka
mhucka added this pull request to the merge queue Jun 15, 2026
Merged via the queue into quantumlib:main with commit 6cb25c5 Jun 15, 2026
35 of 37 checks passed
@rosspeili
rosspeili deleted the fix/issue-1282-mypy-batch2-part2 branch June 16, 2026 05:33
@mhucka mhucka mentioned this pull request Jun 17, 2026
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.

2 participants