Returns a resource corresponding to the given module

        returns None if it can not be found
556339
def find_module(self, modname, folder=None):
        
        for src in self.get_source_folders():
            module = _find_module_in_folder(src, modname)
            if module is not None:
                return module
        for src in self.get_python_path_folders():
            module = _find_module_in_folder(src, modname)
            if module is not None:
                return module
        if folder is not None:
            module = _find_module_in_folder(folder, modname)
            if module is not None:
                return module
        return None
1136179
def get_data_path(package, resource):
    # type: (str, str) -> str
    """"""
    loader = pkgutil.get_loader(package)
    if loader is None or not hasattr(loader, 'get_data'):
        raise PackageResourceError("Failed to load package: '{0}'".format(
            package))
    mod = sys.modules.get(package) or loader.load_module(package)
    if mod is None or not hasattr(mod, '__file__'):
        raise PackageResourceError("Failed to load module: '{0}'".format(
            package))
    parts = resource.split('/')
    parts.insert(0, os.path.dirname(mod.__file__))
    resource_name = os.path.join(*parts)
    return resource_name
854870
def load_module(self, name):
        
        if name in sys.modules:
            return sys.modules[name]
        path = self.module2uri(name)
        if os.path.isfile(path):
            return self._load_module(name, path)
        elif os.path.isdir(path):
            return self._load_package(name, path)
        else:
            raise ImportError("Missing module source file %r" % path)
220339
def get(cls, parent=None):
        
        data = cls._process_request(connection.get, parent=parent)
        return cls._load_resources(data)
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
955770
def _get_module(module_name=None, module=None, register=True):
    
    if module is None and module_name is not None:
        try:
            module = sys.modules[module_name]
        except KeyError as ex:
            print(ex)
            raise KeyError(('module_name=%r must be loaded before ' +
                            'receiving injections') % module_name)
    elif module is not None and module_name is None:
        pass
    else:
        raise ValueError('module_name or module must be exclusively specified')
    if register is True:
        _add_injected_module(module)
    return module
1162443
def resource_exists(self, slug, locale, project_slug=None):
        """"""

        try:
            resource = resources.Resource.get(
                project_slug=project_slug or self.get_project_slug(locale),
                slug=slug,
            )

            return resource

        except NotFoundError:
            pass

        return None
189855
public static function getResource($name, $module, $asFile)
    {
        $config = $module->getConfig();
        $folders = $config['app']['resources'];
        if (!is_array($folders)) {
            $folders = array($folders);
        }
        if (substr($name, 0, 1) == "/") {
            $name = substr($name, 1);
        }
        foreach ($folders as $folder) {
            $path = $module->getDirectory() . ($folder == ""?"":'/' . $folder) . '/' . $name;
            if (file_exists($path)) {
//                $path = realpath($path);
                if ($asFile) {
                    return $path;
                }
                if(substr($path, 0, 1) === ".") {
                    $path = substr($path, 1);
                }
                //$base = realpath($module->getDirectory());
                //$index = strpos($path, $base);
                $url = Bootstrap::getSingleton()->toUrl($path);
                $protocol = 'http';
                if (isset($_SERVER['SCRIPT_URI']) && strpos($_SERVER['SCRIPT_URI'], 'https') !== false) {
                    $protocol = 'https';
                }

                return $protocol . '://' . $_SERVER['HTTP_HOST'] . $url;
            }
        }
        if($module !== ModuleManager::getInstance()->getMainModule()) {
            return self::getResource($name, ModuleManager::getInstance()->getMainModule(), $asFile);
        }
        return false;
    }
211172
def _load_from_module(module):
    
    settings = OrderedDict()

    for key in dir(module):
        if key.isupper():
            settings[key] = getattr(module, key)
    return settings
1297917
def load_module(self, module):
        '''
        
        '''
        m_ref = self._modules_map.get(module)
        if m_ref is None:
            raise LoaderError('Module "{0}" was not found'.format(module))
        mod = importlib.import_module('ansible.modules{0}'.format(
            '.'.join([elm.split('.')[0] for elm in m_ref.split(os.path.sep)])))

        return mod
964769
def get_module(self):
        
        for md in SUPPORTED_MODULES:
            maybe_module = self.get_child_by_name(md)
            if maybe_module:
                # No probability of a placeable having more than one module
                return maybe_module
        return None
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
678888
def get_version_from_module(module):
    """"""
    if module is not None:
        # Setup.py will not pass in a module, but creating __version__ from
        # __init__ will.
        module = str(module).split('.', 1)[0]
        try:
            package = pkg_resources.get_distribution(module)
            return package.version
        except pkg_resources.DistributionNotFound:
            # So there you have it the module is not installed.
            pass
981664
def get(self, resource, params=None, headers=None):
        
        return self.do(resource, 'GET', params=params, headers=headers)
447556
def _get_module_path(name, fail=False, install_path=None):
    
    import imp

    module = imp.find_module(name)
    if not module and fail:
        raise RuntimeError("can't find module '" + name + "'")
    path = module[1]
    if not path and fail:
        raise RuntimeError("module '" + name + "' is missing a file path")
    
    if install_path:
        return os.path.join(install_path, os.path.split(path)[1])

    return path
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
1284819
def find_module(self, fullname, path=None):
        
        if fullname.startswith('pygal.maps.') and hasattr(
                maps, fullname.split('.')[2]):
            return self
        return None