From b1c2f60d32f3dc8f9b07ecf00f6cf5d6ee22ffb8 Mon Sep 17 00:00:00 2001 From: Myhs-phz Date: Wed, 19 Mar 2025 09:14:52 +0000 Subject: [PATCH] fix hook --- tools/update_dataset_suffix.py | 40 +++++++++++++++++----------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/tools/update_dataset_suffix.py b/tools/update_dataset_suffix.py index b1634955..bcecf8ef 100755 --- a/tools/update_dataset_suffix.py +++ b/tools/update_dataset_suffix.py @@ -94,21 +94,21 @@ def check_and_rename(filepath): return None, None -def update_imports(data): - python_file, name_pairs = data - for filepath, new_file in name_pairs: - old_name = os.path.basename(filepath)[:-3] - new_name = os.path.basename(new_file)[:-3] - if not os.path.exists(python_file): - return - with open(python_file, 'r') as file: - filedata = file.read() - # Replace the old name with new name - new_data = filedata.replace(old_name, new_name) - if filedata != new_data: - with open(python_file, 'w') as file: - file.write(new_data) - # print(f"Updated imports in {python_file}") +# def update_imports(data): +# python_file, name_pairs = data +# for filepath, new_file in name_pairs: +# old_name = os.path.basename(filepath)[:-3] +# new_name = os.path.basename(new_file)[:-3] +# if not os.path.exists(python_file): +# return +# with open(python_file, 'r') as file: +# filedata = file.read() +# # Replace the old name with new name +# new_data = filedata.replace(old_name, new_name) +# if filedata != new_data: +# with open(python_file, 'w') as file: +# file.write(new_data) +# # print(f"Updated imports in {python_file}") def main(): @@ -134,11 +134,11 @@ def main(): return with Pool(16) as p: p.starmap(os.rename, name_pairs) - root_folder = 'configs' - python_files = glob.glob(f'{root_folder}/**/*.py', recursive=True) - update_data = [(python_file, name_pairs) for python_file in python_files] - with Pool(16) as p: - p.map(update_imports, update_data) + # root_folder = 'configs' + # python_files = glob.glob(f'{root_folder}/**/*.py', recursive=True) + # update_data = [(python_file, name_pairs) for python_file in python_files] + # with Pool(16) as p: + # p.map(update_imports, update_data) if __name__ == '__main__':