@@ -133,18 +133,13 @@ def __init__(
133
133
# shallow copy here because we don't want to replace what's in
134
134
# scope when we align terms (alignment accesses the underlying
135
135
# numpy array of pandas objects)
136
-
137
- # error: Incompatible types in assignment (expression has type
138
- # "ChainMap[str, Any]", variable has type "DeepChainMap[str, Any]")
139
- self .scope = self .scope .new_child ( # type: ignore[assignment]
140
- (global_dict or frame .f_globals ).copy ()
141
- )
136
+ scope_global = self .scope .new_child ((global_dict or frame .f_globals ).copy ())
137
+ self .scope = DeepChainMap (scope_global )
142
138
if not isinstance (local_dict , Scope ):
143
- # error: Incompatible types in assignment (expression has type
144
- # "ChainMap[str, Any]", variable has type "DeepChainMap[str, Any]")
145
- self .scope = self .scope .new_child ( # type: ignore[assignment]
139
+ scope_local = self .scope .new_child (
146
140
(local_dict or frame .f_locals ).copy ()
147
141
)
142
+ self .scope = DeepChainMap (scope_local )
148
143
finally :
149
144
del frame
150
145
@@ -257,9 +252,7 @@ def _get_vars(self, stack, scopes: list[str]) -> None:
257
252
for scope , (frame , _ , _ , _ , _ , _ ) in variables :
258
253
try :
259
254
d = getattr (frame , "f_" + scope )
260
- # error: Incompatible types in assignment (expression has type
261
- # "ChainMap[str, Any]", variable has type "DeepChainMap[str, Any]")
262
- self .scope = self .scope .new_child (d ) # type: ignore[assignment]
255
+ self .scope = DeepChainMap (self .scope .new_child (d ))
263
256
finally :
264
257
# won't remove it, but DECREF it
265
258
# in Py3 this probably isn't necessary since frame won't be
0 commit comments