Skip to content

Commit e119085

Browse files
authored
Merge pull request #706 from codeflash-ai/codeflash/optimize-pr687-2025-09-03T05.07.18
⚡️ Speed up method `CommentMapper.visit_ClassDef` by 197% in PR #687 (`granular-async-instrumentation`)
2 parents b2bf9fa + ef74bb5 commit e119085

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

codeflash/code_utils/edit_generated_tests.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ def __init__(
3232

3333
def visit_ClassDef(self, node: ast.ClassDef) -> ast.ClassDef:
3434
self.context_stack.append(node.name)
35-
for inner_node in ast.walk(node):
35+
for inner_node in node.body:
3636
if isinstance(inner_node, (ast.FunctionDef, ast.AsyncFunctionDef)):
3737
self.visit_FunctionDef(inner_node)
3838
self.context_stack.pop()
@@ -55,7 +55,9 @@ def visit_FunctionDef(self, node: ast.FunctionDef) -> ast.FunctionDef:
5555
def visit_AsyncFunctionDef(self, node: ast.AsyncFunctionDef) -> ast.AsyncFunctionDef:
5656
return self._process_function_def(node)
5757

58-
def _process_function_def(self, node: ast.FunctionDef | ast.AsyncFunctionDef) -> ast.FunctionDef | ast.AsyncFunctionDef:
58+
def _process_function_def(
59+
self, node: ast.FunctionDef | ast.AsyncFunctionDef
60+
) -> ast.FunctionDef | ast.AsyncFunctionDef:
5961
self.context_stack.append(node.name)
6062
i = len(node.body) - 1
6163
test_qualified_name = ".".join(self.context_stack)

0 commit comments

Comments
 (0)