I found that the current implementation of CachingFileSystem implicitly requires that the file object of wrapped fs uses the property .cache.
https://github.com/fsspec/filesystem_spec/blob/f84b99f0d1f079f990db1a219b74df66ab3e7160/fsspec/implementations/cached.py#L388-L390
However, not all implementation uses the property .cache. I am currently facing an issue that the file object of WebdavFileSystem (from https://github.com/skshetry/webdav4) does overrides method .read() ignoring .cache. Because of that, nothing is cached when I wrap a WebdavFileSystem object with CachingFileSystem.
|
def read(self, length: int = -1) -> Union[str, bytes, None]: |
|
"""Read chunk of bytes.""" |
|
chunk = self.reader.read(length) |
|
if chunk: |
|
self.loc += len(chunk) |
|
return chunk |
In my opinion, a wrapper like CachingFileSystem should not imply how the wrapped object works. Perhaps a more general solution should be implemented here?
I found that the current implementation of
CachingFileSystemimplicitly requires that the file object of wrappedfsuses the property.cache.https://github.com/fsspec/filesystem_spec/blob/f84b99f0d1f079f990db1a219b74df66ab3e7160/fsspec/implementations/cached.py#L388-L390
However, not all implementation uses the property
.cache. I am currently facing an issue that the file object ofWebdavFileSystem(from https://github.com/skshetry/webdav4) does overrides method.read()ignoring.cache. Because of that, nothing is cached when I wrap aWebdavFileSystemobject withCachingFileSystem.webdav4/src/webdav4/fsspec.py
Lines 428 to 433 in e9b8fbd
In my opinion, a wrapper like
CachingFileSystemshould not imply how the wrapped object works. Perhaps a more general solution should be implemented here?