From 493a38162d993826f479e9f7dab7c833d783564c Mon Sep 17 00:00:00 2001 From: Nigel Choi <9gel@users.noreply.github.com> Date: Fri, 28 Jun 2024 11:05:30 +0800 Subject: [PATCH] make mypy happy --- dsl_buttons/__init__.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/dsl_buttons/__init__.py b/dsl_buttons/__init__.py index e8457da..71762b1 100644 --- a/dsl_buttons/__init__.py +++ b/dsl_buttons/__init__.py @@ -16,7 +16,7 @@ unlock_max_time = 3600 # max unlock is 1 hour -def button(): +def button() -> None: keepopen = False lastopen = 0 while True: @@ -54,7 +54,7 @@ def button(): r.publish("door_action", "OPEN") -async def doorlight(): +async def doorlight() -> None: lighton = p.value == 1 try: while True: @@ -70,16 +70,17 @@ async def doorlight(): print("doorlight done", flush=True) -async def runall(): +async def runall() -> None: t_button = asyncio.create_task(asyncio.to_thread(button)) t_doorlight = asyncio.create_task(doorlight()) await t_button await t_doorlight -def main(): +def main() -> int: print("dsl_buttons running", flush=True) asyncio.run(runall()) + return 0 if __name__ == "__main__":