Skip to content

Fix: Remove deprecated text_mode argument #1379

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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