MCPcopy Create free account
hub / github.com/tensorflow/datasets / _to_abs

Method _to_abs

tensorflow_datasets/testing/test_utils.py:179–191  ·  view source on GitHub ↗

Normalize the output to strip the `tmp_path`.

(self, p, *, state: _PathState)

Source from the content-addressed store, hash-verified

177 return out_p
178
179 def _to_abs(self, p, *, state: _PathState):
180 """Normalize the output to strip the `tmp_path`."""
181 assert self._tmp_dir, 'Temp directory uninitialized.'
182 tmp_path = os.fspath(self._tmp_dir)
183 assert p.startswith(tmp_path)
184 p = p[len(tmp_path) :] # Strip the tmp path
185 if state.is_gcs:
186 assert p.startswith('/big' + 'store/')
187 p = p.replace('/big' + 'store/', 'gs://', 1)
188 elif not state.is_abs:
189 assert p.startswith('/')
190 p = p[len('/') :]
191 return p
192
193 def _validate_out(self, out):
194 """Sanity check to avoid leaking accidentally the `self.tmp_dir`."""

Callers 2

_mock_globMethod · 0.95
_mock_walkMethod · 0.95

Calls 1

replaceMethod · 0.45

Tested by

no test coverage detected