Given
 @param [MatchData] match
 @param [String] path
 @return [String] full absolute key name with scope resolved if any
429074
def match_to_key(match, path, location)
      key   = super
      scope = match[1]
      if scope
        scope_parts = extract_literal_or_array_of_literals(scope)
        return nil if scope_parts.nil? || scope_parts.empty?
        "#{scope_parts.join('.')}.#{key}"
      else
        key unless match[0] =~ /\A\w/
      end
    end
69019
def all(path, type)
      defaults = {}
      old_scope = nil
      matching_sets(path, type).each do |set|
        if has_precedence?(old_scope, set["scope"])
          defaults = Utils.deep_merge_hashes(defaults, set["values"])
          old_scope = set["scope"]
        else
          defaults = Utils.deep_merge_hashes(set["values"], defaults)
        end
      end
      defaults
    end
1165532
def match_path_extname(path, extensions)
      basename = File.basename(path)

      i = basename.index('.'.freeze)
      while i && i < basename.length - 1
        extname = basename[i..-1]
        if value = extensions[extname]
          return extname, value
        end

        i = basename.index('.'.freeze, i+1)
      end

      nil
    end
865818
public Map.Entry getMatch(String path)
    {
        Map.Entry entry;

        if (path==null)
            return null;
        
        int l=path.indexOf(';');
        if (l<0)
        {
            l=path.indexOf('?');
            if (l<0)
                l=path.length();
        }

        // try exact match
        entry=_exactMap.getEntry(path,0,l);
        if (entry!=null)
            return (Map.Entry) entry.getValue();
        
        // prefix search
        int i=l;
        while((i=path.lastIndexOf('/',i-1))>=0)
        {
            entry=_prefixMap.getEntry(path,0,i);
            if (entry!=null)
                return (Map.Entry) entry.getValue();
        }
        
        // Prefix Default
        if (_prefixDefault!=null)
            return _prefixDefault;
        
        // Extension search
        i=0;
        while ((i=path.indexOf('.',i+1))>0)
        {
            entry=_suffixMap.getEntry(path,i+1,l-i-1);
            if (entry!=null)
                return (Map.Entry) entry.getValue();
        }        
        
        // Default
        return _default;
    }
100035
def match(path, glob):
    
    path_len = len(path)
    glob_len = len(glob)

    ss = -1
    ss_glob = glob
    if '**' in glob:
        ss = glob.index('**')
        if '**' in glob[ss + 1:]:
            raise dpath.exceptions.InvalidGlob("Invalid glob. Only one '**' is permitted per glob.")

        if path_len >= glob_len:
            # Just right or more stars.
            more_stars = ['*'] * (path_len - glob_len + 1)
            ss_glob = glob[:ss] + more_stars + glob[ss + 1:]
        elif path_len == glob_len - 1:
            # Need one less star.
            ss_glob = glob[:ss] + glob[ss + 1:]

    if path_len == len(ss_glob):
        # Python 3 support
        if PY3:
            return all(map(fnmatch.fnmatch, list(map(str, paths_only(path))), list(map(str, ss_glob))))
        else: # Default to Python 2
            return all(map(fnmatch.fnmatch, map(str, paths_only(path)), map(str, ss_glob)))

    return False
1334189
def _get_path_params(match):
    
    result = {}
    for var_name, value in match.groupdict().iteritems():
      actual_var_name = ApiConfigManager._from_safe_path_param_name(var_name)
      result[actual_var_name] = urllib.unquote_plus(value)
    return result
92407
function match(path) {
    if (path.indexOf(prefix) !== 0) {
      return false;
    }

    const newPath = path.replace(prefix, '') || '/';
    if (trailingSlash) {
      return newPath;
    }

    if (newPath[0] !== '/') {
      return false;
    }

    return newPath;
  }
1340948
def match_path(entry, opts):
    """"""
    if entry.name in ALWAYS_OMIT:
        return False
    # TODO: currently we use fnmatch syntax and match against names.
    # We also might allow glob syntax and match against the whole relative path instead
    # path = entry.get_rel_path()
    path = entry.name
    ok = True
    match = opts.get("match")
    exclude = opts.get("exclude")
    if entry.is_file() and match:
        assert type(match) is list
        ok = False
        for pat in match:
            if fnmatch.fnmatch(path, pat):
                ok = True
                break
    if ok and exclude:
        assert type(exclude) is list
        for pat in exclude:
            if fnmatch.fnmatch(path, pat):
                ok = False
                break
    # write("match", ok, entry)
    return ok
537685
def select_matching_file_patterns(patterns, path)
      patterns.select do |pattern|
        if pattern.is_a?(Regexp)
          path.to_s.match(pattern)
        else
          flags = File::FNM_PATHNAME
          flags |= File::FNM_DOTMATCH if include_hidden_files?
          File.fnmatch(pattern, path, flags)
        end
      end
    end
488934
def check_path_matches_patterns(path, patterns):
    '''  '''
    path = os.path.abspath(path)
    for patt in patterns:
        if isinstance(patt, six.string_types):
            if path == patt:
                return True
        elif patt.search(path):
            return True
    return False
1204979
def file_match(file)
      raise ArgumentError, "Filename cannot be nil" if file.nil?
      { filename: file, matched: file, line: 1, column: 1 }
    end
