Skip to content

Commit

Permalink
ref: unify signature of get_annotations (#74870)
Browse files Browse the repository at this point in the history
mypy 1.11 points out this is inconsistent

<!-- Describe your PR here. -->
  • Loading branch information
asottile-sentry authored Jul 24, 2024
1 parent 7d03c36 commit 81988ef
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
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

0 comments on commit 81988ef

Please sign in to comment.