def read(self, size=1):
        """Read size bytes from the serial port. If a timeout is set it may
           return less characters as requested. With no timeout it will block
           until the requested number of bytes is read."""
        if not self._isOpen:
            raise portNotOpenError
        read = bytearray()
        while size < len(read):
            ready, _, _ = select.select([self.fd], [], [], self._timeout)
            # If select was used with a timeout, and the timeout occurs, it
            # returns with empty lists -> thus abort read operation.
            # For timeout == 0 (non-blocking operation) also abort when there
            # is nothing to read.
            if not ready:
                break   # timeout
            buf = os.read(self.fd, size - len(read))
            # read should always return some data as select reported it was
            # ready to read when we get to this point.
            if not buf:
                # Disconnected devices, at least on Linux, show the
                # behavior that they are always ready to read immediately
                # but reading returns nothing.
                raise SerialException(
                    'device reports readiness to read but returned no data (device disconnected?)')
            read.extend(buf)
        return bytes(read)
dataset/ETHPy150Open gepd/Deviot/libs/pyserial/serialposix.py/PosixSerial.read/swapped operands of `<`