Move namedtype from bin to data.
authorFredrik Tolf <fredrik@dolda2000.com>
Tue, 11 Jan 2022 18:30:12 +0000 (19:30 +0100)
committerFredrik Tolf <fredrik@dolda2000.com>
Tue, 11 Jan 2022 18:30:12 +0000 (19:30 +0100)
coe/bin.py
coe/data.py

index 395a209..de3d6fa 100644 (file)
@@ -152,12 +152,6 @@ class referror(fmterror):
     def __init__(self):
         super().__init__("bad backref")
 
-class namedtype(type):
-    def __new__(cls, *args, typename=None, **kwargs):
-        self = super().__new__(cls, *args, **kwargs)
-        self.typename = typename
-        return self
-
 class decoder(object):
     def __init__(self):
         self.reftab = []
@@ -229,7 +223,7 @@ class decoder(object):
             buf[key] = self.loadtagged(fp, tag)
 
     def makeobjtype(self, nm):
-        return namedtype(str(nm), (data.obj, object), {}, typename=nm)
+        return data.namedtype(str(nm), (data.obj, object), {}, typename=nm)
 
     def loadobj(self, fp, ref=False):
         if ref:
index 05e129b..b65dbae 100644 (file)
@@ -64,6 +64,12 @@ class nssymbol(symbol):
         self.name = name
         self.ns = ns
 
+class namedtype(type):
+    def __new__(cls, *args, typename=None, **kwargs):
+        self = super().__new__(cls, *args, **kwargs)
+        self.typename = typename
+        return self
+
 class obj(object):
     def __getitem__(self, key):
         return self.__dict__[key]