Skip to content

Commit be281fa

Browse files
committed
resolving comments
1 parent 7e8f213 commit be281fa

File tree

3 files changed

+18
-5
lines changed

3 files changed

+18
-5
lines changed

google/cloud/storage/_media/requests/download.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -133,9 +133,9 @@ def _write_to_stream(self, response):
133133
# object to the decoder and return a _DoNothingHash here.
134134
local_checksum_object = _add_decoder(response.raw, checksum_object)
135135

136+
# This is useful for smaller files, or when the user wants to
137+
# download the entire file in one go.
136138
if self.single_shot_download:
137-
# This is useful for smaller files, or when the user wants to
138-
# download the entire file in one go.
139139
content = response.raw.read(decode_content=True)
140140
self._stream.write(content)
141141
self._bytes_downloaded += len(content)
@@ -356,9 +356,9 @@ def _write_to_stream(self, response):
356356
checksum_object = self._checksum_object
357357

358358
with response:
359+
# This is useful for smaller files, or when the user wants to
360+
# download the entire file in one go.
359361
if self.single_shot_download:
360-
# This is useful for smaller files, or when the user wants to
361-
# download the entire file in one go.
362362
content = response.raw.read()
363363
self._stream.write(content)
364364
self._bytes_downloaded += len(content)

google/cloud/storage/blob.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1052,6 +1052,8 @@ def _do_download(
10521052
:type single_shot_download: bool
10531053
:param single_shot_download:
10541054
(Optional) If true, download the object in a single request.
1055+
Caution: Enabling this will increase the memory overload for your application.
1056+
Please enable this as per your user use case.
10551057
"""
10561058

10571059
extra_attributes = {
@@ -1233,6 +1235,8 @@ def download_to_file(
12331235
:type single_shot_download: bool
12341236
:param single_shot_download:
12351237
(Optional) If true, download the object in a single request.
1238+
Caution: Enabling this will increase the memory overload for your application.
1239+
Please enable this as per your user use case.
12361240
12371241
:raises: :class:`google.cloud.exceptions.NotFound`
12381242
"""
@@ -1387,6 +1391,8 @@ def download_to_filename(
13871391
:type single_shot_download: bool
13881392
:param single_shot_download:
13891393
(Optional) If true, download the object in a single request.
1394+
Caution: Enabling this will increase the memory overload for your application.
1395+
Please enable this as per your user use case.
13901396
13911397
:raises: :class:`google.cloud.exceptions.NotFound`
13921398
"""
@@ -1507,6 +1513,8 @@ def download_as_bytes(
15071513
:type single_shot_download: bool
15081514
:param single_shot_download:
15091515
(Optional) If true, download the object in a single request.
1516+
Caution: Enabling this will increase the memory overload for your application.
1517+
Please enable this as per your user use case.
15101518
15111519
:rtype: bytes
15121520
:returns: The data stored in this blob.
@@ -1623,6 +1631,8 @@ def download_as_string(
16231631
:type single_shot_download: bool
16241632
:param single_shot_download:
16251633
(Optional) If true, download the object in a single request.
1634+
Caution: Enabling this will increase the memory overload for your application.
1635+
Please enable this as per your user use case.
16261636
16271637
:rtype: bytes
16281638
:returns: The data stored in this blob.
@@ -1740,6 +1750,8 @@ def download_as_text(
17401750
:type single_shot_download: bool
17411751
:param single_shot_download:
17421752
(Optional) If true, download the object in a single request.
1753+
Caution: Enabling this will increase the memory overload for your application.
1754+
Please enable this as per your user use case.
17431755
17441756
:rtype: text
17451757
:returns: The data stored in this blob, decoded to text.
@@ -4336,6 +4348,8 @@ def _prep_and_do_download(
43364348
:type single_shot_download: bool
43374349
:param single_shot_download:
43384350
(Optional) If true, download the object in a single request.
4351+
Caution: Enabling this will increase the memory overload for your application.
4352+
Please enable this as per your user use case.
43394353
43404354
:type command: str
43414355
:param command:

tests/system/test_blob.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1156,7 +1156,6 @@ def test_blob_download_as_bytes_single_shot_download(
11561156
):
11571157
blob_name = f"download-single-shot-{uuid.uuid4().hex}"
11581158
info = file_data["simple"]
1159-
payload = None
11601159
with open(info["path"], "rb") as f:
11611160
payload = f.read()
11621161

0 commit comments

Comments
 (0)