mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-16 00:37:10 +08:00
builtins: updates for py312 (#10211)
Co-authored-by: AlexWaygood <alex.waygood@gmail.com>
This commit is contained in:
@@ -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): ...
|
||||
|
||||
@@ -17,7 +17,7 @@ from importlib.machinery import ModuleSpec
|
||||
|
||||
# pytype crashes if types.MappingProxyType inherits from collections.abc.Mapping instead of typing.Mapping
|
||||
from typing import Any, ClassVar, Generic, Mapping, Protocol, TypeVar, overload # noqa: Y022
|
||||
from typing_extensions import Literal, ParamSpec, final
|
||||
from typing_extensions import Literal, ParamSpec, TypeVarTuple, final
|
||||
|
||||
__all__ = [
|
||||
"FunctionType",
|
||||
@@ -94,6 +94,8 @@ class FunctionType:
|
||||
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
|
||||
def __init__(
|
||||
|
||||
Reference in New Issue
Block a user