File tree Expand file tree Collapse file tree 3 files changed +6
-13
lines changed
Expand file tree Collapse file tree 3 files changed +6
-13
lines changed Original file line number Diff line number Diff line change 1212 Hashable ,
1313 Iterator ,
1414 Literal ,
15- TypeVar ,
1615 cast ,
1716 final ,
1817 overload ,
2726 DtypeObj ,
2827 IndexLabel ,
2928 NDFrameT ,
29+ Self ,
3030 Shape ,
3131 npt ,
3232)
9292 "duplicated" : "IndexOpsMixin" ,
9393}
9494
95- _T = TypeVar ("_T" , bound = "IndexOpsMixin" )
96-
9795
9896class PandasObject (DirNamesMixin ):
9997 """
@@ -286,7 +284,7 @@ def _values(self) -> ExtensionArray | np.ndarray:
286284 raise AbstractMethodError (self )
287285
288286 @final
289- def transpose (self : _T , * args , ** kwargs ) -> _T :
287+ def transpose (self , * args , ** kwargs ) -> Self :
290288 """
291289 Return the transpose, which is by definition self.
292290
Original file line number Diff line number Diff line change 1717from pandas ._libs .hashtable import object_hash
1818from pandas ._typing import (
1919 DtypeObj ,
20+ Self ,
2021 Shape ,
2122 npt ,
2223 type_t ,
@@ -227,9 +228,7 @@ def empty(self, shape: Shape) -> type_t[ExtensionArray]:
227228 return cls ._empty (shape , dtype = self )
228229
229230 @classmethod
230- def construct_from_string (
231- cls : type_t [ExtensionDtypeT ], string : str
232- ) -> ExtensionDtypeT :
231+ def construct_from_string (cls , string : str ) -> Self :
233232 r"""
234233 Construct this type from a string.
235234
Original file line number Diff line number Diff line change 66 TYPE_CHECKING ,
77 Hashable ,
88 Sequence ,
9- TypeVar ,
109 cast ,
1110 final ,
1211)
2019from pandas ._typing import (
2120 Axis ,
2221 AxisInt ,
22+ Self ,
2323)
2424from pandas .compat import PYPY
2525from pandas .errors import (
8585 Series ,
8686 )
8787
88- _LocationIndexerT = TypeVar ("_LocationIndexerT" , bound = "_LocationIndexer" )
89-
9088# "null slice"
9189_NS = slice (None , None )
9290_one_ellipsis_message = "indexer may only contain one '...' entry"
@@ -669,9 +667,7 @@ class _LocationIndexer(NDFrameIndexerBase):
669667 _takeable : bool
670668
671669 @final
672- def __call__ (
673- self : _LocationIndexerT , axis : Axis | None = None
674- ) -> _LocationIndexerT :
670+ def __call__ (self , axis : Axis | None = None ) -> Self :
675671 # we need to return a copy of ourselves
676672 new_self = type (self )(self .name , self .obj )
677673
You can’t perform that action at this time.
0 commit comments