[ty] Sync vendored typeshed stubs (#20031)
Some checks are pending
CI / Determine changes (push) Waiting to run
CI / cargo fmt (push) Waiting to run
CI / cargo clippy (push) Blocked by required conditions
CI / cargo test (linux) (push) Blocked by required conditions
CI / cargo test (linux, release) (push) Blocked by required conditions
CI / cargo test (windows) (push) Blocked by required conditions
CI / cargo test (wasm) (push) Blocked by required conditions
CI / cargo build (release) (push) Waiting to run
CI / cargo build (msrv) (push) Blocked by required conditions
CI / cargo fuzz build (push) Blocked by required conditions
CI / fuzz parser (push) Blocked by required conditions
CI / test scripts (push) Blocked by required conditions
CI / ecosystem (push) Blocked by required conditions
CI / Fuzz for new ty panics (push) Blocked by required conditions
CI / cargo shear (push) Blocked by required conditions
CI / python package (push) Waiting to run
CI / pre-commit (push) Waiting to run
CI / mkdocs (push) Waiting to run
CI / formatter instabilities and black similarity (push) Blocked by required conditions
CI / test ruff-lsp (push) Blocked by required conditions
CI / check playground (push) Blocked by required conditions
CI / benchmarks-instrumented (push) Blocked by required conditions
CI / benchmarks-walltime (push) Blocked by required conditions
[ty Playground] Release / publish (push) Waiting to run

Co-authored-by: typeshedbot <>
Co-authored-by: Alex Waygood <alex.waygood@gmail.com>
This commit is contained in:
github-actions[bot] 2025-08-21 21:32:48 +00:00 committed by GitHub
parent f82025d919
commit 7a44ea680e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
147 changed files with 2478 additions and 2031 deletions

View file

@ -91,14 +91,14 @@ error[missing-argument]: No argument provided for required parameter `arg` of bo
7 | from typing_extensions import deprecated 7 | from typing_extensions import deprecated
| |
info: Parameter declared here info: Parameter declared here
--> stdlib/typing_extensions.pyi:967:28 --> stdlib/typing_extensions.pyi:973:28
| |
965 | stacklevel: int 971 | stacklevel: int
966 | def __init__(self, message: LiteralString, /, *, category: type[Warning] | None = ..., stacklevel: int = 1) -> None: ... 972 | def __init__(self, message: LiteralString, /, *, category: type[Warning] | None = ..., stacklevel: int = 1) -> None: ...
967 | def __call__(self, arg: _T, /) -> _T: ... 973 | def __call__(self, arg: _T, /) -> _T: ...
| ^^^^^^^ | ^^^^^^^
968 | 974 |
969 | @final 975 | @final
| |
info: rule `missing-argument` is enabled by default info: rule `missing-argument` is enabled by default

View file

@ -4680,20 +4680,11 @@ impl<'db, 'ast> TypeInferenceBuilder<'db, 'ast> {
} }
// Handle various singletons. // Handle various singletons.
if let Type::NominalInstance(instance) = declared.inner_type() { if let Some(name_expr) = target.as_name_expr() {
if instance if let Some(special_form) =
.class(self.db()) SpecialFormType::try_from_file_and_name(self.db(), self.file(), &name_expr.id)
.is_known(self.db(), KnownClass::SpecialForm)
{ {
if let Some(name_expr) = target.as_name_expr() { declared.inner = Type::SpecialForm(special_form);
if let Some(special_form) = SpecialFormType::try_from_file_and_name(
self.db(),
self.file(),
&name_expr.id,
) {
declared.inner = Type::SpecialForm(special_form);
}
}
} }
} }

View file

@ -154,9 +154,10 @@ impl SpecialFormType {
| Self::Intersection | Self::Intersection
| Self::CallableTypeOf | Self::CallableTypeOf
| Self::Protocol // actually `_ProtocolMeta` at runtime but this is what typeshed says | Self::Protocol // actually `_ProtocolMeta` at runtime but this is what typeshed says
| Self::Generic // actually `type` at runtime but this is what typeshed says
| Self::ReadOnly => KnownClass::SpecialForm, | Self::ReadOnly => KnownClass::SpecialForm,
Self::Generic => KnownClass::Type,
Self::List Self::List
| Self::Dict | Self::Dict
| Self::DefaultDict | Self::DefaultDict

View file

@ -1 +1 @@
893b9a760deb3be64d13c748318e95a752230961 f32d9f08bde8e42a3a35c050839d0275979eb3af

View file

@ -108,7 +108,7 @@ from ast import (
unaryop as unaryop, unaryop as unaryop,
withitem as withitem, withitem as withitem,
) )
from typing import Literal from typing import Final
if sys.version_info >= (3, 12): if sys.version_info >= (3, 12):
from ast import ( from ast import (
@ -137,9 +137,9 @@ if sys.version_info >= (3, 10):
pattern as pattern, pattern as pattern,
) )
PyCF_ALLOW_TOP_LEVEL_AWAIT: Literal[8192] PyCF_ALLOW_TOP_LEVEL_AWAIT: Final = 8192
PyCF_ONLY_AST: Literal[1024] PyCF_ONLY_AST: Final = 1024
PyCF_TYPE_COMMENTS: Literal[4096] PyCF_TYPE_COMMENTS: Final = 4096
if sys.version_info >= (3, 13): if sys.version_info >= (3, 13):
PyCF_OPTIMIZED_AST: Literal[33792] PyCF_OPTIMIZED_AST: Final = 33792

View file

@ -1,17 +1,17 @@
"""_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, final
from typing_extensions import Self from typing_extensions import Self
BLAKE2B_MAX_DIGEST_SIZE: int = 64 BLAKE2B_MAX_DIGEST_SIZE: Final = 64
BLAKE2B_MAX_KEY_SIZE: int = 64 BLAKE2B_MAX_KEY_SIZE: Final = 64
BLAKE2B_PERSON_SIZE: int = 16 BLAKE2B_PERSON_SIZE: Final = 16
BLAKE2B_SALT_SIZE: int = 16 BLAKE2B_SALT_SIZE: Final = 16
BLAKE2S_MAX_DIGEST_SIZE: int = 32 BLAKE2S_MAX_DIGEST_SIZE: Final = 32
BLAKE2S_MAX_KEY_SIZE: int = 32 BLAKE2S_MAX_KEY_SIZE: Final = 32
BLAKE2S_PERSON_SIZE: int = 8 BLAKE2S_PERSON_SIZE: Final = 8
BLAKE2S_SALT_SIZE: int = 8 BLAKE2S_SALT_SIZE: Final = 8
@final @final
class blake2b: class blake2b:

View file

@ -116,5 +116,6 @@ class dict_items(ItemsView[_KT_co, _VT_co]): # undocumented
if sys.version_info >= (3, 12): if sys.version_info >= (3, 12):
@runtime_checkable @runtime_checkable
class Buffer(Protocol): class Buffer(Protocol):
__slots__ = ()
@abstractmethod @abstractmethod
def __buffer__(self, flags: int, /) -> memoryview: ... def __buffer__(self, flags: int, /) -> memoryview: ...

View file

@ -1,8 +1,10 @@
IMPORT_MAPPING: dict[str, str] from typing import Final
NAME_MAPPING: dict[tuple[str, str], tuple[str, str]]
PYTHON2_EXCEPTIONS: tuple[str, ...] IMPORT_MAPPING: Final[dict[str, str]]
MULTIPROCESSING_EXCEPTIONS: tuple[str, ...] NAME_MAPPING: Final[dict[tuple[str, str], tuple[str, str]]]
REVERSE_IMPORT_MAPPING: dict[str, str] PYTHON2_EXCEPTIONS: Final[tuple[str, ...]]
REVERSE_NAME_MAPPING: dict[tuple[str, str], tuple[str, str]] MULTIPROCESSING_EXCEPTIONS: Final[tuple[str, ...]]
PYTHON3_OSERROR_EXCEPTIONS: tuple[str, ...] REVERSE_IMPORT_MAPPING: Final[dict[str, str]]
PYTHON3_IMPORTERROR_EXCEPTIONS: tuple[str, ...] REVERSE_NAME_MAPPING: Final[dict[tuple[str, str], tuple[str, str]]]
PYTHON3_OSERROR_EXCEPTIONS: Final[tuple[str, ...]]
PYTHON3_IMPORTERROR_EXCEPTIONS: Final[tuple[str, ...]]

View file

@ -7,24 +7,24 @@ from abc import abstractmethod
from collections.abc import Callable, Iterable, Iterator, Mapping, Sequence from collections.abc import Callable, Iterable, Iterator, Mapping, Sequence
from ctypes import CDLL, ArgumentError as ArgumentError, c_void_p from ctypes import CDLL, ArgumentError as ArgumentError, c_void_p
from types import GenericAlias from types import GenericAlias
from typing import Any, ClassVar, Generic, TypeVar, final, overload, type_check_only from typing import Any, ClassVar, Final, Generic, TypeVar, final, overload, type_check_only
from typing_extensions import Self, TypeAlias from typing_extensions import Self, TypeAlias
_T = TypeVar("_T") _T = TypeVar("_T")
_CT = TypeVar("_CT", bound=_CData) _CT = TypeVar("_CT", bound=_CData)
FUNCFLAG_CDECL: int FUNCFLAG_CDECL: Final = 0x1
FUNCFLAG_PYTHONAPI: int FUNCFLAG_PYTHONAPI: Final = 0x4
FUNCFLAG_USE_ERRNO: int FUNCFLAG_USE_ERRNO: Final = 0x8
FUNCFLAG_USE_LASTERROR: int FUNCFLAG_USE_LASTERROR: Final = 0x10
RTLD_GLOBAL: int RTLD_GLOBAL: Final[int]
RTLD_LOCAL: int RTLD_LOCAL: Final[int]
if sys.version_info >= (3, 11): if sys.version_info >= (3, 11):
CTYPES_MAX_ARGCOUNT: int CTYPES_MAX_ARGCOUNT: Final[int]
if sys.version_info >= (3, 12): if sys.version_info >= (3, 12):
SIZEOF_TIME_T: int SIZEOF_TIME_T: Final[int]
if sys.platform == "win32": if sys.platform == "win32":
# Description, Source, HelpFile, HelpContext, scode # Description, Source, HelpFile, HelpContext, scode
@ -41,8 +41,8 @@ if sys.platform == "win32":
def CopyComPointer(src: _PointerLike, dst: _PointerLike | _CArgObject) -> int: def CopyComPointer(src: _PointerLike, dst: _PointerLike | _CArgObject) -> int:
"""CopyComPointer(src, dst) -> HRESULT value""" """CopyComPointer(src, dst) -> HRESULT value"""
FUNCFLAG_HRESULT: int FUNCFLAG_HRESULT: Final = 0x2
FUNCFLAG_STDCALL: int FUNCFLAG_STDCALL: Final = 0x0
def FormatError(code: int = ...) -> str: def FormatError(code: int = ...) -> str:
"""FormatError([integer]) -> string """FormatError([integer]) -> string

View file

@ -1,7 +1,7 @@
import sys import sys
from _typeshed import ReadOnlyBuffer, SupportsRead, SupportsWrite from _typeshed import ReadOnlyBuffer, SupportsRead, SupportsWrite
from curses import _ncurses_version from curses import _ncurses_version
from typing import Any, final, overload from typing import Any, Final, final, overload
from typing_extensions import TypeAlias from typing_extensions import TypeAlias
# NOTE: This module is ordinarily only available on Unix, but the windows-curses # NOTE: This module is ordinarily only available on Unix, but the windows-curses
@ -11,270 +11,270 @@ from typing_extensions import TypeAlias
_ChType: TypeAlias = str | bytes | int _ChType: TypeAlias = str | bytes | int
# ACS codes are only initialized after initscr is called # ACS codes are only initialized after initscr is called
ACS_BBSS: int ACS_BBSS: Final[int]
ACS_BLOCK: int ACS_BLOCK: Final[int]
ACS_BOARD: int ACS_BOARD: Final[int]
ACS_BSBS: int ACS_BSBS: Final[int]
ACS_BSSB: int ACS_BSSB: Final[int]
ACS_BSSS: int ACS_BSSS: Final[int]
ACS_BTEE: int ACS_BTEE: Final[int]
ACS_BULLET: int ACS_BULLET: Final[int]
ACS_CKBOARD: int ACS_CKBOARD: Final[int]
ACS_DARROW: int ACS_DARROW: Final[int]
ACS_DEGREE: int ACS_DEGREE: Final[int]
ACS_DIAMOND: int ACS_DIAMOND: Final[int]
ACS_GEQUAL: int ACS_GEQUAL: Final[int]
ACS_HLINE: int ACS_HLINE: Final[int]
ACS_LANTERN: int ACS_LANTERN: Final[int]
ACS_LARROW: int ACS_LARROW: Final[int]
ACS_LEQUAL: int ACS_LEQUAL: Final[int]
ACS_LLCORNER: int ACS_LLCORNER: Final[int]
ACS_LRCORNER: int ACS_LRCORNER: Final[int]
ACS_LTEE: int ACS_LTEE: Final[int]
ACS_NEQUAL: int ACS_NEQUAL: Final[int]
ACS_PI: int ACS_PI: Final[int]
ACS_PLMINUS: int ACS_PLMINUS: Final[int]
ACS_PLUS: int ACS_PLUS: Final[int]
ACS_RARROW: int ACS_RARROW: Final[int]
ACS_RTEE: int ACS_RTEE: Final[int]
ACS_S1: int ACS_S1: Final[int]
ACS_S3: int ACS_S3: Final[int]
ACS_S7: int ACS_S7: Final[int]
ACS_S9: int ACS_S9: Final[int]
ACS_SBBS: int ACS_SBBS: Final[int]
ACS_SBSB: int ACS_SBSB: Final[int]
ACS_SBSS: int ACS_SBSS: Final[int]
ACS_SSBB: int ACS_SSBB: Final[int]
ACS_SSBS: int ACS_SSBS: Final[int]
ACS_SSSB: int ACS_SSSB: Final[int]
ACS_SSSS: int ACS_SSSS: Final[int]
ACS_STERLING: int ACS_STERLING: Final[int]
ACS_TTEE: int ACS_TTEE: Final[int]
ACS_UARROW: int ACS_UARROW: Final[int]
ACS_ULCORNER: int ACS_ULCORNER: Final[int]
ACS_URCORNER: int ACS_URCORNER: Final[int]
ACS_VLINE: int ACS_VLINE: Final[int]
ALL_MOUSE_EVENTS: int ALL_MOUSE_EVENTS: Final[int]
A_ALTCHARSET: int A_ALTCHARSET: Final[int]
A_ATTRIBUTES: int A_ATTRIBUTES: Final[int]
A_BLINK: int A_BLINK: Final[int]
A_BOLD: int A_BOLD: Final[int]
A_CHARTEXT: int A_CHARTEXT: Final[int]
A_COLOR: int A_COLOR: Final[int]
A_DIM: int A_DIM: Final[int]
A_HORIZONTAL: int A_HORIZONTAL: Final[int]
A_INVIS: int A_INVIS: Final[int]
A_ITALIC: int A_ITALIC: Final[int]
A_LEFT: int A_LEFT: Final[int]
A_LOW: int A_LOW: Final[int]
A_NORMAL: int A_NORMAL: Final[int]
A_PROTECT: int A_PROTECT: Final[int]
A_REVERSE: int A_REVERSE: Final[int]
A_RIGHT: int A_RIGHT: Final[int]
A_STANDOUT: int A_STANDOUT: Final[int]
A_TOP: int A_TOP: Final[int]
A_UNDERLINE: int A_UNDERLINE: Final[int]
A_VERTICAL: int A_VERTICAL: Final[int]
BUTTON1_CLICKED: int BUTTON1_CLICKED: Final[int]
BUTTON1_DOUBLE_CLICKED: int BUTTON1_DOUBLE_CLICKED: Final[int]
BUTTON1_PRESSED: int BUTTON1_PRESSED: Final[int]
BUTTON1_RELEASED: int BUTTON1_RELEASED: Final[int]
BUTTON1_TRIPLE_CLICKED: int BUTTON1_TRIPLE_CLICKED: Final[int]
BUTTON2_CLICKED: int BUTTON2_CLICKED: Final[int]
BUTTON2_DOUBLE_CLICKED: int BUTTON2_DOUBLE_CLICKED: Final[int]
BUTTON2_PRESSED: int BUTTON2_PRESSED: Final[int]
BUTTON2_RELEASED: int BUTTON2_RELEASED: Final[int]
BUTTON2_TRIPLE_CLICKED: int BUTTON2_TRIPLE_CLICKED: Final[int]
BUTTON3_CLICKED: int BUTTON3_CLICKED: Final[int]
BUTTON3_DOUBLE_CLICKED: int BUTTON3_DOUBLE_CLICKED: Final[int]
BUTTON3_PRESSED: int BUTTON3_PRESSED: Final[int]
BUTTON3_RELEASED: int BUTTON3_RELEASED: Final[int]
BUTTON3_TRIPLE_CLICKED: int BUTTON3_TRIPLE_CLICKED: Final[int]
BUTTON4_CLICKED: int BUTTON4_CLICKED: Final[int]
BUTTON4_DOUBLE_CLICKED: int BUTTON4_DOUBLE_CLICKED: Final[int]
BUTTON4_PRESSED: int BUTTON4_PRESSED: Final[int]
BUTTON4_RELEASED: int BUTTON4_RELEASED: Final[int]
BUTTON4_TRIPLE_CLICKED: int BUTTON4_TRIPLE_CLICKED: Final[int]
# Darwin ncurses doesn't provide BUTTON5_* constants prior to 3.12.10 and 3.13.3 # Darwin ncurses doesn't provide BUTTON5_* constants prior to 3.12.10 and 3.13.3
if sys.version_info >= (3, 10): if sys.version_info >= (3, 10):
if sys.version_info >= (3, 12) or sys.platform != "darwin": if sys.version_info >= (3, 12) or sys.platform != "darwin":
BUTTON5_PRESSED: int BUTTON5_PRESSED: Final[int]
BUTTON5_RELEASED: int BUTTON5_RELEASED: Final[int]
BUTTON5_CLICKED: int BUTTON5_CLICKED: Final[int]
BUTTON5_DOUBLE_CLICKED: int BUTTON5_DOUBLE_CLICKED: Final[int]
BUTTON5_TRIPLE_CLICKED: int BUTTON5_TRIPLE_CLICKED: Final[int]
BUTTON_ALT: int BUTTON_ALT: Final[int]
BUTTON_CTRL: int BUTTON_CTRL: Final[int]
BUTTON_SHIFT: int BUTTON_SHIFT: Final[int]
COLOR_BLACK: int COLOR_BLACK: Final[int]
COLOR_BLUE: int COLOR_BLUE: Final[int]
COLOR_CYAN: int COLOR_CYAN: Final[int]
COLOR_GREEN: int COLOR_GREEN: Final[int]
COLOR_MAGENTA: int COLOR_MAGENTA: Final[int]
COLOR_RED: int COLOR_RED: Final[int]
COLOR_WHITE: int COLOR_WHITE: Final[int]
COLOR_YELLOW: int COLOR_YELLOW: Final[int]
ERR: int ERR: Final[int]
KEY_A1: int KEY_A1: Final[int]
KEY_A3: int KEY_A3: Final[int]
KEY_B2: int KEY_B2: Final[int]
KEY_BACKSPACE: int KEY_BACKSPACE: Final[int]
KEY_BEG: int KEY_BEG: Final[int]
KEY_BREAK: int KEY_BREAK: Final[int]
KEY_BTAB: int KEY_BTAB: Final[int]
KEY_C1: int KEY_C1: Final[int]
KEY_C3: int KEY_C3: Final[int]
KEY_CANCEL: int KEY_CANCEL: Final[int]
KEY_CATAB: int KEY_CATAB: Final[int]
KEY_CLEAR: int KEY_CLEAR: Final[int]
KEY_CLOSE: int KEY_CLOSE: Final[int]
KEY_COMMAND: int KEY_COMMAND: Final[int]
KEY_COPY: int KEY_COPY: Final[int]
KEY_CREATE: int KEY_CREATE: Final[int]
KEY_CTAB: int KEY_CTAB: Final[int]
KEY_DC: int KEY_DC: Final[int]
KEY_DL: int KEY_DL: Final[int]
KEY_DOWN: int KEY_DOWN: Final[int]
KEY_EIC: int KEY_EIC: Final[int]
KEY_END: int KEY_END: Final[int]
KEY_ENTER: int KEY_ENTER: Final[int]
KEY_EOL: int KEY_EOL: Final[int]
KEY_EOS: int KEY_EOS: Final[int]
KEY_EXIT: int KEY_EXIT: Final[int]
KEY_F0: int KEY_F0: Final[int]
KEY_F1: int KEY_F1: Final[int]
KEY_F10: int KEY_F10: Final[int]
KEY_F11: int KEY_F11: Final[int]
KEY_F12: int KEY_F12: Final[int]
KEY_F13: int KEY_F13: Final[int]
KEY_F14: int KEY_F14: Final[int]
KEY_F15: int KEY_F15: Final[int]
KEY_F16: int KEY_F16: Final[int]
KEY_F17: int KEY_F17: Final[int]
KEY_F18: int KEY_F18: Final[int]
KEY_F19: int KEY_F19: Final[int]
KEY_F2: int KEY_F2: Final[int]
KEY_F20: int KEY_F20: Final[int]
KEY_F21: int KEY_F21: Final[int]
KEY_F22: int KEY_F22: Final[int]
KEY_F23: int KEY_F23: Final[int]
KEY_F24: int KEY_F24: Final[int]
KEY_F25: int KEY_F25: Final[int]
KEY_F26: int KEY_F26: Final[int]
KEY_F27: int KEY_F27: Final[int]
KEY_F28: int KEY_F28: Final[int]
KEY_F29: int KEY_F29: Final[int]
KEY_F3: int KEY_F3: Final[int]
KEY_F30: int KEY_F30: Final[int]
KEY_F31: int KEY_F31: Final[int]
KEY_F32: int KEY_F32: Final[int]
KEY_F33: int KEY_F33: Final[int]
KEY_F34: int KEY_F34: Final[int]
KEY_F35: int KEY_F35: Final[int]
KEY_F36: int KEY_F36: Final[int]
KEY_F37: int KEY_F37: Final[int]
KEY_F38: int KEY_F38: Final[int]
KEY_F39: int KEY_F39: Final[int]
KEY_F4: int KEY_F4: Final[int]
KEY_F40: int KEY_F40: Final[int]
KEY_F41: int KEY_F41: Final[int]
KEY_F42: int KEY_F42: Final[int]
KEY_F43: int KEY_F43: Final[int]
KEY_F44: int KEY_F44: Final[int]
KEY_F45: int KEY_F45: Final[int]
KEY_F46: int KEY_F46: Final[int]
KEY_F47: int KEY_F47: Final[int]
KEY_F48: int KEY_F48: Final[int]
KEY_F49: int KEY_F49: Final[int]
KEY_F5: int KEY_F5: Final[int]
KEY_F50: int KEY_F50: Final[int]
KEY_F51: int KEY_F51: Final[int]
KEY_F52: int KEY_F52: Final[int]
KEY_F53: int KEY_F53: Final[int]
KEY_F54: int KEY_F54: Final[int]
KEY_F55: int KEY_F55: Final[int]
KEY_F56: int KEY_F56: Final[int]
KEY_F57: int KEY_F57: Final[int]
KEY_F58: int KEY_F58: Final[int]
KEY_F59: int KEY_F59: Final[int]
KEY_F6: int KEY_F6: Final[int]
KEY_F60: int KEY_F60: Final[int]
KEY_F61: int KEY_F61: Final[int]
KEY_F62: int KEY_F62: Final[int]
KEY_F63: int KEY_F63: Final[int]
KEY_F7: int KEY_F7: Final[int]
KEY_F8: int KEY_F8: Final[int]
KEY_F9: int KEY_F9: Final[int]
KEY_FIND: int KEY_FIND: Final[int]
KEY_HELP: int KEY_HELP: Final[int]
KEY_HOME: int KEY_HOME: Final[int]
KEY_IC: int KEY_IC: Final[int]
KEY_IL: int KEY_IL: Final[int]
KEY_LEFT: int KEY_LEFT: Final[int]
KEY_LL: int KEY_LL: Final[int]
KEY_MARK: int KEY_MARK: Final[int]
KEY_MAX: int KEY_MAX: Final[int]
KEY_MESSAGE: int KEY_MESSAGE: Final[int]
KEY_MIN: int KEY_MIN: Final[int]
KEY_MOUSE: int KEY_MOUSE: Final[int]
KEY_MOVE: int KEY_MOVE: Final[int]
KEY_NEXT: int KEY_NEXT: Final[int]
KEY_NPAGE: int KEY_NPAGE: Final[int]
KEY_OPEN: int KEY_OPEN: Final[int]
KEY_OPTIONS: int KEY_OPTIONS: Final[int]
KEY_PPAGE: int KEY_PPAGE: Final[int]
KEY_PREVIOUS: int KEY_PREVIOUS: Final[int]
KEY_PRINT: int KEY_PRINT: Final[int]
KEY_REDO: int KEY_REDO: Final[int]
KEY_REFERENCE: int KEY_REFERENCE: Final[int]
KEY_REFRESH: int KEY_REFRESH: Final[int]
KEY_REPLACE: int KEY_REPLACE: Final[int]
KEY_RESET: int KEY_RESET: Final[int]
KEY_RESIZE: int KEY_RESIZE: Final[int]
KEY_RESTART: int KEY_RESTART: Final[int]
KEY_RESUME: int KEY_RESUME: Final[int]
KEY_RIGHT: int KEY_RIGHT: Final[int]
KEY_SAVE: int KEY_SAVE: Final[int]
KEY_SBEG: int KEY_SBEG: Final[int]
KEY_SCANCEL: int KEY_SCANCEL: Final[int]
KEY_SCOMMAND: int KEY_SCOMMAND: Final[int]
KEY_SCOPY: int KEY_SCOPY: Final[int]
KEY_SCREATE: int KEY_SCREATE: Final[int]
KEY_SDC: int KEY_SDC: Final[int]
KEY_SDL: int KEY_SDL: Final[int]
KEY_SELECT: int KEY_SELECT: Final[int]
KEY_SEND: int KEY_SEND: Final[int]
KEY_SEOL: int KEY_SEOL: Final[int]
KEY_SEXIT: int KEY_SEXIT: Final[int]
KEY_SF: int KEY_SF: Final[int]
KEY_SFIND: int KEY_SFIND: Final[int]
KEY_SHELP: int KEY_SHELP: Final[int]
KEY_SHOME: int KEY_SHOME: Final[int]
KEY_SIC: int KEY_SIC: Final[int]
KEY_SLEFT: int KEY_SLEFT: Final[int]
KEY_SMESSAGE: int KEY_SMESSAGE: Final[int]
KEY_SMOVE: int KEY_SMOVE: Final[int]
KEY_SNEXT: int KEY_SNEXT: Final[int]
KEY_SOPTIONS: int KEY_SOPTIONS: Final[int]
KEY_SPREVIOUS: int KEY_SPREVIOUS: Final[int]
KEY_SPRINT: int KEY_SPRINT: Final[int]
KEY_SR: int KEY_SR: Final[int]
KEY_SREDO: int KEY_SREDO: Final[int]
KEY_SREPLACE: int KEY_SREPLACE: Final[int]
KEY_SRESET: int KEY_SRESET: Final[int]
KEY_SRIGHT: int KEY_SRIGHT: Final[int]
KEY_SRSUME: int KEY_SRSUME: Final[int]
KEY_SSAVE: int KEY_SSAVE: Final[int]
KEY_SSUSPEND: int KEY_SSUSPEND: Final[int]
KEY_STAB: int KEY_STAB: Final[int]
KEY_SUNDO: int KEY_SUNDO: Final[int]
KEY_SUSPEND: int KEY_SUSPEND: Final[int]
KEY_UNDO: int KEY_UNDO: Final[int]
KEY_UP: int KEY_UP: Final[int]
OK: int OK: Final[int]
REPORT_MOUSE_POSITION: int REPORT_MOUSE_POSITION: Final[int]
_C_API: Any _C_API: Any
version: bytes version: Final[bytes]
def baudrate() -> int: def baudrate() -> int:
"""Return the output speed of the terminal in bits per second.""" """Return the output speed of the terminal in bits per second."""
@ -947,7 +947,7 @@ class window: # undocumented
def attrset(self, attr: int, /) -> None: def attrset(self, attr: int, /) -> None:
"""Set the "background" set of attributes.""" """Set the "background" set of attributes."""
def bkgd(self, ch: _ChType, attr: int = ..., /) -> None: def bkgd(self, ch: _ChType, attr: int = 0, /) -> None:
"""Set the background property of the window. """Set the background property of the window.
ch ch
@ -956,7 +956,7 @@ class window: # undocumented
Background attributes. Background attributes.
""" """
def bkgdset(self, ch: _ChType, attr: int = ..., /) -> None: def bkgdset(self, ch: _ChType, attr: int = 0, /) -> None:
"""Set the window's background. """Set the window's background.
ch ch
@ -1085,7 +1085,7 @@ class window: # undocumented
@overload @overload
def derwin(self, nlines: int, ncols: int, begin_y: int, begin_x: int) -> window: ... def derwin(self, nlines: int, ncols: int, begin_y: int, begin_x: int) -> window: ...
def echochar(self, ch: _ChType, attr: int = ..., /) -> None: def echochar(self, ch: _ChType, attr: int = 0, /) -> None:
"""Add character ch with attribute attr, and refresh. """Add character ch with attribute attr, and refresh.
ch ch

