# Collection of code snippets by Arne Vajhøj 
# (from articles on eksperten.dk / vajhoej.dk written sometime between 2004 and now) 
import yaml
from yamlable import yaml_info, YamlAble

@yaml_info(yaml_tag_ns='yamlproc')
class AB(YamlAble):
    def __init__(self,a=0,b=0):
        self.a = a
        self.b = b

@yaml_info(yaml_tag_ns='yamlproc')
class DE(YamlAble):
    def __init__(self,d='',e=''):
        self.d = d
        self.e = e

@yaml_info(yaml_tag_ns='yamlproc')
class Config(YamlAble):
    def __init__(self,ab=None,c=0,de=None,f=''):
        self.ab = ab
        self.c = c
        self.de = de
        self.f = f

cfg = yaml.load(open('/work/demo2python.yaml', 'r'), Loader=yaml.FullLoader)
a = cfg.ab.a
b = cfg.ab.b
c = cfg.c
d = cfg.de.d
e = cfg.de.e
f = cfg.f
print('%d %d %d %s %s %s' % (a,b,c,d,e,f))
