Skip to content

Commit

Permalink
fix(utils): add get_caller_module_name method in PKGs class
Browse files Browse the repository at this point in the history
  • Loading branch information
entelecheia committed Jul 21, 2023
1 parent ff3be7a commit a2e0c8f
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/hyfi/utils/packages.py
Original file line number Diff line number Diff line change
Expand Up @@ -201,3 +201,8 @@ def getsource(obj: str) -> str:
def viewsource(obj: str) -> None:
"""Print the source code of the object."""
print(PKGs.getsource(obj))

@staticmethod
def get_caller_module_name() -> str:
"""Get the name of the module that called this function."""
return inspect.getmodule(inspect.stack()[2][0]).__name__ # type: ignore

0 comments on commit a2e0c8f

Please sign in to comment.