Repair type annotations in util.py
authorBenjamin Braatz <bb@bbraatz.eu>
Tue, 2 Mar 2021 08:49:24 +0000 (09:49 +0100)
committerBenjamin Braatz <bb@bbraatz.eu>
Tue, 2 Mar 2021 08:49:24 +0000 (09:49 +0100)
controlpi/__init__.py
controlpi/plugins/util.py

index e7d424fd3dafb54813391b3f6a4c214c2a24d9a7..8657d2aa3734d190f6328b548a477283a30f58cd 100644 (file)
@@ -95,7 +95,7 @@ import asyncio
 import collections.abc
 from typing import Mapping, Any
 
-from controlpi.messagebus import MessageBus
+from controlpi.messagebus import MessageBus, Message
 from controlpi.pluginregistry import PluginRegistry
 
 
index 7b8ec5061c097cc010a28972269cbd9598b4b35e..7d3b51149577e73e9df8041064ee56f330954930 100644 (file)
@@ -1,24 +1,24 @@
 """Provide utility plugins for all kinds of systems.
 
 TODO: documentation, doctests, check configurations
+TODO: Keyboard, State, AndState, OrState
 """
 import asyncio
 
-from controlpi import BasePlugin, PluginConfiguration
+from controlpi import BasePlugin, Message, PluginConfiguration
 
 
 class Log(BasePlugin):
-    async def _log(self, message: str) -> None:
+    async def _log(self, message: Message) -> None:
         print(f"{self._name}: {message}")
 
     def _process_conf(self, conf: PluginConfiguration) -> None:
-        receives = [{}]
         self._bus.register(self._name, [], conf['filter'], self._log)
         super()._process_conf(conf)
 
 
 class Init(BasePlugin):
-    async def _execute(self, message: str) -> None:
+    async def _execute(self, message: Message) -> None:
         for message in self._messages:
             await self._bus.send(message)
 
@@ -42,7 +42,7 @@ class Init(BasePlugin):
 
 
 class Wait(BasePlugin):
-    async def _wait(self, message: str) -> None:
+    async def _wait(self, message: Message) -> None:
         await asyncio.sleep(self._seconds)
         await self._bus.send({'sender': self._name, 'event': 'finished'})