Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
QuLogic merged 2 commits intomatplotlib:masterfromanntzer:rc_context
Jul 31, 2017

Conversation

anntzer
Copy link
Contributor

@anntzeranntzer commentedJul 30, 2017
edited
Loading

  • 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 callingdict.__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 rcparamlines.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

  • Has Pytest style unit tests
  • Code is PEP 8 compliant
  • New features are documented, with examples if plot related
  • Documentation is sphinx and numpydoc compliant
  • Added an entry to doc/users/next_whats_new/ if major new feature (follow instructions in README.rst there)
  • Documented in doc/api/api_changes.rst if API changed in a backward-incompatible way

@anntzeranntzerforce-pushed therc_context branch 2 times, most recently fromcf42412 tof7134f2CompareJuly 30, 2017 09:46
Copy link
Member

@tacaswelltacaswell left a 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 thatchain is no longer available in the mpl namespace, but people should not be using that anyway!

.. autofunction::rcdefaults

.. autofunction::rc_file
.. autodata:: rc_context
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

autodata?

Copy link
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Seehttp://www.sphinx-doc.org/en/stable/ext/autodoc.html?highlight=autodata#directive-autofunction, but I guess this technically still qualifies as a function.

@anntzer
Copy link
ContributorAuthor

Looks like s-g fails to resolvehttps://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)

@QuLogic
Copy link
Member

You'll need to rebase against#8955 (or just latestmaster).

- 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) isthat it may make sense to smuggle seemingly "invalid" values into thercParams (by calling `dict.__setitem__`), and we do not want them tocause an error when exiting a rc_context (of course, they may or may notcause an error at the backend level, but that is the responsibility ofwhoever 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'sinternal 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 toreorder all the rc-related functions slightly more logically.)
@anntzer
Copy link
ContributorAuthor

thanks, done

@QuLogicQuLogic added this to the2.1 (next point release) milestoneJul 31, 2017
@QuLogicQuLogic merged commitc4d7ce4 intomatplotlib:masterJul 31, 2017
@anntzeranntzer deleted the rc_context branchJuly 31, 2017 02:39
@anntzeranntzer mentioned this pull requestOct 22, 2017
1 task
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@tacaswelltacaswelltacaswell approved these changes

Assignees
No one assigned
Projects
None yet
Milestone
v2.1
Development

Successfully merging this pull request may close these issues.

3 participants
@anntzer@QuLogic@tacaswell

[8]ページ先頭

©2009-2025 Movatter.jp