Repository navigation
fix Django: infer row types for values() and values_list() #5735 - #5835
asukaminato0721 wants to merge 2 commits into
Conversation
|
✅ This PR meets all requirements from our pull request checklist. Optional recommendations:
Note: this comment updates automatically after changes to the PR. Updates may take up to half an hour. |
|
This pull request has been imported. If you are a Meta employee, you can view this in D135541033. (Because this pull request was imported automatically, there will not be any future comments.) |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
Thanks for this. I built the branch and ran it against a few cases and the mypy_primer output. One regression
for title, n in Book.objects.values_list("title").annotate(n=Count("id")): # bad-unpacking
...The row is typed Unresolved expressions When an expression does not resolve, Two resolvers
Questions
|
|
One more case, related to the "Two resolvers" point above. A reverse relation named directly in from typing import reveal_type
from django.db import models
class Author(models.Model):
name = models.CharField(max_length=10)
class Book(models.Model):
author = models.ForeignKey(Author, on_delete=models.CASCADE, related_name="books")
title = models.CharField(max_length=10)
class Review(models.Model):
book = models.ForeignKey(Book, on_delete=models.CASCADE, related_name="reviews")
reveal_type(Book.objects.values_list("author", "title")) # tuple[int, str]
reveal_type(Author.objects.values_list("books", "name")) # tuple[RelatedManager[Book], str]
reveal_type(Author.objects.values_list("books", flat=True)) # RelatedManager[Book]
reveal_type(Author.objects.values("books")) # dict[str, RelatedManager[Book]]
reveal_type(Review.objects.values_list("book__author__books", "id")) # tuple[RelatedManager[Book], int]
reveal_type(Author.objects.values_list("books__title", "name")) # tuple[str | None, str]Django returns the related model's key there, or Checked at 51302c1 with django-stubs 6.1.2. |
This comment has been minimized.
This comment has been minimized.
|
Diff from mypy_primer, showing the effect of this PR on open source code: ============================================================
SUMMARY
============================================================
Total: +30 new errors, -204 fixed errors
By preset: +6/-3 (default), +6/-3 (strict)
Projects with changes (1):
zulip: +30 -204
============================================================
FULL DIFF DETAILS
------------------------------------------------------------
zulip (https://github.com/zulip/zulip)
- ERROR analytics/views/stats.py:404:28-30: The type of this argument is an explicit `Any` [explicit-any-use]
- ERROR analytics/views/stats.py:404:42-44: The type of `id` is an explicit `Any` [explicit-any-use]
- ERROR analytics/views/stats.py:404:46-50: The type of `name` is an explicit `Any` [explicit-any-use]
- ERROR corporate/tests/test_stripe.py:2518:13-2520:17: The type of this argument is an explicit `Any` [explicit-any-use]
- ERROR corporate/tests/test_stripe.py:2525:13-2527:17: The type of this argument is an explicit `Any` [explicit-any-use]
- ERROR corporate/tests/test_stripe.py:2690:13-2692:17: The type of this argument is an explicit `Any` [explicit-any-use]
- ERROR corporate/tests/test_stripe.py:2844:13-2846:17: The type of this argument is an explicit `Any` [explicit-any-use]
- ERROR corporate/tests/test_stripe.py:2851:13-2853:17: The type of this argument is an explicit `Any` [explicit-any-use]
- ERROR corporate/views/support.py:697:16-701:10: Returning implicit Any from function declared to return "str" [no-any-return-implicit]
- ERROR corporate/views/support.py:704:16-708:10: Returning implicit Any from function declared to return "str" [no-any-return-implicit]
- ERROR corporate/views/support.py:983:16-987:10: Returning implicit Any from function declared to return "str" [no-any-return-implicit]
- ERROR corporate/views/support.py:990:16-994:10: Returning implicit Any from function declared to return "str" [no-any-return-implicit]
- ERROR zerver/actions/create_user.py:277:20-30: The type of this argument is an explicit `Any` [explicit-any-use]
- ERROR zerver/actions/create_user.py:281:18-28: The type of this argument is an explicit `Any` [explicit-any-use]
- ERROR zerver/actions/message_edit.py:453:12-68: Returned type `set[Any]` contains `Any`, so it is not fully checked against declared return type `set[int]` [partially-any-return]
- ERROR zerver/actions/message_edit.py:903:12-20: Returned type `set[Any]` contains `Any`, so it is not fully checked against declared return type `set[int]` [partially-any-return]
- ERROR zerver/actions/message_edit.py:1097:13-20: The type of `user_id` is an explicit `Any` [explicit-any-use]
- ERROR zerver/actions/message_edit.py:1098:13-22: The type of `stream_id` is an explicit `Any` [explicit-any-use]
- ERROR zerver/actions/message_edit.py:1099:13-23: The type of `sub_active` is an explicit `Any` [explicit-any-use]
- ERROR zerver/actions/message_edit.py:1100:13-27: The type of `is_user_active` is an explicit `Any` [explicit-any-use]
- ERROR zerver/actions/message_edit.py:1101:13-32: The type of `user_long_term_idle` is an explicit `Any` [explicit-any-use]
- ERROR zerver/actions/message_edit.py:1102:13-22: The type of `user_role` is an explicit `Any` [explicit-any-use]
- ERROR zerver/actions/message_edit.py:1112:36-43: The type of this argument is an explicit `Any` [explicit-any-use]
- ERROR zerver/actions/message_edit.py:1115:45-52: The type of this argument is an explicit `Any` [explicit-any-use]
- ERROR zerver/actions/message_edit.py:1117:53-60: The type of this argument is an explicit `Any` [explicit-any-use]
- ERROR zerver/actions/message_edit.py:1120:52-59: The type of this argument is an explicit `Any` [explicit-any-use]
- ERROR zerver/actions/message_edit.py:1123:49-56: The type of this argument is an explicit `Any` [explicit-any-use]
- ERROR zerver/actions/message_edit.py:1125:52-59: The type of this argument is an explicit `Any` [explicit-any-use]
- ERROR zerver/actions/message_flags.py:333:32-39: The type of `message` is an explicit `Any` [explicit-any-use]
- ERROR zerver/actions/message_flags.py:337:33-40: The type of `message` is an explicit `Any` [explicit-any-use]
- ERROR zerver/actions/message_flags.py:444:12-60: Returned type `tuple[int, list[Any] | list[Unknown]]` contains `Any`, so it is not fully checked against declared return type `tuple[int, list[int]]` [partially-any-return]
+ ERROR zerver/actions/message_flags.py:444:12-60: Returned type `tuple[int, list[int] | list[Unknown]]` contains `Any`, so it is not fully checked against declared return type `tuple[int, list[int]]` [partially-any-return]
- ERROR zerver/actions/message_send.py:436:40-62: The type of this argument is an explicit `Any` [explicit-any-use]
- ERROR zerver/actions/message_send.py:460:21-36: The type of this argument is an explicit `Any` [explicit-any-use]
- ERROR zerver/actions/message_send.py:462:25-47: The type of this argument is an explicit `Any` [explicit-any-use]
- ERROR zerver/actions/message_send.py:464:21-33: The type of this argument is an explicit `Any` [explicit-any-use]
- ERROR zerver/actions/message_send.py:465:21-38: The type of this argument is an explicit `Any` [explicit-any-use]
- ERROR zerver/actions/message_send.py:491:21-43: The type of this argument is an explicit `Any` [explicit-any-use]
- ERROR zerver/actions/message_send.py:567:10-18: Implicit conversion of `AbstractSet[int | Any] | AbstractSet[int]` to `bool` is not allowed [implicit-bool]
+ ERROR zerver/actions/message_send.py:567:10-18: Implicit conversion of `AbstractSet[int]` to `bool` is not allowed [implicit-bool]
- ERROR zerver/actions/streams.py:377:20-25: The type of attribute `lower` is an explicit `Any` [explicit-any-use]
- ERROR zerver/actions/streams.py:378:13-23: The type of `topic_name` is an explicit `Any` [explicit-any-use]
- ERROR zerver/actions/streams.py:382:9-19: The type of `topic_name` is an explicit `Any` [explicit-any-use]
- ERROR zerver/actions/streams.py:384:45-55: The type of this argument is an explicit `Any` [explicit-any-use]
- ERROR zerver/actions/streams.py:389:13-39: The type of this argument is an explicit `Any` [explicit-any-use]
- ERROR zerver/actions/streams.py:391:13-41: The type of this argument is an explicit `Any` [explicit-any-use]
- ERROR zerver/actions/streams.py:431:12-73: Returned type `QuerySet[Subscription, Any]` contains `Any`, so it is not fully checked against declared return type `QuerySet[Subscription, int]` [partially-any-return]
- ERROR zerver/actions/uploads.py:95:13-20: The type of `path_id` is an explicit `Any` [explicit-any-use]
- ERROR zerver/actions/uploads.py:100:24-31: The type of this argument is an explicit `Any` [explicit-any-use]
- ERROR zerver/actions/uploads.py:104:13-20: The type of `path_id` is an explicit `Any` [explicit-any-use]
- ERROR zerver/actions/uploads.py:109:24-31: The type of this argument is an explicit `Any` [explicit-any-use]
- ERROR zerver/actions/users.py:337:9-22: The type of `user_group_id` is an explicit `Any` [explicit-any-use]
- ERROR zerver/actions/users.py:337:24-39: The type of `user_profile_id` is an explicit `Any` [explicit-any-use]
- ERROR zerver/actions/users.py:338:23-36: The type of this argument is an explicit `Any` [explicit-any-use]
- ERROR zerver/actions/users.py:338:45-60: The type of this argument is an explicit `Any` [explicit-any-use]
- ERROR zerver/actions/users.py:341:9-20: The type of `subgroup_id` is an explicit `Any` [explicit-any-use]
- ERROR zerver/actions/users.py:341:22-35: The type of `supergroup_id` is an explicit `Any` [explicit-any-use]
- ERROR zerver/actions/users.py:342:25-38: The type of this argument is an explicit `Any` [explicit-any-use]
- ERROR zerver/actions/users.py:342:47-58: The type of this argument is an explicit `Any` [explicit-any-use]
- ERROR zerver/actions/users.py:421:9-23: The type of `recipient_type` is an explicit `Any` [explicit-any-use]
- ERROR zerver/actions/users.py:421:25-32: The type of `user_id` is an explicit `Any` [explicit-any-use]
- ERROR zerver/actions/users.py:423:55-62: The type of this argument is an explicit `Any` [explicit-any-use]
- ERROR zerver/actions/users.py:425:41-48: The type of this argument is an explicit `Any` [explicit-any-use]
- ERROR zerver/actions/users.py:430:8-45: Implicit conversion of `set[int | Any]` to `bool` is not allowed [implicit-bool]
+ ERROR zerver/actions/users.py:430:8-45: Implicit conversion of `set[int]` to `bool` is not allowed [implicit-bool]
- ERROR zerver/actions/users.py:471:8-47: Implicit conversion of `set[Any]` to `bool` is not allowed [implicit-bool]
+ ERROR zerver/actions/users.py:471:8-47: Implicit conversion of `set[int]` to `bool` is not allowed [implicit-bool]
- ERROR zerver/lib/alert_words.py:23:40-70: The type of this argument is an explicit `Any` [explicit-any-use]
- ERROR zerver/lib/alert_words.py:24:29-59: The type of this argument is an explicit `Any` [explicit-any-use]
- ERROR zerver/lib/alert_words.py:24:68-87: The type of this argument is an explicit `Any` [explicit-any-use]
- ERROR zerver/lib/bulk_create.py:170:14-19: The type of attribute `lower` is an explicit `Any` [explicit-any-use]
- ERROR zerver/lib/bulk_create.py:170:26-30: The type of `name` is an explicit `Any` [explicit-any-use]
- ERROR zerver/lib/bulk_create.py:205:19-39: The type of this argument is an explicit `Any` [explicit-any-use]
- ERROR zerver/lib/bulk_create.py:207:12-34: The type of this argument is an explicit `Any` [explicit-any-use]
- ERROR zerver/lib/bulk_create.py:207:27-32: The type of attribute `lower` is an explicit `Any` [explicit-any-use]
- ERROR zerver/lib/cache.py:1264:41-44: The type of this argument is an explicit `Any` [explicit-any-use]
- ERROR zerver/lib/cache.py:1264:50-53: The type of `rid` is an explicit `Any` [explicit-any-use]
- ERROR zerver/lib/cache_helpers.py:71:9-79:44: Returned type `QuerySet[RealmCount, Any]` contains `Any`, so it is not fully checked against declared return type `QuerySet[RealmCount, int]` [partially-any-return]
- ERROR zerver/lib/digest.py:388:13-35: The type of this argument is an explicit `Any` [explicit-any-use]
- ERROR zerver/lib/digest.py:388:41-66: The type of this argument is an explicit `Any` [explicit-any-use]
- ERROR zerver/lib/digest.py:403:13-35: The type of this argument is an explicit `Any` [explicit-any-use]
- ERROR zerver/lib/digest.py:403:78-83: The type of attribute `lower` is an explicit `Any` [explicit-any-use]
- ERROR zerver/lib/email_mirror.py:534:25-42: The type of `recipient_str` is unknown; it is inferred as an implicit `Any` [unknown-variable-type]
- ERROR zerver/lib/email_mirror.py:542:9-22: The type of this argument is partially unknown; it contains an implicit `Any` [partially-unknown-type]
- ERROR zerver/lib/export.py:2957:20-34: Returning Any from function declared to return "str" [no-any-return-explicit]
+ ERROR zerver/lib/mention.py:213:21-40: Argument `int | None` is not assignable to parameter `recipient_id` with type `int` in function `ChannelInfo.__init__` [bad-argument-type]
- ERROR zerver/lib/mention.py:211:35-46: The type of this argument is an explicit `Any` [explicit-any-use]
- ERROR zerver/lib/mention.py:212:21-30: The type of this argument is an explicit `Any` [explicit-any-use]
- ERROR zerver/lib/mention.py:213:21-40: The type of this argument is an explicit `Any` [explicit-any-use]
- ERROR zerver/lib/mention.py:214:21-57: The type of this argument is an explicit `Any` [explicit-any-use]
- ERROR zerver/lib/mention.py:215:21-41: The type of this argument is an explicit `Any` [explicit-any-use]
- ERROR zerver/lib/mention.py:217:24-35: The type of this argument is an explicit `Any` [explicit-any-use]
- ERROR zerver/lib/mention.py:217:39-48: The type of this argument is an explicit `Any` [explicit-any-use]
- ERROR zerver/lib/message.py:712:16-30: Returned type `set[Any]` contains `Any`, so it is not fully checked against declared return type `set[int]` [partially-any-return]
- ERROR zerver/lib/message.py:730:12-77: Returned type `set[Any]` contains `Any`, so it is not fully checked against declared return type `set[int]` [partially-any-return]
- ERROR zerver/lib/message.py:835:12-838:43: Returned type `QuerySet[UserMessage, Any]` contains `Any`, so it is not fully checked against declared return type `QuerySet[UserMessage, int]` [partially-any-return]
- ERROR zerver/lib/message.py:864:12-34: Returned type `list[Any]` contains `Any`, so it is not fully checked against declared return type `list[int]` [partially-any-return]
- ERROR zerver/lib/message.py:879:12-28: Returned type `set[Any]` contains `Any`, so it is not fully checked against declared return type `set[int]` [partially-any-return]
- ERROR zerver/lib/message.py:1418:13-37: The type of `first_visible_message_id` is an explicit `Any` [explicit-any-use]
- ERROR zerver/lib/message.py:1432:17-41: The type of `first_visible_message_id` is an explicit `Any` [explicit-any-use]
+ ERROR zerver/lib/message.py:1474:12-1481:6: Returned type `list[tuple[int, int | None]]` is not assignable to declared return type `list[tuple[int, int]]` [bad-return]
- ERROR zerver/lib/message.py:1501:9-21: The type of `recipient_id` is an explicit `Any` [explicit-any-use]
- ERROR zerver/lib/message.py:1501:23-38: The type of `user_profile_id` is an explicit `Any` [explicit-any-use]
- ERROR zerver/lib/message.py:1502:23-35: The type of this argument is an explicit `Any` [explicit-any-use]
- ERROR zerver/lib/message.py:1502:44-59: The type of this argument is an explicit `Any` [explicit-any-use]
- ERROR zerver/lib/message_cache.py:550:47-79: Argument `dict[Any, dict[str, Any]]` is not assignable to parameter `sender_dict` with type `Mapping[int, SenderInfoRow]` in function `MessageDict.hydrate_sender_info` [bad-argument-type]
+ ERROR zerver/lib/message_cache.py:550:47-79: Argument `dict[int, dict[str, Any]]` is not assignable to parameter `sender_dict` with type `Mapping[int, SenderInfoRow]` in function `MessageDict.hydrate_sender_info` [bad-argument-type]
+ ERROR zerver/lib/narrow.py:987:13-998:6: The type of `query` is partially unknown; it contains an implicit `Any` [partially-unknown-type]
+ ERROR zerver/lib/narrow.py:992:7-13: The type of attribute `filter` is partially unknown; it contains an implicit `Any` [partially-unknown-type]
+ ERROR zerver/lib/narrow.py:992:13-998:6: The type of this argument is partially unknown; it contains an implicit `Any` [partially-unknown-type]
- ERROR zerver/lib/narrow.py:1006:8-32: Implicit conversion of `list[Any] | list[Unknown]` to `bool` is not allowed [implicit-bool]
+ ERROR zerver/lib/narrow.py:1006:8-32: Implicit conversion of `list[int] | list[Unknown]` to `bool` is not allowed [implicit-bool]
+ ERROR zerver/lib/narrow.py:1010:18-24: The type of attribute `filter` is partially unknown; it contains an implicit `Any` [partially-unknown-type]
+ ERROR zerver/lib/narrow.py:1010:24-1026:6: The type of this argument is partially unknown; it contains an implicit `Any` [partially-unknown-type]
- ERROR zerver/lib/narrow.py:1147:12-18: Returning Any from function declared to return "int" [no-any-return-explicit]
- ERROR zerver/lib/narrow.py:1175:20-31: Returning Any from function declared to return "int | None" [no-any-return-explicit]
- ERROR zerver/lib/send_email.py:542:12-20: Implicit conversion of `list[Any]` to `bool` is not allowed [implicit-bool]
+ ERROR zerver/lib/send_email.py:542:12-20: Implicit conversion of `list[int]` to `bool` is not allowed [implicit-bool]
- ERROR zerver/lib/send_email.py:573:12-20: Implicit conversion of `list[Any]` to `bool` is not allowed [implicit-bool]
+ ERROR zerver/lib/send_email.py:573:12-20: Implicit conversion of `list[int]` to `bool` is not allowed [implicit-bool]
- ERROR zerver/lib/send_email.py:584:8-16: Implicit conversion of `list[Any]` to `bool` is not allowed [implicit-bool]
+ ERROR zerver/lib/send_email.py:584:8-16: Implicit conversion of `list[int]` to `bool` is not allowed [implicit-bool]
- ERROR zerver/lib/soft_deactivation.py:196:65-90: The type of this argument is an explicit `Any` [explicit-any-use]
- ERROR zerver/lib/soft_deactivation.py:206:30-49: The type of this argument is an explicit `Any` [explicit-any-use]
- ERROR zerver/lib/soft_deactivation.py:230:25-50: The type of this argument is an explicit `Any` [explicit-any-use]
- ERROR zerver/lib/soft_deactivation.py:231:32-44: The type of this argument is an explicit `Any` [explicit-any-use]
- ERROR zerver/lib/soft_deactivation.py:231:46-90: The type of this argument is an explicit `Any` [explicit-any-use]
- ERROR zerver/lib/stream_subscription.py:58:12-62:51: Returned type `QuerySet[Subscription, Any]` contains `Any`, so it is not fully checked against declared return type `QuerySet[Subscription, int]` [partially-any-return]
- ERROR zerver/lib/stream_subscription.py:68:12-72:45: Returned type `QuerySet[Subscription, Any]` contains `Any`, so it is not fully checked against declared return type `QuerySet[Subscription, int]` [partially-any-return]
- ERROR zerver/lib/stream_subscription.py:107:16-38: The type of this argument is an explicit `Any` [explicit-any-use]
- ERROR zerver/lib/stream_subscription.py:107:44-56: The type of this argument is an explicit `Any` [explicit-any-use]
- ERROR zerver/lib/stream_topic.py:36:42-64: The type of this argument is an explicit `Any` [explicit-any-use]
- ERROR zerver/lib/stream_topic.py:36:68-92: The type of this argument is an explicit `Any` [explicit-any-use]
- ERROR zerver/lib/stream_traffic.py:29:22-42: The type of this argument is an explicit `Any` [explicit-any-use]
- ERROR zerver/lib/stream_traffic.py:29:46-66: The type of this argument is an explicit `Any` [explicit-any-use]
- ERROR zerver/lib/stream_traffic.py:31:12-24: Returned type `dict[Any, Any]` contains `Any`, so it is not fully checked against declared return type `dict[int, int] | None` [partially-any-return]
+ ERROR zerver/lib/stream_traffic.py:31:12-24: Returned type `dict[int, int | None]` is not assignable to declared return type `dict[int, int] | None` [bad-return]
- ERROR zerver/lib/streams.py:335:9-22: The type of `user_group_id` is an explicit `Any` [explicit-any-use]
- ERROR zerver/lib/streams.py:335:24-39: The type of `user_profile_id` is an explicit `Any` [explicit-any-use]
- ERROR zerver/lib/streams.py:336:47-60: The type of this argument is an explicit `Any` [explicit-any-use]
- ERROR zerver/lib/streams.py:337:45-60: The type of this argument is an explicit `Any` [explicit-any-use]
- ERROR zerver/lib/test_classes.py:1390:16-32: Returned type `set[Any]` contains `Any`, so it is not fully checked against declared return type `set[int]` [partially-any-return]
- ERROR zerver/lib/topic.py:386:12-24: Returned type `set[Any]` contains `Any`, so it is not fully checked against declared return type `set[int]` [partially-any-return]
- ERROR zerver/lib/user_groups.py:230:8-22: Implicit conversion of `QuerySet[UserGroup, Any]` to `bool` is not allowed [implicit-bool]
+ ERROR zerver/lib/user_groups.py:230:8-22: Implicit conversion of `QuerySet[UserGroup, int]` to `bool` is not allowed [implicit-bool]
- ERROR zerver/lib/user_groups.py:660:9-20: The type of `member_type` is an explicit `Any` [explicit-any-use]
- ERROR zerver/lib/user_groups.py:660:22-30: The type of `group_id` is an explicit `Any` [explicit-any-use]
- ERROR zerver/lib/user_groups.py:660:32-41: The type of `member_id` is an explicit `Any` [explicit-any-use]
- ERROR zerver/lib/user_groups.py:661:43-51: The type of this argument is an explicit `Any` [explicit-any-use]
- ERROR zerver/lib/user_groups.py:663:48-57: The type of this argument is an explicit `Any` [explicit-any-use]
- ERROR zerver/lib/user_groups.py:665:50-59: The type of this argument is an explicit `Any` [explicit-any-use]
- ERROR zerver/lib/user_groups.py:797:12-799:48: Returned type `QuerySet[UserGroupMembership, Any]` contains `Any`, so it is not fully checked against declared return type `QuerySet[UserGroupMembership, int]` [partially-any-return]
- ERROR zerver/lib/user_status.py:83:9-16: The type of `user_id` is an explicit `Any` [explicit-any-use]
- ERROR zerver/lib/user_status.py:84:23-30: The type of this argument is an explicit `Any` [explicit-any-use]
- ERROR zerver/lib/user_status.py:84:54-57: Argument `dict[str, Any]` is not assignable to parameter `row` with type `RawUserInfoDict` in function `format_user_status` [bad-argument-type]
- ERROR zerver/lib/user_topics.py:298:9-21: The type of `recipient_id` is an explicit `Any` [explicit-any-use]
- ERROR zerver/lib/user_topics.py:299:9-19: The type of `topic_name` is an explicit `Any` [explicit-any-use]
- ERROR zerver/lib/user_topics.py:300:9-26: The type of `visibility_policy` is an explicit `Any` [explicit-any-use]
- ERROR zerver/lib/user_topics.py:301:62-67: The type of attribute `lower` is an explicit `Any` [explicit-any-use]
- ERROR zerver/lib/user_topics.py:301:74-91: The type of this argument is an explicit `Any` [explicit-any-use]
- ERROR zerver/lib/users.py:86:43-52: The type of this argument is an explicit `Any` [explicit-any-use]
- ERROR zerver/lib/users.py:86:69-78: The type of `full_name` is an explicit `Any` [explicit-any-use]
- ERROR zerver/lib/workplace_users.py:120:8-59: Implicit conversion of `set[Any]` to `bool` is not allowed [implicit-bool]
+ ERROR zerver/lib/workplace_users.py:120:8-59: Implicit conversion of `set[int]` to `bool` is not allowed [implicit-bool]
- ERROR zerver/management/commands/export_search.py:271:24-50: Returned type `tuple[Any, Literal[True]]` contains `Any`, so it is not fully checked against declared return type `tuple[str, bool]` [partially-any-return]
- ERROR zerver/management/commands/export_search.py:281:44-48: The type of this argument is an explicit `Any` [explicit-any-use]
- ERROR zerver/management/commands/export_search.py:281:50-54: The type of this argument is an explicit `Any` [explicit-any-use]
- ERROR zerver/management/commands/export_search.py:281:60-61: The type of `e` is an explicit `Any` [explicit-any-use]
- ERROR zerver/management/commands/send_custom_email.py:190:17-22: The type of `email` is an explicit `Any` [explicit-any-use]
- ERROR zerver/management/commands/send_custom_email.py:200:21-26: The type of `email` is an explicit `Any` [explicit-any-use]
+ ERROR zerver/management/commands/update_subscriber_counts.py:89:17-93:53: `QuerySet[RealmAuditLog, int | None]` is not assignable to `QuerySet[Any, int]` [bad-assignment]
- ERROR zerver/models/realms.py:1096:16-41: Returning implicit Any from function declared to return "str" [no-any-return-implicit]
- ERROR zerver/models/realms.py:1453:12-76: Returned type `list[dict[str, Any]]` is not assignable to declared return type `list[RealmDomainDict]` [bad-return]
- ERROR zerver/models/recipients.py:70:9-74:51: Returned type `QuerySet[Subscription, Any]` contains `Any`, so it is not fully checked against declared return type `QuerySet[Subscription, int]` [partially-any-return]
- ERROR zerver/models/recipients.py:170:13-51: The type of this argument is an explicit `Any` [explicit-any-use]
+ ERROR zerver/tests/test_audit_log.py:1301:41-1308:10: While checking parameter `iterable`: `int | None` is not assignable to upper bound `SupportsDunderGT[Any] | SupportsDunderLT[Any]` of type variable `SupportsRichComparisonT` [bad-specialization]
- ERROR zerver/tests/test_audit_log.py:1336:13-33: The type of `expected_subgroup_id` is an explicit `Any` [explicit-any-use]
- ERROR zerver/tests/test_audit_log.py:1337:13-35: The type of `expected_supergroup_id` is an explicit `Any` [explicit-any-use]
- ERROR zerver/tests/test_audit_log.py:1341:70-90: The type of this argument is an explicit `Any` [explicit-any-use]
- ERROR zerver/tests/test_audit_log.py:1342:74-96: The type of this argument is an explicit `Any` [explicit-any-use]
- ERROR zerver/tests/test_audit_log.py:1343:45-67: The type of this argument is an explicit `Any` [explicit-any-use]
- ERROR zerver/tests/test_audit_log.py:1344:43-63: The type of this argument is an explicit `Any` [explicit-any-use]
- ERROR zerver/tests/test_channel_folders.py:395:40-58: The type of this argument is an explicit `Any` [explicit-any-use]
- ERROR zerver/tests/test_channel_folders.py:413:40-58: The type of this argument is an explicit `Any` [explicit-any-use]
- ERROR zerver/tests/test_custom_profile_data.py:1248:46-50: The type of `item` is an explicit `Any` [explicit-any-use]
- ERROR zerver/tests/test_custom_profile_data.py:1383:40-58: The type of this argument is an explicit `Any` [explicit-any-use]
- ERROR zerver/tests/test_custom_profile_data.py:1400:40-58: The type of this argument is an explicit `Any` [explicit-any-use]
- ERROR zerver/tests/test_digest.py:185:49-56: The type of `user_id` is an explicit `Any` [explicit-any-use]
- ERROR zerver/tests/test_handle_push_notification.py:125:17-22: The type of `token` is an explicit `Any` [explicit-any-use]
- ERROR zerver/tests/test_handle_push_notification.py:131:22-27: The type of `token` is an explicit `Any` [explicit-any-use]
- ERROR zerver/tests/test_handle_push_notification.py:317:17-22: The type of `token` is an explicit `Any` [explicit-any-use]
- ERROR zerver/tests/test_import_export.py:2005:69-98: The type of this argument is an explicit `Any` [explicit-any-use]
- ERROR zerver/tests/test_import_export.py:2272:20-36: Returned type `set[Any]` contains `Any`, so it is not fully checked against declared return type `set[str]` [partially-any-return]
... (truncated 41 lines) ... |
Summary
Fixes #5735
infers Django query row types from literal field names:
values("name", "price")produces a TypedDict with typed keys.values_list("name", "price")producestuple[str, Decimal].values_list("price", flat=True)producesDecimal.named=Trueadds typed attributes and preserves tuple indexing and unpacking.Test Plan
add test