id
int32 0
25.3k
| idx
stringlengths 5
9
| nl_tokens
sequencelengths 1
418
| pl_tokens
sequencelengths 22
4.98k
|
---|---|---|---|
9,000 | all-9001 | [
"Acquire",
"obtains",
"an",
"additional",
"reference",
"to",
"the",
"socket",
".",
"The",
"socket",
"will",
"only",
"be",
"recycled",
"when",
"it",
"s",
"released",
"as",
"many",
"times",
"as",
"it",
"s",
"been",
"acquired",
"."
] | [
"func",
"(",
"socket",
"*",
"mongoSocket",
")",
"Acquire",
"(",
")",
"(",
"info",
"*",
"mongoServerInfo",
")",
"{",
"socket",
".",
"Lock",
"(",
")",
"\n",
"if",
"<mask>",
".",
"references",
"==",
"0",
"{",
"panic",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"// We'll track references to dead sockets as well.",
"// Caller is still supposed to release the socket.",
"socket",
".",
"references",
"++",
"\n",
"stats",
".",
"socketRefs",
"(",
"+",
"1",
")",
"\n",
"serverInfo",
":=",
"socket",
".",
"serverInfo",
"\n",
"socket",
".",
"Unlock",
"(",
")",
"\n",
"return",
"serverInfo",
"\n",
"}"
] |
9,001 | all-9002 | [
"Apps",
"returns",
"the",
"apps",
"collection",
"from",
"MongoDB",
"."
] | [
"func",
"(",
"s",
"*",
"Storage",
")",
"Apps",
"(",
")",
"*",
"<mask>",
".",
"Collection",
"{",
"nameIndex",
":=",
"mgo",
".",
"Index",
"{",
"Key",
":",
"[",
"]",
"string",
"{",
"\"",
"\"",
"}",
",",
"Unique",
":",
"true",
"}",
"\n",
"c",
":=",
"s",
".",
"Collection",
"(",
"\"",
"\"",
")",
"\n",
"c",
".",
"EnsureIndex",
"(",
"nameIndex",
")",
"\n",
"return",
"c",
"\n",
"}"
] |
9,002 | all-9003 | [
"AssuanSend",
"sends",
"a",
"raw",
"Assuan",
"command",
"to",
"gpg",
"-",
"agent"
] | [
"func",
"(",
"c",
"*",
"Context",
")",
"AssuanSend",
"(",
"cmd",
"string",
",",
"data",
"AssuanDataCallback",
",",
"inquiry",
"AssuanInquireCallback",
",",
"status",
"AssuanStatusCallback",
",",
")",
"error",
"{",
"var",
"operr",
"C",
".",
"gpgme_error_t",
"\n\n",
"dataPtr",
":=",
"callbackAdd",
"(",
"&",
"<mask>",
")",
"\n",
"inquiryPtr",
":=",
"callbackAdd",
"(",
"&",
"inquiry",
")",
"\n",
"statusPtr",
":=",
"callbackAdd",
"(",
"&",
"status",
")",
"\n",
"cmdCStr",
":=",
"C",
".",
"CString",
"(",
"cmd",
")",
"\n",
"defer",
"C",
".",
"free",
"(",
"unsafe",
".",
"Pointer",
"(",
"cmdCStr",
")",
")",
"\n",
"err",
":=",
"C",
".",
"gogpgme_op_assuan_transact_ext",
"(",
"c",
".",
"ctx",
",",
"cmdCStr",
",",
"C",
".",
"uintptr_t",
"(",
"dataPtr",
")",
",",
"C",
".",
"uintptr_t",
"(",
"inquiryPtr",
")",
",",
"C",
".",
"uintptr_t",
"(",
"statusPtr",
")",
",",
"&",
"operr",
",",
")",
"\n\n",
"if",
"handleError",
"(",
"operr",
")",
"!=",
"nil",
"{",
"return",
"handleError",
"(",
"operr",
")",
"\n",
"}",
"\n",
"return",
"handleError",
"(",
"err",
")",
"\n",
"}"
] |
9,003 | all-9004 | [
"lexLineComment",
"scans",
"a",
"line",
"comment",
".",
"Left",
"comment",
"marker",
"is",
"known",
"to",
"be",
"present",
"."
] | [
"func",
"lexLineComment",
"(",
"l",
"*",
"lexer",
")",
"stateFn",
"{",
"l",
".",
"<mask>",
"+=",
"Pos",
"(",
"len",
"(",
"lineComment",
")",
")",
"\n",
"for",
"r",
":=",
"l",
".",
"next",
"(",
")",
";",
"!",
"isEndOfLine",
"(",
"r",
")",
"&&",
"r",
"!=",
"eof",
";",
"{",
"r",
"=",
"l",
".",
"next",
"(",
")",
"\n",
"}",
"\n",
"l",
".",
"backup",
"(",
")",
"\n",
"l",
".",
"emit",
"(",
"ItemComment",
")",
"\n",
"return",
"lexStatements",
"\n",
"}"
] |
9,004 | all-9005 | [
"Equals",
"compares",
"two",
"public",
"keys"
] | [
"func",
"(",
"k",
"*",
"Secp256k1PublicKey",
")",
"Equals",
"(",
"o",
"<mask>",
")",
"bool",
"{",
"sk",
",",
"ok",
":=",
"o",
".",
"(",
"*",
"Secp256k1PublicKey",
")",
"\n",
"if",
"!",
"ok",
"{",
"return",
"false",
"\n",
"}",
"\n\n",
"return",
"(",
"*",
"btcec",
".",
"PublicKey",
")",
"(",
"k",
")",
".",
"IsEqual",
"(",
"(",
"*",
"btcec",
".",
"PublicKey",
")",
"(",
"sk",
")",
")",
"\n",
"}"
] |
9,005 | all-9006 | [
"Specify",
"the",
"value",
"of",
"a",
"uniform",
"variable",
"for",
"the",
"current",
"program",
"object"
] | [
"func",
"UniformMatrix4fv",
"(",
"location",
"int32",
",",
"count",
"int32",
",",
"transpose",
"bool",
",",
"value",
"*",
"float32",
")",
"{",
"syscall",
".",
"Syscall6",
"(",
"gpUniformMatrix4fv",
",",
"4",
",",
"uintptr",
"(",
"<mask>",
")",
",",
"uintptr",
"(",
"count",
")",
",",
"boolToUintptr",
"(",
"transpose",
")",
",",
"uintptr",
"(",
"unsafe",
".",
"Pointer",
"(",
"value",
")",
")",
",",
"0",
",",
"0",
")",
"\n",
"}"
] |
9,006 | all-9007 | [
"Match",
"returns",
"true",
"if",
"patterns",
"matches",
"the",
"string"
] | [
"func",
"Match",
"(",
"s",
",",
"pattern",
"string",
")",
"bool",
"{",
"r",
":=",
"regexp",
".",
"MustCompile",
"(",
"<mask>",
")",
"\n",
"return",
"r",
".",
"MatchString",
"(",
"s",
")",
"\n",
"}"
] |
9,007 | all-9008 | [
"Do",
"executes",
"Storage",
".",
"clearDataForOrigin",
"against",
"the",
"provided",
"context",
"."
] | [
"func",
"(",
"p",
"*",
"ClearDataForOriginParams",
")",
"Do",
"(",
"ctx",
"<mask>",
".",
"Context",
")",
"(",
"err",
"error",
")",
"{",
"return",
"cdp",
".",
"Execute",
"(",
"ctx",
",",
"CommandClearDataForOrigin",
",",
"p",
",",
"nil",
")",
"\n",
"}"
] |
9,008 | all-9009 | [
"Start",
"the",
"server"
] | [
"func",
"(",
"s",
"*",
"Listener",
")",
"Start",
"(",
"c",
"context",
".",
"<mask>",
",",
"h",
"http",
".",
"Handler",
")",
"error",
"{",
"s",
".",
"Handler",
"=",
"h",
"\n",
"return",
"s",
".",
"Serve",
"(",
"s",
".",
"Listener",
")",
"\n",
"}"
] |
9,009 | all-9010 | [
"HasValue",
"returns",
"a",
"boolean",
"if",
"a",
"field",
"has",
"been",
"set",
"."
] | [
"func",
"(",
"d",
"*",
"DashboardConditionalFormat",
")",
"HasValue",
"(",
")",
"bool",
"{",
"if",
"d",
"!=",
"nil",
"&&",
"d",
".",
"Value",
"!=",
"nil",
"{",
"return",
"true",
"\n",
"}",
"\n\n",
"return",
"<mask>",
"\n",
"}"
] |
9,010 | all-9011 | [
"HasEvent",
"returns",
"a",
"boolean",
"if",
"a",
"field",
"has",
"been",
"set",
"."
] | [
"func",
"(",
"r",
"*",
"reqGetEvent",
")",
"HasEvent",
"(",
")",
"bool",
"{",
"if",
"r",
"!=",
"nil",
"&&",
"r",
".",
"<mask>",
"!=",
"nil",
"{",
"return",
"true",
"\n",
"}",
"\n\n",
"return",
"false",
"\n",
"}"
] |
9,011 | all-9012 | [
"GetRGBA",
"()",
"is",
"a",
"wrapper",
"around",
"gtk_color_chooser_get_rgba",
"()",
"."
] | [
"func",
"(",
"v",
"*",
"ColorChooser",
")",
"GetRGBA",
"(",
")",
"*",
"gdk",
".",
"RGBA",
"{",
"gdkColor",
":=",
"gdk",
".",
"NewRGBA",
"(",
")",
"\n",
"C",
".",
"gtk_color_chooser_get_rgba",
"(",
"v",
".",
"native",
"(",
")",
",",
"(",
"*",
"C",
".",
"GdkRGBA",
")",
"(",
"unsafe",
".",
"Pointer",
"(",
"gdkColor",
".",
"Native",
"(",
")",
")",
")",
")",
"\n",
"<mask>",
"gdkColor",
"\n",
"}"
] |
9,012 | all-9013 | [
"MutateCreateAccount",
"for",
"Destination",
"sets",
"the",
"CreateAccountOp",
"s",
"Destination",
"field"
] | [
"func",
"(",
"m",
"Destination",
")",
"MutateCreateAccount",
"(",
"o",
"*",
"xdr",
".",
"CreateAccountOp",
")",
"error",
"{",
"<mask>",
"setAccountId",
"(",
"m",
".",
"AddressOrSeed",
",",
"&",
"o",
".",
"Destination",
")",
"\n",
"}"
] |
9,013 | all-9014 | [
"Info",
"mocks",
"base",
"method"
] | [
"func",
"(",
"m",
"*",
"MockInfoLogger",
")",
"Info",
"(",
"arg0",
"...",
"interface",
"{",
"}",
")",
"{",
"varargs",
":=",
"[",
"]",
"interface",
"{",
"}",
"{",
"}",
"\n",
"for",
"_",
",",
"a",
":=",
"<mask>",
"arg0",
"{",
"varargs",
"=",
"append",
"(",
"varargs",
",",
"a",
")",
"\n",
"}",
"\n",
"m",
".",
"ctrl",
".",
"Call",
"(",
"m",
",",
"\"",
"\"",
",",
"varargs",
"...",
")",
"\n",
"}"
] |
9,014 | all-9015 | [
"Invite",
"sends",
"an",
"invitation",
".",
"If",
"the",
"from",
"address",
"is",
"an",
"empty",
"string",
"the",
"default",
"(",
"yourapp"
] | [
"func",
"Invite",
"(",
"c",
"context",
".",
"Context",
",",
"to",
",",
"from",
"string",
")",
"error",
"{",
"req",
":=",
"&",
"<mask>",
".",
"XmppInviteRequest",
"{",
"Jid",
":",
"&",
"to",
",",
"}",
"\n",
"if",
"from",
"!=",
"\"",
"\"",
"{",
"req",
".",
"FromJid",
"=",
"&",
"from",
"\n",
"}",
"\n",
"res",
":=",
"&",
"pb",
".",
"XmppInviteResponse",
"{",
"}",
"\n",
"return",
"internal",
".",
"Call",
"(",
"c",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"req",
",",
"res",
")",
"\n",
"}"
] |
9,015 | all-9016 | [
"FillStringAt",
"draws",
"the",
"text",
"at",
"the",
"specified",
"point",
"(",
"x",
"y",
")"
] | [
"func",
"(",
"gc",
"*",
"GraphicContext",
")",
"FillStringAt",
"(",
"text",
"string",
",",
"x",
",",
"y",
"float64",
")",
"(",
"cursor",
"float64",
")",
"{",
"return",
"gc",
".",
"drawString",
"(",
"<mask>",
",",
"filled",
",",
"x",
",",
"y",
")",
"\n",
"}"
] |
9,016 | all-9017 | [
"native",
"returns",
"a",
"pointer",
"to",
"the",
"underlying",
"GtkMenuShell",
"."
] | [
"func",
"(",
"v",
"*",
"MenuShell",
")",
"native",
"(",
")",
"*",
"C",
".",
"GtkMenuShell",
"{",
"if",
"v",
"==",
"nil",
"||",
"v",
".",
"GObject",
"==",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n",
"p",
":=",
"unsafe",
".",
"Pointer",
"(",
"v",
".",
"GObject",
")",
"\n",
"<mask>",
"C",
".",
"toGtkMenuShell",
"(",
"p",
")",
"\n",
"}"
] |
9,017 | all-9018 | [
"HasDisplayName",
"returns",
"a",
"boolean",
"if",
"a",
"field",
"has",
"been",
"set",
"."
] | [
"func",
"(",
"s",
"*",
"Series",
")",
"HasDisplayName",
"(",
")",
"bool",
"{",
"if",
"s",
"!=",
"nil",
"&&",
"s",
".",
"DisplayName",
"!=",
"nil",
"{",
"return",
"true",
"\n",
"}",
"\n\n",
"return",
"<mask>",
"\n",
"}"
] |
9,018 | all-9019 | [
"handleMetric",
":",
"Handler",
"for",
"/",
"metric",
"Method",
":",
"GET"
] | [
"func",
"handleMetric",
"(",
"r",
"*",
"ranch",
".",
"Ranch",
")",
"http",
".",
"HandlerFunc",
"{",
"return",
"func",
"(",
"res",
"http",
".",
"ResponseWriter",
",",
"req",
"*",
"http",
".",
"Request",
")",
"{",
"logrus",
".",
"WithField",
"(",
"\"",
"\"",
",",
"\"",
"\"",
")",
".",
"Infof",
"(",
"\"",
"\"",
",",
"req",
".",
"RemoteAddr",
")",
"\n\n",
"if",
"req",
".",
"Method",
"!=",
"http",
".",
"MethodGet",
"{",
"logrus",
".",
"Warningf",
"(",
"\"",
"\"",
",",
"req",
".",
"Method",
")",
"\n",
"http",
".",
"Error",
"(",
"res",
",",
"\"",
"\"",
",",
"http",
".",
"StatusMethodNotAllowed",
")",
"\n",
"return",
"\n",
"}",
"\n\n",
"rtype",
":=",
"req",
".",
"URL",
".",
"Query",
"(",
")",
".",
"Get",
"(",
"\"",
"\"",
")",
"\n",
"if",
"rtype",
"==",
"\"",
"\"",
"{",
"msg",
":=",
"\"",
"\"",
"\n",
"logrus",
".",
"Warning",
"(",
"msg",
")",
"\n",
"http",
".",
"Error",
"(",
"res",
",",
"msg",
",",
"http",
".",
"StatusBadRequest",
")",
"\n",
"return",
"\n",
"}",
"\n\n",
"metric",
",",
"err",
":=",
"r",
".",
"Metric",
"(",
"rtype",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"logrus",
".",
"WithError",
"(",
"err",
")",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"rtype",
")",
"\n",
"http",
".",
"<mask>",
"(",
"res",
",",
"err",
".",
"Error",
"(",
")",
",",
"ErrorToStatus",
"(",
"err",
")",
")",
"\n",
"return",
"\n",
"}",
"\n\n",
"js",
",",
"err",
":=",
"json",
".",
"Marshal",
"(",
"metric",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"logrus",
".",
"WithError",
"(",
"err",
")",
".",
"Error",
"(",
"\"",
"\"",
")",
"\n",
"http",
".",
"Error",
"(",
"res",
",",
"err",
".",
"Error",
"(",
")",
",",
"ErrorToStatus",
"(",
"err",
")",
")",
"\n",
"return",
"\n",
"}",
"\n\n",
"res",
".",
"Header",
"(",
")",
".",
"Set",
"(",
"\"",
"\"",
",",
"\"",
"\"",
")",
"\n",
"res",
".",
"Write",
"(",
"js",
")",
"\n",
"}",
"\n",
"}"
] |
9,019 | all-9020 | [
"ShowActions",
"prints",
"all",
"known",
"actions",
"for",
"an",
"API",
"or",
"the",
"selected",
"resource",
"if",
"any",
"."
] | [
"func",
"(",
"a",
"*",
"API",
")",
"ShowActions",
"(",
"cmd",
",",
"hrefPrefix",
"string",
",",
"values",
"ActionCommands",
")",
"error",
"{",
"res",
",",
"_",
",",
"err",
":=",
"a",
".",
"parseResource",
"(",
"cmd",
",",
"hrefPrefix",
",",
"values",
")",
"\n",
"resource",
":=",
"\"",
"\"",
"\n",
"if",
"err",
"==",
"nil",
"{",
"resource",
"=",
"res",
".",
"Name",
"\n",
"}",
"\n",
"if",
"_",
",",
"ok",
":=",
"a",
".",
"Metadata",
"[",
"hrefPrefix",
"]",
";",
"ok",
"{",
"resource",
"=",
"hrefPrefix",
"\n",
"}",
"\n",
"resNames",
":=",
"make",
"(",
"[",
"]",
"string",
",",
"len",
"(",
"a",
".",
"Metadata",
")",
")",
"\n",
"actionsByRes",
":=",
"make",
"(",
"map",
"[",
"string",
"]",
"[",
"]",
"[",
"]",
"string",
")",
"\n",
"idx",
":=",
"0",
"\n",
"for",
"n",
":=",
"range",
"a",
".",
"Metadata",
"{",
"resNames",
"[",
"idx",
"]",
"=",
"n",
"\n",
"idx",
"++",
"\n",
"}",
"\n",
"sort",
".",
"Strings",
"(",
"resNames",
")",
"\n",
"for",
"_",
",",
"resName",
":=",
"range",
"resNames",
"{",
"actionsByRes",
"[",
"resName",
"]",
"=",
"make",
"(",
"[",
"]",
"[",
"]",
"string",
",",
"0",
")",
"\n",
"res",
":=",
"a",
".",
"Metadata",
"[",
"resName",
"]",
"\n",
"if",
"resource",
"!=",
"\"",
"\"",
"&&",
"resName",
"!=",
"resource",
"{",
"continue",
"\n",
"}",
"\n",
"for",
"_",
",",
"action",
":=",
"range",
"res",
".",
"Actions",
"{",
"for",
"_",
",",
"pattern",
":=",
"range",
"action",
".",
"PathPatterns",
"{",
"vars",
":=",
"pattern",
".",
"Variables",
"\n",
"ivars",
":=",
"make",
"(",
"[",
"]",
"interface",
"{",
"}",
",",
"len",
"(",
"vars",
")",
")",
"\n",
"for",
"i",
",",
"v",
":=",
"range",
"vars",
"{",
"ivars",
"[",
"i",
"]",
"=",
"interface",
"{",
"}",
"(",
"\"",
"\"",
"+",
"v",
")",
"\n",
"}",
"\n",
"subPattern",
":=",
"pattern",
".",
"Pattern",
"\n",
"pat",
":=",
"fmt",
".",
"Sprintf",
"(",
"subPattern",
",",
"ivars",
"...",
")",
"\n",
"var",
"ok",
"bool",
"\n",
"pat",
",",
"ok",
"=",
"shortenPattern",
"(",
"res",
",",
"pat",
",",
"\"",
"\"",
"+",
"<mask>",
".",
"Name",
")",
"\n",
"if",
"!",
"ok",
"{",
"pat",
",",
"_",
"=",
"shortenPattern",
"(",
"res",
",",
"pat",
",",
"\"",
"\"",
"+",
"action",
".",
"Name",
")",
"\n",
"}",
"\n",
"actionsByRes",
"[",
"resName",
"]",
"=",
"append",
"(",
"actionsByRes",
"[",
"resName",
"]",
",",
"[",
"]",
"string",
"{",
"action",
".",
"Name",
",",
"pat",
"}",
")",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n",
"var",
"lines",
"[",
"]",
"string",
"\n",
"actionTitle",
":=",
"\"",
"\"",
"\n",
"hrefTitle",
":=",
"\"",
"\"",
"\n",
"resourceTitle",
":=",
"\"",
"\"",
"\n",
"maxActionLen",
":=",
"len",
"(",
"actionTitle",
")",
"\n",
"maxHrefLen",
":=",
"len",
"(",
"hrefTitle",
")",
"\n",
"maxResourceLen",
":=",
"len",
"(",
"resourceTitle",
")",
"\n",
"for",
"res",
",",
"actions",
":=",
"range",
"actionsByRes",
"{",
"if",
"len",
"(",
"res",
")",
">",
"maxResourceLen",
"{",
"maxResourceLen",
"=",
"len",
"(",
"res",
")",
"\n",
"}",
"\n",
"for",
"_",
",",
"action",
":=",
"range",
"actions",
"{",
"if",
"len",
"(",
"action",
"[",
"0",
"]",
")",
">",
"maxActionLen",
"{",
"maxActionLen",
"=",
"len",
"(",
"action",
"[",
"0",
"]",
")",
"\n",
"}",
"\n",
"if",
"len",
"(",
"action",
"[",
"1",
"]",
")",
">",
"maxHrefLen",
"{",
"maxHrefLen",
"=",
"len",
"(",
"action",
"[",
"1",
"]",
")",
"\n",
"}",
"\n\n",
"}",
"\n",
"}",
"\n",
"for",
"idx",
",",
"resName",
":=",
"range",
"resNames",
"{",
"as",
":=",
"actionsByRes",
"[",
"resName",
"]",
"\n",
"for",
"i",
",",
"action",
":=",
"range",
"as",
"{",
"title",
":=",
"\"",
"\"",
"\n",
"if",
"i",
"==",
"0",
"{",
"title",
"=",
"resName",
"\n",
"if",
"idx",
">",
"0",
"{",
"lines",
"=",
"append",
"(",
"lines",
",",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\\t",
"\\t",
"\"",
",",
"strings",
".",
"Repeat",
"(",
"\"",
"\"",
",",
"maxResourceLen",
")",
",",
"strings",
".",
"Repeat",
"(",
"\"",
"\"",
",",
"maxActionLen",
")",
",",
"strings",
".",
"Repeat",
"(",
"\"",
"\"",
",",
"maxHrefLen",
")",
")",
")",
"\n",
"}",
"\n",
"}",
"\n",
"lines",
"=",
"append",
"(",
"lines",
",",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\\t",
"\\t",
"\"",
",",
"title",
",",
"action",
"[",
"0",
"]",
",",
"action",
"[",
"1",
"]",
")",
")",
"\n",
"}",
"\n",
"}",
"\n",
"w",
":=",
"tabwriter",
".",
"NewWriter",
"(",
"os",
".",
"Stdout",
",",
"0",
",",
"4",
",",
"1",
",",
"' '",
",",
"0",
")",
"\n",
"w",
".",
"Write",
"(",
"[",
"]",
"byte",
"(",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\\t",
"\\t",
"\\n",
"\"",
",",
"resourceTitle",
",",
"actionTitle",
",",
"hrefTitle",
")",
")",
")",
"\n",
"w",
".",
"Write",
"(",
"[",
"]",
"byte",
"(",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\\t",
"\\t",
"\\n",
"\"",
",",
"strings",
".",
"Repeat",
"(",
"\"",
"\"",
",",
"maxResourceLen",
")",
",",
"strings",
".",
"Repeat",
"(",
"\"",
"\"",
",",
"maxActionLen",
")",
",",
"strings",
".",
"Repeat",
"(",
"\"",
"\"",
",",
"maxHrefLen",
")",
")",
")",
")",
"\n",
"w",
".",
"Write",
"(",
"[",
"]",
"byte",
"(",
"strings",
".",
"Join",
"(",
"lines",
",",
"\"",
"\\n",
"\"",
")",
")",
")",
"\n",
"w",
".",
"Write",
"(",
"[",
"]",
"byte",
"(",
"\"",
"\\n",
"\"",
")",
")",
"\n",
"return",
"w",
".",
"Flush",
"(",
")",
"\n",
"}"
] |
9,020 | all-9021 | [
"Parse",
"the",
"string",
"and",
"return",
"an",
"AST",
"or",
"an",
"error"
] | [
"func",
"Parse",
"(",
"s",
"string",
")",
"(",
"*",
"ast",
".",
"Program",
",",
"error",
")",
"{",
"p",
":=",
"newParser",
"(",
"lexer",
".",
"New",
"(",
"s",
")",
")",
"\n",
"prog",
":=",
"p",
".",
"parseProgram",
"(",
")",
"\n",
"if",
"len",
"(",
"p",
".",
"<mask>",
")",
">",
"0",
"{",
"return",
"prog",
",",
"p",
".",
"errors",
"\n",
"}",
"\n",
"return",
"prog",
",",
"nil",
"\n",
"}"
] |
9,021 | all-9022 | [
"CompareKeys",
"checks",
"the",
"key",
"without",
"timestamp",
"and",
"checks",
"the",
"timestamp",
"if",
"keyNoTs",
"is",
"same",
".",
"a<timestamp",
">",
"would",
"be",
"sorted",
"higher",
"than",
"aa<timestamp",
">",
"if",
"we",
"use",
"bytes",
".",
"compare",
"All",
"keys",
"should",
"have",
"timestamp",
"."
] | [
"func",
"CompareKeys",
"(",
"key1",
",",
"key2",
"[",
"]",
"byte",
")",
"int",
"{",
"AssertTrue",
"(",
"len",
"(",
"key1",
")",
">",
"8",
"&&",
"len",
"(",
"key2",
")",
">",
"8",
")",
"\n",
"if",
"cmp",
":=",
"<mask>",
".",
"Compare",
"(",
"key1",
"[",
":",
"len",
"(",
"key1",
")",
"-",
"8",
"]",
",",
"key2",
"[",
":",
"len",
"(",
"key2",
")",
"-",
"8",
"]",
")",
";",
"cmp",
"!=",
"0",
"{",
"return",
"cmp",
"\n",
"}",
"\n",
"return",
"bytes",
".",
"Compare",
"(",
"key1",
"[",
"len",
"(",
"key1",
")",
"-",
"8",
":",
"]",
",",
"key2",
"[",
"len",
"(",
"key2",
")",
"-",
"8",
":",
"]",
")",
"\n",
"}"
] |
9,022 | all-9023 | [
"flattenDatastoreSummary",
"reads",
"various",
"fields",
"from",
"a",
"DatastoreSummary",
"into",
"the",
"passed",
"in",
"ResourceData",
"."
] | [
"func",
"flattenDatastoreSummary",
"(",
"d",
"*",
"schema",
".",
"ResourceData",
",",
"obj",
"*",
"types",
".",
"DatastoreSummary",
")",
"error",
"{",
"d",
".",
"Set",
"(",
"\"",
"\"",
",",
"obj",
".",
"Accessible",
")",
"\n",
"d",
".",
"Set",
"(",
"\"",
"\"",
",",
"structure",
".",
"ByteToMB",
"(",
"obj",
".",
"Capacity",
")",
")",
"\n",
"d",
".",
"Set",
"(",
"\"",
"\"",
",",
"structure",
".",
"ByteToMB",
"(",
"obj",
".",
"FreeSpace",
")",
")",
"\n",
"d",
".",
"Set",
"(",
"\"",
"\"",
",",
"obj",
".",
"MaintenanceMode",
")",
"\n",
"d",
".",
"Set",
"(",
"\"",
"\"",
",",
"obj",
".",
"MultipleHostAccess",
")",
"\n",
"d",
".",
"Set",
"(",
"\"",
"\"",
",",
"structure",
".",
"ByteToMB",
"(",
"obj",
".",
"Uncommitted",
")",
")",
"\n",
"d",
".",
"<mask>",
"(",
"\"",
"\"",
",",
"obj",
".",
"Url",
")",
"\n\n",
"// Set the name attribute off of the name here - since we do not track this",
"// here we check for errors",
"if",
"err",
":=",
"d",
".",
"Set",
"(",
"\"",
"\"",
",",
"obj",
".",
"Name",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
] |
9,023 | all-9024 | [
"Code",
"that",
"checks",
"whether",
"variable",
"with",
"given",
"name",
"and",
"type",
"contains",
"a",
"blank",
"value",
"(",
"empty",
"string",
"empty",
"array",
"or",
"empy",
"map",
")",
".",
"Return",
"empty",
"string",
"if",
"type",
"of",
"variable",
"cannot",
"produce",
"blank",
"values"
] | [
"func",
"blankCondition",
"(",
"name",
"string",
",",
"t",
"gen",
".",
"DataType",
")",
"(",
"blank",
"string",
")",
"{",
"name",
"=",
"fixReserved",
"(",
"name",
")",
"\n",
"switch",
"<mask>",
":=",
"t",
".",
"(",
"type",
")",
"{",
"case",
"*",
"gen",
".",
"BasicDataType",
":",
"if",
"*",
"actual",
"==",
"\"",
"\"",
"{",
"blank",
"=",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\\\"",
"\\\"",
"\"",
",",
"name",
")",
"\n",
"}",
"\n",
"case",
"*",
"gen",
".",
"ArrayDataType",
":",
"blank",
"=",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"name",
")",
"\n",
"case",
"*",
"gen",
".",
"ObjectDataType",
":",
"blank",
"=",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"name",
")",
"\n",
"case",
"*",
"gen",
".",
"EnumerableDataType",
":",
"blank",
"=",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"name",
")",
"\n",
"}",
"\n",
"return",
"\n",
"}"
] |
9,024 | all-9025 | [
"GetOfferingIncome",
"returns",
"total",
"receipt",
"balance",
"from",
"all",
"channels",
"of",
"offering",
"with",
"given",
"id",
"."
] | [
"func",
"(",
"h",
"*",
"<mask>",
")",
"GetOfferingIncome",
"(",
"tkn",
",",
"offeringID",
"string",
")",
"(",
"*",
"uint",
",",
"error",
")",
"{",
"logger",
":=",
"h",
".",
"logger",
".",
"Add",
"(",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"offeringID",
")",
"\n\n",
"return",
"h",
".",
"uintFromQuery",
"(",
"logger",
",",
"tkn",
",",
"`SELECT SUM(channels.receipt_balance)\n\t\t FROM channels\n\t\t WHERE channels.offering=$1`",
",",
"offeringID",
")",
"\n",
"}"
] |
9,025 | all-9026 | [
"StartPipeline",
"restarts",
"a",
"stopped",
"pipeline",
"."
] | [
"func",
"(",
"c",
"APIClient",
")",
"StartPipeline",
"(",
"name",
"string",
")",
"error",
"{",
"_",
",",
"err",
":=",
"c",
".",
"PpsAPIClient",
".",
"StartPipeline",
"(",
"c",
".",
"Ctx",
"(",
")",
",",
"&",
"pps",
".",
"StartPipelineRequest",
"{",
"Pipeline",
":",
"NewPipeline",
"(",
"<mask>",
")",
",",
"}",
",",
")",
"\n",
"return",
"grpcutil",
".",
"ScrubGRPC",
"(",
"err",
")",
"\n",
"}"
] |
9,026 | all-9027 | [
"UnmarshalJSON",
"supports",
"json",
".",
"Unmarshaler",
"interface"
] | [
"func",
"(",
"v",
"*",
"GetHighlightObjectForTestReturns",
")",
"UnmarshalJSON",
"(",
"data",
"[",
"]",
"byte",
")",
"error",
"{",
"r",
":=",
"jlexer",
".",
"Lexer",
"{",
"Data",
":",
"<mask>",
"}",
"\n",
"easyjsonC5a4559bDecodeGithubComChromedpCdprotoOverlay15",
"(",
"&",
"r",
",",
"v",
")",
"\n",
"return",
"r",
".",
"Error",
"(",
")",
"\n",
"}"
] |
9,027 | all-9028 | [
"DateEntropy",
"calculates",
"the",
"entropy",
"provided",
"by",
"a",
"date"
] | [
"func",
"DateEntropy",
"(",
"dateMatch",
"<mask>",
".",
"DateMatch",
")",
"float64",
"{",
"var",
"entropy",
"float64",
"\n",
"if",
"dateMatch",
".",
"Year",
"<",
"100",
"{",
"entropy",
"=",
"math",
".",
"Log2",
"(",
"numDays",
"*",
"numMonths",
"*",
"100",
")",
"\n",
"}",
"else",
"{",
"entropy",
"=",
"math",
".",
"Log2",
"(",
"numDays",
"*",
"numMonths",
"*",
"numYears",
")",
"\n",
"}",
"\n\n",
"if",
"dateMatch",
".",
"Separator",
"!=",
"\"",
"\"",
"{",
"entropy",
"+=",
"2",
"//add two bits for separator selection [/,-,.,etc]",
"\n",
"}",
"\n",
"return",
"entropy",
"\n",
"}"
] |
9,028 | all-9029 | [
"/",
"*",
"Keys",
"returns",
"all",
"of",
"the",
"global",
"keys",
"in",
"the",
"config",
"."
] | [
"func",
"(",
"config",
"*",
"Config",
")",
"Keys",
"(",
")",
"[",
"]",
"string",
"{",
"keys",
":=",
"make",
"(",
"[",
"]",
"string",
",",
"0",
",",
"len",
"(",
"config",
".",
"values",
")",
")",
"\n",
"for",
"key",
":=",
"range",
"config",
".",
"values",
"{",
"keys",
"=",
"append",
"(",
"<mask>",
",",
"key",
")",
"\n",
"}",
"\n",
"sort",
".",
"Strings",
"(",
"keys",
")",
"\n",
"return",
"keys",
"\n",
"}"
] |
9,029 | all-9030 | [
"temporaryUnapprovedFiles",
"returns",
"the",
"list",
"of",
"files",
"that",
"wouldn",
"t",
"be",
"approved",
"by",
"the",
"given",
"set",
"of",
"approvers",
"."
] | [
"func",
"(",
"o",
"Owners",
")",
"temporaryUnapprovedFiles",
"(",
"approvers",
"sets",
".",
"String",
")",
"sets",
".",
"<mask>",
"{",
"ap",
":=",
"NewApprovers",
"(",
"o",
")",
"\n",
"for",
"approver",
":=",
"range",
"approvers",
"{",
"ap",
".",
"AddApprover",
"(",
"approver",
",",
"\"",
"\"",
",",
"false",
")",
"\n",
"}",
"\n",
"return",
"ap",
".",
"UnapprovedFiles",
"(",
")",
"\n",
"}"
] |
9,030 | all-9031 | [
"fetchMore",
"retrieves",
"more",
"results",
"if",
"there",
"are",
"no",
"errors",
"or",
"pending",
"results",
"."
] | [
"func",
"(",
"t",
"*",
"Iterator",
")",
"fetchMore",
"(",
")",
"{",
"if",
"t",
".",
"err",
"==",
"nil",
"&&",
"len",
"(",
"t",
".",
"listRes",
")",
"+",
"len",
"(",
"t",
".",
"searchRes",
")",
"==",
"0",
"&&",
"t",
".",
"more",
"!=",
"nil",
"{",
"t",
".",
"<mask>",
"=",
"t",
".",
"more",
"(",
"t",
")",
"\n",
"}",
"\n",
"}"
] |
9,031 | all-9032 | [
"flattenStorageDrsIoLoadBalanceConfig",
"saves",
"a",
"StorageDrsIoLoadBalanceConfig",
"into",
"the",
"supplied",
"ResourceData",
"."
] | [
"func",
"flattenStorageDrsIoLoadBalanceConfig",
"(",
"d",
"*",
"schema",
".",
"ResourceData",
",",
"obj",
"*",
"types",
".",
"StorageDrsIoLoadBalanceConfig",
",",
"version",
"viapi",
".",
"VSphereVersion",
",",
")",
"error",
"{",
"attrs",
":=",
"<mask>",
"[",
"string",
"]",
"interface",
"{",
"}",
"{",
"\"",
"\"",
":",
"obj",
".",
"IoLatencyThreshold",
",",
"\"",
"\"",
":",
"obj",
".",
"IoLoadImbalanceThreshold",
",",
"}",
"\n",
"if",
"version",
".",
"Newer",
"(",
"viapi",
".",
"VSphereVersion",
"{",
"Product",
":",
"version",
".",
"Product",
",",
"Major",
":",
"6",
"}",
")",
"{",
"attrs",
"[",
"\"",
"\"",
"]",
"=",
"obj",
".",
"ReservableThresholdMode",
"\n",
"if",
"obj",
".",
"ReservableThresholdMode",
"==",
"string",
"(",
"types",
".",
"StorageDrsPodConfigInfoBehaviorManual",
")",
"{",
"attrs",
"[",
"\"",
"\"",
"]",
"=",
"obj",
".",
"ReservableIopsThreshold",
"\n",
"}",
"else",
"{",
"attrs",
"[",
"\"",
"\"",
"]",
"=",
"obj",
".",
"ReservablePercentThreshold",
"\n",
"}",
"\n",
"}",
"\n\n",
"for",
"k",
",",
"v",
":=",
"range",
"attrs",
"{",
"if",
"err",
":=",
"d",
".",
"Set",
"(",
"k",
",",
"v",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"k",
",",
"err",
")",
"\n",
"}",
"\n",
"}",
"\n\n",
"return",
"nil",
"\n",
"}"
] |
9,032 | all-9033 | [
"FullRune",
"reports",
"whether",
"the",
"bytes",
"in",
"p",
"begin",
"with",
"a",
"full",
"CESU",
"-",
"8",
"encoding",
"of",
"a",
"rune",
"."
] | [
"func",
"FullRune",
"(",
"p",
"[",
"]",
"byte",
")",
"bool",
"{",
"high",
",",
"n",
",",
"short",
":=",
"decodeRune",
"(",
"p",
")",
"\n",
"if",
"<mask>",
"{",
"return",
"false",
"\n",
"}",
"\n",
"if",
"!",
"utf16",
".",
"IsSurrogate",
"(",
"high",
")",
"{",
"return",
"true",
"\n",
"}",
"\n",
"_",
",",
"_",
",",
"short",
"=",
"decodeRune",
"(",
"p",
"[",
"n",
":",
"]",
")",
"\n",
"return",
"!",
"short",
"\n",
"}"
] |
9,033 | all-9034 | [
"GetParameters",
"mocks",
"base",
"method"
] | [
"func",
"(",
"m",
"*",
"MockSSMClient",
")",
"GetParameters",
"(",
"arg0",
"*",
"ssm",
".",
"GetParametersInput",
")",
"(",
"*",
"ssm",
".",
"GetParametersOutput",
",",
"error",
")",
"{",
"ret",
":=",
"m",
".",
"ctrl",
".",
"Call",
"(",
"m",
",",
"\"",
"\"",
",",
"arg0",
")",
"\n",
"ret0",
",",
"_",
":=",
"ret",
"[",
"0",
"]",
".",
"(",
"*",
"ssm",
".",
"GetParametersOutput",
")",
"\n",
"ret1",
",",
"_",
":=",
"<mask>",
"[",
"1",
"]",
".",
"(",
"error",
")",
"\n",
"return",
"ret0",
",",
"ret1",
"\n",
"}"
] |
9,034 | all-9035 | [
"GetDynamicData",
"returns",
"the",
"dynamic",
"data",
"with",
"provided",
"path",
"from",
"instance",
"metadata"
] | [
"func",
"(",
"c",
"*",
"ec2MetadataClientImpl",
")",
"GetDynamicData",
"(",
"<mask>",
"string",
")",
"(",
"string",
",",
"error",
")",
"{",
"return",
"c",
".",
"client",
".",
"GetDynamicData",
"(",
"path",
")",
"\n",
"}"
] |
9,035 | all-9036 | [
"IsWarning",
"implements",
"the",
"driver",
".",
"Error",
"interface",
"."
] | [
"func",
"(",
"e",
"*",
"hdbErrors",
")",
"IsWarning",
"(",
")",
"bool",
"{",
"return",
"e",
".",
"<mask>",
"[",
"e",
".",
"idx",
"]",
".",
"errorLevel",
"==",
"errorLevelWarning",
"\n",
"}"
] |
9,036 | all-9037 | [
"WaitPeerListening",
"wait",
"for",
"specified",
"peer",
"be",
"ready",
"for",
"new",
"connections",
"."
] | [
"func",
"WaitPeerListening",
"(",
"network",
",",
"address",
"string",
",",
"timeout",
"time",
".",
"Duration",
")",
"bool",
"{",
"return",
"WaitFunc",
"(",
"100",
"*",
"time",
".",
"Millisecond",
",",
"timeout",
",",
"func",
"(",
")",
"bool",
"{",
"c",
",",
"err",
":=",
"<mask>",
".",
"Dial",
"(",
"network",
",",
"address",
")",
"\n",
"if",
"err",
"==",
"nil",
"{",
"c",
".",
"Close",
"(",
")",
"\n",
"return",
"true",
"\n",
"}",
"\n\n",
"return",
"false",
"\n",
"}",
")",
"\n",
"}"
] |
9,037 | all-9038 | [
"SetKeepBelow",
"is",
"a",
"wrapper",
"around",
"gtk_window_set_keep_below",
"()",
"."
] | [
"func",
"(",
"v",
"*",
"Window",
")",
"SetKeepBelow",
"(",
"setting",
"bool",
")",
"{",
"C",
".",
"gtk_window_set_keep_below",
"(",
"v",
".",
"native",
"(",
")",
",",
"gbool",
"(",
"<mask>",
")",
")",
"\n",
"}"
] |
9,038 | all-9039 | [
"Specify",
"the",
"value",
"of",
"a",
"uniform",
"variable",
"for",
"a",
"specified",
"program",
"object"
] | [
"func",
"ProgramUniformMatrix2x4fv",
"(",
"program",
"uint32",
",",
"location",
"int32",
",",
"count",
"int32",
",",
"transpose",
"bool",
",",
"value",
"*",
"float32",
")",
"{",
"C",
".",
"glowProgramUniformMatrix2x4fv",
"(",
"gpProgramUniformMatrix2x4fv",
",",
"(",
"C",
".",
"GLuint",
")",
"(",
"program",
")",
",",
"(",
"C",
".",
"GLint",
")",
"(",
"<mask>",
")",
",",
"(",
"C",
".",
"GLsizei",
")",
"(",
"count",
")",
",",
"(",
"C",
".",
"GLboolean",
")",
"(",
"boolToInt",
"(",
"transpose",
")",
")",
",",
"(",
"*",
"C",
".",
"GLfloat",
")",
"(",
"unsafe",
".",
"Pointer",
"(",
"value",
")",
")",
")",
"\n",
"}"
] |
9,039 | all-9040 | [
"UnmarshalJSON",
"supports",
"json",
".",
"Unmarshaler",
"interface"
] | [
"func",
"(",
"v",
"*",
"StopObservingParams",
")",
"UnmarshalJSON",
"(",
"data",
"[",
"]",
"byte",
")",
"error",
"{",
"r",
":=",
"jlexer",
".",
"Lexer",
"{",
"Data",
":",
"<mask>",
"}",
"\n",
"easyjsonC5a4559bDecodeGithubComChromedpCdprotoBackgroundservice",
"(",
"&",
"r",
",",
"v",
")",
"\n",
"return",
"r",
".",
"Error",
"(",
")",
"\n",
"}"
] |
9,040 | all-9041 | [
"Validate",
"implements",
"the",
"coal",
".",
"ValidatableModel",
"interface",
"."
] | [
"func",
"(",
"u",
"*",
"User",
")",
"Validate",
"(",
")",
"error",
"{",
"// hash password if available",
"err",
":=",
"u",
".",
"HashPassword",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"// check id",
"if",
"!",
"u",
".",
"ID",
"(",
")",
".",
"Valid",
"(",
")",
"{",
"return",
"fire",
".",
"E",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"// check name",
"if",
"u",
".",
"Name",
"==",
"\"",
"\"",
"{",
"return",
"fire",
".",
"E",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"// check email",
"if",
"u",
".",
"Email",
"==",
"\"",
"\"",
"||",
"!",
"govalidator",
".",
"IsEmail",
"(",
"u",
".",
"Email",
")",
"{",
"return",
"<mask>",
".",
"E",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"// check password hash",
"if",
"len",
"(",
"u",
".",
"PasswordHash",
")",
"==",
"0",
"{",
"return",
"fire",
".",
"E",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"return",
"nil",
"\n",
"}"
] |
9,041 | all-9042 | [
"native",
"returns",
"a",
"pointer",
"to",
"the",
"underlying",
"GtkMisc",
"."
] | [
"func",
"(",
"v",
"*",
"Misc",
")",
"native",
"(",
")",
"*",
"C",
".",
"GtkMisc",
"{",
"if",
"v",
"==",
"nil",
"||",
"v",
".",
"GObject",
"==",
"nil",
"{",
"<mask>",
"nil",
"\n",
"}",
"\n",
"p",
":=",
"unsafe",
".",
"Pointer",
"(",
"v",
".",
"GObject",
")",
"\n",
"return",
"C",
".",
"toGtkMisc",
"(",
"p",
")",
"\n",
"}"
] |
9,042 | all-9043 | [
"ParseBytes",
"parses",
"the",
"given",
"b",
"containing",
"query",
"args",
"."
] | [
"func",
"(",
"a",
"*",
"Args",
")",
"ParseBytes",
"(",
"b",
"[",
"]",
"byte",
")",
"{",
"a",
".",
"Reset",
"(",
")",
"\n\n",
"var",
"s",
"argsScanner",
"\n",
"s",
".",
"b",
"=",
"b",
"\n\n",
"<mask>",
"kv",
"*",
"argsKV",
"\n",
"a",
".",
"args",
",",
"kv",
"=",
"allocArg",
"(",
"a",
".",
"args",
")",
"\n",
"for",
"s",
".",
"next",
"(",
"kv",
")",
"{",
"if",
"len",
"(",
"kv",
".",
"key",
")",
">",
"0",
"||",
"len",
"(",
"kv",
".",
"value",
")",
">",
"0",
"{",
"a",
".",
"args",
",",
"kv",
"=",
"allocArg",
"(",
"a",
".",
"args",
")",
"\n",
"}",
"\n",
"}",
"\n",
"a",
".",
"args",
"=",
"releaseArg",
"(",
"a",
".",
"args",
")",
"\n",
"}"
] |
9,043 | all-9044 | [
"Max",
"returns",
"the",
"highest",
"value",
"in",
"the",
"range"
] | [
"func",
"(",
"r",
"*",
"InclusiveRange",
")",
"Max",
"(",
")",
"int",
"{",
"start",
":=",
"r",
".",
"Start",
"(",
")",
"\n",
"end",
":=",
"r",
".",
"End",
"(",
")",
"\n",
"if",
"<mask>",
">",
"end",
"{",
"return",
"start",
"\n",
"}",
"\n",
"return",
"end",
"\n",
"}"
] |
9,044 | all-9045 | [
"Null",
"verifies",
"the",
"contents",
"of",
"bytes",
"provided",
"is",
"a",
"null",
"starting",
"as",
"pos"
] | [
"func",
"Null",
"(",
"in",
"[",
"]",
"byte",
",",
"pos",
"int",
")",
"(",
"int",
",",
"error",
")",
"{",
"switch",
"in",
"[",
"pos",
"]",
"{",
"case",
"'n'",
":",
"return",
"expect",
"(",
"in",
",",
"pos",
",",
"n",
"...",
")",
"\n",
"return",
"pos",
"+",
"4",
",",
"nil",
"\n",
"<mask>",
":",
"return",
"0",
",",
"errUnexpectedValue",
"\n",
"}",
"\n",
"}"
] |
9,045 | all-9046 | [
"GetCreatedAt",
"sets",
"the",
"timestamp",
"for",
"resource",
"s",
"creation",
"time"
] | [
"func",
"(",
"<mask>",
"*",
"SSMSecretResource",
")",
"GetCreatedAt",
"(",
")",
"time",
".",
"Time",
"{",
"secret",
".",
"lock",
".",
"RLock",
"(",
")",
"\n",
"defer",
"secret",
".",
"lock",
".",
"RUnlock",
"(",
")",
"\n\n",
"return",
"secret",
".",
"createdAt",
"\n",
"}"
] |
9,046 | all-9047 | [
"JsonnetVM",
"constructs",
"a",
"new",
"jsonnet",
".",
"VM",
"according",
"to",
"command",
"line",
"flags"
] | [
"func",
"JsonnetVM",
"(",
"cmd",
"*",
"cobra",
".",
"Command",
")",
"(",
"*",
"jsonnet",
".",
"VM",
",",
"error",
")",
"{",
"vm",
":=",
"jsonnet",
".",
"MakeVM",
"(",
")",
"\n",
"flags",
":=",
"cmd",
".",
"Flags",
"(",
")",
"\n\n",
"var",
"searchUrls",
"[",
"]",
"*",
"url",
".",
"URL",
"\n\n",
"jpath",
":=",
"filepath",
".",
"SplitList",
"(",
"os",
".",
"Getenv",
"(",
"\"",
"\"",
")",
")",
"\n\n",
"jpathArgs",
",",
"err",
":=",
"flags",
".",
"GetStringArray",
"(",
"flagJpath",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"jpath",
"=",
"append",
"(",
"jpath",
",",
"jpathArgs",
"...",
")",
"\n\n",
"for",
"_",
",",
"p",
":=",
"range",
"jpath",
"{",
"p",
",",
"err",
":=",
"filepath",
".",
"Abs",
"(",
"p",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"searchUrls",
"=",
"append",
"(",
"searchUrls",
",",
"dirURL",
"(",
"p",
")",
")",
"\n",
"}",
"\n\n",
"sURLs",
",",
"err",
":=",
"flags",
".",
"GetStringArray",
"(",
"flagJUrl",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"// Special URL scheme used to find embedded content",
"sURLs",
"=",
"append",
"(",
"sURLs",
",",
"\"",
"\"",
")",
"\n\n",
"for",
"_",
",",
"ustr",
":=",
"<mask>",
"sURLs",
"{",
"u",
",",
"err",
":=",
"url",
".",
"Parse",
"(",
"ustr",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"if",
"u",
".",
"Path",
"[",
"len",
"(",
"u",
".",
"Path",
")",
"-",
"1",
"]",
"!=",
"'/'",
"{",
"u",
".",
"Path",
"=",
"u",
".",
"Path",
"+",
"\"",
"\"",
"\n",
"}",
"\n",
"searchUrls",
"=",
"append",
"(",
"searchUrls",
",",
"u",
")",
"\n",
"}",
"\n\n",
"for",
"_",
",",
"u",
":=",
"range",
"searchUrls",
"{",
"log",
".",
"Debugln",
"(",
"\"",
"\"",
",",
"u",
")",
"\n",
"}",
"\n\n",
"vm",
".",
"Importer",
"(",
"utils",
".",
"MakeUniversalImporter",
"(",
"searchUrls",
")",
")",
"\n\n",
"extvars",
",",
"err",
":=",
"flags",
".",
"GetStringSlice",
"(",
"flagExtVar",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"for",
"_",
",",
"extvar",
":=",
"range",
"extvars",
"{",
"kv",
":=",
"strings",
".",
"SplitN",
"(",
"extvar",
",",
"\"",
"\"",
",",
"2",
")",
"\n",
"switch",
"len",
"(",
"kv",
")",
"{",
"case",
"1",
":",
"v",
",",
"present",
":=",
"os",
".",
"LookupEnv",
"(",
"kv",
"[",
"0",
"]",
")",
"\n",
"if",
"present",
"{",
"vm",
".",
"ExtVar",
"(",
"kv",
"[",
"0",
"]",
",",
"v",
")",
"\n",
"}",
"else",
"{",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"kv",
"[",
"0",
"]",
")",
"\n",
"}",
"\n",
"case",
"2",
":",
"vm",
".",
"ExtVar",
"(",
"kv",
"[",
"0",
"]",
",",
"kv",
"[",
"1",
"]",
")",
"\n",
"}",
"\n",
"}",
"\n\n",
"extvarfiles",
",",
"err",
":=",
"flags",
".",
"GetStringSlice",
"(",
"flagExtVarFile",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"for",
"_",
",",
"extvar",
":=",
"range",
"extvarfiles",
"{",
"kv",
":=",
"strings",
".",
"SplitN",
"(",
"extvar",
",",
"\"",
"\"",
",",
"2",
")",
"\n",
"if",
"len",
"(",
"kv",
")",
"!=",
"2",
"{",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"flagExtVarFile",
",",
"extvar",
")",
"\n",
"}",
"\n",
"v",
",",
"err",
":=",
"ioutil",
".",
"ReadFile",
"(",
"kv",
"[",
"1",
"]",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"vm",
".",
"ExtVar",
"(",
"kv",
"[",
"0",
"]",
",",
"string",
"(",
"v",
")",
")",
"\n",
"}",
"\n\n",
"tlavars",
",",
"err",
":=",
"flags",
".",
"GetStringSlice",
"(",
"flagTlaVar",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"for",
"_",
",",
"tlavar",
":=",
"range",
"tlavars",
"{",
"kv",
":=",
"strings",
".",
"SplitN",
"(",
"tlavar",
",",
"\"",
"\"",
",",
"2",
")",
"\n",
"switch",
"len",
"(",
"kv",
")",
"{",
"case",
"1",
":",
"v",
",",
"present",
":=",
"os",
".",
"LookupEnv",
"(",
"kv",
"[",
"0",
"]",
")",
"\n",
"if",
"present",
"{",
"vm",
".",
"TLAVar",
"(",
"kv",
"[",
"0",
"]",
",",
"v",
")",
"\n",
"}",
"else",
"{",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"kv",
"[",
"0",
"]",
")",
"\n",
"}",
"\n",
"case",
"2",
":",
"vm",
".",
"TLAVar",
"(",
"kv",
"[",
"0",
"]",
",",
"kv",
"[",
"1",
"]",
")",
"\n",
"}",
"\n",
"}",
"\n\n",
"tlavarfiles",
",",
"err",
":=",
"flags",
".",
"GetStringSlice",
"(",
"flagTlaVarFile",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"for",
"_",
",",
"tlavar",
":=",
"range",
"tlavarfiles",
"{",
"kv",
":=",
"strings",
".",
"SplitN",
"(",
"tlavar",
",",
"\"",
"\"",
",",
"2",
")",
"\n",
"if",
"len",
"(",
"kv",
")",
"!=",
"2",
"{",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"flagTlaVarFile",
",",
"tlavar",
")",
"\n",
"}",
"\n",
"v",
",",
"err",
":=",
"ioutil",
".",
"ReadFile",
"(",
"kv",
"[",
"1",
"]",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"vm",
".",
"TLAVar",
"(",
"kv",
"[",
"0",
"]",
",",
"string",
"(",
"v",
")",
")",
"\n",
"}",
"\n\n",
"resolver",
",",
"err",
":=",
"buildResolver",
"(",
"cmd",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"utils",
".",
"RegisterNativeFuncs",
"(",
"vm",
",",
"resolver",
")",
"\n\n",
"return",
"vm",
",",
"nil",
"\n",
"}"
] |
9,047 | all-9048 | [
"Embedded",
"returns",
"a",
"Document",
"based",
"on",
"embedded",
"specs",
".",
"No",
"analysis",
"is",
"required"
] | [
"func",
"Embedded",
"(",
"orig",
",",
"flat",
"json",
".",
"RawMessage",
")",
"(",
"*",
"<mask>",
",",
"error",
")",
"{",
"var",
"origSpec",
",",
"flatSpec",
"spec",
".",
"Swagger",
"\n",
"if",
"err",
":=",
"json",
".",
"Unmarshal",
"(",
"orig",
",",
"&",
"origSpec",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"if",
"err",
":=",
"json",
".",
"Unmarshal",
"(",
"flat",
",",
"&",
"flatSpec",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"return",
"&",
"Document",
"{",
"raw",
":",
"orig",
",",
"origSpec",
":",
"&",
"origSpec",
",",
"spec",
":",
"&",
"flatSpec",
",",
"}",
",",
"nil",
"\n",
"}"
] |
9,048 | all-9049 | [
"GetCompareTo",
"returns",
"the",
"CompareTo",
"field",
"if",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"."
] | [
"func",
"(",
"g",
"*",
"GraphDefinitionRequest",
")",
"GetCompareTo",
"(",
")",
"string",
"{",
"if",
"g",
"==",
"nil",
"||",
"g",
".",
"CompareTo",
"==",
"nil",
"{",
"return",
"\"",
"\"",
"\n",
"}",
"\n",
"<mask>",
"*",
"g",
".",
"CompareTo",
"\n",
"}"
] |
9,049 | all-9050 | [
"Expected",
"will",
"return",
"the",
"expected",
"resource",
"group",
"as",
"it",
"would",
"be",
"defined",
"in",
"Azure"
] | [
"func",
"(",
"r",
"*",
"ResourceGroup",
")",
"Expected",
"(",
"immutable",
"*",
"cluster",
".",
"Cluster",
")",
"(",
"*",
"cluster",
".",
"Cluster",
",",
"cloud",
".",
"Resource",
",",
"error",
")",
"{",
"logger",
".",
"Debug",
"(",
"\"",
"\"",
")",
"\n",
"newResource",
":=",
"&",
"ResourceGroup",
"{",
"Shared",
":",
"Shared",
"{",
"Name",
":",
"immutable",
".",
"Name",
",",
"Tags",
":",
"r",
".",
"Tags",
",",
"Identifier",
":",
"immutable",
".",
"ProviderConfig",
"(",
")",
".",
"GroupIdentifier",
",",
"}",
",",
"<mask>",
":",
"immutable",
".",
"ProviderConfig",
"(",
")",
".",
"Location",
",",
"}",
"\n",
"newCluster",
":=",
"r",
".",
"immutableRender",
"(",
"newResource",
",",
"immutable",
")",
"\n",
"return",
"newCluster",
",",
"newResource",
",",
"nil",
"\n",
"}"
] |
9,050 | all-9051 | [
"updateBool",
"will",
"return",
"true",
"and",
"set",
"have",
"to",
"want",
"iff",
"they",
"are",
"set",
"and",
"different",
"."
] | [
"func",
"updateBool",
"(",
"have",
",",
"want",
"*",
"bool",
")",
"bool",
"{",
"<mask>",
"{",
"case",
"have",
"==",
"nil",
":",
"panic",
"(",
"\"",
"\"",
")",
"\n",
"case",
"want",
"==",
"nil",
":",
"return",
"false",
"// do not care what we have",
"\n",
"case",
"*",
"have",
"==",
"*",
"want",
":",
"return",
"false",
"//already have it",
"\n",
"}",
"\n",
"*",
"have",
"=",
"*",
"want",
"// update value",
"\n",
"return",
"true",
"\n",
"}"
] |
9,051 | all-9052 | [
"HasQuery",
"returns",
"a",
"boolean",
"if",
"a",
"field",
"has",
"been",
"set",
"."
] | [
"func",
"(",
"e",
"*",
"EventStreamDefinition",
")",
"HasQuery",
"(",
")",
"bool",
"{",
"if",
"e",
"!=",
"nil",
"&&",
"e",
".",
"Query",
"!=",
"nil",
"{",
"return",
"<mask>",
"\n",
"}",
"\n\n",
"return",
"false",
"\n",
"}"
] |
9,052 | all-9053 | [
"FormFile",
"returns",
"uploaded",
"file",
"associated",
"with",
"the",
"given",
"multipart",
"form",
"key",
".",
"The",
"file",
"is",
"automatically",
"deleted",
"after",
"returning",
"from",
"RequestHandler",
"so",
"either",
"move",
"or",
"copy",
"uploaded",
"file",
"into",
"new",
"place",
"if",
"you",
"want",
"retaining",
"it",
".",
"Use",
"SaveMultipartFile",
"function",
"for",
"permanently",
"saving",
"uploaded",
"file",
".",
"The",
"returned",
"file",
"header",
"is",
"valid",
"until",
"returning",
"from",
"RequestHandler",
"."
] | [
"func",
"(",
"ctx",
"*",
"RequestCtx",
")",
"FormFile",
"(",
"<mask>",
"string",
")",
"(",
"*",
"multipart",
".",
"FileHeader",
",",
"error",
")",
"{",
"mf",
",",
"err",
":=",
"ctx",
".",
"MultipartForm",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"if",
"mf",
".",
"File",
"==",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"fhh",
":=",
"mf",
".",
"File",
"[",
"key",
"]",
"\n",
"if",
"fhh",
"==",
"nil",
"{",
"return",
"nil",
",",
"ErrMissingFile",
"\n",
"}",
"\n",
"return",
"fhh",
"[",
"0",
"]",
",",
"nil",
"\n",
"}"
] |
9,053 | all-9054 | [
"IsNotExist",
"will",
"return",
"true",
"if",
"the",
"error",
"is",
"because",
"the",
"object",
"does",
"not",
"exist",
"."
] | [
"func",
"IsNotExist",
"(",
"err",
"error",
")",
"bool",
"{",
"return",
"os",
".",
"IsNotExist",
"(",
"err",
")",
"||",
"err",
"==",
"<mask>",
".",
"ErrObjectNotExist",
"\n",
"}"
] |
9,054 | all-9055 | [
"GetMonitorOk",
"returns",
"a",
"tuple",
"with",
"the",
"Monitor",
"field",
"if",
"it",
"s",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"and",
"a",
"boolean",
"to",
"check",
"if",
"the",
"value",
"has",
"been",
"set",
"."
] | [
"func",
"(",
"w",
"*",
"Widget",
")",
"GetMonitorOk",
"(",
")",
"(",
"ScreenboardMonitor",
",",
"bool",
")",
"{",
"if",
"w",
"==",
"nil",
"||",
"w",
".",
"Monitor",
"==",
"nil",
"{",
"return",
"ScreenboardMonitor",
"{",
"}",
",",
"<mask>",
"\n",
"}",
"\n",
"return",
"*",
"w",
".",
"Monitor",
",",
"true",
"\n",
"}"
] |
9,055 | all-9056 | [
"UnmarshalJSON",
"supports",
"json",
".",
"Unmarshaler",
"interface"
] | [
"func",
"(",
"v",
"*",
"EventReceivedMessageFromTarget",
")",
"UnmarshalJSON",
"(",
"data",
"[",
"]",
"byte",
")",
"error",
"{",
"r",
":=",
"jlexer",
".",
"Lexer",
"{",
"Data",
":",
"<mask>",
"}",
"\n",
"easyjsonC5a4559bDecodeGithubComChromedpCdprotoTarget17",
"(",
"&",
"r",
",",
"v",
")",
"\n",
"return",
"r",
".",
"Error",
"(",
")",
"\n",
"}"
] |
9,056 | all-9057 | [
"Dial",
"calls",
"net",
".",
"Dial",
"on",
"the",
"address",
"."
] | [
"func",
"(",
"na",
"*",
"NetAddress",
")",
"Dial",
"(",
")",
"(",
"net",
".",
"Conn",
",",
"error",
")",
"{",
"conn",
",",
"err",
":=",
"net",
".",
"Dial",
"(",
"\"",
"\"",
",",
"na",
".",
"String",
"(",
")",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"return",
"<mask>",
",",
"nil",
"\n",
"}"
] |
9,057 | all-9058 | [
"GetItemIndex",
"is",
"a",
"wrapper",
"around",
"gtk_toolbar_get_item_index",
"()",
"."
] | [
"func",
"(",
"v",
"*",
"Toolbar",
")",
"GetItemIndex",
"(",
"item",
"IToolItem",
")",
"int",
"{",
"c",
":=",
"C",
".",
"gtk_toolbar_get_item_index",
"(",
"v",
".",
"native",
"(",
")",
",",
"<mask>",
".",
"toToolItem",
"(",
")",
")",
"\n",
"return",
"int",
"(",
"c",
")",
"\n",
"}"
] |
9,058 | all-9059 | [
"revertToManifest",
"checks",
"that",
"all",
"necessary",
"table",
"files",
"exist",
"and",
"removes",
"all",
"table",
"files",
"not",
"referenced",
"by",
"the",
"manifest",
".",
"idMap",
"is",
"a",
"set",
"of",
"table",
"file",
"id",
"s",
"that",
"were",
"read",
"from",
"the",
"directory",
"listing",
"."
] | [
"func",
"revertToManifest",
"(",
"kv",
"*",
"DB",
",",
"mf",
"*",
"Manifest",
",",
"idMap",
"<mask>",
"[",
"uint64",
"]",
"struct",
"{",
"}",
")",
"error",
"{",
"// 1. Check all files in manifest exist.",
"for",
"id",
":=",
"range",
"mf",
".",
"Tables",
"{",
"if",
"_",
",",
"ok",
":=",
"idMap",
"[",
"id",
"]",
";",
"!",
"ok",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"id",
")",
"\n",
"}",
"\n",
"}",
"\n\n",
"// 2. Delete files that shouldn't exist.",
"for",
"id",
":=",
"range",
"idMap",
"{",
"if",
"_",
",",
"ok",
":=",
"mf",
".",
"Tables",
"[",
"id",
"]",
";",
"!",
"ok",
"{",
"kv",
".",
"elog",
".",
"Printf",
"(",
"\"",
"\\n",
"\"",
",",
"id",
")",
"\n",
"filename",
":=",
"table",
".",
"NewFilename",
"(",
"id",
",",
"kv",
".",
"opt",
".",
"Dir",
")",
"\n",
"if",
"err",
":=",
"os",
".",
"Remove",
"(",
"filename",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"y",
".",
"Wrapf",
"(",
"err",
",",
"\"",
"\"",
",",
"id",
")",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n\n",
"return",
"nil",
"\n",
"}"
] |
9,059 | all-9060 | [
"Using",
"the",
"classic",
"API",
"posts",
"a",
"value",
"to",
"a",
"stat",
"at",
"a",
"specific",
"time",
"using",
"DefaultReporter",
"."
] | [
"func",
"PostValueTime",
"(",
"statKey",
",",
"userKey",
"string",
",",
"<mask>",
"float64",
",",
"timestamp",
"int64",
")",
"error",
"{",
"return",
"DefaultReporter",
".",
"PostValueTime",
"(",
"statKey",
",",
"userKey",
",",
"value",
",",
"timestamp",
")",
"\n",
"}"
] |
9,060 | all-9061 | [
"Returns",
"a",
"parameter",
"from",
"a",
"program",
"object"
] | [
"func",
"GetProgramiv",
"(",
"<mask>",
"uint32",
",",
"pname",
"uint32",
",",
"params",
"*",
"int32",
")",
"{",
"C",
".",
"glowGetProgramiv",
"(",
"gpGetProgramiv",
",",
"(",
"C",
".",
"GLuint",
")",
"(",
"program",
")",
",",
"(",
"C",
".",
"GLenum",
")",
"(",
"pname",
")",
",",
"(",
"*",
"C",
".",
"GLint",
")",
"(",
"unsafe",
".",
"Pointer",
"(",
"params",
")",
")",
")",
"\n",
"}"
] |
9,061 | all-9062 | [
"GetFile",
"returns",
"information",
"about",
"user",
"upload",
"file",
"by",
"given",
"form",
"field",
"name",
"."
] | [
"func",
"(",
"ctx",
"*",
"Context",
")",
"GetFile",
"(",
"name",
"string",
")",
"(",
"multipart",
".",
"<mask>",
",",
"*",
"multipart",
".",
"FileHeader",
",",
"error",
")",
"{",
"return",
"ctx",
".",
"Req",
".",
"FormFile",
"(",
"name",
")",
"\n",
"}"
] |
9,062 | all-9063 | [
"MultipartFormBoundary",
"returns",
"boundary",
"part",
"from",
"multipart",
"/",
"form",
"-",
"data",
";",
"boundary",
"=",
"...",
"Content",
"-",
"Type",
"."
] | [
"func",
"(",
"h",
"*",
"RequestHeader",
")",
"MultipartFormBoundary",
"(",
")",
"[",
"]",
"byte",
"{",
"b",
":=",
"h",
".",
"ContentType",
"(",
")",
"\n",
"if",
"!",
"bytes",
".",
"HasPrefix",
"(",
"b",
",",
"strMultipartFormData",
")",
"{",
"return",
"nil",
"\n",
"}",
"\n",
"b",
"=",
"b",
"[",
"len",
"(",
"strMultipartFormData",
")",
":",
"]",
"\n",
"if",
"len",
"(",
"b",
")",
"==",
"0",
"||",
"b",
"[",
"0",
"]",
"!=",
"';'",
"{",
"return",
"nil",
"\n",
"}",
"\n\n",
"var",
"n",
"int",
"\n",
"for",
"len",
"(",
"b",
")",
">",
"0",
"{",
"n",
"++",
"\n",
"for",
"len",
"(",
"b",
")",
">",
"n",
"&&",
"b",
"[",
"n",
"]",
"==",
"' '",
"{",
"n",
"++",
"\n",
"}",
"\n",
"b",
"=",
"b",
"[",
"n",
":",
"]",
"\n",
"if",
"!",
"bytes",
".",
"HasPrefix",
"(",
"b",
",",
"strBoundary",
")",
"{",
"if",
"n",
"=",
"bytes",
".",
"IndexByte",
"(",
"b",
",",
"';'",
")",
";",
"n",
"<",
"0",
"{",
"return",
"nil",
"\n",
"}",
"\n",
"<mask>",
"\n",
"}",
"\n\n",
"b",
"=",
"b",
"[",
"len",
"(",
"strBoundary",
")",
":",
"]",
"\n",
"if",
"len",
"(",
"b",
")",
"==",
"0",
"||",
"b",
"[",
"0",
"]",
"!=",
"'='",
"{",
"return",
"nil",
"\n",
"}",
"\n",
"b",
"=",
"b",
"[",
"1",
":",
"]",
"\n",
"if",
"n",
"=",
"bytes",
".",
"IndexByte",
"(",
"b",
",",
"';'",
")",
";",
"n",
">=",
"0",
"{",
"b",
"=",
"b",
"[",
":",
"n",
"]",
"\n",
"}",
"\n",
"if",
"len",
"(",
"b",
")",
">",
"1",
"&&",
"b",
"[",
"0",
"]",
"==",
"'\"'",
"&&",
"b",
"[",
"len",
"(",
"b",
")",
"-",
"1",
"]",
"==",
"'\"'",
"{",
"b",
"=",
"b",
"[",
"1",
":",
"len",
"(",
"b",
")",
"-",
"1",
"]",
"\n",
"}",
"\n",
"return",
"b",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
] |
9,063 | all-9064 | [
"UnmarshalText",
"returns",
"an",
"error",
"if",
"text",
"!",
"=",
"secret",
"or",
"closed"
] | [
"func",
"(",
"p",
"*",
"Privacy",
")",
"UnmarshalText",
"(",
"text",
"[",
"]",
"byte",
")",
"error",
"{",
"v",
":=",
"Privacy",
"(",
"text",
")",
"\n",
"if",
"_",
",",
"ok",
":=",
"privacySettings",
"[",
"v",
"]",
";",
"!",
"<mask>",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"v",
")",
"\n",
"}",
"\n",
"*",
"p",
"=",
"v",
"\n",
"return",
"nil",
"\n",
"}"
] |
9,064 | all-9065 | [
"Message",
"returns",
"version",
"with",
"format",
"version",
"(",
"first",
"seven",
"characters",
"of",
"commit",
"hash",
")",
"."
] | [
"func",
"<mask>",
"(",
"commit",
",",
"version",
"string",
")",
"string",
"{",
"var",
"c",
"string",
"\n",
"var",
"v",
"string",
"\n\n",
"if",
"commit",
"==",
"\"",
"\"",
"{",
"c",
"=",
"undefined",
"\n",
"}",
"else",
"if",
"len",
"(",
"commit",
")",
">",
"7",
"{",
"c",
"=",
"commit",
"[",
":",
"7",
"]",
"\n",
"}",
"else",
"{",
"c",
"=",
"commit",
"\n",
"}",
"\n\n",
"if",
"version",
"==",
"\"",
"\"",
"{",
"v",
"=",
"undefined",
"\n",
"}",
"else",
"{",
"v",
"=",
"version",
"\n",
"}",
"\n\n",
"return",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"v",
",",
"c",
")",
"\n",
"}"
] |
9,065 | all-9066 | [
"RenameProfile",
"renames",
"an",
"existing",
"profile",
"entry"
] | [
"func",
"(",
"r",
"*",
"ProtocolLXD",
")",
"RenameProfile",
"(",
"name",
"string",
",",
"<mask>",
"api",
".",
"ProfilePost",
")",
"error",
"{",
"// Send the request",
"_",
",",
"_",
",",
"err",
":=",
"r",
".",
"query",
"(",
"\"",
"\"",
",",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"url",
".",
"QueryEscape",
"(",
"name",
")",
")",
",",
"profile",
",",
"\"",
"\"",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"return",
"nil",
"\n",
"}"
] |
9,066 | all-9067 | [
"UnmarshalJSON",
"supports",
"json",
".",
"Unmarshaler",
"interface"
] | [
"func",
"(",
"v",
"*",
"EventChildNodeInserted",
")",
"UnmarshalJSON",
"(",
"<mask>",
"[",
"]",
"byte",
")",
"error",
"{",
"r",
":=",
"jlexer",
".",
"Lexer",
"{",
"Data",
":",
"data",
"}",
"\n",
"easyjsonC5a4559bDecodeGithubComChromedpCdprotoDom64",
"(",
"&",
"r",
",",
"v",
")",
"\n",
"return",
"r",
".",
"Error",
"(",
")",
"\n",
"}"
] |
9,067 | all-9068 | [
"FailRequest",
"causes",
"the",
"request",
"to",
"fail",
"with",
"specified",
"reason",
".",
"See",
":",
"https",
":",
"//",
"chromedevtools",
".",
"github",
".",
"io",
"/",
"devtools",
"-",
"protocol",
"/",
"tot",
"/",
"Fetch#method",
"-",
"failRequest",
"parameters",
":",
"requestID",
"-",
"An",
"id",
"the",
"client",
"received",
"in",
"requestPaused",
"event",
".",
"errorReason",
"-",
"Causes",
"the",
"request",
"to",
"fail",
"with",
"the",
"given",
"reason",
"."
] | [
"func",
"FailRequest",
"(",
"requestID",
"RequestID",
",",
"errorReason",
"<mask>",
".",
"ErrorReason",
")",
"*",
"FailRequestParams",
"{",
"return",
"&",
"FailRequestParams",
"{",
"RequestID",
":",
"requestID",
",",
"ErrorReason",
":",
"errorReason",
",",
"}",
"\n",
"}"
] |
9,068 | all-9069 | [
"HasStatsdInterval",
"returns",
"a",
"boolean",
"if",
"a",
"field",
"has",
"been",
"set",
"."
] | [
"func",
"(",
"m",
"*",
"MetricMetadata",
")",
"HasStatsdInterval",
"(",
")",
"bool",
"{",
"if",
"m",
"!=",
"nil",
"&&",
"m",
".",
"StatsdInterval",
"!=",
"nil",
"{",
"return",
"<mask>",
"\n",
"}",
"\n\n",
"return",
"false",
"\n",
"}"
] |
9,069 | all-9070 | [
"ReadFromResource",
"reads",
"the",
"custom",
"attributes",
"from",
"an",
"object",
"and",
"saves",
"the",
"data",
"into",
"the",
"supplied",
"ResourceData",
".",
"TODO",
":",
"Add",
"error",
"handling",
"and",
"reporting",
"to",
"this",
"method",
"."
] | [
"func",
"ReadFromResource",
"(",
"client",
"*",
"govmomi",
".",
"Client",
",",
"entity",
"*",
"mo",
".",
"ManagedEntity",
",",
"d",
"*",
"schema",
".",
"ResourceData",
")",
"{",
"customAttrs",
":=",
"make",
"(",
"map",
"[",
"string",
"]",
"interface",
"{",
"}",
")",
"\n",
"if",
"len",
"(",
"entity",
".",
"CustomValue",
")",
">",
"0",
"{",
"for",
"_",
",",
"fv",
":=",
"range",
"entity",
".",
"CustomValue",
"{",
"value",
":=",
"fv",
".",
"(",
"*",
"types",
".",
"CustomFieldStringValue",
")",
".",
"<mask>",
"\n",
"if",
"value",
"!=",
"\"",
"\"",
"{",
"customAttrs",
"[",
"fmt",
".",
"Sprint",
"(",
"fv",
".",
"GetCustomFieldValue",
"(",
")",
".",
"Key",
")",
"]",
"=",
"value",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n",
"d",
".",
"Set",
"(",
"ConfigKey",
",",
"customAttrs",
")",
"\n",
"}"
] |
9,070 | all-9071 | [
"Copy",
"returns",
"a",
"copy",
"of",
"the",
"TypeToResources"
] | [
"func",
"(",
"t",
"TypeToResources",
")",
"Copy",
"(",
")",
"TypeToResources",
"{",
"n",
":=",
"TypeToResources",
"{",
"}",
"\n",
"for",
"k",
",",
"v",
":=",
"<mask>",
"t",
"{",
"n",
"[",
"k",
"]",
"=",
"v",
"\n",
"}",
"\n",
"return",
"n",
"\n",
"}"
] |
9,071 | all-9072 | [
"explain",
"prints",
"a",
"brief",
"description",
"of",
"all",
"the",
"subcommands",
"and",
"the",
"important",
"top",
"-",
"level",
"flags",
"."
] | [
"func",
"(",
"cdr",
"*",
"Commander",
")",
"explain",
"(",
"w",
"io",
".",
"Writer",
")",
"{",
"fmt",
".",
"Fprintf",
"(",
"w",
",",
"\"",
"\\n",
"\\n",
"\"",
",",
"cdr",
".",
"name",
")",
"\n",
"sort",
".",
"Sort",
"(",
"byGroupName",
"(",
"cdr",
".",
"commands",
")",
")",
"\n",
"for",
"_",
",",
"group",
":=",
"range",
"cdr",
".",
"commands",
"{",
"explainGroup",
"(",
"w",
",",
"group",
")",
"\n",
"}",
"\n",
"if",
"cdr",
".",
"topFlags",
"==",
"nil",
"{",
"fmt",
".",
"Fprintln",
"(",
"w",
",",
"\"",
"\\n",
"\"",
")",
"\n",
"return",
"\n",
"}",
"\n",
"if",
"len",
"(",
"cdr",
".",
"important",
")",
"==",
"0",
"{",
"fmt",
".",
"Fprintf",
"(",
"w",
",",
"\"",
"\\n",
"\\\"",
"\\\"",
"\\n",
"\"",
",",
"cdr",
".",
"name",
")",
"\n",
"return",
"\n",
"}",
"\n\n",
"fmt",
".",
"Fprintf",
"(",
"w",
",",
"\"",
"\\n",
"\\\"",
"\\\"",
"\\n",
"\"",
",",
"cdr",
".",
"name",
")",
"\n",
"for",
"_",
",",
"name",
":=",
"range",
"cdr",
".",
"important",
"{",
"f",
":=",
"cdr",
".",
"topFlags",
".",
"Lookup",
"(",
"<mask>",
")",
"\n",
"if",
"f",
"==",
"nil",
"{",
"panic",
"(",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"name",
")",
")",
"\n",
"}",
"\n",
"fmt",
".",
"Fprintf",
"(",
"w",
",",
"\"",
"\\n",
"\"",
",",
"f",
".",
"Name",
",",
"f",
".",
"DefValue",
",",
"f",
".",
"Usage",
")",
"\n",
"}",
"\n",
"}"
] |
9,072 | all-9073 | [
"Do",
"executes",
"Input",
".",
"dispatchTouchEvent",
"against",
"the",
"provided",
"context",
"."
] | [
"func",
"(",
"p",
"*",
"DispatchTouchEventParams",
")",
"Do",
"(",
"ctx",
"context",
".",
"<mask>",
")",
"(",
"err",
"error",
")",
"{",
"return",
"cdp",
".",
"Execute",
"(",
"ctx",
",",
"CommandDispatchTouchEvent",
",",
"p",
",",
"nil",
")",
"\n",
"}"
] |
9,073 | all-9074 | [
"GetStart",
"returns",
"the",
"Start",
"field",
"if",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"."
] | [
"func",
"(",
"p",
"*",
"Params",
")",
"GetStart",
"(",
")",
"<mask>",
"{",
"if",
"p",
"==",
"nil",
"||",
"p",
".",
"Start",
"==",
"nil",
"{",
"return",
"\"",
"\"",
"\n",
"}",
"\n",
"return",
"*",
"p",
".",
"Start",
"\n",
"}"
] |
9,074 | all-9075 | [
"Contains",
"returns",
"boolean",
"indicating",
"whether",
"given",
"ip",
"is",
"contained",
"in",
"any",
"of",
"the",
"inserted",
"networks",
"."
] | [
"func",
"(",
"p",
"*",
"prefixTrie",
")",
"Contains",
"(",
"<mask>",
"net",
".",
"IP",
")",
"(",
"bool",
",",
"error",
")",
"{",
"nn",
":=",
"rnet",
".",
"NewNetworkNumber",
"(",
"ip",
")",
"\n",
"if",
"nn",
"==",
"nil",
"{",
"return",
"false",
",",
"ErrInvalidNetworkNumberInput",
"\n",
"}",
"\n",
"return",
"p",
".",
"contains",
"(",
"nn",
")",
"\n",
"}"
] |
9,075 | all-9076 | [
"AppendChild",
"appends",
"a",
"child",
"to",
"the",
"BasicEntity"
] | [
"func",
"(",
"e",
"*",
"BasicEntity",
")",
"AppendChild",
"(",
"child",
"*",
"BasicEntity",
")",
"{",
"child",
".",
"parent",
"=",
"e",
"\n",
"e",
".",
"children",
"=",
"<mask>",
"(",
"e",
".",
"children",
",",
"*",
"child",
")",
"\n",
"}"
] |
9,076 | all-9077 | [
"TODO",
"(",
"c4milo",
")",
":",
"Legacy",
"function",
"this",
"is",
"to",
"be",
"removed",
"once",
"we",
"migrate",
"the",
"dependant",
"code"
] | [
"func",
"writeVmx",
"(",
"path",
"string",
",",
"vmx",
"map",
"[",
"string",
"]",
"string",
")",
"error",
"{",
"f",
",",
"err",
":=",
"os",
".",
"Create",
"(",
"path",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"defer",
"f",
".",
"Close",
"(",
")",
"\n\n",
"keys",
":=",
"make",
"(",
"[",
"]",
"string",
",",
"len",
"(",
"vmx",
")",
")",
"\n",
"i",
":=",
"0",
"\n",
"for",
"k",
":=",
"range",
"vmx",
"{",
"keys",
"[",
"i",
"]",
"=",
"k",
"\n",
"i",
"++",
"\n",
"}",
"\n\n",
"sort",
".",
"Strings",
"(",
"keys",
")",
"\n\n",
"<mask>",
"buf",
"bytes",
".",
"Buffer",
"\n",
"for",
"_",
",",
"key",
":=",
"range",
"keys",
"{",
"buf",
".",
"WriteString",
"(",
"key",
"+",
"\"",
"\"",
"+",
"`\"`",
"+",
"vmx",
"[",
"key",
"]",
"+",
"`\"`",
")",
"\n",
"buf",
".",
"WriteString",
"(",
"\"",
"\\n",
"\"",
")",
"\n",
"}",
"\n\n",
"if",
"_",
",",
"err",
"=",
"io",
".",
"Copy",
"(",
"f",
",",
"&",
"buf",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"return",
"nil",
"\n",
"}"
] |
9,077 | all-9078 | [
"UnmarshalJSON",
"supports",
"json",
".",
"Unmarshaler",
"interface"
] | [
"func",
"(",
"v",
"*",
"MediaQueryExpression",
")",
"UnmarshalJSON",
"(",
"data",
"[",
"]",
"<mask>",
")",
"error",
"{",
"r",
":=",
"jlexer",
".",
"Lexer",
"{",
"Data",
":",
"data",
"}",
"\n",
"easyjsonC5a4559bDecodeGithubComChromedpCdprotoCss29",
"(",
"&",
"r",
",",
"v",
")",
"\n",
"return",
"r",
".",
"Error",
"(",
")",
"\n",
"}"
] |
9,078 | all-9079 | [
"GetPresence",
"retrieves",
"a",
"user",
"s",
"presence",
".",
"If",
"the",
"from",
"address",
"is",
"an",
"empty",
"string",
"the",
"default",
"(",
"yourapp"
] | [
"func",
"GetPresence",
"(",
"c",
"context",
".",
"Context",
",",
"to",
"string",
",",
"from",
"string",
")",
"(",
"string",
",",
"error",
")",
"{",
"req",
":=",
"&",
"pb",
".",
"PresenceRequest",
"{",
"Jid",
":",
"&",
"to",
",",
"}",
"\n",
"if",
"from",
"!=",
"\"",
"\"",
"{",
"req",
".",
"FromJid",
"=",
"&",
"from",
"\n",
"}",
"\n",
"res",
":=",
"&",
"pb",
".",
"PresenceResponse",
"{",
"}",
"\n",
"if",
"err",
":=",
"internal",
".",
"Call",
"(",
"c",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"req",
",",
"res",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"\"",
"\"",
",",
"err",
"\n",
"}",
"\n",
"if",
"!",
"*",
"res",
".",
"IsAvailable",
"||",
"res",
".",
"Presence",
"==",
"nil",
"{",
"return",
"\"",
"\"",
",",
"ErrPresenceUnavailable",
"\n",
"}",
"\n",
"presence",
",",
"ok",
":=",
"presenceMap",
"[",
"*",
"<mask>",
".",
"Presence",
"]",
"\n",
"if",
"ok",
"{",
"return",
"presence",
",",
"nil",
"\n",
"}",
"\n",
"return",
"\"",
"\"",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"*",
"res",
".",
"Presence",
")",
"\n",
"}"
] |
9,079 | all-9080 | [
"ReleaseBuffer",
"returns",
"a",
"buffer",
"to",
"the",
"pool",
"to",
"be",
"re",
"-",
"used",
"."
] | [
"func",
"ReleaseBuffer",
"(",
"buf",
"*",
"<mask>",
".",
"Buffer",
")",
"{",
"if",
"buf",
"!=",
"nil",
"{",
"buf",
".",
"Reset",
"(",
")",
"\n",
"bufferPool",
".",
"Put",
"(",
"buf",
")",
"\n",
"}",
"\n",
"}"
] |
9,080 | all-9081 | [
"HasQuery",
"returns",
"a",
"boolean",
"if",
"a",
"field",
"has",
"been",
"set",
"."
] | [
"func",
"(",
"a",
"*",
"ApmOrLogQuerySearch",
")",
"HasQuery",
"(",
")",
"bool",
"{",
"if",
"a",
"!=",
"nil",
"&&",
"a",
".",
"Query",
"!=",
"nil",
"{",
"return",
"true",
"\n",
"}",
"\n\n",
"return",
"<mask>",
"\n",
"}"
] |
9,081 | all-9082 | [
"InsertColumn",
"()",
"is",
"a",
"wrapper",
"around",
"gtk_grid_insert_column",
"()",
"."
] | [
"func",
"(",
"v",
"*",
"Grid",
")",
"InsertColumn",
"(",
"position",
"int",
")",
"{",
"C",
".",
"gtk_grid_insert_column",
"(",
"v",
".",
"native",
"(",
")",
",",
"C",
".",
"gint",
"(",
"<mask>",
")",
")",
"\n",
"}"
] |
9,082 | all-9083 | [
"Internal",
"helper",
"to",
"calculate",
"new",
"commitIndex",
"from",
"matchIndexes",
".",
"Must",
"be",
"called",
"with",
"lock",
"held",
"."
] | [
"func",
"(",
"c",
"*",
"commitment",
")",
"recalculate",
"(",
")",
"{",
"if",
"len",
"(",
"c",
".",
"matchIndexes",
")",
"==",
"0",
"{",
"return",
"\n",
"}",
"\n\n",
"matched",
":=",
"<mask>",
"(",
"[",
"]",
"uint64",
",",
"0",
",",
"len",
"(",
"c",
".",
"matchIndexes",
")",
")",
"\n",
"for",
"_",
",",
"idx",
":=",
"range",
"c",
".",
"matchIndexes",
"{",
"matched",
"=",
"append",
"(",
"matched",
",",
"idx",
")",
"\n",
"}",
"\n",
"sort",
".",
"Sort",
"(",
"uint64Slice",
"(",
"matched",
")",
")",
"\n",
"quorumMatchIndex",
":=",
"matched",
"[",
"(",
"len",
"(",
"matched",
")",
"-",
"1",
")",
"/",
"2",
"]",
"\n\n",
"if",
"quorumMatchIndex",
">",
"c",
".",
"commitIndex",
"&&",
"quorumMatchIndex",
">=",
"c",
".",
"startIndex",
"{",
"c",
".",
"commitIndex",
"=",
"quorumMatchIndex",
"\n",
"asyncNotifyCh",
"(",
"c",
".",
"commitCh",
")",
"\n",
"}",
"\n",
"}"
] |
9,083 | all-9084 | [
"LongestPrefix",
"is",
"like",
"Get",
"but",
"instead",
"of",
"an",
"exact",
"match",
"it",
"will",
"return",
"the",
"longest",
"prefix",
"match",
"."
] | [
"func",
"(",
"t",
"*",
"Tree",
")",
"LongestPrefix",
"(",
"s",
"string",
")",
"(",
"string",
",",
"interface",
"{",
"}",
",",
"bool",
")",
"{",
"var",
"last",
"*",
"leafNode",
"\n",
"n",
":=",
"t",
".",
"root",
"\n",
"search",
":=",
"s",
"\n",
"for",
"{",
"// Look for a leaf node",
"if",
"n",
".",
"isLeaf",
"(",
")",
"{",
"last",
"=",
"n",
".",
"leaf",
"\n",
"}",
"\n\n",
"// Check for key exhaution",
"if",
"len",
"(",
"search",
")",
"==",
"0",
"{",
"break",
"\n",
"}",
"\n\n",
"// Look for an edge",
"n",
"=",
"n",
".",
"getEdge",
"(",
"search",
"[",
"0",
"]",
")",
"\n",
"if",
"n",
"==",
"nil",
"{",
"break",
"\n",
"}",
"\n\n",
"// Consume the search prefix",
"if",
"strings",
".",
"HasPrefix",
"(",
"search",
",",
"n",
".",
"prefix",
")",
"{",
"search",
"=",
"search",
"[",
"len",
"(",
"n",
".",
"prefix",
")",
":",
"]",
"\n",
"}",
"else",
"{",
"break",
"\n",
"}",
"\n",
"}",
"\n",
"if",
"last",
"!=",
"nil",
"{",
"return",
"last",
".",
"<mask>",
",",
"last",
".",
"val",
",",
"true",
"\n",
"}",
"\n",
"return",
"\"",
"\"",
",",
"nil",
",",
"false",
"\n",
"}"
] |
9,084 | all-9085 | [
"Helper",
"methods",
"used",
"by",
"the",
"application",
"to",
"get",
"the",
"request",
"-",
"scoped",
"logger",
"entry",
"and",
"set",
"additional",
"fields",
"between",
"handlers",
".",
"This",
"is",
"a",
"useful",
"pattern",
"to",
"use",
"to",
"set",
"state",
"on",
"the",
"entry",
"as",
"it",
"passes",
"through",
"the",
"handler",
"chain",
"which",
"at",
"any",
"point",
"can",
"be",
"logged",
"with",
"a",
"call",
"to",
".",
"Print",
"()",
".",
"Info",
"()",
"etc",
"."
] | [
"func",
"GetLogEntry",
"(",
"r",
"*",
"<mask>",
".",
"Request",
")",
"logrus",
".",
"FieldLogger",
"{",
"entry",
":=",
"middleware",
".",
"GetLogEntry",
"(",
"r",
")",
".",
"(",
"*",
"StructuredLoggerEntry",
")",
"\n",
"return",
"entry",
".",
"Logger",
"\n",
"}"
] |
9,085 | all-9086 | [
"Success",
"outputs",
"Success",
"level",
"log"
] | [
"func",
"Success",
"(",
"val",
"...",
"interface",
"{",
"}",
")",
"error",
"{",
"return",
"glg",
".",
"<mask>",
"(",
"OK",
",",
"blankFormat",
"(",
"len",
"(",
"val",
")",
")",
",",
"val",
"...",
")",
"\n",
"}"
] |
9,086 | all-9087 | [
"ServeHTTP",
"logs",
"the",
"request",
"and",
"response",
"data",
"to",
"Common",
"Log",
"Format"
] | [
"func",
"(",
"lh",
"*",
"commonLogHandler",
")",
"ServeHTTP",
"(",
"w",
"http",
".",
"ResponseWriter",
",",
"req",
"*",
"http",
".",
"Request",
")",
"{",
"// take a copy of the request (so it's immutable)",
"// watch the writer and capture the status and size",
"logData",
":=",
"LogData",
"{",
"Request",
":",
"*",
"req",
",",
"Response",
":",
"WatchResponseWriter",
"(",
"w",
")",
",",
"}",
"\n\n",
"logData",
".",
"Start",
"=",
"time",
".",
"Now",
"(",
")",
"\n",
"lh",
".",
"handler",
".",
"ServeHTTP",
"(",
"logData",
".",
"Response",
",",
"req",
")",
"\n",
"logData",
".",
"End",
"=",
"time",
".",
"Now",
"(",
")",
"\n\n",
"logOutput",
":=",
"bytes",
".",
"Buffer",
"{",
"}",
"\n",
"err",
":=",
"lh",
".",
"template",
".",
"Execute",
"(",
"&",
"logOutput",
",",
"logData",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"panic",
"(",
"err",
")",
"\n",
"}",
"\n\n",
"lh",
".",
"logger",
".",
"Println",
"(",
"logOutput",
".",
"<mask>",
"(",
")",
")",
"\n",
"}"
] |
9,087 | all-9088 | [
"popRandom",
"randomly",
"selects",
"an",
"element",
"of",
"set",
"and",
"pops",
"it",
"."
] | [
"func",
"popRandom",
"(",
"set",
"sets",
".",
"String",
")",
"string",
"{",
"list",
":=",
"set",
".",
"<mask>",
"(",
")",
"\n",
"sort",
".",
"Strings",
"(",
"list",
")",
"\n",
"sel",
":=",
"list",
"[",
"rand",
".",
"Intn",
"(",
"len",
"(",
"list",
")",
")",
"]",
"\n",
"set",
".",
"Delete",
"(",
"sel",
")",
"\n",
"return",
"sel",
"\n",
"}"
] |
9,088 | all-9089 | [
"ActivateCmd",
"returns",
"a",
"cobra",
".",
"Command",
"to",
"activate",
"Pachyderm",
"s",
"auth",
"system"
] | [
"func",
"ActivateCmd",
"(",
"noMetrics",
",",
"noPortForwarding",
"*",
"bool",
")",
"*",
"cobra",
".",
"Command",
"{",
"var",
"initialAdmin",
"string",
"\n",
"activate",
":=",
"&",
"cobra",
".",
"Command",
"{",
"Short",
":",
"\"",
"\"",
",",
"Long",
":",
"`\nActivate Pachyderm's auth system, and restrict access to existing data to the\nuser running the command (or the argument to --initial-admin), who will be the\nfirst cluster admin`",
"[",
"1",
":",
"]",
",",
"Run",
":",
"cmdutil",
".",
"Run",
"(",
"func",
"(",
"args",
"[",
"]",
"string",
")",
"error",
"{",
"var",
"token",
"string",
"\n",
"var",
"err",
"error",
"\n",
"if",
"!",
"strings",
".",
"HasPrefix",
"(",
"initialAdmin",
",",
"auth",
".",
"RobotPrefix",
")",
"{",
"<mask>",
",",
"err",
"=",
"githubLogin",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"}",
"\n",
"fmt",
".",
"Println",
"(",
"\"",
"\"",
")",
"\n\n",
"// Exchange GitHub token for Pachyderm token",
"c",
",",
"err",
":=",
"client",
".",
"NewOnUserMachine",
"(",
"!",
"*",
"noMetrics",
",",
"!",
"*",
"noPortForwarding",
",",
"\"",
"\"",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"}",
"\n",
"defer",
"c",
".",
"Close",
"(",
")",
"\n",
"resp",
",",
"err",
":=",
"c",
".",
"Activate",
"(",
"c",
".",
"Ctx",
"(",
")",
",",
"&",
"auth",
".",
"ActivateRequest",
"{",
"GitHubToken",
":",
"token",
",",
"Subject",
":",
"initialAdmin",
",",
"}",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"grpcutil",
".",
"ScrubGRPC",
"(",
"err",
")",
")",
"\n",
"}",
"\n",
"if",
"err",
":=",
"writePachTokenToCfg",
"(",
"resp",
".",
"PachToken",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"if",
"strings",
".",
"HasPrefix",
"(",
"initialAdmin",
",",
"auth",
".",
"RobotPrefix",
")",
"{",
"fmt",
".",
"Println",
"(",
"\"",
"\"",
"+",
"\"",
"\\n",
"\"",
"+",
"\"",
"\"",
")",
"\n",
"fmt",
".",
"Printf",
"(",
"\"",
"\\\"",
"\\\"",
"\\n",
"\\n",
"\"",
",",
"initialAdmin",
",",
"resp",
".",
"PachToken",
")",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}",
")",
",",
"}",
"\n",
"activate",
".",
"PersistentFlags",
"(",
")",
".",
"StringVar",
"(",
"&",
"initialAdmin",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"`\nThe subject (robot user or github user) who\nwill be the first cluster admin; the user running 'activate' will identify as\nthis user once auth is active. If you set 'initial-admin' to a robot\nuser, pachctl will print that robot user's Pachyderm token; this token is\neffectively a root token, and if it's lost you will be locked out of your\ncluster`",
"[",
"1",
":",
"]",
")",
"\n",
"return",
"cmdutil",
".",
"CreateAlias",
"(",
"activate",
",",
"\"",
"\"",
")",
"\n",
"}"
] |
9,089 | all-9090 | [
"UnmarshalJSON",
"supports",
"json",
".",
"Unmarshaler",
"interface"
] | [
"func",
"(",
"v",
"*",
"GetAppManifestReturns",
")",
"UnmarshalJSON",
"(",
"data",
"[",
"]",
"byte",
")",
"error",
"{",
"r",
":=",
"jlexer",
".",
"Lexer",
"{",
"Data",
":",
"data",
"}",
"\n",
"easyjsonC5a4559bDecodeGithubComChromedpCdprotoPage42",
"(",
"&",
"r",
",",
"v",
")",
"\n",
"return",
"r",
".",
"<mask>",
"(",
")",
"\n",
"}"
] |
9,090 | all-9091 | [
"linkGRs",
"links",
"two",
"goroutines",
"together",
"allowing",
"the",
"child",
"to",
"access",
"the",
"data",
"present",
"in",
"the",
"parent",
"."
] | [
"func",
"linkGRs",
"(",
"parentData",
"Values",
")",
"{",
"childID",
":=",
"curGoroutineID",
"(",
")",
"\n",
"dataLock",
".",
"Lock",
"(",
")",
"\n",
"<mask>",
"[",
"childID",
"]",
"=",
"parentData",
"\n",
"dataLock",
".",
"Unlock",
"(",
")",
"\n",
"}"
] |
9,091 | all-9092 | [
"expandVirtualMachineConfigSpec",
"reads",
"certain",
"ResourceData",
"keys",
"and",
"returns",
"a",
"VirtualMachineConfigSpec",
"."
] | [
"func",
"expandVirtualMachineConfigSpec",
"(",
"d",
"*",
"schema",
".",
"ResourceData",
",",
"client",
"*",
"govmomi",
".",
"Client",
")",
"(",
"<mask>",
".",
"VirtualMachineConfigSpec",
",",
"error",
")",
"{",
"log",
".",
"Printf",
"(",
"\"",
"\"",
",",
"resourceVSphereVirtualMachineIDString",
"(",
"d",
")",
")",
"\n",
"vappConfig",
",",
"err",
":=",
"expandVAppConfig",
"(",
"d",
",",
"client",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"types",
".",
"VirtualMachineConfigSpec",
"{",
"}",
",",
"err",
"\n",
"}",
"\n\n",
"obj",
":=",
"types",
".",
"VirtualMachineConfigSpec",
"{",
"Name",
":",
"d",
".",
"Get",
"(",
"\"",
"\"",
")",
".",
"(",
"string",
")",
",",
"GuestId",
":",
"getWithRestart",
"(",
"d",
",",
"\"",
"\"",
")",
".",
"(",
"string",
")",
",",
"AlternateGuestName",
":",
"getWithRestart",
"(",
"d",
",",
"\"",
"\"",
")",
".",
"(",
"string",
")",
",",
"Annotation",
":",
"d",
".",
"Get",
"(",
"\"",
"\"",
")",
".",
"(",
"string",
")",
",",
"Tools",
":",
"expandToolsConfigInfo",
"(",
"d",
")",
",",
"Flags",
":",
"expandVirtualMachineFlagInfo",
"(",
"d",
")",
",",
"NumCPUs",
":",
"expandCPUCountConfig",
"(",
"d",
")",
",",
"NumCoresPerSocket",
":",
"int32",
"(",
"getWithRestart",
"(",
"d",
",",
"\"",
"\"",
")",
".",
"(",
"int",
")",
")",
",",
"MemoryMB",
":",
"expandMemorySizeConfig",
"(",
"d",
")",
",",
"MemoryHotAddEnabled",
":",
"getBoolWithRestart",
"(",
"d",
",",
"\"",
"\"",
")",
",",
"CpuHotAddEnabled",
":",
"getBoolWithRestart",
"(",
"d",
",",
"\"",
"\"",
")",
",",
"CpuHotRemoveEnabled",
":",
"getBoolWithRestart",
"(",
"d",
",",
"\"",
"\"",
")",
",",
"CpuAllocation",
":",
"expandVirtualMachineResourceAllocation",
"(",
"d",
",",
"\"",
"\"",
")",
",",
"MemoryAllocation",
":",
"expandVirtualMachineResourceAllocation",
"(",
"d",
",",
"\"",
"\"",
")",
",",
"MemoryReservationLockedToMax",
":",
"getMemoryReservationLockedToMax",
"(",
"d",
")",
",",
"ExtraConfig",
":",
"expandExtraConfig",
"(",
"d",
")",
",",
"SwapPlacement",
":",
"getWithRestart",
"(",
"d",
",",
"\"",
"\"",
")",
".",
"(",
"string",
")",
",",
"BootOptions",
":",
"expandVirtualMachineBootOptions",
"(",
"d",
",",
"client",
")",
",",
"VAppConfig",
":",
"vappConfig",
",",
"Firmware",
":",
"getWithRestart",
"(",
"d",
",",
"\"",
"\"",
")",
".",
"(",
"string",
")",
",",
"NestedHVEnabled",
":",
"getBoolWithRestart",
"(",
"d",
",",
"\"",
"\"",
")",
",",
"VPMCEnabled",
":",
"getBoolWithRestart",
"(",
"d",
",",
"\"",
"\"",
")",
",",
"LatencySensitivity",
":",
"expandLatencySensitivity",
"(",
"d",
")",
",",
"}",
"\n\n",
"return",
"obj",
",",
"nil",
"\n",
"}"
] |
9,092 | all-9093 | [
"Any",
"tests",
"an",
"Enumerable",
"to",
"see",
"if",
"there",
"are",
"any",
"elements",
"present",
"."
] | [
"func",
"Any",
"(",
"iterator",
"Enumerable",
")",
"bool",
"{",
"done",
":=",
"make",
"(",
"chan",
"struct",
"{",
"}",
")",
"\n",
"defer",
"close",
"(",
"done",
")",
"\n\n",
"for",
"range",
"iterator",
".",
"Enumerate",
"(",
"done",
")",
"{",
"return",
"true",
"\n",
"}",
"\n",
"return",
"<mask>",
"\n",
"}"
] |
9,093 | all-9094 | [
"Permission",
"returns",
"the",
"needed",
"RBAC",
"permission",
"to",
"cancel",
"the",
"oepration"
] | [
"func",
"(",
"t",
"OperationType",
")",
"Permission",
"(",
")",
"string",
"{",
"switch",
"t",
"{",
"case",
"OperationBackupCreate",
":",
"return",
"\"",
"\"",
"\n",
"case",
"OperationBackupRename",
":",
"return",
"\"",
"\"",
"\n",
"case",
"OperationBackupRestore",
":",
"return",
"\"",
"\"",
"\n",
"case",
"OperationBackupRemove",
":",
"return",
"\"",
"\"",
"\n",
"case",
"OperationConsoleShow",
":",
"return",
"\"",
"\"",
"\n",
"case",
"OperationContainerFreeze",
":",
"return",
"\"",
"\"",
"\n",
"case",
"OperationContainerUnfreeze",
":",
"return",
"\"",
"\"",
"\n",
"case",
"OperationContainerStart",
":",
"return",
"\"",
"\"",
"\n",
"case",
"OperationContainerStop",
":",
"return",
"\"",
"\"",
"\n",
"case",
"OperationContainerRestart",
":",
"return",
"\"",
"\"",
"\n",
"case",
"OperationCommandExec",
":",
"return",
"\"",
"\"",
"\n",
"case",
"OperationSnapshotCreate",
":",
"return",
"\"",
"\"",
"\n",
"case",
"OperationSnapshotRename",
":",
"return",
"\"",
"\"",
"\n",
"case",
"OperationSnapshotTransfer",
":",
"return",
"\"",
"\"",
"\n",
"case",
"OperationSnapshotUpdate",
":",
"return",
"\"",
"\"",
"\n",
"case",
"OperationSnapshotDelete",
":",
"return",
"\"",
"\"",
"\n\n",
"case",
"OperationContainerCreate",
":",
"return",
"\"",
"\"",
"\n",
"case",
"OperationContainerUpdate",
":",
"return",
"\"",
"\"",
"\n",
"case",
"OperationContainerRename",
":",
"return",
"\"",
"\"",
"\n",
"case",
"OperationContainerMigrate",
":",
"return",
"\"",
"\"",
"\n",
"case",
"OperationContainerLiveMigrate",
":",
"return",
"\"",
"\"",
"\n",
"case",
"OperationContainerDelete",
":",
"return",
"\"",
"\"",
"\n",
"case",
"OperationSnapshotRestore",
":",
"return",
"\"",
"\"",
"\n\n",
"case",
"OperationImageDownload",
":",
"return",
"\"",
"\"",
"\n",
"case",
"OperationImageDelete",
":",
"return",
"\"",
"\"",
"\n",
"case",
"OperationImageToken",
":",
"return",
"\"",
"\"",
"\n",
"<mask>",
"OperationImageRefresh",
":",
"return",
"\"",
"\"",
"\n",
"case",
"OperationImagesUpdate",
":",
"return",
"\"",
"\"",
"\n",
"case",
"OperationImagesSynchronize",
":",
"return",
"\"",
"\"",
"\n",
"}",
"\n\n",
"return",
"\"",
"\"",
"\n",
"}"
] |
9,094 | all-9095 | [
"OpenExistingFile",
"opens",
"an",
"existing",
"file",
"errors",
"if",
"it",
"doesn",
"t",
"exist",
"."
] | [
"func",
"OpenExistingFile",
"(",
"filename",
"string",
",",
"<mask>",
"uint32",
")",
"(",
"*",
"os",
".",
"File",
",",
"error",
")",
"{",
"openFlags",
":=",
"os",
".",
"O_RDWR",
"\n",
"if",
"flags",
"&",
"ReadOnly",
"!=",
"0",
"{",
"openFlags",
"=",
"os",
".",
"O_RDONLY",
"\n",
"}",
"\n\n",
"if",
"flags",
"&",
"Sync",
"!=",
"0",
"{",
"openFlags",
"|=",
"datasyncFileFlag",
"\n",
"}",
"\n",
"return",
"os",
".",
"OpenFile",
"(",
"filename",
",",
"openFlags",
",",
"0",
")",
"\n",
"}"
] |
9,095 | all-9096 | [
"file",
"path",
"helper"
] | [
"func",
"ensureDir",
"(",
"dir",
"string",
")",
"error",
"{",
"if",
"exists",
"(",
"dir",
")",
"{",
"return",
"nil",
"\n",
"}",
"\n",
"return",
"os",
".",
"MkdirAll",
"(",
"dir",
",",
"<mask>",
".",
"FileMode",
"(",
"0744",
")",
")",
"\n",
"}"
] |
9,096 | all-9097 | [
"SetPullCredentials",
"sets",
"the",
"credentials",
"to",
"pull",
"from",
"ECR",
"in",
"the",
"auth"
] | [
"func",
"(",
"auth",
"*",
"ECRAuthData",
")",
"SetPullCredentials",
"(",
"creds",
"credentials",
".",
"IAMRoleCredentials",
")",
"{",
"auth",
".",
"<mask>",
".",
"Lock",
"(",
")",
"\n",
"defer",
"auth",
".",
"lock",
".",
"Unlock",
"(",
")",
"\n\n",
"auth",
".",
"pullCredentials",
"=",
"creds",
"\n",
"}"
] |
9,097 | all-9098 | [
"ReadFrame",
"reads",
"a",
"frame",
"from",
"the",
"buffer",
"input",
"r",
"returning",
"it",
"or",
"an",
"error",
"if",
"something",
"went",
"wrong",
".",
"if",
"frame",
"err",
":",
"=",
"ReadFrame",
"(",
"r",
")",
";",
"err",
"!",
"=",
"nil",
"{",
"//",
"handle",
"the",
"error",
"...",
"}",
"else",
"{",
"switch",
"f",
":",
"=",
"frame",
".",
"(",
"type",
")",
"{",
"case",
"nsq",
".",
"Message",
":",
"...",
"}",
"}"
] | [
"func",
"ReadFrame",
"(",
"r",
"*",
"bufio",
".",
"Reader",
")",
"(",
"frame",
"Frame",
",",
"err",
"error",
")",
"{",
"var",
"size",
"int32",
"\n",
"var",
"ftype",
"int32",
"\n\n",
"if",
"err",
"=",
"binary",
".",
"Read",
"(",
"r",
",",
"binary",
".",
"BigEndian",
",",
"&",
"size",
")",
";",
"err",
"!=",
"nil",
"{",
"err",
"=",
"errors",
".",
"Wrap",
"(",
"err",
",",
"\"",
"\"",
")",
"\n",
"return",
"\n",
"}",
"\n\n",
"if",
"err",
"=",
"binary",
".",
"Read",
"(",
"r",
",",
"binary",
".",
"BigEndian",
",",
"&",
"ftype",
")",
";",
"err",
"!=",
"nil",
"{",
"err",
"=",
"errors",
".",
"Wrap",
"(",
"err",
",",
"\"",
"\"",
")",
"\n",
"return",
"\n",
"}",
"\n\n",
"switch",
"size",
"-=",
"4",
";",
"FrameType",
"(",
"ftype",
")",
"{",
"<mask>",
"FrameTypeResponse",
":",
"return",
"readResponse",
"(",
"int",
"(",
"size",
")",
",",
"r",
")",
"\n\n",
"case",
"FrameTypeError",
":",
"return",
"readError",
"(",
"int",
"(",
"size",
")",
",",
"r",
")",
"\n\n",
"case",
"FrameTypeMessage",
":",
"return",
"readMessage",
"(",
"int",
"(",
"size",
")",
",",
"r",
")",
"\n\n",
"default",
":",
"return",
"readUnknownFrame",
"(",
"FrameType",
"(",
"ftype",
")",
",",
"int",
"(",
"size",
")",
",",
"r",
")",
"\n",
"}",
"\n",
"}"
] |
9,098 | all-9099 | [
"flattenHostNasVolume",
"reads",
"various",
"fields",
"from",
"a",
"HostNasVolume",
"into",
"the",
"passed",
"in",
"ResourceData",
".",
"Note",
"the",
"name",
"attribute",
"is",
"not",
"set",
"here",
"bur",
"rather",
"set",
"in",
"flattenDatastoreSummary",
"and",
"sourced",
"from",
"there",
"."
] | [
"func",
"flattenHostNasVolume",
"(",
"d",
"*",
"schema",
".",
"ResourceData",
",",
"obj",
"*",
"types",
".",
"HostNasVolume",
")",
"error",
"{",
"d",
".",
"Set",
"(",
"\"",
"\"",
",",
"obj",
".",
"RemotePath",
")",
"\n",
"d",
".",
"<mask>",
"(",
"\"",
"\"",
",",
"obj",
".",
"SecurityType",
")",
"\n",
"d",
".",
"Set",
"(",
"\"",
"\"",
",",
"obj",
".",
"ProtocolEndpoint",
")",
"\n\n",
"if",
"err",
":=",
"d",
".",
"Set",
"(",
"\"",
"\"",
",",
"obj",
".",
"RemoteHostNames",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
] |
9,099 | all-9100 | [
"SetShowCloseButton",
"is",
"a",
"wrapper",
"around",
"gtk_header_bar_set_show_close_button",
"()",
"."
] | [
"func",
"(",
"v",
"*",
"HeaderBar",
")",
"SetShowCloseButton",
"(",
"<mask>",
"bool",
")",
"{",
"C",
".",
"gtk_header_bar_set_show_close_button",
"(",
"v",
".",
"native",
"(",
")",
",",
"gbool",
"(",
"setting",
")",
")",
"\n",
"}"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.