diff options
Diffstat (limited to 'third_party/python/PyYAML/lib/yaml/error.py')
-rw-r--r-- | third_party/python/PyYAML/lib/yaml/error.py | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/third_party/python/PyYAML/lib/yaml/error.py b/third_party/python/PyYAML/lib/yaml/error.py index 577686db5f..b796b4dc51 100644 --- a/third_party/python/PyYAML/lib/yaml/error.py +++ b/third_party/python/PyYAML/lib/yaml/error.py @@ -1,7 +1,7 @@ __all__ = ['Mark', 'YAMLError', 'MarkedYAMLError'] -class Mark(object): +class Mark: def __init__(self, name, index, line, column, buffer, pointer): self.name = name @@ -16,7 +16,7 @@ class Mark(object): return None head = '' start = self.pointer - while start > 0 and self.buffer[start-1] not in u'\0\r\n\x85\u2028\u2029': + while start > 0 and self.buffer[start-1] not in '\0\r\n\x85\u2028\u2029': start -= 1 if self.pointer-start > max_length/2-1: head = ' ... ' @@ -24,13 +24,13 @@ class Mark(object): break tail = '' end = self.pointer - while end < len(self.buffer) and self.buffer[end] not in u'\0\r\n\x85\u2028\u2029': + while end < len(self.buffer) and self.buffer[end] not in '\0\r\n\x85\u2028\u2029': end += 1 if end-self.pointer > max_length/2-1: tail = ' ... ' end -= 5 break - snippet = self.buffer[start:end].encode('utf-8') + snippet = self.buffer[start:end] return ' '*indent + head + snippet + tail + '\n' \ + ' '*(indent+self.pointer-start+len(head)) + '^' |