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 |
|---|---|---|---|---|---|---|
SetBytes records the number of bytes processed in a single operation. If this is called, the benchmark will report ns/op and MB/s. | func (b *B) SetBytes(n int64) {} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"func (b *B) SetBytes(n int64)",
"func (mr *MockUnsignedTxMockRecorder) SetBytes(arg0 interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"SetBytes\", reflect.TypeOf((*MockUnsignedTx)(nil).SetBytes), arg0)\n}",
"func SetBytes(z *big.Int, buf []byte) *... | [
"0.6600146",
"0.60165143",
"0.5987008",
"0.5880965",
"0.57906413",
"0.57371676",
"0.57300454",
"0.5614308",
"0.5451881",
"0.5433504",
"0.54001087",
"0.53871846",
"0.53859985",
"0.53717464",
"0.53510094",
"0.5333213",
"0.5298324",
"0.5295165",
"0.5218187",
"0.5207804",
"0.5195... | 0.675753 | 0 |
ReportAllocs enables malloc statistics for this benchmark. It is equivalent to setting test.benchmem, but it only affects the benchmark function that calls ReportAllocs. | func (b *B) ReportAllocs() {} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"func (b *B) ReportAllocs()",
"func allocs(c echo.Context) error {\n\tpprof.Handler(\"allocs\").ServeHTTP(c.Response(), c.Request())\n\treturn nil\n}",
"func Report(c context.Context) {\n\tvar stats runtime.MemStats\n\truntime.ReadMemStats(&stats)\n\n\tMemAlloc.Set(c, int64(stats.Alloc))\n\tMemTotalAlloc.Set(c,... | [
"0.74036807",
"0.6688823",
"0.6501399",
"0.6230664",
"0.6176789",
"0.5929078",
"0.5918433",
"0.5865994",
"0.5713867",
"0.56269395",
"0.5620441",
"0.56038296",
"0.5561375",
"0.5464719",
"0.54509616",
"0.5442123",
"0.5417522",
"0.54055613",
"0.5358954",
"0.53147954",
"0.5314264... | 0.7178466 | 1 |
ReportMetric adds "n unit" to the reported benchmark results. If the metric is periteration, the caller should divide by b.N, and by convention units should end in "/op". ReportMetric overrides any previously reported value for the same unit. ReportMetric panics if unit is the empty string or if unit contains any whitespace. If unit is a unit normally reported by the benchmark framework itself (such as "allocs/op"), ReportMetric will override that metric. Setting "ns/op" to 0 will suppress that builtin metric. | func (b *B) ReportMetric(n float64, unit string) {} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"func (s *SysbenchMemory) Report(b *testing.B, output string) {\n\tb.Helper()\n\tresult, err := s.parseOperations(output)\n\tif err != nil {\n\t\tb.Fatalf(\"parsing result %s failed with err: %v\", output, err)\n\t}\n\tReportCustomMetric(b, result, \"memory_operations\" /*metric name*/, \"ops_per_second\" /*unit*/)... | [
"0.61145514",
"0.58451915",
"0.5774043",
"0.5726405",
"0.5541881",
"0.5441088",
"0.5394693",
"0.5334652",
"0.5093722",
"0.50429195",
"0.50089675",
"0.5003965",
"0.4981386",
"0.49562517",
"0.49305192",
"0.48886535",
"0.48771197",
"0.4864596",
"0.4826988",
"0.48240182",
"0.4809... | 0.70846057 | 0 |
NsPerOp returns the "ns/op" metric. | func (r BenchmarkResult) NsPerOp() int64 {} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"func getPromMetricName(desc *otlp.MetricDescriptor, ns string) string {\n\n\tif desc == nil {\n\t\treturn \"\"\n\t}\n\t// whether _total suffix should be applied\n\tisCounter := desc.Type == otlp.MetricDescriptor_MONOTONIC_INT64 ||\n\t\tdesc.Type == otlp.MetricDescriptor_MONOTONIC_DOUBLE\n\n\tb := strings.Builder{... | [
"0.57224274",
"0.5444601",
"0.52460575",
"0.52289724",
"0.49640873",
"0.49150625",
"0.48725146",
"0.48344836",
"0.48164344",
"0.48130932",
"0.4811613",
"0.47757563",
"0.4772676",
"0.47431546",
"0.46914786",
"0.46831667",
"0.46792915",
"0.46668288",
"0.46610507",
"0.46231055",
... | 0.61860836 | 0 |
AllocsPerOp returns the "allocs/op" metric, which is calculated as r.MemAllocs / r.N. | func (r BenchmarkResult) AllocsPerOp() int64 {} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"func AllocsPerRun(runs int, f func()) (avg float64)",
"func (r BenchmarkResult) NsPerOp() int64 {}",
"func AllocsPerRun(runs int, f func()) (avg float64) {}",
"func (p *ResourcePool) Allocs(ctx context.Context) ([]Alloc, error) {\n\tp.mu.Lock()\n\tdefer p.mu.Unlock()\n\tallocs := make([]Alloc, len(p.allocs))... | [
"0.58367735",
"0.57967895",
"0.5711421",
"0.5415888",
"0.53926235",
"0.5278731",
"0.5225933",
"0.5166099",
"0.5140884",
"0.50157243",
"0.4996488",
"0.4967147",
"0.49647212",
"0.48921716",
"0.4846859",
"0.48438126",
"0.4824856",
"0.48070475",
"0.47903964",
"0.47834903",
"0.477... | 0.7850767 | 0 |
AllocedBytesPerOp returns the "B/op" metric, which is calculated as r.MemBytes / r.N. | func (r BenchmarkResult) AllocedBytesPerOp() int64 {} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"func (r BenchmarkResult) AllocsPerOp() int64 {}",
"func (r BenchmarkResult) NsPerOp() int64 {}",
"func getSizeByOP(op int) int {\n\tswitch op {\n\tcase 1:\n\t\treturn 3\n\tcase 2:\n\t\treturn 3\n\tcase 3:\n\t\treturn 1\n\tcase 4:\n\t\treturn 1\n\tcase 5:\n\t\treturn 2\n\tcase 6:\n\t\treturn 2\n\tcase 7:\n\t\tr... | [
"0.63177806",
"0.58997047",
"0.5833068",
"0.5424875",
"0.5393999",
"0.53623736",
"0.5351161",
"0.533708",
"0.5200899",
"0.5046271",
"0.5031193",
"0.5026935",
"0.49018884",
"0.4897368",
"0.48915893",
"0.48873994",
"0.48818982",
"0.48662895",
"0.48648322",
"0.48477483",
"0.4842... | 0.81515044 | 0 |
String returns a summary of the benchmark results. It follows the benchmark result line format from not including the benchmark name. Extra metrics override builtin metrics of the same name. String does not include allocs/op or B/op, since those are reported by MemString. | func (r BenchmarkResult) String() string {} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"func (b *Bench) String() string {\n\tprefix := \" \"\n\tvar buf bytes.Buffer\n\tpercentiles := []float64{5, 50, 70, 90, 95, 99, 99.9, 99.95, 99.99, 100}\n\n\tif b.rps <= 0 {\n\t\tfmt.Fprintf(&buf, \"Duration: %2.2fs, Concurrency: %d, Total runs: %d\\n\", b.timeTaken.Seconds(), b.concurrentRuns, b.calls)\n\t} else... | [
"0.731785",
"0.71303135",
"0.69172883",
"0.66541773",
"0.6599185",
"0.6460193",
"0.64140147",
"0.6366368",
"0.6177817",
"0.60876465",
"0.6058911",
"0.60517734",
"0.6033677",
"0.6018531",
"0.6002297",
"0.60005015",
"0.5999122",
"0.5949123",
"0.59454554",
"0.593246",
"0.5920939... | 0.77329624 | 0 |
MemString returns r.AllocedBytesPerOp and r.AllocsPerOp in the same format as 'go test'. | func (r BenchmarkResult) MemString() string {} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"func (r BenchmarkResult) AllocsPerOp() int64 {}",
"func (r BenchmarkResult) AllocedBytesPerOp() int64 {}",
"func GetMemStats() string {\n\tvar memstats runtime.MemStats\n\truntime.ReadMemStats(&memstats)\n\treturn fmt.Sprintf(\"Alloc: %s, Sys: %s, GC: %d, PauseTotalNs: %dns\", humanize.Bytes(memstats.Alloc), h... | [
"0.6087171",
"0.59305274",
"0.5815041",
"0.5735228",
"0.5709977",
"0.54733354",
"0.5379671",
"0.5365666",
"0.53119045",
"0.5307708",
"0.5279814",
"0.52693146",
"0.5251053",
"0.52317065",
"0.52208996",
"0.52173585",
"0.5215754",
"0.5198797",
"0.51664555",
"0.5164201",
"0.51391... | 0.6777521 | 0 |
RunBenchmarks is an internal function but exported because it is crosspackage; it is part of the implementation of the "go test" command. | func RunBenchmarks(matchString func(pat, str string) (bool, error), benchmarks []InternalBenchmark) {} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"func (bm *DockerBenchmarker) RunBenchmark() {\n\n\t// CIS 4.1 Create a user for the container\n\tbm.CheckNonRootUser()\n\n\t// CIS 4.2 Use trusted base images for containers\n\tbm.CheckTrustedBaseImages()\n\n\t// CIS 4.3 Do not install unnecessary packages in the container\n\tbm.CheckDisallowedPackages()\n\n\t// C... | [
"0.7102962",
"0.68479264",
"0.68192446",
"0.6644519",
"0.6495447",
"0.648628",
"0.6437044",
"0.6397857",
"0.6329505",
"0.6295027",
"0.62487715",
"0.6246818",
"0.62363374",
"0.6189826",
"0.6121475",
"0.6104994",
"0.6038097",
"0.59955555",
"0.5984933",
"0.5976276",
"0.5954494",... | 0.6874231 | 1 |
Run benchmarks f as a subbenchmark with the given name. It reports whether there were any failures. A subbenchmark is like any other benchmark. A benchmark that calls Run at least once will not be measured itself and will be called once with N=1. | func (b *B) Run(name string, f func(b *B)) bool {} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"func RunBenchmark(name string, b *testing.B, f Func, n int) {\n\tb.Run(name, func(b *testing.B) {\n\t\tb.Logf(\"f(%d), loop (b.N) = %d\\n\", n, b.N)\n\t\tfor i := 0; i < b.N; i++ {\n\t\t\tf(n)\n\t\t}\n\t})\n}",
"func RunBenchmark(b *testing.B, version int, f func(*Anwork, int)) {\n\ta, err := MakeAnwork(version)... | [
"0.6889814",
"0.6594207",
"0.6199323",
"0.59165144",
"0.5913794",
"0.5664615",
"0.56288725",
"0.55423",
"0.5482361",
"0.5478386",
"0.5464914",
"0.54069924",
"0.53923553",
"0.53124565",
"0.5267039",
"0.52645284",
"0.5264442",
"0.52217627",
"0.5195152",
"0.51781505",
"0.5164469... | 0.512645 | 22 |
Next reports whether there are more iterations to execute. | func (pb *PB) Next() bool {} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"func (it *ScriptingReturnValueIterator) Next() bool {\n\tT().Debugf(\"%d return values to iterate\", len(it.values.values))\n\tit.inx++\n\tif it.inx < len(it.values.values) {\n\t\treturn true\n\t} else {\n\t\treturn false\n\t}\n}",
"func (i *ResolvedProductIter) Next() bool {\n\tif i.first && i.err != nil {\n\t\... | [
"0.7379314",
"0.72344273",
"0.7204958",
"0.7182491",
"0.717007",
"0.71591055",
"0.7146797",
"0.7086303",
"0.7037553",
"0.7003668",
"0.6974741",
"0.694564",
"0.6934344",
"0.6910715",
"0.6880078",
"0.6877245",
"0.68726087",
"0.68215984",
"0.68158257",
"0.6791055",
"0.67874914",... | 0.66290563 | 36 |
RunParallel runs a benchmark in parallel. It creates multiple goroutines and distributes b.N iterations among them. The number of goroutines defaults to GOMAXPROCS. To increase parallelism for nonCPUbound benchmarks, call SetParallelism before RunParallel. RunParallel is usually used with the go test cpu flag. The body function will be run in each goroutine. It should set up any goroutinelocal state and then iterate until pb.Next returns false. It should not use the StartTimer, StopTimer, or ResetTimer functions, because they have global effect. It should also not call Run. | func (b *B) RunParallel(body func(*PB)) {} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"func (b *B) RunParallel(body func(*PB))",
"func BenchmarkParallelProcess(b *testing.B) {\n\trand.Seed(18)\n\tp := protocols{}\n\tp.tcp = make(map[protos.Protocol]protos.TcpProtocolPlugin)\n\tp.tcp[1] = &TestProtocol{Ports: []int{ServerPort}}\n\ttcp, _ := NewTcp(p)\n\n\tb.ResetTimer()\n\tb.RunParallel(func(pb *te... | [
"0.68615395",
"0.59649223",
"0.59426546",
"0.5708616",
"0.5655967",
"0.55070496",
"0.5472788",
"0.5407767",
"0.54075474",
"0.5368487",
"0.5323917",
"0.52809924",
"0.5219718",
"0.5215668",
"0.51870924",
"0.5168363",
"0.51524377",
"0.51412904",
"0.51335984",
"0.5094116",
"0.508... | 0.6838596 | 1 |
Benchmark benchmarks a single function. It is useful for creating custom benchmarks that do not use the "go test" command. If f depends on testing flags, then Init must be used to register those flags before calling Benchmark and before calling flag.Parse. If f calls Run, the result will be an estimate of running all its subbenchmarks that don't call Run in sequence in a single benchmark. | func Benchmark(f func(b *B)) BenchmarkResult {} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"func RunBenchmark(b *testing.B, version int, f func(*Anwork, int)) {\n\ta, err := MakeAnwork(version)\n\tif err != nil {\n\t\tb.Fatal(err)\n\t}\n\tdefer a.Close()\n\n\tb.ResetTimer()\n\tfor i := 0; i < b.N; i++ {\n\t\tf(a, i)\n\t}\n}",
"func RunBenchmark(name string, b *testing.B, f Func, n int) {\n\tb.Run(name,... | [
"0.7261395",
"0.71153",
"0.6746831",
"0.5840778",
"0.5818933",
"0.5759226",
"0.56847936",
"0.54754686",
"0.5460697",
"0.54217684",
"0.53978",
"0.53957176",
"0.5385811",
"0.5306742",
"0.52589774",
"0.5240582",
"0.52340424",
"0.52124375",
"0.5198126",
"0.51899254",
"0.5184448",... | 0.6789741 | 2 |
Coverage reports the current code coverage as a fraction in the range [0, 1]. If coverage is not enabled, Coverage returns 0. When running a large set of sequential test cases, checking Coverage after each one can be useful for identifying which test cases exercise new code paths. It is not a replacement for the reports generated by 'go test cover' and 'go tool cover'. | func Coverage() float64 {} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"func Coverage() error {\n\tmg.Deps(Test)\n\treturn sh.Run(\"go\", \"tool\", \"cover\", \"-html=coverage.out\")\n}",
"func (c CoverageProfile) CoveragePercent() float64 {\n\tif total := c.TotalLines(); total != 0 {\n\t\treturn 100. * float64(c.TotalCoveredLines()) / float64(total)\n\t}\n\treturn 0\n}",
"func Co... | [
"0.7348242",
"0.71339047",
"0.7077023",
"0.70469147",
"0.7039095",
"0.66986245",
"0.64924324",
"0.63718826",
"0.63314337",
"0.6119978",
"0.5918472",
"0.58236927",
"0.580131",
"0.5723934",
"0.56657857",
"0.5625121",
"0.5540426",
"0.54250145",
"0.542137",
"0.53964365",
"0.53951... | 0.6979682 | 5 |
RegisterCover records the coverage data accumulators for the tests. NOTE: This function is internal to the testing infrastructure and may change. It is not covered (yet) by the Go 1 compatibility guidelines. | func RegisterCover(c Cover) {} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"func RegisterCover(c Cover)",
"func Cover() error {\n\tmg.Deps(getEnvironment, Clean, GetBuildName)\n\tfmt.Println(fmt.Sprintf(\"Testing with coverage gpsa... \"))\n\tfmt.Println(\"# ########################################################################################\")\n\n\terr := gobuildhelpers.CoverTestFo... | [
"0.69105786",
"0.5583642",
"0.5470768",
"0.53251094",
"0.50624096",
"0.4801176",
"0.4700892",
"0.46729824",
"0.4500442",
"0.44995344",
"0.44930428",
"0.44729605",
"0.44596648",
"0.44516873",
"0.4412019",
"0.44031498",
"0.43717226",
"0.43647137",
"0.43597794",
"0.43418637",
"0... | 0.6839271 | 1 |
RunExamples is an internal function but exported because it is crosspackage; it is part of the implementation of the "go test" command. | func RunExamples(matchString func(pat, str string) (bool, error), examples []InternalExample) (ok bool) {} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"func RunExamples(matchString func(pat, str string) (bool, error), examples []InternalExample) (ok bool) {\n\t_, ok = runExamples(matchString, examples)\n\treturn ok\n}",
"func execExamples(arity int, p *gop.Context) {\n\targs := p.GetArgs(arity)\n\tconv := func(args []interface{}) []*ast.File {\n\t\tret := make(... | [
"0.764823",
"0.73474324",
"0.6862852",
"0.6840609",
"0.660363",
"0.65557784",
"0.6547067",
"0.6374077",
"0.63478315",
"0.63422245",
"0.6229371",
"0.6192121",
"0.6175554",
"0.6041606",
"0.6032973",
"0.59743",
"0.58787906",
"0.5873177",
"0.5837253",
"0.5771184",
"0.5759049",
... | 0.7366353 | 1 |
Validate checks the default configuration of a proxy configuration. | func (opts *ProxyOptions) Validate() error {
if !strings.HasPrefix(opts.RemotePrefix, "/") {
opts.RemotePrefix = "/" + opts.RemotePrefix
}
catcher := grip.NewBasicCatcher()
catcher.NewWhen(len(opts.TargetPool) == 0 && opts.FindTarget == nil, "must specify a way to resolve target host")
catcher.NewWhen(len(opts.TargetPool) >= 1 && opts.FindTarget != nil, "cannot specify more than one target resolution option")
return catcher.Resolve()
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"func (c *ProxyServerConfig) CheckAndSetDefaults() error {\n\tif c.AccessPoint == nil {\n\t\treturn trace.BadParameter(\"missing AccessPoint\")\n\t}\n\tif c.AuthClient == nil {\n\t\treturn trace.BadParameter(\"missing AuthClient\")\n\t}\n\tif c.Authorizer == nil {\n\t\treturn trace.BadParameter(\"missing Authorizer... | [
"0.6642014",
"0.65776545",
"0.6576133",
"0.65689003",
"0.62941796",
"0.6183459",
"0.60884404",
"0.6012993",
"0.6012026",
"0.5981353",
"0.59771043",
"0.5960726",
"0.5947902",
"0.59138715",
"0.5907313",
"0.5835956",
"0.579558",
"0.57797164",
"0.57753634",
"0.5757942",
"0.575087... | 0.6594782 | 1 |
parseTag parses a tag string from the struct field and unmarshals into a Tag struct. | func parseTag(raw string) (*Tag, error) {
var tag = new(Tag)
raw = strings.Replace(raw, "`", "", -1)
raw = reflect.StructTag(raw).Get("sql")
// if the tag indicates the field should
// be skipped we can exit right away.
if strings.TrimSpace(raw) == "-" {
tag.Skip = true
return tag, nil
}
// otherwise wrap the string in curly braces
// so that we can use the Yaml parser.
raw = fmt.Sprintf("{ %s }", raw)
// unmarshals the Yaml formatted string into
// the Tag structure.
var err = yaml.Unmarshal([]byte(raw), tag)
return tag, err
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"func parseTag(f reflect.StructField, tag string) (string, tagOptions) {\n\treturn splitTags(getTagValues(f, tag))\n}",
"func ParseTag(raw string) (*Tag, error) {\n\tvar tag = new(Tag)\n\n\traw = strings.TrimSpace(topAndTail(strings.TrimSpace(raw)))\n\tstructTag := reflect.StructTag(raw)\n\tvalue := strings.TrimS... | [
"0.7665988",
"0.7565627",
"0.70666677",
"0.7003763",
"0.69253194",
"0.6555504",
"0.6494551",
"0.63994414",
"0.6377795",
"0.62923414",
"0.6257043",
"0.6251674",
"0.6225439",
"0.6202211",
"0.6199089",
"0.6185696",
"0.6182165",
"0.61815387",
"0.61746836",
"0.6147337",
"0.6138106... | 0.7106158 | 2 |
getIP returns the original IP address from the request, checking special headers before falling back to RemoteAddr. | func getIP(r *http.Request) string {
if ip := r.Header.Get("CF-Connecting-IP"); ip != "" {
return ip
}
if ip := r.Header.Get("X-Forwarded-For"); ip != "" {
// Trim off any others: A.B.C.D[,X.X.X.X,Y.Y.Y.Y,]
return strings.SplitN(ip, ",", 1)[0]
}
if ip, _, err := net.SplitHostPort(r.RemoteAddr); err == nil {
return ip
}
return r.RemoteAddr
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"func GetIP(r *http.Request) string {\n\tforwarded := r.Header.Get(\"X-FORWARDED-FOR\")\n\tif forwarded != \"\" {\n\t\treturn forwarded\n\t}\n\n\treturn r.RemoteAddr\n}",
"func GetIP(r *http.Request) string {\n\tforwarded := r.Header.Get(\"X-FORWARDED-FOR\")\n\tif forwarded != \"\" {\n\t\treturn forwarded\n\t}\n\... | [
"0.8188254",
"0.8172519",
"0.8153036",
"0.8137045",
"0.8078763",
"0.8049451",
"0.8041197",
"0.8029479",
"0.7872405",
"0.75614214",
"0.7544722",
"0.75206316",
"0.7445191",
"0.7402611",
"0.73768044",
"0.72981644",
"0.72841084",
"0.72343224",
"0.723342",
"0.7230571",
"0.71902466... | 0.802386 | 9 |
jsonRPCResponse returns a JSON response containing v, or a plaintext generic response for this httpCode and an error when JSON marshalling fails. | func jsonRPCResponse(httpCode int, v interface{}) (*http.Response, error) {
body, err := json.Marshal(v)
if err != nil {
return &http.Response{
Body: ioutil.NopCloser(strings.NewReader(http.StatusText(httpCode))),
StatusCode: httpCode,
}, fmt.Errorf("failed to serialize JSON: %v", err)
}
return &http.Response{
Body: ioutil.NopCloser(bytes.NewReader(body)),
StatusCode: httpCode,
}, nil
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"func JSONRPCResponse(httpCode int, v interface{}) (*http.Response, error) {\n\tbody, err := json.Marshal(v)\n\tif err != nil {\n\t\treturn &http.Response{\n\t\t\tBody: ioutil.NopCloser(strings.NewReader(http.StatusText(httpCode))),\n\t\t\tStatusCode: httpCode,\n\t\t}, fmt.Errorf(\"failed to serialize JSON: %... | [
"0.73640263",
"0.7071985",
"0.6591684",
"0.62721163",
"0.6254982",
"0.6179157",
"0.6164506",
"0.6073439",
"0.6067801",
"0.60527635",
"0.6048937",
"0.60078514",
"0.59905744",
"0.5982659",
"0.5979399",
"0.5978767",
"0.58956635",
"0.58887005",
"0.5792219",
"0.57853013",
"0.57740... | 0.8310776 | 0 |
block returns a response only if the request should be blocked, otherwise it returns nil if allowed. | func (t *myTransport) block(ctx context.Context, parsedRequests []ModifiedRequest) (int, interface{}) {
var union *blockRange
for _, parsedRequest := range parsedRequests {
ctx = gotils.With(ctx, "ip", parsedRequest.RemoteAddr)
if allowed, _ := t.AllowVisitor(parsedRequest); !allowed {
gotils.L(ctx).Info().Print("Request blocked: Rate limited")
return http.StatusTooManyRequests, jsonRPCLimit(parsedRequest.ID)
} //else if added {
// gotils.L(ctx).Debug().Printf("Added new visitor, ip: %v", parsedRequest.RemoteAddr)
// }
if !t.MatchAnyRule(parsedRequest.Path) {
// gotils.L(ctx).Debug().Print("Request blocked: Method not allowed")
return http.StatusMethodNotAllowed, jsonRPCUnauthorized(parsedRequest.ID, parsedRequest.Path)
}
if t.blockRangeLimit > 0 && parsedRequest.Path == "eth_getLogs" {
r, invalid, err := t.parseRange(ctx, parsedRequest)
if err != nil {
return http.StatusInternalServerError, jsonRPCError(parsedRequest.ID, jsonRPCInternal, err.Error())
} else if invalid != nil {
gotils.L(ctx).Info().Printf("Request blocked: Invalid params: %v", invalid)
return http.StatusBadRequest, jsonRPCError(parsedRequest.ID, jsonRPCInvalidParams, invalid.Error())
}
if r != nil {
if l := r.len(); l > t.blockRangeLimit {
gotils.L(ctx).Info().Println("Request blocked: Exceeds block range limit, range:", l, "limit:", t.blockRangeLimit)
return http.StatusBadRequest, jsonRPCBlockRangeLimit(parsedRequest.ID, l, t.blockRangeLimit)
}
if union == nil {
union = r
} else {
union.extend(r)
if l := union.len(); l > t.blockRangeLimit {
gotils.L(ctx).Info().Println("Request blocked: Exceeds block range limit, range:", l, "limit:", t.blockRangeLimit)
return http.StatusBadRequest, jsonRPCBlockRangeLimit(parsedRequest.ID, l, t.blockRangeLimit)
}
}
}
}
}
return 0, nil
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"func Block(c *blocker.Client, h http.Handler) http.Handler {\n\treturn BlockWithCode(c, h, http.StatusForbidden)\n}",
"func (r *BlockingResolver) handleBlocked(logger *logrus.Entry,\n\trequest *Request, question dns.Question, reason string) (*Response, error) {\n\tresponse := new(dns.Msg)\n\tresponse.SetReply(re... | [
"0.6603521",
"0.6544034",
"0.62985706",
"0.5726369",
"0.5698893",
"0.5625053",
"0.5364136",
"0.5360237",
"0.531655",
"0.5280611",
"0.5275245",
"0.52390784",
"0.5230736",
"0.5164695",
"0.51578766",
"0.5141324",
"0.5141079",
"0.51306504",
"0.5129047",
"0.51090413",
"0.510555",
... | 0.59495723 | 3 |
parseRange returns a block range if one exists, or an error if the request is invalid. | func (t *myTransport) parseRange(ctx context.Context, request ModifiedRequest) (r *blockRange, invalid, internal error) {
if len(request.Params) == 0 {
return nil, nil, nil
}
type filterQuery struct {
BlockHash *string `json:"blockHash"`
FromBlock *rpc.BlockNumber `json:"fromBlock"`
ToBlock *rpc.BlockNumber `json:"toBlock"`
}
var fq filterQuery
err := json.Unmarshal(request.Params[0], &fq)
if err != nil {
return nil, err, nil
}
if fq.BlockHash != nil {
return nil, nil, nil
}
var start, end uint64
if fq.FromBlock != nil {
switch *fq.FromBlock {
case rpc.LatestBlockNumber, rpc.PendingBlockNumber:
l, err := t.latestBlock.get(ctx)
if err != nil {
return nil, nil, err
}
start = l
default:
start = uint64(*fq.FromBlock)
}
}
if fq.ToBlock == nil {
l, err := t.latestBlock.get(ctx)
if err != nil {
return nil, nil, err
}
end = l
} else {
switch *fq.ToBlock {
case rpc.LatestBlockNumber, rpc.PendingBlockNumber:
l, err := t.latestBlock.get(ctx)
if err != nil {
return nil, nil, err
}
end = l
default:
end = uint64(*fq.ToBlock)
}
}
return &blockRange{start: start, end: end}, nil, nil
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"func parseContentRange(r string) (parsed contentRange, err error) {\n\tinvalidErr := fmt.Errorf(\"invalid Content-Range: %v\", r)\n\n\t// Require that units == \"bytes\"\n\tconst bytesPrefix = \"bytes \"\n\tif !strings.HasPrefix(r, bytesPrefix) {\n\t\treturn parsed, invalidErr\n\t}\n\n\t// Split range from total l... | [
"0.65760976",
"0.6273825",
"0.62658364",
"0.6203469",
"0.6190573",
"0.6104221",
"0.60757834",
"0.603592",
"0.6012127",
"0.5833827",
"0.5749373",
"0.5749373",
"0.573297",
"0.5513817",
"0.5503804",
"0.5434472",
"0.5408448",
"0.54031825",
"0.5378902",
"0.5353554",
"0.5262798",
... | 0.7895962 | 0 |
update updates (num, err, at). Only one instance may run at a time, and it spot is reserved by setting next, which is closed when the operation completes. Returns a chan to wait on if another instance is already running. Otherwise returns num and err if the operation is complete. | func (l *latestBlock) update() (chan struct{}, uint64, error) {
l.mu.Lock()
if next := l.next; next != nil {
// Someone beat us to it, return their next chan.
l.mu.Unlock()
return next, 0, nil
}
next := make(chan struct{})
l.next = next
l.mu.Unlock()
var latest uint64
var err error
if l.client == nil {
l.client, err = goclient.Dial(l.url)
}
if err == nil {
var lBig *big.Int
lBig, err = l.client.LatestBlockNumber(context.Background())
if err == nil {
latest = lBig.Uint64()
}
}
now := time.Now()
l.mu.Lock()
l.num = latest
l.err = err
l.at = &now
l.next = nil
l.mu.Unlock()
close(next)
return nil, latest, err
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"func (p *progress) update(nodeIndex NodeIndex, index LogEntryIndex) {\n\tp.NextIndex[nodeIndex] = index + 1\n\tp.MatchIndex[nodeIndex] = index\n}",
"func (s *Stream) Update(ctx context.Context, c Collector) (err error) {\n\tupdate := newTaskLogger(s.stdout).Task(fmt.Sprintf(\"DRIVE %s\", s.drive)).Task(\"UPDATE\... | [
"0.5178523",
"0.5173922",
"0.5094512",
"0.50584483",
"0.4905737",
"0.48709536",
"0.48703036",
"0.48117092",
"0.48010278",
"0.4788073",
"0.47819346",
"0.4738964",
"0.47305784",
"0.47250986",
"0.47129682",
"0.47085497",
"0.46851322",
"0.46636736",
"0.46448827",
"0.46305528",
"0... | 0.586269 | 0 |
/ ============== === Public === ============= StartPing to coordinator every interval duration | func StartPing(interval time.Duration){
log.Println("Ping Time")
pinging := true
for pinging {
pinging = false
log.Print("Pinging set to " + strconv.FormatBool(pinging))
if shouldIPing() {
pinging = true
log.Print("Pinging set to " + strconv.FormatBool(pinging))
bullyImpl.SetIsCoordinatorAlive(false)
log.Print(bullyImpl.IsCoordinatorAlive())
bullyImpl.GetMoi().Ping(bullyImpl.GetCoordinator())
timer := time.NewTimer(interval)
select {
case <- endTimer:
log.Print("Pinging was ended")
case <- timer.C:
if shouldIPing() && !bullyImpl.IsCoordinatorAlive() {
pinging = false
log.Print("Pinging set to " + strconv.FormatBool(pinging))
log.Print("Coordinator is not alive, launching a new Election")
go func(){ electionChannel <- struct{}{} }()
}
}
}
}
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"func periodicPing() {\n\tfor {\n\t\t// Shuffle membership list and get a member\n\t\t// Only executed when the membership list is not empty\n\t\tif CurrentList.Size() > 0 {\n\t\t\tmember := CurrentList.Shuffle()\n\t\t\t// Do not pick itself as the ping target\n\t\t\tif (member.TimeStamp == CurrentMember.TimeStamp)... | [
"0.6193315",
"0.6179224",
"0.6143193",
"0.61351657",
"0.6028782",
"0.6014904",
"0.5982548",
"0.5971441",
"0.59634084",
"0.58982575",
"0.5862859",
"0.5855726",
"0.58180887",
"0.5785415",
"0.5776094",
"0.57536733",
"0.57490754",
"0.5747036",
"0.57020706",
"0.5685898",
"0.567151... | 0.76078093 | 0 |
/ =============== === private === ============= shouldIPing | func shouldIPing() bool {
return !initialElection &&
!bullyImpl.EnCours() &&
!bullyImpl.IsCoordinator()
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"func CheckIp(ip string) int {\n return 0\n\n}",
"func ( ipMeta * pState ) verifyScanningIP( pRecv *packet_metadata ) bool {\n\n\tpRecvKey := constructKey(pRecv)\n\t//first check that IP itself is being scanned\n\tps, ok := ipMeta.Get(pRecvKey)\n\tif !ok {\n\t\treturn false\n\t}\n\tpMap := ps.Packet\n\n\t//sec... | [
"0.63308936",
"0.63304776",
"0.62865573",
"0.6100806",
"0.60891145",
"0.60489625",
"0.5988068",
"0.5969013",
"0.59549296",
"0.5941177",
"0.59268016",
"0.59218574",
"0.59127504",
"0.5910385",
"0.58939743",
"0.5892218",
"0.585198",
"0.58493",
"0.58442616",
"0.58386356",
"0.5836... | 0.7099065 | 0 |
Save it and make sure it shows up in new form | func saveConfigAndValidateNewFormat(t *testing.T, config *ConfigFile, homeFolder string) string {
err := config.Save()
if err != nil {
t.Fatalf("Failed to save: %q", err)
}
buf, err := ioutil.ReadFile(filepath.Join(homeFolder, RootConfigFileName))
if !strings.Contains(string(buf), `"authConfig":`) {
t.Fatalf("Should have save in new form: %s", string(buf))
}
return string(buf)
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"func (c *MakeRequestController) Save() {\n\tc.View.DisplaySaveView()\n}",
"func saveHandler(w http.ResponseWriter, r *http.Request) {\r\n title := r.URL.Path[len(\"/save/\"):]\r\n body := r.FormValue(\"body\")\r\n p := &Page{Title: title, Body: []byte(body)}\r\n p.save()\r\n http.Redirect(w, r, \"... | [
"0.5938537",
"0.57770675",
"0.57358116",
"0.56519854",
"0.5645757",
"0.56110734",
"0.5565139",
"0.556001",
"0.55296665",
"0.5515979",
"0.5514796",
"0.55080813",
"0.5465128",
"0.5440122",
"0.5385621",
"0.5378106",
"0.5364931",
"0.5349868",
"0.5348707",
"0.53369",
"0.53316015",... | 0.0 | -1 |
Version returns package version | func Version() string {
return "0.3.0"
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"func Version() string {\n\treturn version\n}",
"func Version() string {\n\treturn version\n}",
"func Version() string {\n\treturn version\n}",
"func Version() string {\n\treturn version\n}",
"func Version() string {\n\treturn version\n}",
"func Version() string {\n\treturn version\n}",
"func Version() ... | [
"0.77409333",
"0.77409333",
"0.77409333",
"0.77409333",
"0.77409333",
"0.77409333",
"0.77409333",
"0.77409333",
"0.7711625",
"0.76718765",
"0.76226705",
"0.75100535",
"0.75022686",
"0.74754876",
"0.7473825",
"0.74727696",
"0.74727696",
"0.74476475",
"0.7430816",
"0.74275225",
... | 0.7183975 | 38 |
Author returns package author | func Author() string {
return "[Li Kexian](https://www.likexian.com/)"
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"func versionAuthor() string {\n\treturn fmt.Sprintf(\"By %s \", AUTHOR)\n}",
"func (g *Generator) Author() string {\n\treturn g.image.Author\n}",
"func (module *Crawler) Author() string {\n\treturn Author\n}",
"func (r *Readme) Author() string {\n\treturn r.author\n}",
"func (c Config) Author() string {\n... | [
"0.7753293",
"0.74812424",
"0.74752694",
"0.7469505",
"0.7041128",
"0.70028955",
"0.69293934",
"0.6861273",
"0.6804476",
"0.6582052",
"0.6518088",
"0.64972675",
"0.6433045",
"0.641867",
"0.6391086",
"0.6371975",
"0.63282406",
"0.63003945",
"0.61798203",
"0.6172487",
"0.608410... | 0.7652504 | 5 |
License returns package license | func License() string {
return "Licensed under the Apache License 2.0"
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"func License() string {\n\treturn C.GoString(C.avformat_license())\n}",
"func (hdr RPMHeader) License() string {\n\treturn hdr.Tag(\"License\")[0]\n}",
"func (o LicenseOutput) License() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *License) pulumi.StringOutput { return v.License }).(pulumi.StringOutput)\n}"... | [
"0.80683106",
"0.7852772",
"0.77681726",
"0.73551273",
"0.7304998",
"0.7203316",
"0.720249",
"0.7114836",
"0.711298",
"0.7028955",
"0.702722",
"0.70210373",
"0.7013474",
"0.70109254",
"0.69558066",
"0.692713",
"0.68597376",
"0.6855891",
"0.6848694",
"0.6824606",
"0.6714245",
... | 0.76687586 | 7 |
IsStruct returns if v is a struct | func IsStruct(v interface{}) bool {
vv := reflect.ValueOf(v)
if vv.Kind() == reflect.Ptr {
vv = vv.Elem()
}
return vv.Kind() == reflect.Struct
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"func IsStruct(v interface{}) bool {\n\tr := elconv.AsValueRef(reflect.ValueOf(v))\n\treturn r.Kind() == reflect.Struct\n}",
"func IsStruct(v interface{}) bool {\n\tt := reflect.TypeOf(v)\n\tif t.Kind() == reflect.Ptr {\n\t\tt = t.Elem()\n\t}\n\treturn t.Kind() == reflect.Struct\n}",
"func IsStruct(value interf... | [
"0.82171667",
"0.7990323",
"0.7817168",
"0.77442557",
"0.77005786",
"0.7543898",
"0.7345054",
"0.7303476",
"0.72643065",
"0.72182626",
"0.69576186",
"0.69434875",
"0.6671973",
"0.65604955",
"0.6540829",
"0.6474984",
"0.6456741",
"0.6439632",
"0.6424734",
"0.6414836",
"0.64092... | 0.79916877 | 1 |
Name returns name of struct | func Name(v interface{}) string {
return New(v).Name()
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"func (t *typeStruct) Name() string {\n\treturn t.name\n}",
"func (t *Struct) String() string { return t.Name }",
"func (s *Structx) Name() string {\n\treturn s.value.Type().Name()\n}",
"func (s *Struct) Name() string {\n\tname := reflect.TypeOf(s.Ref).Elem().String()\n\n\t// strip the package prefix, as we d... | [
"0.78337574",
"0.76747423",
"0.7607495",
"0.731499",
"0.7308054",
"0.7260499",
"0.7234671",
"0.72284794",
"0.71106577",
"0.70448375",
"0.6989433",
"0.6928384",
"0.6928275",
"0.6908289",
"0.6873566",
"0.6862104",
"0.6840299",
"0.6824419",
"0.6818603",
"0.6763319",
"0.6750533",... | 0.66797554 | 24 |
Struct returns nested struct with name, it panic if not field | func Struct(v interface{}, name string) *Structx {
return New(v).Struct(name)
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"func (field Field) Struct() *Struct {\n\treturn field.Parent.Parent.Parent.StructByName(field.Field.ItemTypeName().Name)\n}",
"func (s *Structx) Struct(name string) *Structx {\n\tf, ok := s.Field(name)\n\tif !ok {\n\t\tpanic(ErrNotField)\n\t}\n\n\treturn New(f.Value())\n}",
"func (p Package) Struct(strct strin... | [
"0.7061889",
"0.6602846",
"0.6469764",
"0.61510986",
"0.6143574",
"0.6041583",
"0.5890761",
"0.58896327",
"0.58850324",
"0.587014",
"0.58472174",
"0.5809523",
"0.580942",
"0.57638764",
"0.5722698",
"0.56878453",
"0.5675025",
"0.56681955",
"0.56636596",
"0.5662201",
"0.5609322... | 0.5708856 | 15 |
Map returns struct name value as map | func Map(v interface{}) map[string]interface{} {
return New(v).Map()
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"func (s *Structx) Map() map[string]interface{} {\n\tresult := map[string]interface{}{}\n\n\tfs := s.Fields()\n\tfor _, v := range fs {\n\t\tif !v.IsExport() {\n\t\t\tcontinue\n\t\t}\n\t\tresult[v.Name()] = v.Value()\n\t}\n\n\treturn result\n}",
"func (self *Map) Map(key string, tagName ...string) map[typeutil.Va... | [
"0.6947698",
"0.6550753",
"0.6488883",
"0.63773406",
"0.63028806",
"0.6241015",
"0.6223389",
"0.61835444",
"0.6182754",
"0.6062261",
"0.60056233",
"0.595988",
"0.5907082",
"0.5865792",
"0.58084315",
"0.5807308",
"0.5769133",
"0.573662",
"0.57096326",
"0.5690888",
"0.5673567",... | 0.5981603 | 11 |
Names returns names of struct | func Names(v interface{}) []string {
return New(v).Names()
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"func (e *Extractor) Names() (out []string, err error) {\n\n\tif err := e.isValidStruct(); err != nil {\n\t\treturn nil, err\n\t}\n\n\ts := reflect.ValueOf(e.StructAddr).Elem()\n\tfields := e.fields(s)\n\tfor _, field := range fields {\n\t\tout = append(out, field.name)\n\t}\n\n\treturn\n}",
"func (s *Structx) Na... | [
"0.7588833",
"0.7442672",
"0.6471602",
"0.64051765",
"0.6401359",
"0.63857347",
"0.6371387",
"0.6339941",
"0.6253955",
"0.62511194",
"0.60572946",
"0.60088223",
"0.6007971",
"0.5964404",
"0.596039",
"0.59451365",
"0.5940028",
"0.59323174",
"0.5923466",
"0.59138364",
"0.589982... | 0.6606947 | 2 |
Tags returns tags of struct | func Tags(v interface{}, key string) (map[string]string, error) {
return New(v).Tags(key)
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"func (f *Field) GetTags() string {\n\tif f == nil {\n\t\treturn \"\"\n\t}\n\n\tjsonTag := \"`json:\\\"\" + f.Name\n\n\tif f.Type.IsInputObject() || !f.Type.IsNonNull() {\n\t\tjsonTag += \",omitempty\"\n\t}\n\n\ttags := jsonTag + \"\\\"`\"\n\n\t// log.Print(\"\\n\\n **************************** \\n\")\n\t// log.Pri... | [
"0.6812187",
"0.662246",
"0.6557578",
"0.64463",
"0.64463",
"0.6434869",
"0.64187056",
"0.64000773",
"0.6397878",
"0.63918966",
"0.63906616",
"0.63834083",
"0.6358394",
"0.6354617",
"0.63435465",
"0.63312256",
"0.63297874",
"0.6329586",
"0.6325723",
"0.6320472",
"0.62952924",... | 0.63034225 | 20 |
Values returns values of struct | func Values(v interface{}) []interface{} {
return New(v).Values()
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"func (e *Extractor) Values() (out []interface{}, err error) {\n\n\tif err := e.isValidStruct(); err != nil {\n\t\treturn nil, err\n\t}\n\n\ts := reflect.ValueOf(e.StructAddr).Elem()\n\tfields := e.fields(s)\n\n\tfor _, field := range fields {\n\t\tout = append(out, field.value.Interface())\n\n\t}\n\n\treturn\n}",
... | [
"0.749085",
"0.7193369",
"0.70431256",
"0.7038614",
"0.6553561",
"0.6546634",
"0.6514496",
"0.6409118",
"0.6362563",
"0.6319657",
"0.6272307",
"0.62592447",
"0.6233262",
"0.6200429",
"0.61777216",
"0.6162476",
"0.615272",
"0.61421496",
"0.6131156",
"0.61253464",
"0.6119984",
... | 0.6132722 | 18 |
Fields return fields of struct | func Fields(v interface{}) []*Fieldx {
return New(v).Fields()
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"func (g *generator) structFields(t reflect.Type) []field {\n\tvar fields []field\n\tfor i := 0; i < t.NumField(); i++ {\n\t\tf := t.Field(i)\n\t\tif g.ignoreField(t, f) {\n\t\t\tcontinue\n\t\t}\n\t\tname, _ := parseTag(g.fieldTagKey, f.Tag)\n\t\tif name == \"\" {\n\t\t\tname = f.Name\n\t\t}\n\t\tfields = append(fi... | [
"0.75068235",
"0.7504617",
"0.7480527",
"0.7158599",
"0.71165246",
"0.70371705",
"0.70371604",
"0.70308304",
"0.6974181",
"0.6914422",
"0.6902291",
"0.6891259",
"0.68756706",
"0.68355393",
"0.6823067",
"0.6750258",
"0.67315525",
"0.67079526",
"0.67078584",
"0.66911334",
"0.66... | 0.0 | -1 |
MustField returns a field with name, panic if error | func MustField(v interface{}, name string) *Fieldx {
return New(v).MustField(name)
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"func (s *Structx) MustField(name string) *Fieldx {\n\tf, ok := s.Field(name)\n\tif !ok {\n\t\tpanic(ErrNotField)\n\t}\n\n\treturn f\n}",
"func (f *Field) Field(name string) *Field {\n\tfield, ok := f.FieldOk(name)\n\tif !ok {\n\t\tpanic(\"field not found\")\n\t}\n\n\treturn field\n}",
"func (m *SnapshotPrepare... | [
"0.7423364",
"0.69897777",
"0.6543684",
"0.646257",
"0.64482886",
"0.6440895",
"0.6413086",
"0.6412193",
"0.62891877",
"0.62620795",
"0.6254666",
"0.62189317",
"0.62152255",
"0.6193386",
"0.6186558",
"0.6180651",
"0.6173179",
"0.615851",
"0.61473036",
"0.6134028",
"0.61222106... | 0.6793865 | 2 |
Field returns a field with name | func Field(v interface{}, name string) (*Fieldx, bool) {
return New(v).Field(name)
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"func (msg *Message) Field(fieldName string) *Field {\n\treturn msg.fieldByName[fieldName]\n}",
"func (f *Field) Field(name string) *Field {\n\tfield, ok := f.FieldOk(name)\n\tif !ok {\n\t\tpanic(\"field not found\")\n\t}\n\n\treturn field\n}",
"func (p *GetField) Name() string { return p.name }",
"func (entr... | [
"0.7775857",
"0.77345854",
"0.74935126",
"0.73585737",
"0.7355919",
"0.73011225",
"0.7235797",
"0.71676767",
"0.70273715",
"0.7023392",
"0.7013657",
"0.6991286",
"0.69764125",
"0.6976257",
"0.69483006",
"0.6941868",
"0.6929807",
"0.69133073",
"0.69127744",
"0.69127744",
"0.68... | 0.6887245 | 20 |
Set set value to the field name, must be exported field | func Set(v interface{}, name string, value interface{}) error {
return New(v).Set(name, value)
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"func (o *Actionmap) SetField(field string, fieldValue interface{}) {\n\t// Get Value object for field\n\ttarget := reflect.ValueOf(o)\n\ttargetField := reflect.Indirect(target).FieldByName(field)\n\n\t// Set value\n\tif fieldValue != nil {\n\t\ttargetField.Set(reflect.ValueOf(fieldValue))\n\t} else {\n\t\t// Must ... | [
"0.6949978",
"0.69492817",
"0.68532985",
"0.68419826",
"0.68381053",
"0.6827162",
"0.6813239",
"0.6796274",
"0.6747405",
"0.6737535",
"0.67272395",
"0.66946477",
"0.6677503",
"0.6676532",
"0.66673386",
"0.66642684",
"0.6662115",
"0.665408",
"0.66438115",
"0.6634173",
"0.66304... | 0.0 | -1 |
Zero set zero value to the field name, must be exported field | func Zero(v interface{}, name string) error {
return New(v).Zero(name)
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"func (f *Fieldx) Zero() error {\n\tzero := reflect.Zero(f.value.Type()).Interface()\n\treturn f.Set(zero)\n}",
"func (f *Field) Zero() error {\n\tzero := reflect.Zero(f.value.Type()).Interface()\n\treturn f.Set(zero)\n}",
"func (s *Structx) Zero(name string) error {\n\tf, ok := s.Field(name)\n\tif !ok {\n\t\tr... | [
"0.707016",
"0.69367206",
"0.6867141",
"0.6822513",
"0.67891884",
"0.6624016",
"0.64442945",
"0.6401223",
"0.6326696",
"0.6121608",
"0.61069906",
"0.61046386",
"0.60874426",
"0.60581774",
"0.6054828",
"0.60095847",
"0.5999497",
"0.59959507",
"0.59943426",
"0.599377",
"0.59923... | 0.5743831 | 35 |
New return a new xstruct object, it panic if not struct | func New(v interface{}) *Structx {
if !IsStruct(v) {
panic(ErrNotStruct)
}
vv := reflect.ValueOf(v)
if vv.Kind() == reflect.Ptr {
vv = vv.Elem()
}
s := &Structx{
data: v,
value: vv,
}
return s
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"func New(s interface{}) *Struct {\n\treturn &Struct{\n\t\traw: s,\n\t\tvalue: structVal(s),\n\t\tTagName: DefaultTagName,\n\t}\n}",
"func (*illnessR) NewStruct() *illnessR {\n\treturn &illnessR{}\n}",
"func (*storeR) NewStruct() *storeR {\n\treturn &storeR{}\n}",
"func (*utxoR) NewStruct() *utxoR {\n\t... | [
"0.6531026",
"0.6405301",
"0.6293614",
"0.6285489",
"0.6268683",
"0.6236182",
"0.61969244",
"0.61175734",
"0.604844",
"0.6025139",
"0.60025066",
"0.5989801",
"0.5977882",
"0.5950956",
"0.59397024",
"0.59170663",
"0.59170663",
"0.5900451",
"0.5890951",
"0.5887615",
"0.58850825... | 0.7363922 | 0 |
Name returns name of struct | func (s *Structx) Name() string {
return s.value.Type().Name()
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"func (t *typeStruct) Name() string {\n\treturn t.name\n}",
"func (t *Struct) String() string { return t.Name }",
"func (s *Struct) Name() string {\n\tname := reflect.TypeOf(s.Ref).Elem().String()\n\n\t// strip the package prefix, as we don't want it explicitly in the name\n\tpkgStrip := strings.Split(name, \".... | [
"0.78337574",
"0.76747423",
"0.731499",
"0.7308054",
"0.7260499",
"0.7234671",
"0.72284794",
"0.71106577",
"0.70448375",
"0.6989433",
"0.6928384",
"0.6928275",
"0.6908289",
"0.6873566",
"0.6862104",
"0.6840299",
"0.6824419",
"0.6818603",
"0.6763319",
"0.6750533",
"0.6737451",... | 0.7607495 | 2 |
Struct returns nested struct with name, it panic if not field | func (s *Structx) Struct(name string) *Structx {
f, ok := s.Field(name)
if !ok {
panic(ErrNotField)
}
return New(f.Value())
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"func (field Field) Struct() *Struct {\n\treturn field.Parent.Parent.Parent.StructByName(field.Field.ItemTypeName().Name)\n}",
"func (p Package) Struct(strct string) Struct {\n\treturn Struct{p, strct}\n}",
"func (obj *object) getStructName(line string) {\n\t/*nested := false\n\tif !strings.Contains(line, \"typ... | [
"0.7061889",
"0.6469764",
"0.61510986",
"0.6143574",
"0.6041583",
"0.5890761",
"0.58896327",
"0.58850324",
"0.587014",
"0.58472174",
"0.5809523",
"0.580942",
"0.57638764",
"0.5722698",
"0.5708856",
"0.56878453",
"0.5675025",
"0.56681955",
"0.56636596",
"0.5662201",
"0.5609322... | 0.6602846 | 1 |
Map returns struct name value as map | func (s *Structx) Map() map[string]interface{} {
result := map[string]interface{}{}
fs := s.Fields()
for _, v := range fs {
if !v.IsExport() {
continue
}
result[v.Name()] = v.Value()
}
return result
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"func (self *Map) Map(key string, tagName ...string) map[typeutil.Variant]typeutil.Variant {\n\tif len(tagName) == 0 {\n\t\ttagName = []string{self.structTagKey}\n\t}\n\n\treturn self.Get(key).Map(tagName...)\n}",
"func (s *simpleFieldMapper) Map(value string) map[string]string {\n\n\t// Create a new map\n\tresul... | [
"0.6550753",
"0.6488883",
"0.63773406",
"0.63028806",
"0.6241015",
"0.6223389",
"0.61835444",
"0.6182754",
"0.6062261",
"0.60056233",
"0.5981603",
"0.595988",
"0.5907082",
"0.5865792",
"0.58084315",
"0.5807308",
"0.5769133",
"0.573662",
"0.57096326",
"0.5690888",
"0.5673567",... | 0.6947698 | 0 |
Names returns names of struct | func (s *Structx) Names() []string {
var result []string
fs := s.Fields()
for _, v := range fs {
result = append(result, v.Name())
}
return result
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"func (e *Extractor) Names() (out []string, err error) {\n\n\tif err := e.isValidStruct(); err != nil {\n\t\treturn nil, err\n\t}\n\n\ts := reflect.ValueOf(e.StructAddr).Elem()\n\tfields := e.fields(s)\n\tfor _, field := range fields {\n\t\tout = append(out, field.name)\n\t}\n\n\treturn\n}",
"func Names(v interfa... | [
"0.7588833",
"0.6606947",
"0.6471602",
"0.64051765",
"0.6401359",
"0.63857347",
"0.6371387",
"0.6339941",
"0.6253955",
"0.62511194",
"0.60572946",
"0.60088223",
"0.6007971",
"0.5964404",
"0.596039",
"0.59451365",
"0.5940028",
"0.59323174",
"0.5923466",
"0.59138364",
"0.589982... | 0.7442672 | 1 |
Tags returns tags of struct | func (s *Structx) Tags(key string) (map[string]string, error) {
result := map[string]string{}
fs := s.Fields()
for _, v := range fs {
if !v.IsExport() {
continue
}
result[v.Name()] = v.Tag(key)
}
return result, nil
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"func (f *Field) GetTags() string {\n\tif f == nil {\n\t\treturn \"\"\n\t}\n\n\tjsonTag := \"`json:\\\"\" + f.Name\n\n\tif f.Type.IsInputObject() || !f.Type.IsNonNull() {\n\t\tjsonTag += \",omitempty\"\n\t}\n\n\ttags := jsonTag + \"\\\"`\"\n\n\t// log.Print(\"\\n\\n **************************** \\n\")\n\t// log.Pri... | [
"0.6812187",
"0.662246",
"0.6557578",
"0.64463",
"0.64463",
"0.6434869",
"0.64187056",
"0.64000773",
"0.6397878",
"0.63918966",
"0.63834083",
"0.6358394",
"0.6354617",
"0.63435465",
"0.63312256",
"0.63297874",
"0.6329586",
"0.6325723",
"0.6320472",
"0.63034225",
"0.62952924",... | 0.63906616 | 10 |
Values returns values of struct | func (s *Structx) Values() []interface{} {
var result []interface{}
fs := s.Fields()
for _, v := range fs {
if !v.IsExport() {
continue
}
result = append(result, v.Value())
}
return result
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"func (e *Extractor) Values() (out []interface{}, err error) {\n\n\tif err := e.isValidStruct(); err != nil {\n\t\treturn nil, err\n\t}\n\n\ts := reflect.ValueOf(e.StructAddr).Elem()\n\tfields := e.fields(s)\n\n\tfor _, field := range fields {\n\t\tout = append(out, field.value.Interface())\n\n\t}\n\n\treturn\n}",
... | [
"0.749085",
"0.7193369",
"0.70431256",
"0.6553561",
"0.6546634",
"0.6514496",
"0.6409118",
"0.6362563",
"0.6319657",
"0.6272307",
"0.62592447",
"0.6233262",
"0.6200429",
"0.61777216",
"0.6162476",
"0.615272",
"0.61421496",
"0.6132722",
"0.6131156",
"0.61253464",
"0.6119984",
... | 0.7038614 | 3 |
Fields return fields of struct | func (s *Structx) Fields() []*Fieldx {
tt := s.value.Type()
fields := []*Fieldx{}
for i := 0; i < tt.NumField(); i++ {
field := tt.Field(i)
f := &Fieldx{
data: field,
value: s.value.FieldByName(field.Name),
}
fields = append(fields, f)
}
return fields
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"func (g *generator) structFields(t reflect.Type) []field {\n\tvar fields []field\n\tfor i := 0; i < t.NumField(); i++ {\n\t\tf := t.Field(i)\n\t\tif g.ignoreField(t, f) {\n\t\t\tcontinue\n\t\t}\n\t\tname, _ := parseTag(g.fieldTagKey, f.Tag)\n\t\tif name == \"\" {\n\t\t\tname = f.Name\n\t\t}\n\t\tfields = append(fi... | [
"0.75068235",
"0.7504617",
"0.7480527",
"0.7158599",
"0.71165246",
"0.70371705",
"0.70371604",
"0.70308304",
"0.6974181",
"0.6914422",
"0.6902291",
"0.6891259",
"0.68756706",
"0.68355393",
"0.6823067",
"0.6750258",
"0.67315525",
"0.67079526",
"0.67078584",
"0.66911334",
"0.66... | 0.6436323 | 35 |
HasField returns field is exists | func (s *Structx) HasField(name string) bool {
_, ok := s.value.Type().FieldByName(name)
return ok
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"func (m *Model) HasField(field string) (bool, error) {\n\treturn m.db.GetCore().HasField(m.GetCtx(), m.tablesInit, field)\n}",
"func (o *StatusDescriptorDTO) HasField() bool {\n\tif o != nil && o.Field != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}",
"func IsHasField(st interface{}, fieldName string) bool... | [
"0.7261434",
"0.70997816",
"0.69505",
"0.688207",
"0.68492347",
"0.6732724",
"0.6667359",
"0.66266596",
"0.66261625",
"0.6545041",
"0.63476",
"0.63033026",
"0.6287312",
"0.6181342",
"0.61592114",
"0.6153436",
"0.6124436",
"0.6121026",
"0.6062587",
"0.6048789",
"0.6042881",
... | 0.70268536 | 2 |
MustField returns a field with name, panic if error | func (s *Structx) MustField(name string) *Fieldx {
f, ok := s.Field(name)
if !ok {
panic(ErrNotField)
}
return f
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"func (f *Field) Field(name string) *Field {\n\tfield, ok := f.FieldOk(name)\n\tif !ok {\n\t\tpanic(\"field not found\")\n\t}\n\n\treturn field\n}",
"func MustField(v interface{}, name string) *Fieldx {\n\treturn New(v).MustField(name)\n}",
"func (m *SnapshotPrepare) Field(fieldpath []string) (string, bool) {\n... | [
"0.6989746",
"0.6792741",
"0.6542752",
"0.6461606",
"0.64479554",
"0.6440115",
"0.64128304",
"0.64117295",
"0.6288998",
"0.62609345",
"0.62533206",
"0.6217395",
"0.6214679",
"0.61926746",
"0.61853856",
"0.61795163",
"0.61721337",
"0.6158753",
"0.61470354",
"0.61338425",
"0.61... | 0.74230164 | 0 |
Field returns a field with name | func (s *Structx) Field(name string) (*Fieldx, bool) {
f, ok := s.value.Type().FieldByName(name)
if !ok {
return nil, false
}
ff := &Fieldx{
data: f,
value: s.value.FieldByName(name),
}
return ff, true
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"func (msg *Message) Field(fieldName string) *Field {\n\treturn msg.fieldByName[fieldName]\n}",
"func (f *Field) Field(name string) *Field {\n\tfield, ok := f.FieldOk(name)\n\tif !ok {\n\t\tpanic(\"field not found\")\n\t}\n\n\treturn field\n}",
"func (p *GetField) Name() string { return p.name }",
"func (entr... | [
"0.7775857",
"0.77345854",
"0.74935126",
"0.73585737",
"0.7355919",
"0.73011225",
"0.7235797",
"0.71676767",
"0.70273715",
"0.7023392",
"0.7013657",
"0.6991286",
"0.69764125",
"0.6976257",
"0.69483006",
"0.6941868",
"0.6929807",
"0.69133073",
"0.69127744",
"0.69127744",
"0.68... | 0.67714995 | 37 |
IsStruct returns if field name is a struct | func (s *Structx) IsStruct(name string) bool {
f, ok := s.Field(name)
if !ok {
return false
}
return IsStruct(f.Value())
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"func isStruct(aType *toolbox.TypeInfo) bool {\n\treturn len(aType.Fields()) > 0\n}",
"func IsStruct(value interface{}) bool {\n\treturn kindOf(value) == reflect.Struct\n}",
"func (f *Frugal) IsStruct(t *Type) bool {\n\tt = f.UnderlyingType(t)\n\tif _, ok := frugalBaseTypes[t.Name]; ok {\n\t\treturn false\n\t}\... | [
"0.7687825",
"0.72234344",
"0.70588535",
"0.6954803",
"0.69227856",
"0.68713754",
"0.6829933",
"0.6793955",
"0.6726297",
"0.6669709",
"0.6660877",
"0.6638737",
"0.6592279",
"0.65219784",
"0.64682996",
"0.6446459",
"0.64411604",
"0.6427048",
"0.63174933",
"0.63074785",
"0.6306... | 0.76137424 | 1 |
Set set value to the field name, must be exported field | func (s *Structx) Set(name string, value interface{}) error {
f, ok := s.Field(name)
if !ok {
return ErrNotField
}
return f.Set(value)
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"func (o *Actionmap) SetField(field string, fieldValue interface{}) {\n\t// Get Value object for field\n\ttarget := reflect.ValueOf(o)\n\ttargetField := reflect.Indirect(target).FieldByName(field)\n\n\t// Set value\n\tif fieldValue != nil {\n\t\ttargetField.Set(reflect.ValueOf(fieldValue))\n\t} else {\n\t\t// Must ... | [
"0.6948246",
"0.69475335",
"0.6852958",
"0.68402",
"0.6839158",
"0.6825246",
"0.6811636",
"0.6794739",
"0.6747628",
"0.6737102",
"0.6725907",
"0.66940546",
"0.6676845",
"0.6675546",
"0.6666642",
"0.6664172",
"0.66604984",
"0.66535085",
"0.6643923",
"0.663431",
"0.6629868",
... | 0.6569884 | 29 |
Zero set zero value to the field name, must be exported field | func (s *Structx) Zero(name string) error {
f, ok := s.Field(name)
if !ok {
return ErrNotField
}
return f.Zero()
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"func (f *Fieldx) Zero() error {\n\tzero := reflect.Zero(f.value.Type()).Interface()\n\treturn f.Set(zero)\n}",
"func (f *Field) Zero() error {\n\tzero := reflect.Zero(f.value.Type()).Interface()\n\treturn f.Set(zero)\n}",
"func (p *Pet) SetFieldZeroValue(field *mapping.StructField) error {\n\tswitch field.Inde... | [
"0.7071071",
"0.6937787",
"0.6822378",
"0.67894715",
"0.66243315",
"0.64448553",
"0.6401543",
"0.63275677",
"0.6122518",
"0.6109088",
"0.6105732",
"0.60884833",
"0.60584295",
"0.6056281",
"0.6009469",
"0.60008335",
"0.599678",
"0.5995564",
"0.59935313",
"0.59933484",
"0.59801... | 0.68677104 | 2 |
Name returns name of field | func (f *Fieldx) Name() string {
return f.data.Name
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"func (p *GetField) Name() string { return p.name }",
"func (f *Field) Name() string {\n\treturn f.field.Name\n}",
"func (field Field) Name() string {\n\tif len(field.Names) > 0 {\n\t\treturn field.Names[0].String()\n\t}\n\n\t// The field has no name, so we use Type name as the field name.\n\treturn itemTypeNam... | [
"0.832963",
"0.7992543",
"0.7985175",
"0.7853335",
"0.7773557",
"0.754141",
"0.7497088",
"0.74856347",
"0.73485583",
"0.7335375",
"0.7331214",
"0.7308102",
"0.7304467",
"0.7294199",
"0.72129047",
"0.7151427",
"0.71134114",
"0.70237076",
"0.6984971",
"0.6883465",
"0.6881271",
... | 0.7724901 | 5 |
Kind returns kind of field | func (f *Fieldx) Kind() reflect.Kind {
return f.value.Kind()
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"func (f *Field) Kind() reflect.Kind {\n\treturn f.value.Kind()\n}",
"func (s *StructField) Kind() reflect.Kind {\n\treturn s.value.Kind()\n}",
"func (f *Field) FieldType() int {\r\n\r\n\tswitch f.Value.(type) {\r\n\tcase int:\r\n\t\treturn 0x00\r\n\tcase bool:\r\n\t\treturn 0x01\r\n\tcase float64:\r\n\t\tretur... | [
"0.8147924",
"0.76955324",
"0.654674",
"0.63921",
"0.6350089",
"0.63476145",
"0.634156",
"0.63220066",
"0.6085066",
"0.60765535",
"0.60757846",
"0.60478234",
"0.6044766",
"0.60117584",
"0.6009119",
"0.5945335",
"0.59276253",
"0.59146184",
"0.5896767",
"0.5896631",
"0.5881111"... | 0.7663187 | 2 |
Tag returns tag of field by key | func (f *Fieldx) Tag(key string) string {
return f.data.Tag.Get(key)
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"func (f *Field) Tag(key string) string {\n\treturn f.field.Tag.Get(key)\n}",
"func (s *StructField) Tag(k string) string {\n\treturn s.field.Tag.Get(k)\n}",
"func (f *Feature) Tag(key string) string {\n\treturn string(f.tags[key])\n}",
"func (field Field) TagGet(key string) (string, bool) {\n\tif field.Tag =... | [
"0.82288235",
"0.77249855",
"0.73751974",
"0.7305909",
"0.6847717",
"0.67421174",
"0.67233205",
"0.66461927",
"0.664495",
"0.66103345",
"0.6562071",
"0.6474098",
"0.6356589",
"0.63518935",
"0.62750554",
"0.6253511",
"0.6252165",
"0.6250972",
"0.6249634",
"0.62475234",
"0.6192... | 0.8173703 | 1 |
Value returns value of field | func (f *Fieldx) Value() interface{} {
return f.value.Interface()
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"func (f *Field) Value() interface{} {\n\treturn f.value.Interface()\n}",
"func (f *TagField) Value() string {\n\treturn f.value\n}",
"func (f Fields) ValueForField(fieldName string) string {\n\treturn f.ValueForFieldOfType(fieldName, \"\")\n}",
"func FieldValue(field *InputField) string {\n\treturn field.val... | [
"0.78044575",
"0.7680545",
"0.73264855",
"0.73037875",
"0.7210174",
"0.71595913",
"0.7142725",
"0.7027207",
"0.6973662",
"0.69686407",
"0.69252616",
"0.6924671",
"0.6916548",
"0.6883484",
"0.6877567",
"0.68529385",
"0.67927307",
"0.67806816",
"0.6757554",
"0.6691187",
"0.6673... | 0.777079 | 1 |
IsAnonymous returns if field is anonymous | func (f *Fieldx) IsAnonymous() bool {
return f.data.Anonymous
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"func (u User) IsAnonymous() bool { return u == \"\" }",
"func (u *User) IsAnonymous() bool { return u.userData.Anonymous }",
"func (a Anonymous) Authenticated() bool { return false }",
"func (v *ApiVisitor) VisitAnonymousFiled(ctx *api.AnonymousFiledContext) interface{} {\n\tstart := ctx.GetStart()\n\tstop :... | [
"0.69357014",
"0.6896947",
"0.6249964",
"0.6154933",
"0.60467505",
"0.5950111",
"0.5785039",
"0.57002443",
"0.5689679",
"0.54320973",
"0.5427697",
"0.53811777",
"0.53437966",
"0.52690166",
"0.52450204",
"0.5144951",
"0.50902295",
"0.50505567",
"0.5047496",
"0.5007263",
"0.499... | 0.836871 | 0 |
IsExport returns if field is exported | func (f *Fieldx) IsExport() bool {
return f.data.PkgPath == ""
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"func (f *Field) IsExported() bool {\n\treturn f.field.PkgPath == \"\"\n}",
"func (f *RawStructFieldType) Exported() bool {\n\treturn strings.Title(f.Field.Name) == f.Field.Name\n}",
"func isExportedField(field *lang.DefineFieldExpr) bool {\n\treturn unicode.IsUpper(rune(field.Name[0]))\n}",
"func (id *Ident)... | [
"0.7942144",
"0.7447053",
"0.7007186",
"0.6894166",
"0.6413923",
"0.629122",
"0.5990713",
"0.59261256",
"0.5923288",
"0.5887067",
"0.5830909",
"0.58021146",
"0.57487935",
"0.57351464",
"0.5712679",
"0.5651064",
"0.56369025",
"0.5623521",
"0.5584422",
"0.5584422",
"0.5584422",... | 0.8320898 | 0 |
IsZero returns if field have zero value, for example not initialized it panic if field is not exported | func (f *Fieldx) IsZero() bool {
zero := reflect.Zero(f.value.Type()).Interface()
return reflect.DeepEqual(f.Value(), zero)
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"func (v *AggregatedDutyCycleValue) FieldIsZero(p string) bool {\n\tif v == nil {\n\t\treturn true\n\t}\n\tswitch p {\n\tcase \"value\":\n\t\treturn v.Value == 0\n\t}\n\tpanic(fmt.Sprintf(\"unknown path '%s'\", p))\n}",
"func (v *FCtrl) FieldIsZero(p string) bool {\n\tif v == nil {\n\t\treturn true\n\t}\n\tswitch... | [
"0.76043546",
"0.7460436",
"0.73974884",
"0.73912054",
"0.7389284",
"0.7320315",
"0.7317287",
"0.7259666",
"0.72409093",
"0.72366846",
"0.7227143",
"0.7223447",
"0.71935904",
"0.7121024",
"0.7034144",
"0.7012459",
"0.6996373",
"0.6978928",
"0.6935796",
"0.68634236",
"0.681139... | 0.6695712 | 23 |
Set set value to the field, must be exported field | func (f *Fieldx) Set(v interface{}) error {
if !f.IsExport() {
return ErrNotExported
}
if !f.value.CanSet() {
return errNotSettable
}
vv := reflect.ValueOf(v)
if f.Kind() != vv.Kind() {
return fmt.Errorf("xstruct: value kind not match, want: %s but got %s", f.Kind(), vv.Kind())
}
f.value.Set(vv)
return nil
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"func (f *Field) Set(val interface{}) error {\n\t// we can't set unexported fields, so be sure this field is exported\n\tif !f.IsExported() {\n\t\treturn errNotExported\n\t}\n\n\t// do we get here? not sure...\n\tif !f.value.CanSet() {\n\t\treturn errNotSettable\n\t}\n\n\tgiven := reflect.ValueOf(val)\n\n\tif f.val... | [
"0.7465701",
"0.72227156",
"0.71931934",
"0.7178279",
"0.70525277",
"0.70517707",
"0.6954857",
"0.6877703",
"0.68667024",
"0.68172044",
"0.681091",
"0.6808195",
"0.6804601",
"0.6799116",
"0.67883015",
"0.67820585",
"0.67766744",
"0.6732145",
"0.67154026",
"0.67043096",
"0.670... | 0.72300845 | 1 |
Zero set field to zero value, must be exported field | func (f *Fieldx) Zero() error {
zero := reflect.Zero(f.value.Type()).Interface()
return f.Set(zero)
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"func (f *Field) Zero() error {\n\tzero := reflect.Zero(f.value.Type()).Interface()\n\treturn f.Set(zero)\n}",
"func (dt *FieldTraits) AllowZeroValue(p Path) { dt.add(p, FieldTypeAllowZeroValue) }",
"func (p *Pet) SetFieldZeroValue(field *mapping.StructField) error {\n\tswitch field.Index[0] {\n\tcase 0: // ID\... | [
"0.76958394",
"0.7169645",
"0.70839614",
"0.70075035",
"0.6945009",
"0.6762313",
"0.6735866",
"0.6724727",
"0.66552305",
"0.66209203",
"0.6607081",
"0.66033936",
"0.65720856",
"0.65431416",
"0.65297574",
"0.6425331",
"0.6425331",
"0.6425331",
"0.6425331",
"0.63963276",
"0.635... | 0.77790207 | 0 |
Set n and theta | func (tpe *TPE) Setup(n int, theta float64) {
tpe.setup.N = n
tpe.setup.Theta = theta
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"func (ds DataSet) SetTheta(t [][][]float64) {\n\tfor i, matrix := range t {\n\t\tfor j, row := range matrix {\n\t\t\tds.NN.Thetas[i].SetRow(j, row)\n\t\t}\n\t}\n}",
"func Nagon(n int, radius float64) v2.VecSet {\n\tif n < 3 {\n\t\treturn nil\n\t}\n\tm := Rotate(Tau / float64(n))\n\tv := make(v2.VecSet, n)\n\tp :... | [
"0.570201",
"0.5282836",
"0.51394093",
"0.5008743",
"0.48968518",
"0.48002815",
"0.46859342",
"0.4647159",
"0.46215564",
"0.45934406",
"0.45926017",
"0.45582205",
"0.45221698",
"0.4500831",
"0.44778112",
"0.44498968",
"0.4448061",
"0.4424958",
"0.44235697",
"0.44030243",
"0.4... | 0.58603626 | 0 |
Get n and theta | func (tpe *TPE) GetConfig() (n int, theta float64) {
return tpe.setup.N, tpe.setup.Theta
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"func involuteTheta(\n\tr float64, // base radius\n\td float64, // involute radial distance\n) float64 {\n\tx := d / r\n\treturn math.Sqrt(x*x - 1)\n}",
"func coef(n int, t, y []Num) ([]Num, []Num) {\r\n\tsize := n + 1\r\n\ta := make([]Num, size)\r\n\th := make([]Num, size)\r\n\r\n\tfor i := 1; i <= n; i++ {\r\n\... | [
"0.56499743",
"0.5570517",
"0.55274975",
"0.5270913",
"0.52580523",
"0.5210327",
"0.5186417",
"0.5147195",
"0.5046329",
"0.5032955",
"0.5023559",
"0.5020158",
"0.49866942",
"0.4941833",
"0.4909239",
"0.49024647",
"0.48769343",
"0.48618388",
"0.48359647",
"0.4822305",
"0.48150... | 0.4970011 | 13 |
Export Setup Vars as JSON string | func (tpe *TPE) ExportSetup() string {
// Marshal Struct to JSON string
configJSON, _ := json.Marshal(tpe.setup)
return string(configJSON)
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"func main() {\n\tprovider := &dummyProvider{\n\t\tsettings: map[string]string{},\n\t}\n\tsettings.SetProvider(provider)\n\toutput := map[string]string{}\n\tfor key, name := range provider.settings {\n\t\tvalue := os.Getenv(key)\n\t\tif value == \"\" {\n\t\t\tcontinue\n\t\t}\n\t\toutput[name] = value\n\t}\n\tdata, ... | [
"0.631789",
"0.5536032",
"0.5465756",
"0.5427909",
"0.5401986",
"0.5396326",
"0.53941",
"0.52809274",
"0.5243702",
"0.5160759",
"0.5114038",
"0.51007146",
"0.5063309",
"0.5053315",
"0.5032404",
"0.50227076",
"0.50181514",
"0.50147146",
"0.49809915",
"0.49705908",
"0.49643305"... | 0.6818595 | 0 |
Import Setup Vars from JSON string | func (tpe *TPE) ImportSetup(JSON string) {
// Unmarshal and load Config
json.Unmarshal([]byte(JSON), &tpe.setup)
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"func (obj *JSONObject) ImportString(str string) {\n\tobj.ImportRaw(json.RawMessage(str))\n}",
"func (obj *JSONObject) ImportRaw(str json.RawMessage) {\n\terr := json.Unmarshal(str, &obj)\n\tif err != nil {\n\t\tdescribe(err)\n\t}\n}",
"func (r *Vars) UnmarshalJSON(b []byte) error {\n\trawVars := make(map[strin... | [
"0.55925316",
"0.54728365",
"0.54148096",
"0.5374281",
"0.53484166",
"0.52084845",
"0.5208345",
"0.5178336",
"0.51544327",
"0.5094269",
"0.50767475",
"0.5066785",
"0.506295",
"0.5060029",
"0.50245893",
"0.49681205",
"0.49542847",
"0.49385795",
"0.49327472",
"0.4896272",
"0.48... | 0.69953114 | 0 |
NewDeviceContext creates a new context given a DeviceConfig. DeviceContext will use that configuration to compute how long requests take. | func newDeviceContext(config *slowfs.DeviceConfig) *deviceContext {
var writeBackCache *writeBackCache
if config.FsyncStrategy == slowfs.WriteBackCachedFsync {
writeBackCache = newWriteBackCache(config)
}
return &deviceContext{
deviceConfig: config,
logger: log.New(os.Stderr, "DeviceContext: ", log.Ldate|log.Ltime|log.Lshortfile),
writeBackCache: writeBackCache,
}
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"func NewContext(config *Config) (*Context, error) {\n\tvar context Context\n\tvar ret C.int32_t\n\tif config != nil {\n\t\tret = C.tiledb_ctx_alloc(config.tiledbConfig, &context.tiledbContext)\n\t} else {\n\t\tret = C.tiledb_ctx_alloc(nil, &context.tiledbContext)\n\t}\n\tif ret != C.TILEDB_OK {\n\t\treturn nil, fm... | [
"0.60010606",
"0.58748376",
"0.58544135",
"0.56649375",
"0.55289286",
"0.55034286",
"0.54515684",
"0.54493266",
"0.5427652",
"0.54165214",
"0.5393935",
"0.5357877",
"0.53502446",
"0.5347706",
"0.53308403",
"0.52864504",
"0.52632374",
"0.5250634",
"0.5219931",
"0.5216731",
"0.... | 0.74137986 | 0 |
ComputeTime computes how long a request should take given the current state of the device. It does not update the context. | func (dc *deviceContext) computeTime(req *Request) time.Duration {
requestDuration := time.Duration(0)
switch req.Type {
// Handle metadata requests, plus metadata requests that have been factored out because we
// need separate handling for them.
case MetadataRequest, CloseRequest:
requestDuration = dc.deviceConfig.MetadataOpTime
case AllocateRequest:
requestDuration = dc.computeSeekTime(req) + dc.deviceConfig.AllocateTime(req.Size)
case ReadRequest:
requestDuration = dc.computeSeekTime(req) + dc.deviceConfig.ReadTime(req.Size)
case WriteRequest:
switch dc.deviceConfig.WriteStrategy {
case slowfs.FastWrite:
// Leave at 0 seconds.
case slowfs.SimulateWrite:
requestDuration = dc.computeSeekTime(req) + dc.deviceConfig.WriteTime(req.Size)
}
case FsyncRequest:
switch dc.deviceConfig.FsyncStrategy {
case slowfs.DumbFsync:
requestDuration = dc.deviceConfig.SeekTime * 10
case slowfs.WriteBackCachedFsync:
requestDuration = dc.deviceConfig.SeekTime + dc.deviceConfig.WriteTime(dc.writeBackCache.getUnwrittenBytes(req.Path))
}
default:
dc.logger.Printf("unknown request type for %+v\n", req)
}
return latestTime(dc.busyUntil, req.Timestamp).Add(requestDuration).Sub(req.Timestamp)
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"func getTime(r *http.Request) time.Duration {\n\tif ctx := r.Context().Value(toTime); ctx != nil {\n\t\tvalue, ok := ctx.(time.Time)\n\t\tif ok {\n\t\t\treturn time.Since(value)\n\t\t}\n\t}\n\n\treturn 0\n}",
"func computeTime(referenceTime time.Time, referenceUptime, eventUptime time.Duration) time.Time {\n\tdi... | [
"0.6423677",
"0.6169987",
"0.59779924",
"0.59779924",
"0.58311296",
"0.5684228",
"0.56696755",
"0.56140286",
"0.55195993",
"0.55083275",
"0.5452939",
"0.5432582",
"0.5420827",
"0.5411604",
"0.53523755",
"0.5336318",
"0.53116274",
"0.52941823",
"0.52860546",
"0.5259746",
"0.52... | 0.77658814 | 0 |
Execute executes a given request, applying changes to the device context. | func (dc *deviceContext) execute(req *Request) {
spareTime := req.Timestamp.Sub(dc.busyUntil)
// Devote spare time to writing back cache.
if spareTime > 0 && dc.writeBackCache != nil {
dc.writeBackCache.writeBack(spareTime)
}
dc.busyUntil = req.Timestamp.Add(dc.computeTime(req))
switch req.Type {
case MetadataRequest, AllocateRequest:
// Do nothing.
case CloseRequest:
if dc.writeBackCache != nil {
dc.writeBackCache.close(req.Path)
}
if dc.lastAccessedFile == req.Path {
dc.lastAccessedFile = ""
dc.firstUnseenByte = 0
}
case ReadRequest:
dc.lastAccessedFile = req.Path
dc.firstUnseenByte = req.Start + req.Size
case WriteRequest:
switch dc.deviceConfig.WriteStrategy {
case slowfs.FastWrite:
// Fast writes don't affect things here.
case slowfs.SimulateWrite:
dc.lastAccessedFile = req.Path
dc.firstUnseenByte = req.Start + req.Size
}
if dc.writeBackCache != nil {
dc.writeBackCache.write(req.Path, req.Size)
}
case FsyncRequest:
if dc.writeBackCache != nil {
dc.writeBackCache.writeBackFile(req.Path)
}
default:
dc.logger.Printf("unknown request type for %+v\n", req)
}
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"func ExecuteRequest(req *http.Request, result interface{}) error {\n\tclient := http.Client{}\n\tresponse, err := client.Do(req)\n\tif err != nil {\n\t\tlog.Println(\"Error executing request call\")\n\t\tlog.Println(err)\n\t\treturn err\n\t}\n\tdefer response.Body.Close()\n\tout, err := ioutil.ReadAll(response.Bod... | [
"0.66719776",
"0.63951325",
"0.63034904",
"0.6293009",
"0.61960685",
"0.616474",
"0.61634",
"0.61555916",
"0.61194813",
"0.6007152",
"0.5956136",
"0.5890451",
"0.5877885",
"0.5847017",
"0.5831893",
"0.57932687",
"0.5766032",
"0.57413876",
"0.5740811",
"0.57251626",
"0.5697184... | 0.64396346 | 1 |
add DeployCmd and it's respective flags parameters: nil returns: nil | func init() {
RootCmd.AddCommand(DeployCmd)
DeployCmd.Flags().StringP("file", "f", "", "file used to specify the job to deploy (required)")
DeployCmd.Flags().StringP("port", "p", "", "connect to a specific port (default: 3939)")
DeployCmd.MarkFlagRequired("file")
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"func init() {\n\tRootCmd.AddCommand(DeployCmd)\n\tDeployCmd.Flags().StringP(\"file\", \"f\", \"\", \"file used to specify the job to deploy (required)\")\n\tDeployCmd.Flags().StringP(\"port\", \"p\", \"\", \"connect to a specific port (default: 3939)\")\n\tDeployCmd.MarkFlagRequired(\"file\")\n}",
"func NewDeplo... | [
"0.67180616",
"0.6289662",
"0.61988926",
"0.61870503",
"0.6114755",
"0.61016816",
"0.6063185",
"0.5987771",
"0.5962346",
"0.5956628",
"0.5893648",
"0.5819978",
"0.5727794",
"0.56987953",
"0.56575954",
"0.5643189",
"0.563208",
"0.5610448",
"0.5586293",
"0.5584757",
"0.5575489"... | 0.7252531 | 0 |
this function is called as the run operation for the DeployCmd parameters: cmd (the definition of cmd.Command), args (an array of strings passed to the command) returns: nil | func deployJob(cmd *cobra.Command, args []string) {
port, _:= cmd.Flags().GetString("port")
if port == "" {
port = DefaultPort
}
name, _:= cmd.Flags().GetString("file")
yaml := unmarsharlYaml(readJobFile(name))
currentDir, _ := os.Getwd()
var job NewJob
job.ID = yaml.Job.ID
job.UID = fmt.Sprint(syscall.Getuid())
group, _ := user.LookupGroup("odin")
gid, _ := strconv.Atoi(group.Gid)
job.GID = strconv.Itoa(gid)
job.Name = yaml.Job.Name
job.Description = yaml.Job.Description
job.File = currentDir + "/" + yaml.Job.File
if yaml.Job.Language == "go" {
job.Language = yaml.Job.Language
cmd := exec.Command(job.Language, "build", job.File)
cmd.SysProcAttr = &syscall.SysProcAttr{}
_, err := cmd.CombinedOutput()
if err != nil {
fmt.Println(err)
os.Exit(2)
}
job.File = job.File[:len(job.File)-3]
} else {
job.Language = yaml.Job.Language
}
job.Schedule = getScheduleString(name, port)
jobJSON, _ := json.Marshal(job)
body := makePostRequest(fmt.Sprintf("http://localhost%s/jobs", port), bytes.NewBuffer(jobJSON))
fmt.Println(body)
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"func (c *DeployCommand) Run(args []string) int {\n\n\tvar err error\n\tvar level, format string\n\n\tconfig := &levant.DeployConfig{\n\t\tClient: &structs.ClientConfig{},\n\t\tDeploy: &structs.DeployConfig{},\n\t\tPlan: &structs.PlanConfig{},\n\t\tTemplate: &structs.TemplateConfig{},\n\t}\n\n\tflags := c.M... | [
"0.6999749",
"0.6883601",
"0.66720974",
"0.647015",
"0.6439493",
"0.6367923",
"0.62261665",
"0.6170908",
"0.6144135",
"0.6070954",
"0.60189515",
"0.60038346",
"0.59228235",
"0.583011",
"0.5787182",
"0.57143575",
"0.57111585",
"0.5704478",
"0.57001704",
"0.5697601",
"0.5682563... | 0.59596425 | 12 |
this function is used to read a file parameters: name (a string containing the path to a file) returns: []byte (an array of bytes containing the contents of the file) | func readJobFile(name string) []byte {
file, err := os.Open(name)
if err != nil {
log.Fatal(err)
}
bytes, err := ioutil.ReadAll(file)
defer file.Close()
return bytes
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"func readJobFile(name string) []byte {\n\tfile, err := os.Open(name)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tbytes, _ := ioutil.ReadAll(file)\n\tdefer file.Close()\n\treturn bytes\n}",
"func ReadFromFile(name string) []byte {\n\tdata, err := ioutil.ReadFile(name)\n\tif err !=nil{\n\t\tpanic(0)\n\t}\n\tret... | [
"0.69813824",
"0.6925253",
"0.6889243",
"0.6857324",
"0.679577",
"0.6663792",
"0.6663792",
"0.6564147",
"0.6492016",
"0.6458569",
"0.6413158",
"0.6352887",
"0.6337797",
"0.63189846",
"0.6313896",
"0.6284289",
"0.6278029",
"0.6267357",
"0.62547106",
"0.62303627",
"0.6223603",
... | 0.7253405 | 0 |
this function is used to unmarshal YAML parameters: byteArray (an array of bytes representing the contents of a file) returns: Config (a struct form of the YAML) | func unmarsharlYaml(byteArray []byte) Config {
var cfg Config
err := yaml.Unmarshal([]byte(byteArray), &cfg)
if err != nil {
log.Fatalf("error: %v", err)
}
return cfg
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"func ReadConfigFromByteArray(configYaml []byte) *Config {\n\tc := &Config{}\n\n\terr := yaml.Unmarshal(configYaml, c)\n\tif err != nil {\n\t\tlog.Fatalf(\"Invalid configuration: %v\", err)\n\t\treturn nil\n\t}\n\n\tc.Vars.init()\n\treturn c\n}",
"func unmarsharlYaml(byteArray []byte) Config {\n\tvar cfg Config\n... | [
"0.7526334",
"0.74325585",
"0.71376395",
"0.6780493",
"0.6310663",
"0.62009126",
"0.61722964",
"0.6167369",
"0.6165938",
"0.6147107",
"0.6135909",
"0.6120184",
"0.60807824",
"0.5971607",
"0.5964108",
"0.595612",
"0.59326005",
"0.5868942",
"0.581166",
"0.57967645",
"0.5746139"... | 0.8160983 | 0 |
this function is used to check if a directory exists parameters: dir (a string containing the path to the checked directory) returns: boolean (true is no error in checking the existence of the directory, false if otherwise) | func ensureDirectory(dir string) bool {
if _, err := os.Stat(dir); os.IsNotExist(err) {
return false
}
return true
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"func (f *Fs) _dirExists(ctx context.Context, dirPath string) (exists bool) {\n\topts := rest.Opts{\n\t\tMethod: \"PROPFIND\",\n\t\tPath: dirPath,\n\t\tExtraHeaders: map[string]string{\n\t\t\t\"Depth\": \"0\",\n\t\t},\n\t}\n\tvar result api.Multistatus\n\tvar resp *http.Response\n\tvar err error\n\terr = f.pacer.... | [
"0.8022152",
"0.7980696",
"0.7967961",
"0.79369617",
"0.79153675",
"0.7788843",
"0.775478",
"0.7736916",
"0.771233",
"0.7554062",
"0.74997157",
"0.74757224",
"0.7441968",
"0.74419415",
"0.7429944",
"0.7408777",
"0.7405653",
"0.7399855",
"0.73931146",
"0.738378",
"0.73702705",... | 0.78437215 | 5 |
this function is used to get the schedule string using the path to the file parameters: name (a string containing the path to a file), port (a string of the port to be used) returns: ss (the generated schedule string) | func getScheduleString(name string, port string) string {
dir, _ := os.Getwd()
absPath := []byte(dir + "/" + name)
ss := makePostRequest(fmt.Sprintf("http://localhost%s/schedule", port), bytes.NewBuffer(absPath))
return ss
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"func getScheduleString(name string, port string) string {\n\tdir, _ := os.Getwd()\n\tabsPath := []byte(dir + \"/\" + name)\n\tss := makePostRequest(fmt.Sprintf(\"http://localhost%s/schedule\", port), bytes.NewBuffer(absPath))\n\treturn ss\n}",
"func (client ScheduleClient) RequestSchedule(date string) ([]byte, e... | [
"0.73062176",
"0.5404668",
"0.5138776",
"0.5093022",
"0.5044953",
"0.50393766",
"0.49811786",
"0.49227092",
"0.49220976",
"0.49137813",
"0.48866478",
"0.48760164",
"0.48616835",
"0.47537345",
"0.4747598",
"0.47460353",
"0.47455624",
"0.4702152",
"0.46913794",
"0.46859178",
"0... | 0.74915403 | 0 |
Read implements the Conn Read method. | func (c *Conn) Read(b []byte) (int, error) {
if !c.ok() {
return 0, syscall.EINVAL
}
if len(c.recvRest) > 0 {
l := copy(b, c.recvRest)
c.recvRest = c.recvRest[l:]
return l, nil
}
p, err := c.recvBuf.Pop()
if err != nil {
return 0, err
}
l := copy(b, p)
c.recvRest = p[l:]
return l, nil
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"func (c *conn) Read(p []byte) (int, error) {\n\treturn c.reader.Read(p)\n}",
"func (clientConn *Conn) Read(p []byte) (n int, err error) {\n\treturn clientConn.dataReader.Read(p)\n}",
"func (c *WrappedConn) Read(b []byte) (n int, err error) {\n\t//c.Conn is certainly not nil\n\tn, err = c.Conn.Read(b)\n\tif err... | [
"0.751353",
"0.74954724",
"0.7471595",
"0.7398077",
"0.7330712",
"0.7235126",
"0.722001",
"0.71372116",
"0.71111274",
"0.709893",
"0.70859236",
"0.70671546",
"0.7060391",
"0.70343703",
"0.702886",
"0.7021947",
"0.698377",
"0.6972257",
"0.69662213",
"0.69353044",
"0.6924279",
... | 0.6590935 | 49 |
Write implements the Conn Write method. | func (c *Conn) Write(b []byte) (int, error) {
if !c.ok() {
return 0, syscall.EINVAL
}
payload := b
if len(payload) > mss {
payload = payload[:mss]
}
_, err := c.sendBuf.Push(payload)
if err != nil {
return 0, err
}
l, err := c.sendDATA(payload)
if err != nil {
return 0, err
}
return l, nil
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"func (connection *Connection) Write(b []byte) (int, error) {\n\t//TODO\n}",
"func (p *Conn) Write(b []byte) (int, error) {\n\treturn p.conn.Write(b)\n}",
"func (c *conn) Write(p []byte) (int, error) {\n\terr := binary.Write(c.Conn, binary.BigEndian, uint32(len(p)))\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\... | [
"0.75177634",
"0.74215007",
"0.73879325",
"0.7332111",
"0.7312324",
"0.7310505",
"0.7264981",
"0.72418797",
"0.7232844",
"0.7203702",
"0.71649534",
"0.71483743",
"0.7077446",
"0.7073222",
"0.7066996",
"0.70635927",
"0.7054253",
"0.7044179",
"0.6984287",
"0.6943448",
"0.694005... | 0.64009035 | 64 |
Close closes the connection. | func (c *Conn) Close() error {
if !c.ok() {
return syscall.EINVAL
}
select {
case <-c.closeChan:
default:
c.closeSendBuf()
c.sendFIN()
}
return nil
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"func (c *Conn) Close() error { return nil }",
"func Close() {\n\tconn.Close()\n}",
"func (c *Conn) Close() error { return c.pc.Close() }",
"func (v *connection) Close() error {\n\tconnectionLogger.Trace(\"connection.Close()\")\n\n\tv.sendMessage(&msgs.FETerminateMsg{})\n\n\tvar result error = nil\n\n\tif v.c... | [
"0.7775359",
"0.7427443",
"0.7338917",
"0.7321364",
"0.7235921",
"0.72172064",
"0.7214366",
"0.7186836",
"0.71783304",
"0.717726",
"0.71748966",
"0.7154546",
"0.71541876",
"0.7110452",
"0.7101479",
"0.7098534",
"0.70903337",
"0.7086785",
"0.7075161",
"0.7068597",
"0.7064785",... | 0.0 | -1 |
LocalAddr returns the local network address. | func (c *Conn) LocalAddr() net.Addr {
if !c.ok() {
return nil
}
return c.conn.LocalAddr()
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"func (s *Conn) LocalAddr() net.Addr {\n\treturn Addr{s.local}\n}",
"func (c *Client) LocalAddr() net.Addr {\n\tc.mu.Lock()\n\tdefer c.mu.Unlock()\n\treturn c.lAddr\n}",
"func (s *Server) LocalAddr() net.Addr {\n\treturn s.udpServ.PacketConn.LocalAddr()\n}",
"func (u *UDP) LocalAddr() net.Addr {\n\treturn u.c... | [
"0.819511",
"0.81470126",
"0.80634415",
"0.8026287",
"0.8009632",
"0.80041057",
"0.79830116",
"0.791989",
"0.7919187",
"0.7894389",
"0.7838935",
"0.7817483",
"0.7807562",
"0.7787841",
"0.77753973",
"0.7737554",
"0.7707347",
"0.7702835",
"0.7686021",
"0.7678269",
"0.7678269",
... | 0.7668036 | 22 |
RemoteAddr returns the remote network address. | func (c *Conn) RemoteAddr() net.Addr {
if !c.ok() {
return nil
}
return c.raddr
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"func (dc *Conn) RemoteAddr() net.Addr {\n\treturn dc.getConn().RemoteAddr()\n}",
"func (s *Conn) RemoteAddr() net.Addr {\n\treturn Addr{s.remote}\n}",
"func (c *Conn) RemoteAddr() net.Addr {\n\tvar err error\n\n\tc.once.Do(func() {\n\t\terr = c.scanProxyData()\n\t})\n\tif err != nil {\n\t\treturn nil\n\t}\n\n\... | [
"0.77139986",
"0.77115506",
"0.76626843",
"0.7597765",
"0.7562441",
"0.7547449",
"0.7542905",
"0.7530346",
"0.7527101",
"0.74879175",
"0.74879175",
"0.74879175",
"0.74846125",
"0.7463457",
"0.74571884",
"0.7453051",
"0.7443206",
"0.74371713",
"0.74066687",
"0.7380345",
"0.736... | 0.76058763 | 3 |
SetDeadline implements the Conn SetDeadline method. | func (c *Conn) SetDeadline(t time.Time) error {
if !c.ok() {
return syscall.EINVAL
}
err := c.SetReadDeadline(t)
if err != nil {
return err
}
return c.SetWriteDeadline(t)
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"func (c *Conn) SetDeadline(t time.Time) error {\n\treturn fmt.Errorf(\"No supported\")\n}",
"func (c *Conn) SetDeadline(t time.Time) error { return c.pc.SetDeadline(t) }",
"func (c *Conn) SetDeadline(t time.Time) error {\n // return c.conn.SetDeadline(t)\n fmt.Println(\"set deadline\", t)\n return nil... | [
"0.89029294",
"0.8833888",
"0.88141",
"0.8760783",
"0.8758353",
"0.8758353",
"0.87352335",
"0.86974245",
"0.86226743",
"0.8615378",
"0.85717165",
"0.85715985",
"0.85475075",
"0.84554946",
"0.84285027",
"0.8362345",
"0.83554965",
"0.83529186",
"0.8343889",
"0.8312316",
"0.8293... | 0.8424976 | 15 |
SetReadDeadline implements the Conn SetReadDeadline method. | func (c *Conn) SetReadDeadline(t time.Time) error {
if !c.ok() {
return syscall.EINVAL
}
c.deadlineMutex.Lock()
defer c.deadlineMutex.Unlock()
c.rdeadline = t
return nil
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"func (c *Conn) SetReadDeadline(t time.Time) error {\n\treturn fmt.Errorf(\"No supported\")\n}",
"func (c *Conn) SetReadDeadline(t time.Time) error { return c.pc.SetReadDeadline(t) }",
"func (c Conn) SetReadDeadline(t time.Time) error {\n\treturn c.conn.SetReadDeadline(t)\n}",
"func (c *cConn) SetReadDeadline... | [
"0.88569814",
"0.8804388",
"0.87452424",
"0.87290215",
"0.86889523",
"0.86709",
"0.8662243",
"0.86535764",
"0.8639709",
"0.8635167",
"0.8631107",
"0.8623234",
"0.8623234",
"0.8623234",
"0.8616967",
"0.8611767",
"0.86115295",
"0.8609532",
"0.8597688",
"0.85944986",
"0.8548238"... | 0.849646 | 22 |
SetWriteDeadline implements the Conn SetWriteDeadline method. | func (c *Conn) SetWriteDeadline(t time.Time) error {
if !c.ok() {
return syscall.EINVAL
}
c.deadlineMutex.Lock()
defer c.deadlineMutex.Unlock()
c.wdeadline = t
return nil
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"func (c *Conn) SetWriteDeadline(t time.Time) error { return c.pc.SetWriteDeadline(t) }",
"func (c *Conn) SetWriteDeadline(t time.Time) error {\n\treturn fmt.Errorf(\"No supported\")\n}",
"func (c *cConn) SetWriteDeadline(t time.Time) error {\n\treturn syscall.EINVAL\n}",
"func (c *Conn) SetWriteDeadline(t ti... | [
"0.8970274",
"0.8926833",
"0.89109606",
"0.8867294",
"0.88668895",
"0.88653904",
"0.8826544",
"0.8816165",
"0.88076603",
"0.87781227",
"0.87760365",
"0.87662244",
"0.87433636",
"0.87411124",
"0.87369555",
"0.87160337",
"0.8684204",
"0.8683646",
"0.8677109",
"0.8677109",
"0.86... | 0.8790527 | 9 |
namespace returns the namespace of tiller | func namespace() string {
if ns := os.Getenv("TILLER_NAMESPACE"); ns != "" {
return ns
}
// Fall back to the namespace associated with the service account token, if available
if data, err := ioutil.ReadFile("/var/run/secrets/kubernetes.io/serviceaccount/namespace"); err == nil {
if ns := strings.TrimSpace(string(data)); len(ns) > 0 {
return ns
}
}
return environment.DefaultTillerNamespace
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"func (o ApplicationSpecRolloutplanCanarymetricTemplaterefOutput) Namespace() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v ApplicationSpecRolloutplanCanarymetricTemplateref) *string { return v.Namespace }).(pulumi.StringPtrOutput)\n}",
"func getNamespace() string {\n\tns := os.Getenv(\"POD_NAMESPACE\")\n\ti... | [
"0.68790233",
"0.6823478",
"0.6823478",
"0.68113446",
"0.6795647",
"0.66579765",
"0.66444504",
"0.6587921",
"0.65514493",
"0.6545297",
"0.64766943",
"0.6472167",
"0.645568",
"0.64538574",
"0.6449971",
"0.64347273",
"0.64197195",
"0.64137775",
"0.6413226",
"0.63904345",
"0.638... | 0.7538144 | 0 |
TestLocalWriteWithExpiredContext ensures that writes are at least attempted even with an expired context, this is so that data is not lost even if the original writer has already disconnected. | func TestLocalWriteWithExpiredContext(t *testing.T) {
ctrl := xtest.NewController(t)
defer ctrl.Finish()
store := setupLocalWrite(t, ctrl)
writeQuery := newWriteQuery(t)
past := time.Now().Add(-time.Minute)
ctx, cancel := context.WithDeadline(context.Background(), past)
defer cancel()
// Ensure expired.
var expired bool
select {
case <-ctx.Done():
expired = true
default:
}
require.True(t, expired, "context expected to be expired")
err := store.Write(ctx, writeQuery)
assert.NoError(t, err)
assert.NoError(t, store.Close())
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"func TestLocalWritesWithExpiredContext(t *testing.T) {\n\tctrl := xtest.NewController(t)\n\tdefer ctrl.Finish()\n\tstore := setupLocalWrite(t, ctrl)\n\twriteQueryOpts := newWriteQuery(t).Options()\n\twriteQueryOpts.Datapoints = ts.Datapoints{\n\t\tts.Datapoint{\n\t\t\tTimestamp: xtime.Now(),\n\t\t\tValue: 42,\... | [
"0.86863756",
"0.535115",
"0.50087106",
"0.4998404",
"0.48275077",
"0.47786194",
"0.46923557",
"0.4685437",
"0.46595412",
"0.46560925",
"0.46249428",
"0.46072173",
"0.4568705",
"0.45547703",
"0.45439237",
"0.45234445",
"0.4492733",
"0.44916826",
"0.44442126",
"0.4440123",
"0.... | 0.8729709 | 0 |
TestLocalWritesWithExpiredContext ensures that writes are at least attempted even with an expired context, this is so that data is not lost even if the original writer has already disconnected. | func TestLocalWritesWithExpiredContext(t *testing.T) {
ctrl := xtest.NewController(t)
defer ctrl.Finish()
store := setupLocalWrite(t, ctrl)
writeQueryOpts := newWriteQuery(t).Options()
writeQueryOpts.Datapoints = ts.Datapoints{
ts.Datapoint{
Timestamp: xtime.Now(),
Value: 42,
},
ts.Datapoint{
Timestamp: xtime.Now(),
Value: 84,
},
}
writeQuery, err := storage.NewWriteQuery(writeQueryOpts)
require.NoError(t, err)
past := time.Now().Add(-time.Minute)
ctx, cancel := context.WithDeadline(context.Background(), past)
defer cancel()
// Ensure expired.
var expired bool
select {
case <-ctx.Done():
expired = true
default:
}
require.True(t, expired, "context expected to be expired")
err = store.Write(ctx, writeQuery)
assert.NoError(t, err)
assert.NoError(t, store.Close())
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"func TestLocalWriteWithExpiredContext(t *testing.T) {\n\tctrl := xtest.NewController(t)\n\tdefer ctrl.Finish()\n\tstore := setupLocalWrite(t, ctrl)\n\twriteQuery := newWriteQuery(t)\n\n\tpast := time.Now().Add(-time.Minute)\n\n\tctx, cancel := context.WithDeadline(context.Background(), past)\n\tdefer cancel()\n\n\... | [
"0.8501558",
"0.51481897",
"0.49856946",
"0.4984615",
"0.47959307",
"0.4789426",
"0.469212",
"0.46893492",
"0.4668998",
"0.46620876",
"0.46356317",
"0.45818096",
"0.45338818",
"0.45038548",
"0.44520673",
"0.4442732",
"0.44425097",
"0.4439125",
"0.443855",
"0.4431337",
"0.4430... | 0.8570746 | 0 |
NewListIssueGroupOfProjectVersionParams creates a new ListIssueGroupOfProjectVersionParams object with the default values initialized. | func NewListIssueGroupOfProjectVersionParams() *ListIssueGroupOfProjectVersionParams {
var (
limitDefault = int32(200)
showhiddenDefault = bool(false)
showremovedDefault = bool(false)
showshortfilenamesDefault = bool(false)
showsuppressedDefault = bool(false)
startDefault = int32(0)
)
return &ListIssueGroupOfProjectVersionParams{
Limit: &limitDefault,
Showhidden: &showhiddenDefault,
Showremoved: &showremovedDefault,
Showshortfilenames: &showshortfilenamesDefault,
Showsuppressed: &showsuppressedDefault,
Start: &startDefault,
timeout: cr.DefaultTimeout,
}
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"func NewListIssueGroupOfProjectVersionParamsWithHTTPClient(client *http.Client) *ListIssueGroupOfProjectVersionParams {\n\tvar (\n\t\tlimitDefault = int32(200)\n\t\tshowhiddenDefault = bool(false)\n\t\tshowremovedDefault = bool(false)\n\t\tshowshortfilenamesDefault = bool(false)\n\t\tsh... | [
"0.77106774",
"0.7519926",
"0.7266955",
"0.7068472",
"0.69551784",
"0.6806871",
"0.6550852",
"0.6518673",
"0.6478527",
"0.641597",
"0.63347816",
"0.6258998",
"0.61002636",
"0.5913099",
"0.57597464",
"0.5716092",
"0.5573168",
"0.54209363",
"0.5116466",
"0.5106761",
"0.50922406... | 0.8728173 | 0 |
NewListIssueGroupOfProjectVersionParamsWithTimeout creates a new ListIssueGroupOfProjectVersionParams object with the default values initialized, and the ability to set a timeout on a request | func NewListIssueGroupOfProjectVersionParamsWithTimeout(timeout time.Duration) *ListIssueGroupOfProjectVersionParams {
var (
limitDefault = int32(200)
showhiddenDefault = bool(false)
showremovedDefault = bool(false)
showshortfilenamesDefault = bool(false)
showsuppressedDefault = bool(false)
startDefault = int32(0)
)
return &ListIssueGroupOfProjectVersionParams{
Limit: &limitDefault,
Showhidden: &showhiddenDefault,
Showremoved: &showremovedDefault,
Showshortfilenames: &showshortfilenamesDefault,
Showsuppressed: &showsuppressedDefault,
Start: &startDefault,
timeout: timeout,
}
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"func (o *ListIssueGroupOfProjectVersionParams) WithTimeout(timeout time.Duration) *ListIssueGroupOfProjectVersionParams {\n\to.SetTimeout(timeout)\n\treturn o\n}",
"func NewListIssueGroupOfProjectVersionParams() *ListIssueGroupOfProjectVersionParams {\n\tvar (\n\t\tlimitDefault = int32(200)\n\t\tsho... | [
"0.8285777",
"0.76709485",
"0.6999598",
"0.6788122",
"0.6615298",
"0.64738816",
"0.6425471",
"0.627703",
"0.6234231",
"0.6165254",
"0.61050606",
"0.60693634",
"0.59893113",
"0.5973421",
"0.596011",
"0.5880141",
"0.5867417",
"0.58638144",
"0.5848223",
"0.57892823",
"0.5765758"... | 0.866563 | 0 |
NewListIssueGroupOfProjectVersionParamsWithContext creates a new ListIssueGroupOfProjectVersionParams object with the default values initialized, and the ability to set a context for a request | func NewListIssueGroupOfProjectVersionParamsWithContext(ctx context.Context) *ListIssueGroupOfProjectVersionParams {
var (
limitDefault = int32(200)
showhiddenDefault = bool(false)
showremovedDefault = bool(false)
showshortfilenamesDefault = bool(false)
showsuppressedDefault = bool(false)
startDefault = int32(0)
)
return &ListIssueGroupOfProjectVersionParams{
Limit: &limitDefault,
Showhidden: &showhiddenDefault,
Showremoved: &showremovedDefault,
Showshortfilenames: &showshortfilenamesDefault,
Showsuppressed: &showsuppressedDefault,
Start: &startDefault,
Context: ctx,
}
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"func (o *ListIssueGroupOfProjectVersionParams) WithContext(ctx context.Context) *ListIssueGroupOfProjectVersionParams {\n\to.SetContext(ctx)\n\treturn o\n}",
"func NewListIssueGroupOfProjectVersionParams() *ListIssueGroupOfProjectVersionParams {\n\tvar (\n\t\tlimitDefault = int32(200)\n\t\tshowhidde... | [
"0.7456868",
"0.7009486",
"0.656374",
"0.65403444",
"0.6411083",
"0.6195592",
"0.60353374",
"0.5974516",
"0.5833243",
"0.58255297",
"0.57971835",
"0.5711053",
"0.5581234",
"0.5545537",
"0.55109894",
"0.5403098",
"0.5391696",
"0.53086615",
"0.528166",
"0.515868",
"0.503509",
... | 0.8186808 | 0 |
NewListIssueGroupOfProjectVersionParamsWithHTTPClient creates a new ListIssueGroupOfProjectVersionParams object with the default values initialized, and the ability to set a custom HTTPClient for a request | func NewListIssueGroupOfProjectVersionParamsWithHTTPClient(client *http.Client) *ListIssueGroupOfProjectVersionParams {
var (
limitDefault = int32(200)
showhiddenDefault = bool(false)
showremovedDefault = bool(false)
showshortfilenamesDefault = bool(false)
showsuppressedDefault = bool(false)
startDefault = int32(0)
)
return &ListIssueGroupOfProjectVersionParams{
Limit: &limitDefault,
Showhidden: &showhiddenDefault,
Showremoved: &showremovedDefault,
Showshortfilenames: &showshortfilenamesDefault,
Showsuppressed: &showsuppressedDefault,
Start: &startDefault,
HTTPClient: client,
}
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"func (o *ListIssueGroupOfProjectVersionParams) WithHTTPClient(client *http.Client) *ListIssueGroupOfProjectVersionParams {\n\to.SetHTTPClient(client)\n\treturn o\n}",
"func (o *ListIssueGroupOfProjectVersionParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}",
"func NewListIssueGroupOfProj... | [
"0.8360157",
"0.70928437",
"0.6931408",
"0.6445891",
"0.6429422",
"0.635374",
"0.63402766",
"0.6332963",
"0.6255657",
"0.61940205",
"0.61775863",
"0.6096276",
"0.6079328",
"0.59976125",
"0.59611464",
"0.5923058",
"0.58905584",
"0.58664536",
"0.58020717",
"0.57899433",
"0.5706... | 0.82316375 | 1 |
WithTimeout adds the timeout to the list issue group of project version params | func (o *ListIssueGroupOfProjectVersionParams) WithTimeout(timeout time.Duration) *ListIssueGroupOfProjectVersionParams {
o.SetTimeout(timeout)
return o
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"func NewListIssueGroupOfProjectVersionParamsWithTimeout(timeout time.Duration) *ListIssueGroupOfProjectVersionParams {\n\tvar (\n\t\tlimitDefault = int32(200)\n\t\tshowhiddenDefault = bool(false)\n\t\tshowremovedDefault = bool(false)\n\t\tshowshortfilenamesDefault = bool(false)\n\t\tsho... | [
"0.76033574",
"0.71231157",
"0.6361641",
"0.63389295",
"0.61667013",
"0.6160391",
"0.61558175",
"0.60834527",
"0.59376264",
"0.59171396",
"0.59017605",
"0.5847091",
"0.58287615",
"0.5822885",
"0.5785406",
"0.57296455",
"0.5713106",
"0.5704875",
"0.5696664",
"0.5583554",
"0.55... | 0.79587877 | 0 |
SetTimeout adds the timeout to the list issue group of project version params | func (o *ListIssueGroupOfProjectVersionParams) SetTimeout(timeout time.Duration) {
o.timeout = timeout
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"func (o *GetUserIssueSearchOptionsOfProjectVersionParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}",
"func (o *TestProjectVersionParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}",
"func (o *ListIssueGroupOfProjectVersionParams) WithTimeout(timeout time.Duration) *ListI... | [
"0.7419088",
"0.7415998",
"0.74146557",
"0.7346928",
"0.7313649",
"0.70382524",
"0.7035942",
"0.7019492",
"0.6918667",
"0.6724615",
"0.67212605",
"0.6717218",
"0.668169",
"0.6655724",
"0.6655445",
"0.66514814",
"0.663366",
"0.66275287",
"0.6624522",
"0.6608101",
"0.65465057",... | 0.79935664 | 0 |
WithContext adds the context to the list issue group of project version params | func (o *ListIssueGroupOfProjectVersionParams) WithContext(ctx context.Context) *ListIssueGroupOfProjectVersionParams {
o.SetContext(ctx)
return o
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"func NewListIssueGroupOfProjectVersionParamsWithContext(ctx context.Context) *ListIssueGroupOfProjectVersionParams {\n\tvar (\n\t\tlimitDefault = int32(200)\n\t\tshowhiddenDefault = bool(false)\n\t\tshowremovedDefault = bool(false)\n\t\tshowshortfilenamesDefault = bool(false)\n\t\tshows... | [
"0.62948304",
"0.598528",
"0.5581085",
"0.552212",
"0.54645795",
"0.545413",
"0.5422915",
"0.5419807",
"0.5402281",
"0.5400749",
"0.5349832",
"0.53158486",
"0.53141356",
"0.5290659",
"0.51958764",
"0.51732075",
"0.51531976",
"0.5130647",
"0.5128487",
"0.5125622",
"0.5115193",... | 0.70730007 | 0 |
SetContext adds the context to the list issue group of project version params | func (o *ListIssueGroupOfProjectVersionParams) SetContext(ctx context.Context) {
o.Context = ctx
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"func (o *ListIssueGroupOfProjectVersionParams) WithContext(ctx context.Context) *ListIssueGroupOfProjectVersionParams {\n\to.SetContext(ctx)\n\treturn o\n}",
"func (o *GetUserIssueSearchOptionsOfProjectVersionParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}",
"func (o *ListSourceFileOfProjectVer... | [
"0.7051063",
"0.6554501",
"0.65222734",
"0.64833874",
"0.6381549",
"0.63245904",
"0.60549706",
"0.6049594",
"0.6018889",
"0.59537435",
"0.5920727",
"0.590724",
"0.5905415",
"0.58888704",
"0.58767873",
"0.585948",
"0.5840669",
"0.583863",
"0.5824884",
"0.58164436",
"0.58100796... | 0.7039994 | 1 |
WithHTTPClient adds the HTTPClient to the list issue group of project version params | func (o *ListIssueGroupOfProjectVersionParams) WithHTTPClient(client *http.Client) *ListIssueGroupOfProjectVersionParams {
o.SetHTTPClient(client)
return o
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"func NewListIssueGroupOfProjectVersionParamsWithHTTPClient(client *http.Client) *ListIssueGroupOfProjectVersionParams {\n\tvar (\n\t\tlimitDefault = int32(200)\n\t\tshowhiddenDefault = bool(false)\n\t\tshowremovedDefault = bool(false)\n\t\tshowshortfilenamesDefault = bool(false)\n\t\tsh... | [
"0.7229135",
"0.7128695",
"0.62978494",
"0.62627566",
"0.612443",
"0.60220456",
"0.5927224",
"0.58634484",
"0.58452076",
"0.58451164",
"0.5792246",
"0.57803667",
"0.5738177",
"0.571743",
"0.5710379",
"0.57090145",
"0.56999815",
"0.56932706",
"0.56893724",
"0.56738585",
"0.564... | 0.7929709 | 0 |
SetHTTPClient adds the HTTPClient to the list issue group of project version params | func (o *ListIssueGroupOfProjectVersionParams) SetHTTPClient(client *http.Client) {
o.HTTPClient = client
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"func (o *GetUserIssueSearchOptionsOfProjectVersionParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}",
"func (o *ListSourceFileOfProjectVersionParams) SetHTTPClient(client *http.Client) {\n\to.HTTPClient = client\n}",
"func (o *ListIssueGroupOfProjectVersionParams) WithHTTPClient(client *... | [
"0.75781035",
"0.7545774",
"0.7496822",
"0.74832404",
"0.7327541",
"0.72963005",
"0.7206542",
"0.7167657",
"0.7121102",
"0.70960355",
"0.7063285",
"0.7042941",
"0.7024429",
"0.7010168",
"0.7000214",
"0.6990505",
"0.69846416",
"0.69845563",
"0.6974066",
"0.69693106",
"0.696433... | 0.82597166 | 0 |
WithFields adds the fields to the list issue group of project version params | func (o *ListIssueGroupOfProjectVersionParams) WithFields(fields *string) *ListIssueGroupOfProjectVersionParams {
o.SetFields(fields)
return o
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"func NewListIssueGroupOfProjectVersionParamsWithHTTPClient(client *http.Client) *ListIssueGroupOfProjectVersionParams {\n\tvar (\n\t\tlimitDefault = int32(200)\n\t\tshowhiddenDefault = bool(false)\n\t\tshowremovedDefault = bool(false)\n\t\tshowshortfilenamesDefault = bool(false)\n\t\tsh... | [
"0.6581097",
"0.64508575",
"0.6125761",
"0.6103511",
"0.6050853",
"0.5857859",
"0.58447516",
"0.578941",
"0.5752445",
"0.5636374",
"0.5558553",
"0.54393566",
"0.54314333",
"0.5418689",
"0.5353155",
"0.53410625",
"0.5295799",
"0.5289252",
"0.5279767",
"0.5277713",
"0.5277713",... | 0.72750825 | 0 |
SetFields adds the fields to the list issue group of project version params | func (o *ListIssueGroupOfProjectVersionParams) SetFields(fields *string) {
o.Fields = fields
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"func (o *ListIssueGroupOfProjectVersionParams) WithFields(fields *string) *ListIssueGroupOfProjectVersionParams {\n\to.SetFields(fields)\n\treturn o\n}",
"func (o *GetUserIssueSearchOptionsOfProjectVersionParams) SetFields(fields *string) {\n\to.Fields = fields\n}",
"func (o *ListSourceFileOfProjectVersionPara... | [
"0.6598279",
"0.6416085",
"0.62957495",
"0.5919385",
"0.5818365",
"0.57457006",
"0.56834465",
"0.5646775",
"0.5639487",
"0.5610329",
"0.5610329",
"0.5608815",
"0.54954934",
"0.54609525",
"0.5449537",
"0.5446919",
"0.544069",
"0.54366577",
"0.5426538",
"0.5410048",
"0.5400385"... | 0.66055834 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.