Skip to content

Commit e0e4697

Browse files
larsonersseth
authored andcommitted
FIX: Sphinx (mne-tools#13600)
1 parent f38d7cc commit e0e4697

2 files changed

Lines changed: 28 additions & 2 deletions

File tree

doc/sphinxext/gh_substitutions.py

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,24 @@
22
# License: BSD-3-Clause
33
# Copyright the MNE-Python contributors.
44

5+
import docutils
56
from docutils.nodes import reference
6-
from docutils.parsers.rst.roles import set_classes
7+
8+
# Adapted from sphinx
9+
if docutils.__version_info__[:2] < (0, 22):
10+
from docutils.parsers.rst import roles
11+
12+
def _normalize_options(options):
13+
if options is None:
14+
return {}
15+
n_options = options.copy()
16+
roles.set_classes(n_options)
17+
return n_options
18+
19+
else:
20+
from docutils.parsers.rst.roles import (
21+
normalize_options as _normalize_options,
22+
)
723

824

925
def gh_role(name, rawtext, text, lineno, inliner, options={}, content=[]): # noqa: B006
@@ -22,7 +38,7 @@ def gh_role(name, rawtext, text, lineno, inliner, options={}, content=[]): # no
2238
slug = "issues/" + text
2339
text = "#" + text
2440
ref = "https://github.com/mne-tools/mne-python/" + slug
25-
set_classes(options)
41+
options = _normalize_options(options)
2642
node = reference(rawtext, text, refuri=ref, **options)
2743
return [node], []
2844

doc/sphinxext/mne_doc_utils.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,16 @@ def reset_warnings(gallery_conf, fname):
7676
warnings.filterwarnings( # deal with other modules having bad imports
7777
"ignore", message=f".*{key}.*", category=DeprecationWarning
7878
)
79+
# ignore (PendingDeprecationWarning)
80+
for key in (
81+
# sphinx
82+
"The mapping interface for autodoc options",
83+
# sphinxcontrib-bibtex
84+
"sphinx.environment.BuildEnvironment.app' is deprecated",
85+
):
86+
warnings.filterwarnings( # deal with other modules having bad imports
87+
"ignore", message=f".*{key}.*", category=PendingDeprecationWarning
88+
)
7989
# ignore (UserWarning)
8090
for message in (
8191
# Matplotlib

0 commit comments

Comments
 (0)