summaryrefslogtreecommitdiff
path: root/sphinx/domains/math.py
diff options
context:
space:
mode:
Diffstat (limited to 'sphinx/domains/math.py')
-rw-r--r--sphinx/domains/math.py29
1 files changed, 4 insertions, 25 deletions
diff --git a/sphinx/domains/math.py b/sphinx/domains/math.py
index 248a7a2a6..88db1ad0e 100644
--- a/sphinx/domains/math.py
+++ b/sphinx/domains/math.py
@@ -8,14 +8,12 @@
:license: BSD, see LICENSE for details.
"""
-import warnings
-from typing import Any, Dict, Iterable, List, Tuple
+from typing import TYPE_CHECKING, Any, Dict, Iterable, List, Tuple
from docutils import nodes
from docutils.nodes import Element, Node, make_id, system_message
from sphinx.addnodes import pending_xref
-from sphinx.deprecation import RemovedInSphinx40Warning
from sphinx.domains import Domain
from sphinx.environment import BuildEnvironment
from sphinx.locale import __
@@ -23,8 +21,7 @@ from sphinx.roles import XRefRole
from sphinx.util import logging
from sphinx.util.nodes import make_refnode
-if False:
- # For type annotation
+if TYPE_CHECKING:
from sphinx.application import Sphinx
from sphinx.builders import Builder
@@ -44,10 +41,10 @@ class MathDomain(Domain):
name = 'math'
label = 'mathematics'
- initial_data = {
+ initial_data: Dict = {
'objects': {}, # labelid -> (docname, eqno)
'has_equations': {}, # docname -> bool
- } # type: Dict
+ }
dangling_warnings = {
'eq': 'equation not found: %(target)s',
}
@@ -139,24 +136,6 @@ class MathDomain(Domain):
def get_objects(self) -> List:
return []
- def add_equation(self, env: BuildEnvironment, docname: str, labelid: str) -> int:
- warnings.warn('MathDomain.add_equation() is deprecated.',
- RemovedInSphinx40Warning, stacklevel=2)
- if labelid in self.equations:
- path = env.doc2path(self.equations[labelid][0])
- msg = __('duplicate label of equation %s, other instance in %s') % (labelid, path)
- raise UserWarning(msg)
- else:
- eqno = self.get_next_equation_number(docname)
- self.equations[labelid] = (docname, eqno)
- return eqno
-
- def get_next_equation_number(self, docname: str) -> int:
- warnings.warn('MathDomain.get_next_equation_number() is deprecated.',
- RemovedInSphinx40Warning, stacklevel=2)
- targets = [eq for eq in self.equations.values() if eq[0] == docname]
- return len(targets) + 1
-
def has_equations(self, docname: str = None) -> bool:
if docname:
return self.data['has_equations'].get(docname, False)