From 076c896ab0d3aad10b60def0fc6ba4c4e813d577 Mon Sep 17 00:00:00 2001 From: Paul McCarthy <pauldmccarthy@gmail.com> Date: Fri, 12 Oct 2018 12:39:41 +0100 Subject: [PATCH] RF: Raw strings for regexps --- fsl/data/dicom.py | 10 +++++----- fsl/data/dtifit.py | 2 +- fsl/version.py | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/fsl/data/dicom.py b/fsl/data/dicom.py index 0f586f6f9..53b7edefe 100644 --- a/fsl/data/dicom.py +++ b/fsl/data/dicom.py @@ -120,11 +120,11 @@ def enabled(): cmd = 'dcm2niix -h' versionPattern = re.compile(r'v' - '(?P<major>[0-9]+)\.' - '(?P<minor>[0-9]+)\.' - '(?P<year>[0-9]{4})' - '(?P<month>[0-9]{2})' - '(?P<day>[0-9]{2})') + r'(?P<major>[0-9]+)\.' + r'(?P<minor>[0-9]+)\.' + r'(?P<year>[0-9]{4})' + r'(?P<month>[0-9]{2})' + r'(?P<day>[0-9]{2})') try: output = sp.check_output(cmd.split()).decode() diff --git a/fsl/data/dtifit.py b/fsl/data/dtifit.py index a2c36fb33..349486698 100644 --- a/fsl/data/dtifit.py +++ b/fsl/data/dtifit.py @@ -50,7 +50,7 @@ def getDTIFitDataPrefix(path): # Gather all of the existing file # prefixes into a dictionary of # prefix : [file list] mappings. - pattern = '^(.*)_(?:V1|V2|V3|L1|L2|L3).*$' + pattern = r'^(.*)_(?:V1|V2|V3|L1|L2|L3).*$' prefixes = {} for f in [f for flist in files for f in flist]: diff --git a/fsl/version.py b/fsl/version.py index 095ab8c41..d9f53ecd2 100644 --- a/fsl/version.py +++ b/fsl/version.py @@ -130,7 +130,7 @@ def patchVersion(filename, newversion): with open(filename, 'rt') as f: lines = f.readlines() - pattern = re.compile('^__version__ *= *\'.*\' *$') + pattern = re.compile(r'^__version__ *= *\'.*\' *$') for i, line in enumerate(lines): if pattern.match(line): -- GitLab