EventCallback descriptor always returns EventSpec from class

Relax actual `__get__` definition to support the multitude of overloads
This commit is contained in:
Masen Furer 2024-10-15 16:54:04 -07:00
parent 98786d015d
commit 4fe8f1ad15
No known key found for this signature in database
GPG Key ID: B0008AD22B3B3A95

View File

@ -1440,19 +1440,19 @@ if sys.version_info >= (3, 10):
@overload @overload
def __get__( def __get__(
self: EventCallback[[V], T], instance: None, owner self: EventCallback[[V], T], instance: None, owner
) -> Callable[[Union[Var[V], V]], T]: ... ) -> Callable[[Union[Var[V], V]], EventSpec]: ...
@overload @overload
def __get__( def __get__(
self: EventCallback[[V, V2], T], instance: None, owner self: EventCallback[[V, V2], T], instance: None, owner
) -> Callable[[Union[Var[V], V], Union[Var[V2], V2]], T]: ... ) -> Callable[[Union[Var[V], V], Union[Var[V2], V2]], EventSpec]: ...
@overload @overload
def __get__( def __get__(
self: EventCallback[[V, V2, V3], T], instance: None, owner self: EventCallback[[V, V2, V3], T], instance: None, owner
) -> Callable[ ) -> Callable[
[Union[Var[V], V], Union[Var[V2], V2], Union[Var[V3], V3]], [Union[Var[V], V], Union[Var[V2], V2], Union[Var[V3], V3]],
T, EventSpec,
]: ... ]: ...
@overload @overload
@ -1465,7 +1465,7 @@ if sys.version_info >= (3, 10):
Union[Var[V3], V3], Union[Var[V3], V3],
Union[Var[V4], V4], Union[Var[V4], V4],
], ],
T, EventSpec,
]: ... ]: ...
@overload @overload
@ -1479,13 +1479,13 @@ if sys.version_info >= (3, 10):
Union[Var[V4], V4], Union[Var[V4], V4],
Union[Var[V5], V5], Union[Var[V5], V5],
], ],
T, EventSpec,
]: ... ]: ...
@overload @overload
def __get__(self, instance, owner) -> Callable[P, T]: ... def __get__(self, instance, owner) -> Callable[P, T]: ...
def __get__(self, instance, owner) -> Callable[P, T]: def __get__(self, instance, owner) -> Callable:
"""Get the function with the instance bound to it. """Get the function with the instance bound to it.
Args: Args: