File tree Expand file tree Collapse file tree 2 files changed +22
-2
lines changed Expand file tree Collapse file tree 2 files changed +22
-2
lines changed Original file line number Diff line number Diff line change 6
6
)
7
7
8
8
9
- def goto_events (group_markers : list [BaseEvent ], any_return : Any ) -> _SpecialEventReturn :
9
+ def goto_events (
10
+ group_markers : list [BaseEvent ], any_return : Any = None
11
+ ) -> _SpecialEventReturn :
10
12
return _SpecialEventReturn (
11
13
behavior = ReturnBehavior .GOTO , returns = (group_markers , any_return )
12
14
)
Original file line number Diff line number Diff line change 1
- # TODO
1
+ import asyncio
2
+ from datetime import datetime
3
+ from drive_events import default_drive , EventInput
4
+ from drive_events .dynamic import goto_events
5
+
6
+
7
+ @default_drive .make_event
8
+ async def tick (event : EventInput , global_ctx ):
9
+ await asyncio .sleep (1 )
10
+ return "tick"
11
+
12
+
13
+ @default_drive .listen_groups ([tick ])
14
+ async def tok (event : EventInput , global_ctx ):
15
+ print (datetime .now (), f"{ event .results [tick .id ]} , then tok" )
16
+ return goto_events ([tick ])
17
+
18
+
19
+ asyncio .run (default_drive .invoke_event (tick ))
You can’t perform that action at this time.
0 commit comments