id
int32 0
25.3k
| idx
stringlengths 5
9
| nl_tokens
sequencelengths 1
418
| pl_tokens
sequencelengths 22
4.98k
|
---|---|---|---|
1,100 | all-1101 | [
"title",
":",
"role",
"create",
"path",
":",
"/",
"roles",
"method",
":",
"POST",
"consume",
":",
"application",
"/",
"x",
"-",
"www",
"-",
"form",
"-",
"urlencoded",
"responses",
":",
"201",
":",
"Role",
"created",
"400",
":",
"Invalid",
"data",
"401",
":",
"Unauthorized",
"409",
":",
"Role",
"already",
"exists"
] | [
"func",
"addRole",
"(",
"w",
"http",
".",
"ResponseWriter",
",",
"r",
"*",
"http",
".",
"Request",
",",
"t",
"auth",
".",
"Token",
")",
"(",
"err",
"error",
")",
"{",
"if",
"!",
"permission",
".",
"Check",
"(",
"t",
",",
"permission",
".",
"PermRoleCreate",
")",
"{",
"return",
"permission",
".",
"ErrUnauthorized",
"\n",
"}",
"\n",
"roleName",
":=",
"InputValue",
"(",
"r",
",",
"\"",
"\"",
")",
"\n",
"if",
"roleName",
"==",
"\"",
"\"",
"{",
"return",
"&",
"errors",
".",
"HTTP",
"{",
"Code",
":",
"http",
".",
"StatusBadRequest",
",",
"Message",
":",
"permTypes",
".",
"ErrInvalidRoleName",
".",
"Error",
"(",
")",
",",
"}",
"\n",
"}",
"\n",
"evt",
",",
"err",
":=",
"<mask>",
".",
"New",
"(",
"&",
"event",
".",
"Opts",
"{",
"Target",
":",
"event",
".",
"Target",
"{",
"Type",
":",
"event",
".",
"TargetTypeRole",
",",
"Value",
":",
"roleName",
"}",
",",
"Kind",
":",
"permission",
".",
"PermRoleCreate",
",",
"Owner",
":",
"t",
",",
"CustomData",
":",
"event",
".",
"FormToCustomData",
"(",
"InputFields",
"(",
"r",
")",
")",
",",
"Allowed",
":",
"event",
".",
"Allowed",
"(",
"permission",
".",
"PermRoleReadEvents",
")",
",",
"}",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"defer",
"func",
"(",
")",
"{",
"evt",
".",
"Done",
"(",
"err",
")",
"}",
"(",
")",
"\n",
"_",
",",
"err",
"=",
"permission",
".",
"NewRole",
"(",
"roleName",
",",
"InputValue",
"(",
"r",
",",
"\"",
"\"",
")",
",",
"InputValue",
"(",
"r",
",",
"\"",
"\"",
")",
")",
"\n",
"if",
"err",
"==",
"permTypes",
".",
"ErrInvalidRoleName",
"{",
"return",
"&",
"errors",
".",
"HTTP",
"{",
"Code",
":",
"http",
".",
"StatusBadRequest",
",",
"Message",
":",
"err",
".",
"Error",
"(",
")",
",",
"}",
"\n",
"}",
"\n",
"if",
"err",
"==",
"permTypes",
".",
"ErrRoleAlreadyExists",
"{",
"return",
"&",
"errors",
".",
"HTTP",
"{",
"Code",
":",
"http",
".",
"StatusConflict",
",",
"Message",
":",
"err",
".",
"Error",
"(",
")",
",",
"}",
"\n",
"}",
"\n",
"if",
"err",
"==",
"nil",
"{",
"w",
".",
"WriteHeader",
"(",
"http",
".",
"StatusCreated",
")",
"\n",
"}",
"\n",
"return",
"err",
"\n",
"}"
] |
1,101 | all-1102 | [
"TODO",
"Test"
] | [
"func",
"CheckIPRangeCounts",
"(",
"counts",
"map",
"[",
"string",
"]",
"int",
",",
"limits",
"[",
"]",
"int",
")",
"bool",
"{",
"for",
"prefix",
",",
"<mask>",
":=",
"range",
"counts",
"{",
"ipParts",
":=",
"strings",
".",
"Split",
"(",
"prefix",
",",
"\"",
"\"",
")",
"\n",
"numParts",
":=",
"len",
"(",
"ipParts",
")",
"\n",
"if",
"limits",
"[",
"numParts",
"]",
"<",
"count",
"{",
"return",
"false",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"true",
"\n",
"}"
] |
1,102 | all-1103 | [
"NameOf",
"returns",
"the",
"name",
"of",
"the",
"function",
"value",
"."
] | [
"func",
"NameOf",
"(",
"v",
"reflect",
".",
"Value",
")",
"string",
"{",
"fnc",
":=",
"runtime",
".",
"FuncForPC",
"(",
"v",
".",
"Pointer",
"(",
")",
")",
"\n",
"if",
"fnc",
"==",
"nil",
"{",
"return",
"\"",
"\"",
"\n",
"}",
"\n",
"fullName",
":=",
"fnc",
".",
"Name",
"(",
")",
"// e.g., \"long/path/name/mypkg.(*MyType).(long/path/name/mypkg.myMethod)-fm\"",
"\n\n",
"// Method closures have a \"-fm\" suffix.",
"fullName",
"=",
"strings",
".",
"TrimSuffix",
"(",
"fullName",
",",
"\"",
"\"",
")",
"\n\n",
"var",
"name",
"string",
"\n",
"for",
"len",
"(",
"fullName",
")",
">",
"0",
"{",
"inParen",
":=",
"strings",
".",
"HasSuffix",
"(",
"fullName",
",",
"\"",
"\"",
")",
"\n",
"fullName",
"=",
"strings",
".",
"TrimSuffix",
"(",
"fullName",
",",
"\"",
"\"",
")",
"\n\n",
"s",
":=",
"lastIdentRx",
".",
"FindString",
"(",
"fullName",
")",
"\n",
"if",
"s",
"==",
"\"",
"\"",
"{",
"break",
"\n",
"}",
"\n",
"name",
"=",
"s",
"+",
"\"",
"\"",
"+",
"name",
"\n",
"fullName",
"=",
"strings",
".",
"TrimSuffix",
"(",
"fullName",
",",
"s",
")",
"\n\n",
"if",
"i",
":=",
"strings",
".",
"LastIndexByte",
"(",
"fullName",
",",
"'('",
")",
";",
"inParen",
"&&",
"i",
">=",
"0",
"{",
"fullName",
"=",
"fullName",
"[",
":",
"i",
"]",
"\n",
"}",
"\n",
"fullName",
"=",
"strings",
".",
"TrimSuffix",
"(",
"fullName",
",",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"return",
"strings",
".",
"TrimSuffix",
"(",
"<mask>",
",",
"\"",
"\"",
")",
"\n",
"}"
] |
1,103 | all-1104 | [
"NewError",
"returns",
"an",
"error",
"corresponding",
"to",
"a",
"typed",
"error",
"returned",
"from",
"ACS",
".",
"It",
"is",
"expected",
"that",
"the",
"passed",
"in",
"interface",
"{}",
"is",
"really",
"a",
"struct",
"which",
"has",
"a",
"Message",
"field",
"of",
"type",
"*",
"string",
".",
"In",
"that",
"case",
"the",
"Message",
"will",
"be",
"conveyed",
"as",
"part",
"of",
"the",
"Error",
"string",
"as",
"well",
"as",
"the",
"type",
".",
"It",
"is",
"safe",
"to",
"pass",
"anything",
"into",
"this",
"constructor",
"and",
"it",
"will",
"also",
"work",
"reasonably",
"well",
"with",
"anything",
"fulfilling",
"the",
"error",
"interface",
"."
] | [
"func",
"(",
"te",
"*",
"tcsError",
")",
"NewError",
"(",
"err",
"interface",
"{",
"}",
")",
"*",
"wsclient",
".",
"WSError",
"{",
"return",
"&",
"wsclient",
".",
"WSError",
"{",
"ErrObj",
":",
"err",
",",
"<mask>",
":",
"errType",
",",
"WSUnretriableErrors",
":",
"&",
"UnretriableErrors",
"{",
"}",
"}",
"\n",
"}"
] |
1,104 | all-1105 | [
"NewSMTP",
"create",
"new",
"SMTP"
] | [
"func",
"NewSMTP",
"(",
"filename",
"string",
",",
"environment",
"string",
")",
"(",
"s",
"*",
"SMTP",
",",
"err",
"error",
")",
"{",
"conf",
",",
"err",
":=",
"GetSMTP",
"(",
"<mask>",
",",
"environment",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"\n",
"}",
"\n",
"auth",
":=",
"smtp",
".",
"PlainAuth",
"(",
"\"",
"\"",
",",
"conf",
".",
"Auth",
".",
"User",
",",
"conf",
".",
"Auth",
".",
"Password",
",",
"conf",
".",
"Host",
")",
"\n",
"f",
":=",
"smtp",
".",
"SendMail",
"\n",
"if",
"conf",
".",
"SSL",
"{",
"f",
"=",
"SendMailSSL",
"\n",
"}",
"\n",
"s",
"=",
"&",
"SMTP",
"{",
"auth",
":",
"auth",
",",
"send",
":",
"f",
",",
"addr",
":",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"conf",
".",
"Host",
",",
"conf",
".",
"Port",
")",
"}",
"\n",
"return",
"\n",
"}"
] |
1,105 | all-1106 | [
"XXX_OneofFuncs",
"is",
"for",
"the",
"internal",
"use",
"of",
"the",
"proto",
"package",
"."
] | [
"func",
"(",
"*",
"WatchRequest",
")",
"XXX_OneofFuncs",
"(",
")",
"(",
"func",
"(",
"msg",
"proto",
".",
"<mask>",
",",
"b",
"*",
"proto",
".",
"Buffer",
")",
"error",
",",
"func",
"(",
"msg",
"proto",
".",
"Message",
",",
"tag",
",",
"wire",
"int",
",",
"b",
"*",
"proto",
".",
"Buffer",
")",
"(",
"bool",
",",
"error",
")",
",",
"func",
"(",
"msg",
"proto",
".",
"Message",
")",
"(",
"n",
"int",
")",
",",
"[",
"]",
"interface",
"{",
"}",
")",
"{",
"return",
"_WatchRequest_OneofMarshaler",
",",
"_WatchRequest_OneofUnmarshaler",
",",
"_WatchRequest_OneofSizer",
",",
"[",
"]",
"interface",
"{",
"}",
"{",
"(",
"*",
"WatchRequest_CreateRequest",
")",
"(",
"nil",
")",
",",
"(",
"*",
"WatchRequest_CancelRequest",
")",
"(",
"nil",
")",
",",
"(",
"*",
"WatchRequest_ProgressRequest",
")",
"(",
"nil",
")",
",",
"}",
"\n",
"}"
] |
1,106 | all-1107 | [
"MarshalJSON",
"implements",
"the",
"json",
".",
"Marshaler",
"interface",
".",
"The",
"time",
"is",
"a",
"quoted",
"string",
"in",
"RFC",
"3339",
"format",
"with",
"sub",
"-",
"second",
"precision",
"added",
"if",
"present",
"."
] | [
"func",
"(",
"t",
"Time",
")",
"MarshalJSON",
"(",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"if",
"y",
":=",
"<mask>",
".",
"Time",
"(",
"t",
")",
".",
"Year",
"(",
")",
";",
"y",
"<",
"0",
"||",
"y",
">=",
"10000",
"{",
"// RFC 3339 is clear that years are 4 digits exactly.",
"// See golang.org/issue/4556#c15 for more discussion.",
"return",
"nil",
",",
"errors",
".",
"New",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"return",
"[",
"]",
"byte",
"(",
"`\"`",
"+",
"t",
".",
"String",
"(",
")",
"+",
"`\"`",
")",
",",
"nil",
"\n",
"}"
] |
1,107 | all-1108 | [
"TODO",
":",
"gtk_container_child_get_valist",
"TODO",
":",
"gtk_container_child_set_valist",
"ChildNotify",
"is",
"a",
"wrapper",
"around",
"gtk_container_child_notify",
"()",
"."
] | [
"func",
"(",
"v",
"*",
"Container",
")",
"ChildNotify",
"(",
"<mask>",
"IWidget",
",",
"childProperty",
"string",
")",
"{",
"cstr",
":=",
"C",
".",
"CString",
"(",
"childProperty",
")",
"\n",
"defer",
"C",
".",
"free",
"(",
"unsafe",
".",
"Pointer",
"(",
"cstr",
")",
")",
"\n",
"C",
".",
"gtk_container_child_notify",
"(",
"v",
".",
"native",
"(",
")",
",",
"child",
".",
"toWidget",
"(",
")",
",",
"(",
"*",
"C",
".",
"gchar",
")",
"(",
"cstr",
")",
")",
"\n",
"}"
] |
1,108 | all-1109 | [
"MarshalBinaryBare",
"encodes",
"the",
"object",
"o",
"according",
"to",
"the",
"Amino",
"spec",
".",
"MarshalBinaryBare",
"doesn",
"t",
"prefix",
"the",
"byte",
"-",
"length",
"of",
"the",
"encoding",
"so",
"the",
"caller",
"must",
"handle",
"framing",
"."
] | [
"func",
"(",
"cdc",
"*",
"Codec",
")",
"MarshalBinaryBare",
"(",
"o",
"interface",
"{",
"}",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"// Dereference value if pointer.",
"<mask>",
"rv",
",",
"_",
",",
"isNilPtr",
"=",
"derefPointers",
"(",
"reflect",
".",
"ValueOf",
"(",
"o",
")",
")",
"\n",
"if",
"isNilPtr",
"{",
"// NOTE: You can still do so by calling",
"// `.MarshalBinaryLengthPrefixed(struct{ *SomeType })` or so on.",
"panic",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"// Encode Amino:binary bytes.",
"var",
"bz",
"[",
"]",
"byte",
"\n",
"buf",
":=",
"new",
"(",
"bytes",
".",
"Buffer",
")",
"\n",
"rt",
":=",
"rv",
".",
"Type",
"(",
")",
"\n",
"info",
",",
"err",
":=",
"cdc",
".",
"getTypeInfo_wlock",
"(",
"rt",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"err",
"=",
"cdc",
".",
"encodeReflectBinary",
"(",
"buf",
",",
"info",
",",
"rv",
",",
"FieldOptions",
"{",
"BinFieldNum",
":",
"1",
"}",
",",
"true",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"bz",
"=",
"buf",
".",
"Bytes",
"(",
")",
"\n\n",
"// If registered concrete, prepend prefix bytes.",
"if",
"info",
".",
"Registered",
"{",
"pb",
":=",
"info",
".",
"Prefix",
".",
"Bytes",
"(",
")",
"\n",
"bz",
"=",
"append",
"(",
"pb",
",",
"bz",
"...",
")",
"\n",
"}",
"\n\n",
"return",
"bz",
",",
"nil",
"\n",
"}"
] |
1,109 | all-1110 | [
"SaveToFile",
"saves",
"the",
"cedar",
"to",
"a",
"file",
"where",
"dataType",
"is",
"either",
"json",
"or",
"gob",
"."
] | [
"func",
"(",
"da",
"*",
"Cedar",
")",
"SaveToFile",
"(",
"fileName",
"string",
",",
"dataType",
"string",
")",
"error",
"{",
"file",
",",
"err",
":=",
"os",
".",
"OpenFile",
"(",
"fileName",
",",
"os",
".",
"O_CREATE",
"|",
"os",
".",
"O_WRONLY",
",",
"0666",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"defer",
"file",
".",
"Close",
"(",
")",
"\n",
"out",
":=",
"bufio",
".",
"NewWriter",
"(",
"file",
")",
"\n",
"defer",
"out",
".",
"Flush",
"(",
")",
"\n",
"da",
".",
"Save",
"(",
"<mask>",
",",
"dataType",
")",
"\n",
"return",
"nil",
"\n",
"}"
] |
1,110 | all-1111 | [
"UnselectPath",
"is",
"a",
"wrapper",
"around",
"gtk_icon_view_unselect_path",
"()",
"."
] | [
"func",
"(",
"v",
"*",
"IconView",
")",
"UnselectPath",
"(",
"<mask>",
"*",
"TreePath",
")",
"{",
"C",
".",
"gtk_icon_view_unselect_path",
"(",
"v",
".",
"native",
"(",
")",
",",
"path",
".",
"native",
"(",
")",
")",
"\n",
"}"
] |
1,111 | all-1112 | [
"define",
"an",
"array",
"of",
"edge",
"flags"
] | [
"func",
"EdgeFlagPointer",
"(",
"stride",
"int32",
",",
"<mask>",
"unsafe",
".",
"Pointer",
")",
"{",
"C",
".",
"glowEdgeFlagPointer",
"(",
"gpEdgeFlagPointer",
",",
"(",
"C",
".",
"GLsizei",
")",
"(",
"stride",
")",
",",
"pointer",
")",
"\n",
"}"
] |
1,112 | all-1113 | [
"MustAlphaNum4",
"retrieves",
"the",
"AlphaNum4",
"value",
"from",
"the",
"union",
"panicing",
"if",
"the",
"value",
"is",
"not",
"set",
"."
] | [
"func",
"(",
"u",
"Asset",
")",
"MustAlphaNum4",
"(",
")",
"AssetAlphaNum4",
"{",
"val",
",",
"ok",
":=",
"u",
".",
"GetAlphaNum4",
"(",
")",
"\n\n",
"if",
"!",
"<mask>",
"{",
"panic",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"return",
"val",
"\n",
"}"
] |
1,113 | all-1114 | [
"SendLinkMsg",
"发送链接消息"
] | [
"func",
"(",
"w",
"*",
"Webhook",
")",
"SendLinkMsg",
"(",
"title",
",",
"content",
",",
"picURL",
",",
"msgURL",
"string",
")",
"error",
"{",
"return",
"w",
".",
"SendPayload",
"(",
"&",
"Payload",
"{",
"MsgType",
":",
"\"",
"\"",
",",
"Link",
":",
"struct",
"{",
"Text",
"string",
"`json:\"text\"`",
"\n",
"Title",
"string",
"`json:\"title\"`",
"\n",
"PicURL",
"string",
"`json:\"picUrl\"`",
"\n",
"MessageURL",
"string",
"`json:\"messageUrl\"`",
"\n",
"}",
"{",
"Text",
":",
"<mask>",
",",
"Title",
":",
"title",
",",
"PicURL",
":",
"picURL",
",",
"MessageURL",
":",
"msgURL",
",",
"}",
",",
"}",
")",
"\n",
"}"
] |
1,114 | all-1115 | [
"IndexOf",
"finds",
"the",
"index",
"of",
"needle",
"in",
"s",
"starting",
"from",
"start",
"."
] | [
"func",
"IndexOf",
"(",
"s",
"string",
",",
"needle",
"string",
",",
"start",
"int",
")",
"int",
"{",
"l",
":=",
"len",
"(",
"s",
")",
"\n",
"if",
"needle",
"==",
"\"",
"\"",
"{",
"if",
"start",
"<",
"0",
"{",
"return",
"0",
"\n",
"}",
"else",
"if",
"start",
"<",
"l",
"{",
"return",
"start",
"\n",
"}",
"else",
"{",
"return",
"l",
"\n",
"}",
"\n",
"}",
"\n",
"if",
"start",
"<",
"0",
"||",
"start",
">",
"l",
"-",
"1",
"{",
"return",
"-",
"1",
"\n",
"}",
"\n",
"pos",
":=",
"strings",
".",
"Index",
"(",
"s",
"[",
"<mask>",
":",
"]",
",",
"needle",
")",
"\n",
"if",
"pos",
"==",
"-",
"1",
"{",
"return",
"-",
"1",
"\n",
"}",
"\n",
"return",
"start",
"+",
"pos",
"\n",
"}"
] |
1,115 | all-1116 | [
"In",
"returns",
"true",
"if",
"the",
"parameter",
"field",
"is",
"an",
"input",
"field",
"."
] | [
"func",
"(",
"f",
"*",
"ParameterField",
")",
"In",
"(",
")",
"bool",
"{",
"return",
"f",
".",
"<mask>",
"==",
"pmInout",
"||",
"f",
".",
"mode",
"==",
"pmIn",
"\n",
"}"
] |
1,116 | all-1117 | [
"title",
":",
"add",
"platform",
"path",
":",
"/",
"platforms",
"method",
":",
"POST",
"consume",
":",
"multipart",
"/",
"form",
"-",
"data",
"produce",
":",
"application",
"/",
"x",
"-",
"json",
"-",
"stream",
"responses",
":",
"200",
":",
"Platform",
"created",
"400",
":",
"Invalid",
"data",
"401",
":",
"Unauthorized"
] | [
"func",
"platformAdd",
"(",
"w",
"http",
".",
"ResponseWriter",
",",
"r",
"*",
"http",
".",
"Request",
",",
"t",
"auth",
".",
"Token",
")",
"(",
"err",
"error",
")",
"{",
"name",
":=",
"InputValue",
"(",
"r",
",",
"\"",
"\"",
")",
"\n",
"file",
",",
"_",
",",
"err",
":=",
"r",
".",
"FormFile",
"(",
"\"",
"\"",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"&",
"tErrors",
".",
"HTTP",
"{",
"Code",
":",
"http",
".",
"StatusBadRequest",
",",
"Message",
":",
"err",
".",
"Error",
"(",
")",
"}",
"\n",
"}",
"\n",
"defer",
"file",
".",
"Close",
"(",
")",
"\n",
"data",
",",
"err",
":=",
"ioutil",
".",
"ReadAll",
"(",
"file",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"if",
"len",
"(",
"data",
")",
"==",
"0",
"{",
"return",
"&",
"tErrors",
".",
"HTTP",
"{",
"Code",
":",
"http",
".",
"StatusBadRequest",
",",
"Message",
":",
"appTypes",
".",
"ErrMissingFileContent",
".",
"Error",
"(",
")",
"}",
"\n",
"}",
"\n",
"args",
":=",
"make",
"(",
"map",
"[",
"string",
"]",
"string",
")",
"\n",
"for",
"key",
",",
"values",
":=",
"range",
"r",
".",
"Form",
"{",
"args",
"[",
"key",
"]",
"=",
"values",
"[",
"0",
"]",
"\n",
"}",
"\n",
"canCreatePlatform",
":=",
"permission",
".",
"Check",
"(",
"t",
",",
"permission",
".",
"PermPlatformCreate",
")",
"\n",
"if",
"!",
"canCreatePlatform",
"{",
"return",
"permission",
".",
"ErrUnauthorized",
"\n",
"}",
"\n",
"w",
".",
"Header",
"(",
")",
".",
"Set",
"(",
"\"",
"\"",
",",
"\"",
"\"",
")",
"\n",
"keepAliveWriter",
":=",
"io",
".",
"NewKeepAliveWriter",
"(",
"w",
",",
"30",
"*",
"time",
".",
"Second",
",",
"\"",
"\"",
")",
"\n",
"defer",
"keepAliveWriter",
".",
"Stop",
"(",
")",
"\n",
"writer",
":=",
"&",
"io",
".",
"SimpleJsonMessageEncoderWriter",
"{",
"Encoder",
":",
"json",
".",
"NewEncoder",
"(",
"keepAliveWriter",
")",
"}",
"\n",
"evt",
",",
"err",
":=",
"event",
".",
"New",
"(",
"&",
"event",
".",
"Opts",
"{",
"Target",
":",
"event",
".",
"Target",
"{",
"Type",
":",
"event",
".",
"TargetTypePlatform",
",",
"Value",
":",
"name",
"}",
",",
"Kind",
":",
"permission",
".",
"PermPlatformCreate",
",",
"Owner",
":",
"t",
",",
"CustomData",
":",
"event",
".",
"FormToCustomData",
"(",
"InputFields",
"(",
"r",
")",
")",
",",
"Allowed",
":",
"<mask>",
".",
"Allowed",
"(",
"permission",
".",
"PermPlatformReadEvents",
")",
",",
"}",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"defer",
"func",
"(",
")",
"{",
"evt",
".",
"Done",
"(",
"err",
")",
"}",
"(",
")",
"\n",
"evt",
".",
"SetLogWriter",
"(",
"writer",
")",
"\n",
"ctx",
",",
"cancel",
":=",
"evt",
".",
"CancelableContext",
"(",
"context",
".",
"Background",
"(",
")",
")",
"\n",
"err",
"=",
"servicemanager",
".",
"Platform",
".",
"Create",
"(",
"appTypes",
".",
"PlatformOptions",
"{",
"Name",
":",
"name",
",",
"Args",
":",
"args",
",",
"Data",
":",
"data",
",",
"Output",
":",
"evt",
",",
"Ctx",
":",
"ctx",
",",
"}",
")",
"\n",
"cancel",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"writer",
".",
"Write",
"(",
"[",
"]",
"byte",
"(",
"\"",
"\\n",
"\"",
")",
")",
"\n",
"return",
"nil",
"\n",
"}"
] |
1,117 | all-1118 | [
"findIncludePaths",
"finds",
"and",
"returns",
"include",
"paths",
"."
] | [
"func",
"findIncludePaths",
"(",
"data",
"[",
"]",
"byte",
",",
"opts",
"*",
"Options",
",",
"f",
"*",
"File",
")",
"(",
"[",
"]",
"string",
",",
"error",
")",
"{",
"var",
"includePaths",
"[",
"]",
"string",
"\n\n",
"for",
"i",
",",
"str",
":=",
"range",
"strings",
".",
"Split",
"(",
"formatLF",
"(",
"string",
"(",
"data",
")",
")",
",",
"lf",
")",
"{",
"ln",
":=",
"newLine",
"(",
"i",
"+",
"1",
",",
"str",
",",
"opts",
",",
"f",
")",
"\n\n",
"if",
"ln",
".",
"isHelperMethodOf",
"(",
"helperMethodNameInclude",
")",
"{",
"if",
"len",
"(",
"ln",
".",
"tokens",
")",
"<",
"3",
"{",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"ln",
".",
"fileName",
"(",
")",
",",
"ln",
".",
"no",
")",
"\n",
"}",
"\n\n",
"includePaths",
"=",
"<mask>",
"(",
"includePaths",
",",
"ln",
".",
"tokens",
"[",
"2",
"]",
")",
"\n",
"}",
"\n",
"}",
"\n\n",
"return",
"includePaths",
",",
"nil",
"\n",
"}"
] |
1,118 | all-1119 | [
"TODO",
":",
"No",
"need",
"to",
"return",
"the",
"pod",
"name",
"since",
"we",
"already",
"have",
"the",
"prowjob",
"in",
"the",
"call",
"site",
"."
] | [
"func",
"(",
"c",
"*",
"Controller",
")",
"startPod",
"(",
"pj",
"prowapi",
".",
"ProwJob",
")",
"(",
"string",
",",
"string",
",",
"error",
")",
"{",
"buildID",
",",
"err",
":=",
"c",
".",
"getBuildID",
"(",
"pj",
".",
"Spec",
".",
"<mask>",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"\"",
"\"",
",",
"\"",
"\"",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"}",
"\n\n",
"pod",
",",
"err",
":=",
"decorate",
".",
"ProwJobToPod",
"(",
"pj",
",",
"buildID",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"\"",
"\"",
",",
"\"",
"\"",
",",
"err",
"\n",
"}",
"\n\n",
"client",
",",
"ok",
":=",
"c",
".",
"pkcs",
"[",
"pj",
".",
"ClusterAlias",
"(",
")",
"]",
"\n",
"if",
"!",
"ok",
"{",
"return",
"\"",
"\"",
",",
"\"",
"\"",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"pj",
".",
"ClusterAlias",
"(",
")",
")",
"\n",
"}",
"\n",
"actual",
",",
"err",
":=",
"client",
".",
"CreatePod",
"(",
"*",
"pod",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"\"",
"\"",
",",
"\"",
"\"",
",",
"err",
"\n",
"}",
"\n",
"return",
"buildID",
",",
"actual",
".",
"ObjectMeta",
".",
"Name",
",",
"nil",
"\n",
"}"
] |
1,119 | all-1120 | [
"OBJECT",
"IDENTIFIER",
"parseObjectIdentifier",
"parses",
"an",
"OBJECT",
"IDENTIFIER",
"from",
"the",
"given",
"bytes",
"and",
"returns",
"it",
".",
"An",
"object",
"identifier",
"is",
"a",
"sequence",
"of",
"variable",
"length",
"integers",
"that",
"are",
"assigned",
"in",
"a",
"hierarchy",
"."
] | [
"func",
"parseObjectIdentifier",
"(",
"bytes",
"[",
"]",
"byte",
")",
"(",
"s",
"[",
"]",
"int",
",",
"err",
"error",
")",
"{",
"if",
"len",
"(",
"bytes",
")",
"==",
"0",
"{",
"err",
"=",
"asn1",
".",
"SyntaxError",
"{",
"Msg",
":",
"\"",
"\"",
"}",
"\n",
"return",
"\n",
"}",
"\n\n",
"// In the worst case, we get two elements from the first byte (which is",
"// encoded differently) and then every varint is a single byte long.",
"s",
"=",
"make",
"(",
"[",
"]",
"int",
",",
"len",
"(",
"<mask>",
")",
"+",
"1",
")",
"\n\n",
"// The first varint is 40*value1 + value2:",
"// According to this packing, value1 can take the values 0, 1 and 2 only.",
"// When value1 = 0 or value1 = 1, then value2 is <= 39. When value1 = 2,",
"// then there are no restrictions on value2.",
"v",
",",
"offset",
",",
"err",
":=",
"_parseBase128Int",
"(",
"bytes",
",",
"0",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"\n",
"}",
"\n",
"if",
"v",
"<",
"80",
"{",
"s",
"[",
"0",
"]",
"=",
"v",
"/",
"40",
"\n",
"s",
"[",
"1",
"]",
"=",
"v",
"%",
"40",
"\n",
"}",
"else",
"{",
"s",
"[",
"0",
"]",
"=",
"2",
"\n",
"s",
"[",
"1",
"]",
"=",
"v",
"-",
"80",
"\n",
"}",
"\n\n",
"i",
":=",
"2",
"\n",
"for",
";",
"offset",
"<",
"len",
"(",
"bytes",
")",
";",
"i",
"++",
"{",
"v",
",",
"offset",
",",
"err",
"=",
"_parseBase128Int",
"(",
"bytes",
",",
"offset",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"\n",
"}",
"\n",
"s",
"[",
"i",
"]",
"=",
"v",
"\n",
"}",
"\n",
"s",
"=",
"s",
"[",
"0",
":",
"i",
"]",
"\n",
"return",
"\n",
"}"
] |
1,120 | all-1121 | [
"saveHostVirtualSwitchID",
"sets",
"a",
"special",
"ID",
"for",
"a",
"host",
"virtual",
"switch",
"composed",
"of",
"the",
"MOID",
"for",
"the",
"concerned",
"HostSystem",
"and",
"the",
"virtual",
"switch",
"s",
"key",
"."
] | [
"func",
"saveHostVirtualSwitchID",
"(",
"d",
"*",
"schema",
".",
"ResourceData",
",",
"hsID",
",",
"<mask>",
"string",
")",
"{",
"d",
".",
"SetId",
"(",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"hostVirtualSwitchIDPrefix",
",",
"hsID",
",",
"name",
")",
")",
"\n",
"}"
] |
1,121 | all-1122 | [
"GroupByLimit",
"creates",
"a",
"GroupBy",
"query",
"with",
"the",
"given",
"limit",
"and",
"Rows",
"queries"
] | [
"func",
"(",
"idx",
"*",
"Index",
")",
"GroupByLimit",
"(",
"limit",
"int64",
",",
"rowsQueries",
"...",
"*",
"PQLRowsQuery",
")",
"*",
"PQLBaseQuery",
"{",
"if",
"len",
"(",
"rowsQueries",
")",
"<",
"1",
"{",
"return",
"NewPQLBaseQuery",
"(",
"\"",
"\"",
",",
"idx",
",",
"errors",
".",
"New",
"(",
"\"",
"\"",
")",
")",
"\n",
"}",
"\n",
"if",
"limit",
"<",
"0",
"{",
"return",
"NewPQLBaseQuery",
"(",
"\"",
"\"",
",",
"idx",
",",
"errors",
".",
"New",
"(",
"\"",
"\"",
")",
")",
"\n",
"}",
"\n",
"text",
":=",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"strings",
".",
"Join",
"(",
"serializeGroupBy",
"(",
"rowsQueries",
"...",
")",
",",
"\"",
"\"",
")",
",",
"<mask>",
")",
"\n",
"return",
"NewPQLBaseQuery",
"(",
"text",
",",
"idx",
",",
"nil",
")",
"\n",
"}"
] |
1,122 | all-1123 | [
"GetAlertIDOk",
"returns",
"a",
"tuple",
"with",
"the",
"AlertID",
"field",
"if",
"it",
"s",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"and",
"a",
"boolean",
"to",
"check",
"if",
"the",
"value",
"has",
"been",
"set",
"."
] | [
"func",
"(",
"w",
"*",
"Widget",
")",
"GetAlertIDOk",
"(",
")",
"(",
"int",
",",
"bool",
")",
"{",
"if",
"w",
"==",
"nil",
"||",
"w",
".",
"AlertID",
"==",
"nil",
"{",
"return",
"0",
",",
"<mask>",
"\n",
"}",
"\n",
"return",
"*",
"w",
".",
"AlertID",
",",
"true",
"\n",
"}"
] |
1,123 | all-1124 | [
"runActionForeachMachine",
"will",
"run",
"the",
"command",
"across",
"multiple",
"machines"
] | [
"func",
"runActionForeachMachine",
"(",
"actionName",
"string",
",",
"machines",
"[",
"]",
"*",
"host",
".",
"Host",
")",
"[",
"]",
"error",
"{",
"var",
"(",
"numConcurrentActions",
"=",
"0",
"\n",
"errorChan",
"=",
"<mask>",
"(",
"chan",
"error",
")",
"\n",
"errs",
"=",
"[",
"]",
"error",
"{",
"}",
"\n",
")",
"\n\n",
"for",
"_",
",",
"machine",
":=",
"range",
"machines",
"{",
"numConcurrentActions",
"++",
"\n",
"go",
"machineCommand",
"(",
"actionName",
",",
"machine",
",",
"errorChan",
")",
"\n",
"}",
"\n\n",
"// TODO: We should probably only do 5-10 of these",
"// at a time, since otherwise cloud providers might",
"// rate limit us.",
"for",
"i",
":=",
"0",
";",
"i",
"<",
"numConcurrentActions",
";",
"i",
"++",
"{",
"if",
"err",
":=",
"<-",
"errorChan",
";",
"err",
"!=",
"nil",
"{",
"errs",
"=",
"append",
"(",
"errs",
",",
"err",
")",
"\n",
"}",
"\n",
"}",
"\n\n",
"close",
"(",
"errorChan",
")",
"\n\n",
"return",
"errs",
"\n",
"}"
] |
1,124 | all-1125 | [
"base64URLEncode",
"encodes",
"the",
"given",
"string",
"to",
"be",
"URL",
"-",
"safe",
"."
] | [
"func",
"base64URLEncode",
"(",
"s",
"string",
")",
"(",
"string",
",",
"error",
")",
"{",
"return",
"base64",
".",
"URLEncoding",
".",
"EncodeToString",
"(",
"[",
"]",
"<mask>",
"(",
"s",
")",
")",
",",
"nil",
"\n",
"}"
] |
1,125 | all-1126 | [
"advanceTicks",
"advances",
"ticks",
"of",
"Raft",
"node",
".",
"This",
"can",
"be",
"used",
"for",
"fast",
"-",
"forwarding",
"election",
"ticks",
"in",
"multi",
"data",
"-",
"center",
"deployments",
"thus",
"speeding",
"up",
"election",
"process",
"."
] | [
"func",
"(",
"r",
"*",
"raftNode",
")",
"advanceTicks",
"(",
"ticks",
"int",
")",
"{",
"for",
"i",
":=",
"0",
";",
"i",
"<",
"ticks",
";",
"i",
"++",
"{",
"r",
".",
"<mask>",
"(",
")",
"\n",
"}",
"\n",
"}"
] |
1,126 | all-1127 | [
"IsTLS",
"returns",
"true",
"if",
"the",
"underlying",
"connection",
"is",
"tls",
".",
"Conn",
".",
"tls",
".",
"Conn",
"is",
"an",
"encrypted",
"connection",
"(",
"aka",
"SSL",
"HTTPS",
")",
"."
] | [
"func",
"(",
"ctx",
"*",
"RequestCtx",
")",
"IsTLS",
"(",
")",
"bool",
"{",
"// cast to (connTLSer) instead of (*tls.Conn), since it catches",
"// cases with overridden tls.Conn such as:",
"//",
"// type customConn struct {",
"// *tls.Conn",
"//",
"// // other custom fields here",
"// }",
"_",
",",
"<mask>",
":=",
"ctx",
".",
"c",
".",
"(",
"connTLSer",
")",
"\n",
"return",
"ok",
"\n",
"}"
] |
1,127 | all-1128 | [
"CustomLog",
"outputs",
"custom",
"level",
"log"
] | [
"func",
"(",
"g",
"*",
"Glg",
")",
"CustomLog",
"(",
"level",
"string",
",",
"val",
"...",
"<mask>",
"{",
"}",
")",
"error",
"{",
"return",
"g",
".",
"out",
"(",
"g",
".",
"TagStringToLevel",
"(",
"level",
")",
",",
"blankFormat",
"(",
"len",
"(",
"val",
")",
")",
",",
"val",
"...",
")",
"\n",
"}"
] |
1,128 | all-1129 | [
"SetFontData",
"sets",
"the",
"current",
"font",
"used",
"to",
"draw",
"text",
".",
"Always",
"use",
"this",
"method",
"as",
"SetFont",
"is",
"unsupported",
"by",
"the",
"pdf",
"graphic",
"context",
".",
"It",
"is",
"mandatory",
"to",
"call",
"this",
"method",
"at",
"least",
"once",
"before",
"printing",
"text",
"or",
"the",
"resulting",
"document",
"will",
"not",
"be",
"valid",
".",
"It",
"is",
"necessary",
"to",
"generate",
"a",
"font",
"definition",
"file",
"first",
"with",
"the",
"makefont",
"utility",
".",
"It",
"is",
"not",
"necessary",
"to",
"call",
"this",
"function",
"for",
"the",
"core",
"PDF",
"fonts",
"(",
"courier",
"helvetica",
"times",
"zapfdingbats",
")",
".",
"go",
"get",
"github",
".",
"com",
"/",
"jung",
"-",
"kurt",
"/",
"gofpdf",
"/",
"makefont",
"http",
":",
"//",
"godoc",
".",
"org",
"/",
"github",
".",
"com",
"/",
"jung",
"-",
"kurt",
"/",
"gofpdf#Fpdf",
".",
"AddFont"
] | [
"func",
"(",
"gc",
"*",
"GraphicContext",
")",
"SetFontData",
"(",
"fontData",
"draw2d",
".",
"FontData",
")",
"{",
"// TODO: call Makefont embed if json file does not exist yet",
"gc",
".",
"StackGraphicContext",
".",
"SetFontData",
"(",
"fontData",
")",
"\n",
"var",
"style",
"string",
"\n",
"if",
"fontData",
".",
"Style",
"&",
"draw2d",
".",
"FontStyleBold",
"!=",
"0",
"{",
"style",
"+=",
"\"",
"\"",
"\n",
"}",
"\n",
"if",
"fontData",
".",
"Style",
"&",
"draw2d",
".",
"FontStyleItalic",
"!=",
"0",
"{",
"style",
"+=",
"\"",
"\"",
"\n",
"}",
"\n",
"fn",
":=",
"draw2d",
".",
"FontFileName",
"(",
"fontData",
")",
"\n",
"fn",
"=",
"fn",
"[",
":",
"len",
"(",
"fn",
")",
"-",
"4",
"]",
"\n",
"<mask>",
",",
"_",
":=",
"gc",
".",
"pdf",
".",
"GetFontSize",
"(",
")",
"\n",
"gc",
".",
"pdf",
".",
"AddFont",
"(",
"fontData",
".",
"Name",
",",
"style",
",",
"fn",
"+",
"\"",
"\"",
")",
"\n",
"gc",
".",
"pdf",
".",
"SetFont",
"(",
"fontData",
".",
"Name",
",",
"style",
",",
"size",
")",
"\n",
"}"
] |
1,129 | all-1130 | [
"focusPrevious",
"focuses",
"on",
"the",
"previous",
"available",
"widget",
".",
"focusPrevious",
"shall",
"be",
"called",
"from",
"queue",
"context",
"."
] | [
"func",
"(",
"w",
"*",
"Window",
")",
"focusPrevious",
"(",
")",
"{",
"// it is ok to be negative since that'll focus on the first widget",
"w",
".",
"focus",
"--",
"\n",
"if",
"w",
".",
"<mask>",
"<",
"0",
"{",
"w",
".",
"focusWidget",
"(",
")",
"\n",
"return",
"\n",
"}",
"\n\n",
"// find previous widget",
"for",
"i",
":=",
"w",
".",
"focus",
";",
"i",
">",
"0",
";",
"i",
"--",
"{",
"widget",
":=",
"w",
".",
"widgets",
"[",
"i",
"]",
"\n",
"if",
"!",
"widget",
".",
"CanFocus",
"(",
")",
"{",
"continue",
"\n",
"}",
"\n",
"setCursor",
"(",
"-",
"1",
",",
"-",
"1",
")",
"// hide",
"\n",
"w",
".",
"focus",
"=",
"i",
"\n",
"widget",
".",
"Focus",
"(",
")",
"\n",
"return",
"\n",
"}",
"\n\n",
"// if we get here we need to focus on last focusable widget",
"for",
"i",
":=",
"len",
"(",
"w",
".",
"widgets",
")",
"-",
"1",
";",
"i",
">",
"w",
".",
"focus",
";",
"i",
"--",
"{",
"widget",
":=",
"w",
".",
"widgets",
"[",
"i",
"]",
"\n",
"if",
"!",
"widget",
".",
"CanFocus",
"(",
")",
"{",
"continue",
"\n",
"}",
"\n",
"setCursor",
"(",
"-",
"1",
",",
"-",
"1",
")",
"// hide",
"\n",
"w",
".",
"focus",
"=",
"i",
"\n",
"widget",
".",
"Focus",
"(",
")",
"\n",
"return",
"\n",
"}",
"\n\n",
"// if we get here it means we found nothing usable and give up",
"}"
] |
1,130 | all-1131 | [
"SetParentContext",
"sets",
"the",
"parent",
"for",
"the",
"Context",
"."
] | [
"func",
"(",
"cb",
"*",
"ContextBuilder",
")",
"SetParentContext",
"(",
"ctx",
"<mask>",
".",
"Context",
")",
"*",
"ContextBuilder",
"{",
"cb",
".",
"ParentContext",
"=",
"ctx",
"\n",
"return",
"cb",
"\n",
"}"
] |
1,131 | all-1132 | [
"unsafeGet",
"gets",
"one",
"cacheItem",
"instance",
"from",
"its",
"key",
"without",
"locking",
".",
"Errors",
":",
"InvalidKeyError",
"when",
"requested",
"key",
"could",
"not",
"be",
"found",
"."
] | [
"func",
"(",
"s",
"*",
"Cache",
")",
"unsafeGet",
"(",
"key",
"string",
")",
"(",
"*",
"cacheItem",
",",
"error",
")",
"{",
"v",
",",
"ok",
":=",
"s",
".",
"<mask>",
"[",
"key",
"]",
"\n",
"if",
"!",
"ok",
"{",
"return",
"nil",
",",
"raiqub",
".",
"InvalidKeyError",
"(",
"key",
")",
"\n",
"}",
"\n",
"return",
"v",
",",
"nil",
"\n",
"}"
] |
1,132 | all-1133 | [
"HTTPRespondMarshalIndentXML",
"marshals",
"response",
"as",
"XML",
"to",
"responseWriter",
"sets",
"Content",
"-",
"Type",
"to",
"application",
"/",
"xml",
"and",
"compresses",
"the",
"response",
"if",
"Content",
"-",
"Encoding",
"from",
"the",
"request",
"allows",
"it",
".",
"The",
"XML",
"will",
"be",
"marshalled",
"indented",
"according",
"to",
"xml",
".",
"MarshalIndent",
".",
"If",
"rootElement",
"is",
"not",
"empty",
"then",
"an",
"additional",
"root",
"element",
"with",
"this",
"name",
"will",
"be",
"wrapped",
"around",
"the",
"content",
"."
] | [
"func",
"HTTPRespondMarshalIndentXML",
"(",
"response",
"interface",
"{",
"}",
",",
"rootElement",
"string",
",",
"prefix",
",",
"indent",
"string",
",",
"responseWriter",
"http",
".",
"ResponseWriter",
",",
"request",
"*",
"http",
".",
"Request",
")",
"(",
"err",
"error",
")",
"{",
"NewHTTPCompressHandlerFromFunc",
"(",
"func",
"(",
"responseWriter",
"http",
".",
"ResponseWriter",
",",
"request",
"*",
"http",
".",
"Request",
")",
"{",
"var",
"data",
"[",
"]",
"byte",
"\n",
"contentPrefix",
":=",
"prefix",
"\n",
"if",
"rootElement",
"!=",
"\"",
"\"",
"{",
"contentPrefix",
"+=",
"indent",
"\n",
"}",
"\n",
"if",
"data",
",",
"err",
"=",
"xml",
".",
"MarshalIndent",
"(",
"response",
",",
"contentPrefix",
",",
"indent",
")",
";",
"err",
"==",
"nil",
"{",
"responseWriter",
".",
"Header",
"(",
")",
".",
"Set",
"(",
"\"",
"\"",
",",
"\"",
"\"",
")",
"\n",
"if",
"rootElement",
"==",
"\"",
"\"",
"{",
"_",
",",
"err",
"=",
"fmt",
".",
"Fprintf",
"(",
"responseWriter",
",",
"\"",
"\\n",
"\"",
",",
"prefix",
",",
"xml",
".",
"Header",
",",
"data",
")",
"\n",
"}",
"else",
"{",
"_",
",",
"err",
"=",
"fmt",
".",
"Fprintf",
"(",
"responseWriter",
",",
"\"",
"\\n",
"\\n",
"\"",
",",
"prefix",
",",
"xml",
".",
"<mask>",
",",
"prefix",
",",
"rootElement",
",",
"data",
",",
"prefix",
",",
"rootElement",
")",
"\n",
"}",
"\n",
"}",
"\n",
"}",
")",
".",
"ServeHTTP",
"(",
"responseWriter",
",",
"request",
")",
"\n",
"return",
"err",
"\n",
"}"
] |
1,133 | all-1134 | [
"Clone",
"a",
"template",
".",
"This",
"is",
"useful",
"for",
"defining",
"helpers",
"on",
"per",
"instance",
"of",
"the",
"template",
"."
] | [
"func",
"(",
"t",
"*",
"<mask>",
")",
"Clone",
"(",
")",
"*",
"Template",
"{",
"t2",
":=",
"&",
"Template",
"{",
"Input",
":",
"t",
".",
"Input",
",",
"program",
":",
"t",
".",
"program",
",",
"}",
"\n",
"return",
"t2",
"\n",
"}"
] |
1,134 | all-1135 | [
"Sends",
"an",
"S3",
"multipart",
"upload",
"initiation",
"request",
".",
"See",
"http",
":",
"//",
"docs",
".",
"amazonwebservices",
".",
"com",
"/",
"AmazonS3",
"/",
"latest",
"/",
"dev",
"/",
"mpuoverview",
".",
"html",
".",
"This",
"initial",
"request",
"returns",
"an",
"UploadId",
"that",
"we",
"use",
"to",
"identify",
"subsequent",
"PUT",
"requests",
"."
] | [
"func",
"newUploader",
"(",
"url",
"string",
",",
"h",
"<mask>",
".",
"Header",
",",
"c",
"*",
"Config",
")",
"(",
"u",
"*",
"uploader",
",",
"err",
"error",
")",
"{",
"u",
"=",
"new",
"(",
"uploader",
")",
"\n",
"u",
".",
"s3",
"=",
"*",
"c",
".",
"Service",
"\n",
"u",
".",
"url",
"=",
"url",
"\n",
"u",
".",
"keys",
"=",
"*",
"c",
".",
"Keys",
"\n",
"u",
".",
"client",
"=",
"c",
".",
"Client",
"\n",
"if",
"u",
".",
"client",
"==",
"nil",
"{",
"u",
".",
"client",
"=",
"http",
".",
"DefaultClient",
"\n",
"}",
"\n",
"u",
".",
"bufsz",
"=",
"minPartSize",
"\n",
"r",
",",
"err",
":=",
"http",
".",
"NewRequest",
"(",
"\"",
"\"",
",",
"url",
"+",
"\"",
"\"",
",",
"nil",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"r",
".",
"Header",
".",
"Set",
"(",
"\"",
"\"",
",",
"time",
".",
"Now",
"(",
")",
".",
"UTC",
"(",
")",
".",
"Format",
"(",
"http",
".",
"TimeFormat",
")",
")",
"\n",
"for",
"k",
":=",
"range",
"h",
"{",
"for",
"_",
",",
"v",
":=",
"range",
"h",
"[",
"k",
"]",
"{",
"r",
".",
"Header",
".",
"Add",
"(",
"k",
",",
"v",
")",
"\n",
"}",
"\n",
"}",
"\n",
"u",
".",
"s3",
".",
"Sign",
"(",
"r",
",",
"u",
".",
"keys",
")",
"\n",
"resp",
",",
"err",
":=",
"u",
".",
"client",
".",
"Do",
"(",
"r",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"defer",
"resp",
".",
"Body",
".",
"Close",
"(",
")",
"\n",
"if",
"resp",
".",
"StatusCode",
"!=",
"200",
"{",
"return",
"nil",
",",
"newRespError",
"(",
"resp",
")",
"\n",
"}",
"\n",
"err",
"=",
"xml",
".",
"NewDecoder",
"(",
"resp",
".",
"Body",
")",
".",
"Decode",
"(",
"u",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"u",
".",
"ch",
"=",
"make",
"(",
"chan",
"*",
"part",
")",
"\n",
"for",
"i",
":=",
"0",
";",
"i",
"<",
"concurrency",
";",
"i",
"++",
"{",
"go",
"u",
".",
"worker",
"(",
")",
"\n",
"}",
"\n",
"return",
"u",
",",
"nil",
"\n",
"}"
] |
1,135 | all-1136 | [
"PangoFontDescription",
"*",
"pango_font_description_from_string",
"(",
"const",
"char",
"*",
"str",
")",
";"
] | [
"func",
"FontDescriptionFromString",
"(",
"str",
"string",
")",
"*",
"FontDescription",
"{",
"cstr",
":=",
"C",
".",
"CString",
"(",
"str",
")",
"\n",
"defer",
"C",
".",
"free",
"(",
"unsafe",
".",
"Pointer",
"(",
"cstr",
")",
")",
"\n",
"c",
":=",
"C",
".",
"pango_font_description_from_string",
"(",
"(",
"*",
"C",
".",
"<mask>",
")",
"(",
"cstr",
")",
")",
"\n",
"v",
":=",
"new",
"(",
"FontDescription",
")",
"\n",
"v",
".",
"pangoFontDescription",
"=",
"c",
"\n",
"return",
"v",
"\n",
"}"
] |
1,136 | all-1137 | [
"Locator",
"returns",
"a",
"locator",
"for",
"the",
"given",
"resource"
] | [
"func",
"(",
"r",
"*",
"Credential",
")",
"Locator",
"(",
"api",
"*",
"API",
")",
"*",
"CredentialLocator",
"{",
"for",
"_",
",",
"l",
":=",
"<mask>",
"r",
".",
"Links",
"{",
"if",
"l",
"[",
"\"",
"\"",
"]",
"==",
"\"",
"\"",
"{",
"return",
"api",
".",
"CredentialLocator",
"(",
"l",
"[",
"\"",
"\"",
"]",
")",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
] |
1,137 | all-1138 | [
"UpdateContainerReference",
"updates",
"container",
"reference",
"in",
"image",
"state"
] | [
"func",
"(",
"imageState",
"*",
"ImageState",
")",
"UpdateContainerReference",
"(",
"container",
"*",
"apicontainer",
".",
"Container",
")",
"{",
"imageState",
".",
"<mask>",
".",
"Lock",
"(",
")",
"\n",
"defer",
"imageState",
".",
"lock",
".",
"Unlock",
"(",
")",
"\n",
"seelog",
".",
"Infof",
"(",
"\"",
"\"",
",",
"container",
".",
"Name",
",",
"imageState",
".",
"Image",
".",
"ImageID",
")",
"\n",
"imageState",
".",
"Containers",
"=",
"append",
"(",
"imageState",
".",
"Containers",
",",
"container",
")",
"\n",
"}"
] |
1,138 | all-1139 | [
"exprList",
"parses",
"a",
"sequence",
"of",
"expressions",
"up",
"to",
"a",
"terminating",
"character",
"."
] | [
"func",
"(",
"st",
"*",
"<mask>",
")",
"exprList",
"(",
"stop",
"byte",
")",
"AST",
"{",
"if",
"len",
"(",
"st",
".",
"str",
")",
">",
"0",
"&&",
"st",
".",
"str",
"[",
"0",
"]",
"==",
"stop",
"{",
"st",
".",
"advance",
"(",
"1",
")",
"\n",
"return",
"&",
"ExprList",
"{",
"Exprs",
":",
"nil",
"}",
"\n",
"}",
"\n\n",
"var",
"exprs",
"[",
"]",
"AST",
"\n",
"for",
"{",
"e",
":=",
"st",
".",
"expression",
"(",
")",
"\n",
"exprs",
"=",
"append",
"(",
"exprs",
",",
"e",
")",
"\n",
"if",
"len",
"(",
"st",
".",
"str",
")",
">",
"0",
"&&",
"st",
".",
"str",
"[",
"0",
"]",
"==",
"stop",
"{",
"st",
".",
"advance",
"(",
"1",
")",
"\n",
"break",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"&",
"ExprList",
"{",
"Exprs",
":",
"exprs",
"}",
"\n",
"}"
] |
1,139 | all-1140 | [
"AddInline",
"returns",
"a",
"copy",
"of",
"MailBuilder",
"that",
"includes",
"the",
"specified",
"inline",
".",
"fileName",
"and",
"contentID",
"may",
"be",
"left",
"empty",
"."
] | [
"func",
"(",
"p",
"MailBuilder",
")",
"AddInline",
"(",
"b",
"[",
"]",
"byte",
",",
"contentType",
"string",
",",
"fileName",
"string",
",",
"contentID",
"string",
",",
")",
"MailBuilder",
"{",
"part",
":=",
"NewPart",
"(",
"contentType",
")",
"\n",
"part",
".",
"Content",
"=",
"b",
"\n",
"<mask>",
".",
"FileName",
"=",
"fileName",
"\n",
"part",
".",
"Disposition",
"=",
"cdInline",
"\n",
"part",
".",
"ContentID",
"=",
"contentID",
"\n",
"p",
".",
"inlines",
"=",
"append",
"(",
"p",
".",
"inlines",
",",
"part",
")",
"\n",
"return",
"p",
"\n",
"}"
] |
1,140 | all-1141 | [
"MoveMouseBy",
"moves",
"the",
"mouse",
"by",
"the",
"provided",
"offset",
"."
] | [
"func",
"(",
"p",
"*",
"Page",
")",
"MoveMouseBy",
"(",
"xOffset",
",",
"yOffset",
"int",
")",
"error",
"{",
"if",
"err",
":=",
"p",
".",
"<mask>",
".",
"MoveTo",
"(",
"nil",
",",
"api",
".",
"XYOffset",
"{",
"X",
":",
"xOffset",
",",
"Y",
":",
"yOffset",
"}",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"}",
"\n\n",
"return",
"nil",
"\n",
"}"
] |
1,141 | all-1142 | [
"KeyfileSettingsBackendNew",
"is",
"a",
"wrapper",
"around",
"g_keyfile_settings_backend_new",
"()",
"."
] | [
"func",
"KeyfileSettingsBackendNew",
"(",
"filename",
",",
"rootPath",
",",
"rootGroup",
"string",
")",
"*",
"SettingsBackend",
"{",
"cstr1",
":=",
"(",
"*",
"C",
".",
"gchar",
")",
"(",
"C",
".",
"CString",
"(",
"filename",
")",
")",
"\n",
"defer",
"C",
".",
"<mask>",
"(",
"unsafe",
".",
"Pointer",
"(",
"cstr1",
")",
")",
"\n\n",
"cstr2",
":=",
"(",
"*",
"C",
".",
"gchar",
")",
"(",
"C",
".",
"CString",
"(",
"rootPath",
")",
")",
"\n",
"defer",
"C",
".",
"free",
"(",
"unsafe",
".",
"Pointer",
"(",
"cstr2",
")",
")",
"\n\n",
"cstr3",
":=",
"(",
"*",
"C",
".",
"gchar",
")",
"(",
"C",
".",
"CString",
"(",
"rootGroup",
")",
")",
"\n",
"defer",
"C",
".",
"free",
"(",
"unsafe",
".",
"Pointer",
"(",
"cstr3",
")",
")",
"\n\n",
"return",
"wrapSettingsBackend",
"(",
"wrapObject",
"(",
"unsafe",
".",
"Pointer",
"(",
"C",
".",
"g_keyfile_settings_backend_new",
"(",
"cstr1",
",",
"cstr2",
",",
"cstr3",
")",
")",
")",
")",
"\n",
"}"
] |
1,142 | all-1143 | [
"GetApplicable",
"returns",
"the",
"subset",
"of",
"blockers",
"applicable",
"to",
"the",
"specified",
"branch",
"."
] | [
"func",
"(",
"b",
"Blockers",
")",
"GetApplicable",
"(",
"org",
",",
"repo",
",",
"branch",
"string",
")",
"[",
"]",
"Blocker",
"{",
"var",
"res",
"[",
"]",
"Blocker",
"\n",
"res",
"=",
"append",
"(",
"res",
",",
"b",
".",
"Repo",
"[",
"orgRepo",
"{",
"org",
":",
"org",
",",
"repo",
":",
"repo",
"}",
"]",
"...",
")",
"\n",
"res",
"=",
"append",
"(",
"res",
",",
"b",
".",
"Branch",
"[",
"orgRepoBranch",
"{",
"org",
":",
"org",
",",
"repo",
":",
"repo",
",",
"branch",
":",
"branch",
"}",
"]",
"...",
")",
"\n\n",
"sort",
".",
"Slice",
"(",
"res",
",",
"func",
"(",
"i",
",",
"j",
"int",
")",
"bool",
"{",
"return",
"res",
"[",
"i",
"]",
".",
"Number",
"<",
"res",
"[",
"j",
"]",
".",
"Number",
"\n",
"}",
")",
"\n",
"return",
"<mask>",
"\n",
"}"
] |
1,143 | all-1144 | [
"MustTxSetHash",
"retrieves",
"the",
"TxSetHash",
"value",
"from",
"the",
"union",
"panicing",
"if",
"the",
"value",
"is",
"not",
"set",
"."
] | [
"func",
"(",
"u",
"StellarMessage",
")",
"MustTxSetHash",
"(",
")",
"Uint256",
"{",
"val",
",",
"ok",
":=",
"u",
".",
"GetTxSetHash",
"(",
")",
"\n\n",
"if",
"!",
"<mask>",
"{",
"panic",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"return",
"val",
"\n",
"}"
] |
1,144 | all-1145 | [
"Parse",
"incoming",
"message"
] | [
"func",
"(",
"m",
"*",
"MessageStream",
")",
"parse",
"(",
")",
"{",
"for",
"{",
"b",
":=",
"<-",
"m",
".",
"pool",
".",
"Full",
"\n",
"log",
".",
"Debugf",
"(",
"\"",
"\"",
",",
"b",
".",
"Bytes",
"(",
")",
")",
"\n",
"msg",
",",
"err",
":=",
"m",
".",
"parser",
".",
"Parse",
"(",
"b",
".",
"Bytes",
"(",
")",
")",
"\n",
"// Log all message parsing errors.",
"if",
"err",
"!=",
"nil",
"{",
"log",
".",
"Print",
"(",
"err",
")",
"\n",
"}",
"\n\n",
"m",
".",
"Inbound",
"<-",
"<mask>",
"\n",
"b",
".",
"Reset",
"(",
")",
"\n",
"m",
".",
"pool",
".",
"Empty",
"<-",
"b",
"\n",
"}",
"\n",
"}"
] |
1,145 | all-1146 | [
"SetObject",
"sets",
"the",
"regular",
"expresion",
"that",
"should",
"match",
"the",
"name",
"of",
"the",
"object",
"."
] | [
"func",
"(",
"x",
"*",
"Exception",
")",
"SetObject",
"(",
"object",
"string",
")",
"error",
"{",
"objectRegexp",
",",
"err",
":=",
"regexp",
".",
"Compile",
"(",
"\"",
"\"",
"+",
"object",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"x",
".",
"<mask>",
"=",
"objectRegexp",
"\n",
"return",
"nil",
"\n",
"}"
] |
1,146 | all-1147 | [
"IntrospectState",
"returns",
"the",
"runtime",
"state",
"for",
"this",
"relayer",
"."
] | [
"func",
"(",
"r",
"*",
"Relayer",
")",
"IntrospectState",
"(",
"opts",
"*",
"IntrospectionOptions",
")",
"RelayerRuntimeState",
"{",
"<mask>",
":=",
"r",
".",
"inbound",
".",
"Count",
"(",
")",
"+",
"r",
".",
"outbound",
".",
"Count",
"(",
")",
"\n",
"return",
"RelayerRuntimeState",
"{",
"Count",
":",
"count",
",",
"InboundItems",
":",
"r",
".",
"inbound",
".",
"IntrospectState",
"(",
"opts",
",",
"\"",
"\"",
")",
",",
"OutboundItems",
":",
"r",
".",
"outbound",
".",
"IntrospectState",
"(",
"opts",
",",
"\"",
"\"",
")",
",",
"MaxTimeout",
":",
"r",
".",
"maxTimeout",
",",
"}",
"\n",
"}"
] |
1,147 | all-1148 | [
"Abs",
"computes",
"an",
"absolute",
"label",
"(",
"one",
"with",
"a",
"repository",
"and",
"package",
"name",
")",
"from",
"this",
"label",
".",
"If",
"this",
"label",
"is",
"already",
"absolute",
"it",
"is",
"returned",
"unchanged",
"."
] | [
"func",
"(",
"l",
"Label",
")",
"Abs",
"(",
"repo",
",",
"pkg",
"string",
")",
"Label",
"{",
"if",
"!",
"l",
".",
"Relative",
"{",
"return",
"l",
"\n",
"}",
"\n",
"return",
"Label",
"{",
"Repo",
":",
"repo",
",",
"Pkg",
":",
"pkg",
",",
"Name",
":",
"l",
".",
"<mask>",
"}",
"\n",
"}"
] |
1,148 | all-1149 | [
"NewRandomSub",
"returns",
"a",
"new",
"PubSub",
"object",
"using",
"RandomSubRouter",
"as",
"the",
"router",
"."
] | [
"func",
"NewRandomSub",
"(",
"ctx",
"context",
".",
"Context",
",",
"h",
"host",
".",
"Host",
",",
"opts",
"...",
"Option",
")",
"(",
"*",
"PubSub",
",",
"error",
")",
"{",
"rt",
":=",
"&",
"RandomSubRouter",
"{",
"peers",
":",
"make",
"(",
"<mask>",
"[",
"peer",
".",
"ID",
"]",
"protocol",
".",
"ID",
")",
",",
"}",
"\n",
"return",
"NewPubSub",
"(",
"ctx",
",",
"h",
",",
"rt",
",",
"opts",
"...",
")",
"\n",
"}"
] |
1,149 | all-1150 | [
"Fetch",
"queries",
"the",
"Vault",
"API"
] | [
"func",
"(",
"d",
"*",
"VaultReadQuery",
")",
"Fetch",
"(",
"clients",
"*",
"ClientSet",
",",
"opts",
"*",
"QueryOptions",
")",
"(",
"interface",
"{",
"}",
",",
"*",
"ResponseMetadata",
",",
"error",
")",
"{",
"select",
"{",
"case",
"<-",
"d",
".",
"stopCh",
":",
"return",
"nil",
",",
"nil",
",",
"ErrStopped",
"\n",
"default",
":",
"}",
"\n\n",
"opts",
"=",
"opts",
".",
"Merge",
"(",
"&",
"QueryOptions",
"{",
"}",
")",
"\n\n",
"if",
"d",
".",
"secret",
"!=",
"nil",
"{",
"if",
"vaultSecretRenewable",
"(",
"d",
".",
"secret",
")",
"{",
"log",
".",
"Printf",
"(",
"\"",
"\"",
",",
"d",
")",
"\n\n",
"renewer",
",",
"err",
":=",
"clients",
".",
"Vault",
"(",
")",
".",
"NewRenewer",
"(",
"&",
"api",
".",
"RenewerInput",
"{",
"Grace",
":",
"opts",
".",
"VaultGrace",
",",
"Secret",
":",
"d",
".",
"vaultSecret",
",",
"}",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"nil",
",",
"errors",
".",
"Wrap",
"(",
"err",
",",
"d",
".",
"<mask>",
"(",
")",
")",
"\n",
"}",
"\n",
"go",
"renewer",
".",
"Renew",
"(",
")",
"\n",
"defer",
"renewer",
".",
"Stop",
"(",
")",
"\n\n",
"RENEW",
":",
"for",
"{",
"select",
"{",
"case",
"err",
":=",
"<-",
"renewer",
".",
"DoneCh",
"(",
")",
":",
"if",
"err",
"!=",
"nil",
"{",
"log",
".",
"Printf",
"(",
"\"",
"\"",
",",
"d",
",",
"err",
")",
"\n",
"}",
"\n",
"log",
".",
"Printf",
"(",
"\"",
"\"",
",",
"d",
")",
"\n",
"break",
"RENEW",
"\n",
"case",
"renewal",
":=",
"<-",
"renewer",
".",
"RenewCh",
"(",
")",
":",
"log",
".",
"Printf",
"(",
"\"",
"\"",
",",
"d",
")",
"\n",
"printVaultWarnings",
"(",
"d",
",",
"renewal",
".",
"Secret",
".",
"Warnings",
")",
"\n",
"updateSecret",
"(",
"d",
".",
"secret",
",",
"renewal",
".",
"Secret",
")",
"\n",
"case",
"<-",
"d",
".",
"stopCh",
":",
"return",
"nil",
",",
"nil",
",",
"ErrStopped",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"else",
"{",
"// The secret isn't renewable, probably the generic secret backend.",
"dur",
":=",
"vaultRenewDuration",
"(",
"d",
".",
"secret",
")",
"\n",
"log",
".",
"Printf",
"(",
"\"",
"\"",
",",
"d",
",",
"dur",
")",
"\n",
"select",
"{",
"case",
"<-",
"time",
".",
"After",
"(",
"dur",
")",
":",
"// The lease is almost expired, it's time to request a new one.",
"case",
"<-",
"d",
".",
"stopCh",
":",
"return",
"nil",
",",
"nil",
",",
"ErrStopped",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n\n",
"// We don't have a secret, or the prior renewal failed",
"vaultSecret",
",",
"err",
":=",
"d",
".",
"readSecret",
"(",
"clients",
",",
"opts",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"nil",
",",
"errors",
".",
"Wrap",
"(",
"err",
",",
"d",
".",
"String",
"(",
")",
")",
"\n",
"}",
"\n\n",
"// Print any warnings",
"printVaultWarnings",
"(",
"d",
",",
"vaultSecret",
".",
"Warnings",
")",
"\n\n",
"// Create the cloned secret which will be exposed to the template.",
"d",
".",
"vaultSecret",
"=",
"vaultSecret",
"\n",
"d",
".",
"secret",
"=",
"transformSecret",
"(",
"vaultSecret",
")",
"\n\n",
"return",
"respWithMetadata",
"(",
"d",
".",
"secret",
")",
"\n",
"}"
] |
1,150 | all-1151 | [
"ConnectIfContainerIsRemote",
"figures",
"out",
"the",
"address",
"of",
"the",
"node",
"which",
"is",
"running",
"the",
"container",
"with",
"the",
"given",
"name",
".",
"If",
"it",
"s",
"not",
"the",
"local",
"node",
"will",
"connect",
"to",
"it",
"and",
"return",
"the",
"connected",
"client",
"otherwise",
"it",
"will",
"just",
"return",
"nil",
"."
] | [
"func",
"ConnectIfContainerIsRemote",
"(",
"cluster",
"*",
"db",
".",
"Cluster",
",",
"project",
",",
"name",
"string",
",",
"cert",
"*",
"shared",
".",
"CertInfo",
")",
"(",
"lxd",
".",
"ContainerServer",
",",
"error",
")",
"{",
"var",
"address",
"string",
"// Node address",
"\n",
"err",
":=",
"cluster",
".",
"Transaction",
"(",
"func",
"(",
"tx",
"*",
"db",
".",
"ClusterTx",
")",
"error",
"{",
"<mask>",
"err",
"error",
"\n",
"address",
",",
"err",
"=",
"tx",
".",
"ContainerNodeAddress",
"(",
"project",
",",
"name",
")",
"\n",
"return",
"err",
"\n",
"}",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"if",
"address",
"==",
"\"",
"\"",
"{",
"// The container is running right on this node, no need to connect.",
"return",
"nil",
",",
"nil",
"\n",
"}",
"\n",
"return",
"Connect",
"(",
"address",
",",
"cert",
",",
"false",
")",
"\n",
"}"
] |
1,151 | all-1152 | [
"NewReaderLexer",
"creates",
"a",
"new",
"lexer"
] | [
"func",
"NewReaderLexer",
"(",
"rdr",
"<mask>",
".",
"Reader",
")",
"*",
"parser",
".",
"Lexer",
"{",
"l",
":=",
"parser",
".",
"NewReaderLexer",
"(",
"rdr",
",",
"SymbolSet",
")",
"\n",
"l",
".",
"SetTagStart",
"(",
"\"",
"\"",
")",
"\n",
"l",
".",
"SetTagEnd",
"(",
"\"",
"\"",
")",
"\n\n",
"return",
"l",
"\n",
"}"
] |
1,152 | all-1153 | [
"C",
"will",
"return",
"the",
"collection",
"associated",
"to",
"the",
"passed",
"model",
"."
] | [
"func",
"(",
"s",
"*",
"SubStore",
")",
"C",
"(",
"model",
"<mask>",
")",
"*",
"mgo",
".",
"Collection",
"{",
"return",
"s",
".",
"DB",
"(",
")",
".",
"C",
"(",
"C",
"(",
"model",
")",
")",
"\n",
"}"
] |
1,153 | all-1154 | [
"MardkownSHAList",
"prints",
"the",
"list",
"of",
"commits",
"in",
"a",
"markdown",
"-",
"friendly",
"way",
"."
] | [
"func",
"MarkdownSHAList",
"(",
"org",
",",
"repo",
"string",
",",
"list",
"[",
"]",
"github",
".",
"GitCommit",
")",
"string",
"{",
"lines",
":=",
"make",
"(",
"[",
"]",
"string",
",",
"len",
"(",
"list",
")",
")",
"\n",
"lineFmt",
":=",
"\"",
"\"",
"\n",
"for",
"i",
",",
"commit",
":=",
"range",
"list",
"{",
"if",
"commit",
".",
"SHA",
"==",
"\"",
"\"",
"{",
"continue",
"\n",
"}",
"\n",
"// if we somehow encounter a SHA that's less than 7 characters, we will",
"// just use it as is.",
"shortSHA",
":=",
"commit",
".",
"SHA",
"\n",
"if",
"len",
"(",
"shortSHA",
")",
">",
"7",
"{",
"shortSHA",
"=",
"shortSHA",
"[",
":",
"7",
"]",
"\n",
"}",
"\n\n",
"// get the first line of the commit",
"message",
":=",
"strings",
".",
"Split",
"(",
"commit",
".",
"Message",
",",
"\"",
"\\n",
"\"",
")",
"[",
"0",
"]",
"\n\n",
"lines",
"[",
"i",
"]",
"=",
"fmt",
".",
"Sprintf",
"(",
"lineFmt",
",",
"shortSHA",
",",
"org",
",",
"repo",
",",
"<mask>",
".",
"SHA",
",",
"message",
")",
"\n",
"}",
"\n",
"return",
"strings",
".",
"Join",
"(",
"lines",
",",
"\"",
"\\n",
"\"",
")",
"\n",
"}"
] |
1,154 | all-1155 | [
"InitLabels",
"returns",
"the",
"process",
"label",
"and",
"file",
"labels",
"to",
"be",
"used",
"within",
"the",
"container",
".",
"A",
"list",
"of",
"options",
"can",
"be",
"passed",
"into",
"this",
"function",
"to",
"alter",
"the",
"labels",
".",
"The",
"labels",
"returned",
"will",
"include",
"a",
"random",
"MCS",
"String",
"that",
"is",
"guaranteed",
"to",
"be",
"unique",
"."
] | [
"func",
"InitLabels",
"(",
"options",
"[",
"]",
"string",
")",
"(",
"string",
",",
"string",
",",
"error",
")",
"{",
"if",
"!",
"selinux",
".",
"SelinuxEnabled",
"(",
")",
"{",
"return",
"\"",
"\"",
",",
"\"",
"\"",
",",
"nil",
"\n",
"}",
"\n",
"processLabel",
",",
"mountLabel",
":=",
"selinux",
".",
"GetLxcContexts",
"(",
")",
"\n",
"if",
"processLabel",
"!=",
"\"",
"\"",
"{",
"pcon",
":=",
"selinux",
".",
"NewContext",
"(",
"processLabel",
")",
"\n",
"mcon",
":=",
"selinux",
".",
"NewContext",
"(",
"mountLabel",
")",
"\n",
"for",
"_",
",",
"opt",
":=",
"range",
"options",
"{",
"if",
"opt",
"==",
"\"",
"\"",
"{",
"return",
"\"",
"\"",
",",
"\"",
"\"",
",",
"nil",
"\n",
"}",
"\n",
"if",
"i",
":=",
"strings",
".",
"Index",
"(",
"opt",
",",
"\"",
"\"",
")",
";",
"i",
"==",
"-",
"1",
"{",
"return",
"\"",
"\"",
",",
"\"",
"\"",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"con",
":=",
"strings",
".",
"SplitN",
"(",
"<mask>",
",",
"\"",
"\"",
",",
"2",
")",
"\n",
"pcon",
"[",
"con",
"[",
"0",
"]",
"]",
"=",
"con",
"[",
"1",
"]",
"\n",
"if",
"con",
"[",
"0",
"]",
"==",
"\"",
"\"",
"||",
"con",
"[",
"0",
"]",
"==",
"\"",
"\"",
"{",
"mcon",
"[",
"con",
"[",
"0",
"]",
"]",
"=",
"con",
"[",
"1",
"]",
"\n",
"}",
"\n",
"}",
"\n",
"processLabel",
"=",
"pcon",
".",
"Get",
"(",
")",
"\n",
"mountLabel",
"=",
"mcon",
".",
"Get",
"(",
")",
"\n",
"}",
"\n",
"return",
"processLabel",
",",
"mountLabel",
",",
"nil",
"\n",
"}"
] |
1,155 | all-1156 | [
"AddFileAttachment",
"returns",
"a",
"copy",
"of",
"MailBuilder",
"that",
"includes",
"the",
"specified",
"attachment",
".",
"fileName",
"will",
"be",
"populated",
"from",
"the",
"base",
"name",
"of",
"path",
".",
"Content",
"type",
"will",
"be",
"detected",
"from",
"the",
"path",
"extension",
"."
] | [
"func",
"(",
"p",
"MailBuilder",
")",
"AddFileAttachment",
"(",
"path",
"string",
")",
"MailBuilder",
"{",
"// Only allow first p.err value",
"if",
"p",
".",
"err",
"!=",
"nil",
"{",
"return",
"p",
"\n",
"}",
"\n",
"f",
",",
"err",
":=",
"os",
".",
"Open",
"(",
"path",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"p",
".",
"err",
"=",
"err",
"\n",
"return",
"p",
"\n",
"}",
"\n",
"b",
",",
"err",
":=",
"ioutil",
".",
"ReadAll",
"(",
"f",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"p",
".",
"err",
"=",
"err",
"\n",
"return",
"p",
"\n",
"}",
"\n",
"<mask>",
":=",
"filepath",
".",
"Base",
"(",
"path",
")",
"\n",
"ctype",
":=",
"mime",
".",
"TypeByExtension",
"(",
"filepath",
".",
"Ext",
"(",
"name",
")",
")",
"\n",
"return",
"p",
".",
"AddAttachment",
"(",
"b",
",",
"ctype",
",",
"name",
")",
"\n",
"}"
] |
1,156 | all-1157 | [
"SetTaskENI",
"sets",
"the",
"eni",
"information",
"of",
"the",
"task"
] | [
"func",
"(",
"task",
"*",
"Task",
")",
"SetTaskENI",
"(",
"eni",
"*",
"apieni",
".",
"ENI",
")",
"{",
"task",
".",
"<mask>",
".",
"Lock",
"(",
")",
"\n",
"defer",
"task",
".",
"lock",
".",
"Unlock",
"(",
")",
"\n\n",
"task",
".",
"ENI",
"=",
"eni",
"\n",
"}"
] |
1,157 | all-1158 | [
"WithFooterTemplate",
"HTML",
"template",
"for",
"the",
"print",
"footer",
".",
"Should",
"use",
"the",
"same",
"format",
"as",
"the",
"headerTemplate",
"."
] | [
"func",
"(",
"p",
"PrintToPDFParams",
")",
"WithFooterTemplate",
"(",
"footerTemplate",
"<mask>",
")",
"*",
"PrintToPDFParams",
"{",
"p",
".",
"FooterTemplate",
"=",
"footerTemplate",
"\n",
"return",
"&",
"p",
"\n",
"}"
] |
1,158 | all-1159 | [
"GetMetadata",
"indicates",
"an",
"expected",
"call",
"of",
"GetMetadata"
] | [
"func",
"(",
"mr",
"*",
"MockHttpClientMockRecorder",
")",
"GetMetadata",
"(",
"arg0",
"<mask>",
"{",
"}",
")",
"*",
"gomock",
".",
"Call",
"{",
"return",
"mr",
".",
"mock",
".",
"ctrl",
".",
"RecordCallWithMethodType",
"(",
"mr",
".",
"mock",
",",
"\"",
"\"",
",",
"reflect",
".",
"TypeOf",
"(",
"(",
"*",
"MockHttpClient",
")",
"(",
"nil",
")",
".",
"GetMetadata",
")",
",",
"arg0",
")",
"\n",
"}"
] |
1,159 | all-1160 | [
"MarshalJSON",
"supports",
"json",
".",
"Marshaler",
"interface"
] | [
"func",
"(",
"v",
"RemoteObject",
")",
"MarshalJSON",
"(",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"w",
":=",
"jwriter",
".",
"Writer",
"{",
"}",
"\n",
"easyjsonC5a4559bEncodeGithubComChromedpCdprotoRuntime9",
"(",
"&",
"w",
",",
"v",
")",
"\n",
"return",
"w",
".",
"<mask>",
".",
"BuildBytes",
"(",
")",
",",
"w",
".",
"Error",
"\n",
"}"
] |
1,160 | all-1161 | [
"PutObjectAsync",
"puts",
"a",
"value",
"into",
"the",
"object",
"store",
"asynchronously",
"."
] | [
"func",
"(",
"c",
"APIClient",
")",
"PutObjectAsync",
"(",
"tags",
"[",
"]",
"*",
"pfs",
".",
"Tag",
")",
"(",
"*",
"PutObjectWriteCloserAsync",
",",
"error",
")",
"{",
"w",
",",
"err",
":=",
"c",
".",
"newPutObjectWriteCloserAsync",
"(",
"<mask>",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"grpcutil",
".",
"ScrubGRPC",
"(",
"err",
")",
"\n",
"}",
"\n",
"return",
"w",
",",
"nil",
"\n",
"}"
] |
1,161 | all-1162 | [
"DeviceChangeString",
"pretty",
"-",
"prints",
"a",
"slice",
"of",
"VirtualDeviceConfigSpec",
"."
] | [
"func",
"DeviceChangeString",
"(",
"specs",
"[",
"]",
"types",
".",
"BaseVirtualDeviceConfigSpec",
")",
"string",
"{",
"var",
"strs",
"[",
"]",
"string",
"\n",
"for",
"_",
",",
"v",
":=",
"range",
"specs",
"{",
"spec",
":=",
"v",
".",
"GetVirtualDeviceConfigSpec",
"(",
")",
"\n",
"strs",
"=",
"<mask>",
"(",
"strs",
",",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"string",
"(",
"spec",
".",
"Operation",
")",
",",
"spec",
".",
"Device",
",",
"spec",
".",
"Device",
".",
"GetVirtualDevice",
"(",
")",
".",
"Key",
")",
")",
"\n",
"}",
"\n",
"return",
"strings",
".",
"Join",
"(",
"strs",
",",
"\"",
"\"",
")",
"\n",
"}"
] |
1,162 | all-1163 | [
"SwitchToWindow",
"switches",
"to",
"the",
"first",
"available",
"window",
"with",
"the",
"provided",
"name",
"(",
"JavaScript",
"window",
".",
"name",
"attribute",
")",
"."
] | [
"func",
"(",
"p",
"*",
"Page",
")",
"SwitchToWindow",
"(",
"name",
"string",
")",
"error",
"{",
"if",
"err",
":=",
"p",
".",
"session",
".",
"SetWindowByName",
"(",
"<mask>",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
] |
1,163 | all-1164 | [
"GetValOk",
"returns",
"a",
"tuple",
"with",
"the",
"Val",
"field",
"if",
"it",
"s",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"and",
"a",
"boolean",
"to",
"check",
"if",
"the",
"value",
"has",
"been",
"set",
"."
] | [
"func",
"(",
"g",
"*",
"GraphDefinitionMarker",
")",
"GetValOk",
"(",
")",
"(",
"json",
".",
"Number",
",",
"bool",
")",
"{",
"if",
"g",
"==",
"nil",
"||",
"g",
".",
"Val",
"==",
"nil",
"{",
"return",
"\"",
"\"",
",",
"<mask>",
"\n",
"}",
"\n",
"return",
"*",
"g",
".",
"Val",
",",
"true",
"\n",
"}"
] |
1,164 | all-1165 | [
"Returns",
"the",
"default",
"value",
"of",
"a",
"type",
".",
"For",
"a",
"time",
"type",
"or",
"a",
"pointer",
"(",
"s",
")",
"to",
"time",
"the",
"default",
"value",
"is",
"not",
"zero",
"(",
"or",
"nil",
")",
"but",
"the",
"time",
"value",
"of",
"1970",
"."
] | [
"func",
"defaultValue",
"(",
"rt",
"reflect",
".",
"Type",
")",
"(",
"rv",
"reflect",
".",
"<mask>",
")",
"{",
"switch",
"rt",
".",
"Kind",
"(",
")",
"{",
"case",
"reflect",
".",
"Ptr",
":",
"// Dereference all the way and see if it's a time type.",
"rt_",
":=",
"rt",
".",
"Elem",
"(",
")",
"\n",
"for",
"rt_",
".",
"Kind",
"(",
")",
"==",
"reflect",
".",
"Ptr",
"{",
"rt_",
"=",
"rt_",
".",
"Elem",
"(",
")",
"\n",
"}",
"\n",
"switch",
"rt_",
"{",
"case",
"timeType",
":",
"// Start from the top and construct pointers as needed.",
"rv",
"=",
"reflect",
".",
"New",
"(",
"rt",
")",
".",
"Elem",
"(",
")",
"\n",
"rt_",
",",
"rv_",
":=",
"rt",
",",
"rv",
"\n",
"for",
"rt_",
".",
"Kind",
"(",
")",
"==",
"reflect",
".",
"Ptr",
"{",
"newPtr",
":=",
"reflect",
".",
"New",
"(",
"rt_",
".",
"Elem",
"(",
")",
")",
"\n",
"rv_",
".",
"Set",
"(",
"newPtr",
")",
"\n",
"rt_",
"=",
"rt_",
".",
"Elem",
"(",
")",
"\n",
"rv_",
"=",
"rv_",
".",
"Elem",
"(",
")",
"\n",
"}",
"\n",
"// Set to 1970, the whole point of this function.",
"rv_",
".",
"Set",
"(",
"reflect",
".",
"ValueOf",
"(",
"zeroTime",
")",
")",
"\n",
"return",
"rv",
"\n",
"}",
"\n",
"case",
"reflect",
".",
"Struct",
":",
"switch",
"rt",
"{",
"case",
"timeType",
":",
"// Set to 1970, the whole point of this function.",
"rv",
"=",
"reflect",
".",
"New",
"(",
"rt",
")",
".",
"Elem",
"(",
")",
"\n",
"rv",
".",
"Set",
"(",
"reflect",
".",
"ValueOf",
"(",
"zeroTime",
")",
")",
"\n",
"return",
"rv",
"\n",
"}",
"\n",
"}",
"\n\n",
"// Just return the default Go zero object.",
"// Return an empty struct.",
"return",
"reflect",
".",
"Zero",
"(",
"rt",
")",
"\n",
"}"
] |
1,165 | all-1166 | [
"AssertTruef",
"is",
"AssertTrue",
"with",
"extra",
"info",
"."
] | [
"func",
"AssertTruef",
"(",
"b",
"bool",
",",
"format",
"string",
",",
"args",
"...",
"interface",
"{",
"}",
")",
"{",
"if",
"!",
"b",
"{",
"log",
".",
"Fatalf",
"(",
"\"",
"\"",
",",
"errors",
".",
"Errorf",
"(",
"<mask>",
",",
"args",
"...",
")",
")",
"\n",
"}",
"\n",
"}"
] |
1,166 | all-1167 | [
"MarkPartitionOffset",
"stashes",
"the",
"offset",
"for",
"the",
"provided",
"topic",
"/",
"partition",
"combination"
] | [
"func",
"(",
"s",
"*",
"OffsetStash",
")",
"MarkPartitionOffset",
"(",
"topic",
"string",
",",
"partition",
"int32",
",",
"offset",
"int64",
",",
"metadata",
"string",
")",
"{",
"s",
".",
"mu",
".",
"Lock",
"(",
")",
"\n",
"defer",
"s",
".",
"mu",
".",
"Unlock",
"(",
")",
"\n\n",
"key",
":=",
"topicPartition",
"{",
"Topic",
":",
"topic",
",",
"Partition",
":",
"partition",
"}",
"\n",
"if",
"info",
":=",
"s",
".",
"offsets",
"[",
"key",
"]",
";",
"<mask>",
">=",
"info",
".",
"Offset",
"{",
"info",
".",
"Offset",
"=",
"offset",
"\n",
"info",
".",
"Metadata",
"=",
"metadata",
"\n",
"s",
".",
"offsets",
"[",
"key",
"]",
"=",
"info",
"\n",
"}",
"\n",
"}"
] |
1,167 | all-1168 | [
"SetUseUnderline",
"is",
"a",
"wrapper",
"around",
"gtk_label_set_use_underline",
"()",
"."
] | [
"func",
"(",
"v",
"*",
"<mask>",
")",
"SetUseUnderline",
"(",
"use",
"bool",
")",
"{",
"C",
".",
"gtk_label_set_use_underline",
"(",
"v",
".",
"native",
"(",
")",
",",
"gbool",
"(",
"use",
")",
")",
"\n",
"}"
] |
1,168 | all-1169 | [
"GetOverwriteMode",
"()",
"is",
"a",
"wrapper",
"around",
"gtk_entry_get_overwrite_mode",
"()",
"."
] | [
"func",
"(",
"v",
"*",
"<mask>",
")",
"GetOverwriteMode",
"(",
")",
"bool",
"{",
"c",
":=",
"C",
".",
"gtk_entry_get_overwrite_mode",
"(",
"v",
".",
"native",
"(",
")",
")",
"\n",
"return",
"gobool",
"(",
"c",
")",
"\n",
"}"
] |
1,169 | all-1170 | [
"Private",
"stuff",
"."
] | [
"func",
"parseDump",
"(",
"r",
"io",
".",
"Reader",
",",
"out",
"io",
".",
"Writer",
")",
"(",
"[",
"]",
"*",
"Goroutine",
",",
"error",
")",
"{",
"scanner",
":=",
"bufio",
".",
"NewScanner",
"(",
"r",
")",
"\n",
"scanner",
".",
"Split",
"(",
"scanLines",
")",
"\n",
"s",
":=",
"scanningState",
"{",
"}",
"\n",
"for",
"scanner",
".",
"Scan",
"(",
")",
"{",
"<mask>",
",",
"err",
":=",
"s",
".",
"scan",
"(",
"scanner",
".",
"Text",
"(",
")",
")",
"\n",
"if",
"line",
"!=",
"\"",
"\"",
"{",
"_",
",",
"_",
"=",
"io",
".",
"WriteString",
"(",
"out",
",",
"line",
")",
"\n",
"}",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"s",
".",
"goroutines",
",",
"err",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"s",
".",
"goroutines",
",",
"scanner",
".",
"Err",
"(",
")",
"\n",
"}"
] |
1,170 | all-1171 | [
"Info",
"returns",
"the",
"server",
"s",
"configuration",
"/",
"host",
"information",
"."
] | [
"func",
"(",
"c",
"*",
"<mask>",
")",
"Info",
"(",
")",
"(",
"Info",
",",
"error",
")",
"{",
"span",
":=",
"c",
".",
"tracer",
".",
"StartSpan",
"(",
"\"",
"\"",
")",
"\n",
"defer",
"span",
".",
"Finish",
"(",
")",
"\n\n",
"_",
",",
"data",
",",
"err",
":=",
"c",
".",
"httpRequest",
"(",
"\"",
"\"",
",",
"\"",
"\"",
",",
"nil",
",",
"nil",
",",
"false",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"Info",
"{",
"}",
",",
"errors",
".",
"Wrap",
"(",
"err",
",",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"info",
":=",
"Info",
"{",
"}",
"\n",
"err",
"=",
"json",
".",
"Unmarshal",
"(",
"data",
",",
"&",
"info",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"Info",
"{",
"}",
",",
"errors",
".",
"Wrap",
"(",
"err",
",",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"return",
"info",
",",
"nil",
"\n",
"}"
] |
1,171 | all-1172 | [
"manifestLayerInfosToBlobInfos",
"extracts",
"a",
"[]",
"types",
".",
"BlobInfo",
"from",
"a",
"[]",
"manifest",
".",
"LayerInfo",
"."
] | [
"func",
"manifestLayerInfosToBlobInfos",
"(",
"layers",
"[",
"]",
"manifest",
".",
"LayerInfo",
")",
"[",
"]",
"types",
".",
"BlobInfo",
"{",
"blobs",
":=",
"make",
"(",
"[",
"]",
"types",
".",
"BlobInfo",
",",
"len",
"(",
"layers",
")",
")",
"\n",
"for",
"i",
",",
"layer",
":=",
"<mask>",
"layers",
"{",
"blobs",
"[",
"i",
"]",
"=",
"layer",
".",
"BlobInfo",
"\n",
"}",
"\n",
"return",
"blobs",
"\n",
"}"
] |
1,172 | all-1173 | [
"ToURL",
"converts",
"the",
"given",
"folder",
"to",
"an",
"URL"
] | [
"func",
"ToURL",
"(",
"folder",
"string",
")",
"string",
"{",
"result",
":=",
"folder",
"\n",
"for",
"_",
",",
"<mask>",
":=",
"range",
"replaces",
"{",
"result",
"=",
"strings",
".",
"Replace",
"(",
"result",
",",
"replace",
".",
"b",
",",
"replace",
".",
"a",
",",
"-",
"1",
")",
"\n",
"}",
"\n",
"return",
"result",
"\n",
"}"
] |
1,173 | all-1174 | [
"Serve",
"serves",
"stuff",
"."
] | [
"func",
"Serve",
"(",
"servers",
"...",
"ServerOptions",
",",
")",
"(",
"retErr",
"error",
")",
"{",
"for",
"_",
",",
"server",
":=",
"range",
"servers",
"{",
"if",
"server",
".",
"RegisterFunc",
"==",
"nil",
"{",
"return",
"ErrMustSpecifyRegisterFunc",
"\n",
"}",
"\n",
"if",
"server",
".",
"Port",
"==",
"0",
"{",
"return",
"ErrMustSpecifyPort",
"\n",
"}",
"\n",
"opts",
":=",
"[",
"]",
"grpc",
".",
"ServerOption",
"{",
"grpc",
".",
"MaxConcurrentStreams",
"(",
"math",
".",
"MaxUint32",
")",
",",
"grpc",
".",
"MaxRecvMsgSize",
"(",
"server",
".",
"MaxMsgSize",
")",
",",
"grpc",
".",
"MaxSendMsgSize",
"(",
"<mask>",
".",
"MaxMsgSize",
")",
",",
"grpc",
".",
"KeepaliveEnforcementPolicy",
"(",
"keepalive",
".",
"EnforcementPolicy",
"{",
"MinTime",
":",
"5",
"*",
"time",
".",
"Second",
",",
"PermitWithoutStream",
":",
"true",
",",
"}",
")",
",",
"grpc",
".",
"UnaryInterceptor",
"(",
"tracing",
".",
"UnaryServerInterceptor",
"(",
")",
")",
",",
"grpc",
".",
"StreamInterceptor",
"(",
"tracing",
".",
"StreamServerInterceptor",
"(",
")",
")",
",",
"}",
"\n",
"if",
"server",
".",
"PublicPortTLSAllowed",
"{",
"// Validate environment",
"certPath",
":=",
"path",
".",
"Join",
"(",
"TLSVolumePath",
",",
"TLSCertFile",
")",
"\n",
"keyPath",
":=",
"path",
".",
"Join",
"(",
"TLSVolumePath",
",",
"TLSKeyFile",
")",
"\n",
"_",
",",
"certPathStatErr",
":=",
"os",
".",
"Stat",
"(",
"certPath",
")",
"\n",
"_",
",",
"keyPathStatErr",
":=",
"os",
".",
"Stat",
"(",
"keyPath",
")",
"\n",
"if",
"certPathStatErr",
"!=",
"nil",
"{",
"log",
".",
"Warnf",
"(",
"\"",
"\"",
",",
"certPath",
",",
"certPathStatErr",
")",
"\n",
"}",
"\n",
"if",
"keyPathStatErr",
"!=",
"nil",
"{",
"log",
".",
"Warnf",
"(",
"\"",
"\"",
",",
"keyPath",
",",
"keyPathStatErr",
")",
"\n",
"}",
"\n",
"if",
"certPathStatErr",
"==",
"nil",
"&&",
"keyPathStatErr",
"==",
"nil",
"{",
"// Read TLS cert and key",
"transportCreds",
",",
"err",
":=",
"credentials",
".",
"NewServerTLSFromFile",
"(",
"certPath",
",",
"keyPath",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"}",
"\n",
"opts",
"=",
"append",
"(",
"opts",
",",
"grpc",
".",
"Creds",
"(",
"transportCreds",
")",
")",
"\n",
"}",
"\n",
"}",
"\n\n",
"grpcServer",
":=",
"grpc",
".",
"NewServer",
"(",
"opts",
"...",
")",
"\n",
"if",
"err",
":=",
"server",
".",
"RegisterFunc",
"(",
"grpcServer",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"listener",
",",
"err",
":=",
"net",
".",
"Listen",
"(",
"\"",
"\"",
",",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"server",
".",
"Port",
")",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"if",
"server",
".",
"Cancel",
"!=",
"nil",
"{",
"go",
"func",
"(",
")",
"{",
"<-",
"server",
".",
"Cancel",
"\n",
"if",
"err",
":=",
"listener",
".",
"Close",
"(",
")",
";",
"err",
"!=",
"nil",
"{",
"fmt",
".",
"Printf",
"(",
"\"",
"\\n",
"\"",
",",
"err",
")",
"\n",
"}",
"\n",
"}",
"(",
")",
"\n",
"}",
"\n",
"if",
"err",
":=",
"grpcServer",
".",
"Serve",
"(",
"listener",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
] |
1,174 | all-1175 | [
"ReadConfig",
"..."
] | [
"func",
"ReadConfig",
"(",
"filename",
"string",
")",
"(",
"*",
"Config",
",",
"error",
")",
"{",
"cfg",
":=",
"NewConfig",
"(",
")",
"\n",
"if",
"filename",
"!=",
"\"",
"\"",
"{",
"b",
",",
"err",
":=",
"ioutil",
".",
"ReadFile",
"(",
"filename",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"body",
":=",
"string",
"(",
"b",
")",
"\n\n",
"// @TODO: fix for config starts with [logging]",
"body",
"=",
"strings",
".",
"Replace",
"(",
"body",
",",
"\"",
"\\n",
"\\n",
"\"",
",",
"\"",
"\\n",
"\\n",
"\"",
",",
"-",
"1",
")",
"\n\n",
"if",
"_",
",",
"err",
":=",
"toml",
".",
"Decode",
"(",
"body",
",",
"cfg",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"}",
"\n\n",
"if",
"cfg",
".",
"Logging",
"==",
"nil",
"{",
"cfg",
".",
"Logging",
"=",
"<mask>",
"(",
"[",
"]",
"zapwriter",
".",
"Config",
",",
"0",
")",
"\n",
"}",
"\n\n",
"if",
"cfg",
".",
"Common",
".",
"LogLevel",
"!=",
"nil",
"||",
"cfg",
".",
"Common",
".",
"Logfile",
"!=",
"nil",
"{",
"log",
".",
"Println",
"(",
"\"",
"\"",
")",
"\n\n",
"l",
":=",
"NewLoggingConfig",
"(",
")",
"\n",
"if",
"cfg",
".",
"Common",
".",
"Logfile",
"!=",
"nil",
"{",
"l",
".",
"File",
"=",
"*",
"cfg",
".",
"Common",
".",
"Logfile",
"\n",
"}",
"\n",
"if",
"cfg",
".",
"Common",
".",
"LogLevel",
"!=",
"nil",
"{",
"l",
".",
"Level",
"=",
"*",
"cfg",
".",
"Common",
".",
"LogLevel",
"\n",
"}",
"\n\n",
"cfg",
".",
"Logging",
"=",
"[",
"]",
"zapwriter",
".",
"Config",
"{",
"l",
"}",
"\n",
"}",
"\n\n",
"if",
"len",
"(",
"cfg",
".",
"Logging",
")",
"==",
"0",
"{",
"cfg",
".",
"Logging",
"=",
"append",
"(",
"cfg",
".",
"Logging",
",",
"NewLoggingConfig",
"(",
")",
")",
"\n",
"}",
"\n\n",
"if",
"err",
":=",
"zapwriter",
".",
"CheckConfig",
"(",
"cfg",
".",
"Logging",
",",
"nil",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"return",
"cfg",
",",
"nil",
"\n",
"}"
] |
1,175 | all-1176 | [
"GetTags",
"returns",
"the",
"Tags",
"field",
"if",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"."
] | [
"func",
"(",
"r",
"*",
"reqGetTags",
")",
"GetTags",
"(",
")",
"TagMap",
"{",
"if",
"r",
"==",
"nil",
"||",
"r",
".",
"Tags",
"==",
"nil",
"{",
"return",
"TagMap",
"{",
"}",
"\n",
"}",
"\n",
"<mask>",
"*",
"r",
".",
"Tags",
"\n",
"}"
] |
1,176 | all-1177 | [
"GetType",
"returns",
"the",
"Type",
"field",
"if",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"."
] | [
"func",
"(",
"t",
"*",
"TimeseriesDefinition",
")",
"GetType",
"(",
")",
"string",
"{",
"if",
"t",
"==",
"nil",
"||",
"t",
".",
"Type",
"==",
"nil",
"{",
"return",
"\"",
"\"",
"\n",
"}",
"\n",
"return",
"*",
"t",
".",
"<mask>",
"\n",
"}"
] |
1,177 | all-1178 | [
"RespondResult",
"sends",
"a",
"response",
"with",
"a",
"given",
"result",
"."
] | [
"func",
"(",
"s",
"*",
"<mask>",
")",
"RespondResult",
"(",
"logger",
"log",
".",
"Logger",
",",
"w",
"http",
".",
"ResponseWriter",
",",
"result",
"interface",
"{",
"}",
")",
"{",
"logger",
"=",
"logger",
".",
"Add",
"(",
"\"",
"\"",
",",
"result",
")",
"\n",
"data",
",",
"err",
":=",
"json",
".",
"Marshal",
"(",
"result",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"logger",
".",
"Error",
"(",
"\"",
"\"",
"+",
"err",
".",
"Error",
"(",
")",
")",
"\n",
"s",
".",
"RespondError",
"(",
"logger",
",",
"w",
",",
"ErrInternalServerError",
")",
"\n",
"return",
"\n",
"}",
"\n\n",
"s",
".",
"respond",
"(",
"logger",
",",
"w",
",",
"&",
"Response",
"{",
"Result",
":",
"data",
"}",
")",
"\n",
"}"
] |
1,178 | all-1179 | [
"Int32",
"returns",
"the",
"int32",
"value",
"stored",
"in",
"r",
".",
"r",
"must",
"have",
"type",
"int32",
"."
] | [
"func",
"(",
"r",
"<mask>",
")",
"Int32",
"(",
")",
"int32",
"{",
"if",
"r",
".",
"typ",
".",
"Kind",
"!=",
"KindInt",
"||",
"r",
".",
"typ",
".",
"Size",
"!=",
"4",
"{",
"panic",
"(",
"\"",
"\"",
"+",
"r",
".",
"typ",
".",
"Name",
")",
"\n",
"}",
"\n",
"return",
"r",
".",
"p",
".",
"proc",
".",
"ReadInt32",
"(",
"r",
".",
"a",
")",
"\n",
"}"
] |
1,179 | all-1180 | [
"Attribute",
"returns",
"an",
"attribute",
"value",
"for",
"exactly",
"one",
"element",
"."
] | [
"func",
"(",
"s",
"*",
"Selection",
")",
"Attribute",
"(",
"attribute",
"string",
")",
"(",
"string",
",",
"error",
")",
"{",
"return",
"s",
".",
"hasProperty",
"(",
"<mask>",
".",
"Element",
".",
"GetAttribute",
",",
"attribute",
",",
"\"",
"\"",
")",
"\n",
"}"
] |
1,180 | all-1181 | [
"retrieve",
"the",
"location",
"of",
"a",
"sample"
] | [
"func",
"GetMultisamplefv",
"(",
"pname",
"uint32",
",",
"<mask>",
"uint32",
",",
"val",
"*",
"float32",
")",
"{",
"syscall",
".",
"Syscall",
"(",
"gpGetMultisamplefv",
",",
"3",
",",
"uintptr",
"(",
"pname",
")",
",",
"uintptr",
"(",
"index",
")",
",",
"uintptr",
"(",
"unsafe",
".",
"Pointer",
"(",
"val",
")",
")",
")",
"\n",
"}"
] |
1,181 | all-1182 | [
"PublishEventContext",
"publish",
"event",
"for",
"given",
"ctx",
"."
] | [
"func",
"PublishEventContext",
"(",
"ctx",
"<mask>",
".",
"Context",
",",
"eventName",
"string",
",",
"eventBody",
"interface",
"{",
"}",
")",
"{",
"pub",
":=",
"PublisherContext",
"(",
"ctx",
")",
"\n",
"if",
"pub",
"==",
"nil",
"{",
"return",
"\n",
"}",
"\n\n",
"pub",
".",
"Publish",
"(",
"eventName",
",",
"eventBody",
")",
"\n",
"}"
] |
1,182 | all-1183 | [
"Parse",
"parses",
"Set",
"-",
"Cookie",
"header",
"."
] | [
"func",
"(",
"c",
"*",
"Cookie",
")",
"Parse",
"(",
"src",
"string",
")",
"error",
"{",
"c",
".",
"buf",
"=",
"<mask>",
"(",
"c",
".",
"buf",
"[",
":",
"0",
"]",
",",
"src",
"...",
")",
"\n",
"return",
"c",
".",
"ParseBytes",
"(",
"c",
".",
"buf",
")",
"\n",
"}"
] |
1,183 | all-1184 | [
"ResourcePool",
"is",
"a",
"convenience",
"method",
"that",
"wraps",
"fetching",
"the",
"host",
"system",
"s",
"root",
"resource",
"pool"
] | [
"func",
"ResourcePool",
"(",
"host",
"*",
"object",
".",
"HostSystem",
")",
"(",
"*",
"<mask>",
".",
"ResourcePool",
",",
"error",
")",
"{",
"ctx",
",",
"cancel",
":=",
"context",
".",
"WithTimeout",
"(",
"context",
".",
"Background",
"(",
")",
",",
"provider",
".",
"DefaultAPITimeout",
")",
"\n",
"defer",
"cancel",
"(",
")",
"\n",
"return",
"host",
".",
"ResourcePool",
"(",
"ctx",
")",
"\n",
"}"
] |
1,184 | all-1185 | [
"Timeout",
"returns",
"the",
"timeout",
"of",
"the",
"connector",
"."
] | [
"func",
"(",
"c",
"*",
"Connector",
")",
"Timeout",
"(",
")",
"int",
"{",
"c",
".",
"mu",
".",
"RLock",
"(",
")",
"\n",
"defer",
"c",
".",
"mu",
".",
"RUnlock",
"(",
")",
"\n",
"<mask>",
"c",
".",
"timeout",
"\n",
"}"
] |
1,185 | all-1186 | [
"NetworkGatewayLocator",
"builds",
"a",
"locator",
"from",
"the",
"given",
"href",
"."
] | [
"func",
"(",
"api",
"*",
"API",
")",
"NetworkGatewayLocator",
"(",
"href",
"<mask>",
")",
"*",
"NetworkGatewayLocator",
"{",
"return",
"&",
"NetworkGatewayLocator",
"{",
"Href",
"(",
"href",
")",
",",
"api",
"}",
"\n",
"}"
] |
1,186 | all-1187 | [
"DeleteCertificate",
"removes",
"a",
"certificate",
"from",
"the",
"LXD",
"trust",
"store"
] | [
"func",
"(",
"r",
"*",
"ProtocolLXD",
")",
"DeleteCertificate",
"(",
"fingerprint",
"string",
")",
"error",
"{",
"// Send the request",
"_",
",",
"_",
",",
"err",
":=",
"r",
".",
"query",
"(",
"\"",
"\"",
",",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"<mask>",
".",
"QueryEscape",
"(",
"fingerprint",
")",
")",
",",
"nil",
",",
"\"",
"\"",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"return",
"nil",
"\n",
"}"
] |
1,187 | all-1188 | [
"Close",
"causes",
"currently",
"running",
"Process",
"()",
"function",
"to",
"exit",
"."
] | [
"func",
"(",
"q",
"*",
"queue",
")",
"Close",
"(",
")",
"{",
"q",
".",
"mtx",
".",
"Lock",
"(",
")",
"\n",
"defer",
"q",
".",
"mtx",
".",
"Unlock",
"(",
")",
"\n\n",
"if",
"q",
".",
"<mask>",
"==",
"nil",
"{",
"return",
"\n",
"}",
"\n\n",
"q",
".",
"exit",
"<-",
"struct",
"{",
"}",
"{",
"}",
"\n",
"<-",
"q",
".",
"exited",
"\n",
"}"
] |
1,188 | all-1189 | [
"flattenDVSContactInfo",
"reads",
"various",
"fields",
"from",
"a",
"DVSContactInfo",
"into",
"the",
"passed",
"in",
"ResourceData",
"."
] | [
"func",
"flattenDVSContactInfo",
"(",
"d",
"*",
"schema",
".",
"ResourceData",
",",
"obj",
"types",
".",
"DVSContactInfo",
")",
"error",
"{",
"d",
".",
"<mask>",
"(",
"\"",
"\"",
",",
"obj",
".",
"Name",
")",
"\n",
"d",
".",
"Set",
"(",
"\"",
"\"",
",",
"obj",
".",
"Contact",
")",
"\n",
"return",
"nil",
"\n",
"}"
] |
1,189 | all-1190 | [
"buildHistogram",
"builds",
"the",
"key",
"-",
"value",
"size",
"histogram",
".",
"When",
"keyPrefix",
"is",
"set",
"only",
"the",
"keys",
"that",
"have",
"prefix",
"keyPrefix",
"are",
"considered",
"for",
"creating",
"the",
"histogram"
] | [
"func",
"(",
"db",
"*",
"DB",
")",
"buildHistogram",
"(",
"keyPrefix",
"[",
"]",
"byte",
")",
"*",
"sizeHistogram",
"{",
"txn",
":=",
"<mask>",
".",
"NewTransaction",
"(",
"false",
")",
"\n",
"defer",
"txn",
".",
"Discard",
"(",
")",
"\n\n",
"itr",
":=",
"txn",
".",
"NewIterator",
"(",
"DefaultIteratorOptions",
")",
"\n",
"defer",
"itr",
".",
"Close",
"(",
")",
"\n\n",
"badgerHistogram",
":=",
"newSizeHistogram",
"(",
")",
"\n\n",
"// Collect key and value sizes.",
"for",
"itr",
".",
"Seek",
"(",
"keyPrefix",
")",
";",
"itr",
".",
"ValidForPrefix",
"(",
"keyPrefix",
")",
";",
"itr",
".",
"Next",
"(",
")",
"{",
"item",
":=",
"itr",
".",
"Item",
"(",
")",
"\n",
"badgerHistogram",
".",
"keySizeHistogram",
".",
"Update",
"(",
"item",
".",
"KeySize",
"(",
")",
")",
"\n",
"badgerHistogram",
".",
"valueSizeHistogram",
".",
"Update",
"(",
"item",
".",
"ValueSize",
"(",
")",
")",
"\n",
"}",
"\n",
"return",
"badgerHistogram",
"\n",
"}"
] |
1,190 | all-1191 | [
"Do",
"executes",
"DOM",
".",
"getContentQuads",
"against",
"the",
"provided",
"context",
".",
"returns",
":",
"quads",
"-",
"Quads",
"that",
"describe",
"node",
"layout",
"relative",
"to",
"viewport",
"."
] | [
"func",
"(",
"p",
"*",
"GetContentQuadsParams",
")",
"Do",
"(",
"ctx",
"context",
".",
"Context",
")",
"(",
"quads",
"[",
"]",
"Quad",
",",
"err",
"error",
")",
"{",
"// execute",
"<mask>",
"res",
"GetContentQuadsReturns",
"\n",
"err",
"=",
"cdp",
".",
"Execute",
"(",
"ctx",
",",
"CommandGetContentQuads",
",",
"p",
",",
"&",
"res",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"return",
"res",
".",
"Quads",
",",
"nil",
"\n",
"}"
] |
1,191 | all-1192 | [
"Do",
"executes",
"Page",
".",
"setDocumentContent",
"against",
"the",
"provided",
"context",
"."
] | [
"func",
"(",
"p",
"*",
"SetDocumentContentParams",
")",
"Do",
"(",
"ctx",
"<mask>",
".",
"Context",
")",
"(",
"err",
"error",
")",
"{",
"return",
"cdp",
".",
"Execute",
"(",
"ctx",
",",
"CommandSetDocumentContent",
",",
"p",
",",
"nil",
")",
"\n",
"}"
] |
1,192 | all-1193 | [
"NewMockECSSDK",
"creates",
"a",
"new",
"mock",
"instance"
] | [
"func",
"NewMockECSSDK",
"(",
"ctrl",
"*",
"gomock",
".",
"<mask>",
")",
"*",
"MockECSSDK",
"{",
"mock",
":=",
"&",
"MockECSSDK",
"{",
"ctrl",
":",
"ctrl",
"}",
"\n",
"mock",
".",
"recorder",
"=",
"&",
"MockECSSDKMockRecorder",
"{",
"mock",
"}",
"\n",
"return",
"mock",
"\n",
"}"
] |
1,193 | all-1194 | [
"Set",
"is",
"required",
"for",
"kingpin",
"interfaces",
"to",
"allow",
"command",
"line",
"params",
"to",
"be",
"set",
"to",
"our",
"map",
"datatype"
] | [
"func",
"(",
"o",
"*",
"MapComplex128Option",
")",
"Set",
"(",
"value",
"string",
")",
"error",
"{",
"parts",
":=",
"stringMapRegex",
".",
"Split",
"(",
"value",
",",
"2",
")",
"\n",
"if",
"len",
"(",
"parts",
")",
"!=",
"2",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"value",
")",
"\n",
"}",
"\n",
"val",
":=",
"Complex128Option",
"{",
"}",
"\n",
"val",
".",
"Set",
"(",
"<mask>",
"[",
"1",
"]",
")",
"\n",
"(",
"*",
"o",
")",
"[",
"parts",
"[",
"0",
"]",
"]",
"=",
"val",
"\n",
"return",
"nil",
"\n",
"}"
] |
1,194 | all-1195 | [
"Do",
"executes",
"Log",
".",
"startViolationsReport",
"against",
"the",
"provided",
"context",
"."
] | [
"func",
"(",
"p",
"*",
"StartViolationsReportParams",
")",
"Do",
"(",
"ctx",
"<mask>",
".",
"Context",
")",
"(",
"err",
"error",
")",
"{",
"return",
"cdp",
".",
"Execute",
"(",
"ctx",
",",
"CommandStartViolationsReport",
",",
"p",
",",
"nil",
")",
"\n",
"}"
] |
1,195 | all-1196 | [
"Reset",
"clears",
"response",
"contents",
"."
] | [
"func",
"(",
"resp",
"*",
"Response",
")",
"Reset",
"(",
")",
"{",
"resp",
".",
"Header",
".",
"Reset",
"(",
")",
"\n",
"resp",
".",
"resetSkipHeader",
"(",
")",
"\n",
"resp",
".",
"SkipBody",
"=",
"<mask>",
"\n",
"resp",
".",
"raddr",
"=",
"nil",
"\n",
"resp",
".",
"laddr",
"=",
"nil",
"\n",
"}"
] |
1,196 | all-1197 | [
"UnmarshalJSON",
"supports",
"json",
".",
"Unmarshaler",
"interface"
] | [
"func",
"(",
"v",
"*",
"RequestDatabaseNamesParams",
")",
"UnmarshalJSON",
"(",
"<mask>",
"[",
"]",
"byte",
")",
"error",
"{",
"r",
":=",
"jlexer",
".",
"Lexer",
"{",
"Data",
":",
"data",
"}",
"\n",
"easyjsonC5a4559bDecodeGithubComChromedpCdprotoIndexeddb3",
"(",
"&",
"r",
",",
"v",
")",
"\n",
"return",
"r",
".",
"Error",
"(",
")",
"\n",
"}"
] |
1,197 | all-1198 | [
"/",
"*",
"Private",
"methods"
] | [
"func",
"(",
"a",
"*",
"AddrBook",
")",
"saveRoutine",
"(",
")",
"{",
"dumpAddressTicker",
":=",
"time",
".",
"NewTicker",
"(",
"dumpAddressInterval",
")",
"\n",
"<mask>",
":",
"for",
"{",
"select",
"{",
"case",
"<-",
"dumpAddressTicker",
".",
"C",
":",
"a",
".",
"saveToFile",
"(",
"a",
".",
"filePath",
")",
"\n",
"case",
"<-",
"a",
".",
"Quit",
":",
"break",
"out",
"\n",
"}",
"\n",
"}",
"\n",
"dumpAddressTicker",
".",
"Stop",
"(",
")",
"\n",
"a",
".",
"saveToFile",
"(",
"a",
".",
"filePath",
")",
"\n",
"a",
".",
"wg",
".",
"Done",
"(",
")",
"\n",
"log",
".",
"Notice",
"(",
"\"",
"\"",
")",
"\n",
"}"
] |
1,198 | all-1199 | [
"PeekPayloadField",
"extracts",
"the",
"specified",
"field",
"from",
"the",
"serialized",
"JWT",
"buf",
"s",
"payload",
"(",
"ie",
"the",
"token",
"claims",
")",
".",
"An",
"error",
"will",
"be",
"returned",
"if",
"the",
"field",
"is",
"not",
"present",
"in",
"the",
"decoded",
"payload",
"."
] | [
"func",
"PeekPayloadField",
"(",
"buf",
"[",
"]",
"<mask>",
",",
"field",
"string",
")",
"(",
"string",
",",
"error",
")",
"{",
"return",
"peekField",
"(",
"buf",
",",
"field",
",",
"tokenPositionPayload",
")",
"\n",
"}"
] |
1,199 | all-1200 | [
"GetValue",
"returns",
"the",
"Value",
"field",
"if",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"."
] | [
"func",
"(",
"w",
"*",
"WidgetMarker",
")",
"GetValue",
"(",
")",
"string",
"{",
"if",
"w",
"==",
"nil",
"||",
"w",
".",
"<mask>",
"==",
"nil",
"{",
"return",
"\"",
"\"",
"\n",
"}",
"\n",
"return",
"*",
"w",
".",
"Value",
"\n",
"}"
] |
Subsets and Splits