__init__.py 文件源码

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

项目:python-web-pdb 作者: romanvm 项目源码 文件源码
def get_current_frame_data(self):
        """
        Get all date about the current execution frame

        :return: current frame data
        :rtype: dict
        :raises AttributeError: if the debugger does hold any execution frame.
        :raises IOError: if source code for the current execution frame is not accessible.
        """
        filename = self.curframe.f_code.co_filename
        lines, start_line = inspect.findsource(self.curframe)
        if sys.version_info[0] == 2:
            lines = [line.decode('utf-8') for line in lines]
        return {
            'filename': os.path.basename(filename),
            'listing': ''.join(lines),
            'curr_line': self.curframe.f_lineno,
            'total_lines': len(lines),
            'breaklist': self.get_file_breaks(filename),
        }
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号