Changeset 153 for pyyaml/trunk/lib/yaml
- Timestamp:
- 05/06/06 18:09:50 (6 years ago)
- Location:
- pyyaml/trunk/lib/yaml
- Files:
-
- 3 modified
-
__init__.py (modified) (1 diff)
-
emitter.py (modified) (2 diffs)
-
nodes.py (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
pyyaml/trunk/lib/yaml/__init__.py
r152 r153 188 188 return dump_all([data], stream, Dumper=SafeDumper, **kwds) 189 189 190 def add_implicit_ detector(tag, regexp, first=None,190 def add_implicit_resolver(tag, regexp, first=None, 191 191 Loader=Loader, Dumper=Dumper): 192 192 """ -
pyyaml/trunk/lib/yaml/emitter.py
r143 r153 698 698 line_breaks = True 699 699 if not (ch == u'\n' or u'\x20' <= ch <= u'\x7E'): 700 if ch < u'\x80' or ch == u'\uFEFF': # '\uFEFF' is BOM. 701 special_characters = True 702 else: 700 if (ch == u'\x85' or u'\xA0' <= ch <= u'\uD7FF' 701 or u'\uE000' <= ch <= u'\uFFFD') and ch != u'\uFEFF': 703 702 unicode_characters = True 704 703 if not self.allow_unicode: 705 704 special_characters = True 705 else: 706 special_characters = True 706 707 707 708 # Spaces, line breaks, and how they are mixed. State machine. … … 962 963 if ch is None or ch in u'"\\\x85\u2028\u2029\uFEFF' \ 963 964 or not (u'\x20' <= ch <= u'\x7E' 964 or (self.allow_unicode and ch > u'\x7F')): 965 or (self.allow_unicode 966 and (u'\xA0' <= ch <= u'\uD7FF' 967 or u'\uE000' <= ch <= u'\uFFFD'))): 965 968 if start < end: 966 969 data = text[start:end] -
pyyaml/trunk/lib/yaml/nodes.py
r136 r153 8 8 def __repr__(self): 9 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) 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) 22 23 return '%s(tag=%r, value=%s)' % (self.__class__.__name__, self.tag, value) 23 24
