Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
python: Tweak some magic trailing commas to avoid Black bugs.
Anders Kaseorg3b301f522bcf
diff --git a/tools/lib/pretty_print.py b/tools/lib/pretty_print.pyindex 006b2ac675e..6daea1a5521 100644--- a/tools/lib/pretty_print.py+++ b/tools/lib/pretty_print.py@@ -40,7 +40,7 @@ def pretty_print_html(html: str, num_spaces: int = 4) -> str:if token.kind in ('html_start', 'handlebars_start', 'handlebars_singleton','html_singleton', 'django_start','jinja2_whitespace_stripped_type2_start',- 'jinja2_whitespace_stripped_start') and stack[-1]['tag'] != 'pre':+ 'jinja2_whitespace_stripped_start',) and stack[-1]['tag'] != 'pre':# An HTML start tag should only cause a new indent if we# are on a new line.if (token.tag not in ('extends', 'include', 'else', 'elif') and@@ -100,7 +100,7 @@ def pretty_print_html(html: str, num_spaces: int = 4) -> str:stack.append(info)elif (token.kind in ('html_end', 'handlebars_end', 'html_singleton_end','django_end', 'handlebars_singleton_end',- 'jinja2_whitespace_stripped_end') and+ 'jinja2_whitespace_stripped_end',) and(stack[-1]['tag'] != 'pre' or token.tag == 'pre')):info = stack.pop()if info['block']:diff --git a/zerver/lib/actions.py b/zerver/lib/actions.pyindex c8c2a1695c6..2b72817ad71 100644--- a/zerver/lib/actions.py+++ b/zerver/lib/actions.py@@ -1201,7 +1201,7 @@ def get_recipient_info(recipient: Recipient,if user_ids:query = UserProfile.objects.filter(- is_active=True,+ is_active=True).values('id','enable_online_push_notifications',@@ -4101,7 +4101,7 @@ def do_mark_all_as_read(user_profile: UserProfile, client: Client) -> int:do_clear_mobile_push_notifications_for_ids([user_profile.id], all_push_message_ids)msgs = UserMessage.objects.filter(- user_profile=user_profile,+ user_profile=user_profile).extra(where=[UserMessage.where_unread()],)diff --git a/zerver/lib/presence.py b/zerver/lib/presence.pyindex a2d97a8a909..b298a3487c9 100644--- a/zerver/lib/presence.py+++ b/zerver/lib/presence.py@@ -157,7 +157,7 @@ def get_status_dict_by_realm(realm_id: int, slim_presence: bool = False) -> Dictpresence_rows = list(query)mobile_query = PushDeviceToken.objects.distinct(- 'user_id',+ 'user_id').values_list('user_id',flat=True,diff --git a/zerver/lib/topic_mutes.py b/zerver/lib/topic_mutes.pyindex 2e98365321f..6bbae12edc6 100644--- a/zerver/lib/topic_mutes.py+++ b/zerver/lib/topic_mutes.py@@ -11,7 +11,7 @@ from zerver.models import MutedTopic, UserProfile, get_streamdef get_topic_mutes(user_profile: UserProfile) -> List[Tuple[str, str, float]]:rows = MutedTopic.objects.filter(- user_profile=user_profile,+ user_profile=user_profile).values('stream__name','topic_name',@@ -107,7 +107,7 @@ def exclude_topic_mutes(conditions: List[Selectable],def build_topic_mute_checker(user_profile: UserProfile) -> Callable[[int, str], bool]:rows = MutedTopic.objects.filter(- user_profile=user_profile,+ user_profile=user_profile).values('recipient_id','topic_name',diff --git a/zerver/migrations/0110_stream_is_in_zephyr_realm.py b/zerver/migrations/0110_stream_is_in_zephyr_realm.pyindex b7270a20d06..e1134d5de60 100644--- a/zerver/migrations/0110_stream_is_in_zephyr_realm.py+++ b/zerver/migrations/0110_stream_is_in_zephyr_realm.py@@ -14,7 +14,7 @@ def populate_is_zephyr(apps: StateApps, schema_editor: DatabaseSchemaEditor) ->for realm in realms:Stream.objects.filter(- realm_id=realm.id,+ realm_id=realm.id).update(is_in_zephyr_realm=True,)diff --git a/zerver/migrations/0239_usermessage_copy_id_to_bigint_id.py b/zerver/migrations/0239_usermessage_copy_id_to_bigint_id.pyindex 313f325b4d1..b31ccb7716e 100644--- a/zerver/migrations/0239_usermessage_copy_id_to_bigint_id.py+++ b/zerver/migrations/0239_usermessage_copy_id_to_bigint_id.py@@ -29,7 +29,7 @@ def copy_id_to_bigid(apps: StateApps, schema_editor: DatabaseSchemaEditor) -> Noreturn# TODO: is the below lookup fast enough, considering there's no index on bigint_id?- first_uncopied_id = UserMessage.objects.filter(bigint_id__isnull=True,+ first_uncopied_id = UserMessage.objects.filter(bigint_id__isnull=True).aggregate(Min('id'))['id__min']# Note: the below id can fall in a segment# where bigint_id = id already, but it's not a big problemdiff --git a/zerver/migrations/0244_message_copy_pub_date_to_date_sent.py b/zerver/migrations/0244_message_copy_pub_date_to_date_sent.pyindex 0f6b5be820b..304b60cb914 100644--- a/zerver/migrations/0244_message_copy_pub_date_to_date_sent.py+++ b/zerver/migrations/0244_message_copy_pub_date_to_date_sent.py@@ -26,7 +26,7 @@ def copy_pub_date_to_date_sent(apps: StateApps, schema_editor: DatabaseSchemaEdi# Nothing to doreturn- first_uncopied_id = Message.objects.filter(date_sent__isnull=True,+ first_uncopied_id = Message.objects.filter(date_sent__isnull=True).aggregate(Min('id'))['id__min']# Note: the below id can fall in a segment# where date_sent = pub_date already, but it's not a big problemdiff --git a/zerver/tests/test_soft_deactivation.py b/zerver/tests/test_soft_deactivation.pyindex 745e5e0c232..2a9b47a4597 100644--- a/zerver/tests/test_soft_deactivation.py+++ b/zerver/tests/test_soft_deactivation.py@@ -250,7 +250,7 @@ class SoftDeactivationMessageTest(ZulipTestCase):def last_realm_audit_log_entry(event_type: int) -> RealmAuditLog:return RealmAuditLog.objects.filter(- event_type=event_type,+ event_type=event_type).order_by('-event_time')[0]long_term_idle_user = self.example_user('hamlet')