Skip to content

Commit 7ee04e6

Browse files
committed
Ruff fix
1 parent 9ed51ce commit 7ee04e6

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

plugwise_usb/helpers/cache.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
from asyncio import get_running_loop
66
import logging
7+
from contextlib import suppress
78
from os import getenv as os_getenv, getpid as os_getpid, name as os_name
89
from os.path import expanduser as os_path_expand_user, join as os_path_join
910
from pathlib import Path
@@ -148,10 +149,8 @@ async def write_cache(self, data: dict[str, str], rewrite: bool = False) -> None
148149
finally:
149150
# Cleanup on error
150151
if temp_path and temp_path.exists():
151-
try:
152+
with suppress(OSError):
152153
temp_path.unlink()
153-
except OSError:
154-
pass
155154

156155
async def read_cache(self) -> dict[str, str]:
157156
"""Return current data from cache file."""

0 commit comments

Comments
 (0)