Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove more deprecated items in Sphinx 6.0 #10562

Merged
merged 6 commits into from Jun 26, 2022
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
18 changes: 0 additions & 18 deletions doc/templating.rst
Expand Up @@ -273,15 +273,6 @@ in the future.
that handles navigation, not the web browser, such as for HTML help or Qt
help formats. In this case, the sidebar is not included.

.. data:: favicon

The path to the HTML favicon in the static path, or URL to the favicon, or
``''``.

.. deprecated:: 4.0

Recommend to use ``favicon_url`` instead.

.. data:: favicon_url

The relative path to the HTML favicon image from the current document, or
Expand All @@ -308,15 +299,6 @@ in the future.

The build date.

.. data:: logo

The path to the HTML logo image in the static path, or URL to the logo, or
``''``.

.. deprecated:: 4.0

Recommend to use ``logo_url`` instead.

.. data:: logo_url

The relative path to the HTML logo image from the current document, or URL
Expand Down
11 changes: 0 additions & 11 deletions doc/usage/restructuredtext/domains.rst
Expand Up @@ -427,17 +427,6 @@ The following directives are provided for module and class contents:
Describe the location where the object is defined. The default value is
the module specified by :rst:dir:`py:currentmodule`.

.. rst:directive:option:: property
:type: no value

Indicate the method is a property.

.. versionadded:: 2.1

.. deprecated:: 4.0

Use :rst:dir:`py:property` instead.

.. rst:directive:option:: staticmethod
:type: no value

Expand Down
12 changes: 4 additions & 8 deletions sphinx/builders/html/__init__.py
Expand Up @@ -536,8 +536,8 @@ def prepare_writing(self, docnames: Set[str]) -> None:
'rellinks': rellinks,
'builder': self.name,
'parents': [],
'logo': logo,
'favicon': favicon,
'logo_url': logo,
'favicon_url': favicon,
'html5_doctype': not self.config.html4_writer,
}
if self.theme:
Expand Down Expand Up @@ -1215,18 +1215,14 @@ def setup_resource_paths(app: Sphinx, pagename: str, templatename: str,
pathto = context.get('pathto')

# favicon_url
favicon = context.get('favicon')
favicon = context.get('favicon_url')
if favicon and not isurl(favicon):
context['favicon_url'] = pathto('_static/' + favicon, resource=True)
AA-Turner marked this conversation as resolved.
Show resolved Hide resolved
else:
context['favicon_url'] = favicon

# logo_url
logo = context.get('logo')
logo = context.get('logo_url')
if logo and not isurl(logo):
context['logo_url'] = pathto('_static/' + logo, resource=True)
AA-Turner marked this conversation as resolved.
Show resolved Hide resolved
else:
context['logo_url'] = logo


def validate_math_renderer(app: Sphinx) -> None:
Expand Down
11 changes: 1 addition & 10 deletions sphinx/domains/python.py
Expand Up @@ -764,15 +764,11 @@ class PyMethod(PyObject):
'async': directives.flag,
'classmethod': directives.flag,
'final': directives.flag,
'property': directives.flag,
'staticmethod': directives.flag,
})

def needs_arglist(self) -> bool:
if 'property' in self.options:
return False
else:
return True
return True

def get_signature_prefix(self, sig: str) -> List[nodes.Node]:
prefix: List[nodes.Node] = []
Expand All @@ -788,9 +784,6 @@ def get_signature_prefix(self, sig: str) -> List[nodes.Node]:
if 'classmethod' in self.options:
prefix.append(nodes.Text('classmethod'))
prefix.append(addnodes.desc_sig_space())
if 'property' in self.options:
AA-Turner marked this conversation as resolved.
Show resolved Hide resolved
prefix.append(nodes.Text('property'))
prefix.append(addnodes.desc_sig_space())
if 'staticmethod' in self.options:
prefix.append(nodes.Text('static'))
prefix.append(addnodes.desc_sig_space())
Expand All @@ -810,8 +803,6 @@ def get_index_text(self, modname: str, name_cls: Tuple[str, str]) -> str:

