(self)
return not eof
Read and decode the next chunk of data from the BufferedReader.
Read and decode the next chunk of data from the BufferedReader.
Read and decode the next chunk of data from the BufferedReader .
def _read_chunk(self):
        """
        Read and decode the next chunk of data from the BufferedReader.
        """

        # The return value is True unless EOF was reached.  The decoded
        # string is placed in self._decoded_chars (replacing its previous
        # value).  The entire input chunk is sent to the decoder, though
        # some of it may remain buffered in the decoder, yet to be
        # converted.

        if self._decoder is None:
            raise ValueError("no decoder")

        if self._telling:
            # To prepare for tell(), we need to snapshot a point in the
            # file where the decoder's input buffer is empty.

            dec_buffer, dec_flags = self._decoder.getstate()
            # Given this, we know there was a valid snapshot point
            # len(dec_buffer) bytes ago with decoder state (b'', dec_flags).

        # Read a chunk, decode it, and put the result in self._decoded_chars.
        if self._has_read1:
            input_chunk = self.buffer.read1(self._CHUNK_SIZE)
        else:
            input_chunk = self.buffer.read(self._CHUNK_SIZE)
        eof = not input_chunk
        decoded_chars = self._decoder.decode(input_chunk, eof)
        self._set_decoded_chars(decoded_chars)
        if decoded_chars:
            self._b2cratio = len(input_chunk) / len(self._decoded_chars)
        else:
            self._b2cratio = 0.0

        if self._telling:
            # At the snapshot point, len(dec_buffer) bytes before the read,
            # the next input to be decoded is dec_buffer + input_chunk.
            self._snapshot = (dec_flags, dec_buffer + input_chunk)

        return not eof
def _read_chunk ( self ) : # The return value is True unless EOF was reached.  The decoded # string is placed in self._decoded_chars (replacing its previous # value).  The entire input chunk is sent to the decoder, though # some of it may remain buffered in the decoder, yet to be # converted. if self . _decoder is None : raise ValueError ( "no decoder" ) if self . _telling : # To prepare for tell(), we need to snapshot a point in the # file where the decoder's input buffer is empty. dec_buffer , dec_flags = self . _decoder . getstate ( ) # Given this, we know there was a valid snapshot point # len(dec_buffer) bytes ago with decoder state (b'', dec_flags). # Read a chunk, decode it, and put the result in self._decoded_chars. if self . _has_read1 : input_chunk = self . buffer . read1 ( self . _CHUNK_SIZE ) else : input_chunk = self . buffer . read ( self . _CHUNK_SIZE ) eof = not input_chunk decoded_chars = self . _decoder . decode ( input_chunk , eof ) self . _set_decoded_chars ( decoded_chars ) if decoded_chars : self . _b2cratio = len ( input_chunk ) / len ( self . _decoded_chars ) else : self . _b2cratio = 0.0 if self . _telling : # At the snapshot point, len(dec_buffer) bytes before the read, # the next input to be decoded is dec_buffer + input_chunk. self . _snapshot = ( dec_flags , dec_buffer + input_chunk ) return not eof