def merge_sync(dsk1, dsk2):
 dsk2_topo = toposort(dsk2)
 sd = _sync_keys(dsk1, dsk2, dsk2_topo)
 new_dsk = dsk1.copy()
 for key in dsk2_topo:
  if (key in sd):
   new_key = sd[key]
  else:
   if (key in dsk1):
    new_key = next(merge_sync.names)
   else:
    new_key = key
   sd[key] = new_key
  task = dsk2[key]
  for (a, b) in sd.items():
   task = subs(task, a, b)
  new_dsk[new_key] = task
 return (new_dsk, sd)

def merge_sync ( dsk1 , dsk2 ) : dsk2_topo = toposort ( dsk2 ) sd = _sync_keys ( dsk1 , dsk2 , dsk2_topo ) new_dsk = dsk1 . copy ( ) for key in dsk2_topo : if ( key in sd ) : new_key = sd [ key ] else : if ( key in dsk1 ) : new_key = next ( merge_sync . names ) else : new_key = key sd [ key ] = new_key task = dsk2 [ key ] for ( a , b ) in sd . items ( ) : task = subs ( task , a , b ) new_dsk [ new_key ] = task return ( new_dsk , sd )
merge two dasks together .