-
Notifications
You must be signed in to change notification settings - Fork 61
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
MyPy fixes #1532
MyPy fixes #1532
Conversation
This is failing due to changes in Pandas-related time signature codes. See: #1534 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good!
I think I would have preferred leaving the default values of robustness_categories
in the signature because even though the docstring is verbose, it makes it clear what the fault behaviour is. Not going to die on this hill tho.
categories: list[str] | None = None, | ||
ops: list[tuple[str, str]] | None = None, | ||
thresholds: list[tuple[float, float]] | None = None, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this because MyPy doesn't like complex default values ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's not so much that it's complex values, it's because those values are treated as mutable objects. It's very easy for a user developer to accidentally modify the default arguments during calls, leading to weird behaviour when called again.
https://stackoverflow.com/questions/1132941/least-astonishment-and-the-mutable-default-argument
Pull Request Checklist:
number
) and pull request (:pull:number
) has been addedWhat kind of change does this PR introduce?
mypy
typing errorsDoes this PR introduce a breaking change?
No, but some call signatures are changed (more precise).
Other information:
https://mypy.readthedocs.io/en/stable/index.html