1212 capture_internal_exceptions ,
1313 event_from_exception ,
1414)
15+ from sentry_sdk ._types import MYPY
16+
17+ if MYPY :
18+ from typing import Any
19+ from typing import TypeVar
20+ from typing import Callable
21+
22+ F = TypeVar ("F" , bound = Callable [..., Any ])
1523
1624
1725class EventSourceHandler (ChaliceEventSourceHandler ):
1826 def __call__ (self , event , context ):
27+ # type: (Any, Any) -> Any
1928 hub = Hub .current
20- client = hub .client
29+ client = hub .client # type: Any
2130
2231 with hub .push_scope () as scope :
2332 with capture_internal_exceptions ():
@@ -41,10 +50,12 @@ def __call__(self, event, context):
4150
4251
4352def _get_view_function_response (app , view_function , function_args ):
53+ # type: (Any, F, Any) -> F
4454 @wraps (view_function )
4555 def wrapped_view_function (** function_args ):
56+ # type: (**Any) -> Any
4657 hub = Hub .current
47- client = hub .client
58+ client = hub .client # type: Any
4859 with hub .push_scope () as scope :
4960 with capture_internal_exceptions ():
5061 configured_time = app .lambda_context .get_remaining_time_in_millis ()
@@ -71,17 +82,19 @@ def wrapped_view_function(**function_args):
7182 hub .flush ()
7283 raise
7384
74- return wrapped_view_function
85+ return wrapped_view_function # type: ignore
7586
7687
7788class ChaliceIntegration (Integration ):
7889 identifier = "chalice"
7990
8091 @staticmethod
8192 def setup_once ():
93+ # type: () -> None
8294 old_get_view_function_response = Chalice ._get_view_function_response
8395
8496 def sentry_event_response (app , view_function , function_args ):
97+ # type: (Any, F, **Any) -> Any
8598 wrapped_view_function = _get_view_function_response (
8699 app , view_function , function_args
87100 )
0 commit comments