Downloader

class plasmapy.utils.data.downloader.Downloader(directory: Path | None = None, validate: bool = True, api_token: str | None = None)[source]

Bases: object

Accesses the PlasmaPy resource files.

Retrieves local paths to resource files, and downloads those files from PlasmaPy’s data repository if they cannot be found locally.

Parameters:
  • directory (Path, optional) – The directory into which files will be downloaded. The default is /~//.plasmapy//downloads//

  • validate (bool, default: True) – If True, verify that local files are up-to-date with the data repository, and use the GitHub API to verify download URLs before downloading files. If False, return any matching local file without verification and, if a local file cannot be found, attempt to download from the repository without validation.

  • api_token (str, optional) – A GitHub authorization token that, if provided, will be used for queries to the GitHub API. If none is provided, public API calls will be used.

Methods Summary

get_file(filename)

Returns a local path to a resource file, downloading it if necessary.

Methods Documentation

get_file(filename: str) Path[source]

Returns a local path to a resource file, downloading it if necessary.

Parameters:

filename (str) – The name of the file in the PlasmaPy’s data repository.

Returns:

Path – The local path to the resource file.

Return type:

Path