neuro_internal_tools / file_operations.py
achref Trabelsi
add app
8bda2ce
raw
history blame contribute delete
562 Bytes
import yaml
def save_file(filepath, content):
with open(filepath, "w", encoding="utf-8") as outfile:
outfile.write(content)
def open_file(filepath):
with open(filepath, "r", encoding="utf-8", errors="ignore") as infile:
return infile.read()
def save_yaml(filepath, data):
with open(filepath, "w", encoding="utf-8") as file:
yaml.dump(data, file, allow_unicode=True)
def open_yaml(filepath):
with open(filepath, "r", encoding="utf-8") as file:
data = yaml.load(file, Loader=yaml.FullLoader)
return data