File tree 3 files changed +6
-13
lines changed
3 files changed +6
-13
lines changed Original file line number Diff line number Diff line change 12
12
Hashable ,
13
13
Iterator ,
14
14
Literal ,
15
- TypeVar ,
16
15
cast ,
17
16
final ,
18
17
overload ,
27
26
DtypeObj ,
28
27
IndexLabel ,
29
28
NDFrameT ,
29
+ Self ,
30
30
Shape ,
31
31
npt ,
32
32
)
92
92
"duplicated" : "IndexOpsMixin" ,
93
93
}
94
94
95
- _T = TypeVar ("_T" , bound = "IndexOpsMixin" )
96
-
97
95
98
96
class PandasObject (DirNamesMixin ):
99
97
"""
@@ -286,7 +284,7 @@ def _values(self) -> ExtensionArray | np.ndarray:
286
284
raise AbstractMethodError (self )
287
285
288
286
@final
289
- def transpose (self : _T , * args , ** kwargs ) -> _T :
287
+ def transpose (self , * args , ** kwargs ) -> Self :
290
288
"""
291
289
Return the transpose, which is by definition self.
292
290
Original file line number Diff line number Diff line change 17
17
from pandas ._libs .hashtable import object_hash
18
18
from pandas ._typing import (
19
19
DtypeObj ,
20
+ Self ,
20
21
Shape ,
21
22
npt ,
22
23
type_t ,
@@ -227,9 +228,7 @@ def empty(self, shape: Shape) -> type_t[ExtensionArray]:
227
228
return cls ._empty (shape , dtype = self )
228
229
229
230
@classmethod
230
- def construct_from_string (
231
- cls : type_t [ExtensionDtypeT ], string : str
232
- ) -> ExtensionDtypeT :
231
+ def construct_from_string (cls , string : str ) -> Self :
233
232
r"""
234
233
Construct this type from a string.
235
234
Original file line number Diff line number Diff line change 6
6
TYPE_CHECKING ,
7
7
Hashable ,
8
8
Sequence ,
9
- TypeVar ,
10
9
cast ,
11
10
final ,
12
11
)
20
19
from pandas ._typing import (
21
20
Axis ,
22
21
AxisInt ,
22
+ Self ,
23
23
)
24
24
from pandas .compat import PYPY
25
25
from pandas .errors import (
85
85
Series ,
86
86
)
87
87
88
- _LocationIndexerT = TypeVar ("_LocationIndexerT" , bound = "_LocationIndexer" )
89
-
90
88
# "null slice"
91
89
_NS = slice (None , None )
92
90
_one_ellipsis_message = "indexer may only contain one '...' entry"
@@ -669,9 +667,7 @@ class _LocationIndexer(NDFrameIndexerBase):
669
667
_takeable : bool
670
668
671
669
@final
672
- def __call__ (
673
- self : _LocationIndexerT , axis : Axis | None = None
674
- ) -> _LocationIndexerT :
670
+ def __call__ (self , axis : Axis | None = None ) -> Self :
675
671
# we need to return a copy of ourselves
676
672
new_self = type (self )(self .name , self .obj )
677
673
You can’t perform that action at this time.
0 commit comments