summaryrefslogtreecommitdiff
path: root/nodes.py
diff options
context:
space:
mode:
authorAnthon van der Neut <anthon@mnt.org>2016-11-22 09:24:43 +0100
committerAnthon van der Neut <anthon@mnt.org>2016-11-22 09:24:43 +0100
commit77559065be3f3e8a76d76e733c26bb9a149f7b42 (patch)
tree37bb94598d77b0eb879bb958c7dad76f7f51fc8f /nodes.py
parenta72e8cf2f64855d29106f4f5b1687e09bcc9284e (diff)
downloadruamel.yaml-77559065be3f3e8a76d76e733c26bb9a149f7b42.tar.gz
memory usage optimisations0.13.1
Diffstat (limited to 'nodes.py')
-rw-r--r--nodes.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/nodes.py b/nodes.py
index 214284a..b518513 100644
--- a/nodes.py
+++ b/nodes.py
@@ -4,6 +4,8 @@ from __future__ import print_function
class Node(object):
+ __slots__ = 'tag', 'value', 'start_mark', 'end_mark', 'comment', 'anchor',
+
def __init__(self, tag, value, start_mark, end_mark, comment=None):
self.tag = tag
self.value = value
@@ -62,6 +64,7 @@ class ScalarNode(Node):
| -> literal style
> -> folding style
"""
+ __slots__ = 'style',
id = 'scalar'
def __init__(self, tag, value, start_mark=None, end_mark=None, style=None,
@@ -71,6 +74,8 @@ class ScalarNode(Node):
class CollectionNode(Node):
+ __slots__ = 'flow_style', 'anchor',
+
def __init__(self, tag, value, start_mark=None, end_mark=None,
flow_style=None, comment=None, anchor=None):
Node.__init__(self, tag, value, start_mark, end_mark, comment=comment)
@@ -79,8 +84,10 @@ class CollectionNode(Node):
class SequenceNode(CollectionNode):
+ __slots__ = ()
id = 'sequence'
class MappingNode(CollectionNode):
+ __slots__ = ()
id = 'mapping'