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 (algorithms) #8271

Merged
merged 19 commits into from
Apr 5, 2023
Merged

Fix mypy errors (algorithms) #8271

merged 19 commits into from
Apr 5, 2023

Conversation

Randl
Copy link
Contributor

@Randl Randl commented Jun 29, 2022

Summary

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

Details and comments

There are ~475 errors left. This is the module with the most type errors so far.
(UPD 04.10.22: I've rebased on the current master. There appear to be many new errors)

All error list
qiskit/algorithms/eigensolvers/vqd.py:156: error: Signature of "initial_point" incompatible with supertype "VariationalAlgorithm"  [override]
qiskit/algorithms/eigensolvers/vqd.py:156: note:      Superclass:
qiskit/algorithms/eigensolvers/vqd.py:156: note:          @overload
qiskit/algorithms/eigensolvers/vqd.py:156: note:          def initial_point(self) -> Optional[ndarray[Any, Any]]
qiskit/algorithms/eigensolvers/vqd.py:156: note:      Subclass:
qiskit/algorithms/eigensolvers/vqd.py:156: note:          @overload
qiskit/algorithms/eigensolvers/vqd.py:156: note:          def initial_point(self) -> Optional[Sequence[float]]
qiskit/algorithms/eigensolvers/vqd.py:157: error: Signature of "initial_point" incompatible with supertype "VariationalAlgorithm"  [override]
qiskit/algorithms/eigensolvers/vqd.py:157: note:      Superclass:
qiskit/algorithms/eigensolvers/vqd.py:157: note:          @overload
qiskit/algorithms/eigensolvers/vqd.py:157: note:          def initial_point(self) -> Optional[ndarray[Any, Any]]
qiskit/algorithms/eigensolvers/vqd.py:157: note:      Subclass:
qiskit/algorithms/eigensolvers/vqd.py:157: note:          def initial_point(self) -> Optional[Sequence[float]]
qiskit/algorithms/eigensolvers/vqd.py:172: error: Property "num_qubits" defined in "QuantumCircuit" is read-only  [misc]
qiskit/algorithms/eigensolvers/vqd.py:210: error: Incompatible types in assignment (expression has type "dict_items[str, Union[BaseOperator, PauliSumOp]]", variable has type "enumerate[Union[BaseOperator, PauliSumOp]]")  [assignment]
qiskit/algorithms/eigensolvers/vqd.py:214: error: Invalid index type "int" for "Dict[str, Union[BaseOperator, PauliSumOp]]"; expected type "str"  [index]
qiskit/algorithms/eigensolvers/vqd.py:223: error: Argument 1 to "abs" has incompatible type "Union[complex, ParameterExpression]"; expected "SupportsAbs[float]"  [arg-type]
qiskit/algorithms/eigensolvers/vqd.py:234: error: Incompatible types in assignment (expression has type "Sequence[float]", variable has type "List[Any]")  [assignment]
qiskit/algorithms/eigensolvers/vqd.py:245: error: Argument "prev_states" to "_get_evaluate_energy" of "VQD" has incompatible type "Sequence[Dict[Any, Any]]"; expected "Optional[List[ndarray[Any, Any]]]"  [arg-type]
qiskit/algorithms/eigensolvers/vqd.py:252: error: Missing positional argument "jac" in call to "__call__" of "Minimizer"  [call-arg]
qiskit/algorithms/eigensolvers/vqd.py:253: error: Argument "fun" to "__call__" of "Minimizer" has incompatible type "Callable[[ndarray[Any, Any]], Union[float, List[float]]]"; expected "Callable[[ndarray[Any, Any]], float]"  [arg-type]
qiskit/algorithms/eigensolvers/vqd.py:253: error: Argument "x0" to "__call__" of "Minimizer" has incompatible type "Sequence[float]"; expected "ndarray[Any, Any]"  [arg-type]
qiskit/algorithms/eigensolvers/vqd.py:257: error: Argument "fun" to "minimize" of "Optimizer" has incompatible type "Callable[[ndarray[Any, Any]], Union[float, List[float]]]"; expected "Callable[[Union[float, ndarray[Any, Any]]], float]"  [arg-type]
qiskit/algorithms/eigensolvers/vqd.py:257: error: Argument "x0" to "minimize" of "Optimizer" has incompatible type "Sequence[float]"; expected "Union[float, ndarray[Any, Any]]"  [arg-type]
qiskit/algorithms/eigensolvers/vqd.py:266: error: Argument 4 to "estimate_observables" has incompatible type "ndarray[Any, Any]"; expected "Optional[Sequence[float]]"  [arg-type]
qiskit/algorithms/eigensolvers/vqd.py:292: error: Incompatible types in assignment (expression has type "ndarray[Any, dtype[Any]]", variable has type "Optional[Sequence[ndarray[Any, Any]]]")  [assignment]
qiskit/algorithms/eigensolvers/vqd.py:293: error: Incompatible types in assignment (expression has type "ndarray[Any, dtype[Any]]", variable has type "Optional[Sequence[float]]")  [assignment]
qiskit/algorithms/eigensolvers/vqd.py:294: error: Incompatible types in assignment (expression has type "ndarray[Any, dtype[Any]]", variable has type "Optional[Sequence[int]]")  [assignment]
qiskit/algorithms/eigensolvers/vqd.py:295: error: Incompatible types in assignment (expression has type "ndarray[Any, dtype[Any]]", variable has type "Optional[Sequence[float]]")  [assignment]
qiskit/algorithms/eigensolvers/vqd.py:341: error: Argument 1 to "bind_parameters" of "QuantumCircuit" has incompatible type "ndarray[Any, Any]"; expected "Union[Mapping[Parameter, float], Sequence[float]]"  [arg-type]
qiskit/algorithms/eigensolvers/vqd.py:347: error: Argument "parameter_values" to "run" of "BaseEstimator" has incompatible type "List[ndarray[Any, Any]]"; expected "Union[Sequence[float], Sequence[Sequence[float]], None]"  [arg-type]
qiskit/algorithms/eigensolvers/vqd.py:360: error: Argument 3 to "run" of "BaseStateFidelity" has incompatible type "List[ndarray[Any, Any]]"; expected "Union[Sequence[float], Sequence[Sequence[float]], None]"  [arg-type]
qiskit/algorithms/eigensolvers/vqd.py:361: error: Argument 4 to "run" of "BaseStateFidelity" has incompatible type "List[List[ndarray[Any, Any]]]"; expected "Union[Sequence[float], Sequence[Sequence[float]], None]"  [arg-type]
qiskit/algorithms/eigensolvers/vqd.py:372: error: Too many arguments  [call-arg]
qiskit/algorithms/eigensolvers/vqd.py:378: error: Incompatible return value type (got "Callable[[ndarray[Any, Any]], Union[ndarray[Any, Any], float]]", expected "Callable[[ndarray[Any, Any]], Union[float, List[float]]]")  [return-value]
qiskit/algorithms/eigensolvers/vqd.py:389: error: Incompatible types in assignment (expression has type "List[<nothing>]", variable has type "Optional[ndarray[Any, Any]]")  [assignment]
qiskit/algorithms/amplitude_amplifiers/grover.py:273: error: "QuantumCircuit" has no attribute "reflection_qubits"  [attr-defined]
qiskit/algorithms/amplitude_amplifiers/grover.py:275: error: Incompatible types in assignment (expression has type "Union[Mapping[int, float], Iterator[int], int]", variable has type "Iterator[int]")  [assignment]
qiskit/algorithms/amplitude_amplifiers/grover.py:328: error: Incompatible types in assignment (expression has type "ndarray[Any, dtype[Any]]", variable has type "Dict[str, Any]")  [assignment]
qiskit/algorithms/amplitude_amplifiers/grover.py:330: error: "Dict[str, Any]" has no attribute "max"  [attr-defined]
qiskit/algorithms/amplitude_amplifiers/grover.py:330: error: "Dict[str, Any]" has no attribute "min"  [attr-defined]
qiskit/algorithms/amplitude_amplifiers/grover.py:405: error: Argument 1 to "len" has incompatible type "Union[Mapping[int, float], List[int], Iterator[int], int, None]"; expected "Sized"  [arg-type]
qiskit/algorithms/amplitude_amplifiers/grover.py:407: error: Value of type "Union[Mapping[int, float], List[int], Iterator[int], int, None]" is not indexable  [index]
qiskit/algorithms/amplitude_amplifiers/grover.py:407: error: Incompatible types in assignment (expression has type "Union[float, Any]", variable has type "Optional[int]")  [assignment]
qiskit/algorithms/amplitude_estimators/ae.py:380: error: Item "ndarray[Any, Any]" of "Union[ndarray[Any, Any], Dict[str, int]]" has no attribute "values"  [union-attr]
qiskit/algorithms/amplitude_estimators/ae.py:405: error: Incompatible types in assignment (expression has type "Dict[int, float]", variable has type "Dict[float, float]")  [assignment]
qiskit/algorithms/amplitude_estimators/ae.py:409: error: Incompatible types in assignment (expression has type "Dict[float, float]", variable has type "Dict[int, float]")  [assignment]
qiskit/algorithms/amplitude_estimators/ae.py:428: error: Incompatible types in assignment (expression has type "Tuple[float, ...]", variable has type "Tuple[float, float]")  [assignment]
qiskit/algorithms/amplitude_estimators/ae.py:605: error: Incompatible return value type (got "Tuple[float, ...]", expected "Tuple[float, float]")  [return-value]
qiskit/algorithms/amplitude_estimators/ae.py:679: error: Incompatible return value type (got "Tuple[float, ...]", expected "Tuple[float, float]")  [return-value]
qiskit/algorithms/amplitude_estimators/fae.py:326: error: Incompatible types in assignment (expression has type "float", variable has type "int")  [assignment]
qiskit/algorithms/amplitude_estimators/fae.py:330: error: Incompatible types in assignment (expression has type "List[Any]", variable has type "Tuple[float, float]")  [assignment]
qiskit/algorithms/amplitude_estimators/fae.py:331: error: Incompatible types in assignment (expression has type "Tuple[float, ...]", variable has type "Tuple[float, float]")  [assignment]
qiskit/algorithms/amplitude_estimators/iae.py:321: error: Argument 1 has incompatible type "List[str]"; expected "str"  [arg-type]
qiskit/algorithms/amplitude_estimators/iae.py:436: error: Name "a_confidence_interval" already defined on line 373  [no-redef]
qiskit/algorithms/amplitude_estimators/iae.py:454: error: "float" object is not iterable  [misc]
qiskit/algorithms/amplitude_estimators/iae.py:516: error: Incompatible types in assignment (expression has type "floating[Any]", variable has type "float")  [assignment]
qiskit/algorithms/amplitude_estimators/iae.py:518: error: Incompatible types in assignment (expression has type "Tuple[float, ...]", variable has type "Tuple[float, float]")  [assignment]
qiskit/algorithms/amplitude_estimators/iae.py:520: error: Argument 1 has incompatible type "floating[Any]"; expected "float"  [arg-type]
qiskit/algorithms/amplitude_estimators/iae.py:524: error: Incompatible types in assignment (expression has type "Tuple[float, ...]", variable has type "Tuple[float, float]")  [assignment]
qiskit/algorithms/amplitude_estimators/mlae.py:247: error: Incompatible types in assignment (expression has type "List[float]", variable has type "Optional[Tuple[float, float]]")  [assignment]
qiskit/algorithms/amplitude_estimators/mlae.py:262: error: Incompatible return value type (got "Tuple[float, ...]", expected "Tuple[float, float]")  [return-value]
qiskit/algorithms/amplitude_estimators/mlae.py:345: error: Incompatible types in assignment (expression has type "List[ndarray[Any, dtype[Any]]]", variable has type "Union[ndarray[Any, Any], Dict[str, int], None]")  [assignment]
qiskit/algorithms/amplitude_estimators/mlae.py:355: error: Incompatible types in assignment (expression has type "List[Any]", variable has type "Union[ndarray[Any, Any], Dict[str, int], None]")  [assignment]
qiskit/algorithms/amplitude_estimators/mlae.py:364: error: Type cannot be declared in assignment to non-self attribute  [misc]
qiskit/algorithms/amplitude_estimators/mlae.py:364: error: Incompatible types in assignment (expression has type "List[<nothing>]", variable has type "Union[ndarray[Any, Any], Dict[str, int], None]")  [assignment]
qiskit/algorithms/amplitude_estimators/mlae.py:372: error: Item "ndarray[Any, Any]" of "Union[ndarray[Any, Any], Dict[str, int]]" has no attribute "append"  [union-attr]
qiskit/algorithms/amplitude_estimators/mlae.py:372: error: Item "Dict[str, int]" of "Union[ndarray[Any, Any], Dict[str, int]]" has no attribute "append"  [union-attr]
qiskit/algorithms/amplitude_estimators/mlae.py:381: error: Item "ndarray[Any, Any]" of "Union[ndarray[Any, Any], Dict[str, int]]" has no attribute "append"  [union-attr]
qiskit/algorithms/amplitude_estimators/mlae.py:381: error: Item "Dict[str, int]" of "Union[ndarray[Any, Any], Dict[str, int]]" has no attribute "append"  [union-attr]
qiskit/algorithms/amplitude_estimators/mlae.py:387: error: "float" object is not iterable  [misc]
qiskit/algorithms/amplitude_estimators/mlae.py:388: error: Argument 1 to "compute_mle" of "MaximumLikelihoodAmplitudeEstimation" has incompatible type "Union[ndarray[Any, Any], Dict[str, int]]"; expected "List[Union[Dict[str, int], ndarray[Any, Any]]]"  [arg-type]
qiskit/algorithms/amplitude_estimators/mlae.py:406: error: Incompatible types in assignment (expression has type "Tuple[float, ...]", variable has type "Tuple[float, float]")  [assignment]
qiskit/algorithms/amplitude_estimators/mlae.py:435: error: Function "builtins.callable" is not valid as a type  [valid-type]
qiskit/algorithms/amplitude_estimators/mlae.py:435: note: Perhaps you meant "typing.Callable" instead of "callable"?
qiskit/algorithms/amplitude_estimators/mlae.py:575: error: Incompatible return value type (got "Tuple[float, ...]", expected "Tuple[float, float]")  [return-value]
qiskit/algorithms/amplitude_estimators/mlae.py:626: error: Incompatible return value type (got "Tuple[float, ...]", expected "Tuple[float, float]")  [return-value]
qiskit/algorithms/amplitude_estimators/mlae.py:656: error: Argument 1 has incompatible type "List[str]"; expected "str"  [arg-type]
qiskit/algorithms/amplitude_estimators/mlae.py:664: error: Item "ndarray[Any, Any]" of "Union[ndarray[Any, Any], List[float]]" has no attribute "append"  [union-attr]
qiskit/algorithms/amplitude_estimators/mlae.py:664: error: Item "ndarray[Any, Any]" of "Union[ndarray[Any, Any], List[float], Dict[str, int]]" has no attribute "values"  [union-attr]
qiskit/algorithms/amplitude_estimators/mlae.py:664: error: Item "List[float]" of "Union[ndarray[Any, Any], List[float], Dict[str, int]]" has no attribute "values"  [union-attr]
qiskit/algorithms/amplitude_estimators/mlae.py:667: error: Generator has incompatible item type "Union[Any, int]"; expected "Union[bool, Literal[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, -1, -2, -3, -4, -5, -6, -7, -8, -9, -10, -11, -12, -13, -14, -15, -16, -17, -18, -19, -20, 0]]"  [misc]
qiskit/algorithms/amplitude_estimators/mlae.py:668: error: Item "ndarray[Any, Any]" of "Union[ndarray[Any, Any], List[float], Dict[str, int]]" has no attribute "items"  [union-attr]
qiskit/algorithms/amplitude_estimators/mlae.py:668: error: Item "List[float]" of "Union[ndarray[Any, Any], List[float], Dict[str, int]]" has no attribute "items"  [union-attr]
qiskit/algorithms/amplitude_estimators/mlae.py:673: error: Incompatible return value type (got "Tuple[List[float], Union[ndarray[Any, Any], List[float]]]", expected "Tuple[List[float], List[int]]")  [return-value]
qiskit/algorithms/aux_ops_evaluator.py:100: error: Argument 1 to "real" has incompatible type "Union[OperatorBase, complex]"; expected "_SupportsReal[float]"  [arg-type]
qiskit/algorithms/aux_ops_evaluator.py:167: error: Incompatible types in assignment (expression has type "zip[Tuple[str, Tuple[complex, complex]]]", variable has type "enumerate[Tuple[complex, complex]]")  [assignment]
qiskit/algorithms/aux_ops_evaluator.py:169: error: Invalid index type "int" for "Union[List[Optional[OperatorBase]], Dict[str, OperatorBase]]"; expected type "str"  [index]
qiskit/algorithms/aux_ops_evaluator.py:170: error: Invalid index type "int" for "Dict[str, Tuple[complex, complex]]"; expected type "str"  [index]
qiskit/algorithms/aux_ops_evaluator.py:199: error: Item "Backend" of "Union[QuantumInstance, Backend]" has no attribute "run_config"  [union-attr]
qiskit/algorithms/eigen_solvers/numpy_eigen_solver.py:191: error: Incompatible types in assignment (expression has type "dict_items[str, OperatorBase]", variable has type "enumerate[OperatorBase]")  [assignment]
qiskit/algorithms/eigen_solvers/numpy_eigen_solver.py:196: error: "OperatorBase" has no attribute "coeff"  [attr-defined]
qiskit/algorithms/eigen_solvers/numpy_eigen_solver.py:204: error: Incompatible types in assignment (expression has type "Union[OperatorBase, complex]", variable has type "float")  [assignment]
qiskit/algorithms/eigen_solvers/numpy_eigen_solver.py:208: error: Invalid index type "int" for "Dict[str, Tuple[complex, complex]]"; expected type "str"  [index]
qiskit/algorithms/eigen_solvers/vqd.py:185: error: Incompatible types in assignment (expression has type "Union[Optimizer, Minimizer, None]", variable has type "Optimizer")  [assignment]
qiskit/algorithms/eigen_solvers/vqd.py:194: error: Incompatible types in assignment (expression has type "Union[QuantumInstance, Backend]", variable has type "Optional[QuantumInstance]")  [assignment]
qiskit/algorithms/eigen_solvers/vqd.py:286: error: Incompatible return value type (got "Optional[Callable[[int, ndarray[Any, Any], float, float], None]]", expected "Optional[Callable[[int, ndarray[Any, Any], float, float, int], None]]")  [return-value]
qiskit/algorithms/eigen_solvers/vqd.py:291: error: Incompatible types in assignment (expression has type "Optional[Callable[[int, ndarray[Any, Any], float, float, int], None]]", variable has type "Optional[Callable[[int, ndarray[Any, Any], float, float], None]]")  [assignment]
qiskit/algorithms/eigen_solvers/vqd.py:309: error: Property "num_qubits" defined in "QuantumCircuit" is read-only  [misc]
qiskit/algorithms/eigen_solvers/vqd.py:414: error: Argument 1 to "assign_parameters" of "QuantumCircuit" has incompatible type "Union[List[float], List[Parameter], ndarray[Any, Any]]"; expected "Union[Mapping[Parameter, Union[ParameterExpression, float]], Sequence[Union[ParameterExpression, float]]]"  [arg-type]
qiskit/algorithms/eigen_solvers/vqd.py:439: error: Item "Tuple[ABC, ...]" of "Union[OperatorBase, Tuple[OperatorBase, ExpectationBase]]" has no attribute "to_circuit_op"  [union-attr]
qiskit/algorithms/eigen_solvers/vqd.py:475: error: Argument 1 to "bind_parameters" of "QuantumCircuit" has incompatible type "ndarray[Any, Any]"; expected "Union[Mapping[Parameter, float], Sequence[float]]"  [arg-type]
qiskit/algorithms/eigen_solvers/vqd.py:479: error: Argument 1 to "real" has incompatible type "Union[OperatorBase, complex]"; expected "_SupportsReal[float]"  [arg-type]
qiskit/algorithms/eigen_solvers/vqd.py:504: error: Incompatible types in assignment (expression has type "zip[Tuple[str, Tuple[Any, Any]]]", variable has type "enumerate[Tuple[Any, Any]]")  [assignment]
qiskit/algorithms/eigen_solvers/vqd.py:507: error: Invalid index type "int" for "Union[List[Optional[OperatorBase]], Dict[str, OperatorBase]]"; expected type "str"  [index]
qiskit/algorithms/eigen_solvers/vqd.py:508: error: Invalid index type "int" for "Dict[str, Tuple[complex, complex]]"; expected type "str"  [index]
qiskit/algorithms/eigen_solvers/vqd.py:541: error: Incompatible types in assignment (expression has type "dict_items[str, OperatorBase]", variable has type "enumerate[OperatorBase]")  [assignment]
qiskit/algorithms/eigen_solvers/vqd.py:542: error: Incompatible types in assignment (expression has type "Dict[<nothing>, <nothing>]", variable has type "List[PauliSumOp]")  [assignment]
qiskit/algorithms/eigen_solvers/vqd.py:545: error: No overload variant of "__setitem__" of "list" matches argument types "int", "OperatorBase"  [call-overload]
qiskit/algorithms/eigen_solvers/vqd.py:545: note: Possible overload variants:
qiskit/algorithms/eigen_solvers/vqd.py:545: note:     def __setitem__(self, SupportsIndex, PauliSumOp) -> None
qiskit/algorithms/eigen_solvers/vqd.py:545: note:     def __setitem__(self, slice, Iterable[PauliSumOp]) -> None
qiskit/algorithms/eigen_solvers/vqd.py:547: error: Incompatible types in assignment (expression has type "List[PauliSumOp]", variable has type "Union[List[Optional[OperatorBase]], Dict[str, OperatorBase], None]")  [assignment]
qiskit/algorithms/eigen_solvers/vqd.py:554: error: Argument 1 to "abs" has incompatible type "Union[complex, ParameterExpression]"; expected "SupportsAbs[float]"  [arg-type]
qiskit/algorithms/eigen_solvers/vqd.py:556: error: "OperatorBase" has no attribute "coeff"  [attr-defined]
qiskit/algorithms/eigen_solvers/vqd.py:556: error: "OperatorBase" has no attribute "__iter__"; maybe "__str__"? (not iterable)  [attr-defined]
qiskit/algorithms/eigen_solvers/vqd.py:576: error: "Callable[[ndarray[Any, Any]], Union[float, List[float]]]" object is not iterable  [misc]
qiskit/algorithms/eigen_solvers/vqd.py:600: error: Argument "fun" to "minimize" of "Optimizer" has incompatible type "Union[Any, Callable[[ndarray[Any, Any]], Union[float, List[float]]]]"; expected "Callable[[Union[float, ndarray[Any, Any]]], float]"  [arg-type]
qiskit/algorithms/eigen_solvers/vqd.py:600: error: Argument "jac" to "minimize" of "Optimizer" has incompatible type "Callable[[Iterable[Any]], ndarray[Any, Any]]"; expected "Optional[Callable[[Union[float, ndarray[Any, Any]]], Union[float, ndarray[Any, Any]]]]"  [arg-type]
qiskit/algorithms/eigen_solvers/vqd.py:712: error: "OperatorBase" object is not iterable  [misc]
qiskit/algorithms/eigen_solvers/vqd.py:713: error: Argument 1 to "construct_expectation" of "VQD" has incompatible type "ParameterView"; expected "Union[List[float], List[Parameter], ndarray[Any, Any]]"  [arg-type]
qiskit/algorithms/eigen_solvers/vqd.py:718: error: Argument 1 to "bind_parameters" of "QuantumCircuit" has incompatible type "ndarray[Any, Any]"; expected "Union[Mapping[Parameter, float], Sequence[float]]"  [arg-type]
qiskit/algorithms/eigen_solvers/vqd.py:757: error: Item "OperatorBase" of "Union[OperatorBase, complex]" has no attribute "primitive"  [union-attr]
qiskit/algorithms/eigen_solvers/vqd.py:757: error: Item "complex" of "Union[OperatorBase, complex]" has no attribute "primitive"  [union-attr]
qiskit/algorithms/eigen_solvers/vqd.py:759: error: Item "OperatorBase" of "Union[OperatorBase, complex]" has no attribute "to_dict_fn"  [union-attr]
qiskit/algorithms/eigen_solvers/vqd.py:759: error: Item "complex" of "Union[OperatorBase, complex]" has no attribute "to_dict_fn"  [union-attr]
qiskit/algorithms/eigen_solvers/vqd.py:793: error: Incompatible types in assignment (expression has type "int", variable has type "None")  [assignment]
qiskit/algorithms/eigensolvers/eigensolver.py:87: error: Incompatible types in assignment (expression has type "ndarray[Any, Any]", variable has type "None")  [assignment]
qiskit/algorithms/eigensolvers/eigensolver.py:104: error: Incompatible types in assignment (expression has type "List[Union[List[Optional[Tuple[complex, Dict[str, Any]]]], Dict[str, Tuple[complex, Dict[str, Any]]]]]", variable has type "None")  [assignment]
qiskit/algorithms/eigensolvers/numpy_eigensolver.py:144: error: "BaseOperator" has no attribute "data"  [attr-defined]
qiskit/algorithms/eigensolvers/numpy_eigensolver.py:145: error: "BaseOperator" has no attribute "data"  [attr-defined]
qiskit/algorithms/eigensolvers/numpy_eigensolver.py:147: error: Incompatible types in assignment (expression has type "ndarray[Any, dtype[complexfloating[_64Bit, _64Bit]]]", variable has type "ndarray[Any, dtype[floating[_64Bit]]]")  [assignment]
qiskit/algorithms/eigensolvers/numpy_eigensolver.py:147: error: "BaseOperator" has no attribute "data"  [attr-defined]
qiskit/algorithms/eigensolvers/numpy_eigensolver.py:174: error: Incompatible types in assignment (expression has type "List[Union[List[Optional[Tuple[complex, complex]]], Dict[str, Tuple[complex, complex]]]]", variable has type "Optional[List[Union[List[Optional[Tuple[complex, Dict[str, Any]]]], Dict[str, Tuple[complex, Dict[str, Any]]]]]]")  [assignment]
qiskit/algorithms/eigensolvers/numpy_eigensolver.py:192: error: Incompatible types in assignment (expression has type "dict_items[str, Union[BaseOperator, PauliSumOp]]", variable has type "enumerate[Union[BaseOperator, PauliSumOp]]")  [assignment]
qiskit/algorithms/eigensolvers/numpy_eigensolver.py:217: error: Invalid index type "int" for "Dict[str, Tuple[complex, complex]]"; expected type "str"  [index]
qiskit/algorithms/eigensolvers/numpy_eigensolver.py:217: error: Incompatible types in assignment (expression has type "Tuple[float, Dict[str, float]]", target has type "Optional[Tuple[complex, complex]]")  [assignment]
qiskit/algorithms/eigensolvers/numpy_eigensolver.py:217: error: Incompatible types in assignment (expression has type "Tuple[float, Dict[str, float]]", target has type "Tuple[complex, complex]")  [assignment]
qiskit/algorithms/eigensolvers/numpy_eigensolver.py:232: error: List comprehension has incompatible type List[Union[Any, float, BaseOperator, PauliSumOp]]; expected List[Union[BaseOperator, PauliSumOp]]  [misc]
qiskit/algorithms/eigensolvers/numpy_eigensolver.py:235: error: Value expression in dictionary comprehension has incompatible type "Union[Any, float, BaseOperator, PauliSumOp]"; expected type "Union[BaseOperator, PauliSumOp]"  [misc]
qiskit/algorithms/eigensolvers/numpy_eigensolver.py:267: error: Argument 3 has incompatible type "Union[List[Optional[Tuple[complex, Dict[str, Any]]]], Dict[str, Tuple[complex, Dict[str, Any]]], None]"; expected "Union[List[Optional[float]], Dict[str, float], None]"  [arg-type]
qiskit/algorithms/eigensolvers/numpy_eigensolver.py:307: error: Incompatible types in assignment (expression has type "ndarray[Any, Any]", variable has type "None")  [assignment]
qiskit/algorithms/evolvers/trotterization/trotter_qrte.py:100: error: Incompatible types in assignment (expression has type "Union[QuantumInstance, Backend]", variable has type "Optional[QuantumInstance]")  [assignment]
qiskit/algorithms/evolvers/trotterization/trotter_qrte.py:208: error: Argument 1 to "bind_parameters" of "OperatorBase" has incompatible type "Optional[Dict[Parameter, complex]]"; expected "Dict[ParameterExpression, Union[complex, ParameterExpression, List[Union[complex, ParameterExpression]]]]"  [arg-type]
qiskit/algorithms/evolvers/trotterization/trotter_qrte.py:263: error: Incompatible return value type (got "Union[PauliSumOp, PauliOp, Literal[0]]", expected "Union[PauliSumOp, PauliOp]")  [return-value]
qiskit/algorithms/factorizers/shor.py:73: error: Incompatible types in assignment (expression has type "Union[QuantumInstance, Backend]", variable has type "Optional[QuantumInstance]")  [assignment]
qiskit/algorithms/factorizers/shor.py:129: error: Argument 2 to "append" of "QuantumCircuit" has incompatible type "QuantumRegister"; expected "Optional[Sequence[Union[Qubit, QuantumRegister, int, slice, Sequence[Union[Qubit, int]]]]]"  [arg-type]
qiskit/algorithms/factorizers/shor.py:131: error: Argument 2 to "append" of "QuantumCircuit" has incompatible type "QuantumRegister"; expected "Optional[Sequence[Union[Qubit, QuantumRegister, int, slice, Sequence[Union[Qubit, int]]]]]"  [arg-type]
qiskit/algorithms/factorizers/shor.py:133: error: Argument 2 to "append" of "QuantumCircuit" has incompatible type "QuantumRegister"; expected "Optional[Sequence[Union[Qubit, QuantumRegister, int, slice, Sequence[Union[Qubit, int]]]]]"  [arg-type]
qiskit/algorithms/factorizers/shor.py:139: error: Argument 2 to "append" of "QuantumCircuit" has incompatible type "QuantumRegister"; expected "Optional[Sequence[Union[Qubit, QuantumRegister, int, slice, Sequence[Union[Qubit, int]]]]]"  [arg-type]
qiskit/algorithms/factorizers/shor.py:143: error: Argument 2 to "append" of "QuantumCircuit" has incompatible type "QuantumRegister"; expected "Optional[Sequence[Union[Qubit, QuantumRegister, int, slice, Sequence[Union[Qubit, int]]]]]"  [arg-type]
qiskit/algorithms/factorizers/shor.py:168: error: Dict entry 0 has incompatible type "ParameterVector": "ndarray[Any, Any]"; expected "Parameter": "Union[ParameterExpression, float]"  [dict-item]
qiskit/algorithms/factorizers/shor.py:169: error: Argument 1 to "append" of "QuantumCircuit" has incompatible type "QuantumCircuit"; expected "Union[Operation, CircuitInstruction]"  [arg-type]
qiskit/algorithms/factorizers/shor.py:171: error: Argument 2 to "append" of "QuantumCircuit" has incompatible type "QuantumRegister"; expected "Optional[Sequence[Union[Qubit, QuantumRegister, int, slice, Sequence[Union[Qubit, int]]]]]"  [arg-type]
qiskit/algorithms/factorizers/shor.py:177: error: Argument 2 to "append" of "QuantumCircuit" has incompatible type "QuantumRegister"; expected "Optional[Sequence[Union[Qubit, QuantumRegister, int, slice, Sequence[Union[Qubit, int]]]]]"  [arg-type]
qiskit/algorithms/factorizers/shor.py:183: error: Argument 2 to "append" of "QuantumCircuit" has incompatible type "QuantumRegister"; expected "Optional[Sequence[Union[Qubit, QuantumRegister, int, slice, Sequence[Union[Qubit, int]]]]]"  [arg-type]
qiskit/algorithms/factorizers/shor.py:191: error: Argument 2 to "append" of "QuantumCircuit" has incompatible type "QuantumRegister"; expected "Optional[Sequence[Union[Qubit, QuantumRegister, int, slice, Sequence[Union[Qubit, int]]]]]"  [arg-type]
qiskit/algorithms/factorizers/shor.py:282: error: Argument 2 to "append" of "QuantumCircuit" has incompatible type "QuantumRegister"; expected "Optional[Sequence[Union[Qubit, QuantumRegister, int, slice, Sequence[Union[Qubit, int]]]]]"  [arg-type]
qiskit/algorithms/factorizers/shor.py:463: error: "ShorResult" has no attribute "get_statevector"  [attr-defined]
qiskit/algorithms/gradients/base_estimator_gradient.py:52: error: Argument after ** must be a mapping, not "Options"  [arg-type]
qiskit/algorithms/gradients/base_estimator_gradient.py:204: error: Argument after ** must be a mapping, not "Options"  [arg-type]
qiskit/algorithms/gradients/base_sampler_gradient.py:45: error: Argument after ** must be a mapping, not "Options"  [arg-type]
qiskit/algorithms/gradients/base_sampler_gradient.py:175: error: Argument after ** must be a mapping, not "Options"  [arg-type]
qiskit/algorithms/gradients/finite_diff_estimator_gradient.py:52: error: Need type annotation for "_base_parameter_values_dict" (hint: "_base_parameter_values_dict: Dict[<type>, <type>] = ...")  [var-annotated]
qiskit/algorithms/gradients/finite_diff_estimator_gradient.py:95: error: Argument 1 to "_get_local_options" of "BaseEstimatorGradient" has incompatible type "Dict[str, Any]"; expected "Options"  [arg-type]
qiskit/algorithms/gradients/finite_diff_sampler_gradient.py:96: error: Argument 1 to "_get_local_options" of "BaseSamplerGradient" has incompatible type "Dict[str, Any]"; expected "Options"  [arg-type]
qiskit/algorithms/gradients/lin_comb_estimator_gradient.py:56: error: Need type annotation for "_gradient_circuits" (hint: "_gradient_circuits: Dict[<type>, <type>] = ...")  [var-annotated]
qiskit/algorithms/gradients/lin_comb_estimator_gradient.py:89: error: Need type annotation for "gradient_circuits" (hint: "gradient_circuits: List[<type>] = ...")  [var-annotated]
qiskit/algorithms/gradients/lin_comb_estimator_gradient.py:89: error: Need type annotation for "result_indices" (hint: "result_indices: List[<type>] = ...")  [var-annotated]
qiskit/algorithms/gradients/lin_comb_estimator_gradient.py:133: error: Argument 1 to "_get_local_options" of "BaseEstimatorGradient" has incompatible type "Dict[str, Any]"; expected "Options"  [arg-type]
qiskit/algorithms/gradients/lin_comb_sampler_gradient.py:50: error: Need type annotation for "_gradient_circuits" (hint: "_gradient_circuits: Dict[<type>, <type>] = ...")  [var-annotated]
qiskit/algorithms/gradients/lin_comb_sampler_gradient.py:77: error: Need type annotation for "gradient_circuits" (hint: "gradient_circuits: List[<type>] = ...")  [var-annotated]
qiskit/algorithms/gradients/lin_comb_sampler_gradient.py:77: error: Need type annotation for "result_indices" (hint: "result_indices: List[<type>] = ...")  [var-annotated]
qiskit/algorithms/gradients/lin_comb_sampler_gradient.py:124: error: Argument 1 to "_get_local_options" of "BaseSamplerGradient" has incompatible type "Dict[str, Any]"; expected "Options"  [arg-type]
qiskit/algorithms/gradients/param_shift_estimator_gradient.py:45: error: Need type annotation for "_gradient_circuits" (hint: "_gradient_circuits: Dict[<type>, <type>] = ...")  [var-annotated]
qiskit/algorithms/gradients/param_shift_estimator_gradient.py:71: error: "ParameterShiftGradientCircuit" object is not iterable  [misc]
qiskit/algorithms/gradients/param_shift_estimator_gradient.py:114: error: Argument 1 to "_get_local_options" of "BaseEstimatorGradient" has incompatible type "Dict[str, Any]"; expected "Options"  [arg-type]
qiskit/algorithms/gradients/param_shift_sampler_gradient.py:43: error: Need type annotation for "_gradient_circuits" (hint: "_gradient_circuits: Dict[<type>, <type>] = ...")  [var-annotated]
qiskit/algorithms/gradients/param_shift_sampler_gradient.py:66: error: "ParameterShiftGradientCircuit" object is not iterable  [misc]
qiskit/algorithms/gradients/param_shift_sampler_gradient.py:119: error: Argument 1 to "_get_local_options" of "BaseSamplerGradient" has incompatible type "Dict[str, Any]"; expected "Options"  [arg-type]
qiskit/algorithms/gradients/spsa_estimator_gradient.py:99: error: Argument 3 to "run" of "BaseEstimator" has incompatible type "List[ndarray[Any, dtype[floating[Any]]]]"; expected "Union[Sequence[float], Sequence[Sequence[float]], None]"  [arg-type]
qiskit/algorithms/gradients/spsa_estimator_gradient.py:123: error: Argument 1 to "_get_local_options" of "BaseEstimatorGradient" has incompatible type "Dict[str, Any]"; expected "Options"  [arg-type]
qiskit/algorithms/gradients/spsa_sampler_gradient.py:124: error: Argument 1 to "_get_local_options" of "BaseSamplerGradient" has incompatible type "Dict[str, Any]"; expected "Options"  [arg-type]
qiskit/algorithms/gradients/utils.py:101: error: Item "List[QuantumCircuit]" of "Union[QuantumCircuit, List[QuantumCircuit]]" has no attribute "copy_empty_like"  [union-attr]
qiskit/algorithms/gradients/utils.py:101: error: Item "List[QuantumCircuit]" of "Union[QuantumCircuit, List[QuantumCircuit]]" has no attribute "name"  [union-attr]
qiskit/algorithms/gradients/utils.py:102: error: Need type annotation for "param_inst_dict"  [var-annotated]
qiskit/algorithms/gradients/utils.py:108: error: Item "List[QuantumCircuit]" of "Union[QuantumCircuit, List[QuantumCircuit]]" has no attribute "data"  [union-attr]
qiskit/algorithms/gradients/utils.py:110: error: Item "List[QuantumCircuit]" of "Union[QuantumCircuit, List[QuantumCircuit]]" has no attribute "qubits"  [union-attr]
qiskit/algorithms/gradients/utils.py:163: error: Argument "circuit" to "ParameterShiftGradientCircuit" has incompatible type "Union[QuantumCircuit, List[QuantumCircuit]]"; expected "QuantumCircuit"  [arg-type]
qiskit/algorithms/gradients/utils.py:166: error: Argument "gradient_parameter_map" to "ParameterShiftGradientCircuit" has incompatible type "defaultdict[Any, List[Parameter]]"; expected "Dict[Parameter, Parameter]"  [arg-type]
qiskit/algorithms/gradients/utils.py:213: error: Incompatible return value type (got "Tuple[ParameterShiftGradientCircuit, List[ndarray[Any, Any]]]", expected "ParameterShiftGradientCircuit")  [return-value]
qiskit/algorithms/gradients/utils.py:237: error: Need type annotation for "plus_offsets" (hint: "plus_offsets: List[<type>] = ...")  [var-annotated]
qiskit/algorithms/gradients/utils.py:237: error: Need type annotation for "minus_offsets" (hint: "minus_offsets: List[<type>] = ...")  [var-annotated]
qiskit/algorithms/gradients/utils.py:237: error: Need type annotation for "result_indices" (hint: "result_indices: List[<type>] = ...")  [var-annotated]
qiskit/algorithms/gradients/utils.py:241: error: "Parameter" has no attribute "__iter__"; maybe "__str__"? (not iterable)  [attr-defined]
qiskit/algorithms/gradients/utils.py:250: error: "Parameter" has no attribute "__iter__"; maybe "__str__"? (not iterable)  [attr-defined]
qiskit/algorithms/gradients/utils.py:270: error: Incompatible return value type (got "Tuple[List[Any], List[Any], List[Any], List[float]]", expected "List[ndarray[Any, Any]]")  [return-value]
qiskit/algorithms/gradients/utils.py:322: error: Item "List[QuantumCircuit]" of "Union[QuantumCircuit, List[QuantumCircuit]]" has no attribute "add_register"  [union-attr]
qiskit/algorithms/gradients/utils.py:323: error: Item "List[QuantumCircuit]" of "Union[QuantumCircuit, List[QuantumCircuit]]" has no attribute "add_bits"  [union-attr]
qiskit/algorithms/gradients/utils.py:324: error: Item "List[QuantumCircuit]" of "Union[QuantumCircuit, List[QuantumCircuit]]" has no attribute "h"  [union-attr]
qiskit/algorithms/gradients/utils.py:325: error: Item "List[QuantumCircuit]" of "Union[QuantumCircuit, List[QuantumCircuit]]" has no attribute "data"  [union-attr]
qiskit/algorithms/gradients/utils.py:326: error: Item "List[QuantumCircuit]" of "Union[QuantumCircuit, List[QuantumCircuit]]" has no attribute "sdg"  [union-attr]
qiskit/algorithms/gradients/utils.py:327: error: Item "List[QuantumCircuit]" of "Union[QuantumCircuit, List[QuantumCircuit]]" has no attribute "data"  [union-attr]
qiskit/algorithms/gradients/utils.py:330: error: Item "List[QuantumCircuit]" of "Union[QuantumCircuit, List[QuantumCircuit]]" has no attribute "data"  [union-attr]
qiskit/algorithms/gradients/utils.py:337: error: Too many arguments for "append" of "list"  [call-arg]
qiskit/algorithms/gradients/utils.py:337: error: Argument 1 to "append" of "list" has incompatible type "Instruction"; expected "QuantumCircuit"  [arg-type]
qiskit/algorithms/gradients/utils.py:338: error: Item "List[QuantumCircuit]" of "Union[QuantumCircuit, List[QuantumCircuit]]" has no attribute "data"  [union-attr]
qiskit/algorithms/gradients/utils.py:339: error: Item "List[QuantumCircuit]" of "Union[QuantumCircuit, List[QuantumCircuit]]" has no attribute "h"  [union-attr]
qiskit/algorithms/gradients/utils.py:341: error: Item "List[QuantumCircuit]" of "Union[QuantumCircuit, List[QuantumCircuit]]" has no attribute "measure"  [union-attr]
qiskit/algorithms/gradients/utils.py:342: error: Argument 1 to "LinearCombGradientCircuit" has incompatible type "Union[QuantumCircuit, List[QuantumCircuit]]"; expected "QuantumCircuit"  [arg-type]
qiskit/algorithms/linear_solvers/hhl.py:144: error: Incompatible types in assignment (expression has type "Union[Backend, QuantumInstance, None]", variable has type "Optional[QuantumInstance]")  [assignment]
qiskit/algorithms/linear_solvers/hhl.py:270: error: Item "BaseOperator" of "Union[LinearSystemObservable, BaseOperator]" has no attribute "observable_circuit"  [union-attr]
qiskit/algorithms/linear_solvers/hhl.py:270: error: Incompatible types in assignment (expression has type "Union[QuantumCircuit, List[QuantumCircuit], Any]", variable has type "Optional[QuantumCircuit]")  [assignment]
qiskit/algorithms/linear_solvers/hhl.py:271: error: Item "BaseOperator" of "Union[LinearSystemObservable, BaseOperator]" has no attribute "post_processing"  [union-attr]
qiskit/algorithms/linear_solvers/hhl.py:271: error: Incompatible types in assignment (expression has type "Union[Callable[[Union[float, List[float]], int, float], float], Any]", variable has type "Optional[Callable[[Union[float, List[float]]], Union[float, List[float]]]]")  [assignment]
qiskit/algorithms/linear_solvers/hhl.py:287: error: Incompatible types in assignment (expression has type "List[QuantumCircuit]", variable has type "Optional[QuantumCircuit]")  [assignment]
qiskit/algorithms/linear_solvers/hhl.py:288: error: Incompatible types in assignment (expression has type "List[Union[LinearSystemObservable, Any, BaseOperator]]", variable has type "Union[LinearSystemObservable, BaseOperator, None]")  [assignment]
qiskit/algorithms/linear_solvers/hhl.py:291: error: No overload variant of "zip" matches argument types "Optional[QuantumCircuit]", "Union[LinearSystemObservable, Any, BaseOperator]"  [call-overload]
qiskit/algorithms/linear_solvers/hhl.py:291: note: Possible overload variants:
qiskit/algorithms/linear_solvers/hhl.py:291: note:     def [_T_co, _T1] __new__(cls, Iterable[_T1], *, strict: bool = ...) -> zip[Tuple[_T1]]
qiskit/algorithms/linear_solvers/hhl.py:291: note:     def [_T_co, _T1, _T2] __new__(cls, Iterable[_T1], Iterable[_T2], *, strict: bool = ...) -> zip[Tuple[_T1, _T2]]
qiskit/algorithms/linear_solvers/hhl.py:291: note:     def [_T_co, _T1, _T2, _T3] __new__(cls, Iterable[_T1], Iterable[_T2], Iterable[_T3], *, strict: bool = ...) -> zip[Tuple[_T1, _T2, _T3]]
qiskit/algorithms/linear_solvers/hhl.py:291: 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]]
qiskit/algorithms/linear_solvers/hhl.py:291: 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]]
qiskit/algorithms/linear_solvers/hhl.py:291: 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, ...]]
qiskit/algorithms/linear_solvers/hhl.py:293: error: Argument 1 to "append" of "QuantumCircuit" has incompatible type "QuantumCircuit"; expected "Union[Operation, CircuitInstruction]"  [arg-type]
qiskit/algorithms/linear_solvers/hhl.py:301: error: Incompatible types in assignment (expression has type "ListOp", variable has type "List[Any]")  [assignment]
qiskit/algorithms/linear_solvers/hhl.py:307: error: Incompatible types in assignment (expression has type "OperatorBase", variable has type "List[Any]")  [assignment]
qiskit/algorithms/linear_solvers/hhl.py:307: error: Argument 1 to "convert" of "ExpectationBase" has incompatible type "List[Any]"; expected "OperatorBase"  [arg-type]
qiskit/algorithms/linear_solvers/hhl.py:320: error: "List[Any]" has no attribute "eval"  [attr-defined]
qiskit/algorithms/linear_solvers/hhl.py:323: error: Too many arguments  [call-arg]
qiskit/algorithms/linear_solvers/hhl.py:357: error: "QuantumCircuit" has no attribute "isometry"  [attr-defined]
qiskit/algorithms/linear_solvers/hhl.py:414: error: "QuantumCircuit" has no attribute "evolution_time"  [attr-defined]
qiskit/algorithms/linear_solvers/hhl.py:460: error: Incompatible types in assignment (expression has type "PiecewiseChebyshev", variable has type "ExactReciprocal")  [assignment]
qiskit/algorithms/linear_solvers/hhl.py:478: error: Argument 1 to "append" of "QuantumCircuit" has incompatible type "QuantumCircuit"; expected "Union[Operation, CircuitInstruction]"  [arg-type]
qiskit/algorithms/linear_solvers/hhl.py:482: error: Argument 1 to "append" of "QuantumCircuit" has incompatible type "PhaseEstimation"; expected "Union[Operation, CircuitInstruction]"  [arg-type]
qiskit/algorithms/linear_solvers/hhl.py:484: error: Argument 1 to "append" of "QuantumCircuit" has incompatible type "PhaseEstimation"; expected "Union[Operation, CircuitInstruction]"  [arg-type]
qiskit/algorithms/linear_solvers/hhl.py:487: error: Argument 1 to "append" of "QuantumCircuit" has incompatible type "ExactReciprocal"; expected "Union[Operation, CircuitInstruction]"  [arg-type]
qiskit/algorithms/linear_solvers/hhl.py:495: error: Argument 1 to "append" of "QuantumCircuit" has incompatible type "QuantumCircuit"; expected "Union[Operation, CircuitInstruction]"  [arg-type]
qiskit/algorithms/linear_solvers/hhl.py:497: error: Argument 1 to "append" of "QuantumCircuit" has incompatible type "QuantumCircuit"; expected "Union[Operation, CircuitInstruction]"  [arg-type]
qiskit/algorithms/linear_solvers/hhl.py:550: error: Argument 2 to "_calculate_observable" of "HHL" has incompatible type "Union[LinearSystemObservable, BaseOperator, List[LinearSystemObservable], List[BaseOperator]]"; expected "Union[LinearSystemObservable, BaseOperator, None]"  [arg-type]
qiskit/algorithms/linear_solvers/hhl.py:550: error: Argument 3 to "_calculate_observable" of "HHL" has incompatible type "Union[QuantumCircuit, List[QuantumCircuit], None]"; expected "Optional[QuantumCircuit]"  [arg-type]
qiskit/algorithms/linear_solvers/matrices/linear_system_matrix.py:128: error: Argument 1 of "power" is incompatible with supertype "QuantumCircuit"; supertype defines the argument type as "float"  [override]
qiskit/algorithms/linear_solvers/matrices/linear_system_matrix.py:128: note: This violates the Liskov substitution principle
qiskit/algorithms/linear_solvers/matrices/linear_system_matrix.py:128: note: See https://mypy.readthedocs.io/en/stable/common_issues.html#incompatible-overrides
qiskit/algorithms/linear_solvers/matrices/numpy_matrix.py:209: error: Argument 1 of "power" is incompatible with supertype "QuantumCircuit"; supertype defines the argument type as "float"  [override]
qiskit/algorithms/linear_solvers/matrices/numpy_matrix.py:209: note: This violates the Liskov substitution principle
qiskit/algorithms/linear_solvers/matrices/numpy_matrix.py:209: note: See https://mypy.readthedocs.io/en/stable/common_issues.html#incompatible-overrides
qiskit/algorithms/linear_solvers/matrices/tridiagonal_toeplitz.py:352: error: Argument 1 to "append" of "QuantumCircuit" has incompatible type "MCMTVChain"; expected "Union[Operation, CircuitInstruction]"  [arg-type]
qiskit/algorithms/linear_solvers/matrices/tridiagonal_toeplitz.py:421: error: Argument 1 of "power" is incompatible with supertype "QuantumCircuit"; supertype defines the argument type as "float"  [override]
qiskit/algorithms/linear_solvers/matrices/tridiagonal_toeplitz.py:421: note: This violates the Liskov substitution principle
qiskit/algorithms/linear_solvers/matrices/tridiagonal_toeplitz.py:421: note: See https://mypy.readthedocs.io/en/stable/common_issues.html#incompatible-overrides
qiskit/algorithms/linear_solvers/numpy_linear_solver.py:63: error: Argument 3 of "solve" is incompatible with supertype "LinearSolver"; supertype defines the argument type as "Union[LinearSystemObservable, BaseOperator, List[LinearSystemObservable], List[BaseOperator], None]"  [override]
qiskit/algorithms/linear_solvers/numpy_linear_solver.py:63: note: This violates the Liskov substitution principle
qiskit/algorithms/linear_solvers/numpy_linear_solver.py:63: note: See https://mypy.readthedocs.io/en/stable/common_issues.html#incompatible-overrides
qiskit/algorithms/linear_solvers/numpy_linear_solver.py:95: error: "QuantumCircuit" has no attribute "matrix"  [attr-defined]
qiskit/algorithms/linear_solvers/numpy_linear_solver.py:99: error: Argument 1 to "solve" has incompatible type "Union[ndarray[Any, Any], QuantumCircuit]"; expected "Union[_SupportsArray[dtype[Union[bool_, integer[Any]]]], _NestedSequence[_SupportsArray[dtype[Union[bool_, integer[Any]]]]], bool, int, _NestedSequence[Union[bool, int]]]"  [arg-type]
qiskit/algorithms/linear_solvers/numpy_linear_solver.py:99: error: Argument 2 to "solve" has incompatible type "Union[ndarray[Any, Any], QuantumCircuit]"; expected "Union[_SupportsArray[dtype[Union[bool_, integer[Any]]]], _NestedSequence[_SupportsArray[dtype[Union[bool_, integer[Any]]]]], bool, int, _NestedSequence[Union[bool, int]]]"  [arg-type]
qiskit/algorithms/linear_solvers/numpy_linear_solver.py:106: error: "BaseOperator" has no attribute "evaluate_classically"  [attr-defined]
qiskit/algorithms/linear_solvers/numpy_linear_solver.py:108: error: Item "BaseOperator" of "Union[LinearSystemObservable, BaseOperator]" has no attribute "evaluate_classically"  [union-attr]
qiskit/algorithms/linear_solvers/observables/absolute_average.py:134: error: Argument 1 to "mean" has incompatible type "Union[ndarray[Any, Any], QuantumCircuit]"; expected "Union[_SupportsArray[dtype[Union[bool_, integer[Any], floating[Any]]]], _NestedSequence[_SupportsArray[dtype[Union[bool_, integer[Any], floating[Any]]]]], bool, int, float, _NestedSequence[Union[bool, int, float]]]"  [arg-type]
qiskit/algorithms/linear_solvers/observables/matrix_functional.py:191: error: Item "QuantumCircuit" of "Union[ndarray[Any, Any], QuantumCircuit]" has no attribute "transpose"  [union-attr]
qiskit/algorithms/linear_solvers/observables/matrix_functional.py:191: error: Argument 2 to "dot" has incompatible type "Union[ndarray[Any, Any], QuantumCircuit]"; expected "Union[_SupportsArray[dtype[Any]], _NestedSequence[_SupportsArray[dtype[Any]]], bool, int, float, complex, str, bytes, _NestedSequence[Union[bool, int, float, complex, str, bytes]]]"  [arg-type]
qiskit/algorithms/minimum_eigen_solvers/qaoa.py:145: error: Missing return statement  [return]
qiskit/algorithms/minimum_eigen_solvers/vqe.py:202: error: Incompatible types in assignment (expression has type "Union[Optimizer, Minimizer, None]", variable has type "Optimizer")  [assignment]
qiskit/algorithms/minimum_eigen_solvers/vqe.py:206: error: Function "builtins.callable" is not valid as a type  [valid-type]
qiskit/algorithms/minimum_eigen_solvers/vqe.py:206: note: Perhaps you meant "typing.Callable" instead of "callable"?
qiskit/algorithms/minimum_eigen_solvers/vqe.py:211: error: Incompatible types in assignment (expression has type "Union[QuantumInstance, Backend]", variable has type "Optional[QuantumInstance]")  [assignment]
qiskit/algorithms/minimum_eigen_solvers/vqe.py:329: error: Property "num_qubits" defined in "QuantumCircuit" is read-only  [misc]
qiskit/algorithms/minimum_eigen_solvers/vqe.py:438: error: Argument 1 to "assign_parameters" of "QuantumCircuit" has incompatible type "Union[List[float], List[Parameter], ndarray[Any, Any]]"; expected "Union[Mapping[Parameter, Union[ParameterExpression, float]], Sequence[Union[ParameterExpression, float]]]"  [arg-type]
qiskit/algorithms/minimum_eigen_solvers/vqe.py:463: error: Item "Tuple[ABC, ...]" of "Union[OperatorBase, Tuple[OperatorBase, ExpectationBase]]" has no attribute "to_circuit_op"  [union-attr]
qiskit/algorithms/minimum_eigen_solvers/vqe.py:512: error: Incompatible types in assignment (expression has type "dict_items[str, OperatorBase]", variable has type "enumerate[OperatorBase]")  [assignment]
qiskit/algorithms/minimum_eigen_solvers/vqe.py:513: error: Incompatible types in assignment (expression has type "Dict[<nothing>, <nothing>]", variable has type "List[PauliSumOp]")  [assignment]
qiskit/algorithms/minimum_eigen_solvers/vqe.py:516: error: No overload variant of "__setitem__" of "list" matches argument types "int", "OperatorBase"  [call-overload]
qiskit/algorithms/minimum_eigen_solvers/vqe.py:516: note: Possible overload variants:
qiskit/algorithms/minimum_eigen_solvers/vqe.py:516: note:     def __setitem__(self, SupportsIndex, PauliSumOp) -> None
qiskit/algorithms/minimum_eigen_solvers/vqe.py:516: note:     def __setitem__(self, slice, Iterable[PauliSumOp]) -> None
qiskit/algorithms/minimum_eigen_solvers/vqe.py:518: error: Incompatible types in assignment (expression has type "List[PauliSumOp]", variable has type "Union[List[Optional[OperatorBase]], Dict[str, OperatorBase], None]")  [assignment]
qiskit/algorithms/minimum_eigen_solvers/vqe.py:526: error: Item callable? of "Union[GradientBase, callable?, None]" has no attribute "gradient_wrapper"  [union-attr]
qiskit/algorithms/minimum_eigen_solvers/vqe.py:535: error: "Callable[[ndarray[Any, Any]], Union[float, List[float]]]" object is not iterable  [misc]
qiskit/algorithms/minimum_eigen_solvers/vqe.py:547: error: Argument "fun" to "minimize" of "Optimizer" has incompatible type "Union[Any, Callable[[ndarray[Any, Any]], Union[float, List[float]]]]"; expected "Callable[[Union[float, ndarray[Any, Any]]], float]"  [arg-type]
qiskit/algorithms/minimum_eigen_solvers/vqe.py:547: error: Argument "jac" to "minimize" of "Optimizer" has incompatible type "Union[Callable[[Iterable[Any]], ndarray[Any, Any]], Any]"; expected "Optional[Callable[[Union[float, ndarray[Any, Any]]], Union[float, ndarray[Any, Any]]]]"  [arg-type]
qiskit/algorithms/minimum_eigen_solvers/vqe.py:613: error: "OperatorBase" object is not iterable  [misc]
qiskit/algorithms/minimum_eigen_solvers/vqe.py:614: error: Argument 1 to "construct_expectation" of "VQE" has incompatible type "ParameterView"; expected "Union[List[float], List[Parameter], ndarray[Any, Any]]"  [arg-type]
qiskit/algorithms/minimum_eigen_solvers/vqe.py:655: error: Item "OperatorBase" of "Union[OperatorBase, complex]" has no attribute "primitive"  [union-attr]
qiskit/algorithms/minimum_eigen_solvers/vqe.py:655: error: Item "complex" of "Union[OperatorBase, complex]" has no attribute "primitive"  [union-attr]
qiskit/algorithms/minimum_eigen_solvers/vqe.py:657: error: Item "OperatorBase" of "Union[OperatorBase, complex]" has no attribute "to_dict_fn"  [union-attr]
qiskit/algorithms/minimum_eigen_solvers/vqe.py:657: error: Item "complex" of "Union[OperatorBase, complex]" has no attribute "to_dict_fn"  [union-attr]
qiskit/algorithms/minimum_eigensolvers/adapt_vqe.py:119: error: Signature of "initial_point" incompatible with supertype "VariationalAlgorithm"  [override]
qiskit/algorithms/minimum_eigensolvers/adapt_vqe.py:119: note:      Superclass:
qiskit/algorithms/minimum_eigensolvers/adapt_vqe.py:119: note:          @overload
qiskit/algorithms/minimum_eigensolvers/adapt_vqe.py:119: note:          def initial_point(self) -> Optional[ndarray[Any, Any]]
qiskit/algorithms/minimum_eigensolvers/adapt_vqe.py:119: note:      Subclass:
qiskit/algorithms/minimum_eigensolvers/adapt_vqe.py:119: note:          @overload
qiskit/algorithms/minimum_eigensolvers/adapt_vqe.py:119: note:          def initial_point() -> Optional[Sequence[float]]
qiskit/algorithms/minimum_eigensolvers/adapt_vqe.py:120: error: Signature of "initial_point" incompatible with supertype "VariationalAlgorithm"  [override]
qiskit/algorithms/minimum_eigensolvers/adapt_vqe.py:120: note:      Superclass:
qiskit/algorithms/minimum_eigensolvers/adapt_vqe.py:120: note:          @overload
qiskit/algorithms/minimum_eigensolvers/adapt_vqe.py:120: note:          def initial_point(self) -> Optional[ndarray[Any, Any]]
qiskit/algorithms/minimum_eigensolvers/adapt_vqe.py:120: note:      Subclass:
qiskit/algorithms/minimum_eigensolvers/adapt_vqe.py:120: note:          def initial_point() -> Optional[Sequence[float]]
qiskit/algorithms/minimum_eigensolvers/adapt_vqe.py:147: error: Incompatible return value type (got "Union[List[Optional[Tuple[complex, Dict[str, Any]]]], Dict[str, Tuple[complex, Dict[str, Any]]]]", expected "List[Tuple[complex, complex]]")  [return-value]
qiskit/algorithms/minimum_eigensolvers/adapt_vqe.py:215: error: Argument 2 to "_compute_gradients" of "AdaptVQE" has incompatible type "Union[BaseOperator, PauliSumOp]"; expected "OperatorBase"  [arg-type]
qiskit/algorithms/minimum_eigensolvers/adapt_vqe.py:217: error: Incompatible types in assignment (expression has type "Tuple[complex, complex]", variable has type "Tuple[float, Optional[PauliSumOp]]")  [assignment]
qiskit/algorithms/minimum_eigensolvers/adapt_vqe.py:260: error: Incompatible types in assignment (expression has type "TerminationCriterion", variable has type "str")  [assignment]
qiskit/algorithms/minimum_eigensolvers/adapt_vqe.py:265: error: Argument 4 to "estimate_observables" has incompatible type "ndarray[Any, Any]"; expected "Optional[Sequence[float]]"  [arg-type]
qiskit/algorithms/minimum_eigensolvers/adapt_vqe.py:270: error: "QuantumCircuit" has no attribute "operators"  [attr-defined]
qiskit/algorithms/minimum_eigensolvers/diagonal_estimator.py:128: error: "float" not callable  [operator]
qiskit/algorithms/minimum_eigensolvers/diagonal_estimator.py:128: error: Argument 1 has incompatible type "dict_values[Any, Tuple[Any, complex]]"; expected "Sequence[Tuple[float, float]]"  [arg-type]
qiskit/algorithms/minimum_eigensolvers/diagonal_estimator.py:134: error: Argument "key" to "min" has incompatible type "Callable[[Tuple[Any, Tuple[Any, complex]]], complex]"; expected "Callable[[Tuple[Any, Tuple[Any, complex]]], Union[SupportsDunderLT[Any], SupportsDunderGT[Any]]]"  [arg-type]
qiskit/algorithms/minimum_eigensolvers/diagonal_estimator.py:134: error: Incompatible return value type (got "complex", expected "Union[SupportsDunderLT[Any], SupportsDunderGT[Any]]")  [return-value]
qiskit/algorithms/minimum_eigensolvers/diagonal_estimator.py:194: error: Incompatible return value type (got "signedinteger[_64Bit]", expected "float")  [return-value]
qiskit/algorithms/minimum_eigensolvers/diagonal_estimator.py:199: error: Missing return statement  [return]
qiskit/algorithms/minimum_eigensolvers/minimum_eigensolver.py:85: error: Incompatible types in assignment (expression has type "complex", variable has type "None")  [assignment]
qiskit/algorithms/minimum_eigensolvers/minimum_eigensolver.py:97: error: Incompatible types in assignment (expression has type "Union[List[Optional[Tuple[complex, Dict[str, Any]]]], Dict[str, Tuple[complex, Dict[str, Any]]]]", variable has type "None")  [assignment]
qiskit/algorithms/minimum_eigensolvers/numpy_minimum_eigensolver.py:105: error: Incompatible types in assignment (expression has type "ndarray[Any, Any]", variable has type "None")  [assignment]
qiskit/algorithms/minimum_eigensolvers/qaoa.py:133: error: Argument "initial_point" to "__init__" of "SamplingVQE" has incompatible type "Optional[ndarray[Any, Any]]"; expected "Optional[Sequence[float]]"  [arg-type]
qiskit/algorithms/minimum_eigensolvers/qaoa.py:141: error: Incompatible types in assignment (expression has type "PrimitiveOp", variable has type "Union[BaseOperator, PauliSumOp]")  [assignment]
qiskit/algorithms/minimum_eigensolvers/qaoa.py:141: error: Argument 1 to "PrimitiveOp" has incompatible type "BaseOperator"; expected "Union[QuantumCircuit, Operator, Pauli, SparsePauliOp, OperatorBase]"  [arg-type]
qiskit/algorithms/minimum_eigensolvers/sampling_mes.py:84: error: Incompatible types in assignment (expression has type "Optional[complex]", variable has type "None")  [assignment]
qiskit/algorithms/minimum_eigensolvers/sampling_mes.py:99: error: Incompatible types in assignment (expression has type "Optional[QuasiDistribution]", variable has type "None")  [assignment]
qiskit/algorithms/minimum_eigensolvers/sampling_mes.py:113: error: Incompatible types in assignment (expression has type "Optional[Union[List[Optional[Tuple[complex, Dict[str, Any]]]], Dict[str, Tuple[complex, Dict[str, Any]]]]]", variable has type "None")  [assignment]
qiskit/algorithms/minimum_eigensolvers/sampling_mes.py:126: error: Incompatible types in assignment (expression has type "Mapping[str, Any]", variable has type "None")  [assignment]
qiskit/algorithms/minimum_eigensolvers/sampling_vqe.py:152: error: Signature of "initial_point" incompatible with supertype "VariationalAlgorithm"  [override]
qiskit/algorithms/minimum_eigensolvers/sampling_vqe.py:152: note:      Superclass:
qiskit/algorithms/minimum_eigensolvers/sampling_vqe.py:152: note:          @overload
qiskit/algorithms/minimum_eigensolvers/sampling_vqe.py:152: note:          def initial_point(self) -> Optional[ndarray[Any, Any]]
qiskit/algorithms/minimum_eigensolvers/sampling_vqe.py:152: note:      Subclass:
qiskit/algorithms/minimum_eigensolvers/sampling_vqe.py:152: note:          @overload
qiskit/algorithms/minimum_eigensolvers/sampling_vqe.py:152: note:          def initial_point() -> Optional[Sequence[float]]
qiskit/algorithms/minimum_eigensolvers/sampling_vqe.py:153: error: Signature of "initial_point" incompatible with supertype "VariationalAlgorithm"  [override]
qiskit/algorithms/minimum_eigensolvers/sampling_vqe.py:153: note:      Superclass:
qiskit/algorithms/minimum_eigensolvers/sampling_vqe.py:153: note:          @overload
qiskit/algorithms/minimum_eigensolvers/sampling_vqe.py:153: note:          def initial_point(self) -> Optional[ndarray[Any, Any]]
qiskit/algorithms/minimum_eigensolvers/sampling_vqe.py:153: note:      Subclass:
qiskit/algorithms/minimum_eigensolvers/sampling_vqe.py:153: note:          def initial_point() -> Optional[Sequence[float]]
qiskit/algorithms/minimum_eigensolvers/sampling_vqe.py:171: error: Property "num_qubits" defined in "QuantumCircuit" is read-only  [misc]
qiskit/algorithms/minimum_eigensolvers/sampling_vqe.py:210: error: Missing positional argument "jac" in call to "__call__" of "Minimizer"  [call-arg]
qiskit/algorithms/minimum_eigensolvers/sampling_vqe.py:210: error: Argument "fun" to "__call__" of "Minimizer" has incompatible type "Callable[[ndarray[Any, Any]], Union[ndarray[Any, Any], float]]"; expected "Callable[[ndarray[Any, Any]], float]"  [arg-type]
qiskit/algorithms/minimum_eigensolvers/sampling_vqe.py:210: error: Argument "x0" to "__call__" of "Minimizer" has incompatible type "Sequence[float]"; expected "ndarray[Any, Any]"  [arg-type]
qiskit/algorithms/minimum_eigensolvers/sampling_vqe.py:213: error: Argument "fun" to "minimize" of "Optimizer" has incompatible type "Callable[[ndarray[Any, Any]], Union[ndarray[Any, Any], float]]"; expected "Callable[[Union[float, ndarray[Any, Any]]], float]"  [arg-type]
qiskit/algorithms/minimum_eigensolvers/sampling_vqe.py:213: error: Argument "x0" to "minimize" of "Optimizer" has incompatible type "Sequence[float]"; expected "Union[float, ndarray[Any, Any]]"  [arg-type]
qiskit/algorithms/minimum_eigensolvers/sampling_vqe.py:224: error: Argument 2 to "run" of "BaseSampler" has incompatible type "List[Union[Any, float, ndarray[Any, Any]]]"; expected "Union[Sequence[float], Sequence[Sequence[float]], None]"  [arg-type]
qiskit/algorithms/minimum_eigensolvers/sampling_vqe.py:231: error: Argument 4 to "estimate_observables" has incompatible type "Union[Any, float, ndarray[Any, Any]]"; expected "Optional[Sequence[float]]"  [arg-type]
qiskit/algorithms/minimum_eigensolvers/sampling_vqe.py:239: error: Argument 3 to "_build_sampling_vqe_result" of "SamplingVQE" has incompatible type "Union[List[Optional[Tuple[complex, Dict[str, Any]]]], Dict[str, Tuple[complex, Dict[str, Any]]], None]"; expected "Union[List[Optional[Tuple[complex, Tuple[complex, int]]]], Dict[str, Tuple[complex, Tuple[complex, int]]]]"  [arg-type]
qiskit/algorithms/minimum_eigensolvers/sampling_vqe.py:310: error: Incompatible return value type (got "Callable[[Any], Any]", expected "Tuple[Callable[[ndarray[Any, Any]], Union[ndarray[Any, Any], float]], Dict[Any, Any]]")  [return-value]
qiskit/algorithms/minimum_eigensolvers/sampling_vqe.py:324: error: Incompatible types in assignment (expression has type "Union[float, ndarray[Any, Any]]", variable has type "Optional[ndarray[Any, Any]]")  [assignment]
qiskit/algorithms/minimum_eigensolvers/sampling_vqe.py:325: error: Argument 2 to "zip" has incompatible type "Union[float, ndarray[Any, Any]]"; expected "Iterable[Any]"  [arg-type]
qiskit/algorithms/minimum_eigensolvers/sampling_vqe.py:328: error: Incompatible types in assignment (expression has type "Union[List[Optional[Tuple[complex, Tuple[complex, int]]]], Dict[str, Tuple[complex, Tuple[complex, int]]]]", variable has type "Optional[Union[List[Optional[Tuple[complex, Dict[str, Any]]]], Dict[str, Tuple[complex, Dict[str, Any]]]]]")  [assignment]
qiskit/algorithms/minimum_eigensolvers/sampling_vqe.py:331: error: Incompatible types in assignment (expression has type "List[QuasiDistribution]", variable has type "Optional[QuasiDistribution]")  [assignment]
qiskit/algorithms/minimum_eigensolvers/sampling_vqe.py:351: error: Incompatible types in assignment (expression has type "int", variable has type "None")  [assignment]
qiskit/algorithms/minimum_eigensolvers/vqe.py:150: error: Signature of "initial_point" incompatible with supertype "VariationalAlgorithm"  [override]
qiskit/algorithms/minimum_eigensolvers/vqe.py:150: note:      Superclass:
qiskit/algorithms/minimum_eigensolvers/vqe.py:150: note:          @overload
qiskit/algorithms/minimum_eigensolvers/vqe.py:150: note:          def initial_point(self) -> Optional[ndarray[Any, Any]]
qiskit/algorithms/minimum_eigensolvers/vqe.py:150: note:      Subclass:
qiskit/algorithms/minimum_eigensolvers/vqe.py:150: note:          @overload
qiskit/algorithms/minimum_eigensolvers/vqe.py:150: note:          def initial_point() -> Optional[Sequence[float]]
qiskit/algorithms/minimum_eigensolvers/vqe.py:151: error: Signature of "initial_point" incompatible with supertype "VariationalAlgorithm"  [override]
qiskit/algorithms/minimum_eigensolvers/vqe.py:151: note:      Superclass:
qiskit/algorithms/minimum_eigensolvers/vqe.py:151: note:          @overload
qiskit/algorithms/minimum_eigensolvers/vqe.py:151: note:          def initial_point(self) -> Optional[ndarray[Any, Any]]
qiskit/algorithms/minimum_eigensolvers/vqe.py:151: note:      Subclass:
qiskit/algorithms/minimum_eigensolvers/vqe.py:151: note:          def initial_point() -> Optional[Sequence[float]]
qiskit/algorithms/minimum_eigensolvers/vqe.py:181: error: Argument "fun" to "__call__" of "Minimizer" has incompatible type "Callable[[ndarray[Any, Any]], Union[ndarray[Any, Any], float]]"; expected "Callable[[ndarray[Any, Any]], float]"  [arg-type]
qiskit/algorithms/minimum_eigensolvers/vqe.py:181: error: Argument "x0" to "__call__" of "Minimizer" has incompatible type "Sequence[float]"; expected "ndarray[Any, Any]"  [arg-type]
qiskit/algorithms/minimum_eigensolvers/vqe.py:185: error: Argument "fun" to "minimize" of "Optimizer" has incompatible type "Callable[[ndarray[Any, Any]], Union[ndarray[Any, Any], float]]"; expected "Callable[[Union[float, ndarray[Any, Any]]], float]"  [arg-type]
qiskit/algorithms/minimum_eigensolvers/vqe.py:185: error: Argument "x0" to "minimize" of "Optimizer" has incompatible type "Sequence[float]"; expected "Union[float, ndarray[Any, Any]]"  [arg-type]
qiskit/algorithms/minimum_eigensolvers/vqe.py:185: error: Argument "jac" to "minimize" of "Optimizer" has incompatible type "Optional[Callable[[ndarray[Any, Any]], ndarray[Any, Any]]]"; expected "Optional[Callable[[Union[float, ndarray[Any, Any]]], Union[float, ndarray[Any, Any]]]]"  [arg-type]
qiskit/algorithms/minimum_eigensolvers/vqe.py:198: error: Argument 4 to "estimate_observables" has incompatible type "Union[Any, float, ndarray[Any, Any]]"; expected "Optional[Sequence[float]]"  [arg-type]
qiskit/algorithms/minimum_eigensolvers/vqe.py:204: error: Argument 3 to "_build_vqe_result" of "VQE" has incompatible type "Union[List[Optional[Tuple[complex, Dict[str, Any]]]], Dict[str, Tuple[complex, Dict[str, Any]]], None]"; expected "Union[List[Optional[Tuple[complex, Tuple[complex, int]]]], Dict[str, Tuple[complex, Tuple[complex, int]]]]"  [arg-type]
qiskit/algorithms/minimum_eigensolvers/vqe.py:282: error: List item 0 has incompatible type "ndarray[Any, Any]"; expected "Sequence[float]"  [list-item]
qiskit/algorithms/minimum_eigensolvers/vqe.py:300: error: Property "num_qubits" defined in "QuantumCircuit" is read-only  [misc]
qiskit/algorithms/minimum_eigensolvers/vqe.py:322: error: Incompatible types in assignment (expression has type "Union[float, ndarray[Any, Any]]", variable has type "Optional[ndarray[Any, Any]]")  [assignment]
qiskit/algorithms/minimum_eigensolvers/vqe.py:323: error: Argument 2 to "zip" has incompatible type "Union[float, ndarray[Any, Any]]"; expected "Iterable[Any]"  [arg-type]
qiskit/algorithms/minimum_eigensolvers/vqe.py:326: error: Incompatible types in assignment (expression has type "Union[List[Optional[Tuple[complex, Tuple[complex, int]]]], Dict[str, Tuple[complex, Tuple[complex, int]]]]", variable has type "Optional[Union[List[Optional[Tuple[complex, Dict[str, Any]]]], Dict[str, Tuple[complex, Dict[str, Any]]]]]")  [assignment]
qiskit/algorithms/minimum_eigensolvers/vqe.py:345: error: Incompatible types in assignment (expression has type "int", variable has type "None")  [assignment]
qiskit/algorithms/observables_evaluator.py:65: error: Incompatible types in assignment (expression has type "List[QuantumCircuit]", variable has type "QuantumCircuit")  [assignment]
qiskit/algorithms/observables_evaluator.py:67: error: List item 0 has incompatible type "Sequence[float]"; expected "float"  [list-item]
qiskit/algorithms/observables_evaluator.py:120: error: Incompatible types in assignment (expression has type "Dict[<nothing>, <nothing>]", variable has type "List[None]")  [assignment]
qiskit/algorithms/observables_evaluator.py:121: error: Incompatible types in assignment (expression has type "zip[Tuple[str, Tuple[complex, Dict[Any, Any]]]]", variable has type "enumerate[Tuple[complex, Dict[Any, Any]]]")  [assignment]
qiskit/algorithms/observables_evaluator.py:124: error: No overload variant of "__setitem__" of "list" matches argument types "int", "Tuple[complex, Dict[Any, Any]]"  [call-overload]
qiskit/algorithms/observables_evaluator.py:124: note: Possible overload variants:
qiskit/algorithms/observables_evaluator.py:124: note:     def __setitem__(self, SupportsIndex, None) -> None
qiskit/algorithms/observables_evaluator.py:124: note:     def __setitem__(self, slice, Iterable[None]) -> None
qiskit/algorithms/observables_evaluator.py:125: error: Incompatible return value type (got "List[None]", expected "Union[List[Optional[Tuple[complex, Dict[str, Any]]]], Dict[str, Tuple[complex, Dict[str, Any]]]]")  [return-value]
qiskit/algorithms/optimizers/adam_amsgrad.py:194: error: Incompatible types in assignment (expression has type "ndarray[Any, dtype[Any]]", variable has type "int")  [assignment]
qiskit/algorithms/optimizers/aqgd.py:223: error: Incompatible types in assignment (expression has type "floating[Any]", variable has type "None")  [assignment]
qiskit/algorithms/optimizers/aqgd.py:333: error: Incompatible types in assignment (expression has type "Union[float, ndarray[Any, Any]]", variable has type "ndarray[Any, Any]")  [assignment]
qiskit/algorithms/optimizers/gradient_descent.py:257: error: Argument 2 has incompatible type "Union[float, ndarray[Any, Any]]"; expected "ndarray[Any, Any]"  [arg-type]
qiskit/algorithms/optimizers/gradient_descent.py:271: error: Incompatible types in assignment (expression has type "Union[float, List[float], ndarray[Any, Any]]", variable has type "Union[float, ndarray[Any, Any]]")  [assignment]
qiskit/algorithms/optimizers/gradient_descent.py:303: error: Argument 1 to "shape" has incompatible type "Union[float, ndarray[Any, Any], List[Union[float, ndarray[Any, Any]]]]"; expected "Union[_SupportsArray[dtype[Any]], _NestedSequence[_SupportsArray[dtype[Any]]], bool, int, float, complex, str, bytes, _NestedSequence[Union[bool, int, float, complex, str, bytes]]]"  [arg-type]
qiskit/algorithms/optimizers/gradient_descent.py:306: error: Incompatible types in assignment (expression has type "floating[Any]", variable has type "Optional[float]")  [assignment]
qiskit/algorithms/optimizers/gradient_descent.py:306: error: Argument 1 to "norm" has incompatible type "Union[float, ndarray[Any, Any], List[Union[float, ndarray[Any, Any]]]]"; expected "Union[_SupportsArray[dtype[Any]], _NestedSequence[_SupportsArray[dtype[Any]]], bool, int, float, complex, str, bytes, _NestedSequence[Union[bool, int, float, complex, str, bytes]]]"  [arg-type]
qiskit/algorithms/optimizers/gradient_descent.py:332: error: Argument 1 to "len" has incompatible type "Union[float, ndarray[Any, Any], List[Union[float, ndarray[Any, Any]]]]"; expected "Sized"  [arg-type]
qiskit/algorithms/optimizers/gradient_descent.py:334: error: Argument 1 has incompatible type "Union[float, ndarray[Any, Any], List[Union[float, ndarray[Any, Any]]]]"; expected "Union[float, ndarray[Any, Any]]"  [arg-type]
qiskit/algorithms/optimizers/gsls.py:127: error: Incompatible types in assignment (expression has type "float", variable has type "Optional[int]")  [assignment]
qiskit/algorithms/optimizers/gsls.py:246: error: Incompatible return value type (got "Tuple[ndarray[Any, Any], Any, int, SupportsFloat]", expected "Tuple[ndarray[Any, Any], float, int, float]")  [return-value]
qiskit/algorithms/optimizers/optimizer_utils/learning_rate.py:43: error: Incompatible types in assignment (expression has type "Iterator[Any]", variable has type "Generator[float, None, None]")  [assignment]
qiskit/algorithms/optimizers/p_bfgs.py:122: error: Need type annotation for "queue"  [var-annotated]
qiskit/algorithms/optimizers/qnspsa.py:358: error: Argument 1 to "assign_parameters" of "QuantumCircuit" has incompatible type "ParameterVector"; expected "Union[Mapping[Parameter, Union[ParameterExpression, float]], Sequence[Union[ParameterExpression, float]]]"  [arg-type]
qiskit/algorithms/optimizers/qnspsa.py:359: error: Argument 1 to "assign_parameters" of "QuantumCircuit" has incompatible type "ParameterVector"; expected "Union[Mapping[Parameter, Union[ParameterExpression, float]], Sequence[Union[ParameterExpression, float]]]"  [arg-type]
qiskit/algorithms/optimizers/qnspsa.py:376: error: All conditional function variants must have identical signatures  [misc]
qiskit/algorithms/optimizers/scipy_optimizer.py:94: error: "SciPyOptimizer" has no attribute "_OPTIONS"  [attr-defined]
qiskit/algorithms/optimizers/spsa.py:388: error: Incompatible types in assignment (expression has type "Union[float, ndarray[Any, Any]]", variable has type "ndarray[Any, dtype[Any]]")  [assignment]
qiskit/algorithms/optimizers/spsa.py:394: error: Incompatible types in assignment (expression has type "Union[float, ndarray[Any, Any]]", variable has type "ndarray[Any, dtype[Any]]")  [assignment]
qiskit/algorithms/optimizers/spsa.py:512: error: Argument 2 to "calibrate" of "SPSA" has incompatible type "Union[float, ndarray[Any, Any]]"; expected "ndarray[Any, Any]"  [arg-type]
qiskit/algorithms/optimizers/spsa.py:522: error: Incompatible types in assignment (expression has type "Callable[[ndarray[Any, Any], ndarray[Any, Any]], ndarray[Any, Any]]", variable has type overloaded function)  [assignment]
qiskit/algorithms/optimizers/spsa.py:631: error: No overload variant of "mean" matches argument types "deque[ndarray[Any, dtype[Any]]]", "int"  [call-overload]
qiskit/algorithms/optimizers/spsa.py:631: note: Possible overload variants:
qiskit/algorithms/optimizers/spsa.py:631: note:     def mean(a: Union[_SupportsArray[dtype[Union[bool_, integer[Any], floating[Any]]]], _NestedSequence[_SupportsArray[dtype[Union[bool_, integer[Any], floating[Any]]]]], bool, int, float, _NestedSequence[Union[bool, int, float]]], axis: None = ..., dtype: None = ..., out: None = ..., keepdims: Literal[False] = ..., *, where: Union[_SupportsArray[dtype[bool_]], _NestedSequence[_SupportsArray[dtype[bool_]]], bool, _NestedSequence[bool]] = ...) -> floating[Any]
qiskit/algorithms/optimizers/spsa.py:631: note:     def mean(a: Union[_SupportsArray[dtype[Union[bool_, integer[Any], floating[Any], complexfloating[Any, Any]]]], _NestedSequence[_SupportsArray[dtype[Union[bool_, integer[Any], floating[Any], complexfloating[Any, Any]]]]], bool, int, float, complex, _NestedSequence[Union[bool, int, float, complex]]], axis: None = ..., dtype: None = ..., out: None = ..., keepdims: Literal[False] = ..., *, where: Union[_SupportsArray[dtype[bool_]], _NestedSequence[_SupportsArray[dtype[bool_]]], bool, _NestedSequence[bool]] = ...) -> complexfloating[Any, Any]
qiskit/algorithms/optimizers/spsa.py:631: note:     def mean(a: Union[Union[_SupportsArray[dtype[Union[bool_, integer[Any], floating[Any], complexfloating[Any, Any]]]], _NestedSequence[_SupportsArray[dtype[Union[bool_, integer[Any], floating[Any], complexfloating[Any, Any]]]]], bool, int, float, complex, _NestedSequence[Union[bool, int, float, complex]]], Union[_SupportsArray[dtype[object_]], _NestedSequence[_SupportsArray[dtype[object_]]]]], axis: Optional[Union[SupportsIndex, Sequence[SupportsIndex]]] = ..., dtype: None = ..., out: None = ..., keepdims: bool = ..., *, where: Union[_SupportsArray[dtype[bool_]], _NestedSequence[_SupportsArray[dtype[bool_]]], bool, _NestedSequence[bool]] = ...) -> Any
qiskit/algorithms/optimizers/spsa.py:631: note:     def [_SCT <: generic] mean(a: Union[Union[_SupportsArray[dtype[Union[bool_, integer[Any], floating[Any], complexfloating[Any, Any]]]], _NestedSequence[_SupportsArray[dtype[Union[bool_, integer[Any], floating[Any], complexfloating[Any, Any]]]]], bool, int, float, complex, _NestedSequence[Union[bool, int, float, complex]]], Union[_SupportsArray[dtype[object_]], _NestedSequence[_SupportsArray[dtype[object_]]]]], axis: None = ..., dtype: Union[dtype[_SCT], Type[_SCT], _SupportsDType[dtype[_SCT]]] = ..., out: None = ..., keepdims: Literal[False] = ..., *, where: Union[_SupportsArray[dtype[bool_]], _NestedSequence[_SupportsArray[dtype[bool_]]], bool, _NestedSequence[bool]] = ...) -> _SCT
qiskit/algorithms/optimizers/spsa.py:631: note:     def mean(a: Union[Union[_SupportsArray[dtype[Union[bool_, integer[Any], floating[Any], complexfloating[Any, Any]]]], _NestedSequence[_SupportsArray[dtype[Union[bool_, integer[Any], floating[Any], complexfloating[Any, Any]]]]], bool, int, float, complex, _NestedSequence[Union[bool, int, float, complex]]], Union[_SupportsArray[dtype[object_]], _NestedSequence[_SupportsArray[dtype[object_]]]]], axis: Optional[Union[SupportsIndex, Sequence[SupportsIndex]]] = ..., dtype: Union[dtype[Any], None, Type[Any], _SupportsDType[dtype[Any]], str, Union[Tuple[Any, int], Tuple[Any, Union[SupportsIndex, Sequence[SupportsIndex]]], List[Any], _DTypeDict, Tuple[Any, Any]]] = ..., out: None = ..., keepdims: bool = ..., *, where: Union[_SupportsArray[dtype[bool_]], _NestedSequence[_SupportsArray[dtype[bool_]]], bool, _NestedSequence[bool]] = ...) -> Any
qiskit/algorithms/optimizers/spsa.py:631: note:     def [_ArrayType <: ndarray[Any, dtype[Any]]] mean(a: Union[Union[_SupportsArray[dtype[Union[bool_, integer[Any], floating[Any], complexfloating[Any, Any]]]], _NestedSequence[_SupportsArray[dtype[Union[bool_, integer[Any], floating[Any], complexfloating[Any, Any]]]]], bool, int, float, complex, _NestedSequence[Union[bool, int, float, complex]]], Union[_SupportsArray[dtype[object_]], _NestedSequence[_SupportsArray[dtype[object_]]]]], axis: Optional[Union[SupportsIndex, Sequence[SupportsIndex]]] = ..., dtype: Union[dtype[Any], None, Type[Any], _SupportsDType[dtype[Any]], str, Union[Tuple[Any, int], Tuple[Any, Union[SupportsIndex, Sequence[SupportsIndex]]], List[Any], _DTypeDict, Tuple[Any, Any]]] = ..., out: _ArrayType = ..., keepdims: bool = ..., *, where: Union[_SupportsArray[dtype[bool_]], _NestedSequence[_SupportsArray[dtype[bool_]]], bool, _NestedSequence[bool]] = ...) -> _ArrayType
qiskit/algorithms/optimizers/umda.py:206: error: Argument 1 to "len" has incompatible type "Union[float, ndarray[Any, Any]]"; expected "Sized"  [arg-type]
qiskit/algorithms/phase_estimators/hamiltonian_phase_estimation.py:124: error: Incompatible return value type (got "Union[PhaseEstimationScale, float]", expected "PhaseEstimationScale")  [return-value]
qiskit/algorithms/phase_estimators/hamiltonian_phase_estimation.py:139: error: Argument "synthesis" to "PauliEvolutionGate" has incompatible type "Union[EvolutionSynthesis, EvolutionBase]"; expected "Optional[EvolutionSynthesis]"  [arg-type]
qiskit/algorithms/phase_estimators/hamiltonian_phase_estimation.py:147: error: Item "EvolutionSynthesis" of "Union[EvolutionSynthesis, EvolutionBase]" has no attribute "convert"  [union-attr]
qiskit/algorithms/phase_estimators/hamiltonian_phase_estimation.py:147: error: Incompatible types in assignment (expression has type "Union[Any, OperatorBase]", variable has type "QuantumCircuit")  [assignment]
qiskit/algorithms/phase_estimators/hamiltonian_phase_estimation.py:207: error: "QuantumCircuit" has no attribute "prepare_state"  [attr-defined]
qiskit/algorithms/phase_estimators/hamiltonian_phase_estimation.py:256: error: "OperatorBase" has no attribute "to_circuit"; maybe "to_circuit_op"?  [attr-defined]
qiskit/algorithms/phase_estimators/hamiltonian_phase_estimation.py:259: error: Argument "state_preparation" to "estimate" of "PhaseEstimation" has incompatible type "Union[StateFn, QuantumCircuit, Statevector, None]"; expected "Optional[QuantumCircuit]"  [arg-type]
qiskit/algorithms/phase_estimators/hamiltonian_phase_estimation.py:304: error: Item "SparsePauliOp" of "Union[PauliSumOp, SparsePauliOp]" has no attribute "reduce"  [union-attr]
qiskit/algorithms/phase_estimators/ipe.py:112: error: Argument 1 to "append" of "QuantumCircuit" has incompatible type "QuantumCircuit"; expected "Union[Operation, CircuitInstruction]"  [arg-type]
qiskit/algorithms/phase_estimators/ipe.py:112: error: Argument 2 to "append" of "QuantumCircuit" has incompatible type "QuantumRegister"; expected "Optional[Sequence[Union[Qubit, QuantumRegister, int, slice, Sequence[Union[Qubit, int]]]]]"  [arg-type]
qiskit/algorithms/phase_estimators/ipe.py:177: error: Signature of "estimate" incompatible with supertype "PhaseEstimator"  [override]
qiskit/algorithms/phase_estimators/ipe.py:177: note:      Superclass:
qiskit/algorithms/phase_estimators/ipe.py:177: note:          def estimate(self, unitary: QuantumCircuit, state_preparation: Optional[QuantumCircuit] = ...) -> PhaseEstimatorResult
qiskit/algorithms/phase_estimators/ipe.py:177: note:      Subclass:
qiskit/algorithms/phase_estimators/ipe.py:177: note:          def estimate(unitary: QuantumCircuit, state_preparation: QuantumCircuit) -> IterativePhaseEstimationResult
qiskit/algorithms/phase_estimators/phase_estimation.py:241: error: Incompatible types in assignment (expression has type "Union[ndarray[Any, Any], Counts]", variable has type "Dict[str, Any]")  [assignment]
qiskit/algorithms/phase_estimators/phase_estimation_result.py:95: error: Argument 1 to "binary_repr" has incompatible type "signedinteger[Any]"; expected "int"  [arg-type]
qiskit/algorithms/phase_estimators/phase_estimation_result.py:140: error: Invalid index type "Union[str, float]" for "Dict[float, Any]"; expected type "float"  [index]
qiskit/algorithms/phase_estimators/phase_estimation_scale.py:138: error: Argument 1 to "abs" has incompatible type "Union[complex, ParameterExpression]"; expected "SupportsAbs[float]"  [arg-type]
qiskit/algorithms/phase_estimators/phase_estimation_scale.py:144: error: Module has no attribute "eigvalsh"  [attr-defined]
qiskit/algorithms/phase_estimators/phase_estimation_scale.py:159: error: Argument 1 to "abs" has incompatible type "Union[complex, ParameterExpression]"; expected "SupportsAbs[float]"  [arg-type]
qiskit/algorithms/state_fidelities/base_state_fidelity.py:47: error: Syntax error in type annotation  [syntax]
qiskit/algorithms/state_fidelities/base_state_fidelity.py:47: note: Suggestion: Use Tuple[T1, ..., Tn] instead of (T1, ..., Tn)
qiskit/algorithms/state_fidelities/base_state_fidelity.py:99: error: Incompatible types in assignment (expression has type "List[Union[Sequence[float], Sequence[Sequence[float]]]]", variable has type "Union[Sequence[float], Sequence[Sequence[float]], None]")  [assignment]
qiskit/algorithms/state_fidelities/base_state_fidelity.py:101: error: Incompatible return value type (got "Union[Sequence[float], Sequence[Sequence[float]]]", expected "Sequence[Sequence[float]]")  [return-value]
qiskit/algorithms/state_fidelities/base_state_fidelity.py:184: error: Argument 1 to "assign_parameters" of "QuantumCircuit" has incompatible type "ParameterVector"; expected "Union[Mapping[Parameter, Union[ParameterExpression, float]], Sequence[Union[ParameterExpression, float]]]"  [arg-type]
qiskit/algorithms/state_fidelities/base_state_fidelity.py:186: error: Argument 1 to "assign_parameters" of "QuantumCircuit" has incompatible type "ParameterVector"; expected "Union[Mapping[Parameter, Union[ParameterExpression, float]], Sequence[Union[ParameterExpression, float]]]"  [arg-type]
qiskit/algorithms/state_fidelities/base_state_fidelity.py:193: error: Unsupported target for indexed assignment ("Mapping[Any, QuantumCircuit]")  [index]
qiskit/algorithms/state_fidelities/base_state_fidelity.py:230: error: Unsupported left operand type for + ("Sequence[float]")  [operator]
qiskit/algorithms/state_fidelities/base_state_fidelity.py:232: error: Incompatible return value type (got "List[Sequence[float]]", expected "List[float]")  [return-value]
qiskit/algorithms/state_fidelities/compute_uncompute.py:71: error: Argument after ** must be a mapping, not "Options"  [arg-type]
qiskit/algorithms/state_fidelities/compute_uncompute.py:133: error: Argument 1 to "_construct_value_list" of "BaseStateFidelity" has incompatible type "Union[QuantumCircuit, Sequence[QuantumCircuit]]"; expected "Sequence[QuantumCircuit]"  [arg-type]
qiskit/algorithms/state_fidelities/compute_uncompute.py:133: error: Argument 2 to "_construct_value_list" of "BaseStateFidelity" has incompatible type "Union[QuantumCircuit, Sequence[QuantumCircuit]]"; expected "Sequence[QuantumCircuit]"  [arg-type]
qiskit/algorithms/state_fidelities/compute_uncompute.py:191: error: Argument after ** must be a mapping, not "Options"  [arg-type]
qiskit/algorithms/time_evolvers/pvqd/pvqd.py:202: error: Argument 1 to "minimize" of "Optimizer" has incompatible type "Callable[[ndarray[Any, Any]], float]"; expected "Callable[[Union[float, ndarray[Any, Any]]], float]"  [arg-type]
qiskit/algorithms/time_evolvers/pvqd/pvqd.py:202: error: Argument 3 to "minimize" of "Optimizer" has incompatible type "Callable[[ndarray[Any, Any]], ndarray[Any, Any]]"; expected "Optional[Callable[[Union[float, ndarray[Any, Any]]], Union[float, ndarray[Any, Any]]]]"  [arg-type]
qiskit/algorithms/time_evolvers/pvqd/pvqd.py:204: error: Missing positional argument "bounds" in call to "__call__" of "Minimizer"  [call-arg]
qiskit/algorithms/time_evolvers/pvqd/pvqd.py:235: error: Argument 1 to "bind_parameters" of "QuantumCircuit" has incompatible type "ndarray[Any, Any]"; expected "Union[Mapping[Parameter, float], Sequence[float]]"  [arg-type]
qiskit/algorithms/time_evolvers/pvqd/pvqd.py:303: error: Value of type "Union[float, List[float]]" is not indexable  [index]
qiskit/algorithms/time_evolvers/pvqd/pvqd.py:303: error: Unsupported left operand type for - ("List[float]")  [operator]
qiskit/algorithms/time_evolvers/pvqd/pvqd.py:303: note: Both left and right operands are unions
qiskit/algorithms/time_evolvers/pvqd/pvqd.py:310: error: Incompatible return value type (got "Tuple[Callable[[Union[ndarray[Any, Any], List[ndarray[Any, Any]]]], Union[float, List[float]]], Callable[[ndarray[Any, Any]], ndarray[Any, Any]]]", expected "Optional[Tuple[Callable[[ndarray[Any, Any]], float], Callable[[ndarray[Any, Any]], ndarray[Any, Any]]]]")  [return-value]
qiskit/algorithms/time_evolvers/pvqd/pvqd.py:367: error: Argument 2 to "_get_observable_evaluator" has incompatible type "Union[List[Union[BaseOperator, PauliSumOp, None]], Dict[str, Union[BaseOperator, PauliSumOp]]]"; expected "Union[BaseOperator, List[BaseOperator]]"  [arg-type]
qiskit/algorithms/time_evolvers/pvqd/pvqd.py:387: error: Argument 1 to "append" of "list" has incompatible type "float"; expected "int"  [arg-type]
qiskit/algorithms/time_evolvers/pvqd/pvqd.py:391: error: Argument 1 to "bind_parameters" of "QuantumCircuit" has incompatible type "ndarray[Any, Any]"; expected "Union[Mapping[Parameter, float], Sequence[float]]"  [arg-type]
qiskit/algorithms/time_evolvers/pvqd/pvqd.py:397: error: Argument "fidelities" to "PVQDResult" has incompatible type "List[int]"; expected "Optional[List[float]]"  [arg-type]
qiskit/algorithms/time_evolvers/pvqd/pvqd.py:397: note: "List" is invariant -- see https://mypy.readthedocs.io/en/stable/common_issues.html#variance
qiskit/algorithms/time_evolvers/pvqd/pvqd.py:397: note: Consider using "Sequence" instead, which is covariant
qiskit/algorithms/time_evolvers/pvqd/pvqd.py:398: error: Argument "estimated_error" to "PVQDResult" has incompatible type "signedinteger[Union[_64Bit, Any]]"; expected "Optional[float]"  [arg-type]
qiskit/algorithms/time_evolvers/pvqd/pvqd.py:401: error: Incompatible types in assignment (expression has type "List[Union[float, List[float]]]", variable has type "Optional[List[List[float]]]")  [assignment]
qiskit/algorithms/time_evolvers/pvqd/pvqd.py:402: error: Incompatible types in assignment (expression has type "Union[float, List[float]]", variable has type "Optional[Union[List[Optional[Tuple[complex, complex]]], Dict[str, Tuple[complex, complex]]]]")  [assignment]
qiskit/algorithms/time_evolvers/pvqd/utils.py:37: error: Argument "basis_gates" to "transpile" has incompatible type "Set[str]"; expected "Optional[List[str]]"  [arg-type]
qiskit/algorithms/time_evolvers/pvqd/utils.py:49: error: Item "List[QuantumCircuit]" of "Union[QuantumCircuit, List[QuantumCircuit]]" has no attribute "data"  [union-attr]
qiskit/algorithms/time_evolvers/pvqd/utils.py:102: error: Argument "parameter_values" to "run" of "BaseEstimator" has incompatible type "List[ndarray[Any, Any]]"; expected "Union[Sequence[float], Sequence[Sequence[float]], None]"  [arg-type]
qiskit/algorithms/time_evolvers/time_evolution_problem.py:85: error: "QuantumCircuit" has no attribute "prepare_state"  [attr-defined]
qiskit/algorithms/time_evolvers/trotterization/trotter_qrte.py:159: error: Argument 1 to "append" of "QuantumCircuit" has incompatible type "QuantumCircuit"; expected "Union[Operation, CircuitInstruction]"  [arg-type]
qiskit/algorithms/time_evolvers/trotterization/trotter_qrte.py:175: error: Argument 2 to "TimeEvolutionResult" has incompatible type "Union[List[Optional[Tuple[complex, Dict[str, Any]]]], Dict[str, Tuple[complex, Dict[str, Any]]]]"; expected "Optional[Union[List[Optional[Tuple[complex, complex]]], Dict[str, Tuple[complex, complex]]]]"  [arg-type]
qiskit/algorithms/utils/validate_initial_point.py:61: error: Incompatible types in assignment (expression has type "ndarray[Any, dtype[floating[_64Bit]]]", variable has type "Optional[Sequence[float]]")  [assignment]

