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

Commit2941847

Browse files
committed
Error out in case of alias inheritance.
1 parent52c6c77 commit2941847

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

‎lib/matplotlib/cbook/__init__.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2783,12 +2783,13 @@ class so far, an alias named ``get_alias`` will be defined; the same will
27832783
exception will be raised.
27842784
27852785
The alias map is stored as the ``_alias_map`` attribute on the class and
2786-
can be used by `~.normalize_kwargs`.
2786+
can be used by `~.normalize_kwargs` (which assumes that higher priority
2787+
aliases come last).
27872788
"""
27882789
ifclsisNone:
27892790
returnfunctools.partial(_define_aliases,alias_d)
27902791

2791-
defmake_alias(name):#Enfore a closure over *name*.
2792+
defmake_alias(name):#Enforce a closure over *name*.
27922793
defmethod(self,*args,**kwargs):
27932794
returngetattr(self,name)(*args,**kwargs)
27942795
returnmethod
@@ -2804,7 +2805,11 @@ def method(self, *args, **kwargs):
28042805
method.__doc__="alias for `{}`".format(prefix+prop)
28052806
setattr(cls,prefix+alias,method)
28062807
ifnotexists:
2807-
raiseValueError("property {} does not exist".format(prop))
2808+
raiseValueError(
2809+
"Neither getter nor setter exists for {!r}".format(prop))
28082810

2811+
ifhasattr(cls,"_alias_map"):
2812+
# Need to decide on conflict resolution policy.
2813+
raiseNotImplementedError("Parent class already defines aliases")
28092814
cls._alias_map=alias_d
28102815
returncls

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp