Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
python: Prefer kwargs form of dict.update.
Anders Kaseorgbef46dab3c33
diff --git a/corporate/tests/test_stripe.py b/corporate/tests/test_stripe.pyindex 349423c6fe1..03c5d167a77 100644--- a/corporate/tests/test_stripe.py+++ b/corporate/tests/test_stripe.py@@ -311,9 +311,10 @@ class StripeTestCase(ZulipTestCase):'signed_seat_count': self.get_signed_seat_count_from_response(response),'salt': self.get_salt_from_response(response)}if invoice: # send_invoice- params.update({- 'billing_modality': 'send_invoice',- 'licenses': 123})+ params.update(+ billing_modality='send_invoice',+ licenses=123,+ )else: # charge_automaticallystripe_token = Noneif not talk_to_stripe:@@ -321,11 +322,11 @@ class StripeTestCase(ZulipTestCase):stripe_token = kwargs.get('stripe_token', stripe_token)if stripe_token is None:stripe_token = stripe_create_token().id- params.update({- 'billing_modality': 'charge_automatically',- 'license_management': 'automatic',- 'stripe_token': stripe_token,- })+ params.update(+ billing_modality='charge_automatically',+ license_management='automatic',+ stripe_token=stripe_token,+ )params.update(kwargs)for key in del_args:diff --git a/corporate/views.py b/corporate/views.pyindex 6b1751cf3a0..974d72d44d1 100644--- a/corporate/views.py+++ b/corporate/views.py@@ -281,24 +281,24 @@ def billing_home(request: HttpRequest) -> HttpResponse:else:payment_method = 'Billed by invoice'- context.update({- 'plan_name': plan.name,- 'has_active_plan': True,- 'free_trial': free_trial,- 'downgrade_at_end_of_cycle': downgrade_at_end_of_cycle,- 'automanage_licenses': plan.automanage_licenses,- 'switch_to_annual_at_end_of_cycle': switch_to_annual_at_end_of_cycle,- 'licenses': licenses,- 'licenses_used': licenses_used,- 'renewal_date': renewal_date,- 'renewal_amount': f'{renewal_cents / 100.:,.2f}',- 'payment_method': payment_method,- 'charge_automatically': charge_automatically,- 'publishable_key': STRIPE_PUBLISHABLE_KEY,- 'stripe_email': stripe_customer.email,- 'CustomerPlan': CustomerPlan,- 'onboarding': request.GET.get("onboarding") is not None,- })+ context.update(+ plan_name=plan.name,+ has_active_plan=True,+ free_trial=free_trial,+ downgrade_at_end_of_cycle=downgrade_at_end_of_cycle,+ automanage_licenses=plan.automanage_licenses,+ switch_to_annual_at_end_of_cycle=switch_to_annual_at_end_of_cycle,+ licenses=licenses,+ licenses_used=licenses_used,+ renewal_date=renewal_date,+ renewal_amount=f'{renewal_cents / 100.:,.2f}',+ payment_method=payment_method,+ charge_automatically=charge_automatically,+ publishable_key=STRIPE_PUBLISHABLE_KEY,+ stripe_email=stripe_customer.email,+ CustomerPlan=CustomerPlan,+ onboarding=request.GET.get("onboarding") is not None,+ )return render(request, 'corporate/billing.html', context=context)diff --git a/zerver/lib/actions.py b/zerver/lib/actions.pyindex 71ee8925c2d..58e976041ff 100644--- a/zerver/lib/actions.py+++ b/zerver/lib/actions.py@@ -1027,11 +1027,11 @@ def do_start_email_change_process(user_profile: UserProfile, new_email: str) ->activation_url = create_confirmation_link(obj, Confirmation.EMAIL_CHANGE)from zerver.context_processors import common_contextcontext = common_context(user_profile)- context.update({- 'old_email': old_email,- 'new_email': new_email,- 'activate_url': activation_url,- })+ context.update(+ old_email=old_email,+ new_email=new_email,+ activate_url=activation_url,+ )language = user_profile.default_languagesend_email('zerver/emails/confirm_new_email', to_emails=[new_email],from_name=FromAddress.security_email_from_name(language=language),@@ -5997,7 +5997,7 @@ def do_delete_realm_export(user_profile: UserProfile, export: RealmAuditLog) -># Allow removal even if the export failed.delete_export_tarball(export_path)- export_data.update({'deleted_timestamp': timezone_now().timestamp()})+ export_data.update(deleted_timestamp=timezone_now().timestamp())export.extra_data = orjson.dumps(export_data).decode()export.save(update_fields=['extra_data'])notify_realm_export(user_profile)diff --git a/zerver/lib/digest.py b/zerver/lib/digest.pyindex eccb4c1adc3..84ba46360de 100644--- a/zerver/lib/digest.py+++ b/zerver/lib/digest.py@@ -180,9 +180,9 @@ def handle_digest_email(user_profile_id: int, cutoff: float,context = common_context(user_profile)# Start building email template data.- context.update({- 'unsubscribe_link': one_click_unsubscribe_link(user_profile, "digest"),- })+ context.update(+ unsubscribe_link=one_click_unsubscribe_link(user_profile, "digest"),+ )home_view_streams = Subscription.objects.filter(user_profile=user_profile,diff --git a/zerver/lib/email_notifications.py b/zerver/lib/email_notifications.pyindex b68b8a01805..9032572afb4 100644--- a/zerver/lib/email_notifications.py+++ b/zerver/lib/email_notifications.py@@ -367,32 +367,32 @@ def do_send_missedmessage_events_reply_in_zulip(user_profile: UserProfile,# we find a clean way to add it back in the futureunsubscribe_link = one_click_unsubscribe_link(user_profile, "missed_messages")context = common_context(user_profile)- context.update({- 'name': user_profile.full_name,- 'message_count': message_count,- 'unsubscribe_link': unsubscribe_link,- 'realm_name_in_notifications': user_profile.realm_name_in_notifications,- })+ context.update(+ name=user_profile.full_name,+ message_count=message_count,+ unsubscribe_link=unsubscribe_link,+ realm_name_in_notifications=user_profile.realm_name_in_notifications,+ )triggers = [message['trigger'] for message in missed_messages]unique_triggers = set(triggers)- context.update({- 'mention': 'mentioned' in unique_triggers or 'wildcard_mentioned' in unique_triggers,- 'stream_email_notify': 'stream_email_notify' in unique_triggers,- 'mention_count': triggers.count('mentioned') + triggers.count("wildcard_mentioned"),- })+ context.update(+ mention='mentioned' in unique_triggers or 'wildcard_mentioned' in unique_triggers,+ stream_email_notify='stream_email_notify' in unique_triggers,+ mention_count=triggers.count('mentioned') + triggers.count("wildcard_mentioned"),+ )# If this setting (email mirroring integration) is enabled, only then# can users reply to email to send message to Zulip. Thus, one must# ensure to display warning in the template.if settings.EMAIL_GATEWAY_PATTERN:- context.update({- 'reply_to_zulip': True,- })+ context.update(+ reply_to_zulip=True,+ )else:- context.update({- 'reply_to_zulip': False,- })+ context.update(+ reply_to_zulip=False,+ )from zerver.lib.email_mirror import create_missed_message_addressreply_to_address = create_missed_message_address(user_profile, missed_messages[0]['message'])@@ -402,9 +402,9 @@ def do_send_missedmessage_events_reply_in_zulip(user_profile: UserProfile,reply_to_name = "Zulip"narrow_url = get_narrow_url(user_profile, missed_messages[0]['message'])- context.update({- 'narrow_url': narrow_url,- })+ context.update(+ narrow_url=narrow_url,+ )senders = list({m['message'].sender for m in missed_messages})if (missed_messages[0]['message'].recipient.type == Recipient.HUDDLE):@@ -413,19 +413,19 @@ def do_send_missedmessage_events_reply_in_zulip(user_profile: UserProfile,assert not isinstance(display_recipient, str)other_recipients = [r['full_name'] for r in display_recipientif r['id'] != user_profile.id]- context.update({'group_pm': True})+ context.update(group_pm=True)if len(other_recipients) == 2:huddle_display_name = " and ".join(other_recipients)- context.update({'huddle_display_name': huddle_display_name})+ context.update(huddle_display_name=huddle_display_name)elif len(other_recipients) == 3:huddle_display_name = f"{other_recipients[0]}, {other_recipients[1]}, and {other_recipients[2]}"- context.update({'huddle_display_name': huddle_display_name})+ context.update(huddle_display_name=huddle_display_name)else:huddle_display_name = "{}, and {} others".format(', '.join(other_recipients[:2]), len(other_recipients) - 2)- context.update({'huddle_display_name': huddle_display_name})+ context.update(huddle_display_name=huddle_display_name)elif (missed_messages[0]['message'].recipient.type == Recipient.PERSONAL):- context.update({'private_message': True})+ context.update(private_message=True)elif (context['mention'] or context['stream_email_notify']):# Keep only the senders who actually mentioned the userif context['mention']:@@ -435,32 +435,32 @@ def do_send_missedmessage_events_reply_in_zulip(user_profile: UserProfile,message = missed_messages[0]['message']stream = Stream.objects.only('id', 'name').get(id=message.recipient.type_id)stream_header = f"{stream.name} > {message.topic_name()}"- context.update({- 'stream_header': stream_header,- })+ context.update(+ stream_header=stream_header,+ )else:raise AssertionError("Invalid messages!")# If message content is disabled, then flush all information we pass to email.if not message_content_allowed_in_missedmessage_emails(user_profile):realm = user_profile.realm- context.update({- 'reply_to_zulip': False,- 'messages': [],- 'sender_str': "",- 'realm_str': realm.name,- 'huddle_display_name': "",- 'show_message_content': False,- 'message_content_disabled_by_user': not user_profile.message_content_in_email_notifications,- 'message_content_disabled_by_realm': not realm.message_content_allowed_in_email_notifications,- })+ context.update(+ reply_to_zulip=False,+ messages=[],+ sender_str="",+ realm_str=realm.name,+ huddle_display_name="",+ show_message_content=False,+ message_content_disabled_by_user=not user_profile.message_content_in_email_notifications,+ message_content_disabled_by_realm=not realm.message_content_allowed_in_email_notifications,+ )else:- context.update({- 'messages': build_message_list(user_profile, [m['message'] for m in missed_messages]),- 'sender_str': ", ".join(sender.full_name for sender in senders),- 'realm_str': user_profile.realm.name,- 'show_message_content': True,- })+ context.update(+ messages=build_message_list(user_profile, [m['message'] for m in missed_messages]),+ sender_str=", ".join(sender.full_name for sender in senders),+ realm_str=user_profile.realm.name,+ show_message_content=True,+ )with override_language(user_profile.default_language):from_name: str = _("Zulip missed messages")@@ -476,9 +476,9 @@ def do_send_missedmessage_events_reply_in_zulip(user_profile: UserProfile,# EMAIL_ADDRESS_VISIBILITY_ADMINS.sender = senders[0]from_name, from_address = (sender.full_name, sender.email)- context.update({- 'reply_to_zulip': False,- })+ context.update(+ reply_to_zulip=False,+ )email_dict = {'template_prefix': 'zerver/emails/missed_message',@@ -598,14 +598,14 @@ def enqueue_welcome_emails(user: UserProfile, realm_creation: bool=False) -> Nondelivery_email__iexact=user.delivery_email).exclude(id=user.id).count()unsubscribe_link = one_click_unsubscribe_link(user, "welcome")context = common_context(user)- context.update({- 'unsubscribe_link': unsubscribe_link,- 'keyboard_shortcuts_link': user.realm.uri + '/help/keyboard-shortcuts',- 'realm_name': user.realm.name,- 'realm_creation': realm_creation,- 'email': user.delivery_email,- 'is_realm_admin': user.role == UserProfile.ROLE_REALM_ADMINISTRATOR,- })+ context.update(+ unsubscribe_link=unsubscribe_link,+ keyboard_shortcuts_link=user.realm.uri + '/help/keyboard-shortcuts',+ realm_name=user.realm.name,+ realm_creation=realm_creation,+ email=user.delivery_email,+ is_realm_admin=user.role == UserProfile.ROLE_REALM_ADMINISTRATOR,+ )if user.is_realm_admin:context['getting_started_link'] = (user.realm.uri +'/help/getting-your-organization-started-with-zulip')diff --git a/zerver/lib/message.py b/zerver/lib/message.pyindex 6fd28955e9c..5df4898c9c8 100644--- a/zerver/lib/message.py+++ b/zerver/lib/message.py@@ -107,7 +107,7 @@ def messages_for_ids(message_ids: List[int],for message_id in message_ids:msg_dict = message_dicts[message_id]- msg_dict.update({"flags": user_message_flags[message_id]})+ msg_dict.update(flags=user_message_flags[message_id])if message_id in search_fields:msg_dict.update(search_fields[message_id])# Make sure that we never send message edit history to clientsdiff --git a/zerver/lib/push_notifications.py b/zerver/lib/push_notifications.pyindex cd242b5628a..ef71a325175 100644--- a/zerver/lib/push_notifications.py+++ b/zerver/lib/push_notifications.py@@ -661,9 +661,9 @@ def get_apns_badge_count_future(user_profile: UserProfile, read_messages_ids: Opdef get_message_payload_apns(user_profile: UserProfile, message: Message) -> Dict[str, Any]:'''A `message` payload for iOS, via APNs.'''zulip_data = get_message_payload(user_profile, message)- zulip_data.update({- 'message_ids': [message.id],- })+ zulip_data.update(+ message_ids=[message.id],+ )assert message.rendered_content is not Nonecontent, _ = truncate_content(get_mobile_push_content(message.rendered_content))@@ -686,16 +686,16 @@ def get_message_payload_gcm(data = get_message_payload(user_profile, message)assert message.rendered_content is not Nonecontent, truncated = truncate_content(get_mobile_push_content(message.rendered_content))- data.update({- 'event': 'message',- 'alert': get_gcm_alert(message),- 'zulip_message_id': message.id, # message_id is reserved for CCS- 'time': datetime_to_timestamp(message.date_sent),- 'content': content,- 'content_truncated': truncated,- 'sender_full_name': message.sender.full_name,- 'sender_avatar_url': absolute_avatar_url(message.sender),- })+ data.update(+ event='message',+ alert=get_gcm_alert(message),+ zulip_message_id=message.id, # message_id is reserved for CCS+ time=datetime_to_timestamp(message.date_sent),+ content=content,+ content_truncated=truncated,+ sender_full_name=message.sender.full_name,+ sender_avatar_url=absolute_avatar_url(message.sender),+ )gcm_options = {'priority': 'high'}return data, gcm_options@@ -704,22 +704,22 @@ def get_remove_payload_gcm() -> Tuple[Dict[str, Any], Dict[str, Any]]:'''A `remove` payload + options, for Android via GCM/FCM.'''gcm_payload = get_base_payload(user_profile)- gcm_payload.update({- 'event': 'remove',- 'zulip_message_ids': ','.join(str(id) for id in message_ids),+ gcm_payload.update(+ event='remove',+ zulip_message_ids=','.join(str(id) for id in message_ids),# Older clients (all clients older than 2019-02-13) look only at# `zulip_message_id` and ignore `zulip_message_ids`. Do our best.- 'zulip_message_id': message_ids[0],- })+ zulip_message_id=message_ids[0],+ )gcm_options = {'priority': 'normal'}return gcm_payload, gcm_optionsdef get_remove_payload_apns(user_profile: UserProfile, message_ids: List[int]) -> Dict[str, Any]:zulip_data = get_base_payload(user_profile)- zulip_data.update({- 'event': 'remove',- 'zulip_message_ids': ','.join(str(id) for id in message_ids),- })+ zulip_data.update(+ event='remove',+ zulip_message_ids=','.join(str(id) for id in message_ids),+ )apns_data = {'badge': get_apns_badge_count(user_profile, message_ids),'custom': {'zulip': zulip_data},diff --git a/zerver/tests/test_mattermost_importer.py b/zerver/tests/test_mattermost_importer.pyindex 0c2dbdf9fd6..6b8bd48021d 100644--- a/zerver/tests/test_mattermost_importer.py+++ b/zerver/tests/test_mattermost_importer.py@@ -221,7 +221,7 @@ class MatterMostImporter(ZulipTestCase):self.assertEqual(subscriber_handler.get_users(stream_id=stream_id_mapper.get("dumbledores-army")), {ron_id, harry_id})# Converting channel data when a user's `teams` value is `null`.- username_to_user["ron"].update({"teams": None})+ username_to_user["ron"].update(teams=None)zerver_stream = convert_channel_data(channel_data=mattermost_data["channel"],user_data_map=username_to_user,@@ -417,7 +417,7 @@ class MatterMostImporter(ZulipTestCase):self.assertFalse(check_user_in_team(snape, "gryffindor"))self.assertTrue(check_user_in_team(snape, "slytherin"))- snape.update({"teams": None})+ snape.update(teams=None)self.assertFalse(check_user_in_team(snape, "slytherin"))def test_label_mirror_dummy_users(self) -> None:diff --git a/zerver/tests/test_message_fetch.py b/zerver/tests/test_message_fetch.pyindex 52c1f506ed9..a146f4f80b2 100644--- a/zerver/tests/test_message_fetch.py+++ b/zerver/tests/test_message_fetch.py@@ -1094,7 +1094,7 @@ class GetOldMessagesTest(ZulipTestCase):for message in result["messages"]:assert(message["id"] in message_ids)- post_params.update({"num_before": len(message_ids[pivot_index:])})+ post_params.update(num_before=len(message_ids[pivot_index:]))with first_visible_id_as(message_ids[pivot_index]):payload = self.client_get("/json/messages", dict(post_params))diff --git a/zerver/tests/test_signup.py b/zerver/tests/test_signup.pyindex 8446cd4fc16..282ba487adb 100644--- a/zerver/tests/test_signup.py+++ b/zerver/tests/test_signup.py@@ -1476,12 +1476,12 @@ so we didn't send them an invitation. We did send invitations to everyone else!"referrer = self.example_user(referrer_name)link = create_confirmation_link(invitee, Confirmation.INVITATION)context = common_context(referrer)- context.update({- 'activate_url': link,- 'referrer_name': referrer.full_name,- 'referrer_email': referrer.email,- 'referrer_realm_name': referrer.realm.name,- })+ context.update(+ activate_url=link,+ referrer_name=referrer.full_name,+ referrer_email=referrer.email,+ referrer_realm_name=referrer.realm.name,+ )with self.settings(EMAIL_BACKEND='django.core.mail.backends.console.EmailBackend'):email = data["email"]send_future_email(diff --git a/zerver/views/digest.py b/zerver/views/digest.pyindex d9eb84762f9..4b697d2bd76 100644--- a/zerver/views/digest.py+++ b/zerver/views/digest.py@@ -16,5 +16,5 @@ def digest_page(request: HttpRequest) -> HttpResponse:cutoff = time.mktime((timezone_now() - timedelta(days=DIGEST_CUTOFF)).timetuple())context = handle_digest_email(user_profile_id, cutoff, render_to_web=True)if context:- context.update({'physical_address': settings.PHYSICAL_ADDRESS})+ context.update(physical_address=settings.PHYSICAL_ADDRESS)return render(request, 'zerver/digest_base.html', context=context)diff --git a/zerver/views/registration.py b/zerver/views/registration.pyindex fed947f3b45..702a63225a7 100644--- a/zerver/views/registration.py+++ b/zerver/views/registration.py@@ -258,7 +258,7 @@ def accounts_register(request: HttpRequest) -> HttpResponse:# verified name from you on file, use that. Otherwise, fall# back to the full name in the request.try:- postdata.update({'full_name': request.session['authenticated_full_name']})+ postdata.update(full_name=request.session['authenticated_full_name'])name_validated = Trueexcept KeyError:pass@@ -573,9 +573,9 @@ def accounts_home(request: HttpRequest, multiuse_object_key: str="",else:form = HomepageForm(realm=realm)context = login_context(request)- context.update({'form': form, 'current_url': request.get_full_path,- 'multiuse_object_key': multiuse_object_key,- 'from_multiuse_invite': from_multiuse_invite})+ context.update(form=form, current_url=request.get_full_path,+ multiuse_object_key=multiuse_object_key,+ from_multiuse_invite=from_multiuse_invite)return render(request, 'zerver/accounts_home.html', context=context)def accounts_home_from_multiuse_invite(request: HttpRequest, confirmation_key: str) -> HttpResponse:@@ -613,9 +613,9 @@ def find_account(request: HttpRequest) -> HttpResponse:emails_q, is_active=True, is_bot=False,realm__deactivated=False):context = common_context(user)- context.update({- 'email': user.delivery_email,- })+ context.update(+ email=user.delivery_email,+ )send_email('zerver/emails/find_team', to_user_ids=[user.id], context=context,from_address=FromAddress.SUPPORT)diff --git a/zerver/views/unsubscribe.py b/zerver/views/unsubscribe.pyindex a2d613f3b96..73678b9ef73 100644--- a/zerver/views/unsubscribe.py+++ b/zerver/views/unsubscribe.py@@ -19,7 +19,7 @@ def process_unsubscribe(request: HttpRequest, confirmation_key: str, subscriptiounsubscribe_function(user_profile)context = common_context(user_profile)- context.update({"subscription_type": subscription_type})+ context.update(subscription_type=subscription_type)return render(request, 'zerver/unsubscribe_success.html', context=context)# Email unsubscribe functions. All have the function signaturediff --git a/zerver/webhooks/clubhouse/view.py b/zerver/webhooks/clubhouse/view.pyindex 2987cddd720..27bef923673 100644--- a/zerver/webhooks/clubhouse/view.py+++ b/zerver/webhooks/clubhouse/view.py@@ -367,10 +367,10 @@ def get_story_update_attachment_body(payload: Dict[str, Any]) -> Optional[str]:file_id = file_ids_added[0]for ref in payload["references"]:if ref["id"] == file_id:- kwargs.update({- "type": ref["entity_type"],- "file_name": ref["name"],- })+ kwargs.update(+ type=ref["entity_type"],+ file_name=ref["name"],+ )return FILE_ATTACHMENT_TEMPLATE.format(**kwargs)@@ -401,7 +401,7 @@ def get_story_label_body(payload: Dict[str, Any]) -> Optional[str]:if reference["id"] == label_id:label_name = reference.get('name', '')- kwargs.update({"label_name": label_name})+ kwargs.update(label_name=label_name)return STORY_LABEL_TEMPLATE.format(**kwargs)@@ -418,9 +418,9 @@ def get_story_update_project_body(payload: Dict[str, Any]) -> str:old_project_id = action["changes"]["project_id"]["old"]for ref in payload["references"]:if ref["id"] == new_project_id:- kwargs.update({"new": ref["name"]})+ kwargs.update(new=ref["name"])if ref["id"] == old_project_id:- kwargs.update({"old": ref["name"]})+ kwargs.update(old=ref["name"])return STORY_UPDATE_PROJECT_TEMPLATE.format(**kwargs)diff --git a/zerver/webhooks/sentry/view.py b/zerver/webhooks/sentry/view.pyindex 1a68e83f0c7..b2854e24bdd 100644--- a/zerver/webhooks/sentry/view.py+++ b/zerver/webhooks/sentry/view.py@@ -133,18 +133,18 @@ def handle_event_payload(event: Dict[str, Any]) -> Tuple[str, str]:post_context = convert_lines_to_traceback_string(exception_frame["post_context"])- context.update({- "syntax_highlight_as": syntax_highlight_as,- "filename": filename,- "pre_context": pre_context,- "context_line": context_line,- "post_context": post_context,- })+ context.update(+ syntax_highlight_as=syntax_highlight_as,+ filename=filename,+ pre_context=pre_context,+ context_line=context_line,+ post_context=post_context,+ )body = EXCEPTION_EVENT_TEMPLATE_WITH_TRACEBACK.format(**context)return (subject, body)- context.update({"filename": filename}) # nocoverage+ context.update(filename=filename) # nocoveragebody = EXCEPTION_EVENT_TEMPLATE.format(**context) # nocoveragereturn (subject, body) # nocoveragediff --git a/zerver/webhooks/taiga/view.py b/zerver/webhooks/taiga/view.pyindex d4f61a7ef91..abdd5a9e861 100644--- a/zerver/webhooks/taiga/view.py+++ b/zerver/webhooks/taiga/view.py@@ -216,7 +216,7 @@ def parse_change_event(change_type: str, message: Mapping[str, Any]) -> Optionalvalues["old"] = oldelse:event_type = "changed_" + change_type- values.update({'old': old, 'new': new})+ values.update(old=old, new=new)elif change_type == "is_blocked":if message["change"]["diff"]["is_blocked"]["to"]:@@ -233,12 +233,12 @@ def parse_change_event(change_type: str, message: Mapping[str, Any]) -> Optionalelif change_type == "user_story":old, new = get_old_and_new_values(change_type, message)event_type = "changed_us"- values.update({'old': old, 'new': new})+ values.update(old=old, new=new)elif change_type in ["subject", 'name']:event_type = 'renamed'old, new = get_old_and_new_values(change_type, message)- values.update({'old': old, 'new': new})+ values.update(old=old, new=new)elif change_type in ["estimated_finish", "estimated_start", "due_date"]:old, new = get_old_and_new_values(change_type, message)@@ -247,7 +247,7 @@ def parse_change_event(change_type: str, message: Mapping[str, Any]) -> Optionalvalues["new"] = newelif not old == new:event_type = change_type- values.update({'old': old, 'new': new})+ values.update(old=old, new=new)else:# date hasn't changedreturn None@@ -255,13 +255,13 @@ def parse_change_event(change_type: str, message: Mapping[str, Any]) -> Optionalelif change_type in ["priority", "severity", "type", "status"]:event_type = 'changed_' + change_typeold, new = get_old_and_new_values(change_type, message)- values.update({'old': old, 'new': new})+ values.update(old=old, new=new)else:# we are not supporting this type of eventreturn None- evt.update({"type": message["type"], "event": event_type, "values": values})+ evt.update(type=message["type"], event=event_type, values=values)return evtdef parse_webhook_test(message: Mapping[str, Any]) -> Dict[str, Any]:diff --git a/zerver/worker/queue_processors.py b/zerver/worker/queue_processors.pyindex 8d1c8008b00..406907e9d7e 100644--- a/zerver/worker/queue_processors.py+++ b/zerver/worker/queue_processors.py@@ -352,12 +352,12 @@ class ConfirmationEmailWorker(QueueProcessingWorker):# queue invitation reminderif settings.INVITATION_LINK_VALIDITY_DAYS >= 4:context = common_context(referrer)- context.update({- 'activate_url': activate_url,- 'referrer_name': referrer.full_name,- 'referrer_email': referrer.delivery_email,- 'referrer_realm_name': referrer.realm.name,- })+ context.update(+ activate_url=activate_url,+ referrer_name=referrer.full_name,+ referrer_email=referrer.delivery_email,+ referrer_realm_name=referrer.realm.name,+ )send_future_email("zerver/emails/invitation_reminder",referrer.realm,diff --git a/zproject/computed_settings.py b/zproject/computed_settings.pyindex b712b7d6648..b3d711688b4 100644--- a/zproject/computed_settings.py+++ b/zproject/computed_settings.py@@ -296,19 +296,19 @@ DATABASES: Dict[str, Dict[str, Any]] = {"default": {if DEVELOPMENT:LOCAL_DATABASE_PASSWORD = get_secret("local_database_password")- DATABASES["default"].update({- 'PASSWORD': LOCAL_DATABASE_PASSWORD,- 'HOST': 'localhost',- })+ DATABASES["default"].update(+ PASSWORD=LOCAL_DATABASE_PASSWORD,+ HOST='localhost',+ )elif REMOTE_POSTGRES_HOST != '':- DATABASES['default'].update({- 'HOST': REMOTE_POSTGRES_HOST,- 'PORT': REMOTE_POSTGRES_PORT,- })+ DATABASES['default'].update(+ HOST=REMOTE_POSTGRES_HOST,+ PORT=REMOTE_POSTGRES_PORT,+ )if get_secret("postgres_password") is not None:- DATABASES['default'].update({- 'PASSWORD': get_secret("postgres_password"),- })+ DATABASES['default'].update(+ PASSWORD=get_secret("postgres_password"),+ )if REMOTE_POSTGRES_SSLMODE != '':DATABASES['default']['OPTIONS']['sslmode'] = REMOTE_POSTGRES_SSLMODEelse:@@ -599,9 +599,9 @@ base_template_engine_settings: Dict[str, Any] = {}default_template_engine_settings = deepcopy(base_template_engine_settings)-default_template_engine_settings.update({- 'NAME': 'Jinja2',- 'DIRS': [+default_template_engine_settings.update(+ NAME='Jinja2',+ DIRS=[# The main templates directoryos.path.join(DEPLOY_ROOT, 'templates'),# The webhook integration templates@@ -609,20 +609,20 @@ default_template_engine_settings.update({# The python-zulip-api:zulip_bots package templatesos.path.join('static' if DEBUG else STATIC_ROOT, 'generated', 'bots'),],- 'APP_DIRS': True,-})+ APP_DIRS=True,+)non_html_template_engine_settings = deepcopy(base_template_engine_settings)-non_html_template_engine_settings.update({- 'NAME': 'Jinja2_plaintext',- 'DIRS': [os.path.join(DEPLOY_ROOT, 'templates')],- 'APP_DIRS': False,-})-non_html_template_engine_settings['OPTIONS'].update({- 'autoescape': False,- 'trim_blocks': True,- 'lstrip_blocks': True,-})+non_html_template_engine_settings.update(+ NAME='Jinja2_plaintext',+ DIRS=[os.path.join(DEPLOY_ROOT, 'templates')],+ APP_DIRS=False,+)+non_html_template_engine_settings['OPTIONS'].update(+ autoescape=False,+ trim_blocks=True,+ lstrip_blocks=True,+)# django-two-factor uses the default Django template engine (not Jinja2), so we# need to add config for it here.diff --git a/zproject/jinja2/__init__.py b/zproject/jinja2/__init__.pyindex fb8582a2fe2..22d405997cd 100644--- a/zproject/jinja2/__init__.py+++ b/zproject/jinja2/__init__.py@@ -14,17 +14,17 @@ from zerver.templatetags.app_filters import display_list, render_markdown_pathdef environment(**options: Any) -> Environment:env = Environment(**options)- env.globals.update({- 'default_page_params': {+ env.globals.update(+ default_page_params={'debug_mode': False,'webpack_public_path': staticfiles_storage.url(settings.WEBPACK_LOADER['DEFAULT']['BUNDLE_DIR_NAME'],),},- 'static': staticfiles_storage.url,- 'url': reverse,- 'render_markdown_path': render_markdown_path,- })+ static=staticfiles_storage.url,+ url=reverse,+ render_markdown_path=render_markdown_path,+ )env.install_gettext_translations(translation, True)