View file

@ -1,8 +1,8 @@
from _curses import window from _curses import window
from typing import final from typing import Final, final
__version__: str __version__: Final[str]
version: str version: Final[str]
class error(Exception): ... class error(Exception): ...

View file

@ -1,7 +1,7 @@
import sys import sys
from _typeshed import ReadOnlyBuffer, StrOrBytesPath from _typeshed import ReadOnlyBuffer, StrOrBytesPath
from types import TracebackType from types import TracebackType
from typing import TypeVar, final, overload, type_check_only from typing import Final, TypeVar, final, overload, type_check_only
from typing_extensions import Self, TypeAlias from typing_extensions import Self, TypeAlias
if sys.platform != "win32": if sys.platform != "win32":
@ -10,7 +10,7 @@ if sys.platform != "win32":
_ValueType: TypeAlias = str | ReadOnlyBuffer _ValueType: TypeAlias = str | ReadOnlyBuffer
class error(OSError): ... class error(OSError): ...
library: str library: Final[str]
# Actual typename dbm, not exposed by the implementation # Actual typename dbm, not exposed by the implementation
@final @final

View file

@ -18,7 +18,7 @@ from _typeshed.importlib import LoaderProtocol
from collections.abc import Callable, Iterable, Iterator, Mapping, MutableSequence, Sequence from collections.abc import Callable, Iterable, Iterator, Mapping, MutableSequence, Sequence
from importlib.machinery import ModuleSpec from importlib.machinery import ModuleSpec
from importlib.metadata import DistributionFinder, PathDistribution from importlib.metadata import DistributionFinder, PathDistribution
from typing import Any, Literal from typing import Any, Final, Literal
from typing_extensions import Self, deprecated from typing_extensions import Self, deprecated
if sys.version_info >= (3, 10): if sys.version_info >= (3, 10):
@ -33,7 +33,7 @@ else:
path_sep: Literal["/"] path_sep: Literal["/"]
path_sep_tuple: tuple[Literal["/"]] path_sep_tuple: tuple[Literal["/"]]
MAGIC_NUMBER: bytes MAGIC_NUMBER: Final[bytes]
def cache_from_source(path: StrPath, debug_override: bool | None = None, *, optimization: Any | None = None) -> str: def cache_from_source(path: StrPath, debug_override: bool | None = None, *, optimization: Any | None = None) -> str:
"""Given the path to a .py file, return the path to its .pyc file. """Given the path to a .py file, return the path to its .pyc file.
@ -89,7 +89,7 @@ def spec_from_file_location(
""" """
@deprecated( @deprecated(
"Deprecated as of Python 3.6: Use site configuration instead. " "Deprecated since Python 3.6. Use site configuration instead. "
"Future versions of Python may not enable this finder by default." "Future versions of Python may not enable this finder by default."
) )
class WindowsRegistryFinder(importlib.abc.MetaPathFinder): class WindowsRegistryFinder(importlib.abc.MetaPathFinder):
@ -167,11 +167,11 @@ class PathFinder(importlib.abc.MetaPathFinder):
""" """
SOURCE_SUFFIXES: list[str] SOURCE_SUFFIXES: Final[list[str]]
DEBUG_BYTECODE_SUFFIXES: list[str] DEBUG_BYTECODE_SUFFIXES: Final = [".pyc"]
OPTIMIZED_BYTECODE_SUFFIXES: list[str] OPTIMIZED_BYTECODE_SUFFIXES: Final = [".pyc"]
BYTECODE_SUFFIXES: list[str] BYTECODE_SUFFIXES: Final = [".pyc"]
EXTENSION_SUFFIXES: list[str] EXTENSION_SUFFIXES: Final[list[str]]
class FileFinder(importlib.abc.PathEntryFinder): class FileFinder(importlib.abc.PathEntryFinder):
"""File-based finder. """File-based finder.
@ -365,7 +365,7 @@ if sys.version_info >= (3, 11):
"""Use default semantics for module creation.""" """Use default semantics for module creation."""
def exec_module(self, module: types.ModuleType) -> None: ... def exec_module(self, module: types.ModuleType) -> None: ...
@deprecated("load_module() is deprecated; use exec_module() instead") @deprecated("Deprecated since Python 3.10; will be removed in Python 3.15. Use `exec_module()` instead.")
def load_module(self, fullname: str) -> types.ModuleType: def load_module(self, fullname: str) -> types.ModuleType:
"""Load a namespace module. """Load a namespace module.
@ -400,14 +400,15 @@ else:
"""Use default semantics for module creation.""" """Use default semantics for module creation."""
def exec_module(self, module: types.ModuleType) -> None: ... def exec_module(self, module: types.ModuleType) -> None: ...
@deprecated("load_module() is deprecated; use exec_module() instead")
def load_module(self, fullname: str) -> types.ModuleType:
"""Load a namespace module.
This method is deprecated. Use exec_module() instead.
"""
if sys.version_info >= (3, 10): if sys.version_info >= (3, 10):
@deprecated("Deprecated since Python 3.10; will be removed in Python 3.15. Use `exec_module()` instead.")
def load_module(self, fullname: str) -> types.ModuleType:
"""Load a namespace module.
This method is deprecated. Use exec_module() instead.
"""
@staticmethod @staticmethod
@deprecated( @deprecated(
"Deprecated since Python 3.4; removed in Python 3.12. " "Deprecated since Python 3.4; removed in Python 3.12. "
@ -422,6 +423,13 @@ else:
def get_resource_reader(self, module: types.ModuleType) -> importlib.readers.NamespaceReader: ... def get_resource_reader(self, module: types.ModuleType) -> importlib.readers.NamespaceReader: ...
else: else:
def load_module(self, fullname: str) -> types.ModuleType:
"""Load a namespace module.
This method is deprecated. Use exec_module() instead.
"""
@classmethod @classmethod
@deprecated( @deprecated(
"Deprecated since Python 3.4; removed in Python 3.12. " "Deprecated since Python 3.4; removed in Python 3.12. "

View file

@ -4,7 +4,7 @@ The 'interpreters' module provides a more convenient interface.
import types import types
from collections.abc import Callable from collections.abc import Callable
from typing import Any, Final, Literal, SupportsIndex, TypeVar from typing import Any, Final, Literal, SupportsIndex, TypeVar, overload
from typing_extensions import TypeAlias from typing_extensions import TypeAlias
_R = TypeVar("_R") _R = TypeVar("_R")
@ -60,19 +60,19 @@ def destroy(id: SupportsIndex, *, restrict: bool = False) -> None:
So does an unrecognized ID. So does an unrecognized ID.
""" """
def list_all(*, require_ready: bool) -> list[tuple[int, int]]: def list_all(*, require_ready: bool = False) -> list[tuple[int, _Whence]]:
"""list_all() -> [(ID, whence)] """list_all() -> [(ID, whence)]
Return a list containing the ID of every existing interpreter. Return a list containing the ID of every existing interpreter.
""" """
def get_current() -> tuple[int, int]: def get_current() -> tuple[int, _Whence]:
"""get_current() -> (ID, whence) """get_current() -> (ID, whence)
Return the ID of current interpreter. Return the ID of current interpreter.
""" """
def get_main() -> tuple[int, int]: def get_main() -> tuple[int, _Whence]:
"""get_main() -> (ID, whence) """get_main() -> (ID, whence)
Return the ID of main interpreter. Return the ID of main interpreter.
@ -97,11 +97,7 @@ def whence(id: SupportsIndex) -> _Whence:
""" """
def exec( def exec(
id: SupportsIndex, id: SupportsIndex, code: str | types.CodeType | Callable[[], object], shared: _SharedDict = {}, *, restrict: bool = False
code: str | types.CodeType | Callable[[], object],
shared: _SharedDict | None = None,
*,
restrict: bool = False,
) -> None | types.SimpleNamespace: ) -> None | types.SimpleNamespace:
"""exec(id, code, shared=None, *, restrict=False) """exec(id, code, shared=None, *, restrict=False)
@ -123,9 +119,10 @@ def exec(
def call( def call(
id: SupportsIndex, id: SupportsIndex,
callable: Callable[..., _R], callable: Callable[..., _R],
args: tuple[Any, ...] | None = None, args: tuple[Any, ...] = (),
kwargs: dict[str, Any] | None = None, kwargs: dict[str, Any] = {},
*, *,
preserve_exc: bool = False,
restrict: bool = False, restrict: bool = False,
) -> tuple[_R, types.SimpleNamespace]: ) -> tuple[_R, types.SimpleNamespace]:
"""call(id, callable, args=None, kwargs=None, *, restrict=False) """call(id, callable, args=None, kwargs=None, *, restrict=False)
@ -135,11 +132,7 @@ def call(
""" """
def run_string( def run_string(
id: SupportsIndex, id: SupportsIndex, script: str | types.CodeType | Callable[[], object], shared: _SharedDict = {}, *, restrict: bool = False
script: str | types.CodeType | Callable[[], object],
shared: _SharedDict | None = None,
*,
restrict: bool = False,
) -> None: ) -> None:
"""run_string(id, script, shared=None, *, restrict=False) """run_string(id, script, shared=None, *, restrict=False)
@ -149,7 +142,7 @@ def run_string(
""" """
def run_func( def run_func(
id: SupportsIndex, func: types.CodeType | Callable[[], object], shared: _SharedDict | None = None, *, restrict: bool = False id: SupportsIndex, func: types.CodeType | Callable[[], object], shared: _SharedDict = {}, *, restrict: bool = False
) -> None: ) -> None:
"""run_func(id, func, shared=None, *, restrict=False) """run_func(id, func, shared=None, *, restrict=False)
@ -175,7 +168,8 @@ def is_shareable(obj: object) -> bool:
False otherwise. False otherwise.
""" """
def capture_exception(exc: BaseException | None = None) -> types.SimpleNamespace: @overload
def capture_exception(exc: BaseException) -> types.SimpleNamespace:
"""capture_exception(exc=None) -> types.SimpleNamespace """capture_exception(exc=None) -> types.SimpleNamespace
Return a snapshot of an exception. If "exc" is None Return a snapshot of an exception. If "exc" is None
@ -184,6 +178,9 @@ def capture_exception(exc: BaseException | None = None) -> types.SimpleNamespace
The returned snapshot is the same as what _interpreters.exec() returns. The returned snapshot is the same as what _interpreters.exec() returns.
""" """
@overload
def capture_exception(exc: None = None) -> types.SimpleNamespace | None: ...
_Whence: TypeAlias = Literal[0, 1, 2, 3, 4, 5] _Whence: TypeAlias = Literal[0, 1, 2, 3, 4, 5]
WHENCE_UNKNOWN: Final = 0 WHENCE_UNKNOWN: Final = 0
WHENCE_RUNTIME: Final = 1 WHENCE_RUNTIME: Final = 1

View file

@ -16,7 +16,7 @@ CHECK_CRC64: Final = 4
CHECK_SHA256: Final = 10 CHECK_SHA256: Final = 10
CHECK_ID_MAX: Final = 15 CHECK_ID_MAX: Final = 15
CHECK_UNKNOWN: Final = 16 CHECK_UNKNOWN: Final = 16
FILTER_LZMA1: int # v big number FILTER_LZMA1: Final[int] # v big number
FILTER_LZMA2: Final = 33 FILTER_LZMA2: Final = 33
FILTER_DELTA: Final = 3 FILTER_DELTA: Final = 3
FILTER_X86: Final = 4 FILTER_X86: Final = 4
@ -33,7 +33,7 @@ MF_BT4: Final = 20
MODE_FAST: Final = 1 MODE_FAST: Final = 1
MODE_NORMAL: Final = 2 MODE_NORMAL: Final = 2
PRESET_DEFAULT: Final = 6 PRESET_DEFAULT: Final = 6
PRESET_EXTREME: int # v big number PRESET_EXTREME: Final[int] # v big number
@final @final
class LZMADecompressor: class LZMADecompressor:

View file

@ -1,7 +1,7 @@
"""Documentation""" """Documentation"""
import sys import sys
from typing import type_check_only from typing import Final, type_check_only
if sys.platform == "win32": if sys.platform == "win32":
class MSIError(Exception): ... class MSIError(Exception): ...
@ -81,42 +81,42 @@ if sys.platform == "win32":
count count
the number of fields of the record the number of fields of the record
""" """
MSICOLINFO_NAMES: int MSICOLINFO_NAMES: Final[int]
MSICOLINFO_TYPES: int MSICOLINFO_TYPES: Final[int]
MSIDBOPEN_CREATE: int MSIDBOPEN_CREATE: Final[int]
MSIDBOPEN_CREATEDIRECT: int MSIDBOPEN_CREATEDIRECT: Final[int]
MSIDBOPEN_DIRECT: int MSIDBOPEN_DIRECT: Final[int]
MSIDBOPEN_PATCHFILE: int MSIDBOPEN_PATCHFILE: Final[int]
MSIDBOPEN_READONLY: int MSIDBOPEN_READONLY: Final[int]
MSIDBOPEN_TRANSACT: int MSIDBOPEN_TRANSACT: Final[int]
MSIMODIFY_ASSIGN: int MSIMODIFY_ASSIGN: Final[int]
MSIMODIFY_DELETE: int MSIMODIFY_DELETE: Final[int]
MSIMODIFY_INSERT: int MSIMODIFY_INSERT: Final[int]
MSIMODIFY_INSERT_TEMPORARY: int MSIMODIFY_INSERT_TEMPORARY: Final[int]
MSIMODIFY_MERGE: int MSIMODIFY_MERGE: Final[int]
MSIMODIFY_REFRESH: int MSIMODIFY_REFRESH: Final[int]
MSIMODIFY_REPLACE: int MSIMODIFY_REPLACE: Final[int]
MSIMODIFY_SEEK: int MSIMODIFY_SEEK: Final[int]
MSIMODIFY_UPDATE: int MSIMODIFY_UPDATE: Final[int]
MSIMODIFY_VALIDATE: int MSIMODIFY_VALIDATE: Final[int]
MSIMODIFY_VALIDATE_DELETE: int MSIMODIFY_VALIDATE_DELETE: Final[int]
MSIMODIFY_VALIDATE_FIELD: int MSIMODIFY_VALIDATE_FIELD: Final[int]
MSIMODIFY_VALIDATE_NEW: int MSIMODIFY_VALIDATE_NEW: Final[int]
PID_APPNAME: int PID_APPNAME: Final[int]
PID_AUTHOR: int PID_AUTHOR: Final[int]
PID_CHARCOUNT: int PID_CHARCOUNT: Final[int]
PID_CODEPAGE: int PID_CODEPAGE: Final[int]
PID_COMMENTS: int PID_COMMENTS: Final[int]
PID_CREATE_DTM: int PID_CREATE_DTM: Final[int]
PID_KEYWORDS: int PID_KEYWORDS: Final[int]
PID_LASTAUTHOR: int PID_LASTAUTHOR: Final[int]
PID_LASTPRINTED: int PID_LASTPRINTED: Final[int]
PID_LASTSAVE_DTM: int PID_LASTSAVE_DTM: Final[int]
PID_PAGECOUNT: int PID_PAGECOUNT: Final[int]
PID_REVNUMBER: int PID_REVNUMBER: Final[int]
PID_SECURITY: int PID_SECURITY: Final[int]
PID_SUBJECT: int PID_SUBJECT: Final[int]
PID_TEMPLATE: int PID_TEMPLATE: Final[int]
PID_TITLE: int PID_TITLE: Final[int]
PID_WORDCOUNT: int PID_WORDCOUNT: Final[int]

View file

@ -315,7 +315,7 @@ def stack_size(size: int = 0, /) -> int:
the suggested approach in the absence of more specific information). the suggested approach in the absence of more specific information).
""" """
TIMEOUT_MAX: float TIMEOUT_MAX: Final[float]
def get_native_id() -> int: # only available on some platforms def get_native_id() -> int: # only available on some platforms
"""Return a non-negative integer identifying the thread as reported """Return a non-negative integer identifying the thread as reported

View file

@ -17,6 +17,7 @@ _LocalDict: TypeAlias = dict[Any, Any]
class _localimpl: class _localimpl:
"""A class managing thread-local dicts""" """A class managing thread-local dicts"""
__slots__ = ("key", "dicts", "localargs", "locallock", "__weakref__")
key: str key: str
dicts: dict[int, tuple[ReferenceType[Any], _LocalDict]] dicts: dict[int, tuple[ReferenceType[Any], _LocalDict]]
# Keep localargs in sync with the *args, **kwargs annotation on local.__new__ # Keep localargs in sync with the *args, **kwargs annotation on local.__new__
@ -31,6 +32,7 @@ class _localimpl:
"""Create a new dict for the current thread, and return it.""" """Create a new dict for the current thread, and return it."""
class local: class local:
__slots__ = ("_local__impl", "__dict__")
def __new__(cls, /, *args: Any, **kw: Any) -> Self: ... def __new__(cls, /, *args: Any, **kw: Any) -> Self: ...
def __getattribute__(self, name: str) -> Any: ... def __getattribute__(self, name: str) -> Any: ...
def __setattr__(self, name: str, value: Any) -> None: ... def __setattr__(self, name: str, value: Any) -> None: ...

View file

@ -3,7 +3,7 @@
# See the README.md file in this directory for more information. # See the README.md file in this directory for more information.
import sys import sys
from collections.abc import Awaitable, Callable, Iterable, Sequence, Set as AbstractSet, Sized from collections.abc import Awaitable, Callable, Iterable, Iterator, Sequence, Set as AbstractSet, Sized
from dataclasses import Field from dataclasses import Field
from os import PathLike from os import PathLike
from types import FrameType, TracebackType from types import FrameType, TracebackType
@ -275,6 +275,16 @@ class SupportsWrite(Protocol[_T_contra]):
class SupportsFlush(Protocol): class SupportsFlush(Protocol):
def flush(self) -> object: ... def flush(self) -> object: ...
# Suitable for dictionary view objects
class Viewable(Protocol[_T_co]):
def __len__(self) -> int: ...
def __iter__(self) -> Iterator[_T_co]: ...
class SupportsGetItemViewable(Protocol[_KT, _VT_co]):
def __len__(self) -> int: ...
def __iter__(self) -> Iterator[_KT]: ...
def __getitem__(self, key: _KT, /) -> _VT_co: ...
# Unfortunately PEP 688 does not allow us to distinguish read-only # Unfortunately PEP 688 does not allow us to distinguish read-only
# from writable buffers. We use these aliases for readability for now. # from writable buffers. We use these aliases for readability for now.
# Perhaps a future extension of the buffer protocol will allow us to # Perhaps a future extension of the buffer protocol will allow us to

View file

@ -128,21 +128,21 @@ if sys.platform == "win32":
WAIT_TIMEOUT: Final = 258 WAIT_TIMEOUT: Final = 258
if sys.version_info >= (3, 10): if sys.version_info >= (3, 10):
LOCALE_NAME_INVARIANT: str LOCALE_NAME_INVARIANT: Final[str]
LOCALE_NAME_MAX_LENGTH: int LOCALE_NAME_MAX_LENGTH: Final[int]
LOCALE_NAME_SYSTEM_DEFAULT: str LOCALE_NAME_SYSTEM_DEFAULT: Final[str]
LOCALE_NAME_USER_DEFAULT: str | None LOCALE_NAME_USER_DEFAULT: Final[str | None]
LCMAP_FULLWIDTH: int LCMAP_FULLWIDTH: Final[int]
LCMAP_HALFWIDTH: int LCMAP_HALFWIDTH: Final[int]
LCMAP_HIRAGANA: int LCMAP_HIRAGANA: Final[int]
LCMAP_KATAKANA: int LCMAP_KATAKANA: Final[int]
LCMAP_LINGUISTIC_CASING: int LCMAP_LINGUISTIC_CASING: Final[int]
LCMAP_LOWERCASE: int LCMAP_LOWERCASE: Final[int]
LCMAP_SIMPLIFIED_CHINESE: int LCMAP_SIMPLIFIED_CHINESE: Final[int]
LCMAP_TITLECASE: int LCMAP_TITLECASE: Final[int]
LCMAP_TRADITIONAL_CHINESE: int LCMAP_TRADITIONAL_CHINESE: Final[int]
LCMAP_UPPERCASE: int LCMAP_UPPERCASE: Final[int]
if sys.version_info >= (3, 12): if sys.version_info >= (3, 12):
COPYFILE2_CALLBACK_CHUNK_STARTED: Final = 1 COPYFILE2_CALLBACK_CHUNK_STARTED: Final = 1

View file

@ -70,7 +70,7 @@ def abstractmethod(funcobj: _FuncT) -> _FuncT:
... ...
""" """
@deprecated("Use 'classmethod' with 'abstractmethod' instead") @deprecated("Deprecated since Python 3.3. Use `@classmethod` stacked on top of `@abstractmethod` instead.")
class abstractclassmethod(classmethod[_T, _P, _R_co]): class abstractclassmethod(classmethod[_T, _P, _R_co]):
"""A decorator indicating abstract classmethods. """A decorator indicating abstract classmethods.
@ -87,7 +87,7 @@ class abstractclassmethod(classmethod[_T, _P, _R_co]):
__isabstractmethod__: Literal[True] __isabstractmethod__: Literal[True]
def __init__(self, callable: Callable[Concatenate[type[_T], _P], _R_co]) -> None: ... def __init__(self, callable: Callable[Concatenate[type[_T], _P], _R_co]) -> None: ...
@deprecated("Use 'staticmethod' with 'abstractmethod' instead") @deprecated("Deprecated since Python 3.3. Use `@staticmethod` stacked on top of `@abstractmethod` instead.")
class abstractstaticmethod(staticmethod[_P, _R_co]): class abstractstaticmethod(staticmethod[_P, _R_co]):
"""A decorator indicating abstract staticmethods. """A decorator indicating abstract staticmethods.
@ -104,7 +104,7 @@ class abstractstaticmethod(staticmethod[_P, _R_co]):
__isabstractmethod__: Literal[True] __isabstractmethod__: Literal[True]
def __init__(self, callable: Callable[_P, _R_co]) -> None: ... def __init__(self, callable: Callable[_P, _R_co]) -> None: ...
@deprecated("Use 'property' with 'abstractmethod' instead") @deprecated("Deprecated since Python 3.3. Use `@property` stacked on top of `@abstractmethod` instead.")
class abstractproperty(property): class abstractproperty(property):
"""A decorator indicating abstract properties. """A decorator indicating abstract properties.

View file

@ -83,7 +83,7 @@ if sys.version_info >= (3, 14):
owner: object = None, owner: object = None,
format: Format = Format.VALUE, # noqa: Y011 format: Format = Format.VALUE, # noqa: Y011
) -> AnnotationForm: ... ) -> AnnotationForm: ...
@deprecated("Use ForwardRef.evaluate() or typing.evaluate_forward_ref() instead.") @deprecated("Use `ForwardRef.evaluate()` or `typing.evaluate_forward_ref()` instead.")
def _evaluate( def _evaluate(
self, self,
globalns: dict[str, Any] | None, globalns: dict[str, Any] | None,

View file

@ -669,7 +669,7 @@ class Namespace(_AttributeHolder):
__hash__: ClassVar[None] # type: ignore[assignment] __hash__: ClassVar[None] # type: ignore[assignment]
if sys.version_info >= (3, 14): if sys.version_info >= (3, 14):
@deprecated("Deprecated in Python 3.14; Simply open files after parsing arguments") @deprecated("Deprecated since Python 3.14. Open files after parsing arguments instead.")
class FileType: class FileType:
"""Deprecated factory for creating file object types """Deprecated factory for creating file object types

View file

@ -1332,20 +1332,20 @@ class Constant(expr):
if sys.version_info < (3, 14): if sys.version_info < (3, 14):
# Aliases for value, for backwards compatibility # Aliases for value, for backwards compatibility
@property @property
@deprecated("Will be removed in Python 3.14. Use `value` instead.") @deprecated("Removed in Python 3.14. Use `value` instead.")
def n(self) -> _ConstantValue: def n(self) -> _ConstantValue:
"""Deprecated. Use value instead.""" """Deprecated. Use value instead."""
@n.setter @n.setter
@deprecated("Will be removed in Python 3.14. Use `value` instead.") @deprecated("Removed in Python 3.14. Use `value` instead.")
def n(self, value: _ConstantValue) -> None: ... def n(self, value: _ConstantValue) -> None: ...
@property @property
@deprecated("Will be removed in Python 3.14. Use `value` instead.") @deprecated("Removed in Python 3.14. Use `value` instead.")
def s(self) -> _ConstantValue: def s(self) -> _ConstantValue:
"""Deprecated. Use value instead.""" """Deprecated. Use value instead."""
@s.setter @s.setter
@deprecated("Will be removed in Python 3.14. Use `value` instead.") @deprecated("Removed in Python 3.14. Use `value` instead.")
def s(self, value: _ConstantValue) -> None: ... def s(self, value: _ConstantValue) -> None: ...
def __init__(self, value: _ConstantValue, kind: str | None = None, **kwargs: Unpack[_Attributes]) -> None: ... def __init__(self, value: _ConstantValue, kind: str | None = None, **kwargs: Unpack[_Attributes]) -> None: ...
@ -1467,7 +1467,7 @@ class Slice(expr):
) -> Self: ) -> Self:
"""Return a copy of the AST node with new values for the specified fields.""" """Return a copy of the AST node with new values for the specified fields."""
@deprecated("Deprecated since Python 3.9. Use ast.Tuple instead.") @deprecated("Deprecated since Python 3.9. Use `ast.Tuple` instead.")
class ExtSlice(slice): class ExtSlice(slice):
"""Deprecated AST node class. Use ast.Tuple instead.""" """Deprecated AST node class. Use ast.Tuple instead."""
@ -2134,31 +2134,31 @@ else:
def __init__(cls, *args: Unused) -> None: ... def __init__(cls, *args: Unused) -> None: ...
if sys.version_info < (3, 14): if sys.version_info < (3, 14):
@deprecated("Replaced by ast.Constant; removed in Python 3.14") @deprecated("Removed in Python 3.14. Use `ast.Constant` instead.")
class Num(Constant, metaclass=_ABC): class Num(Constant, metaclass=_ABC):
"""Deprecated AST node class. Use ast.Constant instead""" """Deprecated AST node class. Use ast.Constant instead"""
def __new__(cls, n: complex, **kwargs: Unpack[_Attributes]) -> Constant: ... # type: ignore[misc] # pyright: ignore[reportInconsistentConstructor] def __new__(cls, n: complex, **kwargs: Unpack[_Attributes]) -> Constant: ... # type: ignore[misc] # pyright: ignore[reportInconsistentConstructor]
@deprecated("Replaced by ast.Constant; removed in Python 3.14") @deprecated("Removed in Python 3.14. Use `ast.Constant` instead.")
class Str(Constant, metaclass=_ABC): class Str(Constant, metaclass=_ABC):
"""Deprecated AST node class. Use ast.Constant instead""" """Deprecated AST node class. Use ast.Constant instead"""
def __new__(cls, s: str, **kwargs: Unpack[_Attributes]) -> Constant: ... # type: ignore[misc] # pyright: ignore[reportInconsistentConstructor] def __new__(cls, s: str, **kwargs: Unpack[_Attributes]) -> Constant: ... # type: ignore[misc] # pyright: ignore[reportInconsistentConstructor]
@deprecated("Replaced by ast.Constant; removed in Python 3.14") @deprecated("Removed in Python 3.14. Use `ast.Constant` instead.")
class Bytes(Constant, metaclass=_ABC): class Bytes(Constant, metaclass=_ABC):
"""Deprecated AST node class. Use ast.Constant instead""" """Deprecated AST node class. Use ast.Constant instead"""
def __new__(cls, s: bytes, **kwargs: Unpack[_Attributes]) -> Constant: ... # type: ignore[misc] # pyright: ignore[reportInconsistentConstructor] def __new__(cls, s: bytes, **kwargs: Unpack[_Attributes]) -> Constant: ... # type: ignore[misc] # pyright: ignore[reportInconsistentConstructor]
@deprecated("Replaced by ast.Constant; removed in Python 3.14") @deprecated("Removed in Python 3.14. Use `ast.Constant` instead.")
class NameConstant(Constant, metaclass=_ABC): class NameConstant(Constant, metaclass=_ABC):
"""Deprecated AST node class. Use ast.Constant instead""" """Deprecated AST node class. Use ast.Constant instead"""
def __new__(cls, value: _ConstantValue, kind: str | None, **kwargs: Unpack[_Attributes]) -> Constant: ... # type: ignore[misc] # pyright: ignore[reportInconsistentConstructor] def __new__(cls, value: _ConstantValue, kind: str | None, **kwargs: Unpack[_Attributes]) -> Constant: ... # type: ignore[misc] # pyright: ignore[reportInconsistentConstructor]
@deprecated("Replaced by ast.Constant; removed in Python 3.14") @deprecated("Removed in Python 3.14. Use `ast.Constant` instead.")
class Ellipsis(Constant, metaclass=_ABC): class Ellipsis(Constant, metaclass=_ABC):
"""Deprecated AST node class. Use ast.Constant instead""" """Deprecated AST node class. Use ast.Constant instead"""
@ -2605,15 +2605,15 @@ class NodeVisitor:
def visit_Param(self, node: Param) -> Any: ... def visit_Param(self, node: Param) -> Any: ...
if sys.version_info < (3, 14): if sys.version_info < (3, 14):
@deprecated("Replaced by visit_Constant; removed in Python 3.14") @deprecated("Removed in Python 3.14. Use `visit_Constant` instead.")
def visit_Num(self, node: Num) -> Any: ... # type: ignore[deprecated] def visit_Num(self, node: Num) -> Any: ... # type: ignore[deprecated]
@deprecated("Replaced by visit_Constant; removed in Python 3.14") @deprecated("Removed in Python 3.14. Use `visit_Constant` instead.")
def visit_Str(self, node: Str) -> Any: ... # type: ignore[deprecated] def visit_Str(self, node: Str) -> Any: ... # type: ignore[deprecated]
@deprecated("Replaced by visit_Constant; removed in Python 3.14") @deprecated("Removed in Python 3.14. Use `visit_Constant` instead.")
def visit_Bytes(self, node: Bytes) -> Any: ... # type: ignore[deprecated] def visit_Bytes(self, node: Bytes) -> Any: ... # type: ignore[deprecated]
@deprecated("Replaced by visit_Constant; removed in Python 3.14") @deprecated("Removed in Python 3.14. Use `visit_Constant` instead.")
def visit_NameConstant(self, node: NameConstant) -> Any: ... # type: ignore[deprecated] def visit_NameConstant(self, node: NameConstant) -> Any: ... # type: ignore[deprecated]
@deprecated("Replaced by visit_Constant; removed in Python 3.14") @deprecated("Removed in Python 3.14. Use `visit_Constant` instead.")
def visit_Ellipsis(self, node: Ellipsis) -> Any: ... # type: ignore[deprecated] def visit_Ellipsis(self, node: Ellipsis) -> Any: ... # type: ignore[deprecated]
class NodeTransformer(NodeVisitor): class NodeTransformer(NodeVisitor):

View file

@ -77,6 +77,7 @@ class _TaskFactory(Protocol):
class Handle: class Handle:
"""Object returned by callback registration methods.""" """Object returned by callback registration methods."""
__slots__ = ("_callback", "_args", "_cancelled", "_loop", "_source_traceback", "_repr", "__weakref__", "_context")
_cancelled: bool _cancelled: bool
_args: Sequence[Any] _args: Sequence[Any]
def __init__( def __init__(
@ -91,6 +92,7 @@ class Handle:
class TimerHandle(Handle): class TimerHandle(Handle):
"""Object returned by timed callback registration methods.""" """Object returned by timed callback registration methods."""
__slots__ = ["_scheduled", "_when"]
def __init__( def __init__(
self, self,
when: float, when: float,
@ -968,10 +970,10 @@ class _AbstractEventLoopPolicy:
if sys.version_info < (3, 14): if sys.version_info < (3, 14):
if sys.version_info >= (3, 12): if sys.version_info >= (3, 12):
@abstractmethod @abstractmethod
@deprecated("Deprecated as of Python 3.12; will be removed in Python 3.14") @deprecated("Deprecated since Python 3.12; removed in Python 3.14.")
def get_child_watcher(self) -> AbstractChildWatcher: ... def get_child_watcher(self) -> AbstractChildWatcher: ...
@abstractmethod @abstractmethod
@deprecated("Deprecated as of Python 3.12; will be removed in Python 3.14") @deprecated("Deprecated since Python 3.12; removed in Python 3.14.")
def set_child_watcher(self, watcher: AbstractChildWatcher) -> None: ... def set_child_watcher(self, watcher: AbstractChildWatcher) -> None: ...
else: else:
@abstractmethod @abstractmethod
@ -1052,9 +1054,9 @@ if sys.version_info >= (3, 14):
If policy is None, the default policy is restored. If policy is None, the default policy is restored.
""" """
@deprecated("Deprecated as of Python 3.14; will be removed in Python 3.16") @deprecated("Deprecated since Python 3.14; will be removed in Python 3.16.")
def get_event_loop_policy() -> _AbstractEventLoopPolicy: ... def get_event_loop_policy() -> _AbstractEventLoopPolicy: ...
@deprecated("Deprecated as of Python 3.14; will be removed in Python 3.16") @deprecated("Deprecated since Python 3.14; will be removed in Python 3.16.")
def set_event_loop_policy(policy: _AbstractEventLoopPolicy | None) -> None: ... def set_event_loop_policy(policy: _AbstractEventLoopPolicy | None) -> None: ...
else: else:
@ -1075,11 +1077,11 @@ def new_event_loop() -> AbstractEventLoop:
if sys.version_info < (3, 14): if sys.version_info < (3, 14):
if sys.version_info >= (3, 12): if sys.version_info >= (3, 12):
@deprecated("Deprecated as of Python 3.12; will be removed in Python 3.14") @deprecated("Deprecated since Python 3.12; removed in Python 3.14.")
def get_child_watcher() -> AbstractChildWatcher: def get_child_watcher() -> AbstractChildWatcher:
"""Equivalent to calling get_event_loop_policy().get_child_watcher().""" """Equivalent to calling get_event_loop_policy().get_child_watcher()."""
@deprecated("Deprecated as of Python 3.12; will be removed in Python 3.14") @deprecated("Deprecated since Python 3.12; removed in Python 3.14.")
def set_child_watcher(watcher: AbstractChildWatcher) -> None: def set_child_watcher(watcher: AbstractChildWatcher) -> None:
"""Equivalent to calling """Equivalent to calling
get_event_loop_policy().set_child_watcher(watcher). get_event_loop_policy().set_child_watcher(watcher).

View file

@ -17,6 +17,7 @@ class BaseProtocol:
write-only transport like write pipe write-only transport like write pipe
""" """
__slots__ = ()
def connection_made(self, transport: transports.BaseTransport) -> None: def connection_made(self, transport: transports.BaseTransport) -> None:
"""Called when a connection is made. """Called when a connection is made.
@ -87,6 +88,8 @@ class Protocol(BaseProtocol):
* CL: connection_lost() * CL: connection_lost()
""" """
# Need annotation or mypy will complain about 'Cannot determine type of "__slots__" in base class'
__slots__: tuple[()] = ()
def data_received(self, data: bytes) -> None: def data_received(self, data: bytes) -> None:
"""Called when some data is received. """Called when some data is received.
@ -125,6 +128,7 @@ class BufferedProtocol(BaseProtocol):
* CL: connection_lost() * CL: connection_lost()
""" """
__slots__ = ()
def get_buffer(self, sizehint: int) -> ReadableBuffer: def get_buffer(self, sizehint: int) -> ReadableBuffer:
"""Called to allocate a new receive buffer. """Called to allocate a new receive buffer.
@ -154,6 +158,7 @@ class BufferedProtocol(BaseProtocol):
class DatagramProtocol(BaseProtocol): class DatagramProtocol(BaseProtocol):
"""Interface for datagram protocol.""" """Interface for datagram protocol."""
__slots__ = ()
def connection_made(self, transport: transports.DatagramTransport) -> None: # type: ignore[override] def connection_made(self, transport: transports.DatagramTransport) -> None: # type: ignore[override]
"""Called when a connection is made. """Called when a connection is made.
@ -177,6 +182,7 @@ class DatagramProtocol(BaseProtocol):
class SubprocessProtocol(BaseProtocol): class SubprocessProtocol(BaseProtocol):
"""Interface for protocol for subprocess calls.""" """Interface for protocol for subprocess calls."""
__slots__: tuple[()] = ()
def pipe_data_received(self, fd: int, data: bytes) -> None: def pipe_data_received(self, fd: int, data: bytes) -> None:
"""Called when the subprocess writes data into stdout/stderr pipe. """Called when the subprocess writes data into stdout/stderr pipe.

View file

@ -56,7 +56,7 @@ if sys.version_info >= (3, 11):
if sys.version_info >= (3, 12): if sys.version_info >= (3, 12):
def run( def run(
main: Coroutine[Any, Any, _T], *, debug: bool | None = ..., loop_factory: Callable[[], AbstractEventLoop] | None = ... main: Coroutine[Any, Any, _T], *, debug: bool | None = None, loop_factory: Callable[[], AbstractEventLoop] | None = None
) -> _T: ) -> _T:
"""Execute the coroutine and return the result. """Execute the coroutine and return the result.

View file

@ -10,7 +10,7 @@ from _asyncio import (
_unregister_task as _unregister_task, _unregister_task as _unregister_task,
) )
from collections.abc import AsyncIterator, Awaitable, Coroutine, Generator, Iterable, Iterator from collections.abc import AsyncIterator, Awaitable, Coroutine, Generator, Iterable, Iterator
from typing import Any, Literal, Protocol, TypeVar, overload, type_check_only from typing import Any, Final, Literal, Protocol, TypeVar, overload, type_check_only
from typing_extensions import TypeAlias from typing_extensions import TypeAlias
from . import _CoroutineLike from . import _CoroutineLike
@ -84,9 +84,9 @@ else:
_TaskYieldType: TypeAlias = Future[object] | None _TaskYieldType: TypeAlias = Future[object] | None
FIRST_COMPLETED = concurrent.futures.FIRST_COMPLETED FIRST_COMPLETED: Final = concurrent.futures.FIRST_COMPLETED
FIRST_EXCEPTION = concurrent.futures.FIRST_EXCEPTION FIRST_EXCEPTION: Final = concurrent.futures.FIRST_EXCEPTION
ALL_COMPLETED = concurrent.futures.ALL_COMPLETED ALL_COMPLETED: Final = concurrent.futures.ALL_COMPLETED
if sys.version_info >= (3, 13): if sys.version_info >= (3, 13):
@type_check_only @type_check_only

View file

@ -12,6 +12,7 @@ __all__ = ("BaseTransport", "ReadTransport", "WriteTransport", "Transport", "Dat
class BaseTransport: class BaseTransport:
"""Base class for transports.""" """Base class for transports."""
__slots__ = ("_extra",)
def __init__(self, extra: Mapping[str, Any] | None = None) -> None: ... def __init__(self, extra: Mapping[str, Any] | None = None) -> None: ...
def get_extra_info(self, name: str, default: Any = None) -> Any: def get_extra_info(self, name: str, default: Any = None) -> Any:
"""Get optional transport information.""" """Get optional transport information."""
@ -37,6 +38,7 @@ class BaseTransport:
class ReadTransport(BaseTransport): class ReadTransport(BaseTransport):
"""Interface for read-only transports.""" """Interface for read-only transports."""
__slots__ = ()
def is_reading(self) -> bool: def is_reading(self) -> bool:
"""Return True if the transport is receiving.""" """Return True if the transport is receiving."""
@ -57,6 +59,7 @@ class ReadTransport(BaseTransport):
class WriteTransport(BaseTransport): class WriteTransport(BaseTransport):
"""Interface for write-only transports.""" """Interface for write-only transports."""
__slots__ = ()
def set_write_buffer_limits(self, high: int | None = None, low: int | None = None) -> None: def set_write_buffer_limits(self, high: int | None = None, low: int | None = None) -> None:
"""Set the high- and low-water limits for write flow control. """Set the high- and low-water limits for write flow control.
@ -140,9 +143,12 @@ class Transport(ReadTransport, WriteTransport):
except writelines(), which calls write() in a loop. except writelines(), which calls write() in a loop.
""" """
__slots__ = ()
class DatagramTransport(BaseTransport): class DatagramTransport(BaseTransport):
"""Interface for datagram (UDP) transports.""" """Interface for datagram (UDP) transports."""
__slots__ = ()
def sendto(self, data: bytes | bytearray | memoryview, addr: _Address | None = None) -> None: def sendto(self, data: bytes | bytearray | memoryview, addr: _Address | None = None) -> None:
"""Send data to the transport. """Send data to the transport.
@ -163,6 +169,7 @@ class DatagramTransport(BaseTransport):
""" """
class SubprocessTransport(BaseTransport): class SubprocessTransport(BaseTransport):
__slots__ = ()
def get_pid(self) -> int: def get_pid(self) -> int:
"""Get subprocess id.""" """Get subprocess id."""
@ -223,4 +230,5 @@ class _FlowControlMixin(Transport):
resume_writing() may be called. resume_writing() may be called.
""" """
__slots__ = ("_loop", "_protocol_paused", "_high_water", "_low_water")
def __init__(self, extra: Mapping[str, Any] | None = None, loop: AbstractEventLoop | None = None) -> None: ... def __init__(self, extra: Mapping[str, Any] | None = None, loop: AbstractEventLoop | None = None) -> None: ...

View file

@ -21,6 +21,7 @@ class TransportSocket:
operations (like "socket.close()") are banned. operations (like "socket.close()") are banned.
""" """
__slots__ = ("_sock",)
def __init__(self, sock: socket.socket) -> None: ... def __init__(self, sock: socket.socket) -> None: ...
@property @property
def family(self) -> int: ... def family(self) -> int: ...

View file

@ -50,7 +50,7 @@ if sys.platform != "win32":
# So, it is special cased. # So, it is special cased.
if sys.version_info < (3, 14): if sys.version_info < (3, 14):
if sys.version_info >= (3, 12): if sys.version_info >= (3, 12):
@deprecated("Deprecated as of Python 3.12; will be removed in Python 3.14") @deprecated("Deprecated since Python 3.12; removed in Python 3.14.")
class AbstractChildWatcher: class AbstractChildWatcher:
"""Abstract base class for monitoring child processes. """Abstract base class for monitoring child processes.
@ -228,7 +228,7 @@ if sys.platform != "win32":
def is_active(self) -> bool: ... def is_active(self) -> bool: ...
def attach_loop(self, loop: events.AbstractEventLoop | None) -> None: ... def attach_loop(self, loop: events.AbstractEventLoop | None) -> None: ...
@deprecated("Deprecated as of Python 3.12; will be removed in Python 3.14") @deprecated("Deprecated since Python 3.12; removed in Python 3.14.")
class SafeChildWatcher(BaseChildWatcher): class SafeChildWatcher(BaseChildWatcher):
"""'Safe' child watcher implementation. """'Safe' child watcher implementation.
@ -249,7 +249,7 @@ if sys.platform != "win32":
) -> None: ... ) -> None: ...
def remove_child_handler(self, pid: int) -> bool: ... def remove_child_handler(self, pid: int) -> bool: ...
@deprecated("Deprecated as of Python 3.12; will be removed in Python 3.14") @deprecated("Deprecated since Python 3.12; removed in Python 3.14.")
class FastChildWatcher(BaseChildWatcher): class FastChildWatcher(BaseChildWatcher):
"""'Fast' child watcher implementation. """'Fast' child watcher implementation.
@ -348,14 +348,14 @@ if sys.platform != "win32":
"""UNIX event loop policy with a watcher for child processes.""" """UNIX event loop policy with a watcher for child processes."""
if sys.version_info >= (3, 12): if sys.version_info >= (3, 12):
@deprecated("Deprecated as of Python 3.12; will be removed in Python 3.14") @deprecated("Deprecated since Python 3.12; removed in Python 3.14.")
def get_child_watcher(self) -> AbstractChildWatcher: def get_child_watcher(self) -> AbstractChildWatcher:
"""Get the watcher for child processes. """Get the watcher for child processes.
If not yet set, a ThreadedChildWatcher object is automatically created. If not yet set, a ThreadedChildWatcher object is automatically created.
""" """
@deprecated("Deprecated as of Python 3.12; will be removed in Python 3.14") @deprecated("Deprecated since Python 3.12; removed in Python 3.14.")
def set_child_watcher(self, watcher: AbstractChildWatcher | None) -> None: def set_child_watcher(self, watcher: AbstractChildWatcher | None) -> None:
"""Set the watcher for child processes.""" """Set the watcher for child processes."""
else: else:
@ -380,7 +380,7 @@ if sys.platform != "win32":
if sys.version_info < (3, 14): if sys.version_info < (3, 14):
if sys.version_info >= (3, 12): if sys.version_info >= (3, 12):
@deprecated("Deprecated as of Python 3.12; will be removed in Python 3.14") @deprecated("Deprecated since Python 3.12; removed in Python 3.14.")
class MultiLoopChildWatcher(AbstractChildWatcher): class MultiLoopChildWatcher(AbstractChildWatcher):
"""A watcher that doesn't require running loop in the main thread. """A watcher that doesn't require running loop in the main thread.

View file

@ -11,8 +11,8 @@ if sys.platform == "win32":
__all__ = ("pipe", "Popen", "PIPE", "PipeHandle") __all__ = ("pipe", "Popen", "PIPE", "PipeHandle")
BUFSIZE: Final = 8192 BUFSIZE: Final = 8192
PIPE = subprocess.PIPE PIPE: Final = subprocess.PIPE
STDOUT = subprocess.STDOUT STDOUT: Final = subprocess.STDOUT
def pipe(*, duplex: bool = False, overlapped: tuple[bool, bool] = (True, True), bufsize: int = 8192) -> tuple[int, int]: def pipe(*, duplex: bool = False, overlapped: tuple[bool, bool] = (True, True), bufsize: int = 8192) -> tuple[int, int]:
"""Like os.pipe() but with overlapped support and using handles not fds.""" """Like os.pipe() but with overlapped support and using handles not fds."""

View file

@ -380,18 +380,18 @@ if sys.version_info >= (3, 12):
NOVEMBER = 11 NOVEMBER = 11
DECEMBER = 12 DECEMBER = 12
JANUARY = Month.JANUARY JANUARY: Final = Month.JANUARY
FEBRUARY = Month.FEBRUARY FEBRUARY: Final = Month.FEBRUARY
MARCH = Month.MARCH MARCH: Final = Month.MARCH
APRIL = Month.APRIL APRIL: Final = Month.APRIL
MAY = Month.MAY MAY: Final = Month.MAY
JUNE = Month.JUNE JUNE: Final = Month.JUNE
JULY = Month.JULY JULY: Final = Month.JULY
AUGUST = Month.AUGUST AUGUST: Final = Month.AUGUST
SEPTEMBER = Month.SEPTEMBER SEPTEMBER: Final = Month.SEPTEMBER
OCTOBER = Month.OCTOBER OCTOBER: Final = Month.OCTOBER
NOVEMBER = Month.NOVEMBER NOVEMBER: Final = Month.NOVEMBER
DECEMBER = Month.DECEMBER DECEMBER: Final = Month.DECEMBER
class Day(enum.IntEnum): class Day(enum.IntEnum):
MONDAY = 0 MONDAY = 0
@ -402,13 +402,13 @@ if sys.version_info >= (3, 12):
SATURDAY = 5 SATURDAY = 5
SUNDAY = 6 SUNDAY = 6
MONDAY = Day.MONDAY MONDAY: Final = Day.MONDAY
TUESDAY = Day.TUESDAY TUESDAY: Final = Day.TUESDAY
WEDNESDAY = Day.WEDNESDAY WEDNESDAY: Final = Day.WEDNESDAY
THURSDAY = Day.THURSDAY THURSDAY: Final = Day.THURSDAY
FRIDAY = Day.FRIDAY FRIDAY: Final = Day.FRIDAY
SATURDAY = Day.SATURDAY SATURDAY: Final = Day.SATURDAY
SUNDAY = Day.SUNDAY SUNDAY: Final = Day.SUNDAY
else: else:
MONDAY: Final = 0 MONDAY: Final = 0
TUESDAY: Final = 1 TUESDAY: Final = 1

View file

@ -16,6 +16,8 @@ HLS: Hue, Luminance, Saturation
HSV: Hue, Saturation, Value HSV: Hue, Saturation, Value
""" """
from typing import Final
__all__ = ["rgb_to_yiq", "yiq_to_rgb", "rgb_to_hls", "hls_to_rgb", "rgb_to_hsv", "hsv_to_rgb"] __all__ = ["rgb_to_yiq", "yiq_to_rgb", "rgb_to_hls", "hls_to_rgb", "rgb_to_hsv", "hsv_to_rgb"]
def rgb_to_yiq(r: float, g: float, b: float) -> tuple[float, float, float]: ... def rgb_to_yiq(r: float, g: float, b: float) -> tuple[float, float, float]: ...
@ -26,6 +28,6 @@ def rgb_to_hsv(r: float, g: float, b: float) -> tuple[float, float, float]: ...
def hsv_to_rgb(h: float, s: float, v: float) -> tuple[float, float, float]: ... def hsv_to_rgb(h: float, s: float, v: float) -> tuple[float, float, float]: ...
# TODO: undocumented # TODO: undocumented
ONE_SIXTH: float ONE_SIXTH: Final[float]
ONE_THIRD: float ONE_THIRD: Final[float]
TWO_THIRD: float TWO_THIRD: Final[float]

View file

@ -15,8 +15,7 @@ RUNNING: Final = "RUNNING"
CANCELLED: Final = "CANCELLED" CANCELLED: Final = "CANCELLED"
CANCELLED_AND_NOTIFIED: Final = "CANCELLED_AND_NOTIFIED" CANCELLED_AND_NOTIFIED: Final = "CANCELLED_AND_NOTIFIED"
FINISHED: Final = "FINISHED" FINISHED: Final = "FINISHED"
_FUTURE_STATES: list[str] _STATE_TO_DESCRIPTION_MAP: Final[dict[str, str]]
_STATE_TO_DESCRIPTION_MAP: dict[str, str]
LOGGER: Logger LOGGER: Logger
class Error(Exception): class Error(Exception):

View file

@ -47,7 +47,7 @@ from multiprocessing.context import BaseContext, Process
from multiprocessing.queues import Queue, SimpleQueue from multiprocessing.queues import Queue, SimpleQueue
from threading import Lock, Semaphore, Thread from threading import Lock, Semaphore, Thread
from types import TracebackType from types import TracebackType
from typing import Any, Generic, TypeVar, overload from typing import Any, Final, Generic, TypeVar, overload
from typing_extensions import TypeVarTuple, Unpack from typing_extensions import TypeVarTuple, Unpack
from weakref import ref from weakref import ref
@ -70,9 +70,9 @@ class _ThreadWakeup:
def _python_exit() -> None: ... def _python_exit() -> None: ...
EXTRA_QUEUED_CALLS: int EXTRA_QUEUED_CALLS: Final = 1
_MAX_WINDOWS_WORKERS: int _MAX_WINDOWS_WORKERS: Final = 61
class _RemoteTraceback(Exception): class _RemoteTraceback(Exception):
tb: str tb: str

View file

@ -51,6 +51,7 @@ _CM_EF = TypeVar("_CM_EF", bound=AbstractContextManager[Any, Any] | _ExitFunc)
class AbstractContextManager(ABC, Protocol[_T_co, _ExitT_co]): # type: ignore[misc] # pyright: ignore[reportGeneralTypeIssues] class AbstractContextManager(ABC, Protocol[_T_co, _ExitT_co]): # type: ignore[misc] # pyright: ignore[reportGeneralTypeIssues]
"""An abstract base class for context managers.""" """An abstract base class for context managers."""
__slots__ = ()
def __enter__(self) -> _T_co: def __enter__(self) -> _T_co:
"""Return `self` upon entering the runtime context.""" """Return `self` upon entering the runtime context."""
@ -67,6 +68,7 @@ class AbstractContextManager(ABC, Protocol[_T_co, _ExitT_co]): # type: ignore[m
class AbstractAsyncContextManager(ABC, Protocol[_T_co, _ExitT_co]): # type: ignore[misc] # pyright: ignore[reportGeneralTypeIssues] class AbstractAsyncContextManager(ABC, Protocol[_T_co, _ExitT_co]): # type: ignore[misc] # pyright: ignore[reportGeneralTypeIssues]
"""An abstract base class for asynchronous context managers.""" """An abstract base class for asynchronous context managers."""
__slots__ = ()
async def __aenter__(self) -> _T_co: async def __aenter__(self) -> _T_co:
"""Return `self` upon entering the runtime context.""" """Return `self` upon entering the runtime context."""

View file

@ -28,7 +28,7 @@ from _ctypes import (
from _typeshed import StrPath from _typeshed import StrPath
from ctypes._endian import BigEndianStructure as BigEndianStructure, LittleEndianStructure as LittleEndianStructure from ctypes._endian import BigEndianStructure as BigEndianStructure, LittleEndianStructure as LittleEndianStructure
from types import GenericAlias from types import GenericAlias
from typing import Any, ClassVar, Generic, Literal, TypeVar, overload, type_check_only from typing import Any, ClassVar, Final, Generic, Literal, TypeVar, overload, type_check_only
from typing_extensions import Self, TypeAlias, deprecated from typing_extensions import Self, TypeAlias, deprecated
if sys.platform == "win32": if sys.platform == "win32":
@ -69,7 +69,7 @@ if sys.version_info >= (3, 14):
else: else:
from _ctypes import POINTER as POINTER, pointer as pointer from _ctypes import POINTER as POINTER, pointer as pointer
DEFAULT_MODE: int DEFAULT_MODE: Final[int]
class ArgumentError(Exception): ... class ArgumentError(Exception): ...
@ -231,8 +231,13 @@ def create_unicode_buffer(init: int | str, size: int | None = None) -> Array[c_w
create_unicode_buffer(aString, anInteger) -> character array create_unicode_buffer(aString, anInteger) -> character array
""" """
@deprecated("Deprecated in Python 3.13; removal scheduled for Python 3.15") if sys.version_info >= (3, 13):
def SetPointerType(pointer: type[_Pointer[Any]], cls: _CTypeBaseType) -> None: ... @deprecated("Deprecated since Python 3.13; will be removed in Python 3.15.")
def SetPointerType(pointer: type[_Pointer[Any]], cls: _CTypeBaseType) -> None: ...
else:
def SetPointerType(pointer: type[_Pointer[Any]], cls: _CTypeBaseType) -> None: ...
def ARRAY(typ: _CT, len: int) -> Array[_CT]: ... # Soft Deprecated, no plans to remove def ARRAY(typ: _CT, len: int) -> Array[_CT]: ... # Soft Deprecated, no plans to remove
if sys.platform == "win32": if sys.platform == "win32":

View file

@ -6,6 +6,8 @@ from ctypes import Structure, Union
class BigEndianStructure(Structure): class BigEndianStructure(Structure):
"""Structure with big endian byte order""" """Structure with big endian byte order"""
__slots__ = ()
class LittleEndianStructure(Structure): class LittleEndianStructure(Structure):
"""Structure base class""" """Structure base class"""
@ -14,5 +16,7 @@ if sys.version_info >= (3, 11):
class BigEndianUnion(Union): class BigEndianUnion(Union):
"""Union with big endian byte order""" """Union with big endian byte order"""
__slots__ = ()
class LittleEndianUnion(Union): class LittleEndianUnion(Union):
"""Union base class""" """Union base class"""

View file

@ -6,4 +6,6 @@ See the relevant header files in /usr/include/mach-o
And also Apple's documentation. And also Apple's documentation.
""" """
__version__: str from typing import Final
__version__: Final[str]

View file

@ -21,7 +21,7 @@ from ctypes import (
c_wchar, c_wchar,
c_wchar_p, c_wchar_p,
) )
from typing import Any, TypeVar from typing import Any, Final, TypeVar
from typing_extensions import Self, TypeAlias from typing_extensions import Self, TypeAlias
if sys.version_info >= (3, 12): if sys.version_info >= (3, 12):
@ -177,7 +177,7 @@ class MSG(Structure):
pt: _CField[POINT, POINT, POINT] pt: _CField[POINT, POINT, POINT]
tagMSG = MSG tagMSG = MSG
MAX_PATH: int MAX_PATH: Final = 260
class WIN32_FIND_DATAA(Structure): class WIN32_FIND_DATAA(Structure):
dwFileAttributes: _CIntLikeField[DWORD] dwFileAttributes: _CIntLikeField[DWORD]

View file

@ -26,12 +26,12 @@ _T = TypeVar("_T")
_P = ParamSpec("_P") _P = ParamSpec("_P")
# available after calling `curses.initscr()` # available after calling `curses.initscr()`
LINES: int LINES: Final[int]
COLS: int COLS: Final[int]
# available after calling `curses.start_color()` # available after calling `curses.start_color()`
COLORS: int COLORS: Final[int]
COLOR_PAIRS: int COLOR_PAIRS: Final[int]
def wrapper(func: Callable[Concatenate[window, _P], _T], /, *arg: _P.args, **kwds: _P.kwargs) -> _T: def wrapper(func: Callable[Concatenate[window, _P], _T], /, *arg: _P.args, **kwds: _P.kwargs) -> _T:
"""Wrapper function that initializes curses and calls another function, """Wrapper function that initializes curses and calls another function,

View file

@ -1,47 +1,47 @@
"""Constants and membership tests for ASCII characters""" """Constants and membership tests for ASCII characters"""
from typing import TypeVar from typing import Final, TypeVar
_CharT = TypeVar("_CharT", str, int) _CharT = TypeVar("_CharT", str, int)
NUL: int NUL: Final = 0x00
SOH: int SOH: Final = 0x01
STX: int STX: Final = 0x02
ETX: int ETX: Final = 0x03
EOT: int EOT: Final = 0x04
ENQ: int ENQ: Final = 0x05
ACK: int ACK: Final = 0x06
BEL: int BEL: Final = 0x07
BS: int BS: Final = 0x08
TAB: int TAB: Final = 0x09
HT: int HT: Final = 0x09
LF: int LF: Final = 0x0A
NL: int NL: Final = 0x0A
VT: int VT: Final = 0x0B
FF: int FF: Final = 0x0C
CR: int CR: Final = 0x0D
SO: int SO: Final = 0x0E
SI: int SI: Final = 0x0F
DLE: int DLE: Final = 0x10
DC1: int DC1: Final = 0x11
DC2: int DC2: Final = 0x12
DC3: int DC3: Final = 0x13
DC4: int DC4: Final = 0x14
NAK: int NAK: Final = 0x15
SYN: int SYN: Final = 0x16
ETB: int ETB: Final = 0x17
CAN: int CAN: Final = 0x18
EM: int EM: Final = 0x19
SUB: int SUB: Final = 0x1A
ESC: int ESC: Final = 0x1B
FS: int FS: Final = 0x1C
GS: int GS: Final = 0x1D
RS: int RS: Final = 0x1E
US: int US: Final = 0x1F
SP: int SP: Final = 0x20
DEL: int DEL: Final = 0x7F
controlnames: list[int] controlnames: Final[list[int]]
def isalnum(c: str | int) -> bool: ... def isalnum(c: str | int) -> bool: ...
def isalpha(c: str | int) -> bool: ... def isalpha(c: str | int) -> bool: ...

View file

@ -5,7 +5,7 @@ from _typeshed import DataclassInstance
from builtins import type as Type # alias to avoid name clashes with fields named "type" from builtins import type as Type # alias to avoid name clashes with fields named "type"
from collections.abc import Callable, Iterable, Mapping from collections.abc import Callable, Iterable, Mapping
from types import GenericAlias from types import GenericAlias
from typing import Any, Generic, Literal, Protocol, TypeVar, overload, type_check_only from typing import Any, Final, Generic, Literal, Protocol, TypeVar, overload, type_check_only
from typing_extensions import Never, TypeIs from typing_extensions import Never, TypeIs
_T = TypeVar("_T") _T = TypeVar("_T")
@ -58,7 +58,7 @@ class _DataclassFactory(Protocol):
class _MISSING_TYPE(enum.Enum): class _MISSING_TYPE(enum.Enum):
MISSING = enum.auto() MISSING = enum.auto()
MISSING = _MISSING_TYPE.MISSING MISSING: Final = _MISSING_TYPE.MISSING
if sys.version_info >= (3, 10): if sys.version_info >= (3, 10):
class KW_ONLY: ... class KW_ONLY: ...
@ -248,6 +248,37 @@ class _DefaultFactory(Protocol[_T_co]):
def __call__(self) -> _T_co: ... def __call__(self) -> _T_co: ...
class Field(Generic[_T]): class Field(Generic[_T]):
if sys.version_info >= (3, 14):
__slots__ = (
"name",
"type",
"default",
"default_factory",
"repr",
"hash",
"init",
"compare",
"metadata",
"kw_only",
"doc",
"_field_type",
)
elif sys.version_info >= (3, 10):
__slots__ = (
"name",
"type",
"default",
"default_factory",
"repr",
"hash",
"init",
"compare",
"metadata",
"kw_only",
"_field_type",
)
else:
__slots__ = ("name", "type", "default", "default_factory", "repr", "hash", "init", "compare", "metadata", "_field_type")
name: str name: str
type: Type[_T] | str | Any type: Type[_T] | str | Any
default: _T | Literal[_MISSING_TYPE.MISSING] default: _T | Literal[_MISSING_TYPE.MISSING]
@ -492,6 +523,7 @@ def is_dataclass(obj: object) -> TypeIs[DataclassInstance | type[DataclassInstan
class FrozenInstanceError(AttributeError): ... class FrozenInstanceError(AttributeError): ...
class InitVar(Generic[_T]): class InitVar(Generic[_T]):
__slots__ = ("type",)
type: Type[_T] type: Type[_T]
def __init__(self, type: Type[_T]) -> None: ... def __init__(self, type: Type[_T]) -> None: ...
@overload @overload

View file

@ -4,7 +4,7 @@ import sys
import types import types
from collections.abc import Callable, Iterator from collections.abc import Callable, Iterator
from opcode import * # `dis` re-exports it as a part of public API from opcode import * # `dis` re-exports it as a part of public API
from typing import IO, Any, NamedTuple from typing import IO, Any, Final, NamedTuple
from typing_extensions import Self, TypeAlias from typing_extensions import Self, TypeAlias
__all__ = [ __all__ = [
@ -249,7 +249,7 @@ class Bytecode:
def dis(self) -> str: def dis(self) -> str:
"""Return a formatted view of the bytecode operations.""" """Return a formatted view of the bytecode operations."""
COMPILER_FLAG_NAMES: dict[int, str] COMPILER_FLAG_NAMES: Final[dict[int, str]]
def findlabels(code: _HaveCodeType) -> list[int]: def findlabels(code: _HaveCodeType) -> list[int]:
"""Detect all offsets in a byte code which are jump targets. """Detect all offsets in a byte code which are jump targets.

View file

@ -42,7 +42,7 @@ import types
import unittest import unittest
from _typeshed import ExcInfo from _typeshed import ExcInfo
from collections.abc import Callable from collections.abc import Callable
from typing import Any, NamedTuple, type_check_only from typing import Any, Final, NamedTuple, type_check_only
from typing_extensions import Self, TypeAlias from typing_extensions import Self, TypeAlias
__all__ = [ __all__ = [
@ -98,29 +98,29 @@ else:
failed: int failed: int
attempted: int attempted: int
OPTIONFLAGS_BY_NAME: dict[str, int] OPTIONFLAGS_BY_NAME: Final[dict[str, int]]
def register_optionflag(name: str) -> int: ... def register_optionflag(name: str) -> int: ...
DONT_ACCEPT_TRUE_FOR_1: int DONT_ACCEPT_TRUE_FOR_1: Final = 1
DONT_ACCEPT_BLANKLINE: int DONT_ACCEPT_BLANKLINE: Final = 2
NORMALIZE_WHITESPACE: int NORMALIZE_WHITESPACE: Final = 4
ELLIPSIS: int ELLIPSIS: Final = 8
SKIP: int SKIP: Final = 16
IGNORE_EXCEPTION_DETAIL: int IGNORE_EXCEPTION_DETAIL: Final = 32
COMPARISON_FLAGS: int COMPARISON_FLAGS: Final = 63
REPORT_UDIFF: int REPORT_UDIFF: Final = 64
REPORT_CDIFF: int REPORT_CDIFF: Final = 128
REPORT_NDIFF: int REPORT_NDIFF: Final = 256
REPORT_ONLY_FIRST_FAILURE: int REPORT_ONLY_FIRST_FAILURE: Final = 512
FAIL_FAST: int FAIL_FAST: Final = 1024
REPORTING_FLAGS: int REPORTING_FLAGS: Final = 1984
BLANKLINE_MARKER: str BLANKLINE_MARKER: Final = "<BLANKLINE>"
ELLIPSIS_MARKER: str ELLIPSIS_MARKER: Final = "..."
class Example: class Example:
""" """

View file

@ -96,7 +96,7 @@ def make_quoted_pairs(value: Any) -> str:
def quote_string(value: Any) -> str: ... def quote_string(value: Any) -> str: ...
rfc2047_matcher: Pattern[str] rfc2047_matcher: Final[Pattern[str]]
class TokenList(list[TokenList | Terminal]): class TokenList(list[TokenList | Terminal]):
token_type: str | None token_type: str | None

View file

@ -4,9 +4,16 @@ from typing import ClassVar, Final, overload
__all__ = ["Charset", "add_alias", "add_charset", "add_codec"] __all__ = ["Charset", "add_alias", "add_charset", "add_codec"]
QP: Final[int] # undocumented QP: Final = 1 # undocumented
BASE64: Final[int] # undocumented BASE64: Final = 2 # undocumented
SHORTEST: Final[int] # undocumented SHORTEST: Final = 3 # undocumented
RFC2047_CHROME_LEN: Final = 7 # undocumented
DEFAULT_CHARSET: Final = "us-ascii" # undocumented
UNKNOWN8BIT: Final = "unknown-8bit" # undocumented
EMPTYSTRING: Final = "" # undocumented
CHARSETS: Final[dict[str, tuple[int | None, int | None, str | None]]]
ALIASES: Final[dict[str, str]]
CODEC_MAP: Final[dict[str, str | None]] # undocumented
class Charset: class Charset:
"""Map character sets to their email properties. """Map character sets to their email properties.

View file

@ -4,7 +4,7 @@ import types
from _typeshed import SupportsKeysAndGetItem, Unused from _typeshed import SupportsKeysAndGetItem, Unused
from builtins import property as _builtins_property from builtins import property as _builtins_property
from collections.abc import Callable, Iterable, Iterator, Mapping from collections.abc import Callable, Iterable, Iterator, Mapping
from typing import Any, Generic, Literal, TypeVar, overload from typing import Any, Final, Generic, Literal, TypeVar, overload
from typing_extensions import Self, TypeAlias from typing_extensions import Self, TypeAlias
__all__ = ["EnumMeta", "Enum", "IntEnum", "Flag", "IntFlag", "auto", "unique"] __all__ = ["EnumMeta", "Enum", "IntEnum", "Flag", "IntFlag", "auto", "unique"]
@ -551,9 +551,9 @@ if sys.version_info >= (3, 11):
NAMED_FLAGS = "multi-flag aliases may not contain unnamed flags" NAMED_FLAGS = "multi-flag aliases may not contain unnamed flags"
UNIQUE = "one name per value" UNIQUE = "one name per value"
CONTINUOUS = EnumCheck.CONTINUOUS CONTINUOUS: Final = EnumCheck.CONTINUOUS
NAMED_FLAGS = EnumCheck.NAMED_FLAGS NAMED_FLAGS: Final = EnumCheck.NAMED_FLAGS
UNIQUE = EnumCheck.UNIQUE UNIQUE: Final = EnumCheck.UNIQUE
class verify: class verify:
""" """
@ -577,10 +577,10 @@ if sys.version_info >= (3, 11):
EJECT = "eject" EJECT = "eject"
KEEP = "keep" KEEP = "keep"
STRICT = FlagBoundary.STRICT STRICT: Final = FlagBoundary.STRICT
CONFORM = FlagBoundary.CONFORM CONFORM: Final = FlagBoundary.CONFORM
EJECT = FlagBoundary.EJECT EJECT: Final = FlagBoundary.EJECT
KEEP = FlagBoundary.KEEP KEEP: Final = FlagBoundary.KEEP
def global_str(self: Enum) -> str: def global_str(self: Enum) -> str:
""" """

View file

@ -14,226 +14,227 @@ e.g. os.strerror(2) could return 'No such file or directory'.
import sys import sys
from collections.abc import Mapping from collections.abc import Mapping
from typing import Final
errorcode: Mapping[int, str] errorcode: Mapping[int, str]
EPERM: int EPERM: Final[int]
ENOENT: int ENOENT: Final[int]
ESRCH: int ESRCH: Final[int]
EINTR: int EINTR: Final[int]
EIO: int EIO: Final[int]
ENXIO: int ENXIO: Final[int]
E2BIG: int E2BIG: Final[int]
ENOEXEC: int ENOEXEC: Final[int]
EBADF: int EBADF: Final[int]
ECHILD: int ECHILD: Final[int]
EAGAIN: int EAGAIN: Final[int]
ENOMEM: int ENOMEM: Final[int]
EACCES: int EACCES: Final[int]
EFAULT: int EFAULT: Final[int]
EBUSY: int EBUSY: Final[int]
EEXIST: int EEXIST: Final[int]
EXDEV: int EXDEV: Final[int]
ENODEV: int ENODEV: Final[int]
ENOTDIR: int ENOTDIR: Final[int]
EISDIR: int EISDIR: Final[int]
EINVAL: int EINVAL: Final[int]
ENFILE: int ENFILE: Final[int]
EMFILE: int EMFILE: Final[int]
ENOTTY: int ENOTTY: Final[int]
ETXTBSY: int ETXTBSY: Final[int]
EFBIG: int EFBIG: Final[int]
ENOSPC: int ENOSPC: Final[int]
ESPIPE: int ESPIPE: Final[int]
EROFS: int EROFS: Final[int]
EMLINK: int EMLINK: Final[int]
EPIPE: int EPIPE: Final[int]
EDOM: int EDOM: Final[int]
ERANGE: int ERANGE: Final[int]
EDEADLK: int EDEADLK: Final[int]
ENAMETOOLONG: int ENAMETOOLONG: Final[int]
ENOLCK: int ENOLCK: Final[int]
ENOSYS: int ENOSYS: Final[int]
ENOTEMPTY: int ENOTEMPTY: Final[int]
ELOOP: int ELOOP: Final[int]
EWOULDBLOCK: int EWOULDBLOCK: Final[int]
ENOMSG: int ENOMSG: Final[int]
EIDRM: int EIDRM: Final[int]
ENOSTR: int ENOSTR: Final[int]
ENODATA: int ENODATA: Final[int]
ETIME: int ETIME: Final[int]
ENOSR: int ENOSR: Final[int]
EREMOTE: int EREMOTE: Final[int]
ENOLINK: int ENOLINK: Final[int]
EPROTO: int EPROTO: Final[int]
EBADMSG: int EBADMSG: Final[int]
EOVERFLOW: int EOVERFLOW: Final[int]
EILSEQ: int EILSEQ: Final[int]
EUSERS: int EUSERS: Final[int]
ENOTSOCK: int ENOTSOCK: Final[int]
EDESTADDRREQ: int EDESTADDRREQ: Final[int]
EMSGSIZE: int EMSGSIZE: Final[int]
EPROTOTYPE: int EPROTOTYPE: Final[int]
ENOPROTOOPT: int ENOPROTOOPT: Final[int]
EPROTONOSUPPORT: int EPROTONOSUPPORT: Final[int]
ESOCKTNOSUPPORT: int ESOCKTNOSUPPORT: Final[int]
ENOTSUP: int ENOTSUP: Final[int]
EOPNOTSUPP: int EOPNOTSUPP: Final[int]
EPFNOSUPPORT: int EPFNOSUPPORT: Final[int]
EAFNOSUPPORT: int EAFNOSUPPORT: Final[int]
EADDRINUSE: int EADDRINUSE: Final[int]
EADDRNOTAVAIL: int EADDRNOTAVAIL: Final[int]
ENETDOWN: int ENETDOWN: Final[int]
ENETUNREACH: int ENETUNREACH: Final[int]
ENETRESET: int ENETRESET: Final[int]
ECONNABORTED: int ECONNABORTED: Final[int]
ECONNRESET: int ECONNRESET: Final[int]
ENOBUFS: int ENOBUFS: Final[int]
EISCONN: int EISCONN: Final[int]
ENOTCONN: int ENOTCONN: Final[int]
ESHUTDOWN: int ESHUTDOWN: Final[int]
ETOOMANYREFS: int ETOOMANYREFS: Final[int]
ETIMEDOUT: int ETIMEDOUT: Final[int]
ECONNREFUSED: int ECONNREFUSED: Final[int]
EHOSTDOWN: int EHOSTDOWN: Final[int]
EHOSTUNREACH: int EHOSTUNREACH: Final[int]
EALREADY: int EALREADY: Final[int]
EINPROGRESS: int EINPROGRESS: Final[int]
ESTALE: int ESTALE: Final[int]
EDQUOT: int EDQUOT: Final[int]
ECANCELED: int # undocumented ECANCELED: Final[int] # undocumented
ENOTRECOVERABLE: int # undocumented ENOTRECOVERABLE: Final[int] # undocumented
EOWNERDEAD: int # undocumented EOWNERDEAD: Final[int] # undocumented
if sys.platform == "sunos5" or sys.platform == "solaris": # noqa: Y008 if sys.platform == "sunos5" or sys.platform == "solaris": # noqa: Y008
ELOCKUNMAPPED: int ELOCKUNMAPPED: Final[int]
ENOTACTIVE: int ENOTACTIVE: Final[int]
if sys.platform != "win32": if sys.platform != "win32":
ENOTBLK: int ENOTBLK: Final[int]
EMULTIHOP: int EMULTIHOP: Final[int]
if sys.platform == "darwin": if sys.platform == "darwin":
# All of the below are undocumented # All of the below are undocumented
EAUTH: int EAUTH: Final[int]
EBADARCH: int EBADARCH: Final[int]
EBADEXEC: int EBADEXEC: Final[int]
EBADMACHO: int EBADMACHO: Final[int]
EBADRPC: int EBADRPC: Final[int]
EDEVERR: int EDEVERR: Final[int]
EFTYPE: int EFTYPE: Final[int]
ENEEDAUTH: int ENEEDAUTH: Final[int]
ENOATTR: int ENOATTR: Final[int]
ENOPOLICY: int ENOPOLICY: Final[int]
EPROCLIM: int EPROCLIM: Final[int]
EPROCUNAVAIL: int EPROCUNAVAIL: Final[int]
EPROGMISMATCH: int EPROGMISMATCH: Final[int]
EPROGUNAVAIL: int EPROGUNAVAIL: Final[int]
EPWROFF: int EPWROFF: Final[int]
ERPCMISMATCH: int ERPCMISMATCH: Final[int]
ESHLIBVERS: int ESHLIBVERS: Final[int]
if sys.version_info >= (3, 11): if sys.version_info >= (3, 11):
EQFULL: int EQFULL: Final[int]
if sys.platform != "darwin": if sys.platform != "darwin":
EDEADLOCK: int EDEADLOCK: Final[int]
if sys.platform != "win32" and sys.platform != "darwin": if sys.platform != "win32" and sys.platform != "darwin":
ECHRNG: int ECHRNG: Final[int]
EL2NSYNC: int EL2NSYNC: Final[int]
EL3HLT: int EL3HLT: Final[int]
EL3RST: int EL3RST: Final[int]
ELNRNG: int ELNRNG: Final[int]
EUNATCH: int EUNATCH: Final[int]
ENOCSI: int ENOCSI: Final[int]
EL2HLT: int EL2HLT: Final[int]
EBADE: int EBADE: Final[int]
EBADR: int EBADR: Final[int]
EXFULL: int EXFULL: Final[int]
ENOANO: int ENOANO: Final[int]
EBADRQC: int EBADRQC: Final[int]
EBADSLT: int EBADSLT: Final[int]
EBFONT: int EBFONT: Final[int]
ENONET: int ENONET: Final[int]
ENOPKG: int ENOPKG: Final[int]
EADV: int EADV: Final[int]
ESRMNT: int ESRMNT: Final[int]
ECOMM: int ECOMM: Final[int]
EDOTDOT: int EDOTDOT: Final[int]
ENOTUNIQ: int ENOTUNIQ: Final[int]
EBADFD: int EBADFD: Final[int]
EREMCHG: int EREMCHG: Final[int]
ELIBACC: int ELIBACC: Final[int]
ELIBBAD: int ELIBBAD: Final[int]
ELIBSCN: int ELIBSCN: Final[int]
ELIBMAX: int ELIBMAX: Final[int]
ELIBEXEC: int ELIBEXEC: Final[int]
ERESTART: int ERESTART: Final[int]
ESTRPIPE: int ESTRPIPE: Final[int]
EUCLEAN: int EUCLEAN: Final[int]
ENOTNAM: int ENOTNAM: Final[int]
ENAVAIL: int ENAVAIL: Final[int]
EISNAM: int EISNAM: Final[int]
EREMOTEIO: int EREMOTEIO: Final[int]
# All of the below are undocumented # All of the below are undocumented
EKEYEXPIRED: int EKEYEXPIRED: Final[int]
EKEYREJECTED: int EKEYREJECTED: Final[int]
EKEYREVOKED: int EKEYREVOKED: Final[int]
EMEDIUMTYPE: int EMEDIUMTYPE: Final[int]
ENOKEY: int ENOKEY: Final[int]
ENOMEDIUM: int ENOMEDIUM: Final[int]
ERFKILL: int ERFKILL: Final[int]
if sys.version_info >= (3, 14): if sys.version_info >= (3, 14):
EHWPOISON: int EHWPOISON: Final[int]
if sys.platform == "win32": if sys.platform == "win32":
# All of these are undocumented # All of these are undocumented
WSABASEERR: int WSABASEERR: Final[int]
WSAEACCES: int WSAEACCES: Final[int]
WSAEADDRINUSE: int WSAEADDRINUSE: Final[int]
WSAEADDRNOTAVAIL: int WSAEADDRNOTAVAIL: Final[int]
WSAEAFNOSUPPORT: int WSAEAFNOSUPPORT: Final[int]
WSAEALREADY: int WSAEALREADY: Final[int]
WSAEBADF: int WSAEBADF: Final[int]
WSAECONNABORTED: int WSAECONNABORTED: Final[int]
WSAECONNREFUSED: int WSAECONNREFUSED: Final[int]
WSAECONNRESET: int WSAECONNRESET: Final[int]
WSAEDESTADDRREQ: int WSAEDESTADDRREQ: Final[int]
WSAEDISCON: int WSAEDISCON: Final[int]
WSAEDQUOT: int WSAEDQUOT: Final[int]
WSAEFAULT: int WSAEFAULT: Final[int]
WSAEHOSTDOWN: int WSAEHOSTDOWN: Final[int]
WSAEHOSTUNREACH: int WSAEHOSTUNREACH: Final[int]
WSAEINPROGRESS: int WSAEINPROGRESS: Final[int]
WSAEINTR: int WSAEINTR: Final[int]
WSAEINVAL: int WSAEINVAL: Final[int]
WSAEISCONN: int WSAEISCONN: Final[int]
WSAELOOP: int WSAELOOP: Final[int]
WSAEMFILE: int WSAEMFILE: Final[int]
WSAEMSGSIZE: int WSAEMSGSIZE: Final[int]
WSAENAMETOOLONG: int WSAENAMETOOLONG: Final[int]
WSAENETDOWN: int WSAENETDOWN: Final[int]
WSAENETRESET: int WSAENETRESET: Final[int]
WSAENETUNREACH: int WSAENETUNREACH: Final[int]
WSAENOBUFS: int WSAENOBUFS: Final[int]
WSAENOPROTOOPT: int WSAENOPROTOOPT: Final[int]
WSAENOTCONN: int WSAENOTCONN: Final[int]
WSAENOTEMPTY: int WSAENOTEMPTY: Final[int]
WSAENOTSOCK: int WSAENOTSOCK: Final[int]
WSAEOPNOTSUPP: int WSAEOPNOTSUPP: Final[int]
WSAEPFNOSUPPORT: int WSAEPFNOSUPPORT: Final[int]
WSAEPROCLIM: int WSAEPROCLIM: Final[int]
WSAEPROTONOSUPPORT: int WSAEPROTONOSUPPORT: Final[int]
WSAEPROTOTYPE: int WSAEPROTOTYPE: Final[int]
WSAEREMOTE: int WSAEREMOTE: Final[int]
WSAESHUTDOWN: int WSAESHUTDOWN: Final[int]
WSAESOCKTNOSUPPORT: int WSAESOCKTNOSUPPORT: Final[int]
WSAESTALE: int WSAESTALE: Final[int]
WSAETIMEDOUT: int WSAETIMEDOUT: Final[int]
WSAETOOMANYREFS: int WSAETOOMANYREFS: Final[int]
WSAEUSERS: int WSAEUSERS: Final[int]
WSAEWOULDBLOCK: int WSAEWOULDBLOCK: Final[int]
WSANOTINITIALISED: int WSANOTINITIALISED: Final[int]
WSASYSNOTREADY: int WSASYSNOTREADY: Final[int]
WSAVERNOTSUPPORTED: int WSAVERNOTSUPPORTED: Final[int]

View file

@ -18,7 +18,7 @@ from typing import Any, AnyStr, Final, Generic, Literal
__all__ = ["clear_cache", "cmp", "dircmp", "cmpfiles", "DEFAULT_IGNORES"] __all__ = ["clear_cache", "cmp", "dircmp", "cmpfiles", "DEFAULT_IGNORES"]
DEFAULT_IGNORES: list[str] DEFAULT_IGNORES: Final[list[str]]
BUFSIZE: Final = 8192 BUFSIZE: Final = 8192
def cmp(f1: StrOrBytesPath, f2: StrOrBytesPath, shallow: bool | Literal[0, 1] = True) -> bool: def cmp(f1: StrOrBytesPath, f2: StrOrBytesPath, shallow: bool | Literal[0, 1] = True) -> bool:

View file

@ -36,6 +36,7 @@ class Fraction(Rational):
""" """
__slots__ = ("_numerator", "_denominator")
@overload @overload
def __new__(cls, numerator: int | Rational = 0, denominator: int | Rational | None = None) -> Self: def __new__(cls, numerator: int | Rational = 0, denominator: int | Rational | None = None) -> Self:
"""Constructs a Rational. """Constructs a Rational.

View file

@ -169,7 +169,7 @@ else:
tuple[Literal["__module__"], Literal["__name__"], Literal["__qualname__"], Literal["__doc__"], Literal["__annotations__"]] tuple[Literal["__module__"], Literal["__name__"], Literal["__qualname__"], Literal["__doc__"], Literal["__annotations__"]]
] ]
WRAPPER_UPDATES: tuple[Literal["__dict__"]] WRAPPER_UPDATES: Final[tuple[Literal["__dict__"]]]
@type_check_only @type_check_only
class _Wrapped(Generic[_PWrapped, _RWrapped, _PWrapper, _RWrapper]): class _Wrapped(Generic[_PWrapped, _RWrapped, _PWrapper, _RWrapper]):

View file

@ -12,9 +12,13 @@ if sys.version_info >= (3, 13):
__all__ += ["translate"] __all__ += ["translate"]
if sys.version_info >= (3, 10): if sys.version_info >= (3, 10):
@deprecated("Will be removed in Python 3.15; Use `glob.glob` and pass *root_dir* argument instead.") @deprecated(
"Deprecated since Python 3.10; will be removed in Python 3.15. Use `glob.glob()` with the *root_dir* argument instead."
)
def glob0(dirname: AnyStr, pattern: AnyStr) -> list[AnyStr]: ... def glob0(dirname: AnyStr, pattern: AnyStr) -> list[AnyStr]: ...
@deprecated("Will be removed in Python 3.15; Use `glob.glob` and pass *root_dir* argument instead.") @deprecated(
"Deprecated since Python 3.10; will be removed in Python 3.15. Use `glob.glob()` with the *root_dir* argument instead."
)
def glob1(dirname: AnyStr, pattern: AnyStr) -> list[AnyStr]: ... def glob1(dirname: AnyStr, pattern: AnyStr) -> list[AnyStr]: ...
else: else:

View file

@ -47,6 +47,7 @@ class HMAC:
This supports the API for Cryptographic Hash Functions (PEP 247). This supports the API for Cryptographic Hash Functions (PEP 247).
""" """
__slots__ = ("_hmac", "_inner", "_outer", "block_size", "digest_size")
digest_size: int digest_size: int
block_size: int block_size: int
@property @property

View file

@ -1,8 +1,10 @@
"""HTML character entity references.""" """HTML character entity references."""
from typing import Final
__all__ = ["html5", "name2codepoint", "codepoint2name", "entitydefs"] __all__ = ["html5", "name2codepoint", "codepoint2name", "entitydefs"]
name2codepoint: dict[str, int] name2codepoint: Final[dict[str, int]]
html5: dict[str, str] html5: Final[dict[str, str]]
codepoint2name: dict[int, str] codepoint2name: Final[dict[int, str]]
entitydefs: dict[str, str] entitydefs: Final[dict[str, str]]

View file

@ -77,7 +77,7 @@ from _typeshed import MaybeNone, ReadableBuffer, SupportsRead, SupportsReadline,
from collections.abc import Callable, Iterable, Iterator, Mapping from collections.abc import Callable, Iterable, Iterator, Mapping
from email._policybase import _MessageT from email._policybase import _MessageT
from socket import socket from socket import socket
from typing import BinaryIO, Literal, TypeVar, overload from typing import BinaryIO, Final, TypeVar, overload
from typing_extensions import Self, TypeAlias from typing_extensions import Self, TypeAlias
__all__ = [ __all__ = [
@ -106,85 +106,85 @@ _DataType: TypeAlias = SupportsRead[bytes] | Iterable[ReadableBuffer] | Readable
_T = TypeVar("_T") _T = TypeVar("_T")
_HeaderValue: TypeAlias = ReadableBuffer | str | int _HeaderValue: TypeAlias = ReadableBuffer | str | int
HTTP_PORT: int HTTP_PORT: Final = 80
HTTPS_PORT: int HTTPS_PORT: Final = 443
# Keep these global constants in sync with http.HTTPStatus (http/__init__.pyi). # Keep these global constants in sync with http.HTTPStatus (http/__init__.pyi).
# They are present for backward compatibility reasons. # They are present for backward compatibility reasons.
CONTINUE: Literal[100] CONTINUE: Final = 100
SWITCHING_PROTOCOLS: Literal[101] SWITCHING_PROTOCOLS: Final = 101
PROCESSING: Literal[102] PROCESSING: Final = 102
EARLY_HINTS: Literal[103] EARLY_HINTS: Final = 103
OK: Literal[200] OK: Final = 200
CREATED: Literal[201] CREATED: Final = 201
ACCEPTED: Literal[202] ACCEPTED: Final = 202
NON_AUTHORITATIVE_INFORMATION: Literal[203] NON_AUTHORITATIVE_INFORMATION: Final = 203
NO_CONTENT: Literal[204] NO_CONTENT: Final = 204
RESET_CONTENT: Literal[205] RESET_CONTENT: Final = 205
PARTIAL_CONTENT: Literal[206] PARTIAL_CONTENT: Final = 206
MULTI_STATUS: Literal[207] MULTI_STATUS: Final = 207
ALREADY_REPORTED: Literal[208] ALREADY_REPORTED: Final = 208
IM_USED: Literal[226] IM_USED: Final = 226
MULTIPLE_CHOICES: Literal[300] MULTIPLE_CHOICES: Final = 300
MOVED_PERMANENTLY: Literal[301] MOVED_PERMANENTLY: Final = 301
FOUND: Literal[302] FOUND: Final = 302
SEE_OTHER: Literal[303] SEE_OTHER: Final = 303
NOT_MODIFIED: Literal[304] NOT_MODIFIED: Final = 304
USE_PROXY: Literal[305] USE_PROXY: Final = 305
TEMPORARY_REDIRECT: Literal[307] TEMPORARY_REDIRECT: Final = 307
PERMANENT_REDIRECT: Literal[308] PERMANENT_REDIRECT: Final = 308
BAD_REQUEST: Literal[400] BAD_REQUEST: Final = 400
UNAUTHORIZED: Literal[401] UNAUTHORIZED: Final = 401
PAYMENT_REQUIRED: Literal[402] PAYMENT_REQUIRED: Final = 402
FORBIDDEN: Literal[403] FORBIDDEN: Final = 403
NOT_FOUND: Literal[404] NOT_FOUND: Final = 404
METHOD_NOT_ALLOWED: Literal[405] METHOD_NOT_ALLOWED: Final = 405
NOT_ACCEPTABLE: Literal[406] NOT_ACCEPTABLE: Final = 406
PROXY_AUTHENTICATION_REQUIRED: Literal[407] PROXY_AUTHENTICATION_REQUIRED: Final = 407
REQUEST_TIMEOUT: Literal[408] REQUEST_TIMEOUT: Final = 408
CONFLICT: Literal[409] CONFLICT: Final = 409
GONE: Literal[410] GONE: Final = 410
LENGTH_REQUIRED: Literal[411] LENGTH_REQUIRED: Final = 411
PRECONDITION_FAILED: Literal[412] PRECONDITION_FAILED: Final = 412
if sys.version_info >= (3, 13): if sys.version_info >= (3, 13):
CONTENT_TOO_LARGE: Literal[413] CONTENT_TOO_LARGE: Final = 413
REQUEST_ENTITY_TOO_LARGE: Literal[413] REQUEST_ENTITY_TOO_LARGE: Final = 413
if sys.version_info >= (3, 13): if sys.version_info >= (3, 13):
URI_TOO_LONG: Literal[414] URI_TOO_LONG: Final = 414
REQUEST_URI_TOO_LONG: Literal[414] REQUEST_URI_TOO_LONG: Final = 414
UNSUPPORTED_MEDIA_TYPE: Literal[415] UNSUPPORTED_MEDIA_TYPE: Final = 415
if sys.version_info >= (3, 13): if sys.version_info >= (3, 13):
RANGE_NOT_SATISFIABLE: Literal[416] RANGE_NOT_SATISFIABLE: Final = 416
REQUESTED_RANGE_NOT_SATISFIABLE: Literal[416] REQUESTED_RANGE_NOT_SATISFIABLE: Final = 416
EXPECTATION_FAILED: Literal[417] EXPECTATION_FAILED: Final = 417
IM_A_TEAPOT: Literal[418] IM_A_TEAPOT: Final = 418
MISDIRECTED_REQUEST: Literal[421] MISDIRECTED_REQUEST: Final = 421
if sys.version_info >= (3, 13): if sys.version_info >= (3, 13):
UNPROCESSABLE_CONTENT: Literal[422] UNPROCESSABLE_CONTENT: Final = 422
UNPROCESSABLE_ENTITY: Literal[422] UNPROCESSABLE_ENTITY: Final = 422
LOCKED: Literal[423] LOCKED: Final = 423
FAILED_DEPENDENCY: Literal[424] FAILED_DEPENDENCY: Final = 424
TOO_EARLY: Literal[425] TOO_EARLY: Final = 425
UPGRADE_REQUIRED: Literal[426] UPGRADE_REQUIRED: Final = 426
PRECONDITION_REQUIRED: Literal[428] PRECONDITION_REQUIRED: Final = 428
TOO_MANY_REQUESTS: Literal[429] TOO_MANY_REQUESTS: Final = 429
REQUEST_HEADER_FIELDS_TOO_LARGE: Literal[431] REQUEST_HEADER_FIELDS_TOO_LARGE: Final = 431
UNAVAILABLE_FOR_LEGAL_REASONS: Literal[451] UNAVAILABLE_FOR_LEGAL_REASONS: Final = 451
INTERNAL_SERVER_ERROR: Literal[500] INTERNAL_SERVER_ERROR: Final = 500
NOT_IMPLEMENTED: Literal[501] NOT_IMPLEMENTED: Final = 501
BAD_GATEWAY: Literal[502] BAD_GATEWAY: Final = 502
SERVICE_UNAVAILABLE: Literal[503] SERVICE_UNAVAILABLE: Final = 503
GATEWAY_TIMEOUT: Literal[504] GATEWAY_TIMEOUT: Final = 504
HTTP_VERSION_NOT_SUPPORTED: Literal[505] HTTP_VERSION_NOT_SUPPORTED: Final = 505
VARIANT_ALSO_NEGOTIATES: Literal[506] VARIANT_ALSO_NEGOTIATES: Final = 506
INSUFFICIENT_STORAGE: Literal[507] INSUFFICIENT_STORAGE: Final = 507
LOOP_DETECTED: Literal[508] LOOP_DETECTED: Final = 508
NOT_EXTENDED: Literal[510] NOT_EXTENDED: Final = 510
NETWORK_AUTHENTICATION_REQUIRED: Literal[511] NETWORK_AUTHENTICATION_REQUIRED: Final = 511
responses: dict[int, str] responses: dict[int, str]

View file

@ -433,46 +433,91 @@ class SimpleHTTPRequestHandler(BaseHTTPRequestHandler):
def executable(path: StrPath) -> bool: # undocumented def executable(path: StrPath) -> bool: # undocumented
"""Test for executable file.""" """Test for executable file."""
@deprecated("Deprecated in Python 3.13; removal scheduled for Python 3.15") if sys.version_info >= (3, 13):
class CGIHTTPRequestHandler(SimpleHTTPRequestHandler): @deprecated("Deprecated since Python 3.13; will be removed in Python 3.15.")
"""Complete HTTP server with GET, HEAD and POST commands. class CGIHTTPRequestHandler(SimpleHTTPRequestHandler):
"""Complete HTTP server with GET, HEAD and POST commands.
GET and HEAD also support running CGI scripts. GET and HEAD also support running CGI scripts.
The POST command is *only* implemented for CGI scripts. The POST command is *only* implemented for CGI scripts.
"""
cgi_directories: list[str]
have_fork: bool # undocumented
def do_POST(self) -> None:
"""Serve a POST request.
This is only implemented for CGI scripts.
""" """
def is_cgi(self) -> bool: # undocumented cgi_directories: list[str]
"""Test whether self.path corresponds to a CGI script. have_fork: bool # undocumented
def do_POST(self) -> None:
"""Serve a POST request.
Returns True and updates the cgi_info attribute to the tuple This is only implemented for CGI scripts.
(dir, rest) if self.path requires running a CGI script.
Returns False otherwise.
If any exception is raised, the caller should assume that """
self.path was rejected as invalid and act accordingly.
The default implementation tests whether the normalized url def is_cgi(self) -> bool: # undocumented
path begins with one of the strings in self.cgi_directories """Test whether self.path corresponds to a CGI script.
(and the next character is a '/' or the end of the string).
Returns True and updates the cgi_info attribute to the tuple
(dir, rest) if self.path requires running a CGI script.
Returns False otherwise.
If any exception is raised, the caller should assume that
self.path was rejected as invalid and act accordingly.
The default implementation tests whether the normalized url
path begins with one of the strings in self.cgi_directories
(and the next character is a '/' or the end of the string).
"""
def is_executable(self, path: StrPath) -> bool: # undocumented
"""Test whether argument path is an executable file."""
def is_python(self, path: StrPath) -> bool: # undocumented
"""Test whether argument path is a Python script."""
def run_cgi(self) -> None: # undocumented
"""Execute a CGI script."""
else:
class CGIHTTPRequestHandler(SimpleHTTPRequestHandler):
"""Complete HTTP server with GET, HEAD and POST commands.
GET and HEAD also support running CGI scripts.
The POST command is *only* implemented for CGI scripts.
""" """
def is_executable(self, path: StrPath) -> bool: # undocumented cgi_directories: list[str]
"""Test whether argument path is an executable file.""" have_fork: bool # undocumented
def do_POST(self) -> None:
"""Serve a POST request.
def is_python(self, path: StrPath) -> bool: # undocumented This is only implemented for CGI scripts.
"""Test whether argument path is a Python script."""
def run_cgi(self) -> None: # undocumented """
"""Execute a CGI script."""
def is_cgi(self) -> bool: # undocumented
"""Test whether self.path corresponds to a CGI script.
Returns True and updates the cgi_info attribute to the tuple
(dir, rest) if self.path requires running a CGI script.
Returns False otherwise.
If any exception is raised, the caller should assume that
self.path was rejected as invalid and act accordingly.
The default implementation tests whether the normalized url
path begins with one of the strings in self.cgi_directories
(and the next character is a '/' or the end of the string).
"""
def is_executable(self, path: StrPath) -> bool: # undocumented
"""Test whether argument path is an executable file."""
def is_python(self, path: StrPath) -> bool: # undocumented
"""Test whether argument path is a Python script."""
def run_cgi(self) -> None: # undocumented
"""Execute a CGI script."""

View file

@ -21,18 +21,18 @@ from _imp import (
from _typeshed import StrPath from _typeshed import StrPath
from os import PathLike from os import PathLike
from types import TracebackType from types import TracebackType
from typing import IO, Any, Protocol, type_check_only from typing import IO, Any, Final, Protocol, type_check_only
SEARCH_ERROR: int SEARCH_ERROR: Final = 0
PY_SOURCE: int PY_SOURCE: Final = 1
PY_COMPILED: int PY_COMPILED: Final = 2
C_EXTENSION: int C_EXTENSION: Final = 3
PY_RESOURCE: int PY_RESOURCE: Final = 4
PKG_DIRECTORY: int PKG_DIRECTORY: Final = 5
C_BUILTIN: int C_BUILTIN: Final = 6
PY_FROZEN: int PY_FROZEN: Final = 7
PY_CODERESOURCE: int PY_CODERESOURCE: Final = 8
IMP_HOOK: int IMP_HOOK: Final = 9
def new_module(name: str) -> types.ModuleType: def new_module(name: str) -> types.ModuleType:
"""**DEPRECATED** """**DEPRECATED**

View file

@ -81,7 +81,7 @@ if sys.version_info < (3, 12):
Deprecated since Python 3.3 Deprecated since Python 3.3
""" """
@deprecated("Deprecated as of Python 3.7: Use importlib.resources.abc.TraversableResources instead.") @deprecated("Deprecated since Python 3.7. Use `importlib.resources.abc.TraversableResources` instead.")
class ResourceLoader(Loader): class ResourceLoader(Loader):
"""Abstract base class for loaders which can return data from their """Abstract base class for loaders which can return data from their
back-end storage to facilitate reading data to perform an import. back-end storage to facilitate reading data to perform an import.
@ -176,7 +176,7 @@ class SourceLoader(_bootstrap_external.SourceLoader, ResourceLoader, ExecutionLo
""" """
@deprecated("Deprecated as of Python 3.3: Use importlib.resources.abc.SourceLoader.path_stats instead.") @deprecated("Deprecated since Python 3.3. Use `importlib.resources.abc.SourceLoader.path_stats` instead.")
def path_mtime(self, path: str) -> float: def path_mtime(self, path: str) -> float:
"""Return the (int) modification time for the path (str).""" """Return the (int) modification time for the path (str)."""

View file

@ -168,6 +168,7 @@ if sys.version_info >= (3, 12):
An immutable collection of selectable EntryPoint objects. An immutable collection of selectable EntryPoint objects.
""" """
__slots__ = ()
def __getitem__(self, name: str) -> EntryPoint: # type: ignore[override] def __getitem__(self, name: str) -> EntryPoint: # type: ignore[override]
""" """
Get the EntryPoint in self matching name. Get the EntryPoint in self matching name.

View file

@ -640,6 +640,7 @@ class Signature:
to parameters (simulating 'functools.partial' behavior.) to parameters (simulating 'functools.partial' behavior.)
""" """
__slots__ = ("_return_annotation", "_parameters")
def __init__( def __init__(
self, parameters: Sequence[Parameter] | None = None, *, return_annotation: Any = ..., __validate_parameters__: bool = True self, parameters: Sequence[Parameter] | None = None, *, return_annotation: Any = ..., __validate_parameters__: bool = True
) -> None: ) -> None:
@ -842,6 +843,7 @@ class Parameter:
`Parameter.KEYWORD_ONLY`, `Parameter.VAR_KEYWORD`. `Parameter.KEYWORD_ONLY`, `Parameter.VAR_KEYWORD`.
""" """
__slots__ = ("_name", "_kind", "_default", "_annotation")
def __init__(self, name: str, kind: _ParameterKind, *, default: Any = ..., annotation: Any = ...) -> None: ... def __init__(self, name: str, kind: _ParameterKind, *, default: Any = ..., annotation: Any = ...) -> None: ...
empty = _empty empty = _empty
@ -890,6 +892,7 @@ class BoundArguments:
Dict of keyword arguments values. Dict of keyword arguments values.
""" """
__slots__ = ("arguments", "_signature", "__weakref__")
arguments: OrderedDict[str, Any] arguments: OrderedDict[str, Any]
@property @property
def args(self) -> tuple[Any, ...]: ... def args(self) -> tuple[Any, ...]: ...

View file

@ -83,6 +83,7 @@ def ip_interface(
class _IPAddressBase: class _IPAddressBase:
"""The mother class.""" """The mother class."""
__slots__ = ()
@property @property
def compressed(self) -> str: def compressed(self) -> str:
"""Return the shorthand version of the IP address as a string.""" """Return the shorthand version of the IP address as a string."""
@ -111,6 +112,7 @@ class _BaseAddress(_IPAddressBase):
used by single IP addresses. used by single IP addresses.
""" """
__slots__ = ()
def __add__(self, other: int) -> Self: ... def __add__(self, other: int) -> Self: ...
def __hash__(self) -> int: ... def __hash__(self) -> int: ...
def __int__(self) -> int: ... def __int__(self) -> int: ...
@ -413,6 +415,7 @@ class _BaseV4:
""" """
__slots__ = ()
if sys.version_info >= (3, 14): if sys.version_info >= (3, 14):
version: Final = 4 version: Final = 4
max_prefixlen: Final = 32 max_prefixlen: Final = 32
@ -425,6 +428,7 @@ class _BaseV4:
class IPv4Address(_BaseV4, _BaseAddress): class IPv4Address(_BaseV4, _BaseAddress):
"""Represent and manipulate single IPv4 Addresses.""" """Represent and manipulate single IPv4 Addresses."""
__slots__ = ("_ip", "__weakref__")
def __init__(self, address: object) -> None: def __init__(self, address: object) -> None:
""" """
Args: Args:
@ -607,6 +611,7 @@ class _BaseV6:
""" """
__slots__ = ()
if sys.version_info >= (3, 14): if sys.version_info >= (3, 14):
version: Final = 6 version: Final = 6
max_prefixlen: Final = 128 max_prefixlen: Final = 128
@ -619,6 +624,7 @@ class _BaseV6:
class IPv6Address(_BaseV6, _BaseAddress): class IPv6Address(_BaseV6, _BaseAddress):
"""Represent and manipulate single IPv6 Addresses.""" """Represent and manipulate single IPv6 Addresses."""
__slots__ = ("_ip", "_scope_id", "__weakref__")
def __init__(self, address: object) -> None: def __init__(self, address: object) -> None:
"""Instantiate a new IPv6 address object. """Instantiate a new IPv6 address object.

View file

@ -314,7 +314,7 @@ class Logger(Filterer):
logger.warning("Houston, we have a %s", "bit of a problem", exc_info=True) logger.warning("Houston, we have a %s", "bit of a problem", exc_info=True)
""" """
@deprecated("Deprecated; use warning() instead.") @deprecated("Deprecated since Python 3.3. Use `Logger.warning()` instead.")
def warn( def warn(
self, self,
msg: object, msg: object,
@ -1005,7 +1005,7 @@ class LoggerAdapter(Generic[_L]):
Delegate a warning call to the underlying logger. Delegate a warning call to the underlying logger.
""" """
@deprecated("Deprecated; use warning() instead.") @deprecated("Deprecated since Python 3.3. Use `LoggerAdapter.warning()` instead.")
def warn( def warn(
self, self,
msg: object, msg: object,
@ -1189,7 +1189,7 @@ def warning(
format. format.
""" """
@deprecated("Deprecated; use warning() instead.") @deprecated("Deprecated since Python 3.3. Use `warning()` instead.")
def warn( def warn(
msg: object, msg: object,
*args: object, *args: object,
@ -1548,4 +1548,4 @@ class StringTemplateStyle(PercentStyle): # undocumented
_STYLES: Final[dict[str, tuple[PercentStyle, str]]] _STYLES: Final[dict[str, tuple[PercentStyle, str]]]
BASIC_FORMAT: Final[str] BASIC_FORMAT: Final = "%(levelname)s:%(name)s:%(message)s"

View file

@ -19,7 +19,7 @@ from typing_extensions import Required, TypeAlias
from . import Filter, Filterer, Formatter, Handler, Logger, _FilterType, _FormatStyle, _Level from . import Filter, Filterer, Formatter, Handler, Logger, _FilterType, _FormatStyle, _Level
DEFAULT_LOGGING_CONFIG_PORT: int DEFAULT_LOGGING_CONFIG_PORT: Final = 9030
RESET_ERROR: Final[int] # undocumented RESET_ERROR: Final[int] # undocumented
IDENTIFIER: Final[Pattern[str]] # undocumented IDENTIFIER: Final[Pattern[str]] # undocumented
@ -163,7 +163,7 @@ class ConvertingTuple(tuple[Any, ...], ConvertingMixin): # undocumented
@overload @overload
def __getitem__(self, key: slice) -> Any: ... def __getitem__(self, key: slice) -> Any: ...
class BaseConfigurator: # undocumented class BaseConfigurator:
""" """
The configurator base class which defines some useful defaults. The configurator base class which defines some useful defaults.
""" """
@ -176,6 +176,8 @@ class BaseConfigurator: # undocumented
value_converters: dict[str, str] value_converters: dict[str, str]
importer: Callable[..., Any] importer: Callable[..., Any]
config: dict[str, Any] # undocumented
def __init__(self, config: _DictConfigArgs | dict[str, Any]) -> None: ... def __init__(self, config: _DictConfigArgs | dict[str, Any]) -> None: ...
def resolve(self, s: str) -> Any: def resolve(self, s: str) -> Any:
""" """

View file

@ -23,12 +23,12 @@ from typing_extensions import Self
_T = TypeVar("_T") _T = TypeVar("_T")
DEFAULT_TCP_LOGGING_PORT: Final[int] DEFAULT_TCP_LOGGING_PORT: Final = 9020
DEFAULT_UDP_LOGGING_PORT: Final[int] DEFAULT_UDP_LOGGING_PORT: Final = 9021
DEFAULT_HTTP_LOGGING_PORT: Final[int] DEFAULT_HTTP_LOGGING_PORT: Final = 9022
DEFAULT_SOAP_LOGGING_PORT: Final[int] DEFAULT_SOAP_LOGGING_PORT: Final = 9023
SYSLOG_UDP_PORT: Final[int] SYSLOG_UDP_PORT: Final = 514
SYSLOG_TCP_PORT: Final[int] SYSLOG_TCP_PORT: Final = 514
class WatchedFileHandler(FileHandler): class WatchedFileHandler(FileHandler):
""" """

View file

@ -1,26 +1,26 @@
import sys import sys
from collections.abc import Container, Iterable, Sequence from collections.abc import Container, Iterable, Sequence
from types import ModuleType from types import ModuleType
from typing import Any, Literal from typing import Any, Final
if sys.platform == "win32": if sys.platform == "win32":
from _msi import * from _msi import *
from _msi import _Database from _msi import _Database
AMD64: bool AMD64: Final[bool]
Win64: bool Win64: Final[bool]
datasizemask: Literal[0x00FF] datasizemask: Final = 0x00FF
type_valid: Literal[0x0100] type_valid: Final = 0x0100
type_localizable: Literal[0x0200] type_localizable: Final = 0x0200
typemask: Literal[0x0C00] typemask: Final = 0x0C00
type_long: Literal[0x0000] type_long: Final = 0x0000
type_short: Literal[0x0400] type_short: Final = 0x0400
type_string: Literal[0x0C00] type_string: Final = 0x0C00
type_binary: Literal[0x0800] type_binary: Final = 0x0800
type_nullable: Literal[0x1000] type_nullable: Final = 0x1000
type_key: Literal[0x2000] type_key: Final = 0x2000
knownbits: Literal[0x3FFF] knownbits: Final = 0x3FFF
class Table: class Table:
name: str name: str

View file

@ -1,4 +1,5 @@
import sys import sys
from typing import Final
if sys.platform == "win32": if sys.platform == "win32":
from . import Table from . import Table
@ -89,6 +90,6 @@ if sys.platform == "win32":
Upgrade: Table Upgrade: Table
Verb: Table Verb: Table
tables: list[Table] tables: Final[list[Table]]
_Validation_records: list[tuple[str, str, str, int | None, int | None, str | None, int | None, str | None, str | None, str]] _Validation_records: list[tuple[str, str, str, int | None, int | None, str | None, int | None, str | None, str | None, str]]

View file

@ -1,13 +1,14 @@
import sys import sys
from typing import Final
from typing_extensions import TypeAlias from typing_extensions import TypeAlias
if sys.platform == "win32": if sys.platform == "win32":
_SequenceType: TypeAlias = list[tuple[str, str | None, int]] _SequenceType: TypeAlias = list[tuple[str, str | None, int]]
AdminExecuteSequence: _SequenceType AdminExecuteSequence: Final[_SequenceType]
AdminUISequence: _SequenceType AdminUISequence: Final[_SequenceType]
AdvtExecuteSequence: _SequenceType AdvtExecuteSequence: Final[_SequenceType]
InstallExecuteSequence: _SequenceType InstallExecuteSequence: Final[_SequenceType]
InstallUISequence: _SequenceType InstallUISequence: Final[_SequenceType]
tables: list[str] tables: Final[list[str]]

View file

@ -1,7 +1,8 @@
import sys import sys
from typing import Final
if sys.platform == "win32": if sys.platform == "win32":
ActionText: list[tuple[str, str, str | None]] ActionText: Final[list[tuple[str, str, str | None]]]
UIText: list[tuple[str, str | None]] UIText: Final[list[tuple[str, str | None]]]
dirname: str dirname: str
tables: list[str] tables: Final[list[str]]

View file

@ -9,10 +9,10 @@ if sys.platform == "win32":
LK_NBLCK: Final = 2 LK_NBLCK: Final = 2
LK_RLCK: Final = 3 LK_RLCK: Final = 3
LK_NBRLCK: Final = 4 LK_NBRLCK: Final = 4
SEM_FAILCRITICALERRORS: int SEM_FAILCRITICALERRORS: Final = 0x0001
SEM_NOALIGNMENTFAULTEXCEPT: int SEM_NOALIGNMENTFAULTEXCEPT: Final = 0x0004
SEM_NOGPFAULTERRORBOX: int SEM_NOGPFAULTERRORBOX: Final = 0x0002
SEM_NOOPENFILEERRORBOX: int SEM_NOOPENFILEERRORBOX: Final = 0x8000
def locking(fd: int, mode: int, nbytes: int, /) -> None: def locking(fd: int, mode: int, nbytes: int, /) -> None:
"""Lock part of a file based on file descriptor fd from the C runtime. """Lock part of a file based on file descriptor fd from the C runtime.

View file

@ -42,6 +42,7 @@ class Token:
Type to uniquely identify a shared object Type to uniquely identify a shared object
""" """
__slots__ = ("typeid", "address", "id")
typeid: str | bytes | None typeid: str | bytes | None
address: _Address | None address: _Address | None
id: str | bytes | int | None id: str | bytes | int | None

View file

@ -60,7 +60,7 @@ def log_to_stderr(level: _LoggingLevel | None = None) -> Logger:
def is_abstract_socket_namespace(address: str | bytes | None) -> bool: ... def is_abstract_socket_namespace(address: str | bytes | None) -> bool: ...
abstract_sockets_supported: bool abstract_sockets_supported: Final[bool]
def get_temp_dir() -> str: ... def get_temp_dir() -> str: ...
def register_after_fork(obj: _T, func: Callable[[_T], object]) -> None: ... def register_after_fork(obj: _T, func: Callable[[_T], object]) -> None: ...

View file

@ -8,13 +8,13 @@ import sys
from typing_extensions import deprecated from typing_extensions import deprecated
if sys.version_info >= (3, 14): if sys.version_info >= (3, 14):
@deprecated("nturl2path module was deprecated since Python 3.14") @deprecated("The `nturl2path` module is deprecated since Python 3.14.")
def url2pathname(url: str) -> str: def url2pathname(url: str) -> str:
"""OS-specific conversion from a relative URL of the 'file' scheme """OS-specific conversion from a relative URL of the 'file' scheme
to a file system path; not recommended for general use. to a file system path; not recommended for general use.
""" """
@deprecated("nturl2path module was deprecated since Python 3.14") @deprecated("The `nturl2path` module is deprecated since Python 3.14.")
def pathname2url(p: str) -> str: def pathname2url(p: str) -> str:
"""OS-specific conversion from a file system path to a relative URL """OS-specific conversion from a file system path to a relative URL
of the 'file' scheme; not recommended for general use. of the 'file' scheme; not recommended for general use.

View file

@ -72,6 +72,7 @@ class Number(metaclass=ABCMeta):
caring what kind, use isinstance(x, Number). caring what kind, use isinstance(x, Number).
""" """
__slots__ = ()
@abstractmethod @abstractmethod
def __hash__(self) -> int: def __hash__(self) -> int:
"""The type of the None singleton.""" """The type of the None singleton."""
@ -89,6 +90,7 @@ class Complex(Number, _ComplexLike):
type as described below. type as described below.
""" """
__slots__ = ()
@abstractmethod @abstractmethod
def __complex__(self) -> complex: def __complex__(self) -> complex:
"""Return a builtin complex instance. Called for complex(self).""" """Return a builtin complex instance. Called for complex(self)."""
@ -182,6 +184,7 @@ class Real(Complex, _RealLike):
Real also provides defaults for the derived operations. Real also provides defaults for the derived operations.
""" """
__slots__ = ()
@abstractmethod @abstractmethod
def __float__(self) -> float: def __float__(self) -> float:
"""Any Real can be converted to a native float object. """Any Real can be converted to a native float object.
@ -290,6 +293,7 @@ class Real(Complex, _RealLike):
class Rational(Real): class Rational(Real):
""".numerator and .denominator should be in lowest terms.""" """.numerator and .denominator should be in lowest terms."""
__slots__ = ()
@property @property
@abstractmethod @abstractmethod
def numerator(self) -> _IntegralLike: def numerator(self) -> _IntegralLike:
@ -321,6 +325,7 @@ class Integral(Rational, _IntegralLike):
bit-string operations. bit-string operations.
""" """
__slots__ = ()
@abstractmethod @abstractmethod
def __int__(self) -> int: def __int__(self) -> int:
"""int(self)""" """int(self)"""

View file

@ -4,7 +4,7 @@ operate on bytecodes (e.g. peephole optimizers).
""" """
import sys import sys
from typing import Literal from typing import Final, Literal
__all__ = [ __all__ = [
"cmp_op", "cmp_op",
@ -29,25 +29,25 @@ if sys.version_info >= (3, 13):
__all__ += ["hasjump"] __all__ += ["hasjump"]
cmp_op: tuple[Literal["<"], Literal["<="], Literal["=="], Literal["!="], Literal[">"], Literal[">="]] cmp_op: tuple[Literal["<"], Literal["<="], Literal["=="], Literal["!="], Literal[">"], Literal[">="]]
hasconst: list[int] hasconst: Final[list[int]]
hasname: list[int] hasname: Final[list[int]]
hasjrel: list[int] hasjrel: Final[list[int]]
hasjabs: list[int] hasjabs: Final[list[int]]
haslocal: list[int] haslocal: Final[list[int]]
hascompare: list[int] hascompare: Final[list[int]]
hasfree: list[int] hasfree: Final[list[int]]
if sys.version_info >= (3, 12): if sys.version_info >= (3, 12):
hasarg: list[int] hasarg: Final[list[int]]
hasexc: list[int] hasexc: Final[list[int]]
else: else:
hasnargs: list[int] hasnargs: Final[list[int]]
if sys.version_info >= (3, 13): if sys.version_info >= (3, 13):
hasjump: list[int] hasjump: Final[list[int]]
opname: list[str] opname: Final[list[str]]
opmap: dict[str, int] opmap: Final[dict[str, int]]
HAVE_ARGUMENT: int HAVE_ARGUMENT: Final = 43
EXTENDED_ARG: int EXTENDED_ARG: Final = 69
def stack_effect(opcode: int, oparg: int | None = None, /, *, jump: bool | None = None) -> int: def stack_effect(opcode: int, oparg: int | None = None, /, *, jump: bool | None = None) -> int:
"""Compute the stack effect of the opcode.""" """Compute the stack effect of the opcode."""

View file

@ -532,22 +532,22 @@ supports_follow_symlinks: set[Callable[..., Any]]
if sys.platform != "win32": if sys.platform != "win32":
# Unix only # Unix only
PRIO_PROCESS: int PRIO_PROCESS: Final[int]
PRIO_PGRP: int PRIO_PGRP: Final[int]
PRIO_USER: int PRIO_USER: Final[int]
F_LOCK: int F_LOCK: Final[int]
F_TLOCK: int F_TLOCK: Final[int]
F_ULOCK: int F_ULOCK: Final[int]
F_TEST: int F_TEST: Final[int]
if sys.platform != "darwin": if sys.platform != "darwin":
POSIX_FADV_NORMAL: int POSIX_FADV_NORMAL: Final[int]
POSIX_FADV_SEQUENTIAL: int POSIX_FADV_SEQUENTIAL: Final[int]
POSIX_FADV_RANDOM: int POSIX_FADV_RANDOM: Final[int]
POSIX_FADV_NOREUSE: int POSIX_FADV_NOREUSE: Final[int]
POSIX_FADV_WILLNEED: int POSIX_FADV_WILLNEED: Final[int]
POSIX_FADV_DONTNEED: int POSIX_FADV_DONTNEED: Final[int]
if sys.platform != "linux" and sys.platform != "darwin": if sys.platform != "linux" and sys.platform != "darwin":
# In the os-module docs, these are marked as being available # In the os-module docs, these are marked as being available
@ -557,69 +557,69 @@ if sys.platform != "win32":
# so the sys-module docs recommend doing `if sys.platform.startswith('freebsd')` # so the sys-module docs recommend doing `if sys.platform.startswith('freebsd')`
# to detect FreeBSD builds. Unfortunately that would be too dynamic # to detect FreeBSD builds. Unfortunately that would be too dynamic
# for type checkers, however. # for type checkers, however.
SF_NODISKIO: int SF_NODISKIO: Final[int]
SF_MNOWAIT: int SF_MNOWAIT: Final[int]
SF_SYNC: int SF_SYNC: Final[int]
if sys.version_info >= (3, 11): if sys.version_info >= (3, 11):
SF_NOCACHE: int SF_NOCACHE: Final[int]
if sys.platform == "linux": if sys.platform == "linux":
XATTR_SIZE_MAX: int XATTR_SIZE_MAX: Final[int]
XATTR_CREATE: int XATTR_CREATE: Final[int]
XATTR_REPLACE: int XATTR_REPLACE: Final[int]
P_PID: int P_PID: Final[int]
P_PGID: int P_PGID: Final[int]
P_ALL: int P_ALL: Final[int]
if sys.platform == "linux": if sys.platform == "linux":
P_PIDFD: int P_PIDFD: Final[int]
WEXITED: int WEXITED: Final[int]
WSTOPPED: int WSTOPPED: Final[int]
WNOWAIT: int WNOWAIT: Final[int]
CLD_EXITED: int CLD_EXITED: Final[int]
CLD_DUMPED: int CLD_DUMPED: Final[int]
CLD_TRAPPED: int CLD_TRAPPED: Final[int]
CLD_CONTINUED: int CLD_CONTINUED: Final[int]
CLD_KILLED: int CLD_KILLED: Final[int]
CLD_STOPPED: int CLD_STOPPED: Final[int]
SCHED_OTHER: int SCHED_OTHER: Final[int]
SCHED_FIFO: int SCHED_FIFO: Final[int]
SCHED_RR: int SCHED_RR: Final[int]
if sys.platform != "darwin" and sys.platform != "linux": if sys.platform != "darwin" and sys.platform != "linux":
SCHED_SPORADIC: int SCHED_SPORADIC: Final[int]
if sys.platform == "linux": if sys.platform == "linux":
SCHED_BATCH: int SCHED_BATCH: Final[int]
SCHED_IDLE: int SCHED_IDLE: Final[int]
SCHED_RESET_ON_FORK: int SCHED_RESET_ON_FORK: Final[int]
if sys.version_info >= (3, 14) and sys.platform == "linux": if sys.version_info >= (3, 14) and sys.platform == "linux":
SCHED_DEADLINE: int SCHED_DEADLINE: Final[int]
SCHED_NORMAL: int SCHED_NORMAL: Final[int]
if sys.platform != "win32": if sys.platform != "win32":
RTLD_LAZY: int RTLD_LAZY: Final[int]
RTLD_NOW: int RTLD_NOW: Final[int]
RTLD_GLOBAL: int RTLD_GLOBAL: Final[int]
RTLD_LOCAL: int RTLD_LOCAL: Final[int]
RTLD_NODELETE: int RTLD_NODELETE: Final[int]
RTLD_NOLOAD: int RTLD_NOLOAD: Final[int]
if sys.platform == "linux": if sys.platform == "linux":
RTLD_DEEPBIND: int RTLD_DEEPBIND: Final[int]
GRND_NONBLOCK: int GRND_NONBLOCK: Final[int]
GRND_RANDOM: int GRND_RANDOM: Final[int]
if sys.platform == "darwin" and sys.version_info >= (3, 12): if sys.platform == "darwin" and sys.version_info >= (3, 12):
PRIO_DARWIN_BG: int PRIO_DARWIN_BG: Final[int]
PRIO_DARWIN_NONUI: int PRIO_DARWIN_NONUI: Final[int]
PRIO_DARWIN_PROCESS: int PRIO_DARWIN_PROCESS: Final[int]
PRIO_DARWIN_THREAD: int PRIO_DARWIN_THREAD: Final[int]
SEEK_SET: Final = 0 SEEK_SET: Final = 0
SEEK_CUR: Final = 1 SEEK_CUR: Final = 1
@ -628,74 +628,74 @@ if sys.platform != "win32":
SEEK_DATA: Final = 3 SEEK_DATA: Final = 3
SEEK_HOLE: Final = 4 SEEK_HOLE: Final = 4
O_RDONLY: int O_RDONLY: Final[int]
O_WRONLY: int O_WRONLY: Final[int]
O_RDWR: int O_RDWR: Final[int]
O_APPEND: int O_APPEND: Final[int]
O_CREAT: int O_CREAT: Final[int]
O_EXCL: int O_EXCL: Final[int]
O_TRUNC: int O_TRUNC: Final[int]
if sys.platform == "win32": if sys.platform == "win32":
O_BINARY: int O_BINARY: Final[int]
O_NOINHERIT: int O_NOINHERIT: Final[int]
O_SHORT_LIVED: int O_SHORT_LIVED: Final[int]
O_TEMPORARY: int O_TEMPORARY: Final[int]
O_RANDOM: int O_RANDOM: Final[int]
O_SEQUENTIAL: int O_SEQUENTIAL: Final[int]
O_TEXT: int O_TEXT: Final[int]
if sys.platform != "win32": if sys.platform != "win32":
O_DSYNC: int O_DSYNC: Final[int]
O_SYNC: int O_SYNC: Final[int]
O_NDELAY: int O_NDELAY: Final[int]
O_NONBLOCK: int O_NONBLOCK: Final[int]
O_NOCTTY: int O_NOCTTY: Final[int]
O_CLOEXEC: int O_CLOEXEC: Final[int]
O_ASYNC: int # Gnu extension if in C library O_ASYNC: Final[int] # Gnu extension if in C library
O_DIRECTORY: int # Gnu extension if in C library O_DIRECTORY: Final[int] # Gnu extension if in C library
O_NOFOLLOW: int # Gnu extension if in C library O_NOFOLLOW: Final[int] # Gnu extension if in C library
O_ACCMODE: int # TODO: when does this exist? O_ACCMODE: Final[int] # TODO: when does this exist?
if sys.platform == "linux": if sys.platform == "linux":
O_RSYNC: int O_RSYNC: Final[int]
O_DIRECT: int # Gnu extension if in C library O_DIRECT: Final[int] # Gnu extension if in C library
O_NOATIME: int # Gnu extension if in C library O_NOATIME: Final[int] # Gnu extension if in C library
O_PATH: int # Gnu extension if in C library O_PATH: Final[int] # Gnu extension if in C library
O_TMPFILE: int # Gnu extension if in C library O_TMPFILE: Final[int] # Gnu extension if in C library
O_LARGEFILE: int # Gnu extension if in C library O_LARGEFILE: Final[int] # Gnu extension if in C library
if sys.platform != "linux" and sys.platform != "win32": if sys.platform != "linux" and sys.platform != "win32":
O_SHLOCK: int O_SHLOCK: Final[int]
O_EXLOCK: int O_EXLOCK: Final[int]
if sys.platform == "darwin" and sys.version_info >= (3, 10): if sys.platform == "darwin" and sys.version_info >= (3, 10):
O_EVTONLY: int O_EVTONLY: Final[int]
O_NOFOLLOW_ANY: int O_NOFOLLOW_ANY: Final[int]
O_SYMLINK: int O_SYMLINK: Final[int]
if sys.platform != "win32" and sys.version_info >= (3, 10): if sys.platform != "win32" and sys.version_info >= (3, 10):
O_FSYNC: int O_FSYNC: Final[int]
if sys.platform != "linux" and sys.platform != "win32" and sys.version_info >= (3, 13): if sys.platform != "linux" and sys.platform != "win32" and sys.version_info >= (3, 13):
O_EXEC: int O_EXEC: Final[int]
O_SEARCH: int O_SEARCH: Final[int]
if sys.platform != "win32" and sys.platform != "darwin": if sys.platform != "win32" and sys.platform != "darwin":
# posix, but apparently missing on macos # posix, but apparently missing on macos
ST_APPEND: int ST_APPEND: Final[int]
ST_MANDLOCK: int ST_MANDLOCK: Final[int]
ST_NOATIME: int ST_NOATIME: Final[int]
ST_NODEV: int ST_NODEV: Final[int]
ST_NODIRATIME: int ST_NODIRATIME: Final[int]
ST_NOEXEC: int ST_NOEXEC: Final[int]
ST_RELATIME: int ST_RELATIME: Final[int]
ST_SYNCHRONOUS: int ST_SYNCHRONOUS: Final[int]
ST_WRITE: int ST_WRITE: Final[int]
if sys.platform != "win32": if sys.platform != "win32":
NGROUPS_MAX: int NGROUPS_MAX: Final[int]
ST_NOSUID: int ST_NOSUID: Final[int]
ST_RDONLY: int ST_RDONLY: Final[int]
curdir: str curdir: str
pardir: str pardir: str
@ -711,10 +711,10 @@ linesep: Literal["\n", "\r\n"]
devnull: str devnull: str
name: str name: str
F_OK: int F_OK: Final = 0
R_OK: int R_OK: Final = 4
W_OK: int W_OK: Final = 2
X_OK: int X_OK: Final = 1
_EnvironCodeFunc: TypeAlias = Callable[[AnyStr], AnyStr] _EnvironCodeFunc: TypeAlias = Callable[[AnyStr], AnyStr]
@ -753,47 +753,47 @@ if sys.platform != "win32":
environb: _Environ[bytes] environb: _Environ[bytes]
if sys.version_info >= (3, 11) or sys.platform != "win32": if sys.version_info >= (3, 11) or sys.platform != "win32":
EX_OK: int EX_OK: Final[int]
if sys.platform != "win32": if sys.platform != "win32":
confstr_names: dict[str, int] confstr_names: dict[str, int]
pathconf_names: dict[str, int] pathconf_names: dict[str, int]
sysconf_names: dict[str, int] sysconf_names: dict[str, int]
EX_USAGE: int EX_USAGE: Final[int]
EX_DATAERR: int EX_DATAERR: Final[int]
EX_NOINPUT: int EX_NOINPUT: Final[int]
EX_NOUSER: int EX_NOUSER: Final[int]
EX_NOHOST: int EX_NOHOST: Final[int]
EX_UNAVAILABLE: int EX_UNAVAILABLE: Final[int]
EX_SOFTWARE: int EX_SOFTWARE: Final[int]
EX_OSERR: int EX_OSERR: Final[int]
EX_OSFILE: int EX_OSFILE: Final[int]
EX_CANTCREAT: int EX_CANTCREAT: Final[int]
EX_IOERR: int EX_IOERR: Final[int]
EX_TEMPFAIL: int EX_TEMPFAIL: Final[int]
EX_PROTOCOL: int EX_PROTOCOL: Final[int]
EX_NOPERM: int EX_NOPERM: Final[int]
EX_CONFIG: int EX_CONFIG: Final[int]
# Exists on some Unix platforms, e.g. Solaris. # Exists on some Unix platforms, e.g. Solaris.
if sys.platform != "win32" and sys.platform != "darwin" and sys.platform != "linux": if sys.platform != "win32" and sys.platform != "darwin" and sys.platform != "linux":
EX_NOTFOUND: int EX_NOTFOUND: Final[int]
P_NOWAIT: int P_NOWAIT: Final[int]
P_NOWAITO: int P_NOWAITO: Final[int]
P_WAIT: int P_WAIT: Final[int]
if sys.platform == "win32": if sys.platform == "win32":
P_DETACH: int P_DETACH: Final[int]
P_OVERLAY: int P_OVERLAY: Final[int]
# wait()/waitpid() options # wait()/waitpid() options
if sys.platform != "win32": if sys.platform != "win32":
WNOHANG: int # Unix only WNOHANG: Final[int] # Unix only
WCONTINUED: int # some Unix systems WCONTINUED: Final[int] # some Unix systems
WUNTRACED: int # Unix only WUNTRACED: Final[int] # Unix only
TMP_MAX: int # Undocumented, but used by tempfile TMP_MAX: Final[int] # Undocumented, but used by tempfile
# ----- os classes (structures) ----- # ----- os classes (structures) -----
@final @final
@ -937,6 +937,7 @@ In the future, this property will contain the last metadata change time."""
class PathLike(ABC, Protocol[AnyStr_co]): # type: ignore[misc] # pyright: ignore[reportGeneralTypeIssues] class PathLike(ABC, Protocol[AnyStr_co]): # type: ignore[misc] # pyright: ignore[reportGeneralTypeIssues]
"""Abstract base class for implementing the file system path protocol.""" """Abstract base class for implementing the file system path protocol."""
__slots__ = ()
@abstractmethod @abstractmethod
def __fspath__(self) -> AnyStr_co: def __fspath__(self) -> AnyStr_co:
"""Return the file system path representation of the object.""" """Return the file system path representation of the object."""
@ -1575,11 +1576,11 @@ if sys.platform != "win32":
""" """
if sys.platform != "darwin": if sys.platform != "darwin":
if sys.version_info >= (3, 10): if sys.version_info >= (3, 10):
RWF_APPEND: int # docs say available on 3.7+, stubtest says otherwise RWF_APPEND: Final[int] # docs say available on 3.7+, stubtest says otherwise
RWF_DSYNC: int RWF_DSYNC: Final[int]
RWF_SYNC: int RWF_SYNC: Final[int]
RWF_HIPRI: int RWF_HIPRI: Final[int]
RWF_NOWAIT: int RWF_NOWAIT: Final[int]
if sys.platform == "linux": if sys.platform == "linux":
def sendfile(out_fd: FileDescriptor, in_fd: FileDescriptor, offset: int | None, count: int) -> int: def sendfile(out_fd: FileDescriptor, in_fd: FileDescriptor, offset: int | None, count: int) -> int:
@ -1590,8 +1591,8 @@ if sys.platform != "win32":
in_fd: FileDescriptor, in_fd: FileDescriptor,
offset: int, offset: int,
count: int, count: int,
headers: Sequence[ReadableBuffer] = ..., headers: Sequence[ReadableBuffer] = (),
trailers: Sequence[ReadableBuffer] = ..., trailers: Sequence[ReadableBuffer] = (),
flags: int = 0, flags: int = 0,
) -> int: # FreeBSD and Mac OS X only ) -> int: # FreeBSD and Mac OS X only
"""Copy count bytes from file descriptor in_fd to file descriptor out_fd.""" """Copy count bytes from file descriptor in_fd to file descriptor out_fd."""
@ -2816,9 +2817,9 @@ else:
scheduler scheduler
A tuple with the scheduler policy (optional) and parameters. A tuple with the scheduler policy (optional) and parameters.
""" """
POSIX_SPAWN_OPEN: int POSIX_SPAWN_OPEN: Final = 0
POSIX_SPAWN_CLOSE: int POSIX_SPAWN_CLOSE: Final = 1
POSIX_SPAWN_DUP2: int POSIX_SPAWN_DUP2: Final = 2
if sys.platform != "win32": if sys.platform != "win32":
@final @final
@ -2978,23 +2979,23 @@ if sys.platform == "win32":
""" """
if sys.platform == "linux": if sys.platform == "linux":
MFD_CLOEXEC: int MFD_CLOEXEC: Final[int]
MFD_ALLOW_SEALING: int MFD_ALLOW_SEALING: Final[int]
MFD_HUGETLB: int MFD_HUGETLB: Final[int]
MFD_HUGE_SHIFT: int MFD_HUGE_SHIFT: Final[int]
MFD_HUGE_MASK: int MFD_HUGE_MASK: Final[int]
MFD_HUGE_64KB: int MFD_HUGE_64KB: Final[int]
MFD_HUGE_512KB: int MFD_HUGE_512KB: Final[int]
MFD_HUGE_1MB: int MFD_HUGE_1MB: Final[int]
MFD_HUGE_2MB: int MFD_HUGE_2MB: Final[int]
MFD_HUGE_8MB: int MFD_HUGE_8MB: Final[int]
MFD_HUGE_16MB: int MFD_HUGE_16MB: Final[int]
MFD_HUGE_32MB: int MFD_HUGE_32MB: Final[int]
MFD_HUGE_256MB: int MFD_HUGE_256MB: Final[int]
MFD_HUGE_512MB: int MFD_HUGE_512MB: Final[int]
MFD_HUGE_1GB: int MFD_HUGE_1GB: Final[int]
MFD_HUGE_2GB: int MFD_HUGE_2GB: Final[int]
MFD_HUGE_16GB: int MFD_HUGE_16GB: Final[int]
def memfd_create(name: str, flags: int = ...) -> int: ... def memfd_create(name: str, flags: int = ...) -> int: ...
def copy_file_range(src: int, dst: int, count: int, offset_src: int | None = ..., offset_dst: int | None = ...) -> int: def copy_file_range(src: int, dst: int, count: int, offset_src: int | None = ..., offset_dst: int | None = ...) -> int:
"""Copy count bytes from one file descriptor to another. """Copy count bytes from one file descriptor to another.
@ -3061,12 +3062,12 @@ if sys.version_info >= (3, 12) and sys.platform == "win32":
""" """
if sys.version_info >= (3, 10) and sys.platform == "linux": if sys.version_info >= (3, 10) and sys.platform == "linux":
EFD_CLOEXEC: int EFD_CLOEXEC: Final[int]
EFD_NONBLOCK: int EFD_NONBLOCK: Final[int]
EFD_SEMAPHORE: int EFD_SEMAPHORE: Final[int]
SPLICE_F_MORE: int SPLICE_F_MORE: Final[int]
SPLICE_F_MOVE: int SPLICE_F_MOVE: Final[int]
SPLICE_F_NONBLOCK: int SPLICE_F_NONBLOCK: Final[int]
def eventfd(initval: int, flags: int = 524288) -> FileDescriptor: def eventfd(initval: int, flags: int = 524288) -> FileDescriptor:
"""Creates and returns an event notification file descriptor.""" """Creates and returns an event notification file descriptor."""
@ -3105,20 +3106,20 @@ if sys.version_info >= (3, 10) and sys.platform == "linux":
""" """
if sys.version_info >= (3, 12) and sys.platform == "linux": if sys.version_info >= (3, 12) and sys.platform == "linux":
CLONE_FILES: int CLONE_FILES: Final[int]
CLONE_FS: int CLONE_FS: Final[int]
CLONE_NEWCGROUP: int # Linux 4.6+ CLONE_NEWCGROUP: Final[int] # Linux 4.6+
CLONE_NEWIPC: int # Linux 2.6.19+ CLONE_NEWIPC: Final[int] # Linux 2.6.19+
CLONE_NEWNET: int # Linux 2.6.24+ CLONE_NEWNET: Final[int] # Linux 2.6.24+
CLONE_NEWNS: int CLONE_NEWNS: Final[int]
CLONE_NEWPID: int # Linux 3.8+ CLONE_NEWPID: Final[int] # Linux 3.8+
CLONE_NEWTIME: int # Linux 5.6+ CLONE_NEWTIME: Final[int] # Linux 5.6+
CLONE_NEWUSER: int # Linux 3.8+ CLONE_NEWUSER: Final[int] # Linux 3.8+
CLONE_NEWUTS: int # Linux 2.6.19+ CLONE_NEWUTS: Final[int] # Linux 2.6.19+
CLONE_SIGHAND: int CLONE_SIGHAND: Final[int]
CLONE_SYSVSEM: int # Linux 2.6.26+ CLONE_SYSVSEM: Final[int] # Linux 2.6.26+
CLONE_THREAD: int CLONE_THREAD: Final[int]
CLONE_VM: int CLONE_VM: Final[int]
def unshare(flags: int) -> None: def unshare(flags: int) -> None:
"""Disassociate parts of a process (or thread) execution context. """Disassociate parts of a process (or thread) execution context.

View file

@ -1,119 +1,120 @@
import sys import sys
from typing import Any, Literal, overload from typing import Any, Final, Literal, overload
if sys.platform != "win32" and sys.platform != "darwin": if sys.platform != "win32" and sys.platform != "darwin":
AFMT_AC3: int # Depends on soundcard.h
AFMT_A_LAW: int AFMT_AC3: Final[int]
AFMT_IMA_ADPCM: int AFMT_A_LAW: Final[int]
AFMT_MPEG: int AFMT_IMA_ADPCM: Final[int]
AFMT_MU_LAW: int AFMT_MPEG: Final[int]
AFMT_QUERY: int AFMT_MU_LAW: Final[int]
AFMT_S16_BE: int AFMT_QUERY: Final[int]
AFMT_S16_LE: int AFMT_S16_BE: Final[int]
AFMT_S16_NE: int AFMT_S16_LE: Final[int]
AFMT_S8: int AFMT_S16_NE: Final[int]
AFMT_U16_BE: int AFMT_S8: Final[int]
AFMT_U16_LE: int AFMT_U16_BE: Final[int]
AFMT_U8: int AFMT_U16_LE: Final[int]
SNDCTL_COPR_HALT: int AFMT_U8: Final[int]
SNDCTL_COPR_LOAD: int SNDCTL_COPR_HALT: Final[int]
SNDCTL_COPR_RCODE: int SNDCTL_COPR_LOAD: Final[int]
SNDCTL_COPR_RCVMSG: int SNDCTL_COPR_RCODE: Final[int]
SNDCTL_COPR_RDATA: int SNDCTL_COPR_RCVMSG: Final[int]
SNDCTL_COPR_RESET: int SNDCTL_COPR_RDATA: Final[int]
SNDCTL_COPR_RUN: int SNDCTL_COPR_RESET: Final[int]
SNDCTL_COPR_SENDMSG: int SNDCTL_COPR_RUN: Final[int]
SNDCTL_COPR_WCODE: int SNDCTL_COPR_SENDMSG: Final[int]
SNDCTL_COPR_WDATA: int SNDCTL_COPR_WCODE: Final[int]
SNDCTL_DSP_BIND_CHANNEL: int SNDCTL_COPR_WDATA: Final[int]
SNDCTL_DSP_CHANNELS: int SNDCTL_DSP_BIND_CHANNEL: Final[int]
SNDCTL_DSP_GETBLKSIZE: int SNDCTL_DSP_CHANNELS: Final[int]
SNDCTL_DSP_GETCAPS: int SNDCTL_DSP_GETBLKSIZE: Final[int]
SNDCTL_DSP_GETCHANNELMASK: int SNDCTL_DSP_GETCAPS: Final[int]
SNDCTL_DSP_GETFMTS: int SNDCTL_DSP_GETCHANNELMASK: Final[int]
SNDCTL_DSP_GETIPTR: int SNDCTL_DSP_GETFMTS: Final[int]
SNDCTL_DSP_GETISPACE: int SNDCTL_DSP_GETIPTR: Final[int]
SNDCTL_DSP_GETODELAY: int SNDCTL_DSP_GETISPACE: Final[int]
SNDCTL_DSP_GETOPTR: int SNDCTL_DSP_GETODELAY: Final[int]
SNDCTL_DSP_GETOSPACE: int SNDCTL_DSP_GETOPTR: Final[int]
SNDCTL_DSP_GETSPDIF: int SNDCTL_DSP_GETOSPACE: Final[int]
SNDCTL_DSP_GETTRIGGER: int SNDCTL_DSP_GETSPDIF: Final[int]
SNDCTL_DSP_MAPINBUF: int SNDCTL_DSP_GETTRIGGER: Final[int]
SNDCTL_DSP_MAPOUTBUF: int SNDCTL_DSP_MAPINBUF: Final[int]
SNDCTL_DSP_NONBLOCK: int SNDCTL_DSP_MAPOUTBUF: Final[int]
SNDCTL_DSP_POST: int SNDCTL_DSP_NONBLOCK: Final[int]
SNDCTL_DSP_PROFILE: int SNDCTL_DSP_POST: Final[int]
SNDCTL_DSP_RESET: int SNDCTL_DSP_PROFILE: Final[int]
SNDCTL_DSP_SAMPLESIZE: int SNDCTL_DSP_RESET: Final[int]
SNDCTL_DSP_SETDUPLEX: int SNDCTL_DSP_SAMPLESIZE: Final[int]
SNDCTL_DSP_SETFMT: int SNDCTL_DSP_SETDUPLEX: Final[int]
SNDCTL_DSP_SETFRAGMENT: int SNDCTL_DSP_SETFMT: Final[int]
SNDCTL_DSP_SETSPDIF: int SNDCTL_DSP_SETFRAGMENT: Final[int]
SNDCTL_DSP_SETSYNCRO: int SNDCTL_DSP_SETSPDIF: Final[int]
SNDCTL_DSP_SETTRIGGER: int SNDCTL_DSP_SETSYNCRO: Final[int]
SNDCTL_DSP_SPEED: int SNDCTL_DSP_SETTRIGGER: Final[int]
SNDCTL_DSP_STEREO: int SNDCTL_DSP_SPEED: Final[int]
SNDCTL_DSP_SUBDIVIDE: int SNDCTL_DSP_STEREO: Final[int]
SNDCTL_DSP_SYNC: int SNDCTL_DSP_SUBDIVIDE: Final[int]
SNDCTL_FM_4OP_ENABLE: int SNDCTL_DSP_SYNC: Final[int]
SNDCTL_FM_LOAD_INSTR: int SNDCTL_FM_4OP_ENABLE: Final[int]
SNDCTL_MIDI_INFO: int SNDCTL_FM_LOAD_INSTR: Final[int]
SNDCTL_MIDI_MPUCMD: int SNDCTL_MIDI_INFO: Final[int]
SNDCTL_MIDI_MPUMODE: int SNDCTL_MIDI_MPUCMD: Final[int]
SNDCTL_MIDI_PRETIME: int SNDCTL_MIDI_MPUMODE: Final[int]
SNDCTL_SEQ_CTRLRATE: int SNDCTL_MIDI_PRETIME: Final[int]
SNDCTL_SEQ_GETINCOUNT: int SNDCTL_SEQ_CTRLRATE: Final[int]
SNDCTL_SEQ_GETOUTCOUNT: int SNDCTL_SEQ_GETINCOUNT: Final[int]
SNDCTL_SEQ_GETTIME: int SNDCTL_SEQ_GETOUTCOUNT: Final[int]
SNDCTL_SEQ_NRMIDIS: int SNDCTL_SEQ_GETTIME: Final[int]
SNDCTL_SEQ_NRSYNTHS: int SNDCTL_SEQ_NRMIDIS: Final[int]
SNDCTL_SEQ_OUTOFBAND: int SNDCTL_SEQ_NRSYNTHS: Final[int]
SNDCTL_SEQ_PANIC: int SNDCTL_SEQ_OUTOFBAND: Final[int]
SNDCTL_SEQ_PERCMODE: int SNDCTL_SEQ_PANIC: Final[int]
SNDCTL_SEQ_RESET: int SNDCTL_SEQ_PERCMODE: Final[int]
SNDCTL_SEQ_RESETSAMPLES: int SNDCTL_SEQ_RESET: Final[int]
SNDCTL_SEQ_SYNC: int SNDCTL_SEQ_RESETSAMPLES: Final[int]
SNDCTL_SEQ_TESTMIDI: int SNDCTL_SEQ_SYNC: Final[int]
SNDCTL_SEQ_THRESHOLD: int SNDCTL_SEQ_TESTMIDI: Final[int]
SNDCTL_SYNTH_CONTROL: int SNDCTL_SEQ_THRESHOLD: Final[int]
SNDCTL_SYNTH_ID: int SNDCTL_SYNTH_CONTROL: Final[int]
SNDCTL_SYNTH_INFO: int SNDCTL_SYNTH_ID: Final[int]
SNDCTL_SYNTH_MEMAVL: int SNDCTL_SYNTH_INFO: Final[int]
SNDCTL_SYNTH_REMOVESAMPLE: int SNDCTL_SYNTH_MEMAVL: Final[int]
SNDCTL_TMR_CONTINUE: int SNDCTL_SYNTH_REMOVESAMPLE: Final[int]
SNDCTL_TMR_METRONOME: int SNDCTL_TMR_CONTINUE: Final[int]
SNDCTL_TMR_SELECT: int SNDCTL_TMR_METRONOME: Final[int]
SNDCTL_TMR_SOURCE: int SNDCTL_TMR_SELECT: Final[int]
SNDCTL_TMR_START: int SNDCTL_TMR_SOURCE: Final[int]
SNDCTL_TMR_STOP: int SNDCTL_TMR_START: Final[int]
SNDCTL_TMR_TEMPO: int SNDCTL_TMR_STOP: Final[int]
SNDCTL_TMR_TIMEBASE: int SNDCTL_TMR_TEMPO: Final[int]
SOUND_MIXER_ALTPCM: int SNDCTL_TMR_TIMEBASE: Final[int]
SOUND_MIXER_BASS: int SOUND_MIXER_ALTPCM: Final[int]
SOUND_MIXER_CD: int SOUND_MIXER_BASS: Final[int]
SOUND_MIXER_DIGITAL1: int SOUND_MIXER_CD: Final[int]
SOUND_MIXER_DIGITAL2: int SOUND_MIXER_DIGITAL1: Final[int]
SOUND_MIXER_DIGITAL3: int SOUND_MIXER_DIGITAL2: Final[int]
SOUND_MIXER_IGAIN: int SOUND_MIXER_DIGITAL3: Final[int]
SOUND_MIXER_IMIX: int SOUND_MIXER_IGAIN: Final[int]
SOUND_MIXER_LINE: int SOUND_MIXER_IMIX: Final[int]
SOUND_MIXER_LINE1: int SOUND_MIXER_LINE: Final[int]
SOUND_MIXER_LINE2: int SOUND_MIXER_LINE1: Final[int]
SOUND_MIXER_LINE3: int SOUND_MIXER_LINE2: Final[int]
SOUND_MIXER_MIC: int SOUND_MIXER_LINE3: Final[int]
SOUND_MIXER_MONITOR: int SOUND_MIXER_MIC: Final[int]
SOUND_MIXER_NRDEVICES: int SOUND_MIXER_MONITOR: Final[int]
SOUND_MIXER_OGAIN: int SOUND_MIXER_NRDEVICES: Final[int]
SOUND_MIXER_PCM: int SOUND_MIXER_OGAIN: Final[int]
SOUND_MIXER_PHONEIN: int SOUND_MIXER_PCM: Final[int]
SOUND_MIXER_PHONEOUT: int SOUND_MIXER_PHONEIN: Final[int]
SOUND_MIXER_RADIO: int SOUND_MIXER_PHONEOUT: Final[int]
SOUND_MIXER_RECLEV: int SOUND_MIXER_RADIO: Final[int]
SOUND_MIXER_SPEAKER: int SOUND_MIXER_RECLEV: Final[int]
SOUND_MIXER_SYNTH: int SOUND_MIXER_SPEAKER: Final[int]
SOUND_MIXER_TREBLE: int SOUND_MIXER_SYNTH: Final[int]
SOUND_MIXER_VIDEO: int SOUND_MIXER_TREBLE: Final[int]
SOUND_MIXER_VOLUME: int SOUND_MIXER_VIDEO: Final[int]
SOUND_MIXER_VOLUME: Final[int]
control_labels: list[str] control_labels: list[str]
control_names: list[str] control_names: list[str]

View file

@ -45,6 +45,31 @@ class PurePath(PathLike[str]):
directly, regardless of your system. directly, regardless of your system.
""" """
if sys.version_info >= (3, 13):
__slots__ = (
"_raw_paths",
"_drv",
"_root",
"_tail_cached",
"_str",
"_str_normcase_cached",
"_parts_normcase_cached",
"_hash",
)
elif sys.version_info >= (3, 12):
__slots__ = (
"_raw_paths",
"_drv",
"_root",
"_tail_cached",
"_str",
"_str_normcase_cached",
"_parts_normcase_cached",
"_lines_cached",
"_hash",
)
else:
__slots__ = ("_drv", "_root", "_parts", "_str", "_hash", "_pparts", "_cached_cparts")
if sys.version_info >= (3, 13): if sys.version_info >= (3, 13):
parser: ClassVar[types.ModuleType] parser: ClassVar[types.ModuleType]
def full_match(self, pattern: StrPath, *, case_sensitive: bool | None = None) -> bool: def full_match(self, pattern: StrPath, *, case_sensitive: bool | None = None) -> bool:
@ -240,6 +265,8 @@ class PurePosixPath(PurePath):
However, you can also instantiate it directly on any system. However, you can also instantiate it directly on any system.
""" """
__slots__ = ()
class PureWindowsPath(PurePath): class PureWindowsPath(PurePath):
"""PurePath subclass for Windows systems. """PurePath subclass for Windows systems.
@ -247,6 +274,8 @@ class PureWindowsPath(PurePath):
However, you can also instantiate it directly on any system. However, you can also instantiate it directly on any system.
""" """
__slots__ = ()
class Path(PurePath): class Path(PurePath):
"""PurePath subclass that can make system calls. """PurePath subclass that can make system calls.
@ -257,6 +286,12 @@ class Path(PurePath):
but cannot instantiate a WindowsPath on a POSIX system or vice versa. but cannot instantiate a WindowsPath on a POSIX system or vice versa.
""" """
if sys.version_info >= (3, 14):
__slots__ = ("_info",)
elif sys.version_info >= (3, 10):
__slots__ = ()
else:
__slots__ = ("_accessor",)
if sys.version_info >= (3, 12): if sys.version_info >= (3, 12):
def __new__(cls, *args: StrPath, **kwargs: Unused) -> Self: ... # pyright: ignore[reportInconsistentConstructor] def __new__(cls, *args: StrPath, **kwargs: Unused) -> Self: ... # pyright: ignore[reportInconsistentConstructor]
else: else:
@ -737,7 +772,7 @@ class Path(PurePath):
""" """
if sys.version_info >= (3, 12): if sys.version_info >= (3, 12):
def walk( def walk(
self, top_down: bool = ..., on_error: Callable[[OSError], object] | None = ..., follow_symlinks: bool = ... self, top_down: bool = True, on_error: Callable[[OSError], object] | None = None, follow_symlinks: bool = False
) -> Iterator[tuple[Self, list[str], list[str]]]: ) -> Iterator[tuple[Self, list[str], list[str]]]:
"""Walk the directory tree from this directory, similar to os.walk().""" """Walk the directory tree from this directory, similar to os.walk()."""
@ -747,12 +782,16 @@ class PosixPath(Path, PurePosixPath):
On a POSIX system, instantiating a Path should return this object. On a POSIX system, instantiating a Path should return this object.
""" """
__slots__ = ()
class WindowsPath(Path, PureWindowsPath): class WindowsPath(Path, PureWindowsPath):
"""Path subclass for Windows systems. """Path subclass for Windows systems.
On a Windows system, instantiating a Path should return this object. On a Windows system, instantiating a Path should return this object.
""" """
__slots__ = ()
if sys.version_info >= (3, 13): if sys.version_info >= (3, 13):
class UnsupportedOperation(NotImplementedError): class UnsupportedOperation(NotImplementedError):
"""An exception that is raised when an unsupported operation is attempted.""" """An exception that is raised when an unsupported operation is attempted."""

View file

@ -355,7 +355,7 @@ _T = TypeVar("_T")
_P = ParamSpec("_P") _P = ParamSpec("_P")
_Mode: TypeAlias = Literal["inline", "cli"] _Mode: TypeAlias = Literal["inline", "cli"]
line_prefix: str # undocumented line_prefix: Final[str] # undocumented
class Restart(Exception): class Restart(Exception):
"""Causes a debugger to be restarted for the debugged python program.""" """Causes a debugger to be restarted for the debugged python program."""

View file

@ -39,7 +39,7 @@ from _pickle import (
) )
from _typeshed import ReadableBuffer, SupportsWrite from _typeshed import ReadableBuffer, SupportsWrite
from collections.abc import Callable, Iterable, Mapping from collections.abc import Callable, Iterable, Mapping
from typing import Any, ClassVar, SupportsBytes, SupportsIndex, final from typing import Any, ClassVar, Final, SupportsBytes, SupportsIndex, final
from typing_extensions import Self from typing_extensions import Self
__all__ = [ __all__ = [
@ -127,8 +127,8 @@ __all__ = [
"UNICODE", "UNICODE",
] ]
HIGHEST_PROTOCOL: int HIGHEST_PROTOCOL: Final = 5
DEFAULT_PROTOCOL: int DEFAULT_PROTOCOL: Final = 5
bytes_types: tuple[type[Any], ...] # undocumented bytes_types: tuple[type[Any], ...] # undocumented
@ -151,85 +151,85 @@ class PickleBuffer:
def __release_buffer__(self, buffer: memoryview, /) -> None: def __release_buffer__(self, buffer: memoryview, /) -> None:
"""Release the buffer object that exposes the underlying memory of the object.""" """Release the buffer object that exposes the underlying memory of the object."""
MARK: bytes MARK: Final = b"("
STOP: bytes STOP: Final = b"."
POP: bytes POP: Final = b"0"
POP_MARK: bytes POP_MARK: Final = b"1"
DUP: bytes DUP: Final = b"2"
FLOAT: bytes FLOAT: Final = b"F"
INT: bytes INT: Final = b"I"
BININT: bytes BININT: Final = b"J"
BININT1: bytes BININT1: Final = b"K"
LONG: bytes LONG: Final = b"L"
BININT2: bytes BININT2: Final = b"M"
NONE: bytes NONE: Final = b"N"
PERSID: bytes PERSID: Final = b"P"
BINPERSID: bytes BINPERSID: Final = b"Q"
REDUCE: bytes REDUCE: Final = b"R"
STRING: bytes STRING: Final = b"S"
BINSTRING: bytes BINSTRING: Final = b"T"
SHORT_BINSTRING: bytes SHORT_BINSTRING: Final = b"U"
UNICODE: bytes UNICODE: Final = b"V"
BINUNICODE: bytes BINUNICODE: Final = b"X"
APPEND: bytes APPEND: Final = b"a"
BUILD: bytes BUILD: Final = b"b"
GLOBAL: bytes GLOBAL: Final = b"c"
DICT: bytes DICT: Final = b"d"
EMPTY_DICT: bytes EMPTY_DICT: Final = b"}"
APPENDS: bytes APPENDS: Final = b"e"
GET: bytes GET: Final = b"g"
BINGET: bytes BINGET: Final = b"h"
INST: bytes INST: Final = b"i"
LONG_BINGET: bytes LONG_BINGET: Final = b"j"
LIST: bytes LIST: Final = b"l"
EMPTY_LIST: bytes EMPTY_LIST: Final = b"]"
OBJ: bytes OBJ: Final = b"o"
PUT: bytes PUT: Final = b"p"
BINPUT: bytes BINPUT: Final = b"q"
LONG_BINPUT: bytes LONG_BINPUT: Final = b"r"
SETITEM: bytes SETITEM: Final = b"s"
TUPLE: bytes TUPLE: Final = b"t"
EMPTY_TUPLE: bytes EMPTY_TUPLE: Final = b")"
SETITEMS: bytes SETITEMS: Final = b"u"
BINFLOAT: bytes BINFLOAT: Final = b"G"
TRUE: bytes TRUE: Final = b"I01\n"
FALSE: bytes FALSE: Final = b"I00\n"
# protocol 2 # protocol 2
PROTO: bytes PROTO: Final = b"\x80"
NEWOBJ: bytes NEWOBJ: Final = b"\x81"
EXT1: bytes EXT1: Final = b"\x82"
EXT2: bytes EXT2: Final = b"\x83"
EXT4: bytes EXT4: Final = b"\x84"
TUPLE1: bytes TUPLE1: Final = b"\x85"
TUPLE2: bytes TUPLE2: Final = b"\x86"
TUPLE3: bytes TUPLE3: Final = b"\x87"
NEWTRUE: bytes NEWTRUE: Final = b"\x88"
NEWFALSE: bytes NEWFALSE: Final = b"\x89"
LONG1: bytes LONG1: Final = b"\x8a"
LONG4: bytes LONG4: Final = b"\x8b"
# protocol 3 # protocol 3
BINBYTES: bytes BINBYTES: Final = b"B"
SHORT_BINBYTES: bytes SHORT_BINBYTES: Final = b"C"
# protocol 4 # protocol 4
SHORT_BINUNICODE: bytes SHORT_BINUNICODE: Final = b"\x8c"
BINUNICODE8: bytes BINUNICODE8: Final = b"\x8d"
BINBYTES8: bytes BINBYTES8: Final = b"\x8e"
EMPTY_SET: bytes EMPTY_SET: Final = b"\x8f"
ADDITEMS: bytes ADDITEMS: Final = b"\x90"
FROZENSET: bytes FROZENSET: Final = b"\x91"
NEWOBJ_EX: bytes NEWOBJ_EX: Final = b"\x92"
STACK_GLOBAL: bytes STACK_GLOBAL: Final = b"\x93"
MEMOIZE: bytes MEMOIZE: Final = b"\x94"
FRAME: bytes FRAME: Final = b"\x95"
# protocol 5 # protocol 5
BYTEARRAY8: bytes BYTEARRAY8: Final = b"\x96"
NEXT_BUFFER: bytes NEXT_BUFFER: Final = b"\x97"
READONLY_BUFFER: bytes READONLY_BUFFER: Final = b"\x98"
def encode_long(x: int) -> bytes: # undocumented def encode_long(x: int) -> bytes: # undocumented
"""Encode a long to a two's complement little-endian binary string. """Encode a long to a two's complement little-endian binary string.

View file

@ -12,7 +12,7 @@ dis(pickle, out=None, memo=None, indentlevel=4)
import sys import sys
from collections.abc import Callable, Iterator, MutableMapping from collections.abc import Callable, Iterator, MutableMapping
from typing import IO, Any from typing import IO, Any, Final
from typing_extensions import TypeAlias from typing_extensions import TypeAlias
__all__ = ["dis", "genops", "optimize"] __all__ = ["dis", "genops", "optimize"]
@ -20,13 +20,14 @@ __all__ = ["dis", "genops", "optimize"]
_Reader: TypeAlias = Callable[[IO[bytes]], Any] _Reader: TypeAlias = Callable[[IO[bytes]], Any]
bytes_types: tuple[type[Any], ...] bytes_types: tuple[type[Any], ...]
UP_TO_NEWLINE: int UP_TO_NEWLINE: Final = -1
TAKEN_FROM_ARGUMENT1: int TAKEN_FROM_ARGUMENT1: Final = -2
TAKEN_FROM_ARGUMENT4: int TAKEN_FROM_ARGUMENT4: Final = -3
TAKEN_FROM_ARGUMENT4U: int TAKEN_FROM_ARGUMENT4U: Final = -4
TAKEN_FROM_ARGUMENT8U: int TAKEN_FROM_ARGUMENT8U: Final = -5
class ArgumentDescriptor: class ArgumentDescriptor:
__slots__ = ("name", "n", "reader", "doc")
name: str name: str
n: int n: int
reader: _Reader reader: _Reader
@ -376,6 +377,7 @@ def read_long4(f: IO[bytes]) -> int:
long4: ArgumentDescriptor long4: ArgumentDescriptor
class StackObject: class StackObject:
__slots__ = ("name", "obtype", "doc")
name: str name: str
obtype: type[Any] | tuple[type[Any], ...] obtype: type[Any] | tuple[type[Any], ...]
doc: str doc: str
@ -401,6 +403,7 @@ markobject: StackObject
stackslice: StackObject stackslice: StackObject
class OpcodeInfo: class OpcodeInfo:
__slots__ = ("name", "code", "arg", "stack_before", "stack_after", "proto", "doc")
name: str name: str
code: str code: str
arg: ArgumentDescriptor | None arg: ArgumentDescriptor | None

View file

@ -259,7 +259,7 @@ def python_compiler() -> str:
""" """
def platform(aliased: bool = ..., terse: bool = ...) -> str: def platform(aliased: bool = False, terse: bool = False) -> str:
"""Returns a single string identifying the underlying platform """Returns a single string identifying the underlying platform
with as much useful information as possible (but no more :). with as much useful information as possible (but no more :).

View file

@ -60,7 +60,7 @@ from _typeshed import ReadableBuffer
from collections.abc import Mapping, MutableMapping from collections.abc import Mapping, MutableMapping
from datetime import datetime from datetime import datetime
from enum import Enum from enum import Enum
from typing import IO, Any from typing import IO, Any, Final
from typing_extensions import Self from typing_extensions import Self
__all__ = ["InvalidFileException", "FMT_XML", "FMT_BINARY", "load", "dump", "loads", "dumps", "UID"] __all__ = ["InvalidFileException", "FMT_XML", "FMT_BINARY", "load", "dump", "loads", "dumps", "UID"]
@ -71,8 +71,8 @@ class PlistFormat(Enum):
FMT_XML = 1 FMT_XML = 1
FMT_BINARY = 2 FMT_BINARY = 2
FMT_XML = PlistFormat.FMT_XML FMT_XML: Final = PlistFormat.FMT_XML
FMT_BINARY = PlistFormat.FMT_BINARY FMT_BINARY: Final = PlistFormat.FMT_BINARY
if sys.version_info >= (3, 13): if sys.version_info >= (3, 13):
def load( def load(
fp: IO[bytes], fp: IO[bytes],

View file

@ -22,7 +22,7 @@ POP3_SSL_PORT: Final = 995
CR: Final = b"\r" CR: Final = b"\r"
LF: Final = b"\n" LF: Final = b"\n"
CRLF: Final = b"\r\n" CRLF: Final = b"\r\n"
HAVE_SSL: bool HAVE_SSL: Final[bool]
class POP3: class POP3:
"""This class supports both the minimal and optional command sets. """This class supports both the minimal and optional command sets.

View file

@ -92,12 +92,12 @@ def classify_class_attrs(object: object) -> list[tuple[str, str, type, str]]:
"""Wrap inspect.classify_class_attrs, with fixup for data descriptors and bound methods.""" """Wrap inspect.classify_class_attrs, with fixup for data descriptors and bound methods."""
if sys.version_info >= (3, 13): if sys.version_info >= (3, 13):
@deprecated("Deprecated in Python 3.13.") @deprecated("Deprecated since Python 3.13.")
def ispackage(path: str) -> bool: def ispackage(path: str) -> bool: # undocumented
"""Guess whether a path refers to a package directory.""" """Guess whether a path refers to a package directory."""
else: else:
def ispackage(path: str) -> bool: def ispackage(path: str) -> bool: # undocumented
"""Guess whether a path refers to a package directory.""" """Guess whether a path refers to a package directory."""
def source_synopsis(file: IO[AnyStr]) -> AnyStr | None: def source_synopsis(file: IO[AnyStr]) -> AnyStr | None:

View file

@ -1 +1,3 @@
topics: dict[str, str] from typing import Final
topics: Final[dict[str, str]]

View file

@ -3,27 +3,28 @@ from _typeshed import structseq
from typing import Final, final from typing import Final, final
if sys.platform != "win32": if sys.platform != "win32":
RLIMIT_AS: int # Depends on resource.h
RLIMIT_CORE: int RLIMIT_AS: Final[int]
RLIMIT_CPU: int RLIMIT_CORE: Final[int]
RLIMIT_DATA: int RLIMIT_CPU: Final[int]
RLIMIT_FSIZE: int RLIMIT_DATA: Final[int]
RLIMIT_MEMLOCK: int RLIMIT_FSIZE: Final[int]
RLIMIT_NOFILE: int RLIMIT_MEMLOCK: Final[int]
RLIMIT_NPROC: int RLIMIT_NOFILE: Final[int]
RLIMIT_RSS: int RLIMIT_NPROC: Final[int]
RLIMIT_STACK: int RLIMIT_RSS: Final[int]
RLIM_INFINITY: int RLIMIT_STACK: Final[int]
RUSAGE_CHILDREN: int RLIM_INFINITY: Final[int]
RUSAGE_SELF: int RUSAGE_CHILDREN: Final[int]
RUSAGE_SELF: Final[int]
if sys.platform == "linux": if sys.platform == "linux":
RLIMIT_MSGQUEUE: int RLIMIT_MSGQUEUE: Final[int]
RLIMIT_NICE: int RLIMIT_NICE: Final[int]
RLIMIT_OFILE: int RLIMIT_OFILE: Final[int]
RLIMIT_RTPRIO: int RLIMIT_RTPRIO: Final[int]
RLIMIT_RTTIME: int RLIMIT_RTTIME: Final[int]
RLIMIT_SIGPENDING: int RLIMIT_SIGPENDING: Final[int]
RUSAGE_THREAD: int RUSAGE_THREAD: Final[int]
@final @final
class struct_rusage( class struct_rusage(

View file

@ -8,25 +8,25 @@ import sys
from _typeshed import FileDescriptorLike from _typeshed import FileDescriptorLike
from collections.abc import Iterable from collections.abc import Iterable
from types import TracebackType from types import TracebackType
from typing import Any, ClassVar, final from typing import Any, ClassVar, Final, final
from typing_extensions import Self from typing_extensions import Self
if sys.platform != "win32": if sys.platform != "win32":
PIPE_BUF: int PIPE_BUF: Final[int]
POLLERR: int POLLERR: Final[int]
POLLHUP: int POLLHUP: Final[int]
POLLIN: int POLLIN: Final[int]
if sys.platform == "linux": if sys.platform == "linux":
POLLMSG: int POLLMSG: Final[int]
POLLNVAL: int POLLNVAL: Final[int]
POLLOUT: int POLLOUT: Final[int]
POLLPRI: int POLLPRI: Final[int]
POLLRDBAND: int POLLRDBAND: Final[int]
if sys.platform == "linux": if sys.platform == "linux":
POLLRDHUP: int POLLRDHUP: Final[int]
POLLRDNORM: int POLLRDNORM: Final[int]
POLLWRBAND: int POLLWRBAND: Final[int]
POLLWRNORM: int POLLWRNORM: Final[int]
# This is actually a function that returns an instance of a class. # This is actually a function that returns an instance of a class.
# The class is not accessible directly, and also calls itself select.poll. # The class is not accessible directly, and also calls itself select.poll.
@ -155,45 +155,45 @@ if sys.platform != "linux" and sys.platform != "win32":
def fromfd(cls, fd: FileDescriptorLike, /) -> kqueue: def fromfd(cls, fd: FileDescriptorLike, /) -> kqueue:
"""Create a kqueue object from a given control fd.""" """Create a kqueue object from a given control fd."""
KQ_EV_ADD: int KQ_EV_ADD: Final[int]
KQ_EV_CLEAR: int KQ_EV_CLEAR: Final[int]
KQ_EV_DELETE: int KQ_EV_DELETE: Final[int]
KQ_EV_DISABLE: int KQ_EV_DISABLE: Final[int]
KQ_EV_ENABLE: int KQ_EV_ENABLE: Final[int]
KQ_EV_EOF: int KQ_EV_EOF: Final[int]
KQ_EV_ERROR: int KQ_EV_ERROR: Final[int]
KQ_EV_FLAG1: int KQ_EV_FLAG1: Final[int]
KQ_EV_ONESHOT: int KQ_EV_ONESHOT: Final[int]
KQ_EV_SYSFLAGS: int KQ_EV_SYSFLAGS: Final[int]
KQ_FILTER_AIO: int KQ_FILTER_AIO: Final[int]
if sys.platform != "darwin": if sys.platform != "darwin":
KQ_FILTER_NETDEV: int KQ_FILTER_NETDEV: Final[int]
KQ_FILTER_PROC: int KQ_FILTER_PROC: Final[int]
KQ_FILTER_READ: int KQ_FILTER_READ: Final[int]
KQ_FILTER_SIGNAL: int KQ_FILTER_SIGNAL: Final[int]
KQ_FILTER_TIMER: int KQ_FILTER_TIMER: Final[int]
KQ_FILTER_VNODE: int KQ_FILTER_VNODE: Final[int]
KQ_FILTER_WRITE: int KQ_FILTER_WRITE: Final[int]
KQ_NOTE_ATTRIB: int KQ_NOTE_ATTRIB: Final[int]
KQ_NOTE_CHILD: int KQ_NOTE_CHILD: Final[int]
KQ_NOTE_DELETE: int KQ_NOTE_DELETE: Final[int]
KQ_NOTE_EXEC: int KQ_NOTE_EXEC: Final[int]
KQ_NOTE_EXIT: int KQ_NOTE_EXIT: Final[int]
KQ_NOTE_EXTEND: int KQ_NOTE_EXTEND: Final[int]
KQ_NOTE_FORK: int KQ_NOTE_FORK: Final[int]
KQ_NOTE_LINK: int KQ_NOTE_LINK: Final[int]
if sys.platform != "darwin": if sys.platform != "darwin":
KQ_NOTE_LINKDOWN: int KQ_NOTE_LINKDOWN: Final[int]
KQ_NOTE_LINKINV: int KQ_NOTE_LINKINV: Final[int]
KQ_NOTE_LINKUP: int KQ_NOTE_LINKUP: Final[int]
KQ_NOTE_LOWAT: int KQ_NOTE_LOWAT: Final[int]
KQ_NOTE_PCTRLMASK: int KQ_NOTE_PCTRLMASK: Final[int]
KQ_NOTE_PDATAMASK: int KQ_NOTE_PDATAMASK: Final[int]
KQ_NOTE_RENAME: int KQ_NOTE_RENAME: Final[int]
KQ_NOTE_REVOKE: int KQ_NOTE_REVOKE: Final[int]
KQ_NOTE_TRACK: int KQ_NOTE_TRACK: Final[int]
KQ_NOTE_TRACKERR: int KQ_NOTE_TRACKERR: Final[int]
KQ_NOTE_WRITE: int KQ_NOTE_WRITE: Final[int]
if sys.platform == "linux": if sys.platform == "linux":
@final @final
@ -269,23 +269,23 @@ if sys.platform == "linux":
def fromfd(cls, fd: FileDescriptorLike, /) -> epoll: def fromfd(cls, fd: FileDescriptorLike, /) -> epoll:
"""Create an epoll object from a given control fd.""" """Create an epoll object from a given control fd."""
EPOLLERR: int EPOLLERR: Final[int]
EPOLLEXCLUSIVE: int EPOLLEXCLUSIVE: Final[int]
EPOLLET: int EPOLLET: Final[int]
EPOLLHUP: int EPOLLHUP: Final[int]
EPOLLIN: int EPOLLIN: Final[int]
EPOLLMSG: int EPOLLMSG: Final[int]
EPOLLONESHOT: int EPOLLONESHOT: Final[int]
EPOLLOUT: int EPOLLOUT: Final[int]
EPOLLPRI: int EPOLLPRI: Final[int]
EPOLLRDBAND: int EPOLLRDBAND: Final[int]
EPOLLRDHUP: int EPOLLRDHUP: Final[int]
EPOLLRDNORM: int EPOLLRDNORM: Final[int]
EPOLLWRBAND: int EPOLLWRBAND: Final[int]
EPOLLWRNORM: int EPOLLWRNORM: Final[int]
EPOLL_CLOEXEC: int EPOLL_CLOEXEC: Final[int]
if sys.version_info >= (3, 14): if sys.version_info >= (3, 14):
EPOLLWAKEUP: int EPOLLWAKEUP: Final[int]
if sys.platform != "linux" and sys.platform != "darwin" and sys.platform != "win32": if sys.platform != "linux" and sys.platform != "darwin" and sys.platform != "win32":
# Solaris only # Solaris only

View file

@ -8,13 +8,13 @@ import sys
from _typeshed import FileDescriptor, FileDescriptorLike, Unused from _typeshed import FileDescriptor, FileDescriptorLike, Unused
from abc import ABCMeta, abstractmethod from abc import ABCMeta, abstractmethod
from collections.abc import Mapping from collections.abc import Mapping
from typing import Any, NamedTuple from typing import Any, Final, NamedTuple
from typing_extensions import Self, TypeAlias from typing_extensions import Self, TypeAlias
_EventMask: TypeAlias = int _EventMask: TypeAlias = int
EVENT_READ: _EventMask EVENT_READ: Final = 1
EVENT_WRITE: _EventMask EVENT_WRITE: Final = 2
class SelectorKey(NamedTuple): class SelectorKey(NamedTuple):
"""SelectorKey(fileobj, fd, events, data) """SelectorKey(fileobj, fd, events, data)

View file

@ -39,7 +39,7 @@ from re import Pattern
from socket import socket from socket import socket
from ssl import SSLContext from ssl import SSLContext
from types import TracebackType from types import TracebackType
from typing import Any, Protocol, overload, type_check_only from typing import Any, Final, Protocol, overload, type_check_only
from typing_extensions import Self, TypeAlias from typing_extensions import Self, TypeAlias
__all__ = [ __all__ = [
@ -62,12 +62,12 @@ __all__ = [
_Reply: TypeAlias = tuple[int, bytes] _Reply: TypeAlias = tuple[int, bytes]
_SendErrs: TypeAlias = dict[str, _Reply] _SendErrs: TypeAlias = dict[str, _Reply]
SMTP_PORT: int SMTP_PORT: Final = 25
SMTP_SSL_PORT: int SMTP_SSL_PORT: Final = 465
CRLF: str CRLF: Final[str]
bCRLF: bytes bCRLF: Final[bytes]
OLDSTYLE_AUTH: Pattern[str] OLDSTYLE_AUTH: Final[Pattern[str]]
class SMTPException(OSError): class SMTPException(OSError):
"""Base class for all exceptions raised by this module.""" """Base class for all exceptions raised by this module."""
@ -590,7 +590,7 @@ class SMTP_SSL(SMTP):
context: SSLContext | None = None, context: SSLContext | None = None,
) -> None: ... ) -> None: ...
LMTP_PORT: int LMTP_PORT: Final = 2003
class LMTP(SMTP): class LMTP(SMTP):
"""LMTP - Local Mail Transfer Protocol """LMTP - Local Mail Transfer Protocol

View file

@ -183,7 +183,7 @@ from _typeshed import ReadableBuffer, Unused, WriteableBuffer
from collections.abc import Iterable from collections.abc import Iterable
from enum import IntEnum, IntFlag from enum import IntEnum, IntFlag
from io import BufferedReader, BufferedRWPair, BufferedWriter, IOBase, RawIOBase, TextIOWrapper from io import BufferedReader, BufferedRWPair, BufferedWriter, IOBase, RawIOBase, TextIOWrapper
from typing import Any, Literal, Protocol, SupportsIndex, overload, type_check_only from typing import Any, Final, Literal, Protocol, SupportsIndex, overload, type_check_only
from typing_extensions import Self from typing_extensions import Self
__all__ = [ __all__ = [
@ -1106,9 +1106,9 @@ if sys.version_info >= (3, 14):
__all__ += ["IP_FREEBIND", "IP_RECVORIGDSTADDR", "VMADDR_CID_LOCAL"] __all__ += ["IP_FREEBIND", "IP_RECVORIGDSTADDR", "VMADDR_CID_LOCAL"]
# Re-exported from errno # Re-exported from errno
EBADF: int EBADF: Final[int]
EAGAIN: int EAGAIN: Final[int]
EWOULDBLOCK: int EWOULDBLOCK: Final[int]
# These errors are implemented in _socket at runtime # These errors are implemented in _socket at runtime
# but they consider themselves to live in socket so we'll put them here. # but they consider themselves to live in socket so we'll put them here.
@ -1173,60 +1173,60 @@ class AddressFamily(IntEnum):
# FreeBSD >= 14.0 # FreeBSD >= 14.0
AF_DIVERT = 44 AF_DIVERT = 44
AF_INET = AddressFamily.AF_INET AF_INET: Final = AddressFamily.AF_INET
AF_INET6 = AddressFamily.AF_INET6 AF_INET6: Final = AddressFamily.AF_INET6
AF_APPLETALK = AddressFamily.AF_APPLETALK AF_APPLETALK: Final = AddressFamily.AF_APPLETALK
AF_DECnet: Literal[12] AF_DECnet: Final = 12
AF_IPX = AddressFamily.AF_IPX AF_IPX: Final = AddressFamily.AF_IPX
AF_SNA = AddressFamily.AF_SNA AF_SNA: Final = AddressFamily.AF_SNA
AF_UNSPEC = AddressFamily.AF_UNSPEC AF_UNSPEC: Final = AddressFamily.AF_UNSPEC
if sys.platform != "darwin": if sys.platform != "darwin":
AF_IRDA = AddressFamily.AF_IRDA AF_IRDA: Final = AddressFamily.AF_IRDA
if sys.platform != "win32": if sys.platform != "win32":
AF_ROUTE = AddressFamily.AF_ROUTE AF_ROUTE: Final = AddressFamily.AF_ROUTE
AF_UNIX = AddressFamily.AF_UNIX AF_UNIX: Final = AddressFamily.AF_UNIX
if sys.platform == "darwin": if sys.platform == "darwin":
AF_SYSTEM = AddressFamily.AF_SYSTEM AF_SYSTEM: Final = AddressFamily.AF_SYSTEM
if sys.platform != "win32" and sys.platform != "darwin": if sys.platform != "win32" and sys.platform != "darwin":
AF_ASH = AddressFamily.AF_ASH AF_ASH: Final = AddressFamily.AF_ASH
AF_ATMPVC = AddressFamily.AF_ATMPVC AF_ATMPVC: Final = AddressFamily.AF_ATMPVC
AF_ATMSVC = AddressFamily.AF_ATMSVC AF_ATMSVC: Final = AddressFamily.AF_ATMSVC
AF_AX25 = AddressFamily.AF_AX25 AF_AX25: Final = AddressFamily.AF_AX25
AF_BRIDGE = AddressFamily.AF_BRIDGE AF_BRIDGE: Final = AddressFamily.AF_BRIDGE
AF_ECONET = AddressFamily.AF_ECONET AF_ECONET: Final = AddressFamily.AF_ECONET
AF_KEY = AddressFamily.AF_KEY AF_KEY: Final = AddressFamily.AF_KEY
AF_LLC = AddressFamily.AF_LLC AF_LLC: Final = AddressFamily.AF_LLC
AF_NETBEUI = AddressFamily.AF_NETBEUI AF_NETBEUI: Final = AddressFamily.AF_NETBEUI
AF_NETROM = AddressFamily.AF_NETROM AF_NETROM: Final = AddressFamily.AF_NETROM
AF_PPPOX = AddressFamily.AF_PPPOX AF_PPPOX: Final = AddressFamily.AF_PPPOX
AF_ROSE = AddressFamily.AF_ROSE AF_ROSE: Final = AddressFamily.AF_ROSE
AF_SECURITY = AddressFamily.AF_SECURITY AF_SECURITY: Final = AddressFamily.AF_SECURITY
AF_WANPIPE = AddressFamily.AF_WANPIPE AF_WANPIPE: Final = AddressFamily.AF_WANPIPE
AF_X25 = AddressFamily.AF_X25 AF_X25: Final = AddressFamily.AF_X25
if sys.platform == "linux": if sys.platform == "linux":
AF_CAN = AddressFamily.AF_CAN AF_CAN: Final = AddressFamily.AF_CAN
AF_PACKET = AddressFamily.AF_PACKET AF_PACKET: Final = AddressFamily.AF_PACKET
AF_RDS = AddressFamily.AF_RDS AF_RDS: Final = AddressFamily.AF_RDS
AF_TIPC = AddressFamily.AF_TIPC AF_TIPC: Final = AddressFamily.AF_TIPC
AF_ALG = AddressFamily.AF_ALG AF_ALG: Final = AddressFamily.AF_ALG
AF_NETLINK = AddressFamily.AF_NETLINK AF_NETLINK: Final = AddressFamily.AF_NETLINK
AF_VSOCK = AddressFamily.AF_VSOCK AF_VSOCK: Final = AddressFamily.AF_VSOCK
AF_QIPCRTR = AddressFamily.AF_QIPCRTR AF_QIPCRTR: Final = AddressFamily.AF_QIPCRTR
if sys.platform != "linux": if sys.platform != "linux":
AF_LINK = AddressFamily.AF_LINK AF_LINK: Final = AddressFamily.AF_LINK
if sys.platform != "darwin" and sys.platform != "linux": if sys.platform != "darwin" and sys.platform != "linux":
AF_BLUETOOTH = AddressFamily.AF_BLUETOOTH AF_BLUETOOTH: Final = AddressFamily.AF_BLUETOOTH
if sys.platform == "win32" and sys.version_info >= (3, 12): if sys.platform == "win32" and sys.version_info >= (3, 12):
AF_HYPERV = AddressFamily.AF_HYPERV AF_HYPERV: Final = AddressFamily.AF_HYPERV
if sys.platform != "linux" and sys.platform != "win32" and sys.platform != "darwin" and sys.version_info >= (3, 12): if sys.platform != "linux" and sys.platform != "win32" and sys.platform != "darwin" and sys.version_info >= (3, 12):
# FreeBSD >= 14.0 # FreeBSD >= 14.0
AF_DIVERT = AddressFamily.AF_DIVERT AF_DIVERT: Final = AddressFamily.AF_DIVERT
class SocketKind(IntEnum): class SocketKind(IntEnum):
"""An enumeration.""" """An enumeration."""
@ -1240,14 +1240,14 @@ class SocketKind(IntEnum):
SOCK_CLOEXEC = 524288 SOCK_CLOEXEC = 524288
SOCK_NONBLOCK = 2048 SOCK_NONBLOCK = 2048
SOCK_STREAM = SocketKind.SOCK_STREAM SOCK_STREAM: Final = SocketKind.SOCK_STREAM
SOCK_DGRAM = SocketKind.SOCK_DGRAM SOCK_DGRAM: Final = SocketKind.SOCK_DGRAM
SOCK_RAW = SocketKind.SOCK_RAW SOCK_RAW: Final = SocketKind.SOCK_RAW
SOCK_RDM = SocketKind.SOCK_RDM SOCK_RDM: Final = SocketKind.SOCK_RDM
SOCK_SEQPACKET = SocketKind.SOCK_SEQPACKET SOCK_SEQPACKET: Final = SocketKind.SOCK_SEQPACKET
if sys.platform == "linux": if sys.platform == "linux":
SOCK_CLOEXEC = SocketKind.SOCK_CLOEXEC SOCK_CLOEXEC: Final = SocketKind.SOCK_CLOEXEC
SOCK_NONBLOCK = SocketKind.SOCK_NONBLOCK SOCK_NONBLOCK: Final = SocketKind.SOCK_NONBLOCK
class MsgFlag(IntFlag): class MsgFlag(IntFlag):
"""An enumeration.""" """An enumeration."""
@ -1281,36 +1281,36 @@ class MsgFlag(IntFlag):
if sys.platform != "win32" and sys.platform != "linux": if sys.platform != "win32" and sys.platform != "linux":
MSG_EOF = 256 MSG_EOF = 256
MSG_CTRUNC = MsgFlag.MSG_CTRUNC MSG_CTRUNC: Final = MsgFlag.MSG_CTRUNC
MSG_DONTROUTE = MsgFlag.MSG_DONTROUTE MSG_DONTROUTE: Final = MsgFlag.MSG_DONTROUTE
MSG_OOB = MsgFlag.MSG_OOB MSG_OOB: Final = MsgFlag.MSG_OOB
MSG_PEEK = MsgFlag.MSG_PEEK MSG_PEEK: Final = MsgFlag.MSG_PEEK
MSG_TRUNC = MsgFlag.MSG_TRUNC MSG_TRUNC: Final = MsgFlag.MSG_TRUNC
MSG_WAITALL = MsgFlag.MSG_WAITALL MSG_WAITALL: Final = MsgFlag.MSG_WAITALL
if sys.platform == "win32": if sys.platform == "win32":
MSG_BCAST = MsgFlag.MSG_BCAST MSG_BCAST: Final = MsgFlag.MSG_BCAST
MSG_MCAST = MsgFlag.MSG_MCAST MSG_MCAST: Final = MsgFlag.MSG_MCAST
if sys.platform != "darwin": if sys.platform != "darwin":
MSG_ERRQUEUE = MsgFlag.MSG_ERRQUEUE MSG_ERRQUEUE: Final = MsgFlag.MSG_ERRQUEUE
if sys.platform != "win32": if sys.platform != "win32":
MSG_DONTWAIT = MsgFlag.MSG_DONTWAIT MSG_DONTWAIT: Final = MsgFlag.MSG_DONTWAIT
MSG_EOR = MsgFlag.MSG_EOR MSG_EOR: Final = MsgFlag.MSG_EOR
MSG_NOSIGNAL = MsgFlag.MSG_NOSIGNAL # Sometimes this exists on darwin, sometimes not MSG_NOSIGNAL: Final = MsgFlag.MSG_NOSIGNAL # Sometimes this exists on darwin, sometimes not
if sys.platform != "win32" and sys.platform != "darwin": if sys.platform != "win32" and sys.platform != "darwin":
MSG_CMSG_CLOEXEC = MsgFlag.MSG_CMSG_CLOEXEC MSG_CMSG_CLOEXEC: Final = MsgFlag.MSG_CMSG_CLOEXEC
MSG_CONFIRM = MsgFlag.MSG_CONFIRM MSG_CONFIRM: Final = MsgFlag.MSG_CONFIRM
MSG_FASTOPEN = MsgFlag.MSG_FASTOPEN MSG_FASTOPEN: Final = MsgFlag.MSG_FASTOPEN
MSG_MORE = MsgFlag.MSG_MORE MSG_MORE: Final = MsgFlag.MSG_MORE
if sys.platform != "win32" and sys.platform != "darwin" and sys.platform != "linux": if sys.platform != "win32" and sys.platform != "darwin" and sys.platform != "linux":
MSG_NOTIFICATION = MsgFlag.MSG_NOTIFICATION MSG_NOTIFICATION: Final = MsgFlag.MSG_NOTIFICATION
if sys.platform != "win32" and sys.platform != "linux": if sys.platform != "win32" and sys.platform != "linux":
MSG_EOF = MsgFlag.MSG_EOF MSG_EOF: Final = MsgFlag.MSG_EOF
class AddressInfo(IntFlag): class AddressInfo(IntFlag):
"""An enumeration.""" """An enumeration."""
@ -1327,18 +1327,18 @@ class AddressInfo(IntFlag):
AI_MASK = 5127 AI_MASK = 5127
AI_V4MAPPED_CFG = 512 AI_V4MAPPED_CFG = 512
AI_ADDRCONFIG = AddressInfo.AI_ADDRCONFIG AI_ADDRCONFIG: Final = AddressInfo.AI_ADDRCONFIG
AI_ALL = AddressInfo.AI_ALL AI_ALL: Final = AddressInfo.AI_ALL
AI_CANONNAME = AddressInfo.AI_CANONNAME AI_CANONNAME: Final = AddressInfo.AI_CANONNAME
AI_NUMERICHOST = AddressInfo.AI_NUMERICHOST AI_NUMERICHOST: Final = AddressInfo.AI_NUMERICHOST
AI_NUMERICSERV = AddressInfo.AI_NUMERICSERV AI_NUMERICSERV: Final = AddressInfo.AI_NUMERICSERV
AI_PASSIVE = AddressInfo.AI_PASSIVE AI_PASSIVE: Final = AddressInfo.AI_PASSIVE
AI_V4MAPPED = AddressInfo.AI_V4MAPPED AI_V4MAPPED: Final = AddressInfo.AI_V4MAPPED
if sys.platform != "win32" and sys.platform != "linux": if sys.platform != "win32" and sys.platform != "linux":
AI_DEFAULT = AddressInfo.AI_DEFAULT AI_DEFAULT: Final = AddressInfo.AI_DEFAULT
AI_MASK = AddressInfo.AI_MASK AI_MASK: Final = AddressInfo.AI_MASK
AI_V4MAPPED_CFG = AddressInfo.AI_V4MAPPED_CFG AI_V4MAPPED_CFG: Final = AddressInfo.AI_V4MAPPED_CFG
if sys.platform == "win32": if sys.platform == "win32":
errorTab: dict[int, str] # undocumented errorTab: dict[int, str] # undocumented
@ -1357,6 +1357,7 @@ class _SendableFile(Protocol):
class socket(_socket.socket): class socket(_socket.socket):
"""A subclass of _socket.socket adding the makefile() method.""" """A subclass of _socket.socket adding the makefile() method."""
__slots__ = ["__weakref__", "_io_refs", "_closed"]
def __init__( def __init__(
self, family: AddressFamily | int = -1, type: SocketKind | int = -1, proto: int = -1, fileno: int | None = None self, family: AddressFamily | int = -1, type: SocketKind | int = -1, proto: int = -1, fileno: int | None = None
) -> None: ... ) -> None: ...

View file

@ -66,7 +66,8 @@ from sqlite3 import (
Row as Row, Row as Row,
Warning as Warning, Warning as Warning,
) )
from typing import Literal from typing import Final, Literal
from typing_extensions import deprecated
if sys.version_info >= (3, 12): if sys.version_info >= (3, 12):
from _sqlite3 import ( from _sqlite3 import (
@ -211,11 +212,15 @@ if sys.version_info >= (3, 11):
if sys.version_info < (3, 14): if sys.version_info < (3, 14):
# Deprecated and removed from _sqlite3 in 3.12, but removed from here in 3.14. # Deprecated and removed from _sqlite3 in 3.12, but removed from here in 3.14.
version: str version: Final[str]
if sys.version_info < (3, 12): if sys.version_info < (3, 12):
if sys.version_info >= (3, 10): if sys.version_info >= (3, 10):
# deprecation wrapper that has a different name for the argument... # deprecation wrapper that has a different name for the argument...
@deprecated(
"Deprecated since Python 3.10; removed in Python 3.12. "
"Open database in URI mode using `cache=shared` parameter instead."
)
def enable_shared_cache(enable: int) -> None: ... def enable_shared_cache(enable: int) -> None: ...
else: else:
from _sqlite3 import enable_shared_cache as enable_shared_cache from _sqlite3 import enable_shared_cache as enable_shared_cache
@ -223,9 +228,9 @@ if sys.version_info < (3, 12):
if sys.version_info < (3, 10): if sys.version_info < (3, 10):
from _sqlite3 import OptimizedUnicode as OptimizedUnicode from _sqlite3 import OptimizedUnicode as OptimizedUnicode
paramstyle: str paramstyle: Final = "qmark"
threadsafety: Literal[0, 1, 3] threadsafety: Literal[0, 1, 3]
apilevel: str apilevel: Final[str]
Date = date Date = date
Time = time Time = time
Timestamp = datetime Timestamp = datetime
@ -236,7 +241,7 @@ def TimestampFromTicks(ticks: float) -> Timestamp: ...
if sys.version_info < (3, 14): if sys.version_info < (3, 14):
# Deprecated in 3.12, removed in 3.14. # Deprecated in 3.12, removed in 3.14.
version_info: tuple[int, int, int] version_info: Final[tuple[int, int, int]]
sqlite_version_info: tuple[int, int, int] sqlite_version_info: Final[tuple[int, int, int]]
Binary = memoryview Binary = memoryview

View file

@ -4,9 +4,9 @@ from re import Pattern
from sre_constants import * from sre_constants import *
from sre_constants import _NamedIntConstant from sre_constants import _NamedIntConstant
from sre_parse import SubPattern from sre_parse import SubPattern
from typing import Any from typing import Any, Final
MAXCODE: int MAXCODE: Final[int]
def dis(code: list[_NamedIntConstant]) -> None: ... def dis(code: list[_NamedIntConstant]) -> None: ...
def isstring(obj: Any) -> bool: ... def isstring(obj: Any) -> bool: ...

View file

@ -5,24 +5,24 @@ from collections.abc import Iterable
from re import Match, Pattern as _Pattern from re import Match, Pattern as _Pattern
from sre_constants import * from sre_constants import *
from sre_constants import _NamedIntConstant as _NIC, error as _Error from sre_constants import _NamedIntConstant as _NIC, error as _Error
from typing import Any, overload from typing import Any, Final, overload
from typing_extensions import TypeAlias from typing_extensions import TypeAlias
SPECIAL_CHARS: str SPECIAL_CHARS: Final = ".\\[{()*+?^$|"
REPEAT_CHARS: str REPEAT_CHARS: Final = "*+?{"
DIGITS: frozenset[str] DIGITS: Final[frozenset[str]]
OCTDIGITS: frozenset[str] OCTDIGITS: Final[frozenset[str]]
HEXDIGITS: frozenset[str] HEXDIGITS: Final[frozenset[str]]
ASCIILETTERS: frozenset[str] ASCIILETTERS: Final[frozenset[str]]
WHITESPACE: frozenset[str] WHITESPACE: Final[frozenset[str]]
ESCAPES: dict[str, tuple[_NIC, int]] ESCAPES: Final[dict[str, tuple[_NIC, int]]]
CATEGORIES: dict[str, tuple[_NIC, _NIC] | tuple[_NIC, list[tuple[_NIC, _NIC]]]] CATEGORIES: Final[dict[str, tuple[_NIC, _NIC] | tuple[_NIC, list[tuple[_NIC, _NIC]]]]]
FLAGS: dict[str, int] FLAGS: Final[dict[str, int]]
TYPE_FLAGS: int TYPE_FLAGS: Final[int]
GLOBAL_FLAGS: int GLOBAL_FLAGS: Final[int]
if sys.version_info >= (3, 11): if sys.version_info >= (3, 11):
MAXWIDTH: int MAXWIDTH: Final[int]
if sys.version_info < (3, 11): if sys.version_info < (3, 11):
class Verbose(Exception): ... class Verbose(Exception): ...
@ -41,7 +41,7 @@ class State:
lookbehindgroups: int | None lookbehindgroups: int | None
@property @property
def groups(self) -> int: ... def groups(self) -> int: ...
def opengroup(self, name: str | None = ...) -> int: ... def opengroup(self, name: str | None = None) -> int: ...
def closegroup(self, gid: int, p: SubPattern) -> None: ... def closegroup(self, gid: int, p: SubPattern) -> None: ...
def checkgroup(self, gid: int) -> bool: ... def checkgroup(self, gid: int) -> bool: ...
def checklookbehindgroup(self, gid: int, source: Tokenizer) -> None: ... def checklookbehindgroup(self, gid: int, source: Tokenizer) -> None: ...

View file

@ -188,7 +188,7 @@ class SSLCertVerificationError(SSLError, ValueError):
CertificateError = SSLCertVerificationError CertificateError = SSLCertVerificationError
if sys.version_info < (3, 12): if sys.version_info < (3, 12):
@deprecated("Deprecated since Python 3.7. Removed in Python 3.12. Use `SSLContext.wrap_socket()` instead.") @deprecated("Deprecated since Python 3.7; removed in Python 3.12. Use `SSLContext.wrap_socket()` instead.")
def wrap_socket( def wrap_socket(
sock: socket.socket, sock: socket.socket,
keyfile: StrOrBytesPath | None = None, keyfile: StrOrBytesPath | None = None,
@ -201,7 +201,7 @@ if sys.version_info < (3, 12):
suppress_ragged_eofs: bool = True, suppress_ragged_eofs: bool = True,
ciphers: str | None = None, ciphers: str | None = None,
) -> SSLSocket: ... ) -> SSLSocket: ...
@deprecated("Deprecated since Python 3.7. Removed in Python 3.12.") @deprecated("Deprecated since Python 3.7; removed in Python 3.12.")
def match_hostname(cert: _PeerCertRetDictType, hostname: str) -> None: def match_hostname(cert: _PeerCertRetDictType, hostname: str) -> None:
"""Verify that *cert* (in decoded format as returned by """Verify that *cert* (in decoded format as returned by
SSLSocket.getpeercert()) matches the *hostname*. RFC 2818 and RFC 6125 SSLSocket.getpeercert()) matches the *hostname*. RFC 2818 and RFC 6125

View file

@ -523,6 +523,7 @@ def variance(data: Iterable[_NumberT], xbar: _NumberT | None = None) -> _NumberT
class NormalDist: class NormalDist:
"""Normal distribution of a random variable""" """Normal distribution of a random variable"""
__slots__ = {"_mu": "Arithmetic mean of a normal distribution", "_sigma": "Standard deviation of a normal distribution"}
def __init__(self, mu: float = 0.0, sigma: float = 1.0) -> None: def __init__(self, mu: float = 0.0, sigma: float = 1.0) -> None:
"""NormalDist where mu is the mean and sigma is the standard deviation.""" """NormalDist where mu is the mean and sigma is the standard deviation."""

View file

@ -18,7 +18,7 @@ import sys
from _typeshed import StrOrLiteralStr from _typeshed import StrOrLiteralStr
from collections.abc import Iterable, Mapping, Sequence from collections.abc import Iterable, Mapping, Sequence
from re import Pattern, RegexFlag from re import Pattern, RegexFlag
from typing import Any, ClassVar, overload from typing import Any, ClassVar, Final, overload
from typing_extensions import LiteralString from typing_extensions import LiteralString
__all__ = [ __all__ = [
@ -36,15 +36,15 @@ __all__ = [
"Template", "Template",
] ]
ascii_letters: LiteralString whitespace: Final = " \t\n\r\v\f"
ascii_lowercase: LiteralString ascii_lowercase: Final = "abcdefghijklmnopqrstuvwxyz"
ascii_uppercase: LiteralString ascii_uppercase: Final = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
digits: LiteralString ascii_letters: Final[LiteralString] # string too long
hexdigits: LiteralString digits: Final = "0123456789"
octdigits: LiteralString hexdigits: Final = "0123456789abcdefABCDEF"
punctuation: LiteralString octdigits: Final = "01234567"
printable: LiteralString punctuation: Final = r"""!"#$%&'()*+,-./:;<=>?@[\]^_`{|}~"""
whitespace: LiteralString printable: Final[LiteralString] # string too long
def capwords(s: StrOrLiteralStr, sep: StrOrLiteralStr | None = None) -> StrOrLiteralStr: def capwords(s: StrOrLiteralStr, sep: StrOrLiteralStr | None = None) -> StrOrLiteralStr:
"""capwords(s [,sep]) -> string """capwords(s [,sep]) -> string

View file

@ -4,13 +4,15 @@ There are two kinds of tables: sets, for which a member test is provided,
and mappings, for which a mapping function is provided. and mappings, for which a mapping function is provided.
""" """
b1_set: set[int] from typing import Final
b3_exceptions: dict[int, str]
c22_specials: set[int] b1_set: Final[set[int]]
c6_set: set[int] b3_exceptions: Final[dict[int, str]]
c7_set: set[int] c22_specials: Final[set[int]]
c8_set: set[int] c6_set: Final[set[int]]
c9_set: set[int] c7_set: Final[set[int]]
c8_set: Final[set[int]]
c9_set: Final[set[int]]
def in_table_a1(code: str) -> bool: ... def in_table_a1(code: str) -> bool: ...
def in_table_b1(code: str) -> bool: ... def in_table_b1(code: str) -> bool: ...

View file

@ -104,27 +104,27 @@ is destroyed.
""" """
from _typeshed import Unused from _typeshed import Unused
from typing import IO, Any, Literal, NamedTuple, NoReturn, overload from typing import IO, Any, Final, Literal, NamedTuple, NoReturn, overload
from typing_extensions import Self, TypeAlias from typing_extensions import Self, TypeAlias
_File: TypeAlias = str | IO[bytes] _File: TypeAlias = str | IO[bytes]
class Error(Exception): ... class Error(Exception): ...
AUDIO_FILE_MAGIC: int AUDIO_FILE_MAGIC: Final = 0x2E736E64
AUDIO_FILE_ENCODING_MULAW_8: int AUDIO_FILE_ENCODING_MULAW_8: Final = 1
AUDIO_FILE_ENCODING_LINEAR_8: int AUDIO_FILE_ENCODING_LINEAR_8: Final = 2
AUDIO_FILE_ENCODING_LINEAR_16: int AUDIO_FILE_ENCODING_LINEAR_16: Final = 3
AUDIO_FILE_ENCODING_LINEAR_24: int AUDIO_FILE_ENCODING_LINEAR_24: Final = 4
AUDIO_FILE_ENCODING_LINEAR_32: int AUDIO_FILE_ENCODING_LINEAR_32: Final = 5
AUDIO_FILE_ENCODING_FLOAT: int AUDIO_FILE_ENCODING_FLOAT: Final = 6
AUDIO_FILE_ENCODING_DOUBLE: int AUDIO_FILE_ENCODING_DOUBLE: Final = 7
AUDIO_FILE_ENCODING_ADPCM_G721: int AUDIO_FILE_ENCODING_ADPCM_G721: Final = 23
AUDIO_FILE_ENCODING_ADPCM_G722: int AUDIO_FILE_ENCODING_ADPCM_G722: Final = 24
AUDIO_FILE_ENCODING_ADPCM_G723_3: int AUDIO_FILE_ENCODING_ADPCM_G723_3: Final = 25
AUDIO_FILE_ENCODING_ADPCM_G723_5: int AUDIO_FILE_ENCODING_ADPCM_G723_5: Final = 26
AUDIO_FILE_ENCODING_ALAW_8: int AUDIO_FILE_ENCODING_ALAW_8: Final = 27
AUDIO_UNKNOWN_SIZE: int AUDIO_UNKNOWN_SIZE: Final = 0xFFFFFFFF
class _sunau_params(NamedTuple): class _sunau_params(NamedTuple):
"""_sunau_params(nchannels, sampwidth, framerate, nframes, comptype, compname)""" """_sunau_params(nchannels, sampwidth, framerate, nframes, comptype, compname)"""

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