Skip to content

Commit

Permalink
Merge branch 'master' into issue-11317/linkcheck-close-streamed-http-…
Browse files Browse the repository at this point in the history
…connections
  • Loading branch information
jayaddison committed May 3, 2023
2 parents 69a6828 + 262e1d9 commit 30db055
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 116 deletions.
3 changes: 3 additions & 0 deletions CHANGES
Expand Up @@ -17,6 +17,9 @@ Incompatible changes
* #11365: Remove support for the ``jsdump`` format in ``sphinx.search``.
* #11366: Make ``locale`` a required argument to
``sphinx.util.i18n.format_date()``.
* #11370: Remove deprecated ``sphinx.util.stemmer`` module.
* #11371: Remove deprecated ``sphinx.pycode.ast.parse()`` function.
* #11372: Remove deprecated ``sphinx.io.read_doc()`` function.

Deprecated
----------
Expand Down
38 changes: 1 addition & 37 deletions sphinx/io.py
@@ -1,8 +1,6 @@
"""Input/Output files"""
from __future__ import annotations

import codecs
import warnings
from typing import TYPE_CHECKING, Any

import docutils
Expand All @@ -11,14 +9,12 @@
from docutils.frontend import Values
from docutils.io import FileInput, Input, NullOutput
from docutils.parsers import Parser
from docutils.parsers.rst import Parser as RSTParser
from docutils.readers import standalone
from docutils.transforms import Transform
from docutils.transforms.references import DanglingReferences
from docutils.writers import UnfilteredWriter

from sphinx import addnodes
from sphinx.deprecation import RemovedInSphinx70Warning
from sphinx.environment import BuildEnvironment
from sphinx.transforms import AutoIndexUpgrader, DoctreeReadEvent, SphinxTransformer
from sphinx.transforms.i18n import (
Expand All @@ -27,7 +23,7 @@
RemoveTranslatableInline,
)
from sphinx.transforms.references import SphinxDomains
from sphinx.util import UnicodeDecodeErrorHandler, get_filetype, logging
from sphinx.util import logging
from sphinx.util.docutils import LoggingReporter
from sphinx.versioning import UIDTransform

Expand Down Expand Up @@ -160,38 +156,6 @@ def __init__(self, *args: Any, **kwargs: Any) -> None:
super().__init__(*args, **kwargs)


def read_doc(app: Sphinx, env: BuildEnvironment, filename: str) -> nodes.document:
"""Parse a document and convert to doctree."""
warnings.warn('sphinx.io.read_doc() is deprecated.',
RemovedInSphinx70Warning, stacklevel=2)

# set up error_handler for the target document
error_handler = UnicodeDecodeErrorHandler(env.docname)
codecs.register_error('sphinx', error_handler) # type: ignore

reader = SphinxStandaloneReader()
reader.setup(app)
filetype = get_filetype(app.config.source_suffix, filename)
parser = app.registry.create_source_parser(app, filetype)
if parser.__class__.__name__ == 'CommonMarkParser' and parser.settings_spec == ():
# a workaround for recommonmark
# If recommonmark.AutoStrictify is enabled, the parser invokes reST parser
# internally. But recommonmark-0.4.0 does not provide settings_spec for reST
# parser. As a workaround, this copies settings_spec for RSTParser to the
# CommonMarkParser.
parser.settings_spec = RSTParser.settings_spec

pub = Publisher(reader=reader,
parser=parser,
writer=SphinxDummyWriter(),
source_class=SphinxFileInput,
destination=NullOutput())
pub.process_programmatic_settings(None, env.settings, None) # type: ignore[arg-type]
pub.set_source(source_path=filename)
pub.publish()
return pub.document


def create_publisher(app: Sphinx, filetype: str) -> Publisher:
reader = SphinxStandaloneReader()
reader.setup(app)
Expand Down
17 changes: 0 additions & 17 deletions sphinx/pycode/ast.py
Expand Up @@ -3,11 +3,8 @@
from __future__ import annotations

import ast
import warnings
from typing import overload

from sphinx.deprecation import RemovedInSphinx70Warning

OPERATORS: dict[type[ast.AST], str] = {
ast.Add: "+",
ast.And: "and",
Expand All @@ -31,20 +28,6 @@
}


def parse(code: str, mode: str = 'exec') -> ast.AST:
"""Parse the *code* using the built-in ast module."""
warnings.warn(
"'sphinx.pycode.ast.parse' is deprecated, use 'ast.parse' instead.",
RemovedInSphinx70Warning, stacklevel=2,
)
try:
return ast.parse(code, mode=mode, type_comments=True)
except SyntaxError:
# Some syntax error found. To ignore invalid type comments, retry parsing without
# type_comments parameter (refs: https://github.com/sphinx-doc/sphinx/issues/8652).
return ast.parse(code, mode=mode)


@overload
def unparse(node: None, code: str = '') -> None:
...
Expand Down
62 changes: 0 additions & 62 deletions sphinx/util/stemmer/__init__.py

This file was deleted.

0 comments on commit 30db055

Please sign in to comment.