diff --git a/fsspec/spec.py b/fsspec/spec.py index e06b82f2e..5c84fbf4d 100644 --- a/fsspec/spec.py +++ b/fsspec/spec.py @@ -812,12 +812,12 @@ def put(self, lpath, rpath, recursive=False, callback=_DEFAULT_CALLBACK, **kwarg self.put_file(lpath, rpath, **kwargs) def head(self, path, size=1024): - """ Get the first ``size`` bytes from file """ + """Get the first ``size`` bytes from file""" with self.open(path, "rb") as f: return f.read(size) def tail(self, path, size=1024): - """ Get the last ``size`` bytes from file """ + """Get the last ``size`` bytes from file""" with self.open(path, "rb") as f: f.seek(max(-size, -f.size), 2) return f.read() @@ -879,7 +879,7 @@ def expand_path(self, path, recursive=False, maxdepth=None): return list(sorted(out)) def mv(self, path1, path2, recursive=False, maxdepth=None, **kwargs): - """ Move file(s) from one location to another """ + """Move file(s) from one location to another""" self.copy(path1, path2, recursive=recursive, maxdepth=maxdepth) self.rm(path1, recursive=recursive) @@ -944,6 +944,10 @@ def open(self, path, mode="rb", block_size=None, cache_options=None, **kwargs): """ Return a file-like object from the filesystem + The file-like object returned ignores an eventual PrefixFileSystem: + - the ``.path`` attribute is always an absolute path + - the``.fs`` attribute, if present, would be the wrapped file-system + The resultant instance must function correctly in a context ``with`` block. @@ -1341,14 +1345,14 @@ def discard(self): """Throw away temporary file""" def info(self): - """ File information about this path """ + """File information about this path""" if "r" in self.mode: return self.details else: raise ValueError("Info not available while writing") def tell(self): - """ Current file location """ + """Current file location""" return self.loc def seek(self, loc, whence=0): @@ -1455,7 +1459,7 @@ def _upload_chunk(self, final=False): # may not yet have been initialized, may need to call _initialize_upload def _initiate_upload(self): - """ Create remote file/upload """ + """Create remote file/upload""" pass def _fetch_range(self, start, end):