Satisfy mypy complaints due to nexus merge #94
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.
Fix the errors mypy throws due to the recent merger of the nexus/water module.
These errors seem to fall into two broad categories: the classes
Annotation
andCode
from sdmx1 requireInternationalString
s to be passed as text arguments. I have not yet worked with them, so I don't know for sure that I kept the intended behaviour. Secondly, several functions from the dataclasses module require arguments to be aDataclassInstance
or ofType[DataclassInstance]
or both. Curiously, the dataclasses-provided functionis_dataclass
doesn't just return True when dealing with aDataclassInstance
, but also when dealing with aDataclass
itself. So passing this function is not enough to ensure we're dealing with aDataclassInstance
. Again, I've fixed the conditions so that the correct data types are provided (in util/config.py and util/common.py), but I don't know if I kept the intended behaviour. E.g. in config.py, thereplace
function is the first one to actually require existing to be aDataclassInstance
, but maybe that check would also make sense before, i.e. whenis_dataclass
is called.How to review
Please check that I kept the intended behaviour.
PR checklist
[ ] Add or expand tests; coverage checks bothOnly type-hint related changes intended[ ] Add, expand, or update documentation.Only type-hint related changes intended[ ] Update doc/whatsnew.Only type-hint related changes intended