1
- from collections . abc import Sequence
1
+ from typing import Any
2
2
3
3
import numpy as np
4
+ from typing_extensions import Self
4
5
5
6
from pandas ._typing import (
6
7
ArrayLike ,
7
8
Scalar ,
9
+ TakeIndexer ,
8
10
npt ,
9
11
)
10
12
11
13
from pandas .core .dtypes .dtypes import ExtensionDtype as ExtensionDtype
12
- from pandas .core .dtypes .generic import ABCExtensionArray
13
14
14
15
class ExtensionArray :
15
- def __getitem__ (self , item ) -> None : ...
16
+ def __getitem__ (self , item ) -> Any : ...
16
17
def __setitem__ (self , key : int | slice | np .ndarray , value ) -> None : ...
17
18
def __len__ (self ) -> int : ...
18
19
def __iter__ (self ): ...
20
+ def __contains__ (self , item : object ) -> bool | np .bool_ : ...
19
21
def to_numpy (
20
22
self ,
21
23
dtype : npt .DTypeLike | None = ...,
@@ -37,22 +39,29 @@ class ExtensionArray:
37
39
) -> np .ndarray : ...
38
40
def fillna (self , value = ..., method = ..., limit = ...): ...
39
41
def dropna (self ): ...
40
- def shift (
41
- self , periods : int = ..., fill_value : object = ...
42
- ) -> ABCExtensionArray : ...
42
+ def shift (self , periods : int = ..., fill_value : object = ...) -> Self : ...
43
43
def unique (self ): ...
44
44
def searchsorted (self , value , side : str = ..., sorter = ...): ...
45
45
# TODO: remove keyword-only when pandas removed na_sentinel
46
- def factorize (
47
- self , * , use_na_sentinel : bool = ...
48
- ) -> tuple [np .ndarray , ABCExtensionArray ]: ...
46
+ def factorize (self , * , use_na_sentinel : bool = ...) -> tuple [np .ndarray , Self ]: ...
49
47
def repeat (self , repeats , axis = ...): ...
50
48
def take (
51
- self , indices : Sequence [int ], * , allow_fill : bool = ..., fill_value = ...
52
- ) -> ABCExtensionArray : ...
53
- def copy (self ) -> ABCExtensionArray : ...
54
- def view (self , dtype = ...) -> ABCExtensionArray | np .ndarray : ...
55
- def ravel (self , order = ...) -> ABCExtensionArray : ...
49
+ self ,
50
+ indexer : TakeIndexer ,
51
+ * ,
52
+ allow_fill : bool = ...,
53
+ fill_value = ...,
54
+ ) -> Self : ...
55
+ def copy (self ) -> Self : ...
56
+ def view (self , dtype = ...) -> Self | np .ndarray : ...
57
+ def ravel (self , order = ...) -> Self : ...
58
+
59
+ class ExtensionOpsMixin :
60
+ @classmethod
61
+ def _add_arithmetic_ops (cls ) -> None : ...
62
+ @classmethod
63
+ def _add_comparison_ops (cls ) -> None : ...
64
+ @classmethod
65
+ def _add_logical_ops (cls ) -> None : ...
56
66
57
- class ExtensionOpsMixin : ...
58
67
class ExtensionScalarOpsMixin (ExtensionOpsMixin ): ...
0 commit comments