| 35 | |
| 36 | |
| 37 | def get_entry_point(task_id: int, assertion: str) -> str: |
| 38 | py_file_path = str(GROUNDTRUTH_MBPP_PATH) + f"/{str(task_id).zfill(3)}.py" |
| 39 | spec = util.spec_from_file_location("inspect_module", py_file_path) |
| 40 | module = util.module_from_spec(spec) |
| 41 | spec.loader.exec_module(module) |
| 42 | functions = [name for name, value in getmembers(module, isfunction)] |
| 43 | |
| 44 | # maybe exist some helper functions, filter them |
| 45 | functions = [func for func in functions if func in assertion] |
| 46 | if len(functions) > 1: |
| 47 | print("more than one function: ", functions) |
| 48 | |
| 49 | return functions[0] if len(functions) > 0 else None |
| 50 | |
| 51 | |
| 52 | def get_code_and_contract_and_assertion(task_id: id) -> Tuple[str, str, str]: |