chore(V2): mypy clean — fix radice V2 nuovo + suppress mirato V1 legacy
- settings.py: lambda factory + type:ignore[call-arg] per env-loaded models
- routers/*.py (6 file): cast esplicito Environment / Client per request.state
- __main__.py: cast Literal env in builder, type:ignore Settings()
- server.py: type:ignore[method-assign] su app.openapi
- deribit/tools.py: assert su validator-normalized fields, list return type
- deribit/client.py: type:ignore mirato no-any-return / has-type, rinomina types→types_list
- hyperliquid/{client,tools}.py: assert su validator-normalized fields, var-annotated
- alpaca/client.py: type:ignore mirato per SDK quirks (assignment, no-any-return, arg-type, union-attr)
- {macro,sentiment}/fetchers.py: type:ignore mirato no-any-return / operator / union-attr
Mypy: 68 → 0 errors. Test: 259 passing. Ruff: clean.
This commit is contained in:
@@ -10,6 +10,7 @@ Boot:
|
||||
from __future__ import annotations
|
||||
|
||||
from contextlib import asynccontextmanager
|
||||
from typing import Literal, cast
|
||||
|
||||
import uvicorn
|
||||
from fastapi import FastAPI
|
||||
@@ -40,7 +41,9 @@ def _make_app(settings: Settings) -> FastAPI:
|
||||
app.state.settings = settings
|
||||
|
||||
async def builder(exchange: str, env: str):
|
||||
return await build_client(settings, exchange, env)
|
||||
return await build_client(
|
||||
settings, exchange, cast(Literal["testnet", "mainnet"], env)
|
||||
)
|
||||
|
||||
app.state.registry = ClientRegistry(builder=builder)
|
||||
|
||||
@@ -65,7 +68,7 @@ def _make_app(settings: Settings) -> FastAPI:
|
||||
|
||||
def main() -> None:
|
||||
configure_root_logging()
|
||||
settings = Settings()
|
||||
settings = Settings() # type: ignore[call-arg]
|
||||
app = _make_app(settings)
|
||||
uvicorn.run(
|
||||
app,
|
||||
|
||||
Reference in New Issue
Block a user