MCPcopy Create free account
hub / github.com/zai-org/CodeGeeX / try_format_code

Function try_format_code

codegeex/data/process_pretrain_dataset.py:19–29  ·  view source on GitHub ↗
(code: str)

Source from the content-addressed store, hash-verified

17
18
19def try_format_code(code: str):
20 # Auto-correct to PEP8 format (Change tab to 4-whitespaces;
21 # add whitespace around some special symbols;
22 # reformat line length < 100, etc.)
23 try:
24 res = format_str(code, mode=FileMode(line_length=200))
25 except Exception as e:
26 res = code
27 print(e)
28 print("Wrong python format: {}".format(code))
29 return res
30
31
32def load_pretrain_dataset(dataset_path: Union[str, List[str]]) -> Dict:

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected