@@ -222,8 +222,6 @@ def compare_CustomCode(
222222 file = self .context .file ,
223223 new_code = new_code ,
224224 flag = flag ,
225- old_value = old_value ._eval (),
226- new_value = new_value ,
227225 )
228226
229227 return new_value
@@ -264,27 +262,20 @@ def compare_CustomList(
264262 new_value_element = next (new )
265263 new_code = yield from new_value_element ._code_repr (self .context )
266264 result .append (new_value_element )
267- to_insert [old_position ].append (( new_code , new_value_element ) )
265+ to_insert [old_position ].append (new_code )
268266 elif c == "d" :
269267 old_value_element , old_node_element = next (old )
270268 yield Delete (
271269 "fix" ,
272270 self .context .file ,
273271 old_node_element ,
274- old_value_element ,
275272 )
276273 old_position += 1
277274 else :
278275 assert False
279276
280277 for position , code_values in to_insert .items ():
281- yield ListInsert (
282- "fix" ,
283- self .context .file ,
284- old_node ,
285- position ,
286- * zip (* code_values ), # type: ignore
287- )
278+ yield ListInsert ("fix" , self .context .file , old_node , position , code_values )
288279
289280 return type (new_value )(result )
290281
@@ -310,22 +301,23 @@ def compare_CustomTuple(
310301 result .append (v )
311302
312303 # delete surplus old elements
313- for old_elem , old_node_elem in zip ( old_elts [ common :], old_nodes [common :]) :
314- yield Delete ("fix" , self .context .file , old_node_elem , old_elem )
304+ for old_node_elem in old_nodes [common :]:
305+ yield Delete ("fix" , self .context .file , old_node_elem )
315306
316307 # insert extra new elements
317308 if len (new_elts ) > common :
318309 to_insert = []
319310 for new_elem in new_elts [common :]:
320311 new_code = yield from new_elem ._code_repr (self .context )
321- to_insert .append (( new_code , new_elem ) )
312+ to_insert .append (new_code )
322313 result .append (new_elem )
314+
323315 yield ListInsert (
324316 "fix" ,
325317 self .context .file ,
326318 old_node ,
327319 common ,
328- * zip ( * to_insert ), # type: ignore
320+ to_insert ,
329321 )
330322
331323 return CustomTuple (result )
@@ -360,7 +352,7 @@ def compare_CustomDict(
360352 ):
361353 if key2 not in new_value .value :
362354 # delete entries
363- yield Delete ("fix" , self .context .file , node2 , old_value . value [ key2 ] )
355+ yield Delete ("fix" , self .context .file , node2 )
364356
365357 to_insert = []
366358 insert_pos = 0
@@ -392,7 +384,6 @@ def compare_CustomDict(
392384 old_node ,
393385 insert_pos ,
394386 new_code ,
395- to_insert ,
396387 )
397388 to_insert = []
398389
@@ -416,7 +407,6 @@ def compare_CustomDict(
416407 old_node ,
417408 len (old_value .value ),
418409 new_code ,
419- to_insert ,
420410 )
421411
422412 return CustomDict (value = result )
@@ -465,7 +455,6 @@ def intercept(change):
465455 flag ,
466456 self .context .file ,
467457 node ,
468- old_value .argument (arg_pos ),
469458 )
470459
471460 if old_args_len < len (new_args ):
@@ -478,7 +467,6 @@ def intercept(change):
478467 arg_pos = insert_pos ,
479468 arg_name = None ,
480469 new_code = new_code ,
481- new_value = insert_value ,
482470 )
483471 result_args .append (insert_value )
484472
@@ -504,7 +492,6 @@ def intercept(change):
504492 ),
505493 self .context .file ,
506494 kw_value ,
507- old_value .argument (kw_arg ),
508495 )
509496
510497 to_insert = []
@@ -535,7 +522,6 @@ def intercept(change):
535522 arg_pos = insert_pos ,
536523 arg_name = insert_key ,
537524 new_code = new_code ,
538- new_value = value ,
539525 )
540526 to_insert = []
541527
@@ -553,7 +539,6 @@ def intercept(change):
553539 arg_pos = None ,
554540 arg_name = key ,
555541 new_code = new_code ,
556- new_value = value ,
557542 )
558543
559544 return CustomCall (
0 commit comments