python类insert_text()的实例源码

rlcompleter.py 文件源码 项目:python- 作者: secondtonone1 项目源码 文件源码 阅读 29 收藏 0 点赞 0 评论 0
def complete(self, text, state):
        """Return the next possible completion for 'text'.

        This is called successively with state == 0, 1, 2, ... until it
        returns None.  The completion should begin with 'text'.

        """
        if self.use_main_ns:
            self.namespace = __main__.__dict__

        if not text.strip():
            if state == 0:
                if _readline_available:
                    readline.insert_text('\t')
                    readline.redisplay()
                    return ''
                else:
                    return '\t'
            else:
                return None

        if state == 0:
            if "." in text:
                self.matches = self.attr_matches(text)
            else:
                self.matches = self.global_matches(text)
        try:
            return self.matches[state]
        except IndexError:
            return None
readline_hooks.py 文件源码 项目:pymotw3 作者: reingart 项目源码 文件源码 阅读 30 收藏 0 点赞 0 评论 0
def startup_hook():
    readline.insert_text('from startup_hook')
readline_hooks.py 文件源码 项目:pymotw3 作者: reingart 项目源码 文件源码 阅读 41 收藏 0 点赞 0 评论 0
def pre_input_hook():
    readline.insert_text(' from pre_input_hook')
    readline.redisplay()
rlcompleter.py 文件源码 项目:ivaochdoc 作者: ivaoch 项目源码 文件源码 阅读 37 收藏 0 点赞 0 评论 0
def complete(self, text, state):
        """Return the next possible completion for 'text'.

        This is called successively with state == 0, 1, 2, ... until it
        returns None.  The completion should begin with 'text'.

        """
        if self.use_main_ns:
            self.namespace = __main__.__dict__

        if not text.strip():
            if state == 0:
                if _readline_available:
                    readline.insert_text('\t')
                    readline.redisplay()
                    return ''
                else:
                    return '\t'
            else:
                return None

        if state == 0:
            if "." in text:
                self.matches = self.attr_matches(text)
            else:
                self.matches = self.global_matches(text)
        try:
            return self.matches[state]
        except IndexError:
            return None
remove_mlag_interfaces.py 文件源码 项目:cluster-genesis 作者: open-power-ref-design-toolkit 项目源码 文件源码 阅读 25 收藏 0 点赞 0 评论 0
def rlinput(prompt, prefill=''):
    readline.set_startup_hook(lambda: readline.insert_text(prefill))
    try:
        return raw_input(prompt)
    finally:
        readline.set_startup_hook()
switch-test.py 文件源码 项目:cluster-genesis 作者: open-power-ref-design-toolkit 项目源码 文件源码 阅读 21 收藏 0 点赞 0 评论 0
def rlinput(prompt, prefill=''):
    readline.set_startup_hook(lambda: readline.insert_text(prefill))
    try:
        return raw_input(prompt)
    finally:
        readline.set_startup_hook()
show_status.py 文件源码 项目:cluster-genesis 作者: open-power-ref-design-toolkit 项目源码 文件源码 阅读 31 收藏 0 点赞 0 评论 0
def rlinput(prompt, prefill=''):
    readline.set_startup_hook(lambda: readline.insert_text(prefill))
    try:
        return raw_input(prompt)
    finally:
        readline.set_startup_hook()
show_mgmt_switches.py 文件源码 项目:cluster-genesis 作者: open-power-ref-design-toolkit 项目源码 文件源码 阅读 23 收藏 0 点赞 0 评论 0
def rlinput(prompt, prefill=''):
    readline.set_startup_hook(lambda: readline.insert_text(prefill))
    try:
        return raw_input(prompt)
    finally:
        readline.set_startup_hook()
pythonrc.py 文件源码 项目:pythonrc 作者: lonetwin 项目源码 文件源码 阅读 23 收藏 0 点赞 0 评论 0
def auto_indent_hook(self):
        """Hook called by readline between printing the prompt and
        starting to read input.
        """
        readline.insert_text(self._indent)
        readline.redisplay()
