Repository: ClickHouse/ClickHouse
File: ci/praktika/result.py (Python)

Code before:

        return "\n".join(info_lines)

    def to_stdout_formatted(
        self,
        indent="",
        output="",
        max_info_lines_cnt=100,
        truncate_from_top=True,
        max_line_length=0,
    ):
        """
        Format the result and its sub-results as a human-readable string for stdout output.

        Args:
            indent: Current indentation level (used for nested results)
            output: Accumulated output string (used for recursive calls)
            max_info_lines_cnt: Maximum number of info lines to display
            truncate_from_top: If True, truncate from the top; if False, truncate from the bottom
            max_line_length: Maximum length of each line (0 means no limit)

        Returns:
            Formatted string representation of the result
        """
        # Import here to avoid circular dependency
        from .info import Info

        add_frame = not output
        sub_indent = indent + "  "
        use_colors = Info().is_local_run

        # Choose color based on status
        if use_colors:
            if self.is_success():
                status_color = _Colors.GREEN + _Colors.BOLD
                frame_color = _Colors.GREEN
            elif self.is_failure() or self.is_error():
                status_color = _Colors.RED + _Colors.BOLD
                frame_color = _Colors.RED
            else:
                status_color = _Colors.YELLOW + _Colors.BOLD
                frame_color = _Colors.YELLOW
        else:
            status_color = ""
            frame_color = ""

        if add_frame:
            output = indent + frame_color + "+" * 80 + (_Colors.RESET if use_colors else "") + "\n"

        if add_frame or not self.is_ok():
            # Capitalize status and only show name if it's not empty

Review comment (suggestion):
To avoid repeating: `{_Colors.RESET if use_colors else ''}`

```
      status_color = ""
      frame_color = ""
      reset_color = ""
      if use_colors:
         reset_color = _Colors.RESET
         bla bla ...
```

Code after:
        return "\n".join(info_lines)

    def to_stdout_formatted(
        self,
        indent="",
        output="",
        max_info_lines_cnt=100,
        truncate_from_top=True,
        max_line_length=0,
    ):
        """
        Format the result and its sub-results as a human-readable string for stdout output.

        Args:
            indent: Current indentation level (used for nested results)
            output: Accumulated output string (used for recursive calls)
            max_info_lines_cnt: Maximum number of info lines to display
            truncate_from_top: If True, truncate from the top; if False, truncate from the bottom
            max_line_length: Maximum length of each line (0 means no limit)

        Returns:
            Formatted string representation of the result
        """
        add_frame = not output
        sub_indent = indent + "  "

        # Check if colors should be used: local run + TTY + terminal supports colors
        use_colors = (
            Info().is_local_run
            and sys.stdout.isatty()
            and os.environ.get("TERM", "").lower() != "dumb"
        )

        # Define color variables once to avoid repetition
        status_color = ""
        frame_color = ""
        reset_color = ""

        if use_colors:
            reset_color = _Colors.RESET
            if self.is_success():
                status_color = _Colors.GREEN + _Colors.BOLD
                frame_color = _Colors.GREEN
            elif self.is_failure() or self.is_error():
                status_color = _Colors.RED + _Colors.BOLD
                frame_color = _Colors.RED
            else:
                status_color = _Colors.YELLOW + _Colors.BOLD
                frame_color = _Colors.YELLOW

        if add_frame: