Skip to content

Commit e9f6359

Browse files
committed
add int to component values type
1 parent f9a70a8 commit e9f6359

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

src/sentry/grouping/component.py

+8-8
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
}
2424

2525

26-
def _calculate_contributes(values: Sequence[str | GroupingComponent]) -> bool:
26+
def _calculate_contributes(values: Sequence[str | int | GroupingComponent]) -> bool:
2727
for value in values or ():
2828
if not isinstance(value, GroupingComponent) or value.contributes:
2929
return True
@@ -38,14 +38,14 @@ class GroupingComponent:
3838
id: str = "default"
3939
hint: str | None
4040
contributes: bool
41-
values: Sequence[str | GroupingComponent]
41+
values: Sequence[str | int | GroupingComponent]
4242

4343
def __init__(
4444
self,
4545
id: str | None = None,
4646
hint: str | None = None,
4747
contributes: bool | None = None,
48-
values: Sequence[str | GroupingComponent] | None = None,
48+
values: Sequence[str | int | GroupingComponent] | None = None,
4949
variant_provider: bool = False,
5050
):
5151
self.id = id or self.id
@@ -54,7 +54,7 @@ def __init__(
5454
self.hint = DEFAULT_HINTS.get(self.id)
5555
self.contributes = contributes
5656
self.variant_provider = variant_provider
57-
self.values: Sequence[str | GroupingComponent] = []
57+
self.values: Sequence[str | int | GroupingComponent] = []
5858

5959
self.update(
6060
hint=hint,
@@ -89,13 +89,13 @@ def _walk_components(c: GroupingComponent, stack: list[str | None]) -> None:
8989

9090
def get_subcomponent(
9191
self, id: str, only_contributing: bool = False
92-
) -> str | GroupingComponent | None:
92+
) -> str | int | GroupingComponent | None:
9393
"""Looks up a subcomponent by the id and returns the first or `None`."""
9494
return next(self.iter_subcomponents(id=id, only_contributing=only_contributing), None)
9595

9696
def iter_subcomponents(
9797
self, id: str, recursive: bool = False, only_contributing: bool = False
98-
) -> Iterator[str | GroupingComponent | None]:
98+
) -> Iterator[str | int | GroupingComponent | None]:
9999
"""Finds all subcomponents matching an id, optionally recursively."""
100100
for value in self.values:
101101
if isinstance(value, GroupingComponent):
@@ -113,7 +113,7 @@ def update(
113113
self,
114114
hint: str | None = None,
115115
contributes: bool | None = None,
116-
values: Sequence[str | GroupingComponent] | None = None,
116+
values: Sequence[str | int | GroupingComponent] | None = None,
117117
) -> None:
118118
"""Updates an already existing component with new values."""
119119
if hint is not None:
@@ -132,7 +132,7 @@ def shallow_copy(self) -> GroupingComponent:
132132
rv.values = list(self.values)
133133
return rv
134134

135-
def iter_values(self) -> Generator[str | GroupingComponent]:
135+
def iter_values(self) -> Generator[str | int | GroupingComponent]:
136136
"""Recursively walks the component and flattens it into a list of
137137
values.
138138
"""

0 commit comments

Comments
 (0)