rlcompleter.py 文件源码 项目:news-for-good 作者: thecodinghub 项目源码 文件源码 阅读 26 收藏 0 点赞 0 评论 0
def complete(self, text, state):
        """Return the next possible completion for 'text'.

        This is called successively with state == 0, 1, 2, ... until it
        returns None.  The completion should begin with 'text'.

        """
        if self.use_main_ns:
            self.namespace = __main__.__dict__

        if not text.strip():
            if state == 0:
                if _readline_available:
                    readline.insert_text('\t')
                    readline.redisplay()
                    return ''
                else:
                    return '\t'
            else:
                return None

        if state == 0:
            if "." in text:
                self.matches = self.attr_matches(text)
            else:
                self.matches = self.global_matches(text)
        try:
            return self.matches[state]
        except IndexError:
            return None
rlcompleter.py 文件源码 项目:Tencent_Cartoon_Download 作者: Fretice 项目源码 文件源码 阅读 33 收藏 0 点赞 0 评论 0
def complete(self, text, state):
        """Return the next possible completion for 'text'.

        This is called successively with state == 0, 1, 2, ... until it
        returns None.  The completion should begin with 'text'.

        """
        if self.use_main_ns:
            self.namespace = __main__.__dict__

        if not text.strip():
            if state == 0:
                if _readline_available:
                    readline.insert_text('\t')
                    readline.redisplay()
                    return ''
                else:
                    return '\t'
            else:
                return None

        if state == 0:
            if "." in text:
                self.matches = self.attr_matches(text)
            else:
                self.matches = self.global_matches(text)
        try:
            return self.matches[state]
        except IndexError:
            return None
rlcompleter.py 文件源码 项目:fieldsight-kobocat 作者: awemulya 项目源码 文件源码 阅读 31 收藏 0 点赞 0 评论 0
def complete(self, text, state):
        """Return the next possible completion for 'text'.

        This is called successively with state == 0, 1, 2, ... until it
        returns None.  The completion should begin with 'text'.

        """
        if self.use_main_ns:
            self.namespace = __main__.__dict__

        if not text.strip():
            if state == 0:
                if _readline_available:
                    readline.insert_text('\t')
                    readline.redisplay()
                    return ''
                else:
                    return '\t'
            else:
                return None

        if state == 0:
            if "." in text:
                self.matches = self.attr_matches(text)
            else:
                self.matches = self.global_matches(text)
        try:
            return self.matches[state]
        except IndexError:
            return None
spellcheck.py 文件源码 项目:multimodal_dialogue 作者: harmdevries89 项目源码 文件源码 阅读 30 收藏 0 点赞 0 评论 0
def rlinput(prompt, prefill=''):
   readline.set_startup_hook(lambda: readline.insert_text(prefill))
   try:
      return raw_input(prompt)
   finally:
      readline.set_startup_hook()
oasis.py 文件源码 项目:oasis 作者: privacylabs 项目源码 文件源码 阅读 26 收藏 0 点赞 0 评论 0
def rlinput(prompt, prefill=''):
  readline.set_startup_hook(lambda: readline.insert_text(prefill))
  try:
    return raw_input(prompt)
  finally:
    readline.set_startup_hook()
__init__.py 文件源码 项目:HOTBot 作者: adammhaile 项目源码 文件源码 阅读 24 收藏 0 点赞 0 评论 0
def default_input(prompt, default=None):
    # https://chistera.yi.org/~dato/blog/entries/2008/02/14/python_raw_input_with_an_editable_default_value_using_readline.html
    if not default:
        default = ""

    def pre_input_hook():
        readline.insert_text(default)
        readline.redisplay()

    prompt += ": "
    readline.set_pre_input_hook(pre_input_hook)
    try:
        return raw_input(prompt)
    finally:
        readline.set_pre_input_hook(None)
