Commit 076c896a authored by Paul McCarthy's avatar Paul McCarthy 🚵
Browse files

RF: Raw strings for regexps

parent e6a4d1f8
...@@ -120,11 +120,11 @@ def enabled(): ...@@ -120,11 +120,11 @@ def enabled():
cmd = 'dcm2niix -h' cmd = 'dcm2niix -h'
versionPattern = re.compile(r'v' versionPattern = re.compile(r'v'
'(?P<major>[0-9]+)\.' r'(?P<major>[0-9]+)\.'
'(?P<minor>[0-9]+)\.' r'(?P<minor>[0-9]+)\.'
'(?P<year>[0-9]{4})' r'(?P<year>[0-9]{4})'
'(?P<month>[0-9]{2})' r'(?P<month>[0-9]{2})'
'(?P<day>[0-9]{2})') r'(?P<day>[0-9]{2})')
try: try:
output = sp.check_output(cmd.split()).decode() output = sp.check_output(cmd.split()).decode()
......
...@@ -50,7 +50,7 @@ def getDTIFitDataPrefix(path): ...@@ -50,7 +50,7 @@ def getDTIFitDataPrefix(path):
# Gather all of the existing file # Gather all of the existing file
# prefixes into a dictionary of # prefixes into a dictionary of
# prefix : [file list] mappings. # prefix : [file list] mappings.
pattern = '^(.*)_(?:V1|V2|V3|L1|L2|L3).*$' pattern = r'^(.*)_(?:V1|V2|V3|L1|L2|L3).*$'
prefixes = {} prefixes = {}
for f in [f for flist in files for f in flist]: for f in [f for flist in files for f in flist]:
......
...@@ -130,7 +130,7 @@ def patchVersion(filename, newversion): ...@@ -130,7 +130,7 @@ def patchVersion(filename, newversion):
with open(filename, 'rt') as f: with open(filename, 'rt') as f:
lines = f.readlines() lines = f.readlines()
pattern = re.compile('^__version__ *= *\'.*\' *$') pattern = re.compile(r'^__version__ *= *\'.*\' *$')
for i, line in enumerate(lines): for i, line in enumerate(lines):
if pattern.match(line): if pattern.match(line):
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment