From 686673d9091ac714a2ae35613fd0d5cb8036dd88 Mon Sep 17 00:00:00 2001 From: Andrew Gorcester Date: Tue, 12 Nov 2024 15:49:39 -0800 Subject: [PATCH] Fix: Remove deprecated text_mode argument (#1379) --- google/cloud/storage/fileio.py | 10 +--------- tests/unit/test_fileio.py | 7 ------- 2 files changed, 1 insertion(+), 16 deletions(-) diff --git a/google/cloud/storage/fileio.py b/google/cloud/storage/fileio.py index c765811d1..f1b5e2bdd 100644 --- a/google/cloud/storage/fileio.py +++ b/google/cloud/storage/fileio.py @@ -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 @@ -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, @@ -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 diff --git a/tests/unit/test_fileio.py b/tests/unit/test_fileio.py index aae84d73e..57581b98a 100644 --- a/tests/unit/test_fileio.py +++ b/tests/unit/test_fileio.py @@ -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