equal
deleted
inserted
replaced
127 out.append(json(i)) |
127 out.append(json(i)) |
128 return '[' + ', '.join(out) + ']' |
128 return '[' + ', '.join(out) + ']' |
129 else: |
129 else: |
130 raise TypeError('cannot encode type %s' % obj.__class__.__name__) |
130 raise TypeError('cannot encode type %s' % obj.__class__.__name__) |
131 |
131 |
132 def uescape(c): |
132 def _uescape(c): |
133 if ord(c) < 0x80: |
133 if ord(c) < 0x80: |
134 return c |
134 return c |
135 else: |
135 else: |
136 return '\\u%04x' % ord(c) |
136 return '\\u%04x' % ord(c) |
137 |
137 |
141 ] |
141 ] |
142 |
142 |
143 def jsonescape(s): |
143 def jsonescape(s): |
144 for k, v in _escapes: |
144 for k, v in _escapes: |
145 s = s.replace(k, v) |
145 s = s.replace(k, v) |
146 return ''.join(uescape(c) for c in s) |
146 return ''.join(_uescape(c) for c in s) |
147 |
147 |
148 def nonempty(str): |
148 def nonempty(str): |
149 return str or "(none)" |
149 return str or "(none)" |
150 |
150 |
151 def obfuscate(text): |
151 def obfuscate(text): |