This is an automated email from the ASF dual-hosted git repository.
potiuk pushed a commit to branch v3-0-test
in repository https://gitbox.apache.org/repos/asf/airflow.git
The following commit(s) were added to refs/heads/v3-0-test by this push:
new 7ed469afea7 [v3-0-test] Better type handling to account for
types-docutils bump (#53364) (#53778)
7ed469afea7 is described below
commit 7ed469afea73b52627ec47a315b5946bd5b10257
Author: Jarek Potiuk <[email protected]>
AuthorDate: Sat Jul 26 10:20:31 2025 +0200
[v3-0-test] Better type handling to account for types-docutils bump
(#53364) (#53778)
(cherry picked from commit 7654e1a49b074d5dc06dd1218369399430dfcfc9)
Co-authored-by: Amogh Desai <[email protected]>
---
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 faa9501ffee..6009186c9d8 100644
--- a/devel-common/src/sphinx_exts/substitution_extensions.py
+++ b/devel-common/src/sphinx_exts/substitution_extensions.py
@@ -63,7 +63,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
@@ -78,11 +78,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]]: