id
int32 0
25.3k
| idx
stringlengths 5
9
| nl_tokens
sequencelengths 1
418
| pl_tokens
sequencelengths 22
4.98k
|
---|---|---|---|
5,700 | all-5701 | [
"String",
"is",
"a",
"string",
"representation",
"of",
"the",
"set",
"."
] | [
"func",
"(",
"s",
"*",
"Set",
")",
"String",
"(",
")",
"string",
"{",
"s",
".",
"RLock",
"(",
")",
"\n",
"defer",
"s",
".",
"RUnlock",
"(",
")",
"\n",
"return",
"strings",
".",
"Join",
"(",
"s",
".",
"<mask>",
",",
"\"",
"\"",
")",
"\n",
"}"
] |
5,701 | all-5702 | [
"Returns",
"a",
"Typed",
"helper",
"at",
"the",
"key",
"If",
"the",
"key",
"doesn",
"t",
"exist",
"a",
"default",
"Typed",
"helper",
"is",
"returned",
"(",
"which",
"will",
"return",
"default",
"values",
"for",
"any",
"subsequent",
"sub",
"queries",
")"
] | [
"func",
"(",
"t",
"Typed",
")",
"<mask>",
"(",
"key",
"string",
")",
"Typed",
"{",
"o",
":=",
"t",
".",
"ObjectOr",
"(",
"key",
",",
"nil",
")",
"\n",
"if",
"o",
"==",
"nil",
"{",
"return",
"Typed",
"(",
"nil",
")",
"\n",
"}",
"\n",
"return",
"o",
"\n",
"}"
] |
5,702 | all-5703 | [
"DeleteUser",
"deletes",
"a",
"user",
"and",
"returns",
"an",
"error",
"if",
"deletion",
"failed"
] | [
"func",
"(",
"<mask>",
"*",
"Client",
")",
"DeleteUser",
"(",
"handle",
"string",
")",
"error",
"{",
"uri",
":=",
"\"",
"\"",
"+",
"handle",
"\n",
"return",
"client",
".",
"doJsonRequest",
"(",
"\"",
"\"",
",",
"uri",
",",
"nil",
",",
"nil",
")",
"\n",
"}"
] |
5,703 | all-5704 | [
"MandatoryParams",
"returns",
"the",
"list",
"of",
"all",
"action",
"mandatory",
"parameters"
] | [
"func",
"(",
"a",
"*",
"<mask>",
")",
"MandatoryParams",
"(",
")",
"[",
"]",
"*",
"ActionParam",
"{",
"m",
":=",
"make",
"(",
"[",
"]",
"*",
"ActionParam",
",",
"len",
"(",
"a",
".",
"Params",
")",
")",
"\n",
"i",
":=",
"0",
"\n",
"for",
"_",
",",
"p",
":=",
"range",
"a",
".",
"Params",
"{",
"if",
"p",
".",
"Mandatory",
"{",
"m",
"[",
"i",
"]",
"=",
"p",
"\n",
"i",
"++",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"m",
"[",
":",
"i",
"]",
"\n",
"}"
] |
5,704 | all-5705 | [
"Check",
"that",
"cluster",
"-",
"related",
"preconditions",
"are",
"met",
"for",
"accepting",
"a",
"new",
"node",
"."
] | [
"func",
"membershipCheckClusterStateForAccept",
"(",
"tx",
"*",
"db",
".",
"ClusterTx",
",",
"<mask>",
"string",
",",
"address",
"string",
",",
"schema",
"int",
",",
"api",
"int",
")",
"error",
"{",
"nodes",
",",
"err",
":=",
"tx",
".",
"Nodes",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"errors",
".",
"Wrap",
"(",
"err",
",",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"if",
"len",
"(",
"nodes",
")",
"==",
"1",
"&&",
"nodes",
"[",
"0",
"]",
".",
"Address",
"==",
"\"",
"\"",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"for",
"_",
",",
"node",
":=",
"range",
"nodes",
"{",
"if",
"node",
".",
"Name",
"==",
"name",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"name",
")",
"\n",
"}",
"\n",
"if",
"node",
".",
"Address",
"==",
"address",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"address",
")",
"\n",
"}",
"\n",
"if",
"node",
".",
"Schema",
"!=",
"schema",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"node",
".",
"Schema",
")",
"\n",
"}",
"\n",
"if",
"node",
".",
"APIExtensions",
"!=",
"api",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"node",
".",
"APIExtensions",
")",
"\n",
"}",
"\n",
"}",
"\n\n",
"return",
"nil",
"\n",
"}"
] |
5,705 | all-5706 | [
"MustSuccess",
"retrieves",
"the",
"Success",
"value",
"from",
"the",
"union",
"panicing",
"if",
"the",
"value",
"is",
"not",
"set",
"."
] | [
"func",
"(",
"u",
"PathPaymentResult",
")",
"MustSuccess",
"(",
")",
"PathPaymentResultSuccess",
"{",
"val",
",",
"ok",
":=",
"u",
".",
"GetSuccess",
"(",
")",
"\n\n",
"if",
"!",
"<mask>",
"{",
"panic",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"return",
"val",
"\n",
"}"
] |
5,706 | all-5707 | [
"Return",
"a",
"slice",
"of",
"binary",
"integer",
"tuples",
".",
"Each",
"tuple",
"contains",
"the",
"schema",
"version",
"and",
"number",
"of",
"api",
"extensions",
"of",
"a",
"node",
"in",
"the",
"cluster",
"."
] | [
"func",
"selectNodesVersions",
"(",
"tx",
"*",
"sql",
".",
"Tx",
")",
"(",
"[",
"]",
"[",
"2",
"]",
"int",
",",
"error",
")",
"{",
"versions",
":=",
"[",
"]",
"[",
"2",
"]",
"int",
"{",
"}",
"\n\n",
"dest",
":=",
"func",
"(",
"i",
"int",
")",
"[",
"]",
"<mask>",
"{",
"}",
"{",
"versions",
"=",
"append",
"(",
"versions",
",",
"[",
"2",
"]",
"int",
"{",
"}",
")",
"\n",
"return",
"[",
"]",
"interface",
"{",
"}",
"{",
"&",
"versions",
"[",
"i",
"]",
"[",
"0",
"]",
",",
"&",
"versions",
"[",
"i",
"]",
"[",
"1",
"]",
"}",
"\n",
"}",
"\n\n",
"stmt",
",",
"err",
":=",
"tx",
".",
"Prepare",
"(",
"\"",
"\"",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"defer",
"stmt",
".",
"Close",
"(",
")",
"\n",
"err",
"=",
"query",
".",
"SelectObjects",
"(",
"stmt",
",",
"dest",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"return",
"versions",
",",
"nil",
"\n",
"}"
] |
5,707 | all-5708 | [
"Getgroups",
"returns",
"a",
"list",
"of",
"the",
"numeric",
"ids",
"of",
"groups",
"that",
"the",
"caller",
"belongs",
"to",
"."
] | [
"func",
"Getgroups",
"(",
")",
"[",
"]",
"int",
"{",
"user",
":=",
"GetUsername",
"(",
")",
"\n",
"list",
":=",
"make",
"(",
"[",
"]",
"int",
",",
"0",
")",
"\n\n",
"// The user could have its own group.",
"if",
"g",
",",
"err",
":=",
"LookupGroup",
"(",
"user",
")",
";",
"err",
"==",
"nil",
"{",
"list",
"=",
"<mask>",
"(",
"list",
",",
"g",
".",
"GID",
")",
"\n",
"}",
"\n\n",
"groups",
",",
"err",
":=",
"LookupInGroup",
"(",
"G_MEMBER",
",",
"user",
",",
"-",
"1",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"if",
"_",
",",
"ok",
":=",
"err",
".",
"(",
"NoFoundError",
")",
";",
"!",
"ok",
"{",
"panic",
"(",
"err",
")",
"\n",
"}",
"\n",
"}",
"\n\n",
"for",
"_",
",",
"v",
":=",
"range",
"groups",
"{",
"list",
"=",
"append",
"(",
"list",
",",
"v",
".",
"GID",
")",
"\n",
"}",
"\n",
"return",
"list",
"\n",
"}"
] |
5,708 | all-5709 | [
"GetStyle",
"returns",
"the",
"Style",
"field",
"if",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"."
] | [
"func",
"(",
"d",
"*",
"DistributionRequest",
")",
"GetStyle",
"(",
")",
"WidgetRequestStyle",
"{",
"if",
"d",
"==",
"nil",
"||",
"d",
".",
"Style",
"==",
"nil",
"{",
"<mask>",
"WidgetRequestStyle",
"{",
"}",
"\n",
"}",
"\n",
"return",
"*",
"d",
".",
"Style",
"\n",
"}"
] |
5,709 | all-5710 | [
"GetHello",
"retrieves",
"the",
"Hello",
"value",
"from",
"the",
"union",
"returning",
"ok",
"if",
"the",
"union",
"s",
"switch",
"indicated",
"the",
"value",
"is",
"valid",
"."
] | [
"func",
"(",
"u",
"StellarMessage",
")",
"GetHello",
"(",
")",
"(",
"result",
"Hello",
",",
"<mask>",
"bool",
")",
"{",
"armName",
",",
"_",
":=",
"u",
".",
"ArmForSwitch",
"(",
"int32",
"(",
"u",
".",
"Type",
")",
")",
"\n\n",
"if",
"armName",
"==",
"\"",
"\"",
"{",
"result",
"=",
"*",
"u",
".",
"Hello",
"\n",
"ok",
"=",
"true",
"\n",
"}",
"\n\n",
"return",
"\n",
"}"
] |
5,710 | all-5711 | [
"UnmarshalJSON",
"supports",
"json",
".",
"Unmarshaler",
"interface"
] | [
"func",
"(",
"v",
"*",
"GetEventListenersParams",
")",
"UnmarshalJSON",
"(",
"<mask>",
"[",
"]",
"byte",
")",
"error",
"{",
"r",
":=",
"jlexer",
".",
"Lexer",
"{",
"Data",
":",
"data",
"}",
"\n",
"easyjsonC5a4559bDecodeGithubComChromedpCdprotoDomdebugger9",
"(",
"&",
"r",
",",
"v",
")",
"\n",
"return",
"r",
".",
"Error",
"(",
")",
"\n",
"}"
] |
5,711 | all-5712 | [
"TextIndexToLayoutIndex",
"()",
"is",
"a",
"wrapper",
"around",
"gtk_entry_text_index_to_layout_index",
"()",
"."
] | [
"func",
"(",
"v",
"*",
"<mask>",
")",
"TextIndexToLayoutIndex",
"(",
"textIndex",
"int",
")",
"int",
"{",
"c",
":=",
"C",
".",
"gtk_entry_text_index_to_layout_index",
"(",
"v",
".",
"native",
"(",
")",
",",
"C",
".",
"gint",
"(",
"textIndex",
")",
")",
"\n",
"return",
"int",
"(",
"c",
")",
"\n",
"}"
] |
5,712 | all-5713 | [
"UnmarshalJSON",
"supports",
"json",
".",
"Unmarshaler",
"interface"
] | [
"func",
"(",
"v",
"*",
"ResetNavigationHistoryParams",
")",
"UnmarshalJSON",
"(",
"<mask>",
"[",
"]",
"byte",
")",
"error",
"{",
"r",
":=",
"jlexer",
".",
"Lexer",
"{",
"Data",
":",
"data",
"}",
"\n",
"easyjsonC5a4559bDecodeGithubComChromedpCdprotoPage19",
"(",
"&",
"r",
",",
"v",
")",
"\n",
"return",
"r",
".",
"Error",
"(",
")",
"\n",
"}"
] |
5,713 | all-5714 | [
"Name",
"is",
"a",
"handler"
] | [
"func",
"(",
"h",
"*",
"Hello",
")",
"Name",
"(",
"ctx",
"context",
".",
"Context",
",",
"w",
"http",
".",
"ResponseWriter",
",",
"r",
"*",
"<mask>",
".",
"Request",
")",
"{",
"name",
":=",
"scaffold",
".",
"GetParam",
"(",
"ctx",
",",
"\"",
"\"",
")",
"\n\n",
"msg",
":=",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"name",
")",
"\n",
"w",
".",
"Write",
"(",
"[",
"]",
"byte",
"(",
"msg",
")",
")",
"\n",
"}"
] |
5,714 | all-5715 | [
"explainGroup",
"explains",
"all",
"the",
"subcommands",
"for",
"a",
"particular",
"group",
"."
] | [
"func",
"explainGroup",
"(",
"w",
"io",
".",
"Writer",
",",
"group",
"*",
"commandGroup",
")",
"{",
"if",
"len",
"(",
"group",
".",
"commands",
")",
"==",
"0",
"{",
"return",
"\n",
"}",
"\n",
"if",
"group",
".",
"name",
"==",
"\"",
"\"",
"{",
"fmt",
".",
"Fprintf",
"(",
"w",
",",
"\"",
"\\n",
"\"",
")",
"\n",
"}",
"else",
"{",
"fmt",
".",
"Fprintf",
"(",
"w",
",",
"\"",
"\\n",
"\"",
",",
"group",
".",
"name",
")",
"\n",
"}",
"\n",
"sort",
".",
"Sort",
"(",
"group",
")",
"\n\n",
"aliases",
":=",
"make",
"(",
"map",
"[",
"string",
"]",
"[",
"]",
"string",
")",
"\n",
"for",
"_",
",",
"cmd",
":=",
"range",
"group",
".",
"commands",
"{",
"if",
"alias",
",",
"ok",
":=",
"cmd",
".",
"(",
"*",
"aliaser",
")",
";",
"ok",
"{",
"root",
":=",
"dealias",
"(",
"alias",
")",
".",
"Name",
"(",
")",
"\n\n",
"if",
"_",
",",
"ok",
":=",
"aliases",
"[",
"root",
"]",
";",
"!",
"ok",
"{",
"aliases",
"[",
"root",
"]",
"=",
"[",
"]",
"string",
"{",
"}",
"\n",
"}",
"\n",
"aliases",
"[",
"root",
"]",
"=",
"append",
"(",
"aliases",
"[",
"root",
"]",
",",
"alias",
".",
"<mask>",
"(",
")",
")",
"\n",
"}",
"\n",
"}",
"\n\n",
"for",
"_",
",",
"cmd",
":=",
"range",
"group",
".",
"commands",
"{",
"if",
"_",
",",
"ok",
":=",
"cmd",
".",
"(",
"*",
"aliaser",
")",
";",
"ok",
"{",
"continue",
"\n",
"}",
"\n\n",
"name",
":=",
"cmd",
".",
"Name",
"(",
")",
"\n",
"names",
":=",
"[",
"]",
"string",
"{",
"name",
"}",
"\n\n",
"if",
"a",
",",
"ok",
":=",
"aliases",
"[",
"name",
"]",
";",
"ok",
"{",
"names",
"=",
"append",
"(",
"names",
",",
"a",
"...",
")",
"\n",
"}",
"\n\n",
"fmt",
".",
"Fprintf",
"(",
"w",
",",
"\"",
"\\t",
"\\n",
"\"",
",",
"strings",
".",
"Join",
"(",
"names",
",",
"\"",
"\"",
")",
",",
"cmd",
".",
"Synopsis",
"(",
")",
")",
"\n",
"}",
"\n",
"fmt",
".",
"Fprintln",
"(",
"w",
")",
"\n",
"}"
] |
5,715 | all-5716 | [
"NewLogAdapterFor",
"creates",
"a",
"LogAdapter",
"that",
"wraps",
"the",
"given",
"loger",
"with",
"the",
"given",
"attributes",
"."
] | [
"func",
"NewLogAdapterFor",
"(",
"base",
"WrappableLogger",
",",
"attrs",
"*",
"Attrs",
")",
"*",
"LogAdapter",
"{",
"if",
"attrs",
"==",
"nil",
"{",
"attrs",
"=",
"NewAttrs",
"(",
")",
"\n",
"}",
"\n\n",
"return",
"&",
"LogAdapter",
"{",
"<mask>",
":",
"base",
",",
"attrs",
":",
"attrs",
",",
"}",
"\n",
"}"
] |
5,716 | all-5717 | [
"NewDockerStatsEngine",
"creates",
"a",
"new",
"instance",
"of",
"the",
"DockerStatsEngine",
"object",
".",
"MustInit",
"()",
"must",
"be",
"called",
"to",
"initialize",
"the",
"fields",
"of",
"the",
"new",
"event",
"listener",
"."
] | [
"func",
"NewDockerStatsEngine",
"(",
"cfg",
"*",
"config",
".",
"Config",
",",
"<mask>",
"dockerapi",
".",
"DockerClient",
",",
"containerChangeEventStream",
"*",
"eventstream",
".",
"EventStream",
")",
"*",
"DockerStatsEngine",
"{",
"return",
"&",
"DockerStatsEngine",
"{",
"client",
":",
"client",
",",
"resolver",
":",
"nil",
",",
"disableMetrics",
":",
"cfg",
".",
"DisableMetrics",
",",
"tasksToContainers",
":",
"make",
"(",
"map",
"[",
"string",
"]",
"map",
"[",
"string",
"]",
"*",
"StatsContainer",
")",
",",
"tasksToHealthCheckContainers",
":",
"make",
"(",
"map",
"[",
"string",
"]",
"map",
"[",
"string",
"]",
"*",
"StatsContainer",
")",
",",
"tasksToDefinitions",
":",
"make",
"(",
"map",
"[",
"string",
"]",
"*",
"taskDefinition",
")",
",",
"containerChangeEventStream",
":",
"containerChangeEventStream",
",",
"}",
"\n",
"}"
] |
5,717 | all-5718 | [
"MarshalJSON",
"supports",
"json",
".",
"Marshaler",
"interface"
] | [
"func",
"(",
"v",
"DisposeBrowserContextParams",
")",
"MarshalJSON",
"(",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"w",
":=",
"jwriter",
".",
"<mask>",
"{",
"}",
"\n",
"easyjsonC5a4559bEncodeGithubComChromedpCdprotoTarget20",
"(",
"&",
"w",
",",
"v",
")",
"\n",
"return",
"w",
".",
"Buffer",
".",
"BuildBytes",
"(",
")",
",",
"w",
".",
"Error",
"\n",
"}"
] |
5,718 | all-5719 | [
"Do",
"executes",
"Runtime",
".",
"runIfWaitingForDebugger",
"against",
"the",
"provided",
"context",
"."
] | [
"func",
"(",
"p",
"*",
"RunIfWaitingForDebuggerParams",
")",
"Do",
"(",
"ctx",
"context",
".",
"<mask>",
")",
"(",
"err",
"error",
")",
"{",
"return",
"cdp",
".",
"Execute",
"(",
"ctx",
",",
"CommandRunIfWaitingForDebugger",
",",
"nil",
",",
"nil",
")",
"\n",
"}"
] |
5,719 | all-5720 | [
"recordTransition",
"records",
"state",
"change",
"happening",
"in",
"every",
"subConn",
"and",
"based",
"on",
"that",
"it",
"evaluates",
"what",
"aggregated",
"state",
"should",
"be",
".",
"It",
"can",
"only",
"transition",
"between",
"Ready",
"Connecting",
"and",
"TransientFailure",
".",
"Other",
"states",
"Idle",
"and",
"Shutdown",
"are",
"transitioned",
"into",
"by",
"ClientConn",
";",
"in",
"the",
"beginning",
"of",
"the",
"connection",
"before",
"any",
"subConn",
"is",
"created",
"ClientConn",
"is",
"in",
"idle",
"state",
".",
"In",
"the",
"end",
"when",
"ClientConn",
"closes",
"it",
"is",
"in",
"Shutdown",
"state",
".",
"recordTransition",
"should",
"only",
"be",
"called",
"synchronously",
"from",
"the",
"same",
"goroutine",
"."
] | [
"func",
"(",
"cse",
"*",
"connectivityStateEvaluator",
")",
"recordTransition",
"(",
"oldState",
",",
"newState",
"connectivity",
".",
"State",
")",
"connectivity",
".",
"State",
"{",
"// Update counters.",
"for",
"idx",
",",
"state",
":=",
"<mask>",
"[",
"]",
"connectivity",
".",
"State",
"{",
"oldState",
",",
"newState",
"}",
"{",
"updateVal",
":=",
"2",
"*",
"uint64",
"(",
"idx",
")",
"-",
"1",
"// -1 for oldState and +1 for new.",
"\n",
"switch",
"state",
"{",
"case",
"connectivity",
".",
"Ready",
":",
"cse",
".",
"numReady",
"+=",
"updateVal",
"\n",
"case",
"connectivity",
".",
"Connecting",
":",
"cse",
".",
"numConnecting",
"+=",
"updateVal",
"\n",
"case",
"connectivity",
".",
"TransientFailure",
":",
"cse",
".",
"numTransientFailure",
"+=",
"updateVal",
"\n",
"}",
"\n",
"}",
"\n\n",
"// Evaluate.",
"if",
"cse",
".",
"numReady",
">",
"0",
"{",
"return",
"connectivity",
".",
"Ready",
"\n",
"}",
"\n",
"if",
"cse",
".",
"numConnecting",
">",
"0",
"{",
"return",
"connectivity",
".",
"Connecting",
"\n",
"}",
"\n",
"return",
"connectivity",
".",
"TransientFailure",
"\n",
"}"
] |
5,720 | all-5721 | [
"GetSpacing",
"()",
"is",
"a",
"wrapper",
"around",
"gtk_box_get_spacing",
"()",
"."
] | [
"func",
"(",
"v",
"*",
"Box",
")",
"GetSpacing",
"(",
")",
"int",
"{",
"c",
":=",
"C",
".",
"gtk_box_get_spacing",
"(",
"v",
".",
"native",
"(",
")",
")",
"\n",
"<mask>",
"int",
"(",
"c",
")",
"\n",
"}"
] |
5,721 | all-5722 | [
"NewCmdWithRunner",
"creates",
"a",
"new",
"CmdWithRunner",
"for",
"the",
"provided",
"name",
"and",
"runner",
".",
"Returns",
"an",
"error",
"if",
"the",
"provided",
"name",
"is",
"not",
"a",
"legal",
"command",
"name",
"."
] | [
"func",
"NewCmdWithRunner",
"(",
"cmdName",
"string",
",",
"runner",
"func",
"(",
")",
")",
"(",
"*",
"CmdWithRunner",
",",
"error",
")",
"{",
"if",
"cmdName",
"==",
"\"",
"\"",
"{",
"return",
"nil",
",",
"errors",
".",
"New",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"for",
"_",
",",
"r",
":=",
"<mask>",
"cmdName",
"{",
"if",
"unicode",
".",
"IsSpace",
"(",
"r",
")",
"{",
"return",
"nil",
",",
"errors",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"cmdName",
")",
"\n",
"}",
"\n",
"}",
"\n\n",
"return",
"&",
"CmdWithRunner",
"{",
"cmdName",
":",
"cmdName",
",",
"runner",
":",
"runner",
",",
"}",
",",
"nil",
"\n",
"}"
] |
5,722 | all-5723 | [
"cleanupPauseContainerNetwork",
"will",
"clean",
"up",
"the",
"network",
"namespace",
"of",
"pause",
"container"
] | [
"func",
"(",
"engine",
"*",
"DockerTaskEngine",
")",
"cleanupPauseContainerNetwork",
"(",
"task",
"*",
"apitask",
".",
"Task",
",",
"container",
"*",
"apicontainer",
".",
"<mask>",
")",
"error",
"{",
"seelog",
".",
"Infof",
"(",
"\"",
"\"",
",",
"task",
".",
"Arn",
")",
"\n\n",
"cniConfig",
",",
"err",
":=",
"engine",
".",
"buildCNIConfigFromTaskContainer",
"(",
"task",
",",
"container",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"errors",
".",
"Wrapf",
"(",
"err",
",",
"\"",
"\"",
",",
"task",
".",
"String",
"(",
")",
")",
"\n",
"}",
"\n\n",
"return",
"engine",
".",
"cniClient",
".",
"CleanupNS",
"(",
"engine",
".",
"ctx",
",",
"cniConfig",
",",
"cniCleanupTimeout",
")",
"\n",
"}"
] |
5,723 | all-5724 | [
"mustWaitPinReady",
"waits",
"up",
"to",
"3",
"-",
"second",
"until",
"connection",
"is",
"up",
"(",
"pin",
"endpoint",
")",
".",
"Fatal",
"on",
"time",
"-",
"out",
"."
] | [
"func",
"mustWaitPinReady",
"(",
"t",
"*",
"testing",
".",
"T",
",",
"cli",
"*",
"clientv3",
".",
"Client",
")",
"{",
"// TODO: decrease timeout after balancer rewrite!!!",
"ctx",
",",
"cancel",
":=",
"context",
".",
"WithTimeout",
"(",
"context",
".",
"Background",
"(",
")",
",",
"10",
"*",
"<mask>",
".",
"Second",
")",
"\n",
"_",
",",
"err",
":=",
"cli",
".",
"Get",
"(",
"ctx",
",",
"\"",
"\"",
")",
"\n",
"cancel",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"t",
".",
"Fatal",
"(",
"err",
")",
"\n",
"}",
"\n",
"}"
] |
5,724 | all-5725 | [
"CloudLocator",
"builds",
"a",
"locator",
"from",
"the",
"given",
"href",
"."
] | [
"func",
"(",
"api",
"*",
"API",
")",
"CloudLocator",
"(",
"href",
"string",
")",
"*",
"CloudLocator",
"{",
"<mask>",
"&",
"CloudLocator",
"{",
"Href",
"(",
"href",
")",
",",
"api",
"}",
"\n",
"}"
] |
5,725 | all-5726 | [
"Pop",
"pops",
"a",
"segment",
"id",
"off",
"of",
"the",
"segment",
"stack",
".",
"It",
"returns",
"false",
"if",
"the",
"stack",
"is",
"empty",
"."
] | [
"func",
"(",
"s",
"*",
"SegmentStack",
")",
"Pop",
"(",
")",
"(",
"int64",
",",
"bool",
")",
"{",
"s",
".",
"Lock",
"(",
")",
"\n",
"defer",
"s",
".",
"Unlock",
"(",
")",
"\n",
"if",
"s",
".",
"Len",
"(",
")",
"==",
"0",
"{",
"return",
"rootSegment",
",",
"false",
"\n",
"}",
"\n",
"id",
":=",
"s",
".",
"s",
"[",
"s",
".",
"Len",
"(",
")",
"-",
"1",
"]",
"\n",
"s",
".",
"s",
"=",
"s",
".",
"s",
"[",
":",
"s",
".",
"Len",
"(",
")",
"-",
"1",
"]",
"\n",
"return",
"<mask>",
",",
"true",
"\n",
"}"
] |
5,726 | all-5727 | [
"Sorti",
"rearranges",
"the",
"position",
"of",
"integer",
"entries",
"in",
"this",
"list",
"so",
"that",
"they",
"are",
"ascending",
"."
] | [
"func",
"(",
"list",
"*",
"LinkedList",
")",
"Sorti",
"(",
")",
"(",
"err",
"error",
")",
"{",
"list",
".",
"key",
".",
"Lock",
"(",
")",
"\n",
"defer",
"list",
".",
"key",
".",
"Unlock",
"(",
")",
"\n\n",
"list",
".",
"first",
",",
"err",
"=",
"mergeSort",
"(",
"list",
".",
"<mask>",
",",
"func",
"(",
"a",
",",
"b",
"interface",
"{",
"}",
")",
"(",
"int",
",",
"error",
")",
"{",
"castA",
",",
"ok",
":=",
"a",
".",
"(",
"int",
")",
"\n",
"if",
"!",
"ok",
"{",
"return",
"0",
",",
"ErrUnexpectedType",
"\n",
"}",
"\n",
"castB",
",",
"ok",
":=",
"b",
".",
"(",
"int",
")",
"\n",
"if",
"!",
"ok",
"{",
"return",
"0",
",",
"ErrUnexpectedType",
"\n",
"}",
"\n\n",
"return",
"castA",
"-",
"castB",
",",
"nil",
"\n",
"}",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"\n",
"}",
"\n",
"list",
".",
"last",
"=",
"findLast",
"(",
"list",
".",
"first",
")",
"\n",
"return",
"\n",
"}"
] |
5,727 | all-5728 | [
"GetSizingOk",
"returns",
"a",
"tuple",
"with",
"the",
"Sizing",
"field",
"if",
"it",
"s",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"and",
"a",
"boolean",
"to",
"check",
"if",
"the",
"value",
"has",
"been",
"set",
"."
] | [
"func",
"(",
"w",
"*",
"Widget",
")",
"GetSizingOk",
"(",
")",
"(",
"string",
",",
"bool",
")",
"{",
"if",
"w",
"==",
"nil",
"||",
"w",
".",
"Sizing",
"==",
"nil",
"{",
"return",
"\"",
"\"",
",",
"<mask>",
"\n",
"}",
"\n",
"return",
"*",
"w",
".",
"Sizing",
",",
"true",
"\n",
"}"
] |
5,728 | all-5729 | [
"Print",
"the",
"inner",
"types",
"."
] | [
"func",
"(",
"ps",
"*",
"printState",
")",
"printInner",
"(",
"prefixOnly",
"bool",
")",
"[",
"]",
"AST",
"{",
"var",
"save",
"[",
"]",
"AST",
"\n",
"var",
"psave",
"*",
"[",
"]",
"AST",
"\n",
"if",
"prefixOnly",
"{",
"psave",
"=",
"&",
"save",
"\n",
"}",
"\n",
"for",
"len",
"(",
"ps",
".",
"inner",
")",
">",
"0",
"{",
"ps",
".",
"printOneInner",
"(",
"psave",
")",
"\n",
"}",
"\n",
"return",
"<mask>",
"\n",
"}"
] |
5,729 | all-5730 | [
"Pop",
"retrieves",
"the",
"last",
"added",
"event"
] | [
"func",
"(",
"t",
"*",
"EventTimeHeap",
")",
"Pop",
"(",
")",
"interface",
"{",
"}",
"{",
"<mask>",
":=",
"*",
"t",
"\n",
"n",
":=",
"len",
"(",
"old",
")",
"\n",
"x",
":=",
"old",
"[",
"n",
"-",
"1",
"]",
"\n",
"*",
"t",
"=",
"old",
"[",
"0",
":",
"n",
"-",
"1",
"]",
"\n",
"return",
"x",
"\n",
"}"
] |
5,730 | all-5731 | [
"NewContextWithContext",
"returns",
"a",
"new",
"plush",
".",
"Context",
"given",
"another",
"context"
] | [
"func",
"NewContextWithContext",
"(",
"ctx",
"<mask>",
".",
"Context",
")",
"*",
"Context",
"{",
"c",
":=",
"NewContext",
"(",
")",
"\n",
"c",
".",
"Context",
"=",
"ctx",
"\n",
"return",
"c",
"\n",
"}"
] |
5,731 | all-5732 | [
"URLPath",
"build",
"path",
"part",
"of",
"URL",
"by",
"given",
"pair",
"values",
"."
] | [
"func",
"(",
"l",
"*",
"Leaf",
")",
"URLPath",
"(",
"pairs",
"...",
"string",
")",
"string",
"{",
"if",
"len",
"(",
"pairs",
")",
"%",
"2",
"!=",
"0",
"{",
"panic",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"urlPath",
":=",
"l",
".",
"rawPattern",
"\n",
"parent",
":=",
"l",
".",
"parent",
"\n",
"for",
"parent",
"!=",
"nil",
"{",
"urlPath",
"=",
"<mask>",
".",
"rawPattern",
"+",
"\"",
"\"",
"+",
"urlPath",
"\n",
"parent",
"=",
"parent",
".",
"parent",
"\n",
"}",
"\n",
"for",
"i",
":=",
"0",
";",
"i",
"<",
"len",
"(",
"pairs",
")",
";",
"i",
"+=",
"2",
"{",
"if",
"len",
"(",
"pairs",
"[",
"i",
"]",
")",
"==",
"0",
"{",
"panic",
"(",
"\"",
"\"",
"+",
"com",
".",
"ToStr",
"(",
"i",
")",
")",
"\n",
"}",
"else",
"if",
"pairs",
"[",
"i",
"]",
"[",
"0",
"]",
"!=",
"':'",
"&&",
"pairs",
"[",
"i",
"]",
"!=",
"\"",
"\"",
"&&",
"pairs",
"[",
"i",
"]",
"!=",
"\"",
"\"",
"{",
"pairs",
"[",
"i",
"]",
"=",
"\"",
"\"",
"+",
"pairs",
"[",
"i",
"]",
"\n",
"}",
"\n",
"urlPath",
"=",
"strings",
".",
"Replace",
"(",
"urlPath",
",",
"pairs",
"[",
"i",
"]",
",",
"pairs",
"[",
"i",
"+",
"1",
"]",
",",
"1",
")",
"\n",
"}",
"\n",
"return",
"urlPath",
"\n",
"}"
] |
5,732 | all-5733 | [
"numToString",
"converts",
"a",
"number",
"a",
"string",
"using",
"the",
"given",
"alpabet",
"."
] | [
"func",
"(",
"b",
"*",
"base57",
")",
"numToString",
"(",
"number",
"*",
"big",
".",
"Int",
",",
"padToLen",
"int",
")",
"string",
"{",
"var",
"(",
"out",
"string",
"\n",
"digit",
"*",
"big",
".",
"Int",
"\n",
")",
"\n\n",
"for",
"number",
".",
"Uint64",
"(",
")",
">",
"0",
"{",
"number",
",",
"digit",
"=",
"new",
"(",
"big",
".",
"Int",
")",
".",
"DivMod",
"(",
"number",
",",
"big",
".",
"NewInt",
"(",
"b",
".",
"alphabet",
".",
"Length",
"(",
")",
")",
",",
"new",
"(",
"big",
".",
"Int",
")",
")",
"\n",
"out",
"+=",
"b",
".",
"alphabet",
".",
"chars",
"[",
"digit",
".",
"Int64",
"(",
")",
"]",
"\n",
"}",
"\n\n",
"if",
"padToLen",
">",
"0",
"{",
"remainder",
":=",
"math",
".",
"Max",
"(",
"float64",
"(",
"padToLen",
"-",
"len",
"(",
"out",
")",
")",
",",
"0",
")",
"\n",
"out",
"=",
"out",
"+",
"strings",
".",
"Repeat",
"(",
"b",
".",
"alphabet",
".",
"chars",
"[",
"0",
"]",
",",
"int",
"(",
"remainder",
")",
")",
"\n",
"}",
"\n\n",
"return",
"<mask>",
"\n",
"}"
] |
5,733 | all-5734 | [
"ItemToResourcesConfig",
"casts",
"an",
"Item",
"object",
"to",
"a",
"ResourcesConfig"
] | [
"func",
"ItemToResourcesConfig",
"(",
"i",
"Item",
")",
"(",
"ResourcesConfig",
",",
"error",
")",
"{",
"conf",
",",
"<mask>",
":=",
"i",
".",
"(",
"ResourcesConfig",
")",
"\n",
"if",
"!",
"ok",
"{",
"return",
"ResourcesConfig",
"{",
"}",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"i",
")",
"\n",
"}",
"\n",
"return",
"conf",
",",
"nil",
"\n",
"}"
] |
5,734 | all-5735 | [
"depaginate",
"adds",
"depagination",
"on",
"top",
"of",
"the",
"retry",
"and",
"rate",
"limiting",
"logic",
"provided",
"by",
"retry",
"."
] | [
"func",
"(",
"c",
"*",
"Client",
")",
"depaginate",
"(",
"action",
"string",
",",
"opts",
"*",
"github",
".",
"ListOptions",
",",
"call",
"func",
"(",
")",
"(",
"[",
"]",
"interface",
"{",
"}",
",",
"*",
"github",
".",
"Response",
",",
"error",
")",
")",
"(",
"[",
"]",
"interface",
"{",
"}",
",",
"error",
")",
"{",
"var",
"allItems",
"[",
"]",
"interface",
"{",
"}",
"\n",
"wrapper",
":=",
"func",
"(",
")",
"(",
"*",
"github",
".",
"Response",
",",
"error",
")",
"{",
"<mask>",
",",
"resp",
",",
"err",
":=",
"call",
"(",
")",
"\n",
"if",
"err",
"==",
"nil",
"{",
"allItems",
"=",
"append",
"(",
"allItems",
",",
"items",
"...",
")",
"\n",
"}",
"\n",
"return",
"resp",
",",
"err",
"\n",
"}",
"\n\n",
"opts",
".",
"Page",
"=",
"1",
"\n",
"opts",
".",
"PerPage",
"=",
"100",
"\n",
"lastPage",
":=",
"1",
"\n",
"for",
";",
"opts",
".",
"Page",
"<=",
"lastPage",
";",
"opts",
".",
"Page",
"++",
"{",
"resp",
",",
"err",
":=",
"c",
".",
"retry",
"(",
"action",
",",
"wrapper",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"allItems",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"opts",
".",
"Page",
",",
"lastPage",
",",
"err",
")",
"\n",
"}",
"\n",
"if",
"resp",
".",
"LastPage",
">",
"0",
"{",
"lastPage",
"=",
"resp",
".",
"LastPage",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"allItems",
",",
"nil",
"\n",
"}"
] |
5,735 | all-5736 | [
"Map",
"applies",
"a",
"function",
"that",
"processes",
"individual",
"strings",
"to",
"the",
"strings",
"in",
"ps",
"and",
"returns",
"a",
"new",
"PlatformStrings",
"with",
"the",
"result",
".",
"Empty",
"strings",
"returned",
"by",
"the",
"function",
"are",
"dropped",
"."
] | [
"func",
"(",
"ps",
"*",
"PlatformStrings",
")",
"Map",
"(",
"f",
"func",
"(",
"s",
"string",
")",
"(",
"string",
",",
"error",
")",
")",
"(",
"PlatformStrings",
",",
"[",
"]",
"error",
")",
"{",
"var",
"errors",
"[",
"]",
"error",
"\n",
"mapSlice",
":=",
"func",
"(",
"ss",
"[",
"]",
"string",
")",
"(",
"[",
"]",
"string",
",",
"error",
")",
"{",
"rs",
":=",
"make",
"(",
"[",
"]",
"string",
",",
"0",
",",
"len",
"(",
"<mask>",
")",
")",
"\n",
"for",
"_",
",",
"s",
":=",
"range",
"ss",
"{",
"if",
"r",
",",
"err",
":=",
"f",
"(",
"s",
")",
";",
"err",
"!=",
"nil",
"{",
"errors",
"=",
"append",
"(",
"errors",
",",
"err",
")",
"\n",
"}",
"else",
"if",
"r",
"!=",
"\"",
"\"",
"{",
"rs",
"=",
"append",
"(",
"rs",
",",
"r",
")",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"rs",
",",
"nil",
"\n",
"}",
"\n",
"result",
",",
"_",
":=",
"ps",
".",
"MapSlice",
"(",
"mapSlice",
")",
"\n",
"return",
"result",
",",
"errors",
"\n",
"}"
] |
5,736 | all-5737 | [
"CreateContainerFromBackup",
"is",
"a",
"convenience",
"function",
"to",
"make",
"it",
"easier",
"to",
"create",
"a",
"container",
"from",
"a",
"backup"
] | [
"func",
"(",
"r",
"*",
"ProtocolLXD",
")",
"CreateContainerFromBackup",
"(",
"args",
"ContainerBackupArgs",
")",
"(",
"Operation",
",",
"error",
")",
"{",
"if",
"!",
"r",
".",
"HasExtension",
"(",
"\"",
"\"",
")",
"{",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\\\"",
"\\\"",
"\"",
")",
"\n",
"}",
"\n\n",
"if",
"args",
".",
"PoolName",
"==",
"\"",
"\"",
"{",
"// Send the request",
"op",
",",
"_",
",",
"err",
":=",
"r",
".",
"queryOperation",
"(",
"\"",
"\"",
",",
"\"",
"\"",
",",
"args",
".",
"BackupFile",
",",
"\"",
"\"",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"return",
"op",
",",
"nil",
"\n",
"}",
"\n\n",
"if",
"!",
"r",
".",
"HasExtension",
"(",
"\"",
"\"",
")",
"{",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\\\"",
"\\\"",
"\"",
")",
"\n",
"}",
"\n\n",
"// Prepare the HTTP request",
"reqURL",
",",
"err",
":=",
"r",
".",
"setQueryAttributes",
"(",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"r",
".",
"httpHost",
")",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"req",
",",
"err",
":=",
"http",
".",
"NewRequest",
"(",
"\"",
"\"",
",",
"reqURL",
",",
"args",
".",
"BackupFile",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"req",
".",
"Header",
".",
"Set",
"(",
"\"",
"\"",
",",
"\"",
"\"",
")",
"\n",
"req",
".",
"Header",
".",
"Set",
"(",
"\"",
"\"",
",",
"args",
".",
"PoolName",
")",
"\n\n",
"// Set the user agent",
"if",
"r",
".",
"httpUserAgent",
"!=",
"\"",
"\"",
"{",
"req",
".",
"Header",
".",
"Set",
"(",
"\"",
"\"",
",",
"r",
".",
"httpUserAgent",
")",
"\n",
"}",
"\n\n",
"// Send the request",
"resp",
",",
"err",
":=",
"r",
".",
"<mask>",
"(",
"req",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"defer",
"resp",
".",
"Body",
".",
"Close",
"(",
")",
"\n\n",
"// Handle errors",
"response",
",",
"_",
",",
"err",
":=",
"lxdParseResponse",
"(",
"resp",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"// Get to the operation",
"respOperation",
",",
"err",
":=",
"response",
".",
"MetadataAsOperation",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"// Setup an Operation wrapper",
"op",
":=",
"operation",
"{",
"Operation",
":",
"*",
"respOperation",
",",
"r",
":",
"r",
",",
"chActive",
":",
"make",
"(",
"chan",
"bool",
")",
",",
"}",
"\n\n",
"return",
"&",
"op",
",",
"nil",
"\n",
"}"
] |
5,737 | all-5738 | [
"Insert",
"is",
"a",
"wrapper",
"around",
"gtk_menu_shell_insert",
"()",
"."
] | [
"func",
"(",
"v",
"*",
"MenuShell",
")",
"Insert",
"(",
"child",
"IMenuItem",
",",
"<mask>",
"int",
")",
"{",
"C",
".",
"gtk_menu_shell_insert",
"(",
"v",
".",
"native",
"(",
")",
",",
"child",
".",
"toWidget",
"(",
")",
",",
"C",
".",
"gint",
"(",
"position",
")",
")",
"\n",
"}"
] |
5,738 | all-5739 | [
"/",
"*",
"Generally",
"used",
"when",
"formatting",
"type",
"check",
"errors",
".",
"We",
"could",
"store",
"the",
"stringified",
"symbol",
"somewhere",
"else",
"and",
"not",
"require",
"a",
"duplicated",
"codeblock",
"to",
"translate",
"OperatorSymbol",
"to",
"string",
"but",
"that",
"would",
"require",
"more",
"memory",
"and",
"another",
"field",
"somewhere",
".",
"Adding",
"operators",
"is",
"rare",
"enough",
"that",
"we",
"just",
"stringify",
"it",
"here",
"instead",
"."
] | [
"func",
"(",
"this",
"OperatorSymbol",
")",
"String",
"(",
")",
"string",
"{",
"switch",
"this",
"{",
"case",
"NOOP",
":",
"return",
"\"",
"\"",
"\n",
"case",
"VALUE",
":",
"return",
"\"",
"\"",
"\n",
"case",
"EQ",
":",
"return",
"\"",
"\"",
"\n",
"case",
"NEQ",
":",
"return",
"\"",
"\"",
"\n",
"case",
"GT",
":",
"return",
"\"",
"\"",
"\n",
"case",
"LT",
":",
"return",
"\"",
"\"",
"\n",
"case",
"GTE",
":",
"return",
"\"",
"\"",
"\n",
"case",
"LTE",
":",
"return",
"\"",
"\"",
"\n",
"case",
"REQ",
":",
"return",
"\"",
"\"",
"\n",
"case",
"NREQ",
":",
"return",
"\"",
"\"",
"\n",
"case",
"AND",
":",
"return",
"\"",
"\"",
"\n",
"case",
"OR",
":",
"return",
"\"",
"\"",
"\n",
"case",
"IN",
":",
"return",
"\"",
"\"",
"\n",
"case",
"BITWISE_AND",
":",
"return",
"\"",
"\"",
"\n",
"case",
"BITWISE_OR",
":",
"return",
"\"",
"\"",
"\n",
"<mask>",
"BITWISE_XOR",
":",
"return",
"\"",
"\"",
"\n",
"case",
"BITWISE_LSHIFT",
":",
"return",
"\"",
"\"",
"\n",
"case",
"BITWISE_RSHIFT",
":",
"return",
"\"",
"\"",
"\n",
"case",
"PLUS",
":",
"return",
"\"",
"\"",
"\n",
"case",
"MINUS",
":",
"return",
"\"",
"\"",
"\n",
"case",
"MULTIPLY",
":",
"return",
"\"",
"\"",
"\n",
"case",
"DIVIDE",
":",
"return",
"\"",
"\"",
"\n",
"case",
"MODULUS",
":",
"return",
"\"",
"\"",
"\n",
"case",
"EXPONENT",
":",
"return",
"\"",
"\"",
"\n",
"case",
"NEGATE",
":",
"return",
"\"",
"\"",
"\n",
"case",
"INVERT",
":",
"return",
"\"",
"\"",
"\n",
"case",
"BITWISE_NOT",
":",
"return",
"\"",
"\"",
"\n",
"case",
"TERNARY_TRUE",
":",
"return",
"\"",
"\"",
"\n",
"case",
"TERNARY_FALSE",
":",
"return",
"\"",
"\"",
"\n",
"case",
"COALESCE",
":",
"return",
"\"",
"\"",
"\n",
"}",
"\n",
"return",
"\"",
"\"",
"\n",
"}"
] |
5,739 | all-5740 | [
"NodeRename",
"changes",
"the",
"name",
"of",
"an",
"existing",
"node",
".",
"Return",
"an",
"error",
"if",
"a",
"node",
"with",
"the",
"same",
"name",
"already",
"exists",
"."
] | [
"func",
"(",
"c",
"*",
"ClusterTx",
")",
"NodeRename",
"(",
"old",
",",
"new",
"string",
")",
"error",
"{",
"count",
",",
"err",
":=",
"query",
".",
"Count",
"(",
"c",
".",
"tx",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"new",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"errors",
".",
"Wrap",
"(",
"err",
",",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"if",
"count",
"!=",
"0",
"{",
"return",
"ErrAlreadyDefined",
"\n",
"}",
"\n",
"stmt",
":=",
"`UPDATE nodes SET name=? WHERE name=?`",
"\n",
"result",
",",
"err",
":=",
"c",
".",
"<mask>",
".",
"Exec",
"(",
"stmt",
",",
"new",
",",
"old",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"errors",
".",
"Wrap",
"(",
"err",
",",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"n",
",",
"err",
":=",
"result",
".",
"RowsAffected",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"errors",
".",
"Wrap",
"(",
"err",
",",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"if",
"n",
"!=",
"1",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"n",
")",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
] |
5,740 | all-5741 | [
"Ordered",
"converts",
"an",
"unordered",
"hashtree",
"into",
"an",
"ordered",
"hashtree",
"."
] | [
"func",
"(",
"u",
"*",
"Unordered",
")",
"Ordered",
"(",
")",
"*",
"Ordered",
"{",
"paths",
":=",
"make",
"(",
"[",
"]",
"string",
",",
"len",
"(",
"u",
".",
"fs",
")",
")",
"\n",
"i",
":=",
"0",
"\n",
"for",
"path",
":=",
"<mask>",
"u",
".",
"fs",
"{",
"paths",
"[",
"i",
"]",
"=",
"path",
"\n",
"i",
"++",
"\n",
"}",
"\n",
"sort",
".",
"Strings",
"(",
"paths",
")",
"\n",
"o",
":=",
"NewOrdered",
"(",
"\"",
"\"",
")",
"\n",
"for",
"i",
":=",
"1",
";",
"i",
"<",
"len",
"(",
"paths",
")",
";",
"i",
"++",
"{",
"path",
":=",
"paths",
"[",
"i",
"]",
"\n",
"n",
":=",
"u",
".",
"fs",
"[",
"path",
"]",
"\n",
"if",
"n",
".",
"DirNode",
"!=",
"nil",
"{",
"o",
".",
"putDir",
"(",
"path",
",",
"n",
")",
"\n",
"}",
"else",
"{",
"o",
".",
"putFile",
"(",
"path",
",",
"n",
")",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"o",
"\n",
"}"
] |
5,741 | all-5742 | [
"UpdateGroup",
"updates",
"a",
"group"
] | [
"func",
"(",
"c",
"*",
"Client",
")",
"UpdateGroup",
"(",
"groupid",
"string",
",",
"obj",
"Group",
")",
"(",
"*",
"<mask>",
",",
"error",
")",
"{",
"url",
":=",
"umGroupPath",
"(",
"groupid",
")",
"+",
"`?depth=`",
"+",
"c",
".",
"client",
".",
"depth",
"+",
"`&pretty=`",
"+",
"strconv",
".",
"FormatBool",
"(",
"c",
".",
"client",
".",
"pretty",
")",
"\n",
"ret",
":=",
"&",
"Group",
"{",
"}",
"\n",
"err",
":=",
"c",
".",
"client",
".",
"Put",
"(",
"url",
",",
"obj",
",",
"ret",
",",
"http",
".",
"StatusAccepted",
")",
"\n",
"return",
"ret",
",",
"err",
"\n",
"}"
] |
5,742 | all-5743 | [
"findControllerForDevice",
"locates",
"a",
"controller",
"via",
"its",
"virtual",
"device",
"."
] | [
"func",
"findControllerForDevice",
"(",
"l",
"object",
".",
"VirtualDeviceList",
",",
"bvd",
"types",
".",
"BaseVirtualDevice",
")",
"(",
"types",
".",
"BaseVirtualController",
",",
"error",
")",
"{",
"vd",
":=",
"bvd",
".",
"GetVirtualDevice",
"(",
")",
"\n",
"ctlr",
":=",
"l",
".",
"FindByKey",
"(",
"vd",
".",
"ControllerKey",
")",
"\n\n",
"if",
"ctlr",
"==",
"nil",
"{",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"vd",
".",
"ControllerKey",
",",
"vd",
".",
"<mask>",
")",
"\n",
"}",
"\n\n",
"return",
"ctlr",
".",
"(",
"types",
".",
"BaseVirtualController",
")",
",",
"nil",
"\n",
"}"
] |
5,743 | all-5744 | [
"Create",
"creates",
"the",
"node",
"at",
"nodePath",
".",
"Create",
"will",
"help",
"to",
"create",
"intermediate",
"directories",
"with",
"no",
"ttl",
".",
"If",
"the",
"node",
"has",
"already",
"existed",
"create",
"will",
"fail",
".",
"If",
"any",
"node",
"on",
"the",
"path",
"is",
"a",
"file",
"create",
"will",
"fail",
"."
] | [
"func",
"(",
"s",
"*",
"<mask>",
")",
"Create",
"(",
"nodePath",
"string",
",",
"dir",
"bool",
",",
"value",
"string",
",",
"unique",
"bool",
",",
"expireOpts",
"TTLOptionSet",
")",
"(",
"*",
"Event",
",",
"error",
")",
"{",
"var",
"err",
"*",
"v2error",
".",
"Error",
"\n\n",
"s",
".",
"worldLock",
".",
"Lock",
"(",
")",
"\n",
"defer",
"s",
".",
"worldLock",
".",
"Unlock",
"(",
")",
"\n\n",
"defer",
"func",
"(",
")",
"{",
"if",
"err",
"==",
"nil",
"{",
"s",
".",
"Stats",
".",
"Inc",
"(",
"CreateSuccess",
")",
"\n",
"reportWriteSuccess",
"(",
"Create",
")",
"\n",
"return",
"\n",
"}",
"\n\n",
"s",
".",
"Stats",
".",
"Inc",
"(",
"CreateFail",
")",
"\n",
"reportWriteFailure",
"(",
"Create",
")",
"\n",
"}",
"(",
")",
"\n\n",
"e",
",",
"err",
":=",
"s",
".",
"internalCreate",
"(",
"nodePath",
",",
"dir",
",",
"value",
",",
"unique",
",",
"false",
",",
"expireOpts",
".",
"ExpireTime",
",",
"Create",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"e",
".",
"EtcdIndex",
"=",
"s",
".",
"CurrentIndex",
"\n",
"s",
".",
"WatcherHub",
".",
"notify",
"(",
"e",
")",
"\n\n",
"return",
"e",
",",
"nil",
"\n",
"}"
] |
5,744 | all-5745 | [
"HasLogQuery",
"returns",
"a",
"boolean",
"if",
"a",
"field",
"has",
"been",
"set",
"."
] | [
"func",
"(",
"d",
"*",
"DistributionRequest",
")",
"HasLogQuery",
"(",
")",
"bool",
"{",
"if",
"d",
"!=",
"nil",
"&&",
"d",
".",
"LogQuery",
"!=",
"nil",
"{",
"return",
"true",
"\n",
"}",
"\n\n",
"return",
"<mask>",
"\n",
"}"
] |
5,745 | all-5746 | [
"Mmap",
"uses",
"the",
"mmap",
"system",
"call",
"to",
"memory",
"-",
"map",
"a",
"file",
".",
"If",
"writable",
"is",
"true",
"memory",
"protection",
"of",
"the",
"pages",
"is",
"set",
"so",
"that",
"they",
"may",
"be",
"written",
"to",
"as",
"well",
"."
] | [
"func",
"Mmap",
"(",
"fd",
"*",
"os",
".",
"File",
",",
"writable",
"bool",
",",
"size",
"int64",
")",
"(",
"[",
"]",
"<mask>",
",",
"error",
")",
"{",
"mtype",
":=",
"unix",
".",
"PROT_READ",
"\n",
"if",
"writable",
"{",
"mtype",
"|=",
"unix",
".",
"PROT_WRITE",
"\n",
"}",
"\n",
"return",
"unix",
".",
"Mmap",
"(",
"int",
"(",
"fd",
".",
"Fd",
"(",
")",
")",
",",
"0",
",",
"int",
"(",
"size",
")",
",",
"mtype",
",",
"unix",
".",
"MAP_SHARED",
")",
"\n",
"}"
] |
5,746 | all-5747 | [
"hasVote",
"returns",
"true",
"if",
"the",
"server",
"identified",
"by",
"id",
"is",
"a",
"Voter",
"in",
"the",
"provided",
"Configuration",
"."
] | [
"func",
"hasVote",
"(",
"configuration",
"Configuration",
",",
"id",
"ServerID",
")",
"bool",
"{",
"for",
"_",
",",
"server",
":=",
"range",
"configuration",
".",
"Servers",
"{",
"if",
"server",
".",
"ID",
"==",
"id",
"{",
"return",
"server",
".",
"Suffrage",
"==",
"Voter",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"<mask>",
"\n",
"}"
] |
5,747 | all-5748 | [
"WithUrls",
"the",
"list",
"of",
"URLs",
"for",
"which",
"applicable",
"cookies",
"will",
"be",
"fetched",
"."
] | [
"func",
"(",
"p",
"GetCookiesParams",
")",
"WithUrls",
"(",
"urls",
"[",
"]",
"<mask>",
")",
"*",
"GetCookiesParams",
"{",
"p",
".",
"Urls",
"=",
"urls",
"\n",
"return",
"&",
"p",
"\n",
"}"
] |
5,748 | all-5749 | [
"ErrorFunc",
"outputs",
"Error",
"level",
"log",
"returned",
"from",
"the",
"function"
] | [
"func",
"(",
"g",
"*",
"Glg",
")",
"ErrorFunc",
"(",
"f",
"func",
"(",
")",
"string",
")",
"error",
"{",
"if",
"g",
".",
"isModeEnable",
"(",
"ERR",
")",
"{",
"return",
"g",
".",
"<mask>",
"(",
"ERR",
",",
"\"",
"\"",
",",
"f",
"(",
")",
")",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
] |
5,749 | all-5750 | [
"ReturnWith",
"takes",
"the",
"result",
"name",
"and",
"the",
"error",
"name",
"and",
"generates",
"the",
"return",
"expression",
"."
] | [
"func",
"(",
"m",
"*",
"Method",
")",
"ReturnWith",
"(",
"respName",
"string",
",",
"errName",
"string",
")",
"string",
"{",
"if",
"!",
"m",
".",
"HasReturn",
"(",
")",
"{",
"<mask>",
"errName",
"\n",
"}",
"\n",
"return",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"respName",
",",
"errName",
")",
"\n",
"}"
] |
5,750 | all-5751 | [
"PathFromDatacenter",
"returns",
"the",
"combined",
"result",
"of",
"RootFromDatacenter",
"plus",
"a",
"relative",
"path",
"for",
"a",
"given",
"particle",
"and",
"datacenter",
"object",
"."
] | [
"func",
"(",
"p",
"RootPathParticle",
")",
"PathFromDatacenter",
"(",
"dc",
"*",
"object",
".",
"Datacenter",
",",
"<mask>",
"string",
")",
"string",
"{",
"return",
"p",
".",
"RootFromDatacenter",
"(",
"dc",
")",
"+",
"\"",
"\"",
"+",
"relative",
"\n",
"}"
] |
5,751 | all-5752 | [
"/",
"*",
"Returns",
"true",
"if",
"this",
"operator",
"is",
"contained",
"by",
"the",
"given",
"array",
"of",
"candidate",
"symbols",
".",
"False",
"otherwise",
"."
] | [
"func",
"(",
"this",
"OperatorSymbol",
")",
"IsModifierType",
"(",
"candidate",
"[",
"]",
"OperatorSymbol",
")",
"bool",
"{",
"for",
"_",
",",
"symbolType",
":=",
"range",
"candidate",
"{",
"if",
"this",
"==",
"symbolType",
"{",
"return",
"true",
"\n",
"}",
"\n",
"}",
"\n\n",
"return",
"<mask>",
"\n",
"}"
] |
5,752 | all-5753 | [
"Or",
"adds",
"OR",
"operator",
"to",
"the",
"Condition",
"and",
"returns",
"it",
"for",
"method",
"chain",
"."
] | [
"func",
"(",
"c",
"*",
"Condition",
")",
"Or",
"(",
"cond",
"interface",
"{",
"}",
",",
"args",
"...",
"<mask>",
"{",
"}",
")",
"*",
"Condition",
"{",
"return",
"c",
".",
"appendQueryByCondOrExpr",
"(",
"\"",
"\"",
",",
"100",
",",
"Or",
",",
"cond",
",",
"args",
"...",
")",
"\n",
"}"
] |
5,753 | all-5754 | [
"SetForUid",
"sets",
"the",
"value",
"of",
"the",
"environment",
"variable",
"named",
"by",
"the",
"key",
"that",
"affects",
"a",
"particular",
"user",
".",
"It",
"returns",
"an",
"error",
"if",
"any",
"."
] | [
"func",
"SetForUid",
"(",
"id",
"int",
",",
"key",
",",
"value",
"string",
")",
"error",
"{",
"_settings",
",",
"err",
":=",
"getSettingsForUid",
"(",
"id",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"if",
"err",
"=",
"_Set",
"(",
"_settings",
".",
"user",
",",
"<mask>",
",",
"value",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"if",
"_settings",
".",
"useKDE",
"{",
"return",
"_Set",
"(",
"_settings",
".",
"kde",
",",
"key",
",",
"value",
")",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
] |
5,754 | all-5755 | [
"Anyp",
"tests",
"an",
"Enumerable",
"to",
"see",
"if",
"there",
"are",
"any",
"elements",
"present",
"that",
"meet",
"a",
"criteria",
"."
] | [
"func",
"Anyp",
"(",
"iterator",
"Enumerable",
",",
"p",
"Predicate",
")",
"bool",
"{",
"done",
":=",
"make",
"(",
"chan",
"struct",
"{",
"}",
")",
"\n",
"defer",
"close",
"(",
"done",
")",
"\n\n",
"for",
"element",
":=",
"range",
"iterator",
".",
"Enumerate",
"(",
"done",
")",
"{",
"if",
"p",
"(",
"element",
")",
"{",
"return",
"<mask>",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"false",
"\n",
"}"
] |
5,755 | all-5756 | [
"RemoveServer",
"will",
"remove",
"the",
"given",
"server",
"from",
"the",
"cluster",
".",
"If",
"the",
"current",
"leader",
"is",
"being",
"removed",
"it",
"will",
"cause",
"a",
"new",
"election",
"to",
"occur",
".",
"This",
"must",
"be",
"run",
"on",
"the",
"leader",
"or",
"it",
"will",
"fail",
".",
"For",
"prevIndex",
"and",
"timeout",
"see",
"AddVoter",
"."
] | [
"func",
"(",
"r",
"*",
"Raft",
")",
"RemoveServer",
"(",
"id",
"ServerID",
",",
"prevIndex",
"uint64",
",",
"timeout",
"time",
".",
"Duration",
")",
"IndexFuture",
"{",
"if",
"r",
".",
"protocolVersion",
"<",
"2",
"{",
"return",
"errorFuture",
"{",
"ErrUnsupportedProtocol",
"}",
"\n",
"}",
"\n\n",
"return",
"r",
".",
"requestConfigChange",
"(",
"configurationChangeRequest",
"{",
"<mask>",
":",
"RemoveServer",
",",
"serverID",
":",
"id",
",",
"prevIndex",
":",
"prevIndex",
",",
"}",
",",
"timeout",
")",
"\n",
"}"
] |
5,756 | all-5757 | [
"detectProperties",
"detects",
"various",
"properties",
"of",
"the",
"registry",
".",
"See",
"the",
"dockerClient",
"documentation",
"for",
"members",
"which",
"are",
"affected",
"by",
"this",
"."
] | [
"func",
"(",
"c",
"*",
"dockerClient",
")",
"detectProperties",
"(",
"ctx",
"<mask>",
".",
"Context",
")",
"error",
"{",
"c",
".",
"detectPropertiesOnce",
".",
"Do",
"(",
"func",
"(",
")",
"{",
"c",
".",
"detectPropertiesError",
"=",
"c",
".",
"detectPropertiesHelper",
"(",
"ctx",
")",
"}",
")",
"\n",
"return",
"c",
".",
"detectPropertiesError",
"\n",
"}"
] |
5,757 | all-5758 | [
"Warn",
"shows",
"a",
"temporary",
"message",
"instead",
"of",
"the",
"status"
] | [
"func",
"(",
"p",
"*",
"ProgressRenderer",
")",
"Warn",
"(",
"status",
"string",
",",
"timeout",
"time",
".",
"Duration",
")",
"{",
"// Acquire rendering lock",
"p",
".",
"lock",
".",
"Lock",
"(",
")",
"\n",
"defer",
"p",
".",
"lock",
".",
"Unlock",
"(",
")",
"\n\n",
"// Check if we're already done",
"if",
"p",
".",
"done",
"{",
"return",
"\n",
"}",
"\n\n",
"// Render the new message",
"p",
".",
"wait",
"=",
"time",
".",
"Now",
"(",
")",
".",
"Add",
"(",
"timeout",
")",
"\n",
"msg",
":=",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"status",
")",
"\n\n",
"// Truncate msg to terminal length",
"msg",
"=",
"\"",
"\\r",
"\"",
"+",
"p",
".",
"truncate",
"(",
"msg",
")",
"\n\n",
"// Don't print if empty and never printed",
"if",
"len",
"(",
"<mask>",
")",
"==",
"1",
"&&",
"p",
".",
"maxLength",
"==",
"0",
"{",
"return",
"\n",
"}",
"\n\n",
"if",
"len",
"(",
"msg",
")",
">",
"p",
".",
"maxLength",
"{",
"p",
".",
"maxLength",
"=",
"len",
"(",
"msg",
")",
"\n",
"}",
"else",
"{",
"fmt",
".",
"Printf",
"(",
"\"",
"\\r",
"\"",
",",
"strings",
".",
"Repeat",
"(",
"\"",
"\"",
",",
"p",
".",
"maxLength",
")",
")",
"\n",
"}",
"\n\n",
"fmt",
".",
"Print",
"(",
"msg",
")",
"\n",
"}"
] |
5,758 | all-5759 | [
"title",
":",
"list",
"keys",
"path",
":",
"/",
"users",
"/",
"keys",
"method",
":",
"GET",
"produce",
":",
"application",
"/",
"json",
"responses",
":",
"200",
":",
"OK",
"400",
":",
"Invalid",
"data",
"401",
":",
"Unauthorized"
] | [
"func",
"listKeys",
"(",
"w",
"<mask>",
".",
"ResponseWriter",
",",
"r",
"*",
"http",
".",
"Request",
",",
"t",
"auth",
".",
"Token",
")",
"error",
"{",
"u",
",",
"err",
":=",
"auth",
".",
"ConvertNewUser",
"(",
"t",
".",
"User",
"(",
")",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"keys",
",",
"err",
":=",
"u",
".",
"ListKeys",
"(",
")",
"\n",
"if",
"err",
"==",
"authTypes",
".",
"ErrKeyDisabled",
"{",
"return",
"&",
"errors",
".",
"HTTP",
"{",
"Code",
":",
"http",
".",
"StatusBadRequest",
",",
"Message",
":",
"err",
".",
"Error",
"(",
")",
"}",
"\n",
"}",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"w",
".",
"Header",
"(",
")",
".",
"Add",
"(",
"\"",
"\"",
",",
"\"",
"\"",
")",
"\n",
"return",
"json",
".",
"NewEncoder",
"(",
"w",
")",
".",
"Encode",
"(",
"keys",
")",
"\n",
"}"
] |
5,759 | all-5760 | [
"FromGRPC",
"parses",
"a",
"gRPC",
"error",
"and",
"returns",
"an",
"Error"
] | [
"func",
"FromGRPC",
"(",
"in",
"error",
")",
"Error",
"{",
"out",
":=",
"&",
"impl",
"{",
"message",
":",
"grpc",
".",
"ErrorDesc",
"(",
"in",
")",
",",
"typ",
":",
"GRPCCodeToType",
"(",
"grpc",
".",
"Code",
"(",
"in",
")",
")",
",",
"code",
":",
"NoCode",
",",
"}",
"\n\n",
"matches",
":=",
"grpcMessageFormat",
".",
"FindStringSubmatch",
"(",
"in",
".",
"Error",
"(",
")",
")",
"\n\n",
"if",
"len",
"(",
"matches",
")",
"<",
"4",
"{",
"return",
"out",
"\n",
"}",
"\n\n",
"out",
".",
"message",
"=",
"matches",
"[",
"1",
"]",
"\n",
"out",
".",
"code",
"=",
"parseCode",
"(",
"matches",
"[",
"2",
"]",
")",
"\n",
"_",
"=",
"json",
".",
"Unmarshal",
"(",
"[",
"]",
"byte",
"(",
"matches",
"[",
"3",
"]",
")",
",",
"&",
"out",
".",
"attributes",
")",
"\n\n",
"got",
":=",
"Get",
"(",
"Code",
"(",
"out",
".",
"code",
")",
")",
"\n",
"if",
"got",
"==",
"nil",
"{",
"return",
"<mask>",
"\n",
"}",
"\n\n",
"return",
"got",
".",
"New",
"(",
"out",
".",
"attributes",
")",
"\n",
"}"
] |
5,760 | all-5761 | [
"GetUintOrZero",
"returns",
"uint",
"value",
"for",
"the",
"given",
"key",
".",
"Zero",
"(",
"0",
")",
"is",
"returned",
"on",
"error",
"."
] | [
"func",
"(",
"a",
"*",
"Args",
")",
"GetUintOrZero",
"(",
"key",
"string",
")",
"int",
"{",
"n",
",",
"err",
":=",
"a",
".",
"GetUint",
"(",
"<mask>",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"n",
"=",
"0",
"\n",
"}",
"\n",
"return",
"n",
"\n",
"}"
] |
5,761 | all-5762 | [
"NewOutgoingStickerResend",
"creates",
"a",
"new",
"outgoing",
"sticker",
"message",
"for",
"re",
"-",
"sending",
"."
] | [
"func",
"(",
"api",
"*",
"TelegramBotAPI",
")",
"NewOutgoingStickerResend",
"(",
"recipient",
"Recipient",
",",
"fileID",
"<mask>",
")",
"*",
"OutgoingSticker",
"{",
"return",
"&",
"OutgoingSticker",
"{",
"outgoingMessageBase",
":",
"outgoingMessageBase",
"{",
"outgoingBase",
":",
"outgoingBase",
"{",
"api",
":",
"api",
",",
"Recipient",
":",
"recipient",
",",
"}",
",",
"}",
",",
"outgoingFileBase",
":",
"outgoingFileBase",
"{",
"fileID",
":",
"fileID",
",",
"}",
",",
"}",
"\n",
"}"
] |
5,762 | all-5763 | [
"ImageLastAccessUpdate",
"updates",
"the",
"last_use_date",
"field",
"of",
"the",
"image",
"with",
"the",
"given",
"fingerprint",
"."
] | [
"func",
"(",
"c",
"*",
"Cluster",
")",
"ImageLastAccessUpdate",
"(",
"fingerprint",
"string",
",",
"date",
"time",
".",
"Time",
")",
"error",
"{",
"stmt",
":=",
"`UPDATE images SET last_use_date=? WHERE fingerprint=?`",
"\n",
"err",
":=",
"exec",
"(",
"c",
".",
"<mask>",
",",
"stmt",
",",
"date",
",",
"fingerprint",
")",
"\n",
"return",
"err",
"\n",
"}"
] |
5,763 | all-5764 | [
"GetUnitOk",
"returns",
"a",
"tuple",
"with",
"the",
"Unit",
"field",
"if",
"it",
"s",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"and",
"a",
"boolean",
"to",
"check",
"if",
"the",
"value",
"has",
"been",
"set",
"."
] | [
"func",
"(",
"a",
"*",
"AlertValueDefinition",
")",
"GetUnitOk",
"(",
")",
"(",
"string",
",",
"bool",
")",
"{",
"if",
"a",
"==",
"nil",
"||",
"a",
".",
"Unit",
"==",
"nil",
"{",
"return",
"\"",
"\"",
",",
"false",
"\n",
"}",
"\n",
"return",
"*",
"a",
".",
"Unit",
",",
"<mask>",
"\n",
"}"
] |
5,764 | all-5765 | [
"HTTPDelete",
"performs",
"a",
"HTTP",
"DELETE",
"request"
] | [
"func",
"HTTPDelete",
"(",
"url",
"string",
")",
"(",
"statusCode",
"int",
",",
"statusText",
"string",
",",
"err",
"error",
")",
"{",
"request",
",",
"err",
":=",
"http",
".",
"NewRequest",
"(",
"\"",
"\"",
",",
"url",
",",
"nil",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"0",
",",
"\"",
"\"",
",",
"err",
"\n",
"}",
"\n",
"response",
",",
"err",
":=",
"http",
".",
"DefaultClient",
".",
"Do",
"(",
"request",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"0",
",",
"\"",
"\"",
",",
"err",
"\n",
"}",
"\n",
"return",
"response",
".",
"StatusCode",
",",
"response",
".",
"<mask>",
",",
"nil",
"\n",
"}"
] |
5,765 | all-5766 | [
"VerifySignature",
"returns",
"true",
"if",
"signature",
"is",
"correct",
"."
] | [
"func",
"VerifySignature",
"(",
"pubk",
",",
"msg",
",",
"sig",
"[",
"]",
"byte",
")",
"bool",
"{",
"return",
"ethcrypto",
".",
"VerifySignature",
"(",
"pubk",
",",
"<mask>",
",",
"sig",
")",
"\n",
"}"
] |
5,766 | all-5767 | [
"GetCountry",
"returns",
"country",
"code",
"by",
"ip",
".",
"Parses",
"response",
"in",
"JSON",
"format",
"and",
"returns",
"a",
"value",
"of",
"the",
"field",
"."
] | [
"func",
"GetCountry",
"(",
"timeout",
"uint64",
",",
"url",
",",
"field",
"string",
")",
"(",
"string",
",",
"error",
")",
"{",
"ctx",
",",
"cancel",
":=",
"context",
".",
"WithTimeout",
"(",
"context",
".",
"Background",
"(",
")",
",",
"time",
".",
"Millisecond",
"*",
"time",
".",
"Duration",
"(",
"timeout",
")",
")",
"\n",
"defer",
"cancel",
"(",
")",
"\n\n",
"req",
",",
"err",
":=",
"http",
".",
"NewRequest",
"(",
"http",
".",
"MethodGet",
",",
"url",
",",
"nil",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"\"",
"\"",
",",
"err",
"\n",
"}",
"\n",
"res",
",",
"err",
":=",
"do",
"(",
"ctx",
",",
"req",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"\"",
"\"",
",",
"err",
"\n",
"}",
"\n",
"defer",
"res",
".",
"Body",
".",
"Close",
"(",
")",
"\n\n",
"object",
":=",
"make",
"(",
"map",
"[",
"string",
"]",
"interface",
"{",
"}",
")",
"\n",
"if",
"err",
":=",
"json",
".",
"NewDecoder",
"(",
"res",
".",
"Body",
")",
".",
"Decode",
"(",
"&",
"object",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"\"",
"\"",
",",
"err",
"\n",
"}",
"\n\n",
"f",
",",
"ok",
":=",
"<mask>",
"[",
"field",
"]",
"\n",
"if",
"!",
"ok",
"{",
"return",
"\"",
"\"",
",",
"ErrMissingRequiredField",
"\n",
"}",
"\n\n",
"country",
",",
"ok",
":=",
"f",
".",
"(",
"string",
")",
"\n",
"if",
"!",
"ok",
"{",
"return",
"\"",
"\"",
",",
"ErrBadCountryValueType",
"\n",
"}",
"\n\n",
"return",
"strings",
".",
"TrimSpace",
"(",
"strings",
".",
"ToUpper",
"(",
"country",
")",
")",
",",
"nil",
"\n",
"}"
] |
5,767 | all-5768 | [
"NewCatalogNodeQuery",
"parses",
"the",
"given",
"string",
"into",
"a",
"dependency",
".",
"If",
"the",
"name",
"is",
"empty",
"then",
"the",
"name",
"of",
"the",
"local",
"agent",
"is",
"used",
"."
] | [
"func",
"NewCatalogNodeQuery",
"(",
"s",
"string",
")",
"(",
"*",
"CatalogNodeQuery",
",",
"error",
")",
"{",
"if",
"s",
"!=",
"\"",
"\"",
"&&",
"!",
"CatalogNodeQueryRe",
".",
"MatchString",
"(",
"s",
")",
"{",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"s",
")",
"\n",
"}",
"\n\n",
"m",
":=",
"regexpMatch",
"(",
"CatalogNodeQueryRe",
",",
"s",
")",
"\n",
"return",
"&",
"CatalogNodeQuery",
"{",
"dc",
":",
"m",
"[",
"\"",
"\"",
"]",
",",
"name",
":",
"m",
"[",
"\"",
"\"",
"]",
",",
"stopCh",
":",
"<mask>",
"(",
"chan",
"struct",
"{",
"}",
",",
"1",
")",
",",
"}",
",",
"nil",
"\n",
"}"
] |
5,768 | all-5769 | [
"NewCache",
"creates",
"a",
"new",
"cache",
"."
] | [
"func",
"NewCache",
"(",
"size",
"int",
")",
"(",
"*",
"Cache",
",",
"error",
")",
"{",
"c",
",",
"err",
":=",
"lru",
".",
"NewWithEvict",
"(",
"size",
",",
"func",
"(",
"key",
"interface",
"{",
"}",
",",
"value",
"interface",
"{",
"}",
")",
"{",
"go",
"func",
"(",
")",
"{",
"<mask>",
",",
"ok",
":=",
"value",
".",
"(",
"*",
"dbHashTree",
")",
"\n",
"if",
"!",
"ok",
"{",
"logrus",
".",
"Infof",
"(",
"\"",
"\"",
",",
"reflect",
".",
"TypeOf",
"(",
"value",
")",
")",
"\n",
"return",
"\n",
"}",
"\n",
"if",
"err",
":=",
"tree",
".",
"Destroy",
"(",
")",
";",
"err",
"!=",
"nil",
"{",
"logrus",
".",
"Infof",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"}",
"\n",
"}",
"(",
")",
"\n",
"}",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"return",
"&",
"Cache",
"{",
"c",
"}",
",",
"nil",
"\n",
"}"
] |
5,769 | all-5770 | [
"GetLengthOk",
"returns",
"a",
"tuple",
"with",
"the",
"Length",
"field",
"if",
"it",
"s",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"and",
"a",
"boolean",
"to",
"check",
"if",
"the",
"value",
"has",
"been",
"set",
"."
] | [
"func",
"(",
"s",
"*",
"Series",
")",
"GetLengthOk",
"(",
")",
"(",
"int",
",",
"bool",
")",
"{",
"if",
"s",
"==",
"nil",
"||",
"s",
".",
"Length",
"==",
"nil",
"{",
"return",
"0",
",",
"false",
"\n",
"}",
"\n",
"return",
"*",
"s",
".",
"Length",
",",
"<mask>",
"\n",
"}"
] |
5,770 | all-5771 | [
"title",
":",
"get",
"envs",
"path",
":",
"/",
"apps",
"/",
"{",
"app",
"}",
"/",
"env",
"method",
":",
"GET",
"produce",
":",
"application",
"/",
"x",
"-",
"json",
"-",
"stream",
"responses",
":",
"200",
":",
"OK",
"401",
":",
"Unauthorized",
"404",
":",
"App",
"not",
"found"
] | [
"func",
"getEnv",
"(",
"w",
"http",
".",
"ResponseWriter",
",",
"r",
"*",
"http",
".",
"Request",
",",
"t",
"auth",
".",
"Token",
")",
"error",
"{",
"var",
"variables",
"[",
"]",
"string",
"\n",
"if",
"envs",
",",
"ok",
":=",
"r",
".",
"URL",
".",
"Query",
"(",
")",
"[",
"\"",
"\"",
"]",
";",
"ok",
"{",
"variables",
"=",
"envs",
"\n",
"}",
"\n",
"appName",
":=",
"r",
".",
"URL",
".",
"<mask>",
"(",
")",
".",
"Get",
"(",
"\"",
"\"",
")",
"\n",
"a",
",",
"err",
":=",
"getAppFromContext",
"(",
"appName",
",",
"r",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"if",
"!",
"t",
".",
"IsAppToken",
"(",
")",
"{",
"allowed",
":=",
"permission",
".",
"Check",
"(",
"t",
",",
"permission",
".",
"PermAppReadEnv",
",",
"contextsForApp",
"(",
"&",
"a",
")",
"...",
",",
")",
"\n",
"if",
"!",
"allowed",
"{",
"return",
"permission",
".",
"ErrUnauthorized",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"writeEnvVars",
"(",
"w",
",",
"&",
"a",
",",
"variables",
"...",
")",
"\n",
"}"
] |
5,771 | all-5772 | [
"GetQuery",
"returns",
"the",
"Query",
"field",
"if",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"."
] | [
"func",
"(",
"w",
"*",
"Widget",
")",
"GetQuery",
"(",
")",
"string",
"{",
"if",
"w",
"==",
"nil",
"||",
"w",
".",
"<mask>",
"==",
"nil",
"{",
"return",
"\"",
"\"",
"\n",
"}",
"\n",
"return",
"*",
"w",
".",
"Query",
"\n",
"}"
] |
5,772 | all-5773 | [
"Date",
"returns",
"a",
"copy",
"of",
"MailBuilder",
"with",
"the",
"specified",
"Date",
"header",
"."
] | [
"func",
"(",
"p",
"MailBuilder",
")",
"Date",
"(",
"date",
"time",
".",
"Time",
")",
"MailBuilder",
"{",
"p",
".",
"<mask>",
"=",
"date",
"\n",
"return",
"p",
"\n",
"}"
] |
5,773 | all-5774 | [
"Execute",
"-",
"adds",
"/",
"removes",
"shared",
"domains"
] | [
"func",
"(",
"c",
"*",
"SharedDomainsCommand",
")",
"Execute",
"(",
"[",
"]",
"string",
")",
"error",
"{",
"var",
"cfMgmt",
"*",
"CFMgmt",
"\n",
"<mask>",
"err",
"error",
"\n",
"if",
"cfMgmt",
",",
"err",
"=",
"InitializePeekManagers",
"(",
"c",
".",
"BaseCFConfigCommand",
",",
"c",
".",
"Peek",
")",
";",
"err",
"==",
"nil",
"{",
"err",
"=",
"cfMgmt",
".",
"SharedDomainManager",
".",
"Apply",
"(",
")",
"\n",
"}",
"\n",
"return",
"err",
"\n",
"}"
] |
5,774 | all-5775 | [
"HasTitleSize",
"returns",
"a",
"boolean",
"if",
"a",
"field",
"has",
"been",
"set",
"."
] | [
"func",
"(",
"q",
"*",
"QueryValueDefinition",
")",
"HasTitleSize",
"(",
")",
"bool",
"{",
"if",
"q",
"!=",
"nil",
"&&",
"q",
".",
"TitleSize",
"!=",
"nil",
"{",
"return",
"true",
"\n",
"}",
"\n\n",
"return",
"<mask>",
"\n",
"}"
] |
5,775 | all-5776 | [
"Spawn",
"the",
"rsync",
"process"
] | [
"func",
"rsyncSendSetup",
"(",
"path",
"string",
",",
"rsyncArgs",
"string",
")",
"(",
"*",
"exec",
".",
"Cmd",
",",
"<mask>",
".",
"Conn",
",",
"io",
".",
"ReadCloser",
",",
"error",
")",
"{",
"auds",
":=",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"uuid",
".",
"NewRandom",
"(",
")",
".",
"String",
"(",
")",
")",
"\n",
"if",
"len",
"(",
"auds",
")",
">",
"shared",
".",
"ABSTRACT_UNIX_SOCK_LEN",
"-",
"1",
"{",
"auds",
"=",
"auds",
"[",
":",
"shared",
".",
"ABSTRACT_UNIX_SOCK_LEN",
"-",
"1",
"]",
"\n",
"}",
"\n\n",
"l",
",",
"err",
":=",
"net",
".",
"Listen",
"(",
"\"",
"\"",
",",
"auds",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"nil",
",",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"execPath",
",",
"err",
":=",
"os",
".",
"Readlink",
"(",
"\"",
"\"",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"nil",
",",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"if",
"!",
"shared",
".",
"PathExists",
"(",
"execPath",
")",
"{",
"execPath",
"=",
"os",
".",
"Args",
"[",
"0",
"]",
"\n",
"}",
"\n\n",
"rsyncCmd",
":=",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\\\"",
"\\\"",
"\"",
",",
"execPath",
",",
"auds",
")",
"\n\n",
"args",
":=",
"[",
"]",
"string",
"{",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"}",
"\n\n",
"// Ignore deletions (requires 3.1 or higher)",
"rsyncCheckVersion",
":=",
"func",
"(",
"min",
"string",
")",
"bool",
"{",
"out",
",",
"err",
":=",
"shared",
".",
"RunCommand",
"(",
"\"",
"\"",
",",
"\"",
"\"",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"false",
"\n",
"}",
"\n\n",
"fields",
":=",
"strings",
".",
"Split",
"(",
"out",
",",
"\"",
"\"",
")",
"\n",
"curVer",
",",
"err",
":=",
"version",
".",
"Parse",
"(",
"fields",
"[",
"3",
"]",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"false",
"\n",
"}",
"\n\n",
"minVer",
",",
"err",
":=",
"version",
".",
"Parse",
"(",
"min",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"false",
"\n",
"}",
"\n\n",
"return",
"curVer",
".",
"Compare",
"(",
"minVer",
")",
">=",
"0",
"\n",
"}",
"\n\n",
"if",
"rsyncCheckVersion",
"(",
"\"",
"\"",
")",
"{",
"args",
"=",
"append",
"(",
"args",
",",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"if",
"rsyncArgs",
"!=",
"\"",
"\"",
"{",
"args",
"=",
"append",
"(",
"args",
",",
"strings",
".",
"Split",
"(",
"rsyncArgs",
",",
"\"",
"\"",
")",
"...",
")",
"\n",
"}",
"\n\n",
"args",
"=",
"append",
"(",
"args",
",",
"[",
"]",
"string",
"{",
"path",
",",
"\"",
"\"",
"}",
"...",
")",
"\n",
"args",
"=",
"append",
"(",
"args",
",",
"[",
"]",
"string",
"{",
"\"",
"\"",
",",
"rsyncCmd",
"}",
"...",
")",
"\n\n",
"cmd",
":=",
"exec",
".",
"Command",
"(",
"\"",
"\"",
",",
"args",
"...",
")",
"\n",
"cmd",
".",
"Stdout",
"=",
"os",
".",
"Stderr",
"\n\n",
"stderr",
",",
"err",
":=",
"cmd",
".",
"StderrPipe",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"nil",
",",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"if",
"err",
":=",
"cmd",
".",
"Start",
"(",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"nil",
",",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"conn",
",",
"err",
":=",
"l",
".",
"Accept",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"cmd",
".",
"Process",
".",
"Kill",
"(",
")",
"\n",
"cmd",
".",
"Wait",
"(",
")",
"\n",
"return",
"nil",
",",
"nil",
",",
"nil",
",",
"err",
"\n",
"}",
"\n",
"l",
".",
"Close",
"(",
")",
"\n\n",
"return",
"cmd",
",",
"conn",
",",
"stderr",
",",
"nil",
"\n",
"}"
] |
5,776 | all-5777 | [
"CreateOrgHook",
"creates",
"a",
"new",
"hook",
"for",
"the",
"org",
"https",
":",
"//",
"developer",
".",
"github",
".",
"com",
"/",
"v3",
"/",
"orgs",
"/",
"hooks",
"/",
"#create",
"-",
"a",
"-",
"hook"
] | [
"func",
"(",
"c",
"*",
"<mask>",
")",
"CreateOrgHook",
"(",
"org",
"string",
",",
"req",
"HookRequest",
")",
"(",
"int",
",",
"error",
")",
"{",
"c",
".",
"log",
"(",
"\"",
"\"",
",",
"org",
")",
"\n",
"return",
"c",
".",
"createHook",
"(",
"org",
",",
"nil",
",",
"req",
")",
"\n",
"}"
] |
5,777 | all-5778 | [
"EstimateGas",
"tries",
"to",
"estimate",
"the",
"gas",
"needed",
"to",
"execute",
"a",
"specific",
"transaction",
"based",
"on",
"the",
"current",
"pending",
"state",
"of",
"the",
"backend",
"blockchain",
"."
] | [
"func",
"(",
"b",
"*",
"backendInstance",
")",
"EstimateGas",
"(",
"ctx",
"<mask>",
".",
"Context",
",",
"call",
"ethereum",
".",
"CallMsg",
")",
"(",
"gas",
"uint64",
",",
"err",
"error",
")",
"{",
"ctx2",
",",
"cancel",
":=",
"b",
".",
"addTimeout",
"(",
"ctx",
")",
"\n",
"defer",
"cancel",
"(",
")",
"\n\n",
"gas",
",",
"err",
"=",
"b",
".",
"conn",
".",
"ethClient",
"(",
")",
".",
"EstimateGas",
"(",
"ctx2",
",",
"call",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"0",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"}",
"\n",
"return",
"gas",
",",
"err",
"\n",
"}"
] |
5,778 | all-5779 | [
"Specify",
"the",
"value",
"of",
"a",
"uniform",
"variable",
"for",
"a",
"specified",
"program",
"object"
] | [
"func",
"ProgramUniform4iv",
"(",
"program",
"uint32",
",",
"location",
"int32",
",",
"count",
"int32",
",",
"value",
"*",
"int32",
")",
"{",
"C",
".",
"glowProgramUniform4iv",
"(",
"gpProgramUniform4iv",
",",
"(",
"C",
".",
"GLuint",
")",
"(",
"program",
")",
",",
"(",
"C",
".",
"GLint",
")",
"(",
"<mask>",
")",
",",
"(",
"C",
".",
"GLsizei",
")",
"(",
"count",
")",
",",
"(",
"*",
"C",
".",
"GLint",
")",
"(",
"unsafe",
".",
"Pointer",
"(",
"value",
")",
")",
")",
"\n",
"}"
] |
5,779 | all-5780 | [
"Run",
"starts",
"the",
"server",
"group",
"returning",
"the",
"first",
"encountered",
"error",
"upon",
"shutdown",
"."
] | [
"func",
"(",
"s",
"*",
"Sentinel",
")",
"Run",
"(",
"ctxt",
"context",
".",
"Context",
")",
"error",
"{",
"s",
".",
"Lock",
"(",
")",
"\n",
"if",
"s",
".",
"started",
"{",
"defer",
"s",
".",
"Unlock",
"(",
")",
"\n",
"return",
"ErrAlreadyStarted",
"\n",
"}",
"\n",
"s",
".",
"started",
"=",
"true",
"\n",
"s",
".",
"Unlock",
"(",
")",
"\n\n",
"eg",
",",
"ctxt",
":=",
"errgroup",
".",
"WithContext",
"(",
"ctxt",
")",
"\n\n",
"// add servers",
"for",
"_",
",",
"f",
":=",
"range",
"s",
".",
"serverFuncs",
"{",
"eg",
".",
"Go",
"(",
"func",
"(",
"f",
"func",
"(",
"context",
".",
"<mask>",
")",
"error",
")",
"func",
"(",
")",
"error",
"{",
"return",
"func",
"(",
")",
"error",
"{",
"return",
"f",
"(",
"ctxt",
")",
"\n",
"}",
"\n",
"}",
"(",
"f",
")",
")",
"\n",
"}",
"\n\n",
"// add shutdown",
"eg",
".",
"Go",
"(",
"func",
"(",
")",
"func",
"(",
")",
"error",
"{",
"s",
".",
"sig",
"=",
"make",
"(",
"chan",
"os",
".",
"Signal",
",",
"1",
")",
"\n",
"signal",
".",
"Notify",
"(",
"s",
".",
"sig",
",",
"s",
".",
"shutdownSigs",
"...",
")",
"\n",
"return",
"func",
"(",
")",
"error",
"{",
"s",
".",
"logf",
"(",
"\"",
"\"",
",",
"<-",
"s",
".",
"sig",
")",
"\n",
"return",
"s",
".",
"Shutdown",
"(",
")",
"\n",
"}",
"\n",
"}",
"(",
")",
")",
"\n\n",
"if",
"err",
":=",
"eg",
".",
"Wait",
"(",
")",
";",
"err",
"!=",
"nil",
"&&",
"!",
"s",
".",
"ShutdownIgnore",
"(",
"err",
")",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"return",
"nil",
"\n",
"}"
] |
5,780 | all-5781 | [
"log",
"creates",
"log",
"record",
"and",
"submits",
"it",
"for",
"processing",
"."
] | [
"func",
"(",
"logger",
"*",
"Logger",
")",
"log",
"(",
"level",
"Level",
",",
"format",
"string",
",",
"a",
"...",
"interface",
"{",
"}",
")",
"{",
"var",
"message",
"string",
"\n",
"if",
"format",
"==",
"\"",
"\"",
"{",
"message",
"=",
"fmt",
".",
"Sprint",
"(",
"a",
"...",
")",
"\n",
"}",
"else",
"{",
"message",
"=",
"fmt",
".",
"Sprintf",
"(",
"<mask>",
",",
"a",
"...",
")",
"\n",
"}",
"\n\n",
"atomic",
".",
"AddUint64",
"(",
"&",
"logger",
".",
"countIn",
",",
"1",
")",
"\n",
"logger",
".",
"recordChannel",
"<-",
"&",
"Record",
"{",
"Level",
":",
"level",
",",
"Message",
":",
"message",
",",
"Time",
":",
"time",
".",
"Now",
"(",
")",
",",
"}",
"\n",
"}"
] |
5,781 | all-5782 | [
"resourceVSphereResourcePoolReadTags",
"reads",
"the",
"tags",
"for",
"vsphere_resource_pool",
"."
] | [
"func",
"resourceVSphereResourcePoolReadTags",
"(",
"d",
"*",
"schema",
".",
"ResourceData",
",",
"meta",
"interface",
"{",
"}",
",",
"rp",
"*",
"object",
".",
"ResourcePool",
")",
"error",
"{",
"if",
"tagsClient",
",",
"_",
":=",
"meta",
".",
"(",
"*",
"VSphereClient",
")",
".",
"TagsClient",
"(",
")",
";",
"tagsClient",
"!=",
"nil",
"{",
"<mask>",
".",
"Printf",
"(",
"\"",
"\"",
",",
"resourceVSphereResourcePoolIDString",
"(",
"d",
")",
")",
"\n",
"if",
"err",
":=",
"readTagsForResource",
"(",
"tagsClient",
",",
"rp",
",",
"d",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"}",
"else",
"{",
"log",
".",
"Printf",
"(",
"\"",
"\"",
",",
"resourceVSphereResourcePoolIDString",
"(",
"d",
")",
")",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
] |
5,782 | all-5783 | [
"AcquireResponseRecorder",
"returns",
"a",
"ResponseRecorder"
] | [
"func",
"AcquireResponseRecorder",
"(",
"underline",
"<mask>",
".",
"ResponseWriter",
")",
"*",
"ResponseRecorder",
"{",
"v",
":=",
"rpool",
".",
"Get",
"(",
")",
"\n",
"var",
"res",
"*",
"ResponseRecorder",
"\n",
"if",
"v",
"!=",
"nil",
"{",
"res",
"=",
"v",
".",
"(",
"*",
"ResponseRecorder",
")",
"\n",
"}",
"else",
"{",
"res",
"=",
"&",
"ResponseRecorder",
"{",
"}",
"\n",
"}",
"\n",
"res",
".",
"underline",
"=",
"underline",
"\n",
"return",
"res",
"\n",
"}"
] |
5,783 | all-5784 | [
"GetThresholds",
"returns",
"the",
"Thresholds",
"field",
"if",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"."
] | [
"func",
"(",
"o",
"*",
"<mask>",
")",
"GetThresholds",
"(",
")",
"ThresholdCount",
"{",
"if",
"o",
"==",
"nil",
"||",
"o",
".",
"Thresholds",
"==",
"nil",
"{",
"return",
"ThresholdCount",
"{",
"}",
"\n",
"}",
"\n",
"return",
"*",
"o",
".",
"Thresholds",
"\n",
"}"
] |
5,784 | all-5785 | [
"AddFlags",
"binds",
"flags",
"to",
"options"
] | [
"func",
"(",
"o",
"*",
"Options",
")",
"AddFlags",
"(",
"flags",
"*",
"flag",
".",
"FlagSet",
")",
"{",
"flags",
".",
"IntVar",
"(",
"&",
"o",
".",
"NumWorkers",
",",
"\"",
"\"",
",",
"25",
",",
"\"",
"\"",
")",
"\n",
"flags",
".",
"StringVar",
"(",
"&",
"o",
".",
"ProwJobNamespace",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
")",
"\n",
"o",
".",
"Options",
".",
"AddFlags",
"(",
"<mask>",
")",
"\n",
"}"
] |
5,785 | all-5786 | [
"Specify",
"the",
"value",
"of",
"a",
"uniform",
"variable",
"for",
"a",
"specified",
"program",
"object"
] | [
"func",
"ProgramUniformMatrix3x4fv",
"(",
"<mask>",
"uint32",
",",
"location",
"int32",
",",
"count",
"int32",
",",
"transpose",
"bool",
",",
"value",
"*",
"float32",
")",
"{",
"C",
".",
"glowProgramUniformMatrix3x4fv",
"(",
"gpProgramUniformMatrix3x4fv",
",",
"(",
"C",
".",
"GLuint",
")",
"(",
"program",
")",
",",
"(",
"C",
".",
"GLint",
")",
"(",
"location",
")",
",",
"(",
"C",
".",
"GLsizei",
")",
"(",
"count",
")",
",",
"(",
"C",
".",
"GLboolean",
")",
"(",
"boolToInt",
"(",
"transpose",
")",
")",
",",
"(",
"*",
"C",
".",
"GLfloat",
")",
"(",
"unsafe",
".",
"Pointer",
"(",
"value",
")",
")",
")",
"\n",
"}"
] |
5,786 | all-5787 | [
"render",
"indexed",
"primitives",
"from",
"array",
"data",
"taking",
"parameters",
"from",
"memory"
] | [
"func",
"DrawElementsIndirect",
"(",
"mode",
"uint32",
",",
"xtype",
"uint32",
",",
"indirect",
"unsafe",
".",
"Pointer",
")",
"{",
"C",
".",
"glowDrawElementsIndirect",
"(",
"gpDrawElementsIndirect",
",",
"(",
"C",
".",
"GLenum",
")",
"(",
"<mask>",
")",
",",
"(",
"C",
".",
"GLenum",
")",
"(",
"xtype",
")",
",",
"indirect",
")",
"\n",
"}"
] |
5,787 | all-5788 | [
"cmps",
"returns",
"a",
"cmp",
"list",
"testing",
"no",
"writes",
"have",
"happened",
"past",
"rev"
] | [
"func",
"(",
"ws",
"writeSet",
")",
"cmps",
"(",
"rev",
"int64",
")",
"[",
"]",
"v3",
".",
"Cmp",
"{",
"cmps",
":=",
"make",
"(",
"[",
"]",
"v3",
".",
"Cmp",
",",
"0",
",",
"len",
"(",
"ws",
")",
")",
"\n",
"for",
"key",
":=",
"range",
"ws",
"{",
"cmps",
"=",
"append",
"(",
"cmps",
",",
"v3",
".",
"Compare",
"(",
"v3",
".",
"ModRevision",
"(",
"key",
")",
",",
"\"",
"\"",
",",
"<mask>",
")",
")",
"\n",
"}",
"\n",
"return",
"cmps",
"\n",
"}"
] |
5,788 | all-5789 | [
"TouchPressDuration",
"returns",
"how",
"long",
"the",
"touch",
"remains",
"in",
"frames",
".",
"TouchPressDuration",
"is",
"concurrent",
"safe",
"."
] | [
"func",
"TouchPressDuration",
"(",
"id",
"int",
")",
"int",
"{",
"theInputState",
".",
"m",
".",
"RLock",
"(",
")",
"\n",
"s",
":=",
"theInputState",
".",
"touchDurations",
"[",
"<mask>",
"]",
"\n",
"theInputState",
".",
"m",
".",
"RUnlock",
"(",
")",
"\n",
"return",
"s",
"\n",
"}"
] |
5,789 | all-5790 | [
"NotifyDevice",
"sends",
"notification",
"data",
"to",
"devices"
] | [
"func",
"(",
"p",
"*",
"Pushy",
")",
"NotifyDevice",
"(",
"request",
"SendNotificationRequest",
")",
"(",
"*",
"NotificationResponse",
",",
"*",
"Error",
",",
"error",
")",
"{",
"url",
":=",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"p",
".",
"APIEndpoint",
",",
"p",
".",
"APIToken",
")",
"\n",
"var",
"success",
"*",
"NotificationResponse",
"\n",
"var",
"pushyErr",
"*",
"Error",
"\n",
"err",
":=",
"<mask>",
"(",
"p",
".",
"httpClient",
",",
"url",
",",
"request",
",",
"&",
"success",
",",
"&",
"pushyErr",
")",
"\n",
"return",
"success",
",",
"pushyErr",
",",
"err",
"\n",
"}"
] |
5,790 | all-5791 | [
"Unwrap",
"same",
"thing",
"as",
"Contact",
"just",
"different",
"interface",
"combines",
"several",
"array",
"into",
"single",
"one"
] | [
"func",
"Unwrap",
"(",
"arrays",
"[",
"]",
"[",
"]",
"byte",
")",
"[",
"]",
"byte",
"{",
"var",
"result",
"[",
"]",
"byte",
"=",
"arrays",
"[",
"0",
"]",
"\n\n",
"for",
"_",
",",
"arr",
":=",
"range",
"arrays",
"[",
"1",
":",
"]",
"{",
"result",
"=",
"append",
"(",
"result",
",",
"arr",
"...",
")",
"\n",
"}",
"\n\n",
"return",
"<mask>",
"\n",
"}"
] |
5,791 | all-5792 | [
"WithTransitionType",
"intended",
"transition",
"type",
"."
] | [
"func",
"(",
"p",
"NavigateParams",
")",
"WithTransitionType",
"(",
"transitionType",
"TransitionType",
")",
"*",
"NavigateParams",
"{",
"p",
".",
"TransitionType",
"=",
"transitionType",
"\n",
"<mask>",
"&",
"p",
"\n",
"}"
] |
5,792 | all-5793 | [
"GetStateType",
"is",
"a",
"wrapper",
"around",
"g_action_get_state_type"
] | [
"func",
"(",
"v",
"*",
"<mask>",
")",
"GetStateType",
"(",
")",
"*",
"VariantType",
"{",
"c",
":=",
"C",
".",
"g_action_get_state_type",
"(",
"v",
".",
"native",
"(",
")",
")",
"\n",
"if",
"c",
"==",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n",
"return",
"newVariantType",
"(",
"(",
"*",
"C",
".",
"GVariantType",
")",
"(",
"c",
")",
")",
"\n",
"}"
] |
5,793 | all-5794 | [
"MustHello",
"retrieves",
"the",
"Hello",
"value",
"from",
"the",
"union",
"panicing",
"if",
"the",
"value",
"is",
"not",
"set",
"."
] | [
"func",
"(",
"u",
"StellarMessage",
")",
"MustHello",
"(",
")",
"Hello",
"{",
"val",
",",
"<mask>",
":=",
"u",
".",
"GetHello",
"(",
")",
"\n\n",
"if",
"!",
"ok",
"{",
"panic",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"return",
"val",
"\n",
"}"
] |
5,794 | all-5795 | [
"Delete",
"deletes",
"a",
"key",
"/",
"value",
"pair",
"."
] | [
"func",
"(",
"c",
"*",
"Cache",
")",
"Delete",
"(",
"key",
"string",
")",
"error",
"{",
"c",
".",
"mu",
".",
"Lock",
"(",
")",
"\n",
"defer",
"c",
".",
"mu",
".",
"Unlock",
"(",
")",
"\n",
"if",
"!",
"c",
".",
"<mask>",
"[",
"key",
"]",
"{",
"return",
"nil",
"\n",
"}",
"\n",
"delete",
"(",
"c",
".",
"keys",
",",
"key",
")",
"\n",
"return",
"os",
".",
"Remove",
"(",
"filepath",
".",
"Join",
"(",
"c",
".",
"root",
",",
"key",
")",
")",
"\n",
"}"
] |
5,795 | all-5796 | [
"UnlockServer",
"unlocks",
"a",
"previously",
"locked",
"existing",
"server",
"allowing",
"destruction",
"again",
".",
"Deprecated",
"use",
"UnLockResource",
"instead",
"."
] | [
"func",
"(",
"c",
"*",
"Client",
")",
"UnlockServer",
"(",
"identifier",
"string",
")",
"error",
"{",
"return",
"c",
".",
"UnLockResource",
"(",
"<mask>",
"{",
"Id",
":",
"identifier",
"}",
")",
"\n",
"}"
] |
5,796 | all-5797 | [
"AgentAfterUncooperativeCloseRequest",
"sets",
"channel",
"s",
"status",
"to",
"challenge",
"period",
"."
] | [
"func",
"(",
"w",
"*",
"Worker",
")",
"AgentAfterUncooperativeCloseRequest",
"(",
"job",
"*",
"data",
".",
"Job",
")",
"error",
"{",
"logger",
":=",
"w",
".",
"logger",
".",
"Add",
"(",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"job",
")",
"\n",
"channel",
",",
"err",
":=",
"w",
".",
"relatedChannel",
"(",
"logger",
",",
"job",
",",
"data",
".",
"JobAgentAfterUncooperativeCloseRequest",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"logger",
"=",
"logger",
".",
"Add",
"(",
"\"",
"\"",
",",
"channel",
")",
"\n\n",
"if",
"channel",
".",
"ServiceStatus",
"!=",
"data",
".",
"ServiceTerminated",
"{",
"_",
",",
"err",
"=",
"w",
".",
"processor",
".",
"TerminateChannel",
"(",
"channel",
".",
"ID",
",",
"data",
".",
"JobTask",
",",
"true",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"logger",
".",
"Error",
"(",
"err",
".",
"Error",
"(",
")",
")",
"\n",
"return",
"ErrTerminateChannel",
"\n",
"}",
"\n",
"}",
"\n\n",
"channel",
".",
"ChannelStatus",
"=",
"data",
".",
"ChannelInChallenge",
"\n",
"if",
"err",
"=",
"w",
".",
"db",
".",
"Update",
"(",
"<mask>",
")",
";",
"err",
"!=",
"nil",
"{",
"logger",
".",
"Error",
"(",
"err",
".",
"Error",
"(",
")",
")",
"\n",
"return",
"ErrInternal",
"\n",
"}",
"\n\n",
"return",
"nil",
"\n",
"}"
] |
5,797 | all-5798 | [
"Status",
"returns",
"the",
"service",
"instance",
"status",
"."
] | [
"func",
"(",
"si",
"*",
"ServiceInstance",
")",
"Status",
"(",
"requestID",
"string",
")",
"(",
"string",
",",
"error",
")",
"{",
"s",
",",
"err",
":=",
"Get",
"(",
"si",
".",
"ServiceName",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"\"",
"\"",
",",
"err",
"\n",
"}",
"\n",
"endpoint",
",",
"err",
":=",
"s",
".",
"getClient",
"(",
"\"",
"\"",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"\"",
"\"",
",",
"err",
"\n",
"}",
"\n",
"return",
"endpoint",
".",
"<mask>",
"(",
"si",
",",
"requestID",
")",
"\n",
"}"
] |
5,798 | all-5799 | [
"Comment",
"inserts",
"the",
"comment",
"character",
"in",
"lines",
"that",
"mach",
"any",
"regular",
"expression",
"in",
"reLine",
"."
] | [
"func",
"(",
"e",
"*",
"edit",
")",
"Comment",
"(",
"reLine",
"[",
"]",
"string",
")",
"error",
"{",
"allReSearch",
":=",
"make",
"(",
"[",
"]",
"*",
"regexp",
".",
"Regexp",
",",
"len",
"(",
"reLine",
")",
")",
"\n\n",
"for",
"i",
",",
"v",
":=",
"range",
"reLine",
"{",
"if",
"re",
",",
"err",
":=",
"regexp",
".",
"Compile",
"(",
"v",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"else",
"{",
"allReSearch",
"[",
"i",
"]",
"=",
"re",
"\n",
"}",
"\n",
"}",
"\n\n",
"if",
"_",
",",
"err",
":=",
"e",
".",
"file",
".",
"Seek",
"(",
"0",
",",
"os",
".",
"SEEK_SET",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"char",
":=",
"[",
"]",
"byte",
"(",
"e",
".",
"CommentChar",
"+",
"\"",
"\"",
")",
"\n",
"isNew",
":=",
"false",
"\n",
"buf",
":=",
"new",
"(",
"bytes",
".",
"Buffer",
")",
"\n\n",
"// Check every line.",
"for",
"{",
"line",
",",
"err",
":=",
"e",
".",
"buf",
".",
"ReadBytes",
"(",
"'\\n'",
")",
"\n",
"if",
"err",
"==",
"io",
".",
"EOF",
"{",
"break",
"\n",
"}",
"\n\n",
"for",
"_",
",",
"v",
":=",
"range",
"allReSearch",
"{",
"if",
"v",
".",
"Match",
"(",
"<mask>",
")",
"{",
"line",
"=",
"append",
"(",
"char",
",",
"line",
"...",
")",
"\n\n",
"if",
"!",
"isNew",
"{",
"isNew",
"=",
"true",
"\n",
"}",
"\n",
"break",
"\n",
"}",
"\n",
"}",
"\n\n",
"if",
"_",
",",
"err",
"=",
"buf",
".",
"Write",
"(",
"line",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"}",
"\n\n",
"if",
"isNew",
"{",
"return",
"e",
".",
"rewrite",
"(",
"buf",
".",
"Bytes",
"(",
")",
")",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
] |
5,799 | all-5800 | [
"Specify",
"the",
"value",
"of",
"a",
"uniform",
"variable",
"for",
"a",
"specified",
"program",
"object"
] | [
"func",
"ProgramUniform3iv",
"(",
"program",
"uint32",
",",
"<mask>",
"int32",
",",
"count",
"int32",
",",
"value",
"*",
"int32",
")",
"{",
"C",
".",
"glowProgramUniform3iv",
"(",
"gpProgramUniform3iv",
",",
"(",
"C",
".",
"GLuint",
")",
"(",
"program",
")",
",",
"(",
"C",
".",
"GLint",
")",
"(",
"location",
")",
",",
"(",
"C",
".",
"GLsizei",
")",
"(",
"count",
")",
",",
"(",
"*",
"C",
".",
"GLint",
")",
"(",
"unsafe",
".",
"Pointer",
"(",
"value",
")",
")",
")",
"\n",
"}"
] |
Subsets and Splits
No saved queries yet
Save your SQL queries to embed, download, and access them later. Queries will appear here once saved.