MCPcopy Index your code
hub / github.com/tensorflow/datasets / _get_folder_str

Function _get_folder_str

tensorflow_datasets/testing/test_utils.py:260–275  ·  view source on GitHub ↗

Get the tree structure.

(root_dir: pathlib.Path | None)

Source from the content-addressed store, hash-verified

258
259
260def _get_folder_str(root_dir: pathlib.Path | None) -> str:
261 """Get the tree structure."""
262 if not root_dir:
263 raise ValueError('Root dir undefined. Cannot find folder.')
264
265 lines = epy.Lines()
266 for p in root_dir.iterdir():
267 if p.is_dir():
268 lines += f'{p.name}/'
269 with lines.indent():
270 subfolder_str = _get_folder_str(p)
271 if subfolder_str:
272 lines += subfolder_str
273 else:
274 lines += p.name
275 return lines.join()
276
277
278@contextlib.contextmanager

Callers 1

print_treeMethod · 0.85

Calls 3

iterdirMethod · 0.80
is_dirMethod · 0.80
joinMethod · 0.80

Tested by

no test coverage detected