-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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 (utils) #8264
Fix mypy errors (utils) #8264
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/utils/mitigation/_filters.py
Outdated
@@ -60,6 +60,11 @@ def cal_matrix(self): | |||
"""Return cal_matrix.""" | |||
return self._cal_matrix | |||
|
|||
@cal_matrix.setter | |||
def cal_matrix(self, new_cal_matrix): |
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.
Is there a reason why this method definition is moved here? Looks like a merge conflict due to an old code to me.
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 reason is this: python/mypy#1465
It may be better just to leave a comment since its a mypy bug, but the change is cheap, so I just went for it (admittedly, I did it before I found out it was a bug)
03fadc0
to
2ed4b7d
Compare
Pull Request Test Coverage Report for Build 5079651444
💛 - Coveralls |
if pending: | ||
category = PendingDeprecationWarning | ||
category: Type[DeprecationWarning] | 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.
I think it would be clearer to declare the type for category
before the if pending
line.
qiskit/utils/mitigation/_filters.py
Outdated
@@ -229,7 +228,7 @@ class TensoredFilter: | |||
since="0.24.0", | |||
additional_msg="For code migration guidelines, visit https://qisk.it/qi_migration.", | |||
) | |||
def __init__(self, cal_matrices: np.matrix, substate_labels_list: list, mit_pattern: list): | |||
def __init__(self, cal_matrices: np.matrix, substate_labels_list: list[str], mit_pattern: list): |
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 docstring indicates that it's not just a list of strings:
a list of the states (as strings, states in the subspace)
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.
As far as I understand this means "as strings (states in the subspace)" not "as strings or states in the subspace"
Except for |
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.
It looks fine to me.
Summary
Following discussion, I'm splitting #8187 by module.
Details and comments
I've moved a setter and getter to be one after another (as per python/mypy#1465)
The are ~40 errors left:
All error list
Large chunk of errors is due to
Backend
/Job
not having properties. There is also set of errors due to casting inqiskit/utils/mitigation/circuits.py