parameters: (method)
return_statement: return new_method
docstring: A wrapper that wraps a parameter checker around the original Dataset(AGNewsDataset).
docstring_summary: A wrapper that wraps a parameter checker around the original Dataset(AGNewsDataset).
docstring_tokens: A wrapper that wraps a parameter checker around the original Dataset ( AGNewsDataset ) .
function: def check_ag_news_dataset(method):
      """A wrapper that wraps a parameter checker around the original Dataset(AGNewsDataset)."""
  
      @wraps(method)
      def new_method(self, *args, **kwargs):
          _, param_dict = parse_user_args(method, *args, **kwargs)
  
          nreq_param_int = ['num_samples', 'num_parallel_workers', 'num_shards', 'shard_id']
  
          # check dataset_files; required argument
          dataset_dir = param_dict.get('dataset_dir')
          check_dir(dataset_dir)
  
          # check usage
          usage = param_dict.get('usage')
          if usage is not None:
              check_valid_str(usage, ["train", "test", "all"], "usage")
  
          validate_dataset_param_value(nreq_param_int, param_dict, int)
          check_sampler_shuffle_shard_options(param_dict)
  
          cache = param_dict.get('cache')
          check_cache_option(cache)
  
          return method(self, *args, **kwargs)
  
      return new_method
function_tokens: def check_ag_news_dataset ( method ) : @ wraps ( method ) def new_method ( self , * args , * * kwargs ) : _ , param_dict = parse_user_args ( method , * args , * * kwargs ) nreq_param_int = [ 'num_samples' , 'num_parallel_workers' , 'num_shards' , 'shard_id' ] # check dataset_files; required argument dataset_dir = param_dict . get ( 'dataset_dir' ) check_dir ( dataset_dir ) # check usage usage = param_dict . get ( 'usage' ) if usage is not None : check_valid_str ( usage , [ "train" , "test" , "all" ] , "usage" ) validate_dataset_param_value ( nreq_param_int , param_dict , int ) check_sampler_shuffle_shard_options ( param_dict ) cache = param_dict . get ( 'cache' ) check_cache_option ( cache ) return method ( self , * args , * * kwargs ) return new_method