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 mypy errors (circuit) #8267

Merged
merged 20 commits into from
Mar 28, 2023
Merged

Fix mypy errors (circuit) #8267

merged 20 commits into from
Mar 28, 2023

Conversation

Randl
Copy link
Contributor

@Randl Randl commented Jun 29, 2022

Summary

Following discussion, I'm splitting #8187 by module.

Details and comments

I've added some ignores: annotated properties, and using attributes which are checked in runtime.

The are ~130 errors left:

All error list
qiskit/circuit/add_control.py:127: error: Argument 1 to "mct" of "QuantumCircuit" has incompatible type "QuantumRegister"; expected "Sequence[Union[Qubit, QuantumRegister, int, slice, Sequence[Union[Qubit, int]]]]"  [arg-type]
qiskit/circuit/add_control.py:129: error: "QuantumCircuit" has no attribute "mcrx"; maybe "mcx" or "crx"?  [attr-defined]
qiskit/circuit/add_control.py:136: error: "QuantumCircuit" has no attribute "mcry"; maybe "cry"?  [attr-defined]
qiskit/circuit/add_control.py:145: error: "QuantumCircuit" has no attribute "mcrz"; maybe "crz"?  [attr-defined]
qiskit/circuit/add_control.py:175: error: "QuantumCircuit" has no attribute "mcrx"; maybe "mcx" or "crx"?  [attr-defined]
qiskit/circuit/add_control.py:179: error: "QuantumCircuit" has no attribute "mcry"; maybe "cry"?  [attr-defined]
qiskit/circuit/add_control.py:187: error: "QuantumCircuit" has no attribute "mcrz"; maybe "crz"?  [attr-defined]
qiskit/circuit/add_control.py:191: error: "QuantumCircuit" has no attribute "mcrz"; maybe "crz"?  [attr-defined]
qiskit/circuit/add_control.py:194: error: "QuantumCircuit" has no attribute "mcry"; maybe "cry"?  [attr-defined]
qiskit/circuit/add_control.py:201: error: "QuantumCircuit" has no attribute "mcrz"; maybe "crz"?  [attr-defined]
qiskit/circuit/add_control.py:206: error: Argument 1 to "mcx" of "QuantumCircuit" has incompatible type "QuantumRegister"; expected "Sequence[Union[Qubit, QuantumRegister, int, slice, Sequence[Union[Qubit, int]]]]"  [arg-type]
qiskit/circuit/add_control.py:221: error: Unsupported operand types for | ("int" and "str")  [operator]
qiskit/circuit/add_control.py:221: note: Right operand is of type "Union[int, str, None]"
qiskit/circuit/add_control.py:226: error: Incompatible types in assignment (expression has type "Union[int, str, None]", variable has type "int")  [assignment]
qiskit/circuit/classicalfunction/classical_function_visitor.py:152: error: "expr" has no attribute "id"  [attr-defined]
qiskit/circuit/classicalfunction/classical_function_visitor.py:153: error: "expr" has no attribute "id"  [attr-defined]
qiskit/circuit/controlledgate.py:100: error: Incompatible types in assignment (expression has type "Union[int, str, None]", variable has type "int")  [assignment]
qiskit/circuit/controlledgate.py:123: error: Incompatible return value type (got "QuantumCircuit", expected "List[Any]")  [return-value]
qiskit/circuit/gate.py:208: error: Incompatible return value type (got "Iterator[Tuple[List[Any], List[Any]]]", expected "Tuple[List[Any], List[Any]]")  [return-value]
qiskit/circuit/gate.py:210: error: Incompatible return value type (got "Iterator[Tuple[List[Any], List[Any]]]", expected "Tuple[List[Any], List[Any]]")  [return-value]
qiskit/circuit/gate.py:212: error: Incompatible return value type (got "Iterator[Tuple[List[Any], List[Any]]]", expected "Tuple[List[Any], List[Any]]")  [return-value]
qiskit/circuit/library/arithmetic/adders/vbe_ripple_carry_adder.py:86: error: Incompatible types in assignment (expression has type "List[<nothing>]", variable has type "QuantumRegister")  [assignment]
qiskit/circuit/library/arithmetic/adders/vbe_ripple_carry_adder.py:97: error: Incompatible types in assignment (expression has type "List[<nothing>]", variable has type "QuantumRegister")  [assignment]
qiskit/circuit/library/arithmetic/adders/vbe_ripple_carry_adder.py:105: error: Incompatible types in assignment (expression has type "List[<nothing>]", variable has type "AncillaRegister")  [assignment]
qiskit/circuit/library/arithmetic/linear_amplitude_function.py:104: error: List item 0 has incompatible type "Union[float, List[float]]"; expected "float"  [list-item]
qiskit/circuit/library/arithmetic/linear_amplitude_function.py:106: error: List item 0 has incompatible type "Union[float, List[float]]"; expected "float"  [list-item]
qiskit/circuit/library/arithmetic/linear_amplitude_function.py:136: error: Value of type "Union[float, List[float]]" is not indexable  [index]
qiskit/circuit/library/arithmetic/linear_amplitude_function.py:137: error: Value of type "Union[float, List[float]]" is not indexable  [index]
qiskit/circuit/library/arithmetic/piecewise_chebyshev.py:255: error: Item "float" of "Union[float, Callable[[int], float]]" has no attribute "__code__"  [union-attr]
qiskit/circuit/library/arithmetic/piecewise_linear_pauli_rotations.py:105: error: Incompatible return value type (got "Union[List[float], ndarray[Any, Any]]", expected "List[float]")  [return-value]
qiskit/circuit/library/arithmetic/piecewise_linear_pauli_rotations.py:124: error: Incompatible return value type (got "Union[List[float], ndarray[Any, Any]]", expected "List[float]")  [return-value]
qiskit/circuit/library/arithmetic/piecewise_linear_pauli_rotations.py:171: error: Incompatible return value type (got "bool_", expected "bool")  [return-value]
qiskit/circuit/library/arithmetic/piecewise_polynomial_pauli_rotations.py:207: error: Incompatible return value type (got "bool_", expected "bool")  [return-value]
qiskit/circuit/library/arithmetic/quadratic_form.py:114: error: Argument 1 to "required_result_qubits" of "QuadraticForm" has incompatible type "Union[ndarray[Any, Any], List[List[Union[float, ParameterExpression]]]]"; expected "Union[ndarray[Any, Any], List[List[float]]]"  [arg-type]
qiskit/circuit/library/arithmetic/quadratic_form.py:114: error: Argument 2 to "required_result_qubits" of "QuadraticForm" has incompatible type "Union[ndarray[Any, Any], List[Union[float, ParameterExpression]]]"; expected "Union[ndarray[Any, Any], List[float]]"  [arg-type]
qiskit/circuit/library/blueprintcircuit.py:73: error: Signature of "qregs" incompatible with supertype "QuantumCircuit"  [override]
qiskit/circuit/library/blueprintcircuit.py:89: error: Read-only property cannot override read-write property  [misc]
qiskit/circuit/library/boolean_logic/quantum_and.py:91: error: Incompatible types in assignment (expression has type "List[<nothing>]", variable has type "AncillaRegister")  [assignment]
qiskit/circuit/library/boolean_logic/quantum_or.py:90: error: Incompatible types in assignment (expression has type "List[<nothing>]", variable has type "AncillaRegister")  [assignment]
qiskit/circuit/library/data_preparation/pauli_feature_map.py:140: error: Argument "entanglement" to "__init__" of "NLocal" has incompatible type "Union[str, List[List[int]], Callable[[int], List[int]]]"; expected "Union[List[int], List[List[int]], None]"  [arg-type]
qiskit/circuit/library/data_preparation/pauli_feature_map.py:151: error: Return type "Optional[List[Parameter]]" of "_parameter_generator" incompatible with return type "Optional[Parameter]" in supertype "NLocal"  [override]
qiskit/circuit/library/data_preparation/state_preparation.py:89: error: Incompatible types in assignment (expression has type "ndarray[Any, Any]", variable has type "Union[str, List[Any], int, Statevector]")  [assignment]
qiskit/circuit/library/data_preparation/state_preparation.py:103: error: Argument 3 to "__init__" of "Gate" has incompatible type "Union[List[int], str, List[Any], Statevector]"; expected "List[Any]"  [arg-type]
qiskit/circuit/library/data_preparation/state_preparation.py:516: error: "Type[QuantumCircuit]" has no attribute "prepare_state"  [attr-defined]
qiskit/circuit/library/evolved_operator_ansatz.py:61: error: Argument "parameter_prefix" to "__init__" of "NLocal" has incompatible type "Union[str, List[str]]"; expected "str"  [arg-type]
qiskit/circuit/library/evolved_operator_ansatz.py:87: error: Read-only property cannot override read-write property  [misc]
qiskit/circuit/library/fourier_checking.py:83: error: Argument 1 to "QuantumCircuit" has incompatible type "float"; expected "Union[Register, int, Sequence[Bit]]"  [arg-type]
qiskit/circuit/library/fourier_checking.py:87: error: "QuantumCircuit" has no attribute "diagonal"  [attr-defined]
qiskit/circuit/library/fourier_checking.py:91: error: "QuantumCircuit" has no attribute "diagonal"  [attr-defined]
qiskit/circuit/library/generalized_gates/diagonal.py:110: error: "QuantumCircuit" has no attribute "ucrz"; maybe "crz"?  [attr-defined]
qiskit/circuit/library/generalized_gates/gms.py:89: error: List item 0 has incompatible type "ndarray[Any, Any]"; expected "List[float]"  [list-item]
qiskit/circuit/library/generalized_gates/linear_function.py:160: error: Incompatible return value type (got "bool_", expected "bool")  [return-value]
qiskit/circuit/library/generalized_gates/mcmt.py:263: error: Missing return statement  [return]
qiskit/circuit/library/generalized_gates/mcmt.py:287: error: Return value expected  [return-value]
qiskit/circuit/library/grover_operator.py:298: error: Incompatible types in assignment (expression has type "List[<nothing>]", variable has type "AncillaRegister")  [assignment]
qiskit/circuit/library/n_local/efficient_su2.py:130: error: Argument "rotation_blocks" to "__init__" of "TwoLocal" has incompatible type "Union[str, type, Instruction, QuantumCircuit, List[Union[str, type, Instruction, QuantumCircuit]]]"; expected "Union[str, List[str], type, List[type], QuantumCircuit, List[QuantumCircuit], None]"  [arg-type]
qiskit/circuit/library/n_local/efficient_su2.py:142: error: Read-only property cannot override read-write property  [misc]
qiskit/circuit/library/n_local/excitation_preserving.py:160: error: Read-only property cannot override read-write property  [misc]
qiskit/circuit/library/n_local/n_local.py:229: error: Incompatible types in assignment (expression has type "List[Union[QuantumCircuit, Instruction]]", variable has type "Union[QuantumCircuit, List[QuantumCircuit], Instruction, List[Instruction]]")  [assignment]
qiskit/circuit/library/n_local/n_local.py:232: error: List comprehension has incompatible type List[QuantumCircuit]; expected List[Instruction]  [misc]
qiskit/circuit/library/n_local/n_local.py:232: error: Item "QuantumCircuit" of "Union[QuantumCircuit, List[QuantumCircuit], Instruction, List[Instruction]]" has no attribute "__iter__" (not iterable)  [union-attr]
qiskit/circuit/library/n_local/n_local.py:232: error: Item "Instruction" of "Union[QuantumCircuit, List[QuantumCircuit], Instruction, List[Instruction]]" has no attribute "__iter__" (not iterable)  [union-attr]
qiskit/circuit/library/n_local/n_local.py:254: error: Incompatible types in assignment (expression has type "List[Union[QuantumCircuit, Instruction]]", variable has type "Union[QuantumCircuit, List[QuantumCircuit], Instruction, List[Instruction]]")  [assignment]
qiskit/circuit/library/n_local/n_local.py:257: error: List comprehension has incompatible type List[QuantumCircuit]; expected List[Instruction]  [misc]
qiskit/circuit/library/n_local/n_local.py:257: error: Item "QuantumCircuit" of "Union[QuantumCircuit, List[QuantumCircuit], Instruction, List[Instruction]]" has no attribute "__iter__" (not iterable)  [union-attr]
qiskit/circuit/library/n_local/n_local.py:257: error: Item "Instruction" of "Union[QuantumCircuit, List[QuantumCircuit], Instruction, List[Instruction]]" has no attribute "__iter__" (not iterable)  [union-attr]
qiskit/circuit/library/n_local/n_local.py:400: error: Incompatible types in assignment (expression has type "Union[ParameterVector, List[Parameter]]", variable has type "ParameterVector")  [assignment]
qiskit/circuit/library/n_local/n_local.py:747: error: Incompatible types in assignment (expression has type "List[Union[List[int], List[List[int]]]]", variable has type "Union[List[int], str, List[List[int]], None]")  [assignment]
qiskit/circuit/library/n_local/n_local.py:751: error: List item 0 has incompatible type "Union[List[int], str, List[List[int]]]"; expected "List[int]"  [list-item]
qiskit/circuit/library/n_local/n_local.py:754: error: List item 0 has incompatible type "Union[List[int], str, List[List[int]]]"; expected "List[int]"  [list-item]
qiskit/circuit/library/n_local/n_local.py:757: error: Argument 1 to "max" has incompatible type "Union[int, List[int]]"; expected "Iterable[int]"  [arg-type]
qiskit/circuit/library/n_local/n_local.py:770: error: Incompatible types in assignment (expression has type "Union[List[int], List[List[int]]]", variable has type "List[Tuple[int, ...]]")  [assignment]
qiskit/circuit/library/n_local/n_local.py:963: error: Incompatible types in assignment (expression has type "Instruction", variable has type "Gate")  [assignment]
qiskit/circuit/library/n_local/n_local.py:983: error: List comprehension has incompatible type List[ParameterExpression]; expected List[Parameter]  [misc]
qiskit/circuit/library/n_local/pauli_two_design.py:96: error: List item 0 has incompatible type "RYGate"; expected "QuantumCircuit"  [list-item]
qiskit/circuit/library/n_local/pauli_two_design.py:97: error: List item 0 has incompatible type "str"; expected "List[int]"  [list-item]
qiskit/circuit/library/n_local/qaoa_ansatz.py:62: error: Incompatible types in assignment (expression has type "Optional[QuantumCircuit]", base class "NLocal" defined the type as "None")  [assignment]
qiskit/circuit/library/n_local/qaoa_ansatz.py:66: error: Incompatible types in assignment (expression has type "Optional[List[Tuple[Optional[float], Optional[float]]]]", base class "NLocal" defined the type as "None")  [assignment]
qiskit/circuit/library/n_local/qaoa_ansatz.py:134: error: Incompatible return value type (got "List[Tuple[int, float]]", expected "Optional[List[Tuple[Optional[float], Optional[float]]]]")  [return-value]
qiskit/circuit/library/n_local/qaoa_ansatz.py:147: error: Read-only property cannot override read-write property  [misc]
qiskit/circuit/library/n_local/qaoa_ansatz.py:250: error: Read-only property cannot override read-write property  [misc]
qiskit/circuit/library/n_local/real_amplitudes.py:160: error: Read-only property cannot override read-write property  [misc]
qiskit/circuit/library/n_local/two_local.py:204: error: Argument "rotation_blocks" to "__init__" of "NLocal" has incompatible type "Union[str, List[str], type, List[type], QuantumCircuit, List[QuantumCircuit], None]"; expected "Union[QuantumCircuit, List[QuantumCircuit], Instruction, List[Instruction], None]"  [arg-type]
qiskit/circuit/library/n_local/two_local.py:205: error: Argument "entanglement_blocks" to "__init__" of "NLocal" has incompatible type "Union[str, List[str], type, List[type], QuantumCircuit, List[QuantumCircuit], None]"; expected "Union[QuantumCircuit, List[QuantumCircuit], Instruction, List[Instruction], None]"  [arg-type]
qiskit/circuit/library/n_local/two_local.py:206: error: Argument "entanglement" to "__init__" of "NLocal" has incompatible type "Union[str, List[List[int]], Callable[[int], List[int]]]"; expected "Union[List[int], List[List[int]], None]"  [arg-type]
qiskit/circuit/library/standard_gates/p.py:108: error: Incompatible types in assignment (expression has type "MCPhaseGate", variable has type "CPhaseGate")  [assignment]
qiskit/circuit/library/standard_gates/u1.py:116: error: Incompatible types in assignment (expression has type "MCU1Gate", variable has type "CU1Gate")  [assignment]
qiskit/circuit/library/standard_gates/u3.py:99: error: "CU3Gate" gets multiple values for keyword argument "label"  [misc]
qiskit/circuit/library/standard_gates/u3.py:99: error: "CU3Gate" gets multiple values for keyword argument "ctrl_state"  [misc]
qiskit/circuit/library/standard_gates/x.py:901: error: Unexpected keyword argument "label" for "__new__" of "object"  [call-arg]
/usr/local/lib/python3.9/site-packages/mypy/typeshed/stdlib/builtins.pyi:88: note: "__new__" of "object" defined here
qiskit/circuit/library/standard_gates/x.py:901: error: Unexpected keyword argument "ctrl_state" for "__new__" of "object"  [call-arg]
/usr/local/lib/python3.9/site-packages/mypy/typeshed/stdlib/builtins.pyi:88: note: "__new__" of "object" defined here
qiskit/circuit/library/standard_gates/x.py:903: error: Cannot access "__init__" directly  [misc]
qiskit/circuit/library/standard_gates/x.py:1004: error: Unexpected keyword argument "label" for "__new__" of "object"  [call-arg]
/usr/local/lib/python3.9/site-packages/mypy/typeshed/stdlib/builtins.pyi:88: note: "__new__" of "object" defined here
qiskit/circuit/library/standard_gates/x.py:1004: error: Unexpected keyword argument "ctrl_state" for "__new__" of "object"  [call-arg]
/usr/local/lib/python3.9/site-packages/mypy/typeshed/stdlib/builtins.pyi:88: note: "__new__" of "object" defined here
qiskit/circuit/library/standard_gates/x.py:1006: error: Cannot access "__init__" directly  [misc]
qiskit/circuit/parameterexpression.py:541: error: Cannot assign multiple types to name "ParameterValueType" without an explicit "Type[...]" annotation  [misc]
qiskit/circuit/quantumcircuit.py:220: error: Argument 1 to "int" has incompatible type "Union[Register, int, Sequence[Bit]]"; expected "Union[str, bytes, array[Any], mmap, _CData, PickleBuffer, SupportsInt, SupportsIndex, SupportsTrunc]"  [arg-type]
qiskit/circuit/quantumcircuit.py:230: error: Argument 1 to "int" has incompatible type "Union[Register, int, Sequence[Bit]]"; expected "Union[str, bytes, array[Any], mmap, _CData, PickleBuffer, SupportsInt, SupportsIndex, SupportsTrunc]"  [arg-type]
qiskit/circuit/quantumcircuit.py:891: error: Item "Instruction" of "Union[QuantumCircuit, Instruction]" has no attribute "to_gate"  [union-attr]
qiskit/circuit/quantumcircuit.py:893: error: Item "Instruction" of "Union[QuantumCircuit, Any, Instruction]" has no attribute "to_instruction"  [union-attr]
qiskit/circuit/quantumcircuit.py:903: error: Argument 2 to "CircuitInstruction" has incompatible type "Sequence[Union[Qubit, int]]"; expected "Iterable[Qubit]"  [arg-type]
qiskit/circuit/quantumcircuit.py:903: error: Argument 3 to "CircuitInstruction" has incompatible type "Sequence[Union[Clbit, int]]"; expected "Iterable[Clbit]"  [arg-type]
qiskit/circuit/quantumcircuit.py:946: error: Argument 1 to "update" of "MutableMapping" has incompatible type "Dict[Clbit, Clbit]"; expected "SupportsKeysAndGetItem[Qubit, Qubit]"  [arg-type]
qiskit/circuit/quantumcircuit.py:961: error: Argument 3 to "CircuitInstruction" has incompatible type "List[Qubit]"; expected "Iterable[Clbit]"  [arg-type]
qiskit/circuit/quantumcircuit.py:1409: error: Unsupported operand types for + ("List[QuantumRegister]" and "List[ClassicalRegister]")  [operator]
qiskit/circuit/quantumcircuit.py:1586: error: Unsupported operand types for + ("List[QuantumRegister]" and "List[ClassicalRegister]")  [operator]
qiskit/circuit/quantumcircuit.py:1587: error: Unsupported operand types for + ("List[QuantumRegister]" and "List[ClassicalRegister]")  [operator]
qiskit/circuit/quantumcircuit.py:1703: error: Unsupported operand types for + ("List[QuantumRegister]" and "List[ClassicalRegister]")  [operator]
qiskit/circuit/quantumcircuit.py:1973: error: Unsupported operand types for + ("List[Qubit]" and "List[Clbit]")  [operator]
qiskit/circuit/quantumcircuit.py:2094: error: Unsupported operand types for + ("List[Qubit]" and "List[Clbit]")  [operator]
qiskit/circuit/quantumcircuit.py:2109: error: Unsupported operand types for + ("Tuple[Qubit, ...]" and "Tuple[Clbit, ...]")  [operator]
qiskit/circuit/quantumcircuit.py:2650: error: Argument 1 to "len" has incompatible type "Union[ParameterExpression, float]"; expected "Sized"  [arg-type]
qiskit/circuit/quantumcircuit.py:2654: error: Argument 1 to "len" has incompatible type "Union[ParameterExpression, float]"; expected "Sized"  [arg-type]
qiskit/circuit/quantumcircuit.py:2656: error: No overload variant of "zip" matches argument types "<subclass of "Parameter" and "ParameterVector">", "Union[ParameterExpression, float]"  [call-overload]
qiskit/circuit/quantumcircuit.py:2656: note: Possible overload variants:
qiskit/circuit/quantumcircuit.py:2656: note:     def [_T_co, _T1] __new__(cls, Iterable[_T1]) -> zip[Tuple[_T1]]
qiskit/circuit/quantumcircuit.py:2656: note:     def [_T_co, _T1, _T2] __new__(cls, Iterable[_T1], Iterable[_T2]) -> zip[Tuple[_T1, _T2]]
qiskit/circuit/quantumcircuit.py:2656: note:     def [_T_co, _T1, _T2, _T3] __new__(cls, Iterable[_T1], Iterable[_T2], Iterable[_T3]) -> zip[Tuple[_T1, _T2, _T3]]
qiskit/circuit/quantumcircuit.py:2656: note:     def [_T_co, _T1, _T2, _T3, _T4] __new__(cls, Iterable[_T1], Iterable[_T2], Iterable[_T3], Iterable[_T4]) -> zip[Tuple[_T1, _T2, _T3, _T4]]
qiskit/circuit/quantumcircuit.py:2656: note:     def [_T_co, _T1, _T2, _T3, _T4, _T5] __new__(cls, Iterable[_T1], Iterable[_T2], Iterable[_T3], Iterable[_T4], Iterable[_T5]) -> zip[Tuple[_T1, _T2, _T3, _T4, _T5]]
qiskit/circuit/quantumcircuit.py:2656: note:     def [_T_co] __new__(cls, Iterable[Any], Iterable[Any], Iterable[Any], Iterable[Any], Iterable[Any], Iterable[Any], *iterables: Iterable[Any]) -> zip[Tuple[Any, ...]]
qiskit/circuit/quantumcircuit.py:2828: error: Incompatible types in assignment (expression has type "Union[Qubit, QuantumRegister, int, slice, Sequence[Union[Qubit, int]]]", variable has type "Qubit")  [assignment]
qiskit/circuit/quantumcircuit.py:2995: error: Unsupported left operand type for + ("Sequence[Union[Qubit, QuantumRegister, int, slice, Sequence[Union[Qubit, int]]]]")  [operator]
qiskit/circuit/quantumcircuit.py:3682: error: Unsupported left operand type for + ("Sequence[Union[Qubit, QuantumRegister, int, slice, Sequence[Union[Qubit, int]]]]")  [operator]
qiskit/circuit/quantumcircuit.py:3975: error: Argument 1 to "qbit_argument_conversion" of "QuantumCircuit" has incompatible type "Union[Qubit, QuantumRegister, int, slice, Sequence[Union[Qubit, QuantumRegister, int, slice, Sequence[Union[Qubit, int]]]]]"; expected "Union[Qubit, QuantumRegister, int, slice, Sequence[Union[Qubit, int]]]"  [arg-type]
qiskit/circuit/quantumcircuit.py:3992: error: List item 0 has incompatible type "Union[Qubit, QuantumRegister, int, slice, Sequence[Union[Qubit, QuantumRegister, int, slice, Sequence[Union[Qubit, int]]]]]"; expected "Union[Qubit, QuantumRegister, int, slice, Sequence[Union[Qubit, int]]]"  [list-item]
qiskit/circuit/quantumcircuit.py:3994: error: Argument 1 to "len" has incompatible type "Union[Qubit, QuantumRegister, int, slice, Sequence[Union[Qubit, QuantumRegister, int, slice, Sequence[Union[Qubit, int]]]]]"; expected "Sized"  [arg-type]
qiskit/circuit/quantumcircuit.py:3995: error: Argument 1 to "len" has incompatible type "Union[Qubit, QuantumRegister, int, slice, Sequence[Union[Qubit, QuantumRegister, int, slice, Sequence[Union[Qubit, int]]]]]"; expected "Sized"  [arg-type]
qiskit/circuit/quantumcircuit.py:3998: error: Value of type "Union[Qubit, QuantumRegister, int, slice, Sequence[Union[Qubit, QuantumRegister, int, slice, Sequence[Union[Qubit, int]]]]]" is not indexable  [index]
qiskit/circuit/quantumcircuit.py:4002: error: Unsupported left operand type for + ("Sequence[Union[Qubit, QuantumRegister, int, slice, Sequence[Union[Qubit, int]]]]")  [operator]

