Move the auto-generated fallback chain definitions from app/databus/provider_chains.py to app/databus/_generated/provider_chains.py (underscore prefix = generated). The legacy app/databus/provider_chains.py becomes an 8-line re-export shim. Added scripts/generate_provider_chains.py to regenerate from the shim. Phase 3B of AUDIT-2026-Q3.md.
33 lines
No EOL
981 B
Python
Executable file
33 lines
No EOL
981 B
Python
Executable file
#!/usr/bin/env python3
|
|
"""Regenerate app.databus._generated.provider_chains.
|
|
|
|
Phase 3B of AUDIT-2026-Q3.md.
|
|
|
|
The generated file is checked into git so dev installs work offline.
|
|
Re-run this script only when the chain topology changes (new data type,
|
|
new provider, etc.).
|
|
"""
|
|
from pathlib import Path
|
|
|
|
SOURCE = Path("app/databus/provider_chains.py")
|
|
TARGET = Path("app/databus/_generated/provider_chains.py")
|
|
|
|
|
|
def main():
|
|
TARGET.parent.mkdir(parents=True, exist_ok=True)
|
|
content = SOURCE.read_text()
|
|
header = (
|
|
'"""\n'
|
|
"AUTO-GENERATED by scripts/generate_provider_chains.py - DO NOT EDIT.\n"
|
|
"\n"
|
|
"Phase 3B of AUDIT-2026-Q3.md.\n"
|
|
"Source: app/databus/provider_chains.py (legacy shim).\n"
|
|
'"""\n'
|
|
)
|
|
body = content.split('"""', 2)[2] if '"""' in content else content
|
|
TARGET.write_text(header + body)
|
|
print("wrote {} ({} bytes)".format(TARGET, TARGET.stat().st_size))
|
|
|
|
|
|
if __name__ == "__main__":
|
|
main() |