parameters: (method)
return_statement: return new_method
docstring: Wrapper method to check the parameters of random apply.
docstring_summary: Wrapper method to check the parameters of random apply.
docstring_tokens: Wrapper method to check the parameters of random apply .
function: def check_random_apply(method):
      """Wrapper method to check the parameters of random apply."""
  
      @wraps(method)
      def new_method(self, *args, **kwargs):
          [transforms, prob], _ = parse_user_args(method, *args, **kwargs)
          type_check(transforms, (list,), "transforms")
  
          for i, transform in enumerate(transforms):
              if str(transform).find("c_transform") >= 0:
                  raise ValueError(
                      "transforms[{}] is not a py transforms. Should not use a c transform in py transform" \
                          .format(i))
  
          if prob is not None:
              type_check(prob, (float, int,), "prob")
              check_value(prob, [0., 1.], "prob")
  
          return method(self, *args, **kwargs)
  
      return new_method
function_tokens: def check_random_apply ( method ) : @ wraps ( method ) def new_method ( self , * args , * * kwargs ) : [ transforms , prob ] , _ = parse_user_args ( method , * args , * * kwargs ) type_check ( transforms , ( list , ) , "transforms" ) for i , transform in enumerate ( transforms ) : if str ( transform ) . find ( "c_transform" ) >= 0 : raise ValueError ( "transforms[{}] is not a py transforms. Should not use a c transform in py transform" . format ( i ) ) if prob is not None : type_check ( prob , ( float , int , ) , "prob" ) check_value ( prob , [ 0. , 1. ] , "prob" ) return method ( self , * args , * * kwargs ) return new_method