id
int32 0
25.3k
| idx
stringlengths 5
9
| nl_tokens
listlengths 1
418
| pl_tokens
listlengths 22
4.98k
|
---|---|---|---|
15,000 | all-15001 | [
"specify",
"a",
"two",
"-",
"dimensional",
"texture",
"subimage",
"in",
"a",
"compressed",
"format"
] | [
"func",
"CompressedTexSubImage2D",
"(",
"target",
"uint32",
",",
"level",
"int32",
",",
"xoffset",
"int32",
",",
"yoffset",
"int32",
",",
"width",
"int32",
",",
"height",
"int32",
",",
"format",
"uint32",
",",
"imageSize",
"int32",
",",
"data",
"unsafe",
".",
"Pointer",
")",
"{",
"C",
".",
"glowCompressedTexSubImage2D",
"(",
"gpCompressedTexSubImage2D",
",",
"(",
"C",
".",
"GLenum",
")",
"(",
"target",
")",
",",
"(",
"C",
".",
"GLint",
")",
"(",
"<mask>",
")",
",",
"(",
"C",
".",
"GLint",
")",
"(",
"xoffset",
")",
",",
"(",
"C",
".",
"GLint",
")",
"(",
"yoffset",
")",
",",
"(",
"C",
".",
"GLsizei",
")",
"(",
"width",
")",
",",
"(",
"C",
".",
"GLsizei",
")",
"(",
"height",
")",
",",
"(",
"C",
".",
"GLenum",
")",
"(",
"format",
")",
",",
"(",
"C",
".",
"GLsizei",
")",
"(",
"imageSize",
")",
",",
"data",
")",
"\n",
"}"
] |
15,001 | all-15002 | [
"ProtoHost",
"finds",
"the",
"specified",
"proto",
":",
"host",
"combo",
"for",
"a",
"service",
"based",
"off",
"of",
"the",
"service",
"s",
"name",
"and",
"which",
"interface",
"you",
"are",
"accessing",
".",
"Values",
"are",
"found",
"in",
"environment",
"variables",
"fitting",
"the",
"scheme",
":",
"SERVICE_",
"{",
"SERVICE",
"NAME",
"}",
"_",
"{",
"INTERFACE",
"NAME",
"}",
"_",
"{",
"PROTO",
"HOST",
"PORT",
"}",
"."
] | [
"func",
"ProtoHost",
"(",
"service",
",",
"name",
"string",
")",
"(",
"string",
",",
"error",
")",
"{",
"proto",
",",
"err",
":=",
"Proto",
"(",
"service",
",",
"<mask>",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"\"",
"\"",
",",
"err",
"\n",
"}",
"\n",
"host",
",",
"err",
":=",
"Host",
"(",
"service",
",",
"name",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"\"",
"\"",
",",
"err",
"\n",
"}",
"\n\n",
"return",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"proto",
",",
"host",
")",
",",
"nil",
"\n",
"}"
] |
15,002 | all-15003 | [
"Middleware",
"is",
"the",
"Neptulon",
"middleware",
"method",
"."
] | [
"func",
"(",
"r",
"*",
"Router",
")",
"Middleware",
"(",
"ctx",
"*",
"neptulon",
".",
"ReqCtx",
")",
"error",
"{",
"if",
"handler",
",",
"<mask>",
":=",
"r",
".",
"routes",
"[",
"ctx",
".",
"Method",
"]",
";",
"ok",
"{",
"return",
"handler",
"(",
"ctx",
")",
"\n",
"}",
"\n\n",
"return",
"ctx",
".",
"Next",
"(",
")",
"\n",
"}"
] |
15,003 | all-15004 | [
"calculate",
"runs",
"the",
"main",
"part",
"of",
"LT",
"."
] | [
"func",
"(",
"d",
"*",
"ltDom",
")",
"calculate",
"(",
")",
"{",
"// name -> bucket (a name), per Georgiadis.",
"buckets",
":=",
"make",
"(",
"[",
"]",
"vName",
",",
"d",
".",
"nVertices",
")",
"\n",
"for",
"i",
":=",
"range",
"buckets",
"{",
"buckets",
"[",
"i",
"]",
"=",
"vName",
"(",
"i",
")",
"\n",
"}",
"\n\n",
"for",
"i",
":=",
"vNumber",
"(",
"len",
"(",
"d",
".",
"vertices",
")",
")",
"-",
"1",
";",
"i",
">",
"0",
";",
"i",
"--",
"{",
"w",
":=",
"d",
".",
"vertices",
"[",
"i",
"]",
"\n\n",
"// Step 3. Implicitly define the immediate dominator of each node.",
"for",
"v",
":=",
"buckets",
"[",
"w",
"]",
";",
"v",
"!=",
"w",
";",
"v",
"=",
"buckets",
"[",
"v",
"]",
"{",
"u",
":=",
"d",
".",
"eval",
"(",
"v",
")",
"\n",
"if",
"d",
".",
"semis",
"[",
"u",
"]",
"<",
"d",
".",
"semis",
"[",
"v",
"]",
"{",
"d",
".",
"idom",
"[",
"v",
"]",
"=",
"u",
"\n",
"}",
"else",
"{",
"d",
".",
"idom",
"[",
"v",
"]",
"=",
"w",
"\n",
"}",
"\n",
"}",
"\n\n",
"// Step 2. Compute the semidominators of all nodes.",
"root",
",",
"obj",
":=",
"d",
".",
"findVertexByName",
"(",
"w",
")",
"\n",
"// This loop never visits the pseudo-root.",
"if",
"root",
"!=",
"nil",
"{",
"u",
":=",
"d",
".",
"eval",
"(",
"pseudoRoot",
")",
"\n",
"if",
"d",
".",
"semis",
"[",
"u",
"]",
"<",
"d",
".",
"semis",
"[",
"w",
"]",
"{",
"d",
".",
"semis",
"[",
"w",
"]",
"=",
"d",
".",
"semis",
"[",
"u",
"]",
"\n",
"}",
"\n",
"}",
"else",
"{",
"d",
".",
"p",
".",
"ForEachReversePtr",
"(",
"obj",
",",
"func",
"(",
"x",
"Object",
",",
"r",
"*",
"Root",
",",
"_",
",",
"_",
"int64",
")",
"bool",
"{",
"<mask>",
"v",
"int",
"\n",
"if",
"r",
"!=",
"nil",
"{",
"v",
"=",
"d",
".",
"p",
".",
"findRootIndex",
"(",
"r",
")",
"+",
"1",
"\n",
"}",
"else",
"{",
"v",
",",
"_",
"=",
"d",
".",
"p",
".",
"findObjectIndex",
"(",
"d",
".",
"p",
".",
"Addr",
"(",
"x",
")",
")",
"\n",
"v",
"+=",
"d",
".",
"nRoots",
"+",
"1",
"\n",
"}",
"\n",
"u",
":=",
"d",
".",
"eval",
"(",
"vName",
"(",
"v",
")",
")",
"\n",
"if",
"d",
".",
"semis",
"[",
"u",
"]",
"<",
"d",
".",
"semis",
"[",
"w",
"]",
"{",
"d",
".",
"semis",
"[",
"w",
"]",
"=",
"d",
".",
"semis",
"[",
"u",
"]",
"\n",
"}",
"\n",
"return",
"true",
"\n",
"}",
")",
"\n",
"}",
"\n\n",
"d",
".",
"link",
"(",
"d",
".",
"parents",
"[",
"w",
"]",
",",
"w",
")",
"\n\n",
"if",
"d",
".",
"parents",
"[",
"w",
"]",
"==",
"d",
".",
"vertices",
"[",
"d",
".",
"semis",
"[",
"w",
"]",
"]",
"{",
"d",
".",
"idom",
"[",
"w",
"]",
"=",
"d",
".",
"parents",
"[",
"w",
"]",
"\n",
"}",
"else",
"{",
"buckets",
"[",
"w",
"]",
"=",
"buckets",
"[",
"d",
".",
"vertices",
"[",
"d",
".",
"semis",
"[",
"w",
"]",
"]",
"]",
"\n",
"buckets",
"[",
"d",
".",
"vertices",
"[",
"d",
".",
"semis",
"[",
"w",
"]",
"]",
"]",
"=",
"w",
"\n",
"}",
"\n",
"}",
"\n\n",
"// The final 'Step 3' is now outside the loop.",
"for",
"v",
":=",
"buckets",
"[",
"pseudoRoot",
"]",
";",
"v",
"!=",
"pseudoRoot",
";",
"v",
"=",
"buckets",
"[",
"v",
"]",
"{",
"d",
".",
"idom",
"[",
"v",
"]",
"=",
"pseudoRoot",
"\n",
"}",
"\n\n",
"// Step 4. Explicitly define the immediate dominator of each",
"// node, in preorder.",
"for",
"_",
",",
"w",
":=",
"range",
"d",
".",
"vertices",
"[",
"1",
":",
"]",
"{",
"if",
"d",
".",
"idom",
"[",
"w",
"]",
"!=",
"d",
".",
"vertices",
"[",
"d",
".",
"semis",
"[",
"w",
"]",
"]",
"{",
"d",
".",
"idom",
"[",
"w",
"]",
"=",
"d",
".",
"idom",
"[",
"d",
".",
"idom",
"[",
"w",
"]",
"]",
"\n",
"}",
"\n",
"}",
"\n",
"}"
] |
15,004 | all-15005 | [
"MarshalJSON",
"supports",
"json",
".",
"Marshaler",
"interface"
] | [
"func",
"(",
"v",
"AppManifestError",
")",
"MarshalJSON",
"(",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"w",
":=",
"jwriter",
".",
"Writer",
"{",
"}",
"\n",
"easyjsonC5a4559bEncodeGithubComChromedpCdprotoPage82",
"(",
"&",
"w",
",",
"v",
")",
"\n",
"return",
"w",
".",
"<mask>",
".",
"BuildBytes",
"(",
")",
",",
"w",
".",
"Error",
"\n",
"}"
] |
15,005 | all-15006 | [
"NewLedgerKey",
"creates",
"a",
"new",
"LedgerKey",
"."
] | [
"func",
"NewLedgerKey",
"(",
"aType",
"LedgerEntryType",
",",
"value",
"interface",
"{",
"}",
")",
"(",
"result",
"LedgerKey",
",",
"err",
"error",
")",
"{",
"result",
".",
"Type",
"=",
"aType",
"\n",
"switch",
"LedgerEntryType",
"(",
"aType",
")",
"{",
"case",
"LedgerEntryTypeAccount",
":",
"tv",
",",
"ok",
":=",
"value",
".",
"(",
"LedgerKeyAccount",
")",
"\n",
"if",
"!",
"ok",
"{",
"err",
"=",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
")",
"\n",
"return",
"\n",
"}",
"\n",
"result",
".",
"Account",
"=",
"&",
"tv",
"\n",
"case",
"LedgerEntryTypeTrustline",
":",
"tv",
",",
"ok",
":=",
"value",
".",
"(",
"LedgerKeyTrustLine",
")",
"\n",
"if",
"!",
"ok",
"{",
"err",
"=",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
")",
"\n",
"return",
"\n",
"}",
"\n",
"result",
".",
"TrustLine",
"=",
"&",
"tv",
"\n",
"case",
"LedgerEntryTypeOffer",
":",
"tv",
",",
"ok",
":=",
"value",
".",
"(",
"LedgerKeyOffer",
")",
"\n",
"if",
"!",
"<mask>",
"{",
"err",
"=",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
")",
"\n",
"return",
"\n",
"}",
"\n",
"result",
".",
"Offer",
"=",
"&",
"tv",
"\n",
"case",
"LedgerEntryTypeData",
":",
"tv",
",",
"ok",
":=",
"value",
".",
"(",
"LedgerKeyData",
")",
"\n",
"if",
"!",
"ok",
"{",
"err",
"=",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
")",
"\n",
"return",
"\n",
"}",
"\n",
"result",
".",
"Data",
"=",
"&",
"tv",
"\n",
"}",
"\n",
"return",
"\n",
"}"
] |
15,006 | all-15007 | [
"PoolsConstraints",
"return",
"the",
"pool",
"constraints",
"collection",
"."
] | [
"func",
"(",
"s",
"*",
"Storage",
")",
"PoolsConstraints",
"(",
")",
"*",
"storage",
".",
"<mask>",
"{",
"poolConstraintIndex",
":=",
"mgo",
".",
"Index",
"{",
"Key",
":",
"[",
"]",
"string",
"{",
"\"",
"\"",
",",
"\"",
"\"",
"}",
",",
"Unique",
":",
"true",
"}",
"\n",
"c",
":=",
"s",
".",
"Collection",
"(",
"\"",
"\"",
")",
"\n",
"c",
".",
"EnsureIndex",
"(",
"poolConstraintIndex",
")",
"\n",
"return",
"c",
"\n",
"}"
] |
15,007 | all-15008 | [
"MarshalJSON",
"returns",
"a",
"{",
"id",
":",
"NNN",
"msgType",
":",
"MMM",
"size",
":",
"SSS",
"}",
"representation"
] | [
"func",
"(",
"fh",
"FrameHeader",
")",
"MarshalJSON",
"(",
")",
"(",
"[",
"]",
"<mask>",
",",
"error",
")",
"{",
"s",
":=",
"struct",
"{",
"ID",
"uint32",
"`json:\"id\"`",
"\n",
"MsgType",
"messageType",
"`json:\"msgType\"`",
"\n",
"Size",
"uint16",
"`json:\"size\"`",
"\n",
"}",
"{",
"fh",
".",
"ID",
",",
"fh",
".",
"messageType",
",",
"fh",
".",
"size",
"}",
"\n",
"return",
"json",
".",
"Marshal",
"(",
"s",
")",
"\n",
"}"
] |
15,008 | all-15009 | [
"GetCommentOk",
"returns",
"a",
"tuple",
"with",
"the",
"Comment",
"field",
"if",
"it",
"s",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"and",
"a",
"boolean",
"to",
"check",
"if",
"the",
"value",
"has",
"been",
"set",
"."
] | [
"func",
"(",
"r",
"*",
"reqComment",
")",
"GetCommentOk",
"(",
")",
"(",
"Comment",
",",
"bool",
")",
"{",
"if",
"r",
"==",
"nil",
"||",
"r",
".",
"<mask>",
"==",
"nil",
"{",
"return",
"Comment",
"{",
"}",
",",
"false",
"\n",
"}",
"\n",
"return",
"*",
"r",
".",
"Comment",
",",
"true",
"\n",
"}"
] |
15,009 | all-15010 | [
"Connect",
"is",
"a",
"wrapper",
"around",
"g_signal_connect_closure",
"()",
".",
"f",
"must",
"be",
"a",
"function",
"with",
"a",
"signaure",
"matching",
"the",
"callback",
"signature",
"for",
"detailedSignal",
".",
"userData",
"must",
"either",
"0",
"or",
"1",
"elements",
"which",
"can",
"be",
"optionally",
"passed",
"to",
"f",
".",
"If",
"f",
"takes",
"less",
"arguments",
"than",
"it",
"is",
"passed",
"from",
"the",
"GLib",
"runtime",
"the",
"extra",
"arguments",
"are",
"ignored",
".",
"Arguments",
"for",
"f",
"must",
"be",
"a",
"matching",
"Go",
"equivalent",
"type",
"for",
"the",
"C",
"callback",
"or",
"an",
"interface",
"type",
"which",
"the",
"value",
"may",
"be",
"packed",
"in",
".",
"If",
"the",
"type",
"is",
"not",
"suitable",
"a",
"runtime",
"panic",
"will",
"occur",
"when",
"the",
"signal",
"is",
"emitted",
"."
] | [
"func",
"(",
"v",
"*",
"Object",
")",
"Connect",
"(",
"detailedSignal",
"string",
",",
"f",
"<mask>",
"{",
"}",
",",
"userData",
"...",
"interface",
"{",
"}",
")",
"(",
"SignalHandle",
",",
"error",
")",
"{",
"return",
"v",
".",
"connectClosure",
"(",
"false",
",",
"detailedSignal",
",",
"f",
",",
"userData",
"...",
")",
"\n",
"}"
] |
15,010 | all-15011 | [
"HasVisibleFocus",
"is",
"a",
"wrapper",
"around",
"gtk_widget_has_visible_focus",
"()",
"."
] | [
"func",
"(",
"v",
"*",
"Widget",
")",
"HasVisibleFocus",
"(",
")",
"bool",
"{",
"c",
":=",
"C",
".",
"gtk_widget_has_visible_focus",
"(",
"v",
".",
"native",
"(",
")",
")",
"\n",
"<mask>",
"gobool",
"(",
"c",
")",
"\n",
"}"
] |
15,011 | all-15012 | [
"replicate",
"is",
"a",
"long",
"running",
"routine",
"that",
"replicates",
"log",
"entries",
"to",
"a",
"single",
"follower",
"."
] | [
"func",
"(",
"r",
"*",
"Raft",
")",
"replicate",
"(",
"s",
"*",
"followerReplication",
")",
"{",
"// Start an async heartbeating routing",
"stopHeartbeat",
":=",
"make",
"(",
"chan",
"struct",
"{",
"}",
")",
"\n",
"defer",
"close",
"(",
"stopHeartbeat",
")",
"\n",
"r",
".",
"goFunc",
"(",
"func",
"(",
")",
"{",
"r",
".",
"heartbeat",
"(",
"s",
",",
"stopHeartbeat",
")",
"}",
")",
"\n\n",
"RPC",
":",
"shouldStop",
":=",
"false",
"\n",
"for",
"!",
"shouldStop",
"{",
"<mask>",
"{",
"case",
"maxIndex",
":=",
"<-",
"s",
".",
"stopCh",
":",
"// Make a best effort to replicate up to this index",
"if",
"maxIndex",
">",
"0",
"{",
"r",
".",
"replicateTo",
"(",
"s",
",",
"maxIndex",
")",
"\n",
"}",
"\n",
"return",
"\n",
"case",
"<-",
"s",
".",
"triggerCh",
":",
"lastLogIdx",
",",
"_",
":=",
"r",
".",
"getLastLog",
"(",
")",
"\n",
"shouldStop",
"=",
"r",
".",
"replicateTo",
"(",
"s",
",",
"lastLogIdx",
")",
"\n",
"// This is _not_ our heartbeat mechanism but is to ensure",
"// followers quickly learn the leader's commit index when",
"// raft commits stop flowing naturally. The actual heartbeats",
"// can't do this to keep them unblocked by disk IO on the",
"// follower. See https://github.com/hashicorp/raft/issues/282.",
"case",
"<-",
"randomTimeout",
"(",
"r",
".",
"conf",
".",
"CommitTimeout",
")",
":",
"lastLogIdx",
",",
"_",
":=",
"r",
".",
"getLastLog",
"(",
")",
"\n",
"shouldStop",
"=",
"r",
".",
"replicateTo",
"(",
"s",
",",
"lastLogIdx",
")",
"\n",
"}",
"\n\n",
"// If things looks healthy, switch to pipeline mode",
"if",
"!",
"shouldStop",
"&&",
"s",
".",
"allowPipeline",
"{",
"goto",
"PIPELINE",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"\n\n",
"PIPELINE",
":",
"// Disable until re-enabled",
"s",
".",
"allowPipeline",
"=",
"false",
"\n\n",
"// Replicates using a pipeline for high performance. This method",
"// is not able to gracefully recover from errors, and so we fall back",
"// to standard mode on failure.",
"if",
"err",
":=",
"r",
".",
"pipelineReplicate",
"(",
"s",
")",
";",
"err",
"!=",
"nil",
"{",
"if",
"err",
"!=",
"ErrPipelineReplicationNotSupported",
"{",
"r",
".",
"logger",
".",
"Error",
"(",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"s",
".",
"peer",
",",
"err",
")",
")",
"\n",
"}",
"\n",
"}",
"\n",
"goto",
"RPC",
"\n",
"}"
] |
15,012 | all-15013 | [
"Stat",
"returns",
"the",
"BlobInfo",
"for",
"a",
"provided",
"blobKey",
".",
"If",
"no",
"blob",
"was",
"found",
"for",
"that",
"key",
"Stat",
"returns",
"datastore",
".",
"ErrNoSuchEntity",
"."
] | [
"func",
"Stat",
"(",
"c",
"context",
".",
"<mask>",
",",
"blobKey",
"appengine",
".",
"BlobKey",
")",
"(",
"*",
"BlobInfo",
",",
"error",
")",
"{",
"c",
",",
"_",
"=",
"appengine",
".",
"Namespace",
"(",
"c",
",",
"\"",
"\"",
")",
"// Blobstore is always in the empty string namespace",
"\n",
"dskey",
":=",
"datastore",
".",
"NewKey",
"(",
"c",
",",
"blobInfoKind",
",",
"string",
"(",
"blobKey",
")",
",",
"0",
",",
"nil",
")",
"\n",
"bi",
":=",
"&",
"BlobInfo",
"{",
"BlobKey",
":",
"blobKey",
",",
"}",
"\n",
"if",
"err",
":=",
"datastore",
".",
"Get",
"(",
"c",
",",
"dskey",
",",
"bi",
")",
";",
"err",
"!=",
"nil",
"&&",
"!",
"isErrFieldMismatch",
"(",
"err",
")",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"return",
"bi",
",",
"nil",
"\n",
"}"
] |
15,013 | all-15014 | [
"GetTabPos",
"()",
"is",
"a",
"wrapper",
"around",
"gtk_notebook_get_tab_pos",
"()",
"."
] | [
"func",
"(",
"v",
"*",
"Notebook",
")",
"GetTabPos",
"(",
")",
"PositionType",
"{",
"c",
":=",
"C",
".",
"gtk_notebook_get_tab_pos",
"(",
"v",
".",
"native",
"(",
")",
")",
"\n",
"<mask>",
"PositionType",
"(",
"c",
")",
"\n",
"}"
] |
15,014 | all-15015 | [
"SetValid",
"changes",
"this",
"Bool",
"s",
"value",
"and",
"also",
"sets",
"it",
"to",
"be",
"non",
"-",
"null",
"."
] | [
"func",
"(",
"b",
"*",
"Bool",
")",
"SetValid",
"(",
"v",
"bool",
")",
"{",
"b",
".",
"Bool",
"=",
"v",
"\n",
"b",
".",
"Valid",
"=",
"<mask>",
"\n",
"}"
] |
15,015 | all-15016 | [
"PATCH",
"/",
"api",
"/",
"user_settings",
"Update",
"the",
"provided",
"attributes",
"of",
"UserSettings",
"."
] | [
"func",
"(",
"loc",
"*",
"UserSettingLocator",
")",
"Update",
"(",
"options",
"rsapi",
".",
"APIParams",
")",
"(",
"*",
"UserSetting",
",",
"error",
")",
"{",
"var",
"res",
"*",
"UserSetting",
"\n",
"var",
"params",
"rsapi",
".",
"APIParams",
"\n",
"params",
"=",
"rsapi",
".",
"APIParams",
"{",
"}",
"\n",
"var",
"viewOpt",
"=",
"options",
"[",
"\"",
"\"",
"]",
"\n",
"if",
"viewOpt",
"!=",
"nil",
"{",
"params",
"[",
"\"",
"\"",
"]",
"=",
"viewOpt",
"\n",
"}",
"\n",
"var",
"p",
"rsapi",
".",
"APIParams",
"\n",
"p",
"=",
"rsapi",
".",
"APIParams",
"{",
"}",
"\n",
"var",
"dateRangeOpt",
"=",
"options",
"[",
"\"",
"\"",
"]",
"\n",
"if",
"dateRangeOpt",
"!=",
"nil",
"{",
"p",
"[",
"\"",
"\"",
"]",
"=",
"dateRangeOpt",
"\n",
"}",
"\n",
"var",
"dismissedDialogsOpt",
"=",
"options",
"[",
"\"",
"\"",
"]",
"\n",
"if",
"dismissedDialogsOpt",
"!=",
"nil",
"{",
"p",
"[",
"\"",
"\"",
"]",
"=",
"dismissedDialogsOpt",
"\n",
"}",
"\n",
"var",
"excludedTagTypesOpt",
"=",
"options",
"[",
"\"",
"\"",
"]",
"\n",
"if",
"excludedTagTypesOpt",
"!=",
"nil",
"{",
"p",
"[",
"\"",
"\"",
"]",
"=",
"excludedTagTypesOpt",
"\n",
"}",
"\n",
"var",
"filtersOpt",
"=",
"options",
"[",
"\"",
"\"",
"]",
"\n",
"if",
"filtersOpt",
"!=",
"nil",
"{",
"p",
"[",
"\"",
"\"",
"]",
"=",
"filtersOpt",
"\n",
"}",
"\n",
"var",
"granularityOpt",
"=",
"options",
"[",
"\"",
"\"",
"]",
"\n",
"if",
"granularityOpt",
"!=",
"nil",
"{",
"p",
"[",
"\"",
"\"",
"]",
"=",
"granularityOpt",
"\n",
"}",
"\n",
"var",
"mainMenuVisibilityOpt",
"=",
"options",
"[",
"\"",
"\"",
"]",
"\n",
"if",
"mainMenuVisibilityOpt",
"!=",
"nil",
"{",
"p",
"[",
"\"",
"\"",
"]",
"=",
"mainMenuVisibilityOpt",
"\n",
"}",
"\n",
"var",
"metricsOpt",
"=",
"<mask>",
"[",
"\"",
"\"",
"]",
"\n",
"if",
"metricsOpt",
"!=",
"nil",
"{",
"p",
"[",
"\"",
"\"",
"]",
"=",
"metricsOpt",
"\n",
"}",
"\n",
"var",
"moduleStatesOpt",
"=",
"options",
"[",
"\"",
"\"",
"]",
"\n",
"if",
"moduleStatesOpt",
"!=",
"nil",
"{",
"p",
"[",
"\"",
"\"",
"]",
"=",
"moduleStatesOpt",
"\n",
"}",
"\n",
"var",
"onboardingStatusOpt",
"=",
"options",
"[",
"\"",
"\"",
"]",
"\n",
"if",
"onboardingStatusOpt",
"!=",
"nil",
"{",
"p",
"[",
"\"",
"\"",
"]",
"=",
"onboardingStatusOpt",
"\n",
"}",
"\n",
"var",
"selectedCloudVendorNamesOpt",
"=",
"options",
"[",
"\"",
"\"",
"]",
"\n",
"if",
"selectedCloudVendorNamesOpt",
"!=",
"nil",
"{",
"p",
"[",
"\"",
"\"",
"]",
"=",
"selectedCloudVendorNamesOpt",
"\n",
"}",
"\n",
"var",
"sortingOpt",
"=",
"options",
"[",
"\"",
"\"",
"]",
"\n",
"if",
"sortingOpt",
"!=",
"nil",
"{",
"p",
"[",
"\"",
"\"",
"]",
"=",
"sortingOpt",
"\n",
"}",
"\n",
"var",
"tableColumnVisibilityOpt",
"=",
"options",
"[",
"\"",
"\"",
"]",
"\n",
"if",
"tableColumnVisibilityOpt",
"!=",
"nil",
"{",
"p",
"[",
"\"",
"\"",
"]",
"=",
"tableColumnVisibilityOpt",
"\n",
"}",
"\n",
"uri",
",",
"err",
":=",
"loc",
".",
"ActionPath",
"(",
"\"",
"\"",
",",
"\"",
"\"",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"res",
",",
"err",
"\n",
"}",
"\n",
"req",
",",
"err",
":=",
"loc",
".",
"api",
".",
"BuildHTTPRequest",
"(",
"uri",
".",
"HTTPMethod",
",",
"uri",
".",
"Path",
",",
"APIVersion",
",",
"params",
",",
"p",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"res",
",",
"err",
"\n",
"}",
"\n",
"resp",
",",
"err",
":=",
"loc",
".",
"api",
".",
"PerformRequest",
"(",
"req",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"res",
",",
"err",
"\n",
"}",
"\n",
"defer",
"resp",
".",
"Body",
".",
"Close",
"(",
")",
"\n",
"if",
"resp",
".",
"StatusCode",
"<",
"200",
"||",
"resp",
".",
"StatusCode",
">",
"299",
"{",
"respBody",
",",
"_",
":=",
"ioutil",
".",
"ReadAll",
"(",
"resp",
".",
"Body",
")",
"\n",
"sr",
":=",
"string",
"(",
"respBody",
")",
"\n",
"if",
"sr",
"!=",
"\"",
"\"",
"{",
"sr",
"=",
"\"",
"\"",
"+",
"sr",
"\n",
"}",
"\n",
"return",
"res",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"resp",
".",
"Status",
",",
"sr",
")",
"\n",
"}",
"\n",
"defer",
"resp",
".",
"Body",
".",
"Close",
"(",
")",
"\n",
"respBody",
",",
"err",
":=",
"ioutil",
".",
"ReadAll",
"(",
"resp",
".",
"Body",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"res",
",",
"err",
"\n",
"}",
"\n",
"err",
"=",
"json",
".",
"Unmarshal",
"(",
"respBody",
",",
"&",
"res",
")",
"\n",
"return",
"res",
",",
"err",
"\n",
"}"
] |
15,016 | all-15017 | [
"title",
":",
"app",
"unlock",
"path",
":",
"/",
"apps",
"/",
"{",
"app",
"}",
"/",
"lock",
"method",
":",
"DELETE",
"produce",
":",
"application",
"/",
"json",
"responses",
":",
"200",
":",
"Ok",
"401",
":",
"Unauthorized",
"404",
":",
"App",
"not",
"found"
] | [
"func",
"forceDeleteLock",
"(",
"w",
"http",
".",
"ResponseWriter",
",",
"r",
"*",
"http",
".",
"Request",
",",
"t",
"auth",
".",
"Token",
")",
"(",
"err",
"error",
")",
"{",
"appName",
":=",
"r",
".",
"URL",
".",
"Query",
"(",
")",
".",
"Get",
"(",
"\"",
"\"",
")",
"\n",
"a",
",",
"err",
":=",
"getAppFromContext",
"(",
"appName",
",",
"r",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"allowed",
":=",
"permission",
".",
"Check",
"(",
"t",
",",
"permission",
".",
"PermAppAdminUnlock",
",",
"contextsForApp",
"(",
"&",
"a",
")",
"...",
",",
")",
"\n",
"if",
"!",
"allowed",
"{",
"return",
"permission",
".",
"ErrUnauthorized",
"\n",
"}",
"\n",
"evt",
",",
"err",
":=",
"event",
".",
"New",
"(",
"&",
"event",
".",
"Opts",
"{",
"Target",
":",
"appTarget",
"(",
"appName",
")",
",",
"Kind",
":",
"permission",
".",
"PermAppAdminUnlock",
",",
"Owner",
":",
"t",
",",
"CustomData",
":",
"<mask>",
".",
"FormToCustomData",
"(",
"InputFields",
"(",
"r",
")",
")",
",",
"Allowed",
":",
"event",
".",
"Allowed",
"(",
"permission",
".",
"PermAppReadEvents",
",",
"contextsForApp",
"(",
"&",
"a",
")",
"...",
")",
",",
"}",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"defer",
"func",
"(",
")",
"{",
"evt",
".",
"Done",
"(",
"err",
")",
"}",
"(",
")",
"\n",
"app",
".",
"ReleaseApplicationLock",
"(",
"a",
".",
"Name",
")",
"\n",
"return",
"nil",
"\n",
"}"
] |
15,017 | all-15018 | [
"Criticalf",
"formats",
"message",
"according",
"to",
"format",
"specifier",
"prepends",
"the",
"prefix",
"as",
"necessary",
"and",
"writes",
"to",
"log",
"with",
"LevelCritical",
".",
"This",
"is",
"part",
"of",
"the",
"Logger",
"interface",
"implementation",
"."
] | [
"func",
"(",
"l",
"*",
"slog",
")",
"Criticalf",
"(",
"<mask>",
"string",
",",
"args",
"...",
"interface",
"{",
"}",
")",
"{",
"lvl",
":=",
"l",
".",
"Level",
"(",
")",
"\n",
"if",
"lvl",
"<=",
"LevelCritical",
"{",
"l",
".",
"b",
".",
"printf",
"(",
"\"",
"\"",
",",
"l",
".",
"tag",
",",
"format",
",",
"args",
"...",
")",
"\n",
"}",
"\n",
"}"
] |
15,018 | all-15019 | [
"GetOffer",
"retrieves",
"the",
"Offer",
"value",
"from",
"the",
"union",
"returning",
"ok",
"if",
"the",
"union",
"s",
"switch",
"indicated",
"the",
"value",
"is",
"valid",
"."
] | [
"func",
"(",
"u",
"LedgerKey",
")",
"GetOffer",
"(",
")",
"(",
"result",
"LedgerKeyOffer",
",",
"ok",
"bool",
")",
"{",
"armName",
",",
"_",
":=",
"u",
".",
"ArmForSwitch",
"(",
"int32",
"(",
"u",
".",
"Type",
")",
")",
"\n\n",
"if",
"armName",
"==",
"\"",
"\"",
"{",
"<mask>",
"=",
"*",
"u",
".",
"Offer",
"\n",
"ok",
"=",
"true",
"\n",
"}",
"\n\n",
"return",
"\n",
"}"
] |
15,019 | all-15020 | [
"MarshalJSON",
"supports",
"json",
".",
"Marshaler",
"interface"
] | [
"func",
"(",
"v",
"RemoveXHRBreakpointParams",
")",
"MarshalJSON",
"(",
")",
"(",
"[",
"]",
"<mask>",
",",
"error",
")",
"{",
"w",
":=",
"jwriter",
".",
"Writer",
"{",
"}",
"\n",
"easyjsonC5a4559bEncodeGithubComChromedpCdprotoDomdebugger4",
"(",
"&",
"w",
",",
"v",
")",
"\n",
"return",
"w",
".",
"Buffer",
".",
"BuildBytes",
"(",
")",
",",
"w",
".",
"Error",
"\n",
"}"
] |
15,020 | all-15021 | [
"Uncompress",
"uncompresses",
"a",
"set",
"of",
"files",
"or",
"from",
"stdin",
"to",
"stdout",
"."
] | [
"func",
"Uncompress",
"(",
"_",
"*",
"flag",
".",
"FlagSet",
")",
"cmdflag",
".",
"Handler",
"{",
"return",
"func",
"(",
"args",
"...",
"string",
")",
"error",
"{",
"zr",
":=",
"lz4",
".",
"NewReader",
"(",
"nil",
")",
"\n\n",
"// Use stdin/stdout if no file provided.",
"if",
"len",
"(",
"args",
")",
"==",
"0",
"{",
"zr",
".",
"Reset",
"(",
"os",
".",
"Stdin",
")",
"\n",
"_",
",",
"err",
":=",
"io",
".",
"Copy",
"(",
"os",
".",
"Stdout",
",",
"zr",
")",
"\n",
"return",
"err",
"\n",
"}",
"\n\n",
"for",
"_",
",",
"zfilename",
":=",
"range",
"args",
"{",
"// Input file.",
"zfile",
",",
"err",
":=",
"os",
".",
"Open",
"(",
"zfilename",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"zinfo",
",",
"err",
":=",
"zfile",
".",
"Stat",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"mode",
":=",
"zinfo",
".",
"Mode",
"(",
")",
"// use the same mode for the output file",
"\n\n",
"// Output file.",
"filename",
":=",
"strings",
".",
"TrimSuffix",
"(",
"zfilename",
",",
"lz4",
".",
"Extension",
")",
"\n",
"file",
",",
"err",
":=",
"os",
".",
"OpenFile",
"(",
"filename",
",",
"os",
".",
"O_CREATE",
"|",
"os",
".",
"O_WRONLY",
",",
"mode",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"zr",
".",
"Reset",
"(",
"zfile",
")",
"\n\n",
"zfinfo",
",",
"err",
":=",
"zfile",
".",
"Stat",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"var",
"(",
"<mask>",
"int",
"\n",
"out",
"io",
".",
"Writer",
"=",
"file",
"\n",
"zsize",
"=",
"zfinfo",
".",
"Size",
"(",
")",
"\n",
"bar",
"*",
"progressbar",
".",
"ProgressBar",
"\n",
")",
"\n",
"if",
"zsize",
">",
"0",
"{",
"bar",
"=",
"progressbar",
".",
"NewOptions64",
"(",
"zsize",
",",
"// File transfers are usually slow, make sure we display the bar at 0%.",
"progressbar",
".",
"OptionSetRenderBlankState",
"(",
"true",
")",
",",
"// Display the filename.",
"progressbar",
".",
"OptionSetDescription",
"(",
"filename",
")",
",",
"progressbar",
".",
"OptionClearOnFinish",
"(",
")",
",",
")",
"\n",
"out",
"=",
"io",
".",
"MultiWriter",
"(",
"out",
",",
"bar",
")",
"\n",
"zr",
".",
"OnBlockDone",
"=",
"func",
"(",
"n",
"int",
")",
"{",
"size",
"+=",
"n",
"\n",
"}",
"\n",
"}",
"\n\n",
"// Uncompress.",
"_",
",",
"err",
"=",
"io",
".",
"Copy",
"(",
"out",
",",
"zr",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"for",
"_",
",",
"c",
":=",
"range",
"[",
"]",
"io",
".",
"Closer",
"{",
"zfile",
",",
"file",
"}",
"{",
"err",
":=",
"c",
".",
"Close",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"}",
"\n\n",
"if",
"bar",
"!=",
"nil",
"{",
"_",
"=",
"bar",
".",
"Clear",
"(",
")",
"\n",
"fmt",
".",
"Printf",
"(",
"\"",
"\\n",
"\"",
",",
"zfilename",
",",
"size",
")",
"\n",
"}",
"\n",
"}",
"\n\n",
"return",
"nil",
"\n",
"}",
"\n",
"}"
] |
15,021 | all-15022 | [
"GetHostOk",
"returns",
"a",
"tuple",
"with",
"the",
"Host",
"field",
"if",
"it",
"s",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"and",
"a",
"boolean",
"to",
"check",
"if",
"the",
"value",
"has",
"been",
"set",
"."
] | [
"func",
"(",
"m",
"*",
"Metric",
")",
"GetHostOk",
"(",
")",
"(",
"string",
",",
"bool",
")",
"{",
"if",
"m",
"==",
"nil",
"||",
"m",
".",
"Host",
"==",
"nil",
"{",
"return",
"\"",
"\"",
",",
"false",
"\n",
"}",
"\n",
"return",
"*",
"m",
".",
"Host",
",",
"<mask>",
"\n",
"}"
] |
15,022 | all-15023 | [
"WithNoDial",
"constructs",
"a",
"new",
"context",
"with",
"an",
"option",
"that",
"instructs",
"the",
"network",
"to",
"not",
"attempt",
"a",
"new",
"dial",
"when",
"opening",
"a",
"stream",
"."
] | [
"func",
"WithNoDial",
"(",
"ctx",
"context",
".",
"Context",
",",
"reason",
"string",
")",
"context",
".",
"Context",
"{",
"return",
"<mask>",
".",
"WithValue",
"(",
"ctx",
",",
"noDial",
",",
"reason",
")",
"\n",
"}"
] |
15,023 | all-15024 | [
"filterAndValidate",
"removes",
"failure",
"data",
"that",
"falls",
"outside",
"the",
"time",
"window",
"and",
"ensures",
"that",
"cluster",
"data",
"is",
"well",
"formed",
".",
"It",
"also",
"removes",
"data",
"for",
"PR",
"jobs",
"so",
"that",
"only",
"post",
"-",
"submit",
"failures",
"are",
"considered",
"."
] | [
"func",
"(",
"f",
"*",
"TriageFiler",
")",
"filterAndValidate",
"(",
"windowDays",
"int",
")",
"error",
"{",
"f",
".",
"latestStart",
"=",
"int64",
"(",
"0",
")",
"\n",
"for",
"_",
",",
"start",
":=",
"range",
"f",
".",
"data",
".",
"Builds",
".",
"Cols",
".",
"Started",
"{",
"if",
"start",
">",
"f",
".",
"latestStart",
"{",
"f",
".",
"latestStart",
"=",
"start",
"\n",
"}",
"\n",
"}",
"\n",
"cutoffTime",
":=",
"time",
".",
"Unix",
"(",
"f",
".",
"latestStart",
",",
"0",
")",
".",
"AddDate",
"(",
"0",
",",
"0",
",",
"-",
"windowDays",
")",
".",
"Unix",
"(",
")",
"\n\n",
"validClusts",
":=",
"[",
"]",
"*",
"Cluster",
"{",
"}",
"\n",
"for",
"clustIndex",
",",
"clust",
":=",
"range",
"f",
".",
"data",
".",
"Clustered",
"{",
"if",
"len",
"(",
"clust",
".",
"Identifier",
")",
"==",
"0",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"clustIndex",
")",
"\n",
"}",
"\n",
"if",
"clust",
".",
"Tests",
"==",
"nil",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"clust",
".",
"Identifier",
")",
"\n",
"}",
"\n",
"validTests",
":=",
"[",
"]",
"*",
"Test",
"{",
"}",
"\n",
"for",
"_",
",",
"test",
":=",
"range",
"clust",
".",
"Tests",
"{",
"if",
"len",
"(",
"test",
".",
"Name",
")",
"==",
"0",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"clust",
".",
"Identifier",
")",
"\n",
"}",
"\n",
"if",
"test",
".",
"Jobs",
"==",
"nil",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"clust",
".",
"Identifier",
")",
"\n",
"}",
"\n",
"validJobs",
":=",
"[",
"]",
"*",
"Job",
"{",
"}",
"\n",
"for",
"_",
",",
"job",
":=",
"range",
"test",
".",
"Jobs",
"{",
"if",
"len",
"(",
"job",
".",
"Name",
")",
"==",
"0",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"clust",
".",
"Identifier",
",",
"test",
".",
"Name",
")",
"\n",
"}",
"\n",
"// Filter out PR jobs",
"if",
"strings",
".",
"HasPrefix",
"(",
"job",
".",
"Name",
",",
"\"",
"\"",
")",
"{",
"continue",
"\n",
"}",
"\n",
"if",
"len",
"(",
"job",
".",
"Builds",
")",
"==",
"0",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"clust",
".",
"Identifier",
",",
"job",
".",
"Name",
",",
"test",
".",
"<mask>",
")",
"\n",
"}",
"\n",
"validBuilds",
":=",
"[",
"]",
"int",
"{",
"}",
"\n",
"rowMap",
",",
"ok",
":=",
"f",
".",
"data",
".",
"Builds",
".",
"Jobs",
"[",
"job",
".",
"Name",
"]",
"\n",
"if",
"!",
"ok",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"job",
".",
"Name",
")",
"\n",
"}",
"\n",
"for",
"_",
",",
"buildnum",
":=",
"range",
"job",
".",
"Builds",
"{",
"row",
",",
"err",
":=",
"rowMap",
".",
"rowForBuild",
"(",
"buildnum",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"if",
"f",
".",
"data",
".",
"Builds",
".",
"Cols",
".",
"Started",
"[",
"row",
"]",
">",
"cutoffTime",
"{",
"validBuilds",
"=",
"append",
"(",
"validBuilds",
",",
"buildnum",
")",
"\n",
"}",
"\n",
"}",
"\n",
"if",
"len",
"(",
"validBuilds",
")",
">",
"0",
"{",
"job",
".",
"Builds",
"=",
"validBuilds",
"\n",
"validJobs",
"=",
"append",
"(",
"validJobs",
",",
"job",
")",
"\n",
"}",
"\n",
"}",
"\n",
"if",
"len",
"(",
"validJobs",
")",
">",
"0",
"{",
"test",
".",
"Jobs",
"=",
"validJobs",
"\n",
"validTests",
"=",
"append",
"(",
"validTests",
",",
"test",
")",
"\n",
"}",
"\n",
"}",
"\n",
"if",
"len",
"(",
"validTests",
")",
">",
"0",
"{",
"clust",
".",
"Tests",
"=",
"validTests",
"\n",
"validClusts",
"=",
"append",
"(",
"validClusts",
",",
"clust",
")",
"\n",
"}",
"\n",
"}",
"\n",
"f",
".",
"data",
".",
"Clustered",
"=",
"validClusts",
"\n",
"return",
"nil",
"\n",
"}"
] |
15,024 | all-15025 | [
"GetMessage",
"returns",
"the",
"Message",
"field",
"if",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"."
] | [
"func",
"(",
"m",
"*",
"Monitor",
")",
"GetMessage",
"(",
")",
"string",
"{",
"if",
"m",
"==",
"nil",
"||",
"m",
".",
"Message",
"==",
"nil",
"{",
"return",
"\"",
"\"",
"\n",
"}",
"\n",
"return",
"*",
"m",
".",
"<mask>",
"\n",
"}"
] |
15,025 | all-15026 | [
"Create",
"a",
"user"
] | [
"func",
"NewUser",
"(",
"player",
"uuid",
".",
"UUID",
",",
"userdata",
"*",
"User",
")",
"(",
"*",
"<mask>",
",",
"error",
")",
"{",
"p",
",",
"err",
":=",
"storage",
".",
"Load",
"(",
"player",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"p",
".",
"User",
"=",
"*",
"userdata",
"\n",
"//fmt.Println(\"Creating user:\")",
"//fmt.Printf(\"%v\", p.User)",
"err",
"=",
"storage",
".",
"Store",
"(",
"p",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"errors",
".",
"New",
"(",
"err",
".",
"Error",
"(",
")",
"+",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"return",
"&",
"p",
".",
"User",
",",
"nil",
"\n",
"}"
] |
15,026 | all-15027 | [
"GetOfferingUsage",
"returns",
"total",
"units",
"used",
"for",
"all",
"channels",
"with",
"a",
"given",
"offering",
"."
] | [
"func",
"(",
"h",
"*",
"<mask>",
")",
"GetOfferingUsage",
"(",
"password",
",",
"offeringID",
"string",
")",
"(",
"*",
"uint",
",",
"error",
")",
"{",
"logger",
":=",
"h",
".",
"logger",
".",
"Add",
"(",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"offeringID",
")",
"\n\n",
"return",
"h",
".",
"uintFromQuery",
"(",
"logger",
",",
"password",
",",
"`SELECT SUM(sessions.units_used)\n\t\t FROM channels\n\t\t \tJOIN sessions\n\t\t\tON sessions.channel=channels.id\n\t\t\t AND channels.offering=$1`",
",",
"offeringID",
")",
"\n",
"}"
] |
15,027 | all-15028 | [
"GetCredentialsEventType",
"is",
"the",
"type",
"for",
"a",
"GetCredentials",
"request"
] | [
"func",
"GetCredentialsEventType",
"(",
"roleType",
"string",
")",
"string",
"{",
"switch",
"roleType",
"{",
"case",
"credentials",
".",
"ApplicationRoleType",
":",
"return",
"getCredentialsEventType",
"\n",
"case",
"credentials",
".",
"ExecutionRoleType",
":",
"return",
"getCredentialsTaskExecutionEventType",
"\n",
"<mask>",
":",
"return",
"getCredentialsInvalidRoleTypeEventType",
"\n",
"}",
"\n",
"}"
] |
15,028 | all-15029 | [
"newProxyFunc",
"builds",
"a",
"proxy",
"function",
"from",
"the",
"given",
"string",
"which",
"should",
"represent",
"a",
"URL",
"that",
"can",
"be",
"used",
"as",
"a",
"proxy",
".",
"It",
"performs",
"basic",
"sanitization",
"of",
"the",
"URL",
"and",
"returns",
"any",
"error",
"encountered",
"."
] | [
"func",
"newProxyFunc",
"(",
"lg",
"*",
"zap",
".",
"Logger",
",",
"proxy",
"string",
")",
"(",
"func",
"(",
"*",
"http",
".",
"Request",
")",
"(",
"*",
"url",
".",
"URL",
",",
"error",
")",
",",
"error",
")",
"{",
"if",
"proxy",
"==",
"\"",
"\"",
"{",
"return",
"nil",
",",
"nil",
"\n",
"}",
"\n",
"// Do a small amount of URL sanitization to help the user",
"// Derived from net/http.ProxyFromEnvironment",
"proxyURL",
",",
"err",
":=",
"url",
".",
"Parse",
"(",
"proxy",
")",
"\n",
"if",
"err",
"!=",
"nil",
"||",
"!",
"strings",
".",
"HasPrefix",
"(",
"proxyURL",
".",
"Scheme",
",",
"\"",
"\"",
")",
"{",
"// proxy was bogus. Try prepending \"http://\" to it and",
"// see if that parses correctly. If not, we ignore the",
"// error and complain about the original one",
"var",
"err2",
"error",
"\n",
"proxyURL",
",",
"err2",
"=",
"url",
".",
"Parse",
"(",
"\"",
"\"",
"+",
"<mask>",
")",
"\n",
"if",
"err2",
"==",
"nil",
"{",
"err",
"=",
"nil",
"\n",
"}",
"\n",
"}",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"proxy",
",",
"err",
")",
"\n",
"}",
"\n\n",
"if",
"lg",
"!=",
"nil",
"{",
"lg",
".",
"Info",
"(",
"\"",
"\"",
",",
"zap",
".",
"String",
"(",
"\"",
"\"",
",",
"proxyURL",
".",
"String",
"(",
")",
")",
")",
"\n",
"}",
"else",
"{",
"plog",
".",
"Infof",
"(",
"\"",
"\"",
",",
"proxyURL",
".",
"String",
"(",
")",
")",
"\n",
"}",
"\n",
"return",
"http",
".",
"ProxyURL",
"(",
"proxyURL",
")",
",",
"nil",
"\n",
"}"
] |
15,029 | all-15030 | [
"resourceVSphereComputeClusterVMDependencyRuleParseID",
"parses",
"an",
"ID",
"for",
"the",
"vsphere_compute_cluster_vm_dependency_rule",
"and",
"outputs",
"its",
"parts",
"."
] | [
"func",
"resourceVSphereComputeClusterVMDependencyRuleParseID",
"(",
"id",
"string",
")",
"(",
"string",
",",
"int32",
",",
"error",
")",
"{",
"<mask>",
":=",
"strings",
".",
"SplitN",
"(",
"id",
",",
"\"",
"\"",
",",
"3",
")",
"\n",
"if",
"len",
"(",
"parts",
")",
"<",
"2",
"{",
"return",
"\"",
"\"",
",",
"0",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"id",
")",
"\n",
"}",
"\n\n",
"key",
",",
"err",
":=",
"strconv",
".",
"Atoi",
"(",
"parts",
"[",
"1",
"]",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"\"",
"\"",
",",
"0",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"parts",
"[",
"1",
"]",
",",
"err",
")",
"\n",
"}",
"\n\n",
"return",
"parts",
"[",
"0",
"]",
",",
"int32",
"(",
"key",
")",
",",
"nil",
"\n",
"}"
] |
15,030 | all-15031 | [
"/",
"*",
"Fatalf",
"uses",
"msg",
"as",
"a",
"format",
"string",
"with",
"subsequent",
"parameters",
"as",
"values",
"and",
"logs",
"the",
"resulting",
"message",
"to",
"all",
"added",
"loggers",
"at",
"LogLevel",
".",
"LevelFatal"
] | [
"func",
"(",
"b",
"*",
"<mask>",
")",
"Fatalf",
"(",
"msg",
"string",
",",
"a",
"...",
"interface",
"{",
"}",
")",
"error",
"{",
"return",
"b",
".",
"Log",
"(",
"LevelFatal",
",",
"nil",
",",
"msg",
",",
"a",
"...",
")",
"\n",
"}"
] |
15,031 | all-15032 | [
"NewCgroupResource",
"is",
"used",
"to",
"return",
"an",
"object",
"that",
"implements",
"the",
"Resource",
"interface"
] | [
"func",
"NewCgroupResource",
"(",
"taskARN",
"string",
",",
"control",
"<mask>",
".",
"Control",
",",
"ioutil",
"ioutilwrapper",
".",
"IOUtil",
",",
"cgroupRoot",
"string",
",",
"cgroupMountPath",
"string",
",",
"resourceSpec",
"specs",
".",
"LinuxResources",
")",
"*",
"CgroupResource",
"{",
"c",
":=",
"&",
"CgroupResource",
"{",
"taskARN",
":",
"taskARN",
",",
"control",
":",
"control",
",",
"ioutil",
":",
"ioutil",
",",
"cgroupRoot",
":",
"cgroupRoot",
",",
"cgroupMountPath",
":",
"cgroupMountPath",
",",
"resourceSpec",
":",
"resourceSpec",
",",
"}",
"\n",
"c",
".",
"initializeResourceStatusToTransitionFunction",
"(",
")",
"\n",
"return",
"c",
"\n",
"}"
] |
15,032 | all-15033 | [
"callNext",
"issues",
"a",
"datastore_v3",
"/",
"Next",
"RPC",
"to",
"advance",
"a",
"cursor",
"such",
"as",
"that",
"returned",
"by",
"a",
"query",
"with",
"more",
"results",
"."
] | [
"func",
"callNext",
"(",
"c",
"context",
".",
"Context",
",",
"res",
"*",
"<mask>",
".",
"QueryResult",
",",
"offset",
",",
"count",
"int32",
")",
"error",
"{",
"if",
"res",
".",
"Cursor",
"==",
"nil",
"{",
"return",
"errors",
".",
"New",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"req",
":=",
"&",
"pb",
".",
"NextRequest",
"{",
"Cursor",
":",
"res",
".",
"Cursor",
",",
"}",
"\n",
"if",
"count",
">=",
"0",
"{",
"req",
".",
"Count",
"=",
"proto",
".",
"Int32",
"(",
"count",
")",
"\n",
"}",
"\n",
"if",
"offset",
"!=",
"0",
"{",
"req",
".",
"Offset",
"=",
"proto",
".",
"Int32",
"(",
"offset",
")",
"\n",
"}",
"\n",
"if",
"res",
".",
"CompiledCursor",
"!=",
"nil",
"{",
"req",
".",
"Compile",
"=",
"proto",
".",
"Bool",
"(",
"true",
")",
"\n",
"}",
"\n",
"res",
".",
"Reset",
"(",
")",
"\n",
"return",
"internal",
".",
"Call",
"(",
"c",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"req",
",",
"res",
")",
"\n",
"}"
] |
15,033 | all-15034 | [
"Patches",
"begin",
"here"
] | [
"func",
"patchRenameCustomVolumeLVs",
"(",
"name",
"string",
",",
"d",
"*",
"Daemon",
")",
"error",
"{",
"// Ignore the error since it will also fail if there are no pools.",
"pools",
",",
"_",
":=",
"d",
".",
"cluster",
".",
"StoragePools",
"(",
")",
"\n\n",
"for",
"_",
",",
"poolName",
":=",
"range",
"pools",
"{",
"poolID",
",",
"pool",
",",
"err",
":=",
"d",
".",
"cluster",
".",
"StoragePoolGet",
"(",
"poolName",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"sType",
",",
"err",
":=",
"storageStringToType",
"(",
"pool",
".",
"Driver",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"if",
"sType",
"!=",
"storageTypeLvm",
"{",
"continue",
"\n",
"}",
"\n\n",
"volumes",
",",
"err",
":=",
"d",
".",
"cluster",
".",
"StoragePoolNodeVolumesGetType",
"(",
"storagePoolVolumeTypeCustom",
",",
"poolID",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"vgName",
":=",
"poolName",
"\n",
"if",
"pool",
".",
"Config",
"[",
"\"",
"\"",
"]",
"!=",
"\"",
"\"",
"{",
"vgName",
"=",
"pool",
".",
"Config",
"[",
"\"",
"\"",
"]",
"\n",
"}",
"\n\n",
"for",
"_",
",",
"volume",
":=",
"<mask>",
"volumes",
"{",
"oldName",
":=",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"vgName",
",",
"volume",
")",
"\n",
"newName",
":=",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"vgName",
",",
"containerNameToLVName",
"(",
"volume",
")",
")",
"\n\n",
"exists",
",",
"err",
":=",
"storageLVExists",
"(",
"newName",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"if",
"exists",
"||",
"oldName",
"==",
"newName",
"{",
"continue",
"\n",
"}",
"\n\n",
"err",
"=",
"lvmLVRename",
"(",
"vgName",
",",
"oldName",
",",
"newName",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"logger",
".",
"Info",
"(",
"\"",
"\"",
",",
"log",
".",
"Ctx",
"{",
"\"",
"\"",
":",
"oldName",
",",
"\"",
"\"",
":",
"newName",
"}",
")",
"\n",
"}",
"\n",
"}",
"\n\n",
"return",
"nil",
"\n",
"}"
] |
15,034 | all-15035 | [
"GetMaxAge",
"parses",
"the",
"Cache",
"-",
"Control",
"header",
"and",
"returns",
"a",
"LifeChanger",
"which",
"can",
"be",
"passed",
"to",
"the",
"response",
"s",
"Reset"
] | [
"func",
"GetMaxAge",
"(",
"reqCtx",
"*",
"fasthttp",
".",
"RequestCtx",
")",
"entry",
".",
"LifeChanger",
"{",
"return",
"func",
"(",
")",
"time",
".",
"Duration",
"{",
"cacheControlHeader",
":=",
"string",
"(",
"reqCtx",
".",
"Request",
".",
"Header",
".",
"Peek",
"(",
"\"",
"\"",
")",
")",
"\n",
"// headerCacheDur returns the seconds",
"headerCacheDur",
":=",
"entry",
".",
"ParseMaxAge",
"(",
"cacheControlHeader",
")",
"\n",
"return",
"<mask>",
".",
"Duration",
"(",
"headerCacheDur",
")",
"*",
"time",
".",
"Second",
"\n",
"}",
"\n",
"}"
] |
15,035 | all-15036 | [
"BCC",
"returns",
"a",
"copy",
"of",
"MailBuilder",
"with",
"this",
"name",
"&",
"address",
"appended",
"to",
"the",
"BCC",
"list",
".",
"name",
"may",
"be",
"empty",
".",
"This",
"method",
"only",
"has",
"an",
"effect",
"if",
"the",
"Send",
"method",
"is",
"used",
"to",
"transmit",
"the",
"message",
"there",
"is",
"no",
"effect",
"on",
"the",
"parts",
"returned",
"by",
"Build",
"()",
"."
] | [
"func",
"(",
"p",
"MailBuilder",
")",
"BCC",
"(",
"name",
",",
"addr",
"string",
")",
"MailBuilder",
"{",
"p",
".",
"bcc",
"=",
"append",
"(",
"p",
".",
"bcc",
",",
"mail",
".",
"<mask>",
"{",
"Name",
":",
"name",
",",
"Address",
":",
"addr",
"}",
")",
"\n",
"return",
"p",
"\n",
"}"
] |
15,036 | all-15037 | [
"ValidatePolicyConfigurationScope",
"checks",
"that",
"scope",
"is",
"a",
"valid",
"name",
"for",
"a",
"signature",
".",
"PolicyTransportScopes",
"keys",
"(",
"i",
".",
"e",
".",
"a",
"valid",
"PolicyConfigurationIdentity",
"()",
"or",
"PolicyConfigurationNamespaces",
"()",
"return",
"value",
")",
".",
"It",
"is",
"acceptable",
"to",
"allow",
"an",
"invalid",
"value",
"which",
"will",
"never",
"be",
"matched",
"it",
"can",
"only",
"cause",
"user",
"confusion",
".",
"scope",
"passed",
"to",
"this",
"function",
"will",
"not",
"be",
"that",
"value",
"is",
"always",
"allowed",
"."
] | [
"func",
"(",
"t",
"dirTransport",
")",
"ValidatePolicyConfigurationScope",
"(",
"scope",
"string",
")",
"error",
"{",
"if",
"!",
"strings",
".",
"HasPrefix",
"(",
"scope",
",",
"\"",
"\"",
")",
"{",
"return",
"errors",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"scope",
")",
"\n",
"}",
"\n",
"// Refuse also \"/\", otherwise \"/\" and \"\" would have the same semantics,",
"// and \"\" could be unexpectedly shadowed by the \"/\" entry.",
"if",
"scope",
"==",
"\"",
"\"",
"{",
"return",
"<mask>",
".",
"New",
"(",
"`Invalid scope \"/\": Use the generic default scope \"\"`",
")",
"\n",
"}",
"\n",
"cleaned",
":=",
"filepath",
".",
"Clean",
"(",
"scope",
")",
"\n",
"if",
"cleaned",
"!=",
"scope",
"{",
"return",
"errors",
".",
"Errorf",
"(",
"`Invalid scope %s: Uses non-canonical format, perhaps try %s`",
",",
"scope",
",",
"cleaned",
")",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
] |
15,037 | all-15038 | [
"merge",
"merges",
"two",
"similar",
"Stack",
"zapping",
"out",
"differences",
"."
] | [
"func",
"(",
"s",
"*",
"Stack",
")",
"merge",
"(",
"r",
"*",
"Stack",
")",
"*",
"Stack",
"{",
"// Assumes similar stacks have the same length.",
"<mask>",
":=",
"&",
"Stack",
"{",
"Calls",
":",
"make",
"(",
"[",
"]",
"Call",
",",
"len",
"(",
"s",
".",
"Calls",
")",
")",
",",
"Elided",
":",
"s",
".",
"Elided",
",",
"}",
"\n",
"for",
"i",
":=",
"range",
"s",
".",
"Calls",
"{",
"out",
".",
"Calls",
"[",
"i",
"]",
"=",
"s",
".",
"Calls",
"[",
"i",
"]",
".",
"merge",
"(",
"&",
"r",
".",
"Calls",
"[",
"i",
"]",
")",
"\n",
"}",
"\n",
"return",
"out",
"\n",
"}"
] |
15,038 | all-15039 | [
"MarshalJSON",
"supports",
"json",
".",
"Marshaler",
"interface"
] | [
"func",
"(",
"v",
"EventStyleSheetRemoved",
")",
"MarshalJSON",
"(",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"w",
":=",
"jwriter",
".",
"Writer",
"{",
"}",
"\n",
"easyjsonC5a4559bEncodeGithubComChromedpCdprotoCss51",
"(",
"&",
"w",
",",
"v",
")",
"\n",
"return",
"w",
".",
"<mask>",
".",
"BuildBytes",
"(",
")",
",",
"w",
".",
"Error",
"\n",
"}"
] |
15,039 | all-15040 | [
"Max",
"returns",
"the",
"highest",
"value",
"in",
"the",
"total",
"range"
] | [
"func",
"(",
"l",
"*",
"InclusiveRanges",
")",
"Max",
"(",
")",
"int",
"{",
"val",
":=",
"l",
".",
"End",
"(",
")",
"\n",
"for",
"_",
",",
"aRange",
":=",
"range",
"l",
".",
"<mask>",
"{",
"next",
":=",
"aRange",
".",
"Max",
"(",
")",
"\n",
"if",
"next",
">",
"val",
"{",
"val",
"=",
"next",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"val",
"\n",
"}"
] |
15,040 | all-15041 | [
"Close",
"implements",
"Handler",
"interface"
] | [
"func",
"(",
"h",
"*",
"RotatingFileHandler",
")",
"Close",
"(",
")",
"error",
"{",
"if",
"h",
".",
"fd",
"!=",
"nil",
"{",
"<mask>",
"h",
".",
"fd",
".",
"Close",
"(",
")",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
] |
15,041 | all-15042 | [
"/",
"*",
"Recurses",
"through",
"all",
"operators",
"in",
"the",
"entire",
"tree",
"eliding",
"operators",
"where",
"both",
"sides",
"are",
"literals",
"."
] | [
"func",
"elideLiterals",
"(",
"root",
"*",
"evaluationStage",
")",
"*",
"evaluationStage",
"{",
"if",
"<mask>",
".",
"leftStage",
"!=",
"nil",
"{",
"root",
".",
"leftStage",
"=",
"elideLiterals",
"(",
"root",
".",
"leftStage",
")",
"\n",
"}",
"\n\n",
"if",
"root",
".",
"rightStage",
"!=",
"nil",
"{",
"root",
".",
"rightStage",
"=",
"elideLiterals",
"(",
"root",
".",
"rightStage",
")",
"\n",
"}",
"\n\n",
"return",
"elideStage",
"(",
"root",
")",
"\n",
"}"
] |
15,042 | all-15043 | [
"Network",
"sets",
"the",
"network",
"(",
"udp",
"tcp",
"etc",
")",
"used",
"by",
"the",
"client",
".",
"See",
"the",
"net",
".",
"Dial",
"documentation",
"(",
"https",
":",
"//",
"golang",
".",
"org",
"/",
"pkg",
"/",
"net",
"/",
"#Dial",
")",
"for",
"the",
"available",
"network",
"options",
".",
"By",
"default",
"network",
"is",
"udp",
".",
"This",
"option",
"is",
"ignored",
"in",
"Client",
".",
"Clone",
"()",
"."
] | [
"func",
"Network",
"(",
"network",
"string",
")",
"Option",
"{",
"return",
"Option",
"(",
"func",
"(",
"c",
"*",
"config",
")",
"{",
"c",
".",
"Conn",
".",
"Network",
"=",
"<mask>",
"\n",
"}",
")",
"\n",
"}"
] |
15,043 | all-15044 | [
"WithConfiguration",
"touch",
"/",
"gesture",
"events",
"configuration",
".",
"Default",
":",
"current",
"platform",
"."
] | [
"func",
"(",
"p",
"SetEmitTouchEventsForMouseParams",
")",
"WithConfiguration",
"(",
"configuration",
"SetEmitTouchEventsForMouseConfiguration",
")",
"*",
"SetEmitTouchEventsForMouseParams",
"{",
"p",
".",
"<mask>",
"=",
"configuration",
"\n",
"return",
"&",
"p",
"\n",
"}"
] |
15,044 | all-15045 | [
"GetDeviceManager",
"()",
"is",
"a",
"wrapper",
"around",
"gdk_display_get_device_manager",
"()",
"."
] | [
"func",
"(",
"v",
"*",
"Display",
")",
"GetDeviceManager",
"(",
")",
"(",
"*",
"DeviceManager",
",",
"<mask>",
")",
"{",
"c",
":=",
"C",
".",
"gdk_display_get_device_manager",
"(",
"v",
".",
"native",
"(",
")",
")",
"\n",
"if",
"c",
"==",
"nil",
"{",
"return",
"nil",
",",
"nilPtrErr",
"\n",
"}",
"\n\n",
"return",
"&",
"DeviceManager",
"{",
"glib",
".",
"Take",
"(",
"unsafe",
".",
"Pointer",
"(",
"c",
")",
")",
"}",
",",
"nil",
"\n",
"}"
] |
15,045 | all-15046 | [
"connectionTerminated",
"unregisters",
"the",
"passed",
"connection",
"and",
"marks",
"the",
"target",
"identified",
"by",
"conn",
".",
"RemoteTCPAddr",
"()",
"as",
"Waiting",
"."
] | [
"func",
"(",
"cm",
"*",
"connectionMaker",
")",
"connectionTerminated",
"(",
"conn",
"Connection",
",",
"err",
"error",
")",
"{",
"cm",
".",
"actionChan",
"<-",
"func",
"(",
")",
"bool",
"{",
"if",
"err",
"!=",
"errConnectToSelf",
"{",
"cm",
".",
"terminationCount",
"++",
"\n",
"}",
"\n",
"delete",
"(",
"cm",
".",
"connections",
",",
"conn",
")",
"\n",
"if",
"conn",
".",
"isOutbound",
"(",
")",
"{",
"target",
":=",
"cm",
".",
"targets",
"[",
"conn",
".",
"remoteTCPAddress",
"(",
")",
"]",
"\n",
"target",
".",
"state",
"=",
"targetWaiting",
"\n",
"target",
".",
"lastError",
"=",
"err",
"\n",
"_",
",",
"peerNameCollision",
":=",
"err",
".",
"(",
"*",
"peerNameCollisionError",
")",
"\n",
"switch",
"{",
"case",
"peerNameCollision",
"||",
"err",
"==",
"errConnectToSelf",
":",
"target",
".",
"nextTryNever",
"(",
")",
"\n",
"case",
"time",
".",
"Now",
"(",
")",
".",
"After",
"(",
"<mask>",
".",
"tryAfter",
".",
"Add",
"(",
"resetAfter",
")",
")",
":",
"target",
".",
"nextTryNow",
"(",
")",
"\n",
"default",
":",
"target",
".",
"nextTryLater",
"(",
")",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"true",
"\n",
"}",
"\n",
"}"
] |
15,046 | all-15047 | [
"MarshalJSON",
"turns",
"a",
"bson",
".",
"ObjectId",
"into",
"a",
"json",
".",
"Marshaller",
"."
] | [
"func",
"(",
"id",
"ObjectId",
")",
"MarshalJSON",
"(",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"return",
"[",
"]",
"<mask>",
"(",
"fmt",
".",
"Sprintf",
"(",
"`\"%x\"`",
",",
"string",
"(",
"id",
")",
")",
")",
",",
"nil",
"\n",
"}"
] |
15,047 | all-15048 | [
"title",
":",
"set",
"node",
"status",
"path",
":",
"/",
"node",
"/",
"status",
"method",
":",
"POST",
"consume",
":",
"application",
"/",
"x",
"-",
"www",
"-",
"form",
"-",
"urlencoded",
"produce",
":",
"application",
"/",
"json",
"responses",
":",
"200",
":",
"Ok",
"400",
":",
"Invalid",
"data",
"401",
":",
"Unauthorized",
"404",
":",
"App",
"or",
"unit",
"not",
"found"
] | [
"func",
"setNodeStatus",
"(",
"w",
"http",
".",
"ResponseWriter",
",",
"r",
"*",
"<mask>",
".",
"Request",
",",
"t",
"auth",
".",
"Token",
")",
"error",
"{",
"if",
"t",
".",
"GetAppName",
"(",
")",
"!=",
"app",
".",
"InternalAppName",
"{",
"return",
"&",
"errors",
".",
"HTTP",
"{",
"Code",
":",
"http",
".",
"StatusForbidden",
",",
"Message",
":",
"\"",
"\"",
"}",
"\n",
"}",
"\n",
"var",
"hostInput",
"provision",
".",
"NodeStatusData",
"\n",
"err",
":=",
"ParseInput",
"(",
"r",
",",
"&",
"hostInput",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"result",
",",
"err",
":=",
"app",
".",
"UpdateNodeStatus",
"(",
"hostInput",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"if",
"err",
"==",
"provision",
".",
"ErrNodeNotFound",
"{",
"return",
"&",
"errors",
".",
"HTTP",
"{",
"Code",
":",
"http",
".",
"StatusNotFound",
",",
"Message",
":",
"err",
".",
"Error",
"(",
")",
"}",
"\n",
"}",
"\n",
"return",
"err",
"\n",
"}",
"\n",
"w",
".",
"Header",
"(",
")",
".",
"Add",
"(",
"\"",
"\"",
",",
"\"",
"\"",
")",
"\n",
"return",
"json",
".",
"NewEncoder",
"(",
"w",
")",
".",
"Encode",
"(",
"result",
")",
"\n",
"}"
] |
15,048 | all-15049 | [
"LeaderPlus",
"returns",
"the",
"leader",
"+",
"n",
"additional",
"nodes",
"from",
"the",
"cluster",
"the",
"leader",
"is",
"always",
"the",
"first",
"node",
"in",
"the",
"returned",
"slice",
"."
] | [
"func",
"(",
"c",
"*",
"cluster",
")",
"LeaderPlus",
"(",
"n",
"int",
")",
"[",
"]",
"*",
"raftNode",
"{",
"r",
":=",
"make",
"(",
"[",
"]",
"*",
"raftNode",
",",
"0",
",",
"n",
"+",
"1",
")",
"\n",
"ldr",
":=",
"c",
".",
"Leader",
"(",
"time",
".",
"Second",
")",
"\n",
"if",
"ldr",
"!=",
"nil",
"{",
"r",
"=",
"append",
"(",
"r",
",",
"ldr",
")",
"\n",
"}",
"\n",
"if",
"len",
"(",
"r",
")",
">=",
"n",
"{",
"return",
"r",
"\n",
"}",
"\n",
"for",
"_",
",",
"node",
":=",
"range",
"c",
".",
"nodes",
"{",
"if",
"!",
"containsNode",
"(",
"r",
",",
"<mask>",
")",
"{",
"r",
"=",
"append",
"(",
"r",
",",
"node",
")",
"\n",
"if",
"len",
"(",
"r",
")",
">=",
"n",
"{",
"return",
"r",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"r",
"\n",
"}"
] |
15,049 | all-15050 | [
"GetAggregatorOk",
"returns",
"a",
"tuple",
"with",
"the",
"Aggregator",
"field",
"if",
"it",
"s",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"and",
"a",
"boolean",
"to",
"check",
"if",
"the",
"value",
"has",
"been",
"set",
"."
] | [
"func",
"(",
"t",
"*",
"TileDefRequest",
")",
"GetAggregatorOk",
"(",
")",
"(",
"string",
",",
"bool",
")",
"{",
"if",
"t",
"==",
"nil",
"||",
"t",
".",
"Aggregator",
"==",
"nil",
"{",
"return",
"\"",
"\"",
",",
"<mask>",
"\n",
"}",
"\n",
"return",
"*",
"t",
".",
"Aggregator",
",",
"true",
"\n",
"}"
] |
15,050 | all-15051 | [
"uploadSSHKey",
"updates",
"the",
"instance",
"metadata",
"with",
"the",
"given",
"ssh",
"key",
"."
] | [
"func",
"(",
"c",
"*",
"ComputeUtil",
")",
"uploadSSHKey",
"(",
"instance",
"*",
"raw",
".",
"Instance",
",",
"sshKeyPath",
"string",
")",
"error",
"{",
"log",
".",
"Infof",
"(",
"\"",
"\"",
")",
"\n\n",
"sshKey",
",",
"err",
":=",
"ioutil",
".",
"ReadFile",
"(",
"sshKeyPath",
"+",
"\"",
"\"",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"metaDataValue",
":=",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\\n",
"\"",
",",
"c",
".",
"userName",
",",
"strings",
".",
"TrimSpace",
"(",
"string",
"(",
"sshKey",
")",
")",
",",
"c",
".",
"userName",
")",
"\n\n",
"op",
",",
"err",
":=",
"c",
".",
"service",
".",
"Instances",
".",
"SetMetadata",
"(",
"c",
".",
"project",
",",
"c",
".",
"<mask>",
",",
"c",
".",
"instanceName",
",",
"&",
"raw",
".",
"Metadata",
"{",
"Fingerprint",
":",
"instance",
".",
"Metadata",
".",
"Fingerprint",
",",
"Items",
":",
"[",
"]",
"*",
"raw",
".",
"MetadataItems",
"{",
"{",
"Key",
":",
"\"",
"\"",
",",
"Value",
":",
"&",
"metaDataValue",
",",
"}",
",",
"}",
",",
"}",
")",
".",
"Do",
"(",
")",
"\n\n",
"return",
"c",
".",
"waitForRegionalOp",
"(",
"op",
".",
"Name",
")",
"\n",
"}"
] |
15,051 | all-15052 | [
"Select",
"creates",
"a",
"reusable",
"stream",
"of",
"transformed",
"values",
"."
] | [
"func",
"Select",
"(",
"subject",
"Enumerable",
",",
"transform",
"Transform",
")",
"Enumerable",
"{",
"return",
"selecter",
"{",
"original",
":",
"subject",
",",
"<mask>",
":",
"transform",
",",
"}",
"\n",
"}"
] |
15,052 | all-15053 | [
"InsertText",
"is",
"a",
"wrapper",
"around",
"gtk_combo_box_text_insert_text",
"()",
"."
] | [
"func",
"(",
"v",
"*",
"ComboBoxText",
")",
"InsertText",
"(",
"position",
"int",
",",
"text",
"string",
")",
"{",
"cstr",
":=",
"C",
".",
"CString",
"(",
"text",
")",
"\n",
"defer",
"C",
".",
"free",
"(",
"unsafe",
".",
"Pointer",
"(",
"cstr",
")",
")",
"\n",
"C",
".",
"gtk_combo_box_text_insert_text",
"(",
"v",
".",
"native",
"(",
")",
",",
"C",
".",
"gint",
"(",
"<mask>",
")",
",",
"(",
"*",
"C",
".",
"gchar",
")",
"(",
"cstr",
")",
")",
"\n",
"}"
] |
15,053 | all-15054 | [
"GetTaskCredentials",
"retrieves",
"credentials",
"for",
"a",
"given",
"credentials",
"id"
] | [
"func",
"(",
"manager",
"*",
"credentialsManager",
")",
"GetTaskCredentials",
"(",
"id",
"string",
")",
"(",
"TaskIAMRoleCredentials",
",",
"bool",
")",
"{",
"manager",
".",
"taskCredentialsLock",
".",
"RLock",
"(",
")",
"\n",
"defer",
"manager",
".",
"taskCredentialsLock",
".",
"RUnlock",
"(",
")",
"\n\n",
"taskCredentials",
",",
"ok",
":=",
"manager",
".",
"idToTaskCredentials",
"[",
"<mask>",
"]",
"\n\n",
"if",
"!",
"ok",
"{",
"return",
"TaskIAMRoleCredentials",
"{",
"}",
",",
"ok",
"\n",
"}",
"\n",
"return",
"TaskIAMRoleCredentials",
"{",
"ARN",
":",
"taskCredentials",
".",
"ARN",
",",
"IAMRoleCredentials",
":",
"taskCredentials",
".",
"GetIAMRoleCredentials",
"(",
")",
",",
"}",
",",
"ok",
"\n",
"}"
] |
15,054 | all-15055 | [
"UnmarshalJSON",
"supports",
"json",
".",
"Unmarshaler",
"interface"
] | [
"func",
"(",
"v",
"*",
"InlineTextBox",
")",
"UnmarshalJSON",
"(",
"<mask>",
"[",
"]",
"byte",
")",
"error",
"{",
"r",
":=",
"jlexer",
".",
"Lexer",
"{",
"Data",
":",
"data",
"}",
"\n",
"easyjsonC5a4559bDecodeGithubComChromedpCdprotoDomsnapshot8",
"(",
"&",
"r",
",",
"v",
")",
"\n",
"return",
"r",
".",
"Error",
"(",
")",
"\n",
"}"
] |
15,055 | all-15056 | [
"Format",
"the",
"given",
"SQL",
"statement",
"in",
"a",
"human",
"-",
"readable",
"way",
".",
"In",
"particular",
"make",
"sure",
"that",
"each",
"column",
"definition",
"in",
"a",
"CREATE",
"TABLE",
"clause",
"is",
"in",
"its",
"own",
"row",
"since",
"SQLite",
"dumps",
"occasionally",
"stuff",
"more",
"than",
"one",
"column",
"in",
"the",
"same",
"line",
"."
] | [
"func",
"formatSQL",
"(",
"statement",
"string",
")",
"string",
"{",
"lines",
":=",
"strings",
".",
"Split",
"(",
"statement",
",",
"\"",
"\\n",
"\"",
")",
"\n",
"for",
"i",
",",
"line",
":=",
"range",
"lines",
"{",
"if",
"strings",
".",
"Contains",
"(",
"line",
",",
"\"",
"\"",
")",
"{",
"// Let UNIQUE(x, y) constraints alone.",
"continue",
"\n",
"}",
"\n",
"lines",
"[",
"i",
"]",
"=",
"strings",
".",
"Replace",
"(",
"<mask>",
",",
"\"",
"\"",
",",
"\"",
"\\n",
"\"",
",",
"-",
"1",
")",
"\n",
"}",
"\n",
"return",
"strings",
".",
"Join",
"(",
"lines",
",",
"\"",
"\\n",
"\"",
")",
"\n",
"}"
] |
15,056 | all-15057 | [
"NewFakeClient",
"creates",
"a",
"new",
"client",
"that",
"will",
"not",
"perform",
"any",
"actions",
"at",
"all",
"."
] | [
"func",
"NewFakeClient",
"(",
")",
"*",
"<mask>",
"{",
"return",
"&",
"Client",
"{",
"logger",
":",
"logrus",
".",
"WithField",
"(",
"\"",
"\"",
",",
"\"",
"\"",
")",
",",
"time",
":",
"&",
"standardTime",
"{",
"}",
",",
"fake",
":",
"true",
",",
"dry",
":",
"true",
",",
"}",
"\n",
"}"
] |
15,057 | all-15058 | [
"ChangeCustomContactVar",
"creates",
"a",
"new",
"CHANGE_CUSTOM_CONTACT_VAR",
"Nagios",
"command",
".",
"Changes",
"the",
"value",
"of",
"a",
"custom",
"contact",
"variable",
"."
] | [
"func",
"ChangeCustomContactVar",
"(",
"contact_name",
"string",
",",
"varname",
"string",
",",
"varvalue",
"<mask>",
",",
")",
"*",
"livestatus",
".",
"Command",
"{",
"return",
"livestatus",
".",
"NewCommand",
"(",
"\"",
"\"",
",",
"stringifyArg",
"(",
"\"",
"\"",
",",
"\"",
"\"",
",",
"contact_name",
")",
",",
"stringifyArg",
"(",
"\"",
"\"",
",",
"\"",
"\"",
",",
"varname",
")",
",",
"stringifyArg",
"(",
"\"",
"\"",
",",
"\"",
"\"",
",",
"varvalue",
")",
",",
")",
"\n",
"}"
] |
15,058 | all-15059 | [
"getCredentials",
"calls",
"gcloud",
"container",
"clusters",
"get",
"-",
"credentials",
"usually",
"preserving",
"currentContext",
"()"
] | [
"func",
"getCredentials",
"(",
"o",
"options",
")",
"error",
"{",
"if",
"!",
"o",
".",
"changeContext",
"{",
"cur",
",",
"err",
":=",
"currentContext",
"(",
"o",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"}",
"\n",
"defer",
"useContext",
"(",
"o",
",",
"cur",
")",
"\n",
"}",
"\n\n",
"// TODO(fejta): we ought to update kube.Client to support modern auth methods.",
"// More info: https://github.com/kubernetes/kubernetes/issues/30617",
"old",
",",
"set",
":=",
"os",
".",
"LookupEnv",
"(",
"useClientCertEnv",
")",
"\n",
"if",
"set",
"{",
"defer",
"os",
".",
"Setenv",
"(",
"useClientCertEnv",
",",
"old",
")",
"\n",
"}",
"\n",
"if",
"err",
":=",
"os",
".",
"Setenv",
"(",
"\"",
"\"",
",",
"\"",
"\"",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"useClientCertEnv",
",",
"err",
")",
"\n",
"}",
"\n",
"args",
",",
"cmd",
":=",
"command",
"(",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"o",
".",
"cluster",
",",
"\"",
"\"",
",",
"o",
".",
"<mask>",
",",
"\"",
"\"",
",",
"o",
".",
"zone",
",",
")",
"\n",
"if",
"err",
":=",
"cmd",
".",
"Run",
"(",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"strings",
".",
"Join",
"(",
"args",
",",
"\"",
"\"",
")",
",",
"err",
")",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
] |
15,059 | all-15060 | [
"diskSpecForCreate",
"checks",
"to",
"make",
"sure",
"that",
"a",
"disk",
"is",
"available",
"to",
"be",
"used",
"to",
"create",
"a",
"VMFS",
"datastore",
"specifically",
"in",
"its",
"entirety",
"and",
"returns",
"a",
"respective",
"VmfsDatastoreCreateSpec",
"."
] | [
"func",
"diskSpecForCreate",
"(",
"dss",
"*",
"object",
".",
"HostDatastoreSystem",
",",
"name",
"string",
")",
"(",
"*",
"types",
".",
"VmfsDatastoreCreateSpec",
",",
"error",
")",
"{",
"disk",
",",
"err",
":=",
"availableScsiDisk",
"(",
"dss",
",",
"name",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"ctx",
",",
"cancel",
":=",
"context",
".",
"WithTimeout",
"(",
"context",
".",
"Background",
"(",
")",
",",
"defaultAPITimeout",
")",
"\n",
"defer",
"cancel",
"(",
")",
"\n",
"options",
",",
"err",
":=",
"dss",
".",
"QueryVmfsDatastoreCreateOptions",
"(",
"ctx",
",",
"disk",
".",
"DevicePath",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"name",
",",
"err",
")",
"\n",
"}",
"\n",
"var",
"option",
"*",
"types",
".",
"VmfsDatastoreOption",
"\n",
"for",
"_",
",",
"o",
":=",
"range",
"options",
"{",
"if",
"_",
",",
"ok",
":=",
"o",
".",
"Info",
".",
"(",
"*",
"types",
".",
"VmfsDatastoreAllExtentOption",
")",
";",
"ok",
"{",
"option",
"=",
"&",
"o",
"\n",
"break",
"\n",
"}",
"\n",
"}",
"\n",
"if",
"option",
"==",
"nil",
"{",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"name",
")",
"\n",
"}",
"\n",
"return",
"<mask>",
".",
"Spec",
".",
"(",
"*",
"types",
".",
"VmfsDatastoreCreateSpec",
")",
",",
"nil",
"\n",
"}"
] |
15,060 | all-15061 | [
"expandVMwareIpfixConfig",
"reads",
"certain",
"ResourceData",
"keys",
"and",
"returns",
"a",
"VMwareIpfixConfig",
"."
] | [
"func",
"expandVMwareIpfixConfig",
"(",
"d",
"*",
"schema",
".",
"ResourceData",
")",
"*",
"<mask>",
".",
"VMwareIpfixConfig",
"{",
"obj",
":=",
"&",
"types",
".",
"VMwareIpfixConfig",
"{",
"ActiveFlowTimeout",
":",
"int32",
"(",
"d",
".",
"Get",
"(",
"\"",
"\"",
")",
".",
"(",
"int",
")",
")",
",",
"CollectorIpAddress",
":",
"d",
".",
"Get",
"(",
"\"",
"\"",
")",
".",
"(",
"string",
")",
",",
"CollectorPort",
":",
"int32",
"(",
"d",
".",
"Get",
"(",
"\"",
"\"",
")",
".",
"(",
"int",
")",
")",
",",
"IdleFlowTimeout",
":",
"int32",
"(",
"d",
".",
"Get",
"(",
"\"",
"\"",
")",
".",
"(",
"int",
")",
")",
",",
"InternalFlowsOnly",
":",
"d",
".",
"Get",
"(",
"\"",
"\"",
")",
".",
"(",
"bool",
")",
",",
"ObservationDomainId",
":",
"int64",
"(",
"d",
".",
"Get",
"(",
"\"",
"\"",
")",
".",
"(",
"int",
")",
")",
",",
"SamplingRate",
":",
"int32",
"(",
"d",
".",
"Get",
"(",
"\"",
"\"",
")",
".",
"(",
"int",
")",
")",
",",
"}",
"\n",
"return",
"obj",
"\n",
"}"
] |
15,061 | all-15062 | [
"NewOutgoingAudioResend",
"creates",
"a",
"new",
"outgoing",
"audio",
"file",
"for",
"re",
"-",
"sending",
"."
] | [
"func",
"(",
"api",
"*",
"TelegramBotAPI",
")",
"NewOutgoingAudioResend",
"(",
"recipient",
"Recipient",
",",
"fileID",
"<mask>",
")",
"*",
"OutgoingAudio",
"{",
"return",
"&",
"OutgoingAudio",
"{",
"outgoingMessageBase",
":",
"outgoingMessageBase",
"{",
"outgoingBase",
":",
"outgoingBase",
"{",
"api",
":",
"api",
",",
"Recipient",
":",
"recipient",
",",
"}",
",",
"}",
",",
"outgoingFileBase",
":",
"outgoingFileBase",
"{",
"fileID",
":",
"fileID",
",",
"}",
",",
"}",
"\n",
"}"
] |
15,062 | all-15063 | [
"HasParams",
"returns",
"a",
"boolean",
"if",
"a",
"field",
"has",
"been",
"set",
"."
] | [
"func",
"(",
"w",
"*",
"Widget",
")",
"HasParams",
"(",
")",
"bool",
"{",
"if",
"w",
"!=",
"nil",
"&&",
"w",
".",
"Params",
"!=",
"nil",
"{",
"return",
"<mask>",
"\n",
"}",
"\n\n",
"return",
"false",
"\n",
"}"
] |
15,063 | all-15064 | [
"MoveStoragePoolVolume",
"renames",
"or",
"moves",
"an",
"existing",
"storage",
"volume"
] | [
"func",
"(",
"r",
"*",
"ProtocolLXD",
")",
"MoveStoragePoolVolume",
"(",
"pool",
"string",
",",
"source",
"ContainerServer",
",",
"sourcePool",
"string",
",",
"volume",
"api",
".",
"StorageVolume",
",",
"args",
"*",
"StoragePoolVolumeMoveArgs",
")",
"(",
"RemoteOperation",
",",
"error",
")",
"{",
"if",
"!",
"r",
".",
"HasExtension",
"(",
"\"",
"\"",
")",
"{",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\\\"",
"\\\"",
"\"",
")",
"\n",
"}",
"\n\n",
"if",
"r",
"!=",
"source",
"{",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"req",
":=",
"api",
".",
"StorageVolumePost",
"{",
"Name",
":",
"args",
".",
"<mask>",
",",
"Pool",
":",
"pool",
",",
"}",
"\n\n",
"// Send the request",
"op",
",",
"_",
",",
"err",
":=",
"r",
".",
"queryOperation",
"(",
"\"",
"\"",
",",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"url",
".",
"QueryEscape",
"(",
"sourcePool",
")",
",",
"url",
".",
"QueryEscape",
"(",
"volume",
".",
"Type",
")",
",",
"volume",
".",
"Name",
")",
",",
"req",
",",
"\"",
"\"",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"rop",
":=",
"remoteOperation",
"{",
"targetOp",
":",
"op",
",",
"chDone",
":",
"make",
"(",
"chan",
"bool",
")",
",",
"}",
"\n\n",
"// Forward targetOp to remote op",
"go",
"func",
"(",
")",
"{",
"rop",
".",
"err",
"=",
"rop",
".",
"targetOp",
".",
"Wait",
"(",
")",
"\n",
"close",
"(",
"rop",
".",
"chDone",
")",
"\n",
"}",
"(",
")",
"\n\n",
"return",
"&",
"rop",
",",
"nil",
"\n",
"}"
] |
15,064 | all-15065 | [
"GetByField",
"provides",
"a",
"mock",
"function",
"with",
"given",
"fields",
":",
"name",
"val",
"store",
"dst"
] | [
"func",
"(",
"_m",
"*",
"ObjectStore",
")",
"GetByField",
"(",
"name",
"string",
",",
"val",
"string",
",",
"store",
"string",
",",
"dst",
"interface",
"{",
"}",
")",
"error",
"{",
"ret",
":=",
"_m",
".",
"Called",
"(",
"name",
",",
"val",
",",
"store",
",",
"dst",
")",
"\n\n",
"<mask>",
"r0",
"error",
"\n",
"if",
"rf",
",",
"ok",
":=",
"ret",
".",
"Get",
"(",
"0",
")",
".",
"(",
"func",
"(",
"string",
",",
"string",
",",
"string",
",",
"interface",
"{",
"}",
")",
"error",
")",
";",
"ok",
"{",
"r0",
"=",
"rf",
"(",
"name",
",",
"val",
",",
"store",
",",
"dst",
")",
"\n",
"}",
"else",
"{",
"r0",
"=",
"ret",
".",
"Error",
"(",
"0",
")",
"\n",
"}",
"\n\n",
"return",
"r0",
"\n",
"}"
] |
15,065 | all-15066 | [
"DeleteLoadbalancer",
"deletes",
"a",
"load",
"balancer"
] | [
"func",
"(",
"c",
"*",
"Client",
")",
"DeleteLoadbalancer",
"(",
"dcid",
",",
"lbalid",
"string",
")",
"(",
"*",
"http",
".",
"Header",
",",
"error",
")",
"{",
"url",
":=",
"lbalPath",
"(",
"dcid",
",",
"lbalid",
")",
"+",
"`?depth=`",
"+",
"c",
".",
"client",
".",
"depth",
"+",
"`&pretty=`",
"+",
"strconv",
".",
"FormatBool",
"(",
"c",
".",
"<mask>",
".",
"pretty",
")",
"\n",
"ret",
":=",
"&",
"http",
".",
"Header",
"{",
"}",
"\n",
"err",
":=",
"c",
".",
"client",
".",
"Delete",
"(",
"url",
",",
"ret",
",",
"http",
".",
"StatusAccepted",
")",
"\n",
"return",
"ret",
",",
"err",
"\n",
"}"
] |
15,066 | all-15067 | [
"shouldOverrideNetworkMode",
"returns",
"true",
"if",
"the",
"network",
"mode",
"of",
"the",
"container",
"needs",
"to",
"be",
"overridden",
".",
"It",
"also",
"returns",
"the",
"override",
"string",
"in",
"this",
"case",
".",
"It",
"returns",
"false",
"otherwise"
] | [
"func",
"(",
"task",
"*",
"Task",
")",
"shouldOverrideNetworkMode",
"(",
"container",
"*",
"apicontainer",
".",
"<mask>",
",",
"dockerContainerMap",
"map",
"[",
"string",
"]",
"*",
"apicontainer",
".",
"DockerContainer",
")",
"(",
"bool",
",",
"string",
")",
"{",
"// TODO. We can do an early return here by determining which kind of task it is",
"// Example: Does this task have ENIs in its payload, what is its networking mode etc",
"if",
"container",
".",
"IsInternal",
"(",
")",
"{",
"// If it's an internal container, set the network mode to none.",
"// Currently, internal containers are either for creating empty host",
"// volumes or for creating the 'pause' container. Both of these",
"// only need the network mode to be set to \"none\"",
"return",
"true",
",",
"networkModeNone",
"\n",
"}",
"\n\n",
"// For other types of containers, determine if the container map contains",
"// a pause container. Since a pause container is only added to the task",
"// when using non docker daemon supported network modes, its existence",
"// indicates the need to configure the network mode outside of supported",
"// network drivers",
"if",
"task",
".",
"GetTaskENI",
"(",
")",
"==",
"nil",
"{",
"return",
"false",
",",
"\"",
"\"",
"\n",
"}",
"\n\n",
"pauseContName",
":=",
"\"",
"\"",
"\n",
"for",
"_",
",",
"cont",
":=",
"range",
"task",
".",
"Containers",
"{",
"if",
"cont",
".",
"Type",
"==",
"apicontainer",
".",
"ContainerCNIPause",
"{",
"pauseContName",
"=",
"cont",
".",
"Name",
"\n",
"break",
"\n",
"}",
"\n",
"}",
"\n",
"if",
"pauseContName",
"==",
"\"",
"\"",
"{",
"seelog",
".",
"Critical",
"(",
"\"",
"\"",
",",
"task",
".",
"String",
"(",
")",
")",
"\n",
"return",
"false",
",",
"\"",
"\"",
"\n",
"}",
"\n",
"pauseContainer",
",",
"ok",
":=",
"dockerContainerMap",
"[",
"pauseContName",
"]",
"\n",
"if",
"!",
"ok",
"||",
"pauseContainer",
"==",
"nil",
"{",
"// This should never be the case and implies a code-bug.",
"seelog",
".",
"Criticalf",
"(",
"\"",
"\"",
",",
"container",
".",
"String",
"(",
")",
",",
"task",
".",
"String",
"(",
")",
")",
"\n",
"return",
"false",
",",
"\"",
"\"",
"\n",
"}",
"\n",
"return",
"true",
",",
"dockerMappingContainerPrefix",
"+",
"pauseContainer",
".",
"DockerID",
"\n",
"}"
] |
15,067 | all-15068 | [
"Run",
"serves",
"the",
"HTTP",
"endpoints",
"."
] | [
"func",
"(",
"h",
"*",
"Handler",
")",
"Run",
"(",
"ctx",
"context",
".",
"Context",
")",
"error",
"{",
"level",
".",
"Info",
"(",
"h",
".",
"logger",
")",
".",
"Log",
"(",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"h",
".",
"options",
".",
"ListenAddress",
")",
"\n\n",
"listener",
",",
"err",
":=",
"net",
".",
"Listen",
"(",
"\"",
"\"",
",",
"h",
".",
"options",
".",
"ListenAddress",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"listener",
"=",
"netutil",
".",
"LimitListener",
"(",
"listener",
",",
"h",
".",
"options",
".",
"MaxConnections",
")",
"\n\n",
"// Monitor incoming connections with conntrack.",
"listener",
"=",
"conntrack",
".",
"NewListener",
"(",
"listener",
",",
"conntrack",
".",
"TrackWithName",
"(",
"\"",
"\"",
")",
",",
"conntrack",
".",
"TrackWithTracing",
"(",
")",
")",
"\n\n",
"<mask>",
"(",
"m",
"=",
"cmux",
".",
"New",
"(",
"listener",
")",
"\n",
"// See https://github.com/grpc/grpc-go/issues/2636 for why we need to use MatchWithWriters().",
"grpcl",
"=",
"m",
".",
"MatchWithWriters",
"(",
"cmux",
".",
"HTTP2MatchHeaderFieldSendSettings",
"(",
"\"",
"\"",
",",
"\"",
"\"",
")",
")",
"\n",
"httpl",
"=",
"m",
".",
"Match",
"(",
"cmux",
".",
"HTTP1Fast",
"(",
")",
")",
"\n",
"grpcSrv",
"=",
"grpc",
".",
"NewServer",
"(",
")",
"\n",
")",
"\n",
"av2",
":=",
"api_v2",
".",
"New",
"(",
"h",
".",
"options",
".",
"TSDB",
",",
"h",
".",
"options",
".",
"EnableAdminAPI",
",",
")",
"\n",
"av2",
".",
"RegisterGRPC",
"(",
"grpcSrv",
")",
"\n\n",
"hh",
",",
"err",
":=",
"av2",
".",
"HTTPHandler",
"(",
"ctx",
",",
"h",
".",
"options",
".",
"ListenAddress",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"hhFunc",
":=",
"h",
".",
"testReadyHandler",
"(",
"hh",
")",
"\n\n",
"operationName",
":=",
"nethttp",
".",
"OperationNameFunc",
"(",
"func",
"(",
"r",
"*",
"http",
".",
"Request",
")",
"string",
"{",
"return",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"r",
".",
"Method",
",",
"r",
".",
"URL",
".",
"Path",
")",
"\n",
"}",
")",
"\n",
"mux",
":=",
"http",
".",
"NewServeMux",
"(",
")",
"\n",
"mux",
".",
"Handle",
"(",
"\"",
"\"",
",",
"h",
".",
"router",
")",
"\n\n",
"av1",
":=",
"route",
".",
"New",
"(",
")",
".",
"WithInstrumentation",
"(",
"instrumentHandlerWithPrefix",
"(",
"\"",
"\"",
")",
")",
"\n",
"h",
".",
"apiV1",
".",
"Register",
"(",
"av1",
")",
"\n",
"apiPath",
":=",
"\"",
"\"",
"\n",
"if",
"h",
".",
"options",
".",
"RoutePrefix",
"!=",
"\"",
"\"",
"{",
"apiPath",
"=",
"h",
".",
"options",
".",
"RoutePrefix",
"+",
"apiPath",
"\n",
"level",
".",
"Info",
"(",
"h",
".",
"logger",
")",
".",
"Log",
"(",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"h",
".",
"options",
".",
"RoutePrefix",
")",
"\n",
"}",
"\n\n",
"mux",
".",
"Handle",
"(",
"apiPath",
"+",
"\"",
"\"",
",",
"http",
".",
"StripPrefix",
"(",
"apiPath",
"+",
"\"",
"\"",
",",
"av1",
")",
")",
"\n\n",
"mux",
".",
"Handle",
"(",
"apiPath",
"+",
"\"",
"\"",
",",
"http",
".",
"StripPrefix",
"(",
"apiPath",
",",
"http",
".",
"HandlerFunc",
"(",
"func",
"(",
"w",
"http",
".",
"ResponseWriter",
",",
"r",
"*",
"http",
".",
"Request",
")",
"{",
"httputil",
".",
"SetCORS",
"(",
"w",
",",
"h",
".",
"options",
".",
"CORSOrigin",
",",
"r",
")",
"\n",
"hhFunc",
"(",
"w",
",",
"r",
")",
"\n",
"}",
")",
",",
")",
")",
"\n\n",
"errlog",
":=",
"stdlog",
".",
"New",
"(",
"log",
".",
"NewStdlibAdapter",
"(",
"level",
".",
"Error",
"(",
"h",
".",
"logger",
")",
")",
",",
"\"",
"\"",
",",
"0",
")",
"\n\n",
"httpSrv",
":=",
"&",
"http",
".",
"Server",
"{",
"Handler",
":",
"withStackTracer",
"(",
"nethttp",
".",
"Middleware",
"(",
"opentracing",
".",
"GlobalTracer",
"(",
")",
",",
"mux",
",",
"operationName",
")",
",",
"h",
".",
"logger",
")",
",",
"ErrorLog",
":",
"errlog",
",",
"ReadTimeout",
":",
"h",
".",
"options",
".",
"ReadTimeout",
",",
"}",
"\n\n",
"errCh",
":=",
"make",
"(",
"chan",
"error",
")",
"\n",
"go",
"func",
"(",
")",
"{",
"errCh",
"<-",
"httpSrv",
".",
"Serve",
"(",
"httpl",
")",
"\n",
"}",
"(",
")",
"\n",
"go",
"func",
"(",
")",
"{",
"errCh",
"<-",
"grpcSrv",
".",
"Serve",
"(",
"grpcl",
")",
"\n",
"}",
"(",
")",
"\n",
"go",
"func",
"(",
")",
"{",
"errCh",
"<-",
"m",
".",
"Serve",
"(",
")",
"\n",
"}",
"(",
")",
"\n\n",
"select",
"{",
"case",
"e",
":=",
"<-",
"errCh",
":",
"return",
"e",
"\n",
"case",
"<-",
"ctx",
".",
"Done",
"(",
")",
":",
"httpSrv",
".",
"Shutdown",
"(",
"ctx",
")",
"\n",
"grpcSrv",
".",
"GracefulStop",
"(",
")",
"\n",
"return",
"nil",
"\n",
"}",
"\n",
"}"
] |
15,068 | all-15069 | [
"UnmarshalJSON",
"supports",
"json",
".",
"Unmarshaler",
"interface"
] | [
"func",
"(",
"v",
"*",
"StackTrace",
")",
"UnmarshalJSON",
"(",
"data",
"[",
"]",
"byte",
")",
"error",
"{",
"r",
":=",
"jlexer",
".",
"Lexer",
"{",
"Data",
":",
"<mask>",
"}",
"\n",
"easyjsonC5a4559bDecodeGithubComChromedpCdprotoRuntime2",
"(",
"&",
"r",
",",
"v",
")",
"\n",
"return",
"r",
".",
"Error",
"(",
")",
"\n",
"}"
] |
15,069 | all-15070 | [
"filterSubpool",
"filters",
"PRs",
"from",
"an",
"initially",
"identified",
"subpool",
"returning",
"the",
"filtered",
"subpool",
".",
"If",
"the",
"subpool",
"becomes",
"empty",
"nil",
"is",
"returned",
"to",
"indicate",
"that",
"the",
"subpool",
"should",
"be",
"deleted",
"."
] | [
"func",
"filterSubpool",
"(",
"ghc",
"githubClient",
",",
"sp",
"*",
"subpool",
")",
"*",
"subpool",
"{",
"<mask>",
"toKeep",
"[",
"]",
"PullRequest",
"\n",
"for",
"_",
",",
"pr",
":=",
"range",
"sp",
".",
"prs",
"{",
"if",
"!",
"filterPR",
"(",
"ghc",
",",
"sp",
",",
"&",
"pr",
")",
"{",
"toKeep",
"=",
"append",
"(",
"toKeep",
",",
"pr",
")",
"\n",
"}",
"\n",
"}",
"\n",
"if",
"len",
"(",
"toKeep",
")",
"==",
"0",
"{",
"return",
"nil",
"\n",
"}",
"\n",
"sp",
".",
"prs",
"=",
"toKeep",
"\n",
"return",
"sp",
"\n",
"}"
] |
15,070 | all-15071 | [
"UpdateIPBlock",
"partial",
"update",
"of",
"ipblock",
"properties"
] | [
"func",
"(",
"c",
"*",
"Client",
")",
"UpdateIPBlock",
"(",
"ipblockid",
"string",
",",
"props",
"IPBlockProperties",
")",
"(",
"*",
"IPBlock",
",",
"error",
")",
"{",
"url",
":=",
"ipblockPath",
"(",
"ipblockid",
")",
"+",
"`?depth=`",
"+",
"c",
".",
"client",
".",
"<mask>",
"+",
"`&pretty=`",
"+",
"strconv",
".",
"FormatBool",
"(",
"c",
".",
"client",
".",
"pretty",
")",
"\n",
"ret",
":=",
"&",
"IPBlock",
"{",
"}",
"\n",
"err",
":=",
"c",
".",
"client",
".",
"Patch",
"(",
"url",
",",
"props",
",",
"ret",
",",
"http",
".",
"StatusAccepted",
")",
"\n",
"return",
"ret",
",",
"err",
"\n",
"}"
] |
15,071 | all-15072 | [
"DetachPersistentDisk",
"updates",
"the",
"agent",
"settings",
"in",
"order",
"to",
"delete",
"an",
"attached",
"persistent",
"disk",
"."
] | [
"func",
"(",
"as",
"AgentSettings",
")",
"DetachPersistentDisk",
"(",
"diskID",
"string",
")",
"AgentSettings",
"{",
"persistenDiskSettings",
":=",
"as",
".",
"Disks",
".",
"Persistent",
"\n",
"<mask>",
"(",
"persistenDiskSettings",
",",
"diskID",
")",
"\n",
"as",
".",
"Disks",
".",
"Persistent",
"=",
"persistenDiskSettings",
"\n\n",
"return",
"as",
"\n",
"}"
] |
15,072 | all-15073 | [
"UpdateUser",
"updates",
"passed",
"user",
"."
] | [
"func",
"(",
"a",
"*",
"API",
")",
"UpdateUser",
"(",
"cfg",
"*",
"User",
")",
"(",
"*",
"User",
",",
"error",
")",
"{",
"if",
"cfg",
"==",
"nil",
"{",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"userCID",
":=",
"string",
"(",
"cfg",
".",
"CID",
")",
"\n\n",
"matched",
",",
"err",
":=",
"regexp",
".",
"MatchString",
"(",
"config",
".",
"UserCIDRegex",
",",
"userCID",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"if",
"!",
"matched",
"{",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"userCID",
")",
"\n",
"}",
"\n\n",
"jsonCfg",
",",
"err",
":=",
"json",
".",
"Marshal",
"(",
"cfg",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"if",
"a",
".",
"Debug",
"{",
"a",
".",
"Log",
".",
"Printf",
"(",
"\"",
"\"",
",",
"string",
"(",
"jsonCfg",
")",
")",
"\n",
"}",
"\n\n",
"<mask>",
",",
"err",
":=",
"a",
".",
"Put",
"(",
"userCID",
",",
"jsonCfg",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"user",
":=",
"&",
"User",
"{",
"}",
"\n",
"if",
"err",
":=",
"json",
".",
"Unmarshal",
"(",
"result",
",",
"user",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"return",
"user",
",",
"nil",
"\n",
"}"
] |
15,073 | all-15074 | [
"Specify",
"the",
"value",
"of",
"a",
"uniform",
"variable",
"for",
"a",
"specified",
"program",
"object"
] | [
"func",
"ProgramUniform4uiv",
"(",
"program",
"uint32",
",",
"location",
"int32",
",",
"count",
"int32",
",",
"value",
"*",
"uint32",
")",
"{",
"C",
".",
"glowProgramUniform4uiv",
"(",
"gpProgramUniform4uiv",
",",
"(",
"C",
".",
"GLuint",
")",
"(",
"program",
")",
",",
"(",
"C",
".",
"GLint",
")",
"(",
"<mask>",
")",
",",
"(",
"C",
".",
"GLsizei",
")",
"(",
"count",
")",
",",
"(",
"*",
"C",
".",
"GLuint",
")",
"(",
"unsafe",
".",
"Pointer",
"(",
"value",
")",
")",
")",
"\n",
"}"
] |
15,074 | all-15075 | [
"StoragePoolGetID",
"returns",
"the",
"id",
"of",
"a",
"single",
"storage",
"pool",
"."
] | [
"func",
"(",
"c",
"*",
"Cluster",
")",
"StoragePoolGetID",
"(",
"poolName",
"string",
")",
"(",
"int64",
",",
"error",
")",
"{",
"poolID",
":=",
"int64",
"(",
"-",
"1",
")",
"\n",
"query",
":=",
"\"",
"\"",
"\n",
"inargs",
":=",
"[",
"]",
"interface",
"{",
"}",
"{",
"poolName",
"}",
"\n",
"outargs",
":=",
"[",
"]",
"<mask>",
"{",
"}",
"{",
"&",
"poolID",
"}",
"\n\n",
"err",
":=",
"dbQueryRowScan",
"(",
"c",
".",
"db",
",",
"query",
",",
"inargs",
",",
"outargs",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"if",
"err",
"==",
"sql",
".",
"ErrNoRows",
"{",
"return",
"-",
"1",
",",
"ErrNoSuchObject",
"\n",
"}",
"\n",
"}",
"\n\n",
"return",
"poolID",
",",
"nil",
"\n",
"}"
] |
15,075 | all-15076 | [
"MarshalJSON",
"supports",
"json",
".",
"Marshaler",
"interface"
] | [
"func",
"(",
"v",
"EvaluateReturns",
")",
"MarshalJSON",
"(",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"w",
":=",
"jwriter",
".",
"Writer",
"{",
"}",
"\n",
"easyjsonC5a4559bEncodeGithubComChromedpCdprotoRuntime37",
"(",
"&",
"w",
",",
"v",
")",
"\n",
"return",
"w",
".",
"Buffer",
".",
"BuildBytes",
"(",
")",
",",
"w",
".",
"<mask>",
"\n",
"}"
] |
15,076 | all-15077 | [
"Logout",
"removes",
"any",
"guest",
"operating",
"system",
"authentication",
"context",
"created",
"by",
"a",
"previous",
"call",
"to",
"VM",
".",
"LoginInGuest",
"()",
".",
"Remarks",
":",
"*",
"This",
"function",
"has",
"no",
"effect",
"and",
"returns",
"success",
"if",
"VM",
".",
"LoginInGuest",
"()",
"has",
"not",
"been",
"called",
".",
"*",
"If",
"you",
"call",
"this",
"function",
"while",
"guest",
"operations",
"are",
"in",
"progress",
"subsequent",
"operations",
"may",
"fail",
"with",
"a",
"permissions",
"error",
".",
"It",
"is",
"best",
"to",
"wait",
"for",
"guest",
"operations",
"to",
"complete",
"before",
"logging",
"out",
".",
"Since",
"VMware",
"Workstation",
"6",
".",
"0",
"Minimum",
"Supported",
"Guest",
"OS",
":",
"Microsoft",
"Windows",
"NT",
"Series",
"Linux"
] | [
"func",
"(",
"g",
"*",
"Guest",
")",
"Logout",
"(",
")",
"error",
"{",
"var",
"jobHandle",
"C",
".",
"VixHandle",
"=",
"C",
".",
"VIX_INVALID_HANDLE",
"\n",
"var",
"err",
"C",
".",
"VixError",
"=",
"C",
".",
"VIX_OK",
"\n\n",
"jobHandle",
"=",
"C",
".",
"VixVM_LogoutFromGuest",
"(",
"g",
".",
"<mask>",
",",
"nil",
",",
"// callbackProc",
"nil",
")",
"// clientData",
"\n\n",
"defer",
"C",
".",
"Vix_ReleaseHandle",
"(",
"jobHandle",
")",
"\n\n",
"err",
"=",
"C",
".",
"vix_job_wait",
"(",
"jobHandle",
")",
"\n",
"if",
"C",
".",
"VIX_OK",
"!=",
"err",
"{",
"return",
"&",
"Error",
"{",
"Operation",
":",
"\"",
"\"",
",",
"Code",
":",
"int",
"(",
"err",
"&",
"0xFFFF",
")",
",",
"Text",
":",
"C",
".",
"GoString",
"(",
"C",
".",
"Vix_GetErrorText",
"(",
"err",
",",
"nil",
")",
")",
",",
"}",
"\n",
"}",
"\n\n",
"return",
"nil",
"\n",
"}"
] |
15,077 | all-15078 | [
"UnmarshalJSON",
"supports",
"json",
".",
"Unmarshaler",
"interface"
] | [
"func",
"(",
"v",
"*",
"EventTargetCrashed",
")",
"UnmarshalJSON",
"(",
"data",
"[",
"]",
"byte",
")",
"error",
"{",
"r",
":=",
"jlexer",
".",
"Lexer",
"{",
"Data",
":",
"<mask>",
"}",
"\n",
"easyjsonC5a4559bDecodeGithubComChromedpCdprotoTarget16",
"(",
"&",
"r",
",",
"v",
")",
"\n",
"return",
"r",
".",
"Error",
"(",
")",
"\n",
"}"
] |
15,078 | all-15079 | [
"UnmarshalEasyJSON",
"satisfies",
"easyjson",
".",
"Unmarshaler",
"."
] | [
"func",
"(",
"t",
"*",
"Modifier",
")",
"UnmarshalEasyJSON",
"(",
"in",
"*",
"jlexer",
".",
"Lexer",
")",
"{",
"switch",
"Modifier",
"(",
"in",
".",
"Int64",
"(",
")",
")",
"{",
"case",
"ModifierNone",
":",
"*",
"t",
"=",
"ModifierNone",
"\n",
"case",
"ModifierAlt",
":",
"*",
"t",
"=",
"ModifierAlt",
"\n",
"case",
"ModifierCtrl",
":",
"*",
"t",
"=",
"ModifierCtrl",
"\n",
"case",
"ModifierMeta",
":",
"*",
"t",
"=",
"ModifierMeta",
"\n",
"<mask>",
"ModifierShift",
":",
"*",
"t",
"=",
"ModifierShift",
"\n\n",
"default",
":",
"in",
".",
"AddError",
"(",
"errors",
".",
"New",
"(",
"\"",
"\"",
")",
")",
"\n",
"}",
"\n",
"}"
] |
15,079 | all-15080 | [
"publish",
"registers",
"server",
"information",
"into",
"the",
"cluster",
".",
"The",
"information",
"is",
"the",
"JSON",
"representation",
"of",
"this",
"server",
"s",
"member",
"struct",
"updated",
"with",
"the",
"static",
"clientURLs",
"of",
"the",
"server",
".",
"The",
"function",
"keeps",
"attempting",
"to",
"register",
"until",
"it",
"succeeds",
"or",
"its",
"server",
"is",
"stopped",
"."
] | [
"func",
"(",
"s",
"*",
"EtcdServer",
")",
"publish",
"(",
"timeout",
"time",
".",
"Duration",
")",
"{",
"b",
",",
"err",
":=",
"json",
".",
"Marshal",
"(",
"s",
".",
"attributes",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"if",
"lg",
":=",
"s",
".",
"getLogger",
"(",
")",
";",
"lg",
"!=",
"nil",
"{",
"lg",
".",
"Panic",
"(",
"\"",
"\"",
",",
"zap",
".",
"Error",
"(",
"err",
")",
")",
"\n",
"}",
"else",
"{",
"plog",
".",
"Panicf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"}",
"\n",
"return",
"\n",
"}",
"\n",
"req",
":=",
"pb",
".",
"Request",
"{",
"Method",
":",
"\"",
"\"",
",",
"Path",
":",
"membership",
".",
"MemberAttributesStorePath",
"(",
"s",
".",
"id",
")",
",",
"Val",
":",
"string",
"(",
"b",
")",
",",
"}",
"\n\n",
"for",
"{",
"ctx",
",",
"cancel",
":=",
"context",
".",
"WithTimeout",
"(",
"s",
".",
"ctx",
",",
"timeout",
")",
"\n",
"_",
",",
"err",
":=",
"s",
".",
"Do",
"(",
"ctx",
",",
"req",
")",
"\n",
"cancel",
"(",
")",
"\n",
"switch",
"err",
"{",
"case",
"nil",
":",
"close",
"(",
"s",
".",
"readych",
")",
"\n",
"if",
"lg",
":=",
"s",
".",
"getLogger",
"(",
")",
";",
"lg",
"!=",
"nil",
"{",
"lg",
".",
"Info",
"(",
"\"",
"\"",
",",
"zap",
".",
"String",
"(",
"\"",
"\"",
",",
"s",
".",
"ID",
"(",
")",
".",
"String",
"(",
")",
")",
",",
"zap",
".",
"String",
"(",
"\"",
"\"",
",",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"s",
".",
"attributes",
")",
")",
",",
"zap",
".",
"String",
"(",
"\"",
"\"",
",",
"req",
".",
"Path",
")",
",",
"zap",
".",
"String",
"(",
"\"",
"\"",
",",
"s",
".",
"cluster",
".",
"ID",
"(",
")",
".",
"String",
"(",
")",
")",
",",
"zap",
".",
"Duration",
"(",
"\"",
"\"",
",",
"timeout",
")",
",",
")",
"\n",
"}",
"else",
"{",
"plog",
".",
"Infof",
"(",
"\"",
"\"",
",",
"s",
".",
"attributes",
",",
"s",
".",
"cluster",
".",
"<mask>",
"(",
")",
")",
"\n",
"}",
"\n",
"return",
"\n\n",
"case",
"ErrStopped",
":",
"if",
"lg",
":=",
"s",
".",
"getLogger",
"(",
")",
";",
"lg",
"!=",
"nil",
"{",
"lg",
".",
"Warn",
"(",
"\"",
"\"",
",",
"zap",
".",
"String",
"(",
"\"",
"\"",
",",
"s",
".",
"ID",
"(",
")",
".",
"String",
"(",
")",
")",
",",
"zap",
".",
"String",
"(",
"\"",
"\"",
",",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"s",
".",
"attributes",
")",
")",
",",
"zap",
".",
"Duration",
"(",
"\"",
"\"",
",",
"timeout",
")",
",",
"zap",
".",
"Error",
"(",
"err",
")",
",",
")",
"\n",
"}",
"else",
"{",
"plog",
".",
"Infof",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"return",
"\n\n",
"default",
":",
"if",
"lg",
":=",
"s",
".",
"getLogger",
"(",
")",
";",
"lg",
"!=",
"nil",
"{",
"lg",
".",
"Warn",
"(",
"\"",
"\"",
",",
"zap",
".",
"String",
"(",
"\"",
"\"",
",",
"s",
".",
"ID",
"(",
")",
".",
"String",
"(",
")",
")",
",",
"zap",
".",
"String",
"(",
"\"",
"\"",
",",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"s",
".",
"attributes",
")",
")",
",",
"zap",
".",
"String",
"(",
"\"",
"\"",
",",
"req",
".",
"Path",
")",
",",
"zap",
".",
"Duration",
"(",
"\"",
"\"",
",",
"timeout",
")",
",",
"zap",
".",
"Error",
"(",
"err",
")",
",",
")",
"\n",
"}",
"else",
"{",
"plog",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n",
"}"
] |
15,080 | all-15081 | [
"Specify",
"the",
"value",
"of",
"a",
"uniform",
"variable",
"for",
"a",
"specified",
"program",
"object"
] | [
"func",
"ProgramUniformMatrix3x2fv",
"(",
"program",
"uint32",
",",
"location",
"int32",
",",
"count",
"int32",
",",
"transpose",
"bool",
",",
"value",
"*",
"float32",
")",
"{",
"syscall",
".",
"Syscall6",
"(",
"gpProgramUniformMatrix3x2fv",
",",
"5",
",",
"uintptr",
"(",
"program",
")",
",",
"uintptr",
"(",
"location",
")",
",",
"uintptr",
"(",
"<mask>",
")",
",",
"boolToUintptr",
"(",
"transpose",
")",
",",
"uintptr",
"(",
"unsafe",
".",
"Pointer",
"(",
"value",
")",
")",
",",
"0",
")",
"\n",
"}"
] |
15,081 | all-15082 | [
"ptsname",
"retrieves",
"the",
"name",
"of",
"the",
"first",
"available",
"pts",
"for",
"the",
"given",
"master",
"."
] | [
"func",
"ptsname",
"(",
"f",
"*",
"os",
".",
"File",
")",
"(",
"string",
",",
"error",
")",
"{",
"<mask>",
"n",
"int32",
"\n",
"if",
"err",
":=",
"ioctl",
"(",
"f",
".",
"Fd",
"(",
")",
",",
"syscall",
".",
"TIOCGPTN",
",",
"uintptr",
"(",
"unsafe",
".",
"Pointer",
"(",
"&",
"n",
")",
")",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"\"",
"\"",
",",
"err",
"\n",
"}",
"\n",
"return",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"n",
")",
",",
"nil",
"\n",
"}"
] |
15,082 | all-15083 | [
"Properties",
"is",
"a",
"convenience",
"method",
"that",
"wraps",
"fetching",
"the",
"Datastore",
"MO",
"from",
"its",
"higher",
"-",
"level",
"object",
"."
] | [
"func",
"Properties",
"(",
"ds",
"*",
"object",
".",
"Datastore",
")",
"(",
"*",
"mo",
".",
"Datastore",
",",
"error",
")",
"{",
"ctx",
",",
"cancel",
":=",
"context",
".",
"WithTimeout",
"(",
"context",
".",
"Background",
"(",
")",
",",
"provider",
".",
"DefaultAPITimeout",
")",
"\n",
"defer",
"cancel",
"(",
")",
"\n",
"<mask>",
"props",
"mo",
".",
"Datastore",
"\n",
"if",
"err",
":=",
"ds",
".",
"Properties",
"(",
"ctx",
",",
"ds",
".",
"Reference",
"(",
")",
",",
"nil",
",",
"&",
"props",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"return",
"&",
"props",
",",
"nil",
"\n",
"}"
] |
15,083 | all-15084 | [
"From",
"committed",
"entryc",
"back",
"to",
"public",
"API",
"method",
".",
"etcdserver",
"/",
"v3demo_server",
".",
"go",
"applyV3Result"
] | [
"func",
"(",
"s",
"*",
"etcdStore",
")",
"applyInternalRaftRequest",
"(",
"req",
"etcdserverpb",
".",
"InternalRaftRequest",
")",
"(",
"proto",
".",
"Message",
",",
"error",
")",
"{",
"switch",
"{",
"case",
"req",
".",
"Range",
"!=",
"nil",
":",
"return",
"applyRange",
"(",
"noTxn",
",",
"s",
".",
"kv",
",",
"req",
".",
"Range",
")",
"\n",
"case",
"req",
".",
"Put",
"!=",
"nil",
":",
"return",
"applyPut",
"(",
"noTxn",
",",
"s",
".",
"kv",
",",
"s",
".",
"lessor",
",",
"req",
".",
"Put",
")",
"\n",
"case",
"req",
".",
"DeleteRange",
"!=",
"nil",
":",
"return",
"applyDeleteRange",
"(",
"noTxn",
",",
"s",
".",
"kv",
",",
"req",
".",
"DeleteRange",
")",
"\n",
"case",
"req",
".",
"Txn",
"!=",
"nil",
":",
"return",
"applyTransaction",
"(",
"s",
".",
"kv",
",",
"s",
".",
"lessor",
",",
"req",
".",
"Txn",
")",
"\n",
"case",
"req",
".",
"Compaction",
"!=",
"nil",
":",
"return",
"applyCompaction",
"(",
"s",
".",
"kv",
",",
"req",
".",
"Compaction",
")",
"\n",
"case",
"req",
".",
"LeaseGrant",
"!=",
"nil",
":",
"return",
"applyLeaseGrant",
"(",
"s",
".",
"lessor",
",",
"req",
".",
"LeaseGrant",
")",
"\n",
"case",
"req",
".",
"LeaseRevoke",
"!=",
"nil",
":",
"return",
"applyLeaseRevoke",
"(",
"s",
".",
"lessor",
",",
"req",
".",
"LeaseRevoke",
")",
"\n",
"<mask>",
":",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"}"
] |
15,084 | all-15085 | [
"GetTitleSizeOk",
"returns",
"a",
"tuple",
"with",
"the",
"TitleSize",
"field",
"if",
"it",
"s",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"and",
"a",
"boolean",
"to",
"check",
"if",
"the",
"value",
"has",
"been",
"set",
"."
] | [
"func",
"(",
"q",
"*",
"QueryValueDefinition",
")",
"GetTitleSizeOk",
"(",
")",
"(",
"string",
",",
"bool",
")",
"{",
"if",
"q",
"==",
"nil",
"||",
"q",
".",
"TitleSize",
"==",
"nil",
"{",
"return",
"\"",
"\"",
",",
"false",
"\n",
"}",
"\n",
"return",
"*",
"q",
".",
"TitleSize",
",",
"<mask>",
"\n",
"}"
] |
15,085 | all-15086 | [
"RangeStart",
"specifies",
"the",
"start",
"of",
"a",
"range",
"within",
"the",
"byte",
"stream",
"that",
"is",
"meaningful",
"to",
"the",
"caller",
".",
"When",
"this",
"range",
"has",
"ended",
"(",
"by",
"calling",
"RangeStart",
"again",
"or",
"Close",
")",
"and",
"all",
"of",
"the",
"necessary",
"chunks",
"are",
"written",
"the",
"callback",
"given",
"during",
"initialization",
"will",
"be",
"called",
"with",
"DataRefs",
"that",
"can",
"be",
"used",
"for",
"accessing",
"that",
"range",
"."
] | [
"func",
"(",
"w",
"*",
"Writer",
")",
"RangeStart",
"(",
"cb",
"func",
"(",
"[",
"]",
"*",
"DataRef",
")",
"error",
")",
"{",
"// Finish prior range.",
"if",
"w",
".",
"dataRefs",
"!=",
"nil",
"{",
"w",
".",
"rangeFinish",
"(",
")",
"\n",
"}",
"\n",
"// Start new range.",
"w",
".",
"cbs",
"=",
"<mask>",
"(",
"w",
".",
"cbs",
",",
"cb",
")",
"\n",
"w",
".",
"dataRefs",
"=",
"[",
"]",
"*",
"DataRef",
"{",
"&",
"DataRef",
"{",
"OffsetBytes",
":",
"int64",
"(",
"w",
".",
"buf",
".",
"Len",
"(",
")",
")",
"}",
"}",
"\n",
"w",
".",
"rangeSize",
"=",
"0",
"\n",
"w",
".",
"rangeCount",
"++",
"\n",
"}"
] |
15,086 | all-15087 | [
"Plugins",
"constantly",
"wait",
"for",
"new",
"issues",
"/",
"events",
"/",
"comments"
] | [
"func",
"(",
"config",
"*",
"transformConfig",
")",
"<mask>",
"(",
"plugin",
"plugins",
".",
"Plugin",
")",
"error",
"{",
"if",
"err",
":=",
"config",
".",
"CheckRootFlags",
"(",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"mysqldb",
",",
"err",
":=",
"config",
".",
"MySQLConfig",
".",
"CreateDatabase",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"influxdb",
",",
"err",
":=",
"config",
".",
"InfluxConfig",
".",
"CreateDatabase",
"(",
"map",
"[",
"string",
"]",
"string",
"{",
"\"",
"\"",
":",
"config",
".",
"repository",
"}",
",",
"config",
".",
"metricName",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"fetcher",
":=",
"NewFetcher",
"(",
"config",
".",
"repository",
")",
"\n\n",
"// Plugins constantly wait for new issues/events/comments",
"go",
"Dispatch",
"(",
"plugin",
",",
"influxdb",
",",
"fetcher",
".",
"IssuesChannel",
",",
"fetcher",
".",
"EventsCommentsChannel",
")",
"\n\n",
"ticker",
":=",
"time",
".",
"Tick",
"(",
"time",
".",
"Hour",
"/",
"time",
".",
"Duration",
"(",
"config",
".",
"frequency",
")",
")",
"\n",
"for",
"{",
"// Fetch new events from MySQL, push it to plugins",
"if",
"err",
":=",
"fetcher",
".",
"Fetch",
"(",
"mysqldb",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"if",
"err",
":=",
"influxdb",
".",
"PushBatchPoints",
"(",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"if",
"config",
".",
"once",
"{",
"break",
"\n",
"}",
"\n",
"<-",
"ticker",
"\n",
"}",
"\n\n",
"return",
"nil",
"\n",
"}"
] |
15,087 | all-15088 | [
"HasToTs",
"returns",
"a",
"boolean",
"if",
"a",
"field",
"has",
"been",
"set",
"."
] | [
"func",
"(",
"t",
"*",
"TriggeringValue",
")",
"HasToTs",
"(",
")",
"bool",
"{",
"if",
"t",
"!=",
"nil",
"&&",
"t",
".",
"ToTs",
"!=",
"nil",
"{",
"return",
"true",
"\n",
"}",
"\n\n",
"return",
"<mask>",
"\n",
"}"
] |
15,088 | all-15089 | [
"Frame",
"returns",
"the",
"frame",
"number",
"value",
"for",
"a",
"given",
"index",
"into",
"the",
"frame",
"set",
".",
"If",
"the",
"index",
"is",
"outside",
"the",
"bounds",
"of",
"the",
"frame",
"set",
"range",
"then",
"an",
"error",
"is",
"returned",
"."
] | [
"func",
"(",
"s",
"*",
"FrameSet",
")",
"Frame",
"(",
"index",
"int",
")",
"(",
"int",
",",
"error",
")",
"{",
"return",
"s",
".",
"rangePtr",
".",
"<mask>",
"(",
"index",
")",
"\n",
"}"
] |
15,089 | all-15090 | [
"ListSecretVersionIdsPagesWithContext",
"mocks",
"base",
"method"
] | [
"func",
"(",
"m",
"*",
"MockSecretsManagerAPI",
")",
"ListSecretVersionIdsPagesWithContext",
"(",
"arg0",
"aws",
".",
"Context",
",",
"arg1",
"*",
"secretsmanager",
".",
"ListSecretVersionIdsInput",
",",
"arg2",
"func",
"(",
"*",
"secretsmanager",
".",
"ListSecretVersionIdsOutput",
",",
"bool",
")",
"bool",
",",
"arg3",
"...",
"<mask>",
".",
"Option",
")",
"error",
"{",
"varargs",
":=",
"[",
"]",
"interface",
"{",
"}",
"{",
"arg0",
",",
"arg1",
",",
"arg2",
"}",
"\n",
"for",
"_",
",",
"a",
":=",
"range",
"arg3",
"{",
"varargs",
"=",
"append",
"(",
"varargs",
",",
"a",
")",
"\n",
"}",
"\n",
"ret",
":=",
"m",
".",
"ctrl",
".",
"Call",
"(",
"m",
",",
"\"",
"\"",
",",
"varargs",
"...",
")",
"\n",
"ret0",
",",
"_",
":=",
"ret",
"[",
"0",
"]",
".",
"(",
"error",
")",
"\n",
"return",
"ret0",
"\n",
"}"
] |
15,090 | all-15091 | [
"Locator",
"returns",
"a",
"locator",
"for",
"the",
"given",
"resource"
] | [
"func",
"(",
"r",
"*",
"ServerTemplateMultiCloudImage",
")",
"Locator",
"(",
"api",
"*",
"API",
")",
"*",
"ServerTemplateMultiCloudImageLocator",
"{",
"for",
"_",
",",
"l",
":=",
"<mask>",
"r",
".",
"Links",
"{",
"if",
"l",
"[",
"\"",
"\"",
"]",
"==",
"\"",
"\"",
"{",
"return",
"api",
".",
"ServerTemplateMultiCloudImageLocator",
"(",
"l",
"[",
"\"",
"\"",
"]",
")",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
] |
15,091 | all-15092 | [
"GetText",
"returns",
"the",
"Text",
"field",
"if",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"."
] | [
"func",
"(",
"p",
"*",
"Params",
")",
"GetText",
"(",
")",
"string",
"{",
"if",
"p",
"==",
"nil",
"||",
"p",
".",
"<mask>",
"==",
"nil",
"{",
"return",
"\"",
"\"",
"\n",
"}",
"\n",
"return",
"*",
"p",
".",
"Text",
"\n",
"}"
] |
15,092 | all-15093 | [
"WithTemplateFromStrings",
"adds",
"a",
"template",
"parsed",
"from",
"string",
"."
] | [
"func",
"WithTemplateFromStrings",
"(",
"<mask>",
"string",
",",
"strings",
"...",
"string",
")",
"Option",
"{",
"return",
"func",
"(",
"o",
"*",
"Options",
")",
"{",
"o",
".",
"strings",
"[",
"name",
"]",
"=",
"strings",
"}",
"\n",
"}"
] |
15,093 | all-15094 | [
"GetKnownStatusTime",
"gets",
"the",
"KnownStatusTime",
"of",
"the",
"task"
] | [
"func",
"(",
"<mask>",
"*",
"Task",
")",
"GetKnownStatusTime",
"(",
")",
"time",
".",
"Time",
"{",
"task",
".",
"lock",
".",
"RLock",
"(",
")",
"\n",
"defer",
"task",
".",
"lock",
".",
"RUnlock",
"(",
")",
"\n\n",
"return",
"task",
".",
"KnownStatusTimeUnsafe",
"\n",
"}"
] |
15,094 | all-15095 | [
"GetPathParts",
"returns",
"the",
"absolute",
"directory",
"path",
"the",
"file",
"name",
"and",
"the",
"absolute",
"path",
"of",
"the",
"provided",
"path",
"string",
"."
] | [
"func",
"GetPathParts",
"(",
"path",
"string",
")",
"(",
"dirPath",
",",
"fileName",
",",
"absPath",
"string",
")",
"{",
"lookup",
",",
"lookupErr",
":=",
"exec",
".",
"LookPath",
"(",
"<mask>",
")",
"\n",
"if",
"lookupErr",
"==",
"nil",
"{",
"path",
"=",
"lookup",
"\n",
"}",
"\n",
"absPath",
",",
"_",
"=",
"filepath",
".",
"Abs",
"(",
"path",
")",
"\n",
"dirPath",
"=",
"filepath",
".",
"Dir",
"(",
"absPath",
")",
"\n",
"fileName",
"=",
"filepath",
".",
"Base",
"(",
"absPath",
")",
"\n",
"return",
"\n",
"}"
] |
15,095 | all-15096 | [
"activationState",
"returns",
"none",
"if",
"auth",
"is",
"totally",
"inactive",
"partial",
"if",
"auth",
".",
"Activate",
"has",
"been",
"called",
"but",
"hasn",
"t",
"finished",
"or",
"failed",
"and",
"full",
"if",
"auth",
".",
"Activate",
"has",
"been",
"called",
"and",
"succeeded",
".",
"When",
"the",
"activation",
"state",
"is",
"partial",
"users",
"cannot",
"authenticate",
";",
"the",
"only",
"functioning",
"auth",
"API",
"calls",
"are",
"Activate",
"()",
"(",
"to",
"retry",
"activation",
")",
"and",
"Deactivate",
"()",
"(",
"to",
"give",
"up",
"and",
"revert",
"to",
"the",
"none",
"state",
")"
] | [
"func",
"(",
"a",
"*",
"apiServer",
")",
"activationState",
"(",
")",
"activationState",
"{",
"a",
".",
"adminMu",
".",
"Lock",
"(",
")",
"\n",
"defer",
"a",
".",
"adminMu",
".",
"Unlock",
"(",
")",
"\n",
"if",
"len",
"(",
"a",
".",
"adminCache",
")",
"==",
"0",
"{",
"return",
"none",
"\n",
"}",
"\n",
"if",
"_",
",",
"magicUserIsAdmin",
":=",
"a",
".",
"adminCache",
"[",
"magicUser",
"]",
";",
"magicUserIsAdmin",
"{",
"return",
"<mask>",
"\n",
"}",
"\n",
"return",
"full",
"\n",
"}"
] |
15,096 | all-15097 | [
"TraceGeneric",
"adds",
"a",
"generic",
"segment",
"to",
"the",
"newrelic",
"transaction",
"if",
"one",
"exists",
"in",
"the",
"context",
"."
] | [
"func",
"TraceGeneric",
"(",
"ctx",
"context",
".",
"Context",
",",
"<mask>",
"string",
")",
"*",
"Trace",
"{",
"return",
"trace",
"(",
"ctx",
",",
"name",
",",
"func",
"(",
"tx",
"Tx",
")",
"error",
"{",
"return",
"tx",
".",
"StartGeneric",
"(",
"name",
")",
"\n",
"}",
")",
"\n",
"}"
] |
15,097 | all-15098 | [
"Retry",
"wraps",
"a",
"function",
"that",
"interacts",
"with",
"the",
"database",
"and",
"retries",
"it",
"in",
"case",
"a",
"transient",
"error",
"is",
"hit",
".",
"This",
"should",
"by",
"typically",
"used",
"to",
"wrap",
"transactions",
"."
] | [
"func",
"Retry",
"(",
"f",
"func",
"(",
")",
"error",
")",
"error",
"{",
"// TODO: the retry loop should be configurable.",
"var",
"err",
"error",
"\n",
"for",
"i",
":=",
"0",
";",
"i",
"<",
"5",
";",
"i",
"++",
"{",
"err",
"=",
"f",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"logger",
".",
"Debugf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n\n",
"if",
"IsRetriableError",
"(",
"err",
")",
"{",
"logger",
".",
"Debugf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"time",
".",
"Sleep",
"(",
"250",
"*",
"time",
".",
"Millisecond",
")",
"\n",
"<mask>",
"\n",
"}",
"\n",
"}",
"\n",
"break",
"\n",
"}",
"\n",
"return",
"err",
"\n",
"}"
] |
15,098 | all-15099 | [
"Text",
"returns",
"the",
"entirety",
"of",
"the",
"text",
"content",
"for",
"exactly",
"one",
"element",
"."
] | [
"func",
"(",
"s",
"*",
"Selection",
")",
"Text",
"(",
")",
"(",
"string",
",",
"error",
")",
"{",
"selectedElement",
",",
"err",
":=",
"s",
".",
"elements",
".",
"GetExactlyOne",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"\"",
"\"",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"s",
",",
"err",
")",
"\n",
"}",
"\n\n",
"text",
",",
"err",
":=",
"selectedElement",
".",
"GetText",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"\"",
"\"",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"s",
",",
"err",
")",
"\n",
"}",
"\n",
"return",
"<mask>",
",",
"nil",
"\n",
"}"
] |
15,099 | all-15100 | [
"resourceVSphereVAppContainerReadTags",
"reads",
"the",
"tags",
"for",
"vsphere_vapp_container",
"."
] | [
"func",
"resourceVSphereVAppContainerReadTags",
"(",
"d",
"*",
"schema",
".",
"ResourceData",
",",
"meta",
"interface",
"{",
"}",
",",
"va",
"*",
"object",
".",
"VirtualApp",
")",
"error",
"{",
"if",
"tagsClient",
",",
"_",
":=",
"meta",
".",
"(",
"*",
"VSphereClient",
")",
".",
"TagsClient",
"(",
")",
";",
"tagsClient",
"!=",
"nil",
"{",
"log",
".",
"Printf",
"(",
"\"",
"\"",
",",
"resourceVSphereVAppContainerIDString",
"(",
"d",
")",
")",
"\n",
"if",
"err",
":=",
"readTagsForResource",
"(",
"tagsClient",
",",
"va",
",",
"d",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"}",
"else",
"{",
"<mask>",
".",
"Printf",
"(",
"\"",
"\"",
",",
"resourceVSphereVAppContainerIDString",
"(",
"d",
")",
")",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.