Skip to content

Commit efc5654

Browse files
committed
Resolve CodeQL warnings
1 parent f256411 commit efc5654

File tree

4 files changed

+7
-5
lines changed

4 files changed

+7
-5
lines changed

pictures/models.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ def url(self) -> str:
5050
return self.storage.url(self.name)
5151

5252
@property
53-
def height(self) -> int or None:
53+
def height(self) -> int | None:
5454
if self.aspect_ratio:
5555
return math.floor(self.width / self.aspect_ratio)
5656

pictures/utils.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,8 @@ def placeholder(width: int, height: int, alt):
8383
font_name = "DejaVuSans-Bold"
8484
elif sys.platform == "darwin":
8585
font_name = "Helvetica"
86+
else: # pragma: no cover
87+
raise RuntimeError(f"Unsupported platform: {sys.platform}")
8688
font = ImageFont.truetype(font_name, fontsize)
8789
text = unquote(f"{alt}\n<{width}x{height}>")
8890
while font.getsize(text)[0] < width / 2:

tests/testapp/__init__.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
try:
22
from .celery_app import app as celery_app
3-
3+
except ImportError: # celery is not installed
4+
__all__ = []
5+
else:
46
__all__ = ["celery_app"]
5-
except ImportError:
6-
pass

tests/testapp/settings.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@
142142
# Dramatiq
143143
try:
144144
import dramatiq # NoQA
145-
except ImportError:
145+
except ImportError: # dramatiq is not installed
146146
pass
147147
else:
148148
INSTALLED_APPS += ["django_dramatiq"]

0 commit comments

Comments
 (0)