Skip to content

Commit 5a03271

Browse files
authored
DirFS: Fix pipe(dict[str, bytes]) (#1628)
1 parent 816a5ab commit 5a03271

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

fsspec/implementations/dirfs.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,8 @@ def _join(self, path):
5656
if not path:
5757
return self.path
5858
return self.fs.sep.join((self.path, self._strip_protocol(path)))
59+
if isinstance(path, dict):
60+
return {self._join(_path): value for _path, value in path.items()}
5961
return [self._join(_path) for _path in path]
6062

6163
def _relpath(self, path):

fsspec/implementations/tests/test_dirfs.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,11 @@ def test_pipe(dirfs):
162162
dirfs.fs.pipe.assert_called_once_with(f"{PATH}/file", *ARGS, **KWARGS)
163163

164164

165+
def test_pipe_dict(dirfs):
166+
dirfs.pipe({"file": b"foo"}, *ARGS, **KWARGS)
167+
dirfs.fs.pipe.assert_called_once_with({f"{PATH}/file": b"foo"}, *ARGS, **KWARGS)
168+
169+
165170
@pytest.mark.asyncio
166171
async def test_async_pipe_file(adirfs):
167172
await adirfs._pipe_file("file", *ARGS, **KWARGS)

0 commit comments

Comments
 (0)