Make one event handler function from many
(
functions: Sequence[EventHandlerFunc],
)
| 201 | |
| 202 | |
| 203 | def merge_event_handler_funcs( |
| 204 | functions: Sequence[EventHandlerFunc], |
| 205 | ) -> EventHandlerFunc: |
| 206 | """Make one event handler function from many""" |
| 207 | if not functions: |
| 208 | msg = "No event handler functions to merge" |
| 209 | raise ValueError(msg) |
| 210 | elif len(functions) == 1: |
| 211 | return functions[0] |
| 212 | |
| 213 | async def await_all_event_handlers(data: Sequence[Any]) -> None: |
| 214 | async with create_task_group() as group: |
| 215 | for func in functions: |
| 216 | group.start_soon(func, data) |
| 217 | |
| 218 | return await_all_event_handlers |
no outgoing calls