From 5b3a48e73bc398a07908ac30a290866b986728a4 Mon Sep 17 00:00:00 2001 From: Albin Vass Date: Fri, 27 Nov 2020 17:58:59 +0100 Subject: [PATCH] GZIPCompressedStream default read size to -1 To be compatible with the io.RawIOBase interface the GZIPCompressedStream read method argument should be called `size` and have a default value of -1 meaning until EOF. See: https://docs.python.org/3/library/io.html#io.RawIOBase Change-Id: Ie8b4c77f6c730c91bb4d4997dcb7f9a9acde0f31 --- .../module_utils/zuul_jobs/upload_utils.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/roles/upload-logs-base/module_utils/zuul_jobs/upload_utils.py b/roles/upload-logs-base/module_utils/zuul_jobs/upload_utils.py index dd254c703..9b6353f83 100644 --- a/roles/upload-logs-base/module_utils/zuul_jobs/upload_utils.py +++ b/roles/upload-logs-base/module_utils/zuul_jobs/upload_utils.py @@ -125,6 +125,9 @@ ICON_IMAGES = { # removed type annotations to support python2. # removed use of *, somearg for positional anonymous args. # Default compression level to 9. +# +# changed read method argument name from length to size and +# added read method default value size=-1 for parent class compatibility class GZIPCompressedStream(io.RawIOBase): def __init__(self, stream, compression_level=9): @@ -144,8 +147,8 @@ class GZIPCompressedStream(io.RawIOBase): self._compressed_stream.seek(0) self.count = 0 - def read(self, length): - r = super().read(length) + def read(self, size=-1): + r = super().read(size) self.count += len(r) return r