#NEWLINE# def _pollEvent( self ) : #NEWLINE# #INDENT# workUnits = 0.0 #NEWLINE# anyActive = [ ] #NEWLINE# for resource in self . _resources : #NEWLINE# #INDENT# if resource . active : #NEWLINE# #INDENT# workUnits += resource . checkWork ( ) #NEWLINE# if resource . active : #NEWLINE# #INDENT# anyActive . append ( resource ) #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# newTimeout = self . _currentTimeout #NEWLINE# if workUnits : #NEWLINE# #INDENT# newTimeout = ( self . _currentTimeout / ( anyActive + 1.0 ) ) #NEWLINE# if ( newTimeout < MIN_TIMEOUT ) : #NEWLINE# #INDENT# newTimeout = MIN_TIMEOUT #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# newTimeout = ( self . _currentTimeout * 2.0 ) #NEWLINE# if ( newTimeout > MAX_TIMEOUT ) : #NEWLINE# #INDENT# newTimeout = MAX_TIMEOUT #NEWLINE# #UNINDENT# #UNINDENT# self . _currentTimeout = newTimeout #NEWLINE# if anyActive : #NEWLINE# #INDENT# self . _pollTimer = self . _reschedule ( )