raise TypeError("Value objects have no children") def path_to(self, child): raise TypeError("Value objects have no children") #TODO? provide this externally? name = "nodes" provides = event.provides + ["nodes"] class Document(event.Document, RootNode): pass class Value(event.Value, ValueNode): pass class Property(event.Property, PropertyNode): pass class Section(event.Section, SectionNode): pass import sys, odml odml.addImplementation(sys.modules[__name__])
class PropertyNode(ParentedNode): @property def children(self): return self.values def successor(self): return self.parent._props[self.position + 1] def path_to(self, child): return (identity_index(self.values, child),) class ValueNode(ParentedNode): def path_from(self, path): raise TypeError("Value objects have no children") def path_to(self, child): raise TypeError("Value objects have no children") #TODO? provide this externally? name = "nodes" provides = event.provides + ["nodes"] class Document(event.Document, RootNode): pass class Value(event.Value, ValueNode): pass class Property(event.Property, PropertyNode): pass class Section(event.Section, SectionNode): pass import sys, odml odml.addImplementation(sys.modules[__name__])