def checkcache(filename=None):
 if (filename is None):
  filenames = list(cache.keys())
 elif (filename in cache):
  filenames = [filename]
 else:
  return
 for filename in filenames:
  (size, mtime, lines, fullname) = cache[filename]
  if (mtime is None):
   continue
  try:
   stat = os.stat(fullname)
  except OSError:
   del cache[filename]
   continue
  if ((size != stat.st_size) or (mtime != stat.st_mtime)):
   del cache[filename]

def checkcache ( filename = None ) : if ( filename is None ) : filenames = list ( cache . keys ( ) ) elif ( filename in cache ) : filenames = [ filename ] else : return for filename in filenames : ( size , mtime , lines , fullname ) = cache [ filename ] if ( mtime is None ) : continue try : stat = os . stat ( fullname ) except OSError : del cache [ filename ] continue if ( ( size != stat . st_size ) or ( mtime != stat . st_mtime ) ) : del cache [ filename ]
discard cache entries that are out of date .