Skip to content

Commit 6ad8c28

Browse files
authored
♻️ Use contextlib.suppress instead of except: pass
Signed-off-by: Paillat <[email protected]>
1 parent b0c0c91 commit 6ad8c28

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

discord/client.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
from __future__ import annotations
2727

2828
import asyncio
29+
import contextlib
2930
import inspect
3031
import logging
3132
import sys
@@ -262,10 +263,8 @@ def __init__(
262263
self.ws: DiscordWebSocket = None # type: ignore
263264

264265
if loop is None:
265-
try:
266+
with contextlib.suppress(RuntimeError):
266267
loop = asyncio.get_running_loop()
267-
except RuntimeError:
268-
pass
269268

270269
self._loop: asyncio.AbstractEventLoop | None = loop
271270
self._listeners: dict[str, list[tuple[asyncio.Future, Callable[..., bool]]]] = (

0 commit comments

Comments
 (0)