python类ECHO的实例源码

__init__.py 文件源码 项目:tools 作者: InfraSIM 项目源码 文件源码 阅读 23 收藏 0 点赞 0 评论 0
def getecho(self):
        '''This returns the terminal echo mode. This returns True if echo is
        on or False if echo is off. Child applications that are expecting you
        to enter a password often set ECHO False. See waitnoecho().

        Not supported on platforms where ``isatty()`` returns False.  '''

        try:
            attr = termios.tcgetattr(self.child_fd)
        except termios.error as err:
            errmsg = 'getecho() may not be called on this platform'
            if err.args[0] == errno.EINVAL:
                raise IOError(err.args[0], '%s: %s.' % (err.args[1], errmsg))
            raise

        self.echo = bool(attr[3] & termios.ECHO)
        return self.echo
terminal.py 文件源码 项目:darkc0de-old-stuff 作者: tuwid 项目源码 文件源码 阅读 31 收藏 0 点赞 0 评论 0
def enableEchoMode():
    fd = stdin.fileno()
    state = tcgetattr(fd)
    if state[TERMIO_LFLAGS] & ECHO:
        return False
    state[TERMIO_LFLAGS] = state[TERMIO_LFLAGS] | ECHO
    tcsetattr(fd, TCSADRAIN, state)
    return True
autoreload.py 文件源码 项目:CodingDojo 作者: ComputerSocietyUNB 项目源码 文件源码 阅读 34 收藏 0 点赞 0 评论 0
def ensure_echo_on():
    if termios:
        fd = sys.stdin
        if fd.isatty():
            attr_list = termios.tcgetattr(fd)
            if not attr_list[3] & termios.ECHO:
                attr_list[3] |= termios.ECHO
                if hasattr(signal, 'SIGTTOU'):
                    old_handler = signal.signal(signal.SIGTTOU, signal.SIG_IGN)
                else:
                    old_handler = None
                termios.tcsetattr(fd, termios.TCSANOW, attr_list)
                if old_handler is not None:
                    signal.signal(signal.SIGTTOU, old_handler)
miniterm.py 文件源码 项目:android3dblendermouse 作者: sketchpunk 项目源码 文件源码 阅读 19 收藏 0 点赞 0 评论 0
def setup(self):
            new = termios.tcgetattr(self.fd)
            new[3] = new[3] & ~termios.ICANON & ~termios.ECHO & ~termios.ISIG
            new[6][termios.VMIN] = 1
            new[6][termios.VTIME] = 0
            termios.tcsetattr(self.fd, termios.TCSANOW, new)
unix_console.py 文件源码 项目:pyrepl 作者: dajose 项目源码 文件源码 阅读 32 收藏 0 点赞 0 评论 0
def prepare(self):
        # per-readline preparations:
        self.__svtermstate = tcgetattr(self.input_fd)
        raw = self.__svtermstate.copy()
        raw.iflag |= termios.ICRNL
        raw.iflag &= ~(termios.BRKINT | termios.INPCK |
                       termios.ISTRIP | termios.IXON)
        raw.oflag &= ~termios.OPOST
        raw.cflag &= ~(termios.CSIZE | termios.PARENB)
        raw.cflag |= (termios.CS8)
        raw.lflag &= ~(termios.ICANON | termios.ECHO |
                       termios.IEXTEN | (termios.ISIG * 1))
        raw.cc[termios.VMIN] = 1
        raw.cc[termios.VTIME] = 0
        tcsetattr(self.input_fd, termios.TCSADRAIN, raw)

        self.screen = []
        self.height, self.width = self.getheightwidth()

        self.__buffer = []

        self.__posxy = 0, 0
        self.__gone_tall = 0
        self.__move = self.__move_short
        self.__offset = 0

        self.__maybe_write_code(self._smkx)

        try:
            self.old_sigwinch = signal.signal(
                signal.SIGWINCH, self.__sigwinch)
        except ValueError:
            pass
miniterm.py 文件源码 项目:microperi 作者: c0d3st0rm 项目源码 文件源码 阅读 24 收藏 0 点赞 0 评论 0
def setup(self):
            new = termios.tcgetattr(self.fd)
            new[3] = new[3] & ~termios.ICANON & ~termios.ECHO & ~termios.ISIG
            new[6][termios.VMIN] = 1
            new[6][termios.VTIME] = 0
            termios.tcsetattr(self.fd, termios.TCSANOW, new)
miniterm.py 文件源码 项目:microbit-gateway 作者: whaleygeek 项目源码 文件源码 阅读 20 收藏 0 点赞 0 评论 0
def setup(self):
            self.old = termios.tcgetattr(self.fd)
            new = termios.tcgetattr(self.fd)
            new[3] = new[3] & ~termios.ICANON & ~termios.ECHO & ~termios.ISIG
            new[6][termios.VMIN] = 1
            new[6][termios.VTIME] = 0
            termios.tcsetattr(self.fd, termios.TCSANOW, new)
