33
33
34
34
35
35
class CompatValidator :
36
- def __init__ (self , defaults , fname = None , method = None , max_fname_arg_count = None ):
36
+ def __init__ (
37
+ self ,
38
+ defaults ,
39
+ fname = None ,
40
+ method : Optional [str ] = None ,
41
+ max_fname_arg_count = None ,
42
+ ):
37
43
self .fname = fname
38
44
self .method = method
39
45
self .defaults = defaults
40
46
self .max_fname_arg_count = max_fname_arg_count
41
47
42
- def __call__ (self , args , kwargs , fname = None , max_fname_arg_count = None , method = None ):
48
+ def __call__ (
49
+ self ,
50
+ args ,
51
+ kwargs ,
52
+ fname = None ,
53
+ max_fname_arg_count = None ,
54
+ method : Optional [str ] = None ,
55
+ ) -> None :
43
56
if args or kwargs :
44
57
fname = self .fname if fname is None else fname
45
58
max_fname_arg_count = (
@@ -300,7 +313,7 @@ def validate_take_with_convert(convert, args, kwargs):
300
313
)
301
314
302
315
303
- def validate_window_func (name , args , kwargs ):
316
+ def validate_window_func (name , args , kwargs ) -> None :
304
317
numpy_args = ("axis" , "dtype" , "out" )
305
318
msg = (
306
319
f"numpy operations are not valid with window objects. "
@@ -315,7 +328,7 @@ def validate_window_func(name, args, kwargs):
315
328
raise UnsupportedFunctionCall (msg )
316
329
317
330
318
- def validate_rolling_func (name , args , kwargs ):
331
+ def validate_rolling_func (name , args , kwargs ) -> None :
319
332
numpy_args = ("axis" , "dtype" , "out" )
320
333
msg = (
321
334
f"numpy operations are not valid with window objects. "
@@ -330,7 +343,7 @@ def validate_rolling_func(name, args, kwargs):
330
343
raise UnsupportedFunctionCall (msg )
331
344
332
345
333
- def validate_expanding_func (name , args , kwargs ):
346
+ def validate_expanding_func (name , args , kwargs ) -> None :
334
347
numpy_args = ("axis" , "dtype" , "out" )
335
348
msg = (
336
349
f"numpy operations are not valid with window objects. "
@@ -345,7 +358,7 @@ def validate_expanding_func(name, args, kwargs):
345
358
raise UnsupportedFunctionCall (msg )
346
359
347
360
348
- def validate_groupby_func (name , args , kwargs , allowed = None ):
361
+ def validate_groupby_func (name , args , kwargs , allowed = None ) -> None :
349
362
"""
350
363
'args' and 'kwargs' should be empty, except for allowed
351
364
kwargs because all of
@@ -359,16 +372,15 @@ def validate_groupby_func(name, args, kwargs, allowed=None):
359
372
360
373
if len (args ) + len (kwargs ) > 0 :
361
374
raise UnsupportedFunctionCall (
362
- f"numpy operations are not valid with "
363
- f"groupby. Use .groupby(...).{ name } () "
364
- f"instead"
375
+ "numpy operations are not valid with groupby. "
376
+ f"Use .groupby(...).{ name } () instead"
365
377
)
366
378
367
379
368
380
RESAMPLER_NUMPY_OPS = ("min" , "max" , "sum" , "prod" , "mean" , "std" , "var" )
369
381
370
382
371
- def validate_resampler_func (method , args , kwargs ):
383
+ def validate_resampler_func (method : str , args , kwargs ) -> None :
372
384
"""
373
385
'args' and 'kwargs' should be empty because all of
374
386
their necessary parameters are explicitly listed in
@@ -385,7 +397,7 @@ def validate_resampler_func(method, args, kwargs):
385
397
raise TypeError ("too many arguments passed in" )
386
398
387
399
388
- def validate_minmax_axis (axis ) :
400
+ def validate_minmax_axis (axis : Optional [ int ]) -> None :
389
401
"""
390
402
Ensure that the axis argument passed to min, max, argmin, or argmax is
391
403
zero or None, as otherwise it will be incorrectly ignored.
0 commit comments