lint fixes

This commit is contained in:
Илья Глазунов 2025-12-04 01:27:43 +03:00
parent 3454801be7
commit edaccb59bb
3 changed files with 10 additions and 6 deletions

View File

@ -11,7 +11,9 @@ The WSGI app path is passed via environment variables:
import importlib
import os
from typing import Any, Callable
from typing import Any, Callable, Optional
WSGI_ADAPTER: Optional[str] = None
try:
from a2wsgi import WSGIMiddleware
@ -27,7 +29,7 @@ except ImportError:
WSGI_ADAPTER = None
def _load_wsgi_app() -> Callable:
def _load_wsgi_app() -> Callable[..., Any]:
app_path = os.environ.get("PYSERVE_WSGI_APP")
is_factory = os.environ.get("PYSERVE_WSGI_FACTORY", "0") == "1"
@ -51,8 +53,9 @@ def _load_wsgi_app() -> Callable:
raise RuntimeError(f"Module '{module_name}' has no attribute '{attr_name}'")
if is_factory:
return app_or_factory()
return app_or_factory
result: Callable[..., Any] = app_or_factory()
return result
return app_or_factory # type: ignore[return-value]
def _create_asgi_app() -> Any:

View File

@ -223,7 +223,7 @@ class ExtensionManager:
try:
from .process_extension import ProcessOrchestrationExtension
self.extension_registry["process_orchestration"] = ProcessOrchestrationExtension # type: ignore
self.extension_registry["process_orchestration"] = ProcessOrchestrationExtension
except ImportError:
pass # Optional dependency

View File

@ -152,9 +152,10 @@ class PyServeServer:
def _create_app(self) -> None:
from contextlib import asynccontextmanager
from typing import AsyncIterator
@asynccontextmanager
async def lifespan(app: Starlette):
async def lifespan(app: Starlette) -> AsyncIterator[None]:
await self._load_async_extensions()
logger.info("Async extensions loaded")
yield