ruff: Fix RUF015 Prefer next(...) over single element slice.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
(cherry picked from commit 3b09197fdf)
This commit is contained in:
Anders Kaseorg
2023-07-21 15:34:11 -07:00
committed by Alex Vandiver
parent a0ce536fa4
commit b9aa772885
21 changed files with 55 additions and 63 deletions

View File

@@ -623,10 +623,10 @@ def get_user_groups(client: Client) -> int:
# {code_example|end}
validate_against_openapi_schema(result, "/user_groups", "get", "200")
hamlet_user_group = [u for u in result["user_groups"] if u["name"] == "hamletcharacters"][0]
[hamlet_user_group] = (u for u in result["user_groups"] if u["name"] == "hamletcharacters")
assert hamlet_user_group["description"] == "Characters of Hamlet"
marketing_user_group = [u for u in result["user_groups"] if u["name"] == "marketing"][0]
[marketing_user_group] = (u for u in result["user_groups"] if u["name"] == "marketing")
return marketing_user_group["id"]