DataManager

class sunpy.data.data_manager.DataManager(cache)[source]

Bases: object

This class provides a remote data manager for managing remote files.

Parameters

cache (sunpy.data.data_manager.Cache) – Cache object to be used by DataManager.

Methods Summary

get(name)

Get the file by name.

override_file(name, uri[, sha_hash])

Replaces the file by the name with the file provided by the url/path.

require(name, urls, sha_hash)

Decorator for informing the data manager about the requirement of a file by a function.

skip_hash_check()

Disables hash checking temporarily

Methods Documentation

get(name)[source]

Get the file by name.

Parameters

name (str) – Name of the file given to the data manager, same as the one provided in require.

Returns

pathlib.Path – Path of the file.

Raises

KeyError – If name is not in the cache.

override_file(name, uri, sha_hash=None)[source]

Replaces the file by the name with the file provided by the url/path.

Parameters
  • name (str) – Name of the file provided in the require decorator.

  • uri (str) – URI of the file which replaces original file. Scheme should be one of http, https, ftp or file. If no scheme is given the uri will be interpreted as a local path. i.e. file:///tmp/test and /tmp/test are the same.

  • sha_hash (str, optional) – SHA256 hash of the file to compared to after downloading.

require(name, urls, sha_hash)[source]

Decorator for informing the data manager about the requirement of a file by a function.

Parameters
  • name (str) – The name to reference the file with.

  • urls (list or str) – A list of urls to download the file from.

  • sha_hash (str) – SHA-256 hash of file.

skip_hash_check()[source]

Disables hash checking temporarily

Examples

>>> with remote_data_manager.skip_hash_check():  
...     myfunction()