[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 __text_signature__ :: str | None
__type_params__ :: tuple[TypeVar | ParamSpec | TypeVarTuple, ...] __type_params__ :: tuple[TypeVar | ParamSpec | TypeVarTuple, ...]
__weakrefoffset__ :: int __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 _generate_next_value_ :: def _generate_next_value_(name: str, start: int, count: int, last_values: list[Any]) -> Any
_ignore_ :: str | list[str] _ignore_ :: str | list[str]
_member_map_ :: dict[str, Enum] _member_map_ :: dict[str, Enum]

View file

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

View file

@ -1,6 +1,4 @@
""" """Accelerator module for asyncio"""
Accelerator module for asyncio
"""
import sys import sys
from asyncio.events import AbstractEventLoop 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 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 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 _typeshed import ReadableBuffer
from typing import ClassVar, final 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: ... 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. 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) # _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 import sys
from collections.abc import Callable, Iterator, Mapping from collections.abc import Callable, Iterator, Mapping

View file

@ -1,6 +1,4 @@
""" """CSV parsing and writing."""
CSV parsing and writing.
"""
import csv import csv
import sys 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 _typeshed
import sys import sys

View file

@ -1,6 +1,4 @@
""" """C decimal arithmetic module"""
C decimal arithmetic module
"""
import sys import sys
from decimal import ( 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 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 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 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. work. One should use importlib as the public-facing version of this module.
""" """
import importlib.abc import importlib.abc
@ -114,7 +114,13 @@ class BuiltinImporter(importlib.abc.MetaPathFinder, importlib.abc.InspectLoader)
# MetaPathFinder # MetaPathFinder
if sys.version_info < (3, 12): if sys.version_info < (3, 12):
@classmethod @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 @classmethod
def find_spec( def find_spec(
@ -142,7 +148,11 @@ class BuiltinImporter(importlib.abc.MetaPathFinder, importlib.abc.InspectLoader)
# Loader # Loader
if sys.version_info < (3, 12): if sys.version_info < (3, 12):
@staticmethod @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): if sys.version_info >= (3, 10):
@staticmethod @staticmethod
def create_module(spec: ModuleSpec) -> types.ModuleType | None: def create_module(spec: ModuleSpec) -> types.ModuleType | None:
@ -170,7 +180,11 @@ class FrozenImporter(importlib.abc.MetaPathFinder, importlib.abc.InspectLoader):
# MetaPathFinder # MetaPathFinder
if sys.version_info < (3, 12): if sys.version_info < (3, 12):
@classmethod @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 @classmethod
def find_spec( def find_spec(
@ -198,7 +212,11 @@ class FrozenImporter(importlib.abc.MetaPathFinder, importlib.abc.InspectLoader):
# Loader # Loader
if sys.version_info < (3, 12): if sys.version_info < (3, 12):
@staticmethod @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): if sys.version_info >= (3, 10):
@staticmethod @staticmethod
def create_module(spec: ModuleSpec) -> types.ModuleType | None: def create_module(spec: ModuleSpec) -> types.ModuleType | None:
@ -206,7 +224,7 @@ class FrozenImporter(importlib.abc.MetaPathFinder, importlib.abc.InspectLoader):
else: else:
@classmethod @classmethod
def create_module(cls, spec: ModuleSpec) -> types.ModuleType | None: def create_module(cls, spec: ModuleSpec) -> types.ModuleType | None:
"""Set __file__, if able.""" """Use default semantics for module creation."""
@staticmethod @staticmethod
def exec_module(module: types.ModuleType) -> None: ... 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 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 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 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. work. One should use importlib as the public-facing version of this module.
""" """
import _ast import _ast
@ -94,7 +94,11 @@ class WindowsRegistryFinder(importlib.abc.MetaPathFinder):
if sys.version_info < (3, 12): if sys.version_info < (3, 12):
@classmethod @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 @classmethod
def find_spec( def find_spec(
@ -114,7 +118,7 @@ class PathFinder(importlib.abc.MetaPathFinder):
@classmethod @classmethod
def invalidate_caches(cls) -> None: def invalidate_caches(cls) -> None:
"""Call the invalidate_caches() method on all path entry finders """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): if sys.version_info >= (3, 10):
@staticmethod @staticmethod
@ -147,7 +151,12 @@ class PathFinder(importlib.abc.MetaPathFinder):
""" """
if sys.version_info < (3, 12): if sys.version_info < (3, 12):
@classmethod @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] SOURCE_SUFFIXES: list[str]
DEBUG_BYTECODE_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 This module is quite similar to the dbm module, but uses GDBM instead to
provide some additional functionality. Please note that the file formats 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 import sys
from _typeshed import ReadableBuffer 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 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, all k, counting elements from 0. For the sake of comparison,
@ -30,13 +29,12 @@ maintains the heap invariant!
""" """
import sys import sys
from typing import Any, Final, TypeVar from _typeshed import SupportsRichComparisonT as _T # All type variable use in this module requires comparability.
from typing import Final
_T = TypeVar("_T") # list items must be comparable
__about__: Final[str] __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.""" """Transform list into a heap, in-place, in O(len(heap)) time."""
def heappop(heap: list[_T], /) -> _T: def heappop(heap: list[_T], /) -> _T:
@ -65,7 +63,7 @@ def heapreplace(heap: list[_T], item: _T, /) -> _T:
""" """
if sys.version_info >= (3, 14): 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.""" """Maxheap variant of heapify."""
def heappop_max(heap: list[_T], /) -> _T: 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 sys
import types 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. 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. 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. 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. builtin open function is defined in this module.
At the top of the I/O hierarchy is the abstract base class IOBase. It 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 collections.abc import Callable
from typing import Any, final from typing import Any, final

View file

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

View file

@ -1,6 +1,4 @@
""" """Fast profiler"""
Fast profiler
"""
import sys import sys
from _typeshed import structseq 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 This module is used as a foundation for the html.parser module. It has no
documented public API and should not be used directly. documented public API and should not be used directly.
""" """
import sys import sys

View file

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

View file

@ -1,5 +1,4 @@
""" """Operator interface.
Operator interface.
This module exports a set of functions implemented in C corresponding This module exports a set of functions implemented in C corresponding
to the intrinsic operators of Python. For example, operator.add(x, y) 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 collections.abc import Iterable, Sequence
from typing import Final, TypeVar 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 _typeshed import ReadableBuffer, SupportsWrite
from collections.abc import Callable, Iterable, Iterator, Mapping 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 import sys
from _typeshed import StrOrBytesPath 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 # This is a slight lie, the implementations aren't exactly identical
# However, in all likelihood, the differences are inconsequential # 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. 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 from typing_extensions import TypeAlias

View file

@ -1,5 +1,4 @@
""" """
The objects used by the site module to add custom builtins. 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. See the socket module for documentation.
""" """
@ -890,7 +889,14 @@ class socket:
operations are disabled. operations are disabled.
""" """
if sys.platform == "win32": 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: def listen(self, backlog: int = ..., /) -> None:
"""listen([backlog]) """listen([backlog])
@ -1091,7 +1097,14 @@ class socket:
@overload @overload
def setsockopt(self, level: int, optname: int, value: None, optlen: int, /) -> None: ... def setsockopt(self, level: int, optname: int, value: None, optlen: int, /) -> None: ...
if sys.platform == "win32": 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: def shutdown(self, how: int, /) -> None:
"""shutdown(flag) """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. for documentation.
""" """

View file

@ -1,5 +1,4 @@
""" """S_IFMT_: file type bits
S_IFMT_: file type bits
S_IFDIR: directory S_IFDIR: directory
S_IFCHR: character device S_IFCHR: character device
S_IFBLK: block 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 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 and also as format strings (explained below) to describe the layout of data
in the C struct. 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. 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 (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 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 collections.abc import Sequence
from tracemalloc import _FrameTuple, _TraceTuple from tracemalloc import _FrameTuple, _TraceTuple

View file

@ -82,19 +82,21 @@ class SupportsNext(Protocol[_T_co]):
class SupportsAnext(Protocol[_T_co]): class SupportsAnext(Protocol[_T_co]):
def __anext__(self) -> Awaitable[_T_co]: ... def __anext__(self) -> Awaitable[_T_co]: ...
# Comparison protocols class SupportsBool(Protocol):
def __bool__(self) -> bool: ...
# Comparison protocols
class SupportsDunderLT(Protocol[_T_contra]): class SupportsDunderLT(Protocol[_T_contra]):
def __lt__(self, other: _T_contra, /) -> bool: ... def __lt__(self, other: _T_contra, /) -> SupportsBool: ...
class SupportsDunderGT(Protocol[_T_contra]): class SupportsDunderGT(Protocol[_T_contra]):
def __gt__(self, other: _T_contra, /) -> bool: ... def __gt__(self, other: _T_contra, /) -> SupportsBool: ...
class SupportsDunderLE(Protocol[_T_contra]): class SupportsDunderLE(Protocol[_T_contra]):
def __le__(self, other: _T_contra, /) -> bool: ... def __le__(self, other: _T_contra, /) -> SupportsBool: ...
class SupportsDunderGE(Protocol[_T_contra]): class SupportsDunderGE(Protocol[_T_contra]):
def __ge__(self, other: _T_contra, /) -> bool: ... def __ge__(self, other: _T_contra, /) -> SupportsBool: ...
class SupportsAllComparisons( class SupportsAllComparisons(
SupportsDunderLT[Any], SupportsDunderGT[Any], SupportsDunderLE[Any], SupportsDunderGE[Any], Protocol 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. 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 collections.abc import Callable
from typing import Any, TypeVar, overload 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 _typeshed import ReadableBuffer
from collections.abc import Mapping 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 _typeshed
import sys 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 Unless explicitly stated otherwise, the description below is true
both for AIFF-C files and AIFF files. 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 import sys
from typing import Literal 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: This module is an optparse-inspired command-line parsing library that:
@ -728,6 +727,30 @@ else:
class _ArgumentGroup(_ActionsContainer): class _ArgumentGroup(_ActionsContainer):
title: str | None title: str | None
_group_actions: list[Action] _group_actions: list[Action]
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__( def __init__(
self, self,
container: _ActionsContainer, container: _ActionsContainer,
@ -971,9 +994,9 @@ class _SubParsersAction(Action, Generic[_ArgumentParserT]):
fromfile_prefix_chars: str | None = ..., fromfile_prefix_chars: str | None = ...,
argument_default: Any = ..., argument_default: Any = ...,
conflict_handler: str = ..., conflict_handler: str = ...,
add_help: bool = ..., add_help: bool = True,
allow_abbrev: bool = ..., allow_abbrev: bool = True,
exit_on_error: bool = ..., exit_on_error: bool = True,
suggest_on_error: bool = False, suggest_on_error: bool = False,
color: bool = False, color: bool = False,
**kwargs: Any, # Accepting any additional kwargs for custom parser classes **kwargs: Any, # Accepting any additional kwargs for custom parser classes
@ -997,9 +1020,9 @@ class _SubParsersAction(Action, Generic[_ArgumentParserT]):
fromfile_prefix_chars: str | None = ..., fromfile_prefix_chars: str | None = ...,
argument_default: Any = ..., argument_default: Any = ...,
conflict_handler: str = ..., conflict_handler: str = ...,
add_help: bool = ..., add_help: bool = True,
allow_abbrev: bool = ..., allow_abbrev: bool = True,
exit_on_error: bool = ..., exit_on_error: bool = True,
**kwargs: Any, # Accepting any additional kwargs for custom parser classes **kwargs: Any, # Accepting any additional kwargs for custom parser classes
) -> _ArgumentParserT: ... ) -> _ArgumentParserT: ...
else: else:
@ -1020,9 +1043,9 @@ class _SubParsersAction(Action, Generic[_ArgumentParserT]):
fromfile_prefix_chars: str | None = ..., fromfile_prefix_chars: str | None = ...,
argument_default: Any = ..., argument_default: Any = ...,
conflict_handler: str = ..., conflict_handler: str = ...,
add_help: bool = ..., add_help: bool = True,
allow_abbrev: bool = ..., allow_abbrev: bool = True,
exit_on_error: bool = ..., exit_on_error: bool = True,
**kwargs: Any, # Accepting any additional kwargs for custom parser classes **kwargs: Any, # Accepting any additional kwargs for custom parser classes
) -> _ArgumentParserT: ... ) -> _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 an array of basic values: characters, integers, floating-point
numbers. Arrays are sequence types and behave very much like lists, numbers. Arrays are sequence types and behave very much like lists,
except that the type of objects stored in them is constrained. except that the type of objects stored in them is constrained.
@ -151,10 +150,7 @@ class array(MutableSequence[_T]):
""" """
else: else:
def index(self, v: _T, /) -> int: # type: ignore[override] def index(self, v: _T, /) -> int: # type: ignore[override]
"""Return index of first occurrence of v in the array. """Return index of first occurrence of v in the array."""
Raise ValueError if the value is not present.
"""
def insert(self, i: int, v: _T, /) -> None: def insert(self, i: int, v: _T, /) -> None:
"""Insert a new item v into the array before position i.""" """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 The `ast` module helps Python applications to process trees of the Python
abstract syntax grammar. The abstract syntax itself might change with abstract syntax grammar. The abstract syntax itself might change with
each Python release; this module helps to find out programmatically what each Python release; this module helps to find out programmatically what
@ -1333,12 +1332,16 @@ class Constant(expr):
# Aliases for value, for backwards compatibility # Aliases for value, for backwards compatibility
@deprecated("Will be removed in Python 3.14; use value instead") @deprecated("Will be removed in Python 3.14; use value instead")
@property @property
def n(self) -> _ConstantValue: ... def n(self) -> _ConstantValue:
"""Deprecated. Use value instead."""
@n.setter @n.setter
def n(self, value: _ConstantValue) -> None: ... def n(self, value: _ConstantValue) -> None: ...
@deprecated("Will be removed in Python 3.14; use value instead") @deprecated("Will be removed in Python 3.14; use value instead")
@property @property
def s(self) -> _ConstantValue: ... def s(self) -> _ConstantValue:
"""Deprecated. Use value instead."""
@s.setter @s.setter
def s(self, value: _ConstantValue) -> None: ... 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 This class adds support for 'chat' style protocols - where one side
sends a 'command', and the other sends a response (examples would be 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 # 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 # 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 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, responsible for notifying us of I/O events) and the event loop proper,
@ -191,7 +190,7 @@ class BaseEventLoop(AbstractEventLoop):
""" """
else: else:
def create_task(self, coro: _CoroutineLike[_T], *, name: object = None) -> Task[_T]: 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. Return a task object.
""" """
@ -571,15 +570,7 @@ class BaseEventLoop(AbstractEventLoop):
ssl: _SSLContext = None, ssl: _SSLContext = None,
ssl_handshake_timeout: float | None = None, ssl_handshake_timeout: float | None = None,
ssl_shutdown_timeout: float | None = None, ssl_shutdown_timeout: float | None = None,
) -> tuple[Transport, _ProtocolT]: ) -> 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.
"""
else: else:
async def start_tls( async def start_tls(
self, self,
@ -800,11 +791,6 @@ class BaseEventLoop(AbstractEventLoop):
""" """
else: else:
async def shutdown_default_executor(self) -> None: async def shutdown_default_executor(self) -> None:
"""Schedule the shutdown of the default executor. """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.
"""
def __del__(self) -> None: ... 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 ssl
import sys import sys
@ -493,9 +491,6 @@ class AbstractEventLoop:
they all set this flag when being created. This option is not they all set this flag when being created. This option is not
supported on Windows. 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 ssl_handshake_timeout is the time in seconds that an SSL server
will wait for completion of the SSL handshake before aborting the will wait for completion of the SSL handshake before aborting the
connection. Default is 60s. connection. Default is 60s.
@ -583,17 +578,10 @@ class AbstractEventLoop:
they all set this flag when being created. This option is not they all set this flag when being created. This option is not
supported on Windows. 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 ssl_handshake_timeout is the time in seconds that an SSL server
will wait for completion of the SSL handshake before aborting the will wait for completion of the SSL handshake before aborting the
connection. Default is 60s. 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 start_serving set to True (default) causes the created server
to start accepting connections immediately. When set to False, to start accepting connections immediately. When set to False,
the user should await Server.start_serving() or Server.serve_forever() 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 ssl_handshake_timeout is the time in seconds that an SSL server
will wait for the SSL handshake to complete (defaults to 60s). 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 start_serving set to True (default) causes the created server
to start accepting connections immediately. When set to False, to start accepting connections immediately. When set to False,
the user should await Server.start_serving() or Server.serve_forever() the user should await Server.start_serving() or Server.serve_forever()

View file

@ -1,6 +1,4 @@
""" """asyncio exceptions."""
asyncio exceptions.
"""
import sys 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 import sys
from _asyncio import Future as Future 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 _typeshed import SupportsWrite
from asyncio import Future from asyncio import Future

View file

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

View file

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

View file

@ -1,6 +1,4 @@
""" """Event loop mixins."""
Event loop mixins.
"""
import sys import sys
import threading 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 A proactor is a "notify-on-completion" multiplexer. Currently a
proactor is only implemented on Windows with IOCP. 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 _typeshed import ReadableBuffer
from asyncio import transports from asyncio import transports

View file

@ -1,4 +1,5 @@
import sys import sys
from _typeshed import SupportsRichComparisonT
from asyncio.events import AbstractEventLoop from asyncio.events import AbstractEventLoop
from types import GenericAlias from types import GenericAlias
from typing import Any, Generic, TypeVar 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(). 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). """A subclass of Queue; retrieves entries in priority order (lowest first).
Entries are typically tuples of the form: (priority number, data). 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 A selector is a "notify-when-ready" multiplexer. For a subclass which
also includes support for signal handling, see the unix_events sub-module. 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]: def can_write_eof(self) -> Literal[False]:
"""Return True if this transport supports write_eof(), False if not.""" """Return True if this transport supports write_eof(), False if not."""
if sys.version_info >= (3, 11): if sys.version_info >= (3, 11):
def get_write_buffer_limits(self) -> tuple[int, int]: 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_read_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: 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. """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 collections.abc import Awaitable, Callable, Iterable
from typing import Any from typing import Any

View file

@ -329,12 +329,6 @@ class StreamReader:
If the data cannot be read because of over limit, a If the data cannot be read because of over limit, a
LimitOverrunError exception will be raised, and the data LimitOverrunError exception will be raised, and the data
will be left in the internal buffer, so it can be read again. 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: 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 concurrent.futures
import sys 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 collections.abc import Callable
from typing import TypeVar 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 collections.abc import Iterable
from enum import Enum from enum import Enum

View file

@ -1,6 +1,4 @@
""" """Abstract Transport class."""
Abstract Transport class.
"""
from asyncio.events import AbstractEventLoop from asyncio.events import AbstractEventLoop
from asyncio.protocols import BaseProtocol 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 sys
import types 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 socket
import sys import sys

View file

@ -1,6 +1,4 @@
""" """Various Windows specific bits and pieces."""
Various Windows specific bits and pieces.
"""
import subprocess import subprocess
import sys 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 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 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. upon normal program termination.
Two public functions, register and unregister, are defined. 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 import sys
from _typeshed import ReadableBuffer from _typeshed import ReadableBuffer

View file

@ -1,6 +1,4 @@
""" """Debugger basics"""
Debugger basics
"""
import sys import sys
from _typeshed import ExcInfo, TraceFunction, Unused 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 import sys
from _typeshed import ReadableBuffer from _typeshed import ReadableBuffer

View file

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

View file

@ -1,6 +1,4 @@
""" """Bisection algorithms."""
Bisection algorithms.
"""
from _bisect import * 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' This module provides direct access to all 'built-in'
identifiers of Python; for example, builtins.len is identifiers of Python; for example, builtins.len is
@ -459,14 +458,13 @@ class int:
length length
Length of bytes object to use. An OverflowError is raised if the Length of bytes object to use. An OverflowError is raised if the
integer is not representable with the given number of bytes. Default integer is not representable with the given number of bytes.
is length 1.
byteorder byteorder
The byte order used to represent the integer. If byteorder is 'big', 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 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 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 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 signed
Determines whether two's complement is used to represent the integer. Determines whether two's complement is used to represent the integer.
If signed is False and a negative integer is given, an OverflowError 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 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 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 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 signed
Indicates whether two's complement is used to represent the integer. Indicates whether two's complement is used to represent the integer.
""" """
@ -2510,13 +2508,11 @@ class memoryview(Sequence[_I]):
""" """
else: else:
def tobytes(self, order: Literal["C", "F", "A"] | None = None) -> bytes: def tobytes(self, order: Literal["C", "F", "A"] | None = None) -> bytes:
"""Return the data in the buffer as a byte string. """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
Order can be {'C', 'F', 'A'}. When order is 'C' or 'F', the data of the Fortran order. For contiguous views, 'A' returns an exact copy of the physical
original array is converted to C or Fortran order. For contiguous views, memory. In particular, in-memory Fortran order is preserved. For non-contiguous
'A' returns an exact copy of the physical memory. In particular, in-memory views, the data is converted to C first. order=None is the same as order='C'.
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]: 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 This module provides a file interface, classes for incremental
(de)compression, and functions for one-shot (de)compression. (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. 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 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 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 This module defines a number of utilities for use by CGI scripts
written in Python. 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: 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 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(). 3-item tuple (etype, evalue, etb) just like the value of sys.exc_info().
The default handler displays output as HTML. The default handler displays output as HTML.
""" """
from _typeshed import OptExcInfo, StrOrBytesPath 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 An IFF chunk (used in formats such as AIFF, TIFF, RMFF (RealMedia File
Format)) has the following structure: 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. 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: 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 import sys
from codeop import CommandCompiler, compile_command as compile_command 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). Written by Marc-Andre Lemburg (mal@lemburg.com).
(c) Copyright CNRI, All Rights Reserved. NO WARRANTY. (c) Copyright CNRI, All Rights Reserved. NO WARRANTY.
""" """
import types 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 This module provides two interfaces, broadly similar to the builtin
function compile(), which take program text, a filename and a 'mode' 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, alternatives to Python's general purpose built-in containers, dict,
list, set, and tuple. list, set, and tuple.
@ -12,6 +11,7 @@ list, set, and tuple.
* UserDict wrapper around dictionary objects for easier dict subclassing * UserDict wrapper around dictionary objects for easier dict subclassing
* UserList wrapper around list objects for easier list subclassing * UserList wrapper around list objects for easier list subclassing
* UserString wrapper around string objects for easier string subclassing * UserString wrapper around string objects for easier string subclassing
""" """
import sys import sys
@ -143,9 +143,7 @@ class UserDict(MutableMapping[_KT, _VT]):
def __ior__(self, other: Iterable[tuple[_KT, _VT]]) -> Self: ... def __ior__(self, other: Iterable[tuple[_KT, _VT]]) -> Self: ...
if sys.version_info >= (3, 12): if sys.version_info >= (3, 12):
@overload @overload
def get(self, key: _KT, default: None = None) -> _VT | None: 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."""
@overload @overload
def get(self, key: _KT, default: _VT) -> _VT: ... def get(self, key: _KT, default: _VT) -> _VT: ...
@overload @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. Unit tests are in test_collections.
""" """

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