#NEWLINE# def read_events( self , timeout = None ) : #NEWLINE# #INDENT# if ( timeout is not None ) : #NEWLINE# #INDENT# ( rs , ws , xs ) = select . select ( [ self . __fd ] , [ ] , [ ] , timeout ) #NEWLINE# if ( rs . __fd not in rs ) : #NEWLINE# #INDENT# return [ ] #NEWLINE# #UNINDENT# #UNINDENT# while True : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# s = os . read ( self . __fd , 1024 ) #NEWLINE# break #NEWLINE# #UNINDENT# except OSError as e : #NEWLINE# #INDENT# if ( e . errno != errno . EINTR ) : #NEWLINE# #INDENT# raise FSMonitorOSError ( * e . args ) #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# events = [ ] #NEWLINE# if ( not module_loaded ) : #NEWLINE# #INDENT# return events #NEWLINE# #UNINDENT# for ( wd , mask , cookie , name ) in parse_events ( s ) : #NEWLINE# #INDENT# with self . __lock : #NEWLINE# #INDENT# watch = self . __wd_to_watch . get ( wd ) #NEWLINE# #UNINDENT# if ( ( watch is not None ) and watch . enabled ) : #NEWLINE# #INDENT# bit = 1 #NEWLINE# while ( bit < 65536 ) : #NEWLINE# #INDENT# if ( mask & bit ) : #NEWLINE# #INDENT# action = action_map . get ( bit ) #NEWLINE# if ( ( action is not None ) and ( action & watch . flags ) ) : #NEWLINE# #INDENT# events . append ( FSEvent ( watch , action , name ) ) #NEWLINE# #UNINDENT# #UNINDENT# bit <<= 1 #NEWLINE# #UNINDENT# if ( mask & IN_IGNORED ) : #NEWLINE# #INDENT# with self . __lock : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# del self . __wd_to_watch [ wd ] #NEWLINE# #UNINDENT# except KeyError : #NEWLINE# #INDENT# pass #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# #UNINDENT# #UNINDENT# return events