Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
typing: Use accurate type hints for dictionaries.
PIG208738691853946
diff --git a/analytics/lib/counts.py b/analytics/lib/counts.pyindex 761eaf094ec..e2ca1ba6002 100644--- a/analytics/lib/counts.py+++ b/analytics/lib/counts.py@@ -302,7 +302,7 @@ def do_increment_logging_stat(table = stat.data_collector.output_tableif table == RealmCount:assert isinstance(zerver_object, Realm)- id_args = {"realm": zerver_object}+ id_args: Dict[str, Union[Realm, UserProfile, Stream]] = {"realm": zerver_object}elif table == UserCount:assert isinstance(zerver_object, UserProfile)id_args = {"realm": zerver_object.realm, "user": zerver_object}diff --git a/corporate/lib/stripe.py b/corporate/lib/stripe.pyindex 5df0c9fbf73..f5b28807cb9 100644--- a/corporate/lib/stripe.py+++ b/corporate/lib/stripe.py@@ -5,7 +5,7 @@ import secretsfrom datetime import datetime, timedeltafrom decimal import Decimalfrom functools import wraps-from typing import Any, Callable, Dict, Generator, Optional, Tuple, TypeVar, cast+from typing import Any, Callable, Dict, Generator, Optional, Tuple, TypeVar, Union, castimport orjsonimport stripe@@ -1032,7 +1032,7 @@ def downgrade_small_realms_behind_on_payments_as_needed() -> None:downgrade_now_without_creating_additional_invoices(realm)void_all_open_invoices(realm)- context: Dict[str, str] = {+ context: Dict[str, Union[str, Realm]] = {"upgrade_url": f"{realm.uri}{reverse('initial_upgrade')}","realm": realm,}diff --git a/zerver/lib/cache_helpers.py b/zerver/lib/cache_helpers.pyindex 04439b05520..405fd61a898 100644--- a/zerver/lib/cache_helpers.py+++ b/zerver/lib/cache_helpers.py@@ -1,7 +1,7 @@# See https://zulip.readthedocs.io/en/latest/subsystems/caching.html for docsimport datetimeimport logging-from typing import Any, Callable, Dict, List, Tuple+from typing import Any, Callable, Dict, Iterable, List, Tuplefrom django.conf import settingsfrom django.contrib.sessions.models import Session@@ -106,7 +106,7 @@ def get_users() -> List[UserProfile]:# wrapper the below adds an extra 3ms or so to startup time for# anything importing this file).cache_fillers: Dict[- str, Tuple[Callable[[], List[Any]], Callable[[Dict[str, Any], Any], None], int, int]+ str, Tuple[Callable[[], Iterable[Any]], Callable[[Dict[str, Any], Any], None], int, int]] = {"user": (get_users, user_cache_items, 3600 * 24 * 7, 10000),"client": (