Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Privatize font_manager.JSONEncoder. #15082

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

Merged
merged 1 commit into from
Aug 23, 2019
Merged

Conversation

anntzer
Copy link
Contributor

@anntzer anntzer commented Aug 19, 2019

... with the usual deprecation dance.

End users can still use json_dump, which provides the necessary
functionality (the docstring was slightly updated at the same time); the
point is to hide the (lengthy) docs of JSONEncoder from the docs
(https://matplotlib.org/devdocs/api/font_manager_api.html#matplotlib.font_manager.JSONEncoder), where they are basically irrelevant.


I guess this picks up another "interesting" issue with missing_references.json: we get missing references when a class (here, the deprecated version of JSONEncoder) has private bases (another prominent case in matplotlib is Axes/_AxesBase), because sphinx tries to link to the base class when generating the inheritance diagram.

PR Summary

PR Checklist

  • Has Pytest style unit tests
  • Code is Flake 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

... with the usual deprecation dance.

End users can still use json_dump, which provides the necessary
functionality (the docstring was slightly updated at the same time); the
point is to hide the (lengthy) docs of JSONEncoder from the docs.
@timhoffm
Copy link
Member

Semi-OT: I come more and more to the conclusion that private base classes are not a great idea.

They try to simplify the API and hide irrelevant parts from the user. But in the end all abstractions are leaky, so the base class shines through. A quick search on the net did not yield any usage or discussion of private base classes.

That doesn't of course help in the present case in which letting the deprecated class inherit from the privatized class seems indeed to be the simplest soloution.

Copy link
Member

@timhoffm timhoffm left a comment

Choose a reason for hiding this comment

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

Anybody can merge after CI pass.

@dstansby dstansby merged commit c634e63 into matplotlib:master Aug 23, 2019
@dstansby dstansby added this to the v3.2.0 milestone Aug 23, 2019
@anntzer anntzer deleted the jsonencoder branch August 23, 2019 09:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants