Skip to content

Commit 92b00f8

Browse files
committed
Minor simplification
1 parent 19da78f commit 92b00f8

File tree

2 files changed

+4
-6
lines changed

2 files changed

+4
-6
lines changed

src/kbase/auth/_async/client.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -238,9 +238,8 @@ async def validate_usernames(
238238
)
239239
tk = None
240240
for u in to_query:
241-
exists = u in res
242-
to_return[u] = exists
243-
if exists:
241+
to_return[u] = u in res
242+
if to_return[u]:
244243
if not tk: # minor optimization, don't get the token until it's needed
245244
tk = await self.get_token(token)
246245
# Usernames are permanent but can be disabled, so we expire based on time

src/kbase/auth/_sync/client.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -238,9 +238,8 @@ def validate_usernames(
238238
)
239239
tk = None
240240
for u in to_query:
241-
exists = u in res
242-
to_return[u] = exists
243-
if exists:
241+
to_return[u] = u in res
242+
if to_return[u]:
244243
if not tk: # minor optimization, don't get the token until it's needed
245244
tk = self.get_token(token)
246245
# Usernames are permanent but can be disabled, so we expire based on time

0 commit comments

Comments
 (0)