@@ -96,7 +96,8 @@ def __init__(
9696 f"fs ({ fs } ) was not created with `asynchronous=True`, this may lead to surprising behavior" ,
9797 stacklevel = 2 ,
9898 )
99- if "://" in path :
99+ if "://" in path and not path .startswith ("http" ):
100+ # `not path.startswith("http")` is a special case for the http filesystem (¯\_(ツ)_/¯)
100101 scheme , _ = path .split ("://" , maxsplit = 1 )
101102 raise ValueError (f"path argument to RemoteStore must not include scheme ({ scheme } ://)" )
102103
@@ -159,21 +160,22 @@ def from_url(
159160 RemoteStore
160161 """
161162 opts = storage_options or {}
162- opts = {"asynchronous" : True , ** opts }
163+ opts = {"asynchronous" : True , "use_listings_cache" : False , ** opts }
163164
164165 fs , path = fsspec .url_to_fs (url , ** opts )
165166
166167 # fsspec is not consistent about removing the scheme from the path, so check and strip it here
167168 # https://github.com/fsspec/filesystem_spec/issues/1722
168- if "://" in path :
169+ if "://" in path and not path .startswith ("http" ):
170+ # `not path.startswith("http")` is a special case for the http filesystem (¯\_(ツ)_/¯)
169171 _ , path = path .split ("://" , maxsplit = 1 )
170172
171173 return cls (fs = fs , path = path , mode = mode , allowed_exceptions = allowed_exceptions )
172174
173175 async def clear (self ) -> None :
174176 # docstring inherited
175177 try :
176- for subpath in await self .fs ._find (self .path , withdirs = True ):
178+ for subpath in await self .fs ._find (self .path , withdirs = True , refresh = True ):
177179 if subpath != self .path :
178180 await self .fs ._rm (subpath , recursive = True )
179181 except FileNotFoundError :
@@ -185,7 +187,7 @@ async def empty(self) -> bool:
185187 # TODO: it would be nice if we didn't have to list all keys here
186188 # it should be possible to stop after the first key is discovered
187189 try :
188- return not await self .fs ._ls (self .path )
190+ return not await self .fs ._ls (self .path , refresh = True )
189191 except FileNotFoundError :
190192 return True
191193
@@ -319,15 +321,15 @@ async def set_partial_values(
319321
320322 async def list (self ) -> AsyncGenerator [str , None ]:
321323 # docstring inherited
322- allfiles = await self .fs ._find (self .path , detail = False , withdirs = False )
324+ allfiles = await self .fs ._find (self .path , detail = False , withdirs = False , refresh = True )
323325 for onefile in (a .replace (self .path + "/" , "" ) for a in allfiles ):
324326 yield onefile
325327
326328 async def list_dir (self , prefix : str ) -> AsyncGenerator [str , None ]:
327329 # docstring inherited
328330 prefix = f"{ self .path } /{ prefix .rstrip ('/' )} "
329331 try :
330- allfiles = await self .fs ._ls (prefix , detail = False )
332+ allfiles = await self .fs ._ls (prefix , detail = False , refresh = True )
331333 except FileNotFoundError :
332334 return
333335 for onefile in (a .replace (prefix + "/" , "" ) for a in allfiles ):
@@ -336,5 +338,7 @@ async def list_dir(self, prefix: str) -> AsyncGenerator[str, None]:
336338 async def list_prefix (self , prefix : str ) -> AsyncGenerator [str , None ]:
337339 # docstring inherited
338340 find_str = f"{ self .path } /{ prefix } "
339- for onefile in await self .fs ._find (find_str , detail = False , maxdepth = None , withdirs = False ):
341+ for onefile in await self .fs ._find (
342+ find_str , detail = False , maxdepth = None , withdirs = False , refresh = True
343+ ):
340344 yield onefile .removeprefix (find_str )
0 commit comments