id
int32 0
25.3k
| idx
stringlengths 5
9
| nl_tokens
sequencelengths 1
418
| pl_tokens
sequencelengths 22
4.98k
|
---|---|---|---|
24,400 | all-24401 | [
"root",
"returns",
"the",
"furthest",
"ancestor",
"of",
"a",
"key",
"which",
"may",
"be",
"itself",
"."
] | [
"func",
"(",
"k",
"*",
"Key",
")",
"root",
"(",
")",
"*",
"Key",
"{",
"for",
"k",
".",
"<mask>",
"!=",
"nil",
"{",
"k",
"=",
"k",
".",
"parent",
"\n",
"}",
"\n",
"return",
"k",
"\n",
"}"
] |
24,401 | all-24402 | [
"UnmarshalJSON",
"supports",
"json",
".",
"Unmarshaler",
"interface"
] | [
"func",
"(",
"v",
"*",
"ScreencastFrameAckParams",
")",
"UnmarshalJSON",
"(",
"data",
"[",
"]",
"byte",
")",
"error",
"{",
"r",
":=",
"jlexer",
".",
"Lexer",
"{",
"Data",
":",
"<mask>",
"}",
"\n",
"easyjsonC5a4559bDecodeGithubComChromedpCdprotoPage18",
"(",
"&",
"r",
",",
"v",
")",
"\n",
"return",
"r",
".",
"Error",
"(",
")",
"\n",
"}"
] |
24,402 | all-24403 | [
"Verify",
"verifies",
"the",
"signature",
"sig",
"against",
"using",
"pub",
"hash",
"and",
"the",
"hashed",
"data",
"."
] | [
"func",
"(",
"r",
"RSAMethod",
")",
"Verify",
"(",
"pub",
"*",
"rsa",
".",
"PublicKey",
",",
"hash",
"crypto",
".",
"Hash",
",",
"hashed",
"[",
"]",
"byte",
",",
"sig",
"[",
"]",
"byte",
")",
"error",
"{",
"return",
"r",
".",
"VerifyFunc",
"(",
"pub",
",",
"<mask>",
",",
"hashed",
",",
"sig",
")",
"\n",
"}"
] |
24,403 | all-24404 | [
"Run",
"is",
"used",
"to",
"scan",
"hosts",
".",
"The",
"Scan",
"object",
"should",
"be",
"configured",
"using",
"specified",
"Add",
"*",
"Set",
"*",
"functions",
".",
"BUG",
"(",
"t94j0",
")",
":",
"The",
"scan",
"will",
"sometimes",
"segfault",
"and",
"theres",
"no",
"reason",
"why"
] | [
"func",
"(",
"s",
"Scan",
")",
"Run",
"(",
")",
"(",
"output",
"Scan",
",",
"err",
"error",
")",
"{",
"if",
"s",
".",
"configErr",
"!=",
"nil",
"{",
"return",
"s",
",",
"s",
".",
"configErr",
"\n",
"}",
"\n\n",
"args",
",",
"err",
":=",
"s",
".",
"CreateNmapArgs",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"s",
",",
"err",
"\n",
"}",
"\n\n",
"// Find path for nmap binary",
"nmapPath",
",",
"err",
":=",
"exec",
".",
"LookPath",
"(",
"\"",
"\"",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"s",
",",
"err",
"\n",
"}",
"\n\n",
"cmd",
":=",
"exec",
".",
"Command",
"(",
"nmapPath",
",",
"args",
"...",
")",
"\n\n",
"// Configure output pipes",
"errPipe",
",",
"err",
":=",
"cmd",
".",
"StderrPipe",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"s",
",",
"err",
"\n",
"}",
"\n\n",
"outPipe",
",",
"err",
":=",
"cmd",
".",
"StdoutPipe",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"s",
",",
"err",
"\n",
"}",
"\n\n",
"// Start command",
"if",
"err",
":=",
"cmd",
".",
"Start",
"(",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"s",
",",
"err",
"\n",
"}",
"\n\n",
"// Read output",
"stdout",
",",
"err",
":=",
"ioutil",
".",
"ReadAll",
"(",
"outPipe",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"s",
",",
"err",
"\n",
"}",
"\n\n",
"stderr",
",",
"err",
":=",
"ioutil",
".",
"ReadAll",
"(",
"errPipe",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"s",
",",
"err",
"\n",
"}",
"\n\n",
"// Wait on command to be finished",
"if",
"err",
":=",
"cmd",
".",
"Wait",
"(",
")",
";",
"err",
"!=",
"nil",
"{",
"fmt",
".",
"Println",
"(",
"err",
")",
"\n",
"return",
"s",
",",
"<mask>",
".",
"New",
"(",
"err",
".",
"Error",
"(",
")",
"+",
"\"",
"\\n",
"\"",
"+",
"string",
"(",
"stderr",
")",
")",
"\n",
"}",
"\n\n",
"// Parse command output",
"rawScan",
",",
"err",
":=",
"parseXML",
"(",
"stdout",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"s",
",",
"err",
"\n",
"}",
"\n\n",
"scan",
":=",
"rawScan",
".",
"cleanScan",
"(",
"s",
")",
"\n\n",
"return",
"scan",
",",
"nil",
"\n",
"}"
] |
24,404 | all-24405 | [
"GetProgramName",
"is",
"a",
"wrapper",
"around",
"gtk_about_dialog_get_program_name",
"()",
"."
] | [
"func",
"(",
"v",
"*",
"AboutDialog",
")",
"GetProgramName",
"(",
")",
"string",
"{",
"c",
":=",
"C",
".",
"gtk_about_dialog_get_program_name",
"(",
"v",
".",
"native",
"(",
")",
")",
"\n",
"return",
"C",
".",
"GoString",
"(",
"(",
"*",
"C",
".",
"<mask>",
")",
"(",
"c",
")",
")",
"\n",
"}"
] |
24,405 | all-24406 | [
"MoveLeader",
"transfers",
"the",
"leader",
"to",
"the",
"given",
"transferee",
"."
] | [
"func",
"(",
"s",
"*",
"EtcdServer",
")",
"MoveLeader",
"(",
"ctx",
"context",
".",
"Context",
",",
"lead",
",",
"transferee",
"uint64",
")",
"error",
"{",
"now",
":=",
"time",
".",
"Now",
"(",
")",
"\n",
"interval",
":=",
"time",
".",
"Duration",
"(",
"s",
".",
"Cfg",
".",
"TickMs",
")",
"*",
"time",
".",
"Millisecond",
"\n\n",
"if",
"lg",
":=",
"s",
".",
"getLogger",
"(",
")",
";",
"lg",
"!=",
"nil",
"{",
"lg",
".",
"Info",
"(",
"\"",
"\"",
",",
"zap",
".",
"String",
"(",
"\"",
"\"",
",",
"s",
".",
"ID",
"(",
")",
".",
"String",
"(",
")",
")",
",",
"zap",
".",
"String",
"(",
"\"",
"\"",
",",
"types",
".",
"ID",
"(",
"lead",
")",
".",
"String",
"(",
")",
")",
",",
"zap",
".",
"String",
"(",
"\"",
"\"",
",",
"types",
".",
"ID",
"(",
"transferee",
")",
".",
"String",
"(",
")",
")",
",",
")",
"\n",
"}",
"else",
"{",
"plog",
".",
"Infof",
"(",
"\"",
"\"",
",",
"s",
".",
"ID",
"(",
")",
",",
"types",
".",
"ID",
"(",
"lead",
")",
",",
"types",
".",
"<mask>",
"(",
"transferee",
")",
")",
"\n",
"}",
"\n\n",
"s",
".",
"r",
".",
"TransferLeadership",
"(",
"ctx",
",",
"lead",
",",
"transferee",
")",
"\n",
"for",
"s",
".",
"Lead",
"(",
")",
"!=",
"transferee",
"{",
"select",
"{",
"case",
"<-",
"ctx",
".",
"Done",
"(",
")",
":",
"// time out",
"return",
"ErrTimeoutLeaderTransfer",
"\n",
"case",
"<-",
"time",
".",
"After",
"(",
"interval",
")",
":",
"}",
"\n",
"}",
"\n\n",
"// TODO: drain all requests, or drop all messages to the old leader",
"if",
"lg",
":=",
"s",
".",
"getLogger",
"(",
")",
";",
"lg",
"!=",
"nil",
"{",
"lg",
".",
"Info",
"(",
"\"",
"\"",
",",
"zap",
".",
"String",
"(",
"\"",
"\"",
",",
"s",
".",
"ID",
"(",
")",
".",
"String",
"(",
")",
")",
",",
"zap",
".",
"String",
"(",
"\"",
"\"",
",",
"types",
".",
"ID",
"(",
"lead",
")",
".",
"String",
"(",
")",
")",
",",
"zap",
".",
"String",
"(",
"\"",
"\"",
",",
"types",
".",
"ID",
"(",
"transferee",
")",
".",
"String",
"(",
")",
")",
",",
"zap",
".",
"Duration",
"(",
"\"",
"\"",
",",
"time",
".",
"Since",
"(",
"now",
")",
")",
",",
")",
"\n",
"}",
"else",
"{",
"plog",
".",
"Infof",
"(",
"\"",
"\"",
",",
"s",
".",
"ID",
"(",
")",
",",
"types",
".",
"ID",
"(",
"lead",
")",
",",
"types",
".",
"ID",
"(",
"transferee",
")",
",",
"time",
".",
"Since",
"(",
"now",
")",
")",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
] |
24,406 | all-24407 | [
"New",
"http",
".",
"StatusInternalServerError"
] | [
"func",
"(",
"e",
"*",
"coreError",
")",
"New",
"(",
"errno",
"int",
",",
"message",
"string",
")",
"*",
"coreError",
"{",
"e",
".",
"HTTPCode",
"=",
"<mask>",
".",
"StatusInternalServerError",
"\n",
"e",
".",
"Errno",
"=",
"errno",
"\n",
"e",
".",
"Message",
"=",
"message",
"\n",
"return",
"e",
"\n",
"}"
] |
24,407 | all-24408 | [
"Route",
"creates",
"a",
"new",
"Mux",
"with",
"a",
"fresh",
"middleware",
"stack",
"and",
"mounts",
"it",
"along",
"the",
"pattern",
"as",
"a",
"subrouter",
".",
"Effectively",
"this",
"is",
"a",
"short",
"-",
"hand",
"call",
"to",
"Mount",
".",
"See",
"_examples",
"/",
"."
] | [
"func",
"(",
"mx",
"*",
"Mux",
")",
"<mask>",
"(",
"pattern",
"string",
",",
"fn",
"func",
"(",
"r",
"Router",
")",
")",
"Router",
"{",
"subRouter",
":=",
"NewRouter",
"(",
")",
"\n",
"if",
"fn",
"!=",
"nil",
"{",
"fn",
"(",
"subRouter",
")",
"\n",
"}",
"\n",
"mx",
".",
"Mount",
"(",
"pattern",
",",
"subRouter",
")",
"\n",
"return",
"subRouter",
"\n",
"}"
] |
24,408 | all-24409 | [
"WithDeployment",
"adds",
"the",
"deployment",
"to",
"the",
"find",
"vms",
"by",
"deployment",
"params"
] | [
"func",
"(",
"o",
"*",
"FindVmsByDeploymentParams",
")",
"WithDeployment",
"(",
"deployment",
"[",
"]",
"<mask>",
")",
"*",
"FindVmsByDeploymentParams",
"{",
"o",
".",
"SetDeployment",
"(",
"deployment",
")",
"\n",
"return",
"o",
"\n",
"}"
] |
24,409 | all-24410 | [
"NewJobSpec",
"converts",
"a",
"prowapi",
".",
"ProwJobSpec",
"invocation",
"into",
"a",
"JobSpec"
] | [
"func",
"NewJobSpec",
"(",
"spec",
"prowapi",
".",
"ProwJobSpec",
",",
"buildID",
",",
"prowJobID",
"string",
")",
"JobSpec",
"{",
"return",
"JobSpec",
"{",
"Type",
":",
"spec",
".",
"Type",
",",
"Job",
":",
"spec",
".",
"Job",
",",
"BuildID",
":",
"buildID",
",",
"ProwJobID",
":",
"prowJobID",
",",
"Refs",
":",
"spec",
".",
"Refs",
",",
"ExtraRefs",
":",
"spec",
".",
"ExtraRefs",
",",
"agent",
":",
"spec",
".",
"<mask>",
",",
"}",
"\n",
"}"
] |
24,410 | all-24411 | [
"And",
"adds",
"AND",
"operator",
"to",
"the",
"Condition",
"and",
"returns",
"it",
"for",
"method",
"chain",
"."
] | [
"func",
"(",
"c",
"*",
"Condition",
")",
"And",
"(",
"cond",
"<mask>",
"{",
"}",
",",
"args",
"...",
"interface",
"{",
"}",
")",
"*",
"Condition",
"{",
"return",
"c",
".",
"appendQueryByCondOrExpr",
"(",
"\"",
"\"",
",",
"100",
",",
"And",
",",
"cond",
",",
"args",
"...",
")",
"\n",
"}"
] |
24,411 | all-24412 | [
"Reset",
"is",
"a",
"wrapper",
"around",
"g_settings_reset",
"()",
"."
] | [
"func",
"(",
"v",
"*",
"Settings",
")",
"Reset",
"(",
"name",
"string",
")",
"{",
"cstr1",
":=",
"(",
"*",
"C",
".",
"gchar",
")",
"(",
"C",
".",
"CString",
"(",
"name",
")",
")",
"\n",
"defer",
"C",
".",
"<mask>",
"(",
"unsafe",
".",
"Pointer",
"(",
"cstr1",
")",
")",
"\n\n",
"C",
".",
"g_settings_reset",
"(",
"v",
".",
"native",
"(",
")",
",",
"cstr1",
")",
"\n",
"}"
] |
24,412 | all-24413 | [
"GetResource",
"returns",
"the",
"Resource",
"field",
"if",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"."
] | [
"func",
"(",
"e",
"*",
"<mask>",
")",
"GetResource",
"(",
")",
"string",
"{",
"if",
"e",
"==",
"nil",
"||",
"e",
".",
"Resource",
"==",
"nil",
"{",
"return",
"\"",
"\"",
"\n",
"}",
"\n",
"return",
"*",
"e",
".",
"Resource",
"\n",
"}"
] |
24,413 | all-24414 | [
"logs",
"a",
"sequence",
"of",
"symbols",
"(",
"one",
"for",
"each",
"tick",
")",
"indicating",
"task",
"activity",
"until",
"a",
"quit",
"is",
"received"
] | [
"func",
"logActivity",
"(",
"symbol",
"string",
",",
"logger",
"logger",
".",
"Logger",
",",
"ticker",
"*",
"time",
".",
"Ticker",
",",
"quitCh",
"<-",
"chan",
"bool",
")",
"{",
"go",
"func",
"(",
")",
"{",
"for",
"{",
"<mask>",
"{",
"case",
"<-",
"ticker",
".",
"C",
":",
"logger",
"(",
"symbol",
")",
"\n",
"case",
"<-",
"quitCh",
":",
"ticker",
".",
"Stop",
"(",
")",
"\n",
"return",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"(",
")",
"\n",
"}"
] |
24,414 | all-24415 | [
"AuthClient",
"verifies",
"password",
"for",
"a",
"given",
"client",
"key",
"."
] | [
"func",
"(",
"h",
"*",
"Handler",
")",
"AuthClient",
"(",
"product",
",",
"productPassword",
",",
"clientKey",
",",
"clientPassword",
"string",
")",
"error",
"{",
"logger",
":=",
"h",
".",
"logger",
".",
"Add",
"(",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"product",
",",
"\"",
"\"",
",",
"clientKey",
")",
"\n\n",
"logger",
".",
"Info",
"(",
"\"",
"\"",
")",
"\n\n",
"prod",
",",
"err",
":=",
"h",
".",
"checkProductPassword",
"(",
"logger",
",",
"product",
",",
"productPassword",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"ch",
",",
"err",
":=",
"h",
".",
"findClientChannel",
"(",
"logger",
",",
"prod",
",",
"clientKey",
",",
"<mask>",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"err",
"=",
"data",
".",
"ValidatePassword",
"(",
"ch",
".",
"Password",
",",
"clientPassword",
",",
"string",
"(",
"ch",
".",
"Salt",
")",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"logger",
".",
"Warn",
"(",
"\"",
"\"",
"+",
"err",
".",
"Error",
"(",
")",
")",
"\n",
"return",
"ErrBadClientPassword",
"\n",
"}",
"\n\n",
"return",
"nil",
"\n",
"}"
] |
24,415 | all-24416 | [
"OnGossipUnicast",
"implements",
"Gossiper",
"but",
"always",
"returns",
"an",
"error",
"as",
"a",
"router",
"should",
"only",
"receive",
"gossip",
"broadcasts",
"of",
"TopologyGossipData",
"."
] | [
"func",
"(",
"router",
"*",
"Router",
")",
"OnGossipUnicast",
"(",
"sender",
"PeerName",
",",
"msg",
"[",
"]",
"<mask>",
")",
"error",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"msg",
")",
"\n",
"}"
] |
24,416 | all-24417 | [
"NewCloudConfigManifest",
"-",
"initialize",
"a",
"cloudconfigmanifest",
"object",
"with",
"a",
"[]",
"byte"
] | [
"func",
"NewCloudConfigManifest",
"(",
"b",
"[",
"]",
"<mask>",
")",
"*",
"CloudConfigManifest",
"{",
"cm",
":=",
"new",
"(",
"CloudConfigManifest",
")",
"\n",
"yaml",
".",
"Unmarshal",
"(",
"b",
",",
"cm",
")",
"\n",
"return",
"cm",
"\n",
"}"
] |
24,417 | all-24418 | [
"sync",
"extracts",
"a",
"deduplicated",
"set",
"of",
"Alertmanager",
"endpoints",
"from",
"a",
"list",
"of",
"target",
"groups",
"definitions",
"."
] | [
"func",
"(",
"s",
"*",
"alertmanagerSet",
")",
"sync",
"(",
"tgs",
"[",
"]",
"*",
"targetgroup",
".",
"Group",
")",
"{",
"allAms",
":=",
"[",
"]",
"alertmanager",
"{",
"}",
"\n",
"allDroppedAms",
":=",
"[",
"]",
"alertmanager",
"{",
"}",
"\n\n",
"for",
"_",
",",
"tg",
":=",
"<mask>",
"tgs",
"{",
"ams",
",",
"droppedAms",
",",
"err",
":=",
"alertmanagerFromGroup",
"(",
"tg",
",",
"s",
".",
"cfg",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"level",
".",
"Error",
"(",
"s",
".",
"logger",
")",
".",
"Log",
"(",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"err",
")",
"\n",
"continue",
"\n",
"}",
"\n",
"allAms",
"=",
"append",
"(",
"allAms",
",",
"ams",
"...",
")",
"\n",
"allDroppedAms",
"=",
"append",
"(",
"allDroppedAms",
",",
"droppedAms",
"...",
")",
"\n",
"}",
"\n\n",
"s",
".",
"mtx",
".",
"Lock",
"(",
")",
"\n",
"defer",
"s",
".",
"mtx",
".",
"Unlock",
"(",
")",
"\n",
"// Set new Alertmanagers and deduplicate them along their unique URL.",
"s",
".",
"ams",
"=",
"[",
"]",
"alertmanager",
"{",
"}",
"\n",
"s",
".",
"droppedAms",
"=",
"[",
"]",
"alertmanager",
"{",
"}",
"\n",
"s",
".",
"droppedAms",
"=",
"append",
"(",
"s",
".",
"droppedAms",
",",
"allDroppedAms",
"...",
")",
"\n",
"seen",
":=",
"map",
"[",
"string",
"]",
"struct",
"{",
"}",
"{",
"}",
"\n\n",
"for",
"_",
",",
"am",
":=",
"range",
"allAms",
"{",
"us",
":=",
"am",
".",
"url",
"(",
")",
".",
"String",
"(",
")",
"\n",
"if",
"_",
",",
"ok",
":=",
"seen",
"[",
"us",
"]",
";",
"ok",
"{",
"continue",
"\n",
"}",
"\n\n",
"// This will initialize the Counters for the AM to 0.",
"s",
".",
"metrics",
".",
"sent",
".",
"WithLabelValues",
"(",
"us",
")",
"\n",
"s",
".",
"metrics",
".",
"errors",
".",
"WithLabelValues",
"(",
"us",
")",
"\n\n",
"seen",
"[",
"us",
"]",
"=",
"struct",
"{",
"}",
"{",
"}",
"\n",
"s",
".",
"ams",
"=",
"append",
"(",
"s",
".",
"ams",
",",
"am",
")",
"\n",
"}",
"\n",
"}"
] |
24,418 | all-24419 | [
"Retrieve",
"mocks",
"base",
"method"
] | [
"func",
"(",
"m",
"*",
"MockProvider",
")",
"Retrieve",
"(",
")",
"(",
"credentials",
".",
"<mask>",
",",
"error",
")",
"{",
"ret",
":=",
"m",
".",
"ctrl",
".",
"Call",
"(",
"m",
",",
"\"",
"\"",
")",
"\n",
"ret0",
",",
"_",
":=",
"ret",
"[",
"0",
"]",
".",
"(",
"credentials",
".",
"Value",
")",
"\n",
"ret1",
",",
"_",
":=",
"ret",
"[",
"1",
"]",
".",
"(",
"error",
")",
"\n",
"return",
"ret0",
",",
"ret1",
"\n",
"}"
] |
24,419 | all-24420 | [
"Execute",
"-",
"deletes",
"orgs"
] | [
"func",
"(",
"c",
"*",
"DeleteOrgsCommand",
")",
"Execute",
"(",
"[",
"]",
"string",
")",
"error",
"{",
"var",
"cfMgmt",
"*",
"CFMgmt",
"\n",
"<mask>",
"err",
"error",
"\n",
"if",
"cfMgmt",
",",
"err",
"=",
"InitializePeekManagers",
"(",
"c",
".",
"BaseCFConfigCommand",
",",
"c",
".",
"Peek",
")",
";",
"err",
"==",
"nil",
"{",
"err",
"=",
"cfMgmt",
".",
"OrgManager",
".",
"DeleteOrgs",
"(",
")",
"\n",
"}",
"\n",
"return",
"err",
"\n",
"}"
] |
24,420 | all-24421 | [
"NewFmtMachineLogger",
"creates",
"a",
"MachineLogger",
"implementation",
"used",
"by",
"the",
"drivers"
] | [
"func",
"NewFmtMachineLogger",
"(",
")",
"MachineLogger",
"{",
"return",
"&",
"FmtMachineLogger",
"{",
"outWriter",
":",
"os",
".",
"Stdout",
",",
"errWriter",
":",
"<mask>",
".",
"Stderr",
",",
"debug",
":",
"false",
",",
"history",
":",
"NewHistoryRecorder",
"(",
")",
",",
"}",
"\n",
"}"
] |
24,421 | all-24422 | [
"Return",
"a",
"generic",
"vertex",
"attribute",
"parameter"
] | [
"func",
"GetVertexAttribdv",
"(",
"index",
"uint32",
",",
"pname",
"uint32",
",",
"params",
"*",
"float64",
")",
"{",
"C",
".",
"glowGetVertexAttribdv",
"(",
"gpGetVertexAttribdv",
",",
"(",
"C",
".",
"GLuint",
")",
"(",
"<mask>",
")",
",",
"(",
"C",
".",
"GLenum",
")",
"(",
"pname",
")",
",",
"(",
"*",
"C",
".",
"GLdouble",
")",
"(",
"unsafe",
".",
"Pointer",
"(",
"params",
")",
")",
")",
"\n",
"}"
] |
24,422 | all-24423 | [
"MarshalJSON",
"supports",
"json",
".",
"Marshaler",
"interface"
] | [
"func",
"(",
"v",
"SetWebLifecycleStateParams",
")",
"MarshalJSON",
"(",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"w",
":=",
"jwriter",
".",
"Writer",
"{",
"}",
"\n",
"easyjsonC5a4559bEncodeGithubComChromedpCdprotoPage6",
"(",
"&",
"w",
",",
"v",
")",
"\n",
"return",
"w",
".",
"<mask>",
".",
"BuildBytes",
"(",
")",
",",
"w",
".",
"Error",
"\n",
"}"
] |
24,423 | all-24424 | [
"void",
"pango_layout_set_text",
"(",
"PangoLayout",
"*",
"layout",
"const",
"char",
"*",
"text",
"int",
"length",
")",
";"
] | [
"func",
"(",
"v",
"*",
"Layout",
")",
"SetText",
"(",
"<mask>",
"string",
",",
"length",
"int",
")",
"{",
"cstr",
":=",
"C",
".",
"CString",
"(",
"text",
")",
"\n",
"defer",
"C",
".",
"free",
"(",
"unsafe",
".",
"Pointer",
"(",
"cstr",
")",
")",
"\n",
"C",
".",
"pango_layout_set_text",
"(",
"v",
".",
"native",
"(",
")",
",",
"(",
"*",
"C",
".",
"char",
")",
"(",
"cstr",
")",
",",
"(",
"C",
".",
"int",
")",
"(",
"length",
")",
")",
"\n",
"}"
] |
24,424 | all-24425 | [
"EnableVirtualTerminalProcessing",
"configures",
"the",
"terminal",
"to",
"accept",
"ANSI",
"sequences",
".",
"This",
"is",
"a",
"no",
"-",
"op",
"for",
"all",
"operating",
"systems",
"other",
"than",
"Windows",
"."
] | [
"func",
"EnableVirtualTerminalProcessing",
"(",
"fd",
"int",
")",
"error",
"{",
"<mask>",
"st",
"uint32",
"\n",
"err",
":=",
"windows",
".",
"GetConsoleMode",
"(",
"windows",
".",
"Handle",
"(",
"fd",
")",
",",
"&",
"st",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"if",
"st",
"&",
"windows",
".",
"ENABLE_VIRTUAL_TERMINAL_PROCESSING",
"==",
"0",
"{",
"return",
"windows",
".",
"SetConsoleMode",
"(",
"windows",
".",
"Handle",
"(",
"fd",
")",
",",
"st",
"|",
"windows",
".",
"ENABLE_VIRTUAL_TERMINAL_PROCESSING",
")",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
] |
24,425 | all-24426 | [
"GetOperationUUIDs",
"returns",
"a",
"list",
"of",
"operation",
"uuids"
] | [
"func",
"(",
"r",
"*",
"ProtocolLXD",
")",
"GetOperationUUIDs",
"(",
")",
"(",
"[",
"]",
"string",
",",
"error",
")",
"{",
"urls",
":=",
"[",
"]",
"string",
"{",
"}",
"\n\n",
"// Fetch the raw value",
"_",
",",
"err",
":=",
"r",
".",
"queryStruct",
"(",
"\"",
"\"",
",",
"\"",
"\"",
",",
"nil",
",",
"\"",
"\"",
",",
"&",
"urls",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"// Parse it",
"uuids",
":=",
"[",
"]",
"string",
"{",
"}",
"\n",
"for",
"_",
",",
"url",
":=",
"range",
"urls",
"{",
"<mask>",
":=",
"strings",
".",
"Split",
"(",
"url",
",",
"\"",
"\"",
")",
"\n",
"uuids",
"=",
"append",
"(",
"uuids",
",",
"fields",
"[",
"len",
"(",
"fields",
")",
"-",
"1",
"]",
")",
"\n",
"}",
"\n\n",
"return",
"uuids",
",",
"nil",
"\n",
"}"
] |
24,426 | all-24427 | [
"MustDecode",
"is",
"like",
"Decode",
"but",
"panics",
"on",
"error"
] | [
"func",
"MustDecode",
"(",
"expected",
"VersionByte",
",",
"src",
"string",
")",
"[",
"]",
"<mask>",
"{",
"d",
",",
"err",
":=",
"Decode",
"(",
"expected",
",",
"src",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"panic",
"(",
"err",
")",
"\n",
"}",
"\n",
"return",
"d",
"\n",
"}"
] |
24,427 | all-24428 | [
"AfterFunc",
"mocks",
"base",
"method"
] | [
"func",
"(",
"m",
"*",
"MockTime",
")",
"AfterFunc",
"(",
"arg0",
"<mask>",
".",
"Duration",
",",
"arg1",
"func",
"(",
")",
")",
"ttime",
".",
"Timer",
"{",
"ret",
":=",
"m",
".",
"ctrl",
".",
"Call",
"(",
"m",
",",
"\"",
"\"",
",",
"arg0",
",",
"arg1",
")",
"\n",
"ret0",
",",
"_",
":=",
"ret",
"[",
"0",
"]",
".",
"(",
"ttime",
".",
"Timer",
")",
"\n",
"return",
"ret0",
"\n",
"}"
] |
24,428 | all-24429 | [
"ValidateCertificate",
"validate",
"the",
"certificate",
"installed",
"on",
"the",
"vm",
"."
] | [
"func",
"(",
"xcg",
"*",
"X509CertGenerator",
")",
"ValidateCertificate",
"(",
"addr",
"string",
",",
"authOptions",
"*",
"auth",
".",
"Options",
")",
"(",
"bool",
",",
"error",
")",
"{",
"tlsConfig",
",",
"err",
":=",
"xcg",
".",
"ReadTLSConfig",
"(",
"addr",
",",
"authOptions",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"false",
",",
"err",
"\n",
"}",
"\n\n",
"dialer",
":=",
"&",
"net",
".",
"Dialer",
"{",
"Timeout",
":",
"<mask>",
".",
"Second",
"*",
"20",
",",
"}",
"\n\n",
"_",
",",
"err",
"=",
"tls",
".",
"DialWithDialer",
"(",
"dialer",
",",
"\"",
"\"",
",",
"addr",
",",
"tlsConfig",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"false",
",",
"err",
"\n",
"}",
"\n\n",
"return",
"true",
",",
"nil",
"\n",
"}"
] |
24,429 | all-24430 | [
"GetConnectionInfo",
"returns",
"the",
"basic",
"connection",
"information",
"used",
"to",
"interact",
"with",
"the",
"server"
] | [
"func",
"(",
"r",
"*",
"ProtocolSimpleStreams",
")",
"GetConnectionInfo",
"(",
")",
"(",
"*",
"ConnectionInfo",
",",
"error",
")",
"{",
"info",
":=",
"ConnectionInfo",
"{",
"}",
"\n",
"<mask>",
".",
"Addresses",
"=",
"[",
"]",
"string",
"{",
"r",
".",
"httpHost",
"}",
"\n",
"info",
".",
"Certificate",
"=",
"r",
".",
"httpCertificate",
"\n",
"info",
".",
"Protocol",
"=",
"\"",
"\"",
"\n",
"info",
".",
"URL",
"=",
"r",
".",
"httpHost",
"\n\n",
"return",
"&",
"info",
",",
"nil",
"\n",
"}"
] |
24,430 | all-24431 | [
"Parses",
"incoming",
"target",
"groups",
"updates",
".",
"If",
"the",
"update",
"contains",
"changes",
"to",
"the",
"target",
"groups",
"Adapter",
"already",
"knows",
"about",
"or",
"new",
"target",
"groups",
"we",
"Marshal",
"to",
"JSON",
"and",
"write",
"to",
"file",
"."
] | [
"func",
"(",
"a",
"*",
"Adapter",
")",
"refreshTargetGroups",
"(",
"allTargetGroups",
"map",
"[",
"string",
"]",
"[",
"]",
"*",
"targetgroup",
".",
"Group",
")",
"{",
"tempGroups",
":=",
"generateTargetGroups",
"(",
"allTargetGroups",
")",
"\n\n",
"if",
"!",
"reflect",
".",
"DeepEqual",
"(",
"a",
".",
"groups",
",",
"tempGroups",
")",
"{",
"a",
".",
"groups",
"=",
"tempGroups",
"\n",
"err",
":=",
"a",
".",
"writeOutput",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"level",
".",
"Error",
"(",
"<mask>",
".",
"With",
"(",
"a",
".",
"logger",
",",
"\"",
"\"",
",",
"\"",
"\"",
")",
")",
".",
"Log",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"}",
"\n",
"}",
"\n",
"}"
] |
24,431 | all-24432 | [
"SetNative",
"overwrites",
"a",
"with",
"the",
"native",
"asset",
"type"
] | [
"func",
"(",
"a",
"*",
"<mask>",
")",
"SetNative",
"(",
")",
"error",
"{",
"newa",
",",
"err",
":=",
"NewAsset",
"(",
"AssetTypeAssetTypeNative",
",",
"nil",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"*",
"a",
"=",
"newa",
"\n",
"return",
"nil",
"\n",
"}"
] |
24,432 | all-24433 | [
"specify",
"mapping",
"of",
"depth",
"values",
"from",
"normalized",
"device",
"coordinates",
"to",
"window",
"coordinates",
"for",
"a",
"specified",
"viewport"
] | [
"func",
"DepthRangeIndexed",
"(",
"<mask>",
"uint32",
",",
"n",
"float64",
",",
"f",
"float64",
")",
"{",
"C",
".",
"glowDepthRangeIndexed",
"(",
"gpDepthRangeIndexed",
",",
"(",
"C",
".",
"GLuint",
")",
"(",
"index",
")",
",",
"(",
"C",
".",
"GLdouble",
")",
"(",
"n",
")",
",",
"(",
"C",
".",
"GLdouble",
")",
"(",
"f",
")",
")",
"\n",
"}"
] |
24,433 | all-24434 | [
"Run",
"executes",
"external",
"commands",
"just",
"like",
"RunWithMatch",
"but",
"does",
"not",
"return",
"the",
"boolean",
"match",
"."
] | [
"func",
"Run",
"(",
"command",
"string",
")",
"(",
"<mask>",
"[",
"]",
"byte",
",",
"err",
"error",
")",
"{",
"output",
",",
"_",
",",
"err",
"=",
"RunWithMatch",
"(",
"command",
")",
"\n",
"return",
"\n",
"}"
] |
24,434 | all-24435 | [
"queryVmfsDatastoreExtendOptions",
"is",
"a",
"stop",
"-",
"gap",
"method",
"that",
"implements",
"QueryVmfsDatastoreExtendOptions",
".",
"It",
"will",
"be",
"removed",
"once",
"the",
"higher",
"level",
"HostDatastoreSystem",
"object",
"supports",
"this",
"method",
"."
] | [
"func",
"queryVmfsDatastoreExtendOptions",
"(",
"ctx",
"context",
".",
"Context",
",",
"s",
"*",
"object",
".",
"HostDatastoreSystem",
",",
"ds",
"*",
"object",
".",
"Datastore",
",",
"devicePath",
"string",
",",
"suppressExpandCandidates",
"bool",
")",
"(",
"[",
"]",
"<mask>",
".",
"VmfsDatastoreOption",
",",
"error",
")",
"{",
"req",
":=",
"types",
".",
"QueryVmfsDatastoreExtendOptions",
"{",
"This",
":",
"s",
".",
"Reference",
"(",
")",
",",
"Datastore",
":",
"ds",
".",
"Reference",
"(",
")",
",",
"DevicePath",
":",
"devicePath",
",",
"SuppressExpandCandidates",
":",
"&",
"suppressExpandCandidates",
",",
"}",
"\n\n",
"res",
",",
"err",
":=",
"methods",
".",
"QueryVmfsDatastoreExtendOptions",
"(",
"ctx",
",",
"s",
".",
"Client",
"(",
")",
",",
"&",
"req",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"return",
"res",
".",
"Returnval",
",",
"nil",
"\n",
"}"
] |
24,435 | all-24436 | [
"ListAttachedVolumes",
"lists",
"attached",
"volumes"
] | [
"func",
"(",
"c",
"*",
"Client",
")",
"ListAttachedVolumes",
"(",
"dcid",
",",
"srvid",
"string",
")",
"(",
"*",
"Volumes",
",",
"error",
")",
"{",
"url",
":=",
"serverVolumeColPath",
"(",
"dcid",
",",
"srvid",
")",
"+",
"`?depth=`",
"+",
"c",
".",
"client",
".",
"depth",
"+",
"`&pretty=`",
"+",
"strconv",
".",
"FormatBool",
"(",
"c",
".",
"client",
".",
"pretty",
")",
"\n",
"ret",
":=",
"&",
"Volumes",
"{",
"}",
"\n",
"err",
":=",
"c",
".",
"client",
".",
"Get",
"(",
"url",
",",
"<mask>",
",",
"http",
".",
"StatusOK",
")",
"\n",
"return",
"ret",
",",
"err",
"\n",
"}"
] |
24,436 | all-24437 | [
"GetType",
"returns",
"the",
"Type",
"field",
"if",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"."
] | [
"func",
"(",
"q",
"*",
"QueryValueDefinition",
")",
"GetType",
"(",
")",
"string",
"{",
"if",
"q",
"==",
"nil",
"||",
"q",
".",
"<mask>",
"==",
"nil",
"{",
"return",
"\"",
"\"",
"\n",
"}",
"\n",
"return",
"*",
"q",
".",
"Type",
"\n",
"}"
] |
24,437 | all-24438 | [
"ViewMetricMetadata",
"allows",
"you",
"to",
"get",
"metadata",
"about",
"a",
"specific",
"metric",
"."
] | [
"func",
"(",
"<mask>",
"*",
"Client",
")",
"ViewMetricMetadata",
"(",
"mn",
"string",
")",
"(",
"*",
"MetricMetadata",
",",
"error",
")",
"{",
"var",
"out",
"MetricMetadata",
"\n",
"if",
"err",
":=",
"client",
".",
"doJsonRequest",
"(",
"\"",
"\"",
",",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"mn",
")",
",",
"nil",
",",
"&",
"out",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"return",
"&",
"out",
",",
"nil",
"\n",
"}"
] |
24,438 | all-24439 | [
"GetRepositoryTags",
"list",
"all",
"tags",
"available",
"in",
"the",
"repository",
".",
"The",
"tag",
"provided",
"inside",
"the",
"ImageReference",
"will",
"be",
"ignored",
".",
"(",
"This",
"is",
"a",
"backward",
"-",
"compatible",
"shim",
"method",
"which",
"calls",
"the",
"module",
"-",
"level",
"GetRepositoryTags",
")"
] | [
"func",
"(",
"i",
"*",
"Image",
")",
"GetRepositoryTags",
"(",
"ctx",
"<mask>",
".",
"Context",
")",
"(",
"[",
"]",
"string",
",",
"error",
")",
"{",
"return",
"GetRepositoryTags",
"(",
"ctx",
",",
"i",
".",
"src",
".",
"c",
".",
"sys",
",",
"i",
".",
"src",
".",
"ref",
")",
"\n",
"}"
] |
24,439 | all-24440 | [
"NewRangeQuery",
"returns",
"an",
"evaluation",
"query",
"for",
"the",
"given",
"time",
"range",
"and",
"with",
"the",
"resolution",
"set",
"by",
"the",
"interval",
"."
] | [
"func",
"(",
"ng",
"*",
"Engine",
")",
"NewRangeQuery",
"(",
"q",
"storage",
".",
"Queryable",
",",
"qs",
"string",
",",
"start",
",",
"end",
"time",
".",
"Time",
",",
"interval",
"<mask>",
".",
"Duration",
")",
"(",
"Query",
",",
"error",
")",
"{",
"expr",
",",
"err",
":=",
"ParseExpr",
"(",
"qs",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"if",
"expr",
".",
"Type",
"(",
")",
"!=",
"ValueTypeVector",
"&&",
"expr",
".",
"Type",
"(",
")",
"!=",
"ValueTypeScalar",
"{",
"return",
"nil",
",",
"errors",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"documentedType",
"(",
"expr",
".",
"Type",
"(",
")",
")",
")",
"\n",
"}",
"\n",
"qry",
":=",
"ng",
".",
"newQuery",
"(",
"q",
",",
"expr",
",",
"start",
",",
"end",
",",
"interval",
")",
"\n",
"qry",
".",
"q",
"=",
"qs",
"\n\n",
"return",
"qry",
",",
"nil",
"\n",
"}"
] |
24,440 | all-24441 | [
"/",
"*",
"Creates",
"IPL",
"image",
"(",
"header",
"and",
"data",
")"
] | [
"func",
"CreateImage",
"(",
"w",
",",
"h",
",",
"depth",
",",
"channels",
"int",
")",
"*",
"IplImage",
"{",
"size",
":=",
"C",
".",
"cvSize",
"(",
"C",
".",
"int",
"(",
"w",
")",
",",
"C",
".",
"int",
"(",
"h",
")",
")",
"\n",
"img",
":=",
"C",
".",
"cvCreateImage",
"(",
"<mask>",
",",
"C",
".",
"int",
"(",
"depth",
")",
",",
"C",
".",
"int",
"(",
"channels",
")",
")",
"\n",
"return",
"(",
"*",
"IplImage",
")",
"(",
"img",
")",
"\n",
"}"
] |
24,441 | all-24442 | [
"LinkByName",
"finds",
"a",
"link",
"by",
"name",
"and",
"returns",
"a",
"pointer",
"to",
"the",
"object"
] | [
"func",
"(",
"NetLinkClient",
")",
"LinkByName",
"(",
"<mask>",
"string",
")",
"(",
"netlink",
".",
"Link",
",",
"error",
")",
"{",
"return",
"netlink",
".",
"LinkByName",
"(",
"name",
")",
"\n",
"}"
] |
24,442 | all-24443 | [
"NewEncoder",
"creates",
"encoder"
] | [
"func",
"NewEncoder",
"(",
"defaultEncoding",
"Encoding",
",",
"encodings",
"...",
"Encoding",
")",
"*",
"Encoder",
"{",
"m",
":=",
"make",
"(",
"map",
"[",
"Encoding",
"]",
"*",
"mimeInfo",
")",
"\n\n",
"for",
"_",
",",
"e",
":=",
"<mask>",
"append",
"(",
"encodings",
",",
"defaultEncoding",
")",
"{",
"info",
":=",
"parseMimeInfo",
"(",
"e",
".",
"Mime",
"(",
")",
")",
"\n",
"m",
"[",
"e",
"]",
"=",
"info",
"\n",
"}",
"\n\n",
"return",
"&",
"Encoder",
"{",
"defaultEncoding",
":",
"defaultEncoding",
",",
"encodings",
":",
"m",
",",
"}",
"\n",
"}"
] |
24,443 | all-24444 | [
"String",
"returns",
"the",
"name",
"of",
"e"
] | [
"func",
"(",
"e",
"ChangeTrustResultCode",
")",
"String",
"(",
")",
"string",
"{",
"name",
",",
"_",
":=",
"changeTrustResultCodeMap",
"[",
"int32",
"(",
"e",
")",
"]",
"\n",
"return",
"<mask>",
"\n",
"}"
] |
24,444 | all-24445 | [
"GetSuccess",
"retrieves",
"the",
"Success",
"value",
"from",
"the",
"union",
"returning",
"ok",
"if",
"the",
"union",
"s",
"switch",
"indicated",
"the",
"value",
"is",
"valid",
"."
] | [
"func",
"(",
"u",
"ManageOfferResult",
")",
"GetSuccess",
"(",
")",
"(",
"result",
"ManageOfferSuccessResult",
",",
"<mask>",
"bool",
")",
"{",
"armName",
",",
"_",
":=",
"u",
".",
"ArmForSwitch",
"(",
"int32",
"(",
"u",
".",
"Code",
")",
")",
"\n\n",
"if",
"armName",
"==",
"\"",
"\"",
"{",
"result",
"=",
"*",
"u",
".",
"Success",
"\n",
"ok",
"=",
"true",
"\n",
"}",
"\n\n",
"return",
"\n",
"}"
] |
24,445 | all-24446 | [
"PublicCertToPEM",
"serializes",
"the",
"public",
"x509",
"cert",
"in",
"cert",
"to",
"a",
"PEM",
"-",
"formatted",
"block"
] | [
"func",
"PublicCertToPEM",
"(",
"cert",
"*",
"tls",
".",
"Certificate",
")",
"[",
"]",
"<mask>",
"{",
"return",
"pem",
".",
"EncodeToMemory",
"(",
"&",
"pem",
".",
"Block",
"{",
"Type",
":",
"\"",
"\"",
",",
"Bytes",
":",
"cert",
".",
"Certificate",
"[",
"0",
"]",
",",
"}",
")",
"\n",
"}"
] |
24,446 | all-24447 | [
"GenerateECDSAKeyPair",
"generates",
"a",
"new",
"ecdsa",
"private",
"and",
"public",
"key"
] | [
"func",
"GenerateECDSAKeyPair",
"(",
"src",
"<mask>",
".",
"Reader",
")",
"(",
"PrivKey",
",",
"PubKey",
",",
"error",
")",
"{",
"return",
"GenerateECDSAKeyPairWithCurve",
"(",
"ECDSACurve",
",",
"src",
")",
"\n",
"}"
] |
24,447 | all-24448 | [
"GetBodyJSON",
"return",
"a",
"json",
"from",
"body"
] | [
"func",
"(",
"ctx",
"*",
"Context",
")",
"GetBodyJSON",
"(",
")",
"{",
"<mask>",
"reqJSON",
"map",
"[",
"string",
"]",
"interface",
"{",
"}",
"\n",
"body",
",",
"_",
":=",
"ioutil",
".",
"ReadAll",
"(",
"ctx",
".",
"Request",
".",
"Body",
")",
"\n",
"defer",
"ctx",
".",
"Request",
".",
"Body",
".",
"Close",
"(",
")",
"\n",
"cType",
":=",
"ctx",
".",
"Request",
".",
"Header",
".",
"Get",
"(",
"\"",
"\"",
")",
"\n",
"a",
":=",
"strings",
".",
"Split",
"(",
"cType",
",",
"\"",
"\"",
")",
"\n",
"if",
"a",
"[",
"0",
"]",
"==",
"\"",
"\"",
"{",
"reqJSON",
"=",
"make",
"(",
"map",
"[",
"string",
"]",
"interface",
"{",
"}",
")",
"\n",
"reqStr",
":=",
"string",
"(",
"body",
")",
"\n",
"reqArr",
":=",
"strings",
".",
"Split",
"(",
"reqStr",
",",
"\"",
"\"",
")",
"\n",
"for",
"_",
",",
"v",
":=",
"range",
"reqArr",
"{",
"param",
":=",
"strings",
".",
"Split",
"(",
"v",
",",
"\"",
"\"",
")",
"\n",
"reqJSON",
"[",
"param",
"[",
"0",
"]",
"]",
",",
"_",
"=",
"url",
".",
"QueryUnescape",
"(",
"param",
"[",
"1",
"]",
")",
"\n",
"}",
"\n",
"}",
"else",
"{",
"json",
".",
"Unmarshal",
"(",
"body",
",",
"&",
"reqJSON",
")",
"\n",
"}",
"\n",
"ctx",
".",
"BodyJSON",
"=",
"reqJSON",
"\n",
"}"
] |
24,448 | all-24449 | [
"NewClient",
"creates",
"a",
"new",
"Client",
"connection",
"from",
"the",
"user",
"name",
"password",
"and",
"resource",
"passed",
"to",
"it",
".",
"It",
"uses",
"default",
"host",
"URL",
"and",
"conf",
"URL",
"."
] | [
"func",
"NewClient",
"(",
"user",
",",
"pass",
",",
"<mask>",
",",
"authType",
"string",
")",
"(",
"*",
"Client",
",",
"error",
")",
"{",
"return",
"NewClientWithServerInfo",
"(",
"user",
",",
"pass",
",",
"resource",
",",
"authType",
",",
"defaultHost",
",",
"defaultDomain",
",",
"defaultConf",
")",
"\n",
"}"
] |
24,449 | all-24450 | [
"FindByButton",
"finds",
"exactly",
"one",
"button",
"element",
"with",
"the",
"provided",
"text",
".",
"Supports",
"<button",
">",
"<input",
"type",
"=",
"button",
">",
"and",
"<input",
"type",
"=",
"submit",
">",
"."
] | [
"func",
"(",
"s",
"*",
"selectable",
")",
"FindByButton",
"(",
"<mask>",
"string",
")",
"*",
"Selection",
"{",
"return",
"newSelection",
"(",
"s",
".",
"session",
",",
"s",
".",
"selectors",
".",
"Append",
"(",
"target",
".",
"Button",
",",
"text",
")",
".",
"Single",
"(",
")",
")",
"\n",
"}"
] |
24,450 | all-24451 | [
"ImportantFlag",
"marks",
"a",
"top",
"-",
"level",
"flag",
"as",
"important",
"which",
"means",
"it",
"will",
"be",
"printed",
"out",
"as",
"part",
"of",
"the",
"output",
"of",
"an",
"ordinary",
"help",
"subcommand",
".",
"(",
"All",
"flags",
"important",
"or",
"not",
"are",
"printed",
"by",
"the",
"flags",
"subcommand",
".",
")"
] | [
"func",
"(",
"cdr",
"*",
"Commander",
")",
"ImportantFlag",
"(",
"name",
"string",
")",
"{",
"cdr",
".",
"important",
"=",
"append",
"(",
"cdr",
".",
"important",
",",
"<mask>",
")",
"\n",
"}"
] |
24,451 | all-24452 | [
"RequireBasicAuth",
"wraps",
"a",
"given",
"handler",
"function",
"inside",
"a",
"handler",
"with",
"basic",
"access",
"authentication",
"."
] | [
"func",
"(",
"s",
"*",
"Server",
")",
"RequireBasicAuth",
"(",
"logger",
"log",
".",
"Logger",
",",
"handler",
"HandlerFunc",
",",
"auth",
"AuthFunc",
")",
"HandlerFunc",
"{",
"l",
":=",
"logger",
".",
"Add",
"(",
"\"",
"\"",
",",
"\"",
"\"",
")",
"\n",
"return",
"func",
"(",
"w",
"http",
".",
"ResponseWriter",
",",
"r",
"*",
"http",
".",
"Request",
",",
"ctx",
"*",
"Context",
")",
"{",
"name",
",",
"pass",
",",
"ok",
":=",
"r",
".",
"BasicAuth",
"(",
")",
"\n",
"if",
"!",
"ok",
"||",
"!",
"auth",
"(",
"name",
",",
"pass",
")",
"{",
"l",
".",
"Add",
"(",
"\"",
"\"",
",",
"r",
".",
"RemoteAddr",
")",
".",
"Warn",
"(",
"\"",
"\"",
")",
"\n",
"s",
".",
"RespondError",
"(",
"logger",
",",
"w",
",",
"ErrAccessDenied",
")",
"\n",
"return",
"\n",
"}",
"\n\n",
"ctx",
".",
"Username",
"=",
"name",
"\n",
"<mask>",
"(",
"w",
",",
"r",
",",
"ctx",
")",
"\n",
"}",
"\n",
"}"
] |
24,452 | all-24453 | [
"ValidEnum",
"validates",
"a",
"proposed",
"value",
"for",
"this",
"enum",
".",
"Implements",
"the",
"Enum",
"interface",
"for",
"ChangeTrustResultCode"
] | [
"func",
"(",
"e",
"ChangeTrustResultCode",
")",
"ValidEnum",
"(",
"v",
"int32",
")",
"bool",
"{",
"_",
",",
"ok",
":=",
"changeTrustResultCodeMap",
"[",
"v",
"]",
"\n",
"return",
"<mask>",
"\n",
"}"
] |
24,453 | all-24454 | [
"State",
"mocks",
"base",
"method"
] | [
"func",
"(",
"m",
"*",
"MockDockerStateResolver",
")",
"State",
"(",
")",
"dockerstate",
".",
"TaskEngineState",
"{",
"ret",
":=",
"m",
".",
"ctrl",
".",
"Call",
"(",
"m",
",",
"\"",
"\"",
")",
"\n",
"ret0",
",",
"_",
":=",
"<mask>",
"[",
"0",
"]",
".",
"(",
"dockerstate",
".",
"TaskEngineState",
")",
"\n",
"return",
"ret0",
"\n",
"}"
] |
24,454 | all-24455 | [
"GetType",
"returns",
"the",
"Type",
"field",
"if",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"."
] | [
"func",
"(",
"g",
"*",
"GraphDefinitionRequestStyle",
")",
"GetType",
"(",
")",
"string",
"{",
"if",
"g",
"==",
"nil",
"||",
"g",
".",
"<mask>",
"==",
"nil",
"{",
"return",
"\"",
"\"",
"\n",
"}",
"\n",
"return",
"*",
"g",
".",
"Type",
"\n",
"}"
] |
24,455 | all-24456 | [
"MarshalJSON",
"supports",
"json",
".",
"Marshaler",
"interface"
] | [
"func",
"(",
"v",
"CaptureSnapshotReturns",
")",
"MarshalJSON",
"(",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"w",
":=",
"jwriter",
".",
"<mask>",
"{",
"}",
"\n",
"easyjsonC5a4559bEncodeGithubComChromedpCdprotoPage77",
"(",
"&",
"w",
",",
"v",
")",
"\n",
"return",
"w",
".",
"Buffer",
".",
"BuildBytes",
"(",
")",
",",
"w",
".",
"Error",
"\n",
"}"
] |
24,456 | all-24457 | [
"bind",
"a",
"buffer",
"object",
"to",
"a",
"transform",
"feedback",
"buffer",
"object"
] | [
"func",
"TransformFeedbackBufferBase",
"(",
"xfb",
"uint32",
",",
"index",
"uint32",
",",
"buffer",
"uint32",
")",
"{",
"syscall",
".",
"Syscall",
"(",
"gpTransformFeedbackBufferBase",
",",
"3",
",",
"uintptr",
"(",
"xfb",
")",
",",
"uintptr",
"(",
"<mask>",
")",
",",
"uintptr",
"(",
"buffer",
")",
")",
"\n",
"}"
] |
24,457 | all-24458 | [
"Like",
"fetch",
"but",
"increments",
"local",
"refcount",
"."
] | [
"func",
"(",
"peers",
"*",
"Peers",
")",
"fetchAndAddRef",
"(",
"<mask>",
"PeerName",
")",
"*",
"Peer",
"{",
"peers",
".",
"Lock",
"(",
")",
"\n",
"defer",
"peers",
".",
"Unlock",
"(",
")",
"\n",
"peer",
":=",
"peers",
".",
"byName",
"[",
"name",
"]",
"\n",
"if",
"peer",
"!=",
"nil",
"{",
"peer",
".",
"localRefCount",
"++",
"\n",
"}",
"\n",
"return",
"peer",
"\n",
"}"
] |
24,458 | all-24459 | [
"UnmarshalJSON",
"supports",
"json",
".",
"Unmarshaler",
"interface"
] | [
"func",
"(",
"v",
"*",
"VisualViewport",
")",
"UnmarshalJSON",
"(",
"<mask>",
"[",
"]",
"byte",
")",
"error",
"{",
"r",
":=",
"jlexer",
".",
"Lexer",
"{",
"Data",
":",
"data",
"}",
"\n",
"easyjsonC5a4559bDecodeGithubComChromedpCdprotoPage1",
"(",
"&",
"r",
",",
"v",
")",
"\n",
"return",
"r",
".",
"Error",
"(",
")",
"\n",
"}"
] |
24,459 | all-24460 | [
"removeContainer",
"deletes",
"the",
"container",
"from",
"the",
"map",
"of",
"containers",
"being",
"watched",
".",
"It",
"also",
"stops",
"the",
"periodic",
"usage",
"data",
"collection",
"for",
"the",
"container",
"."
] | [
"func",
"(",
"engine",
"*",
"DockerStatsEngine",
")",
"removeContainer",
"(",
"dockerID",
"string",
")",
"{",
"engine",
".",
"lock",
".",
"Lock",
"(",
")",
"\n",
"defer",
"engine",
".",
"lock",
".",
"Unlock",
"(",
")",
"\n\n",
"// Make sure that this container belongs to a task.",
"task",
",",
"err",
":=",
"engine",
".",
"resolver",
".",
"ResolveTask",
"(",
"dockerID",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"seelog",
".",
"Debugf",
"(",
"\"",
"\"",
",",
"err",
",",
"dockerID",
")",
"\n",
"return",
"\n",
"}",
"\n\n",
"_",
",",
"taskExists",
":=",
"engine",
".",
"tasksToContainers",
"[",
"task",
".",
"Arn",
"]",
"\n",
"if",
"!",
"taskExists",
"{",
"seelog",
".",
"Debugf",
"(",
"\"",
"\"",
",",
"dockerID",
")",
"\n",
"return",
"\n",
"}",
"\n\n",
"// task arn exists in map.",
"container",
",",
"containerExists",
":=",
"engine",
".",
"tasksToContainers",
"[",
"task",
".",
"Arn",
"]",
"[",
"dockerID",
"]",
"\n",
"if",
"!",
"containerExists",
"{",
"// container arn does not exist in map.",
"seelog",
".",
"Debugf",
"(",
"\"",
"\"",
",",
"dockerID",
")",
"\n",
"return",
"\n",
"}",
"\n\n",
"<mask>",
".",
"doRemoveContainerUnsafe",
"(",
"container",
",",
"task",
".",
"Arn",
")",
"\n",
"}"
] |
24,460 | all-24461 | [
"Unfortunately",
"Go",
"s",
"pre",
"-",
"defined",
"format",
"strings",
"for",
"parsing",
"RFC",
"-",
"3339",
"-",
"compliant",
"timestamps",
"aren",
"t",
"exhaustive",
".",
"This",
"method",
"attempts",
"to",
"parse",
"a",
"larger",
"set",
"of",
"of",
"ISO",
"-",
"8601",
"-",
"compatible",
"timestampts",
"(",
"which",
"are",
"themselves",
"a",
"subset",
"of",
"RFC",
"-",
"3339",
"timestamps",
")"
] | [
"func",
"parseISO8601",
"(",
"s",
"string",
")",
"(",
"<mask>",
".",
"Time",
",",
"error",
")",
"{",
"t",
",",
"err",
":=",
"time",
".",
"Parse",
"(",
"time",
".",
"RFC3339",
",",
"s",
")",
"\n",
"if",
"err",
"==",
"nil",
"{",
"return",
"t",
",",
"nil",
"\n",
"}",
"\n",
"t",
",",
"err",
"=",
"time",
".",
"Parse",
"(",
"\"",
"\"",
",",
"s",
")",
"\n",
"if",
"err",
"==",
"nil",
"{",
"return",
"t",
",",
"nil",
"\n",
"}",
"\n",
"return",
"time",
".",
"Time",
"{",
"}",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\\\"",
"\\\"",
"\"",
",",
"s",
",",
"[",
"]",
"string",
"{",
"time",
".",
"RFC3339",
",",
"\"",
"\"",
"}",
")",
"\n",
"}"
] |
24,461 | all-24462 | [
"IsInhibited",
"is",
"a",
"wrapper",
"around",
"gtk_application_is_inhibited",
"()",
"."
] | [
"func",
"(",
"v",
"*",
"Application",
")",
"IsInhibited",
"(",
"<mask>",
"ApplicationInhibitFlags",
")",
"bool",
"{",
"return",
"gobool",
"(",
"C",
".",
"gtk_application_is_inhibited",
"(",
"v",
".",
"native",
"(",
")",
",",
"C",
".",
"GtkApplicationInhibitFlags",
"(",
"flags",
")",
")",
")",
"\n",
"}"
] |
24,462 | all-24463 | [
"GetJustify",
"is",
"a",
"wrapper",
"around",
"gtk_label_get_justify",
"()",
"."
] | [
"func",
"(",
"v",
"*",
"<mask>",
")",
"GetJustify",
"(",
")",
"Justification",
"{",
"c",
":=",
"C",
".",
"gtk_label_get_justify",
"(",
"v",
".",
"native",
"(",
")",
")",
"\n",
"return",
"Justification",
"(",
"c",
")",
"\n",
"}"
] |
24,463 | all-24464 | [
"Locator",
"returns",
"a",
"locator",
"for",
"the",
"given",
"resource"
] | [
"func",
"(",
"r",
"*",
"Backup",
")",
"Locator",
"(",
"api",
"*",
"API",
")",
"*",
"BackupLocator",
"{",
"for",
"_",
",",
"l",
":=",
"<mask>",
"r",
".",
"Links",
"{",
"if",
"l",
"[",
"\"",
"\"",
"]",
"==",
"\"",
"\"",
"{",
"return",
"api",
".",
"BackupLocator",
"(",
"l",
"[",
"\"",
"\"",
"]",
")",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
] |
24,464 | all-24465 | [
"WithQuality",
"compression",
"quality",
"from",
"range",
"[",
"0",
"..",
"100",
"]",
"."
] | [
"func",
"(",
"p",
"StartScreencastParams",
")",
"WithQuality",
"(",
"<mask>",
"int64",
")",
"*",
"StartScreencastParams",
"{",
"p",
".",
"Quality",
"=",
"quality",
"\n",
"return",
"&",
"p",
"\n",
"}"
] |
24,465 | all-24466 | [
"mergeValues",
"returns",
"the",
"result",
"of",
"merging",
"two",
"url",
".",
"Values",
"."
] | [
"func",
"mergeValues",
"(",
"u1",
",",
"u2",
"<mask>",
".",
"Values",
")",
"url",
".",
"Values",
"{",
"if",
"u1",
"==",
"nil",
"{",
"return",
"u2",
"\n",
"}",
"\n",
"if",
"u2",
"==",
"nil",
"{",
"return",
"u1",
"\n",
"}",
"\n",
"for",
"k",
",",
"v",
":=",
"range",
"u2",
"{",
"u1",
"[",
"k",
"]",
"=",
"append",
"(",
"u1",
"[",
"k",
"]",
",",
"v",
"...",
")",
"\n",
"}",
"\n",
"return",
"u1",
"\n",
"}"
] |
24,466 | all-24467 | [
"DeepCopy",
"copies",
"the",
"receiver",
"into",
"a",
"new",
"UUID3",
"."
] | [
"func",
"(",
"u",
"*",
"UUID3",
")",
"DeepCopy",
"(",
")",
"*",
"UUID3",
"{",
"if",
"u",
"==",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n",
"<mask>",
":=",
"new",
"(",
"UUID3",
")",
"\n",
"u",
".",
"DeepCopyInto",
"(",
"out",
")",
"\n",
"return",
"out",
"\n",
"}"
] |
24,467 | all-24468 | [
"export",
"FrameSet_Len"
] | [
"func",
"FrameSet_Len",
"(",
"id",
"FrameSetId",
")",
"C",
".",
"size_t",
"{",
"<mask>",
",",
"ok",
":=",
"sFrameSets",
".",
"Get",
"(",
"id",
")",
"\n",
"if",
"!",
"ok",
"{",
"return",
"C",
".",
"size_t",
"(",
"0",
")",
"\n",
"}",
"\n",
"return",
"C",
".",
"size_t",
"(",
"fs",
".",
"Len",
"(",
")",
")",
"\n",
"}"
] |
24,468 | all-24469 | [
"validateGTLDs",
"checks",
"that",
"all",
"entries",
"have",
"a",
"valid",
"parseable",
"DelegationDate",
"string",
"and",
"if",
"not",
"-",
"empty",
"a",
"valid",
"parseable",
"RemovalDate",
"string",
".",
"This",
"function",
"assumes",
"an",
"entry",
"with",
"an",
"empty",
"DelegationDate",
"is",
"an",
"error",
".",
"Use",
"delegatedGTLDs",
"to",
"filter",
"out",
"entries",
"that",
"were",
"never",
"delegated",
"before",
"validating",
"."
] | [
"func",
"validateGTLDs",
"(",
"entries",
"[",
"]",
"util",
".",
"GTLDPeriod",
")",
"error",
"{",
"for",
"_",
",",
"gTLD",
":=",
"<mask>",
"entries",
"{",
"// All entries should have a valid delegation date",
"if",
"_",
",",
"err",
":=",
"time",
".",
"Parse",
"(",
"util",
".",
"GTLDPeriodDateFormat",
",",
"gTLD",
".",
"DelegationDate",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"// a gTLD that has not been removed has an empty RemovalDate and that's OK",
"if",
"_",
",",
"err",
":=",
"time",
".",
"Parse",
"(",
"util",
".",
"GTLDPeriodDateFormat",
",",
"gTLD",
".",
"RemovalDate",
")",
";",
"gTLD",
".",
"RemovalDate",
"!=",
"\"",
"\"",
"&&",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
] |
24,469 | all-24470 | [
"This",
"endpoint",
"will",
"return",
"the",
"hook",
"definition",
"for",
"the",
"given",
"hookGroupId",
"and",
"hookId",
".",
"See",
"#hook"
] | [
"func",
"(",
"hooks",
"*",
"Hooks",
")",
"Hook",
"(",
"hookGroupId",
",",
"hookId",
"string",
")",
"(",
"*",
"HookDefinition",
",",
"error",
")",
"{",
"cd",
":=",
"tcclient",
".",
"Client",
"(",
"*",
"hooks",
")",
"\n",
"responseObject",
",",
"_",
",",
"err",
":=",
"(",
"&",
"cd",
")",
".",
"APICall",
"(",
"nil",
",",
"\"",
"\"",
",",
"\"",
"\"",
"+",
"url",
".",
"QueryEscape",
"(",
"hookGroupId",
")",
"+",
"\"",
"\"",
"+",
"url",
".",
"QueryEscape",
"(",
"hookId",
")",
",",
"<mask>",
"(",
"HookDefinition",
")",
",",
"nil",
")",
"\n",
"return",
"responseObject",
".",
"(",
"*",
"HookDefinition",
")",
",",
"err",
"\n",
"}"
] |
24,470 | all-24471 | [
"BuildDvorak",
"builds",
"the",
"Dvorak",
"Graph"
] | [
"func",
"BuildDvorak",
"(",
")",
"<mask>",
"{",
"data",
",",
"err",
":=",
"data",
".",
"Asset",
"(",
"\"",
"\"",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"panic",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"return",
"getAdjancencyGraphFromFile",
"(",
"data",
",",
"\"",
"\"",
")",
"\n",
"}"
] |
24,471 | all-24472 | [
"validateStorageRelocateDiff",
"validates",
"certain",
"storage",
"vMotion",
"diffs",
"to",
"make",
"sure",
"they",
"are",
"functional",
".",
"These",
"mainly",
"have",
"to",
"do",
"with",
"limitations",
"associated",
"with",
"our",
"tracking",
"of",
"virtual",
"disks",
"via",
"their",
"names",
".",
"The",
"current",
"limitations",
"are",
":",
"*",
"Externally",
"-",
"attached",
"virtual",
"disks",
"are",
"not",
"allowed",
"to",
"be",
"vMotioned",
".",
"*",
"Disks",
"must",
"match",
"the",
"vSphere",
"naming",
"convention",
"where",
"the",
"first",
"disk",
"is",
"named",
"VMNAME",
".",
"vmdk",
"and",
"all",
"other",
"disks",
"are",
"named",
"VMNAME_INDEX",
".",
"vmdk",
"This",
"is",
"a",
"validation",
"we",
"use",
"for",
"cloning",
"as",
"well",
".",
"*",
"Any",
"VM",
"that",
"has",
"been",
"created",
"by",
"a",
"linked",
"clone",
"is",
"blocked",
"from",
"storage",
"vMotion",
"full",
"stop",
".",
"TODO",
":",
"Once",
"we",
"have",
"solved",
"the",
"disk",
"tracking",
"issue",
"and",
"are",
"no",
"longer",
"tracking",
"disks",
"via",
"their",
"file",
"names",
"the",
"only",
"restriction",
"that",
"should",
"remain",
"is",
"for",
"externally",
"attached",
"disks",
".",
"That",
"restriction",
"will",
"go",
"away",
"once",
"we",
"figure",
"out",
"a",
"strategy",
"for",
"handling",
"when",
"said",
"disks",
"have",
"been",
"moved",
"OOB",
"of",
"the",
"VM",
"workflow",
"."
] | [
"func",
"(",
"r",
"*",
"DiskSubresource",
")",
"validateStorageRelocateDiff",
"(",
")",
"error",
"{",
"log",
".",
"Printf",
"(",
"\"",
"\"",
",",
"r",
")",
"\n",
"if",
"err",
":=",
"r",
".",
"blockRelocateAttachedDisks",
"(",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"<mask>",
".",
"Printf",
"(",
"\"",
"\"",
",",
"r",
")",
"\n",
"return",
"nil",
"\n",
"}"
] |
24,472 | all-24473 | [
"Set",
"a",
"file",
"input",
"."
] | [
"func",
"yaml_parser_set_input_reader",
"(",
"parser",
"*",
"yaml_parser_t",
",",
"r",
"io",
".",
"Reader",
")",
"{",
"if",
"<mask>",
".",
"read_handler",
"!=",
"nil",
"{",
"panic",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"parser",
".",
"read_handler",
"=",
"yaml_reader_read_handler",
"\n",
"parser",
".",
"input_reader",
"=",
"r",
"\n",
"}"
] |
24,473 | all-24474 | [
"Lock",
"locks",
"the",
"mutex",
"with",
"a",
"cancelable",
"context",
".",
"If",
"the",
"context",
"is",
"canceled",
"while",
"trying",
"to",
"acquire",
"the",
"lock",
"the",
"mutex",
"tries",
"to",
"clean",
"its",
"stale",
"lock",
"entry",
"."
] | [
"func",
"(",
"m",
"*",
"Mutex",
")",
"Lock",
"(",
"ctx",
"context",
".",
"Context",
")",
"error",
"{",
"s",
":=",
"m",
".",
"s",
"\n",
"client",
":=",
"m",
".",
"s",
".",
"<mask>",
"(",
")",
"\n\n",
"m",
".",
"myKey",
"=",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"m",
".",
"pfx",
",",
"s",
".",
"Lease",
"(",
")",
")",
"\n",
"cmp",
":=",
"v3",
".",
"Compare",
"(",
"v3",
".",
"CreateRevision",
"(",
"m",
".",
"myKey",
")",
",",
"\"",
"\"",
",",
"0",
")",
"\n",
"// put self in lock waiters via myKey; oldest waiter holds lock",
"put",
":=",
"v3",
".",
"OpPut",
"(",
"m",
".",
"myKey",
",",
"\"",
"\"",
",",
"v3",
".",
"WithLease",
"(",
"s",
".",
"Lease",
"(",
")",
")",
")",
"\n",
"// reuse key in case this session already holds the lock",
"get",
":=",
"v3",
".",
"OpGet",
"(",
"m",
".",
"myKey",
")",
"\n",
"// fetch current holder to complete uncontended path with only one RPC",
"getOwner",
":=",
"v3",
".",
"OpGet",
"(",
"m",
".",
"pfx",
",",
"v3",
".",
"WithFirstCreate",
"(",
")",
"...",
")",
"\n",
"resp",
",",
"err",
":=",
"client",
".",
"Txn",
"(",
"ctx",
")",
".",
"If",
"(",
"cmp",
")",
".",
"Then",
"(",
"put",
",",
"getOwner",
")",
".",
"Else",
"(",
"get",
",",
"getOwner",
")",
".",
"Commit",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"m",
".",
"myRev",
"=",
"resp",
".",
"Header",
".",
"Revision",
"\n",
"if",
"!",
"resp",
".",
"Succeeded",
"{",
"m",
".",
"myRev",
"=",
"resp",
".",
"Responses",
"[",
"0",
"]",
".",
"GetResponseRange",
"(",
")",
".",
"Kvs",
"[",
"0",
"]",
".",
"CreateRevision",
"\n",
"}",
"\n",
"// if no key on prefix / the minimum rev is key, already hold the lock",
"ownerKey",
":=",
"resp",
".",
"Responses",
"[",
"1",
"]",
".",
"GetResponseRange",
"(",
")",
".",
"Kvs",
"\n",
"if",
"len",
"(",
"ownerKey",
")",
"==",
"0",
"||",
"ownerKey",
"[",
"0",
"]",
".",
"CreateRevision",
"==",
"m",
".",
"myRev",
"{",
"m",
".",
"hdr",
"=",
"resp",
".",
"Header",
"\n",
"return",
"nil",
"\n",
"}",
"\n\n",
"// wait for deletion revisions prior to myKey",
"hdr",
",",
"werr",
":=",
"waitDeletes",
"(",
"ctx",
",",
"client",
",",
"m",
".",
"pfx",
",",
"m",
".",
"myRev",
"-",
"1",
")",
"\n",
"// release lock key if wait failed",
"if",
"werr",
"!=",
"nil",
"{",
"m",
".",
"Unlock",
"(",
"client",
".",
"Ctx",
"(",
")",
")",
"\n",
"}",
"else",
"{",
"m",
".",
"hdr",
"=",
"hdr",
"\n",
"}",
"\n",
"return",
"werr",
"\n",
"}"
] |
24,474 | all-24475 | [
"ReadTail",
"reads",
"the",
"last",
"n",
"bytes",
"of",
"the",
"pod",
"log"
] | [
"func",
"(",
"a",
"*",
"PodLogArtifact",
")",
"ReadTail",
"(",
"n",
"int64",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"logs",
",",
"err",
":=",
"a",
".",
"jobAgent",
".",
"GetJobLog",
"(",
"a",
".",
"<mask>",
",",
"a",
".",
"buildID",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"}",
"\n",
"size",
":=",
"int64",
"(",
"len",
"(",
"logs",
")",
")",
"\n",
"var",
"off",
"int64",
"\n",
"if",
"n",
">",
"size",
"{",
"off",
"=",
"0",
"\n",
"}",
"else",
"{",
"off",
"=",
"size",
"-",
"n",
"\n",
"}",
"\n",
"p",
":=",
"make",
"(",
"[",
"]",
"byte",
",",
"n",
")",
"\n",
"readBytes",
",",
"err",
":=",
"bytes",
".",
"NewReader",
"(",
"logs",
")",
".",
"ReadAt",
"(",
"p",
",",
"off",
")",
"\n",
"if",
"err",
"!=",
"nil",
"&&",
"err",
"!=",
"io",
".",
"EOF",
"{",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"}",
"\n",
"return",
"p",
"[",
":",
"readBytes",
"]",
",",
"nil",
"\n",
"}"
] |
24,475 | all-24476 | [
"Association",
"response",
"is",
"a",
"string",
"that",
"s",
"assumed",
"to",
"be",
"in",
"valid",
"JSON",
"format",
"which",
"will",
"be",
"exactly",
"the",
"same",
"as",
"the",
"value",
"of",
"Association",
".",
"Content",
".",
"Value",
"(",
"cp",
"is",
"responsible",
"to",
"validate",
"it",
"and",
"deal",
"with",
"it",
"if",
"it",
"s",
"not",
"valid",
")",
".",
"We",
"don",
"t",
"do",
"any",
"decoding",
"base",
"on",
"the",
"encoding",
"because",
"the",
"only",
"encoding",
"that",
"cp",
"currently",
"sends",
"us",
"is",
"identity",
";",
"we",
"don",
"t",
"explicitly",
"model",
"the",
"value",
"field",
"as",
"a",
"struct",
"because",
"we",
"don",
"t",
"want",
"to",
"let",
"agent",
"s",
"implementation",
"depends",
"on",
"the",
"payload",
"format",
"of",
"the",
"association",
"(",
"i",
".",
"e",
".",
"eia",
"device",
"for",
"now",
")"
] | [
"func",
"newAssociationResponse",
"(",
"taskARN",
",",
"associationType",
",",
"associationName",
"string",
",",
"state",
"dockerstate",
".",
"TaskEngineState",
")",
"(",
"string",
",",
"error",
")",
"{",
"task",
",",
"ok",
":=",
"state",
".",
"TaskByArn",
"(",
"taskARN",
")",
"\n",
"if",
"!",
"ok",
"{",
"return",
"\"",
"\"",
",",
"errors",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"taskARN",
")",
"\n",
"}",
"\n\n",
"association",
",",
"ok",
":=",
"task",
".",
"AssociationByTypeAndName",
"(",
"associationType",
",",
"associationName",
")",
"\n\n",
"if",
"!",
"<mask>",
"{",
"return",
"\"",
"\"",
",",
"errors",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"associationType",
",",
"associationName",
")",
"\n",
"}",
"\n\n",
"return",
"association",
".",
"Content",
".",
"Value",
",",
"nil",
"\n",
"}"
] |
24,476 | all-24477 | [
"MarshalJSON",
"supports",
"json",
".",
"Marshaler",
"interface"
] | [
"func",
"(",
"v",
"CopyToParams",
")",
"MarshalJSON",
"(",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"w",
":=",
"jwriter",
".",
"<mask>",
"{",
"}",
"\n",
"easyjsonC5a4559bEncodeGithubComChromedpCdprotoDom75",
"(",
"&",
"w",
",",
"v",
")",
"\n",
"return",
"w",
".",
"Buffer",
".",
"BuildBytes",
"(",
")",
",",
"w",
".",
"Error",
"\n",
"}"
] |
24,477 | all-24478 | [
"invalidate",
"a",
"region",
"of",
"a",
"buffer",
"object",
"s",
"data",
"store"
] | [
"func",
"InvalidateBufferSubData",
"(",
"buffer",
"uint32",
",",
"offset",
"int",
",",
"length",
"int",
")",
"{",
"C",
".",
"glowInvalidateBufferSubData",
"(",
"gpInvalidateBufferSubData",
",",
"(",
"C",
".",
"GLuint",
")",
"(",
"buffer",
")",
",",
"(",
"C",
".",
"GLintptr",
")",
"(",
"<mask>",
")",
",",
"(",
"C",
".",
"GLsizeiptr",
")",
"(",
"length",
")",
")",
"\n",
"}"
] |
24,478 | all-24479 | [
"ConstructSearchQuery",
"returns",
"the",
"GitHub",
"search",
"query",
"string",
"for",
"PRs",
"that",
"are",
"open",
"and",
"authored",
"by",
"the",
"user",
"passed",
".",
"The",
"search",
"is",
"scoped",
"to",
"repositories",
"that",
"are",
"configured",
"with",
"either",
"Prow",
"or",
"Tide",
"."
] | [
"func",
"(",
"da",
"*",
"DashboardAgent",
")",
"ConstructSearchQuery",
"(",
"login",
"string",
")",
"string",
"{",
"tokens",
":=",
"[",
"]",
"string",
"{",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
"+",
"login",
"}",
"\n",
"for",
"i",
":=",
"<mask>",
"da",
".",
"repos",
"{",
"tokens",
"=",
"append",
"(",
"tokens",
",",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\\\"",
"\\\"",
"\"",
",",
"da",
".",
"repos",
"[",
"i",
"]",
")",
")",
"\n",
"}",
"\n",
"return",
"strings",
".",
"Join",
"(",
"tokens",
",",
"\"",
"\"",
")",
"\n",
"}"
] |
24,479 | all-24480 | [
"DeleteContainer",
"removes",
"the",
"MAAS",
"device",
"for",
"the",
"container"
] | [
"func",
"(",
"c",
"*",
"Controller",
")",
"DeleteContainer",
"(",
"name",
"string",
")",
"error",
"{",
"<mask>",
",",
"err",
":=",
"c",
".",
"getDevice",
"(",
"name",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"err",
"=",
"device",
".",
"Delete",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"return",
"nil",
"\n",
"}"
] |
24,480 | all-24481 | [
"GetIntegrationPD",
"gets",
"all",
"the",
"PagerDuty",
"Integrations",
"from",
"the",
"system",
"."
] | [
"func",
"(",
"client",
"*",
"Client",
")",
"GetIntegrationPD",
"(",
")",
"(",
"*",
"integrationPD",
",",
"error",
")",
"{",
"var",
"out",
"integrationPD",
"\n",
"if",
"err",
":=",
"client",
".",
"doJsonRequest",
"(",
"\"",
"\"",
",",
"\"",
"\"",
",",
"nil",
",",
"&",
"<mask>",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"return",
"&",
"out",
",",
"nil",
"\n",
"}"
] |
24,481 | all-24482 | [
"LoadCACertFile",
"reads",
"in",
"a",
"CA",
"cert",
"file",
"that",
"may",
"contain",
"multiple",
"certs",
"and",
"gives",
"you",
"back",
"a",
"proper",
"x509",
".",
"CertPool",
"for",
"your",
"fun",
"and",
"proffit"
] | [
"func",
"LoadCACertFile",
"(",
"cert",
"string",
")",
"(",
"*",
"x509",
".",
"CertPool",
",",
"error",
")",
"{",
"// validate caCert, and setup certpool",
"ca",
",",
"err",
":=",
"ioutil",
".",
"ReadFile",
"(",
"cert",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"err",
".",
"Error",
"(",
")",
")",
"\n",
"}",
"\n\n",
"certPool",
":=",
"x509",
".",
"NewCertPool",
"(",
")",
"\n",
"if",
"err",
":=",
"certPool",
".",
"AppendCertsFromPEM",
"(",
"<mask>",
")",
";",
"!",
"err",
"{",
"return",
"nil",
",",
"errors",
".",
"New",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"return",
"certPool",
",",
"nil",
"\n",
"}"
] |
24,482 | all-24483 | [
"ResetOffset",
"marks",
"the",
"provided",
"message",
"as",
"processed",
"alongside",
"a",
"metadata",
"string",
"that",
"represents",
"the",
"state",
"of",
"the",
"partition",
"consumer",
"at",
"that",
"point",
"in",
"time",
".",
"The",
"metadata",
"string",
"can",
"be",
"used",
"by",
"another",
"consumer",
"to",
"restore",
"that",
"state",
"so",
"it",
"can",
"resume",
"consumption",
".",
"Difference",
"between",
"ResetOffset",
"and",
"MarkOffset",
"is",
"that",
"it",
"allows",
"to",
"rewind",
"to",
"an",
"earlier",
"offset"
] | [
"func",
"(",
"c",
"*",
"<mask>",
")",
"ResetOffset",
"(",
"msg",
"*",
"sarama",
".",
"ConsumerMessage",
",",
"metadata",
"string",
")",
"{",
"if",
"sub",
":=",
"c",
".",
"subs",
".",
"Fetch",
"(",
"msg",
".",
"Topic",
",",
"msg",
".",
"Partition",
")",
";",
"sub",
"!=",
"nil",
"{",
"sub",
".",
"ResetOffset",
"(",
"msg",
".",
"Offset",
",",
"metadata",
")",
"\n",
"}",
"\n",
"}"
] |
24,483 | all-24484 | [
"UnmarshalJSON",
"supports",
"json",
".",
"Unmarshaler",
"interface"
] | [
"func",
"(",
"v",
"*",
"EventRequestPaused",
")",
"UnmarshalJSON",
"(",
"data",
"[",
"]",
"byte",
")",
"error",
"{",
"r",
":=",
"jlexer",
".",
"Lexer",
"{",
"Data",
":",
"data",
"}",
"\n",
"easyjsonC5a4559bDecodeGithubComChromedpCdprotoFetch8",
"(",
"&",
"r",
",",
"v",
")",
"\n",
"return",
"r",
".",
"<mask>",
"(",
")",
"\n",
"}"
] |
24,484 | all-24485 | [
"/",
"*",
"Inpaints",
"the",
"selected",
"region",
"in",
"the",
"image"
] | [
"func",
"Inpaint",
"(",
"src",
",",
"inpaint_mask",
",",
"dst",
"*",
"IplImage",
",",
"inpaintRange",
"float64",
",",
"<mask>",
"int",
")",
"{",
"C",
".",
"cvInpaint",
"(",
"unsafe",
".",
"Pointer",
"(",
"src",
")",
",",
"unsafe",
".",
"Pointer",
"(",
"inpaint_mask",
")",
",",
"unsafe",
".",
"Pointer",
"(",
"dst",
")",
",",
"C",
".",
"double",
"(",
"inpaintRange",
")",
",",
"C",
".",
"int",
"(",
"flags",
")",
",",
")",
"\n",
"}"
] |
24,485 | all-24486 | [
"UnmarshalJSON",
"supports",
"json",
".",
"Unmarshaler",
"interface"
] | [
"func",
"(",
"v",
"*",
"<mask>",
")",
"UnmarshalJSON",
"(",
"data",
"[",
"]",
"byte",
")",
"error",
"{",
"r",
":=",
"jlexer",
".",
"Lexer",
"{",
"Data",
":",
"data",
"}",
"\n",
"easyjsonC5a4559bDecodeGithubComChromedpCdprotoAccessibility1",
"(",
"&",
"r",
",",
"v",
")",
"\n",
"return",
"r",
".",
"Error",
"(",
")",
"\n",
"}"
] |
24,486 | all-24487 | [
"ListRecentBuildsForProject",
"fetches",
"the",
"list",
"of",
"recent",
"builds",
"for",
"the",
"given",
"repository",
"The",
"status",
"and",
"branch",
"parameters",
"are",
"used",
"to",
"further",
"filter",
"results",
"if",
"non",
"-",
"empty",
"If",
"limit",
"is",
"-",
"1",
"fetches",
"all",
"builds"
] | [
"func",
"(",
"c",
"*",
"Client",
")",
"ListRecentBuildsForProject",
"(",
"account",
",",
"repo",
",",
"branch",
",",
"status",
"string",
",",
"limit",
",",
"offset",
"int",
")",
"(",
"[",
"]",
"*",
"Build",
",",
"error",
")",
"{",
"path",
":=",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"account",
",",
"repo",
")",
"\n",
"if",
"branch",
"!=",
"\"",
"\"",
"{",
"path",
"=",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"path",
",",
"branch",
")",
"\n",
"}",
"\n\n",
"params",
":=",
"url",
".",
"Values",
"{",
"}",
"\n",
"if",
"status",
"!=",
"\"",
"\"",
"{",
"params",
".",
"Set",
"(",
"\"",
"\"",
",",
"<mask>",
")",
"\n",
"}",
"\n\n",
"return",
"c",
".",
"recentBuilds",
"(",
"path",
",",
"params",
",",
"limit",
",",
"offset",
")",
"\n",
"}"
] |
24,487 | all-24488 | [
"JSONDoc",
"loads",
"a",
"json",
"document",
"from",
"either",
"a",
"file",
"or",
"a",
"remote",
"url"
] | [
"func",
"JSONDoc",
"(",
"<mask>",
"string",
")",
"(",
"json",
".",
"RawMessage",
",",
"error",
")",
"{",
"data",
",",
"err",
":=",
"swag",
".",
"LoadFromFileOrHTTP",
"(",
"path",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"return",
"json",
".",
"RawMessage",
"(",
"data",
")",
",",
"nil",
"\n",
"}"
] |
24,488 | all-24489 | [
"UnmarshalJSON",
"supports",
"json",
".",
"Unmarshaler",
"interface"
] | [
"func",
"(",
"v",
"*",
"CoverageRange",
")",
"UnmarshalJSON",
"(",
"data",
"[",
"]",
"byte",
")",
"error",
"{",
"r",
":=",
"jlexer",
".",
"Lexer",
"{",
"Data",
":",
"data",
"}",
"\n",
"easyjsonC5a4559bDecodeGithubComChromedpCdprotoProfiler26",
"(",
"&",
"r",
",",
"v",
")",
"\n",
"return",
"r",
".",
"<mask>",
"(",
")",
"\n",
"}"
] |
24,489 | all-24490 | [
"/",
"*",
"decode",
"image",
"stored",
"in",
"the",
"buffer"
] | [
"func",
"DecodeImage",
"(",
"buf",
"unsafe",
".",
"Pointer",
",",
"iscolor",
"int",
")",
"*",
"IplImage",
"{",
"rv",
":=",
"C",
".",
"cvDecodeImage",
"(",
"(",
"*",
"C",
".",
"CvMat",
")",
"(",
"buf",
")",
",",
"C",
".",
"int",
"(",
"iscolor",
")",
")",
"\n",
"<mask>",
"(",
"*",
"IplImage",
")",
"(",
"rv",
")",
"\n",
"}"
] |
24,490 | all-24491 | [
"MarshalJSON",
"supports",
"json",
".",
"Marshaler",
"interface"
] | [
"func",
"(",
"v",
"Timings",
")",
"MarshalJSON",
"(",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"w",
":=",
"jwriter",
".",
"<mask>",
"{",
"}",
"\n",
"easyjsonC5a4559bEncodeGithubComChromedpCdprotoHar",
"(",
"&",
"w",
",",
"v",
")",
"\n",
"return",
"w",
".",
"Buffer",
".",
"BuildBytes",
"(",
")",
",",
"w",
".",
"Error",
"\n",
"}"
] |
24,491 | all-24492 | [
"Remove",
"implements",
"Remove",
"method",
"of",
"PlanService",
"interface"
] | [
"func",
"(",
"s",
"*",
"planService",
")",
"Remove",
"(",
"planName",
"string",
")",
"error",
"{",
"return",
"s",
".",
"storage",
".",
"Delete",
"(",
"appTypes",
".",
"Plan",
"{",
"<mask>",
":",
"planName",
"}",
")",
"\n",
"}"
] |
24,492 | all-24493 | [
"title",
":",
"volume",
"plan",
"list",
"path",
":",
"/",
"volumeplans",
"method",
":",
"GET",
"produce",
":",
"application",
"/",
"json",
"responses",
":",
"200",
":",
"List",
"volume",
"plans",
"401",
":",
"Unauthorized"
] | [
"func",
"volumePlansList",
"(",
"w",
"http",
".",
"ResponseWriter",
",",
"r",
"*",
"http",
".",
"<mask>",
",",
"t",
"auth",
".",
"Token",
")",
"error",
"{",
"contexts",
":=",
"permission",
".",
"ContextsForPermission",
"(",
"t",
",",
"permission",
".",
"PermVolumeCreate",
")",
"\n",
"if",
"len",
"(",
"contexts",
")",
"==",
"0",
"{",
"return",
"permission",
".",
"ErrUnauthorized",
"\n",
"}",
"\n",
"plansProvisioners",
",",
"err",
":=",
"volume",
".",
"ListPlans",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"if",
"len",
"(",
"plansProvisioners",
")",
"==",
"0",
"{",
"w",
".",
"WriteHeader",
"(",
"http",
".",
"StatusNoContent",
")",
"\n",
"return",
"nil",
"\n",
"}",
"\n",
"w",
".",
"Header",
"(",
")",
".",
"Set",
"(",
"\"",
"\"",
",",
"\"",
"\"",
")",
"\n",
"return",
"json",
".",
"NewEncoder",
"(",
"w",
")",
".",
"Encode",
"(",
"plansProvisioners",
")",
"\n",
"}"
] |
24,493 | all-24494 | [
"GetId",
"returns",
"the",
"Id",
"field",
"if",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"."
] | [
"func",
"(",
"d",
"*",
"Dashboard",
")",
"GetId",
"(",
")",
"int",
"{",
"if",
"d",
"==",
"nil",
"||",
"d",
".",
"Id",
"==",
"nil",
"{",
"return",
"0",
"\n",
"}",
"\n",
"return",
"*",
"d",
".",
"<mask>",
"\n",
"}"
] |
24,494 | all-24495 | [
"Claim",
"returns",
"true",
"if",
"incoming",
"request",
"can",
"claim",
"for",
"a",
"cached",
"handler",
"the",
"original",
"handler",
"should",
"run",
"as",
"it",
"is",
"and",
"exit"
] | [
"func",
"(",
"v",
"*",
"validatorRule",
")",
"Claim",
"(",
"r",
"*",
"http",
".",
"Request",
")",
"bool",
"{",
"// check for pre-cache validators, if at least one of them return false",
"// for this specific request, then skip the whole cache",
"for",
"_",
",",
"shouldProcess",
":=",
"range",
"v",
".",
"preValidators",
"{",
"if",
"!",
"shouldProcess",
"(",
"r",
")",
"{",
"return",
"false",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"<mask>",
"\n",
"}"
] |
24,495 | all-24496 | [
"UnmarshalEasyJSON",
"sets",
"the",
"Base64",
"from",
"a",
"easyjson",
".",
"Lexer"
] | [
"func",
"(",
"b",
"*",
"Base64",
")",
"UnmarshalEasyJSON",
"(",
"in",
"*",
"jlexer",
".",
"Lexer",
")",
"{",
"if",
"data",
":=",
"in",
".",
"String",
"(",
")",
";",
"in",
".",
"Ok",
"(",
")",
"{",
"enc",
":=",
"base64",
".",
"StdEncoding",
"\n",
"dbuf",
":=",
"make",
"(",
"[",
"]",
"byte",
",",
"enc",
".",
"DecodedLen",
"(",
"len",
"(",
"<mask>",
")",
")",
")",
"\n\n",
"n",
",",
"err",
":=",
"enc",
".",
"Decode",
"(",
"dbuf",
",",
"[",
"]",
"byte",
"(",
"data",
")",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"in",
".",
"AddError",
"(",
"err",
")",
"\n",
"return",
"\n",
"}",
"\n\n",
"*",
"b",
"=",
"dbuf",
"[",
":",
"n",
"]",
"\n",
"}",
"\n",
"}"
] |
24,496 | all-24497 | [
"Dequeue",
"returns",
"Enqueue",
"()",
"d",
"elements",
"in",
"FIFO",
"order",
".",
"If",
"the",
"queue",
"is",
"empty",
"Dequeue",
"blocks",
"until",
"elements",
"are",
"available",
"."
] | [
"func",
"(",
"q",
"*",
"Queue",
")",
"Dequeue",
"(",
")",
"(",
"string",
",",
"error",
")",
"{",
"// TODO: fewer round trips by fetching more than one key",
"resp",
",",
"err",
":=",
"q",
".",
"client",
".",
"Get",
"(",
"q",
".",
"ctx",
",",
"q",
".",
"keyPrefix",
",",
"v3",
".",
"WithFirstRev",
"(",
")",
"...",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"\"",
"\"",
",",
"err",
"\n",
"}",
"\n\n",
"kv",
",",
"err",
":=",
"claimFirstKey",
"(",
"q",
".",
"<mask>",
",",
"resp",
".",
"Kvs",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"\"",
"\"",
",",
"err",
"\n",
"}",
"else",
"if",
"kv",
"!=",
"nil",
"{",
"return",
"string",
"(",
"kv",
".",
"Value",
")",
",",
"nil",
"\n",
"}",
"else",
"if",
"resp",
".",
"More",
"{",
"// missed some items, retry to read in more",
"return",
"q",
".",
"Dequeue",
"(",
")",
"\n",
"}",
"\n\n",
"// nothing yet; wait on elements",
"ev",
",",
"err",
":=",
"WaitPrefixEvents",
"(",
"q",
".",
"client",
",",
"q",
".",
"keyPrefix",
",",
"resp",
".",
"Header",
".",
"Revision",
",",
"[",
"]",
"mvccpb",
".",
"Event_EventType",
"{",
"mvccpb",
".",
"PUT",
"}",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"\"",
"\"",
",",
"err",
"\n",
"}",
"\n\n",
"ok",
",",
"err",
":=",
"deleteRevKey",
"(",
"q",
".",
"client",
",",
"string",
"(",
"ev",
".",
"Kv",
".",
"Key",
")",
",",
"ev",
".",
"Kv",
".",
"ModRevision",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"\"",
"\"",
",",
"err",
"\n",
"}",
"else",
"if",
"!",
"ok",
"{",
"return",
"q",
".",
"Dequeue",
"(",
")",
"\n",
"}",
"\n",
"return",
"string",
"(",
"ev",
".",
"Kv",
".",
"Value",
")",
",",
"err",
"\n",
"}"
] |
24,497 | all-24498 | [
"Keys",
"returns",
"all",
"keys",
"defined",
"in",
"the",
"schema"
] | [
"func",
"(",
"s",
"Schema",
")",
"Keys",
"(",
")",
"[",
"]",
"string",
"{",
"keys",
":=",
"make",
"(",
"[",
"]",
"string",
",",
"len",
"(",
"s",
")",
")",
"\n",
"i",
":=",
"0",
"\n",
"for",
"<mask>",
":=",
"range",
"s",
"{",
"keys",
"[",
"i",
"]",
"=",
"key",
"\n",
"i",
"++",
"\n",
"}",
"\n",
"sort",
".",
"Strings",
"(",
"keys",
")",
"\n",
"return",
"keys",
"\n",
"}"
] |
24,498 | all-24499 | [
"GetUrlOk",
"returns",
"a",
"tuple",
"with",
"the",
"Url",
"field",
"if",
"it",
"s",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"and",
"a",
"boolean",
"to",
"check",
"if",
"the",
"value",
"has",
"been",
"set",
"."
] | [
"func",
"(",
"b",
"*",
"Board",
")",
"GetUrlOk",
"(",
")",
"(",
"string",
",",
"bool",
")",
"{",
"if",
"b",
"==",
"nil",
"||",
"b",
".",
"Url",
"==",
"nil",
"{",
"return",
"\"",
"\"",
",",
"<mask>",
"\n",
"}",
"\n",
"return",
"*",
"b",
".",
"Url",
",",
"true",
"\n",
"}"
] |
24,499 | all-24500 | [
"NewImage",
"returns",
"a",
"types",
".",
"ImageCloser",
"for",
"this",
"reference",
"possibly",
"specialized",
"for",
"this",
"ImageTransport",
".",
"The",
"caller",
"must",
"call",
".",
"Close",
"()",
"on",
"the",
"returned",
"ImageCloser",
".",
"NOTE",
":",
"If",
"any",
"kind",
"of",
"signature",
"verification",
"should",
"happen",
"build",
"an",
"UnparsedImage",
"from",
"the",
"value",
"returned",
"by",
"NewImageSource",
"verify",
"that",
"UnparsedImage",
"and",
"convert",
"it",
"into",
"a",
"real",
"Image",
"via",
"image",
".",
"FromUnparsedImage",
".",
"WARNING",
":",
"This",
"may",
"not",
"do",
"the",
"right",
"thing",
"for",
"a",
"manifest",
"list",
"see",
"image",
".",
"FromSource",
"for",
"details",
"."
] | [
"func",
"(",
"ref",
"openshiftReference",
")",
"NewImage",
"(",
"ctx",
"context",
".",
"<mask>",
",",
"sys",
"*",
"types",
".",
"SystemContext",
")",
"(",
"types",
".",
"ImageCloser",
",",
"error",
")",
"{",
"src",
",",
"err",
":=",
"newImageSource",
"(",
"sys",
",",
"ref",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"return",
"genericImage",
".",
"FromSource",
"(",
"ctx",
",",
"sys",
",",
"src",
")",
"\n",
"}"
] |