def __read(self, read, size): if size is None or size < 0: return MultibyteIncrementalDecoder.decode(self, read(), True) while True: data = read(size) final = not data output = MultibyteIncrementalDecoder.decode(self, data, final) if output or final: return output size = 1 # read 1 more byte and retry
def __new__(cls, stream, errors=None): self = MultibyteIncrementalDecoder.__new__(cls, errors) self.stream = stream return self