diff options
author | Anthon van der Neut <anthon@mnt.org> | 2016-11-22 09:24:43 +0100 |
---|---|---|
committer | Anthon van der Neut <anthon@mnt.org> | 2016-11-22 09:24:43 +0100 |
commit | 77559065be3f3e8a76d76e733c26bb9a149f7b42 (patch) | |
tree | 37bb94598d77b0eb879bb958c7dad76f7f51fc8f /events.py | |
parent | a72e8cf2f64855d29106f4f5b1687e09bcc9284e (diff) | |
download | ruamel.yaml-77559065be3f3e8a76d76e733c26bb9a149f7b42.tar.gz |
memory usage optimisations0.13.1
Diffstat (limited to 'events.py')
-rw-r--r-- | events.py | 33 |
1 files changed, 23 insertions, 10 deletions
@@ -8,6 +8,8 @@ def CommentCheck(): class Event(object): + __slots__ = 'start_mark', 'end_mark', 'comment', + def __init__(self, start_mark=None, end_mark=None, comment=CommentCheck): self.start_mark = start_mark self.end_mark = end_mark @@ -28,28 +30,33 @@ class Event(object): class NodeEvent(Event): + __slots__ = 'anchor', + def __init__(self, anchor, start_mark=None, end_mark=None, comment=None): Event.__init__(self, start_mark, end_mark, comment) self.anchor = anchor class CollectionStartEvent(NodeEvent): + __slots__ = 'tag', 'implicit', 'flow_style', + def __init__(self, anchor, tag, implicit, start_mark=None, end_mark=None, flow_style=None, comment=None): - Event.__init__(self, start_mark, end_mark, comment) - self.anchor = anchor + NodeEvent.__init__(self, anchor, start_mark, end_mark, comment) self.tag = tag self.implicit = implicit self.flow_style = flow_style class CollectionEndEvent(Event): - pass + __slots__ = () -# Implementations. +# Implementations. class StreamStartEvent(Event): + __slots__ = 'encoding', + def __init__(self, start_mark=None, end_mark=None, encoding=None, comment=None): Event.__init__(self, start_mark, end_mark, comment) @@ -57,10 +64,12 @@ class StreamStartEvent(Event): class StreamEndEvent(Event): - pass + __slots__ = () class DocumentStartEvent(Event): + __slots__ = 'explicit', 'version', 'tags', + def __init__(self, start_mark=None, end_mark=None, explicit=None, version=None, tags=None, comment=None): Event.__init__(self, start_mark, end_mark, comment) @@ -70,6 +79,8 @@ class DocumentStartEvent(Event): class DocumentEndEvent(Event): + __slots__ = 'explicit', + def __init__(self, start_mark=None, end_mark=None, explicit=None, comment=None): Event.__init__(self, start_mark, end_mark, comment) @@ -77,10 +88,12 @@ class DocumentEndEvent(Event): class AliasEvent(NodeEvent): - pass + __slots__ = () class ScalarEvent(NodeEvent): + __slots__ = 'tag', 'implicit', 'value', 'style', + def __init__(self, anchor, tag, implicit, value, start_mark=None, end_mark=None, style=None, comment=None): NodeEvent.__init__(self, anchor, start_mark, end_mark, comment) @@ -91,16 +104,16 @@ class ScalarEvent(NodeEvent): class SequenceStartEvent(CollectionStartEvent): - pass + __slots__ = () class SequenceEndEvent(CollectionEndEvent): - pass + __slots__ = () class MappingStartEvent(CollectionStartEvent): - pass + __slots__ = () class MappingEndEvent(CollectionEndEvent): - pass + __slots__ = () |