Create a filter from the extensions and ignore files
330355
def _chunk_filter(self, extensions):
        
        if isinstance(extensions, six.string_types):
            extensions = extensions.split()

        def _filter(chunk):
            """ Exclusion filter """
            name = chunk['name']
            if extensions is not None:
                if not any(name.endswith(e) for e in extensions):
                    return False
            for pattern in self.state.ignore_re:
                if pattern.match(name):
                    return False
            for pattern in self.state.ignore:
                if fnmatch.fnmatchcase(name, pattern):
                    return False
            return True
        return _filter
211035
function filterRepresented(modules, files, options) {
    return _.filter(modules, function(module) {
      return !_.some(files, function(file) {
        // Look for the module name somewhere in the source path
        return (
          path
            .join(sep, options.srcPrefix, file.src.replace(rmain, '$1'), sep)
            .indexOf(sep + module + sep) > -1
        )
      })
    })
  }
780020
def set_exclude_filters(self, exclude_filters):
        '''
        
        '''
        self._exclude_filters = exclude_filters
        self.require_module = False
        for exclude_filter in exclude_filters:
            if not exclude_filter.is_path:
                self.require_module = True
                break
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
301272
function (dir, filelist, extensions, ignore) {
    const files = fs.readdirSync(dir);
    filelist = filelist || [];
    files.forEach(function (file) {
        const ext = fileExtension(file);
        if (ignore.indexOf(ext) === -1) {
            if (fs.statSync(path.resolve(dir, file)).isDirectory()) {
                filelist = walkSync(path.join(dir, file, "/"), filelist, extensions, ignore);
            }
            else {
                if (extensions.indexOf(ext) !== -1) {
                    filelist.push(path.join(dir, file));
                }
            }
        }
    });
    return filelist;
}
89747
function excludeFiles(list, regex) {
        var ret = [];
        for (var i=0; i < list.length; i++) {
            if (!regex.test(list[i].dst)) {
                ret.push(list[i]);
            }
        }
        return ret;
    }
849119
def filter_files(self, path):
        
        excludes = r'|'.join([fnmatch.translate(x) for x in self.project.EXCLUDES]) or r'$.'
        for root, dirs, files in os.walk(path, topdown=True):
            dirs[:] = [d for d in dirs if not re.match(excludes, d)]
            dirs[:] = [os.path.join(root, d) for d in dirs]
            rel_path = os.path.relpath(root, path)

            paths = []
            for f in files:
                if rel_path == '.':
                    file_path = f
                else:
                    file_path = os.path.join(rel_path, f)
                if not re.match(excludes, file_path):
                    paths.append(f)

            files[:] = paths
            yield root, dirs, files
1369994
function ignore(fileMeta, opts) {
    if (typeof opts.ignore === 'function') {
        return opts.ignore(fileMeta, opts);
    }

    if (typeof opts.ignore === 'string' || Array.isArray(opts.ignore)) {
        return micromatch.any(fileMeta.sourceValue, opts.ignore);
    }

    return false;
}
1157853
def add_filter(filter = nil, &block)
      id = "#{filter.inspect}/#{block.inspect}".hash

      @filters[id] = if filter.kind_of?(Filter)
                       filter
                     elsif filter.kind_of?(String)
                       StringFilter.new(filter)
                     elsif filter.kind_of?(Regexp)
                       RegexpFilter.new(filter)
                     elsif block
                       BlockFilter.new(block)
                     else
                       raise ArgumentError, 'Please specify either a string, ' \
                         'filter, or block to filter source files with!'
                     end

      true
    end
113709
private void createFileFilter()
	{
		HashMap<String, String[]> extensionMap = MultimediaContainerManager.getSupportedFileExtensionsPerContainer();
		
		ArrayList<FileFilter> chooserFilterArray = new ArrayList<FileFilter>(extensionMap.size() + 1);

		// add all single file extensions grouped by container
		Set<String> containerNameSet = extensionMap.keySet();
		Iterator<String> containerNameIterator = containerNameSet.iterator();
		while (containerNameIterator.hasNext())
		{
			String containerName = containerNameIterator.next();
			String [] extensions = extensionMap.get(containerName);
			StringBuilder fileText = new StringBuilder(containerName);
			fileText.append(" (");
			int ende = extensions.length-1;
			for (int i=0; i<=ende; i++)
			{
				fileText.append("*.").append(extensions[i]);
				if (i<ende) fileText.append(", ");
			}
			fileText.append(')');
			chooserFilterArray.add(new FileChooserFilter(extensions, fileText.toString()));
		}
		// now add playlist as group of files
		chooserFilterArray.add(PlayList.PLAYLIST_FILE_FILTER);

		// now add all playable files at the last step (container extensions and playlist files)
		String [] containerExtensions = MultimediaContainerManager.getSupportedFileExtensions();
		String [] fullSupportedExtensions = new String[containerExtensions.length + PlayList.SUPPORTEDPLAYLISTS.length];
		System.arraycopy(PlayList.SUPPORTEDPLAYLISTS, 0, fullSupportedExtensions, 0, PlayList.SUPPORTEDPLAYLISTS.length);
		System.arraycopy(containerExtensions, 0, fullSupportedExtensions, PlayList.SUPPORTEDPLAYLISTS.length, containerExtensions.length);
		chooserFilterArray.add(new FileChooserFilter(fullSupportedExtensions, "All playable files"));
		// add default "all files" - WE DO NOT DO THAT ANYMORE ;)
//		chooserFilterArray.add(new FileChooserFilter("*", "All files"));
		
		fileFilterLoad = new FileFilter[chooserFilterArray.size()];
		chooserFilterArray.toArray(fileFilterLoad);

		fileFilterExport = new FileFilter[1];
		fileFilterExport[0] = new FileChooserFilter(javax.sound.sampled.AudioFileFormat.Type.WAVE.getExtension(), javax.sound.sampled.AudioFileFormat.Type.WAVE.toString());
	}
713832
def setup(self):
        """"""
        super(RequireJSFilter, self).setup()

        excluded_files = []
        for bundle in self.excluded_bundles:
            excluded_files.extend(
                map(lambda f: os.path.splitext(f)[0],
                    bundle.contents)
            )

        if excluded_files:
            self.argv.append(
                'exclude={0}'.format(','.join(excluded_files))
            )
734349
def get_ignorer(path, additional_exclusions=None):
    """"""
    ignorefile = zgitignore.ZgitIgnore()
    gitignore_file = os.path.join(path, '.gitignore')
    if os.path.isfile(gitignore_file):
        with open(gitignore_file, 'r') as fileobj:
            ignorefile.add_patterns(fileobj.read().splitlines())

    if additional_exclusions is not None:
        ignorefile.add_patterns(additional_exclusions)

    return ignorefile
1292535
function skip() {
    rimraf(file, function() {})
    delete f.versions[v]
    if (f._attachments)
      delete f._attachments[file]
    need.splice(need.indexOf(v), 1)
    maybeDone(null)
  }
435238
function filterFiles(files, check) {
	return files.filter(function(file) {
		if (typeof check == 'string') {
			// ignore typecase equal
			return check.toLowerCase() === file.toLowerCase();
		} else if (Util.isRegExp(check)) {
			// regexp test
			return check.test(file);
		} else if (typeof check == 'function') {
			// function callback
			return check(file);
		}
	});
}
970411
function filterIgnored(files, ignore, fn) {
  fn(null, files.filter(function(file) {
    // TODO make more robust
    return !~ignore.indexOf(file) && !~ignore.indexOf(file + '/');
  }));
}
490956
function filterFiles(files, validExtensions) {
    const accepted = [];

    for (const fileName of files) {
        if (accepted.indexOf(fileName) === -1 && fileMatchesExtension(fileName, validExtensions)) {
            accepted.push(fileName);
        }
    }

    return accepted;
}
1209318
function createPatternFilter(ignoreFile) {
    return function (pattern) {
        var patternVariations = createPatternVariations(pattern);

        // Loop through patterns in .npmignore and try to find duplicates
        var duplicates = patternVariations.filter(function (patternVar) {
            return ignoreFile.patterns.indexOf(patternVar) !== -1;
        });

        return !duplicates.length;
    };
}