if 'classmethod' in self.options:
return _('%s() (%s class method)') % (methname, clsname)
elif 'property' in self.options:
return _('%s (%s property)') % (methname, clsname)
elif 'staticmethod' in self.options:
return _('%s() (%s static method)') % (methname, clsname)
else:
Expand Down
19 changes: 0 additions & 19 deletions sphinx/util/compat.py
@@ -1,31 +1,12 @@
"""modules for backward compatibility"""

import sys
from typing import TYPE_CHECKING, Any, Dict

if TYPE_CHECKING:
from sphinx.application import Sphinx


def register_application_for_autosummary(app: "Sphinx") -> None:
"""Register application object to autosummary module.

Since Sphinx-1.7, documenters and attrgetters are registered into
application object. As a result, the arguments of
``get_documenter()`` has been changed. To keep compatibility,
this handler registers application object to the module.
"""
if 'sphinx.ext.autosummary' in sys.modules:
from sphinx.ext import autosummary
if hasattr(autosummary, '_objects'):
autosummary._objects['_app'] = app # type: ignore
else:
autosummary._app = app # type: ignore


def setup(app: "Sphinx") -> Dict[str, Any]:
app.connect('builder-inited', register_application_for_autosummary, priority=100)
AA-Turner marked this conversation as resolved.
Show resolved Hide resolved

return {
'version': 'builtin',
'parallel_read_safe': True,
Expand Down
31 changes: 9 additions & 22 deletions tests/test_domain_py.py
Expand Up @@ -704,10 +704,8 @@ def test_pymethod_options(app):
" .. py:method:: meth4\n"
" :async:\n"
" .. py:method:: meth5\n"
" :property:\n"
" .. py:method:: meth6\n"
" :abstractmethod:\n"
" .. py:method:: meth7\n"
" .. py:method:: meth6\n"
" :final:\n")
domain = app.env.get_domain('py')
doctree = restructuredtext.parse(app, text)
Expand All @@ -725,8 +723,6 @@ def test_pymethod_options(app):
addnodes.index,
desc,
addnodes.index,
desc,
addnodes.index,
desc)])]))

# method
Expand Down Expand Up @@ -768,35 +764,26 @@ def test_pymethod_options(app):
assert 'Class.meth4' in domain.objects
assert domain.objects['Class.meth4'] == ('index', 'Class.meth4', 'method', False)

# :property:
# :abstractmethod:
assert_node(doctree[1][1][8], addnodes.index,
entries=[('single', 'meth5 (Class property)', 'Class.meth5', '', None)])
assert_node(doctree[1][1][9], ([desc_signature, ([desc_annotation, ("property", desc_sig_space)],
[desc_name, "meth5"])],
[desc_content, ()]))
entries=[('single', 'meth5() (Class method)', 'Class.meth5', '', None)])
assert_node(doctree[1][1][9], ([desc_signature, ([desc_annotation, ("abstract", desc_sig_space)],
[desc_name, "meth5"],
[desc_parameterlist, ()])],
[desc_content, ()]))
assert 'Class.meth5' in domain.objects
assert domain.objects['Class.meth5'] == ('index', 'Class.meth5', 'method', False)

# :abstractmethod:
# :final:
assert_node(doctree[1][1][10], addnodes.index,
entries=[('single', 'meth6() (Class method)', 'Class.meth6', '', None)])
assert_node(doctree[1][1][11], ([desc_signature, ([desc_annotation, ("abstract", desc_sig_space)],
assert_node(doctree[1][1][11], ([desc_signature, ([desc_annotation, ("final", desc_sig_space)],
[desc_name, "meth6"],
[desc_parameterlist, ()])],
[desc_content, ()]))
assert 'Class.meth6' in domain.objects
assert domain.objects['Class.meth6'] == ('index', 'Class.meth6', 'method', False)

# :final:
assert_node(doctree[1][1][12], addnodes.index,
entries=[('single', 'meth7() (Class method)', 'Class.meth7', '', None)])
assert_node(doctree[1][1][13], ([desc_signature, ([desc_annotation, ("final", desc_sig_space)],
[desc_name, "meth7"],
[desc_parameterlist, ()])],
[desc_content, ()]))
assert 'Class.meth7' in domain.objects
assert domain.objects['Class.meth7'] == ('index', 'Class.meth7', 'method', False)


def test_pyclassmethod(app):
text = (".. py:class:: Class\n"
Expand Down