1515#-----------------------------------------------------------------------------
1616
1717import sys
18+ from typing import Any
1819
1920#-----------------------------------------------------------------------------
2021# Code
@@ -51,7 +52,7 @@ def extract_vars(*names,**kw):
5152 return dict ((k ,callerNS [k ]) for k in names )
5253
5354
54- def extract_vars_above (* names ):
55+ def extract_vars_above (* names : list [ str ] ):
5556 """Extract a set of variables by name from another frame.
5657
5758 Similar to extractVars(), but with a specified depth of 1, so that names
@@ -65,7 +66,7 @@ def extract_vars_above(*names):
6566 return dict ((k ,callerNS [k ]) for k in names )
6667
6768
68- def debugx (expr , pre_msg = '' ):
69+ def debugx (expr : str , pre_msg : str = "" ):
6970 """Print the value of an expression from the caller's frame.
7071
7172 Takes an expression, evaluates it in the caller's frame and prints both
@@ -84,7 +85,8 @@ def debugx(expr,pre_msg=''):
8485# deactivate it by uncommenting the following line, which makes it a no-op
8586#def debugx(expr,pre_msg=''): pass
8687
87- def extract_module_locals (depth = 0 ):
88+
89+ def extract_module_locals (depth : int = 0 ) -> tuple [Any , Any ]:
8890 """Returns (module, locals) of the function `depth` frames away from the caller"""
8991 f = sys ._getframe (depth + 1 )
9092 global_ns = f .f_globals
0 commit comments