From 59bc6cb7e7c5799b2720896e5d8a674ccb91b66a Mon Sep 17 00:00:00 2001 From: bzoracler Date: Sat, 14 Dec 2024 22:42:46 +1300 Subject: [PATCH 01/10] feat: add stubs for `watchpoints` --- pyrightconfig.stricter.json | 1 + stubs/watchpoints/METADATA.toml | 2 + stubs/watchpoints/watchpoints/__init__.pyi | 10 +++ stubs/watchpoints/watchpoints/ast_monkey.pyi | 3 + stubs/watchpoints/watchpoints/util.pyi | 5 ++ stubs/watchpoints/watchpoints/watch.pyi | 64 +++++++++++++++++++ .../watchpoints/watchpoints/watch_element.pyi | 53 +++++++++++++++ stubs/watchpoints/watchpoints/watch_print.pyi | 21 ++++++ 8 files changed, 159 insertions(+) create mode 100644 stubs/watchpoints/METADATA.toml create mode 100644 stubs/watchpoints/watchpoints/__init__.pyi create mode 100644 stubs/watchpoints/watchpoints/ast_monkey.pyi create mode 100644 stubs/watchpoints/watchpoints/util.pyi create mode 100644 stubs/watchpoints/watchpoints/watch.pyi create mode 100644 stubs/watchpoints/watchpoints/watch_element.pyi create mode 100644 stubs/watchpoints/watchpoints/watch_print.pyi diff --git a/pyrightconfig.stricter.json b/pyrightconfig.stricter.json index be0163441020..a16607251715 100644 --- a/pyrightconfig.stricter.json +++ b/pyrightconfig.stricter.json @@ -98,6 +98,7 @@ "stubs/tqdm", "stubs/ttkthemes", "stubs/vobject", + "stubs/watchpoints", "stubs/workalendar", "stubs/wurlitzer", ], diff --git a/stubs/watchpoints/METADATA.toml b/stubs/watchpoints/METADATA.toml new file mode 100644 index 000000000000..9607e41191d6 --- /dev/null +++ b/stubs/watchpoints/METADATA.toml @@ -0,0 +1,2 @@ +version = "0.2.*" +upstream_repository = "https://github.com/gaogaotiantian/watchpoints" diff --git a/stubs/watchpoints/watchpoints/__init__.pyi b/stubs/watchpoints/watchpoints/__init__.pyi new file mode 100644 index 000000000000..fad5cb82ff68 --- /dev/null +++ b/stubs/watchpoints/watchpoints/__init__.pyi @@ -0,0 +1,10 @@ +from typing import Final, Literal +from typing_extensions import LiteralString + +from .watch import Watch + +__version__: Final[LiteralString] + +all: Final[list[Literal["watch", "unwatch"]]] +watch: Final[Watch] +unwatch: Final = watch.unwatch diff --git a/stubs/watchpoints/watchpoints/ast_monkey.pyi b/stubs/watchpoints/watchpoints/ast_monkey.pyi new file mode 100644 index 000000000000..1409982075af --- /dev/null +++ b/stubs/watchpoints/watchpoints/ast_monkey.pyi @@ -0,0 +1,3 @@ +import ast + +def ast_parse_node(node: ast.expr) -> ast.Module: ... diff --git a/stubs/watchpoints/watchpoints/util.pyi b/stubs/watchpoints/watchpoints/util.pyi new file mode 100644 index 000000000000..760ab4d20219 --- /dev/null +++ b/stubs/watchpoints/watchpoints/util.pyi @@ -0,0 +1,5 @@ +import ast +from types import FrameType + +def getline(frame: FrameType) -> str: ... +def getargnodes(frame: FrameType) -> zip[tuple[ast.expr, str]]: ... diff --git a/stubs/watchpoints/watchpoints/watch.pyi b/stubs/watchpoints/watchpoints/watch.pyi new file mode 100644 index 000000000000..650850349a62 --- /dev/null +++ b/stubs/watchpoints/watchpoints/watch.pyi @@ -0,0 +1,64 @@ +import threading +from _typeshed import SupportsWrite, TraceFunction +from collections.abc import Callable +from pdb import Pdb +from types import FrameType +from typing import Any, Literal, Protocol, TypeVar +from typing_extensions import TypeAlias + +from .watch_element import WatchElement + +_T = TypeVar("_T") + +# Alias used for fields that must always be valid identifiers +# A string `x` counts as a valid identifier if both the following are True +# (1) `x.isidentifier()` evaluates to `True` +# (2) `keyword.iskeyword(x)` evaluates to `False` +_Identifier: TypeAlias = str + +class Watch: + custom_printer: Callable[[Any], None] | None + enable: bool + file: str | SupportsWrite[str] | None + pdb: Pdb | None + pdb_enable: bool + set_lock: threading.Lock + stack_limit: int | None + tracefunc_lock: threading.Lock + tracefunc_stack: list[TraceFunction | None] + watch_list: list[WatchElement] + + def __init__(self) -> None: ... + def __call__( + self, + *args: Any, + alias: str = ..., + callback: Callable[[FrameType, WatchElement, tuple[str, str, int | None]], None] = ..., + cmp: Callable[[Any, Any], bool] = ..., + copy: Callable[[_T], _T] = ..., + custom_printer: Callable[[Any], None] = ..., + deepcopy: bool = False, + file: str | SupportsWrite[str] = ..., + stack_limit: int | None = 5, + track: Literal["object", "variable"] = ..., + when: Callable[[Any], bool] = ..., + ) -> None: ... + def config( + self, + *, + callback: Callable[[FrameType, WatchElement, tuple[str, str, int | None]], None] = ..., + pdb: Literal[True] = ..., + file: str | SupportsWrite[str] = ..., + stack_limit: int | None = 5, + custom_printer: Callable[[Any], None] = ..., + ) -> None: ... + def install(self, func: _Identifier = "watch") -> None: ... + def restore(self) -> None: ... + def start_trace(self, frame: FrameType) -> None: ... + def stop_trace(self, frame: FrameType) -> None: ... + def tracefunc(self, frame: FrameType, event: str, arg: Any) -> _TraceFunc: ... + def uninstall(self, func: _Identifier = "watch") -> None: ... + def unwatch(self, *args: Any) -> None: ... + +class _TraceFunc(Protocol): + def __call__(self, frame: FrameType, event: str, arg: Any) -> _TraceFunc: ... diff --git a/stubs/watchpoints/watchpoints/watch_element.pyi b/stubs/watchpoints/watchpoints/watch_element.pyi new file mode 100644 index 000000000000..5a8f0b23fc45 --- /dev/null +++ b/stubs/watchpoints/watchpoints/watch_element.pyi @@ -0,0 +1,53 @@ +import ast +from collections.abc import Callable, Iterable +from types import FrameType +from typing import Any, Literal, TypeVar +from typing_extensions import TypeAlias + +from .watch_print import WatchPrint + +_T = TypeVar("_T") +_TrackKind: TypeAlias = Literal["object", "variable"] | list[Literal["object", "variable"]] + +class WatchElement: + alias: str | None + attr: str | None + cmp: Callable[[Any, Any], bool] | None + copy: Callable[[Any], object] | None + default_alias: str | None + deepcopy: bool + exist: bool + frame: FrameType + localvar: str | None + obj: Any + parent: Any + prev_obj: Any + prev_obj_repr: str + subscr: Any + watch_print: WatchPrint + when: Callable[[Any], bool] | None + + def __init__( + self, + frame: FrameType, + node: ast.expr, + *, + alias: str | None = ..., + callback: Callable[[FrameType, WatchElement, tuple[str, str, int | None]], None] | None = ..., + cmp: Callable[[Any, Any], bool] | None = ..., + copy: Callable[[_T], _T] | None = ..., + deepcopy: bool = False, + default_alias: str | None = ..., + track: _TrackKind = ..., + watch_print: WatchPrint = ..., + when: Callable[[Any], bool] | None = ..., + ) -> None: ... + def belong_to(self, lst: Iterable[Any]) -> bool: ... + def changed(self, frame: FrameType) -> tuple[bool, bool]: ... + def obj_changed(self, other: Any) -> bool: ... + def same(self, other: Any) -> bool: ... + @property + def track(self) -> _TrackKind: ... + @track.setter + def track(self, val: _TrackKind) -> None: ... + def update(self) -> None: ... diff --git a/stubs/watchpoints/watchpoints/watch_print.pyi b/stubs/watchpoints/watchpoints/watch_print.pyi new file mode 100644 index 000000000000..2e07c301ef42 --- /dev/null +++ b/stubs/watchpoints/watchpoints/watch_print.pyi @@ -0,0 +1,21 @@ +from _typeshed import SupportsWrite +from collections.abc import Callable +from types import FrameType +from typing import Any + +from .watch_element import WatchElement + +class WatchPrint: + custom_printer: Callable[[Any], None] | None + file: str | SupportsWrite[str] | None + stack_limit: int | None + + def __init__( + self, + file: str | SupportsWrite[str] | None = ..., + stack_limit: int | None = ..., + custom_printer: Callable[[Any], None] | None = ..., + ) -> None: ... + def __call__(self, frame: FrameType, elem: WatchElement, exec_info: tuple[str, str, int | None]) -> None: ... + def getsourceline(self, exec_info: tuple[str, str, int | None]) -> str: ... + def printer(self, obj: Any) -> None: ... From fa52c08316cf9f825979506fd758583e60e9d5a1 Mon Sep 17 00:00:00 2001 From: bzoracler Date: Sat, 14 Dec 2024 22:57:48 +1300 Subject: [PATCH 02/10] chore: pin to long-term version --- stubs/watchpoints/METADATA.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/stubs/watchpoints/METADATA.toml b/stubs/watchpoints/METADATA.toml index 9607e41191d6..0d08dbc0d9da 100644 --- a/stubs/watchpoints/METADATA.toml +++ b/stubs/watchpoints/METADATA.toml @@ -1,2 +1,2 @@ -version = "0.2.*" +version = "0.2.5" upstream_repository = "https://github.com/gaogaotiantian/watchpoints" From bb1bee3ee4a49ddf42fa1812b31ab9a26fada19c Mon Sep 17 00:00:00 2001 From: bzoracler Date: Sun, 15 Dec 2024 08:28:05 +1300 Subject: [PATCH 03/10] fix: remove `Final` due to module import assignment --- stubs/watchpoints/watchpoints/__init__.pyi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/stubs/watchpoints/watchpoints/__init__.pyi b/stubs/watchpoints/watchpoints/__init__.pyi index fad5cb82ff68..029c7e26a1de 100644 --- a/stubs/watchpoints/watchpoints/__init__.pyi +++ b/stubs/watchpoints/watchpoints/__init__.pyi @@ -6,5 +6,5 @@ from .watch import Watch __version__: Final[LiteralString] all: Final[list[Literal["watch", "unwatch"]]] -watch: Final[Watch] +watch: Watch unwatch: Final = watch.unwatch From 700240d324ef3df5b4da72dbc278246cdee13fd8 Mon Sep 17 00:00:00 2001 From: bzoracler Date: Sun, 15 Dec 2024 08:45:05 +1300 Subject: [PATCH 04/10] fix: pytype compatibility --- stubs/watchpoints/watchpoints/__init__.pyi | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/stubs/watchpoints/watchpoints/__init__.pyi b/stubs/watchpoints/watchpoints/__init__.pyi index 029c7e26a1de..ccd37a1398c9 100644 --- a/stubs/watchpoints/watchpoints/__init__.pyi +++ b/stubs/watchpoints/watchpoints/__init__.pyi @@ -1,5 +1,6 @@ -from typing import Final, Literal -from typing_extensions import LiteralString +from collections.abc import Callable +from typing import Any, Final, Literal +from typing_extensions import LiteralString, Unpack from .watch import Watch @@ -7,4 +8,4 @@ __version__: Final[LiteralString] all: Final[list[Literal["watch", "unwatch"]]] watch: Watch -unwatch: Final = watch.unwatch +unwatch: Final[Callable[[Unpack[tuple[Any, ...]]], None]] From 54a3ee1416c0d3235742929a3fd2438143c96d27 Mon Sep 17 00:00:00 2001 From: bzoracler Date: Sun, 15 Dec 2024 09:00:14 +1300 Subject: [PATCH 05/10] improvement: Switch to `object` where possible --- stubs/watchpoints/watchpoints/__init__.pyi | 4 ++-- stubs/watchpoints/watchpoints/watch.pyi | 8 ++++---- stubs/watchpoints/watchpoints/watch_element.pyi | 6 +++--- stubs/watchpoints/watchpoints/watch_print.pyi | 2 +- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/stubs/watchpoints/watchpoints/__init__.pyi b/stubs/watchpoints/watchpoints/__init__.pyi index ccd37a1398c9..573d5e346208 100644 --- a/stubs/watchpoints/watchpoints/__init__.pyi +++ b/stubs/watchpoints/watchpoints/__init__.pyi @@ -1,5 +1,5 @@ from collections.abc import Callable -from typing import Any, Final, Literal +from typing import Final, Literal from typing_extensions import LiteralString, Unpack from .watch import Watch @@ -8,4 +8,4 @@ __version__: Final[LiteralString] all: Final[list[Literal["watch", "unwatch"]]] watch: Watch -unwatch: Final[Callable[[Unpack[tuple[Any, ...]]], None]] +unwatch: Final[Callable[[Unpack[tuple[object, ...]]], None]] diff --git a/stubs/watchpoints/watchpoints/watch.pyi b/stubs/watchpoints/watchpoints/watch.pyi index 650850349a62..9340c0c3f982 100644 --- a/stubs/watchpoints/watchpoints/watch.pyi +++ b/stubs/watchpoints/watchpoints/watch.pyi @@ -31,7 +31,7 @@ class Watch: def __init__(self) -> None: ... def __call__( self, - *args: Any, + *args: object, alias: str = ..., callback: Callable[[FrameType, WatchElement, tuple[str, str, int | None]], None] = ..., cmp: Callable[[Any, Any], bool] = ..., @@ -56,9 +56,9 @@ class Watch: def restore(self) -> None: ... def start_trace(self, frame: FrameType) -> None: ... def stop_trace(self, frame: FrameType) -> None: ... - def tracefunc(self, frame: FrameType, event: str, arg: Any) -> _TraceFunc: ... + def tracefunc(self, frame: FrameType, event: str, arg: object) -> _TraceFunc: ... def uninstall(self, func: _Identifier = "watch") -> None: ... - def unwatch(self, *args: Any) -> None: ... + def unwatch(self, *args: object) -> None: ... class _TraceFunc(Protocol): - def __call__(self, frame: FrameType, event: str, arg: Any) -> _TraceFunc: ... + def __call__(self, frame: FrameType, event: str, arg: object) -> _TraceFunc: ... diff --git a/stubs/watchpoints/watchpoints/watch_element.pyi b/stubs/watchpoints/watchpoints/watch_element.pyi index 5a8f0b23fc45..d6687441fa09 100644 --- a/stubs/watchpoints/watchpoints/watch_element.pyi +++ b/stubs/watchpoints/watchpoints/watch_element.pyi @@ -42,10 +42,10 @@ class WatchElement: watch_print: WatchPrint = ..., when: Callable[[Any], bool] | None = ..., ) -> None: ... - def belong_to(self, lst: Iterable[Any]) -> bool: ... + def belong_to(self, lst: Iterable[object]) -> bool: ... def changed(self, frame: FrameType) -> tuple[bool, bool]: ... - def obj_changed(self, other: Any) -> bool: ... - def same(self, other: Any) -> bool: ... + def obj_changed(self, other: object) -> bool: ... + def same(self, other: object) -> bool: ... @property def track(self) -> _TrackKind: ... @track.setter diff --git a/stubs/watchpoints/watchpoints/watch_print.pyi b/stubs/watchpoints/watchpoints/watch_print.pyi index 2e07c301ef42..3dc020aad5dc 100644 --- a/stubs/watchpoints/watchpoints/watch_print.pyi +++ b/stubs/watchpoints/watchpoints/watch_print.pyi @@ -18,4 +18,4 @@ class WatchPrint: ) -> None: ... def __call__(self, frame: FrameType, elem: WatchElement, exec_info: tuple[str, str, int | None]) -> None: ... def getsourceline(self, exec_info: tuple[str, str, int | None]) -> str: ... - def printer(self, obj: Any) -> None: ... + def printer(self, obj: object) -> None: ... From fcb96918ddbce593df4f5dcb8aff3a56b7ad9abe Mon Sep 17 00:00:00 2001 From: bzoracler Date: Tue, 24 Dec 2024 12:40:43 +1300 Subject: [PATCH 06/10] docs: add reasons for using `typing.Any` --- stubs/watchpoints/watchpoints/watch.pyi | 10 +++++++--- stubs/watchpoints/watchpoints/watch_element.pyi | 7 +++++-- stubs/watchpoints/watchpoints/watch_print.pyi | 5 ++++- 3 files changed, 16 insertions(+), 6 deletions(-) diff --git a/stubs/watchpoints/watchpoints/watch.pyi b/stubs/watchpoints/watchpoints/watch.pyi index 9340c0c3f982..320bc4afdbac 100644 --- a/stubs/watchpoints/watchpoints/watch.pyi +++ b/stubs/watchpoints/watchpoints/watch.pyi @@ -17,6 +17,9 @@ _T = TypeVar("_T") _Identifier: TypeAlias = str class Watch: + # User-defined callbacks passed to `__call__()` or `config()` set as instance variables have arguments of type `Any` to be + # compatible with more precisely-annotated signatures. + custom_printer: Callable[[Any], None] | None enable: bool file: str | SupportsWrite[str] | None @@ -34,14 +37,15 @@ class Watch: *args: object, alias: str = ..., callback: Callable[[FrameType, WatchElement, tuple[str, str, int | None]], None] = ..., - cmp: Callable[[Any, Any], bool] = ..., + cmp: Callable[[Any, Any], bool] = ..., # User-defined comparison callback; compares 2 arguments of any type copy: Callable[[_T], _T] = ..., + # User-defined printing callback; writes a string representation of any object to a stream custom_printer: Callable[[Any], None] = ..., deepcopy: bool = False, file: str | SupportsWrite[str] = ..., stack_limit: int | None = 5, track: Literal["object", "variable"] = ..., - when: Callable[[Any], bool] = ..., + when: Callable[[Any], bool] = ..., # User-defined callback for conditional watchpoints ) -> None: ... def config( self, @@ -50,7 +54,7 @@ class Watch: pdb: Literal[True] = ..., file: str | SupportsWrite[str] = ..., stack_limit: int | None = 5, - custom_printer: Callable[[Any], None] = ..., + custom_printer: Callable[[Any], None] = ..., # User-defined printing callback ) -> None: ... def install(self, func: _Identifier = "watch") -> None: ... def restore(self) -> None: ... diff --git a/stubs/watchpoints/watchpoints/watch_element.pyi b/stubs/watchpoints/watchpoints/watch_element.pyi index d6687441fa09..6793f539751d 100644 --- a/stubs/watchpoints/watchpoints/watch_element.pyi +++ b/stubs/watchpoints/watchpoints/watch_element.pyi @@ -10,6 +10,9 @@ _T = TypeVar("_T") _TrackKind: TypeAlias = Literal["object", "variable"] | list[Literal["object", "variable"]] class WatchElement: + # User-defined callbacks passed to `__init__` set as instance variables have arguments of type `Any` to be + # compatible with more precisely-annotated signatures. These callbacks are passed from `watchpoints.watch.Watch`. + alias: str | None attr: str | None cmp: Callable[[Any, Any], bool] | None @@ -34,13 +37,13 @@ class WatchElement: *, alias: str | None = ..., callback: Callable[[FrameType, WatchElement, tuple[str, str, int | None]], None] | None = ..., - cmp: Callable[[Any, Any], bool] | None = ..., + cmp: Callable[[Any, Any], bool] | None = ..., # User-defined comparison callback copy: Callable[[_T], _T] | None = ..., deepcopy: bool = False, default_alias: str | None = ..., track: _TrackKind = ..., watch_print: WatchPrint = ..., - when: Callable[[Any], bool] | None = ..., + when: Callable[[Any], bool] | None = ..., # User-defined callback for conditional watchpoints ) -> None: ... def belong_to(self, lst: Iterable[object]) -> bool: ... def changed(self, frame: FrameType) -> tuple[bool, bool]: ... diff --git a/stubs/watchpoints/watchpoints/watch_print.pyi b/stubs/watchpoints/watchpoints/watch_print.pyi index 3dc020aad5dc..715d914daf07 100644 --- a/stubs/watchpoints/watchpoints/watch_print.pyi +++ b/stubs/watchpoints/watchpoints/watch_print.pyi @@ -6,6 +6,9 @@ from typing import Any from .watch_element import WatchElement class WatchPrint: + # User-defined callbacks passed to `__init__` set as instance variables have arguments of type `Any` to be + # compatible with more precisely-annotated signatures. These callbacks are passed from `watchpoints.watch.Watch`. + custom_printer: Callable[[Any], None] | None file: str | SupportsWrite[str] | None stack_limit: int | None @@ -14,7 +17,7 @@ class WatchPrint: self, file: str | SupportsWrite[str] | None = ..., stack_limit: int | None = ..., - custom_printer: Callable[[Any], None] | None = ..., + custom_printer: Callable[[Any], None] | None = ..., # User-defined printing callback ) -> None: ... def __call__(self, frame: FrameType, elem: WatchElement, exec_info: tuple[str, str, int | None]) -> None: ... def getsourceline(self, exec_info: tuple[str, str, int | None]) -> str: ... From 7ae5b5cc68bbac71bb289d79ce082f972b1a977c Mon Sep 17 00:00:00 2001 From: bzoracler Date: Tue, 24 Dec 2024 12:46:44 +1300 Subject: [PATCH 07/10] fix: remove misspelled runtime variable --- stubs/watchpoints/@tests/stubtest_allowlist.txt | 1 + stubs/watchpoints/watchpoints/__init__.pyi | 3 +-- 2 files changed, 2 insertions(+), 2 deletions(-) create mode 100644 stubs/watchpoints/@tests/stubtest_allowlist.txt diff --git a/stubs/watchpoints/@tests/stubtest_allowlist.txt b/stubs/watchpoints/@tests/stubtest_allowlist.txt new file mode 100644 index 000000000000..5755d26ce61f --- /dev/null +++ b/stubs/watchpoints/@tests/stubtest_allowlist.txt @@ -0,0 +1 @@ +watchpoints.all diff --git a/stubs/watchpoints/watchpoints/__init__.pyi b/stubs/watchpoints/watchpoints/__init__.pyi index 573d5e346208..53f34b3a1610 100644 --- a/stubs/watchpoints/watchpoints/__init__.pyi +++ b/stubs/watchpoints/watchpoints/__init__.pyi @@ -1,11 +1,10 @@ from collections.abc import Callable -from typing import Final, Literal +from typing import Final from typing_extensions import LiteralString, Unpack from .watch import Watch __version__: Final[LiteralString] -all: Final[list[Literal["watch", "unwatch"]]] watch: Watch unwatch: Final[Callable[[Unpack[tuple[object, ...]]], None]] From ec50c22b4c6b46a76918fa0b25b88582722b19ca Mon Sep 17 00:00:00 2001 From: bzoracler Date: Tue, 24 Dec 2024 12:49:26 +1300 Subject: [PATCH 08/10] fix: hide implementation detail of tuple iterable --- stubs/watchpoints/watchpoints/util.pyi | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/stubs/watchpoints/watchpoints/util.pyi b/stubs/watchpoints/watchpoints/util.pyi index 760ab4d20219..37d456070dbc 100644 --- a/stubs/watchpoints/watchpoints/util.pyi +++ b/stubs/watchpoints/watchpoints/util.pyi @@ -1,5 +1,6 @@ import ast +from collections.abc import Iterable from types import FrameType def getline(frame: FrameType) -> str: ... -def getargnodes(frame: FrameType) -> zip[tuple[ast.expr, str]]: ... +def getargnodes(frame: FrameType) -> Iterable[tuple[ast.expr, str]]: ... From 3a1f44441527c593d0efe919c501ddd645eeb015 Mon Sep 17 00:00:00 2001 From: bzoracler Date: Tue, 24 Dec 2024 12:52:27 +1300 Subject: [PATCH 09/10] fix: allow class-scoped generic callable --- stubs/watchpoints/watchpoints/watch_element.pyi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/stubs/watchpoints/watchpoints/watch_element.pyi b/stubs/watchpoints/watchpoints/watch_element.pyi index 6793f539751d..6558f4178f4f 100644 --- a/stubs/watchpoints/watchpoints/watch_element.pyi +++ b/stubs/watchpoints/watchpoints/watch_element.pyi @@ -16,7 +16,7 @@ class WatchElement: alias: str | None attr: str | None cmp: Callable[[Any, Any], bool] | None - copy: Callable[[Any], object] | None + copy: Callable[[_T], _T] | None default_alias: str | None deepcopy: bool exist: bool From 1a3d9ea3e351c933a3b8dddc275aeac0aab65660 Mon Sep 17 00:00:00 2001 From: bzoracler Date: Tue, 24 Dec 2024 13:00:19 +1300 Subject: [PATCH 10/10] fix: Disallow generic signature again due to pyright failure --- stubs/watchpoints/watchpoints/watch_element.pyi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/stubs/watchpoints/watchpoints/watch_element.pyi b/stubs/watchpoints/watchpoints/watch_element.pyi index 6558f4178f4f..b99f7e65f1c3 100644 --- a/stubs/watchpoints/watchpoints/watch_element.pyi +++ b/stubs/watchpoints/watchpoints/watch_element.pyi @@ -16,7 +16,7 @@ class WatchElement: alias: str | None attr: str | None cmp: Callable[[Any, Any], bool] | None - copy: Callable[[_T], _T] | None + copy: Callable[[Any], object] | None # User-defined copy callback default_alias: str | None deepcopy: bool exist: bool