Don't revalidate original rcParams when exiting rc_context.#8962
Don't revalidate original rcParams when exiting rc_context.#8962QuLogic merged 2 commits intomatplotlib:masterfrom
Conversation
cf42412 to
f7134f2
Compare
tacaswell
left a comment
There was a problem hiding this comment.
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.
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.antialiasedis 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