deployment_helper.py 文件源码 项目:vitess-tools 作者: jvaidya 项目源码 文件源码 阅读 23 收藏 0 点赞 0 评论 0
def read_value_orig(prompt, default=''):
    if not prompt.endswith(' '):
        prompt += ' '
    if type(default) is int:
        default = str(default)
    readline.set_startup_hook(lambda: readline.insert_text(default))
    try:
        return raw_input(prompt).strip()
    finally:
        readline.set_startup_hook()
rlcompleter.py 文件源码 项目:gardenbot 作者: GoestaO 项目源码 文件源码 阅读 26 收藏 0 点赞 0 评论 0
def complete(self, text, state):
        """Return the next possible completion for 'text'.

        This is called successively with state == 0, 1, 2, ... until it
        returns None.  The completion should begin with 'text'.

        """
        if self.use_main_ns:
            self.namespace = __main__.__dict__

        if not text.strip():
            if state == 0:
                if _readline_available:
                    readline.insert_text('\t')
                    readline.redisplay()
                    return ''
                else:
                    return '\t'
            else:
                return None

        if state == 0:
            if "." in text:
                self.matches = self.attr_matches(text)
            else:
                self.matches = self.global_matches(text)
        try:
            return self.matches[state]
        except IndexError:
            return None
rlcompleter.py 文件源码 项目:flask-zhenai-mongo-echarts 作者: Fretice 项目源码 文件源码 阅读 31 收藏 0 点赞 0 评论 0
def complete(self, text, state):
        """Return the next possible completion for 'text'.

        This is called successively with state == 0, 1, 2, ... until it
        returns None.  The completion should begin with 'text'.

        """
        if self.use_main_ns:
            self.namespace = __main__.__dict__

        if not text.strip():
            if state == 0:
                if _readline_available:
                    readline.insert_text('\t')
                    readline.redisplay()
                    return ''
                else:
                    return '\t'
            else:
                return None

        if state == 0:
            if "." in text:
                self.matches = self.attr_matches(text)
            else:
                self.matches = self.global_matches(text)
        try:
            return self.matches[state]
        except IndexError:
            return None
readline_shell.py 文件源码 项目:gitsome 作者: donnemartin 项目源码 文件源码 阅读 28 收藏 0 点赞 0 评论 0
def _insert_text_func(s, readline):
    """Creates a function to insert text via readline."""
    def inserter():
        readline.insert_text(s)
        readline.redisplay()
    return inserter
rlcompleter.py 文件源码 项目:blog_flask 作者: momantai 项目源码 文件源码 阅读 29 收藏 0 点赞 0 评论 0
def complete(self, text, state):
        """Return the next possible completion for 'text'.

        This is called successively with state == 0, 1, 2, ... until it
        returns None.  The completion should begin with 'text'.

        """
        if self.use_main_ns:
            self.namespace = __main__.__dict__

        if not text.strip():
            if state == 0:
                if _readline_available:
                    readline.insert_text('\t')
                    readline.redisplay()
                    return ''
                else:
                    return '\t'
            else:
                return None

        if state == 0:
            if "." in text:
                self.matches = self.attr_matches(text)
            else:
                self.matches = self.global_matches(text)
        try:
            return self.matches[state]
        except IndexError:
            return None
rlcompleter.py 文件源码 项目:MyFriend-Rob 作者: lcheniv 项目源码 文件源码 阅读 28 收藏 0 点赞 0 评论 0
def complete(self, text, state):
        """Return the next possible completion for 'text'.

        This is called successively with state == 0, 1, 2, ... until it
        returns None.  The completion should begin with 'text'.

        """
        if self.use_main_ns:
            self.namespace = __main__.__dict__

        if not text.strip():
            if state == 0:
                if _readline_available:
                    readline.insert_text('\t')
                    readline.redisplay()
                    return ''
                else:
                    return '\t'
            else:
                return None

        if state == 0:
            if "." in text:
                self.matches = self.attr_matches(text)
            else:
                self.matches = self.global_matches(text)
        try:
            return self.matches[state]
        except IndexError:
            return None


问题


面经


文章

微信
公众号

扫码关注公众号