mirror of
https://github.com/mail-in-a-box/mailinabox.git
synced 2025-01-23 12:37:05 +00:00
Fixed SIM117 (multiple-with-statements): Use a single with
statement with multiple contexts instead of nested with
statements
This commit is contained in:
parent
bd0cb22467
commit
9896bfb765
@ -72,8 +72,7 @@ def scan_files(collector):
|
|||||||
if not os.path.exists(fn):
|
if not os.path.exists(fn):
|
||||||
continue
|
continue
|
||||||
if fn[-3:] == '.gz':
|
if fn[-3:] == '.gz':
|
||||||
with tempfile.NamedTemporaryFile(delete=False) as tmp_file:
|
with tempfile.NamedTemporaryFile(delete=False) as tmp_file, gzip.open(fn, 'rb') as f:
|
||||||
with gzip.open(fn, 'rb') as f:
|
|
||||||
shutil.copyfileobj(f, tmp_file)
|
shutil.copyfileobj(f, tmp_file)
|
||||||
|
|
||||||
if VERBOSE:
|
if VERBOSE:
|
||||||
|
Loading…
Reference in New Issue
Block a user