(self, num)
return b''.join(s)
Read a number of characters.
Read a number of characters.
Read a number of characters .
def read(self, num):
        """Read a number of characters."""
        # take at most num chars out of readahead buffer (holds just one on COM but anyway)
        s, self._readahead = self._readahead[:num], self._readahead[num:]
        while len(s) < num:
            self._queues.wait()
            with safe_io():
                # non-blocking read
                self._current, self._previous = self._fhandle.read(1), self._current
            if self._current:
                s.append(self._current)
        logging.debug('Reading from serial port %s: %r', self._fhandle.port, b''.join(s))
        return b''.join(s)
def read ( self , num ) : # take at most num chars out of readahead buffer (holds just one on COM but anyway) s , self . _readahead = self . _readahead [ : num ] , self . _readahead [ num : ] while len ( s ) < num : self . _queues . wait ( ) with safe_io ( ) : # non-blocking read self . _current , self . _previous = self . _fhandle . read ( 1 ) , self . _current if self . _current : s . append ( self . _current ) logging . debug ( 'Reading from serial port %s: %r' , self . _fhandle . port , b'' . join ( s ) ) return b'' . join ( s )