style(storage): format storage package

This commit is contained in:
rayhpeng
2026-05-13 12:52:34 +08:00
parent 11a9041b65
commit 34ec205e1d
16 changed files with 47 additions and 94 deletions
@@ -23,7 +23,7 @@ id_key = Annotated[
autoincrement=True,
sort_order=-999,
comment="Primary key ID",
)
),
]
@@ -16,10 +16,7 @@ def _validate_mysql_driver(db_url: URL) -> str:
driver = url.get_driver_name()
if driver not in {"aiomysql", "asyncmy"}:
raise ValueError(
"MySQL persistence requires async SQLAlchemy driver "
f"(aiomysql/asyncmy), got: {driver!r}"
)
raise ValueError(f"MySQL persistence requires async SQLAlchemy driver (aiomysql/asyncmy), got: {driver!r}")
return driver
@@ -1,4 +1,3 @@
from __future__ import annotations
import json
@@ -139,10 +139,7 @@ def _build_clause(compiler: SQLCompiler, typeof: str, extract: str, value: objec
if isinstance(value, int):
bp = _bind(compiler, value, BigInteger(), **kw)
if dialect.int_guard:
return (
f"(CASE WHEN {_type_check(typeof, dialect.int_types)} AND {extract} ~ {dialect.int_guard} "
f"THEN CAST({extract} AS {dialect.int_cast}) END = {bp})"
)
return f"(CASE WHEN {_type_check(typeof, dialect.int_types)} AND {extract} ~ {dialect.int_guard} THEN CAST({extract} AS {dialect.int_cast}) END = {bp})"
return f"({_type_check(typeof, dialect.int_types)} AND CAST({extract} AS {dialect.int_cast}) = {bp})"
if isinstance(value, float):
bp = _bind(compiler, value, Float(), **kw)
@@ -15,6 +15,7 @@ class AppPersistence:
"""
Unified runtime persistence bundle.
"""
checkpointer: Checkpointer
engine: AsyncEngine
session_factory: async_sessionmaker[AsyncSession]