id
int32 0
25.3k
| idx
stringlengths 5
9
| nl_tokens
sequencelengths 1
418
| pl_tokens
sequencelengths 22
4.98k
|
---|---|---|---|
4,900 | all-4901 | [
"Mount",
"pfs",
"to",
"mountPoint",
"opts",
"may",
"be",
"left",
"nil",
"."
] | [
"func",
"Mount",
"(",
"c",
"*",
"client",
".",
"APIClient",
",",
"mountPoint",
"string",
",",
"opts",
"*",
"Options",
")",
"error",
"{",
"nfs",
":=",
"pathfs",
".",
"NewPathNodeFs",
"(",
"newFileSystem",
"(",
"c",
",",
"opts",
".",
"getCommits",
"(",
")",
")",
",",
"nil",
")",
"\n",
"server",
",",
"_",
",",
"err",
":=",
"nodefs",
".",
"MountRoot",
"(",
"mountPoint",
",",
"nfs",
".",
"Root",
"(",
")",
",",
"opts",
".",
"getFuse",
"(",
")",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"}",
"\n",
"sigChan",
":=",
"make",
"(",
"chan",
"os",
".",
"Signal",
",",
"1",
")",
"\n",
"signal",
".",
"Notify",
"(",
"sigChan",
",",
"<mask>",
".",
"Interrupt",
")",
"\n",
"go",
"func",
"(",
")",
"{",
"select",
"{",
"case",
"<-",
"sigChan",
":",
"case",
"<-",
"opts",
".",
"getUnmount",
"(",
")",
":",
"}",
"\n",
"server",
".",
"Unmount",
"(",
")",
"\n",
"}",
"(",
")",
"\n",
"server",
".",
"Serve",
"(",
")",
"\n",
"return",
"nil",
"\n",
"}"
] |
4,901 | all-4902 | [
"DeleteResource",
"deletes",
"a",
"resource",
"if",
"it",
"exists",
"errors",
"otherwise"
] | [
"func",
"(",
"s",
"*",
"Storage",
")",
"DeleteResource",
"(",
"name",
"string",
")",
"error",
"{",
"return",
"s",
".",
"resources",
".",
"Delete",
"(",
"<mask>",
")",
"\n",
"}"
] |
4,902 | all-4903 | [
"GetName",
"returns",
"the",
"Name",
"field",
"if",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"."
] | [
"func",
"(",
"c",
"*",
"Creator",
")",
"GetName",
"(",
")",
"string",
"{",
"if",
"c",
"==",
"nil",
"||",
"c",
".",
"Name",
"==",
"nil",
"{",
"return",
"\"",
"\"",
"\n",
"}",
"\n",
"return",
"*",
"c",
".",
"<mask>",
"\n",
"}"
] |
4,903 | all-4904 | [
"sendENIStateChangeWithRetries",
"invokes",
"the",
"sendENIStateChange",
"method",
"with",
"backoff",
"and",
"retries",
".",
"Retries",
"are",
"only",
"effective",
"if",
"sendENIStateChange",
"returns",
"an",
"unmanagedENIError",
".",
"We",
"re",
"effectively",
"waiting",
"for",
"the",
"ENI",
"attachment",
"message",
"from",
"ACS",
"for",
"a",
"network",
"device",
"at",
"this",
"point",
"of",
"time",
"."
] | [
"func",
"(",
"udevWatcher",
"*",
"UdevWatcher",
")",
"sendENIStateChangeWithRetries",
"(",
"parentCtx",
"context",
".",
"Context",
",",
"macAddress",
"string",
",",
"timeout",
"time",
".",
"Duration",
")",
"error",
"{",
"backoff",
":=",
"retry",
".",
"NewExponentialBackoff",
"(",
"sendENIStateChangeBackoffMin",
",",
"sendENIStateChangeBackoffMax",
",",
"sendENIStateChangeBackoffJitter",
",",
"sendENIStateChangeBackoffMultiple",
")",
"\n",
"ctx",
",",
"cancel",
":=",
"context",
".",
"WithTimeout",
"(",
"parentCtx",
",",
"timeout",
")",
"\n",
"defer",
"cancel",
"(",
")",
"\n\n",
"err",
":=",
"retry",
".",
"RetryWithBackoffCtx",
"(",
"ctx",
",",
"backoff",
",",
"func",
"(",
")",
"error",
"{",
"sendErr",
":=",
"udevWatcher",
".",
"sendENIStateChange",
"(",
"macAddress",
")",
"\n",
"if",
"sendErr",
"!=",
"nil",
"{",
"if",
"_",
",",
"ok",
":=",
"sendErr",
".",
"(",
"*",
"unmanagedENIError",
")",
";",
"ok",
"{",
"log",
".",
"Debugf",
"(",
"\"",
"\"",
",",
"sendErr",
")",
"\n",
"return",
"sendErr",
"\n",
"}",
"\n",
"// Not unmanagedENIError. Stop retrying when this happens",
"return",
"apierrors",
".",
"NewRetriableError",
"(",
"apierrors",
".",
"NewRetriable",
"(",
"<mask>",
")",
",",
"sendErr",
")",
"\n",
"}",
"\n\n",
"return",
"nil",
"\n",
"}",
")",
"\n\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"// RetryWithBackoffCtx returns nil when the context is cancelled. Check if there was",
"// a timeout here. TODO: Fix RetryWithBackoffCtx to return ctx.Err() on context Done()",
"if",
"err",
"=",
"ctx",
".",
"Err",
"(",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"errors",
".",
"Wrapf",
"(",
"err",
",",
"\"",
"\"",
",",
"macAddress",
")",
"\n",
"}",
"\n\n",
"return",
"nil",
"\n",
"}"
] |
4,904 | all-4905 | [
"getV3Filter",
"returns",
"a",
"V3",
"filter",
"function",
"from",
"a",
"code",
"byte",
"slice",
"."
] | [
"func",
"getV3Filter",
"(",
"code",
"[",
"]",
"byte",
")",
"(",
"v3Filter",
",",
"error",
")",
"{",
"// check if filter is a known standard filter",
"c",
":=",
"crc32",
".",
"ChecksumIEEE",
"(",
"code",
")",
"\n",
"for",
"_",
",",
"f",
":=",
"<mask>",
"standardV3Filters",
"{",
"if",
"f",
".",
"crc",
"==",
"c",
"&&",
"f",
".",
"len",
"==",
"len",
"(",
"code",
")",
"{",
"return",
"f",
".",
"f",
",",
"nil",
"\n",
"}",
"\n",
"}",
"\n\n",
"// create new vm filter",
"f",
":=",
"new",
"(",
"vmFilter",
")",
"\n",
"r",
":=",
"newRarBitReader",
"(",
"bytes",
".",
"NewReader",
"(",
"code",
"[",
"1",
":",
"]",
")",
")",
"// skip first xor byte check",
"\n\n",
"// read static data",
"n",
",",
"err",
":=",
"r",
".",
"readBits",
"(",
"1",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"if",
"n",
">",
"0",
"{",
"m",
",",
"err",
":=",
"r",
".",
"readUint32",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"f",
".",
"static",
"=",
"make",
"(",
"[",
"]",
"byte",
",",
"m",
"+",
"1",
")",
"\n",
"err",
"=",
"r",
".",
"readFull",
"(",
"f",
".",
"static",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"}",
"\n\n",
"f",
".",
"code",
",",
"err",
"=",
"readCommands",
"(",
"r",
")",
"\n",
"if",
"err",
"==",
"io",
".",
"EOF",
"{",
"err",
"=",
"nil",
"\n",
"}",
"\n\n",
"return",
"f",
".",
"execute",
",",
"err",
"\n",
"}"
] |
4,905 | all-4906 | [
"title",
":",
"platform",
"list",
"path",
":",
"/",
"platforms",
"method",
":",
"GET",
"produce",
":",
"application",
"/",
"json",
"responses",
":",
"200",
":",
"List",
"platforms",
"204",
":",
"No",
"content",
"401",
":",
"Unauthorized"
] | [
"func",
"platformList",
"(",
"w",
"http",
".",
"ResponseWriter",
",",
"r",
"*",
"http",
".",
"<mask>",
",",
"t",
"auth",
".",
"Token",
")",
"error",
"{",
"canUsePlat",
":=",
"permission",
".",
"Check",
"(",
"t",
",",
"permission",
".",
"PermPlatformUpdate",
")",
"||",
"permission",
".",
"Check",
"(",
"t",
",",
"permission",
".",
"PermPlatformCreate",
")",
"\n",
"platforms",
",",
"err",
":=",
"servicemanager",
".",
"Platform",
".",
"List",
"(",
"!",
"canUsePlat",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"if",
"len",
"(",
"platforms",
")",
"==",
"0",
"{",
"w",
".",
"WriteHeader",
"(",
"http",
".",
"StatusNoContent",
")",
"\n",
"return",
"nil",
"\n",
"}",
"\n",
"w",
".",
"Header",
"(",
")",
".",
"Set",
"(",
"\"",
"\"",
",",
"\"",
"\"",
")",
"\n",
"return",
"json",
".",
"NewEncoder",
"(",
"w",
")",
".",
"Encode",
"(",
"platforms",
")",
"\n",
"}"
] |
4,906 | all-4907 | [
"Execute",
"-",
"generates",
"concourse",
"pipeline",
"and",
"tasks"
] | [
"func",
"(",
"c",
"*",
"GenerateConcoursePipelineCommand",
")",
"Execute",
"(",
"[",
"]",
"string",
")",
"error",
"{",
"lo",
".",
"G",
".",
"Warning",
"(",
"\"",
"\"",
")",
"\n",
"const",
"varsFileName",
"=",
"\"",
"\"",
"\n",
"const",
"pipelineFileName",
"=",
"\"",
"\"",
"\n",
"const",
"cfMgmtYml",
"=",
"\"",
"\"",
"\n",
"const",
"cfMgmtSh",
"=",
"\"",
"\"",
"\n",
"var",
"targetFile",
"string",
"\n",
"fmt",
".",
"Println",
"(",
"\"",
"\"",
")",
"\n",
"if",
"err",
":=",
"createFile",
"(",
"pipelineFileName",
",",
"pipelineFileName",
")",
";",
"err",
"!=",
"nil",
"{",
"lo",
".",
"G",
".",
"Error",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"return",
"err",
"\n",
"}",
"\n",
"if",
"err",
":=",
"createFile",
"(",
"varsFileName",
",",
"varsFileName",
")",
";",
"err",
"!=",
"nil",
"{",
"lo",
".",
"G",
".",
"Error",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"return",
"err",
"\n",
"}",
"\n",
"if",
"err",
":=",
"os",
".",
"MkdirAll",
"(",
"\"",
"\"",
",",
"0755",
")",
";",
"err",
"==",
"nil",
"{",
"targetFile",
"=",
"filepath",
".",
"Join",
"(",
"\"",
"\"",
",",
"\"",
"\"",
",",
"cfMgmtYml",
")",
"\n",
"lo",
".",
"G",
".",
"Debug",
"(",
"\"",
"\"",
",",
"targetFile",
")",
"\n",
"if",
"err",
"=",
"createFile",
"(",
"cfMgmtYml",
",",
"targetFile",
")",
";",
"err",
"!=",
"nil",
"{",
"lo",
".",
"G",
".",
"Error",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"return",
"err",
"\n",
"}",
"\n",
"targetFile",
"=",
"filepath",
".",
"Join",
"(",
"\"",
"\"",
",",
"\"",
"\"",
",",
"cfMgmtSh",
")",
"\n",
"lo",
".",
"G",
".",
"Debug",
"(",
"\"",
"\"",
",",
"targetFile",
")",
"\n",
"if",
"err",
"=",
"createFile",
"(",
"cfMgmtSh",
",",
"targetFile",
")",
";",
"err",
"!=",
"nil",
"{",
"lo",
".",
"G",
".",
"<mask>",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"return",
"err",
"\n",
"}",
"\n",
"}",
"else",
"{",
"lo",
".",
"G",
".",
"Error",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"return",
"err",
"\n",
"}",
"\n",
"fmt",
".",
"Println",
"(",
"\"",
"\"",
")",
"\n",
"fmt",
".",
"Println",
"(",
"\"",
"\"",
")",
"\n",
"fmt",
".",
"Println",
"(",
"\"",
"\"",
")",
"\n",
"return",
"nil",
"\n",
"}"
] |
4,907 | all-4908 | [
"HasPrecision",
"returns",
"a",
"boolean",
"if",
"a",
"field",
"has",
"been",
"set",
"."
] | [
"func",
"(",
"w",
"*",
"Widget",
")",
"HasPrecision",
"(",
")",
"bool",
"{",
"if",
"w",
"!=",
"nil",
"&&",
"w",
".",
"Precision",
"!=",
"nil",
"{",
"return",
"<mask>",
"\n",
"}",
"\n\n",
"return",
"false",
"\n",
"}"
] |
4,908 | all-4909 | [
"NewFilename",
"should",
"be",
"named",
"TableFilepath",
"--",
"it",
"combines",
"the",
"dir",
"with",
"the",
"ID",
"to",
"make",
"a",
"table",
"filepath",
"."
] | [
"func",
"NewFilename",
"(",
"id",
"uint64",
",",
"dir",
"string",
")",
"string",
"{",
"return",
"filepath",
".",
"Join",
"(",
"dir",
",",
"IDToFilename",
"(",
"<mask>",
")",
")",
"\n",
"}"
] |
4,909 | all-4910 | [
"HasId",
"returns",
"a",
"boolean",
"if",
"a",
"field",
"has",
"been",
"set",
"."
] | [
"func",
"(",
"a",
"*",
"Alert",
")",
"HasId",
"(",
")",
"bool",
"{",
"if",
"a",
"!=",
"nil",
"&&",
"a",
".",
"Id",
"!=",
"nil",
"{",
"return",
"true",
"\n",
"}",
"\n\n",
"return",
"<mask>",
"\n",
"}"
] |
4,910 | all-4911 | [
"WithRequest",
"specifies",
"the",
"details",
"of",
"the",
"HTTP",
"request",
"that",
"will",
"be",
"used",
"to",
"confirm",
"that",
"the",
"Provider",
"provides",
"an",
"API",
"listening",
"on",
"the",
"given",
"interface",
".",
"Mandatory",
"."
] | [
"func",
"(",
"i",
"*",
"Interaction",
")",
"WithRequest",
"(",
"request",
"Request",
")",
"*",
"Interaction",
"{",
"i",
".",
"Request",
"=",
"request",
"\n\n",
"// Check if someone tried to add an object as a string representation",
"// as per original allowed implementation, e.g.",
"// { \"foo\": \"bar\", \"baz\": like(\"bat\") }",
"if",
"isJSONFormattedObject",
"(",
"request",
".",
"Body",
")",
"{",
"<mask>",
".",
"Println",
"(",
"\"",
"\"",
"+",
"\"",
"\"",
"+",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"return",
"i",
"\n",
"}"
] |
4,911 | all-4912 | [
"UnmarshalJSON",
"supports",
"json",
".",
"Unmarshaler",
"interface"
] | [
"func",
"(",
"v",
"*",
"EventExceptionThrown",
")",
"UnmarshalJSON",
"(",
"data",
"[",
"]",
"byte",
")",
"error",
"{",
"r",
":=",
"jlexer",
".",
"Lexer",
"{",
"Data",
":",
"data",
"}",
"\n",
"easyjsonC5a4559bDecodeGithubComChromedpCdprotoRuntime33",
"(",
"&",
"r",
",",
"v",
")",
"\n",
"return",
"r",
".",
"<mask>",
"(",
")",
"\n",
"}"
] |
4,912 | all-4913 | [
"frameRangeMatches",
"breaks",
"down",
"the",
"string",
"frame",
"range",
"into",
"groups",
"of",
"range",
"matches",
"for",
"further",
"processing",
"."
] | [
"func",
"frameRangeMatches",
"(",
"frange",
"string",
")",
"(",
"[",
"]",
"[",
"]",
"string",
",",
"error",
")",
"{",
"for",
"_",
",",
"k",
":=",
"range",
"defaultPadding",
".",
"AllChars",
"(",
")",
"{",
"frange",
"=",
"strings",
".",
"Replace",
"(",
"frange",
",",
"k",
",",
"\"",
"\"",
",",
"-",
"1",
")",
"\n",
"}",
"\n\n",
"var",
"(",
"matched",
"bool",
"\n",
"match",
"[",
"]",
"string",
"\n",
"rx",
"*",
"regexp",
".",
"Regexp",
"\n",
")",
"\n\n",
"frange",
"=",
"strings",
".",
"Replace",
"(",
"frange",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"-",
"1",
")",
"\n\n",
"// For each comma-sep component, we will parse a frame range",
"parts",
":=",
"strings",
".",
"Split",
"(",
"frange",
",",
"\"",
"\"",
")",
"\n",
"size",
":=",
"len",
"(",
"parts",
")",
"\n",
"matches",
":=",
"make",
"(",
"[",
"]",
"[",
"]",
"string",
",",
"size",
",",
"size",
")",
"\n\n",
"for",
"i",
",",
"part",
":=",
"range",
"parts",
"{",
"<mask>",
"=",
"false",
"\n\n",
"// Build up frames for all comma-sep components",
"for",
"_",
",",
"rx",
"=",
"range",
"rangePatterns",
"{",
"if",
"match",
"=",
"rx",
".",
"FindStringSubmatch",
"(",
"part",
")",
";",
"match",
"==",
"nil",
"{",
"continue",
"\n",
"}",
"\n",
"matched",
"=",
"true",
"\n",
"matches",
"[",
"i",
"]",
"=",
"match",
"[",
"1",
":",
"]",
"\n",
"}",
"\n\n",
"// If any component of the comma-sep frame range fails to",
"// parse, we bail out",
"if",
"!",
"matched",
"{",
"err",
":=",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"frange",
",",
"part",
")",
"\n",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"}",
"\n\n",
"return",
"matches",
",",
"nil",
"\n",
"}"
] |
4,913 | all-4914 | [
"GetId",
"returns",
"the",
"Id",
"field",
"if",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"."
] | [
"func",
"(",
"s",
"*",
"ScreenboardMonitor",
")",
"GetId",
"(",
")",
"int",
"{",
"if",
"s",
"==",
"nil",
"||",
"s",
".",
"<mask>",
"==",
"nil",
"{",
"return",
"0",
"\n",
"}",
"\n",
"return",
"*",
"s",
".",
"Id",
"\n",
"}"
] |
4,914 | all-4915 | [
"SRS",
"returns",
"the",
"projection",
"of",
"the",
"map",
"."
] | [
"func",
"(",
"m",
"*",
"<mask>",
")",
"SRS",
"(",
")",
"string",
"{",
"return",
"C",
".",
"GoString",
"(",
"C",
".",
"mapnik_map_get_srs",
"(",
"m",
".",
"m",
")",
")",
"\n",
"}"
] |
4,915 | all-4916 | [
"visit",
"will",
"call",
"a",
"node",
"visitor",
"on",
"each",
"node",
"that",
"overlaps",
"the",
"given",
"interval"
] | [
"func",
"(",
"x",
"*",
"intervalNode",
")",
"visit",
"(",
"iv",
"*",
"Interval",
",",
"nv",
"nodeVisitor",
")",
"bool",
"{",
"if",
"x",
"==",
"nil",
"{",
"return",
"true",
"\n",
"}",
"\n",
"v",
":=",
"iv",
".",
"Compare",
"(",
"&",
"x",
".",
"iv",
".",
"Ivl",
")",
"\n",
"switch",
"{",
"case",
"v",
"<",
"0",
":",
"if",
"!",
"x",
".",
"left",
".",
"visit",
"(",
"iv",
",",
"nv",
")",
"{",
"return",
"false",
"\n",
"}",
"\n",
"case",
"v",
">",
"0",
":",
"maxiv",
":=",
"Interval",
"{",
"x",
".",
"iv",
".",
"Ivl",
".",
"Begin",
",",
"x",
".",
"max",
"}",
"\n",
"if",
"maxiv",
".",
"Compare",
"(",
"iv",
")",
"==",
"0",
"{",
"if",
"!",
"x",
".",
"left",
".",
"visit",
"(",
"iv",
",",
"nv",
")",
"||",
"!",
"x",
".",
"right",
".",
"visit",
"(",
"iv",
",",
"nv",
")",
"{",
"return",
"false",
"\n",
"}",
"\n",
"}",
"\n",
"default",
":",
"if",
"!",
"x",
".",
"left",
".",
"visit",
"(",
"<mask>",
",",
"nv",
")",
"||",
"!",
"nv",
"(",
"x",
")",
"||",
"!",
"x",
".",
"right",
".",
"visit",
"(",
"iv",
",",
"nv",
")",
"{",
"return",
"false",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"true",
"\n",
"}"
] |
4,916 | all-4917 | [
"UnmarshalJSON",
"supports",
"json",
".",
"Unmarshaler",
"interface"
] | [
"func",
"(",
"v",
"*",
"AddScriptToEvaluateOnNewDocumentReturns",
")",
"UnmarshalJSON",
"(",
"data",
"[",
"]",
"byte",
")",
"error",
"{",
"r",
":=",
"jlexer",
".",
"Lexer",
"{",
"Data",
":",
"<mask>",
"}",
"\n",
"easyjsonC5a4559bDecodeGithubComChromedpCdprotoPage83",
"(",
"&",
"r",
",",
"v",
")",
"\n",
"return",
"r",
".",
"Error",
"(",
")",
"\n",
"}"
] |
4,917 | all-4918 | [
"Collaboration",
"retrieves",
"a",
"detailed",
"view",
"of",
"one",
"of",
"the",
"current",
"user",
"s",
"collaborations"
] | [
"func",
"(",
"c",
"*",
"Client",
")",
"Collaboration",
"(",
"identifier",
"string",
")",
"(",
"*",
"Collaboration",
",",
"error",
")",
"{",
"col",
":=",
"new",
"(",
"Collaboration",
")",
"\n",
"_",
",",
"err",
":=",
"c",
".",
"MakeApiRequest",
"(",
"\"",
"\"",
",",
"\"",
"\"",
"+",
"identifier",
",",
"nil",
",",
"<mask>",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"return",
"col",
",",
"err",
"\n",
"}"
] |
4,918 | all-4919 | [
"UnmarshalEasyJSON",
"satisfies",
"easyjson",
".",
"Unmarshaler",
"."
] | [
"func",
"(",
"t",
"*",
"AuthChallengeResponseResponse",
")",
"UnmarshalEasyJSON",
"(",
"in",
"*",
"jlexer",
".",
"Lexer",
")",
"{",
"switch",
"AuthChallengeResponseResponse",
"(",
"in",
".",
"String",
"(",
")",
")",
"{",
"case",
"AuthChallengeResponseResponseDefault",
":",
"*",
"t",
"=",
"AuthChallengeResponseResponseDefault",
"\n",
"case",
"AuthChallengeResponseResponseCancelAuth",
":",
"*",
"t",
"=",
"AuthChallengeResponseResponseCancelAuth",
"\n",
"case",
"AuthChallengeResponseResponseProvideCredentials",
":",
"*",
"t",
"=",
"AuthChallengeResponseResponseProvideCredentials",
"\n\n",
"<mask>",
":",
"in",
".",
"AddError",
"(",
"errors",
".",
"New",
"(",
"\"",
"\"",
")",
")",
"\n",
"}",
"\n",
"}"
] |
4,919 | all-4920 | [
"fileName",
"returns",
"the",
"file",
"name",
"."
] | [
"func",
"(",
"l",
"*",
"<mask>",
")",
"fileName",
"(",
")",
"string",
"{",
"return",
"l",
".",
"file",
".",
"path",
"+",
"dot",
"+",
"l",
".",
"opts",
".",
"Extension",
"\n",
"}"
] |
4,920 | all-4921 | [
"WithAPICallFunc",
"returns",
"a",
"copy",
"of",
"the",
"parent",
"context",
"that",
"will",
"cause",
"API",
"calls",
"to",
"invoke",
"f",
"instead",
"of",
"their",
"normal",
"operation",
".",
"This",
"is",
"intended",
"for",
"advanced",
"users",
"only",
"."
] | [
"func",
"WithAPICallFunc",
"(",
"ctx",
"context",
".",
"Context",
",",
"f",
"APICallFunc",
")",
"context",
".",
"Context",
"{",
"return",
"internal",
".",
"WithCallOverride",
"(",
"ctx",
",",
"<mask>",
".",
"CallOverrideFunc",
"(",
"f",
")",
")",
"\n",
"}"
] |
4,921 | all-4922 | [
"GenerateCACertificate",
"generates",
"a",
"new",
"certificate",
"authority",
"from",
"the",
"specified",
"org",
"and",
"bit",
"size",
"and",
"stores",
"the",
"resulting",
"certificate",
"and",
"key",
"file",
"in",
"the",
"arguments",
"."
] | [
"func",
"(",
"xcg",
"*",
"X509CertGenerator",
")",
"GenerateCACertificate",
"(",
"certFile",
",",
"keyFile",
",",
"org",
"string",
",",
"bits",
"int",
")",
"error",
"{",
"template",
",",
"err",
":=",
"xcg",
".",
"newCertificate",
"(",
"org",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"template",
".",
"IsCA",
"=",
"true",
"\n",
"template",
".",
"KeyUsage",
"|=",
"x509",
".",
"KeyUsageCertSign",
"\n",
"template",
".",
"KeyUsage",
"|=",
"x509",
".",
"KeyUsageKeyEncipherment",
"\n",
"template",
".",
"KeyUsage",
"|=",
"x509",
".",
"KeyUsageKeyAgreement",
"\n\n",
"priv",
",",
"err",
":=",
"rsa",
".",
"GenerateKey",
"(",
"rand",
".",
"Reader",
",",
"bits",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"derBytes",
",",
"err",
":=",
"x509",
".",
"CreateCertificate",
"(",
"rand",
".",
"Reader",
",",
"<mask>",
",",
"template",
",",
"&",
"priv",
".",
"PublicKey",
",",
"priv",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"certOut",
",",
"err",
":=",
"os",
".",
"Create",
"(",
"certFile",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"pem",
".",
"Encode",
"(",
"certOut",
",",
"&",
"pem",
".",
"Block",
"{",
"Type",
":",
"\"",
"\"",
",",
"Bytes",
":",
"derBytes",
"}",
")",
"\n",
"certOut",
".",
"Close",
"(",
")",
"\n\n",
"keyOut",
",",
"err",
":=",
"os",
".",
"OpenFile",
"(",
"keyFile",
",",
"os",
".",
"O_WRONLY",
"|",
"os",
".",
"O_CREATE",
"|",
"os",
".",
"O_TRUNC",
",",
"0600",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n\n",
"}",
"\n\n",
"pem",
".",
"Encode",
"(",
"keyOut",
",",
"&",
"pem",
".",
"Block",
"{",
"Type",
":",
"\"",
"\"",
",",
"Bytes",
":",
"x509",
".",
"MarshalPKCS1PrivateKey",
"(",
"priv",
")",
"}",
")",
"\n",
"keyOut",
".",
"Close",
"(",
")",
"\n\n",
"return",
"nil",
"\n",
"}"
] |
4,922 | all-4923 | [
"flattenVmwareUplinkPortTeamingPolicy",
"reads",
"various",
"fields",
"from",
"a",
"VmwareUplinkPortTeamingPolicy",
"into",
"the",
"passed",
"in",
"ResourceData",
"."
] | [
"func",
"flattenVmwareUplinkPortTeamingPolicy",
"(",
"d",
"*",
"schema",
".",
"ResourceData",
",",
"obj",
"*",
"<mask>",
".",
"VmwareUplinkPortTeamingPolicy",
")",
"error",
"{",
"if",
"obj",
"==",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n\n",
"structure",
".",
"SetStringPolicy",
"(",
"d",
",",
"\"",
"\"",
",",
"obj",
".",
"Policy",
")",
"\n",
"structure",
".",
"SetBoolPolicy",
"(",
"d",
",",
"\"",
"\"",
",",
"obj",
".",
"NotifySwitches",
")",
"\n",
"structure",
".",
"SetBoolPolicyReverse",
"(",
"d",
",",
"\"",
"\"",
",",
"obj",
".",
"RollingOrder",
")",
"\n\n",
"if",
"err",
":=",
"flattenDVSFailureCriteria",
"(",
"d",
",",
"obj",
".",
"FailureCriteria",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"if",
"err",
":=",
"flattenVMwareUplinkPortOrderPolicy",
"(",
"d",
",",
"obj",
".",
"UplinkPortOrder",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
] |
4,923 | all-4924 | [
"Get",
"returns",
"the",
"element",
"at",
"position",
"i"
] | [
"func",
"(",
"s",
"*",
"Stack",
")",
"Get",
"(",
"i",
"int",
")",
"(",
"<mask>",
"{",
"}",
",",
"error",
")",
"{",
"if",
"i",
"<",
"0",
"||",
"i",
">=",
"len",
"(",
"*",
"s",
")",
"{",
"return",
"nil",
",",
"errors",
".",
"New",
"(",
"strconv",
".",
"Itoa",
"(",
"i",
")",
"+",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"return",
"(",
"*",
"s",
")",
"[",
"i",
"]",
",",
"nil",
"\n",
"}"
] |
4,924 | all-4925 | [
"DesiredTerminal",
"returns",
"true",
"if",
"the",
"cgroup",
"s",
"desired",
"status",
"is",
"REMOVED"
] | [
"func",
"(",
"vol",
"*",
"VolumeResource",
")",
"DesiredTerminal",
"(",
")",
"bool",
"{",
"vol",
".",
"lock",
".",
"RLock",
"(",
")",
"\n",
"defer",
"vol",
".",
"<mask>",
".",
"RUnlock",
"(",
")",
"\n\n",
"return",
"vol",
".",
"desiredStatusUnsafe",
"==",
"resourcestatus",
".",
"ResourceStatus",
"(",
"VolumeRemoved",
")",
"\n",
"}"
] |
4,925 | all-4926 | [
"migrateVSphereVirtualMachineStateV3",
"migrates",
"the",
"state",
"of",
"the",
"vsphere_virtual_machine",
"from",
"version",
"2",
"to",
"version",
"3",
"."
] | [
"func",
"migrateVSphereVirtualMachineStateV3",
"(",
"is",
"*",
"terraform",
".",
"InstanceState",
",",
"meta",
"interface",
"{",
"}",
")",
"error",
"{",
"// All we really preserve from the old state is the UUID of the virtual",
"// machine. We leverage some of the special parts of the import functionality",
"// - namely validating disks, and flagging the VM as imported in the state to",
"// guard against someone adding customization to the configuration and",
"// accidentally forcing a new resource.",
"//",
"// Read will handle most of the population post-migration as it does for",
"// import, and there will be an unavoidable diff for TF-only options on the",
"// next plan.",
"client",
":=",
"meta",
".",
"(",
"*",
"VSphereClient",
")",
".",
"vimClient",
"\n",
"id",
":=",
"is",
".",
"ID",
"\n\n",
"log",
".",
"Printf",
"(",
"\"",
"\"",
",",
"id",
")",
"\n",
"vm",
",",
"err",
":=",
"virtualmachine",
".",
"FromUUID",
"(",
"client",
",",
"id",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"}",
"\n",
"props",
",",
"err",
":=",
"virtualmachine",
".",
"Properties",
"(",
"vm",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"}",
"\n\n",
"// Populate the UUID field of all virtual disks in state.",
"diskCnt",
",",
"_",
":=",
"strconv",
".",
"Atoi",
"(",
"is",
".",
"Attributes",
"[",
"\"",
"\"",
"]",
")",
"\n",
"l",
":=",
"<mask>",
".",
"VirtualDeviceList",
"(",
"props",
".",
"Config",
".",
"Hardware",
".",
"Device",
")",
"\n",
"for",
"i",
":=",
"0",
";",
"i",
"<",
"diskCnt",
";",
"i",
"++",
"{",
"v",
",",
"ok",
":=",
"is",
".",
"Attributes",
"[",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"i",
")",
"]",
"\n",
"if",
"!",
"ok",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"i",
")",
"\n",
"}",
"\n",
"key",
",",
"err",
":=",
"strconv",
".",
"Atoi",
"(",
"v",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"i",
",",
"err",
")",
"\n",
"}",
"\n",
"if",
"key",
"<",
"1",
"{",
"// This is a possibility during v1 -> v3 migrations, and would fail to",
"// find a device anyway, so we just ignore these.",
"continue",
"\n",
"}",
"\n",
"device",
":=",
"l",
".",
"FindByKey",
"(",
"int32",
"(",
"key",
")",
")",
"\n",
"if",
"device",
"==",
"nil",
"{",
"// Missing device, pass",
"continue",
"\n",
"}",
"\n",
"disk",
",",
"ok",
":=",
"device",
".",
"(",
"*",
"types",
".",
"VirtualDisk",
")",
"\n",
"if",
"!",
"ok",
"{",
"// Not the device we are looking for",
"continue",
"\n",
"}",
"\n",
"backing",
",",
"ok",
":=",
"disk",
".",
"Backing",
".",
"(",
"*",
"types",
".",
"VirtualDiskFlatVer2BackingInfo",
")",
"\n",
"if",
"!",
"ok",
"{",
"// Someone has tampered with the VM to the point where we really should",
"// not mess with it. We can't account for all cases, but if someone has",
"// added something like an RDM disk or something else that is not",
"// VMDK-backed, we don't want to continue. We have never supported this.",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"l",
".",
"Name",
"(",
"disk",
")",
")",
"\n",
"}",
"\n",
"is",
".",
"Attributes",
"[",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"i",
")",
"]",
"=",
"backing",
".",
"Uuid",
"\n",
"}",
"\n\n",
"d",
":=",
"resourceVSphereVirtualMachine",
"(",
")",
".",
"Data",
"(",
"&",
"terraform",
".",
"InstanceState",
"{",
"}",
")",
"\n",
"log",
".",
"Printf",
"(",
"\"",
"\"",
",",
"resourceVSphereVirtualMachineIDString",
"(",
"d",
")",
")",
"\n",
"return",
"nil",
"\n",
"}"
] |
4,926 | all-4927 | [
"DefaultParser",
"sets",
"up",
"and",
"assigns",
"the",
"default",
"parser",
"to",
"be",
"used",
"by",
"Xslate",
"."
] | [
"func",
"DefaultParser",
"(",
"tx",
"*",
"Xslate",
",",
"args",
"Args",
")",
"error",
"{",
"syntax",
",",
"ok",
":=",
"args",
".",
"Get",
"(",
"\"",
"\"",
")",
"\n",
"if",
"!",
"ok",
"{",
"syntax",
"=",
"\"",
"\"",
"\n",
"}",
"\n\n",
"switch",
"syntax",
"{",
"case",
"\"",
"\"",
":",
"tx",
".",
"<mask>",
"=",
"tterse",
".",
"New",
"(",
")",
"\n",
"case",
"\"",
"\"",
",",
"\"",
"\"",
":",
"tx",
".",
"Parser",
"=",
"kolonish",
".",
"New",
"(",
")",
"\n",
"default",
":",
"return",
"errors",
".",
"New",
"(",
"\"",
"\"",
"+",
"syntax",
".",
"(",
"string",
")",
"+",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
] |
4,927 | all-4928 | [
"SetCustomDirectory",
"sets",
"the",
"default",
"location",
"for",
"the",
"GeoIP",
".",
"dat",
"files",
"used",
"when",
"calling",
"OpenType",
"()"
] | [
"func",
"SetCustomDirectory",
"(",
"dir",
"<mask>",
")",
"{",
"cdir",
":=",
"C",
".",
"CString",
"(",
"dir",
")",
"\n",
"// GeoIP doesn't copy the string, so don't free it when we're done here.",
"// defer C.free(unsafe.Pointer(cdir))",
"C",
".",
"GeoIP_setup_custom_directory",
"(",
"cdir",
")",
"\n",
"}"
] |
4,928 | all-4929 | [
"Wait",
"blocks",
"until",
"all",
"the",
"jobs",
"in",
"the",
"Pool",
"are",
"done",
"."
] | [
"func",
"(",
"pool",
"*",
"Pool",
")",
"Wait",
"(",
")",
"{",
"working_pipe",
":=",
"<mask>",
"(",
"chan",
"bool",
")",
"\n",
"for",
"{",
"pool",
".",
"working_wanted_pipe",
"<-",
"working_pipe",
"\n",
"if",
"!",
"<-",
"working_pipe",
"{",
"break",
"\n",
"}",
"\n",
"time",
".",
"Sleep",
"(",
"pool",
".",
"interval",
"*",
"time",
".",
"Millisecond",
")",
"\n",
"}",
"\n",
"}"
] |
4,929 | all-4930 | [
"parseGeneralizedTime",
"parses",
"the",
"GeneralizedTime",
"from",
"the",
"given",
"byte",
"slice",
"and",
"returns",
"the",
"resulting",
"time",
"."
] | [
"func",
"parseGeneralizedTime",
"(",
"<mask>",
"[",
"]",
"byte",
")",
"(",
"ret",
"time",
".",
"Time",
",",
"err",
"error",
")",
"{",
"const",
"formatStr",
"=",
"\"",
"\"",
"\n",
"s",
":=",
"string",
"(",
"bytes",
")",
"\n\n",
"if",
"ret",
",",
"err",
"=",
"time",
".",
"Parse",
"(",
"formatStr",
",",
"s",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"\n",
"}",
"\n\n",
"if",
"serialized",
":=",
"ret",
".",
"Format",
"(",
"formatStr",
")",
";",
"serialized",
"!=",
"s",
"{",
"err",
"=",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"s",
",",
"serialized",
")",
"\n",
"}",
"\n\n",
"return",
"\n",
"}"
] |
4,930 | all-4931 | [
"Body",
"renders",
"the",
"<body",
">",
"for",
"JUnit",
"tests"
] | [
"func",
"(",
"lens",
"Lens",
")",
"Body",
"(",
"artifacts",
"[",
"]",
"lenses",
".",
"Artifact",
",",
"resourceDir",
"string",
",",
"data",
"string",
")",
"string",
"{",
"type",
"testResults",
"struct",
"{",
"junit",
"[",
"]",
"junit",
".",
"Result",
"\n",
"link",
"string",
"\n",
"path",
"string",
"\n",
"err",
"error",
"\n",
"}",
"\n",
"resultChan",
":=",
"make",
"(",
"chan",
"testResults",
")",
"\n",
"for",
"_",
",",
"artifact",
":=",
"range",
"artifacts",
"{",
"go",
"func",
"(",
"artifact",
"lenses",
".",
"Artifact",
")",
"{",
"result",
":=",
"testResults",
"{",
"link",
":",
"artifact",
".",
"CanonicalLink",
"(",
")",
",",
"path",
":",
"artifact",
".",
"JobPath",
"(",
")",
",",
"}",
"\n",
"var",
"contents",
"[",
"]",
"byte",
"\n",
"contents",
",",
"result",
".",
"err",
"=",
"artifact",
".",
"ReadAll",
"(",
")",
"\n",
"if",
"result",
".",
"err",
"!=",
"nil",
"{",
"logrus",
".",
"WithError",
"(",
"result",
".",
"err",
")",
".",
"WithField",
"(",
"\"",
"\"",
",",
"artifact",
".",
"CanonicalLink",
"(",
")",
")",
".",
"Warn",
"(",
"\"",
"\"",
")",
"\n",
"resultChan",
"<-",
"result",
"\n",
"return",
"\n",
"}",
"\n",
"var",
"suites",
"junit",
".",
"Suites",
"\n",
"suites",
",",
"result",
".",
"err",
"=",
"junit",
".",
"Parse",
"(",
"contents",
")",
"\n",
"if",
"result",
".",
"err",
"!=",
"nil",
"{",
"logrus",
".",
"WithError",
"(",
"result",
".",
"err",
")",
".",
"WithField",
"(",
"\"",
"\"",
",",
"artifact",
".",
"CanonicalLink",
"(",
")",
")",
".",
"Info",
"(",
"\"",
"\"",
")",
"\n",
"resultChan",
"<-",
"result",
"\n",
"return",
"\n",
"}",
"\n",
"for",
"_",
",",
"suite",
":=",
"range",
"suites",
".",
"Suites",
"{",
"for",
"_",
",",
"test",
":=",
"range",
"suite",
".",
"Results",
"{",
"result",
".",
"junit",
"=",
"append",
"(",
"result",
".",
"junit",
",",
"test",
")",
"\n",
"}",
"\n",
"}",
"\n",
"resultChan",
"<-",
"result",
"\n",
"}",
"(",
"artifact",
")",
"\n",
"}",
"\n",
"results",
":=",
"make",
"(",
"[",
"]",
"testResults",
",",
"0",
",",
"len",
"(",
"artifacts",
")",
")",
"\n",
"for",
"range",
"artifacts",
"{",
"results",
"=",
"append",
"(",
"results",
",",
"<-",
"resultChan",
")",
"\n",
"}",
"\n",
"sort",
".",
"Slice",
"(",
"results",
",",
"func",
"(",
"i",
",",
"j",
"int",
")",
"bool",
"{",
"return",
"results",
"[",
"i",
"]",
".",
"path",
"<",
"results",
"[",
"j",
"]",
".",
"path",
"}",
")",
"\n\n",
"jvd",
":=",
"struct",
"{",
"NumTests",
"int",
"\n",
"Passed",
"[",
"]",
"TestResult",
"\n",
"Failed",
"[",
"]",
"TestResult",
"\n",
"Skipped",
"[",
"]",
"TestResult",
"\n",
"}",
"{",
"}",
"\n",
"for",
"_",
",",
"result",
":=",
"range",
"results",
"{",
"if",
"result",
".",
"err",
"!=",
"nil",
"{",
"continue",
"\n",
"}",
"\n",
"for",
"_",
",",
"<mask>",
":=",
"range",
"result",
".",
"junit",
"{",
"if",
"test",
".",
"Failure",
"!=",
"nil",
"{",
"jvd",
".",
"Failed",
"=",
"append",
"(",
"jvd",
".",
"Failed",
",",
"TestResult",
"{",
"Junit",
":",
"JunitResult",
"{",
"test",
"}",
",",
"Link",
":",
"result",
".",
"link",
",",
"}",
")",
"\n",
"}",
"else",
"if",
"test",
".",
"Skipped",
"!=",
"nil",
"{",
"jvd",
".",
"Skipped",
"=",
"append",
"(",
"jvd",
".",
"Skipped",
",",
"TestResult",
"{",
"Junit",
":",
"JunitResult",
"{",
"test",
"}",
",",
"Link",
":",
"result",
".",
"link",
",",
"}",
")",
"\n",
"}",
"else",
"{",
"jvd",
".",
"Passed",
"=",
"append",
"(",
"jvd",
".",
"Passed",
",",
"TestResult",
"{",
"Junit",
":",
"JunitResult",
"{",
"test",
"}",
",",
"Link",
":",
"result",
".",
"link",
",",
"}",
")",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n\n",
"jvd",
".",
"NumTests",
"=",
"len",
"(",
"jvd",
".",
"Passed",
")",
"+",
"len",
"(",
"jvd",
".",
"Failed",
")",
"+",
"len",
"(",
"jvd",
".",
"Skipped",
")",
"\n\n",
"junitTemplate",
",",
"err",
":=",
"template",
".",
"ParseFiles",
"(",
"filepath",
".",
"Join",
"(",
"resourceDir",
",",
"\"",
"\"",
")",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"logrus",
".",
"WithError",
"(",
"err",
")",
".",
"Error",
"(",
"\"",
"\"",
")",
"\n",
"return",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"}",
"\n\n",
"var",
"buf",
"bytes",
".",
"Buffer",
"\n",
"if",
"err",
":=",
"junitTemplate",
".",
"ExecuteTemplate",
"(",
"&",
"buf",
",",
"\"",
"\"",
",",
"jvd",
")",
";",
"err",
"!=",
"nil",
"{",
"logrus",
".",
"WithError",
"(",
"err",
")",
".",
"Error",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"return",
"buf",
".",
"String",
"(",
")",
"\n",
"}"
] |
4,931 | all-4932 | [
"New",
"-",
"Creates",
"a",
"new",
"table",
"."
] | [
"func",
"New",
"(",
"<mask>",
"[",
"]",
"string",
")",
"*",
"Table",
"{",
"return",
"&",
"Table",
"{",
"Fields",
":",
"fields",
",",
"Rows",
":",
"make",
"(",
"[",
"]",
"map",
"[",
"string",
"]",
"string",
",",
"0",
")",
",",
"fieldSizes",
":",
"make",
"(",
"map",
"[",
"string",
"]",
"int",
")",
",",
"}",
"\n",
"}"
] |
4,932 | all-4933 | [
"GetTitle",
"returns",
"the",
"Title",
"field",
"if",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"."
] | [
"func",
"(",
"h",
"*",
"HeatmapDefinition",
")",
"GetTitle",
"(",
")",
"string",
"{",
"if",
"h",
"==",
"nil",
"||",
"h",
".",
"Title",
"==",
"nil",
"{",
"<mask>",
"\"",
"\"",
"\n",
"}",
"\n",
"return",
"*",
"h",
".",
"Title",
"\n",
"}"
] |
4,933 | all-4934 | [
"UnmarshalYAML",
"implements",
"the",
"yaml",
".",
"Unmarshaler",
"interface",
"."
] | [
"func",
"(",
"c",
"*",
"SDConfig",
")",
"UnmarshalYAML",
"(",
"unmarshal",
"func",
"(",
"interface",
"{",
"}",
")",
"error",
")",
"error",
"{",
"*",
"c",
"=",
"DefaultSDConfig",
"\n",
"type",
"plain",
"SDConfig",
"\n",
"err",
":=",
"unmarshal",
"(",
"(",
"*",
"<mask>",
")",
"(",
"c",
")",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"if",
"c",
".",
"Role",
"==",
"\"",
"\"",
"{",
"return",
"errors",
".",
"New",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"if",
"c",
".",
"Region",
"==",
"\"",
"\"",
"{",
"return",
"errors",
".",
"New",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
] |
4,934 | all-4935 | [
"ResolveStorePath",
"returns",
"the",
"store",
"path",
"where",
"the",
"machine",
"is"
] | [
"func",
"(",
"d",
"*",
"BaseDriver",
")",
"ResolveStorePath",
"(",
"<mask>",
"string",
")",
"string",
"{",
"return",
"filepath",
".",
"Join",
"(",
"d",
".",
"StorePath",
",",
"\"",
"\"",
",",
"d",
".",
"MachineName",
",",
"file",
")",
"\n",
"}"
] |
4,935 | all-4936 | [
"Start",
"the",
"WALWatcher",
"."
] | [
"func",
"(",
"w",
"*",
"WALWatcher",
")",
"Start",
"(",
")",
"{",
"w",
".",
"setMetrics",
"(",
")",
"\n",
"level",
".",
"Info",
"(",
"w",
".",
"logger",
")",
".",
"Log",
"(",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"w",
".",
"name",
")",
"\n\n",
"go",
"w",
".",
"<mask>",
"(",
")",
"\n",
"}"
] |
4,936 | all-4937 | [
"GetExchangeRate",
"gets",
"the",
"exchange",
"rate",
"between",
"two",
"specified",
"currencies"
] | [
"func",
"(",
"c",
"Client",
")",
"GetExchangeRate",
"(",
"from",
"string",
",",
"to",
"string",
")",
"(",
"float64",
",",
"error",
")",
"{",
"exchanges",
",",
"err",
":=",
"c",
".",
"GetExchangeRates",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"0.0",
",",
"err",
"\n",
"}",
"\n",
"key",
":=",
"from",
"+",
"\"",
"\"",
"+",
"to",
"\n",
"if",
"exchanges",
"[",
"key",
"]",
"==",
"\"",
"\"",
"{",
"return",
"0.0",
",",
"<mask>",
".",
"New",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"exchangeFloat",
",",
"err",
":=",
"strconv",
".",
"ParseFloat",
"(",
"exchanges",
"[",
"key",
"]",
",",
"64",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"0.0",
",",
"err",
"\n",
"}",
"\n",
"return",
"exchangeFloat",
",",
"nil",
"\n",
"}"
] |
4,937 | all-4938 | [
"MachineProviderConfigs",
"will",
"return",
"all",
"MachineProviderConfigs",
"for",
"a",
"cluster"
] | [
"func",
"(",
"c",
"*",
"Cluster",
")",
"MachineProviderConfigs",
"(",
")",
"[",
"]",
"*",
"MachineProviderConfig",
"{",
"var",
"providerConfigs",
"[",
"]",
"*",
"MachineProviderConfig",
"\n",
"for",
"_",
",",
"machineSet",
":=",
"range",
"c",
".",
"MachineSets",
"{",
"raw",
":=",
"machineSet",
".",
"Spec",
".",
"Template",
".",
"Spec",
".",
"ProviderConfig",
"\n",
"providerConfig",
":=",
"&",
"MachineProviderConfig",
"{",
"}",
"\n",
"err",
":=",
"json",
".",
"Unmarshal",
"(",
"[",
"]",
"byte",
"(",
"raw",
")",
",",
"providerConfig",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"logger",
".",
"Critical",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"}",
"\n",
"providerConfigs",
"=",
"<mask>",
"(",
"providerConfigs",
",",
"providerConfig",
")",
"\n",
"}",
"\n",
"return",
"providerConfigs",
"\n",
"}"
] |
4,938 | all-4939 | [
"HasValidTLD",
"checks",
"that",
"a",
"domain",
"ends",
"in",
"a",
"valid",
"TLD",
"that",
"was",
"delegated",
"in",
"the",
"root",
"DNS",
"at",
"the",
"time",
"specified",
"."
] | [
"func",
"HasValidTLD",
"(",
"domain",
"string",
",",
"when",
"<mask>",
".",
"Time",
")",
"bool",
"{",
"labels",
":=",
"strings",
".",
"Split",
"(",
"strings",
".",
"ToLower",
"(",
"domain",
")",
",",
"\"",
"\"",
")",
"\n",
"rightLabel",
":=",
"labels",
"[",
"len",
"(",
"labels",
")",
"-",
"1",
"]",
"\n",
"// if the rightmost label is not present in the tldMap, it isn't valid and",
"// never was.",
"if",
"tldPeriod",
",",
"present",
":=",
"tldMap",
"[",
"rightLabel",
"]",
";",
"!",
"present",
"{",
"return",
"false",
"\n",
"}",
"else",
"if",
"tldPeriod",
".",
"Valid",
"(",
"when",
")",
"!=",
"nil",
"{",
"// If the TLD exists but the date is outside of the gTLD's validity period",
"// then it is not a valid TLD.",
"return",
"false",
"\n",
"}",
"\n",
"// Otherwise the TLD exists, and was a valid TLD delegated in the root DNS",
"// at the time of the given date.",
"return",
"true",
"\n",
"}"
] |
4,939 | all-4940 | [
"GetQueryStringOk",
"returns",
"a",
"tuple",
"with",
"the",
"QueryString",
"field",
"if",
"it",
"s",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"and",
"a",
"boolean",
"to",
"check",
"if",
"the",
"value",
"has",
"been",
"set",
"."
] | [
"func",
"(",
"q",
"*",
"QueryConfig",
")",
"GetQueryStringOk",
"(",
")",
"(",
"string",
",",
"bool",
")",
"{",
"if",
"q",
"==",
"nil",
"||",
"q",
".",
"QueryString",
"==",
"nil",
"{",
"return",
"\"",
"\"",
",",
"false",
"\n",
"}",
"\n",
"return",
"*",
"q",
".",
"QueryString",
",",
"<mask>",
"\n",
"}"
] |
4,940 | all-4941 | [
"Scan",
"implements",
"the",
"database",
"/",
"sql",
"/",
"Scanner",
"interface",
"."
] | [
"func",
"(",
"l",
"*",
"Lob",
")",
"Scan",
"(",
"src",
"interface",
"{",
"}",
")",
"error",
"{",
"if",
"l",
".",
"wr",
"==",
"nil",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"l",
")",
"\n",
"}",
"\n\n",
"ws",
",",
"ok",
":=",
"src",
".",
"(",
"writerSetter",
")",
"\n",
"if",
"!",
"ok",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"src",
")",
"\n",
"}",
"\n\n",
"if",
"err",
":=",
"<mask>",
".",
"SetWriter",
"(",
"l",
".",
"wr",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
] |
4,941 | all-4942 | [
"serviceFunc",
"returns",
"or",
"accumulates",
"health",
"service",
"dependencies",
"."
] | [
"func",
"serviceFunc",
"(",
"b",
"*",
"Brain",
",",
"used",
",",
"missing",
"*",
"dep",
".",
"Set",
")",
"func",
"(",
"...",
"string",
")",
"(",
"[",
"]",
"*",
"dep",
".",
"HealthService",
",",
"error",
")",
"{",
"return",
"func",
"(",
"s",
"...",
"string",
")",
"(",
"[",
"]",
"*",
"dep",
".",
"HealthService",
",",
"error",
")",
"{",
"result",
":=",
"[",
"]",
"*",
"dep",
".",
"HealthService",
"{",
"}",
"\n\n",
"if",
"len",
"(",
"s",
")",
"==",
"0",
"||",
"s",
"[",
"0",
"]",
"==",
"\"",
"\"",
"{",
"return",
"result",
",",
"nil",
"\n",
"}",
"\n\n",
"d",
",",
"err",
":=",
"dep",
".",
"NewHealthServiceQuery",
"(",
"strings",
".",
"Join",
"(",
"s",
",",
"\"",
"\"",
")",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"used",
".",
"Add",
"(",
"d",
")",
"\n\n",
"if",
"value",
",",
"ok",
":=",
"b",
".",
"Recall",
"(",
"d",
")",
";",
"ok",
"{",
"return",
"value",
".",
"(",
"[",
"]",
"*",
"dep",
".",
"HealthService",
")",
",",
"nil",
"\n",
"}",
"\n\n",
"<mask>",
".",
"Add",
"(",
"d",
")",
"\n\n",
"return",
"result",
",",
"nil",
"\n",
"}",
"\n",
"}"
] |
4,942 | all-4943 | [
"Debug",
"logs",
"msg",
"to",
"all",
"added",
"loggers",
"at",
"LogLevel",
".",
"LevelDebug"
] | [
"func",
"(",
"la",
"*",
"LogAdapter",
")",
"Debug",
"(",
"msg",
"string",
")",
"error",
"{",
"return",
"la",
".",
"<mask>",
"(",
"LevelDebug",
",",
"nil",
",",
"msg",
")",
"\n",
"}"
] |
4,943 | all-4944 | [
"PrintRepoHeader",
"prints",
"a",
"repo",
"header",
"."
] | [
"func",
"PrintRepoHeader",
"(",
"w",
"<mask>",
".",
"Writer",
",",
"printAuth",
"bool",
")",
"{",
"if",
"printAuth",
"{",
"fmt",
".",
"Fprint",
"(",
"w",
",",
"RepoAuthHeader",
")",
"\n",
"return",
"\n",
"}",
"\n",
"fmt",
".",
"Fprint",
"(",
"w",
",",
"RepoHeader",
")",
"\n",
"}"
] |
4,944 | all-4945 | [
"StartDatastore",
"starts",
"a",
"datastore",
"segment",
"."
] | [
"func",
"(",
"t",
"*",
"tx",
")",
"StartDatastore",
"(",
"table",
",",
"operation",
",",
"sql",
",",
"rollupName",
"string",
")",
"error",
"{",
"t",
".",
"mtx",
".",
"Lock",
"(",
")",
"\n",
"defer",
"t",
".",
"mtx",
".",
"Unlock",
"(",
")",
"\n\n",
"id",
",",
"err",
":=",
"t",
".",
"Tracer",
".",
"BeginDatastoreSegment",
"(",
"t",
".",
"id",
",",
"t",
".",
"ss",
".",
"Peek",
"(",
")",
",",
"table",
",",
"<mask>",
",",
"sql",
",",
"rollupName",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"t",
".",
"ss",
".",
"Push",
"(",
"id",
")",
"\n",
"return",
"nil",
"\n",
"}"
] |
4,945 | all-4946 | [
"Determines",
"if",
"a",
"name",
"corresponds",
"to",
"a",
"shader",
"object"
] | [
"func",
"IsShader",
"(",
"shader",
"uint32",
")",
"bool",
"{",
"ret",
":=",
"C",
".",
"glowIsShader",
"(",
"gpIsShader",
",",
"(",
"C",
".",
"GLuint",
")",
"(",
"shader",
")",
")",
"\n",
"return",
"<mask>",
"==",
"TRUE",
"\n",
"}"
] |
4,946 | all-4947 | [
"HasMethod",
"returns",
"a",
"boolean",
"if",
"a",
"field",
"has",
"been",
"set",
"."
] | [
"func",
"(",
"s",
"*",
"SyntheticsRequest",
")",
"HasMethod",
"(",
")",
"bool",
"{",
"if",
"s",
"!=",
"nil",
"&&",
"s",
".",
"Method",
"!=",
"nil",
"{",
"return",
"<mask>",
"\n",
"}",
"\n\n",
"return",
"false",
"\n",
"}"
] |
4,947 | all-4948 | [
"GetTagTable",
"()",
"is",
"a",
"wrapper",
"around",
"gtk_text_buffer_get_tag_table",
"()",
"."
] | [
"func",
"(",
"v",
"*",
"TextBuffer",
")",
"GetTagTable",
"(",
")",
"(",
"*",
"TextTagTable",
",",
"<mask>",
")",
"{",
"c",
":=",
"C",
".",
"gtk_text_buffer_get_tag_table",
"(",
"v",
".",
"native",
"(",
")",
")",
"\n",
"if",
"c",
"==",
"nil",
"{",
"return",
"nil",
",",
"nilPtrErr",
"\n",
"}",
"\n",
"obj",
":=",
"glib",
".",
"Take",
"(",
"unsafe",
".",
"Pointer",
"(",
"c",
")",
")",
"\n",
"return",
"wrapTextTagTable",
"(",
"obj",
")",
",",
"nil",
"\n",
"}"
] |
4,948 | all-4949 | [
"Proxy",
"is",
"a",
"proxy",
"between",
"tsuru",
"and",
"the",
"service",
".",
"This",
"method",
"allow",
"customized",
"service",
"methods",
"."
] | [
"func",
"Proxy",
"(",
"service",
"*",
"Service",
",",
"path",
"string",
",",
"evt",
"*",
"event",
".",
"<mask>",
",",
"requestID",
"string",
",",
"w",
"http",
".",
"ResponseWriter",
",",
"r",
"*",
"http",
".",
"Request",
")",
"error",
"{",
"endpoint",
",",
"err",
":=",
"service",
".",
"getClient",
"(",
"\"",
"\"",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"return",
"endpoint",
".",
"Proxy",
"(",
"path",
",",
"evt",
",",
"requestID",
",",
"w",
",",
"r",
")",
"\n",
"}"
] |
4,949 | all-4950 | [
"GetCreator",
"returns",
"the",
"Creator",
"field",
"if",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"."
] | [
"func",
"(",
"a",
"*",
"Alert",
")",
"GetCreator",
"(",
")",
"int",
"{",
"if",
"a",
"==",
"nil",
"||",
"a",
".",
"Creator",
"==",
"nil",
"{",
"return",
"0",
"\n",
"}",
"\n",
"<mask>",
"*",
"a",
".",
"Creator",
"\n",
"}"
] |
4,950 | all-4951 | [
"HomeDir",
"returns",
"the",
"home",
"directory",
"of",
"the",
"user",
"that",
"owns",
"the",
"current",
"process",
"."
] | [
"func",
"HomeDir",
"(",
")",
"string",
"{",
"if",
"homeDirSet",
"{",
"return",
"homeDir",
"\n",
"}",
"\n",
"if",
"user",
",",
"err",
":=",
"user",
".",
"Current",
"(",
")",
";",
"err",
"==",
"nil",
"{",
"homeDir",
"=",
"user",
".",
"HomeDir",
"\n",
"}",
"\n",
"homeDirSet",
"=",
"<mask>",
"\n",
"return",
"homeDir",
"\n",
"}"
] |
4,951 | all-4952 | [
"ContainsVMType",
"-"
] | [
"func",
"(",
"s",
"*",
"CloudConfigManifest",
")",
"ContainsVMType",
"(",
"vmTypeName",
"string",
")",
"(",
"result",
"bool",
")",
"{",
"<mask>",
"=",
"false",
"\n",
"for",
"_",
",",
"vmType",
":=",
"range",
"s",
".",
"VMTypes",
"{",
"if",
"vmType",
".",
"Name",
"==",
"vmTypeName",
"{",
"result",
"=",
"true",
"\n",
"return",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"\n",
"}"
] |
4,952 | all-4953 | [
"Helper",
"functions"
] | [
"func",
"lxcSetConfigItem",
"(",
"c",
"*",
"lxc",
".",
"Container",
",",
"key",
"string",
",",
"value",
"string",
")",
"error",
"{",
"if",
"c",
"==",
"nil",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"if",
"!",
"util",
".",
"RuntimeLiblxcVersionAtLeast",
"(",
"2",
",",
"1",
",",
"0",
")",
"{",
"switch",
"key",
"{",
"case",
"\"",
"\"",
":",
"key",
"=",
"\"",
"\"",
"\n",
"<mask>",
"\"",
"\"",
":",
"key",
"=",
"\"",
"\"",
"\n",
"case",
"\"",
"\"",
":",
"key",
"=",
"\"",
"\"",
"\n",
"case",
"\"",
"\"",
":",
"key",
"=",
"\"",
"\"",
"\n",
"case",
"\"",
"\"",
":",
"key",
"=",
"\"",
"\"",
"\n",
"case",
"\"",
"\"",
":",
"key",
"=",
"\"",
"\"",
"\n",
"case",
"\"",
"\"",
":",
"key",
"=",
"\"",
"\"",
"\n",
"case",
"\"",
"\"",
":",
"key",
"=",
"\"",
"\"",
"\n",
"case",
"\"",
"\"",
":",
"key",
"=",
"\"",
"\"",
"\n",
"case",
"\"",
"\"",
":",
"key",
"=",
"\"",
"\"",
"\n",
"case",
"\"",
"\"",
":",
"key",
"=",
"\"",
"\"",
"\n",
"case",
"\"",
"\"",
":",
"key",
"=",
"\"",
"\"",
"\n",
"case",
"\"",
"\"",
":",
"key",
"=",
"\"",
"\"",
"\n",
"case",
"\"",
"\"",
":",
"key",
"=",
"\"",
"\"",
"\n",
"case",
"\"",
"\"",
":",
"key",
"=",
"\"",
"\"",
"\n",
"case",
"\"",
"\"",
":",
"key",
"=",
"\"",
"\"",
"\n",
"case",
"\"",
"\"",
":",
"key",
"=",
"\"",
"\"",
"\n",
"case",
"\"",
"\"",
":",
"key",
"=",
"\"",
"\"",
"\n",
"case",
"\"",
"\"",
":",
"key",
"=",
"\"",
"\"",
"\n",
"case",
"\"",
"\"",
":",
"key",
"=",
"\"",
"\"",
"\n",
"}",
"\n",
"}",
"\n\n",
"if",
"strings",
".",
"HasPrefix",
"(",
"key",
",",
"\"",
"\"",
")",
"{",
"if",
"!",
"util",
".",
"RuntimeLiblxcVersionAtLeast",
"(",
"2",
",",
"1",
",",
"0",
")",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"`Process limits require liblxc >= 2.1`",
")",
"\n",
"}",
"\n",
"}",
"\n\n",
"err",
":=",
"c",
".",
"SetConfigItem",
"(",
"key",
",",
"value",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"key",
",",
"value",
")",
"\n",
"}",
"\n\n",
"return",
"nil",
"\n",
"}"
] |
4,953 | all-4954 | [
"Flags",
"returns",
"etcd",
"flags",
"in",
"string",
"slice",
"."
] | [
"func",
"(",
"e",
"*",
"Etcd",
")",
"Flags",
"(",
")",
"(",
"fs",
"[",
"]",
"string",
")",
"{",
"tp",
":=",
"reflect",
".",
"TypeOf",
"(",
"*",
"e",
")",
"\n",
"vo",
":=",
"reflect",
".",
"ValueOf",
"(",
"*",
"e",
")",
"\n",
"for",
"_",
",",
"name",
":=",
"range",
"etcdFields",
"{",
"field",
",",
"ok",
":=",
"tp",
".",
"FieldByName",
"(",
"name",
")",
"\n",
"if",
"!",
"ok",
"{",
"panic",
"(",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"name",
")",
")",
"\n",
"}",
"\n",
"fv",
":=",
"reflect",
".",
"Indirect",
"(",
"vo",
")",
".",
"FieldByName",
"(",
"name",
")",
"\n",
"var",
"sv",
"string",
"\n",
"switch",
"fv",
".",
"Type",
"(",
")",
".",
"Kind",
"(",
")",
"{",
"case",
"reflect",
".",
"String",
":",
"sv",
"=",
"fv",
".",
"String",
"(",
")",
"\n",
"case",
"reflect",
".",
"Slice",
":",
"n",
":=",
"fv",
".",
"Len",
"(",
")",
"\n",
"sl",
":=",
"make",
"(",
"[",
"]",
"string",
",",
"n",
")",
"\n",
"for",
"i",
":=",
"0",
";",
"i",
"<",
"n",
";",
"i",
"++",
"{",
"sl",
"[",
"i",
"]",
"=",
"fv",
".",
"Index",
"(",
"i",
")",
".",
"String",
"(",
")",
"\n",
"}",
"\n",
"sv",
"=",
"strings",
".",
"Join",
"(",
"sl",
",",
"\"",
"\"",
")",
"\n",
"<mask>",
"reflect",
".",
"Int64",
":",
"sv",
"=",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"fv",
".",
"Int",
"(",
")",
")",
"\n",
"case",
"reflect",
".",
"Bool",
":",
"sv",
"=",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"fv",
".",
"Bool",
"(",
")",
")",
"\n",
"default",
":",
"panic",
"(",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"name",
",",
"fv",
".",
"Type",
"(",
")",
".",
"Kind",
"(",
")",
")",
")",
"\n",
"}",
"\n\n",
"fname",
":=",
"field",
".",
"Tag",
".",
"Get",
"(",
"\"",
"\"",
")",
"\n\n",
"// TODO: remove this",
"if",
"fname",
"==",
"\"",
"\"",
"{",
"fname",
"=",
"\"",
"\"",
"+",
"fname",
"\n",
"}",
"\n\n",
"if",
"sv",
"!=",
"\"",
"\"",
"{",
"fs",
"=",
"append",
"(",
"fs",
",",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"fname",
",",
"sv",
")",
")",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"fs",
"\n",
"}"
] |
4,954 | all-4955 | [
"Flush",
"performs",
"a",
"manual",
"flush",
"to",
"all",
"subscribed",
"reporters",
".",
"This",
"method",
"is",
"usually",
"called",
"by",
"a",
"background",
"thread",
"every",
"flushInterval",
"specified",
"in",
"New",
"()"
] | [
"func",
"(",
"r",
"*",
"Registry",
")",
"Flush",
"(",
")",
"error",
"{",
"r",
".",
"mutex",
".",
"RLock",
"(",
")",
"\n",
"reporters",
":=",
"r",
".",
"reporters",
"\n",
"rtags",
":=",
"r",
".",
"tags",
"\n",
"r",
".",
"mutex",
".",
"RUnlock",
"(",
")",
"\n\n",
"for",
"_",
",",
"rep",
":=",
"range",
"reporters",
"{",
"if",
"err",
":=",
"rep",
".",
"Prep",
"(",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"}",
"\n\n",
"for",
"metricID",
",",
"val",
":=",
"range",
"r",
".",
"reset",
"(",
")",
"{",
"name",
",",
"tags",
":=",
"SplitMetricID",
"(",
"metricID",
")",
"\n",
"if",
"len",
"(",
"name",
")",
">",
"0",
"&&",
"name",
"[",
"0",
"]",
"==",
"'|'",
"{",
"name",
"=",
"name",
"[",
"1",
":",
"]",
"\n",
"}",
"else",
"{",
"name",
"=",
"r",
".",
"prefix",
"+",
"name",
"\n",
"}",
"\n",
"tags",
"=",
"append",
"(",
"tags",
",",
"rtags",
"...",
")",
"\n\n",
"switch",
"inst",
":=",
"val",
".",
"(",
"type",
")",
"{",
"case",
"Discrete",
":",
"val",
":=",
"inst",
".",
"Snapshot",
"(",
")",
"\n",
"for",
"_",
",",
"rep",
":=",
"range",
"reporters",
"{",
"if",
"err",
":=",
"rep",
".",
"Discrete",
"(",
"name",
",",
"tags",
",",
"val",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"}",
"\n",
"case",
"Sample",
":",
"val",
":=",
"inst",
".",
"Snapshot",
"(",
")",
"\n",
"for",
"_",
",",
"rep",
":=",
"range",
"reporters",
"{",
"if",
"err",
":=",
"rep",
".",
"Sample",
"(",
"name",
",",
"tags",
",",
"val",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"}",
"\n",
"releaseDistribution",
"(",
"val",
")",
"\n",
"}",
"\n",
"}",
"\n\n",
"for",
"_",
",",
"rep",
":=",
"<mask>",
"reporters",
"{",
"if",
"err",
":=",
"rep",
".",
"Flush",
"(",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
] |
4,955 | all-4956 | [
"Returns",
"the",
"record",
"ID",
"for",
"a",
"given",
"record",
"name",
"and",
"zone"
] | [
"func",
"(",
"p",
"*",
"dnsimpleProvider",
")",
"GetRecordID",
"(",
"zone",
"string",
",",
"recordName",
"string",
")",
"(",
"recordID",
"int",
",",
"err",
"error",
")",
"{",
"page",
":=",
"1",
"\n",
"listOptions",
":=",
"&",
"dnsimple",
".",
"ZoneRecordListOptions",
"{",
"Name",
":",
"recordName",
"}",
"\n",
"for",
"{",
"listOptions",
".",
"Page",
"=",
"page",
"\n",
"records",
",",
"err",
":=",
"p",
".",
"client",
".",
"ListRecords",
"(",
"p",
".",
"accountID",
",",
"zone",
",",
"listOptions",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"0",
",",
"err",
"\n",
"}",
"\n\n",
"for",
"_",
",",
"record",
":=",
"range",
"records",
".",
"Data",
"{",
"if",
"record",
".",
"Name",
"==",
"recordName",
"{",
"return",
"record",
".",
"<mask>",
",",
"nil",
"\n",
"}",
"\n",
"}",
"\n\n",
"page",
"++",
"\n",
"if",
"page",
">",
"records",
".",
"Pagination",
".",
"TotalPages",
"{",
"break",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"0",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
")",
"\n",
"}"
] |
4,956 | all-4957 | [
"MarshalJSON",
"supports",
"json",
".",
"Marshaler",
"interface"
] | [
"func",
"(",
"v",
"SetShowFPSCounterParams",
")",
"MarshalJSON",
"(",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"w",
":=",
"jwriter",
".",
"Writer",
"{",
"}",
"\n",
"easyjsonC5a4559bEncodeGithubComChromedpCdprotoOverlay4",
"(",
"&",
"w",
",",
"v",
")",
"\n",
"return",
"w",
".",
"Buffer",
".",
"BuildBytes",
"(",
")",
",",
"w",
".",
"<mask>",
"\n",
"}"
] |
4,957 | all-4958 | [
"RevokeScreenboard",
"revokes",
"a",
"currently",
"shared",
"screenboard"
] | [
"func",
"(",
"client",
"*",
"Client",
")",
"RevokeScreenboard",
"(",
"id",
"int",
")",
"error",
"{",
"return",
"<mask>",
".",
"doJsonRequest",
"(",
"\"",
"\"",
",",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"id",
")",
",",
"nil",
",",
"nil",
")",
"\n",
"}"
] |
4,958 | all-4959 | [
"String",
"formats",
"a",
"config",
"map",
"into",
"the",
"key",
"=",
"val",
"key",
"=",
"val",
"...",
"understood",
"by",
"Parse",
".",
"The",
"order",
"of",
"the",
"keys",
"is",
"stable",
"."
] | [
"func",
"(",
"c",
"Config",
")",
"String",
"(",
")",
"string",
"{",
"// sort 'provider' to the front and keep the keys stable.",
"var",
"keys",
"[",
"]",
"string",
"\n",
"for",
"k",
":=",
"range",
"c",
"{",
"if",
"k",
"!=",
"\"",
"\"",
"{",
"keys",
"=",
"append",
"(",
"keys",
",",
"k",
")",
"\n",
"}",
"\n",
"}",
"\n",
"sort",
".",
"Strings",
"(",
"keys",
")",
"\n",
"keys",
"=",
"<mask>",
"(",
"[",
"]",
"string",
"{",
"\"",
"\"",
"}",
",",
"keys",
"...",
")",
"\n\n",
"quote",
":=",
"func",
"(",
"s",
"string",
")",
"string",
"{",
"if",
"strings",
".",
"ContainsAny",
"(",
"s",
",",
"` \"\\`",
")",
"{",
"return",
"strconv",
".",
"Quote",
"(",
"s",
")",
"\n",
"}",
"\n",
"return",
"s",
"\n",
"}",
"\n\n",
"var",
"vals",
"[",
"]",
"string",
"\n",
"for",
"_",
",",
"k",
":=",
"range",
"keys",
"{",
"v",
":=",
"c",
"[",
"k",
"]",
"\n",
"if",
"v",
"==",
"\"",
"\"",
"{",
"continue",
"\n",
"}",
"\n",
"vals",
"=",
"append",
"(",
"vals",
",",
"quote",
"(",
"k",
")",
"+",
"\"",
"\"",
"+",
"quote",
"(",
"v",
")",
")",
"\n",
"}",
"\n",
"return",
"strings",
".",
"Join",
"(",
"vals",
",",
"\"",
"\"",
")",
"\n",
"}"
] |
4,959 | all-4960 | [
"findPKIndex",
"returns",
"the",
"nested",
"field",
"corresponding",
"to",
"the",
"index",
"sequence",
"of",
"field",
"of",
"primary",
"key",
"."
] | [
"func",
"(",
"db",
"*",
"DB",
")",
"findPKIndex",
"(",
"typ",
"reflect",
".",
"Type",
",",
"index",
"[",
"]",
"int",
")",
"[",
"]",
"int",
"{",
"for",
"i",
":=",
"0",
";",
"i",
"<",
"typ",
".",
"NumField",
"(",
")",
";",
"i",
"++",
"{",
"field",
":=",
"typ",
".",
"Field",
"(",
"i",
")",
"\n",
"if",
"IsUnexportedField",
"(",
"field",
")",
"{",
"continue",
"\n",
"}",
"\n",
"if",
"field",
".",
"Anonymous",
"{",
"if",
"idx",
":=",
"db",
".",
"findPKIndex",
"(",
"field",
".",
"Type",
",",
"append",
"(",
"index",
",",
"i",
")",
")",
";",
"idx",
"!=",
"nil",
"{",
"return",
"append",
"(",
"index",
",",
"idx",
"...",
")",
"\n",
"}",
"\n",
"continue",
"\n",
"}",
"\n",
"if",
"db",
".",
"hasPKTag",
"(",
"&",
"<mask>",
")",
"{",
"return",
"append",
"(",
"index",
",",
"i",
")",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
] |
4,960 | all-4961 | [
"Get",
"returns",
"the",
"Location",
"information",
"for",
"the",
"incoming",
"http",
".",
"Request",
"from",
"the",
"context",
".",
"If",
"the",
"location",
"is",
"not",
"set",
"a",
"nil",
"value",
"is",
"returned",
"."
] | [
"func",
"Get",
"(",
"c",
"*",
"gin",
".",
"Context",
")",
"*",
"url",
".",
"URL",
"{",
"v",
",",
"ok",
":=",
"c",
".",
"Get",
"(",
"key",
")",
"\n\n",
"if",
"!",
"ok",
"{",
"return",
"nil",
"\n",
"}",
"\n\n",
"vv",
",",
"ok",
":=",
"v",
".",
"(",
"*",
"<mask>",
".",
"URL",
")",
"\n\n",
"if",
"!",
"ok",
"{",
"return",
"nil",
"\n",
"}",
"\n\n",
"return",
"vv",
"\n",
"}"
] |
4,961 | all-4962 | [
"FindByLabel",
"finds",
"exactly",
"one",
"element",
"by",
"associated",
"label",
"text",
"."
] | [
"func",
"(",
"s",
"*",
"selectable",
")",
"FindByLabel",
"(",
"<mask>",
"string",
")",
"*",
"Selection",
"{",
"return",
"newSelection",
"(",
"s",
".",
"session",
",",
"s",
".",
"selectors",
".",
"Append",
"(",
"target",
".",
"Label",
",",
"text",
")",
".",
"Single",
"(",
")",
")",
"\n",
"}"
] |
4,962 | all-4963 | [
"FetchMetricCluster",
"retrieves",
"metric",
"cluster",
"with",
"passed",
"cid",
"."
] | [
"func",
"(",
"a",
"*",
"API",
")",
"FetchMetricCluster",
"(",
"cid",
"CIDType",
",",
"extras",
"string",
")",
"(",
"*",
"MetricCluster",
",",
"error",
")",
"{",
"if",
"cid",
"==",
"nil",
"||",
"*",
"cid",
"==",
"\"",
"\"",
"{",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"clusterCID",
":=",
"string",
"(",
"*",
"cid",
")",
"\n\n",
"matched",
",",
"err",
":=",
"regexp",
".",
"MatchString",
"(",
"config",
".",
"MetricClusterCIDRegex",
",",
"clusterCID",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"if",
"!",
"matched",
"{",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"clusterCID",
")",
"\n",
"}",
"\n\n",
"reqURL",
":=",
"url",
".",
"URL",
"{",
"Path",
":",
"clusterCID",
",",
"}",
"\n\n",
"extra",
":=",
"\"",
"\"",
"\n",
"switch",
"extras",
"{",
"<mask>",
"\"",
"\"",
":",
"extra",
"=",
"\"",
"\"",
"\n",
"case",
"\"",
"\"",
":",
"extra",
"=",
"\"",
"\"",
"\n",
"}",
"\n\n",
"if",
"extra",
"!=",
"\"",
"\"",
"{",
"q",
":=",
"url",
".",
"Values",
"{",
"}",
"\n",
"q",
".",
"Set",
"(",
"\"",
"\"",
",",
"extra",
")",
"\n",
"reqURL",
".",
"RawQuery",
"=",
"q",
".",
"Encode",
"(",
")",
"\n",
"}",
"\n\n",
"result",
",",
"err",
":=",
"a",
".",
"Get",
"(",
"reqURL",
".",
"String",
"(",
")",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"if",
"a",
".",
"Debug",
"{",
"a",
".",
"Log",
".",
"Printf",
"(",
"\"",
"\"",
",",
"string",
"(",
"result",
")",
")",
"\n",
"}",
"\n\n",
"cluster",
":=",
"&",
"MetricCluster",
"{",
"}",
"\n",
"if",
"err",
":=",
"json",
".",
"Unmarshal",
"(",
"result",
",",
"cluster",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"return",
"cluster",
",",
"nil",
"\n",
"}"
] |
4,963 | all-4964 | [
"MarshalJSON",
"supports",
"json",
".",
"Marshaler",
"interface"
] | [
"func",
"(",
"v",
"SetTimingParams",
")",
"MarshalJSON",
"(",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"w",
":=",
"jwriter",
".",
"Writer",
"{",
"}",
"\n",
"easyjsonC5a4559bEncodeGithubComChromedpCdprotoAnimation",
"(",
"&",
"w",
",",
"v",
")",
"\n",
"return",
"w",
".",
"Buffer",
".",
"BuildBytes",
"(",
")",
",",
"w",
".",
"<mask>",
"\n",
"}"
] |
4,964 | all-4965 | [
"The",
"lvm",
".",
"thinpool_name",
"and",
"lvm",
".",
"vg_name",
"config",
"keys",
"are",
"node",
"-",
"specific",
"and",
"need",
"to",
"be",
"linked",
"to",
"nodes",
"."
] | [
"func",
"patchLvmNodeSpecificConfigKeys",
"(",
"name",
"string",
",",
"d",
"*",
"Daemon",
")",
"error",
"{",
"tx",
",",
"err",
":=",
"d",
".",
"cluster",
".",
"Begin",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"errors",
".",
"Wrap",
"(",
"err",
",",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"// Fetch the IDs of all existing nodes.",
"nodeIDs",
",",
"err",
":=",
"query",
".",
"SelectIntegers",
"(",
"<mask>",
",",
"\"",
"\"",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"errors",
".",
"Wrap",
"(",
"err",
",",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"// Fetch the IDs of all existing lvm pools.",
"poolIDs",
",",
"err",
":=",
"query",
".",
"SelectIntegers",
"(",
"tx",
",",
"\"",
"\"",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"errors",
".",
"Wrap",
"(",
"err",
",",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"for",
"_",
",",
"poolID",
":=",
"range",
"poolIDs",
"{",
"// Fetch the config for this lvm pool and check if it has the",
"// lvn.thinpool_name or lvm.vg_name keys.",
"config",
",",
"err",
":=",
"query",
".",
"SelectConfig",
"(",
"tx",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"poolID",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"errors",
".",
"Wrap",
"(",
"err",
",",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"for",
"_",
",",
"key",
":=",
"range",
"[",
"]",
"string",
"{",
"\"",
"\"",
",",
"\"",
"\"",
"}",
"{",
"value",
",",
"ok",
":=",
"config",
"[",
"key",
"]",
"\n",
"if",
"!",
"ok",
"{",
"continue",
"\n",
"}",
"\n\n",
"// Delete the current key",
"_",
",",
"err",
"=",
"tx",
".",
"Exec",
"(",
"`\nDELETE FROM storage_pools_config WHERE key=? AND storage_pool_id=? AND node_id IS NULL\n`",
",",
"key",
",",
"poolID",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"errors",
".",
"Wrapf",
"(",
"err",
",",
"\"",
"\"",
",",
"key",
")",
"\n",
"}",
"\n\n",
"// Add the config entry for each node",
"for",
"_",
",",
"nodeID",
":=",
"range",
"nodeIDs",
"{",
"_",
",",
"err",
":=",
"tx",
".",
"Exec",
"(",
"`\nINSERT INTO storage_pools_config(storage_pool_id, node_id, key, value)\n VALUES(?, ?, ?, ?)\n`",
",",
"poolID",
",",
"nodeID",
",",
"key",
",",
"value",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"errors",
".",
"Wrapf",
"(",
"err",
",",
"\"",
"\"",
",",
"key",
")",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n\n",
"err",
"=",
"tx",
".",
"Commit",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"errors",
".",
"Wrap",
"(",
"err",
",",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"return",
"err",
"\n",
"}"
] |
4,965 | all-4966 | [
"return",
"the",
"pointer",
"to",
"a",
"mapped",
"buffer",
"object",
"s",
"data",
"store"
] | [
"func",
"GetNamedBufferPointerv",
"(",
"<mask>",
"uint32",
",",
"pname",
"uint32",
",",
"params",
"*",
"unsafe",
".",
"Pointer",
")",
"{",
"syscall",
".",
"Syscall",
"(",
"gpGetNamedBufferPointerv",
",",
"3",
",",
"uintptr",
"(",
"buffer",
")",
",",
"uintptr",
"(",
"pname",
")",
",",
"uintptr",
"(",
"unsafe",
".",
"Pointer",
"(",
"params",
")",
")",
")",
"\n",
"}"
] |
4,966 | all-4967 | [
"limitsCheckAndWait",
"make",
"sure",
"we",
"have",
"not",
"reached",
"the",
"limit",
"or",
"wait"
] | [
"func",
"(",
"<mask>",
"*",
"Client",
")",
"limitsCheckAndWait",
"(",
")",
"{",
"var",
"sleep",
"time",
".",
"Duration",
"\n",
"githubClient",
",",
"err",
":=",
"client",
".",
"getGitHubClient",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"glog",
".",
"Error",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"sleep",
"=",
"time",
".",
"Minute",
"\n",
"}",
"else",
"{",
"limits",
",",
"_",
",",
"err",
":=",
"githubClient",
".",
"RateLimits",
"(",
"context",
".",
"Background",
"(",
")",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"glog",
".",
"Error",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"sleep",
"=",
"time",
".",
"Minute",
"\n",
"}",
"\n",
"if",
"limits",
"!=",
"nil",
"&&",
"limits",
".",
"Core",
"!=",
"nil",
"&&",
"limits",
".",
"Core",
".",
"Remaining",
"<",
"tokenLimit",
"{",
"sleep",
"=",
"limits",
".",
"Core",
".",
"Reset",
".",
"Sub",
"(",
"time",
".",
"Now",
"(",
")",
")",
"\n",
"glog",
".",
"Warning",
"(",
"\"",
"\"",
",",
"sleep",
")",
"\n",
"}",
"\n",
"}",
"\n\n",
"time",
".",
"Sleep",
"(",
"sleep",
")",
"\n",
"}"
] |
4,967 | all-4968 | [
"HasIsReadOnly",
"returns",
"a",
"boolean",
"if",
"a",
"field",
"has",
"been",
"set",
"."
] | [
"func",
"(",
"b",
"*",
"Board",
")",
"HasIsReadOnly",
"(",
")",
"bool",
"{",
"if",
"b",
"!=",
"nil",
"&&",
"b",
".",
"IsReadOnly",
"!=",
"nil",
"{",
"return",
"true",
"\n",
"}",
"\n\n",
"return",
"<mask>",
"\n",
"}"
] |
4,968 | all-4969 | [
"Value",
"converts",
"a",
"value",
"to",
"a",
"database",
"driver",
"value"
] | [
"func",
"(",
"u",
"SSN",
")",
"Value",
"(",
")",
"(",
"driver",
".",
"Value",
",",
"error",
")",
"{",
"return",
"<mask>",
".",
"Value",
"(",
"string",
"(",
"u",
")",
")",
",",
"nil",
"\n",
"}"
] |
4,969 | all-4970 | [
"ListTeamMembers",
"gets",
"a",
"list",
"of",
"team",
"members",
"for",
"the",
"given",
"team",
"id",
"Role",
"options",
"are",
"all",
"maintainer",
"and",
"member",
"https",
":",
"//",
"developer",
".",
"github",
".",
"com",
"/",
"v3",
"/",
"teams",
"/",
"members",
"/",
"#list",
"-",
"team",
"-",
"members"
] | [
"func",
"(",
"c",
"*",
"Client",
")",
"ListTeamMembers",
"(",
"id",
"int",
",",
"role",
"string",
")",
"(",
"[",
"]",
"TeamMember",
",",
"error",
")",
"{",
"c",
".",
"<mask>",
"(",
"\"",
"\"",
",",
"id",
",",
"role",
")",
"\n",
"if",
"c",
".",
"fake",
"{",
"return",
"nil",
",",
"nil",
"\n",
"}",
"\n",
"path",
":=",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"id",
")",
"\n",
"var",
"teamMembers",
"[",
"]",
"TeamMember",
"\n",
"err",
":=",
"c",
".",
"readPaginatedResultsWithValues",
"(",
"path",
",",
"url",
".",
"Values",
"{",
"\"",
"\"",
":",
"[",
"]",
"string",
"{",
"\"",
"\"",
"}",
",",
"\"",
"\"",
":",
"[",
"]",
"string",
"{",
"role",
"}",
",",
"}",
",",
"// This accept header enables the nested teams preview.",
"// https://developer.github.com/changes/2017-08-30-preview-nested-teams/",
"\"",
"\"",
",",
"func",
"(",
")",
"interface",
"{",
"}",
"{",
"return",
"&",
"[",
"]",
"TeamMember",
"{",
"}",
"\n",
"}",
",",
"func",
"(",
"obj",
"interface",
"{",
"}",
")",
"{",
"teamMembers",
"=",
"append",
"(",
"teamMembers",
",",
"*",
"(",
"obj",
".",
"(",
"*",
"[",
"]",
"TeamMember",
")",
")",
"...",
")",
"\n",
"}",
",",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"return",
"teamMembers",
",",
"nil",
"\n",
"}"
] |
4,970 | all-4971 | [
"processFilters",
"processes",
"any",
"filters",
"valid",
"at",
"the",
"current",
"read",
"index",
"and",
"stores",
"the",
"output",
"in",
"outbuf",
"."
] | [
"func",
"(",
"d",
"*",
"decodeReader",
")",
"processFilters",
"(",
")",
"(",
"err",
"error",
")",
"{",
"f",
":=",
"d",
".",
"filters",
"[",
"0",
"]",
"\n",
"if",
"f",
".",
"offset",
">",
"0",
"{",
"return",
"nil",
"\n",
"}",
"\n",
"d",
".",
"filters",
"=",
"d",
".",
"filters",
"[",
"1",
":",
"]",
"\n",
"if",
"d",
".",
"win",
".",
"buffered",
"(",
")",
"<",
"f",
".",
"length",
"{",
"// fill() didn't return enough bytes",
"err",
"=",
"d",
".",
"readErr",
"(",
")",
"\n",
"if",
"err",
"==",
"nil",
"||",
"err",
"==",
"io",
".",
"EOF",
"{",
"return",
"errInvalidFilter",
"\n",
"}",
"\n",
"return",
"err",
"\n",
"}",
"\n\n",
"if",
"cap",
"(",
"d",
".",
"buf",
")",
"<",
"f",
".",
"length",
"{",
"d",
".",
"buf",
"=",
"make",
"(",
"[",
"]",
"byte",
",",
"f",
".",
"length",
")",
"\n",
"}",
"\n",
"d",
".",
"outbuf",
"=",
"d",
".",
"buf",
"[",
":",
"f",
".",
"length",
"]",
"\n",
"n",
":=",
"d",
".",
"win",
".",
"read",
"(",
"d",
".",
"outbuf",
")",
"\n",
"for",
"{",
"// run filter passing buffer and total bytes read so far",
"d",
".",
"outbuf",
",",
"err",
"=",
"f",
".",
"<mask>",
"(",
"d",
".",
"outbuf",
",",
"d",
".",
"tot",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"if",
"cap",
"(",
"d",
".",
"outbuf",
")",
">",
"cap",
"(",
"d",
".",
"buf",
")",
"{",
"// Filter returned a bigger buffer, save it for future filters.",
"d",
".",
"buf",
"=",
"d",
".",
"outbuf",
"\n",
"}",
"\n",
"if",
"len",
"(",
"d",
".",
"filters",
")",
"==",
"0",
"{",
"return",
"nil",
"\n",
"}",
"\n",
"f",
"=",
"d",
".",
"filters",
"[",
"0",
"]",
"\n\n",
"if",
"f",
".",
"offset",
"!=",
"0",
"{",
"// next filter not at current offset",
"f",
".",
"offset",
"-=",
"n",
"\n",
"return",
"nil",
"\n",
"}",
"\n",
"if",
"f",
".",
"length",
"!=",
"len",
"(",
"d",
".",
"outbuf",
")",
"{",
"return",
"errInvalidFilter",
"\n",
"}",
"\n",
"d",
".",
"filters",
"=",
"d",
".",
"filters",
"[",
"1",
":",
"]",
"\n\n",
"if",
"cap",
"(",
"d",
".",
"outbuf",
")",
"<",
"cap",
"(",
"d",
".",
"buf",
")",
"{",
"// Filter returned a smaller buffer. Copy it back to the saved buffer",
"// so the next filter can make use of the larger buffer if needed.",
"d",
".",
"outbuf",
"=",
"append",
"(",
"d",
".",
"buf",
"[",
":",
"0",
"]",
",",
"d",
".",
"outbuf",
"...",
")",
"\n",
"}",
"\n",
"}",
"\n",
"}"
] |
4,971 | all-4972 | [
"GetAllAddresses",
"returns",
"bitcoin",
"addresses",
"associated",
"with",
"client",
"account"
] | [
"func",
"(",
"c",
"Client",
")",
"GetAllAddresses",
"(",
"params",
"*",
"AddressesParams",
")",
"(",
"*",
"addresses",
",",
"error",
")",
"{",
"holder",
":=",
"addressesHolder",
"{",
"}",
"\n",
"if",
"err",
":=",
"c",
".",
"Get",
"(",
"\"",
"\"",
",",
"params",
",",
"&",
"holder",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"addresses",
":=",
"addresses",
"{",
"paginationStats",
":",
"holder",
".",
"paginationStats",
",",
"}",
"\n",
"// Remove one layer of nesting",
"for",
"_",
",",
"addr",
":=",
"range",
"holder",
".",
"Addresses",
"{",
"addresses",
".",
"Addresses",
"=",
"append",
"(",
"addresses",
".",
"Addresses",
",",
"addr",
".",
"<mask>",
")",
"\n",
"}",
"\n",
"return",
"&",
"addresses",
",",
"nil",
"\n",
"}"
] |
4,972 | all-4973 | [
"buildAppPorts",
"creates",
"app",
"ports",
"from",
"proxy",
"config"
] | [
"func",
"buildAppPorts",
"(",
"proxyConfig",
"*",
"ecsacs",
".",
"ProxyConfiguration",
")",
"[",
"]",
"string",
"{",
"<mask>",
"inputAppPorts",
"[",
"]",
"string",
"\n",
"if",
"proxyConfig",
".",
"Properties",
"[",
"appPorts",
"]",
"!=",
"nil",
"{",
"inputAppPorts",
"=",
"strings",
".",
"Split",
"(",
"*",
"proxyConfig",
".",
"Properties",
"[",
"appPorts",
"]",
",",
"splitter",
")",
"\n",
"}",
"\n",
"return",
"inputAppPorts",
"\n",
"}"
] |
4,973 | all-4974 | [
"GetIterFirst",
"()",
"is",
"a",
"wrapper",
"around",
"gtk_tree_model_get_iter_first",
"()",
"."
] | [
"func",
"(",
"v",
"*",
"TreeModel",
")",
"GetIterFirst",
"(",
")",
"(",
"*",
"TreeIter",
",",
"bool",
")",
"{",
"<mask>",
"iter",
"C",
".",
"GtkTreeIter",
"\n",
"c",
":=",
"C",
".",
"gtk_tree_model_get_iter_first",
"(",
"v",
".",
"native",
"(",
")",
",",
"&",
"iter",
")",
"\n",
"if",
"!",
"gobool",
"(",
"c",
")",
"{",
"return",
"nil",
",",
"false",
"\n",
"}",
"\n",
"t",
":=",
"&",
"TreeIter",
"{",
"iter",
"}",
"\n",
"return",
"t",
",",
"true",
"\n",
"}"
] |
4,974 | all-4975 | [
"retrieve",
"the",
"index",
"of",
"a",
"subroutine",
"uniform",
"of",
"a",
"given",
"shader",
"stage",
"within",
"a",
"program"
] | [
"func",
"GetSubroutineIndex",
"(",
"program",
"uint32",
",",
"shadertype",
"uint32",
",",
"name",
"*",
"uint8",
")",
"uint32",
"{",
"<mask>",
":=",
"C",
".",
"glowGetSubroutineIndex",
"(",
"gpGetSubroutineIndex",
",",
"(",
"C",
".",
"GLuint",
")",
"(",
"program",
")",
",",
"(",
"C",
".",
"GLenum",
")",
"(",
"shadertype",
")",
",",
"(",
"*",
"C",
".",
"GLchar",
")",
"(",
"unsafe",
".",
"Pointer",
"(",
"name",
")",
")",
")",
"\n",
"return",
"(",
"uint32",
")",
"(",
"ret",
")",
"\n",
"}"
] |
4,975 | all-4976 | [
"ReceiveComment",
"calls",
"plugin",
".",
"ReceiveComment",
"()",
"for",
"all",
"plugins"
] | [
"func",
"(",
"m",
"*",
"MultiplexerPluginWrapper",
")",
"ReceiveComment",
"(",
"comment",
"sql",
".",
"Comment",
")",
"[",
"]",
"<mask>",
"{",
"points",
":=",
"[",
"]",
"Point",
"{",
"}",
"\n\n",
"for",
"_",
",",
"plugin",
":=",
"range",
"m",
".",
"plugins",
"{",
"points",
"=",
"append",
"(",
"points",
",",
"plugin",
".",
"ReceiveComment",
"(",
"comment",
")",
"...",
")",
"\n",
"}",
"\n\n",
"return",
"points",
"\n",
"}"
] |
4,976 | all-4977 | [
"NewEngine",
"returns",
"a",
"new",
"engine",
"."
] | [
"func",
"NewEngine",
"(",
"opts",
"EngineOpts",
")",
"*",
"Engine",
"{",
"if",
"opts",
".",
"Logger",
"==",
"nil",
"{",
"opts",
".",
"Logger",
"=",
"log",
".",
"NewNopLogger",
"(",
")",
"\n",
"}",
"\n\n",
"metrics",
":=",
"&",
"engineMetrics",
"{",
"currentQueries",
":",
"prometheus",
".",
"NewGauge",
"(",
"prometheus",
".",
"GaugeOpts",
"{",
"Namespace",
":",
"namespace",
",",
"Subsystem",
":",
"subsystem",
",",
"Name",
":",
"\"",
"\"",
",",
"Help",
":",
"\"",
"\"",
",",
"}",
")",
",",
"maxConcurrentQueries",
":",
"prometheus",
".",
"NewGauge",
"(",
"prometheus",
".",
"GaugeOpts",
"{",
"Namespace",
":",
"namespace",
",",
"Subsystem",
":",
"subsystem",
",",
"Name",
":",
"\"",
"\"",
",",
"Help",
":",
"\"",
"\"",
",",
"}",
")",
",",
"queryQueueTime",
":",
"prometheus",
".",
"NewSummary",
"(",
"prometheus",
".",
"SummaryOpts",
"{",
"Namespace",
":",
"namespace",
",",
"Subsystem",
":",
"subsystem",
",",
"Name",
":",
"\"",
"\"",
",",
"Help",
":",
"\"",
"\"",
",",
"ConstLabels",
":",
"prometheus",
".",
"Labels",
"{",
"\"",
"\"",
":",
"\"",
"\"",
"}",
",",
"}",
")",
",",
"queryPrepareTime",
":",
"prometheus",
".",
"NewSummary",
"(",
"prometheus",
".",
"SummaryOpts",
"{",
"Namespace",
":",
"namespace",
",",
"Subsystem",
":",
"subsystem",
",",
"Name",
":",
"\"",
"\"",
",",
"Help",
":",
"\"",
"\"",
",",
"ConstLabels",
":",
"prometheus",
".",
"Labels",
"{",
"\"",
"\"",
":",
"\"",
"\"",
"}",
",",
"}",
")",
",",
"queryInnerEval",
":",
"prometheus",
".",
"NewSummary",
"(",
"prometheus",
".",
"SummaryOpts",
"{",
"Namespace",
":",
"namespace",
",",
"Subsystem",
":",
"subsystem",
",",
"Name",
":",
"\"",
"\"",
",",
"Help",
":",
"\"",
"\"",
",",
"ConstLabels",
":",
"prometheus",
".",
"Labels",
"{",
"\"",
"\"",
":",
"\"",
"\"",
"}",
",",
"}",
")",
",",
"queryResultSort",
":",
"prometheus",
".",
"NewSummary",
"(",
"prometheus",
".",
"SummaryOpts",
"{",
"Namespace",
":",
"namespace",
",",
"Subsystem",
":",
"subsystem",
",",
"<mask>",
":",
"\"",
"\"",
",",
"Help",
":",
"\"",
"\"",
",",
"ConstLabels",
":",
"prometheus",
".",
"Labels",
"{",
"\"",
"\"",
":",
"\"",
"\"",
"}",
",",
"}",
")",
",",
"}",
"\n",
"metrics",
".",
"maxConcurrentQueries",
".",
"Set",
"(",
"float64",
"(",
"opts",
".",
"MaxConcurrent",
")",
")",
"\n\n",
"if",
"opts",
".",
"Reg",
"!=",
"nil",
"{",
"opts",
".",
"Reg",
".",
"MustRegister",
"(",
"metrics",
".",
"currentQueries",
",",
"metrics",
".",
"maxConcurrentQueries",
",",
"metrics",
".",
"queryQueueTime",
",",
"metrics",
".",
"queryPrepareTime",
",",
"metrics",
".",
"queryInnerEval",
",",
"metrics",
".",
"queryResultSort",
",",
")",
"\n",
"}",
"\n",
"return",
"&",
"Engine",
"{",
"gate",
":",
"gate",
".",
"New",
"(",
"opts",
".",
"MaxConcurrent",
")",
",",
"timeout",
":",
"opts",
".",
"Timeout",
",",
"logger",
":",
"opts",
".",
"Logger",
",",
"metrics",
":",
"metrics",
",",
"maxSamplesPerQuery",
":",
"opts",
".",
"MaxSamples",
",",
"}",
"\n",
"}"
] |
4,977 | all-4978 | [
"Specify",
"the",
"value",
"of",
"a",
"uniform",
"variable",
"for",
"the",
"current",
"program",
"object"
] | [
"func",
"Uniform4iv",
"(",
"location",
"int32",
",",
"count",
"int32",
",",
"value",
"*",
"int32",
")",
"{",
"syscall",
".",
"Syscall",
"(",
"gpUniform4iv",
",",
"3",
",",
"uintptr",
"(",
"location",
")",
",",
"uintptr",
"(",
"<mask>",
")",
",",
"uintptr",
"(",
"unsafe",
".",
"Pointer",
"(",
"value",
")",
")",
")",
"\n",
"}"
] |
4,978 | all-4979 | [
"MarshalJSON",
"supports",
"json",
".",
"Marshaler",
"interface"
] | [
"func",
"(",
"v",
"ReloadParams",
")",
"MarshalJSON",
"(",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"w",
":=",
"jwriter",
".",
"<mask>",
"{",
"}",
"\n",
"easyjsonC5a4559bEncodeGithubComChromedpCdprotoPage21",
"(",
"&",
"w",
",",
"v",
")",
"\n",
"return",
"w",
".",
"Buffer",
".",
"BuildBytes",
"(",
")",
",",
"w",
".",
"Error",
"\n",
"}"
] |
4,979 | all-4980 | [
"RenameObject",
"renames",
"a",
"MO",
"and",
"tracks",
"the",
"task",
"to",
"make",
"sure",
"it",
"completes",
"."
] | [
"func",
"RenameObject",
"(",
"client",
"*",
"govmomi",
".",
"Client",
",",
"ref",
"types",
".",
"ManagedObjectReference",
",",
"new",
"string",
")",
"error",
"{",
"req",
":=",
"types",
".",
"Rename_Task",
"{",
"This",
":",
"ref",
",",
"NewName",
":",
"new",
",",
"}",
"\n\n",
"rctx",
",",
"rcancel",
":=",
"<mask>",
".",
"WithTimeout",
"(",
"context",
".",
"Background",
"(",
")",
",",
"provider",
".",
"DefaultAPITimeout",
")",
"\n",
"defer",
"rcancel",
"(",
")",
"\n",
"res",
",",
"err",
":=",
"methods",
".",
"Rename_Task",
"(",
"rctx",
",",
"client",
".",
"Client",
",",
"&",
"req",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"t",
":=",
"object",
".",
"NewTask",
"(",
"client",
".",
"Client",
",",
"res",
".",
"Returnval",
")",
"\n",
"tctx",
",",
"tcancel",
":=",
"context",
".",
"WithTimeout",
"(",
"context",
".",
"Background",
"(",
")",
",",
"provider",
".",
"DefaultAPITimeout",
")",
"\n",
"defer",
"tcancel",
"(",
")",
"\n",
"return",
"t",
".",
"Wait",
"(",
"tctx",
")",
"\n",
"}"
] |
4,980 | all-4981 | [
"MarshalJSON",
"supports",
"json",
".",
"Marshaler",
"interface"
] | [
"func",
"(",
"v",
"RequestCachedResponseParams",
")",
"MarshalJSON",
"(",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"w",
":=",
"jwriter",
".",
"Writer",
"{",
"}",
"\n",
"easyjsonC5a4559bEncodeGithubComChromedpCdprotoCachestorage3",
"(",
"&",
"w",
",",
"v",
")",
"\n",
"return",
"w",
".",
"Buffer",
".",
"BuildBytes",
"(",
")",
",",
"w",
".",
"<mask>",
"\n",
"}"
] |
4,981 | all-4982 | [
"Set",
"is",
"required",
"for",
"kingpin",
"interfaces",
"to",
"allow",
"command",
"line",
"params",
"to",
"be",
"set",
"to",
"our",
"map",
"datatype"
] | [
"func",
"(",
"o",
"*",
"ListRuneOption",
")",
"Set",
"(",
"value",
"string",
")",
"error",
"{",
"val",
":=",
"RuneOption",
"{",
"}",
"\n",
"val",
".",
"Set",
"(",
"<mask>",
")",
"\n",
"*",
"o",
"=",
"append",
"(",
"*",
"o",
",",
"val",
")",
"\n",
"return",
"nil",
"\n",
"}"
] |
4,982 | all-4983 | [
"Listen",
"bind",
"port",
".",
"Receive",
"messages",
"and",
"send",
"to",
"out",
"channel"
] | [
"func",
"(",
"rcv",
"*",
"TCP",
")",
"Listen",
"(",
"addr",
"*",
"<mask>",
".",
"TCPAddr",
")",
"error",
"{",
"return",
"rcv",
".",
"StartFunc",
"(",
"func",
"(",
")",
"error",
"{",
"tcpListener",
",",
"err",
":=",
"net",
".",
"ListenTCP",
"(",
"\"",
"\"",
",",
"addr",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"rcv",
".",
"Go",
"(",
"func",
"(",
"exit",
"chan",
"bool",
")",
"{",
"<-",
"exit",
"\n",
"tcpListener",
".",
"Close",
"(",
")",
"\n",
"}",
")",
"\n\n",
"handler",
":=",
"rcv",
".",
"HandleConnection",
"\n",
"if",
"rcv",
".",
"isFraming",
"{",
"handler",
"=",
"rcv",
".",
"handleFraming",
"\n",
"}",
"\n\n",
"if",
"rcv",
".",
"buffer",
"!=",
"nil",
"{",
"originalOut",
":=",
"rcv",
".",
"out",
"\n\n",
"rcv",
".",
"Go",
"(",
"func",
"(",
"exit",
"chan",
"bool",
")",
"{",
"for",
"{",
"select",
"{",
"case",
"<-",
"exit",
":",
"return",
"\n",
"case",
"p",
":=",
"<-",
"rcv",
".",
"buffer",
":",
"originalOut",
"(",
"p",
")",
"\n",
"}",
"\n",
"}",
"\n",
"}",
")",
"\n\n",
"rcv",
".",
"out",
"=",
"func",
"(",
"p",
"*",
"points",
".",
"Points",
")",
"{",
"rcv",
".",
"buffer",
"<-",
"p",
"\n",
"}",
"\n",
"}",
"\n\n",
"rcv",
".",
"Go",
"(",
"func",
"(",
"exit",
"chan",
"bool",
")",
"{",
"defer",
"tcpListener",
".",
"Close",
"(",
")",
"\n\n",
"for",
"{",
"conn",
",",
"err",
":=",
"tcpListener",
".",
"Accept",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"if",
"strings",
".",
"Contains",
"(",
"err",
".",
"Error",
"(",
")",
",",
"\"",
"\"",
")",
"{",
"break",
"\n",
"}",
"\n",
"rcv",
".",
"logger",
".",
"Warn",
"(",
"\"",
"\"",
",",
"zap",
".",
"Error",
"(",
"err",
")",
",",
")",
"\n",
"continue",
"\n",
"}",
"\n\n",
"rcv",
".",
"Go",
"(",
"func",
"(",
"exit",
"chan",
"bool",
")",
"{",
"handler",
"(",
"conn",
")",
"\n",
"}",
")",
"\n",
"}",
"\n\n",
"}",
")",
"\n\n",
"rcv",
".",
"listener",
"=",
"tcpListener",
"\n\n",
"return",
"nil",
"\n",
"}",
")",
"\n",
"}"
] |
4,983 | all-4984 | [
"Stem",
"an",
"Spanish",
"word",
".",
"This",
"is",
"the",
"only",
"exported",
"function",
"in",
"this",
"package",
"."
] | [
"func",
"Stem",
"(",
"word",
"string",
",",
"stemStopwWords",
"bool",
")",
"string",
"{",
"<mask>",
"=",
"strings",
".",
"ToLower",
"(",
"strings",
".",
"TrimSpace",
"(",
"word",
")",
")",
"\n\n",
"// Return small words and stop words",
"if",
"len",
"(",
"word",
")",
"<=",
"2",
"||",
"(",
"stemStopwWords",
"==",
"false",
"&&",
"isStopWord",
"(",
"word",
")",
")",
"{",
"return",
"word",
"\n",
"}",
"\n\n",
"w",
":=",
"snowballword",
".",
"New",
"(",
"word",
")",
"\n\n",
"// Stem the word. Note, each of these",
"// steps will alter `w` in place.",
"//",
"preprocess",
"(",
"w",
")",
"\n",
"step0",
"(",
"w",
")",
"\n",
"changeInStep1",
":=",
"step1",
"(",
"w",
")",
"\n",
"if",
"changeInStep1",
"==",
"false",
"{",
"changeInStep2a",
":=",
"step2a",
"(",
"w",
")",
"\n",
"if",
"changeInStep2a",
"==",
"false",
"{",
"step2b",
"(",
"w",
")",
"\n",
"}",
"\n",
"}",
"\n",
"step3",
"(",
"w",
")",
"\n",
"postprocess",
"(",
"w",
")",
"\n\n",
"return",
"w",
".",
"String",
"(",
")",
"\n\n",
"}"
] |
4,984 | all-4985 | [
"FromBytes",
"creates",
"a",
"new",
"temporary",
"file",
"in",
"the",
"directory",
"dir",
"with",
"a",
"name",
"beginning",
"with",
"prefix",
"opens",
"the",
"file",
"for",
"reading",
"and",
"writing",
"writes",
"the",
"provided",
"data",
"into",
"it",
"and",
"returns",
"seeks",
"the",
"underlying",
"file",
"object",
"to",
"0",
".",
"If",
"dir",
"is",
"the",
"empty",
"string",
"TempFile",
"uses",
"the",
"default",
"directory",
"for",
"temporary",
"files",
"(",
"see",
"os",
".",
"TempDir",
")",
".",
"Multiple",
"programs",
"calling",
"TempFile",
"simultaneously",
"will",
"not",
"choose",
"the",
"same",
"file",
".",
"The",
"caller",
"can",
"use",
"f",
".",
"Name",
"()",
"to",
"find",
"the",
"pathname",
"of",
"the",
"file",
".",
"It",
"is",
"the",
"caller",
"s",
"responsibility",
"to",
"remove",
"the",
"file",
"when",
"no",
"longer",
"needed",
"."
] | [
"func",
"FromBytes",
"(",
"dir",
",",
"prefix",
"string",
",",
"data",
"[",
"]",
"byte",
")",
"(",
"*",
"TempFile",
",",
"error",
")",
"{",
"var",
"tmp",
"*",
"TempFile",
"=",
"&",
"TempFile",
"{",
"dir",
":",
"dir",
",",
"prefix",
":",
"prefix",
"}",
"\n",
"var",
"err",
"error",
"\n\n",
"tmp",
".",
"<mask>",
",",
"err",
"=",
"ioutil",
".",
"TempFile",
"(",
"dir",
",",
"prefix",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"_",
",",
"err",
"=",
"tmp",
".",
"Write",
"(",
"data",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"tmp",
".",
"Seek",
"(",
"0",
",",
"0",
")",
"\n\n",
"return",
"tmp",
",",
"nil",
"\n",
"}"
] |
4,985 | all-4986 | [
"Convert",
"version",
"number",
"in",
"index",
".",
"json",
"to",
"go",
"package",
"name",
"1",
".",
"6",
"=",
">",
"v1_6"
] | [
"func",
"toPackageName",
"(",
"version",
"string",
")",
"string",
"{",
"if",
"version",
"==",
"\"",
"\"",
"{",
"return",
"\"",
"\"",
"\n",
"}",
"\n",
"parts",
":=",
"strings",
".",
"Split",
"(",
"<mask>",
",",
"\"",
"\"",
")",
"\n",
"i",
":=",
"1",
"\n",
"p",
":=",
"parts",
"[",
"len",
"(",
"parts",
")",
"-",
"i",
"]",
"\n",
"for",
"p",
"==",
"\"",
"\"",
"&&",
"i",
"<=",
"len",
"(",
"parts",
")",
"{",
"i",
"++",
"\n",
"p",
"=",
"parts",
"[",
"len",
"(",
"parts",
")",
"-",
"i",
"]",
"\n",
"}",
"\n",
"version",
"=",
"strings",
".",
"Join",
"(",
"parts",
",",
"\"",
"\"",
")",
"\n",
"return",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"version",
")",
"\n",
"}"
] |
4,986 | all-4987 | [
"NewMockManager",
"creates",
"a",
"new",
"mock",
"instance"
] | [
"func",
"NewMockManager",
"(",
"ctrl",
"*",
"gomock",
".",
"<mask>",
")",
"*",
"MockManager",
"{",
"mock",
":=",
"&",
"MockManager",
"{",
"ctrl",
":",
"ctrl",
"}",
"\n",
"mock",
".",
"recorder",
"=",
"&",
"MockManagerMockRecorder",
"{",
"mock",
"}",
"\n",
"return",
"mock",
"\n",
"}"
] |
4,987 | all-4988 | [
"Gossip",
"yields",
"the",
"current",
"topology",
"as",
"GossipData",
"."
] | [
"func",
"(",
"router",
"*",
"Router",
")",
"Gossip",
"(",
")",
"GossipData",
"{",
"return",
"&",
"topologyGossipData",
"{",
"peers",
":",
"router",
".",
"Peers",
",",
"update",
":",
"router",
".",
"Peers",
".",
"<mask>",
"(",
")",
"}",
"\n",
"}"
] |
4,988 | all-4989 | [
"HasClientEmail",
"returns",
"a",
"boolean",
"if",
"a",
"field",
"has",
"been",
"set",
"."
] | [
"func",
"(",
"i",
"*",
"IntegrationGCPCreateRequest",
")",
"HasClientEmail",
"(",
")",
"bool",
"{",
"if",
"i",
"!=",
"nil",
"&&",
"i",
".",
"ClientEmail",
"!=",
"nil",
"{",
"return",
"true",
"\n",
"}",
"\n\n",
"return",
"<mask>",
"\n",
"}"
] |
4,989 | all-4990 | [
"handle",
"adds",
"new",
"route",
"to",
"the",
"router",
"tree",
"."
] | [
"func",
"(",
"r",
"*",
"Router",
")",
"handle",
"(",
"method",
",",
"pattern",
"string",
",",
"handle",
"Handle",
")",
"*",
"Route",
"{",
"method",
"=",
"strings",
".",
"ToUpper",
"(",
"method",
")",
"\n\n",
"var",
"leaf",
"*",
"Leaf",
"\n",
"// Prevent duplicate routes.",
"if",
"leaf",
"=",
"r",
".",
"getLeaf",
"(",
"method",
",",
"pattern",
")",
";",
"leaf",
"!=",
"nil",
"{",
"return",
"&",
"Route",
"{",
"r",
",",
"leaf",
"}",
"\n",
"}",
"\n\n",
"// Validate HTTP methods.",
"if",
"!",
"_HTTP_METHODS",
"[",
"method",
"]",
"&&",
"method",
"!=",
"\"",
"\"",
"{",
"panic",
"(",
"\"",
"\"",
"+",
"method",
")",
"\n",
"}",
"\n\n",
"// Generate methods need register.",
"methods",
":=",
"make",
"(",
"map",
"[",
"string",
"]",
"bool",
")",
"\n",
"if",
"method",
"==",
"\"",
"\"",
"{",
"for",
"m",
":=",
"range",
"_HTTP_METHODS",
"{",
"methods",
"[",
"m",
"]",
"=",
"true",
"\n",
"}",
"\n",
"}",
"else",
"{",
"methods",
"[",
"method",
"]",
"=",
"true",
"\n",
"}",
"\n\n",
"// Add to router tree.",
"for",
"m",
":=",
"range",
"methods",
"{",
"if",
"t",
",",
"ok",
":=",
"r",
".",
"routers",
"[",
"m",
"]",
";",
"ok",
"{",
"leaf",
"=",
"t",
".",
"Add",
"(",
"<mask>",
",",
"handle",
")",
"\n",
"}",
"else",
"{",
"t",
":=",
"NewTree",
"(",
")",
"\n",
"leaf",
"=",
"t",
".",
"Add",
"(",
"pattern",
",",
"handle",
")",
"\n",
"r",
".",
"routers",
"[",
"m",
"]",
"=",
"t",
"\n",
"}",
"\n",
"r",
".",
"add",
"(",
"m",
",",
"pattern",
",",
"leaf",
")",
"\n",
"}",
"\n",
"return",
"&",
"Route",
"{",
"r",
",",
"leaf",
"}",
"\n",
"}"
] |
4,990 | all-4991 | [
"Remove",
"retreives",
"a",
"value",
"from",
"this",
"List",
"and",
"shifts",
"all",
"other",
"values",
"."
] | [
"func",
"(",
"l",
"*",
"<mask>",
")",
"Remove",
"(",
"pos",
"uint",
")",
"(",
"interface",
"{",
"}",
",",
"bool",
")",
"{",
"l",
".",
"key",
".",
"Lock",
"(",
")",
"\n",
"defer",
"l",
".",
"key",
".",
"Unlock",
"(",
")",
"\n\n",
"if",
"pos",
">",
"uint",
"(",
"len",
"(",
"l",
".",
"underlyer",
")",
")",
"{",
"return",
"nil",
",",
"false",
"\n",
"}",
"\n",
"retval",
":=",
"l",
".",
"underlyer",
"[",
"pos",
"]",
"\n",
"l",
".",
"underlyer",
"=",
"append",
"(",
"l",
".",
"underlyer",
"[",
":",
"pos",
"]",
",",
"l",
".",
"underlyer",
"[",
"pos",
"+",
"1",
":",
"]",
"...",
")",
"\n",
"return",
"retval",
",",
"true",
"\n",
"}"
] |
4,991 | all-4992 | [
"GetTextAlign",
"returns",
"the",
"TextAlign",
"field",
"if",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"."
] | [
"func",
"(",
"w",
"*",
"Widget",
")",
"GetTextAlign",
"(",
")",
"string",
"{",
"if",
"w",
"==",
"nil",
"||",
"w",
".",
"TextAlign",
"==",
"nil",
"{",
"return",
"\"",
"\"",
"\n",
"}",
"\n",
"<mask>",
"*",
"w",
".",
"TextAlign",
"\n",
"}"
] |
4,992 | all-4993 | [
"Parameters",
":",
"-",
"Query"
] | [
"func",
"(",
"p",
"*",
"HyperbahnClient",
")",
"Discover",
"(",
"query",
"*",
"DiscoveryQuery",
")",
"(",
"r",
"*",
"DiscoveryResult_",
",",
"err",
"error",
")",
"{",
"if",
"err",
"=",
"p",
".",
"sendDiscover",
"(",
"<mask>",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"\n",
"}",
"\n",
"return",
"p",
".",
"recvDiscover",
"(",
")",
"\n",
"}"
] |
4,993 | all-4994 | [
"Map",
"returns",
"a",
"string",
"map",
"of",
"the",
"labels",
"."
] | [
"func",
"(",
"ls",
"Labels",
")",
"Map",
"(",
")",
"<mask>",
"[",
"string",
"]",
"string",
"{",
"m",
":=",
"make",
"(",
"map",
"[",
"string",
"]",
"string",
",",
"len",
"(",
"ls",
")",
")",
"\n",
"for",
"_",
",",
"l",
":=",
"range",
"ls",
"{",
"m",
"[",
"l",
".",
"Name",
"]",
"=",
"l",
".",
"Value",
"\n",
"}",
"\n",
"return",
"m",
"\n",
"}"
] |
4,994 | all-4995 | [
"SetConfig",
"sets",
"data",
"sources",
"for",
"configuration",
"."
] | [
"func",
"SetConfig",
"(",
"<mask>",
"interface",
"{",
"}",
",",
"others",
"...",
"interface",
"{",
"}",
")",
"(",
"_",
"*",
"ini",
".",
"File",
",",
"err",
"error",
")",
"{",
"cfg",
",",
"err",
"=",
"ini",
".",
"Load",
"(",
"source",
",",
"others",
"...",
")",
"\n",
"return",
"Config",
"(",
")",
",",
"err",
"\n",
"}"
] |
4,995 | all-4996 | [
"withMax",
"sets",
"the",
"maximum",
"number",
"of",
"retries",
"on",
"this",
"call",
"or",
"this",
"interceptor",
"."
] | [
"func",
"withMax",
"(",
"maxRetries",
"uint",
")",
"retryOption",
"{",
"return",
"retryOption",
"{",
"applyFunc",
":",
"func",
"(",
"o",
"*",
"<mask>",
")",
"{",
"o",
".",
"max",
"=",
"maxRetries",
"\n",
"}",
"}",
"\n",
"}"
] |
4,996 | all-4997 | [
"MonoToStereoF32",
"converts",
"a",
"mono",
"stream",
"into",
"a",
"stereo",
"one",
"by",
"copying",
"the",
"mono",
"signal",
"to",
"both",
"channels",
"in",
"an",
"interleaved",
"signal",
"."
] | [
"func",
"MonoToStereoF32",
"(",
"buf",
"*",
"audio",
".",
"Float32Buffer",
")",
"error",
"{",
"if",
"buf",
"==",
"nil",
"||",
"buf",
".",
"Format",
"==",
"nil",
"||",
"buf",
".",
"Format",
".",
"NumChannels",
"!=",
"1",
"{",
"return",
"<mask>",
".",
"ErrInvalidBuffer",
"\n",
"}",
"\n",
"stereoData",
":=",
"make",
"(",
"[",
"]",
"float32",
",",
"len",
"(",
"buf",
".",
"Data",
")",
"*",
"2",
")",
"\n",
"var",
"j",
"int",
"\n",
"for",
"i",
":=",
"0",
";",
"i",
"<",
"len",
"(",
"buf",
".",
"Data",
")",
";",
"i",
"++",
"{",
"stereoData",
"[",
"j",
"]",
"=",
"buf",
".",
"Data",
"[",
"i",
"]",
"\n",
"j",
"++",
"\n",
"stereoData",
"[",
"j",
"]",
"=",
"buf",
".",
"Data",
"[",
"i",
"]",
"\n",
"j",
"++",
"\n",
"}",
"\n",
"buf",
".",
"Data",
"=",
"stereoData",
"\n",
"buf",
".",
"Format",
".",
"NumChannels",
"=",
"2",
"\n",
"return",
"nil",
"\n",
"}"
] |
4,997 | all-4998 | [
"NewPathPaymentResult",
"creates",
"a",
"new",
"PathPaymentResult",
"."
] | [
"func",
"NewPathPaymentResult",
"(",
"code",
"PathPaymentResultCode",
",",
"<mask>",
"interface",
"{",
"}",
")",
"(",
"result",
"PathPaymentResult",
",",
"err",
"error",
")",
"{",
"result",
".",
"Code",
"=",
"code",
"\n",
"switch",
"PathPaymentResultCode",
"(",
"code",
")",
"{",
"case",
"PathPaymentResultCodePathPaymentSuccess",
":",
"tv",
",",
"ok",
":=",
"value",
".",
"(",
"PathPaymentResultSuccess",
")",
"\n",
"if",
"!",
"ok",
"{",
"err",
"=",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
")",
"\n",
"return",
"\n",
"}",
"\n",
"result",
".",
"Success",
"=",
"&",
"tv",
"\n",
"case",
"PathPaymentResultCodePathPaymentNoIssuer",
":",
"tv",
",",
"ok",
":=",
"value",
".",
"(",
"Asset",
")",
"\n",
"if",
"!",
"ok",
"{",
"err",
"=",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
")",
"\n",
"return",
"\n",
"}",
"\n",
"result",
".",
"NoIssuer",
"=",
"&",
"tv",
"\n",
"default",
":",
"// void",
"}",
"\n",
"return",
"\n",
"}"
] |
4,998 | all-4999 | [
"parseSeriesDesc",
"parses",
"a",
"description",
"of",
"a",
"time",
"series",
"into",
"its",
"metric",
"and",
"value",
"sequence",
"."
] | [
"func",
"(",
"p",
"*",
"parser",
")",
"parseSeriesDesc",
"(",
")",
"(",
"m",
"labels",
".",
"Labels",
",",
"vals",
"[",
"]",
"sequenceValue",
",",
"err",
"error",
")",
"{",
"defer",
"p",
".",
"recover",
"(",
"&",
"err",
")",
"\n\n",
"m",
"=",
"p",
".",
"metric",
"(",
")",
"\n\n",
"const",
"ctx",
"=",
"\"",
"\"",
"\n",
"for",
"{",
"for",
"p",
".",
"peek",
"(",
")",
".",
"typ",
"==",
"ItemSpace",
"{",
"p",
".",
"next",
"(",
")",
"\n",
"}",
"\n",
"if",
"p",
".",
"peek",
"(",
")",
".",
"typ",
"==",
"ItemEOF",
"{",
"break",
"\n",
"}",
"\n\n",
"// Extract blanks.",
"if",
"p",
".",
"peek",
"(",
")",
".",
"typ",
"==",
"ItemBlank",
"{",
"p",
".",
"next",
"(",
")",
"\n",
"times",
":=",
"uint64",
"(",
"1",
")",
"\n",
"if",
"p",
".",
"peek",
"(",
")",
".",
"typ",
"==",
"ItemTimes",
"{",
"p",
".",
"next",
"(",
")",
"\n",
"times",
",",
"err",
"=",
"strconv",
".",
"ParseUint",
"(",
"p",
".",
"expect",
"(",
"ItemNumber",
",",
"ctx",
")",
".",
"val",
",",
"10",
",",
"64",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"p",
".",
"errorf",
"(",
"\"",
"\"",
",",
"ctx",
",",
"err",
")",
"\n",
"}",
"\n",
"}",
"\n",
"for",
"i",
":=",
"uint64",
"(",
"0",
")",
";",
"i",
"<",
"<mask>",
";",
"i",
"++",
"{",
"vals",
"=",
"append",
"(",
"vals",
",",
"sequenceValue",
"{",
"omitted",
":",
"true",
"}",
")",
"\n",
"}",
"\n",
"// This is to ensure that there is a space between this and the next number.",
"// This is especially required if the next number is negative.",
"if",
"t",
":=",
"p",
".",
"expectOneOf",
"(",
"ItemSpace",
",",
"ItemEOF",
",",
"ctx",
")",
".",
"typ",
";",
"t",
"==",
"ItemEOF",
"{",
"break",
"\n",
"}",
"\n",
"continue",
"\n",
"}",
"\n\n",
"// Extract values.",
"sign",
":=",
"1.0",
"\n",
"if",
"t",
":=",
"p",
".",
"peek",
"(",
")",
".",
"typ",
";",
"t",
"==",
"ItemSUB",
"||",
"t",
"==",
"ItemADD",
"{",
"if",
"p",
".",
"next",
"(",
")",
".",
"typ",
"==",
"ItemSUB",
"{",
"sign",
"=",
"-",
"1",
"\n",
"}",
"\n",
"}",
"\n",
"var",
"k",
"float64",
"\n",
"if",
"t",
":=",
"p",
".",
"peek",
"(",
")",
".",
"typ",
";",
"t",
"==",
"ItemNumber",
"{",
"k",
"=",
"sign",
"*",
"p",
".",
"number",
"(",
"p",
".",
"expect",
"(",
"ItemNumber",
",",
"ctx",
")",
".",
"val",
")",
"\n",
"}",
"else",
"if",
"t",
"==",
"ItemIdentifier",
"&&",
"p",
".",
"peek",
"(",
")",
".",
"val",
"==",
"\"",
"\"",
"{",
"p",
".",
"next",
"(",
")",
"\n",
"k",
"=",
"math",
".",
"Float64frombits",
"(",
"value",
".",
"StaleNaN",
")",
"\n",
"}",
"else",
"{",
"p",
".",
"errorf",
"(",
"\"",
"\"",
",",
"ctx",
",",
"t",
".",
"desc",
"(",
")",
",",
"p",
".",
"peek",
"(",
")",
")",
"\n",
"}",
"\n",
"vals",
"=",
"append",
"(",
"vals",
",",
"sequenceValue",
"{",
"value",
":",
"k",
",",
"}",
")",
"\n\n",
"// If there are no offset repetitions specified, proceed with the next value.",
"if",
"t",
":=",
"p",
".",
"peek",
"(",
")",
";",
"t",
".",
"typ",
"==",
"ItemSpace",
"{",
"// This ensures there is a space between every value.",
"continue",
"\n",
"}",
"else",
"if",
"t",
".",
"typ",
"==",
"ItemEOF",
"{",
"break",
"\n",
"}",
"else",
"if",
"t",
".",
"typ",
"!=",
"ItemADD",
"&&",
"t",
".",
"typ",
"!=",
"ItemSUB",
"{",
"p",
".",
"errorf",
"(",
"\"",
"\"",
",",
"ctx",
",",
"t",
".",
"desc",
"(",
")",
",",
"p",
".",
"peek",
"(",
")",
")",
"\n",
"}",
"\n\n",
"// Expand the repeated offsets into values.",
"sign",
"=",
"1.0",
"\n",
"if",
"p",
".",
"next",
"(",
")",
".",
"typ",
"==",
"ItemSUB",
"{",
"sign",
"=",
"-",
"1.0",
"\n",
"}",
"\n",
"offset",
":=",
"sign",
"*",
"p",
".",
"number",
"(",
"p",
".",
"expect",
"(",
"ItemNumber",
",",
"ctx",
")",
".",
"val",
")",
"\n",
"p",
".",
"expect",
"(",
"ItemTimes",
",",
"ctx",
")",
"\n\n",
"times",
",",
"err",
":=",
"strconv",
".",
"ParseUint",
"(",
"p",
".",
"expect",
"(",
"ItemNumber",
",",
"ctx",
")",
".",
"val",
",",
"10",
",",
"64",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"p",
".",
"errorf",
"(",
"\"",
"\"",
",",
"ctx",
",",
"err",
")",
"\n",
"}",
"\n\n",
"for",
"i",
":=",
"uint64",
"(",
"0",
")",
";",
"i",
"<",
"times",
";",
"i",
"++",
"{",
"k",
"+=",
"offset",
"\n",
"vals",
"=",
"append",
"(",
"vals",
",",
"sequenceValue",
"{",
"value",
":",
"k",
",",
"}",
")",
"\n",
"}",
"\n",
"// This is to ensure that there is a space between this expanding notation",
"// and the next number. This is especially required if the next number",
"// is negative.",
"if",
"t",
":=",
"p",
".",
"expectOneOf",
"(",
"ItemSpace",
",",
"ItemEOF",
",",
"ctx",
")",
".",
"typ",
";",
"t",
"==",
"ItemEOF",
"{",
"break",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"m",
",",
"vals",
",",
"nil",
"\n",
"}"
] |
4,999 | all-5000 | [
"pareCode",
"parses",
"a",
"string",
"into",
"a",
"Code",
"or",
"returns",
"0",
"if",
"the",
"parse",
"failed"
] | [
"func",
"parseCode",
"(",
"str",
"string",
")",
"Code",
"{",
"<mask>",
",",
"err",
":=",
"strconv",
".",
"Atoi",
"(",
"str",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"Code",
"(",
"0",
")",
"\n",
"}",
"\n",
"return",
"Code",
"(",
"code",
")",
"\n",
"}"
] |
Subsets and Splits
No saved queries yet
Save your SQL queries to embed, download, and access them later. Queries will appear here once saved.