From d7d745295ae0a47ea057900bf3194ca0eb2e97d8 Mon Sep 17 00:00:00 2001 From: Ken Dreyer Date: Jun 18 2020 13:22:44 +0000 Subject: hub: simplify recipients condition in build_notification() If get_notification_recipients() returns a non-empty list of recipients, then the build_notification() method creates a new buildNotification task. Simplify the conditional that checks the get_notification_recipients() return value so that it is easier to read. Python treats an empty list as False and a non-empty list as True, so we don't need to explicitly test the list length here. The purpose of this change is to make this code easier to read and understand. --- diff --git a/hub/kojihub.py b/hub/kojihub.py index 9157f36..92d33d3 100644 --- a/hub/kojihub.py +++ b/hub/kojihub.py @@ -8457,7 +8457,7 @@ def build_notification(task_id, build_id): web_url = context.opts.get('KojiWebURL', 'http://localhost/koji') recipients = get_notification_recipients(build, dest_tag, build['state']) - if len(recipients) > 0: + if recipients: make_task('buildNotification', [recipients, build, target, web_url])