1f65deb60665a460edf5e9238a70a2c597b3a12c,tensorflow_datasets/core/load.py,,find_builder_dir,#,332

Before Change


  if not version_str:  // Version not given or found
    return None

  builder_dir = os.path.join(builder_dir, version_str)

  // Check for builder dir existance
  if not tf.io.gfile.exists(builder_dir):
    return None
  // Backward compatibility, in order to be a valid ReadOnlyBuilder, the folder
  // has to contain the feature configuration.
  if not tf.io.gfile.exists(feature_lib.make_config_path(builder_dir)):
    return None
  return builder_dir

After Change


      all_builder_dirs.append(builder_dir)
  if not all_builder_dirs:
    return None
  elif len(all_builder_dirs) != 1:
    // Rather than raising error every time, we could potentially be smarter
    // and load the most recent version across all files, but should be
    // carefull when partial version is requested ("my_dataset:3.*.*").
    // Could add some `MultiDataDirManager` API:
    // ```
    // manager = MultiDataDirManager(given_data_dir=data_dir)
    // with manager.merge_data_dirs() as virtual_data_dir:
    //  virtual_builder_dir = _find_builder_dir(name, data_dir=virtual_data_dir)
    //  builder_dir = manager.resolve(virtual_builder_dir)
    // ```
    raise ValueError(
        f"Dataset {name} detected in multiple locations: {all_builder_dirs}. "
        "Please resolve the ambiguity by explicitly setting `data_dir=`."
    )
  else:
    return next(iter(all_builder_dirs))  // List has a single element

Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 9

Instances


Project Name: tensorflow/datasets
Commit Name: 1f65deb60665a460edf5e9238a70a2c597b3a12c
Time: 2020-09-24
Author: epot@google.com
File Name: tensorflow_datasets/core/load.py
Class Name:
Method Name: find_builder_dir


Project Name: danforthcenter/plantcv
Commit Name: 6a9c9bdc8a438460d9d8500e323eea510883d6c6
Time: 2019-10-21
Author: dschneiderch@users.noreply.github.com
File Name: plantcv/utils/sample_images.py
Class Name:
Method Name: sample_images


Project Name: mlflow/mlflow
Commit Name: c7633f228b5527603503fba71f9618898d8c9261
Time: 2018-07-24
Author: smurching@gmail.com
File Name: mlflow/utils/rest_utils.py
Class Name:
Method Name: get_databricks_hostname_and_auth