From 821ee760945bbd38b5a4c6c7db28d9fa08de7fb2 Mon Sep 17 00:00:00 2001 From: RussTreadon-NOAA Date: Wed, 18 Sep 2024 18:21:10 +0000 Subject: [PATCH] make jedi method extract_tar static, clean up comments, correct typo (#2862) --- ush/python/pygfs/jedi/jedi.py | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/ush/python/pygfs/jedi/jedi.py b/ush/python/pygfs/jedi/jedi.py index 9e69065bb2..415a0a3c08 100644 --- a/ush/python/pygfs/jedi/jedi.py +++ b/ush/python/pygfs/jedi/jedi.py @@ -231,9 +231,10 @@ def get_bias_dict(self, task_config: AttrDict, bias_file) -> Dict[str, Any]: return bias_dict + @staticmethod @logit(logger) - def extract_tar(self, tar_file: str) -> None: - """Extract bias correction files from a tarball + def extract_tar(tar_file: str) -> None: + """Extract files from a tarball This method extract files from a tarball @@ -254,14 +255,14 @@ def extract_tar(self, tar_file: str) -> None: tarball.extractall(path=tar_path) logger.info(f"Extract {tarball.getnames()}") except tarfile.ReadError as err: - if tarfile.is_tarfile(tarfile[1]): - logger.error(f"FATAL ERROR: {tarfile[1]} could not be read") - raise tarfile.ReadError(f"FATAL ERROR: unable to read {tarfile[1]}") + if tarfile.is_tarfile(tar_file): + logger.error(f"FATAL ERROR: {tar_file} could not be read") + raise tarfile.ReadError(f"FATAL ERROR: unable to read {tar_file}") else: logger.info() except tarfile.ExtractError as err: - logger.exception(f"FATAL ERROR: unable to extract from {tarfile[1]}") - raise tarfile.ExtractError("FATAL ERROR: unable to extract from {tarfile[1]}") + logger.exception(f"FATAL ERROR: unable to extract from {tar_file}") + raise tarfile.ExtractError("FATAL ERROR: unable to extract from {tar_file}") @logit(logger)