Skip to content

Commit 832263b

Browse files
authored
fix(mypy): Use correct typings for set_user (#1167)
Switch from using (Dict[str, Any]) -> None to (Optional[Dict[str, Any]]) -> None for the `set_user` function's type hints.
1 parent 92fdf39 commit 832263b

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

sentry_sdk/api.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ def set_extra(key, value):
171171

172172
@scopemethod # noqa
173173
def set_user(value):
174-
# type: (Dict[str, Any]) -> None
174+
# type: (Optional[Dict[str, Any]]) -> None
175175
return Hub.current.scope.set_user(value)
176176

177177

sentry_sdk/scope.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -185,12 +185,12 @@ def transaction(self, value):
185185

186186
@_attr_setter
187187
def user(self, value):
188-
# type: (Dict[str, Any]) -> None
188+
# type: (Optional[Dict[str, Any]]) -> None
189189
"""When set a specific user is bound to the scope. Deprecated in favor of set_user."""
190190
self.set_user(value)
191191

192192
def set_user(self, value):
193-
# type: (Dict[str, Any]) -> None
193+
# type: (Optional[Dict[str, Any]]) -> None
194194
"""Sets a user for the scope."""
195195
self._user = value
196196
if self._session is not None:

0 commit comments

Comments
 (0)