Returns the argument of the @import() call relative to the asset search paths.
492123
function importArgumentRelativeToSearchPaths(importer, importArgument, searchPaths) {
  var importAbsolutePath = path.resolve(path.dirname(importer), importArgument);
  var importSearchPath = _.find(searchPaths, function (path) {
    return importAbsolutePath.indexOf(path) === 0;
  });
  if (importSearchPath) {
    return path.relative(importSearchPath, importAbsolutePath);
  }
}
457638
public static Import findImportByExportingInstance( Collection<Import> imports, String exportingInstancePath ) {

		Import result = null;
		if( imports != null && exportingInstancePath != null ) {
			for( Import imp : imports ) {
				if( exportingInstancePath.equals( imp.getInstancePath())) {
					result = imp;
					break;
				}
			}
		}

		return result;
	}
1283926
def find_imports(filename):
    
    with open(filename) as f:
        root = ast.parse(f.read(), filename)
    visitor = ImportFinder(filename)
    visitor.visit(root)
    return visitor.imports
845467
function() {
        if (!this.import) {
            this._findHost = function findHostShim() {
              var current = this;
              var app;
              do {
                app = current.app || app;
              } while (current.parent.parent && (current = current.parent));
              return app;
            };
            this.import = function importShim(asset, options) {
              var app = this._findHost();
              app.import(asset, options);
            };
        }
    }
126758
private String messageImportInvalidAliasPath(Locale locale, String path) {

        return Messages.get().getBundle(locale).key(Messages.ERR_ALIAS_IMPORT_INVALID_ALIAS_PATH_0);

    }
188081
def _get_remote_import_paths(self, pkg, gopath=None):
    
    import_listing = self.import_oracle.list_imports(pkg, gopath=gopath)
    return [imp for imp in import_listing.imports
            if (not self.import_oracle.is_go_internal_import(imp) and
                # We assume relative imports are local to the package and skip attempts to
                # recursively resolve them.
                not self._is_relative(imp))]
795320
function tryParse(filePath: string, platforms: Set<string>): ?AssetPath {
  const result = parsePlatformFilePath(filePath, platforms);
  const {dirPath, baseName, platform, extension} = result;
  if (extension == null) {
    return null;
  }
  const {rootName, resolution} = parseBaseName(baseName);
  return {
    assetName: path.join(dirPath, `${rootName}.${extension}`),
    name: rootName,
    platform,
    resolution,
    type: extension,
  };
}
657885
def get_package_path(name):
    
    name = name.lower()  # use lowercase version to be safe
    # Here we're importing the module just to find it. This is worryingly
    # indirect, but it's otherwise very difficult to find the package.
    pkg = importlib.import_module(name)
    return Path(pkg.__file__).parent
1193028
function getClosestPackage(modulePath) {
  let root;
  let pkg;

  // Catch findRoot or require errors
  try {
    root = findRoot(modulePath);
    pkg = require(path.join(root, "package.json"));
  } catch (e) {
    return null;
  }

  // If the package.json does not have a name property, try again from
  // one level higher.
  // https://github.com/jsdnxx/find-root/issues/2
  // https://github.com/date-fns/date-fns/issues/264#issuecomment-265128399
  if (!pkg.name) {
    return getClosestPackage(path.resolve(root, ".."));
  }

  return {
    package: pkg,
    path: root
  };
}
413559
function fetchFilePathsByType(distFiles, basePath, type) {
  return distFiles
    .filter(function(filePath) {
      return new RegExp('assets/.*\\.' + type + '$').test(filePath);
    })
    .map(function(filePath) {
      return path.join(basePath, filePath);
    });
}
609207
function assetHashPath(url) {
  const parsedUrl = path.parse(url.getValue());
  const asset = manifest.getAssetValue(parsedUrl.base);
  return compiler.types.String('url("' + asset + '")');
}
327079
def file_containing_import(import_path, import_root):
    '''
    '''
    if not _import_paths:
        load_stdlib()

    if os.path.isfile(import_root):
        import_root = os.path.dirname(import_root)

    search_paths = [import_root] + _import_paths
    module_parts = import_path.split('.')
    for i in range(len(module_parts), 0, -1):
        module_path = os.path.join(*module_parts[:i])
        for sp in search_paths:
            p = os.path.join(sp, module_path)
            if os.path.isdir(p):
                return os.path.join(p, '__init__.py')
            elif os.path.isfile(p + '.py'):
                return p + '.py'
    return None
28389
def fileImport(filepath, ignore=None):
        
        basepath, package = EnvManager.packageSplit(filepath)
        if not (basepath and package):
            return None

        # make sure this is not part of the ignored package list
        if ignore and package in ignore:
            return None

        basepath = os.path.normcase(basepath)
        if basepath not in sys.path:
            sys.path.insert(0, basepath)

        logger.debug('Importing: %s' % package)

        try:
            __import__(package)
            module = sys.modules[package]
        except ImportError:
            logger.exception('ImportError: %s' % package)
            return None
        except KeyError:
            logger.exception('Could not find sys.modules package: %s' % package)
            return None
        except StandardError:
            logger.exception('Unknown error occurred not import %s' % package)
            return None

        return module
64106
function resolveModulePath(relativeToFile, modulePath) {
  if (!isLocalModule(modulePath)) {
    return modulePath;
  }

  const alias = getModuleResolverAlias();
  const matched = _.find(_.keys(alias), k => _.startsWith(modulePath, k));

  let res = null;
  if (matched) {
    const resolveTo = alias[matched];
    const relativePath = modulePath.replace(new RegExp(`^${matched}`), '').replace(/^\//, '');
    res = paths.map(resolveTo, relativePath);
    // res = utils.joinPath(utils.getProjectRoot(), resolveTo, relativePath);
  } else {
    res = paths.join(path.dirname(relativeToFile), modulePath);
  }

  let relPath = res.replace(paths.getProjectRoot(), '').replace(/^\/?/, '');
  if (vio.dirExists(relPath)) {
    // if import from a folder, then resolve to index.js
    relPath = paths.join(relPath, 'index');
  }
  return relPath;
}
128329
def import_path(self):
    """"""
    return os.path.join(self.remote_root, self.pkg) if self.pkg else self.remote_root
409282
async function importEnvironmentVariablesFromJSFile(from) {
	const object = await import(path.resolve(from));

	return importEnvironmentVariablesFromObject(object);
}
742630
public static function getResourcePath($path)
    {
        if (self::$importPaths === null) {
            self::$importPaths = self::explodeIncludePath();
        }

        $path = str_replace(array('\\', '/'), DIRECTORY_SEPARATOR, $path);

        foreach (self::$importPaths as $prefix) {
            $testPath = $prefix . DIRECTORY_SEPARATOR . $path;
            if (file_exists($testPath)) {
                return $testPath;
            }
        }

        // Check for the property phing.home
        $homeDir = self::getProperty(self::PHING_HOME);
        if ($homeDir) {
            $testPath = $homeDir . DIRECTORY_SEPARATOR . $path;
            if (file_exists($testPath)) {
                return $testPath;
            }
        }

        // Check for the phing home of phar archive
        if (strpos(self::$importPaths[0], 'phar://') === 0) {
            $testPath = self::$importPaths[0] . '/../' . $path;
            if (file_exists($testPath)) {
                return $testPath;
            }
        }

        // Do one additional check based on path of current file (Phing.php)
        $maybeHomeDir = realpath(__DIR__ . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..');
        $testPath = $maybeHomeDir . DIRECTORY_SEPARATOR . $path;
        if (file_exists($testPath)) {
            return $testPath;
        }

        return null;
    }