Skip to content

Commit

Permalink
Don't override AbstractBufferedFile.flush implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
nsmith- authored Dec 19, 2024
1 parent 18b020b commit 6a11d6b
Showing 1 changed file with 0 additions and 20 deletions.
20 changes: 0 additions & 20 deletions src/fsspec_xrootd/xrootd.py
Original file line number Diff line number Diff line change
Expand Up @@ -911,26 +911,6 @@ def _fetch_range(self, start: int, end: int) -> Any:
raise OSError(f"File did not read properly: {status.message}")
return data

def flush(self, force: bool = False) -> None:
if self.closed:
raise ValueError("Flush on closed file")
if force and self.forced:
raise ValueError("Force flush cannot be called more than once")
if force:
self.forced = True

if self.mode not in {"wb", "ab"}:
# no-op to flush on read-mode
return

if not force and self.buffer.tell() < self.blocksize:
# Defer write on small block
return

if self._upload_chunk(final=force) is not False:
self.offset += self.buffer.seek(0, 2)
self.buffer = io.BytesIO()

def _upload_chunk(self, final: bool = False) -> Any:
status, _n = self._myFile.write(
self.buffer.getvalue(),
Expand Down

0 comments on commit 6a11d6b

Please sign in to comment.