本文整理汇总了Python中trace.find_lines_from_code方法的典型用法代码示例。如果您正苦于以下问题:Python trace.find_lines_from_code方法的具体用法?Python trace.find_lines_from_code怎么用?Python trace.find_lines_from_code使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类trace
的用法示例。
在下文中一共展示了trace.find_lines_from_code方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_deprecated_find_lines_from_code
# 需要导入模块: import trace [as 别名]
# 或者: from trace import find_lines_from_code [as 别名]
def test_deprecated_find_lines_from_code(self):
with self.assertWarns(DeprecationWarning):
def foo():
pass
trace.find_lines_from_code(foo.__code__, ["eggs"])
示例2: find_source_lines
# 需要导入模块: import trace [as 别名]
# 或者: from trace import find_lines_from_code [as 别名]
def find_source_lines(self):
"""Mark all executable source lines in fn as executed 0 times."""
strs = trace.find_strings(self.filename)
lines = trace.find_lines_from_code(self.fn.__code__, strs)
self.firstcodelineno = sys.maxint
for lineno in lines:
self.firstcodelineno = min(self.firstcodelineno, lineno)
self.sourcelines.setdefault(lineno, 0)
if self.firstcodelineno == sys.maxint:
self.firstcodelineno = self.firstlineno
示例3: find_source_lines
# 需要导入模块: import trace [as 别名]
# 或者: from trace import find_lines_from_code [as 别名]
def find_source_lines(self):
"""Mark all executable source lines in fn as executed 0 times."""
strs = trace.find_strings(self.filename)
lines = trace.find_lines_from_code(self.fn.func_code, strs)
self.firstcodelineno = sys.maxint
for lineno in lines:
self.firstcodelineno = min(self.firstcodelineno, lineno)
self.sourcelines.setdefault(lineno, 0)
if self.firstcodelineno == sys.maxint:
self.firstcodelineno = self.firstlineno