本文整理汇总了Python中gnureadline.set_completer_delims方法的典型用法代码示例。如果您正苦于以下问题:Python gnureadline.set_completer_delims方法的具体用法?Python gnureadline.set_completer_delims怎么用?Python gnureadline.set_completer_delims使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类gnureadline
的用法示例。
在下文中一共展示了gnureadline.set_completer_delims方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: setup
# 需要导入模块: import gnureadline [as 别名]
# 或者: from gnureadline import set_completer_delims [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")
示例2: preloop
# 需要导入模块: import gnureadline [as 别名]
# 或者: from gnureadline import set_completer_delims [as 别名]
def preloop(self):
delims = set(readline.get_completer_delims())
for d in "%*-/":
try:
delims.remove(d)
except KeyError:
pass
readline.set_completer_delims(''.join(delims))
try:
readline.read_history_file(self.HISTORY_FILE)
except (OSError, IOError) as e:
warn("Can't read history file")