Skip to content

Commit de4191c

Browse files
committed
chore: enable ASYNC ruff rules
1 parent 53cc868 commit de4191c

File tree

4 files changed

+4
-6
lines changed

4 files changed

+4
-6
lines changed

examples/async_apple_scanner.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -96,8 +96,7 @@ async def async_run(self) -> None:
9696
ALL_SERVICES,
9797
**kwargs, # type: ignore[arg-type]
9898
)
99-
while True:
100-
await asyncio.sleep(1)
99+
await asyncio.Event().wait()
101100

102101
async def async_close(self) -> None:
103102
assert self.aiozc is not None

examples/async_browser.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,7 @@ async def async_run(self) -> None:
7474
self.aiobrowser = AsyncServiceBrowser(
7575
self.aiozc.zeroconf, services, handlers=[async_on_service_state_change]
7676
)
77-
while True:
78-
await asyncio.sleep(1)
77+
await asyncio.Event().wait()
7978

8079
async def async_close(self) -> None:
8180
assert self.aiozc is not None

examples/async_registration.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,7 @@ async def register_services(self, infos: list[AsyncServiceInfo]) -> None:
2424
background_tasks = await asyncio.gather(*tasks)
2525
await asyncio.gather(*background_tasks)
2626
print("Finished registration, press Ctrl-C to exit...")
27-
while True:
28-
await asyncio.sleep(1)
27+
await asyncio.Event().wait()
2928

3029
async def unregister_services(self, infos: list[AsyncServiceInfo]) -> None:
3130
assert self.aiozc is not None

pyproject.toml

+1
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,7 @@ ignore = [
113113
"PERF401", # Cython: closures inside cpdef functions not yet supported
114114
]
115115
select = [
116+
"ASYNC", # async rules
116117
"B", # flake8-bugbear
117118
"C4", # flake8-comprehensions
118119
"S", # flake8-bandit

0 commit comments

Comments
 (0)