id
int32 0
25.3k
| idx
stringlengths 5
9
| nl_tokens
sequencelengths 1
418
| pl_tokens
sequencelengths 22
4.98k
|
---|---|---|---|
24,600 | all-24601 | [
"Provide",
"objects",
"to",
"the",
"Graph",
".",
"The",
"Object",
"documentation",
"describes",
"the",
"impact",
"of",
"various",
"fields",
"."
] | [
"func",
"(",
"g",
"*",
"Graph",
")",
"Provide",
"(",
"objects",
"...",
"*",
"Object",
")",
"error",
"{",
"for",
"_",
",",
"o",
":=",
"range",
"objects",
"{",
"o",
".",
"reflectType",
"=",
"reflect",
".",
"TypeOf",
"(",
"o",
".",
"Value",
")",
"\n",
"o",
".",
"reflectValue",
"=",
"reflect",
".",
"ValueOf",
"(",
"o",
".",
"Value",
")",
"\n\n",
"if",
"o",
".",
"Fields",
"!=",
"nil",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"o",
",",
")",
"\n",
"}",
"\n\n",
"if",
"o",
".",
"Name",
"==",
"\"",
"\"",
"{",
"if",
"!",
"isStructPtr",
"(",
"o",
".",
"reflectType",
")",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
"+",
"\"",
"\"",
",",
"o",
".",
"reflectType",
",",
"o",
".",
"Value",
",",
")",
"\n",
"}",
"\n\n",
"if",
"!",
"o",
".",
"private",
"{",
"if",
"g",
".",
"unnamedType",
"==",
"nil",
"{",
"g",
".",
"unnamedType",
"=",
"make",
"(",
"map",
"[",
"reflect",
".",
"Type",
"]",
"bool",
")",
"\n",
"}",
"\n\n",
"if",
"g",
".",
"unnamedType",
"[",
"o",
".",
"reflectType",
"]",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"o",
".",
"reflectType",
".",
"Elem",
"(",
")",
".",
"PkgPath",
"(",
")",
",",
"o",
".",
"reflectType",
".",
"Elem",
"(",
")",
".",
"Name",
"(",
")",
",",
")",
"\n",
"}",
"\n",
"g",
".",
"unnamedType",
"[",
"o",
".",
"reflectType",
"]",
"=",
"<mask>",
"\n",
"}",
"\n",
"g",
".",
"unnamed",
"=",
"append",
"(",
"g",
".",
"unnamed",
",",
"o",
")",
"\n",
"}",
"else",
"{",
"if",
"g",
".",
"named",
"==",
"nil",
"{",
"g",
".",
"named",
"=",
"make",
"(",
"map",
"[",
"string",
"]",
"*",
"Object",
")",
"\n",
"}",
"\n\n",
"if",
"g",
".",
"named",
"[",
"o",
".",
"Name",
"]",
"!=",
"nil",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"o",
".",
"Name",
")",
"\n",
"}",
"\n",
"g",
".",
"named",
"[",
"o",
".",
"Name",
"]",
"=",
"o",
"\n",
"}",
"\n\n",
"if",
"g",
".",
"Logger",
"!=",
"nil",
"{",
"if",
"o",
".",
"created",
"{",
"g",
".",
"Logger",
".",
"Debugf",
"(",
"\"",
"\"",
",",
"o",
")",
"\n",
"}",
"else",
"if",
"o",
".",
"embedded",
"{",
"g",
".",
"Logger",
".",
"Debugf",
"(",
"\"",
"\"",
",",
"o",
")",
"\n",
"}",
"else",
"{",
"g",
".",
"Logger",
".",
"Debugf",
"(",
"\"",
"\"",
",",
"o",
")",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
] |
24,601 | all-24602 | [
"Check",
"if",
"the",
"config",
"provided",
"through",
"the",
"flags",
"take",
"valid",
"values",
"."
] | [
"func",
"checkConfigValidity",
"(",
")",
"error",
"{",
"glog",
".",
"Info",
"(",
"\"",
"\"",
")",
"\n",
"if",
"*",
"nodeName",
"==",
"\"",
"\"",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"if",
"*",
"gcsPath",
"==",
"\"",
"\"",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"if",
"_",
",",
"err",
":=",
"<mask>",
".",
"Stat",
"(",
"*",
"gcloudAuthFilePath",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"}",
"else",
"{",
"glog",
".",
"Infof",
"(",
"\"",
"\\n",
"\"",
",",
"*",
"gcloudAuthFilePath",
")",
"\n",
"cmd",
":=",
"exec",
".",
"Command",
"(",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
"+",
"*",
"gcloudAuthFilePath",
")",
"\n",
"var",
"stderr",
",",
"stdout",
"bytes",
".",
"Buffer",
"\n",
"cmd",
".",
"Stderr",
",",
"cmd",
".",
"Stdout",
"=",
"&",
"stderr",
",",
"&",
"stdout",
"\n",
"err",
"=",
"cmd",
".",
"Run",
"(",
")",
"\n",
"glog",
".",
"Infof",
"(",
"\"",
"\\n",
"\\n",
"\"",
",",
"stdout",
".",
"String",
"(",
")",
")",
"\n",
"glog",
".",
"Infof",
"(",
"\"",
"\\n",
"\\n",
"\"",
",",
"stderr",
".",
"String",
"(",
")",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
] |
24,602 | all-24603 | [
"Update",
"updates",
"a",
"VirtualApp",
"."
] | [
"func",
"Update",
"(",
"vc",
"*",
"<mask>",
".",
"VirtualApp",
",",
"spec",
"types",
".",
"VAppConfigSpec",
")",
"error",
"{",
"log",
".",
"Printf",
"(",
"\"",
"\"",
",",
"vc",
".",
"InventoryPath",
")",
"\n",
"ctx",
",",
"cancel",
":=",
"context",
".",
"WithTimeout",
"(",
"context",
".",
"Background",
"(",
")",
",",
"provider",
".",
"DefaultAPITimeout",
")",
"\n",
"defer",
"cancel",
"(",
")",
"\n",
"return",
"vc",
".",
"UpdateConfig",
"(",
"ctx",
",",
"spec",
")",
"\n",
"}"
] |
24,603 | all-24604 | [
"RateLimit",
"consumes",
"messages",
"from",
"the",
"messages",
"channel",
"and",
"limits",
"the",
"rate",
"at",
"which",
"they",
"are",
"produced",
"to",
"the",
"channel",
"returned",
"by",
"this",
"function",
".",
"The",
"limit",
"is",
"the",
"maximum",
"number",
"of",
"messages",
"per",
"second",
"that",
"are",
"produced",
".",
"No",
"rate",
"limit",
"is",
"applied",
"if",
"limit",
"is",
"negative",
"or",
"zero",
".",
"The",
"returned",
"channel",
"is",
"closed",
"when",
"the",
"messages",
"channel",
"is",
"closed",
"."
] | [
"func",
"RateLimit",
"(",
"limit",
"int",
",",
"messages",
"<-",
"chan",
"Message",
")",
"<-",
"chan",
"Message",
"{",
"if",
"limit",
"<=",
"0",
"{",
"return",
"messages",
"\n",
"}",
"\n\n",
"output",
":=",
"make",
"(",
"chan",
"Message",
")",
"\n\n",
"go",
"func",
"(",
")",
"{",
"ticker",
":=",
"time",
".",
"NewTicker",
"(",
"1",
"*",
"time",
".",
"Second",
")",
"\n",
"defer",
"ticker",
".",
"Stop",
"(",
")",
"\n",
"defer",
"close",
"(",
"output",
")",
"\n\n",
"input",
":=",
"messages",
"\n",
"count",
":=",
"0",
"\n\n",
"for",
"{",
"select",
"{",
"<mask>",
"<-",
"ticker",
".",
"C",
":",
"count",
"=",
"0",
"\n",
"input",
"=",
"messages",
"\n\n",
"case",
"msg",
",",
"ok",
":=",
"<-",
"input",
":",
"if",
"!",
"ok",
"{",
"return",
"\n",
"}",
"\n\n",
"output",
"<-",
"msg",
"\n\n",
"if",
"count",
"++",
";",
"count",
">=",
"limit",
"{",
"input",
"=",
"nil",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"(",
")",
"\n\n",
"return",
"output",
"\n",
"}"
] |
24,604 | all-24605 | [
"AcceptOffering",
"initiates",
"JobClientPreChannelCreate",
"job",
"."
] | [
"func",
"(",
"h",
"*",
"Handler",
")",
"AcceptOffering",
"(",
"tkn",
"string",
",",
"account",
"data",
".",
"HexString",
",",
"offering",
"string",
",",
"deposit",
",",
"gasPrice",
"uint64",
")",
"(",
"*",
"string",
",",
"error",
")",
"{",
"logger",
":=",
"h",
".",
"logger",
".",
"Add",
"(",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"account",
",",
"\"",
"\"",
",",
"offering",
",",
"\"",
"\"",
",",
"deposit",
",",
"\"",
"\"",
",",
"gasPrice",
")",
"\n\n",
"if",
"!",
"h",
".",
"token",
".",
"Check",
"(",
"tkn",
")",
"{",
"logger",
".",
"Warn",
"(",
"\"",
"\"",
")",
"\n",
"return",
"nil",
",",
"ErrAccessDenied",
"\n",
"}",
"\n\n",
"var",
"acc",
"<mask>",
".",
"Account",
"\n",
"if",
"err",
":=",
"h",
".",
"findByColumn",
"(",
"logger",
",",
"ErrAccountNotFound",
",",
"&",
"acc",
",",
"\"",
"\"",
",",
"account",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"offer",
",",
"err",
":=",
"h",
".",
"findActiveOfferingByID",
"(",
"logger",
",",
"offering",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"minDeposit",
":=",
"data",
".",
"MinDeposit",
"(",
"offer",
")",
"\n\n",
"if",
"deposit",
"==",
"0",
"{",
"deposit",
"=",
"minDeposit",
"\n",
"}",
"else",
"if",
"deposit",
"<",
"minDeposit",
"{",
"logger",
".",
"Error",
"(",
"ErrDepositTooSmall",
".",
"Error",
"(",
")",
")",
"\n",
"return",
"nil",
",",
"ErrDepositTooSmall",
"\n",
"}",
"\n\n",
"if",
"err",
":=",
"h",
".",
"pingOffering",
"(",
"logger",
",",
"offer",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"rid",
":=",
"util",
".",
"NewUUID",
"(",
")",
"\n",
"jobData",
":=",
"&",
"worker",
".",
"ClientPreChannelCreateData",
"{",
"Account",
":",
"acc",
".",
"ID",
",",
"Offering",
":",
"offering",
",",
"GasPrice",
":",
"gasPrice",
",",
"Deposit",
":",
"deposit",
"}",
"\n",
"if",
"err",
":=",
"job",
".",
"AddWithData",
"(",
"h",
".",
"queue",
",",
"nil",
",",
"data",
".",
"JobClientPreChannelCreate",
",",
"data",
".",
"JobChannel",
",",
"rid",
",",
"data",
".",
"JobUser",
",",
"jobData",
")",
";",
"err",
"!=",
"nil",
"{",
"logger",
".",
"Error",
"(",
"err",
".",
"Error",
"(",
")",
")",
"\n",
"return",
"nil",
",",
"ErrInternal",
"\n",
"}",
"\n\n",
"return",
"&",
"rid",
",",
"nil",
"\n",
"}"
] |
24,605 | all-24606 | [
"WithExecutionContextID",
"specifies",
"in",
"which",
"execution",
"context",
"to",
"perform",
"script",
"run",
".",
"If",
"the",
"parameter",
"is",
"omitted",
"the",
"evaluation",
"will",
"be",
"performed",
"in",
"the",
"context",
"of",
"the",
"inspected",
"page",
"."
] | [
"func",
"(",
"p",
"CompileScriptParams",
")",
"WithExecutionContextID",
"(",
"executionContextID",
"ExecutionContextID",
")",
"*",
"CompileScriptParams",
"{",
"p",
".",
"ExecutionContextID",
"=",
"executionContextID",
"\n",
"<mask>",
"&",
"p",
"\n",
"}"
] |
24,606 | all-24607 | [
"Sign",
"signs",
"an",
"HTTP",
"request",
"with",
"the",
"given",
"S3",
"keys",
".",
"This",
"function",
"is",
"a",
"wrapper",
"around",
"DefaultService",
".",
"Sign",
"."
] | [
"func",
"Sign",
"(",
"r",
"*",
"<mask>",
".",
"Request",
",",
"k",
"Keys",
")",
"{",
"DefaultService",
".",
"Sign",
"(",
"r",
",",
"k",
")",
"\n",
"}"
] |
24,607 | all-24608 | [
"Vec3Cross",
"derives",
"the",
"cross",
"product",
"of",
"two",
"vectors",
".",
"dst",
"=",
"v1",
"x",
"v2",
"dest",
"[",
"out",
"]",
"The",
"cross",
"product",
".",
"v1",
"[",
"in",
"]",
"A",
"Vector",
".",
"v2",
"[",
"in",
"]",
"A",
"vector",
"."
] | [
"func",
"Vec3Cross",
"(",
"<mask>",
",",
"v1",
",",
"v2",
"Vec3",
")",
"{",
"dest",
"[",
"0",
"]",
"=",
"v1",
"[",
"1",
"]",
"*",
"v2",
"[",
"2",
"]",
"-",
"v1",
"[",
"2",
"]",
"*",
"v2",
"[",
"1",
"]",
"\n",
"dest",
"[",
"1",
"]",
"=",
"v1",
"[",
"2",
"]",
"*",
"v2",
"[",
"0",
"]",
"-",
"v1",
"[",
"0",
"]",
"*",
"v2",
"[",
"2",
"]",
"\n",
"dest",
"[",
"2",
"]",
"=",
"v1",
"[",
"0",
"]",
"*",
"v2",
"[",
"1",
"]",
"-",
"v1",
"[",
"1",
"]",
"*",
"v2",
"[",
"0",
"]",
"\n",
"}"
] |
24,608 | all-24609 | [
"lookup",
"takes",
"a",
"Go",
"type",
"as",
"argument",
"and",
"returns",
"the",
"matching",
"structType",
"value",
"potentially",
"creating",
"it",
"if",
"it",
"didn",
"t",
"already",
"exist",
".",
"This",
"method",
"is",
"safe",
"to",
"call",
"from",
"multiple",
"goroutines",
"."
] | [
"func",
"(",
"cache",
"*",
"structTypeCache",
")",
"lookup",
"(",
"t",
"reflect",
".",
"Type",
")",
"(",
"s",
"*",
"structType",
")",
"{",
"<mask>",
".",
"mutex",
".",
"RLock",
"(",
")",
"\n",
"s",
"=",
"cache",
".",
"store",
"[",
"t",
"]",
"\n",
"cache",
".",
"mutex",
".",
"RUnlock",
"(",
")",
"\n\n",
"if",
"s",
"==",
"nil",
"{",
"// There's a race confition here where this value may be generated",
"// multiple times.",
"// The impact in practice is really small as it's unlikely to happen",
"// often, we take the approach of keeping the logic simple and avoid",
"// a more complex synchronization logic required to solve this edge",
"// case.",
"s",
"=",
"newStructType",
"(",
"t",
",",
"map",
"[",
"reflect",
".",
"Type",
"]",
"*",
"structType",
"{",
"}",
")",
"\n",
"cache",
".",
"mutex",
".",
"Lock",
"(",
")",
"\n",
"cache",
".",
"store",
"[",
"t",
"]",
"=",
"s",
"\n",
"cache",
".",
"mutex",
".",
"Unlock",
"(",
")",
"\n",
"}",
"\n\n",
"return",
"\n",
"}"
] |
24,609 | all-24610 | [
"Decrement",
"an",
"item",
"of",
"type",
"float32",
"or",
"float64",
"by",
"n",
".",
"Returns",
"an",
"error",
"if",
"the",
"item",
"s",
"value",
"is",
"not",
"floating",
"point",
"if",
"it",
"was",
"not",
"found",
"or",
"if",
"it",
"is",
"not",
"possible",
"to",
"decrement",
"it",
"by",
"n",
".",
"Pass",
"a",
"negative",
"number",
"to",
"decrement",
"the",
"value",
".",
"To",
"retrieve",
"the",
"decremented",
"value",
"use",
"one",
"of",
"the",
"specialized",
"methods",
"e",
".",
"g",
".",
"DecrementFloat64",
"."
] | [
"func",
"(",
"c",
"*",
"cache",
")",
"DecrementFloat",
"(",
"k",
"string",
",",
"n",
"float64",
")",
"error",
"{",
"c",
".",
"mu",
".",
"Lock",
"(",
")",
"\n",
"v",
",",
"found",
":=",
"c",
".",
"items",
"[",
"k",
"]",
"\n",
"if",
"!",
"found",
"||",
"v",
".",
"Expired",
"(",
")",
"{",
"c",
".",
"mu",
".",
"Unlock",
"(",
")",
"\n",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"k",
")",
"\n",
"}",
"\n",
"switch",
"v",
".",
"Object",
".",
"(",
"type",
")",
"{",
"case",
"float32",
":",
"v",
".",
"Object",
"=",
"v",
".",
"<mask>",
".",
"(",
"float32",
")",
"-",
"float32",
"(",
"n",
")",
"\n",
"case",
"float64",
":",
"v",
".",
"Object",
"=",
"v",
".",
"Object",
".",
"(",
"float64",
")",
"-",
"n",
"\n",
"default",
":",
"c",
".",
"mu",
".",
"Unlock",
"(",
")",
"\n",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"k",
")",
"\n",
"}",
"\n",
"c",
".",
"items",
"[",
"k",
"]",
"=",
"v",
"\n",
"c",
".",
"mu",
".",
"Unlock",
"(",
")",
"\n",
"return",
"nil",
"\n",
"}"
] |
24,610 | all-24611 | [
"Do",
"executes",
"Network",
".",
"setBypassServiceWorker",
"against",
"the",
"provided",
"context",
"."
] | [
"func",
"(",
"p",
"*",
"SetBypassServiceWorkerParams",
")",
"Do",
"(",
"ctx",
"<mask>",
".",
"Context",
")",
"(",
"err",
"error",
")",
"{",
"return",
"cdp",
".",
"Execute",
"(",
"ctx",
",",
"CommandSetBypassServiceWorker",
",",
"p",
",",
"nil",
")",
"\n",
"}"
] |
24,611 | all-24612 | [
"ensureValidConfiguration",
"enforces",
"rules",
"about",
"tide",
"and",
"plugin",
"config",
".",
"In",
"this",
"context",
"a",
"subset",
"is",
"the",
"set",
"of",
"repos",
"or",
"orgs",
"for",
"which",
"a",
"specific",
"plugin",
"is",
"either",
"enabled",
"(",
"for",
"plugins",
")",
"or",
"required",
"for",
"merge",
"(",
"for",
"tide",
")",
".",
"The",
"tide",
"superset",
"is",
"every",
"org",
"or",
"repo",
"that",
"has",
"any",
"configuration",
"at",
"all",
"in",
"tide",
".",
"Specifically",
":",
"-",
"every",
"item",
"in",
"the",
"tide",
"subset",
"must",
"also",
"be",
"in",
"the",
"plugins",
"subset",
"-",
"every",
"item",
"in",
"the",
"plugins",
"subset",
"that",
"is",
"in",
"the",
"tide",
"superset",
"must",
"also",
"be",
"in",
"the",
"tide",
"subset",
"For",
"example",
":",
"-",
"if",
"org",
"/",
"repo",
"is",
"configured",
"in",
"tide",
"to",
"require",
"lgtm",
"it",
"must",
"have",
"the",
"lgtm",
"plugin",
"enabled",
"-",
"if",
"org",
"/",
"repo",
"is",
"configured",
"in",
"tide",
"the",
"tide",
"configuration",
"must",
"require",
"the",
"same",
"set",
"of",
"plugins",
"as",
"are",
"configured",
".",
"If",
"the",
"repository",
"has",
"LGTM",
"and",
"approve",
"enabled",
"the",
"tide",
"query",
"must",
"require",
"both",
"labels"
] | [
"func",
"ensureValidConfiguration",
"(",
"plugin",
",",
"label",
",",
"verb",
"string",
",",
"tideSubSet",
",",
"tideSuperSet",
",",
"pluginsSubSet",
"*",
"orgRepoConfig",
")",
"error",
"{",
"notEnabled",
":=",
"tideSubSet",
".",
"difference",
"(",
"pluginsSubSet",
")",
".",
"items",
"(",
")",
"\n",
"notRequired",
":=",
"pluginsSubSet",
".",
"intersection",
"(",
"tideSuperSet",
")",
".",
"difference",
"(",
"tideSubSet",
")",
".",
"items",
"(",
")",
"\n\n",
"var",
"configErrors",
"[",
"]",
"error",
"\n",
"if",
"len",
"(",
"notEnabled",
")",
">",
"0",
"{",
"configErrors",
"=",
"append",
"(",
"configErrors",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"verb",
",",
"label",
",",
"plugin",
",",
"notEnabled",
")",
")",
"\n",
"}",
"\n",
"if",
"len",
"(",
"notRequired",
")",
">",
"0",
"{",
"configErrors",
"=",
"append",
"(",
"configErrors",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"plugin",
",",
"verb",
",",
"<mask>",
",",
"notRequired",
")",
")",
"\n",
"}",
"\n\n",
"return",
"errorutil",
".",
"NewAggregate",
"(",
"configErrors",
"...",
")",
"\n",
"}"
] |
24,612 | all-24613 | [
"PollTaskURL",
"--",
"fake",
"a",
"poll",
"url",
"call"
] | [
"func",
"(",
"s",
"*",
"FakeVCDClient",
")",
"PollTaskURL",
"(",
"taskURL",
"string",
")",
"(",
"<mask>",
"*",
"vcloudclient",
".",
"TaskElem",
",",
"err",
"error",
")",
"{",
"return",
"s",
".",
"FakeTaskElem",
",",
"s",
".",
"ErrPollTaskURL",
"\n",
"}"
] |
24,613 | all-24614 | [
"Redirect",
"the",
"given",
"call",
"to",
"the",
"given",
"URL",
"."
] | [
"func",
"(",
"c",
"*",
"CallService",
")",
"Redirect",
"(",
"sid",
"string",
",",
"u",
"*",
"url",
".",
"URL",
")",
"(",
"*",
"Call",
",",
"error",
")",
"{",
"<mask>",
":=",
"url",
".",
"Values",
"{",
"}",
"\n",
"data",
".",
"Set",
"(",
"\"",
"\"",
",",
"u",
".",
"String",
"(",
")",
")",
"\n",
"return",
"c",
".",
"Update",
"(",
"context",
".",
"Background",
"(",
")",
",",
"sid",
",",
"data",
")",
"\n",
"}"
] |
24,614 | all-24615 | [
"UnsafeDelete",
"must",
"be",
"called",
"holding",
"the",
"lock",
"on",
"the",
"tx",
"."
] | [
"func",
"(",
"t",
"*",
"batchTx",
")",
"UnsafeDelete",
"(",
"bucketName",
"[",
"]",
"byte",
",",
"key",
"[",
"]",
"byte",
")",
"{",
"bucket",
":=",
"t",
".",
"tx",
".",
"Bucket",
"(",
"bucketName",
")",
"\n",
"if",
"bucket",
"==",
"nil",
"{",
"if",
"t",
".",
"backend",
".",
"lg",
"!=",
"nil",
"{",
"t",
".",
"backend",
".",
"lg",
".",
"Fatal",
"(",
"\"",
"\"",
",",
"zap",
".",
"<mask>",
"(",
"\"",
"\"",
",",
"string",
"(",
"bucketName",
")",
")",
",",
")",
"\n",
"}",
"else",
"{",
"plog",
".",
"Fatalf",
"(",
"\"",
"\"",
",",
"bucketName",
")",
"\n",
"}",
"\n",
"}",
"\n",
"err",
":=",
"bucket",
".",
"Delete",
"(",
"key",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"if",
"t",
".",
"backend",
".",
"lg",
"!=",
"nil",
"{",
"t",
".",
"backend",
".",
"lg",
".",
"Fatal",
"(",
"\"",
"\"",
",",
"zap",
".",
"String",
"(",
"\"",
"\"",
",",
"string",
"(",
"bucketName",
")",
")",
",",
"zap",
".",
"Error",
"(",
"err",
")",
",",
")",
"\n",
"}",
"else",
"{",
"plog",
".",
"Fatalf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"}",
"\n",
"}",
"\n",
"t",
".",
"pending",
"++",
"\n",
"}"
] |
24,615 | all-24616 | [
"dino_party",
"-",
">",
"DinoParty"
] | [
"func",
"(",
"rs",
"*",
"Ruleset",
")",
"Camelize",
"(",
"word",
"string",
")",
"string",
"{",
"<mask>",
":=",
"splitAtCaseChangeWithTitlecase",
"(",
"word",
")",
"\n",
"return",
"strings",
".",
"Join",
"(",
"words",
",",
"\"",
"\"",
")",
"\n",
"}"
] |
24,616 | all-24617 | [
"Conns",
"returns",
"a",
"slice",
"of",
"connections",
"to",
"worker",
"servers",
".",
"pipelineRcName",
"is",
"the",
"name",
"of",
"the",
"pipeline",
"s",
"RC",
"and",
"can",
"be",
"gotten",
"with",
"ppsutil",
".",
"PipelineRcName",
".",
"You",
"can",
"also",
"pass",
"for",
"pipelineRcName",
"to",
"get",
"all",
"clients",
"for",
"all",
"workers",
"."
] | [
"func",
"Conns",
"(",
"ctx",
"context",
".",
"Context",
",",
"pipelineRcName",
"string",
",",
"etcdClient",
"*",
"etcd",
".",
"Client",
",",
"etcdPrefix",
"string",
",",
"workerGrpcPort",
"uint16",
")",
"(",
"[",
"]",
"*",
"grpc",
".",
"ClientConn",
",",
"error",
")",
"{",
"resp",
",",
"err",
":=",
"etcdClient",
".",
"Get",
"(",
"ctx",
",",
"path",
".",
"Join",
"(",
"etcdPrefix",
",",
"WorkerEtcdPrefix",
",",
"pipelineRcName",
")",
",",
"etcd",
".",
"WithPrefix",
"(",
")",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"var",
"result",
"[",
"]",
"*",
"grpc",
".",
"ClientConn",
"\n",
"for",
"_",
",",
"kv",
":=",
"range",
"resp",
".",
"Kvs",
"{",
"conn",
",",
"err",
":=",
"grpc",
".",
"Dial",
"(",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"path",
".",
"Base",
"(",
"string",
"(",
"kv",
".",
"Key",
")",
")",
",",
"workerGrpcPort",
")",
",",
"append",
"(",
"client",
".",
"DefaultDialOptions",
"(",
")",
",",
"grpc",
".",
"WithInsecure",
"(",
")",
")",
"...",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"result",
"=",
"append",
"(",
"result",
",",
"<mask>",
")",
"\n",
"}",
"\n",
"return",
"result",
",",
"nil",
"\n",
"}"
] |
24,617 | all-24618 | [
"handleDockerEvents",
"must",
"be",
"called",
"after",
"openEventstream",
";",
"it",
"processes",
"each",
"event",
"that",
"it",
"reads",
"from",
"the",
"docker",
"eventstream"
] | [
"func",
"(",
"<mask>",
"*",
"DockerTaskEngine",
")",
"handleDockerEvents",
"(",
"ctx",
"context",
".",
"Context",
")",
"{",
"for",
"{",
"select",
"{",
"case",
"<-",
"ctx",
".",
"Done",
"(",
")",
":",
"return",
"\n",
"case",
"event",
":=",
"<-",
"engine",
".",
"events",
":",
"engine",
".",
"handleDockerEvent",
"(",
"event",
")",
"\n",
"}",
"\n",
"}",
"\n",
"}"
] |
24,618 | all-24619 | [
"DispatchMouseEvent",
"dispatches",
"a",
"mouse",
"event",
"to",
"the",
"page",
".",
"See",
":",
"https",
":",
"//",
"chromedevtools",
".",
"github",
".",
"io",
"/",
"devtools",
"-",
"protocol",
"/",
"tot",
"/",
"Input#method",
"-",
"dispatchMouseEvent",
"parameters",
":",
"type",
"-",
"Type",
"of",
"the",
"mouse",
"event",
".",
"x",
"-",
"X",
"coordinate",
"of",
"the",
"event",
"relative",
"to",
"the",
"main",
"frame",
"s",
"viewport",
"in",
"CSS",
"pixels",
".",
"y",
"-",
"Y",
"coordinate",
"of",
"the",
"event",
"relative",
"to",
"the",
"main",
"frame",
"s",
"viewport",
"in",
"CSS",
"pixels",
".",
"0",
"refers",
"to",
"the",
"top",
"of",
"the",
"viewport",
"and",
"Y",
"increases",
"as",
"it",
"proceeds",
"towards",
"the",
"bottom",
"of",
"the",
"viewport",
"."
] | [
"func",
"DispatchMouseEvent",
"(",
"typeVal",
"MouseType",
",",
"x",
"float64",
",",
"y",
"float64",
")",
"*",
"DispatchMouseEventParams",
"{",
"return",
"&",
"DispatchMouseEventParams",
"{",
"<mask>",
":",
"typeVal",
",",
"X",
":",
"x",
",",
"Y",
":",
"y",
",",
"}",
"\n",
"}"
] |
24,619 | all-24620 | [
"UnmarshalJSON",
"supports",
"json",
".",
"Unmarshaler",
"interface"
] | [
"func",
"(",
"v",
"*",
"ProcessInfo",
")",
"UnmarshalJSON",
"(",
"<mask>",
"[",
"]",
"byte",
")",
"error",
"{",
"r",
":=",
"jlexer",
".",
"Lexer",
"{",
"Data",
":",
"data",
"}",
"\n",
"easyjsonC5a4559bDecodeGithubComChromedpCdprotoSysteminfo",
"(",
"&",
"r",
",",
"v",
")",
"\n",
"return",
"r",
".",
"Error",
"(",
")",
"\n",
"}"
] |
24,620 | all-24621 | [
"NetworkInterfaceAddress",
"returns",
"the",
"first",
"non",
"-",
"loopback",
"address",
"of",
"any",
"of",
"the",
"system",
"network",
"interfaces",
".",
"Return",
"the",
"empty",
"string",
"if",
"none",
"is",
"found",
"."
] | [
"func",
"NetworkInterfaceAddress",
"(",
")",
"string",
"{",
"ifaces",
",",
"err",
":=",
"net",
".",
"Interfaces",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"\"",
"\"",
"\n",
"}",
"\n",
"for",
"_",
",",
"iface",
":=",
"range",
"ifaces",
"{",
"if",
"shared",
".",
"IsLoopback",
"(",
"&",
"iface",
")",
"{",
"continue",
"\n",
"}",
"\n",
"addrs",
",",
"err",
":=",
"iface",
".",
"Addrs",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"continue",
"\n",
"}",
"\n",
"if",
"len",
"(",
"addrs",
")",
"==",
"0",
"{",
"<mask>",
"\n",
"}",
"\n",
"addr",
",",
"ok",
":=",
"addrs",
"[",
"0",
"]",
".",
"(",
"*",
"net",
".",
"IPNet",
")",
"\n",
"if",
"!",
"ok",
"{",
"continue",
"\n",
"}",
"\n",
"return",
"addr",
".",
"IP",
".",
"String",
"(",
")",
"\n",
"}",
"\n",
"return",
"\"",
"\"",
"\n",
"}"
] |
24,621 | all-24622 | [
"MarshalBinary",
"allocates",
"a",
"byte",
"slice",
"containing",
"the",
"data",
"from",
"a",
"Header",
".",
"If",
"h",
".",
"Version",
"is",
"not",
"Version",
"(",
"1",
")",
"ErrorUnsupportedVersion",
"is",
"returned",
".",
"If",
"h",
".",
"Arg",
"is",
"nil",
"ErrorBadArgumentParameter",
"is",
"returned",
"."
] | [
"func",
"(",
"h",
"*",
"Header",
")",
"MarshalBinary",
"(",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"// Version must be 1",
"if",
"h",
".",
"Version",
"!=",
"Version",
"{",
"return",
"nil",
",",
"ErrorUnsupportedVersion",
"\n",
"}",
"\n\n",
"// Arg must not be nil",
"if",
"h",
".",
"Arg",
"==",
"nil",
"{",
"return",
"nil",
",",
"ErrorBadArgumentParameter",
"\n",
"}",
"\n",
"ab",
",",
"err",
":=",
"h",
".",
"Arg",
".",
"MarshalBinary",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"// Allocate correct number of bytes for header and argument",
"b",
":=",
"make",
"(",
"[",
"]",
"byte",
",",
"headerLen",
"+",
"len",
"(",
"ab",
")",
")",
"\n\n",
"// Place Version in top 4 bits of first byte",
"var",
"vf",
"uint8",
"\n",
"vf",
"|=",
"h",
".",
"Version",
"<<",
"4",
"\n\n",
"// If needed, place response and error flags in bits 5 and 6 of first byte",
"if",
"h",
".",
"FlagResponse",
"{",
"vf",
"|=",
"(",
"1",
"<<",
"3",
")",
"\n",
"}",
"\n",
"if",
"h",
".",
"FlagError",
"{",
"vf",
"|=",
"(",
"1",
"<<",
"2",
")",
"\n",
"}",
"\n",
"b",
"[",
"0",
"]",
"=",
"vf",
"\n\n",
"// Store other fields directly in network byte order",
"b",
"[",
"1",
"]",
"=",
"uint8",
"(",
"h",
".",
"Error",
")",
"\n",
"binary",
".",
"BigEndian",
".",
"PutUint16",
"(",
"b",
"[",
"2",
":",
"4",
"]",
",",
"h",
".",
"Major",
")",
"\n",
"b",
"[",
"4",
"]",
"=",
"h",
".",
"Minor",
"\n",
"b",
"[",
"5",
"]",
"=",
"uint8",
"(",
"h",
".",
"Command",
")",
"\n",
"<mask>",
"(",
"b",
"[",
"6",
":",
"10",
"]",
",",
"h",
".",
"Tag",
"[",
":",
"]",
")",
"\n\n",
"// Copy argument data into end of header",
"copy",
"(",
"b",
"[",
"10",
":",
"]",
",",
"ab",
")",
"\n\n",
"return",
"b",
",",
"nil",
"\n",
"}"
] |
24,622 | all-24623 | [
"NewStreamDecoder",
"returns",
"a",
"new",
"stream",
"decoder",
"that",
"takes",
"input",
"from",
"r",
"."
] | [
"func",
"(",
"c",
"Codec",
")",
"NewStreamDecoder",
"(",
"r",
"<mask>",
".",
"Reader",
")",
"*",
"StreamDecoder",
"{",
"return",
"NewStreamDecoder",
"(",
"c",
".",
"NewParser",
"(",
"r",
")",
")",
"\n",
"}"
] |
24,623 | all-24624 | [
"MarshalJSON",
"supports",
"json",
".",
"Marshaler",
"interface"
] | [
"func",
"(",
"v",
"ExceptionDetails",
")",
"MarshalJSON",
"(",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"w",
":=",
"jwriter",
".",
"Writer",
"{",
"}",
"\n",
"easyjsonC5a4559bEncodeGithubComChromedpCdprotoRuntime28",
"(",
"&",
"w",
",",
"v",
")",
"\n",
"return",
"w",
".",
"Buffer",
".",
"BuildBytes",
"(",
")",
",",
"w",
".",
"<mask>",
"\n",
"}"
] |
24,624 | all-24625 | [
"addChanges",
"writes",
"a",
"batch",
"of",
"changes",
"atomically",
"to",
"the",
"file",
".",
"By",
"atomically",
"that",
"means",
"when",
"we",
"replay",
"the",
"MANIFEST",
"file",
"we",
"ll",
"either",
"replay",
"all",
"the",
"changes",
"or",
"none",
"of",
"them",
".",
"(",
"The",
"truth",
"of",
"this",
"depends",
"on",
"the",
"filesystem",
"--",
"some",
"might",
"append",
"garbage",
"data",
"if",
"a",
"system",
"crash",
"happens",
"at",
"the",
"wrong",
"time",
".",
")"
] | [
"func",
"(",
"mf",
"*",
"manifestFile",
")",
"addChanges",
"(",
"changesParam",
"[",
"]",
"*",
"pb",
".",
"ManifestChange",
")",
"error",
"{",
"changes",
":=",
"pb",
".",
"ManifestChangeSet",
"{",
"Changes",
":",
"changesParam",
"}",
"\n",
"buf",
",",
"err",
":=",
"changes",
".",
"Marshal",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"// Maybe we could use O_APPEND instead (on certain file systems)",
"mf",
".",
"appendLock",
".",
"Lock",
"(",
")",
"\n",
"if",
"err",
":=",
"applyChangeSet",
"(",
"&",
"mf",
".",
"manifest",
",",
"&",
"changes",
")",
";",
"err",
"!=",
"nil",
"{",
"mf",
".",
"appendLock",
".",
"Unlock",
"(",
")",
"\n",
"return",
"err",
"\n",
"}",
"\n",
"// Rewrite manifest if it'd shrink by 1/10 and it's big enough to care",
"if",
"mf",
".",
"manifest",
".",
"Deletions",
">",
"mf",
".",
"deletionsRewriteThreshold",
"&&",
"mf",
".",
"manifest",
".",
"Deletions",
">",
"manifestDeletionsRatio",
"*",
"(",
"mf",
".",
"manifest",
".",
"Creations",
"-",
"mf",
".",
"manifest",
".",
"Deletions",
")",
"{",
"if",
"err",
":=",
"mf",
".",
"rewrite",
"(",
")",
";",
"err",
"!=",
"nil",
"{",
"mf",
".",
"appendLock",
".",
"Unlock",
"(",
")",
"\n",
"return",
"err",
"\n",
"}",
"\n",
"}",
"else",
"{",
"var",
"lenCrcBuf",
"[",
"8",
"]",
"byte",
"\n",
"binary",
".",
"BigEndian",
".",
"PutUint32",
"(",
"lenCrcBuf",
"[",
"0",
":",
"4",
"]",
",",
"uint32",
"(",
"len",
"(",
"buf",
")",
")",
")",
"\n",
"binary",
".",
"BigEndian",
".",
"PutUint32",
"(",
"lenCrcBuf",
"[",
"4",
":",
"8",
"]",
",",
"crc32",
".",
"Checksum",
"(",
"buf",
",",
"y",
".",
"CastagnoliCrcTable",
")",
")",
"\n",
"buf",
"=",
"<mask>",
"(",
"lenCrcBuf",
"[",
":",
"]",
",",
"buf",
"...",
")",
"\n",
"if",
"_",
",",
"err",
":=",
"mf",
".",
"fp",
".",
"Write",
"(",
"buf",
")",
";",
"err",
"!=",
"nil",
"{",
"mf",
".",
"appendLock",
".",
"Unlock",
"(",
")",
"\n",
"return",
"err",
"\n",
"}",
"\n",
"}",
"\n\n",
"mf",
".",
"appendLock",
".",
"Unlock",
"(",
")",
"\n",
"return",
"mf",
".",
"fp",
".",
"Sync",
"(",
")",
"\n",
"}"
] |
24,625 | all-24626 | [
"UnmarshalJSON",
"supports",
"json",
".",
"Unmarshaler",
"interface"
] | [
"func",
"(",
"v",
"*",
"GetDOMStorageItemsParams",
")",
"UnmarshalJSON",
"(",
"data",
"[",
"]",
"<mask>",
")",
"error",
"{",
"r",
":=",
"jlexer",
".",
"Lexer",
"{",
"Data",
":",
"data",
"}",
"\n",
"easyjsonC5a4559bDecodeGithubComChromedpCdprotoDomstorage4",
"(",
"&",
"r",
",",
"v",
")",
"\n",
"return",
"r",
".",
"Error",
"(",
")",
"\n",
"}"
] |
24,626 | all-24627 | [
"FlushTo",
"flushes",
"the",
"written",
"buffer",
"to",
"the",
"given",
"writer"
] | [
"func",
"(",
"w",
"*",
"WriteBuffer",
")",
"FlushTo",
"(",
"iow",
"<mask>",
".",
"Writer",
")",
"(",
"int",
",",
"error",
")",
"{",
"dirty",
":=",
"w",
".",
"buffer",
"[",
"0",
":",
"w",
".",
"BytesWritten",
"(",
")",
"]",
"\n",
"return",
"iow",
".",
"Write",
"(",
"dirty",
")",
"\n",
"}"
] |
24,627 | all-24628 | [
"StoragePoolsNodeConfig",
"returns",
"a",
"map",
"associating",
"each",
"storage",
"pool",
"name",
"to",
"its",
"node",
"-",
"specific",
"config",
"values",
"(",
"i",
".",
"e",
".",
"the",
"ones",
"where",
"node_id",
"is",
"not",
"NULL",
")",
"."
] | [
"func",
"(",
"c",
"*",
"ClusterTx",
")",
"StoragePoolsNodeConfig",
"(",
")",
"(",
"map",
"[",
"string",
"]",
"map",
"[",
"string",
"]",
"string",
",",
"error",
")",
"{",
"names",
",",
"err",
":=",
"query",
".",
"SelectStrings",
"(",
"c",
".",
"tx",
",",
"\"",
"\"",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"pools",
":=",
"make",
"(",
"map",
"[",
"string",
"]",
"map",
"[",
"string",
"]",
"string",
",",
"len",
"(",
"names",
")",
")",
"\n",
"for",
"_",
",",
"name",
":=",
"range",
"names",
"{",
"<mask>",
":=",
"`\nstorage_pools_config JOIN storage_pools ON storage_pools.id=storage_pools_config.storage_pool_id\n`",
"\n",
"config",
",",
"err",
":=",
"query",
".",
"SelectConfig",
"(",
"c",
".",
"tx",
",",
"table",
",",
"\"",
"\"",
",",
"name",
",",
"c",
".",
"nodeID",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"pools",
"[",
"name",
"]",
"=",
"config",
"\n",
"}",
"\n",
"return",
"pools",
",",
"nil",
"\n",
"}"
] |
24,628 | all-24629 | [
"NewRoundrobinBalanced",
"returns",
"a",
"new",
"roundrobin",
"balanced",
"picker",
"."
] | [
"func",
"NewRoundrobinBalanced",
"(",
"lg",
"*",
"zap",
".",
"Logger",
",",
"scs",
"[",
"]",
"balancer",
".",
"SubConn",
",",
"addrToSc",
"<mask>",
"[",
"resolver",
".",
"Address",
"]",
"balancer",
".",
"SubConn",
",",
"scToAddr",
"map",
"[",
"balancer",
".",
"SubConn",
"]",
"resolver",
".",
"Address",
",",
")",
"Picker",
"{",
"return",
"&",
"rrBalanced",
"{",
"lg",
":",
"lg",
",",
"scs",
":",
"scs",
",",
"addrToSc",
":",
"addrToSc",
",",
"scToAddr",
":",
"scToAddr",
",",
"}",
"\n",
"}"
] |
24,629 | all-24630 | [
"NewOptionalBool",
"converts",
"the",
"input",
"bool",
"into",
"either",
"OptionalBoolTrue",
"or",
"OptionalBoolFalse",
".",
"The",
"function",
"is",
"meant",
"to",
"avoid",
"boilerplate",
"code",
"of",
"users",
"."
] | [
"func",
"NewOptionalBool",
"(",
"b",
"bool",
")",
"OptionalBool",
"{",
"o",
":=",
"OptionalBoolFalse",
"\n",
"if",
"b",
"==",
"<mask>",
"{",
"o",
"=",
"OptionalBoolTrue",
"\n",
"}",
"\n",
"return",
"o",
"\n",
"}"
] |
24,630 | all-24631 | [
"GoString",
"defines",
"the",
"printable",
"version",
"of",
"this",
"struct",
"."
] | [
"func",
"(",
"c",
"*",
"ConsulConfig",
")",
"GoString",
"(",
")",
"string",
"{",
"if",
"c",
"==",
"nil",
"{",
"return",
"\"",
"\"",
"\n",
"}",
"\n\n",
"return",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
"+",
"\"",
"\"",
"+",
"\"",
"\"",
"+",
"\"",
"\"",
"+",
"\"",
"\"",
"+",
"\"",
"\"",
"+",
"\"",
"\"",
"+",
"\"",
"\"",
",",
"StringGoString",
"(",
"c",
".",
"Address",
")",
",",
"c",
".",
"Auth",
",",
"c",
".",
"Retry",
",",
"c",
".",
"SSL",
",",
"StringPresent",
"(",
"c",
".",
"<mask>",
")",
",",
"c",
".",
"Transport",
",",
")",
"\n",
"}"
] |
24,631 | all-24632 | [
"CreateConsulClient",
"creates",
"a",
"new",
"Consul",
"API",
"client",
"from",
"the",
"given",
"input",
"."
] | [
"func",
"(",
"c",
"*",
"ClientSet",
")",
"CreateConsulClient",
"(",
"i",
"*",
"CreateConsulClientInput",
")",
"error",
"{",
"consulConfig",
":=",
"consulapi",
".",
"DefaultConfig",
"(",
")",
"\n\n",
"if",
"i",
".",
"<mask>",
"!=",
"\"",
"\"",
"{",
"consulConfig",
".",
"Address",
"=",
"i",
".",
"Address",
"\n",
"}",
"\n\n",
"if",
"i",
".",
"Token",
"!=",
"\"",
"\"",
"{",
"consulConfig",
".",
"Token",
"=",
"i",
".",
"Token",
"\n",
"}",
"\n\n",
"if",
"i",
".",
"AuthEnabled",
"{",
"consulConfig",
".",
"HttpAuth",
"=",
"&",
"consulapi",
".",
"HttpBasicAuth",
"{",
"Username",
":",
"i",
".",
"AuthUsername",
",",
"Password",
":",
"i",
".",
"AuthPassword",
",",
"}",
"\n",
"}",
"\n\n",
"// This transport will attempt to keep connections open to the Consul server.",
"transport",
":=",
"&",
"http",
".",
"Transport",
"{",
"Proxy",
":",
"http",
".",
"ProxyFromEnvironment",
",",
"Dial",
":",
"(",
"&",
"net",
".",
"Dialer",
"{",
"Timeout",
":",
"i",
".",
"TransportDialTimeout",
",",
"KeepAlive",
":",
"i",
".",
"TransportDialKeepAlive",
",",
"}",
")",
".",
"Dial",
",",
"DisableKeepAlives",
":",
"i",
".",
"TransportDisableKeepAlives",
",",
"MaxIdleConns",
":",
"i",
".",
"TransportMaxIdleConns",
",",
"IdleConnTimeout",
":",
"i",
".",
"TransportIdleConnTimeout",
",",
"MaxIdleConnsPerHost",
":",
"i",
".",
"TransportMaxIdleConnsPerHost",
",",
"TLSHandshakeTimeout",
":",
"i",
".",
"TransportTLSHandshakeTimeout",
",",
"}",
"\n\n",
"// Configure SSL",
"if",
"i",
".",
"SSLEnabled",
"{",
"consulConfig",
".",
"Scheme",
"=",
"\"",
"\"",
"\n\n",
"var",
"tlsConfig",
"tls",
".",
"Config",
"\n\n",
"// Custom certificate or certificate and key",
"if",
"i",
".",
"SSLCert",
"!=",
"\"",
"\"",
"&&",
"i",
".",
"SSLKey",
"!=",
"\"",
"\"",
"{",
"cert",
",",
"err",
":=",
"tls",
".",
"LoadX509KeyPair",
"(",
"i",
".",
"SSLCert",
",",
"i",
".",
"SSLKey",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"}",
"\n",
"tlsConfig",
".",
"Certificates",
"=",
"[",
"]",
"tls",
".",
"Certificate",
"{",
"cert",
"}",
"\n",
"}",
"else",
"if",
"i",
".",
"SSLCert",
"!=",
"\"",
"\"",
"{",
"cert",
",",
"err",
":=",
"tls",
".",
"LoadX509KeyPair",
"(",
"i",
".",
"SSLCert",
",",
"i",
".",
"SSLCert",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"}",
"\n",
"tlsConfig",
".",
"Certificates",
"=",
"[",
"]",
"tls",
".",
"Certificate",
"{",
"cert",
"}",
"\n",
"}",
"\n\n",
"// Custom CA certificate",
"if",
"i",
".",
"SSLCACert",
"!=",
"\"",
"\"",
"||",
"i",
".",
"SSLCAPath",
"!=",
"\"",
"\"",
"{",
"rootConfig",
":=",
"&",
"rootcerts",
".",
"Config",
"{",
"CAFile",
":",
"i",
".",
"SSLCACert",
",",
"CAPath",
":",
"i",
".",
"SSLCAPath",
",",
"}",
"\n",
"if",
"err",
":=",
"rootcerts",
".",
"ConfigureTLS",
"(",
"&",
"tlsConfig",
",",
"rootConfig",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"}",
"\n",
"}",
"\n\n",
"// Construct all the certificates now",
"tlsConfig",
".",
"BuildNameToCertificate",
"(",
")",
"\n\n",
"// SSL verification",
"if",
"i",
".",
"ServerName",
"!=",
"\"",
"\"",
"{",
"tlsConfig",
".",
"ServerName",
"=",
"i",
".",
"ServerName",
"\n",
"tlsConfig",
".",
"InsecureSkipVerify",
"=",
"false",
"\n",
"}",
"\n",
"if",
"!",
"i",
".",
"SSLVerify",
"{",
"log",
".",
"Printf",
"(",
"\"",
"\"",
")",
"\n",
"tlsConfig",
".",
"InsecureSkipVerify",
"=",
"true",
"\n",
"}",
"\n\n",
"// Save the TLS config on our transport",
"transport",
".",
"TLSClientConfig",
"=",
"&",
"tlsConfig",
"\n",
"}",
"\n\n",
"// Setup the new transport",
"consulConfig",
".",
"Transport",
"=",
"transport",
"\n\n",
"// Create the API client",
"client",
",",
"err",
":=",
"consulapi",
".",
"NewClient",
"(",
"consulConfig",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"}",
"\n\n",
"// Save the data on ourselves",
"c",
".",
"Lock",
"(",
")",
"\n",
"c",
".",
"consul",
"=",
"&",
"consulClient",
"{",
"client",
":",
"client",
",",
"transport",
":",
"transport",
",",
"}",
"\n",
"c",
".",
"Unlock",
"(",
")",
"\n\n",
"return",
"nil",
"\n",
"}"
] |
24,632 | all-24633 | [
"UnmarshalJSON",
"supports",
"json",
".",
"Unmarshaler",
"interface"
] | [
"func",
"(",
"v",
"*",
"MoveToParams",
")",
"UnmarshalJSON",
"(",
"data",
"[",
"]",
"byte",
")",
"error",
"{",
"r",
":=",
"jlexer",
".",
"Lexer",
"{",
"Data",
":",
"<mask>",
"}",
"\n",
"easyjsonC5a4559bDecodeGithubComChromedpCdprotoDom30",
"(",
"&",
"r",
",",
"v",
")",
"\n",
"return",
"r",
".",
"Error",
"(",
")",
"\n",
"}"
] |
24,633 | all-24634 | [
"dropTree",
"picks",
"all",
"tables",
"from",
"all",
"levels",
"creates",
"a",
"manifest",
"changeset",
"applies",
"it",
"and",
"then",
"decrements",
"the",
"refs",
"of",
"these",
"tables",
"which",
"would",
"result",
"in",
"their",
"deletion",
"."
] | [
"func",
"(",
"s",
"*",
"levelsController",
")",
"dropTree",
"(",
")",
"(",
"int",
",",
"error",
")",
"{",
"// First pick all tables, so we can create a manifest changelog.",
"var",
"all",
"[",
"]",
"*",
"table",
".",
"Table",
"\n",
"for",
"_",
",",
"l",
":=",
"range",
"s",
".",
"levels",
"{",
"l",
".",
"RLock",
"(",
")",
"\n",
"all",
"=",
"append",
"(",
"all",
",",
"l",
".",
"tables",
"...",
")",
"\n",
"l",
".",
"RUnlock",
"(",
")",
"\n",
"}",
"\n",
"if",
"len",
"(",
"all",
")",
"==",
"0",
"{",
"return",
"0",
",",
"nil",
"\n",
"}",
"\n\n",
"// Generate the manifest changes.",
"changes",
":=",
"[",
"]",
"*",
"pb",
".",
"ManifestChange",
"{",
"}",
"\n",
"for",
"_",
",",
"table",
":=",
"range",
"all",
"{",
"changes",
"=",
"<mask>",
"(",
"changes",
",",
"newDeleteChange",
"(",
"table",
".",
"ID",
"(",
")",
")",
")",
"\n",
"}",
"\n",
"changeSet",
":=",
"pb",
".",
"ManifestChangeSet",
"{",
"Changes",
":",
"changes",
"}",
"\n",
"if",
"err",
":=",
"s",
".",
"kv",
".",
"manifest",
".",
"addChanges",
"(",
"changeSet",
".",
"Changes",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"0",
",",
"err",
"\n",
"}",
"\n\n",
"// Now that manifest has been successfully written, we can delete the tables.",
"for",
"_",
",",
"l",
":=",
"range",
"s",
".",
"levels",
"{",
"l",
".",
"Lock",
"(",
")",
"\n",
"l",
".",
"totalSize",
"=",
"0",
"\n",
"l",
".",
"tables",
"=",
"l",
".",
"tables",
"[",
":",
"0",
"]",
"\n",
"l",
".",
"Unlock",
"(",
")",
"\n",
"}",
"\n",
"for",
"_",
",",
"table",
":=",
"range",
"all",
"{",
"if",
"err",
":=",
"table",
".",
"DecrRef",
"(",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"0",
",",
"err",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"len",
"(",
"all",
")",
",",
"nil",
"\n",
"}"
] |
24,634 | all-24635 | [
"initializeContainersV3MetadataEndpoint",
"generates",
"an",
"v3",
"endpoint",
"id",
"for",
"each",
"container",
"constructs",
"the",
"v3",
"metadata",
"endpoint",
"and",
"injects",
"it",
"as",
"an",
"environment",
"variable"
] | [
"func",
"(",
"task",
"*",
"Task",
")",
"initializeContainersV3MetadataEndpoint",
"(",
"uuidProvider",
"utils",
".",
"UUIDProvider",
")",
"{",
"for",
"_",
",",
"container",
":=",
"range",
"task",
".",
"Containers",
"{",
"v3EndpointID",
":=",
"<mask>",
".",
"GetV3EndpointID",
"(",
")",
"\n",
"if",
"v3EndpointID",
"==",
"\"",
"\"",
"{",
"// if container's v3 endpoint has not been set",
"container",
".",
"SetV3EndpointID",
"(",
"uuidProvider",
".",
"New",
"(",
")",
")",
"\n",
"}",
"\n\n",
"container",
".",
"InjectV3MetadataEndpoint",
"(",
")",
"\n",
"}",
"\n",
"}"
] |
24,635 | all-24636 | [
"Output",
"calls",
"UI",
".",
"Output",
"to",
"write",
".",
"OutputFGColor",
"and",
"OutputBGColor",
"are",
"used",
"for",
"color",
"."
] | [
"func",
"(",
"ui",
"*",
"ColorUI",
")",
"Output",
"(",
"message",
"string",
")",
"{",
"ct",
".",
"ChangeColor",
"(",
"ui",
".",
"OutputFGColor",
".",
"Code",
",",
"ui",
".",
"OutputFGColor",
".",
"Bright",
",",
"ui",
".",
"OutputBGColor",
".",
"Code",
",",
"ui",
".",
"OutputBGColor",
".",
"Bright",
")",
"\n",
"ui",
".",
"UI",
".",
"Output",
"(",
"message",
")",
"\n",
"<mask>",
".",
"ResetColor",
"(",
")",
"\n",
"}"
] |
24,636 | all-24637 | [
"NewCapabilities",
"returns",
"a",
"Capabilities",
"instance",
"with",
"any",
"provided",
"features",
"enabled",
"."
] | [
"func",
"NewCapabilities",
"(",
"features",
"...",
"string",
")",
"Capabilities",
"{",
"c",
":=",
"Capabilities",
"{",
"}",
"\n",
"for",
"_",
",",
"feature",
":=",
"<mask>",
"features",
"{",
"c",
".",
"With",
"(",
"feature",
")",
"\n",
"}",
"\n",
"return",
"c",
"\n",
"}"
] |
24,637 | all-24638 | [
"init",
"sets",
"up",
"all",
"global",
"variables",
"and",
"prepares",
"ttk",
"for",
"use",
"."
] | [
"func",
"init",
"(",
")",
"{",
"work",
"=",
"make",
"(",
"chan",
"func",
"(",
")",
",",
"32",
")",
"\n",
"keyC",
"=",
"make",
"(",
"chan",
"Key",
",",
"1024",
")",
"\n",
"windows",
"=",
"make",
"(",
"map",
"[",
"int",
"]",
"*",
"Window",
")",
"\n",
"windower2window",
"=",
"make",
"(",
"map",
"[",
"Windower",
"]",
"*",
"Window",
")",
"\n\n",
"// setup render queue",
"// we do this song and dance in order to be able to deal with slow",
"// connections where rendering could take a long time",
"execute",
":=",
"make",
"(",
"chan",
"bool",
",",
"1",
")",
"\n",
"<mask>",
":=",
"make",
"(",
"[",
"]",
"func",
"(",
")",
",",
"0",
",",
"20",
")",
"\n",
"mtx",
":=",
"sync",
".",
"Mutex",
"{",
"}",
"\n\n",
"var",
"wg",
"sync",
".",
"WaitGroup",
"\n",
"wg",
".",
"Add",
"(",
"2",
")",
"\n",
"go",
"func",
"(",
")",
"{",
"wg",
".",
"Done",
"(",
")",
"\n",
"for",
"range",
"execute",
"{",
"for",
"{",
"// get work off queue",
"mtx",
".",
"Lock",
"(",
")",
"\n",
"if",
"len",
"(",
"fa",
")",
"==",
"0",
"{",
"mtx",
".",
"Unlock",
"(",
")",
"\n",
"break",
"\n",
"}",
"\n",
"f",
":=",
"fa",
"[",
"0",
"]",
"\n",
"fa",
"[",
"0",
"]",
"=",
"nil",
"// just in case to prevent leak",
"\n",
"fa",
"=",
"fa",
"[",
"1",
":",
"]",
"\n",
"mtx",
".",
"Unlock",
"(",
")",
"\n\n",
"// actually do work",
"f",
"(",
")",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"(",
")",
"\n\n",
"go",
"func",
"(",
")",
"{",
"wg",
".",
"Done",
"(",
")",
"\n",
"for",
"f",
":=",
"range",
"work",
"{",
"// queue work",
"mtx",
".",
"Lock",
"(",
")",
"\n",
"fa",
"=",
"append",
"(",
"fa",
",",
"f",
")",
"\n",
"mtx",
".",
"Unlock",
"(",
")",
"\n\n",
"// tell executer there is work",
"select",
"{",
"case",
"execute",
"<-",
"true",
":",
"default",
":",
"}",
"\n",
"}",
"\n",
"}",
"(",
")",
"\n",
"wg",
".",
"Wait",
"(",
")",
"\n",
"}"
] |
24,638 | all-24639 | [
"assertJSONIsEqualOrSubset",
"returns",
"true",
"if",
"v1",
"and",
"v2",
"are",
"equal",
"in",
"value",
"or",
"if",
"both",
"are",
"maps",
"(",
"of",
"type",
"map",
"[",
"string",
"]",
"interface",
"{}",
")",
"and",
"v1",
"is",
"a",
"subset",
"of",
"v2",
"where",
"all",
"keys",
"that",
"are",
"present",
"in",
"v1",
"are",
"present",
"with",
"the",
"same",
"value",
"in",
"v2",
"."
] | [
"func",
"(",
"r",
"*",
"Runner",
")",
"assertJSONIsEqualOrSubset",
"(",
"v1",
"interface",
"{",
"}",
",",
"v2",
"interface",
"{",
"}",
")",
"(",
"bool",
",",
"error",
")",
"{",
"if",
"(",
"v1",
"==",
"nil",
")",
"&&",
"(",
"v2",
"==",
"nil",
")",
"{",
"return",
"true",
",",
"nil",
"\n",
"}",
"\n\n",
"// check if both are non nil and that type matches",
"if",
"(",
"(",
"v1",
"==",
"nil",
")",
"!=",
"(",
"v2",
"==",
"nil",
")",
")",
"||",
"(",
"reflect",
".",
"ValueOf",
"(",
"v1",
")",
".",
"Type",
"(",
")",
"!=",
"reflect",
".",
"ValueOf",
"(",
"v2",
")",
".",
"<mask>",
"(",
")",
")",
"{",
"return",
"false",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"switch",
"v1",
".",
"(",
"type",
")",
"{",
"case",
"map",
"[",
"string",
"]",
"interface",
"{",
"}",
":",
"// recursively check maps",
"// v2 is of same type as v1 as check in early return",
"v2map",
":=",
"v2",
".",
"(",
"map",
"[",
"string",
"]",
"interface",
"{",
"}",
")",
"\n",
"for",
"objK",
",",
"objV",
":=",
"range",
"v1",
".",
"(",
"map",
"[",
"string",
"]",
"interface",
"{",
"}",
")",
"{",
"if",
"v2map",
"[",
"objK",
"]",
"==",
"nil",
"{",
"return",
"false",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"objK",
")",
"\n",
"}",
"\n",
"equalForKey",
",",
"errForKey",
":=",
"r",
".",
"assertJSONIsEqualOrSubset",
"(",
"objV",
",",
"v2map",
"[",
"objK",
"]",
")",
"\n",
"if",
"!",
"equalForKey",
"{",
"return",
"false",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"objK",
",",
"errForKey",
")",
"\n",
"}",
"\n",
"}",
"\n\n",
"return",
"true",
",",
"nil",
"\n",
"default",
":",
"// all non-map types must be deep equal",
"if",
"!",
"reflect",
".",
"DeepEqual",
"(",
"v1",
",",
"v2",
")",
"{",
"return",
"false",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"v1",
",",
"v2",
")",
"\n",
"}",
"\n",
"return",
"true",
",",
"nil",
"\n",
"}",
"\n",
"}"
] |
24,639 | all-24640 | [
"fill",
"populates",
"pb",
".",
"ResponseHeader",
"using",
"etcdserver",
"information"
] | [
"func",
"(",
"h",
"*",
"header",
")",
"fill",
"(",
"rh",
"*",
"<mask>",
".",
"ResponseHeader",
")",
"{",
"if",
"rh",
"==",
"nil",
"{",
"plog",
".",
"Panic",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"rh",
".",
"ClusterId",
"=",
"uint64",
"(",
"h",
".",
"clusterID",
")",
"\n",
"rh",
".",
"MemberId",
"=",
"uint64",
"(",
"h",
".",
"memberID",
")",
"\n",
"rh",
".",
"RaftTerm",
"=",
"h",
".",
"sg",
".",
"Term",
"(",
")",
"\n",
"if",
"rh",
".",
"Revision",
"==",
"0",
"{",
"rh",
".",
"Revision",
"=",
"h",
".",
"rev",
"(",
")",
"\n",
"}",
"\n",
"}"
] |
24,640 | all-24641 | [
"This",
"function",
"recreates",
"an",
"rbd",
"container",
"including",
"its",
"snapshots",
".",
"It",
"recreates",
"the",
"dependencies",
"between",
"the",
"container",
"and",
"the",
"snapshots",
":",
"-",
"create",
"an",
"empty",
"rbd",
"storage",
"volume",
"-",
"for",
"each",
"snapshot",
"dump",
"the",
"contents",
"into",
"the",
"empty",
"storage",
"volume",
"and",
"after",
"each",
"dump",
"take",
"a",
"snapshot",
"of",
"the",
"rbd",
"storage",
"volume",
"-",
"dump",
"the",
"container",
"contents",
"into",
"the",
"rbd",
"storage",
"volume",
"."
] | [
"func",
"(",
"s",
"*",
"storageCeph",
")",
"ContainerBackupLoad",
"(",
"info",
"backupInfo",
",",
"data",
"io",
".",
"ReadSeeker",
",",
"tarArgs",
"[",
"]",
"string",
")",
"error",
"{",
"// create the main container",
"err",
":=",
"s",
".",
"doContainerCreate",
"(",
"info",
".",
"Project",
",",
"info",
".",
"Name",
",",
"info",
".",
"Privileged",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"// mount container",
"_",
",",
"err",
"=",
"s",
".",
"doContainerMount",
"(",
"info",
".",
"Project",
",",
"info",
".",
"Name",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"containerMntPoint",
":=",
"getContainerMountPoint",
"(",
"info",
".",
"Project",
",",
"s",
".",
"pool",
".",
"Name",
",",
"info",
".",
"Name",
")",
"\n",
"// Extract container",
"for",
"_",
",",
"snap",
":=",
"range",
"info",
".",
"Snapshots",
"{",
"cur",
":=",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"snap",
")",
"\n\n",
"// Prepare tar arguments",
"args",
":=",
"append",
"(",
"tarArgs",
",",
"[",
"]",
"string",
"{",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"containerMntPoint",
",",
"cur",
",",
"}",
"...",
")",
"\n\n",
"// Extract snapshots",
"<mask>",
".",
"Seek",
"(",
"0",
",",
"0",
")",
"\n",
"err",
"=",
"shared",
".",
"RunCommandWithFds",
"(",
"data",
",",
"nil",
",",
"\"",
"\"",
",",
"args",
"...",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"logger",
".",
"Errorf",
"(",
"\"",
"\\\"",
"\\\"",
"\\\"",
"\\\"",
"\"",
",",
"cur",
",",
"containerMntPoint",
",",
"err",
")",
"\n",
"return",
"err",
"\n",
"}",
"\n\n",
"// This is costly but we need to ensure that all cached data has",
"// been committed to disk. If we don't then the rbd snapshot of",
"// the underlying filesystem can be inconsistent or - worst case",
"// - empty.",
"syscall",
".",
"Sync",
"(",
")",
"\n\n",
"msg",
",",
"fsFreezeErr",
":=",
"shared",
".",
"TryRunCommand",
"(",
"\"",
"\"",
",",
"\"",
"\"",
",",
"containerMntPoint",
")",
"\n",
"logger",
".",
"Debugf",
"(",
"\"",
"\"",
",",
"msg",
",",
"fsFreezeErr",
")",
"\n\n",
"// create snapshot",
"err",
"=",
"s",
".",
"doContainerSnapshotCreate",
"(",
"info",
".",
"Project",
",",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"info",
".",
"Name",
",",
"snap",
")",
",",
"info",
".",
"Name",
")",
"\n",
"if",
"fsFreezeErr",
"==",
"nil",
"{",
"msg",
",",
"fsFreezeErr",
":=",
"shared",
".",
"TryRunCommand",
"(",
"\"",
"\"",
",",
"\"",
"\"",
",",
"containerMntPoint",
")",
"\n",
"logger",
".",
"Debugf",
"(",
"\"",
"\"",
",",
"msg",
",",
"fsFreezeErr",
")",
"\n",
"}",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"}",
"\n\n",
"// Prepare tar arguments",
"args",
":=",
"append",
"(",
"tarArgs",
",",
"[",
"]",
"string",
"{",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"containerMntPoint",
",",
"\"",
"\"",
",",
"}",
"...",
")",
"\n\n",
"// Extract container",
"data",
".",
"Seek",
"(",
"0",
",",
"0",
")",
"\n",
"err",
"=",
"shared",
".",
"RunCommandWithFds",
"(",
"data",
",",
"nil",
",",
"\"",
"\"",
",",
"args",
"...",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"logger",
".",
"Errorf",
"(",
"\"",
"\\\"",
"\\\"",
"\\\"",
"\\\"",
"\"",
",",
"containerMntPoint",
",",
"err",
")",
"\n",
"return",
"err",
"\n",
"}",
"\n\n",
"return",
"nil",
"\n",
"}"
] |
24,641 | all-24642 | [
"Do",
"executes",
"Overlay",
".",
"setPausedInDebuggerMessage",
"against",
"the",
"provided",
"context",
"."
] | [
"func",
"(",
"p",
"*",
"SetPausedInDebuggerMessageParams",
")",
"Do",
"(",
"ctx",
"context",
".",
"<mask>",
")",
"(",
"err",
"error",
")",
"{",
"return",
"cdp",
".",
"Execute",
"(",
"ctx",
",",
"CommandSetPausedInDebuggerMessage",
",",
"p",
",",
"nil",
")",
"\n",
"}"
] |
24,642 | all-24643 | [
"TypeName",
"-",
"returns",
"valid",
"type",
"name",
"for",
"a",
"give",
"record"
] | [
"func",
"(",
"v",
"*",
"Record",
")",
"TypeName",
"(",
"i",
"int",
",",
"<mask>",
"[",
"]",
"string",
")",
"(",
"typename",
"string",
")",
"{",
"if",
"i",
"+",
"1",
"<",
"v",
".",
"Length",
"{",
"currentNode",
":=",
"v",
".",
"Slice",
"[",
"i",
"]",
"\n",
"typename",
"=",
"\"",
"\"",
"+",
"FormatName",
"(",
"currentNode",
")",
"\n",
"if",
"i",
">=",
"1",
"{",
"parentNames",
":=",
"v",
".",
"FindAllParentsOfSameNamedElement",
"(",
"currentNode",
",",
"properties",
")",
"\n",
"if",
"len",
"(",
"parentNames",
")",
">",
"1",
"{",
"typename",
"=",
"\"",
"\"",
"+",
"FormatName",
"(",
"v",
".",
"Slice",
"[",
"i",
"-",
"1",
"]",
"+",
"\"",
"\"",
"+",
"currentNode",
")",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"else",
"{",
"typename",
"=",
"\"",
"\"",
"\n",
"}",
"\n",
"return",
"\n",
"}"
] |
24,643 | all-24644 | [
"WriteStringToFile",
"writes",
"the",
"string",
"to",
"the",
"file",
"at",
"the",
"provided",
"path",
"."
] | [
"func",
"WriteStringToFile",
"(",
"<mask>",
",",
"path",
"string",
")",
"error",
"{",
"f",
",",
"err",
":=",
"os",
".",
"OpenFile",
"(",
"path",
",",
"os",
".",
"O_CREATE",
"|",
"os",
".",
"O_WRONLY",
",",
"0644",
")",
"\n",
"defer",
"f",
".",
"Close",
"(",
")",
"\n\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"f",
".",
"WriteString",
"(",
"text",
")",
"\n",
"return",
"nil",
"\n",
"}"
] |
24,644 | all-24645 | [
"RestartDatum",
"restarts",
"a",
"datum",
"that",
"s",
"being",
"processed",
"as",
"part",
"of",
"a",
"job",
".",
"datumFilter",
"is",
"a",
"slice",
"of",
"strings",
"which",
"are",
"matched",
"against",
"either",
"the",
"Path",
"or",
"Hash",
"of",
"the",
"datum",
"the",
"order",
"of",
"the",
"strings",
"in",
"datumFilter",
"is",
"irrelevant",
"."
] | [
"func",
"(",
"c",
"APIClient",
")",
"RestartDatum",
"(",
"jobID",
"string",
",",
"datumFilter",
"[",
"]",
"string",
")",
"error",
"{",
"_",
",",
"err",
":=",
"c",
".",
"PpsAPIClient",
".",
"RestartDatum",
"(",
"c",
".",
"Ctx",
"(",
")",
",",
"&",
"pps",
".",
"RestartDatumRequest",
"{",
"<mask>",
":",
"NewJob",
"(",
"jobID",
")",
",",
"DataFilters",
":",
"datumFilter",
",",
"}",
",",
")",
"\n",
"return",
"grpcutil",
".",
"ScrubGRPC",
"(",
"err",
")",
"\n",
"}"
] |
24,645 | all-24646 | [
"UnmarshalJSON",
"is",
"a",
"copy",
"of",
"the",
"json",
".",
"RawMessage",
"implementation",
"."
] | [
"func",
"(",
"this",
"*",
"TriggerHookResponse",
")",
"UnmarshalJSON",
"(",
"data",
"[",
"]",
"byte",
")",
"error",
"{",
"if",
"this",
"==",
"nil",
"{",
"return",
"errors",
".",
"New",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"*",
"this",
"=",
"append",
"(",
"(",
"*",
"this",
")",
"[",
"0",
":",
"0",
"]",
",",
"<mask>",
"...",
")",
"\n",
"return",
"nil",
"\n",
"}"
] |
24,646 | all-24647 | [
"UnmarshalJSON",
"supports",
"json",
".",
"Unmarshaler",
"interface"
] | [
"func",
"(",
"v",
"*",
"EventChildNodeCountUpdated",
")",
"UnmarshalJSON",
"(",
"<mask>",
"[",
"]",
"byte",
")",
"error",
"{",
"r",
":=",
"jlexer",
".",
"Lexer",
"{",
"Data",
":",
"data",
"}",
"\n",
"easyjsonC5a4559bDecodeGithubComChromedpCdprotoDom65",
"(",
"&",
"r",
",",
"v",
")",
"\n",
"return",
"r",
".",
"Error",
"(",
")",
"\n",
"}"
] |
24,647 | all-24648 | [
"SetDetailHeightRows",
"is",
"a",
"wrapper",
"around",
"gtk_calendar_set_detail_height_rows",
"()",
"."
] | [
"func",
"(",
"v",
"*",
"Calendar",
")",
"SetDetailHeightRows",
"(",
"<mask>",
"int",
")",
"{",
"C",
".",
"gtk_calendar_set_detail_height_rows",
"(",
"v",
".",
"native",
"(",
")",
",",
"C",
".",
"gint",
"(",
"rows",
")",
")",
"\n",
"}"
] |
24,648 | all-24649 | [
"NewSharder",
"creates",
"a",
"Sharder",
"using",
"a",
"discovery",
"client",
"."
] | [
"func",
"NewSharder",
"(",
"discoveryClient",
"discovery",
".",
"<mask>",
",",
"numShards",
"uint64",
",",
"namespace",
"string",
")",
"Sharder",
"{",
"return",
"newSharder",
"(",
"discoveryClient",
",",
"numShards",
",",
"namespace",
")",
"\n",
"}"
] |
24,649 | all-24650 | [
"GetClientX509CertURL",
"returns",
"the",
"ClientX509CertURL",
"field",
"if",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"."
] | [
"func",
"(",
"i",
"*",
"IntegrationGCPCreateRequest",
")",
"GetClientX509CertURL",
"(",
")",
"<mask>",
"{",
"if",
"i",
"==",
"nil",
"||",
"i",
".",
"ClientX509CertURL",
"==",
"nil",
"{",
"return",
"\"",
"\"",
"\n",
"}",
"\n",
"return",
"*",
"i",
".",
"ClientX509CertURL",
"\n",
"}"
] |
24,650 | all-24651 | [
"ImageID",
"computes",
"an",
"ID",
"which",
"can",
"uniquely",
"identify",
"this",
"image",
"by",
"its",
"contents",
"."
] | [
"func",
"(",
"m",
"*",
"OCI1",
")",
"ImageID",
"(",
"[",
"]",
"digest",
".",
"Digest",
")",
"(",
"string",
",",
"error",
")",
"{",
"if",
"err",
":=",
"m",
".",
"Config",
".",
"Digest",
".",
"Validate",
"(",
")",
";",
"<mask>",
"!=",
"nil",
"{",
"return",
"\"",
"\"",
",",
"err",
"\n",
"}",
"\n",
"return",
"m",
".",
"Config",
".",
"Digest",
".",
"Hex",
"(",
")",
",",
"nil",
"\n",
"}"
] |
24,651 | all-24652 | [
"UnmarshalJSON",
"supports",
"json",
".",
"Unmarshaler",
"interface"
] | [
"func",
"(",
"v",
"*",
"GetIsolateIDReturns",
")",
"UnmarshalJSON",
"(",
"data",
"[",
"]",
"<mask>",
")",
"error",
"{",
"r",
":=",
"jlexer",
".",
"Lexer",
"{",
"Data",
":",
"data",
"}",
"\n",
"easyjsonC5a4559bDecodeGithubComChromedpCdprotoRuntime23",
"(",
"&",
"r",
",",
"v",
")",
"\n",
"return",
"r",
".",
"Error",
"(",
")",
"\n",
"}"
] |
24,652 | all-24653 | [
"NetIP",
"returns",
"the",
"primary",
"IP",
"address",
"of",
"the",
"system",
"or",
"an",
"empty",
"string",
"."
] | [
"func",
"NetIP",
"(",
")",
"string",
"{",
"addrs",
",",
"err",
":=",
"net",
".",
"InterfaceAddrs",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"\"",
"\"",
"\n",
"}",
"\n",
"for",
"_",
",",
"addr",
":=",
"range",
"addrs",
"{",
"ip",
":=",
"addr",
".",
"String",
"(",
")",
"\n",
"if",
"ip",
"!=",
"\"",
"\"",
"{",
"return",
"<mask>",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"\"",
"\"",
"\n",
"}"
] |
24,653 | all-24654 | [
"serveHttpKVAPI",
"starts",
"a",
"key",
"-",
"value",
"server",
"with",
"a",
"GET",
"/",
"PUT",
"API",
"and",
"listens",
"."
] | [
"func",
"serveHttpKVAPI",
"(",
"kv",
"*",
"kvstore",
",",
"port",
"int",
",",
"confChangeC",
"chan",
"<-",
"raftpb",
".",
"ConfChange",
",",
"errorC",
"<-",
"chan",
"error",
")",
"{",
"srv",
":=",
"http",
".",
"Server",
"{",
"Addr",
":",
"\"",
"\"",
"+",
"strconv",
".",
"Itoa",
"(",
"port",
")",
",",
"Handler",
":",
"&",
"httpKVAPI",
"{",
"store",
":",
"kv",
",",
"confChangeC",
":",
"confChangeC",
",",
"}",
",",
"}",
"\n",
"go",
"func",
"(",
")",
"{",
"if",
"err",
":=",
"srv",
".",
"ListenAndServe",
"(",
")",
";",
"err",
"!=",
"nil",
"{",
"log",
".",
"Fatal",
"(",
"err",
")",
"\n",
"}",
"\n",
"}",
"(",
")",
"\n\n",
"// exit when raft goes down",
"if",
"err",
",",
"<mask>",
":=",
"<-",
"errorC",
";",
"ok",
"{",
"log",
".",
"Fatal",
"(",
"err",
")",
"\n",
"}",
"\n",
"}"
] |
24,654 | all-24655 | [
"HasMinLocationFailed",
"returns",
"a",
"boolean",
"if",
"a",
"field",
"has",
"been",
"set",
"."
] | [
"func",
"(",
"s",
"*",
"SyntheticsOptions",
")",
"HasMinLocationFailed",
"(",
")",
"bool",
"{",
"if",
"s",
"!=",
"nil",
"&&",
"s",
".",
"MinLocationFailed",
"!=",
"nil",
"{",
"return",
"<mask>",
"\n",
"}",
"\n\n",
"return",
"false",
"\n",
"}"
] |
24,655 | all-24656 | [
"Write",
"writes",
"len",
"(",
"p",
")",
"bytes",
"from",
"p",
"to",
"the",
"underlying",
"data",
"stream",
".",
"It",
"returns",
"the",
"number",
"of",
"bytes",
"written",
"from",
"p",
"(",
"0",
"<",
"=",
"n",
"<",
"=",
"len",
"(",
"p",
"))",
"and",
"any",
"error",
"encountered",
"that",
"caused",
"the",
"write",
"to",
"stop",
"early",
".",
"Write",
"must",
"return",
"a",
"non",
"-",
"nil",
"error",
"if",
"it",
"returns",
"n",
"<",
"len",
"(",
"p",
")",
".",
"Write",
"doesn",
"t",
"modify",
"b",
".",
"User",
"so",
"once",
"a",
"[]",
"byte",
"is",
"pinned",
"with",
"a",
"call",
"to",
"Bytes",
"()",
"it",
"should",
"remain",
"valid",
"even",
"with",
"additional",
"calls",
"to",
"Write",
"()",
"that",
"come",
"after",
"the",
"Bytes",
"()",
"call",
"."
] | [
"func",
"(",
"b",
"*",
"AtomicFixedSizeRingBuf",
")",
"Write",
"(",
"p",
"[",
"]",
"byte",
")",
"(",
"n",
"int",
",",
"err",
"error",
")",
"{",
"b",
".",
"tex",
".",
"Lock",
"(",
")",
"\n",
"defer",
"b",
".",
"tex",
".",
"Unlock",
"(",
")",
"\n\n",
"for",
"{",
"if",
"len",
"(",
"p",
")",
"==",
"0",
"{",
"// nothing (left) to copy in; notice we shorten our",
"// local copy p (below) as we read from it.",
"return",
"\n",
"}",
"\n\n",
"writeCapacity",
":=",
"b",
".",
"N",
"-",
"b",
".",
"readable",
"\n",
"if",
"writeCapacity",
"<=",
"0",
"{",
"// we are all full up already.",
"return",
"n",
",",
"<mask>",
".",
"ErrShortWrite",
"\n",
"}",
"\n",
"if",
"len",
"(",
"p",
")",
">",
"writeCapacity",
"{",
"err",
"=",
"io",
".",
"ErrShortWrite",
"\n",
"// leave err set and",
"// keep going, write what we can.",
"}",
"\n\n",
"writeStart",
":=",
"(",
"b",
".",
"Beg",
"+",
"b",
".",
"readable",
")",
"%",
"b",
".",
"N",
"\n\n",
"upperLim",
":=",
"intMin2",
"(",
"writeStart",
"+",
"writeCapacity",
",",
"b",
".",
"N",
")",
"\n\n",
"k",
":=",
"copy",
"(",
"b",
".",
"A",
"[",
"b",
".",
"Use",
"]",
"[",
"writeStart",
":",
"upperLim",
"]",
",",
"p",
")",
"\n\n",
"n",
"+=",
"k",
"\n",
"b",
".",
"readable",
"+=",
"k",
"\n",
"p",
"=",
"p",
"[",
"k",
":",
"]",
"\n\n",
"// we can fill from b.A[b.Use][0:something] from",
"// p's remainder, so loop",
"}",
"\n",
"}"
] |
24,656 | all-24657 | [
"URLs",
"returns",
"a",
"list",
"of",
"all",
"URLs",
".",
"The",
"returned",
"list",
"is",
"sorted",
"in",
"ascending",
"lexicographical",
"order",
"."
] | [
"func",
"(",
"c",
"URLsMap",
")",
"URLs",
"(",
")",
"[",
"]",
"string",
"{",
"<mask>",
"urls",
"[",
"]",
"string",
"\n",
"for",
"_",
",",
"us",
":=",
"range",
"c",
"{",
"for",
"_",
",",
"u",
":=",
"range",
"us",
"{",
"urls",
"=",
"append",
"(",
"urls",
",",
"u",
".",
"String",
"(",
")",
")",
"\n",
"}",
"\n",
"}",
"\n",
"sort",
".",
"Strings",
"(",
"urls",
")",
"\n",
"return",
"urls",
"\n",
"}"
] |
24,657 | all-24658 | [
"Format",
"creates",
"and",
"wraps",
"an",
"error",
"with",
"the",
"given",
"error",
"string",
".",
"Equivalent",
"to",
":",
"errs",
".",
"Wrap",
"(",
"fmt",
".",
"Errorf",
"(",
"format",
"args",
"...",
"))"
] | [
"func",
"Format",
"(",
"info",
"Info",
",",
"format",
"string",
",",
"argv",
"...",
"interface",
"{",
"}",
")",
"Err",
"{",
"return",
"newErr",
"(",
"debug",
".",
"Stack",
"(",
")",
",",
"fmt",
".",
"Errorf",
"(",
"format",
",",
"argv",
"...",
")",
",",
"<mask>",
",",
"info",
",",
"nil",
")",
"\n",
"}"
] |
24,658 | all-24659 | [
"NewStatusPolicy",
"returns",
"a",
"status",
"policy",
"that",
"assigns",
"relative",
"severity",
"in",
"accordance",
"with",
"a",
"user",
"-",
"configurable",
"prioritised",
"slice",
".",
"Check",
"statuses",
"must",
"be",
"listed",
"in",
"ascending",
"severity",
"order",
"."
] | [
"func",
"NewStatusPolicy",
"(",
"statuses",
"[",
"]",
"Status",
")",
"(",
"*",
"statusPolicy",
",",
"error",
")",
"{",
"newPol",
":=",
"make",
"(",
"statusPolicy",
")",
"\n",
"for",
"i",
",",
"status",
":=",
"range",
"statuses",
"{",
"newPol",
"[",
"status",
"]",
"=",
"statusSeverity",
"(",
"i",
")",
"\n",
"}",
"\n\n",
"// Ensure all statuses are covered by the new policy.",
"defaultPol",
":=",
"NewDefaultStatusPolicy",
"(",
")",
"\n",
"for",
"status",
":=",
"range",
"*",
"defaultPol",
"{",
"_",
",",
"ok",
":=",
"newPol",
"[",
"<mask>",
"]",
"\n",
"if",
"!",
"ok",
"{",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"status",
")",
"\n",
"}",
"\n",
"}",
"\n\n",
"return",
"&",
"newPol",
",",
"nil",
"\n",
"}"
] |
24,659 | all-24660 | [
"LineTo",
"is",
"a",
"wrapper",
"around",
"cairo_line_to",
"()",
"."
] | [
"func",
"(",
"v",
"*",
"<mask>",
")",
"LineTo",
"(",
"x",
",",
"y",
"float64",
")",
"{",
"C",
".",
"cairo_line_to",
"(",
"v",
".",
"native",
"(",
")",
",",
"C",
".",
"double",
"(",
"x",
")",
",",
"C",
".",
"double",
"(",
"y",
")",
")",
"\n",
"}"
] |
24,660 | all-24661 | [
"UserLogin",
"logs",
"a",
"user",
"in",
"returning",
"an",
"auth",
"token",
"and",
"the",
"user",
"object"
] | [
"func",
"UserLogin",
"(",
"w",
"http",
".",
"ResponseWriter",
",",
"r",
"*",
"http",
".",
"Request",
")",
"{",
"var",
"login",
"types",
".",
"LoginRequest",
"\n",
"w",
".",
"Header",
"(",
")",
".",
"Set",
"(",
"\"",
"\"",
",",
"\"",
"\"",
")",
"\n",
"w",
".",
"Header",
"(",
")",
".",
"Set",
"(",
"\"",
"\"",
",",
"\"",
"\"",
")",
"\n\n",
"body",
",",
"err",
":=",
"ioutil",
".",
"ReadAll",
"(",
"r",
".",
"Body",
")",
"\n",
"defer",
"r",
".",
"Body",
".",
"Close",
"(",
")",
"\n\n",
"if",
"err",
"!=",
"nil",
"{",
"w",
".",
"WriteHeader",
"(",
"http",
".",
"StatusServiceUnavailable",
")",
"\n",
"return",
"\n",
"}",
"\n\n",
"err",
"=",
"json",
".",
"Unmarshal",
"(",
"body",
",",
"&",
"login",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"w",
".",
"WriteHeader",
"(",
"http",
".",
"StatusServiceUnavailable",
")",
"\n",
"return",
"\n",
"}",
"\n\n",
"<mask>",
",",
"err",
":=",
"userRepository",
".",
"ByUsername",
"(",
"login",
".",
"Username",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"w",
".",
"WriteHeader",
"(",
"http",
".",
"StatusNotFound",
")",
"\n",
"}",
"else",
"if",
"user",
".",
"Username",
"!=",
"login",
".",
"Username",
"||",
"user",
".",
"Password",
"!=",
"login",
".",
"Password",
"{",
"w",
".",
"WriteHeader",
"(",
"http",
".",
"StatusUnauthorized",
")",
"\n",
"}",
"else",
"{",
"w",
".",
"Header",
"(",
")",
".",
"Set",
"(",
"\"",
"\"",
",",
"getAuthToken",
"(",
")",
")",
"\n",
"w",
".",
"WriteHeader",
"(",
"http",
".",
"StatusOK",
")",
"\n",
"res",
":=",
"types",
".",
"LoginResponse",
"{",
"User",
":",
"user",
"}",
"\n",
"resBody",
",",
"_",
":=",
"json",
".",
"Marshal",
"(",
"res",
")",
"\n",
"w",
".",
"Write",
"(",
"resBody",
")",
"\n",
"}",
"\n",
"}"
] |
24,661 | all-24662 | [
"Draw",
"the",
"image",
"frame",
"with",
"certain",
"parameters",
"."
] | [
"func",
"Draw",
"(",
"gc",
"draw2d",
".",
"GraphicContext",
",",
"png",
"string",
",",
"dw",
",",
"dh",
",",
"margin",
",",
"lineWidth",
"float64",
")",
"error",
"{",
"// Draw frame",
"draw2dkit",
".",
"RoundedRectangle",
"(",
"gc",
",",
"lineWidth",
",",
"lineWidth",
",",
"dw",
"-",
"lineWidth",
",",
"dh",
"-",
"lineWidth",
",",
"100",
",",
"100",
")",
"\n",
"gc",
".",
"SetLineWidth",
"(",
"lineWidth",
")",
"\n",
"gc",
".",
"FillStroke",
"(",
")",
"\n\n",
"// load the source image",
"source",
",",
"err",
":=",
"draw2dimg",
".",
"LoadFromPngFile",
"(",
"png",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"// Size of source image",
"sw",
",",
"sh",
":=",
"float64",
"(",
"source",
".",
"Bounds",
"(",
")",
".",
"Dx",
"(",
")",
")",
",",
"float64",
"(",
"source",
".",
"Bounds",
"(",
")",
".",
"Dy",
"(",
")",
")",
"\n",
"// Draw image to fit in the frame",
"// TODO Seems to have a transform bug here on draw image",
"scale",
":=",
"math",
".",
"Min",
"(",
"(",
"dw",
"-",
"margin",
"*",
"2",
")",
"/",
"sw",
",",
"(",
"dh",
"-",
"margin",
"*",
"2",
")",
"/",
"sh",
")",
"\n",
"gc",
".",
"Save",
"(",
")",
"\n",
"gc",
".",
"Translate",
"(",
"(",
"dw",
"-",
"sw",
"*",
"scale",
")",
"/",
"2",
",",
"(",
"dh",
"-",
"sh",
"*",
"scale",
")",
"/",
"2",
")",
"\n",
"gc",
".",
"Scale",
"(",
"scale",
",",
"<mask>",
")",
"\n",
"gc",
".",
"Rotate",
"(",
"0.2",
")",
"\n\n",
"gc",
".",
"DrawImage",
"(",
"source",
")",
"\n",
"gc",
".",
"Restore",
"(",
")",
"\n",
"return",
"nil",
"\n",
"}"
] |
24,662 | all-24663 | [
"UnmarshalJSON",
"supports",
"json",
".",
"Unmarshaler",
"interface"
] | [
"func",
"(",
"v",
"*",
"GetAttributesParams",
")",
"UnmarshalJSON",
"(",
"data",
"[",
"]",
"byte",
")",
"error",
"{",
"r",
":=",
"jlexer",
".",
"Lexer",
"{",
"Data",
":",
"<mask>",
"}",
"\n",
"easyjsonC5a4559bDecodeGithubComChromedpCdprotoDom53",
"(",
"&",
"r",
",",
"v",
")",
"\n",
"return",
"r",
".",
"Error",
"(",
")",
"\n",
"}"
] |
24,663 | all-24664 | [
"UnmarshalJSON",
"supports",
"json",
".",
"Unmarshaler",
"interface"
] | [
"func",
"(",
"v",
"*",
"EventDataCollected",
")",
"UnmarshalJSON",
"(",
"data",
"[",
"]",
"byte",
")",
"error",
"{",
"r",
":=",
"jlexer",
".",
"Lexer",
"{",
"Data",
":",
"data",
"}",
"\n",
"easyjsonC5a4559bDecodeGithubComChromedpCdprotoTracing9",
"(",
"&",
"r",
",",
"v",
")",
"\n",
"return",
"r",
".",
"<mask>",
"(",
")",
"\n",
"}"
] |
24,664 | all-24665 | [
"GetBuildID",
"calls",
"out",
"to",
"tot",
"in",
"order",
"to",
"vend",
"build",
"identifier",
"for",
"the",
"job"
] | [
"func",
"GetBuildID",
"(",
"name",
",",
"totURL",
"string",
")",
"(",
"string",
",",
"error",
")",
"{",
"if",
"totURL",
"==",
"\"",
"\"",
"{",
"return",
"node",
".",
"Generate",
"(",
")",
".",
"String",
"(",
")",
",",
"nil",
"\n",
"}",
"\n",
"var",
"err",
"error",
"\n",
"url",
",",
"err",
":=",
"url",
".",
"Parse",
"(",
"totURL",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"\"",
"\"",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"}",
"\n",
"url",
".",
"Path",
"=",
"path",
".",
"Join",
"(",
"url",
".",
"Path",
",",
"\"",
"\"",
",",
"name",
")",
"\n",
"sleepDuration",
":=",
"100",
"*",
"time",
".",
"Millisecond",
"\n",
"for",
"retries",
":=",
"0",
";",
"retries",
"<",
"10",
";",
"retries",
"++",
"{",
"if",
"retries",
">",
"0",
"{",
"sleep",
"(",
"sleepDuration",
")",
"\n",
"sleepDuration",
"=",
"sleepDuration",
"*",
"2",
"\n",
"}",
"\n",
"var",
"resp",
"*",
"http",
".",
"Response",
"\n",
"resp",
",",
"err",
"=",
"http",
".",
"Get",
"(",
"url",
".",
"String",
"(",
")",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"continue",
"\n",
"}",
"\n",
"defer",
"resp",
".",
"Body",
".",
"Close",
"(",
")",
"\n",
"if",
"resp",
".",
"StatusCode",
"!=",
"200",
"{",
"err",
"=",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"resp",
".",
"Status",
")",
"\n",
"<mask>",
"\n",
"}",
"\n",
"var",
"buf",
"[",
"]",
"byte",
"\n",
"buf",
",",
"err",
"=",
"ioutil",
".",
"ReadAll",
"(",
"resp",
".",
"Body",
")",
"\n",
"if",
"err",
"==",
"nil",
"{",
"return",
"string",
"(",
"buf",
")",
",",
"nil",
"\n",
"}",
"\n",
"return",
"\"",
"\"",
",",
"err",
"\n",
"}",
"\n",
"return",
"\"",
"\"",
",",
"err",
"\n",
"}"
] |
24,665 | all-24666 | [
"IsButtonPressed",
"returns",
"a",
"boolean",
"value",
"indicating",
"whether",
"the",
"given",
"virtual",
"button",
"b",
"is",
"pressed",
"."
] | [
"func",
"(",
"c",
"*",
"gamepadConfig",
")",
"IsButtonPressed",
"(",
"b",
"virtualGamepadButton",
")",
"bool",
"{",
"if",
"!",
"c",
".",
"gamepadIDInitialized",
"{",
"panic",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"c",
".",
"initializeIfNeeded",
"(",
")",
"\n\n",
"bb",
",",
"ok",
":=",
"c",
".",
"buttons",
"[",
"b",
"]",
"\n",
"if",
"ok",
"{",
"return",
"ebiten",
".",
"IsGamepadButtonPressed",
"(",
"c",
".",
"gamepadID",
",",
"bb",
")",
"\n",
"}",
"\n\n",
"a",
",",
"ok",
":=",
"c",
".",
"axes",
"[",
"b",
"]",
"\n",
"if",
"ok",
"{",
"v",
":=",
"ebiten",
".",
"GamepadAxis",
"(",
"c",
".",
"gamepadID",
",",
"a",
".",
"<mask>",
")",
"\n",
"if",
"a",
".",
"positive",
"{",
"return",
"axisThreshold",
"<=",
"v",
"&&",
"v",
"<=",
"1.0",
"\n",
"}",
"else",
"{",
"return",
"-",
"1.0",
"<=",
"v",
"&&",
"v",
"<=",
"-",
"axisThreshold",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"false",
"\n",
"}"
] |
24,666 | all-24667 | [
"GetFilename",
"is",
"a",
"wrapper",
"around",
"gtk_file_chooser_get_filename",
"()",
"."
] | [
"func",
"(",
"v",
"*",
"FileChooser",
")",
"GetFilename",
"(",
")",
"<mask>",
"{",
"c",
":=",
"C",
".",
"gtk_file_chooser_get_filename",
"(",
"v",
".",
"native",
"(",
")",
")",
"\n",
"s",
":=",
"goString",
"(",
"c",
")",
"\n",
"defer",
"C",
".",
"g_free",
"(",
"(",
"C",
".",
"gpointer",
")",
"(",
"c",
")",
")",
"\n",
"return",
"s",
"\n",
"}"
] |
24,667 | all-24668 | [
"Add",
"an",
"item",
"to",
"the",
"cache",
"replacing",
"any",
"existing",
"item",
"using",
"the",
"default",
"expiration",
"."
] | [
"func",
"(",
"c",
"*",
"cache",
")",
"SetDefault",
"(",
"k",
"string",
",",
"x",
"<mask>",
"{",
"}",
")",
"{",
"c",
".",
"Set",
"(",
"k",
",",
"x",
",",
"DefaultExpiration",
")",
"\n",
"}"
] |
24,668 | all-24669 | [
"NewCountPlugin",
"counts",
"events",
"and",
"number",
"of",
"issues",
"in",
"given",
"state",
"and",
"for",
"how",
"long",
"."
] | [
"func",
"NewCountPlugin",
"(",
"runner",
"func",
"(",
"Plugin",
")",
"error",
")",
"*",
"cobra",
".",
"Command",
"{",
"stateCounter",
":=",
"&",
"StatePlugin",
"{",
"}",
"\n",
"eventCounter",
":=",
"&",
"EventCounterPlugin",
"{",
"}",
"\n",
"commentsAsEvents",
":=",
"NewFakeCommentPluginWrapper",
"(",
"eventCounter",
")",
"\n",
"commentCounter",
":=",
"&",
"CommentCounterPlugin",
"{",
"}",
"\n",
"authorLoggable",
":=",
"NewMultiplexerPluginWrapper",
"(",
"commentsAsEvents",
",",
"commentCounter",
",",
")",
"\n",
"authorLogged",
":=",
"NewAuthorLoggerPluginWrapper",
"(",
"authorLoggable",
")",
"\n",
"fullMultiplex",
":=",
"NewMultiplexerPluginWrapper",
"(",
"authorLogged",
",",
"stateCounter",
")",
"\n\n",
"fakeOpen",
":=",
"NewFakeOpenPluginWrapper",
"(",
"fullMultiplex",
")",
"\n",
"typeFilter",
":=",
"NewTypeFilterWrapperPlugin",
"(",
"fakeOpen",
")",
"\n",
"authorFilter",
":=",
"NewAuthorFilterPluginWrapper",
"(",
"typeFilter",
")",
"\n\n",
"cmd",
":=",
"&",
"cobra",
".",
"Command",
"{",
"Use",
":",
"\"",
"\"",
",",
"Short",
":",
"\"",
"\"",
",",
"RunE",
":",
"func",
"(",
"cmd",
"*",
"cobra",
".",
"Command",
",",
"args",
"[",
"]",
"string",
")",
"error",
"{",
"if",
"err",
":=",
"eventCounter",
".",
"CheckFlags",
"(",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"if",
"err",
":=",
"stateCounter",
".",
"CheckFlags",
"(",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"if",
"err",
":=",
"typeFilter",
".",
"CheckFlags",
"(",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"if",
"err",
":=",
"commentCounter",
".",
"CheckFlags",
"(",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"return",
"<mask>",
"(",
"authorFilter",
")",
"\n",
"}",
",",
"}",
"\n\n",
"eventCounter",
".",
"AddFlags",
"(",
"cmd",
")",
"\n",
"stateCounter",
".",
"AddFlags",
"(",
"cmd",
")",
"\n",
"commentCounter",
".",
"AddFlags",
"(",
"cmd",
")",
"\n",
"typeFilter",
".",
"AddFlags",
"(",
"cmd",
")",
"\n",
"authorFilter",
".",
"AddFlags",
"(",
"cmd",
")",
"\n",
"authorLogged",
".",
"AddFlags",
"(",
"cmd",
")",
"\n\n",
"return",
"cmd",
"\n",
"}"
] |
24,669 | all-24670 | [
"invalidate",
"a",
"region",
"of",
"a",
"texture",
"image"
] | [
"func",
"InvalidateTexSubImage",
"(",
"texture",
"uint32",
",",
"level",
"int32",
",",
"xoffset",
"int32",
",",
"yoffset",
"int32",
",",
"zoffset",
"int32",
",",
"width",
"int32",
",",
"height",
"int32",
",",
"<mask>",
"int32",
")",
"{",
"syscall",
".",
"Syscall9",
"(",
"gpInvalidateTexSubImage",
",",
"8",
",",
"uintptr",
"(",
"texture",
")",
",",
"uintptr",
"(",
"level",
")",
",",
"uintptr",
"(",
"xoffset",
")",
",",
"uintptr",
"(",
"yoffset",
")",
",",
"uintptr",
"(",
"zoffset",
")",
",",
"uintptr",
"(",
"width",
")",
",",
"uintptr",
"(",
"height",
")",
",",
"uintptr",
"(",
"depth",
")",
",",
"0",
")",
"\n",
"}"
] |
24,670 | all-24671 | [
"Same",
"as",
"GetName",
"()",
"but",
"for",
"IPv6",
"addresses",
"."
] | [
"func",
"(",
"gi",
"*",
"GeoIP",
")",
"GetNameV6",
"(",
"ip",
"string",
")",
"(",
"name",
"string",
",",
"netmask",
"int",
")",
"{",
"if",
"gi",
".",
"db",
"==",
"nil",
"{",
"return",
"\n",
"}",
"\n\n",
"gi",
".",
"mu",
".",
"Lock",
"(",
")",
"\n",
"defer",
"gi",
".",
"mu",
".",
"Unlock",
"(",
")",
"\n\n",
"cip",
":=",
"C",
".",
"CString",
"(",
"ip",
")",
"\n",
"defer",
"C",
".",
"<mask>",
"(",
"unsafe",
".",
"Pointer",
"(",
"cip",
")",
")",
"\n",
"cname",
":=",
"C",
".",
"GeoIP_name_by_addr_v6",
"(",
"gi",
".",
"db",
",",
"cip",
")",
"\n\n",
"if",
"cname",
"!=",
"nil",
"{",
"name",
"=",
"C",
".",
"GoString",
"(",
"cname",
")",
"\n",
"defer",
"C",
".",
"free",
"(",
"unsafe",
".",
"Pointer",
"(",
"cname",
")",
")",
"\n",
"netmask",
"=",
"int",
"(",
"C",
".",
"GeoIP_last_netmask",
"(",
"gi",
".",
"db",
")",
")",
"\n",
"return",
"\n",
"}",
"\n",
"return",
"\n",
"}"
] |
24,671 | all-24672 | [
"MarshalJSON",
"supports",
"json",
".",
"Marshaler",
"interface"
] | [
"func",
"(",
"v",
"CloseTargetReturns",
")",
"MarshalJSON",
"(",
")",
"(",
"[",
"]",
"<mask>",
",",
"error",
")",
"{",
"w",
":=",
"jwriter",
".",
"Writer",
"{",
"}",
"\n",
"easyjsonC5a4559bEncodeGithubComChromedpCdprotoTarget26",
"(",
"&",
"w",
",",
"v",
")",
"\n",
"return",
"w",
".",
"Buffer",
".",
"BuildBytes",
"(",
")",
",",
"w",
".",
"Error",
"\n",
"}"
] |
24,672 | all-24673 | [
"EachLike",
"specifies",
"that",
"a",
"given",
"element",
"in",
"a",
"JSON",
"body",
"can",
"be",
"repeated",
"minRequired",
"times",
".",
"Number",
"needs",
"to",
"be",
"1",
"or",
"greater"
] | [
"func",
"EachLike",
"(",
"content",
"interface",
"{",
"}",
",",
"minRequired",
"int",
")",
"Matcher",
"{",
"return",
"eachLike",
"{",
"Contents",
":",
"<mask>",
",",
"Min",
":",
"minRequired",
",",
"}",
"\n",
"}"
] |
24,673 | all-24674 | [
"DialogNew",
"()",
"is",
"a",
"wrapper",
"around",
"gtk_dialog_new",
"()",
"."
] | [
"func",
"DialogNew",
"(",
")",
"(",
"*",
"Dialog",
",",
"error",
")",
"{",
"c",
":=",
"C",
".",
"gtk_dialog_new",
"(",
")",
"\n",
"if",
"c",
"==",
"nil",
"{",
"return",
"nil",
",",
"nilPtrErr",
"\n",
"}",
"\n",
"obj",
":=",
"glib",
".",
"Take",
"(",
"unsafe",
".",
"Pointer",
"(",
"c",
")",
")",
"\n",
"<mask>",
"wrapDialog",
"(",
"obj",
")",
",",
"nil",
"\n",
"}"
] |
24,674 | all-24675 | [
"IsValidBuildFileName",
"returns",
"true",
"if",
"a",
"file",
"with",
"the",
"given",
"base",
"name",
"should",
"be",
"treated",
"as",
"a",
"build",
"file",
"."
] | [
"func",
"(",
"c",
"*",
"Config",
")",
"IsValidBuildFileName",
"(",
"name",
"string",
")",
"bool",
"{",
"for",
"_",
",",
"n",
":=",
"range",
"c",
".",
"ValidBuildFileNames",
"{",
"if",
"<mask>",
"==",
"n",
"{",
"return",
"true",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"false",
"\n",
"}"
] |
24,675 | all-24676 | [
"Write",
"outputs",
"the",
"response",
"to",
"w",
"."
] | [
"func",
"(",
"r",
"RawResponse",
")",
"Write",
"(",
"w",
"*",
"bufio",
".",
"<mask>",
")",
"error",
"{",
"return",
"writeResponse",
"(",
"w",
",",
"[",
"]",
"byte",
"(",
"r",
")",
")",
"\n",
"}"
] |
24,676 | all-24677 | [
"GetAllXattr",
"retrieves",
"all",
"extended",
"attributes",
"associated",
"with",
"a",
"file",
"directory",
"or",
"symbolic",
"link",
"."
] | [
"func",
"GetAllXattr",
"(",
"path",
"string",
")",
"(",
"xattrs",
"map",
"[",
"string",
"]",
"string",
",",
"err",
"error",
")",
"{",
"e1",
":=",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
")",
"\n\n",
"// Call llistxattr() twice: First, to determine the size of the buffer",
"// we need to allocate to store the extended attributes, second, to",
"// actually store the extended attributes in the buffer. Also, check if",
"// the size/number of extended attributes hasn't changed between the two",
"// calls.",
"pre",
",",
"err",
":=",
"llistxattr",
"(",
"path",
",",
"nil",
")",
"\n",
"if",
"err",
"!=",
"nil",
"||",
"pre",
"<",
"0",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"if",
"pre",
"==",
"0",
"{",
"return",
"nil",
",",
"nil",
"\n",
"}",
"\n\n",
"dest",
":=",
"make",
"(",
"[",
"]",
"byte",
",",
"pre",
")",
"\n\n",
"post",
",",
"err",
":=",
"llistxattr",
"(",
"path",
",",
"dest",
")",
"\n",
"if",
"err",
"!=",
"nil",
"||",
"<mask>",
"<",
"0",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"if",
"post",
"!=",
"pre",
"{",
"return",
"nil",
",",
"e1",
"\n",
"}",
"\n\n",
"split",
":=",
"strings",
".",
"Split",
"(",
"string",
"(",
"dest",
")",
",",
"\"",
"\\x00",
"\"",
")",
"\n",
"if",
"split",
"==",
"nil",
"{",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"// *listxattr functions return a list of names as an unordered array",
"// of null-terminated character strings (attribute names are separated",
"// by null bytes ('\\0')), like this: user.name1\\0system.name1\\0user.name2\\0",
"// Since we split at the '\\0'-byte the last element of the slice will be",
"// the empty string. We remove it:",
"if",
"split",
"[",
"len",
"(",
"split",
")",
"-",
"1",
"]",
"==",
"\"",
"\"",
"{",
"split",
"=",
"split",
"[",
":",
"len",
"(",
"split",
")",
"-",
"1",
"]",
"\n",
"}",
"\n\n",
"xattrs",
"=",
"make",
"(",
"map",
"[",
"string",
"]",
"string",
",",
"len",
"(",
"split",
")",
")",
"\n\n",
"for",
"_",
",",
"x",
":=",
"range",
"split",
"{",
"xattr",
":=",
"string",
"(",
"x",
")",
"\n",
"// Call Getxattr() twice: First, to determine the size of the",
"// buffer we need to allocate to store the extended attributes,",
"// second, to actually store the extended attributes in the",
"// buffer. Also, check if the size of the extended attribute",
"// hasn't changed between the two calls.",
"pre",
",",
"err",
"=",
"syscall",
".",
"Getxattr",
"(",
"path",
",",
"xattr",
",",
"nil",
")",
"\n",
"if",
"err",
"!=",
"nil",
"||",
"pre",
"<",
"0",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"dest",
"=",
"make",
"(",
"[",
"]",
"byte",
",",
"pre",
")",
"\n",
"post",
":=",
"0",
"\n",
"if",
"pre",
">",
"0",
"{",
"post",
",",
"err",
"=",
"syscall",
".",
"Getxattr",
"(",
"path",
",",
"xattr",
",",
"dest",
")",
"\n",
"if",
"err",
"!=",
"nil",
"||",
"post",
"<",
"0",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"}",
"\n\n",
"if",
"post",
"!=",
"pre",
"{",
"return",
"nil",
",",
"e1",
"\n",
"}",
"\n\n",
"xattrs",
"[",
"xattr",
"]",
"=",
"string",
"(",
"dest",
")",
"\n",
"}",
"\n\n",
"return",
"xattrs",
",",
"nil",
"\n",
"}"
] |
24,677 | all-24678 | [
"Return",
"Go",
"type",
"of",
"the",
"given",
"database",
"entity",
"."
] | [
"func",
"entityType",
"(",
"pkg",
"string",
",",
"entity",
"string",
")",
"string",
"{",
"typ",
":=",
"lex",
".",
"Capital",
"(",
"<mask>",
")",
"\n",
"if",
"pkg",
"!=",
"\"",
"\"",
"{",
"typ",
"=",
"pkg",
"+",
"\"",
"\"",
"+",
"typ",
"\n",
"}",
"\n",
"return",
"typ",
"\n",
"}"
] |
24,678 | all-24679 | [
"Resource",
"is",
"an",
"option",
"that",
"sets",
"the",
"resource",
"information",
"to",
"send",
"with",
"each",
"log",
"entry",
".",
"Please",
"see",
"https",
":",
"//",
"cloud",
".",
"google",
".",
"com",
"/",
"logging",
"/",
"docs",
"/",
"api",
"/",
"v2",
"/",
"resource",
"-",
"list",
"for",
"the",
"list",
"of",
"labels",
"required",
"per",
"ResType",
"."
] | [
"func",
"Resource",
"(",
"typ",
"ResType",
",",
"labels",
"map",
"[",
"string",
"]",
"string",
")",
"Option",
"{",
"return",
"func",
"(",
"sh",
"*",
"StackdriverHook",
")",
"error",
"{",
"return",
"MonitoredResource",
"(",
"&",
"logging",
".",
"MonitoredResource",
"{",
"<mask>",
":",
"string",
"(",
"typ",
")",
",",
"Labels",
":",
"labels",
",",
"}",
")",
"(",
"sh",
")",
"\n",
"}",
"\n",
"}"
] |
24,679 | all-24680 | [
"IsErr",
"checks",
"if",
"err",
"is",
"an",
"errs",
".",
"Err",
"and",
"return",
"it",
"as",
"an",
"errs",
".",
"Err",
"if",
"it",
"is",
".",
"This",
"is",
"equivalent",
"to",
"err",
".",
"(",
"errs",
".",
"Err",
")"
] | [
"func",
"IsErr",
"(",
"err",
"<mask>",
")",
"(",
"Err",
",",
"bool",
")",
"{",
"errsErr",
",",
"isErr",
":=",
"err",
".",
"(",
"Err",
")",
"\n",
"return",
"errsErr",
",",
"isErr",
"\n",
"}"
] |
24,680 | all-24681 | [
"MakeSlice",
"creates",
"a",
"[]",
"interface",
"{}",
"proxy",
"and",
"pushes",
"it",
"on",
"the",
"stack",
".",
"Optional",
"argument",
":",
"size",
"(",
"number",
")",
"Returns",
":",
"proxy",
"(",
"[]",
"interface",
"{}",
")"
] | [
"func",
"MakeSlice",
"(",
"L",
"*",
"lua",
".",
"State",
")",
"int",
"{",
"n",
":=",
"L",
".",
"OptInteger",
"(",
"1",
",",
"0",
")",
"\n",
"s",
":=",
"reflect",
".",
"MakeSlice",
"(",
"tslice",
",",
"n",
",",
"n",
"+",
"1",
")",
"\n",
"makeValueProxy",
"(",
"L",
",",
"s",
",",
"cSliceMeta",
")",
"\n",
"<mask>",
"1",
"\n",
"}"
] |
24,681 | all-24682 | [
"Trigger",
"creates",
"a",
"new",
"PagerDuty",
"incident",
"with",
"the",
"given",
"description",
".",
"The",
"returned",
"incident",
"key",
"can",
"be",
"used",
"to",
"resolve",
"the",
"incident",
".",
"It",
"can",
"also",
"be",
"used",
"by",
"the",
"TriggerIncidentKey",
"*",
"functions",
"to",
"trigger",
"an",
"incident",
"only",
"if",
"that",
"specific",
"incident",
"has",
"been",
"resolved",
"."
] | [
"func",
"(",
"p",
"*",
"Pager",
")",
"Trigger",
"(",
"description",
"string",
")",
"(",
"incidentKey",
"string",
",",
"err",
"error",
")",
"{",
"return",
"p",
".",
"trigger",
"(",
"<mask>",
",",
"\"",
"\"",
",",
"map",
"[",
"string",
"]",
"interface",
"{",
"}",
"{",
"}",
")",
"\n",
"}"
] |
24,682 | all-24683 | [
"validate",
"checks",
"the",
"following",
"properties",
":",
"-",
"Org",
"Regexp",
"MissingLabel",
"and",
"GracePeriod",
"must",
"be",
"non",
"-",
"empty",
".",
"-",
"Repo",
"does",
"not",
"contain",
"a",
"/",
"(",
"should",
"use",
"Org",
"+",
"Repo",
")",
".",
"-",
"At",
"least",
"one",
"of",
"PRs",
"or",
"Issues",
"must",
"be",
"true",
".",
"-",
"Branch",
"only",
"specified",
"if",
"prs",
":",
"true",
"-",
"MissingLabel",
"must",
"not",
"match",
"Regexp",
"."
] | [
"func",
"(",
"r",
"RequireMatchingLabel",
")",
"validate",
"(",
")",
"error",
"{",
"if",
"r",
".",
"Org",
"==",
"\"",
"\"",
"{",
"return",
"errors",
".",
"New",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"if",
"strings",
".",
"Contains",
"(",
"r",
".",
"Repo",
",",
"\"",
"\"",
")",
"{",
"return",
"<mask>",
".",
"New",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"if",
"r",
".",
"Regexp",
"==",
"\"",
"\"",
"{",
"return",
"errors",
".",
"New",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"if",
"r",
".",
"MissingLabel",
"==",
"\"",
"\"",
"{",
"return",
"errors",
".",
"New",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"if",
"r",
".",
"GracePeriod",
"==",
"\"",
"\"",
"{",
"return",
"errors",
".",
"New",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"if",
"!",
"r",
".",
"PRs",
"&&",
"!",
"r",
".",
"Issues",
"{",
"return",
"errors",
".",
"New",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"if",
"!",
"r",
".",
"PRs",
"&&",
"r",
".",
"Branch",
"!=",
"\"",
"\"",
"{",
"return",
"errors",
".",
"New",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"if",
"r",
".",
"Re",
".",
"MatchString",
"(",
"r",
".",
"MissingLabel",
")",
"{",
"return",
"errors",
".",
"New",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
] |
24,683 | all-24684 | [
"NextSystemUID",
"returns",
"the",
"next",
"free",
"system",
"user",
"id",
"to",
"use",
"."
] | [
"func",
"NextSystemUID",
"(",
")",
"(",
"int",
",",
"error",
")",
"{",
"db",
",",
"uid",
",",
"err",
":=",
"nextUID",
"(",
"<mask>",
")",
"\n",
"db",
".",
"close",
"(",
")",
"\n",
"return",
"uid",
",",
"err",
"\n",
"}"
] |
24,684 | all-24685 | [
"NewQueueManager",
"builds",
"a",
"new",
"QueueManager",
"."
] | [
"func",
"NewQueueManager",
"(",
"logger",
"log",
".",
"Logger",
",",
"walDir",
"string",
",",
"samplesIn",
"*",
"ewmaRate",
",",
"cfg",
"config",
".",
"QueueConfig",
",",
"externalLabels",
"labels",
".",
"Labels",
",",
"relabelConfigs",
"[",
"]",
"*",
"relabel",
".",
"Config",
",",
"client",
"StorageClient",
",",
"flushDeadline",
"time",
".",
"Duration",
")",
"*",
"QueueManager",
"{",
"if",
"logger",
"==",
"nil",
"{",
"logger",
"=",
"log",
".",
"NewNopLogger",
"(",
")",
"\n",
"}",
"\n\n",
"name",
":=",
"client",
".",
"Name",
"(",
")",
"\n",
"logger",
"=",
"log",
".",
"With",
"(",
"logger",
",",
"\"",
"\"",
",",
"name",
")",
"\n",
"t",
":=",
"&",
"QueueManager",
"{",
"logger",
":",
"logger",
",",
"flushDeadline",
":",
"flushDeadline",
",",
"cfg",
":",
"cfg",
",",
"externalLabels",
":",
"externalLabels",
",",
"relabelConfigs",
":",
"relabelConfigs",
",",
"<mask>",
":",
"client",
",",
"seriesLabels",
":",
"make",
"(",
"map",
"[",
"uint64",
"]",
"[",
"]",
"prompb",
".",
"Label",
")",
",",
"seriesSegmentIndexes",
":",
"make",
"(",
"map",
"[",
"uint64",
"]",
"int",
")",
",",
"droppedSeries",
":",
"make",
"(",
"map",
"[",
"uint64",
"]",
"struct",
"{",
"}",
")",
",",
"numShards",
":",
"cfg",
".",
"MinShards",
",",
"reshardChan",
":",
"make",
"(",
"chan",
"int",
")",
",",
"quit",
":",
"make",
"(",
"chan",
"struct",
"{",
"}",
")",
",",
"samplesIn",
":",
"samplesIn",
",",
"samplesDropped",
":",
"newEWMARate",
"(",
"ewmaWeight",
",",
"shardUpdateDuration",
")",
",",
"samplesOut",
":",
"newEWMARate",
"(",
"ewmaWeight",
",",
"shardUpdateDuration",
")",
",",
"samplesOutDuration",
":",
"newEWMARate",
"(",
"ewmaWeight",
",",
"shardUpdateDuration",
")",
",",
"}",
"\n\n",
"t",
".",
"watcher",
"=",
"NewWALWatcher",
"(",
"logger",
",",
"name",
",",
"t",
",",
"walDir",
")",
"\n",
"t",
".",
"shards",
"=",
"t",
".",
"newShards",
"(",
")",
"\n\n",
"return",
"t",
"\n",
"}"
] |
24,685 | all-24686 | [
"MarshalEasyJSON",
"satisfies",
"easyjson",
".",
"Marshaler",
"."
] | [
"func",
"(",
"t",
"GetEncodedResponseEncoding",
")",
"MarshalEasyJSON",
"(",
"<mask>",
"*",
"jwriter",
".",
"Writer",
")",
"{",
"out",
".",
"String",
"(",
"string",
"(",
"t",
")",
")",
"\n",
"}"
] |
24,686 | all-24687 | [
"GetAlphaNum12",
"retrieves",
"the",
"AlphaNum12",
"value",
"from",
"the",
"union",
"returning",
"ok",
"if",
"the",
"union",
"s",
"switch",
"indicated",
"the",
"value",
"is",
"valid",
"."
] | [
"func",
"(",
"u",
"Asset",
")",
"GetAlphaNum12",
"(",
")",
"(",
"result",
"AssetAlphaNum12",
",",
"<mask>",
"bool",
")",
"{",
"armName",
",",
"_",
":=",
"u",
".",
"ArmForSwitch",
"(",
"int32",
"(",
"u",
".",
"Type",
")",
")",
"\n\n",
"if",
"armName",
"==",
"\"",
"\"",
"{",
"result",
"=",
"*",
"u",
".",
"AlphaNum12",
"\n",
"ok",
"=",
"true",
"\n",
"}",
"\n\n",
"return",
"\n",
"}"
] |
24,687 | all-24688 | [
"GetActionsForAccel",
"is",
"a",
"wrapper",
"around",
"gtk_application_get_actions_for_accel",
"()",
"."
] | [
"func",
"(",
"v",
"*",
"Application",
")",
"GetActionsForAccel",
"(",
"acc",
"string",
")",
"[",
"]",
"string",
"{",
"cstr1",
":=",
"(",
"*",
"C",
".",
"gchar",
")",
"(",
"C",
".",
"CString",
"(",
"acc",
")",
")",
"\n",
"defer",
"C",
".",
"free",
"(",
"unsafe",
".",
"Pointer",
"(",
"cstr1",
")",
")",
"\n\n",
"<mask>",
"acts",
"[",
"]",
"string",
"\n",
"c",
":=",
"C",
".",
"gtk_application_get_actions_for_accel",
"(",
"v",
".",
"native",
"(",
")",
",",
"cstr1",
")",
"\n",
"originalc",
":=",
"c",
"\n",
"defer",
"C",
".",
"g_strfreev",
"(",
"originalc",
")",
"\n\n",
"for",
"*",
"c",
"!=",
"nil",
"{",
"acts",
"=",
"append",
"(",
"acts",
",",
"C",
".",
"GoString",
"(",
"(",
"*",
"C",
".",
"char",
")",
"(",
"*",
"c",
")",
")",
")",
"\n",
"c",
"=",
"C",
".",
"next_gcharptr",
"(",
"c",
")",
"\n",
"}",
"\n\n",
"return",
"acts",
"\n",
"}"
] |
24,688 | all-24689 | [
"AnnotatedString",
"wraps",
"g_variant_print",
"()",
"but",
"returns",
"a",
"type",
"-",
"annotated",
"string",
"."
] | [
"func",
"(",
"v",
"*",
"Variant",
")",
"AnnotatedString",
"(",
")",
"string",
"{",
"gc",
":=",
"C",
".",
"g_variant_print",
"(",
"v",
".",
"native",
"(",
")",
",",
"gbool",
"(",
"<mask>",
")",
")",
"\n",
"defer",
"C",
".",
"g_free",
"(",
"C",
".",
"gpointer",
"(",
"gc",
")",
")",
"\n",
"return",
"C",
".",
"GoString",
"(",
"(",
"*",
"C",
".",
"char",
")",
"(",
"gc",
")",
")",
"\n",
"}"
] |
24,689 | all-24690 | [
"compact",
"keyspace",
"history",
"to",
"a",
"provided",
"revision"
] | [
"func",
"compact",
"(",
"c",
"*",
"v3",
".",
"Client",
",",
"rev",
"int64",
")",
"{",
"fmt",
".",
"Printf",
"(",
"\"",
"\\n",
"\"",
",",
"rev",
")",
"\n",
"ctx",
",",
"cancel",
":=",
"context",
".",
"WithTimeout",
"(",
"<mask>",
".",
"Background",
"(",
")",
",",
"30",
"*",
"time",
".",
"Second",
")",
"\n",
"_",
",",
"err",
":=",
"c",
".",
"Compact",
"(",
"ctx",
",",
"rev",
",",
"v3",
".",
"WithCompactPhysical",
"(",
")",
")",
"\n",
"cancel",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"ExitWithError",
"(",
"ExitError",
",",
"err",
")",
"\n",
"}",
"\n",
"fmt",
".",
"Printf",
"(",
"\"",
"\\n",
"\"",
",",
"rev",
")",
"\n",
"}"
] |
24,690 | all-24691 | [
"func",
"(",
"f",
"QueryField",
")",
"MarshalJSON",
"()",
"(",
"[]",
"byte",
"error",
")",
"{",
"return",
"json",
".",
"Marshal",
"(",
"struct",
"{",
"Name",
"string",
"json",
":",
"name",
"Val",
"interface",
"{}",
"json",
":",
"val",
"}",
"{",
"Name",
":",
"f",
".",
"Name",
"Val",
":",
"f",
".",
"Val",
"}",
")",
"}"
] | [
"func",
"(",
"f",
"QueryField",
")",
"MarshalJSON",
"(",
")",
"(",
"[",
"]",
"<mask>",
",",
"error",
")",
"{",
"return",
"json",
".",
"Marshal",
"(",
"map",
"[",
"string",
"]",
"interface",
"{",
"}",
"{",
"f",
".",
"Name",
":",
"f",
".",
"Val",
",",
"}",
")",
"\n",
"}"
] |
24,691 | all-24692 | [
"WriteLen8String",
"writes",
"an",
"8",
"-",
"bit",
"length",
"preceded",
"string"
] | [
"func",
"(",
"w",
"*",
"WriteBuffer",
")",
"WriteLen8String",
"(",
"s",
"string",
")",
"{",
"if",
"int",
"(",
"byte",
"(",
"len",
"(",
"s",
")",
")",
")",
"!=",
"len",
"(",
"s",
")",
"{",
"w",
".",
"setErr",
"(",
"errStringTooLong",
")",
"\n",
"}",
"\n\n",
"w",
".",
"WriteSingleByte",
"(",
"<mask>",
"(",
"len",
"(",
"s",
")",
")",
")",
"\n",
"w",
".",
"WriteString",
"(",
"s",
")",
"\n",
"}"
] |
24,692 | all-24693 | [
"GetGroup",
"is",
"a",
"wrapper",
"around",
"gtk_radio_menu_item_get_group",
"()",
"."
] | [
"func",
"(",
"v",
"*",
"RadioMenuItem",
")",
"GetGroup",
"(",
")",
"(",
"*",
"glib",
".",
"SList",
",",
"<mask>",
")",
"{",
"c",
":=",
"C",
".",
"gtk_radio_menu_item_get_group",
"(",
"v",
".",
"native",
"(",
")",
")",
"\n",
"if",
"c",
"==",
"nil",
"{",
"return",
"nil",
",",
"nilPtrErr",
"\n",
"}",
"\n",
"return",
"glib",
".",
"WrapSList",
"(",
"uintptr",
"(",
"unsafe",
".",
"Pointer",
"(",
"c",
")",
")",
")",
",",
"nil",
"\n",
"}"
] |
24,693 | all-24694 | [
"Get",
"returns",
"the",
"value",
"stored",
"for",
"the",
"given",
"key",
"."
] | [
"func",
"(",
"h",
"*",
"kvHandler",
")",
"Get",
"(",
"ctx",
"thrift",
".",
"Context",
",",
"key",
"string",
")",
"(",
"string",
",",
"error",
")",
"{",
"if",
"err",
":=",
"isValidKey",
"(",
"key",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"\"",
"\"",
",",
"err",
"\n",
"}",
"\n\n",
"h",
".",
"RLock",
"(",
")",
"\n",
"defer",
"h",
".",
"RUnlock",
"(",
")",
"\n\n",
"if",
"val",
",",
"<mask>",
":=",
"h",
".",
"vals",
"[",
"key",
"]",
";",
"ok",
"{",
"return",
"val",
",",
"nil",
"\n",
"}",
"\n\n",
"return",
"\"",
"\"",
",",
"&",
"keyvalue",
".",
"KeyNotFound",
"{",
"Key",
":",
"key",
"}",
"\n",
"}"
] |
24,694 | all-24695 | [
"GetExtraColOk",
"returns",
"a",
"tuple",
"with",
"the",
"ExtraCol",
"field",
"if",
"it",
"s",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"and",
"a",
"boolean",
"to",
"check",
"if",
"the",
"value",
"has",
"been",
"set",
"."
] | [
"func",
"(",
"g",
"*",
"GraphDefinitionRequest",
")",
"GetExtraColOk",
"(",
")",
"(",
"string",
",",
"bool",
")",
"{",
"if",
"g",
"==",
"nil",
"||",
"g",
".",
"ExtraCol",
"==",
"nil",
"{",
"return",
"\"",
"\"",
",",
"<mask>",
"\n",
"}",
"\n",
"return",
"*",
"g",
".",
"ExtraCol",
",",
"true",
"\n",
"}"
] |
24,695 | all-24696 | [
"MustManageDataResult",
"retrieves",
"the",
"ManageDataResult",
"value",
"from",
"the",
"union",
"panicing",
"if",
"the",
"value",
"is",
"not",
"set",
"."
] | [
"func",
"(",
"u",
"OperationResultTr",
")",
"MustManageDataResult",
"(",
")",
"ManageDataResult",
"{",
"val",
",",
"ok",
":=",
"u",
".",
"GetManageDataResult",
"(",
")",
"\n\n",
"if",
"!",
"<mask>",
"{",
"panic",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"return",
"val",
"\n",
"}"
] |
24,696 | all-24697 | [
"Remaining",
"returns",
"the",
"remaining",
"time",
"of",
"the",
"lease",
"."
] | [
"func",
"(",
"l",
"*",
"Lease",
")",
"Remaining",
"(",
")",
"time",
".",
"Duration",
"{",
"l",
".",
"expiryMu",
".",
"RLock",
"(",
")",
"\n",
"defer",
"l",
".",
"expiryMu",
".",
"RUnlock",
"(",
")",
"\n",
"if",
"l",
".",
"expiry",
".",
"IsZero",
"(",
")",
"{",
"return",
"<mask>",
".",
"Duration",
"(",
"math",
".",
"MaxInt64",
")",
"\n",
"}",
"\n",
"return",
"time",
".",
"Until",
"(",
"l",
".",
"expiry",
")",
"\n",
"}"
] |
24,697 | all-24698 | [
"GoogleServiceAccountCredentialsFile",
"is",
"an",
"option",
"that",
"loads",
"Google",
"Service",
"Account",
"credentials",
"for",
"use",
"with",
"the",
"StackdriverHook",
"from",
"the",
"specified",
"file",
".",
"Google",
"Service",
"Account",
"credentials",
"can",
"be",
"downloaded",
"from",
"the",
"Google",
"Cloud",
"console",
":",
"https",
":",
"//",
"console",
".",
"cloud",
".",
"google",
".",
"com",
"/",
"iam",
"-",
"admin",
"/",
"serviceaccounts",
"/"
] | [
"func",
"GoogleServiceAccountCredentialsFile",
"(",
"path",
"string",
")",
"Option",
"{",
"return",
"func",
"(",
"sh",
"*",
"StackdriverHook",
")",
"error",
"{",
"buf",
",",
"err",
":=",
"ioutil",
".",
"ReadFile",
"(",
"<mask>",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"return",
"GoogleServiceAccountCredentialsJSON",
"(",
"buf",
")",
"(",
"sh",
")",
"\n",
"}",
"\n",
"}"
] |
24,698 | all-24699 | [
"New",
"generator",
"for",
"creating",
"basic",
"asset",
"files"
] | [
"func",
"New",
"(",
"opts",
"*",
"Options",
")",
"(",
"*",
"genny",
".",
"Generator",
",",
"error",
")",
"{",
"g",
":=",
"genny",
".",
"New",
"(",
")",
"\n",
"g",
".",
"Box",
"(",
"packr",
".",
"New",
"(",
"\"",
"\"",
",",
"\"",
"\"",
")",
")",
"\n\n",
"data",
":=",
"map",
"[",
"string",
"]",
"interface",
"{",
"}",
"{",
"}",
"\n",
"h",
":=",
"<mask>",
".",
"FuncMap",
"{",
"}",
"\n",
"t",
":=",
"gogen",
".",
"TemplateTransformer",
"(",
"data",
",",
"h",
")",
"\n",
"g",
".",
"Transformer",
"(",
"t",
")",
"\n\n",
"g",
".",
"RunFn",
"(",
"func",
"(",
"r",
"*",
"genny",
".",
"Runner",
")",
"error",
"{",
"f",
",",
"err",
":=",
"r",
".",
"FindFile",
"(",
"\"",
"\"",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"s",
":=",
"strings",
".",
"Replace",
"(",
"f",
".",
"String",
"(",
")",
",",
"\"",
"\"",
",",
"\"",
"\\n",
"\"",
"+",
"bs4",
",",
"1",
")",
"\n",
"return",
"r",
".",
"File",
"(",
"genny",
".",
"NewFileS",
"(",
"f",
".",
"Name",
"(",
")",
",",
"s",
")",
")",
"\n",
"}",
")",
"\n\n",
"return",
"g",
",",
"nil",
"\n",
"}"
] |
24,699 | all-24700 | [
"Events",
"starts",
"a",
"task",
"that",
"continuously",
"monitors",
"the",
"list",
"of",
"cluster",
"nodes",
"and",
"maintains",
"a",
"pool",
"of",
"websocket",
"connections",
"against",
"all",
"of",
"them",
"in",
"order",
"to",
"get",
"notified",
"about",
"events",
".",
"Whenever",
"an",
"event",
"is",
"received",
"the",
"given",
"callback",
"is",
"invoked",
"."
] | [
"func",
"Events",
"(",
"endpoints",
"*",
"endpoints",
".",
"Endpoints",
",",
"cluster",
"*",
"db",
".",
"Cluster",
",",
"f",
"func",
"(",
"int64",
",",
"api",
".",
"Event",
")",
")",
"(",
"task",
".",
"Func",
",",
"task",
".",
"Schedule",
")",
"{",
"listeners",
":=",
"map",
"[",
"int64",
"]",
"*",
"lxd",
".",
"EventListener",
"{",
"}",
"\n\n",
"// Update our pool of event listeners. Since database queries are",
"// blocking, we spawn the actual logic in a goroutine, to abort",
"// immediately when we receive the stop signal.",
"update",
":=",
"func",
"(",
"ctx",
"context",
".",
"Context",
")",
"{",
"ch",
":=",
"<mask>",
"(",
"chan",
"struct",
"{",
"}",
")",
"\n",
"go",
"func",
"(",
")",
"{",
"eventsUpdateListeners",
"(",
"endpoints",
",",
"cluster",
",",
"listeners",
",",
"f",
")",
"\n",
"ch",
"<-",
"struct",
"{",
"}",
"{",
"}",
"\n",
"}",
"(",
")",
"\n",
"select",
"{",
"case",
"<-",
"ch",
":",
"case",
"<-",
"ctx",
".",
"Done",
"(",
")",
":",
"}",
"\n\n",
"}",
"\n\n",
"schedule",
":=",
"task",
".",
"Every",
"(",
"time",
".",
"Second",
")",
"\n\n",
"return",
"update",
",",
"schedule",
"\n",
"}"
] |
Subsets and Splits