@@ -673,7 +673,7 @@ def hash_value(value, tp=None, metadata=None, precalculated=None):
673
673
"""calculating hash or returning values recursively"""
674
674
if metadata is None :
675
675
metadata = {}
676
- if isinstance (value , (tuple , list )):
676
+ if isinstance (value , (tuple , list , set )):
677
677
return [hash_value (el , tp , metadata , precalculated ) for el in value ]
678
678
elif isinstance (value , dict ):
679
679
dict_hash = {
@@ -694,8 +694,21 @@ def hash_value(value, tp=None, metadata=None, precalculated=None):
694
694
and "container_path" not in metadata
695
695
):
696
696
return hash_dir (value , precalculated = precalculated )
697
- else :
697
+ elif type (value ).__module__ == "numpy" : # numpy objects
698
+ return sha256 (value .tostring ()).hexdigest ()
699
+ elif (
700
+ isinstance (
701
+ value , (int , float , complex , bool , str , bytes , LazyField , os .PathLike )
702
+ )
703
+ or value is None
704
+ ):
698
705
return value
706
+ else :
707
+ warnings .warn (
708
+ f"pydra doesn't fully support hashing for { type (value )} , "
709
+ f"cp.dumps is used in hash functions, so it could depend on the system"
710
+ )
711
+ return sha256 (cp .dumps (value )).hexdigest ()
699
712
700
713
701
714
def output_from_inputfields (output_spec , input_spec ):
0 commit comments