mirror of https://github.com/astral-sh/ruff
[ty] Sync vendored typeshed stubs (#19060)
Close and reopen this PR to trigger CI Co-authored-by: typeshedbot <>
This commit is contained in:
parent
77941af1c6
commit
966adca6f6
|
|
@ -1 +1 @@
|
||||||
ecd5141cc036366cc9e3ca371096d6a14b0ccd13
|
3f727b0cd6620b7fca45318dd34542b1e1c7dbfb
|
||||||
|
|
|
||||||
|
|
@ -95,6 +95,7 @@ asyncio.staggered: 3.8-
|
||||||
asyncio.taskgroups: 3.11-
|
asyncio.taskgroups: 3.11-
|
||||||
asyncio.threads: 3.9-
|
asyncio.threads: 3.9-
|
||||||
asyncio.timeouts: 3.11-
|
asyncio.timeouts: 3.11-
|
||||||
|
asyncio.tools: 3.14-
|
||||||
asyncio.trsock: 3.8-
|
asyncio.trsock: 3.8-
|
||||||
asyncore: 3.0-3.11
|
asyncore: 3.0-3.11
|
||||||
atexit: 3.0-
|
atexit: 3.0-
|
||||||
|
|
|
||||||
|
|
@ -90,6 +90,7 @@ else:
|
||||||
|
|
||||||
def writer(
|
def writer(
|
||||||
csvfile: SupportsWrite[str],
|
csvfile: SupportsWrite[str],
|
||||||
|
/,
|
||||||
dialect: _DialectLike = "excel",
|
dialect: _DialectLike = "excel",
|
||||||
*,
|
*,
|
||||||
delimiter: str = ",",
|
delimiter: str = ",",
|
||||||
|
|
@ -103,6 +104,7 @@ def writer(
|
||||||
) -> _writer: ...
|
) -> _writer: ...
|
||||||
def reader(
|
def reader(
|
||||||
csvfile: Iterable[str],
|
csvfile: Iterable[str],
|
||||||
|
/,
|
||||||
dialect: _DialectLike = "excel",
|
dialect: _DialectLike = "excel",
|
||||||
*,
|
*,
|
||||||
delimiter: str = ",",
|
delimiter: str = ",",
|
||||||
|
|
|
||||||
|
|
@ -52,6 +52,7 @@ class ZstdCompressor:
|
||||||
self, /, data: ReadableBuffer, mode: _ZstdCompressorContinue | _ZstdCompressorFlushBlock | _ZstdCompressorFlushFrame = 0
|
self, /, data: ReadableBuffer, mode: _ZstdCompressorContinue | _ZstdCompressorFlushBlock | _ZstdCompressorFlushFrame = 0
|
||||||
) -> bytes: ...
|
) -> bytes: ...
|
||||||
def flush(self, /, mode: _ZstdCompressorFlushBlock | _ZstdCompressorFlushFrame = 2) -> bytes: ...
|
def flush(self, /, mode: _ZstdCompressorFlushBlock | _ZstdCompressorFlushFrame = 2) -> bytes: ...
|
||||||
|
def set_pledged_input_size(self, size: int | None, /) -> None: ...
|
||||||
@property
|
@property
|
||||||
def last_mode(self) -> _ZstdCompressorContinue | _ZstdCompressorFlushBlock | _ZstdCompressorFlushFrame: ...
|
def last_mode(self) -> _ZstdCompressorContinue | _ZstdCompressorFlushBlock | _ZstdCompressorFlushFrame: ...
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,4 @@
|
||||||
|
import ast
|
||||||
import builtins
|
import builtins
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
|
|
@ -623,21 +624,6 @@ class AsyncWith(stmt):
|
||||||
**kwargs: Unpack[_Attributes],
|
**kwargs: Unpack[_Attributes],
|
||||||
) -> Self: ...
|
) -> Self: ...
|
||||||
|
|
||||||
if sys.version_info >= (3, 10):
|
|
||||||
class Match(stmt):
|
|
||||||
__match_args__ = ("subject", "cases")
|
|
||||||
subject: expr
|
|
||||||
cases: list[match_case]
|
|
||||||
if sys.version_info >= (3, 13):
|
|
||||||
def __init__(self, subject: expr, cases: list[match_case] = ..., **kwargs: Unpack[_Attributes]) -> None: ...
|
|
||||||
else:
|
|
||||||
def __init__(self, subject: expr, cases: list[match_case], **kwargs: Unpack[_Attributes]) -> None: ...
|
|
||||||
|
|
||||||
if sys.version_info >= (3, 14):
|
|
||||||
def __replace__(
|
|
||||||
self, *, subject: expr = ..., cases: list[match_case] = ..., **kwargs: Unpack[_Attributes]
|
|
||||||
) -> Self: ...
|
|
||||||
|
|
||||||
class Raise(stmt):
|
class Raise(stmt):
|
||||||
if sys.version_info >= (3, 10):
|
if sys.version_info >= (3, 10):
|
||||||
__match_args__ = ("exc", "cause")
|
__match_args__ = ("exc", "cause")
|
||||||
|
|
@ -1076,13 +1062,13 @@ if sys.version_info >= (3, 14):
|
||||||
value: expr
|
value: expr
|
||||||
str: builtins.str
|
str: builtins.str
|
||||||
conversion: int
|
conversion: int
|
||||||
format_spec: builtins.str | None = None
|
format_spec: expr | None = None
|
||||||
def __init__(
|
def __init__(
|
||||||
self,
|
self,
|
||||||
value: expr = ...,
|
value: expr = ...,
|
||||||
str: builtins.str = ...,
|
str: builtins.str = ...,
|
||||||
conversion: int = ...,
|
conversion: int = ...,
|
||||||
format_spec: builtins.str | None = ...,
|
format_spec: expr | None = ...,
|
||||||
**kwargs: Unpack[_Attributes],
|
**kwargs: Unpack[_Attributes],
|
||||||
) -> None: ...
|
) -> None: ...
|
||||||
def __replace__(
|
def __replace__(
|
||||||
|
|
@ -1091,7 +1077,7 @@ if sys.version_info >= (3, 14):
|
||||||
value: expr = ...,
|
value: expr = ...,
|
||||||
str: builtins.str = ...,
|
str: builtins.str = ...,
|
||||||
conversion: int = ...,
|
conversion: int = ...,
|
||||||
format_spec: builtins.str | None = ...,
|
format_spec: expr | None = ...,
|
||||||
**kwargs: Unpack[_Attributes],
|
**kwargs: Unpack[_Attributes],
|
||||||
) -> Self: ...
|
) -> Self: ...
|
||||||
|
|
||||||
|
|
@ -1135,13 +1121,13 @@ class Subscript(expr):
|
||||||
if sys.version_info >= (3, 10):
|
if sys.version_info >= (3, 10):
|
||||||
__match_args__ = ("value", "slice", "ctx")
|
__match_args__ = ("value", "slice", "ctx")
|
||||||
value: expr
|
value: expr
|
||||||
slice: _Slice
|
slice: expr
|
||||||
ctx: expr_context # Not present in Python < 3.13 if not passed to `__init__`
|
ctx: expr_context # Not present in Python < 3.13 if not passed to `__init__`
|
||||||
def __init__(self, value: expr, slice: _Slice, ctx: expr_context = ..., **kwargs: Unpack[_Attributes]) -> None: ...
|
def __init__(self, value: expr, slice: expr, ctx: expr_context = ..., **kwargs: Unpack[_Attributes]) -> None: ...
|
||||||
|
|
||||||
if sys.version_info >= (3, 14):
|
if sys.version_info >= (3, 14):
|
||||||
def __replace__(
|
def __replace__(
|
||||||
self, *, value: expr = ..., slice: _Slice = ..., ctx: expr_context = ..., **kwargs: Unpack[_Attributes]
|
self, *, value: expr = ..., slice: expr = ..., ctx: expr_context = ..., **kwargs: Unpack[_Attributes]
|
||||||
) -> Self: ...
|
) -> Self: ...
|
||||||
|
|
||||||
class Starred(expr):
|
class Starred(expr):
|
||||||
|
|
@ -1194,36 +1180,28 @@ class Tuple(expr):
|
||||||
@deprecated("Deprecated since Python 3.9.")
|
@deprecated("Deprecated since Python 3.9.")
|
||||||
class slice(AST): ...
|
class slice(AST): ...
|
||||||
|
|
||||||
_Slice: typing_extensions.TypeAlias = expr
|
class Slice(expr):
|
||||||
_SliceAttributes: typing_extensions.TypeAlias = _Attributes
|
|
||||||
|
|
||||||
class Slice(_Slice):
|
|
||||||
if sys.version_info >= (3, 10):
|
if sys.version_info >= (3, 10):
|
||||||
__match_args__ = ("lower", "upper", "step")
|
__match_args__ = ("lower", "upper", "step")
|
||||||
lower: expr | None
|
lower: expr | None
|
||||||
upper: expr | None
|
upper: expr | None
|
||||||
step: expr | None
|
step: expr | None
|
||||||
def __init__(
|
def __init__(
|
||||||
self, lower: expr | None = None, upper: expr | None = None, step: expr | None = None, **kwargs: Unpack[_SliceAttributes]
|
self, lower: expr | None = None, upper: expr | None = None, step: expr | None = None, **kwargs: Unpack[_Attributes]
|
||||||
) -> None: ...
|
) -> None: ...
|
||||||
|
|
||||||
if sys.version_info >= (3, 14):
|
if sys.version_info >= (3, 14):
|
||||||
def __replace__(
|
def __replace__(
|
||||||
self,
|
self, *, lower: expr | None = ..., upper: expr | None = ..., step: expr | None = ..., **kwargs: Unpack[_Attributes]
|
||||||
*,
|
|
||||||
lower: expr | None = ...,
|
|
||||||
upper: expr | None = ...,
|
|
||||||
step: expr | None = ...,
|
|
||||||
**kwargs: Unpack[_SliceAttributes],
|
|
||||||
) -> Self: ...
|
) -> Self: ...
|
||||||
|
|
||||||
@deprecated("Deprecated since Python 3.9. Use ast.Tuple instead.")
|
@deprecated("Deprecated since Python 3.9. Use ast.Tuple instead.")
|
||||||
class ExtSlice(slice):
|
class ExtSlice(slice):
|
||||||
def __new__(cls, dims: Iterable[slice] = (), **kwargs: Unpack[_SliceAttributes]) -> Tuple: ... # type: ignore[misc]
|
def __new__(cls, dims: Iterable[slice] = (), **kwargs: Unpack[_Attributes]) -> Tuple: ... # type: ignore[misc]
|
||||||
|
|
||||||
@deprecated("Deprecated since Python 3.9. Use the index value directly instead.")
|
@deprecated("Deprecated since Python 3.9. Use the index value directly instead.")
|
||||||
class Index(slice):
|
class Index(slice):
|
||||||
def __new__(cls, value: expr, **kwargs: Unpack[_SliceAttributes]) -> expr: ... # type: ignore[misc]
|
def __new__(cls, value: expr, **kwargs: Unpack[_Attributes]) -> expr: ... # type: ignore[misc]
|
||||||
|
|
||||||
class expr_context(AST): ...
|
class expr_context(AST): ...
|
||||||
|
|
||||||
|
|
@ -1465,22 +1443,6 @@ class withitem(AST):
|
||||||
def __replace__(self, *, context_expr: expr = ..., optional_vars: expr | None = ...) -> Self: ...
|
def __replace__(self, *, context_expr: expr = ..., optional_vars: expr | None = ...) -> Self: ...
|
||||||
|
|
||||||
if sys.version_info >= (3, 10):
|
if sys.version_info >= (3, 10):
|
||||||
class match_case(AST):
|
|
||||||
__match_args__ = ("pattern", "guard", "body")
|
|
||||||
pattern: _Pattern
|
|
||||||
guard: expr | None
|
|
||||||
body: list[stmt]
|
|
||||||
if sys.version_info >= (3, 13):
|
|
||||||
def __init__(self, pattern: _Pattern, guard: expr | None = None, body: list[stmt] = ...) -> None: ...
|
|
||||||
else:
|
|
||||||
@overload
|
|
||||||
def __init__(self, pattern: _Pattern, guard: expr | None, body: list[stmt]) -> None: ...
|
|
||||||
@overload
|
|
||||||
def __init__(self, pattern: _Pattern, guard: expr | None = None, *, body: list[stmt]) -> None: ...
|
|
||||||
|
|
||||||
if sys.version_info >= (3, 14):
|
|
||||||
def __replace__(self, *, pattern: _Pattern = ..., guard: expr | None = ..., body: list[stmt] = ...) -> Self: ...
|
|
||||||
|
|
||||||
class pattern(AST):
|
class pattern(AST):
|
||||||
lineno: int
|
lineno: int
|
||||||
col_offset: int
|
col_offset: int
|
||||||
|
|
@ -1493,8 +1455,35 @@ if sys.version_info >= (3, 10):
|
||||||
self, *, lineno: int = ..., col_offset: int = ..., end_lineno: int = ..., end_col_offset: int = ...
|
self, *, lineno: int = ..., col_offset: int = ..., end_lineno: int = ..., end_col_offset: int = ...
|
||||||
) -> Self: ...
|
) -> Self: ...
|
||||||
|
|
||||||
# Without the alias, Pyright complains variables named pattern are recursively defined
|
class match_case(AST):
|
||||||
_Pattern: typing_extensions.TypeAlias = pattern
|
__match_args__ = ("pattern", "guard", "body")
|
||||||
|
pattern: ast.pattern
|
||||||
|
guard: expr | None
|
||||||
|
body: list[stmt]
|
||||||
|
if sys.version_info >= (3, 13):
|
||||||
|
def __init__(self, pattern: ast.pattern, guard: expr | None = None, body: list[stmt] = ...) -> None: ...
|
||||||
|
elif sys.version_info >= (3, 10):
|
||||||
|
@overload
|
||||||
|
def __init__(self, pattern: ast.pattern, guard: expr | None, body: list[stmt]) -> None: ...
|
||||||
|
@overload
|
||||||
|
def __init__(self, pattern: ast.pattern, guard: expr | None = None, *, body: list[stmt]) -> None: ...
|
||||||
|
|
||||||
|
if sys.version_info >= (3, 14):
|
||||||
|
def __replace__(self, *, pattern: ast.pattern = ..., guard: expr | None = ..., body: list[stmt] = ...) -> Self: ...
|
||||||
|
|
||||||
|
class Match(stmt):
|
||||||
|
__match_args__ = ("subject", "cases")
|
||||||
|
subject: expr
|
||||||
|
cases: list[match_case]
|
||||||
|
if sys.version_info >= (3, 13):
|
||||||
|
def __init__(self, subject: expr, cases: list[match_case] = ..., **kwargs: Unpack[_Attributes]) -> None: ...
|
||||||
|
else:
|
||||||
|
def __init__(self, subject: expr, cases: list[match_case], **kwargs: Unpack[_Attributes]) -> None: ...
|
||||||
|
|
||||||
|
if sys.version_info >= (3, 14):
|
||||||
|
def __replace__(
|
||||||
|
self, *, subject: expr = ..., cases: list[match_case] = ..., **kwargs: Unpack[_Attributes]
|
||||||
|
) -> Self: ...
|
||||||
|
|
||||||
class MatchValue(pattern):
|
class MatchValue(pattern):
|
||||||
__match_args__ = ("value",)
|
__match_args__ = ("value",)
|
||||||
|
|
@ -1590,22 +1579,22 @@ if sys.version_info >= (3, 10):
|
||||||
class MatchStar(pattern):
|
class MatchStar(pattern):
|
||||||
__match_args__ = ("name",)
|
__match_args__ = ("name",)
|
||||||
name: str | None
|
name: str | None
|
||||||
def __init__(self, name: str | None, **kwargs: Unpack[_Attributes[int]]) -> None: ...
|
def __init__(self, name: str | None = None, **kwargs: Unpack[_Attributes[int]]) -> None: ...
|
||||||
|
|
||||||
if sys.version_info >= (3, 14):
|
if sys.version_info >= (3, 14):
|
||||||
def __replace__(self, *, name: str | None = ..., **kwargs: Unpack[_Attributes[int]]) -> Self: ...
|
def __replace__(self, *, name: str | None = ..., **kwargs: Unpack[_Attributes[int]]) -> Self: ...
|
||||||
|
|
||||||
class MatchAs(pattern):
|
class MatchAs(pattern):
|
||||||
__match_args__ = ("pattern", "name")
|
__match_args__ = ("pattern", "name")
|
||||||
pattern: _Pattern | None
|
pattern: ast.pattern | None
|
||||||
name: str | None
|
name: str | None
|
||||||
def __init__(
|
def __init__(
|
||||||
self, pattern: _Pattern | None = None, name: str | None = None, **kwargs: Unpack[_Attributes[int]]
|
self, pattern: ast.pattern | None = None, name: str | None = None, **kwargs: Unpack[_Attributes[int]]
|
||||||
) -> None: ...
|
) -> None: ...
|
||||||
|
|
||||||
if sys.version_info >= (3, 14):
|
if sys.version_info >= (3, 14):
|
||||||
def __replace__(
|
def __replace__(
|
||||||
self, *, pattern: _Pattern | None = ..., name: str | None = ..., **kwargs: Unpack[_Attributes[int]]
|
self, *, pattern: ast.pattern | None = ..., name: str | None = ..., **kwargs: Unpack[_Attributes[int]]
|
||||||
) -> Self: ...
|
) -> Self: ...
|
||||||
|
|
||||||
class MatchOr(pattern):
|
class MatchOr(pattern):
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,41 @@
|
||||||
|
from collections.abc import Iterable
|
||||||
|
from enum import Enum
|
||||||
|
from typing import NamedTuple, SupportsIndex, type_check_only
|
||||||
|
|
||||||
|
@type_check_only
|
||||||
|
class _AwaitedInfo(NamedTuple): # AwaitedInfo_Type from _remote_debugging
|
||||||
|
thread_id: int
|
||||||
|
awaited_by: list[_TaskInfo]
|
||||||
|
|
||||||
|
@type_check_only
|
||||||
|
class _TaskInfo(NamedTuple): # TaskInfo_Type from _remote_debugging
|
||||||
|
task_id: int
|
||||||
|
task_name: str
|
||||||
|
coroutine_stack: list[_CoroInfo]
|
||||||
|
awaited_by: list[_CoroInfo]
|
||||||
|
|
||||||
|
@type_check_only
|
||||||
|
class _CoroInfo(NamedTuple): # CoroInfo_Type from _remote_debugging
|
||||||
|
call_stack: list[_FrameInfo]
|
||||||
|
task_name: int | str
|
||||||
|
|
||||||
|
@type_check_only
|
||||||
|
class _FrameInfo(NamedTuple): # FrameInfo_Type from _remote_debugging
|
||||||
|
filename: str
|
||||||
|
lineno: int
|
||||||
|
funcname: str
|
||||||
|
|
||||||
|
class NodeType(Enum):
|
||||||
|
COROUTINE = 1
|
||||||
|
TASK = 2
|
||||||
|
|
||||||
|
class CycleFoundException(Exception):
|
||||||
|
cycles: list[list[int]]
|
||||||
|
id2name: dict[int, str]
|
||||||
|
def __init__(self, cycles: list[list[int]], id2name: dict[int, str]) -> None: ...
|
||||||
|
|
||||||
|
def get_all_awaited_by(pid: SupportsIndex) -> list[_AwaitedInfo]: ...
|
||||||
|
def build_async_tree(result: Iterable[_AwaitedInfo], task_emoji: str = "(T)", cor_emoji: str = "") -> list[list[str]]: ...
|
||||||
|
def build_task_table(result: Iterable[_AwaitedInfo]) -> list[list[int | str]]: ...
|
||||||
|
def display_awaited_by_tasks_table(pid: SupportsIndex) -> None: ...
|
||||||
|
def display_awaited_by_tasks_tree(pid: SupportsIndex) -> None: ...
|
||||||
|
|
@ -91,6 +91,10 @@ class ThreadPoolExecutor(Executor):
|
||||||
_shutdown: bool
|
_shutdown: bool
|
||||||
_shutdown_lock: Lock
|
_shutdown_lock: Lock
|
||||||
_thread_name_prefix: str | None
|
_thread_name_prefix: str | None
|
||||||
|
if sys.version_info >= (3, 14):
|
||||||
|
_create_worker_context: Callable[[], WorkerContext]
|
||||||
|
_resolve_work_item_task: _ResolveTaskFunc
|
||||||
|
else:
|
||||||
_initializer: Callable[..., None] | None
|
_initializer: Callable[..., None] | None
|
||||||
_initargs: tuple[Any, ...]
|
_initargs: tuple[Any, ...]
|
||||||
_work_queue: queue.SimpleQueue[_WorkItem[Any]]
|
_work_queue: queue.SimpleQueue[_WorkItem[Any]]
|
||||||
|
|
@ -100,12 +104,12 @@ class ThreadPoolExecutor(Executor):
|
||||||
@classmethod
|
@classmethod
|
||||||
def prepare_context(
|
def prepare_context(
|
||||||
cls, initializer: Callable[[], object], initargs: tuple[()]
|
cls, initializer: Callable[[], object], initargs: tuple[()]
|
||||||
) -> tuple[Callable[[], Self], _ResolveTaskFunc]: ...
|
) -> tuple[Callable[[], WorkerContext], _ResolveTaskFunc]: ...
|
||||||
@overload
|
@overload
|
||||||
@classmethod
|
@classmethod
|
||||||
def prepare_context(
|
def prepare_context(
|
||||||
cls, initializer: Callable[[Unpack[_Ts]], object], initargs: tuple[Unpack[_Ts]]
|
cls, initializer: Callable[[Unpack[_Ts]], object], initargs: tuple[Unpack[_Ts]]
|
||||||
) -> tuple[Callable[[], Self], _ResolveTaskFunc]: ...
|
) -> tuple[Callable[[], WorkerContext], _ResolveTaskFunc]: ...
|
||||||
|
|
||||||
@overload
|
@overload
|
||||||
def __init__(
|
def __init__(
|
||||||
|
|
|
||||||
|
|
@ -683,7 +683,7 @@ else:
|
||||||
extsep: str
|
extsep: str
|
||||||
pathsep: str
|
pathsep: str
|
||||||
defpath: str
|
defpath: str
|
||||||
linesep: str
|
linesep: Literal["\n", "\r\n"]
|
||||||
devnull: str
|
devnull: str
|
||||||
name: str
|
name: str
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@ from collections.abc import AsyncGenerator, Callable, Sequence
|
||||||
from io import TextIOWrapper
|
from io import TextIOWrapper
|
||||||
from types import FrameType, ModuleType, TracebackType
|
from types import FrameType, ModuleType, TracebackType
|
||||||
from typing import Any, Final, Literal, NoReturn, Protocol, TextIO, TypeVar, final, type_check_only
|
from typing import Any, Final, Literal, NoReturn, Protocol, TextIO, TypeVar, final, type_check_only
|
||||||
from typing_extensions import LiteralString, TypeAlias
|
from typing_extensions import LiteralString, TypeAlias, deprecated
|
||||||
|
|
||||||
_T = TypeVar("_T")
|
_T = TypeVar("_T")
|
||||||
|
|
||||||
|
|
@ -335,7 +335,14 @@ class _version_info(_UninstantiableStructseq, tuple[int, int, int, _ReleaseLevel
|
||||||
version_info: _version_info
|
version_info: _version_info
|
||||||
|
|
||||||
def call_tracing(func: Callable[..., _T], args: Any, /) -> _T: ...
|
def call_tracing(func: Callable[..., _T], args: Any, /) -> _T: ...
|
||||||
|
|
||||||
|
if sys.version_info >= (3, 13):
|
||||||
|
@deprecated("Deprecated in Python 3.13; use _clear_internal_caches() instead.")
|
||||||
def _clear_type_cache() -> None: ...
|
def _clear_type_cache() -> None: ...
|
||||||
|
|
||||||
|
else:
|
||||||
|
def _clear_type_cache() -> None: ...
|
||||||
|
|
||||||
def _current_frames() -> dict[int, FrameType]: ...
|
def _current_frames() -> dict[int, FrameType]: ...
|
||||||
def _getframe(depth: int = 0, /) -> FrameType: ...
|
def _getframe(depth: int = 0, /) -> FrameType: ...
|
||||||
def _debugmallocstats() -> None: ...
|
def _debugmallocstats() -> None: ...
|
||||||
|
|
|
||||||
|
|
@ -1,12 +1,14 @@
|
||||||
from _typeshed import Incomplete
|
|
||||||
from collections.abc import Mapping
|
from collections.abc import Mapping
|
||||||
from typing import ClassVar
|
from tkinter import Misc
|
||||||
|
from typing import Any, ClassVar
|
||||||
|
|
||||||
__all__ = ["Dialog"]
|
__all__ = ["Dialog"]
|
||||||
|
|
||||||
class Dialog:
|
class Dialog:
|
||||||
command: ClassVar[str | None]
|
command: ClassVar[str | None]
|
||||||
master: Incomplete | None
|
master: Misc | None
|
||||||
options: Mapping[str, Incomplete]
|
# Types of options are very dynamic. They depend on the command and are
|
||||||
def __init__(self, master=None, **options) -> None: ...
|
# sometimes changed to a different type.
|
||||||
def show(self, **options): ...
|
options: Mapping[str, Any]
|
||||||
|
def __init__(self, master: Misc | None = None, **options: Any) -> None: ...
|
||||||
|
def show(self, **options: Any) -> Any: ...
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
from _typeshed import Incomplete, StrOrBytesPath
|
from _typeshed import Incomplete, StrOrBytesPath, StrPath
|
||||||
from collections.abc import Iterable
|
from collections.abc import Hashable, Iterable
|
||||||
from tkinter import Button, Entry, Frame, Listbox, Misc, Scrollbar, StringVar, Toplevel, commondialog
|
from tkinter import Button, Entry, Event, Frame, Listbox, Misc, Scrollbar, StringVar, Toplevel, commondialog
|
||||||
from typing import IO, ClassVar, Literal
|
from typing import IO, ClassVar, Literal
|
||||||
|
|
||||||
__all__ = [
|
__all__ = [
|
||||||
|
|
@ -19,12 +19,12 @@ __all__ = [
|
||||||
"askdirectory",
|
"askdirectory",
|
||||||
]
|
]
|
||||||
|
|
||||||
dialogstates: dict[Incomplete, tuple[Incomplete, Incomplete]]
|
dialogstates: dict[Hashable, tuple[str, str]]
|
||||||
|
|
||||||
class FileDialog:
|
class FileDialog:
|
||||||
title: str
|
title: str
|
||||||
master: Incomplete
|
master: Misc
|
||||||
directory: Incomplete | None
|
directory: str | None
|
||||||
top: Toplevel
|
top: Toplevel
|
||||||
botframe: Frame
|
botframe: Frame
|
||||||
selection: Entry
|
selection: Entry
|
||||||
|
|
@ -38,23 +38,23 @@ class FileDialog:
|
||||||
filter_button: Button
|
filter_button: Button
|
||||||
cancel_button: Button
|
cancel_button: Button
|
||||||
def __init__(
|
def __init__(
|
||||||
self, master, title=None
|
self, master: Misc, title: str | None = None
|
||||||
) -> None: ... # title is usually a str or None, but e.g. int doesn't raise en exception either
|
) -> None: ... # title is usually a str or None, but e.g. int doesn't raise en exception either
|
||||||
how: Incomplete | None
|
how: str | None
|
||||||
def go(self, dir_or_file=".", pattern: str = "*", default: str = "", key=None): ...
|
def go(self, dir_or_file: StrPath = ".", pattern: StrPath = "*", default: StrPath = "", key: Hashable | None = None): ...
|
||||||
def quit(self, how=None) -> None: ...
|
def quit(self, how: str | None = None) -> None: ...
|
||||||
def dirs_double_event(self, event) -> None: ...
|
def dirs_double_event(self, event: Event) -> None: ...
|
||||||
def dirs_select_event(self, event) -> None: ...
|
def dirs_select_event(self, event: Event) -> None: ...
|
||||||
def files_double_event(self, event) -> None: ...
|
def files_double_event(self, event: Event) -> None: ...
|
||||||
def files_select_event(self, event) -> None: ...
|
def files_select_event(self, event: Event) -> None: ...
|
||||||
def ok_event(self, event) -> None: ...
|
def ok_event(self, event: Event) -> None: ...
|
||||||
def ok_command(self) -> None: ...
|
def ok_command(self) -> None: ...
|
||||||
def filter_command(self, event=None) -> None: ...
|
def filter_command(self, event: Event | None = None) -> None: ...
|
||||||
def get_filter(self): ...
|
def get_filter(self) -> tuple[str, str]: ...
|
||||||
def get_selection(self): ...
|
def get_selection(self) -> str: ...
|
||||||
def cancel_command(self, event=None) -> None: ...
|
def cancel_command(self, event: Event | None = None) -> None: ...
|
||||||
def set_filter(self, dir, pat) -> None: ...
|
def set_filter(self, dir: StrPath, pat: StrPath) -> None: ...
|
||||||
def set_selection(self, file) -> None: ...
|
def set_selection(self, file: StrPath) -> None: ...
|
||||||
|
|
||||||
class LoadFileDialog(FileDialog):
|
class LoadFileDialog(FileDialog):
|
||||||
title: str
|
title: str
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
|
from tkinter import Misc
|
||||||
from tkinter.commondialog import Dialog
|
from tkinter.commondialog import Dialog
|
||||||
from typing import ClassVar, Final
|
from typing import ClassVar, Final, Literal
|
||||||
|
|
||||||
__all__ = ["showinfo", "showwarning", "showerror", "askquestion", "askokcancel", "askyesno", "askyesnocancel", "askretrycancel"]
|
__all__ = ["showinfo", "showwarning", "showerror", "askquestion", "askokcancel", "askyesno", "askyesnocancel", "askretrycancel"]
|
||||||
|
|
||||||
|
|
@ -23,11 +24,75 @@ NO: Final = "no"
|
||||||
class Message(Dialog):
|
class Message(Dialog):
|
||||||
command: ClassVar[str]
|
command: ClassVar[str]
|
||||||
|
|
||||||
def showinfo(title: str | None = None, message: str | None = None, **options) -> str: ...
|
def showinfo(
|
||||||
def showwarning(title: str | None = None, message: str | None = None, **options) -> str: ...
|
title: str | None = None,
|
||||||
def showerror(title: str | None = None, message: str | None = None, **options) -> str: ...
|
message: str | None = None,
|
||||||
def askquestion(title: str | None = None, message: str | None = None, **options) -> str: ...
|
*,
|
||||||
def askokcancel(title: str | None = None, message: str | None = None, **options) -> bool: ...
|
detail: str = ...,
|
||||||
def askyesno(title: str | None = None, message: str | None = None, **options) -> bool: ...
|
icon: Literal["error", "info", "question", "warning"] = ...,
|
||||||
def askyesnocancel(title: str | None = None, message: str | None = None, **options) -> bool | None: ...
|
default: Literal["ok"] = ...,
|
||||||
def askretrycancel(title: str | None = None, message: str | None = None, **options) -> bool: ...
|
parent: Misc = ...,
|
||||||
|
) -> str: ...
|
||||||
|
def showwarning(
|
||||||
|
title: str | None = None,
|
||||||
|
message: str | None = None,
|
||||||
|
*,
|
||||||
|
detail: str = ...,
|
||||||
|
icon: Literal["error", "info", "question", "warning"] = ...,
|
||||||
|
default: Literal["ok"] = ...,
|
||||||
|
parent: Misc = ...,
|
||||||
|
) -> str: ...
|
||||||
|
def showerror(
|
||||||
|
title: str | None = None,
|
||||||
|
message: str | None = None,
|
||||||
|
*,
|
||||||
|
detail: str = ...,
|
||||||
|
icon: Literal["error", "info", "question", "warning"] = ...,
|
||||||
|
default: Literal["ok"] = ...,
|
||||||
|
parent: Misc = ...,
|
||||||
|
) -> str: ...
|
||||||
|
def askquestion(
|
||||||
|
title: str | None = None,
|
||||||
|
message: str | None = None,
|
||||||
|
*,
|
||||||
|
detail: str = ...,
|
||||||
|
icon: Literal["error", "info", "question", "warning"] = ...,
|
||||||
|
default: Literal["yes", "no"] = ...,
|
||||||
|
parent: Misc = ...,
|
||||||
|
) -> str: ...
|
||||||
|
def askokcancel(
|
||||||
|
title: str | None = None,
|
||||||
|
message: str | None = None,
|
||||||
|
*,
|
||||||
|
detail: str = ...,
|
||||||
|
icon: Literal["error", "info", "question", "warning"] = ...,
|
||||||
|
default: Literal["ok", "cancel"] = ...,
|
||||||
|
parent: Misc = ...,
|
||||||
|
) -> bool: ...
|
||||||
|
def askyesno(
|
||||||
|
title: str | None = None,
|
||||||
|
message: str | None = None,
|
||||||
|
*,
|
||||||
|
detail: str = ...,
|
||||||
|
icon: Literal["error", "info", "question", "warning"] = ...,
|
||||||
|
default: Literal["yes", "no"] = ...,
|
||||||
|
parent: Misc = ...,
|
||||||
|
) -> bool: ...
|
||||||
|
def askyesnocancel(
|
||||||
|
title: str | None = None,
|
||||||
|
message: str | None = None,
|
||||||
|
*,
|
||||||
|
detail: str = ...,
|
||||||
|
icon: Literal["error", "info", "question", "warning"] = ...,
|
||||||
|
default: Literal["cancel", "yes", "no"] = ...,
|
||||||
|
parent: Misc = ...,
|
||||||
|
) -> bool | None: ...
|
||||||
|
def askretrycancel(
|
||||||
|
title: str | None = None,
|
||||||
|
message: str | None = None,
|
||||||
|
*,
|
||||||
|
detail: str = ...,
|
||||||
|
icon: Literal["error", "info", "question", "warning"] = ...,
|
||||||
|
default: Literal["retry", "cancel"] = ...,
|
||||||
|
parent: Misc = ...,
|
||||||
|
) -> bool: ...
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
import sys
|
import sys
|
||||||
|
from typing import Final
|
||||||
|
|
||||||
__all__ = [
|
__all__ = [
|
||||||
"AMPER",
|
"AMPER",
|
||||||
|
|
@ -81,87 +82,87 @@ if sys.version_info >= (3, 12):
|
||||||
if sys.version_info >= (3, 14):
|
if sys.version_info >= (3, 14):
|
||||||
__all__ += ["TSTRING_START", "TSTRING_MIDDLE", "TSTRING_END"]
|
__all__ += ["TSTRING_START", "TSTRING_MIDDLE", "TSTRING_END"]
|
||||||
|
|
||||||
ENDMARKER: int
|
ENDMARKER: Final[int]
|
||||||
NAME: int
|
NAME: Final[int]
|
||||||
NUMBER: int
|
NUMBER: Final[int]
|
||||||
STRING: int
|
STRING: Final[int]
|
||||||
NEWLINE: int
|
NEWLINE: Final[int]
|
||||||
INDENT: int
|
INDENT: Final[int]
|
||||||
DEDENT: int
|
DEDENT: Final[int]
|
||||||
LPAR: int
|
LPAR: Final[int]
|
||||||
RPAR: int
|
RPAR: Final[int]
|
||||||
LSQB: int
|
LSQB: Final[int]
|
||||||
RSQB: int
|
RSQB: Final[int]
|
||||||
COLON: int
|
COLON: Final[int]
|
||||||
COMMA: int
|
COMMA: Final[int]
|
||||||
SEMI: int
|
SEMI: Final[int]
|
||||||
PLUS: int
|
PLUS: Final[int]
|
||||||
MINUS: int
|
MINUS: Final[int]
|
||||||
STAR: int
|
STAR: Final[int]
|
||||||
SLASH: int
|
SLASH: Final[int]
|
||||||
VBAR: int
|
VBAR: Final[int]
|
||||||
AMPER: int
|
AMPER: Final[int]
|
||||||
LESS: int
|
LESS: Final[int]
|
||||||
GREATER: int
|
GREATER: Final[int]
|
||||||
EQUAL: int
|
EQUAL: Final[int]
|
||||||
DOT: int
|
DOT: Final[int]
|
||||||
PERCENT: int
|
PERCENT: Final[int]
|
||||||
LBRACE: int
|
LBRACE: Final[int]
|
||||||
RBRACE: int
|
RBRACE: Final[int]
|
||||||
EQEQUAL: int
|
EQEQUAL: Final[int]
|
||||||
NOTEQUAL: int
|
NOTEQUAL: Final[int]
|
||||||
LESSEQUAL: int
|
LESSEQUAL: Final[int]
|
||||||
GREATEREQUAL: int
|
GREATEREQUAL: Final[int]
|
||||||
TILDE: int
|
TILDE: Final[int]
|
||||||
CIRCUMFLEX: int
|
CIRCUMFLEX: Final[int]
|
||||||
LEFTSHIFT: int
|
LEFTSHIFT: Final[int]
|
||||||
RIGHTSHIFT: int
|
RIGHTSHIFT: Final[int]
|
||||||
DOUBLESTAR: int
|
DOUBLESTAR: Final[int]
|
||||||
PLUSEQUAL: int
|
PLUSEQUAL: Final[int]
|
||||||
MINEQUAL: int
|
MINEQUAL: Final[int]
|
||||||
STAREQUAL: int
|
STAREQUAL: Final[int]
|
||||||
SLASHEQUAL: int
|
SLASHEQUAL: Final[int]
|
||||||
PERCENTEQUAL: int
|
PERCENTEQUAL: Final[int]
|
||||||
AMPEREQUAL: int
|
AMPEREQUAL: Final[int]
|
||||||
VBAREQUAL: int
|
VBAREQUAL: Final[int]
|
||||||
CIRCUMFLEXEQUAL: int
|
CIRCUMFLEXEQUAL: Final[int]
|
||||||
LEFTSHIFTEQUAL: int
|
LEFTSHIFTEQUAL: Final[int]
|
||||||
RIGHTSHIFTEQUAL: int
|
RIGHTSHIFTEQUAL: Final[int]
|
||||||
DOUBLESTAREQUAL: int
|
DOUBLESTAREQUAL: Final[int]
|
||||||
DOUBLESLASH: int
|
DOUBLESLASH: Final[int]
|
||||||
DOUBLESLASHEQUAL: int
|
DOUBLESLASHEQUAL: Final[int]
|
||||||
AT: int
|
AT: Final[int]
|
||||||
RARROW: int
|
RARROW: Final[int]
|
||||||
ELLIPSIS: int
|
ELLIPSIS: Final[int]
|
||||||
ATEQUAL: int
|
ATEQUAL: Final[int]
|
||||||
if sys.version_info < (3, 13):
|
if sys.version_info < (3, 13):
|
||||||
AWAIT: int
|
AWAIT: Final[int]
|
||||||
ASYNC: int
|
ASYNC: Final[int]
|
||||||
OP: int
|
OP: Final[int]
|
||||||
ERRORTOKEN: int
|
ERRORTOKEN: Final[int]
|
||||||
N_TOKENS: int
|
N_TOKENS: Final[int]
|
||||||
NT_OFFSET: int
|
NT_OFFSET: Final[int]
|
||||||
tok_name: dict[int, str]
|
tok_name: Final[dict[int, str]]
|
||||||
COMMENT: int
|
COMMENT: Final[int]
|
||||||
NL: int
|
NL: Final[int]
|
||||||
ENCODING: int
|
ENCODING: Final[int]
|
||||||
TYPE_COMMENT: int
|
TYPE_COMMENT: Final[int]
|
||||||
TYPE_IGNORE: int
|
TYPE_IGNORE: Final[int]
|
||||||
COLONEQUAL: int
|
COLONEQUAL: Final[int]
|
||||||
EXACT_TOKEN_TYPES: dict[str, int]
|
EXACT_TOKEN_TYPES: Final[dict[str, int]]
|
||||||
if sys.version_info >= (3, 10):
|
if sys.version_info >= (3, 10):
|
||||||
SOFT_KEYWORD: int
|
SOFT_KEYWORD: Final[int]
|
||||||
|
|
||||||
if sys.version_info >= (3, 12):
|
if sys.version_info >= (3, 12):
|
||||||
EXCLAMATION: int
|
EXCLAMATION: Final[int]
|
||||||
FSTRING_END: int
|
FSTRING_END: Final[int]
|
||||||
FSTRING_MIDDLE: int
|
FSTRING_MIDDLE: Final[int]
|
||||||
FSTRING_START: int
|
FSTRING_START: Final[int]
|
||||||
|
|
||||||
if sys.version_info >= (3, 14):
|
if sys.version_info >= (3, 14):
|
||||||
TSTRING_START: int
|
TSTRING_START: Final[int]
|
||||||
TSTRING_MIDDLE: int
|
TSTRING_MIDDLE: Final[int]
|
||||||
TSTRING_END: int
|
TSTRING_END: Final[int]
|
||||||
|
|
||||||
def ISTERMINAL(x: int) -> bool: ...
|
def ISTERMINAL(x: int) -> bool: ...
|
||||||
def ISNONTERMINAL(x: int) -> bool: ...
|
def ISNONTERMINAL(x: int) -> bool: ...
|
||||||
|
|
|
||||||
|
|
@ -3,10 +3,15 @@ from _typeshed import FileDescriptorOrPath
|
||||||
from collections.abc import Callable, Generator, Iterable, Sequence
|
from collections.abc import Callable, Generator, Iterable, Sequence
|
||||||
from re import Pattern
|
from re import Pattern
|
||||||
from token import *
|
from token import *
|
||||||
from token import EXACT_TOKEN_TYPES as EXACT_TOKEN_TYPES
|
|
||||||
from typing import Any, NamedTuple, TextIO, type_check_only
|
from typing import Any, NamedTuple, TextIO, type_check_only
|
||||||
from typing_extensions import TypeAlias
|
from typing_extensions import TypeAlias
|
||||||
|
|
||||||
|
if sys.version_info < (3, 12):
|
||||||
|
# Avoid double assignment to Final name by imports, which pyright objects to.
|
||||||
|
# EXACT_TOKEN_TYPES is already defined by 'from token import *' above
|
||||||
|
# in Python 3.12+.
|
||||||
|
from token import EXACT_TOKEN_TYPES as EXACT_TOKEN_TYPES
|
||||||
|
|
||||||
__all__ = [
|
__all__ = [
|
||||||
"AMPER",
|
"AMPER",
|
||||||
"AMPEREQUAL",
|
"AMPEREQUAL",
|
||||||
|
|
|
||||||
|
|
@ -388,7 +388,7 @@ class GeneratorType(Generator[_YieldT_co, _SendT_contra, _ReturnT_co]):
|
||||||
@property
|
@property
|
||||||
def gi_running(self) -> bool: ...
|
def gi_running(self) -> bool: ...
|
||||||
@property
|
@property
|
||||||
def gi_yieldfrom(self) -> GeneratorType[_YieldT_co, _SendT_contra, Any] | None: ...
|
def gi_yieldfrom(self) -> Iterator[_YieldT_co] | None: ...
|
||||||
if sys.version_info >= (3, 11):
|
if sys.version_info >= (3, 11):
|
||||||
@property
|
@property
|
||||||
def gi_suspended(self) -> bool: ...
|
def gi_suspended(self) -> bool: ...
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue