Docs: Avoid a DeprecationWarning in pyspecific.py when running with Sphinx >=6.1 (#105886)

Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>
This commit is contained in:
Alex Waygood 2023-06-23 08:58:45 +01:00 committed by GitHub
parent 6a80664ef1
commit a72683ba8e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -14,29 +14,27 @@ import io
from os import getenv, path from os import getenv, path
from time import asctime from time import asctime
from pprint import pformat from pprint import pformat
from docutils import nodes, utils
from docutils.io import StringOutput from docutils.io import StringOutput
from docutils.parsers.rst import Directive from docutils.parsers.rst import Directive
from docutils.utils import new_document from docutils.utils import new_document
from docutils import nodes, utils
from sphinx import addnodes from sphinx import addnodes
from sphinx.builders import Builder from sphinx.builders import Builder
try: from sphinx.domains.python import PyFunction, PyMethod
from sphinx.errors import NoUri from sphinx.errors import NoUri
except ImportError:
from sphinx.environment import NoUri
from sphinx.locale import _ as sphinx_gettext from sphinx.locale import _ as sphinx_gettext
from sphinx.util import status_iterator, logging from sphinx.util import logging
from sphinx.util.docutils import SphinxDirective from sphinx.util.docutils import SphinxDirective
from sphinx.util.nodes import split_explicit_title from sphinx.util.nodes import split_explicit_title
from sphinx.writers.text import TextWriter, TextTranslator from sphinx.writers.text import TextWriter, TextTranslator
try: try:
from sphinx.domains.python import PyFunction, PyMethod # Sphinx 6+
from sphinx.util.display import status_iterator
except ImportError: except ImportError:
from sphinx.domains.python import PyClassmember as PyMethod # Deprecated in Sphinx 6.1, will be removed in Sphinx 8
from sphinx.domains.python import PyModulelevel as PyFunction from sphinx.util import status_iterator
ISSUE_URI = 'https://bugs.python.org/issue?@action=redirect&bpo=%s' ISSUE_URI = 'https://bugs.python.org/issue?@action=redirect&bpo=%s'