foxes.data.static_data.StaticData

class foxes.data.static_data.StaticData[source]

Bases: DataBook

A DataBook filled with static data from this directory.

__init__()[source]

Methods

__init__()

add_data_package(context, package, file_sfx)

Add static files from a package location.

add_data_package_file(context, package, ...)

Add a static file from a package location.

add_file(context, file_path)

Add a file path

add_files(context, file_paths)

Add file paths

get_file_path(context, file_name[, ...])

Get path of a file

toc(context)

Get list of contents

__init__()[source]
add_data_package(context, package, file_sfx)

Add static files from a package location.

Parameters:
  • context (str) – The context

  • package (str or package) – The package, must contain init file

  • file_sfx (list of str) – File endings to include

add_data_package_file(context, package, file_name)

Add a static file from a package location.

Parameters:
  • context (str) – The context

  • package (str or package) – The package, must contain init.py` file

  • file_mane (str) – The file name

add_file(context, file_path)

Add a file path

Parameters:
  • context (str) – The context

  • file_path (str) – The file path

add_files(context, file_paths)

Add file paths

Parameters:
  • context (str) – The context

  • file_paths (list of str) – The file paths

get_file_path(context, file_name, check_raw=True, errors=True)

Get path of a file

Parameters:
  • context (str) – The context

  • file_name (str) – The file name

  • check_raw (bool) – Check if file_name exists as given, and in that case return the path

  • errors (bool) – Flag for raising KeyError, otherwise return None, if context of file_name not found

Returns:

path – The path

Return type:

pathlib.Path

toc(context)

Get list of contents

Parameters:

context (str) – The context

Returns:

keys – The data keys

Return type:

list of str