(self)
return s
Read all chars available; nonblocking; returns unicode.
Read all chars available; nonblocking; returns unicode.
Read all chars available ; nonblocking ; returns unicode .
def read(self):
        """Read all chars available; nonblocking; returns unicode."""
        # we need non-blocking readers
        s = read_all_available(self._stream)
        # can be None (closed) or b'' (no input)
        if s is None:
            return None
        elif not s:
            return u''
        if isinstance(s, bytes):
            # raw input means it's already in the BASIC codepage
            # but the keyboard functions use unicode
            # for input, don't use lead-byte buffering beyond the convert call
            s = self._codepage.bytes_to_unicode(s, preserve=CONTROL)
        # replace CRLF (and, if desired, LF) with CR
        s = s.replace(u'\r\n', u'\r')
        if self._lfcr:
            s = s.replace(u'\n', u'\r')
        return s
def read ( self ) : # we need non-blocking readers s = read_all_available ( self . _stream ) # can be None (closed) or b'' (no input) if s is None : return None elif not s : return u'' if isinstance ( s , bytes ) : # raw input means it's already in the BASIC codepage # but the keyboard functions use unicode # for input, don't use lead-byte buffering beyond the convert call s = self . _codepage . bytes_to_unicode ( s , preserve = CONTROL ) # replace CRLF (and, if desired, LF) with CR s = s . replace ( u'\r\n' , u'\r' ) if self . _lfcr : s = s . replace ( u'\n' , u'\r' ) return s