mirror of
https://github.com/freqtrade/freqtrade.git
synced 2024-11-10 02:12:01 +00:00
chore: improved fix for terminal error
This commit is contained in:
parent
ca3dee7b37
commit
1c5ca0f022
|
@ -59,17 +59,21 @@ class HyperoptOutput:
|
||||||
|
|
||||||
max_rows: Optional[int] = None
|
max_rows: Optional[int] = None
|
||||||
|
|
||||||
if self._streaming and "pytest" not in sys.modules:
|
if self._streaming:
|
||||||
ts = get_terminal_size()
|
try:
|
||||||
# Get terminal size.
|
ts = get_terminal_size()
|
||||||
# Account for header, borders, and for the progress bar.
|
# Get terminal size.
|
||||||
# This assumes that lines don't wrap.
|
# Account for header, borders, and for the progress bar.
|
||||||
if ts.columns < 148:
|
# This assumes that lines don't wrap.
|
||||||
# If the terminal is too small, we can't display the table properly.
|
if ts.columns < 148:
|
||||||
# We will halve the number of rows to display.
|
# If the terminal is too small, we can't display the table properly.
|
||||||
max_rows = -(int(ts.lines / 2) - 6)
|
# We will halve the number of rows to display.
|
||||||
else:
|
max_rows = -(int(ts.lines / 2) - 6)
|
||||||
max_rows = -(ts.lines - 6)
|
else:
|
||||||
|
max_rows = -(ts.lines - 6)
|
||||||
|
except OSError:
|
||||||
|
# If we can't get the terminal size, we will just display the last 10 rows.
|
||||||
|
pass
|
||||||
|
|
||||||
self.__init_table()
|
self.__init_table()
|
||||||
for r in self._results[max_rows:]:
|
for r in self._results[max_rows:]:
|
||||||
|
|
Loading…
Reference in New Issue
Block a user