Skip to content

Commit fd2b27d

Browse files
STY: Apply ruff rule RUF039
RUF039 First argument to `re.search()` is not raw string
1 parent 6c3b44f commit fd2b27d

File tree

4 files changed

+16
-16
lines changed

4 files changed

+16
-16
lines changed

niworkflows/interfaces/confounds.py

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -535,20 +535,20 @@ def _expand_shorthand(model_formula, variables):
535535
nss = _get_matches_from_data('non_steady_state_outlier[0-9]+', variables)
536536
spikes = _get_matches_from_data('motion_outlier[0-9]+', variables)
537537

538-
model_formula = re.sub('wm', wm, model_formula)
539-
model_formula = re.sub('gsr', gsr, model_formula)
540-
model_formula = re.sub('rps', rps, model_formula)
541-
model_formula = re.sub('fd', fd, model_formula)
542-
model_formula = re.sub('acc', acc, model_formula)
543-
model_formula = re.sub('tcc', tcc, model_formula)
544-
model_formula = re.sub('dv', dv, model_formula)
545-
model_formula = re.sub('dvall', dvall, model_formula)
546-
model_formula = re.sub('nss', nss, model_formula)
547-
model_formula = re.sub('spikes', spikes, model_formula)
538+
model_formula = re.sub(r'wm', wm, model_formula)
539+
model_formula = re.sub(r'gsr', gsr, model_formula)
540+
model_formula = re.sub(r'rps', rps, model_formula)
541+
model_formula = re.sub(r'fd', fd, model_formula)
542+
model_formula = re.sub(r'acc', acc, model_formula)
543+
model_formula = re.sub(r'tcc', tcc, model_formula)
544+
model_formula = re.sub(r'dv', dv, model_formula)
545+
model_formula = re.sub(r'dvall', dvall, model_formula)
546+
model_formula = re.sub(r'nss', nss, model_formula)
547+
model_formula = re.sub(r'spikes', spikes, model_formula)
548548

549549
formula_variables = _get_variables_from_formula(model_formula)
550550
others = ' + '.join(set(variables) - set(formula_variables))
551-
model_formula = re.sub('others', others, model_formula)
551+
model_formula = re.sub(r'others', others, model_formula)
552552
return model_formula
553553

554554

niworkflows/reports/core.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -384,7 +384,7 @@ def generate_report(self):
384384

385385
if (logs_path / 'CITATION.html').exists():
386386
text = (
387-
re.compile('<body>(.*?)</body>', re.DOTALL | re.IGNORECASE)
387+
re.compile(r'<body>(.*?)</body>', re.DOTALL | re.IGNORECASE)
388388
.findall((logs_path / 'CITATION.html').read_text())[0]
389389
.strip()
390390
)

niworkflows/utils/bids.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -388,7 +388,7 @@ def group_multiecho(bold_sess):
388388
def _grp_echos(x):
389389
if '_echo-' not in x:
390390
return x
391-
echo = re.search('_echo-\\d*', x).group(0)
391+
echo = re.search(r'_echo-\d*', x).group(0)
392392
return x.replace(echo, '_echo-?')
393393

394394
ses_uids = []

niworkflows/viz/utils.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -138,10 +138,10 @@ def extract_svg(display_object, dpi=300, compress='auto'):
138138
image_svg = svg2str(display_object, dpi)
139139
if compress is True or compress == 'auto':
140140
image_svg = svg_compress(image_svg, compress)
141-
image_svg = re.sub(' height="[0-9]+[a-z]*"', '', image_svg, count=1)
142-
image_svg = re.sub(' width="[0-9]+[a-z]*"', '', image_svg, count=1)
141+
image_svg = re.sub(r' height="[0-9]+[a-z]*"', '', image_svg, count=1)
142+
image_svg = re.sub(r' width="[0-9]+[a-z]*"', '', image_svg, count=1)
143143
image_svg = re.sub(
144-
' viewBox', ' preseveAspectRation="xMidYMid meet" viewBox', image_svg, count=1
144+
r' viewBox', ' preseveAspectRation="xMidYMid meet" viewBox', image_svg, count=1
145145
)
146146
start_tag = '<svg '
147147
start_idx = image_svg.find(start_tag)

0 commit comments

Comments
 (0)