From b8df47a00a37134fcb582f2959583cf4caac5623 Mon Sep 17 00:00:00 2001 From: Lukas Heumos Date: Tue, 22 Oct 2024 22:05:21 +0200 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20Restrict=20stdout=20of=20validation?= =?UTF-8?q?=20messages=20of=20Curator=20to=20max=2010=20terms=20(#2094)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: zethson --- lamindb/_curate.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/lamindb/_curate.py b/lamindb/_curate.py index e9cc22802..638d4afd9 100644 --- a/lamindb/_curate.py +++ b/lamindb/_curate.py @@ -1212,12 +1212,15 @@ def _log_mapping_info(): validated_hint_print = validated_hint_print or f".add_validated_from('{key}')" n_validated = len(values_validated) + if n_validated > 0: _log_mapping_info() + terms_str = f"{', '.join([f'{chr(39)}{v}{chr(39)}' for v in values_validated[:10]])}{', ...' if len(values_validated) > 10 else ''}" + logger.warning( f"found {colors.yellow(n_validated)} validated terms: " - f"{colors.yellow(values_validated)}\n → save terms via " - f"{colors.yellow(validated_hint_print)}" + f"{colors.yellow(terms_str)}\n" + f"→ save terms via {colors.yellow(validated_hint_print)}" ) non_validated_hint_print = validated_hint_print.replace("_validated_", "_new_") @@ -1236,9 +1239,11 @@ def _log_mapping_info(): print_values = _print_values(non_validated) warning_message = ( f"{colors.red(f'{n_non_validated} terms')} {are} not validated: " - f"{colors.red(print_values)}\n → fix typos, remove non-existent values, or save terms via " + f"{colors.red(', '.join(print_values.split(', ')[:10]) + ', ...' if len(print_values.split(', ')) > 10 else print_values)}\n" + f"→ fix typos, remove non-existent values, or save terms via " f"{colors.red(non_validated_hint_print)}" ) + if logger.indent == "": _log_mapping_info() logger.warning(warning_message)