Skip to content

Commit 67e2dbc

Browse files
Fix mypy pre-commit problems
The command `pre-comment run -a` doesn't do all the things that Pandas CI/CD does. This commit fixes two problems found in the mypy section: * Adding some comments to ignore some errors in _ensure_data for complex dtypes * Fix the type signature of _get_expected_exception to match LSP stylings Signed-off-by: Michael Tiemann <72577720+MichaelTiemannOSC@users.noreply.github.com>
1 parent 19d3127 commit 67e2dbc

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

pandas/core/algorithms.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,9 @@ def _ensure_data(values: ArrayLike) -> np.ndarray:
167167
return np.asarray(values)
168168

169169
elif is_complex_dtype(values.dtype):
170-
if values.dtype.itemsize == 16:
170+
# error: Item "ExtensionDtype" of "Union[Any, ExtensionDtype]"
171+
# has no attribute "itemsize"
172+
if values.dtype.itemsize == 16: # type: ignore[union-attr]
171173
# We have support for complex128
172174
return np.asarray(values)
173175
return cast(np.ndarray, values)

pandas/tests/extension/decimal/test_decimal.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -330,7 +330,7 @@ class TestArithmeticOps(base.BaseArithmeticOpsTests):
330330
series_array_exc = None
331331

332332
def _get_expected_exception(
333-
self, op_name: str, obj, other
333+
self, op_name: str, obj, other, *args, **kwargs
334334
) -> type[Exception] | None:
335335
return None
336336

0 commit comments

Comments
 (0)