@Randl Randl requested review from a team, manoelmarques and woodsp-ibm as code owners June 29, 2022 08:30
@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:

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

coveralls commented Jun 30, 2022

Pull Request Test Coverage Report for Build 4616344150

  • 417 of 422 (98.82%) changed or added relevant lines in 85 files are covered.
  • 104 unchanged lines in 11 files lost coverage.
  • Overall coverage increased (+0.02%) to 85.408%

Changes Missing Coverage Covered Lines Changed/Added Lines %
qiskit/algorithms/amplitude_estimators/mlae.py 14 15 93.33%
qiskit/algorithms/eigen_solvers/vqd.py 25 26 96.15%
qiskit/algorithms/gradients/utils.py 0 1 0.0%
qiskit/algorithms/optimizers/gradient_descent.py 9 10 90.0%
qiskit/algorithms/optimizers/umda.py 13 14 92.86%
Files with Coverage Reduction New Missed Lines %
qiskit/algorithms/eigen_solvers/vqd.py 1 88.29%
qiskit/algorithms/eigensolvers/vqd.py 1 96.28%
qiskit/algorithms/gradients/finite_diff_estimator_gradient.py 1 93.42%
qiskit/primitives/backend_estimator.py 1 95.37%
qiskit/primitives/backend_sampler.py 1 97.73%
qiskit/pulse/utils.py 2 94.29%
qiskit/circuit/init.py 5 84.38%
qiskit/circuit/library/standard_gates/multi_control_rotation_gates.py 10 93.38%
qiskit/circuit/quantumcircuitdata.py 11 88.18%
qiskit/transpiler/passmanager.py 12 93.68%
Totals Coverage Status
Change from base Build 4587865335: 0.02%
Covered Lines: 67488
Relevant Lines: 79018

