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

Skip to content

Deprecate old and little used formatters. #16170

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
Jan 12, 2020
Merged

Conversation

anntzer
Copy link
Contributor

@anntzer anntzer commented Jan 9, 2020

  • The new ScalarFormatter replaced OldScalarFormatter in 3910bb9 (2005).
  • IndexFormatter appeared in e66091d (2009) but was never used in the
    examples; IndexDateFormatter is unused in the docs since 4ea4b96
    (2009); both can be fairly easily implemented in terms of
    FuncFormatter.

I'm willing to back off the deprecations if there's demand to keep them,
though.

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

@@ -457,7 +458,8 @@ class TestIndexFormatter:
(2, 'label2'),
(2.5, '')])
def test_formatting(self, x, label):
formatter = mticker.IndexFormatter(['label0', 'label1', 'label2'])
with cbook._suppress_matplotlib_deprecation_warning():
formatter = mticker.IndexFormatter(['label0', 'label1', 'label2'])
Copy link
Member

Choose a reason for hiding this comment

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

If we are deprecating, is there any reason to keep the test?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think the usual policy is to get rid of the test only when the API is deprecated too.

Copy link
Member

Choose a reason for hiding this comment

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

I guess that makes sense because we can't break things until we can break them...

@anntzer
Copy link
Contributor Author

anntzer commented Jan 10, 2020

Actually let's ping @efiring in case he has any thought on this as he's probably the only one who was already around when these came in :)

@anntzer anntzer requested a review from efiring January 10, 2020 00:15
@@ -135,3 +135,8 @@ access the transform classes from the :mod:`.scale` module.
``TexManager.cachedir``
~~~~~~~~~~~~~~~~~~~~~~~
Use `matplotlib.get_cachedir()` instead.

``OldScalarFormatter``, ``IndexFormatter`` and ``DateIndexFormatter``
Copy link
Member

Choose a reason for hiding this comment

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

I don't see the deprecation for OldScalarFormatter. While you are at it, maybe also deprecate OldAutoLocator. I think the renaming of these things to "Old" was probably done with eventual deprecation and removal in mind. The IndexFormatters also seem like good candidates for the trash bin. I can imagine NullFormatter being useful in a user interface as one of a choice of Formatters, but it's true, it can be trivially recreated directly or via FuncFormatter.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oops, added it for OldScalarFormatter. Also deprecated OldAutoLocator.
NullFormatter is trivial to recreate with FuncFormatter (or even simpler, FormatStrFormatter("") :-)), but I think it's widely used enough and its implementation so simple that we can leave it in, at least for now.

@jklymak
Copy link
Member

jklymak commented Jan 11, 2020

Self merge is fine after fixing the deprecations rebase

- The new ScalarFormatter replaced OldScalarFormatter in 3910bb9 (2005).
- IndexFormatter appeared in e66091d (2009) but was never used in the
  examples; IndexDateFormatter is unused in the docs since 4ea4b96
  (2009); both can be fairly easily implemented in terms of
  FuncFormatter.

I'm willing to back off the deprecations if there's demand to keep them,
though.
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.

4 participants