indie-status-page/venv/lib/python3.11/site-packages/mypyc/lower/registry.py
IndieStatusBot 902133edd3 feat: indie status page MVP -- FastAPI + SQLite
- 8 DB models (services, incidents, monitors, subscribers, etc.)
- Full CRUD API for services, incidents, monitors
- Public status page with live data
- Incident detail page with timeline
- API key authentication
- Uptime monitoring scheduler
- 13 tests passing
- TECHNICAL_DESIGN.md with full spec
2026-04-25 05:00:00 +00:00

29 lines
844 B
Python

from __future__ import annotations
from collections.abc import Callable
from typing import Final, TypeVar
from mypyc.ir.ops import Value
from mypyc.irbuild.ll_builder import LowLevelIRBuilder
LowerFunc = Callable[[LowLevelIRBuilder, list[Value], int], Value]
LowerFuncOpt = Callable[[LowLevelIRBuilder, list[Value], int], Value | None]
lowering_registry: Final[dict[str, LowerFuncOpt]] = {}
LF = TypeVar("LF", LowerFunc, LowerFuncOpt)
def lower_primitive_op(name: str) -> Callable[[LF], LF]:
"""Register a handler that generates low-level IR for a primitive op."""
def wrapper(f: LF) -> LF:
assert name not in lowering_registry
lowering_registry[name] = f
return f
return wrapper
# Import various modules that set up global state.
from mypyc.lower import int_ops, list_ops, misc_ops # noqa: F401