1b16d396f7967161b665b62c25c1192dcd8af958,tensorflow_datasets/scripts/replace_fake_images.py,,rewrite_tar,#Any#Any#,89

Before Change


      extension = ":gz"
      shutil_extension = "gztar"
      extension_removal_index = 7 // Hardcode number of indices to be skipped from the end to obtain filename. This is hard-coded as filenames containing "." might exist and thus filepath.split(".") would give an incorrect result.
    elif tar_filepath.lower().endswith("bz2"):
      extension = ":bz2"
      shutil_extension = "bztar"
      extension_removal_index = 7

After Change


  // Create a tempfile to store the images contain noise
  with tempfile.TemporaryDirectory(dir=root_dir) as temp_dir:
    // Checking the extension of file to be extract
    tar_filepath_lowercase = tar_filepath.lower()
    if tar_filepath_lowercase.endswith("gz"):
      extension = ":gz"
      shutil_extension = "gztar"
      if tar_filepath_lowercase.endswith("tgz"):
          extension_removal_index = len(".tgz") // Obtain file name from filepath. Hardcoded indices are used as filenames may contain periods
      else:
          extension_removal_index = len(".tar.gz")
    elif tar_filepath_lowercase.endswith("bz2"):
      extension = ":bz2"
      shutil_extension = "bztar"
      extension_removal_index = len(".tar.bz2")
    elif tar_filepath_lowercase.endswith("xz"):
      extension = ":xz"
      shutil_extension = "xztar"
      extension_removal_index = len(".tar.xz")
    else:
      extension = ""
      shutil_extension = "tar"
      extension_removal_index = -tar_filepath.find(".tar")
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 5

Instances


Project Name: tensorflow/datasets
Commit Name: 1b16d396f7967161b665b62c25c1192dcd8af958
Time: 2020-03-19
Author: thealmightylion.madhav@gmail.com
File Name: tensorflow_datasets/scripts/replace_fake_images.py
Class Name:
Method Name: rewrite_tar


Project Name: bambinos/bambi
Commit Name: 63a9a4d52443ebae8da98db37a56edd499a278b2
Time: 2017-02-22
Author: tyarkoni@gmail.com
File Name: bambi/models.py
Class Name: Model
Method Name: __init__


Project Name: OpenMined/PySyft
Commit Name: 88c2606b36244923c214ee40be069f896bf6342a
Time: 2020-09-11
Author: theo.leffyr@gmail.com
File Name: syft/frameworks/torch/tensors/interpreters/precision.py
Class Name: FixedPrecisionTensor
Method Name: reciprocal