add event overlords
This commit is contained in:
parent
bbaf134dfc
commit
98786d015d
@ -22,6 +22,7 @@ from typing import (
|
|||||||
TypeVar,
|
TypeVar,
|
||||||
Union,
|
Union,
|
||||||
get_type_hints,
|
get_type_hints,
|
||||||
|
overload,
|
||||||
)
|
)
|
||||||
|
|
||||||
from typing_extensions import ParamSpec, get_args, get_origin
|
from typing_extensions import ParamSpec, get_args, get_origin
|
||||||
@ -1416,6 +1417,11 @@ EventType = Union[IndividualEventType[G], List[IndividualEventType[G]]]
|
|||||||
|
|
||||||
P = ParamSpec("P")
|
P = ParamSpec("P")
|
||||||
T = TypeVar("T")
|
T = TypeVar("T")
|
||||||
|
V = TypeVar("V")
|
||||||
|
V2 = TypeVar("V2")
|
||||||
|
V3 = TypeVar("V3")
|
||||||
|
V4 = TypeVar("V4")
|
||||||
|
V5 = TypeVar("V5")
|
||||||
|
|
||||||
if sys.version_info >= (3, 10):
|
if sys.version_info >= (3, 10):
|
||||||
from typing import Concatenate
|
from typing import Concatenate
|
||||||
@ -1431,6 +1437,54 @@ if sys.version_info >= (3, 10):
|
|||||||
"""
|
"""
|
||||||
self.func = func
|
self.func = func
|
||||||
|
|
||||||
|
@overload
|
||||||
|
def __get__(
|
||||||
|
self: EventCallback[[V], T], instance: None, owner
|
||||||
|
) -> Callable[[Union[Var[V], V]], T]: ...
|
||||||
|
|
||||||
|
@overload
|
||||||
|
def __get__(
|
||||||
|
self: EventCallback[[V, V2], T], instance: None, owner
|
||||||
|
) -> Callable[[Union[Var[V], V], Union[Var[V2], V2]], T]: ...
|
||||||
|
|
||||||
|
@overload
|
||||||
|
def __get__(
|
||||||
|
self: EventCallback[[V, V2, V3], T], instance: None, owner
|
||||||
|
) -> Callable[
|
||||||
|
[Union[Var[V], V], Union[Var[V2], V2], Union[Var[V3], V3]],
|
||||||
|
T,
|
||||||
|
]: ...
|
||||||
|
|
||||||
|
@overload
|
||||||
|
def __get__(
|
||||||
|
self: EventCallback[[V, V2, V3, V4], T], instance: None, owner
|
||||||
|
) -> Callable[
|
||||||
|
[
|
||||||
|
Union[Var[V], V],
|
||||||
|
Union[Var[V2], V2],
|
||||||
|
Union[Var[V3], V3],
|
||||||
|
Union[Var[V4], V4],
|
||||||
|
],
|
||||||
|
T,
|
||||||
|
]: ...
|
||||||
|
|
||||||
|
@overload
|
||||||
|
def __get__(
|
||||||
|
self: EventCallback[[V, V2, V3, V4, V5], T], instance: None, owner
|
||||||
|
) -> Callable[
|
||||||
|
[
|
||||||
|
Union[Var[V], V],
|
||||||
|
Union[Var[V2], V2],
|
||||||
|
Union[Var[V3], V3],
|
||||||
|
Union[Var[V4], V4],
|
||||||
|
Union[Var[V5], V5],
|
||||||
|
],
|
||||||
|
T,
|
||||||
|
]: ...
|
||||||
|
|
||||||
|
@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]:
|
||||||
"""Get the function with the instance bound to it.
|
"""Get the function with the instance bound to it.
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user