Python trace.find_lines_from_code() Examples

The following are 5 code examples of trace.find_lines_from_code(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module trace , or try the search function .
Example #1
Source File: test_trace.py    From Fluid-Designer with GNU General Public License v3.0 5 votes vote down vote up
def test_deprecated_find_lines_from_code(self):
        with self.assertWarns(DeprecationWarning):
            def foo():
                pass
            trace.find_lines_from_code(foo.__code__, ["eggs"]) 
Example #2
Source File: profilehooks.py    From pyFileFixity with MIT License 5 votes vote down vote up
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 
Example #3
Source File: test_trace.py    From ironpython3 with Apache License 2.0 5 votes vote down vote up
def test_deprecated_find_lines_from_code(self):
        with self.assertWarns(DeprecationWarning):
            def foo():
                pass
            trace.find_lines_from_code(foo.__code__, ["eggs"]) 
Example #4
Source File: test_trace.py    From Project-New-Reign---Nemesis-Main with GNU General Public License v3.0 5 votes vote down vote up
def test_deprecated_find_lines_from_code(self):
        with self.assertWarns(DeprecationWarning):
            def foo():
                pass
            trace.find_lines_from_code(foo.__code__, ["eggs"]) 
Example #5
Source File: profilehooks.py    From Tautulli with GNU General Public License v3.0 5 votes vote down vote up
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