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:
@@ -87,10 +87,10 @@ class DeribitClient:
|
||||
resp = await http.get(url, params=request_params, headers=headers)
|
||||
data = resp.json()
|
||||
if "result" in data:
|
||||
return data
|
||||
return data # type: ignore[no-any-return]
|
||||
return {"result": None, "error": error_msg}
|
||||
|
||||
return data
|
||||
return data # type: ignore[no-any-return]
|
||||
|
||||
# ── Read tools ───────────────────────────────────────────────
|
||||
|
||||
@@ -190,9 +190,9 @@ class DeribitClient:
|
||||
self._request("public/get_book_summary_by_currency", summary_params),
|
||||
return_exceptions=True,
|
||||
)
|
||||
raw = instruments_raw if isinstance(instruments_raw, dict) else {}
|
||||
raw = instruments_raw if isinstance(instruments_raw, dict) else {} # type: ignore[has-type]
|
||||
summary_items = (
|
||||
summary_raw.get("result") if isinstance(summary_raw, dict) else None
|
||||
summary_raw.get("result") if isinstance(summary_raw, dict) else None # type: ignore[has-type]
|
||||
) or []
|
||||
oi_by_name: dict[str, float] = {}
|
||||
for s in summary_items:
|
||||
@@ -1200,8 +1200,8 @@ class DeribitClient:
|
||||
if len({l["expiry"] for l in legs}) == 2 and len(strikes) == 1:
|
||||
return "calendar spread"
|
||||
if n == 4:
|
||||
types = [l["type"] for l in legs]
|
||||
if types.count("P") == 2 and types.count("C") == 2:
|
||||
types_list = [l["type"] for l in legs]
|
||||
if types_list.count("P") == 2 and types_list.count("C") == 2:
|
||||
return "iron condor"
|
||||
return "custom"
|
||||
|
||||
@@ -1484,7 +1484,7 @@ class DeribitClient:
|
||||
if not values_sorted:
|
||||
return None
|
||||
idx = int(round((len(values_sorted) - 1) * p))
|
||||
return values_sorted[idx]
|
||||
return values_sorted[idx] # type: ignore[no-any-return]
|
||||
|
||||
mean = sum(values) / len(values) if values else None
|
||||
return {
|
||||
@@ -1567,7 +1567,7 @@ class DeribitClient:
|
||||
r = raw.get("result")
|
||||
if r is None:
|
||||
return {"error": raw.get("error", "unknown"), "state": "error"}
|
||||
return r
|
||||
return r # type: ignore[no-any-return]
|
||||
|
||||
async def place_combo_order(
|
||||
self,
|
||||
|
||||
Reference in New Issue
Block a user