console.py 文件源码

python
阅读 28 收藏 0 点赞 0 评论 0

项目:rpl-attacks 作者: dhondta 项目源码 文件源码
def do_status(self, line):
        """
    Display process pool status.
        """
        self.clean_tasks()
        # this prevents from re-displaying the same status table once ENTER is pressed
        #  (marker 'restart' is handled in emptyline() hereafter
        if line == 'restart' and self.__last_tasklist is not None and \
                        hash(repr(self.tasklist)) == self.__last_tasklist:
            return
        self.__last_tasklist = hash(repr(copy(self.tasklist)))
        if len(self.tasklist) == 0:
            data = [['No task currently running']]
        else:
            data = [['Task', 'Status', 'Result']]
            for task, info in sorted(self.tasklist.items(), key=lambda x: str(x[0])):
                data.append([str(task).ljust(15), info['status'].ljust(10), str(info['result']).ljust(40)])
        table = SingleTable(data, 'Status of opened tasks')
        table.justify_columns = {0: 'center', 1: 'center', 2: 'center'}
        print(table.table)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号