From e449052a177ff3efc94f2ee0d8ce6f3ead7a83ec Mon Sep 17 00:00:00 2001
From: Zooko O'Whielacronx <zooko@zooko.com>
Date: Mon, 12 Jan 2009 10:55:39 -0700
Subject: [PATCH] util: dictutil: add DictOfSets.union(key, values) and
 DictOfSets.update(otherdictofsets)

---
 src/allmydata/util/dictutil.py | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/src/allmydata/util/dictutil.py b/src/allmydata/util/dictutil.py
index 227d2479..11c0c743 100644
--- a/src/allmydata/util/dictutil.py
+++ b/src/allmydata/util/dictutil.py
@@ -40,6 +40,16 @@ class DictOfSets(dict):
         else:
             self[key] = set([value])
 
+    def union(self, key, values):
+        if key in self:
+            self[key].update(values)
+        else:
+            self[key] = set(values)
+
+    def update(self, otherdictofsets):
+        for key, value in otherdictofsets.iteritems():
+            self.union(key, value)
+
     def discard(self, key, value):
         if not key in self:
             return
-- 
2.45.2