Browse Source

ref: fix types for endpoints.team_time_to_resolution (#79507)

<!-- Describe your PR here. -->
anthony sottile 4 months ago
parent
commit
119c64fae1
2 changed files with 7 additions and 1 deletions
  1. 0 1
      pyproject.toml
  2. 7 0
      src/sentry/api/endpoints/team_time_to_resolution.py

+ 0 - 1
pyproject.toml

@@ -168,7 +168,6 @@ module = [
     "sentry.api.endpoints.rule_snooze",
     "sentry.api.endpoints.team_details",
     "sentry.api.endpoints.team_release_count",
-    "sentry.api.endpoints.team_time_to_resolution",
     "sentry.api.endpoints.user_subscriptions",
     "sentry.api.event_search",
     "sentry.api.helpers.group_index.index",

+ 7 - 0
src/sentry/api/endpoints/team_time_to_resolution.py

@@ -2,6 +2,7 @@ from __future__ import annotations
 
 from collections import defaultdict
 from datetime import timedelta
+from typing import TypedDict
 
 from django.db.models import Avg, F, Q
 from django.db.models.functions import Coalesce, TruncDay
@@ -19,6 +20,11 @@ from sentry.models.grouphistory import GroupHistory, GroupHistoryStatus
 from sentry.utils.dates import floor_to_utc_day
 
 
+class _SumCount(TypedDict):
+    sum: timedelta
+    count: int
+
+
 @region_silo_endpoint
 class TeamTimeToResolutionEndpoint(TeamEndpoint, EnvironmentMixin):
     owner = ApiOwner.ISSUES
@@ -58,6 +64,7 @@ class TeamTimeToResolutionEndpoint(TeamEndpoint, EnvironmentMixin):
             )
             .annotate(avg_ttr=Avg("ttr"))
         )
+        sums: dict[str, _SumCount]
         sums = defaultdict(lambda: {"sum": timedelta(), "count": 0})
         for gh in history_list:
             key = str(gh["bucket"].date())