|
|
@ -1,7 +1,10 @@ |
|
|
|
from typing import List, Dict, Union |
|
|
|
from typing import List, Dict, Union |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
from prettytable import PrettyTable |
|
|
|
from prettytable.colortable import ColorTable, Themes |
|
|
|
from prettytable.colortable import ColorTable, Themes |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
from slither.utils.colors import Colors |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class MyPrettyTable: |
|
|
|
class MyPrettyTable: |
|
|
|
def __init__(self, field_names: List[str], pretty_align: bool = True): # TODO: True by default? |
|
|
|
def __init__(self, field_names: List[str], pretty_align: bool = True): # TODO: True by default? |
|
|
@ -19,8 +22,12 @@ class MyPrettyTable: |
|
|
|
def add_row(self, row: List[Union[str, List[str]]]) -> None: |
|
|
|
def add_row(self, row: List[Union[str, List[str]]]) -> None: |
|
|
|
self._rows.append(row) |
|
|
|
self._rows.append(row) |
|
|
|
|
|
|
|
|
|
|
|
def to_pretty_table(self) -> ColorTable: |
|
|
|
def to_pretty_table(self) -> PrettyTable: |
|
|
|
table = ColorTable(self._field_names, theme=Themes.OCEAN) |
|
|
|
if Colors.COLORIZATION_ENABLED: |
|
|
|
|
|
|
|
table = ColorTable(self._field_names, theme=Themes.OCEAN) |
|
|
|
|
|
|
|
else: |
|
|
|
|
|
|
|
table = PrettyTable(self._field_names) |
|
|
|
|
|
|
|
|
|
|
|
for row in self._rows: |
|
|
|
for row in self._rows: |
|
|
|
table.add_row(row) |
|
|
|
table.add_row(row) |
|
|
|
if len(self._options["set_alignment"]): |
|
|
|
if len(self._options["set_alignment"]): |
|
|
|