Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 8c913e1

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

File tree

4 files changed

+4
-6
lines changed
Filter options

4 files changed

+4
-6
lines changed

‎examples/async_apple_scanner.py

Copy file name to clipboardExpand all lines: examples/async_apple_scanner.py
+1-2Lines 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

Copy file name to clipboardExpand all lines: examples/async_browser.py
+1-2Lines 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

Copy file name to clipboardExpand all lines: examples/async_registration.py
+1-2Lines 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-
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

Copy file name to clipboardExpand all lines: pyproject.toml
+1Lines 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)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.