Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 21 additions & 1 deletion stdlib/builtins.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,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
Expand Down Expand Up @@ -188,6 +199,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
Expand Down Expand Up @@ -245,6 +258,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: ...
Expand Down Expand Up @@ -960,6 +976,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.
Expand Down Expand Up @@ -1912,6 +1930,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): ...
Expand Down
4 changes: 3 additions & 1 deletion stdlib/types.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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__(
Expand Down