Sync vendored typeshed stubs (#14977)

Co-authored-by: typeshedbot <>
Co-authored-by: Alex Waygood <alex.waygood@gmail.com>
This commit is contained in:
github-actions[bot] 2024-12-15 01:02:41 +00:00 committed by GitHub
parent 4d64cdb83c
commit 53c7ef8bfe
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
38 changed files with 584 additions and 299 deletions

View file

@ -3,6 +3,6 @@
```py ```py
import builtins import builtins
x = builtins.copyright x = builtins.chr
reveal_type(x) # revealed: Literal[copyright] reveal_type(x) # revealed: Literal[chr]
``` ```

View file

@ -10,10 +10,10 @@ def returns_bool() -> bool:
return True return True
if returns_bool(): if returns_bool():
copyright = 1 chr = 1
def f(): def f():
reveal_type(copyright) # revealed: Literal[copyright] | Literal[1] reveal_type(chr) # revealed: Literal[chr] | Literal[1]
``` ```
## Conditionally global or builtin, with annotation ## Conditionally global or builtin, with annotation
@ -25,8 +25,8 @@ def returns_bool() -> bool:
return True return True
if returns_bool(): if returns_bool():
copyright: int = 1 chr: int = 1
def f(): def f():
reveal_type(copyright) # revealed: Literal[copyright] | int reveal_type(chr) # revealed: Literal[chr] | int
``` ```

View file

@ -5672,9 +5672,9 @@ mod tests {
fn builtin_symbol_vendored_stdlib() -> anyhow::Result<()> { fn builtin_symbol_vendored_stdlib() -> anyhow::Result<()> {
let mut db = setup_db(); let mut db = setup_db();
db.write_file("/src/a.py", "c = copyright")?; db.write_file("/src/a.py", "c = chr")?;
assert_public_ty(&db, "/src/a.py", "c", "Literal[copyright]"); assert_public_ty(&db, "/src/a.py", "c", "Literal[chr]");
Ok(()) Ok(())
} }

View file

@ -1 +1 @@
0a2da01946a406ede42e9c66f416a7e7758991d6 fc11e835108394728930059c8db5b436209bc957

View file

@ -57,6 +57,7 @@ _msi: 3.0-3.12
_multibytecodec: 3.0- _multibytecodec: 3.0-
_operator: 3.4- _operator: 3.4-
_osx_support: 3.0- _osx_support: 3.0-
_pickle: 3.0-
_posixsubprocess: 3.2- _posixsubprocess: 3.2-
_py_abc: 3.7- _py_abc: 3.7-
_pydecimal: 3.5- _pydecimal: 3.5-

View file

@ -1,11 +1,23 @@
import sys from _threading_local import local as local
from _thread import _excepthook, _ExceptHookArgs
from _typeshed import ProfileFunction, TraceFunction from _typeshed import ProfileFunction, TraceFunction
from collections.abc import Callable, Iterable, Mapping from threading import (
from types import TracebackType TIMEOUT_MAX as TIMEOUT_MAX,
from typing import Any, TypeVar Barrier as Barrier,
BoundedSemaphore as BoundedSemaphore,
_T = TypeVar("_T") BrokenBarrierError as BrokenBarrierError,
Condition as Condition,
Event as Event,
ExceptHookArgs as ExceptHookArgs,
Lock as Lock,
RLock as RLock,
Semaphore as Semaphore,
Thread as Thread,
ThreadError as ThreadError,
Timer as Timer,
_DummyThread as _DummyThread,
_RLock as _RLock,
excepthook as excepthook,
)
__all__ = [ __all__ = [
"get_ident", "get_ident",
@ -42,123 +54,3 @@ def main_thread() -> Thread: ...
def settrace(func: TraceFunction) -> None: ... def settrace(func: TraceFunction) -> None: ...
def setprofile(func: ProfileFunction | None) -> None: ... def setprofile(func: ProfileFunction | None) -> None: ...
def stack_size(size: int | None = None) -> int: ... def stack_size(size: int | None = None) -> int: ...
TIMEOUT_MAX: float
class ThreadError(Exception): ...
class local:
def __getattribute__(self, name: str) -> Any: ...
def __setattr__(self, name: str, value: Any) -> None: ...
def __delattr__(self, name: str) -> None: ...
class Thread:
name: str
daemon: bool
@property
def ident(self) -> int | None: ...
def __init__(
self,
group: None = None,
target: Callable[..., object] | None = None,
name: str | None = None,
args: Iterable[Any] = (),
kwargs: Mapping[str, Any] | None = None,
*,
daemon: bool | None = None,
) -> None: ...
def start(self) -> None: ...
def run(self) -> None: ...
def join(self, timeout: float | None = None) -> None: ...
def getName(self) -> str: ...
def setName(self, name: str) -> None: ...
@property
def native_id(self) -> int | None: ... # only available on some platforms
def is_alive(self) -> bool: ...
if sys.version_info < (3, 9):
def isAlive(self) -> bool: ...
def isDaemon(self) -> bool: ...
def setDaemon(self, daemonic: bool) -> None: ...
class _DummyThread(Thread): ...
class Lock:
def __enter__(self) -> bool: ...
def __exit__(
self, exc_type: type[BaseException] | None, exc_val: BaseException | None, exc_tb: TracebackType | None
) -> bool | None: ...
def acquire(self, blocking: bool = ..., timeout: float = ...) -> bool: ...
def release(self) -> None: ...
def locked(self) -> bool: ...
class _RLock:
def __enter__(self) -> bool: ...
def __exit__(
self, exc_type: type[BaseException] | None, exc_val: BaseException | None, exc_tb: TracebackType | None
) -> bool | None: ...
def acquire(self, blocking: bool = True, timeout: float = -1) -> bool: ...
def release(self) -> None: ...
RLock = _RLock
class Condition:
def __init__(self, lock: Lock | _RLock | None = None) -> None: ...
def __enter__(self) -> bool: ...
def __exit__(
self, exc_type: type[BaseException] | None, exc_val: BaseException | None, exc_tb: TracebackType | None
) -> bool | None: ...
def acquire(self, blocking: bool = ..., timeout: float = ...) -> bool: ...
def release(self) -> None: ...
def wait(self, timeout: float | None = None) -> bool: ...
def wait_for(self, predicate: Callable[[], _T], timeout: float | None = None) -> _T: ...
def notify(self, n: int = 1) -> None: ...
def notify_all(self) -> None: ...
def notifyAll(self) -> None: ...
class Semaphore:
def __init__(self, value: int = 1) -> None: ...
def __exit__(
self, exc_type: type[BaseException] | None, exc_val: BaseException | None, exc_tb: TracebackType | None
) -> bool | None: ...
def acquire(self, blocking: bool = True, timeout: float | None = None) -> bool: ...
def __enter__(self, blocking: bool = True, timeout: float | None = None) -> bool: ...
if sys.version_info >= (3, 9):
def release(self, n: int = ...) -> None: ...
else:
def release(self) -> None: ...
class BoundedSemaphore(Semaphore): ...
class Event:
def is_set(self) -> bool: ...
def set(self) -> None: ...
def clear(self) -> None: ...
def wait(self, timeout: float | None = None) -> bool: ...
excepthook = _excepthook
ExceptHookArgs = _ExceptHookArgs
class Timer(Thread):
def __init__(
self,
interval: float,
function: Callable[..., object],
args: Iterable[Any] | None = None,
kwargs: Mapping[str, Any] | None = None,
) -> None: ...
def cancel(self) -> None: ...
class Barrier:
@property
def parties(self) -> int: ...
@property
def n_waiting(self) -> int: ...
@property
def broken(self) -> bool: ...
def __init__(self, parties: int, action: Callable[[], None] | None = None, timeout: float | None = None) -> None: ...
def wait(self, timeout: float | None = None) -> int: ...
def reset(self) -> None: ...
def abort(self) -> None: ...
class BrokenBarrierError(RuntimeError): ...

View file

@ -0,0 +1,108 @@
import sys
from _typeshed import ReadableBuffer, SupportsWrite
from collections.abc import Callable, Iterable, Iterator, Mapping
from pickle import PickleBuffer as PickleBuffer
from typing import Any, Protocol, type_check_only
from typing_extensions import TypeAlias
class _ReadableFileobj(Protocol):
def read(self, n: int, /) -> bytes: ...
def readline(self) -> bytes: ...
_BufferCallback: TypeAlias = Callable[[PickleBuffer], Any] | None
_ReducedType: TypeAlias = (
str
| tuple[Callable[..., Any], tuple[Any, ...]]
| tuple[Callable[..., Any], tuple[Any, ...], Any]
| tuple[Callable[..., Any], tuple[Any, ...], Any, Iterator[Any] | None]
| tuple[Callable[..., Any], tuple[Any, ...], Any, Iterator[Any] | None, Iterator[Any] | None]
)
def dump(
obj: Any,
file: SupportsWrite[bytes],
protocol: int | None = None,
*,
fix_imports: bool = True,
buffer_callback: _BufferCallback = None,
) -> None: ...
def dumps(
obj: Any, protocol: int | None = None, *, fix_imports: bool = True, buffer_callback: _BufferCallback = None
) -> bytes: ...
def load(
file: _ReadableFileobj,
*,
fix_imports: bool = True,
encoding: str = "ASCII",
errors: str = "strict",
buffers: Iterable[Any] | None = (),
) -> Any: ...
def loads(
data: ReadableBuffer,
/,
*,
fix_imports: bool = True,
encoding: str = "ASCII",
errors: str = "strict",
buffers: Iterable[Any] | None = (),
) -> Any: ...
class PickleError(Exception): ...
class PicklingError(PickleError): ...
class UnpicklingError(PickleError): ...
@type_check_only
class PicklerMemoProxy:
def clear(self, /) -> None: ...
def copy(self, /) -> dict[int, tuple[int, Any]]: ...
class Pickler:
fast: bool
dispatch_table: Mapping[type, Callable[[Any], _ReducedType]]
reducer_override: Callable[[Any], Any]
bin: bool # undocumented
def __init__(
self,
file: SupportsWrite[bytes],
protocol: int | None = None,
*,
fix_imports: bool = True,
buffer_callback: _BufferCallback = None,
) -> None: ...
@property
def memo(self) -> PicklerMemoProxy: ...
@memo.setter
def memo(self, value: PicklerMemoProxy | dict[int, tuple[int, Any]]) -> None: ...
def dump(self, obj: Any, /) -> None: ...
def clear_memo(self) -> None: ...
if sys.version_info >= (3, 13):
def persistent_id(self, obj: Any, /) -> Any: ...
else:
persistent_id: Callable[[Any], Any]
@type_check_only
class UnpicklerMemoProxy:
def clear(self, /) -> None: ...
def copy(self, /) -> dict[int, tuple[int, Any]]: ...
class Unpickler:
def __init__(
self,
file: _ReadableFileobj,
*,
fix_imports: bool = True,
encoding: str = "ASCII",
errors: str = "strict",
buffers: Iterable[Any] | None = (),
) -> None: ...
@property
def memo(self) -> UnpicklerMemoProxy: ...
@memo.setter
def memo(self, value: UnpicklerMemoProxy | dict[int, tuple[int, Any]]) -> None: ...
def load(self) -> Any: ...
def find_class(self, module_name: str, global_name: str, /) -> Any: ...
if sys.version_info >= (3, 13):
def persistent_load(self, pid: Any, /) -> Any: ...
else:
persistent_load: Callable[[Any], Any]

View file

@ -1,3 +1,4 @@
import sys
from collections.abc import Iterable from collections.abc import Iterable
from typing import ClassVar, Literal, NoReturn from typing import ClassVar, Literal, NoReturn
@ -5,7 +6,7 @@ class Quitter:
name: str name: str
eof: str eof: str
def __init__(self, name: str, eof: str) -> None: ... def __init__(self, name: str, eof: str) -> None: ...
def __call__(self, code: int | None = None) -> NoReturn: ... def __call__(self, code: sys._ExitCode = None) -> NoReturn: ...
class _Printer: class _Printer:
MAXLINES: ClassVar[Literal[23]] MAXLINES: ClassVar[Literal[23]]
@ -13,4 +14,4 @@ class _Printer:
def __call__(self) -> None: ... def __call__(self) -> None: ...
class _Helper: class _Helper:
def __call__(self, request: object) -> None: ... def __call__(self, request: object = ...) -> None: ...

View file

@ -78,8 +78,10 @@ if sys.platform == "win32":
SO_EXCLUSIVEADDRUSE: int SO_EXCLUSIVEADDRUSE: int
if sys.platform != "win32": if sys.platform != "win32":
SO_REUSEPORT: int SO_REUSEPORT: int
if sys.platform != "win32" and sys.platform != "darwin": if sys.platform != "darwin" or sys.version_info >= (3, 13):
SO_BINDTODEVICE: int SO_BINDTODEVICE: int
if sys.platform != "win32" and sys.platform != "darwin":
SO_DOMAIN: int SO_DOMAIN: int
SO_MARK: int SO_MARK: int
SO_PASSCRED: int SO_PASSCRED: int

View file

@ -113,6 +113,20 @@ TK_VERSION: Final[str]
class TkttType: class TkttType:
def deletetimerhandler(self): ... def deletetimerhandler(self): ...
if sys.version_info >= (3, 13):
def create(
screenName: str | None = None,
baseName: str = "",
className: str = "Tk",
interactive: bool = False,
wantobjects: int = 0,
wantTk: bool = True,
sync: bool = False,
use: str | None = None,
/,
): ...
else:
def create( def create(
screenName: str | None = None, screenName: str | None = None,
baseName: str = "", baseName: str = "",
@ -124,5 +138,6 @@ def create(
use: str | None = None, use: str | None = None,
/, /,
): ... ): ...
def getbusywaitinterval(): ... def getbusywaitinterval(): ...
def setbusywaitinterval(new_val, /): ... def setbusywaitinterval(new_val, /): ...

View file

@ -182,30 +182,30 @@ class ArgumentParser(_AttributeHolder, _ActionsContainer):
def add_subparsers( def add_subparsers(
self: _ArgumentParserT, self: _ArgumentParserT,
*, *,
title: str = ..., title: str = "subcommands",
description: str | None = ..., description: str | None = None,
prog: str = ..., prog: str | None = None,
action: type[Action] = ..., action: type[Action] = ...,
option_string: str = ..., option_string: str = ...,
dest: str | None = ..., dest: str | None = None,
required: bool = ..., required: bool = False,
help: str | None = ..., help: str | None = None,
metavar: str | None = ..., metavar: str | None = None,
) -> _SubParsersAction[_ArgumentParserT]: ... ) -> _SubParsersAction[_ArgumentParserT]: ...
@overload @overload
def add_subparsers( def add_subparsers(
self, self,
*, *,
title: str = ..., title: str = "subcommands",
description: str | None = ..., description: str | None = None,
prog: str = ..., prog: str | None = None,
parser_class: type[_ArgumentParserT], parser_class: type[_ArgumentParserT],
action: type[Action] = ..., action: type[Action] = ...,
option_string: str = ..., option_string: str = ...,
dest: str | None = ..., dest: str | None = None,
required: bool = ..., required: bool = False,
help: str | None = ..., help: str | None = None,
metavar: str | None = ..., metavar: str | None = None,
) -> _SubParsersAction[_ArgumentParserT]: ... ) -> _SubParsersAction[_ArgumentParserT]: ...
def print_usage(self, file: IO[str] | None = None) -> None: ... def print_usage(self, file: IO[str] | None = None) -> None: ...
def print_help(self, file: IO[str] | None = None) -> None: ... def print_help(self, file: IO[str] | None = None) -> None: ...
@ -237,7 +237,13 @@ class ArgumentParser(_AttributeHolder, _ActionsContainer):
# undocumented # undocumented
def _get_optional_actions(self) -> list[Action]: ... def _get_optional_actions(self) -> list[Action]: ...
def _get_positional_actions(self) -> list[Action]: ... def _get_positional_actions(self) -> list[Action]: ...
if sys.version_info >= (3, 12):
def _parse_known_args(
self, arg_strings: list[str], namespace: Namespace, intermixed: bool
) -> tuple[Namespace, list[str]]: ...
else:
def _parse_known_args(self, arg_strings: list[str], namespace: Namespace) -> tuple[Namespace, list[str]]: ... def _parse_known_args(self, arg_strings: list[str], namespace: Namespace) -> tuple[Namespace, list[str]]: ...
def _read_args_from_files(self, arg_strings: list[str]) -> list[str]: ... def _read_args_from_files(self, arg_strings: list[str]) -> list[str]: ...
def _match_argument(self, action: Action, arg_strings_pattern: str) -> int: ... def _match_argument(self, action: Action, arg_strings_pattern: str) -> int: ...
def _match_arguments_partial(self, actions: Sequence[Action], arg_strings_pattern: str) -> list[int]: ... def _match_arguments_partial(self, actions: Sequence[Action], arg_strings_pattern: str) -> list[int]: ...

View file

@ -62,3 +62,4 @@ class _ProactorSocketTransport(_ProactorReadPipeTransport, _ProactorBaseWritePip
class BaseProactorEventLoop(base_events.BaseEventLoop): class BaseProactorEventLoop(base_events.BaseEventLoop):
def __init__(self, proactor: Any) -> None: ... def __init__(self, proactor: Any) -> None: ...
async def sock_recv(self, sock: socket, n: int) -> bytes: ...

View file

@ -1,4 +1,5 @@
import selectors import selectors
from socket import socket
from . import base_events from . import base_events
@ -6,3 +7,4 @@ __all__ = ("BaseSelectorEventLoop",)
class BaseSelectorEventLoop(base_events.BaseEventLoop): class BaseSelectorEventLoop(base_events.BaseEventLoop):
def __init__(self, selector: selectors.BaseSelector | None = None) -> None: ... def __init__(self, selector: selectors.BaseSelector | None = None) -> None: ...
async def sock_recv(self, sock: socket, n: int) -> bytes: ...

View file

@ -1,5 +1,6 @@
# ruff: noqa: PYI036 # This is the module declaring BaseException # ruff: noqa: PYI036 # This is the module declaring BaseException
import _ast import _ast
import _sitebuiltins
import _typeshed import _typeshed
import sys import sys
import types import types
@ -46,7 +47,6 @@ from typing import ( # noqa: Y022
Mapping, Mapping,
MutableMapping, MutableMapping,
MutableSequence, MutableSequence,
NoReturn,
Protocol, Protocol,
Sequence, Sequence,
SupportsAbs, SupportsAbs,
@ -1362,8 +1362,10 @@ def compile(
*, *,
_feature_version: int = -1, _feature_version: int = -1,
) -> Any: ... ) -> Any: ...
def copyright() -> None: ...
def credits() -> None: ... copyright: _sitebuiltins._Printer
credits: _sitebuiltins._Printer
def delattr(obj: object, name: str, /) -> None: ... def delattr(obj: object, name: str, /) -> None: ...
def dir(o: object = ..., /) -> list[str]: ... def dir(o: object = ..., /) -> list[str]: ...
@overload @overload
@ -1418,7 +1420,7 @@ else:
/, /,
) -> None: ... ) -> None: ...
def exit(code: sys._ExitCode = None) -> NoReturn: ... exit: _sitebuiltins.Quitter
class filter(Generic[_T]): class filter(Generic[_T]):
@overload @overload
@ -1452,7 +1454,9 @@ def getattr(o: object, name: str, default: _T, /) -> Any | _T: ...
def globals() -> dict[str, Any]: ... def globals() -> dict[str, Any]: ...
def hasattr(obj: object, name: str, /) -> bool: ... def hasattr(obj: object, name: str, /) -> bool: ...
def hash(obj: object, /) -> int: ... def hash(obj: object, /) -> int: ...
def help(request: object = ...) -> None: ...
help: _sitebuiltins._Helper
def hex(number: int | SupportsIndex, /) -> str: ... def hex(number: int | SupportsIndex, /) -> str: ...
def id(obj: object, /) -> int: ... def id(obj: object, /) -> int: ...
def input(prompt: object = "", /) -> str: ... def input(prompt: object = "", /) -> str: ...
@ -1478,7 +1482,9 @@ else:
def isinstance(obj: object, class_or_tuple: _ClassInfo, /) -> bool: ... def isinstance(obj: object, class_or_tuple: _ClassInfo, /) -> bool: ...
def issubclass(cls: type, class_or_tuple: _ClassInfo, /) -> bool: ... def issubclass(cls: type, class_or_tuple: _ClassInfo, /) -> bool: ...
def len(obj: Sized, /) -> int: ... def len(obj: Sized, /) -> int: ...
def license() -> None: ...
license: _sitebuiltins._Printer
def locals() -> dict[str, Any]: ... def locals() -> dict[str, Any]: ...
class map(Generic[_S]): class map(Generic[_S]):
@ -1721,7 +1727,8 @@ def pow(base: _SupportsPow3[_E, _M, _T_co], exp: _E, mod: _M) -> _T_co: ...
def pow(base: _SupportsSomeKindOfPow, exp: float, mod: None = None) -> Any: ... def pow(base: _SupportsSomeKindOfPow, exp: float, mod: None = None) -> Any: ...
@overload @overload
def pow(base: _SupportsSomeKindOfPow, exp: complex, mod: None = None) -> complex: ... def pow(base: _SupportsSomeKindOfPow, exp: complex, mod: None = None) -> complex: ...
def quit(code: sys._ExitCode = None) -> NoReturn: ...
quit: _sitebuiltins.Quitter
class reversed(Generic[_T]): class reversed(Generic[_T]):
@overload @overload

View file

@ -1,3 +1,4 @@
import sys
from types import CodeType from types import CodeType
__all__ = ["compile_command", "Compile", "CommandCompiler"] __all__ = ["compile_command", "Compile", "CommandCompiler"]
@ -6,6 +7,9 @@ def compile_command(source: str, filename: str = "<input>", symbol: str = "singl
class Compile: class Compile:
flags: int flags: int
if sys.version_info >= (3, 13):
def __call__(self, source: str, filename: str, symbol: str, flags: int = 0) -> CodeType: ...
else:
def __call__(self, source: str, filename: str, symbol: str) -> CodeType: ... def __call__(self, source: str, filename: str, symbol: str) -> CodeType: ...
class CommandCompiler: class CommandCompiler:

View file

@ -72,9 +72,19 @@ class _CallItem:
class _SafeQueue(Queue[Future[Any]]): class _SafeQueue(Queue[Future[Any]]):
pending_work_items: dict[int, _WorkItem[Any]] pending_work_items: dict[int, _WorkItem[Any]]
if sys.version_info < (3, 12):
shutdown_lock: Lock shutdown_lock: Lock
thread_wakeup: _ThreadWakeup thread_wakeup: _ThreadWakeup
if sys.version_info >= (3, 9): if sys.version_info >= (3, 12):
def __init__(
self,
max_size: int | None = 0,
*,
ctx: BaseContext,
pending_work_items: dict[int, _WorkItem[Any]],
thread_wakeup: _ThreadWakeup,
) -> None: ...
elif sys.version_info >= (3, 9):
def __init__( def __init__(
self, self,
max_size: int | None = 0, max_size: int | None = 0,

View file

@ -47,7 +47,7 @@ class ArgumentError(Exception): ...
class CDLL: class CDLL:
_func_flags_: ClassVar[int] _func_flags_: ClassVar[int]
_func_restype_: ClassVar[_CDataType] _func_restype_: ClassVar[type[_CDataType]]
_name: str _name: str
_handle: int _handle: int
_FuncPtr: type[_FuncPointer] _FuncPtr: type[_FuncPointer]
@ -202,7 +202,10 @@ if sys.platform == "win32":
class HRESULT(_SimpleCData[int]): ... # TODO undocumented class HRESULT(_SimpleCData[int]): ... # TODO undocumented
if sys.version_info >= (3, 12): if sys.version_info >= (3, 12):
c_time_t: type[c_int32 | c_int64] # alias for one or the other at runtime # At runtime, this is an alias for either c_int32 or c_int64,
# which are themselves an alias for one of c_short, c_int, c_long, or c_longlong
# This covers all our bases.
c_time_t: type[c_int32 | c_int64 | c_short | c_int | c_long | c_longlong]
class py_object(_CanCastTo, _SimpleCData[_T]): ... class py_object(_CanCastTo, _SimpleCData[_T]): ...

View file

@ -27,11 +27,11 @@ class Fraction(Rational):
@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: ...
@overload @overload
def __new__(cls, value: float | Decimal | str, /) -> Self: ... def __new__(cls, numerator: float | Decimal | str) -> Self: ...
if sys.version_info >= (3, 14): if sys.version_info >= (3, 14):
@overload @overload
def __new__(cls, value: _ConvertibleToIntegerRatio) -> Self: ... def __new__(cls, numerator: _ConvertibleToIntegerRatio) -> Self: ...
@classmethod @classmethod
def from_float(cls, f: float) -> Self: ... def from_float(cls, f: float) -> Self: ...

View file

@ -2,8 +2,8 @@ import _compression
import sys import sys
import zlib import zlib
from _typeshed import ReadableBuffer, SizedBuffer, StrOrBytesPath from _typeshed import ReadableBuffer, SizedBuffer, StrOrBytesPath
from io import FileIO from io import FileIO, TextIOWrapper
from typing import Final, Literal, Protocol, TextIO, overload from typing import Final, Literal, Protocol, overload
from typing_extensions import TypeAlias from typing_extensions import TypeAlias
__all__ = ["BadGzipFile", "GzipFile", "open", "compress", "decompress"] __all__ = ["BadGzipFile", "GzipFile", "open", "compress", "decompress"]
@ -57,13 +57,13 @@ def open(
) -> GzipFile: ... ) -> GzipFile: ...
@overload @overload
def open( def open(
filename: StrOrBytesPath, filename: StrOrBytesPath | _ReadableFileobj | _WritableFileobj,
mode: _OpenTextMode, mode: _OpenTextMode,
compresslevel: int = 9, compresslevel: int = 9,
encoding: str | None = None, encoding: str | None = None,
errors: str | None = None, errors: str | None = None,
newline: str | None = None, newline: str | None = None,
) -> TextIO: ... ) -> TextIOWrapper: ...
@overload @overload
def open( def open(
filename: StrOrBytesPath | _ReadableFileobj | _WritableFileobj, filename: StrOrBytesPath | _ReadableFileobj | _WritableFileobj,
@ -72,7 +72,7 @@ def open(
encoding: str | None = None, encoding: str | None = None,
errors: str | None = None, errors: str | None = None,
newline: str | None = None, newline: str | None = None,
) -> GzipFile | TextIO: ... ) -> GzipFile | TextIOWrapper: ...
class _PaddedFile: class _PaddedFile:
file: _ReadableFileobj file: _ReadableFileobj

View file

@ -1,12 +1,12 @@
import pickle import pickle
import sys import sys
from _pickle import _ReducedType
from _typeshed import HasFileno, SupportsWrite, Unused from _typeshed import HasFileno, SupportsWrite, Unused
from abc import ABCMeta from abc import ABCMeta
from builtins import type as Type # alias to avoid name clash from builtins import type as Type # alias to avoid name clash
from collections.abc import Callable from collections.abc import Callable
from copyreg import _DispatchTableType from copyreg import _DispatchTableType
from multiprocessing import connection from multiprocessing import connection
from pickle import _ReducedType
from socket import socket from socket import socket
from typing import Any, Final from typing import Any, Final

View file

@ -182,6 +182,8 @@ class Values:
def ensure_value(self, attr: str, value): ... def ensure_value(self, attr: str, value): ...
def read_file(self, filename: str, mode: str = "careful") -> None: ... def read_file(self, filename: str, mode: str = "careful") -> None: ...
def read_module(self, modname: str, mode: str = "careful") -> None: ... def read_module(self, modname: str, mode: str = "careful") -> None: ...
# __getattr__ doesn't exist, but anything passed as a default to __init__
# is set on the instance.
def __getattr__(self, name: str): ... def __getattr__(self, name: str): ...
def __setattr__(self, name: str, value, /) -> None: ... def __setattr__(self, name: str, value, /) -> None: ...
def __eq__(self, other: object) -> bool: ... def __eq__(self, other: object) -> bool: ...

View file

@ -231,6 +231,7 @@ if sys.platform == "linux" and sys.version_info >= (3, 12):
"CLONE_NEWNET", "CLONE_NEWNET",
"CLONE_NEWNS", "CLONE_NEWNS",
"CLONE_NEWPID", "CLONE_NEWPID",
"CLONE_NEWTIME",
"CLONE_NEWUSER", "CLONE_NEWUSER",
"CLONE_NEWUTS", "CLONE_NEWUTS",
"CLONE_SIGHAND", "CLONE_SIGHAND",

View file

@ -1,7 +1,20 @@
from _pickle import (
PickleError as PickleError,
Pickler as Pickler,
PicklingError as PicklingError,
Unpickler as Unpickler,
UnpicklingError as UnpicklingError,
_BufferCallback,
_ReadableFileobj,
_ReducedType,
dump as dump,
dumps as dumps,
load as load,
loads as loads,
)
from _typeshed import ReadableBuffer, SupportsWrite from _typeshed import ReadableBuffer, SupportsWrite
from collections.abc import Callable, Iterable, Iterator, Mapping from collections.abc import Callable, Iterable, Mapping
from typing import Any, ClassVar, Protocol, SupportsBytes, SupportsIndex, final from typing import Any, ClassVar, SupportsBytes, SupportsIndex, final
from typing_extensions import TypeAlias
__all__ = [ __all__ = [
"PickleBuffer", "PickleBuffer",
@ -93,10 +106,6 @@ DEFAULT_PROTOCOL: int
bytes_types: tuple[type[Any], ...] # undocumented bytes_types: tuple[type[Any], ...] # undocumented
class _ReadableFileobj(Protocol):
def read(self, n: int, /) -> bytes: ...
def readline(self) -> bytes: ...
@final @final
class PickleBuffer: class PickleBuffer:
def __init__(self, buffer: ReadableBuffer) -> None: ... def __init__(self, buffer: ReadableBuffer) -> None: ...
@ -105,84 +114,6 @@ class PickleBuffer:
def __buffer__(self, flags: int, /) -> memoryview: ... def __buffer__(self, flags: int, /) -> memoryview: ...
def __release_buffer__(self, buffer: memoryview, /) -> None: ... def __release_buffer__(self, buffer: memoryview, /) -> None: ...
_BufferCallback: TypeAlias = Callable[[PickleBuffer], Any] | None
def dump(
obj: Any,
file: SupportsWrite[bytes],
protocol: int | None = None,
*,
fix_imports: bool = True,
buffer_callback: _BufferCallback = None,
) -> None: ...
def dumps(
obj: Any, protocol: int | None = None, *, fix_imports: bool = True, buffer_callback: _BufferCallback = None
) -> bytes: ...
def load(
file: _ReadableFileobj,
*,
fix_imports: bool = True,
encoding: str = "ASCII",
errors: str = "strict",
buffers: Iterable[Any] | None = (),
) -> Any: ...
def loads(
data: ReadableBuffer,
/,
*,
fix_imports: bool = True,
encoding: str = "ASCII",
errors: str = "strict",
buffers: Iterable[Any] | None = (),
) -> Any: ...
class PickleError(Exception): ...
class PicklingError(PickleError): ...
class UnpicklingError(PickleError): ...
_ReducedType: TypeAlias = (
str
| tuple[Callable[..., Any], tuple[Any, ...]]
| tuple[Callable[..., Any], tuple[Any, ...], Any]
| tuple[Callable[..., Any], tuple[Any, ...], Any, Iterator[Any] | None]
| tuple[Callable[..., Any], tuple[Any, ...], Any, Iterator[Any] | None, Iterator[Any] | None]
)
class Pickler:
fast: bool
dispatch_table: Mapping[type, Callable[[Any], _ReducedType]]
bin: bool # undocumented
dispatch: ClassVar[dict[type, Callable[[Unpickler, Any], None]]] # undocumented, _Pickler only
def __init__(
self,
file: SupportsWrite[bytes],
protocol: int | None = None,
*,
fix_imports: bool = True,
buffer_callback: _BufferCallback = None,
) -> None: ...
def reducer_override(self, obj: Any) -> Any: ...
def dump(self, obj: Any, /) -> None: ...
def clear_memo(self) -> None: ...
def persistent_id(self, obj: Any) -> Any: ...
class Unpickler:
dispatch: ClassVar[dict[int, Callable[[Unpickler], None]]] # undocumented, _Unpickler only
def __init__(
self,
file: _ReadableFileobj,
*,
fix_imports: bool = True,
encoding: str = "ASCII",
errors: str = "strict",
buffers: Iterable[Any] | None = (),
) -> None: ...
def load(self) -> Any: ...
def find_class(self, module_name: str, global_name: str, /) -> Any: ...
def persistent_load(self, pid: Any) -> Any: ...
MARK: bytes MARK: bytes
STOP: bytes STOP: bytes
POP: bytes POP: bytes
@ -266,6 +197,36 @@ READONLY_BUFFER: bytes
def encode_long(x: int) -> bytes: ... # undocumented def encode_long(x: int) -> bytes: ... # undocumented
def decode_long(data: Iterable[SupportsIndex] | SupportsBytes | ReadableBuffer) -> int: ... # undocumented def decode_long(data: Iterable[SupportsIndex] | SupportsBytes | ReadableBuffer) -> int: ... # undocumented
# pure-Python implementations # undocumented pure-Python implementations
_Pickler = Pickler # undocumented class _Pickler:
_Unpickler = Unpickler # undocumented fast: bool
dispatch_table: Mapping[type, Callable[[Any], _ReducedType]]
bin: bool # undocumented
dispatch: ClassVar[dict[type, Callable[[Unpickler, Any], None]]] # undocumented, _Pickler only
reducer_override: Callable[[Any], Any]
def __init__(
self,
file: SupportsWrite[bytes],
protocol: int | None = None,
*,
fix_imports: bool = True,
buffer_callback: _BufferCallback = None,
) -> None: ...
def dump(self, obj: Any) -> None: ...
def clear_memo(self) -> None: ...
def persistent_id(self, obj: Any) -> Any: ...
class _Unpickler:
dispatch: ClassVar[dict[int, Callable[[Unpickler], None]]] # undocumented, _Unpickler only
def __init__(
self,
file: _ReadableFileobj,
*,
fix_imports: bool = True,
encoding: str = "ASCII",
errors: str = "strict",
buffers: Iterable[Any] | None = None,
) -> None: ...
def load(self) -> Any: ...
def find_class(self, module: str, name: str) -> Any: ...
def persistent_load(self, pid: Any) -> Any: ...

View file

@ -1,3 +1,4 @@
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
from typing_extensions import TypeAlias from typing_extensions import TypeAlias
@ -40,6 +41,12 @@ def read_uint8(f: IO[bytes]) -> int: ...
uint8: ArgumentDescriptor uint8: ArgumentDescriptor
if sys.version_info >= (3, 12):
def read_stringnl(
f: IO[bytes], decode: bool = True, stripquotes: bool = True, *, encoding: str = "latin-1"
) -> bytes | str: ...
else:
def read_stringnl(f: IO[bytes], decode: bool = True, stripquotes: bool = True) -> bytes | str: ... def read_stringnl(f: IO[bytes], decode: bool = True, stripquotes: bool = True) -> bytes | str: ...
stringnl: ArgumentDescriptor stringnl: ArgumentDescriptor

View file

@ -10,6 +10,7 @@ if sys.platform != "win32":
POLLERR: int POLLERR: int
POLLHUP: int POLLHUP: int
POLLIN: int POLLIN: int
if sys.platform == "linux":
POLLMSG: int POLLMSG: int
POLLNVAL: int POLLNVAL: int
POLLOUT: int POLLOUT: int
@ -77,6 +78,7 @@ if sys.platform != "linux" and sys.platform != "win32":
KQ_EV_ONESHOT: int KQ_EV_ONESHOT: int
KQ_EV_SYSFLAGS: int KQ_EV_SYSFLAGS: int
KQ_FILTER_AIO: int KQ_FILTER_AIO: int
if sys.platform != "darwin":
KQ_FILTER_NETDEV: int KQ_FILTER_NETDEV: int
KQ_FILTER_PROC: int KQ_FILTER_PROC: int
KQ_FILTER_READ: int KQ_FILTER_READ: int

View file

@ -53,7 +53,7 @@ if sys.platform == "linux":
class DevpollSelector(_PollLikeSelector): class DevpollSelector(_PollLikeSelector):
def fileno(self) -> int: ... def fileno(self) -> int: ...
if sys.platform != "win32": if sys.platform != "win32" and sys.platform != "linux":
class KqueueSelector(_BaseSelectorImpl): class KqueueSelector(_BaseSelectorImpl):
def fileno(self) -> int: ... def fileno(self) -> int: ...
def select(self, timeout: float | None = None) -> list[tuple[SelectorKey, _EventMask]]: ... def select(self, timeout: float | None = None) -> list[tuple[SelectorKey, _EventMask]]: ...

View file

@ -367,7 +367,6 @@ if sys.platform != "win32" and sys.platform != "darwin":
IP_TRANSPARENT as IP_TRANSPARENT, IP_TRANSPARENT as IP_TRANSPARENT,
IPX_TYPE as IPX_TYPE, IPX_TYPE as IPX_TYPE,
SCM_CREDENTIALS as SCM_CREDENTIALS, SCM_CREDENTIALS as SCM_CREDENTIALS,
SO_BINDTODEVICE as SO_BINDTODEVICE,
SO_DOMAIN as SO_DOMAIN, SO_DOMAIN as SO_DOMAIN,
SO_MARK as SO_MARK, SO_MARK as SO_MARK,
SO_PASSCRED as SO_PASSCRED, SO_PASSCRED as SO_PASSCRED,
@ -396,7 +395,6 @@ if sys.platform != "win32" and sys.platform != "darwin":
__all__ += [ __all__ += [
"IP_TRANSPARENT", "IP_TRANSPARENT",
"SCM_CREDENTIALS", "SCM_CREDENTIALS",
"SO_BINDTODEVICE",
"SO_DOMAIN", "SO_DOMAIN",
"SO_MARK", "SO_MARK",
"SO_PASSCRED", "SO_PASSCRED",
@ -517,6 +515,11 @@ if sys.platform != "win32":
"IPV6_RTHDRDSTOPTS", "IPV6_RTHDRDSTOPTS",
] ]
if sys.platform != "darwin" or sys.version_info >= (3, 13):
from _socket import SO_BINDTODEVICE as SO_BINDTODEVICE
__all__ += ["SO_BINDTODEVICE"]
if sys.platform != "darwin" and sys.platform != "linux": if sys.platform != "darwin" and sys.platform != "linux":
if sys.platform != "win32" or sys.version_info >= (3, 9): if sys.platform != "win32" or sys.version_info >= (3, 9):
from _socket import BDADDR_ANY as BDADDR_ANY, BDADDR_LOCAL as BDADDR_LOCAL, BTPROTO_RFCOMM as BTPROTO_RFCOMM from _socket import BDADDR_ANY as BDADDR_ANY, BDADDR_LOCAL as BDADDR_LOCAL, BTPROTO_RFCOMM as BTPROTO_RFCOMM
@ -1046,7 +1049,6 @@ class AddressFamily(IntEnum):
AF_INET = 2 AF_INET = 2
AF_INET6 = 10 AF_INET6 = 10
AF_APPLETALK = 5 AF_APPLETALK = 5
AF_DECnet = ...
AF_IPX = 4 AF_IPX = 4
AF_SNA = 22 AF_SNA = 22
AF_UNSPEC = 0 AF_UNSPEC = 0
@ -1096,7 +1098,7 @@ class AddressFamily(IntEnum):
AF_INET = AddressFamily.AF_INET AF_INET = AddressFamily.AF_INET
AF_INET6 = AddressFamily.AF_INET6 AF_INET6 = AddressFamily.AF_INET6
AF_APPLETALK = AddressFamily.AF_APPLETALK AF_APPLETALK = AddressFamily.AF_APPLETALK
AF_DECnet = AddressFamily.AF_DECnet AF_DECnet: Literal[12]
AF_IPX = AddressFamily.AF_IPX AF_IPX = AddressFamily.AF_IPX
AF_SNA = AddressFamily.AF_SNA AF_SNA = AddressFamily.AF_SNA
AF_UNSPEC = AddressFamily.AF_UNSPEC AF_UNSPEC = AddressFamily.AF_UNSPEC

View file

@ -73,7 +73,7 @@ if sys.version_info >= (3, 10):
__stdin__: Final[TextIOWrapper | None] # Contains the original value of stdin __stdin__: Final[TextIOWrapper | None] # Contains the original value of stdin
__stdout__: Final[TextIOWrapper | None] # Contains the original value of stdout __stdout__: Final[TextIOWrapper | None] # Contains the original value of stdout
__stderr__: Final[TextIOWrapper | None] # Contains the original value of stderr __stderr__: Final[TextIOWrapper | None] # Contains the original value of stderr
tracebacklimit: int tracebacklimit: int | None
version: str version: str
api_version: int api_version: int
warnoptions: Any warnoptions: Any

View file

@ -1,7 +1,7 @@
import bz2 import bz2
import io import io
import sys import sys
from _typeshed import StrOrBytesPath, StrPath, SupportsRead from _typeshed import ReadableBuffer, StrOrBytesPath, StrPath, SupportsRead, WriteableBuffer
from builtins import list as _list # aliases to avoid name clashes with fields named "type" or "list" from builtins import list as _list # aliases to avoid name clashes with fields named "type" or "list"
from collections.abc import Callable, Iterable, Iterator, Mapping from collections.abc import Callable, Iterable, Iterator, Mapping
from gzip import _ReadableFileobj as _GzipReadableFileobj, _WritableFileobj as _GzipWritableFileobj from gzip import _ReadableFileobj as _GzipReadableFileobj, _WritableFileobj as _GzipWritableFileobj
@ -226,15 +226,29 @@ def open(
errorlevel: int | None = ..., errorlevel: int | None = ...,
preset: Literal[0, 1, 2, 3, 4, 5, 6, 7, 8, 9] | None = ..., preset: Literal[0, 1, 2, 3, 4, 5, 6, 7, 8, 9] | None = ...,
) -> TarFile: ... ) -> TarFile: ...
# TODO: Temporary fallback for modes containing pipe characters. These don't
# work with mypy 1.10, but this should be fixed with mypy 1.11.
# https://github.com/python/typeshed/issues/12182
@overload @overload
def open( def open(
name: StrOrBytesPath | None = None, name: StrOrBytesPath | ReadableBuffer | None = None,
*, *,
mode: str, mode: Literal["r|*", "r|", "r|gz", "r|bz2", "r|xz"],
fileobj: IO[bytes] | None = None,
bufsize: int = 10240,
format: int | None = ...,
tarinfo: type[TarInfo] | None = ...,
dereference: bool | None = ...,
ignore_zeros: bool | None = ...,
encoding: str | None = ...,
errors: str = ...,
pax_headers: Mapping[str, str] | None = ...,
debug: int | None = ...,
errorlevel: int | None = ...,
preset: int | None = ...,
) -> TarFile: ...
@overload
def open(
name: StrOrBytesPath | WriteableBuffer | None = None,
*,
mode: Literal["w|", "w|gz", "w|bz2", "w|xz"],
fileobj: IO[bytes] | None = None, fileobj: IO[bytes] | None = None,
bufsize: int = 10240, bufsize: int = 10240,
format: int | None = ..., format: int | None = ...,
@ -557,7 +571,7 @@ class TarInfo:
self, self,
*, *,
name: str = ..., name: str = ...,
mtime: int = ..., mtime: float = ...,
mode: int = ..., mode: int = ...,
linkname: str = ..., linkname: str = ...,
uid: int = ..., uid: int = ...,

View file

@ -403,6 +403,9 @@ class Misc:
# after_idle is essentially partialmethod(after, "idle") # after_idle is essentially partialmethod(after, "idle")
def after_idle(self, func: Callable[[Unpack[_Ts]], object], *args: Unpack[_Ts]) -> str: ... def after_idle(self, func: Callable[[Unpack[_Ts]], object], *args: Unpack[_Ts]) -> str: ...
def after_cancel(self, id: str) -> None: ... def after_cancel(self, id: str) -> None: ...
if sys.version_info >= (3, 13):
def after_info(self, id: str | None = None) -> tuple[str, ...]: ...
def bell(self, displayof: Literal[0] | Misc | None = 0) -> None: ... def bell(self, displayof: Literal[0] | Misc | None = 0) -> None: ...
def clipboard_get(self, *, displayof: Misc = ..., type: str = ...) -> str: ... def clipboard_get(self, *, displayof: Misc = ..., type: str = ...) -> str: ...
def clipboard_clear(self, *, displayof: Misc = ...) -> None: ... def clipboard_clear(self, *, displayof: Misc = ...) -> None: ...
@ -659,6 +662,38 @@ class YView:
@overload @overload
def yview_scroll(self, number: _ScreenUnits, what: Literal["pixels"]) -> None: ... def yview_scroll(self, number: _ScreenUnits, what: Literal["pixels"]) -> None: ...
if sys.platform == "darwin":
@type_check_only
class _WmAttributes(TypedDict):
alpha: float
fullscreen: bool
modified: bool
notify: bool
titlepath: str
topmost: bool
transparent: bool
type: str # Present, but not actually used on darwin
elif sys.platform == "win32":
@type_check_only
class _WmAttributes(TypedDict):
alpha: float
transparentcolor: str
disabled: bool
fullscreen: bool
toolwindow: bool
topmost: bool
else:
# X11
@type_check_only
class _WmAttributes(TypedDict):
alpha: float
topmost: bool
zoomed: bool
fullscreen: bool
type: str
class Wm: class Wm:
@overload @overload
def wm_aspect(self, minNumer: int, minDenom: int, maxNumer: int, maxDenom: int) -> None: ... def wm_aspect(self, minNumer: int, minDenom: int, maxNumer: int, maxDenom: int) -> None: ...
@ -667,12 +702,144 @@ class Wm:
self, minNumer: None = None, minDenom: None = None, maxNumer: None = None, maxDenom: None = None self, minNumer: None = None, minDenom: None = None, maxNumer: None = None, maxDenom: None = None
) -> tuple[int, int, int, int] | None: ... ) -> tuple[int, int, int, int] | None: ...
aspect = wm_aspect aspect = wm_aspect
if sys.version_info >= (3, 13):
@overload
def wm_attributes(self, *, return_python_dict: Literal[False] = False) -> tuple[Any, ...]: ...
@overload
def wm_attributes(self, *, return_python_dict: Literal[True]) -> _WmAttributes: ...
else:
@overload @overload
def wm_attributes(self) -> tuple[Any, ...]: ... def wm_attributes(self) -> tuple[Any, ...]: ...
@overload
def wm_attributes(self, option: Literal["-alpha"], /) -> float: ...
@overload
def wm_attributes(self, option: Literal["-fullscreen"], /) -> bool: ...
@overload
def wm_attributes(self, option: Literal["-topmost"], /) -> bool: ...
if sys.platform == "darwin":
@overload
def wm_attributes(self, option: Literal["-modified"], /) -> bool: ...
@overload
def wm_attributes(self, option: Literal["-notify"], /) -> bool: ...
@overload
def wm_attributes(self, option: Literal["-titlepath"], /) -> str: ...
@overload
def wm_attributes(self, option: Literal["-transparent"], /) -> bool: ...
@overload
def wm_attributes(self, option: Literal["-type"], /) -> str: ...
elif sys.platform == "win32":
@overload
def wm_attributes(self, option: Literal["-transparentcolor"], /) -> str: ...
@overload
def wm_attributes(self, option: Literal["-disabled"], /) -> bool: ...
@overload
def wm_attributes(self, option: Literal["-toolwindow"], /) -> bool: ...
else:
# X11
@overload
def wm_attributes(self, option: Literal["-zoomed"], /) -> bool: ...
@overload
def wm_attributes(self, option: Literal["-type"], /) -> str: ...
if sys.version_info >= (3, 13):
@overload
def wm_attributes(self, option: Literal["alpha"], /) -> float: ...
@overload
def wm_attributes(self, option: Literal["fullscreen"], /) -> bool: ...
@overload
def wm_attributes(self, option: Literal["topmost"], /) -> bool: ...
if sys.platform == "darwin":
@overload
def wm_attributes(self, option: Literal["modified"], /) -> bool: ...
@overload
def wm_attributes(self, option: Literal["notify"], /) -> bool: ...
@overload
def wm_attributes(self, option: Literal["titlepath"], /) -> str: ...
@overload
def wm_attributes(self, option: Literal["transparent"], /) -> bool: ...
@overload
def wm_attributes(self, option: Literal["type"], /) -> str: ...
elif sys.platform == "win32":
@overload
def wm_attributes(self, option: Literal["transparentcolor"], /) -> str: ...
@overload
def wm_attributes(self, option: Literal["disabled"], /) -> bool: ...
@overload
def wm_attributes(self, option: Literal["toolwindow"], /) -> bool: ...
else:
# X11
@overload
def wm_attributes(self, option: Literal["zoomed"], /) -> bool: ...
@overload
def wm_attributes(self, option: Literal["type"], /) -> str: ...
@overload @overload
def wm_attributes(self, option: str, /): ... def wm_attributes(self, option: str, /): ...
@overload @overload
def wm_attributes(self, option: str, value, /, *__other_option_value_pairs: Any) -> None: ... def wm_attributes(self, option: Literal["-alpha"], value: float, /) -> Literal[""]: ...
@overload
def wm_attributes(self, option: Literal["-fullscreen"], value: bool, /) -> Literal[""]: ...
@overload
def wm_attributes(self, option: Literal["-topmost"], value: bool, /) -> Literal[""]: ...
if sys.platform == "darwin":
@overload
def wm_attributes(self, option: Literal["-modified"], value: bool, /) -> Literal[""]: ...
@overload
def wm_attributes(self, option: Literal["-notify"], value: bool, /) -> Literal[""]: ...
@overload
def wm_attributes(self, option: Literal["-titlepath"], value: str, /) -> Literal[""]: ...
@overload
def wm_attributes(self, option: Literal["-transparent"], value: bool, /) -> Literal[""]: ...
elif sys.platform == "win32":
@overload
def wm_attributes(self, option: Literal["-transparentcolor"], value: str, /) -> Literal[""]: ...
@overload
def wm_attributes(self, option: Literal["-disabled"], value: bool, /) -> Literal[""]: ...
@overload
def wm_attributes(self, option: Literal["-toolwindow"], value: bool, /) -> Literal[""]: ...
else:
# X11
@overload
def wm_attributes(self, option: Literal["-zoomed"], value: bool, /) -> Literal[""]: ...
@overload
def wm_attributes(self, option: Literal["-type"], value: str, /) -> Literal[""]: ...
@overload
def wm_attributes(self, option: str, value, /, *__other_option_value_pairs: Any) -> Literal[""]: ...
if sys.version_info >= (3, 13):
if sys.platform == "darwin":
@overload
def wm_attributes(
self,
*,
alpha: float = ...,
fullscreen: bool = ...,
modified: bool = ...,
notify: bool = ...,
titlepath: str = ...,
topmost: bool = ...,
transparent: bool = ...,
) -> None: ...
elif sys.platform == "win32":
@overload
def wm_attributes(
self,
*,
alpha: float = ...,
transparentcolor: str = ...,
disabled: bool = ...,
fullscreen: bool = ...,
toolwindow: bool = ...,
topmost: bool = ...,
) -> None: ...
else:
# X11
@overload
def wm_attributes(
self, *, alpha: float = ..., topmost: bool = ..., zoomed: bool = ..., fullscreen: bool = ..., type: str = ...
) -> None: ...
attributes = wm_attributes attributes = wm_attributes
def wm_client(self, name: str | None = None) -> str: ... def wm_client(self, name: str | None = None) -> str: ...
client = wm_client client = wm_client

View file

@ -76,7 +76,7 @@ if sys.version_info >= (3, 10):
__all__ += ["SOFT_KEYWORD"] __all__ += ["SOFT_KEYWORD"]
if sys.version_info >= (3, 12): if sys.version_info >= (3, 12):
__all__ += ["EXCLAMATION", "FSTRING_END", "FSTRING_MIDDLE", "FSTRING_START"] __all__ += ["EXCLAMATION", "FSTRING_END", "FSTRING_MIDDLE", "FSTRING_START", "EXACT_TOKEN_TYPES"]
ENDMARKER: int ENDMARKER: int
NAME: int NAME: int

View file

@ -88,7 +88,7 @@ if sys.version_info >= (3, 10):
__all__ += ["SOFT_KEYWORD"] __all__ += ["SOFT_KEYWORD"]
if sys.version_info >= (3, 12): if sys.version_info >= (3, 12):
__all__ += ["EXCLAMATION", "FSTRING_END", "FSTRING_MIDDLE", "FSTRING_START"] __all__ += ["EXCLAMATION", "FSTRING_END", "FSTRING_MIDDLE", "FSTRING_START", "EXACT_TOKEN_TYPES"]
if sys.version_info >= (3, 13): if sys.version_info >= (3, 13):
__all__ += ["TokenError", "open"] __all__ += ["TokenError", "open"]

View file

@ -115,6 +115,8 @@ if sys.version_info >= (3, 11):
class TracebackException: class TracebackException:
__cause__: TracebackException __cause__: TracebackException
__context__: TracebackException __context__: TracebackException
if sys.version_info >= (3, 11):
exceptions: list[TracebackException] | None
__suppress_context__: bool __suppress_context__: bool
stack: StackSummary stack: StackSummary
filename: str filename: str

View file

@ -757,7 +757,7 @@ class MutableMapping(Mapping[_KT, _VT]):
Text = str Text = str
TYPE_CHECKING: bool TYPE_CHECKING: Final[bool]
# In stubs, the arguments of the IO class are marked as positional-only. # In stubs, the arguments of the IO class are marked as positional-only.
# This differs from runtime, but better reflects the fact that in reality # This differs from runtime, but better reflects the fact that in reality

View file

@ -172,11 +172,11 @@ class WeakKeyDictionary(MutableMapping[_KT, _VT]):
@overload @overload
def __ior__(self, other: Iterable[tuple[_KT, _VT]]) -> Self: ... def __ior__(self, other: Iterable[tuple[_KT, _VT]]) -> Self: ...
class finalize: # TODO: This is a good candidate for to be a `Generic[_P, _T]` class class finalize(Generic[_P, _T]):
def __init__(self, obj: object, func: Callable[_P, Any], /, *args: _P.args, **kwargs: _P.kwargs) -> None: ... def __init__(self, obj: _T, func: Callable[_P, Any], /, *args: _P.args, **kwargs: _P.kwargs) -> None: ...
def __call__(self, _: Any = None) -> Any | None: ... def __call__(self, _: Any = None) -> Any | None: ...
def detach(self) -> tuple[Any, Any, tuple[Any, ...], dict[str, Any]] | None: ... def detach(self) -> tuple[_T, Callable[_P, Any], tuple[Any, ...], dict[str, Any]] | None: ...
def peek(self) -> tuple[Any, Any, tuple[Any, ...], dict[str, Any]] | None: ... def peek(self) -> tuple[_T, Callable[_P, Any], tuple[Any, ...], dict[str, Any]] | None: ...
@property @property
def alive(self) -> bool: ... def alive(self) -> bool: ...
atexit: bool atexit: bool

View file

@ -0,0 +1,53 @@
import sys
from _typeshed import Unused
from xml.sax import xmlreader
version: str
AttributesImpl = xmlreader.AttributesImpl
AttributesNSImpl = xmlreader.AttributesNSImpl
class _ClosedParser: ...
class ExpatLocator(xmlreader.Locator):
def __init__(self, parser: ExpatParser) -> None: ...
def getColumnNumber(self) -> int: ...
def getLineNumber(self) -> int: ...
def getPublicId(self): ...
def getSystemId(self): ...
class ExpatParser(xmlreader.IncrementalParser, xmlreader.Locator):
def __init__(self, namespaceHandling: int = 0, bufsize: int = 65516) -> None: ...
def parse(self, source) -> None: ...
def prepareParser(self, source) -> None: ...
def setContentHandler(self, handler) -> None: ...
def getFeature(self, name: str): ...
def setFeature(self, name: str, state) -> None: ...
def getProperty(self, name: str): ...
def setProperty(self, name: str, value) -> None: ...
if sys.version_info >= (3, 9):
def feed(self, data, isFinal: bool = False) -> None: ...
else:
def feed(self, data, isFinal: int = 0) -> None: ...
def flush(self) -> None: ...
def close(self) -> None: ...
def reset(self) -> None: ...
def getColumnNumber(self) -> int | None: ...
def getLineNumber(self) -> int: ...
def getPublicId(self): ...
def getSystemId(self): ...
def start_element(self, name: str, attrs: xmlreader.AttributesImpl) -> None: ...
def end_element(self, name: str) -> None: ...
def start_element_ns(self, name: str, attrs) -> None: ...
def end_element_ns(self, name: str) -> None: ...
def processing_instruction(self, target: str, data: str) -> None: ...
def character_data(self, data: str) -> None: ...
def start_namespace_decl(self, prefix: str | None, uri: str) -> None: ...
def end_namespace_decl(self, prefix: str | None) -> None: ...
def start_doctype_decl(self, name: str, sysid: str | None, pubid: str | None, has_internal_subset: Unused) -> None: ...
def unparsed_entity_decl(self, name, base, sysid, pubid, notation_name) -> None: ...
def notation_decl(self, name, base, sysid, pubid) -> None: ...
def external_entity_ref(self, context, base, sysid, pubid): ...
def skipped_entity_handler(self, name: str, is_pe: bool) -> None: ...
def create_parser(namespaceHandling: int = 0, bufsize: int = 65516) -> ExpatParser: ...

View file

@ -0,0 +1,22 @@
import sys
from collections.abc import Iterator
from re import Match
if sys.version_info >= (3, 13):
class Translator:
def __init__(self, seps: str = ...) -> None: ...
def translate(self, pattern: str) -> str: ...
def extend(self, pattern: str) -> str: ...
def match_dirs(self, pattern: str) -> str: ...
def translate_core(self, pattern: str) -> str: ...
def replace(self, match: Match[str]) -> str: ...
def restrict_rglob(self, pattern: str) -> None: ...
def star_not_empty(self, pattern: str) -> str: ...
else:
def translate(pattern: str) -> str: ...
def match_dirs(pattern: str) -> str: ...
def translate_core(pattern: str) -> str: ...
def replace(match: Match[str]) -> str: ...
def separate(pattern: str) -> Iterator[Match[str]]: ...