Skip to content

Commit

Permalink
Pass kwargs to info and exists calls in glob
Browse files Browse the repository at this point in the history
  • Loading branch information
mariosasko committed Nov 10, 2023
1 parent 453d8c5 commit 3c80a53
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
8 changes: 4 additions & 4 deletions fsspec/asyn.py
Original file line number Diff line number Diff line change
Expand Up @@ -672,9 +672,9 @@ async def _sizes(self, paths, batch_size=None):
[self._size(p) for p in paths], batch_size=batch_size
)

async def _exists(self, path):
async def _exists(self, path, **kwargs):
try:
await self._info(path)
await self._info(path, **kwargs)
return True
except FileNotFoundError:
return False
Expand Down Expand Up @@ -760,11 +760,11 @@ async def _glob(self, path, maxdepth=None, **kwargs):
detail = kwargs.pop("detail", False)

if not has_magic(path):
if await self._exists(path):
if await self._exists(path, **kwargs):
if not detail:
return [path]
else:
return {path: await self._info(path)}
return {path: await self._info(path, **kwargs)}
else:
if not detail:
return [] # glob of non-existent returns empty
Expand Down
4 changes: 2 additions & 2 deletions fsspec/implementations/http.py
Original file line number Diff line number Diff line change
Expand Up @@ -458,11 +458,11 @@ async def _glob(self, path, maxdepth=None, **kwargs):
detail = kwargs.pop("detail", False)

if not has_magic(path):
if await self._exists(path):
if await self._exists(path, **kwargs):
if not detail:
return [path]
else:
return {path: await self._info(path)}
return {path: await self._info(path, **kwargs)}
else:
if not detail:
return [] # glob of non-existent returns empty
Expand Down
4 changes: 2 additions & 2 deletions fsspec/spec.py
Original file line number Diff line number Diff line change
Expand Up @@ -574,11 +574,11 @@ def glob(self, path, maxdepth=None, **kwargs):
detail = kwargs.pop("detail", False)

if not has_magic(path):
if self.exists(path):
if self.exists(path, **kwargs):
if not detail:
return [path]
else:
return {path: self.info(path)}
return {path: self.info(path, **kwargs)}
else:
if not detail:
return [] # glob of non-existent returns empty
Expand Down

0 comments on commit 3c80a53

Please sign in to comment.