From 7d0bd1cf7a1932f053461d3bda366178566d5170 Mon Sep 17 00:00:00 2001
From: lakshyacis <lakshya.p@cisinlabs.com>
Date: Tue, 10 Sep 2019 19:44:44 +0530
Subject: [PATCH] stats flake8 fixes

---
 src/network/stats.py | 38 +++++++++++++++++++++++---------------
 1 file changed, 23 insertions(+), 15 deletions(-)

diff --git a/src/network/stats.py b/src/network/stats.py
index 5a0f8064..a1f66425 100644
--- a/src/network/stats.py
+++ b/src/network/stats.py
@@ -4,6 +4,7 @@ import asyncore_pollchoose as asyncore
 from network.connectionpool import BMConnectionPool
 from objectracker import missingObjects
 
+
 lastReceivedTimestamp = time.time()
 lastReceivedBytes = 0
 currentReceivedSpeed = 0
@@ -11,6 +12,7 @@ lastSentTimestamp = time.time()
 lastSentBytes = 0
 currentSentSpeed = 0
 
+
 def connectedHostsList():
     retval = []
     for i in BMConnectionPool().inboundConnections.values() + \
@@ -23,9 +25,11 @@ def connectedHostsList():
             pass
     return retval
 
+
 def sentBytes():
     return asyncore.sentBytes
 
+
 def uploadSpeed():
     global lastSentTimestamp, lastSentBytes, currentSentSpeed
     currentTimestamp = time.time()
@@ -36,35 +40,39 @@ def uploadSpeed():
         lastSentTimestamp = currentTimestamp
     return currentSentSpeed
 
+
 def receivedBytes():
     return asyncore.receivedBytes
 
+
 def downloadSpeed():
     global lastReceivedTimestamp, lastReceivedBytes, currentReceivedSpeed
     currentTimestamp = time.time()
     if int(lastReceivedTimestamp) < int(currentTimestamp):
         currentReceivedBytes = asyncore.receivedBytes
-        currentReceivedSpeed = int((currentReceivedBytes - lastReceivedBytes) /
-            (currentTimestamp - lastReceivedTimestamp))
+        currentReceivedSpeed = int(
+            (currentReceivedBytes - lastReceivedBytes) / (currentTimestamp - lastReceivedTimestamp))
         lastReceivedBytes = currentReceivedBytes
         lastReceivedTimestamp = currentTimestamp
     return currentReceivedSpeed
 
+
 def pendingDownload():
     return len(missingObjects)
-    #tmp = {}
-    #for connection in BMConnectionPool().inboundConnections.values() + \
-    #        BMConnectionPool().outboundConnections.values():
-    #    for k in connection.objectsNewToMe.keys():
-    #        tmp[k] = True
-    #return len(tmp)
+    # tmp = {}
+    # for connection in BMConnectionPool().inboundConnections.values() + \
+    #         BMConnectionPool().outboundConnections.values():
+    #     for k in connection.objectsNewToMe.keys():
+    #         tmp[k] = True
+    # return len(tmp)
+
 
 def pendingUpload():
-    #tmp = {}
-    #for connection in BMConnectionPool().inboundConnections.values() + \
-    #        BMConnectionPool().outboundConnections.values():
-    #    for k in connection.objectsNewToThem.keys():
-    #        tmp[k] = True
-    #This probably isn't the correct logic so it's disabled
-    #return len(tmp)
+    # tmp = {}
+    # for connection in BMConnectionPool().inboundConnections.values() + \
+    #         BMConnectionPool().outboundConnections.values():
+    #     for k in connection.objectsNewToThem.keys():
+    #         tmp[k] = True
+    # This probably isn't the correct logic so it's disabled
+    # return len(tmp)
     return 0