8000 Deprecate Artist.aname and Axes.aname by timhoffm · Pull Request #11942 · matplotlib/matplotlib · GitHub
[go: up one dir, main page]

Skip to content

Deprecate Artist.aname and Axes.aname #11942

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 27, 2018

Conversation

timhoffm
Copy link
Member

PR Summary

The field aname seems completely unused. It's information can also determined from the class via isinstance() checks or __class__.__name__.

The field should finally be removed. This PR deprecates the field, just in case any user is relying on it.

The field is turned into a property so that a deprecation warning is issued on access. I've refrained from creating a property setter, because I cannot imagine any real-world usecase that would want to set this to another value.

@timhoffm timhoffm added this to the v3.1 milestone Aug 26, 2018
@@ -5,3 +5,6 @@ Support for custom backends that do not provide a ``set_hatch_color`` method is
deprecated. We suggest that custom backends let their ``GraphicsContext``
class inherit from `GraphicsContextBase`, to at least provide stubs for all
required methods.

The fields ``Artist.aname`` and ``Axes.aname`` are deprecated. Please use
``isinstance()`` or ``__class__.__name__`` checks instead.
Copy link
Contributor

Choose a reason for hiding this comment

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

Well technically that's not the same (all subclasses of Axes, e.g. AxesSubplot, have "Axes" as aname, and similarly for Artist), but I agree that's not even close to being a reason not to deprecate it...

@@ -71,8 +71,10 @@ class Artist(object):
Abstract base class for someone who renders into a
:class:`FigureCanvas`.
"""
@cbook.deprecated("3.1")
def aname(self):
Copy link
Contributor

Choose a reason for hiding this comment

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

missing @property, below too

Copy link
Member
@NelleV NelleV left a comment

Choose a reason for hiding this comment

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

Thanks @timhoffm ! This LGTM

@dstansby dstansby merged commit 9857e7c into matplotlib:master Aug 27, 2018
@timhoffm timhoffm deleted the deprecate-aname branch August 27, 2018 16:24
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
0