mirror of
https://github.com/osm-search/Nominatim.git
synced 2026-02-14 01:47:57 +00:00
Merge pull request #3874 from vytas7/falcon-4.2-typing
Adapt type annotations to Falcon App type changes
This commit is contained in:
@@ -7,6 +7,8 @@
|
||||
"""
|
||||
Server implementation using the falcon webserver framework.
|
||||
"""
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import Optional, Mapping, Any, List, cast
|
||||
from pathlib import Path
|
||||
import asyncio
|
||||
@@ -161,7 +163,7 @@ class APIMiddleware:
|
||||
|
||||
def __init__(self, project_dir: Path, environ: Optional[Mapping[str, str]]) -> None:
|
||||
self.api = NominatimAPIAsync(project_dir, environ)
|
||||
self.app: Optional[App] = None
|
||||
self.app: Optional[App[Request, Response]] = None
|
||||
|
||||
@property
|
||||
def config(self) -> Configuration:
|
||||
@@ -169,7 +171,7 @@ class APIMiddleware:
|
||||
"""
|
||||
return self.api.config
|
||||
|
||||
def set_app(self, app: App) -> None:
|
||||
def set_app(self, app: App[Request, Response]) -> None:
|
||||
""" Set the Falcon application this middleware is connected to.
|
||||
"""
|
||||
self.app = app
|
||||
@@ -193,7 +195,7 @@ class APIMiddleware:
|
||||
|
||||
|
||||
def get_application(project_dir: Path,
|
||||
environ: Optional[Mapping[str, str]] = None) -> App:
|
||||
environ: Optional[Mapping[str, str]] = None) -> App[Request, Response]:
|
||||
""" Create a Nominatim Falcon ASGI application.
|
||||
"""
|
||||
apimw = APIMiddleware(project_dir, environ)
|
||||
@@ -215,7 +217,7 @@ def get_application(project_dir: Path,
|
||||
return app
|
||||
|
||||
|
||||
def run_wsgi() -> App:
|
||||
def run_wsgi() -> App[Request, Response]:
|
||||
""" Entry point for uvicorn.
|
||||
|
||||
Make sure uvicorn is run from the project directory.
|
||||
|
||||
Reference in New Issue
Block a user