Skip to content

Commit 5642417

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

File tree

2 files changed

+11
-12
lines changed

2 files changed

+11
-12
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: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -485,7 +485,7 @@ def convert(
485485
values = values[0]
486486

487487
res_values = lib.maybe_convert_objects(
488-
values,
488+
values, # type: ignore[arg-type]
489489
convert_datetime=True,
490490
convert_timedelta=True,
491491
convert_period=True,
@@ -2142,14 +2142,14 @@ def values_for_json(self) -> np.ndarray:
21422142
return self.values
21432143

21442144
@cache_readonly
2145-
def is_numeric(self) -> bool:
2145+
def is_numeric(self) -> bool: # type: ignore[override]
21462146
dtype = self.values.dtype
21472147
kind = dtype.kind
21482148

21492149
return kind in "fciub"
21502150

21512151
@cache_readonly
2152-
def is_object(self) -> bool:
2152+
def is_object(self) -> bool: # type: ignore[override]
21532153
return self.values.dtype.kind == "O"
21542154

21552155

0 commit comments

Comments
 (0)