INNER CODE UNIT · Python

_emit

ythx-101/x-tweet-fetcher · src/xtf/cli.py:27

def _emit(result: dict[str, Any], pretty: bool) -> None:
    print(json.dumps(result, ensure_ascii=False, indent=2 if pretty else None))


def _fail(result: dict[str, Any], exc: XtfError) -> dict[str, Any]:
    result["error"] = str(exc) or exc.code
    result["error_code"] = exc.code
    if getattr(exc, "causes", None):
        result["error_causes"] = {k: str(v) for k, v in exc.causes.items()}
    return result


def _archive_if_requested(args, result: dict[str, Any], tweet_dicts) -> None:
    """Archive fetched tweet dicts when --ledger is set (never fatal).

    Without --ledger this is a no-op, keeping legacy behavior identical.
    """
    if not args.ledger:

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…