e9a3de49af
test / run tests/run_tests.py (pull_request) Successful in 14s
- log.die() typed NoReturn so pyright knows it terminates control flow (was returning the unreachable Die instance type). - manifest.py: raw inputs typed object (not Any) and narrowed via a new _as_json_object helper that validates str keys and returns dict[str, object]. Eliminates the Unknown cascade through .get() calls under strict. - _from_dict classmethods renamed to from_dict so cross-class construction (Bottle.from_dict from Manifest.from_json_obj, etc.) doesn't trip reportPrivateUsage. - _SUPPORTED_RUNTIMES typed tuple[Runtime, ...] so the membership check narrows runtime_raw to Literal["runc", "runsc"] and the # type: ignore[assignment] is no longer needed. - Bottle.env uses a typed _empty_str_dict factory; bare dict resolves to dict[Unknown, Unknown] under strict. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
25 lines
562 B
Python
25 lines
562 B
Python
"""Tiny logging wrappers. All output goes to stderr."""
|
|
|
|
from __future__ import annotations
|
|
|
|
import sys
|
|
from typing import NoReturn
|
|
|
|
|
|
def info(msg: str) -> None:
|
|
print(f"claude-bottle: {msg}", file=sys.stderr)
|
|
|
|
|
|
def warn(msg: str) -> None:
|
|
print(f"claude-bottle: warning: {msg}", file=sys.stderr)
|
|
|
|
|
|
class Die(SystemExit):
|
|
"""Raised by die() so callers (and tests) can distinguish a deliberate
|
|
fatal exit from an unrelated SystemExit."""
|
|
|
|
|
|
def die(msg: str) -> NoReturn:
|
|
print(f"claude-bottle: error: {msg}", file=sys.stderr)
|
|
raise Die(1)
|