def load(self, label, key, module): ''' import thing into appspace @param label: appspaced thing label @param key: appspace key @param module: module path ''' # add branch appspace from include app = lazyimport(module[-1]) if isinstance( module, tuple ) else lazyimport(module) # register get self.register([key], key, label, app) return app
def _key(cls, label, manager): try: # lazily load key key = cls.key if isinstance(key, strings): key = lazyimport(key) # register class key manager.ez_register(ANamespace, label, key) except AttributeError: key = manager.key(ANamespace, label)
def build(cls): '''build manager configuration from class''' l = selfname(cls) # set key key = cls.key if isinstance(key, strings): # load key if string key = lazyimport(key) manager = cls._manager(l, key) # pylint: disable-msg=e1121 b = partial(manager.keyed, ABranch) n = partial(manager.keyed, ANamespace) m = manager.set t = lambda x, y: y.build(manager) if (n(y) or b(y)) else m(y, x, l) exhaustmap(vars(cls), t, cls._filter) return manager
def _key(cls, label, manager): try: # lazily load key key = cls.key if isinstance(key, strings): key = lazyimport(key) # register class key ez_register = manager.ez_register ez_register(ANamespace, label, key) exhaust(imap( lambda x: ez_register(KService, x, label), iter(key.names(True)), )) except AttributeError: key = manager.key(ANamespace, label)