💛 - Coveralls

@Randl
Copy link
Contributor Author

Randl commented Oct 4, 2022

I've rebased the PR on master

@rht
Copy link
Contributor

rht commented Oct 4, 2022

This PR is much bigger now due to the | refactor. I think you should have done the refactor in a separate PR later instead of combining it in 1 PR (which commits are likely going to be squashed). Now it is harder for me to spot an issue due to the Mypy error in the sea of | refactor. The refactor itself is not required to fix the Mypy errors, with Mypy errors being the theme of this PR. Also, in general, your PR is easier to be merged if the number of LOC changes is smaller. I guess it is fine for this PR for now since you have already applied the changes. But you shouldn't do the same for the other Mypy fix PRs.

self._circuit_results = None
self._max_probability = None
self._oracle_evaluation: bool | None = None
self._circuit_results: list[np.ndarray] | list[dict[str, int]] | None = None
Copy link
Contributor

Choose a reason for hiding this comment

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

This annotation is duplicated in the return of circuit_results method. You should make a type alias CircuitResultsT = list[np.ndarray] | list[dict[str, int]] | None. And I think you have to use Optional and Union for the type alias declaration. Because it is not supported yet until Python 3.10.

Copy link
Contributor

Choose a reason for hiding this comment

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

Actually, you should exclude the | None in the CircuitResultsT declaration, because the circuit_results setter doesn't expect None.

@rht
Copy link
Contributor

rht commented Oct 5, 2022

I have reviewed all of the amplitude_amplifiers folder. I think they can be moved to a separate PR so that it is more manageable.

@woodsp-ibm woodsp-ibm added the mod: algorithms Related to the Algorithms module label Feb 14, 2023
@woodsp-ibm
Copy link
Member

I commented in the #8269 one for opflow that algorithms have been refactored over to use the new primitive based execution paradigm and away from opflow. So since this was started there has been quite a bit of change. Is this something you wish to complete. While opflow is being completely deprecated parts of the algorithms are, linear solvers (hhl), factorizers (shor) are deprecated and minimum_eigen_solvers, eigen_solvers and evolvers are pending deprecation now and will be deprecated shortly. The latter are replaced by primitive based equivalents in minimum_eigensolvers, eigensolvers (no _ between eigen and solvers in the new names) and time_evolvers respectively. Amplitude amplifiers, amplitude estimators and phase estimators are refactored in place and take either QuantumInstance and use opflow, or take/use a Sampler (primitive) with the former, now pending deprecated, and will be deprecated leaving them only taking a primitive. So some files, those that will be removed, like opflow, we could consider not changing them - it would be complete folders for minimum_eigen_solvers, eigen_solvers, evolvers, linear solvers and factorizers. Some work has already been done there and I do not know what might be needed to complete it. Either way that code will be removed in the future. The rest will remain so if you are interested in completing this I guess there is still quite a bit to do - especially since quite a bit of new code has been added since this work was started.

