mirror of
https://github.com/osm-search/Nominatim.git
synced 2026-02-26 11:08:13 +00:00
adapt to newest version of mypy
This commit is contained in:
@@ -69,8 +69,8 @@ class DBConnection:
|
|||||||
self.current_params: Optional[Sequence[Any]] = None
|
self.current_params: Optional[Sequence[Any]] = None
|
||||||
self.ignore_sql_errors = ignore_sql_errors
|
self.ignore_sql_errors = ignore_sql_errors
|
||||||
|
|
||||||
self.conn: Optional['psycopg2.connection'] = None
|
self.conn: Optional['psycopg2._psycopg.connection'] = None
|
||||||
self.cursor: Optional['psycopg2.cursor'] = None
|
self.cursor: Optional['psycopg2._psycopg.cursor'] = None
|
||||||
self.connect(cursor_factory=cursor_factory)
|
self.connect(cursor_factory=cursor_factory)
|
||||||
|
|
||||||
def close(self) -> None:
|
def close(self) -> None:
|
||||||
@@ -78,7 +78,7 @@ class DBConnection:
|
|||||||
"""
|
"""
|
||||||
if self.conn is not None:
|
if self.conn is not None:
|
||||||
if self.cursor is not None:
|
if self.cursor is not None:
|
||||||
self.cursor.close() # type: ignore[no-untyped-call]
|
self.cursor.close()
|
||||||
self.cursor = None
|
self.cursor = None
|
||||||
self.conn.close()
|
self.conn.close()
|
||||||
|
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ class Cursor(psycopg2.extras.DictCursor):
|
|||||||
""" Query execution that logs the SQL query when debugging is enabled.
|
""" Query execution that logs the SQL query when debugging is enabled.
|
||||||
"""
|
"""
|
||||||
if LOG.isEnabledFor(logging.DEBUG):
|
if LOG.isEnabledFor(logging.DEBUG):
|
||||||
LOG.debug(self.mogrify(query, args).decode('utf-8')) # type: ignore[no-untyped-call]
|
LOG.debug(self.mogrify(query, args).decode('utf-8'))
|
||||||
|
|
||||||
super().execute(query, args)
|
super().execute(query, args)
|
||||||
|
|
||||||
|
|||||||
@@ -118,4 +118,4 @@ class CopyBuffer:
|
|||||||
"""
|
"""
|
||||||
if self.buffer.tell() > 0:
|
if self.buffer.tell() > 0:
|
||||||
self.buffer.seek(0)
|
self.buffer.seek(0)
|
||||||
cur.copy_from(self.buffer, table, columns=columns) # type: ignore[no-untyped-call]
|
cur.copy_from(self.buffer, table, columns=columns)
|
||||||
|
|||||||
Reference in New Issue
Block a user