From f9d26b04d8d4f84eb5ca6d7a9bcf9744c05758a2 Mon Sep 17 00:00:00 2001 From: hackrush Date: Wed, 12 Dec 2018 00:21:42 +0530 Subject: [PATCH] Get averages! --- scripts/profile_get.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/scripts/profile_get.py b/scripts/profile_get.py index d0c2d9d22..dede184cb 100644 --- a/scripts/profile_get.py +++ b/scripts/profile_get.py @@ -167,9 +167,19 @@ def main(): shutil.rmtree(tempfile.tempdir) max_len = len(max(uris, key=len)) + _sum = num = 0 for result, value in results.items(): + if not isinstance(value, str): + _sum += value + num += 1 print("{0:>{1:d}s}: {2}".format(result, max_len, value)) + avg = _sum / num + print("Average for {0:d} downloaded files is: {1:f}".format(num, avg)) + could_not_download = len(uris) - num + smiley = ":-)" if could_not_download == 0 else ":-(" + print("{0:d} files could not be downloaded {1:s}".format(could_not_download, smiley)) + reactor.callLater(0, reactor.stop)