id
int32 0
25.3k
| idx
stringlengths 5
9
| nl_tokens
sequencelengths 1
418
| pl_tokens
sequencelengths 22
4.98k
|
---|---|---|---|
9,500 | all-9501 | [
"Insert",
"is",
"a",
"wrapper",
"around",
"gtk_list_box_insert",
"()",
"."
] | [
"func",
"(",
"v",
"*",
"ListBox",
")",
"Insert",
"(",
"child",
"IWidget",
",",
"<mask>",
"int",
")",
"{",
"C",
".",
"gtk_list_box_insert",
"(",
"v",
".",
"native",
"(",
")",
",",
"child",
".",
"toWidget",
"(",
")",
",",
"C",
".",
"gint",
"(",
"position",
")",
")",
"\n",
"}"
] |
9,501 | all-9502 | [
"MustPayouts",
"retrieves",
"the",
"Payouts",
"value",
"from",
"the",
"union",
"panicing",
"if",
"the",
"value",
"is",
"not",
"set",
"."
] | [
"func",
"(",
"u",
"InflationResult",
")",
"MustPayouts",
"(",
")",
"[",
"]",
"InflationPayout",
"{",
"val",
",",
"ok",
":=",
"u",
".",
"GetPayouts",
"(",
")",
"\n\n",
"if",
"!",
"<mask>",
"{",
"panic",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"return",
"val",
"\n",
"}"
] |
9,502 | all-9503 | [
"SafeUnmarshal",
"decodes",
"the",
"provided",
"reader",
"into",
"the",
"destination",
"and",
"verifies",
"that",
"provided",
"bytes",
"are",
"all",
"consumed",
"by",
"the",
"unmarshalling",
"process",
"."
] | [
"func",
"SafeUnmarshal",
"(",
"data",
"[",
"]",
"byte",
",",
"dest",
"<mask>",
"{",
"}",
")",
"error",
"{",
"r",
":=",
"bytes",
".",
"NewReader",
"(",
"data",
")",
"\n",
"n",
",",
"err",
":=",
"Unmarshal",
"(",
"r",
",",
"dest",
")",
"\n\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"if",
"n",
"!=",
"len",
"(",
"data",
")",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"len",
"(",
"data",
")",
",",
"n",
")",
"\n",
"}",
"\n\n",
"return",
"nil",
"\n",
"}"
] |
9,503 | all-9504 | [
"Set",
"is",
"required",
"for",
"kingpin",
"interfaces",
"to",
"allow",
"command",
"line",
"params",
"to",
"be",
"set",
"to",
"our",
"map",
"datatype"
] | [
"func",
"(",
"o",
"*",
"MapErrorOption",
")",
"Set",
"(",
"value",
"string",
")",
"error",
"{",
"parts",
":=",
"stringMapRegex",
".",
"Split",
"(",
"value",
",",
"2",
")",
"\n",
"if",
"len",
"(",
"parts",
")",
"!=",
"2",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"value",
")",
"\n",
"}",
"\n",
"val",
":=",
"ErrorOption",
"{",
"}",
"\n",
"val",
".",
"Set",
"(",
"<mask>",
"[",
"1",
"]",
")",
"\n",
"(",
"*",
"o",
")",
"[",
"parts",
"[",
"0",
"]",
"]",
"=",
"val",
"\n",
"return",
"nil",
"\n",
"}"
] |
9,504 | all-9505 | [
"Set",
"sets",
"the",
"value",
"in",
"the",
"format",
"min",
"[",
":",
"max",
"]",
"for",
"a",
"wait",
"timer",
"."
] | [
"func",
"(",
"w",
"*",
"WaitVar",
")",
"Set",
"(",
"value",
"string",
")",
"error",
"{",
"wait",
",",
"err",
":=",
"ParseWaitConfig",
"(",
"value",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"w",
".",
"Min",
"=",
"wait",
".",
"Min",
"\n",
"w",
".",
"Max",
"=",
"<mask>",
".",
"Max",
"\n\n",
"return",
"nil",
"\n",
"}"
] |
9,505 | all-9506 | [
"NewRSASigner",
"creates",
"an",
"RSA",
"Signer",
"for",
"the",
"specified",
"Algorithm",
"and",
"provided",
"low",
"level",
"RSA",
"implementation",
"."
] | [
"func",
"NewRSASigner",
"(",
"alg",
"Algorithm",
",",
"method",
"RSASignerVerifier",
")",
"func",
"(",
"Store",
",",
"crypto",
".",
"Hash",
")",
"(",
"Signer",
",",
"error",
")",
"{",
"return",
"func",
"(",
"store",
"Store",
",",
"hash",
"crypto",
".",
"Hash",
")",
"(",
"Signer",
",",
"error",
")",
"{",
"var",
"ok",
"bool",
"\n",
"var",
"privRaw",
",",
"pubRaw",
"interface",
"{",
"}",
"\n",
"var",
"priv",
"*",
"rsa",
".",
"PrivateKey",
"\n",
"var",
"pub",
"*",
"rsa",
".",
"PublicKey",
"\n\n",
"// check private key",
"if",
"privRaw",
",",
"ok",
"=",
"store",
".",
"PrivateKey",
"(",
")",
";",
"ok",
"{",
"if",
"priv",
",",
"ok",
"=",
"privRaw",
".",
"(",
"*",
"rsa",
".",
"PrivateKey",
")",
";",
"!",
"ok",
"{",
"return",
"nil",
",",
"ErrInvalidPrivateKey",
"\n",
"}",
"\n\n",
"// check private key length",
"if",
"priv",
".",
"N",
".",
"BitLen",
"(",
")",
"<",
"RSAMinimumBitLen",
"{",
"return",
"nil",
",",
"ErrInvalidPrivateKeySize",
"\n",
"}",
"\n",
"}",
"\n\n",
"// check public key",
"if",
"pubRaw",
",",
"ok",
"=",
"store",
".",
"PublicKey",
"(",
")",
";",
"ok",
"{",
"if",
"pub",
",",
"ok",
"=",
"pubRaw",
".",
"(",
"*",
"rsa",
".",
"PublicKey",
")",
";",
"!",
"ok",
"{",
"return",
"nil",
",",
"ErrInvalidPublicKey",
"\n",
"}",
"\n\n",
"// check public key length",
"if",
"pub",
".",
"N",
".",
"BitLen",
"(",
")",
"<",
"RSAMinimumBitLen",
"{",
"return",
"nil",
",",
"ErrInvalidPublicKeySize",
"\n",
"}",
"\n",
"}",
"\n\n",
"// check that either a private or public key has been provided",
"if",
"priv",
"==",
"nil",
"&&",
"pub",
"==",
"nil",
"{",
"return",
"nil",
",",
"ErrMissingPrivateOrPublicKey",
"\n",
"}",
"\n\n",
"return",
"&",
"RSASigner",
"{",
"alg",
":",
"alg",
",",
"method",
":",
"method",
",",
"hash",
":",
"<mask>",
",",
"priv",
":",
"priv",
",",
"pub",
":",
"pub",
",",
"}",
",",
"nil",
"\n",
"}",
"\n",
"}"
] |
9,506 | all-9507 | [
"Status",
"is",
"a",
"wrapper",
"around",
"cairo_pattern_status",
"()",
"."
] | [
"func",
"(",
"v",
"*",
"Pattern",
")",
"<mask>",
"(",
")",
"Status",
"{",
"c",
":=",
"C",
".",
"cairo_pattern_status",
"(",
"v",
".",
"native",
"(",
")",
")",
"\n",
"return",
"Status",
"(",
"c",
")",
"\n",
"}"
] |
9,507 | all-9508 | [
"SetSize",
"changes",
"control",
"size",
".",
"Constant",
"DoNotChange",
"can",
"be",
"used",
"as",
"placeholder",
"to",
"indicate",
"that",
"the",
"control",
"attrubute",
"should",
"be",
"unchanged",
".",
"Method",
"does",
"nothing",
"if",
"new",
"size",
"is",
"less",
"than",
"minimal",
"size",
"EditField",
"height",
"cannot",
"be",
"changed",
"-",
"it",
"equals",
"1",
"always"
] | [
"func",
"(",
"e",
"*",
"EditField",
")",
"SetSize",
"(",
"width",
",",
"height",
"int",
")",
"{",
"if",
"width",
"!=",
"KeepValue",
"&&",
"(",
"<mask>",
">",
"1000",
"||",
"width",
"<",
"e",
".",
"minW",
")",
"{",
"return",
"\n",
"}",
"\n",
"if",
"height",
"!=",
"KeepValue",
"&&",
"(",
"height",
">",
"200",
"||",
"height",
"<",
"e",
".",
"minH",
")",
"{",
"return",
"\n",
"}",
"\n\n",
"if",
"width",
"!=",
"KeepValue",
"{",
"e",
".",
"width",
"=",
"width",
"\n",
"}",
"\n\n",
"e",
".",
"height",
"=",
"1",
"\n",
"}"
] |
9,508 | all-9509 | [
"A",
"zero",
"Port",
"is",
"taken",
"to",
"mean",
"no",
"port",
"provided",
"per",
"BEP",
"7",
"."
] | [
"func",
"(",
"me",
"NodeAddr",
")",
"String",
"(",
")",
"string",
"{",
"if",
"me",
".",
"Port",
"==",
"0",
"{",
"return",
"<mask>",
".",
"IP",
".",
"String",
"(",
")",
"\n",
"}",
"\n",
"return",
"net",
".",
"JoinHostPort",
"(",
"me",
".",
"IP",
".",
"String",
"(",
")",
",",
"strconv",
".",
"FormatInt",
"(",
"int64",
"(",
"me",
".",
"Port",
")",
",",
"10",
")",
")",
"\n",
"}"
] |
9,509 | all-9510 | [
"DeepCopyObject",
"is",
"an",
"autogenerated",
"deepcopy",
"function",
"copying",
"the",
"receiver",
"creating",
"a",
"new",
"runtime",
".",
"Object",
"."
] | [
"func",
"(",
"<mask>",
"*",
"ProwJob",
")",
"DeepCopyObject",
"(",
")",
"runtime",
".",
"Object",
"{",
"if",
"c",
":=",
"in",
".",
"DeepCopy",
"(",
")",
";",
"c",
"!=",
"nil",
"{",
"return",
"c",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
] |
9,510 | all-9511 | [
"Copy",
"returns",
"a",
"deep",
"copy",
"of",
"this",
"configuration",
"."
] | [
"func",
"(",
"c",
"*",
"VaultConfig",
")",
"Copy",
"(",
")",
"*",
"VaultConfig",
"{",
"if",
"c",
"==",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n\n",
"<mask>",
"o",
"VaultConfig",
"\n",
"o",
".",
"Address",
"=",
"c",
".",
"Address",
"\n\n",
"o",
".",
"Enabled",
"=",
"c",
".",
"Enabled",
"\n\n",
"o",
".",
"Grace",
"=",
"c",
".",
"Grace",
"\n\n",
"o",
".",
"Namespace",
"=",
"c",
".",
"Namespace",
"\n\n",
"o",
".",
"RenewToken",
"=",
"c",
".",
"RenewToken",
"\n\n",
"if",
"c",
".",
"Retry",
"!=",
"nil",
"{",
"o",
".",
"Retry",
"=",
"c",
".",
"Retry",
".",
"Copy",
"(",
")",
"\n",
"}",
"\n\n",
"if",
"c",
".",
"SSL",
"!=",
"nil",
"{",
"o",
".",
"SSL",
"=",
"c",
".",
"SSL",
".",
"Copy",
"(",
")",
"\n",
"}",
"\n\n",
"o",
".",
"Token",
"=",
"c",
".",
"Token",
"\n\n",
"o",
".",
"VaultAgentTokenFile",
"=",
"c",
".",
"VaultAgentTokenFile",
"\n\n",
"if",
"c",
".",
"Transport",
"!=",
"nil",
"{",
"o",
".",
"Transport",
"=",
"c",
".",
"Transport",
".",
"Copy",
"(",
")",
"\n",
"}",
"\n\n",
"o",
".",
"UnwrapToken",
"=",
"c",
".",
"UnwrapToken",
"\n\n",
"return",
"&",
"o",
"\n",
"}"
] |
9,511 | all-9512 | [
"UnmarshalJSON",
"supports",
"json",
".",
"Unmarshaler",
"interface"
] | [
"func",
"(",
"v",
"*",
"PushNodeByPathToFrontendReturns",
")",
"UnmarshalJSON",
"(",
"data",
"[",
"]",
"byte",
")",
"error",
"{",
"r",
":=",
"jlexer",
".",
"Lexer",
"{",
"Data",
":",
"data",
"}",
"\n",
"easyjsonC5a4559bDecodeGithubComChromedpCdprotoDom25",
"(",
"&",
"r",
",",
"v",
")",
"\n",
"return",
"r",
".",
"<mask>",
"(",
")",
"\n",
"}"
] |
9,512 | all-9513 | [
"IsCustom",
"()",
"is",
"a",
"wrapper",
"around",
"gtk_paper_size_is_custom",
"()",
"."
] | [
"func",
"(",
"<mask>",
"*",
"PaperSize",
")",
"IsCustom",
"(",
")",
"bool",
"{",
"c",
":=",
"C",
".",
"gtk_paper_size_is_custom",
"(",
"ps",
".",
"native",
"(",
")",
")",
"\n",
"return",
"gobool",
"(",
"c",
")",
"\n",
"}"
] |
9,513 | all-9514 | [
"validateAndWrapHandlers",
"preforms",
"validation",
"and",
"wrapping",
"for",
"each",
"input",
"handler",
".",
"It",
"accepts",
"an",
"optional",
"wrapper",
"function",
"to",
"perform",
"custom",
"wrapping",
"on",
"handlers",
"."
] | [
"func",
"validateAndWrapHandlers",
"(",
"handlers",
"[",
"]",
"<mask>",
",",
"wrappers",
"...",
"func",
"(",
"Handler",
")",
"Handler",
")",
"[",
"]",
"Handler",
"{",
"var",
"wrapper",
"func",
"(",
"Handler",
")",
"Handler",
"\n",
"if",
"len",
"(",
"wrappers",
")",
">",
"0",
"{",
"wrapper",
"=",
"wrappers",
"[",
"0",
"]",
"\n",
"}",
"\n\n",
"wrappedHandlers",
":=",
"make",
"(",
"[",
"]",
"Handler",
",",
"len",
"(",
"handlers",
")",
")",
"\n",
"for",
"i",
",",
"h",
":=",
"range",
"handlers",
"{",
"h",
"=",
"validateAndWrapHandler",
"(",
"h",
")",
"\n",
"if",
"wrapper",
"!=",
"nil",
"&&",
"!",
"inject",
".",
"IsFastInvoker",
"(",
"h",
")",
"{",
"h",
"=",
"wrapper",
"(",
"h",
")",
"\n",
"}",
"\n",
"wrappedHandlers",
"[",
"i",
"]",
"=",
"h",
"\n",
"}",
"\n\n",
"return",
"wrappedHandlers",
"\n",
"}"
] |
9,514 | all-9515 | [
"cancelCtxIfJobFails",
"watches",
"jobID",
"s",
"JobPtr",
"and",
"if",
"its",
"state",
"is",
"changed",
"to",
"a",
"terminal",
"state",
"(",
"KILLED",
"FAILED",
"or",
"SUCCESS",
")",
"cancel",
"the",
"jobCtx",
"so",
"we",
"kill",
"any",
"user",
"processes"
] | [
"func",
"(",
"a",
"*",
"APIServer",
")",
"cancelCtxIfJobFails",
"(",
"jobCtx",
"context",
".",
"Context",
",",
"jobCancel",
"func",
"(",
")",
",",
"jobID",
"string",
")",
"{",
"logger",
":=",
"a",
".",
"getWorkerLogger",
"(",
")",
"// this worker's formatting logger",
"\n\n",
"backoff",
".",
"RetryNotify",
"(",
"func",
"(",
")",
"error",
"{",
"// Check if job was cancelled while backoff was sleeping",
"if",
"isDone",
"(",
"jobCtx",
")",
"{",
"return",
"nil",
"\n",
"}",
"\n\n",
"// Start watching for job state changes",
"watcher",
",",
"err",
":=",
"a",
".",
"jobs",
".",
"ReadOnly",
"(",
"jobCtx",
")",
".",
"WatchOne",
"(",
"jobID",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"if",
"col",
".",
"IsErrNotFound",
"(",
"err",
")",
"{",
"jobCancel",
"(",
")",
"// job deleted before we started--cancel the job ctx",
"\n",
"return",
"nil",
"\n",
"}",
"\n",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"jobID",
",",
"err",
")",
"\n",
"}",
"\n\n",
"// If any job events indicate that the job is done, cancel jobCtx",
"for",
"{",
"select",
"{",
"case",
"e",
":=",
"<-",
"watcher",
".",
"Watch",
"(",
")",
":",
"<mask>",
"e",
".",
"Type",
"{",
"case",
"watch",
".",
"EventPut",
":",
"var",
"jobID",
"string",
"\n",
"jobPtr",
":=",
"&",
"pps",
".",
"EtcdJobInfo",
"{",
"}",
"\n",
"if",
"err",
":=",
"e",
".",
"Unmarshal",
"(",
"&",
"jobID",
",",
"jobPtr",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"}",
"\n",
"if",
"ppsutil",
".",
"IsTerminal",
"(",
"jobPtr",
".",
"State",
")",
"{",
"jobCancel",
"(",
")",
"// cancel the job",
"\n",
"}",
"\n",
"case",
"watch",
".",
"EventDelete",
":",
"jobCancel",
"(",
")",
"// cancel the job",
"\n",
"case",
"watch",
".",
"EventError",
":",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"e",
".",
"Err",
")",
"\n",
"}",
"\n",
"case",
"<-",
"jobCtx",
".",
"Done",
"(",
")",
":",
"break",
"\n",
"}",
"\n",
"}",
"\n",
"}",
",",
"backoff",
".",
"NewInfiniteBackOff",
"(",
")",
",",
"func",
"(",
"err",
"error",
",",
"d",
"time",
".",
"Duration",
")",
"error",
"{",
"if",
"jobCtx",
".",
"Err",
"(",
")",
"==",
"context",
".",
"Canceled",
"{",
"return",
"err",
"// worker is done, nothing else to do",
"\n",
"}",
"\n",
"logger",
".",
"Logf",
"(",
"\"",
"\"",
",",
"jobID",
",",
"err",
",",
"d",
")",
"\n",
"return",
"nil",
"\n",
"}",
")",
"\n",
"}"
] |
9,515 | all-9516 | [
"Generate",
"password",
"requirements",
"from",
"an",
"existing",
"password",
"."
] | [
"func",
"MakeRequirements",
"(",
"password",
"string",
")",
"PasswordStrengthRequirements",
"{",
"pwd",
":=",
"[",
"]",
"byte",
"(",
"password",
")",
"\n",
"reqs",
":=",
"PasswordStrengthRequirements",
"{",
"}",
"\n",
"reqs",
".",
"MaximumTotalLength",
"=",
"len",
"(",
"password",
")",
"\n",
"reqs",
".",
"MinimumTotalLength",
"=",
"len",
"(",
"password",
")",
"\n",
"for",
"i",
":=",
"range",
"pwd",
"{",
"switch",
"{",
"<mask>",
"unicode",
".",
"IsDigit",
"(",
"rune",
"(",
"pwd",
"[",
"i",
"]",
")",
")",
":",
"reqs",
".",
"Digits",
"++",
"\n",
"case",
"unicode",
".",
"IsUpper",
"(",
"rune",
"(",
"pwd",
"[",
"i",
"]",
")",
")",
":",
"reqs",
".",
"Uppercase",
"++",
"\n",
"case",
"unicode",
".",
"IsPunct",
"(",
"rune",
"(",
"pwd",
"[",
"i",
"]",
")",
")",
":",
"reqs",
".",
"Punctuation",
"++",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"reqs",
"\n",
"}"
] |
9,516 | all-9517 | [
"Negate",
"negates",
"the",
"most",
"recent",
"filter",
"."
] | [
"func",
"(",
"q",
"*",
"<mask>",
")",
"Negate",
"(",
")",
"*",
"Query",
"{",
"q",
".",
"headers",
"=",
"append",
"(",
"q",
".",
"headers",
",",
"\"",
"\"",
")",
"\n",
"return",
"q",
"\n",
"}"
] |
9,517 | all-9518 | [
"Set",
"verifies",
"the",
"argument",
"to",
"be",
"a",
"valid",
"member",
"of",
"the",
"allowed",
"values",
"before",
"setting",
"the",
"underlying",
"flag",
"value",
"."
] | [
"func",
"(",
"ss",
"*",
"SelectiveStringsValue",
")",
"Set",
"(",
"s",
"string",
")",
"error",
"{",
"<mask>",
":=",
"strings",
".",
"Split",
"(",
"s",
",",
"\"",
"\"",
")",
"\n",
"for",
"i",
":=",
"range",
"vs",
"{",
"if",
"_",
",",
"ok",
":=",
"ss",
".",
"valids",
"[",
"vs",
"[",
"i",
"]",
"]",
";",
"ok",
"{",
"ss",
".",
"vs",
"=",
"append",
"(",
"ss",
".",
"vs",
",",
"vs",
"[",
"i",
"]",
")",
"\n",
"}",
"else",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"vs",
"[",
"i",
"]",
")",
"\n",
"}",
"\n",
"}",
"\n",
"sort",
".",
"Strings",
"(",
"ss",
".",
"vs",
")",
"\n",
"return",
"nil",
"\n",
"}"
] |
9,518 | all-9519 | [
"MergeConfig",
"merges",
"two",
"config",
"objects",
"together",
"and",
"returns",
"the",
"resulting",
"configuration",
".",
"Values",
"from",
"the",
"right",
"take",
"precedence",
"over",
"the",
"left",
"side",
"."
] | [
"func",
"MergeConfig",
"(",
"a",
",",
"b",
"*",
"Config",
")",
"*",
"Config",
"{",
"// Return quickly if either side was nil",
"if",
"a",
"==",
"nil",
"{",
"return",
"b",
"\n",
"}",
"\n",
"if",
"b",
"==",
"nil",
"{",
"return",
"a",
"\n",
"}",
"\n\n",
"var",
"result",
"Config",
"=",
"*",
"a",
"\n\n",
"if",
"b",
".",
"Delim",
"!=",
"\"",
"\"",
"{",
"result",
".",
"Delim",
"=",
"b",
".",
"Delim",
"\n",
"}",
"\n",
"if",
"b",
".",
"Glue",
"!=",
"\"",
"\"",
"{",
"result",
".",
"Glue",
"=",
"b",
".",
"Glue",
"\n",
"}",
"\n",
"if",
"b",
".",
"Prefix",
"!=",
"\"",
"\"",
"{",
"result",
".",
"Prefix",
"=",
"b",
".",
"Prefix",
"\n",
"}",
"\n",
"if",
"b",
".",
"Empty",
"!=",
"\"",
"\"",
"{",
"<mask>",
".",
"Empty",
"=",
"b",
".",
"Empty",
"\n",
"}",
"\n",
"if",
"b",
".",
"NoTrim",
"{",
"result",
".",
"NoTrim",
"=",
"true",
"\n",
"}",
"\n\n",
"return",
"&",
"result",
"\n",
"}"
] |
9,519 | all-9520 | [
"ArmForSwitch",
"returns",
"which",
"field",
"name",
"should",
"be",
"used",
"for",
"storing",
"the",
"value",
"for",
"an",
"instance",
"of",
"OperationResult"
] | [
"func",
"(",
"u",
"OperationResult",
")",
"ArmForSwitch",
"(",
"sw",
"int32",
")",
"(",
"string",
",",
"bool",
")",
"{",
"switch",
"OperationResultCode",
"(",
"sw",
")",
"{",
"case",
"OperationResultCodeOpInner",
":",
"return",
"\"",
"\"",
",",
"<mask>",
"\n",
"default",
":",
"return",
"\"",
"\"",
",",
"true",
"\n",
"}",
"\n",
"}"
] |
9,520 | all-9521 | [
"Keys",
"returns",
"the",
"list",
"of",
"keys",
"in",
"this",
"map",
".",
"You",
"can",
"use",
"this",
"from",
"a",
"template",
"like",
"so",
"[",
"%",
"FOREACH",
"key",
"IN",
"hash",
".",
"Keys",
"(",
"mymap",
")",
"%",
"]",
"...",
"[",
"%",
"END",
"%",
"]",
"or"
] | [
"func",
"Keys",
"(",
"m",
"map",
"[",
"interface",
"{",
"}",
"]",
"<mask>",
"{",
"}",
")",
"[",
"]",
"interface",
"{",
"}",
"{",
"l",
":=",
"make",
"(",
"[",
"]",
"interface",
"{",
"}",
",",
"len",
"(",
"m",
")",
")",
"\n",
"i",
":=",
"0",
"\n",
"for",
"k",
":=",
"range",
"m",
"{",
"l",
"[",
"i",
"]",
"=",
"k",
"\n",
"i",
"++",
"\n",
"}",
"\n",
"return",
"l",
"\n",
"}"
] |
9,521 | all-9522 | [
"ShouldPullWithExecutionRole",
"returns",
"whether",
"this",
"container",
"has",
"its",
"own",
"ECR",
"credentials"
] | [
"func",
"(",
"c",
"*",
"<mask>",
")",
"ShouldPullWithExecutionRole",
"(",
")",
"bool",
"{",
"c",
".",
"lock",
".",
"RLock",
"(",
")",
"\n",
"defer",
"c",
".",
"lock",
".",
"RUnlock",
"(",
")",
"\n\n",
"return",
"c",
".",
"RegistryAuthentication",
"!=",
"nil",
"&&",
"c",
".",
"RegistryAuthentication",
".",
"Type",
"==",
"AuthTypeECR",
"&&",
"c",
".",
"RegistryAuthentication",
".",
"ECRAuthData",
"!=",
"nil",
"&&",
"c",
".",
"RegistryAuthentication",
".",
"ECRAuthData",
".",
"UseExecutionRole",
"\n",
"}"
] |
9,522 | all-9523 | [
"DelByType",
"removes",
"the",
"specified",
"format",
"returns",
"true",
"when",
"an",
"item",
"was",
"actually",
"removed"
] | [
"func",
"(",
"f",
"*",
"defaultFormats",
")",
"DelByFormat",
"(",
"strfmt",
"Format",
")",
"bool",
"{",
"f",
".",
"Lock",
"(",
")",
"\n",
"defer",
"f",
".",
"Unlock",
"(",
")",
"\n\n",
"tpe",
":=",
"reflect",
".",
"TypeOf",
"(",
"strfmt",
")",
"\n",
"if",
"tpe",
".",
"Kind",
"(",
")",
"==",
"reflect",
".",
"Ptr",
"{",
"tpe",
"=",
"tpe",
".",
"Elem",
"(",
")",
"\n",
"}",
"\n\n",
"for",
"i",
",",
"v",
":=",
"range",
"f",
".",
"data",
"{",
"if",
"v",
".",
"Type",
"==",
"tpe",
"{",
"f",
".",
"data",
"[",
"i",
"]",
"=",
"knownFormat",
"{",
"}",
"// release",
"\n",
"f",
".",
"data",
"=",
"append",
"(",
"f",
".",
"data",
"[",
":",
"i",
"]",
",",
"f",
".",
"<mask>",
"[",
"i",
"+",
"1",
":",
"]",
"...",
")",
"\n",
"return",
"true",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"false",
"\n",
"}"
] |
9,523 | all-9524 | [
"add",
"returns",
"the",
"sum",
"of",
"a",
"and",
"b",
"."
] | [
"func",
"add",
"(",
"b",
",",
"a",
"interface",
"{",
"}",
")",
"(",
"interface",
"{",
"}",
",",
"error",
")",
"{",
"av",
":=",
"reflect",
".",
"ValueOf",
"(",
"a",
")",
"\n",
"bv",
":=",
"reflect",
".",
"ValueOf",
"(",
"b",
")",
"\n\n",
"switch",
"av",
".",
"Kind",
"(",
")",
"{",
"case",
"reflect",
".",
"Int",
",",
"reflect",
".",
"Int8",
",",
"reflect",
".",
"Int16",
",",
"reflect",
".",
"Int32",
",",
"reflect",
".",
"Int64",
":",
"switch",
"bv",
".",
"Kind",
"(",
")",
"{",
"case",
"reflect",
".",
"Int",
",",
"reflect",
".",
"Int8",
",",
"reflect",
".",
"Int16",
",",
"reflect",
".",
"Int32",
",",
"reflect",
".",
"Int64",
":",
"return",
"av",
".",
"Int",
"(",
")",
"+",
"bv",
".",
"Int",
"(",
")",
",",
"nil",
"\n",
"case",
"reflect",
".",
"Uint",
",",
"reflect",
".",
"Uint8",
",",
"reflect",
".",
"Uint16",
",",
"reflect",
".",
"Uint32",
",",
"reflect",
".",
"Uint64",
":",
"return",
"av",
".",
"Int",
"(",
")",
"+",
"int64",
"(",
"bv",
".",
"Uint",
"(",
")",
")",
",",
"nil",
"\n",
"case",
"reflect",
".",
"Float32",
",",
"reflect",
".",
"Float64",
":",
"return",
"float64",
"(",
"av",
".",
"Int",
"(",
")",
")",
"+",
"bv",
".",
"Float",
"(",
")",
",",
"nil",
"\n",
"default",
":",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"bv",
",",
"b",
")",
"\n",
"}",
"\n",
"case",
"reflect",
".",
"Uint",
",",
"reflect",
".",
"Uint8",
",",
"reflect",
".",
"Uint16",
",",
"reflect",
".",
"Uint32",
",",
"reflect",
".",
"Uint64",
":",
"switch",
"bv",
".",
"Kind",
"(",
")",
"{",
"case",
"reflect",
".",
"Int",
",",
"reflect",
".",
"Int8",
",",
"reflect",
".",
"Int16",
",",
"reflect",
".",
"Int32",
",",
"reflect",
".",
"Int64",
":",
"return",
"int64",
"(",
"av",
".",
"Uint",
"(",
")",
")",
"+",
"bv",
".",
"Int",
"(",
")",
",",
"nil",
"\n",
"case",
"reflect",
".",
"Uint",
",",
"reflect",
".",
"Uint8",
",",
"reflect",
".",
"Uint16",
",",
"reflect",
".",
"Uint32",
",",
"reflect",
".",
"Uint64",
":",
"return",
"av",
".",
"Uint",
"(",
")",
"+",
"bv",
".",
"Uint",
"(",
")",
",",
"nil",
"\n",
"<mask>",
"reflect",
".",
"Float32",
",",
"reflect",
".",
"Float64",
":",
"return",
"float64",
"(",
"av",
".",
"Uint",
"(",
")",
")",
"+",
"bv",
".",
"Float",
"(",
")",
",",
"nil",
"\n",
"default",
":",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"bv",
",",
"b",
")",
"\n",
"}",
"\n",
"case",
"reflect",
".",
"Float32",
",",
"reflect",
".",
"Float64",
":",
"switch",
"bv",
".",
"Kind",
"(",
")",
"{",
"case",
"reflect",
".",
"Int",
",",
"reflect",
".",
"Int8",
",",
"reflect",
".",
"Int16",
",",
"reflect",
".",
"Int32",
",",
"reflect",
".",
"Int64",
":",
"return",
"av",
".",
"Float",
"(",
")",
"+",
"float64",
"(",
"bv",
".",
"Int",
"(",
")",
")",
",",
"nil",
"\n",
"case",
"reflect",
".",
"Uint",
",",
"reflect",
".",
"Uint8",
",",
"reflect",
".",
"Uint16",
",",
"reflect",
".",
"Uint32",
",",
"reflect",
".",
"Uint64",
":",
"return",
"av",
".",
"Float",
"(",
")",
"+",
"float64",
"(",
"bv",
".",
"Uint",
"(",
")",
")",
",",
"nil",
"\n",
"case",
"reflect",
".",
"Float32",
",",
"reflect",
".",
"Float64",
":",
"return",
"av",
".",
"Float",
"(",
")",
"+",
"bv",
".",
"Float",
"(",
")",
",",
"nil",
"\n",
"default",
":",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"bv",
",",
"b",
")",
"\n",
"}",
"\n",
"default",
":",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"av",
",",
"a",
")",
"\n",
"}",
"\n",
"}"
] |
9,524 | all-9525 | [
"Remove",
"implements",
"Remove",
"method",
"of",
"PlatformService",
"interface"
] | [
"func",
"(",
"s",
"*",
"platformService",
")",
"Remove",
"(",
"name",
"string",
")",
"error",
"{",
"if",
"name",
"==",
"\"",
"\"",
"{",
"return",
"appTypes",
".",
"ErrPlatformNameMissing",
"\n",
"}",
"\n",
"conn",
",",
"err",
":=",
"db",
".",
"Conn",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"defer",
"conn",
".",
"Close",
"(",
")",
"\n",
"apps",
",",
"_",
":=",
"conn",
".",
"Apps",
"(",
")",
".",
"Find",
"(",
"bson",
".",
"M",
"{",
"\"",
"\"",
":",
"name",
"}",
")",
".",
"Count",
"(",
")",
"\n",
"if",
"apps",
">",
"0",
"{",
"return",
"appTypes",
".",
"ErrDeletePlatformWithApps",
"\n",
"}",
"\n",
"err",
"=",
"builder",
".",
"PlatformRemove",
"(",
"name",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"log",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"}",
"\n",
"images",
",",
"err",
":=",
"servicemanager",
".",
"PlatformImage",
".",
"ListImagesOrDefault",
"(",
"name",
")",
"\n",
"if",
"err",
"==",
"nil",
"{",
"for",
"_",
",",
"img",
":=",
"range",
"images",
"{",
"if",
"regErr",
":=",
"registry",
".",
"RemoveImage",
"(",
"img",
")",
";",
"regErr",
"!=",
"nil",
"{",
"<mask>",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"regErr",
")",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"else",
"{",
"log",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"}",
"\n",
"err",
"=",
"servicemanager",
".",
"PlatformImage",
".",
"DeleteImages",
"(",
"name",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"log",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"}",
"\n",
"return",
"s",
".",
"storage",
".",
"Delete",
"(",
"appTypes",
".",
"Platform",
"{",
"Name",
":",
"name",
"}",
")",
"\n",
"}"
] |
9,525 | all-9526 | [
"WithAdditionalPachdCert",
"instructs",
"the",
"New",
"*",
"functions",
"to",
"additionally",
"trust",
"the",
"signed",
"cert",
"mounted",
"in",
"Pachd",
"s",
"cert",
"volume",
".",
"This",
"is",
"used",
"by",
"Pachd",
"when",
"connecting",
"to",
"itself",
"(",
"if",
"no",
"cert",
"is",
"present",
"the",
"clients",
"cert",
"pool",
"will",
"not",
"be",
"modified",
"so",
"that",
"if",
"no",
"other",
"options",
"have",
"been",
"passed",
"pachd",
"will",
"connect",
"to",
"itself",
"over",
"an",
"insecure",
"connection",
")"
] | [
"func",
"WithAdditionalPachdCert",
"(",
")",
"Option",
"{",
"return",
"func",
"(",
"settings",
"*",
"clientSettings",
")",
"error",
"{",
"if",
"_",
",",
"err",
":=",
"<mask>",
".",
"Stat",
"(",
"grpcutil",
".",
"TLSVolumePath",
")",
";",
"err",
"==",
"nil",
"{",
"if",
"settings",
".",
"caCerts",
"==",
"nil",
"{",
"settings",
".",
"caCerts",
"=",
"x509",
".",
"NewCertPool",
"(",
")",
"\n",
"}",
"\n",
"return",
"addCertFromFile",
"(",
"settings",
".",
"caCerts",
",",
"path",
".",
"Join",
"(",
"grpcutil",
".",
"TLSVolumePath",
",",
"grpcutil",
".",
"TLSCertFile",
")",
")",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}",
"\n",
"}"
] |
9,526 | all-9527 | [
"HasProjectID",
"returns",
"a",
"boolean",
"if",
"a",
"field",
"has",
"been",
"set",
"."
] | [
"func",
"(",
"i",
"*",
"IntegrationGCPCreateRequest",
")",
"HasProjectID",
"(",
")",
"bool",
"{",
"if",
"i",
"!=",
"nil",
"&&",
"i",
".",
"ProjectID",
"!=",
"nil",
"{",
"return",
"true",
"\n",
"}",
"\n\n",
"return",
"<mask>",
"\n",
"}"
] |
9,527 | all-9528 | [
"Find",
"the",
"host",
"with",
"the",
"minimum",
"(",
"good",
"to",
"add",
"a",
"new",
"container",
")",
"and",
"maximum",
"(",
"good",
"to",
"remove",
"a",
"container",
")",
"value",
"for",
"the",
"pair",
"[",
"(",
"number",
"of",
"containers",
"for",
"app",
"-",
"process",
")",
"(",
"number",
"of",
"containers",
"in",
"host",
")",
"]"
] | [
"func",
"(",
"s",
"*",
"segregatedScheduler",
")",
"minMaxNodes",
"(",
"nodes",
"[",
"]",
"cluster",
".",
"Node",
",",
"appName",
",",
"process",
"string",
")",
"(",
"string",
",",
"string",
",",
"error",
")",
"{",
"nodesList",
":=",
"make",
"(",
"node",
".",
"NodeList",
",",
"len",
"(",
"nodes",
")",
")",
"\n",
"for",
"i",
":=",
"range",
"nodes",
"{",
"nodesList",
"[",
"i",
"]",
"=",
"&",
"clusterNodeWrapper",
"{",
"Node",
":",
"&",
"nodes",
"[",
"i",
"]",
",",
"prov",
":",
"s",
".",
"provisioner",
"}",
"\n",
"}",
"\n",
"metaFreqList",
",",
"_",
",",
"err",
":=",
"nodesList",
".",
"SplitMetadata",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"log",
".",
"Debugf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"}",
"\n",
"hostGroupMap",
":=",
"map",
"[",
"string",
"]",
"int",
"{",
"}",
"\n",
"for",
"i",
",",
"m",
":=",
"range",
"metaFreqList",
"{",
"for",
"_",
",",
"n",
":=",
"range",
"m",
".",
"Nodes",
"{",
"hostGroupMap",
"[",
"net",
".",
"URLToHost",
"(",
"n",
".",
"Address",
"(",
")",
")",
"]",
"=",
"i",
"\n",
"}",
"\n",
"}",
"\n",
"hosts",
",",
"hostsMap",
":=",
"s",
".",
"nodesToHosts",
"(",
"nodes",
")",
"\n",
"hostCountMap",
",",
"err",
":=",
"s",
".",
"aggregateContainersByHost",
"(",
"hosts",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"\"",
"\"",
",",
"\"",
"\"",
",",
"err",
"\n",
"}",
"\n",
"appCountMap",
",",
"err",
":=",
"s",
".",
"aggregateContainersByHostAppProcess",
"(",
"hosts",
",",
"appName",
",",
"process",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"\"",
"\"",
",",
"\"",
"\"",
",",
"err",
"\n",
"}",
"\n",
"priorityEntries",
":=",
"[",
"]",
"map",
"[",
"string",
"]",
"int",
"{",
"appGroupCount",
"(",
"hostGroupMap",
",",
"appCountMap",
")",
",",
"appCountMap",
",",
"hostCountMap",
"}",
"\n",
"var",
"minHost",
",",
"maxHost",
"string",
"\n",
"var",
"minScore",
"uint64",
"=",
"math",
".",
"MaxUint64",
"\n",
"<mask>",
"maxScore",
"uint64",
"=",
"0",
"\n",
"for",
"_",
",",
"host",
":=",
"range",
"hosts",
"{",
"var",
"score",
"uint64",
"\n",
"for",
"i",
",",
"e",
":=",
"range",
"priorityEntries",
"{",
"score",
"+=",
"uint64",
"(",
"e",
"[",
"host",
"]",
")",
"<<",
"uint",
"(",
"(",
"len",
"(",
"priorityEntries",
")",
"-",
"i",
"-",
"1",
")",
"*",
"(",
"64",
"/",
"len",
"(",
"priorityEntries",
")",
")",
")",
"\n",
"}",
"\n",
"if",
"score",
"<",
"minScore",
"{",
"minScore",
"=",
"score",
"\n",
"minHost",
"=",
"host",
"\n",
"}",
"\n",
"if",
"score",
">=",
"maxScore",
"{",
"maxScore",
"=",
"score",
"\n",
"maxHost",
"=",
"host",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"hostsMap",
"[",
"minHost",
"]",
",",
"hostsMap",
"[",
"maxHost",
"]",
",",
"nil",
"\n",
"}"
] |
9,528 | all-9529 | [
"HasType",
"returns",
"a",
"boolean",
"if",
"a",
"field",
"has",
"been",
"set",
"."
] | [
"func",
"(",
"q",
"*",
"QueryValueDefinition",
")",
"HasType",
"(",
")",
"bool",
"{",
"if",
"q",
"!=",
"nil",
"&&",
"q",
".",
"<mask>",
"!=",
"nil",
"{",
"return",
"true",
"\n",
"}",
"\n\n",
"return",
"false",
"\n",
"}"
] |
9,529 | all-9530 | [
"MarshalJSON",
"supports",
"json",
".",
"Marshaler",
"interface"
] | [
"func",
"(",
"v",
"InternalPropertyDescriptor",
")",
"MarshalJSON",
"(",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"w",
":=",
"jwriter",
".",
"Writer",
"{",
"}",
"\n",
"easyjsonC5a4559bEncodeGithubComChromedpCdprotoRuntime18",
"(",
"&",
"w",
",",
"v",
")",
"\n",
"return",
"w",
".",
"Buffer",
".",
"BuildBytes",
"(",
")",
",",
"w",
".",
"<mask>",
"\n",
"}"
] |
9,530 | all-9531 | [
"MarshalJSON",
"supports",
"json",
".",
"Marshaler",
"interface"
] | [
"func",
"(",
"v",
"PushNodesByBackendIdsToFrontendParams",
")",
"MarshalJSON",
"(",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"w",
":=",
"jwriter",
".",
"Writer",
"{",
"}",
"\n",
"easyjsonC5a4559bEncodeGithubComChromedpCdprotoDom24",
"(",
"&",
"w",
",",
"v",
")",
"\n",
"return",
"w",
".",
"<mask>",
".",
"BuildBytes",
"(",
")",
",",
"w",
".",
"Error",
"\n",
"}"
] |
9,531 | all-9532 | [
"Push",
"creates",
"a",
"new",
"value",
"under",
"the",
"current",
"root",
"url",
".",
"A",
"populated",
"pointer",
"with",
"that",
"value",
"is",
"also",
"returned",
"."
] | [
"func",
"(",
"c",
"*",
"Client",
")",
"Push",
"(",
"value",
"interface",
"{",
"}",
",",
"params",
"map",
"[",
"string",
"]",
"string",
")",
"(",
"*",
"<mask>",
",",
"error",
")",
"{",
"body",
",",
"err",
":=",
"json",
".",
"Marshal",
"(",
"value",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"log",
".",
"Printf",
"(",
"\"",
"\\n",
"\"",
",",
"err",
")",
"\n",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"res",
",",
"err",
":=",
"c",
".",
"api",
".",
"Call",
"(",
"\"",
"\"",
",",
"c",
".",
"Url",
",",
"c",
".",
"Auth",
",",
"body",
",",
"params",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"var",
"r",
"map",
"[",
"string",
"]",
"string",
"\n\n",
"err",
"=",
"json",
".",
"Unmarshal",
"(",
"res",
",",
"&",
"r",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"log",
".",
"Printf",
"(",
"\"",
"\\n",
"\"",
",",
"err",
")",
"\n",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"ret",
":=",
"&",
"Client",
"{",
"api",
":",
"c",
".",
"api",
",",
"Auth",
":",
"c",
".",
"Auth",
",",
"Url",
":",
"c",
".",
"Url",
"+",
"\"",
"\"",
"+",
"r",
"[",
"\"",
"\"",
"]",
",",
"value",
":",
"value",
"}",
"\n\n",
"return",
"ret",
",",
"nil",
"\n",
"}"
] |
9,532 | all-9533 | [
"HasType",
"returns",
"a",
"boolean",
"if",
"a",
"field",
"has",
"been",
"set",
"."
] | [
"func",
"(",
"t",
"*",
"TileDefRequest",
")",
"HasType",
"(",
")",
"bool",
"{",
"if",
"t",
"!=",
"nil",
"&&",
"t",
".",
"Type",
"!=",
"nil",
"{",
"return",
"true",
"\n",
"}",
"\n\n",
"return",
"<mask>",
"\n",
"}"
] |
9,533 | all-9534 | [
"Read",
"the",
"user",
"s",
"answer",
"from",
"the",
"input",
"stream",
"trimming",
"newline",
"and",
"providing",
"a",
"default",
"."
] | [
"func",
"readAnswer",
"(",
"defaultAnswer",
"string",
")",
"string",
"{",
"answer",
",",
"_",
":=",
"stdin",
".",
"ReadString",
"(",
"'\\n'",
")",
"\n",
"answer",
"=",
"strings",
".",
"TrimSuffix",
"(",
"answer",
",",
"\"",
"\\n",
"\"",
")",
"\n",
"answer",
"=",
"strings",
".",
"TrimSpace",
"(",
"<mask>",
")",
"\n",
"if",
"answer",
"==",
"\"",
"\"",
"{",
"answer",
"=",
"defaultAnswer",
"\n",
"}",
"\n\n",
"return",
"answer",
"\n",
"}"
] |
9,534 | all-9535 | [
"get",
"gets",
"the",
"named",
"builder",
"from",
"the",
"registry",
"."
] | [
"func",
"get",
"(",
"name",
"string",
")",
"(",
"Builder",
",",
"error",
")",
"{",
"b",
",",
"ok",
":=",
"builders",
"[",
"name",
"]",
"\n",
"if",
"!",
"ok",
"{",
"return",
"nil",
",",
"<mask>",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"name",
")",
"\n",
"}",
"\n",
"return",
"b",
",",
"nil",
"\n",
"}"
] |
9,535 | all-9536 | [
"===",
"floor",
"(",
"Vector",
"ValueTypeVector",
")",
"Vector",
"==="
] | [
"func",
"funcFloor",
"(",
"vals",
"[",
"]",
"Value",
",",
"args",
"Expressions",
",",
"enh",
"*",
"EvalNodeHelper",
")",
"<mask>",
"{",
"return",
"simpleFunc",
"(",
"vals",
",",
"enh",
",",
"math",
".",
"Floor",
")",
"\n",
"}"
] |
9,536 | all-9537 | [
"bind",
"one",
"or",
"more",
"named",
"sampler",
"objects",
"to",
"a",
"sequence",
"of",
"consecutive",
"sampler",
"units"
] | [
"func",
"BindSamplers",
"(",
"<mask>",
"uint32",
",",
"count",
"int32",
",",
"samplers",
"*",
"uint32",
")",
"{",
"C",
".",
"glowBindSamplers",
"(",
"gpBindSamplers",
",",
"(",
"C",
".",
"GLuint",
")",
"(",
"first",
")",
",",
"(",
"C",
".",
"GLsizei",
")",
"(",
"count",
")",
",",
"(",
"*",
"C",
".",
"GLuint",
")",
"(",
"unsafe",
".",
"Pointer",
"(",
"samplers",
")",
")",
")",
"\n",
"}"
] |
9,537 | all-9538 | [
"Contain",
"returns",
"whether",
"the",
"named",
"file",
"contains",
"the",
"byte",
"slice",
"b",
".",
"The",
"return",
"value",
"is",
"a",
"boolean",
"."
] | [
"func",
"Contain",
"(",
"filename",
"string",
",",
"b",
"[",
"]",
"byte",
")",
"(",
"bool",
",",
"error",
")",
"{",
"f",
",",
"err",
":=",
"os",
".",
"Open",
"(",
"filename",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"false",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"}",
"\n",
"defer",
"f",
".",
"Close",
"(",
")",
"\n\n",
"buf",
":=",
"bufio",
".",
"NewReader",
"(",
"f",
")",
"\n\n",
"for",
"{",
"line",
",",
"err",
":=",
"buf",
".",
"ReadBytes",
"(",
"'\\n'",
")",
"\n",
"if",
"err",
"==",
"io",
".",
"EOF",
"{",
"<mask>",
"\n",
"}",
"\n",
"if",
"bytes",
".",
"Contains",
"(",
"line",
",",
"b",
")",
"{",
"return",
"true",
",",
"nil",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"false",
",",
"nil",
"\n",
"}"
] |
9,538 | all-9539 | [
"IsErrPartiallyActivated",
"checks",
"if",
"an",
"error",
"is",
"a",
"ErrPartiallyActivated"
] | [
"func",
"IsErrPartiallyActivated",
"(",
"err",
"error",
")",
"bool",
"{",
"if",
"err",
"==",
"nil",
"{",
"return",
"false",
"\n",
"}",
"\n",
"// TODO(msteffen) This is unstructured because we have no way to propagate",
"// structured errors across GRPC boundaries. Fix",
"return",
"strings",
".",
"Contains",
"(",
"err",
".",
"<mask>",
"(",
")",
",",
"status",
".",
"Convert",
"(",
"ErrPartiallyActivated",
")",
".",
"Message",
"(",
")",
")",
"\n",
"}"
] |
9,539 | all-9540 | [
"UnmuteHost",
"unmutes",
"all",
"monitors",
"for",
"the",
"given",
"host"
] | [
"func",
"(",
"client",
"*",
"Client",
")",
"UnmuteHost",
"(",
"host",
"string",
")",
"(",
"*",
"HostActionResp",
",",
"error",
")",
"{",
"var",
"out",
"HostActionResp",
"\n",
"uri",
":=",
"\"",
"\"",
"+",
"<mask>",
"+",
"\"",
"\"",
"\n",
"if",
"err",
":=",
"client",
".",
"doJsonRequest",
"(",
"\"",
"\"",
",",
"uri",
",",
"nil",
",",
"&",
"out",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"return",
"&",
"out",
",",
"nil",
"\n",
"}"
] |
9,540 | all-9541 | [
"MustGetDuration",
"fetches",
"the",
"config",
"and",
"parses",
"it",
"into",
"a",
"duration",
".",
"Panics",
"on",
"failure",
"."
] | [
"func",
"(",
"c",
"*",
"cachedLoader",
")",
"MustGetDuration",
"(",
"key",
"string",
")",
"time",
".",
"Duration",
"{",
"s",
":=",
"c",
".",
"MustGetString",
"(",
"key",
")",
"\n",
"ret",
",",
"err",
":=",
"time",
".",
"ParseDuration",
"(",
"s",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"panic",
"(",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"key",
",",
"err",
")",
")",
"\n",
"}",
"\n",
"return",
"<mask>",
"\n",
"}"
] |
9,541 | all-9542 | [
"flattenClusterVmComponentProtectionSettings",
"saves",
"a",
"ClusterVmComponentProtectionSettings",
"into",
"the",
"supplied",
"ResourceData",
"."
] | [
"func",
"flattenClusterVMComponentProtectionSettings",
"(",
"d",
"*",
"schema",
".",
"ResourceData",
",",
"obj",
"*",
"types",
".",
"ClusterVmComponentProtectionSettings",
")",
"error",
"{",
"return",
"structure",
".",
"SetBatch",
"(",
"d",
",",
"map",
"[",
"string",
"]",
"<mask>",
"{",
"}",
"{",
"\"",
"\"",
":",
"obj",
".",
"VmReactionOnAPDCleared",
",",
"\"",
"\"",
":",
"obj",
".",
"VmStorageProtectionForAPD",
",",
"\"",
"\"",
":",
"obj",
".",
"VmStorageProtectionForPDL",
",",
"\"",
"\"",
":",
"obj",
".",
"VmTerminateDelayForAPDSec",
",",
"}",
")",
"\n",
"}"
] |
9,542 | all-9543 | [
"load",
"a",
"program",
"object",
"with",
"a",
"program",
"binary"
] | [
"func",
"ProgramBinary",
"(",
"program",
"uint32",
",",
"binaryFormat",
"uint32",
",",
"<mask>",
"unsafe",
".",
"Pointer",
",",
"length",
"int32",
")",
"{",
"syscall",
".",
"Syscall6",
"(",
"gpProgramBinary",
",",
"4",
",",
"uintptr",
"(",
"program",
")",
",",
"uintptr",
"(",
"binaryFormat",
")",
",",
"uintptr",
"(",
"binary",
")",
",",
"uintptr",
"(",
"length",
")",
",",
"0",
",",
"0",
")",
"\n",
"}"
] |
9,543 | all-9544 | [
"RunBenchmarks",
"runs",
"the",
"benchmarking",
"for",
"the",
"given",
"function"
] | [
"func",
"(",
"b",
"*",
"Bench",
")",
"RunBenchmarks",
"(",
"r",
"RequestFunc",
")",
"{",
"b",
".",
"request",
"=",
"r",
"\n",
"<mask>",
":=",
"b",
".",
"internalRun",
"(",
"b",
".",
"showProgress",
")",
"\n",
"b",
".",
"processResults",
"(",
"results",
")",
"\n",
"}"
] |
9,544 | all-9545 | [
"HasTime",
"returns",
"a",
"boolean",
"if",
"a",
"field",
"has",
"been",
"set",
"."
] | [
"func",
"(",
"a",
"*",
"AlertGraphDefinition",
")",
"HasTime",
"(",
")",
"bool",
"{",
"if",
"a",
"!=",
"nil",
"&&",
"a",
".",
"Time",
"!=",
"nil",
"{",
"return",
"<mask>",
"\n",
"}",
"\n\n",
"return",
"false",
"\n",
"}"
] |
9,545 | all-9546 | [
"FetchIssueEvents",
"from",
"github",
"and",
"return",
"the",
"full",
"list",
"until",
"it",
"matches",
"latest",
"The",
"entire",
"last",
"page",
"will",
"be",
"included",
"so",
"you",
"can",
"have",
"redundancy",
"."
] | [
"func",
"(",
"client",
"*",
"Client",
")",
"FetchIssueEvents",
"(",
"issueID",
"int",
",",
"latest",
"*",
"int",
",",
"c",
"chan",
"*",
"github",
".",
"IssueEvent",
")",
"{",
"opt",
":=",
"&",
"github",
".",
"ListOptions",
"{",
"PerPage",
":",
"100",
"}",
"\n\n",
"githubClient",
",",
"err",
":=",
"client",
".",
"getGitHubClient",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"close",
"(",
"c",
")",
"\n",
"glog",
".",
"Error",
"(",
"err",
")",
"\n",
"return",
"\n",
"}",
"\n\n",
"count",
":=",
"0",
"\n",
"for",
"{",
"client",
".",
"limitsCheckAndWait",
"(",
")",
"\n\n",
"events",
",",
"resp",
",",
"err",
":=",
"githubClient",
".",
"Issues",
".",
"ListIssueEvents",
"(",
"context",
".",
"Background",
"(",
")",
",",
"client",
".",
"Org",
",",
"client",
".",
"<mask>",
",",
"issueID",
",",
"opt",
",",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"glog",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"time",
".",
"Sleep",
"(",
"time",
".",
"Second",
")",
"\n",
"continue",
"\n",
"}",
"\n\n",
"for",
"_",
",",
"event",
":=",
"range",
"events",
"{",
"c",
"<-",
"event",
"\n",
"count",
"++",
"\n",
"}",
"\n",
"if",
"resp",
".",
"NextPage",
"==",
"0",
"||",
"(",
"latest",
"!=",
"nil",
"&&",
"hasID",
"(",
"events",
",",
"*",
"latest",
")",
")",
"{",
"break",
"\n",
"}",
"\n",
"opt",
".",
"Page",
"=",
"resp",
".",
"NextPage",
"\n",
"}",
"\n\n",
"glog",
".",
"Infof",
"(",
"\"",
"\"",
",",
"count",
")",
"\n",
"close",
"(",
"c",
")",
"\n",
"}"
] |
9,546 | all-9547 | [
"List",
"the",
"namespaces",
"immediately",
"under",
"a",
"given",
"namespace",
".",
"This",
"endpoint",
"lists",
"up",
"to",
"1000",
"namespaces",
".",
"If",
"more",
"namespaces",
"are",
"present",
"a",
"continuationToken",
"will",
"be",
"returned",
"which",
"can",
"be",
"given",
"in",
"the",
"next",
"request",
".",
"For",
"the",
"initial",
"request",
"the",
"payload",
"should",
"be",
"an",
"empty",
"JSON",
"object",
".",
"See",
"#listNamespaces"
] | [
"func",
"(",
"index",
"*",
"Index",
")",
"ListNamespaces",
"(",
"namespace",
",",
"continuationToken",
",",
"limit",
"string",
")",
"(",
"*",
"ListNamespacesResponse",
",",
"error",
")",
"{",
"v",
":=",
"url",
".",
"Values",
"{",
"}",
"\n",
"if",
"continuationToken",
"!=",
"\"",
"\"",
"{",
"v",
".",
"Add",
"(",
"\"",
"\"",
",",
"continuationToken",
")",
"\n",
"}",
"\n",
"if",
"limit",
"!=",
"\"",
"\"",
"{",
"v",
".",
"Add",
"(",
"\"",
"\"",
",",
"limit",
")",
"\n",
"}",
"\n",
"cd",
":=",
"tcclient",
".",
"<mask>",
"(",
"*",
"index",
")",
"\n",
"responseObject",
",",
"_",
",",
"err",
":=",
"(",
"&",
"cd",
")",
".",
"APICall",
"(",
"nil",
",",
"\"",
"\"",
",",
"\"",
"\"",
"+",
"url",
".",
"QueryEscape",
"(",
"namespace",
")",
",",
"new",
"(",
"ListNamespacesResponse",
")",
",",
"v",
")",
"\n",
"return",
"responseObject",
".",
"(",
"*",
"ListNamespacesResponse",
")",
",",
"err",
"\n",
"}"
] |
9,547 | all-9548 | [
"Return",
"all",
"versions",
"in",
"the",
"schema",
"table",
"in",
"increasing",
"order",
"."
] | [
"func",
"selectSchemaVersions",
"(",
"tx",
"*",
"sql",
".",
"Tx",
")",
"(",
"[",
"]",
"int",
",",
"error",
")",
"{",
"statement",
":=",
"`\nSELECT version FROM schema ORDER BY version\n`",
"\n",
"return",
"<mask>",
".",
"SelectIntegers",
"(",
"tx",
",",
"statement",
")",
"\n",
"}"
] |
9,548 | all-9549 | [
"ClientPreServiceSuspend",
"suspends",
"service",
"."
] | [
"func",
"(",
"w",
"*",
"Worker",
")",
"ClientPreServiceSuspend",
"(",
"job",
"*",
"data",
".",
"Job",
")",
"error",
"{",
"logger",
":=",
"w",
".",
"logger",
".",
"Add",
"(",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"job",
")",
"\n\n",
"ch",
",",
"err",
":=",
"w",
".",
"relatedChannel",
"(",
"logger",
",",
"job",
",",
"data",
".",
"JobClientPreServiceSuspend",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"logger",
"=",
"logger",
".",
"Add",
"(",
"\"",
"\"",
",",
"ch",
")",
"\n\n",
"ch",
".",
"ServiceStatus",
"=",
"data",
".",
"ServiceSuspending",
"\n",
"changedTime",
":=",
"<mask>",
".",
"Now",
"(",
")",
"\n",
"ch",
".",
"ServiceChangedTime",
"=",
"&",
"changedTime",
"\n",
"err",
"=",
"w",
".",
"saveRecord",
"(",
"logger",
",",
"w",
".",
"db",
".",
"Querier",
",",
"ch",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
] |
9,549 | all-9550 | [
"RetryNWithBackoffCtx",
"takes",
"a",
"context",
"a",
"Backoff",
"a",
"maximum",
"number",
"of",
"tries",
"n",
"and",
"a",
"function",
"that",
"returns",
"an",
"error",
".",
"The",
"function",
"is",
"called",
"until",
"it",
"does",
"not",
"return",
"an",
"error",
"the",
"context",
"is",
"done",
"or",
"the",
"maximum",
"tries",
"have",
"been",
"reached",
".",
"If",
"the",
"error",
"returned",
"is",
"Retriable",
"the",
"Retriability",
"of",
"it",
"will",
"be",
"respected",
".",
"If",
"the",
"number",
"of",
"tries",
"is",
"exhausted",
"the",
"last",
"error",
"will",
"be",
"returned",
"."
] | [
"func",
"RetryNWithBackoffCtx",
"(",
"ctx",
"context",
".",
"Context",
",",
"backoff",
"Backoff",
",",
"n",
"int",
",",
"fn",
"func",
"(",
")",
"error",
")",
"error",
"{",
"<mask>",
"err",
"error",
"\n",
"RetryWithBackoffCtx",
"(",
"ctx",
",",
"backoff",
",",
"func",
"(",
")",
"error",
"{",
"err",
"=",
"fn",
"(",
")",
"\n",
"n",
"--",
"\n",
"if",
"n",
"==",
"0",
"{",
"// Break out after n tries",
"return",
"nil",
"\n",
"}",
"\n",
"return",
"err",
"\n",
"}",
")",
"\n",
"return",
"err",
"\n",
"}"
] |
9,550 | all-9551 | [
"PlotData",
"plots",
"the",
"results",
"onto",
"a",
"graph",
"and",
"saves",
"the",
"output",
"to",
"the",
"given",
"writer"
] | [
"func",
"PlotData",
"(",
"interval",
"time",
".",
"Duration",
",",
"r",
"results",
".",
"ResultSet",
",",
"w",
"io",
".",
"Writer",
")",
"{",
"set",
":=",
"r",
".",
"Reduce",
"(",
"interval",
")",
"\n",
"t",
":=",
"results",
".",
"TabularResults",
"{",
"}",
"\n",
"rows",
":=",
"t",
".",
"Tabulate",
"(",
"set",
")",
"\n\n",
"seriesY",
":=",
"createYSeries",
"(",
"rows",
")",
"\n",
"seriesX",
":=",
"createXSeries",
"(",
"rows",
")",
"\n",
"ticks",
":=",
"createXTicks",
"(",
"rows",
")",
"\n\n",
"graph",
":=",
"chart",
".",
"Chart",
"{",
"Background",
":",
"chart",
".",
"Style",
"{",
"Padding",
":",
"chart",
".",
"Box",
"{",
"Top",
":",
"50",
",",
"Left",
":",
"25",
",",
"Right",
":",
"25",
",",
"Bottom",
":",
"25",
",",
"}",
",",
"FillColor",
":",
"drawing",
".",
"ColorFromHex",
"(",
"\"",
"\"",
")",
",",
"}",
",",
"XAxis",
":",
"chart",
".",
"XAxis",
"{",
"Name",
":",
"\"",
"\"",
",",
"NameStyle",
":",
"chart",
".",
"StyleShow",
"(",
")",
",",
"Style",
":",
"chart",
".",
"StyleShow",
"(",
")",
",",
"ValueFormatter",
":",
"func",
"(",
"v",
"interface",
"{",
"}",
")",
"string",
"{",
"return",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"v",
")",
"\n",
"}",
",",
"Ticks",
":",
"ticks",
",",
"}",
",",
"YAxis",
":",
"chart",
".",
"YAxis",
"{",
"Name",
":",
"\"",
"\"",
",",
"NameStyle",
":",
"chart",
".",
"StyleShow",
"(",
")",
",",
"Style",
":",
"chart",
".",
"StyleShow",
"(",
")",
",",
"ValueFormatter",
":",
"func",
"(",
"v",
"interface",
"{",
"}",
")",
"string",
"{",
"return",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"v",
")",
"\n",
"}",
",",
"}",
",",
"YAxisSecondary",
":",
"chart",
".",
"YAxis",
"{",
"Name",
":",
"\"",
"\"",
",",
"NameStyle",
":",
"chart",
".",
"StyleShow",
"(",
")",
",",
"Style",
":",
"chart",
".",
"StyleShow",
"(",
")",
",",
"ValueFormatter",
":",
"func",
"(",
"v",
"interface",
"{",
"}",
")",
"string",
"{",
"return",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"v",
")",
"\n",
"}",
",",
"}",
",",
"Series",
":",
"[",
"]",
"chart",
".",
"Series",
"{",
"chart",
".",
"ContinuousSeries",
"{",
"Name",
":",
"\"",
"\"",
",",
"XValues",
":",
"seriesX",
"[",
"\"",
"\"",
"]",
",",
"YValues",
":",
"seriesY",
"[",
"\"",
"\"",
"]",
",",
"Style",
":",
"chart",
".",
"Style",
"{",
"Show",
":",
"true",
",",
"//note; if we set ANY other properties, we must set this to true.",
"StrokeColor",
":",
"drawing",
".",
"ColorGreen",
",",
"// will supercede defaults",
"FillColor",
":",
"drawing",
".",
"ColorGreen",
".",
"WithAlpha",
"(",
"64",
")",
",",
"// will supercede defaults",
"}",
",",
"}",
",",
"<mask>",
".",
"ContinuousSeries",
"{",
"Name",
":",
"\"",
"\"",
",",
"XValues",
":",
"seriesX",
"[",
"\"",
"\"",
"]",
",",
"YValues",
":",
"seriesY",
"[",
"\"",
"\"",
"]",
",",
"Style",
":",
"chart",
".",
"Style",
"{",
"Show",
":",
"true",
",",
"//note; if we set ANY other properties, we must set this to true.",
"StrokeColor",
":",
"drawing",
".",
"ColorRed",
",",
"// will supercede defaults",
"FillColor",
":",
"drawing",
".",
"ColorRed",
".",
"WithAlpha",
"(",
"64",
")",
",",
"// will supercede defaults",
"}",
",",
"}",
",",
"chart",
".",
"ContinuousSeries",
"{",
"Name",
":",
"\"",
"\"",
",",
"XValues",
":",
"seriesX",
"[",
"\"",
"\"",
"]",
",",
"YValues",
":",
"seriesY",
"[",
"\"",
"\"",
"]",
",",
"Style",
":",
"chart",
".",
"Style",
"{",
"Show",
":",
"true",
",",
"//note; if we set ANY other properties, we must set this to true.",
"StrokeColor",
":",
"drawing",
".",
"ColorFromHex",
"(",
"\"",
"\"",
")",
",",
"// will supercede defaults",
"FillColor",
":",
"drawing",
".",
"ColorFromHex",
"(",
"\"",
"\"",
")",
".",
"WithAlpha",
"(",
"64",
")",
",",
"// will supercede defaults",
"}",
",",
"}",
",",
"chart",
".",
"ContinuousSeries",
"{",
"Name",
":",
"\"",
"\"",
",",
"XValues",
":",
"seriesX",
"[",
"\"",
"\"",
"]",
",",
"YValues",
":",
"seriesY",
"[",
"\"",
"\"",
"]",
",",
"Style",
":",
"chart",
".",
"Style",
"{",
"Show",
":",
"true",
",",
"//note; if we set ANY other properties, we must set this to true.",
"StrokeColor",
":",
"drawing",
".",
"ColorFromHex",
"(",
"\"",
"\"",
")",
",",
"// will supercede defaults",
"}",
",",
"}",
",",
"chart",
".",
"ContinuousSeries",
"{",
"YAxis",
":",
"chart",
".",
"YAxisSecondary",
",",
"Name",
":",
"\"",
"\"",
",",
"XValues",
":",
"seriesX",
"[",
"\"",
"\"",
"]",
",",
"YValues",
":",
"seriesY",
"[",
"\"",
"\"",
"]",
",",
"Style",
":",
"chart",
".",
"Style",
"{",
"Show",
":",
"true",
",",
"//note; if we set ANY other properties, we must set this to true.",
"StrokeColor",
":",
"drawing",
".",
"ColorBlue",
",",
"// will supercede defaults",
"}",
",",
"}",
",",
"}",
",",
"}",
"\n\n",
"//note we have to do this as a separate step because we need a reference to graph",
"graph",
".",
"Elements",
"=",
"[",
"]",
"chart",
".",
"Renderable",
"{",
"chart",
".",
"Legend",
"(",
"&",
"graph",
")",
",",
"}",
"\n\n",
"graph",
".",
"Render",
"(",
"chart",
".",
"PNG",
",",
"w",
")",
"\n",
"}"
] |
9,551 | all-9552 | [
"Call",
"initiates",
"a",
"JSON",
"-",
"RPC",
"call",
"using",
"the",
"specified",
"method",
"and",
"params",
"and",
"waits",
"for",
"the",
"response",
".",
"If",
"the",
"response",
"is",
"successful",
"its",
"result",
"is",
"stored",
"in",
"result",
"(",
"a",
"pointer",
"to",
"a",
"value",
"that",
"can",
"be",
"JSON",
"-",
"unmarshaled",
"into",
")",
";",
"otherwise",
"a",
"non",
"-",
"nil",
"error",
"is",
"returned",
"."
] | [
"func",
"(",
"c",
"*",
"Conn",
")",
"Call",
"(",
"ctx",
"context",
".",
"Context",
",",
"method",
"string",
",",
"params",
",",
"result",
"interface",
"{",
"}",
",",
"opts",
"...",
"CallOption",
")",
"error",
"{",
"req",
":=",
"&",
"Request",
"{",
"Method",
":",
"<mask>",
"}",
"\n",
"if",
"err",
":=",
"req",
".",
"SetParams",
"(",
"params",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"for",
"_",
",",
"opt",
":=",
"range",
"opts",
"{",
"if",
"opt",
"==",
"nil",
"{",
"continue",
"\n",
"}",
"\n",
"if",
"err",
":=",
"opt",
".",
"apply",
"(",
"req",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"}",
"\n",
"call",
",",
"err",
":=",
"c",
".",
"send",
"(",
"ctx",
",",
"&",
"anyMessage",
"{",
"request",
":",
"req",
"}",
",",
"true",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"select",
"{",
"case",
"err",
",",
"ok",
":=",
"<-",
"call",
".",
"done",
":",
"if",
"!",
"ok",
"{",
"err",
"=",
"ErrClosed",
"\n",
"}",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"if",
"result",
"!=",
"nil",
"{",
"if",
"call",
".",
"response",
".",
"Result",
"==",
"nil",
"{",
"call",
".",
"response",
".",
"Result",
"=",
"&",
"jsonNull",
"\n",
"}",
"\n",
"// TODO(sqs): error handling",
"if",
"err",
":=",
"json",
".",
"Unmarshal",
"(",
"*",
"call",
".",
"response",
".",
"Result",
",",
"result",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"nil",
"\n\n",
"case",
"<-",
"ctx",
".",
"Done",
"(",
")",
":",
"return",
"ctx",
".",
"Err",
"(",
")",
"\n",
"}",
"\n",
"}"
] |
9,552 | all-9553 | [
"appendDrawTrianglesHistory",
"appends",
"a",
"draw",
"-",
"image",
"history",
"item",
"to",
"the",
"image",
"."
] | [
"func",
"(",
"i",
"*",
"Image",
")",
"appendDrawTrianglesHistory",
"(",
"<mask>",
"*",
"Image",
",",
"vertices",
"[",
"]",
"float32",
",",
"indices",
"[",
"]",
"uint16",
",",
"colorm",
"*",
"affine",
".",
"ColorM",
",",
"mode",
"graphics",
".",
"CompositeMode",
",",
"filter",
"graphics",
".",
"Filter",
",",
"address",
"graphics",
".",
"Address",
")",
"{",
"if",
"i",
".",
"stale",
"||",
"i",
".",
"volatile",
"||",
"i",
".",
"screen",
"{",
"return",
"\n",
"}",
"\n",
"// TODO: Would it be possible to merge draw image history items?",
"const",
"maxDrawTrianglesHistoryNum",
"=",
"1024",
"\n",
"if",
"len",
"(",
"i",
".",
"drawTrianglesHistory",
")",
"+",
"1",
">",
"maxDrawTrianglesHistoryNum",
"{",
"i",
".",
"makeStale",
"(",
")",
"\n",
"return",
"\n",
"}",
"\n",
"// All images must be resolved and not stale each after frame.",
"// So we don't have to care if image is stale or not here.",
"item",
":=",
"&",
"drawTrianglesHistoryItem",
"{",
"image",
":",
"image",
",",
"vertices",
":",
"vertices",
",",
"indices",
":",
"indices",
",",
"colorm",
":",
"colorm",
",",
"mode",
":",
"mode",
",",
"filter",
":",
"filter",
",",
"address",
":",
"address",
",",
"}",
"\n",
"i",
".",
"drawTrianglesHistory",
"=",
"append",
"(",
"i",
".",
"drawTrianglesHistory",
",",
"item",
")",
"\n",
"}"
] |
9,553 | all-9554 | [
"Rate",
"function",
"returns",
"the",
"package",
"rate",
"and",
"byte",
"rate"
] | [
"func",
"(",
"q",
"*",
"statsQueue",
")",
"Rate",
"(",
")",
"(",
"float64",
",",
"float64",
")",
"{",
"front",
",",
"back",
":=",
"q",
".",
"frontAndBack",
"(",
")",
"\n\n",
"if",
"front",
"==",
"nil",
"||",
"back",
"==",
"nil",
"{",
"return",
"0",
",",
"0",
"\n",
"}",
"\n\n",
"if",
"<mask>",
".",
"Since",
"(",
"back",
".",
"SendingTime",
")",
">",
"time",
".",
"Second",
"{",
"q",
".",
"Clear",
"(",
")",
"\n",
"return",
"0",
",",
"0",
"\n",
"}",
"\n\n",
"sampleDuration",
":=",
"back",
".",
"SendingTime",
".",
"Sub",
"(",
"front",
".",
"SendingTime",
")",
"\n\n",
"pr",
":=",
"float64",
"(",
"q",
".",
"Len",
"(",
")",
")",
"/",
"float64",
"(",
"sampleDuration",
")",
"*",
"float64",
"(",
"time",
".",
"Second",
")",
"\n\n",
"br",
":=",
"float64",
"(",
"q",
".",
"ReqSize",
"(",
")",
")",
"/",
"float64",
"(",
"sampleDuration",
")",
"*",
"float64",
"(",
"time",
".",
"Second",
")",
"\n\n",
"return",
"pr",
",",
"br",
"\n",
"}"
] |
9,554 | all-9555 | [
"Mux",
"is",
"an",
"associated",
"http",
".",
"ServeMux",
"instance",
"."
] | [
"func",
"(",
"s",
"*",
"Server",
")",
"Mux",
"(",
")",
"*",
"http",
".",
"ServeMux",
"{",
"return",
"s",
".",
"srv",
".",
"<mask>",
".",
"(",
"*",
"http",
".",
"ServeMux",
")",
"\n",
"}"
] |
9,555 | all-9556 | [
"cephRBDVolumeMarkDeleted",
"marks",
"an",
"RBD",
"storage",
"volume",
"as",
"being",
"in",
"zombie",
"state",
"An",
"RBD",
"storage",
"volume",
"that",
"is",
"in",
"zombie",
"state",
"is",
"not",
"tracked",
"in",
"LXD",
"s",
"database",
"anymore",
"but",
"still",
"needs",
"to",
"be",
"kept",
"around",
"for",
"the",
"sake",
"of",
"any",
"dependent",
"storage",
"entities",
"in",
"the",
"storage",
"pool",
".",
"This",
"usually",
"happens",
"when",
"an",
"RBD",
"storage",
"volume",
"has",
"protected",
"snapshots",
";",
"a",
"scenario",
"most",
"common",
"when",
"creating",
"a",
"sparse",
"copy",
"of",
"a",
"container",
"or",
"when",
"LXD",
"updated",
"an",
"image",
"and",
"the",
"image",
"still",
"has",
"dependent",
"container",
"clones",
"."
] | [
"func",
"cephRBDVolumeMarkDeleted",
"(",
"clusterName",
"string",
",",
"poolName",
"string",
",",
"volumeType",
"string",
",",
"oldVolumeName",
"string",
",",
"newVolumeName",
"string",
",",
"userName",
"string",
",",
"suffix",
"string",
")",
"error",
"{",
"deletedName",
":=",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"poolName",
",",
"volumeType",
",",
"newVolumeName",
")",
"\n",
"if",
"suffix",
"!=",
"\"",
"\"",
"{",
"deletedName",
"=",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"deletedName",
",",
"suffix",
")",
"\n",
"}",
"\n",
"_",
",",
"err",
":=",
"<mask>",
".",
"RunCommand",
"(",
"\"",
"\"",
",",
"\"",
"\"",
",",
"userName",
",",
"\"",
"\"",
",",
"clusterName",
",",
"\"",
"\"",
",",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"poolName",
",",
"volumeType",
",",
"oldVolumeName",
")",
",",
"deletedName",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"return",
"nil",
"\n",
"}"
] |
9,556 | all-9557 | [
"Apply",
"f",
"to",
"all",
"peers",
"reachable",
"by",
"peer",
".",
"If",
"establishedAndSymmetric",
"is",
"true",
"only",
"peers",
"with",
"established",
"bidirectional",
"connections",
"will",
"be",
"selected",
".",
"The",
"exclude",
"maps",
"is",
"treated",
"as",
"a",
"set",
"of",
"remote",
"peers",
"to",
"blacklist",
"."
] | [
"func",
"(",
"peer",
"*",
"Peer",
")",
"forEachConnectedPeer",
"(",
"establishedAndSymmetric",
"bool",
",",
"exclude",
"map",
"[",
"PeerName",
"]",
"PeerName",
",",
"f",
"func",
"(",
"*",
"Peer",
")",
")",
"{",
"for",
"remoteName",
",",
"conn",
":=",
"range",
"peer",
".",
"connections",
"{",
"if",
"establishedAndSymmetric",
"&&",
"!",
"conn",
".",
"isEstablished",
"(",
")",
"{",
"continue",
"\n",
"}",
"\n",
"if",
"_",
",",
"<mask>",
":=",
"exclude",
"[",
"remoteName",
"]",
";",
"found",
"{",
"continue",
"\n",
"}",
"\n",
"remotePeer",
":=",
"conn",
".",
"Remote",
"(",
")",
"\n",
"if",
"remoteConn",
",",
"found",
":=",
"remotePeer",
".",
"connections",
"[",
"peer",
".",
"Name",
"]",
";",
"!",
"establishedAndSymmetric",
"||",
"(",
"found",
"&&",
"remoteConn",
".",
"isEstablished",
"(",
")",
")",
"{",
"f",
"(",
"remotePeer",
")",
"\n",
"}",
"\n",
"}",
"\n",
"}"
] |
9,557 | all-9558 | [
"KeyToPath",
"converts",
"a",
"cache",
"entry",
"key",
"to",
"a",
"path",
"on",
"disk"
] | [
"func",
"(",
"c",
"*",
"Cache",
")",
"KeyToPath",
"(",
"<mask>",
"string",
")",
"string",
"{",
"return",
"filepath",
".",
"Join",
"(",
"c",
".",
"diskRoot",
",",
"key",
")",
"\n",
"}"
] |
9,558 | all-9559 | [
"ArcNegative",
"is",
"a",
"wrapper",
"around",
"cairo_arc_negative",
"()",
"."
] | [
"func",
"(",
"v",
"*",
"<mask>",
")",
"ArcNegative",
"(",
"xc",
",",
"yc",
",",
"radius",
",",
"angle1",
",",
"angle2",
"float64",
")",
"{",
"C",
".",
"cairo_arc_negative",
"(",
"v",
".",
"native",
"(",
")",
",",
"C",
".",
"double",
"(",
"xc",
")",
",",
"C",
".",
"double",
"(",
"yc",
")",
",",
"C",
".",
"double",
"(",
"radius",
")",
",",
"C",
".",
"double",
"(",
"angle1",
")",
",",
"C",
".",
"double",
"(",
"angle2",
")",
")",
"\n",
"}"
] |
9,559 | all-9560 | [
"Add",
"an",
"interface",
"to",
"bridge",
".",
"This",
"is",
"identical",
"to",
"running",
":",
"ip",
"link",
"set",
"$name",
"master",
"$master"
] | [
"func",
"NetworkSetMaster",
"(",
"iface",
",",
"master",
"*",
"net",
".",
"Interface",
")",
"error",
"{",
"data",
":=",
"uint32Attr",
"(",
"syscall",
".",
"IFLA_MASTER",
",",
"uint32",
"(",
"master",
".",
"Index",
")",
")",
"\n",
"return",
"networkMasterAction",
"(",
"iface",
",",
"<mask>",
")",
"\n",
"}"
] |
9,560 | all-9561 | [
"LoadImage",
"indicates",
"an",
"expected",
"call",
"of",
"LoadImage"
] | [
"func",
"(",
"mr",
"*",
"MockLoaderMockRecorder",
")",
"LoadImage",
"(",
"arg0",
",",
"arg1",
",",
"arg2",
"<mask>",
"{",
"}",
")",
"*",
"gomock",
".",
"Call",
"{",
"return",
"mr",
".",
"mock",
".",
"ctrl",
".",
"RecordCallWithMethodType",
"(",
"mr",
".",
"mock",
",",
"\"",
"\"",
",",
"reflect",
".",
"TypeOf",
"(",
"(",
"*",
"MockLoader",
")",
"(",
"nil",
")",
".",
"LoadImage",
")",
",",
"arg0",
",",
"arg1",
",",
"arg2",
")",
"\n",
"}"
] |
9,561 | all-9562 | [
"MapSetX",
"behaves",
"the",
"same",
"as",
"MapSet",
"except",
"it",
"will",
"not",
"overwrite",
"the",
"map",
"key",
"if",
"it",
"already",
"exists",
"."
] | [
"func",
"(",
"s",
"*",
"Scratch",
")",
"MapSetX",
"(",
"k",
",",
"mk",
"string",
",",
"v",
"<mask>",
"{",
"}",
")",
"(",
"string",
",",
"error",
")",
"{",
"s",
".",
"init",
"(",
")",
"\n\n",
"s",
".",
"Lock",
"(",
")",
"\n",
"defer",
"s",
".",
"Unlock",
"(",
")",
"\n",
"return",
"s",
".",
"mapSet",
"(",
"k",
",",
"mk",
",",
"v",
",",
"false",
")",
"\n",
"}"
] |
9,562 | all-9563 | [
"/",
"*",
"PostApps",
"posts",
"new",
"app"
] | [
"func",
"(",
"a",
"*",
"Client",
")",
"PostApps",
"(",
"params",
"*",
"PostAppsParams",
")",
"(",
"*",
"PostAppsOK",
",",
"error",
")",
"{",
"// TODO: Validate the params before sending",
"if",
"params",
"==",
"nil",
"{",
"params",
"=",
"NewPostAppsParams",
"(",
")",
"\n",
"}",
"\n\n",
"result",
",",
"err",
":=",
"a",
".",
"transport",
".",
"Submit",
"(",
"&",
"runtime",
".",
"ClientOperation",
"{",
"ID",
":",
"\"",
"\"",
",",
"Method",
":",
"\"",
"\"",
",",
"PathPattern",
":",
"\"",
"\"",
",",
"ProducesMediaTypes",
":",
"[",
"]",
"string",
"{",
"\"",
"\"",
"}",
",",
"ConsumesMediaTypes",
":",
"[",
"]",
"string",
"{",
"\"",
"\"",
"}",
",",
"Schemes",
":",
"[",
"]",
"string",
"{",
"\"",
"\"",
",",
"\"",
"\"",
"}",
",",
"Params",
":",
"params",
",",
"Reader",
":",
"&",
"PostAppsReader",
"{",
"formats",
":",
"a",
".",
"formats",
"}",
",",
"Context",
":",
"params",
".",
"<mask>",
",",
"Client",
":",
"params",
".",
"HTTPClient",
",",
"}",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"return",
"result",
".",
"(",
"*",
"PostAppsOK",
")",
",",
"nil",
"\n\n",
"}"
] |
9,563 | all-9564 | [
"Errors",
"returned",
"from",
"handleLine",
"break",
"out",
"of",
"readConnections",
"which",
"starts",
"a",
"reconnect",
"This",
"means",
"that",
"we",
"should",
"only",
"return",
"fatal",
"errors",
"as",
"errors",
"here"
] | [
"func",
"(",
"c",
"*",
"Client",
")",
"handleLine",
"(",
"line",
"string",
")",
"error",
"{",
"go",
"func",
"(",
")",
"{",
"// Send a message on the `messageReceived` channel, but do not block in case no one is receiving on the other end",
"select",
"{",
"case",
"c",
".",
"messageReceived",
"<-",
"true",
":",
"default",
":",
"}",
"\n",
"}",
"(",
")",
"\n\n",
"message",
":=",
"ParseMessage",
"(",
"<mask>",
")",
"\n\n",
"switch",
"msg",
":=",
"message",
".",
"(",
"type",
")",
"{",
"case",
"*",
"WhisperMessage",
":",
"if",
"c",
".",
"onWhisperMessage",
"!=",
"nil",
"{",
"c",
".",
"onWhisperMessage",
"(",
"*",
"msg",
")",
"\n",
"}",
"\n",
"return",
"nil",
"\n\n",
"case",
"*",
"PrivateMessage",
":",
"if",
"c",
".",
"onPrivateMessage",
"!=",
"nil",
"{",
"c",
".",
"onPrivateMessage",
"(",
"*",
"msg",
")",
"\n",
"}",
"\n",
"return",
"nil",
"\n\n",
"case",
"*",
"ClearChatMessage",
":",
"if",
"c",
".",
"onClearChatMessage",
"!=",
"nil",
"{",
"c",
".",
"onClearChatMessage",
"(",
"*",
"msg",
")",
"\n",
"}",
"\n",
"return",
"nil",
"\n\n",
"case",
"*",
"RoomStateMessage",
":",
"if",
"c",
".",
"onRoomStateMessage",
"!=",
"nil",
"{",
"c",
".",
"onRoomStateMessage",
"(",
"*",
"msg",
")",
"\n",
"}",
"\n",
"return",
"nil",
"\n\n",
"case",
"*",
"UserNoticeMessage",
":",
"if",
"c",
".",
"onUserNoticeMessage",
"!=",
"nil",
"{",
"c",
".",
"onUserNoticeMessage",
"(",
"*",
"msg",
")",
"\n",
"}",
"\n",
"return",
"nil",
"\n\n",
"case",
"*",
"UserStateMessage",
":",
"if",
"c",
".",
"onUserStateMessage",
"!=",
"nil",
"{",
"c",
".",
"onUserStateMessage",
"(",
"*",
"msg",
")",
"\n",
"}",
"\n",
"return",
"nil",
"\n\n",
"case",
"*",
"NoticeMessage",
":",
"if",
"c",
".",
"onNoticeMessage",
"!=",
"nil",
"{",
"c",
".",
"onNoticeMessage",
"(",
"*",
"msg",
")",
"\n",
"}",
"\n",
"return",
"c",
".",
"handleNoticeMessage",
"(",
"*",
"msg",
")",
"\n\n",
"case",
"*",
"UserJoinMessage",
":",
"if",
"c",
".",
"handleUserJoinMessage",
"(",
"*",
"msg",
")",
"{",
"if",
"c",
".",
"onUserJoinMessage",
"!=",
"nil",
"{",
"c",
".",
"onUserJoinMessage",
"(",
"*",
"msg",
")",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"nil",
"\n\n",
"case",
"*",
"UserPartMessage",
":",
"if",
"c",
".",
"handleUserPartMessage",
"(",
"*",
"msg",
")",
"{",
"if",
"c",
".",
"onUserPartMessage",
"!=",
"nil",
"{",
"c",
".",
"onUserPartMessage",
"(",
"*",
"msg",
")",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"nil",
"\n\n",
"case",
"*",
"ReconnectMessage",
":",
"// https://dev.twitch.tv/docs/irc/commands/#reconnect-twitch-commands",
"if",
"c",
".",
"onReconnectMessage",
"!=",
"nil",
"{",
"c",
".",
"onReconnectMessage",
"(",
"*",
"msg",
")",
"\n",
"}",
"\n",
"return",
"errReconnect",
"\n\n",
"case",
"*",
"NamesMessage",
":",
"if",
"c",
".",
"onNamesMessage",
"!=",
"nil",
"{",
"c",
".",
"onNamesMessage",
"(",
"*",
"msg",
")",
"\n",
"}",
"\n",
"c",
".",
"handleNamesMessage",
"(",
"*",
"msg",
")",
"\n",
"return",
"nil",
"\n\n",
"case",
"*",
"PingMessage",
":",
"if",
"c",
".",
"onPingMessage",
"!=",
"nil",
"{",
"c",
".",
"onPingMessage",
"(",
"*",
"msg",
")",
"\n",
"}",
"\n",
"c",
".",
"handlePingMessage",
"(",
"*",
"msg",
")",
"\n",
"return",
"nil",
"\n\n",
"case",
"*",
"PongMessage",
":",
"if",
"c",
".",
"onPongMessage",
"!=",
"nil",
"{",
"c",
".",
"onPongMessage",
"(",
"*",
"msg",
")",
"\n",
"}",
"\n",
"c",
".",
"handlePongMessage",
"(",
"*",
"msg",
")",
"\n",
"return",
"nil",
"\n\n",
"case",
"*",
"RawMessage",
":",
"if",
"c",
".",
"onUnsetMessage",
"!=",
"nil",
"{",
"c",
".",
"onUnsetMessage",
"(",
"*",
"msg",
")",
"\n",
"}",
"\n",
"}",
"\n\n",
"return",
"nil",
"\n",
"}"
] |
9,564 | all-9565 | [
"AppendBytes",
"appends",
"request",
"header",
"representation",
"to",
"dst",
"and",
"returns",
"the",
"extended",
"dst",
"."
] | [
"func",
"(",
"h",
"*",
"RequestHeader",
")",
"AppendBytes",
"(",
"dst",
"[",
"]",
"byte",
")",
"[",
"]",
"byte",
"{",
"// there is no need in h.parseRawHeaders() here - raw headers are specially handled below.",
"dst",
"=",
"append",
"(",
"dst",
",",
"h",
".",
"Method",
"(",
")",
"...",
")",
"\n",
"dst",
"=",
"append",
"(",
"dst",
",",
"' '",
")",
"\n",
"dst",
"=",
"<mask>",
"(",
"dst",
",",
"h",
".",
"RequestURI",
"(",
")",
"...",
")",
"\n",
"dst",
"=",
"append",
"(",
"dst",
",",
"' '",
")",
"\n",
"dst",
"=",
"append",
"(",
"dst",
",",
"strHTTP11",
"...",
")",
"\n",
"dst",
"=",
"append",
"(",
"dst",
",",
"strCRLF",
"...",
")",
"\n\n",
"if",
"!",
"h",
".",
"rawHeadersParsed",
"&&",
"len",
"(",
"h",
".",
"rawHeaders",
")",
">",
"0",
"{",
"return",
"append",
"(",
"dst",
",",
"h",
".",
"rawHeaders",
"...",
")",
"\n",
"}",
"\n\n",
"userAgent",
":=",
"h",
".",
"UserAgent",
"(",
")",
"\n",
"if",
"len",
"(",
"userAgent",
")",
">",
"0",
"{",
"dst",
"=",
"appendHeaderLine",
"(",
"dst",
",",
"strUserAgent",
",",
"userAgent",
")",
"\n",
"}",
"\n\n",
"host",
":=",
"h",
".",
"Host",
"(",
")",
"\n",
"if",
"len",
"(",
"host",
")",
">",
"0",
"{",
"dst",
"=",
"appendHeaderLine",
"(",
"dst",
",",
"strHost",
",",
"host",
")",
"\n",
"}",
"\n\n",
"contentType",
":=",
"h",
".",
"ContentType",
"(",
")",
"\n",
"if",
"!",
"h",
".",
"ignoreBody",
"(",
")",
"{",
"if",
"len",
"(",
"contentType",
")",
"==",
"0",
"{",
"contentType",
"=",
"strPostArgsContentType",
"\n",
"}",
"\n",
"dst",
"=",
"appendHeaderLine",
"(",
"dst",
",",
"strContentType",
",",
"contentType",
")",
"\n\n",
"if",
"len",
"(",
"h",
".",
"contentLengthBytes",
")",
">",
"0",
"{",
"dst",
"=",
"appendHeaderLine",
"(",
"dst",
",",
"strContentLength",
",",
"h",
".",
"contentLengthBytes",
")",
"\n",
"}",
"\n",
"}",
"else",
"if",
"len",
"(",
"contentType",
")",
">",
"0",
"{",
"dst",
"=",
"appendHeaderLine",
"(",
"dst",
",",
"strContentType",
",",
"contentType",
")",
"\n",
"}",
"\n\n",
"for",
"i",
",",
"n",
":=",
"0",
",",
"len",
"(",
"h",
".",
"h",
")",
";",
"i",
"<",
"n",
";",
"i",
"++",
"{",
"kv",
":=",
"&",
"h",
".",
"h",
"[",
"i",
"]",
"\n",
"dst",
"=",
"appendHeaderLine",
"(",
"dst",
",",
"kv",
".",
"key",
",",
"kv",
".",
"value",
")",
"\n",
"}",
"\n\n",
"// there is no need in h.collectCookies() here, since if cookies aren't collected yet,",
"// they all are located in h.h.",
"n",
":=",
"len",
"(",
"h",
".",
"cookies",
")",
"\n",
"if",
"n",
">",
"0",
"{",
"dst",
"=",
"append",
"(",
"dst",
",",
"strCookie",
"...",
")",
"\n",
"dst",
"=",
"append",
"(",
"dst",
",",
"strColonSpace",
"...",
")",
"\n",
"dst",
"=",
"appendRequestCookieBytes",
"(",
"dst",
",",
"h",
".",
"cookies",
")",
"\n",
"dst",
"=",
"append",
"(",
"dst",
",",
"strCRLF",
"...",
")",
"\n",
"}",
"\n\n",
"if",
"h",
".",
"ConnectionClose",
"(",
")",
"{",
"dst",
"=",
"appendHeaderLine",
"(",
"dst",
",",
"strConnection",
",",
"strClose",
")",
"\n",
"}",
"\n\n",
"return",
"append",
"(",
"dst",
",",
"strCRLF",
"...",
")",
"\n",
"}"
] |
9,565 | all-9566 | [
"canonicalName",
"returns",
"a",
"list",
"of",
"identifiers",
"where",
"any",
"struct",
"field",
"access",
"through",
"an",
"embedded",
"field",
"is",
"expanded",
"to",
"include",
"the",
"names",
"of",
"the",
"embedded",
"types",
"themselves",
".",
"For",
"example",
"suppose",
"field",
"Foo",
"is",
"not",
"directly",
"in",
"the",
"parent",
"struct",
"but",
"actually",
"from",
"an",
"embedded",
"struct",
"of",
"type",
"Bar",
".",
"Then",
"the",
"canonical",
"name",
"of",
"Foo",
"is",
"actually",
"Bar",
".",
"Foo",
".",
"Suppose",
"field",
"Foo",
"is",
"not",
"directly",
"in",
"the",
"parent",
"struct",
"but",
"actually",
"a",
"field",
"in",
"two",
"different",
"embedded",
"structs",
"of",
"types",
"Bar",
"and",
"Baz",
".",
"Then",
"the",
"selector",
"Foo",
"causes",
"a",
"panic",
"since",
"it",
"is",
"ambiguous",
"which",
"one",
"it",
"refers",
"to",
".",
"The",
"user",
"must",
"specify",
"either",
"Bar",
".",
"Foo",
"or",
"Baz",
".",
"Foo",
"."
] | [
"func",
"canonicalName",
"(",
"t",
"reflect",
".",
"Type",
",",
"sel",
"string",
")",
"(",
"[",
"]",
"string",
",",
"error",
")",
"{",
"var",
"name",
"string",
"\n",
"sel",
"=",
"strings",
".",
"TrimPrefix",
"(",
"sel",
",",
"\"",
"\"",
")",
"\n",
"if",
"sel",
"==",
"\"",
"\"",
"{",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"if",
"i",
":=",
"strings",
".",
"IndexByte",
"(",
"sel",
",",
"'.'",
")",
";",
"i",
"<",
"0",
"{",
"name",
",",
"sel",
"=",
"sel",
",",
"\"",
"\"",
"\n",
"}",
"else",
"{",
"name",
",",
"sel",
"=",
"sel",
"[",
":",
"i",
"]",
",",
"sel",
"[",
"i",
":",
"]",
"\n",
"}",
"\n\n",
"// Type must be a struct or pointer to struct.",
"if",
"t",
".",
"Kind",
"(",
")",
"==",
"reflect",
".",
"Ptr",
"{",
"t",
"=",
"t",
".",
"Elem",
"(",
")",
"\n",
"}",
"\n",
"if",
"t",
".",
"Kind",
"(",
")",
"!=",
"reflect",
".",
"Struct",
"{",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"t",
")",
"\n",
"}",
"\n\n",
"// Find the canonical name for this current field name.",
"// If the field exists in an embedded struct, then it will be expanded.",
"if",
"!",
"isExported",
"(",
"name",
")",
"{",
"// Disallow unexported fields:",
"//\t* To discourage people from actually touching unexported fields",
"//\t* FieldByName is buggy (https://golang.org/issue/4876)",
"return",
"[",
"]",
"string",
"{",
"name",
"}",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"sf",
",",
"ok",
":=",
"t",
".",
"FieldByName",
"(",
"name",
")",
"\n",
"if",
"!",
"ok",
"{",
"return",
"[",
"]",
"string",
"{",
"name",
"}",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"var",
"ss",
"[",
"]",
"string",
"\n",
"for",
"i",
":=",
"range",
"sf",
".",
"Index",
"{",
"ss",
"=",
"append",
"(",
"ss",
",",
"t",
".",
"FieldByIndex",
"(",
"sf",
".",
"Index",
"[",
":",
"i",
"+",
"1",
"]",
")",
".",
"Name",
")",
"\n",
"}",
"\n",
"if",
"sel",
"==",
"\"",
"\"",
"{",
"return",
"<mask>",
",",
"nil",
"\n",
"}",
"\n",
"ssPost",
",",
"err",
":=",
"canonicalName",
"(",
"sf",
".",
"Type",
",",
"sel",
")",
"\n",
"return",
"append",
"(",
"ss",
",",
"ssPost",
"...",
")",
",",
"err",
"\n",
"}"
] |
9,566 | all-9567 | [
"String",
"returns",
"the",
"string",
"format",
"for",
"this",
"wait",
"variable"
] | [
"func",
"(",
"w",
"*",
"WaitVar",
")",
"<mask>",
"(",
")",
"string",
"{",
"return",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"w",
".",
"Min",
",",
"w",
".",
"Max",
")",
"\n",
"}"
] |
9,567 | all-9568 | [
"UnmarshalBinary",
"unmarshals",
"a",
"byte",
"slice",
"into",
"a",
"Header",
".",
"If",
"the",
"byte",
"slice",
"does",
"not",
"contain",
"enough",
"data",
"to",
"form",
"a",
"valid",
"Header",
"or",
"an",
"argument",
"is",
"malformed",
"io",
".",
"ErrUnexpectedEOF",
"is",
"returned",
".",
"If",
"the",
"AoE",
"version",
"detected",
"is",
"not",
"equal",
"to",
"the",
"Version",
"constant",
"(",
"1",
")",
"ErrorUnsupportedVersion",
"is",
"returned",
".",
"If",
"an",
"unknown",
"Command",
"type",
"is",
"present",
"ErrorUnrecognizedCommandCode",
"is",
"returned",
"."
] | [
"func",
"(",
"h",
"*",
"Header",
")",
"UnmarshalBinary",
"(",
"b",
"[",
"]",
"byte",
")",
"error",
"{",
"// Must contain minimum length for header",
"if",
"len",
"(",
"b",
")",
"<",
"headerLen",
"{",
"return",
"io",
".",
"ErrUnexpectedEOF",
"\n",
"}",
"\n\n",
"// Version must indicate Version constant (1, at time of writing)",
"h",
".",
"Version",
"=",
"uint8",
"(",
"b",
"[",
"0",
"]",
">>",
"4",
")",
"\n",
"if",
"h",
".",
"Version",
"!=",
"Version",
"{",
"return",
"ErrorUnsupportedVersion",
"\n",
"}",
"\n\n",
"// Flags occupy bits 5 and 6 of first byte",
"h",
".",
"FlagResponse",
"=",
"(",
"b",
"[",
"0",
"]",
"&",
"0x08",
")",
"!=",
"0",
"\n",
"h",
".",
"FlagError",
"=",
"(",
"b",
"[",
"0",
"]",
"&",
"0x04",
")",
"!=",
"0",
"\n\n",
"// Retrieve other fields stored in network byte order",
"h",
".",
"Error",
"=",
"Error",
"(",
"b",
"[",
"1",
"]",
")",
"\n",
"h",
".",
"Major",
"=",
"binary",
".",
"BigEndian",
".",
"Uint16",
"(",
"b",
"[",
"2",
":",
"4",
"]",
")",
"\n",
"h",
".",
"Minor",
"=",
"b",
"[",
"4",
"]",
"\n",
"h",
".",
"Command",
"=",
"Command",
"(",
"b",
"[",
"5",
"]",
")",
"\n\n",
"tag",
":=",
"[",
"4",
"]",
"byte",
"{",
"}",
"\n",
"copy",
"(",
"tag",
"[",
":",
"]",
",",
"b",
"[",
"6",
":",
"10",
"]",
")",
"\n",
"h",
".",
"Tag",
"=",
"<mask>",
"\n\n",
"// Determine Arg type using Command",
"var",
"a",
"Arg",
"\n",
"switch",
"h",
".",
"Command",
"{",
"case",
"CommandIssueATACommand",
":",
"a",
"=",
"new",
"(",
"ATAArg",
")",
"\n",
"case",
"CommandQueryConfigInformation",
":",
"a",
"=",
"new",
"(",
"ConfigArg",
")",
"\n",
"case",
"CommandMACMaskList",
":",
"a",
"=",
"new",
"(",
"MACMaskArg",
")",
"\n",
"case",
"CommandReserveRelease",
":",
"a",
"=",
"new",
"(",
"ReserveReleaseArg",
")",
"\n",
"default",
":",
"// Unknown Command type",
"return",
"ErrorUnrecognizedCommandCode",
"\n",
"}",
"\n\n",
"// Unmarshal Arg as proper type; this may also return io.ErrUnexpectedEOF",
"// or other errors",
"if",
"err",
":=",
"a",
".",
"UnmarshalBinary",
"(",
"b",
"[",
"10",
":",
"]",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"h",
".",
"Arg",
"=",
"a",
"\n\n",
"return",
"nil",
"\n",
"}"
] |
9,568 | all-9569 | [
"GetLogEntry",
"returns",
"the",
"in",
"-",
"context",
"LogEntry",
"for",
"a",
"request",
"."
] | [
"func",
"GetLogEntry",
"(",
"r",
"*",
"http",
".",
"Request",
")",
"LogEntry",
"{",
"entry",
",",
"_",
":=",
"r",
".",
"<mask>",
"(",
")",
".",
"Value",
"(",
"LogEntryCtxKey",
")",
".",
"(",
"LogEntry",
")",
"\n",
"return",
"entry",
"\n",
"}"
] |
9,569 | all-9570 | [
"GetRootDiskDevice",
"returns",
"the",
"container",
"device",
"that",
"is",
"configured",
"as",
"root",
"disk"
] | [
"func",
"GetRootDiskDevice",
"(",
"<mask>",
"map",
"[",
"string",
"]",
"map",
"[",
"string",
"]",
"string",
")",
"(",
"string",
",",
"map",
"[",
"string",
"]",
"string",
",",
"error",
")",
"{",
"var",
"devName",
"string",
"\n",
"var",
"dev",
"map",
"[",
"string",
"]",
"string",
"\n\n",
"for",
"n",
",",
"d",
":=",
"range",
"devices",
"{",
"if",
"IsRootDiskDevice",
"(",
"d",
")",
"{",
"if",
"devName",
"!=",
"\"",
"\"",
"{",
"return",
"\"",
"\"",
",",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"devName",
"=",
"n",
"\n",
"dev",
"=",
"d",
"\n",
"}",
"\n",
"}",
"\n\n",
"if",
"devName",
"!=",
"\"",
"\"",
"{",
"return",
"devName",
",",
"dev",
",",
"nil",
"\n",
"}",
"\n\n",
"return",
"\"",
"\"",
",",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
")",
"\n",
"}"
] |
9,570 | all-9571 | [
"ReadResponse",
"reads",
"a",
"server",
"response",
"into",
"the",
"received",
"o",
"."
] | [
"func",
"(",
"o",
"*",
"PutAppsAppReader",
")",
"ReadResponse",
"(",
"response",
"runtime",
".",
"ClientResponse",
",",
"consumer",
"runtime",
".",
"Consumer",
")",
"(",
"interface",
"{",
"}",
",",
"error",
")",
"{",
"switch",
"response",
".",
"Code",
"(",
")",
"{",
"case",
"200",
":",
"result",
":=",
"NewPutAppsAppOK",
"(",
")",
"\n",
"if",
"err",
":=",
"result",
".",
"readResponse",
"(",
"response",
",",
"consumer",
",",
"o",
".",
"formats",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"return",
"result",
",",
"nil",
"\n\n",
"case",
"400",
":",
"result",
":=",
"NewPutAppsAppBadRequest",
"(",
")",
"\n",
"if",
"err",
":=",
"result",
".",
"readResponse",
"(",
"response",
",",
"consumer",
",",
"o",
".",
"formats",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"return",
"nil",
",",
"<mask>",
"\n\n",
"case",
"500",
":",
"result",
":=",
"NewPutAppsAppInternalServerError",
"(",
")",
"\n",
"if",
"err",
":=",
"result",
".",
"readResponse",
"(",
"response",
",",
"consumer",
",",
"o",
".",
"formats",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"return",
"nil",
",",
"result",
"\n\n",
"default",
":",
"result",
":=",
"NewPutAppsAppDefault",
"(",
"response",
".",
"Code",
"(",
")",
")",
"\n",
"if",
"err",
":=",
"result",
".",
"readResponse",
"(",
"response",
",",
"consumer",
",",
"o",
".",
"formats",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"return",
"nil",
",",
"result",
"\n",
"}",
"\n",
"}"
] |
9,571 | all-9572 | [
"Specify",
"the",
"value",
"of",
"a",
"uniform",
"variable",
"for",
"a",
"specified",
"program",
"object"
] | [
"func",
"ProgramUniformMatrix4x2fv",
"(",
"program",
"uint32",
",",
"location",
"int32",
",",
"count",
"int32",
",",
"transpose",
"bool",
",",
"value",
"*",
"float32",
")",
"{",
"syscall",
".",
"Syscall6",
"(",
"gpProgramUniformMatrix4x2fv",
",",
"5",
",",
"uintptr",
"(",
"<mask>",
")",
",",
"uintptr",
"(",
"location",
")",
",",
"uintptr",
"(",
"count",
")",
",",
"boolToUintptr",
"(",
"transpose",
")",
",",
"uintptr",
"(",
"unsafe",
".",
"Pointer",
"(",
"value",
")",
")",
",",
"0",
")",
"\n",
"}"
] |
9,572 | all-9573 | [
"Set",
"adds",
"a",
"string",
"tag",
"to",
"the",
"span"
] | [
"func",
"(",
"tag",
"spanKindTagName",
")",
"Set",
"(",
"span",
"opentracing",
".",
"Span",
",",
"value",
"SpanKindEnum",
")",
"{",
"span",
".",
"SetTag",
"(",
"string",
"(",
"tag",
")",
",",
"<mask>",
")",
"\n",
"}"
] |
9,573 | all-9574 | [
"NewClusterByConfig",
"returns",
"an",
"unlaunched",
"cluster",
"defined",
"by",
"a",
"cluster",
"configuration"
] | [
"func",
"NewClusterByConfig",
"(",
"t",
"testing",
".",
"TB",
",",
"cfg",
"*",
"ClusterConfig",
")",
"*",
"cluster",
"{",
"<mask>",
"newCluster",
"(",
"t",
",",
"cfg",
")",
"\n",
"}"
] |
9,574 | all-9575 | [
"WithAdditionalRootCAs",
"instructs",
"the",
"New",
"*",
"functions",
"to",
"additionally",
"trust",
"the",
"given",
"base64",
"-",
"encoded",
"signed",
"x509",
"certificates",
"as",
"root",
"certificates",
".",
"Introduced",
"to",
"pass",
"certs",
"in",
"the",
"Pachyderm",
"config"
] | [
"func",
"WithAdditionalRootCAs",
"(",
"pemBytes",
"[",
"]",
"byte",
")",
"Option",
"{",
"return",
"func",
"(",
"settings",
"*",
"clientSettings",
")",
"error",
"{",
"// append certs from config",
"if",
"settings",
".",
"caCerts",
"==",
"nil",
"{",
"settings",
".",
"caCerts",
"=",
"x509",
".",
"NewCertPool",
"(",
")",
"\n",
"}",
"\n",
"if",
"<mask>",
":=",
"settings",
".",
"caCerts",
".",
"AppendCertsFromPEM",
"(",
"pemBytes",
")",
";",
"!",
"ok",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}",
"\n",
"}"
] |
9,575 | all-9576 | [
"Specify",
"the",
"value",
"of",
"a",
"uniform",
"variable",
"for",
"a",
"specified",
"program",
"object"
] | [
"func",
"ProgramUniformMatrix4fv",
"(",
"program",
"uint32",
",",
"location",
"int32",
",",
"count",
"int32",
",",
"transpose",
"bool",
",",
"value",
"*",
"float32",
")",
"{",
"syscall",
".",
"Syscall6",
"(",
"gpProgramUniformMatrix4fv",
",",
"5",
",",
"uintptr",
"(",
"<mask>",
")",
",",
"uintptr",
"(",
"location",
")",
",",
"uintptr",
"(",
"count",
")",
",",
"boolToUintptr",
"(",
"transpose",
")",
",",
"uintptr",
"(",
"unsafe",
".",
"Pointer",
"(",
"value",
")",
")",
",",
"0",
")",
"\n",
"}"
] |
9,576 | all-9577 | [
"Register",
"registers",
"a",
"Scheme",
"."
] | [
"func",
"Register",
"(",
"scheme",
"Scheme",
")",
"{",
"if",
"scheme",
".",
"Generator",
"==",
"nil",
"{",
"panic",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"if",
"scheme",
".",
"Opaque",
"&&",
"scheme",
".",
"Proto",
"&",
"ProtoUnix",
"!=",
"0",
"{",
"panic",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"// register",
"if",
"_",
",",
"ok",
":=",
"schemeMap",
"[",
"scheme",
".",
"Driver",
"]",
";",
"ok",
"{",
"panic",
"(",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"scheme",
".",
"Driver",
")",
")",
"\n",
"}",
"\n\n",
"sz",
":=",
"&",
"Scheme",
"{",
"Driver",
":",
"scheme",
".",
"Driver",
",",
"Generator",
":",
"scheme",
".",
"Generator",
",",
"Proto",
":",
"scheme",
".",
"Proto",
",",
"Opaque",
":",
"scheme",
".",
"Opaque",
",",
"Override",
":",
"scheme",
".",
"Override",
",",
"}",
"\n\n",
"schemeMap",
"[",
"scheme",
".",
"Driver",
"]",
"=",
"sz",
"\n\n",
"// add aliases",
"var",
"hasShort",
"bool",
"\n",
"for",
"_",
",",
"alias",
":=",
"range",
"scheme",
".",
"Aliases",
"{",
"if",
"len",
"(",
"alias",
")",
"==",
"2",
"{",
"hasShort",
"=",
"true",
"\n",
"}",
"\n",
"if",
"scheme",
".",
"Driver",
"!=",
"alias",
"{",
"registerAlias",
"(",
"scheme",
".",
"Driver",
",",
"alias",
",",
"false",
")",
"\n",
"}",
"\n",
"}",
"\n\n",
"if",
"!",
"hasShort",
"&&",
"len",
"(",
"scheme",
".",
"Driver",
")",
">",
"2",
"{",
"registerAlias",
"(",
"scheme",
".",
"Driver",
",",
"scheme",
".",
"Driver",
"[",
":",
"2",
"]",
",",
"<mask>",
")",
"\n",
"}",
"\n\n",
"// ensure always at least one alias, and that if Driver is 2 characters,",
"// that it gets added as well",
"if",
"len",
"(",
"sz",
".",
"Aliases",
")",
"==",
"0",
"||",
"len",
"(",
"scheme",
".",
"Driver",
")",
"==",
"2",
"{",
"sz",
".",
"Aliases",
"=",
"append",
"(",
"sz",
".",
"Aliases",
",",
"scheme",
".",
"Driver",
")",
"\n",
"}",
"\n\n",
"// sort",
"sort",
".",
"Sort",
"(",
"ss",
"(",
"sz",
".",
"Aliases",
")",
")",
"\n",
"}"
] |
9,577 | all-9578 | [
"SetFillRule",
"is",
"a",
"wrapper",
"around",
"cairo_set_fill_rule",
"()",
"."
] | [
"func",
"(",
"v",
"*",
"<mask>",
")",
"SetFillRule",
"(",
"fillRule",
"FillRule",
")",
"{",
"C",
".",
"cairo_set_fill_rule",
"(",
"v",
".",
"native",
"(",
")",
",",
"C",
".",
"cairo_fill_rule_t",
"(",
"fillRule",
")",
")",
"\n",
"}"
] |
9,578 | all-9579 | [
"NewIterator",
"returns",
"a",
"new",
"iterator",
".",
"Depending",
"upon",
"the",
"options",
"either",
"only",
"keys",
"or",
"both",
"key",
"-",
"value",
"pairs",
"would",
"be",
"fetched",
".",
"The",
"keys",
"are",
"returned",
"in",
"lexicographically",
"sorted",
"order",
".",
"Using",
"prefetch",
"is",
"recommended",
"if",
"you",
"re",
"doing",
"a",
"long",
"running",
"iteration",
"for",
"performance",
".",
"Multiple",
"Iterators",
":",
"For",
"a",
"read",
"-",
"only",
"txn",
"multiple",
"iterators",
"can",
"be",
"running",
"simultaneously",
".",
"However",
"for",
"a",
"read",
"-",
"write",
"txn",
"only",
"one",
"can",
"be",
"running",
"at",
"one",
"time",
"to",
"avoid",
"race",
"conditions",
"because",
"Txn",
"is",
"thread",
"-",
"unsafe",
"."
] | [
"func",
"(",
"txn",
"*",
"Txn",
")",
"NewIterator",
"(",
"opt",
"IteratorOptions",
")",
"*",
"Iterator",
"{",
"if",
"txn",
".",
"discarded",
"{",
"panic",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"// Do not change the order of the next if. We must track the number of running iterators.",
"if",
"atomic",
".",
"AddInt32",
"(",
"&",
"txn",
".",
"numIterators",
",",
"1",
")",
">",
"1",
"&&",
"txn",
".",
"update",
"{",
"atomic",
".",
"AddInt32",
"(",
"&",
"txn",
".",
"numIterators",
",",
"-",
"1",
")",
"\n",
"panic",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"// TODO: If Prefix is set, only pick those memtables which have keys with",
"// the prefix.",
"tables",
",",
"decr",
":=",
"txn",
".",
"db",
".",
"getMemTables",
"(",
")",
"\n",
"defer",
"decr",
"(",
")",
"\n",
"txn",
".",
"db",
".",
"vlog",
".",
"incrIteratorCount",
"(",
")",
"\n",
"var",
"iters",
"[",
"]",
"y",
".",
"Iterator",
"\n",
"if",
"itr",
":=",
"txn",
".",
"newPendingWritesIterator",
"(",
"opt",
".",
"Reverse",
")",
";",
"itr",
"!=",
"nil",
"{",
"iters",
"=",
"append",
"(",
"iters",
",",
"itr",
")",
"\n",
"}",
"\n",
"for",
"i",
":=",
"0",
";",
"i",
"<",
"len",
"(",
"tables",
")",
";",
"i",
"++",
"{",
"iters",
"=",
"append",
"(",
"iters",
",",
"tables",
"[",
"i",
"]",
".",
"NewUniIterator",
"(",
"opt",
".",
"Reverse",
")",
")",
"\n",
"}",
"\n",
"iters",
"=",
"txn",
".",
"db",
".",
"lc",
".",
"appendIterators",
"(",
"iters",
",",
"&",
"opt",
")",
"// This will increment references.",
"\n",
"res",
":=",
"&",
"Iterator",
"{",
"txn",
":",
"txn",
",",
"iitr",
":",
"y",
".",
"NewMergeIterator",
"(",
"iters",
",",
"opt",
".",
"Reverse",
")",
",",
"opt",
":",
"opt",
",",
"readTs",
":",
"txn",
".",
"readTs",
",",
"}",
"\n",
"return",
"<mask>",
"\n",
"}"
] |
9,579 | all-9580 | [
"HasLayoutType",
"returns",
"a",
"boolean",
"if",
"a",
"field",
"has",
"been",
"set",
"."
] | [
"func",
"(",
"b",
"*",
"Board",
")",
"HasLayoutType",
"(",
")",
"bool",
"{",
"if",
"b",
"!=",
"nil",
"&&",
"b",
".",
"LayoutType",
"!=",
"nil",
"{",
"return",
"<mask>",
"\n",
"}",
"\n\n",
"return",
"false",
"\n",
"}"
] |
9,580 | all-9581 | [
"SetDirection",
"is",
"a",
"wrapper",
"around",
"gtk_menu_button_set_direction",
"()",
"."
] | [
"func",
"(",
"v",
"*",
"MenuButton",
")",
"SetDirection",
"(",
"direction",
"ArrowType",
")",
"{",
"C",
".",
"gtk_menu_button_set_direction",
"(",
"v",
".",
"native",
"(",
")",
",",
"C",
".",
"GtkArrowType",
"(",
"<mask>",
")",
")",
"\n",
"}"
] |
9,581 | all-9582 | [
"ListPRCommits",
"lists",
"the",
"commits",
"in",
"a",
"pull",
"request",
".",
"GitHub",
"API",
"docs",
":",
"https",
":",
"//",
"developer",
".",
"github",
".",
"com",
"/",
"v3",
"/",
"pulls",
"/",
"#list",
"-",
"commits",
"-",
"on",
"-",
"a",
"-",
"pull",
"-",
"request"
] | [
"func",
"(",
"c",
"*",
"Client",
")",
"ListPRCommits",
"(",
"org",
",",
"repo",
"string",
",",
"number",
"int",
")",
"(",
"[",
"]",
"RepositoryCommit",
",",
"error",
")",
"{",
"c",
".",
"log",
"(",
"\"",
"\"",
",",
"org",
",",
"repo",
",",
"number",
")",
"\n",
"if",
"c",
".",
"fake",
"{",
"return",
"nil",
",",
"nil",
"\n",
"}",
"\n",
"var",
"commits",
"[",
"]",
"RepositoryCommit",
"\n",
"err",
":=",
"c",
".",
"readPaginatedResults",
"(",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"org",
",",
"repo",
",",
"<mask>",
")",
",",
"acceptNone",
",",
"func",
"(",
")",
"interface",
"{",
"}",
"{",
"// newObj returns a pointer to the type of object to create",
"return",
"&",
"[",
"]",
"RepositoryCommit",
"{",
"}",
"\n",
"}",
",",
"func",
"(",
"obj",
"interface",
"{",
"}",
")",
"{",
"// accumulate is the accumulation function for paginated results",
"commits",
"=",
"append",
"(",
"commits",
",",
"*",
"(",
"obj",
".",
"(",
"*",
"[",
"]",
"RepositoryCommit",
")",
")",
"...",
")",
"\n",
"}",
",",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"return",
"commits",
",",
"nil",
"\n",
"}"
] |
9,582 | all-9583 | [
"implements",
"the",
"fuzz",
"(",
"delay",
"kill",
"conn",
")",
"and",
"returns",
"whether",
"or",
"not",
"the",
"read",
"/",
"write",
"should",
"be",
"ignored"
] | [
"func",
"(",
"fc",
"*",
"FuzzedConnection",
")",
"fuzz",
"(",
")",
"bool",
"{",
"if",
"!",
"fc",
".",
"shouldFuzz",
"(",
")",
"{",
"return",
"false",
"\n",
"}",
"\n\n",
"switch",
"fc",
".",
"config",
".",
"Mode",
"{",
"case",
"FuzzModeDrop",
":",
"// randomly drop the r/w, drop the conn, or sleep",
"r",
":=",
"rand",
".",
"Float64",
"(",
")",
"\n",
"if",
"r",
"<=",
"fc",
".",
"config",
".",
"ProbDropRW",
"{",
"return",
"true",
"\n",
"}",
"else",
"if",
"r",
"<",
"fc",
".",
"config",
".",
"ProbDropRW",
"+",
"fc",
".",
"config",
".",
"ProbDropConn",
"{",
"// XXX: can't this fail because machine precision?",
"// XXX: do we need an error?",
"fc",
".",
"Close",
"(",
")",
"\n",
"return",
"true",
"\n",
"}",
"else",
"if",
"r",
"<",
"fc",
".",
"config",
".",
"ProbDropRW",
"+",
"fc",
".",
"config",
".",
"ProbDropConn",
"+",
"fc",
".",
"config",
".",
"ProbSleep",
"{",
"<mask>",
".",
"Sleep",
"(",
"fc",
".",
"randomDuration",
"(",
")",
")",
"\n",
"}",
"\n",
"case",
"FuzzModeDelay",
":",
"// sleep a bit",
"time",
".",
"Sleep",
"(",
"fc",
".",
"randomDuration",
"(",
")",
")",
"\n",
"}",
"\n",
"return",
"false",
"\n",
"}"
] |
9,583 | all-9584 | [
"ToMap",
"converts",
"a",
"regular",
"table",
"to",
"a",
"map",
"of",
"header",
"names",
"to",
"their",
"row",
"data",
".",
"For",
"example",
":",
"t",
":",
"=",
"TabularData",
"{",
"[]",
"string",
"{",
"header1",
"header2",
"}",
"[]",
"string",
"{",
"col1",
"col2",
"}}",
"t",
".",
"ToMap",
"()",
"//",
"Output",
":",
"//",
"map",
"[",
"string",
"]",
"[]",
"string",
"{",
"//",
"header1",
":",
"[]",
"string",
"{",
"col1",
"}",
"//",
"header2",
":",
"[]",
"string",
"{",
"col2",
"}",
"//",
"}"
] | [
"func",
"(",
"t",
"TabularData",
")",
"ToMap",
"(",
")",
"TabularDataMap",
"{",
"m",
":=",
"TabularDataMap",
"{",
"}",
"\n",
"if",
"len",
"(",
"t",
")",
">",
"1",
"{",
"for",
"_",
",",
"th",
":=",
"range",
"t",
"[",
"0",
"]",
"{",
"m",
"[",
"th",
"]",
"=",
"[",
"]",
"string",
"{",
"}",
"\n",
"}",
"\n",
"for",
"_",
",",
"tr",
":=",
"range",
"t",
"[",
"1",
":",
"]",
"{",
"for",
"c",
",",
"td",
":=",
"<mask>",
"tr",
"{",
"m",
"[",
"t",
"[",
"0",
"]",
"[",
"c",
"]",
"]",
"=",
"append",
"(",
"m",
"[",
"t",
"[",
"0",
"]",
"[",
"c",
"]",
"]",
",",
"td",
")",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"m",
"\n",
"}"
] |
9,584 | all-9585 | [
"/////////////////////////////////"
] | [
"func",
"pairs",
"(",
"values",
"...",
"interface",
"{",
"}",
")",
"(",
"map",
"[",
"interface",
"{",
"}",
"]",
"interface",
"{",
"}",
",",
"error",
")",
"{",
"if",
"len",
"(",
"values",
")",
"%",
"2",
"!=",
"0",
"{",
"return",
"nil",
",",
"errors",
".",
"New",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"pairs",
":=",
"make",
"(",
"map",
"[",
"interface",
"{",
"}",
"]",
"interface",
"{",
"}",
")",
"\n",
"for",
"i",
":=",
"0",
";",
"i",
"<",
"len",
"(",
"values",
")",
";",
"i",
"+=",
"2",
"{",
"key",
":=",
"values",
"[",
"i",
"]",
"\n",
"pairs",
"[",
"key",
"]",
"=",
"<mask>",
"[",
"i",
"+",
"1",
"]",
"\n",
"}",
"\n",
"return",
"pairs",
",",
"nil",
"\n",
"}"
] |
9,585 | all-9586 | [
"WithPayload",
"adds",
"the",
"payload",
"to",
"the",
"add",
"Vm",
"o",
"k",
"response"
] | [
"func",
"(",
"o",
"*",
"AddVMOK",
")",
"WithPayload",
"(",
"payload",
"<mask>",
")",
"*",
"AddVMOK",
"{",
"o",
".",
"Payload",
"=",
"payload",
"\n",
"return",
"o",
"\n",
"}"
] |
9,586 | all-9587 | [
"render",
"multiple",
"instances",
"of",
"primitives",
"using",
"a",
"count",
"derived",
"from",
"a",
"transform",
"feedback",
"object"
] | [
"func",
"DrawTransformFeedbackInstanced",
"(",
"<mask>",
"uint32",
",",
"id",
"uint32",
",",
"instancecount",
"int32",
")",
"{",
"C",
".",
"glowDrawTransformFeedbackInstanced",
"(",
"gpDrawTransformFeedbackInstanced",
",",
"(",
"C",
".",
"GLenum",
")",
"(",
"mode",
")",
",",
"(",
"C",
".",
"GLuint",
")",
"(",
"id",
")",
",",
"(",
"C",
".",
"GLsizei",
")",
"(",
"instancecount",
")",
")",
"\n",
"}"
] |
9,587 | all-9588 | [
"GetDouble",
"is",
"a",
"wrapper",
"around",
"g_settings_get_double",
"()",
"."
] | [
"func",
"(",
"v",
"*",
"Settings",
")",
"GetDouble",
"(",
"<mask>",
"string",
")",
"float64",
"{",
"cstr1",
":=",
"(",
"*",
"C",
".",
"gchar",
")",
"(",
"C",
".",
"CString",
"(",
"name",
")",
")",
"\n",
"defer",
"C",
".",
"free",
"(",
"unsafe",
".",
"Pointer",
"(",
"cstr1",
")",
")",
"\n\n",
"return",
"float64",
"(",
"C",
".",
"g_settings_get_double",
"(",
"v",
".",
"native",
"(",
")",
",",
"cstr1",
")",
")",
"\n",
"}"
] |
9,588 | all-9589 | [
"Validate",
"the",
"rule",
"and",
"return",
"a",
"list",
"of",
"encountered",
"errors",
"."
] | [
"func",
"(",
"r",
"*",
"Rule",
")",
"Validate",
"(",
")",
"(",
"errs",
"[",
"]",
"error",
")",
"{",
"if",
"r",
".",
"Record",
"!=",
"\"",
"\"",
"&&",
"r",
".",
"Alert",
"!=",
"\"",
"\"",
"{",
"errs",
"=",
"append",
"(",
"errs",
",",
"errors",
".",
"Errorf",
"(",
"\"",
"\"",
")",
")",
"\n",
"}",
"\n",
"if",
"r",
".",
"Record",
"==",
"\"",
"\"",
"&&",
"r",
".",
"Alert",
"==",
"\"",
"\"",
"{",
"errs",
"=",
"append",
"(",
"errs",
",",
"errors",
".",
"Errorf",
"(",
"\"",
"\"",
")",
")",
"\n",
"}",
"\n\n",
"if",
"r",
".",
"Expr",
"==",
"\"",
"\"",
"{",
"errs",
"=",
"append",
"(",
"errs",
",",
"errors",
".",
"Errorf",
"(",
"\"",
"\"",
")",
")",
"\n",
"}",
"else",
"if",
"_",
",",
"err",
":=",
"promql",
".",
"ParseExpr",
"(",
"r",
".",
"Expr",
")",
";",
"err",
"!=",
"nil",
"{",
"errs",
"=",
"append",
"(",
"errs",
",",
"errors",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"err",
")",
")",
"\n",
"}",
"\n",
"if",
"r",
".",
"Record",
"!=",
"\"",
"\"",
"{",
"if",
"len",
"(",
"r",
".",
"Annotations",
")",
">",
"0",
"{",
"errs",
"=",
"append",
"(",
"errs",
",",
"errors",
".",
"Errorf",
"(",
"\"",
"\"",
")",
")",
"\n",
"}",
"\n",
"if",
"r",
".",
"For",
"!=",
"0",
"{",
"errs",
"=",
"append",
"(",
"errs",
",",
"errors",
".",
"Errorf",
"(",
"\"",
"\"",
")",
")",
"\n",
"}",
"\n",
"if",
"!",
"model",
".",
"IsValidMetricName",
"(",
"model",
".",
"LabelValue",
"(",
"r",
".",
"Record",
")",
")",
"{",
"errs",
"=",
"append",
"(",
"errs",
",",
"errors",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"r",
".",
"Record",
")",
")",
"\n",
"}",
"\n",
"}",
"\n\n",
"for",
"k",
",",
"v",
":=",
"range",
"r",
".",
"Labels",
"{",
"if",
"!",
"model",
".",
"LabelName",
"(",
"k",
")",
".",
"IsValid",
"(",
")",
"{",
"errs",
"=",
"append",
"(",
"errs",
",",
"errors",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"k",
")",
")",
"\n",
"}",
"\n\n",
"if",
"!",
"model",
".",
"LabelValue",
"(",
"v",
")",
".",
"IsValid",
"(",
")",
"{",
"errs",
"=",
"append",
"(",
"errs",
",",
"errors",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"v",
")",
")",
"\n",
"}",
"\n",
"}",
"\n\n",
"for",
"k",
":=",
"<mask>",
"r",
".",
"Annotations",
"{",
"if",
"!",
"model",
".",
"LabelName",
"(",
"k",
")",
".",
"IsValid",
"(",
")",
"{",
"errs",
"=",
"append",
"(",
"errs",
",",
"errors",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"k",
")",
")",
"\n",
"}",
"\n",
"}",
"\n\n",
"errs",
"=",
"append",
"(",
"errs",
",",
"testTemplateParsing",
"(",
"r",
")",
"...",
")",
"\n",
"return",
"errs",
"\n",
"}"
] |
9,589 | all-9590 | [
"Masked",
"returns",
"a",
"new",
"network",
"conforming",
"to",
"new",
"mask",
"."
] | [
"func",
"(",
"n",
"Network",
")",
"Masked",
"(",
"ones",
"int",
")",
"Network",
"{",
"<mask>",
":=",
"net",
".",
"CIDRMask",
"(",
"ones",
",",
"len",
"(",
"n",
".",
"Number",
")",
"*",
"BitsPerUint32",
")",
"\n",
"return",
"NewNetwork",
"(",
"net",
".",
"IPNet",
"{",
"IP",
":",
"n",
".",
"IP",
".",
"Mask",
"(",
"mask",
")",
",",
"Mask",
":",
"mask",
",",
"}",
")",
"\n",
"}"
] |
9,590 | all-9591 | [
"TagStringToLevel",
"converts",
"level",
"string",
"to",
"Glg",
".",
"LEVEL"
] | [
"func",
"(",
"g",
"*",
"Glg",
")",
"TagStringToLevel",
"(",
"<mask>",
"string",
")",
"LEVEL",
"{",
"l",
",",
"ok",
":=",
"g",
".",
"levelMap",
".",
"Load",
"(",
"tag",
")",
"\n",
"if",
"!",
"ok",
"{",
"return",
"255",
"\n",
"}",
"\n",
"return",
"l",
".",
"(",
"LEVEL",
")",
"\n",
"}"
] |
9,591 | all-9592 | [
"ServeHTTPContext",
"calls",
"f",
"(",
"w",
"r",
"c",
")"
] | [
"func",
"(",
"f",
"HandlerFunc",
")",
"ServeHTTPContext",
"(",
"w",
"http",
".",
"ResponseWriter",
",",
"r",
"*",
"http",
".",
"<mask>",
",",
"c",
"*",
"Context",
")",
"{",
"f",
"(",
"w",
",",
"r",
",",
"c",
")",
"\n",
"}"
] |
9,592 | all-9593 | [
"CompileRegexp",
"compiles",
"a",
"regular",
"expression",
"pattern",
"and",
"creates",
"a",
"template",
"to",
"revert",
"it",
"."
] | [
"func",
"CompileRegexp",
"(",
"pattern",
"string",
")",
"(",
"*",
"Regexp",
",",
"error",
")",
"{",
"compiled",
",",
"err",
":=",
"regexp",
".",
"Compile",
"(",
"pattern",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"re",
",",
"err",
":=",
"syntax",
".",
"Parse",
"(",
"pattern",
",",
"syntax",
".",
"Perl",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"tpl",
":=",
"&",
"<mask>",
"{",
"buffer",
":",
"new",
"(",
"bytes",
".",
"Buffer",
")",
"}",
"\n",
"tpl",
".",
"write",
"(",
"re",
")",
"\n",
"return",
"&",
"Regexp",
"{",
"compiled",
":",
"compiled",
",",
"template",
":",
"tpl",
".",
"buffer",
".",
"String",
"(",
")",
",",
"groups",
":",
"tpl",
".",
"groups",
",",
"indices",
":",
"tpl",
".",
"indices",
",",
"}",
",",
"nil",
"\n",
"}"
] |
9,593 | all-9594 | [
"NodeIsEmpty",
"returns",
"an",
"empty",
"string",
"if",
"the",
"node",
"with",
"the",
"given",
"ID",
"has",
"no",
"containers",
"or",
"images",
"associated",
"with",
"it",
".",
"Otherwise",
"it",
"returns",
"a",
"message",
"say",
"what",
"s",
"left",
"."
] | [
"func",
"(",
"c",
"*",
"ClusterTx",
")",
"NodeIsEmpty",
"(",
"id",
"int64",
")",
"(",
"string",
",",
"error",
")",
"{",
"// Check if the node has any containers.",
"containers",
",",
"err",
":=",
"query",
".",
"SelectStrings",
"(",
"c",
".",
"tx",
",",
"\"",
"\"",
",",
"id",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"\"",
"\"",
",",
"errors",
".",
"Wrapf",
"(",
"err",
",",
"\"",
"\"",
",",
"id",
")",
"\n",
"}",
"\n",
"if",
"len",
"(",
"containers",
")",
">",
"0",
"{",
"message",
":=",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"strings",
".",
"Join",
"(",
"containers",
",",
"\"",
"\"",
")",
")",
"\n",
"return",
"message",
",",
"nil",
"\n",
"}",
"\n\n",
"// Check if the node has any images available only in it.",
"images",
":=",
"[",
"]",
"struct",
"{",
"fingerprint",
"string",
"\n",
"nodeID",
"int64",
"\n",
"}",
"{",
"}",
"\n",
"dest",
":=",
"func",
"(",
"i",
"int",
")",
"[",
"]",
"interface",
"{",
"}",
"{",
"images",
"=",
"append",
"(",
"images",
",",
"struct",
"{",
"fingerprint",
"string",
"\n",
"nodeID",
"int64",
"\n",
"}",
"{",
"}",
")",
"\n",
"return",
"[",
"]",
"interface",
"{",
"}",
"{",
"&",
"images",
"[",
"i",
"]",
".",
"fingerprint",
",",
"&",
"images",
"[",
"i",
"]",
".",
"nodeID",
"}",
"\n\n",
"}",
"\n",
"stmt",
",",
"err",
":=",
"c",
".",
"tx",
".",
"Prepare",
"(",
"`\nSELECT fingerprint, node_id FROM images JOIN images_nodes ON images.id=images_nodes.image_id`",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"\"",
"\"",
",",
"err",
"\n",
"}",
"\n",
"defer",
"stmt",
".",
"Close",
"(",
")",
"\n",
"err",
"=",
"query",
".",
"SelectObjects",
"(",
"stmt",
",",
"dest",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"\"",
"\"",
",",
"errors",
".",
"Wrapf",
"(",
"err",
",",
"\"",
"\"",
",",
"id",
")",
"\n",
"}",
"\n",
"index",
":=",
"map",
"[",
"string",
"]",
"[",
"]",
"int64",
"{",
"}",
"// Map fingerprints to IDs of nodes",
"\n",
"for",
"_",
",",
"image",
":=",
"range",
"<mask>",
"{",
"index",
"[",
"image",
".",
"fingerprint",
"]",
"=",
"append",
"(",
"index",
"[",
"image",
".",
"fingerprint",
"]",
",",
"image",
".",
"nodeID",
")",
"\n",
"}",
"\n\n",
"fingerprints",
":=",
"[",
"]",
"string",
"{",
"}",
"\n",
"for",
"fingerprint",
",",
"ids",
":=",
"range",
"index",
"{",
"if",
"len",
"(",
"ids",
")",
">",
"1",
"{",
"continue",
"\n",
"}",
"\n",
"if",
"ids",
"[",
"0",
"]",
"==",
"id",
"{",
"fingerprints",
"=",
"append",
"(",
"fingerprints",
",",
"fingerprint",
")",
"\n",
"}",
"\n",
"}",
"\n\n",
"if",
"len",
"(",
"fingerprints",
")",
">",
"0",
"{",
"message",
":=",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"strings",
".",
"Join",
"(",
"fingerprints",
",",
"\"",
"\"",
")",
")",
"\n",
"return",
"message",
",",
"nil",
"\n",
"}",
"\n\n",
"// Check if the node has any custom volumes.",
"volumes",
",",
"err",
":=",
"query",
".",
"SelectStrings",
"(",
"c",
".",
"tx",
",",
"\"",
"\"",
",",
"id",
",",
"StoragePoolVolumeTypeCustom",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"\"",
"\"",
",",
"errors",
".",
"Wrapf",
"(",
"err",
",",
"\"",
"\"",
",",
"id",
")",
"\n",
"}",
"\n",
"if",
"len",
"(",
"volumes",
")",
">",
"0",
"{",
"message",
":=",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"strings",
".",
"Join",
"(",
"volumes",
",",
"\"",
"\"",
")",
")",
"\n",
"return",
"message",
",",
"nil",
"\n",
"}",
"\n\n",
"return",
"\"",
"\"",
",",
"nil",
"\n",
"}"
] |
9,594 | all-9595 | [
"isBlocked",
"returns",
"a",
"boolean",
"value",
"indicating",
"whether",
"there",
"is",
"a",
"block",
"at",
"the",
"position",
"(",
"x",
"y",
")",
"of",
"the",
"piece",
"with",
"the",
"given",
"angle",
"."
] | [
"func",
"(",
"p",
"*",
"Piece",
")",
"isBlocked",
"(",
"i",
",",
"j",
"int",
",",
"angle",
"Angle",
")",
"bool",
"{",
"size",
":=",
"len",
"(",
"p",
".",
"blocks",
")",
"\n",
"i2",
",",
"j2",
":=",
"i",
",",
"j",
"\n",
"switch",
"angle",
"{",
"case",
"Angle0",
":",
"case",
"Angle90",
":",
"i2",
"=",
"j",
"\n",
"j2",
"=",
"size",
"-",
"1",
"-",
"i",
"\n",
"case",
"Angle180",
":",
"i2",
"=",
"size",
"-",
"1",
"-",
"i",
"\n",
"j2",
"=",
"size",
"-",
"1",
"-",
"j",
"\n",
"<mask>",
"Angle270",
":",
"i2",
"=",
"size",
"-",
"1",
"-",
"j",
"\n",
"j2",
"=",
"i",
"\n",
"}",
"\n",
"return",
"p",
".",
"blocks",
"[",
"i2",
"]",
"[",
"j2",
"]",
"\n",
"}"
] |
9,595 | all-9596 | [
"Account",
"retrieves",
"a",
"detailed",
"view",
"of",
"one",
"account"
] | [
"func",
"(",
"c",
"*",
"Client",
")",
"Account",
"(",
"identifier",
"string",
")",
"(",
"*",
"Account",
",",
"error",
")",
"{",
"account",
":=",
"new",
"(",
"Account",
")",
"\n",
"_",
",",
"err",
":=",
"c",
".",
"MakeApiRequest",
"(",
"\"",
"\"",
",",
"\"",
"\"",
"+",
"identifier",
",",
"nil",
",",
"<mask>",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"return",
"account",
",",
"err",
"\n",
"}"
] |
9,596 | all-9597 | [
"Hosts",
"returns",
"all",
"available",
"hosts",
"in",
"the",
"cluster",
"."
] | [
"func",
"(",
"c",
"*",
"Cluster",
")",
"Hosts",
"(",
")",
"[",
"]",
"URI",
"{",
"hosts",
":=",
"make",
"(",
"[",
"]",
"URI",
",",
"0",
",",
"len",
"(",
"c",
".",
"hosts",
")",
")",
"\n",
"for",
"i",
",",
"host",
":=",
"range",
"c",
".",
"hosts",
"{",
"if",
"c",
".",
"okList",
"[",
"i",
"]",
"{",
"hosts",
"=",
"append",
"(",
"hosts",
",",
"*",
"<mask>",
")",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"hosts",
"\n",
"}"
] |
9,597 | all-9598 | [
"FileChooserNativeDialogNew",
"is",
"a",
"wrapper",
"around",
"gtk_file_chooser_native_new",
"()",
"."
] | [
"func",
"FileChooserNativeDialogNew",
"(",
"title",
"string",
",",
"parent",
"*",
"Window",
",",
"action",
"FileChooserAction",
",",
"accept_label",
"string",
",",
"cancel_label",
"string",
")",
"(",
"*",
"FileChooserNativeDialog",
",",
"error",
")",
"{",
"c_title",
":=",
"C",
".",
"CString",
"(",
"<mask>",
")",
"\n",
"defer",
"C",
".",
"free",
"(",
"unsafe",
".",
"Pointer",
"(",
"c_title",
")",
")",
"\n",
"c_accept_label",
":=",
"C",
".",
"CString",
"(",
"accept_label",
")",
"\n",
"defer",
"C",
".",
"free",
"(",
"unsafe",
".",
"Pointer",
"(",
"c_accept_label",
")",
")",
"\n",
"c_cancel_label",
":=",
"C",
".",
"CString",
"(",
"cancel_label",
")",
"\n",
"defer",
"C",
".",
"free",
"(",
"unsafe",
".",
"Pointer",
"(",
"c_cancel_label",
")",
")",
"\n",
"c",
":=",
"C",
".",
"gtk_file_chooser_native_new",
"(",
"(",
"*",
"C",
".",
"gchar",
")",
"(",
"c_title",
")",
",",
"parent",
".",
"native",
"(",
")",
",",
"C",
".",
"GtkFileChooserAction",
"(",
"action",
")",
",",
"(",
"*",
"C",
".",
"gchar",
")",
"(",
"c_accept_label",
")",
",",
"(",
"*",
"C",
".",
"gchar",
")",
"(",
"c_cancel_label",
")",
")",
"\n",
"if",
"c",
"==",
"nil",
"{",
"return",
"nil",
",",
"nilPtrErr",
"\n",
"}",
"\n",
"obj",
":=",
"glib",
".",
"Take",
"(",
"unsafe",
".",
"Pointer",
"(",
"c",
")",
")",
"\n",
"return",
"wrapFileChooserNativeDialog",
"(",
"obj",
")",
",",
"nil",
"\n",
"}"
] |
9,598 | all-9599 | [
"Return",
"the",
"Time",
"Based",
"One",
"Time",
"Password",
"for",
"the",
"time",
"-",
"period",
"that",
"is",
"Now",
"+",
"the",
"given",
"periods",
".",
"This",
"is",
"useful",
"if",
"you",
"want",
"to",
"provide",
"some",
"flexibility",
"around",
"the",
"acceptance",
"of",
"codes",
".",
"For",
"instance",
"you",
"might",
"want",
"to",
"accept",
"a",
"code",
"that",
"is",
"valid",
"in",
"the",
"current",
"period",
"(",
"FromNow",
"(",
"0",
"))",
"or",
"that",
"was",
"valid",
"in",
"the",
"previous",
"period",
"(",
"FromNow",
"(",
"-",
"1",
"))",
"or",
"that",
"will",
"be",
"valid",
"in",
"the",
"next",
"period",
"(",
"FromNow",
"(",
"1",
"))",
".",
"This",
"means",
"that",
"every",
"code",
"is",
"therefore",
"valid",
"for",
"3",
"*",
"totp",
".",
"Period",
"."
] | [
"func",
"(",
"totp",
"*",
"TOTP",
")",
"FromNow",
"(",
"periods",
"int64",
")",
"int32",
"{",
"period",
":=",
"(",
"time",
".",
"Now",
"(",
")",
".",
"Unix",
"(",
")",
"/",
"int64",
"(",
"totp",
".",
"Period",
")",
")",
"+",
"int64",
"(",
"periods",
")",
"\n",
"return",
"totp",
".",
"ForPeriod",
"(",
"<mask>",
")",
"\n",
"}"
] |
9,599 | all-9600 | [
"watch",
"watches",
"the",
"file",
"for",
"changes"
] | [
"func",
"(",
"d",
"*",
"VaultAgentTokenQuery",
")",
"watch",
"(",
"lastStat",
"os",
".",
"FileInfo",
")",
"<-",
"chan",
"*",
"watchResult",
"{",
"ch",
":=",
"make",
"(",
"chan",
"*",
"watchResult",
",",
"1",
")",
"\n\n",
"go",
"func",
"(",
"lastStat",
"os",
".",
"FileInfo",
")",
"{",
"for",
"{",
"stat",
",",
"err",
":=",
"os",
".",
"Stat",
"(",
"d",
".",
"path",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"<mask>",
"{",
"case",
"<-",
"d",
".",
"stopCh",
":",
"return",
"\n",
"case",
"ch",
"<-",
"&",
"watchResult",
"{",
"err",
":",
"err",
"}",
":",
"return",
"\n",
"}",
"\n",
"}",
"\n\n",
"changed",
":=",
"lastStat",
"==",
"nil",
"||",
"lastStat",
".",
"Size",
"(",
")",
"!=",
"stat",
".",
"Size",
"(",
")",
"||",
"lastStat",
".",
"ModTime",
"(",
")",
"!=",
"stat",
".",
"ModTime",
"(",
")",
"\n\n",
"if",
"changed",
"{",
"select",
"{",
"case",
"<-",
"d",
".",
"stopCh",
":",
"return",
"\n",
"case",
"ch",
"<-",
"&",
"watchResult",
"{",
"stat",
":",
"stat",
"}",
":",
"return",
"\n",
"}",
"\n",
"}",
"\n\n",
"time",
".",
"Sleep",
"(",
"VaultAgentTokenSleepTime",
")",
"\n",
"}",
"\n",
"}",
"(",
"lastStat",
")",
"\n\n",
"return",
"ch",
"\n",
"}"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.