(version)
Downloads CMU data into one of the candidate paths in H5_PATHS.
Downloads CMU data into one of the candidate paths in H5_PATHS.
Downloads CMU data into one of the candidate paths in H5_PATHS .
def _download_and_cache(version):
  """Downloads CMU data into one of the candidate paths in H5_PATHS."""
  for path in H5_PATHS[version]:
    expanded_path = os.path.expanduser(path)
    try:
      os.makedirs(os.path.dirname(expanded_path), exist_ok=True)
      f = open(expanded_path, 'wb+')
    except IOError:
      continue
    with f:
      try:
        _download_into_file(f, version)
      except:
        os.unlink(expanded_path)
        raise
    return expanded_path
  raise IOError('cannot open file to write download data into, '
                f'paths attempted: {H5_PATHS[version]}')
def _download_and_cache ( version ) : for path in H5_PATHS [ version ] : expanded_path = os . path . expanduser ( path ) try : os . makedirs ( os . path . dirname ( expanded_path ) , exist_ok = True ) f = open ( expanded_path , 'wb+' ) except IOError : continue with f : try : _download_into_file ( f , version ) except : os . unlink ( expanded_path ) raise return expanded_path raise IOError ( 'cannot open file to write download data into, ' f'paths attempted: {H5_PATHS[version]}' )