[tor-commits] [onionperf/master] Make a few whitespace fixes.

karsten at torproject.org karsten at torproject.org
Mon Aug 10 09:30:41 UTC 2020


commit 2eceb8c7044a770059f4d1ad06241b60216d4b84
Author: Karsten Loesing <karsten.loesing at gmx.net>
Date:   Sun Jul 12 22:50:41 2020 +0200

    Make a few whitespace fixes.
---
 onionperf/analysis.py      |  4 ++--
 onionperf/visualization.py | 12 ++++++------
 2 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/onionperf/analysis.py b/onionperf/analysis.py
index 49d6dba..8506756 100644
--- a/onionperf/analysis.py
+++ b/onionperf/analysis.py
@@ -26,7 +26,7 @@ class OPAnalysis(Analysis):
 
     def __init__(self, nickname=None, ip_address=None):
         super().__init__(nickname, ip_address)
-        self.json_db = {'type' : 'onionperf', 'version' : '3.0', 'data' : {}}
+        self.json_db = {'type': 'onionperf', 'version': '3.0', 'data': {}}
         self.torctl_filepaths = []
 
     def add_torctl_file(self, filepath):
@@ -64,7 +64,7 @@ class OPAnalysis(Analysis):
                 if self.measurement_ip is None:
                     self.measurement_ip = "unknown"
 
-                self.json_db['data'].setdefault(self.nickname, {'measurement_ip' : self.measurement_ip}).setdefault(json_db_key, parser.get_data())
+                self.json_db['data'].setdefault(self.nickname, {'measurement_ip': self.measurement_ip}).setdefault(json_db_key, parser.get_data())
         self.json_db['data'][self.nickname]["tgen"].pop("heartbeats")
         self.json_db['data'][self.nickname]["tgen"].pop("init_ts")
         self.json_db['data'][self.nickname]["tgen"].pop("stream_summary")
diff --git a/onionperf/visualization.py b/onionperf/visualization.py
index 7cc36d1..52d08fc 100644
--- a/onionperf/visualization.py
+++ b/onionperf/visualization.py
@@ -68,7 +68,7 @@ class TGenVisualization(Visualization):
                                      stream["time_to_first_byte"] = float(s["usecs-to-first-byte-recv"])/1000000
                                  if "usecs-to-last-byte-recv" in s:
                                      stream["time_to_last_byte"] = float(s["usecs-to-last-byte-recv"])/1000000
-                             if "elapsed_seconds" in stream_data: 
+                             if "elapsed_seconds" in stream_data:
                                  s = stream_data["elapsed_seconds"]
                                  # Explanation of the math below for computing Mbps: From filesize_bytes
                                  # and payload_progress fields we can compute the number of seconds that
@@ -93,11 +93,11 @@ class TGenVisualization(Visualization):
                             if "elapsed_seconds" in transfer_data:
                                s = transfer_data["elapsed_seconds"]
                                if "payload_progress" in s:
-                               # Explanation of the math below for computing Mbps: From filesize_bytes
-                               # and payload_progress fields we can compute the number of seconds that
-                               # have elapsed between receiving bytes 524,288 and 1,048,576, which is a
-                               # total amount of 524,288 bytes or 4,194,304 bits or 4.194304 megabits.
-                               # We want the reciprocal of that value with unit megabits per second.
+                                   # Explanation of the math below for computing Mbps: From filesize_bytes
+                                   # and payload_progress fields we can compute the number of seconds that
+                                   # have elapsed between receiving bytes 524,288 and 1,048,576, which is a
+                                   # total amount of 524,288 bytes or 4,194,304 bits or 4.194304 megabits.
+                                   # We want the reciprocal of that value with unit megabits per second.
                                    if transfer_data["filesize_bytes"] == 1048576 and "1.0" in s["payload_progress"]:
                                        stream["mbps"] = 4.194304 / (s["payload_progress"]["1.0"] - s["payload_progress"]["0.5"])
                                    if transfer_data["filesize_bytes"] == 5242880 and "0.2" in s["payload_progress"]:





More information about the tor-commits mailing list