File tree Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Original file line number Diff line number Diff line change 30
30
31
31
from absl import logging
32
32
from etils import epath
33
+ import importlib_resources
33
34
from tensorflow_datasets .core import constants
34
35
from tensorflow_datasets .core import dataset_info
35
36
from tensorflow_datasets .core import dataset_metadata
@@ -310,8 +311,14 @@ def code_path(cls) -> Optional[epath.Path]:
310
311
# For dynamically added modules, `importlib.resources` returns
311
312
# `pathlib.Path('.')` rather than the real path, so filter those by
312
313
# checking for `parts`.
313
- # Check for `zipfile.Path` (`ResourcePath`) as it does not have `.parts`
314
- if isinstance (path , epath .resource_utils .ResourcePath ) or path .parts :
314
+ # Check for `zipfile.Path` (`ResourcePath`) or
315
+ # `importlib_resources.abc.Traversable` (e.g. `MultiplexedPath`) as they
316
+ # do not have `.parts`.
317
+ if (
318
+ isinstance (path , epath .resource_utils .ResourcePath )
319
+ or isinstance (path , importlib_resources .abc .Traversable )
320
+ or path .parts
321
+ ):
315
322
modules [- 1 ] += ".py"
316
323
return path .joinpath (* modules [1 :])
317
324
# Otherwise, fallback to `pathlib.Path`. For non-zipapp, it should be
You can’t perform that action at this time.
0 commit comments