mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
ext.duration: Fix `merge_domaindata()
` (#12251)
Co-authored-by: Adam Turner <9087854+aa-turner@users.noreply.github.com>
This commit is contained in:
parent
04b229fe4d
commit
d7efb295f1
@ -27,6 +27,8 @@ Bugs fixed
|
|||||||
Patch by Donald Hunter.
|
Patch by Donald Hunter.
|
||||||
* #12320: Fix removal of anchors from search summaries (regression in 7.3.0).
|
* #12320: Fix removal of anchors from search summaries (regression in 7.3.0).
|
||||||
Patch by Will Lachance.
|
Patch by Will Lachance.
|
||||||
|
* #12251: Fix ``merge_domaindata()`` in ``sphinx.ext.duration``.
|
||||||
|
Patch by Matthias Geier.
|
||||||
|
|
||||||
Testing
|
Testing
|
||||||
-------
|
-------
|
||||||
|
@ -13,10 +13,15 @@ from sphinx.locale import __
|
|||||||
from sphinx.util import logging
|
from sphinx.util import logging
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
|
from typing import TypedDict
|
||||||
|
|
||||||
from docutils import nodes
|
from docutils import nodes
|
||||||
|
|
||||||
from sphinx.application import Sphinx
|
from sphinx.application import Sphinx
|
||||||
|
|
||||||
|
class _DurationDomainData(TypedDict):
|
||||||
|
reading_durations: dict[str, float]
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
@ -38,9 +43,11 @@ class DurationDomain(Domain):
|
|||||||
def clear_doc(self, docname: str) -> None:
|
def clear_doc(self, docname: str) -> None:
|
||||||
self.reading_durations.pop(docname, None)
|
self.reading_durations.pop(docname, None)
|
||||||
|
|
||||||
def merge_domaindata(self, docnames: list[str], otherdata: dict[str, float]) -> None:
|
def merge_domaindata(self, docnames: list[str], otherdata: _DurationDomainData) -> None: # type: ignore[override]
|
||||||
for docname, duration in otherdata.items():
|
other_reading_durations = otherdata.get('reading_durations', {})
|
||||||
if docname in docnames:
|
docnames_set = frozenset(docnames)
|
||||||
|
for docname, duration in other_reading_durations.items():
|
||||||
|
if docname in docnames_set:
|
||||||
self.reading_durations[docname] = duration
|
self.reading_durations[docname] = duration
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user