Skip to content

Commit 8b80f6f

Browse files
ref: fix reassignment of incorrect QuerySet types (#75158)
fixes a handful of errors once mypy checks model types <!-- Describe your PR here. -->
1 parent 526ad1f commit 8b80f6f

File tree

2 files changed

+4
-5
lines changed

2 files changed

+4
-5
lines changed

src/sentry/api/endpoints/project_releases.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,11 +69,9 @@ def get(self, request: Request, project) -> Response:
6969
if query:
7070
queryset = queryset.filter(version__icontains=query)
7171

72-
queryset = queryset.extra(select={"sort": "COALESCE(date_released, date_added)"})
73-
7472
return self.paginate(
7573
request=request,
76-
queryset=queryset,
74+
queryset=queryset.extra(select={"sort": "COALESCE(date_released, date_added)"}),
7775
order_by="-sort",
7876
paginator_cls=OffsetPaginator,
7977
on_results=lambda x: serialize(

src/sentry/models/eventattachment.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
from sentry.backup.scopes import RelocationScope
1717
from sentry.db.models import BoundedBigIntegerField, Model, region_silo_model, sane_repr
1818
from sentry.db.models.fields.bounded import BoundedIntegerField
19+
from sentry.db.models.manager.base_query_set import BaseQuerySet
1920
from sentry.models.files.utils import get_size_and_checksum, get_storage
2021

2122
# Attachment file types that are considered a crash report (PII relevant)
@@ -31,8 +32,8 @@ def get_crashreport_key(group_id: int) -> str:
3132

3233

3334
def event_attachment_screenshot_filter(
34-
queryset: models.QuerySet[EventAttachment],
35-
) -> models.QuerySet[EventAttachment]:
35+
queryset: BaseQuerySet[EventAttachment],
36+
) -> BaseQuerySet[EventAttachment]:
3637
# Intentionally a hardcoded list instead of a regex since current usecases do not have more 3 screenshots
3738
return queryset.filter(
3839
name__in=[

0 commit comments

Comments
 (0)