Skip to content

Commit

Permalink
Fix: Remove deprecated text_mode argument (#1379)
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewsg committed Dec 11, 2024
1 parent 58b5040 commit 4d20a8e
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 16 deletions.
10 changes: 1 addition & 9 deletions google/cloud/storage/fileio.py
Original file line number Diff line number Diff line change
Expand Up @@ -237,12 +237,6 @@ class BlobWriter(io.BufferedIOBase):
writes must be exactly a multiple of 256KiB as with other resumable
uploads. The default is the chunk_size of the blob, or 40 MiB.
:type text_mode: bool
:param text_mode:
(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.
:type ignore_flush: bool
:param ignore_flush:
Makes flush() do nothing instead of raise an error. flush() without
Expand Down Expand Up @@ -296,7 +290,6 @@ def __init__(
self,
blob,
chunk_size=None,
text_mode=False,
ignore_flush=False,
retry=DEFAULT_RETRY_IF_GENERATION_SPECIFIED,
**upload_kwargs,
Expand All @@ -312,8 +305,7 @@ def __init__(
# Resumable uploads require a chunk size of a multiple of 256KiB.
# self._chunk_size must not be changed after the upload is initiated.
self._chunk_size = chunk_size or blob.chunk_size or DEFAULT_CHUNK_SIZE
# text_mode is a deprecated synonym for ignore_flush
self._ignore_flush = ignore_flush or text_mode
self._ignore_flush = ignore_flush
self._retry = retry
self._upload_kwargs = upload_kwargs

Expand Down
7 changes: 0 additions & 7 deletions tests/unit/test_fileio.py
Original file line number Diff line number Diff line change
Expand Up @@ -326,13 +326,6 @@ def test_attributes_explicit(self):
self.assertEqual(writer._chunk_size, 512 * 1024)
self.assertEqual(writer._retry, DEFAULT_RETRY)

def test_deprecated_text_mode_attribute(self):
blob = mock.Mock()
blob.chunk_size = 256 * 1024
writer = self._make_blob_writer(blob, text_mode=True)
self.assertTrue(writer._ignore_flush)
writer.flush() # This should do nothing and not raise an error.

def test_reject_wrong_chunk_size(self):
blob = mock.Mock()
blob.chunk_size = 123
Expand Down

0 comments on commit 4d20a8e

Please sign in to comment.