Skip to content

Commit

Permalink
Merge pull request #1239 from nipreps/fix/config-save
Browse files Browse the repository at this point in the history
FIX: Avert costly ``BIDSLayout.__repr__`` calls when saving config
  • Loading branch information
oesteban committed Apr 7, 2024
2 parents baf56bb + cb3b2b4 commit 5af71a0
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion mriqc/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -431,7 +431,6 @@ class execution(_Config):
'bids_database_dir',
'fs_license_file',
'fs_subjects_dir',
'layout',
'log_dir',
'output_dir',
'templateflow_home',
Expand Down Expand Up @@ -511,6 +510,11 @@ def init(cls):
indexer=_indexer,
)

# Rewrite __repr__ to avoid the layout query and build the summary
# For a smallish dataset this takes one minute each time.
# See https://github.com/nipreps/mriqc/issues/1239
cls._layout.__class__.__repr__ = lambda x: f'BIDS Layout: {cls.bids_dir}'

cls.layout = cls._layout


Expand Down

0 comments on commit 5af71a0

Please sign in to comment.