From 75f836ea2656da26cc065997b689c6707831f3fa Mon Sep 17 00:00:00 2001 From: Benedikt Ziemons Date: Fri, 19 Jul 2019 01:54:23 +0200 Subject: [PATCH] Iterate before using next --- wmn.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/wmn.py b/wmn.py index 2f43373..d23062b 100644 --- a/wmn.py +++ b/wmn.py @@ -37,7 +37,8 @@ def notify(): return sorted(commits, key=lambda commit: commit["timestamp"]) def extract_commit_message(commit): - return next(commit["message"].splitlines(keepends=False), "$EMPTY_COMMIT_MESSAGE - impossibruh").strip() + return next(iter(commit["message"].splitlines(keepends=False)), + "$EMPTY_COMMIT_MESSAGE - impossibruh").strip() username = request.json["user_name"] commit_messages = list(map(extract_commit_message, sort_commits_by_time(request.json["commits"])))