INNER CODE UNIT · Python

_reject_json_constant

mars-tw/anti-gambling-trader-tw · core/ui/server.py:93

def _reject_json_constant(value: str) -> None:
    raise ValueError(f"JSON 不接受 {value}")


def _finite_json_float(value: str) -> float:
    """Parse a JSON decimal only when Python can represent it finitely."""

    number = float(value)
    if not math.isfinite(number):
        raise ValueError("JSON 數字必須是有限值")
    return number


def _static_path(name: str) -> Path:
    return Path(__file__).resolve().parent / "static" / name


def _ascii_download_name(filename: str) -> str:

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…