mirror of
https://github.com/osm-search/Nominatim.git
synced 2026-02-26 11:08:13 +00:00
mypy: fix new warnings due to external type updates
This commit is contained in:
@@ -94,7 +94,8 @@ class DBConnection:
|
|||||||
|
|
||||||
# Use a dict to hand in the parameters because async is a reserved
|
# Use a dict to hand in the parameters because async is a reserved
|
||||||
# word in Python3.
|
# word in Python3.
|
||||||
self.conn = psycopg2.connect(**{'dsn': self.dsn, 'async': True})
|
self.conn = psycopg2.connect(**{'dsn': self.dsn, 'async': True}) # type: ignore
|
||||||
|
assert self.conn
|
||||||
self.wait()
|
self.wait()
|
||||||
|
|
||||||
if cursor_factory is not None:
|
if cursor_factory is not None:
|
||||||
|
|||||||
@@ -189,7 +189,7 @@ def connect(dsn: str) -> ConnectionContext:
|
|||||||
try:
|
try:
|
||||||
conn = psycopg2.connect(dsn, connection_factory=Connection)
|
conn = psycopg2.connect(dsn, connection_factory=Connection)
|
||||||
ctxmgr = cast(ConnectionContext, contextlib.closing(conn))
|
ctxmgr = cast(ConnectionContext, contextlib.closing(conn))
|
||||||
ctxmgr.connection = cast(Connection, conn)
|
ctxmgr.connection = conn
|
||||||
return ctxmgr
|
return ctxmgr
|
||||||
except psycopg2.OperationalError as err:
|
except psycopg2.OperationalError as err:
|
||||||
raise UsageError(f"Cannot connect to database: {err}") from err
|
raise UsageError(f"Cannot connect to database: {err}") from err
|
||||||
|
|||||||
@@ -268,7 +268,7 @@ def check_database_index_valid(conn: Connection, _: Configuration) -> CheckResul
|
|||||||
WHERE pg_index.indisvalid = false
|
WHERE pg_index.indisvalid = false
|
||||||
AND pg_index.indexrelid = pg_class.oid""")
|
AND pg_index.indexrelid = pg_class.oid""")
|
||||||
|
|
||||||
broken = list(cur)
|
broken = [c[0] for c in cur]
|
||||||
|
|
||||||
if broken:
|
if broken:
|
||||||
return CheckState.FAIL, dict(indexes='\n '.join(broken))
|
return CheckState.FAIL, dict(indexes='\n '.join(broken))
|
||||||
|
|||||||
Reference in New Issue
Block a user