Normalize the output to strip the `tmp_path`.
(self, p, *, state: _PathState)
| 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`.""" |
no test coverage detected