Store Base Adapter Class#

Warning

This class is an abstract implementation using ABC. It serves as an interface for other IO classes to build upon. You should never import BaseIoAdapter to use as IO for your pipeline steps.

class expectmine.storage.base_storage_adapter.BaseStoreAdapter(persistent_path: Path, working_directory: Path, **kwargs: Dict[Any, Any])[source]#

Bases: ABC

abstract __init__(persistent_path: Path, working_directory: Path, **kwargs: Dict[Any, Any])[source]#

Creates a factory for producing scoped storages.

Parameters:
  • persistent_path (Path) – The path which the storage can use to persist data.

  • working_directory (Path) – The path which the storage can use to create temporary files in for the user or pipeline to access.

Example:

>>> BaseAdapter(Path("path1"), Path("path2"))
BaseAdapter
>>> BaseAdapter(Path("path2"))
ValueError("Storage paths can not be empty.")
Raises:
  • TypeError – If the arguments have the wrong type.

  • ValueError – If either step name or any of the paths are empty.

abstract get_instance(step_name: str, *args: List[Any], **kwargs: Dict[Any, Any]) BaseStore[source]#

Produces a scoped instance of type BaseStorage.

Parameters:

step_name (str) – The scope of the instance

Returns:

A scoped instance of a store.

Return type:

BaseStore

Example:

>>> get_instance("Instance 1")
BaseStore
>>> get_instance("")
ValueError("Step name can not be empty.")
Raises:
  • TypeError – If the arguments have the wrong type.

  • ValueError – If step name is too long or empty.