Skip to content

Commit 35746ac

Browse files
committed
fix pyright
1 parent 2940b01 commit 35746ac

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

pandas/compat/numpy/function.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
overload,
2626
)
2727

28+
import numpy as np
2829
from numpy import ndarray
2930

3031
from pandas._libs.lib import (
@@ -215,7 +216,7 @@ def validate_clip_with_axis(
215216
)
216217

217218

218-
def validate_cum_func_with_skipna(skipna, args, kwargs, name) -> bool:
219+
def validate_cum_func_with_skipna(skipna: bool, args, kwargs, name) -> bool:
219220
"""
220221
If this function is called via the 'numpy' library, the third parameter in
221222
its signature is 'dtype', which takes either a 'numpy' dtype or 'None', so
@@ -224,6 +225,8 @@ def validate_cum_func_with_skipna(skipna, args, kwargs, name) -> bool:
224225
if not is_bool(skipna):
225226
args = (skipna,) + args
226227
skipna = True
228+
elif isinstance(skipna, np.bool_):
229+
skipna = bool(skipna)
227230

228231
validate_cum_func(args, kwargs, fname=name)
229232
return skipna

pandas/util/_validators.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,7 @@ def validate_bool_kwarg(
260260
f'For argument "{arg_name}" expected type bool, received '
261261
f"type {type(value).__name__}."
262262
)
263-
return value
263+
return value # pyright: ignore[reportGeneralTypeIssues]
264264

265265

266266
def validate_fillna_kwargs(value, method, validate_scalar_dict_value: bool = True):

0 commit comments

Comments
 (0)