Skip to content

Commit

Permalink
DirFS: Fix pipe(dict[str, bytes]) (fsspec#1628)
Browse files Browse the repository at this point in the history
  • Loading branch information
lgeiger authored Jun 17, 2024
1 parent 816a5ab commit 5a03271
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
2 changes: 2 additions & 0 deletions fsspec/implementations/dirfs.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ def _join(self, path):
if not path:
return self.path
return self.fs.sep.join((self.path, self._strip_protocol(path)))
if isinstance(path, dict):
return {self._join(_path): value for _path, value in path.items()}
return [self._join(_path) for _path in path]

def _relpath(self, path):
Expand Down
5 changes: 5 additions & 0 deletions fsspec/implementations/tests/test_dirfs.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,11 @@ def test_pipe(dirfs):
dirfs.fs.pipe.assert_called_once_with(f"{PATH}/file", *ARGS, **KWARGS)


def test_pipe_dict(dirfs):
dirfs.pipe({"file": b"foo"}, *ARGS, **KWARGS)
dirfs.fs.pipe.assert_called_once_with({f"{PATH}/file": b"foo"}, *ARGS, **KWARGS)


@pytest.mark.asyncio
async def test_async_pipe_file(adirfs):
await adirfs._pipe_file("file", *ARGS, **KWARGS)
Expand Down

0 comments on commit 5a03271

Please sign in to comment.