#NEWLINE# def check_queue( self ) : #NEWLINE# #INDENT# '\n            This function is called at regular intervals by :func:`start`.\n            \n            Iterate through the events, and if there is any with a timestamp\n            greater than the scan_interval, return it and set its timestamp to -1\n            for purging later.\n\n            :returns: Filename if available to process, otherwise None.\n        ' #NEWLINE# now = time . time ( ) #NEWLINE# PyPdfWatcher . events_lock . acquire ( ) #NEWLINE# for ( monitored_file , timestamp ) in PyPdfWatcher . events . items ( ) : #NEWLINE# #INDENT# if ( timestamp == ( - 1 ) ) : #NEWLINE# #INDENT# del PyPdfWatcher . events [ monitored_file ] #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( ( now - timestamp ) > self . scan_interval ) : #NEWLINE# #INDENT# logging . info ( ( 'Processing new file %s' % monitored_file ) ) #NEWLINE# del PyPdfWatcher . events [ monitored_file ] #NEWLINE# monitored_file = self . rename_file_with_spaces ( now ) #NEWLINE# PyPdfWatcher . events [ monitored_file ] = ( - 1 ) #NEWLINE# PyPdfWatcher . events_lock . release ( ) #NEWLINE# return monitored_file #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# PyPdfWatcher . events_lock . release ( ) #NEWLINE# return None