Skip to content

Commit

Permalink
address feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewsg committed Nov 3, 2021
1 parent b06a695 commit dbae485
Showing 1 changed file with 9 additions and 10 deletions.
19 changes: 9 additions & 10 deletions google/cloud/storage/fileio.py
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ class BlobWriter(io.BufferedIOBase):
:type text_mode: bool
:param text_mode:
(Deprecated) A synynom for pass_on_flush. For backwards-compatibility,
(Deprecated) A synonym for ignore_flush. For backwards-compatibility,
if True, sets ignore_flush to True. Use ignore_flush instead. This
parameter will be removed in a future release.
Expand Down Expand Up @@ -406,15 +406,14 @@ def tell(self):
return self._buffer.tell() + len(self._buffer)

def flush(self):
if self._ignore_flush:
# TextIOWrapper expects this method to succeed before calling close().
return

raise io.UnsupportedOperation(
"Cannot flush without finalizing upload. Use close() instead, or "
"set ignore_flush=True when constructing this class (see "
"docstring)."
)
# flush() is not fully supported by the remote service, so raise an
# error here, unless self._ignore_flush is set.
if not self._ignore_flush:
raise io.UnsupportedOperation(
"Cannot flush without finalizing upload. Use close() instead, "
"or set ignore_flush=True when constructing this class (see "
"docstring)."
)

def close(self):
self._checkClosed() # Raises ValueError if closed.
Expand Down

0 comments on commit dbae485

Please sign in to comment.