Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
payno
workflow_concepts
Commits
516c8daa
Commit
516c8daa
authored
Mar 15, 2021
by
payno
Browse files
[esrftaskgraph][hasing] handle case value us a Sized empty
parent
43e5386c
Changes
1
Show whitespace changes
Inline
Side-by-side
esrftaskgraph/esrftaskgraph/hashing.py
View file @
516c8daa
...
...
@@ -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
):
"""Univers
i
al 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
())
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment