Skip to content

Commit 8d5e117

Browse files
committed
Add PrefixFileSystem behaviour on open() docstring
1 parent c7f763f commit 8d5e117

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

fsspec/spec.py

+10-6
Original file line numberDiff line numberDiff line change
@@ -812,12 +812,12 @@ def put(self, lpath, rpath, recursive=False, callback=_DEFAULT_CALLBACK, **kwarg
812812
self.put_file(lpath, rpath, **kwargs)
813813

814814
def head(self, path, size=1024):
815-
""" Get the first ``size`` bytes from file """
815+
"""Get the first ``size`` bytes from file"""
816816
with self.open(path, "rb") as f:
817817
return f.read(size)
818818

819819
def tail(self, path, size=1024):
820-
""" Get the last ``size`` bytes from file """
820+
"""Get the last ``size`` bytes from file"""
821821
with self.open(path, "rb") as f:
822822
f.seek(max(-size, -f.size), 2)
823823
return f.read()
@@ -879,7 +879,7 @@ def expand_path(self, path, recursive=False, maxdepth=None):
879879
return list(sorted(out))
880880

881881
def mv(self, path1, path2, recursive=False, maxdepth=None, **kwargs):
882-
""" Move file(s) from one location to another """
882+
"""Move file(s) from one location to another"""
883883
self.copy(path1, path2, recursive=recursive, maxdepth=maxdepth)
884884
self.rm(path1, recursive=recursive)
885885

@@ -944,6 +944,10 @@ def open(self, path, mode="rb", block_size=None, cache_options=None, **kwargs):
944944
"""
945945
Return a file-like object from the filesystem
946946
947+
The file-like object returned ignores an eventual PrefixFileSystem:
948+
- the ``.path`` attribute is always an absolute path
949+
- the``.fs`` attribute, if present, would be the wrapped file-system
950+
947951
The resultant instance must function correctly in a context ``with``
948952
block.
949953
@@ -1341,14 +1345,14 @@ def discard(self):
13411345
"""Throw away temporary file"""
13421346

13431347
def info(self):
1344-
""" File information about this path """
1348+
"""File information about this path"""
13451349
if "r" in self.mode:
13461350
return self.details
13471351
else:
13481352
raise ValueError("Info not available while writing")
13491353

13501354
def tell(self):
1351-
""" Current file location """
1355+
"""Current file location"""
13521356
return self.loc
13531357

13541358
def seek(self, loc, whence=0):
@@ -1455,7 +1459,7 @@ def _upload_chunk(self, final=False):
14551459
# may not yet have been initialized, may need to call _initialize_upload
14561460

14571461
def _initiate_upload(self):
1458-
""" Create remote file/upload """
1462+
"""Create remote file/upload"""
14591463
pass
14601464

14611465
def _fetch_range(self, start, end):

0 commit comments

Comments
 (0)