mirror of https://github.com/zulip/zulip.git
python: Use modern set comprehension syntax.
Generated by pyupgrade. Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
parent
1f68c73e66
commit
55882fb343
|
@ -124,7 +124,7 @@ rabbitmq_dist_listen = listening_publicly(25672)
|
|||
# Check the erlang magic cookie size
|
||||
cookie_size: Optional[int] = None
|
||||
if os.path.exists("/var/lib/rabbitmq/.erlang.cookie"):
|
||||
with open("/var/lib/rabbitmq/.erlang.cookie", "r") as cookie_fh:
|
||||
with open("/var/lib/rabbitmq/.erlang.cookie") as cookie_fh:
|
||||
cookie_size = len(cookie_fh.readline())
|
||||
else:
|
||||
logging.info("No RabbitMQ erlang cookie found, not auditing RabbitMQ security.")
|
||||
|
|
|
@ -6584,7 +6584,7 @@ def maybe_send_resolve_topic_notifications(
|
|||
# Compute the users who either sent or reacted to messages that
|
||||
# were moved via the "resolve topic' action. Only those users
|
||||
# should be eligible for this message being managed as unread.
|
||||
affected_participant_ids = (set(message.sender_id for message in changed_messages)) | set(
|
||||
affected_participant_ids = {message.sender_id for message in changed_messages} | set(
|
||||
Reaction.objects.filter(message__in=changed_messages).values_list(
|
||||
"user_profile_id", flat=True
|
||||
)
|
||||
|
|
|
@ -6,12 +6,12 @@ from django.db.migrations.state import StateApps
|
|||
|
||||
# There are 66 Unicode non-characters; see
|
||||
# https://www.unicode.org/faq/private_use.html#nonchar4
|
||||
unicode_non_chars = set(
|
||||
unicode_non_chars = {
|
||||
chr(x)
|
||||
for x in list(range(0xFDD0, 0xFDF0)) # FDD0 through FDEF, inclusive
|
||||
+ list(range(0xFFFE, 0x110000, 0x10000)) # 0xFFFE, 0x1FFFE, ... 0x10FFFE inclusive
|
||||
+ list(range(0xFFFF, 0x110000, 0x10000)) # 0xFFFF, 0x1FFFF, ... 0x10FFFF inclusive
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
def character_is_printable(character: str) -> bool:
|
||||
|
@ -31,7 +31,7 @@ def fix_stream_names(apps: StateApps, schema_editor: DatabaseSchemaEditor) -> No
|
|||
for realm_id in realm_ids:
|
||||
print(f"Processing realm {realm_id}")
|
||||
realm_stream_dicts = Stream.objects.filter(realm_id=realm_id).values("id", "name")
|
||||
occupied_stream_names = set(stream_dict["name"] for stream_dict in realm_stream_dicts)
|
||||
occupied_stream_names = {stream_dict["name"] for stream_dict in realm_stream_dicts}
|
||||
|
||||
for stream_dict in realm_stream_dicts:
|
||||
stream_name = stream_dict["name"]
|
||||
|
|
|
@ -1552,7 +1552,7 @@ class MarkUnreadTest(ZulipTestCase):
|
|||
self.assert_json_success(result)
|
||||
event = events[0]["event"]
|
||||
self.assertEqual(event["messages"], messages_to_unread)
|
||||
unread_message_ids = set(str(message_id) for message_id in messages_to_unread)
|
||||
unread_message_ids = {str(message_id) for message_id in messages_to_unread}
|
||||
self.assertSetEqual(set(event["message_details"].keys()), unread_message_ids)
|
||||
for message_id in event["message_details"]:
|
||||
self.assertEqual(
|
||||
|
@ -1625,7 +1625,7 @@ class MarkUnreadTest(ZulipTestCase):
|
|||
self.assert_json_success(result)
|
||||
event = events[0]["event"]
|
||||
self.assertEqual(event["messages"], messages_to_unread)
|
||||
unread_message_ids = set(str(message_id) for message_id in messages_to_unread)
|
||||
unread_message_ids = {str(message_id) for message_id in messages_to_unread}
|
||||
self.assertSetEqual(set(event["message_details"].keys()), unread_message_ids)
|
||||
for message_id in event["message_details"]:
|
||||
self.assertEqual(
|
||||
|
@ -1698,7 +1698,7 @@ class MarkUnreadTest(ZulipTestCase):
|
|||
self.assert_json_success(result)
|
||||
event = events[0]["event"]
|
||||
self.assertEqual(event["messages"], messages_to_unread)
|
||||
unread_message_ids = set(str(message_id) for message_id in messages_to_unread)
|
||||
unread_message_ids = {str(message_id) for message_id in messages_to_unread}
|
||||
self.assertSetEqual(set(event["message_details"].keys()), unread_message_ids)
|
||||
for message_id in event["message_details"]:
|
||||
self.assertEqual(
|
||||
|
@ -1768,7 +1768,7 @@ class MarkUnreadTest(ZulipTestCase):
|
|||
self.assert_json_success(result)
|
||||
event = events[0]["event"]
|
||||
self.assertEqual(event["messages"], messages_to_unread)
|
||||
unread_message_ids = set(str(message_id) for message_id in messages_to_unread)
|
||||
unread_message_ids = {str(message_id) for message_id in messages_to_unread}
|
||||
self.assertSetEqual(set(event["message_details"].keys()), unread_message_ids)
|
||||
for message_id in event["message_details"]:
|
||||
self.assertEqual(
|
||||
|
@ -1838,7 +1838,7 @@ class MarkUnreadTest(ZulipTestCase):
|
|||
self.assert_json_success(result)
|
||||
event = events[0]["event"]
|
||||
self.assertEqual(event["messages"], messages_to_unread)
|
||||
unread_message_ids = set(str(message_id) for message_id in messages_to_unread)
|
||||
unread_message_ids = {str(message_id) for message_id in messages_to_unread}
|
||||
self.assertSetEqual(set(event["message_details"].keys()), unread_message_ids)
|
||||
for message_id in event["message_details"]:
|
||||
self.assertEqual(
|
||||
|
@ -1909,7 +1909,7 @@ class MarkUnreadTest(ZulipTestCase):
|
|||
self.assert_json_success(result)
|
||||
event = events[0]["event"]
|
||||
self.assertEqual(event["messages"], messages_to_unread)
|
||||
unread_message_ids = set(str(message_id) for message_id in messages_to_unread)
|
||||
unread_message_ids = {str(message_id) for message_id in messages_to_unread}
|
||||
self.assertSetEqual(set(event["message_details"].keys()), unread_message_ids)
|
||||
for message_id in event["message_details"]:
|
||||
self.assertNotIn("mentioned", event["message_details"][message_id]),
|
||||
|
@ -1975,7 +1975,7 @@ class MarkUnreadTest(ZulipTestCase):
|
|||
self.assert_json_success(result)
|
||||
event = events[0]["event"]
|
||||
self.assertEqual(event["messages"], messages_to_unread)
|
||||
unread_message_ids = set(str(message_id) for message_id in messages_to_unread)
|
||||
unread_message_ids = {str(message_id) for message_id in messages_to_unread}
|
||||
self.assertSetEqual(set(event["message_details"].keys()), unread_message_ids)
|
||||
for message_id in event["message_details"]:
|
||||
self.assertEqual(event["message_details"][message_id]["mentioned"], True),
|
||||
|
|
Loading…
Reference in New Issue