(customized_prompt=None)
| 77 | |
| 78 | def MakeDefaultFunction(default, conditional_functions, context=None): |
| 79 | def get_failed_info(customized_prompt=None): |
| 80 | failed_info = "no avaliable function found.\n" |
| 81 | for (bf, func, location) in conditional_functions: |
| 82 | prompt = location if customized_prompt is None else customized_prompt |
| 83 | failed_info += "\n%s: \x1b[1;31mFAILED\x1b[0m\n\t%s\n" % ( |
| 84 | prompt, |
| 85 | bf.debug_str(context), |
| 86 | ) |
| 87 | return failed_info |
| 88 | |
| 89 | return lambda *args, **kwargs: default(get_failed_info, *args, **kwargs) |
| 90 |