adapt annotations for SQLAlchemy 2.x

It is not possible to produce type annotations that work with both
versions 1.4 and 2.0. So keep to the principle of only supporting
newest versions when it comes to mypy. This means that some types
may have to be string quoted to not cause issues when running with
SQLAlchemy 1.4.
This commit is contained in:
Sarah Hoffmann
2023-01-27 21:53:53 +01:00
parent 7f5fbe1dc7
commit 2156fd4909
4 changed files with 7 additions and 7 deletions

View File

@@ -69,7 +69,7 @@ class NominatimAPIAsync:
self.server_version = 0
if self.server_version >= 110000:
@sa.event.listens_for(engine.sync_engine, "connect") # type: ignore[misc]
@sa.event.listens_for(engine.sync_engine, "connect")
def _on_connect(dbapi_con: Any, _: Any) -> None:
cursor = dbapi_con.cursor()
cursor.execute("SET jit_above_cost TO '-1'")