@@ -1979,32 +1979,23 @@ def __init__(self, *args, **kwargs):
19791979 # signature deprecation since="3.5": Change to new signature after the
19801980 # deprecation has expired. Also remove setting __init__.__signature__,
19811981 # and remove the Notes from the docstring.
1982- #
1983- # We use lambdas to parse *args, **kwargs through the respective old
1984- # and new signatures.
1985- try :
1986- # Old signature:
1987- # The following raises a TypeError iif the args don't match.
1988- w , h , coords , antialiased , shading , kwargs = (
1982+ params = _api .select_matching_signature (
1983+ [
19891984 lambda meshWidth , meshHeight , coordinates , antialiased = True ,
1990- shading = 'flat' , ** kwargs :
1991- (meshWidth , meshHeight , coordinates , antialiased , shading ,
1992- kwargs ))(* args , ** kwargs )
1993- except TypeError as exc :
1994- # New signature:
1995- # If the following raises a TypeError (i.e. args don't match),
1996- # just let it propagate.
1997- coords , antialiased , shading , kwargs = (
1985+ shading = 'flat' , ** kwargs : locals (),
19981986 lambda coordinates , antialiased = True , shading = 'flat' , ** kwargs :
1999- (coordinates , antialiased , shading , kwargs ))(* args , ** kwargs )
2000- coords = np .asarray (coords , np .float64 )
2001- else : # The old signature matched.
1987+ locals ()
1988+ ],
1989+ * args , ** kwargs ).values ()
1990+ * old_w_h , coords , antialiased , shading , kwargs = params
1991+ if old_w_h : # The old signature matched.
20021992 _api .warn_deprecated (
20031993 "3.5" ,
20041994 message = "This usage of Quadmesh is deprecated: Parameters "
20051995 "meshWidth and meshHeights will be removed; "
20061996 "coordinates must be 2D; all parameters except "
20071997 "coordinates will be keyword-only." )
1998+ w , h = old_w_h
20081999 coords = np .asarray (coords , np .float64 ).reshape ((h + 1 , w + 1 , 2 ))
20092000 kwargs .setdefault ("pickradius" , 0 )
20102001 # end of signature deprecation code
0 commit comments