Movatterモバイル変換


[0]ホーム

URL:


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

Sign up
Appearance settings

Commit8258353

Browse files
committed
Simplify the metaclass
No reason to look up __deepcopy__ in base classes.
1 parent990ffdf commit8258353

File tree

1 file changed

+1
-6
lines changed

1 file changed

+1
-6
lines changed

‎lib/matplotlib/path.py

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,19 +25,14 @@
2525
class_HideDeepcopyMeta(type):
2626
"""Metaclass that allows conditionally hiding the __deepcopy__ method.
2727
28-
Set __hide_deepcopy__ to True to hide the __deepcopy__ method,
29-
which will then be looked up in the usual method resolution order.
28+
Set __hide_deepcopy__ to True to hide the __deepcopy__ method.
3029
"""
3130

3231
def__new__(cls,name,bases,namespace):
3332
orig_ga=namespace.get("__getattribute__")orobject.__getattribute__
3433

3534
def__getattribute__(self,attr_name):
3635
ifattr_name=="__deepcopy__"andorig_ga(self,"__hide_deepcopy__"):
37-
forbaseintype(self).__mro__[1:]:
38-
ifattr_nameinbase.__dict__:
39-
method=base.__dict__[attr_name]
40-
returnmethod.__get__(self,type(self))
4136
raiseAttributeError(
4237
f"'{type(self).__name__}' object has no attribute '{attr_name}'"
4338
)

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp