Skip to content

Commit 5ea2ba8

Browse files
committed
small edits
1 parent 096845c commit 5ea2ba8

File tree

1 file changed

+11
-7
lines changed

1 file changed

+11
-7
lines changed

obstore/python/obstore/fsspec.py

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ class AsyncFsspecStore(fsspec.asyn.AsyncFileSystem):
7272
fsspec-style object.
7373
"""
7474

75+
# https://github.com/fsspec/filesystem_spec/blob/56054c0a30ceedab4c0e6a0f7e429666773baf6d/docs/source/features.rst#instance-caching
7576
cachable = True
7677

7778
def __init__( # noqa: PLR0913
@@ -98,7 +99,9 @@ def __init__( # noqa: PLR0913
9899
Args:
99100
config: Configuration for the cloud storage provider, which can be one of
100101
S3Config, S3ConfigInput, GCSConfig, GCSConfigInput, AzureConfig,
101-
or AzureConfigInput. If None, no cloud storage configuration is applied.
102+
or AzureConfigInput. Any of these values will be applied after checking
103+
for environment variables. If `None`, no cloud storage configuration is
104+
applied beyond what is found in environment variables.
102105
client_options: Additional options for configuring the client.
103106
retry_config: Configuration for handling request errors.
104107
args: positional arguments passed on to the `fsspec.asyn.AsyncFileSystem`
@@ -108,8 +111,9 @@ def __init__( # noqa: PLR0913
108111
asynchronous: Set to `True` if this instance is meant to be be called using
109112
the fsspec async API. This should only be set to true when running
110113
within a coroutine.
111-
max_cache_size (int, optional): The maximum number of items the cache should
112-
store. Defaults to 10.
114+
max_cache_size (int, optional): The maximum number of stores the cache
115+
should keep. A cached store is kept internally for each bucket name.
116+
Defaults to 10.
113117
loop: since both fsspec/python and tokio/rust may be using loops, this
114118
should be kept `None` for now, and will not be used.
115119
batch_size: some operations on many files will batch their requests; if you
@@ -132,6 +136,7 @@ def __init__( # noqa: PLR0913
132136
self.client_options = client_options
133137
self.retry_config = retry_config
134138

139+
# https://stackoverflow.com/a/68550238
135140
self._construct_store = lru_cache(maxsize=max_cache_size)(self._construct_store)
136141

137142
super().__init__(
@@ -145,11 +150,10 @@ def _split_path(self, path: str) -> tuple[str, str]:
145150
"""Split bucket and file path.
146151
147152
Args:
148-
path (str): Input path, like `s3://mybucket/path/to/file`
153+
path: Input path, like `s3://mybucket/path/to/file`
149154
150155
Returns:
151-
tuple[str, str]: with the first element as bucket name and second be
152-
the file path inside the bucket
156+
(bucket name, file path inside the bucket)
153157
154158
Examples:
155159
>>> split_path("s3://mybucket/path/to/file")
@@ -484,7 +488,7 @@ def register(protocol: str | Iterable[str], *, asynchronous: bool = False) -> No
484488
485489
Example:
486490
>>> register("s3")
487-
>>> register("s3", asynchronous=True) # Registers an async-store for "s3"
491+
>>> register("s3", asynchronous=True) # Registers an async store for "s3"
488492
>>> register(["gcs", "abfs"]) # Registers both "gcs" and "abfs"
489493
490494
Notes:

0 commit comments

Comments
 (0)