hack-house/.venv/lib/python3.12/site-packages/sanic_ext/extras/validation/clean.py
leetcrypt bb1d662ee1 chore: rename project coven → hack-house ⛧
Rebrand the Rust client crate (coven/ → hh/, package+binary "hack-house"),
README, CLI strings, and branch (coven → hack-house). Gitea repo renamed
cmd-chat → hack-house to match. Crypto/server logic unchanged; selftest +
golden-vector test still green, binary is now `hack-house`.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-05-30 13:29:14 -07:00

18 lines
452 B
Python

from typing import Any, get_origin, get_type_hints
def clean_data(model: type[object], data: dict[str, Any]) -> dict[str, Any]:
hints = get_type_hints(model)
return {key: _coerce(hints[key], value) for key, value in data.items()}
def _coerce(param_type, value: Any) -> Any:
if (
get_origin(param_type) is not list
and isinstance(value, list)
and len(value) == 1
):
value = value[0]
return value