Find the Module by its name.
779605
def find_module(self, name):
        """"""
        defmodule = lib.EnvFindDefmodule(self._env, name.encode())
        if defmodule == ffi.NULL:
            raise LookupError("Module '%s' not found" % name)

        return Module(self._env, defmodule)
318704
function(name) {
			var match = null;
			list.forEach(function(file) {
				if(_.indexOf(file.modules, name) >= 0) {
					match = file;
					return false;
				}
			});
			return match;
		}
34537
def find_module(module, path=None, imp=None):
    """"""
    if imp is None:
        imp = importlib.import_module
    with cwd_in_path():
        if "." in module:
            last = None
            parts = module.split(".")
            for i, part in enumerate(parts[:-1]):
                mpart = imp(".".join(parts[:i + 1]))
                try:
                    path = mpart.__path__
                except AttributeError:
                    raise NotAPackage(module)
                last = _imp.find_module(parts[i + 1], path)
            return last
        return _imp.find_module(module)
660224
def find_spec(self, fullname, path, target=None):
        ''''''
        if not path:
            path = [os.getcwd()]
        if "." in fullname:
            name = fullname.split(".")[-1]
        else:
            name = fullname
        for entry in path:
            if os.path.isdir(os.path.join(entry, name)):
                # this module has child modules
                filename = os.path.join(entry, name, "__init__.py")
                submodule_locations = [os.path.join(entry, name)]
            else:
                filename = os.path.join(entry, name + ".py")
                submodule_locations = None
            if not os.path.exists(filename):
                continue

            return spec_from_file_location(fullname, filename,
                                           loader=MyLoader(filename),
                                           submodule_search_locations=submodule_locations)
        return None
570042
def getmodule(object):
    """"""
    if ismodule(object):
        return object
    if isclass(object):
        return sys.modules.get(object.__module__)
    try:
        file = getabsfile(object)
    except TypeError:
        return None
    if modulesbyfile.has_key(file):
        return sys.modules[modulesbyfile[file]]
    for module in sys.modules.values():
        if hasattr(module, '__file__'):
            modulesbyfile[getabsfile(module)] = module.__name__
    if modulesbyfile.has_key(file):
        return sys.modules[modulesbyfile[file]]
    main = sys.modules['__main__']
    if hasattr(main, object.__name__):
        mainobject = getattr(main, object.__name__)
        if mainobject is object:
            return main
    builtin = sys.modules['__builtin__']
    if hasattr(builtin, object.__name__):
        builtinobject = getattr(builtin, object.__name__)
        if builtinobject is object:
            return builtin
1090379
def check_module(mod_name):
    """"""
    # Special cases #
    if mod_name in module_name: mod_name = module_name[mod_name]
    # Use a try except block #
    try:
        __import__(mod_name)
    except ImportError as e:
        if str(e) != 'No module named %s' % mod_name: raise e
        print 'You do not seem to have the "%s" package properly installed.' \
              ' Either you never installed it or your $PYTHONPATH is not set up correctly.' \
              ' For more instructions see the README file. (%s)' % (mod_name, e)
        sys.exit()
101980
def load_module(self, module_name, pfx=None, path=None):
        """"""
        try:
            if pfx:
                name = pfx + '.' + module_name
            else:
                name = module_name

            if name in sys.modules:
                module = sys.modules[name]
                self.logger.info("Reloading module '%s'..." % module_name)
                module = importlib.reload(module)

            else:
                self.logger.info("Loading module '%s'..." % module_name)
                module = my_import(name, path=path)

            self.module[module_name] = module
            return module

        except Exception as e:
            self.logger.error("Failed to load module '%s': %s" % (
                module_name, str(e)))
            raise ModuleManagerError(e)
415652
def resolve_name(name):
    

    parts = name.split('.')
    cursor = len(parts) - 1
    module_name = parts[:cursor]
    attr_name = parts[-1]

    while cursor > 0:
        try:
            ret = __import__('.'.join(module_name), fromlist=[attr_name])
            break
        except ImportError:
            if cursor == 0:
                raise
            cursor -= 1
            module_name = parts[:cursor]
            attr_name = parts[cursor]
            ret = ''

    for part in parts[cursor:]:
        try:
            ret = getattr(ret, part)
        except AttributeError:
            raise ImportError(name)

    return ret
90118
def main_module(self):
        """"""
        if self.i_module.keyword == "submodule":
            return self.i_module.i_ctx.get_module(
                self.i_module.i_including_modulename)
        return self.i_module
1284819
def find_module(self, fullname, path=None):
        
        if fullname.startswith('pygal.maps.') and hasattr(
                maps, fullname.split('.')[2]):
            return self
        return None
605492
def get_module_config(self, name):
    
    if self.exists("modules"):
      if name in self._json["modules"] and not isinstance(self._json["modules"][name], str):
        return self._json["modules"][name]
    return None
785978
def module(self):
        """"""
        if self._module is None:
            root = self
            while self._module is None and root is not None:
                if isinstance(root, Module):
                    self._module = root
                else:
                    root = root.parent

        return self._module
632743
def find_module(self, fullname, path=None):
        '''
        
        '''

        loader = None
        if self.__filter is None or self.__filter(fullname):
            loader = ModuleLoader(self, fullname, path)

        return loader
117569
def get(self, name):
        """"""
        if name not in self.modules:
            self.load_dependency(name, False, False, False)

        if name in self.modules:
            return self.modules[name]
        else:
            return None
1347894
function findModuleNameByInteractive() {
        var scripts = document.getElementsByTagName('script'),
            re,
            i,
            name,
            script;

        for (i = scripts.length - 1; i >= 0; i--) {
            script = scripts[i];
            if (script.readyState === 'interactive') {
                re = script;
                break;
            }
        }
        if (re) {
            name = re.getAttribute('data-mod-name');
        } else {
            // sometimes when read module file from cache,
            // interactive status is not triggered
            // module code is executed right after inserting into dom
            // i has to preserve module name before insert module script into dom,
            // then get it back here
            logger.debug('can not find interactive script,time diff : ' + (+new Date() - startLoadModTime));
            logger.debug('old_ie get mod name from cache : ' + startLoadModName);
            name = startLoadModName;
        }
        return name;
    }
114789
def getModule(self, moduleName):
        
        if moduleName not in self.moduleCache:
            modulePath = FilePath(
                athena.jsDeps.getModuleForName(moduleName)._cache.path)
            cachedModule = self.moduleCache[moduleName] = CachedJSModule(
                moduleName, modulePath)
        else:
            cachedModule = self.moduleCache[moduleName]
        return cachedModule
893172
def _get_module_name(module):
    
    name = module.__name__[:-6] if module.__name__.endswith('Module') else module.__name__
    return name.lower()