@woodsp-ibm woodsp-ibm added the mypy Work related to support improving type hints in Qiskti code label Feb 14, 2023
@Randl
Copy link
Contributor Author

Randl commented Feb 14, 2023

This was something we discussed originally when creating PRs, that unless typechecks are CI'd there will be overhead of added untyped code. I'm well aware of it.

I can rebase on master whenever there are plans to review this PR. I will also add fixes for obvious stuff in new code. Anyway there we no plans to fix everything in one PR, only add fixes to whatever can be and try to discuss the less obvious issues.

@Randl
Copy link
Contributor Author

Randl commented Mar 28, 2023

So @woodsp-ibm can you please review the PR?

qiskit/algorithms/amplitude_amplifiers/grover.py Outdated Show resolved Hide resolved
qiskit/algorithms/amplitude_amplifiers/grover.py Outdated Show resolved Hide resolved
qiskit/algorithms/amplitude_amplifiers/grover.py Outdated Show resolved Hide resolved
qiskit/algorithms/amplitude_estimators/fae.py Outdated Show resolved Hide resolved
qiskit/algorithms/gradients/utils.py Outdated Show resolved Hide resolved
qiskit/algorithms/optimizers/umda.py Outdated Show resolved Hide resolved
qiskit/algorithms/time_evolvers/pvqd/pvqd.py Outdated Show resolved Hide resolved
Co-authored-by: Julien Gacon <gaconju@gmail.com>
@Randl
Copy link
Contributor Author

