parameters: (method)
return_statement: return new_method
docstring: check the input arguments of split.
docstring_summary: check the input arguments of split.
docstring_tokens: check the input arguments of split .
function: def check_split(method):
      """check the input arguments of split."""
  
      @wraps(method)
      def new_method(self, *args, **kwargs):
          [sizes, randomize], _ = parse_user_args(method, *args, **kwargs)
  
          type_check(sizes, (list,), "sizes")
          type_check(randomize, (bool,), "randomize")
  
          # check sizes: must be list of float or list of int
          if not sizes:
              raise ValueError("sizes cannot be empty.")
  
          all_int = all(isinstance(item, int) for item in sizes)
          all_float = all(isinstance(item, float) for item in sizes)
  
          if not (all_int or all_float):
              raise ValueError("sizes should be list of int or list of float.")
  
          if all_int:
              all_positive = all(item > 0 for item in sizes)
              if not all_positive:
                  raise ValueError("sizes is a list of int, but there should be no negative or zero numbers.")
  
          if all_float:
              all_valid_percentages = all(0 < item <= 1 for item in sizes)
              if not all_valid_percentages:
                  raise ValueError("sizes is a list of float, but there should be no numbers outside the range (0, 1].")
  
              epsilon = 0.00001
              if not abs(sum(sizes) - 1) < epsilon:
                  raise ValueError("sizes is a list of float, but the percentages do not sum up to 1.")
  
          return method(self, *args, **kwargs)
  
      return new_method
function_tokens: def check_split ( method ) : @ wraps ( method ) def new_method ( self , * args , * * kwargs ) : [ sizes , randomize ] , _ = parse_user_args ( method , * args , * * kwargs ) type_check ( sizes , ( list , ) , "sizes" ) type_check ( randomize , ( bool , ) , "randomize" ) # check sizes: must be list of float or list of int if not sizes : raise ValueError ( "sizes cannot be empty." ) all_int = all ( isinstance ( item , int ) for item in sizes ) all_float = all ( isinstance ( item , float ) for item in sizes ) if not ( all_int or all_float ) : raise ValueError ( "sizes should be list of int or list of float." ) if all_int : all_positive = all ( item > 0 for item in sizes ) if not all_positive : raise ValueError ( "sizes is a list of int, but there should be no negative or zero numbers." ) if all_float : all_valid_percentages = all ( 0 < item <= 1 for item in sizes ) if not all_valid_percentages : raise ValueError ( "sizes is a list of float, but there should be no numbers outside the range (0, 1]." ) epsilon = 0.00001 if not abs ( sum ( sizes ) - 1 ) < epsilon : raise ValueError ( "sizes is a list of float, but the percentages do not sum up to 1." ) return method ( self , * args , * * kwargs ) return new_method