This is a large module with various errors. qiskit/circuit/quantumcircuit.py has multiple errors due to summing list of different types, e.g., qiskit/circuit/quantumcircuit.py:1409: error: Unsupported operand types for + ("List[QuantumRegister]" and "List[ClassicalRegister]").
There is another chunk of missing attributes, which maybe should be ignored?

@Randl Randl requested a review from a team as a code owner June 29, 2022 08:08
@qiskit-bot
Copy link
Collaborator

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:

@@ -1252,6 +1256,7 @@ def append(
else:
operation = instruction
# Convert input to instruction
# TODO: define type SupportsInstruction?
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The checks for hasattr(operation, "to_instruction") appear in muliple places. We may want to define type which says that class can be converted to Instruction instead

@HuangJunye HuangJunye added the Community PR PRs from contributors that are not 'members' of the Qiskit repo label Jun 29, 2022
@kevinsung
Copy link
Contributor

Hi @Randl , sorry for the delay, but we are starting an earnest effort to review your mypy PRs. If you don't mind, could you update this PR and post the mypy output before and after your changes?

@coveralls
Copy link

coveralls commented Feb 8, 2023

Pull Request Test Coverage Report for Build 4534094007

  • 215 of 217 (99.08%) changed or added relevant lines in 40 files are covered.
  • 3 unchanged lines in 3 files lost coverage.
  • Overall coverage increased (+0.003%) to 85.084%

Changes Missing Coverage Covered Lines Changed/Added Lines %
qiskit/circuit/library/n_local/n_local.py 25 27 92.59%
Files with Coverage Reduction New Missed Lines %
crates/accelerate/src/vf2_layout.rs 1 86.44%
qiskit/circuit/library/n_local/n_local.py 1 84.47%
qiskit/transpiler/passes/synthesis/unitary_synthesis.py 1 94.68%
Totals Coverage Status
Change from base Build 4533541029: 0.003%
Covered Lines: 67834
Relevant Lines: 79726

💛 - Coveralls

@Randl Randl force-pushed the mypy-13 branch 3 times, most recently from 6a5485c to ad5fe08 Compare February 8, 2023 22:56
@Randl
Copy link
Contributor Author

Randl commented Feb 8, 2023

@kevinsung I've updated the PR and rebased on master.

mypy output after
out_after.log:qiskit/circuit/classicalfunction/classical_function_visitor.py:152: error: "expr" has no attribute "id"  [attr-defined]
out_after.log:qiskit/circuit/classicalfunction/classical_function_visitor.py:153: error: "expr" has no attribute "id"  [attr-defined]
out_after.log:qiskit/circuit/parameterexpression.py:563: error: Cannot assign multiple types to name "ParameterValueType" without an explicit "Type[...]" annotation  [misc]
out_after.log:qiskit/circuit/quantumcircuit.py:246: error: Argument 1 to "int" has incompatible type "Union[Register, int, Sequence[Bit]]"; expected "Union[str, bytes, bytearray, memoryview, array[Any], mmap, _CData, PickleBuffer, SupportsInt, SupportsIndex, SupportsTrunc]"  [arg-type]
out_after.log:qiskit/circuit/quantumcircuit.py:909: error: Argument 1 to "qbit_argument_conversion" of "QuantumCircuit" has incompatible type "Union[Qubit, QuantumRegister, int, slice, Sequence[Union[Qubit, QuantumRegister, int, slice, Sequence[Union[Qubit, int]]]]]"; expected "Union[Qubit, QuantumRegister, int, slice, Sequence[Union[Qubit, int]]]"  [arg-type]
out_after.log:qiskit/circuit/quantumcircuit.py:920: error: Argument 1 to "cbit_argument_conversion" of "QuantumCircuit" has incompatible type "Union[Clbit, ClassicalRegister, int, slice, Sequence[Union[Clbit, ClassicalRegister, int, slice, Sequence[Union[Clbit, int]]]]]"; expected "Union[Clbit, ClassicalRegister, int, slice, Sequence[Union[Clbit, int]]]"  [arg-type]
out_after.log:qiskit/circuit/quantumcircuit.py:926: error: Argument 1 to "cbit_argument_conversion" of "QuantumCircuit" has incompatible type "Union[Clbit, ClassicalRegister, int, slice, Sequence[Union[Clbit, ClassicalRegister, int, slice, Sequence[Union[Clbit, int]]]]]"; expected "Union[Clbit, ClassicalRegister, int, slice, Sequence[Union[Clbit, int]]]"  [arg-type]
out_after.log:qiskit/circuit/quantumcircuit.py:931: error: List comprehension has incompatible type List[Union[Qubit, Clbit]]; expected List[Qubit]  [misc]
out_after.log:qiskit/circuit/quantumcircuit.py:932: error: List comprehension has incompatible type List[Union[Qubit, Clbit]]; expected List[Clbit]  [misc]
out_after.log:qiskit/circuit/quantumcircuit.py:961: error: Cannot call function of unknown type  [operator]
out_after.log:qiskit/circuit/quantumcircuit.py:1137: error: Incompatible return value type (got "List[Bit]", expected "List[Qubit]")  [return-value]
out_after.log:qiskit/circuit/quantumcircuit.py:1152: error: Incompatible return value type (got "List[Bit]", expected "List[Clbit]")  [return-value]
out_after.log:qiskit/circuit/quantumcircuit.py:1232: error: Incompatible types in assignment (expression has type "Operation", variable has type "Instruction")  [assignment]
out_after.log:qiskit/circuit/quantumcircuit.py:1301: error: Overloaded function implementation does not accept all possible arguments of signature 1  [misc]
out_after.log:qiskit/circuit/quantumcircuit.py:1301: error: Overloaded function implementation does not accept all possible arguments of signature 2  [misc]
out_after.log:qiskit/circuit/quantumcircuit.py:1381: error: Argument 1 to "QuantumRegister" has incompatible type "Union[Register, int, Sequence[Bit]]"; expected "Optional[int]"  [arg-type]
out_after.log:qiskit/circuit/quantumcircuit.py:1387: error: Argument 1 to "QuantumRegister" has incompatible type "Union[Register, int, Sequence[Bit]]"; expected "Optional[int]"  [arg-type]
out_after.log:qiskit/circuit/quantumcircuit.py:1391: error: Argument 1 to "ClassicalRegister" has incompatible type "Union[Register, int, Sequence[Bit]]"; expected "Optional[int]"  [arg-type]
out_after.log:qiskit/circuit/quantumcircuit.py:1572: error: Argument 1 to "Decompose" has incompatible type "Union[Type[Gate], Sequence[Type[Gate]], Sequence[str], str, None]"; expected "Union[Type[Gate], List[Type[Gate]], List[str], str, None]"  [arg-type]
out_after.log:qiskit/circuit/quantumcircuit.py:1672: error: "object" has no attribute "__iter__"; maybe "__str__" or "__dir__"? (not iterable)  [attr-defined]
out_after.log:qiskit/circuit/quantumcircuit.py:1674: error: Argument 2 to "_make_unique" has incompatible type "Dict[str, Union[QuantumRegister, ClassicalRegister]]"; expected "AbstractSet[str]"  [arg-type]
out_after.log:qiskit/circuit/quantumcircuit.py:1966: error: Unsupported operand types for + ("List[Qubit]" and "List[Clbit]")  [operator]
out_after.log:qiskit/circuit/quantumcircuit.py:2089: error: Unsupported operand types for + ("List[Qubit]" and "List[Clbit]")  [operator]
out_after.log:qiskit/circuit/quantumcircuit.py:2104: error: Unsupported operand types for + ("Tuple[Qubit, ...]" and "Tuple[Clbit, ...]")  [operator]
out_after.log:qiskit/circuit/quantumcircuit.py:2702: error: Argument 1 to "len" has incompatible type "Union[ParameterExpression, float]"; expected "Sized"  [arg-type]
out_after.log:qiskit/circuit/quantumcircuit.py:2706: error: Argument 1 to "len" has incompatible type "Union[ParameterExpression, float]"; expected "Sized"  [arg-type]
out_after.log:qiskit/circuit/quantumcircuit.py:2708: error: No overload variant of "zip" matches argument types "<subclass of "Parameter" and "ParameterVector">", "Union[ParameterExpression, float]"  [call-overload]
out_after.log:qiskit/circuit/quantumcircuit.py:2708: note: Possible overload variants:
out_after.log:qiskit/circuit/quantumcircuit.py:2708: note:     def [_T_co, _T1] __new__(cls, Iterable[_T1], /, *, strict: bool = ...) -> zip[Tuple[_T1]]
out_after.log:qiskit/circuit/quantumcircuit.py:2708: note:     def [_T_co, _T1, _T2] __new__(cls, Iterable[_T1], Iterable[_T2], /, *, strict: bool = ...) -> zip[Tuple[_T1, _T2]]
out_after.log:qiskit/circuit/quantumcircuit.py:2708: note:     def [_T_co, _T1, _T2, _T3] __new__(cls, Iterable[_T1], Iterable[_T2], Iterable[_T3], /, *, strict: bool = ...) -> zip[Tuple[_T1, _T2, _T3]]
out_after.log:qiskit/circuit/quantumcircuit.py:2708: note:     def [_T_co, _T1, _T2, _T3, _T4] __new__(cls, Iterable[_T1], Iterable[_T2], Iterable[_T3], Iterable[_T4], /, *, strict: bool = ...) -> zip[Tuple[_T1, _T2, _T3, _T4]]
out_after.log:qiskit/circuit/quantumcircuit.py:2708: note:     def [_T_co, _T1, _T2, _T3, _T4, _T5] __new__(cls, Iterable[_T1], Iterable[_T2], Iterable[_T3], Iterable[_T4], Iterable[_T5], /, *, strict: bool = ...) -> zip[Tuple[_T1, _T2, _T3, _T4, _T5]]
out_after.log:qiskit/circuit/quantumcircuit.py:2708: note:     def [_T_co] __new__(cls, Iterable[Any], Iterable[Any], Iterable[Any], Iterable[Any], Iterable[Any], Iterable[Any], /, *iterables: Iterable[Any], strict: bool = ...) -> zip[Tuple[Any, ...]]
out_after.log:qiskit/circuit/quantumcircuit.py:2884: error: Incompatible types in assignment (expression has type "Union[Qubit, QuantumRegister, int, slice, Sequence[Union[Qubit, int]]]", variable has type "Qubit")  [assignment]
out_after.log:qiskit/circuit/quantumcircuit.py:3051: error: Unsupported left operand type for + ("Sequence[Union[Qubit, QuantumRegister, int, slice, Sequence[Union[Qubit, int]]]]")  [operator]
out_after.log:qiskit/circuit/quantumcircuit.py:3900: error: Argument 1 to "qbit_argument_conversion" of "QuantumCircuit" has incompatible type "Union[Qubit, QuantumRegister, int, slice, Sequence[Union[Qubit, QuantumRegister, int, slice, Sequence[Union[Qubit, int]]]]]"; expected "Union[Qubit, QuantumRegister, int, slice, Sequence[Union[Qubit, int]]]"  [arg-type]
out_after.log:qiskit/circuit/quantumcircuit.py:3930: error: Unsupported left operand type for + ("Sequence[Union[Qubit, QuantumRegister, int, slice, Sequence[Union[Qubit, int]]]]")  [operator]
out_after.log:qiskit/circuit/add_control.py:126: error: Argument 1 to "mct" of "QuantumCircuit" has incompatible type "QuantumRegister"; expected "Sequence[Union[Qubit, QuantumRegister, int, slice, Sequence[Union[Qubit, int]]]]"  [arg-type]
out_after.log:qiskit/circuit/add_control.py:128: error: "QuantumCircuit" has no attribute "mcrx"; maybe "mcx" or "crx"?  [attr-defined]
out_after.log:qiskit/circuit/add_control.py:135: error: "QuantumCircuit" has no attribute "mcry"; maybe "cry"?  [attr-defined]
out_after.log:qiskit/circuit/add_control.py:144: error: "QuantumCircuit" has no attribute "mcrz"; maybe "crz"?  [attr-defined]
out_after.log:qiskit/circuit/add_control.py:174: error: "QuantumCircuit" has no attribute "mcrx"; maybe "mcx" or "crx"?  [attr-defined]
out_after.log:qiskit/circuit/add_control.py:178: error: "QuantumCircuit" has no attribute "mcry"; maybe "cry"?  [attr-defined]
out_after.log:qiskit/circuit/add_control.py:186: error: "QuantumCircuit" has no attribute "mcrz"; maybe "crz"?  [attr-defined]
out_after.log:qiskit/circuit/add_control.py:190: error: "QuantumCircuit" has no attribute "mcrz"; maybe "crz"?  [attr-defined]
out_after.log:qiskit/circuit/add_control.py:193: error: "QuantumCircuit" has no attribute "mcry"; maybe "cry"?  [attr-defined]
out_after.log:qiskit/circuit/add_control.py:200: error: "QuantumCircuit" has no attribute "mcrz"; maybe "crz"?  [attr-defined]
out_after.log:qiskit/circuit/add_control.py:205: error: Argument 1 to "mcx" of "QuantumCircuit" has incompatible type "QuantumRegister"; expected "Sequence[Union[Qubit, QuantumRegister, int, slice, Sequence[Union[Qubit, int]]]]"  [arg-type]
out_after.log:qiskit/circuit/add_control.py:220: error: Unsupported operand types for | ("int" and "str")  [operator]
out_after.log:qiskit/circuit/add_control.py:220: note: Right operand is of type "Union[str, int, None]"
out_after.log:qiskit/circuit/commutation_checker.py:109: error: "Operation" has no attribute "is_parameterized"  [attr-defined]
out_after.log:qiskit/circuit/commutation_checker.py:126: error: "Operation" has no attribute "params"  [attr-defined]
out_after.log:qiskit/circuit/commutation_checker.py:127: error: "Operation" has no attribute "params"  [attr-defined]
out_after.log:qiskit/circuit/controlledgate.py:103: error: Incompatible types in assignment (expression has type "Union[int, str, None]", variable has type "int")  [assignment]
out_after.log:qiskit/circuit/controlledgate.py:126: error: Incompatible return value type (got "QuantumCircuit", expected "List[Any]")  [return-value]
out_after.log:qiskit/circuit/library/arithmetic/piecewise_chebyshev.py:262: error: Item "float" of "Union[float, Callable[[int], float]]" has no attribute "__code__"  [union-attr]
out_after.log:qiskit/circuit/library/blueprintcircuit.py:89: error: Read-only property cannot override read-write property  [misc]
out_after.log:qiskit/circuit/library/boolean_logic/quantum_and.py:94: error: Argument 3 to "mcx" of "QuantumCircuit" has incompatible type "Union[Any, List[Bit]]"; expected "Union[Union[Qubit, QuantumRegister, int, slice, Sequence[Union[Qubit, int]]], Sequence[Union[Qubit, QuantumRegister, int, slice, Sequence[Union[Qubit, int]]]], None]"  [arg-type]
out_after.log:qiskit/circuit/library/boolean_logic/quantum_or.py:95: error: Argument 3 to "mcx" of "QuantumCircuit" has incompatible type "Union[Any, List[Bit]]"; expected "Union[Union[Qubit, QuantumRegister, int, slice, Sequence[Union[Qubit, int]]], Sequence[Union[Qubit, QuantumRegister, int, slice, Sequence[Union[Qubit, int]]]], None]"  [arg-type]
out_after.log:qiskit/circuit/library/data_preparation/pauli_feature_map.py:140: error: Argument "entanglement" to "__init__" of "NLocal" has incompatible type "Union[str, List[List[int]], Callable[[int], List[int]]]"; expected "Union[List[int], List[List[int]], None]"  [arg-type]
out_after.log:qiskit/circuit/library/data_preparation/pauli_feature_map.py:151: error: Return type "Optional[List[Parameter]]" of "_parameter_generator" incompatible with return type "Optional[Parameter]" in supertype "NLocal"  [override]
out_after.log:qiskit/circuit/library/data_preparation/state_preparation.py:103: error: Argument 3 to "__init__" of "Gate" has incompatible type "Union[List[int], str, List[Any], Statevector]"; expected "List[Any]"  [arg-type]
out_after.log:qiskit/circuit/library/evolved_operator_ansatz.py:61: error: Argument "parameter_prefix" to "__init__" of "NLocal" has incompatible type "Union[str, List[str]]"; expected "str"  [arg-type]
out_after.log:qiskit/circuit/library/evolved_operator_ansatz.py:87: error: Read-only property cannot override read-write property  [misc]
out_after.log:qiskit/circuit/library/fourier_checking.py:82: error: Argument 1 to "QuantumCircuit" has incompatible type "float"; expected "Union[Register, int, Sequence[Bit]]"  [arg-type]
out_after.log:qiskit/circuit/library/fourier_checking.py:86: error: "QuantumCircuit" has no attribute "diagonal"  [attr-defined]
out_after.log:qiskit/circuit/library/fourier_checking.py:90: error: "QuantumCircuit" has no attribute "diagonal"  [attr-defined]
out_after.log:qiskit/circuit/library/generalized_gates/diagonal.py:110: error: "QuantumCircuit" has no attribute "ucrz"; maybe "crz"?  [attr-defined]
out_after.log:qiskit/circuit/library/generalized_gates/mcmt.py:210: error: Missing return statement  [return]
out_after.log:qiskit/circuit/library/generalized_gates/mcmt.py:234: error: Return value expected  [return-value]
out_after.log:qiskit/circuit/library/grover_operator.py:308: error: Argument 3 to "mcx" of "QuantumCircuit" has incompatible type "Union[Any, List[Bit]]"; expected "Union[Union[Qubit, QuantumRegister, int, slice, Sequence[Union[Qubit, int]]], Sequence[Union[Qubit, QuantumRegister, int, slice, Sequence[Union[Qubit, int]]]], None]"  [arg-type]
out_after.log:qiskit/circuit/library/n_local/efficient_su2.py:133: error: Argument "rotation_blocks" to "__init__" of "TwoLocal" has incompatible type "Union[str, type, Instruction, QuantumCircuit, List[Union[str, type, Instruction, QuantumCircuit]]]"; expected "Union[str, List[str], type, List[type], QuantumCircuit, List[QuantumCircuit], None]"  [arg-type]
out_after.log:qiskit/circuit/library/n_local/efficient_su2.py:145: error: Read-only property cannot override read-write property  [misc]
out_after.log:qiskit/circuit/library/n_local/excitation_preserving.py:160: error: Read-only property cannot override read-write property  [misc]
out_after.log:qiskit/circuit/library/n_local/n_local.py:240: error: Incompatible types in assignment (expression has type "List[Union[QuantumCircuit, Instruction]]", variable has type "Union[QuantumCircuit, List[QuantumCircuit], Instruction, List[Instruction]]")  [assignment]
out_after.log:qiskit/circuit/library/n_local/n_local.py:266: error: Incompatible types in assignment (expression has type "List[Union[QuantumCircuit, Instruction]]", variable has type "Union[QuantumCircuit, List[QuantumCircuit], Instruction, List[Instruction]]")  [assignment]
out_after.log:qiskit/circuit/library/n_local/n_local.py:740: error: Incompatible types in assignment (expression has type "List[Union[List[int], List[List[int]]]]", variable has type "Union[List[int], str, List[List[int]], None]")  [assignment]
out_after.log:qiskit/circuit/library/n_local/n_local.py:953: error: Incompatible types in assignment (expression has type "Instruction", variable has type "Gate")  [assignment]
out_after.log:qiskit/circuit/library/n_local/n_local.py:973: error: List comprehension has incompatible type List[ParameterExpression]; expected List[Parameter]  [misc]
out_after.log:qiskit/circuit/library/n_local/pauli_two_design.py:97: error: List item 0 has incompatible type "RYGate"; expected "QuantumCircuit"  [list-item]
out_after.log:qiskit/circuit/library/n_local/qaoa_ansatz.py:145: error: Read-only property cannot override read-write property  [misc]
out_after.log:qiskit/circuit/library/n_local/qaoa_ansatz.py:248: error: Read-only property cannot override read-write property  [misc]
out_after.log:qiskit/circuit/library/n_local/real_amplitudes.py:172: error: Read-only property cannot override read-write property  [misc]
out_after.log:qiskit/circuit/library/n_local/two_local.py:215: error: Argument "rotation_blocks" to "__init__" of "NLocal" has incompatible type "Union[str, List[str], type, List[type], QuantumCircuit, List[QuantumCircuit], None]"; expected "Union[QuantumCircuit, List[QuantumCircuit], Instruction, List[Instruction], None]"  [arg-type]
out_after.log:qiskit/circuit/library/n_local/two_local.py:216: error: Argument "entanglement_blocks" to "__init__" of "NLocal" has incompatible type "Union[str, List[str], type, List[type], QuantumCircuit, List[QuantumCircuit], None]"; expected "Union[QuantumCircuit, List[QuantumCircuit], Instruction, List[Instruction], None]"  [arg-type]
out_after.log:qiskit/circuit/library/n_local/two_local.py:217: error: Argument "entanglement" to "__init__" of "NLocal" has incompatible type "Union[str, List[List[int]], Callable[[int], List[int]]]"; expected "Union[List[int], List[List[int]], None]"  [arg-type]
out_after.log:qiskit/circuit/library/standard_gates/p.py:117: error: "Gate" has no attribute "base_gate"  [attr-defined]
out_after.log:qiskit/circuit/library/standard_gates/u1.py:138: error: "Gate" has no attribute "base_gate"  [attr-defined]
out_after.log:qiskit/circuit/library/standard_gates/u3.py:117: error: "CU3Gate" gets multiple values for keyword argument "label"  [misc]
out_after.log:qiskit/circuit/library/standard_gates/u3.py:117: error: "CU3Gate" gets multiple values for keyword argument "ctrl_state"  [misc]
out_after.log:qiskit/circuit/library/standard_gates/x.py:936: error: Unexpected keyword argument "label" for "__new__" of "object"  [call-arg]
out_after.log:qiskit/circuit/library/standard_gates/x.py:936: error: Unexpected keyword argument "ctrl_state" for "__new__" of "object"  [call-arg]
out_after.log:qiskit/circuit/library/standard_gates/x.py:938: error: Accessing "__init__" on an instance is unsound, since instance.__init__ could be from an incompatible subclass  [misc]
out_after.log:qiskit/circuit/library/standard_gates/x.py:1039: error: Unexpected keyword argument "label" for "__new__" of "object"  [call-arg]
out_after.log:qiskit/circuit/library/standard_gates/x.py:1039: error: Unexpected keyword argument "ctrl_state" for "__new__" of "object"  [call-arg]
out_after.log:qiskit/circuit/library/standard_gates/x.py:1041: error: Accessing "__init__" on an instance is unsound, since instance.__init__ could be from an incompatible subclass  [misc]
There are some common errors left: bunch of missing attributes for `QuantumCircuit`, e.g.,
qiskit/circuit/add_control.py:178: error: "QuantumCircuit" has no attribute "mcry"; maybe "cry"?  [attr-defined]

confusion between Bit/Qubit/Clbit/QubitSpecifier, e.g.,

qiskit/circuit/quantumcircuit.py:931: error: List comprehension has incompatible type List[Union[Qubit, Clbit]]; expected List[Qubit]  [misc]

some dark magic happening in standard_gates:
https://github.com/Qiskit/qiskit-terra/blob/26d155495c058bb49aef26c5acd0fd7b917a9770/qiskit/circuit/library/standard_gates/x.py#L1037-L1042

mypy output before
out_before.log:qiskit/circuit/classicalfunction/classical_function_visitor.py:152: error: "expr" has no attribute "id"  [attr-defined]
out_before.log:qiskit/circuit/classicalfunction/classical_function_visitor.py:153: error: "expr" has no attribute "id"  [attr-defined]
out_before.log:qiskit/circuit/parameterexpression.py:62: error: Incompatible types in assignment (expression has type "Dict[Any, Any]", variable has type "None")  [assignment]
out_before.log:qiskit/circuit/parameterexpression.py:282: error: Incompatible types in assignment (expression has type "Dict[Any, Any]", variable has type "None")  [assignment]
out_before.log:qiskit/circuit/parameterexpression.py:561: error: Cannot assign multiple types to name "ParameterValueType" without an explicit "Type[...]" annotation  [misc]
out_before.log:qiskit/circuit/quantumcircuit.py:236: error: Argument 1 to "int" has incompatible type "Union[Register, int, Sequence[Bit]]"; expected "Union[str, bytes, bytearray, memoryview, array[Any], mmap, _CData, PickleBuffer, SupportsInt, SupportsIndex, SupportsTrunc]"  [arg-type]
out_before.log:qiskit/circuit/quantumcircuit.py:246: error: Argument 1 to "int" has incompatible type "Union[Register, int, Sequence[Bit]]"; expected "Union[str, bytes, bytearray, memoryview, array[Any], mmap, _CData, PickleBuffer, SupportsInt, SupportsIndex, SupportsTrunc]"  [arg-type]
out_before.log:qiskit/circuit/quantumcircuit.py:262: error: Need type annotation for "_data" (hint: "_data: List[<type>] = ...")  [var-annotated]
out_before.log:qiskit/circuit/quantumcircuit.py:271: error: Need type annotation for "_control_flow_scopes" (hint: "_control_flow_scopes: List[<type>] = ...")  [var-annotated]
out_before.log:qiskit/circuit/quantumcircuit.py:273: error: Need type annotation for "qregs" (hint: "qregs: List[<type>] = ...")  [var-annotated]
out_before.log:qiskit/circuit/quantumcircuit.py:274: error: Need type annotation for "cregs" (hint: "cregs: List[<type>] = ...")  [var-annotated]
out_before.log:qiskit/circuit/quantumcircuit.py:275: error: Need type annotation for "_qubits" (hint: "_qubits: List[<type>] = ...")  [var-annotated]
out_before.log:qiskit/circuit/quantumcircuit.py:276: error: Need type annotation for "_clbits" (hint: "_clbits: List[<type>] = ...")  [var-annotated]
out_before.log:qiskit/circuit/quantumcircuit.py:282: error: Need type annotation for "_qubit_indices" (hint: "_qubit_indices: Dict[<type>, <type>] = ...")  [var-annotated]
out_before.log:qiskit/circuit/quantumcircuit.py:283: error: Need type annotation for "_clbit_indices" (hint: "_clbit_indices: Dict[<type>, <type>] = ...")  [var-annotated]
out_before.log:qiskit/circuit/quantumcircuit.py:285: error: Need type annotation for "_ancillas" (hint: "_ancillas: List[<type>] = ...")  [var-annotated]
out_before.log:qiskit/circuit/quantumcircuit.py:286: error: Need type annotation for "_calibrations"  [var-annotated]
out_before.log:qiskit/circuit/quantumcircuit.py:389: error: Name "data" already defined on line 358  [no-redef]
out_before.log:qiskit/circuit/quantumcircuit.py:389: error: "Callable[[QuantumCircuit], QuantumCircuitData]" has no attribute "setter"  [attr-defined]
out_before.log:qiskit/circuit/quantumcircuit.py:886: error: Argument 2 to "append" of "QuantumCircuit" has incompatible type "Union[Qubit, QuantumRegister, int, slice, Sequence[Union[Qubit, QuantumRegister, int, slice, Sequence[Union[Qubit, int]]]]]"; expected "Optional[Sequence[Union[Qubit, QuantumRegister, int, slice, Sequence[Union[Qubit, int]]]]]"  [arg-type]
out_before.log:qiskit/circuit/quantumcircuit.py:886: error: Argument 3 to "append" of "QuantumCircuit" has incompatible type "Union[Clbit, ClassicalRegister, int, slice, Sequence[Union[Clbit, ClassicalRegister, int, slice, Sequence[Union[Clbit, int]]]]]"; expected "Optional[Sequence[Union[Clbit, ClassicalRegister, int, slice, Sequence[Union[Clbit, int]]]]]"  [arg-type]
out_before.log:qiskit/circuit/quantumcircuit.py:890: error: Argument "qargs" to "append" of "QuantumCircuit" has incompatible type "Union[Qubit, QuantumRegister, int, slice, Sequence[Union[Qubit, QuantumRegister, int, slice, Sequence[Union[Qubit, int]]]]]"; expected "Optional[Sequence[Union[Qubit, QuantumRegister, int, slice, Sequence[Union[Qubit, int]]]]]"  [arg-type]
out_before.log:qiskit/circuit/quantumcircuit.py:890: error: Argument "cargs" to "append" of "QuantumCircuit" has incompatible type "Union[Clbit, ClassicalRegister, int, slice, Sequence[Union[Clbit, ClassicalRegister, int, slice, Sequence[Union[Clbit, int]]]]]"; expected "Optional[Sequence[Union[Clbit, ClassicalRegister, int, slice, Sequence[Union[Clbit, int]]]]]"  [arg-type]
out_before.log:qiskit/circuit/quantumcircuit.py:901: error: Need type annotation for "edge_map" (hint: "edge_map: Dict[<type>, <type>] = ...")  [var-annotated]
out_before.log:qiskit/circuit/quantumcircuit.py:905: error: Argument 1 to "qbit_argument_conversion" of "QuantumCircuit" has incompatible type "Union[Qubit, QuantumRegister, int, slice, Sequence[Union[Qubit, QuantumRegister, int, slice, Sequence[Union[Qubit, int]]]]]"; expected "Union[Qubit, QuantumRegister, int, slice, Sequence[Union[Qubit, int]]]"  [arg-type]
out_before.log:qiskit/circuit/quantumcircuit.py:916: error: Argument 1 to "cbit_argument_conversion" of "QuantumCircuit" has incompatible type "Union[Clbit, ClassicalRegister, int, slice, Sequence[Union[Clbit, ClassicalRegister, int, slice, Sequence[Union[Clbit, int]]]]]"; expected "Union[Clbit, ClassicalRegister, int, slice, Sequence[Union[Clbit, int]]]"  [arg-type]
out_before.log:qiskit/circuit/quantumcircuit.py:922: error: Argument 1 to "cbit_argument_conversion" of "QuantumCircuit" has incompatible type "Union[Clbit, ClassicalRegister, int, slice, Sequence[Union[Clbit, ClassicalRegister, int, slice, Sequence[Union[Clbit, int]]]]]"; expected "Union[Clbit, ClassicalRegister, int, slice, Sequence[Union[Clbit, int]]]"  [arg-type]
out_before.log:qiskit/circuit/quantumcircuit.py:1228: error: Incompatible types in assignment (expression has type "Operation", variable has type "Instruction")  [assignment]
out_before.log:qiskit/circuit/quantumcircuit.py:1376: error: Need type annotation for "qregs"  [var-annotated]
out_before.log:qiskit/circuit/quantumcircuit.py:1380: error: Need type annotation for "cregs"  [var-annotated]
out_before.log:qiskit/circuit/quantumcircuit.py:1565: error: Argument 1 to "Decompose" has incompatible type "Union[Type[Gate], Sequence[Type[Gate]], Sequence[str], str, None]"; expected "Union[Type[Gate], List[Type[Gate]], List[str], str, None]"  [arg-type]
out_before.log:qiskit/circuit/quantumcircuit.py:1651: error: Need type annotation for "existing_composite_circuits" (hint: "existing_composite_circuits: List[<type>] = ...")  [var-annotated]
out_before.log:qiskit/circuit/quantumcircuit.py:1662: error: Argument 1 to "append" of "list" has incompatible type "ClassicalRegister"; expected "QuantumRegister"  [arg-type]
out_before.log:qiskit/circuit/quantumcircuit.py:1663: error: Need type annotation for "register_escaped_names" (hint: "register_escaped_names: Dict[<type>, <type>] = ...")  [var-annotated]
out_before.log:qiskit/circuit/quantumcircuit.py:1667: error: Argument 2 to "_make_unique" has incompatible type "Dict[Any, Any]"; expected "AbstractSet[str]"  [arg-type]
out_before.log:qiskit/circuit/quantumcircuit.py:1667: error: Argument 2 to "_make_unique" has incompatible type "Dict[str, Any]"; expected "AbstractSet[str]"  [arg-type]
out_before.log:qiskit/circuit/quantumcircuit.py:1918: error: Function "builtins.callable" is not valid as a type  [valid-type]
out_before.log:qiskit/circuit/quantumcircuit.py:1918: note: Perhaps you meant "typing.Callable" instead of "callable"?
out_before.log:qiskit/circuit/quantumcircuit.py:1936: error: Function "builtins.callable" is not valid as a type  [valid-type]
out_before.log:qiskit/circuit/quantumcircuit.py:1936: note: Perhaps you meant "typing.Callable" instead of "callable"?
out_before.log:qiskit/circuit/quantumcircuit.py:1958: error: Unsupported operand types for + ("List[Qubit]" and "List[Clbit]")  [operator]
out_before.log:qiskit/circuit/quantumcircuit.py:1983: error: callable? not callable  [misc]
out_before.log:qiskit/circuit/quantumcircuit.py:2080: error: Unsupported operand types for + ("List[Qubit]" and "List[Clbit]")  [operator]
out_before.log:qiskit/circuit/quantumcircuit.py:2693: error: Argument 1 to "len" has incompatible type "Union[ParameterExpression, float]"; expected "Sized"  [arg-type]
out_before.log:qiskit/circuit/quantumcircuit.py:2697: error: Argument 1 to "len" has incompatible type "Union[ParameterExpression, float]"; expected "Sized"  [arg-type]
out_before.log:qiskit/circuit/quantumcircuit.py:2699: error: No overload variant of "zip" matches argument types "<subclass of "Parameter" and "ParameterVector">", "Union[ParameterExpression, float]"  [call-overload]
out_before.log:qiskit/circuit/quantumcircuit.py:2699: note: Possible overload variants:
out_before.log:qiskit/circuit/quantumcircuit.py:2699: note:     def [_T_co, _T1] __new__(cls, Iterable[_T1], /, *, strict: bool = ...) -> zip[Tuple[_T1]]
out_before.log:qiskit/circuit/quantumcircuit.py:2699: note:     def [_T_co, _T1, _T2] __new__(cls, Iterable[_T1], Iterable[_T2], /, *, strict: bool = ...) -> zip[Tuple[_T1, _T2]]
out_before.log:qiskit/circuit/quantumcircuit.py:2699: note:     def [_T_co, _T1, _T2, _T3] __new__(cls, Iterable[_T1], Iterable[_T2], Iterable[_T3], /, *, strict: bool = ...) -> zip[Tuple[_T1, _T2, _T3]]
out_before.log:qiskit/circuit/quantumcircuit.py:2699: note:     def [_T_co, _T1, _T2, _T3, _T4] __new__(cls, Iterable[_T1], Iterable[_T2], Iterable[_T3], Iterable[_T4], /, *, strict: bool = ...) -> zip[Tuple[_T1, _T2, _T3, _T4]]
out_before.log:qiskit/circuit/quantumcircuit.py:2699: note:     def [_T_co, _T1, _T2, _T3, _T4, _T5] __new__(cls, Iterable[_T1], Iterable[_T2], Iterable[_T3], Iterable[_T4], Iterable[_T5], /, *, strict: bool = ...) -> zip[Tuple[_T1, _T2, _T3, _T4, _T5]]
out_before.log:qiskit/circuit/quantumcircuit.py:2699: note:     def [_T_co] __new__(cls, Iterable[Any], Iterable[Any], Iterable[Any], Iterable[Any], Iterable[Any], Iterable[Any], /, *iterables: Iterable[Any], strict: bool = ...) -> zip[Tuple[Any, ...]]
out_before.log:qiskit/circuit/quantumcircuit.py:2875: error: Incompatible types in assignment (expression has type "Union[Qubit, QuantumRegister, int, slice, Sequence[Union[Qubit, int]]]", variable has type "Qubit")  [assignment]
out_before.log:qiskit/circuit/quantumcircuit.py:2876: error: Need type annotation for "inst"  [var-annotated]
out_before.log:qiskit/circuit/quantumcircuit.py:3040: error: Unsupported left operand type for + ("Sequence[Union[Qubit, QuantumRegister, int, slice, Sequence[Union[Qubit, int]]]]")  [operator]
out_before.log:qiskit/circuit/quantumcircuit.py:3889: error: Argument 1 to "qbit_argument_conversion" of "QuantumCircuit" has incompatible type "Union[Qubit, QuantumRegister, int, slice, Sequence[Union[Qubit, QuantumRegister, int, slice, Sequence[Union[Qubit, int]]]]]"; expected "Union[Qubit, QuantumRegister, int, slice, Sequence[Union[Qubit, int]]]"  [arg-type]
out_before.log:qiskit/circuit/quantumcircuit.py:3908: error: Argument 1 to "len" has incompatible type "Union[Qubit, QuantumRegister, int, slice, Sequence[Union[Qubit, QuantumRegister, int, slice, Sequence[Union[Qubit, int]]]]]"; expected "Sized"  [arg-type]
out_before.log:qiskit/circuit/quantumcircuit.py:3909: error: Argument 1 to "len" has incompatible type "Union[Qubit, QuantumRegister, int, slice, Sequence[Union[Qubit, QuantumRegister, int, slice, Sequence[Union[Qubit, int]]]]]"; expected "Sized"  [arg-type]
out_before.log:qiskit/circuit/quantumcircuit.py:3912: error: Value of type "Union[Qubit, QuantumRegister, int, slice, Sequence[Union[Qubit, QuantumRegister, int, slice, Sequence[Union[Qubit, int]]]]]" is not indexable  [index]
out_before.log:qiskit/circuit/quantumcircuit.py:3916: error: Unsupported left operand type for + ("Sequence[Union[Qubit, QuantumRegister, int, slice, Sequence[Union[Qubit, int]]]]")  [operator]
out_before.log:qiskit/circuit/quantumcircuit.py:4175: error: Need type annotation for "atomic_parameters" (hint: "atomic_parameters: List[<type>] = ...")  [var-annotated]
out_before.log:qiskit/circuit/add_control.py:127: error: Argument 1 to "mct" of "QuantumCircuit" has incompatible type "QuantumRegister"; expected "Sequence[Union[Qubit, QuantumRegister, int, slice, Sequence[Union[Qubit, int]]]]"  [arg-type]
out_before.log:qiskit/circuit/add_control.py:129: error: "QuantumCircuit" has no attribute "mcrx"; maybe "mcx" or "crx"?  [attr-defined]
out_before.log:qiskit/circuit/add_control.py:136: error: "QuantumCircuit" has no attribute "mcry"; maybe "cry"?  [attr-defined]
out_before.log:qiskit/circuit/add_control.py:145: error: "QuantumCircuit" has no attribute "mcrz"; maybe "crz"?  [attr-defined]
out_before.log:qiskit/circuit/add_control.py:175: error: "QuantumCircuit" has no attribute "mcrx"; maybe "mcx" or "crx"?  [attr-defined]
out_before.log:qiskit/circuit/add_control.py:179: error: "QuantumCircuit" has no attribute "mcry"; maybe "cry"?  [attr-defined]
out_before.log:qiskit/circuit/add_control.py:187: error: "QuantumCircuit" has no attribute "mcrz"; maybe "crz"?  [attr-defined]
out_before.log:qiskit/circuit/add_control.py:191: error: "QuantumCircuit" has no attribute "mcrz"; maybe "crz"?  [attr-defined]
out_before.log:qiskit/circuit/add_control.py:194: error: "QuantumCircuit" has no attribute "mcry"; maybe "cry"?  [attr-defined]
out_before.log:qiskit/circuit/add_control.py:201: error: "QuantumCircuit" has no attribute "mcrz"; maybe "crz"?  [attr-defined]
out_before.log:qiskit/circuit/add_control.py:206: error: Argument 1 to "mcx" of "QuantumCircuit" has incompatible type "QuantumRegister"; expected "Sequence[Union[Qubit, QuantumRegister, int, slice, Sequence[Union[Qubit, int]]]]"  [arg-type]
out_before.log:qiskit/circuit/add_control.py:221: error: Unsupported operand types for | ("int" and "str")  [operator]
out_before.log:qiskit/circuit/add_control.py:221: note: Right operand is of type "Union[int, str, None]"
out_before.log:qiskit/circuit/add_control.py:226: error: Incompatible types in assignment (expression has type "Union[int, str, None]", variable has type "int")  [assignment]
out_before.log:qiskit/circuit/commutation_checker.py:109: error: "Operation" has no attribute "is_parameterized"  [attr-defined]
out_before.log:qiskit/circuit/commutation_checker.py:126: error: "Operation" has no attribute "params"  [attr-defined]
out_before.log:qiskit/circuit/commutation_checker.py:127: error: "Operation" has no attribute "params"  [attr-defined]
out_before.log:qiskit/circuit/controlledgate.py:102: error: Incompatible types in assignment (expression has type "Union[int, str, None]", variable has type "int")  [assignment]
out_before.log:qiskit/circuit/controlledgate.py:125: error: Incompatible return value type (got "QuantumCircuit", expected "List[Any]")  [return-value]
out_before.log:qiskit/circuit/gate.py: error: The return type of a generator function should be "Generator" or one of its supertypes  [misc]
out_before.log:qiskit/circuit/gate.py:211: error: Incompatible return value type (got "List[Tuple[List[<nothing>], List[<nothing>]]]", expected "Tuple[List[Any], List[Any]]")  [return-value]
out_before.log:qiskit/circuit/gate.py:215: error: Incompatible return value type (got "List[Any]", expected "Tuple[List[Any], List[Any]]")  [return-value]
out_before.log:qiskit/circuit/gate.py:217: error: Incompatible return value type (got "List[Any]", expected "Tuple[List[Any], List[Any]]")  [return-value]
out_before.log:qiskit/circuit/gate.py:219: error: Incompatible return value type (got "List[Any]", expected "Tuple[List[Any], List[Any]]")  [return-value]
out_before.log:qiskit/circuit/library/arithmetic/piecewise_chebyshev.py:260: error: Item "float" of "Union[float, Callable[[int], float]]" has no attribute "__code__"  [union-attr]
out_before.log:qiskit/circuit/library/arithmetic/piecewise_chebyshev.py:287: error: Incompatible types in assignment (expression has type "Optional[List[List[float]]]", variable has type "None")  [assignment]
out_before.log:qiskit/circuit/library/blueprintcircuit.py:35: error: Need type annotation for "_qregs" (hint: "_qregs: List[<type>] = ...")  [var-annotated]
out_before.log:qiskit/circuit/library/blueprintcircuit.py:36: error: Need type annotation for "_cregs" (hint: "_cregs: List[<type>] = ...")  [var-annotated]
out_before.log:qiskit/circuit/library/boolean_logic/quantum_and.py:89: error: Incompatible types in assignment (expression has type "List[<nothing>]", variable has type "AncillaRegister")  [assignment]
out_before.log:qiskit/circuit/library/boolean_logic/quantum_or.py:88: error: Incompatible types in assignment (expression has type "List[<nothing>]", variable has type "AncillaRegister")  [assignment]
out_before.log:qiskit/circuit/library/data_preparation/pauli_feature_map.py:140: error: Argument "entanglement" to "__init__" of "NLocal" has incompatible type "Union[str, List[List[int]], Callable[[int], List[int]]]"; expected "Union[List[int], List[List[int]], None]"  [arg-type]
out_before.log:qiskit/circuit/library/data_preparation/pauli_feature_map.py:151: error: Return type "Optional[List[Parameter]]" of "_parameter_generator" incompatible with return type "Optional[Parameter]" in supertype "NLocal"  [override]
out_before.log:qiskit/circuit/library/data_preparation/state_preparation.py:103: error: Argument 3 to "__init__" of "Gate" has incompatible type "Union[List[int], str, List[Any], Statevector]"; expected "List[Any]"  [arg-type]
out_before.log:qiskit/circuit/library/data_preparation/state_preparation.py:517: error: "Type[QuantumCircuit]" has no attribute "prepare_state"  [attr-defined]
out_before.log:qiskit/circuit/library/evolved_operator_ansatz.py:61: error: Argument "parameter_prefix" to "__init__" of "NLocal" has incompatible type "Union[str, List[str]]"; expected "str"  [arg-type]
out_before.log:qiskit/circuit/library/evolved_operator_ansatz.py:87: error: Read-only property cannot override read-write property  [misc]
out_before.log:qiskit/circuit/library/fourier_checking.py:82: error: Argument 1 to "QuantumCircuit" has incompatible type "float"; expected "Union[Register, int, Sequence[Bit]]"  [arg-type]
out_before.log:qiskit/circuit/library/fourier_checking.py:86: error: "QuantumCircuit" has no attribute "diagonal"  [attr-defined]
out_before.log:qiskit/circuit/library/fourier_checking.py:90: error: "QuantumCircuit" has no attribute "diagonal"  [attr-defined]
out_before.log:qiskit/circuit/library/generalized_gates/diagonal.py:110: error: "QuantumCircuit" has no attribute "ucrz"; maybe "crz"?  [attr-defined]
out_before.log:qiskit/circuit/library/generalized_gates/mcmt.py:210: error: Missing return statement  [return]
out_before.log:qiskit/circuit/library/generalized_gates/mcmt.py:233: error: Return value expected  [return-value]
out_before.log:qiskit/circuit/library/grover_operator.py:298: error: Incompatible types in assignment (expression has type "List[<nothing>]", variable has type "AncillaRegister")  [assignment]
out_before.log:qiskit/circuit/library/n_local/efficient_su2.py:133: error: Argument "rotation_blocks" to "__init__" of "TwoLocal" has incompatible type "Union[str, type, Instruction, QuantumCircuit, List[Union[str, type, Instruction, QuantumCircuit]]]"; expected "Union[str, List[str], type, List[type], QuantumCircuit, List[QuantumCircuit], None]"  [arg-type]
out_before.log:qiskit/circuit/library/n_local/efficient_su2.py:145: error: Read-only property cannot override read-write property  [misc]
out_before.log:qiskit/circuit/library/n_local/excitation_preserving.py:160: error: Read-only property cannot override read-write property  [misc]
out_before.log:qiskit/circuit/library/n_local/n_local.py:120: error: Need type annotation for "_entanglement_blocks" (hint: "_entanglement_blocks: List[<type>] = ...")  [var-annotated]
out_before.log:qiskit/circuit/library/n_local/n_local.py:121: error: Need type annotation for "_rotation_blocks" (hint: "_rotation_blocks: List[<type>] = ...")  [var-annotated]
out_before.log:qiskit/circuit/library/n_local/n_local.py:122: error: Need type annotation for "_prepended_blocks" (hint: "_prepended_blocks: List[<type>] = ...")  [var-annotated]
out_before.log:qiskit/circuit/library/n_local/n_local.py:123: error: Need type annotation for "_prepended_entanglement" (hint: "_prepended_entanglement: List[<type>] = ...")  [var-annotated]
out_before.log:qiskit/circuit/library/n_local/n_local.py:124: error: Need type annotation for "_appended_blocks" (hint: "_appended_blocks: List[<type>] = ...")  [var-annotated]
out_before.log:qiskit/circuit/library/n_local/n_local.py:125: error: Need type annotation for "_appended_entanglement" (hint: "_appended_entanglement: List[<type>] = ...")  [var-annotated]
out_before.log:qiskit/circuit/library/n_local/n_local.py:227: error: Incompatible types in assignment (expression has type "List[Union[QuantumCircuit, Instruction]]", variable has type "Union[QuantumCircuit, List[QuantumCircuit], Instruction, List[Instruction]]")  [assignment]
out_before.log:qiskit/circuit/library/n_local/n_local.py:230: error: Item "QuantumCircuit" of "Union[QuantumCircuit, Any, List[QuantumCircuit], Instruction, List[Instruction]]" has no attribute "__iter__" (not iterable)  [union-attr]
out_before.log:qiskit/circuit/library/n_local/n_local.py:230: error: Item "Instruction" of "Union[QuantumCircuit, Any, List[QuantumCircuit], Instruction, List[Instruction]]" has no attribute "__iter__" (not iterable)  [union-attr]
out_before.log:qiskit/circuit/library/n_local/n_local.py:252: error: Incompatible types in assignment (expression has type "List[Union[QuantumCircuit, Instruction]]", variable has type "Union[QuantumCircuit, List[QuantumCircuit], Instruction, List[Instruction]]")  [assignment]
out_before.log:qiskit/circuit/library/n_local/n_local.py:255: error: Item "QuantumCircuit" of "Union[QuantumCircuit, Any, List[QuantumCircuit], Instruction, List[Instruction]]" has no attribute "__iter__" (not iterable)  [union-attr]
out_before.log:qiskit/circuit/library/n_local/n_local.py:255: error: Item "Instruction" of "Union[QuantumCircuit, Any, List[QuantumCircuit], Instruction, List[Instruction]]" has no attribute "__iter__" (not iterable)  [union-attr]
out_before.log:qiskit/circuit/library/n_local/n_local.py:398: error: Incompatible types in assignment (expression has type "Union[ParameterVector, List[Parameter]]", variable has type "ParameterVector")  [assignment]
out_before.log:qiskit/circuit/library/n_local/n_local.py:725: error: Incompatible types in assignment (expression has type "List[Union[List[int], List[List[int]]]]", variable has type "Union[List[int], str, List[List[int]], None]")  [assignment]
out_before.log:qiskit/circuit/library/n_local/n_local.py:735: error: Argument 1 to "max" has incompatible type "Union[int, List[int]]"; expected "Iterable[int]"  [arg-type]
out_before.log:qiskit/circuit/library/n_local/n_local.py:748: error: Incompatible types in assignment (expression has type "Union[List[int], List[List[int]]]", variable has type "List[Sequence[int]]")  [assignment]
out_before.log:qiskit/circuit/library/n_local/n_local.py:763: error: Argument 1 of "assign_parameters" is incompatible with supertype "QuantumCircuit"; supertype defines the argument type as "Union[Mapping[Parameter, Union[ParameterExpression, float]], Sequence[Union[ParameterExpression, float]]]"  [override]
out_before.log:qiskit/circuit/library/n_local/n_local.py:763: note: This violates the Liskov substitution principle
out_before.log:qiskit/circuit/library/n_local/n_local.py:763: note: See https://mypy.readthedocs.io/en/stable/common_issues.html#incompatible-overrides
out_before.log:qiskit/circuit/library/n_local/n_local.py:788: error: Argument 1 to "assign_parameters" of "QuantumCircuit" has incompatible type "Union[Dict[Any, Any], List[float], List[Parameter], ParameterVector]"; expected "Union[Mapping[Parameter, Union[ParameterExpression, float]], Sequence[Union[ParameterExpression, float]]]"  [arg-type]
out_before.log:qiskit/circuit/library/n_local/n_local.py:934: error: Incompatible types in assignment (expression has type "Instruction", variable has type "Gate")  [assignment]
out_before.log:qiskit/circuit/library/n_local/n_local.py:954: error: List comprehension has incompatible type List[ParameterExpression]; expected List[Parameter]  [misc]
out_before.log:qiskit/circuit/library/n_local/n_local.py:992: error: Incompatible return value type (got "List[Tuple[int, ...]]", expected "List[Sequence[int]]")  [return-value]
out_before.log:qiskit/circuit/library/n_local/n_local.py:992: note: "List" is invariant -- see https://mypy.readthedocs.io/en/stable/common_issues.html#variance
out_before.log:qiskit/circuit/library/n_local/n_local.py:992: note: Consider using "Sequence" instead, which is covariant
out_before.log:qiskit/circuit/library/n_local/n_local.py:992: note: Perhaps you need a type annotation for "reverse"? Suggestion: "List[Sequence[int]]"
out_before.log:qiskit/circuit/library/n_local/n_local.py:997: error: Incompatible return value type (got "List[Tuple[int, ...]]", expected "List[Sequence[int]]")  [return-value]
out_before.log:qiskit/circuit/library/n_local/n_local.py:997: note: "List" is invariant -- see https://mypy.readthedocs.io/en/stable/common_issues.html#variance
out_before.log:qiskit/circuit/library/n_local/n_local.py:997: note: Consider using "Sequence" instead, which is covariant
out_before.log:qiskit/circuit/library/n_local/n_local.py:997: note: Perhaps you need a type annotation for "linear"? Suggestion: "List[Sequence[int]]"
out_before.log:qiskit/circuit/library/n_local/n_local.py:1000: error: Incompatible return value type (got "List[Tuple[int, ...]]", expected "List[Sequence[int]]")  [return-value]
out_before.log:qiskit/circuit/library/n_local/n_local.py:1000: note: "List" is invariant -- see https://mypy.readthedocs.io/en/stable/common_issues.html#variance
out_before.log:qiskit/circuit/library/n_local/n_local.py:1000: note: Consider using "Sequence" instead, which is covariant
out_before.log:qiskit/circuit/library/n_local/n_local.py:1008: error: Incompatible return value type (got "List[Tuple[int, ...]]", expected "List[Sequence[int]]")  [return-value]
out_before.log:qiskit/circuit/library/n_local/n_local.py:1008: note: "List" is invariant -- see https://mypy.readthedocs.io/en/stable/common_issues.html#variance
out_before.log:qiskit/circuit/library/n_local/n_local.py:1008: note: Consider using "Sequence" instead, which is covariant
out_before.log:qiskit/circuit/library/n_local/n_local.py:1008: note: Perhaps you need a type annotation for "circular"? Suggestion: "List[Sequence[int]]"
out_before.log:qiskit/circuit/library/n_local/n_local.py:1017: error: Incompatible return value type (got "List[Tuple[int, ...]]", expected "List[Sequence[int]]")  [return-value]
out_before.log:qiskit/circuit/library/n_local/n_local.py:1017: note: "List" is invariant -- see https://mypy.readthedocs.io/en/stable/common_issues.html#variance
out_before.log:qiskit/circuit/library/n_local/n_local.py:1017: note: Consider using "Sequence" instead, which is covariant
out_before.log:qiskit/circuit/library/n_local/n_local.py:1017: note: Perhaps you need a type annotation for "sca"? Suggestion: "List[Sequence[int]]"
out_before.log:qiskit/circuit/library/n_local/pauli_two_design.py:85: error: Need type annotation for "_gates" (hint: "_gates: Dict[<type>, <type>] = ...")  [var-annotated]
out_before.log:qiskit/circuit/library/n_local/qaoa_ansatz.py:62: error: Incompatible types in assignment (expression has type "Optional[QuantumCircuit]", variable has type "None")  [assignment]
out_before.log:qiskit/circuit/library/n_local/qaoa_ansatz.py:134: error: Incompatible return value type (got "List[Tuple[int, Any]]", expected "Optional[List[Tuple[Optional[float], Optional[float]]]]")  [return-value]
out_before.log:qiskit/circuit/library/n_local/qaoa_ansatz.py:145: error: Incompatible types in assignment (expression has type "Optional[List[Tuple[Optional[float], Optional[float]]]]", variable has type "None")  [assignment]
out_before.log:qiskit/circuit/library/n_local/qaoa_ansatz.py:147: error: Read-only property cannot override read-write property  [misc]
out_before.log:qiskit/circuit/library/n_local/qaoa_ansatz.py:206: error: Incompatible types in assignment (expression has type "Optional[QuantumCircuit]", variable has type "None")  [assignment]
out_before.log:qiskit/circuit/library/n_local/qaoa_ansatz.py:250: error: Read-only property cannot override read-write property  [misc]
out_before.log:qiskit/circuit/library/n_local/real_amplitudes.py:172: error: Read-only property cannot override read-write property  [misc]
out_before.log:qiskit/circuit/library/n_local/two_local.py:214: error: Argument "rotation_blocks" to "__init__" of "NLocal" has incompatible type "Union[str, List[str], type, List[type], QuantumCircuit, List[QuantumCircuit], None]"; expected "Union[QuantumCircuit, List[QuantumCircuit], Instruction, List[Instruction], None]"  [arg-type]
out_before.log:qiskit/circuit/library/n_local/two_local.py:215: error: Argument "entanglement_blocks" to "__init__" of "NLocal" has incompatible type "Union[str, List[str], type, List[type], QuantumCircuit, List[QuantumCircuit], None]"; expected "Union[QuantumCircuit, List[QuantumCircuit], Instruction, List[Instruction], None]"  [arg-type]
out_before.log:qiskit/circuit/library/n_local/two_local.py:216: error: Argument "entanglement" to "__init__" of "NLocal" has incompatible type "Union[str, List[List[int]], Callable[[int], List[int]]]"; expected "Union[List[int], List[List[int]], None]"  [arg-type]
out_before.log:qiskit/circuit/library/standard_gates/p.py:111: error: Incompatible types in assignment (expression has type "MCPhaseGate", variable has type "CPhaseGate")  [assignment]
out_before.log:qiskit/circuit/library/standard_gates/u1.py:132: error: Incompatible types in assignment (expression has type "MCU1Gate", variable has type "CU1Gate")  [assignment]
out_before.log:qiskit/circuit/library/standard_gates/u3.py:117: error: "CU3Gate" gets multiple values for keyword argument "label"  [misc]
out_before.log:qiskit/circuit/library/standard_gates/u3.py:117: error: "CU3Gate" gets multiple values for keyword argument "ctrl_state"  [misc]
out_before.log:qiskit/circuit/library/standard_gates/x.py:936: error: Unexpected keyword argument "label" for "__new__" of "object"  [call-arg]
out_before.log:qiskit/circuit/library/standard_gates/x.py:936: error: Unexpected keyword argument "ctrl_state" for "__new__" of "object"  [call-arg]
out_before.log:qiskit/circuit/library/standard_gates/x.py:938: error: Accessing "__init__" on an instance is unsound, since instance.__init__ could be from an incompatible subclass  [misc]
out_before.log:qiskit/circuit/library/standard_gates/x.py:1039: error: Unexpected keyword argument "label" for "__new__" of "object"  [call-arg]
out_before.log:qiskit/circuit/library/standard_gates/x.py:1039: error: Unexpected keyword argument "ctrl_state" for "__new__" of "object"  [call-arg]
out_before.log:qiskit/circuit/library/standard_gates/x.py:1041: error: Accessing "__init__" on an instance is unsound, since instance.__init__ could be from an incompatible subclass  [misc]
out_before.log:qiskit/circuit/instructionset.py:127: error: Need type annotation for "_instructions" (hint: "_instructions: List[<type>] = ...")  [var-annotated]
out_before.log:qiskit/circuit/library/arithmetic/adders/vbe_ripple_carry_adder.py:86: error: Incompatible types in assignment (expression has type "List[<nothing>]", variable has type "QuantumRegister")  [assignment]
out_before.log:qiskit/circuit/library/arithmetic/adders/vbe_ripple_carry_adder.py:97: error: Incompatible types in assignment (expression has type "List[<nothing>]", variable has type "QuantumRegister")  [assignment]
out_before.log:qiskit/circuit/library/arithmetic/adders/vbe_ripple_carry_adder.py:105: error: Incompatible types in assignment (expression has type "List[<nothing>]", variable has type "AncillaRegister")  [assignment]
out_before.log:qiskit/circuit/library/arithmetic/linear_amplitude_function.py:136: error: Value of type "Union[float, List[float]]" is not indexable  [index]
out_before.log:qiskit/circuit/library/arithmetic/linear_amplitude_function.py:137: error: Value of type "Union[float, List[float]]" is not indexable  [index]
out_before.log:qiskit/circuit/library/arithmetic/piecewise_linear_pauli_rotations.py:105: error: Incompatible return value type (got "List[float]", expected "List[int]")  [return-value]
out_before.log:qiskit/circuit/library/arithmetic/polynomial_pauli_rotations.py:284: error: Incompatible types in assignment (expression has type "Tuple[int]", variable has type "Tuple[]")  [assignment]
out_before.log:qiskit/circuit/library/arithmetic/polynomial_pauli_rotations.py:287: error: Incompatible types in assignment (expression has type "Tuple[int]", variable has type "Tuple[]")  [assignment]
out_before.log:qiskit/circuit/library/arithmetic/polynomial_pauli_rotations.py:292: error: Incompatible return value type (got "Dict[Tuple[int, ...], int]", expected "Dict[Sequence[int], float]")  [return-value]
out_before.log:qiskit/circuit/library/arithmetic/polynomial_pauli_rotations.py:292: note: Perhaps you need a type annotation for "rotation_coeffs"? Suggestion: "Dict[Sequence[int], float]"
out_before.log:qiskit/circuit/library/arithmetic/quadratic_form.py:186: error: Incompatible types in assignment (expression has type "Union[Any, float, int]", variable has type "int")  [assignment]
out_before.log:qiskit/circuit/library/arithmetic/quadratic_form.py:187: error: Incompatible types in assignment (expression has type "Union[Any, float, int]", variable has type "int")  [assignment]
out_before.log:qiskit/circuit/library/arithmetic/quadratic_form.py:188: error: Incompatible types in assignment (expression has type "float", variable has type "int")  [assignment]
out_before.log:qiskit/circuit/library/standard_gates/equivalence_library.py:1471: error: Need type annotation for "rules"  [var-annotated]
out_before.log:qiskit/circuit/library/standard_gates/equivalence_library.py:1506: error: Need type annotation for "rules"  [var-annotated]
out_before.log:qiskit/circuit/library/standard_gates/multi_control_rotation_gates.py:242: error: "Type[QuantumCircuit]" has no attribute "mcrx"  [attr-defined]
out_before.log:qiskit/circuit/library/standard_gates/multi_control_rotation_gates.py:243: error: "Type[QuantumCircuit]" has no attribute "mcry"  [attr-defined]
out_before.log:qiskit/circuit/library/standard_gates/multi_control_rotation_gates.py:244: error: "Type[QuantumCircuit]" has no attribute "mcrz"  [attr-defined]
out_before.log:qiskit/circuit/library/templates/rzx/rzx_cy.py:30: error: Incompatible types in assignment (expression has type "Parameter", variable has type "float")  [assignment]
out_before.log:qiskit/circuit/library/templates/rzx/rzx_xz.py:35: error: Incompatible types in assignment (expression has type "Parameter", variable has type "float")  [assignment]
out_before.log:qiskit/circuit/library/templates/rzx/rzx_yz.py:30: error: Incompatible types in assignment (expression has type "Parameter", variable has type "float")  [assignment]
out_before.log:qiskit/circuit/library/templates/rzx/rzx_zz1.py:40: error: Incompatible types in assignment (expression has type "Parameter", variable has type "float")  [assignment]
out_before.log:qiskit/circuit/library/templates/rzx/rzx_zz2.py:35: error: Incompatible types in assignment (expression has type "Parameter", variable has type "float")  [assignment]
out_before.log:qiskit/circuit/library/templates/rzx/rzx_zz3.py:35: error: Incompatible types in assignment (expression has type "Parameter", variable has type "float")  [assignment]

qiskit/circuit/gate.py Outdated Show resolved Hide resolved
@kevinsung
Copy link
Contributor

@Randl could you remove the # type: ignores as requested above?

qiskit/circuit/add_control.py Outdated Show resolved Hide resolved
@kevinsung kevinsung added the mypy Work related to support improving type hints in Qiskti code label Mar 20, 2023
Copy link
Contributor

@Cryoris Cryoris left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I left some more comments but I think this is almost good to go from my side 🙂

qiskit/circuit/library/grover_operator.py Outdated Show resolved Hide resolved
@@ -1523,7 +1531,7 @@
xxminusyy = QuantumCircuit(q)
beta = Parameter("beta")
theta = Parameter("theta")
rules = [
rules: list[tuple[Gate, list[Qubit], list[Clbit]]] = [
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is mainly a question about mypy: here the variable is directly defined, so I would assume the type is known. Is it simply that for complex constructs mypy cannot infer the type, or why did it warn here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Idk, locally I get

qiskit/circuit/library/standard_gates/equivalence_library.py:1499: error: Need type annotation for "rules"  [var-annotated]

qiskit/circuit/library/standard_gates/u1.py Outdated Show resolved Hide resolved
Randl and others added 2 commits March 24, 2023 13:49
…70e08db.yaml

Co-authored-by: Julien Gacon <gaconju@gmail.com>
@Randl
Copy link
Contributor Author

Randl commented Mar 24, 2023

Looks like there is some doc-related error after last comment. I found the following warning in logs:

2023-03-24T11:11:08.2118728Z /home/vsts/work/1/s/.tox/docs/lib/python3.9/site-packages/qiskit/circuit/library/generalized_gates/mcmt.py:docstring of qiskit.circuit.library.generalized_gates.mcmt.MCMT:1: WARNING: more than one target found for cross-reference 'Instruction': qiskit.pulse.instructions.Instruction, qiskit.pulse.instructions.instruction.Instruction, qiskit.circuit.Instruction, qiskit.circuit.instruction.Instruction
2023-03-24T11:11:08.2620361Z /home/vsts/work/1/s/docs/stubs/qiskit.circuit.library.MCMTVChain.rst:39: WARNING: more than one target found for cross-reference 'Instruction': qiskit.pulse.instructions.Instruction, qiskit.pulse.instructions.instruction.Instruction, qiskit.circuit.Instruction, qiskit.circuit.instruction.Instruction

but not sure why it happened

qiskit/circuit/gate.py Outdated Show resolved Hide resolved
@Randl
Copy link
Contributor Author

Randl commented Mar 26, 2023

So anything else required from me at this point?

Copy link
Contributor

@Cryoris Cryoris left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks a lot for all the effort and the patience in including the comments! 🙂

@Cryoris Cryoris added the Changelog: Bugfix Include in the "Fixed" section of the changelog label Mar 28, 2023
@Cryoris
Copy link
Contributor

Cryoris commented Mar 28, 2023

Adding the bugfix tag as this also found and fixed a bug in the controlled gate creation

@Cryoris Cryoris added this pull request to the merge queue Mar 28, 2023
Merged via the queue into Qiskit:main with commit be8eeff Mar 28, 2023
adjs added a commit to comp-quantica/qiskit-terra that referenced this pull request Mar 29, 2023
commit 43a9dce
Author: Eric Arellano <14852634+Eric-Arellano@users.noreply.github.com>
Date:   Tue Mar 28 15:27:07 2023 -0600

    Apply new deprecation decorators to algorithms folder (Qiskit#9864)

    * Apply new deprecation decorators to algorithms folder

    * Fix docstring starting on first line

    * Fix test due to positional args not triggering warning

    * Improve test further

commit 67eaa4b
Author: a-matsuo <47442626+a-matsuo@users.noreply.github.com>
Date:   Wed Mar 29 04:50:41 2023 +0900

    Rearrange the gradient result based on the order of the input parameters (Qiskit#9503)

    * finite diff and spsa estimator gradient

    * for param shift, lin_comb, and reverse gradients

    * reverse estimator gradient

    * implemented the new feature

    * fix lint

    * fix test

    * fix and add reno

    * fix

    * fix style

commit 7e09125
Author: Eric Arellano <14852634+Eric-Arellano@users.noreply.github.com>
Date:   Tue Mar 28 08:33:08 2023 -0600

    Add `@deprecate_func` and `@deprecate_arg` decorators (Qiskit#9676)

    * Add `@deprecate_func` and `@deprecate_arg` decorators

    * Update the release note

    * Apply suggestions from code review

    Co-authored-by: Luciano Bello <bel@zurich.ibm.com>

    * lint

    * Use PyPI package_name rather than loose English

    ---------

    Co-authored-by: Luciano Bello <bel@zurich.ibm.com>

commit 90b2439
Author: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Date:   Tue Mar 28 07:44:45 2023 -0400

    Bump indexmap from 1.9.2 to 1.9.3 (Qiskit#9858)

    Bumps [indexmap](https://github.com/bluss/indexmap) from 1.9.2 to 1.9.3.
    - [Release notes](https://github.com/bluss/indexmap/releases)
    - [Changelog](https://github.com/bluss/indexmap/blob/master/RELEASES.md)
    - [Commits](indexmap-rs/indexmap@1.9.2...1.9.3)

    ---
    updated-dependencies:
    - dependency-name: indexmap
      dependency-type: direct:production
      update-type: version-update:semver-patch
    ...

    Signed-off-by: dependabot[bot] <support@github.com>
    Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

commit be8eeff
Author: Evgenii Zheltonozhskii <zheltonozhskiy@gmail.com>
Date:   Tue Mar 28 12:59:41 2023 +0300

    Fix mypy errors (circuit) (Qiskit#8267)

    * Fix circuit mypy errors

    * Fix 2

    * Remove ignores

    * Remove ignores for sure

    * Remove TODO

    * fix for docs

    * Add annotation

    * Fix control bug, remove unnecessary annotation

    * Add test and fix description

    * Fix test

    * Reformat

    * Fix test description

    * Update releasenotes/notes/fix-control-with-string-parameter-4eb8a308170e08db.yaml

    Co-authored-by: Julien Gacon <gaconju@gmail.com>

    * More minor fixes

    * Fix callable import

    * Fix Instruction import for sphinx

    * Replace list[Any] with list

    ---------

    Co-authored-by: Julien Gacon <gaconju@gmail.com>

commit 3118683
Author: Elena Peña Tapia <57907331+ElePT@users.noreply.github.com>
Date:   Tue Mar 28 11:51:20 2023 +0200

    Fix examples (Qiskit#9860)

commit a36416b
Author: Elena Peña Tapia <57907331+ElePT@users.noreply.github.com>
Date:   Tue Mar 28 10:27:43 2023 +0200

    Remove factorizers and linear solvers from `algorithms` (Qiskit#9832)

    * Remove factorizers and linear solvers

    * Add reno

    * Remove shor from backend tests

    * Fix reno

    * Apply suggestions from code review

    Co-authored-by: Steve Wood <40241007+woodsp-ibm@users.noreply.github.com>

    * Apply review reno

    ---------

    Co-authored-by: Steve Wood <40241007+woodsp-ibm@users.noreply.github.com>

commit aacbc66
Author: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Date:   Mon Mar 27 19:13:15 2023 +0000

    Bump pyo3 from 0.18.1 to 0.18.2 (Qiskit#9854)

    Bumps [pyo3](https://github.com/pyo3/pyo3) from 0.18.1 to 0.18.2.
    - [Release notes](https://github.com/pyo3/pyo3/releases)
    - [Changelog](https://github.com/PyO3/pyo3/blob/main/CHANGELOG.md)
    - [Commits](PyO3/pyo3@v0.18.1...v0.18.2)

    ---
    updated-dependencies:
    - dependency-name: pyo3
      dependency-type: direct:production
      update-type: version-update:semver-patch
    ...

    Signed-off-by: dependabot[bot] <support@github.com>
    Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

commit abfb53e
Author: Jake Lishman <jake.lishman@ibm.com>
Date:   Mon Mar 27 15:06:28 2023 +0100

    Ensure up-to-date `pip`, `setuptools` and `wheel` in CI (Qiskit#9850)

    Up-to-date Python packages should not require this step, however there
    are several packages, especially those that are optional for Terra
    functionality, that do not yet contain `pyproject.toml` files when
    building them from source.  In these cases, `pip` will begin erroring
    out from version 23.1 if `wheel` is not installed.

    This commit proactively ensures that the minimum build dependencies for
    legacy Python packages is prepared and up-to-date before attempting
    installations; this includes ensuring that these are updated _inside_
    any created venvs as well as outside them.

commit 03473bd
Author: Elena Peña Tapia <57907331+ElePT@users.noreply.github.com>
Date:   Mon Mar 27 12:23:12 2023 +0200

    pin symengine to `<0.10.0` (Qiskit#9857)

    * pin symengine

    * Avoid specific version

commit a1a67a1
Author: Matthew Treinish <mtreinish@kortar.org>
Date:   Fri Mar 24 14:34:53 2023 -0400

    Add support to CouplingMap for disjoint qubits (Qiskit#9710)

    * Add support to CouplingMap for disjoint qubits

    Previously the CouplingMap class only supported graphs which were fully
    connected. This prevented us from modeling potential hardware which
    didn't have a path between all qubits. This isn't an inherent limitation
    of the underlying graph data structure but was a limitation put on the
    CouplingMap class because several pieces of the transpiler assume a path
    always exists between 2 qubits (mainly in layout and routing). This
    commit removes this limitation and also adds a method to get a subgraph
    CouplingMap for all the components of the CouplingMap. This enables us
    to model these devices with a CouplingMap, which is the first step
    towards supporting these devices in the transpiler.

    One limitation with this PR is most fo the layout and routing algorithms
    do not support disjoint connectivity. The primary exception being
    TrivialLayout (although the output might be invalid) VF2Layout and
    VF2PostLayout which inherently support this already. This commit lays
    the groundwork to fix this limitation in a follow-up PR but for the time
    being it just raises an error in those passes if a disconnected
    CouplingMap is being used. The intent here is to follow up to this commit
    soon for adding support for SabreLayout, SabreSwap, DenseLayout,
    and StochasticSwap to leverage the method get_component_subgraphs added
    here to make them usable on such coupling maps.

    * Remove coupling map connected check from NoiseAdaptiveLayout

    Noise adaptive layout doesn't use a CouplingMap so we can't check for a
    disconnected coupling map in it.

    * Change DenseLayout guard to only prevent running when it won't work

    * Rename get_component_subgraphs to components and cache result

    This commit renames the get_component_subgraphs() method to components()
    which is much more consise name. At the same time this adds caching to
    the return just in case building the component subgraphs is expensive to
    compute we only need to ever do it once.

    * Drop caching of connected components

    * Fix check for dense layout to do a valid comparison

    * Ensure self loops in CouplingMap.distance() return 0

    In a previous commit the distance() method was updated to handle
    disjoint graphs correctly. Prior to this PR it was expected to raise
    when a path didn't exist between 2 qubits by nature of the distance
    matrix construction failing if there was a disconnected coupling map.
    Since that isn't the case after this PR the error condition was
    changed to check explicitly that there is no path available and then
    error. However, there was an issue in this case and self loops would
    incorrectly error as well when instead they should return 0. This commit
    updates the error check to ignore self loops so they return correctly.

    * Fix lint

    * Update CouplingMap.components() docstring

    Co-authored-by: Kevin Krsulich <kevin@krsulich.net>

    * Expand test coverage

    * Remove unused option for strongly connected components

    * Expand docstring to explain return list order

    * Use infinity for disconnected nodes in distance matrix

    * Update releasenotes/notes/add-cmap-componets-7ed56cdf294150f1.yaml

    * Rename CouplingMap.components to connected_components()

    THis commit renames the CouplingMap.components() method to
    connected_components(). It also adds an example to the docstring to
    better explain what a connected component is.

    * Fix typo in relaese note

    * Update method name in release note

    * Restore previous reduce() behavior

    The current reduce() error behavior of raising on trying to reduce to a
    disconnected coupling map is being depended on in other locations. To
    avoid a potentially breaking change this commit reverts the removal of
    that limitation in the method. We can look at doing that in the future
    independently of this PR because removing this specific restriction on
    the reduce() method is not 100% tied to generally allowing disconnected
    coupling map objects.

    * Add missing import

    ---------

    Co-authored-by: Kevin Krsulich <kevin@krsulich.net>

commit 0bd4cfd
Author: Matthew Treinish <mtreinish@kortar.org>
Date:   Fri Mar 24 10:48:21 2023 -0400

    Add option to skip deepcopy on dag_to_circuit (Qiskit#9825)

    * Add option to skip deepcopy on dag_to_circuit

    This commit adds a new option, copy_operations, which allows to disable
    the deepcopy on dag_to_circuit(). Previously the dag to circuit
    converter would always deep copy the operations, however in the
    transpiler we don't need this extra overhead because the DAGCircuits are
    temporary internal artifacts and will not be resused outside of the
    transpiler. So we can avoid the copy overhead in these situations,
    however in general the converter needs to default to copying. This
    new argument enables this workflow by keeping the current behavior by
    default but enabling the transpiler to skip copying operations in the
    output conversion.

    * Fix docs typo

    * Fix docs typo again

    * Use copy_operations=False in more locations

commit dfcfa4a
Author: Jake Lishman <jake.lishman@ibm.com>
Date:   Fri Mar 24 13:16:58 2023 +0000

    Remove dependency on sphinx-autodoc-typehints (Qiskit#9705)

    * Remove dependency on sphinx-autodoc-typehints

    This replaces the whole usage of the separate package
    `sphinx-autodoc-typehints` with the built-in support from `autodoc`,
    available (with this combination of options) since Sphinx 5.0.  This
    removes a docs dependency that has caused us significant problems before
    due to its instability, and the built-in handling in `autodoc` is much
    cleaner as well; rather than trying to textually modify the docstring,
    this version (correctly) mutates the parsed rST structure, which also
    naturally it 100% compatible with the Napoleon processing.

    * Maintain previous type-hint behaviour

commit 4a63b17
Author: Jake Lishman <jake.lishman@ibm.com>
Date:   Fri Mar 24 13:14:07 2023 +0000

    Move OQ3 exporter tests to qasm3 module (Qiskit#9844)

    * Move OQ3 exporter tests to qasm3 module

    These previously lived in `test/python/circuit` just for historical
    reasons (the OQ2 exporter lives there because it's a method on
    `QuantumCircuit`).  Since we have a dedicated `qasm3` module now,
    including in the test suite, it makes sense to move the file there.

    * Add missing __init__.py

commit 9c8eb06
Author: Julien Gacon <gaconju@gmail.com>
Date:   Fri Mar 24 08:46:38 2023 +0100

    Improve ``Parameter`` handling in ``SparsePauliOp`` (Qiskit#9796)

    * add reno

    * Add assign_parameters and parameter in init

    * add SPO.parameters and remove utils

    * fix ParameterValueType typehint

    * Update qiskit/quantum_info/operators/symplectic/sparse_pauli_op.py

    Co-authored-by: Ikko Hamamura <ikkoham@users.noreply.github.com>

    * remove trailing print

    * Elena's comments

    Co-authored-by: Elena Peña Tapia <57907331+ElePT@users.noreply.github.com>

    * fix line length

    ---------

    Co-authored-by: Ikko Hamamura <ikkoham@users.noreply.github.com>
    Co-authored-by: Elena Peña Tapia <57907331+ElePT@users.noreply.github.com>

commit 7bb4af9
Author: Eric Arellano <14852634+Eric-Arellano@users.noreply.github.com>
Date:   Thu Mar 23 09:24:43 2023 -0600

    Remove tweedledum from requirements-dev.txt (Qiskit#9759)

commit 5a19f8a
Author: Jake Lishman <jake.lishman@ibm.com>
Date:   Thu Mar 23 13:57:23 2023 +0000

    Fix missing handling of no-synthesis case in `UnitarySynthesis` (Qiskit#9843)

    Since moving `Optimize1qDecomposition` down to the Rust level, some of
    its use in the default `UnitarySynthesis` plugin was allowing `None` to
    be passed to an internal function unchecked.  This correctly returns the
    "could not synthesise" value when appropriate.

commit 84a0fdd
Author: Takashi Imamichi <31178928+t-imamichi@users.noreply.github.com>
Date:   Thu Mar 23 10:37:34 2023 +0900

    Performance improvement of `SparsePauliOp.to_matrix` (Qiskit#9620)

    * optimize SparsePauliOp.to_matrix

    * optimize dense

    * proper vectorize

    * update copyright year

    * small opt

    * update a comment

commit 262cf08
Author: Jake Lishman <jake.lishman@ibm.com>
Date:   Wed Mar 22 16:11:35 2023 +0000

    Revert "Start deprecation of complex parameters in Qiskit Pulse (Qiskit#9735)" (Qiskit#9838)

    This reverts commit eb4c5cb.

    This is currently causing flaky CI on Windows, so is being temporarily
    reverted while a fix can be made.

commit 789d588
Author: Steve Wood <40241007+woodsp-ibm@users.noreply.github.com>
Date:   Wed Mar 22 09:28:19 2023 -0400

    Update codeowners (Qiskit#9835)

commit eb4c5cb
Author: TsafrirA <113579969+TsafrirA@users.noreply.github.com>
Date:   Tue Mar 21 03:10:59 2023 +0200

    Start deprecation of complex parameters in Qiskit Pulse (Qiskit#9735)

    * Add warning and update tests

    * Release notes

    * Move warning to all Pulse objects.

    * Fix releasenote typo

    * Move warning to format_parameter_value

commit 6cec912
Author: Matthew Treinish <mtreinish@kortar.org>
Date:   Mon Mar 20 13:26:41 2023 -0400

    Fix non-complex dtypes in OneQubitEulerDecomposer methods (Qiskit#9828)

    * Fix non-complex dtypes in OneQubitEulerDecomposer methods

    This commit fixes a regression introduced in the rewrite of the
    internals of the OneQubitEulerDecomposer class to be in rust. Previously
    the angles() and angles_and_phase() methods of OneQubitEulerDecomposer
    would work with a non-complex dtype in the input, however because the
    rust component of the module is strictly typed to only work with a
    complex128 dtype passing the array to rust to compute the angles and
    phase of the unitary would fail. To address this limitation this commit
    casts the input matrix to be complex before passing it to the rust
    function.

    Fixes Qiskit#9827

    * Cleanup release note

    * Update test/python/quantum_info/test_synthesis.py

    Co-authored-by: Jake Lishman <jake@binhbar.com>

    ---------

    Co-authored-by: Jake Lishman <jake@binhbar.com>

commit 9500f42
Author: Etienne Wodey <44871469+airwoodix@users.noreply.github.com>
Date:   Mon Mar 20 15:30:55 2023 +0100

    transpile: narrow the return type depending on the circuits argument (Qiskit#9799)

    * transpile: narrow the return type depending on the circuits argument

    * Fixup release note

    ---------

    Co-authored-by: Jake Lishman <jake.lishman@ibm.com>

commit 8ceb57d
Author: Takashi Imamichi <31178928+t-imamichi@users.noreply.github.com>
Date:   Mon Mar 20 22:38:07 2023 +0900

    fix qasm with reset (Qiskit#9819)

commit e2f6606
Author: Eric Arellano <14852634+Eric-Arellano@users.noreply.github.com>
Date:   Fri Mar 17 11:36:27 2023 -0600

    Consolidate `pip install` calls in CI (Qiskit#9757)

    * Remove unnecessary `pip install` in CI

    * Consolidate `pip install` calls in CI

    * Add back `-U`

    * Go back to editable install so Rust is in debug mode

    * Add RUST_DEBUG env var so we can avoid editable install

    * Remove SETUPTOOLS_ENABLE_FEATURES and also Aer from lint job

    * See if editable install fixes Pylint

    * Give up on not using editable installs in CI

    I don't know why they're causing issues with loading the Rust extension. But it's not a priority
    to figure that out. This PR is still some forward progress.

commit 2afcebc
Author: Eric Arellano <14852634+Eric-Arellano@users.noreply.github.com>
Date:   Fri Mar 17 11:34:25 2023 -0600

    Fix Tox installing Terra from PyPI (Qiskit#9758)

    * Fix Tox installing Terra from PyPI

    * Don't use editable mode

commit b00a8de
Author: Matthew Treinish <mtreinish@kortar.org>
Date:   Thu Mar 16 18:32:14 2023 -0400

    Stop using mergify merge queue feature (Qiskit#9807)

    Due to recent changes in the mergify configuration/service the merge
    queue feature of mergify is no longer working as expected. It's not
    clear if this just a temporary bug in mergify, a longer term change in
    behavior (which requires all PR authors to be registered on mergify), or
    some incompatibility between the github api and mergify. However,
    because we're no longer able to rely on it we've moved to using github's
    native merge queue feature [1][2] instead. Since this new merge queue
    would conflict with mergify's this commit removes the merge queue
    configuration from the mergify configuration. The configuration for
    stable backporting is left in place because github doesn't natively
    offer that feature and it appears to still work fine.

    [1] https://github.blog/changelog/2023-02-08-pull-request-merge-queue-public-beta/
    [2] https://docs.github.com/en/repositories/configuring-branches-and-merges-in-your-repository/configuring-pull-request-merges/managing-a-merge-queue

commit 07ca200
Author: Julien Gacon <gaconju@gmail.com>
Date:   Thu Mar 16 20:20:04 2023 +0100

    Clip probabilities in ``QuantumState`` (Qiskit#9762)

    * Clip probabilities

    * clip implictly

    * add reno

    * add tests

    * add renormalization

    * use sum, not norm

    * ensure round still works

    * normalizing seems to re-introduce errors

    * Tighten floating-point tests

    In cases of rounding and clipping, it's important that the
    floating-point output is bit-for-bit correct, so the fuzzy tests weren't
    ideal (some of these were strict, but it was inconsistent).  It's better
    to use `assertEqual` rather than `assertTrue` where possible so we get
    better errors on failure.

    ---------

    Co-authored-by: Jake Lishman <jake.lishman@ibm.com>

commit 5a9d041
Author: Jake Lishman <jake.lishman@ibm.com>
Date:   Thu Mar 16 18:50:07 2023 +0000

    Remove useless `into_iter()` on `Range` (Qiskit#9806)

    Clippy has started complaining about this on the stable branch, and it's
    probably correct to do so.

commit bbd023b
Author: Matthew Treinish <mtreinish@kortar.org>
Date:   Thu Mar 16 14:44:44 2023 -0400

    Leverage Rust circuit sequence construction for `OneQubitEulerDecomposer` (Qiskit#9583)

    * Leverage Rust circuit sequence construction for OneQubitEulerDecomposer

    This commit is a follow-up to Qiskit#9578 which added a rust implementation
    of the second half of the single qubit euler decomposition routines and
    leveraged them for the Optimize1qGatesDecomposition transpiler pass.
    With that PR the Optimize1qGatesDecomposition no longer was dependent on
    the OneQubitEulerDecomposer class. This commit continues from that PR
    and updates the OneQubitEulerDecomposer to leverage the same Rust
    implementation internally. Calling a decomposer object will internally
    call the rust function to generate a circuit sequence and then return
    either a QuantumCircuit or DAGCircuit (depending on the options).
    Similarly all the angle computation is done directly in Rust.

    * Add missing atol clamping to mod_2pi

    The python version of the OneQubitEulerDecomposer class had atol
    clamping on it's output from mod_2pi, when this function was ported to
    rust this was not included. At the time it was because nothing set the
    atol parameter when calling mod_2pi (the angle calculation in Qiskit#9185 did
    not have atol and the expansion to construct circuits for
    Optimize1qGatesDecomposition always used the default value). However,
    now that we're expanding OneQubitEulerDecomposer to internally do all
    the calculations in rust we need to support an adjustable atol which
    includes the missing endpoint clamping in mod_2pi. This commit adds this
    missing functionality to the function.

    * Add docstring to mod_2pi rust function

    * Remove mod_2pi python function

commit 0d15506
Author: sg495 <sg495@users.noreply.github.com>
Date:   Thu Mar 16 18:40:33 2023 +0000

    new parameters in `plot_bloch_multivector`: `figsize`, `font_size`, and `title_font_size`  (Qiskit#7264)

    * Update state_visualization.py

    Closes Qiskit#7263

    * Introduced font size, title font size and title padding to plot_bloch_multivector

    * Update state_visualization.py

    Documented new kwargs.

    * Fixed code formatting issues in previous commits of Qiskit#7264.

    * Update qiskit/visualization/bloch.py

    Co-authored-by: Luciano Bello <bel@zurich.ibm.com>

    * Update qiskit/visualization/bloch.py

    Co-authored-by: Luciano Bello <bel@zurich.ibm.com>

    * Update qiskit/visualization/state_visualization.py

    Co-authored-by: Luciano Bello <bel@zurich.ibm.com>

    * Update qiskit/visualization/state_visualization.py

    Co-authored-by: Luciano Bello <bel@zurich.ibm.com>

    * Create update-state-visualization-6836bd53e3a24891.yaml

    Added release notes.

    * Update test_graph_matplotlib_drawer.py

    Included a test for the new features.

    * fix test

    * blacking

    ---------

    Co-authored-by: Luciano Bello <bel@zurich.ibm.com>

commit a85456d
Author: Jim Garrison <jim@garrison.cc>
Date:   Thu Mar 16 14:40:16 2023 -0400

    Remove shared `black`/`lint/`lint-incr` `envdir` in `tox.ini` (Qiskit#9800)

    Under tox3, it was faster to have the `black`, `lint`, and `lint-incr`
    environments share an `envdir`.  However, tox4 recreates the environment
    every time one switches from one to another when they share an `envdir`,
    leading to much slower execution.  Here I've changed these environments
    to all use the default (unique) directory rather than a shared one.

    Closes Qiskit#9782

commit b047a7c
Author: Matthew Treinish <mtreinish@kortar.org>
Date:   Thu Mar 16 17:29:12 2023 -0400

    Attempt to trigger Azure pipelines on merge queue events (Qiskit#9809)

    * Attempt to trigger Azure pipelines on merge queue events

    This commit attempts to add a trigger condition to our azure pipelines
    job to trigger on commits to the gh merge queue branch.

    * Only trigger PR CI in queue, not push CI

    ---------

    Co-authored-by: Jake Lishman <jake.lishman@ibm.com>

commit b4bc559
Author: Luciano Bello <bel@zurich.ibm.com>
Date:   Thu Mar 16 15:56:55 2023 +0100

    Some doc formatting and link, mostly on quantumcircuit.py file (Qiskit#9771)

    * some doc formating and link, mostly on quantumcircuit.py file

    * Update qiskit/circuit/quantumcircuit.py

    Co-authored-by: Julien Gacon <gaconju@gmail.com>

    * ident

    * more typos

    * more typos

    * another iteration

    * Bit and Register

    * notes on Register and Bit

    * Update qiskit/circuit/bit.py

    Co-authored-by: Eric Arellano <14852634+Eric-Arellano@users.noreply.github.com>

    * Update qiskit/circuit/register.py

    Co-authored-by: Eric Arellano <14852634+Eric-Arellano@users.noreply.github.com>

    ---------

    Co-authored-by: Julien Gacon <gaconju@gmail.com>
    Co-authored-by: Eric Arellano <14852634+Eric-Arellano@users.noreply.github.com>
    Co-authored-by: Jake Lishman <jake.lishman@ibm.com>

commit c37cec2
Author: Jim Garrison <jim@garrison.cc>
Date:   Thu Mar 16 00:26:01 2023 -0400

    Remove implicit broadcasting from `Pauli`/label construction of `PauliList` (Qiskit#9779)

    * Remove implicit broadcasting from `Pauli`/label construction of `PauliList`

    * Update releasenotes/notes/paulilist-do-not-broadcast-from-paulis-96de3832fba21b94.yaml

    Co-authored-by: Jake Lishman <jake@binhbar.com>

    ---------

    Co-authored-by: Jake Lishman <jake@binhbar.com>
    Co-authored-by: Jake Lishman <jake.lishman@ibm.com>

commit b0b5541
Author: Eric Arellano <14852634+Eric-Arellano@users.noreply.github.com>
Date:   Wed Mar 15 14:09:13 2023 -0600

    `@deprecate_arguments` and `@deprecate_function` add deprecation to docstring (Qiskit#9790)

commit fa4a136
Author: Alexander Ivrii <alexi@il.ibm.com>
Date:   Wed Mar 15 00:21:35 2023 +0200

    Alternative construction mechanism for HLS config (Qiskit#9413)

    * Alternative construction mechanism for HLS config

    * improved how synthesis methods can be specified

    * fixes

    * pass over release notes

    * adding tests for short form

    * Updating the documentation of HLSConfig and HighLevelSynthesis

    * removing unnecessary import in documentation

    ---------

    Co-authored-by: Luciano Bello <bel@zurich.ibm.com>

commit 6bb4957
Author: Luciano Bello <bel@zurich.ibm.com>
Date:   Tue Mar 14 21:41:02 2023 +0100

    extend the documentation for qiskit.circuit.QuantumCircuit.measure (Qiskit#9698)

    * extend the documentation for qiskit.circuit.QuantumCircuit.measure

    * spelling

    * H

    * qregs and cregs

    * spelling

    * Update qiskit/circuit/quantumcircuit.py

    * Update qiskit/circuit/quantumcircuit.py

    * Update qiskit/circuit/quantumcircuit.py

    * Update qiskit/circuit/quantumcircuit.py

    * examples after Args/Return/Raises

    * Update qiskit/circuit/quantumcircuit.py

    Co-authored-by: Jake Lishman <jake@binhbar.com>

    * short description

    * better description

    * as equivalence

    * shorten it a bit

    * ::

    * raw string

    * lvert

    * Tweak grammar

    ---------

    Co-authored-by: Junye Huang <h.jun.ye@gmail.com>
    Co-authored-by: Jake Lishman <jake@binhbar.com>

commit bf3bb96
Author: Matthew Treinish <mtreinish@kortar.org>
Date:   Tue Mar 14 10:18:45 2023 -0400

    Fix basis_gates and coupling_map backend override in transpile() (Qiskit#9789)

    This commit fixes an issue in the transpile() function when a user
    specified the `backend` argument with a BackendV2 based backend along
    with `basis_gates` or `coupling_map`. In this case the `transpile()` was
    generating the preset pass manager with a target, coupling map, and
    basis gates list. However, most individual passes that take basis gates
    and a Target will prefer to use the target if both are specified. This
    is generally sane behavior at the pass level because the target contains
    more rich data and tighter constraints that a transpiler pass will need
    to worry about. To fix this limitation this commit updates transpile()
    to not use the backend's target if either basis_gates or coupling_map
    are specified.

    Longer term this should no longer be an issue when Qiskit#9256 is implemented
    and we'll be relying solely on a target internally. But this fix is
    needed until Qiskit#9256 is started.

    Fixes Qiskit#9781

    Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>

commit 648da26
Author: Jake Lishman <jake.lishman@ibm.com>
Date:   Tue Mar 14 13:25:52 2023 +0000

    Improve error messages in `Target`-based `GateDirection` pass (Qiskit#9787)

    * Improve error messages in `Target`-based `GateDirection` pass

    The `Target` version of `GateDirection` has more information available
    to make better error messages. It can distinguish cases where the
    failure is because a gate would be valid if flipped but the pass doesn't
    know how to do it, and the case where the gate wouldn't be valid in
    either direction.

    * Reword error message on failed flip

    ---------

    Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>

commit 3005806
Author: Eric Arellano <14852634+Eric-Arellano@users.noreply.github.com>
Date:   Mon Mar 13 13:30:26 2023 -0600

    Add `add_deprecation_to_docstring` for docsite deprecation support (Qiskit#9685)

    * Add deprecations to function docstring

    * Work around issue with multiline strings

    * Better variable name

    * Jake's review feedback

    * Make Napoleon check case-insensitive

    * Promote add_deprecation_to_docstring to be public

    It may be useful for Applications/Ecosystem, when they want this functionality but want to keep using their own deprecation decorators

    * Properly error when metadata line is the first line

    * Tests feedback: don't use helper function and simplify instructions to generate tests

    * Don't use the function with @deprecate_function and @deprecate_arguments yet

    This makes the PR a smaller diff, so easier to review and also less risk when we land that it breaks something. Now, this PR only adds new functionality, the public `add_deprecation_to_docstring` function

    * Update qiskit/utils/deprecation.py

    Co-authored-by: Luciano Bello <bel@zurich.ibm.com>

    * Update qiskit/utils/deprecation.py

    Co-authored-by: Luciano Bello <bel@zurich.ibm.com>

    * Add release note

    ---------

    Co-authored-by: Luciano Bello <bel@zurich.ibm.com>

commit c2affb1
Author: Jake Lishman <jake.lishman@ibm.com>
Date:   Mon Mar 13 16:38:36 2023 +0000

    Fix explicitly calibrated gates in `GateDirection` (Qiskit#9786)

    If there is an explicit calibration given, this overrides the generic
    information from the `CouplingMap` or the `Target` for that particular
    instance, since one can use pulse-level control to define gates on a
    circuit-by-circuit basis that are not generically available in a way
    that can be specified in the coupling or target.

commit 2ce129a
Author: Naoki Kanazawa <nkanazawa1989@gmail.com>
Date:   Mon Mar 13 22:08:35 2023 +0900

    Fix unitary synthesis module to get proper error value when it's empty. (Qiskit#9774)

    Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>

commit 6829bb1
Author: Kazuki Tsuoka <kazukitsuoka@g.ecc.u-tokyo.ac.jp>
Date:   Sun Mar 12 16:27:55 2023 +0900

    Fix `Parameter.is_real()` (Qiskit#9664)

    * fix bug

    * add reno

    * Update releasenotes/notes/fix-parameter-is_real-8b8f99811e58075e.yaml

    ---------

    Co-authored-by: Julien Gacon <gaconju@gmail.com>

commit 5a62949
Author: Luciano Bello <bel@zurich.ibm.com>
Date:   Fri Mar 10 23:40:07 2023 +0100

    Qiskit gates not `qelib1.inc` are now defined when dumped (Qiskit#9777)

    * non-standard gates

    * Qiskit gates not qelib1.inc are now defined when dumped

    ---------

    Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>

commit 5ce80ab
Author: Daniel Puzzuoli <dan.puzzuoli@gmail.com>
Date:   Fri Mar 10 11:49:56 2023 -0800

    Implementing CouplingMap.__eq__ (Qiskit#9766)

    * implementing Coupling.__eq__

    * Update qiskit/transpiler/coupling.py

    Co-authored-by: Matthew Treinish <mtreinish@kortar.org>

    * adding comments to test, and adding release note

    * black formatting

    * updating CouplingMap.__eq__ to check edge list equality instead of isomorphism

    * updating release notes

    * updating test doc string

    * Update test/python/transpiler/test_coupling.py

    Co-authored-by: Matthew Treinish <mtreinish@kortar.org>

    * Update test/python/transpiler/test_coupling.py

    Co-authored-by: Matthew Treinish <mtreinish@kortar.org>

    * Update test/python/transpiler/test_coupling.py

    Co-authored-by: Matthew Treinish <mtreinish@kortar.org>

    * Update test/python/transpiler/test_coupling.py

    Co-authored-by: Matthew Treinish <mtreinish@kortar.org>

    ---------

    Co-authored-by: Matthew Treinish <mtreinish@kortar.org>

commit 332f4b2
Author: Jake Lishman <jake.lishman@ibm.com>
Date:   Fri Mar 10 08:31:36 2023 +0000

    Fix zero-qubit `Pauli` label strings (Qiskit#9726)

    It was previously possible to construct a zero-qubit Pauli operator
    using the array form (`Pauli(([], []))`), or by empty-slicing an
    existing Pauli (`Pauli("IXZ")[[]]`).  This commit completes the set by
    making labels with no qubits work as well, for consistency.

    Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>

commit 3284ea0
Author: Eric Arellano <14852634+Eric-Arellano@users.noreply.github.com>
Date:   Thu Mar 9 17:56:54 2023 -0600

    Fix `tox -e docs` for macOS (Qiskit#9765)

    * Fix `tox -e docs` for macOS

    Co-authored-by: Jake Lishman <jake@binhbar.com>

    * Fix two issues. Duh, thanks Jake

    * Update Azure job to set RUST_DEBUG

    Not strictly necessary since Tox already sets it. But makes things consistent and avoids accidentally
    removing this in the future

    ---------

    Co-authored-by: Jake Lishman <jake@binhbar.com>

commit d272919
Author: Matthew Treinish <mtreinish@kortar.org>
Date:   Thu Mar 9 18:11:05 2023 -0500

    Suppress PulseSimulator deprecation warning in tests (Qiskit#9767)

    In the recently released qiskit-aer 0.12.0 the PulseSimulator backend
    (used as its name implies to simulate pulse schedules) was deprecated in
    favor of the actively maintained qiskit-dynamcis package. This
    deprecation is causing test failures when running our test suite with
    qiskit-aer installed because a single test was opportunistically using
    the PulseSimulator backend when aer was installed. This commit adds an
    assertion to catch the DeprecationWarning and adds a comment to rewrite
    the test to use dynamics. Although we may not wish to add the optional
    bidirectional dependency for a single test, in which case we should just
    delete the test. But that is a discussion for a follow up PR when CI is
    not blocked by an upstream package's release. This commit is just a
    short term workaround to unblock forward progress.

commit fa7ac68
Author: Eric Arellano <14852634+Eric-Arellano@users.noreply.github.com>
Date:   Wed Mar 8 12:05:55 2023 -0600

    Don't require Tweedledum for `qiskit.circuit.classicalfunction` on import (Qiskit#9754)

    * Don't require Tweedledum for `qiskit.circuit.classicalfunction` on import

    * Review feedback

commit 9d33618
Author: Jake Lishman <jake.lishman@ibm.com>
Date:   Wed Mar 8 15:47:39 2023 +0000

    Fix docs build on case-insensitive systems (Qiskit#9748)

    During the switchover of the `SymbolicPulse` classes in the pulse
    library, there are several objects documented under
    `qiskit.library.pulse` that differ only by capitalisation.  Under
    `autosummary`, these therefore generate files with names that differ
    only by capitalisation, which causes naming clashes on systems that have
    case-insensitive semantics, such as macOS.  This then causes warnings to
    be emitted from the Sphinx build, failing it.

    Autosummary has this setting that can be used as a workaround.  I went
    this route rather than converting the documentation to use more inline
    documentation for the library for now, because I expect the clash to be
    more short-lived, and I didn't want to make a change that meaningful
    impacts the style of the documentation without knowing the full context
    around it.

    Co-authored-by: Eric Arellano <14852634+Eric-Arellano@users.noreply.github.com>

commit 16f6adb
Author: Junye Huang <h.jun.ye@gmail.com>
Date:   Wed Mar 8 14:09:39 2023 +0100

    Remove non-existent files from MANIFEST.in (Qiskit#9752)

    * remove qiskit/schemas

    * remove include cython files

    * remove include pickle files

commit fe12c26
Author: Eric Arellano <14852634+Eric-Arellano@users.noreply.github.com>
Date:   Tue Mar 7 18:44:38 2023 -0600

    Tag Eric in Rust changes (Qiskit#9749)

commit c6cd0d5
Author: Jake Lishman <jake.lishman@ibm.com>
Date:   Tue Mar 7 23:12:39 2023 +0000

    Add structure for multiple Rust crates (Qiskit#9742)

    * Add structure for multiplie Rust extension crates

    This is a precursor to adding an entirely separate and self-contained
    crate to handle parsing of OpenQASM 2 (not 3 - this is kind of like a
    trial run for that).  It could conceivably still live within
    `qiskit._accelerate`, but having separate crates helps us enforce more
    sane API barriers, and has improvements in the incremental build time
    when working on only one of the Rust extensions.

    The intent after this commit is still to have `qiskit._accelerate` as an
    easy catch-all for accelerators for Python.  Developers should not need
    to be concerned with defining a new crate for every new feature, and for
    the most part `_accelerate` is still logically interoperative within
    itself (for example, `NLayout` is used all over).  This is just laying
    out the groundwork so more complex crate additions _can_ also be made.

    Some of the niceties to do with Cargo workspaces only became stabilised
    in Rust 1.64.  In particular, inheritance from the workspace root for
    things like the package version, Rust version, and dependencies only
    came in then.  For now, the `workspace.packages` key in the root
    `Cargo.toml` is ignored with a small warning during the build, but I've
    put it in place mostly to keep track of what we can change once the MSRV
    becomes 1.64 or greater (likely not til at least Terra 0.26).

    * Add README.md to crates/accelerate

    * Correct licence metadata

commit 2553376
Author: Julien Gacon <gaconju@gmail.com>
Date:   Tue Mar 7 13:15:22 2023 +0100

    Fix bitstring padding in the `BackendSampler` (Qiskit#9744)

    * fix padding

    * add reno

commit 5c49d14
Author: Etienne Wodey <44871469+airwoodix@users.noreply.github.com>
Date:   Mon Mar 6 20:25:02 2023 +0100

    test/transpiler: add regression tests for Qiskit#9701 (Qiskit#9739)

commit 80ca1f3
Author: Shelly Garion <46566946+ShellyGarion@users.noreply.github.com>
Date:   Mon Mar 6 19:23:14 2023 +0200

    Add inverse method to ECRGate (Qiskit#9733)

    * add inverse method to ECRGate

    * add release notes

    * Fix sphinx tags

    * Recategorise as bugfix

    ---------

    Co-authored-by: Julien Gacon <gaconju@gmail.com>
    Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
    Co-authored-by: Jake Lishman <jake.lishman@ibm.com>

commit 126c9ba
Author: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Date:   Mon Mar 6 14:12:24 2023 +0000

    Bump rayon from 1.6.1 to 1.7.0 (Qiskit#9737)

    Bumps [rayon](https://github.com/rayon-rs/rayon) from 1.6.1 to 1.7.0.
    - [Release notes](https://github.com/rayon-rs/rayon/releases)
    - [Changelog](https://github.com/rayon-rs/rayon/blob/master/RELEASES.md)
    - [Commits](rayon-rs/rayon@rayon-core-v1.6.1...rayon-core-v1.7.0)

    ---
    updated-dependencies:
    - dependency-name: rayon
      dependency-type: direct:production
      update-type: version-update:semver-minor
    ...

    Signed-off-by: dependabot[bot] <support@github.com>
    Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
    Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>

commit 6d12cdd
Author: Junye Huang <h.jun.ye@gmail.com>
Date:   Mon Mar 6 13:57:14 2023 +0100

    Update slack invite link to https://qisk.it/join-slack (Qiskit#9736)

commit b99ef32
Author: Jake Lishman <jake.lishman@ibm.com>
Date:   Sun Mar 5 15:59:19 2023 +0000

    Add docs team to tag list for docs configuation changes (Qiskit#9714)

    This adds the current docs team to the qiskit-bot configuration to get
    automatically tagged when changes to the `docs` folder are made.  For
    the most part, this should just be about the documentation build itself,
    which is under their umbrella, rather than the text of the API docs
    which is largely generated from Terra's Python source code.

    Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>

commit dbdf867
Author: John Lapeyre <jlapeyre@users.noreply.github.com>
Date:   Sat Mar 4 13:43:06 2023 -0500

    Fix typo in docstring (Qiskit#9730)
ElePT pushed a commit to ElePT/qiskit that referenced this pull request Apr 5, 2023
* Fix circuit mypy errors

* Fix 2

* Remove ignores

* Remove ignores for sure

* Remove TODO

* fix for docs

* Add annotation

* Fix control bug, remove unnecessary annotation

* Add test and fix description

* Fix test

* Reformat

* Fix test description

* Update releasenotes/notes/fix-control-with-string-parameter-4eb8a308170e08db.yaml

Co-authored-by: Julien Gacon <gaconju@gmail.com>

* More minor fixes

* Fix callable import

* Fix Instruction import for sphinx

* Replace list[Any] with list

---------

Co-authored-by: Julien Gacon <gaconju@gmail.com>
giacomoRanieri pushed a commit to giacomoRanieri/qiskit-terra that referenced this pull request Apr 16, 2023
* Fix circuit mypy errors

* Fix 2

* Remove ignores

* Remove ignores for sure

* Remove TODO

* fix for docs

* Add annotation

* Fix control bug, remove unnecessary annotation

* Add test and fix description

* Fix test

* Reformat

* Fix test description

* Update releasenotes/notes/fix-control-with-string-parameter-4eb8a308170e08db.yaml

Co-authored-by: Julien Gacon <gaconju@gmail.com>

* More minor fixes

* Fix callable import

* Fix Instruction import for sphinx

* Replace list[Any] with list

---------

Co-authored-by: Julien Gacon <gaconju@gmail.com>
king-p3nguin pushed a commit to king-p3nguin/qiskit-terra that referenced this pull request May 22, 2023
* Fix circuit mypy errors

* Fix 2

* Remove ignores

* Remove ignores for sure

* Remove TODO

* fix for docs

* Add annotation

* Fix control bug, remove unnecessary annotation

* Add test and fix description

* Fix test

* Reformat

* Fix test description

* Update releasenotes/notes/fix-control-with-string-parameter-4eb8a308170e08db.yaml

Co-authored-by: Julien Gacon <gaconju@gmail.com>

* More minor fixes

* Fix callable import

* Fix Instruction import for sphinx

* Replace list[Any] with list

---------

Co-authored-by: Julien Gacon <gaconju@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Changelog: Bugfix Include in the "Fixed" section of the changelog Community PR PRs from contributors that are not 'members' of the Qiskit repo mypy Work related to support improving type hints in Qiskti code
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

6 participants