Skip to content

Commit 4e52afb

Browse files
committed
CLN: appease mypy
1 parent 7aa66d5 commit 4e52afb

File tree

2 files changed

+10
-9
lines changed

2 files changed

+10
-9
lines changed

pandas/core/internals/__init__.py

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -44,20 +44,19 @@ def __getattr__(name: str):
4444
from pandas.util._exceptions import find_stack_level
4545

4646
if name in ["NumericBlock", "ObjectBlock"]:
47-
if name == "NumericBlock":
48-
from pandas.core.internals.blocks import NumericBlock
49-
50-
block_type = NumericBlock
51-
elif name == "ObjectBlock":
52-
from pandas.core.internals.blocks import ObjectBlock
53-
54-
block_type = ObjectBlock
5547
warnings.warn(
5648
f"{name} is deprecated and will be removed in a future version. "
5749
"Use NumpyBlock instead.",
5850
DeprecationWarning,
5951
stacklevel=find_stack_level(),
6052
)
61-
return block_type
53+
if name == "NumericBlock":
54+
from pandas.core.internals.blocks import NumericBlock
55+
56+
return NumericBlock
57+
else:
58+
from pandas.core.internals.blocks import ObjectBlock
59+
60+
return ObjectBlock
6261

6362
raise AttributeError(f"module 'pandas.core.internals' has no attribute '{name}'")

pandas/core/internals/blocks.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -478,6 +478,8 @@ def convert(
478478
if self.ndim != 1 and self.shape[0] != 1:
479479
return self.split_and_operate(Block.convert, copy=copy, using_cow=using_cow)
480480

481+
# needed for type hints
482+
assert isinstance(self.values, np.ndarray)
481483
values = self.values
482484
if values.ndim == 2:
483485
# maybe_split ensures we only get here with values.shape[0] == 1,

0 commit comments

Comments
 (0)