当前位置: 首页>>代码示例>>Python>>正文


Python gnureadline.set_completer方法代码示例

本文整理汇总了Python中gnureadline.set_completer方法的典型用法代码示例。如果您正苦于以下问题:Python gnureadline.set_completer方法的具体用法?Python gnureadline.set_completer怎么用?Python gnureadline.set_completer使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在gnureadline的用法示例。


在下文中一共展示了gnureadline.set_completer方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: setup

# 需要导入模块: import gnureadline [as 别名]
# 或者: from gnureadline import set_completer [as 别名]
def setup(self):
        """ Initialization of third-party libraries

        Setting interpreter history.
        Setting appropriate completer function.

        :return:
        """
        if not os.path.exists(self.history_file):
            open(self.history_file, 'a+').close()

        readline.read_history_file(self.history_file)
        readline.set_history_length(self.history_length)
        atexit.register(readline.write_history_file, self.history_file)

        readline.parse_and_bind('set enable-keypad on')

        readline.set_completer(self.complete)
        readline.set_completer_delims(' \t\n;')
        readline.parse_and_bind("tab: complete") 
开发者ID:reverse-shell,项目名称:routersploit,代码行数:22,代码来源:interpreter.py

示例2: pre_input

# 需要导入模块: import gnureadline [as 别名]
# 或者: from gnureadline import set_completer [as 别名]
def pre_input(self, completefn):
        if self.raw_input:
            if HAVE_READLINE:
                import atexit
                self.old_completer = readline.get_completer()
                # Fix Bug #3129: Limit the history size to consume less memory
                readline.set_history_length(self.historysize)
                readline.set_completer(completefn)
                readline.parse_and_bind(self.completekey+": complete")
                try:
                    readline.read_history_file()
                except IOError:
                    pass
                atexit.register(readline.write_history_file)
                self.havecolor = True
                if mswindows and self.enablecolor:
                    self.cwrite = readline.GetOutputFile().write_color
                else:
                    self.cwrite = self.stdout.write 
开发者ID:w3h,项目名称:isf,代码行数:21,代码来源:iohandler.py

示例3: post_input

# 需要导入模块: import gnureadline [as 别名]
# 或者: from gnureadline import set_completer [as 别名]
def post_input(self):
        if self.raw_input:
            if HAVE_READLINE:
                readline.set_completer(self.old_completer)
                self.havecolor = False
        self.cwrite = None 
开发者ID:w3h,项目名称:isf,代码行数:8,代码来源:iohandler.py

示例4: get_language

# 需要导入模块: import gnureadline [as 别名]
# 或者: from gnureadline import set_completer [as 别名]
def get_language(data):
  # Prompts the use for the speaking language

  print output_message(colors.WARNING, "What language is easiest to understand?\n")
  completer = AutoComplete([key for key in data])
  gnureadline.set_completer(completer.complete)
  gnureadline.parse_and_bind('tab: complete')
  language = raw_input(output_message(colors.WARNING, "[Press Tab] >>> "))
  return language 
开发者ID:camtaylor,项目名称:alan,代码行数:11,代码来源:config_utils.py

示例5: get_voice

# 需要导入模块: import gnureadline [as 别名]
# 或者: from gnureadline import set_completer [as 别名]
def get_voice(languages_and_voices, language):
  # Prompts the user for the voice of the bot

  voices = zip(languages_and_voices[language])
  known_voices = [key[0].lower() for key in voices]
  string_voices = " ".join(languages_and_voices[language])

  # Prompt
  print output_message(colors.WARNING, "\nPlease select my voice: \n{}\n".format(string_voices))
  voice_completer = AutoComplete(known_voices)
  gnureadline.set_completer(voice_completer.complete)
  gnureadline.parse_and_bind('tab: complete')
  voice = raw_input(output_message(colors.WARNING, "[Press Tab] >>> "))
  return voice 
开发者ID:camtaylor,项目名称:alan,代码行数:16,代码来源:config_utils.py


注:本文中的gnureadline.set_completer方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。