You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I think it's a "nice-to-have" addition for users. As far as I know, they're just hints that can generally also be picked up by users from the docstring. So not sure how error feedback would improve? But it does allow you to check the code with mypy (which I haven't really looked at much) and I think the hints can be pretty helpful.
I thought you could also enforce the types but now that I look into it I see that's not true.
This issue came up when someone tried to use the ps.plots.series function with a DataFrame instead of a Series. From the error it was hard to know what went wrong. We could manually add type checks like this :
if not isinstance(head, [pd.Series, ps.Timeseries]):
raise TypeError('expected pandas Series or pastas Timeseries object')
But this is maybe a bit to rigid for pastas. Besides it is a lot of work to implement this for the relevant pastas functions.
It would be nice to have one big file with the correct types of each arguments. This way these types can be implemented correctly in functions. Additionally, checks can be implemented to force the correct types.
Describe the proposed enhancement
Following Pastastore, implement Type Hinting into Pastas to improve Error feedback. @dbrakenhoff, good idea?
The text was updated successfully, but these errors were encountered: