mirror of
				https://github.com/zulip/zulip.git
				synced 2025-11-04 05:53:43 +00:00 
			
		
		
		
	python: Avoid relying on Collection supertype of QuerySet.
QuerySet doesn’t implement __contains__, so it can’t be a subtype of Container or Collection (https://code.djangoproject.com/ticket/35154). This incorrect subtyping annotation was removed in https://github.com/typeddjango/django-stubs/pull/1925, so we need to stop relying on it before upgrading to django-stubs 5. Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
		
				
					committed by
					
						
						Tim Abbott
					
				
			
			
				
	
			
			
			
						parent
						
							5654d051f7
						
					
				
				
					commit
					f31579a220
				
			@@ -7,7 +7,7 @@ from typing import Any, Collection, Dict, Iterator, List, Optional, Set, Tuple
 | 
			
		||||
 | 
			
		||||
from django.conf import settings
 | 
			
		||||
from django.db import transaction
 | 
			
		||||
from django.db.models import Exists, OuterRef
 | 
			
		||||
from django.db.models import Exists, OuterRef, QuerySet
 | 
			
		||||
from django.utils.timezone import now as timezone_now
 | 
			
		||||
from django.utils.translation import gettext as _
 | 
			
		||||
from typing_extensions import TypeAlias
 | 
			
		||||
@@ -331,7 +331,7 @@ def get_slim_stream_id_map(realm: Realm) -> Dict[int, Stream]:
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
def bulk_get_digest_context(
 | 
			
		||||
    users: Collection[UserProfile], cutoff: float
 | 
			
		||||
    users: Collection[UserProfile] | QuerySet[UserProfile], cutoff: float
 | 
			
		||||
) -> Iterator[Tuple[UserProfile, Dict[str, Any]]]:
 | 
			
		||||
    # We expect a non-empty list of users all from the same realm.
 | 
			
		||||
    assert users
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user