Python termios 模块,tcflush() 实例源码

我们从Python开源项目中,提取了以下48个代码示例,用于说明如何使用termios.tcflush()

项目:a_sync    作者:notion    | 项目源码 | 文件源码
def a_input(prompt: str) -> str:
    """Async input prompt."""
    readable = []  # type: List[int]
    print(prompt, end='')
    sys.stdout.flush()
    while not readable:
        readable, _, _ = select.select([sys.stdin], [], [], 0)
        try:
            await asyncio.sleep(0.1)
        except futures.CancelledError:
            print("input cancelled...")
            termios.tcflush(sys.stdin, termios.TCIFLUSH)
            raise
    return sys.stdin.readline().rstrip()


# [ Classes ]
项目:android3dblendermouse    作者:sketchpunk    | 项目源码 | 文件源码
def reset_input_buffer(self):
        """Clear input buffer, discarding all that is in the buffer."""
        if not self.is_open:
            raise portNotOpenError
        termios.tcflush(self.fd, termios.TCIFLUSH)
项目:android3dblendermouse    作者:sketchpunk    | 项目源码 | 文件源码
def reset_output_buffer(self):
        """\
        Clear output buffer, aborting the current output and discarding all
        that is in the buffer.
        """
        if not self.is_open:
            raise portNotOpenError
        termios.tcflush(self.fd, termios.TCOFLUSH)
项目:pyrepl    作者:dajose    | 项目源码 | 文件源码
def forgetinput(self):
        termios.tcflush(self.input_fd, termios.TCIFLUSH)
项目:microperi    作者:c0d3st0rm    | 项目源码 | 文件源码
def reset_input_buffer(self):
        """Clear input buffer, discarding all that is in the buffer."""
        if not self.is_open:
            raise portNotOpenError
        termios.tcflush(self.fd, termios.TCIFLUSH)
项目:microperi    作者:c0d3st0rm    | 项目源码 | 文件源码
def reset_output_buffer(self):
        """\
        Clear output buffer, aborting the current output and discarding all
        that is in the buffer.
        """
        if not self.is_open:
            raise portNotOpenError
        termios.tcflush(self.fd, termios.TCOFLUSH)
项目:microbit-gateway    作者:whaleygeek    | 项目源码 | 文件源码
def flushInput(self):
        """Clear input buffer, discarding all that is in the buffer."""
        if not self._isOpen: raise portNotOpenError
        termios.tcflush(self.fd, TERMIOS.TCIFLUSH)
项目:microbit-gateway    作者:whaleygeek    | 项目源码 | 文件源码
def flushOutput(self):
        """Clear output buffer, aborting the current output and
        discarding all that is in the buffer."""
        if not self._isOpen: raise portNotOpenError
        termios.tcflush(self.fd, TERMIOS.TCOFLUSH)
项目:mb_remote    作者:whaleygeek    | 项目源码 | 文件源码
def flushInput(self):
        """Clear input buffer, discarding all that is in the buffer."""
        if not self._isOpen: raise portNotOpenError
        termios.tcflush(self.fd, TERMIOS.TCIFLUSH)
项目:mb_remote    作者:whaleygeek    | 项目源码 | 文件源码
def flushOutput(self):
        """Clear output buffer, aborting the current output and
        discarding all that is in the buffer."""
        if not self._isOpen: raise portNotOpenError
        termios.tcflush(self.fd, TERMIOS.TCOFLUSH)
项目:gcodeplot    作者:arpruss    | 项目源码 | 文件源码
def reset_input_buffer(self):
        """Clear input buffer, discarding all that is in the buffer."""
        if not self.is_open:
            raise portNotOpenError
        termios.tcflush(self.fd, termios.TCIFLUSH)
项目:gcodeplot    作者:arpruss    | 项目源码 | 文件源码
def reset_output_buffer(self):
        """\
        Clear output buffer, aborting the current output and discarding all
        that is in the buffer.
        """
        if not self.is_open:
            raise portNotOpenError
        termios.tcflush(self.fd, termios.TCOFLUSH)
项目:gcodeplot    作者:arpruss    | 项目源码 | 文件源码
def flushInput(self):
        """Clear input buffer, discarding all that is in the buffer."""
        if not self._isOpen: raise portNotOpenError
        termios.tcflush(self.fd, TERMIOS.TCIFLUSH)
项目:gcodeplot    作者:arpruss    | 项目源码 | 文件源码
def flushOutput(self):
        """Clear output buffer, aborting the current output and
        discarding all that is in the buffer."""
        if not self._isOpen: raise portNotOpenError
        termios.tcflush(self.fd, TERMIOS.TCOFLUSH)
项目:bitio    作者:whaleygeek    | 项目源码 | 文件源码
def reset_input_buffer(self):
        """Clear input buffer, discarding all that is in the buffer."""
        if not self.is_open:
            raise portNotOpenError
        termios.tcflush(self.fd, termios.TCIFLUSH)
