Closed akashin closed 5 months ago
Multiple
dict
s haveAny
as value type. Would it be possible to use more narrow types instead? This might also help to make relationships between functions that operate on the same type ofdict
more clear. For instance the relationship betweenread_summary
andwrite_summary
.I suppose using more narrow types is optional, as for a CI script it might be sufficient to fail at runtime if a
dict
contains unexpected types.
Yes, it is definitely possible. I think it makes sense for read_summary
and write_summary
, although instead of narrowing the Any
type I think we should introduce a Summary
type instead of dict
.
For to_csv_record
and from_csv_record
I don't think there is much value in narrowing Any
type as that wouldn't improve the type-checking anywhere.
Noticed that pdm run mypy
could be added here too:
This should make the code safer and easier to read.
To verify the types you can run: