-
Notifications
You must be signed in to change notification settings - Fork 1k
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 more mypy --next type errors #5392
Conversation
Check out this pull request on See visual diffs & provide feedback on Jupyter Notebooks. Powered by ReviewNB |
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.
Using cast
to fix these doesn't feel much better than using type: ignore
. Since they're numeric conversions, could we instead do <type>(<var>)
to enforce type?
For the resolver case: the issue with But for the others, I think you are correct. Updated |
@@ -58,17 +58,17 @@ def random_qubit_unitary( | |||
rng: Random number generator to be used in sampling. Default is | |||
numpy.random. | |||
""" | |||
rng = np.random if rng is None else rng | |||
real_rng: np.random.RandomState = np.random if rng is None else rng |
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.
we should tell mypy to allow_redefined #3832
@@ -92,7 +92,7 @@ def plot_state_histogram( | |||
elif isinstance(data, collections.Counter): | |||
tick_label, values = zip(*sorted(data.items())) | |||
else: | |||
values = data | |||
values = np.array(data) |
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.
prefer np.asarray
Run against
check/mypy --next
See #3767