def __init__(self, name, bases, dict): if dict.get('typename') is None and name[0].islower(): self.typename = name.rstrip("_") if self.typename is not None: register(self.typename, self) _update_class(self) self.conser = Conser(partial(type.__call__, self))
class TypeMetaClass(type): "Metaclass for numba types, conses immutable types." def __init__(self, name, bases, dict): if dict.get('typename') is None and name[0].islower(): self.typename = name.rstrip("_") if self.typename is not None: register(self.typename, self) _update_class(self) self.conser = Conser(partial(type.__call__, self)) def __call__(self, *args, **kwds): args = self.default_args(args, kwds) if not self.mutable: return self.conser.get(*args) return type.__call__(self, *args)