💄 Added parameter type hints#33
Conversation
Added type hints for function parameters
mbuttner
left a comment
There was a problem hiding this comment.
Looks good to me, thank you for adding the types!
|
@Ma-Fi-94 I have run the github actions for your PR and the linting fails in the types you added. Can you have a look at the report and address the issues, please? |
Reverted (for now) annotations in two helper functions which made mypy trip up. Additionally, changed two assignments (ll. 216 and 504) from "=0" to "=0.0", so that mypy understands we are dealing with floats here. Finally, explicitly annotated variable dx (l. 507) as float, so that mypy doesn't complain when we assign floats to it later (e.g. l. 525).
|
OK, so all of the typing related error messages are resolved, that is great! The remaining fails are due to reformatting of some files. I suggest that you install |
| y_scale: str = "linear", | ||
| x_lim: List[float] = [-2 * 1e4, 3 * 1e5], | ||
| y_lim: List[float] = [-2 * 1e4, 3 * 1e5], | ||
| ax: Optional[mpl.Axes] = None, |
There was a problem hiding this comment.
I think that you can do from matplotlib.axes import Axes and the replace mpl.Axes by Axes
mbuttner
left a comment
There was a problem hiding this comment.
Import error mpl.Axes.
|
Did! The same problem seems to be the case for the colormap too, I'll also change this. (Also sorry for the flooding, I'm still rather new to collaboratve software development, apologies!) |
|
Don't worry, it took me a while to understand the whole |
|
Thank you for the guidance! |
No changes to the program logic itself; added type hints for some function parameters which have not been provided before.