id
int32 0
25.3k
| idx
stringlengths 5
9
| nl_tokens
sequencelengths 1
418
| pl_tokens
sequencelengths 22
4.98k
|
---|---|---|---|
10,400 | all-10401 | [
"IsType",
"reports",
"whether",
"the",
"reflect",
".",
"Type",
"is",
"of",
"the",
"specified",
"function",
"type",
"."
] | [
"func",
"IsType",
"(",
"t",
"reflect",
".",
"Type",
",",
"ft",
"funcType",
")",
"bool",
"{",
"if",
"t",
"==",
"nil",
"||",
"t",
".",
"Kind",
"(",
")",
"!=",
"reflect",
".",
"Func",
"||",
"t",
".",
"IsVariadic",
"(",
")",
"{",
"return",
"false",
"\n",
"}",
"\n",
"ni",
",",
"no",
":=",
"t",
".",
"NumIn",
"(",
")",
",",
"t",
".",
"NumOut",
"(",
")",
"\n",
"switch",
"ft",
"{",
"case",
"tbFunc",
":",
"// func(T) bool",
"if",
"ni",
"==",
"1",
"&&",
"<mask>",
"==",
"1",
"&&",
"t",
".",
"Out",
"(",
"0",
")",
"==",
"boolType",
"{",
"return",
"true",
"\n",
"}",
"\n",
"case",
"ttbFunc",
":",
"// func(T, T) bool",
"if",
"ni",
"==",
"2",
"&&",
"no",
"==",
"1",
"&&",
"t",
".",
"In",
"(",
"0",
")",
"==",
"t",
".",
"In",
"(",
"1",
")",
"&&",
"t",
".",
"Out",
"(",
"0",
")",
"==",
"boolType",
"{",
"return",
"true",
"\n",
"}",
"\n",
"case",
"trbFunc",
":",
"// func(T, R) bool",
"if",
"ni",
"==",
"2",
"&&",
"no",
"==",
"1",
"&&",
"t",
".",
"Out",
"(",
"0",
")",
"==",
"boolType",
"{",
"return",
"true",
"\n",
"}",
"\n",
"case",
"tibFunc",
":",
"// func(T, I) bool",
"if",
"ni",
"==",
"2",
"&&",
"no",
"==",
"1",
"&&",
"t",
".",
"In",
"(",
"0",
")",
".",
"AssignableTo",
"(",
"t",
".",
"In",
"(",
"1",
")",
")",
"&&",
"t",
".",
"Out",
"(",
"0",
")",
"==",
"boolType",
"{",
"return",
"true",
"\n",
"}",
"\n",
"case",
"trFunc",
":",
"// func(T) R",
"if",
"ni",
"==",
"1",
"&&",
"no",
"==",
"1",
"{",
"return",
"true",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"false",
"\n",
"}"
] |
10,401 | all-10402 | [
"GetIpv4",
"retrieves",
"the",
"Ipv4",
"value",
"from",
"the",
"union",
"returning",
"ok",
"if",
"the",
"union",
"s",
"switch",
"indicated",
"the",
"value",
"is",
"valid",
"."
] | [
"func",
"(",
"u",
"PeerAddressIp",
")",
"GetIpv4",
"(",
")",
"(",
"result",
"[",
"4",
"]",
"byte",
",",
"ok",
"bool",
")",
"{",
"armName",
",",
"_",
":=",
"u",
".",
"ArmForSwitch",
"(",
"int32",
"(",
"u",
".",
"<mask>",
")",
")",
"\n\n",
"if",
"armName",
"==",
"\"",
"\"",
"{",
"result",
"=",
"*",
"u",
".",
"Ipv4",
"\n",
"ok",
"=",
"true",
"\n",
"}",
"\n\n",
"return",
"\n",
"}"
] |
10,402 | all-10403 | [
"SetProductConfig",
"sets",
"product",
"configuration",
"."
] | [
"func",
"(",
"h",
"*",
"Handler",
")",
"SetProductConfig",
"(",
"product",
",",
"productPassword",
"string",
",",
"config",
"map",
"[",
"string",
"]",
"string",
")",
"error",
"{",
"logger",
":=",
"h",
".",
"logger",
".",
"Add",
"(",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"product",
",",
"\"",
"\"",
",",
"config",
")",
"\n\n",
"logger",
".",
"Info",
"(",
"\"",
"\"",
")",
"\n\n",
"prod",
",",
"err",
":=",
"h",
".",
"checkProductPassword",
"(",
"logger",
",",
"product",
",",
"productPassword",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"if",
"len",
"(",
"config",
")",
"==",
"0",
"{",
"logger",
".",
"Warn",
"(",
"ErrBadProductConfig",
".",
"Error",
"(",
")",
")",
"\n",
"return",
"ErrBadProductConfig",
"\n",
"}",
"\n\n",
"prod",
".",
"ServiceEndpointAddress",
"=",
"serviceEndpointAddress",
"(",
"prod",
",",
"config",
")",
"\n",
"delete",
"(",
"config",
",",
"ProductExternalIP",
")",
"\n\n",
"if",
"prod",
".",
"ServiceEndpointAddress",
"!=",
"nil",
"{",
"country2",
":=",
"h",
".",
"findCountry",
"(",
"logger",
",",
"*",
"prod",
".",
"ServiceEndpointAddress",
")",
"\n",
"if",
"len",
"(",
"country2",
")",
"!=",
"2",
"{",
"country2",
"=",
"country",
".",
"UndefinedCountry",
"\n",
"}",
"\n",
"prod",
".",
"Country",
"=",
"&",
"country2",
"\n",
"}",
"\n\n",
"if",
"prod",
".",
"Config",
",",
"err",
"=",
"json",
".",
"Marshal",
"(",
"config",
")",
";",
"err",
"!=",
"nil",
"{",
"logger",
".",
"<mask>",
"(",
"err",
".",
"Error",
"(",
")",
")",
"\n",
"return",
"ErrInternal",
"\n",
"}",
"\n\n",
"if",
"err",
":=",
"h",
".",
"db",
".",
"Update",
"(",
"prod",
")",
";",
"err",
"!=",
"nil",
"{",
"logger",
".",
"Error",
"(",
"err",
".",
"Error",
"(",
")",
")",
"\n",
"return",
"ErrInternal",
"\n",
"}",
"\n\n",
"return",
"nil",
"\n",
"}"
] |
10,403 | all-10404 | [
"GetCurrentDbDriver",
"returns",
"the",
"DB",
"driver",
"specified",
"in",
"the",
"configuration",
"file",
".",
"If",
"this",
"configuration",
"was",
"omitted",
"it",
"returns",
"the",
"default",
"DB",
"driver"
] | [
"func",
"GetCurrentDbDriver",
"(",
")",
"(",
"*",
"DbDriver",
",",
"error",
")",
"{",
"driverLock",
".",
"RLock",
"(",
")",
"\n",
"if",
"currentDbDriver",
"!=",
"nil",
"{",
"driverLock",
".",
"RUnlock",
"(",
")",
"\n",
"return",
"currentDbDriver",
",",
"nil",
"\n",
"}",
"\n",
"driverLock",
".",
"RUnlock",
"(",
")",
"\n",
"driverLock",
".",
"Lock",
"(",
")",
"\n",
"defer",
"driverLock",
".",
"Unlock",
"(",
")",
"\n",
"if",
"currentDbDriver",
"!=",
"nil",
"{",
"return",
"currentDbDriver",
",",
"nil",
"\n",
"}",
"\n",
"dbDriverName",
",",
"err",
":=",
"config",
".",
"GetString",
"(",
"\"",
"\"",
")",
"\n",
"if",
"err",
"!=",
"nil",
"||",
"dbDriverName",
"==",
"\"",
"\"",
"{",
"dbDriverName",
"=",
"DefaultDbDriverName",
"\n",
"}",
"\n",
"currentDbDriver",
",",
"err",
"=",
"GetDbDriver",
"(",
"dbDriverName",
")",
"\n",
"if",
"<mask>",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"return",
"currentDbDriver",
",",
"nil",
"\n",
"}"
] |
10,404 | all-10405 | [
"Remove",
"is",
"used",
"to",
"delete",
"the",
"cgroup"
] | [
"func",
"(",
"c",
"*",
"control",
")",
"Remove",
"(",
"cgroupPath",
"string",
")",
"error",
"{",
"seelog",
".",
"Debugf",
"(",
"\"",
"\"",
",",
"cgroupPath",
")",
"\n\n",
"<mask>",
",",
"err",
":=",
"c",
".",
"Load",
"(",
"cgroups",
".",
"V1",
",",
"cgroups",
".",
"StaticPath",
"(",
"cgroupPath",
")",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"errors",
".",
"Wrapf",
"(",
"err",
",",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"// Delete cgroup",
"err",
"=",
"controller",
".",
"Delete",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"errors",
".",
"Wrapf",
"(",
"err",
",",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
] |
10,405 | all-10406 | [
"hasFile",
"return",
"if",
"files",
"has",
"a",
"file",
"which",
"has",
"the",
"path",
"specified",
"by",
"the",
"parameter",
"."
] | [
"func",
"hasFile",
"(",
"files",
"[",
"]",
"*",
"File",
",",
"path",
"string",
")",
"bool",
"{",
"for",
"_",
",",
"f",
":=",
"<mask>",
"files",
"{",
"if",
"f",
".",
"path",
"==",
"path",
"{",
"return",
"true",
"\n",
"}",
"\n",
"}",
"\n\n",
"return",
"false",
"\n",
"}"
] |
10,406 | all-10407 | [
"coalesceInterveningIdentical",
"coalesces",
"sufficiently",
"short",
"(",
"<",
"=",
"windowSize",
")",
"equal",
"groups",
"into",
"adjacent",
"unequal",
"groups",
"that",
"currently",
"result",
"in",
"a",
"dual",
"inserted",
"/",
"removed",
"printout",
".",
"This",
"acts",
"as",
"a",
"high",
"-",
"pass",
"filter",
"to",
"smooth",
"out",
"high",
"-",
"frequency",
"changes",
"within",
"the",
"windowSize",
"."
] | [
"func",
"coalesceInterveningIdentical",
"(",
"<mask>",
"[",
"]",
"diffStats",
",",
"windowSize",
"int",
")",
"[",
"]",
"diffStats",
"{",
"groups",
",",
"groupsOrig",
":=",
"groups",
"[",
":",
"0",
"]",
",",
"groups",
"\n",
"for",
"i",
",",
"ds",
":=",
"range",
"groupsOrig",
"{",
"if",
"len",
"(",
"groups",
")",
">=",
"2",
"&&",
"ds",
".",
"NumDiff",
"(",
")",
">",
"0",
"{",
"prev",
":=",
"&",
"groups",
"[",
"len",
"(",
"groups",
")",
"-",
"2",
"]",
"// Unequal group",
"\n",
"curr",
":=",
"&",
"groups",
"[",
"len",
"(",
"groups",
")",
"-",
"1",
"]",
"// Equal group",
"\n",
"next",
":=",
"&",
"groupsOrig",
"[",
"i",
"]",
"// Unequal group",
"\n",
"hadX",
",",
"hadY",
":=",
"prev",
".",
"NumRemoved",
">",
"0",
",",
"prev",
".",
"NumInserted",
">",
"0",
"\n",
"hasX",
",",
"hasY",
":=",
"next",
".",
"NumRemoved",
">",
"0",
",",
"next",
".",
"NumInserted",
">",
"0",
"\n",
"if",
"(",
"(",
"hadX",
"||",
"hasX",
")",
"&&",
"(",
"hadY",
"||",
"hasY",
")",
")",
"&&",
"curr",
".",
"NumIdentical",
"<=",
"windowSize",
"{",
"*",
"prev",
"=",
"(",
"*",
"prev",
")",
".",
"Append",
"(",
"*",
"curr",
")",
".",
"Append",
"(",
"*",
"next",
")",
"\n",
"groups",
"=",
"groups",
"[",
":",
"len",
"(",
"groups",
")",
"-",
"1",
"]",
"// Truncate off equal group",
"\n",
"continue",
"\n",
"}",
"\n",
"}",
"\n",
"groups",
"=",
"append",
"(",
"groups",
",",
"ds",
")",
"\n",
"}",
"\n",
"return",
"groups",
"\n",
"}"
] |
10,407 | all-10408 | [
"SetNumberVcpus",
"sets",
"number",
"of",
"virtual",
"cpus",
"assigned",
"to",
"this",
"machine",
".",
"VM",
"has",
"to",
"be",
"powered",
"off",
"in",
"order",
"to",
"change",
"this",
"parameter",
"."
] | [
"func",
"(",
"v",
"*",
"VM",
")",
"SetNumberVcpus",
"(",
"vcpus",
"uint",
")",
"error",
"{",
"if",
"vcpus",
"<",
"1",
"{",
"vcpus",
"=",
"1",
"\n",
"}",
"\n\n",
"return",
"v",
".",
"updateVMX",
"(",
"func",
"(",
"model",
"*",
"vmx",
".",
"VirtualMachine",
")",
"error",
"{",
"<mask>",
".",
"NumvCPUs",
"=",
"vcpus",
"\n",
"return",
"nil",
"\n",
"}",
")",
"\n",
"}"
] |
10,408 | all-10409 | [
"RegisterWatchHandler",
"registers",
"the",
"http",
"handlers",
"for",
"service",
"Watch",
"to",
"mux",
".",
"The",
"handlers",
"forward",
"requests",
"to",
"the",
"grpc",
"endpoint",
"over",
"the",
"given",
"implementation",
"of",
"WatchClient",
".",
"Note",
":",
"the",
"gRPC",
"framework",
"executes",
"interceptors",
"within",
"the",
"gRPC",
"handler",
".",
"If",
"the",
"passed",
"in",
"WatchClient",
"doesn",
"t",
"go",
"through",
"the",
"normal",
"gRPC",
"flow",
"(",
"creating",
"a",
"gRPC",
"client",
"etc",
".",
")",
"then",
"it",
"will",
"be",
"up",
"to",
"the",
"passed",
"in",
"WatchClient",
"to",
"call",
"the",
"correct",
"interceptors",
"."
] | [
"func",
"RegisterWatchHandlerClient",
"(",
"ctx",
"context",
".",
"Context",
",",
"mux",
"*",
"runtime",
".",
"ServeMux",
",",
"client",
"etcdserverpb",
".",
"WatchClient",
")",
"error",
"{",
"mux",
".",
"Handle",
"(",
"\"",
"\"",
",",
"pattern_Watch_Watch_0",
",",
"func",
"(",
"w",
"http",
".",
"ResponseWriter",
",",
"req",
"*",
"http",
".",
"Request",
",",
"pathParams",
"map",
"[",
"string",
"]",
"string",
")",
"{",
"ctx",
",",
"cancel",
":=",
"context",
".",
"WithCancel",
"(",
"req",
".",
"<mask>",
"(",
")",
")",
"\n",
"defer",
"cancel",
"(",
")",
"\n",
"if",
"cn",
",",
"ok",
":=",
"w",
".",
"(",
"http",
".",
"CloseNotifier",
")",
";",
"ok",
"{",
"go",
"func",
"(",
"done",
"<-",
"chan",
"struct",
"{",
"}",
",",
"closed",
"<-",
"chan",
"bool",
")",
"{",
"select",
"{",
"case",
"<-",
"done",
":",
"case",
"<-",
"closed",
":",
"cancel",
"(",
")",
"\n",
"}",
"\n",
"}",
"(",
"ctx",
".",
"Done",
"(",
")",
",",
"cn",
".",
"CloseNotify",
"(",
")",
")",
"\n",
"}",
"\n",
"inboundMarshaler",
",",
"outboundMarshaler",
":=",
"runtime",
".",
"MarshalerForRequest",
"(",
"mux",
",",
"req",
")",
"\n",
"rctx",
",",
"err",
":=",
"runtime",
".",
"AnnotateContext",
"(",
"ctx",
",",
"mux",
",",
"req",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"runtime",
".",
"HTTPError",
"(",
"ctx",
",",
"mux",
",",
"outboundMarshaler",
",",
"w",
",",
"req",
",",
"err",
")",
"\n",
"return",
"\n",
"}",
"\n",
"resp",
",",
"md",
",",
"err",
":=",
"request_Watch_Watch_0",
"(",
"rctx",
",",
"inboundMarshaler",
",",
"client",
",",
"req",
",",
"pathParams",
")",
"\n",
"ctx",
"=",
"runtime",
".",
"NewServerMetadataContext",
"(",
"ctx",
",",
"md",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"runtime",
".",
"HTTPError",
"(",
"ctx",
",",
"mux",
",",
"outboundMarshaler",
",",
"w",
",",
"req",
",",
"err",
")",
"\n",
"return",
"\n",
"}",
"\n\n",
"forward_Watch_Watch_0",
"(",
"ctx",
",",
"mux",
",",
"outboundMarshaler",
",",
"w",
",",
"req",
",",
"func",
"(",
")",
"(",
"proto",
".",
"Message",
",",
"error",
")",
"{",
"return",
"resp",
".",
"Recv",
"(",
")",
"}",
",",
"mux",
".",
"GetForwardResponseOptions",
"(",
")",
"...",
")",
"\n\n",
"}",
")",
"\n\n",
"return",
"nil",
"\n",
"}"
] |
10,409 | all-10410 | [
"Panicln",
"records",
"the",
"log",
"with",
"fatal",
"level",
"and",
"panics"
] | [
"func",
"(",
"l",
"*",
"Logger",
")",
"Panicln",
"(",
"args",
"...",
"interface",
"{",
"}",
")",
"{",
"msg",
":=",
"fmt",
".",
"Sprintln",
"(",
"args",
"...",
")",
"\n",
"l",
".",
"Output",
"(",
"2",
",",
"LevelError",
",",
"msg",
")",
"\n",
"panic",
"(",
"<mask>",
")",
"\n",
"}"
] |
10,410 | all-10411 | [
"execute",
"a",
"list",
"of",
"display",
"lists"
] | [
"func",
"CallLists",
"(",
"n",
"int32",
",",
"xtype",
"uint32",
",",
"lists",
"unsafe",
".",
"Pointer",
")",
"{",
"C",
".",
"glowCallLists",
"(",
"gpCallLists",
",",
"(",
"C",
".",
"GLsizei",
")",
"(",
"n",
")",
",",
"(",
"C",
".",
"GLenum",
")",
"(",
"xtype",
")",
",",
"<mask>",
")",
"\n",
"}"
] |
10,411 | all-10412 | [
"Do",
"executes",
"Overlay",
".",
"setShowScrollBottleneckRects",
"against",
"the",
"provided",
"context",
"."
] | [
"func",
"(",
"p",
"*",
"SetShowScrollBottleneckRectsParams",
")",
"Do",
"(",
"ctx",
"<mask>",
".",
"Context",
")",
"(",
"err",
"error",
")",
"{",
"return",
"cdp",
".",
"Execute",
"(",
"ctx",
",",
"CommandSetShowScrollBottleneckRects",
",",
"p",
",",
"nil",
")",
"\n",
"}"
] |
10,412 | all-10413 | [
"NotificationRuleLocator",
"builds",
"a",
"locator",
"from",
"the",
"given",
"href",
"."
] | [
"func",
"(",
"api",
"*",
"API",
")",
"NotificationRuleLocator",
"(",
"href",
"<mask>",
")",
"*",
"NotificationRuleLocator",
"{",
"return",
"&",
"NotificationRuleLocator",
"{",
"Href",
"(",
"href",
")",
",",
"api",
"}",
"\n",
"}"
] |
10,413 | all-10414 | [
"SetLogOutput",
"sets",
"output",
"destination",
"for",
"logging",
".",
"If",
"w",
"is",
"nil",
"it",
"unsets",
"output",
"of",
"logging",
"."
] | [
"func",
"(",
"db",
"*",
"DB",
")",
"SetLogOutput",
"(",
"w",
"io",
".",
"Writer",
")",
"{",
"if",
"w",
"==",
"nil",
"{",
"db",
".",
"logger",
"=",
"defaultLogger",
"\n",
"}",
"else",
"{",
"<mask>",
".",
"logger",
"=",
"&",
"templateLogger",
"{",
"w",
":",
"w",
",",
"t",
":",
"defaultLoggerTemplate",
"}",
"\n",
"}",
"\n",
"}"
] |
10,414 | all-10415 | [
"CreateAuthRequest",
"-"
] | [
"func",
"(",
"s",
"*",
"MockHeritageClient",
")",
"CreateAuthRequest",
"(",
"verb",
",",
"requestURL",
",",
"path",
"string",
",",
"args",
"interface",
"{",
"}",
")",
"(",
"*",
"http",
".",
"<mask>",
",",
"error",
")",
"{",
"return",
"&",
"http",
".",
"Request",
"{",
"}",
",",
"nil",
"\n",
"}"
] |
10,415 | all-10416 | [
"UnmarshalJSON",
"supports",
"json",
".",
"Unmarshaler",
"interface"
] | [
"func",
"(",
"v",
"*",
"RequestNodeReturns",
")",
"UnmarshalJSON",
"(",
"data",
"[",
"]",
"<mask>",
")",
"error",
"{",
"r",
":=",
"jlexer",
".",
"Lexer",
"{",
"Data",
":",
"data",
"}",
"\n",
"easyjsonC5a4559bDecodeGithubComChromedpCdprotoDom12",
"(",
"&",
"r",
",",
"v",
")",
"\n",
"return",
"r",
".",
"Error",
"(",
")",
"\n",
"}"
] |
10,416 | all-10417 | [
"expandDVSContactInfo",
"reads",
"certain",
"ResourceData",
"keys",
"and",
"returns",
"a",
"DVSContactInfo",
"."
] | [
"func",
"expandDVSContactInfo",
"(",
"d",
"*",
"schema",
".",
"ResourceData",
")",
"*",
"<mask>",
".",
"DVSContactInfo",
"{",
"obj",
":=",
"&",
"types",
".",
"DVSContactInfo",
"{",
"Name",
":",
"d",
".",
"Get",
"(",
"\"",
"\"",
")",
".",
"(",
"string",
")",
",",
"Contact",
":",
"d",
".",
"Get",
"(",
"\"",
"\"",
")",
".",
"(",
"string",
")",
",",
"}",
"\n",
"return",
"obj",
"\n",
"}"
] |
10,417 | all-10418 | [
"UnmarshalJSON",
"supports",
"json",
".",
"Unmarshaler",
"interface"
] | [
"func",
"(",
"v",
"*",
"EventPaused",
")",
"UnmarshalJSON",
"(",
"data",
"[",
"]",
"<mask>",
")",
"error",
"{",
"r",
":=",
"jlexer",
".",
"Lexer",
"{",
"Data",
":",
"data",
"}",
"\n",
"easyjsonC5a4559bDecodeGithubComChromedpCdprotoDebugger40",
"(",
"&",
"r",
",",
"v",
")",
"\n",
"return",
"r",
".",
"Error",
"(",
")",
"\n",
"}"
] |
10,418 | all-10419 | [
"SetBytesKV",
"sets",
"the",
"given",
"key",
":",
"value",
"header",
".",
"Use",
"AddBytesKV",
"for",
"setting",
"multiple",
"header",
"values",
"under",
"the",
"same",
"key",
"."
] | [
"func",
"(",
"h",
"*",
"RequestHeader",
")",
"SetBytesKV",
"(",
"key",
",",
"value",
"[",
"]",
"byte",
")",
"{",
"h",
".",
"bufKV",
".",
"key",
"=",
"append",
"(",
"h",
".",
"bufKV",
".",
"key",
"[",
":",
"0",
"]",
",",
"key",
"...",
")",
"\n",
"normalizeHeaderKey",
"(",
"h",
".",
"bufKV",
".",
"key",
",",
"h",
".",
"disableNormalizing",
")",
"\n",
"h",
".",
"SetCanonical",
"(",
"h",
".",
"bufKV",
".",
"key",
",",
"<mask>",
")",
"\n",
"}"
] |
10,419 | all-10420 | [
"deepCopyAndSortTags",
"deep",
"copies",
"the",
"tags",
"in",
"the",
"given",
"string",
"slice",
"and",
"then",
"sorts",
"and",
"returns",
"the",
"copied",
"result",
"."
] | [
"func",
"deepCopyAndSortTags",
"(",
"tags",
"[",
"]",
"string",
")",
"[",
"]",
"string",
"{",
"newTags",
":=",
"make",
"(",
"[",
"]",
"string",
",",
"0",
",",
"len",
"(",
"tags",
")",
")",
"\n",
"for",
"_",
",",
"tag",
":=",
"range",
"tags",
"{",
"newTags",
"=",
"<mask>",
"(",
"newTags",
",",
"tag",
")",
"\n",
"}",
"\n",
"sort",
".",
"Strings",
"(",
"newTags",
")",
"\n",
"return",
"newTags",
"\n",
"}"
] |
10,420 | all-10421 | [
"TrimAbove",
"returns",
"a",
"slice",
"of",
"the",
"Trace",
"with",
"all",
"entries",
"above",
"pc",
"removed",
"."
] | [
"func",
"(",
"pcs",
"Trace",
")",
"TrimAbove",
"(",
"pc",
"Call",
")",
"Trace",
"{",
"for",
"len",
"(",
"pcs",
")",
">",
"0",
"&&",
"pcs",
"[",
"len",
"(",
"pcs",
")",
"-",
"1",
"]",
"!=",
"<mask>",
"{",
"pcs",
"=",
"pcs",
"[",
":",
"len",
"(",
"pcs",
")",
"-",
"1",
"]",
"\n",
"}",
"\n",
"return",
"pcs",
"\n",
"}"
] |
10,421 | all-10422 | [
"requestConfigChange",
"is",
"a",
"helper",
"for",
"the",
"above",
"functions",
"that",
"make",
"configuration",
"change",
"requests",
".",
"req",
"describes",
"the",
"change",
".",
"For",
"timeout",
"see",
"AddVoter",
"."
] | [
"func",
"(",
"r",
"*",
"Raft",
")",
"requestConfigChange",
"(",
"req",
"configurationChangeRequest",
",",
"timeout",
"time",
".",
"Duration",
")",
"IndexFuture",
"{",
"var",
"timer",
"<-",
"chan",
"time",
".",
"Time",
"\n",
"if",
"timeout",
">",
"0",
"{",
"timer",
"=",
"time",
".",
"After",
"(",
"timeout",
")",
"\n",
"}",
"\n",
"future",
":=",
"&",
"configurationChangeFuture",
"{",
"req",
":",
"req",
",",
"}",
"\n",
"future",
".",
"init",
"(",
")",
"\n",
"<mask>",
"{",
"case",
"<-",
"timer",
":",
"return",
"errorFuture",
"{",
"ErrEnqueueTimeout",
"}",
"\n",
"case",
"r",
".",
"configurationChangeCh",
"<-",
"future",
":",
"return",
"future",
"\n",
"case",
"<-",
"r",
".",
"shutdownCh",
":",
"return",
"errorFuture",
"{",
"ErrRaftShutdown",
"}",
"\n",
"}",
"\n",
"}"
] |
10,422 | all-10423 | [
"Signer",
"returns",
"a",
"jwt",
".",
"Signer",
"for",
"use",
"when",
"signing",
"tokens",
"."
] | [
"func",
"(",
"gsa",
"*",
"GServiceAccount",
")",
"Signer",
"(",
")",
"(",
"jwt",
".",
"Signer",
",",
"error",
")",
"{",
"gsa",
".",
"mu",
".",
"Lock",
"(",
")",
"\n",
"defer",
"gsa",
".",
"mu",
".",
"Unlock",
"(",
")",
"\n\n",
"if",
"gsa",
".",
"signer",
"==",
"nil",
"{",
"keyset",
",",
"err",
":=",
"pemutil",
".",
"DecodeBytes",
"(",
"[",
"]",
"<mask>",
"(",
"gsa",
".",
"PrivateKey",
")",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"}",
"\n",
"keyset",
".",
"AddPublicKeys",
"(",
")",
"\n\n",
"s",
",",
"err",
":=",
"DefaultAlgorithm",
".",
"New",
"(",
"keyset",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"gsa",
".",
"signer",
"=",
"s",
"\n",
"}",
"\n\n",
"return",
"gsa",
".",
"signer",
",",
"nil",
"\n",
"}"
] |
10,423 | all-10424 | [
"Returns",
"a",
"signed",
"URL",
"for",
"SentryDSN",
"valid",
"for",
"the",
"specified",
"duration",
".",
"Required",
"scopes",
":",
"auth",
":",
"sentry",
":",
"<project",
">",
"See",
"SentryDSN",
"for",
"more",
"details",
"."
] | [
"func",
"(",
"auth",
"*",
"Auth",
")",
"SentryDSN_SignedURL",
"(",
"project",
"string",
",",
"duration",
"time",
".",
"Duration",
")",
"(",
"*",
"url",
".",
"<mask>",
",",
"error",
")",
"{",
"cd",
":=",
"tcclient",
".",
"Client",
"(",
"*",
"auth",
")",
"\n",
"return",
"(",
"&",
"cd",
")",
".",
"SignedURL",
"(",
"\"",
"\"",
"+",
"url",
".",
"QueryEscape",
"(",
"project",
")",
"+",
"\"",
"\"",
",",
"nil",
",",
"duration",
")",
"\n",
"}"
] |
10,424 | all-10425 | [
"UnmarshalEasyJSON",
"satisfies",
"easyjson",
".",
"Unmarshaler",
"."
] | [
"func",
"(",
"t",
"*",
"Timestamp",
")",
"UnmarshalEasyJSON",
"(",
"in",
"*",
"jlexer",
".",
"Lexer",
")",
"{",
"*",
"t",
"=",
"Timestamp",
"(",
"time",
".",
"Unix",
"(",
"0",
",",
"int64",
"(",
"in",
".",
"Float64",
"(",
")",
"*",
"float64",
"(",
"<mask>",
".",
"Millisecond",
")",
")",
")",
")",
"\n",
"}"
] |
10,425 | all-10426 | [
"Ignore",
"is",
"a",
"sentinel",
"option",
"to",
"add",
"ignore",
"error",
"handlers",
"."
] | [
"func",
"Ignore",
"(",
"ignore",
"...",
"func",
"(",
"error",
")",
"bool",
")",
"Option",
"{",
"return",
"func",
"(",
"s",
"*",
"Sentinel",
")",
"error",
"{",
"s",
".",
"Lock",
"(",
")",
"\n",
"defer",
"s",
".",
"Unlock",
"(",
")",
"\n\n",
"if",
"s",
".",
"started",
"{",
"return",
"ErrAlreadyStarted",
"\n",
"}",
"\n\n",
"s",
".",
"ignoreErrors",
"=",
"append",
"(",
"s",
".",
"ignoreErrors",
",",
"<mask>",
"...",
")",
"\n",
"return",
"nil",
"\n",
"}",
"\n",
"}"
] |
10,426 | all-10427 | [
"Specify",
"the",
"value",
"of",
"a",
"uniform",
"variable",
"for",
"a",
"specified",
"program",
"object"
] | [
"func",
"ProgramUniformMatrix2x3fv",
"(",
"<mask>",
"uint32",
",",
"location",
"int32",
",",
"count",
"int32",
",",
"transpose",
"bool",
",",
"value",
"*",
"float32",
")",
"{",
"C",
".",
"glowProgramUniformMatrix2x3fv",
"(",
"gpProgramUniformMatrix2x3fv",
",",
"(",
"C",
".",
"GLuint",
")",
"(",
"program",
")",
",",
"(",
"C",
".",
"GLint",
")",
"(",
"location",
")",
",",
"(",
"C",
".",
"GLsizei",
")",
"(",
"count",
")",
",",
"(",
"C",
".",
"GLboolean",
")",
"(",
"boolToInt",
"(",
"transpose",
")",
")",
",",
"(",
"*",
"C",
".",
"GLfloat",
")",
"(",
"unsafe",
".",
"Pointer",
"(",
"value",
")",
")",
")",
"\n",
"}"
] |
10,427 | all-10428 | [
"PutGob",
"serialize",
"v",
"using",
"gob",
"and",
"put",
"it",
"into",
"the",
"key",
"."
] | [
"func",
"(",
"b",
"Bucket",
")",
"PutGob",
"(",
"k",
"[",
"]",
"[",
"]",
"byte",
",",
"v",
"<mask>",
"{",
"}",
")",
"error",
"{",
"var",
"bs",
"bytesp",
".",
"Slice",
"\n",
"if",
"err",
":=",
"gob",
".",
"NewEncoder",
"(",
"&",
"bs",
")",
".",
"Encode",
"(",
"&",
"v",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"errorsp",
".",
"WithStacksAndMessage",
"(",
"err",
",",
"\"",
"\"",
",",
"v",
")",
"\n",
"}",
"\n",
"return",
"b",
".",
"Put",
"(",
"k",
",",
"bs",
")",
"\n",
"}"
] |
10,428 | all-10429 | [
"Do",
"executes",
"Emulation",
".",
"clearGeolocationOverride",
"against",
"the",
"provided",
"context",
"."
] | [
"func",
"(",
"p",
"*",
"ClearGeolocationOverrideParams",
")",
"Do",
"(",
"ctx",
"context",
".",
"<mask>",
")",
"(",
"err",
"error",
")",
"{",
"return",
"cdp",
".",
"Execute",
"(",
"ctx",
",",
"CommandClearGeolocationOverride",
",",
"nil",
",",
"nil",
")",
"\n",
"}"
] |
10,429 | all-10430 | [
"readPaginatedResults",
"iterates",
"over",
"all",
"objects",
"in",
"the",
"paginated",
"result",
"indicated",
"by",
"the",
"given",
"url",
".",
"newObj",
"()",
"should",
"return",
"a",
"new",
"slice",
"of",
"the",
"expected",
"type",
"accumulate",
"()",
"should",
"accept",
"that",
"populated",
"slice",
"for",
"each",
"page",
"of",
"results",
".",
"Returns",
"an",
"error",
"any",
"call",
"to",
"GitHub",
"or",
"object",
"marshalling",
"fails",
"."
] | [
"func",
"(",
"c",
"*",
"Client",
")",
"readPaginatedResults",
"(",
"path",
",",
"accept",
"string",
",",
"newObj",
"func",
"(",
")",
"<mask>",
"{",
"}",
",",
"accumulate",
"func",
"(",
"interface",
"{",
"}",
")",
")",
"error",
"{",
"values",
":=",
"url",
".",
"Values",
"{",
"\"",
"\"",
":",
"[",
"]",
"string",
"{",
"\"",
"\"",
"}",
",",
"}",
"\n",
"return",
"c",
".",
"readPaginatedResultsWithValues",
"(",
"path",
",",
"values",
",",
"accept",
",",
"newObj",
",",
"accumulate",
")",
"\n",
"}"
] |
10,430 | all-10431 | [
"Estimated",
"minimum",
"cost",
"per",
"socket",
":",
"1",
"goroutine",
"+",
"memory",
"for",
"the",
"largest",
"document",
"ever",
"seen",
"."
] | [
"func",
"(",
"socket",
"*",
"mongoSocket",
")",
"readLoop",
"(",
")",
"{",
"p",
":=",
"make",
"(",
"[",
"]",
"byte",
",",
"36",
")",
"// 16 from header + 20 from OP_REPLY fixed fields",
"\n",
"s",
":=",
"make",
"(",
"[",
"]",
"byte",
",",
"4",
")",
"\n",
"conn",
":=",
"socket",
".",
"conn",
"// No locking, conn never changes.",
"\n",
"for",
"{",
"// XXX Handle timeouts, , etc",
"err",
":=",
"fill",
"(",
"conn",
",",
"p",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"socket",
".",
"kill",
"(",
"err",
",",
"true",
")",
"\n",
"return",
"\n",
"}",
"\n\n",
"totalLen",
":=",
"getInt32",
"(",
"p",
",",
"0",
")",
"\n",
"responseTo",
":=",
"getInt32",
"(",
"p",
",",
"8",
")",
"\n",
"opCode",
":=",
"getInt32",
"(",
"p",
",",
"12",
")",
"\n\n",
"// Don't use socket.server.Addr here. socket is not",
"// locked and socket.server may go away.",
"debugf",
"(",
"\"",
"\"",
",",
"socket",
",",
"socket",
".",
"addr",
",",
"totalLen",
")",
"\n\n",
"_",
"=",
"totalLen",
"\n\n",
"if",
"opCode",
"!=",
"1",
"{",
"socket",
".",
"kill",
"(",
"<mask>",
".",
"New",
"(",
"\"",
"\"",
")",
",",
"true",
")",
"\n",
"return",
"\n",
"}",
"\n\n",
"reply",
":=",
"replyOp",
"{",
"flags",
":",
"uint32",
"(",
"getInt32",
"(",
"p",
",",
"16",
")",
")",
",",
"cursorId",
":",
"getInt64",
"(",
"p",
",",
"20",
")",
",",
"firstDoc",
":",
"getInt32",
"(",
"p",
",",
"28",
")",
",",
"replyDocs",
":",
"getInt32",
"(",
"p",
",",
"32",
")",
",",
"}",
"\n\n",
"stats",
".",
"receivedOps",
"(",
"+",
"1",
")",
"\n",
"stats",
".",
"receivedDocs",
"(",
"int",
"(",
"reply",
".",
"replyDocs",
")",
")",
"\n\n",
"socket",
".",
"Lock",
"(",
")",
"\n",
"replyFunc",
",",
"ok",
":=",
"socket",
".",
"replyFuncs",
"[",
"uint32",
"(",
"responseTo",
")",
"]",
"\n",
"if",
"ok",
"{",
"delete",
"(",
"socket",
".",
"replyFuncs",
",",
"uint32",
"(",
"responseTo",
")",
")",
"\n",
"}",
"\n",
"socket",
".",
"Unlock",
"(",
")",
"\n\n",
"if",
"replyFunc",
"!=",
"nil",
"&&",
"reply",
".",
"replyDocs",
"==",
"0",
"{",
"replyFunc",
"(",
"nil",
",",
"&",
"reply",
",",
"-",
"1",
",",
"nil",
")",
"\n",
"}",
"else",
"{",
"for",
"i",
":=",
"0",
";",
"i",
"!=",
"int",
"(",
"reply",
".",
"replyDocs",
")",
";",
"i",
"++",
"{",
"err",
":=",
"fill",
"(",
"conn",
",",
"s",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"if",
"replyFunc",
"!=",
"nil",
"{",
"replyFunc",
"(",
"err",
",",
"nil",
",",
"-",
"1",
",",
"nil",
")",
"\n",
"}",
"\n",
"socket",
".",
"kill",
"(",
"err",
",",
"true",
")",
"\n",
"return",
"\n",
"}",
"\n\n",
"b",
":=",
"make",
"(",
"[",
"]",
"byte",
",",
"int",
"(",
"getInt32",
"(",
"s",
",",
"0",
")",
")",
")",
"\n\n",
"// copy(b, s) in an efficient way.",
"b",
"[",
"0",
"]",
"=",
"s",
"[",
"0",
"]",
"\n",
"b",
"[",
"1",
"]",
"=",
"s",
"[",
"1",
"]",
"\n",
"b",
"[",
"2",
"]",
"=",
"s",
"[",
"2",
"]",
"\n",
"b",
"[",
"3",
"]",
"=",
"s",
"[",
"3",
"]",
"\n\n",
"err",
"=",
"fill",
"(",
"conn",
",",
"b",
"[",
"4",
":",
"]",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"if",
"replyFunc",
"!=",
"nil",
"{",
"replyFunc",
"(",
"err",
",",
"nil",
",",
"-",
"1",
",",
"nil",
")",
"\n",
"}",
"\n",
"socket",
".",
"kill",
"(",
"err",
",",
"true",
")",
"\n",
"return",
"\n",
"}",
"\n\n",
"if",
"globalDebug",
"&&",
"globalLogger",
"!=",
"nil",
"{",
"m",
":=",
"bson",
".",
"M",
"{",
"}",
"\n",
"if",
"err",
":=",
"bson",
".",
"Unmarshal",
"(",
"b",
",",
"m",
")",
";",
"err",
"==",
"nil",
"{",
"debugf",
"(",
"\"",
"\"",
",",
"socket",
",",
"socket",
".",
"addr",
",",
"m",
")",
"\n",
"}",
"\n",
"}",
"\n\n",
"if",
"replyFunc",
"!=",
"nil",
"{",
"replyFunc",
"(",
"nil",
",",
"&",
"reply",
",",
"i",
",",
"b",
")",
"\n",
"}",
"\n\n",
"// XXX Do bound checking against totalLen.",
"}",
"\n",
"}",
"\n\n",
"socket",
".",
"Lock",
"(",
")",
"\n",
"if",
"len",
"(",
"socket",
".",
"replyFuncs",
")",
"==",
"0",
"{",
"// Nothing else to read for now. Disable deadline.",
"socket",
".",
"conn",
".",
"SetReadDeadline",
"(",
"time",
".",
"Time",
"{",
"}",
")",
"\n",
"}",
"else",
"{",
"socket",
".",
"updateDeadline",
"(",
"readDeadline",
")",
"\n",
"}",
"\n",
"socket",
".",
"Unlock",
"(",
")",
"\n\n",
"// XXX Do bound checking against totalLen.",
"}",
"\n",
"}"
] |
10,431 | all-10432 | [
"GetWriter",
"returns",
"gzip",
".",
"Writer",
"from",
"the",
"pool",
"or",
"creates",
"a",
"new",
"one",
"with",
"gzip",
".",
"BestCompression",
"if",
"the",
"pool",
"is",
"empty",
"."
] | [
"func",
"(",
"pool",
"*",
"GzipPool",
")",
"GetWriter",
"(",
"dst",
"io",
".",
"Writer",
")",
"(",
"writer",
"*",
"gzip",
".",
"Writer",
")",
"{",
"if",
"w",
":=",
"pool",
".",
"pool",
".",
"Get",
"(",
")",
";",
"w",
"!=",
"nil",
"{",
"writer",
"=",
"w",
".",
"(",
"*",
"gzip",
".",
"<mask>",
")",
"\n",
"writer",
".",
"Reset",
"(",
"dst",
")",
"\n",
"}",
"else",
"{",
"writer",
",",
"_",
"=",
"gzip",
".",
"NewWriterLevel",
"(",
"dst",
",",
"gzip",
".",
"BestCompression",
")",
"\n",
"}",
"\n",
"return",
"writer",
"\n",
"}"
] |
10,432 | all-10433 | [
"IntrospectState",
"returns",
"the",
"runtime",
"state",
"for",
"this",
"messsage",
"exchange",
"set",
"."
] | [
"func",
"(",
"mexset",
"*",
"messageExchangeSet",
")",
"IntrospectState",
"(",
"opts",
"*",
"IntrospectionOptions",
")",
"ExchangeSetRuntimeState",
"{",
"mexset",
".",
"RLock",
"(",
")",
"\n",
"setState",
":=",
"ExchangeSetRuntimeState",
"{",
"<mask>",
":",
"mexset",
".",
"name",
",",
"Count",
":",
"len",
"(",
"mexset",
".",
"exchanges",
")",
",",
"}",
"\n\n",
"if",
"opts",
".",
"IncludeExchanges",
"{",
"setState",
".",
"Exchanges",
"=",
"make",
"(",
"map",
"[",
"string",
"]",
"ExchangeRuntimeState",
",",
"len",
"(",
"mexset",
".",
"exchanges",
")",
")",
"\n",
"for",
"k",
",",
"v",
":=",
"range",
"mexset",
".",
"exchanges",
"{",
"state",
":=",
"ExchangeRuntimeState",
"{",
"ID",
":",
"k",
",",
"MessageType",
":",
"v",
".",
"msgType",
",",
"}",
"\n",
"setState",
".",
"Exchanges",
"[",
"strconv",
".",
"Itoa",
"(",
"int",
"(",
"k",
")",
")",
"]",
"=",
"state",
"\n",
"}",
"\n",
"}",
"\n\n",
"mexset",
".",
"RUnlock",
"(",
")",
"\n",
"return",
"setState",
"\n",
"}"
] |
10,433 | all-10434 | [
"nodeAddresses",
"returns",
"the",
"provided",
"node",
"s",
"address",
"based",
"on",
"the",
"priority",
":",
"1",
".",
"NodeInternalIP",
"2",
".",
"NodeExternalIP",
"3",
".",
"NodeLegacyHostIP",
"3",
".",
"NodeHostName",
"Derived",
"from",
"k8s",
".",
"io",
"/",
"kubernetes",
"/",
"pkg",
"/",
"util",
"/",
"node",
"/",
"node",
".",
"go"
] | [
"func",
"nodeAddress",
"(",
"node",
"*",
"apiv1",
".",
"Node",
")",
"(",
"string",
",",
"map",
"[",
"apiv1",
".",
"NodeAddressType",
"]",
"[",
"]",
"string",
",",
"error",
")",
"{",
"m",
":=",
"map",
"[",
"apiv1",
".",
"NodeAddressType",
"]",
"[",
"]",
"string",
"{",
"}",
"\n",
"for",
"_",
",",
"a",
":=",
"range",
"node",
".",
"Status",
".",
"Addresses",
"{",
"m",
"[",
"a",
".",
"Type",
"]",
"=",
"append",
"(",
"m",
"[",
"a",
".",
"Type",
"]",
",",
"a",
".",
"Address",
")",
"\n",
"}",
"\n\n",
"if",
"addresses",
",",
"ok",
":=",
"m",
"[",
"apiv1",
".",
"NodeInternalIP",
"]",
";",
"ok",
"{",
"return",
"addresses",
"[",
"0",
"]",
",",
"m",
",",
"nil",
"\n",
"}",
"\n",
"if",
"addresses",
",",
"ok",
":=",
"m",
"[",
"apiv1",
".",
"NodeExternalIP",
"]",
";",
"ok",
"{",
"return",
"addresses",
"[",
"0",
"]",
",",
"m",
",",
"nil",
"\n",
"}",
"\n",
"if",
"addresses",
",",
"ok",
":=",
"m",
"[",
"apiv1",
".",
"NodeAddressType",
"(",
"NodeLegacyHostIP",
")",
"]",
";",
"ok",
"{",
"return",
"addresses",
"[",
"0",
"]",
",",
"m",
",",
"nil",
"\n",
"}",
"\n",
"if",
"addresses",
",",
"ok",
":=",
"m",
"[",
"apiv1",
".",
"NodeHostName",
"]",
";",
"<mask>",
"{",
"return",
"addresses",
"[",
"0",
"]",
",",
"m",
",",
"nil",
"\n",
"}",
"\n",
"return",
"\"",
"\"",
",",
"m",
",",
"errors",
".",
"New",
"(",
"\"",
"\"",
")",
"\n",
"}"
] |
10,434 | all-10435 | [
"GetType",
"returns",
"the",
"Type",
"field",
"if",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"."
] | [
"func",
"(",
"n",
"*",
"NoteDefinition",
")",
"GetType",
"(",
")",
"string",
"{",
"if",
"n",
"==",
"nil",
"||",
"n",
".",
"Type",
"==",
"nil",
"{",
"return",
"\"",
"\"",
"\n",
"}",
"\n",
"return",
"*",
"n",
".",
"<mask>",
"\n",
"}"
] |
10,435 | all-10436 | [
"Profile",
"will",
"wrap",
"a",
"writer",
"and",
"reader",
"pair",
"and",
"profile",
"where",
"time",
"is",
"spent",
":",
"writing",
"or",
"reading",
".",
"The",
"result",
"is",
"returned",
"when",
"the",
"done",
"func",
"is",
"called",
".",
"The",
"done",
"func",
"can",
"be",
"called",
"multiple",
"times",
".",
"There",
"is",
"a",
"small",
"performance",
"overhead",
"of",
"~µs",
"per",
"Read",
"/",
"Write",
"call",
".",
"This",
"is",
"negligible",
"in",
"most",
"I",
"/",
"O",
"workloads",
".",
"If",
"the",
"overhead",
"is",
"too",
"much",
"for",
"your",
"needs",
"use",
"the",
"ProfileSample",
"call",
"."
] | [
"func",
"Profile",
"(",
"w",
"io",
".",
"Writer",
",",
"r",
"io",
".",
"Reader",
")",
"(",
"pw",
"io",
".",
"Writer",
",",
"pr",
"io",
".",
"Reader",
",",
"done",
"func",
"(",
")",
"TimeProfile",
")",
"{",
"return",
"<mask>",
"(",
"clock",
".",
"New",
"(",
")",
",",
"w",
",",
"r",
")",
"\n",
"}"
] |
10,436 | all-10437 | [
"WriteHeader",
"indicates",
"an",
"expected",
"call",
"of",
"WriteHeader"
] | [
"func",
"(",
"mr",
"*",
"MockResponseWriterMockRecorder",
")",
"WriteHeader",
"(",
"arg0",
"<mask>",
"{",
"}",
")",
"*",
"gomock",
".",
"Call",
"{",
"return",
"mr",
".",
"mock",
".",
"ctrl",
".",
"RecordCallWithMethodType",
"(",
"mr",
".",
"mock",
",",
"\"",
"\"",
",",
"reflect",
".",
"TypeOf",
"(",
"(",
"*",
"MockResponseWriter",
")",
"(",
"nil",
")",
".",
"WriteHeader",
")",
",",
"arg0",
")",
"\n",
"}"
] |
10,437 | all-10438 | [
"AccessTokenFromContext",
"returns",
"the",
"token",
"value",
"stored",
"in",
"context",
"if",
"any",
"."
] | [
"func",
"AccessTokenFromContext",
"(",
"ctx",
"context",
".",
"<mask>",
")",
"(",
"string",
",",
"bool",
")",
"{",
"at",
",",
"ok",
":=",
"ctx",
".",
"Value",
"(",
"accessTokenContextKey",
")",
".",
"(",
"string",
")",
"\n\n",
"return",
"at",
",",
"ok",
"\n",
"}"
] |
10,438 | all-10439 | [
"PaddingStyle",
"returns",
"the",
"style",
"of",
"padding",
"being",
"used",
"to",
"convert",
"between",
"characters",
"and",
"their",
"numeric",
"width",
"i",
".",
"e",
".",
"#",
"==",
"4"
] | [
"func",
"(",
"s",
"*",
"FileSequence",
")",
"PaddingStyle",
"(",
")",
"PadStyle",
"{",
"for",
"style",
",",
"mapper",
":=",
"range",
"padders",
"{",
"if",
"mapper",
"==",
"s",
".",
"padMapper",
"{",
"return",
"<mask>",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"PadStyleDefault",
"\n",
"}"
] |
10,439 | all-10440 | [
"LoadFiles",
"from",
"a",
"list",
"of",
"directories"
] | [
"func",
"(",
"d",
"*",
"directiveParser",
")",
"LoadFiles",
"(",
"paths",
"[",
"]",
"string",
")",
"error",
"{",
"d",
".",
"lock",
".",
"Lock",
"(",
")",
"\n",
"defer",
"d",
".",
"lock",
".",
"Unlock",
"(",
")",
"\n",
"filenames",
",",
"err",
":=",
"pathsToFileGlobs",
"(",
"paths",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"for",
"_",
",",
"filename",
":=",
"range",
"filenames",
"{",
"ranges",
":=",
"d",
".",
"parseFile",
"(",
"filename",
")",
"\n",
"sort",
".",
"Sort",
"(",
"ranges",
")",
"\n",
"d",
".",
"<mask>",
"[",
"filename",
"]",
"=",
"ranges",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
] |
10,440 | all-10441 | [
"getAuthconfigFromCache",
"retrieves",
"the",
"token",
"from",
"cache"
] | [
"func",
"(",
"authProvider",
"*",
"ecrAuthProvider",
")",
"getAuthConfigFromCache",
"(",
"key",
"cacheKey",
")",
"*",
"types",
".",
"AuthConfig",
"{",
"token",
",",
"ok",
":=",
"authProvider",
".",
"tokenCache",
".",
"Get",
"(",
"key",
".",
"String",
"(",
")",
")",
"\n",
"if",
"!",
"ok",
"{",
"return",
"nil",
"\n",
"}",
"\n\n",
"cachedToken",
",",
"ok",
":=",
"token",
".",
"(",
"*",
"ecrapi",
".",
"AuthorizationData",
")",
"\n",
"if",
"!",
"<mask>",
"{",
"log",
".",
"Warnf",
"(",
"\"",
"\"",
")",
"\n",
"return",
"nil",
"\n",
"}",
"\n\n",
"if",
"authProvider",
".",
"IsTokenValid",
"(",
"cachedToken",
")",
"{",
"auth",
",",
"err",
":=",
"extractToken",
"(",
"cachedToken",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"log",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"// Remove invalid token from cache",
"authProvider",
".",
"tokenCache",
".",
"Delete",
"(",
"key",
".",
"String",
"(",
")",
")",
"\n",
"return",
"nil",
"\n",
"}",
"\n",
"return",
"&",
"auth",
"\n",
"}",
"else",
"{",
"// Remove invalid token from cache",
"authProvider",
".",
"tokenCache",
".",
"Delete",
"(",
"key",
".",
"String",
"(",
")",
")",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
] |
10,441 | all-10442 | [
"CreateTeam",
"adds",
"a",
"team",
"with",
"name",
"to",
"the",
"org",
"returning",
"a",
"struct",
"with",
"the",
"new",
"ID",
".",
"See",
"https",
":",
"//",
"developer",
".",
"github",
".",
"com",
"/",
"v3",
"/",
"teams",
"/",
"#create",
"-",
"team"
] | [
"func",
"(",
"c",
"*",
"Client",
")",
"CreateTeam",
"(",
"org",
"string",
",",
"team",
"Team",
")",
"(",
"*",
"Team",
",",
"error",
")",
"{",
"c",
".",
"<mask>",
"(",
"\"",
"\"",
",",
"org",
",",
"team",
")",
"\n",
"if",
"team",
".",
"Name",
"==",
"\"",
"\"",
"{",
"return",
"nil",
",",
"errors",
".",
"New",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"if",
"c",
".",
"fake",
"{",
"return",
"nil",
",",
"nil",
"\n",
"}",
"else",
"if",
"c",
".",
"dry",
"{",
"return",
"&",
"team",
",",
"nil",
"\n",
"}",
"\n",
"path",
":=",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"org",
")",
"\n",
"var",
"retTeam",
"Team",
"\n",
"_",
",",
"err",
":=",
"c",
".",
"request",
"(",
"&",
"request",
"{",
"method",
":",
"http",
".",
"MethodPost",
",",
"path",
":",
"path",
",",
"// This accept header enables the nested teams preview.",
"// https://developer.github.com/changes/2017-08-30-preview-nested-teams/",
"accept",
":",
"\"",
"\"",
",",
"requestBody",
":",
"&",
"team",
",",
"exitCodes",
":",
"[",
"]",
"int",
"{",
"201",
"}",
",",
"}",
",",
"&",
"retTeam",
")",
"\n",
"return",
"&",
"retTeam",
",",
"err",
"\n",
"}"
] |
10,442 | all-10443 | [
"String",
"returns",
"the",
"name",
"of",
"e"
] | [
"func",
"(",
"e",
"MessageType",
")",
"<mask>",
"(",
")",
"string",
"{",
"name",
",",
"_",
":=",
"messageTypeMap",
"[",
"int32",
"(",
"e",
")",
"]",
"\n",
"return",
"name",
"\n",
"}"
] |
10,443 | all-10444 | [
"title",
":",
"autoscale",
"run",
"path",
":",
"/",
"autoscale",
"/",
"run",
"method",
":",
"POST",
"produce",
":",
"application",
"/",
"x",
"-",
"json",
"-",
"stream",
"responses",
":",
"200",
":",
"Ok",
"401",
":",
"Unauthorized"
] | [
"func",
"autoScaleRunHandler",
"(",
"w",
"http",
".",
"ResponseWriter",
",",
"r",
"*",
"http",
".",
"Request",
",",
"t",
"auth",
".",
"Token",
")",
"(",
"err",
"error",
")",
"{",
"if",
"!",
"permission",
".",
"Check",
"(",
"t",
",",
"permission",
".",
"PermNodeAutoscaleUpdateRun",
")",
"{",
"return",
"permission",
".",
"ErrUnauthorized",
"\n",
"}",
"\n",
"evt",
",",
"err",
":=",
"event",
".",
"New",
"(",
"&",
"event",
".",
"Opts",
"{",
"Target",
":",
"event",
".",
"Target",
"{",
"Type",
":",
"event",
".",
"TargetTypePool",
"}",
",",
"Kind",
":",
"permission",
".",
"PermNodeAutoscaleUpdateRun",
",",
"Owner",
":",
"t",
",",
"CustomData",
":",
"event",
".",
"FormToCustomData",
"(",
"InputFields",
"(",
"r",
")",
")",
",",
"DisableLock",
":",
"true",
",",
"Allowed",
":",
"event",
".",
"Allowed",
"(",
"permission",
".",
"PermPoolReadEvents",
")",
",",
"}",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"defer",
"func",
"(",
")",
"{",
"evt",
".",
"Done",
"(",
"err",
")",
"}",
"(",
")",
"\n",
"w",
".",
"Header",
"(",
")",
".",
"Set",
"(",
"\"",
"\"",
",",
"\"",
"\"",
")",
"\n",
"w",
".",
"WriteHeader",
"(",
"http",
".",
"StatusOK",
")",
"\n",
"keepAliveWriter",
":=",
"tsuruIo",
".",
"NewKeepAliveWriter",
"(",
"w",
",",
"15",
"*",
"time",
".",
"Second",
",",
"\"",
"\"",
")",
"\n",
"defer",
"keepAliveWriter",
".",
"Stop",
"(",
")",
"\n",
"<mask>",
":=",
"&",
"tsuruIo",
".",
"SimpleJsonMessageEncoderWriter",
"{",
"Encoder",
":",
"json",
".",
"NewEncoder",
"(",
"keepAliveWriter",
")",
",",
"}",
"\n",
"return",
"autoscale",
".",
"RunOnce",
"(",
"writer",
")",
"\n",
"}"
] |
10,444 | all-10445 | [
"Locale",
"returns",
"the",
"locale",
"of",
"the",
"connector",
"."
] | [
"func",
"(",
"c",
"*",
"Connector",
")",
"Locale",
"(",
")",
"<mask>",
"{",
"c",
".",
"mu",
".",
"RLock",
"(",
")",
"\n",
"defer",
"c",
".",
"mu",
".",
"RUnlock",
"(",
")",
"\n",
"return",
"c",
".",
"locale",
"\n",
"}"
] |
10,445 | all-10446 | [
"NewAgentSettings",
"creates",
"new",
"agent",
"settings",
"for",
"a",
"VM",
"."
] | [
"func",
"NewAgentSettings",
"(",
"agentID",
"string",
",",
"vmCID",
"string",
",",
"networksSettings",
"NetworksSettings",
",",
"env",
"EnvSettings",
",",
"agentOptions",
"AgentOptions",
")",
"AgentSettings",
"{",
"agentSettings",
":=",
"AgentSettings",
"{",
"AgentID",
":",
"agentID",
",",
"Disks",
":",
"DisksSettings",
"{",
"Ephemeral",
":",
"\"",
"\"",
",",
"Persistent",
":",
"map",
"[",
"string",
"]",
"PersistentSettings",
"{",
"}",
",",
"}",
",",
"Blobstore",
":",
"BlobstoreSettings",
"{",
"Provider",
":",
"agentOptions",
".",
"Blobstore",
".",
"Provider",
",",
"Options",
":",
"agentOptions",
".",
"Blobstore",
".",
"<mask>",
",",
"}",
",",
"Env",
":",
"EnvSettings",
"(",
"env",
")",
",",
"Mbus",
":",
"agentOptions",
".",
"Mbus",
",",
"Networks",
":",
"networksSettings",
",",
"Ntp",
":",
"agentOptions",
".",
"Ntp",
",",
"VM",
":",
"VMSettings",
"{",
"Name",
":",
"vmCID",
",",
"}",
",",
"}",
"\n\n",
"return",
"agentSettings",
"\n",
"}"
] |
10,446 | all-10447 | [
"Row",
"fills",
"the",
"dest",
"value",
"slice",
"with",
"row",
"data",
"at",
"index",
"idx",
"."
] | [
"func",
"(",
"f",
"*",
"FieldValues",
")",
"Row",
"(",
"idx",
"int",
",",
"dest",
"[",
"]",
"driver",
".",
"Value",
")",
"{",
"copy",
"(",
"<mask>",
",",
"f",
".",
"values",
"[",
"idx",
"*",
"f",
".",
"cols",
":",
"(",
"idx",
"+",
"1",
")",
"*",
"f",
".",
"cols",
"]",
")",
"\n",
"}"
] |
10,447 | all-10448 | [
"ReceiveComment",
"adds",
"matching",
"comments",
"to",
"InfluxDB"
] | [
"func",
"(",
"c",
"*",
"CommentCounterPlugin",
")",
"ReceiveComment",
"(",
"comment",
"sql",
".",
"Comment",
")",
"[",
"]",
"Point",
"{",
"points",
":=",
"[",
"]",
"Point",
"{",
"}",
"\n",
"for",
"_",
",",
"matcher",
":=",
"range",
"c",
".",
"matcher",
"{",
"if",
"matcher",
".",
"MatchString",
"(",
"comment",
".",
"Body",
")",
"{",
"points",
"=",
"append",
"(",
"points",
",",
"<mask>",
"{",
"Values",
":",
"map",
"[",
"string",
"]",
"interface",
"{",
"}",
"{",
"\"",
"\"",
":",
"1",
",",
"}",
",",
"Date",
":",
"comment",
".",
"CommentCreatedAt",
",",
"}",
")",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"points",
"\n",
"}"
] |
10,448 | all-10449 | [
"Packets",
"to",
"and",
"from",
"any",
"address",
"matching",
"a",
"range",
"in",
"the",
"list",
"are",
"dropped",
"."
] | [
"func",
"(",
"s",
"*",
"Server",
")",
"SetIPBlockList",
"(",
"list",
"iplist",
".",
"Ranger",
")",
"{",
"s",
".",
"mu",
".",
"Lock",
"(",
")",
"\n",
"defer",
"s",
".",
"mu",
".",
"Unlock",
"(",
")",
"\n",
"s",
".",
"ipBlockList",
"=",
"<mask>",
"\n",
"}"
] |
10,449 | all-10450 | [
"identifyDataDirOrDie",
"returns",
"the",
"type",
"of",
"the",
"data",
"dir",
".",
"Dies",
"if",
"the",
"datadir",
"is",
"invalid",
"."
] | [
"func",
"identifyDataDirOrDie",
"(",
"lg",
"*",
"zap",
".",
"Logger",
",",
"dir",
"string",
")",
"dirType",
"{",
"names",
",",
"err",
":=",
"fileutil",
".",
"ReadDir",
"(",
"dir",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"if",
"os",
".",
"IsNotExist",
"(",
"err",
")",
"{",
"return",
"dirEmpty",
"\n",
"}",
"\n",
"if",
"lg",
"!=",
"nil",
"{",
"lg",
".",
"Fatal",
"(",
"\"",
"\"",
",",
"zap",
".",
"String",
"(",
"\"",
"\"",
",",
"dir",
")",
",",
"zap",
".",
"Error",
"(",
"err",
")",
")",
"\n",
"}",
"else",
"{",
"plog",
".",
"Fatalf",
"(",
"\"",
"\"",
",",
"dir",
")",
"\n",
"}",
"\n",
"}",
"\n\n",
"<mask>",
"m",
",",
"p",
"bool",
"\n",
"for",
"_",
",",
"name",
":=",
"range",
"names",
"{",
"switch",
"dirType",
"(",
"name",
")",
"{",
"case",
"dirMember",
":",
"m",
"=",
"true",
"\n",
"case",
"dirProxy",
":",
"p",
"=",
"true",
"\n",
"default",
":",
"if",
"lg",
"!=",
"nil",
"{",
"lg",
".",
"Warn",
"(",
"\"",
"\"",
",",
"zap",
".",
"String",
"(",
"\"",
"\"",
",",
"name",
")",
",",
"zap",
".",
"String",
"(",
"\"",
"\"",
",",
"dir",
")",
",",
")",
"\n",
"}",
"else",
"{",
"plog",
".",
"Warningf",
"(",
"\"",
"\"",
",",
"name",
",",
"dir",
")",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n\n",
"if",
"m",
"&&",
"p",
"{",
"if",
"lg",
"!=",
"nil",
"{",
"lg",
".",
"Fatal",
"(",
"\"",
"\"",
")",
"\n",
"}",
"else",
"{",
"plog",
".",
"Fatal",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"}",
"\n",
"if",
"m",
"{",
"return",
"dirMember",
"\n",
"}",
"\n",
"if",
"p",
"{",
"return",
"dirProxy",
"\n",
"}",
"\n",
"return",
"dirEmpty",
"\n",
"}"
] |
10,450 | all-10451 | [
"Reporter",
"is",
"an",
"Option",
"that",
"can",
"be",
"passed",
"to",
"Equal",
".",
"When",
"Equal",
"traverses",
"the",
"value",
"trees",
"it",
"calls",
"PushStep",
"as",
"it",
"descends",
"into",
"each",
"node",
"in",
"the",
"tree",
"and",
"PopStep",
"as",
"it",
"ascend",
"out",
"of",
"the",
"node",
".",
"The",
"leaves",
"of",
"the",
"tree",
"are",
"either",
"compared",
"(",
"determined",
"to",
"be",
"equal",
"or",
"not",
"equal",
")",
"or",
"ignored",
"and",
"reported",
"as",
"such",
"by",
"calling",
"the",
"Report",
"method",
"."
] | [
"func",
"Reporter",
"(",
"r",
"interface",
"{",
"// PushStep is called when a tree-traversal operation is performed.",
"// The PathStep itself is only valid until the step is popped.",
"// The PathStep.Values are valid for the duration of the entire traversal",
"// and must not be mutated.",
"//",
"// Equal always calls PushStep at the start to provide an operation-less",
"// PathStep used to report the root values.",
"//",
"// Within a slice, the exact set of inserted, removed, or modified elements",
"// is unspecified and may change in future implementations.",
"// The entries of a map are iterated through in an unspecified order.",
"PushStep",
"(",
"PathStep",
")",
"\n\n",
"// Report is called exactly once on leaf nodes to report whether the",
"// comparison identified the node as equal, unequal, or ignored.",
"// A leaf node is one that is immediately preceded by and followed by",
"// a pair of PushStep and PopStep calls.",
"Report",
"(",
"<mask>",
")",
"\n\n",
"// PopStep ascends back up the value tree.",
"// There is always a matching pop call for every push call.",
"PopStep",
"(",
")",
"\n",
"}",
")",
"Option",
"{",
"return",
"reporter",
"{",
"r",
"}",
"\n",
"}"
] |
10,451 | all-10452 | [
"CreateImageAlias",
"sets",
"up",
"a",
"new",
"image",
"alias"
] | [
"func",
"(",
"r",
"*",
"ProtocolLXD",
")",
"CreateImageAlias",
"(",
"alias",
"api",
".",
"ImageAliasesPost",
")",
"error",
"{",
"// Send the request",
"_",
",",
"_",
",",
"err",
":=",
"r",
".",
"<mask>",
"(",
"\"",
"\"",
",",
"\"",
"\"",
",",
"alias",
",",
"\"",
"\"",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"return",
"nil",
"\n",
"}"
] |
10,452 | all-10453 | [
"GetSSHKeyPath",
"returns",
"key",
"path",
"for",
"use",
"with",
"ssh"
] | [
"func",
"(",
"d",
"*",
"SerialDriver",
")",
"GetSSHKeyPath",
"(",
")",
"<mask>",
"{",
"d",
".",
"Lock",
"(",
")",
"\n",
"defer",
"d",
".",
"Unlock",
"(",
")",
"\n",
"return",
"d",
".",
"Driver",
".",
"GetSSHKeyPath",
"(",
")",
"\n",
"}"
] |
10,453 | all-10454 | [
"Block",
"I",
"/",
"O",
"limits"
] | [
"func",
"(",
"c",
"*",
"containerLXC",
")",
"getDiskLimits",
"(",
")",
"(",
"map",
"[",
"string",
"]",
"deviceBlockLimit",
",",
"error",
")",
"{",
"result",
":=",
"map",
"[",
"string",
"]",
"deviceBlockLimit",
"{",
"}",
"\n\n",
"// Build a list of all valid block devices",
"validBlocks",
":=",
"[",
"]",
"string",
"{",
"}",
"\n\n",
"dents",
",",
"err",
":=",
"ioutil",
".",
"ReadDir",
"(",
"\"",
"\"",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"for",
"_",
",",
"f",
":=",
"range",
"dents",
"{",
"fPath",
":=",
"filepath",
".",
"Join",
"(",
"\"",
"\"",
",",
"f",
".",
"Name",
"(",
")",
")",
"\n",
"if",
"shared",
".",
"PathExists",
"(",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"fPath",
")",
")",
"{",
"continue",
"\n",
"}",
"\n\n",
"if",
"!",
"shared",
".",
"PathExists",
"(",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"fPath",
")",
")",
"{",
"continue",
"\n",
"}",
"\n\n",
"block",
",",
"err",
":=",
"ioutil",
".",
"ReadFile",
"(",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"fPath",
")",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"validBlocks",
"=",
"append",
"(",
"validBlocks",
",",
"strings",
".",
"TrimSuffix",
"(",
"string",
"(",
"block",
")",
",",
"\"",
"\\n",
"\"",
")",
")",
"\n",
"}",
"\n\n",
"// Process all the limits",
"blockLimits",
":=",
"map",
"[",
"string",
"]",
"[",
"]",
"deviceBlockLimit",
"{",
"}",
"\n",
"for",
"_",
",",
"k",
":=",
"range",
"c",
".",
"expandedDevices",
".",
"DeviceNames",
"(",
")",
"{",
"m",
":=",
"c",
".",
"expandedDevices",
"[",
"k",
"]",
"\n",
"if",
"m",
"[",
"\"",
"\"",
"]",
"!=",
"\"",
"\"",
"{",
"continue",
"\n",
"}",
"\n\n",
"// Apply max limit",
"if",
"m",
"[",
"\"",
"\"",
"]",
"!=",
"\"",
"\"",
"{",
"m",
"[",
"\"",
"\"",
"]",
"=",
"m",
"[",
"\"",
"\"",
"]",
"\n",
"m",
"[",
"\"",
"\"",
"]",
"=",
"m",
"[",
"\"",
"\"",
"]",
"\n",
"}",
"\n\n",
"// Parse the user input",
"readBps",
",",
"readIops",
",",
"writeBps",
",",
"writeIops",
",",
"err",
":=",
"deviceParseDiskLimit",
"(",
"m",
"[",
"\"",
"\"",
"]",
",",
"m",
"[",
"\"",
"\"",
"]",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"// Set the source path",
"source",
":=",
"shared",
".",
"HostPath",
"(",
"m",
"[",
"\"",
"\"",
"]",
")",
"\n",
"if",
"source",
"==",
"\"",
"\"",
"{",
"source",
"=",
"c",
".",
"RootfsPath",
"(",
")",
"\n",
"}",
"\n\n",
"// Don't try to resolve the block device behind a non-existing path",
"if",
"!",
"shared",
".",
"PathExists",
"(",
"source",
")",
"{",
"continue",
"\n",
"}",
"\n\n",
"// Get the backing block devices (major:minor)",
"blocks",
",",
"err",
":=",
"deviceGetParentBlocks",
"(",
"<mask>",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"if",
"readBps",
"==",
"0",
"&&",
"readIops",
"==",
"0",
"&&",
"writeBps",
"==",
"0",
"&&",
"writeIops",
"==",
"0",
"{",
"// If the device doesn't exist, there is no limit to clear so ignore the failure",
"continue",
"\n",
"}",
"else",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"}",
"\n\n",
"device",
":=",
"deviceBlockLimit",
"{",
"readBps",
":",
"readBps",
",",
"readIops",
":",
"readIops",
",",
"writeBps",
":",
"writeBps",
",",
"writeIops",
":",
"writeIops",
"}",
"\n",
"for",
"_",
",",
"block",
":=",
"range",
"blocks",
"{",
"blockStr",
":=",
"\"",
"\"",
"\n\n",
"if",
"shared",
".",
"StringInSlice",
"(",
"block",
",",
"validBlocks",
")",
"{",
"// Straightforward entry (full block device)",
"blockStr",
"=",
"block",
"\n",
"}",
"else",
"{",
"// Attempt to deal with a partition (guess its parent)",
"fields",
":=",
"strings",
".",
"SplitN",
"(",
"block",
",",
"\"",
"\"",
",",
"2",
")",
"\n",
"fields",
"[",
"1",
"]",
"=",
"\"",
"\"",
"\n",
"if",
"shared",
".",
"StringInSlice",
"(",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"fields",
"[",
"0",
"]",
",",
"fields",
"[",
"1",
"]",
")",
",",
"validBlocks",
")",
"{",
"blockStr",
"=",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"fields",
"[",
"0",
"]",
",",
"fields",
"[",
"1",
"]",
")",
"\n",
"}",
"\n",
"}",
"\n\n",
"if",
"blockStr",
"==",
"\"",
"\"",
"{",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"block",
")",
"\n",
"}",
"\n\n",
"if",
"blockLimits",
"[",
"blockStr",
"]",
"==",
"nil",
"{",
"blockLimits",
"[",
"blockStr",
"]",
"=",
"[",
"]",
"deviceBlockLimit",
"{",
"}",
"\n",
"}",
"\n",
"blockLimits",
"[",
"blockStr",
"]",
"=",
"append",
"(",
"blockLimits",
"[",
"blockStr",
"]",
",",
"device",
")",
"\n",
"}",
"\n",
"}",
"\n\n",
"// Average duplicate limits",
"for",
"block",
",",
"limits",
":=",
"range",
"blockLimits",
"{",
"var",
"readBpsCount",
",",
"readBpsTotal",
",",
"readIopsCount",
",",
"readIopsTotal",
",",
"writeBpsCount",
",",
"writeBpsTotal",
",",
"writeIopsCount",
",",
"writeIopsTotal",
"int64",
"\n\n",
"for",
"_",
",",
"limit",
":=",
"range",
"limits",
"{",
"if",
"limit",
".",
"readBps",
">",
"0",
"{",
"readBpsCount",
"+=",
"1",
"\n",
"readBpsTotal",
"+=",
"limit",
".",
"readBps",
"\n",
"}",
"\n\n",
"if",
"limit",
".",
"readIops",
">",
"0",
"{",
"readIopsCount",
"+=",
"1",
"\n",
"readIopsTotal",
"+=",
"limit",
".",
"readIops",
"\n",
"}",
"\n\n",
"if",
"limit",
".",
"writeBps",
">",
"0",
"{",
"writeBpsCount",
"+=",
"1",
"\n",
"writeBpsTotal",
"+=",
"limit",
".",
"writeBps",
"\n",
"}",
"\n\n",
"if",
"limit",
".",
"writeIops",
">",
"0",
"{",
"writeIopsCount",
"+=",
"1",
"\n",
"writeIopsTotal",
"+=",
"limit",
".",
"writeIops",
"\n",
"}",
"\n",
"}",
"\n\n",
"device",
":=",
"deviceBlockLimit",
"{",
"}",
"\n\n",
"if",
"readBpsCount",
">",
"0",
"{",
"device",
".",
"readBps",
"=",
"readBpsTotal",
"/",
"readBpsCount",
"\n",
"}",
"\n\n",
"if",
"readIopsCount",
">",
"0",
"{",
"device",
".",
"readIops",
"=",
"readIopsTotal",
"/",
"readIopsCount",
"\n",
"}",
"\n\n",
"if",
"writeBpsCount",
">",
"0",
"{",
"device",
".",
"writeBps",
"=",
"writeBpsTotal",
"/",
"writeBpsCount",
"\n",
"}",
"\n\n",
"if",
"writeIopsCount",
">",
"0",
"{",
"device",
".",
"writeIops",
"=",
"writeIopsTotal",
"/",
"writeIopsCount",
"\n",
"}",
"\n\n",
"result",
"[",
"block",
"]",
"=",
"device",
"\n",
"}",
"\n\n",
"return",
"result",
",",
"nil",
"\n",
"}"
] |
10,454 | all-10455 | [
"UnmarshalJSON",
"supports",
"json",
".",
"Unmarshaler",
"interface"
] | [
"func",
"(",
"v",
"*",
"GetTargetsReturns",
")",
"UnmarshalJSON",
"(",
"data",
"[",
"]",
"<mask>",
")",
"error",
"{",
"r",
":=",
"jlexer",
".",
"Lexer",
"{",
"Data",
":",
"data",
"}",
"\n",
"easyjsonC5a4559bDecodeGithubComChromedpCdprotoTarget6",
"(",
"&",
"r",
",",
"v",
")",
"\n",
"return",
"r",
".",
"Error",
"(",
")",
"\n",
"}"
] |
10,455 | all-10456 | [
"ProjectUpdate",
"updates",
"the",
"project",
"matching",
"the",
"given",
"key",
"parameters",
"."
] | [
"func",
"(",
"c",
"*",
"ClusterTx",
")",
"ProjectUpdate",
"(",
"name",
"string",
",",
"object",
"api",
".",
"ProjectPut",
")",
"error",
"{",
"stmt",
":=",
"c",
".",
"stmt",
"(",
"projectUpdate",
")",
"\n",
"result",
",",
"err",
":=",
"stmt",
".",
"Exec",
"(",
"object",
".",
"Description",
",",
"name",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"errors",
".",
"Wrap",
"(",
"err",
",",
"\"",
"\"",
")",
"\n",
"}",
"\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\n",
"id",
",",
"err",
":=",
"c",
".",
"ProjectID",
"(",
"name",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"errors",
".",
"Wrap",
"(",
"err",
",",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"// Clear config.",
"_",
",",
"err",
"=",
"c",
".",
"tx",
".",
"Exec",
"(",
"`\nDELETE FROM projects_config WHERE projects_config.project_id = ?\n`",
",",
"id",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"errors",
".",
"Wrap",
"(",
"err",
",",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"// Insert new config.",
"stmt",
"=",
"c",
".",
"stmt",
"(",
"projectCreateConfigRef",
")",
"\n",
"for",
"key",
",",
"<mask>",
":=",
"range",
"object",
".",
"Config",
"{",
"_",
",",
"err",
":=",
"stmt",
".",
"Exec",
"(",
"id",
",",
"key",
",",
"value",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"errors",
".",
"Wrap",
"(",
"err",
",",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"}",
"\n\n",
"return",
"nil",
"\n",
"}"
] |
10,456 | all-10457 | [
"NewFunc",
"creates",
"a",
"new",
"Pool",
"of",
"workers",
"where",
"each",
"worker",
"will",
"process",
"using",
"the",
"provided",
"func",
"."
] | [
"func",
"NewFunc",
"(",
"n",
"int",
",",
"f",
"func",
"(",
"<mask>",
"{",
"}",
")",
"interface",
"{",
"}",
")",
"*",
"Pool",
"{",
"return",
"New",
"(",
"n",
",",
"func",
"(",
")",
"Worker",
"{",
"return",
"&",
"closureWorker",
"{",
"processor",
":",
"f",
",",
"}",
"\n",
"}",
")",
"\n",
"}"
] |
10,457 | all-10458 | [
"Main",
"draws",
"geometry",
"and",
"returns",
"the",
"filename",
".",
"This",
"should",
"only",
"be",
"used",
"during",
"testing",
"."
] | [
"func",
"Main",
"(",
"gc",
"draw2d",
".",
"GraphicContext",
",",
"ext",
"string",
")",
"(",
"string",
",",
"<mask>",
")",
"{",
"// Draw the droid",
"Draw",
"(",
"gc",
",",
"297",
",",
"210",
")",
"\n\n",
"// Return the output filename",
"return",
"samples",
".",
"Output",
"(",
"\"",
"\"",
",",
"ext",
")",
",",
"nil",
"\n",
"}"
] |
10,458 | all-10459 | [
"PutObjectSplit",
"is",
"the",
"same",
"as",
"PutObject",
"except",
"that",
"the",
"data",
"is",
"splitted",
"into",
"several",
"smaller",
"objects",
".",
"This",
"is",
"primarily",
"useful",
"if",
"you",
"d",
"like",
"to",
"be",
"able",
"to",
"resume",
"upload",
"."
] | [
"func",
"(",
"c",
"APIClient",
")",
"PutObjectSplit",
"(",
"_r",
"io",
".",
"Reader",
")",
"(",
"<mask>",
"[",
"]",
"*",
"pfs",
".",
"Object",
",",
"_",
"int64",
",",
"retErr",
"error",
")",
"{",
"r",
":=",
"grpcutil",
".",
"ReaderWrapper",
"{",
"_r",
"}",
"\n",
"w",
",",
"err",
":=",
"c",
".",
"newPutObjectSplitWriteCloser",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"0",
",",
"grpcutil",
".",
"ScrubGRPC",
"(",
"err",
")",
"\n",
"}",
"\n",
"defer",
"func",
"(",
")",
"{",
"if",
"err",
":=",
"w",
".",
"Close",
"(",
")",
";",
"err",
"!=",
"nil",
"&&",
"retErr",
"==",
"nil",
"{",
"retErr",
"=",
"grpcutil",
".",
"ScrubGRPC",
"(",
"err",
")",
"\n",
"}",
"\n",
"if",
"retErr",
"==",
"nil",
"{",
"objects",
"=",
"w",
".",
"objects",
"\n",
"}",
"\n",
"}",
"(",
")",
"\n",
"buf",
":=",
"grpcutil",
".",
"GetBuffer",
"(",
")",
"\n",
"defer",
"grpcutil",
".",
"PutBuffer",
"(",
"buf",
")",
"\n",
"written",
",",
"err",
":=",
"io",
".",
"CopyBuffer",
"(",
"w",
",",
"r",
",",
"buf",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"0",
",",
"grpcutil",
".",
"ScrubGRPC",
"(",
"err",
")",
"\n",
"}",
"\n",
"// return value set by deferred function",
"return",
"nil",
",",
"written",
",",
"nil",
"\n",
"}"
] |
10,459 | all-10460 | [
"UnmarshalText",
"implements",
"the",
"text",
"unmarshaller",
"interface"
] | [
"func",
"(",
"t",
"*",
"DateTime",
")",
"UnmarshalText",
"(",
"text",
"[",
"]",
"byte",
")",
"error",
"{",
"tt",
",",
"err",
":=",
"ParseDateTime",
"(",
"string",
"(",
"<mask>",
")",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"*",
"t",
"=",
"tt",
"\n",
"return",
"nil",
"\n",
"}"
] |
10,460 | all-10461 | [
"CellRendererTextNew",
"is",
"a",
"wrapper",
"around",
"gtk_cell_renderer_text_new",
"()",
"."
] | [
"func",
"CellRendererTextNew",
"(",
")",
"(",
"*",
"CellRendererText",
",",
"error",
")",
"{",
"c",
":=",
"C",
".",
"gtk_cell_renderer_text_new",
"(",
")",
"\n",
"if",
"c",
"==",
"nil",
"{",
"<mask>",
"nil",
",",
"nilPtrErr",
"\n",
"}",
"\n",
"obj",
":=",
"glib",
".",
"Take",
"(",
"unsafe",
".",
"Pointer",
"(",
"c",
")",
")",
"\n",
"return",
"wrapCellRendererText",
"(",
"obj",
")",
",",
"nil",
"\n",
"}"
] |
10,461 | all-10462 | [
"==",
"Unset",
"variables",
"_Unset",
"unsets",
"the",
"key",
"in",
"the",
"given",
"filename",
".",
"/",
"*",
"func",
"_Unset",
"(",
"filename",
"key",
"string",
")",
"error",
"{"
] | [
"func",
"checkKey",
"(",
"s",
"string",
")",
"{",
"for",
"_",
",",
"char",
":=",
"range",
"s",
"{",
"if",
"(",
"char",
"<",
"'A'",
"||",
"char",
">",
"'Z'",
")",
"&&",
"<mask>",
"!=",
"'_'",
"{",
"panic",
"(",
"errKey",
")",
"\n",
"}",
"\n",
"}",
"\n",
"}"
] |
10,462 | all-10463 | [
"Method",
"---------------------------------------------------------------------",
"NewMethod",
"retuns",
"a",
"request",
"method",
"matcher",
"converting",
"values",
"to",
"upper",
"-",
"case",
"."
] | [
"func",
"NewMethod",
"(",
"m",
"[",
"]",
"string",
")",
"Method",
"{",
"for",
"k",
",",
"v",
":=",
"<mask>",
"m",
"{",
"m",
"[",
"k",
"]",
"=",
"strings",
".",
"ToUpper",
"(",
"v",
")",
"\n",
"}",
"\n",
"return",
"Method",
"(",
"m",
")",
"\n",
"}"
] |
10,463 | all-10464 | [
"DefaultBucketName",
"returns",
"the",
"name",
"of",
"this",
"application",
"s",
"default",
"Google",
"Cloud",
"Storage",
"bucket",
"."
] | [
"func",
"DefaultBucketName",
"(",
"c",
"context",
".",
"Context",
")",
"(",
"string",
",",
"error",
")",
"{",
"req",
":=",
"&",
"aipb",
".",
"GetDefaultGcsBucketNameRequest",
"{",
"}",
"\n",
"<mask>",
":=",
"&",
"aipb",
".",
"GetDefaultGcsBucketNameResponse",
"{",
"}",
"\n\n",
"err",
":=",
"internal",
".",
"Call",
"(",
"c",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"req",
",",
"res",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"\"",
"\"",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"res",
")",
"\n",
"}",
"\n",
"return",
"res",
".",
"GetDefaultGcsBucketName",
"(",
")",
",",
"nil",
"\n",
"}"
] |
10,464 | all-10465 | [
"Addrs",
"implements",
"the",
"Provider",
"interface",
"for",
"the",
"vsphere",
"package",
"."
] | [
"func",
"(",
"p",
"*",
"Provider",
")",
"Addrs",
"(",
"args",
"map",
"[",
"string",
"]",
"string",
",",
"l",
"*",
"log",
".",
"Logger",
")",
"(",
"[",
"]",
"string",
",",
"error",
")",
"{",
"if",
"args",
"[",
"\"",
"\"",
"]",
"!=",
"\"",
"\"",
"{",
"return",
"nil",
",",
"discoverErr",
"(",
"\"",
"\"",
",",
"args",
"[",
"\"",
"\"",
"]",
")",
"\n",
"}",
"\n\n",
"setLog",
"(",
"l",
")",
"\n\n",
"tagName",
":=",
"args",
"[",
"\"",
"\"",
"]",
"\n",
"categoryName",
":=",
"args",
"[",
"\"",
"\"",
"]",
"\n",
"host",
":=",
"valueOrEnv",
"(",
"args",
",",
"\"",
"\"",
",",
"\"",
"\"",
")",
"\n",
"user",
":=",
"valueOrEnv",
"(",
"args",
",",
"\"",
"\"",
",",
"\"",
"\"",
")",
"\n",
"password",
":=",
"valueOrEnv",
"(",
"args",
",",
"\"",
"\"",
",",
"\"",
"\"",
")",
"\n",
"insecure",
",",
"err",
":=",
"strconv",
".",
"ParseBool",
"(",
"valueOrEnv",
"(",
"args",
",",
"\"",
"\"",
",",
"\"",
"\"",
")",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"logger",
".",
"Println",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"timeout",
",",
"err",
":=",
"time",
".",
"ParseDuration",
"(",
"args",
"[",
"\"",
"\"",
"]",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"logger",
".",
"Println",
"(",
"\"",
"\"",
")",
"\n",
"timeout",
"=",
"time",
".",
"Minute",
"*",
"10",
"\n",
"}",
"\n\n",
"ctx",
",",
"cancel",
":=",
"context",
".",
"WithTimeout",
"(",
"context",
".",
"Background",
"(",
")",
",",
"timeout",
")",
"\n",
"defer",
"cancel",
"(",
")",
"\n\n",
"client",
",",
"err",
":=",
"newVSphereClient",
"(",
"ctx",
",",
"host",
",",
"user",
",",
"password",
",",
"insecure",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"discoverErr",
"(",
"err",
".",
"Error",
"(",
")",
")",
"\n",
"}",
"\n\n",
"if",
"tagName",
"==",
"\"",
"\"",
"||",
"categoryName",
"==",
"\"",
"\"",
"{",
"return",
"nil",
",",
"discoverErr",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"logger",
".",
"Printf",
"(",
"\"",
"\"",
",",
"tagName",
",",
"categoryName",
")",
"\n\n",
"tagID",
",",
"err",
":=",
"tagIDFromName",
"(",
"ctx",
",",
"client",
".",
"TagsClient",
",",
"tagName",
",",
"categoryName",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"discoverErr",
"(",
"err",
".",
"Error",
"(",
")",
")",
"\n",
"}",
"\n\n",
"addrs",
",",
"err",
":=",
"virtualMachineIPsForTag",
"(",
"ctx",
",",
"client",
",",
"tagID",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"discoverErr",
"(",
"err",
".",
"<mask>",
"(",
")",
")",
"\n",
"}",
"\n\n",
"logger",
".",
"Printf",
"(",
"\"",
"\"",
",",
"strings",
".",
"Join",
"(",
"addrs",
",",
"\"",
"\"",
")",
")",
"\n",
"return",
"addrs",
",",
"nil",
"\n",
"}"
] |
10,465 | all-10466 | [
"stop",
"is",
"used",
"internally",
"to",
"shutdown",
"a",
"running",
"CLI"
] | [
"func",
"(",
"cli",
"*",
"CLI",
")",
"stop",
"(",
")",
"{",
"cli",
".",
"Lock",
"(",
")",
"\n",
"defer",
"cli",
".",
"Unlock",
"(",
")",
"\n\n",
"if",
"cli",
".",
"stopped",
"{",
"return",
"\n",
"}",
"\n\n",
"close",
"(",
"cli",
".",
"stopCh",
")",
"\n",
"<mask>",
".",
"stopped",
"=",
"true",
"\n",
"}"
] |
10,466 | all-10467 | [
"Mod",
"returns",
"the",
"module",
"path",
"for",
"the",
"module",
"that",
"contains",
"the",
"package",
"named",
"by",
"importPath",
".",
"The",
"name",
"of",
"the",
"go_repository",
"rule",
"for",
"the",
"module",
"is",
"also",
"returned",
".",
"For",
"example",
"calling",
"Mod",
"on",
"github",
".",
"com",
"/",
"foo",
"/",
"bar",
"/",
"v2",
"/",
"baz",
"would",
"give",
"the",
"module",
"path",
"github",
".",
"com",
"/",
"foo",
"/",
"bar",
"/",
"v2",
"and",
"the",
"name",
"com_github_foo_bar_v2",
".",
"If",
"a",
"known",
"repository",
"*",
"could",
"*",
"provide",
"importPath",
"(",
"because",
"its",
"importpath",
"is",
"a",
"prefix",
"of",
"importPath",
")",
"Mod",
"will",
"assume",
"that",
"it",
"does",
".",
"This",
"may",
"give",
"inaccurate",
"results",
"if",
"importPath",
"is",
"in",
"an",
"undeclared",
"nested",
"module",
".",
"Run",
"gazelle",
"update",
"-",
"repos",
"-",
"from_file",
"=",
"go",
".",
"mod",
"first",
"for",
"best",
"results",
".",
"If",
"no",
"known",
"repository",
"could",
"provide",
"importPath",
"Mod",
"will",
"run",
"go",
"list",
"to",
"find",
"the",
"module",
".",
"The",
"special",
"patterns",
"that",
"Root",
"uses",
"are",
"ignored",
".",
"Results",
"are",
"cached",
".",
"Use",
"GOPROXY",
"for",
"faster",
"results",
"."
] | [
"func",
"(",
"r",
"*",
"RemoteCache",
")",
"Mod",
"(",
"importPath",
"string",
")",
"(",
"modPath",
",",
"name",
"string",
",",
"err",
"error",
")",
"{",
"// Check if any of the known repositories is a prefix.",
"prefix",
":=",
"importPath",
"\n",
"for",
"{",
"v",
",",
"ok",
",",
"err",
":=",
"r",
".",
"mod",
".",
"get",
"(",
"prefix",
")",
"\n",
"if",
"ok",
"{",
"if",
"err",
"!=",
"nil",
"{",
"return",
"\"",
"\"",
",",
"\"",
"\"",
",",
"err",
"\n",
"}",
"\n",
"value",
":=",
"v",
".",
"(",
"modValue",
")",
"\n",
"if",
"value",
".",
"known",
"{",
"return",
"value",
".",
"path",
",",
"value",
".",
"name",
",",
"nil",
"\n",
"}",
"else",
"{",
"break",
"\n",
"}",
"\n",
"}",
"\n\n",
"prefix",
"=",
"path",
".",
"Dir",
"(",
"prefix",
")",
"\n",
"if",
"prefix",
"==",
"\"",
"\"",
"||",
"prefix",
"==",
"\"",
"\"",
"{",
"break",
"\n",
"}",
"\n",
"}",
"\n\n",
"// Ask \"go list\".",
"v",
",",
"err",
":=",
"r",
".",
"mod",
".",
"ensure",
"(",
"importPath",
",",
"func",
"(",
")",
"(",
"interface",
"{",
"}",
",",
"error",
")",
"{",
"modPath",
",",
"err",
":=",
"r",
".",
"ModInfo",
"(",
"importPath",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"return",
"modValue",
"{",
"path",
":",
"modPath",
",",
"name",
":",
"label",
".",
"ImportPathToBazelRepoName",
"(",
"modPath",
")",
",",
"}",
",",
"nil",
"\n",
"}",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"\"",
"\"",
",",
"\"",
"\"",
",",
"err",
"\n",
"}",
"\n",
"value",
":=",
"v",
".",
"(",
"modValue",
")",
"\n",
"return",
"value",
".",
"path",
",",
"value",
".",
"<mask>",
",",
"nil",
"\n",
"}"
] |
10,467 | all-10468 | [
"Step",
"2a",
"is",
"the",
"removal",
"of",
"verb",
"suffixes",
"beginning",
"y",
"Search",
"for",
"the",
"longest",
"among",
"the",
"following",
"suffixes",
"in",
"RV",
"and",
"if",
"found",
"delete",
"if",
"preceded",
"by",
"u",
"."
] | [
"func",
"step2a",
"(",
"word",
"*",
"snowballword",
".",
"SnowballWord",
")",
"bool",
"{",
"suffix",
",",
"suffixRunes",
":=",
"word",
".",
"FirstSuffixIn",
"(",
"word",
".",
"RVstart",
",",
"len",
"(",
"word",
".",
"RS",
")",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
",",
" ",
"y",
",",
" ",
"y",
",",
" ",
"y",
",",
" ",
"y",
")",
"",
"\n",
"if",
"suffix",
"!=",
"\"",
"\"",
"{",
"idx",
":=",
"len",
"(",
"<mask>",
".",
"RS",
")",
"-",
"len",
"(",
"suffixRunes",
")",
"-",
"1",
"\n",
"if",
"idx",
">=",
"0",
"&&",
"word",
".",
"RS",
"[",
"idx",
"]",
"==",
"117",
"{",
"word",
".",
"RemoveLastNRunes",
"(",
"len",
"(",
"suffixRunes",
")",
")",
"\n",
"return",
"true",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"false",
"\n",
"}"
] |
10,468 | all-10469 | [
"Open",
"dials",
"to",
"the",
"MongoDB",
"database",
"and",
"return",
"the",
"connection",
"(",
"represented",
"by",
"the",
"type",
"Storage",
")",
".",
"addr",
"is",
"a",
"MongoDB",
"connection",
"URI",
"and",
"dbname",
"is",
"the",
"name",
"of",
"the",
"database",
".",
"This",
"function",
"returns",
"a",
"pointer",
"to",
"a",
"Storage",
"or",
"a",
"non",
"-",
"nil",
"error",
"in",
"case",
"of",
"any",
"failure",
"."
] | [
"func",
"Open",
"(",
"addr",
",",
"dbname",
"string",
")",
"(",
"storage",
"*",
"Storage",
",",
"err",
"error",
")",
"{",
"sessionLock",
".",
"RLock",
"(",
")",
"\n",
"if",
"sessions",
"[",
"addr",
"]",
"==",
"nil",
"{",
"sessionLock",
".",
"RUnlock",
"(",
")",
"\n",
"sessionLock",
".",
"Lock",
"(",
")",
"\n",
"if",
"sessions",
"[",
"addr",
"]",
"==",
"nil",
"{",
"sessions",
"[",
"addr",
"]",
",",
"err",
"=",
"open",
"(",
"addr",
")",
"\n",
"}",
"\n",
"sessionLock",
".",
"Unlock",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"\n",
"}",
"\n",
"}",
"else",
"{",
"sessionLock",
".",
"RUnlock",
"(",
")",
"\n",
"}",
"\n",
"cloned",
":=",
"sessions",
"[",
"addr",
"]",
".",
"Clone",
"(",
")",
"\n",
"runtime",
".",
"SetFinalizer",
"(",
"cloned",
",",
"sessionFinalizer",
")",
"\n",
"<mask>",
"=",
"&",
"Storage",
"{",
"session",
":",
"cloned",
",",
"dbname",
":",
"dbname",
",",
"}",
"\n",
"return",
"\n",
"}"
] |
10,469 | all-10470 | [
"UnmarshalJSON",
"supports",
"json",
".",
"Unmarshaler",
"interface"
] | [
"func",
"(",
"v",
"*",
"CreateIsolatedWorldReturns",
")",
"UnmarshalJSON",
"(",
"<mask>",
"[",
"]",
"byte",
")",
"error",
"{",
"r",
":=",
"jlexer",
".",
"Lexer",
"{",
"Data",
":",
"data",
"}",
"\n",
"easyjsonC5a4559bDecodeGithubComChromedpCdprotoPage72",
"(",
"&",
"r",
",",
"v",
")",
"\n",
"return",
"r",
".",
"Error",
"(",
")",
"\n",
"}"
] |
10,470 | all-10471 | [
"WithTemplatesFromStrings",
"adds",
"a",
"map",
"of",
"templates",
"parsed",
"from",
"strings",
"."
] | [
"func",
"WithTemplatesFromStrings",
"(",
"ts",
"map",
"[",
"string",
"]",
"[",
"]",
"string",
")",
"Option",
"{",
"return",
"func",
"(",
"o",
"*",
"Options",
")",
"{",
"for",
"<mask>",
",",
"strings",
":=",
"range",
"ts",
"{",
"o",
".",
"strings",
"[",
"name",
"]",
"=",
"strings",
"\n",
"}",
"\n",
"}",
"\n",
"}"
] |
10,471 | all-10472 | [
"WriteUint16",
"writes",
"a",
"big",
"endian",
"encoded",
"uint16",
"value",
"to",
"the",
"buffer"
] | [
"func",
"(",
"w",
"*",
"WriteBuffer",
")",
"WriteUint16",
"(",
"n",
"uint16",
")",
"{",
"if",
"b",
":=",
"w",
".",
"reserve",
"(",
"2",
")",
";",
"b",
"!=",
"nil",
"{",
"<mask>",
".",
"BigEndian",
".",
"PutUint16",
"(",
"b",
",",
"n",
")",
"\n",
"}",
"\n",
"}"
] |
10,472 | all-10473 | [
"MarshalJSON",
"supports",
"json",
".",
"Marshaler",
"interface"
] | [
"func",
"(",
"v",
"EventJavascriptDialogOpening",
")",
"MarshalJSON",
"(",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"w",
":=",
"jwriter",
".",
"Writer",
"{",
"}",
"\n",
"easyjsonC5a4559bEncodeGithubComChromedpCdprotoPage56",
"(",
"&",
"w",
",",
"v",
")",
"\n",
"return",
"w",
".",
"<mask>",
".",
"BuildBytes",
"(",
")",
",",
"w",
".",
"Error",
"\n",
"}"
] |
10,473 | all-10474 | [
"Parse",
"decodes",
"s",
"into",
"a",
"UUID",
"or",
"returns",
"an",
"error",
".",
"Both",
"the",
"standard",
"UUID",
"forms",
"of",
"xxxxxxxx",
"-",
"xxxx",
"-",
"xxxx",
"-",
"xxxx",
"-",
"xxxxxxxxxxxx",
"and",
"urn",
":",
"uuid",
":",
"xxxxxxxx",
"-",
"xxxx",
"-",
"xxxx",
"-",
"xxxx",
"-",
"xxxxxxxxxxxx",
"are",
"decoded",
"as",
"well",
"as",
"the",
"Microsoft",
"encoding",
"{",
"xxxxxxxx",
"-",
"xxxx",
"-",
"xxxx",
"-",
"xxxx",
"-",
"xxxxxxxxxxxx",
"}",
"and",
"the",
"raw",
"hex",
"encoding",
":",
"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
"."
] | [
"func",
"Parse",
"(",
"s",
"string",
")",
"(",
"UUID",
",",
"error",
")",
"{",
"var",
"uuid",
"UUID",
"\n",
"switch",
"len",
"(",
"s",
")",
"{",
"// xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
"case",
"36",
":",
"// urn:uuid:xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
"case",
"36",
"+",
"9",
":",
"if",
"strings",
".",
"ToLower",
"(",
"s",
"[",
":",
"9",
"]",
")",
"!=",
"\"",
"\"",
"{",
"return",
"uuid",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"s",
"[",
":",
"9",
"]",
")",
"\n",
"}",
"\n",
"s",
"=",
"s",
"[",
"9",
":",
"]",
"\n\n",
"// {xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx}",
"case",
"36",
"+",
"2",
":",
"s",
"=",
"s",
"[",
"1",
":",
"]",
"\n\n",
"// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
"case",
"32",
":",
"var",
"ok",
"bool",
"\n",
"for",
"i",
":=",
"range",
"uuid",
"{",
"uuid",
"[",
"i",
"]",
",",
"ok",
"=",
"xtob",
"(",
"s",
"[",
"i",
"*",
"2",
"]",
",",
"s",
"[",
"i",
"*",
"2",
"+",
"1",
"]",
")",
"\n",
"if",
"!",
"ok",
"{",
"return",
"uuid",
",",
"errors",
".",
"New",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"uuid",
",",
"nil",
"\n",
"default",
":",
"return",
"uuid",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"len",
"(",
"s",
")",
")",
"\n",
"}",
"\n",
"// s is now at least 36 bytes long",
"// it must be of the form xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
"if",
"s",
"[",
"8",
"]",
"!=",
"'-'",
"||",
"s",
"[",
"13",
"]",
"!=",
"'-'",
"||",
"s",
"[",
"18",
"]",
"!=",
"'-'",
"||",
"s",
"[",
"23",
"]",
"!=",
"'-'",
"{",
"return",
"uuid",
",",
"errors",
".",
"New",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"for",
"i",
",",
"x",
":=",
"range",
"[",
"16",
"]",
"int",
"{",
"0",
",",
"2",
",",
"4",
",",
"6",
",",
"9",
",",
"11",
",",
"14",
",",
"16",
",",
"19",
",",
"21",
",",
"24",
",",
"26",
",",
"28",
",",
"30",
",",
"32",
",",
"34",
"}",
"{",
"v",
",",
"<mask>",
":=",
"xtob",
"(",
"s",
"[",
"x",
"]",
",",
"s",
"[",
"x",
"+",
"1",
"]",
")",
"\n",
"if",
"!",
"ok",
"{",
"return",
"uuid",
",",
"errors",
".",
"New",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"uuid",
"[",
"i",
"]",
"=",
"v",
"\n",
"}",
"\n",
"return",
"uuid",
",",
"nil",
"\n",
"}"
] |
10,474 | all-10475 | [
"NewUniqueStringsValue",
"implements",
"string",
"slice",
"as",
"flag",
".",
"Value",
"interface",
".",
"Given",
"value",
"is",
"to",
"be",
"separated",
"by",
"comma",
".",
"The",
"values",
"are",
"set",
"in",
"order",
"."
] | [
"func",
"NewUniqueStringsValue",
"(",
"s",
"string",
")",
"(",
"us",
"*",
"UniqueStringsValue",
")",
"{",
"us",
"=",
"&",
"UniqueStringsValue",
"{",
"Values",
":",
"make",
"(",
"map",
"[",
"string",
"]",
"struct",
"{",
"}",
")",
"}",
"\n",
"if",
"s",
"==",
"\"",
"\"",
"{",
"return",
"us",
"\n",
"}",
"\n",
"if",
"err",
":=",
"us",
".",
"<mask>",
"(",
"s",
")",
";",
"err",
"!=",
"nil",
"{",
"plog",
".",
"Panicf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"}",
"\n",
"return",
"us",
"\n",
"}"
] |
10,475 | all-10476 | [
"Is",
"the",
"broker",
"valid",
"(",
"active",
"supports",
"check",
"type",
"and",
"reachable",
")"
] | [
"func",
"(",
"cm",
"*",
"CheckManager",
")",
"isValidBroker",
"(",
"broker",
"*",
"api",
".",
"Broker",
")",
"bool",
"{",
"var",
"brokerHost",
"string",
"\n",
"var",
"brokerPort",
"string",
"\n\n",
"if",
"broker",
".",
"Type",
"!=",
"\"",
"\"",
"&&",
"broker",
".",
"Type",
"!=",
"\"",
"\"",
"{",
"return",
"false",
"\n",
"}",
"\n\n",
"<mask>",
":=",
"false",
"\n\n",
"for",
"_",
",",
"detail",
":=",
"range",
"broker",
".",
"Details",
"{",
"detail",
":=",
"detail",
"\n\n",
"// broker must be active",
"if",
"detail",
".",
"Status",
"!=",
"statusActive",
"{",
"if",
"cm",
".",
"Debug",
"{",
"cm",
".",
"Log",
".",
"Printf",
"(",
"\"",
"\\n",
"\"",
",",
"broker",
".",
"Name",
")",
"\n",
"}",
"\n",
"continue",
"\n",
"}",
"\n\n",
"// broker must have module loaded for the check type to be used",
"if",
"!",
"cm",
".",
"brokerSupportsCheckType",
"(",
"cm",
".",
"checkType",
",",
"&",
"detail",
")",
"{",
"if",
"cm",
".",
"Debug",
"{",
"cm",
".",
"Log",
".",
"Printf",
"(",
"\"",
"\\n",
"\"",
",",
"broker",
".",
"Name",
",",
"cm",
".",
"checkType",
")",
"\n",
"}",
"\n",
"continue",
"\n",
"}",
"\n\n",
"if",
"detail",
".",
"ExternalPort",
"!=",
"0",
"{",
"brokerPort",
"=",
"strconv",
".",
"Itoa",
"(",
"int",
"(",
"detail",
".",
"ExternalPort",
")",
")",
"\n",
"}",
"else",
"{",
"if",
"detail",
".",
"Port",
"!=",
"nil",
"&&",
"*",
"detail",
".",
"Port",
"!=",
"0",
"{",
"brokerPort",
"=",
"strconv",
".",
"Itoa",
"(",
"int",
"(",
"*",
"detail",
".",
"Port",
")",
")",
"\n",
"}",
"else",
"{",
"brokerPort",
"=",
"\"",
"\"",
"\n",
"}",
"\n",
"}",
"\n\n",
"if",
"detail",
".",
"ExternalHost",
"!=",
"nil",
"&&",
"*",
"detail",
".",
"ExternalHost",
"!=",
"\"",
"\"",
"{",
"brokerHost",
"=",
"*",
"detail",
".",
"ExternalHost",
"\n",
"}",
"else",
"if",
"detail",
".",
"IP",
"!=",
"nil",
"&&",
"*",
"detail",
".",
"IP",
"!=",
"\"",
"\"",
"{",
"brokerHost",
"=",
"*",
"detail",
".",
"IP",
"\n",
"}",
"\n\n",
"if",
"brokerHost",
"==",
"\"",
"\"",
"{",
"cm",
".",
"Log",
".",
"Printf",
"(",
"\"",
"\"",
",",
"broker",
".",
"Name",
",",
"detail",
".",
"CN",
")",
"\n",
"continue",
"\n",
"}",
"\n\n",
"if",
"brokerHost",
"==",
"\"",
"\"",
"&&",
"brokerPort",
"!=",
"\"",
"\"",
"{",
"brokerPort",
"=",
"\"",
"\"",
"\n",
"}",
"\n\n",
"retries",
":=",
"5",
"\n",
"for",
"attempt",
":=",
"1",
";",
"attempt",
"<=",
"retries",
";",
"attempt",
"++",
"{",
"// broker must be reachable and respond within designated time",
"conn",
",",
"err",
":=",
"net",
".",
"DialTimeout",
"(",
"\"",
"\"",
",",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"brokerHost",
",",
"brokerPort",
")",
",",
"cm",
".",
"brokerMaxResponseTime",
")",
"\n",
"if",
"err",
"==",
"nil",
"{",
"conn",
".",
"Close",
"(",
")",
"\n",
"valid",
"=",
"true",
"\n",
"break",
"\n",
"}",
"\n\n",
"cm",
".",
"Log",
".",
"Printf",
"(",
"\"",
"\"",
",",
"broker",
".",
"Name",
",",
"err",
",",
"attempt",
",",
"retries",
")",
"\n",
"time",
".",
"Sleep",
"(",
"2",
"*",
"time",
".",
"Second",
")",
"\n",
"}",
"\n\n",
"if",
"valid",
"{",
"if",
"cm",
".",
"Debug",
"{",
"cm",
".",
"Log",
".",
"Printf",
"(",
"\"",
"\\n",
"\"",
",",
"broker",
".",
"Name",
")",
"\n",
"}",
"\n",
"break",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"valid",
"\n",
"}"
] |
10,476 | all-10477 | [
"NewClient",
"creates",
"a",
"Client",
"."
] | [
"func",
"NewClient",
"(",
"nick",
",",
"serverHost",
"string",
",",
"serverPort",
"uint16",
")",
"*",
"Client",
"{",
"return",
"&",
"Client",
"{",
"nick",
":",
"nick",
",",
"serverHost",
":",
"serverHost",
",",
"serverPort",
":",
"serverPort",
",",
"writeTimeout",
":",
"30",
"*",
"time",
".",
"Second",
",",
"readTimeout",
":",
"100",
"*",
"time",
".",
"Millisecond",
",",
"channels",
":",
"<mask>",
"[",
"string",
"]",
"struct",
"{",
"}",
"{",
"}",
",",
"mutex",
":",
"&",
"sync",
".",
"Mutex",
"{",
"}",
",",
"}",
"\n",
"}"
] |
10,477 | all-10478 | [
"UpdateId",
"is",
"a",
"convenience",
"helper",
"equivalent",
"to",
":",
"err",
":",
"=",
"collection",
".",
"Update",
"(",
"bson",
".",
"M",
"{",
"_id",
":",
"id",
"}",
"update",
")",
"See",
"the",
"Update",
"method",
"for",
"more",
"details",
"."
] | [
"func",
"(",
"c",
"*",
"Collection",
")",
"UpdateId",
"(",
"id",
"interface",
"{",
"}",
",",
"update",
"interface",
"{",
"}",
")",
"error",
"{",
"return",
"c",
".",
"Update",
"(",
"bson",
".",
"D",
"{",
"{",
"\"",
"\"",
",",
"<mask>",
"}",
"}",
",",
"update",
")",
"\n",
"}"
] |
10,478 | all-10479 | [
"Alertf",
"logs",
"provided",
"message",
"with",
"formatting",
"in",
"ALERT",
"level",
"."
] | [
"func",
"(",
"logger",
"*",
"Logger",
")",
"Alertf",
"(",
"<mask>",
"string",
",",
"a",
"...",
"interface",
"{",
"}",
")",
"{",
"logger",
".",
"log",
"(",
"ALERT",
",",
"format",
",",
"a",
"...",
")",
"\n",
"}"
] |
10,479 | all-10480 | [
"GitHubClient",
"returns",
"a",
"GitHub",
"client",
"."
] | [
"func",
"(",
"o",
"*",
"GitHubOptions",
")",
"GitHubClient",
"(",
"secretAgent",
"*",
"<mask>",
".",
"Agent",
",",
"dryRun",
"bool",
")",
"(",
"client",
"*",
"github",
".",
"Client",
",",
"err",
"error",
")",
"{",
"return",
"o",
".",
"GitHubClientWithLogFields",
"(",
"secretAgent",
",",
"dryRun",
",",
"logrus",
".",
"Fields",
"{",
"}",
")",
"\n",
"}"
] |
10,480 | all-10481 | [
"ValidatePolicyConfigurationScope",
"checks",
"that",
"scope",
"is",
"a",
"valid",
"name",
"for",
"a",
"signature",
".",
"PolicyTransportScopes",
"keys",
"(",
"i",
".",
"e",
".",
"a",
"valid",
"PolicyConfigurationIdentity",
"()",
"or",
"PolicyConfigurationNamespaces",
"()",
"return",
"value",
")",
".",
"It",
"is",
"acceptable",
"to",
"allow",
"an",
"invalid",
"value",
"which",
"will",
"never",
"be",
"matched",
"it",
"can",
"only",
"cause",
"user",
"confusion",
".",
"scope",
"passed",
"to",
"this",
"function",
"will",
"not",
"be",
"that",
"value",
"is",
"always",
"allowed",
"."
] | [
"func",
"(",
"t",
"ostreeTransport",
")",
"ValidatePolicyConfigurationScope",
"(",
"scope",
"string",
")",
"error",
"{",
"sep",
":=",
"strings",
".",
"Index",
"(",
"<mask>",
",",
"\"",
"\"",
")",
"\n",
"if",
"sep",
"<",
"0",
"{",
"return",
"errors",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"scope",
")",
"\n",
"}",
"\n",
"repo",
":=",
"scope",
"[",
":",
"sep",
"]",
"\n\n",
"if",
"!",
"strings",
".",
"HasPrefix",
"(",
"repo",
",",
"\"",
"\"",
")",
"{",
"return",
"errors",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"scope",
")",
"\n",
"}",
"\n",
"cleaned",
":=",
"filepath",
".",
"Clean",
"(",
"repo",
")",
"\n",
"if",
"cleaned",
"!=",
"repo",
"{",
"return",
"errors",
".",
"Errorf",
"(",
"`Invalid ostree: scope %s: Uses non-canonical path format, perhaps try with path %s`",
",",
"scope",
",",
"cleaned",
")",
"\n",
"}",
"\n\n",
"// FIXME? In the namespaces within a repo,",
"// we could be verifying the various character set and length restrictions",
"// from docker/distribution/reference.regexp.go, but other than that there",
"// are few semantically invalid strings.",
"return",
"nil",
"\n",
"}"
] |
10,481 | all-10482 | [
"ValueFromRequest",
"returns",
"the",
"value",
"of",
"a",
"field",
"in",
"the",
"http",
"request",
".",
"The",
"boolean",
"value",
"is",
"set",
"to",
"true",
"if",
"the",
"field",
"exists",
"in",
"the",
"query",
"."
] | [
"func",
"ValueFromRequest",
"(",
"r",
"*",
"http",
".",
"Request",
",",
"field",
"string",
")",
"(",
"string",
",",
"bool",
")",
"{",
"<mask>",
":=",
"r",
".",
"URL",
".",
"Query",
"(",
")",
"\n",
"_",
",",
"exists",
":=",
"values",
"[",
"field",
"]",
"\n",
"return",
"values",
".",
"Get",
"(",
"field",
")",
",",
"exists",
"\n",
"}"
] |
10,482 | all-10483 | [
"CreateServer",
"creates",
"a",
"server",
"from",
"a",
"jason",
"[]",
"byte",
"and",
"returns",
"a",
"Instance",
"struct"
] | [
"func",
"(",
"c",
"*",
"Client",
")",
"CreateServer",
"(",
"dcid",
"string",
",",
"server",
"Server",
")",
"(",
"*",
"Server",
",",
"error",
")",
"{",
"<mask>",
":=",
"serverColPath",
"(",
"dcid",
")",
"+",
"`?depth=`",
"+",
"c",
".",
"client",
".",
"depth",
"+",
"`&pretty=`",
"+",
"strconv",
".",
"FormatBool",
"(",
"c",
".",
"client",
".",
"pretty",
")",
"\n",
"ret",
":=",
"&",
"Server",
"{",
"}",
"\n",
"err",
":=",
"c",
".",
"client",
".",
"Post",
"(",
"url",
",",
"server",
",",
"ret",
",",
"http",
".",
"StatusAccepted",
")",
"\n",
"return",
"ret",
",",
"err",
"\n",
"}"
] |
10,483 | all-10484 | [
"Find",
"the",
"starting",
"point",
"of",
"the",
"region",
"R1",
".",
"R1",
"is",
"the",
"region",
"after",
"the",
"first",
"non",
"-",
"vowel",
"following",
"a",
"vowel",
"or",
"is",
"the",
"null",
"region",
"at",
"the",
"end",
"of",
"the",
"word",
"if",
"there",
"is",
"no",
"such",
"non",
"-",
"vowel",
".",
"R2",
"is",
"not",
"used",
"in",
"Norwegian",
"See",
"http",
":",
"//",
"snowball",
".",
"tartarus",
".",
"org",
"/",
"texts",
"/",
"r1r2",
".",
"html"
] | [
"func",
"r1",
"(",
"word",
"*",
"snowballword",
".",
"SnowballWord",
")",
"(",
"r1start",
"int",
")",
"{",
"// Like the German R1, the length of the Norwegian R1 is adjusted to be at least three.",
"r1start",
"=",
"romance",
".",
"VnvSuffix",
"(",
"<mask>",
",",
"isLowerVowel",
",",
"0",
")",
"\n",
"if",
"r1start",
"<",
"3",
"&&",
"len",
"(",
"word",
".",
"RS",
")",
">=",
"3",
"{",
"r1start",
"=",
"3",
"\n",
"}",
"\n",
"return",
"\n",
"}"
] |
10,484 | all-10485 | [
"Execute",
"the",
"text",
"template",
"with",
"the",
"data",
"derived",
"from",
"the",
"request",
"and",
"return",
"a",
"string",
"."
] | [
"func",
"(",
"mw",
"*",
"AccessLogApacheMiddleware",
")",
"executeTextTemplate",
"(",
"util",
"*",
"accessLogUtil",
")",
"string",
"{",
"buf",
":=",
"bytes",
".",
"NewBufferString",
"(",
"\"",
"\"",
")",
"\n",
"err",
":=",
"mw",
".",
"textTemplate",
".",
"Execute",
"(",
"buf",
",",
"util",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"panic",
"(",
"err",
")",
"\n",
"}",
"\n",
"return",
"buf",
".",
"<mask>",
"(",
")",
"\n",
"}"
] |
10,485 | all-10486 | [
"UnmarshalJSON",
"supports",
"json",
".",
"Unmarshaler",
"interface"
] | [
"func",
"(",
"v",
"*",
"EventWorkerRegistrationUpdated",
")",
"UnmarshalJSON",
"(",
"data",
"[",
"]",
"byte",
")",
"error",
"{",
"r",
":=",
"jlexer",
".",
"Lexer",
"{",
"Data",
":",
"<mask>",
"}",
"\n",
"easyjsonC5a4559bDecodeGithubComChromedpCdprotoServiceworker11",
"(",
"&",
"r",
",",
"v",
")",
"\n",
"return",
"r",
".",
"Error",
"(",
")",
"\n",
"}"
] |
10,486 | all-10487 | [
"Parse",
"parses",
"a",
"string",
"starting",
"with",
"a",
"dotted",
"version",
"and",
"returns",
"it",
"."
] | [
"func",
"Parse",
"(",
"s",
"string",
")",
"(",
"*",
"DottedVersion",
",",
"<mask>",
")",
"{",
"r",
",",
"_",
":=",
"regexp",
".",
"Compile",
"(",
"`^([0-9]+.[0-9]+(.[0-9]+))?.*`",
")",
"\n",
"matches",
":=",
"r",
".",
"FindAllStringSubmatch",
"(",
"s",
",",
"-",
"1",
")",
"\n",
"if",
"len",
"(",
"matches",
"[",
"0",
"]",
")",
"<",
"2",
"{",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"return",
"NewDottedVersion",
"(",
"matches",
"[",
"0",
"]",
"[",
"1",
"]",
")",
"\n",
"}"
] |
10,487 | all-10488 | [
"RemoveAllNetworkAdapters",
"deletes",
"all",
"network",
"adapters",
"from",
"a",
"VM",
"."
] | [
"func",
"(",
"v",
"*",
"VM",
")",
"RemoveAllNetworkAdapters",
"(",
")",
"error",
"{",
"vmxPath",
",",
"err",
":=",
"v",
".",
"VmxPath",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"vmx",
",",
"err",
":=",
"readVmx",
"(",
"vmxPath",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"for",
"key",
":=",
"range",
"vmx",
"{",
"if",
"strings",
".",
"HasPrefix",
"(",
"key",
",",
"\"",
"\"",
")",
"{",
"delete",
"(",
"vmx",
",",
"<mask>",
")",
"\n",
"}",
"\n",
"}",
"\n\n",
"return",
"writeVmx",
"(",
"vmxPath",
",",
"vmx",
")",
"\n",
"}"
] |
10,488 | all-10489 | [
"SliceF",
"is",
"the",
"filter",
"for",
"Slice",
"."
] | [
"func",
"SliceF",
"(",
"start",
",",
"<mask>",
"int",
")",
"func",
"(",
"string",
")",
"string",
"{",
"return",
"func",
"(",
"s",
"string",
")",
"string",
"{",
"return",
"Slice",
"(",
"s",
",",
"start",
",",
"end",
")",
"\n",
"}",
"\n",
"}"
] |
10,489 | all-10490 | [
"LoadExceptionsFromFile",
"loads",
"exceptions",
"from",
"a",
"YAML",
"file",
"."
] | [
"func",
"(",
"s",
"*",
"Seekret",
")",
"LoadExceptionsFromFile",
"(",
"file",
"string",
")",
"error",
"{",
"var",
"exceptionYamlList",
"[",
"]",
"exceptionYaml",
"\n\n",
"if",
"file",
"==",
"\"",
"\"",
"{",
"return",
"nil",
"\n",
"}",
"\n\n",
"filename",
",",
"_",
":=",
"filepath",
".",
"Abs",
"(",
"<mask>",
")",
"\n",
"yamlData",
",",
"err",
":=",
"ioutil",
".",
"ReadFile",
"(",
"filename",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"err",
"=",
"yaml",
".",
"Unmarshal",
"(",
"yamlData",
",",
"&",
"exceptionYamlList",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"for",
"_",
",",
"v",
":=",
"range",
"exceptionYamlList",
"{",
"x",
":=",
"models",
".",
"NewException",
"(",
")",
"\n\n",
"if",
"v",
".",
"Rule",
"!=",
"nil",
"{",
"err",
":=",
"x",
".",
"SetRule",
"(",
"*",
"v",
".",
"Rule",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"}",
"\n\n",
"if",
"v",
".",
"Object",
"!=",
"nil",
"{",
"err",
":=",
"x",
".",
"SetObject",
"(",
"*",
"v",
".",
"Object",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"}",
"\n\n",
"if",
"v",
".",
"Line",
"!=",
"nil",
"{",
"err",
":=",
"x",
".",
"SetNline",
"(",
"*",
"v",
".",
"Line",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"}",
"\n\n",
"if",
"v",
".",
"Content",
"!=",
"nil",
"{",
"err",
":=",
"x",
".",
"SetContent",
"(",
"*",
"v",
".",
"Content",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"}",
"\n\n",
"s",
".",
"AddException",
"(",
"*",
"x",
")",
"\n",
"}",
"\n\n",
"return",
"nil",
"\n",
"}"
] |
10,490 | all-10491 | [
"delimit",
"the",
"boundaries",
"of",
"a",
"query",
"object"
] | [
"func",
"BeginQuery",
"(",
"target",
"uint32",
",",
"id",
"uint32",
")",
"{",
"syscall",
".",
"Syscall",
"(",
"gpBeginQuery",
",",
"2",
",",
"uintptr",
"(",
"<mask>",
")",
",",
"uintptr",
"(",
"id",
")",
",",
"0",
")",
"\n",
"}"
] |
10,491 | all-10492 | [
"ChildSetProperty",
"is",
"a",
"wrapper",
"around",
"gtk_container_child_set_property",
"()",
"."
] | [
"func",
"(",
"v",
"*",
"Container",
")",
"ChildSetProperty",
"(",
"child",
"IWidget",
",",
"name",
"string",
",",
"value",
"interface",
"{",
"}",
")",
"error",
"{",
"gv",
",",
"e",
":=",
"glib",
".",
"GValue",
"(",
"<mask>",
")",
"\n",
"if",
"e",
"!=",
"nil",
"{",
"return",
"e",
"\n",
"}",
"\n",
"cstr",
":=",
"C",
".",
"CString",
"(",
"name",
")",
"\n",
"defer",
"C",
".",
"free",
"(",
"unsafe",
".",
"Pointer",
"(",
"cstr",
")",
")",
"\n\n",
"C",
".",
"gtk_container_child_set_property",
"(",
"v",
".",
"native",
"(",
")",
",",
"child",
".",
"toWidget",
"(",
")",
",",
"(",
"*",
"C",
".",
"gchar",
")",
"(",
"cstr",
")",
",",
"(",
"*",
"C",
".",
"GValue",
")",
"(",
"unsafe",
".",
"Pointer",
"(",
"gv",
".",
"Native",
"(",
")",
")",
")",
")",
"\n",
"return",
"nil",
"\n",
"}"
] |
10,492 | all-10493 | [
"makePipelineInfoCommit",
"is",
"a",
"helper",
"for",
"CreatePipeline",
"that",
"creates",
"a",
"commit",
"with",
"pipelineInfo",
"in",
"SpecRepo",
"(",
"in",
"PFS",
")",
".",
"It",
"s",
"called",
"in",
"both",
"the",
"case",
"where",
"a",
"user",
"is",
"updating",
"a",
"pipeline",
"and",
"the",
"case",
"where",
"a",
"user",
"is",
"creating",
"a",
"new",
"pipeline",
"."
] | [
"func",
"(",
"a",
"*",
"apiServer",
")",
"makePipelineInfoCommit",
"(",
"pachClient",
"*",
"<mask>",
".",
"APIClient",
",",
"pipelineInfo",
"*",
"pps",
".",
"PipelineInfo",
")",
"(",
"result",
"*",
"pfs",
".",
"Commit",
",",
"retErr",
"error",
")",
"{",
"pipelineName",
":=",
"pipelineInfo",
".",
"Pipeline",
".",
"Name",
"\n",
"var",
"commit",
"*",
"pfs",
".",
"Commit",
"\n",
"if",
"err",
":=",
"a",
".",
"sudo",
"(",
"pachClient",
",",
"func",
"(",
"superUserClient",
"*",
"client",
".",
"APIClient",
")",
"error",
"{",
"data",
",",
"err",
":=",
"pipelineInfo",
".",
"Marshal",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"}",
"\n",
"if",
"_",
",",
"err",
"=",
"superUserClient",
".",
"PutFileOverwrite",
"(",
"ppsconsts",
".",
"SpecRepo",
",",
"pipelineName",
",",
"ppsconsts",
".",
"SpecFile",
",",
"bytes",
".",
"NewReader",
"(",
"data",
")",
",",
"0",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"branchInfo",
",",
"err",
":=",
"superUserClient",
".",
"InspectBranch",
"(",
"ppsconsts",
".",
"SpecRepo",
",",
"pipelineName",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"commit",
"=",
"branchInfo",
".",
"Head",
"\n",
"return",
"nil",
"\n",
"}",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"return",
"commit",
",",
"nil",
"\n",
"}"
] |
10,493 | all-10494 | [
"Filters",
"parses",
"all",
"filtering",
"statement",
"defined",
"for",
"the",
"given",
"entity",
".",
"It",
"returns",
"all",
"supported",
"combinations",
"of",
"filters",
"sorted",
"by",
"number",
"of",
"criteria",
"."
] | [
"func",
"Filters",
"(",
"pkg",
"*",
"ast",
".",
"Package",
",",
"entity",
"string",
")",
"[",
"]",
"[",
"]",
"string",
"{",
"objects",
":=",
"pkg",
".",
"Scope",
".",
"Objects",
"\n",
"filters",
":=",
"[",
"]",
"[",
"]",
"string",
"{",
"}",
"\n\n",
"prefix",
":=",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"entity",
")",
"\n\n",
"for",
"name",
":=",
"range",
"objects",
"{",
"if",
"!",
"strings",
".",
"HasPrefix",
"(",
"name",
",",
"prefix",
")",
"{",
"continue",
"\n",
"}",
"\n",
"rest",
":=",
"name",
"[",
"len",
"(",
"prefix",
")",
":",
"]",
"\n",
"filters",
"=",
"append",
"(",
"filters",
",",
"strings",
".",
"Split",
"(",
"<mask>",
",",
"\"",
"\"",
")",
")",
"\n",
"}",
"\n\n",
"sort",
".",
"SliceStable",
"(",
"filters",
",",
"func",
"(",
"i",
",",
"j",
"int",
")",
"bool",
"{",
"return",
"len",
"(",
"filters",
"[",
"i",
"]",
")",
">",
"len",
"(",
"filters",
"[",
"j",
"]",
")",
"\n",
"}",
")",
"\n\n",
"return",
"filters",
"\n",
"}"
] |
10,494 | all-10495 | [
"GetContextId",
"()",
"is",
"a",
"wrapper",
"around",
"gtk_statusbar_get_context_id",
"()",
"."
] | [
"func",
"(",
"v",
"*",
"Statusbar",
")",
"GetContextId",
"(",
"contextDescription",
"string",
")",
"uint",
"{",
"cstr",
":=",
"C",
".",
"CString",
"(",
"contextDescription",
")",
"\n",
"defer",
"C",
".",
"<mask>",
"(",
"unsafe",
".",
"Pointer",
"(",
"cstr",
")",
")",
"\n",
"c",
":=",
"C",
".",
"gtk_statusbar_get_context_id",
"(",
"v",
".",
"native",
"(",
")",
",",
"(",
"*",
"C",
".",
"gchar",
")",
"(",
"cstr",
")",
")",
"\n",
"return",
"uint",
"(",
"c",
")",
"\n",
"}"
] |
10,495 | all-10496 | [
"DatabaseServers",
"retrieves",
"a",
"list",
"of",
"all",
"database",
"servers"
] | [
"func",
"(",
"c",
"*",
"<mask>",
")",
"DatabaseServers",
"(",
")",
"(",
"[",
"]",
"DatabaseServer",
",",
"error",
")",
"{",
"var",
"dbs",
"[",
"]",
"DatabaseServer",
"\n",
"_",
",",
"err",
":=",
"c",
".",
"MakeApiRequest",
"(",
"\"",
"\"",
",",
"\"",
"\"",
",",
"nil",
",",
"&",
"dbs",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"return",
"dbs",
",",
"err",
"\n",
"}"
] |
10,496 | all-10497 | [
"Inspect",
"returns",
"various",
"information",
"for",
"(",
"skopeo",
"inspect",
")",
"parsed",
"from",
"the",
"manifest",
"and",
"configuration",
"."
] | [
"func",
"(",
"m",
"*",
"OCI1",
")",
"Inspect",
"(",
"configGetter",
"func",
"(",
"types",
".",
"BlobInfo",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
")",
"(",
"*",
"<mask>",
".",
"ImageInspectInfo",
",",
"error",
")",
"{",
"config",
",",
"err",
":=",
"configGetter",
"(",
"m",
".",
"ConfigInfo",
"(",
")",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"v1",
":=",
"&",
"imgspecv1",
".",
"Image",
"{",
"}",
"\n",
"if",
"err",
":=",
"json",
".",
"Unmarshal",
"(",
"config",
",",
"v1",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"d1",
":=",
"&",
"Schema2V1Image",
"{",
"}",
"\n",
"json",
".",
"Unmarshal",
"(",
"config",
",",
"d1",
")",
"\n",
"i",
":=",
"&",
"types",
".",
"ImageInspectInfo",
"{",
"Tag",
":",
"\"",
"\"",
",",
"Created",
":",
"v1",
".",
"Created",
",",
"DockerVersion",
":",
"d1",
".",
"DockerVersion",
",",
"Labels",
":",
"v1",
".",
"Config",
".",
"Labels",
",",
"Architecture",
":",
"v1",
".",
"Architecture",
",",
"Os",
":",
"v1",
".",
"OS",
",",
"Layers",
":",
"layerInfosToStrings",
"(",
"m",
".",
"LayerInfos",
"(",
")",
")",
",",
"}",
"\n",
"return",
"i",
",",
"nil",
"\n",
"}"
] |
10,497 | all-10498 | [
"StrEnvDef",
"get",
"environment",
"variable",
"or",
"some",
"default",
"def"
] | [
"func",
"StrEnvDef",
"(",
"env",
"string",
",",
"def",
"string",
")",
"string",
"{",
"val",
":=",
"<mask>",
".",
"Getenv",
"(",
"env",
")",
"\n",
"if",
"val",
"==",
"\"",
"\"",
"{",
"return",
"def",
"\n",
"}",
"\n",
"return",
"val",
"\n",
"}"
] |
10,498 | all-10499 | [
"Implementing",
"http",
"handler",
"interface",
".",
"This",
"is",
"a",
"override",
"of",
"Router",
".",
"ServeHTTP",
"for",
"handling",
"middlewares"
] | [
"func",
"(",
"c4",
"*",
"Seefor",
")",
"ServeHTTP",
"(",
"w",
"http",
".",
"ResponseWriter",
",",
"req",
"*",
"http",
".",
"Request",
")",
"{",
"started",
":=",
"time",
".",
"Now",
"(",
")",
"\n",
"c4",
".",
"handleBeforeMiddlewares",
"(",
"http",
".",
"HandlerFunc",
"(",
"func",
"(",
"w",
"http",
".",
"ResponseWriter",
",",
"req",
"*",
"http",
".",
"Request",
")",
"{",
"beforeEnd",
":=",
"time",
".",
"Now",
"(",
")",
"\n",
"if",
"root",
",",
"exist",
":=",
"c4",
".",
"roots",
"[",
"req",
".",
"Method",
"]",
";",
"exist",
"{",
"handler",
",",
"params",
",",
"route",
":=",
"root",
".",
"match",
"(",
"req",
".",
"URL",
".",
"Path",
")",
"\n",
"if",
"handler",
"!=",
"nil",
"{",
"if",
"c4",
".",
"timer",
"!=",
"nil",
"{",
"after",
":=",
"time",
".",
"Now",
"(",
")",
"\n",
"c4",
".",
"handleAfterMiddlewares",
"(",
"handler",
",",
"w",
",",
"req",
",",
"params",
")",
"\n",
"c4",
".",
"<mask>",
".",
"Get",
"(",
"route",
")",
".",
"Accumulate",
"(",
"started",
",",
"beforeEnd",
",",
"after",
",",
"time",
".",
"Now",
"(",
")",
")",
"\n",
"}",
"else",
"{",
"c4",
".",
"handleAfterMiddlewares",
"(",
"handler",
",",
"w",
",",
"req",
",",
"params",
")",
"\n",
"}",
"\n",
"return",
"\n",
"}",
"\n",
"}",
"\n",
"c4",
".",
"Router",
".",
"handleMissing",
"(",
"w",
",",
"req",
")",
"\n",
"}",
")",
",",
"w",
",",
"req",
")",
"\n",
"}"
] |
10,499 | all-10500 | [
"Delete",
"deletes",
"the",
"instance",
"settings",
"for",
"a",
"given",
"instance",
"ID",
"."
] | [
"func",
"(",
"c",
"*",
"FakeClient",
")",
"Delete",
"(",
"instanceID",
"string",
")",
"error",
"{",
"c",
".",
"DeleteCalled",
"=",
"<mask>",
"\n",
"return",
"c",
".",
"DeleteErr",
"\n",
"}"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.