11from collections import defaultdict
22import copy
3- from typing import List
3+ from typing import Dict , List
44
55import numpy as np
66
77from pandas ._libs import NaT , internals as libinternals
8+ from pandas ._typing import DtypeObj
89from pandas .util ._decorators import cache_readonly
910
1011from pandas .core .dtypes .cast import maybe_promote
@@ -100,10 +101,10 @@ def _get_mgr_concatenation_plan(mgr, indexers):
100101 """
101102 # Calculate post-reindex shape , save for item axis which will be separate
102103 # for each block anyway.
103- mgr_shape = list (mgr .shape )
104+ mgr_shape_list = list (mgr .shape )
104105 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 )
107108
108109 if 0 in indexers :
109110 ax0_indexer = indexers .pop (0 )
@@ -126,9 +127,9 @@ def _get_mgr_concatenation_plan(mgr, indexers):
126127
127128 join_unit_indexers = indexers .copy ()
128129
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 )
132133
133134 if blkno == - 1 :
134135 unit = JoinUnit (None , shape )
@@ -374,8 +375,8 @@ def _get_empty_dtype_and_na(join_units):
374375 else :
375376 dtypes [i ] = unit .dtype
376377
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 )
379380 for dtype , unit in zip (dtypes , join_units ):
380381 if dtype is None :
381382 continue
0 commit comments