[ty] Sync vendored typeshed stubs (#20394)

Close and reopen this PR to trigger CI

---------

Co-authored-by: typeshedbot <>
Co-authored-by: David Peter <mail@david-peter.de>
This commit is contained in:
github-actions[bot] 2025-09-15 09:30:28 +02:00 committed by GitHub
parent 9e4acd8bdd
commit 276ee1bb1e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 53 additions and 39 deletions

View File

@ -409,13 +409,13 @@ f(**kwargs<CURSOR>)
assert_snapshot!(test.goto_type_definition(), @r#" assert_snapshot!(test.goto_type_definition(), @r#"
info[goto-type-definition]: Type definition info[goto-type-definition]: Type definition
--> stdlib/builtins.pyi:2917:7 --> stdlib/builtins.pyi:2916:7
| |
2916 | @disjoint_base 2915 | @disjoint_base
2917 | class dict(MutableMapping[_KT, _VT]): 2916 | class dict(MutableMapping[_KT, _VT]):
| ^^^^ | ^^^^
2918 | """dict() -> new empty dictionary 2917 | """dict() -> new empty dictionary
2919 | dict(mapping) -> new dictionary initialized from a mapping object's 2918 | dict(mapping) -> new dictionary initialized from a mapping object's
| |
info: Source info: Source
--> main.py:6:5 --> main.py:6:5

View File

@ -1 +1 @@
2480d7e7c74493a024eaf254c5d2c6f452c80ee2 47dbbd6c914a5190d54bc5bd498d1e6633d97db2

View File

@ -939,35 +939,42 @@ class AbstractEventLoop:
async def shutdown_default_executor(self) -> None: async def shutdown_default_executor(self) -> None:
"""Schedule the shutdown of the default executor.""" """Schedule the shutdown of the default executor."""
# This class does not exist at runtime, but stubtest complains if it's marked as if sys.version_info >= (3, 14):
# @type_check_only because it has an alias that does exist at runtime. See mypy#19568. class _AbstractEventLoopPolicy:
# @type_check_only """Abstract policy for accessing the event loop."""
class _AbstractEventLoopPolicy:
"""Abstract policy for accessing the event loop."""
@abstractmethod @abstractmethod
def get_event_loop(self) -> AbstractEventLoop: def get_event_loop(self) -> AbstractEventLoop:
"""Get the event loop for the current context. """Get the event loop for the current context.
Returns an event loop object implementing the AbstractEventLoop interface, Returns an event loop object implementing the AbstractEventLoop interface,
or raises an exception in case no event loop has been set for the or raises an exception in case no event loop has been set for the
current context and the current policy does not specify to create one. current context and the current policy does not specify to create one.
It should never return None. It should never return None.
""" """
@abstractmethod @abstractmethod
def set_event_loop(self, loop: AbstractEventLoop | None) -> None: def set_event_loop(self, loop: AbstractEventLoop | None) -> None:
"""Set the event loop for the current context to loop.""" """Set the event loop for the current context to loop."""
@abstractmethod @abstractmethod
def new_event_loop(self) -> AbstractEventLoop: def new_event_loop(self) -> AbstractEventLoop:
"""Create and return a new event loop object according to this """Create and return a new event loop object according to this
policy's rules. If there's need to set this loop as the event loop for policy's rules. If there's need to set this loop as the event loop for
the current context, set_event_loop must be called explicitly. the current context, set_event_loop must be called explicitly.
""" """
# Child processes handling (Unix only).
if sys.version_info < (3, 14): else:
@type_check_only
class _AbstractEventLoopPolicy:
@abstractmethod
def get_event_loop(self) -> AbstractEventLoop: ...
@abstractmethod
def set_event_loop(self, loop: AbstractEventLoop | None) -> None: ...
@abstractmethod
def new_event_loop(self) -> AbstractEventLoop: ...
# Child processes handling (Unix only).
if sys.version_info >= (3, 12): if sys.version_info >= (3, 12):
@abstractmethod @abstractmethod
@deprecated("Deprecated since Python 3.12; removed in Python 3.14.") @deprecated("Deprecated since Python 3.12; removed in Python 3.14.")
@ -981,7 +988,6 @@ class _AbstractEventLoopPolicy:
@abstractmethod @abstractmethod
def set_child_watcher(self, watcher: AbstractChildWatcher) -> None: ... def set_child_watcher(self, watcher: AbstractChildWatcher) -> None: ...
if sys.version_info < (3, 14):
AbstractEventLoopPolicy = _AbstractEventLoopPolicy AbstractEventLoopPolicy = _AbstractEventLoopPolicy
if sys.version_info >= (3, 14): if sys.version_info >= (3, 14):

View File

@ -2687,8 +2687,7 @@ class slice(Generic[_StartT_co, _StopT_co, _StepT_co]):
handling of normal slices. handling of normal slices.
""" """
# Making this a disjoint_base upsets pyright @disjoint_base
# @disjoint_base
class tuple(Sequence[_T_co]): class tuple(Sequence[_T_co]):
"""Built-in immutable sequence. """Built-in immutable sequence.
@ -3355,10 +3354,8 @@ class property:
def __delete__(self, instance: Any, /) -> None: def __delete__(self, instance: Any, /) -> None:
"""Delete an attribute of instance.""" """Delete an attribute of instance."""
# This class does not exist at runtime, but stubtest complains if it's marked as
# @type_check_only because it has an alias that does exist at runtime. See mypy#19568.
# @type_check_only
@final @final
@type_check_only
class _NotImplementedType(Any): class _NotImplementedType(Any):
__call__: None __call__: None

View File

@ -1930,7 +1930,8 @@ class RawTurtle(TPen, TNavigator): # type: ignore[misc] # Conflicting methods
>>> turtle.end_fill() >>> turtle.end_fill()
""" """
def dot(self, size: int | None = None, *color: _Color) -> None: @overload
def dot(self, size: int | _Color | None = None) -> None:
"""Draw a dot with diameter size, using color. """Draw a dot with diameter size, using color.
Optional arguments: Optional arguments:
@ -1945,6 +1946,10 @@ class RawTurtle(TPen, TNavigator): # type: ignore[misc] # Conflicting methods
>>> turtle.fd(50); turtle.dot(20, "blue"); turtle.fd(50) >>> turtle.fd(50); turtle.dot(20, "blue"); turtle.fd(50)
""" """
@overload
def dot(self, size: int | None, color: _Color, /) -> None: ...
@overload
def dot(self, size: int | None, r: float, g: float, b: float, /) -> None: ...
def write( def write(
self, arg: object, move: bool = False, align: str = "left", font: tuple[str, int, str] = ("Arial", 8, "normal") self, arg: object, move: bool = False, align: str = "left", font: tuple[str, int, str] = ("Arial", 8, "normal")
) -> None: ) -> None:
@ -3827,7 +3832,8 @@ def end_fill() -> None:
>>> end_fill() >>> end_fill()
""" """
def dot(size: int | None = None, *color: _Color) -> None: @overload
def dot(size: int | _Color | None = None) -> None:
"""Draw a dot with diameter size, using color. """Draw a dot with diameter size, using color.
Optional arguments: Optional arguments:
@ -3842,6 +3848,10 @@ def dot(size: int | None = None, *color: _Color) -> None:
>>> fd(50); dot(20, "blue"); fd(50) >>> fd(50); dot(20, "blue"); fd(50)
""" """
@overload
def dot(size: int | None, color: _Color, /) -> None: ...
@overload
def dot(size: int | None, r: float, g: float, b: float, /) -> None: ...
def write(arg: object, move: bool = False, align: str = "left", font: tuple[str, int, str] = ("Arial", 8, "normal")) -> None: def write(arg: object, move: bool = False, align: str = "left", font: tuple[str, int, str] = ("Arial", 8, "normal")) -> None:
"""Write text at the current turtle position. """Write text at the current turtle position.

View File

@ -853,7 +853,8 @@ class MagicProxy(Base):
def create_mock(self) -> Any: ... def create_mock(self) -> Any: ...
def __get__(self, obj: Any, _type: Any | None = None) -> Any: ... def __get__(self, obj: Any, _type: Any | None = None) -> Any: ...
class _ANY: # See https://github.com/python/typeshed/issues/14701
class _ANY(Any):
"""A helper object that compares equal to everything.""" """A helper object that compares equal to everything."""
def __eq__(self, other: object) -> Literal[True]: ... def __eq__(self, other: object) -> Literal[True]: ...