id
int32 0
25.3k
| idx
stringlengths 5
9
| nl_tokens
sequencelengths 1
418
| pl_tokens
sequencelengths 22
4.98k
|
---|---|---|---|
9,900 | all-9901 | [
"GetSecretValueRequest",
"mocks",
"base",
"method"
] | [
"func",
"(",
"m",
"*",
"MockSecretsManagerAPI",
")",
"GetSecretValueRequest",
"(",
"arg0",
"*",
"secretsmanager",
".",
"GetSecretValueInput",
")",
"(",
"*",
"request",
".",
"<mask>",
",",
"*",
"secretsmanager",
".",
"GetSecretValueOutput",
")",
"{",
"ret",
":=",
"m",
".",
"ctrl",
".",
"Call",
"(",
"m",
",",
"\"",
"\"",
",",
"arg0",
")",
"\n",
"ret0",
",",
"_",
":=",
"ret",
"[",
"0",
"]",
".",
"(",
"*",
"request",
".",
"Request",
")",
"\n",
"ret1",
",",
"_",
":=",
"ret",
"[",
"1",
"]",
".",
"(",
"*",
"secretsmanager",
".",
"GetSecretValueOutput",
")",
"\n",
"return",
"ret0",
",",
"ret1",
"\n",
"}"
] |
9,901 | all-9902 | [
"TaskContainerStatsHandler",
"returns",
"the",
"handler",
"method",
"for",
"handling",
"task",
"and",
"container",
"stats",
"requests",
"."
] | [
"func",
"TaskContainerStatsHandler",
"(",
"state",
"dockerstate",
".",
"TaskEngineState",
",",
"statsEngine",
"stats",
".",
"Engine",
")",
"func",
"(",
"http",
".",
"ResponseWriter",
",",
"*",
"http",
".",
"Request",
")",
"{",
"return",
"func",
"(",
"w",
"http",
".",
"ResponseWriter",
",",
"r",
"*",
"http",
".",
"Request",
")",
"{",
"taskARN",
",",
"err",
":=",
"getTaskARNByRequest",
"(",
"r",
",",
"state",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"errResponseJSON",
",",
"_",
":=",
"json",
".",
"Marshal",
"(",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"err",
".",
"Error",
"(",
")",
")",
")",
"\n",
"utils",
".",
"WriteJSONToResponse",
"(",
"w",
",",
"<mask>",
".",
"StatusBadRequest",
",",
"errResponseJSON",
",",
"utils",
".",
"RequestTypeTaskStats",
")",
"\n",
"return",
"\n",
"}",
"\n",
"if",
"containerID",
",",
"ok",
":=",
"utils",
".",
"GetMuxValueFromRequest",
"(",
"r",
",",
"statsContainerIDMuxName",
")",
";",
"ok",
"{",
"seelog",
".",
"Infof",
"(",
"\"",
"\"",
",",
"containerID",
")",
"\n",
"WriteContainerStatsResponse",
"(",
"w",
",",
"taskARN",
",",
"containerID",
",",
"statsEngine",
")",
"\n",
"return",
"\n",
"}",
"\n\n",
"seelog",
".",
"Infof",
"(",
"\"",
"\"",
",",
"taskARN",
")",
"\n",
"WriteTaskStatsResponse",
"(",
"w",
",",
"taskARN",
",",
"state",
",",
"statsEngine",
")",
"\n",
"}",
"\n",
"}"
] |
9,902 | all-9903 | [
"Do",
"executes",
"DOM",
".",
"resolveNode",
"against",
"the",
"provided",
"context",
".",
"returns",
":",
"object",
"-",
"JavaScript",
"object",
"wrapper",
"for",
"given",
"node",
"."
] | [
"func",
"(",
"p",
"*",
"ResolveNodeParams",
")",
"Do",
"(",
"ctx",
"context",
".",
"Context",
")",
"(",
"object",
"*",
"runtime",
".",
"RemoteObject",
",",
"err",
"error",
")",
"{",
"// execute",
"var",
"<mask>",
"ResolveNodeReturns",
"\n",
"err",
"=",
"cdp",
".",
"Execute",
"(",
"ctx",
",",
"CommandResolveNode",
",",
"p",
",",
"&",
"res",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"return",
"res",
".",
"Object",
",",
"nil",
"\n",
"}"
] |
9,903 | all-9904 | [
"createHistogramBins",
"creates",
"bins",
"for",
"an",
"histogram",
".",
"The",
"bin",
"sizes",
"are",
"powers",
"of",
"two",
"of",
"the",
"form",
"[",
"2^min_exponent",
"...",
"2^max_exponent",
"]",
"."
] | [
"func",
"createHistogramBins",
"(",
"minExponent",
",",
"maxExponent",
"uint32",
")",
"[",
"]",
"int64",
"{",
"<mask>",
"bins",
"[",
"]",
"int64",
"\n",
"for",
"i",
":=",
"minExponent",
";",
"i",
"<=",
"maxExponent",
";",
"i",
"++",
"{",
"bins",
"=",
"append",
"(",
"bins",
",",
"int64",
"(",
"1",
")",
"<<",
"i",
")",
"\n",
"}",
"\n",
"return",
"bins",
"\n",
"}"
] |
9,904 | all-9905 | [
"compare",
"compares",
"two",
"versions",
"of",
"Docker",
"to",
"decipher",
"which",
"came",
"first",
".",
"compare",
"returns",
"-",
"1",
"if",
"v1",
"<",
"v2",
"1",
"if",
"v1",
">",
"v2",
"0",
"otherwise",
"."
] | [
"func",
"compare",
"(",
"v1",
",",
"v2",
"string",
")",
"int",
"{",
"// Replace RC string with \".\" to make the RC number appear as simply",
"// another sub-version.",
"v1",
"=",
"strings",
".",
"Replace",
"(",
"v1",
",",
"rcString",
",",
"\"",
"\"",
",",
"-",
"1",
")",
"\n",
"v2",
"=",
"strings",
".",
"Replace",
"(",
"v2",
",",
"rcString",
",",
"\"",
"\"",
",",
"-",
"1",
")",
"\n\n",
"// All releases before the community edition (differentiated by",
"// presence of the \"ce\" string in the version string) are \"less than\"",
"// any community edition release (first occurring in March 2017).",
"if",
"strings",
".",
"Contains",
"(",
"v1",
",",
"ceEdition",
")",
"&&",
"!",
"strings",
".",
"Contains",
"(",
"v2",
",",
"ceEdition",
")",
"{",
"return",
"1",
"\n",
"}",
"\n",
"if",
"!",
"strings",
".",
"Contains",
"(",
"v1",
",",
"ceEdition",
")",
"&&",
"strings",
".",
"Contains",
"(",
"v2",
",",
"ceEdition",
")",
"{",
"return",
"-",
"1",
"\n",
"}",
"\n\n",
"// Without this tag, both are pre-CE versions.",
"if",
"!",
"strings",
".",
"Contains",
"(",
"v1",
",",
"ceEdition",
")",
"&&",
"!",
"strings",
".",
"Contains",
"(",
"v2",
",",
"ceEdition",
")",
"{",
"return",
"compareNumeric",
"(",
"v1",
",",
"v2",
")",
"\n",
"}",
"\n\n",
"<mask>",
"compareCE",
"(",
"v1",
",",
"v2",
")",
"\n",
"}"
] |
9,905 | all-9906 | [
"Set",
"creates",
"a",
"new",
"cache",
"file",
"to",
"store",
"the",
"ByteCode",
"."
] | [
"func",
"(",
"c",
"*",
"FileCache",
")",
"Set",
"(",
"<mask>",
"string",
",",
"entity",
"*",
"CacheEntity",
")",
"error",
"{",
"path",
":=",
"c",
".",
"GetCachePath",
"(",
"key",
")",
"\n",
"if",
"err",
":=",
"os",
".",
"MkdirAll",
"(",
"filepath",
".",
"Dir",
"(",
"path",
")",
",",
"0777",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"errors",
".",
"Wrap",
"(",
"err",
",",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"// Need to avoid race condition",
"file",
",",
"err",
":=",
"os",
".",
"OpenFile",
"(",
"path",
",",
"os",
".",
"O_WRONLY",
"|",
"os",
".",
"O_CREATE",
",",
"0666",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"errors",
".",
"Wrap",
"(",
"err",
",",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"defer",
"file",
".",
"Close",
"(",
")",
"\n\n",
"f",
":=",
"bufio",
".",
"NewWriter",
"(",
"file",
")",
"\n",
"defer",
"f",
".",
"Flush",
"(",
")",
"\n",
"enc",
":=",
"gob",
".",
"NewEncoder",
"(",
"f",
")",
"\n",
"if",
"err",
"=",
"enc",
".",
"Encode",
"(",
"entity",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"errors",
".",
"Wrap",
"(",
"err",
",",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"return",
"nil",
"\n",
"}"
] |
9,906 | all-9907 | [
"GoTemplateEngine",
"implements",
"the",
"TemplateEngine",
"interface",
"for",
"using",
"standard",
"Go",
"templates"
] | [
"func",
"GoTemplateEngine",
"(",
"input",
"string",
",",
"data",
"map",
"[",
"string",
"]",
"interface",
"{",
"}",
",",
"helpers",
"map",
"[",
"string",
"]",
"interface",
"{",
"}",
")",
"(",
"string",
",",
"error",
")",
"{",
"// since go templates don't have the concept of an optional map argument like Plush does",
"// add this \"null\" map so it can be used in templates like this:",
"// {{ partial \"flash.html\" .nilOpts }}",
"data",
"[",
"\"",
"\"",
"]",
"=",
"map",
"[",
"string",
"]",
"interface",
"{",
"}",
"{",
"}",
"\n\n",
"t",
":=",
"template",
".",
"New",
"(",
"input",
")",
"\n",
"if",
"helpers",
"!=",
"nil",
"{",
"t",
"=",
"t",
".",
"Funcs",
"(",
"helpers",
")",
"\n",
"}",
"\n\n",
"t",
",",
"err",
":=",
"t",
".",
"Parse",
"(",
"input",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"\"",
"\"",
",",
"err",
"\n",
"}",
"\n\n",
"bb",
":=",
"&",
"bytes",
".",
"<mask>",
"{",
"}",
"\n",
"err",
"=",
"t",
".",
"Execute",
"(",
"bb",
",",
"data",
")",
"\n",
"return",
"bb",
".",
"String",
"(",
")",
",",
"err",
"\n",
"}"
] |
9,907 | all-9908 | [
"Do",
"executes",
"Animation",
".",
"releaseAnimations",
"against",
"the",
"provided",
"context",
"."
] | [
"func",
"(",
"p",
"*",
"ReleaseAnimationsParams",
")",
"Do",
"(",
"ctx",
"<mask>",
".",
"Context",
")",
"(",
"err",
"error",
")",
"{",
"return",
"cdp",
".",
"Execute",
"(",
"ctx",
",",
"CommandReleaseAnimations",
",",
"p",
",",
"nil",
")",
"\n",
"}"
] |
9,908 | all-9909 | [
"DiffFile",
"returns",
"the",
"difference",
"between",
"2",
"paths",
"old",
"path",
"may",
"be",
"omitted",
"in",
"which",
"case",
"the",
"parent",
"of",
"the",
"new",
"path",
"will",
"be",
"used",
".",
"DiffFile",
"return",
"2",
"values",
"(",
"unless",
"it",
"returns",
"an",
"error",
")",
"the",
"first",
"value",
"is",
"files",
"present",
"under",
"new",
"path",
"the",
"second",
"is",
"files",
"present",
"under",
"old",
"path",
"files",
"which",
"are",
"under",
"both",
"paths",
"and",
"have",
"identical",
"content",
"are",
"omitted",
"."
] | [
"func",
"(",
"c",
"APIClient",
")",
"DiffFile",
"(",
"newRepoName",
",",
"newCommitID",
",",
"newPath",
",",
"oldRepoName",
",",
"oldCommitID",
",",
"oldPath",
"string",
",",
"shallow",
"bool",
")",
"(",
"[",
"]",
"*",
"pfs",
".",
"FileInfo",
",",
"[",
"]",
"*",
"pfs",
".",
"FileInfo",
",",
"error",
")",
"{",
"var",
"oldFile",
"*",
"pfs",
".",
"<mask>",
"\n",
"if",
"oldRepoName",
"!=",
"\"",
"\"",
"{",
"oldFile",
"=",
"NewFile",
"(",
"oldRepoName",
",",
"oldCommitID",
",",
"oldPath",
")",
"\n",
"}",
"\n",
"resp",
",",
"err",
":=",
"c",
".",
"PfsAPIClient",
".",
"DiffFile",
"(",
"c",
".",
"Ctx",
"(",
")",
",",
"&",
"pfs",
".",
"DiffFileRequest",
"{",
"NewFile",
":",
"NewFile",
"(",
"newRepoName",
",",
"newCommitID",
",",
"newPath",
")",
",",
"OldFile",
":",
"oldFile",
",",
"Shallow",
":",
"shallow",
",",
"}",
",",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"nil",
",",
"grpcutil",
".",
"ScrubGRPC",
"(",
"err",
")",
"\n",
"}",
"\n",
"return",
"resp",
".",
"NewFiles",
",",
"resp",
".",
"OldFiles",
",",
"nil",
"\n",
"}"
] |
9,909 | all-9910 | [
"MarshalStr",
"is",
"like",
"Marhal",
"but",
"returns",
"a",
"string",
"."
] | [
"func",
"MarshalStr",
"(",
"n",
"tree",
".",
"Node",
")",
"(",
"string",
",",
"error",
")",
"{",
"ret",
":=",
"bytes",
".",
"NewBufferString",
"(",
"\"",
"\"",
")",
"\n",
"err",
":=",
"marshal",
"(",
"n",
",",
"ret",
")",
"\n\n",
"return",
"ret",
".",
"<mask>",
"(",
")",
",",
"err",
"\n",
"}"
] |
9,910 | all-9911 | [
"Set",
"is",
"required",
"for",
"kingpin",
"interfaces",
"to",
"allow",
"command",
"line",
"params",
"to",
"be",
"set",
"to",
"our",
"map",
"datatype"
] | [
"func",
"(",
"o",
"*",
"ListUint16Option",
")",
"Set",
"(",
"value",
"string",
")",
"error",
"{",
"val",
":=",
"Uint16Option",
"{",
"}",
"\n",
"val",
".",
"Set",
"(",
"<mask>",
")",
"\n",
"*",
"o",
"=",
"append",
"(",
"*",
"o",
",",
"val",
")",
"\n",
"return",
"nil",
"\n",
"}"
] |
9,911 | all-9912 | [
"ContainsName",
"returns",
"true",
"if",
"this",
"registry",
"contains",
"the",
"specified",
"name"
] | [
"func",
"(",
"f",
"*",
"defaultFormats",
")",
"ContainsName",
"(",
"name",
"string",
")",
"bool",
"{",
"f",
".",
"Lock",
"(",
")",
"\n",
"defer",
"f",
".",
"Unlock",
"(",
")",
"\n",
"nme",
":=",
"f",
".",
"normalizeName",
"(",
"<mask>",
")",
"\n",
"for",
"_",
",",
"v",
":=",
"range",
"f",
".",
"data",
"{",
"if",
"v",
".",
"Name",
"==",
"nme",
"{",
"return",
"true",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"false",
"\n",
"}"
] |
9,912 | all-9913 | [
"trimPrefix",
"removes",
"a",
"given",
"prefix",
"and",
"any",
"slash",
"following",
"the",
"prefix",
"e",
".",
"g",
".",
":",
"trimPrefix",
"(",
"foo",
"foo",
")",
"==",
"trimPrefix",
"(",
"foo",
"/",
"foo",
")",
"=="
] | [
"func",
"trimPrefix",
"(",
"p",
",",
"<mask>",
"string",
")",
"(",
"s",
"string",
")",
"{",
"s",
"=",
"strings",
".",
"TrimPrefix",
"(",
"p",
",",
"prefix",
")",
"\n",
"s",
"=",
"strings",
".",
"TrimPrefix",
"(",
"s",
",",
"\"",
"\"",
")",
"\n",
"return",
"\n",
"}"
] |
9,913 | all-9914 | [
"SortKeys",
"sorts",
"a",
"list",
"of",
"map",
"keys",
"deduplicating",
"keys",
"if",
"necessary",
".",
"The",
"type",
"of",
"each",
"value",
"must",
"be",
"comparable",
"."
] | [
"func",
"SortKeys",
"(",
"vs",
"[",
"]",
"reflect",
".",
"Value",
")",
"[",
"]",
"reflect",
".",
"Value",
"{",
"if",
"len",
"(",
"vs",
")",
"==",
"0",
"{",
"return",
"vs",
"\n",
"}",
"\n\n",
"// Sort the map keys.",
"sort",
".",
"Slice",
"(",
"vs",
",",
"func",
"(",
"i",
",",
"j",
"int",
")",
"bool",
"{",
"return",
"isLess",
"(",
"vs",
"[",
"i",
"]",
",",
"vs",
"[",
"j",
"]",
")",
"}",
")",
"\n\n",
"// Deduplicate keys (fails for NaNs).",
"vs2",
":=",
"vs",
"[",
":",
"1",
"]",
"\n",
"for",
"_",
",",
"v",
":=",
"range",
"vs",
"[",
"1",
":",
"]",
"{",
"if",
"isLess",
"(",
"vs2",
"[",
"len",
"(",
"vs2",
")",
"-",
"1",
"]",
",",
"v",
")",
"{",
"vs2",
"=",
"<mask>",
"(",
"vs2",
",",
"v",
")",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"vs2",
"\n",
"}"
] |
9,914 | all-9915 | [
"UpdateContactGroup",
"updates",
"passed",
"contact",
"group",
"."
] | [
"func",
"(",
"a",
"*",
"API",
")",
"UpdateContactGroup",
"(",
"cfg",
"*",
"ContactGroup",
")",
"(",
"*",
"ContactGroup",
",",
"error",
")",
"{",
"if",
"cfg",
"==",
"nil",
"{",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"groupCID",
":=",
"string",
"(",
"cfg",
".",
"CID",
")",
"\n\n",
"matched",
",",
"err",
":=",
"regexp",
".",
"MatchString",
"(",
"config",
".",
"ContactGroupCIDRegex",
",",
"groupCID",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"if",
"!",
"matched",
"{",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"groupCID",
")",
"\n",
"}",
"\n\n",
"jsonCfg",
",",
"err",
":=",
"json",
".",
"Marshal",
"(",
"cfg",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"if",
"a",
".",
"Debug",
"{",
"a",
".",
"Log",
".",
"Printf",
"(",
"\"",
"\"",
",",
"string",
"(",
"jsonCfg",
")",
")",
"\n",
"}",
"\n\n",
"result",
",",
"err",
":=",
"a",
".",
"Put",
"(",
"groupCID",
",",
"jsonCfg",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"group",
":=",
"&",
"ContactGroup",
"{",
"}",
"\n",
"if",
"err",
":=",
"json",
".",
"Unmarshal",
"(",
"result",
",",
"group",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"return",
"<mask>",
",",
"nil",
"\n",
"}"
] |
9,915 | all-9916 | [
"init",
"fileLogger",
"split",
"by",
"daily"
] | [
"func",
"(",
"f",
"*",
"FileLogger",
")",
"initLoggerByDaily",
"(",
")",
"{",
"t",
",",
"_",
":=",
"time",
".",
"Parse",
"(",
"DATEFORMAT",
",",
"<mask>",
".",
"Now",
"(",
")",
".",
"Format",
"(",
"DATEFORMAT",
")",
")",
"\n\n",
"f",
".",
"date",
"=",
"&",
"t",
"\n",
"f",
".",
"mu",
".",
"Lock",
"(",
")",
"\n",
"defer",
"f",
".",
"mu",
".",
"Unlock",
"(",
")",
"\n\n",
"logFile",
":=",
"joinFilePath",
"(",
"f",
".",
"fileDir",
",",
"f",
".",
"fileName",
")",
"\n",
"if",
"!",
"f",
".",
"isMustSplit",
"(",
")",
"{",
"if",
"!",
"isExist",
"(",
"f",
".",
"fileDir",
")",
"{",
"os",
".",
"Mkdir",
"(",
"f",
".",
"fileDir",
",",
"0755",
")",
"\n",
"}",
"\n",
"f",
".",
"logFile",
",",
"_",
"=",
"os",
".",
"OpenFile",
"(",
"logFile",
",",
"os",
".",
"O_RDWR",
"|",
"os",
".",
"O_APPEND",
"|",
"os",
".",
"O_CREATE",
",",
"0666",
")",
"\n",
"f",
".",
"lg",
"=",
"log",
".",
"New",
"(",
"f",
".",
"logFile",
",",
"f",
".",
"prefix",
",",
"log",
".",
"LstdFlags",
"|",
"log",
".",
"Lmicroseconds",
")",
"\n",
"}",
"else",
"{",
"f",
".",
"split",
"(",
")",
"\n",
"}",
"\n\n",
"go",
"f",
".",
"logWriter",
"(",
")",
"\n",
"go",
"f",
".",
"fileMonitor",
"(",
")",
"\n",
"}"
] |
9,916 | all-9917 | [
"UnmarshalJSON",
"supports",
"json",
".",
"Unmarshaler",
"interface"
] | [
"func",
"(",
"v",
"*",
"GetWindowForTargetReturns",
")",
"UnmarshalJSON",
"(",
"data",
"[",
"]",
"<mask>",
")",
"error",
"{",
"r",
":=",
"jlexer",
".",
"Lexer",
"{",
"Data",
":",
"data",
"}",
"\n",
"easyjsonC5a4559bDecodeGithubComChromedpCdprotoBrowser5",
"(",
"&",
"r",
",",
"v",
")",
"\n",
"return",
"r",
".",
"Error",
"(",
")",
"\n",
"}"
] |
9,917 | all-9918 | [
"===",
"label_join",
"(",
"vector",
"model",
".",
"ValVector",
"dest_labelname",
"separator",
"src_labelname",
"...",
")",
"Vector",
"==="
] | [
"func",
"funcLabelJoin",
"(",
"vals",
"[",
"]",
"Value",
",",
"args",
"Expressions",
",",
"enh",
"*",
"EvalNodeHelper",
")",
"Vector",
"{",
"var",
"(",
"vector",
"=",
"vals",
"[",
"0",
"]",
".",
"(",
"<mask>",
")",
"\n",
"dst",
"=",
"args",
"[",
"1",
"]",
".",
"(",
"*",
"StringLiteral",
")",
".",
"Val",
"\n",
"sep",
"=",
"args",
"[",
"2",
"]",
".",
"(",
"*",
"StringLiteral",
")",
".",
"Val",
"\n",
"srcLabels",
"=",
"make",
"(",
"[",
"]",
"string",
",",
"len",
"(",
"args",
")",
"-",
"3",
")",
"\n",
")",
"\n\n",
"if",
"enh",
".",
"dmn",
"==",
"nil",
"{",
"enh",
".",
"dmn",
"=",
"make",
"(",
"map",
"[",
"uint64",
"]",
"labels",
".",
"Labels",
",",
"len",
"(",
"enh",
".",
"out",
")",
")",
"\n",
"}",
"\n\n",
"for",
"i",
":=",
"3",
";",
"i",
"<",
"len",
"(",
"args",
")",
";",
"i",
"++",
"{",
"src",
":=",
"args",
"[",
"i",
"]",
".",
"(",
"*",
"StringLiteral",
")",
".",
"Val",
"\n",
"if",
"!",
"model",
".",
"LabelName",
"(",
"src",
")",
".",
"IsValid",
"(",
")",
"{",
"panic",
"(",
"errors",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"src",
")",
")",
"\n",
"}",
"\n",
"srcLabels",
"[",
"i",
"-",
"3",
"]",
"=",
"src",
"\n",
"}",
"\n\n",
"if",
"!",
"model",
".",
"LabelName",
"(",
"dst",
")",
".",
"IsValid",
"(",
")",
"{",
"panic",
"(",
"errors",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"dst",
")",
")",
"\n",
"}",
"\n\n",
"srcVals",
":=",
"make",
"(",
"[",
"]",
"string",
",",
"len",
"(",
"srcLabels",
")",
")",
"\n",
"for",
"_",
",",
"el",
":=",
"range",
"vector",
"{",
"h",
":=",
"el",
".",
"Metric",
".",
"Hash",
"(",
")",
"\n",
"var",
"outMetric",
"labels",
".",
"Labels",
"\n",
"if",
"l",
",",
"ok",
":=",
"enh",
".",
"dmn",
"[",
"h",
"]",
";",
"ok",
"{",
"outMetric",
"=",
"l",
"\n",
"}",
"else",
"{",
"for",
"i",
",",
"src",
":=",
"range",
"srcLabels",
"{",
"srcVals",
"[",
"i",
"]",
"=",
"el",
".",
"Metric",
".",
"Get",
"(",
"src",
")",
"\n",
"}",
"\n\n",
"lb",
":=",
"labels",
".",
"NewBuilder",
"(",
"el",
".",
"Metric",
")",
"\n\n",
"strval",
":=",
"strings",
".",
"Join",
"(",
"srcVals",
",",
"sep",
")",
"\n",
"if",
"strval",
"==",
"\"",
"\"",
"{",
"lb",
".",
"Del",
"(",
"dst",
")",
"\n",
"}",
"else",
"{",
"lb",
".",
"Set",
"(",
"dst",
",",
"strval",
")",
"\n",
"}",
"\n\n",
"outMetric",
"=",
"lb",
".",
"Labels",
"(",
")",
"\n",
"enh",
".",
"dmn",
"[",
"h",
"]",
"=",
"outMetric",
"\n",
"}",
"\n\n",
"enh",
".",
"out",
"=",
"append",
"(",
"enh",
".",
"out",
",",
"Sample",
"{",
"Metric",
":",
"outMetric",
",",
"Point",
":",
"Point",
"{",
"V",
":",
"el",
".",
"Point",
".",
"V",
"}",
",",
"}",
")",
"\n",
"}",
"\n",
"return",
"enh",
".",
"out",
"\n",
"}"
] |
9,918 | all-9919 | [
"GetLogQuery",
"returns",
"the",
"LogQuery",
"field",
"if",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"."
] | [
"func",
"(",
"s",
"*",
"ScatterplotRequest",
")",
"GetLogQuery",
"(",
")",
"WidgetApmOrLogQuery",
"{",
"if",
"s",
"==",
"nil",
"||",
"s",
".",
"LogQuery",
"==",
"nil",
"{",
"return",
"WidgetApmOrLogQuery",
"{",
"}",
"\n",
"}",
"\n",
"<mask>",
"*",
"s",
".",
"LogQuery",
"\n",
"}"
] |
9,919 | all-9920 | [
"IsMember",
"returns",
"true",
"if",
"user",
"is",
"in",
"org",
"."
] | [
"func",
"(",
"f",
"*",
"FakeClient",
")",
"IsMember",
"(",
"org",
",",
"user",
"string",
")",
"(",
"bool",
",",
"error",
")",
"{",
"for",
"_",
",",
"m",
":=",
"range",
"f",
".",
"OrgMembers",
"[",
"org",
"]",
"{",
"if",
"m",
"==",
"<mask>",
"{",
"return",
"true",
",",
"nil",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"false",
",",
"nil",
"\n",
"}"
] |
9,920 | all-9921 | [
"GetType",
"returns",
"the",
"Type",
"field",
"if",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"."
] | [
"func",
"(",
"s",
"*",
"ScatterplotDefinition",
")",
"GetType",
"(",
")",
"string",
"{",
"if",
"s",
"==",
"nil",
"||",
"s",
".",
"<mask>",
"==",
"nil",
"{",
"return",
"\"",
"\"",
"\n",
"}",
"\n",
"return",
"*",
"s",
".",
"Type",
"\n",
"}"
] |
9,921 | all-9922 | [
"Return",
"true",
"if",
"the",
"input",
"word",
"is",
"a",
"Spanish",
"stop",
"word",
"."
] | [
"func",
"isStopWord",
"(",
"word",
"string",
")",
"bool",
"{",
"switch",
"word",
"{",
"<mask>",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
",",
" ",
"p",
",",
" ",
"s",
",",
" ",
"l",
",",
" ",
"y",
",",
" ",
"o",
",",
" ",
"e",
",",
" ",
"s",
" ",
"\"",
"o",
" ",
"\"",
"s",
"",
"",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
",",
" ",
"m",
",",
" ",
"h",
",",
"",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
",",
" ",
"a",
",",
" ",
"a",
",",
" ",
"q",
" ",
"\"",
"n",
" ",
"\"",
"o",
" ",
"\"",
"t",
"",
"",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
",",
" ",
"t",
",",
" ",
"e",
",",
" ",
"e",
",",
" ",
"m",
",",
" ",
"q",
",",
"",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
",",
" ",
"t",
",",
" ",
"t",
",",
" ",
"t",
",",
" ",
"t",
",",
" ",
"e",
",",
"",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
",",
" ",
"m",
" ",
"\"",
"í",
"\"",
"m",
"a",
"",
"",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
",",
" ",
"e",
" ",
"\"",
"s",
"",
"",
"\"",
",",
" ",
"e",
" ",
"\"",
"s",
"\"",
"e",
"t",
"e",
"s",
"e",
"e",
"s",
"é",
"s",
"t",
"n",
"t",
"a",
"é",
"",
"",
"\"",
",",
" ",
"e",
" ",
"\"",
"s",
" ",
"\"",
"s",
"\"",
"e",
"t",
"e",
"s",
"a",
"",
"",
"\"",
",",
" ",
"e",
" ",
"\"",
"s",
"\"",
"e",
"t",
"e",
"s",
"a",
"e",
"s",
"a",
"",
"",
"\"",
",",
" ",
"e",
",",
" ",
"e",
",",
" ",
"e",
",",
" ",
"e",
",",
" ",
"e",
",",
"",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
",",
" ",
"e",
",",
" ",
"e",
",",
" ",
"e",
",",
" ",
"e",
",",
"",
"\"",
",",
" ",
"e",
",",
" ",
"e",
",",
" ",
"e",
",",
" ",
"e",
",",
"",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
",",
" ",
"h",
",",
" ",
"h",
",",
" ",
"h",
",",
" ",
"h",
",",
" ",
"h",
" ",
"\"",
"a",
"",
"",
"\"",
",",
" ",
"h",
" ",
"\"",
"a",
"\"",
"h",
"b",
"\"",
"h",
"b",
"h",
"a",
"r",
"a",
"b",
"í",
"",
"",
"\"",
",",
" ",
"h",
" ",
"\"",
"a",
"\"",
"h",
"b",
"h",
"a",
"í",
"a",
"b",
"a",
"",
"",
"\"",
",",
" ",
"h",
" ",
"\"",
"a",
"\"",
"h",
"b",
"\"",
"h",
"b",
"\"",
"h",
"b",
"\"",
"h",
"b",
"",
"",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
",",
" ",
"h",
",",
"",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
",",
" ",
"h",
",",
" ",
"h",
",",
"",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
",",
" ",
"s",
",",
"",
"\"",
",",
" ",
"s",
" ",
"\"",
"e",
"\"",
"s",
"r",
"\"",
"s",
"r",
"s",
"e",
"á",
"e",
"r",
"a",
"r",
"í",
"s",
"",
"",
"\"",
",",
" ",
"s",
" ",
"\"",
"e",
"\"",
"e",
"a",
"\"",
"e",
"a",
"\"",
"é",
"a",
"e",
"r",
"i",
"",
"",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
",",
" ",
"f",
",",
" ",
"f",
",",
" ",
"f",
",",
" ",
"f",
",",
" ",
"f",
"",
"",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
",",
" ",
"t",
",",
" ",
"t",
",",
" ",
"t",
",",
" ",
"t",
",",
" ",
"t",
" ",
"\"",
"e",
"",
"",
"\"",
",",
" ",
"t",
" ",
"\"",
"e",
"\"",
"t",
"n",
"\"",
"t",
"n",
"t",
"e",
"d",
"",
"",
"\"",
",",
" ",
"t",
" ",
"\"",
"e",
"\"",
"t",
"n",
"t",
"e",
"d",
"e",
"n",
"a",
"",
"",
"\"",
",",
" ",
"t",
" ",
"\"",
"e",
"\"",
"t",
"n",
"t",
"u",
"e",
"t",
"u",
"i",
"t",
"u",
"o",
"",
"",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
",",
"",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
",",
" ",
"t",
",",
"",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
":",
"return",
"true",
"\n",
"}",
"\n",
"return",
"false",
"\n",
"}"
] |
9,922 | all-9923 | [
"Reduce",
"reduces",
"the",
"ResultSet",
"into",
"buckets",
"defined",
"by",
"the",
"given",
"interval"
] | [
"func",
"(",
"r",
"ResultSet",
")",
"Reduce",
"(",
"interval",
"time",
".",
"Duration",
")",
"[",
"]",
"ResultSet",
"{",
"sort",
".",
"Sort",
"(",
"r",
")",
"\n\n",
"start",
":=",
"r",
"[",
"0",
"]",
".",
"Timestamp",
"\n",
"end",
":=",
"r",
"[",
"len",
"(",
"r",
")",
"-",
"1",
"]",
".",
"Timestamp",
"\n\n",
"// create the buckets",
"bucketCount",
":=",
"getBucketCount",
"(",
"start",
",",
"end",
",",
"interval",
")",
"\n",
"buckets",
":=",
"make",
"(",
"[",
"]",
"ResultSet",
",",
"bucketCount",
")",
"\n\n",
"for",
"_",
",",
"result",
":=",
"<mask>",
"r",
"{",
"currentBucket",
":=",
"getBucketNumber",
"(",
"result",
".",
"Timestamp",
",",
"start",
",",
"end",
",",
"interval",
",",
"bucketCount",
")",
"\n",
"buckets",
"[",
"currentBucket",
"]",
"=",
"append",
"(",
"buckets",
"[",
"currentBucket",
"]",
",",
"result",
")",
"\n",
"}",
"\n\n",
"return",
"buckets",
"\n",
"}"
] |
9,923 | all-9924 | [
"NewLeaseKeepAliveCommand",
"returns",
"the",
"cobra",
"command",
"for",
"lease",
"keep",
"-",
"alive",
"."
] | [
"func",
"NewLeaseKeepAliveCommand",
"(",
")",
"*",
"cobra",
".",
"Command",
"{",
"lc",
":=",
"&",
"cobra",
".",
"Command",
"{",
"Use",
":",
"\"",
"\"",
",",
"Short",
":",
"\"",
"\"",
",",
"Run",
":",
"leaseKeepAliveCommandFunc",
",",
"}",
"\n\n",
"lc",
".",
"Flags",
"(",
")",
".",
"BoolVar",
"(",
"&",
"leaseKeepAliveOnce",
",",
"\"",
"\"",
",",
"<mask>",
",",
"\"",
"\"",
")",
"\n\n",
"return",
"lc",
"\n",
"}"
] |
9,924 | all-9925 | [
"Ancestor",
"returns",
"a",
"derivative",
"query",
"with",
"an",
"ancestor",
"filter",
".",
"The",
"ancestor",
"should",
"not",
"be",
"nil",
"."
] | [
"func",
"(",
"q",
"*",
"Query",
")",
"Ancestor",
"(",
"ancestor",
"*",
"Key",
")",
"*",
"Query",
"{",
"q",
"=",
"q",
".",
"<mask>",
"(",
")",
"\n",
"if",
"ancestor",
"==",
"nil",
"{",
"q",
".",
"err",
"=",
"errors",
".",
"New",
"(",
"\"",
"\"",
")",
"\n",
"return",
"q",
"\n",
"}",
"\n",
"q",
".",
"ancestor",
"=",
"ancestor",
"\n",
"return",
"q",
"\n",
"}"
] |
9,925 | all-9926 | [
"Set",
"is",
"required",
"for",
"kingpin",
"interfaces",
"to",
"allow",
"command",
"line",
"params",
"to",
"be",
"set",
"to",
"our",
"map",
"datatype"
] | [
"func",
"(",
"o",
"*",
"MapComplex64Option",
")",
"Set",
"(",
"<mask>",
"string",
")",
"error",
"{",
"parts",
":=",
"stringMapRegex",
".",
"Split",
"(",
"value",
",",
"2",
")",
"\n",
"if",
"len",
"(",
"parts",
")",
"!=",
"2",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"value",
")",
"\n",
"}",
"\n",
"val",
":=",
"Complex64Option",
"{",
"}",
"\n",
"val",
".",
"Set",
"(",
"parts",
"[",
"1",
"]",
")",
"\n",
"(",
"*",
"o",
")",
"[",
"parts",
"[",
"0",
"]",
"]",
"=",
"val",
"\n",
"return",
"nil",
"\n",
"}"
] |
9,926 | all-9927 | [
"AddLabel",
"is",
"a",
"convenience",
"function",
"to",
"add",
"a",
"new",
"label",
"to",
"a",
"window",
".",
"It",
"wraps",
"the",
"AddWidget",
"call",
".",
"AddLabel",
"must",
"be",
"called",
"from",
"queue",
"."
] | [
"func",
"(",
"w",
"*",
"Window",
")",
"AddLabel",
"(",
"x",
",",
"y",
"int",
",",
"format",
"string",
",",
"args",
"...",
"interface",
"{",
"}",
")",
"*",
"<mask>",
"{",
"// we can ignore error for builtins",
"l",
",",
"_",
":=",
"w",
".",
"AddWidget",
"(",
"WidgetLabel",
",",
"x",
",",
"y",
")",
"\n",
"label",
":=",
"l",
".",
"(",
"*",
"Label",
")",
"\n",
"label",
".",
"Resize",
"(",
")",
"\n",
"label",
".",
"SetAttributes",
"(",
"defaultAttributes",
"(",
")",
")",
"\n",
"label",
".",
"SetText",
"(",
"format",
",",
"args",
"...",
")",
"\n\n",
"return",
"label",
"\n",
"}"
] |
9,927 | all-9928 | [
"expandCPUCountConfig",
"is",
"a",
"helper",
"for",
"expandVirtualMachineConfigSpec",
"that",
"determines",
"if",
"we",
"need",
"to",
"restart",
"the",
"VM",
"due",
"to",
"a",
"change",
"in",
"CPU",
"count",
".",
"This",
"is",
"determined",
"by",
"the",
"net",
"change",
"in",
"CPU",
"count",
"and",
"the",
"pre",
"-",
"update",
"values",
"of",
"cpu_hot_add_enabled",
"and",
"cpu_hot_remove_enabled",
".",
"The",
"pre",
"-",
"update",
"value",
"is",
"important",
"here",
"as",
"while",
"CPU",
"hot",
"-",
"add",
"/",
"remove",
"is",
"supported",
"while",
"the",
"values",
"are",
"enabled",
"on",
"the",
"virtual",
"machine",
"modification",
"of",
"hot",
"-",
"add",
"/",
"remove",
"themselves",
"is",
"an",
"operation",
"that",
"requires",
"a",
"power",
"down",
"of",
"the",
"VM",
"."
] | [
"func",
"expandCPUCountConfig",
"(",
"d",
"*",
"schema",
".",
"ResourceData",
")",
"int32",
"{",
"occ",
",",
"ncc",
":=",
"d",
".",
"GetChange",
"(",
"\"",
"\"",
")",
"\n",
"cha",
",",
"_",
":=",
"d",
".",
"GetChange",
"(",
"\"",
"\"",
")",
"\n",
"currentHotAdd",
":=",
"cha",
".",
"(",
"bool",
")",
"\n",
"chr",
",",
"_",
":=",
"d",
".",
"GetChange",
"(",
"\"",
"\"",
")",
"\n",
"currentHotRemove",
":=",
"chr",
".",
"(",
"bool",
")",
"\n",
"oldCPUCount",
":=",
"int32",
"(",
"occ",
".",
"(",
"int",
")",
")",
"\n",
"newCPUCount",
":=",
"int32",
"(",
"ncc",
".",
"(",
"int",
")",
")",
"\n\n",
"switch",
"{",
"case",
"oldCPUCount",
"<",
"newCPUCount",
":",
"// Adding CPUs",
"if",
"!",
"currentHotAdd",
"{",
"log",
".",
"Printf",
"(",
"\"",
"\"",
",",
"resourceVSphereVirtualMachineIDString",
"(",
"d",
")",
")",
"\n",
"d",
".",
"Set",
"(",
"\"",
"\"",
",",
"true",
")",
"\n",
"}",
"\n",
"<mask>",
"oldCPUCount",
">",
"newCPUCount",
":",
"// Removing CPUs",
"if",
"!",
"currentHotRemove",
"{",
"log",
".",
"Printf",
"(",
"\"",
"\"",
",",
"resourceVSphereVirtualMachineIDString",
"(",
"d",
")",
")",
"\n",
"d",
".",
"Set",
"(",
"\"",
"\"",
",",
"true",
")",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"newCPUCount",
"\n",
"}"
] |
9,928 | all-9929 | [
"IsConnected",
"mocks",
"base",
"method"
] | [
"func",
"(",
"m",
"*",
"MockClientServer",
")",
"IsConnected",
"(",
")",
"bool",
"{",
"<mask>",
":=",
"m",
".",
"ctrl",
".",
"Call",
"(",
"m",
",",
"\"",
"\"",
")",
"\n",
"ret0",
",",
"_",
":=",
"ret",
"[",
"0",
"]",
".",
"(",
"bool",
")",
"\n",
"return",
"ret0",
"\n",
"}"
] |
9,929 | all-9930 | [
"helper",
"func",
"to",
"check",
"whether",
"two",
"lists",
"of",
"(",
"distinct",
")",
"strings",
"matches",
"without",
"order"
] | [
"func",
"matchWithoutOrder",
"(",
"a1",
",",
"a2",
"[",
"]",
"string",
")",
"bool",
"{",
"if",
"len",
"(",
"a1",
")",
"!=",
"len",
"(",
"a2",
")",
"{",
"return",
"false",
"\n",
"}",
"\n\n",
"m",
":=",
"make",
"(",
"map",
"[",
"string",
"]",
"bool",
")",
"\n\n",
"for",
"_",
",",
"x",
":=",
"<mask>",
"a1",
"{",
"m",
"[",
"x",
"]",
"=",
"true",
"\n",
"}",
"\n\n",
"for",
"_",
",",
"y",
":=",
"range",
"a2",
"{",
"if",
"_",
",",
"ok",
":=",
"m",
"[",
"y",
"]",
";",
"!",
"ok",
"{",
"return",
"false",
"\n",
"}",
"\n",
"}",
"\n\n",
"return",
"true",
"\n",
"}"
] |
9,930 | all-9931 | [
"Reply",
"sends",
"a",
"message",
"to",
"where",
"the",
"message",
"came",
"from",
"(",
"user",
"or",
"channel",
")"
] | [
"func",
"(",
"bot",
"*",
"Bot",
")",
"Reply",
"(",
"m",
"*",
"Message",
",",
"<mask>",
"string",
")",
"{",
"var",
"target",
"string",
"\n",
"if",
"strings",
".",
"Contains",
"(",
"m",
".",
"To",
",",
"\"",
"\"",
")",
"{",
"target",
"=",
"m",
".",
"To",
"\n",
"}",
"else",
"{",
"target",
"=",
"m",
".",
"From",
"\n",
"}",
"\n",
"bot",
".",
"Msg",
"(",
"target",
",",
"text",
")",
"\n",
"}"
] |
9,931 | all-9932 | [
"roleGrantPermissionCommandFunc",
"executes",
"the",
"role",
"grant",
"-",
"permission",
"command",
"."
] | [
"func",
"roleGrantPermissionCommandFunc",
"(",
"cmd",
"*",
"cobra",
".",
"Command",
",",
"args",
"[",
"]",
"string",
")",
"{",
"if",
"len",
"(",
"args",
")",
"<",
"3",
"{",
"ExitWithError",
"(",
"ExitBadArgs",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
")",
")",
"\n",
"}",
"\n\n",
"perm",
",",
"err",
":=",
"clientv3",
".",
"StrToPermissionType",
"(",
"args",
"[",
"1",
"]",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"ExitWithError",
"(",
"ExitBadArgs",
",",
"err",
")",
"\n",
"}",
"\n\n",
"<mask>",
",",
"rangeEnd",
":=",
"permRange",
"(",
"args",
"[",
"2",
":",
"]",
")",
"\n",
"resp",
",",
"err",
":=",
"mustClientFromCmd",
"(",
"cmd",
")",
".",
"Auth",
".",
"RoleGrantPermission",
"(",
"context",
".",
"TODO",
"(",
")",
",",
"args",
"[",
"0",
"]",
",",
"key",
",",
"rangeEnd",
",",
"perm",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"ExitWithError",
"(",
"ExitError",
",",
"err",
")",
"\n",
"}",
"\n\n",
"display",
".",
"RoleGrantPermission",
"(",
"args",
"[",
"0",
"]",
",",
"*",
"resp",
")",
"\n",
"}"
] |
9,932 | all-9933 | [
"HasApmQuery",
"returns",
"a",
"boolean",
"if",
"a",
"field",
"has",
"been",
"set",
"."
] | [
"func",
"(",
"h",
"*",
"HeatmapRequest",
")",
"HasApmQuery",
"(",
")",
"bool",
"{",
"if",
"h",
"!=",
"nil",
"&&",
"h",
".",
"ApmQuery",
"!=",
"nil",
"{",
"return",
"true",
"\n",
"}",
"\n\n",
"return",
"<mask>",
"\n",
"}"
] |
9,933 | all-9934 | [
"Read",
"in",
"ProgressReader",
"is",
"the",
"same",
"as",
"io",
".",
"Read"
] | [
"func",
"(",
"pt",
"*",
"ProgressReader",
")",
"Read",
"(",
"p",
"[",
"]",
"byte",
")",
"(",
"int",
",",
"error",
")",
"{",
"// Do normal reader tasks",
"n",
",",
"err",
":=",
"pt",
".",
"ReadCloser",
".",
"Read",
"(",
"p",
")",
"\n\n",
"// Do the actual progress tracking",
"if",
"pt",
".",
"Tracker",
"!=",
"nil",
"{",
"<mask>",
".",
"Tracker",
".",
"total",
"+=",
"int64",
"(",
"n",
")",
"\n",
"pt",
".",
"Tracker",
".",
"update",
"(",
"n",
")",
"\n",
"}",
"\n\n",
"return",
"n",
",",
"err",
"\n",
"}"
] |
9,934 | all-9935 | [
"AddAllImageStates",
"mocks",
"base",
"method"
] | [
"func",
"(",
"m",
"*",
"MockImageManager",
")",
"AddAllImageStates",
"(",
"arg0",
"[",
"]",
"*",
"<mask>",
".",
"ImageState",
")",
"{",
"m",
".",
"ctrl",
".",
"Call",
"(",
"m",
",",
"\"",
"\"",
",",
"arg0",
")",
"\n",
"}"
] |
9,935 | all-9936 | [
"ConnectSimpleStreams",
"lets",
"you",
"connect",
"to",
"a",
"remote",
"SimpleStreams",
"image",
"server",
"over",
"HTTPs",
".",
"Unless",
"the",
"remote",
"server",
"is",
"trusted",
"by",
"the",
"system",
"CA",
"the",
"remote",
"certificate",
"must",
"be",
"provided",
"(",
"TLSServerCert",
")",
"."
] | [
"func",
"ConnectSimpleStreams",
"(",
"<mask>",
"string",
",",
"args",
"*",
"ConnectionArgs",
")",
"(",
"ImageServer",
",",
"error",
")",
"{",
"logger",
".",
"Debugf",
"(",
"\"",
"\"",
")",
"\n\n",
"// Cleanup URL",
"url",
"=",
"strings",
".",
"TrimSuffix",
"(",
"url",
",",
"\"",
"\"",
")",
"\n\n",
"// Use empty args if not specified",
"if",
"args",
"==",
"nil",
"{",
"args",
"=",
"&",
"ConnectionArgs",
"{",
"}",
"\n",
"}",
"\n\n",
"// Initialize the client struct",
"server",
":=",
"ProtocolSimpleStreams",
"{",
"httpHost",
":",
"url",
",",
"httpUserAgent",
":",
"args",
".",
"UserAgent",
",",
"httpCertificate",
":",
"args",
".",
"TLSServerCert",
",",
"}",
"\n\n",
"// Setup the HTTP client",
"httpClient",
",",
"err",
":=",
"tlsHTTPClient",
"(",
"args",
".",
"HTTPClient",
",",
"args",
".",
"TLSClientCert",
",",
"args",
".",
"TLSClientKey",
",",
"args",
".",
"TLSCA",
",",
"args",
".",
"TLSServerCert",
",",
"args",
".",
"InsecureSkipVerify",
",",
"args",
".",
"Proxy",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"server",
".",
"http",
"=",
"httpClient",
"\n\n",
"// Get simplestreams client",
"ssClient",
":=",
"simplestreams",
".",
"NewClient",
"(",
"url",
",",
"*",
"httpClient",
",",
"args",
".",
"UserAgent",
")",
"\n",
"server",
".",
"ssClient",
"=",
"ssClient",
"\n\n",
"return",
"&",
"server",
",",
"nil",
"\n",
"}"
] |
9,936 | all-9937 | [
"next",
"advances",
"to",
"the",
"next",
"file",
"block",
"in",
"the",
"archive"
] | [
"func",
"(",
"a",
"*",
"archive50",
")",
"next",
"(",
")",
"(",
"*",
"fileBlockHeader",
",",
"error",
")",
"{",
"for",
"{",
"h",
",",
"err",
":=",
"a",
".",
"readBlockHeader",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"a",
".",
"byteReader",
"=",
"limitByteReader",
"(",
"a",
".",
"v",
",",
"h",
".",
"dataSize",
")",
"\n",
"switch",
"h",
".",
"htype",
"{",
"case",
"block5File",
":",
"return",
"a",
".",
"parseFileHeader",
"(",
"h",
")",
"\n",
"case",
"block5Arc",
":",
"flags",
":=",
"h",
".",
"data",
".",
"uvarint",
"(",
")",
"\n",
"a",
".",
"multi",
"=",
"flags",
"&",
"arc5MultiVol",
">",
"0",
"\n",
"a",
".",
"solid",
"=",
"flags",
"&",
"arc5Solid",
">",
"0",
"\n",
"case",
"block5Encrypt",
":",
"err",
"=",
"a",
".",
"parseEncryptionBlock",
"(",
"h",
".",
"data",
")",
"\n",
"<mask>",
"block5End",
":",
"flags",
":=",
"h",
".",
"data",
".",
"uvarint",
"(",
")",
"\n",
"if",
"flags",
"&",
"endArc5NotLast",
"==",
"0",
"||",
"!",
"a",
".",
"multi",
"{",
"return",
"nil",
",",
"errArchiveEnd",
"\n",
"}",
"\n",
"return",
"nil",
",",
"errArchiveContinues",
"\n",
"default",
":",
"// discard block data",
"_",
",",
"err",
"=",
"io",
".",
"Copy",
"(",
"ioutil",
".",
"Discard",
",",
"a",
".",
"byteReader",
")",
"\n",
"}",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"}",
"\n",
"}"
] |
9,937 | all-9938 | [
"FormatType",
"prints",
"the",
"type",
"as",
"if",
"it",
"were",
"wrapping",
"s",
".",
"This",
"may",
"return",
"s",
"as",
"-",
"is",
"depending",
"on",
"the",
"current",
"type",
"and",
"TypeMode",
"mode",
"."
] | [
"func",
"(",
"opts",
"formatOptions",
")",
"FormatType",
"(",
"t",
"reflect",
".",
"Type",
",",
"s",
"textNode",
")",
"textNode",
"{",
"// Check whether to emit the type or not.",
"switch",
"opts",
".",
"TypeMode",
"{",
"case",
"autoType",
":",
"switch",
"t",
".",
"Kind",
"(",
")",
"{",
"case",
"reflect",
".",
"Struct",
",",
"reflect",
".",
"Slice",
",",
"reflect",
".",
"Array",
",",
"reflect",
".",
"Map",
":",
"if",
"s",
".",
"Equal",
"(",
"textNil",
")",
"{",
"return",
"s",
"\n",
"}",
"\n",
"default",
":",
"return",
"s",
"\n",
"}",
"\n",
"case",
"elideType",
":",
"return",
"s",
"\n",
"}",
"\n\n",
"// Determine the type label, applying special handling for unnamed types.",
"typeName",
":=",
"t",
".",
"String",
"(",
")",
"\n",
"if",
"t",
".",
"Name",
"(",
")",
"==",
"\"",
"\"",
"{",
"// According to Go grammar, certain type literals contain symbols that",
"// do not strongly bind to the next lexicographical token (e.g., *T).",
"switch",
"t",
".",
"Kind",
"(",
")",
"{",
"case",
"reflect",
".",
"Chan",
",",
"reflect",
".",
"Func",
",",
"reflect",
".",
"Ptr",
":",
"typeName",
"=",
"\"",
"\"",
"+",
"typeName",
"+",
"\"",
"\"",
"\n",
"}",
"\n",
"typeName",
"=",
"strings",
".",
"Replace",
"(",
"typeName",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"-",
"1",
")",
"\n",
"typeName",
"=",
"strings",
".",
"Replace",
"(",
"typeName",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"-",
"1",
")",
"\n",
"}",
"\n\n",
"// Avoid wrap the value in parenthesis if unnecessary.",
"if",
"s",
",",
"ok",
":=",
"s",
".",
"(",
"textWrap",
")",
";",
"<mask>",
"{",
"hasParens",
":=",
"strings",
".",
"HasPrefix",
"(",
"s",
".",
"Prefix",
",",
"\"",
"\"",
")",
"&&",
"strings",
".",
"HasSuffix",
"(",
"s",
".",
"Suffix",
",",
"\"",
"\"",
")",
"\n",
"hasBraces",
":=",
"strings",
".",
"HasPrefix",
"(",
"s",
".",
"Prefix",
",",
"\"",
"\"",
")",
"&&",
"strings",
".",
"HasSuffix",
"(",
"s",
".",
"Suffix",
",",
"\"",
"\"",
")",
"\n",
"if",
"hasParens",
"||",
"hasBraces",
"{",
"return",
"textWrap",
"{",
"typeName",
",",
"s",
",",
"\"",
"\"",
"}",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"textWrap",
"{",
"typeName",
"+",
"\"",
"\"",
",",
"s",
",",
"\"",
"\"",
"}",
"\n",
"}"
] |
9,938 | all-9939 | [
"String",
"turns",
"URLsMap",
"into",
"discovery",
"-",
"formatted",
"name",
"-",
"to",
"-",
"URLs",
"sorted",
"by",
"name",
"."
] | [
"func",
"(",
"c",
"URLsMap",
")",
"<mask>",
"(",
")",
"string",
"{",
"var",
"pairs",
"[",
"]",
"string",
"\n",
"for",
"name",
",",
"urls",
":=",
"range",
"c",
"{",
"for",
"_",
",",
"url",
":=",
"range",
"urls",
"{",
"pairs",
"=",
"append",
"(",
"pairs",
",",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"name",
",",
"url",
".",
"String",
"(",
")",
")",
")",
"\n",
"}",
"\n",
"}",
"\n",
"sort",
".",
"Strings",
"(",
"pairs",
")",
"\n",
"return",
"strings",
".",
"Join",
"(",
"pairs",
",",
"\"",
"\"",
")",
"\n",
"}"
] |
9,939 | all-9940 | [
"title",
":",
"team",
"list",
"path",
":",
"/",
"teams",
"method",
":",
"GET",
"produce",
":",
"application",
"/",
"json",
"responses",
":",
"200",
":",
"List",
"teams",
"204",
":",
"No",
"content",
"401",
":",
"Unauthorized"
] | [
"func",
"teamList",
"(",
"w",
"http",
".",
"ResponseWriter",
",",
"r",
"*",
"http",
".",
"Request",
",",
"t",
"auth",
".",
"Token",
")",
"error",
"{",
"permsForTeam",
":=",
"permission",
".",
"PermissionRegistry",
".",
"PermissionsWithContextType",
"(",
"permTypes",
".",
"CtxTeam",
")",
"\n",
"teams",
",",
"err",
":=",
"servicemanager",
".",
"Team",
".",
"List",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"teamsMap",
":=",
"map",
"[",
"string",
"]",
"authTypes",
".",
"Team",
"{",
"}",
"\n",
"permsMap",
":=",
"map",
"[",
"string",
"]",
"[",
"]",
"string",
"{",
"}",
"\n",
"perms",
",",
"err",
":=",
"t",
".",
"Permissions",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"for",
"_",
",",
"team",
":=",
"range",
"teams",
"{",
"teamsMap",
"[",
"team",
".",
"Name",
"]",
"=",
"team",
"\n",
"teamCtx",
":=",
"permission",
".",
"Context",
"(",
"permTypes",
".",
"CtxTeam",
",",
"team",
".",
"Name",
")",
"\n",
"var",
"parent",
"*",
"permission",
".",
"PermissionScheme",
"\n",
"for",
"_",
",",
"p",
":=",
"range",
"permsForTeam",
"{",
"if",
"parent",
"!=",
"nil",
"&&",
"<mask>",
".",
"IsParent",
"(",
"p",
")",
"{",
"continue",
"\n",
"}",
"\n",
"if",
"permission",
".",
"CheckFromPermList",
"(",
"perms",
",",
"p",
",",
"teamCtx",
")",
"{",
"parent",
"=",
"p",
"\n",
"permsMap",
"[",
"team",
".",
"Name",
"]",
"=",
"append",
"(",
"permsMap",
"[",
"team",
".",
"Name",
"]",
",",
"p",
".",
"FullName",
"(",
")",
")",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n",
"if",
"len",
"(",
"permsMap",
")",
"==",
"0",
"{",
"w",
".",
"WriteHeader",
"(",
"http",
".",
"StatusNoContent",
")",
"\n",
"return",
"nil",
"\n",
"}",
"\n",
"var",
"result",
"[",
"]",
"map",
"[",
"string",
"]",
"interface",
"{",
"}",
"\n",
"for",
"name",
",",
"permissions",
":=",
"range",
"permsMap",
"{",
"result",
"=",
"append",
"(",
"result",
",",
"map",
"[",
"string",
"]",
"interface",
"{",
"}",
"{",
"\"",
"\"",
":",
"name",
",",
"\"",
"\"",
":",
"teamsMap",
"[",
"name",
"]",
".",
"Tags",
",",
"\"",
"\"",
":",
"permissions",
",",
"}",
")",
"\n",
"}",
"\n",
"w",
".",
"Header",
"(",
")",
".",
"Set",
"(",
"\"",
"\"",
",",
"\"",
"\"",
")",
"\n",
"return",
"json",
".",
"NewEncoder",
"(",
"w",
")",
".",
"Encode",
"(",
"result",
")",
"\n",
"}"
] |
9,940 | all-9941 | [
"Reset",
"resets",
"the",
"buffer",
"to",
"an",
"empty",
"state",
"ready",
"for",
"writing"
] | [
"func",
"(",
"w",
"*",
"WriteBuffer",
")",
"Reset",
"(",
")",
"{",
"w",
".",
"remaining",
"=",
"w",
".",
"<mask>",
"\n",
"w",
".",
"err",
"=",
"nil",
"\n",
"}"
] |
9,941 | all-9942 | [
"getBuildPath",
"builds",
"a",
"path",
"to",
"trigger",
"a",
"regular",
"build",
"for",
"this",
"job"
] | [
"func",
"getBuildPath",
"(",
"<mask>",
"*",
"prowapi",
".",
"ProwJobSpec",
")",
"string",
"{",
"jenkinsJobName",
":=",
"getJobName",
"(",
"spec",
")",
"\n",
"jenkinsPath",
":=",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"jenkinsJobName",
")",
"\n\n",
"return",
"jenkinsPath",
"\n",
"}"
] |
9,942 | all-9943 | [
"NewScpHistoryEntry",
"creates",
"a",
"new",
"ScpHistoryEntry",
"."
] | [
"func",
"NewScpHistoryEntry",
"(",
"v",
"int32",
",",
"value",
"interface",
"{",
"}",
")",
"(",
"result",
"ScpHistoryEntry",
",",
"err",
"error",
")",
"{",
"result",
".",
"V",
"=",
"v",
"\n",
"switch",
"int32",
"(",
"v",
")",
"{",
"case",
"0",
":",
"tv",
",",
"ok",
":=",
"value",
".",
"(",
"ScpHistoryEntryV0",
")",
"\n",
"if",
"!",
"ok",
"{",
"err",
"=",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
")",
"\n",
"return",
"\n",
"}",
"\n",
"result",
".",
"V0",
"=",
"&",
"<mask>",
"\n",
"}",
"\n",
"return",
"\n",
"}"
] |
9,943 | all-9944 | [
"UnmarshalJSON",
"implements",
"json",
".",
"Unmarshaler",
"."
] | [
"func",
"(",
"id",
"*",
"ID",
")",
"UnmarshalJSON",
"(",
"data",
"[",
"]",
"byte",
")",
"error",
"{",
"// Support both uint64 and string IDs.",
"var",
"v",
"uint64",
"\n",
"if",
"err",
":=",
"json",
".",
"Unmarshal",
"(",
"data",
",",
"&",
"v",
")",
";",
"err",
"==",
"nil",
"{",
"*",
"id",
"=",
"ID",
"{",
"Num",
":",
"v",
"}",
"\n",
"return",
"nil",
"\n",
"}",
"\n",
"var",
"v2",
"string",
"\n",
"if",
"err",
":=",
"json",
".",
"Unmarshal",
"(",
"data",
",",
"&",
"v2",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"*",
"<mask>",
"=",
"ID",
"{",
"Str",
":",
"v2",
",",
"IsString",
":",
"true",
"}",
"\n",
"return",
"nil",
"\n",
"}"
] |
9,944 | all-9945 | [
"CreateComment",
"adds",
"a",
"comment",
"to",
"a",
"PR"
] | [
"func",
"(",
"f",
"*",
"FakeClient",
")",
"CreateComment",
"(",
"owner",
",",
"repo",
"string",
",",
"number",
"int",
",",
"comment",
"string",
")",
"error",
"{",
"f",
".",
"IssueCommentsAdded",
"=",
"append",
"(",
"f",
".",
"IssueCommentsAdded",
",",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"owner",
",",
"repo",
",",
"number",
",",
"comment",
")",
")",
"\n",
"f",
".",
"IssueComments",
"[",
"number",
"]",
"=",
"append",
"(",
"f",
".",
"IssueComments",
"[",
"number",
"]",
",",
"github",
".",
"IssueComment",
"{",
"<mask>",
":",
"f",
".",
"IssueCommentID",
",",
"Body",
":",
"comment",
",",
"User",
":",
"github",
".",
"User",
"{",
"Login",
":",
"botName",
"}",
",",
"}",
")",
"\n",
"f",
".",
"IssueCommentID",
"++",
"\n",
"return",
"nil",
"\n",
"}"
] |
9,945 | all-9946 | [
"WithDepth",
"the",
"maximum",
"depth",
"at",
"which",
"children",
"should",
"be",
"retrieved",
"defaults",
"to",
"1",
".",
"Use",
"-",
"1",
"for",
"the",
"entire",
"subtree",
"or",
"provide",
"an",
"integer",
"larger",
"than",
"0",
"."
] | [
"func",
"(",
"p",
"RequestChildNodesParams",
")",
"WithDepth",
"(",
"depth",
"int64",
")",
"*",
"RequestChildNodesParams",
"{",
"p",
".",
"Depth",
"=",
"<mask>",
"\n",
"return",
"&",
"p",
"\n",
"}"
] |
9,946 | all-9947 | [
"this",
"is",
"a",
"helper",
"function",
"to",
"check",
"if",
"the",
"given",
"provenance",
"has",
"provenance",
"on",
"an",
"input",
"branch"
] | [
"func",
"provenantOnInput",
"(",
"provenance",
"[",
"]",
"*",
"pfs",
".",
"CommitProvenance",
")",
"bool",
"{",
"provenanceCount",
":=",
"len",
"(",
"provenance",
")",
"\n",
"for",
"_",
",",
"p",
":=",
"<mask>",
"provenance",
"{",
"// in particular, we want to exclude provenance on the spec repo (used e.g. for spouts)",
"if",
"p",
".",
"Commit",
".",
"Repo",
".",
"Name",
"==",
"ppsconsts",
".",
"SpecRepo",
"{",
"provenanceCount",
"--",
"\n",
"break",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"provenanceCount",
">",
"0",
"\n",
"}"
] |
9,947 | all-9948 | [
"ReviewCommentEventHandlers",
"returns",
"a",
"map",
"of",
"plugin",
"names",
"to",
"handlers",
"for",
"the",
"repo",
"."
] | [
"func",
"(",
"pa",
"*",
"ConfigAgent",
")",
"ReviewCommentEventHandlers",
"(",
"owner",
",",
"repo",
"string",
")",
"map",
"[",
"string",
"]",
"ReviewCommentEventHandler",
"{",
"pa",
".",
"mut",
".",
"Lock",
"(",
")",
"\n",
"defer",
"pa",
".",
"mut",
".",
"Unlock",
"(",
")",
"\n\n",
"hs",
":=",
"map",
"[",
"string",
"]",
"ReviewCommentEventHandler",
"{",
"}",
"\n",
"for",
"_",
",",
"p",
":=",
"range",
"<mask>",
".",
"getPlugins",
"(",
"owner",
",",
"repo",
")",
"{",
"if",
"h",
",",
"ok",
":=",
"reviewCommentEventHandlers",
"[",
"p",
"]",
";",
"ok",
"{",
"hs",
"[",
"p",
"]",
"=",
"h",
"\n",
"}",
"\n",
"}",
"\n\n",
"return",
"hs",
"\n",
"}"
] |
9,948 | all-9949 | [
"simultaneously",
"specify",
"storage",
"for",
"all",
"levels",
"of",
"a",
"one",
"-",
"dimensional",
"texture"
] | [
"func",
"TextureStorage1D",
"(",
"texture",
"uint32",
",",
"levels",
"int32",
",",
"internalformat",
"uint32",
",",
"<mask>",
"int32",
")",
"{",
"C",
".",
"glowTextureStorage1D",
"(",
"gpTextureStorage1D",
",",
"(",
"C",
".",
"GLuint",
")",
"(",
"texture",
")",
",",
"(",
"C",
".",
"GLsizei",
")",
"(",
"levels",
")",
",",
"(",
"C",
".",
"GLenum",
")",
"(",
"internalformat",
")",
",",
"(",
"C",
".",
"GLsizei",
")",
"(",
"width",
")",
")",
"\n",
"}"
] |
9,949 | all-9950 | [
"Extract",
"field",
"information",
"from",
"the",
"given",
"structure",
"."
] | [
"func",
"parseStruct",
"(",
"str",
"*",
"ast",
".",
"StructType",
")",
"(",
"[",
"]",
"*",
"Field",
",",
"error",
")",
"{",
"fields",
":=",
"make",
"(",
"[",
"]",
"*",
"Field",
",",
"0",
")",
"\n\n",
"for",
"_",
",",
"f",
":=",
"range",
"str",
".",
"Fields",
".",
"List",
"{",
"if",
"len",
"(",
"f",
".",
"Names",
")",
"==",
"0",
"{",
"// Check if this is a parent struct.",
"ident",
",",
"<mask>",
":=",
"f",
".",
"Type",
".",
"(",
"*",
"ast",
".",
"Ident",
")",
"\n",
"if",
"!",
"ok",
"{",
"continue",
"\n",
"}",
"\n\n",
"typ",
",",
"ok",
":=",
"ident",
".",
"Obj",
".",
"Decl",
".",
"(",
"*",
"ast",
".",
"TypeSpec",
")",
"\n",
"if",
"!",
"ok",
"{",
"continue",
"\n",
"}",
"\n\n",
"parentStr",
",",
"ok",
":=",
"typ",
".",
"Type",
".",
"(",
"*",
"ast",
".",
"StructType",
")",
"\n",
"if",
"!",
"ok",
"{",
"continue",
"\n",
"}",
"\n\n",
"parentFields",
",",
"err",
":=",
"parseStruct",
"(",
"parentStr",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"errors",
".",
"Wrapf",
"(",
"err",
",",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"fields",
"=",
"append",
"(",
"fields",
",",
"parentFields",
"...",
")",
"\n\n",
"continue",
"\n",
"}",
"\n\n",
"if",
"len",
"(",
"f",
".",
"Names",
")",
"!=",
"1",
"{",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"f",
".",
"Names",
")",
"\n",
"}",
"\n\n",
"field",
",",
"err",
":=",
"parseField",
"(",
"f",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"fields",
"=",
"append",
"(",
"fields",
",",
"field",
")",
"\n",
"}",
"\n\n",
"return",
"fields",
",",
"nil",
"\n",
"}"
] |
9,950 | all-9951 | [
"Printf",
"outputs",
"formatted",
"Print",
"log"
] | [
"func",
"Printf",
"(",
"format",
"string",
",",
"val",
"...",
"interface",
"{",
"}",
")",
"error",
"{",
"return",
"glg",
".",
"out",
"(",
"PRINT",
",",
"<mask>",
",",
"val",
"...",
")",
"\n",
"}"
] |
9,951 | all-9952 | [
"go",
":",
"generate",
"go",
"-",
"bindata",
"-",
"nometadata",
"-",
"ignore",
".",
"*",
"_test",
"\\",
".",
"|~$DOLLAR",
"-",
"pkg",
"$GOPACKAGE",
"-",
"o",
"bindata",
".",
"go",
"-",
"prefix",
"..",
"/",
"..",
"/",
"lib",
"/",
"..."
] | [
"func",
"newInternalFS",
"(",
"prefix",
"string",
")",
"http",
".",
"FileSystem",
"{",
"// Asset/AssetDir returns `fmt.Errorf(\"Asset %s not found\")`,",
"// which does _not_ get mapped to 404 by `http.FileSystem`.",
"// Need to convert to `os.ErrNotExist` explicitly ourselves.",
"mapNotFound",
":=",
"func",
"(",
"err",
"error",
")",
"error",
"{",
"if",
"err",
"!=",
"nil",
"&&",
"strings",
".",
"Contains",
"(",
"err",
".",
"<mask>",
"(",
")",
",",
"\"",
"\"",
")",
"{",
"err",
"=",
"os",
".",
"ErrNotExist",
"\n",
"}",
"\n",
"return",
"err",
"\n",
"}",
"\n",
"return",
"&",
"assetfs",
".",
"AssetFS",
"{",
"Asset",
":",
"func",
"(",
"path",
"string",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"ret",
",",
"err",
":=",
"Asset",
"(",
"path",
")",
"\n",
"return",
"ret",
",",
"mapNotFound",
"(",
"err",
")",
"\n",
"}",
",",
"AssetDir",
":",
"func",
"(",
"path",
"string",
")",
"(",
"[",
"]",
"string",
",",
"error",
")",
"{",
"ret",
",",
"err",
":=",
"AssetDir",
"(",
"path",
")",
"\n",
"return",
"ret",
",",
"mapNotFound",
"(",
"err",
")",
"\n",
"}",
",",
"Prefix",
":",
"prefix",
",",
"}",
"\n",
"}"
] |
9,952 | all-9953 | [
"Start",
"the",
"queue",
"manager",
"sending",
"samples",
"to",
"the",
"remote",
"storage",
".",
"Does",
"not",
"block",
"."
] | [
"func",
"(",
"t",
"*",
"QueueManager",
")",
"Start",
"(",
")",
"{",
"// Setup the QueueManagers metrics. We do this here rather than in the",
"// constructor because of the ordering of creating Queue Managers's, stopping them,",
"// and then starting new ones in storage/remote/storage.go ApplyConfig.",
"name",
":=",
"t",
".",
"client",
".",
"Name",
"(",
")",
"\n",
"t",
".",
"highestSentTimestampMetric",
"=",
"&",
"maxGauge",
"{",
"Gauge",
":",
"queueHighestSentTimestamp",
".",
"WithLabelValues",
"(",
"name",
")",
",",
"}",
"\n",
"t",
".",
"pendingSamplesMetric",
"=",
"queuePendingSamples",
".",
"WithLabelValues",
"(",
"name",
")",
"\n",
"t",
".",
"enqueueRetriesMetric",
"=",
"enqueueRetriesTotal",
".",
"WithLabelValues",
"(",
"name",
")",
"\n",
"t",
".",
"droppedSamplesTotal",
"=",
"droppedSamplesTotal",
".",
"WithLabelValues",
"(",
"name",
")",
"\n",
"t",
".",
"numShardsMetric",
"=",
"numShards",
".",
"WithLabelValues",
"(",
"name",
")",
"\n",
"t",
".",
"failedSamplesTotal",
"=",
"failedSamplesTotal",
".",
"WithLabelValues",
"(",
"name",
")",
"\n",
"t",
".",
"sentBatchDuration",
"=",
"sentBatchDuration",
".",
"WithLabelValues",
"(",
"name",
")",
"\n",
"t",
".",
"succeededSamplesTotal",
"=",
"succeededSamplesTotal",
".",
"WithLabelValues",
"(",
"name",
")",
"\n",
"t",
".",
"retriedSamplesTotal",
"=",
"retriedSamplesTotal",
".",
"WithLabelValues",
"(",
"name",
")",
"\n",
"t",
".",
"shardCapacity",
"=",
"shardCapacity",
".",
"WithLabelValues",
"(",
"<mask>",
")",
"\n\n",
"// Initialise some metrics.",
"t",
".",
"shardCapacity",
".",
"Set",
"(",
"float64",
"(",
"t",
".",
"cfg",
".",
"Capacity",
")",
")",
"\n",
"t",
".",
"pendingSamplesMetric",
".",
"Set",
"(",
"0",
")",
"\n\n",
"t",
".",
"shards",
".",
"start",
"(",
"t",
".",
"numShards",
")",
"\n",
"t",
".",
"watcher",
".",
"Start",
"(",
")",
"\n\n",
"t",
".",
"wg",
".",
"Add",
"(",
"2",
")",
"\n",
"go",
"t",
".",
"updateShardsLoop",
"(",
")",
"\n",
"go",
"t",
".",
"reshardLoop",
"(",
")",
"\n",
"}"
] |
9,953 | all-9954 | [
"Set",
"the",
"storage",
"."
] | [
"func",
"(",
"s",
"*",
"ReadyStorage",
")",
"Set",
"(",
"db",
"*",
"tsdb",
".",
"<mask>",
",",
"startTimeMargin",
"int64",
")",
"{",
"s",
".",
"mtx",
".",
"Lock",
"(",
")",
"\n",
"defer",
"s",
".",
"mtx",
".",
"Unlock",
"(",
")",
"\n\n",
"s",
".",
"a",
"=",
"&",
"adapter",
"{",
"db",
":",
"db",
",",
"startTimeMargin",
":",
"startTimeMargin",
"}",
"\n",
"}"
] |
9,954 | all-9955 | [
"MarshalJSON",
"supports",
"json",
".",
"Marshaler",
"interface"
] | [
"func",
"(",
"v",
"EventInspectRequested",
")",
"MarshalJSON",
"(",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"w",
":=",
"jwriter",
".",
"Writer",
"{",
"}",
"\n",
"easyjsonC5a4559bEncodeGithubComChromedpCdprotoRuntime29",
"(",
"&",
"w",
",",
"v",
")",
"\n",
"return",
"w",
".",
"Buffer",
".",
"BuildBytes",
"(",
")",
",",
"w",
".",
"<mask>",
"\n",
"}"
] |
9,955 | all-9956 | [
"GetCount",
"returns",
"the",
"Count",
"field",
"if",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"."
] | [
"func",
"(",
"m",
"*",
"ManageStatusDefinition",
")",
"GetCount",
"(",
")",
"int",
"{",
"if",
"m",
"==",
"nil",
"||",
"m",
".",
"Count",
"==",
"nil",
"{",
"<mask>",
"0",
"\n",
"}",
"\n",
"return",
"*",
"m",
".",
"Count",
"\n",
"}"
] |
9,956 | all-9957 | [
"Send",
"implements",
"TCPSender",
"by",
"sealing",
"and",
"sending",
"the",
"msg",
"as",
"-",
"is",
"."
] | [
"func",
"(",
"sender",
"*",
"encryptedTCPSender",
")",
"Send",
"(",
"<mask>",
"[",
"]",
"byte",
")",
"error",
"{",
"sender",
".",
"Lock",
"(",
")",
"\n",
"defer",
"sender",
".",
"Unlock",
"(",
")",
"\n",
"encodedMsg",
":=",
"secretbox",
".",
"Seal",
"(",
"nil",
",",
"msg",
",",
"&",
"sender",
".",
"state",
".",
"nonce",
",",
"sender",
".",
"state",
".",
"sessionKey",
")",
"\n",
"sender",
".",
"state",
".",
"advance",
"(",
")",
"\n",
"return",
"sender",
".",
"sender",
".",
"Send",
"(",
"encodedMsg",
")",
"\n",
"}"
] |
9,957 | all-9958 | [
"String",
"serializes",
"this",
"index",
"to",
"a",
"JSON",
"string",
"."
] | [
"func",
"(",
"io",
"IndexOptions",
")",
"String",
"(",
")",
"string",
"{",
"mopt",
":=",
"map",
"[",
"string",
"]",
"interface",
"{",
"}",
"{",
"}",
"\n",
"if",
"io",
".",
"keysSet",
"{",
"mopt",
"[",
"\"",
"\"",
"]",
"=",
"<mask>",
".",
"keys",
"\n",
"}",
"\n",
"if",
"io",
".",
"trackExistenceSet",
"{",
"mopt",
"[",
"\"",
"\"",
"]",
"=",
"io",
".",
"trackExistence",
"\n",
"}",
"\n",
"return",
"fmt",
".",
"Sprintf",
"(",
"`{\"options\":%s}`",
",",
"encodeMap",
"(",
"mopt",
")",
")",
"\n",
"}"
] |
9,958 | all-9959 | [
"Set",
"is",
"required",
"for",
"kingpin",
"interfaces",
"to",
"allow",
"command",
"line",
"params",
"to",
"be",
"set",
"to",
"our",
"map",
"datatype"
] | [
"func",
"(",
"o",
"*",
"MapFloat32Option",
")",
"Set",
"(",
"value",
"string",
")",
"error",
"{",
"parts",
":=",
"stringMapRegex",
".",
"Split",
"(",
"value",
",",
"2",
")",
"\n",
"if",
"len",
"(",
"parts",
")",
"!=",
"2",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"value",
")",
"\n",
"}",
"\n",
"val",
":=",
"Float32Option",
"{",
"}",
"\n",
"val",
".",
"Set",
"(",
"<mask>",
"[",
"1",
"]",
")",
"\n",
"(",
"*",
"o",
")",
"[",
"parts",
"[",
"0",
"]",
"]",
"=",
"val",
"\n",
"return",
"nil",
"\n",
"}"
] |
9,959 | all-9960 | [
"Run",
"implements",
"the",
"Discoverer",
"interface",
"."
] | [
"func",
"(",
"d",
"*",
"Discovery",
")",
"Run",
"(",
"ctx",
"context",
".",
"Context",
",",
"ch",
"chan",
"<-",
"[",
"]",
"*",
"targetgroup",
".",
"Group",
")",
"{",
"defer",
"func",
"(",
")",
"{",
"for",
"_",
",",
"tc",
":=",
"range",
"d",
".",
"treeCaches",
"{",
"tc",
".",
"Stop",
"(",
")",
"\n",
"}",
"\n",
"// Drain event channel in case the treecache leaks goroutines otherwise.",
"for",
"range",
"d",
".",
"updates",
"{",
"}",
"\n",
"d",
".",
"conn",
".",
"Close",
"(",
")",
"\n",
"}",
"(",
")",
"\n\n",
"for",
"{",
"select",
"{",
"case",
"<-",
"ctx",
".",
"Done",
"(",
")",
":",
"return",
"\n",
"case",
"event",
":=",
"<-",
"d",
".",
"updates",
":",
"tg",
":=",
"&",
"targetgroup",
".",
"Group",
"{",
"Source",
":",
"event",
".",
"Path",
",",
"}",
"\n",
"if",
"<mask>",
".",
"Data",
"!=",
"nil",
"{",
"labelSet",
",",
"err",
":=",
"d",
".",
"parse",
"(",
"*",
"event",
".",
"Data",
",",
"event",
".",
"Path",
")",
"\n",
"if",
"err",
"==",
"nil",
"{",
"tg",
".",
"Targets",
"=",
"[",
"]",
"model",
".",
"LabelSet",
"{",
"labelSet",
"}",
"\n",
"d",
".",
"sources",
"[",
"event",
".",
"Path",
"]",
"=",
"tg",
"\n",
"}",
"else",
"{",
"delete",
"(",
"d",
".",
"sources",
",",
"event",
".",
"Path",
")",
"\n",
"}",
"\n",
"}",
"else",
"{",
"delete",
"(",
"d",
".",
"sources",
",",
"event",
".",
"Path",
")",
"\n",
"}",
"\n",
"select",
"{",
"case",
"<-",
"ctx",
".",
"Done",
"(",
")",
":",
"return",
"\n",
"case",
"ch",
"<-",
"[",
"]",
"*",
"targetgroup",
".",
"Group",
"{",
"tg",
"}",
":",
"}",
"\n",
"}",
"\n",
"}",
"\n",
"}"
] |
9,960 | all-9961 | [
"SetMinBarWidth",
"changes",
"the",
"minimal",
"bar",
"width"
] | [
"func",
"(",
"b",
"*",
"BarChart",
")",
"SetMinBarWidth",
"(",
"<mask>",
"int32",
")",
"{",
"atomic",
".",
"StoreInt32",
"(",
"&",
"b",
".",
"barWidth",
",",
"size",
")",
"\n",
"}"
] |
9,961 | all-9962 | [
"GetName",
"returns",
"the",
"Name",
"field",
"if",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"."
] | [
"func",
"(",
"t",
"*",
"TemplateVariable",
")",
"GetName",
"(",
")",
"string",
"{",
"if",
"t",
"==",
"nil",
"||",
"t",
".",
"Name",
"==",
"nil",
"{",
"return",
"\"",
"\"",
"\n",
"}",
"\n",
"return",
"*",
"t",
".",
"<mask>",
"\n",
"}"
] |
9,962 | all-9963 | [
"EnsureBuildableJob",
"attempts",
"to",
"detect",
"a",
"job",
"that",
"hasn",
"t",
"yet",
"ran",
"and",
"populated",
"its",
"parameters",
".",
"If",
"detected",
"it",
"tries",
"to",
"run",
"a",
"build",
"until",
"the",
"job",
"parameters",
"are",
"processed",
"then",
"it",
"aborts",
"the",
"build",
"."
] | [
"func",
"(",
"c",
"*",
"Client",
")",
"EnsureBuildableJob",
"(",
"spec",
"*",
"prowapi",
".",
"ProwJobSpec",
")",
"error",
"{",
"var",
"jobInfo",
"*",
"JobInfo",
"\n\n",
"// wait at most 20 seconds for the job to appear",
"getJobInfoBackoff",
":=",
"wait",
".",
"Backoff",
"{",
"Duration",
":",
"<mask>",
".",
"Duration",
"(",
"10",
")",
"*",
"time",
".",
"Second",
",",
"Factor",
":",
"1",
",",
"Jitter",
":",
"0",
",",
"Steps",
":",
"2",
",",
"}",
"\n\n",
"getJobErr",
":=",
"wait",
".",
"ExponentialBackoff",
"(",
"getJobInfoBackoff",
",",
"func",
"(",
")",
"(",
"bool",
",",
"error",
")",
"{",
"var",
"jobErr",
"error",
"\n",
"jobInfo",
",",
"jobErr",
"=",
"c",
".",
"GetJobInfo",
"(",
"spec",
")",
"\n\n",
"if",
"jobErr",
"!=",
"nil",
"&&",
"!",
"strings",
".",
"Contains",
"(",
"strings",
".",
"ToLower",
"(",
"jobErr",
".",
"Error",
"(",
")",
")",
",",
"\"",
"\"",
")",
"{",
"return",
"false",
",",
"jobErr",
"\n",
"}",
"\n\n",
"return",
"jobInfo",
"!=",
"nil",
",",
"nil",
"\n",
"}",
")",
"\n\n",
"if",
"getJobErr",
"!=",
"nil",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"spec",
".",
"Job",
")",
"\n",
"}",
"\n\n",
"isParameterized",
":=",
"c",
".",
"JobParameterized",
"(",
"jobInfo",
")",
"\n\n",
"c",
".",
"logger",
".",
"Tracef",
"(",
"\"",
"\"",
",",
"isParameterized",
")",
"\n\n",
"if",
"isParameterized",
"||",
"len",
"(",
"jobInfo",
".",
"Builds",
")",
">",
"0",
"{",
"return",
"nil",
"\n",
"}",
"\n\n",
"buildErr",
":=",
"c",
".",
"LaunchBuild",
"(",
"spec",
",",
"nil",
")",
"\n\n",
"if",
"buildErr",
"!=",
"nil",
"{",
"return",
"buildErr",
"\n",
"}",
"\n\n",
"backoff",
":=",
"wait",
".",
"Backoff",
"{",
"Duration",
":",
"time",
".",
"Duration",
"(",
"5",
")",
"*",
"time",
".",
"Second",
",",
"Factor",
":",
"1",
",",
"Jitter",
":",
"1",
",",
"Steps",
":",
"10",
",",
"}",
"\n\n",
"return",
"wait",
".",
"ExponentialBackoff",
"(",
"backoff",
",",
"func",
"(",
")",
"(",
"bool",
",",
"error",
")",
"{",
"c",
".",
"logger",
".",
"Debugf",
"(",
"\"",
"\"",
",",
"spec",
".",
"Job",
")",
"\n\n",
"jobInfo",
",",
"_",
":=",
"c",
".",
"GetJobInfo",
"(",
"spec",
")",
"\n",
"isParameterized",
":=",
"false",
"\n\n",
"if",
"jobInfo",
"!=",
"nil",
"{",
"isParameterized",
"=",
"c",
".",
"JobParameterized",
"(",
"jobInfo",
")",
"\n\n",
"if",
"isParameterized",
"&&",
"jobInfo",
".",
"LastBuild",
"!=",
"nil",
"{",
"c",
".",
"logger",
".",
"Debugf",
"(",
"\"",
"\"",
",",
"spec",
".",
"Job",
")",
"\n",
"err",
":=",
"c",
".",
"Abort",
"(",
"getJobName",
"(",
"spec",
")",
",",
"jobInfo",
".",
"LastBuild",
")",
"\n\n",
"if",
"err",
"!=",
"nil",
"{",
"c",
".",
"logger",
".",
"Infof",
"(",
"\"",
"\"",
",",
"jobInfo",
".",
"LastBuild",
".",
"Number",
",",
"spec",
".",
"Job",
",",
"err",
")",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n\n",
"// don't stop on (possibly) intermittent errors",
"return",
"isParameterized",
",",
"nil",
"\n",
"}",
")",
"\n",
"}"
] |
9,963 | all-9964 | [
"UpdateCluster",
"requests",
"to",
"bootstrap",
"a",
"new",
"cluster",
"or",
"join",
"an",
"existing",
"one",
"."
] | [
"func",
"(",
"r",
"*",
"ProtocolLXD",
")",
"UpdateCluster",
"(",
"cluster",
"api",
".",
"ClusterPut",
",",
"ETag",
"string",
")",
"(",
"<mask>",
",",
"error",
")",
"{",
"if",
"!",
"r",
".",
"HasExtension",
"(",
"\"",
"\"",
")",
"{",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\\\"",
"\\\"",
"\"",
")",
"\n",
"}",
"\n\n",
"if",
"cluster",
".",
"ServerAddress",
"!=",
"\"",
"\"",
"||",
"cluster",
".",
"ClusterPassword",
"!=",
"\"",
"\"",
"||",
"len",
"(",
"cluster",
".",
"MemberConfig",
")",
">",
"0",
"{",
"if",
"!",
"r",
".",
"HasExtension",
"(",
"\"",
"\"",
")",
"{",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\\\"",
"\\\"",
"\"",
")",
"\n",
"}",
"\n",
"}",
"\n\n",
"op",
",",
"_",
",",
"err",
":=",
"r",
".",
"queryOperation",
"(",
"\"",
"\"",
",",
"\"",
"\"",
",",
"cluster",
",",
"\"",
"\"",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"return",
"op",
",",
"nil",
"\n",
"}"
] |
9,964 | all-9965 | [
"FetchMaintenanceWindow",
"retrieves",
"maintenance",
"[",
"window",
"]",
"with",
"passed",
"cid",
"."
] | [
"func",
"(",
"a",
"*",
"API",
")",
"FetchMaintenanceWindow",
"(",
"cid",
"CIDType",
")",
"(",
"*",
"Maintenance",
",",
"error",
")",
"{",
"if",
"cid",
"==",
"nil",
"||",
"*",
"cid",
"==",
"\"",
"\"",
"{",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"maintenanceCID",
":=",
"string",
"(",
"*",
"cid",
")",
"\n\n",
"<mask>",
",",
"err",
":=",
"regexp",
".",
"MatchString",
"(",
"config",
".",
"MaintenanceCIDRegex",
",",
"maintenanceCID",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"if",
"!",
"matched",
"{",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"maintenanceCID",
")",
"\n",
"}",
"\n\n",
"result",
",",
"err",
":=",
"a",
".",
"Get",
"(",
"maintenanceCID",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"if",
"a",
".",
"Debug",
"{",
"a",
".",
"Log",
".",
"Printf",
"(",
"\"",
"\"",
",",
"string",
"(",
"result",
")",
")",
"\n",
"}",
"\n\n",
"window",
":=",
"&",
"Maintenance",
"{",
"}",
"\n",
"if",
"err",
":=",
"json",
".",
"Unmarshal",
"(",
"result",
",",
"window",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"return",
"window",
",",
"nil",
"\n",
"}"
] |
9,965 | all-9966 | [
"WebSocketHandlerFunc",
"convert",
"websocket",
"function",
"to",
"possum",
".",
"HandlerFunc",
"."
] | [
"func",
"WebSocketHandlerFunc",
"(",
"f",
"func",
"(",
"<mask>",
"*",
"websocket",
".",
"Conn",
")",
")",
"HandlerFunc",
"{",
"h",
":=",
"websocket",
".",
"Handler",
"(",
"f",
")",
"\n",
"return",
"WrapHTTPHandlerFunc",
"(",
"h",
".",
"ServeHTTP",
")",
"\n",
"}"
] |
9,966 | all-9967 | [
"ExecDirect",
"executes",
"a",
"sql",
"statement",
"without",
"statement",
"parameters",
"."
] | [
"func",
"(",
"s",
"*",
"Session",
")",
"ExecDirect",
"(",
"query",
"string",
")",
"(",
"driver",
".",
"<mask>",
",",
"error",
")",
"{",
"s",
".",
"mu",
".",
"Lock",
"(",
")",
"\n",
"defer",
"s",
".",
"mu",
".",
"Unlock",
"(",
")",
"\n\n",
"if",
"err",
":=",
"s",
".",
"writeRequest",
"(",
"mtExecuteDirect",
",",
"!",
"s",
".",
"conn",
".",
"inTx",
",",
"command",
"(",
"query",
")",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"if",
"err",
":=",
"s",
".",
"readReply",
"(",
"nil",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"if",
"s",
".",
"sh",
".",
"functionCode",
"==",
"fcDDL",
"{",
"return",
"driver",
".",
"ResultNoRows",
",",
"nil",
"\n",
"}",
"\n",
"return",
"driver",
".",
"RowsAffected",
"(",
"s",
".",
"rowsAffected",
".",
"total",
"(",
")",
")",
",",
"nil",
"\n",
"}"
] |
9,967 | all-9968 | [
"findNear",
"finds",
"the",
"node",
"near",
"to",
"key",
".",
"If",
"less",
"=",
"true",
"it",
"finds",
"rightmost",
"node",
"such",
"that",
"node",
".",
"key",
"<",
"key",
"(",
"if",
"allowEqual",
"=",
"false",
")",
"or",
"node",
".",
"key",
"<",
"=",
"key",
"(",
"if",
"allowEqual",
"=",
"true",
")",
".",
"If",
"less",
"=",
"false",
"it",
"finds",
"leftmost",
"node",
"such",
"that",
"node",
".",
"key",
">",
"key",
"(",
"if",
"allowEqual",
"=",
"false",
")",
"or",
"node",
".",
"key",
">",
"=",
"key",
"(",
"if",
"allowEqual",
"=",
"true",
")",
".",
"Returns",
"the",
"node",
"found",
".",
"The",
"bool",
"returned",
"is",
"true",
"if",
"the",
"node",
"has",
"key",
"equal",
"to",
"given",
"key",
"."
] | [
"func",
"(",
"s",
"*",
"Skiplist",
")",
"findNear",
"(",
"key",
"[",
"]",
"byte",
",",
"less",
"bool",
",",
"allowEqual",
"bool",
")",
"(",
"*",
"node",
",",
"bool",
")",
"{",
"x",
":=",
"s",
".",
"head",
"\n",
"level",
":=",
"int",
"(",
"s",
".",
"getHeight",
"(",
")",
"-",
"1",
")",
"\n",
"for",
"{",
"// Assume x.key < key.",
"<mask>",
":=",
"s",
".",
"getNext",
"(",
"x",
",",
"level",
")",
"\n",
"if",
"next",
"==",
"nil",
"{",
"// x.key < key < END OF LIST",
"if",
"level",
">",
"0",
"{",
"// Can descend further to iterate closer to the end.",
"level",
"--",
"\n",
"continue",
"\n",
"}",
"\n",
"// Level=0. Cannot descend further. Let's return something that makes sense.",
"if",
"!",
"less",
"{",
"return",
"nil",
",",
"false",
"\n",
"}",
"\n",
"// Try to return x. Make sure it is not a head node.",
"if",
"x",
"==",
"s",
".",
"head",
"{",
"return",
"nil",
",",
"false",
"\n",
"}",
"\n",
"return",
"x",
",",
"false",
"\n",
"}",
"\n\n",
"nextKey",
":=",
"next",
".",
"key",
"(",
"s",
".",
"arena",
")",
"\n",
"cmp",
":=",
"y",
".",
"CompareKeys",
"(",
"key",
",",
"nextKey",
")",
"\n",
"if",
"cmp",
">",
"0",
"{",
"// x.key < next.key < key. We can continue to move right.",
"x",
"=",
"next",
"\n",
"continue",
"\n",
"}",
"\n",
"if",
"cmp",
"==",
"0",
"{",
"// x.key < key == next.key.",
"if",
"allowEqual",
"{",
"return",
"next",
",",
"true",
"\n",
"}",
"\n",
"if",
"!",
"less",
"{",
"// We want >, so go to base level to grab the next bigger note.",
"return",
"s",
".",
"getNext",
"(",
"next",
",",
"0",
")",
",",
"false",
"\n",
"}",
"\n",
"// We want <. If not base level, we should go closer in the next level.",
"if",
"level",
">",
"0",
"{",
"level",
"--",
"\n",
"continue",
"\n",
"}",
"\n",
"// On base level. Return x.",
"if",
"x",
"==",
"s",
".",
"head",
"{",
"return",
"nil",
",",
"false",
"\n",
"}",
"\n",
"return",
"x",
",",
"false",
"\n",
"}",
"\n",
"// cmp < 0. In other words, x.key < key < next.",
"if",
"level",
">",
"0",
"{",
"level",
"--",
"\n",
"continue",
"\n",
"}",
"\n",
"// At base level. Need to return something.",
"if",
"!",
"less",
"{",
"return",
"next",
",",
"false",
"\n",
"}",
"\n",
"// Try to return x. Make sure it is not a head node.",
"if",
"x",
"==",
"s",
".",
"head",
"{",
"return",
"nil",
",",
"false",
"\n",
"}",
"\n",
"return",
"x",
",",
"false",
"\n",
"}",
"\n",
"}"
] |
9,968 | all-9969 | [
"OnKeyPress",
"sets",
"the",
"callback",
"that",
"is",
"called",
"when",
"a",
"user",
"presses",
"a",
"Key",
"while",
"the",
"controls",
"is",
"active",
".",
"If",
"a",
"handler",
"processes",
"the",
"key",
"it",
"should",
"return",
"true",
".",
"If",
"handler",
"returns",
"false",
"it",
"means",
"that",
"the",
"default",
"handler",
"has",
"to",
"process",
"the",
"key"
] | [
"func",
"(",
"l",
"*",
"TableView",
")",
"OnKeyPress",
"(",
"fn",
"func",
"(",
"<mask>",
".",
"Key",
")",
"bool",
")",
"{",
"l",
".",
"onKeyPress",
"=",
"fn",
"\n",
"}"
] |
9,969 | all-9970 | [
"TruncateID",
"returns",
"a",
"shorten",
"id",
"Following",
"two",
"functions",
"are",
"from",
"github",
".",
"com",
"/",
"docker",
"/",
"docker",
"/",
"utils",
"module",
".",
"It",
"was",
"way",
"overkill",
"to",
"include",
"the",
"whole",
"module",
"so",
"we",
"just",
"have",
"these",
"bits",
"that",
"we",
"re",
"using",
"here",
"."
] | [
"func",
"TruncateID",
"(",
"id",
"string",
")",
"string",
"{",
"shortLen",
":=",
"12",
"\n",
"if",
"len",
"(",
"id",
")",
"<",
"shortLen",
"{",
"shortLen",
"=",
"len",
"(",
"id",
")",
"\n",
"}",
"\n",
"return",
"<mask>",
"[",
":",
"shortLen",
"]",
"\n",
"}"
] |
9,970 | all-9971 | [
"Addr",
"returns",
"binded",
"socket",
"address",
".",
"For",
"bind",
"port",
"0",
"in",
"tests"
] | [
"func",
"(",
"rcv",
"*",
"HTTP",
")",
"Addr",
"(",
")",
"<mask>",
".",
"Addr",
"{",
"if",
"rcv",
".",
"listener",
"==",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n",
"return",
"rcv",
".",
"listener",
".",
"Addr",
"(",
")",
"\n",
"}"
] |
9,971 | all-9972 | [
"New",
"creates",
"a",
"new",
"instance",
"of",
"Servers",
"with",
"applied",
"options",
"."
] | [
"func",
"New",
"(",
"opts",
"...",
"Option",
")",
"(",
"s",
"*",
"Servers",
")",
"{",
"s",
"=",
"&",
"Servers",
"{",
"logger",
":",
"stdLogger",
"{",
"}",
",",
"recover",
":",
"func",
"(",
")",
"{",
"}",
",",
"}",
"\n",
"for",
"_",
",",
"opt",
":=",
"<mask>",
"opts",
"{",
"opt",
"(",
"s",
")",
"\n",
"}",
"\n",
"return",
"\n",
"}"
] |
9,972 | all-9973 | [
"NewCheckPerfCommand",
"returns",
"the",
"cobra",
"command",
"for",
"check",
"perf",
"."
] | [
"func",
"NewCheckPerfCommand",
"(",
")",
"*",
"cobra",
".",
"Command",
"{",
"cmd",
":=",
"&",
"cobra",
".",
"Command",
"{",
"Use",
":",
"\"",
"\"",
",",
"Short",
":",
"\"",
"\"",
",",
"Run",
":",
"newCheckPerfCommand",
",",
"}",
"\n\n",
"// TODO: support customized configuration",
"cmd",
".",
"Flags",
"(",
")",
".",
"StringVar",
"(",
"&",
"checkPerfLoad",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
")",
"\n",
"cmd",
".",
"Flags",
"(",
")",
".",
"StringVar",
"(",
"&",
"checkPerfPrefix",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
")",
"\n",
"cmd",
".",
"Flags",
"(",
")",
".",
"BoolVar",
"(",
"&",
"autoCompact",
",",
"\"",
"\"",
",",
"<mask>",
",",
"\"",
"\"",
")",
"\n",
"cmd",
".",
"Flags",
"(",
")",
".",
"BoolVar",
"(",
"&",
"autoDefrag",
",",
"\"",
"\"",
",",
"false",
",",
"\"",
"\"",
")",
"\n\n",
"return",
"cmd",
"\n",
"}"
] |
9,973 | all-9974 | [
"GetMetricQueryOk",
"returns",
"a",
"tuple",
"with",
"the",
"MetricQuery",
"field",
"if",
"it",
"s",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"and",
"a",
"boolean",
"to",
"check",
"if",
"the",
"value",
"has",
"been",
"set",
"."
] | [
"func",
"(",
"q",
"*",
"QueryValueRequest",
")",
"GetMetricQueryOk",
"(",
")",
"(",
"string",
",",
"bool",
")",
"{",
"if",
"q",
"==",
"nil",
"||",
"q",
".",
"MetricQuery",
"==",
"nil",
"{",
"return",
"\"",
"\"",
",",
"<mask>",
"\n",
"}",
"\n",
"return",
"*",
"q",
".",
"MetricQuery",
",",
"true",
"\n",
"}"
] |
9,974 | all-9975 | [
"Return",
"the",
"data",
"to",
"be",
"contained",
"in",
"a",
"QR",
"Code",
"for",
"this",
"TOTP",
"with",
"the",
"given",
"label",
"."
] | [
"func",
"(",
"totp",
"*",
"TOTP",
")",
"QRCodeData",
"(",
"label",
"string",
")",
"string",
"{",
"// We need to URL Escape the label, but at the same time, spaces come through",
"// as +'s, so we need to reverse that encoding...",
"label",
"=",
"url",
".",
"QueryEscape",
"(",
"label",
")",
"\n",
"label",
"=",
"strings",
".",
"Replace",
"(",
"label",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"-",
"1",
")",
"\n",
"return",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"<mask>",
",",
"totp",
".",
"Secret",
"(",
")",
",",
"totp",
".",
"Digits",
",",
"totp",
".",
"Period",
")",
"\n",
"}"
] |
9,975 | all-9976 | [
"findDockerVersions",
"loops",
"over",
"all",
"known",
"API",
"versions",
"and",
"finds",
"which",
"ones",
"are",
"supported",
"by",
"the",
"docker",
"daemon",
"on",
"the",
"host"
] | [
"func",
"findDockerVersions",
"(",
"ctx",
"context",
".",
"Context",
",",
"endpoint",
"string",
")",
"map",
"[",
"dockerclient",
".",
"DockerVersion",
"]",
"sdkclient",
".",
"Client",
"{",
"// if the client version returns a MinAPIVersion, use it to return all the",
"// Docker clients between MinAPIVersion and APIVersion, else try pinging",
"// the clients in getKnownAPIVersions",
"var",
"minAPIVersion",
",",
"apiVersion",
"string",
"\n",
"// get a Docker client with the default supported version",
"client",
",",
"err",
":=",
"newVersionedClient",
"(",
"endpoint",
",",
"string",
"(",
"minDockerAPIVersion",
")",
")",
"\n",
"if",
"err",
"==",
"nil",
"{",
"derivedCtx",
",",
"cancel",
":=",
"<mask>",
".",
"WithTimeout",
"(",
"ctx",
",",
"dockerclient",
".",
"VersionTimeout",
")",
"\n",
"defer",
"cancel",
"(",
")",
"\n",
"serverVersion",
",",
"err",
":=",
"client",
".",
"ServerVersion",
"(",
"derivedCtx",
")",
"\n",
"if",
"err",
"==",
"nil",
"{",
"apiVersion",
"=",
"serverVersion",
".",
"APIVersion",
"\n",
"// check if the docker.Version has MinAPIVersion value",
"if",
"serverVersion",
".",
"MinAPIVersion",
"!=",
"\"",
"\"",
"{",
"minAPIVersion",
"=",
"serverVersion",
".",
"MinAPIVersion",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n",
"clients",
":=",
"make",
"(",
"map",
"[",
"dockerclient",
".",
"DockerVersion",
"]",
"sdkclient",
".",
"Client",
")",
"\n",
"for",
"_",
",",
"version",
":=",
"range",
"dockerclient",
".",
"GetKnownAPIVersions",
"(",
")",
"{",
"dockerClient",
",",
"err",
":=",
"getDockerClientForVersion",
"(",
"endpoint",
",",
"string",
"(",
"version",
")",
",",
"minAPIVersion",
",",
"apiVersion",
",",
"ctx",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"log",
".",
"Infof",
"(",
"\"",
"\"",
",",
"version",
",",
"err",
")",
"\n",
"continue",
"\n",
"}",
"\n",
"clients",
"[",
"version",
"]",
"=",
"dockerClient",
"\n",
"}",
"\n",
"return",
"clients",
"\n",
"}"
] |
9,976 | all-9977 | [
"write",
"writes",
"a",
"reverse",
"template",
"to",
"the",
"buffer",
"."
] | [
"func",
"(",
"t",
"*",
"template",
")",
"write",
"(",
"re",
"*",
"syntax",
".",
"Regexp",
")",
"{",
"switch",
"<mask>",
".",
"Op",
"{",
"case",
"syntax",
".",
"OpLiteral",
":",
"if",
"t",
".",
"level",
"==",
"0",
"{",
"for",
"_",
",",
"r",
":=",
"range",
"re",
".",
"Rune",
"{",
"t",
".",
"buffer",
".",
"WriteRune",
"(",
"r",
")",
"\n",
"if",
"r",
"==",
"'%'",
"{",
"t",
".",
"buffer",
".",
"WriteRune",
"(",
"'%'",
")",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n",
"case",
"syntax",
".",
"OpCapture",
":",
"t",
".",
"level",
"++",
"\n",
"t",
".",
"index",
"++",
"\n",
"if",
"t",
".",
"level",
"==",
"1",
"{",
"t",
".",
"groups",
"=",
"append",
"(",
"t",
".",
"groups",
",",
"re",
".",
"Name",
")",
"\n",
"t",
".",
"indices",
"=",
"append",
"(",
"t",
".",
"indices",
",",
"t",
".",
"index",
")",
"\n",
"t",
".",
"buffer",
".",
"WriteString",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"for",
"_",
",",
"sub",
":=",
"range",
"re",
".",
"Sub",
"{",
"t",
".",
"write",
"(",
"sub",
")",
"\n",
"}",
"\n",
"t",
".",
"level",
"--",
"\n",
"case",
"syntax",
".",
"OpConcat",
":",
"for",
"_",
",",
"sub",
":=",
"range",
"re",
".",
"Sub",
"{",
"t",
".",
"write",
"(",
"sub",
")",
"\n",
"}",
"\n",
"}",
"\n",
"}"
] |
9,977 | all-9978 | [
"flattenClusterDasConfigInfo",
"saves",
"a",
"ClusterDasConfigInfo",
"into",
"the",
"supplied",
"ResourceData",
"."
] | [
"func",
"flattenClusterDasConfigInfo",
"(",
"d",
"*",
"schema",
".",
"ResourceData",
",",
"obj",
"types",
".",
"ClusterDasConfigInfo",
",",
"version",
"viapi",
".",
"VSphereVersion",
")",
"error",
"{",
"var",
"dsIDs",
"[",
"]",
"string",
"\n",
"for",
"_",
",",
"v",
":=",
"range",
"obj",
".",
"HeartbeatDatastore",
"{",
"dsIDs",
"=",
"append",
"(",
"dsIDs",
",",
"v",
".",
"Value",
")",
"\n",
"}",
"\n\n",
"err",
":=",
"structure",
".",
"SetBatch",
"(",
"d",
",",
"map",
"[",
"string",
"]",
"interface",
"{",
"}",
"{",
"\"",
"\"",
":",
"obj",
".",
"Enabled",
",",
"\"",
"\"",
":",
"obj",
".",
"HBDatastoreCandidatePolicy",
",",
"\"",
"\"",
":",
"obj",
".",
"HostMonitoring",
",",
"\"",
"\"",
":",
"obj",
".",
"VmMonitoring",
",",
"\"",
"\"",
":",
"dsIDs",
",",
"}",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"if",
"err",
":=",
"flattenClusterDasVMSettings",
"(",
"d",
",",
"obj",
".",
"DefaultVmSettings",
",",
"version",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"if",
"err",
":=",
"flattenResourceVSphereComputeClusterDasAdvancedOptions",
"(",
"d",
",",
"obj",
".",
"Option",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"if",
"version",
".",
"Newer",
"(",
"viapi",
".",
"VSphereVersion",
"{",
"Product",
":",
"<mask>",
".",
"Product",
",",
"Major",
":",
"6",
"}",
")",
"{",
"if",
"err",
":=",
"d",
".",
"Set",
"(",
"\"",
"\"",
",",
"obj",
".",
"VmComponentProtecting",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"}",
"\n\n",
"// If AdmissionControlEnabled is false, AdmissionControlPolicy is still",
"// configured. Set ha_admission_control_policy to disabled before",
"// flattenBaseClusterDasAdmissionControlPolicy, so AdmissionControlEnabled",
"// can still be checked.",
"if",
"*",
"obj",
".",
"AdmissionControlEnabled",
"==",
"false",
"{",
"return",
"d",
".",
"Set",
"(",
"\"",
"\"",
",",
"clusterAdmissionControlTypeDisabled",
")",
"\n",
"}",
"\n",
"return",
"flattenBaseClusterDasAdmissionControlPolicy",
"(",
"d",
",",
"obj",
".",
"AdmissionControlPolicy",
",",
"version",
")",
"\n",
"}"
] |
9,978 | all-9979 | [
"NewLabel",
"is",
"the",
"Label",
"initializer",
".",
"This",
"call",
"implements",
"the",
"NewWidget",
"convention",
"by",
"taking",
"a",
"*",
"Window",
"and",
"and",
"an",
"anchor",
"point",
"to",
"render",
"the",
"widget",
"."
] | [
"func",
"NewLabel",
"(",
"w",
"*",
"Window",
",",
"x",
",",
"y",
"int",
")",
"(",
"Widgeter",
",",
"error",
")",
"{",
"return",
"&",
"<mask>",
"{",
"Widget",
":",
"MakeWidget",
"(",
"w",
",",
"x",
",",
"y",
")",
",",
"}",
",",
"nil",
"\n",
"}"
] |
9,979 | all-9980 | [
"ServeHTTP",
"validates",
"an",
"incoming",
"webhook",
"and",
"puts",
"it",
"into",
"the",
"event",
"channel",
"."
] | [
"func",
"(",
"s",
"*",
"Server",
")",
"ServeHTTP",
"(",
"w",
"http",
".",
"ResponseWriter",
",",
"r",
"*",
"http",
".",
"<mask>",
")",
"{",
"// TODO: Move webhook handling logic out of hook binary so that we don't have to import all",
"// plugins just to validate the webhook.",
"eventType",
",",
"eventGUID",
",",
"payload",
",",
"ok",
",",
"_",
":=",
"github",
".",
"ValidateWebhook",
"(",
"w",
",",
"r",
",",
"s",
".",
"tokenGenerator",
"(",
")",
")",
"\n",
"if",
"!",
"ok",
"{",
"return",
"\n",
"}",
"\n",
"fmt",
".",
"Fprint",
"(",
"w",
",",
"\"",
"\"",
")",
"\n\n",
"if",
"err",
":=",
"s",
".",
"handleEvent",
"(",
"eventType",
",",
"eventGUID",
",",
"payload",
")",
";",
"err",
"!=",
"nil",
"{",
"logrus",
".",
"WithError",
"(",
"err",
")",
".",
"Error",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"}"
] |
9,980 | all-9981 | [
"NewTXTRegistry",
"returns",
"new",
"TXTRegistry",
"object"
] | [
"func",
"NewTXTRegistry",
"(",
"provider",
"provider",
".",
"<mask>",
",",
"txtPrefix",
",",
"ownerID",
"string",
",",
"cacheInterval",
"time",
".",
"Duration",
")",
"(",
"*",
"TXTRegistry",
",",
"error",
")",
"{",
"if",
"ownerID",
"==",
"\"",
"\"",
"{",
"return",
"nil",
",",
"errors",
".",
"New",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"mapper",
":=",
"newPrefixNameMapper",
"(",
"txtPrefix",
")",
"\n\n",
"return",
"&",
"TXTRegistry",
"{",
"provider",
":",
"provider",
",",
"ownerID",
":",
"ownerID",
",",
"mapper",
":",
"mapper",
",",
"cacheInterval",
":",
"cacheInterval",
",",
"}",
",",
"nil",
"\n",
"}"
] |
9,981 | all-9982 | [
"HasQuery",
"returns",
"a",
"boolean",
"if",
"a",
"field",
"has",
"been",
"set",
"."
] | [
"func",
"(",
"w",
"*",
"Widget",
")",
"HasQuery",
"(",
")",
"bool",
"{",
"if",
"w",
"!=",
"nil",
"&&",
"w",
".",
"Query",
"!=",
"nil",
"{",
"return",
"true",
"\n",
"}",
"\n\n",
"return",
"<mask>",
"\n",
"}"
] |
9,982 | all-9983 | [
"Cmds",
"returns",
"a",
"slice",
"containing",
"debug",
"commands",
"."
] | [
"func",
"Cmds",
"(",
"noMetrics",
"*",
"bool",
",",
"noPortForwarding",
"*",
"bool",
")",
"[",
"]",
"*",
"cobra",
".",
"Command",
"{",
"var",
"commands",
"[",
"]",
"*",
"cobra",
".",
"Command",
"\n\n",
"dump",
":=",
"&",
"cobra",
".",
"Command",
"{",
"Short",
":",
"\"",
"\"",
",",
"Long",
":",
"\"",
"\"",
",",
"Run",
":",
"cmdutil",
".",
"RunFixedArgs",
"(",
"0",
",",
"func",
"(",
"args",
"[",
"]",
"string",
")",
"error",
"{",
"client",
",",
"err",
":=",
"client",
".",
"NewOnUserMachine",
"(",
"!",
"*",
"noMetrics",
",",
"!",
"*",
"noPortForwarding",
",",
"\"",
"\"",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"defer",
"client",
".",
"Close",
"(",
")",
"\n",
"return",
"client",
".",
"Dump",
"(",
"os",
".",
"Stdout",
")",
"\n",
"}",
")",
",",
"}",
"\n",
"commands",
"=",
"append",
"(",
"commands",
",",
"cmdutil",
".",
"CreateAlias",
"(",
"dump",
",",
"\"",
"\"",
")",
")",
"\n\n",
"var",
"duration",
"time",
".",
"Duration",
"\n",
"profile",
":=",
"&",
"cobra",
".",
"Command",
"{",
"Use",
":",
"\"",
"\"",
",",
"Short",
":",
"\"",
"\"",
",",
"Long",
":",
"\"",
"\"",
",",
"Run",
":",
"cmdutil",
".",
"RunFixedArgs",
"(",
"1",
",",
"func",
"(",
"args",
"[",
"]",
"string",
")",
"error",
"{",
"client",
",",
"err",
":=",
"client",
".",
"NewOnUserMachine",
"(",
"!",
"*",
"noMetrics",
",",
"!",
"*",
"noPortForwarding",
",",
"\"",
"\"",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"defer",
"client",
".",
"Close",
"(",
")",
"\n",
"return",
"client",
".",
"Profile",
"(",
"args",
"[",
"0",
"]",
",",
"duration",
",",
"<mask>",
".",
"Stdout",
")",
"\n",
"}",
")",
",",
"}",
"\n",
"profile",
".",
"Flags",
"(",
")",
".",
"DurationVarP",
"(",
"&",
"duration",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"time",
".",
"Minute",
",",
"\"",
"\"",
")",
"\n",
"commands",
"=",
"append",
"(",
"commands",
",",
"cmdutil",
".",
"CreateAlias",
"(",
"profile",
",",
"\"",
"\"",
")",
")",
"\n\n",
"binary",
":=",
"&",
"cobra",
".",
"Command",
"{",
"Short",
":",
"\"",
"\"",
",",
"Long",
":",
"\"",
"\"",
",",
"Run",
":",
"cmdutil",
".",
"RunFixedArgs",
"(",
"0",
",",
"func",
"(",
"args",
"[",
"]",
"string",
")",
"error",
"{",
"client",
",",
"err",
":=",
"client",
".",
"NewOnUserMachine",
"(",
"!",
"*",
"noMetrics",
",",
"!",
"*",
"noPortForwarding",
",",
"\"",
"\"",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"defer",
"client",
".",
"Close",
"(",
")",
"\n",
"return",
"client",
".",
"Binary",
"(",
"os",
".",
"Stdout",
")",
"\n",
"}",
")",
",",
"}",
"\n",
"commands",
"=",
"append",
"(",
"commands",
",",
"cmdutil",
".",
"CreateAlias",
"(",
"binary",
",",
"\"",
"\"",
")",
")",
"\n\n",
"var",
"profileFile",
"string",
"\n",
"var",
"binaryFile",
"string",
"\n",
"pprof",
":=",
"&",
"cobra",
".",
"Command",
"{",
"Use",
":",
"\"",
"\"",
",",
"Short",
":",
"\"",
"\"",
",",
"Long",
":",
"\"",
"\"",
",",
"Run",
":",
"cmdutil",
".",
"RunFixedArgs",
"(",
"1",
",",
"func",
"(",
"args",
"[",
"]",
"string",
")",
"error",
"{",
"client",
",",
"err",
":=",
"client",
".",
"NewOnUserMachine",
"(",
"!",
"*",
"noMetrics",
",",
"!",
"*",
"noPortForwarding",
",",
"\"",
"\"",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"defer",
"client",
".",
"Close",
"(",
")",
"\n",
"var",
"eg",
"errgroup",
".",
"Group",
"\n",
"// Download the profile",
"eg",
".",
"Go",
"(",
"func",
"(",
")",
"(",
"retErr",
"error",
")",
"{",
"if",
"args",
"[",
"0",
"]",
"==",
"\"",
"\"",
"{",
"fmt",
".",
"Printf",
"(",
"\"",
"\"",
",",
"units",
".",
"HumanDuration",
"(",
"duration",
")",
")",
"\n",
"}",
"\n",
"f",
",",
"err",
":=",
"os",
".",
"Create",
"(",
"profileFile",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"defer",
"func",
"(",
")",
"{",
"if",
"err",
":=",
"f",
".",
"Close",
"(",
")",
";",
"err",
"!=",
"nil",
"&&",
"retErr",
"==",
"nil",
"{",
"retErr",
"=",
"err",
"\n",
"}",
"\n",
"}",
"(",
")",
"\n",
"return",
"client",
".",
"Profile",
"(",
"args",
"[",
"0",
"]",
",",
"duration",
",",
"f",
")",
"\n",
"}",
")",
"\n",
"// Download the binary",
"eg",
".",
"Go",
"(",
"func",
"(",
")",
"(",
"retErr",
"error",
")",
"{",
"f",
",",
"err",
":=",
"os",
".",
"Create",
"(",
"binaryFile",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"defer",
"func",
"(",
")",
"{",
"if",
"err",
":=",
"f",
".",
"Close",
"(",
")",
";",
"err",
"!=",
"nil",
"&&",
"retErr",
"==",
"nil",
"{",
"retErr",
"=",
"err",
"\n",
"}",
"\n",
"}",
"(",
")",
"\n",
"return",
"client",
".",
"Binary",
"(",
"f",
")",
"\n",
"}",
")",
"\n",
"if",
"err",
":=",
"eg",
".",
"Wait",
"(",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"cmd",
":=",
"exec",
".",
"Command",
"(",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"binaryFile",
",",
"profileFile",
")",
"\n",
"cmd",
".",
"Stdin",
"=",
"os",
".",
"Stdin",
"\n",
"cmd",
".",
"Stdout",
"=",
"os",
".",
"Stdout",
"\n",
"cmd",
".",
"Stderr",
"=",
"os",
".",
"Stderr",
"\n",
"return",
"cmd",
".",
"Run",
"(",
")",
"\n",
"}",
")",
",",
"}",
"\n",
"pprof",
".",
"Flags",
"(",
")",
".",
"StringVar",
"(",
"&",
"profileFile",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
")",
"\n",
"pprof",
".",
"Flags",
"(",
")",
".",
"StringVar",
"(",
"&",
"binaryFile",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
")",
"\n",
"pprof",
".",
"Flags",
"(",
")",
".",
"DurationVarP",
"(",
"&",
"duration",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"time",
".",
"Minute",
",",
"\"",
"\"",
")",
"\n",
"commands",
"=",
"append",
"(",
"commands",
",",
"cmdutil",
".",
"CreateAlias",
"(",
"pprof",
",",
"\"",
"\"",
")",
")",
"\n\n",
"debug",
":=",
"&",
"cobra",
".",
"Command",
"{",
"Short",
":",
"\"",
"\"",
",",
"Long",
":",
"\"",
"\"",
",",
"}",
"\n",
"commands",
"=",
"append",
"(",
"commands",
",",
"cmdutil",
".",
"CreateAlias",
"(",
"debug",
",",
"\"",
"\"",
")",
")",
"\n\n",
"return",
"commands",
"\n",
"}"
] |
9,983 | all-9984 | [
"MustTrustLine",
"retrieves",
"the",
"TrustLine",
"value",
"from",
"the",
"union",
"panicing",
"if",
"the",
"value",
"is",
"not",
"set",
"."
] | [
"func",
"(",
"u",
"LedgerEntryData",
")",
"MustTrustLine",
"(",
")",
"TrustLineEntry",
"{",
"val",
",",
"ok",
":=",
"u",
".",
"GetTrustLine",
"(",
")",
"\n\n",
"if",
"!",
"<mask>",
"{",
"panic",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"return",
"val",
"\n",
"}"
] |
9,984 | all-9985 | [
"cleans",
"up",
"description",
"removing",
"blank",
"lines",
"and",
"extraneous",
"info"
] | [
"func",
"cleanDescription",
"(",
"doc",
"string",
")",
"string",
"{",
"docBits",
":=",
"strings",
".",
"Split",
"(",
"<mask>",
",",
"\"",
"\"",
")",
"\n",
"doc",
"=",
"docBits",
"[",
"0",
"]",
"\n\n",
"lines",
":=",
"strings",
".",
"Split",
"(",
"doc",
",",
"\"",
"\\n",
"\"",
")",
"\n",
"fullLines",
":=",
"make",
"(",
"[",
"]",
"string",
",",
"len",
"(",
"lines",
")",
")",
"\n",
"i",
":=",
"0",
"\n",
"for",
"_",
",",
"line",
":=",
"range",
"lines",
"{",
"if",
"len",
"(",
"line",
")",
">",
"0",
"&&",
"!",
"blankRegexp",
".",
"MatchString",
"(",
"line",
")",
"{",
"fullLines",
"[",
"i",
"]",
"=",
"line",
"\n",
"i",
"++",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"strings",
".",
"Join",
"(",
"fullLines",
"[",
":",
"i",
"]",
",",
"\"",
"\\n",
"\"",
")",
"\n",
"}"
] |
9,985 | all-9986 | [
"GetAllContainerIDs",
"returns",
"all",
"of",
"the",
"Container",
"Ids"
] | [
"func",
"(",
"state",
"*",
"DockerTaskEngineState",
")",
"GetAllContainerIDs",
"(",
")",
"[",
"]",
"string",
"{",
"state",
".",
"lock",
".",
"RLock",
"(",
")",
"\n",
"defer",
"<mask>",
".",
"lock",
".",
"RUnlock",
"(",
")",
"\n\n",
"var",
"ids",
"[",
"]",
"string",
"\n",
"for",
"id",
":=",
"range",
"state",
".",
"idToTask",
"{",
"ids",
"=",
"append",
"(",
"ids",
",",
"id",
")",
"\n",
"}",
"\n\n",
"return",
"ids",
"\n",
"}"
] |
9,986 | all-9987 | [
"DeProvisionHost",
"-",
"make",
"a",
"deprovision",
"call",
"to",
"innkeeper",
"for",
"a",
"given",
"requestID"
] | [
"func",
"(",
"s",
"*",
"IkClient",
")",
"DeProvisionHost",
"(",
"requestID",
"string",
")",
"(",
"resp",
"*",
"GetStatusResponse",
",",
"err",
"error",
")",
"{",
"resp",
"=",
"<mask>",
"(",
"GetStatusResponse",
")",
"\n",
"qp",
":=",
"url",
".",
"Values",
"{",
"}",
"\n",
"qp",
".",
"Add",
"(",
"requestIDGetParam",
",",
"requestID",
")",
"\n",
"err",
"=",
"s",
".",
"Call",
"(",
"RouteDeProvisionHost",
",",
"qp",
",",
"resp",
")",
"\n",
"return",
"\n",
"}"
] |
9,987 | all-9988 | [
"MarshalJSON",
"supports",
"json",
".",
"Marshaler",
"interface"
] | [
"func",
"(",
"v",
"GetMatchedStylesForNodeReturns",
")",
"MarshalJSON",
"(",
")",
"(",
"[",
"]",
"<mask>",
",",
"error",
")",
"{",
"w",
":=",
"jwriter",
".",
"Writer",
"{",
"}",
"\n",
"easyjsonC5a4559bEncodeGithubComChromedpCdprotoCss41",
"(",
"&",
"w",
",",
"v",
")",
"\n",
"return",
"w",
".",
"Buffer",
".",
"BuildBytes",
"(",
")",
",",
"w",
".",
"Error",
"\n",
"}"
] |
9,988 | all-9989 | [
"Infof",
"records",
"the",
"log",
"with",
"info",
"level"
] | [
"func",
"Infof",
"(",
"format",
"string",
",",
"args",
"...",
"<mask>",
"{",
"}",
")",
"{",
"logger",
".",
"Output",
"(",
"2",
",",
"LevelInfo",
",",
"fmt",
".",
"Sprintf",
"(",
"format",
",",
"args",
"...",
")",
")",
"\n",
"}"
] |
9,989 | all-9990 | [
"NetworkUpdateDescription",
"updates",
"the",
"description",
"of",
"the",
"network",
"with",
"the",
"given",
"ID",
"."
] | [
"func",
"NetworkUpdateDescription",
"(",
"tx",
"*",
"sql",
".",
"Tx",
",",
"id",
"int64",
",",
"<mask>",
"string",
")",
"error",
"{",
"_",
",",
"err",
":=",
"tx",
".",
"Exec",
"(",
"\"",
"\"",
",",
"description",
",",
"id",
")",
"\n",
"return",
"err",
"\n",
"}"
] |
9,990 | all-9991 | [
"TODO",
"(",
"jrick",
")",
"GIcon",
"/",
"*",
"func",
"(",
"v",
"*",
"Entry",
")",
"SetIconFromGIcon",
"()",
"{",
"}",
"GetIconStorageType",
"()",
"is",
"a",
"wrapper",
"around",
"gtk_entry_get_icon_storage_type",
"()",
"."
] | [
"func",
"(",
"v",
"*",
"<mask>",
")",
"GetIconStorageType",
"(",
"iconPos",
"EntryIconPosition",
")",
"ImageType",
"{",
"c",
":=",
"C",
".",
"gtk_entry_get_icon_storage_type",
"(",
"v",
".",
"native",
"(",
")",
",",
"C",
".",
"GtkEntryIconPosition",
"(",
"iconPos",
")",
")",
"\n",
"return",
"ImageType",
"(",
"c",
")",
"\n",
"}"
] |
9,991 | all-9992 | [
"Remove",
"removes",
"an",
"host"
] | [
"func",
"(",
"d",
"*",
"Driver",
")",
"Remove",
"(",
")",
"error",
"{",
"s",
",",
"err",
":=",
"d",
".",
"GetState",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"if",
"s",
"==",
"<mask>",
".",
"Running",
"{",
"if",
"err",
":=",
"d",
".",
"Kill",
"(",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"}",
"\n\n",
"return",
"cmd",
"(",
"\"",
"\\\\",
"\"",
",",
"d",
".",
"MachineName",
",",
"\"",
"\"",
")",
"\n",
"}"
] |
9,992 | all-9993 | [
"Options",
"creates",
"an",
"Options",
"query",
"."
] | [
"func",
"(",
"idx",
"*",
"<mask>",
")",
"Options",
"(",
"row",
"*",
"PQLRowQuery",
",",
"opts",
"...",
"OptionsOption",
")",
"*",
"PQLBaseQuery",
"{",
"oo",
":=",
"&",
"OptionsOptions",
"{",
"}",
"\n",
"for",
"_",
",",
"opt",
":=",
"range",
"opts",
"{",
"opt",
"(",
"oo",
")",
"\n",
"}",
"\n",
"text",
":=",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"row",
".",
"serialize",
"(",
")",
",",
"oo",
".",
"marshal",
"(",
")",
")",
"\n",
"return",
"NewPQLBaseQuery",
"(",
"text",
",",
"idx",
",",
"nil",
")",
"\n",
"}"
] |
9,993 | all-9994 | [
"NewTLSListener",
"handshakes",
"TLS",
"connections",
"and",
"performs",
"optional",
"CRL",
"checking",
"."
] | [
"func",
"NewTLSListener",
"(",
"l",
"net",
".",
"Listener",
",",
"tlsinfo",
"*",
"TLSInfo",
")",
"(",
"<mask>",
".",
"Listener",
",",
"error",
")",
"{",
"check",
":=",
"func",
"(",
"context",
".",
"Context",
",",
"*",
"tls",
".",
"Conn",
")",
"error",
"{",
"return",
"nil",
"}",
"\n",
"return",
"newTLSListener",
"(",
"l",
",",
"tlsinfo",
",",
"check",
")",
"\n",
"}"
] |
9,994 | all-9995 | [
"export",
"FindSequenceOnDisk"
] | [
"func",
"FindSequenceOnDisk",
"(",
"<mask>",
"*",
"C",
".",
"char",
")",
"(",
"FileSeqId",
",",
"Error",
")",
"{",
"return",
"FindSequenceOnDiskPad",
"(",
"pattern",
",",
"C",
".",
"int",
"(",
"fileseq",
".",
"PadStyleDefault",
")",
")",
"\n",
"}"
] |
9,995 | all-9996 | [
"Store",
"creates",
"a",
"Store",
"call",
".",
"Store",
"writes",
"the",
"result",
"of",
"the",
"row",
"query",
"to",
"the",
"specified",
"row",
".",
"If",
"the",
"row",
"already",
"exists",
"it",
"will",
"be",
"replaced",
".",
"The",
"destination",
"field",
"must",
"be",
"of",
"field",
"type",
"set",
"."
] | [
"func",
"(",
"f",
"*",
"Field",
")",
"Store",
"(",
"row",
"*",
"PQLRowQuery",
",",
"rowIDOrKey",
"<mask>",
"{",
"}",
")",
"*",
"PQLBaseQuery",
"{",
"rowStr",
",",
"err",
":=",
"formatIDKeyBool",
"(",
"rowIDOrKey",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"NewPQLBaseQuery",
"(",
"\"",
"\"",
",",
"f",
".",
"index",
",",
"err",
")",
"\n",
"}",
"\n",
"return",
"NewPQLBaseQuery",
"(",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"row",
".",
"serialize",
"(",
")",
".",
"String",
"(",
")",
",",
"f",
".",
"name",
",",
"rowStr",
")",
",",
"f",
".",
"index",
",",
"nil",
")",
"\n",
"}"
] |
9,996 | all-9997 | [
"Next",
"moves",
"iterator",
"to",
"the",
"next",
"item"
] | [
"func",
"(",
"it",
"*",
"Iterator",
")",
"Next",
"(",
")",
"{",
"if",
"it",
".",
"deleted",
"{",
"it",
".",
"deleted",
"=",
"false",
"\n",
"return",
"\n",
"}",
"\n\n",
"retry",
":",
"it",
".",
"valid",
"=",
"true",
"\n",
"next",
",",
"deleted",
":=",
"it",
".",
"curr",
".",
"getNext",
"(",
"0",
")",
"\n",
"if",
"deleted",
"{",
"// Current node is deleted. Unlink current node from the level",
"// and make next node as current node.",
"// If it fails, refresh the path buffer and obtain new current node.",
"if",
"it",
".",
"s",
".",
"helpDelete",
"(",
"0",
",",
"it",
".",
"prev",
",",
"it",
".",
"curr",
",",
"next",
",",
"&",
"it",
".",
"s",
".",
"Stats",
")",
"{",
"it",
".",
"curr",
"=",
"next",
"\n",
"}",
"else",
"{",
"atomic",
".",
"AddUint64",
"(",
"&",
"it",
".",
"s",
".",
"Stats",
".",
"readConflicts",
",",
"1",
")",
"\n",
"found",
":=",
"it",
".",
"s",
".",
"findPath",
"(",
"it",
".",
"curr",
".",
"Item",
"(",
")",
",",
"it",
".",
"cmp",
",",
"<mask>",
".",
"buf",
",",
"&",
"it",
".",
"s",
".",
"Stats",
")",
"!=",
"nil",
"\n",
"last",
":=",
"it",
".",
"curr",
"\n",
"it",
".",
"prev",
"=",
"it",
".",
"buf",
".",
"preds",
"[",
"0",
"]",
"\n",
"it",
".",
"curr",
"=",
"it",
".",
"buf",
".",
"succs",
"[",
"0",
"]",
"\n",
"if",
"found",
"&&",
"last",
"==",
"it",
".",
"curr",
"{",
"goto",
"retry",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"else",
"{",
"it",
".",
"prev",
"=",
"it",
".",
"curr",
"\n",
"it",
".",
"curr",
"=",
"next",
"\n",
"}",
"\n",
"}"
] |
9,997 | all-9998 | [
"URIValue",
"returns",
"the",
"value",
"of",
"the",
"URI",
"pointer",
"passed",
"in",
"or",
"the",
"default",
"value",
"if",
"the",
"pointer",
"is",
"nil",
"."
] | [
"func",
"URIValue",
"(",
"v",
"*",
"strfmt",
".",
"URI",
")",
"strfmt",
".",
"URI",
"{",
"if",
"v",
"==",
"nil",
"{",
"return",
"strfmt",
".",
"URI",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"<mask>",
"*",
"v",
"\n",
"}"
] |
9,998 | all-9999 | [
"HasFontSize",
"returns",
"a",
"boolean",
"if",
"a",
"field",
"has",
"been",
"set",
"."
] | [
"func",
"(",
"n",
"*",
"NoteDefinition",
")",
"HasFontSize",
"(",
")",
"bool",
"{",
"if",
"n",
"!=",
"nil",
"&&",
"n",
".",
"FontSize",
"!=",
"nil",
"{",
"return",
"<mask>",
"\n",
"}",
"\n\n",
"return",
"false",
"\n",
"}"
] |
9,999 | all-10000 | [
"MarshalJSON",
"marshals",
"CgroupResource",
"object",
"using",
"duplicate",
"struct",
"CgroupResourceJSON"
] | [
"func",
"(",
"cgroup",
"*",
"CgroupResource",
")",
"MarshalJSON",
"(",
")",
"(",
"[",
"]",
"<mask>",
",",
"error",
")",
"{",
"if",
"cgroup",
"==",
"nil",
"{",
"return",
"nil",
",",
"errors",
".",
"New",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"return",
"json",
".",
"Marshal",
"(",
"cgroupResourceJSON",
"{",
"cgroup",
".",
"cgroupRoot",
",",
"cgroup",
".",
"cgroupMountPath",
",",
"cgroup",
".",
"GetCreatedAt",
"(",
")",
",",
"func",
"(",
")",
"*",
"CgroupStatus",
"{",
"desiredState",
":=",
"cgroup",
".",
"GetDesiredStatus",
"(",
")",
"\n",
"status",
":=",
"CgroupStatus",
"(",
"desiredState",
")",
"\n",
"return",
"&",
"status",
"\n",
"}",
"(",
")",
",",
"func",
"(",
")",
"*",
"CgroupStatus",
"{",
"knownState",
":=",
"cgroup",
".",
"GetKnownStatus",
"(",
")",
"\n",
"status",
":=",
"CgroupStatus",
"(",
"knownState",
")",
"\n",
"return",
"&",
"status",
"\n",
"}",
"(",
")",
",",
"cgroup",
".",
"resourceSpec",
",",
"}",
")",
"\n",
"}"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.