3333
3434
3535class 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+ ):
3743 self .fname = fname
3844 self .method = method
3945 self .defaults = defaults
4046 self .max_fname_arg_count = max_fname_arg_count
4147
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 :
4356 if args or kwargs :
4457 fname = self .fname if fname is None else fname
4558 max_fname_arg_count = (
@@ -300,7 +313,7 @@ def validate_take_with_convert(convert, args, kwargs):
300313)
301314
302315
303- def validate_window_func (name , args , kwargs ):
316+ def validate_window_func (name , args , kwargs ) -> None :
304317 numpy_args = ("axis" , "dtype" , "out" )
305318 msg = (
306319 f"numpy operations are not valid with window objects. "
@@ -315,7 +328,7 @@ def validate_window_func(name, args, kwargs):
315328 raise UnsupportedFunctionCall (msg )
316329
317330
318- def validate_rolling_func (name , args , kwargs ):
331+ def validate_rolling_func (name , args , kwargs ) -> None :
319332 numpy_args = ("axis" , "dtype" , "out" )
320333 msg = (
321334 f"numpy operations are not valid with window objects. "
@@ -330,7 +343,7 @@ def validate_rolling_func(name, args, kwargs):
330343 raise UnsupportedFunctionCall (msg )
331344
332345
333- def validate_expanding_func (name , args , kwargs ):
346+ def validate_expanding_func (name , args , kwargs ) -> None :
334347 numpy_args = ("axis" , "dtype" , "out" )
335348 msg = (
336349 f"numpy operations are not valid with window objects. "
@@ -345,7 +358,7 @@ def validate_expanding_func(name, args, kwargs):
345358 raise UnsupportedFunctionCall (msg )
346359
347360
348- def validate_groupby_func (name , args , kwargs , allowed = None ):
361+ def validate_groupby_func (name , args , kwargs , allowed = None ) -> None :
349362 """
350363 'args' and 'kwargs' should be empty, except for allowed
351364 kwargs because all of
@@ -359,16 +372,15 @@ def validate_groupby_func(name, args, kwargs, allowed=None):
359372
360373 if len (args ) + len (kwargs ) > 0 :
361374 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"
365377 )
366378
367379
368380RESAMPLER_NUMPY_OPS = ("min" , "max" , "sum" , "prod" , "mean" , "std" , "var" )
369381
370382
371- def validate_resampler_func (method , args , kwargs ):
383+ def validate_resampler_func (method : str , args , kwargs ) -> None :
372384 """
373385 'args' and 'kwargs' should be empty because all of
374386 their necessary parameters are explicitly listed in
@@ -385,7 +397,7 @@ def validate_resampler_func(method, args, kwargs):
385397 raise TypeError ("too many arguments passed in" )
386398
387399
388- def validate_minmax_axis (axis ) :
400+ def validate_minmax_axis (axis : Optional [ int ]) -> None :
389401 """
390402 Ensure that the axis argument passed to min, max, argmin, or argmax is
391403 zero or None, as otherwise it will be incorrectly ignored.
0 commit comments