Refactor `astroquery/utils/system_tools.py`
All imports are now done at modul level and unused code has been
removed.
# Licensed under a 3-clause BSD style license - see LICENSE.rst
+import gzip
import os
-
-# Import DEVNULL for py3 or py3
-try:
- from subprocess import DEVNULL
-except ImportError:
- DEVNULL = open(os.devnull, 'wb')
-
-# Check availability of some system tools
-# Exceptions are raised if not found
+import shutil
def gunzip(filename):
@@ -19,17 +12,13 @@ def gunzip(filename):
----------
filename : str
Fully qualified path of the file to decompress.
+
Returns
-------
filename : str
Name of the decompressed file (or input filename if gzip is not
available).
"""
- import shutil
- import gzip
-
- # system-wide 'gzip' was removed, Python gzip used instead.
- # See #1538 : https://github.com/astropy/astroquery/issues/1538
# ".fz" denotes RICE rather than gzip compression
if not filename.endswith('.fz'):
