@@ -1994,32 +1994,23 @@ def __init__(self, *args, **kwargs):
19941994 # signature deprecation since="3.5": Change to new signature after the
19951995 # deprecation has expired. Also remove setting __init__.__signature__,
19961996 # and remove the Notes from the docstring.
1997- #
1998- # We use lambdas to parse *args, **kwargs through the respective old
1999- # and new signatures.
2000- try :
2001- # Old signature:
2002- # The following raises a TypeError iif the args don't match.
2003- w , h , coords , antialiased , shading , kwargs = (
1997+ params = _api .select_matching_signature (
1998+ [
20041999 lambda meshWidth , meshHeight , coordinates , antialiased = True ,
2005- shading = 'flat' , ** kwargs :
2006- (meshWidth , meshHeight , coordinates , antialiased , shading ,
2007- kwargs ))(* args , ** kwargs )
2008- except TypeError as exc :
2009- # New signature:
2010- # If the following raises a TypeError (i.e. args don't match),
2011- # just let it propagate.
2012- coords , antialiased , shading , kwargs = (
2000+ shading = 'flat' , ** kwargs : locals (),
20132001 lambda coordinates , antialiased = True , shading = 'flat' , ** kwargs :
2014- (coordinates , antialiased , shading , kwargs ))(* args , ** kwargs )
2015- coords = np .asarray (coords , np .float64 )
2016- else : # The old signature matched.
2002+ locals ()
2003+ ],
2004+ * args , ** kwargs ).values ()
2005+ * old_w_h , coords , antialiased , shading , kwargs = params
2006+ if old_w_h : # The old signature matched.
20172007 _api .warn_deprecated (
20182008 "3.5" ,
20192009 message = "This usage of Quadmesh is deprecated: Parameters "
20202010 "meshWidth and meshHeights will be removed; "
20212011 "coordinates must be 2D; all parameters except "
20222012 "coordinates will be keyword-only." )
2013+ w , h = old_w_h
20232014 coords = np .asarray (coords , np .float64 ).reshape ((h + 1 , w + 1 , 2 ))
20242015 kwargs .setdefault ("pickradius" , 0 )
20252016 # end of signature deprecation code
0 commit comments