Lines Matching +full:ignore +full:- +full:errors
1 """ codecs -- Python Codec Registry, API and helpers.
4 Written by Marc-Andre Lemburg (mal@lemburg.com).
38 # Byte Order Mark (BOM = ZERO WIDTH NO-BREAK SPACE = U+FEFF)
43 # UTF-8
46 # UTF-16, little endian
49 # UTF-16, big endian
52 # UTF-32, little endian
55 # UTF-32, big endian
60 # UTF-16, native endianness
63 # UTF-32, native endianness
68 # UTF-16, native endianness
71 # UTF-32, native endianness
86 # Private API to allow Python 3.4 to denylist the known non-Unicode
119 handling schemes by providing the errors argument. These
122 'strict' - raise a ValueError error (or a subclass)
123 'ignore' - ignore the character and continue with the next
124 'replace' - replace with a suitable replacement character;
128 'surrogateescape' - replace with private code points U+DCnn.
129 'xmlcharrefreplace' - Replace with the appropriate XML
131 'backslashreplace' - Replace with backslashed escape sequences.
132 'namereplace' - Replace with \\N{...} escape sequences
138 def encode(self, input, errors='strict'): argument
143 errors defines the error handling to apply. It defaults to
157 def decode(self, input, errors='strict'): argument
166 errors defines the error handling to apply. It defaults to
186 def __init__(self, errors='strict'): argument
191 providing the errors keyword argument. See the module docstring
194 self.errors = errors
226 def __init__(self, errors='strict'): argument
227 IncrementalEncoder.__init__(self, errors)
231 def _buffer_encode(self, input, errors, final): argument
239 (result, consumed) = self._buffer_encode(data, self.errors, final)
260 def __init__(self, errors='strict'): argument
265 providing the errors keyword argument. See the module docstring
268 self.errors = errors
288 additional_state_info must be a non-negative integer
309 def __init__(self, errors='strict'): argument
310 IncrementalDecoder.__init__(self, errors)
314 def _buffer_decode(self, input, errors, final): argument
322 (result, consumed) = self._buffer_decode(data, self.errors, final)
336 # ignore additional state info
348 def __init__(self, stream, errors='strict'): argument
352 stream must be a file-like object open for writing.
355 schemes by providing the errors keyword argument. These
358 'strict' - raise a ValueError (or a subclass)
359 'ignore' - ignore the character and continue with the next
360 'replace'- replace with a suitable replacement character
361 'xmlcharrefreplace' - Replace with the appropriate XML
363 'backslashreplace' - Replace with backslashed escape
365 'namereplace' - Replace with \\N{...} escape sequences.
371 self.errors = errors
377 data, consumed = self.encode(object, self.errors)
423 def __init__(self, stream, errors='strict'): argument
427 stream must be a file-like object open for reading.
430 schemes by providing the errors keyword argument. These
433 'strict' - raise a ValueError (or a subclass)
434 'ignore' - ignore the character and continue with the next
435 'replace'- replace with a suitable replacement character
436 'backslashreplace' - Replace with backslashed escape sequences;
442 self.errors = errors
448 def decode(self, input, errors='strict'): argument
451 def read(self, size=-1, chars=-1, firstline=False):
463 -1 indicates to read and decode as much as possible. size
504 newchars, decodedbytes = self.decode(data, self.errors)
508 self.decode(data[:exc.start], self.errors)
577 lines[-1] += self.charbuffer
615 way to finding the true end-of-line.
627 from decoding errors.
681 def __init__(self, stream, Reader, Writer, errors='strict'): argument
685 stream must be a Stream-like object.
695 self.reader = Reader(stream, errors)
696 self.writer = Writer(stream, errors)
697 self.errors = errors
699 def read(self, size=-1):
776 errors='strict'): argument
778 """ Creates a StreamRecoder instance which implements a two-way
784 transcodings from e.g. latin-1 to utf-8 and back.
786 stream must be a file-like object.
799 self.reader = Reader(stream, errors)
800 self.writer = Writer(stream, errors)
801 self.errors = errors
803 def read(self, size=-1):
806 data, bytesencoded = self.encode(data, self.errors)
815 data, bytesencoded = self.encode(data, self.errors)
821 data, bytesencoded = self.encode(data, self.errors)
828 data, bytesencoded = self.encode(data, self.errors)
836 data, bytesdecoded = self.decode(data, self.errors)
842 data, bytesdecoded = self.decode(data, self.errors)
871 def open(filename, mode='r', encoding=None, errors='strict', buffering=-1): argument
888 errors may be given to define the error handling. It defaults
893 It defaults to -1 which means that the default buffer size will
912 srw = StreamReaderWriter(file, info.streamreader, info.streamwriter, errors)
920 def EncodedFile(file, data_encoding, file_encoding=None, errors='strict'): argument
935 errors may be given to define the error handling. It defaults
950 file_info.streamreader, file_info.streamwriter, errors)
1026 def iterencode(iterator, encoding, errors='strict', **kwargs): argument
1032 errors and kwargs are passed through to the IncrementalEncoder
1035 encoder = getincrementalencoder(encoding)(errors, **kwargs)
1044 def iterdecode(iterator, encoding, errors='strict', **kwargs): argument
1050 errors and kwargs are passed through to the IncrementalDecoder
1053 decoder = getincrementaldecoder(encoding)(errors, **kwargs)
1062 ### Helpers for charmap-based codecs
1066 """ make_identity_dict(rng) -> dict
1099 ignore_errors = lookup_error("ignore")
1105 # In --disable-unicode builds, these error handler are missing
1123 # Make stdout translate Latin-1 output into UTF-8 output
1124 sys.stdout = EncodedFile(sys.stdout, 'latin-1', 'utf-8')
1126 # Have stdin translate Latin-1 input into UTF-8 input
1127 sys.stdin = EncodedFile(sys.stdin, 'utf-8', 'latin-1')