Commit 516c8daa authored by payno's avatar payno
Browse files

[esrftaskgraph][hasing] handle case value us a Sized empty

parent 43e5386c
......@@ -3,6 +3,7 @@ import hashlib
from collections.abc import Mapping, Iterable, Set
import numpy
from esrftaskgraph.utils import qualname
from collections import Sized
def uhashtype(_type):
......@@ -10,7 +11,7 @@ def uhashtype(_type):
def uhash(value, _hash=None):
"""Universial hash (as opposed to python's hash).
"""Universal hash (as opposed to python's hash).
This is an example. Must find something better.
:param value:
......@@ -22,7 +23,7 @@ def uhash(value, _hash=None):
if bdigest:
_hash = hashlib.sha256()
_hash.update(uhashtype(type(value)))
if value is None:
if value is None or isinstance(value, Sized) and len(value) == 0:
pass
elif isinstance(value, UniversalHashable):
_hash.update(repr(value.uhash).encode())
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment