Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions tensorflow_datasets/core/dataset_builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,10 @@ def _get_builder_datadir_path(builder_cls: Type[Any]) -> epath.Path:
"""
pkg_names = builder_cls.__module__.split(".")
# -1 to remove the xxx.py python file.
return epath.resource_path(pkg_names[0]).joinpath(*pkg_names[1:-1])
path = epath.resource_path(pkg_names[0])
for pkg_name in pkg_names[1:-1]:
path = path.joinpath(pkg_name)
return path


class DatasetBuilder(registered.RegisteredDataset):
Expand Down Expand Up @@ -343,7 +346,9 @@ def code_path(cls) -> epath.Path | None:
or path.parts
):
modules[-1] += ".py"
return path.joinpath(*modules[1:])
for module in modules[1:]:
path = path.joinpath(module)
return path
# Otherwise, fallback to `pathlib.Path`. For non-zipapp, it should be
# equivalent to the above return.
try:
Expand Down
5 changes: 4 additions & 1 deletion tensorflow_datasets/core/utils/resource_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,10 @@ def tfds_path(*relative_path: epath.PathLike) -> epath.Path:
Returns:
path: The root TFDS path.
"""
return root_tfds_path().joinpath(*relative_path)
path = root_tfds_path()
for p in relative_path:
path = path.joinpath(p)
return path


def tfds_write_path(*relative_path: epath.PathLike) -> epath.Path:
Expand Down
Loading