Exemplo n.º 1
0
def get_flow_stats_deltas(pairs, attr):
    """Yield pairs (time, value) for increments in input pairs using attribute 'attr'."""
    for (start_time, fs1), (end_time, fs2) in lib.pairwise(pairs):
        delta = end_time - start_time
        value = (getattr(fs2, attr) - getattr(fs1, attr)) / delta
        yield end_time, value
Exemplo n.º 2
0
def get_flow_stats_deltas(pairs, attr):
    """Yield pairs (time, value) for increments in input pairs using attribute 'attr'."""
    for (start_time, fs1), (end_time, fs2) in lib.pairwise(pairs):
        delta = end_time - start_time
        value = (getattr(fs2, attr) - getattr(fs1, attr)) / delta
        yield end_time, value
Exemplo n.º 3
0
 def test_pairwise(self):
     lst = [0, 1, 2, 3, 4]
     self.assertEqual(list(lib.pairwise(lst)), [(0, 1), (1, 2), (2, 3),
                                                (3, 4)])
Exemplo n.º 4
0
 def test_pairwise(self):
     lst = [0, 1, 2, 3, 4]
     self.assertEqual(list(lib.pairwise(lst)), [(0, 1), (1, 2), (2, 3), (3, 4)])