Last change
on this file since 1739 was
898,
checked in by hartmans, 16 years ago
|
Add pyyaml and libyaml packages
backported from lenny.
There is discussion about how these should go in the repository; these are added in this form
in order to make forward progress.
|
File size:
1.4 KB
|
Line | |
---|
1 | |
---|
2 | class Node(object): |
---|
3 | def __init__(self, tag, value, start_mark, end_mark): |
---|
4 | self.tag = tag |
---|
5 | self.value = value |
---|
6 | self.start_mark = start_mark |
---|
7 | self.end_mark = end_mark |
---|
8 | def __repr__(self): |
---|
9 | value = self.value |
---|
10 | #if isinstance(value, list): |
---|
11 | # if len(value) == 0: |
---|
12 | # value = '<empty>' |
---|
13 | # elif len(value) == 1: |
---|
14 | # value = '<1 item>' |
---|
15 | # else: |
---|
16 | # value = '<%d items>' % len(value) |
---|
17 | #else: |
---|
18 | # if len(value) > 75: |
---|
19 | # value = repr(value[:70]+u' ... ') |
---|
20 | # else: |
---|
21 | # value = repr(value) |
---|
22 | value = repr(value) |
---|
23 | return '%s(tag=%r, value=%s)' % (self.__class__.__name__, self.tag, value) |
---|
24 | |
---|
25 | class ScalarNode(Node): |
---|
26 | id = 'scalar' |
---|
27 | def __init__(self, tag, value, |
---|
28 | start_mark=None, end_mark=None, style=None): |
---|
29 | self.tag = tag |
---|
30 | self.value = value |
---|
31 | self.start_mark = start_mark |
---|
32 | self.end_mark = end_mark |
---|
33 | self.style = style |
---|
34 | |
---|
35 | class CollectionNode(Node): |
---|
36 | def __init__(self, tag, value, |
---|
37 | start_mark=None, end_mark=None, flow_style=None): |
---|
38 | self.tag = tag |
---|
39 | self.value = value |
---|
40 | self.start_mark = start_mark |
---|
41 | self.end_mark = end_mark |
---|
42 | self.flow_style = flow_style |
---|
43 | |
---|
44 | class SequenceNode(CollectionNode): |
---|
45 | id = 'sequence' |
---|
46 | |
---|
47 | class MappingNode(CollectionNode): |
---|
48 | id = 'mapping' |
---|
49 | |
---|
Note: See
TracBrowser
for help on using the repository browser.