Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ref: unify signature of get_annotations #74870

Merged
merged 1 commit into from
Jul 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/sentry/plugins/base/v2.py
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,7 @@ def get_actions(self, request, group) -> list[tuple[str, str]]:
"""
return []

def get_annotations(self, group, **kwargs):
def get_annotations(self, group) -> list[dict[str, str]]:
"""
Return a list of annotations to append to this aggregate.

Expand All @@ -340,7 +340,7 @@ def get_annotations(self, group, **kwargs):
The properties of each tag must match the constructor for
:class:`sentry.plugins.Annotation`

>>> def get_annotations(self, group, **kwargs):
>>> def get_annotations(self, group):
>>> task_id = GroupMeta.objects.get_value(group, 'myplugin:tid')
>>> if not task_id:
>>> return []
Expand Down
2 changes: 1 addition & 1 deletion src/sentry/templatetags/sentry_plugins.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def get_actions(group, request):


@register.filter
def get_annotations(group, request=None):
def get_annotations(group, request=None) -> list[dict[str, str]]:
project = group.project

annotation_list = []
Expand Down
2 changes: 1 addition & 1 deletion tests/sentry/templatetags/test_sentry_plugins.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class SamplePlugin(Plugin2):
def get_actions(self, request, group) -> list[tuple[str, str]]:
return [("Example Action", f"http://example.com?id={group.id}")]

def get_annotations(self, group):
def get_annotations(self, group) -> list[dict[str, str]]:
return [
{"label": "Example Tag", "url": f"http://example.com?id={group.id}"},
{"label": "Example Two"},
Expand Down
Loading