Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

typing: Fix argument type for models in function signatures.

PIG208254f70646554
diff --git a/zerver/lib/bulk_create.py b/zerver/lib/bulk_create.py
index 45628fd7532..e24f201defa 100644
--- a/zerver/lib/bulk_create.py
+++ b/zerver/lib/bulk_create.py
@@ -1,4 +1,4 @@
-from typing import Any, Collection, Dict, Iterable, List, Optional, Set, Tuple, Union
+from typing import Any, Collection, Dict, Iterable, List, Optional, Set, Tuple, Type, Union
from django.db.models import Model
@@ -97,7 +97,7 @@ def bulk_create_users(
def bulk_set_users_or_streams_recipient_fields(
- model: Model,
+ model: Type[Model],
objects: Union[Collection[UserProfile], Collection[Stream]],
recipients: Optional[Iterable[Recipient]] = None,
) -> None:
diff --git a/zerver/lib/retention.py b/zerver/lib/retention.py
index 02009a5409d..293b2ae196d 100644
--- a/zerver/lib/retention.py
+++ b/zerver/lib/retention.py
@@ -29,7 +29,7 @@
import logging
import time
from datetime import timedelta
-from typing import Any, Dict, List, Mapping, Optional, Tuple, Union
+from typing import Any, Dict, List, Mapping, Optional, Tuple, Type, Union
from django.conf import settings
from django.db import connection, transaction
@@ -92,7 +92,7 @@ models_with_message_key: List[Dict[str, Any]] = [
@transaction.atomic(savepoint=False)
def move_rows(
- base_model: Model,
+ base_model: Type[Model],
raw_query: SQL,
*,
src_db_table: Optional[str] = None,