stats flake8 fixes
This commit is contained in:
parent
8182e159df
commit
7d0bd1cf7a
|
@ -4,6 +4,7 @@ import asyncore_pollchoose as asyncore
|
||||||
from network.connectionpool import BMConnectionPool
|
from network.connectionpool import BMConnectionPool
|
||||||
from objectracker import missingObjects
|
from objectracker import missingObjects
|
||||||
|
|
||||||
|
|
||||||
lastReceivedTimestamp = time.time()
|
lastReceivedTimestamp = time.time()
|
||||||
lastReceivedBytes = 0
|
lastReceivedBytes = 0
|
||||||
currentReceivedSpeed = 0
|
currentReceivedSpeed = 0
|
||||||
|
@ -11,6 +12,7 @@ lastSentTimestamp = time.time()
|
||||||
lastSentBytes = 0
|
lastSentBytes = 0
|
||||||
currentSentSpeed = 0
|
currentSentSpeed = 0
|
||||||
|
|
||||||
|
|
||||||
def connectedHostsList():
|
def connectedHostsList():
|
||||||
retval = []
|
retval = []
|
||||||
for i in BMConnectionPool().inboundConnections.values() + \
|
for i in BMConnectionPool().inboundConnections.values() + \
|
||||||
|
@ -23,9 +25,11 @@ def connectedHostsList():
|
||||||
pass
|
pass
|
||||||
return retval
|
return retval
|
||||||
|
|
||||||
|
|
||||||
def sentBytes():
|
def sentBytes():
|
||||||
return asyncore.sentBytes
|
return asyncore.sentBytes
|
||||||
|
|
||||||
|
|
||||||
def uploadSpeed():
|
def uploadSpeed():
|
||||||
global lastSentTimestamp, lastSentBytes, currentSentSpeed
|
global lastSentTimestamp, lastSentBytes, currentSentSpeed
|
||||||
currentTimestamp = time.time()
|
currentTimestamp = time.time()
|
||||||
|
@ -36,20 +40,23 @@ def uploadSpeed():
|
||||||
lastSentTimestamp = currentTimestamp
|
lastSentTimestamp = currentTimestamp
|
||||||
return currentSentSpeed
|
return currentSentSpeed
|
||||||
|
|
||||||
|
|
||||||
def receivedBytes():
|
def receivedBytes():
|
||||||
return asyncore.receivedBytes
|
return asyncore.receivedBytes
|
||||||
|
|
||||||
|
|
||||||
def downloadSpeed():
|
def downloadSpeed():
|
||||||
global lastReceivedTimestamp, lastReceivedBytes, currentReceivedSpeed
|
global lastReceivedTimestamp, lastReceivedBytes, currentReceivedSpeed
|
||||||
currentTimestamp = time.time()
|
currentTimestamp = time.time()
|
||||||
if int(lastReceivedTimestamp) < int(currentTimestamp):
|
if int(lastReceivedTimestamp) < int(currentTimestamp):
|
||||||
currentReceivedBytes = asyncore.receivedBytes
|
currentReceivedBytes = asyncore.receivedBytes
|
||||||
currentReceivedSpeed = int((currentReceivedBytes - lastReceivedBytes) /
|
currentReceivedSpeed = int(
|
||||||
(currentTimestamp - lastReceivedTimestamp))
|
(currentReceivedBytes - lastReceivedBytes) / (currentTimestamp - lastReceivedTimestamp))
|
||||||
lastReceivedBytes = currentReceivedBytes
|
lastReceivedBytes = currentReceivedBytes
|
||||||
lastReceivedTimestamp = currentTimestamp
|
lastReceivedTimestamp = currentTimestamp
|
||||||
return currentReceivedSpeed
|
return currentReceivedSpeed
|
||||||
|
|
||||||
|
|
||||||
def pendingDownload():
|
def pendingDownload():
|
||||||
return len(missingObjects)
|
return len(missingObjects)
|
||||||
# tmp = {}
|
# tmp = {}
|
||||||
|
@ -59,6 +66,7 @@ def pendingDownload():
|
||||||
# tmp[k] = True
|
# tmp[k] = True
|
||||||
# return len(tmp)
|
# return len(tmp)
|
||||||
|
|
||||||
|
|
||||||
def pendingUpload():
|
def pendingUpload():
|
||||||
# tmp = {}
|
# tmp = {}
|
||||||
# for connection in BMConnectionPool().inboundConnections.values() + \
|
# for connection in BMConnectionPool().inboundConnections.values() + \
|
||||||
|
|
Reference in New Issue
Block a user