Skip to content

Commit

Permalink
add type hints
Browse files Browse the repository at this point in the history
  • Loading branch information
mdtro committed Apr 17, 2024
1 parent 3a5f547 commit 0b2e227
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/sentry/models/apitoken.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,11 +138,11 @@ def _set_plaintext_token(self, token: str) -> None:
:param token: A plaintext string of the token
:raises PlaintextSecretAlreadyRead: when the token has already been read once
"""
existing_token = None
existing_token: str | None = None
try:
existing_token = self.__plaintext_token # type: ignore[has-type]
existing_token = self.__plaintext_token
except AttributeError:
self.__plaintext_token = token
self.__plaintext_token: str = token

if existing_token == TOKEN_REDACTED:
raise PlaintextSecretAlreadyRead()
Expand All @@ -155,11 +155,11 @@ def _set_plaintext_refresh_token(self, token: str) -> None:
:param token: A plaintext string of the refresh token
:raises PlaintextSecretAlreadyRead: if the token has already been read once
"""
existing_refresh_token = None
existing_refresh_token: str | None = None
try:
existing_refresh_token = self.__plaintext_refresh_token # type: ignore[has-type]
existing_refresh_token = self.__plaintext_refresh_token
except AttributeError:
self.__plaintext_refresh_token = token
self.__plaintext_refresh_token: str = token

if existing_refresh_token == TOKEN_REDACTED:
raise PlaintextSecretAlreadyRead()
Expand Down

0 comments on commit 0b2e227

Please sign in to comment.