Randl commented Apr 4, 2023

@Cryoris @woodsp-ibm @ElePT do you mind to review? I know this PR is large, but that's precisely why it is hard to keep it up-to-date.

Copy link
Contributor

@ElePT ElePT left a comment

Choose a reason for hiding this comment

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

Thanks for working on this PR! It was indeed long, I left a few comments but overall LGTM

@@ -294,7 +298,7 @@ def amplify(self, amplification_problem: AmplificationProblem) -> "GroverResult"
raise AlgorithmError("Sampler job failed.") from exc

num_bits = len(amplification_problem.objective_qubits)
circuit_results = {
circuit_results: dict[str, Any] | Statevector | np.ndarray = {
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 just FYI, the quantum instance is deprecated and will be removed in following qiskit releases. Once the quantum instance is removed, I believe that the circuit_results will always be a dict[str,float], because the type of results.quasi_dists in the line below is fixed. This is not the only annotation that will be simplified, so I can keep track of these when we open the removal PR.

@@ -13,7 +13,7 @@
"""The Maximum Likelihood Amplitude Estimation algorithm."""

from __future__ import annotations
import typing
from typing import Sequence, Callable, List, Tuple
Copy link
Contributor

Choose a reason for hiding this comment

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

I remember this working for normal typehints, but failing for defining custom types in 3.7:

>>> from __future__ import annotations
>>> A = list[float]
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: 'type' object is not subscriptable

I think the issue here is line 32. We ran into a similar problem in Nature and just reverted to typing, I don't know if there is any good workaround.

qiskit/algorithms/gradients/base_qgt.py Outdated Show resolved Hide resolved
qiskit/algorithms/gradients/base_sampler_gradient.py Outdated Show resolved Hide resolved
Copy link
Contributor

@ElePT ElePT 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!

@ElePT ElePT enabled auto-merge April 5, 2023 08:11
@ElePT ElePT added this pull request to the merge queue Apr 5, 2023
Merged via the queue into Qiskit:main with commit c0e4141 Apr 5, 2023
giacomoRanieri pushed a commit to giacomoRanieri/qiskit-terra that referenced this pull request Apr 16, 2023
* Fix mypy errors (algorithms)

* Fix formating

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

* Remove ignores, fix imports and a couple of small bugs

* More fixes

* Update qiskit/algorithms/minimum_eigen_solvers/vqe.py

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

* More fixes

* Remove TODO

* Fix `eval_observables` with `Backend` parameter

* Fix some more annotations

* Fix some TODOs

* Get rid of typing imports where possible

* Fix annotation

* Fix wrong result population

* Fix result types for VQD

* Fix lint

* Remove trailing mypy comment

---------

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 mypy errors (algorithms)

* Fix formating

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

* Remove ignores, fix imports and a couple of small bugs

* More fixes

* Update qiskit/algorithms/minimum_eigen_solvers/vqe.py

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

* More fixes

* Remove TODO

* Fix `eval_observables` with `Backend` parameter

* Fix some more annotations

* Fix some TODOs

* Get rid of typing imports where possible

* Fix annotation

* Fix wrong result population

* Fix result types for VQD

* Fix lint

* Remove trailing mypy comment

---------

Co-authored-by: Julien Gacon <gaconju@gmail.com>
ElePT pushed a commit to ElePT/qiskit that referenced this pull request Jun 27, 2023
* Fix mypy errors (algorithms)

* Fix formating

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

* Remove ignores, fix imports and a couple of small bugs

* More fixes

* Update qiskit/algorithms/minimum_eigen_solvers/vqe.py

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

* More fixes

* Remove TODO

* Fix `eval_observables` with `Backend` parameter

* Fix some more annotations

* Fix some TODOs

* Get rid of typing imports where possible

* Fix annotation

* Fix wrong result population

* Fix result types for VQD

* Fix lint

* Remove trailing mypy comment

---------

Co-authored-by: Julien Gacon <gaconju@gmail.com>
ElePT pushed a commit to ElePT/qiskit-algorithms-test that referenced this pull request Jul 17, 2023
* Fix mypy errors (algorithms)

* Fix formating

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

* Remove ignores, fix imports and a couple of small bugs

* More fixes

* Update qiskit/algorithms/minimum_eigen_solvers/vqe.py

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

* More fixes

* Remove TODO

* Fix `eval_observables` with `Backend` parameter

* Fix some more annotations

* Fix some TODOs

* Get rid of typing imports where possible

* Fix annotation

* Fix wrong result population

* Fix result types for VQD

* Fix lint

* Remove trailing mypy comment

---------

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
Community PR PRs from contributors that are not 'members' of the Qiskit repo mod: algorithms Related to the Algorithms module mypy Work related to support improving type hints in Qiskti code
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

9 participants