Created
February 27, 2018 08:28
-
-
Save joonahn/01456a23529c9ff768081d83699e77b8 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import inspect | |
def get_caller_source_lines(cls, num_of_prev_functions=1): | |
# num_of_prev_functions | |
frame = inspect.stack()[1 + num_of_prev_functions] | |
_, linenum, _, _, _ = inspect.getframeinfo(frame) | |
return linenum |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment