diff options
author | xiubuzhe <xiubuzhe@sina.com> | 2023-10-10 18:42:56 +0800 |
---|---|---|
committer | xiubuzhe <xiubuzhe@sina.com> | 2023-10-10 18:42:56 +0800 |
commit | 761f7e6618b74d4818348b64c96c263dfa31fb03 (patch) | |
tree | 0a79e3cb2ffcf0f439bfb8cef405ba9dab69c5ab /lib/yaml/nodes.py | |
parent | 8cf6546b260ad2e2690e34a625ca2fce8c62fa23 (diff) | |
download | sunhpc-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.py | 49 |
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' + |