|
13 | 13 | import git |
14 | 14 | import libcst as cst |
15 | 15 | from pydantic.dataclasses import dataclass |
| 16 | +from rich.tree import Tree |
16 | 17 |
|
17 | 18 | from codeflash.api.cfapi import get_blocklisted_functions, is_function_being_optimized_again |
18 | 19 | from codeflash.cli_cmds.console import DEBUG_MODE, console, logger |
|
37 | 38 |
|
38 | 39 | from codeflash.models.models import CodeOptimizationContext |
39 | 40 | from codeflash.verification.verification_utils import TestConfig |
| 41 | +from rich.text import Text |
40 | 42 |
|
41 | 43 |
|
42 | 44 | @dataclass(frozen=True) |
@@ -594,20 +596,22 @@ def filter_functions( |
594 | 596 |
|
595 | 597 | if not disable_logs: |
596 | 598 | log_info = { |
597 | | - f"{test_functions_removed_count} test function{'s' if test_functions_removed_count != 1 else ''}": test_functions_removed_count, |
598 | | - f"{site_packages_removed_count} site-package function{'s' if site_packages_removed_count != 1 else ''}": site_packages_removed_count, |
599 | | - f"{malformed_paths_count} non-importable file path{'s' if malformed_paths_count != 1 else ''}": malformed_paths_count, |
600 | | - f"{non_modules_removed_count} function{'s' if non_modules_removed_count != 1 else ''} outside module-root": non_modules_removed_count, |
601 | | - f"{ignore_paths_removed_count} file{'s' if ignore_paths_removed_count != 1 else ''} from ignored paths": ignore_paths_removed_count, |
602 | | - f"{submodule_ignored_paths_count} file{'s' if submodule_ignored_paths_count != 1 else ''} from ignored submodules": submodule_ignored_paths_count, |
603 | | - f"{blocklist_funcs_removed_count} function{'s' if blocklist_funcs_removed_count != 1 else ''} as previously optimized": blocklist_funcs_removed_count, |
604 | | - f"{previous_checkpoint_functions_removed_count} function{'s' if previous_checkpoint_functions_removed_count != 1 else ''} skipped from checkpoint": previous_checkpoint_functions_removed_count, |
| 599 | + "Test functions removed": (test_functions_removed_count, "yellow"), |
| 600 | + "Site-package functions removed": (site_packages_removed_count, "magenta"), |
| 601 | + "Non-importable file paths": (malformed_paths_count, "red"), |
| 602 | + "Functions outside module-root": (non_modules_removed_count, "cyan"), |
| 603 | + "Files from ignored paths": (ignore_paths_removed_count, "blue"), |
| 604 | + "Files from ignored submodules": (submodule_ignored_paths_count, "bright_black"), |
| 605 | + "Blocklisted functions removed": (blocklist_funcs_removed_count, "bright_red"), |
| 606 | + "Functions skipped from checkpoint": (previous_checkpoint_functions_removed_count, "green"), |
605 | 607 | } |
606 | | - log_string = "\n".join([k for k, v in log_info.items() if v > 0]) |
607 | | - if log_string: |
608 | | - logger.info(f"Ignoring: {log_string}") |
| 608 | + tree = Tree(Text("Ignored functions and files", style="bold")) |
| 609 | + for label, (count, color) in log_info.items(): |
| 610 | + if count > 0: |
| 611 | + tree.add(Text(f"{label}: {count}", style=color)) |
| 612 | + if len(tree.children) > 0: |
| 613 | + console.print(tree) |
609 | 614 | console.rule() |
610 | | - |
611 | 615 | return {Path(k): v for k, v in filtered_modified_functions.items() if v}, functions_count |
612 | 616 |
|
613 | 617 |
|
|
0 commit comments