/ 
Finds files for a given component url.

url:        String. In the simplest case it is a file name for a component.
options:    MPC options object.
967005
function findComponent( url, options ){

    if( url[0] === "." || url[0] === "/" ){
        
        return findRelative( url );

    } else if( url.match( /^[-_a-z0-9]+:/i )){

        return findWithFinder( url, options );

    } else {

        return findInPath( url, options );
    }
}
969089
def get_file_urls(self):
        
        if self.use_bundle:
            return [self.get_url()]
        return [bundle_file.file_url for bundle_file in self.files]
575361
def url_to_path(self, url):
        
        parts = urlsplit(url)
        try:
            loader, args = self.url_map.bind(parts.netloc).match(parts.path)
            path = args.get('path')
            if loader == 'schema' and path in self.schemas:
                return path
        except HTTPException:
            return None
283993
protected URL findResource(Klass c, String fileName) {
        boolean ends = false;
        for (String ext : allowedExtensions) {
            if (fileName.endsWith(ext)) {
                ends = true;
                break;
            }
        }
        if (!ends)  return null;

        for ( ; c!=null; c=c.getSuperClass()) {
            URL res = c.getResource(fileName);
            if (res!=null)  return res;
        }
        return null;
    }
490389
def url_to_filename(url):
    
    # remove leading/trailing slash
    if url.startswith('/'):
        url = url[1:]
    if url.endswith('/'):
        url = url[:-1]
    # remove pardir symbols to prevent unwilling filesystem access
    url = remove_pardir_symbols(url)
    # replace dots to underscore in filename part
    url = replace_dots_to_underscores_at_last(url)
    return url
451911
def find_component(name)
      Find.find(self["frameworks/projects"]) do |filename|
        break File.dirname(filename).sub(%r{.+/src/}, "").gsub("/", ".") if
          File.basename(filename).sub(/\..*/, "") == name
      end
    end
331409
private MediaType findContentType(final String url) {
        if (url == null) {
            return null;
        }

        if (url.startsWith("file")) {
            return APPLICATION_OCTET_STREAM_TYPE;
        } else if (url.startsWith("http")) {
            try (CloseableHttpClient httpClient = HttpClients.createDefault()) {
                final HttpHead httpHead = new HttpHead(url);
                try (CloseableHttpResponse response = httpClient.execute(httpHead)) {
                    if (response.getStatusLine().getStatusCode() == SC_OK) {
                        final Header contentType = response.getFirstHeader(CONTENT_TYPE);
                        if (contentType != null) {
                            return MediaType.valueOf(contentType.getValue());
                        }
                    }
                }
            } catch (final IOException e) {
                LOGGER.warn("Unable to retrieve external content from {} due to {}", url, e.getMessage());
            } catch (final Exception e) {
                throw new RepositoryRuntimeException(e);
            }
        }
        LOGGER.debug("Defaulting to octet stream for media type");
        return APPLICATION_OCTET_STREAM_TYPE;
    }
48344
function (files, component) {
            var self = this;
            return files.map(function (file) {
                return file.replace(path.normalize(self._resolvePath(component) + path.sep), '');
            });
        }
1295958
function(component) {
		
		var cid,
			foundCmp;

		if (typeof component === 'object') {
			cid = component.id();
		}
		
		foundCmp = false;
		$.each(jsCow.componentsObjectList, function(i, c) {
			if (c.id() === component) {
				foundCmp = c;
			}
		});
		
		return foundCmp;
	}
965664
def url_to_path(url):
    # type: (str) -> str
    
    assert url.startswith('file:'), (
        "You can only turn file: urls into filenames (not %r)" % url)

    _, netloc, path, _, _ = urllib_parse.urlsplit(url)

    # if we have a UNC path, prepend UNC share notation
    if netloc:
        netloc = '\\\\' + netloc

    path = urllib_request.url2pathname(netloc + path)
    return path
848181
static String expandUriComponent(String source, UriTemplateVariables uriVariables) {
		if (source == null) {
			return null;
		}
		if (source.indexOf('{') == -1) {
			return source;
		}
		Matcher matcher = NAMES_PATTERN.matcher(source);
		StringBuffer sb = new StringBuffer();
		while (matcher.find()) {
			String match = matcher.group(1);
			String variableName = getVariableName(match);
			Object variableValue = uriVariables.getValue(variableName);
			if (UriTemplateVariables.SKIP_VALUE.equals(variableValue)) {
				continue;
			}
			String variableValueString = getVariableValueAsString(variableValue);
			String replacement = Matcher.quoteReplacement(variableValueString);
			matcher.appendReplacement(sb, replacement);
		}
		matcher.appendTail(sb);
		return sb.toString();
	}
705661
def url(options = {})
      image = image_file

      raise MissingImageFileError, "Missing image file for #{inspect}" if image.nil?

      image = processed_image(image, options)
      image = encoded_image(image, options)

      image.url(options.except(*TRANSFORMATION_OPTIONS).merge(name: name))
    rescue MissingImageFileError, WrongImageFormatError => e
      log_warning e.message
      nil
    end
1121238
function findInLocal(url, mockFileDir) {
    var urlObject = URL.parse(url);
    var baseDir = path.resolve(process.cwd(), mockFileDir);
    return path.join(baseDir, urlObject.host, urlObject.pathname);
}
752361
def url_to_path(url):
    # type: (str) -> ByteString
    
    from .misc import to_bytes

    assert is_file_url(url), "Only file: urls can be converted to local paths"
    _, netloc, path, _, _ = urllib_parse.urlsplit(url)
    # Netlocs are UNC paths
    if netloc:
        netloc = "\\\\" + netloc

    path = urllib_request.url2pathname(netloc + path)
    return to_bytes(path, encoding="utf-8")
508518
function findImportedPath(url, prev, includedFilesMap, includedPaths) {
  let candidateFromPaths;

  if(prev !== 'stdin') {
    const prevPath = path.posix.dirname(prev);
    candidateFromPaths = [prevPath, ...includedPaths];
  } else {
    candidateFromPaths = [...includedPaths];
  }

  for(let i = 0; i < candidateFromPaths.length; i++) {
    let candidatePath;
    let candidateFromPath = normalizePath(makeAbsolute(candidateFromPaths[i]));
    if (path.isAbsolute(url)) {
      candidatePath = normalizePath(url);
    } else {
      // Get normalize absolute candidate from path
      candidatePath = path.posix.join(candidateFromPath, url);
    }

    if(includedFilesMap[candidatePath]) {
      return candidatePath;
    } else {
      let urlBasename = path.posix.basename(url);
      let indexOfBasename = url.lastIndexOf(urlBasename);
      let partialUrl = `${url.substring(0, indexOfBasename)}_${urlBasename}`;

      if (path.isAbsolute(partialUrl)) {
        candidatePath = normalizePath(partialUrl);
      } else {
        candidatePath = path.posix.join(candidateFromPath, partialUrl);
      }

      if(includedFilesMap[candidatePath]) {
        return candidatePath;
      }
    }
  }

  return null;
}
218812
function findComponent_(comp, pathFlag, bInfo, parentIdx) {
  var parentNum = parentIdx || 0; // if parentNum > 0 means access from sub level
  var wdgt = comp.widget;
  if (typeof pathFlag == 'number') {
    var iLastIdx = undefined;
    while (wdgt) {
      var comp_ = wdgt.component,
          idx = comp_ && comp_.props['for.index'];

      if (wdgt.$callspace && hasOwn_.call(wdgt.$callspace, 'flowFlag')) {
        // has callspace
        if (wdgt.$callspace.forSpace) {
          // two spaces in one comp
          if (pathFlag >= -1) {
            if (pathFlag == -1) {
              // go next segment
              if (typeof idx == 'number') iLastIdx = idx;else iLastIdx = undefined;
            } else {
              // pathFlag >= 0
              if (parentNum == 0) {
                // eval at comp directly, ignore forSpace, enter new segment // wdgt.$callspace must not $for
                if (typeof idx == 'number') iLastIdx = idx;else iLastIdx = undefined;
              }
              // else, use last segment's index
            }
            if (bInfo) {
              bInfo.unshift(pathFlag >= 0 && parentNum != 0); // true means uses forSpace
              bInfo.unshift(wdgt.$callspace);
              bInfo.unshift(iLastIdx); // last props['for.index']
            }
            return wdgt.component; // found
          } else pathFlag += 2;
        } else {
          // must not '$$for', can be $for=''
          if (pathFlag >= 0) {
            var flowFlag_ = wdgt.$callspace.flowFlag;
            if ((flowFlag_ == 'for' || flowFlag_ == 'for0') && parentNum == 0) {
              // ignore this $for callspace  // enter new segment
              if (typeof idx == 'number') iLastIdx = idx;else iLastIdx = undefined;

              wdgt = wdgt.parent;
              parentNum += 1;
              continue;
            }

            if (bInfo) {
              bInfo.unshift(false);
              bInfo.unshift(wdgt.$callspace);
              bInfo.unshift(iLastIdx); // use last segment's index
            }
            return wdgt.component; // found
          } else pathFlag += 1;
        }

        if (typeof idx == 'number') iLastIdx = idx;else iLastIdx = undefined;
      } else {
        if (iLastIdx === undefined && typeof idx == 'number') iLastIdx = idx;
      }

      wdgt = wdgt.parent;
      parentNum += 1;
    }
    return null;
  } else {
    // pathFlag must be string, no need find props['for.index']
    while (wdgt) {
      // if parentNum == 0 means find from current node
      if (wdgt.$callspace && hasOwn_.call(wdgt.$callspace, 'flowFlag')) {
        // has callspace
        if (parentNum > 0 || wdgt.$callspace.forSpace) // find from sub node, or from current node and current has two spaces ($$for)
          return getCompByPath_(wdgt.component, pathFlag); // according to nearest callspace
      }

      wdgt = wdgt.parent;
      parentNum += 1;
    }
    return null;
  }
}
605394
protected URL getNearTemplateURL(String jarFile, String template) {
        if (jarFile != null) {
            Enumeration<URL> urls = IOUtils.getResources(template);
            while (urls.hasMoreElements()) {
                URL url = urls.nextElement();
                if (url.getPath().startsWith(jarFile)) {
                    return url;
                }
            }
        }
        return null;
    }