Skip to content

Commit c3ddba3

Browse files
committed
fix types
1 parent 2900b59 commit c3ddba3

File tree

3 files changed

+8
-8
lines changed

3 files changed

+8
-8
lines changed

Diff for: src/idom/core/_event_proxy.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
from typing import Any, Sequence
1+
from typing import Any, Dict, Sequence
22
from warnings import warn
33

44

55
def _wrap_in_warning_event_proxies(values: Sequence[Any]) -> Sequence[Any]:
66
return [_EventProxy(x) if isinstance(x, dict) else x for x in values]
77

88

9-
class _EventProxy(dict[Any, Any]):
9+
class _EventProxy(Dict[Any, Any]):
1010
def __getitem__(self, key: Any) -> Any: # pragma: no cover
1111
try:
1212
return super().__getitem__(key)

Diff for: src/idom/core/events.py

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
from __future__ import annotations
22

33
import asyncio
4-
from typing import Any, Callable, List, Optional, Sequence, overload
4+
from typing import Any, Callable, Optional, Sequence, overload
55

66
from anyio import create_task_group
77
from typing_extensions import Literal
@@ -145,18 +145,18 @@ def to_event_handler_function(
145145
if positional_args:
146146
if asyncio.iscoroutinefunction(function):
147147

148-
async def wrapper(data: List[Any]) -> None:
148+
async def wrapper(data: Sequence[Any]) -> None:
149149
await function(*data)
150150

151151
else:
152152

153-
async def wrapper(data: List[Any]) -> None:
153+
async def wrapper(data: Sequence[Any]) -> None:
154154
function(*data)
155155

156156
return wrapper
157157
elif not asyncio.iscoroutinefunction(function):
158158

159-
async def wrapper(data: List[Any]) -> None:
159+
async def wrapper(data: Sequence[Any]) -> None:
160160
function(data)
161161

162162
return wrapper
@@ -212,7 +212,7 @@ def merge_event_handler_funcs(
212212
elif len(functions) == 1:
213213
return functions[0]
214214

215-
async def await_all_event_handlers(data: List[Any]) -> None:
215+
async def await_all_event_handlers(data: Sequence[Any]) -> None:
216216
async with create_task_group() as group:
217217
for func in functions:
218218
group.start_soon(func, data)

Diff for: src/idom/core/proto.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ class _JsonImportSource(TypedDict):
138138
class EventHandlerFunc(Protocol):
139139
"""A coroutine which can handle event data"""
140140

141-
async def __call__(self, data: List[Any]) -> None:
141+
async def __call__(self, data: Sequence[Any]) -> None:
142142
...
143143

144144

0 commit comments

Comments
 (0)