Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Commit

Permalink
Remove isinstance test when converting to boolean
Browse files Browse the repository at this point in the history
  • Loading branch information
Mathieu Velten committed Aug 9, 2023
1 parent 0246483 commit ddc91e8
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions synapse/storage/databases/main/registration.py
Original file line number Diff line number Diff line change
Expand Up @@ -239,8 +239,7 @@ def get_user_by_id_txn(txn: LoggingTransaction) -> Optional[Dict[str, Any]]:
"locked",
]
for column in boolean_columns:
if not isinstance(row[column], bool):
row[column] = bool(row[column])
row[column] = bool(row[column])

return row

Expand Down Expand Up @@ -1141,10 +1140,8 @@ async def get_user_locked_status(self, user_id: str) -> bool:
desc="get_user_locked_status",
)

# Convert the integer into a boolean.
if not isinstance(res, bool):
res = bool(res)
return res
# Convert the potential integer into a boolean.
return bool(res)

async def get_threepid_validation_session(
self,
Expand Down

0 comments on commit ddc91e8

Please sign in to comment.