From 8d1c19a734de8817e025940d1133664f18bb89c5 Mon Sep 17 00:00:00 2001 From: Thor77 Date: Mon, 25 Sep 2017 23:17:51 +0200 Subject: [PATCH] Adapt log.parse_logs and utils.sort_clients to Clients.__iter__ return keys instead of values --- tsstats/log.py | 4 +++- tsstats/utils.py | 3 ++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/tsstats/log.py b/tsstats/log.py index a42f65b..db8e62b 100644 --- a/tsstats/log.py +++ b/tsstats/log.py @@ -144,7 +144,9 @@ def parse_logs(log_glob, ident_map=None, online_dc=True): clients.apply_events(itertools.chain.from_iterable(events)) # find connected clients - online_clients = list(filter(lambda c: c.connected, clients)) + online_clients = list( + filter(lambda c: c.connected, clients.values()) + ) logger.debug( 'Some clients are still connected: %s', online_clients diff --git a/tsstats/utils.py b/tsstats/utils.py index 62044d7..11151e0 100644 --- a/tsstats/utils.py +++ b/tsstats/utils.py @@ -13,7 +13,8 @@ def sort_clients(clients, key_l): :rtype: list ''' cl_data = [ - (client, key_l(client)) for client in clients if key_l(client) > 0 + (client, key_l(client)) for client in clients.values() + if key_l(client) > 0 ] return sorted(cl_data, key=lambda data: data[1], reverse=True)