ruff: Fix PERF401 Use a list comprehension to create a transformed list.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
Anders Kaseorg
2023-07-31 13:52:35 -07:00
committed by Tim Abbott
parent 0b95d83f09
commit 562a79ab76
48 changed files with 495 additions and 674 deletions

View File

@@ -14,16 +14,15 @@ from zerver.models import UserProfile
def get_push_commits_body(payload: WildValue) -> str:
commits_data = []
for commit in payload["event"]["push"]["commits"]:
commits_data.append(
{
"name": commit["author"].tame(check_string),
"sha": commit["raw_id"].tame(check_string),
"url": commit["url"].tame(check_string),
"message": commit["message"].tame(check_string),
}
)
commits_data = [
{
"name": commit["author"].tame(check_string),
"sha": commit["raw_id"].tame(check_string),
"url": commit["url"].tame(check_string),
"message": commit["message"].tame(check_string),
}
for commit in payload["event"]["push"]["commits"]
]
return get_push_commits_event_message(
get_user_name(payload),
None,