From a0d9e1de5d2eac44c66f23a2024e87a1ee82703d Mon Sep 17 00:00:00 2001 From: machichima Date: Tue, 4 Feb 2025 22:26:02 +0800 Subject: [PATCH] feat: inherit from AsyncFsspecStore to specify protocol Specify protocol s3, gs, and abfs --- obstore/python/obstore/fsspec.py | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/obstore/python/obstore/fsspec.py b/obstore/python/obstore/fsspec.py index ed0aca5..8d73c30 100644 --- a/obstore/python/obstore/fsspec.py +++ b/obstore/python/obstore/fsspec.py @@ -31,8 +31,7 @@ import fsspec.spec import obstore as obs -from obstore.store import S3Store, GCSStore, AzureStore, from_url - +from obstore.store import from_url class AsyncFsspecStore(fsspec.asyn.AsyncFileSystem): """An fsspec implementation based on a obstore Store. @@ -115,7 +114,6 @@ def _split_path(self, path: str) -> Tuple[str, str]: @lru_cache(maxsize=10) def _construct_store(self, bucket: str): - # from obstore.store import from_url return from_url( url=f"{self.protocol}://{bucket}", config=self.config, @@ -269,3 +267,13 @@ def read(self, length: int = -1): data = self.fs.cat_file(self.path, self.loc, self.loc + length) self.loc += length return data + + +class S3FsspecStore(AsyncFsspecStore): + protocol = "s3" + +class GCSFsspecStore(AsyncFsspecStore): + protocol = "gs" + +class AzureFsspecStore(AsyncFsspecStore): + protocol = "abfs"