id
int32 0
25.3k
| idx
stringlengths 5
9
| nl_tokens
sequencelengths 1
418
| pl_tokens
sequencelengths 22
4.98k
|
---|---|---|---|
8,600 | all-8601 | [
"TransferLeader",
"tries",
"to",
"transfer",
"leadership",
"to",
"the",
"given",
"transferee",
"."
] | [
"func",
"(",
"rn",
"*",
"RawNode",
")",
"TransferLeader",
"(",
"transferee",
"uint64",
")",
"{",
"_",
"=",
"rn",
".",
"raft",
".",
"Step",
"(",
"pb",
".",
"<mask>",
"{",
"Type",
":",
"pb",
".",
"MsgTransferLeader",
",",
"From",
":",
"transferee",
"}",
")",
"\n",
"}"
] |
8,601 | all-8602 | [
"SaveToPdfFile",
"creates",
"and",
"saves",
"a",
"pdf",
"document",
"to",
"a",
"file"
] | [
"func",
"SaveToPdfFile",
"(",
"filePath",
"<mask>",
",",
"pdf",
"*",
"gofpdf",
".",
"Fpdf",
")",
"error",
"{",
"return",
"pdf",
".",
"OutputFileAndClose",
"(",
"filePath",
")",
"\n",
"}"
] |
8,602 | all-8603 | [
"Validate",
"ensures",
"that",
"the",
"set",
"of",
"options",
"are",
"self",
"-",
"consistent",
"and",
"valid"
] | [
"func",
"(",
"o",
"*",
"Options",
")",
"Validate",
"(",
")",
"error",
"{",
"if",
"o",
".",
"NumWorkers",
"==",
"0",
"{",
"return",
"<mask>",
".",
"New",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"if",
"o",
".",
"ProwJobNamespace",
"==",
"\"",
"\"",
"{",
"return",
"errors",
".",
"New",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"return",
"o",
".",
"Options",
".",
"Validate",
"(",
")",
"\n",
"}"
] |
8,603 | all-8604 | [
"NewZookeeperTreeCache",
"creates",
"a",
"new",
"ZookeeperTreeCache",
"for",
"a",
"given",
"path",
"."
] | [
"func",
"NewZookeeperTreeCache",
"(",
"conn",
"*",
"zk",
".",
"Conn",
",",
"path",
"string",
",",
"events",
"chan",
"ZookeeperTreeCacheEvent",
",",
"logger",
"<mask>",
".",
"Logger",
")",
"*",
"ZookeeperTreeCache",
"{",
"tc",
":=",
"&",
"ZookeeperTreeCache",
"{",
"conn",
":",
"conn",
",",
"prefix",
":",
"path",
",",
"events",
":",
"events",
",",
"stop",
":",
"make",
"(",
"chan",
"struct",
"{",
"}",
")",
",",
"logger",
":",
"logger",
",",
"}",
"\n",
"tc",
".",
"head",
"=",
"&",
"zookeeperTreeCacheNode",
"{",
"events",
":",
"make",
"(",
"chan",
"zk",
".",
"Event",
")",
",",
"children",
":",
"map",
"[",
"string",
"]",
"*",
"zookeeperTreeCacheNode",
"{",
"}",
",",
"stopped",
":",
"true",
",",
"}",
"\n",
"go",
"tc",
".",
"loop",
"(",
"path",
")",
"\n",
"return",
"tc",
"\n",
"}"
] |
8,604 | all-8605 | [
"Append",
"is",
"a",
"wrapper",
"around",
"g_list_append",
"()",
"."
] | [
"func",
"(",
"v",
"*",
"<mask>",
")",
"Append",
"(",
"data",
"uintptr",
")",
"*",
"List",
"{",
"glist",
":=",
"C",
".",
"g_list_append",
"(",
"v",
".",
"native",
"(",
")",
",",
"C",
".",
"gpointer",
"(",
"data",
")",
")",
"\n",
"return",
"v",
".",
"wrapNewHead",
"(",
"glist",
")",
"\n",
"}"
] |
8,605 | all-8606 | [
"Create",
"a",
"new",
"blocking",
"pool",
".",
"As",
"no",
"new",
"connections",
"would",
"be",
"made",
"when",
"the",
"pool",
"is",
"busy",
"the",
"number",
"of",
"connections",
"of",
"the",
"pool",
"is",
"kept",
"no",
"more",
"than",
"initCap",
"and",
"maxCap",
"does",
"not",
"make",
"sense",
"but",
"the",
"api",
"is",
"reserved",
".",
"The",
"timeout",
"to",
"block",
"Get",
"()",
"is",
"set",
"to",
"3",
"by",
"default",
"concerning",
"that",
"it",
"is",
"better",
"to",
"be",
"related",
"with",
"Get",
"()",
"method",
"."
] | [
"func",
"NewBlockingPool",
"(",
"initCap",
",",
"maxCap",
"int",
",",
"livetime",
"<mask>",
".",
"Duration",
",",
"factory",
"Factory",
")",
"(",
"Pool",
",",
"error",
")",
"{",
"if",
"initCap",
"<",
"0",
"||",
"maxCap",
"<",
"1",
"||",
"initCap",
">",
"maxCap",
"{",
"return",
"nil",
",",
"errors",
".",
"New",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"newPool",
":=",
"&",
"blockingPool",
"{",
"timeout",
":",
"3",
",",
"conns",
":",
"make",
"(",
"chan",
"*",
"WrappedConn",
",",
"maxCap",
")",
",",
"factory",
":",
"factory",
",",
"livetime",
":",
"livetime",
",",
"}",
"\n\n",
"for",
"i",
":=",
"0",
";",
"i",
"<",
"initCap",
";",
"i",
"++",
"{",
"newPool",
".",
"conns",
"<-",
"newPool",
".",
"wrap",
"(",
"nil",
")",
"\n",
"}",
"\n",
"return",
"newPool",
",",
"nil",
"\n",
"}"
] |
8,606 | all-8607 | [
"SetReader",
"sets",
"the",
"io",
".",
"Reader",
"source",
"for",
"a",
"lob",
"field",
"to",
"be",
"written",
"to",
"database",
"and",
"return",
"*",
"Lob",
"to",
"enable",
"simple",
"call",
"chaining",
"."
] | [
"func",
"(",
"l",
"*",
"Lob",
")",
"SetReader",
"(",
"rd",
"<mask>",
".",
"Reader",
")",
"*",
"Lob",
"{",
"l",
".",
"rd",
"=",
"rd",
"\n",
"return",
"l",
"\n",
"}"
] |
8,607 | all-8608 | [
"SetColor",
"sets",
"the",
"color",
"to",
"paint",
"the",
"spans",
"."
] | [
"func",
"(",
"p",
"*",
"Painter",
")",
"SetColor",
"(",
"c",
"color",
".",
"<mask>",
")",
"{",
"r",
",",
"g",
",",
"b",
",",
"a",
":=",
"c",
".",
"RGBA",
"(",
")",
"\n",
"if",
"a",
"==",
"0",
"{",
"p",
".",
"cr",
"=",
"0",
"\n",
"p",
".",
"cg",
"=",
"0",
"\n",
"p",
".",
"cb",
"=",
"0",
"\n",
"p",
".",
"ca",
"=",
"a",
"\n",
"}",
"else",
"{",
"p",
".",
"cr",
"=",
"uint8",
"(",
"(",
"r",
"*",
"M16",
"/",
"a",
")",
">>",
"8",
")",
"\n",
"p",
".",
"cg",
"=",
"uint8",
"(",
"(",
"g",
"*",
"M16",
"/",
"a",
")",
">>",
"8",
")",
"\n",
"p",
".",
"cb",
"=",
"uint8",
"(",
"(",
"b",
"*",
"M16",
"/",
"a",
")",
">>",
"8",
")",
"\n",
"p",
".",
"ca",
"=",
"a",
"\n",
"}",
"\n",
"}"
] |
8,608 | all-8609 | [
"MutateOperation",
"for",
"SourceAccount",
"sets",
"the",
"operation",
"s",
"SourceAccount",
"to",
"the",
"pubilic",
"key",
"for",
"the",
"address",
"provided"
] | [
"func",
"(",
"m",
"SourceAccount",
")",
"MutateOperation",
"(",
"o",
"*",
"xdr",
".",
"<mask>",
")",
"error",
"{",
"o",
".",
"SourceAccount",
"=",
"&",
"xdr",
".",
"AccountId",
"{",
"}",
"\n",
"return",
"setAccountId",
"(",
"m",
".",
"AddressOrSeed",
",",
"o",
".",
"SourceAccount",
")",
"\n",
"}"
] |
8,609 | all-8610 | [
"CommentM",
"inserts",
"the",
"comment",
"character",
"in",
"lines",
"that",
"mach",
"any",
"regular",
"expression",
"in",
"reLine",
"in",
"the",
"named",
"file",
"."
] | [
"func",
"CommentM",
"(",
"filename",
"string",
",",
"reLine",
"[",
"]",
"string",
")",
"error",
"{",
"e",
",",
"err",
":=",
"NewEdit",
"(",
"filename",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"err",
"=",
"e",
".",
"<mask>",
"(",
"reLine",
")",
"\n",
"err2",
":=",
"e",
".",
"Close",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"return",
"err2",
"\n",
"}"
] |
8,610 | all-8611 | [
"Register",
"a",
"function",
"table",
".",
"name",
"equivalent",
"to",
"ProxyIpairs",
"that",
"uses",
"ipairs",
"when",
"__ipairs",
"is",
"not",
"present",
".",
"This",
"is",
"much",
"faster",
"than",
"ProxyIpairs",
"."
] | [
"func",
"RegProxyIpairs",
"(",
"L",
"*",
"lua",
".",
"State",
",",
"table",
",",
"name",
"string",
")",
"{",
"L",
".",
"GetGlobal",
"(",
"\"",
"\"",
")",
"\n",
"ref",
":=",
"L",
".",
"Ref",
"(",
"lua",
".",
"LUA_REGISTRYINDEX",
")",
"\n\n",
"f",
":=",
"func",
"(",
"L",
"*",
"lua",
".",
"State",
")",
"int",
"{",
"// See Lua >=5.2 source code.",
"if",
"L",
".",
"GetMetaField",
"(",
"1",
",",
"\"",
"\"",
")",
"{",
"L",
".",
"PushValue",
"(",
"1",
")",
"\n",
"L",
".",
"Call",
"(",
"1",
",",
"3",
")",
"\n",
"return",
"3",
"\n",
"}",
"\n",
"L",
".",
"RawGeti",
"(",
"lua",
".",
"LUA_REGISTRYINDEX",
",",
"<mask>",
")",
"\n",
"L",
".",
"PushValue",
"(",
"1",
")",
"\n",
"L",
".",
"Call",
"(",
"1",
",",
"3",
")",
"\n",
"return",
"3",
"\n",
"}",
"\n\n",
"Register",
"(",
"L",
",",
"table",
",",
"Map",
"{",
"name",
":",
"f",
",",
"}",
")",
"\n",
"}"
] |
8,611 | all-8612 | [
"Capitalize",
"uppercases",
"the",
"first",
"char",
"of",
"s",
"and",
"lowercases",
"the",
"rest",
"."
] | [
"func",
"Capitalize",
"(",
"s",
"string",
")",
"<mask>",
"{",
"return",
"strings",
".",
"ToUpper",
"(",
"s",
"[",
"0",
":",
"1",
"]",
")",
"+",
"strings",
".",
"ToLower",
"(",
"s",
"[",
"1",
":",
"]",
")",
"\n",
"}"
] |
8,612 | all-8613 | [
"digitVal",
"returns",
"the",
"digit",
"value",
"of",
"a",
"rune",
"or",
"16",
"in",
"case",
"the",
"rune",
"does",
"not",
"represent",
"a",
"valid",
"digit",
"."
] | [
"func",
"digitVal",
"(",
"ch",
"rune",
")",
"int",
"{",
"switch",
"{",
"<mask>",
"'0'",
"<=",
"ch",
"&&",
"ch",
"<=",
"'9'",
":",
"return",
"int",
"(",
"ch",
"-",
"'0'",
")",
"\n",
"case",
"'a'",
"<=",
"ch",
"&&",
"ch",
"<=",
"'f'",
":",
"return",
"int",
"(",
"ch",
"-",
"'a'",
"+",
"10",
")",
"\n",
"case",
"'A'",
"<=",
"ch",
"&&",
"ch",
"<=",
"'F'",
":",
"return",
"int",
"(",
"ch",
"-",
"'A'",
"+",
"10",
")",
"\n",
"}",
"\n",
"return",
"16",
"// Larger than any legal digit val.",
"\n",
"}"
] |
8,613 | all-8614 | [
"IsAssignee",
"checks",
"if",
"a",
"user",
"is",
"assigned",
"to",
"the",
"issue",
"."
] | [
"func",
"(",
"i",
"Issue",
")",
"IsAssignee",
"(",
"login",
"string",
")",
"bool",
"{",
"for",
"_",
",",
"assignee",
":=",
"range",
"i",
".",
"Assignees",
"{",
"if",
"NormLogin",
"(",
"login",
")",
"==",
"NormLogin",
"(",
"assignee",
".",
"Login",
")",
"{",
"return",
"true",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"<mask>",
"\n",
"}"
] |
8,614 | all-8615 | [
"Specify",
"the",
"value",
"of",
"a",
"uniform",
"variable",
"for",
"the",
"current",
"program",
"object"
] | [
"func",
"Uniform2f",
"(",
"location",
"int32",
",",
"v0",
"float32",
",",
"v1",
"float32",
")",
"{",
"C",
".",
"glowUniform2f",
"(",
"gpUniform2f",
",",
"(",
"C",
".",
"GLint",
")",
"(",
"<mask>",
")",
",",
"(",
"C",
".",
"GLfloat",
")",
"(",
"v0",
")",
",",
"(",
"C",
".",
"GLfloat",
")",
"(",
"v1",
")",
")",
"\n",
"}"
] |
8,615 | all-8616 | [
"handlerFunc",
"returns",
"a",
"function",
"to",
"enqueue",
"requests",
"onto",
"attachENIHandler",
"buffer"
] | [
"func",
"(",
"attachENIHandler",
"*",
"attachENIHandler",
")",
"handlerFunc",
"(",
")",
"func",
"(",
"<mask>",
"*",
"ecsacs",
".",
"AttachTaskNetworkInterfacesMessage",
")",
"{",
"return",
"func",
"(",
"message",
"*",
"ecsacs",
".",
"AttachTaskNetworkInterfacesMessage",
")",
"{",
"attachENIHandler",
".",
"messageBuffer",
"<-",
"message",
"\n",
"}",
"\n",
"}"
] |
8,616 | all-8617 | [
"BuildCgroupRoot",
"helps",
"build",
"the",
"task",
"cgroup",
"prefix",
"Example",
":",
"/",
"ecs",
"/",
"task",
"-",
"id"
] | [
"func",
"(",
"task",
"*",
"Task",
")",
"BuildCgroupRoot",
"(",
")",
"(",
"string",
",",
"error",
")",
"{",
"taskID",
",",
"err",
":=",
"<mask>",
".",
"GetID",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"\"",
"\"",
",",
"errors",
".",
"Wrapf",
"(",
"err",
",",
"\"",
"\"",
",",
"task",
".",
"Arn",
")",
"\n",
"}",
"\n\n",
"return",
"filepath",
".",
"Join",
"(",
"config",
".",
"DefaultTaskCgroupPrefix",
",",
"taskID",
")",
",",
"nil",
"\n",
"}"
] |
8,617 | all-8618 | [
"bind",
"a",
"buffer",
"object",
"to",
"a",
"transform",
"feedback",
"buffer",
"object"
] | [
"func",
"TransformFeedbackBufferBase",
"(",
"xfb",
"uint32",
",",
"index",
"uint32",
",",
"buffer",
"uint32",
")",
"{",
"C",
".",
"glowTransformFeedbackBufferBase",
"(",
"gpTransformFeedbackBufferBase",
",",
"(",
"C",
".",
"GLuint",
")",
"(",
"xfb",
")",
",",
"(",
"C",
".",
"GLuint",
")",
"(",
"index",
")",
",",
"(",
"C",
".",
"GLuint",
")",
"(",
"<mask>",
")",
")",
"\n",
"}"
] |
8,618 | all-8619 | [
"define",
"the",
"scissor",
"box"
] | [
"func",
"Scissor",
"(",
"x",
"int32",
",",
"y",
"int32",
",",
"width",
"int32",
",",
"height",
"int32",
")",
"{",
"syscall",
".",
"Syscall6",
"(",
"gpScissor",
",",
"4",
",",
"uintptr",
"(",
"x",
")",
",",
"uintptr",
"(",
"y",
")",
",",
"uintptr",
"(",
"width",
")",
",",
"uintptr",
"(",
"<mask>",
")",
",",
"0",
",",
"0",
")",
"\n",
"}"
] |
8,619 | all-8620 | [
"Validate",
"returns",
"an",
"error",
"if",
"the",
"provided",
"checksum",
"does",
"not",
"match",
"the",
"calculated",
"checksum",
"of",
"the",
"provided",
"data"
] | [
"func",
"Validate",
"(",
"data",
"[",
"]",
"byte",
",",
"expected",
"[",
"]",
"byte",
")",
"error",
"{",
"actual",
":=",
"Checksum",
"(",
"data",
")",
"\n\n",
"// validate the provided checksum against the calculated",
"if",
"!",
"bytes",
".",
"Equal",
"(",
"<mask>",
",",
"expected",
")",
"{",
"return",
"ErrInvalidChecksum",
"\n",
"}",
"\n\n",
"return",
"nil",
"\n",
"}"
] |
8,620 | all-8621 | [
"AddHost",
"adds",
"a",
"host",
"to",
"the",
"cluster",
"."
] | [
"func",
"(",
"c",
"*",
"Cluster",
")",
"AddHost",
"(",
"<mask>",
"*",
"URI",
")",
"{",
"c",
".",
"mutex",
".",
"Lock",
"(",
")",
"\n",
"defer",
"c",
".",
"mutex",
".",
"Unlock",
"(",
")",
"\n",
"c",
".",
"hosts",
"=",
"append",
"(",
"c",
".",
"hosts",
",",
"address",
")",
"\n",
"c",
".",
"okList",
"=",
"append",
"(",
"c",
".",
"okList",
",",
"true",
")",
"\n",
"}"
] |
8,621 | all-8622 | [
"export",
"FrameSet_String"
] | [
"func",
"FrameSet_String",
"(",
"id",
"FrameSetId",
")",
"(",
"str",
"*",
"C",
".",
"char",
")",
"{",
"<mask>",
",",
"ok",
":=",
"sFrameSets",
".",
"Get",
"(",
"id",
")",
"\n",
"if",
"!",
"ok",
"{",
"str",
"=",
"C",
".",
"CString",
"(",
"\"",
"\"",
")",
"\n",
"}",
"else",
"{",
"str",
"=",
"C",
".",
"CString",
"(",
"fs",
".",
"String",
"(",
")",
")",
"\n",
"}",
"\n",
"// CString is freed by caller",
"return",
"str",
"\n",
"}"
] |
8,622 | all-8623 | [
"RemoveItem",
"deletes",
"an",
"item",
"which",
"number",
"is",
"id",
"in",
"item",
"list",
"Returns",
"true",
"if",
"item",
"is",
"deleted"
] | [
"func",
"(",
"l",
"*",
"ListBox",
")",
"RemoveItem",
"(",
"id",
"int",
")",
"bool",
"{",
"if",
"id",
"<",
"0",
"||",
"<mask>",
">=",
"len",
"(",
"l",
".",
"items",
")",
"{",
"return",
"false",
"\n",
"}",
"\n\n",
"l",
".",
"items",
"=",
"append",
"(",
"l",
".",
"items",
"[",
":",
"id",
"]",
",",
"l",
".",
"items",
"[",
"id",
"+",
"1",
":",
"]",
"...",
")",
"\n",
"return",
"true",
"\n",
"}"
] |
8,623 | all-8624 | [
"Get",
"fetches",
"the",
"data",
"found",
"in",
"the",
"provided",
"path",
".",
"It",
"returns",
"the",
"content",
"of",
"the",
"response",
"or",
"any",
"errors",
"that",
"occurred",
"during",
"the",
"request",
"or",
"http",
"errors",
"."
] | [
"func",
"(",
"c",
"*",
"Client",
")",
"Get",
"(",
"path",
"string",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"resp",
",",
"err",
":=",
"c",
".",
"<mask>",
"(",
"http",
".",
"MethodGet",
",",
"path",
",",
"nil",
",",
"true",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"return",
"readResp",
"(",
"resp",
")",
"\n",
"}"
] |
8,624 | all-8625 | [
"writeAsFits",
"writes",
"as",
"many",
"bytes",
"from",
"the",
"given",
"slice",
"as",
"fits",
"into",
"the",
"chunk"
] | [
"func",
"(",
"c",
"*",
"writableChunk",
")",
"writeAsFits",
"(",
"b",
"[",
"]",
"byte",
")",
"int",
"{",
"if",
"len",
"(",
"b",
")",
">",
"c",
".",
"contents",
".",
"BytesRemaining",
"(",
")",
"{",
"b",
"=",
"b",
"[",
":",
"c",
".",
"contents",
".",
"BytesRemaining",
"(",
")",
"]",
"\n",
"}",
"\n\n",
"c",
".",
"checksum",
".",
"Add",
"(",
"b",
")",
"\n",
"c",
".",
"contents",
".",
"WriteBytes",
"(",
"b",
")",
"\n\n",
"written",
":=",
"len",
"(",
"b",
")",
"\n",
"c",
".",
"<mask>",
"+=",
"uint16",
"(",
"written",
")",
"\n",
"return",
"written",
"\n",
"}"
] |
8,625 | all-8626 | [
"FetchCheckBundleMetrics",
"retrieves",
"metrics",
"for",
"the",
"check",
"bundle",
"with",
"passed",
"cid",
"."
] | [
"func",
"(",
"a",
"*",
"API",
")",
"FetchCheckBundleMetrics",
"(",
"cid",
"CIDType",
")",
"(",
"*",
"CheckBundleMetrics",
",",
"error",
")",
"{",
"if",
"cid",
"==",
"nil",
"||",
"*",
"cid",
"==",
"\"",
"\"",
"{",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"metricsCID",
":=",
"string",
"(",
"*",
"cid",
")",
"\n\n",
"matched",
",",
"err",
":=",
"regexp",
".",
"MatchString",
"(",
"config",
".",
"CheckBundleMetricsCIDRegex",
",",
"metricsCID",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"if",
"!",
"<mask>",
"{",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"metricsCID",
")",
"\n",
"}",
"\n\n",
"result",
",",
"err",
":=",
"a",
".",
"Get",
"(",
"metricsCID",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"if",
"a",
".",
"Debug",
"{",
"a",
".",
"Log",
".",
"Printf",
"(",
"\"",
"\"",
",",
"string",
"(",
"result",
")",
")",
"\n",
"}",
"\n\n",
"metrics",
":=",
"&",
"CheckBundleMetrics",
"{",
"}",
"\n",
"if",
"err",
":=",
"json",
".",
"Unmarshal",
"(",
"result",
",",
"metrics",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"return",
"metrics",
",",
"nil",
"\n",
"}"
] |
8,626 | all-8627 | [
"Output",
"runs",
"the",
"command",
"and",
"returns",
"its",
"standard",
"output",
".",
"Any",
"returned",
"error",
"will",
"usually",
"be",
"of",
"type",
"*",
"ExitError",
".",
"If",
"c",
".",
"Stderr",
"was",
"nil",
"Output",
"populates",
"ExitError",
".",
"Stderr",
"."
] | [
"func",
"(",
"c",
"*",
"Cmd",
")",
"Output",
"(",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"if",
"c",
".",
"Stdout",
"!=",
"nil",
"{",
"return",
"nil",
",",
"errors",
".",
"New",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"var",
"stdout",
"<mask>",
".",
"Buffer",
"\n",
"c",
".",
"Stdout",
"=",
"&",
"stdout",
"\n\n",
"captureErr",
":=",
"c",
".",
"Stderr",
"==",
"nil",
"\n",
"if",
"captureErr",
"{",
"c",
".",
"Stderr",
"=",
"&",
"prefixSuffixSaver",
"{",
"N",
":",
"32",
"<<",
"10",
"}",
"\n",
"}",
"\n\n",
"err",
":=",
"c",
".",
"Run",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"&&",
"captureErr",
"{",
"if",
"ee",
",",
"ok",
":=",
"err",
".",
"(",
"*",
"ExitError",
")",
";",
"ok",
"{",
"ee",
".",
"Stderr",
"=",
"c",
".",
"Stderr",
".",
"(",
"*",
"prefixSuffixSaver",
")",
".",
"Bytes",
"(",
")",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"stdout",
".",
"Bytes",
"(",
")",
",",
"err",
"\n",
"}"
] |
8,627 | all-8628 | [
"Specify",
"the",
"value",
"of",
"a",
"uniform",
"variable",
"for",
"the",
"current",
"program",
"object"
] | [
"func",
"Uniform2f",
"(",
"location",
"int32",
",",
"v0",
"float32",
",",
"v1",
"float32",
")",
"{",
"syscall",
".",
"Syscall",
"(",
"gpUniform2f",
",",
"3",
",",
"uintptr",
"(",
"<mask>",
")",
",",
"uintptr",
"(",
"math",
".",
"Float32bits",
"(",
"v0",
")",
")",
",",
"uintptr",
"(",
"math",
".",
"Float32bits",
"(",
"v1",
")",
")",
")",
"\n",
"}"
] |
8,628 | all-8629 | [
"DeserializeDBHashTree",
"deserializes",
"a",
"hashtree",
"into",
"a",
"database",
"(",
"bolt",
")",
"backed",
"hashtree",
"."
] | [
"func",
"DeserializeDBHashTree",
"(",
"storageRoot",
"string",
",",
"r",
"io",
".",
"Reader",
")",
"(",
"_",
"HashTree",
",",
"retErr",
"error",
")",
"{",
"result",
",",
"err",
":=",
"NewDBHashTree",
"(",
"storageRoot",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"if",
"err",
":=",
"result",
".",
"Deserialize",
"(",
"r",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"return",
"<mask>",
",",
"nil",
"\n",
"}"
] |
8,629 | all-8630 | [
"GetOverride",
"returns",
"the",
"Override",
"field",
"if",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"."
] | [
"func",
"(",
"h",
"*",
"HostActionMute",
")",
"GetOverride",
"(",
")",
"bool",
"{",
"if",
"h",
"==",
"nil",
"||",
"h",
".",
"Override",
"==",
"nil",
"{",
"return",
"<mask>",
"\n",
"}",
"\n",
"return",
"*",
"h",
".",
"Override",
"\n",
"}"
] |
8,630 | all-8631 | [
"FromItem",
"implements",
"Object",
"interface"
] | [
"func",
"(",
"in",
"*",
"ResourceObject",
")",
"FromItem",
"(",
"i",
"common",
".",
"Item",
")",
"{",
"r",
",",
"err",
":=",
"<mask>",
".",
"ItemToResource",
"(",
"i",
")",
"\n",
"if",
"err",
"==",
"nil",
"{",
"in",
".",
"fromResource",
"(",
"r",
")",
"\n",
"}",
"\n",
"}"
] |
8,631 | all-8632 | [
"Close",
"closes",
"the",
"bot"
] | [
"func",
"(",
"bot",
"*",
"Bot",
")",
"Close",
"(",
")",
"error",
"{",
"if",
"bot",
".",
"unixlist",
"!=",
"nil",
"{",
"return",
"<mask>",
".",
"unixlist",
".",
"Close",
"(",
")",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
] |
8,632 | all-8633 | [
"FromPath",
"gets",
"a",
"portgroup",
"object",
"from",
"its",
"path",
"."
] | [
"func",
"FromPath",
"(",
"client",
"*",
"govmomi",
".",
"Client",
",",
"name",
"string",
",",
"dc",
"*",
"<mask>",
".",
"Datacenter",
")",
"(",
"*",
"object",
".",
"DistributedVirtualPortgroup",
",",
"error",
")",
"{",
"finder",
":=",
"find",
".",
"NewFinder",
"(",
"client",
".",
"Client",
",",
"false",
")",
"\n",
"if",
"dc",
"!=",
"nil",
"{",
"finder",
".",
"SetDatacenter",
"(",
"dc",
")",
"\n",
"}",
"\n\n",
"ctx",
",",
"cancel",
":=",
"context",
".",
"WithTimeout",
"(",
"context",
".",
"Background",
"(",
")",
",",
"provider",
".",
"DefaultAPITimeout",
")",
"\n",
"defer",
"cancel",
"(",
")",
"\n",
"net",
",",
"err",
":=",
"finder",
".",
"Network",
"(",
"ctx",
",",
"name",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"if",
"net",
".",
"Reference",
"(",
")",
".",
"Type",
"!=",
"\"",
"\"",
"{",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"name",
",",
"net",
".",
"Reference",
"(",
")",
".",
"Type",
")",
"\n",
"}",
"\n",
"return",
"FromMOID",
"(",
"client",
",",
"net",
".",
"Reference",
"(",
")",
".",
"Value",
")",
"\n",
"}"
] |
8,633 | all-8634 | [
"Close",
"removes",
"resources",
"associated",
"with",
"an",
"initialized",
"ImageSource",
"if",
"any",
"."
] | [
"func",
"(",
"s",
"*",
"ostreeImageSource",
")",
"Close",
"(",
")",
"<mask>",
"{",
"if",
"s",
".",
"repo",
"!=",
"nil",
"{",
"C",
".",
"g_object_unref",
"(",
"C",
".",
"gpointer",
"(",
"s",
".",
"repo",
")",
")",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
] |
8,634 | all-8635 | [
"Grab",
"every",
"thing",
"from",
"current",
"mark",
"up",
"to",
"the",
"tip",
"of",
"the",
"stack",
"and",
"make",
"it",
"a",
"list"
] | [
"func",
"txMakeArray",
"(",
"st",
"*",
"State",
")",
"{",
"start",
":=",
"st",
".",
"CurrentMark",
"(",
")",
"// start",
"\n",
"end",
":=",
"st",
".",
"StackTip",
"(",
")",
"// end",
"\n\n",
"if",
"end",
"<=",
"start",
"{",
"panic",
"(",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"start",
",",
"end",
")",
")",
"\n",
"}",
"\n\n",
"list",
":=",
"make",
"(",
"[",
"]",
"interface",
"{",
"}",
",",
"<mask>",
"-",
"start",
"+",
"1",
")",
"\n",
"for",
"i",
":=",
"end",
";",
"i",
">=",
"start",
";",
"i",
"--",
"{",
"list",
"[",
"i",
"-",
"start",
"]",
"=",
"st",
".",
"StackPop",
"(",
")",
"\n",
"}",
"\n",
"st",
".",
"sa",
"=",
"list",
"\n",
"st",
".",
"Advance",
"(",
")",
"\n",
"}"
] |
8,635 | all-8636 | [
"NewJobInput",
"creates",
"a",
"pps",
".",
"JobInput",
"."
] | [
"func",
"NewJobInput",
"(",
"repoName",
"<mask>",
",",
"commitID",
"string",
",",
"glob",
"string",
")",
"*",
"pps",
".",
"JobInput",
"{",
"return",
"&",
"pps",
".",
"JobInput",
"{",
"Commit",
":",
"NewCommit",
"(",
"repoName",
",",
"commitID",
")",
",",
"Glob",
":",
"glob",
",",
"}",
"\n",
"}"
] |
8,636 | all-8637 | [
"Execute",
"executes",
"the",
"pipeline",
".",
"The",
"execution",
"starts",
"in",
"the",
"forward",
"phase",
"calling",
"the",
"Forward",
"function",
"of",
"all",
"actions",
".",
"If",
"none",
"of",
"the",
"Forward",
"calls",
"return",
"error",
"the",
"pipeline",
"execution",
"ends",
"in",
"the",
"forward",
"phase",
"and",
"is",
"committed",
".",
"If",
"any",
"of",
"the",
"Forward",
"calls",
"fails",
"the",
"executor",
"switches",
"to",
"the",
"backward",
"phase",
"(",
"roll",
"back",
")",
"and",
"call",
"the",
"Backward",
"function",
"for",
"each",
"action",
"completed",
".",
"It",
"does",
"not",
"call",
"the",
"Backward",
"function",
"of",
"the",
"action",
"that",
"has",
"failed",
".",
"After",
"rolling",
"back",
"all",
"completed",
"actions",
"it",
"returns",
"the",
"original",
"error",
"returned",
"by",
"the",
"action",
"that",
"failed",
"."
] | [
"func",
"(",
"p",
"*",
"Pipeline",
")",
"Execute",
"(",
"params",
"...",
"interface",
"{",
"}",
")",
"(",
"err",
"error",
")",
"{",
"var",
"r",
"Result",
"\n",
"if",
"len",
"(",
"p",
".",
"actions",
")",
"==",
"0",
"{",
"return",
"ErrPipelineNoActions",
"\n",
"}",
"\n",
"fwCtx",
":=",
"FWContext",
"{",
"Params",
":",
"params",
"}",
"\n",
"var",
"i",
"int",
"\n",
"var",
"a",
"*",
"Action",
"\n",
"defer",
"func",
"(",
")",
"{",
"if",
"r",
":=",
"recover",
"(",
")",
";",
"r",
"!=",
"nil",
"{",
"log",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"a",
".",
"Name",
",",
"r",
")",
"\n",
"err",
"=",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"a",
".",
"Name",
",",
"r",
")",
"\n",
"if",
"a",
".",
"OnError",
"!=",
"nil",
"{",
"a",
".",
"OnError",
"(",
"fwCtx",
",",
"err",
")",
"\n",
"}",
"\n",
"p",
".",
"rollback",
"(",
"i",
"-",
"1",
",",
"params",
")",
"\n",
"}",
"\n",
"}",
"(",
")",
"\n",
"for",
"i",
",",
"a",
"=",
"<mask>",
"p",
".",
"actions",
"{",
"log",
".",
"Debugf",
"(",
"\"",
"\"",
",",
"a",
".",
"Name",
")",
"\n",
"if",
"a",
".",
"Forward",
"==",
"nil",
"{",
"err",
"=",
"ErrPipelineForwardMissing",
"\n",
"}",
"else",
"if",
"len",
"(",
"fwCtx",
".",
"Params",
")",
"<",
"a",
".",
"MinParams",
"{",
"err",
"=",
"ErrPipelineFewParameters",
"\n",
"}",
"else",
"{",
"r",
",",
"err",
"=",
"a",
".",
"Forward",
"(",
"fwCtx",
")",
"\n",
"a",
".",
"rMutex",
".",
"Lock",
"(",
")",
"\n",
"a",
".",
"result",
"=",
"r",
"\n",
"a",
".",
"rMutex",
".",
"Unlock",
"(",
")",
"\n",
"fwCtx",
".",
"Previous",
"=",
"r",
"\n",
"}",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"log",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"a",
".",
"Name",
",",
"err",
")",
"\n",
"if",
"a",
".",
"OnError",
"!=",
"nil",
"{",
"a",
".",
"OnError",
"(",
"fwCtx",
",",
"err",
")",
"\n",
"}",
"\n",
"p",
".",
"rollback",
"(",
"i",
"-",
"1",
",",
"params",
")",
"\n",
"return",
"err",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
] |
8,637 | all-8638 | [
"MarshalJSON",
"supports",
"json",
".",
"Marshaler",
"interface"
] | [
"func",
"(",
"v",
"HighlightRectParams",
")",
"MarshalJSON",
"(",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"w",
":=",
"jwriter",
".",
"Writer",
"{",
"}",
"\n",
"easyjsonC5a4559bEncodeGithubComChromedpCdprotoOverlay9",
"(",
"&",
"w",
",",
"v",
")",
"\n",
"return",
"w",
".",
"<mask>",
".",
"BuildBytes",
"(",
")",
",",
"w",
".",
"Error",
"\n",
"}"
] |
8,638 | all-8639 | [
"Bytes",
"()",
"returns",
"a",
"slice",
"of",
"the",
"contents",
"of",
"the",
"unread",
"portion",
"of",
"the",
"buffer",
".",
"To",
"avoid",
"copying",
"see",
"the",
"companion",
"BytesTwo",
"()",
"call",
".",
"Unlike",
"the",
"standard",
"library",
"Bytes",
"()",
"method",
"(",
"on",
"bytes",
".",
"Buffer",
"for",
"example",
")",
"the",
"result",
"of",
"the",
"AtomicFixedSizeRingBuf",
"::",
"Bytes",
"(",
"true",
")",
"is",
"a",
"completely",
"new",
"returned",
"slice",
"so",
"modifying",
"that",
"slice",
"will",
"have",
"no",
"impact",
"on",
"the",
"contents",
"of",
"the",
"internal",
"ring",
".",
"Bytes",
"(",
"false",
")",
"acts",
"like",
"the",
"standard",
"library",
"bytes",
".",
"Buffer",
"::",
"Bytes",
"()",
"call",
"in",
"that",
"it",
"returns",
"a",
"slice",
"which",
"is",
"backed",
"by",
"the",
"buffer",
"itself",
"(",
"so",
"no",
"copy",
"is",
"involved",
")",
".",
"The",
"largest",
"slice",
"Bytes",
"ever",
"returns",
"is",
"bounded",
"above",
"by",
"the",
"maxViewInBytes",
"value",
"used",
"when",
"calling",
"NewAtomicFixedSizeRingBuf",
"()",
".",
"Possible",
"side",
"-",
"effect",
":",
"may",
"modify",
"b",
".",
"Use",
"the",
"buffer",
"in",
"use",
"."
] | [
"func",
"(",
"b",
"*",
"AtomicFixedSizeRingBuf",
")",
"Bytes",
"(",
"makeCopy",
"bool",
")",
"[",
"]",
"byte",
"{",
"b",
".",
"tex",
".",
"Lock",
"(",
")",
"\n",
"defer",
"b",
".",
"tex",
".",
"Unlock",
"(",
")",
"\n\n",
"extent",
":=",
"b",
".",
"Beg",
"+",
"b",
".",
"readable",
"\n",
"if",
"extent",
"<=",
"b",
".",
"N",
"{",
"// we fit contiguously in this buffer without wrapping to the other",
"return",
"b",
".",
"A",
"[",
"b",
".",
"Use",
"]",
"[",
"b",
".",
"Beg",
":",
"(",
"b",
".",
"Beg",
"+",
"b",
".",
"readable",
")",
"]",
"\n",
"}",
"\n\n",
"// wrap into the other buffer",
"src",
":=",
"b",
".",
"Use",
"\n",
"dest",
":=",
"1",
"-",
"b",
".",
"Use",
"\n\n",
"n",
":=",
"copy",
"(",
"b",
".",
"A",
"[",
"dest",
"]",
",",
"b",
".",
"A",
"[",
"src",
"]",
"[",
"b",
".",
"Beg",
":",
"]",
")",
"\n",
"n",
"+=",
"copy",
"(",
"b",
".",
"A",
"[",
"dest",
"]",
"[",
"n",
":",
"]",
",",
"b",
".",
"A",
"[",
"src",
"]",
"[",
"0",
":",
"(",
"extent",
"%",
"b",
".",
"N",
")",
"]",
")",
"\n\n",
"b",
".",
"Use",
"=",
"<mask>",
"\n",
"b",
".",
"Beg",
"=",
"0",
"\n\n",
"if",
"makeCopy",
"{",
"ret",
":=",
"make",
"(",
"[",
"]",
"byte",
",",
"n",
")",
"\n",
"copy",
"(",
"ret",
",",
"b",
".",
"A",
"[",
"b",
".",
"Use",
"]",
"[",
":",
"n",
"]",
")",
"\n",
"return",
"ret",
"\n",
"}",
"\n",
"return",
"b",
".",
"A",
"[",
"b",
".",
"Use",
"]",
"[",
":",
"n",
"]",
"\n",
"}"
] |
8,639 | all-8640 | [
"To",
"check",
"this",
"line",
"is",
"a",
"valid",
"key",
"-",
"value",
"pair",
"or",
"not",
"."
] | [
"func",
"checkLine",
"(",
"line",
"string",
")",
"(",
"string",
",",
"string",
",",
"bool",
")",
"{",
"key",
":=",
"\"",
"\"",
"\n",
"value",
":=",
"\"",
"\"",
"\n",
"sp",
":=",
"strings",
".",
"SplitN",
"(",
"line",
",",
"\"",
"\"",
",",
"2",
")",
"\n",
"if",
"len",
"(",
"sp",
")",
"!=",
"2",
"{",
"return",
"key",
",",
"value",
",",
"<mask>",
"\n",
"}",
"\n",
"key",
"=",
"strings",
".",
"TrimSpace",
"(",
"sp",
"[",
"0",
"]",
")",
"\n",
"value",
"=",
"strings",
".",
"TrimSpace",
"(",
"sp",
"[",
"1",
"]",
")",
"\n",
"return",
"key",
",",
"value",
",",
"true",
"\n",
"}"
] |
8,640 | all-8641 | [
"----------------------------------------------------------------",
"Expects",
"hashes!"
] | [
"func",
"simpleHashFromHashes",
"(",
"hashes",
"[",
"]",
"[",
"]",
"byte",
")",
"[",
"]",
"byte",
"{",
"// Recursive impl.",
"<mask>",
"len",
"(",
"hashes",
")",
"{",
"case",
"0",
":",
"return",
"nil",
"\n",
"case",
"1",
":",
"return",
"hashes",
"[",
"0",
"]",
"\n",
"default",
":",
"left",
":=",
"simpleHashFromHashes",
"(",
"hashes",
"[",
":",
"(",
"len",
"(",
"hashes",
")",
"+",
"1",
")",
"/",
"2",
"]",
")",
"\n",
"right",
":=",
"simpleHashFromHashes",
"(",
"hashes",
"[",
"(",
"len",
"(",
"hashes",
")",
"+",
"1",
")",
"/",
"2",
":",
"]",
")",
"\n",
"return",
"SimpleHashFromTwoHashes",
"(",
"left",
",",
"right",
")",
"\n",
"}",
"\n",
"}"
] |
8,641 | all-8642 | [
"NewURLsMap",
"returns",
"a",
"URLsMap",
"instantiated",
"from",
"the",
"given",
"string",
"which",
"consists",
"of",
"discovery",
"-",
"formatted",
"names",
"-",
"to",
"-",
"URLs",
"like",
":",
"mach0",
"=",
"http",
":",
"//",
"1",
".",
"1",
".",
"1",
".",
"1",
":",
"2380",
"mach0",
"=",
"http",
":",
"//",
"2",
".",
"2",
".",
"2",
".",
"2",
"::",
"2380",
"mach1",
"=",
"http",
":",
"//",
"3",
".",
"3",
".",
"3",
".",
"3",
":",
"2380",
"mach2",
"=",
"http",
":",
"//",
"4",
".",
"4",
".",
"4",
".",
"4",
":",
"2380"
] | [
"func",
"NewURLsMap",
"(",
"s",
"string",
")",
"(",
"URLsMap",
",",
"error",
")",
"{",
"m",
":=",
"parse",
"(",
"s",
")",
"\n\n",
"cl",
":=",
"URLsMap",
"{",
"}",
"\n",
"for",
"<mask>",
",",
"urls",
":=",
"range",
"m",
"{",
"us",
",",
"err",
":=",
"NewURLs",
"(",
"urls",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"cl",
"[",
"name",
"]",
"=",
"us",
"\n",
"}",
"\n",
"return",
"cl",
",",
"nil",
"\n",
"}"
] |
8,642 | all-8643 | [
"UpdateServer",
"updates",
"an",
"existing",
"server",
"s",
"attributes",
".",
"Not",
"all",
"attributes",
"can",
"be",
"changed",
"after",
"creation",
"time",
"(",
"such",
"as",
"Image",
"ServerType",
"and",
"Zone",
")",
".",
"Specify",
"the",
"server",
"you",
"want",
"to",
"update",
"using",
"the",
"ServerOptions",
"Id",
"field"
] | [
"func",
"(",
"c",
"*",
"Client",
")",
"UpdateServer",
"(",
"updateServer",
"*",
"ServerOptions",
")",
"(",
"*",
"Server",
",",
"error",
")",
"{",
"server",
":=",
"new",
"(",
"<mask>",
")",
"\n",
"_",
",",
"err",
":=",
"c",
".",
"MakeApiRequest",
"(",
"\"",
"\"",
",",
"\"",
"\"",
"+",
"updateServer",
".",
"Id",
",",
"updateServer",
",",
"&",
"server",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"return",
"server",
",",
"nil",
"\n",
"}"
] |
8,643 | all-8644 | [
"Visualize",
"emits",
"a",
"string",
"in",
"dot",
"format",
"which",
"when",
"rendered",
"with",
"graphviz",
"visualizes",
"the",
"models",
"and",
"their",
"relationships",
"."
] | [
"func",
"(",
"c",
"*",
"Catalog",
")",
"Visualize",
"(",
"title",
"string",
")",
"string",
"{",
"// prepare buffer",
"var",
"out",
"bytes",
".",
"Buffer",
"\n\n",
"// start graph",
"out",
".",
"WriteString",
"(",
"\"",
"\\n",
"\"",
")",
"\n",
"out",
".",
"WriteString",
"(",
"\"",
"\\\"",
"\\\"",
"\\n",
"\"",
")",
"\n",
"out",
".",
"WriteString",
"(",
"\"",
"\\\"",
"\\\"",
"\\n",
"\"",
")",
"\n",
"out",
".",
"WriteString",
"(",
"\"",
"\\\"",
"\\\"",
"\\n",
"\"",
")",
"\n",
"out",
".",
"WriteString",
"(",
"\"",
"\\\"",
"\\\"",
"\\n",
"\"",
")",
"\n",
"out",
".",
"WriteString",
"(",
"\"",
"\\\"",
"\\\"",
"\\n",
"\"",
")",
"\n",
"out",
".",
"WriteString",
"(",
"\"",
"\\\"",
"\\\"",
"\\n",
"\"",
")",
"\n",
"out",
".",
"WriteString",
"(",
"\"",
"\\\"",
"\\\"",
"\\n",
"\"",
")",
"\n",
"out",
".",
"WriteString",
"(",
"\"",
"\\\"",
"\\\"",
"\\n",
"\"",
")",
"\n",
"out",
".",
"WriteString",
"(",
"\"",
"\\\"",
"\\\"",
"\\n",
"\"",
")",
"\n",
"out",
".",
"WriteString",
"(",
"\"",
"\\\"",
"\\\"",
"\\n",
"\"",
")",
"\n",
"out",
".",
"WriteString",
"(",
"\"",
"\\\"",
"\\\"",
"\\n",
"\"",
")",
"\n",
"out",
".",
"WriteString",
"(",
"\"",
"\\\"",
"\\\"",
"\\n",
"\"",
")",
"\n",
"out",
".",
"WriteString",
"(",
"\"",
"\\n",
"\"",
")",
"\n",
"out",
".",
"WriteString",
"(",
"\"",
"\\\"",
"\"",
"+",
"title",
"+",
"\"",
"\\\"",
"\\n",
"\"",
")",
"\n\n",
"// get a sorted list of model names and lookup table",
"var",
"names",
"[",
"]",
"string",
"\n",
"lookup",
":=",
"make",
"(",
"map",
"[",
"string",
"]",
"string",
")",
"\n",
"for",
"name",
",",
"model",
":=",
"<mask>",
"c",
".",
"models",
"{",
"names",
"=",
"append",
"(",
"names",
",",
"name",
")",
"\n",
"lookup",
"[",
"name",
"]",
"=",
"model",
".",
"Meta",
"(",
")",
".",
"Name",
"\n",
"}",
"\n",
"sort",
".",
"Strings",
"(",
"names",
")",
"\n\n",
"// add model nodes",
"for",
"_",
",",
"name",
":=",
"range",
"names",
"{",
"// get model",
"model",
":=",
"c",
".",
"models",
"[",
"name",
"]",
"\n\n",
"// write begin of node",
"out",
".",
"WriteString",
"(",
"fmt",
".",
"Sprintf",
"(",
"` \"%s\" [ style=filled, fillcolor=white, label=`",
",",
"lookup",
"[",
"name",
"]",
")",
")",
"\n\n",
"// write head table",
"out",
".",
"WriteString",
"(",
"fmt",
".",
"Sprintf",
"(",
"`<<table border=\"0\" align=\"center\" cellspacing=\"0.5\" cellpadding=\"0\" width=\"134\"><tr><td align=\"center\" valign=\"bottom\" width=\"130\"><font face=\"Arial BoldMT\" point-size=\"11\">%s</font></td></tr></table>|`",
",",
"lookup",
"[",
"name",
"]",
")",
")",
"\n\n",
"// write begin of tail table",
"out",
".",
"WriteString",
"(",
"fmt",
".",
"Sprintf",
"(",
"`<table border=\"0\" align=\"left\" cellspacing=\"2\" cellpadding=\"0\" width=\"134\">`",
")",
")",
"\n\n",
"// write attributes",
"for",
"_",
",",
"field",
":=",
"range",
"model",
".",
"Meta",
"(",
")",
".",
"OrderedFields",
"{",
"out",
".",
"WriteString",
"(",
"fmt",
".",
"Sprintf",
"(",
"`<tr><td align=\"left\" width=\"130\" port=\"%s\">%s<font face=\"Arial ItalicMT\" color=\"grey60\"> %s</font></td></tr>`",
",",
"field",
".",
"Name",
",",
"field",
".",
"Name",
",",
"field",
".",
"Type",
".",
"String",
"(",
")",
")",
")",
"\n",
"}",
"\n\n",
"// write end of tail table",
"out",
".",
"WriteString",
"(",
"fmt",
".",
"Sprintf",
"(",
"`</table>>`",
")",
")",
"\n\n",
"// write end of node",
"out",
".",
"WriteString",
"(",
"`, shape=Mrecord, fontsize=10, fontname=\"ArialMT\", margin=\"0.07,0.05\", penwidth=\"1.0\" ];`",
"+",
"\"",
"\\n",
"\"",
")",
"\n",
"}",
"\n\n",
"// define temporary struct",
"type",
"rel",
"struct",
"{",
"from",
",",
"to",
"string",
"\n",
"srcMany",
"bool",
"\n",
"dstMany",
"bool",
"\n",
"hasInverse",
"bool",
"\n",
"}",
"\n\n",
"// prepare list",
"list",
":=",
"make",
"(",
"map",
"[",
"string",
"]",
"*",
"rel",
")",
"\n",
"var",
"relNames",
"[",
"]",
"string",
"\n\n",
"// prepare relationships",
"for",
"_",
",",
"name",
":=",
"range",
"names",
"{",
"// get model",
"model",
":=",
"c",
".",
"models",
"[",
"name",
"]",
"\n\n",
"// add all direct relationships",
"for",
"_",
",",
"field",
":=",
"range",
"model",
".",
"Meta",
"(",
")",
".",
"OrderedFields",
"{",
"if",
"field",
".",
"RelName",
"!=",
"\"",
"\"",
"&&",
"(",
"field",
".",
"ToOne",
"||",
"field",
".",
"ToMany",
")",
"{",
"list",
"[",
"name",
"+",
"\"",
"\"",
"+",
"field",
".",
"RelName",
"]",
"=",
"&",
"rel",
"{",
"from",
":",
"name",
",",
"to",
":",
"field",
".",
"RelType",
",",
"srcMany",
":",
"field",
".",
"ToMany",
",",
"}",
"\n\n",
"relNames",
"=",
"append",
"(",
"relNames",
",",
"name",
"+",
"\"",
"\"",
"+",
"field",
".",
"RelName",
")",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n\n",
"// update relationships",
"for",
"_",
",",
"name",
":=",
"range",
"names",
"{",
"// get model",
"model",
":=",
"c",
".",
"models",
"[",
"name",
"]",
"\n\n",
"// add all indirect relationships",
"for",
"_",
",",
"field",
":=",
"range",
"model",
".",
"Meta",
"(",
")",
".",
"OrderedFields",
"{",
"if",
"field",
".",
"RelName",
"!=",
"\"",
"\"",
"&&",
"(",
"field",
".",
"HasOne",
"||",
"field",
".",
"HasMany",
")",
"{",
"r",
":=",
"list",
"[",
"field",
".",
"RelType",
"+",
"\"",
"\"",
"+",
"field",
".",
"RelInverse",
"]",
"\n",
"r",
".",
"dstMany",
"=",
"field",
".",
"HasMany",
"\n",
"r",
".",
"hasInverse",
"=",
"true",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n\n",
"// sort relationship names",
"sort",
".",
"Strings",
"(",
"relNames",
")",
"\n\n",
"// add relationships",
"for",
"_",
",",
"name",
":=",
"range",
"relNames",
"{",
"// get relationship",
"r",
":=",
"list",
"[",
"name",
"]",
"\n\n",
"// get style",
"style",
":=",
"\"",
"\"",
"\n",
"if",
"!",
"r",
".",
"hasInverse",
"{",
"style",
"=",
"\"",
"\"",
"\n",
"}",
"\n\n",
"// get color",
"color",
":=",
"\"",
"\"",
"\n",
"if",
"r",
".",
"srcMany",
"{",
"color",
"=",
"\"",
"\"",
"\n",
"}",
"\n\n",
"// write edge",
"out",
".",
"WriteString",
"(",
"fmt",
".",
"Sprintf",
"(",
"` \"%s\"--\"%s\"[ fontname=\"ArialMT\", fontsize=7, dir=both, arrowsize=\"0.9\", penwidth=\"0.9\", labelangle=32, labeldistance=\"1.8\", style=%s, color=\"%s\", arrowhead=%s, arrowtail=%s ];`",
",",
"lookup",
"[",
"r",
".",
"from",
"]",
",",
"lookup",
"[",
"r",
".",
"to",
"]",
",",
"style",
",",
"color",
",",
"\"",
"\"",
",",
"\"",
"\"",
")",
"+",
"\"",
"\\n",
"\"",
")",
"\n",
"}",
"\n\n",
"// end graph",
"out",
".",
"WriteString",
"(",
"\"",
"\\n",
"\"",
")",
"\n\n",
"return",
"out",
".",
"String",
"(",
")",
"\n",
"}"
] |
8,644 | all-8645 | [
"ReadTLSConfig",
"reads",
"the",
"tls",
"config",
"for",
"a",
"machine",
"."
] | [
"func",
"(",
"xcg",
"*",
"X509CertGenerator",
")",
"ReadTLSConfig",
"(",
"addr",
"string",
",",
"authOptions",
"*",
"auth",
".",
"Options",
")",
"(",
"*",
"tls",
".",
"Config",
",",
"error",
")",
"{",
"caCertPath",
":=",
"authOptions",
".",
"CaCertPath",
"\n",
"clientCertPath",
":=",
"authOptions",
".",
"ClientCertPath",
"\n",
"clientKeyPath",
":=",
"authOptions",
".",
"ClientKeyPath",
"\n\n",
"log",
".",
"Debugf",
"(",
"\"",
"\"",
",",
"caCertPath",
")",
"\n",
"caCert",
",",
"err",
":=",
"ioutil",
".",
"ReadFile",
"(",
"caCertPath",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"log",
".",
"Debugf",
"(",
"\"",
"\"",
",",
"clientCertPath",
")",
"\n",
"clientCert",
",",
"err",
":=",
"ioutil",
".",
"ReadFile",
"(",
"clientCertPath",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"<mask>",
".",
"Debugf",
"(",
"\"",
"\"",
",",
"clientKeyPath",
")",
"\n",
"clientKey",
",",
"err",
":=",
"ioutil",
".",
"ReadFile",
"(",
"clientKeyPath",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"return",
"xcg",
".",
"getTLSConfig",
"(",
"caCert",
",",
"clientCert",
",",
"clientKey",
",",
"false",
")",
"\n",
"}"
] |
8,645 | all-8646 | [
"Index",
"returns",
"an",
"index",
"with",
"a",
"name",
"."
] | [
"func",
"(",
"s",
"*",
"Schema",
")",
"Index",
"(",
"name",
"string",
",",
"<mask>",
"...",
"IndexOption",
")",
"*",
"Index",
"{",
"if",
"index",
",",
"ok",
":=",
"s",
".",
"indexes",
"[",
"name",
"]",
";",
"ok",
"{",
"return",
"index",
"\n",
"}",
"\n",
"indexOptions",
":=",
"&",
"IndexOptions",
"{",
"}",
"\n",
"indexOptions",
".",
"addOptions",
"(",
"options",
"...",
")",
"\n",
"return",
"s",
".",
"indexWithOptions",
"(",
"name",
",",
"0",
",",
"indexOptions",
")",
"\n",
"}"
] |
8,646 | all-8647 | [
"SetMarkupWithMnemonic",
"is",
"a",
"wrapper",
"around",
"gtk_label_set_markup_with_mnemonic",
"()",
"."
] | [
"func",
"(",
"v",
"*",
"<mask>",
")",
"SetMarkupWithMnemonic",
"(",
"str",
"string",
")",
"{",
"cstr",
":=",
"C",
".",
"CString",
"(",
"str",
")",
"\n",
"defer",
"C",
".",
"free",
"(",
"unsafe",
".",
"Pointer",
"(",
"cstr",
")",
")",
"\n",
"C",
".",
"gtk_label_set_markup_with_mnemonic",
"(",
"v",
".",
"native",
"(",
")",
",",
"(",
"*",
"C",
".",
"gchar",
")",
"(",
"cstr",
")",
")",
"\n",
"}"
] |
8,647 | all-8648 | [
"Snapshot",
"will",
"force",
"the",
"performed",
"query",
"to",
"make",
"use",
"of",
"an",
"available",
"index",
"on",
"the",
"_id",
"field",
"to",
"prevent",
"the",
"same",
"document",
"from",
"being",
"returned",
"more",
"than",
"once",
"in",
"a",
"single",
"iteration",
".",
"This",
"might",
"happen",
"without",
"this",
"setting",
"in",
"situations",
"when",
"the",
"document",
"changes",
"in",
"size",
"and",
"thus",
"has",
"to",
"be",
"moved",
"while",
"the",
"iteration",
"is",
"running",
".",
"Because",
"snapshot",
"mode",
"traverses",
"the",
"_id",
"index",
"it",
"may",
"not",
"be",
"used",
"with",
"sorting",
"or",
"explicit",
"hints",
".",
"It",
"also",
"cannot",
"use",
"any",
"other",
"index",
"for",
"the",
"query",
".",
"Even",
"with",
"snapshot",
"mode",
"items",
"inserted",
"or",
"deleted",
"during",
"the",
"query",
"may",
"or",
"may",
"not",
"be",
"returned",
";",
"that",
"is",
"this",
"mode",
"is",
"not",
"a",
"true",
"point",
"-",
"in",
"-",
"time",
"snapshot",
".",
"The",
"same",
"effect",
"of",
"Snapshot",
"may",
"be",
"obtained",
"by",
"using",
"any",
"unique",
"index",
"on",
"field",
"(",
"s",
")",
"that",
"will",
"not",
"be",
"modified",
"(",
"best",
"to",
"use",
"Hint",
"explicitly",
"too",
")",
".",
"A",
"non",
"-",
"unique",
"index",
"(",
"such",
"as",
"creation",
"time",
")",
"may",
"be",
"made",
"unique",
"by",
"appending",
"_id",
"to",
"the",
"index",
"when",
"creating",
"it",
".",
"Relevant",
"documentation",
":",
"http",
":",
"//",
"www",
".",
"mongodb",
".",
"org",
"/",
"display",
"/",
"DOCS",
"/",
"How",
"+",
"to",
"+",
"do",
"+",
"Snapshotted",
"+",
"Queries",
"+",
"in",
"+",
"the",
"+",
"Mongo",
"+",
"Database"
] | [
"func",
"(",
"q",
"*",
"Query",
")",
"Snapshot",
"(",
")",
"*",
"Query",
"{",
"q",
".",
"m",
".",
"Lock",
"(",
")",
"\n",
"q",
".",
"op",
".",
"options",
".",
"Snapshot",
"=",
"<mask>",
"\n",
"q",
".",
"op",
".",
"hasOptions",
"=",
"true",
"\n",
"q",
".",
"m",
".",
"Unlock",
"(",
")",
"\n",
"return",
"q",
"\n",
"}"
] |
8,648 | all-8649 | [
"flattenVirtualMachineFlagInfo",
"reads",
"various",
"fields",
"from",
"a",
"VirtualMachineFlagInfo",
"into",
"the",
"passed",
"in",
"ResourceData",
"."
] | [
"func",
"flattenVirtualMachineFlagInfo",
"(",
"d",
"*",
"schema",
".",
"ResourceData",
",",
"obj",
"*",
"types",
".",
"VirtualMachineFlagInfo",
")",
"error",
"{",
"d",
".",
"Set",
"(",
"\"",
"\"",
",",
"obj",
".",
"DiskUuidEnabled",
")",
"\n",
"d",
".",
"<mask>",
"(",
"\"",
"\"",
",",
"obj",
".",
"VirtualExecUsage",
")",
"\n",
"d",
".",
"Set",
"(",
"\"",
"\"",
",",
"obj",
".",
"VirtualMmuUsage",
")",
"\n",
"d",
".",
"Set",
"(",
"\"",
"\"",
",",
"obj",
".",
"EnableLogging",
")",
"\n",
"return",
"nil",
"\n",
"}"
] |
8,649 | all-8650 | [
"And",
"succeeds",
"only",
"if",
"all",
"of",
"the",
"given",
"matchers",
"succeed",
".",
"The",
"matchers",
"are",
"tried",
"in",
"order",
"and",
"will",
"fail",
"-",
"fast",
"if",
"one",
"doesn",
"t",
"succeed",
".",
"Expect",
"(",
"hi",
")",
".",
"To",
"(",
"And",
"(",
"HaveLen",
"(",
"2",
")",
"Equal",
"(",
"hi",
"))",
"And",
"()",
"Or",
"()",
"Not",
"()",
"and",
"WithTransform",
"()",
"allow",
"matchers",
"to",
"be",
"composed",
"into",
"complex",
"expressions",
"."
] | [
"func",
"And",
"(",
"ms",
"...",
"types",
".",
"GomegaMatcher",
")",
"<mask>",
".",
"GomegaMatcher",
"{",
"return",
"&",
"matchers",
".",
"AndMatcher",
"{",
"Matchers",
":",
"ms",
"}",
"\n",
"}"
] |
8,650 | all-8651 | [
"Wrap",
"returns",
"a",
"new",
"Listener",
"around",
"the",
"provided",
"net",
".",
"Listener",
".",
"The",
"returned",
"Listener",
"has",
"a",
"guarantee",
"that",
"when",
"Close",
"returns",
"it",
"will",
"no",
"longer",
"accept",
"any",
"new",
"connections",
".",
"See",
":",
"https",
":",
"//",
"github",
".",
"com",
"/",
"uber",
"/",
"tchannel",
"-",
"go",
"/",
"issues",
"/",
"141"
] | [
"func",
"Wrap",
"(",
"l",
"<mask>",
".",
"Listener",
")",
"net",
".",
"Listener",
"{",
"return",
"&",
"listener",
"{",
"Listener",
":",
"l",
",",
"cond",
":",
"sync",
".",
"NewCond",
"(",
"&",
"sync",
".",
"Mutex",
"{",
"}",
")",
"}",
"\n",
"}"
] |
8,651 | all-8652 | [
"makeTable",
"checks",
"each",
"coverage",
"change",
"and",
"produce",
"the",
"table",
"content",
"for",
"coverage",
"bot",
"post",
"It",
"also",
"report",
"on",
"whether",
"any",
"coverage",
"fells",
"below",
"the",
"given",
"threshold"
] | [
"func",
"makeTable",
"(",
"baseCovList",
",",
"newCovList",
"*",
"calculation",
".",
"CoverageList",
",",
"coverageThreshold",
"float32",
")",
"(",
"string",
",",
"bool",
")",
"{",
"var",
"rows",
"[",
"]",
"string",
"\n",
"isCoverageLow",
":=",
"false",
"\n",
"for",
"_",
",",
"change",
":=",
"range",
"findChanges",
"(",
"baseCovList",
",",
"newCovList",
")",
"{",
"filePath",
":=",
"change",
".",
"name",
"\n",
"rows",
"=",
"append",
"(",
"<mask>",
",",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"filePath",
",",
"formatPercentage",
"(",
"change",
".",
"baseRatio",
")",
",",
"formatPercentage",
"(",
"change",
".",
"newRatio",
")",
",",
"deltaDisplayed",
"(",
"change",
")",
")",
")",
"\n\n",
"if",
"change",
".",
"newRatio",
"<",
"coverageThreshold",
"{",
"isCoverageLow",
"=",
"true",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"strings",
".",
"Join",
"(",
"rows",
",",
"\"",
"\\n",
"\"",
")",
",",
"isCoverageLow",
"\n",
"}"
] |
8,652 | all-8653 | [
"GetSkipMetrics",
"fetches",
"the",
"data",
"found",
"in",
"the",
"provided",
"path",
".",
"It",
"returns",
"the",
"content",
"of",
"the",
"response",
"or",
"any",
"errors",
"that",
"occurred",
"during",
"the",
"request",
"or",
"http",
"errors",
".",
"Metrics",
"will",
"not",
"be",
"gathered",
"for",
"this",
"request",
"."
] | [
"func",
"(",
"c",
"*",
"Client",
")",
"GetSkipMetrics",
"(",
"path",
"string",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"resp",
",",
"err",
":=",
"c",
".",
"request",
"(",
"<mask>",
".",
"MethodGet",
",",
"path",
",",
"nil",
",",
"false",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"return",
"readResp",
"(",
"resp",
")",
"\n",
"}"
] |
8,653 | all-8654 | [
"Pixels",
"returns",
"the",
"image",
"s",
"pixels",
".",
"Pixels",
"might",
"return",
"nil",
"when",
"OpenGL",
"error",
"happens",
"."
] | [
"func",
"(",
"i",
"*",
"Image",
")",
"Pixels",
"(",
")",
"[",
"]",
"byte",
"{",
"c",
":=",
"&",
"pixelsCommand",
"{",
"<mask>",
":",
"nil",
",",
"img",
":",
"i",
",",
"}",
"\n",
"theCommandQueue",
".",
"Enqueue",
"(",
"c",
")",
"\n",
"theCommandQueue",
".",
"Flush",
"(",
")",
"\n",
"return",
"c",
".",
"result",
"\n",
"}"
] |
8,654 | all-8655 | [
"title",
":",
"remove",
"team",
"path",
":",
"/",
"teams",
"/",
"{",
"name",
"}",
"method",
":",
"DELETE",
"responses",
":",
"200",
":",
"Team",
"removed",
"401",
":",
"Unauthorized",
"403",
":",
"Forbidden",
"404",
":",
"Not",
"found"
] | [
"func",
"removeTeam",
"(",
"w",
"http",
".",
"ResponseWriter",
",",
"r",
"*",
"http",
".",
"Request",
",",
"t",
"auth",
".",
"<mask>",
")",
"(",
"err",
"error",
")",
"{",
"name",
":=",
"r",
".",
"URL",
".",
"Query",
"(",
")",
".",
"Get",
"(",
"\"",
"\"",
")",
"\n",
"allowed",
":=",
"permission",
".",
"Check",
"(",
"t",
",",
"permission",
".",
"PermTeamDelete",
",",
"permission",
".",
"Context",
"(",
"permTypes",
".",
"CtxTeam",
",",
"name",
")",
",",
")",
"\n",
"if",
"!",
"allowed",
"{",
"return",
"&",
"errors",
".",
"HTTP",
"{",
"Code",
":",
"http",
".",
"StatusNotFound",
",",
"Message",
":",
"fmt",
".",
"Sprintf",
"(",
"`Team \"%s\" not found.`",
",",
"name",
")",
"}",
"\n",
"}",
"\n",
"evt",
",",
"err",
":=",
"event",
".",
"New",
"(",
"&",
"event",
".",
"Opts",
"{",
"Target",
":",
"teamTarget",
"(",
"name",
")",
",",
"Kind",
":",
"permission",
".",
"PermTeamDelete",
",",
"Owner",
":",
"t",
",",
"CustomData",
":",
"event",
".",
"FormToCustomData",
"(",
"InputFields",
"(",
"r",
")",
")",
",",
"Allowed",
":",
"event",
".",
"Allowed",
"(",
"permission",
".",
"PermTeamReadEvents",
",",
"permission",
".",
"Context",
"(",
"permTypes",
".",
"CtxTeam",
",",
"name",
")",
")",
",",
"}",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"defer",
"func",
"(",
")",
"{",
"evt",
".",
"Done",
"(",
"err",
")",
"}",
"(",
")",
"\n",
"err",
"=",
"servicemanager",
".",
"Team",
".",
"Remove",
"(",
"name",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"if",
"_",
",",
"ok",
":=",
"err",
".",
"(",
"*",
"authTypes",
".",
"ErrTeamStillUsed",
")",
";",
"ok",
"{",
"msg",
":=",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\\n",
"\"",
",",
"err",
")",
"\n",
"return",
"&",
"errors",
".",
"HTTP",
"{",
"Code",
":",
"http",
".",
"StatusForbidden",
",",
"Message",
":",
"msg",
"}",
"\n",
"}",
"\n",
"if",
"err",
"==",
"authTypes",
".",
"ErrTeamNotFound",
"{",
"return",
"&",
"errors",
".",
"HTTP",
"{",
"Code",
":",
"http",
".",
"StatusNotFound",
",",
"Message",
":",
"fmt",
".",
"Sprintf",
"(",
"`Team \"%s\" not found.`",
",",
"name",
")",
"}",
"\n",
"}",
"\n",
"return",
"err",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
] |
8,655 | all-8656 | [
"ReadWhisperSchemas",
"reads",
"and",
"parses",
"a",
"storage",
"-",
"schemas",
".",
"conf",
"file",
"and",
"returns",
"a",
"sorted",
"schemas",
"structure",
"see",
"https",
":",
"//",
"graphite",
".",
"readthedocs",
".",
"io",
"/",
"en",
"/",
"0",
".",
"9",
".",
"9",
"/",
"config",
"-",
"carbon",
".",
"html#storage",
"-",
"schemas",
"-",
"conf"
] | [
"func",
"ReadWhisperSchemas",
"(",
"filename",
"string",
")",
"(",
"WhisperSchemas",
",",
"error",
")",
"{",
"config",
",",
"err",
":=",
"parseIniFile",
"(",
"filename",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"var",
"schemas",
"WhisperSchemas",
"\n\n",
"for",
"i",
",",
"section",
":=",
"range",
"config",
"{",
"schema",
":=",
"Schema",
"{",
"}",
"\n",
"schema",
".",
"Name",
"=",
"section",
"[",
"\"",
"\"",
"]",
"\n\n",
"if",
"section",
"[",
"\"",
"\"",
"]",
"==",
"\"",
"\"",
"{",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"schema",
".",
"Name",
")",
"\n",
"}",
"\n",
"schema",
".",
"<mask>",
",",
"err",
"=",
"regexp",
".",
"Compile",
"(",
"section",
"[",
"\"",
"\"",
"]",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"section",
"[",
"\"",
"\"",
"]",
",",
"schema",
".",
"Name",
",",
"err",
".",
"Error",
"(",
")",
")",
"\n",
"}",
"\n",
"schema",
".",
"RetentionStr",
"=",
"section",
"[",
"\"",
"\"",
"]",
"\n",
"schema",
".",
"Retentions",
",",
"err",
"=",
"ParseRetentionDefs",
"(",
"schema",
".",
"RetentionStr",
")",
"\n\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"schema",
".",
"RetentionStr",
",",
"schema",
".",
"Name",
",",
"err",
".",
"Error",
"(",
")",
")",
"\n",
"}",
"\n\n",
"p",
":=",
"int64",
"(",
"0",
")",
"\n",
"if",
"section",
"[",
"\"",
"\"",
"]",
"!=",
"\"",
"\"",
"{",
"p",
",",
"err",
"=",
"strconv",
".",
"ParseInt",
"(",
"section",
"[",
"\"",
"\"",
"]",
",",
"10",
",",
"0",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"section",
"[",
"\"",
"\"",
"]",
",",
"schema",
".",
"Name",
",",
"err",
")",
"\n",
"}",
"\n",
"}",
"\n",
"schema",
".",
"Priority",
"=",
"int64",
"(",
"p",
")",
"<<",
"32",
"-",
"int64",
"(",
"i",
")",
"// to sort records with same priority by position in file",
"\n\n",
"schemas",
"=",
"append",
"(",
"schemas",
",",
"schema",
")",
"\n",
"}",
"\n\n",
"sort",
".",
"Sort",
"(",
"schemas",
")",
"\n",
"return",
"schemas",
",",
"nil",
"\n",
"}"
] |
8,656 | all-8657 | [
"pack28",
"packs",
"28",
"values",
"from",
"in",
"using",
"1",
"bit",
"each"
] | [
"func",
"pack28",
"(",
"in",
"[",
"]",
"uint32",
")",
"uint32",
"{",
"return",
"in",
"[",
"0",
"]",
"|",
"in",
"[",
"1",
"]",
"<<",
"1",
"|",
"in",
"[",
"2",
"]",
"<<",
"2",
"|",
"in",
"[",
"3",
"]",
"<<",
"3",
"|",
"in",
"[",
"4",
"]",
"<<",
"4",
"|",
"in",
"[",
"5",
"]",
"<<",
"5",
"|",
"in",
"[",
"6",
"]",
"<<",
"6",
"|",
"in",
"[",
"7",
"]",
"<<",
"7",
"|",
"in",
"[",
"8",
"]",
"<<",
"8",
"|",
"in",
"[",
"9",
"]",
"<<",
"9",
"|",
"in",
"[",
"10",
"]",
"<<",
"10",
"|",
"in",
"[",
"11",
"]",
"<<",
"11",
"|",
"<mask>",
"[",
"12",
"]",
"<<",
"12",
"|",
"in",
"[",
"13",
"]",
"<<",
"13",
"|",
"in",
"[",
"14",
"]",
"<<",
"14",
"|",
"in",
"[",
"15",
"]",
"<<",
"15",
"|",
"in",
"[",
"16",
"]",
"<<",
"16",
"|",
"in",
"[",
"17",
"]",
"<<",
"17",
"|",
"in",
"[",
"18",
"]",
"<<",
"18",
"|",
"in",
"[",
"19",
"]",
"<<",
"19",
"|",
"in",
"[",
"20",
"]",
"<<",
"20",
"|",
"in",
"[",
"21",
"]",
"<<",
"21",
"|",
"in",
"[",
"22",
"]",
"<<",
"22",
"|",
"in",
"[",
"23",
"]",
"<<",
"23",
"|",
"in",
"[",
"24",
"]",
"<<",
"24",
"|",
"in",
"[",
"25",
"]",
"<<",
"25",
"|",
"in",
"[",
"26",
"]",
"<<",
"26",
"|",
"in",
"[",
"27",
"]",
"<<",
"27",
"\n",
"}"
] |
8,657 | all-8658 | [
"GetVerified",
"returns",
"the",
"Verified",
"field",
"if",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"."
] | [
"func",
"(",
"u",
"*",
"<mask>",
")",
"GetVerified",
"(",
")",
"bool",
"{",
"if",
"u",
"==",
"nil",
"||",
"u",
".",
"Verified",
"==",
"nil",
"{",
"return",
"false",
"\n",
"}",
"\n",
"return",
"*",
"u",
".",
"Verified",
"\n",
"}"
] |
8,658 | all-8659 | [
"Read",
"the",
"secret",
"associated",
"with",
"some",
"key",
".",
"If",
"the",
"secret",
"has",
"recently",
"expired",
"the",
"response",
"code",
"410",
"is",
"returned",
".",
"If",
"the",
"caller",
"lacks",
"the",
"scope",
"necessary",
"to",
"get",
"the",
"secret",
"the",
"call",
"will",
"fail",
"with",
"a",
"403",
"code",
"regardless",
"of",
"whether",
"the",
"secret",
"exists",
".",
"Required",
"scopes",
":",
"secrets",
":",
"get",
":",
"<name",
">",
"See",
"#get"
] | [
"func",
"(",
"secrets",
"*",
"Secrets",
")",
"Get",
"(",
"name",
"string",
")",
"(",
"*",
"Secret",
",",
"error",
")",
"{",
"cd",
":=",
"tcclient",
".",
"Client",
"(",
"*",
"secrets",
")",
"\n",
"responseObject",
",",
"_",
",",
"err",
":=",
"(",
"&",
"cd",
")",
".",
"APICall",
"(",
"nil",
",",
"\"",
"\"",
",",
"\"",
"\"",
"+",
"<mask>",
".",
"QueryEscape",
"(",
"name",
")",
",",
"new",
"(",
"Secret",
")",
",",
"nil",
")",
"\n",
"return",
"responseObject",
".",
"(",
"*",
"Secret",
")",
",",
"err",
"\n",
"}"
] |
8,659 | all-8660 | [
"configures",
"element",
"array",
"buffer",
"binding",
"of",
"a",
"vertex",
"array",
"object"
] | [
"func",
"VertexArrayElementBuffer",
"(",
"vaobj",
"uint32",
",",
"buffer",
"uint32",
")",
"{",
"C",
".",
"glowVertexArrayElementBuffer",
"(",
"gpVertexArrayElementBuffer",
",",
"(",
"C",
".",
"GLuint",
")",
"(",
"vaobj",
")",
",",
"(",
"C",
".",
"GLuint",
")",
"(",
"<mask>",
")",
")",
"\n",
"}"
] |
8,660 | all-8661 | [
"HTTPUnmarshalRequestBodyJSON",
"reads",
"a",
"http",
".",
"Request",
"body",
"and",
"unmarshals",
"it",
"as",
"JSON",
"to",
"result",
"."
] | [
"func",
"HTTPUnmarshalRequestBodyJSON",
"(",
"request",
"*",
"http",
".",
"<mask>",
",",
"result",
"interface",
"{",
"}",
")",
"error",
"{",
"defer",
"request",
".",
"Body",
".",
"Close",
"(",
")",
"\n",
"body",
",",
"err",
":=",
"ioutil",
".",
"ReadAll",
"(",
"request",
".",
"Body",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"return",
"json",
".",
"Unmarshal",
"(",
"body",
",",
"result",
")",
"\n",
"}"
] |
8,661 | all-8662 | [
"joinSubstreams",
"waits",
"for",
"all",
"substream",
"goroutines",
"to",
"complete",
"."
] | [
"func",
"(",
"w",
"*",
"watchGrpcStream",
")",
"joinSubstreams",
"(",
")",
"{",
"for",
"_",
",",
"ws",
":=",
"range",
"w",
".",
"substreams",
"{",
"<-",
"<mask>",
".",
"donec",
"\n",
"}",
"\n",
"for",
"_",
",",
"ws",
":=",
"range",
"w",
".",
"resuming",
"{",
"if",
"ws",
"!=",
"nil",
"{",
"<-",
"ws",
".",
"donec",
"\n",
"}",
"\n",
"}",
"\n",
"}"
] |
8,662 | all-8663 | [
"TimestampValidator",
"will",
"set",
"timestamp",
"fields",
"on",
"create",
"and",
"update",
"operations",
".",
"The",
"fields",
"are",
"inferred",
"from",
"the",
"model",
"using",
"the",
"fire",
"-",
"created",
"-",
"timestamp",
"and",
"fire",
"-",
"updated",
"-",
"timestamp",
"flags",
".",
"Missing",
"created",
"timestamps",
"are",
"retroactively",
"set",
"using",
"the",
"timestamp",
"encoded",
"in",
"the",
"model",
"id",
"."
] | [
"func",
"TimestampValidator",
"(",
")",
"*",
"Callback",
"{",
"return",
"C",
"(",
"\"",
"\"",
",",
"Only",
"(",
"Create",
",",
"Update",
")",
",",
"func",
"(",
"ctx",
"*",
"Context",
")",
"error",
"{",
"// get time",
"now",
":=",
"time",
".",
"Now",
"(",
")",
"\n\n",
"// get timestamp fields",
"ctf",
":=",
"coal",
".",
"L",
"(",
"ctx",
".",
"Model",
",",
"\"",
"\"",
",",
"false",
")",
"\n",
"utf",
":=",
"coal",
".",
"L",
"(",
"ctx",
".",
"Model",
",",
"\"",
"\"",
",",
"false",
")",
"\n\n",
"// set created timestamp on creation and set missing create timestamps",
"// to the timestamp inferred from the model id",
"if",
"ctf",
"!=",
"\"",
"\"",
"{",
"if",
"ctx",
".",
"Operation",
"==",
"Create",
"{",
"ctx",
".",
"Model",
".",
"MustSet",
"(",
"ctf",
",",
"now",
")",
"\n",
"}",
"else",
"if",
"t",
":=",
"ctx",
".",
"Model",
".",
"MustGet",
"(",
"ctf",
")",
".",
"(",
"<mask>",
".",
"Time",
")",
";",
"t",
".",
"IsZero",
"(",
")",
"{",
"ctx",
".",
"Model",
".",
"MustSet",
"(",
"ctf",
",",
"ctx",
".",
"Model",
".",
"ID",
"(",
")",
".",
"Time",
"(",
")",
")",
"\n",
"}",
"\n",
"}",
"\n\n",
"// always set updated timestamp",
"if",
"utf",
"!=",
"\"",
"\"",
"{",
"ctx",
".",
"Model",
".",
"MustSet",
"(",
"utf",
",",
"now",
")",
"\n",
"}",
"\n\n",
"return",
"nil",
"\n",
"}",
")",
"\n",
"}"
] |
8,663 | all-8664 | [
"failed",
"indicates",
"the",
"reader",
"failed"
] | [
"func",
"(",
"r",
"*",
"reqResReader",
")",
"<mask>",
"(",
"err",
"error",
")",
"error",
"{",
"r",
".",
"log",
".",
"Debugf",
"(",
"\"",
"\"",
",",
"err",
",",
"r",
".",
"err",
")",
"\n",
"if",
"r",
".",
"err",
"!=",
"nil",
"{",
"return",
"r",
".",
"err",
"\n",
"}",
"\n\n",
"r",
".",
"mex",
".",
"shutdown",
"(",
")",
"\n",
"r",
".",
"err",
"=",
"err",
"\n",
"return",
"r",
".",
"err",
"\n",
"}"
] |
8,664 | all-8665 | [
"AddRemoteRelease",
"-",
"adds",
"a",
"remote",
"release",
"to",
"the",
"manifest",
".",
"Url",
"should",
"not",
"contain",
"version",
"information"
] | [
"func",
"(",
"s",
"*",
"DeploymentManifest",
")",
"AddRemoteRelease",
"(",
"releaseName",
",",
"<mask>",
",",
"url",
",",
"sha1",
"string",
")",
"(",
"err",
"error",
")",
"{",
"s",
".",
"Releases",
"=",
"append",
"(",
"s",
".",
"Releases",
",",
"Release",
"{",
"Name",
":",
"releaseName",
",",
"URL",
":",
"url",
",",
"SHA1",
":",
"sha1",
",",
"Version",
":",
"ver",
",",
"}",
")",
"\n",
"return",
"\n",
"}"
] |
8,665 | all-8666 | [
"Convenience",
"method",
"which",
"just",
"delegates",
"to",
"mgo",
".",
"Note",
"that",
"hooks",
"are",
"NOT",
"run"
] | [
"func",
"(",
"c",
"*",
"Collection",
")",
"Delete",
"(",
"query",
"bson",
".",
"M",
")",
"(",
"*",
"mgo",
".",
"ChangeInfo",
",",
"error",
")",
"{",
"sess",
":=",
"c",
".",
"<mask>",
".",
"Session",
".",
"Clone",
"(",
")",
"\n",
"defer",
"sess",
".",
"Close",
"(",
")",
"\n",
"col",
":=",
"c",
".",
"collectionOnSession",
"(",
"sess",
")",
"\n",
"return",
"col",
".",
"RemoveAll",
"(",
"query",
")",
"\n",
"}"
] |
8,666 | all-8667 | [
"GetMetricOk",
"returns",
"a",
"tuple",
"with",
"the",
"Metric",
"field",
"if",
"it",
"s",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"and",
"a",
"boolean",
"to",
"check",
"if",
"the",
"value",
"has",
"been",
"set",
"."
] | [
"func",
"(",
"s",
"*",
"Series",
")",
"GetMetricOk",
"(",
")",
"(",
"string",
",",
"bool",
")",
"{",
"if",
"s",
"==",
"nil",
"||",
"s",
".",
"Metric",
"==",
"nil",
"{",
"return",
"\"",
"\"",
",",
"false",
"\n",
"}",
"\n",
"return",
"*",
"s",
".",
"Metric",
",",
"<mask>",
"\n",
"}"
] |
8,667 | all-8668 | [
"insertChild",
"registers",
"given",
"node",
"in",
"the",
"route",
"node",
"tree",
"If",
"there",
"is",
"already",
"a",
"similar",
"node",
"it",
"will",
"not",
"insert",
"new",
"node",
"The",
"returned",
"node",
"is",
"always",
"the",
"registered",
"one",
"ie",
"either",
"newly",
"registered",
"or",
"the",
"old",
"one"
] | [
"func",
"(",
"n",
"*",
"routeNode",
")",
"insertChild",
"(",
"nn",
"*",
"routeNode",
")",
"*",
"routeNode",
"{",
"if",
"child",
":=",
"n",
".",
"findChild",
"(",
"nn",
")",
";",
"child",
"!=",
"nil",
"{",
"return",
"child",
"\n",
"}",
"\n\n",
"if",
"n",
".",
"paramChild",
"!=",
"nil",
"&&",
"nn",
".",
"paramNode",
"{",
"// only allow one param child, unique param name",
"if",
"n",
".",
"paramChild",
".",
"paramName",
"!=",
"nn",
".",
"paramName",
"{",
"panic",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"return",
"n",
".",
"paramChild",
"\n",
"}",
"\n",
"if",
"nn",
".",
"paramNode",
"{",
"n",
".",
"paramChild",
"=",
"nn",
"\n",
"}",
"else",
"{",
"n",
".",
"<mask>",
"=",
"append",
"(",
"n",
".",
"children",
",",
"nn",
")",
"\n",
"}",
"\n",
"return",
"nn",
"\n",
"}"
] |
8,668 | all-8669 | [
"GetMinWidth",
"()",
"is",
"a",
"wrapper",
"around",
"gtk_tree_view_column_get_min_width",
"()",
"."
] | [
"func",
"(",
"v",
"*",
"TreeViewColumn",
")",
"GetMinWidth",
"(",
")",
"int",
"{",
"c",
":=",
"C",
".",
"gtk_tree_view_column_get_min_width",
"(",
"v",
".",
"native",
"(",
")",
")",
"\n",
"<mask>",
"int",
"(",
"c",
")",
"\n",
"}"
] |
8,669 | all-8670 | [
"GetId",
"returns",
"the",
"Id",
"field",
"if",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"."
] | [
"func",
"(",
"s",
"*",
"SyntheticsDevice",
")",
"GetId",
"(",
")",
"string",
"{",
"if",
"s",
"==",
"nil",
"||",
"s",
".",
"<mask>",
"==",
"nil",
"{",
"return",
"\"",
"\"",
"\n",
"}",
"\n",
"return",
"*",
"s",
".",
"Id",
"\n",
"}"
] |
8,670 | all-8671 | [
"sendENIStateChange",
"handles",
"the",
"eni",
"event",
"from",
"udev",
"or",
"reconcile",
"phase"
] | [
"func",
"(",
"udevWatcher",
"*",
"UdevWatcher",
")",
"sendENIStateChange",
"(",
"mac",
"string",
")",
"error",
"{",
"if",
"mac",
"==",
"\"",
"\"",
"{",
"return",
"errors",
".",
"New",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"// check if this is an eni required by a task",
"eni",
",",
"ok",
":=",
"udevWatcher",
".",
"agentState",
".",
"ENIByMac",
"(",
"mac",
")",
"\n",
"if",
"!",
"ok",
"{",
"return",
"&",
"unmanagedENIError",
"{",
"mac",
"}",
"\n",
"}",
"\n",
"if",
"eni",
".",
"IsSent",
"(",
")",
"{",
"return",
"errors",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"eni",
".",
"String",
"(",
")",
")",
"\n",
"}",
"\n",
"if",
"eni",
".",
"HasExpired",
"(",
")",
"{",
"// Agent is aware of the ENI, but we decide not to ack it",
"// as it's ack timeout has expired",
"udevWatcher",
".",
"agentState",
".",
"RemoveENIAttachment",
"(",
"eni",
".",
"MACAddress",
")",
"\n",
"return",
"errors",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"eni",
".",
"String",
"(",
")",
")",
"\n",
"}",
"\n\n",
"// We found an ENI, which has the expiration time set in future and",
"// needs to be acknowledged as having been 'attached' to the Instance",
"go",
"func",
"(",
"eni",
"*",
"apieni",
".",
"ENIAttachment",
")",
"{",
"eni",
".",
"Status",
"=",
"apieni",
".",
"ENIAttached",
"\n",
"log",
".",
"Infof",
"(",
"\"",
"\"",
",",
"eni",
".",
"<mask>",
"(",
")",
")",
"\n",
"udevWatcher",
".",
"eniChangeEvent",
"<-",
"api",
".",
"TaskStateChange",
"{",
"TaskARN",
":",
"eni",
".",
"TaskARN",
",",
"Attachment",
":",
"eni",
",",
"}",
"\n",
"}",
"(",
"eni",
")",
"\n",
"return",
"nil",
"\n",
"}"
] |
8,671 | all-8672 | [
"Less",
"helps",
"implement",
"sort",
".",
"Interface",
"for",
"MoRefSorter",
"."
] | [
"func",
"(",
"s",
"MoRefSorter",
")",
"Less",
"(",
"i",
",",
"j",
"int",
")",
"bool",
"{",
"return",
"s",
"[",
"i",
"]",
".",
"<mask>",
"<",
"s",
"[",
"j",
"]",
".",
"Value",
"\n",
"}"
] |
8,672 | all-8673 | [
"Set",
"is",
"required",
"for",
"kingpin",
"interfaces",
"to",
"allow",
"command",
"line",
"params",
"to",
"be",
"set",
"to",
"our",
"map",
"datatype"
] | [
"func",
"(",
"o",
"*",
"ListBoolOption",
")",
"<mask>",
"(",
"value",
"string",
")",
"error",
"{",
"val",
":=",
"BoolOption",
"{",
"}",
"\n",
"val",
".",
"Set",
"(",
"value",
")",
"\n",
"*",
"o",
"=",
"append",
"(",
"*",
"o",
",",
"val",
")",
"\n",
"return",
"nil",
"\n",
"}"
] |
8,673 | all-8674 | [
"returns",
"a",
"list",
"of",
"countries",
"where",
"Twilio",
"messaging",
"services",
"are",
"available",
"and",
"the",
"corresponding",
"URL",
"for",
"retrieving",
"the",
"country",
"specific",
"messaging",
"prices",
"."
] | [
"func",
"(",
"cmps",
"*",
"CountryMessagingPriceService",
")",
"GetPage",
"(",
"ctx",
"context",
".",
"Context",
",",
"data",
"url",
".",
"Values",
")",
"(",
"*",
"CountriesPricePage",
",",
"error",
")",
"{",
"return",
"cmps",
".",
"GetPageIterator",
"(",
"<mask>",
")",
".",
"Next",
"(",
"ctx",
")",
"\n",
"}"
] |
8,674 | all-8675 | [
"newConsole",
"returns",
"an",
"initalized",
"console",
"that",
"can",
"be",
"used",
"within",
"a",
"container",
"by",
"copying",
"bytes",
"from",
"the",
"master",
"side",
"to",
"the",
"slave",
"that",
"is",
"attached",
"as",
"the",
"tty",
"for",
"the",
"container",
"s",
"init",
"process",
"."
] | [
"func",
"newConsole",
"(",
"uid",
",",
"gid",
"int",
")",
"(",
"Console",
",",
"error",
")",
"{",
"master",
",",
"err",
":=",
"os",
".",
"OpenFile",
"(",
"\"",
"\"",
",",
"syscall",
".",
"O_RDWR",
"|",
"syscall",
".",
"O_NOCTTY",
"|",
"syscall",
".",
"O_CLOEXEC",
",",
"0",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"console",
",",
"err",
":=",
"ptsname",
"(",
"<mask>",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"if",
"err",
":=",
"unlockpt",
"(",
"master",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"if",
"err",
":=",
"os",
".",
"Chmod",
"(",
"console",
",",
"0600",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"if",
"err",
":=",
"os",
".",
"Chown",
"(",
"console",
",",
"uid",
",",
"gid",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"return",
"&",
"linuxConsole",
"{",
"slavePath",
":",
"console",
",",
"master",
":",
"master",
",",
"}",
",",
"nil",
"\n",
"}"
] |
8,675 | all-8676 | [
"newRawClient",
"creates",
"an",
"http",
"package",
"Client",
"taking",
"into",
"account",
"both",
"the",
"parameters",
"and",
"package",
"variables",
"."
] | [
"func",
"newRawClient",
"(",
"noRedirect",
",",
"noCertCheck",
",",
"disableKeepAlives",
"bool",
",",
"responseHeaderTimeout",
"time",
".",
"Duration",
")",
"*",
"http",
".",
"Client",
"{",
"tr",
":=",
"http",
".",
"Transport",
"{",
"DisableKeepAlives",
":",
"disableKeepAlives",
",",
"ResponseHeaderTimeout",
":",
"responseHeaderTimeout",
",",
"Proxy",
":",
"http",
".",
"ProxyFromEnvironment",
",",
"}",
"\n",
"tr",
".",
"TLSClientConfig",
"=",
"&",
"tls",
".",
"Config",
"{",
"InsecureSkipVerify",
":",
"noCertCheck",
"}",
"\n",
"c",
":=",
"http",
".",
"Client",
"{",
"Transport",
":",
"&",
"tr",
"}",
"\n",
"if",
"noRedirect",
"{",
"c",
".",
"CheckRedirect",
"=",
"func",
"(",
"*",
"http",
".",
"Request",
",",
"[",
"]",
"*",
"http",
".",
"<mask>",
")",
"error",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"noRedirectError",
")",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"&",
"c",
"\n",
"}"
] |
8,676 | all-8677 | [
"putBuffer",
"returns",
"a",
"buffer",
"to",
"the",
"free",
"list",
"."
] | [
"func",
"(",
"l",
"*",
"Log",
")",
"putBuffer",
"(",
"b",
"*",
"buffer",
")",
"{",
"if",
"b",
".",
"Len",
"(",
")",
">=",
"256",
"{",
"// Let big buffers die a natural death.",
"return",
"\n",
"}",
"\n",
"l",
".",
"freeListMu",
".",
"Lock",
"(",
")",
"\n",
"b",
".",
"<mask>",
"=",
"l",
".",
"freeList",
"\n",
"l",
".",
"freeList",
"=",
"b",
"\n",
"l",
".",
"freeListMu",
".",
"Unlock",
"(",
")",
"\n",
"}"
] |
8,677 | all-8678 | [
"title",
":",
"service",
"update",
"path",
":",
"/",
"services",
"/",
"{",
"name",
"}",
"method",
":",
"PUT",
"consume",
":",
"application",
"/",
"x",
"-",
"www",
"-",
"form",
"-",
"urlencoded",
"responses",
":",
"200",
":",
"Service",
"updated",
"400",
":",
"Invalid",
"data",
"401",
":",
"Unauthorized",
"403",
":",
"Forbidden",
"(",
"team",
"is",
"not",
"the",
"owner",
")",
"404",
":",
"Service",
"not",
"found"
] | [
"func",
"serviceUpdate",
"(",
"w",
"http",
".",
"ResponseWriter",
",",
"r",
"*",
"http",
".",
"Request",
",",
"t",
"auth",
".",
"Token",
")",
"(",
"err",
"error",
")",
"{",
"d",
":=",
"service",
".",
"Service",
"{",
"Username",
":",
"InputValue",
"(",
"r",
",",
"\"",
"\"",
")",
",",
"Endpoint",
":",
"map",
"[",
"string",
"]",
"string",
"{",
"\"",
"\"",
":",
"InputValue",
"(",
"r",
",",
"\"",
"\"",
")",
"}",
",",
"Password",
":",
"InputValue",
"(",
"r",
",",
"\"",
"\"",
")",
",",
"Name",
":",
"r",
".",
"URL",
".",
"Query",
"(",
")",
".",
"Get",
"(",
"\"",
"\"",
")",
",",
"}",
"\n",
"team",
":=",
"InputValue",
"(",
"r",
",",
"\"",
"\"",
")",
"\n",
"s",
",",
"err",
":=",
"getService",
"(",
"d",
".",
"<mask>",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"allowed",
":=",
"permission",
".",
"Check",
"(",
"t",
",",
"permission",
".",
"PermServiceUpdate",
",",
"contextsForServiceProvision",
"(",
"&",
"s",
")",
"...",
",",
")",
"\n",
"if",
"!",
"allowed",
"{",
"return",
"permission",
".",
"ErrUnauthorized",
"\n",
"}",
"\n",
"delete",
"(",
"r",
".",
"Form",
",",
"\"",
"\"",
")",
"\n",
"evt",
",",
"err",
":=",
"event",
".",
"New",
"(",
"&",
"event",
".",
"Opts",
"{",
"Target",
":",
"serviceTarget",
"(",
"s",
".",
"Name",
")",
",",
"Kind",
":",
"permission",
".",
"PermServiceUpdate",
",",
"Owner",
":",
"t",
",",
"CustomData",
":",
"event",
".",
"FormToCustomData",
"(",
"InputFields",
"(",
"r",
")",
")",
",",
"Allowed",
":",
"event",
".",
"Allowed",
"(",
"permission",
".",
"PermServiceReadEvents",
",",
"contextsForServiceProvision",
"(",
"&",
"s",
")",
"...",
")",
",",
"}",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"defer",
"func",
"(",
")",
"{",
"evt",
".",
"Done",
"(",
"err",
")",
"}",
"(",
")",
"\n",
"s",
".",
"Endpoint",
"=",
"d",
".",
"Endpoint",
"\n",
"s",
".",
"Password",
"=",
"d",
".",
"Password",
"\n",
"s",
".",
"Username",
"=",
"d",
".",
"Username",
"\n",
"if",
"team",
"!=",
"\"",
"\"",
"{",
"s",
".",
"OwnerTeams",
"=",
"[",
"]",
"string",
"{",
"team",
"}",
"\n",
"}",
"\n",
"return",
"service",
".",
"Update",
"(",
"s",
")",
"\n",
"}"
] |
8,678 | all-8679 | [
"NewAWSSDRegistry",
"returns",
"implementation",
"of",
"registry",
"for",
"AWS",
"SD"
] | [
"func",
"NewAWSSDRegistry",
"(",
"provider",
"provider",
".",
"<mask>",
",",
"ownerID",
"string",
")",
"(",
"*",
"AWSSDRegistry",
",",
"error",
")",
"{",
"if",
"ownerID",
"==",
"\"",
"\"",
"{",
"return",
"nil",
",",
"errors",
".",
"New",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"return",
"&",
"AWSSDRegistry",
"{",
"provider",
":",
"provider",
",",
"ownerID",
":",
"ownerID",
",",
"}",
",",
"nil",
"\n",
"}"
] |
8,679 | all-8680 | [
"UnmarshalJSON",
"supports",
"json",
".",
"Unmarshaler",
"interface"
] | [
"func",
"(",
"v",
"*",
"EventDomStorageItemUpdated",
")",
"UnmarshalJSON",
"(",
"data",
"[",
"]",
"byte",
")",
"error",
"{",
"r",
":=",
"jlexer",
".",
"Lexer",
"{",
"Data",
":",
"<mask>",
"}",
"\n",
"easyjsonC5a4559bDecodeGithubComChromedpCdprotoDomstorage6",
"(",
"&",
"r",
",",
"v",
")",
"\n",
"return",
"r",
".",
"Error",
"(",
")",
"\n",
"}"
] |
8,680 | all-8681 | [
"UnmarshalText",
"hydrates",
"this",
"instance",
"from",
"text"
] | [
"func",
"(",
"r",
"*",
"RGBColor",
")",
"UnmarshalText",
"(",
"<mask>",
"[",
"]",
"byte",
")",
"error",
"{",
"// validation is performed later on",
"*",
"r",
"=",
"RGBColor",
"(",
"string",
"(",
"data",
")",
")",
"\n",
"return",
"nil",
"\n",
"}"
] |
8,681 | all-8682 | [
"Specify",
"the",
"value",
"of",
"a",
"uniform",
"variable",
"for",
"the",
"current",
"program",
"object"
] | [
"func",
"Uniform3iv",
"(",
"location",
"int32",
",",
"count",
"int32",
",",
"<mask>",
"*",
"int32",
")",
"{",
"C",
".",
"glowUniform3iv",
"(",
"gpUniform3iv",
",",
"(",
"C",
".",
"GLint",
")",
"(",
"location",
")",
",",
"(",
"C",
".",
"GLsizei",
")",
"(",
"count",
")",
",",
"(",
"*",
"C",
".",
"GLint",
")",
"(",
"unsafe",
".",
"Pointer",
"(",
"value",
")",
")",
")",
"\n",
"}"
] |
8,682 | all-8683 | [
"Logf",
"is",
"a",
"sentinel",
"option",
"to",
"set",
"a",
"logger",
"."
] | [
"func",
"Logf",
"(",
"f",
"func",
"(",
"string",
",",
"...",
"<mask>",
"{",
"}",
")",
")",
"Option",
"{",
"return",
"func",
"(",
"s",
"*",
"Sentinel",
")",
"error",
"{",
"s",
".",
"logf",
"=",
"f",
"\n",
"return",
"nil",
"\n",
"}",
"\n",
"}"
] |
8,683 | all-8684 | [
"ParseTarget",
"parses",
"a",
"endpoint",
":",
"//",
"<id",
">",
"/",
"<endpoint",
">",
"string",
"and",
"returns",
"the",
"parsed",
"id",
"and",
"endpoint",
".",
"If",
"the",
"target",
"is",
"malformed",
"an",
"error",
"is",
"returned",
"."
] | [
"func",
"ParseTarget",
"(",
"target",
"string",
")",
"(",
"string",
",",
"string",
",",
"error",
")",
"{",
"noPrefix",
":=",
"strings",
".",
"TrimPrefix",
"(",
"target",
",",
"targetPrefix",
")",
"\n",
"if",
"noPrefix",
"==",
"target",
"{",
"return",
"\"",
"\"",
",",
"\"",
"\"",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"targetPrefix",
",",
"target",
")",
"\n",
"}",
"\n",
"parts",
":=",
"strings",
".",
"SplitN",
"(",
"noPrefix",
",",
"\"",
"\"",
",",
"2",
")",
"\n",
"if",
"len",
"(",
"parts",
")",
"!=",
"2",
"{",
"return",
"\"",
"\"",
",",
"\"",
"\"",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"scheme",
",",
"<mask>",
")",
"\n",
"}",
"\n",
"return",
"parts",
"[",
"0",
"]",
",",
"parts",
"[",
"1",
"]",
",",
"nil",
"\n",
"}"
] |
8,684 | all-8685 | [
"LineCount",
"returns",
"the",
"number",
"of",
"recorded",
"lines",
"since",
"the",
"beginning",
"of",
"the",
"process",
"."
] | [
"func",
"(",
"ep",
"*",
"ExpectProcess",
")",
"LineCount",
"(",
")",
"int",
"{",
"ep",
".",
"mu",
".",
"Lock",
"(",
")",
"\n",
"defer",
"ep",
".",
"mu",
".",
"Unlock",
"(",
")",
"\n",
"return",
"ep",
".",
"<mask>",
"\n",
"}"
] |
8,685 | all-8686 | [
"HasStyle",
"returns",
"a",
"boolean",
"if",
"a",
"field",
"has",
"been",
"set",
"."
] | [
"func",
"(",
"t",
"*",
"TimeseriesRequest",
")",
"HasStyle",
"(",
")",
"bool",
"{",
"if",
"t",
"!=",
"nil",
"&&",
"t",
".",
"Style",
"!=",
"nil",
"{",
"return",
"<mask>",
"\n",
"}",
"\n\n",
"return",
"false",
"\n",
"}"
] |
8,686 | all-8687 | [
"NewClientWithDialer",
"creates",
"a",
"new",
"Livestatus",
"client",
"instance",
"using",
"a",
"provided",
"network",
"dialer",
"."
] | [
"func",
"NewClientWithDialer",
"(",
"<mask>",
",",
"address",
"string",
",",
"dialer",
"*",
"net",
".",
"Dialer",
")",
"*",
"Client",
"{",
"return",
"&",
"Client",
"{",
"network",
":",
"network",
",",
"address",
":",
"address",
",",
"dialer",
":",
"dialer",
",",
"}",
"\n",
"}"
] |
8,687 | all-8688 | [
"newDigitalOceanChanges",
"returns",
"a",
"collection",
"of",
"Changes",
"based",
"on",
"the",
"given",
"records",
"and",
"action",
"."
] | [
"func",
"newDigitalOceanChanges",
"(",
"action",
"string",
",",
"endpoints",
"[",
"]",
"*",
"endpoint",
".",
"Endpoint",
")",
"[",
"]",
"*",
"DigitalOceanChange",
"{",
"changes",
":=",
"make",
"(",
"[",
"]",
"*",
"DigitalOceanChange",
",",
"0",
",",
"len",
"(",
"endpoints",
")",
")",
"\n\n",
"for",
"_",
",",
"endpoint",
":=",
"range",
"endpoints",
"{",
"changes",
"=",
"<mask>",
"(",
"changes",
",",
"newDigitalOceanChange",
"(",
"action",
",",
"endpoint",
")",
")",
"\n",
"}",
"\n\n",
"return",
"changes",
"\n",
"}"
] |
8,688 | all-8689 | [
"tagByName",
"converts",
"a",
"tag",
"name",
"into",
"its",
"ID",
"."
] | [
"func",
"tagByName",
"(",
"ctx",
"context",
".",
"Context",
",",
"client",
"*",
"tags",
".",
"RestClient",
",",
"name",
",",
"categoryID",
"string",
")",
"(",
"string",
",",
"error",
")",
"{",
"tids",
",",
"err",
":=",
"client",
".",
"GetTagByNameForCategory",
"(",
"ctx",
",",
"<mask>",
",",
"categoryID",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"\"",
"\"",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"name",
",",
"err",
")",
"\n",
"}",
"\n\n",
"if",
"len",
"(",
"tids",
")",
"<",
"1",
"{",
"return",
"\"",
"\"",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"name",
",",
"categoryID",
")",
"\n",
"}",
"\n",
"if",
"len",
"(",
"tids",
")",
">",
"1",
"{",
"// This situation is very similar to the one in tagCategoryByName. The API",
"// docs even say that tags need to be unique in categories, yet",
"// GetTagByNameForCategory still returns multiple results.",
"return",
"\"",
"\"",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"name",
")",
"\n",
"}",
"\n\n",
"logger",
".",
"Printf",
"(",
"\"",
"\"",
",",
"tids",
"[",
"0",
"]",
".",
"ID",
")",
"\n",
"return",
"tids",
"[",
"0",
"]",
".",
"ID",
",",
"nil",
"\n",
"}"
] |
8,689 | all-8690 | [
"BroadcastTopologyUpdate",
"is",
"invoked",
"whenever",
"there",
"is",
"a",
"change",
"to",
"the",
"mesh",
"topology",
"and",
"broadcasts",
"the",
"new",
"set",
"of",
"peers",
"to",
"the",
"mesh",
"."
] | [
"func",
"(",
"router",
"*",
"Router",
")",
"broadcastTopologyUpdate",
"(",
"update",
"[",
"]",
"*",
"Peer",
")",
"{",
"names",
":=",
"make",
"(",
"peerNameSet",
")",
"\n",
"for",
"_",
",",
"p",
":=",
"range",
"update",
"{",
"<mask>",
"[",
"p",
".",
"Name",
"]",
"=",
"struct",
"{",
"}",
"{",
"}",
"\n",
"}",
"\n",
"router",
".",
"topologyGossip",
".",
"GossipBroadcast",
"(",
"&",
"topologyGossipData",
"{",
"peers",
":",
"router",
".",
"Peers",
",",
"update",
":",
"names",
"}",
")",
"\n",
"}"
] |
8,690 | all-8691 | [
"DeepCopy",
"copies",
"the",
"receiver",
"into",
"a",
"new",
"IPv6",
"."
] | [
"func",
"(",
"u",
"*",
"IPv6",
")",
"DeepCopy",
"(",
")",
"*",
"IPv6",
"{",
"if",
"u",
"==",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n",
"<mask>",
":=",
"new",
"(",
"IPv6",
")",
"\n",
"u",
".",
"DeepCopyInto",
"(",
"out",
")",
"\n",
"return",
"out",
"\n",
"}"
] |
8,691 | all-8692 | [
"GetImageURL",
"returns",
"the",
"ImageURL",
"field",
"if",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"."
] | [
"func",
"(",
"c",
"*",
"ConditionalFormat",
")",
"GetImageURL",
"(",
")",
"<mask>",
"{",
"if",
"c",
"==",
"nil",
"||",
"c",
".",
"ImageURL",
"==",
"nil",
"{",
"return",
"\"",
"\"",
"\n",
"}",
"\n",
"return",
"*",
"c",
".",
"ImageURL",
"\n",
"}"
] |
8,692 | all-8693 | [
"WriteTo",
"writes",
"data",
"to",
"w",
"."
] | [
"func",
"(",
"e",
"*",
"htmlTag",
")",
"WriteTo",
"(",
"w",
"io",
".",
"Writer",
")",
"(",
"int64",
",",
"error",
")",
"{",
"var",
"bf",
"bytes",
".",
"Buffer",
"\n\n",
"// Write an open tag.",
"bf",
".",
"WriteString",
"(",
"lt",
")",
"\n",
"bf",
".",
"WriteString",
"(",
"e",
".",
"tagName",
")",
"\n",
"// Write an id.",
"if",
"e",
".",
"id",
"!=",
"\"",
"\"",
"{",
"bf",
".",
"WriteString",
"(",
"space",
")",
"\n",
"bf",
".",
"WriteString",
"(",
"attributeNameID",
")",
"\n",
"bf",
".",
"WriteString",
"(",
"equal",
")",
"\n",
"bf",
".",
"WriteString",
"(",
"doubleQuote",
")",
"\n",
"bf",
".",
"WriteString",
"(",
"e",
".",
"id",
")",
"\n",
"bf",
".",
"WriteString",
"(",
"doubleQuote",
")",
"\n",
"}",
"\n",
"// Write classes.",
"if",
"len",
"(",
"e",
".",
"classes",
")",
">",
"0",
"{",
"bf",
".",
"WriteString",
"(",
"space",
")",
"\n",
"bf",
".",
"WriteString",
"(",
"e",
".",
"opts",
".",
"AttributeNameClass",
")",
"\n",
"bf",
".",
"WriteString",
"(",
"<mask>",
")",
"\n",
"bf",
".",
"WriteString",
"(",
"doubleQuote",
")",
"\n",
"for",
"i",
",",
"class",
":=",
"range",
"e",
".",
"classes",
"{",
"if",
"i",
">",
"0",
"{",
"bf",
".",
"WriteString",
"(",
"space",
")",
"\n",
"}",
"\n",
"bf",
".",
"WriteString",
"(",
"class",
")",
"\n",
"}",
"\n",
"bf",
".",
"WriteString",
"(",
"doubleQuote",
")",
"\n",
"}",
"\n",
"// Write attributes.",
"if",
"len",
"(",
"e",
".",
"attributes",
")",
">",
"0",
"{",
"for",
"_",
",",
"a",
":=",
"range",
"e",
".",
"attributes",
"{",
"bf",
".",
"WriteString",
"(",
"space",
")",
"\n",
"bf",
".",
"WriteString",
"(",
"a",
".",
"key",
")",
"\n",
"if",
"a",
".",
"value",
"!=",
"\"",
"\"",
"{",
"bf",
".",
"WriteString",
"(",
"equal",
")",
"\n",
"bf",
".",
"WriteString",
"(",
"doubleQuote",
")",
"\n",
"bf",
".",
"WriteString",
"(",
"a",
".",
"value",
")",
"\n",
"bf",
".",
"WriteString",
"(",
"doubleQuote",
")",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n",
"bf",
".",
"WriteString",
"(",
"gt",
")",
"\n\n",
"// Write a text value",
"if",
"e",
".",
"textValue",
"!=",
"\"",
"\"",
"{",
"if",
"e",
".",
"opts",
".",
"formatter",
"!=",
"nil",
"{",
"e",
".",
"opts",
".",
"formatter",
".",
"WritingTextValue",
"(",
"&",
"bf",
",",
"e",
")",
"\n",
"}",
"\n",
"bf",
".",
"WriteString",
"(",
"e",
".",
"textValue",
")",
"\n",
"}",
"\n\n",
"if",
"e",
".",
"containPlainText",
"{",
"bf",
".",
"WriteString",
"(",
"lf",
")",
"\n",
"}",
"\n\n",
"// Write children's HTML.",
"if",
"i",
",",
"err",
":=",
"e",
".",
"writeChildren",
"(",
"&",
"bf",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"i",
",",
"err",
"\n",
"}",
"\n\n",
"// Write a close tag.",
"if",
"!",
"e",
".",
"noCloseTag",
"(",
")",
"{",
"if",
"e",
".",
"opts",
".",
"formatter",
"!=",
"nil",
"{",
"e",
".",
"opts",
".",
"formatter",
".",
"ClosingElement",
"(",
"&",
"bf",
",",
"e",
")",
"\n",
"}",
"\n",
"bf",
".",
"WriteString",
"(",
"lt",
")",
"\n",
"bf",
".",
"WriteString",
"(",
"slash",
")",
"\n",
"bf",
".",
"WriteString",
"(",
"e",
".",
"tagName",
")",
"\n",
"bf",
".",
"WriteString",
"(",
"gt",
")",
"\n",
"}",
"\n\n",
"// Write the buffer.",
"i",
",",
"err",
":=",
"w",
".",
"Write",
"(",
"bf",
".",
"Bytes",
"(",
")",
")",
"\n\n",
"return",
"int64",
"(",
"i",
")",
",",
"err",
"\n",
"}"
] |
8,693 | all-8694 | [
"specify",
"a",
"three",
"-",
"dimensional",
"texture",
"subimage",
"in",
"a",
"compressed",
"format"
] | [
"func",
"CompressedTexSubImage3D",
"(",
"target",
"uint32",
",",
"level",
"int32",
",",
"xoffset",
"int32",
",",
"yoffset",
"int32",
",",
"zoffset",
"int32",
",",
"width",
"int32",
",",
"height",
"int32",
",",
"depth",
"int32",
",",
"format",
"uint32",
",",
"imageSize",
"int32",
",",
"data",
"unsafe",
".",
"Pointer",
")",
"{",
"syscall",
".",
"Syscall12",
"(",
"gpCompressedTexSubImage3D",
",",
"11",
",",
"uintptr",
"(",
"target",
")",
",",
"uintptr",
"(",
"level",
")",
",",
"uintptr",
"(",
"xoffset",
")",
",",
"uintptr",
"(",
"yoffset",
")",
",",
"uintptr",
"(",
"zoffset",
")",
",",
"uintptr",
"(",
"width",
")",
",",
"uintptr",
"(",
"<mask>",
")",
",",
"uintptr",
"(",
"depth",
")",
",",
"uintptr",
"(",
"format",
")",
",",
"uintptr",
"(",
"imageSize",
")",
",",
"uintptr",
"(",
"data",
")",
",",
"0",
")",
"\n",
"}"
] |
8,694 | all-8695 | [
"argsOrEnv",
"allows",
"you",
"to",
"pick",
"an",
"environmental",
"variable",
"for",
"a",
"setting",
"if",
"the",
"arg",
"is",
"not",
"set"
] | [
"func",
"argsOrEnv",
"(",
"args",
"map",
"[",
"string",
"]",
"string",
",",
"<mask>",
",",
"env",
"string",
")",
"string",
"{",
"if",
"value",
",",
"ok",
":=",
"args",
"[",
"key",
"]",
";",
"ok",
"{",
"return",
"value",
"\n",
"}",
"\n",
"return",
"os",
".",
"Getenv",
"(",
"env",
")",
"\n",
"}"
] |
8,695 | all-8696 | [
"UnmarshalJSON",
"supports",
"json",
".",
"Unmarshaler",
"interface"
] | [
"func",
"(",
"v",
"*",
"EventEntryAdded",
")",
"UnmarshalJSON",
"(",
"data",
"[",
"]",
"<mask>",
")",
"error",
"{",
"r",
":=",
"jlexer",
".",
"Lexer",
"{",
"Data",
":",
"data",
"}",
"\n",
"easyjsonC5a4559bDecodeGithubComChromedpCdprotoLog3",
"(",
"&",
"r",
",",
"v",
")",
"\n",
"return",
"r",
".",
"Error",
"(",
")",
"\n",
"}"
] |
8,696 | all-8697 | [
"bind",
"an",
"existing",
"texture",
"object",
"to",
"the",
"specified",
"texture",
"unit"
] | [
"func",
"BindTextureUnit",
"(",
"<mask>",
"uint32",
",",
"texture",
"uint32",
")",
"{",
"C",
".",
"glowBindTextureUnit",
"(",
"gpBindTextureUnit",
",",
"(",
"C",
".",
"GLuint",
")",
"(",
"unit",
")",
",",
"(",
"C",
".",
"GLuint",
")",
"(",
"texture",
")",
")",
"\n",
"}"
] |
8,697 | all-8698 | [
"PutManifest",
"writes",
"manifest",
"to",
"the",
"destination",
".",
"FIXME?",
"This",
"should",
"also",
"receive",
"a",
"MIME",
"type",
"if",
"known",
"to",
"differentiate",
"between",
"schema",
"versions",
".",
"If",
"the",
"destination",
"is",
"in",
"principle",
"available",
"refuses",
"this",
"manifest",
"type",
"(",
"e",
".",
"g",
".",
"it",
"does",
"not",
"recognize",
"the",
"schema",
")",
"but",
"may",
"accept",
"a",
"different",
"manifest",
"type",
"the",
"returned",
"error",
"must",
"be",
"an",
"ManifestTypeRejectedError",
"."
] | [
"func",
"(",
"d",
"*",
"Destination",
")",
"PutManifest",
"(",
"ctx",
"context",
".",
"Context",
",",
"m",
"[",
"]",
"byte",
")",
"error",
"{",
"// We do not bother with types.ManifestTypeRejectedError; our .SupportedManifestMIMETypes() above is already providing only one alternative,",
"// so the caller trying a different manifest kind would be pointless.",
"<mask>",
"man",
"manifest",
".",
"Schema2",
"\n",
"if",
"err",
":=",
"json",
".",
"Unmarshal",
"(",
"m",
",",
"&",
"man",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"errors",
".",
"Wrap",
"(",
"err",
",",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"if",
"man",
".",
"SchemaVersion",
"!=",
"2",
"||",
"man",
".",
"MediaType",
"!=",
"manifest",
".",
"DockerV2Schema2MediaType",
"{",
"return",
"errors",
".",
"Errorf",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"layerPaths",
",",
"lastLayerID",
",",
"err",
":=",
"d",
".",
"writeLegacyLayerMetadata",
"(",
"man",
".",
"LayersDescriptors",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"if",
"len",
"(",
"man",
".",
"LayersDescriptors",
")",
">",
"0",
"{",
"if",
"err",
":=",
"d",
".",
"createRepositoriesFile",
"(",
"lastLayerID",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"}",
"\n\n",
"repoTags",
":=",
"[",
"]",
"string",
"{",
"}",
"\n",
"for",
"_",
",",
"tag",
":=",
"range",
"d",
".",
"repoTags",
"{",
"// For github.com/docker/docker consumers, this works just as well as",
"// refString := ref.String()",
"// because when reading the RepoTags strings, github.com/docker/docker/reference",
"// normalizes both of them to the same value.",
"//",
"// Doing it this way to include the normalized-out `docker.io[/library]` does make",
"// a difference for github.com/projectatomic/docker consumers, with the",
"// “Add --add-registry and --block-registry options to docker daemon” patch.",
"// These consumers treat reference strings which include a hostname and reference",
"// strings without a hostname differently.",
"//",
"// Using the host name here is more explicit about the intent, and it has the same",
"// effect as (docker pull) in projectatomic/docker, which tags the result using",
"// a hostname-qualified reference.",
"// See https://github.com/containers/image/issues/72 for a more detailed",
"// analysis and explanation.",
"refString",
":=",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"tag",
".",
"Name",
"(",
")",
",",
"tag",
".",
"Tag",
"(",
")",
")",
"\n",
"repoTags",
"=",
"append",
"(",
"repoTags",
",",
"refString",
")",
"\n",
"}",
"\n\n",
"items",
":=",
"[",
"]",
"ManifestItem",
"{",
"{",
"Config",
":",
"man",
".",
"ConfigDescriptor",
".",
"Digest",
".",
"Hex",
"(",
")",
"+",
"\"",
"\"",
",",
"RepoTags",
":",
"repoTags",
",",
"Layers",
":",
"layerPaths",
",",
"Parent",
":",
"\"",
"\"",
",",
"LayerSources",
":",
"nil",
",",
"}",
"}",
"\n",
"itemsBytes",
",",
"err",
":=",
"json",
".",
"Marshal",
"(",
"&",
"items",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"// FIXME? Do we also need to support the legacy format?",
"return",
"d",
".",
"sendBytes",
"(",
"manifestFileName",
",",
"itemsBytes",
")",
"\n",
"}"
] |
8,698 | all-8699 | [
"UnmarshalWithParams",
"allows",
"field",
"parameters",
"to",
"be",
"specified",
"for",
"the",
"top",
"-",
"level",
"element",
".",
"The",
"form",
"of",
"the",
"params",
"is",
"the",
"same",
"as",
"the",
"field",
"tags",
"."
] | [
"func",
"UnmarshalWithParams",
"(",
"b",
"[",
"]",
"byte",
",",
"val",
"<mask>",
"{",
"}",
",",
"params",
"string",
")",
"(",
"rest",
"[",
"]",
"byte",
",",
"err",
"error",
")",
"{",
"v",
":=",
"reflect",
".",
"ValueOf",
"(",
"val",
")",
".",
"Elem",
"(",
")",
"\n",
"offset",
",",
"err",
":=",
"parseField",
"(",
"v",
",",
"b",
",",
"0",
",",
"parseFieldParameters",
"(",
"params",
")",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"return",
"b",
"[",
"offset",
":",
"]",
",",
"nil",
"\n",
"}"
] |
8,699 | all-8700 | [
"WriteOut",
"writes",
"the",
"frame",
"to",
"the",
"given",
"io",
".",
"Writer"
] | [
"func",
"(",
"f",
"*",
"Frame",
")",
"WriteOut",
"(",
"w",
"io",
".",
"Writer",
")",
"error",
"{",
"var",
"wbuf",
"typed",
".",
"WriteBuffer",
"\n",
"wbuf",
".",
"Wrap",
"(",
"f",
".",
"headerBuffer",
")",
"\n\n",
"if",
"err",
":=",
"f",
".",
"<mask>",
".",
"write",
"(",
"&",
"wbuf",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"fullFrame",
":=",
"f",
".",
"buffer",
"[",
":",
"f",
".",
"Header",
".",
"FrameSize",
"(",
")",
"]",
"\n",
"if",
"_",
",",
"err",
":=",
"w",
".",
"Write",
"(",
"fullFrame",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"return",
"nil",
"\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.