emmi_data_management.checkpoint.providers.file_provider

Classes

FileProvider

Local filesystem (supports file:// and plain paths).

Module Contents

class emmi_data_management.checkpoint.providers.file_provider.FileProvider

Bases: emmi_data_management.checkpoint.types.Provider

Local filesystem (supports file:// and plain paths).

scheme = 'file'
can_handle(uri)

Returns True if the URI points to a local file.

Parameters:

uri (str) – Input URI where the file is located.

Returns:

Whether the URI is a local file or not.

Return type:

  • bool

estimate_size(uri)

Estimate the size of a local file.

Parameters:

uri (str) – Input URI where the file is located.

Returns:

Estimated size of the local file. - None: If no size is available.

Return type:

  • int

fetch(uri, destination_dir, *, compute_hash=True)

Returns a tuple with a local file path for a given URI and a corresponding hash (if possible to create).

Parameters:
  • uri (str) – Input URI where the file is located.

  • destination_dir (pathlib.Path) – Destination directory where the file need to be located.

  • compute_hash (bool) – Compute the hash of the file on the local file system.

Returns:

Local file path and an option hash value.

Return type:

  • tuple[Path, str | None]