astropy.utils.data.clear_download_cache(hashorurl=None, pkgname='astropy')[source]

Clears the data file cache by deleting the local file(s).

If a URL is provided, it will be the name used in the cache. The contents may have been downloaded from this URL or from a mirror or they may have been provided by the user. See download_file for details.

For the purposes of this function, a file can also be identified by a hash of its contents or by the filename under which the data is stored (as returned by download_file, for example).

Parameters
hashorurlstr or None

If None, the whole cache is cleared. Otherwise, specify a hash for the cached file that is supposed to be deleted, the full path to a file in the cache that should be deleted, or a URL that should be removed from the cache if present.

pkgnamestr, optional

The package name to use to locate the download cache. i.e. for pkgname='astropy' the default cache location is ~/.astropy/cache.