miniterm.py 文件源码 项目:mb_remote 作者: whaleygeek 项目源码 文件源码 阅读 21 收藏 0 点赞 0 评论 0
def setup(self):
            self.old = termios.tcgetattr(self.fd)
            new = termios.tcgetattr(self.fd)
            new[3] = new[3] & ~termios.ICANON & ~termios.ECHO & ~termios.ISIG
            new[6][termios.VMIN] = 1
            new[6][termios.VTIME] = 0
            termios.tcsetattr(self.fd, termios.TCSANOW, new)
miniterm.py 文件源码 项目:gcodeplot 作者: arpruss 项目源码 文件源码 阅读 24 收藏 0 点赞 0 评论 0
def setup(self):
            new = termios.tcgetattr(self.fd)
            new[3] = new[3] & ~termios.ICANON & ~termios.ECHO & ~termios.ISIG
            new[6][termios.VMIN] = 1
            new[6][termios.VTIME] = 0
            termios.tcsetattr(self.fd, termios.TCSANOW, new)
miniterm.py 文件源码 项目:gcodeplot 作者: arpruss 项目源码 文件源码 阅读 30 收藏 0 点赞 0 评论 0
def setup(self):
            self.old = termios.tcgetattr(self.fd)
            new = termios.tcgetattr(self.fd)
            new[3] = new[3] & ~termios.ICANON & ~termios.ECHO & ~termios.ISIG
            new[6][termios.VMIN] = 1
            new[6][termios.VTIME] = 0
            termios.tcsetattr(self.fd, termios.TCSANOW, new)
vt100_input.py 文件源码 项目:Liljimbo-Chatbot 作者: chrisjim316 项目源码 文件源码 阅读 24 收藏 0 点赞 0 评论 0
def _patch_lflag(cls, attrs):
        return attrs & ~(termios.ECHO | termios.ICANON | termios.IEXTEN | termios.ISIG)
vt100_input.py 文件源码 项目:Liljimbo-Chatbot 作者: chrisjim316 项目源码 文件源码 阅读 25 收藏 0 点赞 0 评论 0
def _patch_lflag(cls, attrs):
        return attrs | (termios.ECHO | termios.ICANON | termios.IEXTEN | termios.ISIG)
vt100_input.py 文件源码 项目:leetcode 作者: thomasyimgit 项目源码 文件源码 阅读 28 收藏 0 点赞 0 评论 0
def _patch_lflag(cls, attrs):
        return attrs & ~(termios.ECHO | termios.ICANON | termios.IEXTEN | termios.ISIG)
vt100_input.py 文件源码 项目:leetcode 作者: thomasyimgit 项目源码 文件源码 阅读 26 收藏 0 点赞 0 评论 0
def _patch_lflag(cls, attrs):
        return attrs | (termios.ECHO | termios.ICANON | termios.IEXTEN | termios.ISIG)
miniterm.py 文件源码 项目:bitio 作者: whaleygeek 项目源码 文件源码 阅读 22 收藏 0 点赞 0 评论 0
def setup(self):
            new = termios.tcgetattr(self.fd)
            new[3] = new[3] & ~termios.ICANON & ~termios.ECHO & ~termios.ISIG
            new[6][termios.VMIN] = 1
            new[6][termios.VTIME] = 0
            termios.tcsetattr(self.fd, termios.TCSANOW, new)
keyboard.py 文件源码 项目:crazyswarm 作者: USC-ACTLab 项目源码 文件源码 阅读 24 收藏 0 点赞 0 评论 0
def __enter__(self):
        # Save the terminal settings
        self.fd = sys.stdin.fileno()
        self.new_term = termios.tcgetattr(self.fd)
        self.old_term = termios.tcgetattr(self.fd)

        # New terminal setting unbuffered
        self.new_term[3] = (self.new_term[3] & ~termios.ICANON & ~termios.ECHO)
        termios.tcsetattr(self.fd, termios.TCSAFLUSH, self.new_term)

        return self
miniterm.py 文件源码 项目:microbit-serial 作者: martinohanlon 项目源码 文件源码 阅读 26 收藏 0 点赞 0 评论 0
def setup(self):
            new = termios.tcgetattr(self.fd)
            new[3] = new[3] & ~termios.ICANON & ~termios.ECHO & ~termios.ISIG
            new[6][termios.VMIN] = 1
            new[6][termios.VTIME] = 0
            termios.tcsetattr(self.fd, termios.TCSANOW, new)
pexpect.py 文件源码 项目:winpexpect 作者: geertj 项目源码 文件源码 阅读 28 收藏 0 点赞 0 评论 0
def getecho (self):

        """This returns the terminal echo mode. This returns True if echo is
        on or False if echo is off. Child applications that are expecting you
        to enter a password often set ECHO False. See waitnoecho(). """

        attr = termios.tcgetattr(self.child_fd)
        if attr[3] & termios.ECHO:
            return True
        return False


问题


面经


文章

微信
公众号

扫码关注公众号