diff --git a/dicom-archive/database_config_template.py b/dicom-archive/database_config_template.py index 5d2d1ac39..9715d7dee 100644 --- a/dicom-archive/database_config_template.py +++ b/dicom-archive/database_config_template.py @@ -25,8 +25,8 @@ def get_subject_ids(db, dicom_value=None, scanner_id=None): imaging = Imaging(db, False) - phantom_match = re.search('(pha)|(test)', dicom_value, re.IGNORECASE) - candidate_match = re.search('([^_]+)_(\d+)_([^_]+)', dicom_value, re.IGNORECASE) + phantom_match = re.search(r'(pha)|(test)', dicom_value, re.IGNORECASE) + candidate_match = re.search(r'([^_]+)_(\d+)_([^_]+)', dicom_value, re.IGNORECASE) if phantom_match: subject_id_dict['isPhantom'] = True diff --git a/python/lib/dcm2bids_imaging_pipeline_lib/dicom_archive_loader_pipeline.py b/python/lib/dcm2bids_imaging_pipeline_lib/dicom_archive_loader_pipeline.py index ad707f7f4..65af2ac97 100644 --- a/python/lib/dcm2bids_imaging_pipeline_lib/dicom_archive_loader_pipeline.py +++ b/python/lib/dcm2bids_imaging_pipeline_lib/dicom_archive_loader_pipeline.py @@ -151,7 +151,7 @@ def _run_dcm2niix_conversion(self): os.makedirs(nifti_tmp_dir) converter = self.config_db_obj.get_config("converter") - if not re.search('.*dcm2niix.*', converter, re.IGNORECASE): + if not re.search(r'.*dcm2niix.*', converter, re.IGNORECASE): message = f"{converter} does not appear to be a dcm2niix binary." self.log_error_and_exit(message, lib.exitcode.PROJECT_CUSTOMIZATION_FAILURE, is_error="Y", is_verbose="N") diff --git a/python/lib/mri.py b/python/lib/mri.py index 7ebaabbb2..21335a956 100644 --- a/python/lib/mri.py +++ b/python/lib/mri.py @@ -287,9 +287,9 @@ def fetch_and_insert_nifti_file(self, nifti_file, derivatives=None): other_assoc_files['bvec_file'] = assoc_file.path elif re.search(r'bval$', file_info['extension']): other_assoc_files['bval_file'] = assoc_file.path - elif re.search('tsv$', file_info['extension']) and file_info['suffix'] == 'events': + elif re.search(r'tsv$', file_info['extension']) and file_info['suffix'] == 'events': other_assoc_files['task_file'] = assoc_file.path - elif re.search('tsv$', file_info['extension']) and file_info['suffix'] == 'physio': + elif re.search(r'tsv$', file_info['extension']) and file_info['suffix'] == 'physio': other_assoc_files['physio_file'] = assoc_file.path # read the json file if it exists diff --git a/python/lib/utilities.py b/python/lib/utilities.py index 140510587..9d1bd9c92 100755 --- a/python/lib/utilities.py +++ b/python/lib/utilities.py @@ -283,7 +283,7 @@ def assemble_hed_service(data_dir, event_tsv_path, event_json_path): tokenResponse = requests.get(requestTokenURL) cookie = tokenResponse.headers['Set-Cookie'] - token = re.search('csrf_token" value="(.+?)"', tokenResponse.text).group(1) + token = re.search(r'csrf_token" value="(.+?)"', tokenResponse.text).group(1) # Define headers for assemble POST request, containing token and cookie headers = { diff --git a/python/mass_nifti_pic.py b/python/mass_nifti_pic.py index 589c1ff47..046fd0862 100755 --- a/python/mass_nifti_pic.py +++ b/python/mass_nifti_pic.py @@ -171,7 +171,7 @@ def make_pic(file_id, config_file, force, verbose): if not nii_file_path: print('WARNING: no file in the database with FileID = ' + str(file_id)) return - if not re.search('.nii.gz$', nii_file_path): + if not re.search(r'.nii.gz$', nii_file_path): print('WARNING: wrong file type. File ' + nii_file_path + ' is not a .nii.gz file') return if not os.path.exists(data_dir + nii_file_path):