From e8fbbb7306430478dec55d2c963eed116d8330cc Mon Sep 17 00:00:00 2001 From: Scott Gasch Date: Tue, 8 Feb 2022 17:46:56 -0800 Subject: More cleanup, yey! --- text_utils.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'text_utils.py') diff --git a/text_utils.py b/text_utils.py index 76cc7e8..4384a1e 100644 --- a/text_utils.py +++ b/text_utils.py @@ -15,6 +15,8 @@ logger = logging.getLogger(__file__) class RowsColumns(NamedTuple): + """Row + Column""" + rows: int columns: int @@ -31,7 +33,7 @@ def get_console_rows_columns() -> RowsColumns: ).split() except Exception as e: logger.exception(e) - raise Exception('Can\'t determine console size?!') + raise Exception('Can\'t determine console size?!') from e return RowsColumns(int(rows), int(columns)) @@ -122,10 +124,10 @@ def sparkline(numbers: List[float]) -> Tuple[float, float, str]: barcount = len(_bar) min_num, max_num = min(numbers), max(numbers) span = max_num - min_num - sparkline = ''.join( + sline = ''.join( _bar[min([barcount - 1, int((n - min_num) / span * barcount)])] for n in numbers ) - return min_num, max_num, sparkline + return min_num, max_num, sline def distribute_strings( -- cgit v1.3