indie-status-page/venv/lib/python3.11/site-packages/mypyc/ir/deps.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

59 lines
1.8 KiB
Python

from typing import Final
class Capsule:
"""Defines a C extension capsule that a primitive may require."""
def __init__(self, name: str) -> None:
# Module fullname, e.g. 'librt.base64'
self.name: Final = name
def __repr__(self) -> str:
return f"Capsule(name={self.name!r})"
def __eq__(self, other: object) -> bool:
return isinstance(other, Capsule) and self.name == other.name
def __hash__(self) -> int:
return hash(("Capsule", self.name))
class SourceDep:
"""Defines a C source file that a primitive may require.
Each source file must also have a corresponding .h file (replace .c with .h)
that gets implicitly #included if the source is used.
"""
def __init__(self, path: str) -> None:
# Relative path from mypyc/lib-rt, e.g. 'bytes_extra_ops.c'
self.path: Final = path
def __repr__(self) -> str:
return f"SourceDep(path={self.path!r})"
def __eq__(self, other: object) -> bool:
return isinstance(other, SourceDep) and self.path == other.path
def __hash__(self) -> int:
return hash(("SourceDep", self.path))
def get_header(self) -> str:
"""Get the header file path by replacing .c with .h"""
return self.path.replace(".c", ".h")
Dependency = Capsule | SourceDep
LIBRT_STRINGS: Final = Capsule("librt.strings")
LIBRT_BASE64: Final = Capsule("librt.base64")
LIBRT_VECS: Final = Capsule("librt.vecs")
LIBRT_TIME: Final = Capsule("librt.time")
BYTES_EXTRA_OPS: Final = SourceDep("bytes_extra_ops.c")
BYTES_WRITER_EXTRA_OPS: Final = SourceDep("byteswriter_extra_ops.c")
STRING_WRITER_EXTRA_OPS: Final = SourceDep("stringwriter_extra_ops.c")
BYTEARRAY_EXTRA_OPS: Final = SourceDep("bytearray_extra_ops.c")
STR_EXTRA_OPS: Final = SourceDep("str_extra_ops.c")
VECS_EXTRA_OPS: Final = SourceDep("vecs_extra_ops.c")