builtins: updates for py312 (#10211)

Co-authored-by: AlexWaygood <alex.waygood@gmail.com>
This commit is contained in:
Shantanu
2023-06-03 17:05:40 -07:00
committed by GitHub
parent d8ef303e00
commit be85cc7121
2 changed files with 24 additions and 2 deletions

View File

@@ -53,7 +53,18 @@ from typing import ( # noqa: Y022
overload,
type_check_only,
)
from typing_extensions import Concatenate, Literal, LiteralString, ParamSpec, Self, SupportsIndex, TypeAlias, TypeGuard, final
from typing_extensions import (
Concatenate,
Literal,
LiteralString,
ParamSpec,
Self,
SupportsIndex,
TypeAlias,
TypeGuard,
TypeVarTuple,
final,
)
if sys.version_info >= (3, 9):
from types import GenericAlias
@@ -187,6 +198,8 @@ class type:
if sys.version_info >= (3, 10):
def __or__(self, __value: Any) -> types.UnionType: ...
def __ror__(self, __value: Any) -> types.UnionType: ...
if sys.version_info >= (3, 12):
__type_params__: tuple[TypeVar | ParamSpec | TypeVarTuple, ...]
class super:
@overload
@@ -244,6 +257,9 @@ class int:
signed: bool = False,
) -> Self: ...
if sys.version_info >= (3, 12):
def is_integer(self) -> Literal[True]: ...
def __add__(self, __value: int) -> int: ...
def __sub__(self, __value: int) -> int: ...
def __mul__(self, __value: int) -> int: ...
@@ -966,6 +982,8 @@ class function:
if sys.version_info >= (3, 10):
@property
def __builtins__(self) -> dict[str, Any]: ...
if sys.version_info >= (3, 12):
__type_params__: tuple[TypeVar | ParamSpec | TypeVarTuple, ...]
__module__: str
# mypy uses `builtins.function.__get__` to represent methods, properties, and getset_descriptors so we type the return as Any.
@@ -1918,6 +1936,8 @@ class ImportError(Exception):
name: str | None
path: str | None
msg: str # undocumented
if sys.version_info >= (3, 12):
name_from: str | None # undocumented
class LookupError(Exception): ...
class MemoryError(Exception): ...