File tree Expand file tree Collapse file tree 1 file changed +9
-3
lines changed
Expand file tree Collapse file tree 1 file changed +9
-3
lines changed Original file line number Diff line number Diff line change @@ -128,13 +128,19 @@ def get_first_top_level_object_def_ast(
128128
129129def get_first_top_level_function_or_method_ast (
130130 function_name : str , parents : list [FunctionParent ], node : ast .AST
131- ) -> ast .FunctionDef | None :
131+ ) -> ast .FunctionDef | ast . AsyncFunctionDef | None :
132132 if not parents :
133- return get_first_top_level_object_def_ast (function_name , ast .FunctionDef , node )
133+ result = get_first_top_level_object_def_ast (function_name , ast .FunctionDef , node )
134+ if result is not None :
135+ return result
136+ return get_first_top_level_object_def_ast (function_name , ast .AsyncFunctionDef , node )
134137 if parents [0 ].type == "ClassDef" and (
135138 class_node := get_first_top_level_object_def_ast (parents [0 ].name , ast .ClassDef , node )
136139 ):
137- return get_first_top_level_object_def_ast (function_name , ast .FunctionDef , class_node )
140+ result = get_first_top_level_object_def_ast (function_name , ast .FunctionDef , class_node )
141+ if result is not None :
142+ return result
143+ return get_first_top_level_object_def_ast (function_name , ast .AsyncFunctionDef , class_node )
138144 return None
139145
140146
You can’t perform that action at this time.
0 commit comments