id
stringlengths
2
7
text
stringlengths
17
51.2k
title
stringclasses
1 value
c176000
bytesFree = stat.Bfree * uint64(stat.Bsize) bytesUsed = (stat.Blocks - stat.Bfree) * uint64(stat.Bsize) return percentBlocksFree, bytesFree, bytesUsed, nil }
c176001
not get atime for %s", path) return defaultTime } return at }
c176002
0 { return errors.New("priority must be >=0") } lensReg[config.Name] = lens logrus.Infof("Spyglass registered viewer %s with title %s.", config.Name, config.Title) return nil }
c176003
ErrInvalidLensName } return lens, nil }
c176004
a hard-coded value return LastNLinesChunked(a, n, 300*n+1) }
c176005
logrus.WithField("client", "slack"), tokenGenerator: tokenGenerator, } }
c176006
return nil } var uv = sl.urlValues() uv.Add("channel", channel) uv.Add("text", text) _, err := sl.postMessage(chatPostMessage, uv) return err }
c176007
ID: *gw.NatGatewayId, } if set.Mark(g) { inp := &ec2.DeleteNatGatewayInput{NatGatewayId: gw.NatGatewayId} if _, err := svc.DeleteNatGateway(inp); err != nil { klog.Warningf("%v: delete failed: %v", g.ARN(), err) } } } return true }); err != nil { return err } return nil }
c176008
Region: region, ID: *gw.NatGatewayId, }.ARN() set.firstSeen[arn] = now } return true }) return set, errors.Wrapf(err, "couldn't describe nat gateways for %q in %q", acct, region) }
c176009
= 30 * time.Second client.Dialer.KeepAlive = 30 * time.Second client.Dialer.DualStack = true client.http.Transport = &http.Transport{ Proxy: http.ProxyFromEnvironment, Dial: client.Dialer.Dial, DialContext: client.Dialer.DialContext, MaxIdleConns: 100, IdleConnTimeout: 90 * time.Second, TLSHandshakeTimeout: 10 * time.Second, ExpectContinueTimeout: 1 * time.Second, } return client }
c176010
defer c.lock.Unlock() if r != nil { c.storage.Add(*r) } return r, nil }
c176011
ErrNotFound { select { case <-ctx.Done(): return nil, err case <-time.After(3 * time.Second): continue } } return nil, err } return r, nil } }
c176012
defer c.lock.Unlock() for _, r := range resources { c.storage.Add(r) } return resources, nil }
c176013
:= range resources { c.storage.Delete(r.GetName()) err := c.release(r.GetName(), dest) if err != nil { allErrors = multierror.Append(allErrors, err) } } return allErrors }
c176014
!= nil { return fmt.Errorf("no resource name %v", name) } c.storage.Delete(name) if err := c.release(name, dest); err != nil { return err } return nil }
c176015
var allErrors error for _, r := range resources { if err := c.update(r.GetName(), state, nil); err != nil { allErrors = multierror.Append(allErrors, err) continue } if err := c.updateLocalResource(r, state, nil); err != nil { allErrors = multierror.Append(allErrors, err) } } return allErrors }
c176016
r.State, nil); err != nil { allErrors = multierror.Append(allErrors, err) continue } if err := c.storage.Update(r); err != nil { allErrors = multierror.Append(allErrors, err) } } return allErrors }
c176017
err := c.update(r.GetName(), state, userData); err != nil { return err } return c.updateLocalResource(r, state, userData) }
c176018
{ return c.metric(rtype) }
c176019
c.storage.List() return len(resources) > 0 }
c176020
address) if err != nil { if isDialErrorRetriable(err) { if i < count-1 { select { case <-time.After(sleep): i++ continue case <-ctx.Done(): return nil, err } } } return nil, err } return conn, nil } }
c176021
return &DashboardAgent{ repos: repos, goac: config, log: log, } }
c176022
:= range sq.Search.Nodes { prs = append(prs, n.PullRequest) } if !sq.Search.PageInfo.HasNextPage { break } vars["searchCursor"] = githubql.NewString(sq.Search.PageInfo.EndCursor) } da.log.Infof("Search for query \"%s\" cost %d point(s). %d remaining.", query, totalCost, remaining) return prs, nil }
c176023
{ return nil, fmt.Errorf("failed to get the combined status: %v", err) } contexts := make([]Context, 0, len(combined.Statuses)) for _, status := range combined.Statuses { contexts = append( contexts, Context{ Context: status.Context, Description: status.Description, State: strings.ToUpper(status.State), }, ) } return contexts, nil }
c176024
+ login} for i := range da.repos { tokens = append(tokens, fmt.Sprintf("repo:\"%s\"", da.repos[i])) } return strings.Join(tokens, " ") }
c176025
description, states: map[string]State{}, } }
c176026
if !ok { state = NewState(b.description) } state, changed := state.ReceiveEvent(eventName, label, t) b.states[ID] = state return changed }
c176027
if !state.Active() { continue } ages[id] = state.Age(t) } return ages }
c176028
int(math.Ceil(float64(percentile)*float64(len(ages))/100) - 1) if index >= len(ages) { panic(fmt.Errorf("Index is out of range: %d/%d", index, len(ages))) } return ages[index] }
c176029
requests, RequestRetries: requestRetries, RequestLatency: requestLatency, }, ResyncPeriod: resyncPeriod, } }
c176030
path.Join(cacheDir, "temp"), CacheSizeMax: uint64(cacheSizeGB) * uint64(1000000000), // convert G to B })), maxConcurrency, ) }
c176031
NewFromCache(delegate, httpcache.NewMemoryCache(), maxConcurrency) }
c176032
upstreamTransport{delegate: delegate}) return &requestCoalescer{ keys: make(map[string]*responseWaiter), delegate: cacheTransport, } }
c176033
{ return &fakeprowv1.FakeProwV1{Fake: &c.Fake} }
c176034
{ return &fakeprowv1.FakeProwV1{Fake: &c.Fake} }
c176035
return Owners{filenames: filenames, repo: r, seed: s, log: log} }
c176036
ownersToApprovers[fn] = o.repo.Approvers(fn) } return ownersToApprovers }
c176037
len(approversOnly) == 0 { o.log.Debug("No potential approvers exist. Does the repo have OWNERS files?") } return approversOnly }
c176038
{ approverOwnersfiles[approver].Insert(ownersFile) } else { approverOwnersfiles[approver] = sets.NewString(ownersFile) } } } return approverOwnersfiles }
c176039
ap.AddApprover(approver, "", false) } return ap.UnapprovedFiles() }
c176040
for _, suggestedApprover := range o.GetSuggestedApprovers(reverseMap, potentialApprovers).List() { if reverseMap[suggestedApprover].Intersection(unapproved).Len() != 0 { keptApprovers.Insert(suggestedApprover) } } return keptApprovers }
c176041
Unapproved: %q", ap.UnapprovedFiles().List()) return ap.GetCurrentApproversSet() } ap.AddApprover(newApprover, "", false) } return ap.GetCurrentApproversSet() }
c176042
owners.Insert(o.repo.FindApproverOwnersForFile(fn)) } o.removeSubdirs(owners) return owners }
c176043
0, len(approversList)) for _, i := range order { people = append(people, approversList[i]) } return people }
c176044
title="%s">%s</a>*`, a.Reference, a.How, a.Login, ) }
c176045
} intersection := sets.NewString() for item := range one { if lower.Has(strings.ToLower(item)) { intersection.Insert(item) } } return intersection }
c176046
approvers: map[string]Approval{}, assignees: sets.NewString(), ManuallyApproved: func() bool { return false }, } }
c176047
= Approval{ Login: login, How: "LGTM", Reference: reference, NoIssue: noIssue, } }
c176048
string) { delete(ap.approvers, strings.ToLower(login)) }
c176049
ap.assignees.Insert(strings.ToLower(login)) } }
c176050
currentApprovers.Insert(approval.Login) } return currentApprovers }
c176051
to keep the syntax of the github handle // rather than the potential mis-cased username found in // the OWNERS file, that's why it's the first parameter. filesApprovers[fn] = IntersectSetsCase(currentApprovers, potentialApprovers) } return filesApprovers }
c176052
for login, approver := range ap.approvers { if !approver.NoIssue { continue } if len(reverseMap[login]) == 0 { continue } nia[login] = approver } return nia }
c176053
len(approvers) == 0 { unapproved.Insert(fn) } } return unapproved }
c176054
} else { allOwnersFiles = append(allOwnersFiles, ApprovedFile{ baseURL: baseURL, filepath: file, approvers: filesApprovers[file], branch: branch, }) } } return allOwnersFiles }
c176055
ap.ManuallyApproved() { return true } return reqsMet }
c176056
:= range ap.GetCurrentApproversSet().List() { approvals = append(approvals, ap.approvers[approver]) } return approvals }
c176057
approver := range ap.GetNoIssueApproversSet().List() { approvals = append(approvals, ap.approvers[approver]) } return approvals }
c176058
else if err := messageTempl.Execute(buf, data); err != nil { return "", fmt.Errorf("failed to execute template for %s: %v", name, err) } return buf.String(), nil }
c176059
return err } } // open file at output path and truncate f, err := os.OpenFile(outputPath, os.O_RDWR, 0644) if err != nil { return err } defer f.Close() f.Truncate(0) // render template to output path err = t.Execute(f, data) if err != nil { return err } return nil }
c176060
labelmap[name] = l } } } var labels []Label for _, label := range labelmap { labels = append(labels, label) } sort.Slice(labels, func(i, j int) bool { return labels[i].Name < labels[j].Name }) return labels }
c176061
to make nice tables sort.Slice(filteredLabels, func(i, j int) bool { return filteredLabels[i].Name < filteredLabels[j].Name }) return }
c176062
= yaml.Unmarshal(data, &c); err != nil { return nil, err } if err = c.validate(orgs); err != nil { // Ensure no dups return nil, err } return &c, nil }
c176063
repo") repoLabels, err := gc.GetRepoLabels(org, repository) if err != nil { logrus.WithField("org", org).WithField("repo", repository).Error("Failed listing labels for repo") errChan <- err } labels <- RepoLabels{repository: repoLabels} } }(repoChan) } wg.Wait() close(labels) close(errChan) rl := RepoLabels{} for data := range labels { for repo, repoLabels := range data { rl[repo] = repoLabels } } var overallErr error if len(errChan) > 0 { var listErrs []error for listErr := range errChan { listErrs = append(listErrs, listErr) } overallErr = fmt.Errorf("failed to list labels: %v", listErrs) } return &rl, overallErr }
c176064
return Update{Why: "dead", Current: &label, repo: repo} }
c176065
return Update{Why: "missing", Wanted: &label, repo: repo} }
c176066
newRequired[lower] = l case l.DeleteAfter != nil && now.After(*l.DeleteAfter): newDead[lower] = l case parent != nil: l.parent = parent newArchaic[lower] = l } newRequired, newArchaic, newDead = classifyLabels(l.Previously, newRequired, newArchaic, newDead, now, first) } return newRequired, newArchaic, newDead }
c176067
link = discard.ReplaceAllString(link, "") // lowercase return strings.ToLower(link) }
c176068
diskRoot: strings.TrimSuffix(diskRoot, string(os.PathListSeparator)), } }
c176069
filepath.Join(c.diskRoot, key) }
c176070
os.MkdirAll(dir, os.FileMode(0744)) }
c176071
removeTemp(temp.Name()) return fmt.Errorf( "hashes did not match for '%s', given: '%s' actual: '%s", key, contentSHA256, actualContentSHA256) } } // move the content to the key location err = temp.Sync() if err != nil { removeTemp(temp.Name()) return fmt.Errorf("failed to sync cache entry: %v", err) } temp.Close() err = os.Rename(temp.Name(), path) if err != nil { removeTemp(temp.Name()) return fmt.Errorf("failed to insert contents into cache: %v", err) } return nil }
c176072
} return fmt.Errorf("failed to get key: %v", err) } return readHandler(true, f) }
c176073
os.Remove(c.KeyToPath(key)) }
c176074
link, path: path, sizeLimit: sizeLimit, ctx: ctx, } }
c176075
0, fmt.Errorf("error getting gcs attributes for artifact: %v", err) } return attrs.Size, nil }
c176076
getting artifact reader: %v", err) } defer reader.Close() p, err := ioutil.ReadAll(reader) if err != nil { return nil, fmt.Errorf("error reading all from artifact: %v", err) } return p, nil }
c176077
reader, err := a.handle.NewRangeReader(a.ctx, offset, -1) defer reader.Close() if err != nil && err != io.EOF { return nil, fmt.Errorf("error getting artifact reader: %v", err) } read, err := ioutil.ReadAll(reader) if err != nil { return nil, fmt.Errorf("error reading all from artiact: %v", err) } return read, nil }
c176078
gcs attributes for artifact: %v", err) } return attrs.ContentEncoding == "gzip", nil }
c176079
config.Welcome { if !strInSlice(org, c.Repos) { continue } return &c } // Return an empty config, and default to defaultWelcomeMessage return &plugins.Welcome{} }
c176080
{ err = cache.ListAll(s.indexer, selector, func(m interface{}) { ret = append(ret, m.(*v1.ProwJob)) }) return ret, err }
c176081
{ return prowJobNamespaceLister{indexer: s.indexer, namespace: namespace} }
c176082
func(m interface{}) { ret = append(ret, m.(*v1.ProwJob)) }) return ret, err }
c176083
{ return len(br.SkipBranches) == 0 && len(br.Branches) == 0 }
c176084
are regex skip lists, simple comparison // is insufficient. for _, b := range baseBranches.List() { if other.ShouldRun(b) { return true } } return false } if len(other.Branches) == 0 { // There can only be one Brancher with skip_branches. return true } return other.Intersects(br) }
c176085
return true, false, err } return true, cm.RunsAgainstChanges(changeList), nil } return false, false, nil }
c176086
if cm.reChanges.MatchString(change) { return true } } return false }
c176087
return ps.Brancher.ShouldRun(baseRef) }
c176088
determined, shouldRun, err := ps.RegexpChangeMatcher.ShouldRun(changes); err != nil { return false, err } else if determined { return shouldRun, nil } // Postsubmits default to always run return true, nil }
c176089
return ps.Brancher.ShouldRun(baseRef) }
c176090
} if determined, shouldRun, err := ps.RegexpChangeMatcher.ShouldRun(changes); err != nil { return false, err } else if determined { return shouldRun, nil } return defaults, nil }
c176091
ps := presubmits[i] if ps.Name == jobName { return &ps } } return nil }
c176092
SetPresubmitRegexes(nj[k]); err != nil { return err } } c.Presubmits = nj return nil }
c176093
SetPostsubmitRegexes(nj[k]); err != nil { return err } } c.Postsubmits = nj return nil }
c176094
{ for _, r := range repos { if r == repo { res = append(res, v...) break } } } } return res }
c176095
else { for _, r := range repos { if r == repo { res = append(res, v...) break } } } } return res }
c176096
{ res = append(res, p) } return res } return listPeriodic(c.Periodics) }
c176097
presubmits[i].Brancher.reSkip = nil presubmits[i].RegexpChangeMatcher.reChanges = nil } }
c176098
== 0 && len(s.Reviewers) == 0 && len(s.RequiredReviewers) == 0 && len(s.Labels) == 0 }
c176099
ghc, logger: logrus.WithField("client", "repoowners"), cache: make(map[string]cacheEntry), mdYAMLEnabled: mdYAMLEnabled, skipCollaborators: skipCollaborators, ownersDirBlacklist: ownersDirBlacklist, } }