Enforce modern typing (#258)

* Allow UP

* Upgrade typing

* test smolagents

* Change to contextlib

---------

Co-authored-by: Marcus Valtonen Örnhag <marcus.valtonen.ornhag@ericsson.com>
This commit is contained in:
Marcus Valtonen Örnhag
2025-04-08 22:46:12 +02:00
committed by GitHub
parent a07e9439b6
commit f70b27bd41
15 changed files with 43 additions and 47 deletions

View File

@@ -1,11 +1,10 @@
import logging
from collections.abc import Callable
from contextlib import AbstractAsyncContextManager
from pathlib import Path
from typing import (
Any,
AsyncContextManager,
Callable,
Literal,
Optional,
TypedDict,
cast,
)
@@ -29,8 +28,8 @@ curr_dir = Path(__file__).parent
class Body(BaseModel):
sdp: Optional[str] = None
candidate: Optional[dict[str, Any]] = None
sdp: str | None = None
candidate: dict[str, Any] | None = None
type: str
webrtc_id: str
@@ -253,7 +252,7 @@ class Stream(WebRTCConnectionMixin):
return wrapper
def _inject_startup_message(
self, lifespan: Callable[[FastAPI], AsyncContextManager] | None = None
self, lifespan: Callable[[FastAPI], AbstractAsyncContextManager] | None = None
):
"""
Create a FastAPI lifespan context manager to print startup messages and check environment.