@@ -106,9 +106,13 @@ class Scope:
106106 """
107107
108108 __slots__ = ["level" , "scope" , "target" , "resolvers" , "temps" ]
109+ level : int
110+ scope : DeepChainMap
111+ resolvers : DeepChainMap
112+ temps : dict
109113
110114 def __init__ (
111- self , level , global_dict = None , local_dict = None , resolvers = (), target = None
115+ self , level : int , global_dict = None , local_dict = None , resolvers = (), target = None
112116 ):
113117 self .level = level + 1
114118
@@ -146,8 +150,7 @@ def __init__(
146150
147151 # assumes that resolvers are going from outermost scope to inner
148152 if isinstance (local_dict , Scope ):
149- # error: Cannot determine type of 'resolvers'
150- resolvers += tuple (local_dict .resolvers .maps ) # type: ignore[has-type]
153+ resolvers += tuple (local_dict .resolvers .maps )
151154 self .resolvers = DeepChainMap (* resolvers )
152155 self .temps = {}
153156
@@ -212,7 +215,7 @@ def resolve(self, key: str, is_local: bool):
212215
213216 raise UndefinedVariableError (key , is_local ) from err
214217
215- def swapkey (self , old_key : str , new_key : str , new_value = None ):
218+ def swapkey (self , old_key : str , new_key : str , new_value = None ) -> None :
216219 """
217220 Replace a variable name, with a potentially new value.
218221
@@ -238,7 +241,7 @@ def swapkey(self, old_key: str, new_key: str, new_value=None):
238241 mapping [new_key ] = new_value # type: ignore[index]
239242 return
240243
241- def _get_vars (self , stack , scopes : list [str ]):
244+ def _get_vars (self , stack , scopes : list [str ]) -> None :
242245 """
243246 Get specifically scoped variables from a list of stack frames.
244247
@@ -263,7 +266,7 @@ def _get_vars(self, stack, scopes: list[str]):
263266 # scope after the loop
264267 del frame
265268
266- def _update (self , level : int ):
269+ def _update (self , level : int ) -> None :
267270 """
268271 Update the current scope by going back `level` levels.
269272
@@ -313,7 +316,7 @@ def ntemps(self) -> int:
313316 return len (self .temps )
314317
315318 @property
316- def full_scope (self ):
319+ def full_scope (self ) -> DeepChainMap :
317320 """
318321 Return the full scope for use with passing to engines transparently
319322 as a mapping.
0 commit comments