[ty] Sync vendored typeshed stubs (#19461)

Co-authored-by: typeshedbot <>
Co-authored-by: Alex Waygood <alex.waygood@gmail.com>
This commit is contained in:
github-actions[bot] 2025-07-21 14:01:42 +01:00 committed by GitHub
parent c2380fa0e2
commit 3785e13231
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
597 changed files with 1393 additions and 2106 deletions

View file

@ -1618,6 +1618,8 @@ Answer.<CURSOR>
__text_signature__ :: str | None
__type_params__ :: tuple[TypeVar | ParamSpec | TypeVarTuple, ...]
__weakrefoffset__ :: int
_add_alias_ :: def _add_alias_(self, name: str) -> None
_add_value_alias_ :: def _add_value_alias_(self, value: Any) -> None
_generate_next_value_ :: def _generate_next_value_(name: str, start: int, count: int, last_values: list[Any]) -> Any
_ignore_ :: str | list[str]
_member_map_ :: dict[str, Enum]

View file

@ -198,14 +198,14 @@ mod tests {
assert_snapshot!(test.goto_type_definition(), @r#"
info[goto-type-definition]: Type definition
--> stdlib/builtins.pyi:892:7
--> stdlib/builtins.pyi:890:7
|
890 | def __getitem__(self, key: int, /) -> str | int | None: ...
891 |
892 | class str(Sequence[str]):
888 | def __getitem__(self, key: int, /) -> str | int | None: ...
889 |
890 | class str(Sequence[str]):
| ^^^
893 | """str(object='') -> str
894 | str(bytes_or_buffer[, encoding[, errors]]) -> str
891 | """str(object='') -> str
892 | str(bytes_or_buffer[, encoding[, errors]]) -> str
|
info: Source
--> main.py:4:13
@ -227,14 +227,14 @@ mod tests {
assert_snapshot!(test.goto_type_definition(), @r#"
info[goto-type-definition]: Type definition
--> stdlib/builtins.pyi:892:7
--> stdlib/builtins.pyi:890:7
|
890 | def __getitem__(self, key: int, /) -> str | int | None: ...
891 |
892 | class str(Sequence[str]):
888 | def __getitem__(self, key: int, /) -> str | int | None: ...
889 |
890 | class str(Sequence[str]):
| ^^^
893 | """str(object='') -> str
894 | str(bytes_or_buffer[, encoding[, errors]]) -> str
891 | """str(object='') -> str
892 | str(bytes_or_buffer[, encoding[, errors]]) -> str
|
info: Source
--> main.py:2:22
@ -343,14 +343,14 @@ mod tests {
assert_snapshot!(test.goto_type_definition(), @r#"
info[goto-type-definition]: Type definition
--> stdlib/builtins.pyi:892:7
--> stdlib/builtins.pyi:890:7
|
890 | def __getitem__(self, key: int, /) -> str | int | None: ...
891 |
892 | class str(Sequence[str]):
888 | def __getitem__(self, key: int, /) -> str | int | None: ...
889 |
890 | class str(Sequence[str]):
| ^^^
893 | """str(object='') -> str
894 | str(bytes_or_buffer[, encoding[, errors]]) -> str
891 | """str(object='') -> str
892 | str(bytes_or_buffer[, encoding[, errors]]) -> str
|
info: Source
--> main.py:4:18
@ -378,14 +378,14 @@ mod tests {
// is an int. Navigating to `str` would match pyright's behavior.
assert_snapshot!(test.goto_type_definition(), @r#"
info[goto-type-definition]: Type definition
--> stdlib/builtins.pyi:338:7
--> stdlib/builtins.pyi:337:7
|
336 | _LiteralInteger = _PositiveInteger | _NegativeInteger | Literal[0] # noqa: Y026 # TODO: Use TypeAlias once mypy bugs are fixed
337 |
338 | class int:
335 | _LiteralInteger = _PositiveInteger | _NegativeInteger | Literal[0] # noqa: Y026 # TODO: Use TypeAlias once mypy bugs are fixed
336 |
337 | class int:
| ^^^
339 | """int([x]) -> integer
340 | int(x, base=10) -> integer
338 | """int([x]) -> integer
339 | int(x, base=10) -> integer
|
info: Source
--> main.py:4:18
@ -412,14 +412,14 @@ f(**kwargs<CURSOR>)
assert_snapshot!(test.goto_type_definition(), @r#"
info[goto-type-definition]: Type definition
--> stdlib/builtins.pyi:2892:7
--> stdlib/builtins.pyi:2888:7
|
2890 | """See PEP 585"""
2891 |
2892 | class dict(MutableMapping[_KT, _VT]):
2886 | """See PEP 585"""
2887 |
2888 | class dict(MutableMapping[_KT, _VT]):
| ^^^^
2893 | """dict() -> new empty dictionary
2894 | dict(mapping) -> new dictionary initialized from a mapping object's
2889 | """dict() -> new empty dictionary
2890 | dict(mapping) -> new dictionary initialized from a mapping object's
|
info: Source
--> main.py:6:5
@ -443,14 +443,14 @@ f(**kwargs<CURSOR>)
assert_snapshot!(test.goto_type_definition(), @r#"
info[goto-type-definition]: Type definition
--> stdlib/builtins.pyi:892:7
--> stdlib/builtins.pyi:890:7
|
890 | def __getitem__(self, key: int, /) -> str | int | None: ...
891 |
892 | class str(Sequence[str]):
888 | def __getitem__(self, key: int, /) -> str | int | None: ...
889 |
890 | class str(Sequence[str]):
| ^^^
893 | """str(object='') -> str
894 | str(bytes_or_buffer[, encoding[, errors]]) -> str
891 | """str(object='') -> str
892 | str(bytes_or_buffer[, encoding[, errors]]) -> str
|
info: Source
--> main.py:3:17
@ -536,14 +536,14 @@ f(**kwargs<CURSOR>)
assert_snapshot!(test.goto_type_definition(), @r#"
info[goto-type-definition]: Type definition
--> stdlib/builtins.pyi:892:7
--> stdlib/builtins.pyi:890:7
|
890 | def __getitem__(self, key: int, /) -> str | int | None: ...
891 |
892 | class str(Sequence[str]):
888 | def __getitem__(self, key: int, /) -> str | int | None: ...
889 |
890 | class str(Sequence[str]):
| ^^^
893 | """str(object='') -> str
894 | str(bytes_or_buffer[, encoding[, errors]]) -> str
891 | """str(object='') -> str
892 | str(bytes_or_buffer[, encoding[, errors]]) -> str
|
info: Source
--> main.py:4:27
@ -567,13 +567,13 @@ f(**kwargs<CURSOR>)
assert_snapshot!(test.goto_type_definition(), @r#"
info[goto-type-definition]: Type definition
--> stdlib/types.pyi:922:11
--> stdlib/types.pyi:921:11
|
920 | if sys.version_info >= (3, 10):
921 | @final
922 | class NoneType:
919 | if sys.version_info >= (3, 10):
920 | @final
921 | class NoneType:
| ^^^^^^^^
923 | """The type of the None singleton."""
922 | """The type of the None singleton."""
|
info: Source
--> main.py:3:17
@ -584,14 +584,14 @@ f(**kwargs<CURSOR>)
|
info[goto-type-definition]: Type definition
--> stdlib/builtins.pyi:892:7
--> stdlib/builtins.pyi:890:7
|
890 | def __getitem__(self, key: int, /) -> str | int | None: ...
891 |
892 | class str(Sequence[str]):
888 | def __getitem__(self, key: int, /) -> str | int | None: ...
889 |
890 | class str(Sequence[str]):
| ^^^
893 | """str(object='') -> str
894 | str(bytes_or_buffer[, encoding[, errors]]) -> str
891 | """str(object='') -> str
892 | str(bytes_or_buffer[, encoding[, errors]]) -> str
|
info: Source
--> main.py:3:17

View file

@ -29,16 +29,16 @@ error[invalid-argument-type]: Argument to function `loads` is incorrect
| ^ Expected `str | bytes | bytearray`, found `Literal[5]`
|
info: Function defined here
--> stdlib/json/__init__.pyi:219:5
--> stdlib/json/__init__.pyi:218:5
|
217 | """
218 |
219 | def loads(
216 | """
217 |
218 | def loads(
| ^^^^^
220 | s: str | bytes | bytearray,
219 | s: str | bytes | bytearray,
| -------------------------- Parameter declared here
221 | *,
222 | cls: type[JSONDecoder] | None = None,
220 | *,
221 | cls: type[JSONDecoder] | None = None,
|
info: rule `invalid-argument-type` is enabled by default

View file

@ -1 +1 @@
84e41f2853d7af3d651d620f093031cba849bd1d
08225953c98cfd375d80bc88865e5aae77d2c07f

View file

@ -1,5 +1,4 @@
"""
Record of phased-in incompatible language changes.
"""Record of phased-in incompatible language changes.
Each line is of the form:

View file

@ -1,6 +1,4 @@
"""
Accelerator module for asyncio
"""
"""Accelerator module for asyncio"""
import sys
from asyncio.events import AbstractEventLoop

View file

@ -1,5 +1,4 @@
"""
Bisection algorithms.
"""Bisection algorithms.
This module provides support for maintaining a list in sorted order without
having to sort the list after each insertion. For long lists of items with

View file

@ -1,6 +1,4 @@
"""
_blake2b provides BLAKE2b for hashlib
"""
"""_blake2b provides BLAKE2b for hashlib"""
from _typeshed import ReadableBuffer
from typing import ClassVar, final

View file

@ -1 +1,7 @@
"""A minimal subset of the locale module used at interpreter startup
(imported by the _io module), in order to reduce startup time.
Don't import directly from third-party code; use the `locale` module instead!
"""
def getpreferredencoding(do_setlocale: bool = True) -> str: ...

View file

@ -1,5 +1,4 @@
"""
Abstract Base Classes (ABCs) for collections, according to PEP 3119.
"""Abstract Base Classes (ABCs) for collections, according to PEP 3119.
Unit tests are in test_collections.
"""

View file

@ -1,6 +1,4 @@
"""
Internal classes used by the gzip, lzma and bz2 modules
"""
"""Internal classes used by the gzip, lzma and bz2 modules"""
# _compression is replaced by compression._common._streams on Python 3.14+ (PEP-784)

View file

@ -1,6 +1,4 @@
"""
Context Variables
"""
"""Context Variables"""
import sys
from collections.abc import Callable, Iterator, Mapping

View file

@ -1,6 +1,4 @@
"""
CSV parsing and writing.
"""
"""CSV parsing and writing."""
import csv
import sys

View file

@ -1,6 +1,4 @@
"""
Create and manipulate C compatible data types in Python.
"""
"""Create and manipulate C compatible data types in Python."""
import _typeshed
import sys

View file

@ -1,6 +1,4 @@
"""
C decimal arithmetic module
"""
"""C decimal arithmetic module"""
import sys
from decimal import (

View file

@ -1,10 +1,10 @@
"""
Core implementation of import.
"""Core implementation of import.
This module is NOT meant to be directly imported! It has been designed such
that it can be bootstrapped into Python as the implementation of import. As
such it requires the injection of specific modules and attributes in order to
work. One should use importlib as the public-facing version of this module.
"""
import importlib.abc
@ -114,7 +114,13 @@ class BuiltinImporter(importlib.abc.MetaPathFinder, importlib.abc.InspectLoader)
# MetaPathFinder
if sys.version_info < (3, 12):
@classmethod
def find_module(cls, fullname: str, path: Sequence[str] | None = None) -> importlib.abc.Loader | None: ...
def find_module(cls, fullname: str, path: Sequence[str] | None = None) -> importlib.abc.Loader | None:
"""Find the built-in module.
If 'path' is ever specified then the search is considered a failure.
This method is deprecated. Use find_spec() instead.
"""
@classmethod
def find_spec(
@ -142,7 +148,11 @@ class BuiltinImporter(importlib.abc.MetaPathFinder, importlib.abc.InspectLoader)
# Loader
if sys.version_info < (3, 12):
@staticmethod
def module_repr(module: types.ModuleType) -> str: ...
def module_repr(module: types.ModuleType) -> str:
"""Return repr for the module.
The method is deprecated. The import machinery does the job itself.
"""
if sys.version_info >= (3, 10):
@staticmethod
def create_module(spec: ModuleSpec) -> types.ModuleType | None:
@ -170,7 +180,11 @@ class FrozenImporter(importlib.abc.MetaPathFinder, importlib.abc.InspectLoader):
# MetaPathFinder
if sys.version_info < (3, 12):
@classmethod
def find_module(cls, fullname: str, path: Sequence[str] | None = None) -> importlib.abc.Loader | None: ...
def find_module(cls, fullname: str, path: Sequence[str] | None = None) -> importlib.abc.Loader | None:
"""Find a frozen module.
This method is deprecated. Use find_spec() instead.
"""
@classmethod
def find_spec(
@ -198,7 +212,11 @@ class FrozenImporter(importlib.abc.MetaPathFinder, importlib.abc.InspectLoader):
# Loader
if sys.version_info < (3, 12):
@staticmethod
def module_repr(m: types.ModuleType) -> str: ...
def module_repr(m: types.ModuleType) -> str:
"""Return repr for the module.
The method is deprecated. The import machinery does the job itself.
"""
if sys.version_info >= (3, 10):
@staticmethod
def create_module(spec: ModuleSpec) -> types.ModuleType | None:
@ -206,7 +224,7 @@ class FrozenImporter(importlib.abc.MetaPathFinder, importlib.abc.InspectLoader):
else:
@classmethod
def create_module(cls, spec: ModuleSpec) -> types.ModuleType | None:
"""Set __file__, if able."""
"""Use default semantics for module creation."""
@staticmethod
def exec_module(module: types.ModuleType) -> None: ...

View file

@ -1,10 +1,10 @@
"""
Core implementation of path-based import.
"""Core implementation of path-based import.
This module is NOT meant to be directly imported! It has been designed such
that it can be bootstrapped into Python as the implementation of import. As
such it requires the injection of specific modules and attributes in order to
work. One should use importlib as the public-facing version of this module.
"""
import _ast
@ -94,7 +94,11 @@ class WindowsRegistryFinder(importlib.abc.MetaPathFinder):
if sys.version_info < (3, 12):
@classmethod
def find_module(cls, fullname: str, path: Sequence[str] | None = None) -> importlib.abc.Loader | None: ...
def find_module(cls, fullname: str, path: Sequence[str] | None = None) -> importlib.abc.Loader | None:
"""Find module named in the registry.
This method is deprecated. Use find_spec() instead.
"""
@classmethod
def find_spec(
@ -114,7 +118,7 @@ class PathFinder(importlib.abc.MetaPathFinder):
@classmethod
def invalidate_caches(cls) -> None:
"""Call the invalidate_caches() method on all path entry finders
stored in sys.path_importer_cache (where implemented).
stored in sys.path_importer_caches (where implemented).
"""
if sys.version_info >= (3, 10):
@staticmethod
@ -147,7 +151,12 @@ class PathFinder(importlib.abc.MetaPathFinder):
"""
if sys.version_info < (3, 12):
@classmethod
def find_module(cls, fullname: str, path: Sequence[str] | None = None) -> importlib.abc.Loader | None: ...
def find_module(cls, fullname: str, path: Sequence[str] | None = None) -> importlib.abc.Loader | None:
"""find the module on sys.path or 'path' based on sys.path_hooks and
sys.path_importer_cache.
This method is deprecated. Use find_spec() instead.
"""
SOURCE_SUFFIXES: list[str]
DEBUG_BYTECODE_SUFFIXES: list[str]

View file

@ -1,5 +1,4 @@
"""
This module provides an interface to the GNU DBM (GDBM) library.
"""This module provides an interface to the GNU DBM (GDBM) library.
This module is quite similar to the dbm module, but uses GDBM instead to
provide some additional functionality. Please note that the file formats

View file

@ -1,6 +1,4 @@
"""
OpenSSL interface for hashlib module
"""
"""OpenSSL interface for hashlib module"""
import sys
from _typeshed import ReadableBuffer

View file

@ -1,5 +1,4 @@
"""
Heap queue algorithm (a.k.a. priority queue).
"""Heap queue algorithm (a.k.a. priority queue).
Heaps are arrays for which a[k] <= a[2*k+1] and a[k] <= a[2*k+2] for
all k, counting elements from 0. For the sake of comparison,
@ -30,13 +29,12 @@ maintains the heap invariant!
"""
import sys
from typing import Any, Final, TypeVar
_T = TypeVar("_T") # list items must be comparable
from _typeshed import SupportsRichComparisonT as _T # All type variable use in this module requires comparability.
from typing import Final
__about__: Final[str]
def heapify(heap: list[Any], /) -> None: # list items must be comparable
def heapify(heap: list[_T], /) -> None:
"""Transform list into a heap, in-place, in O(len(heap)) time."""
def heappop(heap: list[_T], /) -> _T:
@ -65,7 +63,7 @@ def heapreplace(heap: list[_T], item: _T, /) -> _T:
"""
if sys.version_info >= (3, 14):
def heapify_max(heap: list[Any], /) -> None: # list items must be comparable
def heapify_max(heap: list[_T], /) -> None:
"""Maxheap variant of heapify."""
def heappop_max(heap: list[_T], /) -> _T:

View file

@ -1,6 +1,4 @@
"""
(Extremely) low-level import machinery bits as used by importlib.
"""
"""(Extremely) low-level import machinery bits as used by importlib."""
import sys
import types

View file

@ -1,5 +1,4 @@
"""
This module provides primitive operations to manage Python interpreters.
"""This module provides primitive operations to manage Python interpreters.
The 'interpreters' module provides a more convenient interface.
"""

View file

@ -1,5 +1,4 @@
"""
This module provides primitive operations to manage Python interpreters.
"""This module provides primitive operations to manage Python interpreters.
The 'interpreters' module provides a more convenient interface.
"""

View file

@ -1,5 +1,4 @@
"""
This module provides primitive operations to manage Python interpreters.
"""This module provides primitive operations to manage Python interpreters.
The 'interpreters' module provides a more convenient interface.
"""

View file

@ -1,5 +1,4 @@
"""
The io module provides the Python interfaces to stream handling. The
"""The io module provides the Python interfaces to stream handling. The
builtin open function is defined in this module.
At the top of the I/O hierarchy is the abstract base class IOBase. It

View file

@ -1,6 +1,4 @@
"""
json speedups
"""
"""json speedups"""
from collections.abc import Callable
from typing import Any, final

View file

@ -1,6 +1,4 @@
"""
Support for POSIX locales.
"""
"""Support for POSIX locales."""
import sys
from _typeshed import StrPath

View file

@ -1,6 +1,4 @@
"""
Fast profiler
"""
"""Fast profiler"""
import sys
from _typeshed import structseq

View file

@ -1,8 +1,8 @@
"""
Shared support for scanning document type declarations in HTML and XHTML.
"""Shared support for scanning document type declarations in HTML and XHTML.
This module is used as a foundation for the html.parser module. It has no
documented public API and should not be used directly.
"""
import sys

View file

@ -1,6 +1,4 @@
"""
Documentation
"""
"""Documentation"""
import sys

View file

@ -1,5 +1,4 @@
"""
Operator interface.
"""Operator interface.
This module exports a set of functions implemented in C corresponding
to the intrinsic operators of Python. For example, operator.add(x, y)

View file

@ -1,6 +1,4 @@
"""
Shared OS X support functions.
"""
"""Shared OS X support functions."""
from collections.abc import Iterable, Sequence
from typing import Final, TypeVar

View file

@ -1,6 +1,4 @@
"""
Optimized C implementation for the Python pickle module.
"""
"""Optimized C implementation for the Python pickle module."""
from _typeshed import ReadableBuffer, SupportsWrite
from collections.abc import Callable, Iterable, Iterator, Mapping

View file

@ -1,6 +1,4 @@
"""
A POSIX helper for the subprocess module.
"""
"""A POSIX helper for the subprocess module."""
import sys
from _typeshed import StrOrBytesPath

View file

@ -1,6 +1,4 @@
"""
Python decimal arithmetic module
"""
"""Python decimal arithmetic module"""
# This is a slight lie, the implementations aren't exactly identical
# However, in all likelihood, the differences are inconsequential

View file

@ -1,5 +1,4 @@
"""
C implementation of the Python queue module.
"""C implementation of the Python queue module.
This module is an implementation detail, please do not use it directly.
"""

View file

@ -1,6 +1,4 @@
"""
Module implements the Mersenne Twister random number generator.
"""
"""Module implements the Mersenne Twister random number generator."""
from typing_extensions import TypeAlias

View file

@ -1,5 +1,4 @@
"""
The objects used by the site module to add custom builtins.
"""

View file

@ -1,5 +1,4 @@
"""
Implementation module for socket operations.
"""Implementation module for socket operations.
See the socket module for documentation.
"""
@ -890,7 +889,14 @@ class socket:
operations are disabled.
"""
if sys.platform == "win32":
def ioctl(self, control: int, option: int | tuple[int, int, int] | bool, /) -> None: ...
def ioctl(self, control: int, option: int | tuple[int, int, int] | bool, /) -> None:
"""ioctl(cmd, option) -> long
Control the socket with WSAIoctl syscall. Currently supported 'cmd' values are
SIO_RCVALL: 'option' must be one of the socket.RCVALL_* constants.
SIO_KEEPALIVE_VALS: 'option' is a tuple of (onoff, timeout, interval).
SIO_LOOPBACK_FAST_PATH: 'option' is a boolean value, and is disabled by default
"""
def listen(self, backlog: int = ..., /) -> None:
"""listen([backlog])
@ -1091,7 +1097,14 @@ class socket:
@overload
def setsockopt(self, level: int, optname: int, value: None, optlen: int, /) -> None: ...
if sys.platform == "win32":
def share(self, process_id: int, /) -> bytes: ...
def share(self, process_id: int, /) -> bytes:
"""share(process_id) -> bytes
Share the socket with another process. The target process id
must be provided and the resulting bytes object passed to the target
process. There the shared socket can be instantiated by calling
socket.fromshare().
"""
def shutdown(self, how: int, /) -> None:
"""shutdown(flag)

View file

@ -1,5 +1,4 @@
"""
Implementation module for SSL socket operations. See the socket module
"""Implementation module for SSL socket operations. See the socket module
for documentation.
"""

View file

@ -1,5 +1,4 @@
"""
S_IFMT_: file type bits
"""S_IFMT_: file type bits
S_IFDIR: directory
S_IFCHR: character device
S_IFBLK: block device

View file

@ -1,5 +1,4 @@
"""
Functions to convert between Python values and C structs.
"""Functions to convert between Python values and C structs.
Python bytes objects are used to hold the data representing the C struct
and also as format strings (explained below) to describe the layout of data
in the C struct.

View file

@ -1,5 +1,4 @@
"""
This module provides primitive operations to write multi-threaded programs.
"""This module provides primitive operations to write multi-threaded programs.
The 'threading' module provides a more convenient interface.
"""

View file

@ -1,5 +1,4 @@
"""
Thread-local objects.
"""Thread-local objects.
(Note that this module provides a Python version of the threading.local
class. Depending on the version of Python you're using, there may be a

View file

@ -1,6 +1,4 @@
"""
Debug module to trace memory blocks allocated by Python.
"""
"""Debug module to trace memory blocks allocated by Python."""
from collections.abc import Sequence
from tracemalloc import _FrameTuple, _TraceTuple

View file

@ -82,19 +82,21 @@ class SupportsNext(Protocol[_T_co]):
class SupportsAnext(Protocol[_T_co]):
def __anext__(self) -> Awaitable[_T_co]: ...
# Comparison protocols
class SupportsBool(Protocol):
def __bool__(self) -> bool: ...
# Comparison protocols
class SupportsDunderLT(Protocol[_T_contra]):
def __lt__(self, other: _T_contra, /) -> bool: ...
def __lt__(self, other: _T_contra, /) -> SupportsBool: ...
class SupportsDunderGT(Protocol[_T_contra]):
def __gt__(self, other: _T_contra, /) -> bool: ...
def __gt__(self, other: _T_contra, /) -> SupportsBool: ...
class SupportsDunderLE(Protocol[_T_contra]):
def __le__(self, other: _T_contra, /) -> bool: ...
def __le__(self, other: _T_contra, /) -> SupportsBool: ...
class SupportsDunderGE(Protocol[_T_contra]):
def __ge__(self, other: _T_contra, /) -> bool: ...
def __ge__(self, other: _T_contra, /) -> SupportsBool: ...
class SupportsAllComparisons(
SupportsDunderLT[Any], SupportsDunderGT[Any], SupportsDunderLE[Any], SupportsDunderGE[Any], Protocol

View file

@ -1,5 +1,4 @@
"""
_warnings provides basic warning filtering support.
"""_warnings provides basic warning filtering support.
It is a helper module to speed up interpreter start-up.
"""

View file

@ -1,6 +1,4 @@
"""
Weak-reference support module.
"""
"""Weak-reference support module."""
from collections.abc import Callable
from typing import Any, TypeVar, overload

View file

@ -1,6 +1,4 @@
"""
Implementation module for Zstandard compression.
"""
"""Implementation module for Zstandard compression."""
from _typeshed import ReadableBuffer
from collections.abc import Mapping

View file

@ -1,6 +1,4 @@
"""
Abstract Base Classes (ABCs) according to PEP 3119.
"""
"""Abstract Base Classes (ABCs) according to PEP 3119."""
import _typeshed
import sys

View file

@ -1,5 +1,4 @@
"""
Stuff to parse AIFF-C and AIFF files.
"""Stuff to parse AIFF-C and AIFF files.
Unless explicitly stated otherwise, the description below is true
both for AIFF-C files and AIFF files.

View file

@ -1,6 +1,4 @@
"""
Helpers for introspecting and wrapping annotations.
"""
"""Helpers for introspecting and wrapping annotations."""
import sys
from typing import Literal

View file

@ -1,5 +1,4 @@
"""
Command-line parsing library
"""Command-line parsing library
This module is an optparse-inspired command-line parsing library that:
@ -728,16 +727,40 @@ else:
class _ArgumentGroup(_ActionsContainer):
title: str | None
_group_actions: list[Action]
def __init__(
self,
container: _ActionsContainer,
title: str | None = None,
description: str | None = None,
*,
prefix_chars: str = ...,
argument_default: Any = ...,
conflict_handler: str = ...,
) -> None: ...
if sys.version_info >= (3, 14):
@overload
def __init__(
self,
container: _ActionsContainer,
title: str | None = None,
description: str | None = None,
*,
argument_default: Any = ...,
conflict_handler: str = ...,
) -> None: ...
@overload
@deprecated("Undocumented `prefix_chars` parameter is deprecated since Python 3.14.")
def __init__(
self,
container: _ActionsContainer,
title: str | None = None,
description: str | None = None,
*,
prefix_chars: str,
argument_default: Any = ...,
conflict_handler: str = ...,
) -> None: ...
else:
def __init__(
self,
container: _ActionsContainer,
title: str | None = None,
description: str | None = None,
*,
prefix_chars: str = ...,
argument_default: Any = ...,
conflict_handler: str = ...,
) -> None: ...
# undocumented
class _MutuallyExclusiveGroup(_ArgumentGroup):
@ -971,9 +994,9 @@ class _SubParsersAction(Action, Generic[_ArgumentParserT]):
fromfile_prefix_chars: str | None = ...,
argument_default: Any = ...,
conflict_handler: str = ...,
add_help: bool = ...,
allow_abbrev: bool = ...,
exit_on_error: bool = ...,
add_help: bool = True,
allow_abbrev: bool = True,
exit_on_error: bool = True,
suggest_on_error: bool = False,
color: bool = False,
**kwargs: Any, # Accepting any additional kwargs for custom parser classes
@ -997,9 +1020,9 @@ class _SubParsersAction(Action, Generic[_ArgumentParserT]):
fromfile_prefix_chars: str | None = ...,
argument_default: Any = ...,
conflict_handler: str = ...,
add_help: bool = ...,
allow_abbrev: bool = ...,
exit_on_error: bool = ...,
add_help: bool = True,
allow_abbrev: bool = True,
exit_on_error: bool = True,
**kwargs: Any, # Accepting any additional kwargs for custom parser classes
) -> _ArgumentParserT: ...
else:
@ -1020,9 +1043,9 @@ class _SubParsersAction(Action, Generic[_ArgumentParserT]):
fromfile_prefix_chars: str | None = ...,
argument_default: Any = ...,
conflict_handler: str = ...,
add_help: bool = ...,
allow_abbrev: bool = ...,
exit_on_error: bool = ...,
add_help: bool = True,
allow_abbrev: bool = True,
exit_on_error: bool = True,
**kwargs: Any, # Accepting any additional kwargs for custom parser classes
) -> _ArgumentParserT: ...

View file

@ -1,5 +1,4 @@
"""
This module defines an object type which can efficiently represent
"""This module defines an object type which can efficiently represent
an array of basic values: characters, integers, floating-point
numbers. Arrays are sequence types and behave very much like lists,
except that the type of objects stored in them is constrained.
@ -151,10 +150,7 @@ class array(MutableSequence[_T]):
"""
else:
def index(self, v: _T, /) -> int: # type: ignore[override]
"""Return index of first occurrence of v in the array.
Raise ValueError if the value is not present.
"""
"""Return index of first occurrence of v in the array."""
def insert(self, i: int, v: _T, /) -> None:
"""Insert a new item v into the array before position i."""

View file

@ -1,5 +1,4 @@
"""
The `ast` module helps Python applications to process trees of the Python
abstract syntax grammar. The abstract syntax itself might change with
each Python release; this module helps to find out programmatically what
@ -1333,12 +1332,16 @@ class Constant(expr):
# Aliases for value, for backwards compatibility
@deprecated("Will be removed in Python 3.14; use value instead")
@property
def n(self) -> _ConstantValue: ...
def n(self) -> _ConstantValue:
"""Deprecated. Use value instead."""
@n.setter
def n(self, value: _ConstantValue) -> None: ...
@deprecated("Will be removed in Python 3.14; use value instead")
@property
def s(self) -> _ConstantValue: ...
def s(self) -> _ConstantValue:
"""Deprecated. Use value instead."""
@s.setter
def s(self, value: _ConstantValue) -> None: ...

View file

@ -1,5 +1,4 @@
"""
A class supporting chat-style (command/response) protocols.
"""A class supporting chat-style (command/response) protocols.
This class adds support for 'chat' style protocols - where one side
sends a 'command', and the other sends a response (examples would be

View file

@ -1,6 +1,4 @@
"""
The asyncio package, tracking PEP 3156.
"""
"""The asyncio package, tracking PEP 3156."""
# This condition is so big, it's clearer to keep to platform condition in two blocks
# Can't NOQA on a specific line: https://github.com/plinss/flake8-noqa/issues/22

View file

@ -1,5 +1,4 @@
"""
Base implementation of event loop.
"""Base implementation of event loop.
The event loop can be broken up into a multiplexer (the part
responsible for notifying us of I/O events) and the event loop proper,
@ -191,7 +190,7 @@ class BaseEventLoop(AbstractEventLoop):
"""
else:
def create_task(self, coro: _CoroutineLike[_T], *, name: object = None) -> Task[_T]:
"""Schedule or begin executing a coroutine object.
"""Schedule a coroutine object.
Return a task object.
"""
@ -571,15 +570,7 @@ class BaseEventLoop(AbstractEventLoop):
ssl: _SSLContext = None,
ssl_handshake_timeout: float | None = None,
ssl_shutdown_timeout: float | None = None,
) -> tuple[Transport, _ProtocolT]:
"""Handle an accepted connection.
This is used by servers that accept connections outside of
asyncio but that use asyncio to handle connections.
This method is a coroutine. When completed, the coroutine
returns a (transport, protocol) pair.
"""
) -> tuple[Transport, _ProtocolT]: ...
else:
async def start_tls(
self,
@ -800,11 +791,6 @@ class BaseEventLoop(AbstractEventLoop):
"""
else:
async def shutdown_default_executor(self) -> None:
"""Schedule the shutdown of the default executor.
The timeout parameter specifies the amount of time the executor will
be given to finish joining. The default value is None, which means
that the executor will be given an unlimited amount of time.
"""
"""Schedule the shutdown of the default executor."""
def __del__(self) -> None: ...

View file

@ -1,6 +1,4 @@
"""
Event loop and event loop policy.
"""
"""Event loop and event loop policy."""
import ssl
import sys
@ -493,9 +491,6 @@ class AbstractEventLoop:
they all set this flag when being created. This option is not
supported on Windows.
keep_alive set to True keeps connections active by enabling the
periodic transmission of messages.
ssl_handshake_timeout is the time in seconds that an SSL server
will wait for completion of the SSL handshake before aborting the
connection. Default is 60s.
@ -583,17 +578,10 @@ class AbstractEventLoop:
they all set this flag when being created. This option is not
supported on Windows.
keep_alive set to True keeps connections active by enabling the
periodic transmission of messages.
ssl_handshake_timeout is the time in seconds that an SSL server
will wait for completion of the SSL handshake before aborting the
connection. Default is 60s.
ssl_shutdown_timeout is the time in seconds that an SSL server
will wait for completion of the SSL shutdown procedure
before aborting the connection. Default is 30s.
start_serving set to True (default) causes the created server
to start accepting connections immediately. When set to False,
the user should await Server.start_serving() or Server.serve_forever()
@ -727,9 +715,6 @@ class AbstractEventLoop:
ssl_handshake_timeout is the time in seconds that an SSL server
will wait for the SSL handshake to complete (defaults to 60s).
ssl_shutdown_timeout is the time in seconds that an SSL server
will wait for the SSL shutdown to finish (defaults to 30s).
start_serving set to True (default) causes the created server
to start accepting connections immediately. When set to False,
the user should await Server.start_serving() or Server.serve_forever()

View file

@ -1,6 +1,4 @@
"""
asyncio exceptions.
"""
"""asyncio exceptions."""
import sys

View file

@ -1,6 +1,4 @@
"""
A Future class similar to the one in PEP 3148.
"""
"""A Future class similar to the one in PEP 3148."""
import sys
from _asyncio import Future as Future

View file

@ -1,6 +1,4 @@
"""
Introspection utils for tasks call graphs.
"""
"""Introspection utils for tasks call graphs."""
from _typeshed import SupportsWrite
from asyncio import Future

View file

@ -1,6 +1,4 @@
"""
Synchronization primitives.
"""
"""Synchronization primitives."""
import enum
import sys

View file

@ -1,6 +1,4 @@
"""
Logging configuration.
"""
"""Logging configuration."""
import logging

View file

@ -1,6 +1,4 @@
"""
Event loop mixins.
"""
"""Event loop mixins."""
import sys
import threading

View file

@ -1,5 +1,4 @@
"""
Event loop using a proactor and related classes.
"""Event loop using a proactor and related classes.
A proactor is a "notify-on-completion" multiplexer. Currently a
proactor is only implemented on Windows with IOCP.

View file

@ -1,6 +1,4 @@
"""
Abstract Protocol base classes.
"""
"""Abstract Protocol base classes."""
from _typeshed import ReadableBuffer
from asyncio import transports

View file

@ -1,4 +1,5 @@
import sys
from _typeshed import SupportsRichComparisonT
from asyncio.events import AbstractEventLoop
from types import GenericAlias
from typing import Any, Generic, TypeVar
@ -146,7 +147,7 @@ class Queue(Generic[_T], _LoopBoundMixin): # noqa: Y059
the queue, which may unblock callers of join().
"""
class PriorityQueue(Queue[_T]):
class PriorityQueue(Queue[SupportsRichComparisonT]):
"""A subclass of Queue; retrieves entries in priority order (lowest first).
Entries are typically tuples of the form: (priority number, data).

View file

@ -1,5 +1,4 @@
"""
Event loop using a selector and related classes.
"""Event loop using a selector and related classes.
A selector is a "notify-when-ready" multiplexer. For a subclass which
also includes support for signal handling, see the unix_events sub-module.

View file

@ -184,12 +184,7 @@ class _SSLProtocolTransport(transports._FlowControlMixin, transports.Transport):
def can_write_eof(self) -> Literal[False]:
"""Return True if this transport supports write_eof(), False if not."""
if sys.version_info >= (3, 11):
def get_write_buffer_limits(self) -> tuple[int, int]:
"""Get the high and low watermarks for write flow control.
Return a tuple (low, high) where low and high are
positive number of bytes.
"""
def get_write_buffer_limits(self) -> tuple[int, int]: ...
def get_read_buffer_limits(self) -> tuple[int, int]: ...
def set_read_buffer_limits(self, high: int | None = None, low: int | None = None) -> None:
"""Set the high- and low-water limits for read flow control.

View file

@ -1,6 +1,4 @@
"""
Support for running coroutines in parallel with staggered start times.
"""
"""Support for running coroutines in parallel with staggered start times."""
from collections.abc import Awaitable, Callable, Iterable
from typing import Any

View file

@ -329,12 +329,6 @@ class StreamReader:
If the data cannot be read because of over limit, a
LimitOverrunError exception will be raised, and the data
will be left in the internal buffer, so it can be read again.
The ``separator`` may also be a tuple of separators. In this
case the return value will be the shortest possible that has any
separator as the suffix. For the purposes of LimitOverrunError,
the shortest possible separator is considered to be the one that
matched.
"""
async def read(self, n: int = -1) -> bytes:

View file

@ -1,6 +1,4 @@
"""
Support for tasks, coroutines and the scheduler.
"""
"""Support for tasks, coroutines and the scheduler."""
import concurrent.futures
import sys

View file

@ -1,6 +1,4 @@
"""
High-level support for working with threads in asyncio
"""
"""High-level support for working with threads in asyncio"""
from collections.abc import Callable
from typing import TypeVar

View file

@ -1,6 +1,4 @@
"""
Tools to analyze tasks running in asyncio programs.
"""
"""Tools to analyze tasks running in asyncio programs."""
from collections.abc import Iterable
from enum import Enum

View file

@ -1,6 +1,4 @@
"""
Abstract Transport class.
"""
"""Abstract Transport class."""
from asyncio.events import AbstractEventLoop
from asyncio.protocols import BaseProtocol

View file

@ -1,6 +1,4 @@
"""
Selector event loop for Unix with signal handling.
"""
"""Selector event loop for Unix with signal handling."""
import sys
import types

View file

@ -1,6 +1,4 @@
"""
Selector and proactor event loops for Windows.
"""
"""Selector and proactor event loops for Windows."""
import socket
import sys

View file

@ -1,6 +1,4 @@
"""
Various Windows specific bits and pieces.
"""
"""Various Windows specific bits and pieces."""
import subprocess
import sys

View file

@ -1,5 +1,4 @@
"""
Basic infrastructure for asynchronous socket service clients and servers.
"""Basic infrastructure for asynchronous socket service clients and servers.
There are only two ways to have a program on a single processor do "more
than one thing at a time". Multi-threaded programming is the simplest and

View file

@ -1,5 +1,4 @@
"""
allow programmer to define multiple exit functions to be executed
"""allow programmer to define multiple exit functions to be executed
upon normal program termination.
Two public functions, register and unregister, are defined.

View file

@ -1,6 +1,4 @@
"""
Base16, Base32, Base64 (RFC 3548), Base85 and Ascii85 data encodings
"""
"""Base16, Base32, Base64 (RFC 3548), Base85 and Ascii85 data encodings"""
import sys
from _typeshed import ReadableBuffer

View file

@ -1,6 +1,4 @@
"""
Debugger basics
"""
"""Debugger basics"""
import sys
from _typeshed import ExcInfo, TraceFunction, Unused

View file

@ -1,6 +1,4 @@
"""
Conversion between binary data and ASCII
"""
"""Conversion between binary data and ASCII"""
import sys
from _typeshed import ReadableBuffer

View file

@ -1,5 +1,4 @@
"""
Macintosh binhex compression/decompression.
"""Macintosh binhex compression/decompression.
easy interface:
binhex(inputfilename, outputfilename)

View file

@ -1,6 +1,4 @@
"""
Bisection algorithms.
"""
"""Bisection algorithms."""
from _bisect import *

View file

@ -1,5 +1,4 @@
"""
Built-in functions, types, exceptions, and other objects.
"""Built-in functions, types, exceptions, and other objects.
This module provides direct access to all 'built-in'
identifiers of Python; for example, builtins.len is
@ -459,14 +458,13 @@ class int:
length
Length of bytes object to use. An OverflowError is raised if the
integer is not representable with the given number of bytes. Default
is length 1.
integer is not representable with the given number of bytes.
byteorder
The byte order used to represent the integer. If byteorder is 'big',
the most significant byte is at the beginning of the byte array. If
byteorder is 'little', the most significant byte is at the end of the
byte array. To request the native byte order of the host system, use
sys.byteorder as the byte order value. Default is to use 'big'.
`sys.byteorder' as the byte order value.
signed
Determines whether two's complement is used to represent the integer.
If signed is False and a negative integer is given, an OverflowError
@ -493,7 +491,7 @@ class int:
the most significant byte is at the beginning of the byte array. If
byteorder is 'little', the most significant byte is at the end of the
byte array. To request the native byte order of the host system, use
sys.byteorder as the byte order value. Default is to use 'big'.
`sys.byteorder' as the byte order value.
signed
Indicates whether two's complement is used to represent the integer.
"""
@ -2510,13 +2508,11 @@ class memoryview(Sequence[_I]):
"""
else:
def tobytes(self, order: Literal["C", "F", "A"] | None = None) -> bytes:
"""Return the data in the buffer as a byte string.
Order can be {'C', 'F', 'A'}. When order is 'C' or 'F', the data of the
original array is converted to C or Fortran order. For contiguous views,
'A' returns an exact copy of the physical memory. In particular, in-memory
Fortran order is preserved. For non-contiguous views, the data is converted
to C first. order=None is the same as order='C'.
"""Return the data in the buffer as a byte string. Order can be {'C', 'F', 'A'}.
When order is 'C' or 'F', the data of the original array is converted to C or
Fortran order. For contiguous views, 'A' returns an exact copy of the physical
memory. In particular, in-memory Fortran order is preserved. For non-contiguous
views, the data is converted to C first. order=None is the same as order='C'.
"""
def tolist(self) -> list[int]:

View file

@ -1,5 +1,4 @@
"""
Interface to the libbzip2 compression library.
"""Interface to the libbzip2 compression library.
This module provides a file interface, classes for incremental
(de)compression, and functions for one-shot (de)compression.

View file

@ -1,5 +1,4 @@
"""
Python interface for the 'lsprof' profiler.
"""Python interface for the 'lsprof' profiler.
Compatible with the 'profile' module.
"""

View file

@ -1,5 +1,4 @@
"""
Calendar printing functions
"""Calendar printing functions
Note when comparing these calendars to the ones printed by cal(1): By
default, these calendars have Monday as the first day of the week, and

View file

@ -1,5 +1,4 @@
"""
Support module for CGI (Common Gateway Interface) scripts.
"""Support module for CGI (Common Gateway Interface) scripts.
This module defines a number of utilities for use by CGI scripts
written in Python.

View file

@ -1,5 +1,4 @@
"""
More comprehensive traceback formatting for Python scripts.
"""More comprehensive traceback formatting for Python scripts.
To enable this module, do:
@ -20,6 +19,7 @@ Alternatively, if you have caught an exception and want cgitb to display it
for you, call cgitb.handler(). The optional argument to handler() is a
3-item tuple (etype, evalue, etb) just like the value of sys.exc_info().
The default handler displays output as HTML.
"""
from _typeshed import OptExcInfo, StrOrBytesPath

View file

@ -1,5 +1,4 @@
"""
Simple class to read IFF chunks.
"""Simple class to read IFF chunks.
An IFF chunk (used in formats such as AIFF, TIFF, RMFF (RealMedia File
Format)) has the following structure:

View file

@ -1,5 +1,4 @@
"""
This module provides access to mathematical functions for complex
"""This module provides access to mathematical functions for complex
numbers.
"""

View file

@ -1,5 +1,4 @@
"""
A generic class to build line-oriented command interpreters.
"""A generic class to build line-oriented command interpreters.
Interpreters constructed with this class obey the following conventions:

View file

@ -1,6 +1,4 @@
"""
Utilities needed to emulate Python's interactive interpreter.
"""
"""Utilities needed to emulate Python's interactive interpreter."""
import sys
from codeop import CommandCompiler, compile_command as compile_command

View file

@ -1,10 +1,10 @@
"""
codecs -- Python Codec Registry, API and helpers.
"""codecs -- Python Codec Registry, API and helpers.
Written by Marc-Andre Lemburg (mal@lemburg.com).
(c) Copyright CNRI, All Rights Reserved. NO WARRANTY.
"""
import types

View file

@ -1,5 +1,4 @@
"""
Utilities to compile possibly incomplete Python source code.
"""Utilities to compile possibly incomplete Python source code.
This module provides two interfaces, broadly similar to the builtin
function compile(), which take program text, a filename and a 'mode'

View file

@ -1,5 +1,4 @@
"""
This module implements specialized container datatypes providing
"""This module implements specialized container datatypes providing
alternatives to Python's general purpose built-in containers, dict,
list, set, and tuple.
@ -12,6 +11,7 @@ list, set, and tuple.
* UserDict wrapper around dictionary objects for easier dict subclassing
* UserList wrapper around list objects for easier list subclassing
* UserString wrapper around string objects for easier string subclassing
"""
import sys
@ -143,9 +143,7 @@ class UserDict(MutableMapping[_KT, _VT]):
def __ior__(self, other: Iterable[tuple[_KT, _VT]]) -> Self: ...
if sys.version_info >= (3, 12):
@overload
def get(self, key: _KT, default: None = None) -> _VT | None:
"""D.get(k[,d]) -> D[k] if k in D, else d. d defaults to None."""
def get(self, key: _KT, default: None = None) -> _VT | None: ...
@overload
def get(self, key: _KT, default: _VT) -> _VT: ...
@overload

View file

@ -1,5 +1,4 @@
"""
Abstract Base Classes (ABCs) for collections, according to PEP 3119.
"""Abstract Base Classes (ABCs) for collections, according to PEP 3119.
Unit tests are in test_collections.
"""

Some files were not shown because too many files have changed in this diff Show more