Skip to content

Commit b176418

Browse files
authored
TYP: fix mypy errors in pandas/core/arraylike.py (#39104)
1 parent ffaaef5 commit b176418

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

pandas/core/arraylike.py

+3-5
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,7 @@ def _maybe_fallback(ufunc: Callable, method: str, *inputs: Any, **kwargs: Any):
228228
return NotImplemented
229229

230230

231-
def array_ufunc(self, ufunc: Callable, method: str, *inputs: Any, **kwargs: Any):
231+
def array_ufunc(self, ufunc: np.ufunc, method: str, *inputs: Any, **kwargs: Any):
232232
"""
233233
Compatibility with numpy ufuncs.
234234
@@ -341,9 +341,7 @@ def reconstruct(result):
341341
result = result.__finalize__(self)
342342
return result
343343

344-
if self.ndim > 1 and (
345-
len(inputs) > 1 or ufunc.nout > 1 # type: ignore[attr-defined]
346-
):
344+
if self.ndim > 1 and (len(inputs) > 1 or ufunc.nout > 1):
347345
# Just give up on preserving types in the complex case.
348346
# In theory we could preserve them for them.
349347
# * nout>1 is doable if BlockManager.apply took nout and
@@ -367,7 +365,7 @@ def reconstruct(result):
367365
# Those can have an axis keyword and thus can't be called block-by-block
368366
result = getattr(ufunc, method)(np.asarray(inputs[0]), **kwargs)
369367

370-
if ufunc.nout > 1: # type: ignore[attr-defined]
368+
if ufunc.nout > 1:
371369
result = tuple(reconstruct(x) for x in result)
372370
else:
373371
result = reconstruct(result)

0 commit comments

Comments
 (0)