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

Appearance settings

Commit 7d4fa75

Browse filesBrowse files
tacaswelltimhoffm
authored andcommitted
Backport PR #12653: Don't warn when accessing deprecated properties from the class.
1 parent ab3812d commit 7d4fa75
Copy full SHA for 7d4fa75

File tree

Expand file treeCollapse file tree

1 file changed

+30
-0
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+30
-0
lines changed

‎lib/matplotlib/cbook/deprecation.py

Copy file name to clipboardExpand all lines: lib/matplotlib/cbook/deprecation.py
+30Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,36 @@ def finalize(wrapper, new_doc):
190190
obj.__doc__ = new_doc
191191
obj.__init__ = wrapper
192192
return obj
193+
194+
elif isinstance(obj, property):
195+
obj_type = "attribute"
196+
func = None
197+
name = name or obj.fget.__name__
198+
old_doc = obj.__doc__
199+
200+
class _deprecated_property(property):
201+
def __get__(self, instance, owner):
202+
if instance is not None:
203+
from . import _warn_external
204+
_warn_external(message, category)
205+
return super().__get__(instance, owner)
206+
207+
def __set__(self, instance, value):
208+
if instance is not None:
209+
from . import _warn_external
210+
_warn_external(message, category)
211+
return super().__set__(instance, value)
212+
213+
def __delete__(self, instance):
214+
if instance is not None:
215+
from . import _warn_external
216+
_warn_external(message, category)
217+
return super().__delete__(instance)
218+
219+
def finalize(_, new_doc):
220+
return _deprecated_property(
221+
fget=obj.fget, fset=obj.fset, fdel=obj.fdel, doc=new_doc)
222+
193223
else:
194224
obj_type = "function"
195225
if isinstance(obj, classmethod):

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.