summaryrefslogtreecommitdiffstats
path: root/accounts/utils/console.py
diff options
context:
space:
mode:
Diffstat (limited to 'accounts/utils/console.py')
-rw-r--r--accounts/utils/console.py17
1 files changed, 9 insertions, 8 deletions
diff --git a/accounts/utils/console.py b/accounts/utils/console.py
index c63480a..823ec33 100644
--- a/accounts/utils/console.py
+++ b/accounts/utils/console.py
@@ -1,6 +1,7 @@
# -*- coding: utf-8 -*-
-class TablePrinter(object):
+class TablePrinter():
+ separator: str
def __init__(self, headers=None, separator='|'):
self.headers = headers
@@ -12,11 +13,11 @@ class TablePrinter(object):
if headers is not None:
self._calulate_widths([headers])
- def _calulate_widths(self, rows):
- def _get_column_count(rows):
+ def _calulate_widths(self, rows) -> None:
+ def _get_column_count(rows: list):
return min([len(row) for row in rows])
- def _column_width(column, width):
+ def _column_width(column: tuple, width: int) -> int:
widths = [len(str(elem)) for elem in column]
widths.append(width)
return max(widths)
@@ -30,7 +31,7 @@ class TablePrinter(object):
in zip(list(zip(*rows)), self.widths)]
self._update_format_string()
- def _update_format_string(self):
+ def _update_format_string(self) -> None:
sep = ' %s ' % self.separator
self.format_string = '%s %s %s' % (
self.separator,
@@ -48,13 +49,13 @@ class TablePrinter(object):
for row in rows:
self._print_row(row)
- def _print_headline(self):
+ def _print_headline(self) -> None:
print(('%s%s%s' % (
self.separator,
self.separator.join(['-' * (width + 2) for width in self.widths]),
self.separator)))
- def _print_row(self, row):
+ def _print_row(self, row) -> None:
print((self.format_string % tuple(row)))
@@ -66,7 +67,7 @@ class ConsoleForm(object):
self._fill(kwargs)
self._ready = True
- def _fill(self, data):
+ def _fill(self, data) -> None:
for key, value in list(data.items()):
field = getattr(self.form, key, None)
if field is not None: