Filters the matching class factories by supported properties.
506444
private static <T> T filterBySupportedProperties(
		Class<T> factoryClass,
		Map<String, String> properties,
		List<TableFactory> foundFactories,
		List<TableFactory> classFactories) {

		final List<String> plainGivenKeys = new LinkedList<>();
		properties.keySet().forEach(k -> {
			// replace arrays with wildcard
			String key = k.replaceAll(".\\d+", ".#");
			// ignore duplicates
			if (!plainGivenKeys.contains(key)) {
				plainGivenKeys.add(key);
			}
		});

		Optional<String> lastKey = Optional.empty();
		List<TableFactory> supportedFactories = new LinkedList<>();
		for (TableFactory factory: classFactories) {
			Set<String> requiredContextKeys = normalizeContext(factory).keySet();
			Tuple2<List<String>, List<String>> tuple2 = normalizeSupportedProperties(factory);
			// ignore context keys
			List<String> givenContextFreeKeys = plainGivenKeys.stream()
				.filter(p -> !requiredContextKeys.contains(p))
				.collect(Collectors.toList());
			List<String> givenFilteredKeys = filterSupportedPropertiesFactorySpecific(
				factory,
				givenContextFreeKeys);

			Boolean allTrue = true;
			for (String k: givenFilteredKeys) {
				lastKey = Optional.of(k);
				if (!(tuple2.f0.contains(k) || tuple2.f1.stream().anyMatch(p -> k.startsWith(p)))) {
					allTrue = false;
					break;
				}
			}
			if (allTrue) {
				supportedFactories.add(factory);
			}
		}

		if (supportedFactories.isEmpty() && classFactories.size() == 1 && lastKey.isPresent()) {
			// special case: when there is only one matching factory but the last property key
			// was incorrect
			TableFactory factory = classFactories.get(0);
			Tuple2<List<String>, List<String>> tuple2 = normalizeSupportedProperties(factory);

			String errorMessage = String.format(
				"The matching factory '%s' doesn't support '%s'.\n\nSupported properties of " +
					"this factory are:\n%s",
				factory.getClass().getName(),
				lastKey.get(),
				String.join("\n", tuple2.f0));

			throw new NoMatchingTableFactoryException(
				errorMessage,
				factoryClass,
				foundFactories,
				properties);
		} else if (supportedFactories.isEmpty()) {
			throw new NoMatchingTableFactoryException(
				"No factory supports all properties.",
				factoryClass,
				foundFactories,
				properties);
		} else if (supportedFactories.size() > 1) {
			throw new AmbiguousTableFactoryException(
				supportedFactories,
				factoryClass,
				foundFactories,
				properties);
		}

		return (T) supportedFactories.get(0);
	}
166984
def filterMapAttrs(records=getIndex(), **tags):
    """"""
    if len(tags) == 0: return records # otherwise if unspecified, all given records match
    ret = []
    for record in records: # attempt to match attributes
        if matchRecordAttrs(record, tags):
            ret.append(record)
    return ret
997610
def _generate_filtered_properties(self, props, filters):
        
        # by default no properties are returned
        if props and filters:
            return (props
                    if '*' in filters
                    else dict(((k, v) for k, v in props.items() if k in filters)))
1140586
def find_filter_class(filtername):
    """"""
    if filtername in FILTERS:
        return FILTERS[filtername]
    for name, cls in find_plugin_filters():
        if name == filtername:
            return cls
    return None
1357630
def filter_factory(global_conf, **local_conf):
    """"""
    conf = global_conf.copy()
    conf.update(local_conf)

    def trusted_shared_nets(app):
        return TrustedSharedNetwork(app, conf)
    return trusted_shared_nets
710699
def Filter(self, match=None, **_):
    """"""
    arg = self.stack.pop(-1)

    # Filters can be specified as a comma separated list.
    for filter_name in match.group(1).split(","):
      filter_object = ConfigFilter.classes_by_name.get(filter_name)
      if filter_object is None:
        raise FilterError("Unknown filter function %r" % filter_name)

      if not filter_object.sensitive_arg:
        logging.debug("Applying filter %s for %s.", filter_name, arg)
      arg = filter_object().Filter(arg)
      precondition.AssertType(arg, Text)

    self.stack[-1] += arg
906045
def get_factory_by_class(self, klass):
        
        for check, factory in self._factories.items():
            if klass is check:
                return factory(self, klass)
        for check, factory in self._factories.items():
            if issubclass(klass, check):
                return factory(self, klass)
        return klass
31281
def get_suitable_vis_classes(obj):
    """"""

    ret = []
    for class_ in classes_vis():
        if isinstance(obj, class_.input_classes):
            ret.append(class_)
    return ret
261061
def filter_cols(model, *filtered_columns):
    
    m = sa.orm.class_mapper(model)
    return list(
        {p.key for p in m.iterate_properties if hasattr(p, "columns")}.difference(
            filtered_columns
        )
    )
1007564
def factory(cls, **kwargs):
    
    for name, obj in inspect.getmembers(sys.modules[__name__]):
        if inspect.isclass(obj) and issubclass(obj, UserAuthnMethod):
            try:
                if obj.__name__ == cls:
                    return obj(**kwargs)
            except AttributeError:
                pass
1133987
def filter_factory(global_conf, **local_conf):
    """"""
    conf = global_conf.copy()
    conf.update(local_conf)

    def auth_filter(app):
        return Swauth(app, conf)
    return auth_filter
193082
def class_filter(classes, class_name):
    
    result_classes = classes
    if isinstance(class_name, list):
        if set(class_name) <= set(classes):
            result_classes = class_name
    return result_classes
1152712
def GetConvertersByClass(value_cls):
    """"""
    try:
      return ExportConverter.converters_cache[value_cls]
    except KeyError:
      results = [
          cls for cls in itervalues(ExportConverter.classes)
          if cls.input_rdf_type == value_cls
      ]
      if not results:
        results = [DataAgnosticExportConverter]

      ExportConverter.converters_cache[value_cls] = results
      return results
1219282
def _filter(self, objects, **kwargs):
        """"""
        for obj in objects:
            if self.filter(obj, **kwargs) is False:
                return False

        return True
1349308
public List<Class<?>> scanClasses(Predicate<String> filter)
    {
        List<Class<?>> discoveredClasses = new ArrayList<>(128);

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

            // Then try to load the classes.
            for (String discoveredFilename : discoveredFileNames)
            {
                String clsName = PathUtil.classFilePathToClassname(discoveredFilename);
                try
                {
                    Class<?> clazz = addon.getClassLoader().loadClass(clsName);
                    discoveredClasses.add(clazz);
                }
                catch (ClassNotFoundException ex)
                {
                    LOG.log(Level.WARNING, "Failed to load class for name '" + clsName + "':\n" + ex.getMessage(), ex);
                }
            }
        }
        return discoveredClasses;
    }
205990
private static void filterClasses(final Collection<Class<?>> classes) {
        final Iterator<Class<?>> iterator = classes.iterator();
        while (iterator.hasNext()) {
            final Class<?> clazz = iterator.next();
            if (clazz.isAnnotation() || !Reflections.isConcrete(clazz)) {
                iterator.remove();
            }
        }
    }
552073
def factory(cls, attrs):
        """"""
        name = attrs['identifier'].capitalize()
        return type(name, (cls,), attrs)