diff --git a/examples/async_apple_scanner.py b/examples/async_apple_scanner.py index 19691662..00744b5c 100755 --- a/examples/async_apple_scanner.py +++ b/examples/async_apple_scanner.py @@ -96,8 +96,7 @@ async def async_run(self) -> None: ALL_SERVICES, **kwargs, # type: ignore[arg-type] ) - while True: - await asyncio.sleep(1) + await asyncio.Event().wait() async def async_close(self) -> None: assert self.aiozc is not None diff --git a/examples/async_browser.py b/examples/async_browser.py index d86cfc5e..58193f70 100755 --- a/examples/async_browser.py +++ b/examples/async_browser.py @@ -74,8 +74,7 @@ async def async_run(self) -> None: self.aiobrowser = AsyncServiceBrowser( self.aiozc.zeroconf, services, handlers=[async_on_service_state_change] ) - while True: - await asyncio.sleep(1) + await asyncio.Event().wait() async def async_close(self) -> None: assert self.aiozc is not None diff --git a/examples/async_registration.py b/examples/async_registration.py index d01b15e1..5c774cad 100755 --- a/examples/async_registration.py +++ b/examples/async_registration.py @@ -24,8 +24,7 @@ async def register_services(self, infos: list[AsyncServiceInfo]) -> None: background_tasks = await asyncio.gather(*tasks) await asyncio.gather(*background_tasks) print("Finished registration, press Ctrl-C to exit...") - while True: - await asyncio.sleep(1) + await asyncio.Event().wait() async def unregister_services(self, infos: list[AsyncServiceInfo]) -> None: assert self.aiozc is not None diff --git a/pyproject.toml b/pyproject.toml index 4015b88f..eb4ead92 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -113,6 +113,7 @@ ignore = [ "PERF401", # Cython: closures inside cpdef functions not yet supported ] select = [ + "ASYNC", # async rules "B", # flake8-bugbear "C4", # flake8-comprehensions "S", # flake8-bandit