From b642aabd3a19539573cf43efc80339d11a2f7868 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrei=20V=C4=83caru?= <16517508+anvacaru@users.noreply.github.com> Date: Mon, 11 Nov 2024 17:26:59 +0700 Subject: [PATCH] remove rich handler (#882) --- src/kontrol/__main__.py | 11 ----------- src/kontrol/prove.py | 9 +++++---- 2 files changed, 5 insertions(+), 15 deletions(-) diff --git a/src/kontrol/__main__.py b/src/kontrol/__main__.py index a31631f9a..c6ef378ec 100644 --- a/src/kontrol/__main__.py +++ b/src/kontrol/__main__.py @@ -10,8 +10,6 @@ from pyk.cterm.symbolic import CTermSMTError from pyk.proof.reachability import APRFailureInfo, APRProof from pyk.proof.tui import APRProofViewer -from rich.highlighter import NullHighlighter -from rich.logging import RichHandler from . import VERSION from .cli import _create_argument_parser, generate_options, get_argument_type_setter, get_option_string_destination @@ -115,15 +113,6 @@ def main() -> None: logging.basicConfig( level=loglevel(args, toml_args), format=_LOG_FORMAT, - handlers=[ - RichHandler( - level=loglevel(args, toml_args), - show_level=False, - show_time=False, - show_path=False, - highlighter=NullHighlighter(), - ), - ], ) check_k_version() diff --git a/src/kontrol/prove.py b/src/kontrol/prove.py index 70812a1e3..006d1205c 100644 --- a/src/kontrol/prove.py +++ b/src/kontrol/prove.py @@ -503,12 +503,13 @@ def create_kcfg_explore() -> KCFGExplore: redirect_stdout=True, ) as progress: + display_status_bar = not (options.hide_status_bar or options.verbose or options.debug) failure_infos: list[APRFailureInfo | Exception | None] if options.workers > 1 and len(tests) > 1: done_tests = 0 failed_tests = 0 passed_tests = 0 - if not options.hide_status_bar: + if display_status_bar: task = progress.add_task( f'Multi-proof Mode ({options.workers} workers)', status='Running', @@ -517,7 +518,7 @@ def create_kcfg_explore() -> KCFGExplore: def update_status_bar(test_id: str, result: Any) -> None: nonlocal done_tests, failed_tests, passed_tests, progress - if options.hide_status_bar or progress is None: + if not display_status_bar or progress is None: return done_tests += 1 proof = foundry.get_apr_proof(test_id) @@ -540,14 +541,14 @@ def update_status_bar(test_id: str, result: Any) -> None: process_pool.close() process_pool.join() - if not options.hide_status_bar: + if display_status_bar: if progress is not None: progress.update(task, status='Finished', advance=1) failure_infos = [result.get() for result in results] else: failure_infos = [] for test in tests: - failure_infos.append(init_and_run_proof(test, None if options.hide_status_bar else progress)) + failure_infos.append(init_and_run_proof(test, None if not display_status_bar else progress)) proofs = [foundry.get_apr_proof(test.id) for test in tests]