Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Backport PR #30858 on branch v3.10.x (DOC: reinstate "codex" search term)#30860

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
Show file tree
Hide file tree
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 1 addition & 28 deletionsdoc/conf.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -200,8 +200,6 @@ def _check_dependencies():
else:
sg_matplotlib_animations = True

# The following import is only necessary to monkey patch the signature later on
from sphinx_gallery import gen_rst

# Prevent plt.show() from emitting a non-GUI backend warning.
warnings.filterwarnings('ignore', category=UserWarning,
Expand DownExpand Up@@ -299,7 +297,7 @@ def autodoc_process_bases(app, name, obj, options, bases):
'reference_url': {'matplotlib': None, 'mpl_toolkits': None},
'prefer_full_module': {r'mpl_toolkits\.'},
'remove_config_comments': True,
'reset_modules': ('matplotlib', clear_basic_units),
'reset_modules': ('matplotlib', clear_basic_units, 'sphinxext.util.patch_header'),
'subsection_order': gallery_order_sectionorder,
'thumbnail_size': (320, 224),
'within_subsection_order': gallery_order_subsectionorder,
Expand DownExpand Up@@ -347,31 +345,6 @@ def gallery_image_warning_filter(record):
mathmpl_fontsize = 11.0
mathmpl_srcset = ['2x']

# Monkey-patching gallery header to include search keywords
gen_rst.EXAMPLE_HEADER = """
.. DO NOT EDIT.
.. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY.
.. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE:
.. "{0}"
.. LINE NUMBERS ARE GIVEN BELOW.

.. only:: html

.. meta::
:keywords: codex

.. note::
:class: sphx-glr-download-link-note

:ref:`Go to the end <sphx_glr_download_{1}>`
to download the full example code{2}

.. rst-class:: sphx-glr-example-title

.. _sphx_glr_{1}:

"""

# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']

Expand Down
32 changes: 32 additions & 0 deletionsdoc/sphinxext/util.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
import sys

from sphinx_gallery import gen_rst


def matplotlib_reduced_latex_scraper(block, block_vars, gallery_conf,
**kwargs):
Expand All@@ -19,3 +21,33 @@ def matplotlib_reduced_latex_scraper(block, block_vars, gallery_conf,
# Clear basic_units module to re-register with unit registry on import.
def clear_basic_units(gallery_conf, fname):
return sys.modules.pop('basic_units', None)


# Monkey-patching gallery header to include search keywords
EXAMPLE_HEADER = """
.. DO NOT EDIT.
.. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY.
.. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE:
.. "{0}"
.. LINE NUMBERS ARE GIVEN BELOW.

.. only:: html

.. meta::
:keywords: codex

.. note::
:class: sphx-glr-download-link-note

:ref:`Go to the end <sphx_glr_download_{1}>`
to download the full example code{2}

.. rst-class:: sphx-glr-example-title

.. _sphx_glr_{1}:

"""


def patch_header(gallery_conf, fname):
gen_rst.EXAMPLE_HEADER = EXAMPLE_HEADER
2 changes: 1 addition & 1 deletionlib/matplotlib/tests/test_doc.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -7,7 +7,7 @@ def test_sphinx_gallery_example_header():
This test monitors that the version we have copied is still the same as
the EXAMPLE_HEADER in sphinx-gallery. If sphinx-gallery changes its
EXAMPLE_HEADER, this test will start to fail. In that case, please update
the monkey-patching of EXAMPLE_HEADER inconf.py.
the monkey-patching of EXAMPLE_HEADER insphinxext/util.py.
"""
pytest.importorskip('sphinx_gallery',minversion='0.20.0')
fromsphinx_galleryimportgen_rst
Expand Down
Loading

[8]ページ先頭

©2009-2025 Movatter.jp