parameters: (method)
return_statement: return new_method
docstring: A wrapper that wraps a parameter checker around the original Dataset(VOCDataset).
docstring_summary: A wrapper that wraps a parameter checker around the original Dataset(VOCDataset).
docstring_tokens: A wrapper that wraps a parameter checker around the original Dataset ( VOCDataset ) .
function: def check_vocdataset(method):
      """A wrapper that wraps a parameter checker around the original Dataset(VOCDataset)."""
  
      @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']
          nreq_param_bool = ['shuffle', 'decode']
          nreq_param_dict = ['class_indexing']
  
          dataset_dir = param_dict.get('dataset_dir')
          check_dir(dataset_dir)
  
          task = param_dict.get('task')
          type_check(task, (str,), "task")
  
          usage = param_dict.get('usage')
          type_check(usage, (str,), "usage")
          dataset_dir = os.path.realpath(dataset_dir)
  
          if task == "Segmentation":
              imagesets_file = os.path.join(dataset_dir, "ImageSets", "Segmentation", usage + ".txt")
              if param_dict.get('class_indexing') is not None:
                  raise ValueError("class_indexing is not supported in Segmentation task.")
          elif task == "Detection":
              imagesets_file = os.path.join(dataset_dir, "ImageSets", "Main", usage + ".txt")
          else:
              raise ValueError("Invalid task : " + task + ".")
  
          check_file(imagesets_file)
  
          validate_dataset_param_value(nreq_param_int, param_dict, int)
          validate_dataset_param_value(nreq_param_bool, param_dict, bool)
          validate_dataset_param_value(nreq_param_dict, param_dict, dict)
          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_vocdataset ( 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' ] nreq_param_bool = [ 'shuffle' , 'decode' ] nreq_param_dict = [ 'class_indexing' ] dataset_dir = param_dict . get ( 'dataset_dir' ) check_dir ( dataset_dir ) task = param_dict . get ( 'task' ) type_check ( task , ( str , ) , "task" ) usage = param_dict . get ( 'usage' ) type_check ( usage , ( str , ) , "usage" ) dataset_dir = os . path . realpath ( dataset_dir ) if task == "Segmentation" : imagesets_file = os . path . join ( dataset_dir , "ImageSets" , "Segmentation" , usage + ".txt" ) if param_dict . get ( 'class_indexing' ) is not None : raise ValueError ( "class_indexing is not supported in Segmentation task." ) elif task == "Detection" : imagesets_file = os . path . join ( dataset_dir , "ImageSets" , "Main" , usage + ".txt" ) else : raise ValueError ( "Invalid task : " + task + "." ) check_file ( imagesets_file ) validate_dataset_param_value ( nreq_param_int , param_dict , int ) validate_dataset_param_value ( nreq_param_bool , param_dict , bool ) validate_dataset_param_value ( nreq_param_dict , param_dict , dict ) check_sampler_shuffle_shard_options ( param_dict ) cache = param_dict . get ( 'cache' ) check_cache_option ( cache ) return method ( self , * args , * * kwargs ) return new_method