Files
extra/python-sphinxcontrib-jsmath/001-fix-mypy-violations-2.patch
2025-06-22 20:39:04 -05:00

42 lines
1.6 KiB
Diff

From 631ef5fb4a52129895de47711f68bf3b663a51bb Mon Sep 17 00:00:00 2001
From: Takeshi KOMIYA <i.tkomiya@gmail.com>
Date: Mon, 13 Jan 2020 00:52:10 +0900
Subject: [PATCH] Fix mypy violations
---
setup.cfg | 1 +
sphinxcontrib/jsmath/__init__.py | 4 ++--
2 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/setup.cfg b/setup.cfg
index 821a6c9..2d93352 100644
--- a/setup.cfg
+++ b/setup.cfg
@@ -27,3 +27,4 @@ exclude = .git,.tox,.venv
[mypy]
ignore_missing_imports = True
+strict_optional = False
diff --git a/sphinxcontrib/jsmath/__init__.py b/sphinxcontrib/jsmath/__init__.py
index 1ce675d..2ffef84 100644
--- a/sphinxcontrib/jsmath/__init__.py
+++ b/sphinxcontrib/jsmath/__init__.py
@@ -65,7 +65,7 @@ def html_visit_displaymath(self: HTMLTranslator, node: nodes.math_block) -> None
def install_jsmath(app: Sphinx, env: BuildEnvironment) -> None:
if app.builder.format != 'html' or app.builder.math_renderer_name != 'jsmath': # type: ignore # NOQA
return
- if not app.config.jsmath_path:
+ if not app.config.jsmath_path: # type: ignore
raise ExtensionError('jsmath_path config value must be set for the '
'jsmath extension to work')
@@ -73,7 +73,7 @@ def install_jsmath(app: Sphinx, env: BuildEnvironment) -> None:
domain = cast(MathDomain, env.get_domain('math'))
if domain.has_equations():
# Enable jsmath only if equations exists
- builder.add_js_file(app.config.jsmath_path)
+ builder.add_js_file(app.config.jsmath_path) # type: ignore
def setup(app: Sphinx) -> Dict[str, Any]: