MCPcopy Index your code
hub / github.com/idank/explainshell / _log_summary

Function _log_summary

explainshell/manager.py:379–415  ·  view source on GitHub ↗

Log a summary of batch results and return the exit code.

(
    batch_result: BatchResult,
    prefilter_skipped: int,
    elapsed: float,
    dry_run: bool = False,
    symlinks_mapped: int = 0,
    content_deduped: int = 0,
)

Source from the content-addressed store, hash-verified

377
378
379def _log_summary(
380 batch_result: BatchResult,
381 prefilter_skipped: int,
382 elapsed: float,
383 dry_run: bool = False,
384 symlinks_mapped: int = 0,
385 content_deduped: int = 0,
386) -> int:
387 """Log a summary of batch results and return the exit code."""
388 added = batch_result.n_succeeded + symlinks_mapped + content_deduped
389 skipped = batch_result.n_skipped + prefilter_skipped
390 failed = batch_result.n_failed
391
392 status = "Interrupted" if batch_result.interrupted else "Done"
393 dry_run_note = " (dry run)" if dry_run else ""
394 token_note = ""
395 if batch_result.stats.input_tokens:
396 parts = [
397 f"{util.fmt_tokens(batch_result.stats.input_tokens)} in",
398 f"{util.fmt_tokens(batch_result.stats.output_tokens)} out",
399 ]
400 if batch_result.stats.reasoning_tokens:
401 parts.append(
402 f"{util.fmt_tokens(batch_result.stats.reasoning_tokens)} reasoning"
403 )
404 token_note = f" Tokens: {' / '.join(parts)}."
405 logger.info(
406 "%s%s: %d extracted, %d skipped, %d failed.%s Total time: %s",
407 status,
408 dry_run_note,
409 added,
410 skipped,
411 failed,
412 token_note,
413 _fmt_elapsed(elapsed),
414 )
415 return 0 if failed == 0 else 1
416
417
418def _write_report(run_dir: str, report: ExtractionReport) -> None:

Callers 3

extractFunction · 0.85
diff_db_cmdFunction · 0.85
diff_extractors_cmdFunction · 0.85

Calls 1

_fmt_elapsedFunction · 0.85

Tested by

no test coverage detected