Skip to content

Commit 64d45e4

Browse files
authored
CI: update pyright (#57481)
1 parent c379331 commit 64d45e4

13 files changed

+31
-16
lines changed

.pre-commit-config.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ repos:
129129
types: [python]
130130
stages: [manual]
131131
additional_dependencies: &pyright_dependencies
132-
- pyright@1.1.347
132+
- pyright@1.1.350
133133
- id: pyright
134134
# note: assumes python env is setup and activated
135135
name: pyright reportGeneralTypeIssues

pandas/_testing/_hypothesis.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,8 @@
5454
DATETIME_NO_TZ = st.datetimes()
5555

5656
DATETIME_JAN_1_1900_OPTIONAL_TZ = st.datetimes(
57-
min_value=pd.Timestamp(1900, 1, 1).to_pydatetime(), # pyright: ignore[reportGeneralTypeIssues]
58-
max_value=pd.Timestamp(1900, 1, 1).to_pydatetime(), # pyright: ignore[reportGeneralTypeIssues]
57+
min_value=pd.Timestamp(1900, 1, 1).to_pydatetime(), # pyright: ignore[reportArgumentType]
58+
max_value=pd.Timestamp(1900, 1, 1).to_pydatetime(), # pyright: ignore[reportArgumentType]
5959
timezones=st.one_of(st.none(), dateutil_timezones(), pytz_timezones()),
6060
)
6161

pandas/conftest.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1404,7 +1404,7 @@ def fixed_now_ts() -> Timestamp:
14041404
"""
14051405
Fixture emits fixed Timestamp.now()
14061406
"""
1407-
return Timestamp( # pyright: ignore[reportGeneralTypeIssues]
1407+
return Timestamp( # pyright: ignore[reportReturnType]
14081408
year=2021, month=1, day=1, hour=12, minute=4, second=13, microsecond=22
14091409
)
14101410

pandas/core/_numba/kernels/mean_.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ def sliding_mean(
107107
neg_ct,
108108
compensation_add,
109109
num_consecutive_same_value,
110-
prev_value, # pyright: ignore[reportGeneralTypeIssues]
110+
prev_value, # pyright: ignore[reportArgumentType]
111111
)
112112
else:
113113
for j in range(start[i - 1], s):
@@ -132,7 +132,7 @@ def sliding_mean(
132132
neg_ct,
133133
compensation_add,
134134
num_consecutive_same_value,
135-
prev_value, # pyright: ignore[reportGeneralTypeIssues]
135+
prev_value, # pyright: ignore[reportArgumentType]
136136
)
137137

138138
if nobs >= min_periods and nobs > 0:

pandas/core/arrays/datetimelike.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -358,13 +358,13 @@ def __array__(self, dtype: NpDtype | None = None) -> np.ndarray:
358358
return self._ndarray
359359

360360
@overload
361-
def __getitem__(self, item: ScalarIndexer) -> DTScalarOrNaT:
361+
def __getitem__(self, key: ScalarIndexer) -> DTScalarOrNaT:
362362
...
363363

364364
@overload
365365
def __getitem__(
366366
self,
367-
item: SequenceIndexer | PositionalIndexerTuple,
367+
key: SequenceIndexer | PositionalIndexerTuple,
368368
) -> Self:
369369
...
370370

pandas/core/base.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1165,7 +1165,7 @@ def _memory_usage(self, deep: bool = False) -> int:
11651165
24
11661166
"""
11671167
if hasattr(self.array, "memory_usage"):
1168-
return self.array.memory_usage( # pyright: ignore[reportGeneralTypeIssues]
1168+
return self.array.memory_usage( # pyright: ignore[reportAttributeAccessIssue]
11691169
deep=deep,
11701170
)
11711171

pandas/core/computation/eval.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -394,7 +394,7 @@ def eval(
394394
if inplace and isinstance(target, NDFrame):
395395
target.loc[:, assigner] = ret
396396
else:
397-
target[assigner] = ret # pyright: ignore[reportGeneralTypeIssues]
397+
target[assigner] = ret # pyright: ignore[reportIndexIssue]
398398
except (TypeError, IndexError) as err:
399399
raise ValueError("Cannot assign expression output to target") from err
400400

pandas/core/dtypes/inference.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,7 @@ def is_nested_list_like(obj: object) -> bool:
264264
is_list_like(obj)
265265
and hasattr(obj, "__len__")
266266
# need PEP 724 to handle these typing errors
267-
and len(obj) > 0 # pyright: ignore[reportGeneralTypeIssues]
267+
and len(obj) > 0 # pyright: ignore[reportArgumentType]
268268
and all(is_list_like(item) for item in obj) # type: ignore[attr-defined]
269269
)
270270

pandas/io/xml.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -678,8 +678,8 @@ def get_data_from_filepath(
678678
2. file-like object (e.g. open file object, StringIO)
679679
"""
680680
filepath_or_buffer = stringify_path(filepath_or_buffer) # type: ignore[arg-type]
681-
with get_handle( # pyright: ignore[reportGeneralTypeIssues]
682-
filepath_or_buffer, # pyright: ignore[reportGeneralTypeIssues]
681+
with get_handle( # pyright: ignore[reportCallIssue]
682+
filepath_or_buffer, # pyright: ignore[reportArgumentType]
683683
"r",
684684
encoding=encoding,
685685
compression=compression,

pandas/util/_decorators.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -368,7 +368,7 @@ def decorator(decorated: F) -> F:
368368
continue
369369
if hasattr(docstring, "_docstring_components"):
370370
docstring_components.extend(
371-
docstring._docstring_components # pyright: ignore[reportGeneralTypeIssues]
371+
docstring._docstring_components # pyright: ignore[reportAttributeAccessIssue]
372372
)
373373
elif isinstance(docstring, str) or docstring.__doc__:
374374
docstring_components.append(docstring)

pandas/util/_validators.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -443,7 +443,7 @@ def validate_insert_loc(loc: int, length: int) -> int:
443443
loc += length
444444
if not 0 <= loc <= length:
445445
raise IndexError(f"loc must be an integer between -{length} and {length}")
446-
return loc # pyright: ignore[reportGeneralTypeIssues]
446+
return loc # pyright: ignore[reportReturnType]
447447

448448

449449
def check_dtype_backend(dtype_backend) -> None:

pyproject.toml

+8
Original file line numberDiff line numberDiff line change
@@ -732,14 +732,22 @@ reportUntypedNamedTuple = true
732732
reportUnusedImport = true
733733
disableBytesTypePromotions = true
734734
# disable subset of "basic"
735+
reportArgumentType = false
736+
reportAssignmentType = false
737+
reportAttributeAccessIssue = false
738+
reportCallIssue = false
735739
reportGeneralTypeIssues = false
740+
reportIndexIssue = false
736741
reportMissingModuleSource = false
742+
reportOperatorIssue = false
737743
reportOptionalCall = false
738744
reportOptionalIterable = false
739745
reportOptionalMemberAccess = false
740746
reportOptionalOperand = false
741747
reportOptionalSubscript = false
742748
reportPrivateImportUsage = false
749+
reportRedeclaration = false
750+
reportReturnType = false
743751
reportUnboundVariable = false
744752

745753
[tool.coverage.run]

pyright_reportGeneralTypeIssues.json

+8-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,14 @@
11
{
22
"typeCheckingMode": "off",
3+
"reportArgumentType": true,
4+
"reportAssignmentType": true,
5+
"reportAttributeAccessIssue": true,
6+
"reportCallIssue": true,
37
"reportGeneralTypeIssues": true,
8+
"reportIndexIssue": true,
9+
"reportOperatorIssue": true,
10+
"reportRedeclaration": true,
11+
"reportReturnType": true,
412
"useLibraryCodeForTypes": false,
513
"analyzeUnannotatedFunctions": false,
614
"disableBytesTypePromotions": true,
@@ -63,7 +71,6 @@
6371
"pandas/core/indexes/period.py",
6472
"pandas/core/indexing.py",
6573
"pandas/core/internals/api.py",
66-
"pandas/core/internals/array_manager.py",
6774
"pandas/core/internals/blocks.py",
6875
"pandas/core/internals/construction.py",
6976
"pandas/core/internals/managers.py",

0 commit comments

Comments
 (0)