From 93ea34bee2bd5063d5c37eb278f189eee568395b Mon Sep 17 00:00:00 2001 From: Niloth P <20315308+Niloth-p@users.noreply.github.com> Date: Sun, 19 Oct 2025 10:42:37 +0530 Subject: [PATCH] integrations: Use dict comprehension to define INTEGRATIONS. --- zerver/lib/integrations.py | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/zerver/lib/integrations.py b/zerver/lib/integrations.py index 71b12ec961..b59271ca15 100644 --- a/zerver/lib/integrations.py +++ b/zerver/lib/integrations.py @@ -1,7 +1,7 @@ import os from collections.abc import Callable, Sequence from dataclasses import dataclass, field -from itertools import zip_longest +from itertools import chain, zip_longest from typing import Any, TypeAlias from django.contrib.staticfiles.storage import staticfiles_storage @@ -1067,19 +1067,16 @@ HUBOT_INTEGRATIONS: list[HubotIntegration] = [ ), ] -INTEGRATIONS: dict[str, Integration] = {**OTHER_INTEGRATIONS} -for python_api_integration in PYTHON_API_INTEGRATIONS: - INTEGRATIONS[python_api_integration.name] = python_api_integration - -for hubot_integration in HUBOT_INTEGRATIONS: - INTEGRATIONS[hubot_integration.name] = hubot_integration - -for webhook_integration in WEBHOOK_INTEGRATIONS: - INTEGRATIONS[webhook_integration.name] = webhook_integration - -for bot_integration in BOT_INTEGRATIONS: - INTEGRATIONS[bot_integration.name] = bot_integration +INTEGRATIONS: dict[str, Integration] = { + integration.name: integration + for integration in chain( + WEBHOOK_INTEGRATIONS, + PYTHON_API_INTEGRATIONS, + BOT_INTEGRATIONS, + HUBOT_INTEGRATIONS, + ) +} | OTHER_INTEGRATIONS hubot_integration_names = {integration.name for integration in HUBOT_INTEGRATIONS}