diff --git a/RAT/classlist.py b/RAT/classlist.py index 41fdd155..44aba040 100644 --- a/RAT/classlist.py +++ b/RAT/classlist.py @@ -4,7 +4,7 @@ import collections from collections.abc import Iterable, Sequence import contextlib -import tabulate +import prettytable from typing import Any, Union import warnings @@ -55,8 +55,10 @@ def __repr__(self): output = repr(self.data) else: if any(model.__dict__ for model in self.data): - table = [model.__dict__ for model in self.data] - output = tabulate.tabulate(table, headers='keys', showindex=True) + table = prettytable.PrettyTable() + table.field_names = ['index'] + [key.replace('_', ' ') for key in self.data[0].__dict__.keys()] + table.add_rows([[index] + list(model.__dict__.values()) for index, model in enumerate(self.data)]) + output = table.get_string() else: output = repr(self.data) return output diff --git a/requirements.txt b/requirements.txt index fe40247f..d8702c34 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,6 +1,6 @@ numpy >= 1.20 +prettytable >= 3.9.0 pydantic >= 2.4.0 pytest >= 7.4.0 pytest-cov >= 4.1.0 -StrEnum >= 0.4.15 -tabulate >= 0.9.0 +StrEnum >= 0.4.15 \ No newline at end of file