mirror of
https://github.com/astral-sh/ruff.git
synced 2025-10-02 06:41:23 +00:00
Sync vendored typeshed stubs (#18407)
Co-authored-by: typeshedbot <> Co-authored-by: Alex Waygood <alex.waygood@gmail.com>
This commit is contained in:
parent
54f597658c
commit
7a63ac145a
66 changed files with 928 additions and 368 deletions
|
@ -421,16 +421,16 @@ mod tests {
|
|||
"#,
|
||||
);
|
||||
|
||||
assert_snapshot!(test.goto_type_definition(), @r###"
|
||||
assert_snapshot!(test.goto_type_definition(), @r#"
|
||||
info[goto-type-definition]: Type definition
|
||||
--> stdlib/builtins.pyi:445:7
|
||||
--> stdlib/builtins.pyi:461:7
|
||||
|
|
||||
443 | def __getitem__(self, key: int, /) -> str | int | None: ...
|
||||
444 |
|
||||
445 | class str(Sequence[str]):
|
||||
459 | def __getitem__(self, key: int, /) -> str | int | None: ...
|
||||
460 |
|
||||
461 | class str(Sequence[str]):
|
||||
| ^^^
|
||||
446 | @overload
|
||||
447 | def __new__(cls, object: object = ...) -> Self: ...
|
||||
462 | @overload
|
||||
463 | def __new__(cls, object: object = ...) -> Self: ...
|
||||
|
|
||||
info: Source
|
||||
--> main.py:4:13
|
||||
|
@ -440,7 +440,7 @@ mod tests {
|
|||
4 | a
|
||||
| ^
|
||||
|
|
||||
"###);
|
||||
"#);
|
||||
}
|
||||
#[test]
|
||||
fn goto_type_of_expression_with_literal_node() {
|
||||
|
@ -450,16 +450,16 @@ mod tests {
|
|||
"#,
|
||||
);
|
||||
|
||||
assert_snapshot!(test.goto_type_definition(), @r###"
|
||||
assert_snapshot!(test.goto_type_definition(), @r#"
|
||||
info[goto-type-definition]: Type definition
|
||||
--> stdlib/builtins.pyi:445:7
|
||||
--> stdlib/builtins.pyi:461:7
|
||||
|
|
||||
443 | def __getitem__(self, key: int, /) -> str | int | None: ...
|
||||
444 |
|
||||
445 | class str(Sequence[str]):
|
||||
459 | def __getitem__(self, key: int, /) -> str | int | None: ...
|
||||
460 |
|
||||
461 | class str(Sequence[str]):
|
||||
| ^^^
|
||||
446 | @overload
|
||||
447 | def __new__(cls, object: object = ...) -> Self: ...
|
||||
462 | @overload
|
||||
463 | def __new__(cls, object: object = ...) -> Self: ...
|
||||
|
|
||||
info: Source
|
||||
--> main.py:2:22
|
||||
|
@ -467,7 +467,7 @@ mod tests {
|
|||
2 | a: str = "test"
|
||||
| ^^^^^^
|
||||
|
|
||||
"###);
|
||||
"#);
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
@ -566,16 +566,16 @@ mod tests {
|
|||
"#,
|
||||
);
|
||||
|
||||
assert_snapshot!(test.goto_type_definition(), @r###"
|
||||
assert_snapshot!(test.goto_type_definition(), @r#"
|
||||
info[goto-type-definition]: Type definition
|
||||
--> stdlib/builtins.pyi:445:7
|
||||
--> stdlib/builtins.pyi:461:7
|
||||
|
|
||||
443 | def __getitem__(self, key: int, /) -> str | int | None: ...
|
||||
444 |
|
||||
445 | class str(Sequence[str]):
|
||||
459 | def __getitem__(self, key: int, /) -> str | int | None: ...
|
||||
460 |
|
||||
461 | class str(Sequence[str]):
|
||||
| ^^^
|
||||
446 | @overload
|
||||
447 | def __new__(cls, object: object = ...) -> Self: ...
|
||||
462 | @overload
|
||||
463 | def __new__(cls, object: object = ...) -> Self: ...
|
||||
|
|
||||
info: Source
|
||||
--> main.py:4:18
|
||||
|
@ -585,7 +585,7 @@ mod tests {
|
|||
4 | test(a= "123")
|
||||
| ^
|
||||
|
|
||||
"###);
|
||||
"#);
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
@ -601,16 +601,16 @@ mod tests {
|
|||
// TODO: This should jump to `str` and not `int` because
|
||||
// the keyword is typed as a string. It's only the passed argument that
|
||||
// is an int. Navigating to `str` would match pyright's behavior.
|
||||
assert_snapshot!(test.goto_type_definition(), @r###"
|
||||
assert_snapshot!(test.goto_type_definition(), @r"
|
||||
info[goto-type-definition]: Type definition
|
||||
--> stdlib/builtins.pyi:238:7
|
||||
--> stdlib/builtins.pyi:244:7
|
||||
|
|
||||
236 | _LiteralInteger = _PositiveInteger | _NegativeInteger | Literal[0] # noqa: Y026 # TODO: Use TypeAlias once mypy bugs are fixed
|
||||
237 |
|
||||
238 | class int:
|
||||
242 | _LiteralInteger = _PositiveInteger | _NegativeInteger | Literal[0] # noqa: Y026 # TODO: Use TypeAlias once mypy bugs are fixed
|
||||
243 |
|
||||
244 | class int:
|
||||
| ^^^
|
||||
239 | @overload
|
||||
240 | def __new__(cls, x: ConvertibleToInt = ..., /) -> Self: ...
|
||||
245 | @overload
|
||||
246 | def __new__(cls, x: ConvertibleToInt = ..., /) -> Self: ...
|
||||
|
|
||||
info: Source
|
||||
--> main.py:4:18
|
||||
|
@ -620,7 +620,7 @@ mod tests {
|
|||
4 | test(a= 123)
|
||||
| ^
|
||||
|
|
||||
"###);
|
||||
");
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
@ -635,16 +635,16 @@ f(**kwargs<CURSOR>)
|
|||
"#,
|
||||
);
|
||||
|
||||
assert_snapshot!(test.goto_type_definition(), @r###"
|
||||
assert_snapshot!(test.goto_type_definition(), @r#"
|
||||
info[goto-type-definition]: Type definition
|
||||
--> stdlib/builtins.pyi:1096:7
|
||||
--> stdlib/builtins.pyi:1136:7
|
||||
|
|
||||
1094 | def __class_getitem__(cls, item: Any, /) -> GenericAlias: ...
|
||||
1095 |
|
||||
1096 | class dict(MutableMapping[_KT, _VT]):
|
||||
1134 | def __class_getitem__(cls, item: Any, /) -> GenericAlias: ...
|
||||
1135 |
|
||||
1136 | class dict(MutableMapping[_KT, _VT]):
|
||||
| ^^^^
|
||||
1097 | # __init__ should be kept roughly in line with `collections.UserDict.__init__`, which has similar semantics
|
||||
1098 | # Also multiprocessing.managers.SyncManager.dict()
|
||||
1137 | # __init__ should be kept roughly in line with `collections.UserDict.__init__`, which has similar semantics
|
||||
1138 | # Also multiprocessing.managers.SyncManager.dict()
|
||||
|
|
||||
info: Source
|
||||
--> main.py:6:5
|
||||
|
@ -654,7 +654,7 @@ f(**kwargs<CURSOR>)
|
|||
6 | f(**kwargs)
|
||||
| ^^^^^^
|
||||
|
|
||||
"###);
|
||||
"#);
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
@ -666,16 +666,16 @@ f(**kwargs<CURSOR>)
|
|||
"#,
|
||||
);
|
||||
|
||||
assert_snapshot!(test.goto_type_definition(), @r###"
|
||||
assert_snapshot!(test.goto_type_definition(), @r"
|
||||
info[goto-type-definition]: Type definition
|
||||
--> stdlib/builtins.pyi:445:7
|
||||
--> stdlib/builtins.pyi:461:7
|
||||
|
|
||||
443 | def __getitem__(self, key: int, /) -> str | int | None: ...
|
||||
444 |
|
||||
445 | class str(Sequence[str]):
|
||||
459 | def __getitem__(self, key: int, /) -> str | int | None: ...
|
||||
460 |
|
||||
461 | class str(Sequence[str]):
|
||||
| ^^^
|
||||
446 | @overload
|
||||
447 | def __new__(cls, object: object = ...) -> Self: ...
|
||||
462 | @overload
|
||||
463 | def __new__(cls, object: object = ...) -> Self: ...
|
||||
|
|
||||
info: Source
|
||||
--> main.py:3:17
|
||||
|
@ -684,7 +684,7 @@ f(**kwargs<CURSOR>)
|
|||
3 | a
|
||||
| ^
|
||||
|
|
||||
"###);
|
||||
");
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
@ -759,16 +759,16 @@ f(**kwargs<CURSOR>)
|
|||
"#,
|
||||
);
|
||||
|
||||
assert_snapshot!(test.goto_type_definition(), @r###"
|
||||
assert_snapshot!(test.goto_type_definition(), @r"
|
||||
info[goto-type-definition]: Type definition
|
||||
--> stdlib/builtins.pyi:445:7
|
||||
--> stdlib/builtins.pyi:461:7
|
||||
|
|
||||
443 | def __getitem__(self, key: int, /) -> str | int | None: ...
|
||||
444 |
|
||||
445 | class str(Sequence[str]):
|
||||
459 | def __getitem__(self, key: int, /) -> str | int | None: ...
|
||||
460 |
|
||||
461 | class str(Sequence[str]):
|
||||
| ^^^
|
||||
446 | @overload
|
||||
447 | def __new__(cls, object: object = ...) -> Self: ...
|
||||
462 | @overload
|
||||
463 | def __new__(cls, object: object = ...) -> Self: ...
|
||||
|
|
||||
info: Source
|
||||
--> main.py:4:27
|
||||
|
@ -778,7 +778,7 @@ f(**kwargs<CURSOR>)
|
|||
4 | print(a)
|
||||
| ^
|
||||
|
|
||||
"###);
|
||||
");
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
@ -790,15 +790,15 @@ f(**kwargs<CURSOR>)
|
|||
"#,
|
||||
);
|
||||
|
||||
assert_snapshot!(test.goto_type_definition(), @r###"
|
||||
assert_snapshot!(test.goto_type_definition(), @r"
|
||||
info[goto-type-definition]: Type definition
|
||||
--> stdlib/types.pyi:680:11
|
||||
--> stdlib/types.pyi:689:11
|
||||
|
|
||||
678 | if sys.version_info >= (3, 10):
|
||||
679 | @final
|
||||
680 | class NoneType:
|
||||
687 | if sys.version_info >= (3, 10):
|
||||
688 | @final
|
||||
689 | class NoneType:
|
||||
| ^^^^^^^^
|
||||
681 | def __bool__(self) -> Literal[False]: ...
|
||||
690 | def __bool__(self) -> Literal[False]: ...
|
||||
|
|
||||
info: Source
|
||||
--> main.py:3:17
|
||||
|
@ -809,14 +809,14 @@ f(**kwargs<CURSOR>)
|
|||
|
|
||||
|
||||
info[goto-type-definition]: Type definition
|
||||
--> stdlib/builtins.pyi:445:7
|
||||
--> stdlib/builtins.pyi:461:7
|
||||
|
|
||||
443 | def __getitem__(self, key: int, /) -> str | int | None: ...
|
||||
444 |
|
||||
445 | class str(Sequence[str]):
|
||||
459 | def __getitem__(self, key: int, /) -> str | int | None: ...
|
||||
460 |
|
||||
461 | class str(Sequence[str]):
|
||||
| ^^^
|
||||
446 | @overload
|
||||
447 | def __new__(cls, object: object = ...) -> Self: ...
|
||||
462 | @overload
|
||||
463 | def __new__(cls, object: object = ...) -> Self: ...
|
||||
|
|
||||
info: Source
|
||||
--> main.py:3:17
|
||||
|
@ -825,7 +825,7 @@ f(**kwargs<CURSOR>)
|
|||
3 | a
|
||||
| ^
|
||||
|
|
||||
"###);
|
||||
");
|
||||
}
|
||||
|
||||
impl CursorTest {
|
||||
|
|
|
@ -1 +1 @@
|
|||
1063db7c15135c172f1f6a81d3aff6d1cb00a980
|
||||
5a3c495d2f6fa9b68cd99f39feba4426e4d17ea9
|
||||
|
|
|
@ -103,3 +103,8 @@ def _leave_task(loop: AbstractEventLoop, task: Task[Any]) -> None: ...
|
|||
|
||||
if sys.version_info >= (3, 12):
|
||||
def current_task(loop: AbstractEventLoop | None = None) -> Task[Any] | None: ...
|
||||
|
||||
if sys.version_info >= (3, 14):
|
||||
def future_discard_from_awaited_by(future: Future[Any], waiter: Future[Any], /) -> None: ...
|
||||
def future_add_to_awaited_by(future: Future[Any], waiter: Future[Any], /) -> None: ...
|
||||
def all_tasks(loop: AbstractEventLoop | None = None) -> set[Task[Any]]: ...
|
||||
|
|
|
@ -75,6 +75,8 @@ class _CData:
|
|||
_objects: Mapping[Any, int] | None
|
||||
def __buffer__(self, flags: int, /) -> memoryview: ...
|
||||
def __ctypes_from_outparam__(self, /) -> Self: ...
|
||||
if sys.version_info >= (3, 14):
|
||||
__pointer_type__: type
|
||||
|
||||
# this is a union of all the subclasses of _CData, which is useful because of
|
||||
# the methods that are present on each of those subclasses which are not present
|
||||
|
|
|
@ -304,6 +304,9 @@ def has_colors() -> bool: ...
|
|||
if sys.version_info >= (3, 10):
|
||||
def has_extended_color_support() -> bool: ...
|
||||
|
||||
if sys.version_info >= (3, 14):
|
||||
def assume_default_colors(fg: int, bg: int, /) -> None: ...
|
||||
|
||||
def has_ic() -> bool: ...
|
||||
def has_il() -> bool: ...
|
||||
def has_key(key: int, /) -> bool: ...
|
||||
|
|
|
@ -1,11 +1,19 @@
|
|||
import sys
|
||||
from typing import Any, Final, TypeVar
|
||||
|
||||
_T = TypeVar("_T")
|
||||
_T = TypeVar("_T") # list items must be comparable
|
||||
|
||||
__about__: Final[str]
|
||||
|
||||
def heapify(heap: list[Any], /) -> None: ...
|
||||
def heapify(heap: list[Any], /) -> None: ... # list items must be comparable
|
||||
def heappop(heap: list[_T], /) -> _T: ...
|
||||
def heappush(heap: list[_T], item: _T, /) -> None: ...
|
||||
def heappushpop(heap: list[_T], item: _T, /) -> _T: ...
|
||||
def heapreplace(heap: list[_T], item: _T, /) -> _T: ...
|
||||
|
||||
if sys.version_info >= (3, 14):
|
||||
def heapify_max(heap: list[Any], /) -> None: ... # list items must be comparable
|
||||
def heappop_max(heap: list[_T], /) -> _T: ...
|
||||
def heappush_max(heap: list[_T], item: _T, /) -> None: ...
|
||||
def heappushpop_max(heap: list[_T], item: _T, /) -> _T: ...
|
||||
def heapreplace_max(heap: list[_T], item: _T, /) -> _T: ...
|
||||
|
|
|
@ -5,6 +5,8 @@ from importlib.machinery import ModuleSpec
|
|||
from typing import Any
|
||||
|
||||
check_hash_based_pycs: str
|
||||
if sys.version_info >= (3, 14):
|
||||
pyc_magic_number_token: int
|
||||
|
||||
def source_hash(key: int, source: ReadableBuffer) -> bytes: ...
|
||||
def create_builtin(spec: ModuleSpec, /) -> types.ModuleType: ...
|
||||
|
|
|
@ -4,6 +4,7 @@ from collections.abc import Callable, Sequence
|
|||
from typing import SupportsIndex
|
||||
|
||||
if sys.platform != "win32":
|
||||
if sys.version_info >= (3, 14):
|
||||
def fork_exec(
|
||||
args: Sequence[StrOrBytesPath] | None,
|
||||
executable_list: Sequence[bytes],
|
||||
|
@ -27,6 +28,32 @@ if sys.platform != "win32":
|
|||
uid: SupportsIndex | None,
|
||||
child_umask: int,
|
||||
preexec_fn: Callable[[], None],
|
||||
/,
|
||||
) -> int: ...
|
||||
else:
|
||||
def fork_exec(
|
||||
args: Sequence[StrOrBytesPath] | None,
|
||||
executable_list: Sequence[bytes],
|
||||
close_fds: bool,
|
||||
pass_fds: tuple[int, ...],
|
||||
cwd: str,
|
||||
env: Sequence[bytes] | None,
|
||||
p2cread: int,
|
||||
p2cwrite: int,
|
||||
c2pread: int,
|
||||
c2pwrite: int,
|
||||
errread: int,
|
||||
errwrite: int,
|
||||
errpipe_read: int,
|
||||
errpipe_write: int,
|
||||
restore_signals: bool,
|
||||
call_setsid: bool,
|
||||
pgid_to_set: int,
|
||||
gid: SupportsIndex | None,
|
||||
extra_groups: list[int] | None,
|
||||
uid: SupportsIndex | None,
|
||||
child_umask: int,
|
||||
preexec_fn: Callable[[], None],
|
||||
allow_vfork: bool,
|
||||
/,
|
||||
) -> int: ...
|
||||
|
|
|
@ -18,6 +18,8 @@ class RLock:
|
|||
def release(self) -> None: ...
|
||||
__enter__ = acquire
|
||||
def __exit__(self, t: type[BaseException] | None, v: BaseException | None, tb: TracebackType | None) -> None: ...
|
||||
if sys.version_info >= (3, 14):
|
||||
def locked(self) -> bool: ...
|
||||
|
||||
if sys.version_info >= (3, 13):
|
||||
@final
|
||||
|
@ -105,6 +107,9 @@ _excepthook: Callable[[_ExceptHookArgs], Any]
|
|||
if sys.version_info >= (3, 12):
|
||||
def daemon_threads_allowed() -> bool: ...
|
||||
|
||||
if sys.version_info >= (3, 14):
|
||||
def set_name(name: str) -> None: ...
|
||||
|
||||
class _local:
|
||||
def __getattribute__(self, name: str, /) -> Any: ...
|
||||
def __setattr__(self, name: str, value: Any, /) -> None: ...
|
||||
|
|
|
@ -77,7 +77,7 @@ class TkappType:
|
|||
def globalgetvar(self, *args, **kwargs): ...
|
||||
def globalsetvar(self, *args, **kwargs): ...
|
||||
def globalunsetvar(self, *args, **kwargs): ...
|
||||
def interpaddr(self): ...
|
||||
def interpaddr(self) -> int: ...
|
||||
def loadtk(self) -> None: ...
|
||||
def mainloop(self, threshold: int = 0, /): ...
|
||||
def quit(self): ...
|
||||
|
|
|
@ -298,9 +298,6 @@ class SupportsGetItemBuffer(SliceableBuffer, IndexableBuffer, Protocol):
|
|||
|
||||
class SizedBuffer(Sized, Buffer, Protocol): ...
|
||||
|
||||
# for compatibility with third-party stubs that may use this
|
||||
_BufferWithLen: TypeAlias = SizedBuffer # not stable # noqa: Y047
|
||||
|
||||
ExcInfo: TypeAlias = tuple[type[BaseException], BaseException, TracebackType]
|
||||
OptExcInfo: TypeAlias = ExcInfo | tuple[None, None, None]
|
||||
|
||||
|
|
|
@ -281,13 +281,7 @@ class HelpFormatter:
|
|||
|
||||
if sys.version_info >= (3, 14):
|
||||
def __init__(
|
||||
self,
|
||||
prog: str,
|
||||
indent_increment: int = 2,
|
||||
max_help_position: int = 24,
|
||||
width: int | None = None,
|
||||
prefix_chars: str = "-",
|
||||
color: bool = False,
|
||||
self, prog: str, indent_increment: int = 2, max_help_position: int = 24, width: int | None = None, color: bool = False
|
||||
) -> None: ...
|
||||
else:
|
||||
def __init__(
|
||||
|
|
|
@ -1095,20 +1095,28 @@ if sys.version_info >= (3, 14):
|
|||
**kwargs: Unpack[_Attributes],
|
||||
) -> Self: ...
|
||||
|
||||
if sys.version_info >= (3, 10):
|
||||
from types import EllipsisType
|
||||
|
||||
_ConstantValue: typing_extensions.TypeAlias = str | bytes | bool | int | float | complex | None | EllipsisType
|
||||
else:
|
||||
# Rely on builtins.ellipsis
|
||||
_ConstantValue: typing_extensions.TypeAlias = str | bytes | bool | int | float | complex | None | ellipsis # noqa: F821
|
||||
|
||||
class Constant(expr):
|
||||
if sys.version_info >= (3, 10):
|
||||
__match_args__ = ("value", "kind")
|
||||
value: Any # None, str, bytes, bool, int, float, complex, Ellipsis
|
||||
value: _ConstantValue
|
||||
kind: str | None
|
||||
if sys.version_info < (3, 14):
|
||||
# Aliases for value, for backwards compatibility
|
||||
s: Any
|
||||
n: int | float | complex
|
||||
s: _ConstantValue
|
||||
n: _ConstantValue
|
||||
|
||||
def __init__(self, value: Any, kind: str | None = None, **kwargs: Unpack[_Attributes]) -> None: ...
|
||||
def __init__(self, value: _ConstantValue, kind: str | None = None, **kwargs: Unpack[_Attributes]) -> None: ...
|
||||
|
||||
if sys.version_info >= (3, 14):
|
||||
def __replace__(self, *, value: Any = ..., kind: str | None = ..., **kwargs: Unpack[_Attributes]) -> Self: ...
|
||||
def __replace__(self, *, value: _ConstantValue = ..., kind: str | None = ..., **kwargs: Unpack[_Attributes]) -> Self: ...
|
||||
|
||||
class Attribute(expr):
|
||||
if sys.version_info >= (3, 10):
|
||||
|
@ -1429,15 +1437,19 @@ class keyword(AST):
|
|||
def __replace__(self, *, arg: str | None = ..., value: expr = ..., **kwargs: Unpack[_Attributes]) -> Self: ...
|
||||
|
||||
class alias(AST):
|
||||
name: str
|
||||
asname: str | None
|
||||
if sys.version_info >= (3, 10):
|
||||
lineno: int
|
||||
col_offset: int
|
||||
end_lineno: int | None
|
||||
end_col_offset: int | None
|
||||
if sys.version_info >= (3, 10):
|
||||
__match_args__ = ("name", "asname")
|
||||
name: str
|
||||
asname: str | None
|
||||
if sys.version_info >= (3, 10):
|
||||
def __init__(self, name: str, asname: str | None = None, **kwargs: Unpack[_Attributes]) -> None: ...
|
||||
else:
|
||||
def __init__(self, name: str, asname: str | None = None) -> None: ...
|
||||
|
||||
if sys.version_info >= (3, 14):
|
||||
def __replace__(self, *, name: str = ..., asname: str | None = ..., **kwargs: Unpack[_Attributes]) -> Self: ...
|
||||
|
|
|
@ -41,12 +41,14 @@ if sys.platform == "win32":
|
|||
"Server", # from base_events
|
||||
"iscoroutinefunction", # from coroutines
|
||||
"iscoroutine", # from coroutines
|
||||
"AbstractEventLoopPolicy", # from events
|
||||
"_AbstractEventLoopPolicy", # from events
|
||||
"AbstractEventLoop", # from events
|
||||
"AbstractServer", # from events
|
||||
"Handle", # from events
|
||||
"TimerHandle", # from events
|
||||
"_get_event_loop_policy", # from events
|
||||
"get_event_loop_policy", # from events
|
||||
"_set_event_loop_policy", # from events
|
||||
"set_event_loop_policy", # from events
|
||||
"get_event_loop", # from events
|
||||
"set_event_loop", # from events
|
||||
|
@ -132,9 +134,9 @@ if sys.platform == "win32":
|
|||
"SelectorEventLoop", # from windows_events
|
||||
"ProactorEventLoop", # from windows_events
|
||||
"IocpProactor", # from windows_events
|
||||
"DefaultEventLoopPolicy", # from windows_events
|
||||
"WindowsSelectorEventLoopPolicy", # from windows_events
|
||||
"WindowsProactorEventLoopPolicy", # from windows_events
|
||||
"_DefaultEventLoopPolicy", # from windows_events
|
||||
"_WindowsSelectorEventLoopPolicy", # from windows_events
|
||||
"_WindowsProactorEventLoopPolicy", # from windows_events
|
||||
"EventLoop", # from windows_events
|
||||
)
|
||||
elif sys.version_info >= (3, 13):
|
||||
|
@ -515,12 +517,14 @@ else:
|
|||
"Server", # from base_events
|
||||
"iscoroutinefunction", # from coroutines
|
||||
"iscoroutine", # from coroutines
|
||||
"AbstractEventLoopPolicy", # from events
|
||||
"_AbstractEventLoopPolicy", # from events
|
||||
"AbstractEventLoop", # from events
|
||||
"AbstractServer", # from events
|
||||
"Handle", # from events
|
||||
"TimerHandle", # from events
|
||||
"_get_event_loop_policy", # from events
|
||||
"get_event_loop_policy", # from events
|
||||
"_set_event_loop_policy", # from events
|
||||
"set_event_loop_policy", # from events
|
||||
"get_event_loop", # from events
|
||||
"set_event_loop", # from events
|
||||
|
@ -606,7 +610,7 @@ else:
|
|||
"DatagramTransport", # from transports
|
||||
"SubprocessTransport", # from transports
|
||||
"SelectorEventLoop", # from unix_events
|
||||
"DefaultEventLoopPolicy", # from unix_events
|
||||
"_DefaultEventLoopPolicy", # from unix_events
|
||||
"EventLoop", # from unix_events
|
||||
)
|
||||
elif sys.version_info >= (3, 13):
|
||||
|
|
|
@ -28,12 +28,14 @@ if sys.version_info < (3, 14):
|
|||
# Keep asyncio.__all__ updated with any changes to __all__ here
|
||||
if sys.version_info >= (3, 14):
|
||||
__all__ = (
|
||||
"AbstractEventLoopPolicy",
|
||||
"_AbstractEventLoopPolicy",
|
||||
"AbstractEventLoop",
|
||||
"AbstractServer",
|
||||
"Handle",
|
||||
"TimerHandle",
|
||||
"_get_event_loop_policy",
|
||||
"get_event_loop_policy",
|
||||
"_set_event_loop_policy",
|
||||
"set_event_loop_policy",
|
||||
"get_event_loop",
|
||||
"set_event_loop",
|
||||
|
@ -600,7 +602,7 @@ class AbstractEventLoop:
|
|||
@abstractmethod
|
||||
async def shutdown_default_executor(self) -> None: ...
|
||||
|
||||
class AbstractEventLoopPolicy:
|
||||
class _AbstractEventLoopPolicy:
|
||||
@abstractmethod
|
||||
def get_event_loop(self) -> AbstractEventLoop: ...
|
||||
@abstractmethod
|
||||
|
@ -622,13 +624,33 @@ class AbstractEventLoopPolicy:
|
|||
@abstractmethod
|
||||
def set_child_watcher(self, watcher: AbstractChildWatcher) -> None: ...
|
||||
|
||||
class BaseDefaultEventLoopPolicy(AbstractEventLoopPolicy, metaclass=ABCMeta):
|
||||
if sys.version_info < (3, 14):
|
||||
AbstractEventLoopPolicy = _AbstractEventLoopPolicy
|
||||
|
||||
if sys.version_info >= (3, 14):
|
||||
class _BaseDefaultEventLoopPolicy(_AbstractEventLoopPolicy, metaclass=ABCMeta):
|
||||
def get_event_loop(self) -> AbstractEventLoop: ...
|
||||
def set_event_loop(self, loop: AbstractEventLoop | None) -> None: ...
|
||||
def new_event_loop(self) -> AbstractEventLoop: ...
|
||||
|
||||
def get_event_loop_policy() -> AbstractEventLoopPolicy: ...
|
||||
def set_event_loop_policy(policy: AbstractEventLoopPolicy | None) -> None: ...
|
||||
else:
|
||||
class BaseDefaultEventLoopPolicy(_AbstractEventLoopPolicy, metaclass=ABCMeta):
|
||||
def get_event_loop(self) -> AbstractEventLoop: ...
|
||||
def set_event_loop(self, loop: AbstractEventLoop | None) -> None: ...
|
||||
def new_event_loop(self) -> AbstractEventLoop: ...
|
||||
|
||||
if sys.version_info >= (3, 14):
|
||||
def _get_event_loop_policy() -> _AbstractEventLoopPolicy: ...
|
||||
def _set_event_loop_policy(policy: _AbstractEventLoopPolicy | None) -> None: ...
|
||||
@deprecated("Deprecated as of Python 3.14; will be removed in Python 3.16")
|
||||
def get_event_loop_policy() -> _AbstractEventLoopPolicy: ...
|
||||
@deprecated("Deprecated as of Python 3.14; will be removed in Python 3.16")
|
||||
def set_event_loop_policy(policy: _AbstractEventLoopPolicy | None) -> None: ...
|
||||
|
||||
else:
|
||||
def get_event_loop_policy() -> _AbstractEventLoopPolicy: ...
|
||||
def set_event_loop_policy(policy: _AbstractEventLoopPolicy | None) -> None: ...
|
||||
|
||||
def set_event_loop(loop: AbstractEventLoop | None) -> None: ...
|
||||
def new_event_loop() -> AbstractEventLoop: ...
|
||||
|
||||
|
|
|
@ -8,6 +8,8 @@ from .events import AbstractEventLoop
|
|||
|
||||
# Keep asyncio.__all__ updated with any changes to __all__ here
|
||||
if sys.version_info >= (3, 14):
|
||||
from _asyncio import future_add_to_awaited_by, future_discard_from_awaited_by
|
||||
|
||||
__all__ = ("Future", "wrap_future", "isfuture", "future_discard_from_awaited_by", "future_add_to_awaited_by")
|
||||
else:
|
||||
__all__ = ("Future", "wrap_future", "isfuture")
|
||||
|
@ -19,7 +21,3 @@ _T = TypeVar("_T")
|
|||
# That's why the import order is reversed.
|
||||
def isfuture(obj: object) -> TypeIs[Future[Any]]: ...
|
||||
def wrap_future(future: _ConcurrentFuture[_T] | Future[_T], *, loop: AbstractEventLoop | None = None) -> Future[_T]: ...
|
||||
|
||||
if sys.version_info >= (3, 14):
|
||||
def future_discard_from_awaited_by(future: Future[Any], waiter: Future[Any], /) -> None: ...
|
||||
def future_add_to_awaited_by(future: Future[Any], waiter: Future[Any], /) -> None: ...
|
||||
|
|
|
@ -7,8 +7,8 @@ from socket import socket
|
|||
from typing import Literal
|
||||
from typing_extensions import Self, TypeVarTuple, Unpack, deprecated
|
||||
|
||||
from . import events
|
||||
from .base_events import Server, _ProtocolFactory, _SSLContext
|
||||
from .events import AbstractEventLoop, BaseDefaultEventLoopPolicy
|
||||
from .selector_events import BaseSelectorEventLoop
|
||||
|
||||
_Ts = TypeVarTuple("_Ts")
|
||||
|
@ -16,7 +16,7 @@ _Ts = TypeVarTuple("_Ts")
|
|||
# Keep asyncio.__all__ updated with any changes to __all__ here
|
||||
if sys.platform != "win32":
|
||||
if sys.version_info >= (3, 14):
|
||||
__all__ = ("SelectorEventLoop", "DefaultEventLoopPolicy", "EventLoop")
|
||||
__all__ = ("SelectorEventLoop", "_DefaultEventLoopPolicy", "EventLoop")
|
||||
elif sys.version_info >= (3, 13):
|
||||
# Adds EventLoop
|
||||
__all__ = (
|
||||
|
@ -57,7 +57,7 @@ if sys.version_info < (3, 14):
|
|||
@abstractmethod
|
||||
def remove_child_handler(self, pid: int) -> bool: ...
|
||||
@abstractmethod
|
||||
def attach_loop(self, loop: AbstractEventLoop | None) -> None: ...
|
||||
def attach_loop(self, loop: events.AbstractEventLoop | None) -> None: ...
|
||||
@abstractmethod
|
||||
def close(self) -> None: ...
|
||||
@abstractmethod
|
||||
|
@ -78,7 +78,7 @@ if sys.version_info < (3, 14):
|
|||
@abstractmethod
|
||||
def remove_child_handler(self, pid: int) -> bool: ...
|
||||
@abstractmethod
|
||||
def attach_loop(self, loop: AbstractEventLoop | None) -> None: ...
|
||||
def attach_loop(self, loop: events.AbstractEventLoop | None) -> None: ...
|
||||
@abstractmethod
|
||||
def close(self) -> None: ...
|
||||
@abstractmethod
|
||||
|
@ -98,7 +98,7 @@ if sys.platform != "win32":
|
|||
class BaseChildWatcher(AbstractChildWatcher, metaclass=ABCMeta):
|
||||
def close(self) -> None: ...
|
||||
def is_active(self) -> bool: ...
|
||||
def attach_loop(self, loop: 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")
|
||||
class SafeChildWatcher(BaseChildWatcher):
|
||||
|
@ -128,7 +128,7 @@ if sys.platform != "win32":
|
|||
class BaseChildWatcher(AbstractChildWatcher, metaclass=ABCMeta):
|
||||
def close(self) -> None: ...
|
||||
def is_active(self) -> bool: ...
|
||||
def attach_loop(self, loop: AbstractEventLoop | None) -> None: ...
|
||||
def attach_loop(self, loop: events.AbstractEventLoop | None) -> None: ...
|
||||
|
||||
class SafeChildWatcher(BaseChildWatcher):
|
||||
def __enter__(self) -> Self: ...
|
||||
|
@ -166,8 +166,10 @@ if sys.platform != "win32":
|
|||
cleanup_socket: bool = True,
|
||||
) -> Server: ...
|
||||
|
||||
class _UnixDefaultEventLoopPolicy(BaseDefaultEventLoopPolicy):
|
||||
if sys.version_info < (3, 14):
|
||||
if sys.version_info >= (3, 14):
|
||||
class _UnixDefaultEventLoopPolicy(events._BaseDefaultEventLoopPolicy): ...
|
||||
else:
|
||||
class _UnixDefaultEventLoopPolicy(events.BaseDefaultEventLoopPolicy):
|
||||
if sys.version_info >= (3, 12):
|
||||
@deprecated("Deprecated as of Python 3.12; will be removed in Python 3.14")
|
||||
def get_child_watcher(self) -> AbstractChildWatcher: ...
|
||||
|
@ -179,6 +181,9 @@ if sys.platform != "win32":
|
|||
|
||||
SelectorEventLoop = _UnixSelectorEventLoop
|
||||
|
||||
if sys.version_info >= (3, 14):
|
||||
_DefaultEventLoopPolicy = _UnixDefaultEventLoopPolicy
|
||||
else:
|
||||
DefaultEventLoopPolicy = _UnixDefaultEventLoopPolicy
|
||||
|
||||
if sys.version_info >= (3, 13):
|
||||
|
@ -198,7 +203,7 @@ if sys.platform != "win32":
|
|||
self, pid: int, callback: Callable[[int, int, Unpack[_Ts]], object], *args: Unpack[_Ts]
|
||||
) -> None: ...
|
||||
def remove_child_handler(self, pid: int) -> bool: ...
|
||||
def attach_loop(self, loop: AbstractEventLoop | None) -> None: ...
|
||||
def attach_loop(self, loop: events.AbstractEventLoop | None) -> None: ...
|
||||
|
||||
else:
|
||||
class MultiLoopChildWatcher(AbstractChildWatcher):
|
||||
|
@ -212,7 +217,7 @@ if sys.platform != "win32":
|
|||
self, pid: int, callback: Callable[[int, int, Unpack[_Ts]], object], *args: Unpack[_Ts]
|
||||
) -> None: ...
|
||||
def remove_child_handler(self, pid: int) -> bool: ...
|
||||
def attach_loop(self, loop: AbstractEventLoop | None) -> None: ...
|
||||
def attach_loop(self, loop: events.AbstractEventLoop | None) -> None: ...
|
||||
|
||||
if sys.version_info < (3, 14):
|
||||
class ThreadedChildWatcher(AbstractChildWatcher):
|
||||
|
@ -227,7 +232,7 @@ if sys.platform != "win32":
|
|||
self, pid: int, callback: Callable[[int, int, Unpack[_Ts]], object], *args: Unpack[_Ts]
|
||||
) -> None: ...
|
||||
def remove_child_handler(self, pid: int) -> bool: ...
|
||||
def attach_loop(self, loop: AbstractEventLoop | None) -> None: ...
|
||||
def attach_loop(self, loop: events.AbstractEventLoop | None) -> None: ...
|
||||
|
||||
class PidfdChildWatcher(AbstractChildWatcher):
|
||||
def __enter__(self) -> Self: ...
|
||||
|
@ -236,7 +241,7 @@ if sys.platform != "win32":
|
|||
) -> None: ...
|
||||
def is_active(self) -> bool: ...
|
||||
def close(self) -> None: ...
|
||||
def attach_loop(self, loop: AbstractEventLoop | None) -> None: ...
|
||||
def attach_loop(self, loop: events.AbstractEventLoop | None) -> None: ...
|
||||
def add_child_handler(
|
||||
self, pid: int, callback: Callable[[int, int, Unpack[_Ts]], object], *args: Unpack[_Ts]
|
||||
) -> None: ...
|
||||
|
|
|
@ -8,7 +8,17 @@ from . import events, futures, proactor_events, selector_events, streams, window
|
|||
|
||||
# Keep asyncio.__all__ updated with any changes to __all__ here
|
||||
if sys.platform == "win32":
|
||||
if sys.version_info >= (3, 13):
|
||||
if sys.version_info >= (3, 14):
|
||||
__all__ = (
|
||||
"SelectorEventLoop",
|
||||
"ProactorEventLoop",
|
||||
"IocpProactor",
|
||||
"_DefaultEventLoopPolicy",
|
||||
"_WindowsSelectorEventLoopPolicy",
|
||||
"_WindowsProactorEventLoopPolicy",
|
||||
"EventLoop",
|
||||
)
|
||||
elif sys.version_info >= (3, 13):
|
||||
# 3.13 added `EventLoop`.
|
||||
__all__ = (
|
||||
"SelectorEventLoop",
|
||||
|
@ -85,9 +95,16 @@ if sys.platform == "win32":
|
|||
|
||||
SelectorEventLoop = _WindowsSelectorEventLoop
|
||||
|
||||
if sys.version_info >= (3, 14):
|
||||
class _WindowsSelectorEventLoopPolicy(events._BaseDefaultEventLoopPolicy):
|
||||
_loop_factory: ClassVar[type[SelectorEventLoop]]
|
||||
|
||||
class _WindowsProactorEventLoopPolicy(events._BaseDefaultEventLoopPolicy):
|
||||
_loop_factory: ClassVar[type[ProactorEventLoop]]
|
||||
|
||||
else:
|
||||
class WindowsSelectorEventLoopPolicy(events.BaseDefaultEventLoopPolicy):
|
||||
_loop_factory: ClassVar[type[SelectorEventLoop]]
|
||||
if sys.version_info < (3, 14):
|
||||
def get_child_watcher(self) -> NoReturn: ...
|
||||
def set_child_watcher(self, watcher: Any) -> NoReturn: ...
|
||||
|
||||
|
@ -96,6 +113,9 @@ if sys.platform == "win32":
|
|||
def get_child_watcher(self) -> NoReturn: ...
|
||||
def set_child_watcher(self, watcher: Any) -> NoReturn: ...
|
||||
|
||||
if sys.version_info >= (3, 14):
|
||||
_DefaultEventLoopPolicy = _WindowsProactorEventLoopPolicy
|
||||
else:
|
||||
DefaultEventLoopPolicy = WindowsSelectorEventLoopPolicy
|
||||
if sys.version_info >= (3, 13):
|
||||
EventLoop = ProactorEventLoop
|
||||
|
|
|
@ -6,7 +6,6 @@ import types
|
|||
from _collections_abc import dict_items, dict_keys, dict_values
|
||||
from _typeshed import (
|
||||
AnnotationForm,
|
||||
AnyStr_co,
|
||||
ConvertibleToFloat,
|
||||
ConvertibleToInt,
|
||||
FileDescriptorOrPath,
|
||||
|
@ -33,6 +32,7 @@ from _typeshed import (
|
|||
)
|
||||
from collections.abc import Awaitable, Callable, Iterable, Iterator, MutableSet, Reversible, Set as AbstractSet, Sized
|
||||
from io import BufferedRandom, BufferedReader, BufferedWriter, FileIO, TextIOWrapper
|
||||
from os import PathLike
|
||||
from types import CellType, CodeType, GenericAlias, TracebackType
|
||||
|
||||
# mypy crashes if any of {ByteString, Sequence, MutableSequence, Mapping, MutableMapping}
|
||||
|
@ -154,6 +154,9 @@ class staticmethod(Generic[_P, _R_co]):
|
|||
@property
|
||||
def __wrapped__(self) -> Callable[_P, _R_co]: ...
|
||||
def __call__(self, *args: _P.args, **kwargs: _P.kwargs) -> _R_co: ...
|
||||
if sys.version_info >= (3, 14):
|
||||
def __class_getitem__(cls, item: Any, /) -> GenericAlias: ...
|
||||
__annotate__: AnnotateFunc | None
|
||||
|
||||
class classmethod(Generic[_T, _P, _R_co]):
|
||||
@property
|
||||
|
@ -170,6 +173,9 @@ class classmethod(Generic[_T, _P, _R_co]):
|
|||
__qualname__: str
|
||||
@property
|
||||
def __wrapped__(self) -> Callable[Concatenate[type[_T], _P], _R_co]: ...
|
||||
if sys.version_info >= (3, 14):
|
||||
def __class_getitem__(cls, item: Any, /) -> GenericAlias: ...
|
||||
__annotate__: AnnotateFunc | None
|
||||
|
||||
class type:
|
||||
# object.__base__ is None. Otherwise, it would be a type.
|
||||
|
@ -325,7 +331,11 @@ class int:
|
|||
def __trunc__(self) -> int: ...
|
||||
def __ceil__(self) -> int: ...
|
||||
def __floor__(self) -> int: ...
|
||||
if sys.version_info >= (3, 14):
|
||||
def __round__(self, ndigits: SupportsIndex | None = None, /) -> int: ...
|
||||
else:
|
||||
def __round__(self, ndigits: SupportsIndex = ..., /) -> int: ...
|
||||
|
||||
def __getnewargs__(self) -> tuple[int]: ...
|
||||
def __eq__(self, value: object, /) -> bool: ...
|
||||
def __ne__(self, value: object, /) -> bool: ...
|
||||
|
@ -400,6 +410,9 @@ class float:
|
|||
def __abs__(self) -> float: ...
|
||||
def __hash__(self) -> int: ...
|
||||
def __bool__(self) -> bool: ...
|
||||
if sys.version_info >= (3, 14):
|
||||
@classmethod
|
||||
def from_number(cls, number: float | SupportsIndex | SupportsFloat, /) -> Self: ...
|
||||
|
||||
class complex:
|
||||
# Python doesn't currently accept SupportsComplex for the second argument
|
||||
|
@ -435,6 +448,9 @@ class complex:
|
|||
def __bool__(self) -> bool: ...
|
||||
if sys.version_info >= (3, 11):
|
||||
def __complex__(self) -> complex: ...
|
||||
if sys.version_info >= (3, 14):
|
||||
@classmethod
|
||||
def from_number(cls, number: complex | SupportsComplex | SupportsFloat | SupportsIndex, /) -> Self: ...
|
||||
|
||||
class _FormatMapMapping(Protocol):
|
||||
def __getitem__(self, key: str, /) -> Any: ...
|
||||
|
@ -832,6 +848,8 @@ class bytearray(MutableSequence[int]):
|
|||
def __alloc__(self) -> int: ...
|
||||
def __buffer__(self, flags: int, /) -> memoryview: ...
|
||||
def __release_buffer__(self, buffer: memoryview, /) -> None: ...
|
||||
if sys.version_info >= (3, 14):
|
||||
def resize(self, size: int, /) -> None: ...
|
||||
|
||||
_IntegerFormats: TypeAlias = Literal[
|
||||
"b", "B", "@b", "@B", "h", "H", "@h", "@H", "i", "I", "@i", "@I", "l", "L", "@l", "@L", "q", "Q", "@q", "@Q", "P", "@P"
|
||||
|
@ -909,6 +927,8 @@ class memoryview(Sequence[_I]):
|
|||
# See https://github.com/python/cpython/issues/125420
|
||||
index: ClassVar[None] # type: ignore[assignment]
|
||||
count: ClassVar[None] # type: ignore[assignment]
|
||||
if sys.version_info >= (3, 14):
|
||||
def __class_getitem__(cls, item: Any, /) -> GenericAlias: ...
|
||||
|
||||
@final
|
||||
class bool(int):
|
||||
|
@ -940,7 +960,7 @@ class bool(int):
|
|||
@overload
|
||||
def __rxor__(self, value: int, /) -> int: ...
|
||||
def __getnewargs__(self) -> tuple[int]: ...
|
||||
@deprecated("Will throw an error in Python 3.14. Use `not` for logical negation of bools instead.")
|
||||
@deprecated("Will throw an error in Python 3.16. Use `not` for logical negation of bools instead.")
|
||||
def __invert__(self) -> int: ...
|
||||
|
||||
@final
|
||||
|
@ -1028,7 +1048,7 @@ class function:
|
|||
__annotations__: dict[str, AnnotationForm]
|
||||
if sys.version_info >= (3, 14):
|
||||
__annotate__: AnnotateFunc | None
|
||||
__kwdefaults__: dict[str, Any]
|
||||
__kwdefaults__: dict[str, Any] | None
|
||||
if sys.version_info >= (3, 10):
|
||||
@property
|
||||
def __builtins__(self) -> dict[str, Any]: ...
|
||||
|
@ -1036,6 +1056,26 @@ class function:
|
|||
__type_params__: tuple[TypeVar | ParamSpec | TypeVarTuple, ...]
|
||||
|
||||
__module__: str
|
||||
if sys.version_info >= (3, 13):
|
||||
def __new__(
|
||||
cls,
|
||||
code: CodeType,
|
||||
globals: dict[str, Any],
|
||||
name: str | None = None,
|
||||
argdefs: tuple[object, ...] | None = None,
|
||||
closure: tuple[CellType, ...] | None = None,
|
||||
kwdefaults: dict[str, object] | None = None,
|
||||
) -> Self: ...
|
||||
else:
|
||||
def __new__(
|
||||
cls,
|
||||
code: CodeType,
|
||||
globals: dict[str, Any],
|
||||
name: str | None = None,
|
||||
argdefs: tuple[object, ...] | None = None,
|
||||
closure: tuple[CellType, ...] | None = None,
|
||||
) -> Self: ...
|
||||
|
||||
# mypy uses `builtins.function.__get__` to represent methods, properties, and getset_descriptors so we type the return as Any.
|
||||
def __get__(self, instance: object, owner: type | None = None, /) -> Any: ...
|
||||
|
||||
|
@ -1313,11 +1353,6 @@ def breakpoint(*args: Any, **kws: Any) -> None: ...
|
|||
def callable(obj: object, /) -> TypeIs[Callable[..., object]]: ...
|
||||
def chr(i: int | SupportsIndex, /) -> str: ...
|
||||
|
||||
# We define this here instead of using os.PathLike to avoid import cycle issues.
|
||||
# See https://github.com/python/typeshed/pull/991#issuecomment-288160993
|
||||
class _PathLike(Protocol[AnyStr_co]):
|
||||
def __fspath__(self) -> AnyStr_co: ...
|
||||
|
||||
if sys.version_info >= (3, 10):
|
||||
def aiter(async_iterable: SupportsAiter[_SupportsAnextT_co], /) -> _SupportsAnextT_co: ...
|
||||
|
||||
|
@ -1338,7 +1373,7 @@ if sys.version_info >= (3, 10):
|
|||
@overload
|
||||
def compile(
|
||||
source: str | ReadableBuffer | _ast.Module | _ast.Expression | _ast.Interactive,
|
||||
filename: str | ReadableBuffer | _PathLike[Any],
|
||||
filename: str | ReadableBuffer | PathLike[Any],
|
||||
mode: str,
|
||||
flags: Literal[0],
|
||||
dont_inherit: bool = False,
|
||||
|
@ -1349,7 +1384,7 @@ def compile(
|
|||
@overload
|
||||
def compile(
|
||||
source: str | ReadableBuffer | _ast.Module | _ast.Expression | _ast.Interactive,
|
||||
filename: str | ReadableBuffer | _PathLike[Any],
|
||||
filename: str | ReadableBuffer | PathLike[Any],
|
||||
mode: str,
|
||||
*,
|
||||
dont_inherit: bool = False,
|
||||
|
@ -1359,7 +1394,7 @@ def compile(
|
|||
@overload
|
||||
def compile(
|
||||
source: str | ReadableBuffer | _ast.Module | _ast.Expression | _ast.Interactive,
|
||||
filename: str | ReadableBuffer | _PathLike[Any],
|
||||
filename: str | ReadableBuffer | PathLike[Any],
|
||||
mode: str,
|
||||
flags: Literal[1024],
|
||||
dont_inherit: bool = False,
|
||||
|
@ -1370,7 +1405,7 @@ def compile(
|
|||
@overload
|
||||
def compile(
|
||||
source: str | ReadableBuffer | _ast.Module | _ast.Expression | _ast.Interactive,
|
||||
filename: str | ReadableBuffer | _PathLike[Any],
|
||||
filename: str | ReadableBuffer | PathLike[Any],
|
||||
mode: str,
|
||||
flags: int,
|
||||
dont_inherit: bool = False,
|
||||
|
@ -2160,27 +2195,27 @@ if sys.version_info >= (3, 11):
|
|||
def exceptions(self) -> tuple[_BaseExceptionT_co | BaseExceptionGroup[_BaseExceptionT_co], ...]: ...
|
||||
@overload
|
||||
def subgroup(
|
||||
self, condition: type[_ExceptionT] | tuple[type[_ExceptionT], ...], /
|
||||
self, matcher_value: type[_ExceptionT] | tuple[type[_ExceptionT], ...], /
|
||||
) -> ExceptionGroup[_ExceptionT] | None: ...
|
||||
@overload
|
||||
def subgroup(
|
||||
self, condition: type[_BaseExceptionT] | tuple[type[_BaseExceptionT], ...], /
|
||||
self, matcher_value: type[_BaseExceptionT] | tuple[type[_BaseExceptionT], ...], /
|
||||
) -> BaseExceptionGroup[_BaseExceptionT] | None: ...
|
||||
@overload
|
||||
def subgroup(
|
||||
self, condition: Callable[[_BaseExceptionT_co | Self], bool], /
|
||||
self, matcher_value: Callable[[_BaseExceptionT_co | Self], bool], /
|
||||
) -> BaseExceptionGroup[_BaseExceptionT_co] | None: ...
|
||||
@overload
|
||||
def split(
|
||||
self, condition: type[_ExceptionT] | tuple[type[_ExceptionT], ...], /
|
||||
self, matcher_value: type[_ExceptionT] | tuple[type[_ExceptionT], ...], /
|
||||
) -> tuple[ExceptionGroup[_ExceptionT] | None, BaseExceptionGroup[_BaseExceptionT_co] | None]: ...
|
||||
@overload
|
||||
def split(
|
||||
self, condition: type[_BaseExceptionT] | tuple[type[_BaseExceptionT], ...], /
|
||||
self, matcher_value: type[_BaseExceptionT] | tuple[type[_BaseExceptionT], ...], /
|
||||
) -> tuple[BaseExceptionGroup[_BaseExceptionT] | None, BaseExceptionGroup[_BaseExceptionT_co] | None]: ...
|
||||
@overload
|
||||
def split(
|
||||
self, condition: Callable[[_BaseExceptionT_co | Self], bool], /
|
||||
self, matcher_value: Callable[[_BaseExceptionT_co | Self], bool], /
|
||||
) -> tuple[BaseExceptionGroup[_BaseExceptionT_co] | None, BaseExceptionGroup[_BaseExceptionT_co] | None]: ...
|
||||
# In reality it is `NonEmptySequence`:
|
||||
@overload
|
||||
|
@ -2197,17 +2232,19 @@ if sys.version_info >= (3, 11):
|
|||
# We accept a narrower type, but that's OK.
|
||||
@overload # type: ignore[override]
|
||||
def subgroup(
|
||||
self, condition: type[_ExceptionT] | tuple[type[_ExceptionT], ...], /
|
||||
self, matcher_value: type[_ExceptionT] | tuple[type[_ExceptionT], ...], /
|
||||
) -> ExceptionGroup[_ExceptionT] | None: ...
|
||||
@overload
|
||||
def subgroup(self, condition: Callable[[_ExceptionT_co | Self], bool], /) -> ExceptionGroup[_ExceptionT_co] | None: ...
|
||||
def subgroup(
|
||||
self, matcher_value: Callable[[_ExceptionT_co | Self], bool], /
|
||||
) -> ExceptionGroup[_ExceptionT_co] | None: ...
|
||||
@overload # type: ignore[override]
|
||||
def split(
|
||||
self, condition: type[_ExceptionT] | tuple[type[_ExceptionT], ...], /
|
||||
self, matcher_value: type[_ExceptionT] | tuple[type[_ExceptionT], ...], /
|
||||
) -> tuple[ExceptionGroup[_ExceptionT] | None, ExceptionGroup[_ExceptionT_co] | None]: ...
|
||||
@overload
|
||||
def split(
|
||||
self, condition: Callable[[_ExceptionT_co | Self], bool], /
|
||||
self, matcher_value: Callable[[_ExceptionT_co | Self], bool], /
|
||||
) -> tuple[ExceptionGroup[_ExceptionT_co] | None, ExceptionGroup[_ExceptionT_co] | None]: ...
|
||||
|
||||
if sys.version_info >= (3, 13):
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import sys
|
||||
from collections.abc import Callable, Mapping
|
||||
from concurrent.futures import ThreadPoolExecutor
|
||||
from typing import Final, Literal, Protocol, overload, type_check_only
|
||||
from typing import Literal, Protocol, overload, type_check_only
|
||||
from typing_extensions import ParamSpec, Self, TypeAlias, TypeVar, TypeVarTuple, Unpack
|
||||
|
||||
_Task: TypeAlias = tuple[bytes, Literal["function", "script"]]
|
||||
|
@ -37,8 +37,6 @@ if sys.version_info >= (3, 14):
|
|||
class ExecutionFailed(InterpreterError):
|
||||
def __init__(self, excinfo: _ExcInfo) -> None: ... # type: ignore[override]
|
||||
|
||||
UNBOUND: Final = 2
|
||||
|
||||
class WorkerContext(ThreadWorkerContext):
|
||||
# Parent class doesn't have `shared` argument,
|
||||
@overload # type: ignore[override]
|
||||
|
|
|
@ -31,6 +31,9 @@ from typing_extensions import Self, TypeAlias, deprecated
|
|||
if sys.platform == "win32":
|
||||
from _ctypes import FormatError as FormatError, get_last_error as get_last_error, set_last_error as set_last_error
|
||||
|
||||
if sys.version_info >= (3, 14):
|
||||
from _ctypes import COMError as COMError
|
||||
|
||||
if sys.version_info >= (3, 11):
|
||||
from ctypes._endian import BigEndianUnion as BigEndianUnion, LittleEndianUnion as LittleEndianUnion
|
||||
|
||||
|
@ -197,8 +200,13 @@ if sys.platform == "win32":
|
|||
|
||||
def wstring_at(ptr: _CVoidConstPLike, size: int = -1) -> str: ...
|
||||
|
||||
if sys.version_info >= (3, 14):
|
||||
def memoryview_at(ptr: _CVoidConstPLike, size: int, readonly: bool = False) -> memoryview: ...
|
||||
|
||||
class py_object(_CanCastTo, _SimpleCData[_T]):
|
||||
_type_: ClassVar[Literal["O"]]
|
||||
if sys.version_info >= (3, 14):
|
||||
def __class_getitem__(cls, item: Any, /) -> GenericAlias: ...
|
||||
|
||||
class c_bool(_SimpleCData[bool]):
|
||||
_type_: ClassVar[Literal["?"]]
|
||||
|
@ -270,15 +278,15 @@ class c_double(_SimpleCData[float]):
|
|||
class c_longdouble(_SimpleCData[float]): # can be an alias for c_double
|
||||
_type_: ClassVar[Literal["d", "g"]]
|
||||
|
||||
if sys.version_info >= (3, 14):
|
||||
class c_float_complex(_SimpleCData[complex]):
|
||||
_type_: ClassVar[Literal["E"]]
|
||||
|
||||
if sys.version_info >= (3, 14) and sys.platform != "win32":
|
||||
class c_double_complex(_SimpleCData[complex]):
|
||||
_type_: ClassVar[Literal["C"]]
|
||||
_type_: ClassVar[Literal["D"]]
|
||||
|
||||
class c_float_complex(_SimpleCData[complex]):
|
||||
_type_: ClassVar[Literal["F"]]
|
||||
|
||||
class c_longdouble_complex(_SimpleCData[complex]):
|
||||
_type_: ClassVar[Literal["F"]]
|
||||
_type_: ClassVar[Literal["G"]]
|
||||
|
||||
class c_char(_SimpleCData[bytes]):
|
||||
_type_: ClassVar[Literal["c"]]
|
||||
|
|
|
@ -5,4 +5,7 @@ def find_library(name: str) -> str | None: ...
|
|||
if sys.platform == "win32":
|
||||
def find_msvcrt() -> str | None: ...
|
||||
|
||||
if sys.version_info >= (3, 14):
|
||||
def dllist() -> list[str]: ...
|
||||
|
||||
def test() -> None: ...
|
||||
|
|
|
@ -83,6 +83,15 @@ HACCEL = HANDLE
|
|||
HBITMAP = HANDLE
|
||||
HBRUSH = HANDLE
|
||||
HCOLORSPACE = HANDLE
|
||||
if sys.version_info >= (3, 14):
|
||||
HCONV = HANDLE
|
||||
HCONVLIST = HANDLE
|
||||
HCURSOR = HANDLE
|
||||
HDDEDATA = HANDLE
|
||||
HDROP = HANDLE
|
||||
HFILE = INT
|
||||
HRESULT = LONG
|
||||
HSZ = HANDLE
|
||||
HDC = HANDLE
|
||||
HDESK = HANDLE
|
||||
HDWP = HANDLE
|
||||
|
|
|
@ -71,14 +71,28 @@ def asdict(obj: DataclassInstance, *, dict_factory: Callable[[list[tuple[str, An
|
|||
def astuple(obj: DataclassInstance) -> tuple[Any, ...]: ...
|
||||
@overload
|
||||
def astuple(obj: DataclassInstance, *, tuple_factory: Callable[[list[Any]], _T]) -> _T: ...
|
||||
@overload
|
||||
def dataclass(cls: None, /) -> Callable[[type[_T]], type[_T]]: ...
|
||||
@overload
|
||||
def dataclass(cls: type[_T], /) -> type[_T]: ...
|
||||
|
||||
if sys.version_info >= (3, 11):
|
||||
@overload
|
||||
def dataclass(
|
||||
cls: type[_T],
|
||||
/,
|
||||
*,
|
||||
init: bool = True,
|
||||
repr: bool = True,
|
||||
eq: bool = True,
|
||||
order: bool = False,
|
||||
unsafe_hash: bool = False,
|
||||
frozen: bool = False,
|
||||
match_args: bool = True,
|
||||
kw_only: bool = False,
|
||||
slots: bool = False,
|
||||
weakref_slot: bool = False,
|
||||
) -> type[_T]: ...
|
||||
@overload
|
||||
def dataclass(
|
||||
cls: None = None,
|
||||
/,
|
||||
*,
|
||||
init: bool = True,
|
||||
repr: bool = True,
|
||||
|
@ -95,6 +109,23 @@ if sys.version_info >= (3, 11):
|
|||
elif sys.version_info >= (3, 10):
|
||||
@overload
|
||||
def dataclass(
|
||||
cls: type[_T],
|
||||
/,
|
||||
*,
|
||||
init: bool = True,
|
||||
repr: bool = True,
|
||||
eq: bool = True,
|
||||
order: bool = False,
|
||||
unsafe_hash: bool = False,
|
||||
frozen: bool = False,
|
||||
match_args: bool = True,
|
||||
kw_only: bool = False,
|
||||
slots: bool = False,
|
||||
) -> type[_T]: ...
|
||||
@overload
|
||||
def dataclass(
|
||||
cls: None = None,
|
||||
/,
|
||||
*,
|
||||
init: bool = True,
|
||||
repr: bool = True,
|
||||
|
@ -110,6 +141,20 @@ elif sys.version_info >= (3, 10):
|
|||
else:
|
||||
@overload
|
||||
def dataclass(
|
||||
cls: type[_T],
|
||||
/,
|
||||
*,
|
||||
init: bool = True,
|
||||
repr: bool = True,
|
||||
eq: bool = True,
|
||||
order: bool = False,
|
||||
unsafe_hash: bool = False,
|
||||
frozen: bool = False,
|
||||
) -> type[_T]: ...
|
||||
@overload
|
||||
def dataclass(
|
||||
cls: None = None,
|
||||
/,
|
||||
*,
|
||||
init: bool = True,
|
||||
repr: bool = True,
|
||||
|
@ -308,7 +353,7 @@ def is_dataclass(obj: object) -> TypeIs[DataclassInstance | type[DataclassInstan
|
|||
|
||||
class FrozenInstanceError(AttributeError): ...
|
||||
|
||||
class InitVar(Generic[_T], metaclass=type):
|
||||
class InitVar(Generic[_T]):
|
||||
type: Type[_T]
|
||||
def __init__(self, type: Type[_T]) -> None: ...
|
||||
@overload
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
from _typeshed import BytesPath, Incomplete, StrOrBytesPath, StrPath, Unused
|
||||
from _typeshed import BytesPath, StrOrBytesPath, StrPath, Unused
|
||||
from abc import abstractmethod
|
||||
from collections.abc import Callable, Iterable
|
||||
from distutils.command.bdist import bdist
|
||||
|
@ -226,4 +226,4 @@ class Command:
|
|||
level: Unused = 1,
|
||||
) -> None: ...
|
||||
def ensure_finalized(self) -> None: ...
|
||||
def dump_options(self, header: Incomplete | None = None, indent: str = "") -> None: ...
|
||||
def dump_options(self, header=None, indent: str = "") -> None: ...
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
from _typeshed import Incomplete, StrOrBytesPath
|
||||
from _typeshed import StrOrBytesPath
|
||||
from collections.abc import Sequence
|
||||
from re import Pattern
|
||||
from typing import ClassVar, Final, Literal
|
||||
|
@ -81,4 +81,4 @@ class config(Command):
|
|||
self, header: str, include_dirs: Sequence[str] | None = None, library_dirs: Sequence[str] | None = None, lang: str = "c"
|
||||
) -> bool: ...
|
||||
|
||||
def dump_file(filename: StrOrBytesPath, head: Incomplete | None = None) -> None: ...
|
||||
def dump_file(filename: StrOrBytesPath, head=None) -> None: ...
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
from _typeshed import Incomplete
|
||||
from collections.abc import Callable
|
||||
from typing import Any, ClassVar
|
||||
|
||||
|
@ -18,4 +17,4 @@ class register(PyPIRCCommand):
|
|||
def verify_metadata(self) -> None: ...
|
||||
def send_metadata(self) -> None: ...
|
||||
def build_post_data(self, action): ...
|
||||
def post_to_server(self, data, auth: Incomplete | None = None): ...
|
||||
def post_to_server(self, data, auth=None): ...
|
||||
|
|
|
@ -112,9 +112,7 @@ class Distribution:
|
|||
command_obj: Incomplete
|
||||
have_run: Incomplete
|
||||
want_user_cfg: bool
|
||||
def dump_option_dicts(
|
||||
self, header: Incomplete | None = None, commands: Incomplete | None = None, indent: str = ""
|
||||
) -> None: ...
|
||||
def dump_option_dicts(self, header=None, commands=None, indent: str = "") -> None: ...
|
||||
def find_config_files(self): ...
|
||||
commands: Incomplete
|
||||
def parse_command_line(self): ...
|
||||
|
|
|
@ -53,6 +53,7 @@ _EnumerationT = TypeVar("_EnumerationT", bound=type[Enum])
|
|||
# >>> Enum('Foo', names={'RED': 1, 'YELLOW': 2})
|
||||
# <enum 'Foo'>
|
||||
_EnumNames: TypeAlias = str | Iterable[str] | Iterable[Iterable[str | Any]] | Mapping[str, Any]
|
||||
_Signature: TypeAlias = Any # TODO: Unable to import Signature from inspect module
|
||||
|
||||
if sys.version_info >= (3, 11):
|
||||
class nonmember(Generic[_EnumMemberT]):
|
||||
|
@ -166,6 +167,9 @@ class EnumMeta(type):
|
|||
if sys.version_info >= (3, 12):
|
||||
@overload
|
||||
def __call__(cls: type[_EnumMemberT], value: Any, *values: Any) -> _EnumMemberT: ...
|
||||
if sys.version_info >= (3, 14):
|
||||
@property
|
||||
def __signature__(cls) -> _Signature: ...
|
||||
|
||||
_member_names_: list[str] # undocumented
|
||||
_member_map_: dict[str, Enum] # undocumented
|
||||
|
@ -212,7 +216,7 @@ class Enum(metaclass=EnumMeta):
|
|||
if sys.version_info >= (3, 11):
|
||||
def __copy__(self) -> Self: ...
|
||||
def __deepcopy__(self, memo: Any) -> Self: ...
|
||||
if sys.version_info >= (3, 12):
|
||||
if sys.version_info >= (3, 12) and sys.version_info < (3, 14):
|
||||
@classmethod
|
||||
def __signature__(cls) -> str: ...
|
||||
|
||||
|
|
|
@ -170,6 +170,9 @@ if sys.platform != "win32" and sys.platform != "darwin":
|
|||
ENOMEDIUM: int
|
||||
ERFKILL: int
|
||||
|
||||
if sys.version_info >= (3, 14):
|
||||
EHWPOISON: int
|
||||
|
||||
if sys.platform == "win32":
|
||||
# All of these are undocumented
|
||||
WSABASEERR: int
|
||||
|
|
|
@ -4,6 +4,10 @@ from _typeshed import FileDescriptorLike
|
|||
def cancel_dump_traceback_later() -> None: ...
|
||||
def disable() -> None: ...
|
||||
def dump_traceback(file: FileDescriptorLike = ..., all_threads: bool = ...) -> None: ...
|
||||
|
||||
if sys.version_info >= (3, 14):
|
||||
def dump_c_stack(file: FileDescriptorLike = ...) -> None: ...
|
||||
|
||||
def dump_traceback_later(timeout: float, repeat: bool = ..., file: FileDescriptorLike = ..., exit: bool = ...) -> None: ...
|
||||
def enable(file: FileDescriptorLike = ..., all_threads: bool = ...) -> None: ...
|
||||
def is_enabled() -> bool: ...
|
||||
|
|
|
@ -145,3 +145,6 @@ class Fraction(Rational):
|
|||
@property
|
||||
def imag(self) -> Literal[0]: ...
|
||||
def conjugate(self) -> Fraction: ...
|
||||
if sys.version_info >= (3, 14):
|
||||
@classmethod
|
||||
def from_number(cls, number: float | Rational | _ConvertibleToIntegerRatio) -> Self: ...
|
||||
|
|
|
@ -113,6 +113,7 @@ class FileLoader(_bootstrap_external.FileLoader, ResourceLoader, ExecutionLoader
|
|||
def get_filename(self, name: str | None = None) -> str: ...
|
||||
def load_module(self, name: str | None = None) -> types.ModuleType: ...
|
||||
|
||||
if sys.version_info < (3, 11):
|
||||
class ResourceReader(metaclass=ABCMeta):
|
||||
@abstractmethod
|
||||
def open_resource(self, resource: str) -> IO[bytes]: ...
|
||||
|
@ -173,3 +174,10 @@ class TraversableResources(ResourceReader):
|
|||
def resource_path(self, resource: Any) -> str: ...
|
||||
def is_resource(self, path: str) -> bool: ...
|
||||
def contents(self) -> Iterator[str]: ...
|
||||
|
||||
elif sys.version_info < (3, 14):
|
||||
from importlib.resources.abc import (
|
||||
ResourceReader as ResourceReader,
|
||||
Traversable as Traversable,
|
||||
TraversableResources as TraversableResources,
|
||||
)
|
||||
|
|
|
@ -16,5 +16,28 @@ from importlib._bootstrap_external import (
|
|||
|
||||
if sys.version_info >= (3, 11):
|
||||
from importlib._bootstrap_external import NamespaceLoader as NamespaceLoader
|
||||
if sys.version_info >= (3, 14):
|
||||
from importlib._bootstrap_external import AppleFrameworkLoader as AppleFrameworkLoader
|
||||
|
||||
def all_suffixes() -> list[str]: ...
|
||||
|
||||
if sys.version_info >= (3, 14):
|
||||
__all__ = [
|
||||
"AppleFrameworkLoader",
|
||||
"BYTECODE_SUFFIXES",
|
||||
"BuiltinImporter",
|
||||
"DEBUG_BYTECODE_SUFFIXES",
|
||||
"EXTENSION_SUFFIXES",
|
||||
"ExtensionFileLoader",
|
||||
"FileFinder",
|
||||
"FrozenImporter",
|
||||
"ModuleSpec",
|
||||
"NamespaceLoader",
|
||||
"OPTIMIZED_BYTECODE_SUFFIXES",
|
||||
"PathFinder",
|
||||
"SOURCE_SUFFIXES",
|
||||
"SourceFileLoader",
|
||||
"SourcelessFileLoader",
|
||||
"WindowsRegistryFinder",
|
||||
"all_suffixes",
|
||||
]
|
||||
|
|
|
@ -2,12 +2,16 @@ import os
|
|||
import sys
|
||||
from collections.abc import Iterator
|
||||
from contextlib import AbstractContextManager
|
||||
from importlib.abc import Traversable
|
||||
from pathlib import Path
|
||||
from types import ModuleType
|
||||
from typing import Any, BinaryIO, Literal, TextIO
|
||||
from typing_extensions import TypeAlias
|
||||
|
||||
if sys.version_info >= (3, 11):
|
||||
from importlib.resources.abc import Traversable
|
||||
else:
|
||||
from importlib.abc import Traversable
|
||||
|
||||
if sys.version_info >= (3, 11):
|
||||
from importlib.resources._common import Package as Package
|
||||
else:
|
||||
|
@ -72,5 +76,7 @@ if sys.version_info >= (3, 11):
|
|||
else:
|
||||
def files(package: Package) -> Traversable: ...
|
||||
|
||||
if sys.version_info >= (3, 10):
|
||||
if sys.version_info >= (3, 11):
|
||||
from importlib.resources.abc import ResourceReader as ResourceReader
|
||||
elif sys.version_info >= (3, 10):
|
||||
from importlib.abc import ResourceReader as ResourceReader
|
||||
|
|
|
@ -5,7 +5,7 @@ if sys.version_info >= (3, 11):
|
|||
import types
|
||||
from collections.abc import Callable
|
||||
from contextlib import AbstractContextManager
|
||||
from importlib.abc import ResourceReader, Traversable
|
||||
from importlib.resources.abc import ResourceReader, Traversable
|
||||
from pathlib import Path
|
||||
from typing import Literal, overload
|
||||
from typing_extensions import TypeAlias, deprecated
|
||||
|
|
|
@ -1,14 +1,69 @@
|
|||
import sys
|
||||
from abc import ABCMeta, abstractmethod
|
||||
from collections.abc import Iterator
|
||||
from io import BufferedReader
|
||||
from typing import IO, Any, Literal, Protocol, overload, runtime_checkable
|
||||
|
||||
if sys.version_info >= (3, 11):
|
||||
# These are all actually defined in this file on 3.11+,
|
||||
# and re-exported from importlib.abc,
|
||||
# but it's much less code duplication for typeshed if we pretend that they're still defined
|
||||
# in importlib.abc on 3.11+, and re-exported from this file
|
||||
from importlib.abc import (
|
||||
ResourceReader as ResourceReader,
|
||||
Traversable as Traversable,
|
||||
TraversableResources as TraversableResources,
|
||||
)
|
||||
class ResourceReader(metaclass=ABCMeta):
|
||||
@abstractmethod
|
||||
def open_resource(self, resource: str) -> IO[bytes]: ...
|
||||
@abstractmethod
|
||||
def resource_path(self, resource: str) -> str: ...
|
||||
if sys.version_info >= (3, 10):
|
||||
@abstractmethod
|
||||
def is_resource(self, path: str) -> bool: ...
|
||||
else:
|
||||
@abstractmethod
|
||||
def is_resource(self, name: str) -> bool: ...
|
||||
|
||||
@abstractmethod
|
||||
def contents(self) -> Iterator[str]: ...
|
||||
|
||||
@runtime_checkable
|
||||
class Traversable(Protocol):
|
||||
@abstractmethod
|
||||
def is_dir(self) -> bool: ...
|
||||
@abstractmethod
|
||||
def is_file(self) -> bool: ...
|
||||
@abstractmethod
|
||||
def iterdir(self) -> Iterator[Traversable]: ...
|
||||
if sys.version_info >= (3, 11):
|
||||
@abstractmethod
|
||||
def joinpath(self, *descendants: str) -> Traversable: ...
|
||||
else:
|
||||
@abstractmethod
|
||||
def joinpath(self, child: str, /) -> Traversable: ...
|
||||
|
||||
# The documentation and runtime protocol allows *args, **kwargs arguments,
|
||||
# but this would mean that all implementers would have to support them,
|
||||
# which is not the case.
|
||||
@overload
|
||||
@abstractmethod
|
||||
def open(self, mode: Literal["r"] = "r", *, encoding: str | None = None, errors: str | None = None) -> IO[str]: ...
|
||||
@overload
|
||||
@abstractmethod
|
||||
def open(self, mode: Literal["rb"]) -> IO[bytes]: ...
|
||||
@property
|
||||
@abstractmethod
|
||||
def name(self) -> str: ...
|
||||
if sys.version_info >= (3, 10):
|
||||
def __truediv__(self, child: str, /) -> Traversable: ...
|
||||
else:
|
||||
@abstractmethod
|
||||
def __truediv__(self, child: str, /) -> Traversable: ...
|
||||
|
||||
@abstractmethod
|
||||
def read_bytes(self) -> bytes: ...
|
||||
@abstractmethod
|
||||
def read_text(self, encoding: str | None = None) -> str: ...
|
||||
|
||||
class TraversableResources(ResourceReader):
|
||||
@abstractmethod
|
||||
def files(self) -> Traversable: ...
|
||||
def open_resource(self, resource: str) -> BufferedReader: ...
|
||||
def resource_path(self, resource: Any) -> str: ...
|
||||
def is_resource(self, path: str) -> bool: ...
|
||||
def contents(self) -> Iterator[str]: ...
|
||||
|
||||
__all__ = ["ResourceReader", "Traversable", "TraversableResources"]
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
import importlib.abc
|
||||
import importlib.machinery
|
||||
import sys
|
||||
import types
|
||||
|
@ -12,6 +11,7 @@ from importlib._bootstrap_external import (
|
|||
source_from_cache as source_from_cache,
|
||||
spec_from_file_location as spec_from_file_location,
|
||||
)
|
||||
from importlib.abc import Loader
|
||||
from typing_extensions import ParamSpec
|
||||
|
||||
_P = ParamSpec("_P")
|
||||
|
@ -24,10 +24,26 @@ if sys.version_info < (3, 12):
|
|||
def resolve_name(name: str, package: str | None) -> str: ...
|
||||
def find_spec(name: str, package: str | None = None) -> importlib.machinery.ModuleSpec | None: ...
|
||||
|
||||
class LazyLoader(importlib.abc.Loader):
|
||||
def __init__(self, loader: importlib.abc.Loader) -> None: ...
|
||||
class LazyLoader(Loader):
|
||||
def __init__(self, loader: Loader) -> None: ...
|
||||
@classmethod
|
||||
def factory(cls, loader: importlib.abc.Loader) -> Callable[..., LazyLoader]: ...
|
||||
def factory(cls, loader: Loader) -> Callable[..., LazyLoader]: ...
|
||||
def exec_module(self, module: types.ModuleType) -> None: ...
|
||||
|
||||
def source_hash(source_bytes: ReadableBuffer) -> bytes: ...
|
||||
|
||||
if sys.version_info >= (3, 14):
|
||||
__all__ = [
|
||||
"LazyLoader",
|
||||
"Loader",
|
||||
"MAGIC_NUMBER",
|
||||
"cache_from_source",
|
||||
"decode_source",
|
||||
"find_spec",
|
||||
"module_from_spec",
|
||||
"resolve_name",
|
||||
"source_from_cache",
|
||||
"source_hash",
|
||||
"spec_from_file_location",
|
||||
"spec_from_loader",
|
||||
]
|
||||
|
|
|
@ -373,6 +373,9 @@ class LoggerAdapter(Generic[_L]):
|
|||
else:
|
||||
extra: Mapping[str, object]
|
||||
|
||||
if sys.version_info >= (3, 13):
|
||||
merge_extra: bool
|
||||
|
||||
def process(self, msg: Any, kwargs: MutableMapping[str, Any]) -> tuple[Any, MutableMapping[str, Any]]: ...
|
||||
def debug(
|
||||
self,
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
import sys
|
||||
from _typeshed import FileDescriptorLike, Unused
|
||||
from collections.abc import Sequence
|
||||
from struct import Struct
|
||||
|
@ -14,6 +15,18 @@ class ForkServer:
|
|||
def connect_to_new_process(self, fds: Sequence[int]) -> tuple[int, int]: ...
|
||||
def ensure_running(self) -> None: ...
|
||||
|
||||
if sys.version_info >= (3, 14):
|
||||
def main(
|
||||
listener_fd: int | None,
|
||||
alive_r: FileDescriptorLike,
|
||||
preload: Sequence[str],
|
||||
main_path: str | None = None,
|
||||
sys_path: list[str] | None = None,
|
||||
*,
|
||||
authkey_r: int | None = None,
|
||||
) -> None: ...
|
||||
|
||||
else:
|
||||
def main(
|
||||
listener_fd: int | None,
|
||||
alive_r: FileDescriptorLike,
|
||||
|
@ -21,6 +34,7 @@ def main(
|
|||
main_path: str | None = None,
|
||||
sys_path: Unused = None,
|
||||
) -> None: ...
|
||||
|
||||
def read_signed(fd: int) -> Any: ...
|
||||
def write_signed(fd: int, n: int) -> None: ...
|
||||
|
||||
|
|
|
@ -2,7 +2,17 @@ import queue
|
|||
import sys
|
||||
import threading
|
||||
from _typeshed import SupportsKeysAndGetItem, SupportsRichComparison, SupportsRichComparisonT
|
||||
from collections.abc import Callable, Iterable, Iterator, Mapping, MutableMapping, MutableSequence, Sequence
|
||||
from collections.abc import (
|
||||
Callable,
|
||||
Iterable,
|
||||
Iterator,
|
||||
Mapping,
|
||||
MutableMapping,
|
||||
MutableSequence,
|
||||
MutableSet,
|
||||
Sequence,
|
||||
Set as AbstractSet,
|
||||
)
|
||||
from types import GenericAlias, TracebackType
|
||||
from typing import Any, AnyStr, ClassVar, Generic, SupportsIndex, TypeVar, overload
|
||||
from typing_extensions import Self, TypeAlias
|
||||
|
@ -18,6 +28,7 @@ __all__ = ["BaseManager", "SyncManager", "BaseProxy", "Token", "SharedMemoryMana
|
|||
_T = TypeVar("_T")
|
||||
_KT = TypeVar("_KT")
|
||||
_VT = TypeVar("_VT")
|
||||
_S = TypeVar("_S")
|
||||
|
||||
class Namespace:
|
||||
def __init__(self, **kwds: Any) -> None: ...
|
||||
|
@ -111,6 +122,51 @@ else:
|
|||
def items(self) -> list[tuple[_KT, _VT]]: ... # type: ignore[override]
|
||||
def values(self) -> list[_VT]: ... # type: ignore[override]
|
||||
|
||||
if sys.version_info >= (3, 14):
|
||||
class _BaseSetProxy(BaseProxy, MutableSet[_T]):
|
||||
__builtins__: ClassVar[dict[str, Any]]
|
||||
# Copied from builtins.set
|
||||
def add(self, element: _T, /) -> None: ...
|
||||
def copy(self) -> set[_T]: ...
|
||||
def clear(self) -> None: ...
|
||||
def difference(self, *s: Iterable[Any]) -> set[_T]: ...
|
||||
def difference_update(self, *s: Iterable[Any]) -> None: ...
|
||||
def discard(self, element: _T, /) -> None: ...
|
||||
def intersection(self, *s: Iterable[Any]) -> set[_T]: ...
|
||||
def intersection_update(self, *s: Iterable[Any]) -> None: ...
|
||||
def isdisjoint(self, s: Iterable[Any], /) -> bool: ...
|
||||
def issubset(self, s: Iterable[Any], /) -> bool: ...
|
||||
def issuperset(self, s: Iterable[Any], /) -> bool: ...
|
||||
def pop(self) -> _T: ...
|
||||
def remove(self, element: _T, /) -> None: ...
|
||||
def symmetric_difference(self, s: Iterable[_T], /) -> set[_T]: ...
|
||||
def symmetric_difference_update(self, s: Iterable[_T], /) -> None: ...
|
||||
def union(self, *s: Iterable[_S]) -> set[_T | _S]: ...
|
||||
def update(self, *s: Iterable[_T]) -> None: ...
|
||||
def __len__(self) -> int: ...
|
||||
def __contains__(self, o: object, /) -> bool: ...
|
||||
def __iter__(self) -> Iterator[_T]: ...
|
||||
def __and__(self, value: AbstractSet[object], /) -> set[_T]: ...
|
||||
def __iand__(self, value: AbstractSet[object], /) -> Self: ...
|
||||
def __or__(self, value: AbstractSet[_S], /) -> set[_T | _S]: ...
|
||||
def __ior__(self, value: AbstractSet[_T], /) -> Self: ... # type: ignore[override,misc]
|
||||
def __sub__(self, value: AbstractSet[_T | None], /) -> set[_T]: ...
|
||||
def __isub__(self, value: AbstractSet[object], /) -> Self: ...
|
||||
def __xor__(self, value: AbstractSet[_S], /) -> set[_T | _S]: ...
|
||||
def __ixor__(self, value: AbstractSet[_T], /) -> Self: ... # type: ignore[override,misc]
|
||||
def __le__(self, value: AbstractSet[object], /) -> bool: ...
|
||||
def __lt__(self, value: AbstractSet[object], /) -> bool: ...
|
||||
def __ge__(self, value: AbstractSet[object], /) -> bool: ...
|
||||
def __gt__(self, value: AbstractSet[object], /) -> bool: ...
|
||||
def __eq__(self, value: object, /) -> bool: ...
|
||||
def __rand__(self, value: AbstractSet[object], /) -> set[_T]: ...
|
||||
def __ror__(self, value: AbstractSet[_S], /) -> set[_T | _S]: ... # type: ignore[misc]
|
||||
def __rsub__(self, value: AbstractSet[_T], /) -> set[_T]: ...
|
||||
def __rxor__(self, value: AbstractSet[_S], /) -> set[_T | _S]: ... # type: ignore[misc]
|
||||
def __class_getitem__(cls, item: Any, /) -> GenericAlias: ...
|
||||
|
||||
class SetProxy(_BaseSetProxy[_T]): ...
|
||||
|
||||
class BaseListProxy(BaseProxy, MutableSequence[_T]):
|
||||
__builtins__: ClassVar[dict[str, Any]]
|
||||
def __len__(self) -> int: ...
|
||||
|
@ -273,6 +329,11 @@ class SyncManager(BaseManager):
|
|||
def list(self, sequence: Sequence[_T], /) -> ListProxy[_T]: ...
|
||||
@overload
|
||||
def list(self) -> ListProxy[Any]: ...
|
||||
if sys.version_info >= (3, 14):
|
||||
@overload
|
||||
def set(self, iterable: Iterable[_T], /) -> SetProxy[_T]: ...
|
||||
@overload
|
||||
def set(self) -> SetProxy[Any]: ...
|
||||
|
||||
class RemoteError(Exception): ...
|
||||
|
||||
|
|
|
@ -18,6 +18,9 @@ if sys.platform != "win32":
|
|||
def duplicate_for_child(self, fd: int) -> int: ...
|
||||
def poll(self, flag: int = 1) -> int | None: ...
|
||||
def wait(self, timeout: float | None = None) -> int | None: ...
|
||||
if sys.version_info >= (3, 14):
|
||||
def interrupt(self) -> None: ...
|
||||
|
||||
def terminate(self) -> None: ...
|
||||
def kill(self) -> None: ...
|
||||
def close(self) -> None: ...
|
||||
|
|
|
@ -43,6 +43,7 @@ if sys.platform == "win32":
|
|||
def detach(self) -> int: ...
|
||||
|
||||
else:
|
||||
if sys.version_info < (3, 14):
|
||||
ACKNOWLEDGE: Final[bool]
|
||||
|
||||
def recvfds(sock: socket, size: int) -> list[int]: ...
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
import sys
|
||||
import threading
|
||||
from _typeshed import ConvertibleToInt, Incomplete, Unused
|
||||
from collections.abc import Callable, Iterable, Mapping, MutableMapping, Sequence
|
||||
|
@ -22,14 +23,19 @@ __all__ = [
|
|||
"SUBWARNING",
|
||||
]
|
||||
|
||||
if sys.version_info >= (3, 14):
|
||||
__all__ += ["warn"]
|
||||
|
||||
_T = TypeVar("_T")
|
||||
_R_co = TypeVar("_R_co", default=Any, covariant=True)
|
||||
|
||||
NOTSET: Final[int]
|
||||
SUBDEBUG: Final[int]
|
||||
DEBUG: Final[int]
|
||||
INFO: Final[int]
|
||||
SUBWARNING: Final[int]
|
||||
NOTSET: Final = 0
|
||||
SUBDEBUG: Final = 5
|
||||
DEBUG: Final = 10
|
||||
INFO: Final = 20
|
||||
SUBWARNING: Final = 25
|
||||
if sys.version_info >= (3, 14):
|
||||
WARNING: Final = 30
|
||||
|
||||
LOGGER_NAME: Final[str]
|
||||
DEFAULT_LOGGING_FORMAT: Final[str]
|
||||
|
@ -37,6 +43,10 @@ DEFAULT_LOGGING_FORMAT: Final[str]
|
|||
def sub_debug(msg: object, *args: object) -> None: ...
|
||||
def debug(msg: object, *args: object) -> None: ...
|
||||
def info(msg: object, *args: object) -> None: ...
|
||||
|
||||
if sys.version_info >= (3, 14):
|
||||
def warn(msg: object, *args: object) -> None: ...
|
||||
|
||||
def sub_warning(msg: object, *args: object) -> None: ...
|
||||
def get_logger() -> Logger: ...
|
||||
def log_to_stderr(level: _LoggingLevel | None = None) -> Logger: ...
|
||||
|
|
|
@ -7,7 +7,6 @@
|
|||
# (since type checkers don't see `complex` as a subtype of `numbers.Complex`,
|
||||
# nor `float` as a subtype of `numbers.Real`, etc.)
|
||||
|
||||
from _typeshed import Incomplete
|
||||
from abc import ABCMeta, abstractmethod
|
||||
from typing import ClassVar, Literal, Protocol, overload
|
||||
|
||||
|
@ -166,7 +165,7 @@ class Integral(Rational, _IntegralLike):
|
|||
def __int__(self) -> int: ...
|
||||
def __index__(self) -> int: ...
|
||||
@abstractmethod
|
||||
def __pow__(self, exponent, modulus: Incomplete | None = None) -> _IntegralLike: ...
|
||||
def __pow__(self, exponent, modulus=None) -> _IntegralLike: ...
|
||||
@abstractmethod
|
||||
def __lshift__(self, other) -> _IntegralLike: ...
|
||||
@abstractmethod
|
||||
|
|
|
@ -49,3 +49,5 @@ if sys.version_info >= (3, 11):
|
|||
XML_ERROR_INVALID_ARGUMENT: Final[LiteralString]
|
||||
XML_ERROR_NO_BUFFER: Final[LiteralString]
|
||||
XML_ERROR_AMPLIFICATION_LIMIT_BREACH: Final[LiteralString]
|
||||
if sys.version_info >= (3, 14):
|
||||
XML_ERROR_NOT_STARTED: Final[LiteralString]
|
||||
|
|
|
@ -148,6 +148,8 @@ if sys.platform == "linux":
|
|||
EPOLLWRBAND: int
|
||||
EPOLLWRNORM: int
|
||||
EPOLL_CLOEXEC: int
|
||||
if sys.version_info >= (3, 14):
|
||||
EPOLLWAKEUP: int
|
||||
|
||||
if sys.platform != "linux" and sys.platform != "darwin" and sys.platform != "win32":
|
||||
# Solaris only
|
||||
|
|
|
@ -18,7 +18,6 @@ __all__ = [
|
|||
"rmtree",
|
||||
"Error",
|
||||
"SpecialFileError",
|
||||
"ExecError",
|
||||
"make_archive",
|
||||
"get_archive_formats",
|
||||
"register_archive_format",
|
||||
|
@ -34,6 +33,8 @@ __all__ = [
|
|||
"SameFileError",
|
||||
"disk_usage",
|
||||
]
|
||||
if sys.version_info < (3, 14):
|
||||
__all__ += ["ExecError"]
|
||||
|
||||
_StrOrBytesPathT = TypeVar("_StrOrBytesPathT", bound=StrOrBytesPath)
|
||||
_StrPathT = TypeVar("_StrPathT", bound=StrPath)
|
||||
|
@ -42,7 +43,13 @@ _BytesPathT = TypeVar("_BytesPathT", bound=BytesPath)
|
|||
class Error(OSError): ...
|
||||
class SameFileError(Error): ...
|
||||
class SpecialFileError(OSError): ...
|
||||
|
||||
if sys.version_info >= (3, 14):
|
||||
ExecError = RuntimeError # Deprecated in Python 3.14; removal scheduled for Python 3.16
|
||||
|
||||
else:
|
||||
class ExecError(OSError): ...
|
||||
|
||||
class ReadError(OSError): ...
|
||||
class RegistryError(Exception): ...
|
||||
|
||||
|
|
|
@ -35,6 +35,7 @@ if sys.platform != "win32":
|
|||
_RequestType: TypeAlias = _socket | tuple[bytes, _socket]
|
||||
_AfUnixAddress: TypeAlias = str | ReadableBuffer # address acceptable for an AF_UNIX socket
|
||||
_AfInetAddress: TypeAlias = tuple[str | bytes | bytearray, int] # address acceptable for an AF_INET socket
|
||||
_AfInet6Address: TypeAlias = tuple[str | bytes | bytearray, int, int, int] # address acceptable for an AF_INET6 socket
|
||||
|
||||
# This can possibly be generic at some point:
|
||||
class BaseServer:
|
||||
|
@ -71,10 +72,10 @@ class TCPServer(BaseServer):
|
|||
socket_type: int
|
||||
if sys.version_info >= (3, 11):
|
||||
allow_reuse_port: bool
|
||||
server_address: _AfInetAddress
|
||||
server_address: _AfInetAddress | _AfInet6Address
|
||||
def __init__(
|
||||
self,
|
||||
server_address: _AfInetAddress,
|
||||
server_address: _AfInetAddress | _AfInet6Address,
|
||||
RequestHandlerClass: Callable[[Any, _RetAddress, Self], BaseRequestHandler],
|
||||
bind_and_activate: bool = True,
|
||||
) -> None: ...
|
||||
|
|
|
@ -23,6 +23,8 @@ AT_LOCALE: dict[_NamedIntConstant, _NamedIntConstant]
|
|||
AT_UNICODE: dict[_NamedIntConstant, _NamedIntConstant]
|
||||
CH_LOCALE: dict[_NamedIntConstant, _NamedIntConstant]
|
||||
CH_UNICODE: dict[_NamedIntConstant, _NamedIntConstant]
|
||||
if sys.version_info >= (3, 14):
|
||||
CH_NEGATE: dict[_NamedIntConstant, _NamedIntConstant]
|
||||
# flags
|
||||
if sys.version_info < (3, 13):
|
||||
SRE_FLAG_TEMPLATE: Final = 1
|
||||
|
|
|
@ -32,11 +32,14 @@ whitespace: LiteralString
|
|||
|
||||
def capwords(s: StrOrLiteralStr, sep: StrOrLiteralStr | None = None) -> StrOrLiteralStr: ...
|
||||
|
||||
class Template(metaclass=type):
|
||||
class Template:
|
||||
template: str
|
||||
delimiter: ClassVar[str]
|
||||
idpattern: ClassVar[str]
|
||||
braceidpattern: ClassVar[str | None]
|
||||
if sys.version_info >= (3, 14):
|
||||
flags: ClassVar[RegexFlag | None]
|
||||
else:
|
||||
flags: ClassVar[RegexFlag]
|
||||
pattern: ClassVar[Pattern[str]]
|
||||
def __init__(self, template: str) -> None: ...
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
from collections.abc import Iterator
|
||||
from types import GenericAlias
|
||||
from typing import Any, Literal, final
|
||||
|
||||
__all__ = ["Interpolation", "Template"]
|
||||
|
@ -11,6 +12,7 @@ class Template: # TODO: consider making `Template` generic on `TypeVarTuple`
|
|||
def __new__(cls, *args: str | Interpolation) -> Template: ...
|
||||
def __iter__(self) -> Iterator[str | Interpolation]: ...
|
||||
def __add__(self, other: Template | str) -> Template: ...
|
||||
def __class_getitem__(cls, item: Any, /) -> GenericAlias: ...
|
||||
@property
|
||||
def values(self) -> tuple[Any, ...]: ... # Tuple of interpolation values, which can have any type
|
||||
|
||||
|
@ -26,3 +28,4 @@ class Interpolation:
|
|||
def __new__(
|
||||
cls, value: Any, expression: str, conversion: Literal["a", "r", "s"] | None = None, format_spec: str = ""
|
||||
) -> Interpolation: ...
|
||||
def __class_getitem__(cls, item: Any, /) -> GenericAlias: ...
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import sys
|
||||
from _typeshed import MaybeNone, OptExcInfo, ProfileFunction, TraceFunction, structseq
|
||||
from _typeshed import MaybeNone, OptExcInfo, ProfileFunction, StrOrBytesPath, TraceFunction, structseq
|
||||
from _typeshed.importlib import MetaPathFinderProtocol, PathEntryFinderProtocol
|
||||
from builtins import object as _object
|
||||
from collections.abc import AsyncGenerator, Callable, Sequence
|
||||
|
@ -470,3 +470,7 @@ if sys.version_info >= (3, 12):
|
|||
from . import _monitoring
|
||||
|
||||
monitoring = _monitoring
|
||||
|
||||
if sys.version_info >= (3, 14):
|
||||
def is_remote_debug_enabled() -> bool: ...
|
||||
def remote_exec(pid: int, script: StrOrBytesPath) -> None: ...
|
||||
|
|
|
@ -312,7 +312,7 @@ class Event(Generic[_W_co]):
|
|||
def NoDefaultRoot() -> None: ...
|
||||
|
||||
class Variable:
|
||||
def __init__(self, master: Misc | None = None, value: Incomplete | None = None, name: str | None = None) -> None: ...
|
||||
def __init__(self, master: Misc | None = None, value=None, name: str | None = None) -> None: ...
|
||||
def set(self, value) -> None: ...
|
||||
initialize = set
|
||||
def get(self): ...
|
||||
|
@ -379,7 +379,7 @@ class Misc:
|
|||
children: dict[str, Widget]
|
||||
def destroy(self) -> None: ...
|
||||
def deletecommand(self, name: str) -> None: ...
|
||||
def tk_strictMotif(self, boolean: Incomplete | None = None): ...
|
||||
def tk_strictMotif(self, boolean=None): ...
|
||||
def tk_bisque(self) -> None: ...
|
||||
def tk_setPalette(self, *args, **kw) -> None: ...
|
||||
def wait_variable(self, name: str | Variable = "PY_VAR") -> None: ...
|
||||
|
@ -442,15 +442,15 @@ class Misc:
|
|||
) -> None: ...
|
||||
def option_clear(self) -> None: ...
|
||||
def option_get(self, name, className): ...
|
||||
def option_readfile(self, fileName, priority: Incomplete | None = None) -> None: ...
|
||||
def option_readfile(self, fileName, priority=None) -> None: ...
|
||||
def selection_clear(self, **kw) -> None: ...
|
||||
def selection_get(self, **kw): ...
|
||||
def selection_handle(self, command, **kw) -> None: ...
|
||||
def selection_own(self, **kw) -> None: ...
|
||||
def selection_own_get(self, **kw): ...
|
||||
def send(self, interp, cmd, *args): ...
|
||||
def lower(self, belowThis: Incomplete | None = None) -> None: ...
|
||||
def tkraise(self, aboveThis: Incomplete | None = None) -> None: ...
|
||||
def lower(self, belowThis=None) -> None: ...
|
||||
def tkraise(self, aboveThis=None) -> None: ...
|
||||
lift = tkraise
|
||||
if sys.version_info >= (3, 11):
|
||||
def info_patchlevel(self) -> _VersionInfoType: ...
|
||||
|
@ -888,29 +888,23 @@ class Wm:
|
|||
@overload
|
||||
def wm_geometry(self, newGeometry: str) -> None: ...
|
||||
geometry = wm_geometry
|
||||
def wm_grid(
|
||||
self,
|
||||
baseWidth: Incomplete | None = None,
|
||||
baseHeight: Incomplete | None = None,
|
||||
widthInc: Incomplete | None = None,
|
||||
heightInc: Incomplete | None = None,
|
||||
): ...
|
||||
def wm_grid(self, baseWidth=None, baseHeight=None, widthInc=None, heightInc=None): ...
|
||||
grid = wm_grid
|
||||
def wm_group(self, pathName: Incomplete | None = None): ...
|
||||
def wm_group(self, pathName=None): ...
|
||||
group = wm_group
|
||||
def wm_iconbitmap(self, bitmap: Incomplete | None = None, default: Incomplete | None = None): ...
|
||||
def wm_iconbitmap(self, bitmap=None, default=None): ...
|
||||
iconbitmap = wm_iconbitmap
|
||||
def wm_iconify(self) -> None: ...
|
||||
iconify = wm_iconify
|
||||
def wm_iconmask(self, bitmap: Incomplete | None = None): ...
|
||||
def wm_iconmask(self, bitmap=None): ...
|
||||
iconmask = wm_iconmask
|
||||
def wm_iconname(self, newName: Incomplete | None = None) -> str: ...
|
||||
def wm_iconname(self, newName=None) -> str: ...
|
||||
iconname = wm_iconname
|
||||
def wm_iconphoto(self, default: bool, image1: _PhotoImageLike | str, /, *args: _PhotoImageLike | str) -> None: ...
|
||||
iconphoto = wm_iconphoto
|
||||
def wm_iconposition(self, x: int | None = None, y: int | None = None) -> tuple[int, int] | None: ...
|
||||
iconposition = wm_iconposition
|
||||
def wm_iconwindow(self, pathName: Incomplete | None = None): ...
|
||||
def wm_iconwindow(self, pathName=None): ...
|
||||
iconwindow = wm_iconwindow
|
||||
def wm_manage(self, widget) -> None: ...
|
||||
manage = wm_manage
|
||||
|
@ -1027,7 +1021,7 @@ class Tk(Misc, Wm):
|
|||
def globalgetvar(self, *args, **kwargs): ...
|
||||
def globalsetvar(self, *args, **kwargs): ...
|
||||
def globalunsetvar(self, *args, **kwargs): ...
|
||||
def interpaddr(self): ...
|
||||
def interpaddr(self) -> int: ...
|
||||
def loadtk(self) -> None: ...
|
||||
def record(self, script, /): ...
|
||||
if sys.version_info < (3, 11):
|
||||
|
@ -1453,8 +1447,8 @@ class Canvas(Widget, XView, YView):
|
|||
@overload
|
||||
def tag_bind(self, tagOrId: str | int, *, func: str, add: Literal["", "+"] | bool | None = None) -> None: ...
|
||||
def tag_unbind(self, tagOrId: str | int, sequence: str, funcid: str | None = None) -> None: ...
|
||||
def canvasx(self, screenx, gridspacing: Incomplete | None = None): ...
|
||||
def canvasy(self, screeny, gridspacing: Incomplete | None = None): ...
|
||||
def canvasx(self, screenx, gridspacing=None): ...
|
||||
def canvasy(self, screeny, gridspacing=None): ...
|
||||
@overload
|
||||
def coords(self, tagOrId: str | int, /) -> list[float]: ...
|
||||
@overload
|
||||
|
@ -2462,7 +2456,7 @@ class Listbox(Widget, XView, YView):
|
|||
select_set = selection_set
|
||||
def size(self) -> int: ... # type: ignore[override]
|
||||
def itemcget(self, index: str | int, option): ...
|
||||
def itemconfigure(self, index: str | int, cnf: Incomplete | None = None, **kw): ...
|
||||
def itemconfigure(self, index: str | int, cnf=None, **kw): ...
|
||||
itemconfig = itemconfigure
|
||||
|
||||
class Menu(Widget):
|
||||
|
@ -3142,7 +3136,7 @@ class Scrollbar(Widget):
|
|||
@overload
|
||||
def configure(self, cnf: str) -> tuple[str, str, str, Any, Any]: ...
|
||||
config = configure
|
||||
def activate(self, index: Incomplete | None = None): ...
|
||||
def activate(self, index=None): ...
|
||||
def delta(self, deltax: int, deltay: int) -> float: ...
|
||||
def fraction(self, x: int, y: int) -> float: ...
|
||||
def identify(self, x: int, y: int) -> Literal["arrow1", "arrow2", "slider", "trough1", "trough2", ""]: ...
|
||||
|
@ -3625,7 +3619,7 @@ class Text(Widget, XView, YView):
|
|||
def yview_pickplace(self, *what): ... # deprecated
|
||||
|
||||
class _setit:
|
||||
def __init__(self, var, value, callback: Incomplete | None = None) -> None: ...
|
||||
def __init__(self, var, value, callback=None) -> None: ...
|
||||
def __call__(self, *args) -> None: ...
|
||||
|
||||
# manual page: tk_optionMenu
|
||||
|
@ -3663,9 +3657,7 @@ class _PhotoImageLike(_Image): ...
|
|||
class Image(_Image):
|
||||
name: Incomplete
|
||||
tk: _tkinter.TkappType
|
||||
def __init__(
|
||||
self, imgtype, name: Incomplete | None = None, cnf={}, master: Misc | _tkinter.TkappType | None = None, **kw
|
||||
) -> None: ...
|
||||
def __init__(self, imgtype, name=None, cnf={}, master: Misc | _tkinter.TkappType | None = None, **kw) -> None: ...
|
||||
def __del__(self) -> None: ...
|
||||
def __setitem__(self, key, value) -> None: ...
|
||||
def __getitem__(self, key): ...
|
||||
|
@ -3791,7 +3783,7 @@ class BitmapImage(Image, _BitmapImageLike):
|
|||
# This should be kept in sync with PIL.ImageTK.BitmapImage.__init__()
|
||||
def __init__(
|
||||
self,
|
||||
name: Incomplete | None = None,
|
||||
name=None,
|
||||
cnf: dict[str, Any] = {},
|
||||
master: Misc | _tkinter.TkappType | None = None,
|
||||
*,
|
||||
|
@ -3925,7 +3917,7 @@ class Spinbox(Widget, XView):
|
|||
def configure(self, cnf: str) -> tuple[str, str, str, Any, Any]: ...
|
||||
config = configure
|
||||
def bbox(self, index) -> tuple[int, int, int, int] | None: ... # type: ignore[override]
|
||||
def delete(self, first, last: Incomplete | None = None) -> Literal[""]: ...
|
||||
def delete(self, first, last=None) -> Literal[""]: ...
|
||||
def get(self) -> str: ...
|
||||
def icursor(self, index): ...
|
||||
def identify(self, x: int, y: int) -> Literal["", "buttondown", "buttonup", "entry"]: ...
|
||||
|
@ -3939,7 +3931,7 @@ class Spinbox(Widget, XView):
|
|||
def selection(self, *args) -> tuple[int, ...]: ...
|
||||
def selection_adjust(self, index): ...
|
||||
def selection_clear(self): ... # type: ignore[override]
|
||||
def selection_element(self, element: Incomplete | None = None): ...
|
||||
def selection_element(self, element=None): ...
|
||||
def selection_from(self, index: int) -> None: ...
|
||||
def selection_present(self) -> None: ...
|
||||
def selection_range(self, start: int, end: int) -> None: ...
|
||||
|
@ -4082,7 +4074,7 @@ class PanedWindow(Widget):
|
|||
def sash_mark(self, index): ...
|
||||
def sash_place(self, index, x, y): ...
|
||||
def panecget(self, child, option): ...
|
||||
def paneconfigure(self, tagOrId, cnf: Incomplete | None = None, **kw): ...
|
||||
def paneconfigure(self, tagOrId, cnf=None, **kw): ...
|
||||
paneconfig: Incomplete
|
||||
def panes(self): ...
|
||||
|
||||
|
|
|
@ -8,5 +8,5 @@ class Dialog:
|
|||
command: ClassVar[str | None]
|
||||
master: Incomplete | None
|
||||
options: Mapping[str, Incomplete]
|
||||
def __init__(self, master: Incomplete | None = None, **options) -> None: ...
|
||||
def __init__(self, master=None, **options) -> None: ...
|
||||
def show(self, **options): ...
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
from _typeshed import Incomplete
|
||||
from collections.abc import Mapping
|
||||
from tkinter import Widget
|
||||
from typing import Any, Final
|
||||
|
@ -10,5 +9,5 @@ DIALOG_ICON: Final = "questhead"
|
|||
class Dialog(Widget):
|
||||
widgetName: str
|
||||
num: int
|
||||
def __init__(self, master: Incomplete | None = None, cnf: Mapping[str, Any] = {}, **kw) -> None: ...
|
||||
def __init__(self, master=None, cnf: Mapping[str, Any] = {}, **kw) -> None: ...
|
||||
def destroy(self) -> None: ...
|
||||
|
|
|
@ -38,21 +38,21 @@ class FileDialog:
|
|||
filter_button: Button
|
||||
cancel_button: Button
|
||||
def __init__(
|
||||
self, master, title: Incomplete | None = None
|
||||
self, master, title=None
|
||||
) -> None: ... # title is usually a str or None, but e.g. int doesn't raise en exception either
|
||||
how: Incomplete | None
|
||||
def go(self, dir_or_file=".", pattern: str = "*", default: str = "", key: Incomplete | None = None): ...
|
||||
def quit(self, how: Incomplete | None = None) -> None: ...
|
||||
def go(self, dir_or_file=".", pattern: str = "*", default: str = "", key=None): ...
|
||||
def quit(self, how=None) -> None: ...
|
||||
def dirs_double_event(self, event) -> None: ...
|
||||
def dirs_select_event(self, event) -> None: ...
|
||||
def files_double_event(self, event) -> None: ...
|
||||
def files_select_event(self, event) -> None: ...
|
||||
def ok_event(self, event) -> None: ...
|
||||
def ok_command(self) -> None: ...
|
||||
def filter_command(self, event: Incomplete | None = None) -> None: ...
|
||||
def filter_command(self, event=None) -> None: ...
|
||||
def get_filter(self): ...
|
||||
def get_selection(self): ...
|
||||
def cancel_command(self, event: Incomplete | None = None) -> None: ...
|
||||
def cancel_command(self, event=None) -> None: ...
|
||||
def set_filter(self, dir, pat) -> None: ...
|
||||
def set_selection(self, file) -> None: ...
|
||||
|
||||
|
|
|
@ -35,7 +35,7 @@ __all__ = [
|
|||
]
|
||||
|
||||
def tclobjs_to_py(adict: dict[Any, Any]) -> dict[Any, Any]: ...
|
||||
def setup_master(master: Incomplete | None = None): ...
|
||||
def setup_master(master=None): ...
|
||||
|
||||
_Padding: TypeAlias = (
|
||||
tkinter._ScreenUnits
|
||||
|
@ -52,14 +52,14 @@ class Style:
|
|||
master: Incomplete
|
||||
tk: _tkinter.TkappType
|
||||
def __init__(self, master: tkinter.Misc | None = None) -> None: ...
|
||||
def configure(self, style, query_opt: Incomplete | None = None, **kw): ...
|
||||
def map(self, style, query_opt: Incomplete | None = None, **kw): ...
|
||||
def lookup(self, style, option, state: Incomplete | None = None, default: Incomplete | None = None): ...
|
||||
def layout(self, style, layoutspec: Incomplete | None = None): ...
|
||||
def configure(self, style, query_opt=None, **kw): ...
|
||||
def map(self, style, query_opt=None, **kw): ...
|
||||
def lookup(self, style, option, state=None, default=None): ...
|
||||
def layout(self, style, layoutspec=None): ...
|
||||
def element_create(self, elementname, etype, *args, **kw) -> None: ...
|
||||
def element_names(self): ...
|
||||
def element_options(self, elementname): ...
|
||||
def theme_create(self, themename, parent: Incomplete | None = None, settings: Incomplete | None = None) -> None: ...
|
||||
def theme_create(self, themename, parent=None, settings=None) -> None: ...
|
||||
def theme_settings(self, themename, settings) -> None: ...
|
||||
def theme_names(self) -> tuple[str, ...]: ...
|
||||
@overload
|
||||
|
@ -68,10 +68,10 @@ class Style:
|
|||
def theme_use(self, themename: None = None) -> str: ...
|
||||
|
||||
class Widget(tkinter.Widget):
|
||||
def __init__(self, master: tkinter.Misc | None, widgetname, kw: Incomplete | None = None) -> None: ...
|
||||
def __init__(self, master: tkinter.Misc | None, widgetname, kw=None) -> None: ...
|
||||
def identify(self, x: int, y: int) -> str: ...
|
||||
def instate(self, statespec, callback: Incomplete | None = None, *args, **kw): ...
|
||||
def state(self, statespec: Incomplete | None = None): ...
|
||||
def instate(self, statespec, callback=None, *args, **kw): ...
|
||||
def state(self, statespec=None): ...
|
||||
|
||||
class Button(Widget):
|
||||
def __init__(
|
||||
|
@ -567,8 +567,8 @@ class Notebook(Widget):
|
|||
def identify(self, x: int, y: int) -> str: ...
|
||||
def index(self, tab_id): ...
|
||||
def insert(self, pos, child, **kw) -> None: ...
|
||||
def select(self, tab_id: Incomplete | None = None): ...
|
||||
def tab(self, tab_id, option: Incomplete | None = None, **kw): ...
|
||||
def select(self, tab_id=None): ...
|
||||
def tab(self, tab_id, option=None, **kw): ...
|
||||
def tabs(self): ...
|
||||
def enable_traversal(self) -> None: ...
|
||||
|
||||
|
@ -617,8 +617,8 @@ class Panedwindow(Widget, tkinter.PanedWindow):
|
|||
def config(self, cnf: str) -> tuple[str, str, str, Any, Any]: ...
|
||||
forget: Incomplete
|
||||
def insert(self, pos, child, **kw) -> None: ...
|
||||
def pane(self, pane, option: Incomplete | None = None, **kw): ...
|
||||
def sashpos(self, index, newpos: Incomplete | None = None): ...
|
||||
def pane(self, pane, option=None, **kw): ...
|
||||
def sashpos(self, index, newpos=None): ...
|
||||
|
||||
PanedWindow = Panedwindow
|
||||
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
import sys
|
||||
from collections.abc import Callable, Sequence
|
||||
from _typeshed import StrPath
|
||||
from collections.abc import Callable, Generator, Sequence
|
||||
from contextlib import contextmanager
|
||||
from tkinter import Canvas, Frame, Misc, PhotoImage, Scrollbar
|
||||
from typing import Any, ClassVar, Literal, TypedDict, overload
|
||||
from typing_extensions import Self, TypeAlias
|
||||
|
@ -128,6 +130,9 @@ __all__ = [
|
|||
"Terminator",
|
||||
]
|
||||
|
||||
if sys.version_info >= (3, 14):
|
||||
__all__ += ["fill", "no_animation", "poly", "save"]
|
||||
|
||||
if sys.version_info >= (3, 12):
|
||||
__all__ += ["teleport"]
|
||||
|
||||
|
@ -231,6 +236,10 @@ class TurtleScreen(TurtleScreenBase):
|
|||
def delay(self, delay: None = None) -> int: ...
|
||||
@overload
|
||||
def delay(self, delay: int) -> None: ...
|
||||
if sys.version_info >= (3, 14):
|
||||
@contextmanager
|
||||
def no_animation(self) -> Generator[None]: ...
|
||||
|
||||
def update(self) -> None: ...
|
||||
def window_width(self) -> int: ...
|
||||
def window_height(self) -> int: ...
|
||||
|
@ -249,6 +258,8 @@ class TurtleScreen(TurtleScreenBase):
|
|||
# Looks like if self.cv is not a ScrolledCanvas, this could return a tuple as well
|
||||
@overload
|
||||
def screensize(self, canvwidth: int, canvheight: int, bg: _Color | None = None) -> None: ...
|
||||
if sys.version_info >= (3, 14):
|
||||
def save(self, filename: StrPath, *, overwrite: bool = False) -> None: ...
|
||||
onscreenclick = onclick
|
||||
resetscreen = reset
|
||||
clearscreen = clear
|
||||
|
@ -428,12 +439,20 @@ class RawTurtle(TPen, TNavigator): # type: ignore[misc] # Conflicting methods
|
|||
def clearstamp(self, stampid: int | tuple[int, ...]) -> None: ...
|
||||
def clearstamps(self, n: int | None = None) -> None: ...
|
||||
def filling(self) -> bool: ...
|
||||
if sys.version_info >= (3, 14):
|
||||
@contextmanager
|
||||
def fill(self) -> Generator[None]: ...
|
||||
|
||||
def begin_fill(self) -> None: ...
|
||||
def end_fill(self) -> None: ...
|
||||
def dot(self, size: int | None = None, *color: _Color) -> None: ...
|
||||
def write(
|
||||
self, arg: object, move: bool = False, align: str = "left", font: tuple[str, int, str] = ("Arial", 8, "normal")
|
||||
) -> None: ...
|
||||
if sys.version_info >= (3, 14):
|
||||
@contextmanager
|
||||
def poly(self) -> Generator[None]: ...
|
||||
|
||||
def begin_poly(self) -> None: ...
|
||||
def end_poly(self) -> None: ...
|
||||
def get_poly(self) -> _PolygonCoords | None: ...
|
||||
|
@ -516,6 +535,11 @@ def tracer(n: int, delay: int | None = None) -> None: ...
|
|||
def delay(delay: None = None) -> int: ...
|
||||
@overload
|
||||
def delay(delay: int) -> None: ...
|
||||
|
||||
if sys.version_info >= (3, 14):
|
||||
@contextmanager
|
||||
def no_animation() -> Generator[None]: ...
|
||||
|
||||
def update() -> None: ...
|
||||
def window_width() -> int: ...
|
||||
def window_height() -> int: ...
|
||||
|
@ -534,6 +558,9 @@ def screensize(canvwidth: None = None, canvheight: None = None, bg: None = None)
|
|||
@overload
|
||||
def screensize(canvwidth: int, canvheight: int, bg: _Color | None = None) -> None: ...
|
||||
|
||||
if sys.version_info >= (3, 14):
|
||||
def save(filename: StrPath, *, overwrite: bool = False) -> None: ...
|
||||
|
||||
onscreenclick = onclick
|
||||
resetscreen = reset
|
||||
clearscreen = clear
|
||||
|
@ -705,10 +732,20 @@ def stamp() -> Any: ...
|
|||
def clearstamp(stampid: int | tuple[int, ...]) -> None: ...
|
||||
def clearstamps(n: int | None = None) -> None: ...
|
||||
def filling() -> bool: ...
|
||||
|
||||
if sys.version_info >= (3, 14):
|
||||
@contextmanager
|
||||
def fill() -> Generator[None]: ...
|
||||
|
||||
def begin_fill() -> None: ...
|
||||
def end_fill() -> None: ...
|
||||
def dot(size: int | None = None, *color: _Color) -> None: ...
|
||||
def write(arg: object, move: bool = False, align: str = "left", font: tuple[str, int, str] = ("Arial", 8, "normal")) -> None: ...
|
||||
|
||||
if sys.version_info >= (3, 14):
|
||||
@contextmanager
|
||||
def poly() -> Generator[None]: ...
|
||||
|
||||
def begin_poly() -> None: ...
|
||||
def end_poly() -> None: ...
|
||||
def get_poly() -> _PolygonCoords | None: ...
|
||||
|
|
|
@ -151,7 +151,7 @@ class CodeType:
|
|||
def co_firstlineno(self) -> int: ...
|
||||
if sys.version_info >= (3, 10):
|
||||
@property
|
||||
@deprecated("Will be removed in Python 3.14. Use the co_lines() method instead.")
|
||||
@deprecated("Will be removed in Python 3.15. Use the co_lines() method instead.")
|
||||
def co_lnotab(self) -> bytes: ...
|
||||
else:
|
||||
@property
|
||||
|
@ -171,6 +171,8 @@ class CodeType:
|
|||
@property
|
||||
def co_qualname(self) -> str: ...
|
||||
def co_positions(self) -> Iterable[tuple[int | None, int | None, int | None, int | None]]: ...
|
||||
if sys.version_info >= (3, 14):
|
||||
def co_branches(self) -> Iterator[tuple[int, int, int]]: ...
|
||||
|
||||
if sys.version_info >= (3, 11):
|
||||
def __new__(
|
||||
|
@ -480,6 +482,10 @@ class MethodType:
|
|||
def __qualname__(self) -> str: ... # inherited from the added function
|
||||
def __new__(cls, func: Callable[..., Any], instance: object, /) -> Self: ...
|
||||
def __call__(self, *args: Any, **kwargs: Any) -> Any: ...
|
||||
|
||||
if sys.version_info >= (3, 13):
|
||||
def __get__(self, instance: object, owner: type | None = None, /) -> Self: ...
|
||||
|
||||
def __eq__(self, value: object, /) -> bool: ...
|
||||
def __hash__(self) -> int: ...
|
||||
|
||||
|
@ -580,6 +586,9 @@ class FrameType:
|
|||
f_trace_lines: bool
|
||||
f_trace_opcodes: bool
|
||||
def clear(self) -> None: ...
|
||||
if sys.version_info >= (3, 14):
|
||||
@property
|
||||
def f_generator(self) -> GeneratorType[Any, Any, Any] | CoroutineType[Any, Any, Any] | None: ...
|
||||
|
||||
@final
|
||||
class GetSetDescriptorType:
|
||||
|
|
|
@ -797,11 +797,15 @@ class MutableMapping(Mapping[_KT, _VT]):
|
|||
# -- weakref.WeakValueDictionary.__ior__
|
||||
# -- weakref.WeakKeyDictionary.__ior__
|
||||
@overload
|
||||
def update(self, m: SupportsKeysAndGetItem[_KT, _VT], /, **kwargs: _VT) -> None: ...
|
||||
def update(self, m: SupportsKeysAndGetItem[_KT, _VT], /) -> None: ...
|
||||
@overload
|
||||
def update(self, m: Iterable[tuple[_KT, _VT]], /, **kwargs: _VT) -> None: ...
|
||||
def update(self: Mapping[str, _VT], m: SupportsKeysAndGetItem[str, _VT], /, **kwargs: _VT) -> None: ...
|
||||
@overload
|
||||
def update(self, **kwargs: _VT) -> None: ...
|
||||
def update(self, m: Iterable[tuple[_KT, _VT]], /) -> None: ...
|
||||
@overload
|
||||
def update(self: Mapping[str, _VT], m: Iterable[tuple[str, _VT]], /, **kwargs: _VT) -> None: ...
|
||||
@overload
|
||||
def update(self: Mapping[str, _VT], **kwargs: _VT) -> None: ...
|
||||
|
||||
Text = str
|
||||
|
||||
|
|
|
@ -110,6 +110,8 @@ __all__ = [
|
|||
"SupportsIndex",
|
||||
"SupportsInt",
|
||||
"SupportsRound",
|
||||
"Reader",
|
||||
"Writer",
|
||||
# One-off things.
|
||||
"Annotated",
|
||||
"assert_never",
|
||||
|
@ -136,6 +138,7 @@ __all__ = [
|
|||
"overload",
|
||||
"override",
|
||||
"Protocol",
|
||||
"Sentinel",
|
||||
"reveal_type",
|
||||
"runtime",
|
||||
"runtime_checkable",
|
||||
|
@ -199,6 +202,7 @@ _T = _TypeVar("_T")
|
|||
_F = _TypeVar("_F", bound=Callable[..., Any])
|
||||
_TC = _TypeVar("_TC", bound=type[object])
|
||||
_T_co = _TypeVar("_T_co", covariant=True) # Any type covariant containers.
|
||||
_T_contra = _TypeVar("_T_contra", contravariant=True)
|
||||
|
||||
class _Final: ... # This should be imported from typing but that breaks pytype
|
||||
|
||||
|
@ -446,6 +450,19 @@ else:
|
|||
@abc.abstractmethod
|
||||
def __round__(self, ndigits: int, /) -> _T_co: ...
|
||||
|
||||
if sys.version_info >= (3, 14):
|
||||
from io import Reader as Reader, Writer as Writer
|
||||
else:
|
||||
@runtime_checkable
|
||||
class Reader(Protocol[_T_co]):
|
||||
@abc.abstractmethod
|
||||
def read(self, size: int = ..., /) -> _T_co: ...
|
||||
|
||||
@runtime_checkable
|
||||
class Writer(Protocol[_T_contra]):
|
||||
@abc.abstractmethod
|
||||
def write(self, data: _T_contra, /) -> int: ...
|
||||
|
||||
if sys.version_info >= (3, 13):
|
||||
from types import CapsuleType as CapsuleType
|
||||
from typing import (
|
||||
|
@ -670,6 +687,16 @@ else:
|
|||
globals: Mapping[str, Any] | None = None, # value types depend on the key
|
||||
locals: Mapping[str, Any] | None = None, # value types depend on the key
|
||||
type_params: Iterable[TypeVar | ParamSpec | TypeVarTuple] | None = None,
|
||||
format: Format = Format.VALUE, # noqa: Y011
|
||||
format: Format | None = None,
|
||||
_recursive_guard: Container[str] = ...,
|
||||
) -> AnnotationForm: ...
|
||||
|
||||
# PEP 661
|
||||
class Sentinel:
|
||||
def __init__(self, name: str, repr: str | None = None) -> None: ...
|
||||
if sys.version_info >= (3, 14):
|
||||
def __or__(self, other: Any) -> UnionType: ... # other can be any type form legal for unions
|
||||
def __ror__(self, other: Any) -> UnionType: ... # other can be any type form legal for unions
|
||||
else:
|
||||
def __or__(self, other: Any) -> _SpecialForm: ... # other can be any type form legal for unions
|
||||
def __ror__(self, other: Any) -> _SpecialForm: ... # other can be any type form legal for unions
|
||||
|
|
|
@ -13,12 +13,22 @@ if sys.platform == "win32":
|
|||
SND_NODEFAULT: Final = 2
|
||||
SND_NOSTOP: Final = 16
|
||||
SND_NOWAIT: Final = 8192
|
||||
if sys.version_info >= (3, 14):
|
||||
SND_SENTRY: Final = 524288
|
||||
SND_SYNC: Final = 0
|
||||
SND_SYSTEM: Final = 2097152
|
||||
|
||||
MB_ICONASTERISK: Final = 64
|
||||
MB_ICONEXCLAMATION: Final = 48
|
||||
MB_ICONHAND: Final = 16
|
||||
MB_ICONQUESTION: Final = 32
|
||||
MB_OK: Final = 0
|
||||
if sys.version_info >= (3, 14):
|
||||
MB_ICONERROR: Final = 16
|
||||
MB_ICONINFORMATION: Final = 64
|
||||
MB_ICONSTOP: Final = 16
|
||||
MB_ICONWARNING: Final = 48
|
||||
|
||||
def Beep(frequency: int, duration: int) -> None: ...
|
||||
# Can actually accept anything ORed with 4, and if not it's definitely str, but that's inexpressible
|
||||
@overload
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
import sys
|
||||
from _typeshed import ReadableBuffer, StrPath, SupportsRead, _T_co
|
||||
from collections.abc import Iterable
|
||||
from typing import Protocol
|
||||
|
@ -10,7 +11,7 @@ from xml.sax._exceptions import (
|
|||
SAXReaderNotAvailable as SAXReaderNotAvailable,
|
||||
)
|
||||
from xml.sax.handler import ContentHandler as ContentHandler, ErrorHandler as ErrorHandler
|
||||
from xml.sax.xmlreader import XMLReader
|
||||
from xml.sax.xmlreader import InputSource as InputSource, XMLReader
|
||||
|
||||
class _SupportsReadClose(SupportsRead[_T_co], Protocol[_T_co]):
|
||||
def close(self) -> None: ...
|
||||
|
@ -23,3 +24,19 @@ def make_parser(parser_list: Iterable[str] = ()) -> XMLReader: ...
|
|||
def parse(source: _Source, handler: ContentHandler, errorHandler: ErrorHandler = ...) -> None: ...
|
||||
def parseString(string: ReadableBuffer | str, handler: ContentHandler, errorHandler: ErrorHandler | None = ...) -> None: ...
|
||||
def _create_parser(parser_name: str) -> XMLReader: ...
|
||||
|
||||
if sys.version_info >= (3, 14):
|
||||
__all__ = [
|
||||
"ContentHandler",
|
||||
"ErrorHandler",
|
||||
"InputSource",
|
||||
"SAXException",
|
||||
"SAXNotRecognizedException",
|
||||
"SAXNotSupportedException",
|
||||
"SAXParseException",
|
||||
"SAXReaderNotAvailable",
|
||||
"default_parser_list",
|
||||
"make_parser",
|
||||
"parse",
|
||||
"parseString",
|
||||
]
|
||||
|
|
|
@ -24,6 +24,9 @@ __all__ = [
|
|||
"LargeZipFile",
|
||||
]
|
||||
|
||||
if sys.version_info >= (3, 14):
|
||||
__all__ += ["ZIP_ZSTANDARD"]
|
||||
|
||||
# TODO: use TypeAlias for these two when mypy bugs are fixed
|
||||
# https://github.com/python/mypy/issues/16581
|
||||
_DateTuple = tuple[int, int, int, int, int, int] # noqa: Y026
|
||||
|
@ -251,6 +254,9 @@ class ZipFile:
|
|||
) -> None: ...
|
||||
if sys.version_info >= (3, 11):
|
||||
def mkdir(self, zinfo_or_directory_name: str | ZipInfo, mode: int = 0o777) -> None: ...
|
||||
if sys.version_info >= (3, 14):
|
||||
@property
|
||||
def data_offset(self) -> int | None: ...
|
||||
|
||||
def __del__(self) -> None: ...
|
||||
|
||||
|
@ -361,10 +367,21 @@ else:
|
|||
|
||||
def is_zipfile(filename: StrOrBytesPath | _SupportsReadSeekTell) -> bool: ...
|
||||
|
||||
ZIP_STORED: Final[int]
|
||||
ZIP_DEFLATED: Final[int]
|
||||
ZIP64_LIMIT: Final[int]
|
||||
ZIP_FILECOUNT_LIMIT: Final[int]
|
||||
ZIP_MAX_COMMENT: Final[int]
|
||||
ZIP_BZIP2: Final[int]
|
||||
ZIP_LZMA: Final[int]
|
||||
|
||||
ZIP_STORED: Final = 0
|
||||
ZIP_DEFLATED: Final = 8
|
||||
ZIP_BZIP2: Final = 12
|
||||
ZIP_LZMA: Final = 14
|
||||
if sys.version_info >= (3, 14):
|
||||
ZIP_ZSTANDARD: Final = 93
|
||||
|
||||
DEFAULT_VERSION: Final[int]
|
||||
ZIP64_VERSION: Final[int]
|
||||
BZIP2_VERSION: Final[int]
|
||||
LZMA_VERSION: Final[int]
|
||||
if sys.version_info >= (3, 14):
|
||||
ZSTANDARD_VERSION: Final[int]
|
||||
MAX_EXTRACT_VERSION: Final[int]
|
||||
|
|
|
@ -1,10 +1,14 @@
|
|||
import sys
|
||||
from _typeshed import StrOrBytesPath
|
||||
from importlib.abc import ResourceReader
|
||||
from importlib.machinery import ModuleSpec
|
||||
from types import CodeType, ModuleType
|
||||
from typing_extensions import deprecated
|
||||
|
||||
if sys.version_info >= (3, 10):
|
||||
from importlib.readers import ZipReader
|
||||
else:
|
||||
from importlib.abc import ResourceReader
|
||||
|
||||
if sys.version_info >= (3, 10):
|
||||
from _frozen_importlib_external import _LoaderBasics
|
||||
else:
|
||||
|
@ -29,7 +33,13 @@ class zipimporter(_LoaderBasics):
|
|||
def get_code(self, fullname: str) -> CodeType: ...
|
||||
def get_data(self, pathname: str) -> bytes: ...
|
||||
def get_filename(self, fullname: str) -> str: ...
|
||||
if sys.version_info >= (3, 14):
|
||||
def get_resource_reader(self, fullname: str) -> ZipReader: ... # undocumented
|
||||
elif sys.version_info >= (3, 10):
|
||||
def get_resource_reader(self, fullname: str) -> ZipReader | None: ... # undocumented
|
||||
else:
|
||||
def get_resource_reader(self, fullname: str) -> ResourceReader | None: ... # undocumented
|
||||
|
||||
def get_source(self, fullname: str) -> str | None: ...
|
||||
def is_package(self, fullname: str) -> bool: ...
|
||||
@deprecated("Deprecated since 3.10; use exec_module() instead")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue