Skip to content

Commit c4928a6

Browse files
committed
nest JSON loading so it isn't attempted on import
1 parent 19cb886 commit c4928a6

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

mne_bids/utils.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -520,10 +520,6 @@ def _import_nibabel(why="work with MRI data"):
520520

521521

522522
# better example sorting, without relying on numbers in example titles
523-
with open(Path(__file__).parents[1] / "doc" / "example_order.json") as fid:
524-
EXAMPLE_ORDER = json.load(fid)
525-
526-
527523
def _example_sorter(filename):
528524
"""Sort for MNE-BIDS example filenames in a custom order.
529525
@@ -532,6 +528,9 @@ def _example_sorter(filename):
532528
to work correctly in Sphinx Gallery / maintain serializability of the sphinx gallery
533529
config dict in `conf.py`.
534530
"""
531+
with open(Path(__file__).parents[1] / "doc" / "example_order.json") as fid:
532+
EXAMPLE_ORDER = json.load(fid)
533+
535534
if filename not in EXAMPLE_ORDER:
536535
EXAMPLE_ORDER.append(filename)
537536
return EXAMPLE_ORDER.index(filename)

0 commit comments

Comments
 (0)