mirror of
https://github.com/PiBrewing/craftbeerpi4.git
synced 2024-11-27 01:08:12 +01:00
21 lines
378 B
Python
21 lines
378 B
Python
|
from cbpi.utils.encoder import ComplexEncoder
|
||
|
|
||
|
__all__ = ['load_config',"json_dumps"]
|
||
|
|
||
|
import json
|
||
|
import yaml
|
||
|
|
||
|
|
||
|
def load_config(fname):
|
||
|
|
||
|
try:
|
||
|
with open(fname, 'rt') as f:
|
||
|
data = yaml.load(f, Loader=yaml.FullLoader)
|
||
|
return data
|
||
|
except Exception as e:
|
||
|
|
||
|
pass
|
||
|
|
||
|
def json_dumps(obj):
|
||
|
return json.dumps(obj, cls=ComplexEncoder)
|