Skip to content

Commit 5d5e77b

Browse files
committed
removed old function
1 parent 274f98b commit 5d5e77b

File tree

1 file changed

+1
-19
lines changed

1 file changed

+1
-19
lines changed

codeflash/code_utils/code_extractor.py

Lines changed: 1 addition & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -235,26 +235,8 @@ def extract_code(functions_to_optimize: list[FunctionToOptimize]) -> tuple[str |
235235
return edited_code, contextual_dunder_methods
236236

237237

238-
def find_preexisting_object_old(source_code: str) -> list[tuple[str, list[FunctionParent]]]:
239-
"""Find all preexisting functions, classes or class methods in the source code"""
240-
preexisting_objects: list[tuple[str, list[FunctionParent]]] = []
241-
try:
242-
module_node: ast.Module = ast.parse(source_code)
243-
except SyntaxError:
244-
logger.exception("find_preexisting_objects - Syntax error while parsing code")
245-
return preexisting_objects
246-
for node in module_node.body:
247-
if isinstance(node, (ast.FunctionDef, ast.AsyncFunctionDef)):
248-
preexisting_objects.append((node.name, []))
249-
elif isinstance(node, ast.ClassDef):
250-
preexisting_objects.append((node.name, []))
251-
for cnode in node.body:
252-
if isinstance(cnode, (ast.FunctionDef, ast.AsyncFunctionDef)):
253-
preexisting_objects.append((cnode.name, [FunctionParent(node.name, "ClassDef")]))
254-
return preexisting_objects
255-
256238
def find_preexisting_objects(source_code: str) -> set[tuple[str, tuple[FunctionParent, ...]]]:
257-
"""Find all preexisting functions, classes or class methods in the source code"""
239+
"""Find all preexisting functions, classes or class methods in the source code."""
258240
preexisting_objects: set[tuple[str, tuple[FunctionParent, ...]]] = set()
259241
try:
260242
module_node: ast.Module = ast.parse(source_code)

0 commit comments

Comments
 (0)