Spaces:
Sleeping
Sleeping
#!/usr/bin/env python3 | |
# -*- coding: utf-8 -*- | |
""" | |
Created on Tue Jul 11 12:56:00 2023 | |
Copyright (c): Shamim Ahamed | |
""" | |
import yaml | |
from addict import Dict | |
class MyDict(Dict): | |
def __missing__(self, name): | |
raise KeyError(name) | |
def read_yaml(fpath): | |
with open(fpath, mode="r") as file: | |
yml = yaml.safe_load(file) | |
return MyDict(yml) |