Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
typing: Replace CursorObj by CursorWrapper.
PIG20871427239d00b
diff --git a/zerver/lib/fix_unreads.py b/zerver/lib/fix_unreads.pyindex 247a7666707..a29c462bb88 100644--- a/zerver/lib/fix_unreads.py+++ b/zerver/lib/fix_unreads.py@@ -1,13 +1,10 @@import loggingimport time-from typing import Callable, List, TypeVar--from psycopg2.extensions import cursor-from psycopg2.sql import SQL--CursorObj = TypeVar("CursorObj", bound=cursor)+from typing import Callable, Listfrom django.db import connection+from django.db.backends.utils import CursorWrapper+from psycopg2.sql import SQLfrom zerver.models import UserProfile@@ -23,7 +20,7 @@ logger.setLevel(logging.WARNING)def build_topic_mute_checker(- cursor: CursorObj, user_profile: UserProfile+ cursor: CursorWrapper, user_profile: UserProfile) -> Callable[[int, str], bool]:"""This function is similar to the function of the same name@@ -52,7 +49,7 @@ def build_topic_mute_checker(return is_muted-def update_unread_flags(cursor: CursorObj, user_message_ids: List[int]) -> None:+def update_unread_flags(cursor: CursorWrapper, user_message_ids: List[int]) -> None:query = SQL("""UPDATE zerver_usermessage@@ -72,7 +69,7 @@ def get_timing(message: str, f: Callable[[], None]) -> None:logger.info("elapsed time: %.03f\n", elapsed)-def fix_unsubscribed(cursor: CursorObj, user_profile: UserProfile) -> None:+def fix_unsubscribed(cursor: CursorWrapper, user_profile: UserProfile) -> None:recipient_ids = []diff --git a/zerver/lib/migrate.py b/zerver/lib/migrate.pyindex 1189c16bd5e..ab1b7b3d242 100644--- a/zerver/lib/migrate.py+++ b/zerver/lib/migrate.py@@ -1,14 +1,12 @@import time-from typing import List, TypeVar+from typing import List-from psycopg2.extensions import cursor+from django.db.backends.utils import CursorWrapperfrom psycopg2.sql import SQL, Composable, Identifier-CursorObj = TypeVar("CursorObj", bound=cursor)-def do_batch_update(- cursor: CursorObj,+ cursor: CursorWrapper,table: str,assignments: List[Composable],batch_size: int = 10000,