Rosetta
Main Page
Related Pages
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Properties
Friends
Macros
Pages
test
yaml
nodes.py
Go to the documentation of this file.
1
# (c) Copyright Rosetta Commons Member Institutions.
2
# (c) This file is part of the Rosetta software suite and is made available under license.
3
# (c) The Rosetta software is developed by the contributing members of the Rosetta Commons.
4
# (c) For more information, see http://www.rosettacommons.org. Questions about this can be
5
# (c) addressed to University of Washington UW TechTransfer, email: license@u.washington.edu.
6
7
class
Node
(object):
8
def
__init__
(self, tag, value, start_mark, end_mark):
9
self.
tag
= tag
10
self.
value
= value
11
self.
start_mark
= start_mark
12
self.
end_mark
= end_mark
13
def
__repr__
(self):
14
value = self.
value
15
#if isinstance(value, list):
16
# if len(value) == 0:
17
# value = '<empty>'
18
# elif len(value) == 1:
19
# value = '<1 item>'
20
# else:
21
# value = '<%d items>' % len(value)
22
#else:
23
# if len(value) > 75:
24
# value = repr(value[:70]+u' ... ')
25
# else:
26
# value = repr(value)
27
value = repr(value)
28
return
'%s(tag=%r, value=%s)'
% (self.__class__.__name__, self.
tag
, value)
29
30
class
ScalarNode
(
Node
):
31
id =
'scalar'
32
def
__init__
(self, tag, value,
33
start_mark=
None
, end_mark=
None
, style=
None
):
34
self.
tag
= tag
35
self.
value
= value
36
self.
start_mark
= start_mark
37
self.
end_mark
= end_mark
38
self.
style
= style
39
40
class
CollectionNode
(
Node
):
41
def
__init__
(self, tag, value,
42
start_mark=
None
, end_mark=
None
, flow_style=
None
):
43
self.
tag
= tag
44
self.
value
= value
45
self.
start_mark
= start_mark
46
self.
end_mark
= end_mark
47
self.
flow_style
= flow_style
48
49
class
SequenceNode
(
CollectionNode
):
50
id =
'sequence'
51
52
class
MappingNode
(
CollectionNode
):
53
id =
'mapping'
54
yaml.nodes.Node.__repr__
def __repr__
Definition:
nodes.py:13
yaml.nodes.Node.tag
tag
Definition:
nodes.py:9
yaml.nodes.ScalarNode.__init__
def __init__
Definition:
nodes.py:33
yaml.nodes.CollectionNode.flow_style
flow_style
Definition:
nodes.py:47
yaml.nodes.Node
Definition:
nodes.py:7
yaml.nodes.Node.end_mark
end_mark
Definition:
nodes.py:12
yaml.nodes.Node.__init__
def __init__
Definition:
nodes.py:8
yaml.nodes.ScalarNode.style
style
Definition:
nodes.py:38
yaml.nodes.CollectionNode
Definition:
nodes.py:40
yaml.nodes.SequenceNode
Definition:
nodes.py:49
yaml.nodes.Node.start_mark
start_mark
Definition:
nodes.py:11
yaml.nodes.Node.value
value
Definition:
nodes.py:10
yaml.nodes.CollectionNode.__init__
def __init__
Definition:
nodes.py:42
yaml.nodes.MappingNode
Definition:
nodes.py:52
yaml.nodes.ScalarNode
Definition:
nodes.py:30
Generated on Sun Jan 17 2016 15:23:10 for Rosetta by
1.8.7