wags_tails.utils.storage#

Provide helpful functions for managing data storage.

wags_tails.utils.storage.get_data_dir()[source]#

Get base wags-tails data storage location.

By default, conform to XDG Base Directory Specification, unless a directory is specified otherwise:

  1. check env var "WAGS_TAILS_DIR"

  2. check env var "XDG_DATA_HOME"

  3. check env var "XDG_DATA_DIRS" for a colon-separated list, skipping any

    that can’t be used (i.e. they’re already a file)

  4. otherwise, use ~/.local/share/

Return type:

Path

Returns:

path to base data directory

wags_tails.utils.storage.get_latest_local_file(directory, glob)[source]#

Get most recent locally-available file.

Parameters:
  • dir – location to check (presumably, the data directory for a source)

  • glob (str) – file pattern to match against

Return type:

Path

Returns:

Path to most recent file

Raises:

FileNotFoundError – if no local data is available