// updateIssues just calls updateIssues utility function
// using the client and config as contained in this issueTracker.
11879
func (tracker *issueTracker) updateIssues(
	issues []*github.Issue,
	updateFunc issueUpdateFunc,
	rollbackFunc issueUpdateFunc,
) ([]*github.Issue, action.Action, error) {

	var (
		client = tracker.newClient()
		owner  = tracker.config.GitHubOwner
		repo   = tracker.config.GitHubRepository
	)
	return updateIssues(client, owner, repo, issues, updateFunc, rollbackFunc)
}
1120763
func (f *githubIssueFetcher) listIssues(query string, opts *github.SearchOptions) (*github.IssuesSearchResult, *github.Response, error) {
	return f.client.Search.Issues(query, opts)
}
513195
func (s *RepositoriesService) UpdateRequiredStatusChecks(ctx context.Context, owner, repo, branch string, sreq *RequiredStatusChecksRequest) (*RequiredStatusChecks, *Response, error) {
	u := fmt.Sprintf("repos/%v/%v/branches/%v/protection/required_status_checks", owner, repo, branch)
	req, err := s.client.NewRequest("PATCH", u, sreq)
	if err != nil {
		return nil, nil, err
	}

	sc := new(RequiredStatusChecks)
	resp, err := s.client.Do(ctx, req, sc)
	if err != nil {
		return nil, resp, err
	}

	return sc, resp, nil
}
1090244
func (p *Processor) UpdateSecrets(s secrets.Secrets, trustedCertificate *x509.Certificate) {
	p.aporetoJWT.UpdateSecrets(s, trustedCertificate)
}
751729
func dedupeIssues(issues []*github.Issue) []*github.Issue {
	set := make(map[int]struct{}, len(issues))
	return filterIssues(issues, func(issue *github.Issue) bool {
		num := *issue.Number
		if _, seen := set[num]; seen {
			return false
		}
		set[num] = struct{}{}
		return true
	})
}
823477
func (s *IssueService) Update(issue *Issue) (*Issue, *Response, error) {
	return s.UpdateWithOptions(issue, nil)
}
1306152
func (s *ServicesService) Update(idOrName string, svc *Service) (*Service, *http.Response, error) {
	return s.UpdateWithContext(context.TODO(), idOrName, svc)
}
911994
func (m *enumerator) updateMatches(skipEmptyKey bool) {
	m.lowK = nil
	m.lowIdxs = m.lowIdxs[:0]
	m.lowCurr = 0

	for i, key := range m.currKs {
		if (key == nil && m.currVs[i] == 0) || // in case of empty iterator
			(len(key) == 0 && skipEmptyKey) { // skip empty keys
			continue
		}

		cmp := bytes.Compare(key, m.lowK)
		if cmp < 0 || len(m.lowIdxs) == 0 {
			// reached a new low
			m.lowK = key
			m.lowIdxs = m.lowIdxs[:0]
			m.lowIdxs = append(m.lowIdxs, i)
		} else if cmp == 0 {
			m.lowIdxs = append(m.lowIdxs, i)
		}
	}
}
130917
func UpdateFailures(c context.Context, creations int, vm *model.VM) {
	creationFailures.Add(c, int64(creations), vm.Prefix, vm.Attributes.GetProject(), vm.Attributes.GetZone())
}
837669
func (me *DefaultAdapter) updateValuesSql(buf *SqlBuilder, updates ...UpdateExpression) error {
	if len(updates) == 0 {
		return NewGoquError("No update values provided")
	}
	updateLen := len(updates)
	for i, update := range updates {
		if err := me.Literal(buf, update); err != nil {
			return err
		}
		if i < updateLen-1 {
			buf.WriteRune(comma_rune)
		}
	}
	return nil

}
392129
func UpdateConsoles(c context.Context) error {
	cfgName := info.AppID(c) + ".cfg"

	logging.Debugf(c, "fetching configs for %s", cfgName)
	// Acquire the raw config client.
	lucicfg := backend.Get(c).GetConfigInterface(c, backend.AsService)
	// Project configs for Milo contains console definitions.
	configs, err := lucicfg.GetProjectConfigs(c, cfgName, false)
	if err != nil {
		return errors.Annotate(err, "while fetching project configs").Err()
	}
	logging.Infof(c, "got %d project configs", len(configs))

	merr := errors.MultiError{}
	knownProjects := map[string]stringset.Set{}
	// Iterate through each project config, extracting the console definition.
	for _, cfg := range configs {
		projectName := cfg.ConfigSet.Project()
		if projectName == "" {
			return fmt.Errorf("Invalid config set path %s", cfg.ConfigSet)
		}
		knownProjects[projectName] = nil
		if kp, err := updateProjectConsoles(c, projectName, &cfg); err != nil {
			err = errors.Annotate(err, "processing project %s", projectName).Err()
			merr = append(merr, err)
		} else {
			knownProjects[projectName] = kp
		}
	}

	// Delete all the consoles that no longer exists or are part of deleted projects.
	toDelete := []*datastore.Key{}
	err = datastore.Run(c, datastore.NewQuery("Console"), func(key *datastore.Key) error {
		proj := key.Parent().StringID()
		id := key.StringID()
		// If this console is either:
		// 1. In a project that no longer exists, or
		// 2. Not in the project, then delete it.
		knownConsoles, ok := knownProjects[proj]
		if !ok {
			logging.Infof(
				c, "deleting %s/%s because the project no longer exists", proj, id)
			toDelete = append(toDelete, key)
			return nil
		}
		if knownConsoles == nil {
			// The project exists but we couldn't check it this time.  Skip it and
			// try again the next cron cycle.
			return nil
		}
		if !knownConsoles.Has(id) {
			logging.Infof(
				c, "deleting %s/%s because the console no longer exists", proj, id)
			toDelete = append(toDelete, key)
		}
		return nil
	})
	if err != nil {
		merr = append(merr, err)
	} else if err := datastore.Delete(c, toDelete); err != nil {
		merr = append(merr, err)
	}

	// Print some stats.
	processedConsoles := 0
	for _, cons := range knownProjects {
		if cons != nil {
			processedConsoles += cons.Len()
		}
	}
	logging.Infof(
		c, "processed %d consoles over %d projects", processedConsoles, len(knownProjects))

	if len(merr) == 0 {
		return nil
	}
	return merr
}
651058
func (i *IssueStats) GetOpenIssues() int {
	if i == nil || i.OpenIssues == nil {
		return 0
	}
	return *i.OpenIssues
}
266417
func (c *Client) UpdateGCS(i *UpdateGCSInput) (*GCS, error) {
	if i.Service == "" {
		return nil, ErrMissingService
	}

	if i.Version == 0 {
		return nil, ErrMissingVersion
	}

	if i.Name == "" {
		return nil, ErrMissingName
	}

	path := fmt.Sprintf("/service/%s/version/%d/logging/gcs/%s", i.Service, i.Version, i.Name)
	resp, err := c.PutForm(path, i, nil)
	if err != nil {
		return nil, err
	}

	var b *GCS
	if err := decodeJSON(&b, resp.Body); err != nil {
		return nil, err
	}
	return b, nil
}
1078360
func (dp *DHCPPool) GetIssues(macs []string) ([]string, map[uint64]string) {
	dp.lock.Lock()
	defer dp.lock.Unlock()
	var found bool
	found = false
	var inPoolNotInCache []string
	var duplicateInPool map[uint64]string
	duplicateInPool = make(map[uint64]string)

	var count int
	var saveindex uint64
	for i := uint64(0); i < dp.capacity; i++ {
		if dp.free[i] {
			continue
		}
		for _, mac := range macs {
			if dp.mac[i] == mac {
				found = true
			}
		}
		if !found {
			inPoolNotInCache = append(inPoolNotInCache, dp.mac[i]+", "+strconv.Itoa(int(i)))
		}
	}
	for _, mac := range macs {
		count = 0
		saveindex = 0

		for i := uint64(0); i < dp.capacity; i++ {
			if dp.free[i] {
				continue
			}
			if dp.mac[i] == mac {
				if count == 0 {
					saveindex = i
				}
				if count == 1 {
					duplicateInPool[saveindex] = mac
					duplicateInPool[i] = mac
				} else if count > 1 {
					duplicateInPool[i] = mac
				}
				count++
			}
		}
	}
	return inPoolNotInCache, duplicateInPool
}
138748
func (r *Report) GetAllIssues() []*issue.Issue {
	var issues []*issue.Issue
	switch r.Type {
	case TypeMulti:
		for _, subReport := range r.Multi {
			issues = append(issues, subReport.GetAllIssues()...)
		}
	case TypeIssues:
		issues = append(issues, r.Issues...)
	}
	return issues
}
697751
func (s *DB) UpdateColumns(values interface{}) *DB {
	return s.NewScope(s.Value).
		Set("gorm:update_column", true).
		Set("gorm:save_associations", false).
		InstanceSet("gorm:update_interface", values).
		callCallbacks(s.parent.callbacks.updates).db
}
337496
func UpdateConditions(client v1beta1client.HelmReleaseInterface, fhr v1beta1.HelmRelease, updates ...v1beta1.HelmReleaseCondition) error {
	cFhr, err := client.Get(fhr.Name, v1.GetOptions{})
	if err != nil {
		return err
	}

	UpdateConditionsPatch(&cFhr.Status, updates...)
	_, err = client.UpdateStatus(cFhr)
	return err
}