Skip to content

Commit c087384

Browse files
committed
cubestat: some type hints
1 parent 4d32585 commit c087384

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

cubestat/cubestat.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ def __init__(self, stdscr, args):
4646
self.input_handler = InputHandler(self)
4747
self.data_manager = DataManager(args.buffer_size)
4848

49-
def do_read(self, context):
49+
def do_read(self, context) -> None:
5050
updates = []
5151
for group, metric in self.metrics.items():
5252
datapoint = metric.read(context)
@@ -59,11 +59,11 @@ def do_read(self, context):
5959
if self.h_shift > 0:
6060
self.h_shift += 1
6161

62-
def max_val(self, metric, title, data_slice):
62+
def max_val(self, metric, title: str, data_slice: list) -> float:
6363
max_value, _ = metric.format(title, data_slice, [-1])
6464
return max_value
6565

66-
def _ruler_values(self, metric, title, idxs, data):
66+
def _ruler_values(self, metric, title: str, idxs: list, data: list) -> list:
6767
if self.view == ViewMode.off:
6868
return []
6969
idxs = [idx for idx in idxs if idx < len(data)]
@@ -73,7 +73,7 @@ def _ruler_values(self, metric, title, idxs, data):
7373
idxs = idxs[:1]
7474
return list(zip(idxs, formatted_values))
7575

76-
def render(self):
76+
def render(self) -> None:
7777
with self.lock:
7878
if self.snapshots_rendered > self.snapshots_observed:
7979
logging.fatal('self.snapshots_rendered > self.snapshots_observed')

cubestat/data.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ def init_group():
1313

1414
self.data = collections.defaultdict(init_group)
1515

16-
# TODO: UI-related things should be moved out of here
16+
# Returns a slice of data row which will be visible on the screen
1717
def get_slice(self, series, h_shift, chart_width):
1818
data_length = len(series) - h_shift if h_shift > 0 else len(series)
1919
index = max(0, data_length - chart_width)

0 commit comments

Comments
 (0)