Skip to content

Commit ba9e478

Browse files
committed
fix pyright
1 parent 942713a commit ba9e478

File tree

3 files changed

+6
-24
lines changed

3 files changed

+6
-24
lines changed

.pre-commit-config.yaml

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -77,27 +77,6 @@ repos:
7777
--linelength=88,
7878
'--filter=-readability/casting,-runtime/int,-build/include_subdir,-readability/fn_size'
7979
]
80-
- repo: https://github.com/pycqa/pylint
81-
rev: v2.16.1
82-
hooks:
83-
- id: pylint
84-
stages: [manual]
85-
- repo: https://github.com/pycqa/pylint
86-
rev: v2.16.1
87-
hooks:
88-
- id: pylint
89-
alias: redefined-outer-name
90-
name: Redefining name from outer scope
91-
files: ^pandas/
92-
exclude: |
93-
(?x)
94-
^pandas/tests # keep excluded
95-
|/_testing/ # keep excluded
96-
|^pandas/util/_test_decorators\.py # keep excluded
97-
|^pandas/_version\.py # keep excluded
98-
|^pandas/conftest\.py # keep excluded
99-
args: [--disable=all, --enable=redefined-outer-name]
100-
stages: [manual]
10180
- repo: https://github.com/PyCQA/isort
10281
rev: 5.12.0
10382
hooks:

pandas/compat/numpy/function.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
overload,
2525
)
2626

27+
import numpy as np
2728
from numpy import ndarray
2829

2930
from pandas._libs.lib import (
@@ -212,7 +213,7 @@ def validate_clip_with_axis(
212213
)
213214

214215

215-
def validate_cum_func_with_skipna(skipna, args, kwargs, name) -> bool:
216+
def validate_cum_func_with_skipna(skipna: bool, args, kwargs, name) -> bool:
216217
"""
217218
If this function is called via the 'numpy' library, the third parameter in
218219
its signature is 'dtype', which takes either a 'numpy' dtype or 'None', so
@@ -221,6 +222,8 @@ def validate_cum_func_with_skipna(skipna, args, kwargs, name) -> bool:
221222
if not is_bool(skipna):
222223
args = (skipna,) + args
223224
skipna = True
225+
elif isinstance(skipna, np.bool_):
226+
skipna = bool(skipna)
224227

225228
validate_cum_func(args, kwargs, fname=name)
226229
return skipna

pandas/util/_validators.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,7 @@ def validate_bool_kwarg(
258258
f'For argument "{arg_name}" expected type bool, received '
259259
f"type {type(value).__name__}."
260260
)
261-
return value
261+
return value # pyright: ignore[reportGeneralTypeIssues]
262262

263263

264264
def validate_fillna_kwargs(value, method, validate_scalar_dict_value: bool = True):
@@ -437,4 +437,4 @@ def validate_insert_loc(loc: int, length: int) -> int:
437437
loc += length
438438
if not 0 <= loc <= length:
439439
raise IndexError(f"loc must be an integer between -{length} and {length}")
440-
return loc
440+
return loc # pyright: ignore[reportGeneralTypeIssues]

0 commit comments

Comments
 (0)