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

Restrict numpy version to unblock inflight PRs from failing #5853

Merged
merged 15 commits into from
Sep 2, 2022

Conversation

tanujkhattar
Copy link
Collaborator

@tanujkhattar tanujkhattar commented Sep 2, 2022

Latest release of numpy breaks type checks on master.

See https://github.com/quantumlib/Cirq/runs/8161863398?check_suite_focus=true for failing tests.

Part of #5852

cirq-core/cirq/experiments/purity_estimation.py:61: error: Incompatible return value type (got "floating[Any]", expected "float")  [return-value]
cirq-core/cirq/sim/state_vector_simulator.py:87: error: Incompatible types in "yield from" (actual type "ndarray[Any, Any]", expected type "Sequence[complex]")  [misc]
cirq-core/cirq/sim/density_matrix_utils.py:257: error: Unsupported operand types for & ("object" and "int")  [operator]
cirq-core/cirq/sim/density_matrix_utils.py:257: error: Unsupported operand types for - ("object" and "int")  [operator]
cirq-core/cirq/sim/density_matrix_utils.py:267: error: No overload variant of "int" matches argument type "object"  [call-overload]
cirq-core/cirq/sim/density_matrix_utils.py:267: note: Possible overload variants:
cirq-core/cirq/sim/density_matrix_utils.py:267: note:     def __new__(cls, Union[str, bytes, array[Any], mmap, _CData, PickleBuffer, SupportsInt, SupportsIndex, SupportsTrunc] = ...) -> int
cirq-core/cirq/sim/density_matrix_utils.py:267: note:     def __new__(cls, Union[str, bytes], base: SupportsIndex) -> int
cirq-core/cirq/qis/states.py:687: error: Unused "type: ignore" comment
cirq-core/cirq/protocols/trace_distance_bound.py:109: error: Unused "type: ignore" comment
cirq-core/cirq/linalg/transformations.py:338: error: Unused "type: ignore" comment
cirq-core/cirq/linalg/decompositions.py:868: error: No overload variant of "vstack" matches argument type "ndarray[Any, Any]"  [call-overload]
cirq-core/cirq/linalg/decompositions.py:868: note: Possible overload variants:
cirq-core/cirq/linalg/decompositions.py:868: note:     def [_SCT <: generic] vstack(tup: Sequence[Union[_SupportsArray[dtype[_SCT]], _NestedSequence[_SupportsArray[dtype[_SCT]]]]]) -> ndarray[Any, dtype[_SCT]]
cirq-core/cirq/linalg/decompositions.py:868: note:     def vstack(tup: Sequence[Union[_SupportsArray[dtype[Any]], _NestedSequence[_SupportsArray[dtype[Any]]], bool, int, float, complex, str, bytes, _NestedSequence[Union[bool, int, float, complex, str, bytes]]]]) -> ndarray[Any, dtype[Any]]
cirq-core/cirq/interop/quirk/cells/input_rotation_cells.py:153: error: No overload variant of "__rpow__" of "float" matches argument type "Operation"  [operator]
cirq-core/cirq/interop/quirk/cells/input_rotation_cells.py:153: note: Possible overload variants:
cirq-core/cirq/interop/quirk/cells/input_rotation_cells.py:153: note:     def __rpow__(self, Literal[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25], None = ...) -> float
cirq-core/cirq/interop/quirk/cells/input_rotation_cells.py:153: note:     def __rpow__(self, Literal[-1, -2, -3, -4, -5, -6, -7, -8, -9, -10, -11, -12, -13, -14, -15, -16, -17, -18, -19, -20], None = ...) -> complex
cirq-core/cirq/interop/quirk/cells/input_rotation_cells.py:153: note:     def __rpow__(self, float, None = ...) -> Any
cirq-core/cirq/experiments/fidelity_estimation.py:63: error: Incompatible return value type (got "floating[Any]", expected "float")  [return-value]
cirq-core/cirq/experiments/fidelity_estimation.py:196: error: Argument 1 has incompatible type "signedinteger[_64Bit]"; expected "int"  [arg-type]
cirq-core/cirq/experiments/fidelity_estimation.py:196: error: Argument 2 has incompatible type "ndarray[Any, Any]"; expected "Sequence[float]"  [arg-type]
cirq-core/cirq/contrib/quantum_volume/quantum_volume.py:153: error: Incompatible return value type (got "floating[_64Bit]", expected "float")  [return-value]
Found 14 errors in 10 files (checked 1059 source files)

This PR restricts the version of numpy to unblock the in-flight PRs.

@tanujkhattar tanujkhattar requested review from a team, vtomole and cduck as code owners September 2, 2022 21:06
@CirqBot CirqBot added the Size: XS <10 lines changed label Sep 2, 2022
@tanujkhattar tanujkhattar merged commit fb1b9bc into master Sep 2, 2022
pavoljuhas added a commit to pavoljuhas/Cirq that referenced this pull request Sep 3, 2022
CirqBot pushed a commit that referenced this pull request Sep 6, 2022
- Revert "Restrict numpy version to unblock inflight PRs from failing (#5853)"
- Clarify wording of ValueError message
- Fix typing complaints on non-native numeric types
- Fix complaint on float.__rpow__(cirq.Operation) use -
  cirq.Operation has no `__pow__`, but the GateOperation subclass has
- Fix complaint about vstack on generic array
- clean up unused "type: ignore" comments

Resolves #5852.

Reverts #5853.
rht pushed a commit to rht/Cirq that referenced this pull request May 1, 2023
rht pushed a commit to rht/Cirq that referenced this pull request May 1, 2023
- Revert "Restrict numpy version to unblock inflight PRs from failing (quantumlib#5853)"
- Clarify wording of ValueError message
- Fix typing complaints on non-native numeric types
- Fix complaint on float.__rpow__(cirq.Operation) use -
  cirq.Operation has no `__pow__`, but the GateOperation subclass has
- Fix complaint about vstack on generic array
- clean up unused "type: ignore" comments

Resolves quantumlib#5852.

Reverts quantumlib#5853.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Size: XS <10 lines changed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants