Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions lib/matplotlib/cbook/deprecation.py
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,36 @@ def finalize(wrapper, new_doc):
obj.__doc__ = new_doc
obj.__init__ = wrapper
return obj

elif isinstance(obj, property):
obj_type = "attribute"
func = None
name = name or obj.fget.__name__
old_doc = obj.__doc__

class _deprecated_property(property):
def __get__(self, instance, owner):
if instance is not None:
from . import _warn_external
_warn_external(message, category)
return super().__get__(instance, owner)

def __set__(self, instance, value):
if instance is not None:
from . import _warn_external
_warn_external(message, category)
return super().__set__(instance, value)

def __delete__(self, instance):
if instance is not None:
from . import _warn_external
_warn_external(message, category)
return super().__delete__(instance)

def finalize(_, new_doc):
return _deprecated_property(
fget=obj.fget, fset=obj.fset, fdel=obj.fdel, doc=new_doc)

else:
obj_type = "function"
if isinstance(obj, classmethod):
Expand Down