Scans all Forge addons for files accepted by given filter, and return them as a map (from Addon to URL list)
166752
public Map<Addon, List<URL>> scanForAddonMap(Predicate<String> filter)
    {
        Map<Addon, List<URL>> result = new IdentityHashMap<>();

        // For each Forge addon...
        for (Addon addon : furnace.getAddonRegistry().getAddons(AddonFilters.allStarted()))
        {
            List<String> filteredResourcePaths = filterAddonResources(addon, filter);

            List<URL> discoveredURLs = new ArrayList<>();
            for (String filePath : filteredResourcePaths)
            {
                URL ruleFile = addon.getClassLoader().getResource(filePath);
                if (ruleFile != null)
                    discoveredURLs.add(ruleFile);
            }
            if (!discoveredURLs.isEmpty())
                result.put(addon, discoveredURLs);
        }
        return result;
    }
514327
function listFilters(plugins) {
    return plugins
        .reverse()
        .reduce(function(result, plugin) {
            return result.merge(plugin.getFilters());
        }, Immutable.Map());
}
279969
def _verify_filters(self, kwargs, obj, encode=False):
        """"""
        return (filters.legacy_filter_formatter if encode else filters.filter_formatter)(
            kwargs,
            obj._get_attributes_map()
        )
996001
def load(filters="*.*", text='Select a file, FACEFACE!', default_directory='default_directory'):
    
    # make sure the filters contains "*.*" as an option!
    if not '*' in filters.split(';'): filters = filters + ";;All files (*)"
    
    # if this type of pref doesn't exist, we need to make a new one
    if default_directory in _settings.keys(): default = _settings[default_directory]
    else:                                     default = ""
    
    # pop up the dialog
    result = _qtw.QFileDialog.getOpenFileName(None,text,default,filters)
    
    # If Qt5, take the zeroth element
    if _s._qt.VERSION_INFO[0:5] == "PyQt5": result = result[0]
    
    # Make sure it's a string
    result = str(result)    
    
    if result == '': return None
    else:
        _settings[default_directory] = _os.path.split(result)[0]
        return result
1051312
def file_links(items, opts=None):
	
	result = []
	kwargs = get_kwargs_for_file_link(opts)
	for item in items:
		if isinstance(item, FileNode):
			result.append(get_file_link(item, **kwargs))
		else:
			result.append(file_links(item, kwargs))
	return result
1244875
@Override
    public Map<ArchivePath, Node> getContent(Filter<ArchivePath> filter) {
        return this.getArchive().getContent(filter);
    }
605224
def readFILTERLIST(self):
        
        number = self.readUI8()
        return [self.readFILTER() for _ in range(number)]
1242485
public Collection<Effort> getEffortRecords(EffortFilter filter) {
        filter = (filter == null) ? new EffortFilter() : filter;

        filter.workitem.clear();
        filter.workitem.add(this);
        return getInstance().get().effortRecords(filter);
    }
1369757
function _get_all_items(){
	var ret_filters = [];
	var complete_filters = bbop.core.get_keys(anchor.current_data);
	for( var cfi = 0; cfi < complete_filters.length; cfi++ ){
	    var test_filter = complete_filters[cfi];
	    if( test_filter != '_nil_' ){
		ret_filters.push(test_filter);
	    }
	}
	return ret_filters;
    }
921619
public List getFacesExtensionsFilterMappings()
    {
        if (_facesExtensionsFilterMappings != null)
        {
            return _facesExtensionsFilterMappings;
        }

        List tempExtensionsFilterMappings = new ArrayList();
        for (Iterator it = _filters.entrySet().iterator(); it.hasNext(); )
        {
            Map.Entry entry = (Map.Entry)it.next();
            String filterName = (String)entry.getKey();
            String filterClassName = (String)entry.getValue();
            
            if (!"org.apache.myfaces.component.html.util.ExtensionsFilter".equals(filterClassName) &&
                !"org.apache.myfaces.webapp.filter.ExtensionsFilter".equals(filterClassName))
            {
                // not an extensions filter
                continue;
            }
            
            Class filterClass = org.apache.myfaces.shared.util.ClassUtils.simpleClassForName(filterClassName);
            List urlPatterns = (List)_filterMappings.get(filterName);
            if( urlPatterns != null )
            {
                for (Iterator it2 = urlPatterns.iterator(); it2.hasNext(); )
                {
                    String urlpattern = (String)it2.next();
                    tempExtensionsFilterMappings.add(new org.apache.myfaces.shared.webapp.webxml.FilterMapping(
                        filterName, filterClass, urlpattern));
                    if (log.isLoggable(Level.FINEST))
                    {
                        log.finest("adding mapping for filter + " + filterName + " urlpattern = " + urlpattern);
                    }
                }
            }
        }
        
        //Expose to all threads
        _facesExtensionsFilterMappings = tempExtensionsFilterMappings;
        
        return _facesExtensionsFilterMappings;
    }
1187069
def autorun_filters(filters, doc, search_dirs, verbose):
    
    def remove_py(s):
            return s[:-3] if s.endswith('.py') else s

    filter_paths = []
    for filter_ in filters:
        filter_exp = p.normpath(p.expanduser(p.expandvars(filter_)))

        if filter_exp == remove_py(p.basename(filter_exp)).lstrip('.'):
            # import .foo  # is not supported
            module = True
            mod_path = filter_exp.replace('.', p.sep)
            path_postfixes = (p.join(mod_path, '__init__.py'), mod_path + '.py')
        else:
            module = False
            # allow with and without .py ending
            path_postfixes = (remove_py(filter_exp) + '.py',)

        for path, path_postf in [(path, path_postf)
                                 for path in search_dirs
                                 for path_postf in path_postfixes]:
            if p.isabs(path_postf):
                filter_path = path_postf
            else:
                filter_path = p.abspath(p.normpath(p.join(path, path_postf)))

            if p.isfile(filter_path):
                if verbose:
                    debug("panflute: filter <{}> found in {}".format(filter_, filter_path))

                if module and not (path in reduced_sys_path):
                    extra_dir = p.abspath(path)
                    # `path` already doesn't contain `.`, `..`, env vars or `~`
                else:
                    extra_dir = None
                module_ = filter_exp if module else filter_path

                filter_paths.append((filter_, filter_path, module_, extra_dir))
                break
            elif p.isabs(path_postf):
                if verbose:
                    debug("          filter <{}> NOT found in {}".format(filter_, filter_path))
                raise Exception("filter not found: " + filter_)
            elif verbose:
                debug("          filter <{}> NOT found in {}".format(filter_, filter_path))
        else:
            raise Exception("filter not found: " + filter_)

    for filter_, filter_path, module_, extra_dir in filter_paths:
        if verbose:
            debug("panflute: running filter <{}>".format(filter_))
        with ContextImport(module_, extra_dir) as module:
            try:
                module.main(doc)
            except Exception as e:
                debug("Failed to run filter: " + filter_)
                if not hasattr(module, 'main'):
                    debug(' - Possible cause: filter lacks a main() function')
                debug('Filter code:')
                debug('-' * 64)
                with open(filter_path) as fp:
                    debug(fp.read())
                debug('-' * 64)
                raise Exception(e)
        if verbose:
            debug("panflute: filter <{}> completed".format(filter_))

    return doc
358570
def load_filter_files(files)
      # collect the class => path => value entries from each defaults file
      hash = {}
      files.enumerate { |file| load_filter_file(file, hash) }
      logger.debug { "The migrator loaded the filters #{hash.qp}." }
      hash
    end
921164
function fileFilter(filter) {
  if (filter) {
     if (typeof filter === 'string') {
        var regex = new RegExp(filter);
        return function(filePath) { return regex.test(filePath); }
     }
     else if (filter instanceof RegExp)
        return function(filePath) { return filter.test(filePath); }
     else {   // must be a function itself
        return filter;
     }
   }
   else  // none, return "pass all"
      return function() { return true; };
}
109881
private List<AddOnModel> loadAddOns() {
        debug("searching for addons in: " + getMain().getFileSystemManager().getLibLocation());
        PluginManager pluginManager = new DefaultPluginManager(getMain().getFileSystemManager().getLibLocation(),
                new ArrayList<>(aspectOrAffectedSet));
        // load the plugins
        debug("loading plugins");
        pluginManager.loadPlugins();
        debug("loaded: " + pluginManager.getPlugins().toString());

        // start (active/resolved) the plugins
        try {
            debug("starting plugins");
            pluginManager.startPlugins();
        } catch (Exception | NoClassDefFoundError e) {
            error("Error while trying to start the PF4J-Plugins", e);
        }
        try {
            debug("retrieving addons from the plugins");
            List<AddOnModel> addOns = pluginManager.getExtensions(AddOnModel.class);
            debug("retrieved: " + addOns.toString());
            KeyManager keyManager = new KeyManager();
            addOns.stream()
                    .filter(addOn -> addOn.getClass().getClassLoader() instanceof IzouPluginClassLoader)
                    .forEach(addOn -> {
                        IzouPluginClassLoader izouPluginClassLoader = (IzouPluginClassLoader) addOn.getClass()
                                .getClassLoader();
                        PluginWrapper plugin = pluginManager.getPlugin(izouPluginClassLoader.getPluginDescriptor()
                                .getPluginId());
                        keyManager.manageAddOnKey(plugin.getDescriptor());
                        pluginWrappers.put(addOn, plugin);
                        addOn.setPlugin(plugin);
                    });
            keyManager.saveAddOnKeys();
            return addOns;
        } catch (Exception e) {
            log.fatal("Error while trying to start the AddOns", e);
            return new ArrayList<>();
        }
    }
1052053
function getFilters(resourceName, adapterName, operation) {
    var filterConfig = injector.loadModule('filterConfig');
    var filters = { before: [], after: [] };

    if (!filterConfig) { return filters; }

    var levels = [resourceName, adapterName, operation, 'before'];
    filters.before = (traverseFilters(filterConfig, levels, 0) || []).map(function (name) {
        return injector.loadModule(name + 'Filter');
    });

    levels = [resourceName, adapterName, operation, 'after'];
    filters.after = (traverseFilters(filterConfig, levels, 0) || []).map(function (name) {
        return injector.loadModule(name + 'Filter');
    });

    return filters;
}
1212931
def list_matching_files(dir, extensions=None, recursive=True):
    
    from .modules import utils
    return utils.list_matching_files(dir, extensions=extensions, recursive=recursive)
1072910
public Collection<FileInfo> getFileInfo(final Predicate<FileInfo> filter) {
        return files.values().stream()
                .filter(filter)
                .collect(Collectors.toList());
    }