Skip to content

Conversation

@mergify
Copy link
Contributor

@mergify mergify bot commented Jun 16, 2025

Summary

Fixes for latest mypy errors in CI

Details and comments

Was erroring as follows

qiskit_machine_learning/neural_networks/effective_dimension.py:72: error: Unused "type: ignore" comment  [unused-ignore]
qiskit_machine_learning/neural_networks/effective_dimension.py:74: error: Unused "type: ignore" comment  [unused-ignore]
qiskit_machine_learning/neural_networks/effective_dimension.py:86: error: Incompatible types in assignment (expression has type "ndarray[Any, dtype[floating[_64Bit]]]", variable has type "None")  [assignment]
qiskit_machine_learning/neural_networks/effective_dimension.py:98: error: Incompatible types in assignment (expression has type "ndarray[Any, dtype[Any]]", variable has type "None")  [assignment]
qiskit_machine_learning/neural_networks/effective_dimension.py:112: error: Incompatible types in assignment (expression has type "ndarray[Any, dtype[floating[_64Bit]]]", variable has type "None")  [assignment]
qiskit_machine_learning/neural_networks/effective_dimension.py:124: error: Incompatible types in assignment (expression has type "ndarray[Any, dtype[Any]]", variable has type "None")  [assignment]
qiskit_machine_learning/neural_networks/effective_dimension.py:150: error: Need type annotation for "param_set"  [var-annotated]
qiskit_machine_learning/neural_networks/effective_dimension.py:334: error: Incompatible types in assignment (expression has type "ndarray[Any, dtype[floating[_64Bit]]]", variable has type "None")  [assignment]
qiskit_machine_learning/neural_networks/effective_dimension.py:349: error: Incompatible types in assignment (expression has type "ndarray[Any, dtype[Any]]", variable has type "None")  [assignment]
qiskit_machine_learning/kernels/algorithms/quantum_kernel_trainer.py:221: error: Incompatible types in assignment (expression has type "Union[Any, float]", variable has type "int")  [assignment]
Found 10 errors in 2 files (checked 188 source files)

The last one above, in quantum_kernel_trainer I fixed it by correcting the type of a field it was accessing when creating the result where the field in question is part of the results parent class VariationalResult in variational_algorithm. The optimal_value had a type mismatch between the getter and the setter.


This is an automatic backport of pull request #944 done by Mergify.

* Fix errors raised by latest  mypy (1.16.0)

* fix comment

* Added type ignore to avoid mypy failure

* Fix date that somehow I messed up

* Make ignore cover the 3.9 and > 3.9 cases

* Fix lint too long line (why was black ok with it?)

(cherry picked from commit 40fc9ab)
@coveralls
Copy link

Pull Request Test Coverage Report for Build 15684213270

Details

  • 7 of 7 (100.0%) changed or added relevant lines in 2 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage remained the same at 90.637%

Totals Coverage Status
Change from base Build 15197430949: 0.0%
Covered Lines: 4366
Relevant Lines: 4817

💛 - Coveralls

@edoaltamura edoaltamura merged commit b79a091 into stable/0.8 Jun 16, 2025
15 checks passed
@edoaltamura edoaltamura deleted the mergify/bp/stable/0.8/pr-944 branch June 16, 2025 15:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants