Skip to content

Commit ecda401

Browse files
committed
classify ann
1 parent 143bab4 commit ecda401

File tree

9 files changed

+68
-26
lines changed

9 files changed

+68
-26
lines changed

pandas-stubs/_testing/__init__.pyi

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -92,16 +92,6 @@ def assert_timedelta_array_equal(
9292
obj: str = "TimedeltaArray",
9393
check_freq: bool = True,
9494
) -> None: ...
95-
def assert_numpy_array_equal(
96-
left,
97-
right,
98-
strict_nan: bool = False,
99-
check_dtype: bool | Literal["equiv"] = True,
100-
err_msg: str | None = None,
101-
check_same: Literal["copy", "same"] | None = None,
102-
obj: str = "numpy array",
103-
index_values: Index | np.ndarray | None = None,
104-
) -> None: ...
10595
def assert_extension_array_equal(
10696
left: ExtensionArray,
10797
right: ExtensionArray,
@@ -173,7 +163,6 @@ def assert_frame_equal(
173163
atol: float = 1e-8,
174164
obj: str = "DataFrame",
175165
) -> None: ...
176-
def assert_equal(left, right, **kwargs: Any) -> None: ...
177166
def assert_sp_array_equal(left: SparseArray, right: SparseArray) -> None: ...
178167
def assert_contains_all(iterable: Iterable[T], dic: Container[T]) -> None: ...
179168
def assert_copy(iter1: Iterable[T], iter2: Iterable[T], **eql_kwargs: Any) -> None: ...

pandas-stubs/core/algorithms.pyi

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
from typing import (
2+
Any,
23
Literal,
34
overload,
45
)
@@ -72,9 +73,9 @@ def value_counts(
7273
dropna: bool = True,
7374
) -> Series: ...
7475
def take(
75-
arr,
76+
arr: np.ndarray | ExtensionArray | Index | Series,
7677
indices: TakeIndexer,
7778
axis: Literal[0, 1] = 0,
7879
allow_fill: bool = False,
79-
fill_value=None,
80-
): ...
80+
fill_value: Any = None,
81+
) -> np_1darray | ExtensionArray: ...

pandas-stubs/core/groupby/groupby.pyi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -302,7 +302,7 @@ class GroupBy(BaseGroupBy[NDFrameT]):
302302
periods: int | Sequence[int] = 1,
303303
freq: Frequency | None = ...,
304304
axis: Axis | _NoDefaultDoNotUse = 0,
305-
fill_value=...,
305+
fill_value: Scalar | None = None,
306306
suffix: str | None = ...,
307307
) -> NDFrameT: ...
308308
@final

pandas-stubs/core/groupby/ops.pyi

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,6 @@ class BaseGrouper:
3939
def get_iterator(
4040
self, data: NDFrameT, axis: AxisInt = ...
4141
) -> Iterator[tuple[Hashable, NDFrameT]]: ...
42-
@final
43-
@cache_readonly
44-
def group_keys_seq(self): ...
4542
@cache_readonly
4643
def indices(self) -> dict[Hashable, npt.NDArray[np.intp]]: ...
4744
@final

pandas-stubs/core/interchange/dataframe_protocol.pyi

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ from typing import (
1414
cast,
1515
)
1616

17+
from typing_extensions import Self
18+
1719
class DlpackDeviceType(enum.IntEnum):
1820
CPU = cast(int, ...)
1921
CUDA = cast(int, ...)
@@ -58,7 +60,7 @@ class Buffer(ABC, metaclass=abc.ABCMeta):
5860
@abstractmethod
5961
def ptr(self) -> int: ...
6062
@abstractmethod
61-
def __dlpack__(self): ...
63+
def __dlpack__(self) -> Any: ...
6264
@abstractmethod
6365
def __dlpack_device__(self) -> tuple[DlpackDeviceType, int | None]: ...
6466

@@ -94,7 +96,9 @@ class Column(ABC, metaclass=abc.ABCMeta):
9496
class DataFrame(ABC, metaclass=abc.ABCMeta):
9597
version: int
9698
@abstractmethod
97-
def __dataframe__(self, nan_as_null: bool = ..., allow_copy: bool = ...): ...
99+
def __dataframe__(
100+
self, nan_as_null: bool = ..., allow_copy: bool = ...
101+
) -> Self: ...
98102
@property
99103
@abstractmethod
100104
def metadata(self) -> dict[str, Any]: ...

