6ea7bb25fe15a53b69245d2785b3efd064963ebc,tensorflow_hub/resolver.py,,_merge_relative_path,#,187

Before Change


  // which are valid directories in fileystems like "gs://".
  norm_rel_path = os.path.normpath(rel_path.lstrip("/"))

  if norm_rel_path == ".":
    return dst_path

  // Check that the norm rel path does not starts with "..".
  if norm_rel_path.startswith(".."):
    raise ValueError("Relative path %r is invalid." % rel_path)

  merged = os.path.join(dst_path, norm_rel_path)

  // After merging verify that the merged path keeps the original dst_path.
  if not merged.startswith(dst_path):
    raise ValueError("Relative path %r is invalid. Failed to merge with %r." % (
        rel_path, dst_path))
  return merged


def _module_descriptor_file(module_dir):
  Returns the name of the file containing descriptor for the "module_dir".

After Change



def _merge_relative_path(dst_path, rel_path):
  Merge a relative tar file to a destination (which can be "gs://...").
  return file_utils.merge_relative_path(dst_path, rel_path)


def _module_descriptor_file(module_dir):
  Returns the name of the file containing descriptor for the "module_dir".
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 4

Non-data size: 7

Instances


Project Name: tensorflow/hub
Commit Name: 6ea7bb25fe15a53b69245d2785b3efd064963ebc
Time: 2020-09-24
Author: no-reply@google.com
File Name: tensorflow_hub/resolver.py
Class Name:
Method Name: _merge_relative_path


Project Name: daavoo/pyntcloud
Commit Name: a2f318363a1c4dde386d7f7ac316baa706678b89
Time: 2017-03-09
Author: daviddelaiglesiacastro@gmail.com
File Name: pyntcloud/pyntcloud.py
Class Name: PyntCloud
Method Name: get_sample


Project Name: arraiy/torchgeometry
Commit Name: 6a4fa82792bddc6126eaf944956f49f0a0cb7ca7
Time: 2020-12-22
Author: edgar.riba@gmail.com
File Name: kornia/filters/sobel.py
Class Name: Sobel
Method Name: forward


Project Name: erichson/ristretto
Commit Name: 89b703017ad90e56ce6382bb4686cab3430c46bc
Time: 2018-05-22
Author: jknox13@uw.edu
File Name: ristretto/sketch/transforms.py
Class Name:
Method Name: randomized_uniform_sampling