python类clear_history()的实例源码

command.py 文件源码 项目:jiveplot 作者: haavee 项目源码 文件源码 阅读 26 收藏 0 点赞 0 评论 0
def __exit__(self, ex_tp, ex_val, ex_tb):
        if not haveReadline:
            return False
        try:
            # update the history for this project
            readline.write_history_file(self.historyFile)
        except Exception as E:
            print "Failed to write history to {0} - {1}".format(self.historyFile, E)
        # put back the original history!
        readline.clear_history()
        readline.read_history_file(self.oldhistFile)
        os.unlink(self.oldhistFile)

        # and put back the old completer
        readline.set_completer(self.oldCompleter)

# linegenerators, pass one of these to the "run"
# method of the CommandLineInterface object
#import ctypes
#rllib = ctypes.cdll.LoadLibrary("libreadline.so")
#rl_line_buffer = ctypes.c_char_p.in_dll(rllib, "rl_line_buffer")
#rl_done        = ctypes.c_int.in_dll(rllib, "rl_done")
history.py 文件源码 项目:My-Web-Server-Framework-With-Python2.7 作者: syjsu 项目源码 文件源码 阅读 35 收藏 0 点赞 0 评论 0
def remove_item(self, index):
        # readline.remove_history_item() doesn't seem to work. Do it the
        # hard way.

        #try:
        #    readline.remove_history_item(i)
        #except ValueError:
        #    pass

        buf = []
        for i in range(1, self.total + 1):
            if i != index:
                buf += self.get_item(i)

        self.clear_history()
        for s in buf:
            readline.add_history(s)
readlineng.py 文件源码 项目:darkc0de-old-stuff 作者: tuwid 项目源码 文件源码 阅读 22 收藏 0 点赞 0 评论 0
def clear_history():
            pass
command.py 文件源码 项目:jiveplot 作者: haavee 项目源码 文件源码 阅读 26 收藏 0 点赞 0 评论 0
def __enter__(self):
        # we only do something if we have readline
        if not haveReadline:
            return self
        ## Set up the new history context
        self.historyFile      = os.path.join( os.getenv('HOME'), ".{0}.history".format(self.basename)) 
        (h, self.oldhistFile) = tempfile.mkstemp(prefix=self.basename, suffix=".hist", dir="/tmp")
        # only need the filename, really
        os.close(h)
        readline.write_history_file(self.oldhistFile)
        readline.clear_history()

        # if reading the old history fails, fail silently
        # (the file might not exist yet)
        try:
            readline.read_history_file(self.historyFile)
        except:
            pass

        # store the old completer, install our own one
        readline.parse_and_bind("tab: complete")
        #readline.parse_and_bind("C-c: backward-kill-line")
        self.oldCompleter = readline.get_completer()
        readline.set_completer(self.completer)
        return self

    # clean up the context
readlineng.py 文件源码 项目:autoinjection 作者: ChengWiLL 项目源码 文件源码 阅读 23 收藏 0 点赞 0 评论 0
def clear_history():
            pass
history.py 文件源码 项目:My-Web-Server-Framework-With-Python2.7 作者: syjsu 项目源码 文件源码 阅读 28 收藏 0 点赞 0 评论 0
def clear_history(self):
        """
        Clear the history buffer. Subclasses *must* provide an
        implementation of this method.
        """
        pass
history.py 文件源码 项目:My-Web-Server-Framework-With-Python2.7 作者: syjsu 项目源码 文件源码 阅读 29 收藏 0 点赞 0 评论 0
def replace_history(self, commands):
        """
        Replace the entire contents of the history with another set of values

        :Parameters:
            commands : list
                List of strings to put in the history after clearing it of any
                existing entries
        """
        self.clear_history()
        for command in commands:
            self.add_item(command, force=True)
history.py 文件源码 项目:My-Web-Server-Framework-With-Python2.7 作者: syjsu 项目源码 文件源码 阅读 25 收藏 0 点赞 0 评论 0
def clear_history(self):
        try:
            readline.clear_history()
        except AttributeError:
            len = self.get_max_length()
            readline.set_history_length(0)
            readline.set_history_length(len)
history.py 文件源码 项目:My-Web-Server-Framework-With-Python2.7 作者: syjsu 项目源码 文件源码 阅读 33 收藏 0 点赞 0 评论 0
def remove_item(self, index):
        buf = copy.deepcopy(self.__get_buf())
        self.clear_history()
        for s in buf:
            readline.add_history(s)
history.py 文件源码 项目:My-Web-Server-Framework-With-Python2.7 作者: syjsu 项目源码 文件源码 阅读 24 收藏 0 点赞 0 评论 0
def clear_history(self):
        pass
readlineng.py 文件源码 项目:Eagle 作者: magerx 项目源码 文件源码 阅读 23 收藏 0 点赞 0 评论 0
def clear_history():
            pass
readlineng.py 文件源码 项目:Helix 作者: 3lackrush 项目源码 文件源码 阅读 24 收藏 0 点赞 0 评论 0
def clear_history():
            pass
readlineng.py 文件源码 项目:autoscan 作者: b01u 项目源码 文件源码 阅读 29 收藏 0 点赞 0 评论 0
def clear_history():
            pass


问题


面经


文章

微信
公众号

扫码关注公众号