Skip to content

Commit

Permalink
Remove more deprecated items in Sphinx 6.0 (#10562)
Browse files Browse the repository at this point in the history
  • Loading branch information
AA-Turner committed Jun 26, 2022
1 parent 7b07874 commit ac0fc4b
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 106 deletions.
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
1 change: 0 additions & 1 deletion sphinx/application.py
Expand Up @@ -89,7 +89,6 @@
'sphinx.transforms.post_transforms',
'sphinx.transforms.post_transforms.code',
'sphinx.transforms.post_transforms.images',
'sphinx.util.compat',
'sphinx.versioning',
# collectors should be loaded by specific order
'sphinx.environment.collectors.dependencies',
Expand Down
20 changes: 8 additions & 12 deletions sphinx/builders/html/__init__.py
Expand Up @@ -548,8 +548,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 @@ -1227,18 +1227,14 @@ def setup_resource_paths(app: Sphinx, pagename: str, templatename: str,
pathto = context.get('pathto')

# favicon_url
favicon = context.get('favicon')
if favicon and not isurl(favicon):
context['favicon_url'] = pathto('_static/' + favicon, resource=True)
else:
context['favicon_url'] = favicon
favicon_url = context.get('favicon_url')
if favicon_url and not isurl(favicon_url):
context['favicon_url'] = pathto('_static/' + favicon_url, resource=True)

# logo_url
logo = context.get('logo')
if logo and not isurl(logo):
context['logo_url'] = pathto('_static/' + logo, resource=True)
else:
context['logo_url'] = logo
logo_url = context.get('logo_url')
if logo_url and not isurl(logo_url):
context['logo_url'] = pathto('_static/' + logo_url, resource=True)


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:
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
33 changes: 0 additions & 33 deletions sphinx/util/compat.py

This file was deleted.

29 changes: 8 additions & 21 deletions tests/test_domain_py.py
Expand Up @@ -731,10 +731,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 @@ -752,8 +750,6 @@ def test_pymethod_options(app):
addnodes.index,
desc,
addnodes.index,
desc,
addnodes.index,
desc)])]))

# method
Expand Down Expand Up @@ -795,35 +791,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"])],
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

0 comments on commit ac0fc4b

Please sign in to comment.