id stringlengths 2 7 | text stringlengths 17 51.2k | title stringclasses 1
value |
|---|---|---|
c6300 | oldest := ndb.nodeCacheQueue.Front()
hash := ndb.nodeCacheQueue.Remove(oldest).(*Node).hash
delete(ndb.nodeCache, string(hash))
}
} | |
c6301 | ndb.batch.Close()
ndb.batch = ndb.db.NewBatch()
} | |
c6302 | empty")
}
return ndb.saveRoot(root.hash, version)
} | |
c6303 | return ndb.saveRoot([]byte{}, version)
} | |
c6304 | > 0 && (elems[0] == n || (nav.NodeType() == xpath.AttributeNode &&
nav.LocalName() == elems[0].Data && nav.Value() == InnerText(elems[0]))) {
continue
}
elems = append(elems, n)
}
return elems
} | |
c6305 | := charset.NewReader(resp.Body, resp.Header.Get("Content-Type"))
if err != nil {
return nil, err
}
return html.Parse(r)
} | |
c6306 | error) {
return html.Parse(r)
} | |
c6307 | }
for child := n.FirstChild; child != nil; child = child.NextSibling {
output(buf, child)
}
}
var buf bytes.Buffer
output(&buf, n)
return buf.String()
} | |
c6308 |
} else {
for n := n.FirstChild; n != nil; n = n.NextSibling {
html.Render(&buf, n)
}
}
return buf.String()
} | |
c6309 | c.Get(path, args, &organization)
if organization != nil {
organization.client = c
}
return
} | |
c6310 | args, &token)
if token != nil {
token.client = c
}
return
} | |
c6311 | if action.DidCreateCard() {
return action
}
}
return nil
} | |
c6312 | {
if action.DidCreateCard() {
newSlice = append(newSlice, action)
}
}
return newSlice
} | |
c6313 | {
if action.DidChangeListForCard() {
newSlice = append(newSlice, action)
}
}
return newSlice
} | |
c6314 | if action.DidChangeCardMembership() || action.DidArchiveCard() || action.DidUnarchiveCard() {
newSlice = append(newSlice, action)
}
}
return newSlice
} | |
c6315 | c.Get(path, args, &member)
if err == nil {
member.client = c
}
return
} | |
c6316 | o.client.Get(path, args, &members)
for i := range members {
members[i].client = o.client
}
return
} | |
c6317 | b.client.Get(path, args, &members)
for i := range members {
members[i].client = b.client
}
return
} | |
c6318 | c.ID)
err = c.client.Get(path, args, &members)
for i := range members {
members[i].client = c.client
}
return
} | |
c6319 | path := fmt.Sprintf("customFields/%s", fieldID)
err = c.Get(path, args, &customField)
return
} | |
c6320 | := fmt.Sprintf("boards/%s/customFields", b.ID)
err = b.client.Get(path, args, &customFields)
return
} | |
c6321 | {
return durs[i].FirstEntered.Before(durs[j].FirstEntered)
} | |
c6322 |
err = errors.Wrap(err, "GetMembershipChangeActions() call failed.")
return
}
} else {
actions = c.Actions.FilterToCardMembershipChangeActions()
}
return actions.GetMemberDurations()
} | |
c6323 | values in line with API POST
b.Prefs.SelfJoin = true
b.Prefs.CardCovers = true
return b
} | |
c6324 | := IDToTime(b.ID)
return t
} | |
c6325 | return b.client.Delete(path, Arguments{}, b)
} | |
c6326 | args, &board)
if board != nil {
board.client = c
}
return
} | |
c6327 | for i := range boards {
boards[i].client = c
}
return
} | |
c6328 | m.client.Get(path, args, &boards)
for i := range boards {
boards[i].client = m.client
}
return
} | |
c6329 | throttle: time.Tick(time.Second / 8), // Actually 10/second, but we're extra cautious
testMode: false,
ctx: context.Background(),
}
} | |
c6330 | *Client {
newC := *c
newC.ctx = ctx
return &newC
} | |
c6331 | := "members/me/notifications"
err = c.Get(path, args, ¬ifications)
for i := range notifications {
notifications[i].client = c
}
return
} | |
c6332 |
err := c.Post(path, args, webhook)
if err == nil {
webhook.client = c
}
return err
} | |
c6333 | args, &webhook)
if webhook != nil {
webhook.client = c
}
return
} | |
c6334 | fmt.Sprintf("tokens/%s/webhooks", t.ID)
err = t.client.Get(path, args, &webhooks)
return
} | |
c6335 |
}
decoder := json.NewDecoder(r.Body)
err = decoder.Decode(&whr)
if err != nil {
err = errors.Wrapf(err, "GetBoardWebhookRequest() failed to decode '%s'.", r.URL)
}
return
} | |
c6336 | := IDToTime(c.ID)
return t
} | |
c6337 | }
}
for _, cf := range c.CustomFieldItems {
name := bcfOptionNames[cf.IDCustomField]
// create 2nd level map when not available yet
map2, ok := bcfOptionsMap[cf.IDCustomField]
if !ok {
continue
}
value, ok := map2[cf.IDValue]
if ok {
(*cfm)[name] = value
}
}
c.customFieldMa... | |
c6338 | args["idList"] = listID
return c.client.Put(path, args, &c)
} | |
c6339 | Arguments{"pos": fmt.Sprintf("%f", newPos)}, c)
} | |
c6340 |
return c.client.Delete(path, Defaults(), nil)
} | |
c6341 | = c.client.Post(path, Arguments{"value": memberID}, &member)
return member, err
} | |
c6342 | := fmt.Sprintf("cards/%s/idLabels/%s", c.ID, labelID)
return c.client.Delete(path, Defaults(), label)
} | |
c6343 | c.client.Post(path, Arguments{"value": labelID}, &c.IDLabels)
return err
} | |
c6344 | c.ID)
return c.client.Put(path, Arguments{"pos": "top"}, c)
} | |
c6345 | return c.client.Put(path, args, c)
} | |
c6346 | args["due"] = card.Due.Format(time.RFC3339)
}
// Allow overriding the creation position with 'top' or 'botttom'
if pos, ok := extraArgs["pos"]; ok {
args["pos"] = pos
}
err := c.Post(path, args, &card)
if err == nil {
card.client = c
}
return err
} | |
c6347 | }
if card.Due != nil {
args["due"] = card.Due.Format(time.RFC3339)
}
// Allow overwriting the creation position with 'top' or 'bottom'
if pos, ok := extraArgs["pos"]; ok {
args["pos"] = pos
}
err := l.client.Post(path, args, &card)
if err == nil {
card.client = l.client
} else {
err = errors.Wrapf(err,... | |
c6348 | args["text"] = comment
action := Action{}
err := c.client.Post(path, args, &action)
if err != nil {
err = errors.Wrapf(err, "Error commenting on card %s", c.ID)
}
return &action, err
} | |
c6349 | attachment.URL,
"name": attachment.Name,
}
err := c.client.Post(path, args, &attachment)
if err != nil {
err = errors.Wrapf(err, "Error adding attachment to card %s", c.ID)
}
return err
} | |
c6350 | return nil, err
}
action = actions.FirstCardCreateAction()
}
if action != nil && action.Data != nil && action.Data.CardSource != nil {
card, err := c.client.GetCard(action.Data.CardSource.ID, args)
return card, err
}
return nil, nil
} | |
c6351 | {
c.client.log("[trello] Can't get details about the parent of card '%s' due to lack of permissions or card deleted.", c.ID)
return ancestors, nil
} else if err != nil {
return ancestors, err
}
}
return ancestors, err
} | |
c6352 | if err != nil {
return c, err
}
if len(ancestors) > 0 {
return ancestors[len(ancestors)-1], nil
}
return c, nil
} | |
c6353 | if err != nil {
err = errors.Wrapf(err, "GetActions() call failed.")
return nil, err
}
}
actions = c.Actions.FilterToCardCreationActions()
if len(actions) > 0 {
return actions[0].MemberCreator, nil
}
return nil, errors.Errorf("No card creation actions on Card %s with a .MemberCreator", c.ID)
} | |
c6354 | if actions[0].IDMemberCreator != "" {
return actions[0].IDMemberCreator, err
}
}
return "", errors.Wrapf(err, "No Actions on card '%s' could be used to find its creator.", c.ID)
} | |
c6355 |
for _, action := range actions {
if action.Data != nil && action.Data.CardSource != nil && action.Data.CardSource.ID == cardID {
return true, nil
}
}
return false, nil
} | |
c6356 | := fmt.Sprintf("cards/%s", cardID)
err = c.Get(path, args, &card)
if card != nil {
card.client = c
}
return card, err
} | |
c6357 |
if len(nextCardBatch) > 0 {
cards = append(cards, nextCardBatch...)
} else {
moreCards = false
}
}
}
for i := range cards {
cards[i].client = b.client
}
return
} | |
c6358 | l.ID)
err = l.client.Get(path, args, &cards)
for i := range cards {
cards[i].client = l.client
}
return
} | |
c6359 | fmt.Sprintf("boards/%s/labels", b.ID)
err = b.client.Get(path, args, &labels)
return
} | |
c6360 | url.Values{}
for key, value := range args {
v.Set(key, value)
}
return v
} | |
c6361 | := fmt.Sprintf("boards/%s/actions", b.ID)
err = b.client.Get(path, args, &actions)
return
} | |
c6362 | := fmt.Sprintf("lists/%s/actions", l.ID)
err = l.client.Get(path, args, &actions)
return
} | |
c6363 | := fmt.Sprintf("cards/%s/actions", c.ID)
err = c.client.Get(path, args, &actions)
return
} | |
c6364 | from the card when it's closed.
// This allows us to "close out" the duration length.
return c.GetActions(Arguments{"filter": "addMemberToCard,removeMemberFromCard,updateCard:closed"})
} | |
c6365 | == "updateCard") && a.Data != nil && a.Data.Card != nil && a.Data.Card.Closed
} | |
c6366 | == "updateCard") && a.Data != nil && a.Data.Old != nil && a.Data.Old.Closed
} | |
c6367 | SearchResult{}
err = c.Get("search", args, &res)
cards = res.Cards
return
} | |
c6368 | = c.Get("search", args, &res)
boards = res.Boards
for _, board := range boards {
board.client = c
}
return
} | |
c6369 | err = c.Get("search/members", args, &members)
return
} | |
c6370 | return ok && re.IsRateLimit()
} | |
c6371 | return ok && nf.IsNotFound()
} | |
c6372 | := err.(permissionDeniedError)
return ok && pd.IsPermissionDenied()
} | |
c6373 | := IDToTime(l.ID)
return t
} | |
c6374 |
err = c.Get(path, args, &list)
if list != nil {
list.client = c
for i := range list.Cards {
list.Cards[i].client = c
}
}
return
} | |
c6375 | b.client.Get(path, args, &lists)
for i := range lists {
lists[i].client = b.client
for j := range lists[i].Cards {
lists[i].Cards[j].client = b.client
}
}
return
} | |
c6376 | err = errors.Wrapf(err, "ID '%s' failed to convert to timestamp.", id)
} else {
t = time.Unix(int64(ts), 0)
}
return
} | |
c6377 | l.Duration + d
l.TimesInList++
} | |
c6378 | if err != nil {
err = errors.Wrap(err, "GetListChangeActions() call failed.")
return
}
} else {
actions = c.Actions.FilterToListChangeActions()
}
return actions.GetListDurations()
} | |
c6379 | &ListDuration{ListID: prevList.ID, ListName: prevList.Name, Duration: duration, TimesInList: 1, FirstEntered: prevTime}
} else {
durs[prevList.ID].AddDuration(duration)
}
}
durations = make([]*ListDuration, 0, len(durs))
for _, ld := range durs {
durations = append(durations, ld)
}
sort.Sort(ByFirstEnte... | |
c6380 | false,
ClusterName: "Consul-Alerts",
}
victorOps := ¬ifier.VictorOpsNotifier{
Enabled: false,
}
ilert := ¬ifier.ILertNotifier{
Enabled: false,
IncidentKeyTemplate: "{{.Node}}:{{.Service}}:{{.Check}}",
}
notifiers := ¬ifier.Notifiers{
Email: email,
Log: ... | |
c6381 |
if res.StatusCode != 200 {
body, _ := ioutil.ReadAll(res.Body)
return errors.New(fmt.Sprintf("Unexpected HTTP status code: %d (%s)", res.StatusCode, string(body)))
}
return nil
} | |
c6382 | for _, kvpair := range remindersList {
var message notifier.Message
json.Unmarshal(kvpair.Value, &message)
messages = append(messages, message)
}
log.Println("Getting reminders")
return messages
} | |
c6383 | m.Node, m.CheckId)
c.api.KV().Put(&consulapi.KVPair{Key: key, Value: data}, nil)
log.Println("Setting reminder for node: ", m.Node)
} | |
c6384 | node, checkid)
c.api.KV().Delete(key, nil)
log.Println("Deleting reminder for node: ", node)
} | |
c6385 | data, _ := json.Marshal(status)
c.api.KV().Put(&consulapi.KVPair{Key: key, Value: data}, nil)
// check if blacklisted
if !c.IsBlacklisted(status.HealthCheck) {
alerts = append(alerts, *status.HealthCheck)
}
}
}
return alerts
} | |
c6386 | match := rp.FindStringSubmatch(kvPair.Key)
custNotifName := match[1]
if custNotifName == "" {
continue
}
customNotifs[custNotifName] = string(kvPair.Value)
}
}
return customNotifs
} | |
c6387 | if err != nil {
log.Printf("unable to match %s %s against pattern %s. Error: %s\n",
entity, id, pattern, err.Error())
} else if matched {
log.Printf("Regexp matching %s found (%s).\n", entity, pattern)
return profile
}
}
}
return ""
} | |
c6388 | kvPair, _, _ := c.api.KV().Get(key, nil)
if kvPair == nil {
log.Println("profile key not found.")
return checkProfile
}
if err := json.Unmarshal(kvPair.Value, &checkProfile); err != nil {
log.Error("Profile unmarshalling error: ", err.Error())
} else {
log.Println("Interval: ", checkProfile.Interval, " Li... | |
c6389 | c.CheckKeyExists(serviceCheckKey) || c.CheckKeyMatchesRegexp("consul-alerts/config/checks/blacklist/services", service)
}
}
checkID := check.CheckID
checkCheckKey := fmt.Sprintf("consul-alerts/config/checks/blacklist/checks/%s", checkID)
checkBlacklisted := func() bool {
return c.CheckKeyExists(checkCheckKey... | |
c6390 | := range substrings {
if _, ok := cm.SubstringToID[substring]; !ok {
cm.SubstringToID[substring] = make(map[uint32]struct{})
}
cm.SubstringToID[substring][uint32(i)] = struct{}{}
}
}
return cm
} | |
c6391 | := gzip.NewReader(f)
if err != nil {
return cm, err
}
err = json.NewDecoder(w).Decode(&cm)
return cm, err
} | |
c6392 | !ok {
cm.SubstringToID[substring] = make(map[uint32]struct{})
}
cm.SubstringToID[substring][uint32(i)] = struct{}{}
}
}
cm.mux.Unlock()
} | |
c6393 | return err
}
defer f.Close()
w := gzip.NewWriter(f)
defer w.Close()
enc := json.NewEncoder(w)
// enc.SetIndent("", " ")
return enc.Encode(cm)
} | |
c6394 | rankByWordCount(cm.match(searchWord)) {
return pair.Key
}
return ""
} | |
c6395 | if i >= max {
break
}
matches = append(matches, pair.Key)
}
return matches
} | |
c6396 | err != nil {
return c, err
}
defer resp.Body.Close()
return c, nil
} | |
c6397 | unmarshal(&s); err != nil {
return err
}
urlp, err := url.Parse(s)
if err != nil {
return err
}
u.URL = urlp
return nil
} | |
c6398 | return u.String(), nil
}
return nil, nil
} | |
c6399 | must be configured")
}
if c.BasicAuth != nil && (string(c.BasicAuth.Password) != "" && c.BasicAuth.PasswordFile != "") {
return fmt.Errorf("at most one of basic_auth password & password_file must be configured")
}
return nil
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.