The types module to be imported.
        Parameters
        name -- name of types module
        modulePath -- optional path where module is located.
430777
def setTypesModuleName(self, name, modulePath=None):
        
        self.typesModuleName = '%s' %name
        if modulePath is not None:
            self.typesModuleName = '%s.%s' %(modulePath,name)
1339217
def find_module(self, fullname, path=None):
        
        # path points to the top-level package path if any
        # and we can only import sub-modules/-packages
        if path is None:
            return
        if fullname.startswith(self.module_prefix):
            return self
        else:
            return None
49698
def _import(self, name):
        '''  '''
        mod = __import__(name)
        components = name.split('.')
        for comp in components[1:]:
            mod = getattr(mod, comp)
        return mod
476486
def import_by_path(dotted_path, error_prefix=''):
    
    try:
        module_path, class_name = dotted_path.rsplit('.', 1)
    except ValueError:
        raise ImproperlyConfigured("%s%s doesn't look like a module path" % (
            error_prefix, dotted_path))
    try:
        module = import_module(module_path)
    except ImportError as e:
        raise ImproperlyConfigured('%sError importing module %s: "%s"' % (
            error_prefix, module_path, e))
    try:
        attr = getattr(module, class_name)
    except AttributeError:
        raise ImproperlyConfigured(
            '%sModule "%s" does not define a "%s" attribute/class' % (
                error_prefix, module_path, class_name
            )
        )
    return attr
1017243
def import_class(classpath, package=None):
    
    if '.' in classpath:
        module, classname = classpath.rsplit('.', 1)
        if package and not module.startswith('.'):
            module = '.{0}'.format(module)
        mod = import_module(module, package)
    else:
        classname = classpath
        mod = import_module(package)

    return getattr(mod, classname)
382740
def import_file(name, path):
    
    spec = importlib.util.spec_from_file_location(name, path)
    mod = importlib.util.module_from_spec(spec)
    spec.loader.exec_module(mod)
    return mod
496328
def my_import(name):
    
    mod = __import__(name)
    components = name.split('.')
    for comp in components[1:]:
        mod = getattr(mod, comp)
    return mod
1321207
def _import_module(module_name, warn=True, prefix='_py_', ignore='_'):
    
    try:
        module = __import__(module_name)
    except ImportError:
        if warn:
            warnings.warn("Failed to import module " + module_name)
    else:
        for attr in dir(module):
            if ignore and attr.startswith(ignore):
                continue
            if prefix:
                if attr in globals():
                    globals()[prefix + attr] = globals()[attr]
                elif warn:
                    warnings.warn("No Python implementation of " + attr)
            globals()[attr] = getattr(module, attr)
        return True
230202
def load_path_with_default(self, path, default_constructor):
        '''
        
        '''
        try:
            imported_obj = self.load_path(path)
        except (ImportError, ConfigurationError):
            imported_obj = default_constructor(path)
        else:
            # Ugly but seemingly expedient way to check a module was an
            # namespace type module
            if (isinstance(imported_obj, ModuleType) and
                    imported_obj.__spec__.origin == 'namespace'):
                imported_obj = default_constructor(path)
        return imported_obj
161147
function resolve(to, importPath, fileType) {
  importPath =
    path.extname(importPath) === '' ? `${importPath}.${fileType}` : importPath
  if (importPath.startsWith('/')) {
    return importPath
  } else if (matchModuleImport.test(importPath)) {
    return require.resolve(importPath.replace(matchModuleImport, ''))
  }
  return path.join(path.dirname(to), importPath)
}
465799
def _find_module(name, path=None):
    

    parts = name.split('.')

    for part in parts:
        if path is not None:
            path = [path]

        fh, path, descr = imp.find_module(part, path)
        if fh is not None and part != parts[-1]:
            fh.close()

    return fh, path, descr
1027418
def packageFromPath(path, includeModule=False):
    
    path = nstr(path)
    module = ''
    if os.path.isfile(path):
        path, fname = os.path.split(path)
        if fname.endswith('.py') and fname != '__init__.py':
            module = fname.split('.')[0]

    parts = os.path.normpath(path).split(os.path.sep)
    package_parts = []

    for i in range(len(parts), 0, -1):
        filename = os.path.sep.join(parts[:i] + ['__init__.py'])

        if not os.path.isfile(filename):
            break

        package_parts.insert(0, parts[i - 1])

    if includeModule and module:
        package_parts.append(module)

    return '.'.join(package_parts)
554618
def import_(path):
    
    if isinstance(path, str):
        v = path.split(':')
        if len(v) == 1:
            x = path.rsplit('.', 1)
            if len(x) == 2:
                module, func = x
            else:
                module, func = x[0], ''
        else:
            module, func = v
        mod = __import__(module)
        f = mod
        if func:
            for x in func.split('.'):
                f = getattr(f, x)
    else:
        f = path
    return f
705817
def import_attr(path):
    
    module_path, attr_name = path.rsplit(".", 1)
    return getattr(import_module(module_path), attr_name)
882781
def import_attribute(path):
    
    module_name, attribute_name = path.rsplit('.', 1)
    module = import_module(module_name)
    attribute = getattr(module, attribute_name)
    return attribute
287074
def load(self, root, module_path, pkg_name):
        
        root = os.path.join(root, module_path)
        import_name = os.path.join(pkg_name, module_path).replace(os.sep, '.')
        for (_, name, _) in pkgutil.iter_modules([root]):
            self.modules[name] = import_module('.' + name, package=import_name)
        return self.modules
805548
def load_module(self, name):
        
        _verbose_message('namespace module loaded with path {!r}', self.path)

        # Adjusting code from LoaderBasics
        if name in sys.modules:
            mod = sys.modules[name]
            self.exec_module(mod)
            # In this case we do not want to remove the module in case of error
            # Ref : https://docs.python.org/3/reference/import.html#loaders
        else:
            try:
                # Building custom spec and loading as in _LoaderBasics...
                spec = ModuleSpec(name, self, origin='namespace', is_package=True)
                spec.submodule_search_locations = self.path

                # this will call create_module and also initialize the module properly (like for py3)
                mod = module_from_spec(spec)

                # as per https://docs.python.org/3/reference/import.html#loaders
                assert mod.__name__ in sys.modules

                self.exec_module(mod)
                # We don't ensure that the import-related module attributes get
                # set in the sys.modules replacement case.  Such modules are on
                # their own.
            except:
                # as per https://docs.python.org/3/reference/import.html#loaders
                if name in sys.modules:
                    del sys.modules[name]
                raise

        return sys.modules[name]