Skip to content

Commit f61c139

Browse files
committed
revert changes
1 parent 0042d08 commit f61c139

File tree

3 files changed

+346
-289
lines changed

3 files changed

+346
-289
lines changed

codeflash/code_utils/static_analysis.py

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -128,19 +128,13 @@ def get_first_top_level_object_def_ast(
128128

129129
def get_first_top_level_function_or_method_ast(
130130
function_name: str, parents: list[FunctionParent], node: ast.AST
131-
) -> ast.FunctionDef | ast.AsyncFunctionDef | None:
131+
) -> ast.FunctionDef | None:
132132
if not parents:
133-
result = get_first_top_level_object_def_ast(function_name, ast.FunctionDef, node)
134-
if result is None:
135-
result = get_first_top_level_object_def_ast(function_name, ast.AsyncFunctionDef, node)
136-
return result
133+
return get_first_top_level_object_def_ast(function_name, ast.FunctionDef, node)
137134
if parents[0].type == "ClassDef" and (
138135
class_node := get_first_top_level_object_def_ast(parents[0].name, ast.ClassDef, node)
139136
):
140-
result = get_first_top_level_object_def_ast(function_name, ast.FunctionDef, class_node)
141-
if result is None:
142-
result = get_first_top_level_object_def_ast(function_name, ast.AsyncFunctionDef, class_node)
143-
return result
137+
return get_first_top_level_object_def_ast(function_name, ast.FunctionDef, class_node)
144138
return None
145139

146140

@@ -164,4 +158,4 @@ def has_typed_parameters(node: ast.FunctionDef | ast.AsyncFunctionDef, parents:
164158
return all(arg.annotation for arg in node.args.args)
165159
if kind in [FunctionKind.CLASS_METHOD, FunctionKind.INSTANCE_METHOD]:
166160
return all(arg.annotation for arg in node.args.args[1:])
167-
return False
161+
return False

0 commit comments

Comments
 (0)