本文整理匯總了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")