MCPcopy Index your code
hub / github.com/zai-org/CodeGeeX2 / first_block

Function first_block

evaluation/utils.py:368–370  ·  view source on GitHub ↗

Split off first block of code by scanning for class, def etc. on newlines.

(string, stop_words)

Source from the content-addressed store, hash-verified

366# Modified from https://github.com/bigcode-project/bigcode-evaluation-harness/blob/main/lm_eval/tasks/mbpp.py
367stop_words=["\nclass", "\nassert", '\n"""', "\nprint", "\nif"]
368def 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
373def cleanup_code(

Callers 1

cleanup_codeFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected