Combines alerts into one string that can be printed to the terminal :return: the alert string.
(self)
| 104 | return alerts |
| 105 | |
| 106 | def _build_alert_str(self) -> str: |
| 107 | """Combines alerts into one string that can be printed to the terminal |
| 108 | :return: the alert string. |
| 109 | """ |
| 110 | alert_str = "" |
| 111 | alerts = self._get_alerts() |
| 112 | |
| 113 | longest_alert = max(ALERTS, key=len) |
| 114 | num_asterisks = len(longest_alert) + 8 |
| 115 | |
| 116 | for i, cur_alert in enumerate(alerts): |
| 117 | # Use padding to center the alert |
| 118 | padding = " " * int((num_asterisks - len(cur_alert)) / 2) |
| 119 | |
| 120 | if i > 0: |
| 121 | alert_str += "\n" |
| 122 | alert_str += "*" * num_asterisks + "\n" |
| 123 | alert_str += padding + cur_alert + padding + "\n" |
| 124 | alert_str += "*" * num_asterisks + "\n" |
| 125 | |
| 126 | return alert_str |
| 127 | |
| 128 | def _build_colored_prompt(self) -> str: |
| 129 | """Randomly builds a colored prompt |
no test coverage detected