Commit b2134dc5 authored by Łukasz Nowak's avatar Łukasz Nowak

shutil.copyfileobj has default buffer.

parent 852ee9c5
...@@ -80,10 +80,9 @@ def download_network_cached(dir_url, cache_url, path, url, logger, ...@@ -80,10 +80,9 @@ def download_network_cached(dir_url, cache_url, path, url, logger,
signature_certificate_file_list=signature_certificate_file_list) signature_certificate_file_list=signature_certificate_file_list)
file_descriptor = nc.select(directory_key) file_descriptor = nc.select(directory_key)
buffer_size = min(1024, os.path.getsize(file_descriptor.name))
f = open(path, 'w+b') f = open(path, 'w+b')
try: try:
shutil.copyfileobj(file_descriptor, f, buffer_size) shutil.copyfileobj(file_descriptor, f)
finally: finally:
f.close() f.close()
file_descriptor.close() file_descriptor.close()
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment