Mark stub-only private symbols as @type_check_only in third-party stubs (#14545)

This commit is contained in:
Brian Schubert
2025-08-08 11:29:48 +02:00
committed by GitHub
parent a358dc24e8
commit 81c8fcb2e6
131 changed files with 334 additions and 147 deletions
+4
View File
@@ -238,6 +238,7 @@ SEARCH_FUNCTION_DOMAIN: Final[int]
# Pretty Printing
@type_check_only
class _PrettyPrinter(Protocol):
# TODO: The "children" and "display_hint" methods are optional for
# pretty-printers. Unfortunately, there is no such thing as an optional
@@ -258,6 +259,7 @@ type_printers: list[gdb.types._TypePrinter]
# Filtering Frames
@type_check_only
class _FrameFilter(Protocol):
name: str
enabled: bool
@@ -920,6 +922,7 @@ class TuiWindow:
def erase(self) -> None: ...
def write(self, string: str, full_window: bool = ..., /) -> None: ...
@type_check_only
class _Window(Protocol):
def close(self) -> None: ...
def render(self) -> None: ...
@@ -962,6 +965,7 @@ class FreeProgspaceEvent(Event): ...
class SignalEvent(StopEvent):
stop_signal: str
@type_check_only
class _InferiorCallEvent(Event): ...
class InferiorCallPreEvent(_InferiorCallEvent):
+3 -2
View File
@@ -1,5 +1,5 @@
from collections.abc import Iterator
from typing import Protocol
from typing import Protocol, type_check_only
import gdb
@@ -10,13 +10,14 @@ def deep_items(type_: gdb.Type) -> Iterator[tuple[str, gdb.Field]]: ...
def get_type_recognizers() -> list[_TypeRecognizer]: ...
def apply_type_recognizers(recognizers: list[_TypeRecognizer], type_obj: gdb.Type) -> str | None: ...
def register_type_printer(locus: gdb.Objfile | gdb.Progspace | None, printer: _TypePrinter) -> None: ...
@type_check_only
class _TypePrinter(Protocol):
enabled: bool
name: str
def instantiate(self) -> _TypeRecognizer | None: ...
@type_check_only
class _TypeRecognizer(Protocol):
def recognize(self, type: gdb.Type, /) -> str | None: ...
+3 -2
View File
@@ -1,13 +1,13 @@
from collections.abc import Sequence
from re import Pattern
from typing import Protocol
from typing import Protocol, type_check_only
import gdb
def register_xmethod_matcher(
locus: gdb.Objfile | gdb.Progspace | None, matcher: XMethodMatcher, replace: bool = False
) -> None: ...
@type_check_only
class _XMethod(Protocol):
name: str
enabled: bool
@@ -31,6 +31,7 @@ class XMethodMatcher:
def __init__(self, name: str) -> None: ...
def match(self, class_type: gdb.Type, method_name: str) -> XMethodWorker | Sequence[XMethodWorker]: ...
@type_check_only
class _SimpleWorkerMethod(Protocol):
def __call__(self, *args: gdb.Value) -> object: ...