From 3d853caf16b538dfe11d76ddfa6d15accd4fc03e Mon Sep 17 00:00:00 2001 From: Anders Kaseorg Date: Sat, 29 Oct 2022 20:30:03 -0400 Subject: [PATCH] ruff: Fix C417 Unnecessary `map` usage. Signed-off-by: Anders Kaseorg --- zerver/lib/integrations.py | 2 +- zerver/tests/test_markdown.py | 2 +- zerver/tests/test_subs.py | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/zerver/lib/integrations.py b/zerver/lib/integrations.py index 1ff026f20e..a105b40719 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 0bcf52e3bc..483083d447 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 e4d6c174a7..df0ef4e34c 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"])