1010from sentry .integrations .types import ExternalProviders
1111from sentry .notifications .services .service import notifications_service
1212from sentry .notifications .types import NotificationSettingEnum
13- from sentry .plugins .base import Notification , Plugin
13+ from sentry .plugins .base import Plugin
1414from sentry .plugins .base .configuration import react_plugin_config
15+ from sentry .plugins .base .structs import Notification
1516from sentry .shared_integrations .exceptions import ApiError
1617from sentry .types .actor import Actor , ActorType
1718
@@ -51,7 +52,7 @@ def configure(self, project, request):
5152 def get_plugin_type (self ):
5253 return "notification"
5354
54- def notify (self , notification , raise_exception = False ):
55+ def notify (self , notification : Notification , raise_exception : bool = False ) -> None :
5556 """
5657 This calls the notify_users method of the plugin.
5758 Normally this method eats the error and logs it but if we
@@ -60,7 +61,7 @@ def notify(self, notification, raise_exception=False):
6061 """
6162 event = notification .event
6263 try :
63- return self .notify_users (
64+ self .notify_users (
6465 event .group , event , triggering_rules = [r .label for r in notification .rules ]
6566 )
6667 except (
@@ -82,7 +83,6 @@ def notify(self, notification, raise_exception=False):
8283 )
8384 if raise_exception :
8485 raise
85- return False
8686
8787 def rule_notify (self , event , futures ):
8888 rules = []
@@ -180,16 +180,16 @@ def should_notify(self, group, event):
180180
181181 return True
182182
183- def test_configuration (self , project ):
183+ def test_configuration (self , project ) -> None :
184184 from sentry .utils .samples import create_sample_event
185185
186186 event = create_sample_event (project , platform = "python" )
187187 notification = Notification (event = event )
188- return self .notify (notification , raise_exception = True )
188+ self .notify (notification , raise_exception = True )
189189
190190 def test_configuration_and_get_test_results (self , project ):
191191 try :
192- test_results = self .test_configuration (project )
192+ self .test_configuration (project )
193193 except Exception as exc :
194194 if isinstance (exc , HTTPError ) and hasattr (exc .response , "text" ):
195195 test_results = f"{ exc } \n { exc .response .text [:256 ]} "
@@ -202,7 +202,7 @@ def test_configuration_and_get_test_results(self, project):
202202 test_results = (
203203 "There was an internal error with the Plugin, %s" % str (exc )[:256 ]
204204 )
205- if not test_results :
205+ else :
206206 test_results = "No errors returned"
207207 return test_results
208208
0 commit comments