id
int32 0
25.3k
| idx
stringlengths 5
9
| nl_tokens
sequencelengths 1
418
| pl_tokens
sequencelengths 22
4.98k
|
---|---|---|---|
23,100 | all-23101 | [
"SauceLabs",
"opens",
"a",
"Sauce",
"Labs",
"session",
"and",
"returns",
"a",
"*",
"Page",
".",
"Does",
"not",
"support",
"Sauce",
"Connect",
".",
"This",
"method",
"takes",
"the",
"same",
"Options",
"as",
"NewPage",
".",
"Passing",
"the",
"Desired",
"Option",
"will",
"completely",
"override",
"the",
"provided",
"name",
"platform",
"browser",
"and",
"version",
"."
] | [
"func",
"SauceLabs",
"(",
"name",
",",
"platform",
",",
"browser",
",",
"version",
",",
"username",
",",
"accessKey",
"string",
",",
"options",
"...",
"Option",
")",
"(",
"*",
"Page",
",",
"error",
")",
"{",
"url",
":=",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"username",
",",
"accessKey",
")",
"\n",
"capabilities",
":=",
"NewCapabilities",
"(",
")",
".",
"Browser",
"(",
"browser",
")",
".",
"Platform",
"(",
"platform",
")",
".",
"Version",
"(",
"version",
")",
"\n",
"capabilities",
"[",
"\"",
"\"",
"]",
"=",
"name",
"\n",
"return",
"NewPage",
"(",
"url",
",",
"append",
"(",
"[",
"]",
"Option",
"{",
"Desired",
"(",
"capabilities",
")",
"}",
",",
"<mask>",
"...",
")",
"...",
")",
"\n",
"}"
] |
23,101 | all-23102 | [
"Objects",
"returns",
"all",
"known",
"objects",
"named",
"as",
"well",
"as",
"unnamed",
".",
"The",
"returned",
"elements",
"are",
"not",
"in",
"a",
"stable",
"order",
"."
] | [
"func",
"(",
"g",
"*",
"Graph",
")",
"Objects",
"(",
")",
"[",
"]",
"*",
"Object",
"{",
"objects",
":=",
"make",
"(",
"[",
"]",
"*",
"Object",
",",
"0",
",",
"len",
"(",
"g",
".",
"unnamed",
")",
"+",
"len",
"(",
"g",
".",
"named",
")",
")",
"\n",
"for",
"_",
",",
"o",
":=",
"range",
"g",
".",
"unnamed",
"{",
"if",
"!",
"o",
".",
"embedded",
"{",
"objects",
"=",
"append",
"(",
"objects",
",",
"o",
")",
"\n",
"}",
"\n",
"}",
"\n",
"for",
"_",
",",
"o",
":=",
"range",
"g",
".",
"named",
"{",
"if",
"!",
"o",
".",
"embedded",
"{",
"objects",
"=",
"append",
"(",
"objects",
",",
"o",
")",
"\n",
"}",
"\n",
"}",
"\n",
"// randomize to prevent callers from relying on ordering",
"for",
"i",
":=",
"0",
";",
"i",
"<",
"len",
"(",
"objects",
")",
";",
"i",
"++",
"{",
"j",
":=",
"<mask>",
".",
"Intn",
"(",
"i",
"+",
"1",
")",
"\n",
"objects",
"[",
"i",
"]",
",",
"objects",
"[",
"j",
"]",
"=",
"objects",
"[",
"j",
"]",
",",
"objects",
"[",
"i",
"]",
"\n",
"}",
"\n",
"return",
"objects",
"\n",
"}"
] |
23,102 | all-23103 | [
"Fetch",
"retrieves",
"this",
"dependency",
"and",
"returns",
"the",
"result",
"or",
"any",
"errors",
"that",
"occur",
"in",
"the",
"process",
"."
] | [
"func",
"(",
"d",
"*",
"FileQuery",
")",
"Fetch",
"(",
"clients",
"*",
"ClientSet",
",",
"opts",
"*",
"QueryOptions",
")",
"(",
"interface",
"{",
"}",
",",
"*",
"ResponseMetadata",
",",
"error",
")",
"{",
"log",
".",
"Printf",
"(",
"\"",
"\"",
",",
"d",
",",
"d",
".",
"path",
")",
"\n\n",
"select",
"{",
"<mask>",
"<-",
"d",
".",
"stopCh",
":",
"log",
".",
"Printf",
"(",
"\"",
"\"",
",",
"d",
")",
"\n",
"return",
"\"",
"\"",
",",
"nil",
",",
"ErrStopped",
"\n",
"case",
"r",
":=",
"<-",
"d",
".",
"watch",
"(",
"d",
".",
"stat",
")",
":",
"if",
"r",
".",
"err",
"!=",
"nil",
"{",
"return",
"\"",
"\"",
",",
"nil",
",",
"errors",
".",
"Wrap",
"(",
"r",
".",
"err",
",",
"d",
".",
"String",
"(",
")",
")",
"\n",
"}",
"\n\n",
"log",
".",
"Printf",
"(",
"\"",
"\"",
",",
"d",
")",
"\n\n",
"data",
",",
"err",
":=",
"ioutil",
".",
"ReadFile",
"(",
"d",
".",
"path",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"\"",
"\"",
",",
"nil",
",",
"errors",
".",
"Wrap",
"(",
"err",
",",
"d",
".",
"String",
"(",
")",
")",
"\n",
"}",
"\n\n",
"d",
".",
"stat",
"=",
"r",
".",
"stat",
"\n",
"return",
"respWithMetadata",
"(",
"string",
"(",
"data",
")",
")",
"\n",
"}",
"\n",
"}"
] |
23,103 | all-23104 | [
"newBruteRanger",
"returns",
"a",
"new",
"Ranger",
"."
] | [
"func",
"newBruteRanger",
"(",
")",
"Ranger",
"{",
"return",
"&",
"bruteRanger",
"{",
"ipV4Entries",
":",
"<mask>",
"(",
"map",
"[",
"string",
"]",
"RangerEntry",
")",
",",
"ipV6Entries",
":",
"make",
"(",
"map",
"[",
"string",
"]",
"RangerEntry",
")",
",",
"}",
"\n",
"}"
] |
23,104 | all-23105 | [
"processNextItem",
"attempts",
"to",
"upload",
"container",
"logs",
"to",
"GCS"
] | [
"func",
"(",
"c",
"*",
"Controller",
")",
"processNextItem",
"(",
")",
"bool",
"{",
"key",
",",
"quit",
":=",
"c",
".",
"queue",
".",
"Get",
"(",
")",
"\n",
"if",
"quit",
"{",
"return",
"false",
"\n",
"}",
"\n",
"defer",
"c",
".",
"queue",
".",
"Done",
"(",
"<mask>",
")",
"\n\n",
"workItem",
":=",
"key",
".",
"(",
"item",
")",
"\n\n",
"prowJob",
",",
"err",
":=",
"c",
".",
"prowJobClient",
".",
"GetProwJob",
"(",
"workItem",
".",
"prowJobId",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"c",
".",
"handleErr",
"(",
"err",
",",
"workItem",
")",
"\n",
"return",
"true",
"\n",
"}",
"\n",
"spec",
":=",
"downwardapi",
".",
"NewJobSpec",
"(",
"prowJob",
".",
"Spec",
",",
"prowJob",
".",
"Status",
".",
"BuildID",
",",
"prowJob",
".",
"Name",
")",
"\n\n",
"result",
":=",
"c",
".",
"client",
".",
"Pods",
"(",
"workItem",
".",
"namespace",
")",
".",
"GetLogs",
"(",
"workItem",
".",
"podName",
",",
"&",
"api",
".",
"PodLogOptions",
"{",
"Container",
":",
"workItem",
".",
"containerName",
"}",
")",
".",
"Do",
"(",
")",
"\n",
"if",
"err",
":=",
"result",
".",
"Error",
"(",
")",
";",
"err",
"!=",
"nil",
"{",
"c",
".",
"handleErr",
"(",
"err",
",",
"workItem",
")",
"\n",
"return",
"true",
"\n",
"}",
"\n\n",
"// error is checked above",
"log",
",",
"_",
":=",
"result",
".",
"Raw",
"(",
")",
"\n",
"var",
"target",
"string",
"\n",
"if",
"workItem",
".",
"podName",
"==",
"workItem",
".",
"prowJobId",
"{",
"target",
"=",
"path",
".",
"Join",
"(",
"ContainerLogDir",
",",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"workItem",
".",
"containerName",
")",
")",
"\n",
"}",
"else",
"{",
"target",
"=",
"path",
".",
"Join",
"(",
"ContainerLogDir",
",",
"workItem",
".",
"podName",
",",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"workItem",
".",
"containerName",
")",
")",
"\n",
"}",
"\n",
"data",
":=",
"gcs",
".",
"DataUpload",
"(",
"bytes",
".",
"NewReader",
"(",
"log",
")",
")",
"\n",
"if",
"err",
":=",
"c",
".",
"gcsConfig",
".",
"Run",
"(",
"&",
"spec",
",",
"map",
"[",
"string",
"]",
"gcs",
".",
"UploadFunc",
"{",
"target",
":",
"data",
"}",
")",
";",
"err",
"!=",
"nil",
"{",
"c",
".",
"handleErr",
"(",
"err",
",",
"workItem",
")",
"\n",
"return",
"true",
"\n",
"}",
"\n",
"c",
".",
"queue",
".",
"Forget",
"(",
"key",
")",
"\n",
"return",
"true",
"\n",
"}"
] |
23,105 | all-23106 | [
"Fill",
"extra",
"image",
"fields",
"such",
"as",
"properties",
"and",
"alias",
".",
"This",
"is",
"called",
"after",
"fetching",
"a",
"single",
"row",
"from",
"the",
"images",
"table",
"."
] | [
"func",
"(",
"c",
"*",
"Cluster",
")",
"imageFill",
"(",
"id",
"int",
",",
"image",
"*",
"api",
".",
"Image",
",",
"create",
",",
"expire",
",",
"used",
",",
"upload",
"*",
"time",
".",
"Time",
",",
"arch",
"int",
")",
"error",
"{",
"// Some of the dates can be nil in the DB, let's process them.",
"if",
"create",
"!=",
"nil",
"{",
"image",
".",
"CreatedAt",
"=",
"*",
"create",
"\n",
"}",
"else",
"{",
"image",
".",
"CreatedAt",
"=",
"time",
".",
"Time",
"{",
"}",
"\n",
"}",
"\n\n",
"if",
"expire",
"!=",
"nil",
"{",
"image",
".",
"ExpiresAt",
"=",
"*",
"expire",
"\n",
"}",
"else",
"{",
"image",
".",
"ExpiresAt",
"=",
"time",
".",
"Time",
"{",
"}",
"\n",
"}",
"\n\n",
"if",
"used",
"!=",
"nil",
"{",
"image",
".",
"LastUsedAt",
"=",
"*",
"used",
"\n",
"}",
"else",
"{",
"image",
".",
"LastUsedAt",
"=",
"time",
".",
"Time",
"{",
"}",
"\n",
"}",
"\n\n",
"image",
".",
"Architecture",
",",
"_",
"=",
"osarch",
".",
"ArchitectureName",
"(",
"arch",
")",
"\n\n",
"// The upload date is enforced by NOT NULL in the schema, so it can never be nil.",
"image",
".",
"UploadedAt",
"=",
"*",
"upload",
"\n\n",
"// Get the properties",
"q",
":=",
"\"",
"\"",
"\n",
"var",
"key",
",",
"value",
",",
"name",
",",
"desc",
"string",
"\n",
"inargs",
":=",
"[",
"]",
"interface",
"{",
"}",
"{",
"id",
"}",
"\n",
"outfmt",
":=",
"[",
"]",
"interface",
"{",
"}",
"{",
"key",
",",
"value",
"}",
"\n",
"results",
",",
"err",
":=",
"queryScan",
"(",
"c",
".",
"db",
",",
"q",
",",
"inargs",
",",
"outfmt",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"properties",
":=",
"map",
"[",
"string",
"]",
"string",
"{",
"}",
"\n",
"for",
"_",
",",
"r",
":=",
"range",
"results",
"{",
"key",
"=",
"r",
"[",
"0",
"]",
".",
"(",
"string",
")",
"\n",
"value",
"=",
"r",
"[",
"1",
"]",
".",
"(",
"string",
")",
"\n",
"properties",
"[",
"key",
"]",
"=",
"value",
"\n",
"}",
"\n\n",
"image",
".",
"Properties",
"=",
"properties",
"\n\n",
"// Get the aliases",
"q",
"=",
"\"",
"\"",
"\n",
"inargs",
"=",
"[",
"]",
"interface",
"{",
"}",
"{",
"<mask>",
"}",
"\n",
"outfmt",
"=",
"[",
"]",
"interface",
"{",
"}",
"{",
"name",
",",
"desc",
"}",
"\n",
"results",
",",
"err",
"=",
"queryScan",
"(",
"c",
".",
"db",
",",
"q",
",",
"inargs",
",",
"outfmt",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"aliases",
":=",
"[",
"]",
"api",
".",
"ImageAlias",
"{",
"}",
"\n",
"for",
"_",
",",
"r",
":=",
"range",
"results",
"{",
"name",
"=",
"r",
"[",
"0",
"]",
".",
"(",
"string",
")",
"\n",
"desc",
"=",
"r",
"[",
"1",
"]",
".",
"(",
"string",
")",
"\n",
"a",
":=",
"api",
".",
"ImageAlias",
"{",
"Name",
":",
"name",
",",
"Description",
":",
"desc",
"}",
"\n",
"aliases",
"=",
"append",
"(",
"aliases",
",",
"a",
")",
"\n",
"}",
"\n\n",
"image",
".",
"Aliases",
"=",
"aliases",
"\n\n",
"_",
",",
"source",
",",
"err",
":=",
"c",
".",
"ImageSourceGet",
"(",
"id",
")",
"\n",
"if",
"err",
"==",
"nil",
"{",
"image",
".",
"UpdateSource",
"=",
"&",
"source",
"\n",
"}",
"\n\n",
"return",
"nil",
"\n",
"}"
] |
23,106 | all-23107 | [
"gValueSlice",
"converts",
"a",
"C",
"array",
"of",
"GValues",
"to",
"a",
"Go",
"slice",
"."
] | [
"func",
"gValueSlice",
"(",
"values",
"*",
"C",
".",
"GValue",
",",
"nValues",
"int",
")",
"(",
"slice",
"[",
"]",
"C",
".",
"GValue",
")",
"{",
"<mask>",
":=",
"(",
"*",
"reflect",
".",
"SliceHeader",
")",
"(",
"(",
"unsafe",
".",
"Pointer",
"(",
"&",
"slice",
")",
")",
")",
"\n",
"header",
".",
"Cap",
"=",
"nValues",
"\n",
"header",
".",
"Len",
"=",
"nValues",
"\n",
"header",
".",
"Data",
"=",
"uintptr",
"(",
"unsafe",
".",
"Pointer",
"(",
"values",
")",
")",
"\n",
"return",
"\n",
"}"
] |
23,107 | all-23108 | [
"GetMonitorWidthMM",
"is",
"a",
"wrapper",
"around",
"gdk_screen_get_monitor_width_mm",
"()",
"."
] | [
"func",
"(",
"v",
"*",
"Screen",
")",
"GetMonitorWidthMM",
"(",
"m",
"int",
")",
"int",
"{",
"<mask>",
"int",
"(",
"C",
".",
"gdk_screen_get_monitor_width_mm",
"(",
"v",
".",
"native",
"(",
")",
",",
"C",
".",
"gint",
"(",
"m",
")",
")",
")",
"\n",
"}"
] |
23,108 | all-23109 | [
"Logging",
"logs",
"http",
"requests"
] | [
"func",
"Logging",
"(",
"next",
"http",
".",
"Handler",
",",
"log",
"*",
"logrus",
".",
"Logger",
")",
"http",
".",
"Handler",
"{",
"return",
"http",
".",
"HandlerFunc",
"(",
"func",
"(",
"w",
"http",
".",
"ResponseWriter",
",",
"r",
"*",
"http",
".",
"Request",
")",
"{",
"srw",
":=",
"StatusResponseWriter",
"{",
"w",
",",
"0",
",",
"0",
"}",
"\n",
"start",
":=",
"time",
".",
"Now",
"(",
")",
"\n",
"next",
".",
"ServeHTTP",
"(",
"&",
"srw",
",",
"r",
")",
"\n",
"end",
":=",
"time",
".",
"Now",
"(",
")",
"\n",
"latency",
":=",
"end",
".",
"Sub",
"(",
"start",
")",
"\n\n",
"log",
".",
"WithField",
"(",
"\"",
"\"",
",",
"r",
".",
"RemoteAddr",
")",
".",
"WithField",
"(",
"\"",
"\"",
",",
"latency",
")",
".",
"WithField",
"(",
"\"",
"\"",
",",
"srw",
".",
"Length",
"(",
")",
")",
".",
"WithField",
"(",
"\"",
"\"",
",",
"srw",
".",
"<mask>",
"(",
")",
")",
".",
"Printf",
"(",
"\"",
"\"",
",",
"r",
".",
"Method",
",",
"r",
".",
"URL",
",",
"r",
".",
"Proto",
")",
"\n",
"}",
")",
"\n",
"}"
] |
23,109 | all-23110 | [
"setEvaluationTimestamp",
"updates",
"evaluationTimestamp",
"to",
"the",
"timestamp",
"of",
"when",
"the",
"rule",
"group",
"was",
"last",
"evaluated",
"."
] | [
"func",
"(",
"g",
"*",
"Group",
")",
"setEvaluationTimestamp",
"(",
"<mask>",
"time",
".",
"Time",
")",
"{",
"g",
".",
"metrics",
".",
"groupLastEvalTime",
".",
"WithLabelValues",
"(",
"groupKey",
"(",
"g",
".",
"file",
",",
"g",
".",
"name",
")",
")",
".",
"Set",
"(",
"float64",
"(",
"ts",
".",
"UnixNano",
"(",
")",
")",
"/",
"1e9",
")",
"\n\n",
"g",
".",
"mtx",
".",
"Lock",
"(",
")",
"\n",
"defer",
"g",
".",
"mtx",
".",
"Unlock",
"(",
")",
"\n",
"g",
".",
"evaluationTimestamp",
"=",
"ts",
"\n",
"}"
] |
23,110 | all-23111 | [
"MustV0",
"retrieves",
"the",
"V0",
"value",
"from",
"the",
"union",
"panicing",
"if",
"the",
"value",
"is",
"not",
"set",
"."
] | [
"func",
"(",
"u",
"ScpHistoryEntry",
")",
"MustV0",
"(",
")",
"ScpHistoryEntryV0",
"{",
"val",
",",
"<mask>",
":=",
"u",
".",
"GetV0",
"(",
")",
"\n\n",
"if",
"!",
"ok",
"{",
"panic",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"return",
"val",
"\n",
"}"
] |
23,111 | all-23112 | [
"Deal",
"with",
"the",
"login",
"request",
"."
] | [
"func",
"(",
"c",
"*",
"Client",
")",
"loginHandler",
"(",
"w",
"http",
".",
"ResponseWriter",
",",
"r",
"*",
"http",
".",
"Request",
")",
"{",
"username",
":=",
"r",
".",
"FormValue",
"(",
"\"",
"\"",
")",
"\n",
"password",
":=",
"r",
".",
"FormValue",
"(",
"\"",
"\"",
")",
"\n\n",
"user",
",",
"err",
":=",
"c",
".",
"login",
"(",
"username",
",",
"<mask>",
")",
"\n",
"if",
"err",
"==",
"nil",
"&&",
"user",
"!=",
"nil",
"{",
"c",
".",
"user",
"=",
"user",
"\n",
"c",
".",
"err",
"=",
"nil",
"\n",
"http",
".",
"Redirect",
"(",
"w",
",",
"r",
",",
"\"",
"\"",
",",
"http",
".",
"StatusFound",
")",
"\n",
"return",
"\n",
"}",
"\n",
"c",
".",
"err",
"=",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
")",
"\n",
"http",
".",
"Redirect",
"(",
"w",
",",
"r",
",",
"\"",
"\"",
",",
"http",
".",
"StatusFound",
")",
"\n",
"return",
"\n",
"}"
] |
23,112 | all-23113 | [
"Do",
"executes",
"Debugger",
".",
"setBlackboxPatterns",
"against",
"the",
"provided",
"context",
"."
] | [
"func",
"(",
"p",
"*",
"SetBlackboxPatternsParams",
")",
"Do",
"(",
"ctx",
"context",
".",
"<mask>",
")",
"(",
"err",
"error",
")",
"{",
"return",
"cdp",
".",
"Execute",
"(",
"ctx",
",",
"CommandSetBlackboxPatterns",
",",
"p",
",",
"nil",
")",
"\n",
"}"
] |
23,113 | all-23114 | [
"ColorButtonNewWithRGBA",
"is",
"a",
"wrapper",
"around",
"gtk_color_button_new_with_rgba",
"()",
"."
] | [
"func",
"ColorButtonNewWithRGBA",
"(",
"gdkColor",
"*",
"gdk",
".",
"RGBA",
")",
"(",
"*",
"ColorButton",
",",
"<mask>",
")",
"{",
"c",
":=",
"C",
".",
"gtk_color_button_new_with_rgba",
"(",
"(",
"*",
"C",
".",
"GdkRGBA",
")",
"(",
"unsafe",
".",
"Pointer",
"(",
"gdkColor",
".",
"Native",
"(",
")",
")",
")",
")",
"\n",
"if",
"c",
"==",
"nil",
"{",
"return",
"nil",
",",
"nilPtrErr",
"\n",
"}",
"\n",
"return",
"wrapColorButton",
"(",
"glib",
".",
"Take",
"(",
"unsafe",
".",
"Pointer",
"(",
"c",
")",
")",
")",
",",
"nil",
"\n",
"}"
] |
23,114 | all-23115 | [
"SetDraw",
"is",
"a",
"wrapper",
"around",
"gtk_separator_tool_item_set_draw",
"()",
"."
] | [
"func",
"(",
"v",
"*",
"SeparatorToolItem",
")",
"SetDraw",
"(",
"draw",
"bool",
")",
"{",
"C",
".",
"gtk_separator_tool_item_set_draw",
"(",
"v",
".",
"native",
"(",
")",
",",
"gbool",
"(",
"<mask>",
")",
")",
"\n",
"}"
] |
23,115 | all-23116 | [
"Critical",
"formats",
"message",
"using",
"the",
"default",
"formats",
"for",
"its",
"operands",
"prepends",
"the",
"prefix",
"as",
"necessary",
"and",
"writes",
"to",
"log",
"with",
"LevelCritical",
".",
"This",
"is",
"part",
"of",
"the",
"Logger",
"interface",
"implementation",
"."
] | [
"func",
"(",
"l",
"*",
"slog",
")",
"Critical",
"(",
"args",
"...",
"interface",
"{",
"}",
")",
"{",
"lvl",
":=",
"l",
".",
"Level",
"(",
")",
"\n",
"if",
"lvl",
"<=",
"LevelCritical",
"{",
"l",
".",
"b",
".",
"<mask>",
"(",
"\"",
"\"",
",",
"l",
".",
"tag",
",",
"args",
"...",
")",
"\n",
"}",
"\n",
"}"
] |
23,116 | all-23117 | [
"MustData",
"retrieves",
"the",
"Data",
"value",
"from",
"the",
"union",
"panicing",
"if",
"the",
"value",
"is",
"not",
"set",
"."
] | [
"func",
"(",
"u",
"LedgerKey",
")",
"MustData",
"(",
")",
"LedgerKeyData",
"{",
"val",
",",
"<mask>",
":=",
"u",
".",
"GetData",
"(",
")",
"\n\n",
"if",
"!",
"ok",
"{",
"panic",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"return",
"val",
"\n",
"}"
] |
23,117 | all-23118 | [
"AddGauge",
"adds",
"value",
"to",
"existing",
"gauge"
] | [
"func",
"(",
"m",
"*",
"CirconusMetrics",
")",
"AddGauge",
"(",
"metric",
"string",
",",
"val",
"interface",
"{",
"}",
")",
"{",
"m",
".",
"gm",
".",
"Lock",
"(",
")",
"\n",
"defer",
"m",
".",
"gm",
".",
"Unlock",
"(",
")",
"\n\n",
"v",
",",
"ok",
":=",
"m",
".",
"gauges",
"[",
"metric",
"]",
"\n",
"if",
"!",
"ok",
"{",
"m",
".",
"gauges",
"[",
"metric",
"]",
"=",
"val",
"\n",
"return",
"\n",
"}",
"\n\n",
"switch",
"val",
".",
"(",
"type",
")",
"{",
"default",
":",
"// ignore it, unsupported type",
"case",
"int",
":",
"m",
".",
"gauges",
"[",
"metric",
"]",
"=",
"v",
".",
"(",
"int",
")",
"+",
"val",
".",
"(",
"int",
")",
"\n",
"case",
"int8",
":",
"m",
".",
"gauges",
"[",
"metric",
"]",
"=",
"v",
".",
"(",
"int8",
")",
"+",
"val",
".",
"(",
"int8",
")",
"\n",
"case",
"int16",
":",
"m",
".",
"gauges",
"[",
"metric",
"]",
"=",
"v",
".",
"(",
"int16",
")",
"+",
"val",
".",
"(",
"int16",
")",
"\n",
"case",
"int32",
":",
"m",
".",
"gauges",
"[",
"metric",
"]",
"=",
"v",
".",
"(",
"int32",
")",
"+",
"val",
".",
"(",
"int32",
")",
"\n",
"case",
"int64",
":",
"m",
".",
"gauges",
"[",
"metric",
"]",
"=",
"v",
".",
"(",
"int64",
")",
"+",
"val",
".",
"(",
"int64",
")",
"\n",
"case",
"uint",
":",
"m",
".",
"gauges",
"[",
"metric",
"]",
"=",
"v",
".",
"(",
"uint",
")",
"+",
"val",
".",
"(",
"uint",
")",
"\n",
"case",
"uint8",
":",
"m",
".",
"gauges",
"[",
"metric",
"]",
"=",
"v",
".",
"(",
"uint8",
")",
"+",
"val",
".",
"(",
"uint8",
")",
"\n",
"case",
"uint16",
":",
"m",
".",
"gauges",
"[",
"metric",
"]",
"=",
"v",
".",
"(",
"uint16",
")",
"+",
"val",
".",
"(",
"uint16",
")",
"\n",
"<mask>",
"uint32",
":",
"m",
".",
"gauges",
"[",
"metric",
"]",
"=",
"v",
".",
"(",
"uint32",
")",
"+",
"val",
".",
"(",
"uint32",
")",
"\n",
"case",
"uint64",
":",
"m",
".",
"gauges",
"[",
"metric",
"]",
"=",
"v",
".",
"(",
"uint64",
")",
"+",
"val",
".",
"(",
"uint64",
")",
"\n",
"case",
"float32",
":",
"m",
".",
"gauges",
"[",
"metric",
"]",
"=",
"v",
".",
"(",
"float32",
")",
"+",
"val",
".",
"(",
"float32",
")",
"\n",
"case",
"float64",
":",
"m",
".",
"gauges",
"[",
"metric",
"]",
"=",
"v",
".",
"(",
"float64",
")",
"+",
"val",
".",
"(",
"float64",
")",
"\n",
"}",
"\n",
"}"
] |
23,118 | all-23119 | [
"WithDefaults",
"patches",
"a",
"http",
".",
"Server",
"based",
"on",
"a",
"best",
"practice",
"configuration",
"from",
"Cloudflare",
":",
"https",
":",
"//",
"blog",
".",
"cloudflare",
".",
"com",
"/",
"exposing",
"-",
"go",
"-",
"on",
"-",
"the",
"-",
"internet",
"/",
"You",
"can",
"override",
"the",
"defaults",
"by",
"mutating",
"the",
"Default",
"*",
"variables",
"exposed",
"by",
"this",
"package"
] | [
"func",
"WithDefaults",
"(",
"srv",
"*",
"http",
".",
"Server",
")",
"*",
"http",
".",
"<mask>",
"{",
"if",
"srv",
".",
"TLSConfig",
"==",
"nil",
"{",
"srv",
".",
"TLSConfig",
"=",
"&",
"tls",
".",
"Config",
"{",
"}",
"\n",
"}",
"\n\n",
"srv",
".",
"TLSConfig",
".",
"PreferServerCipherSuites",
"=",
"true",
"\n",
"srv",
".",
"TLSConfig",
".",
"MinVersion",
"=",
"DefaultMinVersion",
"\n",
"srv",
".",
"TLSConfig",
".",
"CurvePreferences",
"=",
"DefaultCurvePreferences",
"\n",
"srv",
".",
"TLSConfig",
".",
"CipherSuites",
"=",
"DefaultCipherSuites",
"\n\n",
"if",
"srv",
".",
"ReadTimeout",
"==",
"0",
"{",
"srv",
".",
"ReadTimeout",
"=",
"DefaultReadTimeout",
"\n",
"}",
"\n\n",
"if",
"srv",
".",
"WriteTimeout",
"==",
"0",
"{",
"srv",
".",
"WriteTimeout",
"=",
"DefaultWriteTimeout",
"\n",
"}",
"\n\n",
"if",
"srv",
".",
"IdleTimeout",
"==",
"0",
"{",
"srv",
".",
"IdleTimeout",
"=",
"DefaultIdleTimeout",
"\n",
"}",
"\n\n",
"return",
"srv",
"\n",
"}"
] |
23,119 | all-23120 | [
"calculateLBA",
"calculates",
"a",
"logical",
"block",
"address",
"from",
"the",
"LBA",
"array",
"and",
"48",
"-",
"bit",
"flags",
"from",
"an",
"ATAArg",
"."
] | [
"func",
"calculateLBA",
"(",
"rlba",
"[",
"6",
"]",
"uint8",
",",
"is48Bit",
"bool",
")",
"int64",
"{",
"// Pad two bytes at the end to parse as uint64",
"b",
":=",
"[",
"]",
"<mask>",
"{",
"rlba",
"[",
"0",
"]",
",",
"rlba",
"[",
"1",
"]",
",",
"rlba",
"[",
"2",
"]",
",",
"rlba",
"[",
"3",
"]",
",",
"rlba",
"[",
"4",
"]",
",",
"rlba",
"[",
"5",
"]",
",",
"0",
",",
"0",
",",
"}",
"\n",
"lba",
":=",
"binary",
".",
"LittleEndian",
".",
"Uint64",
"(",
"b",
")",
"\n\n",
"// Mask off high bits to limit size to either 48 bit or 28 bit,",
"// depending on is48Bit's value.",
"if",
"is48Bit",
"{",
"// 48-bit",
"lba",
"&=",
"0x0000ffffffffffff",
"\n",
"}",
"else",
"{",
"// 28-bit",
"lba",
"&=",
"0x0fffffff",
"\n",
"}",
"\n\n",
"return",
"int64",
"(",
"lba",
")",
"\n",
"}"
] |
23,120 | all-23121 | [
"UnmarshalJSON",
"sets",
"the",
"Base64",
"from",
"JSON"
] | [
"func",
"(",
"b",
"*",
"Base64",
")",
"UnmarshalJSON",
"(",
"<mask>",
"[",
"]",
"byte",
")",
"error",
"{",
"l",
":=",
"jlexer",
".",
"Lexer",
"{",
"Data",
":",
"data",
"}",
"\n",
"b",
".",
"UnmarshalEasyJSON",
"(",
"&",
"l",
")",
"\n",
"return",
"l",
".",
"Error",
"(",
")",
"\n",
"}"
] |
23,121 | all-23122 | [
"title",
":",
"user",
"create",
"path",
":",
"/",
"users",
"method",
":",
"POST",
"consume",
":",
"application",
"/",
"x",
"-",
"www",
"-",
"form",
"-",
"urlencoded",
"responses",
":",
"201",
":",
"User",
"created",
"400",
":",
"Invalid",
"data",
"401",
":",
"Unauthorized",
"403",
":",
"Forbidden",
"409",
":",
"User",
"already",
"exists"
] | [
"func",
"createUser",
"(",
"w",
"http",
".",
"ResponseWriter",
",",
"r",
"*",
"http",
".",
"Request",
")",
"error",
"{",
"registrationEnabled",
",",
"_",
":=",
"config",
".",
"GetBool",
"(",
"\"",
"\"",
")",
"\n",
"if",
"!",
"registrationEnabled",
"{",
"token",
":=",
"r",
".",
"Header",
".",
"Get",
"(",
"\"",
"\"",
")",
"\n",
"t",
",",
"err",
":=",
"app",
".",
"AuthScheme",
".",
"Auth",
"(",
"token",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"createDisabledErr",
"\n",
"}",
"\n",
"if",
"!",
"permission",
".",
"Check",
"(",
"t",
",",
"permission",
".",
"PermUserCreate",
")",
"{",
"return",
"createDisabledErr",
"\n",
"}",
"\n",
"}",
"\n",
"email",
":=",
"InputValue",
"(",
"r",
",",
"\"",
"\"",
")",
"\n",
"password",
":=",
"InputValue",
"(",
"r",
",",
"\"",
"\"",
")",
"\n",
"evt",
",",
"err",
":=",
"event",
".",
"New",
"(",
"&",
"event",
".",
"Opts",
"{",
"Target",
":",
"userTarget",
"(",
"email",
")",
",",
"Kind",
":",
"permission",
".",
"PermUserCreate",
",",
"RawOwner",
":",
"event",
".",
"Owner",
"{",
"Type",
":",
"event",
".",
"OwnerTypeUser",
",",
"Name",
":",
"email",
"}",
",",
"CustomData",
":",
"<mask>",
".",
"FormToCustomData",
"(",
"InputFields",
"(",
"r",
",",
"\"",
"\"",
")",
")",
",",
"Allowed",
":",
"event",
".",
"Allowed",
"(",
"permission",
".",
"PermUserReadEvents",
",",
"permission",
".",
"Context",
"(",
"permTypes",
".",
"CtxUser",
",",
"email",
")",
")",
",",
"}",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"defer",
"func",
"(",
")",
"{",
"evt",
".",
"Done",
"(",
"err",
")",
"}",
"(",
")",
"\n",
"u",
":=",
"auth",
".",
"User",
"{",
"Email",
":",
"email",
",",
"Password",
":",
"password",
",",
"}",
"\n",
"_",
",",
"err",
"=",
"app",
".",
"AuthScheme",
".",
"Create",
"(",
"&",
"u",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"handleAuthError",
"(",
"err",
")",
"\n",
"}",
"\n",
"w",
".",
"WriteHeader",
"(",
"http",
".",
"StatusCreated",
")",
"\n",
"return",
"nil",
"\n",
"}"
] |
23,122 | all-23123 | [
"MarshalJSON",
"returns",
"the",
"Base64",
"as",
"JSON"
] | [
"func",
"(",
"b",
"Base64",
")",
"MarshalJSON",
"(",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"<mask>",
"w",
"jwriter",
".",
"Writer",
"\n",
"b",
".",
"MarshalEasyJSON",
"(",
"&",
"w",
")",
"\n",
"return",
"w",
".",
"BuildBytes",
"(",
")",
"\n",
"}"
] |
23,123 | all-23124 | [
"StdinPipe",
"returns",
"a",
"pipe",
"that",
"will",
"be",
"connected",
"to",
"the",
"command",
"s",
"standard",
"input",
"when",
"the",
"command",
"starts",
".",
"The",
"pipe",
"will",
"be",
"closed",
"automatically",
"after",
"Wait",
"sees",
"the",
"command",
"exit",
".",
"A",
"caller",
"need",
"only",
"call",
"Close",
"to",
"force",
"the",
"pipe",
"to",
"close",
"sooner",
".",
"For",
"example",
"if",
"the",
"command",
"being",
"run",
"will",
"not",
"exit",
"until",
"standard",
"input",
"is",
"closed",
"the",
"caller",
"must",
"close",
"the",
"pipe",
"."
] | [
"func",
"(",
"c",
"*",
"Cmd",
")",
"StdinPipe",
"(",
")",
"(",
"io",
".",
"WriteCloser",
",",
"error",
")",
"{",
"if",
"c",
".",
"Stdin",
"!=",
"nil",
"{",
"return",
"nil",
",",
"errors",
".",
"New",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"if",
"c",
".",
"Process",
"!=",
"nil",
"{",
"return",
"nil",
",",
"errors",
".",
"New",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"pr",
",",
"pw",
",",
"err",
":=",
"<mask>",
".",
"Pipe",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"c",
".",
"Stdin",
"=",
"pr",
"\n",
"c",
".",
"closeAfterStart",
"=",
"append",
"(",
"c",
".",
"closeAfterStart",
",",
"pr",
")",
"\n",
"wc",
":=",
"&",
"closeOnce",
"{",
"File",
":",
"pw",
"}",
"\n",
"c",
".",
"closeAfterWait",
"=",
"append",
"(",
"c",
".",
"closeAfterWait",
",",
"closerFunc",
"(",
"wc",
".",
"safeClose",
")",
")",
"\n",
"return",
"wc",
",",
"nil",
"\n",
"}"
] |
23,124 | all-23125 | [
"UnmarshalJSON",
"supports",
"json",
".",
"Unmarshaler",
"interface"
] | [
"func",
"(",
"v",
"*",
"ComputedProperty",
")",
"UnmarshalJSON",
"(",
"data",
"[",
"]",
"<mask>",
")",
"error",
"{",
"r",
":=",
"jlexer",
".",
"Lexer",
"{",
"Data",
":",
"data",
"}",
"\n",
"easyjsonC5a4559bDecodeGithubComChromedpCdprotoCss60",
"(",
"&",
"r",
",",
"v",
")",
"\n",
"return",
"r",
".",
"Error",
"(",
")",
"\n",
"}"
] |
23,125 | all-23126 | [
"UnmarshalJSON",
"supports",
"json",
".",
"Unmarshaler",
"interface"
] | [
"func",
"(",
"v",
"*",
"UnregisterParams",
")",
"UnmarshalJSON",
"(",
"<mask>",
"[",
"]",
"byte",
")",
"error",
"{",
"r",
":=",
"jlexer",
".",
"Lexer",
"{",
"Data",
":",
"data",
"}",
"\n",
"easyjsonC5a4559bDecodeGithubComChromedpCdprotoServiceworker2",
"(",
"&",
"r",
",",
"v",
")",
"\n",
"return",
"r",
".",
"Error",
"(",
")",
"\n",
"}"
] |
23,126 | all-23127 | [
"SetParams",
"sets",
"value",
"of",
"param",
"with",
"given",
"name",
"."
] | [
"func",
"(",
"ctx",
"*",
"Context",
")",
"SetParams",
"(",
"<mask>",
",",
"val",
"string",
")",
"{",
"if",
"name",
"!=",
"\"",
"\"",
"&&",
"!",
"strings",
".",
"HasPrefix",
"(",
"name",
",",
"\"",
"\"",
")",
"{",
"name",
"=",
"\"",
"\"",
"+",
"name",
"\n",
"}",
"\n",
"ctx",
".",
"params",
"[",
"name",
"]",
"=",
"val",
"\n",
"}"
] |
23,127 | all-23128 | [
"ListTasks",
"mocks",
"base",
"method"
] | [
"func",
"(",
"m",
"*",
"MockTaskEngine",
")",
"ListTasks",
"(",
")",
"(",
"[",
"]",
"*",
"<mask>",
".",
"Task",
",",
"error",
")",
"{",
"ret",
":=",
"m",
".",
"ctrl",
".",
"Call",
"(",
"m",
",",
"\"",
"\"",
")",
"\n",
"ret0",
",",
"_",
":=",
"ret",
"[",
"0",
"]",
".",
"(",
"[",
"]",
"*",
"task",
".",
"Task",
")",
"\n",
"ret1",
",",
"_",
":=",
"ret",
"[",
"1",
"]",
".",
"(",
"error",
")",
"\n",
"return",
"ret0",
",",
"ret1",
"\n",
"}"
] |
23,128 | all-23129 | [
"MutateChangeTrust",
"for",
"Limit",
"sets",
"the",
"ChangeTrustOp",
"s",
"Limit",
"field"
] | [
"func",
"(",
"m",
"Limit",
")",
"MutateChangeTrust",
"(",
"o",
"*",
"xdr",
".",
"ChangeTrustOp",
")",
"(",
"err",
"error",
")",
"{",
"o",
".",
"Limit",
",",
"err",
"=",
"<mask>",
".",
"Parse",
"(",
"string",
"(",
"m",
")",
")",
"\n",
"return",
"\n",
"}"
] |
23,129 | all-23130 | [
"BToken",
"generates",
"an",
"array",
"of",
"random",
"bytes",
"with",
"length",
"as",
"specified",
"by",
"size",
"parameter",
"."
] | [
"func",
"(",
"self",
"*",
"Salter",
")",
"BToken",
"(",
"size",
"int",
")",
"[",
"]",
"byte",
"{",
"mac",
":=",
"hmac",
".",
"New",
"(",
"sha256",
".",
"New",
",",
"self",
".",
"salt",
")",
"\n\n",
"for",
"_",
",",
"v",
":=",
"<mask>",
"self",
".",
"rndSources",
"{",
"itemSize",
":=",
"float32",
"(",
"size",
")",
"*",
"(",
"float32",
"(",
"v",
".",
"Weight",
")",
"/",
"float32",
"(",
"self",
".",
"sumWeight",
")",
")",
"\n",
"mac",
".",
"Write",
"(",
"getRandomBytes",
"(",
"v",
".",
"Reader",
",",
"int",
"(",
"itemSize",
")",
")",
")",
"\n",
"}",
"\n",
"macSum",
":=",
"mac",
".",
"Sum",
"(",
"nil",
")",
"\n\n",
"self",
".",
"salt",
"=",
"macSum",
"\n",
"return",
"macSum",
"\n",
"}"
] |
23,130 | all-23131 | [
"NewHandler",
"creates",
"a",
"ControllerHandler",
"from",
"the",
"factory",
"and",
"methodName"
] | [
"func",
"NewHandler",
"(",
"factory",
"ControllerFactoryFunc",
",",
"methodName",
"string",
")",
"ControllerHandler",
"{",
"handler",
":=",
"ControllerHandler",
"{",
"factory",
":",
"factory",
",",
"methodName",
":",
"methodName",
"}",
"\n",
"if",
"!",
"handler",
".",
"isValid",
"(",
")",
"{",
"panic",
"(",
"\"",
"\"",
"+",
"methodName",
")",
"\n",
"}",
"\n",
"return",
"<mask>",
"\n",
"}"
] |
23,131 | all-23132 | [
"GetWebsite",
"is",
"a",
"wrapper",
"around",
"gtk_about_dialog_get_website",
"()",
"."
] | [
"func",
"(",
"v",
"*",
"AboutDialog",
")",
"GetWebsite",
"(",
")",
"string",
"{",
"c",
":=",
"C",
".",
"gtk_about_dialog_get_website",
"(",
"v",
".",
"native",
"(",
")",
")",
"\n",
"return",
"C",
".",
"GoString",
"(",
"(",
"*",
"C",
".",
"<mask>",
")",
"(",
"c",
")",
")",
"\n",
"}"
] |
23,132 | all-23133 | [
"Flush",
"any",
"changes",
"made",
"to",
"hosts",
"file",
"."
] | [
"func",
"(",
"h",
"Hosts",
")",
"Flush",
"(",
")",
"error",
"{",
"file",
",",
"err",
":=",
"<mask>",
".",
"Create",
"(",
"h",
".",
"Path",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"w",
":=",
"bufio",
".",
"NewWriter",
"(",
"file",
")",
"\n\n",
"for",
"_",
",",
"line",
":=",
"range",
"h",
".",
"Lines",
"{",
"fmt",
".",
"Fprintf",
"(",
"w",
",",
"\"",
"\"",
",",
"line",
".",
"Raw",
",",
"eol",
")",
"\n",
"}",
"\n\n",
"err",
"=",
"w",
".",
"Flush",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"return",
"h",
".",
"Load",
"(",
")",
"\n",
"}"
] |
23,133 | all-23134 | [
"Run",
"executes",
"the",
"trace",
"behavior"
] | [
"func",
"(",
"b",
"*",
"Behavior",
")",
"Run",
"(",
"t",
"crossdock",
".",
"T",
")",
"{",
"logParams",
"(",
"t",
")",
"\n",
"sampled",
",",
"err",
":=",
"strconv",
".",
"ParseBool",
"(",
"t",
".",
"Param",
"(",
"sampledParam",
")",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"t",
".",
"Fatalf",
"(",
"\"",
"\"",
",",
"sampledParam",
",",
"err",
")",
"\n",
"}",
"\n",
"baggage",
":=",
"randomBaggage",
"(",
")",
"\n\n",
"level1",
":=",
"&",
"<mask>",
"{",
"ServerRole",
":",
"RoleS1",
",",
"}",
"\n",
"server1",
":=",
"t",
".",
"Param",
"(",
"server1NameParam",
")",
"\n\n",
"level2",
":=",
"&",
"Downstream",
"{",
"ServiceName",
":",
"t",
".",
"Param",
"(",
"server2NameParam",
")",
",",
"ServerRole",
":",
"RoleS2",
",",
"HostPort",
":",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"b",
".",
"serviceToHost",
"(",
"t",
".",
"Param",
"(",
"server2NameParam",
")",
")",
",",
"b",
".",
"ServerPort",
",",
")",
",",
"Encoding",
":",
"t",
".",
"Param",
"(",
"server2EncodingParam",
")",
",",
"}",
"\n",
"level1",
".",
"Downstream",
"=",
"level2",
"\n\n",
"level3",
":=",
"&",
"Downstream",
"{",
"ServiceName",
":",
"t",
".",
"Param",
"(",
"server3NameParam",
")",
",",
"ServerRole",
":",
"RoleS3",
",",
"HostPort",
":",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"b",
".",
"serviceToHost",
"(",
"t",
".",
"Param",
"(",
"server3NameParam",
")",
")",
",",
"b",
".",
"ServerPort",
",",
")",
",",
"Encoding",
":",
"t",
".",
"Param",
"(",
"server3EncodingParam",
")",
",",
"}",
"\n",
"level2",
".",
"Downstream",
"=",
"level3",
"\n\n",
"resp",
",",
"err",
":=",
"b",
".",
"startTrace",
"(",
"t",
",",
"level1",
",",
"sampled",
",",
"baggage",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"t",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"server1",
",",
"err",
".",
"Error",
"(",
")",
")",
"\n",
"return",
"\n",
"}",
"\n\n",
"log",
".",
"Printf",
"(",
"\"",
"\"",
",",
"resp",
".",
"Span",
",",
"resp",
".",
"Downstream",
")",
"\n",
"traceID",
":=",
"resp",
".",
"Span",
".",
"TraceID",
"\n\n",
"require",
":=",
"crossdock",
".",
"Require",
"(",
"t",
")",
"\n",
"require",
".",
"NotEmpty",
"(",
"traceID",
",",
"\"",
"\"",
",",
"server1",
")",
"\n\n",
"if",
"validateTrace",
"(",
"t",
",",
"level1",
".",
"Downstream",
",",
"resp",
",",
"server1",
",",
"1",
",",
"traceID",
",",
"sampled",
",",
"baggage",
")",
"{",
"t",
".",
"Successf",
"(",
"\"",
"\"",
")",
"\n",
"log",
".",
"Println",
"(",
"\"",
"\"",
")",
"\n",
"}",
"else",
"{",
"log",
".",
"Println",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"}"
] |
23,134 | all-23135 | [
"Do",
"executes",
"DeviceOrientation",
".",
"setDeviceOrientationOverride",
"against",
"the",
"provided",
"context",
"."
] | [
"func",
"(",
"p",
"*",
"SetDeviceOrientationOverrideParams",
")",
"Do",
"(",
"ctx",
"<mask>",
".",
"Context",
")",
"(",
"err",
"error",
")",
"{",
"return",
"cdp",
".",
"Execute",
"(",
"ctx",
",",
"CommandSetDeviceOrientationOverride",
",",
"p",
",",
"nil",
")",
"\n",
"}"
] |
23,135 | all-23136 | [
"UpdateProfile",
"updates",
"the",
"profile",
"to",
"match",
"the",
"provided",
"Profile",
"struct"
] | [
"func",
"(",
"r",
"*",
"ProtocolLXD",
")",
"UpdateProfile",
"(",
"<mask>",
"string",
",",
"profile",
"api",
".",
"ProfilePut",
",",
"ETag",
"string",
")",
"error",
"{",
"// Send the request",
"_",
",",
"_",
",",
"err",
":=",
"r",
".",
"query",
"(",
"\"",
"\"",
",",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"url",
".",
"QueryEscape",
"(",
"name",
")",
")",
",",
"profile",
",",
"ETag",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"return",
"nil",
"\n",
"}"
] |
23,136 | all-23137 | [
"GetPayouts",
"retrieves",
"the",
"Payouts",
"value",
"from",
"the",
"union",
"returning",
"ok",
"if",
"the",
"union",
"s",
"switch",
"indicated",
"the",
"value",
"is",
"valid",
"."
] | [
"func",
"(",
"u",
"InflationResult",
")",
"GetPayouts",
"(",
")",
"(",
"result",
"[",
"]",
"InflationPayout",
",",
"ok",
"bool",
")",
"{",
"armName",
",",
"_",
":=",
"u",
".",
"ArmForSwitch",
"(",
"int32",
"(",
"u",
".",
"Code",
")",
")",
"\n\n",
"if",
"armName",
"==",
"\"",
"\"",
"{",
"result",
"=",
"*",
"u",
".",
"Payouts",
"\n",
"<mask>",
"=",
"true",
"\n",
"}",
"\n\n",
"return",
"\n",
"}"
] |
23,137 | all-23138 | [
"Run",
"executes",
"the",
"rule",
"into",
"a",
"content",
"to",
"find",
"all",
"lines",
"that",
"matches",
"it",
"."
] | [
"func",
"(",
"r",
"*",
"Rule",
")",
"Run",
"(",
"content",
"[",
"]",
"byte",
")",
"[",
"]",
"RunResult",
"{",
"var",
"results",
"[",
"]",
"RunResult",
"\n\n",
"b",
":=",
"bufio",
".",
"NewScanner",
"(",
"bytes",
".",
"NewReader",
"(",
"content",
")",
")",
"\n\n",
"nLine",
":=",
"0",
"\n",
"for",
"b",
".",
"Scan",
"(",
")",
"{",
"nLine",
"=",
"nLine",
"+",
"1",
"\n",
"line",
":=",
"b",
".",
"<mask>",
"(",
")",
"\n\n",
"if",
"r",
".",
"Match",
".",
"MatchString",
"(",
"line",
")",
"{",
"unmatch",
":=",
"false",
"\n",
"for",
"_",
",",
"Unmatch",
":=",
"range",
"r",
".",
"Unmatch",
"{",
"if",
"Unmatch",
".",
"MatchString",
"(",
"line",
")",
"{",
"unmatch",
"=",
"true",
"\n",
"}",
"\n",
"}",
"\n\n",
"if",
"!",
"unmatch",
"{",
"results",
"=",
"append",
"(",
"results",
",",
"RunResult",
"{",
"Line",
":",
"line",
",",
"Nline",
":",
"nLine",
",",
"}",
")",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n\n",
"return",
"results",
"\n",
"}"
] |
23,138 | all-23139 | [
"Do",
"executes",
"Target",
".",
"setAutoAttach",
"against",
"the",
"provided",
"context",
"."
] | [
"func",
"(",
"p",
"*",
"SetAutoAttachParams",
")",
"Do",
"(",
"ctx",
"context",
".",
"<mask>",
")",
"(",
"err",
"error",
")",
"{",
"return",
"cdp",
".",
"Execute",
"(",
"ctx",
",",
"CommandSetAutoAttach",
",",
"p",
",",
"nil",
")",
"\n",
"}"
] |
23,139 | all-23140 | [
"WithProviders",
"allows",
"specifying",
"your",
"own",
"set",
"of",
"providers",
"."
] | [
"func",
"WithProviders",
"(",
"m",
"map",
"[",
"string",
"]",
"<mask>",
")",
"Option",
"{",
"return",
"func",
"(",
"d",
"*",
"Discover",
")",
"error",
"{",
"d",
".",
"Providers",
"=",
"m",
"\n",
"return",
"nil",
"\n",
"}",
"\n",
"}"
] |
23,140 | all-23141 | [
"same",
"with",
"Error",
"()"
] | [
"func",
"(",
"f",
"*",
"FileLogger",
")",
"E",
"(",
"format",
"string",
",",
"v",
"...",
"<mask>",
"{",
"}",
")",
"{",
"f",
".",
"Error",
"(",
"format",
",",
"v",
"...",
")",
"\n",
"}"
] |
23,141 | all-23142 | [
"setExtends",
"will",
"set",
"the",
"ExtendsService",
"for",
"all",
"services",
".",
"It",
"is",
"done",
"after",
"all",
"files",
"are",
"parsed",
"as",
"services",
"may",
"extend",
"those",
"found",
"in",
"an",
"included",
"file",
"."
] | [
"func",
"setExtends",
"(",
"state",
"map",
"[",
"string",
"]",
"parseState",
")",
"error",
"{",
"for",
"_",
",",
"v",
":=",
"range",
"state",
"{",
"for",
"_",
",",
"s",
":=",
"range",
"v",
".",
"services",
"{",
"if",
"s",
".",
"Extends",
"==",
"\"",
"\"",
"{",
"continue",
"\n",
"}",
"\n\n",
"var",
"searchServices",
"[",
"]",
"*",
"<mask>",
"\n",
"var",
"searchFor",
"string",
"\n",
"parts",
":=",
"strings",
".",
"SplitN",
"(",
"s",
".",
"Extends",
",",
"\"",
"\"",
",",
"2",
")",
"\n",
"// If it's not imported, then look at the current file's services.",
"if",
"len",
"(",
"parts",
")",
"<",
"2",
"{",
"searchServices",
"=",
"v",
".",
"services",
"\n",
"searchFor",
"=",
"s",
".",
"Extends",
"\n",
"}",
"else",
"{",
"include",
":=",
"v",
".",
"global",
".",
"includes",
"[",
"parts",
"[",
"0",
"]",
"]",
"\n",
"s",
".",
"ExtendsPrefix",
"=",
"include",
".",
"pkg",
"+",
"\"",
"\"",
"\n",
"searchServices",
"=",
"state",
"[",
"include",
".",
"file",
"]",
".",
"services",
"\n",
"searchFor",
"=",
"parts",
"[",
"1",
"]",
"\n",
"}",
"\n\n",
"foundService",
":=",
"sort",
".",
"Search",
"(",
"len",
"(",
"searchServices",
")",
",",
"func",
"(",
"i",
"int",
")",
"bool",
"{",
"return",
"searchServices",
"[",
"i",
"]",
".",
"Name",
">=",
"searchFor",
"\n",
"}",
")",
"\n",
"if",
"foundService",
"==",
"len",
"(",
"searchServices",
")",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"s",
".",
"Extends",
",",
"s",
".",
"Name",
")",
"\n",
"}",
"\n",
"s",
".",
"ExtendsService",
"=",
"searchServices",
"[",
"foundService",
"]",
"\n",
"}",
"\n",
"}",
"\n\n",
"return",
"nil",
"\n",
"}"
] |
23,142 | all-23143 | [
"UnmarshalJSON",
"supports",
"json",
".",
"Unmarshaler",
"interface"
] | [
"func",
"(",
"v",
"*",
"StopTrackingHeapObjectsParams",
")",
"UnmarshalJSON",
"(",
"data",
"[",
"]",
"byte",
")",
"error",
"{",
"r",
":=",
"jlexer",
".",
"Lexer",
"{",
"Data",
":",
"data",
"}",
"\n",
"easyjsonC5a4559bDecodeGithubComChromedpCdprotoHeapprofiler1",
"(",
"&",
"r",
",",
"v",
")",
"\n",
"return",
"r",
".",
"<mask>",
"(",
")",
"\n",
"}"
] |
23,143 | all-23144 | [
"Update",
"the",
"min",
"and",
"max",
"fields",
"if",
"value",
"is",
"less",
"than",
"or",
"greater",
"than",
"the",
"current",
"min",
"/",
"max",
"value",
"."
] | [
"func",
"(",
"histogram",
"*",
"histogramData",
")",
"Update",
"(",
"value",
"int64",
")",
"{",
"if",
"value",
">",
"histogram",
".",
"max",
"{",
"histogram",
".",
"max",
"=",
"value",
"\n",
"}",
"\n",
"if",
"value",
"<",
"histogram",
".",
"min",
"{",
"histogram",
".",
"min",
"=",
"value",
"\n",
"}",
"\n\n",
"histogram",
".",
"sum",
"+=",
"value",
"\n",
"histogram",
".",
"totalCount",
"++",
"\n\n",
"for",
"<mask>",
":=",
"0",
";",
"index",
"<=",
"len",
"(",
"histogram",
".",
"bins",
")",
";",
"index",
"++",
"{",
"// Allocate value in the last buckets if we reached the end of the Bounds array.",
"if",
"index",
"==",
"len",
"(",
"histogram",
".",
"bins",
")",
"{",
"histogram",
".",
"countPerBin",
"[",
"index",
"]",
"++",
"\n",
"break",
"\n",
"}",
"\n\n",
"// Check if the value should be added to the \"index\" bin",
"if",
"value",
"<",
"int64",
"(",
"histogram",
".",
"bins",
"[",
"index",
"]",
")",
"{",
"histogram",
".",
"countPerBin",
"[",
"index",
"]",
"++",
"\n",
"break",
"\n",
"}",
"\n",
"}",
"\n",
"}"
] |
23,144 | all-23145 | [
"MiddlewareFunc",
"makes",
"PoweredByMiddleware",
"implement",
"the",
"Middleware",
"interface",
"."
] | [
"func",
"(",
"mw",
"*",
"PoweredByMiddleware",
")",
"MiddlewareFunc",
"(",
"h",
"HandlerFunc",
")",
"HandlerFunc",
"{",
"poweredBy",
":=",
"xPoweredByDefault",
"\n",
"if",
"mw",
".",
"XPoweredBy",
"!=",
"\"",
"\"",
"{",
"poweredBy",
"=",
"mw",
".",
"XPoweredBy",
"\n",
"}",
"\n\n",
"return",
"func",
"(",
"w",
"ResponseWriter",
",",
"r",
"*",
"<mask>",
")",
"{",
"w",
".",
"Header",
"(",
")",
".",
"Add",
"(",
"\"",
"\"",
",",
"poweredBy",
")",
"\n\n",
"// call the handler",
"h",
"(",
"w",
",",
"r",
")",
"\n\n",
"}",
"\n",
"}"
] |
23,145 | all-23146 | [
"WithQuery",
"requested",
"substring",
"in",
"name",
".",
"Only",
"histograms",
"which",
"have",
"query",
"as",
"a",
"substring",
"in",
"their",
"name",
"are",
"extracted",
".",
"An",
"empty",
"or",
"absent",
"query",
"returns",
"all",
"histograms",
"."
] | [
"func",
"(",
"p",
"GetHistogramsParams",
")",
"WithQuery",
"(",
"<mask>",
"string",
")",
"*",
"GetHistogramsParams",
"{",
"p",
".",
"Query",
"=",
"query",
"\n",
"return",
"&",
"p",
"\n",
"}"
] |
23,146 | all-23147 | [
"Warnf",
"outputs",
"formatted",
"Warn",
"level",
"log"
] | [
"func",
"(",
"g",
"*",
"Glg",
")",
"Warnf",
"(",
"format",
"string",
",",
"val",
"...",
"interface",
"{",
"}",
")",
"error",
"{",
"return",
"g",
".",
"out",
"(",
"WARN",
",",
"<mask>",
",",
"val",
"...",
")",
"\n",
"}"
] |
23,147 | all-23148 | [
"ReadUint32",
"returns",
"the",
"next",
"value",
"in",
"the",
"buffer",
"as",
"a",
"uint32"
] | [
"func",
"(",
"r",
"*",
"ReadBuffer",
")",
"ReadUint32",
"(",
")",
"uint32",
"{",
"if",
"b",
":=",
"r",
".",
"ReadBytes",
"(",
"4",
")",
";",
"b",
"!=",
"nil",
"{",
"return",
"<mask>",
".",
"BigEndian",
".",
"Uint32",
"(",
"b",
")",
"\n",
"}",
"\n\n",
"return",
"0",
"\n",
"}"
] |
23,148 | all-23149 | [
"GetYAlign",
"is",
"a",
"wrapper",
"around",
"gtk_label_get_yalign",
"()",
"."
] | [
"func",
"(",
"v",
"*",
"<mask>",
")",
"GetYAlign",
"(",
")",
"float64",
"{",
"c",
":=",
"C",
".",
"gtk_label_get_yalign",
"(",
"v",
".",
"native",
"(",
")",
")",
"\n",
"return",
"float64",
"(",
"c",
")",
"\n",
"}"
] |
23,149 | all-23150 | [
"GetShare",
"gets",
"a",
"share"
] | [
"func",
"(",
"c",
"*",
"Client",
")",
"GetShare",
"(",
"groupid",
"string",
",",
"resourceid",
"string",
")",
"(",
"*",
"Share",
",",
"error",
")",
"{",
"url",
":=",
"umGroupSharePath",
"(",
"groupid",
",",
"resourceid",
")",
"+",
"`?depth=`",
"+",
"c",
".",
"client",
".",
"depth",
"+",
"`&pretty=`",
"+",
"strconv",
".",
"FormatBool",
"(",
"c",
".",
"<mask>",
".",
"pretty",
")",
"\n",
"ret",
":=",
"&",
"Share",
"{",
"}",
"\n",
"err",
":=",
"c",
".",
"client",
".",
"Get",
"(",
"url",
",",
"ret",
",",
"http",
".",
"StatusOK",
")",
"\n",
"return",
"ret",
",",
"err",
"\n",
"}"
] |
23,150 | all-23151 | [
"==",
"Locking",
"LockUser",
"locks",
"the",
"passwd",
"of",
"the",
"given",
"user",
"."
] | [
"func",
"LockUser",
"(",
"name",
"string",
")",
"error",
"{",
"shadow",
",",
"err",
":=",
"LookupShadow",
"(",
"name",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"if",
"shadow",
".",
"<mask>",
"[",
"0",
"]",
"!=",
"_LOCK_CHAR",
"{",
"shadow",
".",
"password",
"=",
"string",
"(",
"_LOCK_CHAR",
")",
"+",
"shadow",
".",
"password",
"\n",
"return",
"edit",
"(",
"name",
",",
"shadow",
")",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
] |
23,151 | all-23152 | [
"DoneMany",
"works",
"like",
"Done",
"but",
"accepts",
"multiple",
"indices",
"."
] | [
"func",
"(",
"w",
"*",
"WaterMark",
")",
"DoneMany",
"(",
"indices",
"[",
"]",
"uint64",
")",
"{",
"w",
".",
"markCh",
"<-",
"<mask>",
"{",
"index",
":",
"0",
",",
"indices",
":",
"indices",
",",
"done",
":",
"true",
"}",
"\n",
"}"
] |
23,152 | all-23153 | [
"controls",
"feedback",
"mode"
] | [
"func",
"FeedbackBuffer",
"(",
"size",
"int32",
",",
"xtype",
"uint32",
",",
"<mask>",
"*",
"float32",
")",
"{",
"syscall",
".",
"Syscall",
"(",
"gpFeedbackBuffer",
",",
"3",
",",
"uintptr",
"(",
"size",
")",
",",
"uintptr",
"(",
"xtype",
")",
",",
"uintptr",
"(",
"unsafe",
".",
"Pointer",
"(",
"buffer",
")",
")",
")",
"\n",
"}"
] |
23,153 | all-23154 | [
"NewSetHeadersHandler",
"sets",
"provied",
"headers",
"on",
"HTTP",
"response",
"."
] | [
"func",
"NewSetHeadersHandler",
"(",
"h",
"http",
".",
"Handler",
",",
"headers",
"map",
"[",
"string",
"]",
"string",
")",
"http",
".",
"Handler",
"{",
"return",
"http",
".",
"HandlerFunc",
"(",
"func",
"(",
"w",
"http",
".",
"ResponseWriter",
",",
"r",
"*",
"http",
".",
"Request",
")",
"{",
"for",
"header",
",",
"value",
":=",
"<mask>",
"headers",
"{",
"w",
".",
"Header",
"(",
")",
".",
"Set",
"(",
"header",
",",
"value",
")",
"\n",
"}",
"\n",
"h",
".",
"ServeHTTP",
"(",
"w",
",",
"r",
")",
"\n",
"}",
")",
"\n",
"}"
] |
23,154 | all-23155 | [
"RestoreSecretWithContext",
"mocks",
"base",
"method"
] | [
"func",
"(",
"m",
"*",
"MockSecretsManagerAPI",
")",
"RestoreSecretWithContext",
"(",
"arg0",
"aws",
".",
"Context",
",",
"arg1",
"*",
"secretsmanager",
".",
"RestoreSecretInput",
",",
"arg2",
"...",
"request",
".",
"Option",
")",
"(",
"*",
"secretsmanager",
".",
"RestoreSecretOutput",
",",
"error",
")",
"{",
"varargs",
":=",
"[",
"]",
"<mask>",
"{",
"}",
"{",
"arg0",
",",
"arg1",
"}",
"\n",
"for",
"_",
",",
"a",
":=",
"range",
"arg2",
"{",
"varargs",
"=",
"append",
"(",
"varargs",
",",
"a",
")",
"\n",
"}",
"\n",
"ret",
":=",
"m",
".",
"ctrl",
".",
"Call",
"(",
"m",
",",
"\"",
"\"",
",",
"varargs",
"...",
")",
"\n",
"ret0",
",",
"_",
":=",
"ret",
"[",
"0",
"]",
".",
"(",
"*",
"secretsmanager",
".",
"RestoreSecretOutput",
")",
"\n",
"ret1",
",",
"_",
":=",
"ret",
"[",
"1",
"]",
".",
"(",
"error",
")",
"\n",
"return",
"ret0",
",",
"ret1",
"\n",
"}"
] |
23,155 | all-23156 | [
"SetMaxRetryDelay",
"sets",
"the",
"maximum",
"duration",
"that",
"automatically",
"reconnecting",
"methods",
"on",
"c",
"(",
"e",
".",
"g",
".",
"Firehose",
"Stream",
"TailingLogs",
")",
"will",
"sleep",
"for",
"after",
"receiving",
"many",
"successive",
"errors",
"from",
"the",
"traffic",
"controller",
".",
"Defaults",
"to",
"DefaultMaxRetryDelay",
"."
] | [
"func",
"(",
"c",
"*",
"<mask>",
")",
"SetMaxRetryDelay",
"(",
"d",
"time",
".",
"Duration",
")",
"{",
"atomic",
".",
"StoreInt64",
"(",
"&",
"c",
".",
"maxRetryDelay",
",",
"int64",
"(",
"d",
")",
")",
"\n",
"}"
] |
23,156 | all-23157 | [
"UnmarshalJSON",
"supports",
"json",
".",
"Unmarshaler",
"interface"
] | [
"func",
"(",
"v",
"*",
"SetAttributesAsTextParams",
")",
"UnmarshalJSON",
"(",
"data",
"[",
"]",
"byte",
")",
"error",
"{",
"r",
":=",
"jlexer",
".",
"Lexer",
"{",
"Data",
":",
"data",
"}",
"\n",
"easyjsonC5a4559bDecodeGithubComChromedpCdprotoDom8",
"(",
"&",
"r",
",",
"v",
")",
"\n",
"return",
"r",
".",
"<mask>",
"(",
")",
"\n",
"}"
] |
23,157 | all-23158 | [
"putNewKV",
"attempts",
"to",
"create",
"the",
"given",
"key",
"only",
"succeeding",
"if",
"the",
"key",
"did",
"not",
"yet",
"exist",
"."
] | [
"func",
"putNewKV",
"(",
"kv",
"v3",
".",
"KV",
",",
"<mask>",
",",
"val",
"string",
",",
"leaseID",
"v3",
".",
"LeaseID",
")",
"(",
"int64",
",",
"error",
")",
"{",
"cmp",
":=",
"v3",
".",
"Compare",
"(",
"v3",
".",
"Version",
"(",
"key",
")",
",",
"\"",
"\"",
",",
"0",
")",
"\n",
"req",
":=",
"v3",
".",
"OpPut",
"(",
"key",
",",
"val",
",",
"v3",
".",
"WithLease",
"(",
"leaseID",
")",
")",
"\n",
"txnresp",
",",
"err",
":=",
"kv",
".",
"Txn",
"(",
"context",
".",
"TODO",
"(",
")",
")",
".",
"If",
"(",
"cmp",
")",
".",
"Then",
"(",
"req",
")",
".",
"Commit",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"0",
",",
"err",
"\n",
"}",
"\n",
"if",
"!",
"txnresp",
".",
"Succeeded",
"{",
"return",
"0",
",",
"ErrKeyExists",
"\n",
"}",
"\n",
"return",
"txnresp",
".",
"Header",
".",
"Revision",
",",
"nil",
"\n",
"}"
] |
23,158 | all-23159 | [
"GetDeviceEnabled",
"is",
"a",
"wrapper",
"around",
"gtk_widget_get_device_enabled",
"()",
"."
] | [
"func",
"(",
"v",
"*",
"Widget",
")",
"GetDeviceEnabled",
"(",
"device",
"*",
"gdk",
".",
"<mask>",
")",
"bool",
"{",
"c",
":=",
"C",
".",
"gtk_widget_get_device_enabled",
"(",
"v",
".",
"native",
"(",
")",
",",
"(",
"*",
"C",
".",
"GdkDevice",
")",
"(",
"unsafe",
".",
"Pointer",
"(",
"device",
".",
"Native",
"(",
")",
")",
")",
")",
"\n",
"return",
"gobool",
"(",
"c",
")",
"\n",
"}"
] |
23,159 | all-23160 | [
"UnmarshalEasyJSON",
"satisfies",
"easyjson",
".",
"Unmarshaler",
"."
] | [
"func",
"(",
"t",
"*",
"AuthChallengeSource",
")",
"UnmarshalEasyJSON",
"(",
"in",
"*",
"jlexer",
".",
"Lexer",
")",
"{",
"<mask>",
"AuthChallengeSource",
"(",
"in",
".",
"String",
"(",
")",
")",
"{",
"case",
"AuthChallengeSourceServer",
":",
"*",
"t",
"=",
"AuthChallengeSourceServer",
"\n",
"case",
"AuthChallengeSourceProxy",
":",
"*",
"t",
"=",
"AuthChallengeSourceProxy",
"\n\n",
"default",
":",
"in",
".",
"AddError",
"(",
"errors",
".",
"New",
"(",
"\"",
"\"",
")",
")",
"\n",
"}",
"\n",
"}"
] |
23,160 | all-23161 | [
"sum64",
"sums",
"the",
"md5",
"hash",
"to",
"an",
"uint64",
"."
] | [
"func",
"sum64",
"(",
"hash",
"[",
"md5",
".",
"Size",
"]",
"<mask>",
")",
"uint64",
"{",
"var",
"s",
"uint64",
"\n\n",
"for",
"i",
",",
"b",
":=",
"range",
"hash",
"{",
"shift",
":=",
"uint64",
"(",
"(",
"md5",
".",
"Size",
"-",
"i",
"-",
"1",
")",
"*",
"8",
")",
"\n\n",
"s",
"|=",
"uint64",
"(",
"b",
")",
"<<",
"shift",
"\n",
"}",
"\n",
"return",
"s",
"\n",
"}"
] |
23,161 | all-23162 | [
"KeysOnly",
"returns",
"a",
"derivative",
"query",
"that",
"yields",
"only",
"keys",
"not",
"keys",
"and",
"entities",
".",
"It",
"cannot",
"be",
"used",
"with",
"projection",
"queries",
"."
] | [
"func",
"(",
"q",
"*",
"Query",
")",
"KeysOnly",
"(",
")",
"*",
"<mask>",
"{",
"q",
"=",
"q",
".",
"clone",
"(",
")",
"\n",
"q",
".",
"keysOnly",
"=",
"true",
"\n",
"return",
"q",
"\n",
"}"
] |
23,162 | all-23163 | [
"Prepare",
"prepares",
"for",
"a",
"git",
"pull",
"and",
"validates",
"the",
"configured",
"directory"
] | [
"func",
"(",
"r",
"*",
"Repo",
")",
"Prepare",
"(",
")",
"error",
"{",
"// check if directory exists or is empty",
"// if not, create directory",
"fs",
",",
"err",
":=",
"gos",
".",
"ReadDir",
"(",
"r",
".",
"Path",
")",
"\n",
"if",
"err",
"!=",
"nil",
"||",
"len",
"(",
"fs",
")",
"==",
"0",
"{",
"return",
"gos",
".",
"MkdirAll",
"(",
"r",
".",
"Path",
",",
"os",
".",
"FileMode",
"(",
"0755",
")",
")",
"\n",
"}",
"\n\n",
"// validate git repo",
"isGit",
":=",
"<mask>",
"\n",
"for",
"_",
",",
"f",
":=",
"range",
"fs",
"{",
"if",
"f",
".",
"IsDir",
"(",
")",
"&&",
"f",
".",
"Name",
"(",
")",
"==",
"\"",
"\"",
"{",
"isGit",
"=",
"true",
"\n",
"break",
"\n",
"}",
"\n",
"}",
"\n\n",
"if",
"isGit",
"{",
"// check if same repository",
"var",
"repoURL",
"string",
"\n",
"if",
"repoURL",
",",
"err",
"=",
"r",
".",
"originURL",
"(",
")",
";",
"err",
"==",
"nil",
"{",
"if",
"strings",
".",
"TrimSuffix",
"(",
"repoURL",
",",
"\"",
"\"",
")",
"==",
"strings",
".",
"TrimSuffix",
"(",
"r",
".",
"URL",
".",
"Val",
"(",
")",
",",
"\"",
"\"",
")",
"{",
"r",
".",
"pulled",
"=",
"true",
"\n",
"return",
"nil",
"\n",
"}",
"\n",
"}",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"r",
".",
"Path",
",",
"err",
")",
"\n",
"}",
"\n",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"repoURL",
",",
"r",
".",
"Path",
")",
"\n",
"}",
"\n",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"r",
".",
"Path",
")",
"\n",
"}"
] |
23,163 | all-23164 | [
"UnmarshalJSON",
"supports",
"json",
".",
"Unmarshaler",
"interface"
] | [
"func",
"(",
"v",
"*",
"Effect",
")",
"UnmarshalJSON",
"(",
"<mask>",
"[",
"]",
"byte",
")",
"error",
"{",
"r",
":=",
"jlexer",
".",
"Lexer",
"{",
"Data",
":",
"data",
"}",
"\n",
"easyjsonC5a4559bDecodeGithubComChromedpCdprotoAnimation17",
"(",
"&",
"r",
",",
"v",
")",
"\n",
"return",
"r",
".",
"Error",
"(",
")",
"\n",
"}"
] |
23,164 | all-23165 | [
"ParseReference",
"converts",
"a",
"string",
"which",
"should",
"not",
"start",
"with",
"the",
"ImageTransport",
".",
"Name",
"prefix",
"into",
"an",
"OCI",
"ImageReference",
"."
] | [
"func",
"ParseReference",
"(",
"reference",
"string",
")",
"(",
"types",
".",
"ImageReference",
",",
"error",
")",
"{",
"dir",
",",
"image",
":=",
"<mask>",
".",
"SplitPathAndImage",
"(",
"reference",
")",
"\n",
"return",
"NewReference",
"(",
"dir",
",",
"image",
")",
"\n",
"}"
] |
23,165 | all-23166 | [
"SetX",
"behaves",
"the",
"same",
"as",
"Set",
"except",
"it",
"will",
"not",
"overwrite",
"existing",
"keys",
"if",
"already",
"present",
"."
] | [
"func",
"(",
"s",
"*",
"Scratch",
")",
"SetX",
"(",
"k",
"string",
",",
"v",
"interface",
"{",
"}",
")",
"string",
"{",
"s",
".",
"init",
"(",
")",
"\n\n",
"s",
".",
"Lock",
"(",
")",
"\n",
"defer",
"s",
".",
"Unlock",
"(",
")",
"\n",
"if",
"_",
",",
"ok",
":=",
"s",
".",
"values",
"[",
"k",
"]",
";",
"!",
"ok",
"{",
"s",
".",
"<mask>",
"[",
"k",
"]",
"=",
"v",
"\n",
"}",
"\n",
"return",
"\"",
"\"",
"\n",
"}"
] |
23,166 | all-23167 | [
"Locator",
"returns",
"a",
"locator",
"for",
"the",
"given",
"resource"
] | [
"func",
"(",
"r",
"*",
"EndUser",
")",
"Locator",
"(",
"api",
"*",
"API",
")",
"*",
"EndUserLocator",
"{",
"<mask>",
"api",
".",
"EndUserLocator",
"(",
"r",
".",
"Href",
")",
"\n",
"}"
] |
23,167 | all-23168 | [
"String",
"returns",
"version",
"as",
"a",
"string"
] | [
"func",
"(",
"v",
"*",
"DottedVersion",
")",
"String",
"(",
")",
"string",
"{",
"version",
":=",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"v",
".",
"Major",
",",
"v",
".",
"Minor",
")",
"\n",
"if",
"v",
".",
"Patch",
"!=",
"-",
"1",
"{",
"version",
"+=",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"v",
".",
"Patch",
")",
"\n",
"}",
"\n",
"return",
"<mask>",
"\n",
"}"
] |
23,168 | all-23169 | [
"NewConsumer",
"initializes",
"a",
"new",
"consumer"
] | [
"func",
"NewConsumer",
"(",
"addrs",
"[",
"]",
"string",
",",
"groupID",
"string",
",",
"topics",
"[",
"]",
"string",
",",
"config",
"*",
"Config",
")",
"(",
"*",
"Consumer",
",",
"error",
")",
"{",
"<mask>",
",",
"err",
":=",
"NewClient",
"(",
"addrs",
",",
"config",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"consumer",
",",
"err",
":=",
"NewConsumerFromClient",
"(",
"client",
",",
"groupID",
",",
"topics",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"consumer",
".",
"ownClient",
"=",
"true",
"\n",
"return",
"consumer",
",",
"nil",
"\n",
"}"
] |
23,169 | all-23170 | [
"ValidateCustomizationSpec",
"checks",
"the",
"validity",
"of",
"the",
"supplied",
"customization",
"spec",
".",
"It",
"should",
"be",
"called",
"during",
"diff",
"customization",
"to",
"veto",
"invalid",
"configs",
"."
] | [
"func",
"ValidateCustomizationSpec",
"(",
"d",
"*",
"schema",
".",
"ResourceDiff",
",",
"family",
"string",
")",
"error",
"{",
"// Validate that the proper section exists for OS family suboptions.",
"linuxExists",
":=",
"len",
"(",
"d",
".",
"Get",
"(",
"cKeyPrefix",
"+",
"\"",
"\"",
"+",
"\"",
"\"",
")",
".",
"(",
"[",
"]",
"<mask>",
"{",
"}",
")",
")",
">",
"0",
"\n",
"windowsExists",
":=",
"len",
"(",
"d",
".",
"Get",
"(",
"cKeyPrefix",
"+",
"\"",
"\"",
"+",
"\"",
"\"",
")",
".",
"(",
"[",
"]",
"interface",
"{",
"}",
")",
")",
">",
"0",
"\n",
"sysprepExists",
":=",
"d",
".",
"Get",
"(",
"cKeyPrefix",
"+",
"\"",
"\"",
"+",
"\"",
"\"",
")",
".",
"(",
"string",
")",
"!=",
"\"",
"\"",
"\n",
"switch",
"{",
"case",
"family",
"==",
"string",
"(",
"types",
".",
"VirtualMachineGuestOsFamilyLinuxGuest",
")",
"&&",
"!",
"linuxExists",
":",
"return",
"errors",
".",
"New",
"(",
"\"",
"\"",
")",
"\n",
"case",
"family",
"==",
"string",
"(",
"types",
".",
"VirtualMachineGuestOsFamilyWindowsGuest",
")",
"&&",
"!",
"windowsExists",
"&&",
"!",
"sysprepExists",
":",
"return",
"errors",
".",
"New",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
] |
23,170 | all-23171 | [
"Start",
"is",
"used",
"to",
"start",
"the",
"de",
"-",
"duplication",
"manager"
] | [
"func",
"(",
"d",
"*",
"DedupManager",
")",
"Start",
"(",
")",
"error",
"{",
"log",
".",
"Printf",
"(",
"\"",
"\"",
")",
"\n\n",
"<mask>",
":=",
"d",
".",
"clients",
".",
"Consul",
"(",
")",
"\n",
"go",
"d",
".",
"createSession",
"(",
"client",
")",
"\n\n",
"// Start to watch each template",
"for",
"_",
",",
"t",
":=",
"range",
"d",
".",
"templates",
"{",
"go",
"d",
".",
"watchTemplate",
"(",
"client",
",",
"t",
")",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
] |
23,171 | all-23172 | [
"revokeExpiredLeases",
"finds",
"all",
"leases",
"past",
"their",
"expiry",
"and",
"sends",
"them",
"to",
"epxired",
"channel",
"for",
"to",
"be",
"revoked",
"."
] | [
"func",
"(",
"le",
"*",
"lessor",
")",
"revokeExpiredLeases",
"(",
")",
"{",
"var",
"<mask>",
"[",
"]",
"*",
"Lease",
"\n\n",
"// rate limit",
"revokeLimit",
":=",
"leaseRevokeRate",
"/",
"2",
"\n\n",
"le",
".",
"mu",
".",
"RLock",
"(",
")",
"\n",
"if",
"le",
".",
"isPrimary",
"(",
")",
"{",
"ls",
"=",
"le",
".",
"findExpiredLeases",
"(",
"revokeLimit",
")",
"\n",
"}",
"\n",
"le",
".",
"mu",
".",
"RUnlock",
"(",
")",
"\n\n",
"if",
"len",
"(",
"ls",
")",
"!=",
"0",
"{",
"select",
"{",
"case",
"<-",
"le",
".",
"stopC",
":",
"return",
"\n",
"case",
"le",
".",
"expiredC",
"<-",
"ls",
":",
"default",
":",
"// the receiver of expiredC is probably busy handling",
"// other stuff",
"// let's try this next time after 500ms",
"}",
"\n",
"}",
"\n",
"}"
] |
23,172 | all-23173 | [
"Reconfigure",
"reconfigures",
"any",
"BaseComputeResource",
"that",
"uses",
"a",
"BaseComputeResourceConfigSpec",
"as",
"configuration",
"(",
"example",
":",
"standalone",
"hosts",
"or",
"clusters",
")",
".",
"Modify",
"is",
"always",
"set",
"."
] | [
"func",
"Reconfigure",
"(",
"obj",
"BaseComputeResource",
",",
"spec",
"types",
".",
"BaseComputeResourceConfigSpec",
")",
"error",
"{",
"var",
"c",
"*",
"object",
".",
"ComputeResource",
"\n",
"switch",
"t",
":=",
"obj",
".",
"(",
"type",
")",
"{",
"case",
"*",
"object",
".",
"ComputeResource",
":",
"log",
".",
"Printf",
"(",
"\"",
"\"",
",",
"t",
".",
"Name",
"(",
")",
")",
"\n",
"c",
"=",
"t",
"\n",
"case",
"*",
"object",
".",
"ClusterComputeResource",
":",
"log",
".",
"Printf",
"(",
"\"",
"\"",
",",
"t",
".",
"Name",
"(",
")",
")",
"\n",
"c",
"=",
"&",
"t",
".",
"ComputeResource",
"\n",
"default",
":",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"t",
")",
"\n",
"}",
"\n\n",
"ctx",
",",
"cancel",
":=",
"context",
".",
"WithTimeout",
"(",
"context",
".",
"Background",
"(",
")",
",",
"provider",
".",
"DefaultAPITimeout",
")",
"\n",
"defer",
"cancel",
"(",
")",
"\n",
"<mask>",
",",
"err",
":=",
"c",
".",
"Reconfigure",
"(",
"ctx",
",",
"spec",
",",
"true",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"return",
"task",
".",
"Wait",
"(",
"ctx",
")",
"\n",
"}"
] |
23,173 | all-23174 | [
"Return",
"a",
"copy",
"of",
"our",
"complete",
"state",
"."
] | [
"func",
"(",
"p",
"*",
"peer",
")",
"Gossip",
"(",
")",
"(",
"complete",
"mesh",
".",
"GossipData",
")",
"{",
"complete",
"=",
"p",
".",
"st",
".",
"copy",
"(",
")",
"\n",
"p",
".",
"logger",
".",
"Printf",
"(",
"\"",
"\"",
",",
"<mask>",
".",
"(",
"*",
"state",
")",
".",
"set",
")",
"\n",
"return",
"complete",
"\n",
"}"
] |
23,174 | all-23175 | [
"HasShortName",
"returns",
"a",
"boolean",
"if",
"a",
"field",
"has",
"been",
"set",
"."
] | [
"func",
"(",
"m",
"*",
"MetricMetadata",
")",
"HasShortName",
"(",
")",
"bool",
"{",
"if",
"m",
"!=",
"nil",
"&&",
"m",
".",
"ShortName",
"!=",
"nil",
"{",
"return",
"true",
"\n",
"}",
"\n\n",
"return",
"<mask>",
"\n",
"}"
] |
23,175 | all-23176 | [
"parseTriageData",
"unmarshals",
"raw",
"json",
"data",
"into",
"a",
"triageData",
"struct",
"and",
"creates",
"a",
"BuildIndexer",
"for",
"every",
"job",
"."
] | [
"func",
"parseTriageData",
"(",
"jsonIn",
"[",
"]",
"byte",
")",
"(",
"*",
"triageData",
",",
"error",
")",
"{",
"var",
"<mask>",
"triageData",
"\n",
"if",
"err",
":=",
"json",
".",
"Unmarshal",
"(",
"jsonIn",
",",
"&",
"data",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"if",
"data",
".",
"Builds",
".",
"Cols",
".",
"Started",
"==",
"nil",
"{",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"if",
"data",
".",
"Builds",
".",
"JobsRaw",
"==",
"nil",
"{",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"if",
"data",
".",
"Builds",
".",
"JobPaths",
"==",
"nil",
"{",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"if",
"data",
".",
"Clustered",
"==",
"nil",
"{",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"// Populate 'Jobs' with the BuildIndexer for each job.",
"data",
".",
"Builds",
".",
"Jobs",
"=",
"make",
"(",
"map",
"[",
"string",
"]",
"BuildIndexer",
")",
"\n",
"for",
"jobID",
",",
"mapper",
":=",
"range",
"data",
".",
"Builds",
".",
"JobsRaw",
"{",
"switch",
"mapper",
":=",
"mapper",
".",
"(",
"type",
")",
"{",
"case",
"[",
"]",
"interface",
"{",
"}",
":",
"// In this case mapper is a 3 member array. 0:first buildnum, 1:number of builds, 2:start index.",
"data",
".",
"Builds",
".",
"Jobs",
"[",
"jobID",
"]",
"=",
"ContigIndexer",
"{",
"startBuild",
":",
"int",
"(",
"mapper",
"[",
"0",
"]",
".",
"(",
"float64",
")",
")",
",",
"count",
":",
"int",
"(",
"mapper",
"[",
"1",
"]",
".",
"(",
"float64",
")",
")",
",",
"startRow",
":",
"int",
"(",
"mapper",
"[",
"2",
"]",
".",
"(",
"float64",
")",
")",
",",
"}",
"\n",
"case",
"map",
"[",
"string",
"]",
"interface",
"{",
"}",
":",
"// In this case mapper is a dictionary.",
"data",
".",
"Builds",
".",
"Jobs",
"[",
"jobID",
"]",
"=",
"DictIndexer",
"(",
"mapper",
")",
"\n",
"default",
":",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"jobID",
",",
"reflect",
".",
"TypeOf",
"(",
"mapper",
")",
")",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"&",
"data",
",",
"nil",
"\n",
"}"
] |
23,176 | all-23177 | [
"Start",
"the",
"server",
"."
] | [
"func",
"(",
"s",
"*",
"Server",
")",
"Start",
"(",
")",
"(",
"err",
"error",
")",
"{",
"<mask>",
".",
"Infof",
"(",
"\"",
"\"",
",",
"s",
".",
"Config",
".",
"Port",
")",
"\n",
"var",
"l",
"net",
".",
"Listener",
"\n",
"go",
"func",
"(",
")",
"{",
"l",
",",
"err",
"=",
"net",
".",
"Listen",
"(",
"\"",
"\"",
",",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"s",
".",
"Config",
".",
"Port",
")",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"log",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"s",
".",
"Error",
"<-",
"err",
"\n",
"return",
"\n",
"}",
"\n",
"s",
".",
"isStarted",
"=",
"true",
"\n",
"if",
"len",
"(",
"s",
".",
"Config",
".",
"SSL",
".",
"Certificate",
")",
">",
"0",
"&&",
"len",
"(",
"s",
".",
"Config",
".",
"SSL",
".",
"Key",
")",
">",
"0",
"{",
"err",
"=",
"s",
".",
"ServeTLS",
"(",
"l",
",",
"s",
".",
"Config",
".",
"SSL",
".",
"Certificate",
",",
"s",
".",
"Config",
".",
"SSL",
".",
"Key",
")",
"\n",
"if",
"err",
"!=",
"nil",
"&&",
"err",
"!=",
"http",
".",
"ErrServerClosed",
"{",
"log",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"l",
".",
"Close",
"(",
")",
"\n",
"s",
".",
"Error",
"<-",
"err",
"\n",
"s",
".",
"quit",
"<-",
"true",
"\n",
"}",
"\n",
"close",
"(",
"s",
".",
"quit",
")",
"\n",
"}",
"else",
"{",
"err",
"=",
"s",
".",
"Serve",
"(",
"l",
")",
"\n",
"if",
"err",
"!=",
"nil",
"&&",
"err",
"!=",
"http",
".",
"ErrServerClosed",
"{",
"log",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"s",
".",
"Error",
"<-",
"err",
"\n",
"s",
".",
"quit",
"<-",
"true",
"\n",
"}",
"\n",
"close",
"(",
"s",
".",
"quit",
")",
"\n",
"}",
"\n",
"}",
"(",
")",
"\n\n",
"<-",
"s",
".",
"quit",
"\n\n",
"if",
"err",
"=",
"s",
".",
"Shutdown",
"(",
"context",
".",
"Background",
"(",
")",
")",
";",
"err",
"!=",
"nil",
"{",
"log",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"s",
".",
"Error",
"<-",
"err",
"\n",
"}",
"\n\n",
"<-",
"s",
".",
"quit",
"\n\n",
"l",
"=",
"nil",
"\n",
"log",
".",
"Info",
"(",
"\"",
"\"",
")",
"\n",
"s",
".",
"isStarted",
"=",
"false",
"\n",
"s",
".",
"Done",
"<-",
"true",
"\n",
"return",
"\n",
"}"
] |
23,177 | all-23178 | [
"Remove",
"is",
"a",
"wrapper",
"around",
"g_menu_remove",
"()",
"."
] | [
"func",
"(",
"v",
"*",
"<mask>",
")",
"Remove",
"(",
"position",
"int",
")",
"{",
"C",
".",
"g_menu_remove",
"(",
"v",
".",
"native",
"(",
")",
",",
"C",
".",
"gint",
"(",
"position",
")",
")",
"\n",
"}"
] |
23,178 | all-23179 | [
"MSetForUid",
"sets",
"multiple",
"values",
"of",
"the",
"environment",
"variables",
"named",
"by",
"the",
"keys",
"that",
"affects",
"a",
"particular",
"user",
".",
"It",
"returns",
"an",
"error",
"if",
"any",
"."
] | [
"func",
"MSetForUid",
"(",
"id",
"int",
",",
"keys",
",",
"values",
"[",
"]",
"string",
")",
"error",
"{",
"_settings",
",",
"err",
":=",
"getSettingsForUid",
"(",
"id",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"if",
"err",
"=",
"_MSet",
"(",
"_settings",
".",
"<mask>",
",",
"keys",
",",
"values",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"if",
"_settings",
".",
"useKDE",
"{",
"return",
"_MSet",
"(",
"_settings",
".",
"kde",
",",
"keys",
",",
"values",
")",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
] |
23,179 | all-23180 | [
"NormalizeMax",
"sets",
"the",
"max",
"value",
"to",
"1",
"and",
"normalize",
"the",
"rest",
"of",
"the",
"data",
"."
] | [
"func",
"NormalizeMax",
"(",
"buf",
"*",
"<mask>",
".",
"FloatBuffer",
")",
"{",
"if",
"buf",
"==",
"nil",
"{",
"return",
"\n",
"}",
"\n",
"max",
":=",
"0.0",
"\n\n",
"for",
"i",
":=",
"0",
";",
"i",
"<",
"len",
"(",
"buf",
".",
"Data",
")",
";",
"i",
"++",
"{",
"if",
"math",
".",
"Abs",
"(",
"buf",
".",
"Data",
"[",
"i",
"]",
")",
">",
"max",
"{",
"max",
"=",
"math",
".",
"Abs",
"(",
"buf",
".",
"Data",
"[",
"i",
"]",
")",
"\n",
"}",
"\n",
"}",
"\n\n",
"if",
"max",
"!=",
"0.0",
"{",
"for",
"i",
":=",
"0",
";",
"i",
"<",
"len",
"(",
"buf",
".",
"Data",
")",
";",
"i",
"++",
"{",
"buf",
".",
"Data",
"[",
"i",
"]",
"/=",
"max",
"\n",
"}",
"\n",
"}",
"\n",
"}"
] |
23,180 | all-23181 | [
"define",
"an",
"array",
"of",
"color",
"indexes"
] | [
"func",
"IndexPointer",
"(",
"xtype",
"uint32",
",",
"stride",
"int32",
",",
"<mask>",
"unsafe",
".",
"Pointer",
")",
"{",
"syscall",
".",
"Syscall",
"(",
"gpIndexPointer",
",",
"3",
",",
"uintptr",
"(",
"xtype",
")",
",",
"uintptr",
"(",
"stride",
")",
",",
"uintptr",
"(",
"pointer",
")",
")",
"\n",
"}"
] |
23,181 | all-23182 | [
"Connect",
"connects",
"to",
"the",
"given",
"WebSocket",
"server",
".",
"addr",
"should",
"be",
"formatted",
"as",
"ws",
":",
"//",
"host",
":",
"port",
"-",
"or",
"-",
"wss",
":",
"//",
"host",
":",
"port",
"(",
"i",
".",
"e",
".",
"ws",
":",
"//",
"127",
".",
"0",
".",
"0",
".",
"1",
":",
"3000",
"-",
"or",
"-",
"wss",
":",
"//",
"localhost",
":",
"3000",
")"
] | [
"func",
"(",
"c",
"*",
"Conn",
")",
"Connect",
"(",
"addr",
"string",
")",
"error",
"{",
"ws",
",",
"err",
":=",
"websocket",
".",
"Dial",
"(",
"addr",
",",
"\"",
"\"",
",",
"\"",
"\"",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"if",
"err",
":=",
"c",
".",
"setConn",
"(",
"ws",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"c",
".",
"isClientConn",
"=",
"true",
"\n",
"c",
".",
"wg",
".",
"Add",
"(",
"1",
")",
"\n",
"go",
"func",
"(",
")",
"{",
"defer",
"recoverAndLog",
"(",
"c",
",",
"&",
"c",
".",
"wg",
")",
"\n",
"c",
".",
"startReceive",
"(",
")",
"\n",
"}",
"(",
")",
"\n",
"<mask>",
".",
"Sleep",
"(",
"time",
".",
"Millisecond",
")",
"// give receive goroutine a few cycles to start",
"\n",
"return",
"nil",
"\n",
"}"
] |
23,182 | all-23183 | [
"GetPageIterator",
"returns",
"a",
"KeyPageIterator",
"with",
"the",
"given",
"page",
"filters",
".",
"Call",
"iterator",
".",
"Next",
"()",
"to",
"get",
"the",
"first",
"page",
"of",
"resources",
"(",
"and",
"again",
"to",
"retrieve",
"subsequent",
"pages",
")",
"."
] | [
"func",
"(",
"c",
"*",
"KeyService",
")",
"GetPageIterator",
"(",
"data",
"<mask>",
".",
"Values",
")",
"*",
"KeyPageIterator",
"{",
"iter",
":=",
"NewPageIterator",
"(",
"c",
".",
"client",
",",
"data",
",",
"keyPathPart",
")",
"\n",
"return",
"&",
"KeyPageIterator",
"{",
"p",
":",
"iter",
",",
"}",
"\n",
"}"
] |
23,183 | all-23184 | [
"NewReaderByteCodeLoader",
"creates",
"a",
"new",
"object"
] | [
"func",
"NewReaderByteCodeLoader",
"(",
"p",
"parser",
".",
"<mask>",
",",
"c",
"compiler",
".",
"Compiler",
")",
"*",
"ReaderByteCodeLoader",
"{",
"return",
"&",
"ReaderByteCodeLoader",
"{",
"NewFlags",
"(",
")",
",",
"p",
",",
"c",
"}",
"\n",
"}"
] |
23,184 | all-23185 | [
"Release",
"returns",
"the",
"message",
"to",
"the",
"pool",
"for",
"re",
"-",
"use",
"."
] | [
"func",
"(",
"m",
"*",
"Message",
")",
"Release",
"(",
")",
"{",
"if",
"m",
"!=",
"nil",
"{",
"m",
".",
"Text",
"=",
"nil",
"\n",
"m",
".",
"<mask>",
"=",
"m",
".",
"List",
"[",
":",
"0",
"]",
"\n",
"messagePool",
".",
"Put",
"(",
"m",
")",
"\n",
"}",
"\n",
"}"
] |
23,185 | all-23186 | [
"MustAllowTrustResult",
"retrieves",
"the",
"AllowTrustResult",
"value",
"from",
"the",
"union",
"panicing",
"if",
"the",
"value",
"is",
"not",
"set",
"."
] | [
"func",
"(",
"u",
"OperationResultTr",
")",
"MustAllowTrustResult",
"(",
")",
"AllowTrustResult",
"{",
"val",
",",
"ok",
":=",
"u",
".",
"GetAllowTrustResult",
"(",
")",
"\n\n",
"if",
"!",
"<mask>",
"{",
"panic",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"return",
"val",
"\n",
"}"
] |
23,186 | all-23187 | [
"Touch",
"performs",
"the",
"provided",
"Touch",
"event",
"at",
"the",
"location",
"of",
"each",
"element",
"in",
"the",
"selection",
"."
] | [
"func",
"(",
"s",
"*",
"Selection",
")",
"Touch",
"(",
"event",
"Touch",
")",
"error",
"{",
"var",
"touchFunc",
"func",
"(",
"x",
",",
"y",
"int",
")",
"error",
"\n",
"<mask>",
"event",
"{",
"case",
"HoldFinger",
":",
"touchFunc",
"=",
"s",
".",
"session",
".",
"TouchDown",
"\n",
"case",
"ReleaseFinger",
":",
"touchFunc",
"=",
"s",
".",
"session",
".",
"TouchUp",
"\n",
"case",
"MoveFinger",
":",
"touchFunc",
"=",
"s",
".",
"session",
".",
"TouchMove",
"\n",
"default",
":",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"event",
",",
"s",
")",
"\n",
"}",
"\n\n",
"return",
"s",
".",
"forEachElement",
"(",
"func",
"(",
"selectedElement",
"element",
".",
"Element",
")",
"error",
"{",
"x",
",",
"y",
",",
"err",
":=",
"selectedElement",
".",
"GetLocation",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"s",
",",
"err",
")",
"\n",
"}",
"\n",
"if",
"err",
":=",
"touchFunc",
"(",
"x",
",",
"y",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"s",
",",
"err",
")",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}",
")",
"\n",
"}"
] |
23,187 | all-23188 | [
"GetResourceByName",
"convenience",
"method",
"to",
"find",
"and",
"return",
"a",
"resource",
"by",
"name"
] | [
"func",
"(",
"s",
"*",
"ConcoursePipeline",
")",
"GetResourceByName",
"(",
"name",
"string",
")",
"*",
"atc",
".",
"ResourceConfig",
"{",
"for",
"i",
",",
"v",
":=",
"<mask>",
"s",
".",
"Resources",
"{",
"if",
"v",
".",
"Name",
"==",
"name",
"{",
"return",
"&",
"s",
".",
"Resources",
"[",
"i",
"]",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
] |
23,188 | all-23189 | [
"NewPatternFromRGB",
"is",
"a",
"wrapper",
"around",
"cairo_pattern_create_rgb",
"()",
"."
] | [
"func",
"NewPatternFromRGB",
"(",
"red",
",",
"green",
",",
"<mask>",
"float64",
")",
"(",
"*",
"Pattern",
",",
"error",
")",
"{",
"c",
":=",
"C",
".",
"cairo_pattern_create_rgb",
"(",
"C",
".",
"double",
"(",
"red",
")",
",",
"C",
".",
"double",
"(",
"green",
")",
",",
"C",
".",
"double",
"(",
"blue",
")",
")",
"\n",
"return",
"newPatternFromNative",
"(",
"c",
")",
"\n",
"}"
] |
23,189 | all-23190 | [
"repl",
"replaces",
"%",
"directives",
"with",
"right",
"time"
] | [
"func",
"repl",
"(",
"match",
"string",
",",
"t",
"time",
".",
"Time",
")",
"string",
"{",
"if",
"match",
"==",
"\"",
"\"",
"{",
"return",
"\"",
"\"",
"\n",
"}",
"\n\n",
"formatFunc",
",",
"<mask>",
":=",
"formats",
"[",
"match",
"]",
"\n",
"if",
"ok",
"{",
"return",
"formatFunc",
"(",
"t",
")",
"\n",
"}",
"\n",
"return",
"formatNanoForMatch",
"(",
"match",
",",
"t",
")",
"\n",
"}"
] |
23,190 | all-23191 | [
"PrintDetailedFileInfo",
"pretty",
"-",
"prints",
"detailed",
"file",
"info",
"."
] | [
"func",
"PrintDetailedFileInfo",
"(",
"fileInfo",
"*",
"pfs",
".",
"FileInfo",
")",
"error",
"{",
"template",
",",
"err",
":=",
"template",
".",
"New",
"(",
"\"",
"\"",
")",
".",
"Funcs",
"(",
"funcMap",
")",
".",
"Parse",
"(",
"`Path: {{.File.Path}}\nType: {{fileType .FileType}}\nSize: {{prettySize .SizeBytes}}\nChildren: {{range .Children}} {{.}} {{end}}\n`",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"return",
"template",
".",
"Execute",
"(",
"<mask>",
".",
"Stdout",
",",
"fileInfo",
")",
"\n",
"}"
] |
23,191 | all-23192 | [
"DeleteWorksheet",
"deletes",
"passed",
"worksheet",
"."
] | [
"func",
"(",
"a",
"*",
"API",
")",
"DeleteWorksheet",
"(",
"cfg",
"*",
"Worksheet",
")",
"(",
"bool",
",",
"error",
")",
"{",
"if",
"cfg",
"==",
"nil",
"{",
"return",
"<mask>",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"return",
"a",
".",
"DeleteWorksheetByCID",
"(",
"CIDType",
"(",
"&",
"cfg",
".",
"CID",
")",
")",
"\n",
"}"
] |
23,192 | all-23193 | [
"Draw",
"draws",
"a",
"given",
"text",
"on",
"a",
"given",
"destination",
"image",
"dst",
".",
"face",
"is",
"the",
"font",
"for",
"text",
"rendering",
".",
"(",
"x",
"y",
")",
"represents",
"a",
"dot",
"(",
"period",
")",
"position",
".",
"Be",
"careful",
"that",
"this",
"doesn",
"t",
"represent",
"left",
"-",
"upper",
"corner",
"position",
".",
"clr",
"is",
"the",
"color",
"for",
"text",
"rendering",
".",
"Glyphs",
"used",
"for",
"rendering",
"are",
"cached",
"in",
"least",
"-",
"recently",
"-",
"used",
"way",
".",
"It",
"is",
"OK",
"to",
"call",
"Draw",
"with",
"a",
"same",
"text",
"and",
"a",
"same",
"face",
"at",
"every",
"frame",
"in",
"terms",
"of",
"performance",
".",
"Be",
"careful",
"that",
"the",
"passed",
"font",
"face",
"is",
"held",
"by",
"this",
"package",
"and",
"is",
"never",
"released",
".",
"This",
"is",
"a",
"known",
"issue",
"(",
"#498",
")",
".",
"Draw",
"is",
"concurrent",
"-",
"safe",
"."
] | [
"func",
"Draw",
"(",
"dst",
"*",
"ebiten",
".",
"Image",
",",
"text",
"string",
",",
"face",
"<mask>",
".",
"Face",
",",
"x",
",",
"y",
"int",
",",
"clr",
"color",
".",
"Color",
")",
"{",
"textM",
".",
"Lock",
"(",
")",
"\n\n",
"fx",
":=",
"fixed",
".",
"I",
"(",
"x",
")",
"\n",
"prevR",
":=",
"rune",
"(",
"-",
"1",
")",
"\n\n",
"runes",
":=",
"[",
"]",
"rune",
"(",
"text",
")",
"\n",
"glyphImgs",
":=",
"getGlyphImages",
"(",
"face",
",",
"runes",
")",
"\n",
"colorm",
":=",
"colorToColorM",
"(",
"clr",
")",
"\n\n",
"for",
"i",
",",
"r",
":=",
"range",
"runes",
"{",
"if",
"prevR",
">=",
"0",
"{",
"fx",
"+=",
"face",
".",
"Kern",
"(",
"prevR",
",",
"r",
")",
"\n",
"}",
"\n",
"drawGlyph",
"(",
"dst",
",",
"face",
",",
"r",
",",
"glyphImgs",
"[",
"i",
"]",
",",
"fx",
",",
"fixed",
".",
"I",
"(",
"y",
")",
",",
"colorm",
")",
"\n",
"fx",
"+=",
"glyphAdvance",
"(",
"face",
",",
"r",
")",
"\n\n",
"prevR",
"=",
"r",
"\n",
"}",
"\n\n",
"textM",
".",
"Unlock",
"(",
")",
"\n",
"}"
] |
23,193 | all-23194 | [
"CheckButtonNew",
"is",
"a",
"wrapper",
"around",
"gtk_check_button_new",
"()",
"."
] | [
"func",
"CheckButtonNew",
"(",
")",
"(",
"*",
"CheckButton",
",",
"<mask>",
")",
"{",
"c",
":=",
"C",
".",
"gtk_check_button_new",
"(",
")",
"\n",
"if",
"c",
"==",
"nil",
"{",
"return",
"nil",
",",
"nilPtrErr",
"\n",
"}",
"\n",
"obj",
":=",
"glib",
".",
"Take",
"(",
"unsafe",
".",
"Pointer",
"(",
"c",
")",
")",
"\n",
"return",
"wrapCheckButton",
"(",
"obj",
")",
",",
"nil",
"\n",
"}"
] |
23,194 | all-23195 | [
"GetInt64",
"returns",
"the",
"value",
"of",
"the",
"given",
"key",
"which",
"must",
"be",
"of",
"type",
"Int64",
"."
] | [
"func",
"(",
"m",
"*",
"Map",
")",
"GetInt64",
"(",
"name",
"string",
")",
"int64",
"{",
"m",
".",
"schema",
".",
"assertKeyType",
"(",
"name",
",",
"Int64",
")",
"\n",
"n",
",",
"err",
":=",
"strconv",
".",
"ParseInt",
"(",
"m",
".",
"GetRaw",
"(",
"<mask>",
")",
",",
"10",
",",
"64",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"panic",
"(",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"err",
")",
")",
"\n",
"}",
"\n",
"return",
"n",
"\n",
"}"
] |
23,195 | all-23196 | [
"EstimatedSize",
"returns",
"the",
"approximate",
"size",
"of",
"the",
"key",
"-",
"value",
"pair",
".",
"This",
"can",
"be",
"called",
"while",
"iterating",
"through",
"a",
"store",
"to",
"quickly",
"estimate",
"the",
"size",
"of",
"a",
"range",
"of",
"key",
"-",
"value",
"pairs",
"(",
"without",
"fetching",
"the",
"corresponding",
"values",
")",
"."
] | [
"func",
"(",
"item",
"*",
"Item",
")",
"EstimatedSize",
"(",
")",
"int64",
"{",
"if",
"!",
"item",
".",
"hasValue",
"(",
")",
"{",
"return",
"0",
"\n",
"}",
"\n",
"if",
"(",
"item",
".",
"meta",
"&",
"bitValuePointer",
")",
"==",
"0",
"{",
"return",
"int64",
"(",
"len",
"(",
"item",
".",
"key",
")",
"+",
"len",
"(",
"item",
".",
"vptr",
")",
")",
"\n",
"}",
"\n",
"var",
"vp",
"valuePointer",
"\n",
"vp",
".",
"Decode",
"(",
"<mask>",
".",
"vptr",
")",
"\n",
"return",
"int64",
"(",
"vp",
".",
"Len",
")",
"// includes key length.",
"\n",
"}"
] |
23,196 | all-23197 | [
"ExportField",
"exports",
"columns",
"for",
"a",
"field",
"."
] | [
"func",
"(",
"c",
"*",
"Client",
")",
"ExportField",
"(",
"field",
"*",
"Field",
")",
"(",
"io",
".",
"Reader",
",",
"error",
")",
"{",
"span",
":=",
"c",
".",
"tracer",
".",
"StartSpan",
"(",
"\"",
"\"",
")",
"\n",
"defer",
"span",
".",
"Finish",
"(",
")",
"\n\n",
"var",
"shardsMax",
"map",
"[",
"string",
"]",
"uint64",
"\n",
"var",
"err",
"error",
"\n\n",
"status",
",",
"err",
":=",
"c",
".",
"Status",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"shardsMax",
",",
"err",
"=",
"c",
".",
"shardsMax",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"status",
".",
"indexMaxShard",
"=",
"shardsMax",
"\n",
"shardURIs",
",",
"err",
":=",
"c",
".",
"statusToNodeShardsForIndex",
"(",
"<mask>",
",",
"field",
".",
"index",
".",
"Name",
"(",
")",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"return",
"newExportReader",
"(",
"c",
",",
"shardURIs",
",",
"field",
")",
",",
"nil",
"\n",
"}"
] |
23,197 | all-23198 | [
"ScaleNewWithRange",
"is",
"a",
"wrapper",
"around",
"gtk_scale_new_with_range",
"()",
"."
] | [
"func",
"ScaleNewWithRange",
"(",
"orientation",
"Orientation",
",",
"min",
",",
"<mask>",
",",
"step",
"float64",
")",
"(",
"*",
"Scale",
",",
"error",
")",
"{",
"c",
":=",
"C",
".",
"gtk_scale_new_with_range",
"(",
"C",
".",
"GtkOrientation",
"(",
"orientation",
")",
",",
"C",
".",
"gdouble",
"(",
"min",
")",
",",
"C",
".",
"gdouble",
"(",
"max",
")",
",",
"C",
".",
"gdouble",
"(",
"step",
")",
")",
"\n\n",
"if",
"c",
"==",
"nil",
"{",
"return",
"nil",
",",
"nilPtrErr",
"\n",
"}",
"\n",
"return",
"wrapScale",
"(",
"glib",
".",
"Take",
"(",
"unsafe",
".",
"Pointer",
"(",
"c",
")",
")",
")",
",",
"nil",
"\n",
"}"
] |
23,198 | all-23199 | [
"WithFormat",
"image",
"compression",
"format",
"(",
"defaults",
"to",
"png",
")",
"."
] | [
"func",
"(",
"p",
"CaptureScreenshotParams",
")",
"WithFormat",
"(",
"format",
"CaptureScreenshotFormat",
")",
"*",
"CaptureScreenshotParams",
"{",
"p",
".",
"Format",
"=",
"<mask>",
"\n",
"return",
"&",
"p",
"\n",
"}"
] |
23,199 | all-23200 | [
"render",
"multiple",
"sets",
"of",
"primitives",
"by",
"specifying",
"indices",
"of",
"array",
"data",
"elements"
] | [
"func",
"MultiDrawElements",
"(",
"<mask>",
"uint32",
",",
"count",
"*",
"int32",
",",
"xtype",
"uint32",
",",
"indices",
"*",
"unsafe",
".",
"Pointer",
",",
"drawcount",
"int32",
")",
"{",
"syscall",
".",
"Syscall6",
"(",
"gpMultiDrawElements",
",",
"5",
",",
"uintptr",
"(",
"mode",
")",
",",
"uintptr",
"(",
"unsafe",
".",
"Pointer",
"(",
"count",
")",
")",
",",
"uintptr",
"(",
"xtype",
")",
",",
"uintptr",
"(",
"unsafe",
".",
"Pointer",
"(",
"indices",
")",
")",
",",
"uintptr",
"(",
"drawcount",
")",
",",
"0",
")",
"\n",
"}"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.