Skip to content

Commit 14280fa

Browse files
authored
Merge pull request #709 from codeflash-ai/codeflash/optimize-pr687-2025-09-03T05.27.10
⚡️ Speed up method `CommentMapper.visit_FunctionDef` by 84% in PR #687 (`granular-async-instrumentation`)
2 parents 1142de5 + 600dafc commit 14280fa

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

codeflash/code_utils/edit_generated_tests.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,9 @@ def _process_function_def_common(self, node: ast.FunctionDef | ast.AsyncFunction
7070
j = len(line_node.body) - 1
7171
while j >= 0:
7272
compound_line_node: ast.stmt = line_node.body[j]
73-
internal_node: ast.AST
74-
for internal_node in ast.walk(compound_line_node):
73+
nodes_to_check = [compound_line_node]
74+
nodes_to_check.extend(getattr(compound_line_node, "body", []))
75+
for internal_node in nodes_to_check:
7576
if isinstance(internal_node, (ast.stmt, ast.Assign)):
7677
inv_id = str(i) + "_" + str(j)
7778
match_key = key + "#" + inv_id

0 commit comments

Comments
 (0)