@@ -801,7 +801,7 @@ def concat_arrays(arrays, reindexers, axis=0, index=None, fill_value=None): # n
801801 raise NotImplementedError (msg )
802802 # TODO: behaviour here should be chosen through a merge strategy
803803 df = pd .concat (
804- unify_dtypes (f (x ) for f , x in zip (reindexers , arrays )),
804+ unify_dtypes (f (x ) for f , x in zip (reindexers , arrays , strict = True )),
805805 axis = axis ,
806806 ignore_index = True ,
807807 )
@@ -816,7 +816,9 @@ def concat_arrays(arrays, reindexers, axis=0, index=None, fill_value=None): # n
816816 msg = "Cannot concatenate an AwkwardArray with other array types."
817817 raise NotImplementedError (msg )
818818
819- return ak .concatenate ([f (a ) for f , a in zip (reindexers , arrays )], axis = axis )
819+ return ak .concatenate (
820+ [f (a ) for f , a in zip (reindexers , arrays , strict = True )], axis = axis
821+ )
820822 elif any (isinstance (a , CupySparseMatrix ) for a in arrays ):
821823 import cupyx .scipy .sparse as cpsparse
822824
@@ -829,7 +831,7 @@ def concat_arrays(arrays, reindexers, axis=0, index=None, fill_value=None): # n
829831 return sparse_stack (
830832 [
831833 f (as_cp_sparse (a ), axis = 1 - axis , fill_value = fill_value )
832- for f , a in zip (reindexers , arrays )
834+ for f , a in zip (reindexers , arrays , strict = True )
833835 ],
834836 format = "csr" ,
835837 )
@@ -842,7 +844,7 @@ def concat_arrays(arrays, reindexers, axis=0, index=None, fill_value=None): # n
842844 return cp .concatenate (
843845 [
844846 f (cp .asarray (x ), fill_value = fill_value , axis = 1 - axis )
845- for f , x in zip (reindexers , arrays )
847+ for f , x in zip (reindexers , arrays , strict = True )
846848 ],
847849 axis = axis ,
848850 )
@@ -856,7 +858,7 @@ def concat_arrays(arrays, reindexers, axis=0, index=None, fill_value=None): # n
856858 axis = 1 - axis ,
857859 fill_value = fill_value ,
858860 )
859- for f , a in zip (reindexers , arrays )
861+ for f , a in zip (reindexers , arrays , strict = True )
860862 ],
861863 format = "csr" ,
862864 )
@@ -871,7 +873,7 @@ def concat_arrays(arrays, reindexers, axis=0, index=None, fill_value=None): # n
871873 return np .concatenate (
872874 [
873875 f (x , fill_value = fill_value , axis = 1 - axis )
874- for f , x in zip (reindexers , arrays )
876+ for f , x in zip (reindexers , arrays , strict = True )
875877 ],
876878 axis = axis ,
877879 )
@@ -932,7 +934,7 @@ def gen_outer_reindexers(els, shapes, new_index: pd.Index, *, axis=0):
932934 (lambda x : x )
933935 if not_missing (el )
934936 else (lambda _ , shape = shape : pd .DataFrame (index = range (shape )))
935- for el , shape in zip (els , shapes )
937+ for el , shape in zip (els , shapes , strict = True )
936938 ]
937939 elif any (isinstance (el , AwkArray ) for el in els if not_missing (el )):
938940 import awkward as ak
@@ -1025,7 +1027,7 @@ def outer_concat_aligned_mapping(
10251027 fill_value = fill_value ,
10261028 off_axis_size = off_axis_size ,
10271029 )
1028- for el , n in zip (els , ns )
1030+ for el , n in zip (els , ns , strict = True )
10291031 ],
10301032 cur_reindexers ,
10311033 axis = concat_axis ,
@@ -1046,7 +1048,8 @@ def concat_pairwise_mapping(
10461048
10471049 for k in join_keys (mappings ):
10481050 els = [
1049- m .get (k , sparse_class ((s , s ), dtype = bool )) for m , s in zip (mappings , shapes )
1051+ m .get (k , sparse_class ((s , s ), dtype = bool ))
1052+ for m , s in zip (mappings , shapes , strict = True )
10501053 ]
10511054 if all (isinstance (el , CupySparseMatrix | CupyArray ) for el in els ):
10521055 result [k ] = _cp_block_diag (els , format = "csr" )
@@ -1075,7 +1078,7 @@ def merge_outer(mappings, batch_keys, *, join_index="-", merge=merge_unique):
10751078 all_keys = union_keys (mappings )
10761079 out = merge (mappings )
10771080 for key in all_keys .difference (out .keys ()):
1078- for b , m in zip (batch_keys , mappings ):
1081+ for b , m in zip (batch_keys , mappings , strict = True ):
10791082 val = m .get (key , None )
10801083 if val is not None :
10811084 out [f"{ key } { join_index } { b } " ] = val
@@ -1633,7 +1636,7 @@ def concat( # noqa: PLR0912, PLR0913, PLR0915
16331636 alt_mapping = merge (
16341637 [
16351638 {k : r (v , axis = 0 ) for k , v in getattr (a , f"{ alt_axis_name } m" ).items ()}
1636- for r , a in zip (reindexers , adatas )
1639+ for r , a in zip (reindexers , adatas , strict = True )
16371640 ],
16381641 )
16391642 alt_pairwise = merge (
@@ -1642,7 +1645,7 @@ def concat( # noqa: PLR0912, PLR0913, PLR0915
16421645 k : r (r (v , axis = 0 ), axis = 1 )
16431646 for k , v in getattr (a , f"{ alt_axis_name } p" ).items ()
16441647 }
1645- for r , a in zip (reindexers , adatas )
1648+ for r , a in zip (reindexers , adatas , strict = True )
16461649 ]
16471650 )
16481651 uns = uns_merge ([a .uns for a in adatas ])
@@ -1668,11 +1671,11 @@ def concat( # noqa: PLR0912, PLR0913, PLR0915
16681671 axis = axis ,
16691672 )
16701673 elif any (has_raw ):
1671- warn (
1674+ msg = (
16721675 "Only some AnnData objects have `.raw` attribute, "
1673- "not concatenating `.raw` attributes." ,
1674- UserWarning ,
1676+ "not concatenating `.raw` attributes."
16751677 )
1678+ warn (msg , UserWarning , stacklevel = 2 )
16761679 return AnnData (
16771680 ** {
16781681 "X" : X ,
0 commit comments