summaryrefslogtreecommitdiffstats
path: root/contrib/python/ipython/py3/IPython/utils/frame.py
diff options
context:
space:
mode:
authorAlexSm <[email protected]>2024-11-14 18:02:48 +0100
committerGitHub <[email protected]>2024-11-14 18:02:48 +0100
commit42393178e3ca660b7b2da431bc4c768aadafe856 (patch)
tree846127355de5d4088b4eefcab801b15c1ec4e454 /contrib/python/ipython/py3/IPython/utils/frame.py
parentc0af8d60b18390f8ef7b3ff878b822c43da62a54 (diff)
parent51f34813686206b46686d84e96243def9f9da8df (diff)
Merge pull request #11568 from maximyurchuk/mergelibs-yurchuk-manual
Mergelibs yurchuk manual
Diffstat (limited to 'contrib/python/ipython/py3/IPython/utils/frame.py')
-rw-r--r--contrib/python/ipython/py3/IPython/utils/frame.py8
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