pandas-stubs/core/resample.pyi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ class Resampler(BaseGroupBy[NDFrameT]):
175175
# attributes via setattr
176176
class _GroupByMixin(Resampler[NDFrameT]):
177177
key: str | list[str] | None
178-
def __getitem__(self, key) -> Self: ... # type: ignore[override] # pyright: ignore[reportIncompatibleMethodOverride]
178+
def __getitem__(self, key: Hashable) -> Self: ... # type: ignore[override] # pyright: ignore[reportIncompatibleMethodOverride]
179179

180180
class DatetimeIndexResampler(Resampler[NDFrameT]): ...
181181

pandas-stubs/core/reshape/util.pyi

Lines changed: 0 additions & 1 deletion
This file was deleted.

pandas-stubs/errors/__init__.pyi

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ class MergeError(ValueError): ...
2020
class AccessorRegistrationWarning(Warning): ...
2121

2222
class AbstractMethodError(NotImplementedError):
23-
def __init__(self, class_instance, methodtype: str = ...) -> None: ...
23+
def __init__(self, class_instance: type, methodtype: str = ...) -> None: ...
2424

2525
class NumbaUtilError(Exception): ...
2626
class DuplicateLabelError(ValueError): ...
@@ -34,7 +34,7 @@ class IndexingError(Exception): ...
3434
class PyperclipException(RuntimeError): ...
3535

3636
class PyperclipWindowsException(PyperclipException):
37-
def __init__(self, message) -> None: ...
37+
def __init__(self, message: str) -> None: ...
3838

3939
class CSSWarning(UserWarning): ...
4040
class PossibleDataLossError(Exception): ...

pyproject.toml

Lines changed: 54 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -200,8 +200,60 @@ ignore = [
200200
"A004", # https://docs.astral.sh/ruff/rules/builtin-import-shadowing/
201201
"PYI001", # https://docs.astral.sh/ruff/rules/unprefixed-type-param/
202202
"PYI042", # https://docs.astral.sh/ruff/rules/snake-case-type-alias/
203-
"ERA001", "ANN001", "ANN201", "ANN204", "ANN206", "ANN401", "PLR0402", "PLC0105"
204-
]
203+
"ERA001", "ANN401", "PLR0402", "PLC0105"
204+
]
205+
"*range.pyi" = [
206+
# TODO: remove when pandas-dev/pandas-stubs#1442 is resolved
207+
"ANN001", "ANN201", "ANN204", "ANN206",
208+
]
209+
"*category.pyi" = [
210+
# TODO: remove when pandas-dev/pandas-stubs#1443 is resolved
211+
"ANN001", "ANN201", "ANN204", "ANN206",
212+
]
213+
"*series.pyi" = [
214+
# TODO: remove when pandas-dev/pandas-stubs#1444 is resolved
215+
"ANN001", "ANN201", "ANN204", "ANN206",
216+
]
217+
"*frame.pyi" = [
218+
# TODO: remove when pandas-dev/pandas-stubs#1446 is resolved
219+
"ANN001", "ANN201", "ANN204", "ANN206",
220+
]
221+
"*index*" = [
222+
# TODO: remove when indexes are fully typed
223+
"ANN001", "ANN201", "ANN204", "ANN206",
224+
]
225+
"*computation*" = [
226+
# TODO: remove when computations are fully typed
227+
"ANN001", "ANN201", "ANN204", "ANN206",
228+
]
229+
"*plotting*" = [
230+
# TODO: remove when plottings are fully typed
231+
"ANN001", "ANN201", "ANN204", "ANN206",
232+
]
233+
"*io*" = [
234+
# TODO: remove when io is fully typed
235+
"ANN001", "ANN201", "ANN204", "ANN206",
236+
]
237+
"*window*" = [
238+
# TODO: remove when window is fully typed
239+
"ANN001", "ANN201", "ANN204", "ANN206",
240+
]
241+
"*generic.pyi" = [
242+
# TODO: remove when generic.pyi is fully typed
243+
"ANN001", "ANN201", "ANN204", "ANN206",
244+
]
245+
"*array*" = [
246+
# TODO: remove when array is fully typed
247+
"ANN001", "ANN201", "ANN204", "ANN206",
248+
]
249+
"*_libs*" = [
250+
# TODO: remove when _libs is fully typed
251+
"ANN001", "ANN201", "ANN204", "ANN206",
252+
]
253+
"*base.pyi" = [
254+
# TODO: remove when base.pyi's are fully typed
255+
"ANN001", "ANN201", "ANN204", "ANN206",
256+
]
205257
"scripts/*" = [
206258
# The following rules are ignored permanently for good reasons
207259
"EM", # https://docs.astral.sh/ruff/rules/#flake8-errmsg-em

0 commit comments

Comments
 (0)