291079
public PathMatcher.PathMatch<T> match(String path){
		if (!exactPathMatches.isEmpty()) {
			T match = getExactPath(path);
			if (match != null) {
				UndertowLogger.REQUEST_LOGGER.debugf("Matched exact path %s", path);
				return new PathMatcher.PathMatch<>(path, "", match);
			}
		}

		int length = path.length();
		final int[] lengths = this.lengths;
		for (int i = 0; i < lengths.length; ++i) {
			int pathLength = lengths[i];
			if (pathLength == length) {
				SubstringMap.SubstringMatch<T> next = paths.get(path, length);
				if (next != null) {
					UndertowLogger.REQUEST_LOGGER.debugf("Matched prefix path %s for path %s", next.getKey(), path);
					return new PathMatcher.PathMatch<>(path, "", next.getValue());
				}
			} else if (pathLength < length) {
				char c = path.charAt(pathLength);
				if (c == '/') {

					//String part = path.substring(0, pathLength);
					SubstringMap.SubstringMatch<T> next = paths.get(path, pathLength);
					if (next != null) {
						UndertowLogger.REQUEST_LOGGER.debugf("Matched prefix path %s for path %s", next.getKey(), path);
						return new PathMatcher.PathMatch<>(next.getKey(), path.substring(pathLength), next.getValue());
					}
				}
			}
		}
		UndertowLogger.REQUEST_LOGGER.debugf("Matched default handler path %s", path);
		return new PathMatcher.PathMatch<>("", path, defaultHandler);
	}
356688
def lookup(self, path_info: str) -> MatchResult:
        
        for name, pattern in self.patterns.items():
            match = pattern.match(path_info)
            if match is None:
                continue
            match.name = name
            return match
        return None
301068
function matches (path) {
      if (type(ignores) === TYPES.STRING) {
        return path.search(ignores) > -1;
      } else if (type(ignores) === TYPES.REGEXP) {
        return ignores.test(path);
      } else {
        return ignores.some(function (ignore) {
          return type(ignore) === TYPES.STRING ? (path.search(ignore) > -1) : ignore.test(path);
        });
      }
    }
722053
public boolean matches(String path) {
        List<String> segments;

        segments = Filesystem.SEPARATOR.split(path);
        if (segments.size() < minDepth || segments.size() > maxDepth) {
            return false;
        }
        if (predicates.size() > 0) {
            throw new UnsupportedOperationException("cannot match with predicates");
        }
        return matches(0, segments, new ArrayList<>(includes), new ArrayList<>(excludes));
    }
860889
def match_path_to_api_path(path_definitions, target_path, base_path='',
                           context=None):
    
    if context is None:
        context = {}
    assert isinstance(context, collections.Mapping)
    if target_path.startswith(base_path):
        # Convert all of the api paths into Path instances for easier regex
        # matching.
        normalized_target_path = re.sub(NORMALIZE_SLASH_REGEX, '/',
                                        target_path)
        matching_api_paths = list()
        matching_api_paths_regex = list()
        for p, v in path_definitions.items():
            # Doing this to help with case where we might have base_path
            # being just /, and then the path starts with / as well.
            full_path = re.sub(NORMALIZE_SLASH_REGEX, '/', base_path + p)
            r = path_to_regex(
                api_path=full_path,
                path_parameters=extract_path_parameters(v),
                operation_parameters=extract_operation_parameters(v),
                context=context,
            )
            if full_path == normalized_target_path:
                matching_api_paths.append(p)
            elif r.match(normalized_target_path):
                matching_api_paths_regex.\
                    append((p, r.match(normalized_target_path)))

        # Keep it consistent with the previous behavior
        target_path = target_path[len(base_path):]
    else:
        matching_api_paths = []
        matching_api_paths_regex = []

    if not matching_api_paths and not matching_api_paths_regex:
        fstr = MESSAGES['path']['no_matching_paths_found'].format(target_path)
        raise LookupError(fstr)
    elif len(matching_api_paths) == 1:
        return matching_api_paths[0]
    elif len(matching_api_paths) > 1:
        raise MultiplePathsFound(
            MESSAGES['path']['multiple_paths_found'].format(
                target_path, [v[0] for v in matching_api_paths],
            )
        )
    elif len(matching_api_paths_regex) == 1:
        return matching_api_paths_regex[0][0]
    elif len(matching_api_paths_regex) > 1:
        # TODO: This area needs improved logic.
        # We check to see if any of the matched paths is longers than
        # the others.  If so, we *assume* it is the correct match.  This is
        # going to be prone to false positives. in certain cases.
        matches_by_path_size = collections.defaultdict(list)
        for path, match in matching_api_paths_regex:
            matches_by_path_size[len(path)].append(path)
        longest_match = max(matches_by_path_size.keys())
        if len(matches_by_path_size[longest_match]) == 1:
            return matches_by_path_size[longest_match][0]
        raise MultiplePathsFound(
            MESSAGES['path']['multiple_paths_found'].format(
                target_path, [v[0] for v in matching_api_paths_regex],
            )
        )
    else:
        return matching_api_paths_regex[0][0]
557724
def find(pattern)
      patterns= [pattern].flatten
      contents=[]
      self.each_pair do |path, content|
        patterns.each do |pattern|
          contents << content if Content.path_match? path, pattern
        end
      end
      contents
    end