Skip to content

Commit

Permalink
Use Node.findall
Browse files Browse the repository at this point in the history
  • Loading branch information
AA-Turner committed Apr 22, 2022
1 parent ab4fe2f commit 9baadd6
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions doc/development/tutorials/examples/todo.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ def merge_todos(app, env, docnames, other):

def process_todo_nodes(app, doctree, fromdocname):
if not app.config.todo_include_todos:
for node in doctree.traverse(todo):
for node in doctree.findall(todo):
node.parent.remove(node)

# Replace all todolist nodes with a list of the collected todos.
Expand All @@ -80,7 +80,7 @@ def process_todo_nodes(app, doctree, fromdocname):
if not hasattr(env, 'todo_all_todos'):
env.todo_all_todos = []

for node in doctree.traverse(todolist):
for node in doctree.findall(todolist):
if not app.config.todo_include_todos:
node.replace_self([])
continue
Expand Down
2 changes: 1 addition & 1 deletion sphinx/ext/intersphinx.py
Original file line number Diff line number Diff line change
Expand Up @@ -572,7 +572,7 @@ class IntersphinxRoleResolver(ReferencesResolver):
default_priority = ReferencesResolver.default_priority - 1

def run(self, **kwargs: Any) -> None:
for node in self.document.traverse(pending_xref):
for node in self.document.findall(pending_xref):
if 'intersphinx' not in node:
continue
contnode = cast(nodes.TextElement, node[0].deepcopy())
Expand Down
2 changes: 1 addition & 1 deletion tests/test_directive_code.py
Original file line number Diff line number Diff line change
Expand Up @@ -591,7 +591,7 @@ def test_linenothreshold(app, status, warning):
def test_code_block_dedent(app, status, warning):
app.builder.build(['dedent'])
doctree = app.env.get_doctree('dedent')
codeblocks = list(doctree.traverse(nodes.literal_block))
codeblocks = [*doctree.findall(nodes.literal_block)]
# Note: comparison string should not have newlines at the beginning or end
text_0_indent = '''First line
Second line
Expand Down

0 comments on commit 9baadd6

Please sign in to comment.