Searches for a file providing given module.

        Returns the normalized module id and path of the file.
2777
def lookup(self, module_name):
        
        for search_path in self._paths:
            module_path = os.path.join(search_path, module_name)
            new_module_name, module_file = self._lookup(module_path, module_name)
            if module_file:
                return new_module_name, module_file
        return None, None
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
65321
def get_path(*args, module=a99):
    

    p = os.path.abspath(os.path.join(os.path.split(module.__file__)[0], *args))
    return p
239809
function(str){
    var match = str.split(':');

    var module_id = match[0];
    var module_instance = match[1];

    var instance = [];

    if(this.sid && this.options.instance_through) instance.push(this.sid);
    if(this.instance && this.options.instance_through) instance.push(this.instance);
    if(module_instance) instance.push(module_instance);

    var info = {
      filename: mid.path(module_id, this.options),
      instance: instance.join('-')
    };

    return info;
  }
668329
function _getModule (moduleElement) {
    var id = moduleElement.getAttribute('id');
    var dir = moduleElement.getAttribute('dir');
    var name = moduleElement.getAttribute('name');
    var fileSets = domutils.getChild(moduleElement, 'desc', 'fileSets');
    var modules = domutils.getChild(moduleElement, 'desc', 'modules');
    var module = { id: id, dir: dir, name: name, fileSets: [], modules: [] };
    if (fileSets !== undefined) {
      var fileSetElements = domutils.selectMatchingXPath('desc:fileSet', fileSets);
      var numFileSets = fileSetElements.length;
      for (var fsIdx = 0; fsIdx < numFileSets; fsIdx++) {
        module.fileSets.push(_getFileSet(fileSetElements[fsIdx]));
      }
    }
    if (modules !== undefined) {
      var moduleElements = domutils.selectMatchingXPath('desc:module', modules);
      var numModules = moduleElements.length;
      for (var mIdx = 0; mIdx < numModules; mIdx++) {
        module.modules.push(_getModule(moduleElements[mIdx]));
      }
    }
    return module;
  }
200
def find_module(modpath):
    """"""
    module_path = modpath.replace('.', '/') + '.py'
    init_path = modpath.replace('.', '/') + '/__init__.py'
    for root_path in sys.path:
        path = os.path.join(root_path, module_path)
        if os.path.isfile(path):
            return path
        path = os.path.join(root_path, init_path)
        if os.path.isfile(path):
            return path
846277
def find_module(cls, fullname, path=None):
        
        spec = cls.find_spec(fullname, path)
        if spec is None:
            return None
        elif spec.loader is None and spec.submodule_search_locations:
            # Here we need to create a namespace loader to handle namespaces since python2 doesn't...
            return NamespaceLoader2(spec.name, spec.submodule_search_locations)
        else:
            return spec.loader
853176
function findModulePath(request, parent) {
  var mainScriptDir = path.dirname(Module._resolveFilename(request, parent));
  var resolvedModule = Module._resolveLookupPaths(request, parent);
  var paths = resolvedModule[1];
  for (var i = 0, PL = paths.length; i < PL; i++) {
    if (mainScriptDir.indexOf(paths[i]) === 0) {
      return path.join(paths[i], request.replace('/', path.sep));
    }
  }
  return null;
}
151534
def getmoduleinfo(path):
    """"""
    filename = os.path.basename(path)
    suffixes = map(lambda (suffix, mode, mtype):
                   (-len(suffix), suffix, mode, mtype), imp.get_suffixes())
    suffixes.sort() # try longest suffixes first, in case they overlap
    for neglen, suffix, mode, mtype in suffixes:
        if filename[neglen:] == suffix:
            return filename[:neglen], suffix, mode, mtype
1047495
private File locateModule(ModuleIdentifier modID) {
    File modDir = new File(modRoot, modID.toString());
    if (modDir.exists()) {
      return modDir;
    }
    return null;
  }
793809
def scan_file(pym, filename, sentinel, installed):
    '''
    '''
    if not utils.is_python_script(filename):
        return

    if not pym:
        # This is for finding a previously created instance, not finding an
        # installed module with the same name. Might need to base the name
        # on the actual paths to reduce ambiguity in the printed scan results.
        module = os.path.basename(filename)
        pym = utils.find_package(module, installed)
        if not pym:
            pym = PyModule(module, 'SCRIPT', os.path.abspath(filename))
            installed.insert(0, pym)
        else:
            pym.is_scan = True

    for imp_type, import_path, extra_file_scan in _scan_file(filename, sentinel):
        dep = utils.find_package(import_path, installed)
        if dep:
            dep.add_dependant(pym)
            pym.add_dependency(dep)

            if imp_type != 'import':
                pym.add_framework(imp_type)

        if extra_file_scan:
            # extra_file_scan should be a directory or file containing the
            # import name
            scan_filename = utils.file_containing_import(import_path, extra_file_scan)
            log.info('Related scan: %s - %s', import_path, scan_filename)
            if scan_filename.endswith('__init__.py'):
                scan_directory(pym, os.path.dirname(scan_filename), sentinel, installed)
            else:
                scan_file(pym, scan_filename, sentinel, installed)

    return pym
1277983
def find_module(self, fullname):
        

        spec = self.find_spec(fullname)
        if spec is None:
            return None

        # We need to handle the namespace case here for python2
        if spec.loader is None and len(spec.submodule_search_locations):
            spec.loader = NamespaceLoader2(spec.name, spec.submodule_search_locations)

        return spec.loader
1110242
function getModuleRequirePath(moduleName) {
  return moduleName[0] === '.' ?
    require.resolve(resolve(process.cwd(), moduleName)) :
    moduleName
}
573266
def _find_file(self, load):
        '''
        
        '''
        path = load.get('path')
        if not path:
            return {'path': '',
                    'rel': ''}
        tgt_env = load.get('saltenv', 'base')
        return self.find_file(path, tgt_env)
318704
function(name) {
			var match = null;
			list.forEach(function(file) {
				if(_.indexOf(file.modules, name) >= 0) {
					match = file;
					return false;
				}
			});
			return match;
		}
1142621
function getModulePath(filePath, fileName) {
    if (isJavaScript(fileName)) {
        fileName = fileName.substring(0, fileName.length - 3);
    }

    return filePath + '/' + fileName;
}
538283
def modulePath(self):
        
        base_path = os.path.dirname(self.filepath())
        module_path = self.importPath()

        module_path = os.path.expanduser(os.path.expandvars(module_path))
        if module_path.startswith('.'):
            module_path = os.path.abspath(os.path.join(base_path, module_path))

        return module_path