Skip to content

Commit b7816b0

Browse files
authored
Fix multiple **kwargs type hints (getsentry#967)
A **kwargs argument should be hinted as `T`, instead of `Dict[str, T]`. The dict wrapping is already implied by the type system. See: https://mypy.readthedocs.io/en/stable/getting_started.html?highlight=kwargs#more-function-signatures
1 parent 55b8a64 commit b7816b0

File tree

3 files changed

+8
-7
lines changed

3 files changed

+8
-7
lines changed

sentry_sdk/api.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ def capture_event(
7070
event, # type: Event
7171
hint=None, # type: Optional[Hint]
7272
scope=None, # type: Optional[Any]
73-
**scope_args # type: Dict[str, Any]
73+
**scope_args # type: Any
7474
):
7575
# type: (...) -> Optional[str]
7676
return Hub.current.capture_event(event, hint, scope=scope, **scope_args)
@@ -81,7 +81,7 @@ def capture_message(
8181
message, # type: str
8282
level=None, # type: Optional[str]
8383
scope=None, # type: Optional[Any]
84-
**scope_args # type: Dict[str, Any]
84+
**scope_args # type: Any
8585
):
8686
# type: (...) -> Optional[str]
8787
return Hub.current.capture_message(message, level, scope=scope, **scope_args)
@@ -91,7 +91,7 @@ def capture_message(
9191
def capture_exception(
9292
error=None, # type: Optional[Union[BaseException, ExcInfo]]
9393
scope=None, # type: Optional[Any]
94-
**scope_args # type: Dict[str, Any]
94+
**scope_args # type: Any
9595
):
9696
# type: (...) -> Optional[str]
9797
return Hub.current.capture_exception(error, scope=scope, **scope_args)

sentry_sdk/hub.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -311,7 +311,7 @@ def capture_event(
311311
event, # type: Event
312312
hint=None, # type: Optional[Hint]
313313
scope=None, # type: Optional[Any]
314-
**scope_args # type: Dict[str, Any]
314+
**scope_args # type: Any
315315
):
316316
# type: (...) -> Optional[str]
317317
"""Captures an event. Alias of :py:meth:`sentry_sdk.Client.capture_event`."""
@@ -329,7 +329,7 @@ def capture_message(
329329
message, # type: str
330330
level=None, # type: Optional[str]
331331
scope=None, # type: Optional[Any]
332-
**scope_args # type: Dict[str, Any]
332+
**scope_args # type: Any
333333
):
334334
# type: (...) -> Optional[str]
335335
"""Captures a message. The message is just a string. If no level
@@ -349,7 +349,7 @@ def capture_exception(
349349
self,
350350
error=None, # type: Optional[Union[BaseException, ExcInfo]]
351351
scope=None, # type: Optional[Any]
352-
**scope_args # type: Dict[str, Any]
352+
**scope_args # type: Any
353353
):
354354
# type: (...) -> Optional[str]
355355
"""Captures an exception.

sentry_sdk/integrations/chalice.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717

1818
if MYPY:
1919
from typing import Any
20+
from typing import Dict
2021
from typing import TypeVar
2122
from typing import Callable
2223

@@ -110,7 +111,7 @@ def setup_once():
110111
)
111112

112113
def sentry_event_response(app, view_function, function_args):
113-
# type: (Any, F, **Any) -> Any
114+
# type: (Any, F, Dict[str, Any]) -> Any
114115
wrapped_view_function = _get_view_function_response(
115116
app, view_function, function_args
116117
)

0 commit comments

Comments
 (0)