(self, n=-1)
return new_bytes
Read n bytes from stream with codepage conversion.
Read n bytes from stream with codepage conversion.
Read n bytes from stream with codepage conversion .
def read(self, n=-1):
        """Read n bytes from stream with codepage conversion."""
        new_bytes = self._stream.read(n)
        if new_bytes:
            new_last = new_bytes[-1:]
            if self._last == b'\r' and new_bytes.startswith(b'\n'):
                new_bytes = new_bytes[1:]
            self._last = new_last
            new_bytes = new_bytes.replace(b'\r\n', b'\r').replace(b'\n', b'\r')
        return new_bytes
def read ( self , n = - 1 ) : new_bytes = self . _stream . read ( n ) if new_bytes : new_last = new_bytes [ - 1 : ] if self . _last == b'\r' and new_bytes . startswith ( b'\n' ) : new_bytes = new_bytes [ 1 : ] self . _last = new_last new_bytes = new_bytes . replace ( b'\r\n' , b'\r' ) . replace ( b'\n' , b'\r' ) return new_bytes