Skip to content

Commit

Permalink
fix-linter
Browse files Browse the repository at this point in the history
  • Loading branch information
Gleekzone committed Sep 9, 2020
1 parent 6614fad commit a25e324
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 3 deletions.
2 changes: 2 additions & 0 deletions mypy.ini
Original file line number Diff line number Diff line change
Expand Up @@ -54,3 +54,5 @@ ignore_missing_imports = True
ignore_missing_imports = True
[mypy-pure_eval.*]
ignore_missing_imports = True
[mypy-chalice.*]
ignore_missing_imports = True
19 changes: 16 additions & 3 deletions sentry_sdk/integrations/chalice.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,21 @@
capture_internal_exceptions,
event_from_exception,
)
from sentry_sdk._types import MYPY

if MYPY:
from typing import Any
from typing import TypeVar
from typing import Callable

F = TypeVar("F", bound=Callable[..., Any])


class EventSourceHandler(ChaliceEventSourceHandler):
def __call__(self, event, context):
# type: (Any, Any) -> Any
hub = Hub.current
client = hub.client
client = hub.client # type: Any

with hub.push_scope() as scope:
with capture_internal_exceptions():
Expand All @@ -41,10 +50,12 @@ def __call__(self, event, context):


def _get_view_function_response(app, view_function, function_args):
# type: (Any, F, Any) -> F
@wraps(view_function)
def wrapped_view_function(**function_args):
# type: (**Any) -> Any
hub = Hub.current
client = hub.client
client = hub.client # type: Any
with hub.push_scope() as scope:
with capture_internal_exceptions():
configured_time = app.lambda_context.get_remaining_time_in_millis()
Expand All @@ -71,17 +82,19 @@ def wrapped_view_function(**function_args):
hub.flush()
raise

return wrapped_view_function
return wrapped_view_function # type: ignore


class ChaliceIntegration(Integration):
identifier = "chalice"

@staticmethod
def setup_once():
# type: () -> None
old_get_view_function_response = Chalice._get_view_function_response

def sentry_event_response(app, view_function, function_args):
# type: (Any, F, **Any) -> Any
wrapped_view_function = _get_view_function_response(
app, view_function, function_args
)
Expand Down

0 comments on commit a25e324

Please sign in to comment.