Check if the path matches at least one of the provided patterns.
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
1204066
def _find_paths(self, current_dir, patterns):
        """"""
        pattern = patterns[0]
        patterns = patterns[1:]
        has_wildcard = is_pattern(pattern)
        using_globstar = pattern == "**"

        # This avoids os.listdir() for performance
        if has_wildcard:
            entries = [x.name for x in scandir(current_dir)]
        else:
            entries = [pattern]

        if using_globstar:
            matching_subdirs = map(lambda x: x[0], walk(current_dir))
        else:
            subdirs = [e for e in entries
                       if os.path.isdir(os.path.join(current_dir, e))]
            matching_subdirs = match_entries(subdirs, pattern)

        # For terminal globstar, add a pattern for all files in subdirs
        if using_globstar and not patterns:
            patterns = ['*']

        if patterns:  # we've still got more directories to traverse
            for subdir in matching_subdirs:
                absolute_path = os.path.join(current_dir, subdir)
                for match in self._find_paths(absolute_path, patterns):
                    yield match

        else:  # we've got the last pattern
            if not has_wildcard:
                entries = [pattern + '.wsp', pattern + '.wsp.gz']
            files = [e for e in entries
                     if os.path.isfile(os.path.join(current_dir, e))]
            matching_files = match_entries(files, pattern + '.*')

            for _basename in matching_files + matching_subdirs:
                yield os.path.join(current_dir, _basename)
54988
def match_pattern(self, path):
        
        for pattern in self.__pattern:
            if len(fnmatch.filter([path], pattern)) > 0:
                return True
        return False
1197321
def match(self, path_pattern):
        
        cf = self._flavour.casefold
        path_pattern = cf(path_pattern)
        drv, root, pat_parts = self._flavour.parse_parts((path_pattern,))
        if not pat_parts:
            raise ValueError("empty pattern")
        if drv and drv != cf(self._drv):
            return False
        if root and root != cf(self._root):
            return False
        parts = self._cparts
        if drv or root:
            if len(pat_parts) != len(parts):
                return False
            pat_parts = pat_parts[1:]
        elif len(pat_parts) > len(parts):
            return False
        for part, pat in zip(reversed(parts), reversed(pat_parts)):
            if not fnmatch.fnmatchcase(part, pat):
                return False
        return True
433582
def filter_paths(pathnames, patterns=None, ignore_patterns=None):
    """"""
    result = []
    if patterns is None:
        patterns = ['*']
    if ignore_patterns is None:
        ignore_patterns = []
    for pathname in pathnames:
        if match_patterns(pathname, patterns) and not match_patterns(pathname, ignore_patterns):
            result.append(pathname)
    return result
61554
public static boolean match(String filePath, String patternPath) {
    return match(new AlluxioURI(filePath), new AlluxioURI(patternPath));
  }
548674
private function matchByRegex(string $pattern, string $path): array
    {
        $isPatternMatched = (bool) \preg_match_all("~^$pattern$~", $path, $matches);

        if (!$isPatternMatched) {
            return [$isPatternMatched, []];
        }

        foreach ($matches as $k => $match) {
            $match = \array_shift($match);
            if (\is_int($k) || empty($match)) {
                unset($matches[$k]);
                continue;
            }
            $matches[$k] = $match;
        }

        return [$isPatternMatched, $matches];
    }
1104199
def matches_pattern(self, other):
        """"""
        if hasattr(other, 'messageType'):
            messageTypeIsEqual = False
            if self.messageType is None or other.messageType is None:
                messageTypeIsEqual = True
            else:
                messageTypeIsEqual = (self.messageType == other.messageType)
            extendedIsEqual = False
            if self.extended is None or other.extended is None:
                extendedIsEqual = True
            else:
                extendedIsEqual = (self.extended == other.extended)
            return messageTypeIsEqual and extendedIsEqual
        return False
432300
def isignored(self, relpath, directory=False):
    """"""
    relpath = self._relpath_no_dot(relpath)
    if directory:
      relpath = self._append_trailing_slash(relpath)
    return self.ignore.match_file(relpath)
519919
public final boolean matches(@NotNull final String targetPath) {
        Contract.requireArgNotNull("targetPath", targetPath);
        if (regExpr == null) {
            return true;
        }
        return regExpr.matcher(targetPath).find();
    }
343484
def check_next_match(self, match, new_relations, subject_graph, one_match):
        """"""
        if not CustomPattern.check_next_match(self, match, new_relations, subject_graph, one_match):
            return False
        if self.strong:
            # can this ever become a strong ring?
            vertex1_start = match.forward[self.pattern_graph.central_vertex]
            for vertex1 in new_relations.values():
                paths = list(subject_graph.iter_shortest_paths(vertex1, vertex1_start))
                if self.size % 2 == 0 and len(match) == self.size:
                    if len(paths) != 2:
                        #print "NRingPattern.check_next_match: not strong a.1"
                        return False
                    for path in paths:
                        if len(path) != len(match)//2+1:
                            #print "NRingPattern.check_next_match: not strong a.2"
                            return False
                else:
                    if len(paths) != 1:
                        #print "NRingPattern.check_next_match: not strong b.1"
                        return False
                    if len(paths[0]) != (len(match)+1)//2:
                        #print "NRingPattern.check_next_match: not strong b.2"
                        return False
            #print "RingPattern.check_next_match: no remarks"
        return True
530005
function (value, pattern) {
        try {
            checkSubtree(value, pattern);
            return true;
        } catch (e) {
            if (e instanceof Match.Error)
                return false;
            // Rethrow other errors.
            throw e;
        }
    }
743745
def is_excluded(self, path, exclude=None):
        
        for pattern in (exclude or self.exclude_pattern):
            if path.match(pattern):
                return True
        else:
            return False
545454
def match(self, files):
        """"""
        if not files:
            return set()

        if (self.matched_inherit.all_files()
                or self.matched_and_subdir.all_files()
                or self.matched_no_subdir.all_files()):
            # Optimization: one of the matched patterns matches everything
            # So simply return it
            return set(files)

        unmatched = set(files)
        matched = set()
        for pattern_set in self._matching_pattern_sets():
            pattern_set.match_files(matched, unmatched)
            if not unmatched:
                # Optimization: If we have matched all files already
                # simply return at this point - nothing else to do
                break

        return matched
502464
private boolean matchesPath(String routePath, String pathToMatch) {
        routePath = PathKit.VAR_REGEXP_PATTERN.matcher(routePath).replaceAll(PathKit.VAR_REPLACE);
        return pathToMatch.matches("(?i)" + routePath);
    }
251159
def _is_pattern_match(re_pattern, s):
    """"""
    match = re.match(re_pattern, s, re.I)
    return match.group() == s if match else False
260095
public static int matchPathOne(String platformDependentPath, String... patterns) {
		for (int i = 0; i < patterns.length; i++) {
			if (matchPath(platformDependentPath, patterns[i])) {
				return i;
			}
		}
		return -1;
	}