项目:bitio    作者:whaleygeek    | 项目源码 | 文件源码
def reset_output_buffer(self):
        """\
        Clear output buffer, aborting the current output and discarding all
        that is in the buffer.
        """
        if not self.is_open:
            raise portNotOpenError
        termios.tcflush(self.fd, termios.TCOFLUSH)
项目:microbit-serial    作者:martinohanlon    | 项目源码 | 文件源码
def reset_input_buffer(self):
        """Clear input buffer, discarding all that is in the buffer."""
        if not self.is_open:
            raise portNotOpenError
        termios.tcflush(self.fd, termios.TCIFLUSH)
项目:microbit-serial    作者:martinohanlon    | 项目源码 | 文件源码
def reset_output_buffer(self):
        """\
        Clear output buffer, aborting the current output and discarding all
        that is in the buffer.
        """
        if not self.is_open:
            raise portNotOpenError
        termios.tcflush(self.fd, termios.TCOFLUSH)
项目:CANbit    作者:whaleygeek    | 项目源码 | 文件源码
def flushInput(self):
        """Clear input buffer, discarding all that is in the buffer."""
        if not self._isOpen: raise portNotOpenError
        termios.tcflush(self.fd, TERMIOS.TCIFLUSH)
项目:CANbit    作者:whaleygeek    | 项目源码 | 文件源码
def flushOutput(self):
        """Clear output buffer, aborting the current output and
        discarding all that is in the buffer."""
        if not self._isOpen: raise portNotOpenError
        termios.tcflush(self.fd, TERMIOS.TCOFLUSH)
项目:driveboardapp    作者:nortd    | 项目源码 | 文件源码
def flushInput(self):
        """Clear input buffer, discarding all that is in the buffer."""
        if not self._isOpen: raise portNotOpenError
        termios.tcflush(self.fd, TERMIOS.TCIFLUSH)
项目:driveboardapp    作者:nortd    | 项目源码 | 文件源码
def flushOutput(self):
        """\
        Clear output buffer, aborting the current output and discarding all
        that is in the buffer.
        """
        if not self._isOpen: raise portNotOpenError
        termios.tcflush(self.fd, TERMIOS.TCOFLUSH)
项目:Parlay    作者:PromenadeSoftware    | 项目源码 | 文件源码
def flushInput(self):
        """Clear input buffer, discarding all that is in the buffer."""
        termios.tcflush(self._f.fileno(), termios.TCIFLUSH)
项目:Parlay    作者:PromenadeSoftware    | 项目源码 | 文件源码
def flushOutput(self):
        """Clear output buffer, aborting the current output and
        discarding all that is in the buffer."""
        termios.tcflush(self._f.fileno(), termios.TCOFLUSH)
项目:overhead_mobile_tracker    作者:NU-MSR    | 项目源码 | 文件源码
def flush(self):
        """
        flush stdin... untested on Windows"
        """
        if os.name == 'nt':
            while self.kbhit():
                self.getch()
        else:
            termios.tcflush(sys.stdin, termios.TCIOFLUSH)
        return


# Test
项目:mb_sdcard    作者:whaleygeek    | 项目源码 | 文件源码
def flushInput(self):
        """Clear input buffer, discarding all that is in the buffer."""
        if not self._isOpen: raise portNotOpenError
        termios.tcflush(self.fd, TERMIOS.TCIFLUSH)
项目:mb_sdcard    作者:whaleygeek    | 项目源码 | 文件源码
def flushOutput(self):
        """Clear output buffer, aborting the current output and
        discarding all that is in the buffer."""
        if not self._isOpen: raise portNotOpenError
        termios.tcflush(self.fd, TERMIOS.TCOFLUSH)
项目:ddt4all    作者:cedricp    | 项目源码 | 文件源码
def reset_input_buffer(self):
        """Clear input buffer, discarding all that is in the buffer."""
        if not self.is_open:
            raise portNotOpenError
        termios.tcflush(self.fd, termios.TCIFLUSH)
项目:ddt4all    作者:cedricp    | 项目源码 | 文件源码
def reset_output_buffer(self):
        """\
        Clear output buffer, aborting the current output and discarding all
        that is in the buffer.
        """
        if not self.is_open:
            raise portNotOpenError
        termios.tcflush(self.fd, termios.TCOFLUSH)
项目:mt7687-serial-uploader    作者:will127534    | 项目源码 | 文件源码
def reset_input_buffer(self):
        """Clear input buffer, discarding all that is in the buffer."""
        if not self.is_open:
            raise portNotOpenError
        termios.tcflush(self.fd, termios.TCIFLUSH)
项目:mt7687-serial-uploader    作者:will127534    | 项目源码 | 文件源码
def reset_output_buffer(self):
        """\
        Clear output buffer, aborting the current output and discarding all
        that is in the buffer.
        """
        if not self.is_open:
            raise portNotOpenError
        termios.tcflush(self.fd, termios.TCOFLUSH)
项目:pefile.pypy    作者:cloudtracer    | 项目源码 | 文件源码
def forgetinput(self):
        termios.tcflush(self.input_fd, termios.TCIFLUSH)
