[LNT] r311759 - Add file missing in r311754

Matthias Braun via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 24 19:45:23 PDT 2017


Author: matze
Date: Thu Aug 24 19:45:23 2017
New Revision: 311759

URL: http://llvm.org/viewvc/llvm-project?rev=311759&view=rev
Log:
Add file missing in r311754

Added:
    lnt/trunk/lnt/util/multidict.py

Added: lnt/trunk/lnt/util/multidict.py
URL: http://llvm.org/viewvc/llvm-project/lnt/trunk/lnt/util/multidict.py?rev=311759&view=auto
==============================================================================
--- lnt/trunk/lnt/util/multidict.py (added)
+++ lnt/trunk/lnt/util/multidict.py Thu Aug 24 19:45:23 2017
@@ -0,0 +1,32 @@
+class multidict:
+    def __init__(self, elts=()):
+        self.data = {}
+        for key, value in elts:
+            self[key] = value
+
+    def __contains__(self, item):
+        return item in self.data
+
+    def __getitem__(self, item):
+        return self.data[item]
+
+    def __setitem__(self, key, value):
+        if key in self.data:
+            self.data[key].append(value)
+        else:
+            self.data[key] = [value]
+
+    def items(self):
+        return self.data.items()
+
+    def values(self):
+        return self.data.values()
+
+    def keys(self):
+        return self.data.keys()
+
+    def __len__(self):
+        return len(self.data)
+
+    def get(self, key, default=None):
+        return self.data.get(key, default)




More information about the llvm-commits mailing list