Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(13)

Unified Diff: tools/telemetry/third_party/gsutilz/gslib/gcs_json_media.py

Issue 1376593003: Roll gsutil version to 4.15. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: tools/telemetry/third_party/gsutilz/gslib/gcs_json_media.py
diff --git a/tools/telemetry/third_party/gsutilz/gslib/gcs_json_media.py b/tools/telemetry/third_party/gsutilz/gslib/gcs_json_media.py
index 45440f9e727e4ba9bf7d1403822013982ede52e4..99684896f9d748ab0f9fda11664b23127627377c 100644
--- a/tools/telemetry/third_party/gsutilz/gslib/gcs_json_media.py
+++ b/tools/telemetry/third_party/gsutilz/gslib/gcs_json_media.py
@@ -454,11 +454,8 @@ class HttpWithDownloadStream(httplib2.Http):
class doc).
"""
- def __init__(self, stream=None, *args, **kwds):
- if stream is None:
- raise apitools_exceptions.InvalidUserInputError(
- 'Cannot create HttpWithDownloadStream with no stream')
- self._stream = stream
+ def __init__(self, *args, **kwds):
+ self._stream = None
self._logger = logging.getLogger()
super(HttpWithDownloadStream, self).__init__(*args, **kwds)
@@ -466,6 +463,10 @@ class HttpWithDownloadStream(httplib2.Http):
def stream(self):
return self._stream
+ @stream.setter
+ def stream(self, value):
+ self._stream = value
+
def _conn_request(self, conn, request_uri, method, body, headers): # pylint: disable=too-many-statements
try:
if hasattr(conn, 'sock') and conn.sock is None:
@@ -513,6 +514,9 @@ class HttpWithDownloadStream(httplib2.Http):
while True:
new_data = http_stream.read(TRANSFER_BUFFER_SIZE)
if new_data:
+ if self.stream is None:
+ raise apitools_exceptions.InvalidUserInputError(
+ 'Cannot exercise HttpWithDownloadStream with no stream')
self.stream.write(new_data)
bytes_read += len(new_data)
else:
« no previous file with comments | « tools/telemetry/third_party/gsutilz/gslib/gcs_json_api.py ('k') | tools/telemetry/third_party/gsutilz/gslib/hashing_helper.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698