#NEWLINE# def select( self , timeout = None ) : #NEWLINE# #INDENT# timeout = ( None if ( timeout is None ) else max ( timeout , 0 ) ) #NEWLINE# ready = [ ] #NEWLINE# try : #NEWLINE# #INDENT# ( r , w , _ ) = self . _select ( self . _readers , self . _writers , [ ] , timeout ) #NEWLINE# #UNINDENT# except select . error as exc : #NEWLINE# #INDENT# if ( exc . args [ 0 ] == EINTR ) : #NEWLINE# #INDENT# return ready #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# raise #NEWLINE# #UNINDENT# #UNINDENT# r = set ( r ) #NEWLINE# w = set ( w ) #NEWLINE# for fd in ( r | w ) : #NEWLINE# #INDENT# events = 0 #NEWLINE# if ( fd in r ) : #NEWLINE# #INDENT# events |= EVENT_READ #NEWLINE# #UNINDENT# if ( fd in w ) : #NEWLINE# #INDENT# events |= EVENT_WRITE #NEWLINE# #UNINDENT# key = self . _key_from_fd ( fd ) #NEWLINE# if key : #NEWLINE# #INDENT# ready . append ( ( key , ( events & key . events ) ) ) #NEWLINE# #UNINDENT# #UNINDENT# return ready