type event plz

This commit is contained in:
Lendemor 2024-11-22 16:03:26 +01:00
parent a5caa27264
commit e895907a49

View File

@ -93,7 +93,7 @@ class Event:
BACKGROUND_TASK_MARKER = "_reflex_background_task"
def background(fn, *, __internal_reflex_call: bool = False):
def background(fn: Callable, *, __internal_reflex_call: bool = False):
"""Decorator to mark event handler as running in the background.
Args:
@ -999,7 +999,8 @@ def download(
)
def _callback_arg_spec(eval_result):
# This function seems unused. Check if we still need it. If not, remove in 0.7.0
def _callback_arg_spec(eval_result: Any):
"""ArgSpec for call_script callback function.
Args:
@ -1106,7 +1107,7 @@ def run_script(
)
def get_event(state, event):
def get_event(state: BaseState, event: str):
"""Get the event from the given state.
Args:
@ -1119,7 +1120,7 @@ def get_event(state, event):
return f"{state.get_name()}.{event}"
def get_hydrate_event(state) -> str:
def get_hydrate_event(state: BaseState) -> str:
"""Get the name of the hydrate event for the state.
Args:
@ -1759,13 +1760,13 @@ class EventCallback(Generic[P, T]):
@overload
def __get__(
self: EventCallback[P, T], instance: None, owner
self: EventCallback[P, T], instance: None, owner: Any
) -> EventCallback[P, T]: ...
@overload
def __get__(self, instance, owner) -> Callable[P, T]: ...
def __get__(self, instance: Any, owner: Any) -> Callable[P, T]: ...
def __get__(self, instance, owner) -> Callable: # type: ignore
def __get__(self, instance: Any, owner: Any) -> Callable: # type: ignore
"""Get the function with the instance bound to it.
Args: