Exemple #1
0
    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
Exemple #2
0
 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)
Exemple #3
0
 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
Exemple #4
0
 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)