From 2597c1f79647b59683d7ec9d90f51757bf62b828 Mon Sep 17 00:00:00 2001 From: Jon Clucas Date: Fri, 2 Feb 2024 22:50:40 -0500 Subject: [PATCH] :art: Use built-in `set`s --- CPAC/utils/build_data_config.py | 2 +- CPAC/utils/extract_data.py | 12 +++++------- CPAC/utils/extract_data_multiscan.py | 8 +++----- CPAC/utils/extract_parameters.py | 6 ++---- 4 files changed, 11 insertions(+), 17 deletions(-) diff --git a/CPAC/utils/build_data_config.py b/CPAC/utils/build_data_config.py index 39f8c5c376..b1adfbf800 100644 --- a/CPAC/utils/build_data_config.py +++ b/CPAC/utils/build_data_config.py @@ -129,7 +129,7 @@ def get_file_list( base_directory, creds_path=None, write_txt=None, write_pkl=None, write_info=False ) -> LIST[PATHSTR]: """Return a list of input and data file paths. - + These paths are either stored locally or on an AWS S3 bucket on the cloud. """ import os diff --git a/CPAC/utils/extract_data.py b/CPAC/utils/extract_data.py index 6cfdcd7f88..f8050936e3 100644 --- a/CPAC/utils/extract_data.py +++ b/CPAC/utils/extract_data.py @@ -454,8 +454,6 @@ def generate_supplementary_files(data_config_outdir, data_config_name): import csv import os - from sets import Set - data_config_path = os.path.join(data_config_outdir, data_config_name) try: @@ -465,11 +463,11 @@ def generate_supplementary_files(data_config_outdir, data_config_name): data_config_path ) - subject_scan_set = Set() - subID_set = Set() - session_set = Set() - subject_set = Set() - scan_set = Set() + subject_scan_set = set() + subID_set = set() + session_set = set() + subject_set = set() + scan_set = set() data_list = [] try: diff --git a/CPAC/utils/extract_data_multiscan.py b/CPAC/utils/extract_data_multiscan.py index dab674af66..87a0b46f5b 100644 --- a/CPAC/utils/extract_data_multiscan.py +++ b/CPAC/utils/extract_data_multiscan.py @@ -403,15 +403,13 @@ def generate_suplimentary_files(output_path): """ import csv - from sets import Set - subjects_list = yaml.safe_load( open(os.path.join(output_path, "CPAC_subject_list.yml"), "r") ) - subject_scan_set = Set() - subject_set = Set() - scan_set = Set() + subject_scan_set = set() + subject_set = set() + scan_set = set() data_list = [] for sub in subjects_list: diff --git a/CPAC/utils/extract_parameters.py b/CPAC/utils/extract_parameters.py index 9b7843ce45..460c48de13 100644 --- a/CPAC/utils/extract_parameters.py +++ b/CPAC/utils/extract_parameters.py @@ -79,8 +79,6 @@ def grab(output_dir, scrubbing): import os import re - from sets import Set - pipelines = glob.glob(os.path.join(output_dir, "pipeline*")) for p in pipelines: @@ -102,8 +100,8 @@ def grab(output_dir, scrubbing): if val: threshold_list.append(val.group(0)) - scan_list = Set(scan_list) - threshold_list = Set(threshold_list) + scan_list = set(scan_list) + threshold_list = set(threshold_list) for scan in scan_list: for threshold in threshold_list: