Fix CI for mypy and add explicit shape for COO #919
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
To fix CI. I tested the changes on a couple of machines 1 with 3.9 the other 3.12 and it seems to pass checks locally.
Fixes #917
Details and comments
There was a unit test failure around shape. See Nightly tests failing around sparse COO #917 so I added shape parameter explicitly to COO. This had been noted in a deprecation warning that shape would become required and did so in the lastest sparse which is where things broke. It still works with the earlier sparse versions where its optional.
There are several mypy failures as below. These do not show up in 3.9 and my first attempt was to add a type: ignore comment for the incompatible type ones which passed under 3.12 but under 3.9 gave
error: Unused "type: ignore" comment [unused-ignore]
as it does not fail under the older mypy which is still in use by 3.9. Given the code works, though I guess the newer mypy notes the type differences from what it sees to start with being assigned to what is done to the same variable later I simply added an Any type to the variable which passes mypy now under 3.9 and 3.12 since it allows all (any) types.For the pegagos_svc failure I cast the return of the algorithm_globals.random.integers call to an int type so as to avoid the later use of it in the get being unable to match appropriately.