Skip to content

Commit 711eb2b

Browse files
authored
Remove unused publisher creation functions (#13680)
1 parent 9c4902f commit 711eb2b

File tree

2 files changed

+1
-39
lines changed

2 files changed

+1
-39
lines changed

sphinx/io.py

Lines changed: 1 addition & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,7 @@
44

55
from typing import TYPE_CHECKING
66

7-
from docutils.core import Publisher
8-
from docutils.io import FileInput, NullOutput
7+
from docutils.io import FileInput
98
from docutils.readers import standalone
109
from docutils.transforms.references import DanglingReferences
1110
from docutils.writers import UnfilteredWriter
@@ -110,22 +109,3 @@ class SphinxFileInput(FileInput):
110109
def __init__(self, *args: Any, **kwargs: Any) -> None:
111110
kwargs['error_handler'] = 'sphinx'
112111
super().__init__(*args, **kwargs)
113-
114-
115-
def _create_publisher(
116-
*, env: BuildEnvironment, parser: Parser, transforms: list[type[Transform]]
117-
) -> Publisher:
118-
reader = SphinxStandaloneReader()
119-
reader._setup_transforms(transforms)
120-
pub = Publisher(
121-
reader=reader,
122-
parser=parser,
123-
writer=SphinxDummyWriter(),
124-
source_class=SphinxFileInput,
125-
destination=NullOutput(),
126-
)
127-
# Propagate exceptions by default when used programmatically:
128-
defaults = {'traceback': True, **env.settings}
129-
# Set default settings
130-
pub.get_settings(**defaults)
131-
return pub

sphinx/registry.py

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
from sphinx.domains.std import GenericObject, Target
1313
from sphinx.errors import ExtensionError, SphinxError, VersionRequirementError
1414
from sphinx.extension import Extension
15-
from sphinx.io import _create_publisher
1615
from sphinx.locale import __
1716
from sphinx.parsers import Parser as SphinxParser
1817
from sphinx.roles import XRefRole
@@ -26,7 +25,6 @@
2625
from typing import Any, TypeAlias
2726

2827
from docutils import nodes
29-
from docutils.core import Publisher
3028
from docutils.nodes import Element, Node, TextElement
3129
from docutils.parsers import Parser
3230
from docutils.parsers.rst import Directive
@@ -153,9 +151,6 @@ def __init__(self) -> None:
153151
#: additional transforms; list of transforms
154152
self.transforms: list[type[Transform]] = []
155153

156-
# private cache of Docutils Publishers (file type -> publisher object)
157-
self.publishers: dict[str, Publisher] = {}
158-
159154
@property
160155
def autodoc_attrgettrs(self) -> dict[type, Callable[[Any, str, Any], Any]]:
161156
return self.autodoc_attrgetters
@@ -596,19 +591,6 @@ def get_envversion(self, app: Sphinx) -> Mapping[str, int]:
596591

597592
return _get_env_version(app.extensions)
598593

599-
def _get_publisher(
600-
self, filetype: str, *, config: Config, env: BuildEnvironment
601-
) -> Publisher:
602-
try:
603-
return self.publishers[filetype]
604-
except KeyError:
605-
pass
606-
parser = self.create_source_parser(filetype, config=config, env=env)
607-
transforms = self.get_transforms()
608-
publisher = _create_publisher(env=env, parser=parser, transforms=transforms)
609-
self.publishers[filetype] = publisher
610-
return publisher
611-
612594

613595
def merge_source_suffix(app: Sphinx, config: Config) -> None:
614596
"""Merge any user-specified source_suffix with any added by extensions."""

0 commit comments

Comments
 (0)