-
Notifications
You must be signed in to change notification settings - Fork 2.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix mypy errors (results) #8255
base: main
Are you sure you want to change the base?
Conversation
Thank you for opening a new pull request. Before your PR can be merged it will first need to pass continuous integration tests and be reviewed. Sometimes the review process can be slow, so please be patient. While you're waiting, please feel free to review other open PRs. While only a subset of people are authorized to approve pull requests for merging, everyone is encouraged to review open pull requests. Doing reviews helps reduce the burden on the core team and helps make the project's code better for everyone. One or more of the the following people are requested to review this:
|
qiskit/result/mitigation/utils.py
Outdated
@@ -32,7 +32,7 @@ def z_diagonal(dim, dtype=float): | |||
return (-1) ** np.mod(parity, 2) | |||
|
|||
|
|||
def expval_with_stddev(coeffs: np.ndarray, probs: np.ndarray, shots: int) -> Tuple[float, float]: | |||
def expval_with_stddev(coeffs: np.ndarray, probs: np.ndarray, shots: int) -> List[float]: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Possibly instead should return tuple of floats, i.e.,
return expval, calc_stddev
in L59
@@ -122,7 +124,7 @@ def expectation_value( | |||
diagonal = str2diag(diagonal) | |||
|
|||
# Apply transpose of mitigation matrix | |||
coeffs = mit_mat.T.dot(diagonal) | |||
coeffs = mit_mat.T.dot(diagonal) # TODO: won't work if diagonal is Callable or dict? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The case of diagonal being Callable
or dict
is not explained anywhere in documentation (even though it is mentioned there) and is not tested. Not sure what it means.
"""The device qubits for this mitigator""" | ||
return self._qubits | ||
return self._qubits # TODO: cast to tuple or change return type |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This appears to be just the wrong signature. self._qubits
is not necessarily tuple.
8d9dbde
to
79deca9
Compare
Pull Request Test Coverage Report for Build 5057927442
💛 - Coveralls |
Pull Request Test Coverage Report for Build 8702741555Details
💛 - Coveralls |
Summary
Following discussion, I'm splitting #8187 by module.
Details and comments
This fixes all the mypy errors in results as for now.