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 C417 Unnecessary `map` usage.

Anders Kaseorg3d853caf16b5
diff --git a/zerver/lib/integrations.py b/zerver/lib/integrations.py
index 1ff026f20e0..a105b40719b 100644
--- a/zerver/lib/integrations.py
+++ b/zerver/lib/integrations.py
@@ -94,7 +94,7 @@ class Integration:
+ category
+ "' is not a key in CATEGORIES.",
)
- self.categories = list(map((lambda c: CATEGORIES[c]), categories))
+ self.categories = [CATEGORIES[c] for c in categories]
self.logo_path = logo if logo is not None else self.get_logo_path()
# TODO: Enforce that all integrations have logo_url with an assertion.
diff --git a/zerver/tests/test_markdown.py b/zerver/tests/test_markdown.py
index 0bcf52e3bc4..483083d4477 100644
--- a/zerver/tests/test_markdown.py
+++ b/zerver/tests/test_markdown.py
@@ -235,7 +235,7 @@ class MarkdownMiscTest(ZulipTestCase):
lst = get_possible_mentions_info(
mention_backend, {"Fred Flintstone", "Cordelia, LEAR's daughter", "Not A User"}
)
- set_of_names = set(map(lambda x: x.full_name.lower(), lst))
+ set_of_names = {x.full_name.lower() for x in lst}
self.assertEqual(set_of_names, {"fred flintstone", "cordelia, lear's daughter"})
by_id = {row.id: row for row in lst}
diff --git a/zerver/tests/test_subs.py b/zerver/tests/test_subs.py
index e4d6c174a73..df0ef4e34c9 100644
--- a/zerver/tests/test_subs.py
+++ b/zerver/tests/test_subs.py
@@ -5700,8 +5700,8 @@ class GetSubscribersTest(ZulipTestCase):
# It's +1 because of the stream Rome.
self.assert_length(never_sub, len(web_public_streams) + 1)
- sub_ids = list(map(lambda stream: stream["stream_id"], sub))
- unsub_ids = list(map(lambda stream: stream["stream_id"], unsub))
+ sub_ids = [stream["stream_id"] for stream in sub]
+ unsub_ids = [stream["stream_id"] for stream in unsub]
for stream_dict in never_sub:
self.assertTrue(stream_dict["is_web_public"])