mirror of https://github.com/zulip/zulip.git
ruff: Fix C414 Unnecessary `list` call within `sorted()`.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
parent
69e94b5991
commit
77c15547e6
|
@ -721,7 +721,7 @@ def do_update_message(
|
|||
)
|
||||
subscriber_ids = set(subscriptions.values_list("user_profile_id", flat=True))
|
||||
|
||||
users_to_be_notified += list(map(subscriber_info, sorted(list(subscriber_ids))))
|
||||
users_to_be_notified += list(map(subscriber_info, sorted(subscriber_ids)))
|
||||
|
||||
# UserTopic updates and the content of notifications depend on
|
||||
# whether we've moved the entire topic, or just part of it. We
|
||||
|
|
|
@ -397,7 +397,7 @@ def send_peer_subscriber_events(
|
|||
type="subscription",
|
||||
op=op,
|
||||
stream_ids=[stream_id],
|
||||
user_ids=sorted(list(altered_user_ids)),
|
||||
user_ids=sorted(altered_user_ids),
|
||||
)
|
||||
send_event(realm, event, peer_user_ids)
|
||||
|
||||
|
@ -435,7 +435,7 @@ def send_peer_subscriber_events(
|
|||
type="subscription",
|
||||
op=op,
|
||||
stream_ids=[stream_id],
|
||||
user_ids=sorted(list(altered_user_ids)),
|
||||
user_ids=sorted(altered_user_ids),
|
||||
)
|
||||
send_event(realm, event, peer_user_ids)
|
||||
|
||||
|
@ -444,7 +444,7 @@ def send_peer_subscriber_events(
|
|||
event = dict(
|
||||
type="subscription",
|
||||
op=op,
|
||||
stream_ids=sorted(list(stream_ids)),
|
||||
stream_ids=sorted(stream_ids),
|
||||
user_ids=[user_id],
|
||||
)
|
||||
send_event(realm, event, peer_user_ids)
|
||||
|
|
|
@ -306,7 +306,7 @@ def bulk_get_digest_context(
|
|||
# Get all the recent topics for all the users. This does the heavy
|
||||
# lifting of making an expensive query to the Message table. Then
|
||||
# for each user, we filter to just the streams they care about.
|
||||
recent_topics = get_recent_topics(sorted(list(all_stream_ids)), cutoff_date)
|
||||
recent_topics = get_recent_topics(sorted(all_stream_ids), cutoff_date)
|
||||
|
||||
stream_map = get_slim_stream_map(all_stream_ids)
|
||||
|
||||
|
|
|
@ -1095,7 +1095,7 @@ def apply_event(
|
|||
for sub in sub_dict:
|
||||
if sub["stream_id"] in stream_ids:
|
||||
subscribers = set(sub["subscribers"]) | user_ids
|
||||
sub["subscribers"] = sorted(list(subscribers))
|
||||
sub["subscribers"] = sorted(subscribers)
|
||||
elif event["op"] == "peer_remove":
|
||||
if include_subscribers:
|
||||
stream_ids = set(event["stream_ids"])
|
||||
|
@ -1109,7 +1109,7 @@ def apply_event(
|
|||
for sub in sub_dict:
|
||||
if sub["stream_id"] in stream_ids:
|
||||
subscribers = set(sub["subscribers"]) - user_ids
|
||||
sub["subscribers"] = sorted(list(subscribers))
|
||||
sub["subscribers"] = sorted(subscribers)
|
||||
else:
|
||||
raise AssertionError("Unexpected event type {type}/{op}".format(**event))
|
||||
elif event["type"] == "presence":
|
||||
|
|
|
@ -1330,7 +1330,7 @@ def export_partial_message_files(
|
|||
|
||||
all_message_ids |= message_ids
|
||||
|
||||
message_id_chunks = chunkify(sorted(list(all_message_ids)), chunk_size=MESSAGE_BATCH_CHUNK_SIZE)
|
||||
message_id_chunks = chunkify(sorted(all_message_ids), chunk_size=MESSAGE_BATCH_CHUNK_SIZE)
|
||||
|
||||
write_message_partials(
|
||||
realm=realm,
|
||||
|
@ -2177,7 +2177,7 @@ def export_messages_single_user(
|
|||
all_message_ids |= reaction_message_ids
|
||||
|
||||
dump_file_id = 1
|
||||
for message_id_chunk in chunkify(sorted(list(all_message_ids)), MESSAGE_BATCH_CHUNK_SIZE):
|
||||
for message_id_chunk in chunkify(sorted(all_message_ids), MESSAGE_BATCH_CHUNK_SIZE):
|
||||
fat_query = (
|
||||
UserMessage.objects.select_related("message", "message__sending_client")
|
||||
.filter(user_profile=user_profile, message_id__in=message_id_chunk)
|
||||
|
|
|
@ -358,7 +358,7 @@ def get_team_body(helper: Helper) -> str:
|
|||
new_visibility = payload["team"]["privacy"].tame(check_string)
|
||||
return f"Team visibility changed to `{new_visibility}`"
|
||||
|
||||
missing_keys = "/".join(sorted(list(changes.keys())))
|
||||
missing_keys = "/".join(sorted(changes.keys()))
|
||||
helper.log_unsupported(f"team/edited (changes: {missing_keys})")
|
||||
|
||||
# Do our best to give useful info to the customer--at least
|
||||
|
|
Loading…
Reference in New Issue