Skip to content

Commit 8f9efae

Browse files
Apply ruff/flake8-simplify rule SIM105
SIM105 Use `contextlib.suppress(ImportError)` instead of `try`-`except`-`pass`
1 parent 82385fd commit 8f9efae

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

numcodecs/lzma.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1+
import contextlib
2+
13
_lzma = None
24
try:
35
import lzma as _lzma
46
except ImportError: # pragma: no cover
5-
try:
7+
with contextlib.suppress(ImportError):
68
from backports import lzma as _lzma
7-
except ImportError:
8-
pass
99

1010

1111
if _lzma:

0 commit comments

Comments
 (0)