Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions fsspec/implementations/dirfs.py
Original file line number Diff line number Diff line change
Expand Up @@ -231,10 +231,16 @@ def exists(self, path):
return self.fs.exists(self._join(path))

async def _info(self, path, **kwargs):
return await self.fs._info(self._join(path), **kwargs)
info = await self.fs._info(self._join(path), **kwargs)
info = info.copy()
info["name"] = self._relpath(info["name"])
return info

def info(self, path, **kwargs):
return self.fs.info(self._join(path), **kwargs)
info = self.fs.info(self._join(path), **kwargs)
info = info.copy()
info["name"] = self._relpath(info["name"])
return info

async def _ls(self, path, detail=True, **kwargs):
ret = (await self.fs._ls(self._join(path), detail=detail, **kwargs)).copy()
Expand Down
6 changes: 4 additions & 2 deletions fsspec/implementations/tests/test_dirfs.py
Original file line number Diff line number Diff line change
Expand Up @@ -327,12 +327,14 @@ def test_exists(dirfs):

@pytest.mark.asyncio
async def test_async_info(adirfs):
assert await adirfs._info("file", **KWARGS) == adirfs.fs._info.return_value
adirfs.fs._info.return_value = {"name": f"{PATH}/file", "foo": "bar"}
assert await adirfs._info("file", **KWARGS) == {"name": "file", "foo": "bar"}
adirfs.fs._info.assert_called_once_with(f"{PATH}/file", **KWARGS)


def test_info(dirfs):
assert dirfs.info("file", **KWARGS) == dirfs.fs.info.return_value
dirfs.fs.info.return_value = {"name": f"{PATH}/file", "foo": "bar"}
assert dirfs.info("file", **KWARGS) == {"name": "file", "foo": "bar"}
dirfs.fs.info.assert_called_once_with(f"{PATH}/file", **KWARGS)


Expand Down
Loading