Fix mypy errors in batch 3 part 1 (#1282)#1368
Open
rosspeili wants to merge 3 commits into
Open
Conversation
Annotate Tensor optional fields and add guards in _namedtensor. Default beta in compute_thc_resources when None (same pattern as DF). Return empty FermionOperator when plane_wave external potential has no terms.
Contributor
There was a problem hiding this comment.
Code Review
This pull request introduces several type safety improvements, bug fixes, and resource estimation updates. In _namedtensor.py, type annotations were added to the Tensor class, and safety checks were introduced to raise TypeError when required attributes are missing. The vectorize method was also updated to use Literal types and direct array reshaping. In plane_wave_hamiltonian.py, a fallback was added to return an empty FermionOperator if the operator is None. Lastly, in compute_thc_resources.py, a fallback calculation for beta was implemented when it is not provided, and float division was replaced with integer division. There are no review comments, so we have no feedback to provide.
Contributor
Author
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Annotate Tensor optional fields and add guards in _namedtensor. Default beta in compute_thc_resources when None (same pattern as DF). Return empty FermionOperator when plane_wave external potential has no terms.