mirror of https://github.com/zulip/zulip.git
ruff: Fix C413 Unnecessary `list` call around `sorted()`.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
parent
9e53f0c756
commit
69e94b5991
|
@ -1002,7 +1002,7 @@ def handle_remove_push_notification(user_profile_id: int, message_ids: List[int]
|
|||
# space consume 12 bytes, and 12 x 200 = 2400 bytes is still well
|
||||
# below the 4KB limit (leaving plenty of space for metadata).
|
||||
MAX_APNS_MESSAGE_IDS = 200
|
||||
truncated_message_ids = list(sorted(message_ids))[-MAX_APNS_MESSAGE_IDS:]
|
||||
truncated_message_ids = sorted(message_ids)[-MAX_APNS_MESSAGE_IDS:]
|
||||
gcm_payload, gcm_options = get_remove_payload_gcm(user_profile, truncated_message_ids)
|
||||
apns_payload = get_remove_payload_apns(user_profile, truncated_message_ids)
|
||||
|
||||
|
|
|
@ -1283,7 +1283,7 @@ class RealmFilter(models.Model):
|
|||
# Report patterns missing in linkifier pattern.
|
||||
missing_in_pattern_set = found_group_set - group_set
|
||||
if len(missing_in_pattern_set) > 0:
|
||||
name = list(sorted(missing_in_pattern_set))[0]
|
||||
name = min(missing_in_pattern_set)
|
||||
raise ValidationError(
|
||||
_("Group %(name)r in URL format string is not present in linkifier pattern."),
|
||||
params={"name": name},
|
||||
|
@ -1295,7 +1295,7 @@ class RealmFilter(models.Model):
|
|||
# We just report the first missing pattern here. Users can
|
||||
# incrementally resolve errors if there are multiple
|
||||
# missing patterns.
|
||||
name = list(sorted(missing_in_url_set))[0]
|
||||
name = min(missing_in_url_set)
|
||||
raise ValidationError(
|
||||
_("Group %(name)r in linkifier pattern is not present in URL format string."),
|
||||
params={"name": name},
|
||||
|
|
|
@ -261,7 +261,7 @@ def remote_server_notify_push(
|
|||
MAX_MESSAGE_IDS = 200
|
||||
if payload and payload.get("event") == "remove" and payload.get("zulip_message_ids"):
|
||||
ids = [int(id) for id in payload["zulip_message_ids"].split(",")]
|
||||
truncated_ids = list(sorted(ids))[-MAX_MESSAGE_IDS:]
|
||||
truncated_ids = sorted(ids)[-MAX_MESSAGE_IDS:]
|
||||
payload["zulip_message_ids"] = ",".join(str(id) for id in truncated_ids)
|
||||
return payload
|
||||
|
||||
|
|
Loading…
Reference in New Issue