INNER CODE UNIT · Python

_public_error

simonlin1212/Vibe-Research · backtest/cli.py:38

def _public_error(exc: Exception) -> str:
    """Keep actionable validation causes, never return a traceback or local path."""
    message = str(exc)
    message = re.sub(r"https?://\S+", "[远程地址]", message)
    message = re.sub(r"(?:[A-Za-z]:[\\/]|/(?:Users|home|tmp|private|var|opt)/)[^\s,;。]+", "[本地路径]", message)
    message = re.sub(r"(?i)(?:api[_-]?key|token|authorization|password)\s*[:=]\s*\S+", "[凭据已隐藏]", message)
    return message[:1200]


def _catalog() -> dict:
    """界面要用的选项表 —— **由这里下发,前端不写死一份**。

    写死的那份迟早与真实实现对不上,而对不上的表现是「选了没反应」或者
    「真实存在的选项不在列表里」,两种都看不出是配置漂移。
    """
    from backtest.gate import MARKETS, STYLES
    return {
        # The model assembles this JSON; option labels alone do not tell it that

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…