1
1
from collections import defaultdict
2
2
import copy
3
- from typing import List
3
+ from typing import Dict , List
4
4
5
5
import numpy as np
6
6
7
7
from pandas ._libs import NaT , internals as libinternals
8
+ from pandas ._typing import DtypeObj
8
9
from pandas .util ._decorators import cache_readonly
9
10
10
11
from pandas .core .dtypes .cast import maybe_promote
@@ -100,10 +101,10 @@ def _get_mgr_concatenation_plan(mgr, indexers):
100
101
"""
101
102
# Calculate post-reindex shape , save for item axis which will be separate
102
103
# for each block anyway.
103
- mgr_shape = list (mgr .shape )
104
+ mgr_shape_list = list (mgr .shape )
104
105
for ax , indexer in indexers .items ():
105
- mgr_shape [ax ] = len (indexer )
106
- mgr_shape = tuple (mgr_shape )
106
+ mgr_shape_list [ax ] = len (indexer )
107
+ mgr_shape = tuple (mgr_shape_list )
107
108
108
109
if 0 in indexers :
109
110
ax0_indexer = indexers .pop (0 )
@@ -126,9 +127,9 @@ def _get_mgr_concatenation_plan(mgr, indexers):
126
127
127
128
join_unit_indexers = indexers .copy ()
128
129
129
- shape = list (mgr_shape )
130
- shape [0 ] = len (placements )
131
- shape = tuple (shape )
130
+ shape_list = list (mgr_shape )
131
+ shape_list [0 ] = len (placements )
132
+ shape = tuple (shape_list )
132
133
133
134
if blkno == - 1 :
134
135
unit = JoinUnit (None , shape )
@@ -374,8 +375,8 @@ def _get_empty_dtype_and_na(join_units):
374
375
else :
375
376
dtypes [i ] = unit .dtype
376
377
377
- upcast_classes = defaultdict (list )
378
- null_upcast_classes = defaultdict (list )
378
+ upcast_classes : Dict [ str , List [ DtypeObj ]] = defaultdict (list )
379
+ null_upcast_classes : Dict [ str , List [ DtypeObj ]] = defaultdict (list )
379
380
for dtype , unit in zip (dtypes , join_units ):
380
381
if dtype is None :
381
382
continue
0 commit comments