Returns (module, locals) of the function `depth` frames away from the caller
(depth: int = 0)
| 90 | |
| 91 | |
| 92 | def extract_module_locals(depth: int = 0) -> tuple[ModuleType, dict[str, Any]]: |
| 93 | """Returns (module, locals) of the function `depth` frames away from the caller""" |
| 94 | f = sys._getframe(depth + 1) |
| 95 | global_ns = f.f_globals |
| 96 | module = sys.modules[global_ns['__name__']] |
| 97 | return (module, f.f_locals) |
no outgoing calls
no test coverage detected
searching dependent graphs…