Skip to content

Commit 59cdb79

Browse files
committed
fsspec.implementations.cached: don't consider 'fo' keyword for the fs instance cache
1 parent e065656 commit 59cdb79

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

fsspec/implementations/cached.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ class CachingFileSystem(ChainedFileSystem):
6161
"""
6262

6363
protocol: ClassVar[str | tuple[str, ...]] = ("blockcache", "cached")
64+
_strip_tokenize_options = ("fo",)
6465

6566
def __init__(
6667
self,

fsspec/spec.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,9 @@ def __call__(cls, *args, **kwargs):
6767
extra_tokens = tuple(
6868
getattr(cls, attr, None) for attr in cls._extra_tokenize_attributes
6969
)
70+
strip_tokenize_options = {
71+
k: kwargs.pop(k) for k in cls._strip_tokenize_options if k in kwargs
72+
}
7073
token = tokenize(
7174
cls, cls._pid, threading.get_ident(), *args, *extra_tokens, **kwargs
7275
)
@@ -78,7 +81,7 @@ def __call__(cls, *args, **kwargs):
7881
cls._latest = token
7982
return cls._cache[token]
8083
else:
81-
obj = super().__call__(*args, **kwargs)
84+
obj = super().__call__(*args, **kwargs, **strip_tokenize_options)
8285
# Setting _fs_token here causes some static linters to complain.
8386
obj._fs_token_ = token
8487
obj.storage_args = args
@@ -115,6 +118,8 @@ class AbstractFileSystem(metaclass=_Cached):
115118

116119
#: Extra *class attributes* that should be considered when hashing.
117120
_extra_tokenize_attributes = ()
121+
#: *storage options* that should not be considered when hashing.
122+
_strip_tokenize_options = ()
118123

119124
# Set by _Cached metaclass
120125
storage_args: tuple[Any, ...]

0 commit comments

Comments
 (0)