summaryrefslogtreecommitdiffstats
path: root/odl-pipeline/lib/utils/utils_yaml.py
blob: e5b42af1177801feabbf22590f2c62d1b7b43b7c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#
# Copyright (c) 2017 All rights reserved
# This program and the accompanying materials
# are made available under the terms of the Apache License, Version 2.0
# which accompanies this distribution, and is available at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
#
import yaml


def write_dict_to_yaml(config, path):
    with open(path, 'w+') as f:
        yaml.safe_dump(config, f, default_flow_style=False)


def read_dict_from_yaml(path):
    with open(path, 'r') as f:
        return yaml.safe_load(f)