Skip to content

Commit

Permalink
fix: bug in *toml* loader crashing with mixed arrays in config
Browse files Browse the repository at this point in the history
This happened, e.g., when trying to run MRIQC on datasets with both
single-echo and multi-echo runs or with filters where some array had
mixed types (e.g., `part: [null, 'mag']`).

Resolves: #1264.
  • Loading branch information
oesteban committed Apr 17, 2024
1 parent 09c32df commit aba40b8
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
5 changes: 4 additions & 1 deletion mriqc/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -665,7 +665,10 @@ def from_dict(sections):

def load(filename):
"""Load settings from file."""
from toml import loads
try:
from tomllib import loads
except ModuleNotFoundError: # Python < 3.11
from tomli import loads

filename = Path(filename)
sections = loads(filename.read_text())
Expand Down
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ dependencies = [
"statsmodels",
"templateflow",
"toml",
"tomli >= 1.1.0; python_version < '3.11'",
"torch >= 1.10.2",
]
description = "Automated Quality Control and visual reports for Quality Assessment of structural (T1w, T2w) and functional MRI of the brain."
Expand Down

0 comments on commit aba40b8

Please sign in to comment.