Skip to content

Commit a826ccd

Browse files
STY: Apply ruff/flake8-comprehensions rule C416
C416 Unnecessary `dict` comprehension (rewrite using `dict()`)
1 parent 9e007ec commit a826ccd

File tree

2 files changed

+2
-4
lines changed

2 files changed

+2
-4
lines changed

nibabel/brikhead.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ def parse_AFNI_header(fobj):
198198
return parse_AFNI_header(src)
199199
# unpack variables in HEAD file
200200
head = fobj.read().split('\n\n')
201-
return {key: value for key, value in map(_unpack_var, head)}
201+
return dict(map(_unpack_var, head))
202202

203203

204204
class AFNIArrayProxy(ArrayProxy):

nibabel/nicom/dicomwrappers.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -685,9 +685,7 @@ def __init__(self, dcm_data, frame_filters=None):
685685
frame_slc_pos = [np.inner(ipp, self.slice_normal) for ipp in frame_ipps]
686686
rnd_slc_pos = np.round(frame_slc_pos, 4)
687687
uniq_slc_pos = np.unique(rnd_slc_pos)
688-
pos_ord_map = {
689-
val: order for val, order in zip(uniq_slc_pos, np.argsort(uniq_slc_pos))
690-
}
688+
pos_ord_map = dict(zip(uniq_slc_pos, np.argsort(uniq_slc_pos)))
691689
self._frame_slc_ord = [pos_ord_map[pos] for pos in rnd_slc_pos]
692690
if len(self._frame_slc_ord) > 1:
693691
self._slice_spacing = (

0 commit comments

Comments
 (0)