MCPcopy Create free account
hub / github.com/MotrixLab/ViMoGen / save_json

Function save_json

mbench/utils.py:33–43  ·  view source on GitHub ↗

Save data to JSON file Args: data: Data to save filepath: Path to save the JSON file

(data: Union[Dict, List], filepath: str)

Source from the content-addressed store, hash-verified

31
32
33def save_json(data: Union[Dict, List], filepath: str) -> None:
34 """
35 Save data to JSON file
36
37 Args:
38 data: Data to save
39 filepath: Path to save the JSON file
40 """
41 os.makedirs(os.path.dirname(filepath), exist_ok=True)
42 with open(filepath, 'w', encoding='utf-8') as f:
43 json.dump(data, f, indent=2, ensure_ascii=False)
44
45
46def load_json(filepath: str) -> Union[Dict, List]:

Callers 2

build_full_info_jsonMethod · 0.85
evaluateMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected