def is_url_in_cache(url_key):
 try:
  (dldir, urlmapfn) = _get_download_cache_locs()
 except (IOError, OSError) as e:
  msg = u'Remote data cache could not be accessed due to '
  estr = (u'' if (len(e.args) < 1) else (u': ' + str(e)))
  warn(CacheMissingWarning(((msg + e.__class__.__name__) + estr)))
  return False
 if (six.PY2 and isinstance(url_key, six.text_type)):
  url_key = url_key.encode(u'utf-8')
 with _open_shelve(urlmapfn, True) as url2hash:
  if (url_key in url2hash):
   return True
 return False

def is_url_in_cache ( url_key ) : try : ( dldir , urlmapfn ) = _get_download_cache_locs ( ) except ( IOError , OSError ) as e : msg = u'Remote data cache could not be accessed due to ' estr = ( u'' if ( len ( e . args ) < 1 ) else ( u': ' + str ( e ) ) ) warn ( CacheMissingWarning ( ( ( msg + e . __class__ . __name__ ) + estr ) ) ) return False if ( six . PY2 and isinstance ( url_key , six . text_type ) ) : url_key = url_key . encode ( u'utf-8' ) with _open_shelve ( urlmapfn , True ) as url2hash : if ( url_key in url2hash ) : return True return False
check if a download from url_key is in the cache .