1
0
mirror of https://github.com/openSUSE/osc.git synced 2024-11-10 06:46:15 +01:00

core: style, de-duplicate read() calls

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
This commit is contained in:
Ruediger Meier 2014-05-22 14:33:55 +00:00
parent a833120ebd
commit 6bb8ca437b

View File

@ -5366,14 +5366,17 @@ def streamfile(url, http_meth = http_GET, bufsize=8192, data=None, progress_obj=
if progress_obj:
basename = os.path.basename(urlsplit(url)[2])
progress_obj.start(basename=basename, text=text, size=cl)
data = f.read(bufsize)
read = len(data)
while len(data):
read = 0
while True:
data = f.read(bufsize)
if not len(data):
break
read += len(data)
if progress_obj:
progress_obj.update(read)
yield data
data = f.read(bufsize)
read += len(data)
if progress_obj:
progress_obj.end(read)
f.close()