python: Remove unnecessary list comprehension.

`all` can take a generator, not just a list.  

Using a generator expression here is simpler and faster.
This commit is contained in:
BIKI DAS
2021-12-30 20:21:50 +05:30
committed by GitHub
parent b673e966ca
commit ad61d06cea

View File

@@ -100,10 +100,10 @@ def check_send_webhook_message(
# shell-style wildcards.
if (
only_events is not None
and all([not fnmatch.fnmatch(complete_event_type, pattern) for pattern in only_events])
and all(not fnmatch.fnmatch(complete_event_type, pattern) for pattern in only_events)
) or (
exclude_events is not None
and any([fnmatch.fnmatch(complete_event_type, pattern) for pattern in exclude_events])
and any(fnmatch.fnmatch(complete_event_type, pattern) for pattern in exclude_events)
):
return