Exemplo n.º 1
0
 def get_module(self, **kwargs):
     if self.fallback:
         return self.module
     if not 'cluster' in kwargs:
         raise loader.LoaderImportError(
             "must specify 'cluster' param when importing .ekube or .ckube files"
         )
     return self.module[kwargs['cluster']]
Exemplo n.º 2
0
 def get_symbol(self, symname, **kwargs):
     if self.fallback:
         return self.module.__dict__[symname]
     if not 'cluster' in kwargs:
         raise loader.LoaderImportError(
             "must specify 'cluster' param when importing .ekube or .ckube files"
         )
     return self.module[kwargs['cluster']].__dict__[symname]
Exemplo n.º 3
0
 def import_relative(name, *exports, **kwargs):
     self.debug(
         3,
         '{}: import_relative({}, ...)'.format(self.path.base_rel_path,
                                               name))
     if len(name) == 0 or name.startswith('.') or '..' in name or \
             name.lower().strip('0123456789abcdefghijklmnopqrstuvwxyz_') != '':
         raise loader.LoaderImportError(
             'import_relative() uses a python-like import (got {})'.
             format(name))
     name_path = '/'.join(name.split('.')) + '.py'
     kwargs['__reserved_names'] = ('import_relative', 'import_objects')
     return self.collection().import_relative(self, name_path, name,
                                              exports, **kwargs)