Skip to content

Commit

Permalink
replace ast.Str with ast.Constant to avoid deprecation warnings in py…
Browse files Browse the repository at this point in the history
…thon 3.12
  • Loading branch information
phinate authored and patrick-kidger committed Jul 31, 2024
1 parent b877cf8 commit 2ae053b
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion jaxtyping/_import_hook.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ def visit_Module(self, node: ast.Module):
for i, child in enumerate(node.body):
if isinstance(child, ast.ImportFrom) and child.module == "__future__":
continue
elif isinstance(child, ast.Expr) and isinstance(child.value, ast.Str):
elif isinstance(child, ast.Expr) and isinstance(child.value, ast.Constant):
continue # module docstring
else:
node.body.insert(i, ast.Import(names=[ast.alias("jaxtyping", None)]))
Expand Down

0 comments on commit 2ae053b

Please sign in to comment.