// filterList returns a list scrubbed of old releases.
557798
func filterList(rels []*release.Release) []*release.Release {
	idx := map[string]int32{}

	for _, r := range rels {
		name, version := r.GetName(), r.GetVersion()
		if max, ok := idx[name]; ok {
			// check if we have a greater version already
			if max > version {
				continue
			}
		}
		idx[name] = version
	}

	uniq := make([]*release.Release, 0, len(idx))
	for _, r := range rels {
		if idx[r.GetName()] == r.GetVersion() {
			uniq = append(uniq, r)
		}
	}
	return uniq
}
888968
func (b *Filter) Greylist(err error) {
	s, ok := status.FromError(err)
	if !ok {
		return
	}
	if ok, peerURL := required(s); ok && peerURL != "" {
		logger.Infof("Greylisting peer %s", peerURL)
		b.greylistURLs.Store(peerURL, time.Now())
	}
}
929644
func FilterFileList(path, pat string) ([]string, error) {
	capacity := 10
	//initialize a fileName slice, len=0, cap=10
	fileList := make([]string, 0, capacity)
	err := filepath.Walk(path,
		func(pathName string, f os.FileInfo, e error) error {
			if f == nil {
				return e
			}
			if f.IsDir() {
				return nil
			}
			if pat != "" {
				ret, _ := regexp.MatchString(pat, f.Name())
				if !ret {
					return nil
				}
			}
			fileList = append(fileList, pathName)
			return nil
		})
	return fileList, err
}
238463
func FilterHashes(h HashSet, f filter.Filter) HashSet {
	filtered := make(HashSet, 0)
	for _, e := range h {
		if !f.Match(e.Name) {
			filtered = append(filtered, e)
		}
	}
	log.Info("ignored", len(h)-len(filtered), "files")
	return filtered
}
116303
func (cli *Client) PluginList(ctx context.Context, filter filters.Args) (types.PluginsListResponse, error) {
	var plugins types.PluginsListResponse
	query := url.Values{}

	if filter.Len() > 0 {
		filterJSON, err := filters.ToParamWithVersion(cli.version, filter)
		if err != nil {
			return plugins, err
		}
		query.Set("filters", filterJSON)
	}
	resp, err := cli.get(ctx, "/plugins", query, nil)
	defer ensureReaderClosed(resp)
	if err != nil {
		return plugins, wrapResponseError(err, resp, "plugin", "")
	}

	err = json.NewDecoder(resp.body).Decode(&plugins)
	return plugins, err
}
1209068
func (mem *Memory) List(filter func(*rspb.Release) bool) ([]*rspb.Release, error) {
	defer unlock(mem.rlock())

	var ls []*rspb.Release
	for _, recs := range mem.cache {
		recs.Iter(func(_ int, rec *record) bool {
			if filter(rec.rls) {
				ls = append(ls, rec.rls)
			}
			return true
		})
	}
	return ls, nil
}
866244
func (api *ProductDiskAPI) FilterMultiBy(key string, value interface{}) *ProductDiskAPI {
	api.filterBy(key, value, true)
	return api
}
640011
func (f *FakeCloud) List(filter string) ([]types.NodeName, error) {
	f.addCall("list")
	result := []types.NodeName{}
	for _, machine := range f.Machines {
		if match, _ := regexp.MatchString(filter, string(machine)); match {
			result = append(result, machine)
		}
	}
	return result, f.Err
}
1138013
func (api *LicenseAPI) FilterBy(key string, value interface{}) *LicenseAPI {
	api.filterBy(key, value, false)
	return api
}
680503
func (s *evictionLister) List(selector labels.Selector) (ret []*v1beta1.Eviction, err error) {
	err = cache.ListAll(s.indexer, selector, func(m interface{}) {
		ret = append(ret, m.(*v1beta1.Eviction))
	})
	return ret, err
}
390894
func (api *InterfaceAPI) FilterBy(key string, value interface{}) *InterfaceAPI {
	api.filterBy(key, value, false)
	return api
}
334090
func (api *DNSAPI) FilterBy(key string, value interface{}) *DNSAPI {
	api.filterBy(key, value, false)
	return api
}
552577
func (api *BridgeAPI) FilterBy(key string, value interface{}) *BridgeAPI {
	api.filterBy(key, value, false)
	return api
}
572195
func (s *Server) filterContainerList(filter *pb.ContainerFilter, origCtrList []*oci.Container) []*oci.Container {
	// Filter using container id and pod id first.
	if filter.Id != "" {
		id, err := s.CtrIDIndex().Get(filter.Id)
		if err != nil {
			// If we don't find a container ID with a filter, it should not
			// be considered an error.  Log a warning and return an empty struct
			logrus.Warnf("unable to find container ID %s", filter.Id)
			return []*oci.Container{}
		}
		c := s.ContainerServer.GetContainer(id)
		if c != nil {
			switch {
			case filter.PodSandboxId == "":
				return []*oci.Container{c}
			case c.Sandbox() == filter.PodSandboxId:
				return []*oci.Container{c}
			default:
				return []*oci.Container{}
			}
		}
	} else if filter.PodSandboxId != "" {
		pod := s.ContainerServer.GetSandbox(filter.PodSandboxId)
		if pod == nil {
			return []*oci.Container{}
		}
		return pod.Containers().List()
	}
	logrus.Debug("no filters were applied, returning full container list")
	return origCtrList
}
317139
func (c *Conn) ListUnitsFiltered(states []string) ([]UnitStatus, error) {
	return c.listUnitsInternal(c.sysobj.Call("org.freedesktop.systemd1.Manager.ListUnitsFiltered", 0, states).Store)
}
530462
func (pc *PCCloud) List(filter string) ([]k8stypes.NodeName, error) {
	return nil, nil
}
116009
func (f *List) AddFilters(filters ...Filter) {
	for _, filter := range filters {
		fpb, err := filter.ConstructPBFilter()
		if err != nil {
			panic(err)
		}
		f.Filters = append(f.Filters, fpb)
	}
}