-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Don't revalidate original rcParams when exiting rc_context. #8962
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
Conversation
cf42412
to
f7134f2
Compare
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.
conditional on the doc-building being fixed.
Minor API change in that chain
is no longer available in the mpl namespace, but people should not be using that anyway!
.. autofunction::rcdefaults | ||
|
||
.. autofunction::rc_file | ||
.. autodata:: rc_context |
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.
autodata?
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.
See http://www.sphinx-doc.org/en/stable/ext/autodoc.html?highlight=autodata#directive-autofunction, but I guess this technically still qualifies as a function.
Looks like s-g fails to resolve https://docs.{numpy,scipy}.org/doc/numpy/reference/searchindex.js which indeed do not exist. Not sure whether they used to exist and numpy/scipy changed their docs build? (the issue also appears with s-g 0.1.11 so it's not due to the s-g update) |
You'll need to rebase against #8955 (or just latest |
- Rewrite rc_context using contextmanager, which removes the need for saving state. - When `__exit__`ing rc_context, skip rcParam validation, as the items have already been validated originally. The rationale for not revalidating (beyond a minor gain in speed) is that it may make sense to smuggle seemingly "invalid" values into the rcParams (by calling `dict.__setitem__`), and we do not want them to cause an error when exiting a rc_context (of course, they may or may not cause an error at the backend level, but that is the responsibility of whoever set this "invalid" value). For example, the rcparam `lines.antialiased` is declared as a boolean, but the mpl_cairo backend actually also recognizes any of cairo's internal antialiasing enum values (NONE, FAST, GOOD, BEST, etc.). (The rst docs needed to be slightly updated because .. autoclass:: rc_context won't work anymore, so I also took advantage of that to reorder all the rc-related functions slightly more logically.)
thanks, done |
Rewrite rc_context using contextmanager, which removes the need for
saving state.
When
__exit__
ing rc_context, skip rcParam validation, as the itemshave already been validated originally.
The rationale for not revalidating (beyond a minor gain in speed) is
that it may make sense to smuggle seemingly "invalid" values into the
rcParams (by calling
dict.__setitem__
), and we do not want them tocause an error when exiting a rc_context (of course, they may or may not
cause an error at the backend level, but that is the responsibility of
whoever set this "invalid" value).
For example, the rcparam
lines.antialiased
is declared as a boolean,but the mpl_cairo backend actually also recognizes any of cairo's
internal antialiasing enum values (NONE, FAST, GOOD, BEST, etc.).
(The rst docs needed to be slightly updated because .. autoclass::
rc_context won't work anymore, so I also took advantage of that to
reorder all the rc-related functions slightly more logically.)
PR Summary
PR Checklist