fix: avoid hyperopt-results not showing past terminal height

This commit is contained in:
Matthias
2024-08-29 07:08:41 +02:00
parent c1f54b14d0
commit 87678eff98
3 changed files with 34 additions and 20 deletions

View File

@@ -1,14 +1,18 @@
from typing import Union
from typing import Callable, List, Union
from rich.console import ConsoleRenderable, Group, RichCast
from rich.progress import Progress
class CustomProgress(Progress):
def __init__(self, *args, cust_objs=[], **kwargs) -> None:
def __init__(self, *args, cust_objs=[], cust_callables: List[Callable] = [], **kwargs) -> None:
self._cust_objs = cust_objs
self._cust_callables = cust_callables
super().__init__(*args, **kwargs)
def get_renderable(self) -> Union[ConsoleRenderable, RichCast, str]:
renderable = Group(*self._cust_objs, *self.get_renderables())
objs = [obj for obj in self._cust_objs]
for cust_call in self._cust_callables:
objs.append(cust_call())
renderable = Group(*objs, *self.get_renderables())
return renderable