frames
¶
Utilities for working with stack traces and frames.
Typical Usage
>>> import inspect
>>> from typelib.py import frames
>>> var = 1
>>> frames.extract("var")
1
>>> current_frame = inspect.currentframe()
>>> frames.getcaller() == current_frame
True
Functions:
-
extract–Extract
namefrom the stacktrace offrame. -
getcaller–Get the caller of the current scope, excluding this library.
extract
¶
Extract name from the stacktrace of frame.
If frame is not provided, this function will use the current frame.
Parameters:
-
(name¶str) –The name of the object to extract from the stacktrace.
-
(frame¶FrameType | None, default:None) –The
types.FrameTypeinstance to start from (optional).
Source code in src/typelib/py/frames.py
getcaller
¶
Get the caller of the current scope, excluding this library.
If frame is not provided, this function will use the current frame.
Parameters:
-
(frame¶FrameType | None, default:None) –The
types.FrameTypeinstance to start from (optional).