@@ -406,20 +406,19 @@ def _parse_args(*args, caller_name='function'):
406
406
"""
407
407
X = Y = C = None
408
408
409
- len_args = len (args )
410
- if len_args == 2 :
409
+ nargs = len (args )
410
+ if nargs == 2 :
411
411
# The use of atleast_1d allows for handling scalar arguments while also
412
412
# keeping masked arrays
413
413
U , V = np .atleast_1d (* args )
414
- elif len_args == 3 :
414
+ elif nargs == 3 :
415
415
U , V , C = np .atleast_1d (* args )
416
- elif len_args == 4 :
416
+ elif nargs == 4 :
417
417
X , Y , U , V = np .atleast_1d (* args )
418
- elif len_args == 5 :
418
+ elif nargs == 5 :
419
419
X , Y , U , V , C = np .atleast_1d (* args )
420
420
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 )
423
422
424
423
nr , nc = (1 , U .shape [0 ]) if U .ndim == 1 else U .shape
425
424
@@ -476,7 +475,7 @@ def __init__(self, ax, *args,
476
475
%s
477
476
"""
478
477
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' )
480
479
self .X = X
481
480
self .Y = Y
482
481
self .XY = np .column_stack ((X , Y ))
@@ -928,7 +927,7 @@ def __init__(self, ax, *args,
928
927
kwargs ['linewidth' ] = 1
929
928
930
929
# 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' )
932
931
self .x = x
933
932
self .y = y
934
933
xy = np .column_stack ((x , y ))
0 commit comments