Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
typing: Do explicit type conversion when appropriate.
PIG208d2af20eb2ad3
diff --git a/analytics/tests/test_stats_views.py b/analytics/tests/test_stats_views.pyindex fcc36087ca2..67e403495b5 100644--- a/analytics/tests/test_stats_views.py+++ b/analytics/tests/test_stats_views.py@@ -207,7 +207,11 @@ class TestGetChartData(ZulipTestCase):client2 = Client.objects.create(name="client 2")client3 = Client.objects.create(name="client 3")client4 = Client.objects.create(name="client 4")- self.insert_data(stat, [client4.id, client3.id, client2.id], [client3.id, client1.id])+ self.insert_data(+ stat,+ [str(client4.id), str(client3.id), str(client2.id)],+ [str(client3.id), str(client1.id)],+ )result = self.client_get("/json/analytics/chart_data", {"chart_name": "messages_sent_by_client"})diff --git a/analytics/views/activity_common.py b/analytics/views/activity_common.pyindex cca5e154c99..d752b01dddf 100644--- a/analytics/views/activity_common.py+++ b/analytics/views/activity_common.py@@ -110,7 +110,7 @@ def get_user_activity_summary(records: List[QuerySet]) -> Dict[str, Dict[str, Anfor record in records:client = record.client.name- query = record.query+ query = str(record.query)update("use", record)diff --git a/corporate/tests/test_stripe.py b/corporate/tests/test_stripe.pyindex 0d63c04e537..12a5b5b4be4 100644--- a/corporate/tests/test_stripe.py+++ b/corporate/tests/test_stripe.py@@ -3237,12 +3237,12 @@ class BillingHelpersTest(ZulipTestCase):def test_get_realms_to_default_discount_dict(self) -> None:Customer.objects.create(realm=get_realm("zulip"), stripe_customer_id="cus_1")lear_customer = Customer.objects.create(realm=get_realm("lear"), stripe_customer_id="cus_2")- lear_customer.default_discount = 30+ lear_customer.default_discount = Decimal(30)lear_customer.save(update_fields=["default_discount"])zephyr_customer = Customer.objects.create(realm=get_realm("zephyr"), stripe_customer_id="cus_3")- zephyr_customer.default_discount = 0+ zephyr_customer.default_discount = Decimal(0)zephyr_customer.save(update_fields=["default_discount"])self.assertEqual(diff --git a/zerver/lib/actions.py b/zerver/lib/actions.pyindex 0bfd7fd91ea..b4cab794b8e 100644--- a/zerver/lib/actions.py+++ b/zerver/lib/actions.py@@ -466,7 +466,7 @@ def process_new_human_user(mit_beta_user = realm.is_zephyr_mirror_realmif prereg_user is not None:- streams = prereg_user.streams.all()+ streams: List[Stream] = list(prereg_user.streams.all())acting_user: Optional[UserProfile] = prereg_user.referred_byelse:streams = []diff --git a/zilencer/management/commands/populate_db.py b/zilencer/management/commands/populate_db.pyindex c7fd1dc2e00..f0e14544e64 100644--- a/zilencer/management/commands/populate_db.py+++ b/zilencer/management/commands/populate_db.py@@ -9,6 +9,7 @@ import bmemcachedimport orjsonfrom django.conf import settingsfrom django.contrib.sessions.models import Session+from django.core.files.base import Filefrom django.core.management import call_commandfrom django.core.management.base import BaseCommand, CommandParserfrom django.db import connection@@ -557,7 +558,7 @@ class Command(BaseCommand):# across platforms.subscriptions_list: List[Tuple[UserProfile, Recipient]] = []- profiles: Sequence[UserProfile] = (+ profiles: Sequence[UserProfile] = list(UserProfile.objects.select_related().filter(is_bot=False).order_by("email"))@@ -716,7 +717,7 @@ class Command(BaseCommand):# Create a test realm emoji.IMAGE_FILE_PATH = static_path("images/test-images/checkbox.png")with open(IMAGE_FILE_PATH, "rb") as fp:- check_add_realm_emoji(zulip_realm, "green_tick", iago, fp)+ check_add_realm_emoji(zulip_realm, "green_tick", iago, File(fp))if not options["test_suite"]:# Populate users with some bar data@@ -1018,7 +1019,7 @@ def generate_and_send_messages(elif message_type == Recipient.STREAM:# Pick a random subscriber to the streammessage.sender = random.choice(- Subscription.objects.filter(recipient=message.recipient)+ list(Subscription.objects.filter(recipient=message.recipient))).user_profilemessage.subject = random.choice(possible_topics[message.recipient.id])saved_data["subject"] = message.subject