id
int32 0
25.3k
| idx
stringlengths 5
9
| nl_tokens
sequencelengths 1
418
| pl_tokens
sequencelengths 22
4.98k
|
---|---|---|---|
2,500 | all-2501 | [
"ApplyEmbeddedOrientation",
"is",
"a",
"wrapper",
"around",
"gdk_pixbuf_apply_embedded_orientation",
"()",
"."
] | [
"func",
"(",
"v",
"*",
"Pixbuf",
")",
"ApplyEmbeddedOrientation",
"(",
")",
"(",
"*",
"Pixbuf",
",",
"error",
")",
"{",
"c",
":=",
"C",
".",
"gdk_pixbuf_apply_embedded_orientation",
"(",
"v",
".",
"native",
"(",
")",
")",
"\n",
"if",
"c",
"==",
"nil",
"{",
"return",
"nil",
",",
"nilPtrErr",
"\n",
"}",
"\n\n",
"obj",
":=",
"&",
"glib",
".",
"<mask>",
"{",
"glib",
".",
"ToGObject",
"(",
"unsafe",
".",
"Pointer",
"(",
"c",
")",
")",
"}",
"\n",
"p",
":=",
"&",
"Pixbuf",
"{",
"obj",
"}",
"\n",
"//obj.Ref()",
"runtime",
".",
"SetFinalizer",
"(",
"p",
",",
"func",
"(",
"_",
"interface",
"{",
"}",
")",
"{",
"obj",
".",
"Unref",
"(",
")",
"}",
")",
"\n",
"return",
"p",
",",
"nil",
"\n",
"}"
] |
2,501 | all-2502 | [
"NewStateManager",
"mocks",
"base",
"method"
] | [
"func",
"(",
"m",
"*",
"MockStateManager",
")",
"NewStateManager",
"(",
"arg0",
"*",
"config",
".",
"Config",
",",
"arg1",
"...",
"statemanager",
".",
"Option",
")",
"(",
"statemanager",
".",
"StateManager",
",",
"error",
")",
"{",
"varargs",
":=",
"[",
"]",
"interface",
"{",
"}",
"{",
"arg0",
"}",
"\n",
"for",
"_",
",",
"a",
":=",
"<mask>",
"arg1",
"{",
"varargs",
"=",
"append",
"(",
"varargs",
",",
"a",
")",
"\n",
"}",
"\n",
"ret",
":=",
"m",
".",
"ctrl",
".",
"Call",
"(",
"m",
",",
"\"",
"\"",
",",
"varargs",
"...",
")",
"\n",
"ret0",
",",
"_",
":=",
"ret",
"[",
"0",
"]",
".",
"(",
"statemanager",
".",
"StateManager",
")",
"\n",
"ret1",
",",
"_",
":=",
"ret",
"[",
"1",
"]",
".",
"(",
"error",
")",
"\n",
"return",
"ret0",
",",
"ret1",
"\n",
"}"
] |
2,502 | all-2503 | [
"New",
"returns",
"a",
"file",
"system",
"that",
"returns",
"constant",
"modification",
"time",
"for",
"all",
"files",
"."
] | [
"func",
"New",
"(",
"fs",
"http",
".",
"FileSystem",
",",
"t",
"<mask>",
".",
"Time",
")",
"http",
".",
"FileSystem",
"{",
"return",
"&",
"timefs",
"{",
"fs",
":",
"fs",
",",
"t",
":",
"t",
"}",
"\n",
"}"
] |
2,503 | all-2504 | [
"ProjectID",
"is",
"an",
"option",
"that",
"sets",
"the",
"project",
"ID",
"which",
"is",
"needed",
"for",
"the",
"log",
"name",
"."
] | [
"func",
"ProjectID",
"(",
"projectID",
"string",
")",
"Option",
"{",
"return",
"func",
"(",
"sh",
"*",
"StackdriverHook",
")",
"error",
"{",
"sh",
".",
"projectID",
"=",
"projectID",
"\n",
"<mask>",
"nil",
"\n",
"}",
"\n",
"}"
] |
2,504 | all-2505 | [
"title",
":",
"install",
"host",
"info",
"path",
":",
"/",
"install",
"/",
"hosts",
"/",
"{",
"name",
"}",
"method",
":",
"GET",
"produce",
":",
"application",
"/",
"json",
"responses",
":",
"200",
":",
"OK",
"401",
":",
"Unauthorized",
"404",
":",
"Not",
"Found"
] | [
"func",
"installHostInfo",
"(",
"w",
"http",
".",
"ResponseWriter",
",",
"r",
"*",
"http",
".",
"Request",
",",
"t",
"auth",
".",
"Token",
")",
"error",
"{",
"allowed",
":=",
"permission",
".",
"Check",
"(",
"t",
",",
"permission",
".",
"PermInstallManage",
")",
"\n",
"if",
"!",
"allowed",
"{",
"return",
"permission",
".",
"ErrUnauthorized",
"\n",
"}",
"\n",
"host",
",",
"err",
":=",
"install",
".",
"GetHostByName",
"(",
"r",
".",
"URL",
".",
"Query",
"(",
")",
".",
"Get",
"(",
"\"",
"\"",
")",
")",
"\n",
"if",
"errNf",
",",
"ok",
":=",
"err",
".",
"(",
"*",
"install",
".",
"ErrHostNotFound",
")",
";",
"ok",
"{",
"return",
"&",
"<mask>",
".",
"HTTP",
"{",
"Code",
":",
"http",
".",
"StatusNotFound",
",",
"Message",
":",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"errNf",
".",
"Name",
")",
"}",
"\n",
"}",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"w",
".",
"Header",
"(",
")",
".",
"Set",
"(",
"\"",
"\"",
",",
"\"",
"\"",
")",
"\n",
"return",
"json",
".",
"NewEncoder",
"(",
"w",
")",
".",
"Encode",
"(",
"&",
"host",
")",
"\n",
"}"
] |
2,505 | all-2506 | [
"GetLocalID",
"returns",
"the",
"current",
"local",
"id"
] | [
"func",
"(",
"o",
"*",
"<mask>",
")",
"GetLocalID",
"(",
")",
"uint64",
"{",
"o",
".",
"RLock",
"(",
")",
"\n",
"defer",
"o",
".",
"RUnlock",
"(",
")",
"\n",
"return",
"o",
".",
"localID",
"\n",
"}"
] |
2,506 | all-2507 | [
"DerivePrivateKey",
"derives",
"the",
"private",
"key",
"with",
"index",
"and",
"chainCode",
".",
"If",
"prime",
"is",
"true",
"the",
"derivation",
"is",
"hardened",
".",
"It",
"returns",
"the",
"new",
"private",
"key",
"and",
"new",
"chain",
"code",
"."
] | [
"func",
"DerivePrivateKey",
"(",
"privKeyBytes",
"[",
"]",
"byte",
",",
"chainCode",
"[",
"]",
"byte",
",",
"index",
"uint32",
",",
"prime",
"bool",
")",
"(",
"[",
"]",
"byte",
",",
"[",
"]",
"byte",
")",
"{",
"var",
"data",
"[",
"]",
"byte",
"\n",
"if",
"prime",
"{",
"index",
"=",
"index",
"|",
"0x80000000",
"\n",
"data",
"=",
"<mask>",
"(",
"[",
"]",
"byte",
"{",
"byte",
"(",
"0",
")",
"}",
",",
"privKeyBytes",
"...",
")",
"\n",
"}",
"else",
"{",
"public",
":=",
"PubKeyBytesFromPrivKeyBytes",
"(",
"privKeyBytes",
",",
"true",
")",
"\n",
"data",
"=",
"public",
"\n",
"}",
"\n",
"data",
"=",
"append",
"(",
"data",
",",
"uint32ToBytes",
"(",
"index",
")",
"...",
")",
"\n",
"data2",
",",
"chainCode2",
":=",
"I64",
"(",
"chainCode",
",",
"data",
")",
"\n",
"x",
":=",
"addScalars",
"(",
"privKeyBytes",
",",
"data2",
")",
"\n",
"return",
"x",
",",
"chainCode2",
"\n",
"}"
] |
2,507 | all-2508 | [
"bind",
"one",
"or",
"more",
"buffer",
"objects",
"to",
"a",
"sequence",
"of",
"indexed",
"buffer",
"targets"
] | [
"func",
"BindBuffersBase",
"(",
"target",
"uint32",
",",
"first",
"uint32",
",",
"count",
"int32",
",",
"buffers",
"*",
"uint32",
")",
"{",
"C",
".",
"glowBindBuffersBase",
"(",
"gpBindBuffersBase",
",",
"(",
"C",
".",
"GLenum",
")",
"(",
"target",
")",
",",
"(",
"C",
".",
"GLuint",
")",
"(",
"first",
")",
",",
"(",
"C",
".",
"GLsizei",
")",
"(",
"<mask>",
")",
",",
"(",
"*",
"C",
".",
"GLuint",
")",
"(",
"unsafe",
".",
"Pointer",
"(",
"buffers",
")",
")",
")",
"\n",
"}"
] |
2,508 | all-2509 | [
"ForceSave",
"mocks",
"base",
"method"
] | [
"func",
"(",
"m",
"*",
"MockStateManager",
")",
"ForceSave",
"(",
")",
"error",
"{",
"ret",
":=",
"m",
".",
"ctrl",
".",
"Call",
"(",
"m",
",",
"\"",
"\"",
")",
"\n",
"ret0",
",",
"_",
":=",
"<mask>",
"[",
"0",
"]",
".",
"(",
"error",
")",
"\n",
"return",
"ret0",
"\n",
"}"
] |
2,509 | all-2510 | [
"Embed",
"embeds",
"the",
"images",
"to",
"the",
"email",
"."
] | [
"func",
"(",
"m",
"*",
"Message",
")",
"Embed",
"(",
"<mask>",
"string",
",",
"settings",
"...",
"FileSetting",
")",
"{",
"m",
".",
"embedded",
"=",
"m",
".",
"appendFile",
"(",
"m",
".",
"embedded",
",",
"fileFromFilename",
"(",
"filename",
")",
",",
"settings",
")",
"\n",
"}"
] |
2,510 | all-2511 | [
"Idle",
"indicates",
"to",
"the",
"server",
"that",
"the",
"client",
"is",
"ready",
"to",
"receive",
"unsolicited",
"mailbox",
"update",
"messages",
".",
"When",
"the",
"client",
"wants",
"to",
"send",
"commands",
"again",
"it",
"must",
"first",
"close",
"stop",
"."
] | [
"func",
"(",
"c",
"*",
"Client",
")",
"Idle",
"(",
"stop",
"<-",
"chan",
"struct",
"{",
"}",
")",
"error",
"{",
"if",
"c",
".",
"LogoutTimeout",
"==",
"0",
"{",
"return",
"c",
".",
"idle",
"(",
"stop",
")",
"\n",
"}",
"\n\n",
"t",
":=",
"time",
".",
"NewTicker",
"(",
"c",
".",
"LogoutTimeout",
")",
"\n",
"defer",
"t",
".",
"Stop",
"(",
")",
"\n\n",
"for",
"{",
"stopOrRestart",
":=",
"<mask>",
"(",
"chan",
"struct",
"{",
"}",
")",
"\n",
"done",
":=",
"make",
"(",
"chan",
"error",
",",
"1",
")",
"\n",
"go",
"func",
"(",
")",
"{",
"done",
"<-",
"c",
".",
"idle",
"(",
"stopOrRestart",
")",
"\n",
"}",
"(",
")",
"\n\n",
"select",
"{",
"case",
"<-",
"t",
".",
"C",
":",
"close",
"(",
"stopOrRestart",
")",
"\n",
"if",
"err",
":=",
"<-",
"done",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"case",
"<-",
"stop",
":",
"close",
"(",
"stopOrRestart",
")",
"\n",
"return",
"<-",
"done",
"\n",
"case",
"err",
":=",
"<-",
"done",
":",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n",
"}"
] |
2,511 | all-2512 | [
"AccelMapLockPath",
"is",
"a",
"wrapper",
"around",
"gtk_accel_map_lock_path",
"()",
"."
] | [
"func",
"AccelMapLockPath",
"(",
"<mask>",
"string",
")",
"{",
"cstr",
":=",
"C",
".",
"CString",
"(",
"path",
")",
"\n",
"defer",
"C",
".",
"free",
"(",
"unsafe",
".",
"Pointer",
"(",
"cstr",
")",
")",
"\n\n",
"C",
".",
"gtk_accel_map_lock_path",
"(",
"(",
"*",
"C",
".",
"gchar",
")",
"(",
"cstr",
")",
")",
"\n",
"}"
] |
2,512 | all-2513 | [
"Attach",
"attaches",
"items",
"to",
"the",
"lease",
"with",
"given",
"ID",
".",
"When",
"the",
"lease",
"expires",
"the",
"attached",
"items",
"will",
"be",
"automatically",
"removed",
".",
"If",
"the",
"given",
"lease",
"does",
"not",
"exist",
"an",
"error",
"will",
"be",
"returned",
"."
] | [
"func",
"(",
"le",
"*",
"lessor",
")",
"Attach",
"(",
"<mask>",
"LeaseID",
",",
"items",
"[",
"]",
"LeaseItem",
")",
"error",
"{",
"le",
".",
"mu",
".",
"Lock",
"(",
")",
"\n",
"defer",
"le",
".",
"mu",
".",
"Unlock",
"(",
")",
"\n\n",
"l",
":=",
"le",
".",
"leaseMap",
"[",
"id",
"]",
"\n",
"if",
"l",
"==",
"nil",
"{",
"return",
"ErrLeaseNotFound",
"\n",
"}",
"\n\n",
"l",
".",
"mu",
".",
"Lock",
"(",
")",
"\n",
"for",
"_",
",",
"it",
":=",
"range",
"items",
"{",
"l",
".",
"itemSet",
"[",
"it",
"]",
"=",
"struct",
"{",
"}",
"{",
"}",
"\n",
"le",
".",
"itemMap",
"[",
"it",
"]",
"=",
"id",
"\n",
"}",
"\n",
"l",
".",
"mu",
".",
"Unlock",
"(",
")",
"\n",
"return",
"nil",
"\n",
"}"
] |
2,513 | all-2514 | [
"GoValue",
"converts",
"a",
"Value",
"to",
"comparable",
"Go",
"type",
".",
"GoValue",
"()",
"returns",
"a",
"non",
"-",
"nil",
"error",
"if",
"the",
"conversion",
"was",
"unsuccessful",
".",
"The",
"returned",
"interface",
"{}",
"must",
"be",
"type",
"asserted",
"as",
"the",
"actual",
"Go",
"representation",
"of",
"the",
"Value",
".",
"This",
"function",
"is",
"a",
"wrapper",
"around",
"the",
"many",
"g_value_get_",
"*",
"()",
"functions",
"depending",
"on",
"the",
"type",
"of",
"the",
"Value",
"."
] | [
"func",
"(",
"v",
"*",
"<mask>",
")",
"GoValue",
"(",
")",
"(",
"interface",
"{",
"}",
",",
"error",
")",
"{",
"f",
",",
"err",
":=",
"gValueMarshalers",
".",
"lookup",
"(",
"v",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"//No need to add finalizer because it is already done by ValueAlloc and ValueInit",
"rv",
",",
"err",
":=",
"f",
"(",
"uintptr",
"(",
"unsafe",
".",
"Pointer",
"(",
"v",
".",
"native",
"(",
")",
")",
")",
")",
"\n",
"return",
"rv",
",",
"err",
"\n",
"}"
] |
2,514 | all-2515 | [
"Fail",
"prints",
"usage",
"information",
"to",
"stderr",
"and",
"exits",
"with",
"non",
"-",
"zero",
"status"
] | [
"func",
"(",
"p",
"*",
"<mask>",
")",
"Fail",
"(",
"msg",
"string",
")",
"{",
"p",
".",
"WriteUsage",
"(",
"os",
".",
"Stderr",
")",
"\n",
"fmt",
".",
"Fprintln",
"(",
"os",
".",
"Stderr",
",",
"\"",
"\"",
",",
"msg",
")",
"\n",
"os",
".",
"Exit",
"(",
"-",
"1",
")",
"\n",
"}"
] |
2,515 | all-2516 | [
"subqueryOrRangeSelector",
"parses",
"a",
"Subquery",
"based",
"on",
"given",
"Expr",
"(",
"or",
")",
"a",
"Matrix",
"(",
"a",
".",
"k",
".",
"a",
".",
"range",
")",
"selector",
"based",
"on",
"a",
"given",
"Vector",
"selector",
".",
"<Vector_selector",
">",
"[",
"<duration",
">",
"]",
"|",
"<Vector_selector",
">",
"[",
"<duration",
">",
":",
"[",
"<duration",
">",
"]",
"]"
] | [
"func",
"(",
"p",
"*",
"parser",
")",
"subqueryOrRangeSelector",
"(",
"expr",
"Expr",
",",
"checkRange",
"bool",
")",
"Expr",
"{",
"ctx",
":=",
"\"",
"\"",
"\n",
"if",
"checkRange",
"{",
"ctx",
"=",
"\"",
"\"",
"\n",
"}",
"\n\n",
"p",
".",
"next",
"(",
")",
"\n\n",
"var",
"erange",
"time",
".",
"Duration",
"\n",
"var",
"err",
"error",
"\n\n",
"erangeStr",
":=",
"p",
".",
"expect",
"(",
"ItemDuration",
",",
"ctx",
")",
".",
"val",
"\n",
"erange",
",",
"err",
"=",
"parseDuration",
"(",
"erangeStr",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"p",
".",
"error",
"(",
"err",
")",
"\n",
"}",
"\n\n",
"var",
"itm",
"item",
"\n",
"if",
"checkRange",
"{",
"itm",
"=",
"p",
".",
"expectOneOf",
"(",
"ItemRightBracket",
",",
"ItemColon",
",",
"ctx",
")",
"\n",
"if",
"itm",
".",
"typ",
"==",
"ItemRightBracket",
"{",
"// Range selector.",
"vs",
",",
"ok",
":=",
"expr",
".",
"(",
"*",
"VectorSelector",
")",
"\n",
"if",
"!",
"ok",
"{",
"p",
".",
"errorf",
"(",
"\"",
"\"",
",",
"expr",
")",
"\n",
"}",
"\n",
"return",
"&",
"MatrixSelector",
"{",
"<mask>",
":",
"vs",
".",
"Name",
",",
"LabelMatchers",
":",
"vs",
".",
"LabelMatchers",
",",
"Range",
":",
"erange",
",",
"}",
"\n",
"}",
"\n",
"}",
"else",
"{",
"itm",
"=",
"p",
".",
"expect",
"(",
"ItemColon",
",",
"ctx",
")",
"\n",
"}",
"\n\n",
"// Subquery.",
"var",
"estep",
"time",
".",
"Duration",
"\n\n",
"itm",
"=",
"p",
".",
"expectOneOf",
"(",
"ItemRightBracket",
",",
"ItemDuration",
",",
"ctx",
")",
"\n",
"if",
"itm",
".",
"typ",
"==",
"ItemDuration",
"{",
"estepStr",
":=",
"itm",
".",
"val",
"\n",
"estep",
",",
"err",
"=",
"parseDuration",
"(",
"estepStr",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"p",
".",
"error",
"(",
"err",
")",
"\n",
"}",
"\n",
"p",
".",
"expect",
"(",
"ItemRightBracket",
",",
"ctx",
")",
"\n",
"}",
"\n\n",
"return",
"&",
"SubqueryExpr",
"{",
"Expr",
":",
"expr",
",",
"Range",
":",
"erange",
",",
"Step",
":",
"estep",
",",
"}",
"\n",
"}"
] |
2,516 | all-2517 | [
"CtxServeHTTP",
"implements",
"Handler",
".",
"CtxServeHTTP"
] | [
"func",
"(",
"h",
"HandlerFunc",
")",
"CtxServeHTTP",
"(",
"ctx",
"context",
".",
"<mask>",
",",
"w",
"http",
".",
"ResponseWriter",
",",
"r",
"*",
"http",
".",
"Request",
")",
"{",
"h",
"(",
"ctx",
",",
"w",
",",
"r",
")",
"\n",
"}"
] |
2,517 | all-2518 | [
"UnmarshalYAML",
"implements",
"the",
"yaml",
".",
"Unmarshaler",
"interface",
"."
] | [
"func",
"(",
"c",
"*",
"<mask>",
")",
"UnmarshalYAML",
"(",
"unmarshal",
"func",
"(",
"interface",
"{",
"}",
")",
"error",
")",
"error",
"{",
"if",
"err",
":=",
"unmarshal",
"(",
"(",
"*",
"string",
")",
"(",
"c",
")",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"switch",
"*",
"c",
"{",
"case",
"RoleNode",
",",
"RolePod",
",",
"RoleService",
",",
"RoleEndpoint",
",",
"RoleIngress",
":",
"return",
"nil",
"\n",
"default",
":",
"return",
"errors",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"*",
"c",
")",
"\n",
"}",
"\n",
"}"
] |
2,518 | all-2519 | [
"Add",
"adds",
"an",
"Error",
"with",
"given",
"key",
"name",
"value",
"and",
"reason",
"."
] | [
"func",
"(",
"l",
"*",
"ErrorList",
")",
"add",
"(",
"name",
"string",
",",
"value",
"interface",
"{",
"}",
",",
"reason",
"string",
")",
"{",
"*",
"l",
"=",
"append",
"(",
"*",
"l",
",",
"&",
"Error",
"{",
"name",
",",
"value",
",",
"<mask>",
"}",
")",
"\n",
"}"
] |
2,519 | all-2520 | [
"RetryNotify",
"calls",
"notify",
"function",
"with",
"the",
"error",
"and",
"wait",
"duration",
"for",
"each",
"failed",
"attempt",
"before",
"sleep",
"."
] | [
"func",
"RetryNotify",
"(",
"operation",
"Operation",
",",
"b",
"BackOff",
",",
"notify",
"Notify",
")",
"error",
"{",
"var",
"err",
"error",
"\n",
"var",
"next",
"<mask>",
".",
"Duration",
"\n\n",
"b",
".",
"Reset",
"(",
")",
"\n",
"for",
"{",
"if",
"err",
"=",
"operation",
"(",
")",
";",
"err",
"==",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n\n",
"if",
"next",
"=",
"b",
".",
"NextBackOff",
"(",
")",
";",
"next",
"==",
"Stop",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"if",
"notify",
"!=",
"nil",
"{",
"if",
"err",
":=",
"notify",
"(",
"err",
",",
"next",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"}",
"\n\n",
"time",
".",
"Sleep",
"(",
"next",
")",
"\n",
"}",
"\n",
"}"
] |
2,520 | all-2521 | [
"chooseNodeToAdd",
"finds",
"which",
"is",
"the",
"node",
"with",
"the",
"minimum",
"number",
"of",
"containers",
"and",
"returns",
"it"
] | [
"func",
"(",
"s",
"*",
"segregatedScheduler",
")",
"chooseNodeToAdd",
"(",
"nodes",
"[",
"]",
"cluster",
".",
"Node",
",",
"contName",
"string",
",",
"appName",
",",
"<mask>",
"string",
")",
"(",
"string",
",",
"error",
")",
"{",
"log",
".",
"Debugf",
"(",
"\"",
"\"",
",",
"contName",
",",
"nodes",
")",
"\n",
"s",
".",
"hostMutex",
".",
"Lock",
"(",
")",
"\n",
"defer",
"s",
".",
"hostMutex",
".",
"Unlock",
"(",
")",
"\n",
"chosenNode",
",",
"_",
",",
"err",
":=",
"s",
".",
"minMaxNodes",
"(",
"nodes",
",",
"appName",
",",
"process",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"\"",
"\"",
",",
"err",
"\n",
"}",
"\n",
"log",
".",
"Debugf",
"(",
"\"",
"\"",
",",
"contName",
",",
"chosenNode",
")",
"\n",
"if",
"contName",
"!=",
"\"",
"\"",
"{",
"coll",
":=",
"s",
".",
"provisioner",
".",
"Collection",
"(",
")",
"\n",
"defer",
"coll",
".",
"Close",
"(",
")",
"\n",
"err",
"=",
"coll",
".",
"Update",
"(",
"bson",
".",
"M",
"{",
"\"",
"\"",
":",
"contName",
"}",
",",
"bson",
".",
"M",
"{",
"\"",
"\"",
":",
"bson",
".",
"M",
"{",
"\"",
"\"",
":",
"net",
".",
"URLToHost",
"(",
"chosenNode",
")",
"}",
"}",
")",
"\n",
"}",
"\n",
"return",
"chosenNode",
",",
"err",
"\n",
"}"
] |
2,521 | all-2522 | [
"CONTRACT",
":",
"rv",
".",
"CanAddr",
"()",
"is",
"true",
"."
] | [
"func",
"(",
"cdc",
"*",
"Codec",
")",
"decodeReflectJSONInterface",
"(",
"bz",
"[",
"]",
"byte",
",",
"iinfo",
"*",
"TypeInfo",
",",
"rv",
"reflect",
".",
"Value",
",",
"fopts",
"FieldOptions",
")",
"(",
"err",
"error",
")",
"{",
"if",
"!",
"rv",
".",
"CanAddr",
"(",
")",
"{",
"panic",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"if",
"printLog",
"{",
"fmt",
".",
"Println",
"(",
"\"",
"\"",
")",
"\n",
"defer",
"func",
"(",
")",
"{",
"fmt",
".",
"Printf",
"(",
"\"",
"\\n",
"\"",
",",
"err",
")",
"\n",
"}",
"(",
")",
"\n",
"}",
"\n\n",
"/*\n\t\tWe don't make use of user-provided interface values because there are a\n\t\tlot of edge cases.\n\n\t\t* What if the type is mismatched?\n\t\t* What if the JSON field entry is missing?\n\t\t* Circular references?\n\t*/",
"if",
"!",
"rv",
".",
"IsNil",
"(",
")",
"{",
"// We don't strictly need to set it nil, but lets keep it here for a",
"// while in case we forget, for defensive purposes.",
"rv",
".",
"<mask>",
"(",
"iinfo",
".",
"ZeroValue",
")",
"\n",
"}",
"\n\n",
"// Consume type wrapper info.",
"name",
",",
"bz",
",",
"err",
":=",
"decodeInterfaceJSON",
"(",
"bz",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"\n",
"}",
"\n",
"// XXX: Check name against interface to make sure that it actually",
"// matches, and return an error if it doesn't.",
"// NOTE: Unlike decodeReflectBinaryInterface, we already dealt with nil in decodeReflectJSON.",
"// NOTE: We also \"consumed\" the interface wrapper by replacing `bz` above.",
"// Get concrete type info.",
"// NOTE: Unlike decodeReflectBinaryInterface, uses the full name string.",
"var",
"cinfo",
"*",
"TypeInfo",
"\n",
"cinfo",
",",
"err",
"=",
"cdc",
".",
"getTypeInfoFromName_rlock",
"(",
"name",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"\n",
"}",
"\n\n",
"// Construct the concrete type.",
"var",
"crv",
",",
"irvSet",
"=",
"constructConcreteType",
"(",
"cinfo",
")",
"\n\n",
"// Decode into the concrete type.",
"err",
"=",
"cdc",
".",
"decodeReflectJSON",
"(",
"bz",
",",
"cinfo",
",",
"crv",
",",
"fopts",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"rv",
".",
"Set",
"(",
"irvSet",
")",
"// Helps with debugging",
"\n",
"return",
"\n",
"}",
"\n\n",
"// We need to set here, for when !PointerPreferred and the type",
"// is say, an array of bytes (e.g. [32]byte), then we must call",
"// rv.Set() *after* the value was acquired.",
"rv",
".",
"Set",
"(",
"irvSet",
")",
"\n",
"return",
"\n",
"}"
] |
2,522 | all-2523 | [
"ParseFile",
"reads",
"and",
"parses",
"rules",
"from",
"a",
"file",
"."
] | [
"func",
"ParseFile",
"(",
"file",
"string",
")",
"(",
"*",
"RuleGroups",
",",
"[",
"]",
"error",
")",
"{",
"b",
",",
"err",
":=",
"ioutil",
".",
"ReadFile",
"(",
"<mask>",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"[",
"]",
"error",
"{",
"err",
"}",
"\n",
"}",
"\n",
"return",
"Parse",
"(",
"b",
")",
"\n",
"}"
] |
2,523 | all-2524 | [
"GetPriorityOk",
"returns",
"a",
"tuple",
"with",
"the",
"Priority",
"field",
"if",
"it",
"s",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"and",
"a",
"boolean",
"to",
"check",
"if",
"the",
"value",
"has",
"been",
"set",
"."
] | [
"func",
"(",
"e",
"*",
"Event",
")",
"GetPriorityOk",
"(",
")",
"(",
"string",
",",
"bool",
")",
"{",
"if",
"e",
"==",
"nil",
"||",
"e",
".",
"Priority",
"==",
"nil",
"{",
"return",
"\"",
"\"",
",",
"false",
"\n",
"}",
"\n",
"return",
"*",
"e",
".",
"Priority",
",",
"<mask>",
"\n",
"}"
] |
2,524 | all-2525 | [
"stdPagedQuery",
"executes",
"a",
"query",
"using",
"default",
"job",
"parameters",
"and",
"paging",
"over",
"the",
"results",
"returning",
"them",
"over",
"the",
"data",
"chan",
"provided"
] | [
"func",
"(",
"c",
"*",
"Client",
")",
"stdPagedQuery",
"(",
"service",
"*",
"bigquery",
".",
"Service",
",",
"pageSize",
"int",
",",
"dataset",
",",
"project",
",",
"queryStr",
"string",
",",
"dataChan",
"chan",
"Data",
")",
"(",
"[",
"]",
"[",
"]",
"interface",
"{",
"}",
",",
"[",
"]",
"string",
",",
"error",
")",
"{",
"c",
".",
"printDebug",
"(",
"\"",
"\"",
")",
"\n",
"datasetRef",
":=",
"&",
"bigquery",
".",
"DatasetReference",
"{",
"DatasetId",
":",
"dataset",
",",
"ProjectId",
":",
"project",
",",
"}",
"\n\n",
"query",
":=",
"&",
"bigquery",
".",
"QueryRequest",
"{",
"DefaultDataset",
":",
"datasetRef",
",",
"MaxResults",
":",
"int64",
"(",
"pageSize",
")",
",",
"Kind",
":",
"\"",
"\"",
",",
"<mask>",
":",
"queryStr",
",",
"}",
"\n\n",
"qr",
",",
"err",
":=",
"service",
".",
"Jobs",
".",
"Query",
"(",
"project",
",",
"query",
")",
".",
"Do",
"(",
")",
"\n\n",
"// extract the initial rows that have already been returned with the Query",
"headers",
",",
"rows",
":=",
"c",
".",
"headersAndRows",
"(",
"qr",
".",
"Schema",
",",
"qr",
".",
"Rows",
")",
"\n\n",
"if",
"err",
"!=",
"nil",
"{",
"c",
".",
"printDebug",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"if",
"dataChan",
"!=",
"nil",
"{",
"dataChan",
"<-",
"Data",
"{",
"Err",
":",
"err",
"}",
"\n",
"}",
"\n\n",
"return",
"nil",
",",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"return",
"c",
".",
"processPagedQuery",
"(",
"qr",
".",
"JobReference",
",",
"qr",
".",
"PageToken",
",",
"dataChan",
",",
"headers",
",",
"rows",
")",
"\n",
"}"
] |
2,525 | all-2526 | [
"runClient",
"performs",
"the",
"main",
"work",
"of",
"the",
"client",
".",
"It",
"attempts",
"to",
"connect",
"to",
"the",
"server",
"via",
"a",
"UNIX",
"-",
"domain",
"socket",
".",
"If",
"the",
"server",
"is",
"not",
"running",
"it",
"starts",
"the",
"server",
"and",
"tries",
"again",
".",
"The",
"server",
"does",
"all",
"the",
"work",
"so",
"the",
"client",
"just",
"waits",
"for",
"the",
"server",
"to",
"complete",
"then",
"exits",
"."
] | [
"func",
"runClient",
"(",
")",
"error",
"{",
"startTime",
":=",
"time",
".",
"Now",
"(",
")",
"\n",
"conn",
",",
"err",
":=",
"net",
".",
"Dial",
"(",
"\"",
"\"",
",",
"*",
"socketPath",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"if",
"err",
":=",
"startServer",
"(",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"}",
"\n",
"for",
"retry",
":=",
"0",
";",
"retry",
"<",
"3",
";",
"retry",
"++",
"{",
"conn",
",",
"err",
"=",
"net",
".",
"Dial",
"(",
"\"",
"\"",
",",
"*",
"socketPath",
")",
"\n",
"if",
"err",
"==",
"nil",
"{",
"break",
"\n",
"}",
"\n",
"// Wait for server to start listening.",
"<mask>",
".",
"Sleep",
"(",
"1",
"*",
"time",
".",
"Second",
")",
"\n",
"}",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"}",
"\n",
"}",
"\n",
"defer",
"conn",
".",
"Close",
"(",
")",
"\n\n",
"if",
"_",
",",
"err",
":=",
"io",
".",
"Copy",
"(",
"os",
".",
"Stderr",
",",
"conn",
")",
";",
"err",
"!=",
"nil",
"{",
"log",
".",
"Print",
"(",
"err",
")",
"\n",
"}",
"\n\n",
"elapsedTime",
":=",
"time",
".",
"Since",
"(",
"startTime",
")",
"\n",
"log",
".",
"Printf",
"(",
"\"",
"\"",
",",
"elapsedTime",
".",
"Seconds",
"(",
")",
")",
"\n",
"return",
"nil",
"\n",
"}"
] |
2,526 | all-2527 | [
"title",
":",
"app",
"restart",
"path",
":",
"/",
"apps",
"/",
"{",
"app",
"}",
"/",
"restart",
"method",
":",
"POST",
"consume",
":",
"application",
"/",
"x",
"-",
"www",
"-",
"form",
"-",
"urlencoded",
"produce",
":",
"application",
"/",
"x",
"-",
"json",
"-",
"stream",
"responses",
":",
"200",
":",
"Ok",
"401",
":",
"Unauthorized",
"404",
":",
"App",
"not",
"found"
] | [
"func",
"restart",
"(",
"w",
"http",
".",
"ResponseWriter",
",",
"r",
"*",
"<mask>",
".",
"Request",
",",
"t",
"auth",
".",
"Token",
")",
"(",
"err",
"error",
")",
"{",
"process",
":=",
"InputValue",
"(",
"r",
",",
"\"",
"\"",
")",
"\n",
"appName",
":=",
"r",
".",
"URL",
".",
"Query",
"(",
")",
".",
"Get",
"(",
"\"",
"\"",
")",
"\n",
"a",
",",
"err",
":=",
"getAppFromContext",
"(",
"appName",
",",
"r",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"allowed",
":=",
"permission",
".",
"Check",
"(",
"t",
",",
"permission",
".",
"PermAppUpdateRestart",
",",
"contextsForApp",
"(",
"&",
"a",
")",
"...",
",",
")",
"\n",
"if",
"!",
"allowed",
"{",
"return",
"permission",
".",
"ErrUnauthorized",
"\n",
"}",
"\n",
"evt",
",",
"err",
":=",
"event",
".",
"New",
"(",
"&",
"event",
".",
"Opts",
"{",
"Target",
":",
"appTarget",
"(",
"appName",
")",
",",
"Kind",
":",
"permission",
".",
"PermAppUpdateRestart",
",",
"Owner",
":",
"t",
",",
"CustomData",
":",
"event",
".",
"FormToCustomData",
"(",
"InputFields",
"(",
"r",
")",
")",
",",
"Allowed",
":",
"event",
".",
"Allowed",
"(",
"permission",
".",
"PermAppReadEvents",
",",
"contextsForApp",
"(",
"&",
"a",
")",
"...",
")",
",",
"}",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"defer",
"func",
"(",
")",
"{",
"evt",
".",
"Done",
"(",
"err",
")",
"}",
"(",
")",
"\n",
"w",
".",
"Header",
"(",
")",
".",
"Set",
"(",
"\"",
"\"",
",",
"\"",
"\"",
")",
"\n",
"keepAliveWriter",
":=",
"tsuruIo",
".",
"NewKeepAliveWriter",
"(",
"w",
",",
"30",
"*",
"time",
".",
"Second",
",",
"\"",
"\"",
")",
"\n",
"defer",
"keepAliveWriter",
".",
"Stop",
"(",
")",
"\n",
"writer",
":=",
"&",
"tsuruIo",
".",
"SimpleJsonMessageEncoderWriter",
"{",
"Encoder",
":",
"json",
".",
"NewEncoder",
"(",
"keepAliveWriter",
")",
"}",
"\n",
"evt",
".",
"SetLogWriter",
"(",
"writer",
")",
"\n",
"return",
"a",
".",
"Restart",
"(",
"process",
",",
"evt",
")",
"\n",
"}"
] |
2,527 | all-2528 | [
"flattenClusterDependencyRuleInfo",
"saves",
"a",
"ClusterDependencyRuleInfo",
"into",
"the",
"supplied",
"ResourceData",
"."
] | [
"func",
"flattenClusterDependencyRuleInfo",
"(",
"d",
"*",
"schema",
".",
"ResourceData",
",",
"obj",
"*",
"types",
".",
"ClusterDependencyRuleInfo",
")",
"error",
"{",
"return",
"structure",
".",
"SetBatch",
"(",
"d",
",",
"map",
"[",
"string",
"]",
"interface",
"{",
"}",
"{",
"\"",
"\"",
":",
"obj",
".",
"Enabled",
",",
"\"",
"\"",
":",
"obj",
".",
"Mandatory",
",",
"\"",
"\"",
":",
"obj",
".",
"<mask>",
",",
"\"",
"\"",
":",
"obj",
".",
"DependsOnVmGroup",
",",
"\"",
"\"",
":",
"obj",
".",
"VmGroup",
",",
"}",
")",
"\n",
"}"
] |
2,528 | all-2529 | [
"ReportSnapshot",
"reports",
"the",
"status",
"of",
"the",
"sent",
"snapshot",
"."
] | [
"func",
"(",
"rn",
"*",
"RawNode",
")",
"ReportSnapshot",
"(",
"id",
"uint64",
",",
"status",
"SnapshotStatus",
")",
"{",
"rej",
":=",
"<mask>",
"==",
"SnapshotFailure",
"\n\n",
"_",
"=",
"rn",
".",
"raft",
".",
"Step",
"(",
"pb",
".",
"Message",
"{",
"Type",
":",
"pb",
".",
"MsgSnapStatus",
",",
"From",
":",
"id",
",",
"Reject",
":",
"rej",
"}",
")",
"\n",
"}"
] |
2,529 | all-2530 | [
"If",
"stdin",
"stdout",
"and",
"/",
"or",
"stderr",
"are",
"pointing",
"to",
"/",
"dev",
"/",
"null",
"in",
"the",
"parent",
"s",
"rootfs",
"this",
"method",
"will",
"make",
"them",
"point",
"to",
"/",
"dev",
"/",
"null",
"in",
"this",
"container",
"s",
"rootfs",
".",
"This",
"needs",
"to",
"be",
"called",
"after",
"we",
"chroot",
"/",
"pivot",
"into",
"the",
"container",
"s",
"rootfs",
"so",
"that",
"any",
"symlinks",
"are",
"resolved",
"locally",
"."
] | [
"func",
"reOpenDevNull",
"(",
"rootfs",
"string",
")",
"error",
"{",
"var",
"stat",
",",
"devNullStat",
"syscall",
".",
"Stat_t",
"\n",
"file",
",",
"err",
":=",
"os",
".",
"Open",
"(",
"\"",
"\"",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"}",
"\n",
"defer",
"<mask>",
".",
"Close",
"(",
")",
"\n",
"if",
"err",
":=",
"syscall",
".",
"Fstat",
"(",
"int",
"(",
"file",
".",
"Fd",
"(",
")",
")",
",",
"&",
"devNullStat",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"for",
"fd",
":=",
"0",
";",
"fd",
"<",
"3",
";",
"fd",
"++",
"{",
"if",
"err",
":=",
"syscall",
".",
"Fstat",
"(",
"fd",
",",
"&",
"stat",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"if",
"stat",
".",
"Rdev",
"==",
"devNullStat",
".",
"Rdev",
"{",
"// Close and re-open the fd.",
"if",
"err",
":=",
"syscall",
".",
"Dup3",
"(",
"int",
"(",
"file",
".",
"Fd",
"(",
")",
")",
",",
"fd",
",",
"0",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
] |
2,530 | all-2531 | [
"flattenVMwareUplinkPortOrderPolicy",
"reads",
"various",
"fields",
"from",
"a",
"VMwareUplinkPortOrderPolicy",
"into",
"the",
"passed",
"in",
"ResourceData",
"."
] | [
"func",
"flattenVMwareUplinkPortOrderPolicy",
"(",
"d",
"*",
"schema",
".",
"ResourceData",
",",
"obj",
"*",
"<mask>",
".",
"VMwareUplinkPortOrderPolicy",
")",
"error",
"{",
"if",
"obj",
"==",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n\n",
"if",
"err",
":=",
"d",
".",
"Set",
"(",
"\"",
"\"",
",",
"obj",
".",
"ActiveUplinkPort",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"if",
"err",
":=",
"d",
".",
"Set",
"(",
"\"",
"\"",
",",
"obj",
".",
"StandbyUplinkPort",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
] |
2,531 | all-2532 | [
"-",
"create",
"temporary",
"directory",
"$",
"{",
"LXD_DIR",
"}",
"/",
"images",
"/",
"lxd_images_",
"-",
"create",
"new",
"zfs",
"volume",
"images",
"/",
"<fingerprint",
">",
"-",
"mount",
"the",
"zfs",
"volume",
"on",
"$",
"{",
"LXD_DIR",
"}",
"/",
"images",
"/",
"lxd_images_",
"-",
"unpack",
"the",
"downloaded",
"image",
"in",
"$",
"{",
"LXD_DIR",
"}",
"/",
"images",
"/",
"lxd_images_",
"-",
"mark",
"new",
"zfs",
"volume",
"images",
"/",
"<fingerprint",
">",
"readonly",
"-",
"remove",
"mountpoint",
"property",
"from",
"zfs",
"volume",
"images",
"/",
"<fingerprint",
">",
"-",
"create",
"read",
"-",
"write",
"snapshot",
"from",
"zfs",
"volume",
"images",
"/",
"<fingerprint",
">"
] | [
"func",
"(",
"s",
"*",
"storageZfs",
")",
"ImageCreate",
"(",
"fingerprint",
"string",
",",
"tracker",
"*",
"ioprogress",
".",
"ProgressTracker",
")",
"error",
"{",
"logger",
".",
"Debugf",
"(",
"\"",
"\\\"",
"\\\"",
"\\\"",
"\\\"",
"\"",
",",
"fingerprint",
",",
"s",
".",
"pool",
".",
"Name",
")",
"\n\n",
"poolName",
":=",
"s",
".",
"getOnDiskPoolName",
"(",
")",
"\n",
"imageMntPoint",
":=",
"getImageMountPoint",
"(",
"s",
".",
"pool",
".",
"Name",
",",
"fingerprint",
")",
"\n",
"fs",
":=",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"fingerprint",
")",
"\n",
"revert",
":=",
"true",
"\n",
"subrevert",
":=",
"true",
"\n\n",
"err",
":=",
"s",
".",
"createImageDbPoolVolume",
"(",
"fingerprint",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"defer",
"func",
"(",
")",
"{",
"if",
"!",
"subrevert",
"{",
"return",
"\n",
"}",
"\n",
"s",
".",
"deleteImageDbPoolVolume",
"(",
"fingerprint",
")",
"\n",
"}",
"(",
")",
"\n\n",
"if",
"zfsFilesystemEntityExists",
"(",
"poolName",
",",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"fs",
")",
")",
"{",
"if",
"err",
":=",
"zfsPoolVolumeRename",
"(",
"poolName",
",",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"<mask>",
")",
",",
"fs",
",",
"true",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"defer",
"func",
"(",
")",
"{",
"if",
"!",
"revert",
"{",
"return",
"\n",
"}",
"\n",
"s",
".",
"ImageDelete",
"(",
"fingerprint",
")",
"\n",
"}",
"(",
")",
"\n\n",
"// In case this is an image from an older lxd instance, wipe the",
"// mountpoint.",
"err",
"=",
"zfsPoolVolumeSet",
"(",
"poolName",
",",
"fs",
",",
"\"",
"\"",
",",
"\"",
"\"",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"revert",
"=",
"false",
"\n",
"subrevert",
"=",
"false",
"\n\n",
"return",
"nil",
"\n",
"}",
"\n\n",
"if",
"!",
"shared",
".",
"PathExists",
"(",
"imageMntPoint",
")",
"{",
"err",
":=",
"os",
".",
"MkdirAll",
"(",
"imageMntPoint",
",",
"0700",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"defer",
"func",
"(",
")",
"{",
"if",
"!",
"subrevert",
"{",
"return",
"\n",
"}",
"\n",
"os",
".",
"RemoveAll",
"(",
"imageMntPoint",
")",
"\n",
"}",
"(",
")",
"\n",
"}",
"\n\n",
"// Create temporary mountpoint directory.",
"tmp",
":=",
"getImageMountPoint",
"(",
"s",
".",
"pool",
".",
"Name",
",",
"\"",
"\"",
")",
"\n",
"tmpImageDir",
",",
"err",
":=",
"ioutil",
".",
"TempDir",
"(",
"tmp",
",",
"\"",
"\"",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"defer",
"os",
".",
"RemoveAll",
"(",
"tmpImageDir",
")",
"\n\n",
"imagePath",
":=",
"shared",
".",
"VarPath",
"(",
"\"",
"\"",
",",
"fingerprint",
")",
"\n\n",
"// Create a new storage volume on the storage pool for the image.",
"dataset",
":=",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"poolName",
",",
"fs",
")",
"\n",
"msg",
",",
"err",
":=",
"zfsPoolVolumeCreate",
"(",
"dataset",
",",
"\"",
"\"",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"logger",
".",
"Errorf",
"(",
"\"",
"\\\"",
"\\\"",
"\\\"",
"\\\"",
"\"",
",",
"dataset",
",",
"s",
".",
"pool",
".",
"Name",
",",
"msg",
")",
"\n",
"return",
"err",
"\n",
"}",
"\n",
"subrevert",
"=",
"false",
"\n",
"defer",
"func",
"(",
")",
"{",
"if",
"!",
"revert",
"{",
"return",
"\n",
"}",
"\n",
"s",
".",
"ImageDelete",
"(",
"fingerprint",
")",
"\n",
"}",
"(",
")",
"\n\n",
"// Set a temporary mountpoint for the image.",
"err",
"=",
"zfsPoolVolumeSet",
"(",
"poolName",
",",
"fs",
",",
"\"",
"\"",
",",
"tmpImageDir",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"// Make sure that the image actually got mounted.",
"if",
"!",
"shared",
".",
"IsMountPoint",
"(",
"tmpImageDir",
")",
"{",
"zfsMount",
"(",
"poolName",
",",
"fs",
")",
"\n",
"}",
"\n\n",
"// Unpack the image into the temporary mountpoint.",
"err",
"=",
"unpackImage",
"(",
"imagePath",
",",
"tmpImageDir",
",",
"storageTypeZfs",
",",
"s",
".",
"s",
".",
"OS",
".",
"RunningInUserNS",
",",
"nil",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"// Mark the new storage volume for the image as readonly.",
"if",
"err",
"=",
"zfsPoolVolumeSet",
"(",
"poolName",
",",
"fs",
",",
"\"",
"\"",
",",
"\"",
"\"",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"// Remove the temporary mountpoint from the image storage volume.",
"if",
"err",
"=",
"zfsPoolVolumeSet",
"(",
"poolName",
",",
"fs",
",",
"\"",
"\"",
",",
"\"",
"\"",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"// Make sure that the image actually got unmounted.",
"if",
"shared",
".",
"IsMountPoint",
"(",
"tmpImageDir",
")",
"{",
"zfsUmount",
"(",
"poolName",
",",
"fs",
",",
"tmpImageDir",
")",
"\n",
"}",
"\n\n",
"// Create a snapshot of that image on the storage pool which we clone for",
"// container creation.",
"err",
"=",
"zfsPoolVolumeSnapshotCreate",
"(",
"poolName",
",",
"fs",
",",
"\"",
"\"",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"revert",
"=",
"false",
"\n\n",
"logger",
".",
"Debugf",
"(",
"\"",
"\\\"",
"\\\"",
"\\\"",
"\\\"",
"\"",
",",
"fingerprint",
",",
"s",
".",
"pool",
".",
"Name",
")",
"\n",
"return",
"nil",
"\n",
"}"
] |
2,532 | all-2533 | [
"WithContext",
"adds",
"the",
"context",
"to",
"the",
"put",
"apps",
"app",
"params"
] | [
"func",
"(",
"o",
"*",
"PutAppsAppParams",
")",
"WithContext",
"(",
"ctx",
"context",
".",
"<mask>",
")",
"*",
"PutAppsAppParams",
"{",
"o",
".",
"SetContext",
"(",
"ctx",
")",
"\n",
"return",
"o",
"\n",
"}"
] |
2,533 | all-2534 | [
"NewDecoderSize",
"creates",
"a",
"new",
"Decoder",
"using",
"a",
"type",
"Registry",
"a",
"max",
"size",
"and",
"an",
"io",
".",
"Reader",
"."
] | [
"func",
"NewDecoderSize",
"(",
"reg",
"Registry",
",",
"maxSize",
"uint64",
",",
"r",
"io",
".",
"Reader",
")",
"Decoder",
"{",
"var",
"buf",
"[",
"]",
"<mask>",
"\n",
"return",
"decoder",
"{",
"reg",
",",
"maxSize",
",",
"bytes",
".",
"NewBuffer",
"(",
"buf",
")",
",",
"bufio",
".",
"NewReader",
"(",
"r",
")",
"}",
"\n",
"}"
] |
2,534 | all-2535 | [
"RemoveIPAddr",
"removes",
"an",
"IP",
"address",
"from",
"Pinger",
".",
"ip",
"arg",
"should",
"be",
"a",
"net",
".",
"IPAddr",
"pointer",
"."
] | [
"func",
"(",
"p",
"*",
"Pinger",
")",
"RemoveIPAddr",
"(",
"<mask>",
"*",
"net",
".",
"IPAddr",
")",
"{",
"p",
".",
"mu",
".",
"Lock",
"(",
")",
"\n",
"delete",
"(",
"p",
".",
"addrs",
",",
"ip",
".",
"String",
"(",
")",
")",
"\n",
"p",
".",
"mu",
".",
"Unlock",
"(",
")",
"\n",
"}"
] |
2,535 | all-2536 | [
"Errm",
"executes",
"the",
"same",
"function",
"on",
"the",
"default",
"Base",
"instance"
] | [
"func",
"Errm",
"(",
"m",
"*",
"Attrs",
",",
"<mask>",
"string",
",",
"a",
"...",
"interface",
"{",
"}",
")",
"error",
"{",
"return",
"Errorm",
"(",
"m",
",",
"msg",
",",
"a",
"...",
")",
"\n",
"}"
] |
2,536 | all-2537 | [
"GetPageHeight",
"()",
"is",
"a",
"wrapper",
"around",
"gtk_page_setup_get_page_height",
"()",
"."
] | [
"func",
"(",
"<mask>",
"*",
"PageSetup",
")",
"GetPageHeight",
"(",
"unit",
"Unit",
")",
"float64",
"{",
"c",
":=",
"C",
".",
"gtk_page_setup_get_page_height",
"(",
"ps",
".",
"native",
"(",
")",
",",
"C",
".",
"GtkUnit",
"(",
"unit",
")",
")",
"\n",
"return",
"float64",
"(",
"c",
")",
"\n",
"}"
] |
2,537 | all-2538 | [
"Functions",
"dealing",
"with",
"storage",
"pools",
"."
] | [
"func",
"(",
"s",
"*",
"storageDir",
")",
"StoragePoolVolumeCreate",
"(",
")",
"error",
"{",
"logger",
".",
"Infof",
"(",
"\"",
"\\\"",
"\\\"",
"\\\"",
"\\\"",
"\"",
",",
"s",
".",
"volume",
".",
"Name",
",",
"s",
".",
"pool",
".",
"Name",
")",
"\n\n",
"_",
",",
"err",
":=",
"s",
".",
"StoragePoolMount",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"source",
":=",
"s",
".",
"pool",
".",
"Config",
"[",
"\"",
"\"",
"]",
"\n",
"if",
"<mask>",
"==",
"\"",
"\"",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\\\"",
"\\\"",
"\"",
")",
"\n",
"}",
"\n\n",
"isSnapshot",
":=",
"shared",
".",
"IsSnapshot",
"(",
"s",
".",
"volume",
".",
"Name",
")",
"\n\n",
"var",
"storageVolumePath",
"string",
"\n\n",
"if",
"isSnapshot",
"{",
"storageVolumePath",
"=",
"getStoragePoolVolumeSnapshotMountPoint",
"(",
"s",
".",
"pool",
".",
"Name",
",",
"s",
".",
"volume",
".",
"Name",
")",
"\n",
"}",
"else",
"{",
"storageVolumePath",
"=",
"getStoragePoolVolumeMountPoint",
"(",
"s",
".",
"pool",
".",
"Name",
",",
"s",
".",
"volume",
".",
"Name",
")",
"\n",
"}",
"\n\n",
"err",
"=",
"os",
".",
"MkdirAll",
"(",
"storageVolumePath",
",",
"0711",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"err",
"=",
"s",
".",
"initQuota",
"(",
"storageVolumePath",
",",
"s",
".",
"volumeID",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"logger",
".",
"Infof",
"(",
"\"",
"\\\"",
"\\\"",
"\\\"",
"\\\"",
"\"",
",",
"s",
".",
"volume",
".",
"Name",
",",
"s",
".",
"pool",
".",
"Name",
")",
"\n",
"return",
"nil",
"\n",
"}"
] |
2,538 | all-2539 | [
"bytesToHex",
"converts",
"a",
"slice",
"of",
"bytes",
"to",
"a",
"human",
"-",
"readable",
"string",
"."
] | [
"func",
"bytesToHex",
"(",
"b",
"[",
"]",
"byte",
")",
"string",
"{",
"hex",
":=",
"make",
"(",
"[",
"]",
"string",
",",
"len",
"(",
"b",
")",
")",
"\n",
"for",
"i",
",",
"ch",
":=",
"range",
"b",
"{",
"<mask>",
"[",
"i",
"]",
"=",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"ch",
")",
"\n",
"}",
"\n",
"return",
"strings",
".",
"Join",
"(",
"hex",
",",
"\"",
"\"",
")",
"\n",
"}"
] |
2,539 | all-2540 | [
"GetMarginOk",
"returns",
"a",
"tuple",
"with",
"the",
"Margin",
"field",
"if",
"it",
"s",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"and",
"a",
"boolean",
"to",
"check",
"if",
"the",
"value",
"has",
"been",
"set",
"."
] | [
"func",
"(",
"w",
"*",
"Widget",
")",
"GetMarginOk",
"(",
")",
"(",
"string",
",",
"bool",
")",
"{",
"if",
"w",
"==",
"nil",
"||",
"w",
".",
"Margin",
"==",
"nil",
"{",
"return",
"\"",
"\"",
",",
"false",
"\n",
"}",
"\n",
"return",
"*",
"w",
".",
"Margin",
",",
"<mask>",
"\n",
"}"
] |
2,540 | all-2541 | [
"ReadLines",
"emits",
"each",
"line",
"found",
"in",
"reader",
"."
] | [
"func",
"ReadLines",
"(",
"reader",
"io",
".",
"Reader",
")",
"Filter",
"{",
"return",
"FilterFunc",
"(",
"func",
"(",
"arg",
"Arg",
")",
"error",
"{",
"return",
"splitIntoLines",
"(",
"<mask>",
",",
"arg",
")",
"\n",
"}",
")",
"\n",
"}"
] |
2,541 | all-2542 | [
"parseIPv4Mask",
"parses",
"IPv4",
"netmask",
"written",
"in",
"IP",
"form",
"(",
"e",
".",
"g",
".",
"255",
".",
"255",
".",
"255",
".",
"0",
")",
".",
"This",
"function",
"should",
"really",
"belong",
"to",
"the",
"net",
"package",
"."
] | [
"func",
"parseIPv4Mask",
"(",
"s",
"string",
")",
"net",
".",
"IPMask",
"{",
"mask",
":=",
"net",
".",
"ParseIP",
"(",
"s",
")",
"\n",
"if",
"mask",
"==",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n",
"return",
"net",
".",
"IPv4Mask",
"(",
"mask",
"[",
"12",
"]",
",",
"mask",
"[",
"13",
"]",
",",
"<mask>",
"[",
"14",
"]",
",",
"mask",
"[",
"15",
"]",
")",
"\n",
"}"
] |
2,542 | all-2543 | [
"ProwJobClientset",
"returns",
"a",
"ProwJob",
"clientset",
"for",
"use",
"in",
"informer",
"factories",
"."
] | [
"func",
"(",
"o",
"*",
"ExperimentalKubernetesOptions",
")",
"ProwJobClientset",
"(",
"namespace",
"string",
",",
"dryRun",
"bool",
")",
"(",
"prowJobClientset",
"prow",
".",
"Interface",
",",
"err",
"error",
")",
"{",
"if",
"err",
":=",
"o",
".",
"resolve",
"(",
"dryRun",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"if",
"o",
".",
"dryRun",
"{",
"return",
"nil",
",",
"<mask>",
".",
"New",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"return",
"o",
".",
"prowJobClientset",
",",
"nil",
"\n",
"}"
] |
2,543 | all-2544 | [
"===",
"label_replace",
"(",
"Vector",
"ValueTypeVector",
"dst_label",
"replacement",
"src_labelname",
"regex",
"ValueTypeString",
")",
"Vector",
"==="
] | [
"func",
"funcLabelReplace",
"(",
"vals",
"[",
"]",
"Value",
",",
"args",
"Expressions",
",",
"enh",
"*",
"EvalNodeHelper",
")",
"Vector",
"{",
"var",
"(",
"vector",
"=",
"vals",
"[",
"0",
"]",
".",
"(",
"Vector",
")",
"\n",
"dst",
"=",
"args",
"[",
"1",
"]",
".",
"(",
"*",
"StringLiteral",
")",
".",
"Val",
"\n",
"repl",
"=",
"args",
"[",
"2",
"]",
".",
"(",
"*",
"StringLiteral",
")",
".",
"Val",
"\n",
"src",
"=",
"args",
"[",
"3",
"]",
".",
"(",
"*",
"StringLiteral",
")",
".",
"Val",
"\n",
"regexStr",
"=",
"args",
"[",
"4",
"]",
".",
"(",
"*",
"StringLiteral",
")",
".",
"Val",
"\n",
")",
"\n\n",
"if",
"enh",
".",
"regex",
"==",
"nil",
"{",
"var",
"err",
"error",
"\n",
"enh",
".",
"regex",
",",
"err",
"=",
"regexp",
".",
"Compile",
"(",
"\"",
"\"",
"+",
"regexStr",
"+",
"\"",
"\"",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"panic",
"(",
"errors",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"regexStr",
")",
")",
"\n",
"}",
"\n",
"if",
"!",
"model",
".",
"LabelNameRE",
".",
"MatchString",
"(",
"dst",
")",
"{",
"panic",
"(",
"errors",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"dst",
")",
")",
"\n",
"}",
"\n",
"enh",
".",
"dmn",
"=",
"make",
"(",
"map",
"[",
"uint64",
"]",
"labels",
".",
"Labels",
",",
"len",
"(",
"enh",
".",
"out",
")",
")",
"\n",
"}",
"\n\n",
"for",
"_",
",",
"el",
":=",
"range",
"vector",
"{",
"h",
":=",
"el",
".",
"Metric",
".",
"Hash",
"(",
")",
"\n",
"var",
"outMetric",
"labels",
".",
"Labels",
"\n",
"if",
"l",
",",
"ok",
":=",
"enh",
".",
"dmn",
"[",
"h",
"]",
";",
"<mask>",
"{",
"outMetric",
"=",
"l",
"\n",
"}",
"else",
"{",
"srcVal",
":=",
"el",
".",
"Metric",
".",
"Get",
"(",
"src",
")",
"\n",
"indexes",
":=",
"enh",
".",
"regex",
".",
"FindStringSubmatchIndex",
"(",
"srcVal",
")",
"\n",
"if",
"indexes",
"==",
"nil",
"{",
"// If there is no match, no replacement should take place.",
"outMetric",
"=",
"el",
".",
"Metric",
"\n",
"enh",
".",
"dmn",
"[",
"h",
"]",
"=",
"outMetric",
"\n",
"}",
"else",
"{",
"res",
":=",
"enh",
".",
"regex",
".",
"ExpandString",
"(",
"[",
"]",
"byte",
"{",
"}",
",",
"repl",
",",
"srcVal",
",",
"indexes",
")",
"\n\n",
"lb",
":=",
"labels",
".",
"NewBuilder",
"(",
"el",
".",
"Metric",
")",
".",
"Del",
"(",
"dst",
")",
"\n",
"if",
"len",
"(",
"res",
")",
">",
"0",
"{",
"lb",
".",
"Set",
"(",
"dst",
",",
"string",
"(",
"res",
")",
")",
"\n",
"}",
"\n",
"outMetric",
"=",
"lb",
".",
"Labels",
"(",
")",
"\n",
"enh",
".",
"dmn",
"[",
"h",
"]",
"=",
"outMetric",
"\n",
"}",
"\n",
"}",
"\n\n",
"enh",
".",
"out",
"=",
"append",
"(",
"enh",
".",
"out",
",",
"Sample",
"{",
"Metric",
":",
"outMetric",
",",
"Point",
":",
"Point",
"{",
"V",
":",
"el",
".",
"Point",
".",
"V",
"}",
",",
"}",
")",
"\n",
"}",
"\n",
"return",
"enh",
".",
"out",
"\n",
"}"
] |
2,544 | all-2545 | [
"performPeriodicReconciliation",
"is",
"used",
"to",
"periodically",
"invoke",
"the",
"reconciliation",
"process",
"based",
"on",
"a",
"ticker"
] | [
"func",
"(",
"udevWatcher",
"*",
"UdevWatcher",
")",
"performPeriodicReconciliation",
"(",
"updateInterval",
"<mask>",
".",
"Duration",
")",
"{",
"udevWatcher",
".",
"updateIntervalTicker",
"=",
"time",
".",
"NewTicker",
"(",
"updateInterval",
")",
"\n",
"for",
"{",
"select",
"{",
"case",
"<-",
"udevWatcher",
".",
"updateIntervalTicker",
".",
"C",
":",
"if",
"err",
":=",
"udevWatcher",
".",
"reconcileOnce",
"(",
")",
";",
"err",
"!=",
"nil",
"{",
"log",
".",
"Warnf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"}",
"\n",
"case",
"<-",
"udevWatcher",
".",
"ctx",
".",
"Done",
"(",
")",
":",
"udevWatcher",
".",
"updateIntervalTicker",
".",
"Stop",
"(",
")",
"\n",
"return",
"\n",
"}",
"\n",
"}",
"\n",
"}"
] |
2,545 | all-2546 | [
"GetStyleOk",
"returns",
"a",
"tuple",
"with",
"the",
"Style",
"field",
"if",
"it",
"s",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"and",
"a",
"boolean",
"to",
"check",
"if",
"the",
"value",
"has",
"been",
"set",
"."
] | [
"func",
"(",
"g",
"*",
"GraphDefinitionRequest",
")",
"GetStyleOk",
"(",
")",
"(",
"GraphDefinitionRequestStyle",
",",
"bool",
")",
"{",
"if",
"g",
"==",
"nil",
"||",
"g",
".",
"Style",
"==",
"nil",
"{",
"return",
"GraphDefinitionRequestStyle",
"{",
"}",
",",
"<mask>",
"\n",
"}",
"\n",
"return",
"*",
"g",
".",
"Style",
",",
"true",
"\n",
"}"
] |
2,546 | all-2547 | [
"title",
":",
"list",
"autoscale",
"history",
"path",
":",
"/",
"autoscale",
"method",
":",
"GET",
"produce",
":",
"application",
"/",
"json",
"responses",
":",
"200",
":",
"Ok",
"204",
":",
"No",
"content",
"401",
":",
"Unauthorized"
] | [
"func",
"autoScaleHistoryHandler",
"(",
"w",
"http",
".",
"ResponseWriter",
",",
"r",
"*",
"<mask>",
".",
"Request",
",",
"t",
"auth",
".",
"Token",
")",
"error",
"{",
"if",
"!",
"permission",
".",
"Check",
"(",
"t",
",",
"permission",
".",
"PermNodeAutoscale",
")",
"{",
"return",
"permission",
".",
"ErrUnauthorized",
"\n",
"}",
"\n",
"skip",
",",
"_",
":=",
"strconv",
".",
"Atoi",
"(",
"r",
".",
"URL",
".",
"Query",
"(",
")",
".",
"Get",
"(",
"\"",
"\"",
")",
")",
"\n",
"limit",
",",
"_",
":=",
"strconv",
".",
"Atoi",
"(",
"r",
".",
"URL",
".",
"Query",
"(",
")",
".",
"Get",
"(",
"\"",
"\"",
")",
")",
"\n",
"history",
",",
"err",
":=",
"autoscale",
".",
"ListAutoScaleEvents",
"(",
"skip",
",",
"limit",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"if",
"len",
"(",
"history",
")",
"==",
"0",
"{",
"w",
".",
"WriteHeader",
"(",
"http",
".",
"StatusNoContent",
")",
"\n",
"return",
"nil",
"\n",
"}",
"\n",
"w",
".",
"Header",
"(",
")",
".",
"Set",
"(",
"\"",
"\"",
",",
"\"",
"\"",
")",
"\n",
"return",
"json",
".",
"NewEncoder",
"(",
"w",
")",
".",
"Encode",
"(",
"&",
"history",
")",
"\n",
"}"
] |
2,547 | all-2548 | [
"Pause",
"pauses",
"the",
"peer",
".",
"The",
"peer",
"will",
"simply",
"drops",
"all",
"incoming",
"messages",
"without",
"returning",
"an",
"error",
"."
] | [
"func",
"(",
"p",
"*",
"peer",
")",
"Pause",
"(",
")",
"{",
"p",
".",
"mu",
".",
"Lock",
"(",
")",
"\n",
"defer",
"p",
".",
"mu",
".",
"Unlock",
"(",
")",
"\n",
"p",
".",
"paused",
"=",
"<mask>",
"\n",
"p",
".",
"msgAppReader",
".",
"pause",
"(",
")",
"\n",
"p",
".",
"msgAppV2Reader",
".",
"pause",
"(",
")",
"\n",
"}"
] |
2,548 | all-2549 | [
"SetTextDisplay",
"sets",
"which",
"part",
"of",
"the",
"title",
"is",
"displayed",
"in",
"case",
"of",
"the",
"title",
"is",
"longer",
"than",
"the",
"lable",
".",
"Only",
"AlignLeft",
"and",
"AlignRigth",
"are",
"valid",
"values",
"for",
"the",
"property",
".",
"Any",
"other",
"value",
"does",
"is",
"skipped",
"and",
"does",
"not",
"affect",
"displaying",
"the",
"title"
] | [
"func",
"(",
"l",
"*",
"Label",
")",
"SetTextDisplay",
"(",
"<mask>",
"Align",
")",
"{",
"if",
"align",
"!=",
"AlignLeft",
"&&",
"align",
"!=",
"AlignRight",
"{",
"return",
"\n",
"}",
"\n\n",
"l",
".",
"textDisplay",
"=",
"align",
"\n",
"}"
] |
2,549 | all-2550 | [
"MarshalJSON",
"calls",
"json",
".",
"RawMessage",
"method",
"of",
"the",
"same",
"name",
".",
"Required",
"since",
"LaunchSpecsResponse",
"is",
"of",
"type",
"json",
".",
"RawMessage",
"..."
] | [
"func",
"(",
"this",
"*",
"LaunchSpecsResponse",
")",
"MarshalJSON",
"(",
")",
"(",
"[",
"]",
"<mask>",
",",
"error",
")",
"{",
"x",
":=",
"json",
".",
"RawMessage",
"(",
"*",
"this",
")",
"\n",
"return",
"(",
"&",
"x",
")",
".",
"MarshalJSON",
"(",
")",
"\n",
"}"
] |
2,550 | all-2551 | [
"ResolveUpdate",
"is",
"invoked",
"when",
"dns",
"name",
"is",
"already",
"owned",
"by",
"current",
"endpoint",
"ResolveUpdate",
"uses",
"current",
"record",
"as",
"base",
"and",
"updates",
"it",
"accordingly",
"with",
"new",
"version",
"of",
"same",
"resource",
"if",
"it",
"doesn",
"t",
"exist",
"then",
"pick",
"min"
] | [
"func",
"(",
"s",
"PerResource",
")",
"ResolveUpdate",
"(",
"current",
"*",
"endpoint",
".",
"Endpoint",
",",
"candidates",
"[",
"]",
"*",
"endpoint",
".",
"Endpoint",
")",
"*",
"endpoint",
".",
"Endpoint",
"{",
"currentResource",
":=",
"current",
".",
"Labels",
"[",
"endpoint",
".",
"ResourceLabelKey",
"]",
"// resource which has already acquired the DNS",
"\n",
"// TODO: sort candidates only needed because we can still have two endpoints from same resource here. We sort for consistency",
"// TODO: remove once single endpoint can have multiple targets",
"<mask>",
".",
"SliceStable",
"(",
"candidates",
",",
"func",
"(",
"i",
",",
"j",
"int",
")",
"bool",
"{",
"return",
"s",
".",
"less",
"(",
"candidates",
"[",
"i",
"]",
",",
"candidates",
"[",
"j",
"]",
")",
"\n",
"}",
")",
"\n",
"for",
"_",
",",
"ep",
":=",
"range",
"candidates",
"{",
"if",
"ep",
".",
"Labels",
"[",
"endpoint",
".",
"ResourceLabelKey",
"]",
"==",
"currentResource",
"{",
"return",
"ep",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"s",
".",
"ResolveCreate",
"(",
"candidates",
")",
"\n",
"}"
] |
2,551 | all-2552 | [
"Config",
"safely",
"swaps",
"the",
"underlying",
"TLS",
"configuration",
"."
] | [
"func",
"(",
"l",
"*",
"networkListener",
")",
"Config",
"(",
"cert",
"*",
"<mask>",
".",
"CertInfo",
")",
"{",
"config",
":=",
"util",
".",
"ServerTLSConfig",
"(",
"cert",
")",
"\n\n",
"l",
".",
"mu",
".",
"Lock",
"(",
")",
"\n",
"defer",
"l",
".",
"mu",
".",
"Unlock",
"(",
")",
"\n\n",
"l",
".",
"config",
"=",
"config",
"\n",
"}"
] |
2,552 | all-2553 | [
"findIncludes",
"finds",
"and",
"adds",
"include",
"files",
"."
] | [
"func",
"findIncludes",
"(",
"data",
"[",
"]",
"byte",
",",
"opts",
"*",
"Options",
",",
"includes",
"*",
"[",
"]",
"*",
"File",
",",
"targetFile",
"*",
"File",
")",
"error",
"{",
"includePaths",
",",
"err",
":=",
"findIncludePaths",
"(",
"data",
",",
"opts",
",",
"targetFile",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"for",
"_",
",",
"includePath",
":=",
"range",
"includePaths",
"{",
"if",
"!",
"hasFile",
"(",
"*",
"includes",
",",
"includePath",
")",
"{",
"f",
",",
"err",
":=",
"readFile",
"(",
"includePath",
",",
"opts",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"*",
"includes",
"=",
"append",
"(",
"*",
"includes",
",",
"f",
")",
"\n\n",
"if",
"err",
":=",
"findIncludes",
"(",
"f",
".",
"data",
",",
"opts",
",",
"<mask>",
",",
"f",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n\n",
"return",
"nil",
"\n",
"}"
] |
2,553 | all-2554 | [
"New",
"mocks",
"base",
"method"
] | [
"func",
"(",
"m",
"*",
"MockCgroupFactory",
")",
"New",
"(",
"arg0",
"cgroups",
".",
"Hierarchy",
",",
"arg1",
"cgroups",
".",
"Path",
",",
"arg2",
"*",
"specs_go",
".",
"LinuxResources",
")",
"(",
"cgroups",
".",
"Cgroup",
",",
"error",
")",
"{",
"ret",
":=",
"m",
".",
"ctrl",
".",
"Call",
"(",
"m",
",",
"\"",
"\"",
",",
"arg0",
",",
"arg1",
",",
"arg2",
")",
"\n",
"ret0",
",",
"_",
":=",
"<mask>",
"[",
"0",
"]",
".",
"(",
"cgroups",
".",
"Cgroup",
")",
"\n",
"ret1",
",",
"_",
":=",
"ret",
"[",
"1",
"]",
".",
"(",
"error",
")",
"\n",
"return",
"ret0",
",",
"ret1",
"\n",
"}"
] |
2,554 | all-2555 | [
"UpdateServerGroup",
"updates",
"an",
"existing",
"server",
"groups",
"s",
"attributes",
".",
"Not",
"all",
"attributes",
"can",
"be",
"changed",
"(",
"such",
"as",
"Id",
")",
".",
"Specify",
"the",
"server",
"group",
"you",
"want",
"to",
"update",
"using",
"the",
"ServerGroupOptions",
"Id",
"field",
".",
"To",
"change",
"group",
"memberships",
"use",
"AddServersToServerGroup",
"RemoveServersFromServerGroup",
"and",
"MoveServersToServerGroup",
"."
] | [
"func",
"(",
"c",
"*",
"Client",
")",
"UpdateServerGroup",
"(",
"updateServerGroup",
"*",
"ServerGroupOptions",
")",
"(",
"*",
"ServerGroup",
",",
"error",
")",
"{",
"group",
":=",
"new",
"(",
"ServerGroup",
")",
"\n",
"_",
",",
"err",
":=",
"c",
".",
"MakeApiRequest",
"(",
"\"",
"\"",
",",
"\"",
"\"",
"+",
"updateServerGroup",
".",
"Id",
",",
"updateServerGroup",
",",
"&",
"group",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"return",
"<mask>",
",",
"nil",
"\n",
"}"
] |
2,555 | all-2556 | [
"AppArmorProfile",
"returns",
"the",
"current",
"apparmor",
"profile",
"."
] | [
"func",
"AppArmorProfile",
"(",
")",
"string",
"{",
"contents",
",",
"err",
":=",
"ioutil",
".",
"ReadFile",
"(",
"\"",
"\"",
")",
"\n",
"if",
"err",
"==",
"nil",
"{",
"return",
"strings",
".",
"TrimSpace",
"(",
"<mask>",
"(",
"contents",
")",
")",
"\n",
"}",
"\n\n",
"return",
"\"",
"\"",
"\n",
"}"
] |
2,556 | all-2557 | [
"Returns",
"the",
"handles",
"of",
"the",
"shader",
"objects",
"attached",
"to",
"a",
"program",
"object"
] | [
"func",
"GetAttachedShaders",
"(",
"program",
"uint32",
",",
"maxCount",
"int32",
",",
"count",
"*",
"int32",
",",
"shaders",
"*",
"uint32",
")",
"{",
"C",
".",
"glowGetAttachedShaders",
"(",
"gpGetAttachedShaders",
",",
"(",
"C",
".",
"GLuint",
")",
"(",
"<mask>",
")",
",",
"(",
"C",
".",
"GLsizei",
")",
"(",
"maxCount",
")",
",",
"(",
"*",
"C",
".",
"GLsizei",
")",
"(",
"unsafe",
".",
"Pointer",
"(",
"count",
")",
")",
",",
"(",
"*",
"C",
".",
"GLuint",
")",
"(",
"unsafe",
".",
"Pointer",
"(",
"shaders",
")",
")",
")",
"\n",
"}"
] |
2,557 | all-2558 | [
"copyBytes",
"copies",
"len",
"bytes",
"at",
"off",
"distance",
"from",
"the",
"end",
"to",
"the",
"end",
"of",
"the",
"window",
"."
] | [
"func",
"(",
"w",
"*",
"window",
")",
"copyBytes",
"(",
"len",
",",
"off",
"int",
")",
"{",
"len",
"&=",
"w",
".",
"<mask>",
"\n\n",
"n",
":=",
"w",
".",
"available",
"(",
")",
"\n",
"if",
"len",
">",
"n",
"{",
"// if there is not enough space availaible we copy",
"// as much as we can and save the offset and length",
"// of the remaining data to be copied later.",
"w",
".",
"l",
"=",
"len",
"-",
"n",
"\n",
"w",
".",
"o",
"=",
"off",
"\n",
"len",
"=",
"n",
"\n",
"}",
"\n\n",
"i",
":=",
"(",
"w",
".",
"w",
"-",
"off",
")",
"&",
"w",
".",
"mask",
"\n",
"for",
";",
"len",
">",
"0",
";",
"len",
"--",
"{",
"w",
".",
"buf",
"[",
"w",
".",
"w",
"]",
"=",
"w",
".",
"buf",
"[",
"i",
"]",
"\n",
"w",
".",
"w",
"=",
"(",
"w",
".",
"w",
"+",
"1",
")",
"&",
"w",
".",
"mask",
"\n",
"i",
"=",
"(",
"i",
"+",
"1",
")",
"&",
"w",
".",
"mask",
"\n",
"}",
"\n",
"}"
] |
2,558 | all-2559 | [
"NewOutgoingKickChatMember",
"creates",
"a",
"request",
"to",
"kick",
"a",
"member",
"from",
"a",
"group",
"chat",
"or",
"channel",
"."
] | [
"func",
"(",
"api",
"*",
"TelegramBotAPI",
")",
"NewOutgoingKickChatMember",
"(",
"chat",
"Recipient",
",",
"userID",
"int",
")",
"*",
"OutgoingKickChatMember",
"{",
"<mask>",
"&",
"OutgoingKickChatMember",
"{",
"api",
":",
"api",
",",
"Recipient",
":",
"chat",
",",
"UserID",
":",
"userID",
",",
"}",
"\n",
"}"
] |
2,559 | all-2560 | [
"collectFieldIndexes",
"returns",
"the",
"indexes",
"of",
"field",
"which",
"doesn",
"t",
"have",
"skip",
"tag",
"and",
"pk",
"tag",
"."
] | [
"func",
"(",
"db",
"*",
"DB",
")",
"collectFieldIndexes",
"(",
"typ",
"reflect",
".",
"Type",
",",
"index",
"[",
"]",
"int",
")",
"(",
"indexes",
"[",
"]",
"[",
"]",
"int",
")",
"{",
"for",
"i",
":=",
"0",
";",
"i",
"<",
"typ",
".",
"NumField",
"(",
")",
";",
"i",
"++",
"{",
"field",
":=",
"typ",
".",
"Field",
"(",
"i",
")",
"\n",
"if",
"IsUnexportedField",
"(",
"<mask>",
")",
"{",
"continue",
"\n",
"}",
"\n",
"if",
"!",
"(",
"db",
".",
"hasSkipTag",
"(",
"&",
"field",
")",
"||",
"(",
"db",
".",
"hasPKTag",
"(",
"&",
"field",
")",
"&&",
"db",
".",
"isAutoIncrementable",
"(",
"&",
"field",
")",
")",
")",
"{",
"tmp",
":=",
"make",
"(",
"[",
"]",
"int",
",",
"len",
"(",
"index",
")",
"+",
"1",
")",
"\n",
"copy",
"(",
"tmp",
",",
"index",
")",
"\n",
"tmp",
"[",
"len",
"(",
"tmp",
")",
"-",
"1",
"]",
"=",
"i",
"\n",
"if",
"field",
".",
"Anonymous",
"{",
"indexes",
"=",
"append",
"(",
"indexes",
",",
"db",
".",
"collectFieldIndexes",
"(",
"field",
".",
"Type",
",",
"tmp",
")",
"...",
")",
"\n",
"}",
"else",
"{",
"indexes",
"=",
"append",
"(",
"indexes",
",",
"tmp",
")",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"indexes",
"\n",
"}"
] |
2,560 | all-2561 | [
"checkPassword",
"calculates",
"if",
"a",
"password",
"is",
"correct",
"given",
"password",
"check",
"data",
"and",
"keys",
"."
] | [
"func",
"checkPassword",
"(",
"b",
"*",
"readBuf",
",",
"keys",
"[",
"]",
"[",
"]",
"byte",
")",
"error",
"{",
"if",
"len",
"(",
"*",
"b",
")",
"<",
"12",
"{",
"return",
"nil",
"// not enough bytes, ignore for the moment",
"\n",
"}",
"\n",
"pwcheck",
":=",
"b",
".",
"bytes",
"(",
"8",
")",
"\n",
"sum",
":=",
"b",
".",
"<mask>",
"(",
"4",
")",
"\n",
"csum",
":=",
"sha256",
".",
"Sum256",
"(",
"pwcheck",
")",
"\n",
"if",
"bytes",
".",
"Equal",
"(",
"sum",
",",
"csum",
"[",
":",
"len",
"(",
"sum",
")",
"]",
")",
"&&",
"!",
"bytes",
".",
"Equal",
"(",
"pwcheck",
",",
"keys",
"[",
"2",
"]",
")",
"{",
"return",
"errBadPassword",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
] |
2,561 | all-2562 | [
"isSetOperator",
"returns",
"whether",
"the",
"item",
"corresponds",
"to",
"a",
"set",
"operator",
"."
] | [
"func",
"(",
"i",
"ItemType",
")",
"isSetOperator",
"(",
")",
"bool",
"{",
"switch",
"i",
"{",
"<mask>",
"ItemLAND",
",",
"ItemLOR",
",",
"ItemLUnless",
":",
"return",
"true",
"\n",
"}",
"\n",
"return",
"false",
"\n",
"}"
] |
2,562 | all-2563 | [
"Ensure",
"that",
"the",
"container",
"s",
"policy",
"is",
"loaded",
"into",
"the",
"kernel",
"so",
"the",
"container",
"can",
"boot",
"."
] | [
"func",
"AALoadProfile",
"(",
"c",
"container",
")",
"error",
"{",
"state",
":=",
"c",
".",
"DaemonState",
"(",
")",
"\n",
"if",
"!",
"<mask>",
".",
"OS",
".",
"AppArmorAdmin",
"{",
"return",
"nil",
"\n",
"}",
"\n\n",
"if",
"err",
":=",
"mkApparmorNamespace",
"(",
"c",
",",
"AANamespace",
"(",
"c",
")",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"/* In order to avoid forcing a profile parse (potentially slow) on\n\t * every container start, let's use apparmor's binary policy cache,\n\t * which checks mtime of the files to figure out if the policy needs to\n\t * be regenerated.\n\t *\n\t * Since it uses mtimes, we shouldn't just always write out our local\n\t * apparmor template; instead we should check to see whether the\n\t * template is the same as ours. If it isn't we should write our\n\t * version out so that the new changes are reflected and we definitely\n\t * force a recompile.\n\t */",
"profile",
":=",
"path",
".",
"Join",
"(",
"aaPath",
",",
"\"",
"\"",
",",
"AAProfileShort",
"(",
"c",
")",
")",
"\n",
"content",
",",
"err",
":=",
"ioutil",
".",
"ReadFile",
"(",
"profile",
")",
"\n",
"if",
"err",
"!=",
"nil",
"&&",
"!",
"os",
".",
"IsNotExist",
"(",
"err",
")",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"updated",
":=",
"getAAProfileContent",
"(",
"c",
")",
"\n\n",
"if",
"string",
"(",
"content",
")",
"!=",
"string",
"(",
"updated",
")",
"{",
"if",
"err",
":=",
"os",
".",
"MkdirAll",
"(",
"path",
".",
"Join",
"(",
"aaPath",
",",
"\"",
"\"",
")",
",",
"0700",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"if",
"err",
":=",
"os",
".",
"MkdirAll",
"(",
"path",
".",
"Join",
"(",
"aaPath",
",",
"\"",
"\"",
")",
",",
"0700",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"if",
"err",
":=",
"ioutil",
".",
"WriteFile",
"(",
"profile",
",",
"[",
"]",
"byte",
"(",
"updated",
")",
",",
"0600",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"}",
"\n\n",
"return",
"runApparmor",
"(",
"APPARMOR_CMD_LOAD",
",",
"c",
")",
"\n",
"}"
] |
2,563 | all-2564 | [
"String",
"-",
"Ouput",
"table",
"as",
"a",
"string",
"."
] | [
"func",
"(",
"t",
"*",
"Table",
")",
"String",
"(",
"title",
"string",
")",
"string",
"{",
"tableString",
":=",
"[",
"]",
"string",
"{",
"}",
"\n\n",
"if",
"len",
"(",
"t",
".",
"Rows",
")",
"==",
"0",
"&&",
"t",
".",
"Footer",
"==",
"nil",
"{",
"return",
"\"",
"\"",
"\n",
"}",
"\n\n",
"tableString",
"=",
"append",
"(",
"tableString",
",",
"\"",
"\"",
"+",
"<mask>",
")",
"\n\n",
"t",
".",
"calculateSizes",
"(",
"t",
".",
"Footer",
")",
"\n\n",
"if",
"!",
"t",
".",
"Markdown",
"{",
"// t.printDash()",
"tableString",
"=",
"append",
"(",
"tableString",
",",
"t",
".",
"stringDash",
"(",
")",
")",
"\n",
"}",
"\n\n",
"if",
"!",
"t",
".",
"HideHead",
"{",
"tableString",
"=",
"append",
"(",
"tableString",
",",
"t",
".",
"getHead",
"(",
")",
")",
"\n",
"tableString",
"=",
"append",
"(",
"tableString",
",",
"t",
".",
"stringTableDash",
"(",
")",
")",
"\n",
"// fmt.Println(t.getHead())",
"// t.printTableDash()",
"}",
"\n\n",
"for",
"_",
",",
"r",
":=",
"range",
"t",
".",
"Rows",
"{",
"// fmt.Println(t.rowString(r))",
"tableString",
"=",
"append",
"(",
"tableString",
",",
"t",
".",
"rowString",
"(",
"r",
")",
")",
"\n",
"if",
"!",
"t",
".",
"Markdown",
"{",
"tableString",
"=",
"append",
"(",
"tableString",
",",
"t",
".",
"stringDash",
"(",
")",
")",
"\n",
"}",
"\n",
"}",
"\n\n",
"if",
"t",
".",
"Footer",
"!=",
"nil",
"{",
"tableString",
"=",
"append",
"(",
"tableString",
",",
"t",
".",
"stringTableDash",
"(",
")",
")",
"\n",
"tableString",
"=",
"append",
"(",
"tableString",
",",
"t",
".",
"rowString",
"(",
"t",
".",
"Footer",
")",
")",
"\n",
"if",
"!",
"t",
".",
"Markdown",
"{",
"tableString",
"=",
"append",
"(",
"tableString",
",",
"t",
".",
"stringDash",
"(",
")",
")",
"\n",
"}",
"\n",
"}",
"\n\n",
"return",
"strings",
".",
"Join",
"(",
"tableString",
"[",
":",
"]",
",",
"\"",
"\\n",
"\"",
")",
"\n",
"}"
] |
2,564 | all-2565 | [
"extractTag",
"extracts",
"and",
"returns",
"a",
"tag",
"."
] | [
"func",
"extractTagName",
"(",
"s",
"string",
")",
"<mask>",
"{",
"tagName",
":=",
"strings",
".",
"Split",
"(",
"strings",
".",
"Split",
"(",
"s",
",",
"sharp",
")",
"[",
"0",
"]",
",",
"dot",
")",
"[",
"0",
"]",
"\n\n",
"if",
"tagName",
"==",
"\"",
"\"",
"{",
"tagName",
"=",
"tagNameDiv",
"\n",
"}",
"\n\n",
"return",
"tagName",
"\n",
"}"
] |
2,565 | all-2566 | [
"SetFragmentTexture",
"sets",
"a",
"texture",
"for",
"the",
"fragment",
"function",
"at",
"an",
"index",
"in",
"the",
"texture",
"argument",
"table",
".",
"Reference",
":",
"https",
":",
"//",
"developer",
".",
"apple",
".",
"com",
"/",
"documentation",
"/",
"metal",
"/",
"mtlrendercommandencoder",
"/",
"1515390",
"-",
"setfragmenttexture"
] | [
"func",
"(",
"rce",
"RenderCommandEncoder",
")",
"SetFragmentTexture",
"(",
"texture",
"Texture",
",",
"<mask>",
"int",
")",
"{",
"C",
".",
"RenderCommandEncoder_SetFragmentTexture",
"(",
"rce",
".",
"commandEncoder",
",",
"texture",
".",
"texture",
",",
"C",
".",
"uint_t",
"(",
"index",
")",
")",
"\n",
"}"
] |
2,566 | all-2567 | [
"DeleteProject",
"adds",
"a",
"new",
"project",
"resource",
"to",
"RBAC",
"."
] | [
"func",
"(",
"r",
"*",
"Server",
")",
"DeleteProject",
"(",
"id",
"int64",
")",
"error",
"{",
"// Update RBAC",
"err",
":=",
"r",
".",
"postResources",
"(",
"nil",
",",
"[",
"]",
"string",
"{",
"strconv",
".",
"FormatInt",
"(",
"<mask>",
",",
"10",
")",
"}",
",",
"false",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"// Update project map",
"r",
".",
"resourcesLock",
".",
"Lock",
"(",
")",
"\n",
"for",
"k",
",",
"v",
":=",
"range",
"r",
".",
"resources",
"{",
"if",
"v",
"==",
"strconv",
".",
"FormatInt",
"(",
"id",
",",
"10",
")",
"{",
"delete",
"(",
"r",
".",
"resources",
",",
"k",
")",
"\n",
"break",
"\n",
"}",
"\n",
"}",
"\n",
"r",
".",
"resourcesLock",
".",
"Unlock",
"(",
")",
"\n\n",
"return",
"nil",
"\n",
"}"
] |
2,567 | all-2568 | [
"SetSelectedCol",
"changes",
"the",
"currently",
"selected",
"column",
".",
"If",
"column",
"is",
"greater",
"than",
"number",
"of",
"columns",
"the",
"last",
"column",
"is",
"selected",
".",
"Set",
"row",
"to",
"-",
"1",
"to",
"turn",
"off",
"selection",
".",
"The",
"table",
"scrolls",
"automatically",
"to",
"display",
"the",
"column"
] | [
"func",
"(",
"l",
"*",
"TableView",
")",
"SetSelectedCol",
"(",
"<mask>",
"int",
")",
"{",
"oldSelection",
":=",
"l",
".",
"selectedCol",
"\n",
"if",
"col",
">=",
"len",
"(",
"l",
".",
"columns",
")",
"{",
"l",
".",
"selectedCol",
"=",
"len",
"(",
"l",
".",
"columns",
")",
"-",
"1",
"\n",
"}",
"else",
"if",
"col",
"<",
"-",
"1",
"{",
"l",
".",
"selectedCol",
"=",
"-",
"1",
"\n",
"}",
"\n\n",
"if",
"l",
".",
"selectedCol",
"!=",
"oldSelection",
"{",
"l",
".",
"EnsureColVisible",
"(",
")",
"\n",
"l",
".",
"emitSelectionChange",
"(",
")",
"\n",
"}",
"\n",
"}"
] |
2,568 | all-2569 | [
"IntegrityCheck",
"returns",
"two",
"values",
"the",
"base",
"OTP",
"and",
"the",
"current",
"counter",
".",
"This",
"is",
"used",
"for",
"example",
"with",
"the",
"Google",
"Authenticator",
"app",
"s",
"Check",
"key",
"value",
"function",
"and",
"can",
"be",
"used",
"to",
"verify",
"that",
"the",
"application",
"and",
"the",
"provider",
"are",
"in",
"sync",
"."
] | [
"func",
"(",
"otp",
"*",
"HOTP",
")",
"IntegrityCheck",
"(",
")",
"(",
"string",
",",
"uint64",
")",
"{",
"h",
":=",
"hmac",
".",
"New",
"(",
"sha1",
".",
"New",
",",
"otp",
".",
"Key",
")",
"\n",
"counter",
":=",
"make",
"(",
"[",
"]",
"byte",
",",
"8",
")",
"\n",
"h",
".",
"Write",
"(",
"counter",
")",
"\n",
"hash",
":=",
"h",
".",
"Sum",
"(",
"nil",
")",
"\n",
"result",
":=",
"truncate",
"(",
"hash",
")",
"\n\n",
"mod",
":=",
"new",
"(",
"big",
".",
"Int",
")",
".",
"Exp",
"(",
"big",
".",
"NewInt",
"(",
"10",
")",
",",
"big",
".",
"NewInt",
"(",
"int64",
"(",
"otp",
".",
"Digits",
")",
")",
",",
"nil",
")",
"\n",
"mod",
"=",
"<mask>",
".",
"Mod",
"(",
"big",
".",
"NewInt",
"(",
"result",
")",
",",
"mod",
")",
"\n",
"fmtStr",
":=",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"otp",
".",
"Digits",
")",
"\n",
"return",
"fmt",
".",
"Sprintf",
"(",
"fmtStr",
",",
"mod",
".",
"Uint64",
"(",
")",
")",
",",
"otp",
".",
"Counter",
"(",
")",
"\n",
"}"
] |
2,569 | all-2570 | [
"NewMockECRSDK",
"creates",
"a",
"new",
"mock",
"instance"
] | [
"func",
"NewMockECRSDK",
"(",
"ctrl",
"*",
"gomock",
".",
"<mask>",
")",
"*",
"MockECRSDK",
"{",
"mock",
":=",
"&",
"MockECRSDK",
"{",
"ctrl",
":",
"ctrl",
"}",
"\n",
"mock",
".",
"recorder",
"=",
"&",
"MockECRSDKMockRecorder",
"{",
"mock",
"}",
"\n",
"return",
"mock",
"\n",
"}"
] |
2,570 | all-2571 | [
"UnmarshalJSON",
"supports",
"json",
".",
"Unmarshaler",
"interface"
] | [
"func",
"(",
"v",
"*",
"GetInstallabilityErrorsParams",
")",
"UnmarshalJSON",
"(",
"<mask>",
"[",
"]",
"byte",
")",
"error",
"{",
"r",
":=",
"jlexer",
".",
"Lexer",
"{",
"Data",
":",
"data",
"}",
"\n",
"easyjsonC5a4559bDecodeGithubComChromedpCdprotoPage39",
"(",
"&",
"r",
",",
"v",
")",
"\n",
"return",
"r",
".",
"Error",
"(",
")",
"\n",
"}"
] |
2,571 | all-2572 | [
"SetPathBytes",
"sets",
"URI",
"path",
"."
] | [
"func",
"(",
"u",
"*",
"URI",
")",
"SetPathBytes",
"(",
"<mask>",
"[",
"]",
"byte",
")",
"{",
"u",
".",
"pathOriginal",
"=",
"append",
"(",
"u",
".",
"pathOriginal",
"[",
":",
"0",
"]",
",",
"path",
"...",
")",
"\n",
"u",
".",
"path",
"=",
"normalizePath",
"(",
"u",
".",
"path",
",",
"u",
".",
"pathOriginal",
")",
"\n",
"}"
] |
2,572 | all-2573 | [
"Create",
"mocks",
"base",
"method"
] | [
"func",
"(",
"m",
"*",
"MockManager",
")",
"Create",
"(",
"arg0",
"*",
"container",
".",
"Config",
",",
"arg1",
"*",
"container",
".",
"HostConfig",
",",
"arg2",
"*",
"task",
".",
"Task",
",",
"arg3",
"string",
")",
"error",
"{",
"<mask>",
":=",
"m",
".",
"ctrl",
".",
"Call",
"(",
"m",
",",
"\"",
"\"",
",",
"arg0",
",",
"arg1",
",",
"arg2",
",",
"arg3",
")",
"\n",
"ret0",
",",
"_",
":=",
"ret",
"[",
"0",
"]",
".",
"(",
"error",
")",
"\n",
"return",
"ret0",
"\n",
"}"
] |
2,573 | all-2574 | [
"Result",
"reads",
"response",
"result",
"data",
"into",
"given",
"object",
".",
"Object",
"should",
"be",
"passed",
"by",
"reference",
"."
] | [
"func",
"(",
"ctx",
"*",
"ResCtx",
")",
"Result",
"(",
"v",
"interface",
"{",
"}",
")",
"error",
"{",
"if",
"!",
"ctx",
".",
"Success",
"{",
"return",
"errors",
".",
"New",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"if",
"ctx",
".",
"result",
"==",
"nil",
"{",
"return",
"<mask>",
".",
"New",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"if",
"err",
":=",
"json",
".",
"Unmarshal",
"(",
"ctx",
".",
"result",
",",
"v",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
] |
2,574 | all-2575 | [
"GetPrivateImage",
"isn",
"t",
"relevant",
"for",
"the",
"simplestreams",
"protocol"
] | [
"func",
"(",
"r",
"*",
"ProtocolSimpleStreams",
")",
"GetPrivateImage",
"(",
"fingerprint",
"string",
",",
"secret",
"string",
")",
"(",
"*",
"api",
".",
"<mask>",
",",
"string",
",",
"error",
")",
"{",
"return",
"nil",
",",
"\"",
"\"",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
")",
"\n",
"}"
] |
2,575 | all-2576 | [
"GdkAtomIntern",
"is",
"a",
"wrapper",
"around",
"gdk_atom_intern"
] | [
"func",
"GdkAtomIntern",
"(",
"atomName",
"string",
",",
"onlyIfExists",
"bool",
")",
"Atom",
"{",
"cstr",
":=",
"C",
".",
"CString",
"(",
"atomName",
")",
"\n",
"defer",
"C",
".",
"<mask>",
"(",
"unsafe",
".",
"Pointer",
"(",
"cstr",
")",
")",
"\n",
"c",
":=",
"C",
".",
"gdk_atom_intern",
"(",
"(",
"*",
"C",
".",
"gchar",
")",
"(",
"cstr",
")",
",",
"gbool",
"(",
"onlyIfExists",
")",
")",
"\n",
"return",
"Atom",
"(",
"uintptr",
"(",
"unsafe",
".",
"Pointer",
"(",
"c",
")",
")",
")",
"\n",
"}"
] |
2,576 | all-2577 | [
"removeLegacyGoRepository",
"removes",
"loads",
"of",
"go_repository",
"from"
] | [
"func",
"removeLegacyGoRepository",
"(",
"f",
"*",
"rule",
".",
"File",
")",
"{",
"for",
"_",
",",
"l",
":=",
"<mask>",
"f",
".",
"Loads",
"{",
"if",
"l",
".",
"Name",
"(",
")",
"==",
"\"",
"\"",
"{",
"l",
".",
"Remove",
"(",
"\"",
"\"",
")",
"\n",
"if",
"l",
".",
"IsEmpty",
"(",
")",
"{",
"l",
".",
"Delete",
"(",
")",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n",
"}"
] |
2,577 | all-2578 | [
"Encrypt",
"returns",
"encrypted",
"bytes",
"from",
"the",
"inpu",
"data"
] | [
"func",
"(",
"pk",
"*",
"RsaPublicKey",
")",
"Encrypt",
"(",
"b",
"[",
"]",
"byte",
")",
"(",
"[",
"]",
"<mask>",
",",
"error",
")",
"{",
"return",
"rsa",
".",
"EncryptPKCS1v15",
"(",
"rand",
".",
"Reader",
",",
"pk",
".",
"k",
",",
"b",
")",
"\n",
"}"
] |
2,578 | all-2579 | [
"MutateTransaction",
"for",
"Network",
"sets",
"the",
"Network",
"ID",
"to",
"use",
"when",
"signing",
"this",
"transaction"
] | [
"func",
"(",
"m",
"Network",
")",
"MutateTransaction",
"(",
"o",
"*",
"TransactionBuilder",
")",
"error",
"{",
"o",
".",
"NetworkID",
"=",
"m",
".",
"<mask>",
"(",
")",
"\n",
"return",
"nil",
"\n",
"}"
] |
2,579 | all-2580 | [
"enqueueKey",
"schedules",
"an",
"item",
"for",
"reconciliation"
] | [
"func",
"(",
"c",
"*",
"controller",
")",
"enqueueKey",
"(",
"ctx",
"string",
",",
"obj",
"interface",
"{",
"}",
")",
"{",
"switch",
"o",
":=",
"obj",
".",
"(",
"<mask>",
")",
"{",
"case",
"*",
"prowjobv1",
".",
"ProwJob",
":",
"ns",
":=",
"o",
".",
"Spec",
".",
"Namespace",
"\n",
"if",
"ns",
"==",
"\"",
"\"",
"{",
"ns",
"=",
"o",
".",
"Namespace",
"\n",
"}",
"\n",
"c",
".",
"workqueue",
".",
"AddRateLimited",
"(",
"toKey",
"(",
"ctx",
",",
"ns",
",",
"o",
".",
"Name",
")",
")",
"\n",
"case",
"*",
"pipelinev1alpha1",
".",
"PipelineRun",
":",
"c",
".",
"workqueue",
".",
"AddRateLimited",
"(",
"toKey",
"(",
"ctx",
",",
"o",
".",
"Namespace",
",",
"o",
".",
"Name",
")",
")",
"\n",
"default",
":",
"logrus",
".",
"Warnf",
"(",
"\"",
"\"",
",",
"o",
",",
"obj",
")",
"\n",
"return",
"\n",
"}",
"\n",
"}"
] |
2,580 | all-2581 | [
"/",
"*",
"GtkGrid",
"RemoveRow",
"()",
"is",
"a",
"wrapper",
"around",
"gtk_grid_remove_row",
"()",
"."
] | [
"func",
"(",
"v",
"*",
"Grid",
")",
"RemoveRow",
"(",
"position",
"int",
")",
"{",
"C",
".",
"gtk_grid_remove_row",
"(",
"v",
".",
"native",
"(",
")",
",",
"C",
".",
"gint",
"(",
"<mask>",
")",
")",
"\n",
"}"
] |
2,581 | all-2582 | [
"WithVersion",
"mocks",
"base",
"method"
] | [
"func",
"(",
"m",
"*",
"MockDockerClient",
")",
"WithVersion",
"(",
"arg0",
"dockerclient",
".",
"DockerVersion",
")",
"dockerapi",
".",
"DockerClient",
"{",
"<mask>",
":=",
"m",
".",
"ctrl",
".",
"Call",
"(",
"m",
",",
"\"",
"\"",
",",
"arg0",
")",
"\n",
"ret0",
",",
"_",
":=",
"ret",
"[",
"0",
"]",
".",
"(",
"dockerapi",
".",
"DockerClient",
")",
"\n",
"return",
"ret0",
"\n",
"}"
] |
2,582 | all-2583 | [
"EncodeUvarint",
"is",
"used",
"to",
"encode",
"golang",
"s",
"int",
"int32",
"int64",
"by",
"default",
".",
"unless",
"specified",
"differently",
"by",
"the",
"binary",
":",
"fixed32",
"binary",
":",
"fixed64",
"or",
"binary",
":",
"zigzag32",
"binary",
":",
"zigzag64",
"tags",
".",
"It",
"matches",
"protobufs",
"varint",
"encoding",
"."
] | [
"func",
"EncodeUvarint",
"(",
"w",
"<mask>",
".",
"Writer",
",",
"u",
"uint64",
")",
"(",
"err",
"error",
")",
"{",
"var",
"buf",
"[",
"10",
"]",
"byte",
"\n",
"n",
":=",
"binary",
".",
"PutUvarint",
"(",
"buf",
"[",
":",
"]",
",",
"u",
")",
"\n",
"_",
",",
"err",
"=",
"w",
".",
"Write",
"(",
"buf",
"[",
"0",
":",
"n",
"]",
")",
"\n",
"return",
"\n",
"}"
] |
2,583 | all-2584 | [
"MarshalJSON",
"supports",
"json",
".",
"Marshaler",
"interface"
] | [
"func",
"(",
"v",
"Layer",
")",
"MarshalJSON",
"(",
")",
"(",
"[",
"]",
"<mask>",
",",
"error",
")",
"{",
"w",
":=",
"jwriter",
".",
"Writer",
"{",
"}",
"\n",
"easyjsonC5a4559bEncodeGithubComChromedpCdprotoLayertree14",
"(",
"&",
"w",
",",
"v",
")",
"\n",
"return",
"w",
".",
"Buffer",
".",
"BuildBytes",
"(",
")",
",",
"w",
".",
"Error",
"\n",
"}"
] |
2,584 | all-2585 | [
"INTEGER",
"checkInteger",
"returns",
"nil",
"if",
"the",
"given",
"bytes",
"are",
"a",
"valid",
"DER",
"-",
"encoded",
"INTEGER",
"and",
"an",
"error",
"otherwise",
"."
] | [
"func",
"checkInteger",
"(",
"bytes",
"[",
"]",
"byte",
")",
"error",
"{",
"if",
"len",
"(",
"bytes",
")",
"==",
"0",
"{",
"return",
"asn1",
".",
"StructuralError",
"{",
"Msg",
":",
"\"",
"\"",
"}",
"\n",
"}",
"\n",
"if",
"len",
"(",
"bytes",
")",
"==",
"1",
"{",
"return",
"nil",
"\n",
"}",
"\n",
"if",
"(",
"bytes",
"[",
"0",
"]",
"==",
"0",
"&&",
"<mask>",
"[",
"1",
"]",
"&",
"0x80",
"==",
"0",
")",
"||",
"(",
"bytes",
"[",
"0",
"]",
"==",
"0xff",
"&&",
"bytes",
"[",
"1",
"]",
"&",
"0x80",
"==",
"0x80",
")",
"{",
"return",
"asn1",
".",
"StructuralError",
"{",
"Msg",
":",
"\"",
"\"",
"}",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
] |
2,585 | all-2586 | [
"InitTextTemplates",
"initialzes",
"a",
"series",
"of",
"plain",
"text",
"templates",
"in",
"the",
"directory",
"pattern",
"."
] | [
"func",
"InitTextTemplates",
"(",
"pattern",
"string",
")",
"(",
"err",
"error",
")",
"{",
"textTemp",
".",
"Template",
",",
"err",
"=",
"<mask>",
".",
"ParseGlob",
"(",
"pattern",
")",
"\n",
"return",
"nil",
"\n",
"}"
] |
2,586 | all-2587 | [
"WriteTo",
"writes",
"data",
"to",
"w",
"."
] | [
"func",
"(",
"e",
"*",
"helperMethodDoctype",
")",
"WriteTo",
"(",
"w",
"<mask>",
".",
"Writer",
")",
"(",
"int64",
",",
"error",
")",
"{",
"i",
",",
"err",
":=",
"w",
".",
"Write",
"(",
"[",
"]",
"byte",
"(",
"doctypes",
"[",
"e",
".",
"doctype",
"]",
")",
")",
"\n",
"return",
"int64",
"(",
"i",
")",
",",
"err",
"\n",
"}"
] |
2,587 | all-2588 | [
"title",
":",
"add",
"event",
"block",
"path",
":",
"/",
"events",
"/",
"blocks",
"method",
":",
"POST",
"consume",
":",
"application",
"/",
"x",
"-",
"www",
"-",
"form",
"-",
"urlencoded",
"responses",
":",
"200",
":",
"OK",
"400",
":",
"Invalid",
"data",
"or",
"empty",
"reason",
"401",
":",
"Unauthorized"
] | [
"func",
"eventBlockAdd",
"(",
"w",
"http",
".",
"ResponseWriter",
",",
"r",
"*",
"http",
".",
"Request",
",",
"t",
"auth",
".",
"Token",
")",
"(",
"err",
"error",
")",
"{",
"if",
"!",
"permission",
".",
"Check",
"(",
"t",
",",
"permission",
".",
"PermEventBlockAdd",
")",
"{",
"return",
"permission",
".",
"ErrUnauthorized",
"\n",
"}",
"\n",
"var",
"block",
"event",
".",
"Block",
"\n",
"err",
"=",
"ParseInput",
"(",
"r",
",",
"&",
"block",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"if",
"block",
".",
"Reason",
"==",
"\"",
"\"",
"{",
"return",
"&",
"errors",
".",
"HTTP",
"{",
"Code",
":",
"http",
".",
"StatusBadRequest",
",",
"Message",
":",
"\"",
"\"",
"}",
"\n",
"}",
"\n",
"evt",
",",
"err",
":=",
"event",
".",
"New",
"(",
"&",
"event",
".",
"Opts",
"{",
"Target",
":",
"event",
".",
"Target",
"{",
"Type",
":",
"event",
".",
"TargetTypeEventBlock",
"}",
",",
"Kind",
":",
"permission",
".",
"PermEventBlockAdd",
",",
"Owner",
":",
"t",
",",
"CustomData",
":",
"<mask>",
".",
"FormToCustomData",
"(",
"InputFields",
"(",
"r",
")",
")",
",",
"Allowed",
":",
"event",
".",
"Allowed",
"(",
"permission",
".",
"PermEventBlockReadEvents",
")",
",",
"}",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"defer",
"func",
"(",
")",
"{",
"evt",
".",
"Target",
".",
"Value",
"=",
"block",
".",
"ID",
".",
"Hex",
"(",
")",
"\n",
"evt",
".",
"Done",
"(",
"err",
")",
"\n",
"}",
"(",
")",
"\n",
"return",
"event",
".",
"AddBlock",
"(",
"&",
"block",
")",
"\n",
"}"
] |
2,588 | all-2589 | [
"MarshalJSON",
"serializes",
"this",
"row",
"result",
"."
] | [
"func",
"(",
"b",
"RowResult",
")",
"MarshalJSON",
"(",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"columns",
":=",
"b",
".",
"Columns",
"\n",
"if",
"columns",
"==",
"nil",
"{",
"columns",
"=",
"[",
"]",
"uint64",
"{",
"}",
"\n",
"}",
"\n",
"keys",
":=",
"b",
".",
"Keys",
"\n",
"if",
"<mask>",
"==",
"nil",
"{",
"keys",
"=",
"[",
"]",
"string",
"{",
"}",
"\n",
"}",
"\n",
"return",
"json",
".",
"Marshal",
"(",
"struct",
"{",
"Attributes",
"map",
"[",
"string",
"]",
"interface",
"{",
"}",
"`json:\"attrs\"`",
"\n",
"Columns",
"[",
"]",
"uint64",
"`json:\"columns\"`",
"\n",
"Keys",
"[",
"]",
"string",
"`json:\"keys\"`",
"\n",
"}",
"{",
"Attributes",
":",
"b",
".",
"Attributes",
",",
"Columns",
":",
"columns",
",",
"Keys",
":",
"keys",
",",
"}",
")",
"\n",
"}"
] |
2,589 | all-2590 | [
"convertENIToCNIConfig",
"converts",
"input",
"eni",
"config",
"into",
"cni",
"config"
] | [
"func",
"convertENIToCNIConfig",
"(",
"eni",
"*",
"apieni",
".",
"ENI",
",",
"cfg",
"*",
"ecscni",
".",
"Config",
")",
"{",
"cfg",
".",
"ENIID",
"=",
"eni",
".",
"ID",
"\n",
"cfg",
".",
"ID",
"=",
"eni",
".",
"MacAddress",
"\n",
"cfg",
".",
"ENIMACAddress",
"=",
"eni",
".",
"MacAddress",
"\n",
"cfg",
".",
"SubnetGatewayIPV4Address",
"=",
"eni",
".",
"GetSubnetGatewayIPV4Address",
"(",
")",
"\n",
"for",
"_",
",",
"ipv4",
":=",
"range",
"eni",
".",
"IPV4Addresses",
"{",
"if",
"ipv4",
".",
"Primary",
"{",
"cfg",
".",
"ENIIPV4Address",
"=",
"ipv4",
".",
"Address",
"\n",
"break",
"\n",
"}",
"\n",
"}",
"\n",
"// If there is ipv6 assigned to eni then set it",
"if",
"len",
"(",
"eni",
".",
"IPV6Addresses",
")",
">",
"0",
"{",
"cfg",
".",
"ENIIPV6Address",
"=",
"eni",
".",
"IPV6Addresses",
"[",
"0",
"]",
".",
"<mask>",
"\n",
"}",
"\n",
"}"
] |
2,590 | all-2591 | [
"NewClient",
"creates",
"a",
"new",
"client",
"instance"
] | [
"func",
"NewClient",
"(",
"addrs",
"[",
"]",
"string",
",",
"config",
"*",
"Config",
")",
"(",
"*",
"Client",
",",
"error",
")",
"{",
"if",
"config",
"==",
"nil",
"{",
"config",
"=",
"NewConfig",
"(",
")",
"\n",
"}",
"\n\n",
"if",
"err",
":=",
"config",
".",
"Validate",
"(",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"client",
",",
"err",
":=",
"sarama",
".",
"NewClient",
"(",
"addrs",
",",
"&",
"config",
".",
"Config",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"return",
"&",
"Client",
"{",
"Client",
":",
"<mask>",
",",
"config",
":",
"*",
"config",
"}",
",",
"nil",
"\n",
"}"
] |
2,591 | all-2592 | [
"ensures",
"we",
"are",
"in",
"bounds",
"."
] | [
"func",
"(",
"c",
"*",
"Cursor",
")",
"correctPosition",
"(",
")",
"{",
"if",
"c",
".",
"Position",
">",
"len",
"(",
"c",
".",
"<mask>",
")",
"{",
"c",
".",
"Position",
"=",
"len",
"(",
"c",
".",
"input",
")",
"\n",
"}",
"\n\n",
"if",
"c",
".",
"Position",
"<",
"0",
"{",
"c",
".",
"Position",
"=",
"0",
"\n",
"}",
"\n",
"}"
] |
2,592 | all-2593 | [
"uploads",
"a",
"part",
"checking",
"the",
"etag",
"against",
"the",
"calculated",
"value"
] | [
"func",
"(",
"lo",
"*",
"largeObject",
")",
"putPart",
"(",
"part",
"*",
"part",
")",
"error",
"{",
"container",
":=",
"lo",
".",
"container",
"\n",
"objectName",
":=",
"lo",
".",
"objectName",
"+",
"\"",
"\"",
"+",
"lo",
".",
"timestamp",
"+",
"\"",
"\"",
"+",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"part",
".",
"PartNumber",
")",
"\n\n",
"lo",
".",
"logger",
".",
"Debug",
"(",
"swiftLargeObjectLogTag",
",",
"\"",
"\"",
",",
"container",
",",
"objectName",
",",
"part",
".",
"len",
",",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"part",
".",
"contentMd5",
")",
",",
"part",
".",
"ETag",
",",
"\"",
"\"",
")",
"\n\n",
"if",
"_",
",",
"err",
":=",
"part",
".",
"r",
".",
"Seek",
"(",
"0",
",",
"0",
")",
";",
"err",
"!=",
"nil",
"{",
"// move back to beginning, if retrying",
"return",
"err",
"\n",
"}",
"\n\n",
"headers",
",",
"err",
":=",
"lo",
".",
"c",
".",
"ObjectPut",
"(",
"container",
",",
"objectName",
",",
"<mask>",
".",
"r",
",",
"true",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"nil",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"s",
":=",
"headers",
"[",
"\"",
"\"",
"]",
"\n",
"if",
"part",
".",
"ETag",
"!=",
"s",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"s",
",",
"part",
".",
"ETag",
")",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
] |
2,593 | all-2594 | [
"WithBudget",
"if",
"set",
"after",
"this",
"many",
"virtual",
"milliseconds",
"have",
"elapsed",
"virtual",
"time",
"will",
"be",
"paused",
"and",
"a",
"virtualTimeBudgetExpired",
"event",
"is",
"sent",
"."
] | [
"func",
"(",
"p",
"SetVirtualTimePolicyParams",
")",
"WithBudget",
"(",
"budget",
"float64",
")",
"*",
"SetVirtualTimePolicyParams",
"{",
"p",
".",
"Budget",
"=",
"budget",
"\n",
"<mask>",
"&",
"p",
"\n",
"}"
] |
2,594 | all-2595 | [
"UnmarshalJSON",
"unmarshals",
"VolumeResource",
"object",
"using",
"duplicate",
"struct",
"VolumeResourceJSON"
] | [
"func",
"(",
"vol",
"*",
"VolumeResource",
")",
"UnmarshalJSON",
"(",
"b",
"[",
"]",
"byte",
")",
"error",
"{",
"temp",
":=",
"&",
"volumeResourceJSON",
"{",
"}",
"\n\n",
"if",
"err",
":=",
"json",
".",
"Unmarshal",
"(",
"b",
",",
"&",
"temp",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"vol",
".",
"Name",
"=",
"temp",
".",
"Name",
"\n",
"vol",
".",
"VolumeConfig",
"=",
"temp",
".",
"VolumeConfig",
"\n",
"if",
"temp",
".",
"DesiredStatus",
"!=",
"nil",
"{",
"vol",
".",
"SetDesiredStatus",
"(",
"resourcestatus",
".",
"ResourceStatus",
"(",
"*",
"temp",
".",
"DesiredStatus",
")",
")",
"\n",
"}",
"\n",
"if",
"temp",
".",
"KnownStatus",
"!=",
"nil",
"{",
"vol",
".",
"SetKnownStatus",
"(",
"resourcestatus",
".",
"ResourceStatus",
"(",
"*",
"<mask>",
".",
"KnownStatus",
")",
")",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
] |
2,595 | all-2596 | [
"Set",
"implements",
"Set",
"()",
"of",
"opentracing",
".",
"TextMapWriter"
] | [
"func",
"(",
"c",
"tracingHeadersCarrier",
")",
"Set",
"(",
"key",
",",
"val",
"string",
")",
"{",
"prefixedKey",
":=",
"tracingKeyEncoding",
".",
"mapAndCache",
"(",
"<mask>",
")",
"\n",
"c",
"[",
"prefixedKey",
"]",
"=",
"val",
"\n",
"}"
] |
2,596 | all-2597 | [
"Printf",
"records",
"the",
"log",
"with",
"trace",
"level"
] | [
"func",
"Printf",
"(",
"<mask>",
"string",
",",
"args",
"...",
"interface",
"{",
"}",
")",
"{",
"logger",
".",
"Output",
"(",
"2",
",",
"LevelTrace",
",",
"fmt",
".",
"Sprintf",
"(",
"format",
",",
"args",
"...",
")",
")",
"\n",
"}"
] |
2,597 | all-2598 | [
"MustCreateAccountOp",
"retrieves",
"the",
"CreateAccountOp",
"value",
"from",
"the",
"union",
"panicing",
"if",
"the",
"value",
"is",
"not",
"set",
"."
] | [
"func",
"(",
"u",
"OperationBody",
")",
"MustCreateAccountOp",
"(",
")",
"CreateAccountOp",
"{",
"val",
",",
"ok",
":=",
"u",
".",
"GetCreateAccountOp",
"(",
")",
"\n\n",
"if",
"!",
"<mask>",
"{",
"panic",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"return",
"val",
"\n",
"}"
] |
2,598 | all-2599 | [
"ErrorData",
"reads",
"the",
"error",
"response",
"data",
"into",
"given",
"object",
".",
"Object",
"should",
"be",
"passed",
"by",
"reference",
"."
] | [
"func",
"(",
"ctx",
"*",
"ResCtx",
")",
"ErrorData",
"(",
"v",
"<mask>",
"{",
"}",
")",
"error",
"{",
"if",
"ctx",
".",
"Success",
"{",
"return",
"errors",
".",
"New",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"if",
"ctx",
".",
"errorData",
"==",
"nil",
"{",
"return",
"errors",
".",
"New",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"if",
"err",
":=",
"json",
".",
"Unmarshal",
"(",
"ctx",
".",
"errorData",
",",
"v",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
] |
2,599 | all-2600 | [
"Wrap",
"returns",
"a",
"handler",
"which",
"records",
"the",
"number",
"of",
"requests",
"received",
"and",
"responses",
"sent",
"to",
"the",
"given",
"handler",
"as",
"well",
"as",
"latency",
"quantiles",
"for",
"responses",
"over",
"a",
"five",
"-",
"minute",
"window",
".",
"These",
"counters",
"are",
"published",
"as",
"the",
"following",
"metrics",
":",
"HTTP",
".",
"Requests",
"HTTP",
".",
"Responses",
"HTTP",
".",
"Latency",
".",
"{",
"P50",
"P75",
"P90",
"P95",
"P99",
"P999",
"}",
"By",
"tracking",
"incoming",
"requests",
"and",
"outgoing",
"responses",
"one",
"can",
"monitor",
"not",
"only",
"the",
"requests",
"per",
"second",
"but",
"also",
"the",
"number",
"of",
"requests",
"being",
"processed",
"at",
"any",
"given",
"point",
"in",
"time",
"."
] | [
"func",
"Wrap",
"(",
"h",
"http",
".",
"Handler",
")",
"http",
".",
"Handler",
"{",
"return",
"http",
".",
"HandlerFunc",
"(",
"func",
"(",
"w",
"<mask>",
".",
"ResponseWriter",
",",
"r",
"*",
"http",
".",
"Request",
")",
"{",
"requests",
".",
"Add",
"(",
")",
"// inc requests",
"\n",
"defer",
"responses",
".",
"Add",
"(",
")",
"// inc responses when we're done",
"\n",
"defer",
"recordLatency",
"(",
"time",
".",
"Now",
"(",
")",
")",
"// record latency when we're done",
"\n\n",
"h",
".",
"ServeHTTP",
"(",
"w",
",",
"r",
")",
"\n",
"}",
")",
"\n",
"}"
] |
Subsets and Splits
No saved queries yet
Save your SQL queries to embed, download, and access them later. Queries will appear here once saved.