DirectoryArtifactStore#

class scikitplot.agent.DirectoryArtifactStore(directory)[source]#

Keep each artifact in <directory>/<first two digits>/<digest>.json.

Parameters:
directorystr or os.PathLike

Created if missing.

Parameters:

directory (str | os.PathLike[str])

Notes

Written like JsonFileStore: a temporary file in the same directory, synced, renamed into place and the directory synced, so a reader sees a whole artifact or none. The digest is checked to be 64 hexadecimal digits before it names a file.

get(key)[source]#

Return the value stored under key.

Raises:
KeyError

If nothing is stored under key.

StateError

If what is stored does not have digest key.

Parameters:

key (str)

Return type:

Any

has(key)[source]#

Whether a file is stored under key.

Parameters:

key (str)

Return type:

bool

path(key)[source]#

Return the file that holds key.

Parameters:

key (str)

Return type:

Path

put(value)[source]#

Store value and return its digest.

Parameters:
valueobject

A JSON value (plain).

Returns:
str

64 hexadecimal digits.

Parameters:

value (Any)

Return type:

str