Skip to content

Commit 062a7fa

Browse files
committed
fix(typing): Add type: ignore for order_by column types in base_query_set
Django's `query.order_by` contains `str | Combinable` but `query.annotations` expects `str` keys and `new_order_by` expects `Expression` items. These are safe at runtime; suppress for mypy 1.19+. Ref: #107727
1 parent abcaf47 commit 062a7fa

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/sentry/db/models/manager/base_query_set.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,14 +47,14 @@ def update_with_returning(
4747
# Inline annotations in order_by(), if possible.
4848
new_order_by = []
4949
for col in query.order_by:
50-
if annotation := query.annotations.get(col):
50+
if annotation := query.annotations.get(col): # type: ignore[arg-type]
5151
if getattr(annotation, "contains_aggregate", False):
5252
raise exceptions.FieldError(
5353
f"Cannot update when ordering by an aggregate: {annotation}"
5454
)
5555
new_order_by.append(annotation)
5656
else:
57-
new_order_by.append(col)
57+
new_order_by.append(col) # type: ignore[arg-type]
5858
query.order_by = tuple(new_order_by)
5959

6060
# Clear any annotations so that they won't be present in subqueries.

0 commit comments

Comments
 (0)