Split off first block of code by scanning for class, def etc. on newlines.
(string, stop_words)
| 366 | # Modified from https://github.com/bigcode-project/bigcode-evaluation-harness/blob/main/lm_eval/tasks/mbpp.py |
| 367 | stop_words=["\nclass", "\nassert", '\n"""', "\nprint", "\nif"] |
| 368 | def first_block(string, stop_words): |
| 369 | """Split off first block of code by scanning for class, def etc. on newlines.""" |
| 370 | return re.split("|".join(stop_words), string)[0].rstrip() |
| 371 | |
| 372 | |
| 373 | def cleanup_code( |