#NEWLINE# def _start_monitoring( self ) : #NEWLINE# #INDENT# ' Internal method that monitors the directory for changes ' #NEWLINE# before = self . _file_timestamp_info ( self . path ) #NEWLINE# while True : #NEWLINE# #INDENT# gevent . sleep ( 1 ) #NEWLINE# after = self . _file_timestamp_info ( self . path ) #NEWLINE# added = [ fname for fname in after . keys ( ) if ( fname not in before . keys ( ) ) ] #NEWLINE# removed = [ fname for fname in before . keys ( ) if ( fname not in after . keys ( ) ) ] #NEWLINE# modified = [ ] #NEWLINE# for fname in before . keys ( ) : #NEWLINE# #INDENT# if ( fname not in removed ) : #NEWLINE# #INDENT# if ( os . path . getmtime ( fname ) != before . get ( fname ) ) : #NEWLINE# #INDENT# modified . append ( fname ) #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# if added : #NEWLINE# #INDENT# self . on_create ( added ) #NEWLINE# #UNINDENT# if after : #NEWLINE# #INDENT# self . on_delete ( removed ) #NEWLINE# #UNINDENT# if modified : #NEWLINE# #INDENT# self . on_modify ( modified ) #NEWLINE# #UNINDENT# before = after