Allow None in set_prop_cycle (in type hints)#29920
Conversation
`set_prop_cycle` allows to pass `None` for resetting the cycle, but with the current type hints, type checkers give an error for this case.
None in set_prop_cycleNone in set_prop_cycle (in type hints)
There was a problem hiding this comment.
Thank you for opening your first PR into Matplotlib!
If you have not heard from us in a week or so, please leave a new comment below and that should bring it to our attention. Most of our reviewers are volunteers and sometimes things fall through the cracks.
You can also join us on gitter for real-time discussion.
For details on testing, writing docs, and our review process, please see the developer guide
We strive to be a welcoming and open project. Please follow our Code of Conduct.
|
Can you also fix the docstring for |
Add `None` to the docstring as a request from the maintainers.
I just did that. Maybe in the future it would make sense to add the types directly to the code (instead of using stubs) and remove the types from the docstrings, because these are not checked and can be easily out of sync with the actual types. Sphinx can add the types to the generated docs if you do it that way, and if you want to preserve the current presentation format maybe that can be done through a Sphinx plugin. What is the official stance of Matplotlib on this? |
|
When introducing typing, we decided to go with type stubs for several reasons. I would not say that this is set in stone forever, but there are currently no plans to change it. |
PR summary
set_prop_cycleallows to passNonefor resetting the cycle, but with the current type hints, type checkers give an error for this case.PR checklist