(self, new_mode)
Switch to input or output mode and fix readahaed buffer.
Switch to input or output mode and fix readahaed buffer.
Switch to input or output mode and fix readahaed buffer .
def _switch_mode(self, new_mode):
        """Switch to input or output mode and fix readahaed buffer."""
        if new_mode == b'I' and self.mode == b'O':
            self._fhandle.flush()
            self.mode = b'I'
        elif new_mode == b'O' and self.mode == b'I':
            self._fhandle.seek(-len(self._readahead), 1)
            self._readahead = []
            self._previous, self._current = b'', b''
            self.mode = b'O'
def _switch_mode ( self , new_mode ) : if new_mode == b'I' and self . mode == b'O' : self . _fhandle . flush ( ) self . mode = b'I' elif new_mode == b'O' and self . mode == b'I' : self . _fhandle . seek ( - len ( self . _readahead ) , 1 ) self . _readahead = [ ] self . _previous , self . _current = b'' , b'' self . mode = b'O'