Skip to content

Commit

Permalink
BF: Change in datalad could ignore custom rules
Browse files Browse the repository at this point in the history
A change in behavior of datalad's ConfigManager.get method, requires the
use of get_all parameter in order to get all configured values. Adaption
to that change missed this usage in dicom2spec as discovered in issue
psychoinformatics-degh-173.
  • Loading branch information
bpoldrack committed Mar 10, 2021
1 parent c87946d commit 03c568c
Showing 1 changed file with 15 additions and 6 deletions.
21 changes: 15 additions & 6 deletions datalad_hirni/commands/dicom2spec.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,21 @@ def __init__(self, dataset=None):
self._rule_set = []
# get a list of paths to build the rule set from
# Note: assure_list is supposed to return empty list if there's nothing
self._file_list = \
assure_list(cfg.get("datalad.hirni.dicom2spec.rules"))

try:
self._file_list = assure_list(
cfg.get("datalad.hirni.dicom2spec.rules", get_all=True)
)
except TypeError as e:
if "unexpected keyword argument 'get_all'" in str(e):
# Older datalad version should return multiple values w/o
# needing get_all:
self._file_list = assure_list(
cfg.get("datalad.hirni.dicom2spec.rules")
)
else:
raise

lgr.debug("loaded list of rule files: %s", self._file_list)

for file in self._file_list:
Expand Down Expand Up @@ -362,10 +375,6 @@ def __call__(path=None, spec=None, dataset=None, subject=None,
yield meta
continue





if 'dicom' not in meta['metadata']:

# TODO: Really "notneeded" or simply not a result at all?
Expand Down

0 comments on commit 03c568c

Please sign in to comment.