File tree Expand file tree Collapse file tree 2 files changed +8
-2
lines changed
tensorflow_datasets/core/download Expand file tree Collapse file tree 2 files changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -318,8 +318,10 @@ def downloaded_size(self) -> int:
318
318
def _get_dl_path (
319
319
self , resource : resource_lib .Resource , checksum : str | None = None
320
320
) -> epath .Path :
321
- return self ._download_dir / resource_lib .get_dl_fname (
322
- resource .url , checksum
321
+ return (
322
+ self ._download_dir
323
+ / resource .relative_download_dir
324
+ / resource_lib .get_dl_fname (resource .url , checksum )
323
325
)
324
326
325
327
@property
Original file line number Diff line number Diff line change @@ -285,6 +285,7 @@ def __init__(
285
285
url : str | None = None ,
286
286
extract_method : ExtractMethod | None = None ,
287
287
path : epath .PathLike | None = None ,
288
+ relative_download_dir : epath .PathLike = '' ,
288
289
):
289
290
"""Resource constructor.
290
291
@@ -294,10 +295,13 @@ def __init__(
294
295
set, will be guessed from downloaded file name `original_fname`.
295
296
path: Path of resource on local disk. Can be None if resource has not be
296
297
downloaded yet. In such case, `url` must be set.
298
+ relative_download_dir: Optional directory for downloading relative to
299
+ `download_dir`.
297
300
"""
298
301
self .url = url
299
302
self ._extract_method = extract_method
300
303
self .path : epath .Path = epath .Path (path ) if path else None # pytype: disable=annotation-type-mismatch # attribute-variable-annotations
304
+ self .relative_download_dir = relative_download_dir
301
305
302
306
@classmethod
303
307
def exists_locally (cls , path : epath .Path ) -> bool :
You can’t perform that action at this time.
0 commit comments