Skip to content

Commit b2a1f3f

Browse files
committed
Revert contextlib change to improve performance.
1 parent fa212b7 commit b2a1f3f

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,7 @@ lint.ignore = [
117117
"PLR091", # Too many statements/branches/arguments
118118
"PLR2004", # Magic value used in comparison, consider replacing <int> with a constant variable
119119
"RUF012", # Mutable class attributes https://github.com/astral-sh/ruff/issues/5243
120+
"SIM105", # Use contextlib.suppress(ImportError) instead of try-except-pass
120121
"SLF001", # private-member-access
121122

122123
# Should be fixed later

qrcode/compat/png.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
import contextlib
2-
31
# Try to import png library.
42
PngWriter = None
53

6-
with contextlib.suppress(ImportError):
4+
try:
75
from png import Writer as PngWriter # noqa: F401
6+
except ImportError:
7+
pass

0 commit comments

Comments
 (0)