Skip to content

Commit f094cd7

Browse files
committed
fix: comments
1 parent ddc41d1 commit f094cd7

File tree

7 files changed

+16
-24
lines changed

7 files changed

+16
-24
lines changed

.pre-commit-config.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ minimum_pre_commit_version: 2.15.0
22
ci:
33
autofix_prs: false
44
repos:
5-
- repo: https://github.com/python/black
5+
- repo: https://github.com/psf/black
66
rev: 25.9.0
77
hooks:
88
- id: black
@@ -11,7 +11,7 @@ repos:
1111
hooks:
1212
- id: isort
1313
- repo: https://github.com/astral-sh/ruff-pre-commit
14-
rev: v0.13.1
14+
rev: v0.13.2
1515
hooks:
1616
- id: ruff-check
1717
args: [

pandas-stubs/_typing.pyi

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -825,14 +825,6 @@ np_ndarray_td: TypeAlias = npt.NDArray[np.timedelta64]
825825

826826
# Define shape and generic type variables with defaults similar to numpy
827827
GenericT = TypeVar("GenericT", bound=np.generic, default=Any)
828-
TD64ItemT = TypeVar(
829-
"TD64ItemT",
830-
bound=datetime.timedelta | int | None,
831-
default=datetime.timedelta | int | None,
832-
)
833-
DT64ItemT = TypeVar(
834-
"DT64ItemT", bound=datetime.date | int | None, default=datetime.date | int | None
835-
)
836828
GenericT_co = TypeVar("GenericT_co", bound=np.generic, default=Any, covariant=True)
837829
ShapeT = TypeVar("ShapeT", bound=tuple[int, ...], default=tuple[Any, ...])
838830
# Numpy ndarray with more ergonomic typevar

pandas-stubs/core/indexes/base.pyi

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -477,7 +477,6 @@ class Index(IndexOpsMixin[S1]):
477477
def __ge__(self, other: Self | S1) -> np_1darray[np.bool]: ... # type: ignore[override] # pyright: ignore[reportIncompatibleMethodOverride]
478478
def __lt__(self, other: Self | S1) -> np_1darray[np.bool]: ... # type: ignore[override] # pyright: ignore[reportIncompatibleMethodOverride]
479479
def __gt__(self, other: Self | S1) -> np_1darray[np.bool]: ... # type: ignore[override] # pyright: ignore[reportIncompatibleMethodOverride]
480-
# overwrite inherited methods from OpsMixin
481480
@overload
482481
def __add__(self: Index[Never], other: _str) -> Never: ...
483482
@overload

pandas-stubs/core/series.pyi

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4461,7 +4461,7 @@ class Series(IndexOpsMixin[S1], NDFrame):
44614461
level: None = ...,
44624462
numeric_only: _bool = False,
44634463
**kwargs: Any,
4464-
) -> Any: ...
4464+
) -> float: ...
44654465
@overload
44664466
def mean(
44674467
self: Series[Timestamp],
@@ -4488,7 +4488,7 @@ class Series(IndexOpsMixin[S1], NDFrame):
44884488
level: None = ...,
44894489
numeric_only: _bool = False,
44904490
**kwargs: Any,
4491-
) -> Any: ...
4491+
) -> float: ...
44924492
@overload
44934493
def median(
44944494
self: Series[complex],
@@ -4633,7 +4633,7 @@ class Series(IndexOpsMixin[S1], NDFrame):
46334633
ddof: int = 1,
46344634
numeric_only: _bool = False,
46354635
**kwargs: Any,
4636-
) -> Any: ...
4636+
) -> float: ...
46374637
@overload
46384638
def std(
46394639
self: Series[complex],
@@ -4675,7 +4675,7 @@ class Series(IndexOpsMixin[S1], NDFrame):
46754675
@overload # type: ignore[override]
46764676
def to_numpy( # pyrefly: ignore[bad-override]
46774677
self: Series[Timestamp],
4678-
dtype: None = None,
4678+
dtype: None | type[np.datetime64] = None,
46794679
copy: bool = False,
46804680
na_value: Scalar = ...,
46814681
**kwargs,
@@ -4691,7 +4691,7 @@ class Series(IndexOpsMixin[S1], NDFrame):
46914691
@overload
46924692
def to_numpy( # pyrefly: ignore[bad-override]
46934693
self: Series[Timedelta],
4694-
dtype: None = None,
4694+
dtype: None | type[np.timedelta64] = None,
46954695
copy: bool = False,
46964696
na_value: Scalar = ...,
46974697
**kwargs,

tests/indexes/arithmetic/bool/test_add.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ def test_add_py_scalar() -> None:
1313
"""Test pd.Index[bool] + Python native scalars"""
1414
b, i, f, c = True, 1, 1.0, 1j
1515

16-
left.__add__(b)
1716
check(assert_type(left + b, "pd.Index[bool]"), pd.Index, np.bool_)
1817
check(assert_type(left + i, "pd.Index[int]"), pd.Index, np.integer)
1918
check(assert_type(left + f, "pd.Index[float]"), pd.Index, np.floating)

tests/series/test_agg.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
from typing import Any
2-
31
import numpy as np
42
import pandas as pd
53
from typing_extensions import assert_type
@@ -13,9 +11,9 @@
1311

1412
def test_agg_any_float() -> None:
1513
series = pd.DataFrame({"A": [1.0, float("nan"), 2.0]})["A"]
16-
check(assert_type(series.mean(), Any), np.float64)
17-
check(assert_type(series.median(), Any), np.float64)
18-
check(assert_type(series.std(), Any), np.float64)
14+
check(assert_type(series.mean(), float), np.float64)
15+
check(assert_type(series.median(), float), np.float64)
16+
check(assert_type(series.std(), float), np.float64)
1917

2018

2119
def test_agg_bool() -> None:

tests/test_timefuncs.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1042,8 +1042,7 @@ def test_series_types_to_numpy() -> None:
10421042
dtype=np.int64,
10431043
)
10441044
check(
1045-
# mypy gives error: Expression is of type "ndarray[tuple[int], dtype[timedelta64[Any]]]", not "ndarray[tuple[int], dtype[timedelta64[timedelta | int | None]]]" [assert-type]
1046-
assert_type(td_s.to_numpy(dtype=np.timedelta64), np_1darray[np.timedelta64]), # type: ignore[assert-type]
1045+
assert_type(td_s.to_numpy(dtype=np.timedelta64), np_1darray[np.timedelta64]),
10471046
np_1darray,
10481047
dtype=np.timedelta64,
10491048
)
@@ -1052,6 +1051,11 @@ def test_series_types_to_numpy() -> None:
10521051
np_1darray,
10531052
dtype=np.int64,
10541053
)
1054+
check(
1055+
assert_type(ts_s.to_numpy(dtype=np.datetime64), np_1darray[np.datetime64]),
1056+
np_1darray,
1057+
dtype=np.datetime64,
1058+
)
10551059
check(
10561060
assert_type(p_s.to_numpy(dtype=np.int64), np_1darray[np.int64]),
10571061
np_1darray,

0 commit comments

Comments
 (0)