@@ -313,7 +313,7 @@ def remove_edges(
313313 cg ,
314314 * ,
315315 atomic_edges : Iterable [np .ndarray ],
316- operation_id : basetypes .OPERATION_ID = None ,
316+ operation_id : basetypes .OPERATION_ID = None , # type: ignore
317317 time_stamp : datetime .datetime = None ,
318318 parent_ts : datetime .datetime = None ,
319319):
@@ -522,7 +522,7 @@ def __init__(
522522 cg ,
523523 * ,
524524 new_l2_ids : Iterable ,
525- operation_id : basetypes .OPERATION_ID ,
525+ operation_id : basetypes .OPERATION_ID , # type: ignore
526526 time_stamp : datetime .datetime ,
527527 new_old_id_d : Dict [np .uint64 , Set [np .uint64 ]] = None ,
528528 old_new_id_d : Dict [np .uint64 , Set [np .uint64 ]] = None ,
@@ -542,7 +542,7 @@ def __init__(
542542
543543 def _update_id_lineage (
544544 self ,
545- parent : basetypes .NODE_ID ,
545+ parent : basetypes .NODE_ID , # type: ignore
546546 children : np .ndarray ,
547547 layer : int ,
548548 parent_layer : int ,
@@ -658,7 +658,21 @@ def _create_new_parents(self, layer: int):
658658 self ._update_id_lineage (parent , cc_ids , layer , parent_layer )
659659 self .cg .cache .children_cache [parent ] = cc_ids
660660 cache_utils .update (self .cg .cache .parents_cache , cc_ids , parent )
661- sanity_check_single (self .cg , parent , self ._operation_id )
661+
662+ try :
663+ sanity_check_single (self .cg , parent , self ._operation_id )
664+ except AssertionError :
665+ from pychunkedgraph .debug .utils import get_l2children
666+
667+ pairs = [
668+ (a , b ) for idx , a in enumerate (cc_ids ) for b in cc_ids [idx + 1 :]
669+ ]
670+ for c1 , c2 in pairs :
671+ l2c1 = get_l2children (self .cg , c1 )
672+ l2c2 = get_l2children (self .cg , c2 )
673+ if np .intersect1d (l2c1 , l2c2 ).size :
674+ msg = f"{ self ._operation_id } :{ c1 } { c2 } have common children."
675+ raise ValueError (msg )
662676
663677 def run (self ) -> Iterable :
664678 """
0 commit comments