Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
latentvector committed Apr 7, 2024
1 parent 935be77 commit 67d683a
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions commune/module/module.py
Original file line number Diff line number Diff line change
Expand Up @@ -365,16 +365,21 @@ def munch(cls, x:Dict) -> Munch:
return cls.dict2munch(x)

@classmethod
def load_yaml(cls, path:str=None) -> Dict:
def load_yaml(cls, path:str=None, default={}, **kwargs) -> Dict:
'''f
Loads a yaml file
'''
import yaml
path = cls.resolve_path(path)

try:
with open(path, 'r') as file:
data = yaml.safe_load(file)
except:
data = default

return data

from commune.utils.dict import load_yaml
config = load_yaml(path)
return config

get_yaml = load_yaml


Expand Down

0 comments on commit 67d683a

Please sign in to comment.