From 77ed1970e1d9c11590424c65ac83f35eb499bb62 Mon Sep 17 00:00:00 2001 From: mwiegand Date: Tue, 13 Jul 2021 19:00:26 +0200 Subject: [PATCH] wip --- bundles/bind/metadata.py | 10 +--------- libs/hashable.py | 7 +++++++ 2 files changed, 8 insertions(+), 9 deletions(-) create mode 100644 libs/hashable.py diff --git a/bundles/bind/metadata.py b/bundles/bind/metadata.py index 1fc8fc8..f43a285 100644 --- a/bundles/bind/metadata.py +++ b/bundles/bind/metadata.py @@ -1,13 +1,5 @@ -class hdict(dict): - def __hash__(self): - return hash(tuple(sorted(self.items()))) - -class hlist(list): - def __hash__(self): - return hash(tuple(sorted(self))) - - from ipaddress import ip_interface +hdict, hlist = repo.libs.hashable.hdict, repo.libs.hashable.hlist defaults = { diff --git a/libs/hashable.py b/libs/hashable.py new file mode 100644 index 0000000..5cb4562 --- /dev/null +++ b/libs/hashable.py @@ -0,0 +1,7 @@ +class hdict(dict): + def __hash__(self): + return hash(tuple(sorted(self.items()))) + +class hlist(list): + def __hash__(self): + return hash(tuple(sorted(self)))