We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 6d192e7 commit 72cbed1Copy full SHA for 72cbed1
superduper/base/base.py
@@ -17,7 +17,28 @@
17
from superduper.base.datalayer import Datalayer
18
19
20
-REGISTRY = {}
+class _UniqueRegistry:
21
+ def __init__(self, d):
22
+ self.d = d
23
+ def __getitem__(self, item):
24
+ return self.d[item]
25
+
26
+ def __setitem__(self, key, value):
27
+ matching = [x for x in self.d.keys() if x.split('.')[-1] == key.split('.')[-1]]
28
+ if matching and matching[0] != key:
29
+ raise ValueError(
30
+ f"Class name \"{key.split('.')[-1]}\" already exists"
31
+ f" as a `superduper` schema: as {matching[0]}."
32
+ )
33
+ elif matching:
34
+ return
35
+ self.d[key] = value
36
37
+ def __repr__(self):
38
+ return f'_UniqueRegistry({self.d})'
39
40
41
+REGISTRY = _UniqueRegistry({})
42
43
44
class BaseMeta(type):
0 commit comments