INNER CODE UNIT · Python

_migrate_source_encoding_on_startup

ArcReel/ArcReel · server/app.py:292

async def _migrate_source_encoding_on_startup(
    projects_root: Path,
    *,
    migrate_source_encoding: Callable[[Path], Any] | None = None,
) -> dict[str, dict]:
    """对每个项目执行幂等编码迁移。失败被捕获并写日志,不阻塞启动。"""
    summary: dict[str, dict] = {}
    migrate = migrate_source_encoding or migrate_project_source_encoding
    if not projects_root.exists():  # noqa: ASYNC240 -- 启动期一次性存在性检查,本地元数据
        return summary

    def _run_one(project_dir: Path) -> dict:
        marker_dir = project_dir / ".arcreel"
        marker = marker_dir / "source_encoding_migrated"
        if marker.exists():
            return {"skipped": True}
        try:
            result = migrate(project_dir)

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…