Skip to content

Commit

Permalink
Changes table library from tabular to prettytable
Browse files Browse the repository at this point in the history
  • Loading branch information
DrPaulSharp committed Oct 24, 2023
1 parent bbfebd4 commit 9d1678a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
8 changes: 5 additions & 3 deletions RAT/classlist.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 9d1678a

Please sign in to comment.