CoolFace
Apppublic

achref/neuro_internal_tools

sourceHugging Faceupdated 3y agoView on Hugging Face
1likes
file_operations.py23 linesDownload Raw Back to root
1import yaml2 3 4def save_file(filepath, content):5    with open(filepath, "w", encoding="utf-8") as outfile:6        outfile.write(content)7 8 9def open_file(filepath):10    with open(filepath, "r", encoding="utf-8", errors="ignore") as infile:11        return infile.read()12 13 14def save_yaml(filepath, data):15    with open(filepath, "w", encoding="utf-8") as file:16        yaml.dump(data, file, allow_unicode=True)17 18 19def open_yaml(filepath):20    with open(filepath, "r", encoding="utf-8") as file:21        data = yaml.load(file, Loader=yaml.FullLoader)22    return data23