pkglts.hash_management module

Set of function to associate hash to blobs.

pkglts.hash_management.compute_hash(txt)[source]

Compute hash summary of a text

Parameters:

txt (str) – content to hash

Returns:

hash key

Return type:

(str)

pkglts.hash_management.get_pkg_hash(rep='.')[source]

Read pkg_hash file associated to this package

Parameters:

rep (Path) – directory to search for info

Returns:

hash map of preserved sections in this

package

Return type:

(dict of str, list)

pkglts.hash_management.modified_file_hash(pth, pkg_hash)[source]

Check whether a file complies with previously stored hash

Parameters:
  • pth (Path) – path to file to test

  • pkg_hash (dict of str, list) – hash map of preserved sections in this package

Returns:

whether this file has been modified or not

Return type:

(bool)

pkglts.hash_management.pth_as_key(pth)[source]

Normalize path to enable to use them as keys

Parameters:

pth (Path) – path to normalize

Returns:

(str)

pkglts.hash_management.write_pkg_hash(pkg_hash, rep='.')[source]

Store hash associated to this package on disk.

Parameters:
  • pkg_hash (dict of str, list) – hash map of preserved sections in this package

  • rep (Path) – directory to search for info

Returns:

None