Spaces:
Runtime error
Runtime error
File size: 706 Bytes
37e46db | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 | import os
import yaml
import sys
from src.exception import CustomException
def make_dirs(dirs:list[str]):
try:
for dir in dirs:
os.makedirs(dir, exist_ok=True)
except Exception as e:
raise CustomException(e, sys)
def make_files(files:list[str]):
try:
for file in files:
with open(file, 'w') as f:
f.close()
except Exception as e:
raise CustomException(e, sys)
def read_yml(filepath:str):
try:
with open(filepath, 'r') as file:
filedata = yaml.safe_load(file)
file.close()
return filedata
except Exception as e:
raise CustomException(e, sys)
|