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.

ruff: Fix RUF025 Unnecessary dict comprehension for iterable.

Anders Kaseorg869d9d9a79aa
diff --git a/zerver/tests/test_message_fetch.py b/zerver/tests/test_message_fetch.py
index 1cd1c79da93..5e54cd51db8 100644
--- a/zerver/tests/test_message_fetch.py
+++ b/zerver/tests/test_message_fetch.py
@@ -3370,7 +3370,7 @@ class GetOldMessagesTest(ZulipTestCase):
post_params = {
**other_params,
param: type,
- **{other_param: 0 for other_param in int_params[:idx] + int_params[idx + 1 :]},
+ **dict.fromkeys(int_params[:idx] + int_params[idx + 1 :], 0),
}
result = self.client_get("/json/messages", post_params)
self.assert_json_error(result, f"Bad value for '{param}': {type}")
diff --git a/zproject/backends.py b/zproject/backends.py
index 3d7383da7c8..bd4d575e5f1 100644
--- a/zproject/backends.py
+++ b/zproject/backends.py
@@ -165,7 +165,7 @@ def auth_enabled_helper(
else:
enabled_method_dict = realm.authentication_methods_dict()
else:
- enabled_method_dict = {method: True for method in AUTH_BACKEND_NAME_MAP}
+ enabled_method_dict = dict.fromkeys(AUTH_BACKEND_NAME_MAP, True)
pad_method_dict(enabled_method_dict)
for supported_backend in supported_auth_backends():