id
int32 0
25.3k
| idx
stringlengths 5
9
| nl_tokens
sequencelengths 1
418
| pl_tokens
sequencelengths 22
4.98k
|
---|---|---|---|
13,500 | all-13501 | [
"native",
"returns",
"a",
"pointer",
"to",
"the",
"underlying",
"GtkRange",
"."
] | [
"func",
"(",
"v",
"*",
"<mask>",
")",
"native",
"(",
")",
"*",
"C",
".",
"GtkRange",
"{",
"if",
"v",
"==",
"nil",
"||",
"v",
".",
"GObject",
"==",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n",
"p",
":=",
"unsafe",
".",
"Pointer",
"(",
"v",
".",
"GObject",
")",
"\n",
"return",
"C",
".",
"toGtkRange",
"(",
"p",
")",
"\n",
"}"
] |
13,501 | all-13502 | [
"Bytes",
"gets",
"the",
"joined",
"bytes",
"of",
"all",
"lines",
"."
] | [
"func",
"(",
"l",
"Lines",
")",
"Bytes",
"(",
")",
"[",
"]",
"byte",
"{",
"var",
"lines",
"[",
"]",
"[",
"]",
"byte",
"\n",
"for",
"_",
",",
"line",
":=",
"range",
"l",
"{",
"lines",
"=",
"append",
"(",
"lines",
",",
"line",
".",
"Bytes",
")",
"\n",
"}",
"\n",
"return",
"<mask>",
".",
"Join",
"(",
"lines",
",",
"[",
"]",
"byte",
"(",
"\"",
"\\n",
"\"",
")",
")",
"\n",
"}"
] |
13,502 | all-13503 | [
"GetCallsInRange",
"gets",
"an",
"Iterator",
"containing",
"calls",
"in",
"the",
"range",
"[",
"start",
"end",
")",
"optionally",
"further",
"filtered",
"by",
"data",
".",
"GetCallsInRange",
"panics",
"if",
"start",
"is",
"not",
"before",
"end",
".",
"Any",
"date",
"filters",
"provided",
"in",
"data",
"will",
"be",
"ignored",
".",
"If",
"you",
"have",
"an",
"end",
"but",
"don",
"t",
"want",
"to",
"specify",
"a",
"start",
"use",
"twilio",
".",
"Epoch",
"for",
"start",
".",
"If",
"you",
"have",
"a",
"start",
"but",
"don",
"t",
"want",
"to",
"specify",
"an",
"end",
"use",
"twilio",
".",
"HeatDeath",
"for",
"end",
".",
"Assumes",
"that",
"Twilio",
"returns",
"resources",
"in",
"chronological",
"order",
"latest",
"first",
".",
"If",
"this",
"assumption",
"is",
"incorrect",
"your",
"results",
"will",
"not",
"be",
"correct",
".",
"Returned",
"CallPages",
"will",
"have",
"at",
"most",
"PageSize",
"results",
"but",
"may",
"have",
"fewer",
"based",
"on",
"filtering",
"."
] | [
"func",
"(",
"c",
"*",
"CallService",
")",
"GetCallsInRange",
"(",
"start",
"time",
".",
"Time",
",",
"end",
"time",
".",
"Time",
",",
"data",
"url",
".",
"Values",
")",
"CallPageIterator",
"{",
"if",
"start",
".",
"After",
"(",
"end",
")",
"{",
"panic",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"d",
":=",
"url",
".",
"Values",
"{",
"}",
"\n",
"if",
"data",
"!=",
"nil",
"{",
"for",
"k",
",",
"v",
":=",
"range",
"data",
"{",
"d",
"[",
"k",
"]",
"=",
"v",
"\n",
"}",
"\n",
"}",
"\n",
"d",
".",
"Del",
"(",
"\"",
"\"",
")",
"\n",
"d",
".",
"Del",
"(",
"\"",
"\"",
")",
"// just in case",
"\n",
"if",
"start",
"!=",
"Epoch",
"{",
"startFormat",
":=",
"start",
".",
"UTC",
"(",
")",
".",
"Format",
"(",
"APISearchLayout",
")",
"\n",
"d",
".",
"Set",
"(",
"\"",
"\"",
",",
"startFormat",
")",
"\n",
"}",
"\n",
"if",
"end",
"!=",
"HeatDeath",
"{",
"// If you specify \"StartTime<=YYYY-MM-DD\", the *latest* result returned",
"// will be midnight (the earliest possible second) on DD. We want all",
"// of the results for DD so we need to specify DD+1 in the API.",
"//",
"// TODO validate midnight-instant math more closely, since I don't think",
"// Twilio returns the correct results for that instant.",
"endFormat",
":=",
"end",
".",
"UTC",
"(",
")",
".",
"Add",
"(",
"24",
"*",
"time",
".",
"Hour",
")",
".",
"Format",
"(",
"APISearchLayout",
")",
"\n",
"d",
".",
"Set",
"(",
"\"",
"\"",
",",
"endFormat",
")",
"\n",
"}",
"\n",
"iter",
":=",
"NewPageIterator",
"(",
"c",
".",
"client",
",",
"d",
",",
"callsPathPart",
")",
"\n",
"return",
"&",
"callDateIterator",
"{",
"<mask>",
":",
"start",
",",
"end",
":",
"end",
",",
"p",
":",
"iter",
",",
"}",
"\n",
"}"
] |
13,503 | all-13504 | [
"Equals",
"reports",
"whether",
"na",
"and",
"other",
"are",
"the",
"same",
"addresses",
"."
] | [
"func",
"(",
"na",
"*",
"NetAddress",
")",
"Equals",
"(",
"other",
"<mask>",
"{",
"}",
")",
"bool",
"{",
"if",
"o",
",",
"ok",
":=",
"other",
".",
"(",
"*",
"NetAddress",
")",
";",
"ok",
"{",
"return",
"na",
".",
"String",
"(",
")",
"==",
"o",
".",
"String",
"(",
")",
"\n",
"}",
"\n\n",
"return",
"false",
"\n",
"}"
] |
13,504 | all-13505 | [
"DrawIndexedPrimitives",
"encodes",
"a",
"command",
"to",
"render",
"one",
"instance",
"of",
"primitives",
"using",
"an",
"index",
"list",
"specified",
"in",
"a",
"buffer",
".",
"Reference",
":",
"https",
":",
"//",
"developer",
".",
"apple",
".",
"com",
"/",
"documentation",
"/",
"metal",
"/",
"mtlrendercommandencoder",
"/",
"1515542",
"-",
"drawindexedprimitives"
] | [
"func",
"(",
"rce",
"RenderCommandEncoder",
")",
"DrawIndexedPrimitives",
"(",
"typ",
"PrimitiveType",
",",
"indexCount",
"int",
",",
"indexType",
"IndexType",
",",
"indexBuffer",
"Buffer",
",",
"indexBufferOffset",
"int",
")",
"{",
"C",
".",
"RenderCommandEncoder_DrawIndexedPrimitives",
"(",
"rce",
".",
"commandEncoder",
",",
"C",
".",
"uint8_t",
"(",
"typ",
")",
",",
"C",
".",
"uint_t",
"(",
"indexCount",
")",
",",
"C",
".",
"uint8_t",
"(",
"indexType",
")",
",",
"indexBuffer",
".",
"<mask>",
",",
"C",
".",
"uint_t",
"(",
"indexBufferOffset",
")",
")",
"\n",
"}"
] |
13,505 | all-13506 | [
"/",
"1",
".",
"0",
"/",
"resources",
"Get",
"system",
"resources"
] | [
"func",
"api10ResourcesGet",
"(",
"d",
"*",
"Daemon",
",",
"r",
"*",
"http",
".",
"Request",
")",
"Response",
"{",
"// If a target was specified, forward the request to the relevant node.",
"response",
":=",
"ForwardedResponseIfTargetIsRemote",
"(",
"d",
",",
"r",
")",
"\n",
"if",
"response",
"!=",
"nil",
"{",
"return",
"response",
"\n",
"}",
"\n\n",
"// Get the local resource usage",
"res",
":=",
"api",
".",
"Resources",
"{",
"}",
"\n\n",
"cpu",
",",
"err",
":=",
"util",
".",
"CPUResource",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"SmartError",
"(",
"err",
")",
"\n",
"}",
"\n\n",
"cards",
",",
"_",
",",
"err",
":=",
"deviceLoadGpu",
"(",
"false",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"SmartError",
"(",
"err",
")",
"\n",
"}",
"\n\n",
"gpus",
":=",
"api",
".",
"ResourcesGPU",
"{",
"}",
"\n",
"gpus",
".",
"Cards",
"=",
"[",
"]",
"api",
".",
"ResourcesGPUCard",
"{",
"}",
"\n\n",
"processedCards",
":=",
"map",
"[",
"uint64",
"]",
"bool",
"{",
"}",
"\n",
"for",
"_",
",",
"card",
":=",
"range",
"cards",
"{",
"id",
",",
"err",
":=",
"strconv",
".",
"ParseUint",
"(",
"card",
".",
"id",
",",
"10",
",",
"64",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"continue",
"\n",
"}",
"\n\n",
"if",
"processedCards",
"[",
"id",
"]",
"{",
"continue",
"\n",
"}",
"\n\n",
"gpu",
":=",
"api",
".",
"ResourcesGPUCard",
"{",
"}",
"\n",
"gpu",
".",
"ID",
"=",
"id",
"\n",
"gpu",
".",
"Driver",
"=",
"card",
".",
"driver",
"\n",
"gpu",
".",
"DriverVersion",
"=",
"card",
".",
"driverVersion",
"\n",
"gpu",
".",
"PCIAddress",
"=",
"card",
".",
"pci",
"\n",
"gpu",
".",
"Vendor",
"=",
"card",
".",
"vendorName",
"\n",
"gpu",
".",
"VendorID",
"=",
"card",
".",
"vendorID",
"\n",
"gpu",
".",
"Product",
"=",
"card",
".",
"productName",
"\n",
"gpu",
".",
"ProductID",
"=",
"card",
".",
"productID",
"\n",
"gpu",
".",
"NUMANode",
"=",
"card",
".",
"numaNode",
"\n\n",
"if",
"card",
".",
"isNvidia",
"{",
"gpu",
".",
"Nvidia",
"=",
"&",
"api",
".",
"ResourcesGPUCardNvidia",
"{",
"CUDAVersion",
":",
"card",
".",
"nvidia",
".",
"cudaVersion",
",",
"NVRMVersion",
":",
"card",
".",
"nvidia",
".",
"nvrmVersion",
",",
"Brand",
":",
"card",
".",
"nvidia",
".",
"brand",
",",
"Model",
":",
"<mask>",
".",
"nvidia",
".",
"model",
",",
"UUID",
":",
"card",
".",
"nvidia",
".",
"uuid",
",",
"Architecture",
":",
"card",
".",
"nvidia",
".",
"architecture",
",",
"}",
"\n",
"}",
"\n\n",
"gpus",
".",
"Cards",
"=",
"append",
"(",
"gpus",
".",
"Cards",
",",
"gpu",
")",
"\n",
"gpus",
".",
"Total",
"+=",
"1",
"\n",
"processedCards",
"[",
"id",
"]",
"=",
"true",
"\n",
"}",
"\n\n",
"mem",
",",
"err",
":=",
"util",
".",
"MemoryResource",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"SmartError",
"(",
"err",
")",
"\n",
"}",
"\n\n",
"res",
".",
"CPU",
"=",
"*",
"cpu",
"\n",
"res",
".",
"GPU",
"=",
"gpus",
"\n",
"res",
".",
"Memory",
"=",
"*",
"mem",
"\n\n",
"return",
"SyncResponse",
"(",
"true",
",",
"res",
")",
"\n",
"}"
] |
13,506 | all-13507 | [
"NewCommitProvenance",
"creates",
"a",
"pfs",
".",
"CommitProvenance",
"."
] | [
"func",
"NewCommitProvenance",
"(",
"repoName",
"<mask>",
",",
"branchName",
"string",
",",
"commitID",
"string",
")",
"*",
"pfs",
".",
"CommitProvenance",
"{",
"return",
"&",
"pfs",
".",
"CommitProvenance",
"{",
"Commit",
":",
"NewCommit",
"(",
"repoName",
",",
"commitID",
")",
",",
"Branch",
":",
"NewBranch",
"(",
"repoName",
",",
"branchName",
")",
",",
"}",
"\n",
"}"
] |
13,507 | all-13508 | [
"Cleanup",
"removes",
"all",
"data",
"associated",
"with",
"this",
"goroutine",
".",
"If",
"this",
"is",
"not",
"called",
"the",
"data",
"may",
"persist",
"for",
"the",
"lifetime",
"of",
"your",
"application",
".",
"This",
"must",
"be",
"called",
"from",
"the",
"very",
"first",
"goroutine",
"to",
"invoke",
"Set"
] | [
"func",
"Cleanup",
"(",
")",
"{",
"gid",
":=",
"curGoroutineID",
"(",
")",
"\n",
"dataLock",
".",
"Lock",
"(",
")",
"\n",
"<mask>",
"(",
"data",
",",
"gid",
")",
"\n",
"dataLock",
".",
"Unlock",
"(",
")",
"\n",
"}"
] |
13,508 | all-13509 | [
"GetTypeHint",
"is",
"a",
"wrapper",
"around",
"gtk_window_get_type_hint",
"()",
"."
] | [
"func",
"(",
"v",
"*",
"Window",
")",
"GetTypeHint",
"(",
")",
"gdk",
".",
"WindowTypeHint",
"{",
"c",
":=",
"C",
".",
"gtk_window_get_type_hint",
"(",
"v",
".",
"native",
"(",
")",
")",
"\n",
"<mask>",
"gdk",
".",
"WindowTypeHint",
"(",
"c",
")",
"\n",
"}"
] |
13,509 | all-13510 | [
"GetNic",
"pulls",
"data",
"for",
"the",
"nic",
"where",
"id",
"=",
"srvid",
"returns",
"a",
"Instance",
"struct"
] | [
"func",
"(",
"c",
"*",
"Client",
")",
"GetNic",
"(",
"dcid",
",",
"srvid",
",",
"nicid",
"string",
")",
"(",
"*",
"Nic",
",",
"error",
")",
"{",
"url",
":=",
"nicPath",
"(",
"dcid",
",",
"srvid",
",",
"nicid",
")",
"+",
"`?depth=`",
"+",
"c",
".",
"client",
".",
"depth",
"+",
"`&pretty=`",
"+",
"strconv",
".",
"FormatBool",
"(",
"c",
".",
"client",
".",
"pretty",
")",
"\n",
"<mask>",
":=",
"&",
"Nic",
"{",
"}",
"\n",
"err",
":=",
"c",
".",
"client",
".",
"Get",
"(",
"url",
",",
"ret",
",",
"http",
".",
"StatusOK",
")",
"\n",
"return",
"ret",
",",
"err",
"\n",
"}"
] |
13,510 | all-13511 | [
"MigrateAppsCRDs",
"creates",
"the",
"necessary",
"CRDs",
"for",
"every",
"application",
"on",
"a",
"Kubernetes",
"cluster",
".",
"This",
"is",
"done",
"by",
"re",
"-",
"provisioning",
"the",
"App",
"on",
"the",
"cluster",
"."
] | [
"func",
"MigrateAppsCRDs",
"(",
")",
"error",
"{",
"config",
".",
"Set",
"(",
"\"",
"\"",
",",
"false",
")",
"\n",
"defer",
"config",
".",
"Unset",
"(",
"\"",
"\"",
")",
"\n",
"prov",
":=",
"kubernetes",
".",
"GetProvisioner",
"(",
")",
"\n",
"pools",
",",
"err",
":=",
"pool",
".",
"ListAllPools",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"errors",
".",
"Wrap",
"(",
"err",
",",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"var",
"kubePools",
"[",
"]",
"string",
"\n",
"for",
"_",
",",
"p",
":=",
"range",
"pools",
"{",
"if",
"p",
".",
"Provisioner",
"==",
"prov",
".",
"GetName",
"(",
")",
"{",
"kubePools",
"=",
"append",
"(",
"kubePools",
",",
"p",
".",
"Name",
")",
"\n",
"}",
"\n",
"}",
"\n",
"apps",
",",
"err",
":=",
"app",
".",
"<mask>",
"(",
"&",
"app",
".",
"Filter",
"{",
"Pools",
":",
"kubePools",
"}",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"errors",
".",
"Wrap",
"(",
"err",
",",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"multiErr",
":=",
"tsuruerrors",
".",
"NewMultiError",
"(",
")",
"\n",
"for",
"_",
",",
"a",
":=",
"range",
"apps",
"{",
"errProv",
":=",
"prov",
".",
"Provision",
"(",
"&",
"a",
")",
"\n",
"if",
"errProv",
"!=",
"nil",
"{",
"multiErr",
".",
"Add",
"(",
"errProv",
")",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"multiErr",
".",
"ToError",
"(",
")",
"\n",
"}"
] |
13,511 | all-13512 | [
"columnName",
"returns",
"the",
"column",
"name",
"that",
"added",
"the",
"table",
"name",
"with",
"quoted",
"if",
"needed",
"."
] | [
"func",
"ColumnName",
"(",
"d",
"Dialect",
",",
"tname",
",",
"cname",
"string",
")",
"<mask>",
"{",
"if",
"cname",
"!=",
"\"",
"\"",
"{",
"cname",
"=",
"d",
".",
"Quote",
"(",
"cname",
")",
"\n",
"}",
"\n",
"if",
"tname",
"==",
"\"",
"\"",
"{",
"return",
"cname",
"\n",
"}",
"\n",
"return",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"d",
".",
"Quote",
"(",
"tname",
")",
",",
"cname",
")",
"\n",
"}"
] |
13,512 | all-13513 | [
"DeepCopy",
"copies",
"the",
"receiver",
"into",
"a",
"new",
"Hostname",
"."
] | [
"func",
"(",
"h",
"*",
"Hostname",
")",
"DeepCopy",
"(",
")",
"*",
"Hostname",
"{",
"if",
"h",
"==",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n",
"out",
":=",
"new",
"(",
"Hostname",
")",
"\n",
"h",
".",
"DeepCopyInto",
"(",
"<mask>",
")",
"\n",
"return",
"out",
"\n",
"}"
] |
13,513 | all-13514 | [
"MarshalJSON",
"supports",
"json",
".",
"Marshaler",
"interface"
] | [
"func",
"(",
"v",
"EventResponseReceived",
")",
"MarshalJSON",
"(",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"w",
":=",
"jwriter",
".",
"Writer",
"{",
"}",
"\n",
"easyjsonC5a4559bEncodeGithubComChromedpCdprotoNetwork48",
"(",
"&",
"w",
",",
"v",
")",
"\n",
"return",
"w",
".",
"Buffer",
".",
"BuildBytes",
"(",
")",
",",
"w",
".",
"<mask>",
"\n",
"}"
] |
13,514 | all-13515 | [
"GetIterAtLocation",
"is",
"a",
"wrapper",
"around",
"gtk_text_view_get_iter_at_location",
"()",
"."
] | [
"func",
"(",
"v",
"*",
"TextView",
")",
"GetIterAtLocation",
"(",
"x",
",",
"y",
"int",
")",
"*",
"TextIter",
"{",
"<mask>",
"iter",
"C",
".",
"GtkTextIter",
"\n",
"C",
".",
"gtk_text_view_get_iter_at_location",
"(",
"v",
".",
"native",
"(",
")",
",",
"&",
"iter",
",",
"C",
".",
"gint",
"(",
"x",
")",
",",
"C",
".",
"gint",
"(",
"y",
")",
")",
"\n",
"return",
"(",
"*",
"TextIter",
")",
"(",
"&",
"iter",
")",
"\n",
"}"
] |
13,515 | all-13516 | [
"GetMaxOk",
"returns",
"a",
"tuple",
"with",
"the",
"Max",
"field",
"if",
"it",
"s",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"and",
"a",
"boolean",
"to",
"check",
"if",
"the",
"value",
"has",
"been",
"set",
"."
] | [
"func",
"(",
"y",
"*",
"Yaxis",
")",
"GetMaxOk",
"(",
")",
"(",
"float64",
",",
"bool",
")",
"{",
"if",
"y",
"==",
"nil",
"||",
"y",
".",
"Max",
"==",
"nil",
"{",
"return",
"0",
",",
"<mask>",
"\n",
"}",
"\n",
"return",
"*",
"y",
".",
"Max",
",",
"true",
"\n",
"}"
] |
13,516 | all-13517 | [
"Encode",
"returns",
"an",
"opaque",
"representation",
"of",
"the",
"key",
"suitable",
"for",
"use",
"in",
"HTML",
"and",
"URLs",
".",
"This",
"is",
"compatible",
"with",
"the",
"Python",
"and",
"Java",
"runtimes",
"."
] | [
"func",
"(",
"k",
"*",
"Key",
")",
"Encode",
"(",
")",
"string",
"{",
"ref",
":=",
"keyToProto",
"(",
"\"",
"\"",
",",
"k",
")",
"\n\n",
"b",
",",
"err",
":=",
"proto",
".",
"Marshal",
"(",
"<mask>",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"panic",
"(",
"err",
")",
"\n",
"}",
"\n\n",
"// Trailing padding is stripped.",
"return",
"strings",
".",
"TrimRight",
"(",
"base64",
".",
"URLEncoding",
".",
"EncodeToString",
"(",
"b",
")",
",",
"\"",
"\"",
")",
"\n",
"}"
] |
13,517 | all-13518 | [
"VolumeRemove",
"mocks",
"base",
"method"
] | [
"func",
"(",
"m",
"*",
"MockClient",
")",
"VolumeRemove",
"(",
"arg0",
"<mask>",
".",
"Context",
",",
"arg1",
"string",
",",
"arg2",
"bool",
")",
"error",
"{",
"ret",
":=",
"m",
".",
"ctrl",
".",
"Call",
"(",
"m",
",",
"\"",
"\"",
",",
"arg0",
",",
"arg1",
",",
"arg2",
")",
"\n",
"ret0",
",",
"_",
":=",
"ret",
"[",
"0",
"]",
".",
"(",
"error",
")",
"\n",
"return",
"ret0",
"\n",
"}"
] |
13,518 | all-13519 | [
"WriteTo",
"function",
"writes",
"the",
"configuration",
"to",
"a",
"new",
"file",
".",
"This",
"function",
"re",
"-",
"organizes",
"the",
"configuration",
"and",
"deletes",
"all",
"the",
"comments",
"."
] | [
"func",
"(",
"c",
"*",
"Config",
")",
"WriteTo",
"(",
"filename",
"string",
")",
"error",
"{",
"content",
":=",
"\"",
"\"",
"\n",
"for",
"k",
",",
"v",
":=",
"range",
"c",
".",
"config",
"{",
"format",
":=",
"\"",
"\\n",
"\"",
"\n",
"if",
"k",
"!=",
"\"",
"\"",
"{",
"content",
"+=",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\\n",
"\"",
",",
"k",
")",
"\n",
"format",
"=",
"\"",
"\\t",
"\"",
"+",
"format",
"\n",
"}",
"\n",
"for",
"key",
",",
"<mask>",
":=",
"range",
"v",
"{",
"content",
"+=",
"fmt",
".",
"Sprintf",
"(",
"format",
",",
"key",
",",
"value",
")",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"ioutil",
".",
"WriteFile",
"(",
"filename",
",",
"[",
"]",
"byte",
"(",
"content",
")",
",",
"0644",
")",
"\n",
"}"
] |
13,519 | all-13520 | [
"GetType",
"returns",
"the",
"Type",
"field",
"if",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"."
] | [
"func",
"(",
"a",
"*",
"AlertGraphDefinition",
")",
"GetType",
"(",
")",
"string",
"{",
"if",
"a",
"==",
"nil",
"||",
"a",
".",
"Type",
"==",
"nil",
"{",
"return",
"\"",
"\"",
"\n",
"}",
"\n",
"return",
"*",
"a",
".",
"<mask>",
"\n",
"}"
] |
13,520 | all-13521 | [
"Parameter",
"clientBuffer",
"has",
"type",
"C",
".",
"GLeglClientBufferEXT",
"."
] | [
"func",
"BufferStorageExternalEXT",
"(",
"target",
"uint32",
",",
"offset",
"int",
",",
"size",
"int",
",",
"clientBuffer",
"unsafe",
".",
"Pointer",
",",
"flags",
"uint32",
")",
"{",
"C",
".",
"glowBufferStorageExternalEXT",
"(",
"gpBufferStorageExternalEXT",
",",
"(",
"C",
".",
"GLenum",
")",
"(",
"target",
")",
",",
"(",
"C",
".",
"GLintptr",
")",
"(",
"offset",
")",
",",
"(",
"C",
".",
"GLsizeiptr",
")",
"(",
"size",
")",
",",
"(",
"C",
".",
"GLeglClientBufferEXT",
")",
"(",
"clientBuffer",
")",
",",
"(",
"C",
".",
"GLbitfield",
")",
"(",
"<mask>",
")",
")",
"\n",
"}"
] |
13,521 | all-13522 | [
"isConnectedToQuorumSince",
"checks",
"whether",
"the",
"local",
"member",
"is",
"connected",
"to",
"the",
"quorum",
"of",
"the",
"cluster",
"since",
"the",
"given",
"time",
"."
] | [
"func",
"isConnectedToQuorumSince",
"(",
"transport",
"rafthttp",
".",
"Transporter",
",",
"since",
"time",
".",
"Time",
",",
"self",
"<mask>",
".",
"ID",
",",
"members",
"[",
"]",
"*",
"membership",
".",
"Member",
")",
"bool",
"{",
"return",
"numConnectedSince",
"(",
"transport",
",",
"since",
",",
"self",
",",
"members",
")",
">=",
"(",
"len",
"(",
"members",
")",
"/",
"2",
")",
"+",
"1",
"\n",
"}"
] |
13,522 | all-13523 | [
"HasExistingState",
"returns",
"true",
"if",
"the",
"server",
"has",
"any",
"existing",
"state",
"(",
"logs",
"knowledge",
"of",
"a",
"current",
"term",
"or",
"any",
"snapshots",
")",
"."
] | [
"func",
"HasExistingState",
"(",
"logs",
"LogStore",
",",
"stable",
"StableStore",
",",
"snaps",
"SnapshotStore",
")",
"(",
"bool",
",",
"error",
")",
"{",
"// Make sure we don't have a current term.",
"currentTerm",
",",
"err",
":=",
"stable",
".",
"GetUint64",
"(",
"keyCurrentTerm",
")",
"\n",
"if",
"err",
"==",
"nil",
"{",
"if",
"currentTerm",
">",
"0",
"{",
"return",
"true",
",",
"nil",
"\n",
"}",
"\n",
"}",
"else",
"{",
"if",
"err",
".",
"Error",
"(",
")",
"!=",
"\"",
"\"",
"{",
"return",
"false",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"}",
"\n",
"}",
"\n\n",
"// Make sure we have an empty log.",
"lastIndex",
",",
"err",
":=",
"logs",
".",
"LastIndex",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"false",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"}",
"\n",
"if",
"lastIndex",
">",
"0",
"{",
"return",
"<mask>",
",",
"nil",
"\n",
"}",
"\n\n",
"// Make sure we have no snapshots",
"snapshots",
",",
"err",
":=",
"snaps",
".",
"List",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"false",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"}",
"\n",
"if",
"len",
"(",
"snapshots",
")",
">",
"0",
"{",
"return",
"true",
",",
"nil",
"\n",
"}",
"\n\n",
"return",
"false",
",",
"nil",
"\n",
"}"
] |
13,523 | all-13524 | [
"NewIssue",
"returns",
"a",
"new",
"issue",
".",
"Returns",
"an",
"error",
"if",
"formatTmpl",
"is",
"not",
"a",
"valid",
"template",
"for",
"an",
"Issue",
"."
] | [
"func",
"NewIssue",
"(",
"linter",
"string",
",",
"formatTmpl",
"*",
"template",
".",
"Template",
")",
"(",
"*",
"Issue",
",",
"error",
")",
"{",
"issue",
":=",
"&",
"Issue",
"{",
"Line",
":",
"1",
",",
"Severity",
":",
"Warning",
",",
"Linter",
":",
"linter",
",",
"formatTmpl",
":",
"formatTmpl",
",",
"}",
"\n",
"err",
":=",
"formatTmpl",
".",
"Execute",
"(",
"ioutil",
".",
"Discard",
",",
"<mask>",
")",
"\n",
"return",
"issue",
",",
"err",
"\n",
"}"
] |
13,524 | all-13525 | [
"MarshalJSON",
"supports",
"json",
".",
"Marshaler",
"interface"
] | [
"func",
"(",
"v",
"GetBrowserCommandLineParams",
")",
"MarshalJSON",
"(",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"w",
":=",
"jwriter",
".",
"Writer",
"{",
"}",
"\n",
"easyjsonC5a4559bEncodeGithubComChromedpCdprotoBrowser16",
"(",
"&",
"w",
",",
"v",
")",
"\n",
"return",
"w",
".",
"<mask>",
".",
"BuildBytes",
"(",
")",
",",
"w",
".",
"Error",
"\n",
"}"
] |
13,525 | all-13526 | [
"NewLeaseGrantCommand",
"returns",
"the",
"cobra",
"command",
"for",
"lease",
"grant",
"."
] | [
"func",
"NewLeaseGrantCommand",
"(",
")",
"*",
"cobra",
".",
"Command",
"{",
"lc",
":=",
"&",
"cobra",
".",
"Command",
"{",
"Use",
":",
"\"",
"\"",
",",
"Short",
":",
"\"",
"\"",
",",
"Run",
":",
"leaseGrantCommandFunc",
",",
"}",
"\n\n",
"<mask>",
"lc",
"\n",
"}"
] |
13,526 | all-13527 | [
"GetById",
"will",
"populate",
"a",
"user",
"object",
"from",
"a",
"database",
"model",
"with",
"a",
"matching",
"id",
"."
] | [
"func",
"(",
"u",
"*",
"MyUserModel",
")",
"GetById",
"(",
"id",
"<mask>",
"{",
"}",
")",
"error",
"{",
"err",
":=",
"dbmap",
".",
"SelectOne",
"(",
"u",
",",
"\"",
"\"",
",",
"id",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"return",
"nil",
"\n",
"}"
] |
13,527 | all-13528 | [
"Returns",
"a",
"signed",
"URL",
"for",
"ListDenylist",
"valid",
"for",
"the",
"specified",
"duration",
".",
"Required",
"scopes",
":",
"notify",
":",
"manage",
"-",
"denylist",
"See",
"ListDenylist",
"for",
"more",
"details",
"."
] | [
"func",
"(",
"notify",
"*",
"Notify",
")",
"ListDenylist_SignedURL",
"(",
"continuationToken",
",",
"limit",
"string",
",",
"duration",
"<mask>",
".",
"Duration",
")",
"(",
"*",
"url",
".",
"URL",
",",
"error",
")",
"{",
"v",
":=",
"url",
".",
"Values",
"{",
"}",
"\n",
"if",
"continuationToken",
"!=",
"\"",
"\"",
"{",
"v",
".",
"Add",
"(",
"\"",
"\"",
",",
"continuationToken",
")",
"\n",
"}",
"\n",
"if",
"limit",
"!=",
"\"",
"\"",
"{",
"v",
".",
"Add",
"(",
"\"",
"\"",
",",
"limit",
")",
"\n",
"}",
"\n",
"cd",
":=",
"tcclient",
".",
"Client",
"(",
"*",
"notify",
")",
"\n",
"return",
"(",
"&",
"cd",
")",
".",
"SignedURL",
"(",
"\"",
"\"",
",",
"v",
",",
"duration",
")",
"\n",
"}"
] |
13,528 | all-13529 | [
"Do",
"executes",
"Target",
".",
"getTargets",
"against",
"the",
"provided",
"context",
".",
"returns",
":",
"targetInfos",
"-",
"The",
"list",
"of",
"targets",
"."
] | [
"func",
"(",
"p",
"*",
"GetTargetsParams",
")",
"Do",
"(",
"ctx",
"context",
".",
"Context",
")",
"(",
"targetInfos",
"[",
"]",
"*",
"Info",
",",
"err",
"error",
")",
"{",
"// execute",
"var",
"res",
"GetTargetsReturns",
"\n",
"err",
"=",
"cdp",
".",
"Execute",
"(",
"ctx",
",",
"CommandGetTargets",
",",
"nil",
",",
"&",
"<mask>",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"return",
"res",
".",
"TargetInfos",
",",
"nil",
"\n",
"}"
] |
13,529 | all-13530 | [
"ImageDelete",
"deletes",
"the",
"image",
"with",
"the",
"given",
"ID",
"."
] | [
"func",
"(",
"c",
"*",
"Cluster",
")",
"ImageDelete",
"(",
"id",
"int",
")",
"error",
"{",
"err",
":=",
"exec",
"(",
"c",
".",
"<mask>",
",",
"\"",
"\"",
",",
"id",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"return",
"nil",
"\n",
"}"
] |
13,530 | all-13531 | [
"RelationshipValidator",
"makes",
"sure",
"all",
"relationships",
"of",
"a",
"model",
"are",
"correct",
"and",
"in",
"place",
".",
"It",
"does",
"so",
"by",
"combining",
"a",
"DependentResourcesValidator",
"and",
"a",
"VerifyReferencesValidator",
"based",
"on",
"the",
"specified",
"model",
"and",
"catalog",
"."
] | [
"func",
"RelationshipValidator",
"(",
"model",
"coal",
".",
"Model",
",",
"catalog",
"*",
"coal",
".",
"Catalog",
",",
"excludedFields",
"...",
"string",
")",
"*",
"Callback",
"{",
"// prepare lists",
"dependentResources",
":=",
"make",
"(",
"map",
"[",
"coal",
".",
"Model",
"]",
"string",
")",
"\n",
"references",
":=",
"make",
"(",
"map",
"[",
"string",
"]",
"coal",
".",
"Model",
")",
"\n\n",
"// iterate through all fields",
"for",
"_",
",",
"<mask>",
":=",
"range",
"coal",
".",
"Init",
"(",
"model",
")",
".",
"Meta",
"(",
")",
".",
"Relationships",
"{",
"// exclude field if requested",
"if",
"Contains",
"(",
"excludedFields",
",",
"field",
".",
"Name",
")",
"{",
"continue",
"\n",
"}",
"\n\n",
"// handle has-one and has-many relationships",
"if",
"field",
".",
"HasOne",
"||",
"field",
".",
"HasMany",
"{",
"// get related model",
"relatedModel",
":=",
"catalog",
".",
"Find",
"(",
"field",
".",
"RelType",
")",
"\n",
"if",
"relatedModel",
"==",
"nil",
"{",
"panic",
"(",
"fmt",
".",
"Sprintf",
"(",
"`fire: missing model in catalog: \"%s\"`",
",",
"field",
".",
"RelType",
")",
")",
"\n",
"}",
"\n\n",
"// get related bson field",
"bsonField",
":=",
"\"",
"\"",
"\n",
"for",
"_",
",",
"relatedField",
":=",
"range",
"relatedModel",
".",
"Meta",
"(",
")",
".",
"Relationships",
"{",
"if",
"relatedField",
".",
"RelName",
"==",
"field",
".",
"RelInverse",
"{",
"bsonField",
"=",
"relatedField",
".",
"Name",
"\n",
"}",
"\n",
"}",
"\n",
"if",
"bsonField",
"==",
"\"",
"\"",
"{",
"panic",
"(",
"fmt",
".",
"Sprintf",
"(",
"`fire: missing field for inverse relationship: \"%s\"`",
",",
"field",
".",
"RelInverse",
")",
")",
"\n",
"}",
"\n\n",
"// add relationship",
"dependentResources",
"[",
"relatedModel",
"]",
"=",
"bsonField",
"\n",
"}",
"\n\n",
"// handle to-one and to-many relationships",
"if",
"field",
".",
"ToOne",
"||",
"field",
".",
"ToMany",
"{",
"// get related model",
"relatedModel",
":=",
"catalog",
".",
"Find",
"(",
"field",
".",
"RelType",
")",
"\n",
"if",
"relatedModel",
"==",
"nil",
"{",
"panic",
"(",
"fmt",
".",
"Sprintf",
"(",
"`fire: missing model in catalog: \"%s\"`",
",",
"field",
".",
"RelType",
")",
")",
"\n",
"}",
"\n\n",
"// add relationship",
"references",
"[",
"field",
".",
"Name",
"]",
"=",
"relatedModel",
"\n",
"}",
"\n",
"}",
"\n\n",
"// create callbacks",
"cb1",
":=",
"DependentResourcesValidator",
"(",
"dependentResources",
")",
"\n",
"cb2",
":=",
"VerifyReferencesValidator",
"(",
"references",
")",
"\n\n",
"return",
"C",
"(",
"\"",
"\"",
",",
"func",
"(",
"ctx",
"*",
"Context",
")",
"bool",
"{",
"return",
"cb1",
".",
"Matcher",
"(",
"ctx",
")",
"||",
"cb2",
".",
"Matcher",
"(",
"ctx",
")",
"\n",
"}",
",",
"func",
"(",
"ctx",
"*",
"Context",
")",
"error",
"{",
"// run dependent resources validator",
"if",
"cb1",
".",
"Matcher",
"(",
"ctx",
")",
"{",
"err",
":=",
"cb1",
".",
"Handler",
"(",
"ctx",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"}",
"\n\n",
"// run dependent resources validator",
"if",
"cb2",
".",
"Matcher",
"(",
"ctx",
")",
"{",
"err",
":=",
"cb2",
".",
"Handler",
"(",
"ctx",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"}",
"\n\n",
"return",
"nil",
"\n",
"}",
")",
"\n",
"}"
] |
13,531 | all-13532 | [
"CreateRecord",
"wraps",
"the",
"Create",
"method",
"of",
"the",
"API",
"s",
"Record",
"service"
] | [
"func",
"(",
"n",
"NS1DomainService",
")",
"CreateRecord",
"(",
"r",
"*",
"dns",
".",
"Record",
")",
"(",
"*",
"http",
".",
"<mask>",
",",
"error",
")",
"{",
"return",
"n",
".",
"service",
".",
"Records",
".",
"Create",
"(",
"r",
")",
"\n",
"}"
] |
13,532 | all-13533 | [
"Close",
"closes",
"an",
"associated",
"syslog",
"Writer",
"."
] | [
"func",
"(",
"handler",
"*",
"SyslogHandler",
")",
"Close",
"(",
")",
"error",
"{",
"if",
"<mask>",
".",
"writter",
"==",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n",
"return",
"handler",
".",
"writter",
".",
"Close",
"(",
")",
"\n",
"}"
] |
13,533 | all-13534 | [
"initField",
"is",
"similar",
"to",
"reflect",
"s",
"Value",
".",
"FieldByIndex",
"in",
"that",
"it",
"returns",
"the",
"nested",
"struct",
"field",
"corresponding",
"to",
"index",
"but",
"it",
"initialises",
"any",
"nil",
"pointers",
"encountered",
"when",
"traversing",
"the",
"structure",
"."
] | [
"func",
"initField",
"(",
"val",
"reflect",
".",
"Value",
",",
"index",
"[",
"]",
"int",
")",
"reflect",
".",
"Value",
"{",
"for",
"_",
",",
"i",
":=",
"range",
"index",
"[",
":",
"len",
"(",
"index",
")",
"-",
"1",
"]",
"{",
"val",
"=",
"val",
".",
"Field",
"(",
"i",
")",
"\n",
"if",
"val",
".",
"Kind",
"(",
")",
"==",
"reflect",
".",
"Ptr",
"{",
"if",
"val",
".",
"IsNil",
"(",
")",
"{",
"val",
".",
"Set",
"(",
"reflect",
".",
"New",
"(",
"val",
".",
"Type",
"(",
")",
".",
"Elem",
"(",
")",
")",
")",
"\n",
"}",
"\n",
"val",
"=",
"val",
".",
"Elem",
"(",
")",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"val",
".",
"<mask>",
"(",
"index",
"[",
"len",
"(",
"index",
")",
"-",
"1",
"]",
")",
"\n",
"}"
] |
13,534 | all-13535 | [
"tagCategoryByName",
"converts",
"a",
"tag",
"category",
"name",
"into",
"its",
"ID",
"."
] | [
"func",
"tagCategoryByName",
"(",
"ctx",
"context",
".",
"<mask>",
",",
"client",
"*",
"tags",
".",
"RestClient",
",",
"name",
"string",
")",
"(",
"string",
",",
"error",
")",
"{",
"cats",
",",
"err",
":=",
"client",
".",
"GetCategoriesByName",
"(",
"ctx",
",",
"name",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"\"",
"\"",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"name",
",",
"err",
")",
"\n",
"}",
"\n\n",
"if",
"len",
"(",
"cats",
")",
"<",
"1",
"{",
"return",
"\"",
"\"",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"name",
")",
"\n",
"}",
"\n",
"if",
"len",
"(",
"cats",
")",
">",
"1",
"{",
"// Although GetCategoriesByName does not seem to think that tag categories",
"// are unique, empirical observation via the console and API show that they",
"// are. This error case is handled anyway.",
"return",
"\"",
"\"",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"name",
")",
"\n",
"}",
"\n\n",
"return",
"cats",
"[",
"0",
"]",
".",
"ID",
",",
"nil",
"\n",
"}"
] |
13,535 | all-13536 | [
"Do",
"executes",
"Browser",
".",
"resetPermissions",
"against",
"the",
"provided",
"context",
"."
] | [
"func",
"(",
"p",
"*",
"ResetPermissionsParams",
")",
"Do",
"(",
"ctx",
"<mask>",
".",
"Context",
")",
"(",
"err",
"error",
")",
"{",
"return",
"cdp",
".",
"Execute",
"(",
"ctx",
",",
"CommandResetPermissions",
",",
"p",
",",
"nil",
")",
"\n",
"}"
] |
13,536 | all-13537 | [
"CachePath",
"returns",
"the",
"directory",
"that",
"LXD",
"should",
"its",
"cache",
"under",
".",
"If",
"LXD_DIR",
"is",
"set",
"this",
"path",
"is",
"$LXD_DIR",
"/",
"cache",
"otherwise",
"it",
"is",
"/",
"var",
"/",
"cache",
"/",
"lxd",
"."
] | [
"func",
"CachePath",
"(",
"<mask>",
"...",
"string",
")",
"string",
"{",
"varDir",
":=",
"os",
".",
"Getenv",
"(",
"\"",
"\"",
")",
"\n",
"logDir",
":=",
"\"",
"\"",
"\n",
"if",
"varDir",
"!=",
"\"",
"\"",
"{",
"logDir",
"=",
"filepath",
".",
"Join",
"(",
"varDir",
",",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"items",
":=",
"[",
"]",
"string",
"{",
"logDir",
"}",
"\n",
"items",
"=",
"append",
"(",
"items",
",",
"path",
"...",
")",
"\n",
"return",
"filepath",
".",
"Join",
"(",
"items",
"...",
")",
"\n",
"}"
] |
13,537 | all-13538 | [
"HasType",
"returns",
"a",
"boolean",
"if",
"a",
"field",
"has",
"been",
"set",
"."
] | [
"func",
"(",
"m",
"*",
"MetricMetadata",
")",
"HasType",
"(",
")",
"bool",
"{",
"if",
"m",
"!=",
"nil",
"&&",
"m",
".",
"<mask>",
"!=",
"nil",
"{",
"return",
"true",
"\n",
"}",
"\n\n",
"return",
"false",
"\n",
"}"
] |
13,538 | all-13539 | [
"TimeElapsed",
"returns",
"approximate",
"duration",
"since",
"conversation",
"started",
".",
"Returns",
"-",
"1",
"seconds",
"if",
"time_elapsed",
"is",
"not",
"found",
"or",
"parsing",
"failed",
"."
] | [
"func",
"(",
"s",
"*",
"<mask>",
")",
"TimeElapsed",
"(",
")",
"time",
".",
"Duration",
"{",
"s",
".",
"mu",
".",
"Lock",
"(",
")",
"\n",
"defer",
"s",
".",
"mu",
".",
"Unlock",
"(",
")",
"\n",
"if",
"v",
",",
"ok",
":=",
"s",
".",
"Decoded",
"[",
"\"",
"\"",
"]",
".",
"(",
"string",
")",
";",
"ok",
"{",
"if",
"dur",
",",
"err",
":=",
"time",
".",
"ParseDuration",
"(",
"v",
"+",
"\"",
"\"",
")",
";",
"err",
"==",
"nil",
"{",
"return",
"dur",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"time",
".",
"Second",
"*",
"-",
"1",
"\n",
"}"
] |
13,539 | all-13540 | [
"Calculates",
"the",
"per",
"-",
"element",
"bit",
"-",
"wise",
"conjunction",
"of",
"an",
"array",
"and",
"a",
"scalar",
"with",
"a",
"mask",
"."
] | [
"func",
"AndScalarWithMask",
"(",
"src",
"*",
"IplImage",
",",
"value",
"Scalar",
",",
"dst",
",",
"mask",
"*",
"IplImage",
")",
"{",
"C",
".",
"cvAndS",
"(",
"unsafe",
".",
"Pointer",
"(",
"src",
")",
",",
"(",
"C",
".",
"CvScalar",
")",
"(",
"<mask>",
")",
",",
"unsafe",
".",
"Pointer",
"(",
"dst",
")",
",",
"unsafe",
".",
"Pointer",
"(",
"mask",
")",
",",
")",
"\n",
"}"
] |
13,540 | all-13541 | [
"ChangeCustomSvcVar",
"creates",
"a",
"new",
"CHANGE_CUSTOM_SVC_VAR",
"Nagios",
"command",
".",
"Changes",
"the",
"value",
"of",
"a",
"custom",
"service",
"variable",
"."
] | [
"func",
"ChangeCustomSvcVar",
"(",
"host_name",
"string",
",",
"service_description",
"string",
",",
"varname",
"string",
",",
"varvalue",
"<mask>",
",",
")",
"*",
"livestatus",
".",
"Command",
"{",
"return",
"livestatus",
".",
"NewCommand",
"(",
"\"",
"\"",
",",
"stringifyArg",
"(",
"\"",
"\"",
",",
"\"",
"\"",
",",
"host_name",
")",
",",
"stringifyArg",
"(",
"\"",
"\"",
",",
"\"",
"\"",
",",
"service_description",
")",
",",
"stringifyArg",
"(",
"\"",
"\"",
",",
"\"",
"\"",
",",
"varname",
")",
",",
"stringifyArg",
"(",
"\"",
"\"",
",",
"\"",
"\"",
",",
"varvalue",
")",
",",
")",
"\n",
"}"
] |
13,541 | all-13542 | [
"load",
"pre",
"-",
"compiled",
"shader",
"binaries"
] | [
"func",
"ShaderBinary",
"(",
"count",
"int32",
",",
"shaders",
"*",
"uint32",
",",
"binaryformat",
"uint32",
",",
"binary",
"unsafe",
".",
"Pointer",
",",
"<mask>",
"int32",
")",
"{",
"syscall",
".",
"Syscall6",
"(",
"gpShaderBinary",
",",
"5",
",",
"uintptr",
"(",
"count",
")",
",",
"uintptr",
"(",
"unsafe",
".",
"Pointer",
"(",
"shaders",
")",
")",
",",
"uintptr",
"(",
"binaryformat",
")",
",",
"uintptr",
"(",
"binary",
")",
",",
"uintptr",
"(",
"length",
")",
",",
"0",
")",
"\n",
"}"
] |
13,542 | all-13543 | [
"Members",
"returns",
"a",
"slice",
"of",
"Members",
"that",
"are",
"currently",
"in",
"the",
"Group",
"."
] | [
"func",
"(",
"g",
"*",
"<mask>",
")",
"Members",
"(",
")",
"[",
"]",
"*",
"Member",
"{",
"g",
".",
"memberLock",
".",
"Lock",
"(",
")",
"\n",
"res",
":=",
"g",
".",
"members",
"[",
":",
"]",
"\n",
"g",
".",
"memberLock",
".",
"Unlock",
"(",
")",
"\n",
"return",
"res",
"\n",
"}"
] |
13,543 | all-13544 | [
"Abandon",
"provides",
"a",
"mock",
"function",
"with",
"given",
"fields",
":",
"_a0",
"_a1"
] | [
"func",
"(",
"_m",
"*",
"Storage",
")",
"Abandon",
"(",
"_a0",
"context",
".",
"Context",
",",
"_a1",
"string",
")",
"(",
"bool",
",",
"error",
")",
"{",
"ret",
":=",
"_m",
".",
"Called",
"(",
"_a0",
",",
"_a1",
")",
"\n\n",
"var",
"r0",
"bool",
"\n",
"if",
"rf",
",",
"ok",
":=",
"ret",
".",
"Get",
"(",
"0",
")",
".",
"(",
"func",
"(",
"context",
".",
"Context",
",",
"string",
")",
"bool",
")",
";",
"ok",
"{",
"r0",
"=",
"rf",
"(",
"_a0",
",",
"_a1",
")",
"\n",
"}",
"else",
"{",
"r0",
"=",
"ret",
".",
"Get",
"(",
"0",
")",
".",
"(",
"bool",
")",
"\n",
"}",
"\n\n",
"var",
"r1",
"error",
"\n",
"if",
"rf",
",",
"ok",
":=",
"ret",
".",
"Get",
"(",
"1",
")",
".",
"(",
"func",
"(",
"context",
".",
"<mask>",
",",
"string",
")",
"error",
")",
";",
"ok",
"{",
"r1",
"=",
"rf",
"(",
"_a0",
",",
"_a1",
")",
"\n",
"}",
"else",
"{",
"r1",
"=",
"ret",
".",
"Error",
"(",
"1",
")",
"\n",
"}",
"\n\n",
"return",
"r0",
",",
"r1",
"\n",
"}"
] |
13,544 | all-13545 | [
"QueryValue",
"returns",
"the",
"value",
"in",
"the",
"GET",
"query",
"string"
] | [
"func",
"(",
"r",
"*",
"Request",
")",
"QueryValue",
"(",
"key",
"string",
")",
"string",
"{",
"return",
"r",
".",
"URL",
".",
"Query",
"(",
")",
".",
"Get",
"(",
"<mask>",
")",
"\n",
"}"
] |
13,545 | all-13546 | [
"Exec",
"implements",
"the",
"Query",
"interface",
"."
] | [
"func",
"(",
"q",
"*",
"query",
")",
"Exec",
"(",
"ctx",
"context",
".",
"Context",
")",
"*",
"Result",
"{",
"if",
"span",
":=",
"opentracing",
".",
"SpanFromContext",
"(",
"ctx",
")",
";",
"span",
"!=",
"nil",
"{",
"span",
".",
"SetTag",
"(",
"queryTag",
",",
"q",
".",
"stmt",
".",
"String",
"(",
")",
")",
"\n",
"}",
"\n\n",
"res",
",",
"warnings",
",",
"err",
":=",
"q",
".",
"ng",
".",
"exec",
"(",
"ctx",
",",
"q",
")",
"\n",
"return",
"&",
"<mask>",
"{",
"Err",
":",
"err",
",",
"Value",
":",
"res",
",",
"Warnings",
":",
"warnings",
"}",
"\n",
"}"
] |
13,546 | all-13547 | [
"Allow",
"allows",
"permission",
"mode",
"for",
"roles"
] | [
"func",
"(",
"permission",
"*",
"Permission",
")",
"Allow",
"(",
"mode",
"PermissionMode",
",",
"roles",
"...",
"string",
")",
"*",
"Permission",
"{",
"if",
"mode",
"==",
"CRUD",
"{",
"return",
"permission",
".",
"Allow",
"(",
"Create",
",",
"roles",
"...",
")",
".",
"Allow",
"(",
"Update",
",",
"roles",
"...",
")",
".",
"Allow",
"(",
"Read",
",",
"roles",
"...",
")",
".",
"Allow",
"(",
"Delete",
",",
"roles",
"...",
")",
"\n",
"}",
"\n\n",
"if",
"permission",
".",
"AllowedRoles",
"[",
"mode",
"]",
"==",
"nil",
"{",
"permission",
".",
"AllowedRoles",
"[",
"<mask>",
"]",
"=",
"[",
"]",
"string",
"{",
"}",
"\n",
"}",
"\n",
"permission",
".",
"AllowedRoles",
"[",
"mode",
"]",
"=",
"append",
"(",
"permission",
".",
"AllowedRoles",
"[",
"mode",
"]",
",",
"roles",
"...",
")",
"\n",
"return",
"permission",
"\n",
"}"
] |
13,547 | all-13548 | [
"SetDocumenters",
"is",
"a",
"wrapper",
"around",
"gtk_about_dialog_set_documenters",
"()",
"."
] | [
"func",
"(",
"v",
"*",
"AboutDialog",
")",
"SetDocumenters",
"(",
"documenters",
"[",
"]",
"string",
")",
"{",
"cdocumenters",
":=",
"C",
".",
"make_strings",
"(",
"C",
".",
"int",
"(",
"len",
"(",
"documenters",
")",
"+",
"1",
")",
")",
"\n",
"for",
"i",
",",
"doc",
":=",
"range",
"documenters",
"{",
"cstr",
":=",
"C",
".",
"CString",
"(",
"doc",
")",
"\n",
"defer",
"C",
".",
"<mask>",
"(",
"unsafe",
".",
"Pointer",
"(",
"cstr",
")",
")",
"\n",
"C",
".",
"set_string",
"(",
"cdocumenters",
",",
"C",
".",
"int",
"(",
"i",
")",
",",
"(",
"*",
"C",
".",
"gchar",
")",
"(",
"cstr",
")",
")",
"\n",
"}",
"\n\n",
"C",
".",
"set_string",
"(",
"cdocumenters",
",",
"C",
".",
"int",
"(",
"len",
"(",
"documenters",
")",
")",
",",
"nil",
")",
"\n",
"C",
".",
"gtk_about_dialog_set_documenters",
"(",
"v",
".",
"native",
"(",
")",
",",
"cdocumenters",
")",
"\n",
"C",
".",
"destroy_strings",
"(",
"cdocumenters",
")",
"\n",
"}"
] |
13,548 | all-13549 | [
"MarshalJSON",
"supports",
"json",
".",
"Marshaler",
"interface"
] | [
"func",
"(",
"v",
"SetPausedParams",
")",
"MarshalJSON",
"(",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"w",
":=",
"jwriter",
".",
"Writer",
"{",
"}",
"\n",
"easyjsonC5a4559bEncodeGithubComChromedpCdprotoAnimation2",
"(",
"&",
"w",
",",
"v",
")",
"\n",
"return",
"w",
".",
"Buffer",
".",
"BuildBytes",
"(",
")",
",",
"w",
".",
"<mask>",
"\n",
"}"
] |
13,549 | all-13550 | [
"Do",
"executes",
"Page",
".",
"handleJavaScriptDialog",
"against",
"the",
"provided",
"context",
"."
] | [
"func",
"(",
"p",
"*",
"HandleJavaScriptDialogParams",
")",
"Do",
"(",
"ctx",
"<mask>",
".",
"Context",
")",
"(",
"err",
"error",
")",
"{",
"return",
"cdp",
".",
"Execute",
"(",
"ctx",
",",
"CommandHandleJavaScriptDialog",
",",
"p",
",",
"nil",
")",
"\n",
"}"
] |
13,550 | all-13551 | [
"setNewLogs",
"is",
"used",
"to",
"setup",
"the",
"logs",
"which",
"should",
"be",
"appended",
"for",
"a",
"request",
"."
] | [
"func",
"(",
"r",
"*",
"Raft",
")",
"setNewLogs",
"(",
"req",
"*",
"AppendEntriesRequest",
",",
"nextIndex",
",",
"lastIndex",
"uint64",
")",
"error",
"{",
"// Append up to MaxAppendEntries or up to the lastIndex",
"req",
".",
"Entries",
"=",
"make",
"(",
"[",
"]",
"*",
"Log",
",",
"0",
",",
"r",
".",
"conf",
".",
"MaxAppendEntries",
")",
"\n",
"maxIndex",
":=",
"min",
"(",
"nextIndex",
"+",
"uint64",
"(",
"r",
".",
"conf",
".",
"MaxAppendEntries",
")",
"-",
"1",
",",
"lastIndex",
")",
"\n",
"for",
"i",
":=",
"nextIndex",
";",
"i",
"<=",
"maxIndex",
";",
"i",
"++",
"{",
"oldLog",
":=",
"new",
"(",
"Log",
")",
"\n",
"if",
"err",
":=",
"r",
".",
"logs",
".",
"GetLog",
"(",
"i",
",",
"oldLog",
")",
";",
"err",
"!=",
"nil",
"{",
"r",
".",
"logger",
".",
"Error",
"(",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"i",
",",
"err",
")",
")",
"\n",
"return",
"err",
"\n",
"}",
"\n",
"req",
".",
"Entries",
"=",
"<mask>",
"(",
"req",
".",
"Entries",
",",
"oldLog",
")",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
] |
13,551 | all-13552 | [
"Formatted",
"returns",
"the",
"formatted",
"log",
"record",
"string",
"."
] | [
"func",
"(",
"r",
"*",
"Record",
")",
"Formatted",
"(",
"calldepth",
"int",
")",
"string",
"{",
"if",
"r",
".",
"formatted",
"==",
"\"",
"\"",
"{",
"<mask>",
"buf",
"bytes",
".",
"Buffer",
"\n",
"r",
".",
"formatter",
".",
"Format",
"(",
"calldepth",
"+",
"1",
",",
"r",
",",
"&",
"buf",
")",
"\n",
"r",
".",
"formatted",
"=",
"buf",
".",
"String",
"(",
")",
"\n",
"}",
"\n",
"return",
"r",
".",
"formatted",
"\n",
"}"
] |
13,552 | all-13553 | [
"SetElement",
"sets",
"an",
"element",
"at",
"(",
"i",
"j",
")",
"."
] | [
"func",
"(",
"c",
"*",
"ColorM",
")",
"SetElement",
"(",
"i",
",",
"j",
"int",
",",
"element",
"float32",
")",
"*",
"ColorM",
"{",
"newC",
":=",
"&",
"ColorM",
"{",
"body",
":",
"make",
"(",
"[",
"]",
"float32",
",",
"16",
")",
",",
"translate",
":",
"make",
"(",
"[",
"]",
"float32",
",",
"4",
")",
",",
"}",
"\n",
"copy",
"(",
"newC",
".",
"body",
",",
"colorMIdentityBody",
")",
"\n",
"copy",
"(",
"newC",
".",
"translate",
",",
"colorMIdentityTranslate",
")",
"\n",
"if",
"c",
".",
"isInited",
"(",
")",
"{",
"if",
"c",
".",
"body",
"!=",
"nil",
"{",
"<mask>",
"(",
"newC",
".",
"body",
",",
"c",
".",
"body",
")",
"\n",
"}",
"\n",
"if",
"c",
".",
"translate",
"!=",
"nil",
"{",
"copy",
"(",
"newC",
".",
"translate",
",",
"c",
".",
"translate",
")",
"\n",
"}",
"\n",
"}",
"\n",
"if",
"j",
"<",
"(",
"ColorMDim",
"-",
"1",
")",
"{",
"newC",
".",
"body",
"[",
"i",
"+",
"j",
"*",
"(",
"ColorMDim",
"-",
"1",
")",
"]",
"=",
"element",
"\n",
"}",
"else",
"{",
"newC",
".",
"translate",
"[",
"i",
"]",
"=",
"element",
"\n",
"}",
"\n",
"return",
"newC",
"\n",
"}"
] |
13,553 | all-13554 | [
"keyToProto",
"converts",
"a",
"*",
"Key",
"to",
"a",
"Reference",
"proto",
"."
] | [
"func",
"keyToProto",
"(",
"defaultAppID",
"string",
",",
"k",
"*",
"Key",
")",
"*",
"pb",
".",
"Reference",
"{",
"appID",
":=",
"k",
".",
"appID",
"\n",
"if",
"appID",
"==",
"\"",
"\"",
"{",
"appID",
"=",
"defaultAppID",
"\n",
"}",
"\n",
"n",
":=",
"0",
"\n",
"for",
"i",
":=",
"k",
";",
"i",
"!=",
"nil",
";",
"i",
"=",
"i",
".",
"parent",
"{",
"n",
"++",
"\n",
"}",
"\n",
"e",
":=",
"make",
"(",
"[",
"]",
"*",
"pb",
".",
"Path_Element",
",",
"n",
")",
"\n",
"for",
"i",
":=",
"k",
";",
"i",
"!=",
"nil",
";",
"i",
"=",
"i",
".",
"parent",
"{",
"n",
"--",
"\n",
"e",
"[",
"n",
"]",
"=",
"&",
"pb",
".",
"Path_Element",
"{",
"Type",
":",
"&",
"i",
".",
"kind",
",",
"}",
"\n",
"// At most one of {Name,Id} should be set.",
"// Neither will be set for incomplete keys.",
"if",
"i",
".",
"stringID",
"!=",
"\"",
"\"",
"{",
"e",
"[",
"n",
"]",
".",
"Name",
"=",
"&",
"i",
".",
"stringID",
"\n",
"}",
"else",
"if",
"i",
".",
"intID",
"!=",
"0",
"{",
"e",
"[",
"n",
"]",
".",
"Id",
"=",
"&",
"i",
".",
"intID",
"\n",
"}",
"\n",
"}",
"\n",
"var",
"namespace",
"*",
"string",
"\n",
"if",
"k",
".",
"namespace",
"!=",
"\"",
"\"",
"{",
"namespace",
"=",
"proto",
".",
"String",
"(",
"k",
".",
"namespace",
")",
"\n",
"}",
"\n",
"return",
"&",
"pb",
".",
"Reference",
"{",
"App",
":",
"proto",
".",
"<mask>",
"(",
"appID",
")",
",",
"NameSpace",
":",
"namespace",
",",
"Path",
":",
"&",
"pb",
".",
"Path",
"{",
"Element",
":",
"e",
",",
"}",
",",
"}",
"\n",
"}"
] |
13,554 | all-13555 | [
"title",
":",
"autoscale",
"rules",
"list",
"path",
":",
"/",
"autoscale",
"/",
"rules",
"method",
":",
"GET",
"produce",
":",
"application",
"/",
"json",
"responses",
":",
"200",
":",
"Ok",
"204",
":",
"No",
"content",
"401",
":",
"Unauthorized"
] | [
"func",
"autoScaleListRules",
"(",
"w",
"http",
".",
"ResponseWriter",
",",
"r",
"*",
"http",
".",
"Request",
",",
"t",
"auth",
".",
"Token",
")",
"error",
"{",
"allowedListRule",
":=",
"permission",
".",
"Check",
"(",
"t",
",",
"permission",
".",
"PermNodeAutoscaleRead",
")",
"\n",
"if",
"!",
"allowedListRule",
"{",
"return",
"permission",
".",
"ErrUnauthorized",
"\n",
"}",
"\n",
"rules",
",",
"err",
":=",
"autoscale",
".",
"ListRules",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"if",
"len",
"(",
"rules",
")",
"==",
"0",
"{",
"w",
".",
"WriteHeader",
"(",
"http",
".",
"StatusNoContent",
")",
"\n",
"return",
"nil",
"\n",
"}",
"\n",
"return",
"json",
".",
"NewEncoder",
"(",
"w",
")",
".",
"Encode",
"(",
"&",
"<mask>",
")",
"\n",
"}"
] |
13,555 | all-13556 | [
"GetObjectReader",
"returns",
"a",
"reader",
"for",
"an",
"object",
"in",
"object",
"store",
"by",
"hash",
"."
] | [
"func",
"(",
"c",
"APIClient",
")",
"GetObjectReader",
"(",
"<mask>",
"string",
")",
"(",
"io",
".",
"ReadCloser",
",",
"error",
")",
"{",
"ctx",
",",
"cancel",
":=",
"context",
".",
"WithCancel",
"(",
"c",
".",
"Ctx",
"(",
")",
")",
"\n",
"getObjectClient",
",",
"err",
":=",
"c",
".",
"ObjectAPIClient",
".",
"GetObject",
"(",
"ctx",
",",
"&",
"pfs",
".",
"Object",
"{",
"Hash",
":",
"hash",
"}",
",",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"grpcutil",
".",
"ScrubGRPC",
"(",
"err",
")",
"\n",
"}",
"\n",
"return",
"grpcutil",
".",
"NewStreamingBytesReader",
"(",
"getObjectClient",
",",
"cancel",
")",
",",
"nil",
"\n",
"}"
] |
13,556 | all-13557 | [
"DatumID",
"computes",
"the",
"id",
"for",
"a",
"datum",
"this",
"value",
"is",
"used",
"in",
"ListDatum",
"and",
"InspectDatum",
"."
] | [
"func",
"(",
"a",
"*",
"APIServer",
")",
"DatumID",
"(",
"data",
"[",
"]",
"*",
"Input",
")",
"string",
"{",
"hash",
":=",
"sha256",
".",
"New",
"(",
")",
"\n",
"for",
"_",
",",
"d",
":=",
"range",
"data",
"{",
"hash",
".",
"Write",
"(",
"[",
"]",
"byte",
"(",
"d",
".",
"FileInfo",
".",
"File",
".",
"Path",
")",
")",
"\n",
"hash",
".",
"Write",
"(",
"d",
".",
"FileInfo",
".",
"Hash",
")",
"\n",
"}",
"\n",
"// InputFileID is a single string id for the data from this input, it's used in logs and in",
"// the statsTree",
"return",
"<mask>",
".",
"EncodeToString",
"(",
"hash",
".",
"Sum",
"(",
"nil",
")",
")",
"\n",
"}"
] |
13,557 | all-13558 | [
"GetStyleOk",
"returns",
"a",
"tuple",
"with",
"the",
"Style",
"field",
"if",
"it",
"s",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"and",
"a",
"boolean",
"to",
"check",
"if",
"the",
"value",
"has",
"been",
"set",
"."
] | [
"func",
"(",
"h",
"*",
"HeatmapRequest",
")",
"GetStyleOk",
"(",
")",
"(",
"WidgetRequestStyle",
",",
"bool",
")",
"{",
"if",
"h",
"==",
"nil",
"||",
"h",
".",
"Style",
"==",
"nil",
"{",
"return",
"WidgetRequestStyle",
"{",
"}",
",",
"<mask>",
"\n",
"}",
"\n",
"return",
"*",
"h",
".",
"Style",
",",
"true",
"\n",
"}"
] |
13,558 | all-13559 | [
"bind",
"a",
"framebuffer",
"to",
"a",
"framebuffer",
"target"
] | [
"func",
"BindFramebuffer",
"(",
"target",
"uint32",
",",
"framebuffer",
"uint32",
")",
"{",
"syscall",
".",
"Syscall",
"(",
"gpBindFramebuffer",
",",
"2",
",",
"uintptr",
"(",
"<mask>",
")",
",",
"uintptr",
"(",
"framebuffer",
")",
",",
"0",
")",
"\n",
"}"
] |
13,559 | all-13560 | [
"Asynchronous",
"."
] | [
"func",
"(",
"peer",
"*",
"localPeer",
")",
"doConnectionEstablished",
"(",
"conn",
"ourConnection",
")",
"{",
"peer",
".",
"actionChan",
"<-",
"func",
"(",
")",
"{",
"<mask>",
".",
"handleConnectionEstablished",
"(",
"conn",
")",
"\n",
"}",
"\n",
"}"
] |
13,560 | all-13561 | [
"ParseDateTime",
"parses",
"a",
"string",
"that",
"represents",
"an",
"ISO8601",
"time",
"or",
"a",
"unix",
"epoch"
] | [
"func",
"ParseDateTime",
"(",
"data",
"string",
")",
"(",
"DateTime",
",",
"error",
")",
"{",
"if",
"<mask>",
"==",
"\"",
"\"",
"{",
"return",
"NewDateTime",
"(",
")",
",",
"nil",
"\n",
"}",
"\n",
"var",
"lastError",
"error",
"\n",
"for",
"_",
",",
"layout",
":=",
"range",
"dateTimeFormats",
"{",
"dd",
",",
"err",
":=",
"time",
".",
"Parse",
"(",
"layout",
",",
"data",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"lastError",
"=",
"err",
"\n",
"continue",
"\n",
"}",
"\n",
"lastError",
"=",
"nil",
"\n",
"return",
"DateTime",
"(",
"dd",
")",
",",
"nil",
"\n",
"}",
"\n",
"return",
"DateTime",
"{",
"}",
",",
"lastError",
"\n",
"}"
] |
13,561 | all-13562 | [
"title",
":",
"list",
"permissions",
"path",
":",
"/",
"permissions",
"method",
":",
"GET",
"produce",
":",
"application",
"/",
"json",
"responses",
":",
"200",
":",
"Ok",
"401",
":",
"Unauthorized"
] | [
"func",
"listPermissions",
"(",
"w",
"http",
".",
"ResponseWriter",
",",
"r",
"*",
"http",
".",
"Request",
",",
"t",
"auth",
".",
"<mask>",
")",
"error",
"{",
"if",
"!",
"permission",
".",
"Check",
"(",
"t",
",",
"permission",
".",
"PermRoleUpdate",
")",
"{",
"return",
"permission",
".",
"ErrUnauthorized",
"\n",
"}",
"\n",
"lst",
":=",
"permission",
".",
"PermissionRegistry",
".",
"Permissions",
"(",
")",
"\n",
"sort",
".",
"Sort",
"(",
"lst",
")",
"\n",
"permList",
":=",
"make",
"(",
"[",
"]",
"permissionSchemeData",
",",
"len",
"(",
"lst",
")",
")",
"\n",
"for",
"i",
",",
"perm",
":=",
"range",
"lst",
"{",
"contexts",
":=",
"perm",
".",
"AllowedContexts",
"(",
")",
"\n",
"contextNames",
":=",
"make",
"(",
"[",
"]",
"string",
",",
"len",
"(",
"contexts",
")",
")",
"\n",
"for",
"j",
",",
"ctx",
":=",
"range",
"contexts",
"{",
"contextNames",
"[",
"j",
"]",
"=",
"string",
"(",
"ctx",
")",
"\n",
"}",
"\n",
"permList",
"[",
"i",
"]",
"=",
"permissionSchemeData",
"{",
"Name",
":",
"perm",
".",
"FullName",
"(",
")",
",",
"Contexts",
":",
"contextNames",
",",
"}",
"\n",
"}",
"\n",
"w",
".",
"Header",
"(",
")",
".",
"Set",
"(",
"\"",
"\"",
",",
"\"",
"\"",
")",
"\n",
"return",
"json",
".",
"NewEncoder",
"(",
"w",
")",
".",
"Encode",
"(",
"permList",
")",
"\n",
"}"
] |
13,562 | all-13563 | [
"BytesPerSec",
"tells",
"the",
"rate",
"per",
"second",
"at",
"which",
"bytes",
"were",
"written",
"since",
"last",
"measurement",
"."
] | [
"func",
"(",
"m",
"*",
"MeasuredWriter",
")",
"BytesPerSec",
"(",
")",
"uint64",
"{",
"return",
"uint64",
"(",
"m",
".",
"<mask>",
".",
"Rate",
"(",
"time",
".",
"Second",
")",
")",
"\n",
"}"
] |
13,563 | all-13564 | [
"returns",
"a",
"subset",
"of",
"a",
"buffer",
"object",
"s",
"data",
"store"
] | [
"func",
"GetNamedBufferSubData",
"(",
"buffer",
"uint32",
",",
"offset",
"int",
",",
"size",
"int",
",",
"data",
"unsafe",
".",
"Pointer",
")",
"{",
"syscall",
".",
"Syscall6",
"(",
"gpGetNamedBufferSubData",
",",
"4",
",",
"uintptr",
"(",
"buffer",
")",
",",
"uintptr",
"(",
"<mask>",
")",
",",
"uintptr",
"(",
"size",
")",
",",
"uintptr",
"(",
"data",
")",
",",
"0",
",",
"0",
")",
"\n",
"}"
] |
13,564 | all-13565 | [
"Error",
"is",
"equivalent",
"to",
"Log",
"followed",
"by",
"Fail",
"."
] | [
"func",
"(",
"t",
"*",
"T",
")",
"<mask>",
"(",
"args",
"...",
"interface",
"{",
"}",
")",
"{",
"fmt",
".",
"Fprintln",
"(",
"os",
".",
"Stderr",
",",
"args",
"...",
")",
"\n",
"t",
".",
"Fail",
"(",
")",
"\n",
"}"
] |
13,565 | all-13566 | [
"CreateScreenboard",
"creates",
"a",
"new",
"screenboard",
"when",
"given",
"a",
"Screenboard",
"struct",
".",
"Note",
"that",
"the",
"Id",
"Resource",
"Url",
"and",
"similar",
"elements",
"are",
"not",
"used",
"in",
"creation",
"."
] | [
"func",
"(",
"client",
"*",
"Client",
")",
"CreateScreenboard",
"(",
"board",
"*",
"Screenboard",
")",
"(",
"*",
"Screenboard",
",",
"error",
")",
"{",
"<mask>",
":=",
"&",
"Screenboard",
"{",
"}",
"\n",
"if",
"err",
":=",
"client",
".",
"doJsonRequest",
"(",
"\"",
"\"",
",",
"\"",
"\"",
",",
"board",
",",
"out",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"return",
"out",
",",
"nil",
"\n",
"}"
] |
13,566 | all-13567 | [
"Hash",
"index",
"from",
"key",
"."
] | [
"func",
"(",
"h",
"*",
"chdHasher",
")",
"HashIndexFromKey",
"(",
"b",
"[",
"]",
"<mask>",
")",
"uint64",
"{",
"return",
"(",
"hasher",
"(",
"b",
")",
"^",
"h",
".",
"r",
"[",
"0",
"]",
")",
"%",
"h",
".",
"buckets",
"\n",
"}"
] |
13,567 | all-13568 | [
"AddResult",
"adds",
"a",
"check",
"result",
".",
"This",
"will",
"not",
"terminate",
"the",
"check",
".",
"If",
"status",
"is",
"the",
"highest",
"yet",
"reported",
"this",
"will",
"update",
"the",
"check",
"s",
"final",
"return",
"status",
"."
] | [
"func",
"(",
"c",
"*",
"Check",
")",
"AddResult",
"(",
"status",
"Status",
",",
"message",
"string",
")",
"{",
"var",
"result",
"Result",
"\n",
"<mask>",
".",
"status",
"=",
"status",
"\n",
"result",
".",
"message",
"=",
"message",
"\n",
"c",
".",
"results",
"=",
"append",
"(",
"c",
".",
"results",
",",
"result",
")",
"\n\n",
"if",
"(",
"*",
"c",
".",
"statusPolicy",
")",
"[",
"result",
".",
"status",
"]",
">",
"(",
"*",
"c",
".",
"statusPolicy",
")",
"[",
"c",
".",
"status",
"]",
"{",
"c",
".",
"status",
"=",
"result",
".",
"status",
"\n",
"}",
"\n",
"}"
] |
13,568 | all-13569 | [
"MarshalJSON",
"supports",
"json",
".",
"Marshaler",
"interface"
] | [
"func",
"(",
"v",
"Scope",
")",
"MarshalJSON",
"(",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"w",
":=",
"jwriter",
".",
"Writer",
"{",
"}",
"\n",
"easyjsonC5a4559bEncodeGithubComChromedpCdprotoDebugger23",
"(",
"&",
"w",
",",
"v",
")",
"\n",
"return",
"w",
".",
"<mask>",
".",
"BuildBytes",
"(",
")",
",",
"w",
".",
"Error",
"\n",
"}"
] |
13,569 | all-13570 | [
"Order",
"returns",
"a",
"derivative",
"query",
"with",
"a",
"field",
"-",
"based",
"sort",
"order",
".",
"Orders",
"are",
"applied",
"in",
"the",
"order",
"they",
"are",
"added",
".",
"The",
"default",
"order",
"is",
"ascending",
";",
"to",
"sort",
"in",
"descending",
"order",
"prefix",
"the",
"fieldName",
"with",
"a",
"minus",
"sign",
"(",
"-",
")",
"."
] | [
"func",
"(",
"q",
"*",
"<mask>",
")",
"Order",
"(",
"fieldName",
"string",
")",
"*",
"Query",
"{",
"q",
"=",
"q",
".",
"clone",
"(",
")",
"\n",
"fieldName",
"=",
"strings",
".",
"TrimSpace",
"(",
"fieldName",
")",
"\n",
"o",
":=",
"order",
"{",
"Direction",
":",
"ascending",
",",
"FieldName",
":",
"fieldName",
",",
"}",
"\n",
"if",
"strings",
".",
"HasPrefix",
"(",
"fieldName",
",",
"\"",
"\"",
")",
"{",
"o",
".",
"Direction",
"=",
"descending",
"\n",
"o",
".",
"FieldName",
"=",
"strings",
".",
"TrimSpace",
"(",
"fieldName",
"[",
"1",
":",
"]",
")",
"\n",
"}",
"else",
"if",
"strings",
".",
"HasPrefix",
"(",
"fieldName",
",",
"\"",
"\"",
")",
"{",
"q",
".",
"err",
"=",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"fieldName",
")",
"\n",
"return",
"q",
"\n",
"}",
"\n",
"if",
"len",
"(",
"o",
".",
"FieldName",
")",
"==",
"0",
"{",
"q",
".",
"err",
"=",
"errors",
".",
"New",
"(",
"\"",
"\"",
")",
"\n",
"return",
"q",
"\n",
"}",
"\n",
"q",
".",
"order",
"=",
"append",
"(",
"q",
".",
"order",
",",
"o",
")",
"\n",
"return",
"q",
"\n",
"}"
] |
13,570 | all-13571 | [
"DialDualStackTimeout",
"dials",
"the",
"given",
"TCP",
"addr",
"using",
"both",
"tcp4",
"and",
"tcp6",
"using",
"the",
"given",
"timeout",
".",
"This",
"function",
"has",
"the",
"following",
"additional",
"features",
"comparing",
"to",
"net",
".",
"Dial",
":",
"*",
"It",
"reduces",
"load",
"on",
"DNS",
"resolver",
"by",
"caching",
"resolved",
"TCP",
"addressed",
"for",
"DefaultDNSCacheDuration",
".",
"*",
"It",
"dials",
"all",
"the",
"resolved",
"TCP",
"addresses",
"in",
"round",
"-",
"robin",
"manner",
"until",
"connection",
"is",
"established",
".",
"This",
"may",
"be",
"useful",
"if",
"certain",
"addresses",
"are",
"temporarily",
"unreachable",
".",
"This",
"dialer",
"is",
"intended",
"for",
"custom",
"code",
"wrapping",
"before",
"passing",
"to",
"Client",
".",
"Dial",
"or",
"HostClient",
".",
"Dial",
".",
"For",
"instance",
"per",
"-",
"host",
"counters",
"and",
"/",
"or",
"limits",
"may",
"be",
"implemented",
"by",
"such",
"wrappers",
".",
"The",
"addr",
"passed",
"to",
"the",
"function",
"must",
"contain",
"port",
".",
"Example",
"addr",
"values",
":",
"*",
"foobar",
".",
"baz",
":",
"443",
"*",
"foo",
".",
"bar",
":",
"80",
"*",
"aaa",
".",
"com",
":",
"8080"
] | [
"func",
"(",
"d",
"*",
"TCPDialer",
")",
"DialDualStackTimeout",
"(",
"addr",
"string",
",",
"timeout",
"time",
".",
"Duration",
")",
"(",
"<mask>",
".",
"Conn",
",",
"error",
")",
"{",
"return",
"d",
".",
"dial",
"(",
"addr",
",",
"true",
",",
"timeout",
")",
"\n",
"}"
] |
13,571 | all-13572 | [
"Reset",
"discards",
"the",
"Reader",
"s",
"state",
"and",
"makes",
"it",
"equivalent",
"to",
"the",
"result",
"of",
"its",
"original",
"state",
"from",
"NewReader",
"but",
"reading",
"from",
"r",
"instead",
".",
"This",
"permits",
"reusing",
"a",
"Reader",
"rather",
"than",
"allocating",
"a",
"new",
"one",
"."
] | [
"func",
"(",
"z",
"*",
"Reader",
")",
"Reset",
"(",
"r",
"io",
".",
"Reader",
")",
"{",
"z",
".",
"<mask>",
"=",
"Header",
"{",
"}",
"\n",
"z",
".",
"pos",
"=",
"0",
"\n",
"z",
".",
"src",
"=",
"r",
"\n",
"z",
".",
"zdata",
"=",
"z",
".",
"zdata",
"[",
":",
"0",
"]",
"\n",
"z",
".",
"data",
"=",
"z",
".",
"data",
"[",
":",
"0",
"]",
"\n",
"z",
".",
"idx",
"=",
"0",
"\n",
"z",
".",
"checksum",
".",
"Reset",
"(",
")",
"\n",
"}"
] |
13,572 | all-13573 | [
"Get",
"returns",
"the",
"value",
"for",
"the",
"label",
"with",
"the",
"given",
"name",
".",
"Returns",
"an",
"empty",
"string",
"if",
"the",
"label",
"doesn",
"t",
"exist",
"."
] | [
"func",
"(",
"ls",
"Labels",
")",
"Get",
"(",
"name",
"string",
")",
"string",
"{",
"for",
"_",
",",
"l",
":=",
"range",
"ls",
"{",
"if",
"l",
".",
"Name",
"==",
"name",
"{",
"return",
"l",
".",
"<mask>",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"\"",
"\"",
"\n",
"}"
] |
13,573 | all-13574 | [
"MarshalEasyJSON",
"satisfies",
"easyjson",
".",
"Marshaler",
"."
] | [
"func",
"(",
"t",
"SetEmitTouchEventsForMouseConfiguration",
")",
"MarshalEasyJSON",
"(",
"out",
"*",
"jwriter",
".",
"Writer",
")",
"{",
"<mask>",
".",
"String",
"(",
"string",
"(",
"t",
")",
")",
"\n",
"}"
] |
13,574 | all-13575 | [
"Set",
"adds",
"a",
"key",
"-",
"value",
"pair",
"to",
"the",
"database",
".",
"It",
"will",
"return",
"ErrReadOnlyTxn",
"if",
"update",
"flag",
"was",
"set",
"to",
"false",
"when",
"creating",
"the",
"transaction",
".",
"The",
"current",
"transaction",
"keeps",
"a",
"reference",
"to",
"the",
"key",
"and",
"val",
"byte",
"slice",
"arguments",
".",
"Users",
"must",
"not",
"modify",
"key",
"and",
"val",
"until",
"the",
"end",
"of",
"the",
"transaction",
"."
] | [
"func",
"(",
"txn",
"*",
"Txn",
")",
"<mask>",
"(",
"key",
",",
"val",
"[",
"]",
"byte",
")",
"error",
"{",
"e",
":=",
"&",
"Entry",
"{",
"Key",
":",
"key",
",",
"Value",
":",
"val",
",",
"}",
"\n",
"return",
"txn",
".",
"SetEntry",
"(",
"e",
")",
"\n",
"}"
] |
13,575 | all-13576 | [
"ThrottledReader",
"ensures",
"that",
"reads",
"to",
"r",
"never",
"exceeds",
"a",
"specified",
"rate",
"of",
"bytes",
"per",
"second",
".",
"The",
"maxBurst",
"duration",
"changes",
"how",
"often",
"the",
"verification",
"is",
"done",
".",
"The",
"smaller",
"the",
"value",
"the",
"less",
"bursty",
"but",
"also",
"the",
"more",
"overhead",
"there",
"is",
"to",
"the",
"throttling",
"."
] | [
"func",
"ThrottledReader",
"(",
"r",
"<mask>",
".",
"Reader",
",",
"bytesPerSec",
"int",
",",
"maxBurst",
"time",
".",
"Duration",
")",
"ThrottlerReader",
"{",
"return",
"&",
"throttledReader",
"{",
"wrap",
":",
"r",
",",
"limiter",
":",
"newRateLimiter",
"(",
"bytesPerSec",
",",
"maxBurst",
")",
",",
"}",
"\n",
"}"
] |
13,576 | all-13577 | [
"SetLineWidth",
"is",
"a",
"wrapper",
"around",
"cairo_set_line_width",
"()",
"."
] | [
"func",
"(",
"v",
"*",
"Context",
")",
"SetLineWidth",
"(",
"width",
"float64",
")",
"{",
"C",
".",
"cairo_set_line_width",
"(",
"v",
".",
"native",
"(",
")",
",",
"C",
".",
"double",
"(",
"<mask>",
")",
")",
"\n",
"}"
] |
13,577 | all-13578 | [
"EnsureColVisible",
"scrolls",
"the",
"table",
"horizontally",
"to",
"make",
"the",
"currently",
"selected",
"column",
"fully",
"visible"
] | [
"func",
"(",
"l",
"*",
"TableView",
")",
"EnsureColVisible",
"(",
")",
"{",
"if",
"l",
".",
"isColVisible",
"(",
"l",
".",
"selectedCol",
")",
"{",
"return",
"\n",
"}",
"\n\n",
"if",
"l",
".",
"selectedCol",
"<",
"l",
".",
"topCol",
"{",
"l",
".",
"topCol",
"=",
"l",
".",
"selectedCol",
"\n",
"return",
"\n",
"}",
"\n\n",
"width",
":=",
"l",
".",
"width",
"-",
"1",
"-",
"l",
".",
"counterWidth",
"(",
")",
"\n",
"if",
"l",
".",
"showRowNo",
"&&",
"l",
".",
"showVLines",
"{",
"width",
"--",
"\n",
"}",
"\n\n",
"toShow",
":=",
"l",
".",
"selectedCol",
"\n",
"for",
"width",
">",
"0",
"{",
"if",
"l",
".",
"columns",
"[",
"toShow",
"]",
".",
"Width",
">",
"<mask>",
"{",
"if",
"toShow",
"==",
"l",
".",
"selectedCol",
"{",
"break",
"\n",
"}",
"else",
"{",
"toShow",
"++",
"\n",
"break",
"\n",
"}",
"\n",
"}",
"else",
"if",
"l",
".",
"columns",
"[",
"toShow",
"]",
".",
"Width",
"==",
"width",
"{",
"break",
"\n",
"}",
"else",
"{",
"width",
"-=",
"l",
".",
"columns",
"[",
"toShow",
"]",
".",
"Width",
"\n",
"if",
"width",
"<",
"0",
"{",
"break",
"\n",
"}",
"\n",
"toShow",
"--",
"\n",
"if",
"toShow",
"==",
"0",
"{",
"break",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n\n",
"l",
".",
"topCol",
"=",
"toShow",
"\n",
"}"
] |
13,578 | all-13579 | [
"NewTimeoutTransport",
"returns",
"a",
"transport",
"created",
"using",
"the",
"given",
"TLS",
"info",
".",
"If",
"read",
"/",
"write",
"on",
"the",
"created",
"connection",
"blocks",
"longer",
"than",
"its",
"time",
"limit",
"it",
"will",
"return",
"timeout",
"error",
".",
"If",
"read",
"/",
"write",
"timeout",
"is",
"set",
"transport",
"will",
"not",
"be",
"able",
"to",
"reuse",
"connection",
"."
] | [
"func",
"NewTimeoutTransport",
"(",
"info",
"TLSInfo",
",",
"dialtimeoutd",
",",
"rdtimeoutd",
",",
"wtimeoutd",
"<mask>",
".",
"Duration",
")",
"(",
"*",
"http",
".",
"Transport",
",",
"error",
")",
"{",
"tr",
",",
"err",
":=",
"NewTransport",
"(",
"info",
",",
"dialtimeoutd",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"if",
"rdtimeoutd",
"!=",
"0",
"||",
"wtimeoutd",
"!=",
"0",
"{",
"// the timed out connection will timeout soon after it is idle.",
"// it should not be put back to http transport as an idle connection for future usage.",
"tr",
".",
"MaxIdleConnsPerHost",
"=",
"-",
"1",
"\n",
"}",
"else",
"{",
"// allow more idle connections between peers to avoid unnecessary port allocation.",
"tr",
".",
"MaxIdleConnsPerHost",
"=",
"1024",
"\n",
"}",
"\n\n",
"tr",
".",
"Dial",
"=",
"(",
"&",
"rwTimeoutDialer",
"{",
"Dialer",
":",
"net",
".",
"Dialer",
"{",
"Timeout",
":",
"dialtimeoutd",
",",
"KeepAlive",
":",
"30",
"*",
"time",
".",
"Second",
",",
"}",
",",
"rdtimeoutd",
":",
"rdtimeoutd",
",",
"wtimeoutd",
":",
"wtimeoutd",
",",
"}",
")",
".",
"Dial",
"\n",
"return",
"tr",
",",
"nil",
"\n",
"}"
] |
13,579 | all-13580 | [
"observe",
"sends",
"an",
"observation",
"to",
"every",
"observer",
"."
] | [
"func",
"(",
"r",
"*",
"Raft",
")",
"observe",
"(",
"o",
"interface",
"{",
"}",
")",
"{",
"// In general observers should not block. But in any case this isn't",
"// disastrous as we only hold a read lock, which merely prevents",
"// registration / deregistration of observers.",
"r",
".",
"observersLock",
".",
"RLock",
"(",
")",
"\n",
"defer",
"r",
".",
"observersLock",
".",
"RUnlock",
"(",
")",
"\n",
"for",
"_",
",",
"or",
":=",
"range",
"r",
".",
"observers",
"{",
"// It's wasteful to do this in the loop, but for the common case",
"// where there are no observers we won't create any objects.",
"ob",
":=",
"Observation",
"{",
"Raft",
":",
"r",
",",
"Data",
":",
"o",
"}",
"\n",
"if",
"or",
".",
"filter",
"!=",
"nil",
"&&",
"!",
"or",
".",
"filter",
"(",
"&",
"ob",
")",
"{",
"continue",
"\n",
"}",
"\n",
"if",
"or",
".",
"<mask>",
"==",
"nil",
"{",
"continue",
"\n",
"}",
"\n",
"if",
"or",
".",
"blocking",
"{",
"or",
".",
"channel",
"<-",
"ob",
"\n",
"atomic",
".",
"AddUint64",
"(",
"&",
"or",
".",
"numObserved",
",",
"1",
")",
"\n",
"}",
"else",
"{",
"select",
"{",
"case",
"or",
".",
"channel",
"<-",
"ob",
":",
"atomic",
".",
"AddUint64",
"(",
"&",
"or",
".",
"numObserved",
",",
"1",
")",
"\n",
"default",
":",
"atomic",
".",
"AddUint64",
"(",
"&",
"or",
".",
"numDropped",
",",
"1",
")",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n",
"}"
] |
13,580 | all-13581 | [
"UpdatedImage",
"returns",
"a",
"types",
".",
"Image",
"modified",
"according",
"to",
"options",
".",
"This",
"does",
"not",
"change",
"the",
"state",
"of",
"the",
"original",
"Image",
"object",
"."
] | [
"func",
"(",
"m",
"*",
"manifestSchema2",
")",
"UpdatedImage",
"(",
"ctx",
"context",
".",
"Context",
",",
"options",
"types",
".",
"ManifestUpdateOptions",
")",
"(",
"types",
".",
"Image",
",",
"error",
")",
"{",
"copy",
":=",
"manifestSchema2",
"{",
"// NOTE: This is not a deep copy, it still shares slices etc.",
"src",
":",
"m",
".",
"src",
",",
"configBlob",
":",
"m",
".",
"configBlob",
",",
"m",
":",
"manifest",
".",
"Schema2Clone",
"(",
"m",
".",
"m",
")",
",",
"}",
"\n",
"if",
"options",
".",
"LayerInfos",
"!=",
"nil",
"{",
"if",
"err",
":=",
"copy",
".",
"m",
".",
"UpdateLayerInfos",
"(",
"options",
".",
"LayerInfos",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"}",
"\n",
"// Ignore options.EmbeddedDockerReference: it may be set when converting from schema1 to schema2, but we really don't care.",
"switch",
"options",
".",
"ManifestMIMEType",
"{",
"case",
"\"",
"\"",
":",
"// No conversion, OK",
"case",
"manifest",
".",
"DockerV2Schema1SignedMediaType",
",",
"manifest",
".",
"DockerV2Schema1MediaType",
":",
"return",
"copy",
".",
"convertToManifestSchema1",
"(",
"ctx",
",",
"options",
".",
"InformationOnly",
".",
"Destination",
")",
"\n",
"case",
"imgspecv1",
".",
"MediaTypeImageManifest",
":",
"return",
"copy",
".",
"convertToManifestOCI1",
"(",
"ctx",
")",
"\n",
"<mask>",
":",
"return",
"nil",
",",
"errors",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"manifest",
".",
"DockerV2Schema2MediaType",
",",
"options",
".",
"ManifestMIMEType",
")",
"\n",
"}",
"\n\n",
"return",
"memoryImageFromManifest",
"(",
"&",
"copy",
")",
",",
"nil",
"\n",
"}"
] |
13,581 | all-13582 | [
"Stop",
"the",
"HTTP",
"server",
"of",
"the",
"endpoint",
"associated",
"with",
"the",
"given",
"code",
".",
"The",
"associated",
"socket",
"will",
"be",
"shutdown",
"too",
"."
] | [
"func",
"(",
"e",
"*",
"Endpoints",
")",
"closeListener",
"(",
"kind",
"kind",
")",
"error",
"{",
"listener",
":=",
"e",
".",
"listeners",
"[",
"kind",
"]",
"\n",
"if",
"listener",
"==",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n",
"delete",
"(",
"e",
".",
"listeners",
",",
"kind",
")",
"\n\n",
"logger",
".",
"Info",
"(",
"\"",
"\"",
",",
"<mask>",
".",
"Ctx",
"{",
"\"",
"\"",
":",
"listener",
".",
"Addr",
"(",
")",
"}",
")",
"\n\n",
"return",
"listener",
".",
"Close",
"(",
")",
"\n",
"}"
] |
13,582 | all-13583 | [
"PSCPopupServiceOffering",
"calls",
"popupServiceOffering",
"method",
"of",
"Privatix",
"service",
"contract",
"."
] | [
"func",
"(",
"b",
"*",
"backendInstance",
")",
"PSCPopupServiceOffering",
"(",
"opts",
"*",
"bind",
".",
"TransactOpts",
",",
"offeringHash",
"[",
"32",
"]",
"byte",
",",
"somcType",
"uint8",
",",
"somcData",
"data",
".",
"Base64String",
")",
"(",
"*",
"types",
".",
"Transaction",
",",
"error",
")",
"{",
"ctx2",
",",
"cancel",
":=",
"b",
".",
"addTimeout",
"(",
"opts",
".",
"<mask>",
")",
"\n",
"defer",
"cancel",
"(",
")",
"\n\n",
"opts",
".",
"Context",
"=",
"ctx2",
"\n\n",
"tx",
",",
"err",
":=",
"b",
".",
"psc",
".",
"PopupServiceOffering",
"(",
"opts",
",",
"offeringHash",
",",
"somcType",
",",
"string",
"(",
"somcData",
")",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"err",
"=",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"}",
"\n",
"return",
"tx",
",",
"err",
"\n",
"}"
] |
13,583 | all-13584 | [
"WaitTillProvisioned",
"helper",
"function"
] | [
"func",
"(",
"c",
"*",
"Client",
")",
"WaitTillProvisioned",
"(",
"path",
"string",
")",
"error",
"{",
"waitCount",
":=",
"300",
"\n",
"for",
"i",
":=",
"0",
";",
"i",
"<",
"waitCount",
";",
"i",
"++",
"{",
"request",
",",
"err",
":=",
"c",
".",
"GetRequestStatus",
"(",
"path",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"if",
"<mask>",
".",
"Metadata",
".",
"Status",
"==",
"\"",
"\"",
"{",
"return",
"nil",
"\n",
"}",
"\n",
"time",
".",
"Sleep",
"(",
"1",
"*",
"time",
".",
"Second",
")",
"\n",
"i",
"++",
"\n",
"}",
"\n",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
")",
"\n",
"}"
] |
13,584 | all-13585 | [
"MarshalEasyJSON",
"writes",
"the",
"URI",
"to",
"a",
"easyjson",
".",
"Writer"
] | [
"func",
"(",
"u",
"URI",
")",
"MarshalEasyJSON",
"(",
"w",
"*",
"jwriter",
".",
"Writer",
")",
"{",
"w",
".",
"<mask>",
"(",
"string",
"(",
"u",
")",
")",
"\n",
"}"
] |
13,585 | all-13586 | [
"FetchContactGroups",
"retrieves",
"all",
"contact",
"groups",
"available",
"to",
"the",
"API",
"Token",
"."
] | [
"func",
"(",
"a",
"*",
"API",
")",
"FetchContactGroups",
"(",
")",
"(",
"*",
"[",
"]",
"ContactGroup",
",",
"error",
")",
"{",
"result",
",",
"err",
":=",
"a",
".",
"Get",
"(",
"config",
".",
"ContactGroupPrefix",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"var",
"groups",
"[",
"]",
"ContactGroup",
"\n",
"if",
"err",
":=",
"json",
".",
"Unmarshal",
"(",
"result",
",",
"&",
"<mask>",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"return",
"&",
"groups",
",",
"nil",
"\n",
"}"
] |
13,586 | all-13587 | [
"MoveTo",
"moves",
"node",
"into",
"the",
"new",
"container",
"places",
"it",
"before",
"the",
"given",
"anchor",
".",
"See",
":",
"https",
":",
"//",
"chromedevtools",
".",
"github",
".",
"io",
"/",
"devtools",
"-",
"protocol",
"/",
"tot",
"/",
"DOM#method",
"-",
"moveTo",
"parameters",
":",
"nodeID",
"-",
"Id",
"of",
"the",
"node",
"to",
"move",
".",
"targetNodeID",
"-",
"Id",
"of",
"the",
"element",
"to",
"drop",
"the",
"moved",
"node",
"into",
"."
] | [
"func",
"MoveTo",
"(",
"nodeID",
"cdp",
".",
"NodeID",
",",
"targetNodeID",
"cdp",
".",
"NodeID",
")",
"*",
"MoveToParams",
"{",
"<mask>",
"&",
"MoveToParams",
"{",
"NodeID",
":",
"nodeID",
",",
"TargetNodeID",
":",
"targetNodeID",
",",
"}",
"\n",
"}"
] |
13,587 | all-13588 | [
"SetString",
"is",
"a",
"wrapper",
"around",
"g_value_set_string",
"()",
"."
] | [
"func",
"(",
"v",
"*",
"<mask>",
")",
"SetString",
"(",
"val",
"string",
")",
"{",
"cstr",
":=",
"C",
".",
"CString",
"(",
"val",
")",
"\n",
"defer",
"C",
".",
"free",
"(",
"unsafe",
".",
"Pointer",
"(",
"cstr",
")",
")",
"\n",
"C",
".",
"g_value_set_string",
"(",
"v",
".",
"native",
"(",
")",
",",
"(",
"*",
"C",
".",
"gchar",
")",
"(",
"cstr",
")",
")",
"\n",
"}"
] |
13,588 | all-13589 | [
"GetPullRequest",
"returns",
"details",
"about",
"the",
"PR",
"."
] | [
"func",
"(",
"f",
"*",
"FakeClient",
")",
"GetPullRequest",
"(",
"owner",
",",
"repo",
"string",
",",
"number",
"int",
")",
"(",
"*",
"github",
".",
"PullRequest",
",",
"error",
")",
"{",
"val",
",",
"exists",
":=",
"f",
".",
"PullRequests",
"[",
"<mask>",
"]",
"\n",
"if",
"!",
"exists",
"{",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"number",
")",
"\n",
"}",
"\n",
"return",
"val",
",",
"nil",
"\n",
"}"
] |
13,589 | all-13590 | [
"Render",
"writes",
"HTML",
"representing",
"this",
"Record",
"to",
"the",
"provided",
"output",
"."
] | [
"func",
"(",
"rec",
"*",
"Record",
")",
"Render",
"(",
"out",
"http",
".",
"ResponseWriter",
",",
"inPath",
"string",
")",
"{",
"mtime",
":=",
"\"",
"\"",
"\n",
"<mask>",
",",
"err",
":=",
"time",
".",
"Parse",
"(",
"time",
".",
"RFC3339",
",",
"rec",
".",
"MTime",
")",
"\n",
"if",
"err",
"==",
"nil",
"{",
"mtime",
"=",
"ts",
".",
"Format",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"var",
"url",
",",
"size",
"string",
"\n",
"if",
"rec",
".",
"isDir",
"{",
"url",
"=",
"gcsPath",
"+",
"inPath",
"+",
"rec",
".",
"Name",
"\n",
"size",
"=",
"\"",
"\"",
"\n",
"}",
"else",
"{",
"url",
"=",
"gcsBaseURL",
"+",
"inPath",
"+",
"rec",
".",
"Name",
"\n",
"size",
"=",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"rec",
".",
"Size",
")",
"\n",
"}",
"\n",
"htmlGridItem",
"(",
"out",
",",
"iconFile",
",",
"url",
",",
"rec",
".",
"Name",
",",
"size",
",",
"mtime",
")",
"\n",
"}"
] |
13,590 | all-13591 | [
"HasTime",
"returns",
"a",
"boolean",
"if",
"a",
"field",
"has",
"been",
"set",
"."
] | [
"func",
"(",
"e",
"*",
"EventTimelineDefinition",
")",
"HasTime",
"(",
")",
"bool",
"{",
"if",
"e",
"!=",
"nil",
"&&",
"e",
".",
"Time",
"!=",
"nil",
"{",
"return",
"<mask>",
"\n",
"}",
"\n\n",
"return",
"false",
"\n",
"}"
] |
13,591 | all-13592 | [
"NewMockECSClient",
"creates",
"a",
"new",
"mock",
"instance"
] | [
"func",
"NewMockECSClient",
"(",
"ctrl",
"*",
"gomock",
".",
"<mask>",
")",
"*",
"MockECSClient",
"{",
"mock",
":=",
"&",
"MockECSClient",
"{",
"ctrl",
":",
"ctrl",
"}",
"\n",
"mock",
".",
"recorder",
"=",
"&",
"MockECSClientMockRecorder",
"{",
"mock",
"}",
"\n",
"return",
"mock",
"\n",
"}"
] |
13,592 | all-13593 | [
"config",
".",
"signatureTopLevel",
"returns",
"an",
"URL",
"string",
"configured",
"in",
"config",
"for",
"ref",
"for",
"write",
"access",
"if",
"“write”",
".",
"(",
"the",
"top",
"level",
"of",
"the",
"storage",
"namespaced",
"by",
"repo",
".",
"FullName",
"etc",
".",
")",
"or",
"if",
"no",
"signature",
"storage",
"should",
"be",
"used",
"."
] | [
"func",
"(",
"config",
"*",
"registryConfiguration",
")",
"signatureTopLevel",
"(",
"ref",
"dockerReference",
",",
"write",
"bool",
")",
"string",
"{",
"if",
"config",
".",
"Docker",
"!=",
"nil",
"{",
"// Look for a full match.",
"identity",
":=",
"ref",
".",
"PolicyConfigurationIdentity",
"(",
")",
"\n",
"if",
"ns",
",",
"ok",
":=",
"config",
".",
"Docker",
"[",
"identity",
"]",
";",
"ok",
"{",
"logrus",
".",
"Debugf",
"(",
"` Using \"docker\" namespace %s`",
",",
"identity",
")",
"\n",
"if",
"url",
":=",
"ns",
".",
"signatureTopLevel",
"(",
"write",
")",
";",
"url",
"!=",
"\"",
"\"",
"{",
"return",
"url",
"\n",
"}",
"\n",
"}",
"\n\n",
"// Look for a match of the possible parent namespaces.",
"for",
"_",
",",
"name",
":=",
"range",
"ref",
".",
"PolicyConfigurationNamespaces",
"(",
")",
"{",
"if",
"ns",
",",
"ok",
":=",
"config",
".",
"Docker",
"[",
"name",
"]",
";",
"ok",
"{",
"logrus",
".",
"Debugf",
"(",
"` Using \"docker\" namespace %s`",
",",
"name",
")",
"\n",
"if",
"url",
":=",
"ns",
".",
"signatureTopLevel",
"(",
"write",
")",
";",
"<mask>",
"!=",
"\"",
"\"",
"{",
"return",
"url",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n",
"// Look for a default location",
"if",
"config",
".",
"DefaultDocker",
"!=",
"nil",
"{",
"logrus",
".",
"Debugf",
"(",
"` Using \"default-docker\" configuration`",
")",
"\n",
"if",
"url",
":=",
"config",
".",
"DefaultDocker",
".",
"signatureTopLevel",
"(",
"write",
")",
";",
"url",
"!=",
"\"",
"\"",
"{",
"return",
"url",
"\n",
"}",
"\n",
"}",
"\n",
"logrus",
".",
"Debugf",
"(",
"\"",
"\"",
",",
"ref",
".",
"PolicyConfigurationIdentity",
"(",
")",
")",
"\n",
"return",
"\"",
"\"",
"\n",
"}"
] |
13,593 | all-13594 | [
"InitFromHTTPRequest",
"-",
"initialize",
"a",
"lease",
"from",
"the",
"http",
"request",
"object",
"body"
] | [
"func",
"(",
"s",
"*",
"Lease",
")",
"InitFromHTTPRequest",
"(",
"req",
"*",
"http",
".",
"Request",
")",
"(",
"err",
"error",
")",
"{",
"if",
"req",
".",
"<mask>",
"!=",
"nil",
"{",
"if",
"body",
",",
"err",
":=",
"ioutil",
".",
"ReadAll",
"(",
"req",
".",
"Body",
")",
";",
"err",
"==",
"nil",
"{",
"if",
"err",
"=",
"json",
".",
"Unmarshal",
"(",
"body",
",",
"s",
")",
";",
"err",
"!=",
"nil",
"{",
"GLogger",
".",
"Println",
"(",
"err",
")",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"else",
"{",
"err",
"=",
"ErrEmptyBody",
"\n",
"}",
"\n\n",
"if",
"s",
".",
"ProcurementMeta",
"==",
"nil",
"{",
"s",
".",
"ProcurementMeta",
"=",
"make",
"(",
"map",
"[",
"string",
"]",
"interface",
"{",
"}",
")",
"\n",
"}",
"\n",
"return",
"\n",
"}"
] |
13,594 | all-13595 | [
"VerifyMimeType",
"returns",
"a",
"handler",
"that",
"verifies",
"that",
"a",
"request",
"has",
"a",
"specified",
"mime",
"type",
"set",
"in",
"Content",
"-",
"Type",
"header"
] | [
"func",
"VerifyMimeType",
"(",
"mimeType",
"string",
")",
"<mask>",
".",
"HandlerFunc",
"{",
"return",
"func",
"(",
"w",
"http",
".",
"ResponseWriter",
",",
"req",
"*",
"http",
".",
"Request",
")",
"{",
"Expect",
"(",
"strings",
".",
"Split",
"(",
"req",
".",
"Header",
".",
"Get",
"(",
"\"",
"\"",
")",
",",
"\"",
"\"",
")",
"[",
"0",
"]",
")",
".",
"Should",
"(",
"Equal",
"(",
"mimeType",
")",
")",
"\n",
"}",
"\n",
"}"
] |
13,595 | all-13596 | [
"SetAttr",
"adds",
"or",
"replaces",
"the",
"named",
"attribute",
"with",
"an",
"expression",
"produced",
"by",
"ExprFromValue",
"."
] | [
"func",
"(",
"r",
"*",
"Rule",
")",
"SetAttr",
"(",
"key",
"string",
",",
"<mask>",
"interface",
"{",
"}",
")",
"{",
"rhs",
":=",
"ExprFromValue",
"(",
"value",
")",
"\n",
"if",
"attr",
",",
"ok",
":=",
"r",
".",
"attrs",
"[",
"key",
"]",
";",
"ok",
"{",
"attr",
".",
"RHS",
"=",
"rhs",
"\n",
"}",
"else",
"{",
"r",
".",
"attrs",
"[",
"key",
"]",
"=",
"&",
"bzl",
".",
"AssignExpr",
"{",
"LHS",
":",
"&",
"bzl",
".",
"Ident",
"{",
"Name",
":",
"key",
"}",
",",
"RHS",
":",
"rhs",
",",
"Op",
":",
"\"",
"\"",
",",
"}",
"\n",
"}",
"\n",
"r",
".",
"updated",
"=",
"true",
"\n",
"}"
] |
13,596 | all-13597 | [
"AddChild",
"adds",
"a",
"child",
"part",
"to",
"either",
"FirstChild",
"or",
"the",
"end",
"of",
"the",
"children",
"NextSibling",
"chain",
".",
"The",
"child",
"may",
"have",
"siblings",
"and",
"children",
"attached",
".",
"This",
"method",
"will",
"set",
"the",
"Parent",
"field",
"on",
"child",
"and",
"all",
"its",
"siblings",
".",
"Safe",
"to",
"call",
"on",
"nil",
"."
] | [
"func",
"(",
"p",
"*",
"Part",
")",
"AddChild",
"(",
"child",
"*",
"Part",
")",
"{",
"if",
"p",
"==",
"<mask>",
"{",
"// Prevent paradox.",
"return",
"\n",
"}",
"\n",
"if",
"p",
"!=",
"nil",
"{",
"if",
"p",
".",
"FirstChild",
"==",
"nil",
"{",
"// Make it the first child.",
"p",
".",
"FirstChild",
"=",
"child",
"\n",
"}",
"else",
"{",
"// Append to sibling chain.",
"current",
":=",
"p",
".",
"FirstChild",
"\n",
"for",
"current",
".",
"NextSibling",
"!=",
"nil",
"{",
"current",
"=",
"current",
".",
"NextSibling",
"\n",
"}",
"\n",
"if",
"current",
"==",
"child",
"{",
"// Prevent infinite loop.",
"return",
"\n",
"}",
"\n",
"current",
".",
"NextSibling",
"=",
"child",
"\n",
"}",
"\n",
"}",
"\n",
"// Update all new first-level children Parent pointers.",
"for",
"c",
":=",
"child",
";",
"c",
"!=",
"nil",
";",
"c",
"=",
"c",
".",
"NextSibling",
"{",
"if",
"c",
"==",
"c",
".",
"NextSibling",
"{",
"// Prevent infinite loop.",
"return",
"\n",
"}",
"\n",
"c",
".",
"Parent",
"=",
"p",
"\n",
"}",
"\n",
"}"
] |
13,597 | all-13598 | [
"Discover",
"allows",
"to",
"update",
"list",
"of",
"known",
"Sentinel",
"addresses",
".",
"From",
"docs",
":",
"A",
"client",
"may",
"update",
"its",
"internal",
"list",
"of",
"Sentinel",
"nodes",
"following",
"this",
"procedure",
":",
"1",
")",
"Obtain",
"a",
"list",
"of",
"other",
"Sentinels",
"for",
"this",
"master",
"using",
"the",
"command",
"SENTINEL",
"sentinels",
"<master",
"-",
"name",
">",
".",
"2",
")",
"Add",
"every",
"ip",
":",
"port",
"pair",
"not",
"already",
"existing",
"in",
"our",
"list",
"at",
"the",
"end",
"of",
"the",
"list",
"."
] | [
"func",
"(",
"s",
"*",
"Sentinel",
")",
"Discover",
"(",
")",
"error",
"{",
"addrs",
",",
"err",
":=",
"s",
".",
"SentinelAddrs",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"s",
".",
"mu",
".",
"Lock",
"(",
")",
"\n",
"for",
"_",
",",
"addr",
":=",
"<mask>",
"addrs",
"{",
"if",
"!",
"stringInSlice",
"(",
"addr",
",",
"s",
".",
"Addrs",
")",
"{",
"s",
".",
"Addrs",
"=",
"append",
"(",
"s",
".",
"Addrs",
",",
"addr",
")",
"\n",
"}",
"\n",
"}",
"\n",
"s",
".",
"mu",
".",
"Unlock",
"(",
")",
"\n",
"return",
"nil",
"\n",
"}"
] |
13,598 | all-13599 | [
"Printf",
"throw",
"logstr",
"to",
"channel",
"to",
"print",
"to",
"the",
"logger",
".",
"Arguments",
"are",
"handled",
"in",
"the",
"manner",
"of",
"fmt",
".",
"Printf",
"."
] | [
"func",
"(",
"f",
"*",
"FileLogger",
")",
"Printf",
"(",
"format",
"string",
",",
"v",
"...",
"interface",
"{",
"}",
")",
"{",
"_",
",",
"<mask>",
",",
"line",
",",
"_",
":=",
"runtime",
".",
"Caller",
"(",
"1",
")",
"//calldepth=2",
"\n",
"f",
".",
"logChan",
"<-",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"shortFileName",
"(",
"file",
")",
",",
"line",
")",
"+",
"fmt",
".",
"Sprintf",
"(",
"format",
",",
"v",
"...",
")",
"\n",
"}"
] |
13,599 | all-13600 | [
"ParseFileID",
"reads",
"the",
"file",
"id",
"out",
"of",
"a",
"filename",
"."
] | [
"func",
"ParseFileID",
"(",
"name",
"string",
")",
"(",
"uint64",
",",
"bool",
")",
"{",
"name",
"=",
"path",
".",
"Base",
"(",
"<mask>",
")",
"\n",
"if",
"!",
"strings",
".",
"HasSuffix",
"(",
"name",
",",
"fileSuffix",
")",
"{",
"return",
"0",
",",
"false",
"\n",
"}",
"\n",
"//\tsuffix := name[len(fileSuffix):]",
"name",
"=",
"strings",
".",
"TrimSuffix",
"(",
"name",
",",
"fileSuffix",
")",
"\n",
"id",
",",
"err",
":=",
"strconv",
".",
"Atoi",
"(",
"name",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"0",
",",
"false",
"\n",
"}",
"\n",
"y",
".",
"AssertTrue",
"(",
"id",
">=",
"0",
")",
"\n",
"return",
"uint64",
"(",
"id",
")",
",",
"true",
"\n",
"}"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.