Skip to content

Commit

Permalink
Adding None support to HashableDict
Browse files Browse the repository at this point in the history
  • Loading branch information
cosimon committed Dec 20, 2023
1 parent ed7a329 commit d51282c
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion tap_mambu/helpers/hashable_dict.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import json
import math


class HashableDict(dict):
Expand All @@ -8,7 +9,7 @@ def _recur_hash(value):
if type(value) in [dict, HashableDict]:
return HashableDict(value).__key()
if type(value) == list:
return tuple(sorted(map(HashableDict._recur_hash, value)))
return tuple(sorted(map(HashableDict._recur_hash, value), key=lambda x: x if x is not None else -math.inf))
return value

def __key(self):
Expand Down

0 comments on commit d51282c

Please sign in to comment.