Skip to content

Commit af968b8

Browse files
committed
fix(issues): Fix mypy error in issue.id shortcut
Use explicit isinstance checks instead of to_list to satisfy mypy's type narrowing for SearchValue.raw_value.
1 parent cb65dae commit af968b8

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

src/sentry/issues/endpoints/organization_group_index.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,6 @@
6363
from sentry.models.organization import Organization
6464
from sentry.models.project import Project
6565
from sentry.search.events.constants import EQUALITY_OPERATORS
66-
from sentry.search.events.filter import to_list
6766
from sentry.search.snuba.backend import assigned_or_suggested_filter
6867
from sentry.search.snuba.executors import get_search_filter
6968
from sentry.utils.cursors import Cursor, CursorResult
@@ -178,10 +177,15 @@ def _get_issue_id_shortcut_ids(
178177
return None
179178
if sf.key.name != "issue.id" or sf.operator not in EQUALITY_OPERATORS:
180179
return None
180+
raw = sf.value.raw_value
181181
try:
182-
return [int(v) for v in to_list(sf.value.raw_value)]
182+
if isinstance(raw, (list, tuple)):
183+
return [int(v) for v in raw]
184+
if isinstance(raw, (int, float, str)):
185+
return [int(raw)]
183186
except (ValueError, TypeError):
184-
return None
187+
pass
188+
return None
185189

186190

187191
@extend_schema(tags=["Events"])

0 commit comments

Comments
 (0)