Skip to content

Commit a25e324

Browse files
committed
fix-linter
1 parent 6614fad commit a25e324

2 files changed

Lines changed: 18 additions & 3 deletions

File tree

mypy.ini

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,3 +54,5 @@ ignore_missing_imports = True
5454
ignore_missing_imports = True
5555
[mypy-pure_eval.*]
5656
ignore_missing_imports = True
57+
[mypy-chalice.*]
58+
ignore_missing_imports = True

sentry_sdk/integrations/chalice.py

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,21 @@
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

1725
class 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

4352
def _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

7788
class 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

Comments
 (0)