summaryrefslogtreecommitdiffstats
path: root/lib/yaml/nodes.py
diff options
context:
space:
mode:
authorxiubuzhe <xiubuzhe@sina.com>2023-10-10 18:42:56 +0800
committerxiubuzhe <xiubuzhe@sina.com>2023-10-10 18:42:56 +0800
commit761f7e6618b74d4818348b64c96c263dfa31fb03 (patch)
tree0a79e3cb2ffcf0f439bfb8cef405ba9dab69c5ab /lib/yaml/nodes.py
parent8cf6546b260ad2e2690e34a625ca2fce8c62fa23 (diff)
downloadsunhpc-761f7e6618b74d4818348b64c96c263dfa31fb03.tar.gz
sunhpc-761f7e6618b74d4818348b64c96c263dfa31fb03.tar.bz2
sunhpc-761f7e6618b74d4818348b64c96c263dfa31fb03.zip
add yumrepos,mpi,ntfs,nvidia,openmpi,schrodinger
Diffstat (limited to 'lib/yaml/nodes.py')
-rw-r--r--lib/yaml/nodes.py49
1 files changed, 49 insertions, 0 deletions
diff --git a/lib/yaml/nodes.py b/lib/yaml/nodes.py
new file mode 100644
index 0000000..c4f070c
--- /dev/null
+++ b/lib/yaml/nodes.py
@@ -0,0 +1,49 @@
+
+class Node(object):
+ def __init__(self, tag, value, start_mark, end_mark):
+ self.tag = tag
+ self.value = value
+ self.start_mark = start_mark
+ self.end_mark = end_mark
+ def __repr__(self):
+ value = self.value
+ #if isinstance(value, list):
+ # if len(value) == 0:
+ # value = '<empty>'
+ # elif len(value) == 1:
+ # value = '<1 item>'
+ # else:
+ # value = '<%d items>' % len(value)
+ #else:
+ # if len(value) > 75:
+ # value = repr(value[:70]+u' ... ')
+ # else:
+ # value = repr(value)
+ value = repr(value)
+ return '%s(tag=%r, value=%s)' % (self.__class__.__name__, self.tag, value)
+
+class ScalarNode(Node):
+ id = 'scalar'
+ def __init__(self, tag, value,
+ start_mark=None, end_mark=None, style=None):
+ self.tag = tag
+ self.value = value
+ self.start_mark = start_mark
+ self.end_mark = end_mark
+ self.style = style
+
+class CollectionNode(Node):
+ def __init__(self, tag, value,
+ start_mark=None, end_mark=None, flow_style=None):
+ self.tag = tag
+ self.value = value
+ self.start_mark = start_mark
+ self.end_mark = end_mark
+ self.flow_style = flow_style
+
+class SequenceNode(CollectionNode):
+ id = 'sequence'
+
+class MappingNode(CollectionNode):
+ id = 'mapping'
+