Skip to content

Commit 384975d

Browse files
style: use contextlib.suppress in EZSP.disconnect per ruff SIM105
ruff (the pinned v0.0.261 in pre-commit-config) flagged the simplified disconnect handler from 7cf20c0 with SIM105 (try-except-pass should be contextlib.suppress). Same behavior, idiomatic form. contextlib was already imported. Tests: 428 pass on Python 3.14.2, no behavioral change.
1 parent f43c38f commit 384975d

1 file changed

Lines changed: 3 additions & 5 deletions

File tree

bellows/ezsp/__init__.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -224,12 +224,10 @@ async def get_xncp_features(self) -> xncp.FirmwareFeatures:
224224
async def disconnect(self):
225225
self.stop_ezsp()
226226
if self._gw is not None:
227-
try:
227+
# Secondary loop closed; the proxy can't reach the gateway.
228+
# Drop the reference so the caller can rebuild from scratch.
229+
with contextlib.suppress(ConnectionError):
228230
await self._gw.disconnect()
229-
except ConnectionError:
230-
# Secondary loop closed; the proxy can't reach the gateway.
231-
# Drop the reference so the caller can rebuild from scratch.
232-
pass
233231
self._gw = None
234232

235233
async def _command(self, name: str, *args: Any, **kwargs: Any) -> Any:

0 commit comments

Comments
 (0)