diff options
author | Matthias Baumgartner <dev@igsor.net> | 2023-01-16 21:43:38 +0100 |
---|---|---|
committer | Matthias Baumgartner <dev@igsor.net> | 2023-01-16 21:43:38 +0100 |
commit | e12cd52ad267563c8046a593ad551b1dd089a702 (patch) | |
tree | d94cdf7ac540eb82630f78cbf564682b66007f51 /bsfs/utils | |
parent | 7f5a2920ef311b2077300714d7700313077a0bf6 (diff) | |
parent | 3504609e1ba1f7f653fa79910474bebd3ec24d8a (diff) | |
download | bsfs-e12cd52ad267563c8046a593ad551b1dd089a702.tar.gz bsfs-e12cd52ad267563c8046a593ad551b1dd089a702.tar.bz2 bsfs-e12cd52ad267563c8046a593ad551b1dd089a702.zip |
Merge branch 'mb/features' into develop
Diffstat (limited to 'bsfs/utils')
-rw-r--r-- | bsfs/utils/errors.py | 3 | ||||
-rw-r--r-- | bsfs/utils/uuid.py | 7 |
2 files changed, 10 insertions, 0 deletions
diff --git a/bsfs/utils/errors.py b/bsfs/utils/errors.py index be9d40e..6ae6484 100644 --- a/bsfs/utils/errors.py +++ b/bsfs/utils/errors.py @@ -41,4 +41,7 @@ class ConfigError(_BSFSError): class BackendError(_BSFSError): """Could not parse an AST structure.""" +class UnsupportedError(_BSFSError): + """Some requested functionality is not supported by an implementation.""" + ## EOF ## diff --git a/bsfs/utils/uuid.py b/bsfs/utils/uuid.py index 6366b18..ba5cf52 100644 --- a/bsfs/utils/uuid.py +++ b/bsfs/utils/uuid.py @@ -7,6 +7,7 @@ Author: Matthias Baumgartner, 2022 # imports from collections import abc import hashlib +import json import os import platform import random @@ -105,4 +106,10 @@ class UCID(): with open(path, 'rb') as ifile: return HASH(ifile.read()).hexdigest() + + @staticmethod + def from_dict(content: dict) -> str: + """Get the content from a dict.""" + return HASH(json.dumps(content).encode('ascii', 'ignore')).hexdigest() + ## EOF ## |