id
int32 0
25.3k
| idx
stringlengths 5
9
| nl_tokens
sequencelengths 1
418
| pl_tokens
sequencelengths 22
4.98k
|
---|---|---|---|
11,400 | all-11401 | [
"StartListening",
"mark",
"the",
"event",
"stream",
"as",
"open",
"and",
"start",
"listening"
] | [
"func",
"(",
"eventStream",
"*",
"EventStream",
")",
"StartListening",
"(",
")",
"{",
"eventStream",
".",
"statusLock",
".",
"Lock",
"(",
")",
"\n",
"defer",
"eventStream",
".",
"statusLock",
".",
"Unlock",
"(",
")",
"\n",
"eventStream",
".",
"open",
"=",
"<mask>",
"\n\n",
"go",
"eventStream",
".",
"listen",
"(",
")",
"\n",
"}"
] |
11,401 | all-11402 | [
"MarshalEasyJSON",
"writes",
"the",
"ObjectId",
"to",
"a",
"easyjson",
".",
"Writer"
] | [
"func",
"(",
"<mask>",
"*",
"ObjectId",
")",
"MarshalEasyJSON",
"(",
"w",
"*",
"jwriter",
".",
"Writer",
")",
"{",
"w",
".",
"String",
"(",
"bson",
".",
"ObjectId",
"(",
"*",
"id",
")",
".",
"Hex",
"(",
")",
")",
"\n",
"}"
] |
11,402 | all-11403 | [
"List",
"returns",
"available",
"snapshots",
"in",
"the",
"store",
"."
] | [
"func",
"(",
"f",
"*",
"FileSnapshotStore",
")",
"List",
"(",
")",
"(",
"[",
"]",
"*",
"SnapshotMeta",
",",
"error",
")",
"{",
"// Get the eligible snapshots",
"snapshots",
",",
"err",
":=",
"f",
".",
"getSnapshots",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"f",
".",
"logger",
".",
"Printf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"var",
"snapMeta",
"[",
"]",
"*",
"SnapshotMeta",
"\n",
"for",
"_",
",",
"meta",
":=",
"range",
"snapshots",
"{",
"snapMeta",
"=",
"<mask>",
"(",
"snapMeta",
",",
"&",
"meta",
".",
"SnapshotMeta",
")",
"\n",
"if",
"len",
"(",
"snapMeta",
")",
"==",
"f",
".",
"retain",
"{",
"break",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"snapMeta",
",",
"nil",
"\n",
"}"
] |
11,403 | all-11404 | [
"Error",
"satisfies",
"the",
"error",
"interface",
"."
] | [
"func",
"(",
"e",
"*",
"ExceptionDetails",
")",
"<mask>",
"(",
")",
"string",
"{",
"// TODO: watch script parsed events and match the ExceptionDetails.ScriptID",
"// to the name/location of the actual code and display here",
"return",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"e",
".",
"Text",
",",
"e",
".",
"LineNumber",
",",
"e",
".",
"ColumnNumber",
")",
"\n",
"}"
] |
11,404 | all-11405 | [
"GetId",
"retrieves",
"the",
"Id",
"value",
"from",
"the",
"union",
"returning",
"ok",
"if",
"the",
"union",
"s",
"switch",
"indicated",
"the",
"value",
"is",
"valid",
"."
] | [
"func",
"(",
"u",
"Memo",
")",
"GetId",
"(",
")",
"(",
"result",
"Uint64",
",",
"ok",
"bool",
")",
"{",
"armName",
",",
"_",
":=",
"u",
".",
"ArmForSwitch",
"(",
"int32",
"(",
"u",
".",
"<mask>",
")",
")",
"\n\n",
"if",
"armName",
"==",
"\"",
"\"",
"{",
"result",
"=",
"*",
"u",
".",
"Id",
"\n",
"ok",
"=",
"true",
"\n",
"}",
"\n\n",
"return",
"\n",
"}"
] |
11,405 | all-11406 | [
"HTTPToHTTPSRedirectHandler",
"redirects",
"with",
"status",
"code",
"301",
"to",
"a",
"https",
":",
"//",
"version",
"of",
"HTTP",
"request",
"."
] | [
"func",
"HTTPToHTTPSRedirectHandler",
"(",
"w",
"http",
".",
"ResponseWriter",
",",
"r",
"*",
"http",
".",
"Request",
")",
"{",
"url",
":=",
"r",
".",
"<mask>",
"\n",
"url",
".",
"Scheme",
"=",
"\"",
"\"",
"\n",
"if",
"url",
".",
"Host",
"==",
"\"",
"\"",
"{",
"url",
".",
"Host",
"=",
"r",
".",
"Host",
"\n",
"}",
"\n",
"w",
".",
"Header",
"(",
")",
".",
"Set",
"(",
"\"",
"\"",
",",
"url",
".",
"String",
"(",
")",
")",
"\n",
"w",
".",
"WriteHeader",
"(",
"http",
".",
"StatusMovedPermanently",
")",
"\n",
"}"
] |
11,406 | all-11407 | [
"MarshalEasyJSON",
"satisfies",
"easyjson",
".",
"Marshaler",
"."
] | [
"func",
"(",
"t",
"VersionRunningStatus",
")",
"MarshalEasyJSON",
"(",
"out",
"*",
"jwriter",
".",
"Writer",
")",
"{",
"out",
".",
"<mask>",
"(",
"string",
"(",
"t",
")",
")",
"\n",
"}"
] |
11,407 | all-11408 | [
"shouldUpdate",
"returns",
"true",
"if",
"Walk",
"should",
"pass",
"true",
"to",
"the",
"callback",
"s",
"update",
"parameter",
"in",
"the",
"directory",
"rel",
".",
"This",
"indicates",
"the",
"build",
"file",
"should",
"be",
"updated",
"."
] | [
"func",
"shouldUpdate",
"(",
"rel",
"string",
",",
"mode",
"Mode",
",",
"updateParent",
"bool",
",",
"updateRels",
"<mask>",
"[",
"string",
"]",
"bool",
")",
"bool",
"{",
"return",
"mode",
"==",
"VisitAllUpdateSubdirsMode",
"&&",
"updateParent",
"||",
"updateRels",
"[",
"rel",
"]",
"\n",
"}"
] |
11,408 | all-11409 | [
"Exists",
"is",
"used",
"to",
"verify",
"the",
"existence",
"of",
"a",
"cgroup"
] | [
"func",
"(",
"c",
"*",
"control",
")",
"Exists",
"(",
"cgroupPath",
"string",
")",
"bool",
"{",
"seelog",
".",
"Debugf",
"(",
"\"",
"\"",
",",
"cgroupPath",
")",
"\n\n",
"<mask>",
",",
"err",
":=",
"c",
".",
"Load",
"(",
"cgroups",
".",
"V1",
",",
"cgroups",
".",
"StaticPath",
"(",
"cgroupPath",
")",
")",
"\n",
"if",
"err",
"!=",
"nil",
"||",
"controller",
"==",
"nil",
"{",
"return",
"false",
"\n",
"}",
"\n\n",
"return",
"true",
"\n",
"}"
] |
11,409 | all-11410 | [
"RestartVirtualMachine",
"restarts",
"the",
"virtual",
"machine",
"and",
"waits",
"until",
"it",
"reaches",
"the",
"goal",
"state",
"(",
"stopped",
")",
"or",
"times",
"out",
"."
] | [
"func",
"(",
"a",
"AzureClient",
")",
"RestartVirtualMachine",
"(",
"resourceGroup",
",",
"name",
"string",
")",
"error",
"{",
"log",
".",
"Info",
"(",
"\"",
"\"",
",",
"logutil",
".",
"Fields",
"{",
"\"",
"\"",
":",
"<mask>",
"}",
")",
"\n",
"if",
"_",
",",
"err",
":=",
"a",
".",
"virtualMachinesClient",
"(",
")",
".",
"Restart",
"(",
"resourceGroup",
",",
"name",
",",
"nil",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"return",
"a",
".",
"waitVMPowerState",
"(",
"resourceGroup",
",",
"name",
",",
"Running",
",",
"waitStartTimeout",
")",
"\n",
"}"
] |
11,410 | all-11411 | [
"IsSensitive",
"is",
"a",
"wrapper",
"around",
"gtk_widget_is_sensitive",
"()",
"."
] | [
"func",
"(",
"v",
"*",
"Widget",
")",
"IsSensitive",
"(",
")",
"bool",
"{",
"c",
":=",
"C",
".",
"gtk_widget_is_sensitive",
"(",
"v",
".",
"native",
"(",
")",
")",
"\n",
"<mask>",
"gobool",
"(",
"c",
")",
"\n",
"}"
] |
11,411 | all-11412 | [
"Close",
"flushes",
"the",
"Client",
"s",
"buffer",
"and",
"releases",
"the",
"associated",
"ressources",
".",
"The",
"Client",
"and",
"all",
"the",
"cloned",
"Clients",
"must",
"not",
"be",
"used",
"afterward",
"."
] | [
"func",
"(",
"c",
"*",
"Client",
")",
"Close",
"(",
")",
"{",
"if",
"c",
".",
"muted",
"{",
"return",
"\n",
"}",
"\n",
"c",
".",
"conn",
".",
"mu",
".",
"Lock",
"(",
")",
"\n",
"c",
".",
"<mask>",
".",
"flush",
"(",
"0",
")",
"\n",
"c",
".",
"conn",
".",
"handleError",
"(",
"c",
".",
"conn",
".",
"w",
".",
"Close",
"(",
")",
")",
"\n",
"c",
".",
"conn",
".",
"closed",
"=",
"true",
"\n",
"c",
".",
"conn",
".",
"mu",
".",
"Unlock",
"(",
")",
"\n",
"}"
] |
11,412 | all-11413 | [
"processLog",
"is",
"invoked",
"to",
"process",
"the",
"application",
"of",
"a",
"single",
"committed",
"log",
"entry",
"."
] | [
"func",
"(",
"r",
"*",
"Raft",
")",
"processLog",
"(",
"l",
"*",
"Log",
",",
"future",
"*",
"logFuture",
")",
"{",
"switch",
"l",
".",
"Type",
"{",
"case",
"LogBarrier",
":",
"// Barrier is handled by the FSM",
"fallthrough",
"\n\n",
"case",
"LogCommand",
":",
"// Forward to the fsm handler",
"select",
"{",
"case",
"r",
".",
"fsmMutateCh",
"<-",
"&",
"commitTuple",
"{",
"l",
",",
"future",
"}",
":",
"case",
"<-",
"r",
".",
"shutdownCh",
":",
"if",
"future",
"!=",
"nil",
"{",
"future",
".",
"respond",
"(",
"ErrRaftShutdown",
")",
"\n",
"}",
"\n",
"}",
"\n\n",
"// Return so that the future is only responded to",
"// by the FSM handler when the application is done",
"return",
"\n\n",
"case",
"LogConfiguration",
":",
"<mask>",
"LogAddPeerDeprecated",
":",
"case",
"LogRemovePeerDeprecated",
":",
"case",
"LogNoop",
":",
"// Ignore the no-op",
"default",
":",
"panic",
"(",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"l",
")",
")",
"\n",
"}",
"\n\n",
"// Invoke the future if given",
"if",
"future",
"!=",
"nil",
"{",
"future",
".",
"respond",
"(",
"nil",
")",
"\n",
"}",
"\n",
"}"
] |
11,413 | all-11414 | [
"sendAcks",
"sends",
"ack",
"requests",
"to",
"ACS"
] | [
"func",
"(",
"payloadHandler",
"*",
"payloadRequestHandler",
")",
"sendAcks",
"(",
")",
"{",
"for",
"{",
"select",
"{",
"case",
"mid",
":=",
"<-",
"payloadHandler",
".",
"ackRequest",
":",
"payloadHandler",
".",
"ackMessageId",
"(",
"<mask>",
")",
"\n",
"case",
"<-",
"payloadHandler",
".",
"ctx",
".",
"Done",
"(",
")",
":",
"return",
"\n",
"}",
"\n",
"}",
"\n",
"}"
] |
11,414 | all-11415 | [
"Provided",
"in",
"order",
"to",
"implement",
"the",
"http",
".",
"CloseNotifier",
"interface",
"."
] | [
"func",
"(",
"w",
"*",
"responseWriter",
")",
"CloseNotify",
"(",
")",
"<-",
"chan",
"bool",
"{",
"notifier",
":=",
"w",
".",
"ResponseWriter",
".",
"(",
"<mask>",
".",
"CloseNotifier",
")",
"\n",
"return",
"notifier",
".",
"CloseNotify",
"(",
")",
"\n",
"}"
] |
11,415 | all-11416 | [
"MarshalJSON",
"supports",
"json",
".",
"Marshaler",
"interface"
] | [
"func",
"(",
"v",
"EventRequestServedFromCache",
")",
"MarshalJSON",
"(",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"w",
":=",
"jwriter",
".",
"Writer",
"{",
"}",
"\n",
"easyjsonC5a4559bEncodeGithubComChromedpCdprotoNetwork51",
"(",
"&",
"w",
",",
"v",
")",
"\n",
"return",
"w",
".",
"<mask>",
".",
"BuildBytes",
"(",
")",
",",
"w",
".",
"Error",
"\n",
"}"
] |
11,416 | all-11417 | [
"Enable",
"or",
"disable",
"a",
"generic",
"vertex",
"attribute",
"array"
] | [
"func",
"EnableVertexArrayAttrib",
"(",
"vaobj",
"uint32",
",",
"<mask>",
"uint32",
")",
"{",
"syscall",
".",
"Syscall",
"(",
"gpEnableVertexArrayAttrib",
",",
"2",
",",
"uintptr",
"(",
"vaobj",
")",
",",
"uintptr",
"(",
"index",
")",
",",
"0",
")",
"\n",
"}"
] |
11,417 | all-11418 | [
"execWatchCommandFunc",
"executes",
"the",
"exec",
"-",
"watch",
"command",
"."
] | [
"func",
"execWatchCommandFunc",
"(",
"c",
"*",
"cli",
".",
"Context",
",",
"ki",
"client",
".",
"KeysAPI",
")",
"{",
"args",
":=",
"c",
".",
"Args",
"(",
")",
"\n",
"argslen",
":=",
"len",
"(",
"args",
")",
"\n\n",
"if",
"argslen",
"<",
"2",
"{",
"handleError",
"(",
"c",
",",
"ExitBadArgs",
",",
"errors",
".",
"New",
"(",
"\"",
"\"",
")",
")",
"\n",
"}",
"\n\n",
"var",
"(",
"key",
"string",
"\n",
"cmdArgs",
"[",
"]",
"string",
"\n",
")",
"\n\n",
"foundSep",
":=",
"false",
"\n",
"for",
"i",
":=",
"range",
"args",
"{",
"if",
"args",
"[",
"i",
"]",
"==",
"\"",
"\"",
"&&",
"i",
"!=",
"0",
"{",
"foundSep",
"=",
"true",
"\n",
"break",
"\n",
"}",
"\n",
"}",
"\n\n",
"if",
"foundSep",
"{",
"key",
"=",
"args",
"[",
"0",
"]",
"\n",
"cmdArgs",
"=",
"args",
"[",
"2",
":",
"]",
"\n",
"}",
"else",
"{",
"// If no flag is parsed, the order of key and cmdArgs will be switched and",
"// args will not contain `--`.",
"key",
"=",
"args",
"[",
"argslen",
"-",
"1",
"]",
"\n",
"cmdArgs",
"=",
"args",
"[",
":",
"argslen",
"-",
"1",
"]",
"\n",
"}",
"\n\n",
"<mask>",
":=",
"0",
"\n",
"if",
"c",
".",
"Int",
"(",
"\"",
"\"",
")",
"!=",
"0",
"{",
"index",
"=",
"c",
".",
"Int",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"recursive",
":=",
"c",
".",
"Bool",
"(",
"\"",
"\"",
")",
"\n\n",
"sigch",
":=",
"make",
"(",
"chan",
"os",
".",
"Signal",
",",
"1",
")",
"\n",
"signal",
".",
"Notify",
"(",
"sigch",
",",
"os",
".",
"Interrupt",
")",
"\n\n",
"go",
"func",
"(",
")",
"{",
"<-",
"sigch",
"\n",
"os",
".",
"Exit",
"(",
"0",
")",
"\n",
"}",
"(",
")",
"\n\n",
"w",
":=",
"ki",
".",
"Watcher",
"(",
"key",
",",
"&",
"client",
".",
"WatcherOptions",
"{",
"AfterIndex",
":",
"uint64",
"(",
"index",
")",
",",
"Recursive",
":",
"recursive",
"}",
")",
"\n\n",
"for",
"{",
"resp",
",",
"err",
":=",
"w",
".",
"Next",
"(",
"context",
".",
"TODO",
"(",
")",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"handleError",
"(",
"c",
",",
"ExitServerError",
",",
"err",
")",
"\n",
"}",
"\n",
"if",
"resp",
".",
"Node",
".",
"Dir",
"{",
"fmt",
".",
"Fprintf",
"(",
"os",
".",
"Stderr",
",",
"\"",
"\\n",
"\"",
",",
"resp",
".",
"Node",
".",
"Key",
")",
"\n",
"continue",
"\n",
"}",
"\n\n",
"cmd",
":=",
"exec",
".",
"Command",
"(",
"cmdArgs",
"[",
"0",
"]",
",",
"cmdArgs",
"[",
"1",
":",
"]",
"...",
")",
"\n",
"cmd",
".",
"Env",
"=",
"environResponse",
"(",
"resp",
",",
"os",
".",
"Environ",
"(",
")",
")",
"\n\n",
"cmd",
".",
"Stdout",
"=",
"os",
".",
"Stdout",
"\n",
"cmd",
".",
"Stderr",
"=",
"os",
".",
"Stderr",
"\n\n",
"go",
"func",
"(",
")",
"{",
"err",
":=",
"cmd",
".",
"Start",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"fmt",
".",
"Fprintf",
"(",
"os",
".",
"Stderr",
",",
"err",
".",
"Error",
"(",
")",
")",
"\n",
"os",
".",
"Exit",
"(",
"1",
")",
"\n",
"}",
"\n",
"cmd",
".",
"Wait",
"(",
")",
"\n",
"}",
"(",
")",
"\n",
"}",
"\n",
"}"
] |
11,418 | all-11419 | [
"getFieldWithTag",
"lookups",
"jwt",
"tag",
"with",
"specified",
"tagName",
"on",
"obj",
"returning",
"its",
"reflected",
"value",
"."
] | [
"func",
"getFieldWithTag",
"(",
"obj",
"interface",
"{",
"}",
",",
"tagName",
"string",
")",
"*",
"reflect",
".",
"<mask>",
"{",
"objVal",
":=",
"reflect",
".",
"ValueOf",
"(",
"obj",
")",
"\n",
"if",
"objVal",
".",
"Kind",
"(",
")",
"!=",
"reflect",
".",
"Struct",
"{",
"objVal",
"=",
"objVal",
".",
"Elem",
"(",
")",
"\n",
"}",
"\n\n",
"for",
"i",
":=",
"0",
";",
"i",
"<",
"objVal",
".",
"NumField",
"(",
")",
";",
"i",
"++",
"{",
"fieldType",
":=",
"objVal",
".",
"Type",
"(",
")",
".",
"Field",
"(",
"i",
")",
"\n",
"if",
"tagName",
"==",
"fieldType",
".",
"Tag",
".",
"Get",
"(",
"\"",
"\"",
")",
"{",
"field",
":=",
"objVal",
".",
"Field",
"(",
"i",
")",
"\n",
"return",
"&",
"field",
"\n",
"}",
"\n",
"}",
"\n\n",
"return",
"nil",
"\n",
"}"
] |
11,419 | all-11420 | [
"SetAppMesh",
"sets",
"the",
"app",
"mesh",
"config",
"of",
"the",
"task"
] | [
"func",
"(",
"task",
"*",
"<mask>",
")",
"SetAppMesh",
"(",
"appMesh",
"*",
"apiappmesh",
".",
"AppMesh",
")",
"{",
"task",
".",
"lock",
".",
"Lock",
"(",
")",
"\n",
"defer",
"task",
".",
"lock",
".",
"Unlock",
"(",
")",
"\n\n",
"task",
".",
"AppMesh",
"=",
"appMesh",
"\n",
"}"
] |
11,420 | all-11421 | [
"Returns",
"an",
"string",
"at",
"the",
"key",
"and",
"whether",
"or",
"not",
"the",
"key",
"existed",
"and",
"the",
"value",
"was",
"an",
"string"
] | [
"func",
"(",
"t",
"Typed",
")",
"InterfaceIf",
"(",
"key",
"string",
")",
"(",
"interface",
"{",
"}",
",",
"bool",
")",
"{",
"value",
",",
"exists",
":=",
"t",
"[",
"key",
"]",
"\n",
"if",
"exists",
"==",
"false",
"{",
"return",
"nil",
",",
"<mask>",
"\n",
"}",
"\n",
"return",
"value",
",",
"true",
"\n",
"}"
] |
11,421 | all-11422 | [
"GeneratePluginHelp",
"compiles",
"and",
"returns",
"the",
"help",
"information",
"for",
"all",
"plugins",
"."
] | [
"func",
"(",
"ha",
"*",
"HelpAgent",
")",
"GeneratePluginHelp",
"(",
")",
"*",
"pluginhelp",
".",
"Help",
"{",
"config",
":=",
"ha",
".",
"pa",
".",
"Config",
"(",
")",
"\n",
"orgToRepos",
":=",
"ha",
".",
"oa",
".",
"orgToReposMap",
"(",
"config",
")",
"\n\n",
"normalRevMap",
",",
"externalRevMap",
":=",
"reversePluginMaps",
"(",
"config",
",",
"orgToRepos",
")",
"\n\n",
"allPlugins",
",",
"pluginHelp",
":=",
"ha",
".",
"generateNormalPluginHelp",
"(",
"config",
",",
"normalRevMap",
")",
"\n\n",
"allExternalPlugins",
",",
"externalPluginHelp",
":=",
"ha",
".",
"generateExternalPluginHelp",
"(",
"config",
",",
"externalRevMap",
")",
"\n\n",
"// Load repo->plugins maps from config",
"repoPlugins",
":=",
"map",
"[",
"string",
"]",
"[",
"]",
"string",
"{",
"\"",
"\"",
":",
"allPlugins",
",",
"}",
"\n",
"for",
"repo",
",",
"plugins",
":=",
"range",
"config",
".",
"Plugins",
"{",
"repoPlugins",
"[",
"repo",
"]",
"=",
"plugins",
"\n",
"}",
"\n",
"repoExternalPlugins",
":=",
"map",
"[",
"string",
"]",
"[",
"]",
"string",
"{",
"\"",
"\"",
":",
"allExternalPlugins",
",",
"}",
"\n",
"for",
"repo",
",",
"exts",
":=",
"range",
"config",
".",
"ExternalPlugins",
"{",
"for",
"_",
",",
"ext",
":=",
"<mask>",
"exts",
"{",
"repoExternalPlugins",
"[",
"repo",
"]",
"=",
"append",
"(",
"repoExternalPlugins",
"[",
"repo",
"]",
",",
"ext",
".",
"Name",
")",
"\n",
"}",
"\n",
"}",
"\n\n",
"return",
"&",
"pluginhelp",
".",
"Help",
"{",
"AllRepos",
":",
"allRepos",
"(",
"config",
",",
"orgToRepos",
")",
",",
"RepoPlugins",
":",
"repoPlugins",
",",
"RepoExternalPlugins",
":",
"repoExternalPlugins",
",",
"PluginHelp",
":",
"pluginHelp",
",",
"ExternalPluginHelp",
":",
"externalPluginHelp",
",",
"}",
"\n",
"}"
] |
11,422 | all-11423 | [
"InputBranches",
"returns",
"the",
"branches",
"in",
"an",
"Input",
"."
] | [
"func",
"InputBranches",
"(",
"input",
"*",
"Input",
")",
"[",
"]",
"*",
"pfs",
".",
"Branch",
"{",
"var",
"result",
"[",
"]",
"*",
"pfs",
".",
"Branch",
"\n",
"VisitInput",
"(",
"input",
",",
"func",
"(",
"input",
"*",
"Input",
")",
"{",
"if",
"input",
".",
"Pfs",
"!=",
"nil",
"{",
"<mask>",
"=",
"append",
"(",
"result",
",",
"&",
"pfs",
".",
"Branch",
"{",
"Repo",
":",
"&",
"pfs",
".",
"Repo",
"{",
"Name",
":",
"input",
".",
"Pfs",
".",
"Repo",
"}",
",",
"Name",
":",
"input",
".",
"Pfs",
".",
"Branch",
",",
"}",
")",
"\n",
"}",
"\n",
"if",
"input",
".",
"Cron",
"!=",
"nil",
"{",
"result",
"=",
"append",
"(",
"result",
",",
"&",
"pfs",
".",
"Branch",
"{",
"Repo",
":",
"&",
"pfs",
".",
"Repo",
"{",
"Name",
":",
"input",
".",
"Cron",
".",
"Repo",
"}",
",",
"Name",
":",
"\"",
"\"",
",",
"}",
")",
"\n",
"}",
"\n",
"if",
"input",
".",
"Git",
"!=",
"nil",
"{",
"result",
"=",
"append",
"(",
"result",
",",
"&",
"pfs",
".",
"Branch",
"{",
"Repo",
":",
"&",
"pfs",
".",
"Repo",
"{",
"Name",
":",
"input",
".",
"Git",
".",
"Name",
"}",
",",
"Name",
":",
"input",
".",
"Git",
".",
"Branch",
",",
"}",
")",
"\n",
"}",
"\n",
"}",
")",
"\n",
"return",
"result",
"\n",
"}"
] |
11,423 | all-11424 | [
"APICall",
"performs",
"an",
"API",
"call",
".",
"This",
"is",
"not",
"intended",
"for",
"general",
"use",
";",
"it",
"is",
"exported",
"for",
"use",
"in",
"conjunction",
"with",
"WithAPICallFunc",
"."
] | [
"func",
"APICall",
"(",
"ctx",
"context",
".",
"Context",
",",
"service",
",",
"method",
"string",
",",
"in",
",",
"out",
"proto",
".",
"Message",
")",
"error",
"{",
"return",
"internal",
".",
"Call",
"(",
"ctx",
",",
"service",
",",
"<mask>",
",",
"in",
",",
"out",
")",
"\n",
"}"
] |
11,424 | all-11425 | [
"UnmarshalJSON",
"supports",
"json",
".",
"Unmarshaler",
"interface"
] | [
"func",
"(",
"v",
"*",
"empty",
")",
"UnmarshalJSON",
"(",
"data",
"[",
"]",
"<mask>",
")",
"error",
"{",
"r",
":=",
"jlexer",
".",
"Lexer",
"{",
"Data",
":",
"data",
"}",
"\n",
"easyjsonC5a4559bDecodeGithubComChromedpCdproto",
"(",
"&",
"r",
",",
"v",
")",
"\n",
"return",
"r",
".",
"Error",
"(",
")",
"\n",
"}"
] |
11,425 | all-11426 | [
"set",
"a",
"named",
"parameter",
"of",
"a",
"framebuffer",
"object"
] | [
"func",
"FramebufferParameteri",
"(",
"<mask>",
"uint32",
",",
"pname",
"uint32",
",",
"param",
"int32",
")",
"{",
"syscall",
".",
"Syscall",
"(",
"gpFramebufferParameteri",
",",
"3",
",",
"uintptr",
"(",
"target",
")",
",",
"uintptr",
"(",
"pname",
")",
",",
"uintptr",
"(",
"param",
")",
")",
"\n",
"}"
] |
11,426 | all-11427 | [
"RestoreSnapshot",
"restores",
"a",
"volume",
"with",
"provided",
"snapshot"
] | [
"func",
"(",
"c",
"*",
"Client",
")",
"RestoreSnapshot",
"(",
"dcid",
"string",
",",
"volid",
"string",
",",
"snapshotID",
"string",
")",
"(",
"*",
"http",
".",
"Header",
",",
"error",
")",
"{",
"path",
":=",
"volumePath",
"(",
"dcid",
",",
"volid",
")",
"+",
"\"",
"\"",
"\n",
"data",
":=",
"url",
".",
"Values",
"{",
"}",
"\n",
"data",
".",
"Set",
"(",
"\"",
"\"",
",",
"snapshotID",
")",
"\n",
"ret",
":=",
"&",
"http",
".",
"Header",
"{",
"}",
"\n",
"err",
":=",
"c",
".",
"client",
".",
"Post",
"(",
"path",
",",
"data",
",",
"ret",
",",
"<mask>",
".",
"StatusAccepted",
")",
"\n",
"return",
"ret",
",",
"err",
"\n",
"}"
] |
11,427 | all-11428 | [
"String",
"returns",
"unique",
"string",
"representation",
"of",
"the",
"ctx",
".",
"The",
"returned",
"value",
"may",
"be",
"useful",
"for",
"logging",
"."
] | [
"func",
"(",
"ctx",
"*",
"RequestCtx",
")",
"String",
"(",
")",
"string",
"{",
"return",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"ctx",
".",
"ID",
"(",
")",
",",
"ctx",
".",
"LocalAddr",
"(",
")",
",",
"ctx",
".",
"RemoteAddr",
"(",
")",
",",
"ctx",
".",
"<mask>",
".",
"Header",
".",
"Method",
"(",
")",
",",
"ctx",
".",
"URI",
"(",
")",
".",
"FullURI",
"(",
")",
")",
"\n",
"}"
] |
11,428 | all-11429 | [
"Campaign",
"puts",
"a",
"value",
"as",
"eligible",
"for",
"the",
"election",
"on",
"the",
"prefix",
"key",
".",
"Multiple",
"sessions",
"can",
"participate",
"in",
"the",
"election",
"for",
"the",
"same",
"prefix",
"but",
"only",
"one",
"can",
"be",
"the",
"leader",
"at",
"a",
"time",
".",
"If",
"the",
"context",
"is",
"context",
".",
"TODO",
"()",
"/",
"context",
".",
"Background",
"()",
"the",
"Campaign",
"will",
"continue",
"to",
"be",
"blocked",
"for",
"other",
"keys",
"to",
"be",
"deleted",
"unless",
"server",
"returns",
"a",
"non",
"-",
"recoverable",
"error",
"(",
"e",
".",
"g",
".",
"ErrCompacted",
")",
".",
"Otherwise",
"until",
"the",
"context",
"is",
"not",
"cancelled",
"or",
"timed",
"-",
"out",
"Campaign",
"will",
"continue",
"to",
"be",
"blocked",
"until",
"it",
"becomes",
"the",
"leader",
"."
] | [
"func",
"(",
"e",
"*",
"Election",
")",
"Campaign",
"(",
"ctx",
"context",
".",
"Context",
",",
"val",
"string",
")",
"error",
"{",
"s",
":=",
"e",
".",
"session",
"\n",
"client",
":=",
"e",
".",
"session",
".",
"Client",
"(",
")",
"\n\n",
"k",
":=",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"e",
".",
"keyPrefix",
",",
"s",
".",
"Lease",
"(",
")",
")",
"\n",
"txn",
":=",
"client",
".",
"Txn",
"(",
"ctx",
")",
".",
"If",
"(",
"v3",
".",
"Compare",
"(",
"v3",
".",
"CreateRevision",
"(",
"k",
")",
",",
"\"",
"\"",
",",
"0",
")",
")",
"\n",
"txn",
"=",
"txn",
".",
"Then",
"(",
"v3",
".",
"OpPut",
"(",
"k",
",",
"val",
",",
"v3",
".",
"WithLease",
"(",
"s",
".",
"Lease",
"(",
")",
")",
")",
")",
"\n",
"txn",
"=",
"txn",
".",
"Else",
"(",
"v3",
".",
"OpGet",
"(",
"k",
")",
")",
"\n",
"resp",
",",
"err",
":=",
"txn",
".",
"Commit",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"e",
".",
"leaderKey",
",",
"e",
".",
"leaderRev",
",",
"e",
".",
"leaderSession",
"=",
"k",
",",
"resp",
".",
"Header",
".",
"Revision",
",",
"s",
"\n",
"if",
"!",
"resp",
".",
"Succeeded",
"{",
"kv",
":=",
"resp",
".",
"Responses",
"[",
"0",
"]",
".",
"GetResponseRange",
"(",
")",
".",
"Kvs",
"[",
"0",
"]",
"\n",
"e",
".",
"leaderRev",
"=",
"kv",
".",
"CreateRevision",
"\n",
"if",
"string",
"(",
"kv",
".",
"Value",
")",
"!=",
"val",
"{",
"if",
"err",
"=",
"e",
".",
"Proclaim",
"(",
"ctx",
",",
"val",
")",
";",
"err",
"!=",
"nil",
"{",
"e",
".",
"Resign",
"(",
"ctx",
")",
"\n",
"return",
"err",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n\n",
"_",
",",
"err",
"=",
"waitDeletes",
"(",
"ctx",
",",
"client",
",",
"e",
".",
"keyPrefix",
",",
"e",
".",
"leaderRev",
"-",
"1",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"// clean up in case of context cancel",
"select",
"{",
"case",
"<-",
"ctx",
".",
"Done",
"(",
")",
":",
"e",
".",
"Resign",
"(",
"client",
".",
"Ctx",
"(",
")",
")",
"\n",
"<mask>",
":",
"e",
".",
"leaderSession",
"=",
"nil",
"\n",
"}",
"\n",
"return",
"err",
"\n",
"}",
"\n",
"e",
".",
"hdr",
"=",
"resp",
".",
"Header",
"\n\n",
"return",
"nil",
"\n",
"}"
] |
11,429 | all-11430 | [
"NextProto",
"adds",
"nph",
"to",
"be",
"processed",
"when",
"key",
"is",
"negotiated",
"when",
"TLS",
"connection",
"is",
"established",
".",
"This",
"function",
"can",
"only",
"be",
"called",
"before",
"the",
"server",
"is",
"started",
"."
] | [
"func",
"(",
"s",
"*",
"Server",
")",
"NextProto",
"(",
"key",
"string",
",",
"nph",
"ServeHandler",
")",
"{",
"if",
"s",
".",
"nextProtos",
"==",
"nil",
"{",
"s",
".",
"nextProtos",
"=",
"make",
"(",
"map",
"[",
"string",
"]",
"ServeHandler",
")",
"\n",
"}",
"\n",
"s",
".",
"configTLS",
"(",
")",
"\n",
"s",
".",
"tlsConfig",
".",
"NextProtos",
"=",
"append",
"(",
"s",
".",
"tlsConfig",
".",
"NextProtos",
",",
"key",
")",
"\n",
"s",
".",
"nextProtos",
"[",
"<mask>",
"]",
"=",
"nph",
"\n",
"}"
] |
11,430 | all-11431 | [
"UnmarshalJSON",
"supports",
"json",
".",
"Unmarshaler",
"interface"
] | [
"func",
"(",
"v",
"*",
"DispatchTouchEventParams",
")",
"UnmarshalJSON",
"(",
"data",
"[",
"]",
"byte",
")",
"error",
"{",
"r",
":=",
"jlexer",
".",
"Lexer",
"{",
"Data",
":",
"<mask>",
"}",
"\n",
"easyjsonC5a4559bDecodeGithubComChromedpCdprotoInput7",
"(",
"&",
"r",
",",
"v",
")",
"\n",
"return",
"r",
".",
"Error",
"(",
")",
"\n",
"}"
] |
11,431 | all-11432 | [
"Set",
"a",
"cookie",
"on",
"the",
"response",
"which",
"will",
"expire",
"after",
"the",
"given",
"duration",
"."
] | [
"func",
"(",
"c",
"*",
"Cookies",
")",
"Set",
"(",
"name",
",",
"<mask>",
"string",
",",
"maxAge",
"time",
".",
"Duration",
")",
"{",
"ck",
":=",
"http",
".",
"Cookie",
"{",
"Name",
":",
"name",
",",
"Value",
":",
"value",
",",
"MaxAge",
":",
"int",
"(",
"maxAge",
".",
"Seconds",
"(",
")",
")",
",",
"}",
"\n\n",
"http",
".",
"SetCookie",
"(",
"c",
".",
"res",
",",
"&",
"ck",
")",
"\n",
"}"
] |
11,432 | all-11433 | [
"APIExtensionsCount",
"returns",
"the",
"number",
"of",
"available",
"API",
"extensions",
"."
] | [
"func",
"APIExtensionsCount",
"(",
")",
"int",
"{",
"count",
":=",
"len",
"(",
"APIExtensions",
")",
"\n\n",
"// This environment variable is an internal one to force the code",
"// to believe that we an API extensions version greater than we",
"// actually have. It's used by integration tests to exercise the",
"// cluster upgrade process.",
"artificialBump",
":=",
"os",
".",
"Getenv",
"(",
"\"",
"\"",
")",
"\n",
"if",
"artificialBump",
"!=",
"\"",
"\"",
"{",
"n",
",",
"err",
":=",
"strconv",
".",
"Atoi",
"(",
"artificialBump",
")",
"\n",
"if",
"err",
"==",
"nil",
"{",
"count",
"+=",
"n",
"\n",
"}",
"\n",
"}",
"\n\n",
"return",
"<mask>",
"\n",
"}"
] |
11,433 | all-11434 | [
"Select",
"iterates",
"over",
"a",
"list",
"and",
"returns",
"a",
"transformed",
"item",
"."
] | [
"func",
"(",
"iter",
"Enumerator",
")",
"Select",
"(",
"transform",
"Transform",
")",
"Enumerator",
"{",
"retval",
":=",
"make",
"(",
"chan",
"<mask>",
"{",
"}",
")",
"\n\n",
"go",
"func",
"(",
")",
"{",
"for",
"item",
":=",
"range",
"iter",
"{",
"retval",
"<-",
"transform",
"(",
"item",
")",
"\n",
"}",
"\n",
"close",
"(",
"retval",
")",
"\n",
"}",
"(",
")",
"\n\n",
"return",
"retval",
"\n",
"}"
] |
11,434 | all-11435 | [
"expandResourceVSphereComputeClusterDrsAdvancedOptions",
"reads",
"certain",
"ResourceData",
"keys",
"and",
"returns",
"a",
"BaseOptionValue",
"list",
"designed",
"for",
"use",
"as",
"DRS",
"advanced",
"options",
"."
] | [
"func",
"expandResourceVSphereComputeClusterDrsAdvancedOptions",
"(",
"d",
"*",
"schema",
".",
"ResourceData",
")",
"[",
"]",
"types",
".",
"BaseOptionValue",
"{",
"var",
"opts",
"[",
"]",
"types",
".",
"BaseOptionValue",
"\n\n",
"m",
":=",
"d",
".",
"Get",
"(",
"\"",
"\"",
")",
".",
"(",
"map",
"[",
"string",
"]",
"interface",
"{",
"}",
")",
"\n",
"for",
"k",
",",
"v",
":=",
"<mask>",
"m",
"{",
"opts",
"=",
"append",
"(",
"opts",
",",
"&",
"types",
".",
"OptionValue",
"{",
"Key",
":",
"k",
",",
"Value",
":",
"types",
".",
"AnyType",
"(",
"v",
")",
",",
"}",
")",
"\n",
"}",
"\n",
"return",
"opts",
"\n",
"}"
] |
11,435 | all-11436 | [
"String",
"renderer",
"that",
"will",
"run",
"the",
"string",
"through",
"the",
"github",
".",
"com",
"/",
"gobuffalo",
"/",
"plush",
"package",
"and",
"return",
"text",
"/",
"plain",
"as",
"the",
"content",
"type",
"."
] | [
"func",
"(",
"e",
"*",
"Engine",
")",
"String",
"(",
"s",
"string",
",",
"args",
"...",
"interface",
"{",
"}",
")",
"Renderer",
"{",
"if",
"len",
"(",
"args",
")",
">",
"0",
"{",
"s",
"=",
"fmt",
".",
"Sprintf",
"(",
"s",
",",
"args",
"...",
")",
"\n",
"}",
"\n",
"return",
"stringRenderer",
"{",
"<mask>",
":",
"e",
",",
"body",
":",
"s",
",",
"}",
"\n",
"}"
] |
11,436 | all-11437 | [
"ResourceNameFor",
"returns",
"a",
"lowercase",
"plural",
"form",
"of",
"a",
"type",
"for",
"human",
"messages",
".",
"Returns",
"lowercased",
"kind",
"if",
"discovery",
"lookup",
"fails",
"."
] | [
"func",
"ResourceNameFor",
"(",
"mapper",
"meta",
".",
"RESTMapper",
",",
"o",
"runtime",
".",
"Object",
")",
"string",
"{",
"gvk",
":=",
"o",
".",
"GetObjectKind",
"(",
")",
".",
"GroupVersionKind",
"(",
")",
"\n",
"mapping",
",",
"err",
":=",
"mapper",
".",
"RESTMapping",
"(",
"gvk",
".",
"GroupKind",
"(",
")",
",",
"gvk",
".",
"Version",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"log",
".",
"Debugf",
"(",
"\"",
"\"",
",",
"gvk",
",",
"err",
")",
"\n",
"return",
"strings",
".",
"ToLower",
"(",
"gvk",
".",
"Kind",
")",
"\n",
"}",
"\n\n",
"return",
"mapping",
".",
"Resource",
".",
"<mask>",
"\n",
"}"
] |
11,437 | all-11438 | [
"GoString",
"defines",
"the",
"printable",
"version",
"of",
"this",
"struct",
"."
] | [
"func",
"(",
"c",
"*",
"ExecConfig",
")",
"GoString",
"(",
")",
"<mask>",
"{",
"if",
"c",
"==",
"nil",
"{",
"return",
"\"",
"\"",
"\n",
"}",
"\n\n",
"return",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
"+",
"\"",
"\"",
"+",
"\"",
"\"",
"+",
"\"",
"\"",
"+",
"\"",
"\"",
"+",
"\"",
"\"",
"+",
"\"",
"\"",
"+",
"\"",
"\"",
"+",
"\"",
"\"",
"+",
"\"",
"\"",
",",
"StringGoString",
"(",
"c",
".",
"Command",
")",
",",
"BoolGoString",
"(",
"c",
".",
"Enabled",
")",
",",
"c",
".",
"Env",
",",
"SignalGoString",
"(",
"c",
".",
"KillSignal",
")",
",",
"TimeDurationGoString",
"(",
"c",
".",
"KillTimeout",
")",
",",
"SignalGoString",
"(",
"c",
".",
"ReloadSignal",
")",
",",
"TimeDurationGoString",
"(",
"c",
".",
"Splay",
")",
",",
"TimeDurationGoString",
"(",
"c",
".",
"Timeout",
")",
",",
")",
"\n",
"}"
] |
11,438 | all-11439 | [
"GetBool",
"returns",
"the",
"value",
"of",
"the",
"given",
"key",
"which",
"must",
"be",
"of",
"type",
"Bool",
"."
] | [
"func",
"(",
"m",
"*",
"Map",
")",
"GetBool",
"(",
"name",
"string",
")",
"bool",
"{",
"m",
".",
"schema",
".",
"assertKeyType",
"(",
"name",
",",
"Bool",
")",
"\n",
"return",
"<mask>",
".",
"IsTrue",
"(",
"m",
".",
"GetRaw",
"(",
"name",
")",
")",
"\n",
"}"
] |
11,439 | all-11440 | [
"Route",
"is",
"a",
"shortcut",
"for",
"same",
"handlers",
"but",
"different",
"HTTP",
"methods",
".",
"Example",
":",
"m",
".",
"Route",
"(",
"/",
"GET",
"POST",
"h",
")"
] | [
"func",
"(",
"r",
"*",
"Router",
")",
"Route",
"(",
"pattern",
",",
"methods",
"string",
",",
"h",
"...",
"<mask>",
")",
"(",
"route",
"*",
"Route",
")",
"{",
"for",
"_",
",",
"m",
":=",
"range",
"strings",
".",
"Split",
"(",
"methods",
",",
"\"",
"\"",
")",
"{",
"route",
"=",
"r",
".",
"Handle",
"(",
"strings",
".",
"TrimSpace",
"(",
"m",
")",
",",
"pattern",
",",
"h",
")",
"\n",
"}",
"\n",
"return",
"route",
"\n",
"}"
] |
11,440 | all-11441 | [
"PartitionActive",
"separates",
"the",
"provided",
"prowjobs",
"into",
"pending",
"and",
"triggered",
"and",
"returns",
"them",
"inside",
"channels",
"so",
"that",
"they",
"can",
"be",
"consumed",
"in",
"parallel",
"by",
"different",
"goroutines",
".",
"Complete",
"prowjobs",
"are",
"filtered",
"out",
".",
"Controller",
"loops",
"need",
"to",
"handle",
"pending",
"jobs",
"first",
"so",
"they",
"can",
"conform",
"to",
"maximum",
"concurrency",
"requirements",
"that",
"different",
"jobs",
"may",
"have",
"."
] | [
"func",
"PartitionActive",
"(",
"pjs",
"[",
"]",
"prowapi",
".",
"ProwJob",
")",
"(",
"pending",
",",
"triggered",
"chan",
"prowapi",
".",
"ProwJob",
")",
"{",
"// Size channels correctly.",
"pendingCount",
",",
"triggeredCount",
":=",
"0",
",",
"0",
"\n",
"for",
"_",
",",
"pj",
":=",
"range",
"pjs",
"{",
"switch",
"pj",
".",
"Status",
".",
"State",
"{",
"case",
"prowapi",
".",
"PendingState",
":",
"pendingCount",
"++",
"\n",
"case",
"prowapi",
".",
"TriggeredState",
":",
"triggeredCount",
"++",
"\n",
"}",
"\n",
"}",
"\n",
"pending",
"=",
"<mask>",
"(",
"chan",
"prowapi",
".",
"ProwJob",
",",
"pendingCount",
")",
"\n",
"triggered",
"=",
"make",
"(",
"chan",
"prowapi",
".",
"ProwJob",
",",
"triggeredCount",
")",
"\n\n",
"// Partition the jobs into the two separate channels.",
"for",
"_",
",",
"pj",
":=",
"range",
"pjs",
"{",
"switch",
"pj",
".",
"Status",
".",
"State",
"{",
"case",
"prowapi",
".",
"PendingState",
":",
"pending",
"<-",
"pj",
"\n",
"case",
"prowapi",
".",
"TriggeredState",
":",
"triggered",
"<-",
"pj",
"\n",
"}",
"\n",
"}",
"\n",
"close",
"(",
"pending",
")",
"\n",
"close",
"(",
"triggered",
")",
"\n",
"return",
"pending",
",",
"triggered",
"\n",
"}"
] |
11,441 | all-11442 | [
"NewPQLRowQuery",
"creates",
"a",
"new",
"PqlRowQuery",
"."
] | [
"func",
"NewPQLRowQuery",
"(",
"pql",
"string",
",",
"<mask>",
"*",
"Index",
",",
"err",
"error",
")",
"*",
"PQLRowQuery",
"{",
"return",
"&",
"PQLRowQuery",
"{",
"index",
":",
"index",
",",
"pql",
":",
"pql",
",",
"err",
":",
"err",
",",
"hasKeys",
":",
"index",
".",
"options",
".",
"keys",
",",
"}",
"\n",
"}"
] |
11,442 | all-11443 | [
"BaseProperties",
"returns",
"the",
"base",
"-",
"level",
"ComputeResource",
"managed",
"object",
"for",
"a",
"BaseComputeResource",
"an",
"interface",
"that",
"any",
"base",
"-",
"level",
"ComputeResource",
"and",
"derivative",
"object",
"implements",
".",
"Note",
"that",
"this",
"does",
"not",
"return",
"any",
"cluster",
"-",
"level",
"attributes",
"."
] | [
"func",
"BaseProperties",
"(",
"obj",
"BaseComputeResource",
")",
"(",
"*",
"mo",
".",
"ComputeResource",
",",
"error",
")",
"{",
"ctx",
",",
"cancel",
":=",
"context",
".",
"WithTimeout",
"(",
"context",
".",
"Background",
"(",
")",
",",
"provider",
".",
"DefaultAPITimeout",
")",
"\n",
"defer",
"cancel",
"(",
")",
"\n",
"<mask>",
"props",
"mo",
".",
"ComputeResource",
"\n",
"if",
"err",
":=",
"obj",
".",
"Properties",
"(",
"ctx",
",",
"obj",
".",
"Reference",
"(",
")",
",",
"nil",
",",
"&",
"props",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"return",
"&",
"props",
",",
"nil",
"\n",
"}"
] |
11,443 | all-11444 | [
"GetVisibleText",
"is",
"a",
"wrapper",
"around",
"gtk_text_iter_get_visible_text",
"()",
"."
] | [
"func",
"(",
"v",
"*",
"TextIter",
")",
"GetVisibleText",
"(",
"end",
"*",
"TextIter",
")",
"string",
"{",
"c",
":=",
"C",
".",
"gtk_text_iter_get_visible_text",
"(",
"v",
".",
"native",
"(",
")",
",",
"end",
".",
"native",
"(",
")",
")",
"\n",
"return",
"C",
".",
"GoString",
"(",
"(",
"*",
"C",
".",
"<mask>",
")",
"(",
"c",
")",
")",
"\n",
"}"
] |
11,444 | all-11445 | [
"WindowNew",
"is",
"a",
"wrapper",
"around",
"gtk_window_new",
"()",
"."
] | [
"func",
"WindowNew",
"(",
"t",
"WindowType",
")",
"(",
"*",
"Window",
",",
"<mask>",
")",
"{",
"c",
":=",
"C",
".",
"gtk_window_new",
"(",
"C",
".",
"GtkWindowType",
"(",
"t",
")",
")",
"\n",
"if",
"c",
"==",
"nil",
"{",
"return",
"nil",
",",
"nilPtrErr",
"\n",
"}",
"\n",
"return",
"wrapWindow",
"(",
"glib",
".",
"Take",
"(",
"unsafe",
".",
"Pointer",
"(",
"c",
")",
")",
")",
",",
"nil",
"\n",
"}"
] |
11,445 | all-11446 | [
"WithBaggageItem",
"creates",
"a",
"new",
"context",
"with",
"an",
"extra",
"baggage",
"item",
"."
] | [
"func",
"(",
"c",
"MockSpanContext",
")",
"WithBaggageItem",
"(",
"key",
",",
"value",
"string",
")",
"MockSpanContext",
"{",
"var",
"newBaggage",
"map",
"[",
"string",
"]",
"string",
"\n",
"if",
"c",
".",
"Baggage",
"==",
"nil",
"{",
"newBaggage",
"=",
"map",
"[",
"string",
"]",
"string",
"{",
"key",
":",
"<mask>",
"}",
"\n",
"}",
"else",
"{",
"newBaggage",
"=",
"make",
"(",
"map",
"[",
"string",
"]",
"string",
",",
"len",
"(",
"c",
".",
"Baggage",
")",
"+",
"1",
")",
"\n",
"for",
"k",
",",
"v",
":=",
"range",
"c",
".",
"Baggage",
"{",
"newBaggage",
"[",
"k",
"]",
"=",
"v",
"\n",
"}",
"\n",
"newBaggage",
"[",
"key",
"]",
"=",
"value",
"\n",
"}",
"\n",
"// Use positional parameters so the compiler will help catch new fields.",
"return",
"MockSpanContext",
"{",
"c",
".",
"TraceID",
",",
"c",
".",
"SpanID",
",",
"c",
".",
"Sampled",
",",
"newBaggage",
"}",
"\n",
"}"
] |
11,446 | all-11447 | [
"CommentOutM",
"removes",
"the",
"comment",
"character",
"of",
"lines",
"that",
"mach",
"any",
"regular",
"expression",
"in",
"reLine",
"in",
"the",
"named",
"file",
"."
] | [
"func",
"CommentOutM",
"(",
"filename",
"string",
",",
"reLine",
"[",
"]",
"string",
")",
"error",
"{",
"e",
",",
"err",
":=",
"NewEdit",
"(",
"<mask>",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"err",
"=",
"e",
".",
"CommentOut",
"(",
"reLine",
")",
"\n",
"err2",
":=",
"e",
".",
"Close",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"return",
"err2",
"\n",
"}"
] |
11,447 | all-11448 | [
"dvsProperties",
"is",
"a",
"convenience",
"method",
"that",
"wraps",
"fetching",
"the",
"DVS",
"MO",
"from",
"its",
"higher",
"-",
"level",
"object",
"."
] | [
"func",
"dvsProperties",
"(",
"dvs",
"*",
"<mask>",
".",
"VmwareDistributedVirtualSwitch",
")",
"(",
"*",
"mo",
".",
"VmwareDistributedVirtualSwitch",
",",
"error",
")",
"{",
"ctx",
",",
"cancel",
":=",
"context",
".",
"WithTimeout",
"(",
"context",
".",
"Background",
"(",
")",
",",
"defaultAPITimeout",
")",
"\n",
"defer",
"cancel",
"(",
")",
"\n",
"var",
"props",
"mo",
".",
"VmwareDistributedVirtualSwitch",
"\n",
"if",
"err",
":=",
"dvs",
".",
"Properties",
"(",
"ctx",
",",
"dvs",
".",
"Reference",
"(",
")",
",",
"nil",
",",
"&",
"props",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"return",
"&",
"props",
",",
"nil",
"\n",
"}"
] |
11,448 | all-11449 | [
"String",
"wraps",
"g_variant_print",
"()",
".",
"It",
"returns",
"a",
"string",
"understood",
"by",
"g_variant_parse",
"()",
"."
] | [
"func",
"(",
"v",
"*",
"Variant",
")",
"String",
"(",
")",
"string",
"{",
"gc",
":=",
"C",
".",
"g_variant_print",
"(",
"v",
".",
"native",
"(",
")",
",",
"gbool",
"(",
"false",
")",
")",
"\n",
"defer",
"C",
".",
"g_free",
"(",
"C",
".",
"gpointer",
"(",
"gc",
")",
")",
"\n",
"return",
"C",
".",
"GoString",
"(",
"(",
"*",
"C",
".",
"<mask>",
")",
"(",
"gc",
")",
")",
"\n",
"}"
] |
11,449 | all-11450 | [
"map",
"all",
"of",
"a",
"buffer",
"object",
"s",
"data",
"store",
"into",
"the",
"client",
"s",
"address",
"space"
] | [
"func",
"MapBuffer",
"(",
"<mask>",
"uint32",
",",
"access",
"uint32",
")",
"unsafe",
".",
"Pointer",
"{",
"ret",
":=",
"C",
".",
"glowMapBuffer",
"(",
"gpMapBuffer",
",",
"(",
"C",
".",
"GLenum",
")",
"(",
"target",
")",
",",
"(",
"C",
".",
"GLenum",
")",
"(",
"access",
")",
")",
"\n",
"return",
"(",
"unsafe",
".",
"Pointer",
")",
"(",
"ret",
")",
"\n",
"}"
] |
11,450 | all-11451 | [
"prepareReviewersBody",
"separates",
"reviewers",
"from",
"team_reviewers",
"and",
"prepares",
"a",
"map",
"{",
"reviewers",
":",
"[",
"octocat",
"hubot",
"other_user",
"]",
"team_reviewers",
":",
"[",
"justice",
"-",
"league",
"]",
"}",
"https",
":",
"//",
"developer",
".",
"github",
".",
"com",
"/",
"v3",
"/",
"pulls",
"/",
"review_requests",
"/",
"#create",
"-",
"a",
"-",
"review",
"-",
"request"
] | [
"func",
"prepareReviewersBody",
"(",
"logins",
"[",
"]",
"string",
",",
"org",
"string",
")",
"(",
"map",
"[",
"string",
"]",
"[",
"]",
"string",
",",
"error",
")",
"{",
"body",
":=",
"map",
"[",
"string",
"]",
"[",
"]",
"string",
"{",
"}",
"\n",
"var",
"errors",
"[",
"]",
"error",
"\n",
"for",
"_",
",",
"login",
":=",
"range",
"logins",
"{",
"mat",
":=",
"teamRe",
".",
"FindStringSubmatch",
"(",
"login",
")",
"\n",
"if",
"mat",
"==",
"nil",
"{",
"if",
"_",
",",
"exists",
":=",
"body",
"[",
"\"",
"\"",
"]",
";",
"!",
"exists",
"{",
"body",
"[",
"\"",
"\"",
"]",
"=",
"[",
"]",
"string",
"{",
"}",
"\n",
"}",
"\n",
"body",
"[",
"\"",
"\"",
"]",
"=",
"append",
"(",
"body",
"[",
"\"",
"\"",
"]",
",",
"login",
")",
"\n",
"}",
"else",
"if",
"mat",
"[",
"1",
"]",
"==",
"org",
"{",
"if",
"_",
",",
"exists",
":=",
"body",
"[",
"\"",
"\"",
"]",
";",
"!",
"exists",
"{",
"body",
"[",
"\"",
"\"",
"]",
"=",
"[",
"]",
"string",
"{",
"}",
"\n",
"}",
"\n",
"body",
"[",
"\"",
"\"",
"]",
"=",
"append",
"(",
"body",
"[",
"\"",
"\"",
"]",
",",
"mat",
"[",
"2",
"]",
")",
"\n",
"}",
"else",
"{",
"<mask>",
"=",
"append",
"(",
"errors",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"login",
",",
"org",
")",
")",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"body",
",",
"errorutil",
".",
"NewAggregate",
"(",
"errors",
"...",
")",
"\n",
"}"
] |
11,451 | all-11452 | [
"Create",
"creates",
"a",
"channel",
"and",
"returns",
"a",
"token",
"for",
"use",
"by",
"the",
"client",
".",
"The",
"clientID",
"is",
"an",
"application",
"-",
"provided",
"string",
"used",
"to",
"identify",
"the",
"client",
"."
] | [
"func",
"Create",
"(",
"c",
"context",
".",
"Context",
",",
"clientID",
"string",
")",
"(",
"token",
"string",
",",
"err",
"error",
")",
"{",
"req",
":=",
"&",
"pb",
".",
"CreateChannelRequest",
"{",
"ApplicationKey",
":",
"&",
"clientID",
",",
"}",
"\n",
"resp",
":=",
"&",
"pb",
".",
"CreateChannelResponse",
"{",
"}",
"\n",
"err",
"=",
"<mask>",
".",
"Call",
"(",
"c",
",",
"service",
",",
"\"",
"\"",
",",
"req",
",",
"resp",
")",
"\n",
"token",
"=",
"resp",
".",
"GetToken",
"(",
")",
"\n",
"return",
"token",
",",
"remapError",
"(",
"err",
")",
"\n",
"}"
] |
11,452 | all-11453 | [
"Snake",
"converts",
"to",
"snake",
"case",
"(",
"FooBar",
"-",
">",
"foo_bar",
")"
] | [
"func",
"Snake",
"(",
"<mask>",
"string",
")",
"string",
"{",
"var",
"ret",
"bytes",
".",
"Buffer",
"\n\n",
"multipleUpper",
":=",
"false",
"\n",
"var",
"lastUpper",
"rune",
"\n",
"var",
"beforeUpper",
"rune",
"\n\n",
"for",
"_",
",",
"c",
":=",
"range",
"name",
"{",
"// Non-lowercase character after uppercase is considered to be uppercase too.",
"isUpper",
":=",
"(",
"unicode",
".",
"IsUpper",
"(",
"c",
")",
"||",
"(",
"lastUpper",
"!=",
"0",
"&&",
"!",
"unicode",
".",
"IsLower",
"(",
"c",
")",
")",
")",
"\n\n",
"if",
"lastUpper",
"!=",
"0",
"{",
"// Output a delimiter if last character was either the",
"// first uppercase character in a row, or the last one",
"// in a row (e.g. 'S' in \"HTTPServer\"). Do not output",
"// a delimiter at the beginning of the name.",
"firstInRow",
":=",
"!",
"multipleUpper",
"\n",
"lastInRow",
":=",
"!",
"isUpper",
"\n\n",
"if",
"ret",
".",
"Len",
"(",
")",
">",
"0",
"&&",
"(",
"firstInRow",
"||",
"lastInRow",
")",
"&&",
"beforeUpper",
"!=",
"'_'",
"{",
"ret",
".",
"WriteByte",
"(",
"'_'",
")",
"\n",
"}",
"\n",
"ret",
".",
"WriteRune",
"(",
"unicode",
".",
"ToLower",
"(",
"lastUpper",
")",
")",
"\n",
"}",
"\n\n",
"// Buffer uppercase char, do not output it yet as a delimiter",
"// may be required if the next character is lowercase.",
"if",
"isUpper",
"{",
"multipleUpper",
"=",
"(",
"lastUpper",
"!=",
"0",
")",
"\n",
"lastUpper",
"=",
"c",
"\n",
"continue",
"\n",
"}",
"\n\n",
"ret",
".",
"WriteRune",
"(",
"c",
")",
"\n",
"lastUpper",
"=",
"0",
"\n",
"beforeUpper",
"=",
"c",
"\n",
"multipleUpper",
"=",
"false",
"\n",
"}",
"\n\n",
"if",
"lastUpper",
"!=",
"0",
"{",
"ret",
".",
"WriteRune",
"(",
"unicode",
".",
"ToLower",
"(",
"lastUpper",
")",
")",
"\n",
"}",
"\n",
"return",
"string",
"(",
"ret",
".",
"Bytes",
"(",
")",
")",
"\n",
"}"
] |
11,453 | all-11454 | [
"simultaneously",
"specify",
"storage",
"for",
"all",
"levels",
"of",
"a",
"three",
"-",
"dimensional",
"two",
"-",
"dimensional",
"array",
"or",
"cube",
"-",
"map",
"array",
"texture"
] | [
"func",
"TexStorage3D",
"(",
"<mask>",
"uint32",
",",
"levels",
"int32",
",",
"internalformat",
"uint32",
",",
"width",
"int32",
",",
"height",
"int32",
",",
"depth",
"int32",
")",
"{",
"C",
".",
"glowTexStorage3D",
"(",
"gpTexStorage3D",
",",
"(",
"C",
".",
"GLenum",
")",
"(",
"target",
")",
",",
"(",
"C",
".",
"GLsizei",
")",
"(",
"levels",
")",
",",
"(",
"C",
".",
"GLenum",
")",
"(",
"internalformat",
")",
",",
"(",
"C",
".",
"GLsizei",
")",
"(",
"width",
")",
",",
"(",
"C",
".",
"GLsizei",
")",
"(",
"height",
")",
",",
"(",
"C",
".",
"GLsizei",
")",
"(",
"depth",
")",
")",
"\n",
"}"
] |
11,454 | all-11455 | [
"UnmarshalEasyJSON",
"satisfies",
"easyjson",
".",
"Unmarshaler",
"."
] | [
"func",
"(",
"t",
"*",
"InterceptionStage",
")",
"UnmarshalEasyJSON",
"(",
"in",
"*",
"jlexer",
".",
"Lexer",
")",
"{",
"switch",
"InterceptionStage",
"(",
"in",
".",
"String",
"(",
")",
")",
"{",
"case",
"InterceptionStageRequest",
":",
"*",
"t",
"=",
"InterceptionStageRequest",
"\n",
"case",
"InterceptionStageHeadersReceived",
":",
"*",
"t",
"=",
"InterceptionStageHeadersReceived",
"\n\n",
"<mask>",
":",
"in",
".",
"AddError",
"(",
"errors",
".",
"New",
"(",
"\"",
"\"",
")",
")",
"\n",
"}",
"\n",
"}"
] |
11,455 | all-11456 | [
"Set",
"parses",
"out",
"a",
"prowapi",
".",
"Refs",
"from",
"the",
"user",
"string",
".",
"The",
"following",
"example",
"shows",
"all",
"possible",
"fields",
":",
"org",
"repo",
"=",
"base",
"-",
"ref",
":",
"base",
"-",
"sha",
"[",
"pull",
"-",
"number",
":",
"pull",
"-",
"sha",
"]",
"...",
"For",
"the",
"base",
"ref",
"and",
"every",
"pull",
"number",
"the",
"SHAs",
"are",
"optional",
"and",
"any",
"number",
"of",
"them",
"may",
"be",
"set",
"or",
"unset",
"."
] | [
"func",
"(",
"r",
"*",
"gitRefs",
")",
"Set",
"(",
"<mask>",
"string",
")",
"error",
"{",
"gitRef",
",",
"err",
":=",
"ParseRefs",
"(",
"value",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"r",
".",
"gitRefs",
"=",
"append",
"(",
"r",
".",
"gitRefs",
",",
"*",
"gitRef",
")",
"\n",
"return",
"nil",
"\n",
"}"
] |
11,456 | all-11457 | [
"TickerGo",
"calls",
"the",
"given",
"ProcessFunc",
"every",
"time",
"the",
"ticker",
"fires",
".",
"This",
"is",
"not",
"rate",
"limited",
"multiple",
"calls",
"could",
"be",
"in",
"-",
"flight",
"at",
"the",
"same",
"time",
"."
] | [
"func",
"TickerGo",
"(",
"ticker",
"<-",
"chan",
"<mask>",
".",
"Time",
",",
"procfunc",
"gp",
".",
"ProcessFunc",
")",
"gp",
".",
"Process",
"{",
"return",
"gp",
".",
"Go",
"(",
"goCallOnTicker",
"(",
"ticker",
",",
"procfunc",
")",
")",
"\n",
"}"
] |
11,457 | all-11458 | [
"Calculates",
"the",
"per",
"-",
"element",
"difference",
"between",
"an",
"array",
"and",
"a",
"scalar",
"with",
"a",
"mask",
".",
"dst",
"=",
"src",
"-",
"value"
] | [
"func",
"SubScalarWithMask",
"(",
"src",
"*",
"IplImage",
",",
"value",
"Scalar",
",",
"dst",
",",
"mask",
"*",
"IplImage",
")",
"{",
"C",
".",
"cvSubS",
"(",
"unsafe",
".",
"Pointer",
"(",
"src",
")",
",",
"(",
"C",
".",
"CvScalar",
")",
"(",
"value",
")",
",",
"unsafe",
".",
"Pointer",
"(",
"dst",
")",
",",
"unsafe",
".",
"Pointer",
"(",
"<mask>",
")",
",",
")",
"\n",
"}"
] |
11,458 | all-11459 | [
"GetLabel",
"returns",
"the",
"Label",
"field",
"if",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"."
] | [
"func",
"(",
"t",
"*",
"TileDefMarker",
")",
"GetLabel",
"(",
")",
"string",
"{",
"if",
"t",
"==",
"nil",
"||",
"t",
".",
"Label",
"==",
"nil",
"{",
"return",
"\"",
"\"",
"\n",
"}",
"\n",
"return",
"*",
"t",
".",
"<mask>",
"\n",
"}"
] |
11,459 | all-11460 | [
"GetResourceOk",
"returns",
"a",
"tuple",
"with",
"the",
"Resource",
"field",
"if",
"it",
"s",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"and",
"a",
"boolean",
"to",
"check",
"if",
"the",
"value",
"has",
"been",
"set",
"."
] | [
"func",
"(",
"e",
"*",
"Event",
")",
"GetResourceOk",
"(",
")",
"(",
"string",
",",
"bool",
")",
"{",
"if",
"e",
"==",
"nil",
"||",
"e",
".",
"Resource",
"==",
"nil",
"{",
"return",
"\"",
"\"",
",",
"false",
"\n",
"}",
"\n",
"return",
"*",
"e",
".",
"<mask>",
",",
"true",
"\n",
"}"
] |
11,460 | all-11461 | [
"Error",
"calls",
"UI",
".",
"Error",
"to",
"write",
".",
"ErrorFGColor",
"and",
"ErrorBGColor",
"are",
"used",
"for",
"color",
"."
] | [
"func",
"(",
"ui",
"*",
"ColorUI",
")",
"Error",
"(",
"message",
"string",
")",
"{",
"ct",
".",
"ChangeColor",
"(",
"ui",
".",
"ErrorFGColor",
".",
"Code",
",",
"ui",
".",
"ErrorFGColor",
".",
"Bright",
",",
"ui",
".",
"ErrorBGColor",
".",
"Code",
",",
"ui",
".",
"ErrorBGColor",
".",
"Bright",
")",
"\n",
"ui",
".",
"UI",
".",
"Error",
"(",
"<mask>",
")",
"\n",
"ct",
".",
"ResetColor",
"(",
")",
"\n",
"}"
] |
11,461 | all-11462 | [
"nextItem",
"returns",
"the",
"next",
"item",
"from",
"the",
"input",
"."
] | [
"func",
"(",
"l",
"*",
"lexer",
")",
"nextItem",
"(",
")",
"item",
"{",
"item",
":=",
"<-",
"l",
".",
"<mask>",
"\n",
"l",
".",
"lastPos",
"=",
"item",
".",
"pos",
"\n",
"return",
"item",
"\n",
"}"
] |
11,462 | all-11463 | [
"CookieJar",
"sets",
"HTTP",
"cookie",
"jar",
"for",
"this",
"client"
] | [
"func",
"CookieJar",
"(",
"jar",
"http",
".",
"CookieJar",
")",
"ClientParam",
"{",
"return",
"func",
"(",
"c",
"*",
"Client",
")",
"error",
"{",
"c",
".",
"jar",
"=",
"<mask>",
"\n",
"return",
"nil",
"\n",
"}",
"\n",
"}"
] |
11,463 | all-11464 | [
"$",
"{",
"LXD_DIR",
"}",
"/",
"storage",
"-",
"pools",
"/",
"<pool",
">",
"/",
"custom",
"/",
"<storage_volume",
">"
] | [
"func",
"getStoragePoolVolumeMountPoint",
"(",
"poolName",
"string",
",",
"volumeName",
"string",
")",
"string",
"{",
"return",
"<mask>",
".",
"VarPath",
"(",
"\"",
"\"",
",",
"poolName",
",",
"\"",
"\"",
",",
"volumeName",
")",
"\n",
"}"
] |
11,464 | all-11465 | [
"UnmarshalJSON",
"supports",
"json",
".",
"Unmarshaler",
"interface"
] | [
"func",
"(",
"v",
"*",
"RemoveBindingParams",
")",
"UnmarshalJSON",
"(",
"<mask>",
"[",
"]",
"byte",
")",
"error",
"{",
"r",
":=",
"jlexer",
".",
"Lexer",
"{",
"Data",
":",
"data",
"}",
"\n",
"easyjsonC5a4559bDecodeGithubComChromedpCdprotoRuntime8",
"(",
"&",
"r",
",",
"v",
")",
"\n",
"return",
"r",
".",
"Error",
"(",
")",
"\n",
"}"
] |
11,465 | all-11466 | [
"RemoveHostTags",
"removes",
"all",
"tags",
"from",
"a",
"host",
"for",
"the",
"given",
"source",
".",
"If",
"none",
"is",
"given",
"the",
"API",
"defaults",
"to",
"users",
"."
] | [
"func",
"(",
"client",
"*",
"Client",
")",
"RemoveHostTags",
"(",
"host",
",",
"source",
"string",
")",
"error",
"{",
"uri",
":=",
"\"",
"\"",
"+",
"host",
"\n",
"if",
"source",
"!=",
"\"",
"\"",
"{",
"uri",
"+=",
"\"",
"\"",
"+",
"source",
"\n",
"}",
"\n",
"return",
"<mask>",
".",
"doJsonRequest",
"(",
"\"",
"\"",
",",
"uri",
",",
"nil",
",",
"nil",
")",
"\n",
"}"
] |
11,466 | all-11467 | [
"GetDetailHeightRows",
"is",
"a",
"wrapper",
"around",
"gtk_calendar_get_detail_height_rows",
"()",
"."
] | [
"func",
"(",
"v",
"*",
"Calendar",
")",
"GetDetailHeightRows",
"(",
")",
"int",
"{",
"c",
":=",
"C",
".",
"gtk_calendar_get_detail_height_rows",
"(",
"v",
".",
"native",
"(",
")",
")",
"\n",
"<mask>",
"int",
"(",
"c",
")",
"\n",
"}"
] |
11,467 | all-11468 | [
"Do",
"executes",
"DOMStorage",
".",
"disable",
"against",
"the",
"provided",
"context",
"."
] | [
"func",
"(",
"p",
"*",
"DisableParams",
")",
"Do",
"(",
"ctx",
"<mask>",
".",
"Context",
")",
"(",
"err",
"error",
")",
"{",
"return",
"cdp",
".",
"Execute",
"(",
"ctx",
",",
"CommandDisable",
",",
"nil",
",",
"nil",
")",
"\n",
"}"
] |
11,468 | all-11469 | [
"Read",
"file",
"asynchronously"
] | [
"func",
"readAllAsync",
"(",
"f",
"io",
".",
"ReadCloser",
")",
"(",
"*",
"[",
"]",
"byte",
",",
"chan",
"struct",
"{",
"}",
")",
"{",
"done",
":=",
"make",
"(",
"chan",
"struct",
"{",
"}",
",",
"1",
")",
"// signal that the read is done",
"\n",
"var",
"buf",
"[",
"]",
"byte",
"// placeholder buffer for the result",
"\n",
"<mask>",
"func",
"(",
")",
"{",
"var",
"err",
"error",
"\n",
"buf",
",",
"err",
"=",
"ioutil",
".",
"ReadAll",
"(",
"f",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"buf",
"=",
"make",
"(",
"[",
"]",
"byte",
",",
"0",
")",
"\n",
"}",
"\n",
"f",
".",
"Close",
"(",
")",
"\n",
"done",
"<-",
"struct",
"{",
"}",
"{",
"}",
"\n",
"}",
"(",
")",
"\n",
"return",
"&",
"buf",
",",
"done",
"\n",
"}"
] |
11,469 | all-11470 | [
"handlePulls",
"pull",
"for",
"Pub",
"/",
"Sub",
"subscriptions",
"and",
"handle",
"them",
"."
] | [
"func",
"(",
"s",
"*",
"PullServer",
")",
"handlePulls",
"(",
"ctx",
"context",
".",
"Context",
",",
"projectSubscriptions",
"config",
".",
"PubsubSubscriptions",
")",
"(",
"*",
"errgroup",
".",
"Group",
",",
"context",
".",
"Context",
",",
"error",
")",
"{",
"// Since config might change we need be able to cancel the current run",
"errGroup",
",",
"derivedCtx",
":=",
"errgroup",
".",
"WithContext",
"(",
"ctx",
")",
"\n",
"for",
"project",
",",
"subscriptions",
":=",
"range",
"projectSubscriptions",
"{",
"<mask>",
",",
"err",
":=",
"s",
".",
"Client",
".",
"new",
"(",
"ctx",
",",
"project",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"errGroup",
",",
"derivedCtx",
",",
"err",
"\n",
"}",
"\n",
"for",
"_",
",",
"subName",
":=",
"range",
"subscriptions",
"{",
"sub",
":=",
"client",
".",
"subscription",
"(",
"subName",
")",
"\n",
"errGroup",
".",
"Go",
"(",
"func",
"(",
")",
"error",
"{",
"logrus",
".",
"Infof",
"(",
"\"",
"\"",
",",
"sub",
".",
"string",
"(",
")",
",",
"project",
")",
"\n",
"defer",
"logrus",
".",
"Warnf",
"(",
"\"",
"\"",
",",
"sub",
".",
"string",
"(",
")",
",",
"project",
")",
"\n",
"err",
":=",
"sub",
".",
"receive",
"(",
"derivedCtx",
",",
"func",
"(",
"ctx",
"context",
".",
"Context",
",",
"msg",
"messageInterface",
")",
"{",
"if",
"err",
"=",
"s",
".",
"Subscriber",
".",
"handleMessage",
"(",
"msg",
",",
"sub",
".",
"string",
"(",
")",
")",
";",
"err",
"!=",
"nil",
"{",
"s",
".",
"Subscriber",
".",
"Metrics",
".",
"ACKMessageCounter",
".",
"With",
"(",
"prometheus",
".",
"Labels",
"{",
"subscriptionLabel",
":",
"sub",
".",
"string",
"(",
")",
"}",
")",
".",
"Inc",
"(",
")",
"\n",
"}",
"else",
"{",
"s",
".",
"Subscriber",
".",
"Metrics",
".",
"NACKMessageCounter",
".",
"With",
"(",
"prometheus",
".",
"Labels",
"{",
"subscriptionLabel",
":",
"sub",
".",
"string",
"(",
")",
"}",
")",
".",
"Inc",
"(",
")",
"\n",
"}",
"\n",
"msg",
".",
"ack",
"(",
")",
"\n",
"}",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"logrus",
".",
"WithError",
"(",
"err",
")",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"sub",
".",
"string",
"(",
")",
",",
"project",
")",
"\n",
"return",
"err",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}",
")",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"errGroup",
",",
"derivedCtx",
",",
"nil",
"\n",
"}"
] |
11,470 | all-11471 | [
"Vec2SAdd",
"performs",
"a",
"scaled",
"vector",
"addition",
".",
"dest",
"=",
"v1",
"+",
"(",
"v2",
"*",
"s",
")",
"dest",
"[",
"out",
"]",
"The",
"result",
"vector",
".",
"v1",
"[",
"in",
"]",
"The",
"base",
"vector",
".",
"v1",
"[",
"in",
"]",
"The",
"vector",
"to",
"scale",
"and",
"add",
"to",
"v1",
".",
"s",
"[",
"in",
"]",
"The",
"amount",
"to",
"scale",
"v2",
"by",
"before",
"adding",
"to",
"v1",
"."
] | [
"func",
"Vec2SAdd",
"(",
"<mask>",
",",
"v1",
",",
"v2",
"Vec2",
",",
"s",
"float32",
")",
"{",
"dest",
"[",
"0",
"]",
"=",
"v1",
"[",
"0",
"]",
"+",
"v2",
"[",
"0",
"]",
"*",
"s",
"\n",
"dest",
"[",
"1",
"]",
"=",
"v1",
"[",
"1",
"]",
"+",
"v2",
"[",
"1",
"]",
"*",
"s",
"\n",
"}"
] |
11,471 | all-11472 | [
"GetJsonNumberOk",
"is",
"a",
"helper",
"routine",
"that",
"returns",
"a",
"boolean",
"representing",
"if",
"a",
"value",
"was",
"set",
"and",
"if",
"so",
"dereferences",
"the",
"pointer",
"to",
"it",
"."
] | [
"func",
"GetJsonNumberOk",
"(",
"v",
"*",
"json",
".",
"Number",
")",
"(",
"json",
".",
"Number",
",",
"bool",
")",
"{",
"if",
"v",
"!=",
"nil",
"{",
"return",
"*",
"v",
",",
"<mask>",
"\n",
"}",
"\n\n",
"return",
"\"",
"\"",
",",
"false",
"\n",
"}"
] |
11,472 | all-11473 | [
"WithApp",
"adds",
"the",
"app",
"to",
"the",
"patch",
"apps",
"app",
"params"
] | [
"func",
"(",
"o",
"*",
"PatchAppsAppParams",
")",
"WithApp",
"(",
"app",
"<mask>",
")",
"*",
"PatchAppsAppParams",
"{",
"o",
".",
"SetApp",
"(",
"app",
")",
"\n",
"return",
"o",
"\n",
"}"
] |
11,473 | all-11474 | [
"Get",
"returns",
"a",
"new",
"byte",
"slices",
"that",
"fits",
"the",
"given",
"size",
"."
] | [
"func",
"(",
"p",
"*",
"Pool",
")",
"Get",
"(",
"sz",
"int",
")",
"interface",
"{",
"}",
"{",
"for",
"i",
",",
"bktSize",
":=",
"<mask>",
"p",
".",
"sizes",
"{",
"if",
"sz",
">",
"bktSize",
"{",
"continue",
"\n",
"}",
"\n",
"b",
":=",
"p",
".",
"buckets",
"[",
"i",
"]",
".",
"Get",
"(",
")",
"\n",
"if",
"b",
"==",
"nil",
"{",
"b",
"=",
"p",
".",
"make",
"(",
"bktSize",
")",
"\n",
"}",
"\n",
"return",
"b",
"\n",
"}",
"\n",
"return",
"p",
".",
"make",
"(",
"sz",
")",
"\n",
"}"
] |
11,474 | all-11475 | [
"MaxHeight",
"is",
"the",
"expected",
"maximum",
"tree",
"height",
"given",
"the",
"number",
"of",
"nodes"
] | [
"func",
"(",
"ivt",
"*",
"IntervalTree",
")",
"MaxHeight",
"(",
")",
"int",
"{",
"<mask>",
"int",
"(",
"(",
"2",
"*",
"math",
".",
"Log2",
"(",
"float64",
"(",
"ivt",
".",
"Len",
"(",
")",
"+",
"1",
")",
")",
")",
"+",
"0.5",
")",
"\n",
"}"
] |
11,475 | all-11476 | [
"Equivalent",
"to",
"HAProxy",
"show",
"stat",
"command",
"."
] | [
"func",
"(",
"h",
"*",
"HAProxyClient",
")",
"Stats",
"(",
")",
"(",
"stats",
"[",
"]",
"*",
"Stat",
",",
"err",
"error",
")",
"{",
"res",
",",
"err",
":=",
"h",
".",
"RunCommand",
"(",
"\"",
"\"",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"reader",
":=",
"csv",
".",
"NewReader",
"(",
"res",
")",
"\n",
"<mask>",
".",
"TrailingComma",
"=",
"true",
"\n",
"err",
"=",
"gocsv",
".",
"UnmarshalCSV",
"(",
"reader",
",",
"&",
"stats",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"}",
"\n\n",
"//\tfor _, s := range allStats {",
"//\t\tswitch s.SvName {",
"//\t\tcase \"FRONTEND\":",
"//\t\t\tservices.Frontends = append(services.Frontends, s)",
"//\t\tcase \"BACKEND\":",
"//\t\t\tservices.Backends = append(services.Backends, s)",
"//\t\tdefault:",
"//\t\t\tservices.Listeners = append(services.Listeners, s)",
"//\t\t}",
"//\t}",
"return",
"stats",
",",
"nil",
"\n",
"}"
] |
11,476 | all-11477 | [
"WithAccessorPropertiesOnly",
"if",
"true",
"returns",
"accessor",
"properties",
"(",
"with",
"getter",
"/",
"setter",
")",
"only",
";",
"internal",
"properties",
"are",
"not",
"returned",
"either",
"."
] | [
"func",
"(",
"p",
"GetPropertiesParams",
")",
"WithAccessorPropertiesOnly",
"(",
"accessorPropertiesOnly",
"bool",
")",
"*",
"GetPropertiesParams",
"{",
"p",
".",
"AccessorPropertiesOnly",
"=",
"accessorPropertiesOnly",
"\n",
"<mask>",
"&",
"p",
"\n",
"}"
] |
11,477 | all-11478 | [
"ValidEnum",
"validates",
"a",
"proposed",
"value",
"for",
"this",
"enum",
".",
"Implements",
"the",
"Enum",
"interface",
"for",
"TransactionResultCode"
] | [
"func",
"(",
"e",
"TransactionResultCode",
")",
"ValidEnum",
"(",
"v",
"int32",
")",
"bool",
"{",
"_",
",",
"<mask>",
":=",
"transactionResultCodeMap",
"[",
"v",
"]",
"\n",
"return",
"ok",
"\n",
"}"
] |
11,478 | all-11479 | [
"SetMemorySize",
"sets",
"memory",
"size",
"in",
"megabytes",
".",
"VM",
"has",
"to",
"be",
"powered",
"off",
"in",
"order",
"to",
"change",
"this",
"parameter",
"."
] | [
"func",
"(",
"v",
"*",
"VM",
")",
"SetMemorySize",
"(",
"<mask>",
"uint",
")",
"error",
"{",
"if",
"size",
"==",
"0",
"{",
"size",
"=",
"4",
"\n",
"}",
"\n\n",
"// Makes sure memory size is divisible by 4, otherwise VMware is going to",
"// silently fail, cancelling vix operations.",
"if",
"size",
"%",
"4",
"!=",
"0",
"{",
"size",
"=",
"uint",
"(",
"math",
".",
"Floor",
"(",
"float64",
"(",
"(",
"size",
"/",
"4",
")",
"*",
"4",
")",
")",
")",
"\n",
"}",
"\n\n",
"return",
"v",
".",
"updateVMX",
"(",
"func",
"(",
"model",
"*",
"vmx",
".",
"VirtualMachine",
")",
"error",
"{",
"model",
".",
"Memsize",
"=",
"size",
"\n",
"return",
"nil",
"\n",
"}",
")",
"\n",
"}"
] |
11,479 | all-11480 | [
"Init",
"mocks",
"base",
"method"
] | [
"func",
"(",
"m",
"*",
"MockTaskEngine",
")",
"Init",
"(",
"arg0",
"context",
".",
"<mask>",
")",
"error",
"{",
"ret",
":=",
"m",
".",
"ctrl",
".",
"Call",
"(",
"m",
",",
"\"",
"\"",
",",
"arg0",
")",
"\n",
"ret0",
",",
"_",
":=",
"ret",
"[",
"0",
"]",
".",
"(",
"error",
")",
"\n",
"return",
"ret0",
"\n",
"}"
] |
11,480 | all-11481 | [
"Bytes",
"returns",
"the",
"bytes",
"in",
"teh",
"template",
"file"
] | [
"func",
"(",
"s",
"*",
"FileSource",
")",
"Bytes",
"(",
")",
"(",
"[",
"]",
"<mask>",
",",
"error",
")",
"{",
"rdr",
",",
"err",
":=",
"s",
".",
"Reader",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"return",
"ioutil",
".",
"ReadAll",
"(",
"rdr",
")",
"\n",
"}"
] |
11,481 | all-11482 | [
"Kruskal",
"finds",
"the",
"minimum",
"spanning",
"tree",
"with",
"disjoint",
"-",
"set",
"data",
"structure",
".",
"(",
"http",
":",
"//",
"en",
".",
"wikipedia",
".",
"org",
"/",
"wiki",
"/",
"Kruskal%27s_algorithm",
")",
"0",
".",
"Kruskal",
"(",
"G",
")",
"1",
".",
"2",
".",
"A",
"=",
"∅",
"3",
".",
"4",
".",
"for",
"each",
"vertex",
"v",
"in",
"G",
":",
"5",
".",
"MakeDisjointSet",
"(",
"v",
")",
"6",
".",
"7",
".",
"edges",
"=",
"get",
"all",
"edges",
"8",
".",
"sort",
"edges",
"in",
"ascending",
"order",
"of",
"weight",
"9",
".",
"10",
".",
"for",
"each",
"edge",
"(",
"u",
"v",
")",
"in",
"edges",
":",
"11",
".",
"if",
"FindSet",
"(",
"u",
")",
"≠",
"FindSet",
"(",
"v",
")",
":",
"12",
".",
"A",
"=",
"A",
"∪",
"{",
"(",
"u",
"v",
")",
"}",
"13",
".",
"Union",
"(",
"u",
"v",
")",
"14",
".",
"15",
".",
"return",
"A"
] | [
"func",
"Kruskal",
"(",
"g",
"Graph",
")",
"(",
"map",
"[",
"Edge",
"]",
"struct",
"{",
"}",
",",
"error",
")",
"{",
"// A = ∅",
"A",
":=",
"make",
"(",
"map",
"[",
"Edge",
"]",
"struct",
"{",
"}",
")",
"\n\n",
"// disjointSet maps a member Node to a represent.",
"// (https://en.wikipedia.org/wiki/Disjoint-set_data_structure)",
"forests",
":=",
"NewForests",
"(",
")",
"\n\n",
"// for each vertex v in G:",
"for",
"_",
",",
"nd",
":=",
"range",
"g",
".",
"GetNodes",
"(",
")",
"{",
"// MakeDisjointSet(v)",
"MakeDisjointSet",
"(",
"forests",
",",
"nd",
".",
"String",
"(",
")",
")",
"\n",
"}",
"\n\n",
"// edges = get all edges",
"edges",
":=",
"[",
"]",
"Edge",
"{",
"}",
"\n",
"foundEdge",
":=",
"make",
"(",
"map",
"[",
"string",
"]",
"struct",
"{",
"}",
")",
"\n",
"for",
"id1",
",",
"nd1",
":=",
"range",
"g",
".",
"GetNodes",
"(",
")",
"{",
"tm",
",",
"err",
":=",
"g",
".",
"GetTargets",
"(",
"id1",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"for",
"id2",
",",
"nd2",
":=",
"range",
"tm",
"{",
"weight",
",",
"err",
":=",
"g",
".",
"GetWeight",
"(",
"id1",
",",
"id2",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"edge",
":=",
"NewEdge",
"(",
"nd1",
",",
"nd2",
",",
"weight",
")",
"\n",
"if",
"_",
",",
"ok",
":=",
"foundEdge",
"[",
"edge",
".",
"String",
"(",
")",
"]",
";",
"!",
"ok",
"{",
"edges",
"=",
"append",
"(",
"edges",
",",
"edge",
")",
"\n",
"foundEdge",
"[",
"<mask>",
".",
"String",
"(",
")",
"]",
"=",
"struct",
"{",
"}",
"{",
"}",
"\n",
"}",
"\n",
"}",
"\n\n",
"sm",
",",
"err",
":=",
"g",
".",
"GetSources",
"(",
"id1",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"for",
"id3",
",",
"nd3",
":=",
"range",
"sm",
"{",
"weight",
",",
"err",
":=",
"g",
".",
"GetWeight",
"(",
"id3",
",",
"id1",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"edge",
":=",
"NewEdge",
"(",
"nd3",
",",
"nd1",
",",
"weight",
")",
"\n",
"if",
"_",
",",
"ok",
":=",
"foundEdge",
"[",
"edge",
".",
"String",
"(",
")",
"]",
";",
"!",
"ok",
"{",
"edges",
"=",
"append",
"(",
"edges",
",",
"edge",
")",
"\n",
"foundEdge",
"[",
"edge",
".",
"String",
"(",
")",
"]",
"=",
"struct",
"{",
"}",
"{",
"}",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n\n",
"// sort edges in ascending order of weight",
"sort",
".",
"Sort",
"(",
"EdgeSlice",
"(",
"edges",
")",
")",
"\n\n",
"// for each edge (u, v) in edges:",
"for",
"_",
",",
"edge",
":=",
"range",
"edges",
"{",
"// if FindSet(u) ≠ FindSet(v):",
"if",
"FindSet",
"(",
"forests",
",",
"edge",
".",
"Source",
"(",
")",
".",
"String",
"(",
")",
")",
".",
"represent",
"!=",
"FindSet",
"(",
"forests",
",",
"edge",
".",
"Target",
"(",
")",
".",
"String",
"(",
")",
")",
".",
"represent",
"{",
"// A = A ∪ {(u, v)}",
"A",
"[",
"edge",
"]",
"=",
"struct",
"{",
"}",
"{",
"}",
"\n\n",
"// Union(u, v)",
"// overwrite v's represent with u's represent",
"Union",
"(",
"forests",
",",
"FindSet",
"(",
"forests",
",",
"edge",
".",
"Source",
"(",
")",
".",
"String",
"(",
")",
")",
",",
"FindSet",
"(",
"forests",
",",
"edge",
".",
"Target",
"(",
")",
".",
"String",
"(",
")",
")",
")",
"\n",
"}",
"\n",
"}",
"\n\n",
"return",
"A",
",",
"nil",
"\n",
"}"
] |
11,482 | all-11483 | [
"GetTextAlign",
"returns",
"the",
"TextAlign",
"field",
"if",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"."
] | [
"func",
"(",
"t",
"*",
"TileDef",
")",
"GetTextAlign",
"(",
")",
"string",
"{",
"if",
"t",
"==",
"nil",
"||",
"t",
".",
"TextAlign",
"==",
"nil",
"{",
"return",
"\"",
"\"",
"\n",
"}",
"\n",
"<mask>",
"*",
"t",
".",
"TextAlign",
"\n",
"}"
] |
11,483 | all-11484 | [
"NewClient",
"creates",
"a",
"new",
"client",
"from",
"a",
"boskosClient",
"interface"
] | [
"func",
"NewClient",
"(",
"boskosClient",
"boskosClient",
")",
"*",
"Client",
"{",
"return",
"&",
"<mask>",
"{",
"basic",
":",
"boskosClient",
",",
"resources",
":",
"map",
"[",
"string",
"]",
"common",
".",
"Resource",
"{",
"}",
",",
"}",
"\n",
"}"
] |
11,484 | all-11485 | [
"ParseConfig",
"reads",
"in",
"configPath",
"and",
"returns",
"a",
"list",
"of",
"resource",
"objects",
"on",
"success",
"."
] | [
"func",
"ParseConfig",
"(",
"configPath",
"string",
")",
"(",
"[",
"]",
"common",
".",
"Resource",
",",
"error",
")",
"{",
"file",
",",
"err",
":=",
"ioutil",
".",
"ReadFile",
"(",
"configPath",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"var",
"data",
"common",
".",
"BoskosConfig",
"\n",
"err",
"=",
"yaml",
".",
"Unmarshal",
"(",
"file",
",",
"&",
"data",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"var",
"resources",
"[",
"]",
"common",
".",
"Resource",
"\n",
"for",
"_",
",",
"entry",
":=",
"range",
"data",
".",
"Resources",
"{",
"resources",
"=",
"append",
"(",
"resources",
",",
"common",
".",
"NewResourcesFromConfig",
"(",
"<mask>",
")",
"...",
")",
"\n",
"}",
"\n",
"return",
"resources",
",",
"nil",
"\n",
"}"
] |
11,485 | all-11486 | [
"Reset",
"a",
"routing",
"context",
"to",
"its",
"initial",
"state",
"."
] | [
"func",
"(",
"x",
"*",
"<mask>",
")",
"Reset",
"(",
")",
"{",
"x",
".",
"Routes",
"=",
"nil",
"\n",
"x",
".",
"RoutePath",
"=",
"\"",
"\"",
"\n",
"x",
".",
"RouteMethod",
"=",
"\"",
"\"",
"\n",
"x",
".",
"RoutePatterns",
"=",
"x",
".",
"RoutePatterns",
"[",
":",
"0",
"]",
"\n",
"x",
".",
"URLParams",
".",
"Keys",
"=",
"x",
".",
"URLParams",
".",
"Keys",
"[",
":",
"0",
"]",
"\n",
"x",
".",
"URLParams",
".",
"Values",
"=",
"x",
".",
"URLParams",
".",
"Values",
"[",
":",
"0",
"]",
"\n\n",
"x",
".",
"routePattern",
"=",
"\"",
"\"",
"\n",
"x",
".",
"routeParams",
".",
"Keys",
"=",
"x",
".",
"routeParams",
".",
"Keys",
"[",
":",
"0",
"]",
"\n",
"x",
".",
"routeParams",
".",
"Values",
"=",
"x",
".",
"routeParams",
".",
"Values",
"[",
":",
"0",
"]",
"\n",
"x",
".",
"methodNotAllowed",
"=",
"false",
"\n",
"}"
] |
11,486 | all-11487 | [
"NewContext",
"creates",
"a",
"new",
"audio",
"context",
"with",
"the",
"given",
"sample",
"rate",
".",
"The",
"sample",
"rate",
"is",
"also",
"used",
"for",
"decoding",
"MP3",
"with",
"audio",
"/",
"mp3",
"package",
"or",
"other",
"formats",
"as",
"the",
"target",
"sample",
"rate",
".",
"sampleRate",
"should",
"be",
"44100",
"or",
"48000",
".",
"Other",
"values",
"might",
"not",
"work",
".",
"For",
"example",
"22050",
"causes",
"error",
"on",
"Safari",
"when",
"decoding",
"MP3",
".",
"Error",
"returned",
"by",
"NewContext",
"is",
"always",
"nil",
"as",
"of",
"1",
".",
"5",
".",
"0",
"-",
"alpha",
".",
"NewContext",
"panics",
"when",
"an",
"audio",
"context",
"is",
"already",
"created",
"."
] | [
"func",
"NewContext",
"(",
"sampleRate",
"int",
")",
"(",
"*",
"Context",
",",
"error",
")",
"{",
"theContextLock",
".",
"Lock",
"(",
")",
"\n",
"defer",
"theContextLock",
".",
"Unlock",
"(",
")",
"\n",
"if",
"theContext",
"!=",
"nil",
"{",
"panic",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"c",
":=",
"&",
"Context",
"{",
"sampleRate",
":",
"sampleRate",
",",
"c",
":",
"newContext",
"(",
"sampleRate",
")",
",",
"players",
":",
"map",
"[",
"*",
"playerImpl",
"]",
"struct",
"{",
"}",
"{",
"}",
",",
"inited",
":",
"make",
"(",
"chan",
"struct",
"{",
"}",
")",
",",
"}",
"\n",
"theContext",
"=",
"c",
"\n\n",
"h",
":=",
"getHook",
"(",
")",
"\n",
"h",
".",
"OnSuspendAudio",
"(",
"func",
"(",
")",
"{",
"c",
".",
"m",
".",
"Lock",
"(",
")",
"\n",
"c",
".",
"suspended",
"=",
"true",
"\n",
"c",
".",
"m",
".",
"Unlock",
"(",
")",
"\n",
"}",
")",
"\n",
"h",
".",
"OnResumeAudio",
"(",
"func",
"(",
")",
"{",
"c",
".",
"m",
".",
"Lock",
"(",
")",
"\n",
"c",
".",
"suspended",
"=",
"false",
"\n",
"c",
".",
"m",
".",
"Unlock",
"(",
")",
"\n",
"}",
")",
"\n\n",
"h",
".",
"AppendHookOnBeforeUpdate",
"(",
"func",
"(",
")",
"error",
"{",
"c",
".",
"initedOnce",
".",
"Do",
"(",
"func",
"(",
")",
"{",
"close",
"(",
"c",
".",
"inited",
")",
"\n",
"}",
")",
"\n\n",
"<mask>",
"err",
"error",
"\n",
"theContextLock",
".",
"Lock",
"(",
")",
"\n",
"if",
"theContext",
"!=",
"nil",
"{",
"theContext",
".",
"m",
".",
"Lock",
"(",
")",
"\n",
"err",
"=",
"theContext",
".",
"err",
"\n",
"theContext",
".",
"m",
".",
"Unlock",
"(",
")",
"\n",
"}",
"\n",
"theContextLock",
".",
"Unlock",
"(",
")",
"\n",
"return",
"err",
"\n",
"}",
")",
"\n\n",
"return",
"c",
",",
"nil",
"\n",
"}"
] |
11,487 | all-11488 | [
"Clone",
"returns",
"a",
"member",
"with",
"the",
"same",
"server",
"configuration",
".",
"The",
"returned",
"member",
"will",
"not",
"set",
"PeerListeners",
"and",
"ClientListeners",
"."
] | [
"func",
"(",
"m",
"*",
"member",
")",
"Clone",
"(",
"t",
"testing",
".",
"TB",
")",
"*",
"member",
"{",
"mm",
":=",
"&",
"member",
"{",
"}",
"\n",
"mm",
".",
"ServerConfig",
"=",
"m",
".",
"ServerConfig",
"\n\n",
"var",
"err",
"error",
"\n",
"clientURLStrs",
":=",
"m",
".",
"ClientURLs",
".",
"StringSlice",
"(",
")",
"\n",
"mm",
".",
"ClientURLs",
",",
"err",
"=",
"types",
".",
"NewURLs",
"(",
"clientURLStrs",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"// this should never fail",
"panic",
"(",
"err",
")",
"\n",
"}",
"\n",
"peerURLStrs",
":=",
"m",
".",
"PeerURLs",
".",
"StringSlice",
"(",
")",
"\n",
"mm",
".",
"PeerURLs",
",",
"err",
"=",
"types",
".",
"NewURLs",
"(",
"peerURLStrs",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"// this should never fail",
"panic",
"(",
"err",
")",
"\n",
"}",
"\n",
"clusterStr",
":=",
"m",
".",
"InitialPeerURLsMap",
".",
"String",
"(",
")",
"\n",
"mm",
".",
"InitialPeerURLsMap",
",",
"err",
"=",
"types",
".",
"NewURLsMap",
"(",
"clusterStr",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"// this should never fail",
"panic",
"(",
"err",
")",
"\n",
"}",
"\n",
"mm",
".",
"InitialClusterToken",
"=",
"m",
".",
"InitialClusterToken",
"\n",
"mm",
".",
"ElectionTicks",
"=",
"m",
".",
"ElectionTicks",
"\n",
"<mask>",
".",
"PeerTLSInfo",
"=",
"m",
".",
"PeerTLSInfo",
"\n",
"mm",
".",
"ClientTLSInfo",
"=",
"m",
".",
"ClientTLSInfo",
"\n",
"return",
"mm",
"\n",
"}"
] |
11,488 | all-11489 | [
"Doubles",
"are",
"saved",
"as",
"strings",
"prefixed",
"by",
"an",
"unsigned",
"8",
"bit",
"integer",
"specifying",
"the",
"length",
"of",
"the",
"representation",
".",
"This",
"8",
"bit",
"integer",
"has",
"special",
"values",
"in",
"order",
"to",
"specify",
"the",
"following",
"conditions",
":",
"253",
":",
"not",
"a",
"number",
"254",
":",
"+",
"inf",
"255",
":",
"-",
"inf"
] | [
"func",
"(",
"d",
"*",
"decode",
")",
"readFloat64",
"(",
")",
"(",
"float64",
",",
"error",
")",
"{",
"length",
",",
"err",
":=",
"d",
".",
"readUint8",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"0",
",",
"err",
"\n",
"}",
"\n",
"switch",
"length",
"{",
"case",
"253",
":",
"return",
"math",
".",
"NaN",
"(",
")",
",",
"nil",
"\n",
"case",
"254",
":",
"return",
"math",
".",
"Inf",
"(",
"0",
")",
",",
"nil",
"\n",
"case",
"255",
":",
"return",
"math",
".",
"Inf",
"(",
"-",
"1",
")",
",",
"nil",
"\n",
"default",
":",
"floatBytes",
":=",
"make",
"(",
"[",
"]",
"byte",
",",
"length",
")",
"\n",
"_",
",",
"err",
":=",
"<mask>",
".",
"ReadFull",
"(",
"d",
".",
"r",
",",
"floatBytes",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"0",
",",
"err",
"\n",
"}",
"\n",
"f",
",",
"err",
":=",
"strconv",
".",
"ParseFloat",
"(",
"string",
"(",
"floatBytes",
")",
",",
"64",
")",
"\n",
"return",
"f",
",",
"err",
"\n",
"}",
"\n\n",
"panic",
"(",
"\"",
"\"",
")",
"\n",
"}"
] |
11,489 | all-11490 | [
"retrieve",
"a",
"sub",
"-",
"region",
"of",
"a",
"texture",
"image",
"from",
"a",
"texture",
"object"
] | [
"func",
"GetTextureSubImage",
"(",
"texture",
"uint32",
",",
"level",
"int32",
",",
"xoffset",
"int32",
",",
"yoffset",
"int32",
",",
"zoffset",
"int32",
",",
"width",
"int32",
",",
"height",
"int32",
",",
"depth",
"int32",
",",
"format",
"uint32",
",",
"xtype",
"uint32",
",",
"bufSize",
"int32",
",",
"pixels",
"unsafe",
".",
"Pointer",
")",
"{",
"C",
".",
"glowGetTextureSubImage",
"(",
"gpGetTextureSubImage",
",",
"(",
"C",
".",
"GLuint",
")",
"(",
"texture",
")",
",",
"(",
"C",
".",
"GLint",
")",
"(",
"level",
")",
",",
"(",
"C",
".",
"GLint",
")",
"(",
"xoffset",
")",
",",
"(",
"C",
".",
"GLint",
")",
"(",
"yoffset",
")",
",",
"(",
"C",
".",
"GLint",
")",
"(",
"zoffset",
")",
",",
"(",
"C",
".",
"GLsizei",
")",
"(",
"<mask>",
")",
",",
"(",
"C",
".",
"GLsizei",
")",
"(",
"height",
")",
",",
"(",
"C",
".",
"GLsizei",
")",
"(",
"depth",
")",
",",
"(",
"C",
".",
"GLenum",
")",
"(",
"format",
")",
",",
"(",
"C",
".",
"GLenum",
")",
"(",
"xtype",
")",
",",
"(",
"C",
".",
"GLsizei",
")",
"(",
"bufSize",
")",
",",
"pixels",
")",
"\n",
"}"
] |
11,490 | all-11491 | [
"Specify",
"the",
"value",
"of",
"a",
"uniform",
"variable",
"for",
"the",
"current",
"program",
"object"
] | [
"func",
"Uniform1iv",
"(",
"location",
"int32",
",",
"count",
"int32",
",",
"<mask>",
"*",
"int32",
")",
"{",
"C",
".",
"glowUniform1iv",
"(",
"gpUniform1iv",
",",
"(",
"C",
".",
"GLint",
")",
"(",
"location",
")",
",",
"(",
"C",
".",
"GLsizei",
")",
"(",
"count",
")",
",",
"(",
"*",
"C",
".",
"GLint",
")",
"(",
"unsafe",
".",
"Pointer",
"(",
"value",
")",
")",
")",
"\n",
"}"
] |
11,491 | all-11492 | [
"dockerStatsToContainerStats",
"returns",
"a",
"new",
"object",
"of",
"the",
"ContainerStats",
"object",
"from",
"docker",
"stats",
"."
] | [
"func",
"dockerStatsToContainerStats",
"(",
"dockerStats",
"*",
"<mask>",
".",
"StatsJSON",
")",
"(",
"*",
"ContainerStats",
",",
"error",
")",
"{",
"if",
"numCores",
"==",
"uint64",
"(",
"0",
")",
"{",
"seelog",
".",
"Error",
"(",
"\"",
"\"",
")",
"\n",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"cpuUsage",
":=",
"(",
"dockerStats",
".",
"CPUStats",
".",
"CPUUsage",
".",
"TotalUsage",
"*",
"100",
")",
"/",
"numCores",
"\n",
"memoryUsage",
":=",
"dockerStats",
".",
"MemoryStats",
".",
"PrivateWorkingSet",
"\n",
"return",
"&",
"ContainerStats",
"{",
"cpuUsage",
":",
"cpuUsage",
",",
"memoryUsage",
":",
"memoryUsage",
",",
"timestamp",
":",
"dockerStats",
".",
"Read",
",",
"}",
",",
"nil",
"\n",
"}"
] |
11,492 | all-11493 | [
"GetGUISettings",
"returns",
"gui",
"settings",
"."
] | [
"func",
"(",
"h",
"*",
"Handler",
")",
"GetGUISettings",
"(",
"tkn",
"string",
")",
"(",
"map",
"[",
"string",
"]",
"interface",
"{",
"}",
",",
"error",
")",
"{",
"logger",
":=",
"h",
".",
"logger",
".",
"Add",
"(",
"\"",
"\"",
",",
"\"",
"\"",
")",
"\n\n",
"if",
"!",
"h",
".",
"token",
".",
"Check",
"(",
"tkn",
")",
"{",
"logger",
".",
"Warn",
"(",
"\"",
"\"",
")",
"\n",
"return",
"nil",
",",
"ErrAccessDenied",
"\n",
"}",
"\n\n",
"retStr",
",",
"err",
":=",
"data",
".",
"ReadSetting",
"(",
"h",
".",
"db",
".",
"Querier",
",",
"data",
".",
"SettingGUI",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"logger",
".",
"Error",
"(",
"err",
".",
"Error",
"(",
")",
")",
"\n",
"return",
"nil",
",",
"ErrInternal",
"\n",
"}",
"\n\n",
"ret",
":=",
"<mask>",
"(",
"map",
"[",
"string",
"]",
"interface",
"{",
"}",
")",
"\n\n",
"err",
"=",
"json",
".",
"Unmarshal",
"(",
"[",
"]",
"byte",
"(",
"retStr",
")",
",",
"&",
"ret",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"logger",
".",
"Error",
"(",
"err",
".",
"Error",
"(",
")",
")",
"\n",
"return",
"nil",
",",
"ErrInternal",
"\n",
"}",
"\n\n",
"return",
"ret",
",",
"nil",
"\n",
"}"
] |
11,493 | all-11494 | [
"arg2Reader",
"returns",
"an",
"ArgReader",
"to",
"read",
"arg2",
"."
] | [
"func",
"(",
"r",
"*",
"reqResReader",
")",
"arg2Reader",
"(",
")",
"(",
"ArgReader",
",",
"error",
")",
"{",
"return",
"r",
".",
"argReader",
"(",
"<mask>",
"/* last */",
",",
"reqResReaderPreArg2",
",",
"reqResReaderPreArg3",
")",
"\n",
"}"
] |
11,494 | all-11495 | [
"Stats",
"returns",
"statistics",
"for",
"the",
"server",
"."
] | [
"func",
"(",
"s",
"*",
"<mask>",
")",
"Stats",
"(",
")",
"ServerStats",
"{",
"s",
".",
"mu",
".",
"Lock",
"(",
")",
"\n",
"defer",
"s",
".",
"mu",
".",
"Unlock",
"(",
")",
"\n",
"ss",
":=",
"s",
".",
"stats",
"\n",
"ss",
".",
"GoodNodes",
"=",
"s",
".",
"numGoodNodes",
"(",
")",
"\n",
"ss",
".",
"Nodes",
"=",
"s",
".",
"numNodes",
"(",
")",
"\n",
"ss",
".",
"OutstandingTransactions",
"=",
"len",
"(",
"s",
".",
"transactions",
")",
"\n",
"return",
"ss",
"\n",
"}"
] |
11,495 | all-11496 | [
"NewTaskResponse",
"creates",
"a",
"TaskResponse",
"for",
"a",
"task",
"."
] | [
"func",
"NewTaskResponse",
"(",
"task",
"*",
"apitask",
".",
"Task",
",",
"containerMap",
"map",
"[",
"string",
"]",
"*",
"apicontainer",
".",
"DockerContainer",
")",
"*",
"TaskResponse",
"{",
"containers",
":=",
"[",
"]",
"ContainerResponse",
"{",
"}",
"\n",
"for",
"_",
",",
"container",
":=",
"<mask>",
"containerMap",
"{",
"if",
"container",
".",
"Container",
".",
"IsInternal",
"(",
")",
"{",
"continue",
"\n",
"}",
"\n",
"containerResponse",
":=",
"NewContainerResponse",
"(",
"container",
",",
"task",
".",
"GetTaskENI",
"(",
")",
")",
"\n",
"containers",
"=",
"append",
"(",
"containers",
",",
"containerResponse",
")",
"\n",
"}",
"\n\n",
"knownStatus",
":=",
"task",
".",
"GetKnownStatus",
"(",
")",
"\n",
"knownBackendStatus",
":=",
"knownStatus",
".",
"BackendStatus",
"(",
")",
"\n",
"desiredStatusInAgent",
":=",
"task",
".",
"GetDesiredStatus",
"(",
")",
"\n",
"desiredStatus",
":=",
"desiredStatusInAgent",
".",
"BackendStatus",
"(",
")",
"\n\n",
"if",
"(",
"knownBackendStatus",
"==",
"\"",
"\"",
"&&",
"desiredStatus",
"!=",
"\"",
"\"",
")",
"||",
"(",
"knownBackendStatus",
"==",
"\"",
"\"",
"&&",
"desiredStatus",
"==",
"\"",
"\"",
")",
"{",
"desiredStatus",
"=",
"\"",
"\"",
"\n",
"}",
"\n\n",
"return",
"&",
"TaskResponse",
"{",
"Arn",
":",
"task",
".",
"Arn",
",",
"DesiredStatus",
":",
"desiredStatus",
",",
"KnownStatus",
":",
"knownBackendStatus",
",",
"Family",
":",
"task",
".",
"Family",
",",
"Version",
":",
"task",
".",
"Version",
",",
"Containers",
":",
"containers",
",",
"}",
"\n",
"}"
] |
11,496 | all-11497 | [
"RemoveColumn",
"is",
"a",
"wrapper",
"around",
"gtk_tree_view_remove_column",
"()",
"."
] | [
"func",
"(",
"v",
"*",
"TreeView",
")",
"RemoveColumn",
"(",
"<mask>",
"*",
"TreeViewColumn",
")",
"int",
"{",
"return",
"int",
"(",
"C",
".",
"gtk_tree_view_remove_column",
"(",
"v",
".",
"native",
"(",
")",
",",
"column",
".",
"native",
"(",
")",
")",
")",
"\n",
"}"
] |
11,497 | all-11498 | [
"getTargetsFromTargetAnnotation",
"gets",
"endpoints",
"from",
"optional",
"target",
"annotation",
".",
"Returns",
"empty",
"endpoints",
"array",
"if",
"none",
"are",
"found",
"."
] | [
"func",
"getTargetsFromTargetAnnotation",
"(",
"annotations",
"map",
"[",
"string",
"]",
"string",
")",
"endpoint",
".",
"Targets",
"{",
"<mask>",
"targets",
"endpoint",
".",
"Targets",
"\n\n",
"// Get the desired hostname of the ingress from the annotation.",
"targetAnnotation",
",",
"exists",
":=",
"annotations",
"[",
"targetAnnotationKey",
"]",
"\n",
"if",
"exists",
"&&",
"targetAnnotation",
"!=",
"\"",
"\"",
"{",
"// splits the hostname annotation and removes the trailing periods",
"targetsList",
":=",
"strings",
".",
"Split",
"(",
"strings",
".",
"Replace",
"(",
"targetAnnotation",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"-",
"1",
")",
",",
"\"",
"\"",
")",
"\n",
"for",
"_",
",",
"targetHostname",
":=",
"range",
"targetsList",
"{",
"targetHostname",
"=",
"strings",
".",
"TrimSuffix",
"(",
"targetHostname",
",",
"\"",
"\"",
")",
"\n",
"targets",
"=",
"append",
"(",
"targets",
",",
"targetHostname",
")",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"targets",
"\n",
"}"
] |
11,498 | all-11499 | [
"StartServe",
"starts",
"serving",
"agent",
"server",
"."
] | [
"func",
"(",
"srv",
"*",
"Server",
")",
"StartServe",
"(",
")",
"error",
"{",
"var",
"err",
"error",
"\n",
"srv",
".",
"ln",
",",
"err",
"=",
"net",
".",
"Listen",
"(",
"srv",
".",
"network",
",",
"srv",
".",
"address",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"var",
"opts",
"[",
"]",
"grpc",
".",
"ServerOption",
"\n",
"opts",
"=",
"append",
"(",
"opts",
",",
"grpc",
".",
"MaxRecvMsgSize",
"(",
"int",
"(",
"maxRequestBytes",
"+",
"grpcOverheadBytes",
")",
")",
")",
"\n",
"opts",
"=",
"append",
"(",
"opts",
",",
"grpc",
".",
"MaxSendMsgSize",
"(",
"maxSendBytes",
")",
")",
"\n",
"opts",
"=",
"append",
"(",
"opts",
",",
"grpc",
".",
"MaxConcurrentStreams",
"(",
"maxStreams",
")",
")",
"\n",
"srv",
".",
"grpcServer",
"=",
"grpc",
".",
"NewServer",
"(",
"opts",
"...",
")",
"\n\n",
"rpcpb",
".",
"RegisterTransportServer",
"(",
"srv",
".",
"grpcServer",
",",
"srv",
")",
"\n\n",
"srv",
".",
"lg",
".",
"Info",
"(",
"\"",
"\"",
",",
"zap",
".",
"String",
"(",
"\"",
"\"",
",",
"srv",
".",
"address",
")",
",",
"zap",
".",
"String",
"(",
"\"",
"\"",
",",
"srv",
".",
"ln",
".",
"Addr",
"(",
")",
".",
"String",
"(",
")",
")",
",",
")",
"\n",
"err",
"=",
"srv",
".",
"grpcServer",
".",
"Serve",
"(",
"srv",
".",
"ln",
")",
"\n",
"if",
"err",
"!=",
"nil",
"&&",
"strings",
".",
"Contains",
"(",
"err",
".",
"Error",
"(",
")",
",",
"\"",
"\"",
")",
"{",
"srv",
".",
"lg",
".",
"Info",
"(",
"\"",
"\"",
",",
"zap",
".",
"String",
"(",
"\"",
"\"",
",",
"srv",
".",
"address",
")",
",",
"zap",
".",
"Error",
"(",
"err",
")",
",",
")",
"\n",
"}",
"else",
"{",
"srv",
".",
"lg",
".",
"Warn",
"(",
"\"",
"\"",
",",
"zap",
".",
"String",
"(",
"\"",
"\"",
",",
"srv",
".",
"<mask>",
")",
",",
"zap",
".",
"Error",
"(",
"err",
")",
",",
")",
"\n",
"}",
"\n",
"return",
"err",
"\n",
"}"
] |
11,499 | all-11500 | [
"Run",
"starts",
"the",
"port",
"forwarder",
".",
"Returns",
"after",
"initialization",
"is",
"begun",
"returning",
"any",
"initialization",
"errors",
"."
] | [
"func",
"(",
"f",
"*",
"PortForwarder",
")",
"Run",
"(",
"appName",
"string",
",",
"localPort",
",",
"remotePort",
"uint16",
")",
"error",
"{",
"podNameSelector",
":=",
"<mask>",
"[",
"string",
"]",
"string",
"{",
"\"",
"\"",
":",
"\"",
"\"",
",",
"\"",
"\"",
":",
"appName",
",",
"}",
"\n\n",
"podList",
",",
"err",
":=",
"f",
".",
"core",
".",
"Pods",
"(",
"f",
".",
"namespace",
")",
".",
"List",
"(",
"metav1",
".",
"ListOptions",
"{",
"LabelSelector",
":",
"metav1",
".",
"FormatLabelSelector",
"(",
"metav1",
".",
"SetAsLabelSelector",
"(",
"podNameSelector",
")",
")",
",",
"TypeMeta",
":",
"metav1",
".",
"TypeMeta",
"{",
"Kind",
":",
"\"",
"\"",
",",
"APIVersion",
":",
"\"",
"\"",
",",
"}",
",",
"}",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"if",
"len",
"(",
"podList",
".",
"Items",
")",
"==",
"0",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"appName",
")",
"\n",
"}",
"\n\n",
"// Choose a random pod",
"podName",
":=",
"podList",
".",
"Items",
"[",
"rand",
".",
"Intn",
"(",
"len",
"(",
"podList",
".",
"Items",
")",
")",
"]",
".",
"Name",
"\n\n",
"url",
":=",
"f",
".",
"client",
".",
"Post",
"(",
")",
".",
"Resource",
"(",
"\"",
"\"",
")",
".",
"Namespace",
"(",
"f",
".",
"namespace",
")",
".",
"Name",
"(",
"podName",
")",
".",
"SubResource",
"(",
"\"",
"\"",
")",
".",
"URL",
"(",
")",
"\n\n",
"transport",
",",
"upgrader",
",",
"err",
":=",
"spdy",
".",
"RoundTripperFor",
"(",
"f",
".",
"config",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"dialer",
":=",
"spdy",
".",
"NewDialer",
"(",
"upgrader",
",",
"&",
"http",
".",
"Client",
"{",
"Transport",
":",
"transport",
"}",
",",
"\"",
"\"",
",",
"url",
")",
"\n",
"ports",
":=",
"[",
"]",
"string",
"{",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"localPort",
",",
"remotePort",
")",
"}",
"\n",
"readyChan",
":=",
"make",
"(",
"chan",
"struct",
"{",
"}",
",",
"1",
")",
"\n",
"stopChan",
":=",
"make",
"(",
"chan",
"struct",
"{",
"}",
",",
"1",
")",
"\n\n",
"// Ensure that the port forwarder isn't already shutdown, and append the",
"// shutdown channel so this forwarder can be closed",
"f",
".",
"stopChansLock",
".",
"Lock",
"(",
")",
"\n",
"if",
"f",
".",
"shutdown",
"{",
"f",
".",
"stopChansLock",
".",
"Unlock",
"(",
")",
"\n",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"f",
".",
"stopChans",
"=",
"append",
"(",
"f",
".",
"stopChans",
",",
"stopChan",
")",
"\n",
"f",
".",
"stopChansLock",
".",
"Unlock",
"(",
")",
"\n\n",
"fw",
",",
"err",
":=",
"portforward",
".",
"New",
"(",
"dialer",
",",
"ports",
",",
"stopChan",
",",
"readyChan",
",",
"ioutil",
".",
"Discard",
",",
"f",
".",
"logger",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"errChan",
":=",
"make",
"(",
"chan",
"error",
",",
"1",
")",
"\n",
"go",
"func",
"(",
")",
"{",
"errChan",
"<-",
"fw",
".",
"ForwardPorts",
"(",
")",
"}",
"(",
")",
"\n\n",
"select",
"{",
"case",
"err",
"=",
"<-",
"errChan",
":",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"case",
"<-",
"fw",
".",
"Ready",
":",
"return",
"nil",
"\n",
"}",
"\n",
"}"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.