Commit 9e911f2
authored
Chore(Next-Gen): enable pre-commits for
## Description
Following #827, this PR
enables pre-commit hooks for `CAREamistV2` and attempts to solve the
errors.
Note that there is something fishy with the use of `TypeVar` that `mypy`
disagrees with:
```python
src/careamics/careamist_v2.py:128: error: Argument 1 to "_load_model" of "CAREamistV2" has incompatible type "NGConfiguration[CAREAlgorithm] | Path | None"; expected "NGConfiguration[AlgorithmConfig] | Path | None" [arg-type]
src/careamics/careamist_v2.py:128: error: Argument 1 to "_load_model" of "CAREamistV2" has incompatible type "NGConfiguration[N2NAlgorithm] | Path | None"; expected "NGConfiguration[AlgorithmConfig] | Path | None" [arg-type]
src/careamics/careamist_v2.py:128: error: Argument 1 to "_load_model" of "CAREamistV2" has incompatible type "NGConfiguration[N2VAlgorithm] | Path | None"; expected "NGConfiguration[AlgorithmConfig] | Path | None" [arg-type]
Found 3 errors in 1 file (checked 1 source file)
```
One way to solve it to redefine `AlgorithmConfig` in the same module,
rather than importing it. It seems that allows "bounding" the type to
the functions it is used in.
But it would be annoying to have to redefine the generics in every
module. I decided to just ignore it for now for two reasons:
- #817 introduces a validator
that may improve the situation
- Maybe pyright (#698) will
be better suitedCAREamistV2 (#833)1 parent 8a67cf6 commit 9e911f2
4 files changed
Lines changed: 162 additions & 178 deletions
File tree
- docs/v0.1/lightning_api
- src/careamics
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
20 | | - | |
| 20 | + | |
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
| |||
30 | 30 | | |
31 | 31 | | |
32 | 32 | | |
33 | | - | |
| 33 | + | |
34 | 34 | | |
35 | 35 | | |
36 | 36 | | |
| |||
44 | 44 | | |
45 | 45 | | |
46 | 46 | | |
47 | | - | |
| 47 | + | |
48 | 48 | | |
49 | 49 | | |
50 | 50 | | |
| |||
This file was deleted.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
139 | 139 | | |
140 | 140 | | |
141 | 141 | | |
142 | | - | |
143 | | - | |
144 | 142 | | |
145 | 143 | | |
146 | 144 | | |
| |||
0 commit comments