|
4 | 4 | # Python imports. |
5 | 5 | from argparse import Namespace |
6 | 6 | from collections import deque |
| 7 | +from functools import cache |
| 8 | +from importlib.util import find_spec |
7 | 9 | from math import floor, log10 |
8 | 10 | from re import Pattern, compile |
9 | | -from typing import Final, NamedTuple, TypeAlias |
| 11 | +from typing import Final, NamedTuple |
10 | 12 |
|
11 | 13 | ############################################################################## |
12 | 14 | # Textual imports. |
@@ -78,7 +80,18 @@ class Situation(NamedTuple): |
78 | 80 |
|
79 | 81 |
|
80 | 82 | ############################################################################## |
81 | | -PlotHistory: TypeAlias = deque[Situation] |
| 83 | +@cache |
| 84 | +def _faster_label() -> str: |
| 85 | + """Get the label that gives our faster status. |
| 86 | +
|
| 87 | + Returns: |
| 88 | + The labelto show the faster status. |
| 89 | + """ |
| 90 | + return " | [b]Faster[/]" if find_spec("numba") else "" |
| 91 | + |
| 92 | + |
| 93 | +############################################################################## |
| 94 | +PlotHistory = deque[Situation] |
82 | 95 | """Type of the plot history.""" |
83 | 96 |
|
84 | 97 |
|
@@ -217,7 +230,7 @@ def _update_situation(self, message: Mandelbrot.Plotted) -> None: |
217 | 230 | message.mandelbrot.border_subtitle = ( |
218 | 231 | f"{message.mandelbrot.multibrot:0.2f} multibrot | " |
219 | 232 | f"{message.mandelbrot.max_iteration:0.2f} iterations | " |
220 | | - f"{message.elapsed:0.4f} seconds" |
| 233 | + f"{message.elapsed:0.4f} seconds{_faster_label()}" |
221 | 234 | ) |
222 | 235 |
|
223 | 236 | def _remember(self) -> None: |
|
0 commit comments