Skip to content

Commit fe85cc8

Browse files
committed
CLN: appease mypy
1 parent 5415de5 commit fe85cc8

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
@@ -481,7 +481,7 @@ def convert(
481481
values = values[0]
482482

483483
res_values = lib.maybe_convert_objects(
484-
values,
484+
values, # type: ignore[arg-type]
485485
convert_non_numeric=True,
486486
)
487487
refs = None
@@ -2137,14 +2137,14 @@ def values_for_json(self) -> np.ndarray:
21372137
return self.values
21382138

21392139
@cache_readonly
2140-
def is_numeric(self) -> bool:
2140+
def is_numeric(self) -> bool: # type: ignore[override]
21412141
dtype = self.values.dtype
21422142
kind = dtype.kind
21432143

21442144
return kind in "fciub"
21452145

21462146
@cache_readonly
2147-
def is_object(self) -> bool:
2147+
def is_object(self) -> bool: # type: ignore[override]
21482148
return self.values.dtype.kind == "O"
21492149

21502150

0 commit comments

Comments
 (0)