Skip to content
Open
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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ repos:
- "--unsafe-fixes"
files: '.*test_cases/.+\.py$'
- repo: https://github.com/psf/black-pre-commit-mirror
rev: 26.3.1
rev: 26.5.0
hooks:
- id: black
- repo: https://github.com/pycqa/flake8
Expand Down
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ requires-python = ">=3.10" # Minimum version to run tests, used by uv run
line-length = 130
target-version = ["py310"]
skip-magic-trailing-comma = true
preview = true

[tool.ruff]
line-length = 130
Expand Down
2 changes: 2 additions & 0 deletions stdlib/_asyncio.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,12 @@ class Future(Awaitable[_T]):
@property
def _exception(self) -> BaseException | None: ...
_blocking: bool

@property
def _log_traceback(self) -> bool: ...
@_log_traceback.setter
def _log_traceback(self, val: Literal[False]) -> None: ...

_asyncio_future_blocking: bool # is a part of duck-typing contract for `Future`
def __init__(self, *, loop: AbstractEventLoop | None = None) -> None: ...
def __del__(self) -> None: ...
Expand Down
3 changes: 3 additions & 0 deletions stdlib/_bisect.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ def bisect_left(
def bisect_left(
a: SupportsGetItem[int, _T], x: SupportsRichComparisonT, lo: int = 0, *, hi: int, key: Callable[[_T], SupportsRichComparisonT]
) -> int: ...

@overload
def bisect_right(
a: SupportsLenAndGetItem[SupportsRichComparisonT],
Expand Down Expand Up @@ -72,6 +73,7 @@ def bisect_right(
def bisect_right(
a: SupportsGetItem[int, _T], x: SupportsRichComparisonT, lo: int = 0, *, hi: int, key: Callable[[_T], SupportsRichComparisonT]
) -> int: ...

@overload
def insort_left(
a: MutableSequence[SupportsRichComparisonT],
Expand All @@ -85,6 +87,7 @@ def insort_left(
def insort_left(
a: MutableSequence[_T], x: _T, lo: int = 0, hi: int | None = None, *, key: Callable[[_T], SupportsRichComparisonT]
) -> None: ...

@overload
def insort_right(
a: MutableSequence[SupportsRichComparisonT],
Expand Down
2 changes: 2 additions & 0 deletions stdlib/_codecs.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ def encode(obj: ReadableBuffer, encoding: _BytesToBytesEncoding, errors: str = "
def encode(obj: str, encoding: _StrToStrEncoding, errors: str = "strict") -> str: ... # type: ignore[overload-overlap]
@overload
def encode(obj: str, encoding: str = "utf-8", errors: str = "strict") -> bytes: ...

@overload
def decode(obj: ReadableBuffer, encoding: _BytesToBytesEncoding, errors: str = "strict") -> bytes: ... # type: ignore[overload-overlap]
@overload
Expand All @@ -67,6 +68,7 @@ def decode(
def decode(obj: str, encoding: Literal["hex", "hex_codec"], errors: str = "strict") -> bytes: ...
@overload
def decode(obj: ReadableBuffer, encoding: str = "utf-8", errors: str = "strict") -> str: ...

def lookup(encoding: str, /) -> codecs.CodecInfo: ...
def charmap_build(map: str, /) -> _CharMap: ...
def ascii_decode(data: ReadableBuffer, errors: str | None = None, /) -> tuple[str, int]: ...
Expand Down
5 changes: 5 additions & 0 deletions stdlib/_contextvars.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,18 @@ class ContextVar(Generic[_T]):
def __new__(cls, name: str) -> Self: ...
@overload
def __new__(cls, name: str, *, default: _T) -> Self: ...

def __hash__(self) -> int: ...
@property
def name(self) -> str: ...

@overload
def get(self) -> _T: ...
@overload
def get(self, default: _T, /) -> _T: ...
@overload
def get(self, default: _D, /) -> _D | _T: ...

def set(self, value: _T, /) -> Token[_T]: ...
def reset(self, token: Token[_T], /) -> None: ...
def __class_getitem__(cls, item: Any, /) -> GenericAlias: ...
Expand All @@ -49,12 +52,14 @@ def copy_context() -> Context: ...
@final
class Context(Mapping[ContextVar[Any], Any]):
def __init__(self) -> None: ...

@overload
def get(self, key: ContextVar[_T], default: None = None, /) -> _T | None: ...
@overload
def get(self, key: ContextVar[_T], default: _T, /) -> _T: ...
@overload
def get(self, key: ContextVar[_T], default: _D, /) -> _T | _D: ...

def run(self, callable: Callable[_P, _T], *args: _P.args, **kwargs: _P.kwargs) -> _T: ...
def copy(self) -> Context: ...
__hash__: ClassVar[None] # type: ignore[assignment]
Expand Down
15 changes: 15 additions & 0 deletions stdlib/_ctypes.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -127,21 +127,25 @@ class _PyCPointerType(_CTypeBaseType):
class _Pointer(_PointerLike, _CData, Generic[_CT], metaclass=_PyCPointerType):
_type_: type[_CT]
contents: _CT

@overload
def __init__(self) -> None: ...
@overload
def __init__(self, arg: _CT) -> None: ...

@overload
def __getitem__(self, key: int, /) -> Any: ...
@overload
def __getitem__(self, key: slice[SupportsIndex | None], /) -> list[Any]: ...

def __setitem__(self, key: int, value: Any, /) -> None: ...

if sys.version_info < (3, 14):
@overload
def POINTER(type: None, /) -> type[c_void_p]: ...
@overload
def POINTER(type: type[_CT], /) -> type[_Pointer[_CT]]: ...

def pointer(obj: _CT, /) -> _Pointer[_CT]: ...

# This class is not exposed. It calls itself _ctypes.CArgObject.
Expand Down Expand Up @@ -177,6 +181,7 @@ class CFuncPtr(_PointerLike, _CData, metaclass=_PyCFuncPtrType):
errcheck: _ECT
# Abstract attribute that must be defined on subclasses
_flags_: ClassVar[int]

@overload
def __new__(cls) -> Self: ...
@overload
Expand Down Expand Up @@ -209,10 +214,12 @@ if sys.version_info >= (3, 14):
bit_offset: int
bit_size: int
is_anonymous: bool

@overload
def __get__(self, instance: None, owner: builtins.type[Any] | None = None, /) -> Self: ...
@overload
def __get__(self, instance: Any, owner: builtins.type[Any] | None = None, /) -> _GetT: ...

def __set__(self, instance: Any, value: _SetT, /) -> None: ...

_CField = CField
Expand All @@ -223,10 +230,12 @@ else:
class _CField(Generic[_CT, _GetT, _SetT]):
offset: int
size: int

@overload
def __get__(self, instance: None, owner: type[Any] | None = None, /) -> Self: ...
@overload
def __get__(self, instance: Any, owner: type[Any] | None = None, /) -> _GetT: ...

def __set__(self, instance: Any, value: _SetT, /) -> None: ...

# This class is not exposed. It calls itself _ctypes.UnionType.
Expand Down Expand Up @@ -308,16 +317,19 @@ class Array(_CData, Generic[_CT], metaclass=_PyCArrayType):
def _length_(self) -> int: ...
@_length_.setter
def _length_(self, value: int) -> None: ...

@property
@abstractmethod
def _type_(self) -> type[_CT]: ...
@_type_.setter
def _type_(self, value: type[_CT]) -> None: ...

# Note: only available if _CT == c_char
@property
def raw(self) -> bytes: ...
@raw.setter
def raw(self, value: ReadableBuffer) -> None: ...

value: Any # Note: bytes if _CT == c_char, str if _CT == c_wchar, unavailable otherwise
# TODO: These methods cannot be annotated correctly at the moment.
# All of these "Any"s stand for the array's element type, but it's not possible to use _CT
Expand All @@ -332,14 +344,17 @@ class Array(_CData, Generic[_CT], metaclass=_PyCArrayType):
# This special behavior is not easy to model in a stub, so for now all places where
# the array element type would belong are annotated with Any instead.
def __init__(self, *args: Any) -> None: ...

@overload
def __getitem__(self, key: int, /) -> Any: ...
@overload
def __getitem__(self, key: slice[SupportsIndex | None], /) -> list[Any]: ...

@overload
def __setitem__(self, key: int, value: Any, /) -> None: ...
@overload
def __setitem__(self, key: slice[SupportsIndex | None], value: Iterable[Any], /) -> None: ...

def __iter__(self) -> Iterator[Any]: ...
# Can't inherit from Sized because the metaclass conflict between
# Sized and _CData prevents using _CDataMeta.
Expand Down
36 changes: 36 additions & 0 deletions stdlib/_curses.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -375,18 +375,22 @@ class error(Exception): ...
@final
class window: # undocumented
encoding: str

@overload
def addch(self, ch: _ChType, attr: int = ...) -> None: ...
@overload
def addch(self, y: int, x: int, ch: _ChType, attr: int = ...) -> None: ...

@overload
def addnstr(self, str: str, n: int, attr: int = ...) -> None: ...
@overload
def addnstr(self, y: int, x: int, str: str, n: int, attr: int = ...) -> None: ...

@overload
def addstr(self, str: str, attr: int = ...) -> None: ...
@overload
def addstr(self, y: int, x: int, str: str, attr: int = ...) -> None: ...

def attroff(self, attr: int, /) -> None: ...
def attron(self, attr: int, /) -> None: ...
def attrset(self, attr: int, /) -> None: ...
Expand All @@ -403,10 +407,12 @@ class window: # undocumented
bl: _ChType = ...,
br: _ChType = ...,
) -> None: ...

@overload
def box(self) -> None: ...
@overload
def box(self, vertch: _ChType = 0, horch: _ChType = 0) -> None: ...

@overload
def chgat(self, attr: int) -> None: ...
@overload
Expand All @@ -415,39 +421,49 @@ class window: # undocumented
def chgat(self, y: int, x: int, attr: int) -> None: ...
@overload
def chgat(self, y: int, x: int, num: int, attr: int) -> None: ...

def clear(self) -> None: ...
def clearok(self, yes: int) -> None: ...
def clrtobot(self) -> None: ...
def clrtoeol(self) -> None: ...
def cursyncup(self) -> None: ...

@overload
def delch(self) -> None: ...
@overload
def delch(self, y: int, x: int) -> None: ...

def deleteln(self) -> None: ...

@overload
def derwin(self, begin_y: int, begin_x: int) -> window: ...
@overload
def derwin(self, nlines: int, ncols: int, begin_y: int, begin_x: int) -> window: ...

def echochar(self, ch: _ChType, attr: int = 0, /) -> None: ...
def enclose(self, y: int, x: int, /) -> bool: ...
def erase(self) -> None: ...
def getbegyx(self) -> tuple[int, int]: ...
def getbkgd(self) -> tuple[int, int]: ...

@overload
def getch(self) -> int: ...
@overload
def getch(self, y: int, x: int) -> int: ...

@overload
def get_wch(self) -> int | str: ...
@overload
def get_wch(self, y: int, x: int) -> int | str: ...

@overload
def getkey(self) -> str: ...
@overload
def getkey(self, y: int, x: int) -> str: ...

def getmaxyx(self) -> tuple[int, int]: ...
def getparyx(self) -> tuple[int, int]: ...

@overload
def getstr(self) -> bytes: ...
@overload
Expand All @@ -456,36 +472,46 @@ class window: # undocumented
def getstr(self, y: int, x: int) -> bytes: ...
@overload
def getstr(self, y: int, x: int, n: int) -> bytes: ...

def getyx(self) -> tuple[int, int]: ...

@overload
def hline(self, ch: _ChType, n: int) -> None: ...
@overload
def hline(self, y: int, x: int, ch: _ChType, n: int) -> None: ...

def idcok(self, flag: bool) -> None: ...
def idlok(self, yes: bool) -> None: ...
def immedok(self, flag: bool) -> None: ...

@overload
def inch(self) -> int: ...
@overload
def inch(self, y: int, x: int) -> int: ...

@overload
def insch(self, ch: _ChType, attr: int = ...) -> None: ...
@overload
def insch(self, y: int, x: int, ch: _ChType, attr: int = ...) -> None: ...

def insdelln(self, nlines: int) -> None: ...
def insertln(self) -> None: ...

@overload
def insnstr(self, str: str, n: int, attr: int = ...) -> None: ...
@overload
def insnstr(self, y: int, x: int, str: str, n: int, attr: int = ...) -> None: ...

@overload
def insstr(self, str: str, attr: int = ...) -> None: ...
@overload
def insstr(self, y: int, x: int, str: str, attr: int = ...) -> None: ...

@overload
def instr(self, n: int = 2047) -> bytes: ...
@overload
def instr(self, y: int, x: int, n: int = 2047) -> bytes: ...

def is_linetouched(self, line: int, /) -> bool: ...
def is_wintouched(self) -> bool: ...
def keypad(self, yes: bool, /) -> None: ...
Expand All @@ -495,50 +521,60 @@ class window: # undocumented
def mvwin(self, new_y: int, new_x: int) -> None: ...
def nodelay(self, yes: bool) -> None: ...
def notimeout(self, yes: bool) -> None: ...

@overload
def noutrefresh(self) -> None: ...
@overload
def noutrefresh(self, pminrow: int, pmincol: int, sminrow: int, smincol: int, smaxrow: int, smaxcol: int) -> None: ...

@overload
def overlay(self, destwin: window) -> None: ...
@overload
def overlay(
self, destwin: window, sminrow: int, smincol: int, dminrow: int, dmincol: int, dmaxrow: int, dmaxcol: int
) -> None: ...

@overload
def overwrite(self, destwin: window) -> None: ...
@overload
def overwrite(
self, destwin: window, sminrow: int, smincol: int, dminrow: int, dmincol: int, dmaxrow: int, dmaxcol: int
) -> None: ...

def putwin(self, file: SupportsWrite[bytes], /) -> None: ...
def redrawln(self, beg: int, num: int, /) -> None: ...
def redrawwin(self) -> None: ...

@overload
def refresh(self) -> None: ...
@overload
def refresh(self, pminrow: int, pmincol: int, sminrow: int, smincol: int, smaxrow: int, smaxcol: int) -> None: ...

def resize(self, nlines: int, ncols: int) -> None: ...
def scroll(self, lines: int = 1) -> None: ...
def scrollok(self, flag: bool) -> None: ...
def setscrreg(self, top: int, bottom: int, /) -> None: ...
def standend(self) -> None: ...
def standout(self) -> None: ...

@overload
def subpad(self, begin_y: int, begin_x: int) -> window: ...
@overload
def subpad(self, nlines: int, ncols: int, begin_y: int, begin_x: int) -> window: ...

@overload
def subwin(self, begin_y: int, begin_x: int) -> window: ...
@overload
def subwin(self, nlines: int, ncols: int, begin_y: int, begin_x: int) -> window: ...

def syncdown(self) -> None: ...
def syncok(self, flag: bool) -> None: ...
def syncup(self) -> None: ...
def timeout(self, delay: int) -> None: ...
def touchline(self, start: int, count: int, changed: bool = True) -> None: ...
def touchwin(self) -> None: ...
def untouchwin(self) -> None: ...

@overload
def vline(self, ch: _ChType, n: int) -> None: ...
@overload
Expand Down
Loading
Loading