query stringlengths 7 3.85k | document stringlengths 11 430k | metadata dict | negatives listlengths 0 101 | negative_scores listlengths 0 101 | document_score stringlengths 3 10 | document_rank stringclasses 102 values |
|---|---|---|---|---|---|---|
Title uses strings.Title to return operand with the first unicode codepoint of each word converted to uppercase. | func Title(operand string) string { return strings.Title(operand) } | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"func ToTitle(r rune) rune",
"func Title(in string) string {\n\n\trunes := []rune(in)\n\tlength := len(runes)\n\n\tvar out []rune\n\tfor i := 0; i < length; i++ {\n\t\tif i > 0 && unicode.IsUpper(runes[i]) && ((i+1 < length && unicode.IsLower(runes[i+1])) || unicode.IsLower(runes[i-1])) {\n\t\t\tout = append(out,... | [
"0.75362426",
"0.7420402",
"0.7298345",
"0.7221202",
"0.71784824",
"0.7118454",
"0.70131034",
"0.6994498",
"0.6810526",
"0.6740117",
"0.6604884",
"0.65940887",
"0.65800273",
"0.6561685",
"0.65249354",
"0.65127033",
"0.6468561",
"0.64599764",
"0.64533174",
"0.63843113",
"0.632... | 0.7397537 | 2 |
ToLower uses strings.ToLower to return operand with all unicode codepoints converted to lowercase. | func ToLower(operand string) string { return strings.ToLower(operand) } | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"func ToLower(r rune) rune",
"func SpecialCaseToLower(special unicode.SpecialCase, r rune) rune",
"func toLower(s string) string {\n\treturn strings.ToLower(s)\n}",
"func toLower(tk token.Token) token.Token {\n\ts := strings.ToLower(tk.Text())\n\treturn token.UpdateText(tk, s)\n}",
"func ToLower(str string)... | [
"0.7667526",
"0.736745",
"0.7208126",
"0.7137268",
"0.7069492",
"0.705703",
"0.705131",
"0.7034256",
"0.70304763",
"0.6950598",
"0.6929829",
"0.6856248",
"0.6828877",
"0.6773903",
"0.6757076",
"0.673432",
"0.67115104",
"0.66437197",
"0.6626718",
"0.66254663",
"0.6624735",
"... | 0.8119913 | 0 |
ToUpper uses strings.ToUpper to return operand with all unicode codepoints converted to uppercase. | func ToUpper(operand string) string { return strings.ToUpper(operand) } | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"func upper(in string) string {\n\tout := []rune(in)\n\tout[0] = unicode.ToUpper(out[0])\n\treturn string(out)\n}",
"func ToUpper(r rune) rune",
"func Upper(s string) string {\n\treturn strings.ToUpper(s)\n}",
"func upperCase(v string) (string, error) {\n\treturn strings.ToUpper(v), nil\n}",
"func ToUpper(s... | [
"0.7619067",
"0.7483768",
"0.7391097",
"0.7280122",
"0.72594786",
"0.7113133",
"0.71099466",
"0.70730865",
"0.7053634",
"0.701086",
"0.68747383",
"0.6840409",
"0.68256366",
"0.6812164",
"0.67067987",
"0.66705513",
"0.6659231",
"0.66334844",
"0.6598262",
"0.6582776",
"0.656221... | 0.84688693 | 0 |
Trim uses strings.Trim to remove any occurrences of chars from the beginning and end of operand. | func Trim(chars string, operand string) string { return strings.Trim(operand, chars) } | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"func TrimSpace(operand string) string { return strings.TrimSpace(operand) }",
"func TrimLeft(chars string, operand string) string { return strings.TrimLeft(operand, chars) }",
"func TrimPrefix(prefix, operand string) string { return strings.TrimPrefix(operand, prefix) }",
"func filterTrim(ctx stick.Context, ... | [
"0.8349016",
"0.7741901",
"0.7373609",
"0.7302248",
"0.7040318",
"0.69703877",
"0.69395834",
"0.6924436",
"0.6859497",
"0.6822096",
"0.6818247",
"0.67978364",
"0.6779929",
"0.67027116",
"0.66982675",
"0.6682328",
"0.66658735",
"0.6663513",
"0.6622947",
"0.6596055",
"0.6498226... | 0.89910746 | 0 |
TrimLeft uses strings.TrimLeft to remove any occurrences of chars from the beginning of operand. | func TrimLeft(chars string, operand string) string { return strings.TrimLeft(operand, chars) } | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"func (s *Str) TrimLeft(cutset string) *Str {\n\ts.val = strings.TrimLeft(s.val, cutset)\n\treturn s\n}",
"func LeftTrim(str, chars string) string {\n\tif chars == \"\" {\n\t\treturn strings.TrimLeftFunc(str, unicode.IsSpace)\n\t}\n\tr, _ := regexp.Compile(\"^[\" + chars + \"]+\")\n\treturn r.ReplaceAllString(str... | [
"0.7660647",
"0.7622056",
"0.7534656",
"0.74435884",
"0.7333051",
"0.72390336",
"0.72058535",
"0.6937747",
"0.6934556",
"0.67538977",
"0.666173",
"0.63456863",
"0.6317367",
"0.6309685",
"0.62236136",
"0.6174375",
"0.6161742",
"0.6141191",
"0.6040537",
"0.599031",
"0.5936853",... | 0.90295964 | 0 |
TrimPrefix uses strings.TrimPrefix to remove prefix from the beginning of operand. | func TrimPrefix(prefix, operand string) string { return strings.TrimPrefix(operand, prefix) } | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"func trimToPrefix(str, prefix string) string {\n\ti := strings.Index(str, prefix)\n\tif i < 0 {\n\t\treturn str\n\t}\n\treturn str[i:]\n}",
"func trimOutPrefix(str, prefix string) string {\n\ti := strings.Index(str, prefix)\n\tif i < 0 {\n\t\treturn str\n\t}\n\treturn str[i+len(prefix):]\n}",
"func (s *Stringi... | [
"0.79802936",
"0.76670146",
"0.7575979",
"0.7347845",
"0.7151964",
"0.6931681",
"0.6902632",
"0.6860264",
"0.6841062",
"0.68230784",
"0.6656401",
"0.65976673",
"0.65567815",
"0.64447945",
"0.642312",
"0.64137286",
"0.6408851",
"0.64047384",
"0.63290054",
"0.63274646",
"0.6324... | 0.9364741 | 0 |
TrimRight uses strings.TrimRight to remove any occurrences of chars from the end of operand. | func TrimRight(cutset string, operand string) string { return strings.TrimRight(operand, cutset) } | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"func trimRight(s string) string {\n\treturn strings.TrimRightFunc(s, unicode.IsSpace)\n}",
"func RightTrim(str, chars string) string {\n\tif chars == \"\" {\n\t\treturn strings.TrimRightFunc(str, unicode.IsSpace)\n\t}\n\tr, _ := regexp.Compile(\"[\" + chars + \"]+$\")\n\treturn r.ReplaceAllString(str, \"\")\n}",... | [
"0.7941458",
"0.7652819",
"0.7532694",
"0.74803454",
"0.70558035",
"0.6945625",
"0.69270116",
"0.6880997",
"0.6880915",
"0.6215482",
"0.61146474",
"0.60969275",
"0.6040601",
"0.589196",
"0.5886939",
"0.58238745",
"0.57857376",
"0.57648623",
"0.57059145",
"0.5652308",
"0.56523... | 0.83351445 | 0 |
TrimSpace uses strings.TrimSpace to remove all unicode whitespace codepoints from the beginning and end of operand. | func TrimSpace(operand string) string { return strings.TrimSpace(operand) } | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"func Trim(chars string, operand string) string { return strings.Trim(operand, chars) }",
"func TrimLeft(chars string, operand string) string { return strings.TrimLeft(operand, chars) }",
"func trimS(s string) string {\r\n\treturn strings.TrimSpace(s)\r\n}",
"func ShouldEqualTrimSpace(actual interface{}, expe... | [
"0.7410103",
"0.68665975",
"0.6548592",
"0.6355161",
"0.62889844",
"0.62683105",
"0.6243955",
"0.6243547",
"0.6224234",
"0.61773384",
"0.617549",
"0.61590344",
"0.61192745",
"0.60075575",
"0.60062546",
"0.59572494",
"0.59486145",
"0.5935191",
"0.5934588",
"0.5899888",
"0.5875... | 0.75475335 | 0 |
TrimSuffix uses strings.TrimSuffix to remove suffix from the end of operand. | func TrimSuffix(suffix, operand string) string { return strings.TrimSuffix(operand, suffix) } | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"func (s *Stringish) TrimSuffix(suffix string) *Stringish {\n\ts.str = strings.TrimSuffix(s.str, suffix)\n\treturn s\n}",
"func TrimPrefix(prefix, operand string) string { return strings.TrimPrefix(operand, prefix) }",
"func removeSuffix(value, suffix string) string {\n\treturn value[0 : len(value)-len(suffix)]... | [
"0.7361788",
"0.71717155",
"0.7046378",
"0.68964106",
"0.6881872",
"0.66473514",
"0.63875514",
"0.62565345",
"0.6204681",
"0.61894584",
"0.61191064",
"0.60459554",
"0.6032065",
"0.5949064",
"0.59068537",
"0.5882754",
"0.5873037",
"0.57579243",
"0.5750609",
"0.574808",
"0.5739... | 0.91758645 | 0 |
Unquote uses strconv.Unquote to the underlying, unquoted string value of operand. | func Unquote(operand string) (unquoted string, err error) { return strconv.Unquote(operand) } | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"func unquote(s string) string {\n\tif strings.HasPrefix(s, `\"`) && strings.HasSuffix(s, `\"`) {\n\t\ts, err := strconv.Unquote(s)\n\t\tif err != nil {\n\t\t\tpanic(fmt.Errorf(\"unable to unquote %q; %v\", s, err))\n\t\t}\n\t\treturn s\n\t}\n\treturn s\n}",
"func unquote(s []byte) (t string, ok bool) {\n\ts, ok ... | [
"0.69857085",
"0.6599664",
"0.62009734",
"0.5994443",
"0.595505",
"0.5912972",
"0.5821383",
"0.5570849",
"0.55220246",
"0.5440596",
"0.5429673",
"0.54185534",
"0.54095936",
"0.5297827",
"0.52768856",
"0.52635616",
"0.52546376",
"0.52247566",
"0.51736724",
"0.51180476",
"0.510... | 0.8678551 | 0 |
/ Slice Manipulation Grep filters operand according to pattern, returning a slice of matching elements. Pattern is treated as a regexp. | func Grep(pattern string, operand []string) ([]string, error) {
rex, err := regexp.Compile(pattern)
if err != nil {
return nil, err
}
var matching []string
for _, elem := range operand {
if rex.MatchString(elem) {
matching = append(matching, elem)
}
}
return matching, nil
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"func Filter(slice []string, match MatchFunc) []string {\n\tout := make([]string, 0, len(slice))\n\tfor _, s := range slice {\n\t\tif match(s) {\n\t\t\tout = append(out, s)\n\t\t}\n\t}\n\treturn out\n}",
"func FilterSliceWithRegexps(sl []string, excludeRegexps []*regexp.Regexp) []string {\n\tres := make([]string,... | [
"0.6164099",
"0.59633416",
"0.58574915",
"0.5823077",
"0.5570078",
"0.54958916",
"0.5297229",
"0.528321",
"0.5275069",
"0.5222033",
"0.52046746",
"0.51630586",
"0.50914747",
"0.502559",
"0.49922454",
"0.49668378",
"0.49371526",
"0.492161",
"0.49108174",
"0.4897063",
"0.489706... | 0.68440825 | 0 |
Head returns the first n elements of operand. If less than n elements are in operand, it returns all of operand. | func Head(n int, operand []string) []string {
if len(operand) < n {
return operand
}
return operand[:n]
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"func (s VectOp) Head(n int) VectOp {\n\treturn On(s[:n])\n}",
"func Tail(n int, operand []string) []string {\n\tif len(operand) < n {\n\t\treturn operand\n\t}\n\treturn operand[len(operand)-n:]\n}",
"func (s Stream) Head(n int) Stream {\n\tvar mod Modifer\n\tif n >= 0 {\n\t\th := head(n)\n\t\tmod = &h\n\t} els... | [
"0.66164404",
"0.5852609",
"0.580193",
"0.55647224",
"0.54286236",
"0.52772564",
"0.5217181",
"0.51278394",
"0.5118447",
"0.51058024",
"0.51055855",
"0.5101355",
"0.50714004",
"0.505273",
"0.4997914",
"0.49927148",
"0.49915862",
"0.49413338",
"0.492538",
"0.49159002",
"0.4905... | 0.82317895 | 0 |
Intersect returns the intersection of a and operand. Duplicate elements are removed. Ordering is not preserved. | func Intersect(a, operand []string) []string {
intersection := make([]string, Max(len(a), len(operand)))
uniqA := make(map[string]bool, len(a))
for _, elem := range a {
uniqA[elem] = true
}
i := 0
uniqOp := make(map[string]bool, len(operand))
for _, elem := range operand {
if uniqA[elem] && !uniqOp[elem] {
intersection[i] = elem
i++
}
uniqOp[elem] = true
}
return intersection[:i]
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"func intersect(a interface{}, b interface{}) []interface{} {\n\tset := make([]interface{}, 0)\n\tav := reflect.ValueOf(a)\n\n\tfor i := 0; i < av.Len(); i++ {\n\t\tel := av.Index(i).Interface()\n\t\tif contains(b, el) {\n\t\t\tset = append(set, el)\n\t\t}\n\t}\n\n\treturn set\n}",
"func Intersection[T comparable... | [
"0.6938771",
"0.6470136",
"0.6355641",
"0.62724626",
"0.6205251",
"0.61451906",
"0.6133328",
"0.6062865",
"0.604192",
"0.5919244",
"0.5915263",
"0.59103686",
"0.5897044",
"0.58723134",
"0.5854885",
"0.58476067",
"0.58396256",
"0.5808019",
"0.5781952",
"0.5766504",
"0.57609963... | 0.7582888 | 0 |
Reverse returns a copy of operand with the elements in reverse order. | func Reverse(operand []string) []string {
reversed := make([]string, len(operand))
for i := range operand {
reversed[len(operand)-i-1] = operand[i]
}
return reversed
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"func (t *T) Reverse() *T { return &T{lhs: t.rhs, rhs: t.lhs} }",
"func (*Functions) Reverse(in interface{}) interface{} {\n\tv := reflect.ValueOf(in)\n\tc := v.Len()\n\tout := reflect.MakeSlice(v.Type(), c, c)\n\tfor i := 0; i < c; i++ {\n\t\tout.Index(i).Set(v.Index(c - i - 1))\n\t}\n\treturn out.Interface()\n}... | [
"0.6923477",
"0.6782499",
"0.6638562",
"0.6633635",
"0.66281265",
"0.65916026",
"0.6445335",
"0.64214706",
"0.6296603",
"0.6294488",
"0.62126815",
"0.6190993",
"0.61606294",
"0.6137002",
"0.6126894",
"0.61138034",
"0.61090255",
"0.60554713",
"0.60536623",
"0.6051185",
"0.6050... | 0.7513851 | 0 |
Seq generates a sequence of ints from first to last. If incr is specified (an optional third argument), then the sequence will increment by incr. Otherwise, incr defaults to 1. Incr may be negative to generate a sequence of descending ints. | func Seq(first, last int, incr ...int) []int {
j := 1
if len(incr) > 1 {
panic("Seq incr cannot be more than one value in length")
}
if len(incr) == 1 {
if (incr[0]) == 0 {
panic("Seq incr value cannot be zero")
}
j = incr[0]
}
var values []int
current := first
if j > 0 {
for current <= last {
values = append(values, current)
current += j
}
} else {
for current >= last {
values = append(values, current)
current += j
}
}
return values
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"func intSeq() func() int {\n\ti := 0\n\treturn func() int {\n\t\ti++\n\t\treturn i\n\t}\n}",
"func intSeq() func() int {\n\ti := 0\n\treturn func() int {\n\t\ti++\n\t\treturn i\n\t}\n}",
"func (d *DataPacket) SequenceIncr() {\n\td.data[111]++\n}",
"func Sequence(start int, includedEnd int, interval int) []in... | [
"0.58424926",
"0.58424926",
"0.5653298",
"0.56301075",
"0.5609903",
"0.5451971",
"0.5306408",
"0.52724165",
"0.52414966",
"0.52021176",
"0.5157603",
"0.5133184",
"0.5119144",
"0.51074183",
"0.50727046",
"0.50644374",
"0.50640833",
"0.5040232",
"0.49489027",
"0.49045926",
"0.4... | 0.7631241 | 0 |
Shuffle returns a copy of operand with the elements shuffled pseudorandomly. | func Shuffle(operand []string) []string {
shuffled := make([]string, len(operand))
for i, p := range pseudo.Perm(len(operand)) {
shuffled[i] = operand[p]
}
return shuffled
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"func (a Slice[T]) Shuffle() Slice[T] {\n\tfor i := len(a) - 1; i > 0; i-- {\n\t\tj := rand.Intn(i + 1)\n\t\ta[i], a[j] = a[j], a[i]\n\t}\n\treturn a\n}",
"func (indis Individuals) shuffle(generator *rand.Rand) Individuals {\n\tvar shuffled = make(Individuals, len(indis))\n\tfor i, v := range generator.Perm(len(i... | [
"0.65571165",
"0.63301414",
"0.63115364",
"0.6239861",
"0.62270623",
"0.62163925",
"0.62152797",
"0.62081397",
"0.6158927",
"0.61263853",
"0.60523444",
"0.60523444",
"0.6043424",
"0.6010341",
"0.60028875",
"0.59959465",
"0.5987183",
"0.59851146",
"0.5976741",
"0.59650725",
"0... | 0.7436856 | 0 |
Sort returns a copy of operand sorted by sort.Strings. | func Sort(operand []string) []string {
sorted := make([]string, len(operand))
for i := range operand {
sorted[i] = operand[i]
}
sort.Strings(sorted)
return sorted
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"func (p StringSlice) Sort() { Sort(p) }",
"func Strings(a []string) { Sort(StringSlice(a)) }",
"func (s StringSlice) Sort() {\n\tsort.Sort(s)\n}",
"func TestSort() {\n\ts := StringSlice{\"name1\", \"name3\", \"name2\"}\n\tfmt.Println(\"Input: \", s)\n\tsort.Sort(s)\n\t// Std lib: sort.SortStrings(s) :3\n\tfm... | [
"0.7126395",
"0.671989",
"0.62521285",
"0.61218864",
"0.6060801",
"0.5976071",
"0.59110546",
"0.57168454",
"0.5669356",
"0.5645189",
"0.55945086",
"0.5568044",
"0.5536487",
"0.54952943",
"0.5461731",
"0.5431923",
"0.53972733",
"0.53659576",
"0.53563726",
"0.5344095",
"0.53435... | 0.7650956 | 0 |
Tail returns the last n elements of operand. If less than n elements are in operand, it returns all of operand. | func Tail(n int, operand []string) []string {
if len(operand) < n {
return operand
}
return operand[len(operand)-n:]
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"func (ts TrickSlice) Last(n int) TrickSlice {\n\tv := reflect.Value(ts)\n\tif n > v.Len() {\n\t\tn = v.Len()\n\t}\n\treturn TrickSlice(v.Slice3(v.Len()-n, v.Len(), v.Len()))\n}",
"func Head(n int, operand []string) []string {\n\tif len(operand) < n {\n\t\treturn operand\n\t}\n\treturn operand[:n]\n}",
"func (s... | [
"0.5990556",
"0.58987325",
"0.56341475",
"0.5606524",
"0.55992526",
"0.55949426",
"0.5534373",
"0.5496476",
"0.5344239",
"0.530208",
"0.5287378",
"0.5271894",
"0.52395886",
"0.5224553",
"0.5187527",
"0.51836413",
"0.5181041",
"0.51473564",
"0.513726",
"0.5094199",
"0.5035168"... | 0.8165838 | 0 |
Union returns the union of a and operand. Duplicate elements are removed. Ordering is not preserved. | func Union(a, operand []string) []string {
uniq := make(map[string]bool, len(a)+len(operand))
for _, elem := range a {
uniq[elem] = true
}
for _, elem := range operand {
uniq[elem] = true
}
union := make([]string, len(uniq))
i := 0
for k := range uniq {
union[i] = k
i++
}
return union[:i]
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"func Union[T comparable](a, b Set[T]) Set[T] {\n\tresult := a.New()\n\tresult.Add(a.Elements()...)\n\tresult.Add(b.Elements()...)\n\treturn result\n}",
"func (s *QuickUnionSet) Union(a, b int) {\n\tfrom := s.Root(a)\n\tto := s.Root(b)\n\ts.SetID(from, to)\n}",
"func (r *Rights) Union(b ...*Rights) *Rights {\n\... | [
"0.7149548",
"0.6900931",
"0.6745773",
"0.66751015",
"0.6497951",
"0.6349197",
"0.6344535",
"0.63178736",
"0.631593",
"0.6304623",
"0.6292116",
"0.6256469",
"0.6236854",
"0.6230655",
"0.617909",
"0.61442053",
"0.61380035",
"0.6113462",
"0.6104106",
"0.6093799",
"0.6038361",
... | 0.7705332 | 0 |
/ Time Now uses time.Now to return the current time as a time.Time instance. | func Now() time.Time { return time.Now() } | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"func (t *Time) Now() time.Time {\n\treturn t.current\n}",
"func Now() Time {\n\treturn NewTime(time.Now())\n}",
"func TimeNow() Time {\n\treturn Time{\n\t\ttime.Now(),\n\t}\n}",
"func Now() Time {\n\treturn Time{format(time.Now())}\n}",
"func Now() Time {\n\tvar t Time\n\tt.FromNSec(uint64(gotime.Now().Uni... | [
"0.8948937",
"0.89447755",
"0.8840452",
"0.882197",
"0.8772744",
"0.8706519",
"0.87028384",
"0.8692103",
"0.8672435",
"0.8672435",
"0.8658959",
"0.86543334",
"0.86413795",
"0.85889804",
"0.8583817",
"0.8577014",
"0.85453176",
"0.8479161",
"0.8455715",
"0.844247",
"0.84101653"... | 0.8504319 | 17 |
ParseTime uses time.Parse to return a time.Time instance of operand parsed according to format. | func ParseTime(format, operand string) (time.Time, error) { return time.Parse(format, operand) } | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"func parseTime(format string, timeStr string) time.Time {\n\tt, err := time.Parse(format, timeStr)\n\tcheck(err)\n\treturn t\n}",
"func ParseTime(time string) (string, error) {\n\tmatches := TimeRegex.FindStringSubmatch(time)\n\tif len(matches) != 3 {\n\t\treturn \"\", errors.New(\"wrong time format - only minut... | [
"0.7695394",
"0.7498485",
"0.739932",
"0.73629034",
"0.72838485",
"0.7269359",
"0.72644264",
"0.72294974",
"0.7206954",
"0.72009856",
"0.7193034",
"0.71692765",
"0.71193546",
"0.71139544",
"0.7111959",
"0.7111016",
"0.70746815",
"0.7039669",
"0.70367527",
"0.70133245",
"0.696... | 0.8885299 | 0 |
/ Regular Expressions Matches use regexp.MatchString to check if operand matches pattern. | func Matches(pattern string, operand string) (bool, error) {
return regexp.MatchString(pattern, operand)
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"func Match(regx string, arg string) bool {\n\tmatched, err := regexp.MatchString(\"^(\"+regx+\")$\", arg)\n\tif err != nil {\n\t\treturn false\n\t}\n\treturn matched\n}",
"func main() {\n\tfmt.Println(isMatch(\"mississippi\", \"mis*is*p*.\"))\n\tfmt.Println(isMatch(\"aab\", \"c*a*b\"))\n}",
"func (String) Matc... | [
"0.6712451",
"0.6439957",
"0.6344449",
"0.6230377",
"0.6228559",
"0.62159455",
"0.6212523",
"0.62079054",
"0.6198076",
"0.618296",
"0.61804867",
"0.61698055",
"0.61658955",
"0.6119233",
"0.60992146",
"0.60759795",
"0.6074126",
"0.6049856",
"0.6049856",
"0.6004666",
"0.5965482... | 0.7500275 | 0 |
CompileRegex uses regexp.Compile to compile a new regexp.Regexp according to pattern. | func CompileRegex(pattern string) (*regexp.Regexp, error) { return regexp.Compile(pattern) } | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"func CompileRegexp(pattern string) *regexp.Regexp {\n\tif pattern == \"\" {\n\t\treturn nil\n\t}\n\n\t// add ^...$ to all regexp when not given\n\tif !strings.HasPrefix(pattern, \"^\") {\n\t\tpattern = \"^\" + pattern\n\t}\n\tif !strings.HasSuffix(pattern, \"$\") {\n\t\tpattern += \"$\"\n\t}\n\n\t// make all regex... | [
"0.81953734",
"0.7839732",
"0.77232397",
"0.74875295",
"0.73487467",
"0.7305067",
"0.724314",
"0.72297364",
"0.7156587",
"0.71189314",
"0.7027613",
"0.69368225",
"0.690044",
"0.68722314",
"0.68648875",
"0.68534964",
"0.68054307",
"0.66829604",
"0.6646106",
"0.6637849",
"0.662... | 0.900864 | 0 |
CompileERE uses regexp.CompilePOSIX to compile a new regexp.Regexp according to pattern. Uses POSIX extended regexp behavior. | func CompileERE(pattern string) (*regexp.Regexp, error) { return regexp.CompilePOSIX(pattern) } | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"func CompilePOSIX(expr string) (*NRegexp, error) {\n\tre, err := regexp.CompilePOSIX(expr)\n\treturn &NRegexp{Regexp: re}, err\n}",
"func CompileRegex(pattern string) (*regexp.Regexp, error) { return regexp.Compile(pattern) }",
"func MustCompilePOSIX(str string) *NRegexp {\n\treturn &NRegexp{Regexp: regexp.Mus... | [
"0.73134357",
"0.67773414",
"0.67725855",
"0.6715364",
"0.6700544",
"0.66973156",
"0.6678918",
"0.63899606",
"0.63447237",
"0.63398224",
"0.61929864",
"0.6109555",
"0.6099",
"0.6074681",
"0.6041667",
"0.6004279",
"0.589885",
"0.5801142",
"0.5786491",
"0.5763816",
"0.56644255"... | 0.91923267 | 0 |
QuoteRegex uses regexp.QuoteMeta to returnsoperand with all regex metachars escaped. | func QuoteRegex(operand string) string { return regexp.QuoteMeta(operand) } | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"func quote(s string) string {\n\treturn regexp.QuoteMeta(s)\n}",
"func Quote(operand string) string { return strconv.Quote(operand) }",
"func RegexpSlashQuote(sb *strings.Builder, str string) {\n\tutil.WriteByte(sb, '/')\n\tfor _, c := range str {\n\t\tswitch c {\n\t\tcase '\\t':\n\t\t\tutil.WriteString(sb, `\... | [
"0.64418626",
"0.6150245",
"0.5972613",
"0.58816785",
"0.57087374",
"0.56048954",
"0.53677803",
"0.5344235",
"0.5316042",
"0.52762926",
"0.52702194",
"0.52489674",
"0.52244294",
"0.5212476",
"0.5168041",
"0.5153413",
"0.51419055",
"0.51419055",
"0.51419055",
"0.514183",
"0.51... | 0.8789912 | 0 |
/ Encoding Base64Encode uses base64.StdEncoding to encode operand. | func Base64Encode(operand string) string { return base64.StdEncoding.EncodeToString([]byte(operand)) } | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"func base64Encode(value string) string {\n\treturn base64.StdEncoding.EncodeToString([]byte(value))\n}",
"func runtimeEncodeBase64(ic *interop.Context) error {\n\tsrc := ic.VM.Estack().Pop().Bytes()\n\tresult := base64.StdEncoding.EncodeToString(src)\n\tic.VM.Estack().PushVal([]byte(result))\n\treturn nil\n}",
... | [
"0.7592985",
"0.75759953",
"0.75514597",
"0.7529357",
"0.7516748",
"0.7492097",
"0.74903625",
"0.7457392",
"0.7451023",
"0.74448234",
"0.7409036",
"0.74026495",
"0.7399233",
"0.7367904",
"0.7363434",
"0.7363157",
"0.7342584",
"0.73423576",
"0.7318747",
"0.7312583",
"0.7302294... | 0.8992932 | 0 |
Base64Decode uses base64.StdEncoding to decode operand. | func Base64Decode(operand string) (string, error) {
bytes, err := base64.StdEncoding.DecodeString(operand)
return string(bytes), err
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"func Base64Decode(src []byte) ([]byte, error) {\n\treturn DefaultEncoding.Base64Decode(src)\n}",
"func base64Decode(s string) ([]byte, error) {\n\t// add back missing padding\n\tswitch len(s) % 4 {\n\tcase 2:\n\t\ts += \"==\"\n\tcase 3:\n\t\ts += \"=\"\n\t}\n\treturn base64.URLEncoding.DecodeString(s)\n}",
"fu... | [
"0.8132559",
"0.80681306",
"0.80681306",
"0.80534303",
"0.8034052",
"0.795179",
"0.7944728",
"0.7894075",
"0.7866363",
"0.7828444",
"0.7825174",
"0.78025174",
"0.7749249",
"0.7738054",
"0.77317834",
"0.7590619",
"0.7585206",
"0.7550624",
"0.7548784",
"0.7532218",
"0.7496599",... | 0.86120623 | 0 |
ParseBool uses strconv.ParseBool to parse operand as a bool. | func ParseBool(operand string) (value bool, err error) { return strconv.ParseBool(operand) } | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"func ParseBool(str string) bool {\n\tb, _ := strconv.ParseBool(str)\n\treturn b\n}",
"func ParseBool(str string) (bool, error) {\n\tif str == \"on\" {\n\t\treturn true, nil\n\t}\n\tif str == \"off\" {\n\t\treturn false, nil\n\t}\n\treturn strconv.ParseBool(str)\n}",
"func ParseBool(s string) (bool, error) {\n\... | [
"0.87281555",
"0.8482916",
"0.84199905",
"0.83869666",
"0.8338142",
"0.8029671",
"0.8000297",
"0.797828",
"0.7886067",
"0.76948595",
"0.7463733",
"0.73488927",
"0.73259276",
"0.73199666",
"0.7224256",
"0.7078567",
"0.70561355",
"0.70538497",
"0.70096534",
"0.6897837",
"0.6872... | 0.89225525 | 0 |
ParseInt uses strconv.ParseInt with base == 0 (auto) and bitsize = 32 to parse operand as an int. | func ParseInt(operand string) (value int, err error) {
i64, err := strconv.ParseInt(operand, 0, 32)
return int(i64), err
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"func ParseInt(s String, base Int) Int {\n\tresult, _ := strconv.ParseInt(string(s), int(base), 0)\n\treturn Int(result)\n}",
"func ParseInt(key string, base int, bitSize int) (int64, error) {\n\tfnParseInt := \"ParseInt\"\n\n\tval := os.Getenv(key)\n\n\tif val == \"\" {\n\t\treturn 0, notFoundError(key, fnParseI... | [
"0.7732646",
"0.747722",
"0.74192244",
"0.73542285",
"0.730553",
"0.7294096",
"0.72713816",
"0.7267639",
"0.7195607",
"0.7017008",
"0.6923082",
"0.6920135",
"0.691729",
"0.6908659",
"0.69058967",
"0.6884467",
"0.6884467",
"0.6877954",
"0.68716604",
"0.68492323",
"0.6831126",
... | 0.8082527 | 0 |
ParseFloat uses strconv.ParseFloat with bitsize == 64 to parse operand as a float. | func ParseFloat(operand string) (f float64, err error) { return strconv.ParseFloat(operand, 64) } | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"func ParseFloat(s string, bitSize int) (float64, error) {\n\treturn strconv.ParseFloat(s, bitSize)\n}",
"func ParseFloat(s string, base int, prec uint, mode RoundingMode) (f *Float, b int, err error) {}",
"func ParseFloat(s string, base int, prec uint, mode big.RoundingMode,) (*big.Float, int, error)",
"func... | [
"0.8577388",
"0.8037701",
"0.7888861",
"0.765797",
"0.7510848",
"0.74987507",
"0.7497898",
"0.73149884",
"0.7054141",
"0.70316344",
"0.701707",
"0.6983013",
"0.6963574",
"0.6880399",
"0.68307865",
"0.6796332",
"0.6754063",
"0.6752347",
"0.6695293",
"0.66873264",
"0.6636752",
... | 0.8547908 | 1 |
ParseURL uses url.Parse to parse operand as a url. | func ParseURL(operand string) (url *url.URL, err error) { return url.Parse(operand) } | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"func Parse(url string) *URL {\n\tresult := &URL{}\n\tresult.Input = url\n\tresult.Scheme, result.Opaque, result.Query, result.Fragment = splitMainPart(url)\n\tresult.Authority, result.Path = splitPath(result.Opaque)\n\tresult.UserInfo, result.Host, result.Port = splitAuthority(result.Authority)\n\tresult.Path = se... | [
"0.7380766",
"0.72652763",
"0.72410816",
"0.7142754",
"0.6947265",
"0.6927803",
"0.6865738",
"0.68655217",
"0.68425167",
"0.6833722",
"0.68201834",
"0.6754445",
"0.66690123",
"0.6664009",
"0.6628707",
"0.6611244",
"0.6603158",
"0.6520449",
"0.6483474",
"0.64653146",
"0.646494... | 0.8605891 | 0 |
/ Math Abs returns the absolute value of operand. | func Abs(operand int) int {
if operand < 0 {
return operand * -1
}
return operand
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"func Abs(arg float64) float64 {\n\treturn math.Abs(arg)\n}",
"func Abs(a int) int {\n\treturn neogointernal.Opcode1(\"ABS\", a).(int)\n}",
"func Abs(in Res) Res {\n\tsign := in.Output().Copy()\n\tanyvec.GreaterThan(sign, sign.Creator().MakeNumeric(0))\n\tsign.Scale(sign.Creator().MakeNumeric(2))\n\tsign.AddSca... | [
"0.82674694",
"0.815114",
"0.80781394",
"0.7916723",
"0.78819174",
"0.7836325",
"0.78362995",
"0.78362995",
"0.78362995",
"0.7770546",
"0.7764423",
"0.77447665",
"0.7727246",
"0.7717831",
"0.77176994",
"0.7654214",
"0.7606882",
"0.7606882",
"0.7606882",
"0.7606882",
"0.760688... | 0.8551374 | 0 |
Add a to operand. | func Add(a, operand int) int { return operand + a } | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"func Add() {\n\tMatch('+')\n\tTerm()\n\tEmitLn(\"ADD (SP)+,D0\")\n}",
"func Add(a, b Expr) Expr {\n\treturn &addOp{&simpleOperator{a, b, scanner.ADD}}\n}",
"func Add(a, b Expr) Expr {\n\treturn &arithmeticOperator{&simpleOperator{a, b, scanner.ADD}}\n}",
"func (c *OperandsController) Add(ctx *app.AddOperands... | [
"0.65395206",
"0.65035975",
"0.641603",
"0.6332773",
"0.63169646",
"0.62367994",
"0.6209624",
"0.61428565",
"0.6119819",
"0.6083758",
"0.6069107",
"0.6053807",
"0.60509676",
"0.60224986",
"0.59966093",
"0.5969306",
"0.5967391",
"0.59664905",
"0.5937366",
"0.59199166",
"0.5916... | 0.68668467 | 0 |
Subtract a from operand. | func Subtract(a, operand int) int { return operand - a } | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"func Subtract(a cty.Value, b cty.Value) (cty.Value, error) {\n\treturn SubtractFunc.Call([]cty.Value{a, b})\n}",
"func Subtract() {\n\tMatch('-')\n\tTerm()\n\tEmitLn(\"SUB (SP)+,D0\")\n\tEmitLn(\"NEG D0\")\n}",
"func subtract(x, y int) (res int) {\n\tres = x - y\n\treturn\n}",
"func (expr Expression) Subtrac... | [
"0.7223267",
"0.7035692",
"0.6913862",
"0.6877539",
"0.6848358",
"0.68113536",
"0.68023574",
"0.6774074",
"0.6738111",
"0.6730106",
"0.6730106",
"0.6730106",
"0.6708217",
"0.6704883",
"0.67037517",
"0.6674617",
"0.6651721",
"0.6651721",
"0.66430914",
"0.6631221",
"0.6624722",... | 0.8263535 | 0 |
Divide operand by a. | func Divide(a, operand int) int { return operand / a } | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"func (c *calculon) Divide(ctx context.Context, arg calculator.Operand) (calculator.Result, error) {\n\tc.mutex.Lock()\n\tdefer c.mutex.Unlock()\n\tif arg.Value == 0 {\n\t\treturn calculator.Result{}, calculator.InvalidArgumentError(map[string]string{\"value\": \"cannot be 0\"})\n\t}\n\tc.current /= arg.Value\n\tre... | [
"0.69174546",
"0.6843468",
"0.6825028",
"0.6747531",
"0.6714473",
"0.67077965",
"0.6701392",
"0.67010087",
"0.6653182",
"0.65372056",
"0.65251654",
"0.65114766",
"0.6497556",
"0.6494549",
"0.64721185",
"0.64691997",
"0.64665496",
"0.6429992",
"0.63459116",
"0.63432753",
"0.63... | 0.8398136 | 0 |
Modulo returns operand modulo a. | func Modulo(a, operand int) int { return operand % a } | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"func Modulo(a cty.Value, b cty.Value) (cty.Value, error) {\n\treturn ModuloFunc.Call([]cty.Value{a, b})\n}",
"func mod(a int, n int) int {\n\tif n == 0 {\n\t\treturn 0\n\t}\n\tval := a - (n * int(a/n))\n\tif val < 0 {\n\t\treturn val + n\n\t}\n\treturn val\n}",
"func Mod(a, b Expr) Expr {\n\treturn &arithmetic... | [
"0.7940327",
"0.7586372",
"0.7558664",
"0.74437463",
"0.73613614",
"0.7257822",
"0.72539693",
"0.7203363",
"0.6978081",
"0.6941233",
"0.6902041",
"0.6896566",
"0.6878835",
"0.68742746",
"0.6847059",
"0.68291336",
"0.6719125",
"0.6716226",
"0.6716226",
"0.6716226",
"0.6611154"... | 0.9219174 | 0 |
Multiply operand and a. | func Multiply(a, operand int) int { return operand * a } | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"func (t *Arith) Multiply(args *Args, reply *int) error {\n *reply = args.A * args.B\n return nil\n}",
"func Mul(a, b Expr) Expr {\n\treturn &arithmeticOperator{&simpleOperator{a, b, scanner.MUL}}\n}",
"func (t *Arith) Multiply(args *Args, reply *int) error {\n\t*reply = args.A * args.B\n\treturn nil\n}",... | [
"0.64794683",
"0.6352899",
"0.63007265",
"0.6270386",
"0.62166786",
"0.62012625",
"0.6192971",
"0.61921877",
"0.61724627",
"0.6120581",
"0.61101425",
"0.6107033",
"0.60812974",
"0.60760665",
"0.605561",
"0.60107994",
"0.5994247",
"0.59858465",
"0.5966094",
"0.59659034",
"0.59... | 0.76100755 | 0 |
Min returns the minimum of a and operand. | func Min(a, operand int) int {
if a < operand {
return a
}
return operand
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"func Min(a, b int) int {\n\treturn neogointernal.Opcode2(\"MIN\", a, b).(int)\n}",
"func (self *State)Min(a,b any)any{\n self.IncOperations(self.coeff[\"min\"]+self.off[\"min\"])\n return wrap2(a,b,math.Min)\n}",
"func Min(a, b float64) float64 {\n\tif a < b {\n\t\treturn a\n\t}\n\treturn b\n}",
"func Min(... | [
"0.7898636",
"0.75427616",
"0.7273848",
"0.7273848",
"0.7273848",
"0.7243717",
"0.7240031",
"0.7240031",
"0.71972597",
"0.71972597",
"0.71972597",
"0.71972597",
"0.71972597",
"0.71972597",
"0.71972597",
"0.71962607",
"0.71934444",
"0.7160514",
"0.7096722",
"0.7096722",
"0.709... | 0.79488987 | 0 |
Max returns the maximum of a and operand. | func Max(a, operand int) int {
if a > operand {
return a
}
return operand
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"func Max(a, b int) int {\n\treturn neogointernal.Opcode2(\"MAX\", a, b).(int)\n}",
"func (self *State)Max(a,b any)any{\n self.IncOperations(self.coeff[\"max\"]+self.off[\"max\"])\n return wrap2(a,b,math.Max)\n}",
"func Max(a uint64, b uint64) uint64 {\n\tif a > b {\n\t\treturn a\n\t}\n\treturn b\n}",
"func... | [
"0.76541007",
"0.75704294",
"0.7160812",
"0.7106996",
"0.7106996",
"0.7106996",
"0.70229346",
"0.6992478",
"0.69921494",
"0.6984913",
"0.6984913",
"0.6984913",
"0.6984913",
"0.6984913",
"0.6974091",
"0.6950687",
"0.69445604",
"0.69353336",
"0.69353336",
"0.69049996",
"0.68763... | 0.78921455 | 0 |
InSequence does work in sequence and waits for the previous work item to complete. it should write results on channel in order of input work array. | func InSequence(ch chan Result, work []int) []Result {
results := make([]Result, len(work))
go buildInSeq(ch, work, results)
return results
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"func InParallel(ch chan Result, work []int) []Result {\n\tresults := make([]Result, len(work))\n\tvar mutex = &sync.Mutex{}\n\tfor i, num := range work {\n\t\tgo func(w int, res *Result, ch chan Result) {\n\t\t\t*res = executeWork(w)\n\t\t\tmutex.Lock()\n\t\t\tch <- *res\n\t\t\tmutex.Unlock()\n\t\t}(num, &results[... | [
"0.5639781",
"0.5458441",
"0.51682293",
"0.51466763",
"0.50523716",
"0.50321937",
"0.49681675",
"0.4961015",
"0.4910961",
"0.48957968",
"0.48762244",
"0.48419768",
"0.4810957",
"0.47938824",
"0.4775782",
"0.47745758",
"0.47491193",
"0.47487912",
"0.4732034",
"0.47135037",
"0.... | 0.7534587 | 0 |
InParallel does work in parallel and should write results on channels as work item complete | func InParallel(ch chan Result, work []int) []Result {
results := make([]Result, len(work))
var mutex = &sync.Mutex{}
for i, num := range work {
go func(w int, res *Result, ch chan Result) {
*res = executeWork(w)
mutex.Lock()
ch <- *res
mutex.Unlock()
}(num, &results[i], ch)
}
return results
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"func (p *Pool) worker() {\n\tdefer p.wg.Done()\n\tfor job := range p.In {\n\t\tatomic.AddInt64(&p.Stats.Pending, -1)\n\t\tatomic.AddInt64(&p.Stats.Running, 1)\n\t\tjob.Result, job.Error = job.F(job.Args...)\n\t\tatomic.AddInt64(&p.Stats.Running, -1)\n\t\tatomic.AddInt64(&p.Stats.Completed, 1)\n\t\tp.Out <- job\n\t... | [
"0.64908785",
"0.625165",
"0.6146995",
"0.59722465",
"0.5944965",
"0.59253687",
"0.5891594",
"0.57865125",
"0.5781637",
"0.5769501",
"0.5758638",
"0.5753309",
"0.5699973",
"0.5681928",
"0.5672774",
"0.56393874",
"0.5605364",
"0.56021065",
"0.5571599",
"0.5538197",
"0.55216354... | 0.6966479 | 0 |
build sleep for time mentioned in num and returns the same number | func executeWork(num int) Result {
time.Sleep(time.Duration(num) * SleepUnit)
return Result(num)
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"func sleep(sec int) {\n <-time.After(time.Second * time.Duration(sec))\n}",
"func FindStuff(num int, c chan int) { \n pause := NextPause();\n\n for i := 0; i < 10; i++ { \n time.Sleep(pause())\n c <- num\n } \n}",
"func sleep(n time.Duration) {\n\ttime.Sleep(n *... | [
"0.6189984",
"0.6142917",
"0.6070678",
"0.60201865",
"0.5921345",
"0.5911421",
"0.58785754",
"0.5866416",
"0.5822231",
"0.5820751",
"0.58051276",
"0.57652694",
"0.5728804",
"0.56591916",
"0.5655849",
"0.5601837",
"0.5596157",
"0.55948293",
"0.5592226",
"0.557727",
"0.5573602"... | 0.5885448 | 6 |
SpittingWebToNest returns the Nest that this Spitter is creating a Web to spit at, thus connecting them. Nil if not spitting. Value can be returned as a nil pointer. | func (spitterImpl *SpitterImpl) SpittingWebToNest() spiders.Nest {
return spitterImpl.spittingWebToNestImpl
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"func (spitterImpl *SpitterImpl) Spit(nest spiders.Nest) bool {\n\treturn spitterImpl.RunOnServer(\"spit\", map[string]interface{}{\n\t\t\"nest\": nest,\n\t}).(bool)\n}",
"func (connection *SenseConnection) Sense() *SenseUplink {\n\treturn connection.SenseUplink\n}",
"func Spit(content string, spitType string, ... | [
"0.46678373",
"0.43025213",
"0.41266426",
"0.40999755",
"0.4031369",
"0.40144655",
"0.40144596",
"0.39685214",
"0.39212373",
"0.39158916",
"0.38860258",
"0.38709098",
"0.3857416",
"0.38451752",
"0.383847",
"0.3829763",
"0.38195068",
"0.3810067",
"0.38047096",
"0.37613794",
"0... | 0.8139762 | 0 |
Spit runs logic that creates and spits a new Web from the Nest the Spitter is on to another Nest, connecting them. | func (spitterImpl *SpitterImpl) Spit(nest spiders.Nest) bool {
return spitterImpl.RunOnServer("spit", map[string]interface{}{
"nest": nest,
}).(bool)
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"func LaunchWeb(conf Conf, rp string, hub *hub.Hub, q *event.Queue, addrChan chan string, webDev bool) {\n\tif rp == \"\" {\n\t\trp = rootPath\n\t}\n\tr := httprouter.New()\n\tr.HandleMethodNotAllowed = false\n\tr.NotFound = notFoundHandler{}\n\tr.PanicHandler = panicHandler\n\n\th := handler{hub: hub}\n\n\t// --- ... | [
"0.61486995",
"0.58042717",
"0.55214345",
"0.5442607",
"0.5282036",
"0.52660775",
"0.52590233",
"0.52099",
"0.51979893",
"0.5196904",
"0.518868",
"0.5142204",
"0.5105513",
"0.5049837",
"0.50302064",
"0.50073564",
"0.4975622",
"0.49714735",
"0.49605906",
"0.49463308",
"0.49382... | 0.0 | -1 |
InitImplDefaults initializes safe defaults for all fields in Spitter. | func (spitterImpl *SpitterImpl) InitImplDefaults() {
spitterImpl.SpiderlingImpl.InitImplDefaults()
spitterImpl.spittingWebToNestImpl = nil
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"func (jobImpl *JobImpl) InitImplDefaults() {\n\tjobImpl.GameObjectImpl.InitImplDefaults()\n\n\tjobImpl.carryLimitImpl = 0\n\tjobImpl.damageImpl = 0\n\tjobImpl.energyImpl = 0\n\tjobImpl.movesImpl = 0\n\tjobImpl.rangeImpl = 0\n\tjobImpl.shieldImpl = 0\n\tjobImpl.titleImpl = \"\"\n\tjobImpl.unitCostImpl = 0\n}",
"f... | [
"0.6839208",
"0.6786656",
"0.6145108",
"0.60509324",
"0.6035193",
"0.59128183",
"0.58774954",
"0.57771736",
"0.57705206",
"0.573478",
"0.567347",
"0.56701875",
"0.5638894",
"0.5609368",
"0.5605868",
"0.5598546",
"0.5596984",
"0.55728424",
"0.5521497",
"0.5506418",
"0.55063957... | 0.7516784 | 0 |
DeltaMerge merges the delta for a given attribute in Spitter. | func (spitterImpl *SpitterImpl) DeltaMerge(
deltaMerge base.DeltaMerge,
attribute string,
delta interface{},
) (bool, error) {
merged, err := spitterImpl.SpiderlingImpl.DeltaMerge(
deltaMerge,
attribute,
delta,
)
if merged || err != nil {
return merged, err
}
spidersDeltaMerge, ok := deltaMerge.(DeltaMerge)
if !ok {
return false, errors.New(
"deltaMerge is not the expected type of: " +
"'spiders.impl.DeltaMerge'",
)
}
switch attribute {
case "spittingWebToNest":
spitterImpl.spittingWebToNestImpl = spidersDeltaMerge.Nest(delta)
return true, nil
}
return false, nil // no errors in delta merging
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"func (unitImpl *UnitImpl) DeltaMerge(\n\tdeltaMerge base.DeltaMerge,\n\tattribute string,\n\tdelta interface{},\n) (bool, error) {\n\tmerged, err := unitImpl.GameObjectImpl.DeltaMerge(\n\t\tdeltaMerge,\n\t\tattribute,\n\t\tdelta,\n\t)\n\tif merged || err != nil {\n\t\treturn merged, err\n\t}\n\n\tstardashDeltaMerg... | [
"0.6245515",
"0.61435264",
"0.56309336",
"0.5469952",
"0.54615533",
"0.54158205",
"0.53108287",
"0.5222636",
"0.51804227",
"0.5180254",
"0.5049148",
"0.4957558",
"0.4927703",
"0.48822376",
"0.4880821",
"0.48743123",
"0.48371434",
"0.48234692",
"0.48100564",
"0.4801188",
"0.47... | 0.6708245 | 0 |
PingHandler returns a Handler for Ping Request | func PingHandler(formatter *render.Render) http.HandlerFunc {
return func(w http.ResponseWriter, req *http.Request) {
formatter.JSON(w, http.StatusOK, struct{ Message string }{"Payments API is up and running !!"})
}
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"func (c *Conn) PingHandler() func(appData string) error {\n\treturn c.handlePing\n}",
"func NewPingHandler(config *config.Config) *PingHandler {\n\treturn &PingHandler{cf: config}\n}",
"func (app *Application) PingHandler() http.Handler {\n\treturn http.HandlerFunc(func(w http.ResponseWriter, request *http.Req... | [
"0.7720891",
"0.76226425",
"0.74403113",
"0.73901325",
"0.7134259",
"0.71059835",
"0.70995325",
"0.7083865",
"0.7082013",
"0.70737785",
"0.701905",
"0.70126235",
"0.69297284",
"0.68595296",
"0.6839317",
"0.6711285",
"0.6630836",
"0.6571368",
"0.6465587",
"0.6418863",
"0.63841... | 0.6801965 | 15 |
MakePaymentHandler returns a Handler for making a payment | func MakePaymentHandler(formatter *render.Render) http.HandlerFunc {
return func(w http.ResponseWriter, req *http.Request) {
log.Printf("Make payment handler function")
fmt.Println("Make payment handler router function")
var payment model.Payment
_ = json.NewDecoder(req.Body).Decode(&payment)
transactionID, _ := service.MakePayment(&payment)
formatter.JSON(w, http.StatusOK, struct {
Success bool
Message string
TransactionID int
}{
true,
"Fee Payment Transaction Recorded Successfully",
transactionID,
})
}
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"func MakePaymentHandlers(r *mux.Router, n negroni.Negroni, service payment.UseCase) {\n\tpaymentsRouter := r.PathPrefix(\"/v1/payments\").Subrouter()\n\tpaymentsRouter.Handle(\"\", n.With(\n\t\tnegroni.Wrap(paymentFindAll(service)),\n\t)).Methods(\"GET\", \"OPTIONS\")\n\n\tpaymentsRouter.Handle(\"/{paymentID}\", n... | [
"0.69572175",
"0.65829253",
"0.6421519",
"0.640149",
"0.6159726",
"0.6038519",
"0.5934669",
"0.5926997",
"0.59172374",
"0.5886439",
"0.58437103",
"0.5839155",
"0.5768513",
"0.57279027",
"0.5699862",
"0.56855047",
"0.56638527",
"0.5659348",
"0.56425124",
"0.5614429",
"0.557001... | 0.77579606 | 0 |
////////////////////////////////////////////////////////////////////////////// CALLBACKS // //////////// | func (mc *MouseCannon) StateEntry() {
for i := 0; i < 20; i++ {
mc.bullets = append(mc.bullets,
&Bullet{
color: sdl.Color{255, 0, 0, 255},
posRect: &sdl.Rect{0, 0, 2, 2},
})
engine.Register(mc.bullets[i])
}
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"func callback(\n\tservice models.DeviceService,\n\tid string,\n\taction string,\n\tactionType models.ActionType,\n\tlc logger.LoggingClient) error {\n\n\tclient := &http.Client{}\n\turl := service.Addressable.GetCallbackURL()\n\tif len(url) > 0 {\n\t\tbody, err := getBody(id, actionType)\n\t\tif err != nil {\n\t\t... | [
"0.59013164",
"0.5869913",
"0.5864536",
"0.57989216",
"0.57925755",
"0.5727821",
"0.57164985",
"0.57053274",
"0.5696967",
"0.5694784",
"0.56891954",
"0.5655518",
"0.5637238",
"0.56134903",
"0.56065613",
"0.55933195",
"0.5590466",
"0.55772394",
"0.55689883",
"0.55651474",
"0.5... | 0.0 | -1 |
////////////////////////////////////////////////////////////////////////////// FUNCTIONS // //////////// | func (mc *MouseCannon) isArmed() bool {
return mc.armed
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"func curate(file *pe.File) []byte {\n\n\tm := make(map[string]interface{})\n\tfields := make([]string, 0)\n\n\tif file.HasDOSHdr {\n\t\tm[\"dos_header\"] = file.DOSHeader\n\t\tfields = append(fields, \"dos_header\")\n\t}\n\n\tif file.HasRichHdr {\n\t\tm[\"rich_header\"] = file.RichHeader\n\t\tfields = append(field... | [
"0.5175247",
"0.4751098",
"0.47478223",
"0.47188663",
"0.46758133",
"0.46617737",
"0.45669132",
"0.45663005",
"0.4564074",
"0.45483142",
"0.45308706",
"0.45184872",
"0.450741",
"0.45017928",
"0.44985196",
"0.44984955",
"0.44978857",
"0.44974223",
"0.4484171",
"0.44783118",
"0... | 0.0 | -1 |
Kinds is a list of known pkger kinds. | func Kinds() []Kind {
var out []Kind
for k := range kinds {
out = append(out, k)
}
return out
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"func (*bzlLibraryLang) Kinds() map[string]rule.KindInfo {\n\treturn kinds\n}",
"func (es ExternalServices) Kinds() (kinds []string) {\n\tset := make(map[string]bool, len(es))\n\tfor _, e := range es {\n\t\tif !set[e.Kind] {\n\t\t\tkinds = append(kinds, e.Kind)\n\t\t\tset[e.Kind] = true\n\t\t}\n\t}\n\treturn kind... | [
"0.67730343",
"0.6455275",
"0.6337542",
"0.63176453",
"0.62905663",
"0.62271625",
"0.61758685",
"0.6062551",
"0.5999965",
"0.5919107",
"0.5728519",
"0.56822056",
"0.54708886",
"0.52446043",
"0.5142412",
"0.511807",
"0.50216275",
"0.49991712",
"0.49917233",
"0.4989127",
"0.498... | 0.70997757 | 0 |
String provides the kind in human readable form. | func (k Kind) String() string {
if kinds[k] {
return string(k)
}
if k == KindUnknown {
return "unknown"
}
return string(k)
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"func (k Kind) String() string {\n\tif k == 0 {\n\t\treturn \"any\"\n\t}\n\tvar ret []string\n\tfor i := uint(0); i < 64; i++ {\n\t\tif k&(1<<i) != 0 {\n\t\t\tif name, ok := kindNames[1<<i]; ok {\n\t\t\t\tret = append(ret, name)\n\t\t\t}\n\t\t}\n\t}\n\tif len(ret) == 0 {\n\t\treturn \"unknown\"\n\t}\n\treturn strin... | [
"0.7882306",
"0.78182817",
"0.7631398",
"0.74356145",
"0.7273103",
"0.7260341",
"0.72308713",
"0.72308713",
"0.72005254",
"0.7159091",
"0.71464866",
"0.70390964",
"0.69976556",
"0.6933344",
"0.6829861",
"0.67954165",
"0.67454123",
"0.674282",
"0.67382026",
"0.67114013",
"0.67... | 0.7552743 | 3 |
OK validates the kind is valid. | func (k Kind) OK() error {
if k == KindUnknown {
return errors.New("invalid kind")
}
if !kinds[k] {
return errors.New("unsupported kind provided")
}
return nil
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"func (kind Kind) IsValid() bool {\n\treturn kind&Invalid == 0\n}",
"func (m *Resource) IsOK() bool {\n\tswitch {\n\tcase len(m.name) == 0:\n\t\treturn false\n\tcase len(m.description) == 0:\n\t\treturn false\n\tcase m.schema == nil:\n\t\treturn false\n\tcase m.model == nil:\n\t\treturn false\n\tcase m.store == n... | [
"0.62202156",
"0.59624",
"0.57328045",
"0.57115155",
"0.5710232",
"0.56863034",
"0.5651936",
"0.5640751",
"0.5633026",
"0.55821824",
"0.5531406",
"0.5531406",
"0.550324",
"0.5461285",
"0.5461285",
"0.5432487",
"0.53961223",
"0.5378424",
"0.53483063",
"0.5335181",
"0.53294885"... | 0.7533541 | 0 |
ResourceType converts a kind to a known resource type (if applicable). | func (k Kind) ResourceType() influxdb.ResourceType {
switch k {
case KindBucket:
return influxdb.BucketsResourceType
case KindCheck, KindCheckDeadman, KindCheckThreshold:
return influxdb.ChecksResourceType
case KindDashboard:
return influxdb.DashboardsResourceType
case KindLabel:
return influxdb.LabelsResourceType
case KindNotificationEndpoint,
KindNotificationEndpointHTTP,
KindNotificationEndpointPagerDuty,
KindNotificationEndpointSlack:
return influxdb.NotificationEndpointResourceType
case KindNotificationRule:
return influxdb.NotificationRuleResourceType
case KindTask:
return influxdb.TasksResourceType
case KindTelegraf:
return influxdb.TelegrafsResourceType
case KindVariable:
return influxdb.VariablesResourceType
default:
return ""
}
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"func kindToResource(kind string, mixedCase bool) (plural, singular string) {\n\tif len(kind) == 0 {\n\t\treturn\n\t}\n\tif mixedCase {\n\t\t// Legacy support for mixed case names\n\t\tsingular = strings.ToLower(kind[:1]) + kind[1:]\n\t} else {\n\t\tsingular = strings.ToLower(kind)\n\t}\n\tswitch string(singular[le... | [
"0.71807873",
"0.69749266",
"0.68243074",
"0.66789937",
"0.63449645",
"0.6294564",
"0.6266824",
"0.6245719",
"0.6232153",
"0.62168616",
"0.6216163",
"0.6209334",
"0.6199783",
"0.6177958",
"0.61682874",
"0.6163824",
"0.6140141",
"0.61386055",
"0.61364526",
"0.6111235",
"0.6102... | 0.70482045 | 1 |
Encode will safely encode the id. | func (s SafeID) Encode() ([]byte, error) {
id := platform.ID(s)
b, _ := id.Encode()
return b, nil
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"func (id ID) Encode() string {\n\tbody := base32i.CheckEncode(id.Bytes())\n\treturn string(append([]byte{'b'}, body...))\n}",
"func EncodeId(sentEmailId uint32) string {\n\tvar buf [4]byte\n\tbuf[0] = byte(sentEmailId >> 24)\n\tbuf[1] = byte(sentEmailId >> 16)\n\tbuf[2] = byte(sentEmailId >> 8)\n\tbuf[3] = byte(... | [
"0.77108073",
"0.66864574",
"0.66426456",
"0.65644044",
"0.6460869",
"0.6443142",
"0.6401249",
"0.6338997",
"0.62644243",
"0.62184376",
"0.6162067",
"0.6094737",
"0.6081955",
"0.6073592",
"0.6046869",
"0.6023225",
"0.599918",
"0.59980166",
"0.5976361",
"0.5976155",
"0.592403"... | 0.77954394 | 0 |
String prints a encoded string representation of the id. | func (s SafeID) String() string {
return platform.ID(s).String()
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"func (id ID) String() string {\n\treturn base64.URLEncoding.EncodeToString(id[:])\n}",
"func (id *Id) String() string {\n\treturn strconv.FormatUint(uint64(*id), 16)\n}",
"func (id ID) String() string {\n\ttext := make([]byte, encodedLen)\n\tencode(text, id[:])\n\treturn *(*string)(unsafe.Pointer(&text))\n}",
... | [
"0.8165663",
"0.8161382",
"0.8121128",
"0.80728704",
"0.80641985",
"0.80392027",
"0.7919137",
"0.79033333",
"0.7877943",
"0.77691376",
"0.7767631",
"0.77567667",
"0.7708006",
"0.7594143",
"0.75821745",
"0.75821745",
"0.75821745",
"0.75687236",
"0.7556296",
"0.75527304",
"0.75... | 0.741215 | 23 |
IsNew indicates the resource is new to the platform. | func (d DiffIdentifier) IsNew() bool {
return d.ID == 0
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"func (me TxsdShow) IsNew() bool { return me == \"new\" }",
"func (me TxsdShow) IsNew() bool { return me.String() == \"new\" }",
"func (c Customer) IsNew() bool {\n\treturn c.ID == 0\n}",
"func (c *Checkpoint) IsNew() bool {\n\treturn c.State == ActiveState && c.ID == 0 && c.EndTime == nil &&\n\t\tc.UUID == n... | [
"0.7124189",
"0.71037585",
"0.7013115",
"0.6765984",
"0.67634845",
"0.6687251",
"0.65053016",
"0.64151883",
"0.63380104",
"0.63252676",
"0.60556406",
"0.60512",
"0.60003394",
"0.58730227",
"0.5747134",
"0.5649383",
"0.5528927",
"0.5502173",
"0.5344137",
"0.52407295",
"0.52377... | 0.6897515 | 3 |
HasConflicts provides a binary t/f if there are any changes within package after dry run is complete. | func (d Diff) HasConflicts() bool {
for _, b := range d.Buckets {
if b.hasConflict() {
return true
}
}
for _, l := range d.Labels {
if l.hasConflict() {
return true
}
}
for _, v := range d.Variables {
if v.hasConflict() {
return true
}
}
return false
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"func (t *Table) HasConflicts(ctx context.Context) (bool, error) {\n\tif t.Format() == types.Format_DOLT {\n\t\tart, err := t.GetArtifacts(ctx)\n\t\tif err != nil {\n\t\t\treturn false, err\n\t\t}\n\n\t\treturn art.HasConflicts(ctx)\n\t}\n\treturn t.table.HasConflicts(ctx)\n}",
"func (rnode *RuleNode) HasConflict... | [
"0.6893376",
"0.5742307",
"0.5700375",
"0.55312514",
"0.5376664",
"0.529813",
"0.52914315",
"0.5250208",
"0.5233584",
"0.52170324",
"0.5205163",
"0.5082322",
"0.5065302",
"0.50519806",
"0.5041187",
"0.5038167",
"0.49985608",
"0.4966648",
"0.4961827",
"0.49594378",
"0.49502417... | 0.67191136 | 1 |
MarshalJSON implementation here is forced by the embedded check value here. | func (d DiffCheckValues) MarshalJSON() ([]byte, error) {
if d.Check == nil {
return json.Marshal(nil)
}
return json.Marshal(d.Check)
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"func mustMarshalJSON(v interface{}) []byte {\n\tb, err := json.Marshal(v)\n\tif err != nil {\n\t\tpanic(\"marshal json: \" + err.Error())\n\t}\n\treturn b\n}",
"func (sc SafetyCheck) MarshalJSON() ([]byte, error) {\n\tsc.Kind = KindSafetyCheck\n\tobjectMap := make(map[string]interface{})\n\tif sc.Kind != \"\" {\... | [
"0.6703141",
"0.6430447",
"0.628579",
"0.62582934",
"0.6081891",
"0.60665685",
"0.6062087",
"0.60332453",
"0.60280246",
"0.5984815",
"0.5958768",
"0.5944417",
"0.5929845",
"0.59293",
"0.59254575",
"0.5917242",
"0.5909856",
"0.58898854",
"0.58615434",
"0.5857886",
"0.5848257",... | 0.6018383 | 9 |
UnmarshalJSON decodes the check values. | func (d *DiffCheckValues) UnmarshalJSON(b []byte) (err error) {
d.Check, err = icheck.UnmarshalJSON(b)
if errors2.EInternal == errors2.ErrorCode(err) {
return nil
}
return err
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"func (v *AndroidCheckRule) UnmarshalJSON(data []byte) error {\n\tr := jlexer.Lexer{Data: data}\n\teasyjson795c59c6DecodeGrapeGuardRules12(&r, v)\n\treturn r.Error()\n}",
"func (v *ItemCheckResponse) UnmarshalJSON(data []byte) error {\n\tr := jlexer.Lexer{Data: data}\n\teasyjson6a975c40DecodeJsonBenchmark2(&r, v)... | [
"0.6849288",
"0.6813789",
"0.67794085",
"0.65396965",
"0.6531918",
"0.64446926",
"0.63754225",
"0.6328835",
"0.6325424",
"0.6293037",
"0.62720406",
"0.6265991",
"0.6262729",
"0.62530154",
"0.62403893",
"0.6238377",
"0.6227791",
"0.61955345",
"0.6188854",
"0.6162939",
"0.61487... | 0.75885034 | 0 |
MarshalJSON implementation here is forced by the embedded check value here. | func (d DiffNotificationEndpointValues) MarshalJSON() ([]byte, error) {
if d.NotificationEndpoint == nil {
return json.Marshal(nil)
}
return json.Marshal(d.NotificationEndpoint)
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"func mustMarshalJSON(v interface{}) []byte {\n\tb, err := json.Marshal(v)\n\tif err != nil {\n\t\tpanic(\"marshal json: \" + err.Error())\n\t}\n\treturn b\n}",
"func (sc SafetyCheck) MarshalJSON() ([]byte, error) {\n\tsc.Kind = KindSafetyCheck\n\tobjectMap := make(map[string]interface{})\n\tif sc.Kind != \"\" {\... | [
"0.6702867",
"0.64294523",
"0.6286051",
"0.6258406",
"0.6081727",
"0.6065949",
"0.6061521",
"0.6033792",
"0.60271937",
"0.601817",
"0.5984657",
"0.5958404",
"0.5944886",
"0.59299093",
"0.59280074",
"0.5925472",
"0.5916274",
"0.5909515",
"0.5889001",
"0.58614844",
"0.5856765",... | 0.0 | -1 |
UnmarshalJSON decodes the notification endpoint. This is necessary unfortunately. | func (d *DiffNotificationEndpointValues) UnmarshalJSON(b []byte) (err error) {
d.NotificationEndpoint, err = endpoint.UnmarshalJSON(b)
if errors2.EInvalid == errors2.ErrorCode(err) {
return nil
}
return
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"func (n *Notification) UnmarshalJSON(b []byte) error {\n\tnotification := map[string]interface{}{}\n\n\terr := json.Unmarshal(b, ¬ification)\n\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif notification[\"_id\"] != nil && bson.IsObjectIdHex(notification[\"_id\"].(string)) {\n\t\tn.ID = bson.ObjectIdHex(notific... | [
"0.7236028",
"0.7215726",
"0.6961847",
"0.67759407",
"0.67417806",
"0.67417806",
"0.67417806",
"0.6726022",
"0.66012084",
"0.65831494",
"0.6509571",
"0.6504241",
"0.6405176",
"0.64035046",
"0.63879925",
"0.63658404",
"0.63658404",
"0.63457674",
"0.6283621",
"0.62764734",
"0.6... | 0.7383068 | 0 |
MarshalJSON marshals a summary chart. | func (s *SummaryChart) MarshalJSON() ([]byte, error) {
b, err := influxdb.MarshalViewPropertiesJSON(s.Properties)
if err != nil {
return nil, err
}
type alias SummaryChart
out := struct {
Props json.RawMessage `json:"properties"`
alias
}{
Props: b,
alias: alias(*s),
}
return json.Marshal(out)
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"func (ss StatsSummary) MarshalJSON() ([]byte, error) {\n\ttype Alias StatsSummary\n\tresp := struct {\n\t\tStatDate *string `json:\"statDate\"`\n\t\tSummaryTime string `json:\"summaryTime\"`\n\t\tAlias\n\t}{\n\t\tSummaryTime: ss.SummaryTime.Format(TimeLayout),\n\t\tAlias: (Alias)(ss),\n\t}\n\tif ss.StatD... | [
"0.63141054",
"0.6245847",
"0.5888697",
"0.5545922",
"0.5509937",
"0.54198235",
"0.5396004",
"0.5379865",
"0.53409183",
"0.5336062",
"0.5316955",
"0.53086776",
"0.52871865",
"0.5250192",
"0.5250104",
"0.52132285",
"0.5193233",
"0.51777637",
"0.51521647",
"0.515026",
"0.510514... | 0.69818693 | 0 |
UnmarshalJSON unmarshals a view properties and other data. | func (s *SummaryChart) UnmarshalJSON(b []byte) error {
type alias SummaryChart
a := (*alias)(s)
if err := json.Unmarshal(b, a); err != nil {
return err
}
s.XPosition = a.XPosition
s.XPosition = a.YPosition
s.Height = a.Height
s.Width = a.Width
vp, err := influxdb.UnmarshalViewPropertiesJSON(b)
if err != nil {
return err
}
s.Properties = vp
return nil
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"func (v *ViewProperties) UnmarshalJSON(data []byte) error {\n\tvar rawMsg map[string]json.RawMessage\n\tif err := json.Unmarshal(data, &rawMsg); err != nil {\n\t\treturn err\n\t}\n\tfor key, val := range rawMsg {\n\t\tvar err error\n\t\tswitch key {\n\t\tcase \"accumulated\":\n\t\t\terr = unpopulate(val, &v.Accumu... | [
"0.7521359",
"0.69134307",
"0.6182066",
"0.60080624",
"0.5860861",
"0.56737185",
"0.56453896",
"0.5628084",
"0.5626881",
"0.5614671",
"0.5613706",
"0.56116426",
"0.5608741",
"0.5591743",
"0.5576611",
"0.5567037",
"0.55564475",
"0.5552273",
"0.5540684",
"0.5507903",
"0.5496686... | 0.57720464 | 5 |
UnmarshalJSON unmarshals the notificatio endpoint. This is necessary b/c of the notification endpoint does not have a means ot unmarshal itself. | func (s *SummaryNotificationEndpoint) UnmarshalJSON(b []byte) error {
var a struct {
SummaryIdentifier
NotificationEndpoint json.RawMessage `json:"notificationEndpoint"`
LabelAssociations []SummaryLabel `json:"labelAssociations"`
}
if err := json.Unmarshal(b, &a); err != nil {
return err
}
s.SummaryIdentifier = a.SummaryIdentifier
s.LabelAssociations = a.LabelAssociations
e, err := endpoint.UnmarshalJSON(a.NotificationEndpoint)
s.NotificationEndpoint = e
return err
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"func (n *Notification) UnmarshalJSON(b []byte) error {\n\tnotification := map[string]interface{}{}\n\n\terr := json.Unmarshal(b, ¬ification)\n\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif notification[\"_id\"] != nil && bson.IsObjectIdHex(notification[\"_id\"].(string)) {\n\t\tn.ID = bson.ObjectIdHex(notific... | [
"0.69373727",
"0.65384173",
"0.6510438",
"0.62654644",
"0.6248569",
"0.6122419",
"0.604768",
"0.6027493",
"0.60112524",
"0.59933054",
"0.5926565",
"0.5925177",
"0.5888255",
"0.5877787",
"0.58761215",
"0.58761215",
"0.58761215",
"0.5857041",
"0.5844848",
"0.5835386",
"0.580605... | 0.62947893 | 3 |
Checks that the given request has a valid session | func CheckAuth(c *gin.Context) {
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"func IsSession(r *http.Request) bool {\n\tval := r.Context().Value(authSessionActiveKey)\n\tswitch val.(type) {\n\tcase bool:\n\t\treturn val.(bool)\n\tdefault:\n\t\treturn false\n\t}\n}",
"func SessionCheck(writer http.ResponseWriter, request *http.Request) (sess Session, err error) {\n\tcookie, err := request.... | [
"0.68616503",
"0.6834911",
"0.6676546",
"0.66695386",
"0.6328408",
"0.63170826",
"0.6307383",
"0.62890023",
"0.62826055",
"0.6258494",
"0.6256342",
"0.6208338",
"0.61973584",
"0.61390716",
"0.61384505",
"0.61313486",
"0.61105573",
"0.6034856",
"0.6005577",
"0.59854245",
"0.59... | 0.0 | -1 |
Random returns random string from letters with length | func Random(length int, letters string) string {
bytes := make([]byte, length)
// A src.Int63() generates 63 random bits, enough for letterIdxMax characters!
for index, cache, remain := length-1, randomize.Int63(), letterIdxMax; index >= 0; {
if remain == 0 {
cache, remain = randomize.Int63(), letterIdxMax
}
if idx := int(cache & letterIdxMask); idx < len(letters) {
bytes[index] = letters[idx]
index--
}
cache >>= letterIdxBits
remain--
}
return *(*string)(unsafe.Pointer(&bytes))
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"func generateRandomString(length int) string {\n\tletterRunes := []rune(\"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789\")\n\tb := make([]rune, length)\n\tfor i := range b {\n\t\tb[i] = letterRunes[rand.Intn(len(letterRunes))]\n\t}\n\treturn string(b)\n}",
"func generateRandString(length int) st... | [
"0.83070576",
"0.8210682",
"0.8164084",
"0.8048164",
"0.802901",
"0.80230534",
"0.8022366",
"0.8022267",
"0.7973639",
"0.79713494",
"0.796581",
"0.79470444",
"0.79470444",
"0.7938094",
"0.79303855",
"0.7924201",
"0.79141414",
"0.79013175",
"0.79013175",
"0.7890087",
"0.786210... | 0.8115874 | 3 |
Fetch the updated stats | func (s *StatFS) Fetch() error {
return syscall.Statfs(s.path, &s.stat)
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"func (c *StatsCollector) fetchStats() (map[string]string, error) {\n\n\t// TODO measure rpc time\n\t//timer := prometheus.NewTimer(rpc_request_duration)\n\t//defer timer.ObserveDuration()\n\n\t// establish connection to Kamailio server\n\tvar err error\n\tvar conn net.Conn\n\tif c.kamailioHost == \"\" {\n\t\tlog.D... | [
"0.6630799",
"0.63485396",
"0.626949",
"0.62368155",
"0.6143968",
"0.5994762",
"0.59772927",
"0.5966089",
"0.59394723",
"0.59333026",
"0.59260935",
"0.58925277",
"0.5889321",
"0.58758885",
"0.5873812",
"0.58506167",
"0.5810288",
"0.5777145",
"0.5775306",
"0.5769908",
"0.57540... | 0.0 | -1 |
MaxFiles that can be written based on filesize and free blocks | func (s *StatFS) MaxFiles(size int) int {
return int(s.stat.Bfree / (uint64(size) / uint64(s.stat.Bsize)))
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"func DefineFiles(tsize uint64, hilimit uint64, flS *FileCollection) error {\n\tvar nfiles, remain uint64\n\ttfs, err := flS.totalFileSize() \n\tif err != nil {\n\t\tlog.Printf(\"DefineFiles(): Error computing total file size: %s\", err.Error())\n\t\treturn err\n\t}\n\tif tsize > tfs && tsize > hilimit { //Trying t... | [
"0.67073935",
"0.6590335",
"0.65184194",
"0.61902106",
"0.61621016",
"0.6069341",
"0.59757304",
"0.57250816",
"0.56450105",
"0.55433017",
"0.5528977",
"0.55281764",
"0.54828227",
"0.54323435",
"0.5431975",
"0.5417879",
"0.5390343",
"0.5368576",
"0.5367149",
"0.5358498",
"0.53... | 0.6947793 | 0 |
BlockFiles calculates the amount of blocks needes for a file based on filesize and blocksize | func (s *StatFS) BlockFiles(size int) int {
return size / int(s.stat.Bsize)
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"func blocks(n int) int {\n\tb := align(n+2, blocksize)\n\treturn b / blocksize\n}",
"func (d *digest) BlockSize() int { return 1 }",
"func calculateBlocks(size uint64, isDecrypt bool) (blocks uint64) {\n\tblocks = size / BlockSize\n\tif !isDecrypt {\n\t\tblocks++\n\t}\n\treturn\n}",
"func (sm3 *SM3) BlockSiz... | [
"0.6831651",
"0.64359915",
"0.6351425",
"0.61531454",
"0.60735196",
"0.6053935",
"0.59970754",
"0.59917593",
"0.59917593",
"0.59467095",
"0.59163296",
"0.5890694",
"0.5873502",
"0.5858289",
"0.58537126",
"0.5849925",
"0.58035946",
"0.5725327",
"0.57226384",
"0.5721372",
"0.57... | 0.78074825 | 0 |
Returns a quic.Session object with a .OpenStreamSync method to send streams | func DialAsQuicClient(ctx context.Context, hostname string, port int) (quic.Session, error) {
// TODO(jophba): Change InsecureSkipVerify
tlsConfig := &tls.Config{InsecureSkipVerify: true}
addr := fmt.Sprintf("%s:%d", hostname, port)
session, err := quic.DialAddrContext(ctx, addr, tlsConfig, nil)
return session, err
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"func (s *Session) Open() (str *Stream, err error) {\n\t// Wait for acks\n\tselect {\n\tcase s.opened <- struct{}{}:\n\tcase <-s.done:\n\t\treturn nil, ErrSessionClosed\n\t}\n\tsid := s.generateStreamID()\n\tif sid == 0 {\n\t\treturn nil, ErrMaxOpenStreams\n\t}\n\tstr = newStream(s, sid)\n\tif _, err = str.SendWind... | [
"0.63929254",
"0.63021433",
"0.5947112",
"0.59255314",
"0.5806985",
"0.575277",
"0.5727995",
"0.57169294",
"0.57070553",
"0.57049143",
"0.5697204",
"0.5692881",
"0.5660469",
"0.56468356",
"0.5645025",
"0.56316733",
"0.56232727",
"0.5610288",
"0.56046814",
"0.5600436",
"0.5599... | 0.0 | -1 |
DSL returns the attached DSL. | func (e *Element) DSL() func() { return e.DSLFunc } | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"func (a *AttributeDefinition) DSL() func() {\n\treturn a.DSLFunc\n}",
"func (t *TraitDefinition) DSL() func() {\n\treturn t.DSLFunc\n}",
"func RunHTTPDSL(t *testing.T, dsl func()) *RootExpr {\n\tsetupDSLRun()\n\n\t// run DSL (first pass)\n\tif !eval.Execute(dsl, nil) {\n\t\tt.Fatal(eval.Context.Error())\n\t}\n... | [
"0.72912025",
"0.71394557",
"0.52221245",
"0.47624788",
"0.47548372",
"0.46640116",
"0.46548972",
"0.46548972",
"0.46406454",
"0.45281145",
"0.45281145",
"0.44300607",
"0.44300607",
"0.44285825",
"0.44285825",
"0.44161195",
"0.43295914",
"0.43234164",
"0.43234164",
"0.42773739"... | 0.7892379 | 0 |
Finalize finalizes the relationships. | func (e *Element) Finalize() {
for _, rel := range e.Relationships {
rel.Finalize()
}
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"func (g *Graph) Finalize() error {\n\tfor _, node := range g.Nodes {\n\t\tif node.Kind == \"Cluster\" || node.Kind == \"Namespace\" {\n\t\t\tcontinue\n\t\t}\n\n\t\tif _, ok := g.Relationships[node.UID]; ok {\n\t\t\tcontinue\n\t\t}\n\n\t\tif len(node.GetNamespace()) == 0 {\n\t\t\tcluster, err := g.CoreV1().Cluster(... | [
"0.74310845",
"0.6169468",
"0.6152649",
"0.5992198",
"0.59840745",
"0.5963255",
"0.59058857",
"0.589553",
"0.5820891",
"0.5803074",
"0.5767071",
"0.56872946",
"0.565301",
"0.5554321",
"0.5549271",
"0.5516171",
"0.5505405",
"0.54880655",
"0.54810625",
"0.5472923",
"0.5462089",... | 0.8170965 | 0 |
GetElement returns the underlying element. | func (e *Element) GetElement() *Element { return e } | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"func (e emptyBackEnd) GetElement(i *Element) interface{} {\n\treturn \"not nil!\"\n}",
"func (x *Path) GetElement() []string {\n\tif x != nil {\n\t\treturn x.Element\n\t}\n\treturn nil\n}",
"func (m *TimeoutMap) GetElement(id string) (Element, bool) {\n\tm.mu.RLock()\n\tdefer m.mu.RUnlock()\n\tvar el Element =... | [
"0.68505967",
"0.63871956",
"0.6307817",
"0.62885356",
"0.62882924",
"0.62737614",
"0.6238111",
"0.6231037",
"0.61693996",
"0.61534953",
"0.6141453",
"0.6129889",
"0.6086939",
"0.59937763",
"0.592392",
"0.59199315",
"0.58983856",
"0.58807564",
"0.58547294",
"0.5854002",
"0.57... | 0.82764304 | 0 |
MergeTags adds the given tags. It skips tags already present in e.Tags. | func (e *Element) MergeTags(tags ...string) {
e.Tags = mergeTags(e.Tags, tags)
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"func MergeTags(generalTags []*Tag, infraTags []*Tag) []*Tag {\n\tvar dupMap = make(map[string]bool)\n\tfor _, tag := range generalTags {\n\t\tdupMap[tag.Key] = true\n\t}\n\tfor _, tag := range infraTags {\n\t\tif _, exists := dupMap[tag.Key]; !exists {\n\t\t\tgeneralTags = append(generalTags, tag)\n\t\t}\n\t}\n\tr... | [
"0.69267917",
"0.66822976",
"0.6641655",
"0.6398739",
"0.60571116",
"0.60490227",
"0.59776914",
"0.5947697",
"0.5940782",
"0.59327805",
"0.58563393",
"0.583582",
"0.5833119",
"0.58270645",
"0.5826986",
"0.5785081",
"0.57704574",
"0.5765203",
"0.57195115",
"0.57146055",
"0.570... | 0.72073734 | 0 |
PrefixTags adds the given tags to the beginning of the comma separated list. | func (e *Element) PrefixTags(tags ...string) {
prefix := strings.Join(tags, ",")
if e.Tags == "" {
e.Tags = prefix
return
}
e.Tags = mergeTags(prefix, strings.Split(e.Tags, ","))
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"func TagsHasPrefix(v string) predicate.Project {\n\treturn predicate.Project(func(s *sql.Selector) {\n\t\ts.Where(sql.HasPrefix(s.C(FieldTags), v))\n\t})\n}",
"func (e *Extractor) NamesFromTagWithPrefix(tag string, prefix string) (out []string, err error) {\n\n\tif err := e.isValidStruct(); err != nil {\n\t\tret... | [
"0.6147257",
"0.59784806",
"0.5961276",
"0.5960882",
"0.5945469",
"0.55871814",
"0.54802436",
"0.54000705",
"0.53906906",
"0.5346082",
"0.5337324",
"0.5337324",
"0.53358513",
"0.52466637",
"0.52123576",
"0.51916856",
"0.518039",
"0.5169964",
"0.5168189",
"0.51646787",
"0.5117... | 0.8500971 | 0 |
mergeTags merges the comma separated tags in old with the ones in tags and returns a comma separated string with the results. | func mergeTags(existing string, tags []string) string {
if existing == "" {
return strings.Join(tags, ",")
}
old := strings.Split(existing, ",")
var merged []string
for _, o := range old {
found := false
for _, tag := range tags {
if tag == o {
found = true
break
}
}
if !found {
merged = append(merged, o)
}
}
for _, tag := range tags {
found := false
for _, o := range merged {
if tag == o {
found = true
break
}
}
if !found {
merged = append(merged, tag)
}
}
return strings.Join(merged, ",")
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"func mergeTags(t1, t2 []Tag) []Tag {\n\tn := len(t1) + len(t2)\n\tif n == 0 {\n\t\treturn nil\n\t}\n\n\tout := make([]Tag, 0, n)\n\tout = append(out, t1...)\n\tout = append(out, t2...)\n\n\treturn SortTags(out)\n}",
"func (p *plugin) concatTags(tags1 *structtag.Tags, tags2 *structtag.Tags) (*structtag.Tags, erro... | [
"0.65004945",
"0.64422244",
"0.6354086",
"0.62970436",
"0.6101939",
"0.59882367",
"0.59166086",
"0.5755861",
"0.5537153",
"0.5528983",
"0.5473174",
"0.5382972",
"0.53700674",
"0.5263985",
"0.52288485",
"0.5228463",
"0.5219212",
"0.52181876",
"0.5166654",
"0.5160324",
"0.51315... | 0.7932081 | 0 |
do nothing, it's a posix specific feature at the moment | func suspend() {} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"func (s *Server) isUnixSocket() bool {\n\treturn false\n}",
"func fakeSyscall(duration time.Duration) {\n\truntime.Entersyscall()\n\tfor start := runtime.Nanotime(); runtime.Nanotime()-start < int64(duration); {\n\t}\n\truntime.Exitsyscall()\n}",
"func testUnixAddr() string {\n\tf, err := os.CreateTemp(\"\", \... | [
"0.5275571",
"0.5275274",
"0.526875",
"0.52434105",
"0.5234334",
"0.51867586",
"0.51269925",
"0.50681794",
"0.5060849",
"0.5052121",
"0.49770987",
"0.49730974",
"0.49512863",
"0.48924834",
"0.4852543",
"0.48440093",
"0.48321727",
"0.48252714",
"0.481353",
"0.48109722",
"0.479... | 0.0 | -1 |
Git Call git command with arguments. All print out displayed. It returns git Return code. | func Do(opts ...string) int {
colorCyan, colorReset := utils.DefColor(36)
log.Printf("%sgit %s%s\n", colorCyan, strings.Join(opts, " "), colorReset)
return utils.RunCmd("git", opts...)
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"func Git(cmd string, args ...string) (res *exec.Cmd, stdout, stderr *bytes.Buffer) {\n\tcmdArgs := make([]string, 1)\n\tcmdArgs[0] = cmd\n\tcmdArgs = append(cmdArgs, args...)\n\tres = exec.Command(gitCmd, cmdArgs...)\n\tstdout, stderr = new(bytes.Buffer), new(bytes.Buffer)\n\tres.Stdout, res.Stderr = stdout, stder... | [
"0.7911547",
"0.71259296",
"0.7000005",
"0.69734985",
"0.6904909",
"0.67912936",
"0.666957",
"0.6618324",
"0.6606666",
"0.6528801",
"0.6436387",
"0.6329439",
"0.6293814",
"0.6277394",
"0.6271859",
"0.62361526",
"0.6219715",
"0.61598617",
"0.6095661",
"0.60269254",
"0.59765816... | 0.56290394 | 35 |
Call a git command and get the output as string output. | func Get(opts ...string) (string, error) {
gotrace.Trace("RUNNING: git %s", strings.Join(opts, " "))
out, err := exec.Command("git", opts...).Output()
return string(out), err
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"func (gitCommand *GitCommand) RunAndGetOutput() []byte {\n\tstdout, err := gitCommand.Run(false)\n\tif err != nil {\n\t\treturn []byte{}\n\t}\n\n\tdata, err := ioutil.ReadAll(stdout)\n\tif err != nil {\n\t\treturn []byte{}\n\t}\n\n\treturn data\n}",
"func Git(cmd string, args ...string) (res *exec.Cmd, stdout, s... | [
"0.74961495",
"0.74380195",
"0.72340816",
"0.7192161",
"0.6944512",
"0.69108826",
"0.68365854",
"0.6786665",
"0.66299236",
"0.6544166",
"0.647694",
"0.6359478",
"0.6296321",
"0.62803876",
"0.6264853",
"0.6264695",
"0.6105203",
"0.610021",
"0.6060656",
"0.604493",
"0.6029006",... | 0.7203828 | 3 |
Commit Do a git commit | func Commit(msg string, errorIfEmpty bool) error {
s := Status()
if len(s.Added) == 0 {
return fmt.Errorf("No files added. Please check.")
}
if Do("commit", "-m", msg) > 0 {
return fmt.Errorf("Unable to commit.")
}
return nil
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"func (h *Host) Commit(msg string) error {\n\th.save()\n\treturn h.maybeGitCommit(h.Serial + \": \" + msg)\n}",
"func commit(msg string) {\n\tgit := exec.Command(\"git\", \"commit\", \"-m\", msg)\n\tgitOut, err := git.Output()\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tfmt.Println(string(gitOut))\n}",
"func (ma... | [
"0.7253733",
"0.7246724",
"0.72047913",
"0.71192944",
"0.71116143",
"0.6984826",
"0.69353336",
"0.6924362",
"0.68456167",
"0.6838363",
"0.6761796",
"0.67052233",
"0.6679999",
"0.6579832",
"0.65475893",
"0.64579743",
"0.6450618",
"0.6381569",
"0.63741416",
"0.63672525",
"0.636... | 0.64495957 | 17 |
GitPush Push latest commits | func Push() error {
if Do("push") > 0 {
return fmt.Errorf("Unable to push commits.")
}
return nil
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"func (g Git) Push(branch string) ([]byte, error) {\n\tif branch == \"\" {\n\t\tbranch = \"master\"\n\t}\n\tcmd := exec.Command(\"git\", \"push\", \"-f\", \"-q\", g.Repo, branch)\n\tcmd.Dir = g.Work\n\treturn cmd.CombinedOutput()\n}",
"func gitPush(c *cli.Context) error {\n\t// inputs\n\tremote, branch := c.Args(... | [
"0.7113327",
"0.7086695",
"0.69694716",
"0.66233176",
"0.6561084",
"0.6558431",
"0.6540989",
"0.6505147",
"0.6372477",
"0.6327776",
"0.6313685",
"0.6308401",
"0.6247429",
"0.62335414",
"0.62103194",
"0.6168965",
"0.61616284",
"0.6116616",
"0.61156374",
"0.61033505",
"0.607903... | 0.6263923 | 12 |
NewLimitedWriter will automatically Close the writer on certain conditions defined by options. Since some options include async events the writes will be mutex protected meaning only 1 thread will be able to call Write/Close at the time | func NewLimitedWriter(w io.WriteCloser, options ...LimitedWriterOption) io.WriteCloser {
for _, o := range options {
w = o(w)
}
return NewSyncedWriteCloser(w)
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"func NewLimitedWriter(w io.Writer, limit int) io.Writer {\n\treturn &limitedWriter{w, limit}\n}",
"func ConcurrentWriteLimit(n int) LoggerOption { return concurrentWriteLimit(n) }",
"func RateLimitedWriter(w io.Writer, config *Configuration) io.Writer {\n\tif !config.isRateLimitedWr() {\n\t\treturn w\n\t}\n\tr... | [
"0.716447",
"0.69312716",
"0.66316056",
"0.6544516",
"0.59969217",
"0.59826624",
"0.59427977",
"0.5693132",
"0.5654763",
"0.56334114",
"0.5568591",
"0.5514889",
"0.54932827",
"0.54898715",
"0.54849005",
"0.5482889",
"0.5476103",
"0.54604113",
"0.5444612",
"0.541179",
"0.53988... | 0.79731476 | 0 |
WithMaxBytes will block writes which would make the total stream larger than maxBytes. | func WithMaxBytes(maxBytes int) LimitedWriterOption {
bytesWritten := 0
return func(w io.WriteCloser) io.WriteCloser {
preCheck := NewPreWriteCallbacks(w, func(p []byte) error {
if bytesWritten+len(p) > maxBytes {
if err := w.Close(); err != nil {
return fmt.Errorf("failed to close WriteCloser writing maxBytes; Close error was: %w", err)
}
return ErrTooLargeWrite
}
return nil
})
return NewPostWriteCallbacks(preCheck, func(p []byte, n int, err error) {
bytesWritten += n
})
}
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"func WithMaxInflightBytes(n int) WriterOption {\n\treturn func(ms *ManagedStream) {\n\t\tms.streamSettings.MaxInflightBytes = n\n\t}\n}",
"func MaxBytes(m int64) optionSetter {\n\treturn func(o *options) error {\n\t\to.maxBytes = m\n\t\treturn nil\n\t}\n}",
"func WithMaxBytes(maxBytes int) ProducerOption {\n\t... | [
"0.64424664",
"0.63611335",
"0.63254035",
"0.6157941",
"0.6022508",
"0.58639663",
"0.5862048",
"0.585846",
"0.57976556",
"0.579048",
"0.5726838",
"0.5713632",
"0.5687121",
"0.56670904",
"0.56304896",
"0.5605672",
"0.5575398",
"0.5557216",
"0.5519068",
"0.5500462",
"0.5431439"... | 0.73057044 | 0 |
Deprecated: Use Orden.ProtoReflect.Descriptor instead. | func (*Orden) Descriptor() ([]byte, []int) {
return file_chat_proto_rawDescGZIP(), []int{0}
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"func ProtoFromDescriptor(d protoreflect.Descriptor) proto.Message {\n\tswitch d := d.(type) {\n\tcase protoreflect.FileDescriptor:\n\t\treturn ProtoFromFileDescriptor(d)\n\tcase protoreflect.MessageDescriptor:\n\t\treturn ProtoFromMessageDescriptor(d)\n\tcase protoreflect.FieldDescriptor:\n\t\treturn ProtoFromFiel... | [
"0.7074704",
"0.705885",
"0.7006217",
"0.69509065",
"0.69417596",
"0.68928474",
"0.6831902",
"0.68113196",
"0.68061244",
"0.6795427",
"0.6787744",
"0.6785139",
"0.67669904",
"0.6762595",
"0.6745581",
"0.6745484",
"0.6744348",
"0.674337",
"0.6737492",
"0.6733155",
"0.6728783",... | 0.0 | -1 |
Deprecated: Use Paquete.ProtoReflect.Descriptor instead. | func (*Paquete) Descriptor() ([]byte, []int) {
return file_chat_proto_rawDescGZIP(), []int{1}
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"func ProtoFromDescriptor(d protoreflect.Descriptor) proto.Message {\n\tswitch d := d.(type) {\n\tcase protoreflect.FileDescriptor:\n\t\treturn ProtoFromFileDescriptor(d)\n\tcase protoreflect.MessageDescriptor:\n\t\treturn ProtoFromMessageDescriptor(d)\n\tcase protoreflect.FieldDescriptor:\n\t\treturn ProtoFromFiel... | [
"0.71970433",
"0.69474417",
"0.68986475",
"0.6868476",
"0.68605566",
"0.68491507",
"0.6848551",
"0.683634",
"0.683079",
"0.6795646",
"0.6790544",
"0.6761866",
"0.67528534",
"0.67488086",
"0.67405385",
"0.6737484",
"0.6721846",
"0.6719707",
"0.6711924",
"0.6711404",
"0.6706742... | 0.6704001 | 22 |
Deprecated: Use Message.ProtoReflect.Descriptor instead. | func (*Message) Descriptor() ([]byte, []int) {
return file_chat_proto_rawDescGZIP(), []int{2}
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"func ProtoFromMessageDescriptor(d protoreflect.MessageDescriptor) *descriptorpb.DescriptorProto {\n\ttype canProto interface {\n\t\tMessageDescriptorProto() *descriptorpb.DescriptorProto\n\t}\n\tif res, ok := d.(canProto); ok {\n\t\treturn res.MessageDescriptorProto()\n\t}\n\tif res, ok := d.(DescriptorProtoWrappe... | [
"0.7343522",
"0.7332535",
"0.72937775",
"0.71048754",
"0.7050007",
"0.6987258",
"0.6960036",
"0.691296",
"0.68633527",
"0.6859684",
"0.68459857",
"0.6845709",
"0.68352896",
"0.68222934",
"0.6815316",
"0.68140835",
"0.6813839",
"0.68118334",
"0.6800345",
"0.68002284",
"0.67994... | 0.67455775 | 33 |
Path Type implements the starlark.Value.Type() method. | func (p Path) Type() string {
return fmt.Sprintf("Path")
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"func (p Path) Type(reference, value interface{}) Path { return p.with(Type, reference, value) }",
"func Type(value r.Value) r.Type {\n\tif !value.IsValid() || value == None {\n\t\treturn nil\n\t}\n\treturn value.Type()\n}",
"func (value *Value) Type() Type {\n\treturn value.valueType\n}",
"func (a ValueNode)... | [
"0.7426185",
"0.67868197",
"0.6723539",
"0.6706437",
"0.657168",
"0.6492181",
"0.64873666",
"0.6484821",
"0.6484744",
"0.64651024",
"0.64247006",
"0.64185387",
"0.64053804",
"0.6343937",
"0.633024",
"0.6304487",
"0.6299285",
"0.62893945",
"0.62660074",
"0.62631536",
"0.623611... | 0.7162587 | 1 |
Freeze implements the starlark.Value.Freeze() method. | func (p Path) Freeze() {} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"func (i *Index) Freeze() {\n\ti.frozen = true\n}",
"func (p *Poly) freeze() {\n\tfor i := 0; i < n; i++ {\n\t\tp[i] = freeze(p[i])\n\t}\n}",
"func freeze(o *goja.Object) {\n\tfor _, key := range o.Keys() {\n\t\to.DefineDataProperty(key, o.Get(key), goja.FLAG_FALSE, goja.FLAG_FALSE, goja.FLAG_TRUE)\n\t}\n}",
... | [
"0.6292724",
"0.6172568",
"0.6090478",
"0.60317403",
"0.5963623",
"0.58790493",
"0.5820719",
"0.57209927",
"0.5712187",
"0.56367314",
"0.5491579",
"0.5445859",
"0.5395169",
"0.53697157",
"0.53642315",
"0.5219047",
"0.5203252",
"0.52030545",
"0.51646525",
"0.5120046",
"0.50957... | 0.5367814 | 14 |
Truth implements the starlark.Value.Truth() method. | func (p Path) Truth() starlark.Bool { return starlark.True } | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"func truth(r reflect.Value) bool {\nout:\n\tswitch r.Kind() {\n\tcase reflect.Array, reflect.Slice:\n\t\treturn r.Len() > 0\n\tcase reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64:\n\t\treturn r.Int() > 0\n\tcase reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64:\n\... | [
"0.6300829",
"0.60781026",
"0.60108006",
"0.58833617",
"0.58359164",
"0.5806103",
"0.5771532",
"0.57651114",
"0.5737598",
"0.57369924",
"0.57280886",
"0.57044286",
"0.5695262",
"0.5693679",
"0.56920135",
"0.568601",
"0.5668572",
"0.56666636",
"0.563851",
"0.5629889",
"0.56166... | 0.5112665 | 85 |
Hash32 implements the Arg.Hash32() method. | func (p Path) Hash32(h hash.Hash32) { h.Write([]byte(p)) } | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"func (t *Target) Hash32(h hash.Hash32) {\n\th.Write([]byte(t.Name))\n\th.Write([]byte(t.Builder))\n\tfor _, arg := range t.Args {\n\t\targ.Hash32(h)\n\t}\n\tfor _, env := range t.Env {\n\t\th.Write([]byte(env))\n\t}\n}",
"func CalcHash32(data []byte) Hash32 {\n\treturn hash.Sum(data)\n}",
"func (s String) Hash... | [
"0.74894154",
"0.72687817",
"0.7188007",
"0.69853705",
"0.6892721",
"0.67331547",
"0.6720686",
"0.67194086",
"0.6649251",
"0.66210663",
"0.65797126",
"0.6577248",
"0.6553477",
"0.6546589",
"0.6525743",
"0.64986825",
"0.64651316",
"0.6463679",
"0.64490825",
"0.63933766",
"0.63... | 0.7510771 | 0 |
Hash implements the starlark.Value.Hash() method. | func (p Path) Hash() (uint32, error) {
return adler32.Checksum([]byte(p)), nil
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"func Hash(value int64) uint64 {\n\treturn FNVHash64(uint64(value))\n}",
"func (n *SoupNode) Hash() (uint32, error) {\n\treturn hashString(fmt.Sprintf(\"%v\", *n)), nil\n}",
"func (o *ObjectIndex) Hash() uint32 {\n\tvar h uint32 = 17\n\n\tvar str string\n\tstr += fmt.Sprintf(\"%08x\", o.machine)\n\tstr += fmt.S... | [
"0.7138284",
"0.7119623",
"0.7041903",
"0.700204",
"0.7000892",
"0.69765645",
"0.6946901",
"0.69159335",
"0.69111687",
"0.6884624",
"0.68813616",
"0.6854573",
"0.6839519",
"0.68087643",
"0.68017894",
"0.6779525",
"0.6749075",
"0.67478395",
"0.6744907",
"0.6727617",
"0.6685133... | 0.6400822 | 61 |
starlarkPath parses Starlark kw/args and returns a corresponding `Path` | func starlarkPath(
args starlark.Tuple,
kwargs []starlark.Tuple,
) (starlark.Value, error) {
if len(args) != 1 {
return nil, errors.Errorf(
"Expected exactly 1 positional argument; found %d",
len(args),
)
}
if len(kwargs) != 0 {
return nil, errors.Errorf(
"Expected exactly 0 positional arguments; found %d",
len(kwargs),
)
}
if s, ok := args[0].(starlark.String); ok {
return Path(s), nil
}
return nil, errors.Errorf(
"TypeError: Expected a string argument; found %s",
args[0].Type(),
)
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"func (j *Js) Getpath(args ...string) *Js {\n\td := j\n\tfor i := range args {\n\t\tm := d.Getdata()\n\n\t\tif val, ok := m[args[i]]; ok {\n\t\t\td.data = val\n\t\t} else {\n\t\t\td.data = nil\n\t\t\treturn d\n\t\t}\n\t}\n\treturn d\n}",
"func extractPath(c *gin.Context, tag string) (string, []string, error) {\n\... | [
"0.5881082",
"0.5746452",
"0.5599261",
"0.5507016",
"0.5389365",
"0.53872955",
"0.53744584",
"0.53303474",
"0.5306618",
"0.5272473",
"0.5219563",
"0.5219563",
"0.5170733",
"0.51603353",
"0.515905",
"0.5149575",
"0.50718874",
"0.5059588",
"0.5042506",
"0.50372833",
"0.503696",... | 0.80633986 | 0 |
GlobGroup Type implements the starlark.Value.Type() method. | func (gg GlobGroup) Type() string {
return fmt.Sprintf("GlobGroup")
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"func (NamespaceStar) Type() string { return TypeNamespaceStar }",
"func (b *GroupsSearchBuilder) Type(v string) *GroupsSearchBuilder {\n\tb.Params[\"type\"] = v\n\treturn b\n}",
"func (value *Value) Type() Type {\n\treturn value.valueType\n}",
"func (b baseValue) Type() string {\n\treturn string(b.flagType)\... | [
"0.6424173",
"0.63089347",
"0.6207848",
"0.6189664",
"0.6150497",
"0.61098784",
"0.6105709",
"0.61046934",
"0.61017525",
"0.6056659",
"0.6042432",
"0.60282564",
"0.60250735",
"0.6024554",
"0.6006814",
"0.60044366",
"0.59927106",
"0.5968349",
"0.59500855",
"0.59442514",
"0.592... | 0.81681466 | 0 |
Freeze implements the starlark.Value.Freeze() method. | func (gg GlobGroup) Freeze() {} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"func (i *Index) Freeze() {\n\ti.frozen = true\n}",
"func (p *Poly) freeze() {\n\tfor i := 0; i < n; i++ {\n\t\tp[i] = freeze(p[i])\n\t}\n}",
"func freeze(o *goja.Object) {\n\tfor _, key := range o.Keys() {\n\t\to.DefineDataProperty(key, o.Get(key), goja.FLAG_FALSE, goja.FLAG_FALSE, goja.FLAG_TRUE)\n\t}\n}",
... | [
"0.629121",
"0.61709946",
"0.6089411",
"0.60298693",
"0.59620976",
"0.5877203",
"0.58217835",
"0.57199144",
"0.5709729",
"0.5635698",
"0.5491367",
"0.5444173",
"0.5394565",
"0.536854",
"0.5366694",
"0.53647643",
"0.5217478",
"0.5201497",
"0.5199691",
"0.5163645",
"0.5118248",... | 0.45463032 | 41 |
Truth implements the starlark.Value.Truth() method. | func (gg GlobGroup) Truth() starlark.Bool { return starlark.True } | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"func truth(r reflect.Value) bool {\nout:\n\tswitch r.Kind() {\n\tcase reflect.Array, reflect.Slice:\n\t\treturn r.Len() > 0\n\tcase reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64:\n\t\treturn r.Int() > 0\n\tcase reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64:\n\... | [
"0.6302526",
"0.6080101",
"0.60129184",
"0.58864635",
"0.58375704",
"0.5808124",
"0.57730013",
"0.5767958",
"0.5739565",
"0.57394236",
"0.57306063",
"0.5705854",
"0.569673",
"0.5695482",
"0.56939113",
"0.5689309",
"0.56702256",
"0.5668591",
"0.5640195",
"0.5632629",
"0.561903... | 0.0 | -1 |
Hash32 implements the Arg.Hash32() method. | func (gg GlobGroup) Hash32(h hash.Hash32) {
for _, p := range gg {
h.Write([]byte(p))
}
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"func (p Path) Hash32(h hash.Hash32) { h.Write([]byte(p)) }",
"func (t *Target) Hash32(h hash.Hash32) {\n\th.Write([]byte(t.Name))\n\th.Write([]byte(t.Builder))\n\tfor _, arg := range t.Args {\n\t\targ.Hash32(h)\n\t}\n\tfor _, env := range t.Env {\n\t\th.Write([]byte(env))\n\t}\n}",
"func CalcHash32(data []byte... | [
"0.7513112",
"0.7491727",
"0.72715765",
"0.7190082",
"0.6986059",
"0.68957806",
"0.67351377",
"0.67205036",
"0.67193633",
"0.6649574",
"0.6621809",
"0.65809476",
"0.6579308",
"0.65534127",
"0.6548068",
"0.65251803",
"0.64664733",
"0.6466416",
"0.64491963",
"0.6394227",
"0.631... | 0.6501993 | 16 |
Hash implements the starlark.Value.Hash() method. | func (gg GlobGroup) Hash() (uint32, error) {
h := adler32.New()
gg.Hash32(h)
return h.Sum32(), nil
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"func Hash(value int64) uint64 {\n\treturn FNVHash64(uint64(value))\n}",
"func (n *SoupNode) Hash() (uint32, error) {\n\treturn hashString(fmt.Sprintf(\"%v\", *n)), nil\n}",
"func (o *ObjectIndex) Hash() uint32 {\n\tvar h uint32 = 17\n\n\tvar str string\n\tstr += fmt.Sprintf(\"%08x\", o.machine)\n\tstr += fmt.S... | [
"0.71392304",
"0.7118988",
"0.70433563",
"0.70033073",
"0.7000457",
"0.69771796",
"0.6946999",
"0.69167256",
"0.6911272",
"0.6885437",
"0.6881275",
"0.6854698",
"0.6839323",
"0.6808889",
"0.6802325",
"0.67797977",
"0.6749414",
"0.6748137",
"0.6745063",
"0.67278856",
"0.668532... | 0.0 | -1 |
String Hash32 implements the Arg.Hash32() method. | func (s String) Hash32(h hash.Hash32) { h.Write([]byte(s)) } | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"func HexToHash32(s string) Hash32 { return BytesToHash(util.FromHex(s)) }",
"func (p Path) Hash32(h hash.Hash32) { h.Write([]byte(p)) }",
"func hash(s string) uint32 {\n h := fnv.New32a()\n h.Write([]byte(s))\n return h.Sum32()\n}",
"func (t *Target) Hash32(h hash.Hash32) {\n\th.Write([]byte(t.Name))\n\th... | [
"0.7575041",
"0.7430379",
"0.7387939",
"0.7271739",
"0.7122693",
"0.6981774",
"0.6963979",
"0.69053805",
"0.68457013",
"0.68161345",
"0.6785067",
"0.67835623",
"0.67606795",
"0.6733655",
"0.67066145",
"0.670613",
"0.66108847",
"0.6555351",
"0.6541611",
"0.6475872",
"0.6459690... | 0.80541074 | 0 |
Sub Type implements the starlark.Value.Type() method. | func (s *Sub) Type() string { return "Sub" } | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"func (value *Value) Type() Type {\n\treturn value.valueType\n}",
"func (v Value) Type() Type {\n\treturn v.Typ\n}",
"func (val Value) Type() Type {\n\treturn val.typ\n}",
"func (v Value) Type() Type {\n\treturn v.typ\n}",
"func (v Value) Type() ValueType {\n\tif v.iface == nil {\n\t\treturn NilType\n\t}\n\... | [
"0.755581",
"0.7475477",
"0.74640226",
"0.74598986",
"0.7345107",
"0.7240795",
"0.7237268",
"0.71322525",
"0.70109874",
"0.6932564",
"0.6901902",
"0.68951213",
"0.68916506",
"0.68422705",
"0.67929244",
"0.67622596",
"0.6681911",
"0.6673024",
"0.6662416",
"0.6656612",
"0.66240... | 0.61994 | 49 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.