

def ComPortThread(self):
    '        Thread that handles the incoming traffic. Does the basic input\n        transformation (newlines) and generates an SerialRxEvent\n        '
    while self.alive.isSet():
        b = self.serial.read((self.serial.in_waiting or 1))
        if b:
            if (self.settings.newline == NEWLINE_CR):
                b = b.replace(b'\r', b'\n')
            elif (self.settings.newline == NEWLINE_LF):
                pass
            elif (self.settings.newline == NEWLINE_CRLF):
                b = b.replace(b'\r\n', b'\n')
            event = SerialRxEvent(self.GetId(), b)
            self.GetEventHandler().AddPendingEvent(event)

dataset/ETHPy150Open pyserial/pyserial/examples/wxTerminal.py TerminalFrame.ComPortThread/original