Skip to content

Commit 490612b

Browse files
committed
fix comments + fstrings
1 parent 31fd3c0 commit 490612b

File tree

2 files changed

+9
-7
lines changed

2 files changed

+9
-7
lines changed

dcm2bids/dcm2bids_gen.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ def run(self):
135135

136136
def move(self, acq, idList, post_op):
137137
"""Move an acquisition to BIDS format"""
138-
for srcFile in sorted(glob(acq.srcRoot + ".*"), reverse=True):
138+
for srcFile in sorted(glob(f"{acq.srcRoot}.*"), reverse=True):
139139
ext = Path(srcFile).suffixes
140140
ext = [curr_ext for curr_ext in ext if curr_ext in ['.nii', '.gz',
141141
'.json',
@@ -177,8 +177,10 @@ def move(self, acq, idList, post_op):
177177
acq.setExtraDstFile(curr_post_op["custom_entities"])
178178

179179
# Copy json file with this new set of custom entities.
180-
shutil.copy(str(srcFile).replace("".join(ext), ".json"),
181-
str(acq.extraDstFile) + ".json")
180+
shutil.copy(
181+
str(srcFile).replace("".join(ext), ".json"),
182+
f"{str(acq.extraDstFile)}.json",
183+
)
182184
cmd = cmd.replace('dst_file',
183185
str(acq.extraDstFile) + ''.join(ext))
184186
else:

dcm2bids/sidecar.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -188,8 +188,8 @@ def post_op(self, value):
188188
"Please check the documentation.")
189189

190190
if 'src_file' not in cmd_split or 'dst_file' not in cmd_split:
191-
raise ValueError("post_op cmd is not defined correctly."
192-
"src_file and/or dst_file is missing."
191+
raise ValueError("post_op cmd is not defined correctly. "
192+
"<src_file> and/or <dst_file> is missing. "
193193
"Please check the documentation.")
194194

195195
if isinstance(datatype, str):
@@ -208,14 +208,14 @@ def post_op(self, value):
208208
res = list(set([ele for ele in pairs if pairs.count(ele) > 1]))
209209
if res:
210210
raise ValueError("Some post operations apply on "
211-
"the same combination of datatype/suffix."
211+
"the same combination of datatype/suffix. "
212212
"Please fix post_op key in your config file."
213213
f"{pairs}")
214214

215215
self._post_op = post_op
216216

217217
except Exception:
218-
raise ValueError("post_op is not defined correctly."
218+
raise ValueError("post_op is not defined correctly. "
219219
"Please check the documentation.")
220220

221221
@property

0 commit comments

Comments
 (0)