MCPcopy
hub / github.com/mne-tools/mne-python / reset_warnings

Function reset_warnings

doc/sphinxext/mne_doc_utils.py:32–120  ·  view source on GitHub ↗

Ensure we are future compatible and ignore silly warnings.

(gallery_conf, fname)

Source from the content-addressed store, hash-verified

30
31
32def reset_warnings(gallery_conf, fname):
33 """Ensure we are future compatible and ignore silly warnings."""
34 # In principle, our examples should produce no warnings.
35 # Here we cause warnings to become errors, with a few exceptions.
36 # This list should be considered alongside
37 # setup.cfg -> [tool:pytest] -> filterwarnings
38
39 # remove tweaks from other module imports or example runs
40 warnings.resetwarnings()
41 # restrict
42 warnings.filterwarnings("error")
43 # allow these, but show them
44 warnings.filterwarnings("always", '.*non-standard config type: "foo".*')
45 warnings.filterwarnings("always", '.*config type: "MNEE_USE_CUUDAA".*')
46 warnings.filterwarnings("always", ".*cannot make axes width small.*")
47 warnings.filterwarnings("always", ".*Axes that are not compatible.*")
48 warnings.filterwarnings("always", ".*FastICA did not converge.*")
49 # ECoG BIDS spec violations:
50 warnings.filterwarnings("always", ".*Fiducial point nasion not found.*")
51 warnings.filterwarnings("always", ".*DigMontage is only a subset of.*")
52 warnings.filterwarnings( # xhemi morph (should probably update sample)
53 "always", ".*does not exist, creating it and saving it.*"
54 )
55 # internal warnings
56 warnings.filterwarnings("default", module="sphinx")
57 # don't error on joblib warning during parallel doc build otherwise we get a
58 # cryptic deadlock instead of a nice traceback
59 warnings.filterwarnings(
60 "always",
61 "A worker stopped while some jobs were given to the executor.*",
62 category=UserWarning,
63 )
64 # ignore (DeprecationWarning)
65 for key in (
66 # nibabel
67 "__array__ implementation doesn't accept.*",
68 # pybtex (from sphinxcontrib-bibtex)
69 "pkg_resources is deprecated as an API.*",
70 "\nImplementing implicit namespace packages",
71 # latexcodec
72 r"open_text is deprecated\. Use files",
73 # dipy etc.
74 "The `disp` and `iprint` options of the L-BFGS-B solver",
75 # statsmodels<->pandas
76 "Substitution is deprecated and will be removed",
77 ):
78 warnings.filterwarnings( # deal with other modules having bad imports
79 "ignore", message=f".*{key}.*", category=DeprecationWarning
80 )
81 # ignore (PendingDeprecationWarning)
82 for key in (
83 # sphinx
84 "The mapping interface for autodoc options",
85 # sphinxcontrib-bibtex
86 "sphinx.environment.BuildEnvironment.app' is deprecated",
87 ):
88 warnings.filterwarnings( # deal with other modules having bad imports
89 "ignore", message=f".*{key}.*", category=PendingDeprecationWarning

Callers 2

conf.pyFile · 0.90
reset_modulesFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected