8000 chore: enable ASYNC ruff rules (#1528) · python-zeroconf/python-zeroconf@8c913e1 · GitHub
[go: up one dir, main page]

Skip to content

Commit 8c913e1

Browse files
authored
chore: enable ASYNC ruff rules (#1528)
1 parent 53cc868 commit 8c913e1

File tree

4 files changed

+4
-6
lines changed

4 files changed

+4
-6
lines changed

examples/async_apple_scanner.py

Lines changed: 1 addition & 2 deletions
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

Lines changed: 1 addition & 2 deletions
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

Lines changed: 1 addition & 2 deletions
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 9900 -
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

Lines changed: 1 addition & 0 deletions
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)
0