quickie.conditions.FilesModified

class quickie.conditions.FilesModified(cache_id: LiteralString, *, paths: Sequence[str | Path], exclude: Sequence[str | Path] = (), algorithm: str | Algorithm = Algorithm.TIMESTAMP, allow_missing: bool = False)

Check if files have been not being modified.

__init__(cache_id: LiteralString, *, paths: Sequence[str | Path], exclude: Sequence[str | Path] = (), algorithm: str | Algorithm = Algorithm.TIMESTAMP, allow_missing: bool = False)

Initialize the check.

Parameters:
  • cache_id – The identifier of the condition, used as part of the cache file name. It should be unique for each condition instance to avoid conflicts. It is recommended to be something that groups the files being checked, or a random string like an UUID.

  • paths – The files to check.

  • exclude – The files to exclude from the check.

  • algorithm – The algorithm to use for checking. Can be one of quickie.conditions.FilesModified.Algorithm or a string representing the algorithm name, such as “md5”, “sha1”, “sha256”, or “timestamp”.

  • allow_missing – If True, missing files will be treated as if they have not been modified. Defaults to False.

Raises:

ValueError – If the algorithm is not supported.

Returns:

True if the files have been modified, False otherwise.

Methods

__init__(cache_id, *, paths[, exclude, ...])

Initialize the check.

get_cache_file_name(task)

Return the name of the cache file.

get_cache_file_path(task)

Return the path of the cache file.