Skip to content

Commit b2ec1d5

Browse files
committed
Remove empty metadata keys, adressing bids-validator errors/warnings (GitHub issue #269)
1 parent 585949f commit b2ec1d5

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

bidscoin/bids.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2086,9 +2086,10 @@ def poolmetadata(datasource: DataSource, targetmeta: Path, usermeta: Meta, metae
20862086
elif isinstance(metapool[key], list):
20872087
metapool[key] = [item.replace('<<session', f"<<ses{ses}") for item in metapool[key]]
20882088

2089-
# Remove unused (but added from the template) B0FieldIdentifiers/Sources
2090-
if not metapool.get(key):
2091-
metapool.pop(key, None)
2089+
# Remove unused keys, such as B0FieldIdentifiers/Sources (added from the template)
2090+
for metakey, metaval in metapool.items():
2091+
if not metaval and metaval != 0:
2092+
metapool.pop(metakey, None)
20922093

20932094
return Meta(metapool)
20942095

0 commit comments

Comments
 (0)