1a5f9918aSopenharmony_ci 2a5f9918aSopenharmony_ci# Abstract classes. 3a5f9918aSopenharmony_ci 4a5f9918aSopenharmony_ciclass Event(object): 5a5f9918aSopenharmony_ci def __init__(self, start_mark=None, end_mark=None): 6a5f9918aSopenharmony_ci self.start_mark = start_mark 7a5f9918aSopenharmony_ci self.end_mark = end_mark 8a5f9918aSopenharmony_ci def __repr__(self): 9a5f9918aSopenharmony_ci attributes = [key for key in ['anchor', 'tag', 'implicit', 'value'] 10a5f9918aSopenharmony_ci if hasattr(self, key)] 11a5f9918aSopenharmony_ci arguments = ', '.join(['%s=%r' % (key, getattr(self, key)) 12a5f9918aSopenharmony_ci for key in attributes]) 13a5f9918aSopenharmony_ci return '%s(%s)' % (self.__class__.__name__, arguments) 14a5f9918aSopenharmony_ci 15a5f9918aSopenharmony_ciclass NodeEvent(Event): 16a5f9918aSopenharmony_ci def __init__(self, anchor, start_mark=None, end_mark=None): 17a5f9918aSopenharmony_ci self.anchor = anchor 18a5f9918aSopenharmony_ci self.start_mark = start_mark 19a5f9918aSopenharmony_ci self.end_mark = end_mark 20a5f9918aSopenharmony_ci 21a5f9918aSopenharmony_ciclass CollectionStartEvent(NodeEvent): 22a5f9918aSopenharmony_ci def __init__(self, anchor, tag, implicit, start_mark=None, end_mark=None, 23a5f9918aSopenharmony_ci flow_style=None): 24a5f9918aSopenharmony_ci self.anchor = anchor 25a5f9918aSopenharmony_ci self.tag = tag 26a5f9918aSopenharmony_ci self.implicit = implicit 27a5f9918aSopenharmony_ci self.start_mark = start_mark 28a5f9918aSopenharmony_ci self.end_mark = end_mark 29a5f9918aSopenharmony_ci self.flow_style = flow_style 30a5f9918aSopenharmony_ci 31a5f9918aSopenharmony_ciclass CollectionEndEvent(Event): 32a5f9918aSopenharmony_ci pass 33a5f9918aSopenharmony_ci 34a5f9918aSopenharmony_ci# Implementations. 35a5f9918aSopenharmony_ci 36a5f9918aSopenharmony_ciclass StreamStartEvent(Event): 37a5f9918aSopenharmony_ci def __init__(self, start_mark=None, end_mark=None, encoding=None): 38a5f9918aSopenharmony_ci self.start_mark = start_mark 39a5f9918aSopenharmony_ci self.end_mark = end_mark 40a5f9918aSopenharmony_ci self.encoding = encoding 41a5f9918aSopenharmony_ci 42a5f9918aSopenharmony_ciclass StreamEndEvent(Event): 43a5f9918aSopenharmony_ci pass 44a5f9918aSopenharmony_ci 45a5f9918aSopenharmony_ciclass DocumentStartEvent(Event): 46a5f9918aSopenharmony_ci def __init__(self, start_mark=None, end_mark=None, 47a5f9918aSopenharmony_ci explicit=None, version=None, tags=None): 48a5f9918aSopenharmony_ci self.start_mark = start_mark 49a5f9918aSopenharmony_ci self.end_mark = end_mark 50a5f9918aSopenharmony_ci self.explicit = explicit 51a5f9918aSopenharmony_ci self.version = version 52a5f9918aSopenharmony_ci self.tags = tags 53a5f9918aSopenharmony_ci 54a5f9918aSopenharmony_ciclass DocumentEndEvent(Event): 55a5f9918aSopenharmony_ci def __init__(self, start_mark=None, end_mark=None, 56a5f9918aSopenharmony_ci explicit=None): 57a5f9918aSopenharmony_ci self.start_mark = start_mark 58a5f9918aSopenharmony_ci self.end_mark = end_mark 59a5f9918aSopenharmony_ci self.explicit = explicit 60a5f9918aSopenharmony_ci 61a5f9918aSopenharmony_ciclass AliasEvent(NodeEvent): 62a5f9918aSopenharmony_ci pass 63a5f9918aSopenharmony_ci 64a5f9918aSopenharmony_ciclass ScalarEvent(NodeEvent): 65a5f9918aSopenharmony_ci def __init__(self, anchor, tag, implicit, value, 66a5f9918aSopenharmony_ci start_mark=None, end_mark=None, style=None): 67a5f9918aSopenharmony_ci self.anchor = anchor 68a5f9918aSopenharmony_ci self.tag = tag 69a5f9918aSopenharmony_ci self.implicit = implicit 70a5f9918aSopenharmony_ci self.value = value 71a5f9918aSopenharmony_ci self.start_mark = start_mark 72a5f9918aSopenharmony_ci self.end_mark = end_mark 73a5f9918aSopenharmony_ci self.style = style 74a5f9918aSopenharmony_ci 75a5f9918aSopenharmony_ciclass SequenceStartEvent(CollectionStartEvent): 76a5f9918aSopenharmony_ci pass 77a5f9918aSopenharmony_ci 78a5f9918aSopenharmony_ciclass SequenceEndEvent(CollectionEndEvent): 79a5f9918aSopenharmony_ci pass 80a5f9918aSopenharmony_ci 81a5f9918aSopenharmony_ciclass MappingStartEvent(CollectionStartEvent): 82a5f9918aSopenharmony_ci pass 83a5f9918aSopenharmony_ci 84a5f9918aSopenharmony_ciclass MappingEndEvent(CollectionEndEvent): 85a5f9918aSopenharmony_ci pass 86a5f9918aSopenharmony_ci 87