From 8dc0c47abac97c689406a014945e5f605dd762e1 Mon Sep 17 00:00:00 2001 From: Fredrik Tolf Date: Tue, 11 Jan 2022 19:30:12 +0100 Subject: [PATCH] Move namedtype from bin to data. --- coe/bin.py | 8 +------- coe/data.py | 6 ++++++ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/coe/bin.py b/coe/bin.py index 395a209..de3d6fa 100644 --- a/coe/bin.py +++ b/coe/bin.py @@ -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: diff --git a/coe/data.py b/coe/data.py index 05e129b..b65dbae 100644 --- a/coe/data.py +++ b/coe/data.py @@ -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] -- 2.11.0