def gunzip_file(zip_file, out_file):
if not os.path.isfile(out_file):
with gzip.open(zip_file, 'rb') as f_in:
with open(out_file, 'wb') as f_out:
f_out.writelines(f_in)
Or, using a compound with statement:
def gunzip_file(zip_file, out_file):
if not os.path.isfile(out_file):
with gzip.open(zip_file, 'rb') as f_in, open(out_file, 'wb') as f_out:
f_out.writelines(f_in)
It would be nice if hivtrace would only unpack resource files if they're not found. This would have two advantages:
The following code would need to be changed:
https://github.com/veg/hivtrace/blob/e1164ddbb2bd6d0d7d7a8163e6c47f2cf7f44995/hivtrace/hivtrace.py#L67-L70
An implementation could look like this:
Or, using a compound with statement: