id
int32 0
25.3k
| idx
stringlengths 5
9
| nl_tokens
sequencelengths 1
418
| pl_tokens
sequencelengths 22
4.98k
|
---|---|---|---|
14,500 | all-14501 | [
"SetGUISettings",
"sets",
"gui",
"settings",
"."
] | [
"func",
"(",
"h",
"*",
"Handler",
")",
"SetGUISettings",
"(",
"tkn",
"string",
",",
"v",
"map",
"[",
"string",
"]",
"interface",
"{",
"}",
")",
"error",
"{",
"logger",
":=",
"h",
".",
"logger",
".",
"Add",
"(",
"\"",
"\"",
",",
"\"",
"\"",
")",
"\n\n",
"if",
"!",
"h",
".",
"token",
".",
"Check",
"(",
"tkn",
")",
"{",
"logger",
".",
"Warn",
"(",
"\"",
"\"",
")",
"\n",
"return",
"ErrAccessDenied",
"\n",
"}",
"\n\n",
"d",
",",
"err",
":=",
"json",
".",
"Marshal",
"(",
"&",
"v",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"logger",
".",
"Error",
"(",
"err",
".",
"Error",
"(",
")",
")",
"\n",
"return",
"ErrInternal",
"\n",
"}",
"\n\n",
"_",
",",
"err",
"=",
"h",
".",
"db",
".",
"Exec",
"(",
"`\n\t\tUPDATE settings \n\t\t SET value = $1\n\t\t WHERE key=$2`",
",",
"string",
"(",
"d",
")",
",",
"data",
".",
"SettingGUI",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"logger",
".",
"<mask>",
"(",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"err",
")",
")",
"\n",
"return",
"ErrInternal",
"\n",
"}",
"\n\n",
"return",
"nil",
"\n",
"}"
] |
14,501 | all-14502 | [
"Stop",
"-",
"signal",
"for",
"the",
"service",
"to",
"stop",
"serving"
] | [
"func",
"(",
"networkBus",
"*",
"NetworkBus",
")",
"Stop",
"(",
")",
"{",
"service",
":=",
"networkBus",
".",
"service",
"\n",
"if",
"service",
".",
"started",
"{",
"service",
".",
"wg",
".",
"Done",
"(",
")",
"\n",
"<mask>",
".",
"started",
"=",
"false",
"\n",
"}",
"\n",
"}"
] |
14,502 | all-14503 | [
"GetAuthorHandleOk",
"returns",
"a",
"tuple",
"with",
"the",
"AuthorHandle",
"field",
"if",
"it",
"s",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"and",
"a",
"boolean",
"to",
"check",
"if",
"the",
"value",
"has",
"been",
"set",
"."
] | [
"func",
"(",
"b",
"*",
"Board",
")",
"GetAuthorHandleOk",
"(",
")",
"(",
"string",
",",
"bool",
")",
"{",
"if",
"b",
"==",
"nil",
"||",
"b",
".",
"AuthorHandle",
"==",
"nil",
"{",
"return",
"\"",
"\"",
",",
"<mask>",
"\n",
"}",
"\n",
"return",
"*",
"b",
".",
"AuthorHandle",
",",
"true",
"\n",
"}"
] |
14,503 | all-14504 | [
"InstanceIdentityDocument",
"mocks",
"base",
"method"
] | [
"func",
"(",
"m",
"*",
"MockEC2MetadataClient",
")",
"InstanceIdentityDocument",
"(",
")",
"(",
"ec2metadata",
".",
"EC2InstanceIdentityDocument",
",",
"error",
")",
"{",
"<mask>",
":=",
"m",
".",
"ctrl",
".",
"Call",
"(",
"m",
",",
"\"",
"\"",
")",
"\n",
"ret0",
",",
"_",
":=",
"ret",
"[",
"0",
"]",
".",
"(",
"ec2metadata",
".",
"EC2InstanceIdentityDocument",
")",
"\n",
"ret1",
",",
"_",
":=",
"ret",
"[",
"1",
"]",
".",
"(",
"error",
")",
"\n",
"return",
"ret0",
",",
"ret1",
"\n",
"}"
] |
14,504 | all-14505 | [
"NetworkCert",
"returns",
"the",
"full",
"TLS",
"certificate",
"information",
"for",
"this",
"endpoint",
"."
] | [
"func",
"(",
"e",
"*",
"Endpoints",
")",
"NetworkCert",
"(",
")",
"*",
"shared",
".",
"CertInfo",
"{",
"e",
".",
"mu",
".",
"RLock",
"(",
")",
"\n",
"defer",
"e",
".",
"mu",
".",
"RUnlock",
"(",
")",
"\n\n",
"return",
"e",
".",
"<mask>",
"\n",
"}"
] |
14,505 | all-14506 | [
"SetSize",
"sets",
"the",
"new",
"Canvas",
"size",
".",
"If",
"new",
"size",
"does",
"not",
"equal",
"old",
"size",
"then",
"Canvas",
"is",
"recreated",
"and",
"cleared",
"with",
"default",
"colors",
".",
"Both",
"Canvas",
"width",
"and",
"height",
"must",
"be",
"greater",
"than",
"2"
] | [
"func",
"SetScreenSize",
"(",
"width",
"int",
",",
"height",
"int",
")",
"{",
"if",
"canvas",
".",
"width",
"==",
"width",
"&&",
"canvas",
".",
"<mask>",
"==",
"height",
"{",
"return",
"\n",
"}",
"\n\n",
"canvas",
".",
"width",
"=",
"width",
"\n",
"canvas",
".",
"height",
"=",
"height",
"\n\n",
"canvas",
".",
"clipStack",
"=",
"make",
"(",
"[",
"]",
"rect",
",",
"0",
")",
"\n",
"SetClipRect",
"(",
"0",
",",
"0",
",",
"width",
",",
"height",
")",
"\n",
"}"
] |
14,506 | all-14507 | [
"Read",
"reads",
"the",
"TELNET",
"escaped",
"data",
"from",
"the",
"wrapped",
"io",
".",
"Reader",
"and",
"un",
"-",
"escapes",
"it",
"into",
"data",
"."
] | [
"func",
"(",
"r",
"*",
"internalDataReader",
")",
"Read",
"(",
"data",
"[",
"]",
"byte",
")",
"(",
"n",
"int",
",",
"err",
"error",
")",
"{",
"const",
"IAC",
"=",
"255",
"\n\n",
"const",
"SB",
"=",
"250",
"\n",
"const",
"SE",
"=",
"240",
"\n\n",
"const",
"WILL",
"=",
"251",
"\n",
"const",
"WONT",
"=",
"252",
"\n",
"const",
"DO",
"=",
"253",
"\n",
"const",
"DONT",
"=",
"254",
"\n\n",
"p",
":=",
"data",
"\n\n",
"for",
"len",
"(",
"p",
")",
">",
"0",
"{",
"var",
"b",
"byte",
"\n\n",
"b",
",",
"err",
"=",
"r",
".",
"buffered",
".",
"ReadByte",
"(",
")",
"\n",
"if",
"nil",
"!=",
"err",
"{",
"return",
"n",
",",
"err",
"\n",
"}",
"\n\n",
"if",
"IAC",
"==",
"b",
"{",
"var",
"peeked",
"[",
"]",
"byte",
"\n\n",
"peeked",
",",
"err",
"=",
"r",
".",
"buffered",
".",
"Peek",
"(",
"1",
")",
"\n",
"if",
"nil",
"!=",
"err",
"{",
"return",
"n",
",",
"err",
"\n",
"}",
"\n\n",
"switch",
"peeked",
"[",
"0",
"]",
"{",
"case",
"WILL",
",",
"WONT",
",",
"DO",
",",
"DONT",
":",
"_",
",",
"err",
"=",
"r",
".",
"buffered",
".",
"Discard",
"(",
"2",
")",
"\n",
"if",
"nil",
"!=",
"err",
"{",
"return",
"n",
",",
"err",
"\n",
"}",
"\n",
"case",
"IAC",
":",
"p",
"[",
"0",
"]",
"=",
"IAC",
"\n",
"n",
"++",
"\n",
"p",
"=",
"p",
"[",
"1",
":",
"]",
"\n\n",
"_",
",",
"err",
"=",
"r",
".",
"buffered",
".",
"Discard",
"(",
"1",
")",
"\n",
"if",
"nil",
"!=",
"err",
"{",
"return",
"n",
",",
"err",
"\n",
"}",
"\n",
"case",
"SB",
":",
"for",
"{",
"var",
"b2",
"byte",
"\n",
"b2",
",",
"err",
"=",
"r",
".",
"buffered",
".",
"ReadByte",
"(",
")",
"\n",
"if",
"nil",
"!=",
"err",
"{",
"return",
"n",
",",
"err",
"\n",
"}",
"\n\n",
"if",
"IAC",
"==",
"b2",
"{",
"peeked",
",",
"err",
"=",
"r",
".",
"buffered",
".",
"Peek",
"(",
"1",
")",
"\n",
"if",
"nil",
"!=",
"err",
"{",
"return",
"n",
",",
"err",
"\n",
"}",
"\n\n",
"if",
"IAC",
"==",
"peeked",
"[",
"0",
"]",
"{",
"_",
",",
"err",
"=",
"r",
".",
"buffered",
".",
"Discard",
"(",
"1",
")",
"\n",
"if",
"nil",
"!=",
"err",
"{",
"return",
"n",
",",
"err",
"\n",
"}",
"\n",
"}",
"\n\n",
"if",
"SE",
"==",
"peeked",
"[",
"0",
"]",
"{",
"_",
",",
"err",
"=",
"r",
".",
"buffered",
".",
"Discard",
"(",
"1",
")",
"\n",
"if",
"nil",
"!=",
"err",
"{",
"return",
"n",
",",
"err",
"\n",
"}",
"\n",
"<mask>",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n",
"case",
"SE",
":",
"_",
",",
"err",
"=",
"r",
".",
"buffered",
".",
"Discard",
"(",
"1",
")",
"\n",
"if",
"nil",
"!=",
"err",
"{",
"return",
"n",
",",
"err",
"\n",
"}",
"\n",
"default",
":",
"// If we get in here, this is not following the TELNET protocol.",
"//@TODO: Make a better error.",
"err",
"=",
"errCorrupted",
"\n",
"return",
"n",
",",
"err",
"\n",
"}",
"\n",
"}",
"else",
"{",
"p",
"[",
"0",
"]",
"=",
"b",
"\n",
"n",
"++",
"\n",
"p",
"=",
"p",
"[",
"1",
":",
"]",
"\n",
"}",
"\n",
"}",
"\n\n",
"return",
"n",
",",
"nil",
"\n",
"}"
] |
14,507 | all-14508 | [
"DelBytes",
"deletes",
"header",
"with",
"the",
"given",
"key",
"."
] | [
"func",
"(",
"h",
"*",
"RequestHeader",
")",
"DelBytes",
"(",
"key",
"[",
"]",
"byte",
")",
"{",
"h",
".",
"parseRawHeaders",
"(",
")",
"\n",
"h",
".",
"bufKV",
".",
"key",
"=",
"append",
"(",
"h",
".",
"bufKV",
".",
"key",
"[",
":",
"0",
"]",
",",
"key",
"...",
")",
"\n",
"normalizeHeaderKey",
"(",
"h",
".",
"bufKV",
".",
"key",
",",
"h",
".",
"disableNormalizing",
")",
"\n",
"h",
".",
"del",
"(",
"h",
".",
"bufKV",
".",
"<mask>",
")",
"\n",
"}"
] |
14,508 | all-14509 | [
"Error",
"outputs",
"Error",
"log"
] | [
"func",
"<mask>",
"(",
"val",
"...",
"interface",
"{",
"}",
")",
"error",
"{",
"return",
"glg",
".",
"out",
"(",
"ERR",
",",
"blankFormat",
"(",
"len",
"(",
"val",
")",
")",
",",
"val",
"...",
")",
"\n",
"}"
] |
14,509 | all-14510 | [
"Send",
"encodes",
"the",
"message",
"and",
"sends",
"it",
"via",
"the",
"SMTP",
"server",
"specified",
"by",
"addr",
".",
"Send",
"uses",
"net",
"/",
"smtp",
".",
"SendMail",
"and",
"accepts",
"the",
"same",
"authentication",
"parameters",
"."
] | [
"func",
"(",
"p",
"MailBuilder",
")",
"Send",
"(",
"addr",
"string",
",",
"a",
"smtp",
".",
"Auth",
")",
"error",
"{",
"buf",
":=",
"&",
"bytes",
".",
"Buffer",
"{",
"}",
"\n",
"root",
",",
"err",
":=",
"p",
".",
"Build",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"err",
"=",
"root",
".",
"Encode",
"(",
"buf",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"recips",
":=",
"make",
"(",
"[",
"]",
"string",
",",
"0",
",",
"len",
"(",
"p",
".",
"to",
")",
"+",
"len",
"(",
"p",
".",
"cc",
")",
"+",
"len",
"(",
"p",
".",
"bcc",
")",
")",
"\n",
"for",
"_",
",",
"a",
":=",
"<mask>",
"p",
".",
"to",
"{",
"recips",
"=",
"append",
"(",
"recips",
",",
"a",
".",
"Address",
")",
"\n",
"}",
"\n",
"for",
"_",
",",
"a",
":=",
"range",
"p",
".",
"cc",
"{",
"recips",
"=",
"append",
"(",
"recips",
",",
"a",
".",
"Address",
")",
"\n",
"}",
"\n",
"for",
"_",
",",
"a",
":=",
"range",
"p",
".",
"bcc",
"{",
"recips",
"=",
"append",
"(",
"recips",
",",
"a",
".",
"Address",
")",
"\n",
"}",
"\n",
"return",
"smtp",
".",
"SendMail",
"(",
"addr",
",",
"a",
",",
"p",
".",
"from",
".",
"Address",
",",
"recips",
",",
"buf",
".",
"Bytes",
"(",
")",
")",
"\n",
"}"
] |
14,510 | all-14511 | [
"When",
"pulling",
"an",
"image",
"the",
"docker",
"api",
"will",
"pull",
"and",
"then",
"subsequently",
"unzip",
"the",
"downloaded",
"artifacts",
".",
"Docker",
"does",
"not",
"separate",
"the",
"pull",
"from",
"the",
"unpack",
"step",
".",
"What",
"this",
"means",
"is",
"that",
"this",
"timeout",
"doesn",
"t",
"tick",
"while",
"unpacking",
"the",
"downloaded",
"files",
".",
"This",
"only",
"causes",
"noticeable",
"impact",
"with",
"large",
"files",
"but",
"we",
"should",
"investigate",
"improving",
"this",
"."
] | [
"func",
"handleInactivityTimeout",
"(",
"reader",
"io",
".",
"ReadCloser",
",",
"timeout",
"<mask>",
".",
"Duration",
",",
"cancelRequest",
"func",
"(",
")",
",",
"canceled",
"*",
"uint32",
")",
"(",
"io",
".",
"ReadCloser",
",",
"chan",
"<-",
"struct",
"{",
"}",
")",
"{",
"done",
":=",
"make",
"(",
"chan",
"struct",
"{",
"}",
")",
"\n",
"proxyReader",
":=",
"&",
"proxyReader",
"{",
"ReadCloser",
":",
"reader",
"}",
"\n",
"go",
"func",
"(",
")",
"{",
"var",
"lastCallCount",
"uint64",
"\n",
"for",
"{",
"select",
"{",
"case",
"<-",
"time",
".",
"After",
"(",
"timeout",
")",
":",
"case",
"<-",
"done",
":",
"return",
"\n",
"}",
"\n",
"curCallCount",
":=",
"proxyReader",
".",
"callCount",
"(",
")",
"\n",
"if",
"curCallCount",
"==",
"lastCallCount",
"{",
"atomic",
".",
"AddUint32",
"(",
"canceled",
",",
"1",
")",
"\n",
"cancelRequest",
"(",
")",
"\n",
"return",
"\n",
"}",
"\n",
"lastCallCount",
"=",
"curCallCount",
"\n",
"}",
"\n",
"}",
"(",
")",
"\n",
"return",
"proxyReader",
",",
"done",
"\n",
"}"
] |
14,511 | all-14512 | [
"configureTeam",
"patches",
"the",
"team",
"name",
"/",
"description",
"/",
"privacy",
"when",
"values",
"differ"
] | [
"func",
"configureTeam",
"(",
"client",
"editTeamClient",
",",
"orgName",
",",
"teamName",
"string",
",",
"team",
"org",
".",
"Team",
",",
"gt",
"github",
".",
"Team",
",",
"parent",
"*",
"int",
")",
"error",
"{",
"// Do we need to reconfigure any team settings?",
"patch",
":=",
"false",
"\n",
"if",
"gt",
".",
"Name",
"!=",
"teamName",
"{",
"patch",
"=",
"true",
"\n",
"}",
"\n",
"gt",
".",
"Name",
"=",
"teamName",
"\n",
"if",
"team",
".",
"Description",
"!=",
"nil",
"&&",
"gt",
".",
"Description",
"!=",
"*",
"team",
".",
"Description",
"{",
"patch",
"=",
"true",
"\n",
"gt",
".",
"Description",
"=",
"*",
"team",
".",
"Description",
"\n",
"}",
"else",
"{",
"gt",
".",
"Description",
"=",
"\"",
"\"",
"\n",
"}",
"\n",
"// doesn't have parent in github, but has parent in config",
"if",
"gt",
".",
"Parent",
"==",
"nil",
"&&",
"parent",
"!=",
"nil",
"{",
"patch",
"=",
"true",
"\n",
"gt",
".",
"ParentTeamID",
"=",
"parent",
"\n",
"}",
"\n",
"if",
"gt",
".",
"Parent",
"!=",
"nil",
"{",
"// has parent in github ...",
"if",
"parent",
"==",
"nil",
"{",
"// ... but doesn't need one",
"patch",
"=",
"true",
"\n",
"gt",
".",
"Parent",
"=",
"nil",
"\n",
"gt",
".",
"ParentTeamID",
"=",
"parent",
"\n",
"}",
"else",
"if",
"gt",
".",
"Parent",
".",
"ID",
"!=",
"*",
"<mask>",
"{",
"// but it's different than the config",
"patch",
"=",
"true",
"\n",
"gt",
".",
"Parent",
"=",
"nil",
"\n",
"gt",
".",
"ParentTeamID",
"=",
"parent",
"\n",
"}",
"\n",
"}",
"\n\n",
"if",
"team",
".",
"Privacy",
"!=",
"nil",
"&&",
"gt",
".",
"Privacy",
"!=",
"string",
"(",
"*",
"team",
".",
"Privacy",
")",
"{",
"patch",
"=",
"true",
"\n",
"gt",
".",
"Privacy",
"=",
"string",
"(",
"*",
"team",
".",
"Privacy",
")",
"\n\n",
"}",
"else",
"if",
"team",
".",
"Privacy",
"==",
"nil",
"&&",
"(",
"parent",
"!=",
"nil",
"||",
"len",
"(",
"team",
".",
"Children",
")",
">",
"0",
")",
"&&",
"gt",
".",
"Privacy",
"!=",
"\"",
"\"",
"{",
"patch",
"=",
"true",
"\n",
"gt",
".",
"Privacy",
"=",
"github",
".",
"PrivacyClosed",
"// nested teams must be closed",
"\n",
"}",
"\n\n",
"if",
"patch",
"{",
"// yes we need to patch",
"if",
"_",
",",
"err",
":=",
"client",
".",
"EditTeam",
"(",
"gt",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"orgName",
",",
"gt",
".",
"ID",
",",
"gt",
".",
"Name",
",",
"err",
")",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
] |
14,512 | all-14513 | [
"GetLogger",
"returns",
"logger",
"instance",
"based",
"on",
"provided",
"name",
".",
"If",
"logger",
"does",
"not",
"exist",
"error",
"will",
"be",
"returned",
"."
] | [
"func",
"GetLogger",
"(",
"name",
"string",
")",
"(",
"*",
"Logger",
",",
"error",
")",
"{",
"if",
"name",
"==",
"\"",
"\"",
"{",
"return",
"getDefaultLogger",
"(",
")",
",",
"nil",
"\n",
"}",
"\n",
"lock",
".",
"RLock",
"(",
")",
"\n",
"logger",
",",
"ok",
":=",
"loggers",
"[",
"name",
"]",
"\n",
"lock",
".",
"RUnlock",
"(",
")",
"\n",
"if",
"!",
"<mask>",
"{",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"name",
")",
"\n",
"}",
"\n",
"return",
"logger",
",",
"nil",
"\n",
"}"
] |
14,513 | all-14514 | [
"SubmitTaskStateChange",
"mocks",
"base",
"method"
] | [
"func",
"(",
"m",
"*",
"MockECSSubmitStateSDK",
")",
"SubmitTaskStateChange",
"(",
"arg0",
"*",
"ecs",
".",
"SubmitTaskStateChangeInput",
")",
"(",
"*",
"ecs",
".",
"SubmitTaskStateChangeOutput",
",",
"error",
")",
"{",
"ret",
":=",
"m",
".",
"ctrl",
".",
"Call",
"(",
"m",
",",
"\"",
"\"",
",",
"arg0",
")",
"\n",
"ret0",
",",
"_",
":=",
"ret",
"[",
"0",
"]",
".",
"(",
"*",
"ecs",
".",
"SubmitTaskStateChangeOutput",
")",
"\n",
"ret1",
",",
"_",
":=",
"<mask>",
"[",
"1",
"]",
".",
"(",
"error",
")",
"\n",
"return",
"ret0",
",",
"ret1",
"\n",
"}"
] |
14,514 | all-14515 | [
"GetImageServer",
"returns",
"a",
"ImageServer",
"struct",
"for",
"the",
"remote"
] | [
"func",
"(",
"c",
"*",
"Config",
")",
"GetImageServer",
"(",
"name",
"string",
")",
"(",
"lxd",
".",
"ImageServer",
",",
"error",
")",
"{",
"// Get the remote",
"remote",
",",
"ok",
":=",
"c",
".",
"Remotes",
"[",
"name",
"]",
"\n",
"if",
"!",
"ok",
"{",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\\\"",
"\\\"",
"\"",
",",
"name",
")",
"\n",
"}",
"\n\n",
"// Get connection arguments",
"args",
",",
"err",
":=",
"c",
".",
"getConnectionArgs",
"(",
"name",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"// Unix socket",
"if",
"strings",
".",
"HasPrefix",
"(",
"remote",
".",
"Addr",
",",
"\"",
"\"",
")",
"{",
"d",
",",
"err",
":=",
"lxd",
".",
"ConnectLXDUnix",
"(",
"strings",
".",
"TrimPrefix",
"(",
"strings",
".",
"TrimPrefix",
"(",
"remote",
".",
"Addr",
",",
"\"",
"\"",
")",
",",
"\"",
"\"",
")",
",",
"args",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"if",
"remote",
".",
"Project",
"!=",
"\"",
"\"",
"&&",
"remote",
".",
"<mask>",
"!=",
"\"",
"\"",
"{",
"d",
"=",
"d",
".",
"UseProject",
"(",
"remote",
".",
"Project",
")",
"\n",
"}",
"\n\n",
"if",
"c",
".",
"ProjectOverride",
"!=",
"\"",
"\"",
"{",
"d",
"=",
"d",
".",
"UseProject",
"(",
"c",
".",
"ProjectOverride",
")",
"\n",
"}",
"\n\n",
"return",
"d",
",",
"nil",
"\n",
"}",
"\n\n",
"// HTTPs (simplestreams)",
"if",
"remote",
".",
"Protocol",
"==",
"\"",
"\"",
"{",
"d",
",",
"err",
":=",
"lxd",
".",
"ConnectSimpleStreams",
"(",
"remote",
".",
"Addr",
",",
"args",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"return",
"d",
",",
"nil",
"\n",
"}",
"\n\n",
"// HTTPs (public LXD)",
"if",
"remote",
".",
"Public",
"{",
"d",
",",
"err",
":=",
"lxd",
".",
"ConnectPublicLXD",
"(",
"remote",
".",
"Addr",
",",
"args",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"return",
"d",
",",
"nil",
"\n",
"}",
"\n\n",
"// HTTPs (private LXD)",
"d",
",",
"err",
":=",
"lxd",
".",
"ConnectLXD",
"(",
"remote",
".",
"Addr",
",",
"args",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"if",
"remote",
".",
"Project",
"!=",
"\"",
"\"",
"&&",
"remote",
".",
"Project",
"!=",
"\"",
"\"",
"{",
"d",
"=",
"d",
".",
"UseProject",
"(",
"remote",
".",
"Project",
")",
"\n",
"}",
"\n\n",
"if",
"c",
".",
"ProjectOverride",
"!=",
"\"",
"\"",
"{",
"d",
"=",
"d",
".",
"UseProject",
"(",
"c",
".",
"ProjectOverride",
")",
"\n",
"}",
"\n\n",
"return",
"d",
",",
"nil",
"\n",
"}"
] |
14,515 | all-14516 | [
"LimitReachedHandler",
"logs",
"the",
"throttled",
"request",
"in",
"the",
"credentials",
"audit",
"log"
] | [
"func",
"LimitReachedHandler",
"(",
"auditLogger",
"audit",
".",
"AuditLogger",
")",
"func",
"(",
"http",
".",
"ResponseWriter",
",",
"*",
"http",
".",
"Request",
")",
"{",
"return",
"func",
"(",
"w",
"http",
".",
"ResponseWriter",
",",
"r",
"*",
"<mask>",
".",
"Request",
")",
"{",
"logRequest",
":=",
"request",
".",
"LogRequest",
"{",
"Request",
":",
"r",
",",
"}",
"\n",
"auditLogger",
".",
"Log",
"(",
"logRequest",
",",
"http",
".",
"StatusTooManyRequests",
",",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"}"
] |
14,516 | all-14517 | [
"MarshalEasyJSON",
"satisfies",
"easyjson",
".",
"Marshaler",
"."
] | [
"func",
"(",
"t",
"ScreencastFormat",
")",
"MarshalEasyJSON",
"(",
"<mask>",
"*",
"jwriter",
".",
"Writer",
")",
"{",
"out",
".",
"String",
"(",
"string",
"(",
"t",
")",
")",
"\n",
"}"
] |
14,517 | all-14518 | [
"Key",
"returns",
"the",
"value",
"associated",
"with",
"the",
"given",
"name",
"key",
"in",
"the",
"dictionary",
"v",
".",
"Like",
"the",
"result",
"of",
"the",
"Name",
"method",
"the",
"key",
"should",
"not",
"include",
"a",
"leading",
"slash",
".",
"If",
"v",
"is",
"a",
"stream",
"Key",
"applies",
"to",
"the",
"stream",
"s",
"header",
"dictionary",
".",
"If",
"v",
".",
"Kind",
"()",
"!",
"=",
"Dict",
"and",
"v",
".",
"Kind",
"()",
"!",
"=",
"Stream",
"Key",
"returns",
"a",
"null",
"Value",
"."
] | [
"func",
"(",
"v",
"Value",
")",
"Key",
"(",
"key",
"string",
")",
"Value",
"{",
"x",
",",
"ok",
":=",
"v",
".",
"data",
".",
"(",
"dict",
")",
"\n",
"if",
"!",
"ok",
"{",
"strm",
",",
"ok",
":=",
"v",
".",
"data",
".",
"(",
"<mask>",
")",
"\n",
"if",
"!",
"ok",
"{",
"return",
"Value",
"{",
"}",
"\n",
"}",
"\n",
"x",
"=",
"strm",
".",
"hdr",
"\n",
"}",
"\n",
"return",
"v",
".",
"r",
".",
"resolve",
"(",
"v",
".",
"ptr",
",",
"x",
"[",
"name",
"(",
"key",
")",
"]",
")",
"\n",
"}"
] |
14,518 | all-14519 | [
"WriteGoogleAssets",
"writes",
"assets",
"to",
"a",
"google",
"backend",
"."
] | [
"func",
"WriteGoogleAssets",
"(",
"encoder",
"Encoder",
",",
"opts",
"*",
"AssetOpts",
",",
"bucket",
"string",
",",
"cred",
"<mask>",
",",
"volumeSize",
"int",
")",
"error",
"{",
"if",
"err",
":=",
"WriteAssets",
"(",
"encoder",
",",
"opts",
",",
"googleBackend",
",",
"googleBackend",
",",
"volumeSize",
",",
"\"",
"\"",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"return",
"WriteSecret",
"(",
"encoder",
",",
"GoogleSecret",
"(",
"bucket",
",",
"cred",
")",
",",
"opts",
")",
"\n",
"}"
] |
14,519 | all-14520 | [
"sync",
"proposes",
"a",
"SYNC",
"request",
"and",
"is",
"non",
"-",
"blocking",
".",
"This",
"makes",
"no",
"guarantee",
"that",
"the",
"request",
"will",
"be",
"proposed",
"or",
"performed",
".",
"The",
"request",
"will",
"be",
"canceled",
"after",
"the",
"given",
"timeout",
"."
] | [
"func",
"(",
"s",
"*",
"EtcdServer",
")",
"sync",
"(",
"timeout",
"time",
".",
"Duration",
")",
"{",
"req",
":=",
"pb",
".",
"Request",
"{",
"Method",
":",
"\"",
"\"",
",",
"ID",
":",
"s",
".",
"reqIDGen",
".",
"Next",
"(",
")",
",",
"Time",
":",
"time",
".",
"Now",
"(",
")",
".",
"UnixNano",
"(",
")",
",",
"}",
"\n",
"data",
":=",
"pbutil",
".",
"MustMarshal",
"(",
"&",
"req",
")",
"\n",
"// There is no promise that node has leader when do SYNC request,",
"// so it uses goroutine to propose.",
"ctx",
",",
"cancel",
":=",
"<mask>",
".",
"WithTimeout",
"(",
"s",
".",
"ctx",
",",
"timeout",
")",
"\n",
"s",
".",
"goAttach",
"(",
"func",
"(",
")",
"{",
"s",
".",
"r",
".",
"Propose",
"(",
"ctx",
",",
"data",
")",
"\n",
"cancel",
"(",
")",
"\n",
"}",
")",
"\n",
"}"
] |
14,520 | all-14521 | [
"Set",
"stores",
"the",
"ByteCode"
] | [
"func",
"(",
"c",
"MemoryCache",
")",
"Set",
"(",
"<mask>",
"string",
",",
"bc",
"*",
"CacheEntity",
")",
"error",
"{",
"c",
"[",
"key",
"]",
"=",
"bc",
"\n",
"return",
"nil",
"\n",
"}"
] |
14,521 | all-14522 | [
"resourceVSphereComputeClusterApplyCreate",
"processes",
"the",
"creation",
"part",
"of",
"resourceVSphereComputeClusterCreate",
"."
] | [
"func",
"resourceVSphereComputeClusterApplyCreate",
"(",
"d",
"*",
"schema",
".",
"ResourceData",
",",
"meta",
"interface",
"{",
"}",
")",
"(",
"*",
"<mask>",
".",
"ClusterComputeResource",
",",
"error",
")",
"{",
"log",
".",
"Printf",
"(",
"\"",
"\"",
",",
"resourceVSphereComputeClusterIDString",
"(",
"d",
")",
")",
"\n",
"client",
",",
"err",
":=",
"resourceVSphereComputeClusterClient",
"(",
"meta",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"dc",
",",
"err",
":=",
"datacenterFromID",
"(",
"client",
",",
"d",
".",
"Get",
"(",
"\"",
"\"",
")",
".",
"(",
"string",
")",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"}",
"\n\n",
"// Find the folder based off the path to the datacenter. This is where we",
"// create the datastore cluster.",
"f",
",",
"err",
":=",
"folder",
".",
"FromPath",
"(",
"client",
",",
"d",
".",
"Get",
"(",
"\"",
"\"",
")",
".",
"(",
"string",
")",
",",
"folder",
".",
"VSphereFolderTypeHost",
",",
"dc",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"}",
"\n\n",
"// Create the cluster. We use an empty config spec so that we can move the",
"// necessary hosts into the cluster *before* we send the full configuration,",
"// ensuring that any host-dependent configuration does not break.",
"cluster",
",",
"err",
":=",
"clustercomputeresource",
".",
"Create",
"(",
"f",
",",
"d",
".",
"Get",
"(",
"\"",
"\"",
")",
".",
"(",
"string",
")",
",",
"types",
".",
"ClusterConfigSpecEx",
"{",
"}",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"}",
"\n\n",
"// Set the ID now before proceeding any further. Any other operation past",
"// this point is recoverable.",
"d",
".",
"SetId",
"(",
"cluster",
".",
"Reference",
"(",
")",
".",
"Value",
")",
"\n\n",
"return",
"cluster",
",",
"nil",
"\n",
"}"
] |
14,522 | all-14523 | [
"Like",
"ObjectOf",
"but",
"panics",
"instead",
"of",
"returning",
"nil",
".",
"Only",
"valid",
"during",
"p",
"s",
"create",
"and",
"build",
"phases",
"."
] | [
"func",
"(",
"p",
"*",
"Package",
")",
"objectOf",
"(",
"id",
"*",
"ast",
".",
"Ident",
")",
"types",
".",
"Object",
"{",
"if",
"o",
":=",
"p",
".",
"info",
".",
"ObjectOf",
"(",
"id",
")",
";",
"o",
"!=",
"nil",
"{",
"return",
"o",
"\n",
"}",
"\n",
"panic",
"(",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"<mask>",
".",
"Name",
",",
"p",
".",
"Prog",
".",
"Fset",
".",
"Position",
"(",
"id",
".",
"Pos",
"(",
")",
")",
")",
")",
"\n",
"}"
] |
14,523 | all-14524 | [
"NewSigner",
"creates",
"a",
"new",
"RSA",
"backed",
"Signer"
] | [
"func",
"NewSigner",
"(",
"opts",
"*",
"KeyOptions",
")",
"(",
"Signer",
",",
"error",
")",
"{",
"privateKey",
":=",
"opts",
".",
"KeyBytes",
"\n",
"if",
"opts",
".",
"KeyPath",
"!=",
"\"",
"\"",
"{",
"<mask>",
",",
"err",
":=",
"ioutil",
".",
"ReadFile",
"(",
"opts",
".",
"KeyPath",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"privateKey",
"=",
"raw",
"\n",
"}",
"\n",
"block",
",",
"_",
":=",
"pem",
".",
"Decode",
"(",
"privateKey",
")",
"\n",
"blockBytes",
":=",
"block",
".",
"Bytes",
"\n",
"// Decode the PEM key if a password is set",
"if",
"x509",
".",
"IsEncryptedPEMBlock",
"(",
"block",
")",
"{",
"b",
",",
"err",
":=",
"x509",
".",
"DecryptPEMBlock",
"(",
"block",
",",
"opts",
".",
"Password",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"blockBytes",
"=",
"b",
"\n",
"}",
"\n",
"parsed",
",",
"err",
":=",
"x509",
".",
"ParsePKCS8PrivateKey",
"(",
"blockBytes",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"privKey",
",",
"ok",
":=",
"parsed",
".",
"(",
"*",
"rsa",
".",
"PrivateKey",
")",
"\n",
"if",
"!",
"ok",
"{",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"return",
"&",
"rsaSigner",
"{",
"privKey",
":",
"privKey",
"}",
",",
"nil",
"\n",
"}"
] |
14,524 | all-14525 | [
"GetAlertsInRange",
"gets",
"an",
"Iterator",
"containing",
"conferences",
"in",
"the",
"range",
"[",
"start",
"end",
")",
"optionally",
"further",
"filtered",
"by",
"data",
".",
"GetAlertsInRange",
"panics",
"if",
"start",
"is",
"not",
"before",
"end",
".",
"Any",
"date",
"filters",
"provided",
"in",
"data",
"will",
"be",
"ignored",
".",
"If",
"you",
"have",
"an",
"end",
"but",
"don",
"t",
"want",
"to",
"specify",
"a",
"start",
"use",
"twilio",
".",
"Epoch",
"for",
"start",
".",
"If",
"you",
"have",
"a",
"start",
"but",
"don",
"t",
"want",
"to",
"specify",
"an",
"end",
"use",
"twilio",
".",
"HeatDeath",
"for",
"end",
".",
"Assumes",
"that",
"Twilio",
"returns",
"resources",
"in",
"chronological",
"order",
"latest",
"first",
".",
"If",
"this",
"assumption",
"is",
"incorrect",
"your",
"results",
"will",
"not",
"be",
"correct",
".",
"Returned",
"AlertPages",
"will",
"have",
"at",
"most",
"PageSize",
"results",
"but",
"may",
"have",
"fewer",
"based",
"on",
"filtering",
"."
] | [
"func",
"(",
"a",
"*",
"AlertService",
")",
"GetAlertsInRange",
"(",
"start",
"time",
".",
"Time",
",",
"end",
"time",
".",
"Time",
",",
"data",
"url",
".",
"Values",
")",
"AlertPageIterator",
"{",
"if",
"start",
".",
"After",
"(",
"end",
")",
"{",
"panic",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"d",
":=",
"<mask>",
".",
"Values",
"{",
"}",
"\n",
"if",
"data",
"!=",
"nil",
"{",
"for",
"k",
",",
"v",
":=",
"range",
"data",
"{",
"d",
"[",
"k",
"]",
"=",
"v",
"\n",
"}",
"\n",
"}",
"\n",
"d",
".",
"Del",
"(",
"\"",
"\"",
")",
"// just in case",
"\n",
"if",
"start",
"!=",
"Epoch",
"{",
"startFormat",
":=",
"start",
".",
"UTC",
"(",
")",
".",
"Format",
"(",
"time",
".",
"RFC3339",
")",
"\n",
"d",
".",
"Set",
"(",
"\"",
"\"",
",",
"startFormat",
")",
"\n",
"}",
"\n",
"if",
"end",
"!=",
"HeatDeath",
"{",
"// If you specify \"StartTime<=YYYY-MM-DD\", the *latest* result returned",
"// will be midnight (the earliest possible second) on DD. We want all",
"// of the results for DD so we need to specify DD+1 in the API.",
"//",
"// TODO validate midnight-instant math more closely, since I don't think",
"// Twilio returns the correct results for that instant.",
"endFormat",
":=",
"end",
".",
"UTC",
"(",
")",
".",
"Format",
"(",
"time",
".",
"RFC3339",
")",
"\n",
"d",
".",
"Set",
"(",
"\"",
"\"",
",",
"endFormat",
")",
"\n",
"}",
"\n",
"iter",
":=",
"NewPageIterator",
"(",
"a",
".",
"client",
",",
"d",
",",
"alertPathPart",
")",
"\n",
"return",
"&",
"alertDateIterator",
"{",
"start",
":",
"start",
",",
"end",
":",
"end",
",",
"p",
":",
"iter",
",",
"}",
"\n",
"}"
] |
14,525 | all-14526 | [
"DB",
"returns",
"a",
"value",
"representing",
"the",
"named",
"database",
".",
"If",
"name",
"is",
"empty",
"the",
"database",
"name",
"provided",
"in",
"the",
"dialed",
"URL",
"is",
"used",
"instead",
".",
"If",
"that",
"is",
"also",
"empty",
"test",
"is",
"used",
"as",
"a",
"fallback",
"in",
"a",
"way",
"equivalent",
"to",
"the",
"mongo",
"shell",
".",
"Creating",
"this",
"value",
"is",
"a",
"very",
"lightweight",
"operation",
"and",
"involves",
"no",
"network",
"communication",
"."
] | [
"func",
"(",
"s",
"*",
"Session",
")",
"DB",
"(",
"name",
"string",
")",
"*",
"Database",
"{",
"if",
"name",
"==",
"\"",
"\"",
"{",
"<mask>",
"=",
"s",
".",
"defaultdb",
"\n",
"}",
"\n",
"return",
"&",
"Database",
"{",
"s",
",",
"name",
"}",
"\n",
"}"
] |
14,526 | all-14527 | [
"updates",
"a",
"subset",
"of",
"a",
"buffer",
"object",
"s",
"data",
"store"
] | [
"func",
"NamedBufferSubData",
"(",
"<mask>",
"uint32",
",",
"offset",
"int",
",",
"size",
"int",
",",
"data",
"unsafe",
".",
"Pointer",
")",
"{",
"C",
".",
"glowNamedBufferSubData",
"(",
"gpNamedBufferSubData",
",",
"(",
"C",
".",
"GLuint",
")",
"(",
"buffer",
")",
",",
"(",
"C",
".",
"GLintptr",
")",
"(",
"offset",
")",
",",
"(",
"C",
".",
"GLsizeiptr",
")",
"(",
"size",
")",
",",
"data",
")",
"\n",
"}"
] |
14,527 | all-14528 | [
"UnmarshalJSON",
"supports",
"json",
".",
"Unmarshaler",
"interface"
] | [
"func",
"(",
"v",
"*",
"RunScriptParams",
")",
"UnmarshalJSON",
"(",
"data",
"[",
"]",
"byte",
")",
"error",
"{",
"r",
":=",
"jlexer",
".",
"Lexer",
"{",
"Data",
":",
"data",
"}",
"\n",
"easyjsonC5a4559bDecodeGithubComChromedpCdprotoRuntime6",
"(",
"&",
"r",
",",
"v",
")",
"\n",
"return",
"r",
".",
"<mask>",
"(",
")",
"\n",
"}"
] |
14,528 | all-14529 | [
"ExpandHTML",
"expands",
"a",
"template",
"with",
"HTML",
"escaping",
"with",
"templates",
"read",
"from",
"the",
"given",
"files",
"."
] | [
"func",
"(",
"te",
"Expander",
")",
"ExpandHTML",
"(",
"templateFiles",
"[",
"]",
"string",
")",
"(",
"result",
"string",
",",
"resultErr",
"error",
")",
"{",
"defer",
"func",
"(",
")",
"{",
"if",
"r",
":=",
"recover",
"(",
")",
";",
"r",
"!=",
"nil",
"{",
"var",
"ok",
"bool",
"\n",
"resultErr",
",",
"ok",
"=",
"r",
".",
"(",
"error",
")",
"\n",
"if",
"!",
"ok",
"{",
"resultErr",
"=",
"errors",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"te",
".",
"name",
",",
"r",
")",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"(",
")",
"\n\n",
"tmpl",
":=",
"html_template",
".",
"New",
"(",
"te",
".",
"name",
")",
".",
"Funcs",
"(",
"html_template",
".",
"FuncMap",
"(",
"te",
".",
"funcMap",
")",
")",
"\n",
"tmpl",
".",
"Option",
"(",
"\"",
"\"",
")",
"\n",
"tmpl",
".",
"Funcs",
"(",
"html_template",
".",
"FuncMap",
"{",
"\"",
"\"",
":",
"func",
"(",
"name",
"string",
",",
"data",
"interface",
"{",
"}",
")",
"(",
"html_template",
".",
"HTML",
",",
"error",
")",
"{",
"var",
"buffer",
"bytes",
".",
"Buffer",
"\n",
"err",
":=",
"tmpl",
".",
"ExecuteTemplate",
"(",
"&",
"buffer",
",",
"name",
",",
"data",
")",
"\n",
"return",
"html_template",
".",
"HTML",
"(",
"buffer",
".",
"String",
"(",
")",
")",
",",
"err",
"\n",
"}",
",",
"}",
")",
"\n",
"tmpl",
",",
"err",
":=",
"tmpl",
".",
"Parse",
"(",
"te",
".",
"text",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"\"",
"\"",
",",
"errors",
".",
"Wrapf",
"(",
"err",
",",
"\"",
"\"",
",",
"te",
".",
"name",
")",
"\n",
"}",
"\n",
"if",
"len",
"(",
"templateFiles",
")",
">",
"0",
"{",
"_",
",",
"err",
"=",
"tmpl",
".",
"ParseFiles",
"(",
"templateFiles",
"...",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"\"",
"\"",
",",
"<mask>",
".",
"Wrapf",
"(",
"err",
",",
"\"",
"\"",
",",
"te",
".",
"name",
")",
"\n",
"}",
"\n",
"}",
"\n",
"var",
"buffer",
"bytes",
".",
"Buffer",
"\n",
"err",
"=",
"tmpl",
".",
"Execute",
"(",
"&",
"buffer",
",",
"te",
".",
"data",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"\"",
"\"",
",",
"errors",
".",
"Wrapf",
"(",
"err",
",",
"\"",
"\"",
",",
"te",
".",
"name",
")",
"\n",
"}",
"\n",
"return",
"buffer",
".",
"String",
"(",
")",
",",
"nil",
"\n",
"}"
] |
14,529 | all-14530 | [
"UpdateBranchProtection",
"configures",
"org",
"/",
"repo",
"=",
"branch",
".",
"See",
"https",
":",
"//",
"developer",
".",
"github",
".",
"com",
"/",
"v3",
"/",
"repos",
"/",
"branches",
"/",
"#update",
"-",
"branch",
"-",
"protection"
] | [
"func",
"(",
"c",
"*",
"Client",
")",
"UpdateBranchProtection",
"(",
"org",
",",
"repo",
",",
"branch",
"string",
",",
"config",
"BranchProtectionRequest",
")",
"error",
"{",
"c",
".",
"log",
"(",
"\"",
"\"",
",",
"org",
",",
"repo",
",",
"branch",
",",
"config",
")",
"\n",
"_",
",",
"err",
":=",
"c",
".",
"<mask>",
"(",
"&",
"request",
"{",
"accept",
":",
"\"",
"\"",
",",
"// for required_approving_review_count",
"method",
":",
"http",
".",
"MethodPut",
",",
"path",
":",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"org",
",",
"repo",
",",
"branch",
")",
",",
"requestBody",
":",
"config",
",",
"exitCodes",
":",
"[",
"]",
"int",
"{",
"200",
"}",
",",
"}",
",",
"nil",
")",
"\n",
"return",
"err",
"\n",
"}"
] |
14,530 | all-14531 | [
"removeSubdirs",
"takes",
"a",
"set",
"of",
"directories",
"as",
"an",
"input",
"and",
"removes",
"all",
"subdirectories",
".",
"E",
".",
"g",
".",
"[",
"a",
"a",
"/",
"b",
"/",
"c",
"d",
"/",
"e",
"d",
"/",
"e",
"/",
"f",
"]",
"-",
">",
"[",
"a",
"d",
"/",
"e",
"]",
"Subdirs",
"will",
"not",
"be",
"removed",
"if",
"they",
"are",
"configured",
"to",
"have",
"no",
"parent",
"OWNERS",
"files",
"or",
"if",
"any",
"OWNERS",
"file",
"in",
"the",
"relative",
"path",
"between",
"the",
"subdir",
"and",
"the",
"higher",
"level",
"dir",
"is",
"configured",
"to",
"have",
"no",
"parent",
"OWNERS",
"files",
"."
] | [
"func",
"(",
"o",
"Owners",
")",
"removeSubdirs",
"(",
"dirs",
"sets",
".",
"String",
")",
"{",
"canonicalize",
":=",
"func",
"(",
"p",
"string",
")",
"string",
"{",
"if",
"p",
"==",
"\"",
"\"",
"{",
"return",
"\"",
"\"",
"\n",
"}",
"\n",
"return",
"p",
"\n",
"}",
"\n",
"for",
"_",
",",
"dir",
":=",
"<mask>",
"dirs",
".",
"List",
"(",
")",
"{",
"path",
":=",
"dir",
"\n",
"for",
"{",
"if",
"o",
".",
"repo",
".",
"IsNoParentOwners",
"(",
"path",
")",
"||",
"canonicalize",
"(",
"path",
")",
"==",
"\"",
"\"",
"{",
"break",
"\n",
"}",
"\n",
"path",
"=",
"filepath",
".",
"Dir",
"(",
"path",
")",
"\n",
"if",
"dirs",
".",
"Has",
"(",
"canonicalize",
"(",
"path",
")",
")",
"{",
"dirs",
".",
"Delete",
"(",
"dir",
")",
"\n",
"break",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n",
"}"
] |
14,531 | all-14532 | [
"SeekForPrev",
"finds",
"an",
"entry",
"with",
"key",
"<",
"=",
"target",
"."
] | [
"func",
"(",
"s",
"*",
"Iterator",
")",
"SeekForPrev",
"(",
"target",
"[",
"]",
"<mask>",
")",
"{",
"s",
".",
"n",
",",
"_",
"=",
"s",
".",
"list",
".",
"findNear",
"(",
"target",
",",
"true",
",",
"true",
")",
"// find <=.",
"\n",
"}"
] |
14,532 | all-14533 | [
"Helpers",
"--------------------------------------------------------------------",
"getHost",
"tries",
"its",
"best",
"to",
"return",
"the",
"request",
"host",
"."
] | [
"func",
"getHost",
"(",
"r",
"*",
"http",
".",
"Request",
")",
"string",
"{",
"if",
"r",
".",
"URL",
".",
"IsAbs",
"(",
")",
"{",
"host",
":=",
"r",
".",
"Host",
"\n",
"// Slice off any port information.",
"if",
"i",
":=",
"strings",
".",
"Index",
"(",
"host",
",",
"\"",
"\"",
")",
";",
"i",
"!=",
"-",
"1",
"{",
"host",
"=",
"<mask>",
"[",
":",
"i",
"]",
"\n",
"}",
"\n",
"return",
"host",
"\n",
"}",
"\n",
"return",
"r",
".",
"URL",
".",
"Host",
"\n",
"}"
] |
14,533 | all-14534 | [
"Insert",
"queues",
"up",
"the",
"provided",
"documents",
"for",
"insertion",
"."
] | [
"func",
"(",
"b",
"*",
"Bulk",
")",
"Insert",
"(",
"docs",
"...",
"interface",
"{",
"}",
")",
"{",
"b",
".",
"inserts",
"=",
"<mask>",
"(",
"b",
".",
"inserts",
",",
"docs",
"...",
")",
"\n",
"}"
] |
14,534 | all-14535 | [
"CubicCurveTo",
"adds",
"a",
"cubic",
"bezier",
"curve",
"to",
"the",
"current",
"path"
] | [
"func",
"(",
"p",
"*",
"<mask>",
")",
"CubicCurveTo",
"(",
"cx1",
",",
"cy1",
",",
"cx2",
",",
"cy2",
",",
"x",
",",
"y",
"float64",
")",
"{",
"if",
"len",
"(",
"p",
".",
"Components",
")",
"==",
"0",
"{",
"//special case when no move has been done",
"p",
".",
"MoveTo",
"(",
"x",
",",
"y",
")",
"\n",
"}",
"else",
"{",
"p",
".",
"appendToPath",
"(",
"CubicCurveToCmp",
",",
"cx1",
",",
"cy1",
",",
"cx2",
",",
"cy2",
",",
"x",
",",
"y",
")",
"\n",
"}",
"\n",
"p",
".",
"x",
"=",
"x",
"\n",
"p",
".",
"y",
"=",
"y",
"\n",
"}"
] |
14,535 | all-14536 | [
"SetElement",
"sets",
"an",
"element",
"at",
"(",
"i",
"j",
")",
"."
] | [
"func",
"(",
"c",
"*",
"ColorM",
")",
"SetElement",
"(",
"i",
",",
"j",
"int",
",",
"element",
"float64",
")",
"{",
"c",
".",
"impl",
"=",
"c",
".",
"impl",
".",
"SetElement",
"(",
"i",
",",
"j",
",",
"float32",
"(",
"<mask>",
")",
")",
"\n",
"}"
] |
14,536 | all-14537 | [
"resourceVSphereVirtualMachineMigrateState",
"is",
"the",
"master",
"state",
"migration",
"function",
"for",
"the",
"vsphere_virtual_machine",
"resource",
"."
] | [
"func",
"resourceVSphereVirtualMachineMigrateState",
"(",
"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",
"2",
":",
"log",
".",
"Printf",
"(",
"\"",
"\"",
",",
"version",
",",
"os",
")",
"\n",
"migrateFunc",
"=",
"migrateVSphereVirtualMachineStateV3",
"\n",
"case",
"1",
":",
"log",
".",
"Printf",
"(",
"\"",
"\"",
",",
"version",
",",
"os",
")",
"\n",
"migrateFunc",
"=",
"migrateVSphereVirtualMachineStateV2",
"\n",
"case",
"0",
":",
"log",
".",
"Printf",
"(",
"\"",
"\"",
",",
"version",
",",
"<mask>",
")",
"\n",
"migrateFunc",
"=",
"migrateVSphereVirtualMachineStateV1",
"\n",
"default",
":",
"// Migration is complete",
"log",
".",
"Printf",
"(",
"\"",
"\"",
",",
"version",
",",
"os",
")",
"\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",
"resourceVSphereVirtualMachineMigrateState",
"(",
"version",
",",
"os",
",",
"meta",
")",
"\n",
"}"
] |
14,537 | all-14538 | [
"String",
"returns",
"a",
"displayable",
"name",
"for",
"the",
"user",
"."
] | [
"func",
"(",
"u",
"*",
"<mask>",
")",
"String",
"(",
")",
"string",
"{",
"if",
"u",
".",
"AuthDomain",
"!=",
"\"",
"\"",
"&&",
"strings",
".",
"HasSuffix",
"(",
"u",
".",
"Email",
",",
"\"",
"\"",
"+",
"u",
".",
"AuthDomain",
")",
"{",
"return",
"u",
".",
"Email",
"[",
":",
"len",
"(",
"u",
".",
"Email",
")",
"-",
"len",
"(",
"\"",
"\"",
"+",
"u",
".",
"AuthDomain",
")",
"]",
"\n",
"}",
"\n",
"if",
"u",
".",
"FederatedIdentity",
"!=",
"\"",
"\"",
"{",
"return",
"u",
".",
"FederatedIdentity",
"\n",
"}",
"\n",
"return",
"u",
".",
"Email",
"\n",
"}"
] |
14,538 | all-14539 | [
"ResponseHeaders",
"returns",
"the",
"response",
"headers",
"."
] | [
"func",
"(",
"c",
"headerCtx",
")",
"ResponseHeaders",
"(",
")",
"map",
"[",
"string",
"]",
"string",
"{",
"if",
"h",
":=",
"c",
".",
"<mask>",
"(",
")",
";",
"h",
"!=",
"nil",
"{",
"return",
"h",
".",
"respHeaders",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
] |
14,539 | all-14540 | [
"----------------------------------------",
"Other"
] | [
"func",
"EncodeBool",
"(",
"w",
"io",
".",
"<mask>",
",",
"b",
"bool",
")",
"(",
"err",
"error",
")",
"{",
"if",
"b",
"{",
"err",
"=",
"EncodeUint8",
"(",
"w",
",",
"1",
")",
"// same as EncodeUvarint(w, 1).",
"\n",
"}",
"else",
"{",
"err",
"=",
"EncodeUint8",
"(",
"w",
",",
"0",
")",
"// same as EncodeUvarint(w, 0).",
"\n",
"}",
"\n",
"return",
"\n",
"}"
] |
14,540 | all-14541 | [
"Prim",
"finds",
"the",
"minimum",
"spanning",
"tree",
"with",
"min",
"-",
"heap",
"(",
"priority",
"queue",
")",
".",
"(",
"http",
":",
"//",
"en",
".",
"wikipedia",
".",
"org",
"/",
"wiki",
"/",
"Prim%27s_algorithm",
")",
"0",
".",
"Prim",
"(",
"G",
"source",
")",
"1",
".",
"2",
".",
"let",
"Q",
"be",
"a",
"priority",
"queue",
"3",
".",
"distance",
"[",
"source",
"]",
"=",
"0",
"4",
".",
"5",
".",
"for",
"each",
"vertex",
"v",
"in",
"G",
":",
"6",
".",
"7",
".",
"if",
"v",
"≠",
"source",
":",
"8",
".",
"distance",
"[",
"v",
"]",
"=",
"∞",
"9",
".",
"prev",
"[",
"v",
"]",
"=",
"undefined",
"10",
".",
"11",
".",
"Q",
".",
"add_with_priority",
"(",
"v",
"distance",
"[",
"v",
"]",
")",
"12",
".",
"13",
".",
"14",
".",
"while",
"Q",
"is",
"not",
"empty",
":",
"15",
".",
"16",
".",
"u",
"=",
"Q",
".",
"extract_min",
"()",
"17",
".",
"18",
".",
"for",
"each",
"adjacent",
"vertex",
"v",
"of",
"u",
":",
"19",
".",
"21",
".",
"if",
"v",
"∈",
"Q",
"and",
"distance",
"[",
"v",
"]",
">",
"weight",
"(",
"u",
"v",
")",
":",
"22",
".",
"distance",
"[",
"v",
"]",
"=",
"weight",
"(",
"u",
"v",
")",
"23",
".",
"prev",
"[",
"v",
"]",
"=",
"u",
"24",
".",
"Q",
".",
"decrease_priority",
"(",
"v",
"weight",
"(",
"u",
"v",
"))",
"25",
".",
"26",
".",
"27",
".",
"return",
"tree",
"from",
"prev"
] | [
"func",
"Prim",
"(",
"g",
"Graph",
",",
"src",
"<mask>",
")",
"(",
"map",
"[",
"Edge",
"]",
"struct",
"{",
"}",
",",
"error",
")",
"{",
"// let Q be a priority queue",
"minHeap",
":=",
"&",
"nodeDistanceHeap",
"{",
"}",
"\n\n",
"// distance[source] = 0",
"distance",
":=",
"make",
"(",
"map",
"[",
"ID",
"]",
"float64",
")",
"\n",
"distance",
"[",
"src",
"]",
"=",
"0.0",
"\n\n",
"// for each vertex v in G:",
"for",
"id",
":=",
"range",
"g",
".",
"GetNodes",
"(",
")",
"{",
"// if v ≠ src:",
"if",
"id",
"!=",
"src",
"{",
"// distance[v] = ∞",
"distance",
"[",
"id",
"]",
"=",
"math",
".",
"MaxFloat64",
"\n\n",
"// prev[v] = undefined",
"// prev[v] = \"\"",
"}",
"\n\n",
"// Q.add_with_priority(v, distance[v])",
"nds",
":=",
"nodeDistance",
"{",
"}",
"\n",
"nds",
".",
"id",
"=",
"id",
"\n",
"nds",
".",
"distance",
"=",
"distance",
"[",
"id",
"]",
"\n\n",
"heap",
".",
"Push",
"(",
"minHeap",
",",
"nds",
")",
"\n",
"}",
"\n\n",
"heap",
".",
"Init",
"(",
"minHeap",
")",
"\n",
"prev",
":=",
"make",
"(",
"map",
"[",
"ID",
"]",
"ID",
")",
"\n\n",
"// while Q is not empty:",
"for",
"minHeap",
".",
"Len",
"(",
")",
"!=",
"0",
"{",
"// u = Q.extract_min()",
"u",
":=",
"heap",
".",
"Pop",
"(",
"minHeap",
")",
".",
"(",
"nodeDistance",
")",
"\n",
"uID",
":=",
"u",
".",
"id",
"\n\n",
"// for each adjacent vertex v of u:",
"tm",
",",
"err",
":=",
"g",
".",
"GetTargets",
"(",
"uID",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"for",
"vID",
":=",
"range",
"tm",
"{",
"isExist",
":=",
"false",
"\n",
"for",
"_",
",",
"one",
":=",
"range",
"*",
"minHeap",
"{",
"if",
"vID",
"==",
"one",
".",
"id",
"{",
"isExist",
"=",
"true",
"\n",
"break",
"\n",
"}",
"\n",
"}",
"\n\n",
"// weight(u, v)",
"weight",
",",
"err",
":=",
"g",
".",
"GetWeight",
"(",
"uID",
",",
"vID",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"// if v ∈ Q and distance[v] > weight(u, v):",
"if",
"isExist",
"&&",
"distance",
"[",
"vID",
"]",
">",
"weight",
"{",
"// distance[v] = weight(u, v)",
"distance",
"[",
"vID",
"]",
"=",
"weight",
"\n\n",
"// prev[v] = u",
"prev",
"[",
"vID",
"]",
"=",
"uID",
"\n\n",
"// Q.decrease_priority(v, weight(u, v))",
"minHeap",
".",
"updateDistance",
"(",
"vID",
",",
"weight",
")",
"\n",
"heap",
".",
"Init",
"(",
"minHeap",
")",
"\n",
"}",
"\n",
"}",
"\n\n",
"sm",
",",
"err",
":=",
"g",
".",
"GetSources",
"(",
"uID",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"vID",
":=",
"uID",
"\n",
"for",
"uID",
":=",
"range",
"sm",
"{",
"isExist",
":=",
"false",
"\n",
"for",
"_",
",",
"one",
":=",
"range",
"*",
"minHeap",
"{",
"if",
"vID",
"==",
"one",
".",
"id",
"{",
"isExist",
"=",
"true",
"\n",
"break",
"\n",
"}",
"\n",
"}",
"\n\n",
"// weight(u, v)",
"weight",
",",
"err",
":=",
"g",
".",
"GetWeight",
"(",
"uID",
",",
"vID",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"// if v ∈ Q and distance[v] > weight(u, v):",
"if",
"isExist",
"&&",
"distance",
"[",
"vID",
"]",
">",
"weight",
"{",
"// distance[v] = weight(u, v)",
"distance",
"[",
"vID",
"]",
"=",
"weight",
"\n\n",
"// prev[v] = u",
"prev",
"[",
"vID",
"]",
"=",
"uID",
"\n\n",
"// Q.decrease_priority(v, weight(u, v))",
"minHeap",
".",
"updateDistance",
"(",
"vID",
",",
"weight",
")",
"\n",
"heap",
".",
"Init",
"(",
"minHeap",
")",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n\n",
"tree",
":=",
"make",
"(",
"map",
"[",
"Edge",
"]",
"struct",
"{",
"}",
")",
"\n",
"for",
"k",
",",
"v",
":=",
"range",
"prev",
"{",
"weight",
",",
"err",
":=",
"g",
".",
"GetWeight",
"(",
"v",
",",
"k",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"src",
",",
"err",
":=",
"g",
".",
"GetNode",
"(",
"v",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"tgt",
",",
"err",
":=",
"g",
".",
"GetNode",
"(",
"k",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"tree",
"[",
"NewEdge",
"(",
"src",
",",
"tgt",
",",
"weight",
")",
"]",
"=",
"struct",
"{",
"}",
"{",
"}",
"\n",
"}",
"\n",
"return",
"tree",
",",
"nil",
"\n",
"}"
] |
14,541 | all-14542 | [
"Stability",
":",
"***",
"EXPERIMENTAL",
"***",
"A",
"paginated",
"list",
"of",
"builds",
"that",
"have",
"been",
"run",
"in",
"Taskcluster",
".",
"Can",
"be",
"filtered",
"on",
"various",
"git",
"-",
"specific",
"fields",
".",
"See",
"#builds"
] | [
"func",
"(",
"github",
"*",
"Github",
")",
"Builds",
"(",
"continuationToken",
",",
"limit",
",",
"organization",
",",
"repository",
",",
"sha",
"string",
")",
"(",
"*",
"BuildsResponse",
",",
"error",
")",
"{",
"v",
":=",
"url",
".",
"Values",
"{",
"}",
"\n",
"if",
"continuationToken",
"!=",
"\"",
"\"",
"{",
"v",
".",
"Add",
"(",
"\"",
"\"",
",",
"continuationToken",
")",
"\n",
"}",
"\n",
"if",
"limit",
"!=",
"\"",
"\"",
"{",
"v",
".",
"Add",
"(",
"\"",
"\"",
",",
"limit",
")",
"\n",
"}",
"\n",
"if",
"organization",
"!=",
"\"",
"\"",
"{",
"v",
".",
"Add",
"(",
"\"",
"\"",
",",
"organization",
")",
"\n",
"}",
"\n",
"if",
"repository",
"!=",
"\"",
"\"",
"{",
"v",
".",
"Add",
"(",
"\"",
"\"",
",",
"repository",
")",
"\n",
"}",
"\n",
"if",
"sha",
"!=",
"\"",
"\"",
"{",
"v",
".",
"Add",
"(",
"\"",
"\"",
",",
"sha",
")",
"\n",
"}",
"\n",
"<mask>",
":=",
"tcclient",
".",
"Client",
"(",
"*",
"github",
")",
"\n",
"responseObject",
",",
"_",
",",
"err",
":=",
"(",
"&",
"cd",
")",
".",
"APICall",
"(",
"nil",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"new",
"(",
"BuildsResponse",
")",
",",
"v",
")",
"\n",
"return",
"responseObject",
".",
"(",
"*",
"BuildsResponse",
")",
",",
"err",
"\n",
"}"
] |
14,542 | all-14543 | [
"UpdateCertificate",
"updates",
"the",
"certificate",
"definition"
] | [
"func",
"(",
"r",
"*",
"ProtocolLXD",
")",
"UpdateCertificate",
"(",
"fingerprint",
"string",
",",
"certificate",
"api",
".",
"CertificatePut",
",",
"ETag",
"string",
")",
"error",
"{",
"if",
"!",
"r",
".",
"HasExtension",
"(",
"\"",
"\"",
")",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\\\"",
"\\\"",
"\"",
")",
"\n",
"}",
"\n\n",
"// Send the request",
"_",
",",
"_",
",",
"err",
":=",
"r",
".",
"<mask>",
"(",
"\"",
"\"",
",",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"url",
".",
"QueryEscape",
"(",
"fingerprint",
")",
")",
",",
"certificate",
",",
"ETag",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"return",
"nil",
"\n",
"}"
] |
14,543 | all-14544 | [
"native",
"returns",
"a",
"pointer",
"to",
"the",
"underlying",
"GtkPaned",
"."
] | [
"func",
"(",
"v",
"*",
"Paned",
")",
"native",
"(",
")",
"*",
"C",
".",
"GtkPaned",
"{",
"if",
"v",
"==",
"nil",
"||",
"v",
".",
"GObject",
"==",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n",
"p",
":=",
"unsafe",
".",
"Pointer",
"(",
"v",
".",
"GObject",
")",
"\n",
"<mask>",
"C",
".",
"toGtkPaned",
"(",
"p",
")",
"\n",
"}"
] |
14,544 | all-14545 | [
"Pop",
"removes",
"and",
"returns",
"the",
"item",
"at",
"the",
"end",
"of",
"the",
"stack"
] | [
"func",
"(",
"s",
"*",
"Stack",
")",
"Pop",
"(",
")",
"<mask>",
"{",
"}",
"{",
"l",
":=",
"len",
"(",
"*",
"s",
")",
"\n",
"if",
"l",
"==",
"0",
"{",
"return",
"nil",
"\n",
"}",
"\n\n",
"v",
":=",
"(",
"*",
"s",
")",
"[",
"l",
"-",
"1",
"]",
"\n",
"*",
"s",
"=",
"(",
"*",
"s",
")",
"[",
":",
"l",
"-",
"1",
"]",
"\n",
"return",
"v",
"\n",
"}"
] |
14,545 | all-14546 | [
"ButtonBoxNew",
"is",
"a",
"wrapper",
"around",
"gtk_button_box_new",
"()",
"."
] | [
"func",
"ButtonBoxNew",
"(",
"o",
"Orientation",
")",
"(",
"*",
"ButtonBox",
",",
"<mask>",
")",
"{",
"c",
":=",
"C",
".",
"gtk_button_box_new",
"(",
"C",
".",
"GtkOrientation",
"(",
"o",
")",
")",
"\n",
"if",
"c",
"==",
"nil",
"{",
"return",
"nil",
",",
"nilPtrErr",
"\n",
"}",
"\n",
"obj",
":=",
"glib",
".",
"Take",
"(",
"unsafe",
".",
"Pointer",
"(",
"c",
")",
")",
"\n",
"return",
"wrapButtonBox",
"(",
"obj",
")",
",",
"nil",
"\n",
"}"
] |
14,546 | all-14547 | [
"SetSelectMultiple",
"is",
"a",
"wrapper",
"around",
"gtk_file_chooser_set_select_multiple",
"()",
"."
] | [
"func",
"(",
"v",
"*",
"FileChooser",
")",
"SetSelectMultiple",
"(",
"<mask>",
"bool",
")",
"{",
"C",
".",
"gtk_file_chooser_set_select_multiple",
"(",
"v",
".",
"native",
"(",
")",
",",
"gbool",
"(",
"value",
")",
")",
"\n",
"}"
] |
14,547 | all-14548 | [
"Locator",
"returns",
"a",
"locator",
"for",
"the",
"given",
"resource"
] | [
"func",
"(",
"r",
"*",
"Subnet",
")",
"Locator",
"(",
"api",
"*",
"API",
")",
"*",
"SubnetLocator",
"{",
"for",
"_",
",",
"l",
":=",
"<mask>",
"r",
".",
"Links",
"{",
"if",
"l",
"[",
"\"",
"\"",
"]",
"==",
"\"",
"\"",
"{",
"return",
"api",
".",
"SubnetLocator",
"(",
"l",
"[",
"\"",
"\"",
"]",
")",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
] |
14,548 | all-14549 | [
"SetCachedSecretValue",
"set",
"the",
"secret",
"value",
"in",
"the",
"secretData",
"field",
"given",
"the",
"key",
"and",
"value"
] | [
"func",
"(",
"secret",
"*",
"SSMSecretResource",
")",
"SetCachedSecretValue",
"(",
"secretKey",
"string",
",",
"secretValue",
"string",
")",
"{",
"secret",
".",
"lock",
".",
"Lock",
"(",
")",
"\n",
"defer",
"secret",
".",
"lock",
".",
"Unlock",
"(",
")",
"\n\n",
"if",
"<mask>",
".",
"secretData",
"==",
"nil",
"{",
"secret",
".",
"secretData",
"=",
"make",
"(",
"map",
"[",
"string",
"]",
"string",
")",
"\n",
"}",
"\n\n",
"secret",
".",
"secretData",
"[",
"secretKey",
"]",
"=",
"secretValue",
"\n",
"}"
] |
14,549 | all-14550 | [
"AttrStrings",
"returns",
"the",
"string",
"values",
"of",
"an",
"attribute",
"if",
"it",
"is",
"a",
"list",
".",
"nil",
"is",
"returned",
"if",
"the",
"attribute",
"is",
"not",
"set",
"or",
"is",
"not",
"a",
"list",
".",
"Non",
"-",
"string",
"values",
"within",
"the",
"list",
"won",
"t",
"be",
"returned",
"."
] | [
"func",
"(",
"r",
"*",
"Rule",
")",
"AttrStrings",
"(",
"key",
"string",
")",
"[",
"]",
"string",
"{",
"attr",
",",
"ok",
":=",
"r",
".",
"attrs",
"[",
"key",
"]",
"\n",
"if",
"!",
"ok",
"{",
"return",
"nil",
"\n",
"}",
"\n",
"list",
",",
"ok",
":=",
"attr",
".",
"RHS",
".",
"(",
"*",
"bzl",
".",
"ListExpr",
")",
"\n",
"if",
"!",
"ok",
"{",
"return",
"nil",
"\n",
"}",
"\n",
"strs",
":=",
"make",
"(",
"[",
"]",
"string",
",",
"0",
",",
"len",
"(",
"list",
".",
"List",
")",
")",
"\n",
"for",
"_",
",",
"e",
":=",
"range",
"<mask>",
".",
"List",
"{",
"if",
"str",
",",
"ok",
":=",
"e",
".",
"(",
"*",
"bzl",
".",
"StringExpr",
")",
";",
"ok",
"{",
"strs",
"=",
"append",
"(",
"strs",
",",
"str",
".",
"Value",
")",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"strs",
"\n",
"}"
] |
14,550 | all-14551 | [
"StringJoinFormat",
"formats",
"every",
"value",
"in",
"values",
"with",
"format",
"and",
"joins",
"the",
"result",
"with",
"sep",
"as",
"separator",
".",
"values",
"must",
"be",
"a",
"slice",
"of",
"a",
"formatable",
"type"
] | [
"func",
"StringJoinFormat",
"(",
"format",
"string",
",",
"values",
"interface",
"{",
"}",
",",
"sep",
"string",
")",
"string",
"{",
"v",
":=",
"reflect",
".",
"ValueOf",
"(",
"values",
")",
"\n",
"if",
"v",
".",
"Kind",
"(",
")",
"!=",
"reflect",
".",
"Slice",
"{",
"panic",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"var",
"<mask>",
"bytes",
".",
"Buffer",
"\n",
"for",
"i",
":=",
"0",
";",
"i",
"<",
"v",
".",
"Len",
"(",
")",
";",
"i",
"++",
"{",
"if",
"i",
">",
"0",
"{",
"buffer",
".",
"WriteString",
"(",
"sep",
")",
"\n",
"}",
"\n",
"buffer",
".",
"WriteString",
"(",
"fmt",
".",
"Sprintf",
"(",
"format",
",",
"v",
".",
"Index",
"(",
"i",
")",
".",
"Interface",
"(",
")",
")",
")",
"\n",
"}",
"\n",
"return",
"buffer",
".",
"String",
"(",
")",
"\n",
"}"
] |
14,551 | all-14552 | [
"GetPageIterator",
"returns",
"a",
"AlertPageIterator",
"with",
"the",
"given",
"page",
"filters",
".",
"Call",
"iterator",
".",
"Next",
"()",
"to",
"get",
"the",
"first",
"page",
"of",
"resources",
"(",
"and",
"again",
"to",
"retrieve",
"subsequent",
"pages",
")",
"."
] | [
"func",
"(",
"a",
"*",
"AlertService",
")",
"GetPageIterator",
"(",
"<mask>",
"url",
".",
"Values",
")",
"AlertPageIterator",
"{",
"iter",
":=",
"NewPageIterator",
"(",
"a",
".",
"client",
",",
"data",
",",
"alertPathPart",
")",
"\n",
"return",
"&",
"alertPageIterator",
"{",
"p",
":",
"iter",
",",
"}",
"\n",
"}"
] |
14,552 | all-14553 | [
"native",
"returns",
"a",
"pointer",
"to",
"the",
"underlying",
"GtkStatusbar"
] | [
"func",
"(",
"v",
"*",
"Statusbar",
")",
"native",
"(",
")",
"*",
"C",
".",
"GtkStatusbar",
"{",
"if",
"v",
"==",
"nil",
"||",
"v",
".",
"GObject",
"==",
"nil",
"{",
"<mask>",
"nil",
"\n",
"}",
"\n",
"p",
":=",
"unsafe",
".",
"Pointer",
"(",
"v",
".",
"GObject",
")",
"\n",
"return",
"C",
".",
"toGtkStatusbar",
"(",
"p",
")",
"\n",
"}"
] |
14,553 | all-14554 | [
"Close",
"causes",
"currently",
"running",
"Run",
"()",
"function",
"to",
"exit",
"."
] | [
"func",
"(",
"m",
"*",
"Monitor",
")",
"Close",
"(",
")",
"{",
"m",
".",
"mtx",
".",
"Lock",
"(",
")",
"\n",
"defer",
"m",
".",
"mtx",
".",
"Unlock",
"(",
")",
"\n\n",
"if",
"m",
".",
"<mask>",
"!=",
"nil",
"{",
"m",
".",
"exit",
"<-",
"struct",
"{",
"}",
"{",
"}",
"\n",
"<-",
"m",
".",
"exited",
"\n",
"}",
"\n",
"}"
] |
14,554 | all-14555 | [
"waitStopped",
"waits",
"until",
"the",
"host",
"is",
"stopped"
] | [
"func",
"(",
"d",
"*",
"Driver",
")",
"waitStopped",
"(",
")",
"error",
"{",
"log",
".",
"Infof",
"(",
"\"",
"\"",
")",
"\n\n",
"for",
"{",
"s",
",",
"err",
":=",
"d",
".",
"GetState",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"if",
"s",
"!=",
"<mask>",
".",
"Running",
"{",
"return",
"nil",
"\n",
"}",
"\n\n",
"time",
".",
"Sleep",
"(",
"1",
"*",
"time",
".",
"Second",
")",
"\n",
"}",
"\n",
"}"
] |
14,555 | all-14556 | [
"ExecuteString",
"substitutes",
"template",
"tags",
"(",
"placeholders",
")",
"with",
"the",
"corresponding",
"values",
"from",
"the",
"map",
"m",
"and",
"returns",
"the",
"result",
".",
"Substitution",
"map",
"m",
"may",
"contain",
"values",
"with",
"the",
"following",
"types",
":",
"*",
"[]",
"byte",
"-",
"the",
"fastest",
"value",
"type",
"*",
"string",
"-",
"convenient",
"value",
"type",
"*",
"TagFunc",
"-",
"flexible",
"value",
"type",
"This",
"function",
"is",
"optimized",
"for",
"frozen",
"templates",
".",
"Use",
"ExecuteString",
"for",
"constantly",
"changing",
"templates",
"."
] | [
"func",
"(",
"t",
"*",
"<mask>",
")",
"ExecuteString",
"(",
"m",
"map",
"[",
"string",
"]",
"interface",
"{",
"}",
")",
"string",
"{",
"return",
"t",
".",
"ExecuteFuncString",
"(",
"func",
"(",
"w",
"io",
".",
"Writer",
",",
"tag",
"string",
")",
"(",
"int",
",",
"error",
")",
"{",
"return",
"stdTagFunc",
"(",
"w",
",",
"tag",
",",
"m",
")",
"}",
")",
"\n",
"}"
] |
14,556 | all-14557 | [
"NewDataBytes",
"returns",
"a",
"new",
"memory",
"based",
"data",
"buffer",
"that",
"contains",
"b",
"bytes"
] | [
"func",
"NewDataBytes",
"(",
"b",
"[",
"]",
"byte",
")",
"(",
"*",
"Data",
",",
"error",
")",
"{",
"d",
":=",
"newData",
"(",
")",
"\n",
"<mask>",
"cb",
"*",
"C",
".",
"char",
"\n",
"if",
"len",
"(",
"b",
")",
"!=",
"0",
"{",
"cb",
"=",
"(",
"*",
"C",
".",
"char",
")",
"(",
"unsafe",
".",
"Pointer",
"(",
"&",
"b",
"[",
"0",
"]",
")",
")",
"\n",
"}",
"\n",
"return",
"d",
",",
"handleError",
"(",
"C",
".",
"gpgme_data_new_from_mem",
"(",
"&",
"d",
".",
"dh",
",",
"cb",
",",
"C",
".",
"size_t",
"(",
"len",
"(",
"b",
")",
")",
",",
"1",
")",
")",
"\n",
"}"
] |
14,557 | all-14558 | [
"AddProject",
"adds",
"a",
"new",
"project",
"resource",
"to",
"RBAC",
"."
] | [
"func",
"(",
"r",
"*",
"Server",
")",
"AddProject",
"(",
"<mask>",
"int64",
",",
"name",
"string",
")",
"error",
"{",
"resource",
":=",
"rbacResource",
"{",
"Name",
":",
"name",
",",
"Identifier",
":",
"strconv",
".",
"FormatInt",
"(",
"id",
",",
"10",
")",
",",
"}",
"\n\n",
"// Update RBAC",
"err",
":=",
"r",
".",
"postResources",
"(",
"[",
"]",
"rbacResource",
"{",
"resource",
"}",
",",
"nil",
",",
"false",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"// Update project map",
"r",
".",
"resourcesLock",
".",
"Lock",
"(",
")",
"\n",
"r",
".",
"resources",
"[",
"name",
"]",
"=",
"strconv",
".",
"FormatInt",
"(",
"id",
",",
"10",
")",
"\n",
"r",
".",
"resourcesLock",
".",
"Unlock",
"(",
")",
"\n\n",
"return",
"nil",
"\n",
"}"
] |
14,558 | all-14559 | [
"GetUint64Setting",
"finds",
"the",
"key",
"value",
"in",
"table",
"Setting",
".",
"Checks",
"that",
"the",
"value",
"in",
"the",
"format",
"of",
"uint64"
] | [
"func",
"GetUint64Setting",
"(",
"db",
"*",
"reform",
".",
"DB",
",",
"key",
"string",
")",
"(",
"uint64",
",",
"error",
")",
"{",
"var",
"setting",
"Setting",
"\n",
"err",
":=",
"<mask>",
".",
"FindByPrimaryKeyTo",
"(",
"&",
"setting",
",",
"key",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"if",
"err",
"==",
"sql",
".",
"ErrNoRows",
"{",
"return",
"0",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
"+",
"\"",
"\"",
",",
"key",
")",
"\n",
"}",
"\n",
"return",
"0",
",",
"err",
"\n",
"}",
"\n\n",
"value",
",",
"err",
":=",
"strconv",
".",
"ParseUint",
"(",
"setting",
".",
"Value",
",",
"10",
",",
"64",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"0",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"key",
",",
"err",
")",
"\n",
"}",
"\n\n",
"return",
"value",
",",
"nil",
"\n\n",
"}"
] |
14,559 | all-14560 | [
"WithSelector",
"selectors",
"to",
"highlight",
"relevant",
"nodes",
"."
] | [
"func",
"(",
"p",
"HighlightNodeParams",
")",
"WithSelector",
"(",
"selector",
"string",
")",
"*",
"HighlightNodeParams",
"{",
"p",
".",
"Selector",
"=",
"selector",
"\n",
"<mask>",
"&",
"p",
"\n",
"}"
] |
14,560 | all-14561 | [
"flattenHostVirtualSwitchBeaconConfig",
"reads",
"various",
"fields",
"from",
"a",
"HostVirtualSwitchBeaconConfig",
"into",
"the",
"passed",
"in",
"ResourceData",
"."
] | [
"func",
"flattenHostVirtualSwitchBeaconConfig",
"(",
"d",
"*",
"schema",
".",
"ResourceData",
",",
"obj",
"*",
"types",
".",
"HostVirtualSwitchBeaconConfig",
")",
"error",
"{",
"d",
".",
"<mask>",
"(",
"\"",
"\"",
",",
"obj",
".",
"Interval",
")",
"\n",
"return",
"nil",
"\n",
"}"
] |
14,561 | all-14562 | [
"Keys",
"must",
"be",
"at",
"maximum",
"250",
"bytes",
"long",
"ASCII",
"and",
"not",
"contain",
"whitespace",
"or",
"control",
"characters",
"."
] | [
"func",
"normaliseKey",
"(",
"key",
"string",
")",
"string",
"{",
"newkey",
":=",
"<mask>",
".",
"QueryEscape",
"(",
"key",
")",
"\n",
"if",
"len",
"(",
"newkey",
")",
">",
"250",
"{",
"newkey",
"=",
"newkey",
"[",
":",
"250",
"]",
"\n",
"}",
"\n\n",
"return",
"newkey",
"\n",
"}"
] |
14,562 | all-14563 | [
"ConfigPath",
"returns",
"a",
"joined",
"path",
"of",
"the",
"configuration",
"directory",
"and",
"passed",
"arguments"
] | [
"func",
"(",
"c",
"*",
"Config",
")",
"ConfigPath",
"(",
"paths",
"...",
"string",
")",
"string",
"{",
"path",
":=",
"[",
"]",
"string",
"{",
"c",
".",
"ConfigDir",
"}",
"\n",
"path",
"=",
"append",
"(",
"path",
",",
"paths",
"...",
")",
"\n\n",
"return",
"filepath",
".",
"Join",
"(",
"<mask>",
"...",
")",
"\n",
"}"
] |
14,563 | all-14564 | [
"GetLeftMargin",
"()",
"is",
"a",
"wrapper",
"around",
"gtk_page_setup_get_left_margin",
"()",
"."
] | [
"func",
"(",
"<mask>",
"*",
"PageSetup",
")",
"GetLeftMargin",
"(",
"unit",
"Unit",
")",
"float64",
"{",
"c",
":=",
"C",
".",
"gtk_page_setup_get_left_margin",
"(",
"ps",
".",
"native",
"(",
")",
",",
"C",
".",
"GtkUnit",
"(",
"unit",
")",
")",
"\n",
"return",
"float64",
"(",
"c",
")",
"\n",
"}"
] |
14,564 | all-14565 | [
"UnmarshalJSON",
"supports",
"json",
".",
"Unmarshaler",
"interface"
] | [
"func",
"(",
"v",
"*",
"RuleMatch",
")",
"UnmarshalJSON",
"(",
"data",
"[",
"]",
"byte",
")",
"error",
"{",
"r",
":=",
"jlexer",
".",
"Lexer",
"{",
"Data",
":",
"data",
"}",
"\n",
"easyjsonC5a4559bDecodeGithubComChromedpCdprotoCss24",
"(",
"&",
"r",
",",
"v",
")",
"\n",
"return",
"r",
".",
"<mask>",
"(",
")",
"\n",
"}"
] |
14,565 | all-14566 | [
"isValid",
"checks",
"that",
"the",
"controller",
"and",
"method",
"specifies",
"will",
"sucessfully",
"execute",
"if",
"getResponse",
"is",
"called",
"on",
"it"
] | [
"func",
"(",
"handler",
"ControllerHandler",
")",
"isValid",
"(",
")",
"bool",
"{",
"controller",
":=",
"handler",
".",
"factory",
"(",
")",
"\n",
"rController",
":=",
"reflect",
".",
"ValueOf",
"(",
"controller",
")",
"\n",
"method",
":=",
"rController",
".",
"MethodByName",
"(",
"handler",
".",
"methodName",
")",
"\n",
"if",
"(",
"method",
"==",
"reflect",
".",
"Value",
"{",
"}",
")",
"{",
"panic",
"(",
"\"",
"\"",
"+",
"handler",
".",
"methodName",
")",
"\n",
"}",
"\n",
"typeOfMethod",
":=",
"method",
".",
"<mask>",
"(",
")",
"\n\n",
"var",
"r",
"*",
"Response",
"\n",
"responseType",
":=",
"reflect",
".",
"TypeOf",
"(",
"r",
")",
".",
"Elem",
"(",
")",
"\n\n",
"return",
"(",
"method",
".",
"Kind",
"(",
")",
"==",
"reflect",
".",
"Func",
")",
"&&",
"(",
"typeOfMethod",
".",
"NumMethod",
"(",
")",
"==",
"0",
")",
"&&",
"(",
"typeOfMethod",
".",
"NumOut",
"(",
")",
"==",
"1",
")",
"&&",
"typeOfMethod",
".",
"Out",
"(",
"0",
")",
"==",
"responseType",
"\n\n",
"}"
] |
14,566 | all-14567 | [
"gzipped",
"returns",
"whether",
"the",
"file",
"is",
"gzip",
"-",
"encoded",
"in",
"GCS"
] | [
"func",
"(",
"a",
"*",
"GCSArtifact",
")",
"gzipped",
"(",
")",
"(",
"bool",
",",
"error",
")",
"{",
"attrs",
",",
"err",
":=",
"a",
".",
"<mask>",
".",
"Attrs",
"(",
"a",
".",
"ctx",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"false",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"}",
"\n",
"return",
"attrs",
".",
"ContentEncoding",
"==",
"\"",
"\"",
",",
"nil",
"\n",
"}"
] |
14,567 | all-14568 | [
"UnmarshalSecp256k1PrivateKey",
"returns",
"a",
"private",
"key",
"from",
"bytes"
] | [
"func",
"UnmarshalSecp256k1PrivateKey",
"(",
"data",
"[",
"]",
"byte",
")",
"(",
"PrivKey",
",",
"error",
")",
"{",
"if",
"len",
"(",
"data",
")",
"!=",
"btcec",
".",
"PrivKeyBytesLen",
"{",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"btcec",
".",
"PrivKeyBytesLen",
")",
"\n",
"}",
"\n\n",
"privk",
",",
"_",
":=",
"btcec",
".",
"PrivKeyFromBytes",
"(",
"btcec",
".",
"S256",
"(",
")",
",",
"<mask>",
")",
"\n",
"return",
"(",
"*",
"Secp256k1PrivateKey",
")",
"(",
"privk",
")",
",",
"nil",
"\n",
"}"
] |
14,568 | all-14569 | [
"Compare",
"returns",
"-",
"1",
"/",
"0",
"/",
"+",
"1",
"iff",
"v",
"is",
"less",
"than",
"/",
"equal",
"/",
"greater",
"than",
"major",
".",
"minor"
] | [
"func",
"(",
"v",
"ServerVersion",
")",
"Compare",
"(",
"major",
",",
"minor",
"int",
")",
"int",
"{",
"a",
":=",
"v",
".",
"Major",
"\n",
"b",
":=",
"major",
"\n\n",
"if",
"a",
"==",
"b",
"{",
"a",
"=",
"v",
".",
"Minor",
"\n",
"b",
"=",
"minor",
"\n",
"}",
"\n\n",
"var",
"res",
"int",
"\n",
"if",
"a",
">",
"b",
"{",
"<mask>",
"=",
"1",
"\n",
"}",
"else",
"if",
"a",
"==",
"b",
"{",
"res",
"=",
"0",
"\n",
"}",
"else",
"{",
"res",
"=",
"-",
"1",
"\n",
"}",
"\n",
"return",
"res",
"\n",
"}"
] |
14,569 | all-14570 | [
"Tabulate",
"transforms",
"the",
"ResultsSets",
"and",
"returns",
"a",
"slice",
"of",
"Row"
] | [
"func",
"(",
"t",
"*",
"TabularResults",
")",
"Tabulate",
"(",
"results",
"[",
"]",
"ResultSet",
")",
"[",
"]",
"Row",
"{",
"var",
"rows",
"[",
"]",
"Row",
"\n",
"startTime",
":=",
"time",
".",
"Unix",
"(",
"0",
",",
"0",
")",
"\n\n",
"for",
"_",
",",
"bucket",
":=",
"range",
"results",
"{",
"if",
"len",
"(",
"bucket",
")",
">",
"0",
"{",
"var",
"elapsedTime",
"time",
".",
"Duration",
"\n\n",
"if",
"startTime",
"==",
"time",
".",
"Unix",
"(",
"0",
",",
"0",
")",
"{",
"startTime",
"=",
"bucket",
"[",
"0",
"]",
".",
"Timestamp",
"\n",
"}",
"\n",
"elapsedTime",
"=",
"bucket",
"[",
"0",
"]",
".",
"Timestamp",
".",
"Sub",
"(",
"startTime",
")",
"\n\n",
"row",
":=",
"Row",
"{",
"StartTime",
":",
"bucket",
"[",
"0",
"]",
".",
"Timestamp",
",",
"ElapsedTime",
":",
"elapsedTime",
",",
"Threads",
":",
"0",
",",
"TotalRequests",
":",
"0",
",",
"TotalFailures",
":",
"0",
",",
"TotalSuccess",
":",
"0",
",",
"TotalTimeouts",
":",
"0",
",",
"AvgRequestTime",
":",
"0",
",",
"}",
"\n\n",
"totalRequestTime",
":=",
"0",
"*",
"time",
".",
"Second",
"\n",
"maxThreads",
":=",
"0",
"\n\n",
"for",
"_",
",",
"r",
":=",
"range",
"bucket",
"{",
"row",
".",
"TotalRequests",
"++",
"\n\n",
"if",
"r",
".",
"Error",
"!=",
"nil",
"{",
"if",
"_",
",",
"ok",
":=",
"r",
".",
"Error",
".",
"(",
"errors",
".",
"Timeout",
")",
";",
"ok",
"{",
"row",
".",
"TotalTimeouts",
"++",
"\n",
"}",
"\n\n",
"row",
".",
"TotalFailures",
"++",
"\n",
"}",
"else",
"{",
"<mask>",
".",
"TotalSuccess",
"++",
"\n",
"totalRequestTime",
"+=",
"r",
".",
"RequestTime",
"\n",
"}",
"\n\n",
"if",
"r",
".",
"Threads",
">",
"maxThreads",
"{",
"maxThreads",
"=",
"r",
".",
"Threads",
"\n",
"row",
".",
"Threads",
"=",
"maxThreads",
"\n",
"}",
"\n",
"}",
"\n\n",
"if",
"totalRequestTime",
"!=",
"0",
"&&",
"row",
".",
"TotalSuccess",
"!=",
"0",
"{",
"avgTime",
":=",
"int64",
"(",
"totalRequestTime",
")",
"/",
"int64",
"(",
"row",
".",
"TotalSuccess",
")",
"\n",
"row",
".",
"AvgRequestTime",
"=",
"time",
".",
"Duration",
"(",
"avgTime",
")",
"\n",
"}",
"\n\n",
"rows",
"=",
"append",
"(",
"rows",
",",
"row",
")",
"\n",
"}",
"\n",
"}",
"\n\n",
"return",
"rows",
"\n",
"}"
] |
14,570 | all-14571 | [
"Discrete",
"implements",
"instruments",
".",
"Reporter"
] | [
"func",
"(",
"r",
"*",
"Reporter",
")",
"Discrete",
"(",
"name",
"string",
",",
"tags",
"[",
"]",
"string",
",",
"val",
"float64",
")",
"error",
"{",
"metric",
":=",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"name",
",",
"strings",
".",
"Join",
"(",
"tags",
",",
"\"",
"\"",
")",
",",
"val",
")",
"\n",
"r",
".",
"metrics",
"=",
"<mask>",
"(",
"r",
".",
"metrics",
",",
"metric",
")",
"\n",
"return",
"nil",
"\n",
"}"
] |
14,571 | all-14572 | [
"GetTitleAlignOk",
"returns",
"a",
"tuple",
"with",
"the",
"TitleAlign",
"field",
"if",
"it",
"s",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"and",
"a",
"boolean",
"to",
"check",
"if",
"the",
"value",
"has",
"been",
"set",
"."
] | [
"func",
"(",
"e",
"*",
"EventStreamDefinition",
")",
"GetTitleAlignOk",
"(",
")",
"(",
"string",
",",
"bool",
")",
"{",
"if",
"e",
"==",
"nil",
"||",
"e",
".",
"TitleAlign",
"==",
"nil",
"{",
"return",
"\"",
"\"",
",",
"<mask>",
"\n",
"}",
"\n",
"return",
"*",
"e",
".",
"TitleAlign",
",",
"true",
"\n",
"}"
] |
14,572 | all-14573 | [
"newScreenFramebuffer",
"creates",
"a",
"framebuffer",
"for",
"the",
"screen",
"."
] | [
"func",
"newScreenFramebuffer",
"(",
"context",
"*",
"context",
",",
"width",
",",
"height",
"int",
")",
"*",
"framebuffer",
"{",
"return",
"&",
"framebuffer",
"{",
"native",
":",
"context",
".",
"getScreenFramebuffer",
"(",
")",
",",
"width",
":",
"<mask>",
",",
"height",
":",
"height",
",",
"}",
"\n",
"}"
] |
14,573 | all-14574 | [
"diffNewOld",
"returns",
"any",
"elements",
"of",
"new",
"that",
"were",
"missing",
"in",
"old",
"."
] | [
"func",
"(",
"p",
"*",
"nasDatastoreMountProcessor",
")",
"diffNewOld",
"(",
")",
"[",
"]",
"<mask>",
"{",
"return",
"p",
".",
"diff",
"(",
"p",
".",
"newHSIDs",
",",
"p",
".",
"oldHSIDs",
")",
"\n",
"}"
] |
14,574 | all-14575 | [
"FindRuleWithOverride",
"searches",
"the",
"current",
"configuration",
"for",
"user",
"-",
"specified",
"dependency",
"resolution",
"overrides",
".",
"Overrides",
"specified",
"later",
"(",
"in",
"configuration",
"files",
"in",
"deeper",
"directories",
"or",
"closer",
"to",
"the",
"end",
"of",
"the",
"file",
")",
"are",
"returned",
"first",
".",
"If",
"no",
"override",
"is",
"found",
"label",
".",
"NoLabel",
"is",
"returned",
"."
] | [
"func",
"FindRuleWithOverride",
"(",
"c",
"*",
"config",
".",
"Config",
",",
"imp",
"ImportSpec",
",",
"lang",
"string",
")",
"(",
"label",
".",
"Label",
",",
"bool",
")",
"{",
"rc",
":=",
"getResolveConfig",
"(",
"c",
")",
"\n",
"for",
"i",
":=",
"len",
"(",
"rc",
".",
"overrides",
")",
"-",
"1",
";",
"i",
">=",
"0",
";",
"i",
"--",
"{",
"o",
":=",
"rc",
".",
"overrides",
"[",
"i",
"]",
"\n",
"if",
"o",
".",
"matches",
"(",
"imp",
",",
"lang",
")",
"{",
"return",
"o",
".",
"dep",
",",
"true",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"<mask>",
".",
"NoLabel",
",",
"false",
"\n",
"}"
] |
14,575 | all-14576 | [
"HasSearch",
"returns",
"a",
"boolean",
"if",
"a",
"field",
"has",
"been",
"set",
"."
] | [
"func",
"(",
"w",
"*",
"WidgetApmOrLogQuery",
")",
"HasSearch",
"(",
")",
"bool",
"{",
"if",
"w",
"!=",
"nil",
"&&",
"w",
".",
"Search",
"!=",
"nil",
"{",
"return",
"true",
"\n",
"}",
"\n\n",
"return",
"<mask>",
"\n",
"}"
] |
14,576 | all-14577 | [
"SetBytesKV",
"sets",
"key",
"=",
"value",
"argument",
"."
] | [
"func",
"(",
"a",
"*",
"Args",
")",
"SetBytesKV",
"(",
"key",
",",
"value",
"[",
"]",
"byte",
")",
"{",
"a",
".",
"args",
"=",
"setArgBytes",
"(",
"a",
".",
"args",
",",
"<mask>",
",",
"value",
",",
"argsHasValue",
")",
"\n",
"}"
] |
14,577 | all-14578 | [
"SetString",
"is",
"a",
"wrapper",
"around",
"g_settings_set_string",
"()",
"."
] | [
"func",
"(",
"v",
"*",
"Settings",
")",
"SetString",
"(",
"name",
"string",
",",
"value",
"string",
")",
"bool",
"{",
"cstr1",
":=",
"(",
"*",
"C",
".",
"gchar",
")",
"(",
"C",
".",
"CString",
"(",
"name",
")",
")",
"\n",
"defer",
"C",
".",
"free",
"(",
"unsafe",
".",
"Pointer",
"(",
"cstr1",
")",
")",
"\n\n",
"cstr2",
":=",
"(",
"*",
"C",
".",
"gchar",
")",
"(",
"C",
".",
"CString",
"(",
"<mask>",
")",
")",
"\n",
"defer",
"C",
".",
"free",
"(",
"unsafe",
".",
"Pointer",
"(",
"cstr2",
")",
")",
"\n\n",
"return",
"gobool",
"(",
"C",
".",
"g_settings_set_string",
"(",
"v",
".",
"native",
"(",
")",
",",
"cstr1",
",",
"cstr2",
")",
")",
"\n",
"}"
] |
14,578 | all-14579 | [
"StartSession",
"creates",
"a",
"new",
"client",
"session",
"."
] | [
"func",
"(",
"h",
"*",
"Handler",
")",
"StartSession",
"(",
"product",
",",
"productPassword",
",",
"clientKey",
",",
"ip",
"string",
",",
"port",
"uint16",
")",
"(",
"*",
"data",
".",
"Offering",
",",
"error",
")",
"{",
"logger",
":=",
"h",
".",
"logger",
".",
"Add",
"(",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"product",
",",
"\"",
"\"",
",",
"clientKey",
",",
"\"",
"\"",
",",
"ip",
",",
"\"",
"\"",
",",
"port",
")",
"\n\n",
"logger",
".",
"Info",
"(",
"\"",
"\"",
")",
"\n\n",
"prod",
",",
"err",
":=",
"h",
".",
"checkProductPassword",
"(",
"logger",
",",
"product",
",",
"productPassword",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"ch",
",",
"err",
":=",
"h",
".",
"findClientChannel",
"(",
"logger",
",",
"prod",
",",
"clientKey",
",",
"true",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"var",
"offer",
"data",
".",
"Offering",
"\n",
"if",
"err",
":=",
"h",
".",
"db",
".",
"FindByPrimaryKeyTo",
"(",
"&",
"offer",
",",
"ch",
".",
"Offering",
")",
";",
"err",
"!=",
"nil",
"{",
"logger",
".",
"Error",
"(",
"err",
".",
"Error",
"(",
")",
")",
"\n",
"return",
"nil",
",",
"ErrInternal",
"\n",
"}",
"\n\n",
"<mask>",
":=",
"time",
".",
"Now",
"(",
")",
"\n\n",
"var",
"ipPtr",
"*",
"string",
"\n",
"if",
"len",
"(",
"ip",
")",
"!=",
"0",
"{",
"ipPtr",
"=",
"pointer",
".",
"ToString",
"(",
"ip",
")",
"\n",
"}",
"\n\n",
"var",
"portPtr",
"*",
"uint16",
"\n",
"if",
"port",
"!=",
"0",
"{",
"portPtr",
"=",
"pointer",
".",
"ToUint16",
"(",
"port",
")",
"\n",
"}",
"\n\n",
"err",
"=",
"h",
".",
"db",
".",
"InTransaction",
"(",
"func",
"(",
"tx",
"*",
"reform",
".",
"TX",
")",
"error",
"{",
"sess",
":=",
"data",
".",
"Session",
"{",
"ID",
":",
"util",
".",
"NewUUID",
"(",
")",
",",
"Channel",
":",
"ch",
".",
"ID",
",",
"Started",
":",
"now",
",",
"LastUsageTime",
":",
"now",
",",
"ClientIP",
":",
"ipPtr",
",",
"ClientPort",
":",
"portPtr",
",",
"}",
"\n",
"if",
"err",
":=",
"tx",
".",
"Insert",
"(",
"&",
"sess",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"if",
"ch",
".",
"ServiceStatus",
"==",
"data",
".",
"ServiceActivating",
"{",
"err",
":=",
"job",
".",
"AddWithData",
"(",
"h",
".",
"queue",
",",
"tx",
",",
"data",
".",
"JobClientCompleteServiceTransition",
",",
"data",
".",
"JobChannel",
",",
"ch",
".",
"ID",
",",
"data",
".",
"JobSessionServer",
",",
"data",
".",
"ServiceActive",
")",
"\n",
"if",
"err",
"!=",
"nil",
"&&",
"err",
"!=",
"job",
".",
"ErrDuplicatedJob",
"{",
"return",
"err",
"\n",
"}",
"\n",
"}",
"\n\n",
"return",
"nil",
"\n",
"}",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"logger",
".",
"Error",
"(",
"err",
".",
"Error",
"(",
")",
")",
"\n",
"return",
"nil",
",",
"ErrInternal",
"\n",
"}",
"\n\n",
"return",
"&",
"offer",
",",
"nil",
"\n",
"}"
] |
14,579 | all-14580 | [
"Close",
"removes",
"subscriber",
"from",
"channel",
"."
] | [
"func",
"(",
"s",
"*",
"<mask>",
")",
"Close",
"(",
")",
"error",
"{",
"go",
"func",
"(",
")",
"{",
"for",
"_",
",",
"c",
":=",
"range",
"s",
".",
"channels",
"{",
"c",
".",
"unsubscribe",
"<-",
"s",
"\n",
"}",
"\n",
"}",
"(",
")",
"\n",
"go",
"func",
"(",
")",
"{",
"s",
".",
"closed",
"<-",
"true",
"\n",
"close",
"(",
"s",
".",
"send",
")",
"\n",
"}",
"(",
")",
"\n",
"return",
"nil",
"\n",
"}"
] |
14,580 | all-14581 | [
"getTaskEventsUnsafe",
"gets",
"the",
"event",
"list",
"for",
"the",
"task",
"arn",
"in",
"the",
"sendableEvent",
"from",
"taskToEvent",
"map"
] | [
"func",
"(",
"handler",
"*",
"TaskHandler",
")",
"getTaskEventsUnsafe",
"(",
"event",
"*",
"sendableEvent",
")",
"*",
"taskSendableEvents",
"{",
"taskARN",
":=",
"event",
".",
"taskArn",
"(",
")",
"\n",
"taskEvents",
",",
"ok",
":=",
"handler",
".",
"tasksToEvents",
"[",
"taskARN",
"]",
"\n\n",
"if",
"!",
"ok",
"{",
"// We are not tracking this task arn in the tasksToEvents map. Create",
"// a new entry",
"taskEvents",
"=",
"&",
"taskSendableEvents",
"{",
"events",
":",
"<mask>",
".",
"New",
"(",
")",
",",
"sending",
":",
"false",
",",
"createdAt",
":",
"time",
".",
"Now",
"(",
")",
",",
"taskARN",
":",
"taskARN",
",",
"}",
"\n",
"handler",
".",
"tasksToEvents",
"[",
"taskARN",
"]",
"=",
"taskEvents",
"\n",
"seelog",
".",
"Debugf",
"(",
"\"",
"\"",
",",
"event",
".",
"toString",
"(",
")",
",",
"taskEvents",
".",
"toStringUnsafe",
"(",
")",
")",
"\n",
"}",
"\n\n",
"return",
"taskEvents",
"\n",
"}"
] |
14,581 | all-14582 | [
"HasErrors",
"returns",
"weather",
"FormErrors",
"instance",
"contains",
"at",
"leas",
"one",
"error",
"."
] | [
"func",
"(",
"f",
"FormErrors",
")",
"HasErrors",
"(",
")",
"bool",
"{",
"if",
"len",
"(",
"f",
".",
"Errors",
")",
">",
"0",
"{",
"return",
"true",
"\n",
"}",
"\n",
"for",
"_",
",",
"v",
":=",
"range",
"f",
".",
"FieldErrors",
"{",
"if",
"len",
"(",
"v",
")",
">",
"0",
"{",
"return",
"<mask>",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"false",
"\n",
"}"
] |
14,582 | all-14583 | [
"NewAWSSDProvider",
"initializes",
"a",
"new",
"AWS",
"Route53",
"Auto",
"Naming",
"based",
"Provider",
"."
] | [
"func",
"NewAWSSDProvider",
"(",
"domainFilter",
"DomainFilter",
",",
"namespaceType",
"string",
",",
"assumeRole",
"string",
",",
"dryRun",
"bool",
")",
"(",
"*",
"AWSSDProvider",
",",
"error",
")",
"{",
"config",
":=",
"aws",
".",
"NewConfig",
"(",
")",
"\n\n",
"config",
"=",
"config",
".",
"WithHTTPClient",
"(",
"instrumented_http",
".",
"NewClient",
"(",
"config",
".",
"HTTPClient",
",",
"&",
"instrumented_http",
".",
"Callbacks",
"{",
"PathProcessor",
":",
"func",
"(",
"path",
"string",
")",
"string",
"{",
"<mask>",
":=",
"strings",
".",
"Split",
"(",
"path",
",",
"\"",
"\"",
")",
"\n",
"return",
"parts",
"[",
"len",
"(",
"parts",
")",
"-",
"1",
"]",
"\n",
"}",
",",
"}",
")",
",",
")",
"\n\n",
"sess",
",",
"err",
":=",
"session",
".",
"NewSessionWithOptions",
"(",
"session",
".",
"Options",
"{",
"Config",
":",
"*",
"config",
",",
"SharedConfigState",
":",
"session",
".",
"SharedConfigEnable",
",",
"}",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"if",
"assumeRole",
"!=",
"\"",
"\"",
"{",
"log",
".",
"Infof",
"(",
"\"",
"\"",
",",
"assumeRole",
")",
"\n",
"sess",
".",
"Config",
".",
"WithCredentials",
"(",
"stscreds",
".",
"NewCredentials",
"(",
"sess",
",",
"assumeRole",
")",
")",
"\n",
"}",
"\n\n",
"sess",
".",
"Handlers",
".",
"Build",
".",
"PushBack",
"(",
"request",
".",
"MakeAddToUserAgentHandler",
"(",
"\"",
"\"",
",",
"externaldns",
".",
"Version",
")",
")",
"\n\n",
"provider",
":=",
"&",
"AWSSDProvider",
"{",
"client",
":",
"sd",
".",
"New",
"(",
"sess",
")",
",",
"namespaceFilter",
":",
"domainFilter",
",",
"namespaceTypeFilter",
":",
"newSdNamespaceFilter",
"(",
"namespaceType",
")",
",",
"dryRun",
":",
"dryRun",
",",
"}",
"\n\n",
"return",
"provider",
",",
"nil",
"\n",
"}"
] |
14,583 | all-14584 | [
"SetLimit",
"redefines",
"the",
"limit",
"of",
"the",
"app",
".",
"The",
"new",
"limit",
"must",
"be",
"bigger",
"than",
"or",
"equal",
"to",
"the",
"current",
"number",
"of",
"units",
"in",
"the",
"app",
".",
"The",
"new",
"limit",
"may",
"be",
"smaller",
"than",
"0",
"which",
"means",
"that",
"the",
"app",
"should",
"have",
"an",
"unlimited",
"number",
"of",
"units",
".",
"SetLimit",
"implements",
"SetLimit",
"method",
"from",
"QuotaService",
"interface"
] | [
"func",
"(",
"s",
"*",
"QuotaService",
")",
"SetLimit",
"(",
"appName",
"string",
",",
"limit",
"int",
")",
"error",
"{",
"q",
",",
"err",
":=",
"s",
".",
"<mask>",
".",
"Get",
"(",
"appName",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"if",
"limit",
"<",
"0",
"{",
"limit",
"=",
"-",
"1",
"\n",
"}",
"else",
"if",
"limit",
"<",
"q",
".",
"InUse",
"{",
"return",
"quota",
".",
"ErrLimitLowerThanAllocated",
"\n",
"}",
"\n",
"return",
"s",
".",
"Storage",
".",
"SetLimit",
"(",
"appName",
",",
"limit",
")",
"\n",
"}"
] |
14,584 | all-14585 | [
"/",
"*",
"save",
"image",
"to",
"file"
] | [
"func",
"SaveImage",
"(",
"filename",
"string",
",",
"image",
"*",
"IplImage",
",",
"params",
"[",
"]",
"int",
")",
"int",
"{",
"name_c",
":=",
"C",
".",
"CString",
"(",
"<mask>",
")",
"\n",
"defer",
"C",
".",
"free",
"(",
"unsafe",
".",
"Pointer",
"(",
"name_c",
")",
")",
"\n",
"var",
"firstParam",
"*",
"C",
".",
"int",
"\n",
"if",
"len",
"(",
"params",
")",
">",
"0",
"{",
"var",
"params_c",
"[",
"]",
"C",
".",
"int",
"\n",
"for",
"_",
",",
"param",
":=",
"range",
"params",
"{",
"params_c",
"=",
"append",
"(",
"params_c",
",",
"C",
".",
"int",
"(",
"param",
")",
")",
"\n",
"}",
"\n",
"firstParam",
"=",
"&",
"params_c",
"[",
"0",
"]",
"\n",
"}",
"\n",
"rv",
":=",
"C",
".",
"cvSaveImage",
"(",
"name_c",
",",
"unsafe",
".",
"Pointer",
"(",
"image",
")",
",",
"firstParam",
")",
"\n",
"return",
"int",
"(",
"rv",
")",
"\n",
"}"
] |
14,585 | all-14586 | [
"Do",
"executes",
"ServiceWorker",
".",
"startWorker",
"against",
"the",
"provided",
"context",
"."
] | [
"func",
"(",
"p",
"*",
"StartWorkerParams",
")",
"Do",
"(",
"ctx",
"<mask>",
".",
"Context",
")",
"(",
"err",
"error",
")",
"{",
"return",
"cdp",
".",
"Execute",
"(",
"ctx",
",",
"CommandStartWorker",
",",
"p",
",",
"nil",
")",
"\n",
"}"
] |
14,586 | all-14587 | [
"GetNameOk",
"returns",
"a",
"tuple",
"with",
"the",
"Name",
"field",
"if",
"it",
"s",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"and",
"a",
"boolean",
"to",
"check",
"if",
"the",
"value",
"has",
"been",
"set",
"."
] | [
"func",
"(",
"s",
"*",
"SyntheticsDevice",
")",
"GetNameOk",
"(",
")",
"(",
"string",
",",
"bool",
")",
"{",
"if",
"s",
"==",
"nil",
"||",
"s",
".",
"<mask>",
"==",
"nil",
"{",
"return",
"\"",
"\"",
",",
"false",
"\n",
"}",
"\n",
"return",
"*",
"s",
".",
"Name",
",",
"true",
"\n",
"}"
] |
14,587 | all-14588 | [
"sort",
"must",
"be",
"called",
"after",
"all",
"the",
"adds",
"but",
"before",
"any",
"find",
"."
] | [
"func",
"(",
"t",
"*",
"funcTab",
")",
"sort",
"(",
")",
"{",
"sort",
".",
"Slice",
"(",
"t",
".",
"entries",
",",
"func",
"(",
"i",
",",
"j",
"int",
")",
"bool",
"{",
"return",
"t",
".",
"entries",
"[",
"i",
"]",
".",
"min",
"<",
"t",
".",
"entries",
"[",
"j",
"]",
".",
"<mask>",
"\n",
"}",
")",
"\n",
"}"
] |
14,588 | all-14589 | [
"ReceiveIssueEvent",
"adds",
"issue",
"events",
"to",
"InfluxDB"
] | [
"func",
"(",
"e",
"*",
"EventCounterPlugin",
")",
"ReceiveIssueEvent",
"(",
"event",
"sql",
".",
"IssueEvent",
")",
"[",
"]",
"Point",
"{",
"var",
"label",
"string",
"\n",
"if",
"event",
".",
"Label",
"!=",
"nil",
"{",
"label",
"=",
"*",
"event",
".",
"Label",
"\n",
"}",
"\n\n",
"if",
"!",
"e",
".",
"matcher",
".",
"Match",
"(",
"event",
".",
"Event",
",",
"label",
")",
"{",
"return",
"nil",
"\n",
"}",
"\n",
"return",
"[",
"]",
"<mask>",
"{",
"{",
"Values",
":",
"map",
"[",
"string",
"]",
"interface",
"{",
"}",
"{",
"\"",
"\"",
":",
"1",
"}",
",",
"Date",
":",
"event",
".",
"EventCreatedAt",
",",
"}",
",",
"}",
"\n",
"}"
] |
14,589 | all-14590 | [
"ModifyLease",
"modifies",
"the",
"lease",
"of",
"a",
"task",
".",
"Used",
"to",
"request",
"more",
"processing",
"time",
"or",
"to",
"abandon",
"processing",
".",
"leaseTime",
"is",
"in",
"seconds",
"and",
"must",
"not",
"be",
"negative",
"."
] | [
"func",
"ModifyLease",
"(",
"c",
"context",
".",
"Context",
",",
"task",
"*",
"Task",
",",
"queueName",
"string",
",",
"leaseTime",
"int",
")",
"error",
"{",
"if",
"queueName",
"==",
"\"",
"\"",
"{",
"queueName",
"=",
"\"",
"\"",
"\n",
"}",
"\n",
"req",
":=",
"&",
"pb",
".",
"TaskQueueModifyTaskLeaseRequest",
"{",
"QueueName",
":",
"[",
"]",
"byte",
"(",
"queueName",
")",
",",
"TaskName",
":",
"[",
"]",
"byte",
"(",
"task",
".",
"Name",
")",
",",
"EtaUsec",
":",
"proto",
".",
"Int64",
"(",
"task",
".",
"ETA",
".",
"UnixNano",
"(",
")",
"/",
"1e3",
")",
",",
"// Used to verify ownership.",
"LeaseSeconds",
":",
"proto",
".",
"Float64",
"(",
"float64",
"(",
"leaseTime",
")",
")",
",",
"}",
"\n",
"res",
":=",
"&",
"pb",
".",
"TaskQueueModifyTaskLeaseResponse",
"{",
"}",
"\n",
"if",
"err",
":=",
"internal",
".",
"Call",
"(",
"c",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"req",
",",
"res",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"<mask>",
".",
"ETA",
"=",
"time",
".",
"Unix",
"(",
"0",
",",
"*",
"res",
".",
"UpdatedEtaUsec",
"*",
"1e3",
")",
"\n",
"return",
"nil",
"\n",
"}"
] |
14,590 | all-14591 | [
"GetTitleSize",
"returns",
"the",
"TitleSize",
"field",
"if",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"."
] | [
"func",
"(",
"d",
"*",
"DistributionDefinition",
")",
"GetTitleSize",
"(",
")",
"string",
"{",
"if",
"d",
"==",
"nil",
"||",
"d",
".",
"TitleSize",
"==",
"nil",
"{",
"<mask>",
"\"",
"\"",
"\n",
"}",
"\n",
"return",
"*",
"d",
".",
"TitleSize",
"\n",
"}"
] |
14,591 | all-14592 | [
"DomainRedirectHandler",
"responds",
"with",
"redirect",
"url",
"based",
"on",
"domain",
"and",
"httpsPort",
"othervise",
"it",
"executes",
"the",
"handler",
"."
] | [
"func",
"DomainRedirectHandler",
"(",
"h",
"http",
".",
"Handler",
",",
"domain",
",",
"httpsPort",
"string",
")",
"http",
".",
"Handler",
"{",
"if",
"domain",
"==",
"\"",
"\"",
"&&",
"httpsPort",
"==",
"\"",
"\"",
"{",
"return",
"h",
"\n",
"}",
"\n\n",
"scheme",
":=",
"\"",
"\"",
"\n",
"port",
":=",
"\"",
"\"",
"\n",
"if",
"httpsPort",
"!=",
"\"",
"\"",
"{",
"if",
"_",
",",
"err",
":=",
"strconv",
".",
"Atoi",
"(",
"httpsPort",
")",
";",
"err",
"==",
"nil",
"{",
"scheme",
"=",
"\"",
"\"",
"\n",
"port",
"=",
"httpsPort",
"\n",
"}",
"\n",
"if",
"_",
",",
"p",
",",
"err",
":=",
"net",
".",
"SplitHostPort",
"(",
"httpsPort",
")",
";",
"err",
"==",
"nil",
"{",
"scheme",
"=",
"\"",
"\"",
"\n",
"port",
"=",
"p",
"\n",
"}",
"\n",
"}",
"\n",
"if",
"port",
"==",
"\"",
"\"",
"{",
"port",
"=",
"\"",
"\"",
"\n",
"}",
"\n",
"var",
"altDomain",
"string",
"\n",
"if",
"strings",
".",
"HasPrefix",
"(",
"\"",
"\"",
",",
"domain",
")",
"{",
"altDomain",
"=",
"strings",
".",
"TrimPrefix",
"(",
"domain",
",",
"\"",
"\"",
")",
"\n",
"}",
"else",
"{",
"altDomain",
"=",
"\"",
"\"",
"+",
"domain",
"\n",
"}",
"\n",
"return",
"http",
".",
"HandlerFunc",
"(",
"func",
"(",
"w",
"http",
".",
"ResponseWriter",
",",
"r",
"*",
"http",
".",
"Request",
")",
"{",
"d",
",",
"p",
",",
"err",
":=",
"net",
".",
"SplitHostPort",
"(",
"r",
".",
"Host",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"d",
"=",
"r",
".",
"Host",
"\n",
"}",
"\n",
"rs",
":=",
"r",
".",
"URL",
".",
"Scheme",
"\n",
"if",
"fs",
":=",
"r",
".",
"Header",
".",
"Get",
"(",
"\"",
"\"",
")",
";",
"fs",
"!=",
"\"",
"\"",
"{",
"rs",
"=",
"strings",
".",
"ToLower",
"(",
"fs",
")",
"\n",
"}",
"\n",
"s",
":=",
"scheme",
"\n",
"if",
"rs",
"==",
"\"",
"\"",
"{",
"s",
"=",
"\"",
"\"",
"\n",
"}",
"\n",
"if",
"d",
"==",
"domain",
"&&",
"rs",
"==",
"s",
"{",
"h",
".",
"ServeHTTP",
"(",
"w",
",",
"r",
")",
"\n",
"return",
"\n",
"}",
"\n",
"<mask>",
"{",
"case",
"s",
"==",
"\"",
"\"",
"&&",
"p",
"==",
"\"",
"\"",
":",
"p",
"=",
"\"",
"\"",
"\n",
"case",
"s",
"==",
"\"",
"\"",
"&&",
"p",
"==",
"\"",
"\"",
":",
"p",
"=",
"\"",
"\"",
"\n",
"case",
"port",
"!=",
"\"",
"\"",
":",
"p",
"=",
"\"",
"\"",
"+",
"port",
"\n",
"case",
"p",
"!=",
"\"",
"\"",
":",
"p",
"=",
"\"",
"\"",
"+",
"p",
"\n",
"}",
"\n",
"if",
"d",
"==",
"altDomain",
"{",
"http",
".",
"Redirect",
"(",
"w",
",",
"r",
",",
"strings",
".",
"Join",
"(",
"[",
"]",
"string",
"{",
"s",
",",
"\"",
"\"",
",",
"domain",
",",
"p",
",",
"r",
".",
"RequestURI",
"}",
",",
"\"",
"\"",
")",
",",
"http",
".",
"StatusMovedPermanently",
")",
"\n",
"return",
"\n",
"}",
"\n",
"http",
".",
"Redirect",
"(",
"w",
",",
"r",
",",
"strings",
".",
"Join",
"(",
"[",
"]",
"string",
"{",
"s",
",",
"\"",
"\"",
",",
"domain",
",",
"p",
",",
"r",
".",
"RequestURI",
"}",
",",
"\"",
"\"",
")",
",",
"http",
".",
"StatusFound",
")",
"\n",
"}",
")",
"\n",
"}"
] |
14,592 | all-14593 | [
"SetLogger",
"replaces",
"the",
"default",
"logger",
"with",
"a",
"new",
"one",
"that",
"writes",
"to",
"out",
"has",
"prefix",
"and",
"flags",
"flag"
] | [
"func",
"SetLogger",
"(",
"out",
"io",
".",
"Writer",
",",
"prefix",
"string",
",",
"flag",
"int",
")",
"{",
"Log",
"=",
"stdlog",
".",
"New",
"(",
"out",
",",
"prefix",
",",
"<mask>",
")",
"\n",
"}"
] |
14,593 | all-14594 | [
"MarshalJSON",
"supports",
"json",
".",
"Marshaler",
"interface"
] | [
"func",
"(",
"v",
"GetIsolateIDReturns",
")",
"MarshalJSON",
"(",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"w",
":=",
"jwriter",
".",
"Writer",
"{",
"}",
"\n",
"easyjsonC5a4559bEncodeGithubComChromedpCdprotoRuntime23",
"(",
"&",
"w",
",",
"v",
")",
"\n",
"return",
"w",
".",
"<mask>",
".",
"BuildBytes",
"(",
")",
",",
"w",
".",
"Error",
"\n",
"}"
] |
14,594 | all-14595 | [
"snapshotName",
"generates",
"a",
"name",
"for",
"the",
"snapshot",
"."
] | [
"func",
"snapshotName",
"(",
"term",
",",
"index",
"uint64",
")",
"string",
"{",
"<mask>",
":=",
"time",
".",
"Now",
"(",
")",
"\n",
"msec",
":=",
"now",
".",
"UnixNano",
"(",
")",
"/",
"int64",
"(",
"time",
".",
"Millisecond",
")",
"\n",
"return",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"term",
",",
"index",
",",
"msec",
")",
"\n",
"}"
] |
14,595 | all-14596 | [
"TODO",
"(",
"jrick",
")",
"GIcon",
"/",
"*",
"func",
"(",
"v",
"*",
"Entry",
")",
"GetIconGIcon",
"()",
"{",
"}",
"SetIconActivatable",
"()",
"is",
"a",
"wrapper",
"around",
"gtk_entry_set_icon_activatable",
"()",
"."
] | [
"func",
"(",
"v",
"*",
"<mask>",
")",
"SetIconActivatable",
"(",
"iconPos",
"EntryIconPosition",
",",
"activatable",
"bool",
")",
"{",
"C",
".",
"gtk_entry_set_icon_activatable",
"(",
"v",
".",
"native",
"(",
")",
",",
"C",
".",
"GtkEntryIconPosition",
"(",
"iconPos",
")",
",",
"gbool",
"(",
"activatable",
")",
")",
"\n",
"}"
] |
14,596 | all-14597 | [
"allLogLevelsAsStrings",
"returns",
"all",
"logrus",
"levels",
"as",
"a",
"list",
"of",
"strings"
] | [
"func",
"allLogLevelsAsStrings",
"(",
")",
"[",
"]",
"string",
"{",
"var",
"levels",
"[",
"]",
"string",
"\n",
"for",
"_",
",",
"level",
":=",
"range",
"logrus",
".",
"AllLevels",
"{",
"levels",
"=",
"<mask>",
"(",
"levels",
",",
"level",
".",
"String",
"(",
")",
")",
"\n",
"}",
"\n",
"return",
"levels",
"\n",
"}"
] |
14,597 | all-14598 | [
"Get",
"gets",
"the",
"item",
"for",
"the",
"given",
"key",
"and",
"decodes",
"the",
"obtained",
"value",
"into",
"v",
".",
"ErrCacheMiss",
"is",
"returned",
"for",
"a",
"memcache",
"cache",
"miss",
".",
"The",
"key",
"must",
"be",
"at",
"most",
"250",
"bytes",
"in",
"length",
"."
] | [
"func",
"(",
"cd",
"Codec",
")",
"Get",
"(",
"c",
"context",
".",
"Context",
",",
"<mask>",
"string",
",",
"v",
"interface",
"{",
"}",
")",
"(",
"*",
"Item",
",",
"error",
")",
"{",
"i",
",",
"err",
":=",
"Get",
"(",
"c",
",",
"key",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"if",
"err",
":=",
"cd",
".",
"Unmarshal",
"(",
"i",
".",
"Value",
",",
"v",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"return",
"i",
",",
"nil",
"\n",
"}"
] |
14,598 | all-14599 | [
"SetUserAgent",
"sets",
"User",
"-",
"Agent",
"header",
"value",
"."
] | [
"func",
"(",
"h",
"*",
"RequestHeader",
")",
"SetUserAgent",
"(",
"userAgent",
"string",
")",
"{",
"h",
".",
"parseRawHeaders",
"(",
")",
"\n",
"h",
".",
"userAgent",
"=",
"<mask>",
"(",
"h",
".",
"userAgent",
"[",
":",
"0",
"]",
",",
"userAgent",
"...",
")",
"\n",
"}"
] |
14,599 | all-14600 | [
"Set",
"writes",
"the",
"given",
"item",
"unconditionally",
"."
] | [
"func",
"(",
"<mask>",
"Codec",
")",
"Set",
"(",
"c",
"context",
".",
"Context",
",",
"item",
"*",
"Item",
")",
"error",
"{",
"return",
"singleError",
"(",
"cd",
".",
"set",
"(",
"c",
",",
"[",
"]",
"*",
"Item",
"{",
"item",
"}",
",",
"pb",
".",
"MemcacheSetRequest_SET",
")",
")",
"\n",
"}"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.