From 7bb9bfc9450b56c494a08682b354ce06d56ca6e1 Mon Sep 17 00:00:00 2001 From: Matt Martz Date: Tue, 8 Oct 2013 07:09:55 -0500 Subject: [PATCH] Code formatting fix ups --- speedtest_cli.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/speedtest_cli.py b/speedtest_cli.py index 9f9fc9c..4d90bc2 100755 --- a/speedtest_cli.py +++ b/speedtest_cli.py @@ -123,8 +123,8 @@ def distance(origin, destination): lat2, lon2 = destination radius = 6371 # km - dlat = math.radians(lat2-lat1) - dlon = math.radians(lon2-lon1) + dlat = math.radians(lat2 - lat1) + dlon = math.radians(lon2 - lon1) a = (math.sin(dlat / 2) * math.sin(dlat / 2) + math.cos(math.radians(lat1)) * math.cos(math.radians(lat2)) * math.sin(dlon / 2) * math.sin(dlon / 2)) @@ -187,7 +187,7 @@ def downloadSpeed(files, quiet=False): prod_thread.join(timeout=0.1) while cons_thread.is_alive(): cons_thread.join(timeout=0.1) - return (sum(finished)/(time.time()-start)) + return (sum(finished) / (time.time() - start)) class FilePutter(threading.Thread): @@ -195,7 +195,7 @@ class FilePutter(threading.Thread): self.url = url chars = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ' data = chars * (int(round(int(size) / 36.0))) - self.data = ('content1=%s' % data[0:int(size)-9]).encode() + self.data = ('content1=%s' % data[0:int(size) - 9]).encode() del data self.result = None self.starttime = start @@ -247,7 +247,7 @@ def uploadSpeed(url, sizes, quiet=False): prod_thread.join(timeout=0.1) while cons_thread.is_alive(): cons_thread.join(timeout=0.1) - return (sum(finished)/(time.time()-start)) + return (sum(finished) / (time.time() - start)) def getAttributesByTagName(dom, tagName): @@ -544,6 +544,7 @@ def main(): except KeyboardInterrupt: print_('\nCancelling...') + if __name__ == '__main__': main()