id
int32 0
25.3k
| idx
stringlengths 5
9
| nl_tokens
sequencelengths 1
418
| pl_tokens
sequencelengths 22
4.98k
|
---|---|---|---|
25,000 | all-25001 | [
"RestoreFromFile",
"read",
"and",
"parse",
"data",
"from",
"single",
"file"
] | [
"func",
"(",
"app",
"*",
"App",
")",
"RestoreFromFile",
"(",
"filename",
"string",
",",
"storeFunc",
"func",
"(",
"*",
"points",
".",
"Points",
")",
")",
"error",
"{",
"var",
"pointsCount",
"int",
"\n",
"startTime",
":=",
"time",
".",
"Now",
"(",
")",
"\n\n",
"logger",
":=",
"zapwriter",
".",
"Logger",
"(",
"\"",
"\"",
")",
".",
"With",
"(",
"zap",
".",
"String",
"(",
"\"",
"\"",
",",
"filename",
")",
")",
"\n",
"logger",
".",
"Info",
"(",
"\"",
"\"",
")",
"\n\n",
"defer",
"func",
"(",
")",
"{",
"logger",
".",
"Info",
"(",
"\"",
"\"",
",",
"zap",
".",
"Int",
"(",
"\"",
"\"",
",",
"pointsCount",
")",
",",
"zap",
".",
"Duration",
"(",
"\"",
"\"",
",",
"time",
".",
"Since",
"(",
"startTime",
")",
")",
",",
")",
"\n",
"}",
"(",
")",
"\n\n",
"err",
":=",
"points",
".",
"ReadFromFile",
"(",
"filename",
",",
"func",
"(",
"p",
"*",
"<mask>",
".",
"Points",
")",
"{",
"pointsCount",
"+=",
"len",
"(",
"p",
".",
"Data",
")",
"\n",
"storeFunc",
"(",
"p",
")",
"\n",
"}",
")",
"\n\n",
"return",
"err",
"\n",
"}"
] |
25,001 | all-25002 | [
"Insert",
"adds",
"a",
"key",
"-",
"value",
"pair",
"into",
"the",
"cedar",
".",
"It",
"will",
"return",
"ErrInvalidValue",
"if",
"value",
"<",
"0",
"or",
">",
"=",
"ValueLimit",
"."
] | [
"func",
"(",
"da",
"*",
"Cedar",
")",
"Insert",
"(",
"<mask>",
"[",
"]",
"byte",
",",
"value",
"int",
")",
"error",
"{",
"if",
"value",
"<",
"0",
"||",
"value",
">=",
"ValueLimit",
"{",
"return",
"ErrInvalidValue",
"\n",
"}",
"\n",
"p",
":=",
"da",
".",
"get",
"(",
"key",
",",
"0",
",",
"0",
")",
"\n",
"*",
"p",
"=",
"value",
"\n",
"return",
"nil",
"\n",
"}"
] |
25,002 | all-25003 | [
"CreateApiClient",
"creates",
"a",
"new",
"API",
"client",
".",
"It",
"takes",
"a",
"ApiClientOptions",
"struct",
"for",
"specifying",
"name",
"and",
"other",
"attributes",
".",
"Not",
"all",
"attributes",
"can",
"be",
"specified",
"at",
"create",
"time",
"(",
"such",
"as",
"Id",
"which",
"is",
"allocated",
"for",
"you",
")"
] | [
"func",
"(",
"c",
"*",
"Client",
")",
"CreateApiClient",
"(",
"<mask>",
"*",
"ApiClientOptions",
")",
"(",
"*",
"ApiClient",
",",
"error",
")",
"{",
"ac",
":=",
"new",
"(",
"ApiClient",
")",
"\n",
"_",
",",
"err",
":=",
"c",
".",
"MakeApiRequest",
"(",
"\"",
"\"",
",",
"\"",
"\"",
",",
"options",
",",
"&",
"ac",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"return",
"ac",
",",
"nil",
"\n",
"}"
] |
25,003 | all-25004 | [
"ValidateDiff",
"performs",
"any",
"complex",
"validation",
"of",
"an",
"individual",
"cdrom",
"sub",
"-",
"resource",
"that",
"can",
"t",
"be",
"done",
"in",
"schema",
"alone",
"."
] | [
"func",
"(",
"r",
"*",
"CdromSubresource",
")",
"ValidateDiff",
"(",
")",
"error",
"{",
"log",
".",
"Printf",
"(",
"\"",
"\"",
",",
"r",
")",
"\n",
"dsID",
":=",
"r",
".",
"Get",
"(",
"\"",
"\"",
")",
".",
"(",
"string",
")",
"\n",
"path",
":=",
"r",
".",
"Get",
"(",
"\"",
"\"",
")",
".",
"(",
"string",
")",
"\n",
"clientDevice",
":=",
"r",
".",
"Get",
"(",
"\"",
"\"",
")",
".",
"(",
"bool",
")",
"\n",
"switch",
"{",
"case",
"clientDevice",
"&&",
"(",
"dsID",
"!=",
"\"",
"\"",
"||",
"path",
"!=",
"\"",
"\"",
")",
":",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
")",
"\n",
"case",
"!",
"clientDevice",
"&&",
"(",
"dsID",
"==",
"\"",
"\"",
"||",
"<mask>",
"==",
"\"",
"\"",
")",
":",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"log",
".",
"Printf",
"(",
"\"",
"\"",
",",
"r",
")",
"\n",
"return",
"nil",
"\n",
"}"
] |
25,004 | all-25005 | [
"ImageInsert",
"inserts",
"a",
"new",
"image",
"."
] | [
"func",
"(",
"c",
"*",
"Cluster",
")",
"ImageInsert",
"(",
"project",
",",
"fp",
"string",
",",
"fname",
"string",
",",
"sz",
"int64",
",",
"public",
"bool",
",",
"autoUpdate",
"bool",
",",
"architecture",
"string",
",",
"createdAt",
"time",
".",
"Time",
",",
"expiresAt",
"time",
".",
"Time",
",",
"properties",
"map",
"[",
"string",
"]",
"string",
")",
"error",
"{",
"err",
":=",
"c",
".",
"Transaction",
"(",
"func",
"(",
"tx",
"*",
"ClusterTx",
")",
"error",
"{",
"enabled",
",",
"err",
":=",
"tx",
".",
"ProjectHasImages",
"(",
"project",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"errors",
".",
"Wrap",
"(",
"err",
",",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"if",
"!",
"enabled",
"{",
"project",
"=",
"\"",
"\"",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"arch",
",",
"err",
":=",
"osarch",
".",
"ArchitectureId",
"(",
"architecture",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"arch",
"=",
"0",
"\n",
"}",
"\n\n",
"err",
"=",
"c",
".",
"Transaction",
"(",
"func",
"(",
"tx",
"*",
"ClusterTx",
")",
"error",
"{",
"publicInt",
":=",
"0",
"\n",
"if",
"public",
"{",
"publicInt",
"=",
"1",
"\n",
"}",
"\n\n",
"autoUpdateInt",
":=",
"0",
"\n",
"if",
"autoUpdate",
"{",
"autoUpdateInt",
"=",
"1",
"\n",
"}",
"\n\n",
"stmt",
",",
"err",
":=",
"tx",
".",
"tx",
".",
"Prepare",
"(",
"`INSERT INTO images (project_id, fingerprint, filename, size, public, auto_update, architecture, creation_date, expiry_date, upload_date) VALUES ((SELECT id FROM projects WHERE name = ?), ?, ?, ?, ?, ?, ?, ?, ?, ?)`",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"defer",
"stmt",
".",
"Close",
"(",
")",
"\n\n",
"result",
",",
"err",
":=",
"stmt",
".",
"Exec",
"(",
"project",
",",
"fp",
",",
"fname",
",",
"sz",
",",
"publicInt",
",",
"autoUpdateInt",
",",
"arch",
",",
"createdAt",
",",
"expiresAt",
",",
"time",
".",
"Now",
"(",
")",
".",
"UTC",
"(",
")",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"id64",
",",
"err",
":=",
"result",
".",
"LastInsertId",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"id",
":=",
"int",
"(",
"id64",
")",
"\n\n",
"if",
"len",
"(",
"properties",
")",
">",
"0",
"{",
"pstmt",
",",
"err",
":=",
"tx",
".",
"tx",
".",
"Prepare",
"(",
"`INSERT INTO images_properties (image_id, type, key, value) VALUES (?, 0, ?, ?)`",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"defer",
"pstmt",
".",
"Close",
"(",
")",
"\n\n",
"for",
"k",
",",
"v",
":=",
"<mask>",
"properties",
"{",
"// we can assume, that there is just one",
"// value per key",
"_",
",",
"err",
"=",
"pstmt",
".",
"Exec",
"(",
"id",
",",
"k",
",",
"v",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"}",
"\n\n",
"}",
"\n\n",
"_",
",",
"err",
"=",
"tx",
".",
"tx",
".",
"Exec",
"(",
"\"",
"\"",
",",
"id",
",",
"c",
".",
"nodeID",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"return",
"nil",
"\n",
"}",
")",
"\n",
"return",
"err",
"\n",
"}"
] |
25,005 | all-25006 | [
"ParentFromPath",
"takes",
"a",
"relative",
"object",
"path",
"(",
"usually",
"a",
"folder",
")",
"an",
"object",
"type",
"and",
"an",
"optional",
"supplied",
"datacenter",
"and",
"returns",
"the",
"parent",
"*",
"object",
".",
"Folder",
"if",
"it",
"exists",
".",
"The",
"datacenter",
"supplied",
"in",
"dc",
"cannot",
"be",
"nil",
"if",
"the",
"folder",
"type",
"supplied",
"by",
"ft",
"is",
"something",
"else",
"other",
"than",
"VSphereFolderTypeDatacenter",
"."
] | [
"func",
"ParentFromPath",
"(",
"c",
"*",
"govmomi",
".",
"Client",
",",
"p",
"string",
",",
"ft",
"VSphereFolderType",
",",
"dc",
"*",
"object",
".",
"Datacenter",
")",
"(",
"*",
"<mask>",
".",
"Folder",
",",
"error",
")",
"{",
"return",
"FromPath",
"(",
"c",
",",
"path",
".",
"Dir",
"(",
"p",
")",
",",
"ft",
",",
"dc",
")",
"\n",
"}"
] |
25,006 | all-25007 | [
"Write",
"logs",
"an",
"Warning",
"message",
"to",
"a",
"logger",
"."
] | [
"func",
"(",
"lw",
"WarningLogWriter",
")",
"Write",
"(",
"p",
"[",
"]",
"<mask>",
")",
"(",
"int",
",",
"error",
")",
"{",
"lw",
".",
"Warning",
"(",
"string",
"(",
"bytes",
".",
"TrimRightFunc",
"(",
"p",
",",
"unicode",
".",
"IsSpace",
")",
")",
")",
"\n",
"return",
"len",
"(",
"p",
")",
",",
"nil",
"\n",
"}"
] |
25,007 | all-25008 | [
"RandomIdentifier",
"returns",
"a",
"random",
"Identifier",
"prefixed",
"by",
"the",
"prefix",
"parameter",
".",
"This",
"function",
"is",
"used",
"to",
"generate",
"database",
"objects",
"with",
"random",
"names",
"for",
"test",
"and",
"example",
"code",
"."
] | [
"func",
"RandomIdentifier",
"(",
"prefix",
"string",
")",
"Identifier",
"{",
"b",
":=",
"make",
"(",
"[",
"]",
"<mask>",
",",
"16",
")",
"\n",
"if",
"_",
",",
"err",
":=",
"io",
".",
"ReadFull",
"(",
"rand",
".",
"Reader",
",",
"b",
")",
";",
"err",
"!=",
"nil",
"{",
"panic",
"(",
"err",
".",
"Error",
"(",
")",
")",
"// rand should never fail",
"\n",
"}",
"\n",
"return",
"Identifier",
"(",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"prefix",
",",
"b",
")",
")",
"\n",
"}"
] |
25,008 | all-25009 | [
"Only",
"initialize",
"the",
"minimal",
"information",
"we",
"need",
"about",
"a",
"given",
"storage",
"type",
"."
] | [
"func",
"(",
"s",
"*",
"storageDir",
")",
"StorageCoreInit",
"(",
")",
"error",
"{",
"s",
".",
"sType",
"=",
"storageTypeDir",
"\n",
"typeName",
",",
"<mask>",
":=",
"storageTypeToString",
"(",
"s",
".",
"sType",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"s",
".",
"sTypeName",
"=",
"typeName",
"\n",
"s",
".",
"sTypeVersion",
"=",
"\"",
"\"",
"\n\n",
"return",
"nil",
"\n",
"}"
] |
25,009 | all-25010 | [
"title",
":",
"node",
"healing",
"update",
"path",
":",
"/",
"healing",
"/",
"node",
"method",
":",
"POST",
"consume",
":",
"application",
"/",
"x",
"-",
"www",
"-",
"form",
"-",
"urlencoded",
"responses",
":",
"200",
":",
"Ok",
"401",
":",
"Unauthorized"
] | [
"func",
"nodeHealingUpdate",
"(",
"w",
"http",
".",
"ResponseWriter",
",",
"r",
"*",
"http",
".",
"Request",
",",
"t",
"auth",
".",
"Token",
")",
"(",
"err",
"error",
")",
"{",
"poolName",
":=",
"InputValue",
"(",
"r",
",",
"\"",
"\"",
")",
"\n",
"var",
"ctxs",
"[",
"]",
"permTypes",
".",
"PermissionContext",
"\n",
"if",
"poolName",
"!=",
"\"",
"\"",
"{",
"ctxs",
"=",
"append",
"(",
"ctxs",
",",
"permission",
".",
"Context",
"(",
"permTypes",
".",
"CtxPool",
",",
"poolName",
")",
")",
"\n",
"}",
"\n",
"if",
"!",
"permission",
".",
"Check",
"(",
"t",
",",
"permission",
".",
"PermHealingUpdate",
",",
"ctxs",
"...",
")",
"{",
"return",
"permission",
".",
"ErrUnauthorized",
"\n",
"}",
"\n",
"evt",
",",
"err",
":=",
"event",
".",
"New",
"(",
"&",
"event",
".",
"Opts",
"{",
"Target",
":",
"event",
".",
"Target",
"{",
"Type",
":",
"event",
".",
"TargetTypePool",
",",
"Value",
":",
"poolName",
"}",
",",
"Kind",
":",
"permission",
".",
"PermHealingUpdate",
",",
"Owner",
":",
"t",
",",
"CustomData",
":",
"<mask>",
".",
"FormToCustomData",
"(",
"InputFields",
"(",
"r",
")",
")",
",",
"DisableLock",
":",
"true",
",",
"Allowed",
":",
"event",
".",
"Allowed",
"(",
"permission",
".",
"PermPoolReadEvents",
",",
"ctxs",
"...",
")",
",",
"}",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"defer",
"func",
"(",
")",
"{",
"evt",
".",
"Done",
"(",
"err",
")",
"}",
"(",
")",
"\n",
"var",
"config",
"healer",
".",
"NodeHealerConfig",
"\n",
"err",
"=",
"ParseInput",
"(",
"r",
",",
"&",
"config",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"return",
"healer",
".",
"UpdateConfig",
"(",
"poolName",
",",
"config",
")",
"\n",
"}"
] |
25,010 | all-25011 | [
"ListIntegrationGCP",
"gets",
"all",
"Google",
"Cloud",
"Platform",
"Integrations",
"."
] | [
"func",
"(",
"<mask>",
"*",
"Client",
")",
"ListIntegrationGCP",
"(",
")",
"(",
"[",
"]",
"*",
"IntegrationGCP",
",",
"error",
")",
"{",
"var",
"list",
"[",
"]",
"*",
"IntegrationGCP",
"\n",
"if",
"err",
":=",
"client",
".",
"doJsonRequest",
"(",
"\"",
"\"",
",",
"\"",
"\"",
",",
"nil",
",",
"&",
"list",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"return",
"list",
",",
"nil",
"\n",
"}"
] |
25,011 | all-25012 | [
"GetTitle",
"returns",
"the",
"Title",
"field",
"if",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"."
] | [
"func",
"(",
"g",
"*",
"GroupDefinition",
")",
"GetTitle",
"(",
")",
"<mask>",
"{",
"if",
"g",
"==",
"nil",
"||",
"g",
".",
"Title",
"==",
"nil",
"{",
"return",
"\"",
"\"",
"\n",
"}",
"\n",
"return",
"*",
"g",
".",
"Title",
"\n",
"}"
] |
25,012 | all-25013 | [
"UnmarshalJSON",
"supports",
"json",
".",
"Unmarshaler",
"interface"
] | [
"func",
"(",
"v",
"*",
"GetScriptSourceReturns",
")",
"UnmarshalJSON",
"(",
"data",
"[",
"]",
"byte",
")",
"error",
"{",
"r",
":=",
"jlexer",
".",
"Lexer",
"{",
"Data",
":",
"<mask>",
"}",
"\n",
"easyjsonC5a4559bDecodeGithubComChromedpCdprotoDebugger33",
"(",
"&",
"r",
",",
"v",
")",
"\n",
"return",
"r",
".",
"Error",
"(",
")",
"\n",
"}"
] |
25,013 | all-25014 | [
"ChangeHostEventHandler",
"creates",
"a",
"new",
"CHANGE_HOST_EVENT_HANDLER",
"Nagios",
"command",
".",
"Changes",
"the",
"event",
"handler",
"command",
"for",
"a",
"particular",
"host",
"to",
"be",
"that",
"specified",
"by",
"the",
"event_handler_command",
"option",
".",
"The",
"event_handler_command",
"option",
"specifies",
"the",
"short",
"name",
"of",
"the",
"command",
"that",
"should",
"be",
"used",
"as",
"the",
"new",
"host",
"event",
"handler",
".",
"The",
"command",
"must",
"have",
"been",
"configured",
"in",
"Nagios",
"before",
"it",
"was",
"last",
"(",
"re",
")",
"started",
"."
] | [
"func",
"ChangeHostEventHandler",
"(",
"host_name",
"<mask>",
",",
"event_handler_command",
"string",
",",
")",
"*",
"livestatus",
".",
"Command",
"{",
"return",
"livestatus",
".",
"NewCommand",
"(",
"\"",
"\"",
",",
"stringifyArg",
"(",
"\"",
"\"",
",",
"\"",
"\"",
",",
"host_name",
")",
",",
"stringifyArg",
"(",
"\"",
"\"",
",",
"\"",
"\"",
",",
"event_handler_command",
")",
",",
")",
"\n",
"}"
] |
25,014 | all-25015 | [
"GetStats",
"returns",
"skiplist",
"stats"
] | [
"func",
"(",
"s",
"*",
"Skiplist",
")",
"GetStats",
"(",
")",
"StatsReport",
"{",
"<mask>",
"report",
"StatsReport",
"\n",
"report",
".",
"Apply",
"(",
"&",
"s",
".",
"Stats",
")",
"\n",
"return",
"report",
"\n",
"}"
] |
25,015 | all-25016 | [
"DecodeReadRequest",
"reads",
"a",
"remote",
".",
"Request",
"from",
"a",
"http",
".",
"Request",
"."
] | [
"func",
"DecodeReadRequest",
"(",
"r",
"*",
"http",
".",
"Request",
")",
"(",
"*",
"prompb",
".",
"ReadRequest",
",",
"error",
")",
"{",
"compressed",
",",
"err",
":=",
"ioutil",
".",
"ReadAll",
"(",
"io",
".",
"LimitReader",
"(",
"r",
".",
"<mask>",
",",
"decodeReadLimit",
")",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"reqBuf",
",",
"err",
":=",
"snappy",
".",
"Decode",
"(",
"nil",
",",
"compressed",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"var",
"req",
"prompb",
".",
"ReadRequest",
"\n",
"if",
"err",
":=",
"proto",
".",
"Unmarshal",
"(",
"reqBuf",
",",
"&",
"req",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"return",
"&",
"req",
",",
"nil",
"\n",
"}"
] |
25,016 | all-25017 | [
"GetHost",
"will",
"get",
"a",
"specified",
"host",
"by",
"either",
"hostname",
"or",
"ip",
".",
"The",
"first",
"return",
"value",
"is",
"the",
"host",
"if",
"it",
"was",
"found",
".",
"The",
"second",
"return",
"value",
"is",
"the",
"wether",
"the",
"host",
"was",
"found",
"or",
"not"
] | [
"func",
"(",
"s",
"Scan",
")",
"GetHost",
"(",
"hostTarget",
"string",
")",
"(",
"target",
"Host",
",",
"exists",
"bool",
")",
"{",
"target",
",",
"ok",
":=",
"s",
".",
"Hosts",
"[",
"hostTarget",
"]",
"\n",
"if",
"ok",
"{",
"return",
"target",
",",
"true",
"\n",
"}",
"\n\n",
"for",
"_",
",",
"host",
":=",
"range",
"s",
".",
"Hosts",
"{",
"for",
"_",
",",
"hostname",
":=",
"range",
"host",
".",
"Hostnames",
"{",
"if",
"hostname",
".",
"Name",
"==",
"hostTarget",
"{",
"return",
"host",
",",
"<mask>",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n\n",
"return",
"Host",
"{",
"}",
",",
"false",
"\n",
"}"
] |
25,017 | all-25018 | [
"Rectangle",
"draws",
"a",
"rectangle",
"using",
"a",
"path",
"between",
"(",
"x1",
"y1",
")",
"and",
"(",
"x2",
"y2",
")"
] | [
"func",
"Rectangle",
"(",
"path",
"draw2d",
".",
"PathBuilder",
",",
"x1",
",",
"y1",
",",
"x2",
",",
"y2",
"float64",
")",
"{",
"path",
".",
"MoveTo",
"(",
"x1",
",",
"y1",
")",
"\n",
"<mask>",
".",
"LineTo",
"(",
"x2",
",",
"y1",
")",
"\n",
"path",
".",
"LineTo",
"(",
"x2",
",",
"y2",
")",
"\n",
"path",
".",
"LineTo",
"(",
"x1",
",",
"y2",
")",
"\n",
"path",
".",
"Close",
"(",
")",
"\n",
"}"
] |
25,018 | all-25019 | [
"Push",
"will",
"add",
"a",
"new",
"span",
"on",
"to",
"the",
"stack",
".",
"Successful",
"spans",
"must",
"be",
"finished",
"by",
"calling",
"Pop",
".",
"If",
"the",
"code",
"panics",
"or",
"an",
"error",
"is",
"returned",
"the",
"last",
"pushed",
"span",
"will",
"be",
"flagged",
"with",
"the",
"error",
"and",
"a",
"leftover",
"spans",
"are",
"popped",
"."
] | [
"func",
"(",
"t",
"*",
"Tracer",
")",
"Push",
"(",
"name",
"string",
")",
"{",
"// get context",
"var",
"ctx",
"opentracing",
".",
"SpanContext",
"\n",
"if",
"len",
"(",
"t",
".",
"spans",
")",
">",
"0",
"{",
"ctx",
"=",
"t",
".",
"Last",
"(",
")",
".",
"Context",
"(",
")",
"\n",
"}",
"else",
"{",
"ctx",
"=",
"t",
".",
"<mask>",
".",
"Context",
"(",
")",
"\n",
"}",
"\n\n",
"// create new span",
"span",
":=",
"opentracing",
".",
"StartSpan",
"(",
"name",
",",
"opentracing",
".",
"ChildOf",
"(",
"ctx",
")",
")",
"\n\n",
"// push span",
"t",
".",
"spans",
"=",
"append",
"(",
"t",
".",
"spans",
",",
"span",
")",
"\n",
"}"
] |
25,019 | all-25020 | [
"/",
"*",
"ToImage",
"converts",
"a",
"opencv",
".",
"IplImage",
"to",
"an",
"go",
"image",
".",
"Image"
] | [
"func",
"(",
"img",
"*",
"IplImage",
")",
"ToImage",
"(",
")",
"image",
".",
"Image",
"{",
"var",
"height",
",",
"width",
",",
"channels",
",",
"step",
"int",
"=",
"img",
".",
"Height",
"(",
")",
",",
"img",
".",
"Width",
"(",
")",
",",
"img",
".",
"Channels",
"(",
")",
",",
"img",
".",
"WidthStep",
"(",
")",
"\n",
"out",
":=",
"image",
".",
"NewNRGBA",
"(",
"image",
".",
"Rect",
"(",
"0",
",",
"0",
",",
"width",
",",
"height",
")",
")",
"\n",
"if",
"img",
".",
"Depth",
"(",
")",
"!=",
"IPL_DEPTH_8U",
"{",
"return",
"nil",
"// TODO return error",
"\n",
"}",
"\n",
"// Turn opencv.Iplimage.imageData(*char) to slice",
"var",
"limg",
"*",
"C",
".",
"char",
"=",
"img",
".",
"imageData",
"\n",
"var",
"limg_ptr",
"unsafe",
".",
"Pointer",
"=",
"unsafe",
".",
"Pointer",
"(",
"limg",
")",
"\n",
"var",
"data",
"[",
"]",
"C",
".",
"char",
"=",
"(",
"*",
"[",
"1",
"<<",
"30",
"]",
"C",
".",
"char",
")",
"(",
"limg_ptr",
")",
"[",
":",
"height",
"*",
"step",
":",
"height",
"*",
"step",
"]",
"\n\n",
"c",
":=",
"color",
".",
"NRGBA",
"{",
"R",
":",
"uint8",
"(",
"0",
")",
",",
"G",
":",
"uint8",
"(",
"0",
")",
",",
"B",
":",
"uint8",
"(",
"0",
")",
",",
"A",
":",
"uint8",
"(",
"255",
")",
"}",
"\n",
"// Iteratively assign imageData's color to Go's image",
"for",
"y",
":=",
"0",
";",
"y",
"<",
"height",
";",
"y",
"++",
"{",
"for",
"x",
":=",
"0",
";",
"x",
"<",
"step",
";",
"x",
"=",
"x",
"+",
"channels",
"{",
"c",
".",
"B",
"=",
"uint8",
"(",
"data",
"[",
"y",
"*",
"step",
"+",
"x",
"]",
")",
"\n",
"c",
".",
"G",
"=",
"uint8",
"(",
"data",
"[",
"y",
"*",
"step",
"+",
"x",
"+",
"1",
"]",
")",
"\n",
"c",
".",
"R",
"=",
"uint8",
"(",
"data",
"[",
"y",
"*",
"step",
"+",
"x",
"+",
"2",
"]",
")",
"\n",
"if",
"channels",
"==",
"4",
"{",
"c",
".",
"A",
"=",
"uint8",
"(",
"data",
"[",
"y",
"*",
"<mask>",
"+",
"x",
"+",
"3",
"]",
")",
"\n",
"}",
"\n",
"out",
".",
"SetNRGBA",
"(",
"int",
"(",
"x",
"/",
"channels",
")",
",",
"y",
",",
"c",
")",
"\n",
"}",
"\n",
"}",
"\n\n",
"return",
"out",
"\n",
"}"
] |
25,020 | all-25021 | [
"Error",
"is",
"part",
"of",
"the",
"error",
"interface",
"."
] | [
"func",
"(",
"agg",
"aggregate",
")",
"<mask>",
"(",
")",
"string",
"{",
"if",
"len",
"(",
"agg",
")",
"==",
"0",
"{",
"// This should never happen, really.",
"return",
"\"",
"\"",
"\n",
"}",
"\n",
"return",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"strings",
".",
"Join",
"(",
"agg",
".",
"Strings",
"(",
")",
",",
"\"",
"\"",
")",
")",
"\n",
"}"
] |
25,021 | all-25022 | [
"UpdateSpaces",
"sets",
"the",
"isolation",
"segment",
"for",
"each",
"space",
"as",
"specified",
"in",
"the",
"cf",
"-",
"mgmt",
"config",
"."
] | [
"func",
"(",
"u",
"*",
"Updater",
")",
"UpdateSpaces",
"(",
")",
"error",
"{",
"scs",
",",
"err",
":=",
"u",
".",
"Cfg",
".",
"GetSpaceConfigs",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"isolationSegmentMap",
",",
"err",
":=",
"u",
".",
"isolationSegmentMap",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"for",
"_",
",",
"sc",
":=",
"range",
"scs",
"{",
"<mask>",
",",
"err",
":=",
"u",
".",
"SpaceManager",
".",
"FindSpace",
"(",
"sc",
".",
"Org",
",",
"sc",
".",
"Space",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"isolationSegmentGUID",
",",
"err",
":=",
"u",
".",
"getIsolationSegmentGUID",
"(",
"sc",
".",
"IsoSegment",
",",
"isolationSegmentMap",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"if",
"space",
".",
"IsolationSegmentGuid",
"!=",
"isolationSegmentGUID",
"{",
"if",
"u",
".",
"Peek",
"{",
"if",
"sc",
".",
"IsoSegment",
"!=",
"\"",
"\"",
"{",
"lo",
".",
"G",
".",
"Infof",
"(",
"\"",
"\"",
",",
"sc",
".",
"Space",
",",
"sc",
".",
"IsoSegment",
",",
"sc",
".",
"Org",
")",
"\n",
"}",
"else",
"{",
"lo",
".",
"G",
".",
"Infof",
"(",
"\"",
"\"",
",",
"sc",
".",
"Space",
",",
"sc",
".",
"Org",
")",
"\n",
"}",
"\n",
"continue",
"\n",
"}",
"\n",
"if",
"sc",
".",
"IsoSegment",
"!=",
"\"",
"\"",
"{",
"lo",
".",
"G",
".",
"Infof",
"(",
"\"",
"\"",
",",
"sc",
".",
"Space",
",",
"sc",
".",
"IsoSegment",
",",
"sc",
".",
"Org",
")",
"\n",
"err",
"=",
"u",
".",
"Client",
".",
"IsolationSegmentForSpace",
"(",
"space",
".",
"Guid",
",",
"isolationSegmentGUID",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"}",
"else",
"{",
"lo",
".",
"G",
".",
"Infof",
"(",
"\"",
"\"",
",",
"sc",
".",
"Space",
",",
"sc",
".",
"Org",
")",
"\n",
"err",
"=",
"u",
".",
"Client",
".",
"ResetIsolationSegmentForSpace",
"(",
"space",
".",
"Guid",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
] |
25,022 | all-25023 | [
"HasQuery",
"returns",
"a",
"boolean",
"if",
"a",
"field",
"has",
"been",
"set",
"."
] | [
"func",
"(",
"t",
"*",
"TileDefRequest",
")",
"HasQuery",
"(",
")",
"bool",
"{",
"if",
"t",
"!=",
"nil",
"&&",
"t",
".",
"Query",
"!=",
"nil",
"{",
"return",
"<mask>",
"\n",
"}",
"\n\n",
"return",
"false",
"\n",
"}"
] |
25,023 | all-25024 | [
"The",
"ArgReader",
"will",
"handle",
"fragmentation",
"as",
"needed",
".",
"Once",
"the",
"argument",
"has",
"been",
"read",
"the",
"ArgReader",
"must",
"be",
"closed",
"."
] | [
"func",
"(",
"r",
"*",
"fragmentingReader",
")",
"ArgReader",
"(",
"last",
"bool",
")",
"(",
"ArgReader",
",",
"error",
")",
"{",
"if",
"err",
":=",
"r",
".",
"BeginArgument",
"(",
"<mask>",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"return",
"r",
",",
"nil",
"\n",
"}"
] |
25,024 | all-25025 | [
"ImageAliasesMove",
"changes",
"the",
"image",
"ID",
"associated",
"with",
"an",
"alias",
"."
] | [
"func",
"(",
"c",
"*",
"Cluster",
")",
"ImageAliasesMove",
"(",
"source",
"int",
",",
"destination",
"int",
")",
"error",
"{",
"err",
":=",
"exec",
"(",
"c",
".",
"db",
",",
"\"",
"\"",
",",
"destination",
",",
"<mask>",
")",
"\n",
"return",
"err",
"\n",
"}"
] |
25,025 | all-25026 | [
"SetSRS",
"sets",
"the",
"projection",
"of",
"the",
"map",
"as",
"a",
"proj4",
"string",
"(",
"+",
"init",
"=",
"epsg",
":",
"4326",
"etc",
")",
"."
] | [
"func",
"(",
"m",
"*",
"Map",
")",
"SetSRS",
"(",
"srs",
"string",
")",
"{",
"cs",
":=",
"C",
".",
"CString",
"(",
"srs",
")",
"\n",
"defer",
"C",
".",
"<mask>",
"(",
"unsafe",
".",
"Pointer",
"(",
"cs",
")",
")",
"\n",
"C",
".",
"mapnik_map_set_srs",
"(",
"m",
".",
"m",
",",
"cs",
")",
"\n",
"}"
] |
25,026 | all-25027 | [
"GetSearch",
"returns",
"the",
"Search",
"field",
"if",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"."
] | [
"func",
"(",
"w",
"*",
"WidgetApmOrLogQuery",
")",
"GetSearch",
"(",
")",
"ApmOrLogQuerySearch",
"{",
"if",
"w",
"==",
"nil",
"||",
"w",
".",
"Search",
"==",
"nil",
"{",
"<mask>",
"ApmOrLogQuerySearch",
"{",
"}",
"\n",
"}",
"\n",
"return",
"*",
"w",
".",
"Search",
"\n",
"}"
] |
25,027 | all-25028 | [
"newHTMLTag",
"creates",
"and",
"returns",
"an",
"HTML",
"tag",
"."
] | [
"func",
"newHTMLTag",
"(",
"ln",
"*",
"line",
",",
"rslt",
"*",
"result",
",",
"src",
"*",
"source",
",",
"parent",
"element",
",",
"opts",
"*",
"Options",
")",
"(",
"*",
"htmlTag",
",",
"error",
")",
"{",
"if",
"len",
"(",
"ln",
".",
"tokens",
")",
"<",
"1",
"{",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"ln",
".",
"fileName",
"(",
")",
",",
"ln",
".",
"no",
")",
"\n",
"}",
"\n\n",
"s",
":=",
"ln",
".",
"tokens",
"[",
"0",
"]",
"\n\n",
"tagName",
":=",
"extractTagName",
"(",
"s",
")",
"\n\n",
"id",
",",
"err",
":=",
"extractID",
"(",
"s",
",",
"ln",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"classes",
":=",
"extractClasses",
"(",
"s",
")",
"\n\n",
"e",
":=",
"&",
"htmlTag",
"{",
"elementBase",
":",
"newElementBase",
"(",
"ln",
",",
"rslt",
",",
"src",
",",
"<mask>",
",",
"opts",
")",
",",
"tagName",
":",
"tagName",
",",
"id",
":",
"id",
",",
"classes",
":",
"classes",
",",
"containPlainText",
":",
"strings",
".",
"HasSuffix",
"(",
"s",
",",
"dot",
")",
",",
"insertBr",
":",
"strings",
".",
"HasSuffix",
"(",
"s",
",",
"doubleDot",
")",
",",
"attributes",
":",
"make",
"(",
"[",
"]",
"htmlAttribute",
",",
"0",
",",
"2",
")",
",",
"}",
"\n\n",
"if",
"err",
":=",
"e",
".",
"setAttributes",
"(",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"return",
"e",
",",
"nil",
"\n",
"}"
] |
25,028 | all-25029 | [
"Infof",
"logs",
"a",
"formatted",
"line",
"with",
"a",
"VERBOSE",
"prefix",
"."
] | [
"func",
"(",
"l",
"*",
"logger",
")",
"Verbosef",
"(",
"format",
"string",
",",
"vals",
"...",
"<mask>",
"{",
"}",
")",
"{",
"l",
".",
"mut",
".",
"Lock",
"(",
")",
"\n",
"defer",
"l",
".",
"mut",
".",
"Unlock",
"(",
")",
"\n",
"s",
":=",
"fmt",
".",
"Sprintf",
"(",
"format",
",",
"vals",
"...",
")",
"\n",
"l",
".",
"logger",
".",
"Output",
"(",
"2",
",",
"\"",
"\"",
"+",
"s",
")",
"\n",
"l",
".",
"callHandlers",
"(",
"LevelVerbose",
",",
"s",
")",
"\n",
"}"
] |
25,029 | all-25030 | [
"LoadImage",
"mocks",
"base",
"method"
] | [
"func",
"(",
"m",
"*",
"MockDockerClient",
")",
"LoadImage",
"(",
"arg0",
"context",
".",
"<mask>",
",",
"arg1",
"io",
".",
"Reader",
",",
"arg2",
"time",
".",
"Duration",
")",
"error",
"{",
"ret",
":=",
"m",
".",
"ctrl",
".",
"Call",
"(",
"m",
",",
"\"",
"\"",
",",
"arg0",
",",
"arg1",
",",
"arg2",
")",
"\n",
"ret0",
",",
"_",
":=",
"ret",
"[",
"0",
"]",
".",
"(",
"error",
")",
"\n",
"return",
"ret0",
"\n",
"}"
] |
25,030 | all-25031 | [
"Produces",
"code",
"that",
"initializes",
"a",
"APIParams",
"struct",
"with",
"the",
"values",
"of",
"parameters",
"for",
"the",
"given",
"action",
"and",
"location",
"."
] | [
"func",
"paramsInitializer",
"(",
"action",
"*",
"gen",
".",
"Action",
",",
"location",
"int",
",",
"varName",
"string",
")",
"string",
"{",
"var",
"fields",
"[",
"]",
"string",
"\n",
"var",
"optionals",
"[",
"]",
"*",
"gen",
".",
"ActionParam",
"\n",
"varName",
"=",
"fixReserved",
"(",
"varName",
")",
"\n",
"for",
"_",
",",
"param",
":=",
"range",
"action",
".",
"Params",
"{",
"if",
"param",
".",
"Location",
"!=",
"location",
"{",
"continue",
"\n",
"}",
"\n",
"if",
"param",
".",
"Mandatory",
"{",
"name",
":=",
"param",
".",
"Name",
"\n",
"if",
"location",
"==",
"1",
"{",
"// QueryParam",
"name",
"=",
"param",
".",
"QueryName",
"\n",
"}",
"\n",
"fields",
"=",
"append",
"(",
"fields",
",",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\\\"",
"\\\"",
"\"",
",",
"name",
",",
"fixReserved",
"(",
"param",
".",
"VarName",
")",
")",
")",
"\n",
"}",
"else",
"{",
"optionals",
"=",
"append",
"(",
"optionals",
",",
"param",
")",
"\n",
"}",
"\n",
"}",
"\n",
"if",
"len",
"(",
"fields",
")",
"==",
"0",
"&&",
"len",
"(",
"optionals",
")",
"==",
"0",
"{",
"return",
"\"",
"\"",
"\n",
"}",
"\n",
"var",
"paramsDecl",
"=",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\\n",
"\\n",
"\"",
",",
"strings",
".",
"Join",
"(",
"fields",
",",
"\"",
"\\n",
"\\t",
"\"",
")",
")",
"\n",
"if",
"len",
"(",
"optionals",
")",
"==",
"0",
"{",
"return",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\\n",
"\"",
",",
"varName",
",",
"paramsDecl",
")",
"\n",
"}",
"\n",
"var",
"inits",
"=",
"make",
"(",
"[",
"]",
"string",
",",
"len",
"(",
"optionals",
")",
")",
"\n",
"for",
"i",
",",
"opt",
":=",
"range",
"optionals",
"{",
"name",
":=",
"opt",
".",
"Name",
"\n",
"if",
"location",
"==",
"1",
"{",
"// QueryParam",
"name",
"=",
"opt",
".",
"QueryName",
"\n",
"}",
"\n",
"inits",
"[",
"i",
"]",
"=",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\\t",
"\\\"",
"\\\"",
"\\n",
"\\t",
"\\n",
"\\t",
"\\t",
"\\\"",
"\\\"",
"\\n",
"\\t",
"\"",
",",
"opt",
".",
"VarName",
",",
"opt",
".",
"Name",
",",
"opt",
".",
"VarName",
",",
"varName",
",",
"<mask>",
",",
"opt",
".",
"VarName",
")",
"\n",
"}",
"\n",
"var",
"paramsInits",
"=",
"strings",
".",
"Join",
"(",
"inits",
",",
"\"",
"\\n",
"\\t",
"\"",
")",
"\n",
"return",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\\n",
"\\n",
"\"",
",",
"varName",
",",
"paramsDecl",
",",
"paramsInits",
")",
"\n",
"}"
] |
25,031 | all-25032 | [
"Decode",
"decodes",
"a",
"serialized",
"token",
"verifying",
"the",
"signature",
"storing",
"the",
"decoded",
"data",
"from",
"the",
"token",
"in",
"obj",
"."
] | [
"func",
"(",
"rs",
"*",
"RSASigner",
")",
"Decode",
"(",
"buf",
"[",
"]",
"byte",
",",
"obj",
"interface",
"{",
"}",
")",
"error",
"{",
"return",
"rs",
".",
"alg",
".",
"Decode",
"(",
"<mask>",
",",
"buf",
",",
"obj",
")",
"\n",
"}"
] |
25,032 | all-25033 | [
"Stop",
"stops",
"serving",
"gRPC",
"server",
"."
] | [
"func",
"(",
"srv",
"*",
"Server",
")",
"Stop",
"(",
")",
"{",
"srv",
".",
"lg",
".",
"Info",
"(",
"\"",
"\"",
",",
"zap",
".",
"String",
"(",
"\"",
"\"",
",",
"srv",
".",
"address",
")",
")",
"\n",
"srv",
".",
"grpcServer",
".",
"Stop",
"(",
")",
"\n",
"srv",
".",
"lg",
".",
"Info",
"(",
"\"",
"\"",
",",
"zap",
".",
"String",
"(",
"\"",
"\"",
",",
"srv",
".",
"<mask>",
")",
")",
"\n",
"}"
] |
25,033 | all-25034 | [
"Mutate",
"applies",
"the",
"provided",
"mutators",
"to",
"this",
"builder",
"s",
"payment",
"or",
"operation",
"."
] | [
"func",
"(",
"b",
"*",
"CreateAccountBuilder",
")",
"Mutate",
"(",
"muts",
"...",
"interface",
"{",
"}",
")",
"{",
"for",
"_",
",",
"m",
":=",
"<mask>",
"muts",
"{",
"var",
"err",
"error",
"\n",
"switch",
"mut",
":=",
"m",
".",
"(",
"type",
")",
"{",
"case",
"CreateAccountMutator",
":",
"err",
"=",
"mut",
".",
"MutateCreateAccount",
"(",
"&",
"b",
".",
"CA",
")",
"\n",
"case",
"OperationMutator",
":",
"err",
"=",
"mut",
".",
"MutateOperation",
"(",
"&",
"b",
".",
"O",
")",
"\n",
"default",
":",
"err",
"=",
"errors",
".",
"New",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"if",
"err",
"!=",
"nil",
"{",
"b",
".",
"Err",
"=",
"err",
"\n",
"return",
"\n",
"}",
"\n",
"}",
"\n",
"}"
] |
25,034 | all-25035 | [
"NewKNode",
"..."
] | [
"func",
"NewKNode",
"(",
"val",
"rune",
")",
"*",
"KNode",
"{",
"return",
"&",
"KNode",
"{",
"val",
":",
"val",
",",
"links",
":",
"<mask>",
"(",
"[",
"]",
"*",
"KNode",
",",
"0",
")",
",",
"}",
"\n",
"}"
] |
25,035 | all-25036 | [
"parseJSON",
"returns",
"a",
"structure",
"for",
"valid",
"JSON"
] | [
"func",
"parseJSON",
"(",
"s",
"string",
")",
"(",
"interface",
"{",
"}",
",",
"error",
")",
"{",
"if",
"s",
"==",
"\"",
"\"",
"{",
"return",
"map",
"[",
"string",
"]",
"interface",
"{",
"}",
"{",
"}",
",",
"nil",
"\n",
"}",
"\n\n",
"var",
"data",
"interface",
"{",
"}",
"\n",
"if",
"err",
":=",
"json",
".",
"Unmarshal",
"(",
"[",
"]",
"<mask>",
"(",
"s",
")",
",",
"&",
"data",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"return",
"data",
",",
"nil",
"\n",
"}"
] |
25,036 | all-25037 | [
"Specify",
"the",
"value",
"of",
"a",
"uniform",
"variable",
"for",
"a",
"specified",
"program",
"object"
] | [
"func",
"ProgramUniform1f",
"(",
"program",
"uint32",
",",
"location",
"int32",
",",
"v0",
"float32",
")",
"{",
"syscall",
".",
"Syscall",
"(",
"gpProgramUniform1f",
",",
"3",
",",
"uintptr",
"(",
"program",
")",
",",
"uintptr",
"(",
"<mask>",
")",
",",
"uintptr",
"(",
"math",
".",
"Float32bits",
"(",
"v0",
")",
")",
")",
"\n",
"}"
] |
25,037 | all-25038 | [
"splitBucketObject",
"breaks",
"a",
"path",
"into",
"the",
"first",
"part",
"(",
"the",
"bucket",
")",
"and",
"everything",
"else",
"(",
"the",
"object",
")",
"."
] | [
"func",
"splitBucketObject",
"(",
"path",
"string",
")",
"(",
"string",
",",
"string",
")",
"{",
"<mask>",
"=",
"strings",
".",
"Trim",
"(",
"path",
",",
"\"",
"\"",
")",
"\n",
"parts",
":=",
"strings",
".",
"SplitN",
"(",
"path",
",",
"\"",
"\"",
",",
"2",
")",
"\n",
"if",
"len",
"(",
"parts",
")",
"==",
"0",
"{",
"return",
"\"",
"\"",
",",
"\"",
"\"",
"\n",
"}",
"\n",
"if",
"len",
"(",
"parts",
")",
"==",
"1",
"{",
"return",
"parts",
"[",
"0",
"]",
",",
"\"",
"\"",
"\n",
"}",
"\n",
"return",
"parts",
"[",
"0",
"]",
",",
"parts",
"[",
"1",
"]",
"\n",
"}"
] |
25,038 | all-25039 | [
"saveHostPortGroupID",
"sets",
"a",
"special",
"ID",
"for",
"a",
"host",
"virtual",
"switch",
"composed",
"of",
"the",
"MOID",
"for",
"the",
"concerned",
"HostSystem",
"and",
"the",
"port",
"group",
"s",
"key",
"."
] | [
"func",
"saveHostPortGroupID",
"(",
"d",
"*",
"schema",
".",
"ResourceData",
",",
"hsID",
",",
"name",
"string",
")",
"{",
"d",
".",
"SetId",
"(",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"hostPortGroupIDPrefix",
",",
"hsID",
",",
"<mask>",
")",
")",
"\n",
"}"
] |
25,039 | all-25040 | [
"GetName",
"returns",
"the",
"Name",
"field",
"if",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"."
] | [
"func",
"(",
"g",
"*",
"GroupData",
")",
"GetName",
"(",
")",
"string",
"{",
"if",
"g",
"==",
"nil",
"||",
"g",
".",
"Name",
"==",
"nil",
"{",
"return",
"\"",
"\"",
"\n",
"}",
"\n",
"return",
"*",
"g",
".",
"<mask>",
"\n",
"}"
] |
25,040 | all-25041 | [
"GetDefaultRightMargin",
"()",
"is",
"a",
"wrapper",
"around",
"gtk_paper_size_get_default_right_margin",
"()",
"."
] | [
"func",
"(",
"ps",
"*",
"PaperSize",
")",
"GetDefaultRightMargin",
"(",
"<mask>",
"Unit",
")",
"float64",
"{",
"c",
":=",
"C",
".",
"gtk_paper_size_get_default_right_margin",
"(",
"ps",
".",
"native",
"(",
")",
",",
"C",
".",
"GtkUnit",
"(",
"unit",
")",
")",
"\n",
"return",
"float64",
"(",
"c",
")",
"\n",
"}"
] |
25,041 | all-25042 | [
"deleteResourceIfExists",
"is",
"an",
"utility",
"method",
"to",
"determine",
"if",
"a",
"resource",
"exists",
"from",
"the",
"error",
"returned",
"from",
"its",
"Get",
"response",
".",
"If",
"so",
"deletes",
"it",
".",
"name",
"is",
"used",
"only",
"for",
"logging",
"purposes",
"."
] | [
"func",
"deleteResourceIfExists",
"(",
"resourceType",
",",
"name",
"string",
",",
"getFunc",
"func",
"(",
")",
"error",
",",
"deleteFunc",
"func",
"(",
")",
"(",
"autorest",
".",
"Response",
",",
"error",
")",
")",
"error",
"{",
"f",
":=",
"logutil",
".",
"Fields",
"{",
"\"",
"\"",
":",
"name",
"}",
"\n",
"<mask>",
".",
"Debug",
"(",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"resourceType",
")",
",",
"f",
")",
"\n",
"if",
"exists",
",",
"err",
":=",
"checkResourceExistsFromError",
"(",
"getFunc",
"(",
")",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"else",
"if",
"!",
"exists",
"{",
"log",
".",
"Info",
"(",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"resourceType",
")",
",",
"f",
")",
"\n",
"return",
"nil",
"\n",
"}",
"\n",
"log",
".",
"Info",
"(",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"resourceType",
")",
",",
"f",
")",
"\n",
"_",
",",
"err",
":=",
"deleteFunc",
"(",
")",
"\n",
"return",
"err",
"\n",
"}"
] |
25,042 | all-25043 | [
"UnmarshalJSON",
"supports",
"json",
".",
"Unmarshaler",
"interface"
] | [
"func",
"(",
"v",
"*",
"DispatchSyncEventParams",
")",
"UnmarshalJSON",
"(",
"data",
"[",
"]",
"byte",
")",
"error",
"{",
"r",
":=",
"jlexer",
".",
"Lexer",
"{",
"Data",
":",
"<mask>",
"}",
"\n",
"easyjsonC5a4559bDecodeGithubComChromedpCdprotoServiceworker15",
"(",
"&",
"r",
",",
"v",
")",
"\n",
"return",
"r",
".",
"Error",
"(",
")",
"\n",
"}"
] |
25,043 | all-25044 | [
"title",
":",
"set",
"envs",
"path",
":",
"/",
"apps",
"/",
"{",
"app",
"}",
"/",
"env",
"method",
":",
"POST",
"consume",
":",
"application",
"/",
"x",
"-",
"www",
"-",
"form",
"-",
"urlencoded",
"produce",
":",
"application",
"/",
"x",
"-",
"json",
"-",
"stream",
"responses",
":",
"200",
":",
"Envs",
"updated",
"400",
":",
"Invalid",
"data",
"401",
":",
"Unauthorized",
"404",
":",
"App",
"not",
"found"
] | [
"func",
"setEnv",
"(",
"w",
"http",
".",
"ResponseWriter",
",",
"r",
"*",
"http",
".",
"Request",
",",
"t",
"auth",
".",
"Token",
")",
"(",
"err",
"error",
")",
"{",
"var",
"e",
"apiTypes",
".",
"Envs",
"\n",
"err",
"=",
"ParseInput",
"(",
"r",
",",
"&",
"e",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"if",
"len",
"(",
"e",
".",
"Envs",
")",
"==",
"0",
"{",
"msg",
":=",
"\"",
"\"",
"\n",
"return",
"&",
"errors",
".",
"HTTP",
"{",
"Code",
":",
"http",
".",
"StatusBadRequest",
",",
"Message",
":",
"msg",
"}",
"\n",
"}",
"\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",
".",
"PermAppUpdateEnvSet",
",",
"contextsForApp",
"(",
"&",
"a",
")",
"...",
",",
")",
"\n",
"if",
"!",
"allowed",
"{",
"return",
"permission",
".",
"ErrUnauthorized",
"\n",
"}",
"\n",
"var",
"toExclude",
"[",
"]",
"string",
"\n",
"if",
"e",
".",
"Private",
"{",
"for",
"i",
":=",
"0",
";",
"i",
"<",
"len",
"(",
"e",
".",
"Envs",
")",
";",
"i",
"++",
"{",
"toExclude",
"=",
"append",
"(",
"toExclude",
",",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"i",
")",
")",
"\n",
"}",
"\n",
"}",
"\n",
"evt",
",",
"err",
":=",
"event",
".",
"New",
"(",
"&",
"event",
".",
"Opts",
"{",
"Target",
":",
"appTarget",
"(",
"appName",
")",
",",
"Kind",
":",
"permission",
".",
"PermAppUpdateEnvSet",
",",
"Owner",
":",
"t",
",",
"CustomData",
":",
"event",
".",
"FormToCustomData",
"(",
"InputFields",
"(",
"r",
",",
"toExclude",
"...",
")",
")",
",",
"Allowed",
":",
"event",
".",
"Allowed",
"(",
"permission",
".",
"PermAppReadEvents",
",",
"contextsForApp",
"(",
"&",
"a",
")",
"...",
")",
",",
"}",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"defer",
"func",
"(",
")",
"{",
"evt",
".",
"Done",
"(",
"err",
")",
"}",
"(",
")",
"\n",
"envs",
":=",
"map",
"[",
"string",
"]",
"string",
"{",
"}",
"\n",
"variables",
":=",
"[",
"]",
"<mask>",
".",
"EnvVar",
"{",
"}",
"\n",
"for",
"_",
",",
"v",
":=",
"range",
"e",
".",
"Envs",
"{",
"envs",
"[",
"v",
".",
"Name",
"]",
"=",
"v",
".",
"Value",
"\n",
"variables",
"=",
"append",
"(",
"variables",
",",
"bind",
".",
"EnvVar",
"{",
"Name",
":",
"v",
".",
"Name",
",",
"Value",
":",
"v",
".",
"Value",
",",
"Public",
":",
"!",
"e",
".",
"Private",
"}",
")",
"\n",
"}",
"\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",
"err",
"=",
"a",
".",
"SetEnvs",
"(",
"bind",
".",
"SetEnvArgs",
"{",
"Envs",
":",
"variables",
",",
"ShouldRestart",
":",
"!",
"e",
".",
"NoRestart",
",",
"Writer",
":",
"evt",
",",
"}",
")",
"\n",
"if",
"v",
",",
"ok",
":=",
"err",
".",
"(",
"*",
"errors",
".",
"ValidationError",
")",
";",
"ok",
"{",
"return",
"&",
"errors",
".",
"HTTP",
"{",
"Code",
":",
"http",
".",
"StatusBadRequest",
",",
"Message",
":",
"v",
".",
"Message",
"}",
"\n",
"}",
"\n",
"return",
"err",
"\n",
"}"
] |
25,044 | all-25045 | [
"resourceVSphereFolderMigrateState",
"is",
"the",
"master",
"state",
"migration",
"function",
"for",
"the",
"vsphere_folder",
"resource",
"."
] | [
"func",
"resourceVSphereFolderMigrateState",
"(",
"version",
"int",
",",
"os",
"*",
"terraform",
".",
"InstanceState",
",",
"meta",
"interface",
"{",
"}",
")",
"(",
"*",
"terraform",
".",
"InstanceState",
",",
"error",
")",
"{",
"// Guard against a nil state.",
"if",
"os",
"==",
"nil",
"{",
"return",
"nil",
",",
"nil",
"\n",
"}",
"\n\n",
"// Guard against empty state, can't do anything with it",
"if",
"os",
".",
"Empty",
"(",
")",
"{",
"return",
"os",
",",
"nil",
"\n",
"}",
"\n\n",
"var",
"migrateFunc",
"func",
"(",
"*",
"terraform",
".",
"InstanceState",
",",
"interface",
"{",
"}",
")",
"error",
"\n",
"switch",
"version",
"{",
"case",
"0",
":",
"log",
".",
"Printf",
"(",
"\"",
"\"",
",",
"version",
",",
"os",
")",
"\n",
"migrateFunc",
"=",
"resourceVSphereFolderMigrateStateV1",
"\n",
"default",
":",
"// Migration is complete",
"log",
".",
"Printf",
"(",
"\"",
"\"",
",",
"version",
",",
"<mask>",
")",
"\n",
"return",
"os",
",",
"nil",
"\n",
"}",
"\n",
"if",
"err",
":=",
"migrateFunc",
"(",
"os",
",",
"meta",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"version",
"++",
"\n",
"log",
".",
"Printf",
"(",
"\"",
"\"",
",",
"version",
",",
"os",
")",
"\n",
"return",
"resourceVSphereFolderMigrateState",
"(",
"version",
",",
"os",
",",
"meta",
")",
"\n",
"}"
] |
25,045 | all-25046 | [
"FetchIssueComments",
"fetches",
"comments",
"associated",
"to",
"given",
"Issue",
"(",
"since",
"latest",
")"
] | [
"func",
"(",
"client",
"*",
"Client",
")",
"FetchIssueComments",
"(",
"issueID",
"int",
",",
"latest",
"time",
".",
"Time",
",",
"c",
"chan",
"*",
"github",
".",
"IssueComment",
")",
"{",
"opt",
":=",
"&",
"github",
".",
"IssueListCommentsOptions",
"{",
"Since",
":",
"latest",
",",
"Sort",
":",
"\"",
"\"",
",",
"Direction",
":",
"\"",
"\"",
"}",
"\n\n",
"githubClient",
",",
"err",
":=",
"client",
".",
"getGitHubClient",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"close",
"(",
"c",
")",
"\n",
"glog",
".",
"Error",
"(",
"err",
")",
"\n",
"return",
"\n",
"}",
"\n\n",
"count",
":=",
"0",
"\n",
"for",
"{",
"client",
".",
"limitsCheckAndWait",
"(",
")",
"\n\n",
"comments",
",",
"resp",
",",
"err",
":=",
"githubClient",
".",
"Issues",
".",
"ListComments",
"(",
"context",
".",
"Background",
"(",
")",
",",
"client",
".",
"Org",
",",
"client",
".",
"Project",
",",
"issueID",
",",
"opt",
",",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"close",
"(",
"c",
")",
"\n",
"glog",
".",
"Error",
"(",
"err",
")",
"\n",
"return",
"\n",
"}",
"\n\n",
"for",
"_",
",",
"comment",
":=",
"range",
"comments",
"{",
"c",
"<-",
"comment",
"\n",
"count",
"++",
"\n",
"}",
"\n",
"if",
"resp",
".",
"NextPage",
"==",
"0",
"{",
"break",
"\n",
"}",
"\n",
"opt",
".",
"ListOptions",
".",
"Page",
"=",
"resp",
".",
"NextPage",
"\n",
"}",
"\n\n",
"glog",
".",
"Infof",
"(",
"\"",
"\"",
",",
"<mask>",
",",
"latest",
",",
"issueID",
")",
"\n",
"close",
"(",
"c",
")",
"\n",
"}"
] |
25,046 | all-25047 | [
"NodeClear",
"removes",
"any",
"container",
"or",
"image",
"associated",
"with",
"this",
"node",
"."
] | [
"func",
"(",
"c",
"*",
"ClusterTx",
")",
"NodeClear",
"(",
"id",
"int64",
")",
"error",
"{",
"_",
",",
"err",
":=",
"c",
".",
"tx",
".",
"Exec",
"(",
"\"",
"\"",
",",
"id",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"// Get the IDs of the images this node is hosting.",
"ids",
",",
"err",
":=",
"query",
".",
"SelectIntegers",
"(",
"c",
".",
"<mask>",
",",
"\"",
"\"",
",",
"id",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"// Delete the association",
"_",
",",
"err",
"=",
"c",
".",
"tx",
".",
"Exec",
"(",
"\"",
"\"",
",",
"id",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"// Delete the image as well if this was the only node with it.",
"for",
"_",
",",
"id",
":=",
"range",
"ids",
"{",
"count",
",",
"err",
":=",
"query",
".",
"Count",
"(",
"c",
".",
"tx",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"id",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"if",
"count",
">",
"0",
"{",
"continue",
"\n",
"}",
"\n",
"_",
",",
"err",
"=",
"c",
".",
"tx",
".",
"Exec",
"(",
"\"",
"\"",
",",
"id",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"}",
"\n\n",
"return",
"nil",
"\n",
"}"
] |
25,047 | all-25048 | [
"Wildcard",
"matches",
"paths",
"with",
"wildcard",
"form",
".",
"E",
".",
"g",
".",
"/",
"foo",
"/",
"v1",
"/",
"bar",
"/",
"v2",
"will",
"match",
"the",
"form",
"/",
"foo",
"/",
"*",
"/",
"bar",
"/",
"*",
"and",
"/",
"foo",
"/",
"v1",
"/",
"v2",
"/",
"bar",
"will",
"match",
"the",
"form",
"/",
"foo",
"/",
"*",
"/",
"*",
"/",
"bar",
"but",
"will",
"not",
"match",
"/",
"foo",
"/",
"*",
"/",
"bar",
"."
] | [
"func",
"Wildcard",
"(",
"path",
"string",
")",
"*",
"wildcard",
"{",
"matches",
":=",
"strings",
".",
"Split",
"(",
"<mask>",
",",
"\"",
"\"",
")",
"\n",
"return",
"&",
"wildcard",
"{",
"matches",
":",
"matches",
",",
"}",
"\n",
"}"
] |
25,048 | all-25049 | [
"connect",
"opens",
"a",
"new",
"connection",
"to",
"the",
"server",
"."
] | [
"func",
"(",
"c",
"*",
"Client",
")",
"connect",
"(",
")",
"error",
"{",
"dialer",
":=",
"&",
"net",
".",
"Dialer",
"{",
"Timeout",
":",
"30",
"*",
"time",
".",
"Second",
",",
"KeepAlive",
":",
"30",
"*",
"time",
".",
"Second",
",",
"}",
"\n\n",
"conn",
",",
"err",
":=",
"dialer",
".",
"Dial",
"(",
"\"",
"\"",
",",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"c",
".",
"serverHost",
",",
"c",
".",
"serverPort",
")",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"}",
"\n\n",
"c",
".",
"conn",
"=",
"<mask>",
"\n",
"c",
".",
"rw",
"=",
"bufio",
".",
"NewReadWriter",
"(",
"bufio",
".",
"NewReader",
"(",
"c",
".",
"conn",
")",
",",
"bufio",
".",
"NewWriter",
"(",
"c",
".",
"conn",
")",
")",
"\n",
"return",
"nil",
"\n",
"}"
] |
25,049 | all-25050 | [
"MSetsysForUid",
"sets",
"multiple",
"values",
"of",
"the",
"environment",
"variables",
"named",
"by",
"the",
"keys",
"that",
"affects",
"the",
"system",
"as",
"a",
"whole",
".",
"You",
"must",
"be",
"Root",
".",
"It",
"returns",
"an",
"error",
"if",
"any",
"."
] | [
"func",
"MSetsysForUid",
"(",
"id",
"int",
",",
"<mask>",
",",
"values",
"[",
"]",
"string",
")",
"error",
"{",
"if",
"!",
"_IS_ROOT",
"{",
"return",
"ErrNoRoot",
"\n",
"}",
"\n\n",
"_settings",
",",
"err",
":=",
"getSettingsForUid",
"(",
"id",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"return",
"_MSet",
"(",
"_settings",
".",
"global",
",",
"keys",
",",
"values",
")",
"\n",
"}"
] |
25,050 | all-25051 | [
"UnmarshalJSON",
"supports",
"json",
".",
"Unmarshaler",
"interface"
] | [
"func",
"(",
"v",
"*",
"InsertTextParams",
")",
"UnmarshalJSON",
"(",
"<mask>",
"[",
"]",
"byte",
")",
"error",
"{",
"r",
":=",
"jlexer",
".",
"Lexer",
"{",
"Data",
":",
"data",
"}",
"\n",
"easyjsonC5a4559bDecodeGithubComChromedpCdprotoInput5",
"(",
"&",
"r",
",",
"v",
")",
"\n",
"return",
"r",
".",
"Error",
"(",
")",
"\n",
"}"
] |
25,051 | all-25052 | [
"adds",
"endpoint",
"into",
"recordset",
"aggregation",
"loading",
"original",
"values",
"from",
"endpoint",
"labels",
"first"
] | [
"func",
"addEndpoint",
"(",
"ep",
"*",
"endpoint",
".",
"Endpoint",
",",
"recordSets",
"map",
"[",
"string",
"]",
"*",
"recordSet",
",",
"delete",
"bool",
")",
"{",
"key",
":=",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"ep",
".",
"DNSName",
",",
"ep",
".",
"RecordType",
")",
"\n",
"rs",
":=",
"recordSets",
"[",
"<mask>",
"]",
"\n",
"if",
"rs",
"==",
"nil",
"{",
"rs",
"=",
"&",
"recordSet",
"{",
"dnsName",
":",
"canonicalizeDomainName",
"(",
"ep",
".",
"DNSName",
")",
",",
"recordType",
":",
"ep",
".",
"RecordType",
",",
"names",
":",
"make",
"(",
"map",
"[",
"string",
"]",
"bool",
")",
",",
"}",
"\n",
"}",
"\n",
"if",
"rs",
".",
"zoneID",
"==",
"\"",
"\"",
"{",
"rs",
".",
"zoneID",
"=",
"ep",
".",
"Labels",
"[",
"designateZoneID",
"]",
"\n",
"}",
"\n",
"if",
"rs",
".",
"recordSetID",
"==",
"\"",
"\"",
"{",
"rs",
".",
"recordSetID",
"=",
"ep",
".",
"Labels",
"[",
"designateRecordSetID",
"]",
"\n",
"}",
"\n",
"for",
"_",
",",
"rec",
":=",
"range",
"strings",
".",
"Split",
"(",
"ep",
".",
"Labels",
"[",
"designateOriginalRecords",
"]",
",",
"\"",
"\\000",
"\"",
")",
"{",
"if",
"_",
",",
"ok",
":=",
"rs",
".",
"names",
"[",
"rec",
"]",
";",
"!",
"ok",
"&&",
"rec",
"!=",
"\"",
"\"",
"{",
"rs",
".",
"names",
"[",
"rec",
"]",
"=",
"true",
"\n",
"}",
"\n",
"}",
"\n",
"targets",
":=",
"ep",
".",
"Targets",
"\n",
"if",
"ep",
".",
"RecordType",
"==",
"endpoint",
".",
"RecordTypeCNAME",
"{",
"targets",
"=",
"canonicalizeDomainNames",
"(",
"targets",
")",
"\n",
"}",
"\n",
"for",
"_",
",",
"t",
":=",
"range",
"targets",
"{",
"rs",
".",
"names",
"[",
"t",
"]",
"=",
"!",
"delete",
"\n",
"}",
"\n",
"recordSets",
"[",
"key",
"]",
"=",
"rs",
"\n",
"}"
] |
25,052 | all-25053 | [
"Create",
"creates",
"a",
"ClusterComputeResource",
"in",
"a",
"supplied",
"folder",
".",
"The",
"resulting",
"ClusterComputeResource",
"is",
"returned",
"."
] | [
"func",
"Create",
"(",
"f",
"*",
"object",
".",
"Folder",
",",
"name",
"string",
",",
"spec",
"types",
".",
"ClusterConfigSpecEx",
")",
"(",
"*",
"object",
".",
"ClusterComputeResource",
",",
"error",
")",
"{",
"log",
".",
"Printf",
"(",
"\"",
"\"",
",",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"f",
".",
"InventoryPath",
",",
"<mask>",
")",
")",
"\n",
"ctx",
",",
"cancel",
":=",
"context",
".",
"WithTimeout",
"(",
"context",
".",
"Background",
"(",
")",
",",
"provider",
".",
"DefaultAPITimeout",
")",
"\n",
"defer",
"cancel",
"(",
")",
"\n",
"cluster",
",",
"err",
":=",
"f",
".",
"CreateCluster",
"(",
"ctx",
",",
"name",
",",
"spec",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"return",
"cluster",
",",
"nil",
"\n",
"}"
] |
25,053 | all-25054 | [
"SetLayout",
"()",
"is",
"a",
"wrapper",
"around",
"gtk_button_box_set_layout",
"()",
"."
] | [
"func",
"(",
"v",
"*",
"ButtonBox",
")",
"SetLayout",
"(",
"style",
"ButtonBoxStyle",
")",
"{",
"C",
".",
"gtk_button_box_set_layout",
"(",
"v",
".",
"native",
"(",
")",
",",
"C",
".",
"GtkButtonBoxStyle",
"(",
"<mask>",
")",
")",
"\n",
"}"
] |
25,054 | all-25055 | [
"NormalizeSCSIBus",
"checks",
"the",
"SCSI",
"controllers",
"on",
"the",
"virtual",
"machine",
"and",
"either",
"creates",
"them",
"if",
"they",
"don",
"t",
"exist",
"or",
"migrates",
"them",
"to",
"the",
"specified",
"controller",
"type",
".",
"Devices",
"are",
"migrated",
"to",
"the",
"new",
"controller",
"appropriately",
".",
"A",
"spec",
"slice",
"is",
"returned",
"with",
"the",
"changes",
".",
"The",
"first",
"number",
"of",
"slots",
"specified",
"by",
"count",
"are",
"normalized",
"by",
"this",
"function",
".",
"Any",
"others",
"are",
"left",
"unchanged",
"."
] | [
"func",
"NormalizeSCSIBus",
"(",
"l",
"object",
".",
"VirtualDeviceList",
",",
"ct",
"string",
",",
"count",
"int",
",",
"st",
"string",
")",
"(",
"object",
".",
"VirtualDeviceList",
",",
"[",
"]",
"types",
".",
"BaseVirtualDeviceConfigSpec",
",",
"error",
")",
"{",
"log",
".",
"Printf",
"(",
"\"",
"\"",
",",
"count",
",",
"ct",
")",
"\n",
"var",
"spec",
"[",
"]",
"types",
".",
"BaseVirtualDeviceConfigSpec",
"\n",
"ctlrs",
":=",
"make",
"(",
"[",
"]",
"types",
".",
"BaseVirtualSCSIController",
",",
"count",
")",
"\n",
"// Don't worry about doing any fancy select stuff here, just go thru the",
"// VirtualDeviceList and populate the controllers.",
"iCount",
":=",
"int32",
"(",
"count",
")",
"\n",
"for",
"_",
",",
"dev",
":=",
"range",
"l",
"{",
"if",
"sc",
",",
"ok",
":=",
"dev",
".",
"(",
"types",
".",
"BaseVirtualSCSIController",
")",
";",
"ok",
"{",
"if",
"busNumber",
":=",
"sc",
".",
"GetVirtualSCSIController",
"(",
")",
".",
"BusNumber",
";",
"busNumber",
"<",
"iCount",
"{",
"ctlrs",
"[",
"busNumber",
"]",
"=",
"sc",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n",
"log",
".",
"Printf",
"(",
"\"",
"\"",
",",
"scsiControllerListString",
"(",
"ctlrs",
")",
")",
"\n",
"// Now iterate over the controllers",
"for",
"n",
",",
"ctlr",
":=",
"<mask>",
"ctlrs",
"{",
"if",
"ctlr",
"==",
"nil",
"{",
"log",
".",
"Printf",
"(",
"\"",
"\"",
",",
"ct",
",",
"n",
")",
"\n",
"cspec",
",",
"err",
":=",
"createSCSIController",
"(",
"&",
"l",
",",
"ct",
",",
"st",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"nil",
",",
"err",
"\n",
"}",
"\n",
"spec",
"=",
"append",
"(",
"spec",
",",
"cspec",
"...",
")",
"\n",
"continue",
"\n",
"}",
"\n",
"if",
"l",
".",
"Type",
"(",
"ctlr",
".",
"(",
"types",
".",
"BaseVirtualDevice",
")",
")",
"==",
"ct",
"{",
"cspec",
",",
"err",
":=",
"setSCSIBusSharing",
"(",
"&",
"l",
",",
"ctlr",
",",
"st",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"nil",
",",
"err",
"\n",
"}",
"\n",
"spec",
"=",
"append",
"(",
"spec",
",",
"cspec",
"...",
")",
"\n",
"continue",
"\n",
"}",
"\n",
"cspec",
",",
"err",
":=",
"swapSCSIDevice",
"(",
"l",
",",
"ctlr",
",",
"ct",
",",
"st",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"nil",
",",
"err",
"\n",
"}",
"\n",
"spec",
"=",
"append",
"(",
"spec",
",",
"cspec",
"...",
")",
"\n",
"l",
"=",
"applyDeviceChange",
"(",
"l",
",",
"cspec",
")",
"\n",
"continue",
"\n",
"}",
"\n",
"log",
".",
"Printf",
"(",
"\"",
"\"",
",",
"DeviceListString",
"(",
"l",
")",
")",
"\n",
"log",
".",
"Printf",
"(",
"\"",
"\"",
",",
"DeviceChangeString",
"(",
"spec",
")",
")",
"\n",
"return",
"l",
",",
"spec",
",",
"nil",
"\n",
"}"
] |
25,055 | all-25056 | [
"pushImage",
"pushes",
"a",
"docker",
"image",
"."
] | [
"func",
"pushImage",
"(",
"client",
"*",
"docker",
".",
"Client",
",",
"authConfig",
"docker",
".",
"AuthConfiguration",
",",
"repo",
"string",
",",
"sourceTag",
"string",
",",
"destTag",
"string",
")",
"(",
"string",
",",
"error",
")",
"{",
"sourceImage",
":=",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"repo",
",",
"sourceTag",
")",
"\n",
"destImage",
":=",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"repo",
",",
"destTag",
")",
"\n\n",
"fmt",
".",
"Printf",
"(",
"\"",
"\\n",
"\"",
",",
"destImage",
")",
"\n\n",
"if",
"err",
":=",
"client",
".",
"TagImage",
"(",
"sourceImage",
",",
"docker",
".",
"TagImageOptions",
"{",
"Repo",
":",
"repo",
",",
"Tag",
":",
"destTag",
",",
"Context",
":",
"context",
".",
"Background",
"(",
")",
",",
"}",
")",
";",
"err",
"!=",
"nil",
"{",
"err",
"=",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"return",
"\"",
"\"",
",",
"err",
"\n",
"}",
"\n\n",
"if",
"err",
":=",
"<mask>",
".",
"PushImage",
"(",
"docker",
".",
"PushImageOptions",
"{",
"Name",
":",
"repo",
",",
"Tag",
":",
"destTag",
",",
"}",
",",
"authConfig",
",",
")",
";",
"err",
"!=",
"nil",
"{",
"err",
"=",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"return",
"\"",
"\"",
",",
"err",
"\n",
"}",
"\n\n",
"return",
"destImage",
",",
"nil",
"\n",
"}"
] |
25,056 | all-25057 | [
"Passwd",
"sets",
"a",
"hashed",
"passwd",
"for",
"the",
"actual",
"user",
".",
"The",
"passwd",
"must",
"be",
"supplied",
"in",
"clear",
"-",
"text",
"."
] | [
"func",
"(",
"s",
"*",
"Shadow",
")",
"Passwd",
"(",
"key",
"[",
"]",
"byte",
")",
"{",
"loadConfig",
"(",
")",
"\n",
"s",
".",
"password",
",",
"_",
"=",
"config",
".",
"crypter",
".",
"Generate",
"(",
"<mask>",
",",
"nil",
")",
"\n",
"s",
".",
"setChange",
"(",
")",
"\n",
"}"
] |
25,057 | all-25058 | [
"SAdd",
"returns",
"a",
"new",
"vector",
"that",
"is",
"the",
"result",
"of",
"v",
"+",
"(",
"v1",
"*",
"s",
")",
".",
"It",
"allocates",
"a",
"new",
"vector",
"/",
"slice",
"."
] | [
"func",
"(",
"v",
"Vec3",
")",
"SAdd",
"(",
"v1",
"Vec3",
",",
"s",
"float32",
")",
"Vec3",
"{",
"<mask>",
"NewVec3XYZ",
"(",
"v",
"[",
"0",
"]",
"+",
"v1",
"[",
"0",
"]",
"*",
"s",
",",
"v",
"[",
"1",
"]",
"+",
"v1",
"[",
"1",
"]",
"*",
"s",
",",
"v",
"[",
"2",
"]",
"+",
"v1",
"[",
"2",
"]",
"*",
"s",
",",
")",
"\n",
"}"
] |
25,058 | all-25059 | [
"define",
"an",
"array",
"of",
"vertex",
"data"
] | [
"func",
"VertexPointer",
"(",
"<mask>",
"int32",
",",
"xtype",
"uint32",
",",
"stride",
"int32",
",",
"pointer",
"unsafe",
".",
"Pointer",
")",
"{",
"syscall",
".",
"Syscall6",
"(",
"gpVertexPointer",
",",
"4",
",",
"uintptr",
"(",
"size",
")",
",",
"uintptr",
"(",
"xtype",
")",
",",
"uintptr",
"(",
"stride",
")",
",",
"uintptr",
"(",
"pointer",
")",
",",
"0",
",",
"0",
")",
"\n",
"}"
] |
25,059 | all-25060 | [
"/",
"Create",
"a",
"new",
"PDF",
"surface",
"."
] | [
"func",
"CreatePDFSurface",
"(",
"fileName",
"string",
",",
"width",
"float64",
",",
"height",
"float64",
")",
"(",
"*",
"Surface",
",",
"error",
")",
"{",
"cstr",
":=",
"C",
".",
"CString",
"(",
"fileName",
")",
"\n",
"defer",
"C",
".",
"free",
"(",
"unsafe",
".",
"Pointer",
"(",
"cstr",
")",
")",
"\n\n",
"surfaceNative",
":=",
"C",
".",
"cairo_pdf_surface_create",
"(",
"cstr",
",",
"C",
".",
"double",
"(",
"width",
")",
",",
"C",
".",
"double",
"(",
"height",
")",
")",
"\n\n",
"status",
":=",
"Status",
"(",
"C",
".",
"cairo_surface_status",
"(",
"surfaceNative",
")",
")",
"\n",
"if",
"status",
"!=",
"STATUS_SUCCESS",
"{",
"return",
"nil",
",",
"ErrorStatus",
"(",
"status",
")",
"\n",
"}",
"\n\n",
"s",
":=",
"wrapSurface",
"(",
"surfaceNative",
")",
"\n\n",
"runtime",
".",
"SetFinalizer",
"(",
"s",
",",
"(",
"*",
"Surface",
")",
".",
"<mask>",
")",
"\n\n",
"return",
"s",
",",
"nil",
"\n",
"}"
] |
25,060 | all-25061 | [
"contains",
"is",
"whether",
"the",
"given",
"key",
"has",
"a",
"watcher",
"in",
"the",
"group",
"."
] | [
"func",
"(",
"wg",
"*",
"watcherGroup",
")",
"contains",
"(",
"<mask>",
"string",
")",
"bool",
"{",
"_",
",",
"ok",
":=",
"wg",
".",
"keyWatchers",
"[",
"key",
"]",
"\n",
"return",
"ok",
"||",
"wg",
".",
"ranges",
".",
"Intersects",
"(",
"adt",
".",
"NewStringAffinePoint",
"(",
"key",
")",
")",
"\n",
"}"
] |
25,061 | all-25062 | [
"Apps",
"returns",
"an",
"object",
"that",
"can",
"list",
"and",
"get",
"Apps",
"."
] | [
"func",
"(",
"s",
"*",
"appLister",
")",
"Apps",
"(",
"namespace",
"string",
")",
"AppNamespaceLister",
"{",
"<mask>",
"appNamespaceLister",
"{",
"indexer",
":",
"s",
".",
"indexer",
",",
"namespace",
":",
"namespace",
"}",
"\n",
"}"
] |
25,062 | all-25063 | [
"MarshalJSON",
"supports",
"json",
".",
"Marshaler",
"interface"
] | [
"func",
"(",
"v",
"SetEffectivePropertyValueForNodeParams",
")",
"MarshalJSON",
"(",
")",
"(",
"[",
"]",
"<mask>",
",",
"error",
")",
"{",
"w",
":=",
"jwriter",
".",
"Writer",
"{",
"}",
"\n",
"easyjsonC5a4559bEncodeGithubComChromedpCdprotoCss21",
"(",
"&",
"w",
",",
"v",
")",
"\n",
"return",
"w",
".",
"Buffer",
".",
"BuildBytes",
"(",
")",
",",
"w",
".",
"Error",
"\n",
"}"
] |
25,063 | all-25064 | [
"Patch",
"sets",
"the",
"value",
"pointed",
"to",
"by",
"the",
"given",
"destination",
"to",
"the",
"given",
"value",
"and",
"returns",
"a",
"function",
"to",
"restore",
"it",
"to",
"its",
"original",
"value",
".",
"The",
"value",
"must",
"be",
"assignable",
"to",
"the",
"element",
"type",
"of",
"the",
"destination",
".",
"For",
"an",
"exaple",
"see",
":",
"https",
":",
"//",
"github",
".",
"com",
"/",
"heketi",
"/",
"heketi",
"/",
"blob",
"/",
"master",
"/",
"utils",
"/",
"log_test",
".",
"go"
] | [
"func",
"Patch",
"(",
"dest",
",",
"<mask>",
"interface",
"{",
"}",
")",
"Restorer",
"{",
"destv",
":=",
"reflect",
".",
"ValueOf",
"(",
"dest",
")",
".",
"Elem",
"(",
")",
"\n",
"oldv",
":=",
"reflect",
".",
"New",
"(",
"destv",
".",
"Type",
"(",
")",
")",
".",
"Elem",
"(",
")",
"\n",
"oldv",
".",
"Set",
"(",
"destv",
")",
"\n",
"valuev",
":=",
"reflect",
".",
"ValueOf",
"(",
"value",
")",
"\n",
"if",
"!",
"valuev",
".",
"IsValid",
"(",
")",
"{",
"// This isn't quite right when the destination type is not",
"// nilable, but it's better than the complex alternative.",
"valuev",
"=",
"reflect",
".",
"Zero",
"(",
"destv",
".",
"Type",
"(",
")",
")",
"\n",
"}",
"\n",
"destv",
".",
"Set",
"(",
"valuev",
")",
"\n",
"return",
"func",
"(",
")",
"{",
"destv",
".",
"Set",
"(",
"oldv",
")",
"\n",
"}",
"\n",
"}"
] |
25,064 | all-25065 | [
"view",
"returns",
"runs",
"the",
"specified",
"fn",
"within",
"a",
"read",
"-",
"only",
"transaction",
"on",
"the",
"database",
"."
] | [
"func",
"(",
"bdc",
"*",
"cache",
")",
"view",
"(",
"fn",
"func",
"(",
"tx",
"*",
"bolt",
".",
"Tx",
")",
"error",
")",
"(",
"retErr",
"error",
")",
"{",
"// bolt.Open(bdc.path, 0600, &bolt.Options{ReadOnly: true}) will, if the file does not exist,",
"// nevertheless create it, but with an O_RDONLY file descriptor, try to initialize it, and fail — while holding",
"// a read lock, blocking any future writes.",
"// Hence this preliminary check, which is RACY: Another process could remove the file",
"// between the Lstat call and opening the database.",
"if",
"_",
",",
"err",
":=",
"os",
".",
"Lstat",
"(",
"bdc",
".",
"path",
")",
";",
"err",
"!=",
"nil",
"&&",
"os",
".",
"IsNotExist",
"(",
"err",
")",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"lockPath",
"(",
"bdc",
".",
"path",
")",
"\n",
"defer",
"unlockPath",
"(",
"bdc",
".",
"<mask>",
")",
"\n",
"db",
",",
"err",
":=",
"bolt",
".",
"Open",
"(",
"bdc",
".",
"path",
",",
"0600",
",",
"&",
"bolt",
".",
"Options",
"{",
"ReadOnly",
":",
"true",
"}",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"defer",
"func",
"(",
")",
"{",
"if",
"err",
":=",
"db",
".",
"Close",
"(",
")",
";",
"retErr",
"==",
"nil",
"&&",
"err",
"!=",
"nil",
"{",
"retErr",
"=",
"err",
"\n",
"}",
"\n",
"}",
"(",
")",
"\n\n",
"return",
"db",
".",
"View",
"(",
"fn",
")",
"\n",
"}"
] |
25,065 | all-25066 | [
"functionColor",
"returns",
"the",
"color",
"to",
"be",
"used",
"for",
"the",
"function",
"name",
"based",
"on",
"the",
"type",
"of",
"package",
"the",
"function",
"is",
"in",
"."
] | [
"func",
"(",
"p",
"*",
"Palette",
")",
"functionColor",
"(",
"line",
"*",
"stack",
".",
"Call",
")",
"string",
"{",
"if",
"line",
".",
"IsStdlib",
"{",
"if",
"<mask>",
".",
"Func",
".",
"IsExported",
"(",
")",
"{",
"return",
"p",
".",
"FuncStdLibExported",
"\n",
"}",
"\n",
"return",
"p",
".",
"FuncStdLib",
"\n",
"}",
"else",
"if",
"line",
".",
"IsPkgMain",
"(",
")",
"{",
"return",
"p",
".",
"FuncMain",
"\n",
"}",
"else",
"if",
"line",
".",
"Func",
".",
"IsExported",
"(",
")",
"{",
"return",
"p",
".",
"FuncOtherExported",
"\n",
"}",
"\n",
"return",
"p",
".",
"FuncOther",
"\n",
"}"
] |
25,066 | all-25067 | [
"/",
"*",
"Closed",
"returns",
"true",
"if",
"the",
"buffer",
"has",
"been",
"closed"
] | [
"func",
"(",
"b",
"*",
"Buffer",
")",
"Closed",
"(",
")",
"bool",
"{",
"b",
".",
"<mask>",
".",
"Lock",
"(",
")",
"\n",
"defer",
"b",
".",
"lock",
".",
"Unlock",
"(",
")",
"\n\n",
"return",
"b",
".",
"closed",
"\n",
"}"
] |
25,067 | all-25068 | [
"ChangeNormalHostCheckInterval",
"creates",
"a",
"new",
"CHANGE_NORMAL_HOST_CHECK_INTERVAL",
"Nagios",
"command",
".",
"Changes",
"the",
"normal",
"(",
"regularly",
"scheduled",
")",
"check",
"interval",
"for",
"a",
"particular",
"host",
"."
] | [
"func",
"ChangeNormalHostCheckInterval",
"(",
"host_name",
"string",
",",
"check_interval",
"<mask>",
".",
"Duration",
",",
")",
"*",
"livestatus",
".",
"Command",
"{",
"return",
"livestatus",
".",
"NewCommand",
"(",
"\"",
"\"",
",",
"stringifyArg",
"(",
"\"",
"\"",
",",
"\"",
"\"",
",",
"host_name",
")",
",",
"stringifyArg",
"(",
"\"",
"\"",
",",
"\"",
"\"",
",",
"check_interval",
")",
",",
")",
"\n",
"}"
] |
25,068 | all-25069 | [
"parseFileEncryptionRecord",
"processes",
"the",
"optional",
"file",
"encryption",
"record",
"from",
"a",
"file",
"header",
"."
] | [
"func",
"(",
"a",
"*",
"archive50",
")",
"parseFileEncryptionRecord",
"(",
"b",
"readBuf",
",",
"f",
"*",
"fileBlockHeader",
")",
"error",
"{",
"if",
"ver",
":=",
"b",
".",
"uvarint",
"(",
")",
";",
"ver",
"!=",
"0",
"{",
"return",
"errUnknownEncMethod",
"\n",
"}",
"\n",
"flags",
":=",
"b",
".",
"uvarint",
"(",
")",
"\n\n",
"keys",
",",
"err",
":=",
"a",
".",
"getKeys",
"(",
"&",
"b",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"f",
".",
"key",
"=",
"keys",
"[",
"0",
"]",
"\n",
"if",
"len",
"(",
"b",
")",
"<",
"16",
"{",
"return",
"errCorruptEncrypt",
"\n",
"}",
"\n",
"f",
".",
"iv",
"=",
"b",
".",
"bytes",
"(",
"16",
")",
"\n\n",
"if",
"flags",
"&",
"file5EncCheckPresent",
">",
"0",
"{",
"if",
"err",
":=",
"checkPassword",
"(",
"&",
"b",
",",
"keys",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"}",
"\n",
"if",
"flags",
"&",
"file5EncUseMac",
">",
"0",
"{",
"a",
".",
"checksum",
".",
"<mask>",
"=",
"keys",
"[",
"1",
"]",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
] |
25,069 | all-25070 | [
"tagOrDigest",
"returns",
"a",
"tag",
"or",
"digest",
"from",
"the",
"reference",
"."
] | [
"func",
"(",
"ref",
"dockerReference",
")",
"tagOrDigest",
"(",
")",
"(",
"string",
",",
"error",
")",
"{",
"if",
"ref",
",",
"ok",
":=",
"ref",
".",
"ref",
".",
"(",
"reference",
".",
"Canonical",
")",
";",
"ok",
"{",
"return",
"ref",
".",
"Digest",
"(",
")",
".",
"String",
"(",
")",
",",
"nil",
"\n",
"}",
"\n",
"if",
"<mask>",
",",
"ok",
":=",
"ref",
".",
"ref",
".",
"(",
"reference",
".",
"NamedTagged",
")",
";",
"ok",
"{",
"return",
"ref",
".",
"Tag",
"(",
")",
",",
"nil",
"\n",
"}",
"\n",
"// This should not happen, NewReference above refuses reference.IsNameOnly values.",
"return",
"\"",
"\"",
",",
"errors",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"reference",
".",
"FamiliarString",
"(",
"ref",
".",
"ref",
")",
")",
"\n",
"}"
] |
25,070 | all-25071 | [
"UpdateCharSet",
"will",
"change",
"the",
"current",
"character",
"set",
"to",
"the",
"given",
"one"
] | [
"func",
"(",
"s",
"*",
"Spinner",
")",
"UpdateCharSet",
"(",
"cs",
"[",
"]",
"string",
")",
"{",
"s",
".",
"<mask>",
".",
"Lock",
"(",
")",
"\n",
"defer",
"s",
".",
"lock",
".",
"Unlock",
"(",
")",
"\n",
"s",
".",
"chars",
"=",
"cs",
"\n",
"}"
] |
25,071 | all-25072 | [
"ParseCommit",
"takes",
"an",
"argument",
"of",
"the",
"form",
"repo",
"["
] | [
"func",
"ParseCommit",
"(",
"arg",
"string",
")",
"(",
"*",
"pfs",
".",
"Commit",
",",
"error",
")",
"{",
"parts",
":=",
"strings",
".",
"SplitN",
"(",
"arg",
",",
"\"",
"\"",
",",
"2",
")",
"\n",
"if",
"parts",
"[",
"0",
"]",
"==",
"\"",
"\"",
"{",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\\\"",
"\\\"",
"\"",
",",
"arg",
")",
"\n",
"}",
"\n",
"commit",
":=",
"&",
"pfs",
".",
"Commit",
"{",
"Repo",
":",
"&",
"pfs",
".",
"Repo",
"{",
"Name",
":",
"parts",
"[",
"0",
"]",
",",
"}",
",",
"ID",
":",
"\"",
"\"",
",",
"}",
"\n",
"if",
"len",
"(",
"parts",
")",
"==",
"2",
"{",
"commit",
".",
"ID",
"=",
"parts",
"[",
"1",
"]",
"\n",
"}",
"\n",
"return",
"<mask>",
",",
"nil",
"\n",
"}"
] |
25,072 | all-25073 | [
"GetClientEmail",
"returns",
"the",
"ClientEmail",
"field",
"if",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"."
] | [
"func",
"(",
"i",
"*",
"IntegrationGCPUpdateRequest",
")",
"GetClientEmail",
"(",
")",
"string",
"{",
"if",
"i",
"==",
"nil",
"||",
"i",
".",
"ClientEmail",
"==",
"nil",
"{",
"return",
"\"",
"\"",
"\n",
"}",
"\n",
"<mask>",
"*",
"i",
".",
"ClientEmail",
"\n",
"}"
] |
25,073 | all-25074 | [
"NewSession",
"gets",
"the",
"leased",
"session",
"for",
"a",
"client",
"."
] | [
"func",
"NewSession",
"(",
"client",
"*",
"v3",
".",
"Client",
",",
"opts",
"...",
"SessionOption",
")",
"(",
"*",
"Session",
",",
"error",
")",
"{",
"ops",
":=",
"&",
"sessionOptions",
"{",
"ttl",
":",
"defaultSessionTTL",
",",
"ctx",
":",
"client",
".",
"Ctx",
"(",
")",
"}",
"\n",
"for",
"_",
",",
"opt",
":=",
"range",
"opts",
"{",
"opt",
"(",
"ops",
")",
"\n",
"}",
"\n\n",
"id",
":=",
"ops",
".",
"leaseID",
"\n",
"if",
"id",
"==",
"v3",
".",
"NoLease",
"{",
"resp",
",",
"err",
":=",
"client",
".",
"Grant",
"(",
"ops",
".",
"ctx",
",",
"int64",
"(",
"ops",
".",
"ttl",
")",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"<mask>",
"=",
"v3",
".",
"LeaseID",
"(",
"resp",
".",
"ID",
")",
"\n",
"}",
"\n\n",
"ctx",
",",
"cancel",
":=",
"context",
".",
"WithCancel",
"(",
"ops",
".",
"ctx",
")",
"\n",
"keepAlive",
",",
"err",
":=",
"client",
".",
"KeepAlive",
"(",
"ctx",
",",
"id",
")",
"\n",
"if",
"err",
"!=",
"nil",
"||",
"keepAlive",
"==",
"nil",
"{",
"cancel",
"(",
")",
"\n",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"donec",
":=",
"make",
"(",
"chan",
"struct",
"{",
"}",
")",
"\n",
"s",
":=",
"&",
"Session",
"{",
"client",
":",
"client",
",",
"opts",
":",
"ops",
",",
"id",
":",
"id",
",",
"cancel",
":",
"cancel",
",",
"donec",
":",
"donec",
"}",
"\n\n",
"// keep the lease alive until client error or cancelled context",
"go",
"func",
"(",
")",
"{",
"defer",
"close",
"(",
"donec",
")",
"\n",
"for",
"range",
"keepAlive",
"{",
"// eat messages until keep alive channel closes",
"}",
"\n",
"}",
"(",
")",
"\n\n",
"return",
"s",
",",
"nil",
"\n",
"}"
] |
25,074 | all-25075 | [
"Set",
"a",
"new",
"dirname",
"for",
"the",
"sequence"
] | [
"func",
"(",
"s",
"*",
"FileSequence",
")",
"SetDirname",
"(",
"dir",
"string",
")",
"{",
"if",
"!",
"strings",
".",
"HasSuffix",
"(",
"dir",
",",
"string",
"(",
"filepath",
".",
"Separator",
")",
")",
"{",
"dir",
"=",
"dir",
"+",
"<mask>",
"(",
"filepath",
".",
"Separator",
")",
"\n",
"}",
"\n",
"s",
".",
"dir",
"=",
"dir",
"\n",
"}"
] |
25,075 | all-25076 | [
"NewLogger",
"creates",
"a",
"new",
"reporter",
"logger",
"."
] | [
"func",
"NewLogger",
"(",
"conf",
"*",
"Config",
")",
"(",
"log",
".",
"Logger",
",",
"error",
")",
"{",
"l",
":=",
"&",
"reportLogger",
"{",
"}",
"\n\n",
"<mask>",
",",
"err",
":=",
"log",
".",
"NewLoggerBase",
"(",
"conf",
".",
"BaseConfig",
",",
"l",
".",
"log",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"l",
".",
"LoggerBase",
"=",
"base",
"\n",
"return",
"l",
",",
"nil",
"\n",
"}"
] |
25,076 | all-25077 | [
"CopyContainerSnapshot",
"copies",
"a",
"snapshot",
"from",
"a",
"remote",
"server",
"into",
"a",
"new",
"container",
".",
"Additional",
"options",
"can",
"be",
"passed",
"using",
"ContainerCopyArgs"
] | [
"func",
"(",
"r",
"*",
"ProtocolLXD",
")",
"CopyContainerSnapshot",
"(",
"source",
"ContainerServer",
",",
"containerName",
"string",
",",
"snapshot",
"api",
".",
"ContainerSnapshot",
",",
"args",
"*",
"ContainerSnapshotCopyArgs",
")",
"(",
"RemoteOperation",
",",
"error",
")",
"{",
"// Backward compatibility (with broken Name field)",
"fields",
":=",
"strings",
".",
"Split",
"(",
"snapshot",
".",
"Name",
",",
"shared",
".",
"SnapshotDelimiter",
")",
"\n",
"cName",
":=",
"containerName",
"\n",
"sName",
":=",
"fields",
"[",
"len",
"(",
"fields",
")",
"-",
"1",
"]",
"\n\n",
"// Base request",
"req",
":=",
"api",
".",
"ContainersPost",
"{",
"Name",
":",
"cName",
",",
"ContainerPut",
":",
"api",
".",
"ContainerPut",
"{",
"Architecture",
":",
"snapshot",
".",
"Architecture",
",",
"Config",
":",
"snapshot",
".",
"Config",
",",
"Devices",
":",
"snapshot",
".",
"Devices",
",",
"Ephemeral",
":",
"snapshot",
".",
"Ephemeral",
",",
"Profiles",
":",
"snapshot",
".",
"Profiles",
",",
"}",
",",
"}",
"\n\n",
"if",
"snapshot",
".",
"Stateful",
"&&",
"args",
".",
"Live",
"{",
"if",
"!",
"r",
".",
"HasExtension",
"(",
"\"",
"\"",
")",
"{",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\\\"",
"\\\"",
"\"",
")",
"\n",
"}",
"\n",
"req",
".",
"ContainerPut",
".",
"Stateful",
"=",
"snapshot",
".",
"Stateful",
"\n",
"req",
".",
"Source",
".",
"Live",
"=",
"args",
".",
"Live",
"\n",
"}",
"\n",
"req",
".",
"Source",
".",
"BaseImage",
"=",
"snapshot",
".",
"Config",
"[",
"\"",
"\"",
"]",
"\n\n",
"// Process the copy arguments",
"if",
"args",
"!=",
"nil",
"{",
"// Sanity checks",
"if",
"shared",
".",
"StringInSlice",
"(",
"args",
".",
"Mode",
",",
"[",
"]",
"string",
"{",
"\"",
"\"",
",",
"\"",
"\"",
"}",
")",
"{",
"if",
"!",
"r",
".",
"HasExtension",
"(",
"\"",
"\"",
")",
"{",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\\\"",
"\\\"",
"\"",
")",
"\n",
"}",
"\n\n",
"if",
"!",
"source",
".",
"HasExtension",
"(",
"\"",
"\"",
")",
"{",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\\\"",
"\\\"",
"\"",
")",
"\n",
"}",
"\n",
"}",
"\n\n",
"if",
"args",
".",
"Mode",
"==",
"\"",
"\"",
"&&",
"!",
"source",
".",
"HasExtension",
"(",
"\"",
"\"",
")",
"{",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\\\"",
"\\\"",
"\"",
")",
"\n",
"}",
"\n\n",
"// Allow overriding the target name",
"if",
"args",
".",
"Name",
"!=",
"\"",
"\"",
"{",
"req",
".",
"<mask>",
"=",
"args",
".",
"Name",
"\n",
"}",
"\n",
"}",
"\n\n",
"sourceInfo",
",",
"err",
":=",
"source",
".",
"GetConnectionInfo",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"}",
"\n\n",
"destInfo",
",",
"err",
":=",
"r",
".",
"GetConnectionInfo",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"}",
"\n\n",
"container",
",",
"_",
",",
"err",
":=",
"source",
".",
"GetContainer",
"(",
"cName",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"}",
"\n\n",
"// Optimization for the local copy case",
"if",
"destInfo",
".",
"URL",
"==",
"sourceInfo",
".",
"URL",
"&&",
"destInfo",
".",
"SocketPath",
"==",
"sourceInfo",
".",
"SocketPath",
"&&",
"(",
"!",
"r",
".",
"IsClustered",
"(",
")",
"||",
"container",
".",
"Location",
"==",
"r",
".",
"clusterTarget",
"||",
"r",
".",
"HasExtension",
"(",
"\"",
"\"",
")",
")",
"{",
"// Project handling",
"if",
"destInfo",
".",
"Project",
"!=",
"sourceInfo",
".",
"Project",
"{",
"if",
"!",
"r",
".",
"HasExtension",
"(",
"\"",
"\"",
")",
"{",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\\\"",
"\\\"",
"\"",
")",
"\n",
"}",
"\n\n",
"req",
".",
"Source",
".",
"Project",
"=",
"sourceInfo",
".",
"Project",
"\n",
"}",
"\n\n",
"// Local copy source fields",
"req",
".",
"Source",
".",
"Type",
"=",
"\"",
"\"",
"\n",
"req",
".",
"Source",
".",
"Source",
"=",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"cName",
",",
"sName",
")",
"\n\n",
"// Copy the container",
"op",
",",
"err",
":=",
"r",
".",
"CreateContainer",
"(",
"req",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"rop",
":=",
"remoteOperation",
"{",
"targetOp",
":",
"op",
",",
"chDone",
":",
"make",
"(",
"chan",
"bool",
")",
",",
"}",
"\n\n",
"// Forward targetOp to remote op",
"go",
"func",
"(",
")",
"{",
"rop",
".",
"err",
"=",
"rop",
".",
"targetOp",
".",
"Wait",
"(",
")",
"\n",
"close",
"(",
"rop",
".",
"chDone",
")",
"\n",
"}",
"(",
")",
"\n\n",
"return",
"&",
"rop",
",",
"nil",
"\n",
"}",
"\n\n",
"// Source request",
"sourceReq",
":=",
"api",
".",
"ContainerSnapshotPost",
"{",
"Migration",
":",
"true",
",",
"Name",
":",
"args",
".",
"Name",
",",
"}",
"\n",
"if",
"snapshot",
".",
"Stateful",
"&&",
"args",
".",
"Live",
"{",
"sourceReq",
".",
"Live",
"=",
"args",
".",
"Live",
"\n",
"}",
"\n\n",
"// Push mode migration",
"if",
"args",
"!=",
"nil",
"&&",
"args",
".",
"Mode",
"==",
"\"",
"\"",
"{",
"// Get target server connection information",
"info",
",",
"err",
":=",
"r",
".",
"GetConnectionInfo",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"// Create the container",
"req",
".",
"Source",
".",
"Type",
"=",
"\"",
"\"",
"\n",
"req",
".",
"Source",
".",
"Mode",
"=",
"\"",
"\"",
"\n\n",
"op",
",",
"err",
":=",
"r",
".",
"CreateContainer",
"(",
"req",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"opAPI",
":=",
"op",
".",
"Get",
"(",
")",
"\n\n",
"targetSecrets",
":=",
"map",
"[",
"string",
"]",
"string",
"{",
"}",
"\n",
"for",
"k",
",",
"v",
":=",
"range",
"opAPI",
".",
"Metadata",
"{",
"targetSecrets",
"[",
"k",
"]",
"=",
"v",
".",
"(",
"string",
")",
"\n",
"}",
"\n\n",
"// Prepare the source request",
"target",
":=",
"api",
".",
"ContainerPostTarget",
"{",
"}",
"\n",
"target",
".",
"Operation",
"=",
"opAPI",
".",
"ID",
"\n",
"target",
".",
"Websockets",
"=",
"targetSecrets",
"\n",
"target",
".",
"Certificate",
"=",
"info",
".",
"Certificate",
"\n",
"sourceReq",
".",
"Target",
"=",
"&",
"target",
"\n\n",
"return",
"r",
".",
"tryMigrateContainerSnapshot",
"(",
"source",
",",
"cName",
",",
"sName",
",",
"sourceReq",
",",
"info",
".",
"Addresses",
")",
"\n",
"}",
"\n\n",
"// Get source server connection information",
"info",
",",
"err",
":=",
"source",
".",
"GetConnectionInfo",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"op",
",",
"err",
":=",
"source",
".",
"MigrateContainerSnapshot",
"(",
"cName",
",",
"sName",
",",
"sourceReq",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"opAPI",
":=",
"op",
".",
"Get",
"(",
")",
"\n\n",
"sourceSecrets",
":=",
"map",
"[",
"string",
"]",
"string",
"{",
"}",
"\n",
"for",
"k",
",",
"v",
":=",
"range",
"opAPI",
".",
"Metadata",
"{",
"sourceSecrets",
"[",
"k",
"]",
"=",
"v",
".",
"(",
"string",
")",
"\n",
"}",
"\n\n",
"// Relay mode migration",
"if",
"args",
"!=",
"nil",
"&&",
"args",
".",
"Mode",
"==",
"\"",
"\"",
"{",
"// Push copy source fields",
"req",
".",
"Source",
".",
"Type",
"=",
"\"",
"\"",
"\n",
"req",
".",
"Source",
".",
"Mode",
"=",
"\"",
"\"",
"\n\n",
"// Start the process",
"targetOp",
",",
"err",
":=",
"r",
".",
"CreateContainer",
"(",
"req",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"targetOpAPI",
":=",
"targetOp",
".",
"Get",
"(",
")",
"\n\n",
"// Extract the websockets",
"targetSecrets",
":=",
"map",
"[",
"string",
"]",
"string",
"{",
"}",
"\n",
"for",
"k",
",",
"v",
":=",
"range",
"targetOpAPI",
".",
"Metadata",
"{",
"targetSecrets",
"[",
"k",
"]",
"=",
"v",
".",
"(",
"string",
")",
"\n",
"}",
"\n\n",
"// Launch the relay",
"err",
"=",
"r",
".",
"proxyMigration",
"(",
"targetOp",
".",
"(",
"*",
"operation",
")",
",",
"targetSecrets",
",",
"source",
",",
"op",
".",
"(",
"*",
"operation",
")",
",",
"sourceSecrets",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"// Prepare a tracking operation",
"rop",
":=",
"remoteOperation",
"{",
"targetOp",
":",
"targetOp",
",",
"chDone",
":",
"make",
"(",
"chan",
"bool",
")",
",",
"}",
"\n\n",
"// Forward targetOp to remote op",
"go",
"func",
"(",
")",
"{",
"rop",
".",
"err",
"=",
"rop",
".",
"targetOp",
".",
"Wait",
"(",
")",
"\n",
"close",
"(",
"rop",
".",
"chDone",
")",
"\n",
"}",
"(",
")",
"\n\n",
"return",
"&",
"rop",
",",
"nil",
"\n",
"}",
"\n\n",
"// Pull mode migration",
"req",
".",
"Source",
".",
"Type",
"=",
"\"",
"\"",
"\n",
"req",
".",
"Source",
".",
"Mode",
"=",
"\"",
"\"",
"\n",
"req",
".",
"Source",
".",
"Operation",
"=",
"opAPI",
".",
"ID",
"\n",
"req",
".",
"Source",
".",
"Websockets",
"=",
"sourceSecrets",
"\n",
"req",
".",
"Source",
".",
"Certificate",
"=",
"info",
".",
"Certificate",
"\n\n",
"return",
"r",
".",
"tryCreateContainer",
"(",
"req",
",",
"info",
".",
"Addresses",
")",
"\n",
"}"
] |
25,077 | all-25078 | [
"AddTitled",
"is",
"a",
"wrapper",
"around",
"gtk_stack_add_titled",
"()",
"."
] | [
"func",
"(",
"v",
"*",
"Stack",
")",
"AddTitled",
"(",
"child",
"IWidget",
",",
"name",
",",
"title",
"string",
")",
"{",
"cName",
":=",
"C",
".",
"CString",
"(",
"name",
")",
"\n",
"defer",
"C",
".",
"free",
"(",
"unsafe",
".",
"Pointer",
"(",
"cName",
")",
")",
"\n",
"cTitle",
":=",
"C",
".",
"CString",
"(",
"title",
")",
"\n",
"defer",
"C",
".",
"free",
"(",
"unsafe",
".",
"Pointer",
"(",
"cTitle",
")",
")",
"\n",
"C",
".",
"gtk_stack_add_titled",
"(",
"v",
".",
"native",
"(",
")",
",",
"<mask>",
".",
"toWidget",
"(",
")",
",",
"(",
"*",
"C",
".",
"gchar",
")",
"(",
"cName",
")",
",",
"(",
"*",
"C",
".",
"gchar",
")",
"(",
"cTitle",
")",
")",
"\n",
"}"
] |
25,078 | all-25079 | [
"ShouldReportToBackend",
"returns",
"true",
"if",
"the",
"container",
"status",
"is",
"recognized",
"as",
"a",
"valid",
"state",
"by",
"ECS",
".",
"Note",
"that",
"not",
"all",
"container",
"statuses",
"are",
"recognized",
"by",
"ECS",
"or",
"map",
"to",
"ECS",
"states"
] | [
"func",
"(",
"cs",
"*",
"ContainerStatus",
")",
"ShouldReportToBackend",
"(",
"steadyStateStatus",
"ContainerStatus",
")",
"bool",
"{",
"return",
"*",
"<mask>",
"==",
"steadyStateStatus",
"||",
"*",
"cs",
"==",
"ContainerStopped",
"\n",
"}"
] |
25,079 | all-25080 | [
"NewUnionInput",
"returns",
"an",
"input",
"which",
"is",
"the",
"union",
"of",
"other",
"inputs",
".",
"That",
"means",
"that",
"all",
"datums",
"from",
"any",
"of",
"the",
"inputs",
"will",
"be",
"seen",
"individually",
"by",
"the",
"job",
"/",
"pipeline",
"."
] | [
"func",
"NewUnionInput",
"(",
"input",
"...",
"*",
"pps",
".",
"<mask>",
")",
"*",
"pps",
".",
"Input",
"{",
"return",
"&",
"pps",
".",
"Input",
"{",
"Union",
":",
"input",
",",
"}",
"\n",
"}"
] |
25,080 | all-25081 | [
"ServeHTTP",
"handles",
"a",
"http",
"request"
] | [
"func",
"(",
"handler",
"ControllerHandler",
")",
"ServeHTTP",
"(",
"w",
"http",
".",
"ResponseWriter",
",",
"r",
"*",
"<mask>",
".",
"Request",
")",
"{",
"handler",
".",
"getResponse",
"(",
"r",
")",
".",
"Send",
"(",
"w",
")",
"\n",
"}"
] |
25,081 | all-25082 | [
"establish",
"data",
"storage",
"format",
"dimensions",
"and",
"sample",
"count",
"of",
"a",
"renderbuffer",
"object",
"s",
"image"
] | [
"func",
"NamedRenderbufferStorageMultisample",
"(",
"renderbuffer",
"uint32",
",",
"samples",
"int32",
",",
"internalformat",
"uint32",
",",
"width",
"int32",
",",
"<mask>",
"int32",
")",
"{",
"syscall",
".",
"Syscall6",
"(",
"gpNamedRenderbufferStorageMultisample",
",",
"5",
",",
"uintptr",
"(",
"renderbuffer",
")",
",",
"uintptr",
"(",
"samples",
")",
",",
"uintptr",
"(",
"internalformat",
")",
",",
"uintptr",
"(",
"width",
")",
",",
"uintptr",
"(",
"height",
")",
",",
"0",
")",
"\n",
"}"
] |
25,082 | all-25083 | [
"Init",
"..."
] | [
"func",
"Init",
"(",
"address",
"string",
",",
"opts",
"Opts",
")",
"(",
"*",
"sql",
".",
"DB",
",",
"error",
")",
"{",
"timeout",
",",
"retry",
":=",
"opts",
".",
"Timeout",
",",
"opts",
".",
"Retry",
"\n",
"if",
"timeout",
"==",
"time",
".",
"Duration",
"(",
"0",
")",
"{",
"timeout",
"=",
"10",
"*",
"time",
".",
"Second",
"\n",
"}",
"\n",
"if",
"retry",
"==",
"time",
".",
"Duration",
"(",
"0",
")",
"{",
"retry",
"=",
"1",
"*",
"time",
".",
"Second",
"\n",
"}",
"\n\n",
"u",
",",
"err",
":=",
"url",
".",
"Parse",
"(",
"address",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"username",
":=",
"\"",
"\"",
"\n",
"if",
"u",
".",
"User",
"!=",
"nil",
"{",
"username",
"=",
"u",
".",
"<mask>",
".",
"Username",
"(",
")",
"\n",
"}",
"\n\n",
"opts",
".",
"Logger",
".",
"Debug",
"(",
"\"",
"\"",
",",
"zap",
".",
"String",
"(",
"\"",
"\"",
",",
"u",
".",
"Host",
")",
",",
"zap",
".",
"String",
"(",
"\"",
"\"",
",",
"username",
")",
")",
"\n\n",
"db",
",",
"err",
":=",
"sql",
".",
"Open",
"(",
"\"",
"\"",
",",
"address",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"err",
".",
"Error",
"(",
")",
")",
"\n",
"}",
"\n\n",
"// Otherwise 1 second cooldown is going to be multiplied by number of tests.",
"ctx",
",",
"cancel",
":=",
"context",
".",
"WithTimeout",
"(",
"context",
".",
"Background",
"(",
")",
",",
"retry",
")",
"\n",
"defer",
"cancel",
"(",
")",
"\n\n",
"if",
"err",
":=",
"db",
".",
"PingContext",
"(",
"ctx",
")",
";",
"err",
"!=",
"nil",
"{",
"cancel",
":=",
"time",
".",
"NewTimer",
"(",
"timeout",
")",
"\n\n",
"PingLoop",
":",
"for",
"{",
"select",
"{",
"case",
"<-",
"time",
".",
"After",
"(",
"retry",
")",
":",
"ctx",
",",
"cancel",
":=",
"context",
".",
"WithTimeout",
"(",
"context",
".",
"Background",
"(",
")",
",",
"retry",
")",
"\n",
"if",
"err",
":=",
"db",
".",
"PingContext",
"(",
"ctx",
")",
";",
"err",
"!=",
"nil",
"{",
"opts",
".",
"Logger",
".",
"Debug",
"(",
"\"",
"\"",
",",
"zap",
".",
"String",
"(",
"\"",
"\"",
",",
"u",
".",
"Host",
")",
",",
"zap",
".",
"String",
"(",
"\"",
"\"",
",",
"username",
")",
")",
"\n\n",
"cancel",
"(",
")",
"\n",
"continue",
"PingLoop",
"\n",
"}",
"\n",
"opts",
".",
"Logger",
".",
"Info",
"(",
"\"",
"\"",
",",
"zap",
".",
"String",
"(",
"\"",
"\"",
",",
"u",
".",
"Host",
")",
",",
"zap",
".",
"String",
"(",
"\"",
"\"",
",",
"username",
")",
")",
"\n\n",
"cancel",
"(",
")",
"\n",
"break",
"PingLoop",
"\n",
"case",
"<-",
"cancel",
".",
"C",
":",
"return",
"nil",
",",
"Timeout",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n\n",
"return",
"db",
",",
"nil",
"\n",
"}"
] |
25,083 | all-25084 | [
"UnmarshalBinary",
"unmarshals",
"a",
"raw",
"byte",
"slice",
"into",
"a",
"Directive",
".",
"If",
"the",
"byte",
"slice",
"does",
"not",
"contain",
"exactly",
"8",
"bytes",
"io",
".",
"ErrUnexpectedEOF",
"is",
"returned",
".",
"If",
"byte",
"0",
"(",
"reserved",
"byte",
")",
"is",
"not",
"empty",
"ErrorBadArgumentParameter",
"is",
"returned",
"."
] | [
"func",
"(",
"d",
"*",
"Directive",
")",
"UnmarshalBinary",
"(",
"b",
"[",
"]",
"byte",
")",
"error",
"{",
"// Must be exactly 8 bytes",
"if",
"len",
"(",
"b",
")",
"!=",
"directiveLen",
"{",
"return",
"io",
".",
"ErrUnexpectedEOF",
"\n",
"}",
"\n\n",
"// Byte 0 is reserved",
"if",
"b",
"[",
"0",
"]",
"!=",
"0",
"{",
"return",
"ErrorBadArgumentParameter",
"\n",
"}",
"\n\n",
"// Copy command and MAC address into Directive",
"d",
".",
"Command",
"=",
"DirectiveCommand",
"(",
"b",
"[",
"1",
"]",
")",
"\n",
"mac",
":=",
"make",
"(",
"<mask>",
".",
"HardwareAddr",
",",
"6",
")",
"\n",
"copy",
"(",
"mac",
",",
"b",
"[",
"2",
":",
"]",
")",
"\n",
"d",
".",
"MAC",
"=",
"mac",
"\n\n",
"return",
"nil",
"\n",
"}"
] |
25,084 | all-25085 | [
"waitSteady",
"waits",
"for",
"a",
"task",
"to",
"leave",
"steady",
"-",
"state",
"by",
"waiting",
"for",
"a",
"new",
"event",
"or",
"a",
"timeout",
"."
] | [
"func",
"(",
"mtask",
"*",
"managedTask",
")",
"waitSteady",
"(",
")",
"{",
"seelog",
".",
"Infof",
"(",
"\"",
"\"",
",",
"mtask",
".",
"Arn",
",",
"mtask",
".",
"GetKnownStatus",
"(",
")",
".",
"String",
"(",
")",
")",
"\n\n",
"timeoutCtx",
",",
"cancel",
":=",
"<mask>",
".",
"WithTimeout",
"(",
"mtask",
".",
"ctx",
",",
"mtask",
".",
"steadyStatePollInterval",
")",
"\n",
"defer",
"cancel",
"(",
")",
"\n",
"timedOut",
":=",
"mtask",
".",
"waitEvent",
"(",
"timeoutCtx",
".",
"Done",
"(",
")",
")",
"\n\n",
"if",
"timedOut",
"{",
"seelog",
".",
"Debugf",
"(",
"\"",
"\"",
",",
"mtask",
".",
"Arn",
")",
"\n",
"go",
"mtask",
".",
"engine",
".",
"checkTaskState",
"(",
"mtask",
".",
"Task",
")",
"\n",
"}",
"\n",
"}"
] |
25,085 | all-25086 | [
"randomAppsURL",
"randomly",
"selects",
"a",
"server",
"from",
"an",
"array",
"and",
"creates",
"an",
"URL",
"pointing",
"to",
"the",
"app",
"list",
"."
] | [
"func",
"randomAppsURL",
"(",
"servers",
"[",
"]",
"string",
")",
"string",
"{",
"// TODO: If possible update server list from Marathon at some point.",
"server",
":=",
"servers",
"[",
"<mask>",
".",
"Intn",
"(",
"len",
"(",
"servers",
")",
")",
"]",
"\n",
"return",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"server",
",",
"appListPath",
")",
"\n",
"}"
] |
25,086 | all-25087 | [
"UnmarshalJSON",
"supports",
"json",
".",
"Unmarshaler",
"interface"
] | [
"func",
"(",
"v",
"*",
"EvaluateOnCallFrameReturns",
")",
"UnmarshalJSON",
"(",
"data",
"[",
"]",
"byte",
")",
"error",
"{",
"r",
":=",
"jlexer",
".",
"Lexer",
"{",
"Data",
":",
"<mask>",
"}",
"\n",
"easyjsonC5a4559bDecodeGithubComChromedpCdprotoDebugger42",
"(",
"&",
"r",
",",
"v",
")",
"\n",
"return",
"r",
".",
"Error",
"(",
")",
"\n",
"}"
] |
25,087 | all-25088 | [
"GetQueryConfig",
"returns",
"the",
"QueryConfig",
"field",
"if",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"."
] | [
"func",
"(",
"o",
"*",
"<mask>",
")",
"GetQueryConfig",
"(",
")",
"QueryConfig",
"{",
"if",
"o",
"==",
"nil",
"||",
"o",
".",
"QueryConfig",
"==",
"nil",
"{",
"return",
"QueryConfig",
"{",
"}",
"\n",
"}",
"\n",
"return",
"*",
"o",
".",
"QueryConfig",
"\n",
"}"
] |
25,088 | all-25089 | [
"validPropertyName",
"returns",
"whether",
"name",
"consists",
"of",
"one",
"or",
"more",
"valid",
"Go",
"identifiers",
"joined",
"by",
".",
"."
] | [
"func",
"validPropertyName",
"(",
"name",
"string",
")",
"bool",
"{",
"if",
"name",
"==",
"\"",
"\"",
"{",
"return",
"false",
"\n",
"}",
"\n",
"for",
"_",
",",
"s",
":=",
"<mask>",
"strings",
".",
"Split",
"(",
"name",
",",
"\"",
"\"",
")",
"{",
"if",
"s",
"==",
"\"",
"\"",
"{",
"return",
"false",
"\n",
"}",
"\n",
"first",
":=",
"true",
"\n",
"for",
"_",
",",
"c",
":=",
"range",
"s",
"{",
"if",
"first",
"{",
"first",
"=",
"false",
"\n",
"if",
"c",
"!=",
"'_'",
"&&",
"!",
"unicode",
".",
"IsLetter",
"(",
"c",
")",
"{",
"return",
"false",
"\n",
"}",
"\n",
"}",
"else",
"{",
"if",
"c",
"!=",
"'_'",
"&&",
"!",
"unicode",
".",
"IsLetter",
"(",
"c",
")",
"&&",
"!",
"unicode",
".",
"IsDigit",
"(",
"c",
")",
"{",
"return",
"false",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"true",
"\n",
"}"
] |
25,089 | all-25090 | [
"GetCreateAccountResult",
"retrieves",
"the",
"CreateAccountResult",
"value",
"from",
"the",
"union",
"returning",
"ok",
"if",
"the",
"union",
"s",
"switch",
"indicated",
"the",
"value",
"is",
"valid",
"."
] | [
"func",
"(",
"u",
"OperationResultTr",
")",
"GetCreateAccountResult",
"(",
")",
"(",
"result",
"CreateAccountResult",
",",
"ok",
"bool",
")",
"{",
"armName",
",",
"_",
":=",
"u",
".",
"ArmForSwitch",
"(",
"int32",
"(",
"u",
".",
"Type",
")",
")",
"\n\n",
"if",
"armName",
"==",
"\"",
"\"",
"{",
"result",
"=",
"*",
"u",
".",
"CreateAccountResult",
"\n",
"<mask>",
"=",
"true",
"\n",
"}",
"\n\n",
"return",
"\n",
"}"
] |
25,090 | all-25091 | [
"lower",
"your",
"expectations"
] | [
"func",
"(",
"fs",
"*",
"BtrfsFilesystem",
")",
"Create",
"(",
"bytes",
"uint64",
")",
"error",
"{",
"// significantly",
"idempotent",
":=",
"exec",
".",
"Command",
"(",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"`\n\t\tif [ ! -e $IMAGE_PATH ] || [ \"$(stat --printf=\"%s\" $IMAGE_PATH)\" != \"$SIZE_IN_BYTES\" ]; then\n\t\t\ttouch $IMAGE_PATH\n\t\t\ttruncate -s ${SIZE_IN_BYTES} $IMAGE_PATH\n\t\tfi\n\n\t\tlo=\"$(losetup -j $IMAGE_PATH | cut -d':' -f1)\"\n\t\tif [ -z \"$lo\" ]; then\n\t\t\tlo=\"$(losetup -f --show $IMAGE_PATH)\"\n\t\tfi\n\n\t\tif ! file $IMAGE_PATH | grep BTRFS; then\n\t\t\t`",
"+",
"fs",
".",
"mkfsBin",
"+",
"` --nodiscard $IMAGE_PATH\n\t\tfi\n\n\t\tmkdir -p $MOUNT_PATH\n\n\t\tif ! mountpoint -q $MOUNT_PATH; then\n\t\t\tmount -t btrfs $lo $MOUNT_PATH\n\t\tfi\n\t`",
")",
"\n\n",
"idempotent",
".",
"Env",
"=",
"[",
"]",
"string",
"{",
"\"",
"\"",
"+",
"<mask>",
".",
"Getenv",
"(",
"\"",
"\"",
")",
",",
"\"",
"\"",
"+",
"fs",
".",
"mountPath",
",",
"\"",
"\"",
"+",
"fs",
".",
"imagePath",
",",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"bytes",
")",
",",
"}",
"\n\n",
"_",
",",
"err",
":=",
"fs",
".",
"run",
"(",
"idempotent",
")",
"\n",
"return",
"err",
"\n",
"}"
] |
25,091 | all-25092 | [
"hasSkipTag",
"returns",
"whether",
"the",
"struct",
"field",
"has",
"the",
"-",
"tag",
"."
] | [
"func",
"(",
"db",
"*",
"DB",
")",
"hasSkipTag",
"(",
"field",
"*",
"reflect",
".",
"StructField",
")",
"bool",
"{",
"if",
"field",
".",
"<mask>",
".",
"Get",
"(",
"dbTag",
")",
"==",
"skipTag",
"{",
"return",
"true",
"\n",
"}",
"\n",
"return",
"false",
"\n",
"}"
] |
25,092 | all-25093 | [
"WithValidatorConcurrency",
"is",
"an",
"option",
"that",
"sets",
"topic",
"validator",
"throttle",
"."
] | [
"func",
"WithValidatorConcurrency",
"(",
"n",
"int",
")",
"ValidatorOpt",
"{",
"<mask>",
"func",
"(",
"addVal",
"*",
"addValReq",
")",
"error",
"{",
"addVal",
".",
"throttle",
"=",
"n",
"\n",
"return",
"nil",
"\n",
"}",
"\n",
"}"
] |
25,093 | all-25094 | [
"String",
"returns",
"a",
"string",
"representation",
"of",
"the",
"ENI",
"Attachment"
] | [
"func",
"(",
"eni",
"*",
"ENIAttachment",
")",
"String",
"(",
")",
"string",
"{",
"eni",
".",
"guard",
".",
"RLock",
"(",
")",
"\n",
"defer",
"eni",
".",
"<mask>",
".",
"RUnlock",
"(",
")",
"\n\n",
"return",
"eni",
".",
"stringUnsafe",
"(",
")",
"\n",
"}"
] |
25,094 | all-25095 | [
"publishMetricsOnce",
"is",
"invoked",
"by",
"the",
"ticker",
"to",
"periodically",
"publish",
"metrics",
"to",
"backend",
"."
] | [
"func",
"(",
"<mask>",
"*",
"clientServer",
")",
"publishMetricsOnce",
"(",
")",
"error",
"{",
"// Get the list of objects to send to backend.",
"requests",
",",
"err",
":=",
"cs",
".",
"metricsToPublishMetricRequests",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"// Make the publish metrics request to the backend.",
"for",
"_",
",",
"request",
":=",
"range",
"requests",
"{",
"err",
"=",
"cs",
".",
"MakeRequest",
"(",
"request",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
] |
25,095 | all-25096 | [
"copy",
"a",
"one",
"-",
"dimensional",
"texture",
"subimage"
] | [
"func",
"CopyTexSubImage1D",
"(",
"target",
"uint32",
",",
"level",
"int32",
",",
"xoffset",
"int32",
",",
"x",
"int32",
",",
"y",
"int32",
",",
"width",
"int32",
")",
"{",
"syscall",
".",
"Syscall6",
"(",
"gpCopyTexSubImage1D",
",",
"6",
",",
"uintptr",
"(",
"target",
")",
",",
"uintptr",
"(",
"level",
")",
",",
"uintptr",
"(",
"xoffset",
")",
",",
"uintptr",
"(",
"x",
")",
",",
"uintptr",
"(",
"y",
")",
",",
"uintptr",
"(",
"<mask>",
")",
")",
"\n",
"}"
] |
25,096 | all-25097 | [
"GetConfigMap",
"gets",
"the",
"configmap",
"identified",
"in",
"the",
"client",
"s",
"specified",
"namespace",
".",
"Analogous",
"to",
"kubectl",
"get",
"configmap",
"--",
"namespace",
"=",
"client",
".",
"namespace"
] | [
"func",
"(",
"c",
"*",
"Client",
")",
"GetConfigMap",
"(",
"name",
",",
"namespace",
"string",
")",
"(",
"ConfigMap",
",",
"error",
")",
"{",
"c",
".",
"log",
"(",
"\"",
"\"",
",",
"name",
")",
"\n",
"if",
"namespace",
"==",
"\"",
"\"",
"{",
"namespace",
"=",
"c",
".",
"namespace",
"\n",
"}",
"\n",
"var",
"retConfigMap",
"ConfigMap",
"\n",
"err",
":=",
"c",
".",
"<mask>",
"(",
"&",
"request",
"{",
"path",
":",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"namespace",
",",
"name",
")",
",",
"}",
",",
"&",
"retConfigMap",
")",
"\n\n",
"return",
"retConfigMap",
",",
"err",
"\n",
"}"
] |
25,097 | all-25098 | [
"AddEnvVar",
"adds",
"a",
"new",
"environment",
"variable",
"to",
"the",
"specified",
"project",
"Returns",
"the",
"added",
"env",
"var",
"(",
"the",
"value",
"will",
"be",
"masked",
")"
] | [
"func",
"(",
"c",
"*",
"Client",
")",
"AddEnvVar",
"(",
"<mask>",
",",
"repo",
",",
"name",
",",
"value",
"string",
")",
"(",
"*",
"EnvVar",
",",
"error",
")",
"{",
"envVar",
":=",
"&",
"EnvVar",
"{",
"}",
"\n\n",
"err",
":=",
"c",
".",
"request",
"(",
"\"",
"\"",
",",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"account",
",",
"repo",
")",
",",
"envVar",
",",
"nil",
",",
"&",
"EnvVar",
"{",
"Name",
":",
"name",
",",
"Value",
":",
"value",
"}",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"return",
"envVar",
",",
"nil",
"\n",
"}"
] |
25,098 | all-25099 | [
"HandlerBlock",
"is",
"a",
"wrapper",
"around",
"g_signal_handler_block",
"()",
"."
] | [
"func",
"(",
"v",
"*",
"<mask>",
")",
"HandlerBlock",
"(",
"handle",
"SignalHandle",
")",
"{",
"C",
".",
"g_signal_handler_block",
"(",
"C",
".",
"gpointer",
"(",
"v",
".",
"GObject",
")",
",",
"C",
".",
"gulong",
"(",
"handle",
")",
")",
"\n",
"}"
] |
25,099 | all-25100 | [
"CheckButtonNewWithMnemonic",
"is",
"a",
"wrapper",
"around",
"gtk_check_button_new_with_mnemonic",
"()",
"."
] | [
"func",
"CheckButtonNewWithMnemonic",
"(",
"label",
"string",
")",
"(",
"*",
"CheckButton",
",",
"error",
")",
"{",
"cstr",
":=",
"C",
".",
"CString",
"(",
"<mask>",
")",
"\n",
"defer",
"C",
".",
"free",
"(",
"unsafe",
".",
"Pointer",
"(",
"cstr",
")",
")",
"\n",
"c",
":=",
"C",
".",
"gtk_check_button_new_with_mnemonic",
"(",
"(",
"*",
"C",
".",
"gchar",
")",
"(",
"cstr",
")",
")",
"\n",
"if",
"c",
"==",
"nil",
"{",
"return",
"nil",
",",
"nilPtrErr",
"\n",
"}",
"\n",
"obj",
":=",
"glib",
".",
"Take",
"(",
"unsafe",
".",
"Pointer",
"(",
"c",
")",
")",
"\n",
"return",
"wrapCheckButton",
"(",
"obj",
")",
",",
"nil",
"\n",
"}"
] |