@@ -603,9 +603,25 @@ class str(Sequence[str]):
603603 def zfill (self : LiteralString , width : SupportsIndex , / ) -> LiteralString : ...
604604 @overload
605605 def zfill (self , width : SupportsIndex , / ) -> str : ... # type: ignore[misc]
606- @staticmethod
607- @overload
608- def maketrans (x : dict [int , _T ] | dict [str , _T ] | dict [str | int , _T ], / ) -> dict [int , _T ]: ...
606+ if sys .version_info >= (3 , 15 ):
607+ @staticmethod
608+ @overload
609+ def maketrans (
610+ x : (
611+ dict [int , _T ]
612+ | dict [str , _T ]
613+ | dict [str | int , _T ]
614+ | frozendict [int , _T ]
615+ | frozendict [str , _T ]
616+ | frozendict [str | int , _T ]
617+ ),
618+ / ,
619+ ) -> dict [int , _T ]: ...
620+ else :
621+ @staticmethod
622+ @overload
623+ def maketrans (x : dict [int , _T ] | dict [str , _T ] | dict [str | int , _T ], / ) -> dict [int , _T ]: ...
624+
609625 @staticmethod
610626 @overload
611627 def maketrans (x : str , y : str , / ) -> dict [int , int ]: ...
@@ -691,7 +707,11 @@ class bytes(Sequence[int]):
691707 def lower (self ) -> bytes : ...
692708 def lstrip (self , bytes : ReadableBuffer | None = None , / ) -> bytes : ...
693709 def partition (self , sep : ReadableBuffer , / ) -> tuple [bytes , bytes , bytes ]: ...
694- def replace (self , old : ReadableBuffer , new : ReadableBuffer , count : SupportsIndex = - 1 , / ) -> bytes : ...
710+ if sys .version_info >= (3 , 15 ):
711+ def replace (self , old : ReadableBuffer , new : ReadableBuffer , / , count : SupportsIndex = - 1 ) -> bytes : ...
712+ else :
713+ def replace (self , old : ReadableBuffer , new : ReadableBuffer , count : SupportsIndex = - 1 , / ) -> bytes : ...
714+
695715 def removeprefix (self , prefix : ReadableBuffer , / ) -> bytes : ...
696716 def removesuffix (self , suffix : ReadableBuffer , / ) -> bytes : ...
697717 def rfind (
@@ -803,7 +823,11 @@ class bytearray(MutableSequence[int]):
803823 def remove (self , value : int , / ) -> None : ...
804824 def removeprefix (self , prefix : ReadableBuffer , / ) -> bytearray : ...
805825 def removesuffix (self , suffix : ReadableBuffer , / ) -> bytearray : ...
806- def replace (self , old : ReadableBuffer , new : ReadableBuffer , count : SupportsIndex = - 1 , / ) -> bytearray : ...
826+ if sys .version_info >= (3 , 15 ):
827+ def replace (self , old : ReadableBuffer , new : ReadableBuffer , / , count : SupportsIndex = - 1 ) -> bytearray : ...
828+ else :
829+ def replace (self , old : ReadableBuffer , new : ReadableBuffer , count : SupportsIndex = - 1 , / ) -> bytearray : ...
830+
807831 def rfind (
808832 self , sub : ReadableBuffer | SupportsIndex , start : SupportsIndex | None = None , end : SupportsIndex | None = None , /
809833 ) -> int : ...
@@ -827,6 +851,9 @@ class bytearray(MutableSequence[int]):
827851 def swapcase (self ) -> bytearray : ...
828852 def title (self ) -> bytearray : ...
829853 def translate (self , table : ReadableBuffer | None , / , delete : bytes = b"" ) -> bytearray : ...
854+ if sys .version_info >= (3 , 15 ):
855+ def take_bytes (self , n : int | None = None , / ) -> bytes : ...
856+
830857 def upper (self ) -> bytearray : ...
831858 def zfill (self , width : SupportsIndex , / ) -> bytearray : ...
832859 if sys .version_info >= (3 , 14 ):
@@ -1022,6 +1049,8 @@ class slice(Generic[_StartT_co, _StopT_co, _StepT_co]):
10221049 __hash__ : ClassVar [None ] # type: ignore[assignment]
10231050
10241051 def indices (self , len : SupportsIndex , / ) -> tuple [int , int , int ]: ...
1052+ if sys .version_info >= (3 , 15 ):
1053+ def __class_getitem__ (cls , item : Any , / ) -> GenericAlias : ...
10251054
10261055@disjoint_base
10271056class tuple (Sequence [_T_co ]):
@@ -1223,14 +1252,69 @@ class dict(MutableMapping[_KT, _VT]):
12231252 def __reversed__ (self ) -> Iterator [_KT ]: ...
12241253 __hash__ : ClassVar [None ] # type: ignore[assignment]
12251254 def __class_getitem__ (cls , item : Any , / ) -> GenericAlias : ...
1226- def __or__ (self , value : dict [_T1 , _T2 ], / ) -> dict [_KT | _T1 , _VT | _T2 ]: ...
1227- def __ror__ (self , value : dict [_T1 , _T2 ], / ) -> dict [_KT | _T1 , _VT | _T2 ]: ...
1255+ if sys .version_info >= (3 , 15 ):
1256+ def __or__ (self , value : dict [_T1 , _T2 ] | frozendict [_T1 , _T2 ], / ) -> dict [_KT | _T1 , _VT | _T2 ]: ...
1257+ @overload
1258+ def __ror__ (self , value : dict [_T1 , _T2 ], / ) -> dict [_KT | _T1 , _VT | _T2 ]: ...
1259+ @overload
1260+ def __ror__ (self , value : frozendict [_T1 , _T2 ], / ) -> frozendict [_KT | _T1 , _VT | _T2 ]: ...
1261+ else :
1262+ def __or__ (self , value : dict [_T1 , _T2 ], / ) -> dict [_KT | _T1 , _VT | _T2 ]: ...
1263+ def __ror__ (self , value : dict [_T1 , _T2 ], / ) -> dict [_KT | _T1 , _VT | _T2 ]: ...
12281264 # dict.__ior__ should be kept roughly in line with MutableMapping.update()
12291265 @overload # type: ignore[misc]
12301266 def __ior__ (self , value : SupportsKeysAndGetItem [_KT , _VT ], / ) -> Self : ...
12311267 @overload
12321268 def __ior__ (self , value : Iterable [tuple [_KT , _VT ]], / ) -> Self : ...
12331269
1270+ if sys .version_info >= (3 , 15 ):
1271+ @disjoint_base
1272+ class frozendict (Mapping [_KT , _VT ]):
1273+ @overload
1274+ def __new__ (cls , / ) -> frozendict [Any , Any ]: ...
1275+ @overload
1276+ def __new__ (cls : type [frozendict [str , _VT ]], / , ** kwargs : _VT ) -> frozendict [str , _VT ]: ...
1277+ @overload
1278+ def __new__ (cls , map : SupportsKeysAndGetItem [_KT , _VT ], / ) -> frozendict [_KT , _VT ]: ...
1279+ @overload
1280+ def __new__ (
1281+ cls : type [frozendict [str , _VT ]], map : SupportsKeysAndGetItem [str , _VT ], / , ** kwargs : _VT
1282+ ) -> frozendict [str , _VT ]: ...
1283+ @overload
1284+ def __new__ (cls , iterable : Iterable [tuple [_KT , _VT ]], / ) -> frozendict [_KT , _VT ]: ...
1285+ @overload
1286+ def __new__ (
1287+ cls : type [frozendict [str , _VT ]], iterable : Iterable [tuple [str , _VT ]], / , ** kwargs : _VT
1288+ ) -> frozendict [str , _VT ]: ...
1289+ def __init__ (self ) -> None : ...
1290+ def copy (self ) -> frozendict [_KT , _VT ]: ...
1291+ @overload
1292+ @classmethod
1293+ def fromkeys (cls , iterable : Iterable [_T ], value : None = None , / ) -> frozendict [_T , Any | None ]: ...
1294+ @overload
1295+ @classmethod
1296+ def fromkeys (cls , iterable : Iterable [_T ], value : _S , / ) -> frozendict [_T , _S ]: ...
1297+ @overload # type: ignore[override]
1298+ def get (self , key : _KT , default : None = None , / ) -> _VT | None : ...
1299+ @overload
1300+ def get (self , key : _KT , default : _VT , / ) -> _VT : ...
1301+ @overload
1302+ def get (self , key : _KT , default : _T , / ) -> _VT | _T : ...
1303+ def keys (self ) -> dict_keys [_KT , _VT ]: ...
1304+ def values (self ) -> dict_values [_KT , _VT ]: ...
1305+ def items (self ) -> dict_items [_KT , _VT ]: ...
1306+ def __len__ (self ) -> int : ...
1307+ def __getitem__ (self , key : _KT , / ) -> _VT : ...
1308+ def __reversed__ (self ) -> Iterator [_KT ]: ...
1309+ def __iter__ (self ) -> Iterator [_KT ]: ...
1310+ def __hash__ (self ) -> int : ...
1311+ def __class_getitem__ (cls , item : Any , / ) -> GenericAlias : ...
1312+ def __or__ (self , value : dict [_T1 , _T2 ] | frozendict [_T1 , _T2 ], / ) -> frozendict [_KT | _T1 , _VT | _T2 ]: ...
1313+ @overload
1314+ def __ror__ (self , value : dict [_T1 , _T2 ], / ) -> dict [_KT | _T1 , _VT | _T2 ]: ...
1315+ @overload
1316+ def __ror__ (self , value : frozendict [_T1 , _T2 ], / ) -> frozendict [_KT | _T1 , _VT | _T2 ]: ...
1317+
12341318@disjoint_base
12351319class set (MutableSet [_T ]):
12361320 @overload
@@ -1362,7 +1446,13 @@ def abs(x: SupportsAbs[_T], /) -> _T: ...
13621446def all (iterable : Iterable [object ], / ) -> bool : ...
13631447def any (iterable : Iterable [object ], / ) -> bool : ...
13641448def ascii (obj : object , / ) -> str : ...
1365- def bin (number : SupportsIndex , / ) -> str : ...
1449+
1450+ if sys .version_info >= (3 , 15 ):
1451+ def bin (integer : SupportsIndex , / ) -> str : ...
1452+
1453+ else :
1454+ def bin (number : SupportsIndex , / ) -> str : ...
1455+
13661456def breakpoint (* args : Any , ** kws : Any ) -> None : ...
13671457def callable (obj : object , / ) -> TypeIs [Callable [..., object ]]: ...
13681458def chr (i : SupportsIndex , / ) -> str : ...
@@ -1438,7 +1528,15 @@ def divmod(x: _T_contra, y: SupportsRDivMod[_T_contra, _T_co], /) -> _T_co: ...
14381528
14391529# The `globals` argument to `eval` has to be `dict[str, Any]` rather than `dict[str, object]` due to invariance.
14401530# (The `globals` argument has to be a "real dict", rather than any old mapping, unlike the `locals` argument.)
1441- if sys .version_info >= (3 , 13 ):
1531+ if sys .version_info >= (3 , 15 ):
1532+ def eval (
1533+ source : str | ReadableBuffer | CodeType ,
1534+ / ,
1535+ globals : dict [str , Any ] | frozendict [str , Any ] | None = None ,
1536+ locals : Mapping [str , object ] | None = None ,
1537+ ) -> Any : ...
1538+
1539+ elif sys .version_info >= (3 , 13 ):
14421540 def eval (
14431541 source : str | ReadableBuffer | CodeType ,
14441542 / ,
@@ -1455,7 +1553,17 @@ else:
14551553 ) -> Any : ...
14561554
14571555# Comment above regarding `eval` applies to `exec` as well
1458- if sys .version_info >= (3 , 13 ):
1556+ if sys .version_info >= (3 , 15 ):
1557+ def exec (
1558+ source : str | ReadableBuffer | CodeType ,
1559+ / ,
1560+ globals : dict [str , Any ] | frozendict [str , Any ] | None = None ,
1561+ locals : Mapping [str , object ] | None = None ,
1562+ * ,
1563+ closure : tuple [CellType , ...] | None = None ,
1564+ ) -> None : ...
1565+
1566+ elif sys .version_info >= (3 , 13 ):
14591567 def exec (
14601568 source : str | ReadableBuffer | CodeType ,
14611569 / ,
@@ -1521,7 +1629,12 @@ def hash(obj: object, /) -> int: ...
15211629
15221630help : _sitebuiltins ._Helper
15231631
1524- def hex (number : SupportsIndex , / ) -> str : ...
1632+ if sys .version_info >= (3 , 15 ):
1633+ def hex (integer : SupportsIndex , / ) -> str : ...
1634+
1635+ else :
1636+ def hex (number : SupportsIndex , / ) -> str : ...
1637+
15251638def id (obj : object , / ) -> int : ...
15261639def input (prompt : object = "" , / ) -> str : ...
15271640@type_check_only
@@ -1685,7 +1798,12 @@ def min(iterable: Iterable[_T1], /, *, key: Callable[[_T1], SupportsRichComparis
16851798def next (i : SupportsNext [_T ], / ) -> _T : ...
16861799@overload
16871800def next (i : SupportsNext [_T ], default : _VT , / ) -> _T | _VT : ...
1688- def oct (number : SupportsIndex , / ) -> str : ...
1801+
1802+ if sys .version_info >= (3 , 15 ):
1803+ def oct (integer : SupportsIndex , / ) -> str : ...
1804+
1805+ else :
1806+ def oct (number : SupportsIndex , / ) -> str : ...
16891807
16901808_Opener : TypeAlias = Callable [[str , int ], int ]
16911809
@@ -1885,6 +2003,18 @@ def round(number: _SupportsRound2[_T], ndigits: SupportsIndex) -> _T: ...
18852003# See https://github.com/python/typeshed/pull/6292#discussion_r748875189
18862004# for why arg 3 of `setattr` should be annotated with `Any` and not `object`
18872005def setattr (obj : object , name : str , value : Any , / ) -> None : ...
2006+
2007+ if sys .version_info >= (3 , 15 ):
2008+ @final
2009+ class sentinel :
2010+ __name__ : str
2011+ __module__ : str
2012+ def __new__ (cls , name : str , / ) -> Self : ...
2013+ def __copy__ (self , / ) -> Self : ...
2014+ def __deepcopy__ (self , memo : Any , / ) -> Self : ...
2015+ def __or__ (self , other : Any , / ) -> types .UnionType : ...
2016+ def __ror__ (self , other : Any , / ) -> types .UnionType : ...
2017+
18882018@overload
18892019def sorted (
18902020 iterable : Iterable [SupportsRichComparisonT ], / , * , key : None = None , reverse : bool = False
@@ -1970,6 +2100,16 @@ def __import__(
19702100 fromlist : Sequence [str ] | None = (),
19712101 level : int = 0 ,
19722102) -> types .ModuleType : ...
2103+
2104+ if sys .version_info >= (3 , 15 ):
2105+ def __lazy_import__ (
2106+ name : str ,
2107+ globals : Mapping [str , object ] | None = None ,
2108+ locals : Mapping [str , object ] | None = None ,
2109+ fromlist : Sequence [str ] | None = (),
2110+ level : int = 0 ,
2111+ ) -> Any : ...
2112+
19732113def __build_class__ (func : Callable [[], CellType | Any ], name : str , / , * bases : Any , metaclass : Any = ..., ** kwds : Any ) -> Any : ...
19742114
19752115# Backwards compatibility hack for folks who relied on the ellipsis type
@@ -2048,6 +2188,9 @@ class ImportError(Exception):
20482188 if sys .version_info >= (3 , 12 ):
20492189 name_from : str | None # undocumented
20502190
2191+ if sys .version_info >= (3 , 15 ):
2192+ class ImportCycleError (ImportError ): ...
2193+
20512194class LookupError (Exception ): ...
20522195class MemoryError (Exception ): ...
20532196
0 commit comments