From d593a67133ab5617f650f84d27f8182767d39294 Mon Sep 17 00:00:00 2001 From: BO ZHANG Date: Sun, 6 Nov 2022 21:38:35 +0800 Subject: [PATCH] use os.system to implement dm.remove_files --- csst_common/data_manager.py | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/csst_common/data_manager.py b/csst_common/data_manager.py index 0ac2e9c..f48c62d 100644 --- a/csst_common/data_manager.py +++ b/csst_common/data_manager.py @@ -23,7 +23,7 @@ from astropy.table import Table from .dfs import gaia_query_from_dfs, get_l1api from .params import CSST_PARAMS as CP from .params import DFS_CONF -from .utils import remove_files, remove_dir +from .utils import remove_dir class CsstMsDataManager: @@ -252,8 +252,8 @@ class CsstMsDataManager: # parse info _telescope, _instrument, _survey, _imagetype, \ - _exp_start, _exp_stop, _exp_id, \ - _detector, *_l0_post, _ext = re.split(r"[_.]", fps_img[0]) + _exp_start, _exp_stop, _exp_id, \ + _detector, *_l0_post, _ext = re.split(r"[_.]", fps_img[0]) _exp_start = int(_exp_start) _exp_stop = int(_exp_stop) @@ -514,9 +514,8 @@ class CsstMsDataManager: lines += f"CSST_DFS_GATEWAY = " + os.getenv("CSST_DFS_GATEWAY") + "\n" return lines - @staticmethod - def remove_files(fmt="./*_post.fits"): - remove_files(fmt=fmt) + def remove_files(self, fmt="*.fits"): + os.system(f"rm -rf {os.path.join(self.dir_l1, fmt)}") @staticmethod def remove_dir(path): -- GitLab