Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
scripts: Help mypy resolve the psycopg2.connect overload.
Anders Kaseorg5d77d50423a7
diff --git a/puppet/zulip/files/postgresql/process_fts_updates b/puppet/zulip/files/postgresql/process_fts_updatesindex 722307c7761..0c9a8050d51 100755--- a/puppet/zulip/files/postgresql/process_fts_updates+++ b/puppet/zulip/files/postgresql/process_fts_updates@@ -172,7 +172,8 @@ if options.nagios_check:pg_args["user"] = options.nagios_userelse:del pg_args["user"]- conn = psycopg2.connect(**pg_args)+ # connection_factory=None lets mypy understand the return type+ conn = psycopg2.connect(connection_factory=None, **pg_args)cursor = conn.cursor()cursor.execute("SELECT count(*) FROM fts_update_log")num = cursor.fetchall()[0][0]@@ -199,7 +200,8 @@ retries = 1while True:try:if conn is None:- conn = psycopg2.connect(**pg_args)+ # connection_factory=None lets mypy understand the return type+ conn = psycopg2.connect(connection_factory=None, **pg_args)cursor = conn.cursor()retries = 30diff --git a/scripts/setup/reindex-textual-data b/scripts/setup/reindex-textual-dataindex 67952064e3c..617e6d25afc 100755--- a/scripts/setup/reindex-textual-data+++ b/scripts/setup/reindex-textual-data@@ -44,7 +44,8 @@ pg_args["dbname"] = settings.DATABASES["default"]["NAME"]pg_args["sslmode"] = settings.DATABASES["default"]["OPTIONS"].get("sslmode")pg_args["connect_timeout"] = "600"-conn = psycopg2.connect(**pg_args)+# connection_factory=None lets mypy understand the return type+conn = psycopg2.connect(connection_factory=None, **pg_args)conn.autocommit = Truepg_server_version = conn.server_version