Skip to content

Commit df0343a

Browse files
committed
Use unstrip_protocol to merge protocol and path
1 parent e7f3ac4 commit df0343a

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/datasets/arrow_writer.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -313,9 +313,10 @@ def __init__(
313313
if stream is None:
314314
fs_token_paths = fsspec.get_fs_token_paths(path, storage_options=storage_options)
315315
self._fs: fsspec.AbstractFileSystem = fs_token_paths[0]
316-
protocol = self._fs.protocol if isinstance(self._fs.protocol, str) else self._fs.protocol[-1]
317316
self._path = (
318-
fs_token_paths[2][0] if not is_remote_filesystem(self._fs) else protocol + "://" + fs_token_paths[2][0]
317+
fs_token_paths[2][0]
318+
if not is_remote_filesystem(self._fs)
319+
else self._fs.unstrip_protocol(fs_token_paths[2][0])
319320
)
320321
self.stream = self._fs.open(fs_token_paths[2][0], "wb")
321322
self._closable_stream = True

src/datasets/builder.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -329,8 +329,7 @@ def __init__(
329329
is_local = not is_remote_filesystem(self._fs)
330330
path_join = os.path.join if is_local else posixpath.join
331331

332-
protocol = self._fs.protocol if isinstance(self._fs.protocol, str) else self._fs.protocol[-1]
333-
self._cache_dir_root = fs_token_paths[2][0] if is_local else protocol + "://" + fs_token_paths[2][0]
332+
self._cache_dir_root = fs_token_paths[2][0] if is_local else self._fs.unstrip_protocol(fs_token_paths[2][0])
334333
self._cache_dir = self._build_cache_dir()
335334
self._cache_downloaded_dir = (
336335
path_join(self._cache_dir_root, config.DOWNLOADED_DATASETS_DIR)

0 commit comments

Comments
 (0)