File: listn.py

package info (click to toggle)
python-hiyapyco 0.7.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 436 kB
  • sloc: python: 2,012; makefile: 237
file content (23 lines) | stat: -rwxr-xr-x 692 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#! /usr/bin/env python

import sys
import os
import logging

basepath = os.path.dirname(os.path.realpath(__file__))
sys.path.insert(0, os.path.dirname(basepath))
import hiyapyco

conf = hiyapyco.load(
        os.path.join(basepath, 'listn1.yaml'),
        os.path.join(basepath, 'listn2.yaml'),
        method=hiyapyco.METHOD_MERGE,
        failonmissingfiles=True
        )
print(conf)
print('-'*10, 'YAML', '-'*10)
print(hiyapyco.dump(conf))
assert conf == {'l1': [{'d1': {'d1k1': 'v1', 'd1k2': 'v2', 'd1k3': 'v3'}}, {'d2': {'d2k2': 'x2', 'd2k1': 'xxx'}}, {'d0': {'d0k1': 'only in 1'}}, {'d3': {'d3k1': 'only in 2'}}]}

# vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4 smartindent nu