Skip to content

Commit

Permalink
ref: unify signature of notify_users
Browse files Browse the repository at this point in the history
  • Loading branch information
asottile-sentry committed Jul 25, 2024
1 parent 36455ed commit f1356c8
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 7 deletions.
6 changes: 4 additions & 2 deletions src/sentry/plugins/bases/notify.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,9 @@ def notify(self, notification: Notification, raise_exception: bool = False) -> N
event = notification.event
try:
self.notify_users(
event.group, event, triggering_rules=[r.label for r in notification.rules]
group=event.group,
event=event,
triggering_rules=[r.label for r in notification.rules],
)
except (
ApiError,
Expand Down Expand Up @@ -102,7 +104,7 @@ def rule_notify(self, event, futures):
self.notify(notification)
self.logger.info("notification.dispatched", extra=extra)

def notify_users(self, group, event, triggering_rules, fail_silently=False, **kwargs):
def notify_users(self, group, event, triggering_rules) -> None:
raise NotImplementedError

def notify_about_activity(self, activity):
Expand Down
2 changes: 1 addition & 1 deletion src/sentry/plugins/sentry_webhooks/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ def get_webhook_urls(self, project):
def get_client(self, payload):
return WebhookApiClient(payload)

def notify_users(self, group, event, triggering_rules, fail_silently=False, **kwargs):
def notify_users(self, group, event, triggering_rules) -> None:
payload = self.get_group_data(group, event, triggering_rules)
client = self.get_client(payload)
for url in self.get_webhook_urls(group.project):
Expand Down
2 changes: 1 addition & 1 deletion src/sentry_plugins/opsgenie/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ def build_payload(group, event, triggering_rules):
"tags": [f'{str(x).replace(",", "")}:{str(y).replace(",", "")}' for x, y in event.tags],
}

def notify_users(self, group, event, fail_silently=False, triggering_rules=None, **kwargs):
def notify_users(self, group, event, triggering_rules) -> None:
if not self.is_configured(group.project):
return

Expand Down
2 changes: 1 addition & 1 deletion src/sentry_plugins/pagerduty/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ def get_config(self, project, user=None, initial=None, add_additional_fields: bo
},
]

def notify_users(self, group, event, fail_silently=False, **kwargs):
def notify_users(self, group, event, triggering_rules) -> None:
if not self.is_configured(group.project):
return

Expand Down
2 changes: 1 addition & 1 deletion src/sentry_plugins/twilio/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ def error_message_from_json(self, data):
return error_message
return None

def notify_users(self, group, event, **kwargs):
def notify_users(self, group, event, triggering_rules) -> None:
if not self.is_configured(group.project):
return
project = group.project
Expand Down
2 changes: 1 addition & 1 deletion src/sentry_plugins/victorops/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ def build_description(self, event):

return "\n\n".join((f"{k}\n-----------\n\n{v}" for k, v in interface_list))

def notify_users(self, group, event, fail_silently=False, **kwargs):
def notify_users(self, group, event, triggering_rules) -> None:
if not self.is_configured(group.project):
return

Expand Down

0 comments on commit f1356c8

Please sign in to comment.