Coverage for python/lsst/pex/config/callStack.py : 93%

Hot-keys on this page
r m x p toggle line displays
j k next/prev highlighted chunk
0 (zero) top of page
1 (one) first highlighted chunk
# # LSST Data Management System # Copyright 2017 AURA/LSST. # # This product includes software developed by the # LSST Project (http://www.lsst.org/). # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the LSST License Statement and # the GNU General Public License along with this program. If not, # see <https://www.lsstcorp.org/LegalNotices/>. #
"""Retrieve the frame for the caller
By "caller", we mean our user's caller.
Parameters ---------- relative : `int`, non-negative Number of frames above the caller to retrieve.
Returns ------- frame : `__builtin__.Frame` Frame for the caller. """
"""Retrieve the stack frame for the caller
By "caller", we mean our user's caller.
Parameters ---------- relative : `int`, non-negative Number of frames above the caller to retrieve.
Returns ------- frame : `StackFrame` Stack frame for the caller. """
"""A single element of the stack trace
This differs slightly from the standard system mechanisms for getting a stack trace by the fact that it does not look up the source code until it is absolutely necessary, reducing the I/O.
Parameters ---------- filename : `str` Name of file containing the code being executed. lineno : `int` Line number of file being executed. function : `str` Function name being executed. content : `str` or `None` The actual content being executed. If not provided, it will be loaded from the file. """
def content(self): """Getter for content being executed
Load from file on demand. """
def fromFrame(cls, frame): """Construct from a Frame object
inspect.currentframe() provides a Frame object. This is a convenience constructor to interpret that Frame object.
Parameters ---------- frame : `Frame` Frame object to interpret.
Returns ------- output : `StackFrame` Constructed object. """
return "%s(%s, %s, %s)" % (self.__class__.__name__, self.filename, self.lineno, self.function)
"""Format for printing
Parameters ---------- full : `bool` Print full details, including content being executed?
Returns ------- result : `str` Formatted string. """ result += "\n %s" % (self.content,)
"""Retrieve the call stack for the caller
By "caller", we mean our user's caller - we don't include ourselves or our caller.
The result is ordered with the most recent frame last.
Parameters ---------- skip : `int`, non-negative Number of stack frames above caller to skip.
Returns ------- output : `list` of `StackFrame` The call stack. """ |