This is an automated email from the ASF dual-hosted git repository.

skrawcz pushed a commit to branch stefan/fix-unit-tests
in repository https://gitbox.apache.org/repos/asf/hamilton.git

commit 009b25799c407316bdee6570a9620860ac60db22
Author: Stefan Krawczyk <[email protected]>
AuthorDate: Mon Dec 29 22:25:09 2025 +1100

    Update AST check due to deprecation
---
 hamilton/graph_types.py | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/hamilton/graph_types.py b/hamilton/graph_types.py
index 7c81b625..ba95b7ca 100644
--- a/hamilton/graph_types.py
+++ b/hamilton/graph_types.py
@@ -70,7 +70,15 @@ def _remove_docs_and_comments(source: str) -> str:
         if not isinstance(n.body[0], ast.Expr):
             continue
 
-        if not hasattr(n.body[0], "value") or not isinstance(n.body[0].value, 
ast.Str):
+        # In Python 3.8+, string literals (including docstrings) are 
ast.Constant nodes
+        # ast.Str is deprecated and will be removed in Python 3.14
+        if not hasattr(n.body[0], "value"):
+            continue
+
+        value = n.body[0].value
+        is_docstring = isinstance(value, ast.Constant) and 
isinstance(value.value, str)
+
+        if not is_docstring:
             continue
 
         # skip docstring

Reply via email to