#NEWLINE# def endPing( self ) : #NEWLINE# #INDENT# r = len ( self . recv ) #NEWLINE# loss = ( ( self . count - r ) / float ( self . count ) ) #NEWLINE# loss = int ( ( 100 * loss ) ) #NEWLINE# if r : #NEWLINE# #INDENT# avgLatency = ( sum ( [ i [ 1 ] for i in self . recv ] ) / float ( avgLatency ) ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# avgLatency = None #NEWLINE# #UNINDENT# self . deferred . callback ( ( loss , avgLatency ) )