diff options
author | robot-piglet <robot-piglet@yandex-team.com> | 2024-11-09 12:07:32 +0300 |
---|---|---|
committer | robot-piglet <robot-piglet@yandex-team.com> | 2024-11-09 12:17:11 +0300 |
commit | 381a9a45520ba56577e90032e086e0168a03b956 (patch) | |
tree | f49a7f9feff6df2c4916cf20205e9c22cb26dfd2 /contrib/python/ipython/py3/IPython/utils/frame.py | |
parent | 66839121782766f516d9a33982e1968d319e3395 (diff) | |
download | ydb-381a9a45520ba56577e90032e086e0168a03b956.tar.gz |
Intermediate changes
commit_hash:2e32c346f257520a6c3629b88dc628744d3d3386
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 808906bda8..3d0c1b7189 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 |