diff options
| author | Maxim Yurchuk <[email protected]> | 2024-11-13 16:32:39 +0300 |
|---|---|---|
| committer | Maxim Yurchuk <[email protected]> | 2024-11-13 16:32:39 +0300 |
| commit | 23387aafadce23ea77beffb2981e8c0e2f2a7f0a (patch) | |
| tree | 54b0f95fca1ad03d93f5a18abdfe98e8ab34b420 /contrib/python/ipython/py3/IPython/utils/frame.py | |
| parent | ee51155da394b56a8e3329d25a514422e5da7bc3 (diff) | |
| parent | 4ab23311f7a6d45ac318179569df9ba46fb9ab68 (diff) | |
Merge branch 'rightlib' into mergelibs-yurchuk-manual
Diffstat (limited to 'contrib/python/ipython/py3/IPython/utils/frame.py')
| -rw-r--r-- | contrib/python/ipython/py3/IPython/utils/frame.py | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/contrib/python/ipython/py3/IPython/utils/frame.py b/contrib/python/ipython/py3/IPython/utils/frame.py index 808906bda81..3d0c1b71897 100644 --- a/contrib/python/ipython/py3/IPython/utils/frame.py +++ b/contrib/python/ipython/py3/IPython/utils/frame.py @@ -15,6 +15,7 @@ Utilities for working with stack frames. #----------------------------------------------------------------------------- import sys +from typing import Any #----------------------------------------------------------------------------- # Code @@ -51,7 +52,7 @@ def extract_vars(*names,**kw): return dict((k,callerNS[k]) for k in names) -def extract_vars_above(*names): +def extract_vars_above(*names: list[str]): """Extract a set of variables by name from another frame. Similar to extractVars(), but with a specified depth of 1, so that names @@ -65,7 +66,7 @@ def extract_vars_above(*names): return dict((k,callerNS[k]) for k in names) -def debugx(expr,pre_msg=''): +def debugx(expr: str, pre_msg: str = ""): """Print the value of an expression from the caller's frame. Takes an expression, evaluates it in the caller's frame and prints both @@ -84,7 +85,8 @@ def debugx(expr,pre_msg=''): # deactivate it by uncommenting the following line, which makes it a no-op #def debugx(expr,pre_msg=''): pass -def extract_module_locals(depth=0): + +def extract_module_locals(depth: int = 0) -> tuple[Any, Any]: """Returns (module, locals) of the function `depth` frames away from the caller""" f = sys._getframe(depth + 1) global_ns = f.f_globals |
