mypy: fix new warnings due to external type updates

This commit is contained in:
Sarah Hoffmann
2022-09-05 17:38:48 +02:00
parent ae5687539a
commit 185c3cf7a8
3 changed files with 4 additions and 3 deletions

View File

@@ -189,7 +189,7 @@ def connect(dsn: str) -> ConnectionContext:
try:
conn = psycopg2.connect(dsn, connection_factory=Connection)
ctxmgr = cast(ConnectionContext, contextlib.closing(conn))
ctxmgr.connection = cast(Connection, conn)
ctxmgr.connection = conn
return ctxmgr
except psycopg2.OperationalError as err:
raise UsageError(f"Cannot connect to database: {err}") from err