in muss/utils/helpers.py [0:0]
def get_hashable_object(obj):
def get_hashable_dict(d):
return tuple(sorted([(key, get_hashable_object(value)) for key, value in d.items()]))
def get_hashable_list(l):
return tuple(l)
def get_hashable_numpy_array(arr):
# Note: tobytes() Makes a copy of the array
return arr.tobytes()
if isinstance(obj, list):
return get_hashable_list(obj)
if isinstance(obj, dict):
return get_hashable_dict(obj)
if isinstance(obj, np.ndarray):
return get_hashable_numpy_array(obj)
return obj