Skip to content
2 changes: 1 addition & 1 deletion pandas-stubs/_testing/__init__.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ def assert_frame_equal(
def assert_equal(left, right, **kwargs: Any) -> None: ...
def assert_sp_array_equal(left: SparseArray, right: SparseArray) -> None: ...
def assert_contains_all(iterable: Iterable[T], dic: Container[T]) -> None: ...
def assert_copy(iter1: Iterable[T], iter2: Iterable[T], **eql_kwargs) -> None: ...
def assert_copy(iter1: Iterable[T], iter2: Iterable[T], **eql_kwargs: Any) -> None: ...
@contextmanager
def assert_produces_warning(
expected_warning: (
Expand Down
3 changes: 3 additions & 0 deletions pandas-stubs/core/arrays/base.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ from pandas._typing import (
from pandas.core.dtypes.dtypes import ExtensionDtype as ExtensionDtype

class ExtensionArray:
def __array_ufunc__(
self, ufunc: np.ufunc, method: str, *inputs: Any, **kwargs: Any
) -> Any: ...
@overload
def __getitem__(self, item: ScalarIndexer) -> Any: ...
@overload
Expand Down
1 change: 0 additions & 1 deletion pandas-stubs/core/arrays/boolean.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ class BooleanArray(BaseMaskedArray):
) -> None: ...
@property
def dtype(self): ...
def __array_ufunc__(self, ufunc, method, *inputs, **kwargs: Any): ...
def __setitem__(self, key, value) -> None: ...
def astype(self, dtype, copy: bool = True): ...
def any(self, *, skipna: bool = ..., **kwargs: Any): ...
Expand Down
8 changes: 4 additions & 4 deletions pandas-stubs/core/arrays/categorical.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ from pandas._typing import (
ArrayLike,
Dtype,
ListLike,
NpDtype,
Ordered,
PositionalIndexerTuple,
Scalar,
Expand Down Expand Up @@ -89,8 +90,9 @@ class Categorical(ExtensionArray):
@property
def shape(self): ...
def shift(self, periods=1, fill_value=...): ...
def __array__(self, dtype=...) -> np_1darray: ...
def __array_ufunc__(self, ufunc, method, *inputs, **kwargs: Any): ...
def __array__(
self, dtype: NpDtype | None = None, copy: bool | None = None
) -> np_1darray: ...
@property
def T(self): ...
@property
Expand All @@ -112,8 +114,6 @@ class Categorical(ExtensionArray):
def take(
self, indexer: TakeIndexer, *, allow_fill: bool = ..., fill_value=...
) -> Categorical: ...
def __len__(self) -> int: ...
def __iter__(self): ...
def __contains__(self, key) -> bool: ...
@overload
def __getitem__(self, key: ScalarIndexer) -> Any: ...
Expand Down
7 changes: 5 additions & 2 deletions pandas-stubs/core/arrays/datetimelike.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,14 @@ from pandas._libs import (
)
from pandas._typing import (
DatetimeLikeScalar,
NpDtype,
PositionalIndexerTuple,
ScalarIndexer,
SequenceIndexer,
TimeAmbiguous,
TimeNonexistent,
TimeUnit,
np_1darray,
)

DTScalarOrNaT: TypeAlias = DatetimeLikeScalar | NaTType
Expand Down Expand Up @@ -66,10 +68,11 @@ class DatetimeLikeArrayMixin(ExtensionOpsMixin, ExtensionArray):
def asi8(self) -> np.ndarray: ...
@property
def nbytes(self): ...
def __array__(self, dtype=...) -> np.ndarray: ...
def __array__(
self, dtype: NpDtype | None = None, copy: bool | None = None
) -> np_1darray: ...
@property
def size(self) -> int: ...
def __len__(self) -> int: ...
@overload
def __getitem__(self, key: ScalarIndexer) -> DTScalarOrNaT: ...
@overload
Expand Down
1 change: 0 additions & 1 deletion pandas-stubs/core/arrays/datetimes.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ class DatetimeArray(DatetimeLikeArrayMixin, TimelikeOps, DatelikeOps):
def tzinfo(self) -> _tzinfo | None: ...
@property
def is_normalized(self): ...
def __array__(self, dtype=...) -> np.ndarray: ...
def __iter__(self): ...
def astype(self, dtype, copy: bool = True): ...
def tz_convert(self, tz: TimeZones): ...
Expand Down
3 changes: 0 additions & 3 deletions pandas-stubs/core/arrays/integer.pyi
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
from typing import Any

from pandas.core.arrays.masked import BaseMaskedArray

from pandas._libs.missing import NAType
Expand All @@ -19,7 +17,6 @@ class IntegerArray(BaseMaskedArray):
@property
def dtype(self) -> _IntegerDtype: ...
def __init__(self, values, mask, copy: bool = ...) -> None: ...
def __array_ufunc__(self, ufunc, method, *inputs, **kwargs: Any): ...
def __setitem__(self, key, value) -> None: ...
def astype(self, dtype, copy: bool = True): ...

Expand Down
7 changes: 4 additions & 3 deletions pandas-stubs/core/arrays/interval.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ from pandas._libs.interval import (
)
from pandas._typing import (
Axis,
NpDtype,
Scalar,
ScalarIndexer,
SequenceIndexer,
Expand Down Expand Up @@ -57,8 +58,9 @@ class IntervalArray(IntervalMixin, ExtensionArray):
copy: bool = False,
dtype=None,
): ...
def __iter__(self): ...
def __len__(self) -> int: ...
def __array__(
self, dtype: NpDtype | None = None, copy: bool | None = None
) -> np_1darray: ...
@overload
def __getitem__(self, key: ScalarIndexer) -> IntervalOrNA: ...
@overload
Expand Down Expand Up @@ -100,7 +102,6 @@ class IntervalArray(IntervalMixin, ExtensionArray):
def mid(self) -> Index: ...
@property
def is_non_overlapping_monotonic(self) -> bool: ...
def __array__(self, dtype=...) -> np_1darray: ...
def __arrow_array__(self, type=...): ...
def to_tuples(self, na_tuple: bool = True): ...
def repeat(self, repeats, axis: Axis | None = ...): ...
Expand Down
7 changes: 5 additions & 2 deletions pandas-stubs/core/arrays/masked.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,11 @@ from pandas.core.arrays import (
from typing_extensions import Self

from pandas._typing import (
NpDtype,
Scalar,
ScalarIndexer,
SequenceIndexer,
np_1darray,
npt,
)

Expand All @@ -23,7 +25,6 @@ class BaseMaskedArray(ExtensionArray, ExtensionOpsMixin):
@overload
def __getitem__(self, item: SequenceIndexer) -> Self: ...
def __iter__(self): ...
def __len__(self) -> int: ...
def __invert__(self): ...
def to_numpy(
self,
Expand All @@ -32,7 +33,9 @@ class BaseMaskedArray(ExtensionArray, ExtensionOpsMixin):
na_value: Scalar = ...,
) -> np.ndarray: ...
__array_priority__: int = ...
def __array__(self, dtype=...) -> np.ndarray: ...
def __array__(
self, dtype: NpDtype | None = None, copy: bool | None = None
) -> np_1darray: ...
def __arrow_array__(self, type=...): ...
def isna(self): ...
@property
Expand Down
5 changes: 1 addition & 4 deletions pandas-stubs/core/arrays/numpy_.pyi
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
from typing import Any

import numpy as np
from numpy.lib.mixins import NDArrayOperatorsMixin
from pandas.core.arrays.base import (
Expand All @@ -15,5 +13,4 @@ class PandasDtype(ExtensionDtype):
@property
def itemsize(self) -> int: ...

class PandasArray(ExtensionArray, ExtensionOpsMixin, NDArrayOperatorsMixin):
def __array_ufunc__(self, ufunc, method, *inputs, **kwargs: Any): ...
class PandasArray(ExtensionArray, ExtensionOpsMixin, NDArrayOperatorsMixin): ...
9 changes: 7 additions & 2 deletions pandas-stubs/core/arrays/period.pyi
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import numpy as np
from pandas import PeriodDtype
from pandas.core.arrays.datetimelike import (
DatelikeOps,
Expand All @@ -7,13 +6,19 @@ from pandas.core.arrays.datetimelike import (

from pandas._libs.tslibs import Timestamp
from pandas._libs.tslibs.period import Period
from pandas._typing import (
NpDtype,
np_1darray,
)

class PeriodArray(DatetimeLikeArrayMixin, DatelikeOps):
__array_priority__: int = ...
def __init__(self, values, freq=..., dtype=..., copy: bool = ...) -> None: ...
@property
def dtype(self) -> PeriodDtype: ...
def __array__(self, dtype=...) -> np.ndarray: ...
def __array__(
self, dtype: NpDtype | None = None, copy: bool | None = None
) -> np_1darray: ...
def __arrow_array__(self, type=...): ...
year: int = ...
month: int = ...
Expand Down
9 changes: 5 additions & 4 deletions pandas-stubs/core/arrays/sparse/array.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,17 @@ from typing import (
overload,
)

import numpy as np
from pandas.core.arrays import (
ExtensionArray,
ExtensionOpsMixin,
)
from typing_extensions import Self

from pandas._typing import (
NpDtype,
ScalarIndexer,
SequenceIndexer,
np_1darray,
)

@final
Expand All @@ -33,7 +34,9 @@ class SparseArray(ExtensionArray, ExtensionOpsMixin):
) -> None: ...
@classmethod
def from_spmatrix(cls, data): ...
def __array__(self, dtype=..., copy=...) -> np.ndarray: ...
def __array__(
self, dtype: NpDtype | None = None, copy: bool | None = None
) -> np_1darray: ...
def __setitem__(self, key, value) -> None: ...
@property
def sp_index(self): ...
Expand All @@ -47,7 +50,6 @@ class SparseArray(ExtensionArray, ExtensionOpsMixin):
def fill_value(self, value) -> None: ...
@property
def kind(self) -> str: ...
def __len__(self) -> int: ...
@property
def nbytes(self) -> int: ...
@property
Expand Down Expand Up @@ -78,5 +80,4 @@ class SparseArray(ExtensionArray, ExtensionOpsMixin):
def mean(self, axis: int = ..., *args: Any, **kwargs: Any): ...
@property
def T(self): ...
def __array_ufunc__(self, ufunc, method, *inputs, **kwargs: Any): ...
def __abs__(self): ...
8 changes: 1 addition & 7 deletions pandas-stubs/core/indexes/category.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,7 @@ from pandas.core.indexes.base import Index
from pandas.core.indexes.extension import ExtensionIndex
from typing_extensions import Self

from pandas._typing import (
S1,
DtypeArg,
)
from pandas._typing import S1

class CategoricalIndex(ExtensionIndex[S1], accessor.PandasDelegate):
codes: np.ndarray = ...
Expand All @@ -36,9 +33,6 @@ class CategoricalIndex(ExtensionIndex[S1], accessor.PandasDelegate):
@property
def values(self): ...
def __contains__(self, key) -> bool: ...
def __array__(
self, dtype: DtypeArg = ..., copy: bool | None = ...
) -> np.ndarray: ...
@property
def is_unique(self) -> bool: ...
@property
Expand Down
1 change: 0 additions & 1 deletion pandas-stubs/core/indexes/range.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,6 @@ class RangeIndex(_IndexSubclassBase[int, np.int64]):
return_indexers: bool = ...,
sort: bool = ...,
): ...
def __len__(self) -> int: ...
@property
def size(self) -> int: ...
def __floordiv__(self, other): ...
Expand Down
8 changes: 5 additions & 3 deletions pandas-stubs/plotting/_misc.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ def radviz(
ax: Axes | None = None,
color: _Color | Sequence[_Color] | None = None,
colormap: str | Colormap | None = None,
**kwds,
**kwds: Any,
) -> Axes: ...
def andrews_curves(
frame: DataFrame,
Expand All @@ -65,7 +65,7 @@ def bootstrap_plot(
fig: Figure | None = None,
size: int = 50,
samples: int = 500,
**kwds,
**kwds: Any,
) -> Figure: ...
def parallel_coordinates(
frame: DataFrame,
Expand All @@ -81,7 +81,9 @@ def parallel_coordinates(
sort_labels: bool = False,
**kwargs: Any,
) -> Axes: ...
def lag_plot(series: Series, lag: int = 1, ax: Axes | None = None, **kwds) -> Axes: ...
def lag_plot(
series: Series, lag: int = 1, ax: Axes | None = None, **kwds: Any
) -> Axes: ...
def autocorrelation_plot(
series: Series, ax: Axes | None = None, **kwargs: Any
) -> Axes: ...
Expand Down
19 changes: 8 additions & 11 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -76,15 +76,15 @@ build-backend = "poetry.core.masonry.api"

[tool.poe.tasks.test_all]
help = "Run all tests"
script = "scripts.test:test(src=True, dist=True)"
script = "scripts.test:run_tests(src=True, dist=True)"

[tool.poe.tasks.test]
help = "Run local tests (includes 'mypy', 'pyright', 'pytest', and 'style')"
script = "scripts.test:test(src=True)"
script = "scripts.test:run_tests(src=True)"

[tool.poe.tasks.test_dist]
help = "Run tests on the installed stubs (includes 'mypy_dist' and 'pyright_dist')"
script = "scripts.test:test(dist=True)"
script = "scripts.test:run_tests(dist=True)"

[tool.poe.tasks.pytest]
help = "Run pytest"
Expand All @@ -106,7 +106,7 @@ script = "scripts.test:mypy_src(mypy_nightly)"

[tool.poe.tasks.mypy_dist]
help = "Run mypy on 'tests' using the installed stubs"
script = "scripts.test:test(dist=True, type_checker='mypy')"
script = "scripts.test:run_tests(dist=True, type_checker='mypy')"

[tool.poe.tasks.ty]
help = "Run ty on pandas-stubs"
Expand All @@ -126,7 +126,7 @@ script = "scripts.test.run:pyright_src_strict"

[tool.poe.tasks.pyright_dist]
help = "Run pyright on 'tests' using the installed stubs"
script = "scripts.test:test(dist=True, type_checker='pyright')"
script = "scripts.test:run_tests(dist=True, type_checker='pyright')"

[tool.poe.tasks.stubtest]
script = "scripts.test:stubtest(allowlist, check_missing, nightly)"
Expand Down Expand Up @@ -178,12 +178,12 @@ fix = true
[tool.ruff.lint]
extend-select = ["ALL"]
ignore = [
# The following rules are ignored permanently for good reasons
"COM", # https://docs.astral.sh/ruff/rules/#flake8-commas-com
"D", # https://docs.astral.sh/ruff/rules/#pydocstyle-d
"E501", # handled by black https://docs.astral.sh/ruff/rules/line-too-long/
"FBT", # https://docs.astral.sh/ruff/rules/#flake8-boolean-trap-fbt
"I", # handled by isort
"TRY003", # https://docs.astral.sh/ruff/rules/raise-vanilla-args/
]


Expand All @@ -200,14 +200,11 @@ ignore = [
"PYI001", # https://docs.astral.sh/ruff/rules/unprefixed-type-param/
"PYI042", # https://docs.astral.sh/ruff/rules/snake-case-type-alias/
"TD003", # https://docs.astral.sh/ruff/rules/missing-todo-link/
"ERA001", "ANN", "PLR0402", "PLC0105"
"ERA001", "ANN001", "ANN201", "ANN204", "ANN206", "ANN401", "PLR0402", "PLC0105"
]
"scripts/*" = [
# The following rules are ignored permanently for good reasons
"EM", # https://docs.astral.sh/ruff/rules/#flake8-errmsg-em
"S603", # https://docs.astral.sh/ruff/rules/subprocess-without-shell-equals-true/
# The following rules are ignored temporarily. Either fix them or move to the permanent list above.
"TRY", "PT", "BLE"
]
"tests/*" = [
# The following rules are ignored permanently for good reasons
Expand All @@ -223,7 +220,7 @@ ignore = [
"A001", # https://docs.astral.sh/ruff/rules/builtin-variable-shadowing/
"PYI042", # https://docs.astral.sh/ruff/rules/snake-case-type-alias/
"SLF001", # https://docs.astral.sh/ruff/rules/private-member-access/
"ANN001", "ANN002", "ANN201", "ANN202", "ANN204", "ANN206", "ANN401", "ARG", "ERA", "RUF", "SIM", "TRY", "PT", "NPY", "N", "DTZ", "PLR", "TC", "PGH", "PTH", "S311", "C901"
"ANN001", "ANN201", "ANN204", "ANN206", "ANN401", "ARG", "ERA", "RUF", "SIM", "TRY", "PT", "NPY", "N", "DTZ", "PLR", "TC", "PGH", "PTH", "S311", "C901"
]
"tests/test_io.py" = [
# The following rules are ignored permanently for good reasons
Expand Down
Loading