File tree Expand file tree Collapse file tree 1 file changed +4
-7
lines changed Expand file tree Collapse file tree 1 file changed +4
-7
lines changed Original file line number Diff line number Diff line change 3131
3232
3333class EventType (Enum ):
34- """The types of changes that can be observed."""
34+ """The types of file events that can be observed."""
3535
3636 CREATE = Change .added
3737 """The file was created."""
@@ -87,7 +87,6 @@ class FileWatcher(Receiver[Event]):
8787 ```python
8888 import asyncio
8989
90- from frequenz.channels import select, selected_from
9190 from frequenz.channels.file_watcher import EventType, FileWatcher
9291
9392 PATH = "/tmp/test.txt"
@@ -106,11 +105,9 @@ async def main() -> None:
106105 file.write("Hello, world!")
107106 async with asyncio.TaskGroup() as group:
108107 group.create_task(update_file())
109- async for selected in select(file_watcher):
110- if selected_from(selected, file_watcher):
111- event = selected.value
112- print(f"File {event.path}: {event.type.name}")
113- break
108+ async for event in file_watcher:
109+ print(f"File {event.path}: {event.type.name}")
110+ break
114111
115112
116113 asyncio.run(main())
You can’t perform that action at this time.
0 commit comments