From 8f29d9548e3dfcd325a5c729093e3bf6657d7b6c Mon Sep 17 00:00:00 2001 From: Martin Durant Date: Fri, 2 Aug 2024 16:50:13 -0400 Subject: [PATCH] to support https://github.com/fsspec/kerchunk/pull/488 (#1657) --- fsspec/implementations/reference.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/fsspec/implementations/reference.py b/fsspec/implementations/reference.py index 58acd31a7..c14ee8302 100644 --- a/fsspec/implementations/reference.py +++ b/fsspec/implementations/reference.py @@ -502,6 +502,7 @@ def flush(self, base_url=None, storage_options=None): if k != ".zmetadata" and ".z" in k: self.zmetadata[k] = json.loads(self._items.pop(k)) met = {"metadata": self.zmetadata, "record_size": self.record_size} + self._items.clear() self._items[".zmetadata"] = json.dumps(met).encode() self.fs.pipe( "/".join([base_url or self.out_root, ".zmetadata"]), @@ -1085,7 +1086,7 @@ def isdir(self, path): # overwrite auto-sync version if self.dircache: return path in self.dircache elif isinstance(self.references, LazyReferenceMapper): - return path in self.references.listdir("") + return path in self.references.listdir() else: # this may be faster than building dircache for single calls, but # by looping will be slow for many calls; could cache it?