diff options
| author | Scott Gasch <[email protected]> | 2022-02-08 17:46:56 -0800 |
|---|---|---|
| committer | Scott Gasch <[email protected]> | 2022-02-08 17:46:56 -0800 |
| commit | e8fbbb7306430478dec55d2c963eed116d8330cc (patch) | |
| tree | 28c61b43d11df95b0d70d7f12eba139e02a3942e /text_utils.py | |
| parent | 0d63d44ac89aab38fe95f36497adaf95110ab949 (diff) | |
More cleanup, yey!
Diffstat (limited to 'text_utils.py')
| -rw-r--r-- | text_utils.py | 8 |
1 files changed, 5 insertions, 3 deletions
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( |
