Skip to content

Commit a7a7f6c

Browse files
TYP: check_untyped_defs core.internals.concat (#36008)
1 parent 094c7ca commit a7a7f6c

File tree

2 files changed

+10
-12
lines changed

2 files changed

+10
-12
lines changed

pandas/core/internals/concat.py

+10-9
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
from collections import defaultdict
22
import copy
3-
from typing import List
3+
from typing import Dict, List
44

55
import numpy as np
66

77
from pandas._libs import NaT, internals as libinternals
8+
from pandas._typing import DtypeObj
89
from pandas.util._decorators import cache_readonly
910

1011
from 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

setup.cfg

-3
Original file line numberDiff line numberDiff line change
@@ -184,9 +184,6 @@ check_untyped_defs=False
184184
[mypy-pandas.core.internals.blocks]
185185
check_untyped_defs=False
186186

187-
[mypy-pandas.core.internals.concat]
188-
check_untyped_defs=False
189-
190187
[mypy-pandas.core.internals.construction]
191188
check_untyped_defs=False
192189

0 commit comments

Comments
 (0)