Skip to content
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 typing in numpy function arguments #5657

Merged
merged 7 commits into from
Jul 6, 2022

Conversation

pavoljuhas
Copy link
Collaborator

  • Assure mypy that np.isclose receives a concrete scalar argument
  • Turn off type check for TParamValComplex used in numpy expressions

Avoid incompatible type error on a possibility of numbers.Complex type.
Assume it is not sympy.Expr and hope for the best.
@pavoljuhas pavoljuhas requested review from a team, vtomole and cduck as code owners June 30, 2022 01:40
@pavoljuhas pavoljuhas requested a review from tanujkhattar June 30, 2022 01:40
@CirqBot CirqBot added the size: S 10< lines changed <50 label Jun 30, 2022
cirq-core/cirq/ops/pauli_string.py Show resolved Hide resolved
Also use assertions to tell mypy that PauliString.coefficient is complex
when not parameterized.
Assume GlobalPhaseGate.coefficient is a numerical value otherwise.
@pavoljuhas pavoljuhas force-pushed the fix-mypy-numpy-errors-2 branch from ada2527 to 8f6233f Compare July 1, 2022 21:32
@pavoljuhas pavoljuhas requested a review from dabacon July 1, 2022 22:19
@MichaelBroughton MichaelBroughton added the automerge Tells CirqBot to sync and merge this PR. (If it's running.) label Jul 6, 2022
@CirqBot CirqBot added the front_of_queue_automerge CirqBot uses this label to indicate (and remember) what's being merged next. label Jul 6, 2022
@CirqBot
Copy link
Collaborator

CirqBot commented Jul 6, 2022

Automerge cancelled: A status check is failing.

@CirqBot CirqBot removed automerge Tells CirqBot to sync and merge this PR. (If it's running.) front_of_queue_automerge CirqBot uses this label to indicate (and remember) what's being merged next. labels Jul 6, 2022
@MichaelBroughton MichaelBroughton added the automerge Tells CirqBot to sync and merge this PR. (If it's running.) label Jul 6, 2022
@CirqBot
Copy link
Collaborator

CirqBot commented Jul 6, 2022

Automerge cancelled: A status check is failing.

@CirqBot CirqBot removed the automerge Tells CirqBot to sync and merge this PR. (If it's running.) label Jul 6, 2022
@pavoljuhas pavoljuhas added the automerge Tells CirqBot to sync and merge this PR. (If it's running.) label Jul 6, 2022
@CirqBot CirqBot added the front_of_queue_automerge CirqBot uses this label to indicate (and remember) what's being merged next. label Jul 6, 2022
@CirqBot CirqBot merged commit 7a845a5 into quantumlib:master Jul 6, 2022
@CirqBot CirqBot removed automerge Tells CirqBot to sync and merge this PR. (If it's running.) front_of_queue_automerge CirqBot uses this label to indicate (and remember) what's being merged next. labels Jul 6, 2022
@pavoljuhas pavoljuhas deleted the fix-mypy-numpy-errors-2 branch July 6, 2022 22:06
rht pushed a commit to rht/Cirq that referenced this pull request May 1, 2023
- Assure mypy that np.isclose receives a concrete scalar argument
- Turn off type check for TParamValComplex used in numpy expressions
harry-phasecraft pushed a commit to PhaseCraft/Cirq that referenced this pull request Oct 31, 2024
- Assure mypy that np.isclose receives a concrete scalar argument
- Turn off type check for TParamValComplex used in numpy expressions
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
size: S 10< lines changed <50
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants