@@ -406,20 +406,19 @@ def _parse_args(*args, caller_name='function'):
406406 """
407407 X = Y = C = None
408408
409- len_args = len (args )
410- if len_args == 2 :
409+ nargs = len (args )
410+ if nargs == 2 :
411411 # The use of atleast_1d allows for handling scalar arguments while also
412412 # keeping masked arrays
413413 U , V = np .atleast_1d (* args )
414- elif len_args == 3 :
414+ elif nargs == 3 :
415415 U , V , C = np .atleast_1d (* args )
416- elif len_args == 4 :
416+ elif nargs == 4 :
417417 X , Y , U , V = np .atleast_1d (* args )
418- elif len_args == 5 :
418+ elif nargs == 5 :
419419 X , Y , U , V , C = np .atleast_1d (* args )
420420 else :
421- raise TypeError (f'{ caller_name } takes 2-5 positional arguments but '
422- f'{ len_args } were given' )
421+ raise _api .nargs_error (caller_name , takes = "from 2 to 5" , given = nargs )
423422
424423 nr , nc = (1 , U .shape [0 ]) if U .ndim == 1 else U .shape
425424
@@ -476,7 +475,7 @@ def __init__(self, ax, *args,
476475 %s
477476 """
478477 self ._axes = ax # The attr actually set by the Artist.axes property.
479- X , Y , U , V , C = _parse_args (* args , caller_name = 'quiver() ' )
478+ X , Y , U , V , C = _parse_args (* args , caller_name = 'quiver' )
480479 self .X = X
481480 self .Y = Y
482481 self .XY = np .column_stack ((X , Y ))
@@ -928,7 +927,7 @@ def __init__(self, ax, *args,
928927 kwargs ['linewidth' ] = 1
929928
930929 # Parse out the data arrays from the various configurations supported
931- x , y , u , v , c = _parse_args (* args , caller_name = 'barbs() ' )
930+ x , y , u , v , c = _parse_args (* args , caller_name = 'barbs' )
932931 self .x = x
933932 self .y = y
934933 xy = np .column_stack ((x , y ))
0 commit comments