insndb/core: make Dict almost immutable
authorDmitry Selyutin <ghostmansd@gmail.com>
Sat, 10 Jun 2023 19:50:54 +0000 (22:50 +0300)
committerDmitry Selyutin <ghostmansd@gmail.com>
Sat, 10 Jun 2023 19:50:54 +0000 (22:50 +0300)
src/openpower/insndb/core.py

index d0425ff8b968319875ba74d1050b275d399dea42..b9f681b62ada18c4484113479d90a642e8c3f88f 100644 (file)
@@ -124,6 +124,27 @@ class Dict(Node, dict):
         cls.__datatype = datatype
         return super().__init_subclass__()
 
+    def __hash__(self):
+        return hash(tuple(sorted(self.items())))
+
+    def clear(self):
+        raise NotImplementedError()
+
+    def __delitem__(self, key):
+        raise NotImplementedError()
+
+    def __setitem__(self, key, value):
+        raise NotImplementedError()
+
+    def popitem(self) -> tuple:
+        raise NotImplementedError()
+
+    def pop(self, key, default=None):
+        raise NotImplementedError()
+
+    def update(self, entry, **kwargs):
+        raise NotImplementedError()
+
     @walkmethod
     def walk(clsself, match=None):
         if match is None:
@@ -756,9 +777,6 @@ class Fields(Dict, datatype=type("Bits", (Tuple,), {}, datatype=int)):
 
         return super().__init__(mapping)
 
-    def __hash__(self):
-        return hash(tuple(sorted(self.items())))
-
     def __iter__(self):
         yield from self.__mapping.items()