Skip to content

Commit 0e48282

Browse files
committed
WIP
1 parent 5a6906c commit 0e48282

File tree

4 files changed

+12
-16
lines changed

4 files changed

+12
-16
lines changed

pandas-stubs/core/arrays/base.pyi

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,11 @@ from pandas._typing import (
1010
npt,
1111
)
1212

13-
from pandas.core.dtypes.dtypes import ExtensionDtype as ExtensionDtype
13+
from pandas.core.dtypes.dtypes import ExtensionDtype
1414

1515
class ExtensionArray:
1616
def __getitem__(self, item) -> Any: ...
17-
def __setitem__(self, key: int | slice | np.ndarray, value) -> None: ...
17+
def __setitem__(self, key: int | slice | np.ndarray, value: Self) -> None: ...
1818
def __len__(self) -> int: ...
1919
def __iter__(self): ...
2020
def __contains__(self, item: object) -> bool | np.bool_: ...

pandas-stubs/core/arrays/interval.pyi

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,10 @@ from pandas import (
1212
Index,
1313
Series,
1414
)
15-
from pandas.core.arrays.base import ExtensionArray as ExtensionArray
15+
from pandas.core.arrays.base import ExtensionArray
1616
from typing_extensions import Self
1717

18-
from pandas._libs.interval import (
19-
Interval as Interval,
20-
IntervalMixin as IntervalMixin,
21-
)
18+
from pandas._libs.interval import Interval, IntervalMixin
2219
from pandas._typing import (
2320
Axis,
2421
IntervalT,
@@ -77,7 +74,6 @@ class IntervalArray(IntervalMixin, ExtensionArray, Generic[IntervalT]):
7774
def __iter__(self) -> IntervalT: ...
7875
def __len__(self) -> int: ...
7976
def __getitem__(self, value: IntervalT): ...
80-
def __setitem__(self, key: int, value: IntervalT) -> None: ...
8177
def __eq__(self, other): ...
8278
def __ne__(self, other): ...
8379
def fillna(self, value=..., method=..., limit=...): ...

pandas-stubs/core/arrays/string_.pyi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ class StringArray(PandasArray):
4848
| npt.NDArray[np.string_]
4949
| StringArray,
5050
) -> None: ...
51-
@overload # type: ignore[override]
51+
@overload
5252
def __getitem__(self, item: int) -> str | NAType: ...
5353
@overload
5454
def __getitem__(self, item: _ArrayKey) -> StringArray: ...

tests/test_arrays.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -439,11 +439,11 @@ def test_interval_array_construction() -> None:
439439

440440
def test_integer_array_attrib_props() -> None:
441441
ia = IntervalArray([pd.Interval(0, 1), pd.Interval(1, 2)])
442-
check(assert_type(ia.left, pd.Index), pd.Int64Index)
443-
check(assert_type(ia.right, pd.Index), pd.Int64Index)
442+
check(assert_type(ia.left, pd.Index), pd.Index, np.intp)
443+
check(assert_type(ia.right, pd.Index), pd.Index, np.intp)
444444
check(assert_type(ia.closed, str), str)
445-
check(assert_type(ia.mid, pd.Index), pd.Float64Index)
446-
check(assert_type(ia.length, pd.Index), pd.Int64Index)
445+
check(assert_type(ia.mid, pd.Index), pd.Index, float)
446+
check(assert_type(ia.length, pd.Index), pd.Index, np.intp)
447447
check(assert_type(ia.is_empty, npt.NDArray[np.bool_]), np.ndarray, np.bool_)
448448
check(assert_type(ia.is_non_overlapping_monotonic, bool), bool)
449449

@@ -473,9 +473,9 @@ def test_integer_array_attrib_props() -> None:
473473
check(assert_type(ia.to_tuples(False), npt.NDArray[np.object_]), np.ndarray, tuple)
474474

475475
ia_float = IntervalArray([pd.Interval(0, 1.5), pd.Interval(1, 2)])
476-
check(assert_type(ia_float.left, pd.Index), pd.Float64Index)
477-
check(assert_type(ia_float.right, pd.Index), pd.Float64Index)
478-
check(assert_type(ia_float.length, pd.Index), pd.Float64Index)
476+
check(assert_type(ia_float.left, pd.Index), pd.Index, float)
477+
check(assert_type(ia_float.right, pd.Index), pd.Index, float)
478+
check(assert_type(ia_float.length, pd.Index), pd.Index, float)
479479

480480
ia_ts = IntervalArray(
481481
[

0 commit comments

Comments
 (0)