File tree Expand file tree Collapse file tree 1 file changed +8
-3
lines changed
Expand file tree Collapse file tree 1 file changed +8
-3
lines changed Original file line number Diff line number Diff line change @@ -612,11 +612,16 @@ def _analyze_imports_in_optimized_code(
612612 return dict (imported_names_map )
613613
614614
615- def find_target_node (root : ast .AST , function_to_optimize : FunctionToOptimize ) -> Optional [ast .FunctionDef ]:
616- def _find (node : ast .AST , parents : list [FunctionParent ]) -> Optional [ast .FunctionDef ]:
615+ def find_target_node (
616+ root : ast .AST , function_to_optimize : FunctionToOptimize
617+ ) -> Optional [ast .FunctionDef | ast .AsyncFunctionDef ]:
618+ def _find (node : ast .AST , parents : list [FunctionParent ]) -> Optional [ast .FunctionDef | ast .AsyncFunctionDef ]:
617619 if not parents :
618620 for child in getattr (node , "body" , []):
619- if isinstance (child , ast .FunctionDef ) and child .name == function_to_optimize .function_name :
621+ if (
622+ isinstance (child , (ast .FunctionDef , ast .AsyncFunctionDef ))
623+ and child .name == function_to_optimize .function_name
624+ ):
620625 return child
621626 return None
622627
You can’t perform that action at this time.
0 commit comments