本文整理汇总了Python中_hotshot.logreader方法的典型用法代码示例。如果您正苦于以下问题:Python _hotshot.logreader方法的具体用法?Python _hotshot.logreader怎么用?Python _hotshot.logreader使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类_hotshot
的用法示例。
在下文中一共展示了_hotshot.logreader方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: import _hotshot [as 别名]
# 或者: from _hotshot import logreader [as 别名]
def __init__(self, logfn):
# fileno -> filename
self._filemap = {}
# (fileno, lineno) -> filename, funcname
self._funcmap = {}
self._reader = _hotshot.logreader(logfn)
self._nextitem = self._reader.next
self._info = self._reader.info
if 'current-directory' in self._info:
self.cwd = self._info['current-directory']
else:
self.cwd = None
# This mirrors the call stack of the profiled code as the log
# is read back in. It contains tuples of the form:
#
# (file name, line number of function def, function name)
#
self._stack = []
self._append = self._stack.append
self._pop = self._stack.pop
示例2: test_logreader_eof_error
# 需要导入模块: import _hotshot [as 别名]
# 或者: from _hotshot import logreader [as 别名]
def test_logreader_eof_error(self):
emptyfile = tempfile.NamedTemporaryFile()
try:
self.assertRaises((IOError, EOFError), _hotshot.logreader,
emptyfile.name)
finally:
emptyfile.close()
gc.collect()