def setUp(self): visit.inject(visit.Visitor) self.y = yaml.load(''' a: 1 b: 2 c: {x: 3, y: 4} d: {x: 5, y: 6} e: {x: 3, y: 6} ''')
def setUp(self): visit.inject(visit.Visitor) self.y = yaml.load(''' a: 1 b: 2 c: [3, 4] ''') self.z = yaml.load(''' - 0 - one - { first: 3, second: 4} ''')
def setUp(self): visit.inject(visit.Visitor)
#!/usr/bin/python # coding=utf-8 import yaml import visit class ValidationError(Exception): pass class MetaVisitor(visit.Visitor): pass visit.inject(MetaVisitor) # visit.inject(BookVisitor) with file("kw-schema.yaml") as f: print yaml.load(f.read())