def read_cached_file(filename, cache_info, reload_func=None):
 mtime = os.path.getmtime(filename)
 if ((not cache_info) or (mtime != cache_info.get('mtime'))):
  LOG.debug((_('Reloading cached file %s') % filename))
  with open(filename) as fap:
   cache_info['data'] = fap.read()
  cache_info['mtime'] = mtime
  if reload_func:
   reload_func(cache_info['data'])
 return cache_info['data']

def read_cached_file ( filename , cache_info , reload_func = None ) : mtime = os . path . getmtime ( filename ) if ( ( not cache_info ) or ( mtime != cache_info . get ( 'mtime' ) ) ) : LOG . debug ( ( _ ( 'Reloading cached file %s' ) % filename ) ) with open ( filename ) as fap : cache_info [ 'data' ] = fap . read ( ) cache_info [ 'mtime' ] = mtime if reload_func : reload_func ( cache_info [ 'data' ] ) return cache_info [ 'data' ]
read from a file if it has been modified .