From 9691e225724e041997c74f8665dcbfa12bb1c579 Mon Sep 17 00:00:00 2001 From: Frederick Muriuki Muriithi Date: Fri, 11 Mar 2022 11:51:02 +0300 Subject: Fix some linting issues --- gn3/fs_helpers.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'gn3/fs_helpers.py') diff --git a/gn3/fs_helpers.py b/gn3/fs_helpers.py index 578269b..f313086 100644 --- a/gn3/fs_helpers.py +++ b/gn3/fs_helpers.py @@ -71,9 +71,8 @@ contents to TARGET_DIR/. os.mkdir(os.path.join(target_dir, token)) gzipped_file.save(tar_target_loc) # Extract to "tar_target_loc/token" - tar = tarfile.open(tar_target_loc) - tar.extractall(path=os.path.join(target_dir, token)) - tar.close() + with tarfile.open(tar_target_loc) as tar: + tar.extractall(path=os.path.join(target_dir, token)) # pylint: disable=W0703 except Exception: return {"status": 128, "error": "gzip failed to unpack file"} -- cgit v1.2.3