diff options
author | Frederick Muriuki Muriithi | 2022-02-21 16:23:06 +0300 |
---|---|---|
committer | Frederick Muriuki Muriithi | 2022-02-21 16:23:06 +0300 |
commit | a35fce27875d9db80dce1976b6f8ee8c00ecfe0a (patch) | |
tree | 8e8f815a6e3d37348bdb8f253f5ec53f72dc2dbc /gn3/fs_helpers.py | |
parent | c84b07b8c5ac0a42c0fab929c75823b30b548191 (diff) | |
download | genenetwork3-a35fce27875d9db80dce1976b6f8ee8c00ecfe0a.tar.gz |
Fix a myriad of linter issues
* Use `with` in place of plain `open`
* Use f-strings in place of `str.format()`
* Remove string interpolation from queries - provide data as query parameters
* other minor fixes
Diffstat (limited to 'gn3/fs_helpers.py')
-rw-r--r-- | gn3/fs_helpers.py | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/gn3/fs_helpers.py b/gn3/fs_helpers.py index 73f6567..e2f7ee2 100644 --- a/gn3/fs_helpers.py +++ b/gn3/fs_helpers.py @@ -71,9 +71,8 @@ contents to TARGET_DIR/<dir-hash>. 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"} |