id
int32 0
25.3k
| idx
stringlengths 5
9
| nl_tokens
sequencelengths 1
418
| pl_tokens
sequencelengths 22
4.98k
|
---|---|---|---|
22,700 | all-22701 | [
"MustAddMessageError",
"calls",
"AddMessageError",
"and",
"panics",
"in",
"case",
"of",
"an",
"error",
"."
] | [
"func",
"(",
"r",
"*",
"MapErrorRegistry",
")",
"MustAddMessageError",
"(",
"code",
"int",
",",
"message",
"string",
")",
"*",
"<mask>",
"{",
"err",
",",
"e",
":=",
"r",
".",
"AddMessageError",
"(",
"code",
",",
"message",
")",
"\n",
"if",
"e",
"!=",
"nil",
"{",
"panic",
"(",
"e",
")",
"\n",
"}",
"\n",
"return",
"err",
"\n",
"}"
] |
22,701 | all-22702 | [
"ConvertPathToChildPath",
"is",
"a",
"wrapper",
"around",
"gtk_tree_model_filter_convert_path_to_child_path",
"()",
"."
] | [
"func",
"(",
"v",
"*",
"TreeModelFilter",
")",
"ConvertPathToChildPath",
"(",
"filterPath",
"*",
"TreePath",
")",
"*",
"TreePath",
"{",
"path",
":=",
"C",
".",
"gtk_tree_model_filter_convert_path_to_child_path",
"(",
"v",
".",
"native",
"(",
")",
",",
"filterPath",
".",
"native",
"(",
")",
")",
"\n",
"if",
"path",
"==",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n\n",
"p",
":=",
"&",
"TreePath",
"{",
"<mask>",
"}",
"\n",
"runtime",
".",
"SetFinalizer",
"(",
"p",
",",
"(",
"*",
"TreePath",
")",
".",
"free",
")",
"\n\n",
"return",
"p",
"\n",
"}"
] |
22,702 | all-22703 | [
"gboolean",
"pango_font_description_equal",
"(",
"const",
"PangoFontDescription",
"*",
"desc1",
"const",
"PangoFontDescription",
"*",
"desc2",
")",
"G_GNUC_PURE",
";"
] | [
"func",
"(",
"v",
"*",
"FontDescription",
")",
"Equal",
"(",
"v2",
"*",
"FontDescription",
")",
"bool",
"{",
"c",
":=",
"C",
".",
"pango_font_description_equal",
"(",
"v",
".",
"native",
"(",
")",
",",
"v2",
".",
"native",
"(",
")",
")",
"\n",
"<mask>",
"gobool",
"(",
"c",
")",
"\n",
"}"
] |
22,703 | all-22704 | [
"Get",
"stores",
"in",
"a",
"the",
"Lua",
"value",
"indexed",
"at",
"the",
"sequence",
"of",
"subfields",
".",
"a",
"must",
"be",
"a",
"pointer",
"as",
"in",
"LuaToGo",
"."
] | [
"func",
"(",
"lo",
"*",
"LuaObject",
")",
"Get",
"(",
"a",
"interface",
"{",
"}",
",",
"subfields",
"...",
"<mask>",
"{",
"}",
")",
"error",
"{",
"lo",
".",
"Push",
"(",
")",
"\n",
"defer",
"lo",
".",
"l",
".",
"Pop",
"(",
"1",
")",
"\n",
"err",
":=",
"get",
"(",
"lo",
".",
"l",
",",
"subfields",
"...",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"defer",
"lo",
".",
"l",
".",
"Pop",
"(",
"1",
")",
"\n",
"return",
"LuaToGo",
"(",
"lo",
".",
"l",
",",
"-",
"1",
",",
"a",
")",
"\n",
"}"
] |
22,704 | all-22705 | [
"runAndSkipJobs",
"executes",
"the",
"config",
".",
"Presubmits",
"that",
"are",
"requested",
"and",
"posts",
"skipped",
"statuses",
"for",
"the",
"reporting",
"jobs",
"that",
"are",
"skipped"
] | [
"func",
"runAndSkipJobs",
"(",
"c",
"<mask>",
",",
"pr",
"*",
"github",
".",
"PullRequest",
",",
"requestedJobs",
"[",
"]",
"config",
".",
"Presubmit",
",",
"skippedJobs",
"[",
"]",
"config",
".",
"Presubmit",
",",
"eventGUID",
"string",
",",
"elideSkippedContexts",
"bool",
")",
"error",
"{",
"if",
"err",
":=",
"validateContextOverlap",
"(",
"requestedJobs",
",",
"skippedJobs",
")",
";",
"err",
"!=",
"nil",
"{",
"c",
".",
"Logger",
".",
"WithError",
"(",
"err",
")",
".",
"Warn",
"(",
"\"",
"\"",
")",
"\n",
"return",
"err",
"\n",
"}",
"\n",
"runErr",
":=",
"RunRequested",
"(",
"c",
",",
"pr",
",",
"requestedJobs",
",",
"eventGUID",
")",
"\n",
"var",
"skipErr",
"error",
"\n",
"if",
"!",
"elideSkippedContexts",
"{",
"skipErr",
"=",
"skipRequested",
"(",
"c",
",",
"pr",
",",
"skippedJobs",
")",
"\n",
"}",
"\n\n",
"return",
"errorutil",
".",
"NewAggregate",
"(",
"runErr",
",",
"skipErr",
")",
"\n",
"}"
] |
22,705 | all-22706 | [
"MarshalEasyJSON",
"satisfies",
"easyjson",
".",
"Marshaler",
"."
] | [
"func",
"(",
"t",
"TransitionType",
")",
"MarshalEasyJSON",
"(",
"out",
"*",
"jwriter",
".",
"Writer",
")",
"{",
"<mask>",
".",
"String",
"(",
"string",
"(",
"t",
")",
")",
"\n",
"}"
] |
22,706 | all-22707 | [
"ListNamespaces",
"returns",
"all",
"namespaces",
"matching",
"defined",
"namespace",
"filter"
] | [
"func",
"(",
"p",
"*",
"AWSSDProvider",
")",
"ListNamespaces",
"(",
")",
"(",
"[",
"]",
"*",
"sd",
".",
"NamespaceSummary",
",",
"error",
")",
"{",
"namespaces",
":=",
"make",
"(",
"[",
"]",
"*",
"sd",
".",
"NamespaceSummary",
",",
"0",
")",
"\n\n",
"f",
":=",
"func",
"(",
"resp",
"*",
"sd",
".",
"ListNamespacesOutput",
",",
"lastPage",
"bool",
")",
"bool",
"{",
"for",
"_",
",",
"ns",
":=",
"range",
"resp",
".",
"Namespaces",
"{",
"if",
"!",
"p",
".",
"namespaceFilter",
".",
"Match",
"(",
"aws",
".",
"StringValue",
"(",
"<mask>",
".",
"Name",
")",
")",
"{",
"continue",
"\n",
"}",
"\n",
"namespaces",
"=",
"append",
"(",
"namespaces",
",",
"ns",
")",
"\n",
"}",
"\n\n",
"return",
"true",
"\n",
"}",
"\n\n",
"err",
":=",
"p",
".",
"client",
".",
"ListNamespacesPages",
"(",
"&",
"sd",
".",
"ListNamespacesInput",
"{",
"Filters",
":",
"[",
"]",
"*",
"sd",
".",
"NamespaceFilter",
"{",
"p",
".",
"namespaceTypeFilter",
"}",
",",
"}",
",",
"f",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"return",
"namespaces",
",",
"nil",
"\n",
"}"
] |
22,707 | all-22708 | [
"CreateOrUpdateUser",
"should",
"be",
"only",
"used",
"for",
"creating",
"the",
"new",
"user",
"or",
"when",
"you",
"are",
"not",
"sure",
"if",
"it",
"is",
"a",
"create",
"or",
"update",
".",
"(",
"When",
"only",
"password",
"is",
"passed",
"in",
"we",
"are",
"not",
"sure",
"if",
"it",
"is",
"a",
"update",
"or",
"create",
")"
] | [
"func",
"(",
"s",
"*",
"store",
")",
"CreateOrUpdateUser",
"(",
"user",
"User",
")",
"(",
"out",
"User",
",",
"created",
"bool",
",",
"err",
"error",
")",
"{",
"_",
",",
"err",
"=",
"s",
".",
"getUser",
"(",
"user",
".",
"User",
",",
"true",
")",
"\n",
"if",
"err",
"==",
"nil",
"{",
"out",
",",
"err",
"=",
"s",
".",
"UpdateUser",
"(",
"<mask>",
")",
"\n",
"return",
"out",
",",
"false",
",",
"err",
"\n",
"}",
"\n",
"u",
",",
"err",
":=",
"s",
".",
"CreateUser",
"(",
"user",
")",
"\n",
"return",
"u",
",",
"true",
",",
"err",
"\n",
"}"
] |
22,708 | all-22709 | [
"HasStyle",
"returns",
"a",
"boolean",
"if",
"a",
"field",
"has",
"been",
"set",
"."
] | [
"func",
"(",
"t",
"*",
"TileDefRequest",
")",
"HasStyle",
"(",
")",
"bool",
"{",
"if",
"t",
"!=",
"nil",
"&&",
"t",
".",
"Style",
"!=",
"nil",
"{",
"return",
"<mask>",
"\n",
"}",
"\n\n",
"return",
"false",
"\n",
"}"
] |
22,709 | all-22710 | [
"InitPachOnlyEnv",
"initializes",
"this",
"service",
"environment",
".",
"This",
"dials",
"a",
"GRPC",
"connection",
"to",
"pachd",
"only",
"(",
"in",
"a",
"background",
"goroutine",
")",
"and",
"creates",
"the",
"template",
"pachClient",
"used",
"by",
"future",
"calls",
"to",
"GetPachClient",
".",
"This",
"call",
"returns",
"immediately",
"but",
"GetPachClient",
"will",
"block",
"until",
"the",
"client",
"is",
"ready",
"."
] | [
"func",
"InitPachOnlyEnv",
"(",
"config",
"*",
"Configuration",
")",
"*",
"ServiceEnv",
"{",
"env",
":=",
"&",
"ServiceEnv",
"{",
"Configuration",
":",
"config",
"}",
"\n",
"env",
".",
"pachAddress",
"=",
"<mask>",
".",
"JoinHostPort",
"(",
"\"",
"\"",
",",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"env",
".",
"PeerPort",
")",
")",
"\n",
"env",
".",
"pachEg",
".",
"Go",
"(",
"env",
".",
"initPachClient",
")",
"\n",
"return",
"env",
"// env is not ready yet",
"\n",
"}"
] |
22,710 | all-22711 | [
"Post",
"sends",
"POST",
"request",
"to",
"the",
"given",
"url",
"with",
"the",
"given",
"POST",
"arguments",
".",
"The",
"contents",
"of",
"dst",
"will",
"be",
"replaced",
"by",
"the",
"body",
"and",
"returned",
"if",
"the",
"dst",
"is",
"too",
"small",
"a",
"new",
"slice",
"will",
"be",
"allocated",
".",
"The",
"function",
"follows",
"redirects",
".",
"Use",
"Do",
"*",
"for",
"manually",
"handling",
"redirects",
".",
"Empty",
"POST",
"body",
"is",
"sent",
"if",
"postArgs",
"is",
"nil",
"."
] | [
"func",
"(",
"c",
"*",
"<mask>",
")",
"Post",
"(",
"dst",
"[",
"]",
"byte",
",",
"url",
"string",
",",
"postArgs",
"*",
"Args",
")",
"(",
"statusCode",
"int",
",",
"body",
"[",
"]",
"byte",
",",
"err",
"error",
")",
"{",
"return",
"clientPostURL",
"(",
"dst",
",",
"url",
",",
"postArgs",
",",
"c",
")",
"\n",
"}"
] |
22,711 | all-22712 | [
"Down",
"brings",
"down",
"all",
"endpoints",
"and",
"stops",
"serving",
"HTTP",
"requests",
"."
] | [
"func",
"(",
"e",
"*",
"Endpoints",
")",
"Down",
"(",
")",
"error",
"{",
"e",
".",
"mu",
".",
"Lock",
"(",
")",
"\n",
"defer",
"e",
".",
"mu",
".",
"Unlock",
"(",
")",
"\n\n",
"if",
"e",
".",
"listeners",
"[",
"network",
"]",
"!=",
"nil",
"||",
"e",
".",
"listeners",
"[",
"local",
"]",
"!=",
"nil",
"{",
"logger",
".",
"Infof",
"(",
"\"",
"\"",
")",
"\n",
"err",
":=",
"e",
".",
"closeListener",
"(",
"network",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"err",
"=",
"e",
".",
"closeListener",
"(",
"<mask>",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"}",
"\n\n",
"if",
"e",
".",
"listeners",
"[",
"cluster",
"]",
"!=",
"nil",
"{",
"logger",
".",
"Infof",
"(",
"\"",
"\"",
")",
"\n",
"err",
":=",
"e",
".",
"closeListener",
"(",
"cluster",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"}",
"\n\n",
"if",
"e",
".",
"listeners",
"[",
"devlxd",
"]",
"!=",
"nil",
"{",
"logger",
".",
"Infof",
"(",
"\"",
"\"",
")",
"\n",
"err",
":=",
"e",
".",
"closeListener",
"(",
"devlxd",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"}",
"\n\n",
"if",
"e",
".",
"listeners",
"[",
"pprof",
"]",
"!=",
"nil",
"{",
"logger",
".",
"Infof",
"(",
"\"",
"\"",
")",
"\n",
"err",
":=",
"e",
".",
"closeListener",
"(",
"pprof",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"}",
"\n\n",
"if",
"e",
".",
"tomb",
"!=",
"nil",
"{",
"e",
".",
"tomb",
".",
"Kill",
"(",
"nil",
")",
"\n",
"e",
".",
"tomb",
".",
"Wait",
"(",
")",
"\n",
"}",
"\n\n",
"return",
"nil",
"\n",
"}"
] |
22,712 | all-22713 | [
"loadConfig",
"loads",
"one",
"or",
"multiple",
"config",
"files",
"and",
"returns",
"a",
"config",
"object",
"."
] | [
"func",
"loadConfig",
"(",
"prowConfig",
",",
"jobConfig",
"string",
")",
"(",
"*",
"Config",
",",
"error",
")",
"{",
"stat",
",",
"err",
":=",
"os",
".",
"Stat",
"(",
"prowConfig",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"if",
"stat",
".",
"IsDir",
"(",
")",
"{",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"prowConfig",
")",
"\n",
"}",
"\n\n",
"<mask>",
"nc",
"Config",
"\n",
"if",
"err",
":=",
"yamlToConfig",
"(",
"prowConfig",
",",
"&",
"nc",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"if",
"err",
":=",
"parseProwConfig",
"(",
"&",
"nc",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"// TODO(krzyzacy): temporary allow empty jobconfig",
"// also temporary allow job config in prow config",
"if",
"jobConfig",
"==",
"\"",
"\"",
"{",
"return",
"&",
"nc",
",",
"nil",
"\n",
"}",
"\n\n",
"stat",
",",
"err",
"=",
"os",
".",
"Stat",
"(",
"jobConfig",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"if",
"!",
"stat",
".",
"IsDir",
"(",
")",
"{",
"// still support a single file",
"var",
"jc",
"JobConfig",
"\n",
"if",
"err",
":=",
"yamlToConfig",
"(",
"jobConfig",
",",
"&",
"jc",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"if",
"err",
":=",
"nc",
".",
"mergeJobConfig",
"(",
"jc",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"return",
"&",
"nc",
",",
"nil",
"\n",
"}",
"\n\n",
"// we need to ensure all config files have unique basenames,",
"// since updateconfig plugin will use basename as a key in the configmap",
"uniqueBasenames",
":=",
"sets",
".",
"String",
"{",
"}",
"\n\n",
"err",
"=",
"filepath",
".",
"Walk",
"(",
"jobConfig",
",",
"func",
"(",
"path",
"string",
",",
"info",
"os",
".",
"FileInfo",
",",
"err",
"error",
")",
"error",
"{",
"if",
"err",
"!=",
"nil",
"{",
"logrus",
".",
"WithError",
"(",
"err",
")",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"path",
")",
"\n",
"// bad file should not stop us from parsing the directory",
"return",
"nil",
"\n",
"}",
"\n\n",
"if",
"strings",
".",
"HasPrefix",
"(",
"info",
".",
"Name",
"(",
")",
",",
"\"",
"\"",
")",
"{",
"// kubernetes volumes also include files we",
"// should not look be looking into for keys",
"if",
"info",
".",
"IsDir",
"(",
")",
"{",
"return",
"filepath",
".",
"SkipDir",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}",
"\n\n",
"if",
"filepath",
".",
"Ext",
"(",
"path",
")",
"!=",
"\"",
"\"",
"&&",
"filepath",
".",
"Ext",
"(",
"path",
")",
"!=",
"\"",
"\"",
"{",
"return",
"nil",
"\n",
"}",
"\n\n",
"if",
"info",
".",
"IsDir",
"(",
")",
"{",
"return",
"nil",
"\n",
"}",
"\n\n",
"base",
":=",
"filepath",
".",
"Base",
"(",
"path",
")",
"\n",
"if",
"uniqueBasenames",
".",
"Has",
"(",
"base",
")",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"base",
")",
"\n",
"}",
"\n",
"uniqueBasenames",
".",
"Insert",
"(",
"base",
")",
"\n\n",
"var",
"subConfig",
"JobConfig",
"\n",
"if",
"err",
":=",
"yamlToConfig",
"(",
"path",
",",
"&",
"subConfig",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"return",
"nc",
".",
"mergeJobConfig",
"(",
"subConfig",
")",
"\n",
"}",
")",
"\n\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"return",
"&",
"nc",
",",
"nil",
"\n",
"}"
] |
22,713 | all-22714 | [
"Topic",
"sets",
"the",
"channel",
"c",
"topic",
"(",
"requires",
"bot",
"has",
"proper",
"permissions",
")"
] | [
"func",
"(",
"bot",
"*",
"Bot",
")",
"Topic",
"(",
"c",
",",
"<mask>",
"string",
")",
"{",
"str",
":=",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"c",
",",
"topic",
")",
"\n",
"bot",
".",
"Send",
"(",
"str",
")",
"\n",
"}"
] |
22,714 | all-22715 | [
"UnmarshalJSON",
"supports",
"json",
".",
"Unmarshaler",
"interface"
] | [
"func",
"(",
"v",
"*",
"SetPageScaleFactorParams",
")",
"UnmarshalJSON",
"(",
"data",
"[",
"]",
"<mask>",
")",
"error",
"{",
"r",
":=",
"jlexer",
".",
"Lexer",
"{",
"Data",
":",
"data",
"}",
"\n",
"easyjsonC5a4559bDecodeGithubComChromedpCdprotoEmulation6",
"(",
"&",
"r",
",",
"v",
")",
"\n",
"return",
"r",
".",
"Error",
"(",
")",
"\n",
"}"
] |
22,715 | all-22716 | [
"Concat",
"multiplies",
"a",
"color",
"matrix",
"with",
"the",
"other",
"color",
"matrix",
".",
"This",
"is",
"same",
"as",
"muptiplying",
"the",
"matrix",
"other",
"and",
"the",
"matrix",
"c",
"in",
"this",
"order",
"."
] | [
"func",
"(",
"c",
"*",
"ColorM",
")",
"Concat",
"(",
"other",
"*",
"ColorM",
")",
"*",
"ColorM",
"{",
"if",
"!",
"c",
".",
"isInited",
"(",
")",
"{",
"return",
"other",
"\n",
"}",
"\n",
"if",
"!",
"other",
".",
"isInited",
"(",
")",
"{",
"return",
"c",
"\n",
"}",
"\n\n",
"lhsb",
":=",
"colorMIdentityBody",
"\n",
"lhst",
":=",
"colorMIdentityTranslate",
"\n",
"rhsb",
":=",
"colorMIdentityBody",
"\n",
"rhst",
":=",
"colorMIdentityTranslate",
"\n",
"if",
"other",
".",
"isInited",
"(",
")",
"{",
"if",
"other",
".",
"body",
"!=",
"nil",
"{",
"lhsb",
"=",
"other",
".",
"body",
"\n",
"}",
"\n",
"if",
"<mask>",
".",
"translate",
"!=",
"nil",
"{",
"lhst",
"=",
"other",
".",
"translate",
"\n",
"}",
"\n",
"}",
"\n",
"if",
"c",
".",
"isInited",
"(",
")",
"{",
"if",
"c",
".",
"body",
"!=",
"nil",
"{",
"rhsb",
"=",
"c",
".",
"body",
"\n",
"}",
"\n",
"if",
"c",
".",
"translate",
"!=",
"nil",
"{",
"rhst",
"=",
"c",
".",
"translate",
"\n",
"}",
"\n",
"}",
"\n\n",
"return",
"&",
"ColorM",
"{",
"// TODO: This is a temporary hack to calculate multiply of transposed matrices.",
"// Fix mulSquare implmentation and swap the arguments.",
"body",
":",
"mulSquare",
"(",
"rhsb",
",",
"lhsb",
",",
"ColorMDim",
"-",
"1",
")",
",",
"translate",
":",
"[",
"]",
"float32",
"{",
"lhsb",
"[",
"0",
"]",
"*",
"rhst",
"[",
"0",
"]",
"+",
"lhsb",
"[",
"4",
"]",
"*",
"rhst",
"[",
"1",
"]",
"+",
"lhsb",
"[",
"8",
"]",
"*",
"rhst",
"[",
"2",
"]",
"+",
"lhsb",
"[",
"12",
"]",
"*",
"rhst",
"[",
"3",
"]",
"+",
"lhst",
"[",
"0",
"]",
",",
"lhsb",
"[",
"1",
"]",
"*",
"rhst",
"[",
"0",
"]",
"+",
"lhsb",
"[",
"5",
"]",
"*",
"rhst",
"[",
"1",
"]",
"+",
"lhsb",
"[",
"9",
"]",
"*",
"rhst",
"[",
"2",
"]",
"+",
"lhsb",
"[",
"13",
"]",
"*",
"rhst",
"[",
"3",
"]",
"+",
"lhst",
"[",
"1",
"]",
",",
"lhsb",
"[",
"2",
"]",
"*",
"rhst",
"[",
"0",
"]",
"+",
"lhsb",
"[",
"6",
"]",
"*",
"rhst",
"[",
"1",
"]",
"+",
"lhsb",
"[",
"10",
"]",
"*",
"rhst",
"[",
"2",
"]",
"+",
"lhsb",
"[",
"14",
"]",
"*",
"rhst",
"[",
"3",
"]",
"+",
"lhst",
"[",
"2",
"]",
",",
"lhsb",
"[",
"3",
"]",
"*",
"rhst",
"[",
"0",
"]",
"+",
"lhsb",
"[",
"7",
"]",
"*",
"rhst",
"[",
"1",
"]",
"+",
"lhsb",
"[",
"11",
"]",
"*",
"rhst",
"[",
"2",
"]",
"+",
"lhsb",
"[",
"15",
"]",
"*",
"rhst",
"[",
"3",
"]",
"+",
"lhst",
"[",
"3",
"]",
",",
"}",
",",
"}",
"\n",
"}"
] |
22,716 | all-22717 | [
"Update",
"updates",
"a",
"ResourcePool",
"."
] | [
"func",
"Update",
"(",
"rp",
"*",
"object",
".",
"ResourcePool",
",",
"name",
"string",
",",
"spec",
"*",
"types",
".",
"ResourceConfigSpec",
")",
"error",
"{",
"log",
".",
"Printf",
"(",
"\"",
"\"",
",",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"rp",
".",
"InventoryPath",
")",
")",
"\n",
"ctx",
",",
"cancel",
":=",
"context",
".",
"WithTimeout",
"(",
"<mask>",
".",
"Background",
"(",
")",
",",
"provider",
".",
"DefaultAPITimeout",
")",
"\n",
"defer",
"cancel",
"(",
")",
"\n",
"return",
"rp",
".",
"UpdateConfig",
"(",
"ctx",
",",
"name",
",",
"spec",
")",
"\n",
"}"
] |
22,717 | all-22718 | [
"Debugf",
"formats",
"message",
"according",
"to",
"format",
"specifier",
"prepends",
"the",
"prefix",
"as",
"necessary",
"and",
"writes",
"to",
"log",
"with",
"LevelDebug",
".",
"This",
"is",
"part",
"of",
"the",
"Logger",
"interface",
"implementation",
"."
] | [
"func",
"(",
"l",
"*",
"slog",
")",
"Debugf",
"(",
"format",
"string",
",",
"args",
"...",
"<mask>",
"{",
"}",
")",
"{",
"lvl",
":=",
"l",
".",
"Level",
"(",
")",
"\n",
"if",
"lvl",
"<=",
"LevelDebug",
"{",
"l",
".",
"b",
".",
"printf",
"(",
"\"",
"\"",
",",
"l",
".",
"tag",
",",
"format",
",",
"args",
"...",
")",
"\n",
"}",
"\n",
"}"
] |
22,718 | all-22719 | [
"ServerCertPath",
"returns",
"the",
"path",
"for",
"the",
"remote",
"s",
"server",
"certificate"
] | [
"func",
"(",
"c",
"*",
"Config",
")",
"ServerCertPath",
"(",
"<mask>",
"string",
")",
"string",
"{",
"return",
"c",
".",
"ConfigPath",
"(",
"\"",
"\"",
",",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"remote",
")",
")",
"\n",
"}"
] |
22,719 | all-22720 | [
"Strings",
"flattens",
"the",
"aggregate",
"(",
"and",
"any",
"sub",
"aggregates",
")",
"into",
"a",
"slice",
"of",
"strings",
"."
] | [
"func",
"(",
"agg",
"aggregate",
")",
"Strings",
"(",
")",
"[",
"]",
"string",
"{",
"strs",
":=",
"<mask>",
"(",
"[",
"]",
"string",
",",
"0",
",",
"len",
"(",
"agg",
")",
")",
"\n",
"for",
"_",
",",
"e",
":=",
"range",
"agg",
"{",
"if",
"subAgg",
",",
"ok",
":=",
"e",
".",
"(",
"aggregate",
")",
";",
"ok",
"{",
"strs",
"=",
"append",
"(",
"strs",
",",
"subAgg",
".",
"Strings",
"(",
")",
"...",
")",
"\n",
"}",
"else",
"{",
"strs",
"=",
"append",
"(",
"strs",
",",
"e",
".",
"Error",
"(",
")",
")",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"strs",
"\n",
"}"
] |
22,720 | all-22721 | [
"NewHMACSigner",
"creates",
"a",
"HMAC",
"Signer",
"for",
"the",
"specified",
"Algorithm",
"."
] | [
"func",
"NewHMACSigner",
"(",
"alg",
"Algorithm",
")",
"func",
"(",
"Store",
",",
"crypto",
".",
"Hash",
")",
"(",
"Signer",
",",
"error",
")",
"{",
"return",
"func",
"(",
"store",
"Store",
",",
"hash",
"crypto",
".",
"Hash",
")",
"(",
"Signer",
",",
"error",
")",
"{",
"var",
"ok",
"bool",
"\n",
"var",
"keyRaw",
"<mask>",
"{",
"}",
"\n",
"var",
"key",
"[",
"]",
"byte",
"\n\n",
"// check private key",
"if",
"keyRaw",
",",
"ok",
"=",
"store",
".",
"PrivateKey",
"(",
")",
";",
"!",
"ok",
"{",
"return",
"nil",
",",
"ErrMissingPrivateKey",
"\n",
"}",
"\n\n",
"// check key type",
"if",
"key",
",",
"ok",
"=",
"keyRaw",
".",
"(",
"[",
"]",
"byte",
")",
";",
"!",
"ok",
"{",
"return",
"nil",
",",
"ErrInvalidPrivateKey",
"\n",
"}",
"\n\n",
"return",
"&",
"HmacSigner",
"{",
"alg",
":",
"alg",
",",
"hash",
":",
"hash",
",",
"key",
":",
"key",
",",
"}",
",",
"nil",
"\n",
"}",
"\n",
"}"
] |
22,721 | all-22722 | [
"FetchContactGroup",
"retrieves",
"contact",
"group",
"with",
"passed",
"cid",
"."
] | [
"func",
"(",
"a",
"*",
"API",
")",
"FetchContactGroup",
"(",
"cid",
"CIDType",
")",
"(",
"*",
"ContactGroup",
",",
"error",
")",
"{",
"if",
"cid",
"==",
"nil",
"||",
"*",
"cid",
"==",
"\"",
"\"",
"{",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"groupCID",
":=",
"string",
"(",
"*",
"cid",
")",
"\n\n",
"<mask>",
",",
"err",
":=",
"regexp",
".",
"MatchString",
"(",
"config",
".",
"ContactGroupCIDRegex",
",",
"groupCID",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"if",
"!",
"matched",
"{",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"groupCID",
")",
"\n",
"}",
"\n\n",
"result",
",",
"err",
":=",
"a",
".",
"Get",
"(",
"groupCID",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"if",
"a",
".",
"Debug",
"{",
"a",
".",
"Log",
".",
"Printf",
"(",
"\"",
"\"",
",",
"string",
"(",
"result",
")",
")",
"\n",
"}",
"\n\n",
"group",
":=",
"new",
"(",
"ContactGroup",
")",
"\n",
"if",
"err",
":=",
"json",
".",
"Unmarshal",
"(",
"result",
",",
"group",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"return",
"group",
",",
"nil",
"\n",
"}"
] |
22,722 | all-22723 | [
"NewPatternLinear",
"is",
"a",
"wrapper",
"around",
"cairo_pattern_create_linear",
"()",
"."
] | [
"func",
"NewPatternLinear",
"(",
"x0",
",",
"y0",
",",
"x1",
",",
"y1",
"float64",
")",
"(",
"*",
"<mask>",
",",
"error",
")",
"{",
"c",
":=",
"C",
".",
"cairo_pattern_create_linear",
"(",
"C",
".",
"double",
"(",
"x0",
")",
",",
"C",
".",
"double",
"(",
"y0",
")",
",",
"C",
".",
"double",
"(",
"x1",
")",
",",
"C",
".",
"double",
"(",
"y1",
")",
")",
"\n",
"return",
"newPatternFromNative",
"(",
"c",
")",
"\n",
"}"
] |
22,723 | all-22724 | [
"MarshalJSON",
"supports",
"json",
".",
"Marshaler",
"interface"
] | [
"func",
"(",
"v",
"EventSinksUpdated",
")",
"MarshalJSON",
"(",
")",
"(",
"[",
"]",
"<mask>",
",",
"error",
")",
"{",
"w",
":=",
"jwriter",
".",
"Writer",
"{",
"}",
"\n",
"easyjsonC5a4559bEncodeGithubComChromedpCdprotoCast3",
"(",
"&",
"w",
",",
"v",
")",
"\n",
"return",
"w",
".",
"Buffer",
".",
"BuildBytes",
"(",
")",
",",
"w",
".",
"Error",
"\n",
"}"
] |
22,724 | all-22725 | [
"Subject",
"is",
"an",
"Option",
"that",
"sets",
"a",
"identity",
"s",
"subject",
"field",
"."
] | [
"func",
"Subject",
"(",
"value",
"pkix",
".",
"<mask>",
")",
"Option",
"{",
"return",
"func",
"(",
"c",
"*",
"configuration",
")",
"{",
"c",
".",
"subject",
"=",
"&",
"value",
"\n",
"}",
"\n",
"}"
] |
22,725 | all-22726 | [
"Backtick",
"produces",
"a",
"backticked",
"literal",
"given",
"an",
"input",
"string",
"."
] | [
"func",
"Backtick",
"(",
"in",
"string",
")",
"string",
"{",
"<mask>",
"buf",
"bytes",
".",
"Buffer",
"\n",
"buf",
".",
"WriteByte",
"(",
"'`'",
")",
"\n",
"for",
"_",
",",
"c",
":=",
"range",
"in",
"{",
"buf",
".",
"WriteRune",
"(",
"c",
")",
"\n",
"if",
"c",
"==",
"'`'",
"{",
"buf",
".",
"WriteByte",
"(",
"'`'",
")",
"\n",
"}",
"\n",
"}",
"\n",
"buf",
".",
"WriteByte",
"(",
"'`'",
")",
"\n",
"return",
"buf",
".",
"String",
"(",
")",
"\n",
"}"
] |
22,726 | all-22727 | [
"UnmarshalJSON",
"supports",
"json",
".",
"Unmarshaler",
"interface"
] | [
"func",
"(",
"v",
"*",
"EventAnimationCanceled",
")",
"UnmarshalJSON",
"(",
"data",
"[",
"]",
"byte",
")",
"error",
"{",
"r",
":=",
"jlexer",
".",
"Lexer",
"{",
"Data",
":",
"data",
"}",
"\n",
"easyjsonC5a4559bDecodeGithubComChromedpCdprotoAnimation15",
"(",
"&",
"r",
",",
"v",
")",
"\n",
"return",
"r",
".",
"<mask>",
"(",
")",
"\n",
"}"
] |
22,727 | all-22728 | [
"SetPresubmitRegexes",
"compiles",
"and",
"validates",
"all",
"the",
"regular",
"expressions",
"for",
"the",
"provided",
"presubmits",
"."
] | [
"func",
"SetPresubmitRegexes",
"(",
"js",
"[",
"]",
"Presubmit",
")",
"error",
"{",
"for",
"i",
",",
"j",
":=",
"range",
"js",
"{",
"if",
"re",
",",
"err",
":=",
"regexp",
".",
"Compile",
"(",
"j",
".",
"Trigger",
")",
";",
"err",
"==",
"nil",
"{",
"js",
"[",
"i",
"]",
".",
"<mask>",
"=",
"re",
"\n",
"}",
"else",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"j",
".",
"Name",
",",
"err",
")",
"\n",
"}",
"\n",
"if",
"!",
"js",
"[",
"i",
"]",
".",
"re",
".",
"MatchString",
"(",
"j",
".",
"RerunCommand",
")",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\\\"",
"\\\"",
"\\\"",
"\\\"",
"\"",
",",
"j",
".",
"Name",
",",
"j",
".",
"RerunCommand",
",",
"j",
".",
"Trigger",
")",
"\n",
"}",
"\n",
"b",
",",
"err",
":=",
"setBrancherRegexes",
"(",
"j",
".",
"Brancher",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"j",
".",
"Name",
",",
"err",
")",
"\n",
"}",
"\n",
"js",
"[",
"i",
"]",
".",
"Brancher",
"=",
"b",
"\n\n",
"c",
",",
"err",
":=",
"setChangeRegexes",
"(",
"j",
".",
"RegexpChangeMatcher",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"j",
".",
"Name",
",",
"err",
")",
"\n",
"}",
"\n",
"js",
"[",
"i",
"]",
".",
"RegexpChangeMatcher",
"=",
"c",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
] |
22,728 | all-22729 | [
"UnmarshalJSON",
"supports",
"json",
".",
"Unmarshaler",
"interface"
] | [
"func",
"(",
"v",
"*",
"StopViolationsReportParams",
")",
"UnmarshalJSON",
"(",
"data",
"[",
"]",
"byte",
")",
"error",
"{",
"r",
":=",
"jlexer",
".",
"Lexer",
"{",
"Data",
":",
"<mask>",
"}",
"\n",
"easyjsonC5a4559bDecodeGithubComChromedpCdprotoLog1",
"(",
"&",
"r",
",",
"v",
")",
"\n",
"return",
"r",
".",
"Error",
"(",
")",
"\n",
"}"
] |
22,729 | all-22730 | [
"braceIndices",
"returns",
"the",
"first",
"level",
"curly",
"brace",
"indices",
"from",
"a",
"string",
".",
"It",
"returns",
"an",
"error",
"in",
"case",
"of",
"unbalanced",
"braces",
"."
] | [
"func",
"braceIndices",
"(",
"s",
"string",
")",
"(",
"[",
"]",
"int",
",",
"error",
")",
"{",
"var",
"level",
",",
"idx",
"int",
"\n",
"idxs",
":=",
"make",
"(",
"[",
"]",
"int",
",",
"0",
")",
"\n",
"for",
"i",
":=",
"0",
";",
"i",
"<",
"len",
"(",
"s",
")",
";",
"i",
"++",
"{",
"switch",
"s",
"[",
"i",
"]",
"{",
"case",
"'{'",
":",
"if",
"level",
"++",
";",
"level",
"==",
"1",
"{",
"idx",
"=",
"i",
"\n",
"}",
"\n",
"case",
"'}'",
":",
"if",
"level",
"--",
";",
"level",
"==",
"0",
"{",
"idxs",
"=",
"<mask>",
"(",
"idxs",
",",
"idx",
",",
"i",
"+",
"1",
")",
"\n",
"}",
"else",
"if",
"level",
"<",
"0",
"{",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"s",
")",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n",
"if",
"level",
"!=",
"0",
"{",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"s",
")",
"\n",
"}",
"\n",
"return",
"idxs",
",",
"nil",
"\n",
"}"
] |
22,730 | all-22731 | [
"SetEncoder",
"can",
"be",
"used",
"to",
"set",
"the",
"implementation",
"of",
"a",
"compression",
"algorithm",
".",
"The",
"encoding",
"should",
"be",
"a",
"standardised",
"identifier",
".",
"See",
":",
"https",
":",
"//",
"developer",
".",
"mozilla",
".",
"org",
"/",
"en",
"-",
"US",
"/",
"docs",
"/",
"Web",
"/",
"HTTP",
"/",
"Headers",
"/",
"Accept",
"-",
"Encoding",
"For",
"example",
"add",
"the",
"Brotli",
"algortithm",
":",
"import",
"brotli_enc",
"gopkg",
".",
"in",
"/",
"kothar",
"/",
"brotli",
"-",
"go",
".",
"v0",
"/",
"enc",
"compressor",
":",
"=",
"middleware",
".",
"NewCompressor",
"(",
"5",
"text",
"/",
"html",
")",
"compressor",
".",
"SetEncoder",
"(",
"br",
"func",
"(",
"w",
"http",
".",
"ResponseWriter",
"level",
"int",
")",
"io",
".",
"Writer",
"{",
"params",
":",
"=",
"brotli_enc",
".",
"NewBrotliParams",
"()",
"params",
".",
"SetQuality",
"(",
"level",
")",
"return",
"brotli_enc",
".",
"NewBrotliWriter",
"(",
"params",
"w",
")",
"}",
")"
] | [
"func",
"(",
"c",
"*",
"Compressor",
")",
"SetEncoder",
"(",
"encoding",
"string",
",",
"fn",
"EncoderFunc",
")",
"{",
"encoding",
"=",
"strings",
".",
"ToLower",
"(",
"encoding",
")",
"\n",
"if",
"encoding",
"==",
"\"",
"\"",
"{",
"panic",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"if",
"fn",
"==",
"nil",
"{",
"panic",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"// If we are adding a new encoder that is already registered, we have to",
"// clear that one out first.",
"if",
"_",
",",
"ok",
":=",
"c",
".",
"pooledEncoders",
"[",
"encoding",
"]",
";",
"ok",
"{",
"delete",
"(",
"c",
".",
"pooledEncoders",
",",
"encoding",
")",
"\n",
"}",
"\n",
"if",
"_",
",",
"ok",
":=",
"c",
".",
"encoders",
"[",
"encoding",
"]",
";",
"ok",
"{",
"delete",
"(",
"c",
".",
"encoders",
",",
"encoding",
")",
"\n",
"}",
"\n\n",
"// If the encoder supports Resetting (IoReseterWriter), then it can be pooled.",
"encoder",
":=",
"fn",
"(",
"ioutil",
".",
"Discard",
",",
"c",
".",
"level",
")",
"\n",
"if",
"encoder",
"!=",
"nil",
"{",
"if",
"_",
",",
"ok",
":=",
"encoder",
".",
"(",
"ioResetterWriter",
")",
";",
"ok",
"{",
"pool",
":=",
"&",
"sync",
".",
"Pool",
"{",
"New",
":",
"func",
"(",
")",
"interface",
"{",
"}",
"{",
"return",
"fn",
"(",
"ioutil",
".",
"Discard",
",",
"c",
".",
"level",
")",
"\n",
"}",
",",
"}",
"\n",
"c",
".",
"pooledEncoders",
"[",
"encoding",
"]",
"=",
"pool",
"\n",
"}",
"\n",
"}",
"\n",
"// If the encoder is not in the pooledEncoders, add it to the normal encoders.",
"if",
"_",
",",
"ok",
":=",
"c",
".",
"pooledEncoders",
"[",
"encoding",
"]",
";",
"!",
"ok",
"{",
"c",
".",
"encoders",
"[",
"encoding",
"]",
"=",
"fn",
"\n",
"}",
"\n\n",
"for",
"i",
",",
"v",
":=",
"<mask>",
"c",
".",
"encodingPrecedence",
"{",
"if",
"v",
"==",
"encoding",
"{",
"c",
".",
"encodingPrecedence",
"=",
"append",
"(",
"c",
".",
"encodingPrecedence",
"[",
":",
"i",
"]",
",",
"c",
".",
"encodingPrecedence",
"[",
"i",
"+",
"1",
":",
"]",
"...",
")",
"\n",
"}",
"\n",
"}",
"\n\n",
"c",
".",
"encodingPrecedence",
"=",
"append",
"(",
"[",
"]",
"string",
"{",
"encoding",
"}",
",",
"c",
".",
"encodingPrecedence",
"...",
")",
"\n",
"}"
] |
22,731 | all-22732 | [
"GenerateAccount",
"generates",
"new",
"private",
"key",
"and",
"creates",
"new",
"account",
"."
] | [
"func",
"(",
"h",
"*",
"<mask>",
")",
"GenerateAccount",
"(",
"tkn",
"string",
",",
"params",
"*",
"AccountParams",
")",
"(",
"*",
"string",
",",
"error",
")",
"{",
"logger",
":=",
"h",
".",
"logger",
".",
"Add",
"(",
"\"",
"\"",
",",
"\"",
"\"",
")",
"\n\n",
"if",
"!",
"h",
".",
"token",
".",
"Check",
"(",
"tkn",
")",
"{",
"logger",
".",
"Warn",
"(",
"\"",
"\"",
")",
"\n",
"return",
"nil",
",",
"ErrAccessDenied",
"\n",
"}",
"\n\n",
"account",
":=",
"params",
".",
"prefilledAccount",
"(",
")",
"\n\n",
"id",
",",
"err",
":=",
"h",
".",
"fillAndSaveAccount",
"(",
"logger",
",",
"account",
",",
"crypto",
".",
"GenerateKey",
",",
"false",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"return",
"&",
"id",
",",
"nil",
"\n",
"}"
] |
22,732 | all-22733 | [
"PartitionZones",
":",
"Method",
"returns",
"a",
"slice",
"of",
"zones",
"that",
"adhere",
"to",
"the",
"domain",
"filter",
"and",
"a",
"slice",
"of",
"ones",
"that",
"does",
"not",
"adhere",
"to",
"the",
"filter"
] | [
"func",
"(",
"c",
"*",
"PDNSAPIClient",
")",
"PartitionZones",
"(",
"zones",
"[",
"]",
"pgo",
".",
"Zone",
")",
"(",
"filteredZones",
"[",
"]",
"pgo",
".",
"Zone",
",",
"residualZones",
"[",
"]",
"pgo",
".",
"Zone",
")",
"{",
"if",
"c",
".",
"domainFilter",
".",
"IsConfigured",
"(",
")",
"{",
"for",
"_",
",",
"zone",
":=",
"range",
"zones",
"{",
"if",
"c",
".",
"domainFilter",
".",
"Match",
"(",
"zone",
".",
"Name",
")",
"{",
"filteredZones",
"=",
"<mask>",
"(",
"filteredZones",
",",
"zone",
")",
"\n",
"}",
"else",
"{",
"residualZones",
"=",
"append",
"(",
"residualZones",
",",
"zone",
")",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"else",
"{",
"filteredZones",
"=",
"zones",
"\n",
"}",
"\n",
"return",
"filteredZones",
",",
"residualZones",
"\n",
"}"
] |
22,733 | all-22734 | [
"MarshalJSON",
"supports",
"json",
".",
"Marshaler",
"interface"
] | [
"func",
"(",
"v",
"SetVirtualTimePolicyParams",
")",
"MarshalJSON",
"(",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"w",
":=",
"jwriter",
".",
"Writer",
"{",
"}",
"\n",
"easyjsonC5a4559bEncodeGithubComChromedpCdprotoEmulation1",
"(",
"&",
"w",
",",
"v",
")",
"\n",
"return",
"w",
".",
"Buffer",
".",
"BuildBytes",
"(",
")",
",",
"w",
".",
"<mask>",
"\n",
"}"
] |
22,734 | all-22735 | [
"/",
"*",
"SmartError",
"returns",
"the",
"right",
"error",
"message",
"based",
"on",
"err",
"."
] | [
"func",
"SmartError",
"(",
"err",
"error",
")",
"<mask>",
"{",
"switch",
"errors",
".",
"Cause",
"(",
"err",
")",
"{",
"case",
"nil",
":",
"return",
"EmptySyncResponse",
"\n",
"case",
"os",
".",
"ErrNotExist",
",",
"sql",
".",
"ErrNoRows",
",",
"db",
".",
"ErrNoSuchObject",
":",
"return",
"NotFound",
"(",
"nil",
")",
"\n",
"case",
"os",
".",
"ErrPermission",
":",
"return",
"Forbidden",
"(",
"nil",
")",
"\n",
"case",
"db",
".",
"ErrAlreadyDefined",
",",
"sqlite3",
".",
"ErrConstraintUnique",
":",
"return",
"Conflict",
"(",
"nil",
")",
"\n",
"case",
"dqlite",
".",
"ErrNoAvailableLeader",
":",
"return",
"Unavailable",
"(",
"err",
")",
"\n",
"default",
":",
"return",
"InternalError",
"(",
"err",
")",
"\n",
"}",
"\n",
"}"
] |
22,735 | all-22736 | [
"PFX",
"wraps",
"the",
"certificate",
"and",
"private",
"key",
"in",
"an",
"encrypted",
"PKCS#12",
"packet",
".",
"The",
"provided",
"password",
"must",
"be",
"alphanumeric",
"."
] | [
"func",
"(",
"id",
"*",
"Identity",
")",
"PFX",
"(",
"password",
"string",
")",
"[",
"]",
"byte",
"{",
"return",
"toPFX",
"(",
"id",
".",
"Certificate",
",",
"<mask>",
".",
"PrivateKey",
",",
"password",
")",
"\n",
"}"
] |
22,736 | all-22737 | [
"notifySubs",
"sends",
"a",
"given",
"message",
"to",
"all",
"corresponding",
"subscribers",
".",
"Only",
"called",
"from",
"processLoop",
"."
] | [
"func",
"(",
"p",
"*",
"PubSub",
")",
"notifySubs",
"(",
"msg",
"*",
"pb",
".",
"Message",
")",
"{",
"for",
"_",
",",
"topic",
":=",
"range",
"msg",
".",
"GetTopicIDs",
"(",
")",
"{",
"subs",
":=",
"p",
".",
"myTopics",
"[",
"topic",
"]",
"\n",
"for",
"f",
":=",
"range",
"subs",
"{",
"select",
"{",
"case",
"f",
".",
"ch",
"<-",
"&",
"<mask>",
"{",
"msg",
"}",
":",
"default",
":",
"log",
".",
"Infof",
"(",
"\"",
"\"",
",",
"topic",
")",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n",
"}"
] |
22,737 | all-22738 | [
"GetRandomPassword",
"mocks",
"base",
"method"
] | [
"func",
"(",
"m",
"*",
"MockSecretsManagerAPI",
")",
"GetRandomPassword",
"(",
"arg0",
"*",
"secretsmanager",
".",
"GetRandomPasswordInput",
")",
"(",
"*",
"secretsmanager",
".",
"GetRandomPasswordOutput",
",",
"error",
")",
"{",
"ret",
":=",
"m",
".",
"ctrl",
".",
"Call",
"(",
"m",
",",
"\"",
"\"",
",",
"arg0",
")",
"\n",
"ret0",
",",
"_",
":=",
"ret",
"[",
"0",
"]",
".",
"(",
"*",
"secretsmanager",
".",
"GetRandomPasswordOutput",
")",
"\n",
"ret1",
",",
"_",
":=",
"<mask>",
"[",
"1",
"]",
".",
"(",
"error",
")",
"\n",
"return",
"ret0",
",",
"ret1",
"\n",
"}"
] |
22,738 | all-22739 | [
"MarshalIndex",
"serializes",
"the",
"sitemap",
"index",
"to",
"XML",
"with",
"the",
"<sitemapindex",
">",
"xmlns",
"added",
"and",
"the",
"XML",
"preamble",
"prepended",
"."
] | [
"func",
"MarshalIndex",
"(",
"index",
"*",
"<mask>",
")",
"(",
"indexXML",
"[",
"]",
"byte",
",",
"err",
"error",
")",
"{",
"if",
"len",
"(",
"index",
".",
"Sitemaps",
")",
">",
"MaxSitemaps",
"{",
"err",
"=",
"ErrExceededMaxSitemaps",
"\n",
"return",
"\n",
"}",
"\n",
"index",
".",
"XMLNS",
"=",
"xmlns",
"\n",
"indexXML",
"=",
"[",
"]",
"byte",
"(",
"preamble",
")",
"\n",
"var",
"smiXML",
"[",
"]",
"byte",
"\n",
"smiXML",
",",
"err",
"=",
"xml",
".",
"Marshal",
"(",
"index",
")",
"\n",
"if",
"err",
"==",
"nil",
"{",
"indexXML",
"=",
"append",
"(",
"indexXML",
",",
"smiXML",
"...",
")",
"\n",
"}",
"\n",
"if",
"len",
"(",
"indexXML",
")",
">",
"MaxFileSize",
"{",
"err",
"=",
"ErrExceededMaxFileSize",
"\n",
"}",
"\n",
"return",
"\n",
"}"
] |
22,739 | all-22740 | [
"UserLogin",
"is",
"the",
"login",
"route",
"."
] | [
"func",
"UserLogin",
"(",
"c",
"*",
"gin",
".",
"Context",
")",
"{",
"c",
".",
"Header",
"(",
"\"",
"\"",
",",
"\"",
"\"",
")",
"\n\n",
"var",
"json",
"Login",
"\n",
"if",
"c",
".",
"BindJSON",
"(",
"&",
"json",
")",
"==",
"nil",
"{",
"user",
",",
"err",
":=",
"userRepository",
".",
"ByUsername",
"(",
"json",
".",
"User",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"c",
".",
"JSON",
"(",
"<mask>",
".",
"StatusNotFound",
",",
"gin",
".",
"H",
"{",
"\"",
"\"",
":",
"\"",
"\"",
"}",
")",
"\n",
"}",
"else",
"if",
"user",
".",
"Username",
"!=",
"json",
".",
"User",
"||",
"user",
".",
"Password",
"!=",
"json",
".",
"Password",
"{",
"c",
".",
"JSON",
"(",
"http",
".",
"StatusUnauthorized",
",",
"gin",
".",
"H",
"{",
"\"",
"\"",
":",
"\"",
"\"",
"}",
")",
"\n",
"}",
"else",
"{",
"c",
".",
"Header",
"(",
"\"",
"\"",
",",
"getAuthToken",
"(",
")",
")",
"\n",
"c",
".",
"JSON",
"(",
"http",
".",
"StatusOK",
",",
"types",
".",
"LoginResponse",
"{",
"User",
":",
"user",
"}",
")",
"\n",
"}",
"\n",
"}",
"\n",
"}"
] |
22,740 | all-22741 | [
"ReadFull",
"implements",
"io",
".",
"ReadFull",
"on",
"Reader",
"."
] | [
"func",
"(",
"r",
"*",
"Reader",
")",
"ReadFull",
"(",
"p",
"[",
"]",
"byte",
")",
"{",
"if",
"r",
".",
"err",
"!=",
"nil",
"{",
"return",
"\n",
"}",
"\n",
"<mask>",
"n",
"int",
"\n",
"n",
",",
"r",
".",
"err",
"=",
"io",
".",
"ReadFull",
"(",
"r",
".",
"rd",
",",
"p",
")",
"\n",
"r",
".",
"cnt",
"+=",
"n",
"\n",
"}"
] |
22,741 | all-22742 | [
"GetTransitionRunning",
"is",
"a",
"wrapper",
"around",
"gtk_stack_get_transition_running",
"()",
"."
] | [
"func",
"(",
"v",
"*",
"Stack",
")",
"GetTransitionRunning",
"(",
")",
"bool",
"{",
"c",
":=",
"C",
".",
"gtk_stack_get_transition_running",
"(",
"v",
".",
"native",
"(",
")",
")",
"\n",
"<mask>",
"gobool",
"(",
"c",
")",
"\n",
"}"
] |
22,742 | all-22743 | [
"newDir",
"creates",
"a",
"directory"
] | [
"func",
"newDir",
"(",
"store",
"*",
"store",
",",
"nodePath",
"string",
",",
"createdIndex",
"uint64",
",",
"<mask>",
"*",
"node",
",",
"expireTime",
"time",
".",
"Time",
")",
"*",
"node",
"{",
"return",
"&",
"node",
"{",
"Path",
":",
"nodePath",
",",
"CreatedIndex",
":",
"createdIndex",
",",
"ModifiedIndex",
":",
"createdIndex",
",",
"Parent",
":",
"parent",
",",
"ExpireTime",
":",
"expireTime",
",",
"Children",
":",
"make",
"(",
"map",
"[",
"string",
"]",
"*",
"node",
")",
",",
"store",
":",
"store",
",",
"}",
"\n",
"}"
] |
22,743 | all-22744 | [
"WithContext",
"adds",
"the",
"context",
"to",
"the",
"find",
"vms",
"by",
"states",
"params"
] | [
"func",
"(",
"o",
"*",
"FindVmsByStatesParams",
")",
"WithContext",
"(",
"ctx",
"<mask>",
".",
"Context",
")",
"*",
"FindVmsByStatesParams",
"{",
"o",
".",
"SetContext",
"(",
"ctx",
")",
"\n",
"return",
"o",
"\n",
"}"
] |
22,744 | all-22745 | [
"MustGetString",
"fetches",
"the",
"config",
"and",
"parses",
"it",
"into",
"a",
"string",
".",
"Panics",
"on",
"failure",
"."
] | [
"func",
"(",
"c",
"*",
"cachedLoader",
")",
"MustGetString",
"(",
"key",
"string",
")",
"string",
"{",
"b",
",",
"err",
":=",
"c",
".",
"Get",
"(",
"key",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"panic",
"(",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"key",
",",
"err",
")",
")",
"\n",
"}",
"\n\n",
"<mask>",
"s",
"string",
"\n",
"err",
"=",
"json",
".",
"Unmarshal",
"(",
"b",
",",
"&",
"s",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"panic",
"(",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"key",
",",
"err",
")",
")",
"\n",
"}",
"\n\n",
"return",
"s",
"\n",
"}"
] |
22,745 | all-22746 | [
"GetMustShowDistributionOk",
"returns",
"a",
"tuple",
"with",
"the",
"MustShowDistribution",
"field",
"if",
"it",
"s",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"and",
"a",
"boolean",
"to",
"check",
"if",
"the",
"value",
"has",
"been",
"set",
"."
] | [
"func",
"(",
"w",
"*",
"Widget",
")",
"GetMustShowDistributionOk",
"(",
")",
"(",
"bool",
",",
"bool",
")",
"{",
"if",
"w",
"==",
"nil",
"||",
"w",
".",
"MustShowDistribution",
"==",
"nil",
"{",
"return",
"false",
",",
"<mask>",
"\n",
"}",
"\n",
"return",
"*",
"w",
".",
"MustShowDistribution",
",",
"true",
"\n",
"}"
] |
22,746 | all-22747 | [
"Delete",
"registers",
"handlers",
"with",
"the",
"given",
"pattern",
"for",
"DELETE",
"method"
] | [
"func",
"(",
"r",
"*",
"<mask>",
")",
"Delete",
"(",
"pat",
"string",
",",
"f",
"...",
"HandlerFunc",
")",
"{",
"r",
".",
"HandleMethod",
"(",
"pat",
",",
"\"",
"\"",
",",
"f",
"...",
")",
"\n",
"}"
] |
22,747 | all-22748 | [
"Specify",
"the",
"value",
"of",
"a",
"uniform",
"variable",
"for",
"the",
"current",
"program",
"object"
] | [
"func",
"UniformMatrix2fv",
"(",
"location",
"int32",
",",
"<mask>",
"int32",
",",
"transpose",
"bool",
",",
"value",
"*",
"float32",
")",
"{",
"syscall",
".",
"Syscall6",
"(",
"gpUniformMatrix2fv",
",",
"4",
",",
"uintptr",
"(",
"location",
")",
",",
"uintptr",
"(",
"count",
")",
",",
"boolToUintptr",
"(",
"transpose",
")",
",",
"uintptr",
"(",
"unsafe",
".",
"Pointer",
"(",
"value",
")",
")",
",",
"0",
",",
"0",
")",
"\n",
"}"
] |
22,748 | all-22749 | [
"UnmarshalJSON",
"supports",
"json",
".",
"Unmarshaler",
"interface"
] | [
"func",
"(",
"v",
"*",
"CollectClassNamesParams",
")",
"UnmarshalJSON",
"(",
"data",
"[",
"]",
"byte",
")",
"error",
"{",
"r",
":=",
"jlexer",
".",
"Lexer",
"{",
"Data",
":",
"data",
"}",
"\n",
"easyjsonC5a4559bDecodeGithubComChromedpCdprotoCss62",
"(",
"&",
"r",
",",
"v",
")",
"\n",
"return",
"r",
".",
"<mask>",
"(",
")",
"\n",
"}"
] |
22,749 | all-22750 | [
"GetSellPrice",
"gets",
"the",
"current",
"BTC",
"sell",
"price"
] | [
"func",
"(",
"c",
"<mask>",
")",
"GetSellPrice",
"(",
"qty",
"int",
")",
"(",
"*",
"pricesHolder",
",",
"error",
")",
"{",
"return",
"c",
".",
"getPrice",
"(",
"\"",
"\"",
",",
"qty",
")",
"\n",
"}"
] |
22,750 | all-22751 | [
"Run",
"creates",
"a",
"new",
"transaction",
"with",
"ops",
"and",
"runs",
"it",
"immediately",
".",
"The",
"id",
"parameter",
"specifies",
"the",
"transaction",
"id",
"and",
"may",
"be",
"written",
"down",
"ahead",
"of",
"time",
"to",
"later",
"verify",
"the",
"success",
"of",
"the",
"change",
"and",
"resume",
"it",
"when",
"the",
"procedure",
"is",
"interrupted",
"for",
"any",
"reason",
".",
"If",
"empty",
"a",
"random",
"id",
"will",
"be",
"generated",
".",
"The",
"info",
"parameter",
"if",
"not",
"nil",
"is",
"included",
"under",
"the",
"i",
"field",
"of",
"the",
"transaction",
"document",
".",
"Operations",
"across",
"documents",
"are",
"not",
"atomically",
"applied",
"but",
"are",
"guaranteed",
"to",
"be",
"eventually",
"all",
"applied",
"in",
"the",
"order",
"provided",
"or",
"all",
"aborted",
"as",
"long",
"as",
"the",
"affected",
"documents",
"are",
"only",
"modified",
"through",
"transactions",
".",
"If",
"documents",
"are",
"simultaneously",
"modified",
"by",
"transactions",
"and",
"out",
"of",
"transactions",
"the",
"behavior",
"is",
"undefined",
".",
"If",
"Run",
"returns",
"no",
"errors",
"all",
"operations",
"were",
"applied",
"successfully",
".",
"If",
"it",
"returns",
"ErrAborted",
"one",
"or",
"more",
"operations",
"can",
"t",
"be",
"applied",
"and",
"the",
"transaction",
"was",
"entirely",
"aborted",
"with",
"no",
"changes",
"performed",
".",
"Otherwise",
"if",
"the",
"transaction",
"is",
"interrupted",
"while",
"running",
"for",
"any",
"reason",
"it",
"may",
"be",
"resumed",
"explicitly",
"or",
"by",
"attempting",
"to",
"apply",
"another",
"transaction",
"on",
"any",
"of",
"the",
"documents",
"targeted",
"by",
"ops",
"as",
"long",
"as",
"the",
"interruption",
"was",
"made",
"after",
"the",
"transaction",
"document",
"itself",
"was",
"inserted",
".",
"Run",
"Resume",
"with",
"the",
"obtained",
"transaction",
"id",
"to",
"confirm",
"whether",
"the",
"transaction",
"was",
"applied",
"or",
"not",
".",
"Any",
"number",
"of",
"transactions",
"may",
"be",
"run",
"concurrently",
"with",
"one",
"runner",
"or",
"many",
"."
] | [
"func",
"(",
"r",
"*",
"<mask>",
")",
"Run",
"(",
"ops",
"[",
"]",
"Op",
",",
"id",
"bson",
".",
"ObjectId",
",",
"info",
"interface",
"{",
"}",
")",
"(",
"err",
"error",
")",
"{",
"const",
"efmt",
"=",
"\"",
"\"",
"\n",
"for",
"i",
":=",
"range",
"ops",
"{",
"op",
":=",
"&",
"ops",
"[",
"i",
"]",
"\n",
"if",
"op",
".",
"C",
"==",
"\"",
"\"",
"||",
"op",
".",
"Id",
"==",
"nil",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"efmt",
",",
"i",
",",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"changes",
":=",
"0",
"\n",
"if",
"op",
".",
"Insert",
"!=",
"nil",
"{",
"changes",
"++",
"\n",
"}",
"\n",
"if",
"op",
".",
"Update",
"!=",
"nil",
"{",
"changes",
"++",
"\n",
"}",
"\n",
"if",
"op",
".",
"Remove",
"{",
"changes",
"++",
"\n",
"}",
"\n",
"if",
"changes",
">",
"1",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"efmt",
",",
"i",
",",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"if",
"changes",
"==",
"0",
"&&",
"op",
".",
"Assert",
"==",
"nil",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"efmt",
",",
"i",
",",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"}",
"\n",
"if",
"id",
"==",
"\"",
"\"",
"{",
"id",
"=",
"bson",
".",
"NewObjectId",
"(",
")",
"\n",
"}",
"\n\n",
"// Insert transaction sooner rather than later, to stay on the safer side.",
"t",
":=",
"transaction",
"{",
"Id",
":",
"id",
",",
"Ops",
":",
"ops",
",",
"State",
":",
"tpreparing",
",",
"Info",
":",
"info",
",",
"}",
"\n",
"if",
"err",
"=",
"r",
".",
"tc",
".",
"Insert",
"(",
"&",
"t",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"if",
"err",
"=",
"flush",
"(",
"r",
",",
"&",
"t",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"if",
"t",
".",
"State",
"==",
"taborted",
"{",
"return",
"ErrAborted",
"\n",
"}",
"else",
"if",
"t",
".",
"State",
"!=",
"tapplied",
"{",
"panic",
"(",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"&",
"t",
",",
"t",
".",
"State",
")",
")",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
] |
22,751 | all-22752 | [
"newUniqueEphemeralKV",
"creates",
"a",
"new",
"unique",
"key",
"/",
"value",
"pair",
"associated",
"with",
"a",
"session",
"lease"
] | [
"func",
"newUniqueEphemeralKV",
"(",
"s",
"*",
"concurrency",
".",
"Session",
",",
"prefix",
",",
"val",
"string",
")",
"(",
"ek",
"*",
"EphemeralKV",
",",
"err",
"error",
")",
"{",
"for",
"{",
"newKey",
":=",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"prefix",
",",
"time",
".",
"Now",
"(",
")",
".",
"UnixNano",
"(",
")",
")",
"\n",
"ek",
",",
"err",
"=",
"newEphemeralKV",
"(",
"s",
",",
"newKey",
",",
"val",
")",
"\n",
"if",
"err",
"==",
"nil",
"||",
"err",
"!=",
"ErrKeyExists",
"{",
"<mask>",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"ek",
",",
"err",
"\n",
"}"
] |
22,752 | all-22753 | [
"Choose",
"a",
"token",
"bucket",
"capacity",
"that",
"ensures",
"that",
"the",
"action",
"gated",
"by",
"the",
"token",
"bucket",
"will",
"be",
"limited",
"to",
"within",
"a",
"few",
"percent",
"of",
"rateHz",
"*",
"window",
"for",
"any",
"window",
"of",
"the",
"given",
"size",
".",
"This",
"is",
"not",
"be",
"possible",
"for",
"all",
"rates",
"and",
"windows",
".",
"In",
"that",
"case",
"an",
"error",
"will",
"be",
"returned",
"."
] | [
"func",
"ChooseTokenBucketCapacity",
"(",
"rateHz",
"float64",
",",
"window",
"<mask>",
".",
"Duration",
")",
"(",
"capacity",
"uint64",
",",
"err",
"error",
")",
"{",
"// Check that the input is reasonable.",
"if",
"rateHz",
"<=",
"0",
"||",
"math",
".",
"IsInf",
"(",
"rateHz",
",",
"0",
")",
"{",
"err",
"=",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"rateHz",
")",
"\n",
"return",
"\n",
"}",
"\n\n",
"if",
"window",
"<=",
"0",
"{",
"err",
"=",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"window",
")",
"\n",
"return",
"\n",
"}",
"\n\n",
"// We cannot help but allow the rate to exceed the configured maximum by some",
"// factor in an arbitrary window, no matter how small we scale the max",
"// accumulated credit -- the bucket may be full at the start of the window,",
"// be immediately exhausted, then be repeatedly exhausted just before filling",
"// throughout the window.",
"//",
"// For example: let the window W = 10 seconds, and the bandwidth B = 20 MiB/s.",
"// Set the max accumulated credit C = W*B/2 = 100 MiB. Then this",
"// sequence of events is allowed:",
"//",
"// * T=0: Allow through 100 MiB.",
"// * T=4.999999: Allow through nearly 100 MiB.",
"// * T=9.999999: Allow through nearly 100 MiB.",
"//",
"// Above we allow through nearly 300 MiB, exceeding the allowed bytes for the",
"// window by nearly 50%. Note however that this trend cannot continue into",
"// the next window, so this must be a transient spike.",
"//",
"// In general if we set C <= W*B/N, then we're off by no more than a factor",
"// of (N+1)/N within any window of size W.",
"//",
"// Choose a reasonable N.",
"const",
"N",
"=",
"50",
"// At most 2% error",
"\n\n",
"w",
":=",
"float64",
"(",
"window",
")",
"/",
"float64",
"(",
"time",
".",
"Second",
")",
"\n",
"capacityFloat",
":=",
"math",
".",
"Floor",
"(",
"w",
"*",
"rateHz",
"/",
"N",
")",
"\n",
"if",
"!",
"(",
"capacityFloat",
">=",
"1",
"&&",
"capacityFloat",
"<",
"float64",
"(",
"math",
".",
"MaxUint64",
")",
")",
"{",
"err",
"=",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
"+",
"\"",
"\"",
",",
"rateHz",
",",
"window",
",",
"capacityFloat",
")",
"\n\n",
"return",
"\n",
"}",
"\n\n",
"capacity",
"=",
"uint64",
"(",
"capacityFloat",
")",
"\n",
"if",
"capacity",
"==",
"0",
"{",
"panic",
"(",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"rateHz",
",",
"window",
",",
"capacityFloat",
")",
")",
"\n",
"}",
"\n\n",
"return",
"\n",
"}"
] |
22,753 | all-22754 | [
"Register",
"adds",
"a",
"subcommand",
"to",
"the",
"supported",
"subcommands",
"in",
"the",
"specified",
"group",
".",
"(",
"Help",
"output",
"is",
"sorted",
"and",
"arranged",
"by",
"group",
"name",
".",
")",
"The",
"empty",
"string",
"is",
"an",
"acceptable",
"group",
"name",
";",
"such",
"subcommands",
"are",
"explained",
"first",
"before",
"named",
"groups",
"."
] | [
"func",
"(",
"cdr",
"*",
"Commander",
")",
"Register",
"(",
"cmd",
"Command",
",",
"group",
"string",
")",
"{",
"for",
"_",
",",
"g",
":=",
"range",
"cdr",
".",
"commands",
"{",
"if",
"g",
".",
"name",
"==",
"group",
"{",
"g",
".",
"commands",
"=",
"append",
"(",
"g",
".",
"commands",
",",
"cmd",
")",
"\n",
"return",
"\n",
"}",
"\n",
"}",
"\n",
"cdr",
".",
"commands",
"=",
"append",
"(",
"cdr",
".",
"commands",
",",
"&",
"commandGroup",
"{",
"<mask>",
":",
"group",
",",
"commands",
":",
"[",
"]",
"Command",
"{",
"cmd",
"}",
",",
"}",
")",
"\n",
"}"
] |
22,754 | all-22755 | [
"Client",
"returns",
"a",
"HTTP",
"client",
"using",
"the",
"bearer",
"token",
"."
] | [
"func",
"(",
"b",
"*",
"Bearer",
")",
"Client",
"(",
")",
"*",
"http",
".",
"Client",
"{",
"return",
"&",
"http",
".",
"Client",
"{",
"Transport",
":",
"&",
"oauth2",
".",
"Transport",
"{",
"<mask>",
":",
"b",
",",
"}",
",",
"}",
"\n",
"}"
] |
22,755 | all-22756 | [
"WithContext",
"adds",
"the",
"context",
"to",
"the",
"patch",
"apps",
"app",
"params"
] | [
"func",
"(",
"o",
"*",
"PatchAppsAppParams",
")",
"WithContext",
"(",
"ctx",
"<mask>",
".",
"Context",
")",
"*",
"PatchAppsAppParams",
"{",
"o",
".",
"SetContext",
"(",
"ctx",
")",
"\n",
"return",
"o",
"\n",
"}"
] |
22,756 | all-22757 | [
"Render",
"renders",
"a",
"template",
"using",
"the",
"provided",
"template",
"and",
"vars",
"struct",
"and",
"returns",
"a",
"response",
"with",
"the",
"rendered",
"template"
] | [
"func",
"(",
"c",
"*",
"Controller",
")",
"Render",
"(",
"templateStr",
"string",
",",
"vars",
"interface",
"{",
"}",
")",
"*",
"OkResponse",
"{",
"response",
":=",
"NewResponse",
"(",
")",
"\n",
"<mask>",
".",
"SetContent",
"(",
"c",
".",
"RenderView",
"(",
"templateStr",
",",
"vars",
")",
")",
"\n",
"return",
"response",
"\n",
"}"
] |
22,757 | all-22758 | [
"imageLoadGoroutine",
"accepts",
"tar",
"stream",
"on",
"reader",
"sends",
"it",
"to",
"c",
"and",
"reports",
"error",
"or",
"success",
"by",
"writing",
"to",
"statusChannel"
] | [
"func",
"imageLoadGoroutine",
"(",
"ctx",
"context",
".",
"Context",
",",
"c",
"*",
"client",
".",
"Client",
",",
"reader",
"*",
"io",
".",
"PipeReader",
",",
"statusChannel",
"chan",
"<-",
"error",
")",
"{",
"err",
":=",
"errors",
".",
"New",
"(",
"\"",
"\"",
")",
"\n",
"defer",
"func",
"(",
")",
"{",
"logrus",
".",
"Debugf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"statusChannel",
"<-",
"err",
"\n",
"}",
"(",
")",
"\n",
"defer",
"func",
"(",
")",
"{",
"if",
"err",
"==",
"nil",
"{",
"reader",
".",
"Close",
"(",
")",
"\n",
"}",
"else",
"{",
"reader",
".",
"CloseWithError",
"(",
"err",
")",
"\n",
"}",
"\n",
"}",
"(",
")",
"\n\n",
"resp",
",",
"err",
":=",
"c",
".",
"ImageLoad",
"(",
"ctx",
",",
"reader",
",",
"<mask>",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"err",
"=",
"errors",
".",
"Wrap",
"(",
"err",
",",
"\"",
"\"",
")",
"\n",
"return",
"\n",
"}",
"\n",
"defer",
"resp",
".",
"Body",
".",
"Close",
"(",
")",
"\n",
"}"
] |
22,758 | all-22759 | [
"AfterEachMiddleware",
"is",
"invoked",
"after",
"any",
"other",
"and",
"is",
"the",
"last",
"function",
"to",
"be",
"called",
"prior",
"to",
"returning",
"to",
"the",
"test",
"suite",
".",
"It",
"is",
"therefore",
"not",
"invoked",
"on",
"__setup"
] | [
"func",
"AfterEachMiddleware",
"(",
"AfterEach",
"types",
".",
"Hook",
")",
"proxy",
".",
"Middleware",
"{",
"return",
"func",
"(",
"next",
"http",
".",
"Handler",
")",
"http",
".",
"Handler",
"{",
"return",
"http",
".",
"HandlerFunc",
"(",
"func",
"(",
"w",
"http",
".",
"ResponseWriter",
",",
"r",
"*",
"http",
".",
"Request",
")",
"{",
"<mask>",
".",
"ServeHTTP",
"(",
"w",
",",
"r",
")",
"\n\n",
"if",
"r",
".",
"URL",
".",
"Path",
"!=",
"\"",
"\"",
"{",
"log",
".",
"Println",
"(",
"\"",
"\"",
")",
"\n",
"err",
":=",
"AfterEach",
"(",
")",
"\n\n",
"if",
"err",
"!=",
"nil",
"{",
"log",
".",
"Println",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"w",
".",
"WriteHeader",
"(",
"http",
".",
"StatusInternalServerError",
")",
"\n",
"}",
"\n",
"}",
"\n",
"}",
")",
"\n",
"}",
"\n",
"}"
] |
22,759 | all-22760 | [
"SetTrackPrintStatus",
"()",
"is",
"a",
"wrapper",
"around",
"gtk_print_operation_set_track_print_status",
"()",
"."
] | [
"func",
"(",
"po",
"*",
"PrintOperation",
")",
"SetTrackPrintStatus",
"(",
"<mask>",
"bool",
")",
"{",
"C",
".",
"gtk_print_operation_set_track_print_status",
"(",
"po",
".",
"native",
"(",
")",
",",
"gbool",
"(",
"progress",
")",
")",
"\n",
"}"
] |
22,760 | all-22761 | [
"Form",
"is",
"middleware",
"to",
"deserialize",
"form",
"-",
"urlencoded",
"data",
"from",
"the",
"request",
".",
"It",
"gets",
"data",
"from",
"the",
"form",
"-",
"urlencoded",
"body",
"if",
"present",
"or",
"from",
"the",
"query",
"string",
".",
"It",
"uses",
"the",
"http",
".",
"Request",
".",
"ParseForm",
"()",
"method",
"to",
"perform",
"deserialization",
"then",
"reflection",
"is",
"used",
"to",
"map",
"each",
"field",
"into",
"the",
"struct",
"with",
"the",
"proper",
"type",
".",
"Structs",
"with",
"primitive",
"slice",
"types",
"(",
"bool",
"float",
"int",
"string",
")",
"can",
"support",
"deserialization",
"of",
"repeated",
"form",
"keys",
"for",
"example",
":",
"key",
"=",
"val1&key",
"=",
"val2&key",
"=",
"val3",
"An",
"interface",
"pointer",
"can",
"be",
"added",
"as",
"a",
"second",
"argument",
"in",
"order",
"to",
"map",
"the",
"struct",
"to",
"a",
"specific",
"interface",
"."
] | [
"func",
"Form",
"(",
"formStruct",
"interface",
"{",
"}",
",",
"ifacePtr",
"...",
"interface",
"{",
"}",
")",
"martini",
".",
"Handler",
"{",
"return",
"func",
"(",
"context",
"martini",
".",
"Context",
",",
"req",
"*",
"http",
".",
"Request",
")",
"{",
"ensureNotPointer",
"(",
"formStruct",
")",
"\n",
"formStruct",
":=",
"reflect",
".",
"New",
"(",
"reflect",
".",
"TypeOf",
"(",
"formStruct",
")",
")",
"\n",
"errors",
":=",
"newErrors",
"(",
")",
"\n",
"parseErr",
":=",
"req",
".",
"ParseForm",
"(",
")",
"\n\n",
"// Format validation of the request body or the URL would add considerable overhead,",
"// and ParseForm does not complain when URL encoding is off.",
"// Because an empty request body or url can also mean absence of all needed values,",
"// it is not in all cases a bad request, so let's return 422.",
"if",
"parseErr",
"!=",
"nil",
"{",
"errors",
".",
"Overall",
"[",
"DeserializationError",
"]",
"=",
"parseErr",
".",
"Error",
"(",
")",
"\n",
"}",
"\n\n",
"mapForm",
"(",
"formStruct",
",",
"req",
".",
"Form",
",",
"errors",
")",
"\n\n",
"validateAndMap",
"(",
"formStruct",
",",
"<mask>",
",",
"errors",
",",
"ifacePtr",
"...",
")",
"\n",
"}",
"\n",
"}"
] |
22,761 | all-22762 | [
"startStopReplication",
"will",
"set",
"up",
"state",
"and",
"start",
"asynchronous",
"replication",
"to",
"new",
"peers",
"and",
"stop",
"replication",
"to",
"removed",
"peers",
".",
"Before",
"removing",
"a",
"peer",
"it",
"ll",
"instruct",
"the",
"replication",
"routines",
"to",
"try",
"to",
"replicate",
"to",
"the",
"current",
"index",
".",
"This",
"must",
"only",
"be",
"called",
"from",
"the",
"main",
"thread",
"."
] | [
"func",
"(",
"r",
"*",
"Raft",
")",
"startStopReplication",
"(",
")",
"{",
"inConfig",
":=",
"make",
"(",
"map",
"[",
"ServerID",
"]",
"bool",
",",
"len",
"(",
"r",
".",
"configurations",
".",
"latest",
".",
"Servers",
")",
")",
"\n",
"lastIdx",
":=",
"r",
".",
"getLastIndex",
"(",
")",
"\n\n",
"// Start replication goroutines that need starting",
"for",
"_",
",",
"server",
":=",
"range",
"r",
".",
"configurations",
".",
"latest",
".",
"Servers",
"{",
"if",
"server",
".",
"ID",
"==",
"r",
".",
"localID",
"{",
"continue",
"\n",
"}",
"\n",
"inConfig",
"[",
"server",
".",
"ID",
"]",
"=",
"true",
"\n",
"if",
"_",
",",
"ok",
":=",
"r",
".",
"leaderState",
".",
"replState",
"[",
"server",
".",
"ID",
"]",
";",
"!",
"ok",
"{",
"r",
".",
"logger",
".",
"Info",
"(",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"server",
".",
"ID",
")",
")",
"\n",
"s",
":=",
"&",
"followerReplication",
"{",
"peer",
":",
"server",
",",
"commitment",
":",
"r",
".",
"leaderState",
".",
"commitment",
",",
"stopCh",
":",
"<mask>",
"(",
"chan",
"uint64",
",",
"1",
")",
",",
"triggerCh",
":",
"make",
"(",
"chan",
"struct",
"{",
"}",
",",
"1",
")",
",",
"currentTerm",
":",
"r",
".",
"getCurrentTerm",
"(",
")",
",",
"nextIndex",
":",
"lastIdx",
"+",
"1",
",",
"lastContact",
":",
"time",
".",
"Now",
"(",
")",
",",
"notify",
":",
"make",
"(",
"map",
"[",
"*",
"verifyFuture",
"]",
"struct",
"{",
"}",
")",
",",
"notifyCh",
":",
"make",
"(",
"chan",
"struct",
"{",
"}",
",",
"1",
")",
",",
"stepDown",
":",
"r",
".",
"leaderState",
".",
"stepDown",
",",
"}",
"\n",
"r",
".",
"leaderState",
".",
"replState",
"[",
"server",
".",
"ID",
"]",
"=",
"s",
"\n",
"r",
".",
"goFunc",
"(",
"func",
"(",
")",
"{",
"r",
".",
"replicate",
"(",
"s",
")",
"}",
")",
"\n",
"asyncNotifyCh",
"(",
"s",
".",
"triggerCh",
")",
"\n",
"}",
"\n",
"}",
"\n\n",
"// Stop replication goroutines that need stopping",
"for",
"serverID",
",",
"repl",
":=",
"range",
"r",
".",
"leaderState",
".",
"replState",
"{",
"if",
"inConfig",
"[",
"serverID",
"]",
"{",
"continue",
"\n",
"}",
"\n",
"// Replicate up to lastIdx and stop",
"r",
".",
"logger",
".",
"Info",
"(",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"serverID",
",",
"lastIdx",
")",
")",
"\n",
"repl",
".",
"stopCh",
"<-",
"lastIdx",
"\n",
"close",
"(",
"repl",
".",
"stopCh",
")",
"\n",
"delete",
"(",
"r",
".",
"leaderState",
".",
"replState",
",",
"serverID",
")",
"\n",
"}",
"\n",
"}"
] |
22,762 | all-22763 | [
"NewWithWebhook",
"creates",
"a",
"new",
"API",
"client",
"for",
"a",
"Telegram",
"bot",
"using",
"the",
"apiKey",
"provided",
".",
"It",
"will",
"call",
"the",
"GetMe",
"method",
"to",
"retrieve",
"the",
"bots",
"id",
"name",
"and",
"username",
".",
"In",
"addition",
"to",
"the",
"API",
"client",
"a",
"http",
".",
"HandlerFunc",
"will",
"be",
"returned",
".",
"This",
"handler",
"func",
"reacts",
"to",
"webhook",
"requests",
"and",
"will",
"put",
"updates",
"into",
"the",
"Updates",
"channel",
"."
] | [
"func",
"NewWithWebhook",
"(",
"apiKey",
",",
"webhookURL",
",",
"certificate",
"string",
")",
"(",
"*",
"TelegramBotAPI",
",",
"http",
".",
"HandlerFunc",
",",
"error",
")",
"{",
"toReturn",
":=",
"TelegramBotAPI",
"{",
"Updates",
":",
"make",
"(",
"chan",
"BotUpdate",
")",
",",
"baseURIs",
":",
"createEndpoints",
"(",
"fmt",
".",
"Sprintf",
"(",
"apiBaseURI",
",",
"apiKey",
")",
")",
",",
"closed",
":",
"make",
"(",
"chan",
"struct",
"{",
"}",
")",
",",
"c",
":",
"newClient",
"(",
"fmt",
".",
"Sprintf",
"(",
"apiBaseURI",
",",
"apiKey",
")",
")",
",",
"updateC",
":",
"newClient",
"(",
"fmt",
".",
"Sprintf",
"(",
"apiBaseURI",
",",
"apiKey",
")",
")",
",",
"}",
"\n",
"user",
",",
"err",
":=",
"toReturn",
".",
"GetMe",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"nil",
",",
"err",
"\n",
"}",
"\n",
"toReturn",
".",
"ID",
"=",
"user",
".",
"User",
".",
"<mask>",
"\n",
"toReturn",
".",
"Name",
"=",
"user",
".",
"User",
".",
"FirstName",
"\n",
"toReturn",
".",
"Username",
"=",
"*",
"user",
".",
"User",
".",
"Username",
"\n\n",
"file",
",",
"err",
":=",
"os",
".",
"Open",
"(",
"certificate",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"err",
"=",
"toReturn",
".",
"setWebhook",
"(",
"webhookURL",
",",
"certificate",
",",
"file",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"updateFunc",
":=",
"func",
"(",
"w",
"http",
".",
"ResponseWriter",
",",
"r",
"*",
"http",
".",
"Request",
")",
"{",
"bytes",
",",
"err",
":=",
"ioutil",
".",
"ReadAll",
"(",
"r",
".",
"Body",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"toReturn",
".",
"Updates",
"<-",
"BotUpdate",
"{",
"err",
":",
"err",
"}",
"\n",
"return",
"\n",
"}",
"\n\n",
"update",
":=",
"&",
"Update",
"{",
"}",
"\n",
"err",
"=",
"json",
".",
"Unmarshal",
"(",
"bytes",
",",
"update",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"toReturn",
".",
"Updates",
"<-",
"BotUpdate",
"{",
"err",
":",
"err",
"}",
"\n",
"return",
"\n",
"}",
"\n\n",
"toReturn",
".",
"Updates",
"<-",
"BotUpdate",
"{",
"update",
":",
"*",
"update",
"}",
"\n",
"}",
"\n\n",
"return",
"&",
"toReturn",
",",
"updateFunc",
",",
"nil",
"\n",
"}"
] |
22,763 | all-22764 | [
"CssProviderNew",
"is",
"a",
"wrapper",
"around",
"gtk_css_provider_new",
"()",
"."
] | [
"func",
"CssProviderNew",
"(",
")",
"(",
"*",
"CssProvider",
",",
"<mask>",
")",
"{",
"c",
":=",
"C",
".",
"gtk_css_provider_new",
"(",
")",
"\n",
"if",
"c",
"==",
"nil",
"{",
"return",
"nil",
",",
"nilPtrErr",
"\n",
"}",
"\n\n",
"return",
"wrapCssProvider",
"(",
"glib",
".",
"Take",
"(",
"unsafe",
".",
"Pointer",
"(",
"c",
")",
")",
")",
",",
"nil",
"\n",
"}"
] |
22,764 | all-22765 | [
"formatURL",
"returns",
"formatted",
"url",
"for",
"tcs",
"endpoint",
"."
] | [
"func",
"formatURL",
"(",
"endpoint",
"string",
",",
"cluster",
"string",
",",
"containerInstance",
"string",
")",
"string",
"{",
"tcsURL",
":=",
"endpoint",
"\n",
"if",
"!",
"strings",
".",
"HasSuffix",
"(",
"tcsURL",
",",
"\"",
"\"",
")",
"{",
"tcsURL",
"+=",
"\"",
"\"",
"\n",
"}",
"\n",
"query",
":=",
"url",
".",
"Values",
"{",
"}",
"\n",
"<mask>",
".",
"Set",
"(",
"\"",
"\"",
",",
"cluster",
")",
"\n",
"query",
".",
"Set",
"(",
"\"",
"\"",
",",
"containerInstance",
")",
"\n",
"return",
"tcsURL",
"+",
"\"",
"\"",
"+",
"query",
".",
"Encode",
"(",
")",
"\n",
"}"
] |
22,765 | all-22766 | [
"Options",
"handles",
"OPTIONS",
"methods",
"with",
"a",
"given",
"pattern"
] | [
"func",
"(",
"r",
"*",
"Router",
")",
"Options",
"(",
"<mask>",
"string",
",",
"handlers",
"...",
"interface",
"{",
"}",
")",
"*",
"Router",
"{",
"c",
":=",
"r",
".",
"pattern",
"(",
"pattern",
")",
"\n",
"c",
".",
"Method",
"=",
"\"",
"\"",
"\n",
"clone",
":=",
"r",
".",
"clone",
"(",
"c",
")",
"\n",
"clone",
".",
"handle",
"(",
"handlers",
")",
"\n",
"return",
"clone",
"\n",
"}"
] |
22,766 | all-22767 | [
"RegisterHealthHandler",
"uses",
"the",
"user",
"-",
"specified",
"function",
"f",
"for",
"the",
"Health",
"endpoint",
"."
] | [
"func",
"(",
"s",
"*",
"<mask>",
")",
"RegisterHealthHandler",
"(",
"f",
"HealthFunc",
")",
"{",
"wrapped",
":=",
"func",
"(",
"ctx",
"Context",
",",
"r",
"HealthRequest",
")",
"(",
"bool",
",",
"string",
")",
"{",
"return",
"f",
"(",
"ctx",
")",
"\n",
"}",
"\n",
"s",
".",
"metaHandler",
".",
"setHandler",
"(",
"wrapped",
")",
"\n",
"}"
] |
22,767 | all-22768 | [
"Step",
"3",
"is",
"the",
"removal",
"of",
"residual",
"suffixes",
"."
] | [
"func",
"step3",
"(",
"word",
"*",
"snowballword",
".",
"SnowballWord",
")",
"bool",
"{",
"suffix",
",",
"suffixRunes",
":=",
"word",
".",
"FirstSuffixIfIn",
"(",
"<mask>",
".",
"RVstart",
",",
"len",
"(",
"word",
".",
"RS",
")",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
",",
" ",
"í",
" ",
"\"",
"\"",
"\"",
"e",
",",
"\"",
"é",
",",
"",
"",
")",
"\n\n",
"// No suffix found, nothing to do.",
"//",
"if",
"suffix",
"==",
"\"",
"\"",
"{",
"return",
"false",
"\n",
"}",
"\n\n",
"// Remove all these suffixes",
"word",
".",
"RemoveLastNRunes",
"(",
"len",
"(",
"suffixRunes",
")",
")",
"\n\n",
"if",
"suffix",
"==",
"\"",
"\"",
"||",
"suffix",
"==",
"\"",
" ",
"",
"// If preceded by gu with the u in RV delete the u",
"//",
"guSuffix",
",",
"_",
":=",
"word",
".",
"FirstSuffix",
"(",
"\"",
"\"",
")",
"\n",
"if",
"guSuffix",
"!=",
"\"",
"\"",
"{",
"word",
".",
"RemoveLastNRunes",
"(",
"1",
")",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"true",
"\n",
"}"
] |
22,768 | all-22769 | [
"Rev",
"fetches",
"current",
"revision",
"on",
"this",
"member",
"."
] | [
"func",
"(",
"m",
"*",
"Member",
")",
"Rev",
"(",
"ctx",
"context",
".",
"Context",
")",
"(",
"int64",
",",
"error",
")",
"{",
"cli",
",",
"err",
":=",
"m",
".",
"CreateEtcdClient",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"0",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"err",
",",
"m",
".",
"EtcdClientEndpoint",
")",
"\n",
"}",
"\n",
"defer",
"cli",
".",
"Close",
"(",
")",
"\n\n",
"resp",
",",
"err",
":=",
"cli",
".",
"Status",
"(",
"ctx",
",",
"m",
".",
"EtcdClientEndpoint",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"0",
",",
"err",
"\n",
"}",
"\n",
"return",
"resp",
".",
"<mask>",
".",
"Revision",
",",
"nil",
"\n",
"}"
] |
22,769 | all-22770 | [
"Fetch",
"information",
"about",
"all",
"node",
"-",
"specific",
"configuration",
"keys",
"set",
"on",
"the",
"storage",
"pools",
"and",
"networks",
"of",
"this",
"cluster",
"."
] | [
"func",
"clusterGetMemberConfig",
"(",
"cluster",
"*",
"db",
".",
"Cluster",
")",
"(",
"[",
"]",
"api",
".",
"ClusterMemberConfigKey",
",",
"error",
")",
"{",
"var",
"pools",
"<mask>",
"[",
"string",
"]",
"map",
"[",
"string",
"]",
"string",
"\n",
"var",
"networks",
"map",
"[",
"string",
"]",
"map",
"[",
"string",
"]",
"string",
"\n\n",
"keys",
":=",
"[",
"]",
"api",
".",
"ClusterMemberConfigKey",
"{",
"}",
"\n\n",
"err",
":=",
"cluster",
".",
"Transaction",
"(",
"func",
"(",
"tx",
"*",
"db",
".",
"ClusterTx",
")",
"error",
"{",
"var",
"err",
"error",
"\n\n",
"pools",
",",
"err",
"=",
"tx",
".",
"StoragePoolsNodeConfig",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"errors",
".",
"Wrapf",
"(",
"err",
",",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"networks",
",",
"err",
"=",
"tx",
".",
"NetworksNodeConfig",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"errors",
".",
"Wrapf",
"(",
"err",
",",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"return",
"nil",
"\n",
"}",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"for",
"pool",
",",
"config",
":=",
"range",
"pools",
"{",
"for",
"key",
":=",
"range",
"config",
"{",
"if",
"strings",
".",
"HasPrefix",
"(",
"key",
",",
"\"",
"\"",
")",
"{",
"continue",
"\n",
"}",
"\n\n",
"key",
":=",
"api",
".",
"ClusterMemberConfigKey",
"{",
"Entity",
":",
"\"",
"\"",
",",
"Name",
":",
"pool",
",",
"Key",
":",
"key",
",",
"Description",
":",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\\\"",
"\\\"",
"\\\"",
"\\\"",
"\"",
",",
"key",
",",
"pool",
")",
",",
"}",
"\n",
"keys",
"=",
"append",
"(",
"keys",
",",
"key",
")",
"\n",
"}",
"\n",
"}",
"\n\n",
"for",
"network",
",",
"config",
":=",
"range",
"networks",
"{",
"for",
"key",
":=",
"range",
"config",
"{",
"if",
"strings",
".",
"HasPrefix",
"(",
"key",
",",
"\"",
"\"",
")",
"{",
"continue",
"\n",
"}",
"\n\n",
"key",
":=",
"api",
".",
"ClusterMemberConfigKey",
"{",
"Entity",
":",
"\"",
"\"",
",",
"Name",
":",
"network",
",",
"Key",
":",
"key",
",",
"Description",
":",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\\\"",
"\\\"",
"\\\"",
"\\\"",
"\"",
",",
"key",
",",
"network",
")",
",",
"}",
"\n",
"keys",
"=",
"append",
"(",
"keys",
",",
"key",
")",
"\n",
"}",
"\n",
"}",
"\n\n",
"return",
"keys",
",",
"nil",
"\n",
"}"
] |
22,770 | all-22771 | [
"datacenterFromID",
"locates",
"a",
"Datacenter",
"by",
"its",
"managed",
"object",
"reference",
"ID",
"."
] | [
"func",
"datacenterFromID",
"(",
"client",
"*",
"govmomi",
".",
"Client",
",",
"id",
"string",
")",
"(",
"*",
"object",
".",
"Datacenter",
",",
"error",
")",
"{",
"finder",
":=",
"find",
".",
"NewFinder",
"(",
"client",
".",
"Client",
",",
"false",
")",
"\n\n",
"ref",
":=",
"types",
".",
"ManagedObjectReference",
"{",
"Type",
":",
"\"",
"\"",
",",
"Value",
":",
"id",
",",
"}",
"\n\n",
"ctx",
",",
"cancel",
":=",
"context",
".",
"WithTimeout",
"(",
"context",
".",
"Background",
"(",
")",
",",
"defaultAPITimeout",
")",
"\n",
"defer",
"cancel",
"(",
")",
"\n",
"<mask>",
",",
"err",
":=",
"finder",
".",
"ObjectReference",
"(",
"ctx",
",",
"ref",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"id",
",",
"err",
")",
"\n",
"}",
"\n",
"return",
"ds",
".",
"(",
"*",
"object",
".",
"Datacenter",
")",
",",
"nil",
"\n",
"}"
] |
22,771 | all-22772 | [
"rmCommandFunc",
"executes",
"the",
"rm",
"command",
"."
] | [
"func",
"rmCommandFunc",
"(",
"c",
"*",
"cli",
".",
"Context",
",",
"ki",
"<mask>",
".",
"KeysAPI",
")",
"{",
"if",
"len",
"(",
"c",
".",
"Args",
"(",
")",
")",
"==",
"0",
"{",
"handleError",
"(",
"c",
",",
"ExitBadArgs",
",",
"errors",
".",
"New",
"(",
"\"",
"\"",
")",
")",
"\n",
"}",
"\n",
"key",
":=",
"c",
".",
"Args",
"(",
")",
"[",
"0",
"]",
"\n",
"recursive",
":=",
"c",
".",
"Bool",
"(",
"\"",
"\"",
")",
"\n",
"dir",
":=",
"c",
".",
"Bool",
"(",
"\"",
"\"",
")",
"\n",
"prevValue",
":=",
"c",
".",
"String",
"(",
"\"",
"\"",
")",
"\n",
"prevIndex",
":=",
"c",
".",
"Int",
"(",
"\"",
"\"",
")",
"\n\n",
"ctx",
",",
"cancel",
":=",
"contextWithTotalTimeout",
"(",
"c",
")",
"\n",
"resp",
",",
"err",
":=",
"ki",
".",
"Delete",
"(",
"ctx",
",",
"key",
",",
"&",
"client",
".",
"DeleteOptions",
"{",
"PrevIndex",
":",
"uint64",
"(",
"prevIndex",
")",
",",
"PrevValue",
":",
"prevValue",
",",
"Dir",
":",
"dir",
",",
"Recursive",
":",
"recursive",
"}",
")",
"\n",
"cancel",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"handleError",
"(",
"c",
",",
"ExitServerError",
",",
"err",
")",
"\n",
"}",
"\n",
"if",
"!",
"resp",
".",
"Node",
".",
"Dir",
"||",
"c",
".",
"GlobalString",
"(",
"\"",
"\"",
")",
"!=",
"\"",
"\"",
"{",
"printResponseKey",
"(",
"resp",
",",
"c",
".",
"GlobalString",
"(",
"\"",
"\"",
")",
")",
"\n",
"}",
"\n",
"}"
] |
22,772 | all-22773 | [
"Execute",
"will",
"check",
"the",
"given",
"certificate",
"to",
"ensure",
"that",
"all",
"of",
"the",
"DNS",
"subject",
"alternate",
"names",
"that",
"specify",
"a",
"reverse",
"DNS",
"name",
"under",
"the",
"respective",
"IPv4",
"or",
"IPv6",
"arpa",
"zones",
"are",
"well",
"formed",
".",
"A",
"Warn",
"LintResult",
"is",
"returned",
"if",
"the",
"name",
"is",
"in",
"a",
"reverse",
"DNS",
"zone",
"but",
"has",
"the",
"wrong",
"number",
"of",
"labels",
"."
] | [
"func",
"(",
"l",
"*",
"arpaMalformedIP",
")",
"Execute",
"(",
"c",
"*",
"x509",
".",
"Certificate",
")",
"*",
"LintResult",
"{",
"for",
"_",
",",
"name",
":=",
"range",
"c",
".",
"DNSNames",
"{",
"name",
"=",
"strings",
".",
"ToLower",
"(",
"name",
")",
"\n",
"var",
"err",
"error",
"\n",
"if",
"strings",
".",
"HasSuffix",
"(",
"name",
",",
"rdnsIPv4Suffix",
")",
"{",
"// If the name has the in-addr.arpa suffix then it should be an IPv4 reverse",
"// DNS name.",
"err",
"=",
"lintReversedIPAddressLabels",
"(",
"<mask>",
",",
"false",
")",
"\n",
"}",
"else",
"if",
"strings",
".",
"HasSuffix",
"(",
"name",
",",
"rdnsIPv6Suffix",
")",
"{",
"// If the name has the ip6.arpa suffix then it should be an IPv6 reverse",
"// DNS name.",
"err",
"=",
"lintReversedIPAddressLabels",
"(",
"name",
",",
"true",
")",
"\n",
"}",
"\n",
"// Return the first error as a negative lint result",
"if",
"err",
"!=",
"nil",
"{",
"return",
"&",
"LintResult",
"{",
"Status",
":",
"Warn",
",",
"Details",
":",
"err",
".",
"Error",
"(",
")",
",",
"}",
"\n",
"}",
"\n",
"}",
"\n\n",
"return",
"&",
"LintResult",
"{",
"Status",
":",
"Pass",
",",
"}",
"\n",
"}"
] |
22,773 | all-22774 | [
"Do",
"executes",
"Storage",
".",
"getUsageAndQuota",
"against",
"the",
"provided",
"context",
".",
"returns",
":",
"usage",
"-",
"Storage",
"usage",
"(",
"bytes",
")",
".",
"quota",
"-",
"Storage",
"quota",
"(",
"bytes",
")",
".",
"usageBreakdown",
"-",
"Storage",
"usage",
"per",
"type",
"(",
"bytes",
")",
"."
] | [
"func",
"(",
"p",
"*",
"GetUsageAndQuotaParams",
")",
"Do",
"(",
"ctx",
"context",
".",
"Context",
")",
"(",
"usage",
"float64",
",",
"quota",
"float64",
",",
"usageBreakdown",
"[",
"]",
"*",
"UsageForType",
",",
"err",
"error",
")",
"{",
"// execute",
"var",
"res",
"GetUsageAndQuotaReturns",
"\n",
"err",
"=",
"cdp",
".",
"Execute",
"(",
"ctx",
",",
"CommandGetUsageAndQuota",
",",
"p",
",",
"&",
"res",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"0",
",",
"0",
",",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"return",
"res",
".",
"Usage",
",",
"<mask>",
".",
"Quota",
",",
"res",
".",
"UsageBreakdown",
",",
"nil",
"\n",
"}"
] |
22,774 | all-22775 | [
"hasID",
"look",
"for",
"a",
"specific",
"id",
"in",
"a",
"list",
"of",
"events"
] | [
"func",
"hasID",
"(",
"events",
"[",
"]",
"*",
"github",
".",
"IssueEvent",
",",
"id",
"int",
")",
"bool",
"{",
"for",
"_",
",",
"event",
":=",
"range",
"events",
"{",
"if",
"*",
"event",
".",
"ID",
"==",
"int64",
"(",
"id",
")",
"{",
"return",
"true",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"<mask>",
"\n",
"}"
] |
22,775 | all-22776 | [
"NewClusterWithHost",
"returns",
"a",
"cluster",
"with",
"the",
"given",
"URIs",
"."
] | [
"func",
"NewClusterWithHost",
"(",
"hosts",
"...",
"*",
"URI",
")",
"*",
"Cluster",
"{",
"cluster",
":=",
"DefaultCluster",
"(",
")",
"\n",
"for",
"_",
",",
"host",
":=",
"<mask>",
"hosts",
"{",
"cluster",
".",
"AddHost",
"(",
"host",
")",
"\n",
"}",
"\n",
"return",
"cluster",
"\n",
"}"
] |
22,776 | all-22777 | [
"New",
"generator",
"for",
"creating",
"a",
"Buffalo",
"API",
"application"
] | [
"func",
"New",
"(",
"opts",
"*",
"Options",
")",
"(",
"*",
"genny",
".",
"<mask>",
",",
"error",
")",
"{",
"if",
"err",
":=",
"opts",
".",
"Validate",
"(",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"gg",
",",
"err",
":=",
"core",
".",
"New",
"(",
"opts",
".",
"Options",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"gg",
",",
"err",
"\n",
"}",
"\n\n",
"g",
":=",
"genny",
".",
"New",
"(",
")",
"\n",
"data",
":=",
"map",
"[",
"string",
"]",
"interface",
"{",
"}",
"{",
"\"",
"\"",
":",
"opts",
",",
"}",
"\n\n",
"helpers",
":=",
"template",
".",
"FuncMap",
"{",
"}",
"\n\n",
"t",
":=",
"gogen",
".",
"TemplateTransformer",
"(",
"data",
",",
"helpers",
")",
"\n",
"g",
".",
"Transformer",
"(",
"t",
")",
"\n",
"g",
".",
"Box",
"(",
"packr",
".",
"New",
"(",
"\"",
"\"",
",",
"\"",
"\"",
")",
")",
"\n\n",
"gg",
".",
"Add",
"(",
"g",
")",
"\n\n",
"return",
"gg",
",",
"nil",
"\n",
"}"
] |
22,777 | all-22778 | [
"RemoveAppImages",
"removes",
"all",
"app",
"images",
"from",
"a",
"remote",
"registry",
"v2",
"server",
"returning",
"an",
"error",
"in",
"case",
"of",
"failure",
"."
] | [
"func",
"RemoveAppImages",
"(",
"appName",
"string",
")",
"error",
"{",
"registry",
",",
"_",
":=",
"config",
".",
"GetString",
"(",
"\"",
"\"",
")",
"\n",
"if",
"registry",
"==",
"\"",
"\"",
"{",
"// Nothing to do if no registry is set",
"return",
"nil",
"\n",
"}",
"\n",
"r",
":=",
"&",
"dockerRegistry",
"{",
"server",
":",
"registry",
"}",
"\n",
"<mask>",
":=",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"appName",
")",
"\n",
"tags",
",",
"err",
":=",
"r",
".",
"getImageTags",
"(",
"image",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"multi",
":=",
"tsuruErrors",
".",
"NewMultiError",
"(",
")",
"\n",
"for",
"_",
",",
"tag",
":=",
"range",
"tags",
"{",
"digest",
",",
"err",
":=",
"r",
".",
"getDigest",
"(",
"image",
",",
"tag",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"multi",
".",
"Add",
"(",
"errors",
".",
"Wrapf",
"(",
"err",
",",
"\"",
"\"",
",",
"r",
".",
"server",
",",
"image",
",",
"tag",
")",
")",
"\n",
"continue",
"\n",
"}",
"\n",
"err",
"=",
"r",
".",
"removeImage",
"(",
"image",
",",
"digest",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"multi",
".",
"Add",
"(",
"errors",
".",
"Wrapf",
"(",
"err",
",",
"\"",
"\"",
",",
"r",
".",
"server",
",",
"image",
",",
"tag",
",",
"digest",
")",
")",
"\n",
"if",
"errors",
".",
"Cause",
"(",
"err",
")",
"==",
"ErrDeleteDisabled",
"{",
"break",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"multi",
".",
"ToError",
"(",
")",
"\n",
"}"
] |
22,778 | all-22779 | [
"MarshalJSON",
"supports",
"json",
".",
"Marshaler",
"interface"
] | [
"func",
"(",
"v",
"GetHeapUsageReturns",
")",
"MarshalJSON",
"(",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"w",
":=",
"jwriter",
".",
"Writer",
"{",
"}",
"\n",
"easyjsonC5a4559bEncodeGithubComChromedpCdprotoRuntime25",
"(",
"&",
"w",
",",
"v",
")",
"\n",
"return",
"w",
".",
"Buffer",
".",
"BuildBytes",
"(",
")",
",",
"w",
".",
"<mask>",
"\n",
"}"
] |
22,779 | all-22780 | [
"OptClientManualServerAddress",
"forces",
"the",
"client",
"use",
"only",
"the",
"manual",
"server",
"address"
] | [
"func",
"OptClientManualServerAddress",
"(",
"enabled",
"bool",
")",
"ClientOption",
"{",
"return",
"func",
"(",
"options",
"*",
"ClientOptions",
")",
"error",
"{",
"<mask>",
".",
"manualServerAddress",
"=",
"enabled",
"\n",
"return",
"nil",
"\n",
"}",
"\n",
"}"
] |
22,780 | all-22781 | [
"GetAccelPath",
"is",
"a",
"wrapper",
"around",
"gtk_menu_get_accel_path",
"()",
"."
] | [
"func",
"(",
"v",
"*",
"Menu",
")",
"GetAccelPath",
"(",
")",
"string",
"{",
"c",
":=",
"C",
".",
"gtk_menu_get_accel_path",
"(",
"v",
".",
"native",
"(",
")",
")",
"\n",
"return",
"C",
".",
"GoString",
"(",
"(",
"*",
"C",
".",
"<mask>",
")",
"(",
"c",
")",
")",
"\n",
"}"
] |
22,781 | all-22782 | [
"CreateComment",
"creates",
"a",
"comment",
"on",
"the",
"issue",
".",
"See",
"https",
":",
"//",
"developer",
".",
"github",
".",
"com",
"/",
"v3",
"/",
"issues",
"/",
"comments",
"/",
"#create",
"-",
"a",
"-",
"comment"
] | [
"func",
"(",
"c",
"*",
"Client",
")",
"CreateComment",
"(",
"org",
",",
"repo",
"string",
",",
"number",
"int",
",",
"<mask>",
"string",
")",
"error",
"{",
"c",
".",
"log",
"(",
"\"",
"\"",
",",
"org",
",",
"repo",
",",
"number",
",",
"comment",
")",
"\n",
"ic",
":=",
"IssueComment",
"{",
"Body",
":",
"comment",
",",
"}",
"\n",
"_",
",",
"err",
":=",
"c",
".",
"request",
"(",
"&",
"request",
"{",
"method",
":",
"http",
".",
"MethodPost",
",",
"path",
":",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"org",
",",
"repo",
",",
"number",
")",
",",
"requestBody",
":",
"&",
"ic",
",",
"exitCodes",
":",
"[",
"]",
"int",
"{",
"201",
"}",
",",
"}",
",",
"nil",
")",
"\n",
"return",
"err",
"\n",
"}"
] |
22,782 | all-22783 | [
"MarshalJSON",
"supports",
"json",
".",
"Marshaler",
"interface"
] | [
"func",
"(",
"v",
"SetVirtualTimePolicyReturns",
")",
"MarshalJSON",
"(",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"w",
":=",
"jwriter",
".",
"Writer",
"{",
"}",
"\n",
"easyjsonC5a4559bEncodeGithubComChromedpCdprotoEmulation",
"(",
"&",
"w",
",",
"v",
")",
"\n",
"return",
"w",
".",
"Buffer",
".",
"BuildBytes",
"(",
")",
",",
"w",
".",
"<mask>",
"\n",
"}"
] |
22,783 | all-22784 | [
"NewUbuntuCluster",
"creates",
"a",
"simple",
"Ubuntu",
"Openstack",
"cluster",
"."
] | [
"func",
"NewUbuntuCluster",
"(",
"name",
"string",
")",
"*",
"cluster",
".",
"Cluster",
"{",
"var",
"(",
"masterName",
"=",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"name",
")",
"\n",
"nodeName",
"=",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"name",
")",
"\n",
")",
"\n",
"controlPlaneProviderConfig",
":=",
"&",
"cluster",
".",
"ControlPlaneProviderConfig",
"{",
"Cloud",
":",
"cluster",
".",
"CloudECS",
",",
"<mask>",
":",
"\"",
"\"",
",",
"SSH",
":",
"&",
"cluster",
".",
"SSH",
"{",
"PublicKeyPath",
":",
"\"",
"\"",
",",
"User",
":",
"\"",
"\"",
",",
"}",
",",
"Values",
":",
"&",
"cluster",
".",
"Values",
"{",
"ItemMap",
":",
"map",
"[",
"string",
"]",
"string",
"{",
"\"",
"\"",
":",
"kubeadm",
".",
"GetRandomToken",
"(",
")",
",",
"}",
",",
"}",
",",
"KubernetesAPI",
":",
"&",
"cluster",
".",
"KubernetesAPI",
"{",
"Port",
":",
"\"",
"\"",
",",
"}",
",",
"Network",
":",
"&",
"cluster",
".",
"Network",
"{",
"Type",
":",
"cluster",
".",
"NetworkTypePublic",
",",
"InternetGW",
":",
"&",
"cluster",
".",
"InternetGW",
"{",
"Name",
":",
"\"",
"\"",
",",
"}",
",",
"}",
",",
"}",
"\n",
"machineSetsProviderConfigs",
":=",
"[",
"]",
"*",
"cluster",
".",
"MachineProviderConfig",
"{",
"{",
"ServerPool",
":",
"&",
"cluster",
".",
"ServerPool",
"{",
"Type",
":",
"cluster",
".",
"ServerPoolTypeMaster",
",",
"Name",
":",
"masterName",
",",
"MaxCount",
":",
"1",
",",
"Image",
":",
"\"",
"\"",
",",
"Size",
":",
"\"",
"\"",
",",
"BootstrapScripts",
":",
"[",
"]",
"string",
"{",
"\"",
"\"",
",",
"}",
",",
"Subnets",
":",
"[",
"]",
"*",
"cluster",
".",
"Subnet",
"{",
"{",
"Name",
":",
"\"",
"\"",
",",
"CIDR",
":",
"\"",
"\"",
",",
"}",
",",
"}",
",",
"Firewalls",
":",
"[",
"]",
"*",
"cluster",
".",
"Firewall",
"{",
"{",
"Name",
":",
"masterName",
",",
"IngressRules",
":",
"[",
"]",
"*",
"cluster",
".",
"IngressRule",
"{",
"{",
"IngressFromPort",
":",
"\"",
"\"",
",",
"IngressToPort",
":",
"\"",
"\"",
",",
"IngressSource",
":",
"\"",
"\"",
",",
"IngressProtocol",
":",
"\"",
"\"",
",",
"}",
",",
"{",
"IngressFromPort",
":",
"\"",
"\"",
",",
"IngressToPort",
":",
"\"",
"\"",
",",
"IngressSource",
":",
"\"",
"\"",
",",
"IngressProtocol",
":",
"\"",
"\"",
",",
"}",
",",
"{",
"IngressSource",
":",
"\"",
"\"",
",",
"}",
",",
"}",
",",
"}",
",",
"}",
",",
"}",
",",
"}",
",",
"{",
"ServerPool",
":",
"&",
"cluster",
".",
"ServerPool",
"{",
"Type",
":",
"cluster",
".",
"ServerPoolTypeNode",
",",
"Name",
":",
"nodeName",
",",
"MaxCount",
":",
"2",
",",
"Image",
":",
"\"",
"\"",
",",
"Size",
":",
"\"",
"\"",
",",
"BootstrapScripts",
":",
"[",
"]",
"string",
"{",
"\"",
"\"",
",",
"}",
",",
"Firewalls",
":",
"[",
"]",
"*",
"cluster",
".",
"Firewall",
"{",
"{",
"Name",
":",
"nodeName",
",",
"IngressRules",
":",
"[",
"]",
"*",
"cluster",
".",
"IngressRule",
"{",
"{",
"IngressFromPort",
":",
"\"",
"\"",
",",
"IngressToPort",
":",
"\"",
"\"",
",",
"IngressSource",
":",
"\"",
"\"",
",",
"IngressProtocol",
":",
"\"",
"\"",
",",
"}",
",",
"{",
"IngressSource",
":",
"\"",
"\"",
",",
"}",
",",
"}",
",",
"}",
",",
"}",
",",
"}",
",",
"}",
",",
"}",
"\n",
"c",
":=",
"cluster",
".",
"NewCluster",
"(",
"name",
")",
"\n",
"c",
".",
"SetProviderConfig",
"(",
"controlPlaneProviderConfig",
")",
"\n",
"c",
".",
"NewMachineSetsFromProviderConfigs",
"(",
"machineSetsProviderConfigs",
")",
"\n",
"return",
"c",
"\n",
"}"
] |
22,784 | all-22785 | [
"CreateDashboard",
"creates",
"a",
"new",
"dashboard",
"."
] | [
"func",
"(",
"a",
"*",
"API",
")",
"CreateDashboard",
"(",
"cfg",
"*",
"Dashboard",
")",
"(",
"*",
"Dashboard",
",",
"error",
")",
"{",
"if",
"cfg",
"==",
"nil",
"{",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"jsonCfg",
",",
"err",
":=",
"json",
".",
"Marshal",
"(",
"cfg",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"if",
"a",
".",
"Debug",
"{",
"a",
".",
"<mask>",
".",
"Printf",
"(",
"\"",
"\"",
",",
"string",
"(",
"jsonCfg",
")",
")",
"\n",
"}",
"\n\n",
"result",
",",
"err",
":=",
"a",
".",
"Post",
"(",
"config",
".",
"DashboardPrefix",
",",
"jsonCfg",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"dashboard",
":=",
"&",
"Dashboard",
"{",
"}",
"\n",
"if",
"err",
":=",
"json",
".",
"Unmarshal",
"(",
"result",
",",
"dashboard",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"return",
"dashboard",
",",
"nil",
"\n",
"}"
] |
22,785 | all-22786 | [
"Load",
"reads",
"state",
"off",
"the",
"disk",
"from",
"the",
"well",
"-",
"known",
"filepath",
"and",
"loads",
"it",
"into",
"the",
"passed",
"State",
"object",
"."
] | [
"func",
"(",
"manager",
"*",
"basicStateManager",
")",
"Load",
"(",
")",
"error",
"{",
"s",
":=",
"manager",
".",
"state",
"\n",
"log",
".",
"Info",
"(",
"\"",
"\"",
")",
"\n",
"data",
",",
"err",
":=",
"manager",
".",
"readFile",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"<mask>",
".",
"Error",
"(",
"\"",
"\"",
",",
"\"",
"\"",
",",
"err",
")",
"\n",
"return",
"err",
"\n",
"}",
"\n",
"if",
"data",
"==",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n",
"// Dry-run to make sure this is a version we can understand",
"err",
"=",
"manager",
".",
"dryRun",
"(",
"data",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"// Now load it into the actual state. The reason we do this with the",
"// intermediate state is that we *must* unmarshal directly into the",
"// \"saveable\" pointers we were given in AddSaveable; if we unmarshal",
"// directly into a map with values of pointers, those pointers are lost.",
"// We *must* unmarshal this way because the existing pointers could have",
"// semi-initialized data (and are actually expected to)",
"var",
"intermediate",
"intermediateState",
"\n",
"err",
"=",
"json",
".",
"Unmarshal",
"(",
"data",
",",
"&",
"intermediate",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"log",
".",
"Debug",
"(",
"\"",
"\"",
")",
"\n",
"return",
"err",
"\n",
"}",
"\n\n",
"for",
"key",
",",
"rawJSON",
":=",
"range",
"intermediate",
".",
"Data",
"{",
"actualPointer",
",",
"ok",
":=",
"manager",
".",
"state",
".",
"Data",
"[",
"key",
"]",
"\n",
"if",
"!",
"ok",
"{",
"log",
".",
"Error",
"(",
"\"",
"\"",
"+",
"key",
")",
"\n",
"continue",
"\n",
"}",
"\n",
"err",
"=",
"json",
".",
"Unmarshal",
"(",
"rawJSON",
",",
"actualPointer",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"log",
".",
"Debug",
"(",
"\"",
"\"",
")",
"\n",
"return",
"err",
"\n",
"}",
"\n",
"}",
"\n\n",
"log",
".",
"Debug",
"(",
"\"",
"\"",
",",
"\"",
"\"",
",",
"s",
")",
"\n",
"return",
"nil",
"\n",
"}"
] |
22,786 | all-22787 | [
"FindRulesByImport",
"attempts",
"to",
"resolve",
"an",
"import",
"string",
"to",
"a",
"rule",
"record",
".",
"imp",
"is",
"the",
"import",
"to",
"resolve",
"(",
"which",
"includes",
"the",
"target",
"language",
")",
".",
"lang",
"is",
"the",
"language",
"of",
"the",
"rule",
"with",
"the",
"dependency",
"(",
"for",
"example",
"in",
"go_proto_library",
"imp",
"will",
"have",
"ProtoLang",
"and",
"lang",
"will",
"be",
"GoLang",
")",
".",
"from",
"is",
"the",
"rule",
"which",
"is",
"doing",
"the",
"dependency",
".",
"This",
"is",
"used",
"to",
"check",
"vendoring",
"visibility",
"and",
"to",
"check",
"for",
"self",
"-",
"imports",
".",
"FindRulesByImport",
"returns",
"a",
"list",
"of",
"rules",
"since",
"any",
"number",
"of",
"rules",
"may",
"provide",
"the",
"same",
"import",
".",
"Callers",
"may",
"need",
"to",
"resolve",
"ambiguities",
"using",
"language",
"-",
"specific",
"heuristics",
"."
] | [
"func",
"(",
"ix",
"*",
"RuleIndex",
")",
"FindRulesByImport",
"(",
"imp",
"ImportSpec",
",",
"lang",
"string",
")",
"[",
"]",
"FindResult",
"{",
"matches",
":=",
"ix",
".",
"importMap",
"[",
"imp",
"]",
"\n",
"results",
":=",
"make",
"(",
"[",
"]",
"FindResult",
",",
"0",
",",
"len",
"(",
"matches",
")",
")",
"\n",
"for",
"_",
",",
"m",
":=",
"range",
"matches",
"{",
"if",
"ix",
".",
"mrslv",
"(",
"m",
".",
"rule",
",",
"\"",
"\"",
")",
".",
"Name",
"(",
")",
"!=",
"lang",
"{",
"continue",
"\n",
"}",
"\n",
"results",
"=",
"append",
"(",
"results",
",",
"FindResult",
"{",
"<mask>",
":",
"m",
".",
"label",
",",
"Embeds",
":",
"m",
".",
"embeds",
",",
"}",
")",
"\n",
"}",
"\n",
"return",
"results",
"\n",
"}"
] |
22,787 | all-22788 | [
"DoTimeout",
"calculates",
"deadline",
"and",
"calls",
"DoDeadline",
"on",
"the",
"least",
"loaded",
"client"
] | [
"func",
"(",
"cc",
"*",
"LBClient",
")",
"DoTimeout",
"(",
"req",
"*",
"Request",
",",
"resp",
"*",
"<mask>",
",",
"timeout",
"time",
".",
"Duration",
")",
"error",
"{",
"deadline",
":=",
"time",
".",
"Now",
"(",
")",
".",
"Add",
"(",
"timeout",
")",
"\n",
"return",
"cc",
".",
"get",
"(",
")",
".",
"DoDeadline",
"(",
"req",
",",
"resp",
",",
"deadline",
")",
"\n",
"}"
] |
22,788 | all-22789 | [
"Specify",
"the",
"value",
"of",
"a",
"uniform",
"variable",
"for",
"the",
"current",
"program",
"object"
] | [
"func",
"Uniform1i",
"(",
"location",
"int32",
",",
"v0",
"int32",
")",
"{",
"syscall",
".",
"Syscall",
"(",
"gpUniform1i",
",",
"2",
",",
"uintptr",
"(",
"<mask>",
")",
",",
"uintptr",
"(",
"v0",
")",
",",
"0",
")",
"\n",
"}"
] |
22,789 | all-22790 | [
"HasFillMax",
"returns",
"a",
"boolean",
"if",
"a",
"field",
"has",
"been",
"set",
"."
] | [
"func",
"(",
"t",
"*",
"TileDefStyle",
")",
"HasFillMax",
"(",
")",
"bool",
"{",
"if",
"t",
"!=",
"nil",
"&&",
"t",
".",
"FillMax",
"!=",
"nil",
"{",
"return",
"true",
"\n",
"}",
"\n\n",
"return",
"<mask>",
"\n",
"}"
] |
22,790 | all-22791 | [
"Execute",
"-",
"updates",
"named",
"quota"
] | [
"func",
"(",
"c",
"*",
"OrgNamedQuotaConfigurationCommand",
")",
"Execute",
"(",
"args",
"[",
"]",
"string",
")",
"error",
"{",
"c",
".",
"initConfig",
"(",
")",
"\n",
"orgQuota",
",",
"err",
":=",
"c",
".",
"ConfigManager",
".",
"GetOrgQuota",
"(",
"c",
".",
"Name",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"if",
"orgQuota",
"==",
"nil",
"{",
"orgQuota",
"=",
"&",
"config",
".",
"OrgQuota",
"{",
"Name",
":",
"c",
".",
"Name",
",",
"TotalPrivateDomains",
":",
"\"",
"\"",
",",
"TotalReservedRoutePorts",
":",
"\"",
"\"",
",",
"TotalServiceKeys",
":",
"\"",
"\"",
",",
"AppInstanceLimit",
":",
"\"",
"\"",
",",
"AppTaskLimit",
":",
"\"",
"\"",
",",
"InstanceMemoryLimit",
":",
"\"",
"\"",
",",
"TotalRoutes",
":",
"\"",
"\"",
",",
"TotalServices",
":",
"\"",
"\"",
",",
"PaidServicePlansAllowed",
":",
"true",
",",
"}",
"\n",
"}",
"\n",
"errorString",
":=",
"\"",
"\"",
"\n",
"updateOrgNamedQuotaConfig",
"(",
"orgQuota",
",",
"c",
".",
"Quota",
",",
"&",
"errorString",
")",
"\n\n",
"if",
"errorString",
"!=",
"\"",
"\"",
"{",
"return",
"<mask>",
".",
"New",
"(",
"errorString",
")",
"\n",
"}",
"\n",
"return",
"c",
".",
"ConfigManager",
".",
"SaveOrgQuota",
"(",
"orgQuota",
")",
"\n",
"}"
] |
22,791 | all-22792 | [
"GetAcceptFocus",
"is",
"a",
"wrapper",
"around",
"gtk_window_get_accept_focus",
"()",
"."
] | [
"func",
"(",
"v",
"*",
"Window",
")",
"GetAcceptFocus",
"(",
")",
"bool",
"{",
"c",
":=",
"C",
".",
"gtk_window_get_accept_focus",
"(",
"v",
".",
"native",
"(",
")",
")",
"\n",
"<mask>",
"gobool",
"(",
"c",
")",
"\n",
"}"
] |
22,792 | all-22793 | [
"ManageOffer",
"groups",
"the",
"creation",
"of",
"a",
"new",
"ManageOfferBuilder",
"with",
"a",
"call",
"to",
"Mutate",
"."
] | [
"func",
"ManageOffer",
"(",
"passiveOffer",
"bool",
",",
"muts",
"...",
"<mask>",
"{",
"}",
")",
"(",
"result",
"ManageOfferBuilder",
")",
"{",
"result",
".",
"PassiveOffer",
"=",
"passiveOffer",
"\n",
"result",
".",
"Mutate",
"(",
"muts",
"...",
")",
"\n",
"return",
"\n",
"}"
] |
22,793 | all-22794 | [
"MapCloudIP",
"issues",
"a",
"request",
"to",
"map",
"the",
"cloud",
"ip",
"to",
"the",
"destination",
".",
"The",
"destination",
"can",
"be",
"an",
"identifier",
"of",
"any",
"resource",
"capable",
"of",
"receiving",
"a",
"Cloud",
"IP",
"such",
"as",
"a",
"server",
"interface",
"a",
"load",
"balancer",
"or",
"a",
"cloud",
"sql",
"instace",
".",
"To",
"map",
"a",
"Cloud",
"IP",
"to",
"a",
"server",
"first",
"lookup",
"the",
"server",
"to",
"get",
"it",
"s",
"interface",
"identifier",
"(",
"or",
"use",
"the",
"MapCloudIPtoServer",
"convenience",
"method",
")"
] | [
"func",
"(",
"c",
"*",
"Client",
")",
"MapCloudIP",
"(",
"identifier",
"string",
",",
"destination",
"string",
")",
"error",
"{",
"_",
",",
"err",
":=",
"c",
".",
"MakeApiRequest",
"(",
"\"",
"\"",
",",
"\"",
"\"",
"+",
"identifier",
"+",
"\"",
"\"",
",",
"<mask>",
"[",
"string",
"]",
"string",
"{",
"\"",
"\"",
":",
"destination",
"}",
",",
"nil",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
] |
22,794 | all-22795 | [
"NewGossip",
"returns",
"a",
"usable",
"GossipChannel",
"from",
"the",
"router",
".",
"TODO",
"(",
"pb",
")",
":",
"rename?"
] | [
"func",
"(",
"router",
"*",
"Router",
")",
"NewGossip",
"(",
"channelName",
"string",
",",
"g",
"Gossiper",
")",
"(",
"Gossip",
",",
"error",
")",
"{",
"channel",
":=",
"newGossipChannel",
"(",
"channelName",
",",
"router",
".",
"Ourself",
",",
"router",
".",
"Routes",
",",
"g",
",",
"router",
".",
"logger",
")",
"\n",
"router",
".",
"gossipLock",
".",
"Lock",
"(",
")",
"\n",
"defer",
"router",
".",
"gossipLock",
".",
"Unlock",
"(",
")",
"\n",
"if",
"_",
",",
"found",
":=",
"router",
".",
"gossipChannels",
"[",
"channelName",
"]",
";",
"<mask>",
"{",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"channelName",
")",
"\n",
"}",
"\n",
"router",
".",
"gossipChannels",
"[",
"channelName",
"]",
"=",
"channel",
"\n",
"return",
"channel",
",",
"nil",
"\n",
"}"
] |
22,795 | all-22796 | [
"MarshalJSON",
"supports",
"json",
".",
"Marshaler",
"interface"
] | [
"func",
"(",
"v",
"RequestCacheNamesReturns",
")",
"MarshalJSON",
"(",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"w",
":=",
"jwriter",
".",
"<mask>",
"{",
"}",
"\n",
"easyjsonC5a4559bEncodeGithubComChromedpCdprotoCachestorage4",
"(",
"&",
"w",
",",
"v",
")",
"\n",
"return",
"w",
".",
"Buffer",
".",
"BuildBytes",
"(",
")",
",",
"w",
".",
"Error",
"\n",
"}"
] |
22,796 | all-22797 | [
"ResetPartitionOffset",
"marks",
"an",
"offset",
"of",
"the",
"provided",
"topic",
"/",
"partition",
"as",
"processed",
".",
"See",
"ResetOffset",
"for",
"additional",
"explanation",
"."
] | [
"func",
"(",
"c",
"*",
"Consumer",
")",
"ResetPartitionOffset",
"(",
"topic",
"string",
",",
"partition",
"int32",
",",
"offset",
"int64",
",",
"<mask>",
"string",
")",
"{",
"sub",
":=",
"c",
".",
"subs",
".",
"Fetch",
"(",
"topic",
",",
"partition",
")",
"\n",
"if",
"sub",
"!=",
"nil",
"{",
"sub",
".",
"ResetOffset",
"(",
"offset",
",",
"metadata",
")",
"\n",
"}",
"\n",
"}"
] |
22,797 | all-22798 | [
"NewImage",
"returns",
"a",
"types",
".",
"ImageCloser",
"for",
"this",
"reference",
"possibly",
"specialized",
"for",
"this",
"ImageTransport",
".",
"The",
"caller",
"must",
"call",
".",
"Close",
"()",
"on",
"the",
"returned",
"ImageCloser",
".",
"NOTE",
":",
"If",
"any",
"kind",
"of",
"signature",
"verification",
"should",
"happen",
"build",
"an",
"UnparsedImage",
"from",
"the",
"value",
"returned",
"by",
"NewImageSource",
"verify",
"that",
"UnparsedImage",
"and",
"convert",
"it",
"into",
"a",
"real",
"Image",
"via",
"image",
".",
"FromUnparsedImage",
"."
] | [
"func",
"(",
"ref",
"ostreeReference",
")",
"NewImage",
"(",
"ctx",
"context",
".",
"Context",
",",
"sys",
"*",
"<mask>",
".",
"SystemContext",
")",
"(",
"types",
".",
"ImageCloser",
",",
"error",
")",
"{",
"var",
"tmpDir",
"string",
"\n",
"if",
"sys",
"==",
"nil",
"||",
"sys",
".",
"OSTreeTmpDirPath",
"==",
"\"",
"\"",
"{",
"tmpDir",
"=",
"os",
".",
"TempDir",
"(",
")",
"\n",
"}",
"else",
"{",
"tmpDir",
"=",
"sys",
".",
"OSTreeTmpDirPath",
"\n",
"}",
"\n",
"src",
",",
"err",
":=",
"newImageSource",
"(",
"tmpDir",
",",
"ref",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"return",
"image",
".",
"FromSource",
"(",
"ctx",
",",
"sys",
",",
"src",
")",
"\n",
"}"
] |
22,798 | all-22799 | [
"Len",
"derives",
"the",
"scalar",
"scalar",
"length",
"of",
"the",
"vector",
".",
"(",
"len",
")"
] | [
"func",
"(",
"v",
"Vec3",
")",
"Len",
"(",
")",
"float32",
"{",
"<mask>",
"math32",
".",
"Sqrt",
"(",
"v",
"[",
"0",
"]",
"*",
"v",
"[",
"0",
"]",
"+",
"v",
"[",
"1",
"]",
"*",
"v",
"[",
"1",
"]",
"+",
"v",
"[",
"2",
"]",
"*",
"v",
"[",
"2",
"]",
")",
"\n",
"}"
] |
22,799 | all-22800 | [
"SetItems",
"implements",
"the",
"Collection",
"interface"
] | [
"func",
"(",
"in",
"*",
"ResourcesConfigCollection",
")",
"SetItems",
"(",
"objects",
"[",
"]",
"Object",
")",
"{",
"<mask>",
"items",
"[",
"]",
"*",
"ResourcesConfigObject",
"\n",
"for",
"_",
",",
"b",
":=",
"range",
"objects",
"{",
"items",
"=",
"append",
"(",
"items",
",",
"b",
".",
"(",
"*",
"ResourcesConfigObject",
")",
")",
"\n",
"}",
"\n",
"in",
".",
"Items",
"=",
"items",
"\n",
"}"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.