This is an automated email from the ASF dual-hosted git repository. amoghdesai pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/airflow.git
The following commit(s) were added to refs/heads/main by this push: new 7654e1a49b0 Better type handling to account for types-docutils bump (#53364) 7654e1a49b0 is described below commit 7654e1a49b074d5dc06dd1218369399430dfcfc9 Author: Amogh Desai <amoghrajesh1...@gmail.com> AuthorDate: Tue Jul 15 15:06:51 2025 +0530 Better type handling to account for types-docutils bump (#53364) --- devel-common/src/sphinx_exts/substitution_extensions.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/devel-common/src/sphinx_exts/substitution_extensions.py b/devel-common/src/sphinx_exts/substitution_extensions.py index a4f705a756a..699dbffa30f 100644 --- a/devel-common/src/sphinx_exts/substitution_extensions.py +++ b/devel-common/src/sphinx_exts/substitution_extensions.py @@ -61,7 +61,7 @@ class SubstitutionCodeBlockTransform(SphinxTransform): return isinstance(node, (nodes.literal_block, nodes.literal)) for node in self.document.traverse(condition): - if _SUBSTITUTION_OPTION_NAME not in node: + if not node.get(_SUBSTITUTION_OPTION_NAME): continue # Some nodes don't have a direct document property, so walk up until we find it @@ -76,11 +76,13 @@ class SubstitutionCodeBlockTransform(SphinxTransform): old_child = child for name, value in substitution_defs.items(): replacement = value.astext() - child = nodes.Text(child.replace(f"|{name}|", replacement)) - node.replace(old_child, child) + if isinstance(child, nodes.Text): + child = nodes.Text(child.replace(f"|{name}|", replacement)) + if isinstance(node, nodes.Element): + node.replace(old_child, child) # The highlighter checks this -- without this, it will refuse to apply highlighting - node.rawsource = node.astext() + node.rawsource = node.astext() # type: ignore[attr-defined] def substitution_code_role(*args, **kwargs) -> tuple[list, list[Any]]: