Skip to content

Commit 48c9bd1

Browse files
STY: Fix ruff style violations in doc/conf.py
- Move misplaced imports (pathlib, shutil, re) to the top import block - Replace pathlib.Path with already-imported Path alias - Break two string literals that exceeded the 88-char line limit (E501) at lines 609 and 626
1 parent d37a294 commit 48c9bd1

1 file changed

Lines changed: 8 additions & 9 deletions

File tree

doc/conf.py

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111

1212
import faulthandler
1313
import os
14+
import re
15+
import shutil
1416
import subprocess
1517
import sys
1618
from datetime import datetime, timezone
@@ -477,13 +479,10 @@
477479
jupyterlite_contents = ["jupyterlite_contents"]
478480
jupyterlite_bind_ipynb_suffix = False
479481

480-
import pathlib
481-
import shutil
482-
483482
# Automatically inject the required subset of MNE-sample-data into JupyterLite
484-
src_sample_data = pathlib.Path(os.path.expanduser("~/mne_data/MNE-sample-data"))
483+
src_sample_data = Path(os.path.expanduser("~/mne_data/MNE-sample-data"))
485484
dst_sample_data = (
486-
pathlib.Path(os.path.abspath(os.path.dirname(__file__)))
485+
Path(os.path.abspath(os.path.dirname(__file__)))
487486
/ "jupyterlite_contents"
488487
/ "mne_data"
489488
/ "MNE-sample-data"
@@ -521,8 +520,6 @@
521520
with open(pyproject_path, encoding="utf-8") as f:
522521
orig_pyproject = f.read()
523522

524-
import re
525-
526523
# Relax constraints for Pyodide which often lags behind PyPI
527524
patched = re.sub(r'"scipy\s*>=\s*1\.13"', '"scipy >= 1.11"', orig_pyproject)
528525
patched = re.sub(r'"matplotlib\s*>=\s*3\.9"', '"matplotlib >= 3.5"', patched)
@@ -606,7 +603,8 @@
606603
"def pyodide_pooch_fetch(self, fname, processor=None, downloader=None):\n"
607604
" url = self.get_url(fname)\n"
608605
" if 'osf.io' in url or 'files.osf.io' in url:\n"
609-
" print(f'Bypassing OSF download for {fname}. Using injected local cache.')\n"
606+
" print(f'Bypassing OSF download for"
607+
" {fname}. Using injected local cache.')\n"
610608
" return orig_pooch_fetch(\n"
611609
" self, fname, processor=processor, downloader=downloader\n"
612610
" )\n"
@@ -623,7 +621,8 @@
623621
" print('Corrupted MNE config deleted automatically.')\n"
624622
" except Exception:\n"
625623
" pass\n"
626-
"for ds in ['SAMPLE', 'TESTING', 'SSVEP', 'EEGBCI', 'SOMATO', 'AUDIOVISUAL', 'BRAINSTORM']:\n"
624+
"for ds in ['SAMPLE', 'TESTING', 'SSVEP',"
625+
" 'EEGBCI', 'SOMATO', 'AUDIOVISUAL', 'BRAINSTORM']:\n"
627626
" mne.set_config(f'MNE_DATASETS_{ds}_PATH', '/drive/mne_data')\n"
628627
"import IPython\n"
629628
"IPython.get_ipython().run_line_magic('matplotlib', 'inline')\n"

0 commit comments

Comments
 (0)