Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

integrations: Use dict comprehension to define INTEGRATIONS.

Niloth P93ea34bee2bd
diff --git a/zerver/lib/integrations.py b/zerver/lib/integrations.py
index 71b12ec9616..b59271ca159 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}