id
int32 0
25.3k
| idx
stringlengths 5
9
| nl_tokens
listlengths 1
418
| pl_tokens
listlengths 22
4.98k
|
---|---|---|---|
22,300 | all-22301 | [
"SetBool",
"is",
"a",
"wrapper",
"around",
"g_value_set_boolean",
"()",
"."
] | [
"func",
"(",
"v",
"*",
"<mask>",
")",
"SetBool",
"(",
"val",
"bool",
")",
"{",
"C",
".",
"g_value_set_boolean",
"(",
"v",
".",
"native",
"(",
")",
",",
"gbool",
"(",
"val",
")",
")",
"\n",
"}"
] |
22,301 | all-22302 | [
"flushLog",
"attempts",
"to",
"flush",
"any",
"pending",
"logs",
"to",
"the",
"appserver",
".",
"It",
"should",
"not",
"be",
"called",
"concurrently",
"."
] | [
"func",
"(",
"c",
"*",
"context",
")",
"flushLog",
"(",
"force",
"bool",
")",
"(",
"flushed",
"bool",
")",
"{",
"c",
".",
"pendingLogs",
".",
"Lock",
"(",
")",
"\n",
"// Grab up to 30 MB. We can get away with up to 32 MB, but let's be cautious.",
"n",
",",
"rem",
":=",
"0",
",",
"30",
"<<",
"20",
"\n",
"for",
";",
"n",
"<",
"len",
"(",
"c",
".",
"pendingLogs",
".",
"lines",
")",
";",
"n",
"++",
"{",
"ll",
":=",
"c",
".",
"pendingLogs",
".",
"lines",
"[",
"n",
"]",
"\n",
"// Each log line will require about 3 bytes of overhead.",
"nb",
":=",
"proto",
".",
"Size",
"(",
"ll",
")",
"+",
"3",
"\n",
"if",
"nb",
">",
"rem",
"{",
"break",
"\n",
"}",
"\n",
"rem",
"-=",
"nb",
"\n",
"}",
"\n",
"lines",
":=",
"c",
".",
"pendingLogs",
".",
"lines",
"[",
":",
"n",
"]",
"\n",
"c",
".",
"pendingLogs",
".",
"lines",
"=",
"c",
".",
"pendingLogs",
".",
"lines",
"[",
"n",
":",
"]",
"\n",
"c",
".",
"pendingLogs",
".",
"Unlock",
"(",
")",
"\n\n",
"if",
"len",
"(",
"lines",
")",
"==",
"0",
"&&",
"!",
"force",
"{",
"// Nothing to flush.",
"return",
"false",
"\n",
"}",
"\n\n",
"rescueLogs",
":=",
"false",
"\n",
"defer",
"func",
"(",
")",
"{",
"if",
"rescueLogs",
"{",
"c",
".",
"pendingLogs",
".",
"Lock",
"(",
")",
"\n",
"c",
".",
"pendingLogs",
".",
"lines",
"=",
"append",
"(",
"lines",
",",
"c",
".",
"pendingLogs",
".",
"<mask>",
"...",
")",
"\n",
"c",
".",
"pendingLogs",
".",
"Unlock",
"(",
")",
"\n",
"}",
"\n",
"}",
"(",
")",
"\n\n",
"buf",
",",
"err",
":=",
"proto",
".",
"Marshal",
"(",
"&",
"logpb",
".",
"UserAppLogGroup",
"{",
"LogLine",
":",
"lines",
",",
"}",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"log",
".",
"Printf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"rescueLogs",
"=",
"true",
"\n",
"return",
"false",
"\n",
"}",
"\n\n",
"req",
":=",
"&",
"logpb",
".",
"FlushRequest",
"{",
"Logs",
":",
"buf",
",",
"}",
"\n",
"res",
":=",
"&",
"basepb",
".",
"VoidProto",
"{",
"}",
"\n",
"c",
".",
"pendingLogs",
".",
"Lock",
"(",
")",
"\n",
"c",
".",
"pendingLogs",
".",
"flushes",
"++",
"\n",
"c",
".",
"pendingLogs",
".",
"Unlock",
"(",
")",
"\n",
"if",
"err",
":=",
"Call",
"(",
"toContext",
"(",
"c",
")",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"req",
",",
"res",
")",
";",
"err",
"!=",
"nil",
"{",
"log",
".",
"Printf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"rescueLogs",
"=",
"true",
"\n",
"return",
"false",
"\n",
"}",
"\n",
"return",
"true",
"\n",
"}"
] |
22,302 | all-22303 | [
"SetReadDeadline",
"mocks",
"base",
"method"
] | [
"func",
"(",
"m",
"*",
"MockClientServer",
")",
"SetReadDeadline",
"(",
"arg0",
"<mask>",
".",
"Time",
")",
"error",
"{",
"ret",
":=",
"m",
".",
"ctrl",
".",
"Call",
"(",
"m",
",",
"\"",
"\"",
",",
"arg0",
")",
"\n",
"ret0",
",",
"_",
":=",
"ret",
"[",
"0",
"]",
".",
"(",
"error",
")",
"\n",
"return",
"ret0",
"\n",
"}"
] |
22,303 | all-22304 | [
"buf",
"returns",
"the",
"buffer",
"of",
"the",
"current",
"token",
"."
] | [
"func",
"(",
"l",
"*",
"promlexer",
")",
"buf",
"(",
")",
"[",
"]",
"byte",
"{",
"return",
"l",
".",
"b",
"[",
"l",
".",
"<mask>",
":",
"l",
".",
"i",
"]",
"\n",
"}"
] |
22,304 | all-22305 | [
"Handler",
"handles",
"functions",
"of",
"type",
"GoannaHandlerFunc"
] | [
"func",
"<mask>",
"(",
"gf",
"GoannaHandlerFunc",
")",
"http",
".",
"HandlerFunc",
"{",
"return",
"func",
"(",
"w",
"http",
".",
"ResponseWriter",
",",
"r",
"*",
"http",
".",
"Request",
")",
"{",
"gr",
":=",
"&",
"Request",
"{",
"Request",
":",
"r",
"}",
"\n",
"gf",
"(",
"gr",
")",
".",
"Send",
"(",
"w",
")",
"\n",
"}",
"\n",
"}"
] |
22,305 | all-22306 | [
"MustV0",
"retrieves",
"the",
"V0",
"value",
"from",
"the",
"union",
"panicing",
"if",
"the",
"value",
"is",
"not",
"set",
"."
] | [
"func",
"(",
"u",
"AuthenticatedMessage",
")",
"MustV0",
"(",
")",
"AuthenticatedMessageV0",
"{",
"val",
",",
"<mask>",
":=",
"u",
".",
"GetV0",
"(",
")",
"\n\n",
"if",
"!",
"ok",
"{",
"panic",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"return",
"val",
"\n",
"}"
] |
22,306 | all-22307 | [
"Remove",
"a",
"key",
"from",
"the",
"node",
"list"
] | [
"func",
"(",
"l",
"*",
"NodeList",
")",
"Remove",
"(",
"key",
"[",
"]",
"byte",
")",
"*",
"skiplist",
".",
"Node",
"{",
"var",
"prev",
"*",
"skiplist",
".",
"<mask>",
"\n",
"node",
":=",
"l",
".",
"head",
"\n",
"for",
"node",
"!=",
"nil",
"{",
"nodeKey",
":=",
"(",
"*",
"Item",
")",
"(",
"node",
".",
"Item",
"(",
")",
")",
".",
"Bytes",
"(",
")",
"\n",
"if",
"bytes",
".",
"Equal",
"(",
"nodeKey",
",",
"key",
")",
"{",
"if",
"prev",
"==",
"nil",
"{",
"l",
".",
"head",
"=",
"node",
".",
"GetLink",
"(",
")",
"\n",
"return",
"node",
"\n",
"}",
"\n\n",
"prev",
".",
"SetLink",
"(",
"node",
".",
"GetLink",
"(",
")",
")",
"\n",
"return",
"node",
"\n",
"}",
"\n",
"prev",
"=",
"node",
"\n",
"node",
"=",
"node",
".",
"GetLink",
"(",
")",
"\n",
"}",
"\n\n",
"return",
"nil",
"\n",
"}"
] |
22,307 | all-22308 | [
"Check",
"Schedulers",
"It",
"verifies",
"your",
"scheduler",
"configuration",
"and",
"validates",
"related",
"confs",
"."
] | [
"func",
"checkScheduler",
"(",
")",
"error",
"{",
"if",
"servers",
",",
"err",
":=",
"config",
".",
"Get",
"(",
"\"",
"\"",
")",
";",
"err",
"==",
"nil",
"&&",
"servers",
"!=",
"nil",
"{",
"return",
"<mask>",
".",
"Errorf",
"(",
"`Using docker:servers is deprecated, please remove it your config and use \"tsuru docker-node-add\" do add docker nodes.`",
")",
"\n",
"}",
"\n",
"isSegregate",
",",
"err",
":=",
"config",
".",
"GetBool",
"(",
"\"",
"\"",
")",
"\n",
"if",
"err",
"==",
"nil",
"{",
"if",
"isSegregate",
"{",
"return",
"config",
".",
"NewWarning",
"(",
"`Setting \"docker:segregate\" is not necessary anymore, this is the default behavior from now on.`",
")",
"\n",
"}",
"else",
"{",
"return",
"errors",
".",
"Errorf",
"(",
"`You must remove \"docker:segregate\" from your config.`",
")",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
] |
22,308 | all-22309 | [
"Process",
"does",
"the",
"main",
"job",
":",
"It",
"tries",
"to",
"get",
"the",
"value",
"of",
"Remaining",
"rate",
"just",
"before",
"the",
"token",
"gets",
"reset",
".",
"It",
"does",
"that",
"more",
"and",
"more",
"often",
"(",
"as",
"the",
"reset",
"date",
"gets",
"closer",
")",
"to",
"get",
"the",
"most",
"accurate",
"value",
"."
] | [
"func",
"(",
"t",
"TokenHandler",
")",
"Process",
"(",
")",
"{",
"lastRate",
",",
"err",
":=",
"t",
".",
"getCoreRate",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"glog",
".",
"Fatalf",
"(",
"\"",
"\"",
",",
"t",
".",
"login",
",",
"err",
")",
"\n",
"}",
"\n\n",
"for",
"{",
"halfPeriod",
":=",
"lastRate",
".",
"Reset",
".",
"Time",
".",
"Sub",
"(",
"time",
".",
"Now",
"(",
")",
")",
"/",
"2",
"\n",
"time",
".",
"Sleep",
"(",
"halfPeriod",
")",
"\n",
"newRate",
",",
"err",
":=",
"t",
".",
"getCoreRate",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"glog",
".",
"Error",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"continue",
"\n",
"}",
"\n",
"// There is a bug in GitHub. They seem to reset the Remaining value before resetting the Reset value.",
"if",
"!",
"newRate",
".",
"Reset",
".",
"Time",
".",
"Equal",
"(",
"lastRate",
".",
"Reset",
".",
"Time",
")",
"||",
"newRate",
".",
"Remaining",
">",
"lastRate",
".",
"Remaining",
"{",
"if",
"err",
":=",
"t",
".",
"influxdb",
".",
"Push",
"(",
"\"",
"\"",
",",
"map",
"[",
"string",
"]",
"string",
"{",
"\"",
"\"",
":",
"t",
".",
"login",
"}",
",",
"map",
"[",
"string",
"]",
"interface",
"{",
"}",
"{",
"\"",
"\"",
":",
"lastRate",
".",
"Limit",
"-",
"lastRate",
".",
"Remaining",
"}",
",",
"lastRate",
".",
"Reset",
".",
"Time",
",",
")",
";",
"err",
"!=",
"nil",
"{",
"glog",
".",
"Error",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"}",
"\n",
"// Make sure the timer is properly reset, and we have time anyway",
"time",
".",
"Sleep",
"(",
"30",
"*",
"time",
".",
"Minute",
")",
"\n",
"for",
"{",
"newRate",
",",
"err",
"=",
"t",
".",
"getCoreRate",
"(",
")",
"\n",
"if",
"err",
"==",
"nil",
"{",
"<mask>",
"\n",
"}",
"\n",
"glog",
".",
"Error",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"time",
".",
"Sleep",
"(",
"time",
".",
"Minute",
")",
"\n",
"}",
"\n\n",
"}",
"\n",
"lastRate",
"=",
"newRate",
"\n",
"}",
"\n",
"}"
] |
22,309 | all-22310 | [
"MarshalJSON",
"supports",
"json",
".",
"Marshaler",
"interface"
] | [
"func",
"(",
"v",
"SetFontSizesParams",
")",
"MarshalJSON",
"(",
")",
"(",
"[",
"]",
"<mask>",
",",
"error",
")",
"{",
"w",
":=",
"jwriter",
".",
"Writer",
"{",
"}",
"\n",
"easyjsonC5a4559bEncodeGithubComChromedpCdprotoPage9",
"(",
"&",
"w",
",",
"v",
")",
"\n",
"return",
"w",
".",
"Buffer",
".",
"BuildBytes",
"(",
")",
",",
"w",
".",
"Error",
"\n",
"}"
] |
22,310 | all-22311 | [
"GetColorOk",
"returns",
"a",
"tuple",
"with",
"the",
"Color",
"field",
"if",
"it",
"s",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"and",
"a",
"boolean",
"to",
"check",
"if",
"the",
"value",
"has",
"been",
"set",
"."
] | [
"func",
"(",
"f",
"*",
"FreeTextDefinition",
")",
"GetColorOk",
"(",
")",
"(",
"string",
",",
"bool",
")",
"{",
"if",
"f",
"==",
"nil",
"||",
"f",
".",
"Color",
"==",
"nil",
"{",
"return",
"\"",
"\"",
",",
"false",
"\n",
"}",
"\n",
"return",
"*",
"f",
".",
"Color",
",",
"<mask>",
"\n",
"}"
] |
22,311 | all-22312 | [
"GetSizeFormat",
"returns",
"the",
"SizeFormat",
"field",
"if",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"."
] | [
"func",
"(",
"t",
"*",
"TraceServiceDefinition",
")",
"GetSizeFormat",
"(",
")",
"string",
"{",
"if",
"t",
"==",
"nil",
"||",
"t",
".",
"SizeFormat",
"==",
"nil",
"{",
"<mask>",
"\"",
"\"",
"\n",
"}",
"\n",
"return",
"*",
"t",
".",
"SizeFormat",
"\n",
"}"
] |
22,312 | all-22313 | [
"Collect",
"adds",
"any",
"non",
"nil",
"errors",
"in",
"args",
"to",
"the",
"list",
"."
] | [
"func",
"(",
"list",
"*",
"ErrorList",
")",
"Collect",
"(",
"args",
"...",
"interface",
"{",
"}",
")",
"{",
"for",
"_",
",",
"a",
":=",
"range",
"args",
"{",
"if",
"err",
",",
"_",
":=",
"a",
".",
"(",
"error",
")",
";",
"err",
"!=",
"nil",
"{",
"*",
"list",
"=",
"append",
"(",
"*",
"<mask>",
",",
"err",
")",
"\n",
"}",
"\n",
"}",
"\n",
"}"
] |
22,313 | all-22314 | [
"Health",
"health",
"checks",
"pachd",
"it",
"returns",
"an",
"error",
"if",
"pachd",
"isn",
"t",
"healthy",
"."
] | [
"func",
"(",
"c",
"APIClient",
")",
"Health",
"(",
")",
"error",
"{",
"_",
",",
"err",
":=",
"c",
".",
"healthClient",
".",
"Health",
"(",
"c",
".",
"Ctx",
"(",
")",
",",
"&",
"<mask>",
".",
"Empty",
"{",
"}",
")",
"\n",
"return",
"grpcutil",
".",
"ScrubGRPC",
"(",
"err",
")",
"\n",
"}"
] |
22,314 | all-22315 | [
"Scan",
"satisfy",
"sql",
".",
"Scanner",
"interface",
"."
] | [
"func",
"(",
"b",
"*",
"Bag",
")",
"Scan",
"(",
"src",
"interface",
"{",
"}",
")",
"(",
"err",
"error",
")",
"{",
"<mask>",
"t",
":=",
"src",
".",
"(",
"type",
")",
"{",
"case",
"[",
"]",
"byte",
":",
"err",
"=",
"gob",
".",
"NewDecoder",
"(",
"bytes",
".",
"NewReader",
"(",
"t",
")",
")",
".",
"Decode",
"(",
"b",
")",
"\n",
"default",
":",
"return",
"errors",
".",
"New",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"return",
"\n",
"}"
] |
22,315 | all-22316 | [
"Sunday",
"sunday"
] | [
"func",
"(",
"<mask>",
"*",
"Now",
")",
"Sunday",
"(",
")",
"time",
".",
"Time",
"{",
"t",
":=",
"now",
".",
"BeginningOfDay",
"(",
")",
"\n",
"weekday",
":=",
"int",
"(",
"t",
".",
"Weekday",
"(",
")",
")",
"\n",
"if",
"weekday",
"==",
"0",
"{",
"return",
"t",
"\n",
"}",
"\n",
"return",
"t",
".",
"AddDate",
"(",
"0",
",",
"0",
",",
"(",
"7",
"-",
"weekday",
")",
")",
"\n",
"}"
] |
22,316 | all-22317 | [
"GetTitle",
"returns",
"the",
"Title",
"field",
"if",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"."
] | [
"func",
"(",
"a",
"*",
"AlertValueDefinition",
")",
"GetTitle",
"(",
")",
"<mask>",
"{",
"if",
"a",
"==",
"nil",
"||",
"a",
".",
"Title",
"==",
"nil",
"{",
"return",
"\"",
"\"",
"\n",
"}",
"\n",
"return",
"*",
"a",
".",
"Title",
"\n",
"}"
] |
22,317 | all-22318 | [
"MarshalJSON",
"supports",
"json",
".",
"Marshaler",
"interface"
] | [
"func",
"(",
"v",
"EventChildNodeRemoved",
")",
"MarshalJSON",
"(",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"w",
":=",
"jwriter",
".",
"Writer",
"{",
"}",
"\n",
"easyjsonC5a4559bEncodeGithubComChromedpCdprotoDom63",
"(",
"&",
"w",
",",
"v",
")",
"\n",
"return",
"w",
".",
"<mask>",
".",
"BuildBytes",
"(",
")",
",",
"w",
".",
"Error",
"\n",
"}"
] |
22,318 | all-22319 | [
"flattenClusterOrchestrationInfo",
"saves",
"a",
"ClusterOrchestrationInfo",
"into",
"the",
"supplied",
"ResourceData",
"."
] | [
"func",
"flattenClusterOrchestrationInfo",
"(",
"d",
"*",
"schema",
".",
"ResourceData",
",",
"obj",
"*",
"types",
".",
"ClusterOrchestrationInfo",
")",
"error",
"{",
"return",
"structure",
".",
"SetBatch",
"(",
"d",
",",
"map",
"[",
"string",
"]",
"<mask>",
"{",
"}",
"{",
"\"",
"\"",
":",
"obj",
".",
"DefaultVmReadiness",
".",
"PostReadyDelay",
",",
"\"",
"\"",
":",
"obj",
".",
"DefaultVmReadiness",
".",
"ReadyCondition",
",",
"}",
")",
"\n",
"}"
] |
22,319 | all-22320 | [
"SetMarginRight",
"is",
"a",
"wrapper",
"around",
"gtk_widget_set_margin_right",
"()",
"."
] | [
"func",
"(",
"v",
"*",
"Widget",
")",
"SetMarginRight",
"(",
"margin",
"int",
")",
"{",
"C",
".",
"gtk_widget_set_margin_right",
"(",
"v",
".",
"native",
"(",
")",
",",
"C",
".",
"gint",
"(",
"<mask>",
")",
")",
"\n",
"}"
] |
22,320 | all-22321 | [
"UnmarshalJSON",
"supports",
"json",
".",
"Unmarshaler",
"interface"
] | [
"func",
"(",
"v",
"*",
"ResourceTiming",
")",
"UnmarshalJSON",
"(",
"data",
"[",
"]",
"byte",
")",
"error",
"{",
"r",
":=",
"jlexer",
".",
"Lexer",
"{",
"Data",
":",
"data",
"}",
"\n",
"easyjsonC5a4559bDecodeGithubComChromedpCdprotoNetwork23",
"(",
"&",
"r",
",",
"v",
")",
"\n",
"return",
"r",
".",
"<mask>",
"(",
")",
"\n",
"}"
] |
22,321 | all-22322 | [
"SaveLastSync",
"saves",
"last",
"sync",
"time",
"in",
"Unix",
"to",
"a",
"volume"
] | [
"func",
"(",
"c",
"*",
"Controller",
")",
"SaveLastSync",
"(",
"lastSync",
"time",
".",
"Time",
")",
"error",
"{",
"if",
"c",
".",
"lastSyncFallback",
"==",
"\"",
"\"",
"{",
"return",
"nil",
"\n",
"}",
"\n\n",
"lastSyncUnix",
":=",
"strconv",
".",
"FormatInt",
"(",
"lastSync",
".",
"Unix",
"(",
")",
",",
"10",
")",
"\n",
"logrus",
".",
"Infof",
"(",
"\"",
"\"",
",",
"lastSyncUnix",
")",
"\n\n",
"tempFile",
",",
"err",
":=",
"ioutil",
".",
"TempFile",
"(",
"filepath",
".",
"Dir",
"(",
"c",
".",
"lastSyncFallback",
")",
",",
"\"",
"\"",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"defer",
"<mask>",
".",
"Remove",
"(",
"tempFile",
".",
"Name",
"(",
")",
")",
"\n\n",
"err",
"=",
"ioutil",
".",
"WriteFile",
"(",
"tempFile",
".",
"Name",
"(",
")",
",",
"[",
"]",
"byte",
"(",
"lastSyncUnix",
")",
",",
"0644",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"err",
"=",
"os",
".",
"Rename",
"(",
"tempFile",
".",
"Name",
"(",
")",
",",
"c",
".",
"lastSyncFallback",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"logrus",
".",
"WithError",
"(",
"err",
")",
".",
"Info",
"(",
"\"",
"\"",
")",
"\n",
"return",
"copyFile",
"(",
"tempFile",
".",
"Name",
"(",
")",
",",
"c",
".",
"lastSyncFallback",
")",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
] |
22,322 | all-22323 | [
"UnmarshalJSON",
"supports",
"json",
".",
"Unmarshaler",
"interface"
] | [
"func",
"(",
"v",
"*",
"GetBrowserSamplingProfileReturns",
")",
"UnmarshalJSON",
"(",
"data",
"[",
"]",
"<mask>",
")",
"error",
"{",
"r",
":=",
"jlexer",
".",
"Lexer",
"{",
"Data",
":",
"data",
"}",
"\n",
"easyjsonC5a4559bDecodeGithubComChromedpCdprotoMemory12",
"(",
"&",
"r",
",",
"v",
")",
"\n",
"return",
"r",
".",
"Error",
"(",
")",
"\n",
"}"
] |
22,323 | all-22324 | [
"UnmarshalJSON",
"supports",
"json",
".",
"Unmarshaler",
"interface"
] | [
"func",
"(",
"v",
"*",
"CustomPreview",
")",
"UnmarshalJSON",
"(",
"data",
"[",
"]",
"<mask>",
")",
"error",
"{",
"r",
":=",
"jlexer",
".",
"Lexer",
"{",
"Data",
":",
"data",
"}",
"\n",
"easyjsonC5a4559bDecodeGithubComChromedpCdprotoRuntime43",
"(",
"&",
"r",
",",
"v",
")",
"\n",
"return",
"r",
".",
"Error",
"(",
")",
"\n",
"}"
] |
22,324 | all-22325 | [
"NewDataFile",
"returns",
"a",
"new",
"file",
"based",
"data",
"buffer"
] | [
"func",
"NewDataFile",
"(",
"f",
"*",
"<mask>",
".",
"File",
")",
"(",
"*",
"Data",
",",
"error",
")",
"{",
"d",
":=",
"newData",
"(",
")",
"\n",
"return",
"d",
",",
"handleError",
"(",
"C",
".",
"gpgme_data_new_from_fd",
"(",
"&",
"d",
".",
"dh",
",",
"C",
".",
"int",
"(",
"f",
".",
"Fd",
"(",
")",
")",
")",
")",
"\n",
"}"
] |
22,325 | all-22326 | [
"MiddlewareFunc",
"makes",
"AuthBasicMiddleware",
"implement",
"the",
"Middleware",
"interface",
"."
] | [
"func",
"(",
"mw",
"*",
"AuthBasicMiddleware",
")",
"MiddlewareFunc",
"(",
"handler",
"HandlerFunc",
")",
"HandlerFunc",
"{",
"if",
"mw",
".",
"Realm",
"==",
"\"",
"\"",
"{",
"log",
".",
"Fatal",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"if",
"mw",
".",
"Authenticator",
"==",
"nil",
"{",
"log",
".",
"Fatal",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"if",
"mw",
".",
"Authorizator",
"==",
"nil",
"{",
"mw",
".",
"Authorizator",
"=",
"func",
"(",
"userId",
"string",
",",
"request",
"*",
"Request",
")",
"bool",
"{",
"return",
"true",
"\n",
"}",
"\n",
"}",
"\n\n",
"return",
"func",
"(",
"writer",
"ResponseWriter",
",",
"request",
"*",
"Request",
")",
"{",
"authHeader",
":=",
"request",
".",
"Header",
".",
"Get",
"(",
"\"",
"\"",
")",
"\n",
"if",
"authHeader",
"==",
"\"",
"\"",
"{",
"mw",
".",
"unauthorized",
"(",
"writer",
")",
"\n",
"return",
"\n",
"}",
"\n\n",
"providedUserId",
",",
"providedPassword",
",",
"err",
":=",
"mw",
".",
"decodeBasicAuthHeader",
"(",
"authHeader",
")",
"\n\n",
"if",
"err",
"!=",
"nil",
"{",
"Error",
"(",
"writer",
",",
"\"",
"\"",
",",
"<mask>",
".",
"StatusBadRequest",
")",
"\n",
"return",
"\n",
"}",
"\n\n",
"if",
"!",
"mw",
".",
"Authenticator",
"(",
"providedUserId",
",",
"providedPassword",
")",
"{",
"mw",
".",
"unauthorized",
"(",
"writer",
")",
"\n",
"return",
"\n",
"}",
"\n\n",
"if",
"!",
"mw",
".",
"Authorizator",
"(",
"providedUserId",
",",
"request",
")",
"{",
"mw",
".",
"unauthorized",
"(",
"writer",
")",
"\n",
"return",
"\n",
"}",
"\n\n",
"request",
".",
"Env",
"[",
"\"",
"\"",
"]",
"=",
"providedUserId",
"\n\n",
"handler",
"(",
"writer",
",",
"request",
")",
"\n",
"}",
"\n",
"}"
] |
22,326 | all-22327 | [
"Find",
"a",
"task",
"by",
"index",
"path",
"and",
"redirect",
"to",
"the",
"artifact",
"on",
"the",
"most",
"recent",
"run",
"with",
"the",
"given",
"name",
".",
"Note",
"that",
"multiple",
"calls",
"to",
"this",
"endpoint",
"may",
"return",
"artifacts",
"from",
"differen",
"tasks",
"if",
"a",
"new",
"task",
"is",
"inserted",
"into",
"the",
"index",
"between",
"calls",
".",
"Avoid",
"using",
"this",
"method",
"as",
"a",
"stable",
"link",
"to",
"multiple",
"connected",
"files",
"if",
"the",
"index",
"path",
"does",
"not",
"contain",
"a",
"unique",
"identifier",
".",
"For",
"example",
"the",
"following",
"two",
"links",
"may",
"return",
"unrelated",
"files",
":",
"*",
"https",
":",
"//",
"tc",
".",
"example",
".",
"com",
"/",
"api",
"/",
"index",
"/",
"v1",
"/",
"task",
"/",
"some",
"-",
"app",
".",
"win64",
".",
"latest",
".",
"installer",
"/",
"artifacts",
"/",
"public",
"/",
"installer",
".",
"exe",
"*",
"https",
":",
"//",
"tc",
".",
"example",
".",
"com",
"/",
"api",
"/",
"index",
"/",
"v1",
"/",
"task",
"/",
"some",
"-",
"app",
".",
"win64",
".",
"latest",
".",
"installer",
"/",
"artifacts",
"/",
"public",
"/",
"debug",
"-",
"symbols",
".",
"zip",
"This",
"problem",
"be",
"remedied",
"by",
"including",
"the",
"revision",
"in",
"the",
"index",
"path",
"or",
"by",
"bundling",
"both",
"installer",
"and",
"debug",
"symbols",
"into",
"a",
"single",
"artifact",
".",
"If",
"no",
"task",
"exists",
"for",
"the",
"given",
"index",
"path",
"this",
"API",
"end",
"-",
"point",
"responds",
"with",
"404",
".",
"Required",
"scopes",
":",
"If",
"private",
":",
"queue",
":",
"get",
"-",
"artifact",
":",
"<name",
">",
"See",
"#findArtifactFromTask"
] | [
"func",
"(",
"index",
"*",
"Index",
")",
"FindArtifactFromTask",
"(",
"indexPath",
",",
"name",
"string",
")",
"error",
"{",
"cd",
":=",
"tcclient",
".",
"Client",
"(",
"*",
"index",
")",
"\n",
"_",
",",
"_",
",",
"err",
":=",
"(",
"&",
"cd",
")",
".",
"APICall",
"(",
"nil",
",",
"\"",
"\"",
",",
"\"",
"\"",
"+",
"<mask>",
".",
"QueryEscape",
"(",
"indexPath",
")",
"+",
"\"",
"\"",
"+",
"url",
".",
"QueryEscape",
"(",
"name",
")",
",",
"nil",
",",
"nil",
")",
"\n",
"return",
"err",
"\n",
"}"
] |
22,327 | all-22328 | [
"GetOrgProjects",
"returns",
"the",
"list",
"of",
"projects",
"under",
"an",
"org"
] | [
"func",
"(",
"f",
"*",
"FakeClient",
")",
"GetOrgProjects",
"(",
"org",
"string",
")",
"(",
"[",
"]",
"github",
".",
"<mask>",
",",
"error",
")",
"{",
"return",
"f",
".",
"RepoProjects",
"[",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"org",
")",
"]",
",",
"nil",
"\n",
"}"
] |
22,328 | all-22329 | [
"the",
"_actual_",
"close",
"process",
"."
] | [
"func",
"(",
"p",
"*",
"process",
")",
"doClose",
"(",
")",
"{",
"// this function is only be called once (protected by p.Lock()).",
"// and it will panic (on closing channels) otherwise.",
"close",
"(",
"p",
".",
"closing",
")",
"// signal that we're shutting down (Closing)",
"\n\n",
"for",
"len",
"(",
"p",
".",
"<mask>",
")",
">",
"0",
"||",
"len",
"(",
"p",
".",
"waitfors",
")",
">",
"0",
"{",
"for",
"plc",
",",
"_",
":=",
"range",
"p",
".",
"children",
"{",
"child",
":=",
"plc",
".",
"Child",
"(",
")",
"\n",
"if",
"child",
"!=",
"nil",
"{",
"// check because child may already have been removed.",
"go",
"child",
".",
"Close",
"(",
")",
"// force all children to shut down",
"\n",
"}",
"\n",
"plc",
".",
"ParentClear",
"(",
")",
"\n",
"}",
"\n",
"p",
".",
"children",
"=",
"nil",
"// clear them. release memory.",
"\n\n",
"// we must be careful not to iterate over waitfors directly, as it may",
"// change under our feet.",
"wf",
":=",
"p",
".",
"waitfors",
"\n",
"p",
".",
"waitfors",
"=",
"nil",
"// clear them. release memory.",
"\n",
"for",
"w",
",",
"_",
":=",
"range",
"wf",
"{",
"// Here, we wait UNLOCKED, so that waitfors who are in the middle of",
"// adding a child to us can finish. we will immediately close the child.",
"p",
".",
"Unlock",
"(",
")",
"\n",
"<-",
"w",
".",
"ChildClosed",
"(",
")",
"// wait till all waitfors are fully closed (before teardown)",
"\n",
"p",
".",
"Lock",
"(",
")",
"\n",
"w",
".",
"ParentClear",
"(",
")",
"\n",
"}",
"\n",
"}",
"\n\n",
"if",
"p",
".",
"teardown",
"!=",
"nil",
"{",
"p",
".",
"closeErr",
"=",
"p",
".",
"teardown",
"(",
")",
"// actually run the close logic (ok safe to teardown)",
"\n",
"}",
"\n",
"close",
"(",
"p",
".",
"closed",
")",
"// signal that we're shut down (Closed)",
"\n\n",
"// go remove all the parents from the process links. optimization.",
"go",
"func",
"(",
"waiters",
"[",
"]",
"*",
"processLink",
")",
"{",
"for",
"_",
",",
"pl",
":=",
"range",
"waiters",
"{",
"pl",
".",
"ClearChild",
"(",
")",
"\n",
"pr",
",",
"ok",
":=",
"pl",
".",
"Parent",
"(",
")",
".",
"(",
"*",
"process",
")",
"\n",
"if",
"!",
"ok",
"{",
"// parent has already been called to close",
"continue",
"\n",
"}",
"\n",
"pr",
".",
"Lock",
"(",
")",
"\n",
"delete",
"(",
"pr",
".",
"waitfors",
",",
"pl",
")",
"\n",
"delete",
"(",
"pr",
".",
"children",
",",
"pl",
")",
"\n",
"pr",
".",
"Unlock",
"(",
")",
"\n",
"}",
"\n",
"}",
"(",
"p",
".",
"waiters",
")",
"// pass in so",
"\n",
"p",
".",
"waiters",
"=",
"nil",
"// clear them. release memory.",
"\n",
"}"
] |
22,329 | all-22330 | [
"/",
"*",
"func",
"(",
"r",
"*",
"Render",
")",
"HTML",
"(",
"status",
"int",
"name",
"string",
"binding",
"interface",
"{}",
"htmlOpt",
"...",
"HTMLRenderOptions",
")",
"{",
"opt",
":",
"=",
"r",
".",
"prepareHTMLRenderOptions",
"(",
"htmlOpt",
")",
"assign",
"a",
"layout",
"if",
"there",
"is",
"one",
"if",
"len",
"(",
"opt",
".",
"Layout",
")",
">",
"0",
"{",
"r",
".",
"addYield",
"(",
"name",
"binding",
")",
"name",
"=",
"opt",
".",
"Layout",
"}"
] | [
"func",
"(",
"r",
"*",
"Render",
")",
"HTML",
"(",
"status",
"int",
",",
"name",
"string",
",",
"binding",
"interface",
"{",
"}",
",",
"htmlOpt",
"...",
"HTMLRenderOptions",
")",
"{",
"out",
",",
"err",
":=",
"r",
".",
"renderBytes",
"(",
"name",
",",
"binding",
",",
"htmlOpt",
"...",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"http",
".",
"Error",
"(",
"r",
",",
"err",
".",
"Error",
"(",
")",
",",
"http",
".",
"StatusInternalServerError",
")",
"\n",
"return",
"\n",
"}",
"\n\n",
"r",
".",
"Header",
"(",
")",
".",
"Set",
"(",
"ContentType",
",",
"r",
".",
"opt",
".",
"HTMLContentType",
"+",
"r",
".",
"compiledCharset",
")",
"\n",
"r",
".",
"WriteHeader",
"(",
"<mask>",
")",
"\n",
"io",
".",
"Copy",
"(",
"r",
",",
"out",
")",
"\n\n",
"}"
] |
22,330 | all-22331 | [
"GetHashTreeTag",
"is",
"a",
"convenience",
"function",
"to",
"deserialize",
"a",
"HashTree",
"from",
"an",
"tagged",
"object",
"in",
"the",
"object",
"store",
"."
] | [
"func",
"GetHashTreeTag",
"(",
"pachClient",
"*",
"<mask>",
".",
"APIClient",
",",
"storageRoot",
"string",
",",
"treeRef",
"*",
"pfs",
".",
"Tag",
")",
"(",
"HashTree",
",",
"error",
")",
"{",
"return",
"getHashTree",
"(",
"storageRoot",
",",
"func",
"(",
"w",
"io",
".",
"Writer",
")",
"error",
"{",
"return",
"pachClient",
".",
"GetTag",
"(",
"treeRef",
".",
"Name",
",",
"w",
")",
"\n",
"}",
")",
"\n",
"}"
] |
22,331 | all-22332 | [
"dispatchEvent",
"sends",
"a",
"WatchResponse",
"to",
"the",
"appropriate",
"watcher",
"stream"
] | [
"func",
"(",
"w",
"*",
"watchGrpcStream",
")",
"dispatchEvent",
"(",
"pbresp",
"*",
"pb",
".",
"WatchResponse",
")",
"bool",
"{",
"events",
":=",
"make",
"(",
"[",
"]",
"*",
"<mask>",
",",
"len",
"(",
"pbresp",
".",
"Events",
")",
")",
"\n",
"for",
"i",
",",
"ev",
":=",
"range",
"pbresp",
".",
"Events",
"{",
"events",
"[",
"i",
"]",
"=",
"(",
"*",
"Event",
")",
"(",
"ev",
")",
"\n",
"}",
"\n",
"// TODO: return watch ID?",
"wr",
":=",
"&",
"WatchResponse",
"{",
"Header",
":",
"*",
"pbresp",
".",
"Header",
",",
"Events",
":",
"events",
",",
"CompactRevision",
":",
"pbresp",
".",
"CompactRevision",
",",
"Created",
":",
"pbresp",
".",
"Created",
",",
"Canceled",
":",
"pbresp",
".",
"Canceled",
",",
"cancelReason",
":",
"pbresp",
".",
"CancelReason",
",",
"}",
"\n\n",
"// watch IDs are zero indexed, so request notify watch responses are assigned a watch ID of -1 to",
"// indicate they should be broadcast.",
"if",
"wr",
".",
"IsProgressNotify",
"(",
")",
"&&",
"pbresp",
".",
"WatchId",
"==",
"-",
"1",
"{",
"return",
"w",
".",
"broadcastResponse",
"(",
"wr",
")",
"\n",
"}",
"\n\n",
"return",
"w",
".",
"unicastResponse",
"(",
"wr",
",",
"pbresp",
".",
"WatchId",
")",
"\n\n",
"}"
] |
22,332 | all-22333 | [
"AddRepoTags",
"adds",
"the",
"specified",
"tags",
"to",
"the",
"destination",
"s",
"repoTags",
"."
] | [
"func",
"(",
"d",
"*",
"Destination",
")",
"AddRepoTags",
"(",
"tags",
"[",
"]",
"reference",
".",
"NamedTagged",
")",
"{",
"d",
".",
"repoTags",
"=",
"<mask>",
"(",
"d",
".",
"repoTags",
",",
"tags",
"...",
")",
"\n",
"}"
] |
22,333 | all-22334 | [
"wait",
"until",
"more",
"than",
"n",
"bytes",
"have",
"been",
"written"
] | [
"func",
"(",
"c",
"*",
"<mask>",
")",
"wait",
"(",
"n",
"int64",
")",
"{",
"c",
".",
"mu",
".",
"Lock",
"(",
")",
"\n",
"defer",
"c",
".",
"mu",
".",
"Unlock",
"(",
")",
"\n",
"for",
"c",
".",
"n",
"<",
"n",
"{",
"c",
".",
"cond",
".",
"Wait",
"(",
")",
"\n",
"}",
"\n",
"}"
] |
22,334 | all-22335 | [
"WithAbortContext",
"specifies",
"the",
"context",
"for",
"permanently",
"aborting",
"the",
"transaction",
"."
] | [
"func",
"WithAbortContext",
"(",
"ctx",
"context",
".",
"<mask>",
")",
"stmOption",
"{",
"return",
"func",
"(",
"so",
"*",
"stmOptions",
")",
"{",
"so",
".",
"ctx",
"=",
"ctx",
"}",
"\n",
"}"
] |
22,335 | all-22336 | [
"MarshalJSON",
"supports",
"json",
".",
"Marshaler",
"interface"
] | [
"func",
"(",
"v",
"HighlightNodeParams",
")",
"MarshalJSON",
"(",
")",
"(",
"[",
"]",
"<mask>",
",",
"error",
")",
"{",
"w",
":=",
"jwriter",
".",
"Writer",
"{",
"}",
"\n",
"easyjsonC5a4559bEncodeGithubComChromedpCdprotoOverlay11",
"(",
"&",
"w",
",",
"v",
")",
"\n",
"return",
"w",
".",
"Buffer",
".",
"BuildBytes",
"(",
")",
",",
"w",
".",
"Error",
"\n",
"}"
] |
22,336 | all-22337 | [
"LoadFromPath",
"is",
"a",
"wrapper",
"around",
"gtk_css_provider_load_from_path",
"()",
"."
] | [
"func",
"(",
"v",
"*",
"CssProvider",
")",
"LoadFromPath",
"(",
"<mask>",
"string",
")",
"error",
"{",
"cpath",
":=",
"C",
".",
"CString",
"(",
"path",
")",
"\n",
"defer",
"C",
".",
"free",
"(",
"unsafe",
".",
"Pointer",
"(",
"cpath",
")",
")",
"\n",
"var",
"gerr",
"*",
"C",
".",
"GError",
"\n",
"if",
"C",
".",
"gtk_css_provider_load_from_path",
"(",
"v",
".",
"native",
"(",
")",
",",
"(",
"*",
"C",
".",
"gchar",
")",
"(",
"cpath",
")",
",",
"&",
"gerr",
")",
"==",
"0",
"{",
"defer",
"C",
".",
"g_error_free",
"(",
"gerr",
")",
"\n",
"return",
"errors",
".",
"New",
"(",
"goString",
"(",
"gerr",
".",
"message",
")",
")",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
] |
22,337 | all-22338 | [
"ReceiveIssue",
"is",
"a",
"wrapper",
"on",
"plugin",
".",
"ReceiveIssue",
"()"
] | [
"func",
"(",
"o",
"*",
"FakeCommentPluginWrapper",
")",
"ReceiveIssue",
"(",
"issue",
"sql",
".",
"Issue",
")",
"[",
"]",
"Point",
"{",
"// Pass through",
"return",
"o",
".",
"plugin",
".",
"ReceiveIssue",
"(",
"<mask>",
")",
"\n",
"}"
] |
22,338 | all-22339 | [
"PutBlob",
"writes",
"contents",
"of",
"stream",
"and",
"returns",
"data",
"representing",
"the",
"result",
"(",
"with",
"all",
"data",
"filled",
"in",
")",
".",
"inputInfo",
".",
"Digest",
"can",
"be",
"optionally",
"provided",
"if",
"known",
";",
"it",
"is",
"not",
"mandatory",
"for",
"the",
"implementation",
"to",
"verify",
"it",
".",
"inputInfo",
".",
"Size",
"is",
"the",
"expected",
"length",
"of",
"stream",
"if",
"known",
".",
"May",
"update",
"cache",
".",
"WARNING",
":",
"The",
"contents",
"of",
"stream",
"are",
"being",
"verified",
"on",
"the",
"fly",
".",
"Until",
"stream",
".",
"Read",
"()",
"returns",
"io",
".",
"EOF",
"the",
"contents",
"of",
"the",
"data",
"SHOULD",
"NOT",
"be",
"available",
"to",
"any",
"other",
"readers",
"for",
"download",
"using",
"the",
"supplied",
"digest",
".",
"If",
"stream",
".",
"Read",
"()",
"at",
"any",
"time",
"ESPECIALLY",
"at",
"end",
"of",
"input",
"returns",
"an",
"error",
"PutBlob",
"MUST",
"1",
")",
"fail",
"and",
"2",
")",
"delete",
"any",
"data",
"stored",
"so",
"far",
"."
] | [
"func",
"(",
"d",
"*",
"dockerImageDestination",
")",
"PutBlob",
"(",
"ctx",
"context",
".",
"Context",
",",
"stream",
"io",
".",
"Reader",
",",
"inputInfo",
"types",
".",
"BlobInfo",
",",
"cache",
"types",
".",
"BlobInfoCache",
",",
"isConfig",
"bool",
")",
"(",
"types",
".",
"BlobInfo",
",",
"error",
")",
"{",
"if",
"inputInfo",
".",
"Digest",
".",
"String",
"(",
")",
"!=",
"\"",
"\"",
"{",
"// This should not really be necessary, at least the copy code calls TryReusingBlob automatically.",
"// Still, we need to check, if only because the \"initiate upload\" endpoint does not have a documented \"blob already exists\" return value.",
"// But we do that with NoCache, so that it _only_ checks the primary destination, instead of trying all mount candidates _again_.",
"haveBlob",
",",
"reusedInfo",
",",
"err",
":=",
"d",
".",
"TryReusingBlob",
"(",
"ctx",
",",
"inputInfo",
",",
"<mask>",
".",
"NoCache",
",",
"false",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"types",
".",
"BlobInfo",
"{",
"}",
",",
"err",
"\n",
"}",
"\n",
"if",
"haveBlob",
"{",
"return",
"reusedInfo",
",",
"nil",
"\n",
"}",
"\n",
"}",
"\n\n",
"// FIXME? Chunked upload, progress reporting, etc.",
"uploadPath",
":=",
"fmt",
".",
"Sprintf",
"(",
"blobUploadPath",
",",
"reference",
".",
"Path",
"(",
"d",
".",
"ref",
".",
"ref",
")",
")",
"\n",
"logrus",
".",
"Debugf",
"(",
"\"",
"\"",
",",
"uploadPath",
")",
"\n",
"res",
",",
"err",
":=",
"d",
".",
"c",
".",
"makeRequest",
"(",
"ctx",
",",
"\"",
"\"",
",",
"uploadPath",
",",
"nil",
",",
"nil",
",",
"v2Auth",
",",
"nil",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"types",
".",
"BlobInfo",
"{",
"}",
",",
"err",
"\n",
"}",
"\n",
"defer",
"res",
".",
"Body",
".",
"Close",
"(",
")",
"\n",
"if",
"res",
".",
"StatusCode",
"!=",
"http",
".",
"StatusAccepted",
"{",
"logrus",
".",
"Debugf",
"(",
"\"",
"\"",
",",
"*",
"res",
")",
"\n",
"return",
"types",
".",
"BlobInfo",
"{",
"}",
",",
"errors",
".",
"Wrapf",
"(",
"client",
".",
"HandleErrorResponse",
"(",
"res",
")",
",",
"\"",
"\"",
",",
"uploadPath",
",",
"d",
".",
"c",
".",
"registry",
")",
"\n",
"}",
"\n",
"uploadLocation",
",",
"err",
":=",
"res",
".",
"Location",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"types",
".",
"BlobInfo",
"{",
"}",
",",
"errors",
".",
"Wrap",
"(",
"err",
",",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"digester",
":=",
"digest",
".",
"Canonical",
".",
"Digester",
"(",
")",
"\n",
"sizeCounter",
":=",
"&",
"sizeCounter",
"{",
"}",
"\n",
"tee",
":=",
"io",
".",
"TeeReader",
"(",
"stream",
",",
"io",
".",
"MultiWriter",
"(",
"digester",
".",
"Hash",
"(",
")",
",",
"sizeCounter",
")",
")",
"\n",
"res",
",",
"err",
"=",
"d",
".",
"c",
".",
"makeRequestToResolvedURL",
"(",
"ctx",
",",
"\"",
"\"",
",",
"uploadLocation",
".",
"String",
"(",
")",
",",
"map",
"[",
"string",
"]",
"[",
"]",
"string",
"{",
"\"",
"\"",
":",
"{",
"\"",
"\"",
"}",
"}",
",",
"tee",
",",
"inputInfo",
".",
"Size",
",",
"v2Auth",
",",
"nil",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"logrus",
".",
"Debugf",
"(",
"\"",
"\"",
",",
"res",
")",
"\n",
"return",
"types",
".",
"BlobInfo",
"{",
"}",
",",
"err",
"\n",
"}",
"\n",
"defer",
"res",
".",
"Body",
".",
"Close",
"(",
")",
"\n",
"computedDigest",
":=",
"digester",
".",
"Digest",
"(",
")",
"\n\n",
"uploadLocation",
",",
"err",
"=",
"res",
".",
"Location",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"types",
".",
"BlobInfo",
"{",
"}",
",",
"errors",
".",
"Wrap",
"(",
"err",
",",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"// FIXME: DELETE uploadLocation on failure (does not really work in docker/distribution servers, which incorrectly require the \"delete\" action in the token's scope)",
"locationQuery",
":=",
"uploadLocation",
".",
"Query",
"(",
")",
"\n",
"// TODO: check inputInfo.Digest == computedDigest https://github.com/containers/image/pull/70#discussion_r77646717",
"locationQuery",
".",
"Set",
"(",
"\"",
"\"",
",",
"computedDigest",
".",
"String",
"(",
")",
")",
"\n",
"uploadLocation",
".",
"RawQuery",
"=",
"locationQuery",
".",
"Encode",
"(",
")",
"\n",
"res",
",",
"err",
"=",
"d",
".",
"c",
".",
"makeRequestToResolvedURL",
"(",
"ctx",
",",
"\"",
"\"",
",",
"uploadLocation",
".",
"String",
"(",
")",
",",
"map",
"[",
"string",
"]",
"[",
"]",
"string",
"{",
"\"",
"\"",
":",
"{",
"\"",
"\"",
"}",
"}",
",",
"nil",
",",
"-",
"1",
",",
"v2Auth",
",",
"nil",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"types",
".",
"BlobInfo",
"{",
"}",
",",
"err",
"\n",
"}",
"\n",
"defer",
"res",
".",
"Body",
".",
"Close",
"(",
")",
"\n",
"if",
"res",
".",
"StatusCode",
"!=",
"http",
".",
"StatusCreated",
"{",
"logrus",
".",
"Debugf",
"(",
"\"",
"\"",
",",
"*",
"res",
")",
"\n",
"return",
"types",
".",
"BlobInfo",
"{",
"}",
",",
"errors",
".",
"Wrapf",
"(",
"client",
".",
"HandleErrorResponse",
"(",
"res",
")",
",",
"\"",
"\"",
",",
"uploadLocation",
")",
"\n",
"}",
"\n\n",
"logrus",
".",
"Debugf",
"(",
"\"",
"\"",
",",
"computedDigest",
")",
"\n",
"cache",
".",
"RecordKnownLocation",
"(",
"d",
".",
"ref",
".",
"Transport",
"(",
")",
",",
"bicTransportScope",
"(",
"d",
".",
"ref",
")",
",",
"computedDigest",
",",
"newBICLocationReference",
"(",
"d",
".",
"ref",
")",
")",
"\n",
"return",
"types",
".",
"BlobInfo",
"{",
"Digest",
":",
"computedDigest",
",",
"Size",
":",
"sizeCounter",
".",
"size",
"}",
",",
"nil",
"\n",
"}"
] |
22,339 | all-22340 | [
"MarshalJSON",
"supports",
"json",
".",
"Marshaler",
"interface"
] | [
"func",
"(",
"v",
"Cookie",
")",
"MarshalJSON",
"(",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"w",
":=",
"jwriter",
".",
"Writer",
"{",
"}",
"\n",
"easyjsonC5a4559bEncodeGithubComChromedpCdprotoHar12",
"(",
"&",
"w",
",",
"v",
")",
"\n",
"return",
"w",
".",
"Buffer",
".",
"BuildBytes",
"(",
")",
",",
"w",
".",
"<mask>",
"\n",
"}"
] |
22,340 | all-22341 | [
"draw",
"multiple",
"instances",
"of",
"a",
"set",
"of",
"elements",
"with",
"offset",
"applied",
"to",
"instanced",
"attributes"
] | [
"func",
"DrawElementsInstancedBaseInstance",
"(",
"mode",
"uint32",
",",
"<mask>",
"int32",
",",
"xtype",
"uint32",
",",
"indices",
"unsafe",
".",
"Pointer",
",",
"instancecount",
"int32",
",",
"baseinstance",
"uint32",
")",
"{",
"C",
".",
"glowDrawElementsInstancedBaseInstance",
"(",
"gpDrawElementsInstancedBaseInstance",
",",
"(",
"C",
".",
"GLenum",
")",
"(",
"mode",
")",
",",
"(",
"C",
".",
"GLsizei",
")",
"(",
"count",
")",
",",
"(",
"C",
".",
"GLenum",
")",
"(",
"xtype",
")",
",",
"indices",
",",
"(",
"C",
".",
"GLsizei",
")",
"(",
"instancecount",
")",
",",
"(",
"C",
".",
"GLuint",
")",
"(",
"baseinstance",
")",
")",
"\n",
"}"
] |
22,341 | all-22342 | [
"Flags",
"that",
"were",
"not",
"set",
"via",
"command",
"-",
"line",
"arguments",
"and",
"have",
"defaulted",
".",
"It",
"s",
"smart",
"enough",
"to",
"respect",
"a",
"flag",
"that",
"was",
"set",
"to",
"the",
"default",
"value",
"via",
"command",
"-",
"line",
"arguments",
".",
"Must",
"be",
"called",
"after",
"flag",
".",
"Parse",
"()"
] | [
"func",
"defaultedFlags",
"(",
")",
"[",
"]",
"string",
"{",
"m",
":=",
"make",
"(",
"map",
"[",
"string",
"]",
"bool",
")",
"\n\n",
"FlagSet",
".",
"VisitAll",
"(",
"func",
"(",
"f",
"*",
"flag",
".",
"Flag",
")",
"{",
"m",
"[",
"f",
".",
"<mask>",
"]",
"=",
"true",
"\n",
"}",
")",
"\n\n",
"FlagSet",
".",
"Visit",
"(",
"func",
"(",
"f",
"*",
"flag",
".",
"Flag",
")",
"{",
"delete",
"(",
"m",
",",
"f",
".",
"Name",
")",
"\n",
"}",
")",
"\n\n",
"s",
":=",
"make",
"(",
"[",
"]",
"string",
",",
"0",
")",
"\n\n",
"for",
"name",
",",
"_",
":=",
"range",
"m",
"{",
"s",
"=",
"append",
"(",
"s",
",",
"name",
")",
"\n",
"}",
"\n\n",
"return",
"s",
"\n",
"}"
] |
22,342 | all-22343 | [
"NewDiscovery",
"returns",
"a",
"new",
"OpenStack",
"Discoverer",
"which",
"periodically",
"refreshes",
"its",
"targets",
"."
] | [
"func",
"NewDiscovery",
"(",
"conf",
"*",
"SDConfig",
",",
"l",
"log",
".",
"Logger",
")",
"(",
"*",
"refresh",
".",
"Discovery",
",",
"error",
")",
"{",
"r",
",",
"err",
":=",
"newRefresher",
"(",
"conf",
",",
"l",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"return",
"refresh",
".",
"NewDiscovery",
"(",
"l",
",",
"\"",
"\"",
",",
"<mask>",
".",
"Duration",
"(",
"conf",
".",
"RefreshInterval",
")",
",",
"r",
".",
"refresh",
",",
")",
",",
"nil",
"\n\n",
"}"
] |
22,343 | all-22344 | [
"New",
"creates",
"a",
"new",
"configured",
"Vault",
"factory",
"."
] | [
"func",
"New",
"(",
"config",
"Config",
")",
"(",
"spec",
".",
"VaultFactory",
",",
"error",
")",
"{",
"newVaultFactory",
":=",
"&",
"vaultFactory",
"{",
"Config",
":",
"config",
",",
"}",
"\n\n",
"// Dependencies.",
"if",
"newVaultFactory",
".",
"<mask>",
"==",
"\"",
"\"",
"{",
"return",
"nil",
",",
"microerror",
".",
"Maskf",
"(",
"invalidConfigError",
",",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"if",
"newVaultFactory",
".",
"AdminToken",
"==",
"\"",
"\"",
"{",
"return",
"nil",
",",
"microerror",
".",
"Maskf",
"(",
"invalidConfigError",
",",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"return",
"newVaultFactory",
",",
"nil",
"\n",
"}"
] |
22,344 | all-22345 | [
"Must",
"be",
"called",
"while",
"appendLock",
"is",
"held",
"."
] | [
"func",
"(",
"mf",
"*",
"manifestFile",
")",
"rewrite",
"(",
")",
"error",
"{",
"// In Windows the files should be closed before doing a Rename.",
"if",
"err",
":=",
"mf",
".",
"fp",
".",
"Close",
"(",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"fp",
",",
"netCreations",
",",
"err",
":=",
"helpRewrite",
"(",
"mf",
".",
"<mask>",
",",
"&",
"mf",
".",
"manifest",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"mf",
".",
"fp",
"=",
"fp",
"\n",
"mf",
".",
"manifest",
".",
"Creations",
"=",
"netCreations",
"\n",
"mf",
".",
"manifest",
".",
"Deletions",
"=",
"0",
"\n\n",
"return",
"nil",
"\n",
"}"
] |
22,345 | all-22346 | [
"Compare",
"returns",
"result",
"of",
"comparison",
"between",
"two",
"versions"
] | [
"func",
"(",
"v",
"*",
"DottedVersion",
")",
"Compare",
"(",
"other",
"*",
"DottedVersion",
")",
"int",
"{",
"<mask>",
":=",
"compareInts",
"(",
"v",
".",
"Major",
",",
"other",
".",
"Major",
")",
"\n",
"if",
"result",
"!=",
"0",
"{",
"return",
"result",
"\n",
"}",
"\n",
"result",
"=",
"compareInts",
"(",
"v",
".",
"Minor",
",",
"other",
".",
"Minor",
")",
"\n",
"if",
"result",
"!=",
"0",
"{",
"return",
"result",
"\n",
"}",
"\n",
"return",
"compareInts",
"(",
"v",
".",
"Patch",
",",
"other",
".",
"Patch",
")",
"\n",
"}"
] |
22,346 | all-22347 | [
"HasQueryConfig",
"returns",
"a",
"boolean",
"if",
"a",
"field",
"has",
"been",
"set",
"."
] | [
"func",
"(",
"o",
"*",
"<mask>",
")",
"HasQueryConfig",
"(",
")",
"bool",
"{",
"if",
"o",
"!=",
"nil",
"&&",
"o",
".",
"QueryConfig",
"!=",
"nil",
"{",
"return",
"true",
"\n",
"}",
"\n\n",
"return",
"false",
"\n",
"}"
] |
22,347 | all-22348 | [
"ReadConsoleInput",
"reads",
"(",
"and",
"removes",
")",
"data",
"from",
"the",
"console",
"input",
"buffer",
".",
"See",
"https",
":",
"//",
"msdn",
".",
"microsoft",
".",
"com",
"/",
"en",
"-",
"us",
"/",
"library",
"/",
"windows",
"/",
"desktop",
"/",
"ms684961",
"(",
"v",
"=",
"vs",
".",
"85",
")",
".",
"aspx",
"."
] | [
"func",
"ReadConsoleInput",
"(",
"handle",
"uintptr",
",",
"buffer",
"[",
"]",
"INPUT_RECORD",
",",
"count",
"*",
"uint32",
")",
"error",
"{",
"r1",
",",
"r2",
",",
"err",
":=",
"readConsoleInputProc",
".",
"Call",
"(",
"handle",
",",
"uintptr",
"(",
"unsafe",
".",
"Pointer",
"(",
"&",
"<mask>",
"[",
"0",
"]",
")",
")",
",",
"uintptr",
"(",
"len",
"(",
"buffer",
")",
")",
",",
"uintptr",
"(",
"unsafe",
".",
"Pointer",
"(",
"count",
")",
")",
")",
"\n",
"use",
"(",
"buffer",
")",
"\n",
"return",
"checkError",
"(",
"r1",
",",
"r2",
",",
"err",
")",
"\n",
"}"
] |
22,348 | all-22349 | [
"resourceVSphereDatastoreClusterApplySDRSConfig",
"applies",
"the",
"SDRS",
"configuration",
"to",
"a",
"datastore",
"cluster",
"."
] | [
"func",
"resourceVSphereDatastoreClusterApplySDRSConfig",
"(",
"d",
"*",
"schema",
".",
"ResourceData",
",",
"meta",
"interface",
"{",
"}",
",",
"pod",
"*",
"object",
".",
"StoragePod",
")",
"error",
"{",
"// This is a no-op if there is no SDRS config changed",
"if",
"!",
"resourceVSphereDatastoreClusterHasSDRSConfigChange",
"(",
"d",
")",
"{",
"log",
".",
"Printf",
"(",
"\"",
"\"",
",",
"resourceVSphereDatastoreClusterIDString",
"(",
"d",
")",
")",
"\n",
"return",
"nil",
"\n",
"}",
"\n\n",
"log",
".",
"Printf",
"(",
"\"",
"\"",
",",
"resourceVSphereDatastoreClusterIDString",
"(",
"d",
")",
")",
"\n",
"client",
":=",
"meta",
".",
"(",
"*",
"VSphereClient",
")",
".",
"vimClient",
"\n",
"if",
"err",
":=",
"viapi",
".",
"ValidateVirtualCenter",
"(",
"client",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"// Get the version of the vSphere connection to help determine what",
"// attributes we need to set",
"version",
":=",
"viapi",
".",
"ParseVersionFromClient",
"(",
"<mask>",
")",
"\n\n",
"// Expand the SDRS configuration.",
"spec",
":=",
"types",
".",
"StorageDrsConfigSpec",
"{",
"PodConfigSpec",
":",
"expandStorageDrsPodConfigSpec",
"(",
"d",
",",
"version",
")",
",",
"}",
"\n\n",
"return",
"storagepod",
".",
"ApplyDRSConfiguration",
"(",
"client",
",",
"pod",
",",
"spec",
")",
"\n",
"}"
] |
22,349 | all-22350 | [
"initState",
"Initializes",
"the",
"Sponge",
"State",
".",
"The",
"first",
"512",
"bits",
"are",
"set",
"to",
"zeros",
"and",
"the",
"remainder",
"receive",
"Blake2b",
"s",
"IV",
"as",
"per",
"Blake2b",
"s",
"specification",
".",
"<b",
">",
"Note",
":",
"<",
"/",
"b",
">",
"Even",
"though",
"sponges",
"typically",
"have",
"their",
"internal",
"state",
"initialized",
"with",
"zeros",
"Blake2b",
"s",
"G",
"function",
"has",
"a",
"fixed",
"point",
":",
"if",
"the",
"internal",
"state",
"and",
"message",
"are",
"both",
"filled",
"with",
"zeros",
".",
"the",
"resulting",
"permutation",
"will",
"always",
"be",
"a",
"block",
"filled",
"with",
"zeros",
";",
"this",
"happens",
"because",
"Blake2b",
"does",
"not",
"use",
"the",
"constants",
"originally",
"employed",
"in",
"Blake2",
"inside",
"its",
"G",
"function",
"relying",
"on",
"the",
"IV",
"for",
"avoiding",
"possible",
"fixed",
"points",
"."
] | [
"func",
"initState",
"(",
")",
"[",
"]",
"uint64",
"{",
"state",
":=",
"make",
"(",
"[",
"]",
"uint64",
",",
"16",
")",
"\n",
"state",
"[",
"8",
"]",
"=",
"blake2bIV",
"[",
"0",
"]",
"\n",
"<mask>",
"[",
"9",
"]",
"=",
"blake2bIV",
"[",
"1",
"]",
"\n",
"state",
"[",
"10",
"]",
"=",
"blake2bIV",
"[",
"2",
"]",
"\n",
"state",
"[",
"11",
"]",
"=",
"blake2bIV",
"[",
"3",
"]",
"\n",
"state",
"[",
"12",
"]",
"=",
"blake2bIV",
"[",
"4",
"]",
"\n",
"state",
"[",
"13",
"]",
"=",
"blake2bIV",
"[",
"5",
"]",
"\n",
"state",
"[",
"14",
"]",
"=",
"blake2bIV",
"[",
"6",
"]",
"\n",
"state",
"[",
"15",
"]",
"=",
"blake2bIV",
"[",
"7",
"]",
"\n",
"return",
"state",
"\n",
"}"
] |
22,350 | all-22351 | [
"trace",
"is",
"a",
"helper",
"function",
"for",
"TraceExternal",
"and",
"TraceGeneric",
"you",
"probably",
"don",
"t",
"want",
"to",
"use",
"it",
"directly",
"."
] | [
"func",
"trace",
"(",
"ctx",
"context",
".",
"Context",
",",
"name",
"string",
",",
"fn",
"func",
"(",
"Tx",
")",
"error",
")",
"*",
"Trace",
"{",
"if",
"tx",
",",
"ok",
":=",
"FromContext",
"(",
"ctx",
")",
";",
"ok",
"{",
"err",
":=",
"fn",
"(",
"tx",
")",
"\n",
"return",
"&",
"Trace",
"{",
"err",
":",
"err",
",",
"done",
":",
"func",
"(",
")",
"error",
"{",
"return",
"<mask>",
".",
"EndSegment",
"(",
")",
"\n",
"}",
",",
"}",
"\n",
"}",
"\n",
"return",
"&",
"Trace",
"{",
"nil",
",",
"func",
"(",
")",
"error",
"{",
"return",
"nil",
"}",
"}",
"\n",
"}"
] |
22,351 | all-22352 | [
"Close",
"destroys",
"the",
"nodetable"
] | [
"func",
"(",
"nt",
"*",
"NodeTable",
")",
"Close",
"(",
")",
"{",
"nt",
".",
"fastHTCount",
"=",
"0",
"\n",
"nt",
".",
"slowHTCount",
"=",
"0",
"\n",
"nt",
".",
"conflicts",
"=",
"0",
"\n",
"nt",
".",
"fastHT",
"=",
"make",
"(",
"<mask>",
"[",
"uint32",
"]",
"uint64",
")",
"\n",
"nt",
".",
"slowHT",
"=",
"make",
"(",
"map",
"[",
"uint32",
"]",
"[",
"]",
"uint64",
")",
"\n\n",
"buf",
":=",
"dbInstances",
".",
"MakeBuf",
"(",
")",
"\n",
"defer",
"dbInstances",
".",
"FreeBuf",
"(",
"buf",
")",
"\n",
"dbInstances",
".",
"Delete",
"(",
"unsafe",
".",
"Pointer",
"(",
"nt",
")",
",",
"CompareNodeTable",
",",
"buf",
",",
"&",
"dbInstances",
".",
"Stats",
")",
"\n",
"}"
] |
22,352 | all-22353 | [
"CreateServerGroup",
"creates",
"a",
"new",
"server",
"group",
"It",
"takes",
"an",
"instance",
"of",
"ServerGroupOptions",
".",
"Not",
"all",
"attributes",
"can",
"be",
"specified",
"at",
"create",
"time",
"(",
"such",
"as",
"Id",
"which",
"is",
"allocated",
"for",
"you",
")",
"."
] | [
"func",
"(",
"c",
"*",
"Client",
")",
"CreateServerGroup",
"(",
"newServerGroup",
"*",
"ServerGroupOptions",
")",
"(",
"*",
"ServerGroup",
",",
"error",
")",
"{",
"group",
":=",
"<mask>",
"(",
"ServerGroup",
")",
"\n",
"_",
",",
"err",
":=",
"c",
".",
"MakeApiRequest",
"(",
"\"",
"\"",
",",
"\"",
"\"",
",",
"newServerGroup",
",",
"&",
"group",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"return",
"group",
",",
"nil",
"\n",
"}"
] |
22,353 | all-22354 | [
"rgb",
"converts",
"a",
"color",
"(",
"used",
"by",
"draw2d",
")",
"into",
"3",
"int",
"(",
"used",
"by",
"gofpdf",
")"
] | [
"func",
"rgb",
"(",
"c",
"color",
".",
"<mask>",
")",
"(",
"int",
",",
"int",
",",
"int",
")",
"{",
"r",
",",
"g",
",",
"b",
",",
"_",
":=",
"c",
".",
"RGBA",
"(",
")",
"\n",
"return",
"int",
"(",
"float64",
"(",
"r",
")",
"*",
"c255",
")",
",",
"int",
"(",
"float64",
"(",
"g",
")",
"*",
"c255",
")",
",",
"int",
"(",
"float64",
"(",
"b",
")",
"*",
"c255",
")",
"\n",
"}"
] |
22,354 | all-22355 | [
"doRequest",
"creates",
"and",
"performs",
"an",
"http",
"request",
"."
] | [
"func",
"(",
"c",
"*",
"Client",
")",
"doRequest",
"(",
"host",
"*",
"URI",
",",
"method",
",",
"path",
"string",
",",
"headers",
"map",
"[",
"string",
"]",
"string",
",",
"reader",
"<mask>",
".",
"Reader",
")",
"(",
"*",
"http",
".",
"Response",
",",
"error",
")",
"{",
"req",
",",
"err",
":=",
"makeRequest",
"(",
"host",
",",
"method",
",",
"path",
",",
"headers",
",",
"reader",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"errors",
".",
"Wrap",
"(",
"err",
",",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"return",
"c",
".",
"client",
".",
"Do",
"(",
"req",
")",
"\n",
"}"
] |
22,355 | all-22356 | [
"Set",
"parses",
"and",
"updates",
"v",
"from",
"the",
"given",
"version",
"string",
".",
"Implements",
"flag",
".",
"Value"
] | [
"func",
"(",
"v",
"*",
"Version",
")",
"Set",
"(",
"version",
"string",
")",
"error",
"{",
"metadata",
":=",
"splitOff",
"(",
"&",
"version",
",",
"\"",
"\"",
")",
"\n",
"preRelease",
":=",
"PreRelease",
"(",
"splitOff",
"(",
"&",
"version",
",",
"\"",
"\"",
")",
")",
"\n",
"dotParts",
":=",
"strings",
".",
"SplitN",
"(",
"version",
",",
"\"",
"\"",
",",
"3",
")",
"\n\n",
"if",
"len",
"(",
"dotParts",
")",
"!=",
"3",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"version",
")",
"\n",
"}",
"\n\n",
"if",
"err",
":=",
"validateIdentifier",
"(",
"string",
"(",
"preRelease",
")",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"}",
"\n\n",
"if",
"err",
":=",
"validateIdentifier",
"(",
"metadata",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"}",
"\n\n",
"parsed",
":=",
"make",
"(",
"[",
"]",
"int64",
",",
"3",
",",
"3",
")",
"\n\n",
"for",
"i",
",",
"v",
":=",
"<mask>",
"dotParts",
"[",
":",
"3",
"]",
"{",
"val",
",",
"err",
":=",
"strconv",
".",
"ParseInt",
"(",
"v",
",",
"10",
",",
"64",
")",
"\n",
"parsed",
"[",
"i",
"]",
"=",
"val",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"}",
"\n\n",
"v",
".",
"Metadata",
"=",
"metadata",
"\n",
"v",
".",
"PreRelease",
"=",
"preRelease",
"\n",
"v",
".",
"Major",
"=",
"parsed",
"[",
"0",
"]",
"\n",
"v",
".",
"Minor",
"=",
"parsed",
"[",
"1",
"]",
"\n",
"v",
".",
"Patch",
"=",
"parsed",
"[",
"2",
"]",
"\n",
"return",
"nil",
"\n",
"}"
] |
22,356 | all-22357 | [
"DeepCopyObject",
"implements",
"the",
"runtime",
".",
"Object",
"interface"
] | [
"func",
"(",
"in",
"*",
"ResourcesConfigObject",
")",
"DeepCopyObject",
"(",
")",
"runtime",
".",
"<mask>",
"{",
"if",
"c",
":=",
"in",
".",
"deepCopy",
"(",
")",
";",
"c",
"!=",
"nil",
"{",
"return",
"c",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
] |
22,357 | all-22358 | [
"Create",
"creates",
"a",
"new",
"file",
"with",
"b",
"bytes",
"."
] | [
"func",
"Create",
"(",
"filename",
"string",
",",
"b",
"[",
"]",
"byte",
")",
"(",
"err",
"error",
")",
"{",
"file",
",",
"err",
":=",
"os",
".",
"Create",
"(",
"<mask>",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"_",
",",
"err",
"=",
"file",
".",
"Write",
"(",
"b",
")",
"\n",
"err2",
":=",
"file",
".",
"Close",
"(",
")",
"\n",
"if",
"err2",
"!=",
"nil",
"&&",
"err",
"==",
"nil",
"{",
"err",
"=",
"err2",
"\n",
"}",
"\n",
"return",
"\n",
"}"
] |
22,358 | all-22359 | [
"InitHtmlTemplates",
"initialzes",
"a",
"series",
"of",
"HTML",
"templates",
"in",
"the",
"directory",
"pattern",
"."
] | [
"func",
"InitHtmlTemplates",
"(",
"pattern",
"string",
")",
"(",
"err",
"error",
")",
"{",
"htmlTemp",
".",
"<mask>",
",",
"err",
"=",
"html",
".",
"ParseGlob",
"(",
"pattern",
")",
"\n",
"return",
"\n",
"}"
] |
22,359 | all-22360 | [
"/",
"*",
"external",
"address",
"helpers",
"UPNP",
"external",
"address",
"discovery",
"&",
"port",
"mapping"
] | [
"func",
"getUPNPExternalAddress",
"(",
"externalPort",
",",
"internalPort",
"int",
")",
"*",
"NetAddress",
"{",
"log",
".",
"Info",
"(",
"\"",
"\"",
")",
"\n",
"nat",
",",
"err",
":=",
"upnp",
".",
"Discover",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"log",
".",
"Info",
"(",
"\"",
"\"",
",",
"\"",
"\"",
",",
"err",
")",
"\n",
"return",
"nil",
"\n",
"}",
"\n\n",
"ext",
",",
"err",
":=",
"nat",
".",
"GetExternalAddress",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"log",
".",
"Info",
"(",
"\"",
"\"",
",",
"\"",
"\"",
",",
"err",
")",
"\n",
"return",
"nil",
"\n",
"}",
"\n\n",
"// UPnP can't seem to get the external port, so let's just be explicit.",
"if",
"externalPort",
"==",
"0",
"{",
"externalPort",
"=",
"defaultExternalPort",
"\n",
"}",
"\n\n",
"externalPort",
",",
"err",
"=",
"nat",
".",
"AddPortMapping",
"(",
"\"",
"\"",
",",
"externalPort",
",",
"internalPort",
",",
"\"",
"\"",
",",
"0",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"<mask>",
".",
"Info",
"(",
"\"",
"\"",
",",
"\"",
"\"",
",",
"err",
")",
"\n",
"return",
"nil",
"\n",
"}",
"\n\n",
"log",
".",
"Info",
"(",
"\"",
"\"",
",",
"\"",
"\"",
",",
"ext",
")",
"\n",
"return",
"NewNetAddressIPPort",
"(",
"ext",
",",
"uint16",
"(",
"externalPort",
")",
")",
"\n",
"}"
] |
22,360 | all-22361 | [
"schemaHostPortGroupSpec",
"returns",
"schema",
"items",
"for",
"resources",
"that",
"need",
"to",
"work",
"with",
"HostPortGroupSpec",
"such",
"as",
"port",
"groups",
"."
] | [
"func",
"schemaHostPortGroupSpec",
"(",
")",
"map",
"[",
"string",
"]",
"*",
"schema",
".",
"Schema",
"{",
"s",
":=",
"map",
"[",
"string",
"]",
"*",
"schema",
".",
"Schema",
"{",
"// HostPortGroupSpec",
"\"",
"\"",
":",
"{",
"Type",
":",
"schema",
".",
"TypeString",
",",
"Required",
":",
"true",
",",
"Description",
":",
"\"",
"\"",
",",
"ForceNew",
":",
"true",
",",
"}",
",",
"\"",
"\"",
":",
"{",
"<mask>",
":",
"schema",
".",
"TypeInt",
",",
"Optional",
":",
"true",
",",
"Description",
":",
"\"",
"\"",
",",
"Default",
":",
"0",
",",
"ValidateFunc",
":",
"validation",
".",
"IntBetween",
"(",
"0",
",",
"4095",
")",
",",
"}",
",",
"\"",
"\"",
":",
"{",
"Type",
":",
"schema",
".",
"TypeString",
",",
"Required",
":",
"true",
",",
"Description",
":",
"\"",
"\"",
",",
"ForceNew",
":",
"true",
",",
"}",
",",
"}",
"\n",
"structure",
".",
"MergeSchema",
"(",
"s",
",",
"schemaHostNetworkPolicy",
"(",
")",
")",
"\n",
"return",
"s",
"\n",
"}"
] |
22,361 | all-22362 | [
"WriteObject",
"implements",
"ObjectCodec",
"."
] | [
"func",
"(",
"VarintObjectCodec",
")",
"WriteObject",
"(",
"<mask>",
"io",
".",
"Writer",
",",
"obj",
"interface",
"{",
"}",
")",
"error",
"{",
"data",
",",
"err",
":=",
"json",
".",
"Marshal",
"(",
"obj",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"var",
"buf",
"[",
"binary",
".",
"MaxVarintLen64",
"]",
"byte",
"\n",
"b",
":=",
"binary",
".",
"PutUvarint",
"(",
"buf",
"[",
":",
"]",
",",
"uint64",
"(",
"len",
"(",
"data",
")",
")",
")",
"\n",
"if",
"_",
",",
"err",
":=",
"stream",
".",
"Write",
"(",
"buf",
"[",
":",
"b",
"]",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"if",
"_",
",",
"err",
":=",
"stream",
".",
"Write",
"(",
"data",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
] |
22,362 | all-22363 | [
"RemoveUnits",
"removes",
"n",
"units",
"from",
"the",
"app",
".",
"It",
"s",
"a",
"process",
"composed",
"of",
"multiple",
"steps",
":",
"1",
".",
"Remove",
"units",
"from",
"the",
"provisioner",
"2",
".",
"Update",
"quota"
] | [
"func",
"(",
"app",
"*",
"App",
")",
"RemoveUnits",
"(",
"n",
"uint",
",",
"process",
"string",
",",
"w",
"<mask>",
".",
"Writer",
")",
"error",
"{",
"prov",
",",
"err",
":=",
"app",
".",
"getProvisioner",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"w",
"=",
"app",
".",
"withLogWriter",
"(",
"w",
")",
"\n",
"err",
"=",
"prov",
".",
"RemoveUnits",
"(",
"app",
",",
"n",
",",
"process",
",",
"w",
")",
"\n",
"rebuild",
".",
"RoutesRebuildOrEnqueue",
"(",
"app",
".",
"Name",
")",
"\n",
"quotaErr",
":=",
"app",
".",
"fixQuota",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"return",
"quotaErr",
"\n",
"}"
] |
22,363 | all-22364 | [
"CreateJob",
"creates",
"and",
"runs",
"a",
"job",
"in",
"PPS",
".",
"This",
"function",
"is",
"mostly",
"useful",
"internally",
"users",
"should",
"generally",
"run",
"work",
"by",
"creating",
"pipelines",
"as",
"well",
"."
] | [
"func",
"(",
"c",
"APIClient",
")",
"CreateJob",
"(",
"pipeline",
"string",
",",
"outputCommit",
"*",
"pfs",
".",
"Commit",
")",
"(",
"*",
"pps",
".",
"Job",
",",
"error",
")",
"{",
"job",
",",
"err",
":=",
"c",
".",
"PpsAPIClient",
".",
"CreateJob",
"(",
"c",
".",
"Ctx",
"(",
")",
",",
"&",
"pps",
".",
"CreateJobRequest",
"{",
"Pipeline",
":",
"NewPipeline",
"(",
"pipeline",
")",
",",
"OutputCommit",
":",
"outputCommit",
",",
"}",
",",
")",
"\n",
"return",
"<mask>",
",",
"grpcutil",
".",
"ScrubGRPC",
"(",
"err",
")",
"\n",
"}"
] |
22,364 | all-22365 | [
"if",
"started",
"with",
"manual",
"TLS",
"stores",
"TLS",
"assets",
"from",
"tester",
"/",
"client",
"to",
"disk",
"before",
"starting",
"etcd",
"process"
] | [
"func",
"(",
"srv",
"*",
"Server",
")",
"saveTLSAssets",
"(",
")",
"error",
"{",
"if",
"srv",
".",
"Member",
".",
"PeerCertPath",
"!=",
"\"",
"\"",
"{",
"if",
"srv",
".",
"Member",
".",
"PeerCertData",
"==",
"\"",
"\"",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"srv",
".",
"Member",
".",
"PeerCertPath",
")",
"\n",
"}",
"\n",
"if",
"err",
":=",
"ioutil",
".",
"WriteFile",
"(",
"srv",
".",
"Member",
".",
"PeerCertPath",
",",
"[",
"]",
"byte",
"(",
"srv",
".",
"Member",
".",
"PeerCertData",
")",
",",
"0644",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"}",
"\n",
"if",
"srv",
".",
"Member",
".",
"PeerKeyPath",
"!=",
"\"",
"\"",
"{",
"if",
"srv",
".",
"Member",
".",
"PeerKeyData",
"==",
"\"",
"\"",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"srv",
".",
"Member",
".",
"PeerKeyPath",
")",
"\n",
"}",
"\n",
"if",
"err",
":=",
"ioutil",
".",
"WriteFile",
"(",
"srv",
".",
"Member",
".",
"PeerKeyPath",
",",
"[",
"]",
"byte",
"(",
"srv",
".",
"Member",
".",
"PeerKeyData",
")",
",",
"0644",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"}",
"\n",
"if",
"srv",
".",
"Member",
".",
"PeerTrustedCAPath",
"!=",
"\"",
"\"",
"{",
"if",
"srv",
".",
"Member",
".",
"PeerTrustedCAData",
"==",
"\"",
"\"",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"srv",
".",
"Member",
".",
"PeerTrustedCAPath",
")",
"\n",
"}",
"\n",
"if",
"err",
":=",
"ioutil",
".",
"WriteFile",
"(",
"srv",
".",
"Member",
".",
"PeerTrustedCAPath",
",",
"[",
"]",
"byte",
"(",
"srv",
".",
"Member",
".",
"PeerTrustedCAData",
")",
",",
"0644",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"}",
"\n",
"if",
"srv",
".",
"Member",
".",
"PeerCertPath",
"!=",
"\"",
"\"",
"&&",
"srv",
".",
"Member",
".",
"PeerKeyPath",
"!=",
"\"",
"\"",
"&&",
"srv",
".",
"Member",
".",
"PeerTrustedCAPath",
"!=",
"\"",
"\"",
"{",
"srv",
".",
"lg",
".",
"Info",
"(",
"\"",
"\"",
",",
"zap",
".",
"String",
"(",
"\"",
"\"",
",",
"srv",
".",
"Member",
".",
"PeerCertPath",
")",
",",
"zap",
".",
"<mask>",
"(",
"\"",
"\"",
",",
"srv",
".",
"Member",
".",
"PeerKeyPath",
")",
",",
"zap",
".",
"String",
"(",
"\"",
"\"",
",",
"srv",
".",
"Member",
".",
"PeerTrustedCAPath",
")",
",",
")",
"\n",
"}",
"\n\n",
"if",
"srv",
".",
"Member",
".",
"ClientCertPath",
"!=",
"\"",
"\"",
"{",
"if",
"srv",
".",
"Member",
".",
"ClientCertData",
"==",
"\"",
"\"",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"srv",
".",
"Member",
".",
"ClientCertPath",
")",
"\n",
"}",
"\n",
"if",
"err",
":=",
"ioutil",
".",
"WriteFile",
"(",
"srv",
".",
"Member",
".",
"ClientCertPath",
",",
"[",
"]",
"byte",
"(",
"srv",
".",
"Member",
".",
"ClientCertData",
")",
",",
"0644",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"}",
"\n",
"if",
"srv",
".",
"Member",
".",
"ClientKeyPath",
"!=",
"\"",
"\"",
"{",
"if",
"srv",
".",
"Member",
".",
"ClientKeyData",
"==",
"\"",
"\"",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"srv",
".",
"Member",
".",
"ClientKeyPath",
")",
"\n",
"}",
"\n",
"if",
"err",
":=",
"ioutil",
".",
"WriteFile",
"(",
"srv",
".",
"Member",
".",
"ClientKeyPath",
",",
"[",
"]",
"byte",
"(",
"srv",
".",
"Member",
".",
"ClientKeyData",
")",
",",
"0644",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"}",
"\n",
"if",
"srv",
".",
"Member",
".",
"ClientTrustedCAPath",
"!=",
"\"",
"\"",
"{",
"if",
"srv",
".",
"Member",
".",
"ClientTrustedCAData",
"==",
"\"",
"\"",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"srv",
".",
"Member",
".",
"ClientTrustedCAPath",
")",
"\n",
"}",
"\n",
"if",
"err",
":=",
"ioutil",
".",
"WriteFile",
"(",
"srv",
".",
"Member",
".",
"ClientTrustedCAPath",
",",
"[",
"]",
"byte",
"(",
"srv",
".",
"Member",
".",
"ClientTrustedCAData",
")",
",",
"0644",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"}",
"\n",
"if",
"srv",
".",
"Member",
".",
"ClientCertPath",
"!=",
"\"",
"\"",
"&&",
"srv",
".",
"Member",
".",
"ClientKeyPath",
"!=",
"\"",
"\"",
"&&",
"srv",
".",
"Member",
".",
"ClientTrustedCAPath",
"!=",
"\"",
"\"",
"{",
"srv",
".",
"lg",
".",
"Info",
"(",
"\"",
"\"",
",",
"zap",
".",
"String",
"(",
"\"",
"\"",
",",
"srv",
".",
"Member",
".",
"ClientCertPath",
")",
",",
"zap",
".",
"String",
"(",
"\"",
"\"",
",",
"srv",
".",
"Member",
".",
"ClientKeyPath",
")",
",",
"zap",
".",
"String",
"(",
"\"",
"\"",
",",
"srv",
".",
"Member",
".",
"ClientTrustedCAPath",
")",
",",
")",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
] |
22,365 | all-22366 | [
"Scan",
"implements",
"the",
"database",
"/",
"sql",
"/",
"Scanner",
"interface",
"."
] | [
"func",
"(",
"d",
"*",
"Decimal",
")",
"Scan",
"(",
"src",
"interface",
"{",
"}",
")",
"error",
"{",
"b",
",",
"<mask>",
":=",
"src",
".",
"(",
"[",
"]",
"byte",
")",
"\n",
"if",
"!",
"ok",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"src",
")",
"\n",
"}",
"\n\n",
"if",
"len",
"(",
"b",
")",
"!=",
"decimalSize",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"len",
"(",
"b",
")",
",",
"b",
",",
"decimalSize",
")",
"\n",
"}",
"\n\n",
"if",
"(",
"b",
"[",
"15",
"]",
"&",
"0x60",
")",
"==",
"0x60",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"b",
")",
"\n",
"}",
"\n\n",
"v",
":=",
"(",
"*",
"big",
".",
"Rat",
")",
"(",
"d",
")",
"\n",
"p",
":=",
"v",
".",
"Num",
"(",
")",
"\n",
"q",
":=",
"v",
".",
"Denom",
"(",
")",
"\n\n",
"neg",
",",
"exp",
":=",
"decodeDecimal",
"(",
"b",
",",
"p",
")",
"\n\n",
"switch",
"{",
"case",
"exp",
"<",
"0",
":",
"q",
".",
"Set",
"(",
"exp10",
"(",
"exp",
"*",
"-",
"1",
")",
")",
"\n",
"case",
"exp",
"==",
"0",
":",
"q",
".",
"Set",
"(",
"natOne",
")",
"\n",
"case",
"exp",
">",
"0",
":",
"p",
".",
"Mul",
"(",
"p",
",",
"exp10",
"(",
"exp",
")",
")",
"\n",
"q",
".",
"Set",
"(",
"natOne",
")",
"\n",
"}",
"\n\n",
"if",
"neg",
"{",
"v",
".",
"Neg",
"(",
"v",
")",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
] |
22,366 | all-22367 | [
"SafeLoad",
"is",
"a",
"wrapper",
"around",
"Load",
"()",
"that",
"does",
"not",
"error",
"when",
"invalid",
"keys",
"are",
"found",
"and",
"just",
"logs",
"warnings",
"instead",
".",
"Other",
"kinds",
"of",
"errors",
"are",
"still",
"returned",
"."
] | [
"func",
"SafeLoad",
"(",
"schema",
"Schema",
",",
"<mask>",
"map",
"[",
"string",
"]",
"string",
")",
"(",
"Map",
",",
"error",
")",
"{",
"m",
",",
"err",
":=",
"Load",
"(",
"schema",
",",
"values",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"errors",
",",
"ok",
":=",
"err",
".",
"(",
"ErrorList",
")",
"\n",
"if",
"!",
"ok",
"{",
"return",
"m",
",",
"err",
"\n",
"}",
"\n",
"for",
"_",
",",
"error",
":=",
"range",
"errors",
"{",
"message",
":=",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"error",
".",
"Reason",
")",
"\n",
"logger",
".",
"Error",
"(",
"message",
",",
"log",
".",
"Ctx",
"{",
"\"",
"\"",
":",
"error",
".",
"Name",
"}",
")",
"\n",
"}",
"\n",
"}",
"\n\n",
"return",
"m",
",",
"nil",
"\n",
"}"
] |
22,367 | all-22368 | [
"$",
"{",
"LXD_DIR",
"}",
"/",
"storage",
"-",
"pools",
"/",
"<pool",
">",
"/",
"custom",
"-",
"snapshots",
"/",
"<custom",
"volume",
"name",
">",
"/",
"<snapshot",
"name",
">"
] | [
"func",
"getStoragePoolVolumeSnapshotMountPoint",
"(",
"poolName",
"string",
",",
"snapshotName",
"string",
")",
"string",
"{",
"return",
"<mask>",
".",
"VarPath",
"(",
"\"",
"\"",
",",
"poolName",
",",
"\"",
"\"",
",",
"snapshotName",
")",
"\n",
"}"
] |
22,368 | all-22369 | [
"ReleaseOne",
"will",
"release",
"a",
"resource",
"as",
"well",
"as",
"leased",
"resources",
"associated",
"to",
"it"
] | [
"func",
"(",
"c",
"*",
"Client",
")",
"ReleaseOne",
"(",
"name",
",",
"dest",
"string",
")",
"(",
"allErrors",
"error",
")",
"{",
"res",
",",
"err",
":=",
"c",
".",
"getResource",
"(",
"name",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"allErrors",
"=",
"err",
"\n",
"return",
"\n",
"}",
"\n",
"resourceNames",
":=",
"[",
"]",
"string",
"{",
"name",
"}",
"\n",
"var",
"leasedResources",
"common",
".",
"LeasedResources",
"\n",
"if",
"err",
":=",
"res",
".",
"UserData",
".",
"Extract",
"(",
"LeasedResources",
",",
"&",
"leasedResources",
")",
";",
"err",
"!=",
"nil",
"{",
"if",
"_",
",",
"ok",
":=",
"err",
".",
"(",
"*",
"common",
".",
"UserDataNotFound",
")",
";",
"!",
"ok",
"{",
"logrus",
".",
"WithError",
"(",
"err",
")",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"LeasedResources",
")",
"\n",
"allErrors",
"=",
"multierror",
".",
"Append",
"(",
"allErrors",
",",
"err",
")",
"\n",
"if",
"err",
":=",
"c",
".",
"basic",
".",
"ReleaseOne",
"(",
"name",
",",
"<mask>",
")",
";",
"err",
"!=",
"nil",
"{",
"logrus",
".",
"WithError",
"(",
"err",
")",
".",
"Warningf",
"(",
"\"",
"\"",
",",
"name",
")",
"\n",
"allErrors",
"=",
"multierror",
".",
"Append",
"(",
"allErrors",
",",
"err",
")",
"\n",
"}",
"\n",
"return",
"\n",
"}",
"\n",
"}",
"\n",
"resourceNames",
"=",
"append",
"(",
"resourceNames",
",",
"leasedResources",
"...",
")",
"\n",
"for",
"_",
",",
"n",
":=",
"range",
"resourceNames",
"{",
"if",
"err",
":=",
"c",
".",
"basic",
".",
"ReleaseOne",
"(",
"n",
",",
"dest",
")",
";",
"err",
"!=",
"nil",
"{",
"logrus",
".",
"WithError",
"(",
"err",
")",
".",
"Warningf",
"(",
"\"",
"\"",
",",
"n",
")",
"\n",
"allErrors",
"=",
"multierror",
".",
"Append",
"(",
"allErrors",
",",
"err",
")",
"\n",
"}",
"\n",
"}",
"\n",
"c",
".",
"deleteResource",
"(",
"name",
")",
"\n",
"return",
"\n",
"}"
] |
22,369 | all-22370 | [
"PrivateKey",
"is",
"an",
"Option",
"for",
"setting",
"the",
"identity",
"s",
"private",
"key",
"."
] | [
"func",
"PrivateKey",
"(",
"<mask>",
"crypto",
".",
"Signer",
")",
"Option",
"{",
"return",
"func",
"(",
"c",
"*",
"configuration",
")",
"{",
"c",
".",
"priv",
"=",
"&",
"value",
"\n",
"}",
"\n",
"}"
] |
22,370 | all-22371 | [
"UnmarshalJSON",
"supports",
"json",
".",
"Unmarshaler",
"interface"
] | [
"func",
"(",
"v",
"*",
"Bucket",
")",
"UnmarshalJSON",
"(",
"data",
"[",
"]",
"byte",
")",
"error",
"{",
"r",
":=",
"jlexer",
".",
"Lexer",
"{",
"Data",
":",
"<mask>",
"}",
"\n",
"easyjsonC5a4559bDecodeGithubComChromedpCdprotoBrowser20",
"(",
"&",
"r",
",",
"v",
")",
"\n",
"return",
"r",
".",
"Error",
"(",
")",
"\n",
"}"
] |
22,371 | all-22372 | [
"Panics",
"if",
"error",
"."
] | [
"func",
"(",
"cdc",
"*",
"Codec",
")",
"MustUnmarshalBinaryLengthPrefixed",
"(",
"bz",
"[",
"]",
"byte",
",",
"ptr",
"<mask>",
"{",
"}",
")",
"{",
"err",
":=",
"cdc",
".",
"UnmarshalBinaryLengthPrefixed",
"(",
"bz",
",",
"ptr",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"panic",
"(",
"err",
")",
"\n",
"}",
"\n",
"}"
] |
22,372 | all-22373 | [
"Error",
"call",
"UI",
".",
"Error",
"to",
"write",
".",
"ErrorPrefix",
"is",
"used",
"to",
"prefix",
"the",
"message",
"."
] | [
"func",
"(",
"ui",
"*",
"PrefixUI",
")",
"Error",
"(",
"message",
"string",
")",
"{",
"if",
"ui",
".",
"ErrorPrefix",
"==",
"\"",
"\"",
"{",
"//Lets keep the space if they want one",
"message",
"=",
"ui",
".",
"ErrorPrefix",
"+",
"message",
"\n",
"}",
"else",
"if",
"ui",
".",
"ErrorPrefix",
"!=",
"\"",
"\"",
"{",
"message",
"=",
"ui",
".",
"ErrorPrefix",
"+",
"\"",
"\"",
"+",
"<mask>",
"\n",
"}",
"\n",
"ui",
".",
"UI",
".",
"Error",
"(",
"message",
")",
"\n",
"}"
] |
22,373 | all-22374 | [
"MarshalEasyJSON",
"satisfies",
"easyjson",
".",
"Marshaler",
"."
] | [
"func",
"(",
"t",
"CachedResponseType",
")",
"MarshalEasyJSON",
"(",
"out",
"*",
"jwriter",
".",
"Writer",
")",
"{",
"<mask>",
".",
"String",
"(",
"string",
"(",
"t",
")",
")",
"\n",
"}"
] |
22,374 | all-22375 | [
"year",
":",
"set",
"most",
"sig",
"bit",
"month",
"0",
"based"
] | [
"func",
"writeDate",
"(",
"wr",
"*",
"bufio",
".",
"Writer",
",",
"t",
"time",
".",
"Time",
")",
"{",
"//store in utc",
"utc",
":=",
"t",
".",
"In",
"(",
"time",
".",
"UTC",
")",
"\n\n",
"year",
",",
"<mask>",
",",
"day",
":=",
"utc",
".",
"Date",
"(",
")",
"\n\n",
"wr",
".",
"WriteUint16",
"(",
"uint16",
"(",
"year",
")",
"|",
"0x8000",
")",
"\n",
"wr",
".",
"WriteInt8",
"(",
"int8",
"(",
"month",
")",
"-",
"1",
")",
"\n",
"wr",
".",
"WriteInt8",
"(",
"int8",
"(",
"day",
")",
")",
"\n",
"}"
] |
22,375 | all-22376 | [
"setupStreamContext",
"is",
"used",
"to",
"create",
"a",
"new",
"stream",
"context",
".",
"This",
"should",
"be",
"called",
"with",
"the",
"stream",
"lock",
"held",
"."
] | [
"func",
"(",
"n",
"*",
"NetworkTransport",
")",
"setupStreamContext",
"(",
")",
"{",
"ctx",
",",
"cancel",
":=",
"<mask>",
".",
"WithCancel",
"(",
"context",
".",
"Background",
"(",
")",
")",
"\n",
"n",
".",
"streamCtx",
"=",
"ctx",
"\n",
"n",
".",
"streamCancel",
"=",
"cancel",
"\n",
"}"
] |
22,376 | all-22377 | [
"calculateBlocks",
"determines",
"if",
"a",
"PR",
"should",
"be",
"blocked",
"and",
"returns",
"the",
"summary",
"describing",
"the",
"block",
"."
] | [
"func",
"calculateBlocks",
"(",
"changes",
"[",
"]",
"github",
".",
"PullRequestChange",
",",
"blockades",
"[",
"]",
"blockade",
")",
"summary",
"{",
"sum",
":=",
"make",
"(",
"summary",
")",
"\n",
"for",
"_",
",",
"change",
":=",
"range",
"<mask>",
"{",
"for",
"_",
",",
"b",
":=",
"range",
"blockades",
"{",
"if",
"b",
".",
"isBlocked",
"(",
"change",
".",
"Filename",
")",
"{",
"sum",
"[",
"b",
".",
"explanation",
"]",
"=",
"append",
"(",
"sum",
"[",
"b",
".",
"explanation",
"]",
",",
"change",
")",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"sum",
"\n",
"}"
] |
22,377 | all-22378 | [
"native",
"returns",
"a",
"pointer",
"to",
"the",
"underlying",
"GtkStack",
"."
] | [
"func",
"(",
"v",
"*",
"Stack",
")",
"native",
"(",
")",
"*",
"C",
".",
"GtkStack",
"{",
"if",
"v",
"==",
"nil",
"||",
"v",
".",
"GObject",
"==",
"nil",
"{",
"<mask>",
"nil",
"\n",
"}",
"\n",
"p",
":=",
"unsafe",
".",
"Pointer",
"(",
"v",
".",
"GObject",
")",
"\n",
"return",
"C",
".",
"toGtkStack",
"(",
"p",
")",
"\n",
"}"
] |
22,378 | all-22379 | [
"Locator",
"returns",
"a",
"locator",
"for",
"the",
"given",
"resource"
] | [
"func",
"(",
"r",
"*",
"NetworkOptionGroupAttachment",
")",
"Locator",
"(",
"api",
"*",
"API",
")",
"*",
"NetworkOptionGroupAttachmentLocator",
"{",
"for",
"_",
",",
"l",
":=",
"<mask>",
"r",
".",
"Links",
"{",
"if",
"l",
"[",
"\"",
"\"",
"]",
"==",
"\"",
"\"",
"{",
"return",
"api",
".",
"NetworkOptionGroupAttachmentLocator",
"(",
"l",
"[",
"\"",
"\"",
"]",
")",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
] |
22,379 | all-22380 | [
"UnmarshalJSON",
"supports",
"json",
".",
"Unmarshaler",
"interface"
] | [
"func",
"(",
"v",
"*",
"DeliverPushMessageParams",
")",
"UnmarshalJSON",
"(",
"<mask>",
"[",
"]",
"byte",
")",
"error",
"{",
"r",
":=",
"jlexer",
".",
"Lexer",
"{",
"Data",
":",
"data",
"}",
"\n",
"easyjsonC5a4559bDecodeGithubComChromedpCdprotoServiceworker17",
"(",
"&",
"r",
",",
"v",
")",
"\n",
"return",
"r",
".",
"Error",
"(",
")",
"\n",
"}"
] |
22,380 | all-22381 | [
"Send",
"a",
"request",
"to",
"the",
"broker",
"to",
"leave",
"the",
"group",
"on",
"failes",
"rebalance",
"()",
"and",
"on",
"Close",
"()"
] | [
"func",
"(",
"c",
"*",
"Consumer",
")",
"leaveGroup",
"(",
")",
"error",
"{",
"broker",
",",
"err",
":=",
"c",
".",
"<mask>",
".",
"Coordinator",
"(",
"c",
".",
"groupID",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"c",
".",
"closeCoordinator",
"(",
"broker",
",",
"err",
")",
"\n",
"return",
"err",
"\n",
"}",
"\n\n",
"memberID",
",",
"_",
":=",
"c",
".",
"membership",
"(",
")",
"\n",
"if",
"_",
",",
"err",
"=",
"broker",
".",
"LeaveGroup",
"(",
"&",
"sarama",
".",
"LeaveGroupRequest",
"{",
"GroupId",
":",
"c",
".",
"groupID",
",",
"MemberId",
":",
"memberID",
",",
"}",
")",
";",
"err",
"!=",
"nil",
"{",
"c",
".",
"closeCoordinator",
"(",
"broker",
",",
"err",
")",
"\n",
"}",
"\n",
"return",
"err",
"\n",
"}"
] |
22,381 | all-22382 | [
"MarshalJSON",
"returns",
"the",
"URI",
"as",
"JSON"
] | [
"func",
"(",
"u",
"URI",
")",
"MarshalJSON",
"(",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"<mask>",
"w",
"jwriter",
".",
"Writer",
"\n",
"u",
".",
"MarshalEasyJSON",
"(",
"&",
"w",
")",
"\n",
"return",
"w",
".",
"BuildBytes",
"(",
")",
"\n",
"}"
] |
22,382 | all-22383 | [
"GridNew",
"()",
"is",
"a",
"wrapper",
"around",
"gtk_grid_new",
"()",
"."
] | [
"func",
"GridNew",
"(",
")",
"(",
"*",
"Grid",
",",
"<mask>",
")",
"{",
"c",
":=",
"C",
".",
"gtk_grid_new",
"(",
")",
"\n",
"if",
"c",
"==",
"nil",
"{",
"return",
"nil",
",",
"nilPtrErr",
"\n",
"}",
"\n",
"obj",
":=",
"glib",
".",
"Take",
"(",
"unsafe",
".",
"Pointer",
"(",
"c",
")",
")",
"\n",
"return",
"wrapGrid",
"(",
"obj",
")",
",",
"nil",
"\n",
"}"
] |
22,383 | all-22384 | [
"PrivateKey",
"returns",
"the",
"stored",
"private",
"key",
"for",
"the",
"keystore",
"."
] | [
"func",
"(",
"ks",
"*",
"Keystore",
")",
"PrivateKey",
"(",
")",
"(",
"crypto",
".",
"PrivateKey",
",",
"bool",
")",
"{",
"ks",
".",
"rw",
".",
"RLock",
"(",
")",
"\n",
"defer",
"ks",
".",
"rw",
".",
"RUnlock",
"(",
")",
"\n",
"return",
"ks",
".",
"Key",
",",
"<mask>",
".",
"Key",
"!=",
"nil",
"\n",
"}"
] |
22,384 | all-22385 | [
"SetVisible",
"is",
"a",
"wrapper",
"around",
"gtk_widget_set_visible",
"()",
"."
] | [
"func",
"(",
"v",
"*",
"Widget",
")",
"SetVisible",
"(",
"<mask>",
"bool",
")",
"{",
"C",
".",
"gtk_widget_set_visible",
"(",
"v",
".",
"native",
"(",
")",
",",
"gbool",
"(",
"visible",
")",
")",
"\n",
"}"
] |
22,385 | all-22386 | [
"RefreshImage",
"requests",
"that",
"LXD",
"issues",
"an",
"image",
"refresh"
] | [
"func",
"(",
"r",
"*",
"ProtocolLXD",
")",
"RefreshImage",
"(",
"fingerprint",
"string",
")",
"(",
"Operation",
",",
"error",
")",
"{",
"if",
"!",
"r",
".",
"HasExtension",
"(",
"\"",
"\"",
")",
"{",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\\\"",
"\\\"",
"\"",
")",
"\n",
"}",
"\n\n",
"// Send the request",
"op",
",",
"_",
",",
"err",
":=",
"r",
".",
"queryOperation",
"(",
"\"",
"\"",
",",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"<mask>",
".",
"QueryEscape",
"(",
"fingerprint",
")",
")",
",",
"nil",
",",
"\"",
"\"",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"return",
"op",
",",
"nil",
"\n",
"}"
] |
22,386 | all-22387 | [
"Implements",
"Err"
] | [
"func",
"(",
"e",
"*",
"err",
")",
"LogString",
"(",
")",
"string",
"{",
"return",
"concatArgs",
"(",
"\"",
"\"",
",",
"\"",
"\"",
",",
"e",
".",
"time",
",",
"\"",
"\"",
",",
"e",
".",
"wrappedErrStr",
"(",
")",
",",
"\"",
"\"",
"+",
"concatArgs",
"(",
"e",
".",
"info",
")",
"+",
"\"",
"\"",
",",
"\"",
"\"",
",",
"e",
".",
"publicMsg",
",",
"\"",
"\"",
",",
"string",
"(",
"e",
".",
"<mask>",
")",
",",
")",
"\n",
"}"
] |
22,387 | all-22388 | [
"HasIndex",
"returns",
"true",
"if",
"the",
"given",
"index",
"is",
"in",
"the",
"schema",
"."
] | [
"func",
"(",
"s",
"*",
"Schema",
")",
"HasIndex",
"(",
"indexName",
"string",
")",
"bool",
"{",
"_",
",",
"ok",
":=",
"s",
".",
"indexes",
"[",
"indexName",
"]",
"\n",
"return",
"<mask>",
"\n",
"}"
] |
22,388 | all-22389 | [
"HasTitle",
"returns",
"a",
"boolean",
"if",
"a",
"field",
"has",
"been",
"set",
"."
] | [
"func",
"(",
"s",
"*",
"ScreenboardLite",
")",
"HasTitle",
"(",
")",
"bool",
"{",
"if",
"s",
"!=",
"nil",
"&&",
"s",
".",
"Title",
"!=",
"nil",
"{",
"return",
"<mask>",
"\n",
"}",
"\n\n",
"return",
"false",
"\n",
"}"
] |
22,389 | all-22390 | [
"Domains",
"lists",
"the",
"domains",
"on",
"the",
"server"
] | [
"func",
"(",
"cgp",
"*",
"CGP",
")",
"Domains",
"(",
")",
"(",
"[",
"]",
"*",
"Domain",
",",
"error",
")",
"{",
"<mask>",
"vl",
"valueList",
"\n",
"err",
":=",
"cgp",
".",
"request",
"(",
"listDomains",
"{",
"}",
",",
"&",
"vl",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"[",
"]",
"*",
"Domain",
"{",
"}",
",",
"err",
"\n",
"}",
"\n",
"vals",
":=",
"vl",
".",
"SubValues",
"\n",
"ds",
":=",
"make",
"(",
"[",
"]",
"*",
"Domain",
",",
"len",
"(",
"vals",
")",
")",
"\n",
"for",
"i",
",",
"d",
":=",
"range",
"vals",
"{",
"ds",
"[",
"i",
"]",
"=",
"cgp",
".",
"Domain",
"(",
"d",
")",
"\n",
"}",
"\n",
"return",
"ds",
",",
"nil",
"\n",
"}"
] |
22,390 | all-22391 | [
"GroupByFilter",
"creates",
"a",
"GroupBy",
"query",
"with",
"the",
"given",
"filter",
"and",
"Rows",
"queries"
] | [
"func",
"(",
"idx",
"*",
"<mask>",
")",
"GroupByFilter",
"(",
"filterQuery",
"*",
"PQLRowQuery",
",",
"rowsQueries",
"...",
"*",
"PQLRowsQuery",
")",
"*",
"PQLBaseQuery",
"{",
"if",
"len",
"(",
"rowsQueries",
")",
"<",
"1",
"{",
"return",
"NewPQLBaseQuery",
"(",
"\"",
"\"",
",",
"idx",
",",
"errors",
".",
"New",
"(",
"\"",
"\"",
")",
")",
"\n",
"}",
"\n",
"filterText",
":=",
"filterQuery",
".",
"serialize",
"(",
")",
".",
"String",
"(",
")",
"\n",
"text",
":=",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"strings",
".",
"Join",
"(",
"serializeGroupBy",
"(",
"rowsQueries",
"...",
")",
",",
"\"",
"\"",
")",
",",
"filterText",
")",
"\n",
"return",
"NewPQLBaseQuery",
"(",
"text",
",",
"idx",
",",
"nil",
")",
"\n",
"}"
] |
22,391 | all-22392 | [
"PERFORMANCE",
":",
"The",
"code",
"of",
"this",
"function",
"is",
"complicated",
"because",
"we",
"try",
"to",
"call",
"the",
"underlying",
"drivers",
"as",
"less",
"as",
"possible",
"to",
"get",
"the",
"information",
"we",
"need",
"."
] | [
"func",
"attemptGetHostState",
"(",
"h",
"*",
"host",
".",
"Host",
",",
"stateQueryChan",
"chan",
"<-",
"HostListItem",
")",
"{",
"requestBeginning",
":=",
"time",
".",
"Now",
"(",
")",
"\n",
"url",
":=",
"\"",
"\"",
"\n",
"currentState",
":=",
"state",
".",
"None",
"\n",
"dockerVersion",
":=",
"\"",
"\"",
"\n",
"hostError",
":=",
"\"",
"\"",
"\n\n",
"url",
",",
"err",
":=",
"h",
".",
"URL",
"(",
")",
"\n\n",
"// PERFORMANCE: if we have the url, it's ok to assume the host is running",
"// This reduces the number of calls to the drivers",
"if",
"err",
"==",
"nil",
"{",
"if",
"url",
"!=",
"\"",
"\"",
"{",
"currentState",
"=",
"state",
".",
"Running",
"\n",
"}",
"else",
"{",
"currentState",
",",
"err",
"=",
"h",
".",
"Driver",
".",
"GetState",
"(",
")",
"\n",
"}",
"\n",
"}",
"else",
"{",
"currentState",
",",
"_",
"=",
"h",
".",
"Driver",
".",
"GetState",
"(",
")",
"\n",
"}",
"\n\n",
"if",
"err",
"==",
"nil",
"&&",
"url",
"!=",
"\"",
"\"",
"{",
"// PERFORMANCE: Reuse the url instead of asking the host again.",
"// This reduces the number of calls to the drivers",
"dockerHost",
":=",
"&",
"mcndockerclient",
".",
"RemoteDocker",
"{",
"HostURL",
":",
"url",
",",
"AuthOption",
":",
"h",
".",
"AuthOptions",
"(",
")",
",",
"}",
"\n",
"dockerVersion",
",",
"err",
"=",
"mcndockerclient",
".",
"DockerVersion",
"(",
"dockerHost",
")",
"\n\n",
"if",
"err",
"!=",
"nil",
"{",
"dockerVersion",
"=",
"\"",
"\"",
"\n",
"}",
"else",
"{",
"dockerVersion",
"=",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"dockerVersion",
")",
"\n",
"}",
"\n",
"}",
"\n\n",
"if",
"err",
"!=",
"nil",
"{",
"hostError",
"=",
"err",
".",
"Error",
"(",
")",
"\n",
"}",
"\n",
"if",
"hostError",
"==",
"drivers",
".",
"ErrHostIsNotRunning",
".",
"Error",
"(",
")",
"{",
"hostError",
"=",
"\"",
"\"",
"\n",
"}",
"\n\n",
"var",
"swarmOptions",
"*",
"swarm",
".",
"Options",
"\n",
"var",
"engineOptions",
"*",
"engine",
".",
"Options",
"\n",
"if",
"h",
".",
"HostOptions",
"!=",
"nil",
"{",
"swarmOptions",
"=",
"h",
".",
"HostOptions",
".",
"SwarmOptions",
"\n",
"engineOptions",
"=",
"h",
".",
"HostOptions",
".",
"EngineOptions",
"\n",
"}",
"\n\n",
"isMaster",
":=",
"false",
"\n",
"swarmHost",
":=",
"\"",
"\"",
"\n",
"if",
"swarmOptions",
"!=",
"nil",
"{",
"isMaster",
"=",
"swarmOptions",
".",
"Master",
"\n",
"swarmHost",
"=",
"swarmOptions",
".",
"Host",
"\n",
"}",
"\n\n",
"activeHost",
":=",
"isActive",
"(",
"currentState",
",",
"url",
")",
"\n",
"activeSwarm",
":=",
"isSwarmActive",
"(",
"currentState",
",",
"url",
",",
"isMaster",
",",
"swarmHost",
")",
"\n",
"active",
":=",
"\"",
"\"",
"\n",
"if",
"activeHost",
"{",
"<mask>",
"=",
"\"",
"\"",
"\n",
"}",
"\n",
"if",
"activeSwarm",
"{",
"active",
"=",
"\"",
"\"",
"\n",
"}",
"\n\n",
"stateQueryChan",
"<-",
"HostListItem",
"{",
"Name",
":",
"h",
".",
"Name",
",",
"Active",
":",
"active",
",",
"ActiveHost",
":",
"activeHost",
",",
"ActiveSwarm",
":",
"activeSwarm",
",",
"DriverName",
":",
"h",
".",
"Driver",
".",
"DriverName",
"(",
")",
",",
"State",
":",
"currentState",
",",
"URL",
":",
"url",
",",
"SwarmOptions",
":",
"swarmOptions",
",",
"EngineOptions",
":",
"engineOptions",
",",
"DockerVersion",
":",
"dockerVersion",
",",
"Error",
":",
"hostError",
",",
"ResponseTime",
":",
"time",
".",
"Now",
"(",
")",
".",
"Round",
"(",
"time",
".",
"Millisecond",
")",
".",
"Sub",
"(",
"requestBeginning",
".",
"Round",
"(",
"time",
".",
"Millisecond",
")",
")",
",",
"}",
"\n",
"}"
] |
22,392 | all-22393 | [
"UnmarshalJSON",
"supports",
"json",
".",
"Unmarshaler",
"interface"
] | [
"func",
"(",
"v",
"*",
"EventWebSocketCreated",
")",
"UnmarshalJSON",
"(",
"data",
"[",
"]",
"<mask>",
")",
"error",
"{",
"r",
":=",
"jlexer",
".",
"Lexer",
"{",
"Data",
":",
"data",
"}",
"\n",
"easyjsonC5a4559bDecodeGithubComChromedpCdprotoNetwork45",
"(",
"&",
"r",
",",
"v",
")",
"\n",
"return",
"r",
".",
"Error",
"(",
")",
"\n",
"}"
] |
22,393 | all-22394 | [
"/",
"*",
"Frame",
"returns",
"a",
"path",
"to",
"the",
"given",
"frame",
"in",
"the",
"sequence",
".",
"Integer",
"or",
"string",
"digits",
"are",
"treated",
"as",
"a",
"frame",
"number",
"and",
"padding",
"is",
"applied",
"all",
"other",
"values",
"are",
"passed",
"though",
".",
"Accepts",
"ints",
"strings",
"[]",
"byte",
"and",
"Stringer",
"types"
] | [
"func",
"(",
"s",
"*",
"FileSequence",
")",
"Frame",
"(",
"frame",
"interface",
"{",
"}",
")",
"(",
"string",
",",
"error",
")",
"{",
"var",
"zframe",
"string",
"\n",
"var",
"isInt",
"bool",
"\n\n",
"if",
"s",
".",
"frameSet",
"!=",
"nil",
"{",
"switch",
"t",
":=",
"frame",
".",
"(",
"type",
")",
"{",
"case",
"int",
":",
"var",
"i",
"int",
"=",
"t",
"\n",
"zframe",
"=",
"zfillInt",
"(",
"i",
",",
"s",
".",
"zfill",
")",
"\n",
"isInt",
"=",
"true",
"\n",
"case",
"string",
":",
"zframe",
"=",
"t",
"\n",
"case",
"[",
"]",
"byte",
":",
"zframe",
"=",
"string",
"(",
"t",
")",
"\n",
"case",
"fmt",
".",
"Stringer",
":",
"zframe",
"=",
"t",
".",
"String",
"(",
")",
"\n",
"default",
":",
"return",
"zframe",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"t",
")",
"\n",
"}",
"\n",
"// Only try and zfill the string if it was an int format",
"if",
"!",
"isInt",
"{",
"if",
"_",
",",
"err",
":=",
"strconv",
".",
"Atoi",
"(",
"zframe",
")",
";",
"err",
"==",
"nil",
"{",
"zframe",
"=",
"zfillString",
"(",
"zframe",
",",
"s",
".",
"zfill",
")",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n\n",
"var",
"buf",
"strings",
".",
"Builder",
"\n",
"buf",
".",
"WriteString",
"(",
"s",
".",
"dir",
")",
"\n",
"buf",
".",
"WriteString",
"(",
"s",
".",
"basename",
")",
"\n",
"buf",
".",
"WriteString",
"(",
"zframe",
")",
"\n",
"buf",
".",
"WriteString",
"(",
"s",
".",
"ext",
")",
"\n",
"return",
"buf",
".",
"<mask>",
"(",
")",
",",
"nil",
"\n",
"}"
] |
22,394 | all-22395 | [
"MarshalJSON",
"supports",
"json",
".",
"Marshaler",
"interface"
] | [
"func",
"(",
"v",
"ShapeOutsideInfo",
")",
"MarshalJSON",
"(",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"w",
":=",
"jwriter",
".",
"<mask>",
"{",
"}",
"\n",
"easyjsonC5a4559bEncodeGithubComChromedpCdprotoDom1",
"(",
"&",
"w",
",",
"v",
")",
"\n",
"return",
"w",
".",
"Buffer",
".",
"BuildBytes",
"(",
")",
",",
"w",
".",
"Error",
"\n",
"}"
] |
22,395 | all-22396 | [
"MarshalJSON",
"supports",
"json",
".",
"Marshaler",
"interface"
] | [
"func",
"(",
"v",
"SetGeolocationOverrideParams",
")",
"MarshalJSON",
"(",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"w",
":=",
"jwriter",
".",
"<mask>",
"{",
"}",
"\n",
"easyjsonC5a4559bEncodeGithubComChromedpCdprotoEmulation7",
"(",
"&",
"w",
",",
"v",
")",
"\n",
"return",
"w",
".",
"Buffer",
".",
"BuildBytes",
"(",
")",
",",
"w",
".",
"Error",
"\n",
"}"
] |
22,396 | all-22397 | [
"Next",
"waits",
"for",
"the",
"next",
"record",
"and",
"returns",
"that",
"."
] | [
"func",
"(",
"s",
"*",
"PubSubSubscription",
")",
"Next",
"(",
")",
"(",
"*",
"<mask>",
",",
"error",
")",
"{",
"if",
"s",
".",
"resp",
".",
"Error",
"!=",
"nil",
"{",
"return",
"nil",
",",
"s",
".",
"resp",
".",
"Error",
"\n",
"}",
"\n\n",
"d",
":=",
"json",
".",
"NewDecoder",
"(",
"s",
".",
"resp",
".",
"Output",
")",
"\n\n",
"var",
"r",
"struct",
"{",
"From",
"[",
"]",
"byte",
"`json:\"from,omitempty\"`",
"\n",
"Data",
"[",
"]",
"byte",
"`json:\"data,omitempty\"`",
"\n",
"Seqno",
"[",
"]",
"byte",
"`json:\"seqno,omitempty\"`",
"\n",
"TopicIDs",
"[",
"]",
"string",
"`json:\"topicIDs,omitempty\"`",
"\n",
"}",
"\n\n",
"err",
":=",
"d",
".",
"Decode",
"(",
"&",
"r",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"from",
",",
"err",
":=",
"peer",
".",
"IDFromBytes",
"(",
"r",
".",
"From",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"return",
"&",
"Message",
"{",
"From",
":",
"from",
",",
"Data",
":",
"r",
".",
"Data",
",",
"Seqno",
":",
"r",
".",
"Seqno",
",",
"TopicIDs",
":",
"r",
".",
"TopicIDs",
",",
"}",
",",
"nil",
"\n",
"}"
] |
22,397 | all-22398 | [
"SetShowFallback",
"()",
"is",
"a",
"wrapper",
"around",
"gtk_app_chooser_widget_set_show_fallback",
"()",
"."
] | [
"func",
"(",
"v",
"*",
"AppChooserWidget",
")",
"SetShowFallback",
"(",
"setting",
"bool",
")",
"{",
"C",
".",
"gtk_app_chooser_widget_set_show_fallback",
"(",
"v",
".",
"native",
"(",
")",
",",
"gbool",
"(",
"<mask>",
")",
")",
"\n",
"}"
] |
22,398 | all-22399 | [
"DialTimeout",
"dials",
"the",
"given",
"TCP",
"addr",
"using",
"tcp4",
"using",
"the",
"given",
"timeout",
".",
"This",
"function",
"has",
"the",
"following",
"additional",
"features",
"comparing",
"to",
"net",
".",
"Dial",
":",
"*",
"It",
"reduces",
"load",
"on",
"DNS",
"resolver",
"by",
"caching",
"resolved",
"TCP",
"addressed",
"for",
"DefaultDNSCacheDuration",
".",
"*",
"It",
"dials",
"all",
"the",
"resolved",
"TCP",
"addresses",
"in",
"round",
"-",
"robin",
"manner",
"until",
"connection",
"is",
"established",
".",
"This",
"may",
"be",
"useful",
"if",
"certain",
"addresses",
"are",
"temporarily",
"unreachable",
".",
"This",
"dialer",
"is",
"intended",
"for",
"custom",
"code",
"wrapping",
"before",
"passing",
"to",
"Client",
".",
"Dial",
"or",
"HostClient",
".",
"Dial",
".",
"For",
"instance",
"per",
"-",
"host",
"counters",
"and",
"/",
"or",
"limits",
"may",
"be",
"implemented",
"by",
"such",
"wrappers",
".",
"The",
"addr",
"passed",
"to",
"the",
"function",
"must",
"contain",
"port",
".",
"Example",
"addr",
"values",
":",
"*",
"foobar",
".",
"baz",
":",
"443",
"*",
"foo",
".",
"bar",
":",
"80",
"*",
"aaa",
".",
"com",
":",
"8080"
] | [
"func",
"(",
"d",
"*",
"TCPDialer",
")",
"DialTimeout",
"(",
"addr",
"string",
",",
"timeout",
"time",
".",
"Duration",
")",
"(",
"net",
".",
"Conn",
",",
"error",
")",
"{",
"return",
"d",
".",
"dial",
"(",
"addr",
",",
"<mask>",
",",
"timeout",
")",
"\n",
"}"
] |
22,399 | all-22400 | [
"DebugFunc",
"outputs",
"Debug",
"level",
"log",
"returned",
"from",
"the",
"function"
] | [
"func",
"(",
"g",
"*",
"Glg",
")",
"DebugFunc",
"(",
"f",
"func",
"(",
")",
"string",
")",
"error",
"{",
"if",
"g",
".",
"isModeEnable",
"(",
"DEBG",
")",
"{",
"return",
"g",
".",
"<mask>",
"(",
"DEBG",
",",
"\"",
"\"",
",",
"f",
"(",
")",
")",
"\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.