Return true if filename matches any of exclusions.
172087
def _is_excluded(filename, exclusions):
    """"""
    for exclusion in exclusions:
        if fnmatch(filename, exclusion):
            return True

    return False
71982
def should_exclude(self, filename) -> bool:
        
        for skip_glob in self.skip_globs:
            if self.filename_matches_glob(filename, skip_glob):
                return True
        return False
931747
def _is_skippable(filename_full):
    """"""

    # File types
    if not Settings.follow_symlinks and os.path.islink(filename_full):
        return True
    if os.path.basename(filename_full) == timestamp.RECORD_FILENAME:
        return True
    if not os.path.exists(filename_full):
        if Settings.verbose:
            print(filename_full, 'was not found.')
        return True

    return False
719137
def should_be_excluded(name, exclude_patterns):
    
    for pattern in exclude_patterns:
        if fnmatch.fnmatch(name, pattern):
            return True
    return False
143
def match_files(self, matched, unmatched):
        """"""
        for pattern in self.iter():
            pattern.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
180658
def excluded?(filename)
      exclude.each do |f|
        f += '**/*' if f.end_with? '/'
        return true if File.fnmatch(f, filename, File::FNM_EXTGLOB | File::FNM_PATHNAME)
      end
      false
    end
1053272
private boolean contentsExcluded(String name) {
        name = (name.endsWith(File.separator)) ? name : name + File.separator;
        for (int i = 0; i < excludes.length; i++) {
            String e = excludes[i];
            if (e.endsWith("**") && SelectorUtils.matchPath(
                e.substring(0, e.length() - 2), name, isCaseSensitive())) {
                return true;
            }
        }
        return false;
    }
821979
def should_skip(filename, config, path='/'):
    """"""
    for skip_path in config['skip']:
        if posixpath.abspath(posixpath.join(path, filename)) == posixpath.abspath(skip_path.replace('\\', '/')):
            return True

    position = os.path.split(filename)
    while position[1]:
        if position[1] in config['skip']:
            return True
        position = os.path.split(position[0])

    for glob in config['skip_glob']:
        if fnmatch.fnmatch(filename, glob):
            return True

    return False
1124555
def match_files(files, pattern: Pattern):
    """"""

    for name in files:
        if re.match(pattern, name):
            yield name
1234135
private boolean matchesIncludes( final String fileName )
    {
        if( m_includes.length == 0 )
        {
            return true;
        }
        for( Pattern include : m_includes )
        {
            if( include.matcher( fileName ).matches() )
            {
                return true;
            }
        }
        return false;
    }
822632
def file_should_be_skipped(
    filename: str,
    config: Mapping[str, Any],
    path: str = ''
) -> bool:
    """"""
    os_path = os.path.join(path, filename)

    normalized_path = os_path.replace('\\', '/')
    if normalized_path[1:2] == ':':
        normalized_path = normalized_path[2:]

    if path and config['safety_excludes']:
        check_exclude = '/' + filename.replace('\\', '/') + '/'
        if path and os.path.basename(path) in ('lib', ):
            check_exclude = '/' + os.path.basename(path) + check_exclude
        if safety_exclude_re.search(check_exclude):
            return True

    for skip_path in config['skip']:
        if posixpath.abspath(normalized_path) == posixpath.abspath(skip_path.replace('\\', '/')):
            return True

    position = os.path.split(filename)
    while position[1]:
        if position[1] in config['skip']:
            return True
        position = os.path.split(position[0])

    for glob in config['skip_glob']:
        if fnmatch.fnmatch(filename, glob) or fnmatch.fnmatch('/' + filename, glob):
            return True

    if not (os.path.isfile(os_path) or os.path.isdir(os_path) or os.path.islink(os_path)):
        return True

    return False
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
218246
def fpath_has_ext(fname, exts, case_sensitive=False):
    
    fname_ = fname.lower() if not case_sensitive else fname
    if case_sensitive:
        ext_pats = ['*' + ext for ext in exts]
    else:
        ext_pats = ['*' + ext.lower() for ext in exts]
    return any([fnmatch.fnmatch(fname_, pat) for pat in ext_pats])
268891
def _filter(self, filename):
        
        return self.name_filter is not None and re.search(self.name_filter, filename) is None
1023901
def exclude_file(self, file):
        """"""
        for pattern in self.compiled_exclude_files:
            if (pattern.match(file)):
                return(True)
        return(False)
722373
def match_filenames(filenames, pattern):
    """"""
    matching = []

    for filename in filenames:
        if fnmatch(get_filebase(filename, pattern), globify(pattern)):
            matching.append(filename)

    return matching
112420
def should_ignore(self, filename):
        """"""
        _, ext = os.path.splitext(filename)
        return ext in self.ignored_file_extensions