@@ -1063,20 +1063,21 @@ def _concat_same_type(
1063
1063
else :
1064
1064
sp_kind = "integer"
1065
1065
1066
+ sp_index : SparseIndex
1066
1067
if sp_kind == "integer" :
1067
1068
indices = []
1068
1069
1069
1070
for arr in to_concat :
1070
- idx = arr .sp_index .to_int_index ().indices .copy ()
1071
- idx += length # TODO: wraparound
1071
+ int_idx = arr .sp_index .to_int_index ().indices .copy ()
1072
+ int_idx += length # TODO: wraparound
1072
1073
length += arr .sp_index .length
1073
1074
1074
1075
values .append (arr .sp_values )
1075
- indices .append (idx )
1076
+ indices .append (int_idx )
1076
1077
1077
1078
data = np .concatenate (values )
1078
- indices = np .concatenate (indices )
1079
- sp_index = IntIndex (length , indices )
1079
+ indices_arr = np .concatenate (indices )
1080
+ sp_index = IntIndex (length , indices_arr )
1080
1081
1081
1082
else :
1082
1083
# when concatenating block indices, we don't claim that you'll
@@ -1088,18 +1089,18 @@ def _concat_same_type(
1088
1089
blocs = []
1089
1090
1090
1091
for arr in to_concat :
1091
- idx = arr .sp_index .to_block_index ()
1092
+ block_idx = arr .sp_index .to_block_index ()
1092
1093
1093
1094
values .append (arr .sp_values )
1094
- blocs .append (idx .blocs .copy () + length )
1095
- blengths .append (idx .blengths )
1095
+ blocs .append (block_idx .blocs .copy () + length )
1096
+ blengths .append (block_idx .blengths )
1096
1097
length += arr .sp_index .length
1097
1098
1098
1099
data = np .concatenate (values )
1099
- blocs = np .concatenate (blocs )
1100
- blengths = np .concatenate (blengths )
1100
+ blocs_arr = np .concatenate (blocs )
1101
+ blengths_arr = np .concatenate (blengths )
1101
1102
1102
- sp_index = BlockIndex (length , blocs , blengths )
1103
+ sp_index = BlockIndex (length , blocs_arr , blengths_arr )
1103
1104
1104
1105
return cls (data , sparse_index = sp_index , fill_value = fill_value )
1105
1106
@@ -1666,8 +1667,9 @@ def make_sparse(
1666
1667
return sparsified_values , index , fill_value
1667
1668
1668
1669
1669
- def make_sparse_index (length , indices , kind ):
1670
+ def make_sparse_index (length , indices , kind ) -> SparseIndex :
1670
1671
1672
+ index : SparseIndex
1671
1673
if kind == "block" or isinstance (kind , BlockIndex ):
1672
1674
locs , lens = splib .get_blocks (indices )
1673
1675
index = BlockIndex (length , locs , lens )
0 commit comments