summaryrefslogtreecommitdiffstats
path: root/odl-pipeline/lib/utils/utils_yaml.py
diff options
context:
space:
mode:
Diffstat (limited to 'odl-pipeline/lib/utils/utils_yaml.py')
-rwxr-xr-xodl-pipeline/lib/utils/utils_yaml.py20
1 files changed, 20 insertions, 0 deletions
diff --git a/odl-pipeline/lib/utils/utils_yaml.py b/odl-pipeline/lib/utils/utils_yaml.py
new file mode 100755
index 0000000..f9513b8
--- /dev/null
+++ b/odl-pipeline/lib/utils/utils_yaml.py
@@ -0,0 +1,20 @@
+#
+# Copyright (c) 2015 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.dump(config, f, default_flow_style=False)
+
+
+def read_dict_from_yaml(path):
+ with open(path, 'r') as f:
+ return yaml.load(f)
58 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232