From 16ea94e06e63e1dc648c3c1fb6136cabc241f3ad Mon Sep 17 00:00:00 2001 From: Zhiyuan Chen Date: Fri, 14 Apr 2023 19:06:46 +0800 Subject: [PATCH] support hash Signed-off-by: Zhiyuan Chen --- chanfig/flat_dict.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/chanfig/flat_dict.py b/chanfig/flat_dict.py index e877b029..47d70565 100644 --- a/chanfig/flat_dict.py +++ b/chanfig/flat_dict.py @@ -1148,6 +1148,9 @@ def _add_indent(self, text: str) -> str: text = first + "\n" + text return text + def __hash__(self): + return hash(frozenset(self.items())) + def __getstate__(self, *args, **kwargs): return self.__dict__