Skip to content

Commit

Permalink
Remove deprecated code for Sphinx 5.0
Browse files Browse the repository at this point in the history
  • Loading branch information
AA-Turner committed Apr 16, 2022
1 parent 9236b42 commit 267954e
Show file tree
Hide file tree
Showing 16 changed files with 54 additions and 493 deletions.
6 changes: 1 addition & 5 deletions sphinx/deprecation.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,6 @@
from typing import Any, Dict, Type


class RemovedInSphinx50Warning(DeprecationWarning):
pass


class RemovedInSphinx60Warning(PendingDeprecationWarning):
pass

Expand All @@ -18,7 +14,7 @@ class RemovedInSphinx70Warning(PendingDeprecationWarning):
pass


RemovedInNextVersionWarning = RemovedInSphinx50Warning
RemovedInNextVersionWarning = RemovedInSphinx60Warning


def deprecated_alias(modname: str, objects: Dict[str, object],
Expand Down
14 changes: 0 additions & 14 deletions sphinx/domains/javascript.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,13 +114,6 @@ def add_target_and_index(self, name_obj: Tuple[str, str], sig: str,
fullname = (mod_name + '.' if mod_name else '') + name_obj[0]
node_id = make_id(self.env, self.state.document, '', fullname)
signode['ids'].append(node_id)

# Assign old styled node_id not to break old hyperlinks (if possible)
# Note: Will be removed in Sphinx-5.0 (RemovedInSphinx50Warning)
old_node_id = self.make_old_id(fullname)
if old_node_id not in self.state.document.ids and old_node_id not in signode['ids']:
signode['ids'].append(old_node_id)

self.state.document.note_explicit_target(signode)

domain = cast(JavaScriptDomain, self.env.get_domain('js'))
Expand Down Expand Up @@ -280,13 +273,6 @@ def run(self) -> List[Node]:
location=(self.env.docname, self.lineno))

target = nodes.target('', '', ids=[node_id], ismod=True)

# Assign old styled node_id not to break old hyperlinks (if possible)
# Note: Will be removed in Sphinx-5.0 (RemovedInSphinx50Warning)
old_node_id = self.make_old_id(mod_name)
if old_node_id not in self.state.document.ids and old_node_id not in target['ids']:
target['ids'].append(old_node_id)

self.state.document.note_explicit_target(target)
ret.append(target)
indextext = _('%s (module)') % mod_name
Expand Down
13 changes: 0 additions & 13 deletions sphinx/domains/python.py
Original file line number Diff line number Diff line change
Expand Up @@ -565,12 +565,6 @@ def add_target_and_index(self, name_cls: Tuple[str, str], sig: str,
fullname = (modname + '.' if modname else '') + name_cls[0]
node_id = make_id(self.env, self.state.document, '', fullname)
signode['ids'].append(node_id)

# Assign old styled node_id(fullname) not to break old hyperlinks (if possible)
# Note: Will removed in Sphinx-5.0 (RemovedInSphinx50Warning)
if node_id != fullname and fullname not in self.state.document.ids:
signode['ids'].append(fullname)

self.state.document.note_explicit_target(signode)

domain = cast(PythonDomain, self.env.get_domain('py'))
Expand Down Expand Up @@ -994,13 +988,6 @@ def run(self) -> List[Node]:
node_id = make_id(self.env, self.state.document, 'module', modname)
target = nodes.target('', '', ids=[node_id], ismod=True)
self.set_source_info(target)

# Assign old styled node_id not to break old hyperlinks (if possible)
# Note: Will removed in Sphinx-5.0 (RemovedInSphinx50Warning)
old_node_id = self.make_old_id(modname)
if node_id != old_node_id and old_node_id not in self.state.document.ids:
target['ids'].append(old_node_id)

self.state.document.note_explicit_target(target)

domain.note_module(modname,
Expand Down
14 changes: 0 additions & 14 deletions sphinx/domains/rst.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,6 @@ class ReSTMarkup(ObjectDescription[str]):
def add_target_and_index(self, name: str, sig: str, signode: desc_signature) -> None:
node_id = make_id(self.env, self.state.document, self.objtype, name)
signode['ids'].append(node_id)

# Assign old styled node_id not to break old hyperlinks (if possible)
# Note: Will be removed in Sphinx-5.0 (RemovedInSphinx50Warning)
old_node_id = self.make_old_id(name)
if old_node_id not in self.state.document.ids and old_node_id not in signode['ids']:
signode['ids'].append(old_node_id)

self.state.document.note_explicit_target(signode)

domain = cast(ReSTDomain, self.env.get_domain('rst'))
Expand Down Expand Up @@ -142,13 +135,6 @@ def add_target_and_index(self, name: str, sig: str, signode: desc_signature) ->

node_id = make_id(self.env, self.state.document, prefix, name)
signode['ids'].append(node_id)

# Assign old styled node_id not to break old hyperlinks (if possible)
# Note: Will be removed in Sphinx-5.0 (RemovedInSphinx50Warning)
old_node_id = self.make_old_id(name)
if old_node_id not in self.state.document.ids and old_node_id not in signode['ids']:
signode['ids'].append(old_node_id)

self.state.document.note_explicit_target(signode)
domain.note_object(self.objtype, objname, node_id, location=signode)

Expand Down
22 changes: 0 additions & 22 deletions sphinx/domains/std.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,13 +55,6 @@ def handle_signature(self, sig: str, signode: desc_signature) -> str:
def add_target_and_index(self, name: str, sig: str, signode: desc_signature) -> None:
node_id = make_id(self.env, self.state.document, self.objtype, name)
signode['ids'].append(node_id)

# Assign old styled node_id not to break old hyperlinks (if possible)
# Note: Will be removed in Sphinx-5.0 (RemovedInSphinx50Warning)
old_node_id = self.make_old_id(name)
if old_node_id not in self.state.document.ids and old_node_id not in signode['ids']:
signode['ids'].append(old_node_id)

self.state.document.note_explicit_target(signode)

if self.indextemplate:
Expand Down Expand Up @@ -129,13 +122,6 @@ def run(self) -> List[Node]:
node_id = make_id(self.env, self.state.document, self.name, fullname)
node = nodes.target('', '', ids=[node_id])
self.set_source_info(node)

# Assign old styled node_id not to break old hyperlinks (if possible)
# Note: Will be removed in Sphinx-5.0 (RemovedInSphinx50Warning)
old_node_id = self.make_old_id(fullname)
if old_node_id not in self.state.document.ids and old_node_id not in node['ids']:
node['ids'].append(old_node_id)

self.state.document.note_explicit_target(node)
ret: List[Node] = [node]
if self.indextemplate:
Expand Down Expand Up @@ -492,14 +478,6 @@ def run(self) -> List[Node]:
prefix = 'grammar-token-%s' % productionGroup
node_id = make_id(self.env, self.state.document, prefix, name)
subnode['ids'].append(node_id)

# Assign old styled node_id not to break old hyperlinks (if possible)
# Note: Will be removed in Sphinx-5.0 (RemovedInSphinx50Warning)
old_node_id = self.make_old_id(name)
if (old_node_id not in self.state.document.ids and
old_node_id not in subnode['ids']):
subnode['ids'].append(old_node_id)

self.state.document.note_implicit_target(subnode, subnode)

if len(productionGroup) != 0:
Expand Down
Loading

0 comments on commit 267954e

Please sign in to comment.