Chore(Next-Gen): enable pre-commits for CAREamistV2#833
Conversation
CAREamistV2
|
hmm yeah I think maybe this is one of those things pyright is fine with but mypy complains, and now I don't remember why I made the configuration a generic, sorry for complicating things. But a solution here is to replace the typing of the config arg in the NGConfigurationType = (
NGConfiguration[CAREAlgorithm]
| NGConfiguration[N2NAlgorithm]
| NGConfiguration[N2VAlgorithm]
) |
No need to apologize. It is a bit annoying that generics are so annoying in Python (at least for mypy). Maybe another nail in the coffin. Implemented the change in 68b39be |
| val_data_target=val_data_target, | ||
| train_data_mask=filtering_mask, | ||
| loading=loading, | ||
| loading=loading, # type: ignore |
There was a problem hiding this comment.
damn it something else that works with pyright but not mypy, this is happening bec mypy can't resolve overloads that well
There was a problem hiding this comment.
Yep... Moving to pyright is just going to feel good I surmise.
Description
Following #827, this PR enables pre-commit hooks for
CAREamistV2and attempts to solve the errors.Note that there is something fishy with the use of
TypeVarthatmypydisagrees with:One way to solve it to redefine
AlgorithmConfigin 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:
NGTrainingConfig, default preset by algorithm #817 introduces a validator that may improve the situation