@@ -106,9 +106,13 @@ class Scope:
106
106
"""
107
107
108
108
__slots__ = ["level" , "scope" , "target" , "resolvers" , "temps" ]
109
+ level : int
110
+ scope : DeepChainMap
111
+ resolvers : DeepChainMap
112
+ temps : dict
109
113
110
114
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
112
116
):
113
117
self .level = level + 1
114
118
@@ -146,8 +150,7 @@ def __init__(
146
150
147
151
# assumes that resolvers are going from outermost scope to inner
148
152
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 )
151
154
self .resolvers = DeepChainMap (* resolvers )
152
155
self .temps = {}
153
156
@@ -212,7 +215,7 @@ def resolve(self, key: str, is_local: bool):
212
215
213
216
raise UndefinedVariableError (key , is_local ) from err
214
217
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 :
216
219
"""
217
220
Replace a variable name, with a potentially new value.
218
221
@@ -238,7 +241,7 @@ def swapkey(self, old_key: str, new_key: str, new_value=None):
238
241
mapping [new_key ] = new_value # type: ignore[index]
239
242
return
240
243
241
- def _get_vars (self , stack , scopes : list [str ]):
244
+ def _get_vars (self , stack , scopes : list [str ]) -> None :
242
245
"""
243
246
Get specifically scoped variables from a list of stack frames.
244
247
@@ -263,7 +266,7 @@ def _get_vars(self, stack, scopes: list[str]):
263
266
# scope after the loop
264
267
del frame
265
268
266
- def _update (self , level : int ):
269
+ def _update (self , level : int ) -> None :
267
270
"""
268
271
Update the current scope by going back `level` levels.
269
272
@@ -313,7 +316,7 @@ def ntemps(self) -> int:
313
316
return len (self .temps )
314
317
315
318
@property
316
- def full_scope (self ):
319
+ def full_scope (self ) -> DeepChainMap :
317
320
"""
318
321
Return the full scope for use with passing to engines transparently
319
322
as a mapping.
0 commit comments