Skip to content

Commit

Permalink
fix(mypy): Use correct typings for set_user (#1167)
Browse files Browse the repository at this point in the history
Switch from using (Dict[str, Any]) -> None to
(Optional[Dict[str, Any]]) -> None for the `set_user` function's type
hints.
  • Loading branch information
AbhiPrasad authored Aug 20, 2021
1 parent 92fdf39 commit 832263b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion sentry_sdk/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ def set_extra(key, value):

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


Expand Down
4 changes: 2 additions & 2 deletions sentry_sdk/scope.py
Original file line number Diff line number Diff line change
Expand Up @@ -185,12 +185,12 @@ def transaction(self, value):

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

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

0 comments on commit 832263b

Please sign in to comment.