Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix type hints
  • Loading branch information
Archmonger committed Dec 7, 2025
commit a571c28f64a8de2895d4a06a6e35dd4ddba99d2f
10 changes: 5 additions & 5 deletions src/reactpy/core/events.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import contextlib
import inspect
from collections.abc import Sequence
from typing import Any, Callable, Literal, overload
from typing import Any, Callable, Literal, cast, overload

from anyio import create_task_group

Expand Down Expand Up @@ -119,7 +119,7 @@ def __init__(

if not (stop_propagation and prevent_default):
with contextlib.suppress(Exception):
func_to_inspect = function
func_to_inspect = cast(Any, function)
while hasattr(func_to_inspect, "__wrapped__"):
func_to_inspect = func_to_inspect.__wrapped__

Expand Down Expand Up @@ -172,21 +172,21 @@ def to_event_handler_function(
async def wrapper(data: Sequence[Any]) -> None:
await function(*data)

wrapper.__wrapped__ = function
cast(Any, wrapper).__wrapped__ = function

else:

async def wrapper(data: Sequence[Any]) -> None:
function(*data)

wrapper.__wrapped__ = function
cast(Any, wrapper).__wrapped__ = function
return wrapper
elif not asyncio.iscoroutinefunction(function):

async def wrapper(data: Sequence[Any]) -> None:
function(data)

wrapper.__wrapped__ = function
cast(Any, wrapper).__wrapped__ = function
return wrapper
else:
return function
Expand Down
Loading