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
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 2 deletions

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