Skip to content

Commit 28d8ba5

Browse files
twoertweinyehoshuadimarsky
authored andcommitted
STYL: a few cleanups in pyi files (pandas-dev#46921)
1 parent 55d8196 commit 28d8ba5

File tree

6 files changed

+15
-45
lines changed

6 files changed

+15
-45
lines changed

pandas/_libs/hashtable.pyi

+5-18
Original file line numberDiff line numberDiff line change
@@ -144,26 +144,13 @@ class HashTable:
144144
np.ndarray, # np.ndarray[subclass-specific]
145145
npt.NDArray[np.intp],
146146
] | np.ndarray: ... # np.ndarray[subclass-specific]
147-
def _unique(
148-
self,
149-
values: np.ndarray, # np.ndarray[subclass-specific]
150-
uniques, # FooVector
151-
count_prior: int = ...,
152-
na_sentinel: int = ...,
153-
na_value: object = ...,
154-
ignore_na: bool = ...,
155-
return_inverse: bool = ...,
156-
) -> tuple[
157-
np.ndarray, # np.ndarray[subclass-specific]
158-
npt.NDArray[np.intp],
159-
] | np.ndarray: ... # np.ndarray[subclass-specific]
160147
def factorize(
161148
self,
162149
values: np.ndarray, # np.ndarray[subclass-specific]
163150
na_sentinel: int = ...,
164151
na_value: object = ...,
165152
mask=...,
166-
) -> tuple[np.ndarray, npt.NDArray[np.intp],]: ... # np.ndarray[subclass-specific]
153+
) -> tuple[np.ndarray, npt.NDArray[np.intp]]: ... # np.ndarray[subclass-specific]
167154

168155
class Complex128HashTable(HashTable): ...
169156
class Complex64HashTable(HashTable): ...
@@ -175,7 +162,7 @@ class Int64HashTable(HashTable):
175162
def get_labels_groupby(
176163
self,
177164
values: npt.NDArray[np.int64], # const int64_t[:]
178-
) -> tuple[npt.NDArray[np.intp], npt.NDArray[np.int64],]: ...
165+
) -> tuple[npt.NDArray[np.intp], npt.NDArray[np.int64]]: ...
179166
def map_keys_to_values(
180167
self,
181168
keys: npt.NDArray[np.int64],
@@ -198,13 +185,13 @@ def duplicated(
198185
keep: Literal["last", "first", False] = ...,
199186
) -> npt.NDArray[np.bool_]: ...
200187
def mode(
201-
values: np.ndarray, dropna: bool, mask: npt.NDArray[np.bool_] | None = None
188+
values: np.ndarray, dropna: bool, mask: npt.NDArray[np.bool_] | None = ...
202189
) -> np.ndarray: ...
203190
def value_count(
204191
values: np.ndarray,
205192
dropna: bool,
206-
mask: npt.NDArray[np.bool_] | None = None,
207-
) -> tuple[np.ndarray, npt.NDArray[np.int64],]: ... # np.ndarray[same-as-values]
193+
mask: npt.NDArray[np.bool_] | None = ...,
194+
) -> tuple[np.ndarray, npt.NDArray[np.int64]]: ... # np.ndarray[same-as-values]
208195

209196
# arr and values should have same dtype
210197
def ismember(

pandas/_libs/tslibs/conversion.pyi

+2-2
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ class OutOfBoundsTimedelta(ValueError): ...
1414

1515
def precision_from_unit(
1616
unit: str,
17-
) -> tuple[int, int,]: ... # (int64_t, _)
17+
) -> tuple[int, int]: ... # (int64_t, _)
1818
def ensure_datetime64ns(
1919
arr: np.ndarray, # np.ndarray[datetime64[ANY]]
2020
copy: bool = ...,
@@ -25,5 +25,5 @@ def ensure_timedelta64ns(
2525
) -> np.ndarray: ... # np.ndarray[timedelta64ns]
2626
def datetime_to_datetime64(
2727
values: npt.NDArray[np.object_],
28-
) -> tuple[np.ndarray, tzinfo | None,]: ... # (np.ndarray[dt64ns], _)
28+
) -> tuple[np.ndarray, tzinfo | None]: ... # (np.ndarray[dt64ns], _)
2929
def localize_pydatetime(dt: datetime, tz: tzinfo | None) -> datetime: ...

pandas/_libs/tslibs/dtypes.pyi

-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
from enum import Enum
22

3-
from pandas._libs.tslibs.offsets import BaseOffset
4-
53
# These are not public API, but are exposed in the .pyi file because they
64
# are imported in tests.
75
_attrname_to_abbrevs: dict[str, str]

pandas/_libs/tslibs/timestamps.pyi

-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ import numpy as np
1616

1717
from pandas._libs.tslibs import (
1818
BaseOffset,
19-
NaTType,
2019
Period,
2120
Tick,
2221
Timedelta,

pandas/conftest.py

-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
- Dtypes
1818
- Misc
1919
"""
20-
# pyright: reportUntypedFunctionDecorator = false
2120

2221
from collections import abc
2322
from datetime import (

pyproject.toml

+8-21
Original file line numberDiff line numberDiff line change
@@ -153,34 +153,21 @@ pythonVersion = "3.8"
153153
typeCheckingMode = "basic"
154154
include = ["pandas", "typings"]
155155
exclude = ["pandas/tests", "pandas/io/clipboard", "pandas/util/version"]
156+
# enable subset of "strict"
157+
reportDuplicateImport = true
158+
reportInvalidStubStatement = true
159+
reportPropertyTypeMismatch = true
160+
reportUntypedClassDecorator = true
161+
reportUntypedFunctionDecorator = true
162+
reportUntypedNamedTuple = true
163+
# disable subset of "basic"
156164
reportGeneralTypeIssues = false
157-
reportConstantRedefinition = false
158-
reportFunctionMemberAccess = false
159-
reportImportCycles = false
160-
reportIncompatibleMethodOverride = false
161-
reportIncompatibleVariableOverride = false
162165
reportMissingModuleSource = false
163-
reportMissingParameterType = false
164-
reportMissingTypeArgument = false
165-
reportMissingTypeStubs = false
166166
reportOptionalCall = false
167167
reportOptionalIterable = false
168168
reportOptionalMemberAccess = false
169169
reportOptionalOperand = false
170170
reportOptionalSubscript = false
171171
reportPrivateImportUsage = false
172-
reportPrivateUsage = false
173172
reportUnboundVariable = false
174-
reportUnknownArgumentType = false
175-
reportUnknownLambdaType = false
176-
reportUnknownMemberType = false
177-
reportUnknownParameterType = false
178-
reportUnknownVariableType = false
179-
reportUnnecessaryComparison = false
180-
reportUnnecessaryIsInstance = false
181173
reportUnsupportedDunderAll = false
182-
reportUntypedBaseClass = false
183-
reportUnusedClass = false
184-
reportUnusedFunction = false
185-
reportUnusedImport = false
186-
reportUnusedVariable = false

0 commit comments

Comments
 (0)