Skip to content

Commit

Permalink
STY: Apply ruff/flake8-comprehensions rule C416
Browse files Browse the repository at this point in the history
C416 Unnecessary `dict` comprehension (rewrite using `dict()`)
  • Loading branch information
DimitriPapadopoulos committed Sep 22, 2024
1 parent af40039 commit f9eba7b
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
2 changes: 1 addition & 1 deletion nibabel/brikhead.py
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ def parse_AFNI_header(fobj):
return parse_AFNI_header(src)
# unpack variables in HEAD file
head = fobj.read().split('\n\n')
return {key: value for key, value in map(_unpack_var, head)}
return dict(map(_unpack_var, head))


class AFNIArrayProxy(ArrayProxy):
Expand Down
4 changes: 1 addition & 3 deletions nibabel/nicom/dicomwrappers.py
Original file line number Diff line number Diff line change
Expand Up @@ -685,9 +685,7 @@ def __init__(self, dcm_data, frame_filters=None):
frame_slc_pos = [np.inner(ipp, self.slice_normal) for ipp in frame_ipps]
rnd_slc_pos = np.round(frame_slc_pos, 4)
uniq_slc_pos = np.unique(rnd_slc_pos)
pos_ord_map = {
val: order for val, order in zip(uniq_slc_pos, np.argsort(uniq_slc_pos))
}
pos_ord_map = dict(zip(uniq_slc_pos, np.argsort(uniq_slc_pos)))
self._frame_slc_ord = [pos_ord_map[pos] for pos in rnd_slc_pos]
if len(self._frame_slc_ord) > 1:
self._slice_spacing = (
Expand Down

0 comments on commit f9eba7b

Please sign in to comment.