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


Python pyreadline.parse_and_bind方法代码示例

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


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

示例1: init_history

# 需要导入模块: import pyreadline [as 别名]
# 或者: from pyreadline import parse_and_bind [as 别名]
def init_history(self, histfile):
        readline.parse_and_bind("tab: complete")
        if hasattr(readline, "read_history_file"):
            try:
                readline.read_history_file(histfile)
            except IOError:
                pass
            atexit.register(self.save_history, histfile) 
开发者ID:cj1324,项目名称:CGIShell,代码行数:10,代码来源:cgishell.py

示例2: __init__

# 需要导入模块: import pyreadline [as 别名]
# 或者: from pyreadline import parse_and_bind [as 别名]
def __init__(self):
        self.sentCache = {}
        self.commands = {}
        self.acceptingInput = False
        self.lastPrompt = True
        self.blockingQueue = Queue.Queue()

        self._queuedCmds = []

        readline.set_completer(self.complete)
        readline.parse_and_bind('tab: complete')

        members = inspect.getmembers(self, predicate = inspect.ismethod)
        for m in members:
            if hasattr(m[1], "clidesc"):
                fname = m[0]
                fn = m[1]
                try:
                    cmd, subcommand = fname.split('_')
                except ValueError:
                    cmd = fname
                    subcommand = "_"


                if not cmd in self.commands:
                    self.commands[cmd] = {}

                self.commands[cmd][subcommand] = {
                   "args": inspect.getargspec(fn)[0][1:],
                   "optional": len(inspect.getargspec(fn)[3]) if inspect.getargspec(fn)[3] else 0,
                   "desc": fn.clidesc,
                   "fn": fn,
                   "order": fn.cliorder
                }
        #self.cv = threading.Condition()
        self.inputThread = threading.Thread(target = self.startInputThread)
        self.inputThread.daemon = True 
开发者ID:svub,项目名称:whatsapp-rest-webservice,代码行数:39,代码来源:cli.py


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