项目:get_started_with_respeaker    作者:respeaker    | 项目源码 | 文件源码
def flushInput(self):
        """Clear input buffer, discarding all that is in the buffer."""
        if not self._isOpen: raise portNotOpenError
        termios.tcflush(self.fd, TERMIOS.TCIFLUSH)
项目:get_started_with_respeaker    作者:respeaker    | 项目源码 | 文件源码
def flushOutput(self):
        """Clear output buffer, aborting the current output and
        discarding all that is in the buffer."""
        if not self._isOpen: raise portNotOpenError
        termios.tcflush(self.fd, TERMIOS.TCOFLUSH)
项目:Jackal_Velodyne_Duke    作者:MengGuo    | 项目源码 | 文件源码
def reset_input_buffer(self):
        """Clear input buffer, discarding all that is in the buffer."""
        if not self.is_open:
            raise portNotOpenError
        termios.tcflush(self.fd, termios.TCIFLUSH)
项目:Jackal_Velodyne_Duke    作者:MengGuo    | 项目源码 | 文件源码
def reset_output_buffer(self):
        """\
        Clear output buffer, aborting the current output and discarding all
        that is in the buffer.
        """
        if not self.is_open:
            raise portNotOpenError
        termios.tcflush(self.fd, termios.TCOFLUSH)
项目:Jackal_Velodyne_Duke    作者:MengGuo    | 项目源码 | 文件源码
def reset_input_buffer(self):
        """Clear input buffer, discarding all that is in the buffer."""
        if not self.is_open:
            raise portNotOpenError
        termios.tcflush(self.fd, termios.TCIFLUSH)
项目:Jackal_Velodyne_Duke    作者:MengGuo    | 项目源码 | 文件源码
def reset_output_buffer(self):
        """\
        Clear output buffer, aborting the current output and discarding all
        that is in the buffer.
        """
        if not self.is_open:
            raise portNotOpenError
        termios.tcflush(self.fd, termios.TCOFLUSH)
项目:btc-fpga-miner    作者:marsohod4you    | 项目源码 | 文件源码
def flushInput(self):
        """Clear input buffer, discarding all that is in the buffer."""
        if not self._isOpen: raise portNotOpenError
        termios.tcflush(self.fd, TERMIOS.TCIFLUSH)
项目:btc-fpga-miner    作者:marsohod4you    | 项目源码 | 文件源码
def flushOutput(self):
        """Clear output buffer, aborting the current output and
        discarding all that is in the buffer."""
        if not self._isOpen: raise portNotOpenError
        termios.tcflush(self.fd, TERMIOS.TCOFLUSH)
项目:btc-fpga-miner    作者:marsohod4you    | 项目源码 | 文件源码
def flushInput(self):
        """Clear input buffer, discarding all that is in the buffer."""
        if not self._isOpen: raise portNotOpenError
        termios.tcflush(self.fd, TERMIOS.TCIFLUSH)
项目:btc-fpga-miner    作者:marsohod4you    | 项目源码 | 文件源码
def flushOutput(self):
        """Clear output buffer, aborting the current output and
        discarding all that is in the buffer."""
        if not self._isOpen: raise portNotOpenError
        termios.tcflush(self.fd, TERMIOS.TCOFLUSH)
项目:helios-server-mixnet    作者:RunasSudo    | 项目源码 | 文件源码
def getch(self):
                termios.tcflush(0, termios.TCIFLUSH) # XXX Leave this in?
                return os.read(self._fd, 1)
项目:helios-server-mixnet    作者:RunasSudo    | 项目源码 | 文件源码
def close(self, delay = 0):
                if delay:
                    time.sleep(delay)
                    termios.tcflush(self._fd, termios.TCIFLUSH)
                termios.tcsetattr(self._fd, termios.TCSAFLUSH, self._old)
项目:helios-server-mixnet    作者:RunasSudo    | 项目源码 | 文件源码
def getch(self):
                termios.tcflush(0, termios.TCIFLUSH) # XXX Leave this in?
                return os.read(self._fd, 1)
项目:helios-server-mixnet    作者:RunasSudo    | 项目源码 | 文件源码
def close(self, delay = 0):
                if delay:
                    time.sleep(delay)
                    termios.tcflush(self._fd, termios.TCIFLUSH)
                termios.tcsetattr(self._fd, termios.TCSAFLUSH, self._old)
项目:ftcommunity-apps    作者:ftCommunity    | 项目源码 | 文件源码
def reset_input_buffer(self):
        """Clear input buffer, discarding all that is in the buffer."""
        if not self.is_open:
            raise portNotOpenError
        termios.tcflush(self.fd, termios.TCIFLUSH)
项目:ftcommunity-apps    作者:ftCommunity    | 项目源码 | 文件源码
def reset_output_buffer(self):
        """\
        Clear output buffer, aborting the current output and discarding all
        that is in the buffer.
        """
        if not self.is_open:
            raise portNotOpenError
        termios.tcflush(self.fd, termios.TCOFLUSH)