id
int32 0
25.3k
| idx
stringlengths 5
9
| nl_tokens
sequencelengths 1
418
| pl_tokens
sequencelengths 22
4.98k
|
---|---|---|---|
9,800 | all-9801 | [
"NewLedgerHeaderHistoryEntryExt",
"creates",
"a",
"new",
"LedgerHeaderHistoryEntryExt",
"."
] | [
"func",
"NewLedgerHeaderHistoryEntryExt",
"(",
"v",
"int32",
",",
"<mask>",
"interface",
"{",
"}",
")",
"(",
"result",
"LedgerHeaderHistoryEntryExt",
",",
"err",
"error",
")",
"{",
"result",
".",
"V",
"=",
"v",
"\n",
"switch",
"int32",
"(",
"v",
")",
"{",
"case",
"0",
":",
"// void",
"}",
"\n",
"return",
"\n",
"}"
] |
9,801 | all-9802 | [
"GetTypeOk",
"returns",
"a",
"tuple",
"with",
"the",
"Type",
"field",
"if",
"it",
"s",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"and",
"a",
"boolean",
"to",
"check",
"if",
"the",
"value",
"has",
"been",
"set",
"."
] | [
"func",
"(",
"f",
"*",
"FreeTextDefinition",
")",
"GetTypeOk",
"(",
")",
"(",
"string",
",",
"bool",
")",
"{",
"if",
"f",
"==",
"nil",
"||",
"f",
".",
"<mask>",
"==",
"nil",
"{",
"return",
"\"",
"\"",
",",
"false",
"\n",
"}",
"\n",
"return",
"*",
"f",
".",
"Type",
",",
"true",
"\n",
"}"
] |
9,802 | all-9803 | [
"SearchMetricClusters",
"returns",
"metric",
"clusters",
"matching",
"the",
"specified",
"search",
"query",
"and",
"/",
"or",
"filter",
".",
"If",
"nil",
"is",
"passed",
"for",
"both",
"parameters",
"all",
"metric",
"clusters",
"will",
"be",
"returned",
"."
] | [
"func",
"(",
"a",
"*",
"API",
")",
"SearchMetricClusters",
"(",
"searchCriteria",
"*",
"SearchQueryType",
",",
"filterCriteria",
"*",
"SearchFilterType",
")",
"(",
"*",
"[",
"]",
"MetricCluster",
",",
"error",
")",
"{",
"q",
":=",
"url",
".",
"Values",
"{",
"}",
"\n\n",
"if",
"searchCriteria",
"!=",
"nil",
"&&",
"*",
"searchCriteria",
"!=",
"\"",
"\"",
"{",
"q",
".",
"Set",
"(",
"\"",
"\"",
",",
"string",
"(",
"*",
"searchCriteria",
")",
")",
"\n",
"}",
"\n\n",
"if",
"filterCriteria",
"!=",
"nil",
"&&",
"len",
"(",
"*",
"filterCriteria",
")",
">",
"0",
"{",
"for",
"<mask>",
",",
"criteria",
":=",
"range",
"*",
"filterCriteria",
"{",
"for",
"_",
",",
"val",
":=",
"range",
"criteria",
"{",
"q",
".",
"Add",
"(",
"filter",
",",
"val",
")",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n\n",
"if",
"q",
".",
"Encode",
"(",
")",
"==",
"\"",
"\"",
"{",
"return",
"a",
".",
"FetchMetricClusters",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"reqURL",
":=",
"url",
".",
"URL",
"{",
"Path",
":",
"config",
".",
"MetricClusterPrefix",
",",
"RawQuery",
":",
"q",
".",
"Encode",
"(",
")",
",",
"}",
"\n\n",
"result",
",",
"err",
":=",
"a",
".",
"Get",
"(",
"reqURL",
".",
"String",
"(",
")",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"}",
"\n\n",
"var",
"clusters",
"[",
"]",
"MetricCluster",
"\n",
"if",
"err",
":=",
"json",
".",
"Unmarshal",
"(",
"result",
",",
"&",
"clusters",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"return",
"&",
"clusters",
",",
"nil",
"\n",
"}"
] |
9,803 | all-9804 | [
"Take",
"a",
"list",
"of",
"paths",
"and",
"reduce",
"them",
"to",
"cleaned",
"and",
"unique",
"paths",
".",
"Return",
"two",
"slices",
"separated",
"by",
"directory",
"paths",
"and",
"sequence",
"patterns"
] | [
"func",
"preparePaths",
"(",
"paths",
"[",
"]",
"string",
")",
"(",
"[",
"]",
"string",
",",
"fileseq",
".",
"FileSequences",
")",
"{",
"var",
"(",
"fi",
"os",
".",
"FileInfo",
"\n",
"err",
"error",
"\n",
")",
"\n\n",
"dirs",
":=",
"make",
"(",
"[",
"]",
"string",
",",
"0",
")",
"\n",
"seqs",
":=",
"make",
"(",
"fileseq",
".",
"FileSequences",
",",
"0",
")",
"\n",
"previous",
":=",
"make",
"(",
"map",
"[",
"string",
"]",
"struct",
"{",
"}",
")",
"\n\n",
"for",
"_",
",",
"p",
":=",
"range",
"paths",
"{",
"p",
":=",
"strings",
".",
"TrimSpace",
"(",
"filepath",
".",
"Clean",
"(",
"p",
")",
")",
"\n",
"if",
"p",
"==",
"\"",
"\"",
"{",
"continue",
"\n",
"}",
"\n\n",
"if",
"_",
",",
"seen",
":=",
"previous",
"[",
"p",
"]",
";",
"<mask>",
"{",
"continue",
"\n",
"}",
"\n",
"previous",
"[",
"p",
"]",
"=",
"struct",
"{",
"}",
"{",
"}",
"\n\n",
"if",
"fi",
",",
"err",
"=",
"os",
".",
"Stat",
"(",
"p",
")",
";",
"err",
"!=",
"nil",
"{",
"// If the path doesn't exist, test it for",
"// a valid fileseq pattern",
"if",
"seq",
",",
"err",
":=",
"fileseq",
".",
"NewFileSequence",
"(",
"p",
")",
";",
"err",
"==",
"nil",
"{",
"seqs",
"=",
"append",
"(",
"seqs",
",",
"seq",
")",
"\n",
"continue",
"\n",
"}",
"\n\n",
"fmt",
".",
"Fprintf",
"(",
"errOut",
",",
"\"",
"\\n",
"\"",
",",
"ErrorPath",
",",
"p",
",",
"err",
")",
"\n",
"continue",
"\n",
"}",
"\n\n",
"if",
"!",
"fi",
".",
"IsDir",
"(",
")",
"{",
"continue",
"\n",
"}",
"\n\n",
"dirs",
"=",
"append",
"(",
"dirs",
",",
"p",
")",
"\n",
"}",
"\n\n",
"return",
"dirs",
",",
"seqs",
"\n",
"}"
] |
9,804 | all-9805 | [
"NewCRDSource",
"creates",
"a",
"new",
"crdSource",
"with",
"the",
"given",
"config",
"."
] | [
"func",
"NewCRDSource",
"(",
"crdClient",
"rest",
".",
"Interface",
",",
"namespace",
",",
"kind",
"string",
",",
"scheme",
"*",
"runtime",
".",
"Scheme",
")",
"(",
"<mask>",
",",
"error",
")",
"{",
"return",
"&",
"crdSource",
"{",
"crdResource",
":",
"strings",
".",
"ToLower",
"(",
"kind",
")",
"+",
"\"",
"\"",
",",
"namespace",
":",
"namespace",
",",
"crdClient",
":",
"crdClient",
",",
"codec",
":",
"runtime",
".",
"NewParameterCodec",
"(",
"scheme",
")",
",",
"}",
",",
"nil",
"\n",
"}"
] |
9,805 | all-9806 | [
"ns1ChangesByZone",
"separates",
"a",
"multi",
"-",
"zone",
"change",
"into",
"a",
"single",
"change",
"per",
"zone",
"."
] | [
"func",
"ns1ChangesByZone",
"(",
"zones",
"[",
"]",
"*",
"dns",
".",
"Zone",
",",
"changeSets",
"[",
"]",
"*",
"ns1Change",
")",
"map",
"[",
"string",
"]",
"[",
"]",
"*",
"ns1Change",
"{",
"changes",
":=",
"make",
"(",
"map",
"[",
"string",
"]",
"[",
"]",
"*",
"ns1Change",
")",
"\n",
"zoneNameIDMapper",
":=",
"zoneIDName",
"{",
"}",
"\n",
"for",
"_",
",",
"z",
":=",
"range",
"zones",
"{",
"zoneNameIDMapper",
".",
"Add",
"(",
"z",
".",
"Zone",
",",
"z",
".",
"Zone",
")",
"\n",
"changes",
"[",
"z",
".",
"Zone",
"]",
"=",
"[",
"]",
"*",
"ns1Change",
"{",
"}",
"\n",
"}",
"\n\n",
"for",
"_",
",",
"c",
":=",
"range",
"changeSets",
"{",
"<mask>",
",",
"_",
":=",
"zoneNameIDMapper",
".",
"FindZone",
"(",
"c",
".",
"Endpoint",
".",
"DNSName",
")",
"\n",
"if",
"zone",
"==",
"\"",
"\"",
"{",
"log",
".",
"Debugf",
"(",
"\"",
"\"",
",",
"c",
".",
"Endpoint",
".",
"DNSName",
")",
"\n",
"continue",
"\n",
"}",
"\n",
"changes",
"[",
"zone",
"]",
"=",
"append",
"(",
"changes",
"[",
"zone",
"]",
",",
"c",
")",
"\n",
"}",
"\n\n",
"return",
"changes",
"\n",
"}"
] |
9,806 | all-9807 | [
"Wait",
"waits",
"for",
"the",
"command",
"to",
"exit",
"and",
"waits",
"for",
"any",
"copying",
"to",
"stdin",
"or",
"copying",
"from",
"stdout",
"or",
"stderr",
"to",
"complete",
".",
"The",
"command",
"must",
"have",
"been",
"started",
"by",
"Start",
".",
"The",
"returned",
"error",
"is",
"nil",
"if",
"the",
"command",
"runs",
"has",
"no",
"problems",
"copying",
"stdin",
"stdout",
"and",
"stderr",
"and",
"exits",
"with",
"a",
"zero",
"exit",
"status",
".",
"If",
"the",
"command",
"fails",
"to",
"run",
"or",
"doesn",
"t",
"complete",
"successfully",
"the",
"error",
"is",
"of",
"type",
"*",
"ExitError",
".",
"Other",
"error",
"types",
"may",
"be",
"returned",
"for",
"I",
"/",
"O",
"problems",
".",
"If",
"c",
".",
"Stdin",
"is",
"not",
"an",
"*",
"os",
".",
"File",
"Wait",
"also",
"waits",
"for",
"the",
"I",
"/",
"O",
"loop",
"copying",
"from",
"c",
".",
"Stdin",
"into",
"the",
"process",
"s",
"standard",
"input",
"to",
"complete",
".",
"Wait",
"releases",
"any",
"resources",
"associated",
"with",
"the",
"Cmd",
"."
] | [
"func",
"(",
"c",
"*",
"Cmd",
")",
"Wait",
"(",
")",
"error",
"{",
"if",
"c",
".",
"Process",
"==",
"nil",
"{",
"return",
"<mask>",
".",
"New",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"if",
"c",
".",
"finished",
"{",
"return",
"errors",
".",
"New",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"c",
".",
"finished",
"=",
"true",
"\n\n",
"state",
",",
"err",
":=",
"c",
".",
"Process",
".",
"Wait",
"(",
")",
"\n\n",
"return",
"c",
".",
"WaitIO",
"(",
"state",
",",
"err",
")",
"\n",
"}"
] |
9,807 | all-9808 | [
"getReleaseNote",
"returns",
"the",
"release",
"note",
"from",
"a",
"PR",
"body",
"assumes",
"that",
"the",
"PR",
"body",
"followed",
"the",
"PR",
"template"
] | [
"func",
"getReleaseNote",
"(",
"body",
"string",
")",
"string",
"{",
"potentialMatch",
":=",
"noteMatcherRE",
".",
"FindStringSubmatch",
"(",
"<mask>",
")",
"\n",
"if",
"potentialMatch",
"==",
"nil",
"{",
"return",
"\"",
"\"",
"\n",
"}",
"\n",
"return",
"strings",
".",
"TrimSpace",
"(",
"potentialMatch",
"[",
"1",
"]",
")",
"\n",
"}"
] |
9,808 | all-9809 | [
"HasGroup",
"returns",
"a",
"boolean",
"if",
"a",
"field",
"has",
"been",
"set",
"."
] | [
"func",
"(",
"c",
"*",
"CheckStatusDefinition",
")",
"HasGroup",
"(",
")",
"bool",
"{",
"if",
"c",
"!=",
"nil",
"&&",
"c",
".",
"<mask>",
"!=",
"nil",
"{",
"return",
"true",
"\n",
"}",
"\n\n",
"return",
"false",
"\n",
"}"
] |
9,809 | all-9810 | [
"export",
"gogpgme_assuan_inquiry_callback"
] | [
"func",
"gogpgme_assuan_inquiry_callback",
"(",
"handle",
"unsafe",
".",
"Pointer",
",",
"cName",
"*",
"C",
".",
"<mask>",
",",
"cArgs",
"*",
"C",
".",
"char",
")",
"C",
".",
"gpgme_error_t",
"{",
"name",
":=",
"C",
".",
"GoString",
"(",
"cName",
")",
"\n",
"args",
":=",
"C",
".",
"GoString",
"(",
"cArgs",
")",
"\n",
"c",
":=",
"callbackLookup",
"(",
"uintptr",
"(",
"handle",
")",
")",
".",
"(",
"*",
"AssuanInquireCallback",
")",
"\n",
"if",
"*",
"c",
"==",
"nil",
"{",
"return",
"0",
"\n",
"}",
"\n",
"(",
"*",
"c",
")",
"(",
"name",
",",
"args",
")",
"\n",
"return",
"0",
"\n",
"}"
] |
9,810 | all-9811 | [
"GetStyleOk",
"returns",
"a",
"tuple",
"with",
"the",
"Style",
"field",
"if",
"it",
"s",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"and",
"a",
"boolean",
"to",
"check",
"if",
"the",
"value",
"has",
"been",
"set",
"."
] | [
"func",
"(",
"t",
"*",
"TileDefRequest",
")",
"GetStyleOk",
"(",
")",
"(",
"TileDefRequestStyle",
",",
"bool",
")",
"{",
"if",
"t",
"==",
"nil",
"||",
"t",
".",
"Style",
"==",
"nil",
"{",
"return",
"TileDefRequestStyle",
"{",
"}",
",",
"<mask>",
"\n",
"}",
"\n",
"return",
"*",
"t",
".",
"Style",
",",
"true",
"\n",
"}"
] |
9,811 | all-9812 | [
"ReadUint16",
"returns",
"the",
"next",
"value",
"in",
"the",
"buffer",
"as",
"a",
"uint16"
] | [
"func",
"(",
"r",
"*",
"ReadBuffer",
")",
"ReadUint16",
"(",
")",
"uint16",
"{",
"if",
"b",
":=",
"r",
".",
"ReadBytes",
"(",
"2",
")",
";",
"b",
"!=",
"nil",
"{",
"return",
"<mask>",
".",
"BigEndian",
".",
"Uint16",
"(",
"b",
")",
"\n",
"}",
"\n\n",
"return",
"0",
"\n",
"}"
] |
9,812 | all-9813 | [
"Check",
"if",
"the",
"unix",
"device",
"already",
"exists",
"."
] | [
"func",
"(",
"c",
"*",
"containerLXC",
")",
"deviceExistsInDevicesFolder",
"(",
"prefix",
"string",
",",
"path",
"string",
")",
"bool",
"{",
"relativeDestPath",
":=",
"strings",
".",
"TrimPrefix",
"(",
"path",
",",
"\"",
"\"",
")",
"\n",
"devName",
":=",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"strings",
".",
"Replace",
"(",
"prefix",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"-",
"1",
")",
",",
"strings",
".",
"Replace",
"(",
"relativeDestPath",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"-",
"1",
")",
")",
"\n",
"devPath",
":=",
"filepath",
".",
"Join",
"(",
"c",
".",
"DevicesPath",
"(",
")",
",",
"devName",
")",
"\n\n",
"return",
"<mask>",
".",
"PathExists",
"(",
"devPath",
")",
"\n",
"}"
] |
9,813 | all-9814 | [
"Restart",
"reboots",
"the",
"virtual",
"machine",
"instance",
"."
] | [
"func",
"(",
"d",
"*",
"Driver",
")",
"Restart",
"(",
")",
"error",
"{",
"if",
"err",
":=",
"d",
".",
"checkLegacyDriver",
"(",
"<mask>",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"// NOTE(ahmetalpbalkan) Azure will always keep the VM in Running state",
"// during the restart operation. Hence we rely on returned async operation",
"// polling to make sure the reboot is waited upon.",
"c",
",",
"err",
":=",
"d",
".",
"newAzureClient",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"return",
"c",
".",
"RestartVirtualMachine",
"(",
"d",
".",
"ResourceGroup",
",",
"d",
".",
"naming",
"(",
")",
".",
"VM",
"(",
")",
")",
"\n",
"}"
] |
9,814 | all-9815 | [
"WaitTilUptoDate",
"blocks",
"until",
"all",
"nodes",
"in",
"the",
"cluster",
"have",
"gotten",
"their",
"commitedIndex",
"upto",
"the",
"Index",
"from",
"the",
"last",
"successful",
"call",
"to",
"Apply"
] | [
"func",
"(",
"c",
"*",
"cluster",
")",
"WaitTilUptoDate",
"(",
"t",
"*",
"testing",
".",
"T",
",",
"maxWait",
"time",
".",
"Duration",
")",
"{",
"idx",
":=",
"c",
".",
"lastApplySuccess",
".",
"Index",
"(",
")",
"\n",
"start",
":=",
"time",
".",
"Now",
"(",
")",
"\n",
"for",
"true",
"{",
"allAtIdx",
":=",
"true",
"\n",
"for",
"i",
":=",
"0",
";",
"i",
"<",
"len",
"(",
"c",
".",
"nodes",
")",
";",
"i",
"++",
"{",
"nodeAppliedIdx",
":=",
"c",
".",
"nodes",
"[",
"i",
"]",
".",
"raft",
".",
"AppliedIndex",
"(",
")",
"\n",
"if",
"nodeAppliedIdx",
"<",
"idx",
"{",
"allAtIdx",
"=",
"false",
"\n",
"break",
"\n",
"}",
"else",
"if",
"nodeAppliedIdx",
">",
"idx",
"{",
"allAtIdx",
"=",
"false",
"\n",
"idx",
"=",
"nodeAppliedIdx",
"\n",
"<mask>",
"\n",
"}",
"\n",
"}",
"\n",
"if",
"allAtIdx",
"{",
"t",
".",
"Logf",
"(",
"\"",
"\"",
",",
"idx",
")",
"\n",
"return",
"\n",
"}",
"\n",
"if",
"time",
".",
"Now",
"(",
")",
".",
"Sub",
"(",
"start",
")",
">",
"maxWait",
"{",
"t",
".",
"Fatalf",
"(",
"\"",
"\"",
",",
"idx",
",",
"c",
".",
"appliedIndexes",
"(",
")",
")",
"\n",
"}",
"\n",
"time",
".",
"Sleep",
"(",
"time",
".",
"Millisecond",
"*",
"10",
")",
"\n",
"}",
"\n",
"}"
] |
9,815 | all-9816 | [
"Error",
"sets",
"response",
"status",
"code",
"to",
"the",
"given",
"value",
"and",
"sets",
"response",
"body",
"to",
"the",
"given",
"message",
"."
] | [
"func",
"(",
"ctx",
"*",
"RequestCtx",
")",
"Error",
"(",
"<mask>",
"string",
",",
"statusCode",
"int",
")",
"{",
"ctx",
".",
"Response",
".",
"Reset",
"(",
")",
"\n",
"ctx",
".",
"SetStatusCode",
"(",
"statusCode",
")",
"\n",
"ctx",
".",
"SetContentTypeBytes",
"(",
"defaultContentType",
")",
"\n",
"ctx",
".",
"SetBodyString",
"(",
"msg",
")",
"\n",
"}"
] |
9,816 | all-9817 | [
"NewRanch",
"creates",
"a",
"new",
"Ranch",
"object",
".",
"In",
":",
"config",
"-",
"path",
"to",
"resource",
"file",
"storage",
"-",
"path",
"to",
"where",
"to",
"save",
"/",
"restore",
"the",
"state",
"data",
"Out",
":",
"A",
"Ranch",
"object",
"loaded",
"from",
"config",
"/",
"storage",
"or",
"error"
] | [
"func",
"NewRanch",
"(",
"config",
"string",
",",
"s",
"*",
"<mask>",
")",
"(",
"*",
"Ranch",
",",
"error",
")",
"{",
"newRanch",
":=",
"&",
"Ranch",
"{",
"Storage",
":",
"s",
",",
"UpdateTime",
":",
"updateTime",
",",
"}",
"\n",
"if",
"config",
"!=",
"\"",
"\"",
"{",
"if",
"err",
":=",
"newRanch",
".",
"SyncConfig",
"(",
"config",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"}",
"\n",
"newRanch",
".",
"LogStatus",
"(",
")",
"\n",
"return",
"newRanch",
",",
"nil",
"\n",
"}"
] |
9,817 | all-9818 | [
"SetText",
"is",
"a",
"wrapper",
"around",
"gtk_label_set_text",
"()",
"."
] | [
"func",
"(",
"v",
"*",
"<mask>",
")",
"SetText",
"(",
"str",
"string",
")",
"{",
"cstr",
":=",
"C",
".",
"CString",
"(",
"str",
")",
"\n",
"defer",
"C",
".",
"free",
"(",
"unsafe",
".",
"Pointer",
"(",
"cstr",
")",
")",
"\n",
"C",
".",
"gtk_label_set_text",
"(",
"v",
".",
"native",
"(",
")",
",",
"(",
"*",
"C",
".",
"gchar",
")",
"(",
"cstr",
")",
")",
"\n",
"}"
] |
9,818 | all-9819 | [
"block",
"and",
"wait",
"for",
"a",
"sync",
"object",
"to",
"become",
"signaled"
] | [
"func",
"ClientWaitSync",
"(",
"sync",
"uintptr",
",",
"flags",
"uint32",
",",
"timeout",
"uint64",
")",
"uint32",
"{",
"ret",
":=",
"C",
".",
"glowClientWaitSync",
"(",
"gpClientWaitSync",
",",
"(",
"C",
".",
"GLsync",
")",
"(",
"sync",
")",
",",
"(",
"C",
".",
"GLbitfield",
")",
"(",
"flags",
")",
",",
"(",
"C",
".",
"GLuint64",
")",
"(",
"timeout",
")",
")",
"\n",
"return",
"(",
"uint32",
")",
"(",
"<mask>",
")",
"\n",
"}"
] |
9,819 | all-9820 | [
"HasTransferAllUserComments",
"returns",
"a",
"boolean",
"if",
"a",
"field",
"has",
"been",
"set",
"."
] | [
"func",
"(",
"c",
"*",
"ChannelSlackRequest",
")",
"HasTransferAllUserComments",
"(",
")",
"bool",
"{",
"if",
"c",
"!=",
"nil",
"&&",
"c",
".",
"TransferAllUserComments",
"!=",
"nil",
"{",
"return",
"true",
"\n",
"}",
"\n\n",
"return",
"<mask>",
"\n",
"}"
] |
9,820 | all-9821 | [
"ContainerPool",
"returns",
"the",
"storage",
"pool",
"of",
"a",
"given",
"container",
"."
] | [
"func",
"(",
"c",
"*",
"ClusterTx",
")",
"ContainerPool",
"(",
"project",
",",
"containerName",
"string",
")",
"(",
"string",
",",
"error",
")",
"{",
"// Get container storage volume. Since container names are globally",
"// unique, and their storage volumes carry the same name, their storage",
"// volumes are unique too.",
"poolName",
":=",
"\"",
"\"",
"\n",
"query",
":=",
"`\nSELECT storage_pools.name FROM storage_pools\n JOIN storage_volumes ON storage_pools.id=storage_volumes.storage_pool_id\n JOIN containers ON containers.name=storage_volumes.name\n JOIN projects ON projects.id=containers.project_id\n WHERE projects.name=? AND storage_volumes.node_id=? AND storage_volumes.name=? AND storage_volumes.type=?\n`",
"\n",
"inargs",
":=",
"[",
"]",
"interface",
"{",
"}",
"{",
"project",
",",
"c",
".",
"nodeID",
",",
"containerName",
",",
"StoragePoolVolumeTypeContainer",
"}",
"\n",
"outargs",
":=",
"[",
"]",
"interface",
"{",
"}",
"{",
"&",
"poolName",
"}",
"\n\n",
"err",
":=",
"c",
".",
"<mask>",
".",
"QueryRow",
"(",
"query",
",",
"inargs",
"...",
")",
".",
"Scan",
"(",
"outargs",
"...",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"if",
"err",
"==",
"sql",
".",
"ErrNoRows",
"{",
"return",
"\"",
"\"",
",",
"ErrNoSuchObject",
"\n",
"}",
"\n\n",
"return",
"\"",
"\"",
",",
"err",
"\n",
"}",
"\n\n",
"return",
"poolName",
",",
"nil",
"\n",
"}"
] |
9,821 | all-9822 | [
"MarshalJSON",
"supports",
"json",
".",
"Marshaler",
"interface"
] | [
"func",
"(",
"v",
"StopLoadingParams",
")",
"MarshalJSON",
"(",
")",
"(",
"[",
"]",
"<mask>",
",",
"error",
")",
"{",
"w",
":=",
"jwriter",
".",
"Writer",
"{",
"}",
"\n",
"easyjsonC5a4559bEncodeGithubComChromedpCdprotoPage4",
"(",
"&",
"w",
",",
"v",
")",
"\n",
"return",
"w",
".",
"Buffer",
".",
"BuildBytes",
"(",
")",
",",
"w",
".",
"Error",
"\n",
"}"
] |
9,822 | all-9823 | [
"appendActions",
"appends",
"*",
"only",
"*",
"actions",
"that",
"don",
"t",
"exist",
"in",
"actions",
"/",
"foo",
".",
"go",
".",
"if",
"the",
"action",
"already",
"exists",
"it",
"is",
"not",
"touched",
"."
] | [
"func",
"appendActions",
"(",
"f",
"genny",
".",
"File",
",",
"pres",
"*",
"presenter",
")",
"genny",
".",
"RunFn",
"{",
"return",
"func",
"(",
"r",
"*",
"genny",
".",
"Runner",
")",
"error",
"{",
"<mask>",
":=",
"f",
".",
"String",
"(",
")",
"\n",
"for",
"_",
",",
"ac",
":=",
"range",
"pres",
".",
"Options",
".",
"Actions",
"{",
"a",
":=",
"name",
".",
"New",
"(",
"ac",
")",
"\n",
"x",
":=",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"pres",
".",
"Name",
".",
"Pascalize",
"(",
")",
",",
"a",
".",
"Pascalize",
"(",
")",
")",
"\n",
"if",
"strings",
".",
"Contains",
"(",
"body",
",",
"x",
")",
"{",
"continue",
"\n",
"}",
"\n",
"pres",
".",
"Actions",
"=",
"append",
"(",
"pres",
".",
"Actions",
",",
"a",
")",
"\n",
"}",
"\n\n",
"a",
",",
"err",
":=",
"box",
".",
"FindString",
"(",
"\"",
"\"",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"f",
"=",
"genny",
".",
"NewFileS",
"(",
"f",
".",
"Name",
"(",
")",
"+",
"\"",
"\"",
",",
"f",
".",
"String",
"(",
")",
"+",
"a",
")",
"\n\n",
"f",
",",
"err",
"=",
"transform",
"(",
"pres",
",",
"f",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"return",
"r",
".",
"File",
"(",
"f",
")",
"\n",
"}",
"\n",
"}"
] |
9,823 | all-9824 | [
"Replace",
"provides",
"a",
"mock",
"function",
"with",
"given",
"fields",
":",
"key",
"store",
"src"
] | [
"func",
"(",
"_m",
"*",
"ObjectStore",
")",
"Replace",
"(",
"key",
"string",
",",
"store",
"string",
",",
"src",
"interface",
"{",
"}",
")",
"error",
"{",
"ret",
":=",
"_m",
".",
"Called",
"(",
"key",
",",
"<mask>",
",",
"src",
")",
"\n\n",
"var",
"r0",
"error",
"\n",
"if",
"rf",
",",
"ok",
":=",
"ret",
".",
"Get",
"(",
"0",
")",
".",
"(",
"func",
"(",
"string",
",",
"string",
",",
"interface",
"{",
"}",
")",
"error",
")",
";",
"ok",
"{",
"r0",
"=",
"rf",
"(",
"key",
",",
"store",
",",
"src",
")",
"\n",
"}",
"else",
"{",
"r0",
"=",
"ret",
".",
"Error",
"(",
"0",
")",
"\n",
"}",
"\n\n",
"return",
"r0",
"\n",
"}"
] |
9,824 | all-9825 | [
"Parse",
"native",
"names",
"into",
"go",
"parameter",
"names"
] | [
"func",
"toVarName",
"(",
"<mask>",
"string",
")",
"string",
"{",
"p",
":=",
"partsRegexp",
".",
"ReplaceAllString",
"(",
"name",
",",
"\"",
"\"",
")",
"\n",
"return",
"inflect",
".",
"CamelizeDownFirst",
"(",
"p",
")",
"\n",
"}"
] |
9,825 | all-9826 | [
"ProtoRecv",
"gets",
"a",
"protobuf",
"message",
"from",
"a",
"websocket"
] | [
"func",
"ProtoRecv",
"(",
"ws",
"*",
"websocket",
".",
"Conn",
",",
"msg",
"proto",
".",
"<mask>",
")",
"error",
"{",
"mt",
",",
"r",
",",
"err",
":=",
"ws",
".",
"NextReader",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"if",
"mt",
"!=",
"websocket",
".",
"BinaryMessage",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"buf",
",",
"err",
":=",
"ioutil",
".",
"ReadAll",
"(",
"r",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"err",
"=",
"proto",
".",
"Unmarshal",
"(",
"buf",
",",
"msg",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"return",
"nil",
"\n",
"}"
] |
9,826 | all-9827 | [
"GetGitHubClient",
"creates",
"a",
"client",
"for",
"each",
"token"
] | [
"func",
"GetGitHubClient",
"(",
"<mask>",
"string",
")",
"*",
"github",
".",
"Client",
"{",
"return",
"github",
".",
"NewClient",
"(",
"oauth2",
".",
"NewClient",
"(",
"oauth2",
".",
"NoContext",
",",
"oauth2",
".",
"StaticTokenSource",
"(",
"&",
"oauth2",
".",
"Token",
"{",
"AccessToken",
":",
"token",
"}",
")",
",",
")",
",",
")",
"\n",
"}"
] |
9,827 | all-9828 | [
"GetSteadyStateStatus",
"returns",
"the",
"steady",
"state",
"status",
"for",
"the",
"container",
".",
"If",
"Container",
".",
"steadyState",
"is",
"not",
"initialized",
"the",
"default",
"steady",
"state",
"status",
"defined",
"by",
"defaultContainerSteadyStateStatus",
"is",
"returned",
".",
"The",
"pause",
"container",
"s",
"steady",
"state",
"differs",
"from",
"that",
"of",
"other",
"containers",
"as",
"the",
"pause",
"container",
"can",
"reach",
"its",
"teady",
"state",
"once",
"networking",
"resources",
"have",
"been",
"provisioned",
"for",
"it",
"which",
"is",
"done",
"in",
"the",
"ContainerResourcesProvisioned",
"state"
] | [
"func",
"(",
"c",
"*",
"<mask>",
")",
"GetSteadyStateStatus",
"(",
")",
"apicontainerstatus",
".",
"ContainerStatus",
"{",
"if",
"c",
".",
"SteadyStateStatusUnsafe",
"==",
"nil",
"{",
"return",
"defaultContainerSteadyStateStatus",
"\n",
"}",
"\n",
"return",
"*",
"c",
".",
"SteadyStateStatusUnsafe",
"\n",
"}"
] |
9,828 | all-9829 | [
"Returns",
"same",
"path",
"as",
"Executable",
"returns",
"just",
"the",
"folder",
"path",
".",
"Excludes",
"the",
"executable",
"name",
"."
] | [
"func",
"ExecutableFolder",
"(",
")",
"(",
"string",
",",
"error",
")",
"{",
"p",
",",
"err",
":=",
"Executable",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"\"",
"\"",
",",
"err",
"\n",
"}",
"\n",
"<mask>",
",",
"_",
":=",
"filepath",
".",
"Split",
"(",
"p",
")",
"\n",
"return",
"folder",
",",
"nil",
"\n",
"}"
] |
9,829 | all-9830 | [
"NewVaultAgentTokenQuery",
"creates",
"a",
"new",
"dependency",
"."
] | [
"func",
"NewVaultAgentTokenQuery",
"(",
"path",
"string",
")",
"(",
"*",
"VaultAgentTokenQuery",
",",
"error",
")",
"{",
"return",
"&",
"VaultAgentTokenQuery",
"{",
"stopCh",
":",
"<mask>",
"(",
"chan",
"struct",
"{",
"}",
",",
"1",
")",
",",
"path",
":",
"path",
",",
"}",
",",
"nil",
"\n",
"}"
] |
9,830 | all-9831 | [
"DeleteTeam",
"removes",
"team",
".",
"ID",
"from",
"GitHub",
".",
"See",
"https",
":",
"//",
"developer",
".",
"github",
".",
"com",
"/",
"v3",
"/",
"teams",
"/",
"#delete",
"-",
"team"
] | [
"func",
"(",
"c",
"*",
"Client",
")",
"DeleteTeam",
"(",
"id",
"int",
")",
"error",
"{",
"c",
".",
"log",
"(",
"\"",
"\"",
",",
"id",
")",
"\n",
"path",
":=",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"id",
")",
"\n",
"_",
",",
"err",
":=",
"c",
".",
"request",
"(",
"&",
"request",
"{",
"method",
":",
"http",
".",
"MethodDelete",
",",
"path",
":",
"<mask>",
",",
"exitCodes",
":",
"[",
"]",
"int",
"{",
"204",
"}",
",",
"}",
",",
"nil",
")",
"\n",
"return",
"err",
"\n",
"}"
] |
9,831 | all-9832 | [
"ToString",
"returns",
"port",
"information",
"in",
"a",
"pretty",
"-",
"printed",
"format"
] | [
"func",
"(",
"p",
"Port",
")",
"ToString",
"(",
")",
"(",
"out",
"string",
")",
"{",
"out",
"+=",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\\n",
"\"",
",",
"p",
".",
"ID",
",",
"p",
".",
"Protocol",
",",
"p",
".",
"State",
")",
"\n",
"for",
"_",
",",
"script",
":=",
"range",
"p",
".",
"Scripts",
"{",
"output",
":=",
"\"",
"\"",
"\n",
"for",
"_",
",",
"<mask>",
":=",
"range",
"strings",
".",
"Split",
"(",
"script",
".",
"Output",
",",
"\"",
"\\n",
"\"",
")",
"{",
"output",
"+=",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\\n",
"\"",
",",
"line",
")",
"\n",
"}",
"\n",
"out",
"+=",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\\n",
"\\n",
"\"",
",",
"script",
".",
"Name",
",",
"output",
")",
"\n",
"}",
"\n",
"return",
"\n",
"}"
] |
9,832 | all-9833 | [
"ServiceInfoFromMetadata",
"gets",
"the",
"service",
"information",
"from",
"the",
"metadata",
"or",
"returns",
"empty",
"strings"
] | [
"func",
"ServiceInfoFromMetadata",
"(",
"<mask>",
"metadata",
".",
"MD",
")",
"(",
"serviceName",
",",
"serviceVersion",
",",
"netAddress",
"string",
",",
"err",
"error",
")",
"{",
"serviceNameL",
",",
"ok",
":=",
"md",
"[",
"\"",
"\"",
"]",
"\n",
"if",
"ok",
"&&",
"len",
"(",
"serviceNameL",
")",
">",
"0",
"{",
"serviceName",
"=",
"serviceNameL",
"[",
"0",
"]",
"\n",
"}",
"\n",
"serviceVersionL",
",",
"ok",
":=",
"md",
"[",
"\"",
"\"",
"]",
"\n",
"if",
"ok",
"&&",
"len",
"(",
"serviceVersionL",
")",
">",
"0",
"{",
"serviceVersion",
"=",
"serviceVersionL",
"[",
"0",
"]",
"\n",
"}",
"\n",
"netAddressL",
",",
"ok",
":=",
"md",
"[",
"\"",
"\"",
"]",
"\n",
"if",
"ok",
"&&",
"len",
"(",
"netAddressL",
")",
">",
"0",
"{",
"netAddress",
"=",
"netAddressL",
"[",
"0",
"]",
"\n",
"}",
"\n",
"return",
"\n",
"}"
] |
9,833 | all-9834 | [
"UnmarshalJSON",
"supports",
"json",
".",
"Unmarshaler",
"interface"
] | [
"func",
"(",
"v",
"*",
"GetPartialAXTreeParams",
")",
"UnmarshalJSON",
"(",
"data",
"[",
"]",
"byte",
")",
"error",
"{",
"r",
":=",
"jlexer",
".",
"Lexer",
"{",
"Data",
":",
"<mask>",
"}",
"\n",
"easyjsonC5a4559bDecodeGithubComChromedpCdprotoAccessibility6",
"(",
"&",
"r",
",",
"v",
")",
"\n",
"return",
"r",
".",
"Error",
"(",
")",
"\n",
"}"
] |
9,834 | all-9835 | [
"Parse",
"parses",
"the",
"given",
"string",
"as",
"a",
"signal",
".",
"If",
"the",
"signal",
"is",
"not",
"found",
"an",
"error",
"is",
"returned",
"."
] | [
"func",
"Parse",
"(",
"s",
"string",
")",
"(",
"<mask>",
".",
"Signal",
",",
"error",
")",
"{",
"sig",
",",
"ok",
":=",
"SignalLookup",
"[",
"strings",
".",
"ToUpper",
"(",
"s",
")",
"]",
"\n",
"if",
"!",
"ok",
"{",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"s",
",",
"ValidSignals",
")",
"\n",
"}",
"\n",
"return",
"sig",
",",
"nil",
"\n",
"}"
] |
9,835 | all-9836 | [
"lexSpace",
"scans",
"a",
"run",
"of",
"space",
"characters",
".",
"One",
"space",
"has",
"already",
"been",
"seen",
"."
] | [
"func",
"lexSpace",
"(",
"l",
"*",
"lexer",
")",
"stateFn",
"{",
"for",
"isSpace",
"(",
"l",
".",
"peek",
"(",
")",
")",
"{",
"l",
".",
"next",
"(",
")",
"\n",
"}",
"\n",
"l",
".",
"<mask>",
"(",
")",
"\n",
"return",
"lexStatements",
"\n",
"}"
] |
9,836 | all-9837 | [
"GetWriter",
"returns",
"flate",
".",
"Writer",
"from",
"the",
"pool",
"or",
"creates",
"a",
"new",
"one",
"with",
"flate",
".",
"BestCompression",
"if",
"the",
"pool",
"is",
"empty",
"."
] | [
"func",
"(",
"pool",
"*",
"DeflatePool",
")",
"GetWriter",
"(",
"dst",
"io",
".",
"<mask>",
")",
"(",
"writer",
"*",
"flate",
".",
"Writer",
")",
"{",
"if",
"w",
":=",
"pool",
".",
"pool",
".",
"Get",
"(",
")",
";",
"w",
"!=",
"nil",
"{",
"writer",
"=",
"w",
".",
"(",
"*",
"flate",
".",
"Writer",
")",
"\n",
"writer",
".",
"Reset",
"(",
"dst",
")",
"\n",
"}",
"else",
"{",
"writer",
",",
"_",
"=",
"flate",
".",
"NewWriter",
"(",
"dst",
",",
"flate",
".",
"BestCompression",
")",
"\n",
"}",
"\n",
"return",
"writer",
"\n",
"}"
] |
9,837 | all-9838 | [
"gtk_action_bar_new",
"()"
] | [
"func",
"ActionBarNew",
"(",
")",
"(",
"*",
"ActionBar",
",",
"error",
")",
"{",
"c",
":=",
"C",
".",
"gtk_action_bar_new",
"(",
")",
"\n",
"if",
"c",
"==",
"nil",
"{",
"<mask>",
"nil",
",",
"nilPtrErr",
"\n",
"}",
"\n",
"return",
"wrapActionBar",
"(",
"glib",
".",
"Take",
"(",
"unsafe",
".",
"Pointer",
"(",
"c",
")",
")",
")",
",",
"nil",
"\n",
"}"
] |
9,838 | all-9839 | [
"resolveExistingPathToFullyExplicit",
"is",
"the",
"same",
"as",
"ResolvePathToFullyExplicit",
"but",
"without",
"the",
"special",
"case",
"for",
"missing",
"final",
"component",
"."
] | [
"func",
"resolveExistingPathToFullyExplicit",
"(",
"path",
"string",
")",
"(",
"string",
",",
"error",
")",
"{",
"resolved",
",",
"err",
":=",
"filepath",
".",
"Abs",
"(",
"<mask>",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"\"",
"\"",
",",
"err",
"// Coverage: This can fail only if os.Getwd() fails.",
"\n",
"}",
"\n",
"resolved",
",",
"err",
"=",
"filepath",
".",
"EvalSymlinks",
"(",
"resolved",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"\"",
"\"",
",",
"err",
"\n",
"}",
"\n",
"return",
"filepath",
".",
"Clean",
"(",
"resolved",
")",
",",
"nil",
"\n",
"}"
] |
9,839 | all-9840 | [
"WithParent",
"constructs",
"and",
"returns",
"a",
"Process",
"with",
"a",
"given",
"parent",
"."
] | [
"func",
"WithParent",
"(",
"parent",
"Process",
")",
"Process",
"{",
"if",
"<mask>",
"==",
"nil",
"{",
"panic",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"q",
":=",
"newProcess",
"(",
"nil",
")",
"\n",
"parent",
".",
"AddChild",
"(",
"q",
")",
"\n",
"return",
"q",
"\n",
"}"
] |
9,840 | all-9841 | [
"Add",
"adds",
"a",
"new",
"key",
":",
"value",
"to",
"current",
"Cache",
"instance",
".",
"Errors",
":",
"DuplicatedKeyError",
"when",
"requested",
"key",
"already",
"exists",
"."
] | [
"func",
"(",
"s",
"*",
"Cache",
")",
"Add",
"(",
"key",
"string",
",",
"value",
"<mask>",
"{",
"}",
")",
"error",
"{",
"lckStatus",
":=",
"s",
".",
"removeExpired",
"(",
")",
"\n\n",
"i",
":=",
"&",
"cacheItem",
"{",
"expireAt",
":",
"time",
".",
"Now",
"(",
")",
".",
"Add",
"(",
"s",
".",
"lifetime",
")",
",",
"lifetime",
":",
"s",
".",
"lifetime",
",",
"value",
":",
"value",
",",
"}",
"\n\n",
"if",
"lckStatus",
"==",
"raiqub",
".",
"ReadLocked",
"{",
"s",
".",
"RUnlock",
"(",
")",
"\n",
"s",
".",
"Lock",
"(",
")",
"\n",
"}",
"\n",
"defer",
"s",
".",
"Unlock",
"(",
")",
"\n\n",
"if",
"_",
",",
"ok",
":=",
"s",
".",
"values",
"[",
"key",
"]",
";",
"ok",
"{",
"return",
"raiqub",
".",
"DuplicatedKeyError",
"(",
"key",
")",
"\n",
"}",
"\n\n",
"s",
".",
"values",
"[",
"key",
"]",
"=",
"i",
"\n",
"return",
"nil",
"\n",
"}"
] |
9,841 | all-9842 | [
"cleanNotify",
"is",
"used",
"to",
"delete",
"notify",
"."
] | [
"func",
"(",
"s",
"*",
"followerReplication",
")",
"cleanNotify",
"(",
"v",
"*",
"verifyFuture",
")",
"{",
"s",
".",
"notifyLock",
".",
"Lock",
"(",
")",
"\n",
"<mask>",
"(",
"s",
".",
"notify",
",",
"v",
")",
"\n",
"s",
".",
"notifyLock",
".",
"Unlock",
"(",
")",
"\n",
"}"
] |
9,842 | all-9843 | [
"CacheFasthttp",
"accepts",
"two",
"parameters",
"first",
"is",
"the",
"fasthttp",
".",
"RequestHandler",
"which",
"you",
"want",
"to",
"cache",
"its",
"result",
"the",
"second",
"is",
"optional",
"the",
"cache",
"Entry",
"s",
"expiration",
"duration",
"if",
"the",
"expiration",
"<",
"=",
"2",
"seconds",
"then",
"expiration",
"is",
"taken",
"by",
"the",
"cache",
"-",
"control",
"s",
"maxage",
"header",
"returns",
"a",
"fhttp",
".",
"Handler",
"with",
"a",
"ServeHTTP",
"which",
"is",
"the",
"fasthttp",
".",
"RequestHandler",
"which",
"you",
"can",
"use",
"as",
"your",
"default",
"router",
"or",
"per",
"-",
"route",
"handler",
"All",
"type",
"of",
"responses",
"are",
"cached",
"templates",
"json",
"text",
"anything",
".",
"You",
"can",
"add",
"validators",
"with",
"this",
"function"
] | [
"func",
"CacheFasthttp",
"(",
"bodyHandler",
"fasthttp",
".",
"RequestHandler",
",",
"expiration",
"time",
".",
"Duration",
")",
"*",
"fhttp",
".",
"<mask>",
"{",
"return",
"fhttp",
".",
"NewHandler",
"(",
"bodyHandler",
",",
"expiration",
")",
"\n",
"}"
] |
9,843 | all-9844 | [
"neighbourCount",
"calculates",
"the",
"Moore",
"neighborhood",
"of",
"(",
"x",
"y",
")",
"."
] | [
"func",
"neighbourCount",
"(",
"a",
"[",
"]",
"bool",
",",
"width",
",",
"height",
",",
"x",
",",
"y",
"int",
")",
"int",
"{",
"c",
":=",
"0",
"\n",
"for",
"j",
":=",
"-",
"1",
";",
"j",
"<=",
"1",
";",
"j",
"++",
"{",
"for",
"i",
":=",
"-",
"1",
";",
"i",
"<=",
"1",
";",
"i",
"++",
"{",
"if",
"i",
"==",
"0",
"&&",
"j",
"==",
"0",
"{",
"<mask>",
"\n",
"}",
"\n",
"x2",
":=",
"x",
"+",
"i",
"\n",
"y2",
":=",
"y",
"+",
"j",
"\n",
"if",
"x2",
"<",
"0",
"||",
"y2",
"<",
"0",
"||",
"width",
"<=",
"x2",
"||",
"height",
"<=",
"y2",
"{",
"continue",
"\n",
"}",
"\n",
"if",
"a",
"[",
"y2",
"*",
"width",
"+",
"x2",
"]",
"{",
"c",
"++",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"c",
"\n",
"}"
] |
9,844 | all-9845 | [
"Collect",
"cache",
"metrics"
] | [
"func",
"(",
"c",
"*",
"Cache",
")",
"Stat",
"(",
"<mask>",
"helper",
".",
"StatCallback",
")",
"{",
"s",
":=",
"c",
".",
"settings",
".",
"Load",
"(",
")",
".",
"(",
"*",
"cacheSettings",
")",
"\n\n",
"send",
"(",
"\"",
"\"",
",",
"float64",
"(",
"c",
".",
"Size",
"(",
")",
")",
")",
"\n",
"send",
"(",
"\"",
"\"",
",",
"float64",
"(",
"c",
".",
"Len",
"(",
")",
")",
")",
"\n",
"send",
"(",
"\"",
"\"",
",",
"float64",
"(",
"s",
".",
"maxSize",
")",
")",
"\n\n",
"helper",
".",
"SendAndSubstractUint32",
"(",
"\"",
"\"",
",",
"&",
"c",
".",
"stat",
".",
"queryCnt",
",",
"send",
")",
"\n",
"helper",
".",
"SendAndSubstractUint32",
"(",
"\"",
"\"",
",",
"&",
"c",
".",
"stat",
".",
"tagsNormalizeErrors",
",",
"send",
")",
"\n",
"helper",
".",
"SendAndSubstractUint32",
"(",
"\"",
"\"",
",",
"&",
"c",
".",
"stat",
".",
"overflowCnt",
",",
"send",
")",
"\n\n",
"helper",
".",
"SendAndSubstractUint32",
"(",
"\"",
"\"",
",",
"&",
"c",
".",
"stat",
".",
"queueBuildCnt",
",",
"send",
")",
"\n",
"helper",
".",
"SendAndSubstractUint32",
"(",
"\"",
"\"",
",",
"&",
"c",
".",
"stat",
".",
"queueBuildTimeMs",
",",
"send",
")",
"\n",
"helper",
".",
"SendUint32",
"(",
"\"",
"\"",
",",
"&",
"c",
".",
"stat",
".",
"queueWriteoutTime",
",",
"send",
")",
"\n",
"}"
] |
9,845 | all-9846 | [
"LoadByteCode",
"loads",
"a",
"new",
"ByteCode",
".",
"This",
"is",
"used",
"for",
"op",
"codes",
"that",
"call",
"to",
"external",
"templates",
"such",
"as",
"include"
] | [
"func",
"(",
"st",
"*",
"State",
")",
"LoadByteCode",
"(",
"<mask>",
"string",
")",
"(",
"*",
"ByteCode",
",",
"error",
")",
"{",
"return",
"st",
".",
"Loader",
".",
"Load",
"(",
"key",
")",
"\n",
"}"
] |
9,846 | all-9847 | [
"Read",
"decompresses",
"data",
"from",
"the",
"underlying",
"source",
"into",
"the",
"supplied",
"buffer",
".",
"Since",
"there",
"can",
"be",
"multiple",
"streams",
"concatenated",
"Header",
"values",
"may",
"change",
"between",
"calls",
"to",
"Read",
"()",
".",
"If",
"that",
"is",
"the",
"case",
"no",
"data",
"is",
"actually",
"read",
"from",
"the",
"underlying",
"io",
".",
"Reader",
"to",
"allow",
"for",
"potential",
"input",
"buffer",
"resizing",
"."
] | [
"func",
"(",
"z",
"*",
"Reader",
")",
"Read",
"(",
"buf",
"[",
"]",
"byte",
")",
"(",
"int",
",",
"error",
")",
"{",
"if",
"debugFlag",
"{",
"debug",
"(",
"\"",
"\"",
",",
"len",
"(",
"buf",
")",
")",
"\n",
"}",
"\n",
"if",
"!",
"z",
".",
"Header",
".",
"done",
"{",
"if",
"err",
":=",
"z",
".",
"readHeader",
"(",
"true",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"0",
",",
"err",
"\n",
"}",
"\n",
"if",
"debugFlag",
"{",
"debug",
"(",
"\"",
"\"",
",",
"len",
"(",
"z",
".",
"zdata",
")",
",",
"cap",
"(",
"z",
".",
"zdata",
")",
",",
"len",
"(",
"z",
".",
"data",
")",
",",
"cap",
"(",
"z",
".",
"data",
")",
",",
"z",
".",
"idx",
")",
"\n",
"}",
"\n",
"}",
"\n\n",
"if",
"len",
"(",
"buf",
")",
"==",
"0",
"{",
"return",
"0",
",",
"nil",
"\n",
"}",
"\n\n",
"if",
"z",
".",
"idx",
"==",
"len",
"(",
"z",
".",
"data",
")",
"{",
"// No data ready for reading, process the next block.",
"if",
"debugFlag",
"{",
"debug",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"// Reset uncompressed buffer",
"z",
".",
"data",
"=",
"z",
".",
"zdata",
"[",
":",
"cap",
"(",
"z",
".",
"zdata",
")",
"]",
"[",
"len",
"(",
"z",
".",
"zdata",
")",
":",
"]",
"\n\n",
"// Block length: 0 = end of frame, highest bit set: uncompressed.",
"bLen",
",",
"err",
":=",
"z",
".",
"readUint32",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"0",
",",
"err",
"\n",
"}",
"\n",
"z",
".",
"pos",
"+=",
"4",
"\n\n",
"if",
"bLen",
"==",
"0",
"{",
"// End of frame reached.",
"if",
"!",
"z",
".",
"NoChecksum",
"{",
"// Validate the frame checksum.",
"checksum",
",",
"err",
":=",
"z",
".",
"readUint32",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"0",
",",
"err",
"\n",
"}",
"\n",
"if",
"debugFlag",
"{",
"debug",
"(",
"\"",
"\"",
",",
"z",
".",
"checksum",
".",
"Sum32",
"(",
")",
",",
"checksum",
")",
"\n",
"}",
"\n",
"z",
".",
"pos",
"+=",
"4",
"\n",
"if",
"h",
":=",
"z",
".",
"checksum",
".",
"Sum32",
"(",
")",
";",
"checksum",
"!=",
"h",
"{",
"return",
"0",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"h",
",",
"checksum",
")",
"\n",
"}",
"\n",
"}",
"\n\n",
"// Get ready for the next concatenated frame and keep the position.",
"<mask>",
":=",
"z",
".",
"pos",
"\n",
"z",
".",
"Reset",
"(",
"z",
".",
"src",
")",
"\n",
"z",
".",
"pos",
"=",
"pos",
"\n\n",
"// Since multiple frames can be concatenated, check for more.",
"return",
"0",
",",
"z",
".",
"readHeader",
"(",
"false",
")",
"\n",
"}",
"\n\n",
"if",
"debugFlag",
"{",
"debug",
"(",
"\"",
"\"",
",",
"bLen",
")",
"\n",
"}",
"\n",
"if",
"bLen",
"&",
"compressedBlockFlag",
">",
"0",
"{",
"// Uncompressed block.",
"bLen",
"&=",
"compressedBlockMask",
"\n",
"if",
"debugFlag",
"{",
"debug",
"(",
"\"",
"\"",
",",
"bLen",
")",
"\n",
"}",
"\n",
"if",
"int",
"(",
"bLen",
")",
">",
"cap",
"(",
"z",
".",
"data",
")",
"{",
"return",
"0",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"bLen",
")",
"\n",
"}",
"\n",
"z",
".",
"data",
"=",
"z",
".",
"data",
"[",
":",
"bLen",
"]",
"\n",
"if",
"_",
",",
"err",
":=",
"io",
".",
"ReadFull",
"(",
"z",
".",
"src",
",",
"z",
".",
"data",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"0",
",",
"err",
"\n",
"}",
"\n",
"z",
".",
"pos",
"+=",
"int64",
"(",
"bLen",
")",
"\n",
"if",
"z",
".",
"OnBlockDone",
"!=",
"nil",
"{",
"z",
".",
"OnBlockDone",
"(",
"int",
"(",
"bLen",
")",
")",
"\n",
"}",
"\n\n",
"if",
"z",
".",
"BlockChecksum",
"{",
"checksum",
",",
"err",
":=",
"z",
".",
"readUint32",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"0",
",",
"err",
"\n",
"}",
"\n",
"z",
".",
"pos",
"+=",
"4",
"\n\n",
"if",
"h",
":=",
"xxh32",
".",
"ChecksumZero",
"(",
"z",
".",
"data",
")",
";",
"h",
"!=",
"checksum",
"{",
"return",
"0",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"h",
",",
"checksum",
")",
"\n",
"}",
"\n",
"}",
"\n\n",
"}",
"else",
"{",
"// Compressed block.",
"if",
"debugFlag",
"{",
"debug",
"(",
"\"",
"\"",
",",
"bLen",
")",
"\n",
"}",
"\n",
"if",
"int",
"(",
"bLen",
")",
">",
"cap",
"(",
"z",
".",
"data",
")",
"{",
"return",
"0",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"bLen",
")",
"\n",
"}",
"\n",
"zdata",
":=",
"z",
".",
"zdata",
"[",
":",
"bLen",
"]",
"\n",
"if",
"_",
",",
"err",
":=",
"io",
".",
"ReadFull",
"(",
"z",
".",
"src",
",",
"zdata",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"0",
",",
"err",
"\n",
"}",
"\n",
"z",
".",
"pos",
"+=",
"int64",
"(",
"bLen",
")",
"\n\n",
"if",
"z",
".",
"BlockChecksum",
"{",
"checksum",
",",
"err",
":=",
"z",
".",
"readUint32",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"0",
",",
"err",
"\n",
"}",
"\n",
"z",
".",
"pos",
"+=",
"4",
"\n\n",
"if",
"h",
":=",
"xxh32",
".",
"ChecksumZero",
"(",
"zdata",
")",
";",
"h",
"!=",
"checksum",
"{",
"return",
"0",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"h",
",",
"checksum",
")",
"\n",
"}",
"\n",
"}",
"\n\n",
"n",
",",
"err",
":=",
"UncompressBlock",
"(",
"zdata",
",",
"z",
".",
"data",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"0",
",",
"err",
"\n",
"}",
"\n",
"z",
".",
"data",
"=",
"z",
".",
"data",
"[",
":",
"n",
"]",
"\n",
"if",
"z",
".",
"OnBlockDone",
"!=",
"nil",
"{",
"z",
".",
"OnBlockDone",
"(",
"n",
")",
"\n",
"}",
"\n",
"}",
"\n\n",
"if",
"!",
"z",
".",
"NoChecksum",
"{",
"_",
",",
"_",
"=",
"z",
".",
"checksum",
".",
"Write",
"(",
"z",
".",
"data",
")",
"\n",
"if",
"debugFlag",
"{",
"debug",
"(",
"\"",
"\"",
",",
"z",
".",
"checksum",
".",
"Sum32",
"(",
")",
")",
"\n",
"}",
"\n",
"}",
"\n",
"z",
".",
"idx",
"=",
"0",
"\n",
"}",
"\n\n",
"n",
":=",
"copy",
"(",
"buf",
",",
"z",
".",
"data",
"[",
"z",
".",
"idx",
":",
"]",
")",
"\n",
"z",
".",
"idx",
"+=",
"n",
"\n",
"if",
"debugFlag",
"{",
"debug",
"(",
"\"",
"\"",
",",
"n",
")",
"\n",
"}",
"\n\n",
"return",
"n",
",",
"nil",
"\n",
"}"
] |
9,847 | all-9848 | [
"ColorChooserDialogNew",
"()",
"is",
"a",
"wrapper",
"around",
"gtk_color_chooser_dialog_new",
"()",
"."
] | [
"func",
"ColorChooserDialogNew",
"(",
"title",
"string",
",",
"<mask>",
"*",
"Window",
")",
"(",
"*",
"ColorChooserDialog",
",",
"error",
")",
"{",
"cstr",
":=",
"C",
".",
"CString",
"(",
"title",
")",
"\n",
"defer",
"C",
".",
"free",
"(",
"unsafe",
".",
"Pointer",
"(",
"cstr",
")",
")",
"\n",
"c",
":=",
"C",
".",
"gtk_color_chooser_dialog_new",
"(",
"(",
"*",
"C",
".",
"gchar",
")",
"(",
"cstr",
")",
",",
"parent",
".",
"native",
"(",
")",
")",
"\n",
"if",
"c",
"==",
"nil",
"{",
"return",
"nil",
",",
"nilPtrErr",
"\n",
"}",
"\n",
"return",
"wrapColorChooserDialog",
"(",
"glib",
".",
"Take",
"(",
"unsafe",
".",
"Pointer",
"(",
"c",
")",
")",
")",
",",
"nil",
"\n",
"}"
] |
9,848 | all-9849 | [
"GetServiceName",
"returns",
"the",
"ServiceName",
"field",
"if",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"."
] | [
"func",
"(",
"w",
"*",
"Widget",
")",
"GetServiceName",
"(",
")",
"<mask>",
"{",
"if",
"w",
"==",
"nil",
"||",
"w",
".",
"ServiceName",
"==",
"nil",
"{",
"return",
"\"",
"\"",
"\n",
"}",
"\n",
"return",
"*",
"w",
".",
"ServiceName",
"\n",
"}"
] |
9,849 | all-9850 | [
"retrieve",
"the",
"index",
"of",
"a",
"named",
"uniform",
"block"
] | [
"func",
"GetUniformIndices",
"(",
"program",
"uint32",
",",
"uniformCount",
"int32",
",",
"uniformNames",
"*",
"*",
"uint8",
",",
"uniformIndices",
"*",
"uint32",
")",
"{",
"C",
".",
"glowGetUniformIndices",
"(",
"gpGetUniformIndices",
",",
"(",
"C",
".",
"GLuint",
")",
"(",
"<mask>",
")",
",",
"(",
"C",
".",
"GLsizei",
")",
"(",
"uniformCount",
")",
",",
"(",
"*",
"*",
"C",
".",
"GLchar",
")",
"(",
"unsafe",
".",
"Pointer",
"(",
"uniformNames",
")",
")",
",",
"(",
"*",
"C",
".",
"GLuint",
")",
"(",
"unsafe",
".",
"Pointer",
"(",
"uniformIndices",
")",
")",
")",
"\n",
"}"
] |
9,850 | all-9851 | [
"GetValueOk",
"returns",
"a",
"tuple",
"with",
"the",
"Value",
"field",
"if",
"it",
"s",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"and",
"a",
"boolean",
"to",
"check",
"if",
"the",
"value",
"has",
"been",
"set",
"."
] | [
"func",
"(",
"w",
"*",
"WidgetMarker",
")",
"GetValueOk",
"(",
")",
"(",
"string",
",",
"bool",
")",
"{",
"if",
"w",
"==",
"nil",
"||",
"w",
".",
"Value",
"==",
"nil",
"{",
"return",
"\"",
"\"",
",",
"false",
"\n",
"}",
"\n",
"return",
"*",
"w",
".",
"<mask>",
",",
"true",
"\n",
"}"
] |
9,851 | all-9852 | [
"GetIsMobileOk",
"returns",
"a",
"tuple",
"with",
"the",
"IsMobile",
"field",
"if",
"it",
"s",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"and",
"a",
"boolean",
"to",
"check",
"if",
"the",
"value",
"has",
"been",
"set",
"."
] | [
"func",
"(",
"s",
"*",
"SyntheticsDevice",
")",
"GetIsMobileOk",
"(",
")",
"(",
"bool",
",",
"bool",
")",
"{",
"if",
"s",
"==",
"nil",
"||",
"s",
".",
"IsMobile",
"==",
"nil",
"{",
"return",
"<mask>",
",",
"false",
"\n",
"}",
"\n",
"return",
"*",
"s",
".",
"IsMobile",
",",
"true",
"\n",
"}"
] |
9,852 | all-9853 | [
"UnmarshalJSON",
"implements",
"json",
".",
"Unamrshaler",
"interface",
".",
"It",
"parses",
"time",
".",
"Duration",
"as",
"strings",
"."
] | [
"func",
"(",
"o",
"*",
"<mask>",
")",
"UnmarshalJSON",
"(",
"data",
"[",
"]",
"byte",
")",
"error",
"{",
"v",
":=",
"&",
"optionsJSON",
"{",
"}",
"\n",
"if",
"err",
":=",
"json",
".",
"Unmarshal",
"(",
"data",
",",
"v",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"*",
"o",
"=",
"Options",
"{",
"Timeout",
":",
"v",
".",
"Timeout",
".",
"Duration",
"(",
")",
",",
"KeepAlive",
":",
"v",
".",
"KeepAlive",
".",
"Duration",
"(",
")",
",",
"TLSHandshakeTimeout",
":",
"v",
".",
"TLSHandshakeTimeout",
".",
"Duration",
"(",
")",
",",
"TLSSkipVerify",
":",
"v",
".",
"TLSSkipVerify",
",",
"RetryTimeMax",
":",
"v",
".",
"RetryTimeMax",
".",
"Duration",
"(",
")",
",",
"RetrySleepMax",
":",
"v",
".",
"RetrySleepMax",
".",
"Duration",
"(",
")",
",",
"RetrySleepBase",
":",
"v",
".",
"RetrySleepBase",
".",
"Duration",
"(",
")",
",",
"}",
"\n",
"return",
"nil",
"\n",
"}"
] |
9,853 | all-9854 | [
"GetCookieInt64",
"returns",
"cookie",
"result",
"in",
"int64",
"type",
"."
] | [
"func",
"(",
"ctx",
"*",
"Context",
")",
"GetCookieInt64",
"(",
"name",
"string",
")",
"int64",
"{",
"return",
"com",
".",
"StrTo",
"(",
"ctx",
".",
"GetCookie",
"(",
"<mask>",
")",
")",
".",
"MustInt64",
"(",
")",
"\n",
"}"
] |
9,854 | all-9855 | [
"NewSurface",
"creates",
"a",
"gotk3",
"cairo",
"Surface",
"from",
"a",
"pointer",
"to",
"a",
"C",
"cairo_surface_t",
".",
"This",
"is",
"primarily",
"designed",
"for",
"use",
"with",
"other",
"gotk3",
"packages",
"and",
"should",
"be",
"avoided",
"by",
"applications",
"."
] | [
"func",
"NewSurface",
"(",
"s",
"uintptr",
",",
"needsRef",
"bool",
")",
"*",
"Surface",
"{",
"surface",
":=",
"WrapSurface",
"(",
"s",
")",
"\n",
"if",
"needsRef",
"{",
"surface",
".",
"reference",
"(",
")",
"\n",
"}",
"\n",
"runtime",
".",
"SetFinalizer",
"(",
"surface",
",",
"(",
"*",
"Surface",
")",
".",
"<mask>",
")",
"\n",
"return",
"surface",
"\n",
"}"
] |
9,855 | all-9856 | [
"nodeToMember",
"builds",
"member",
"from",
"a",
"key",
"value",
"node",
".",
"the",
"child",
"nodes",
"of",
"the",
"given",
"node",
"MUST",
"be",
"sorted",
"by",
"key",
"."
] | [
"func",
"nodeToMember",
"(",
"n",
"*",
"v2store",
".",
"NodeExtern",
")",
"(",
"*",
"Member",
",",
"error",
")",
"{",
"m",
":=",
"&",
"Member",
"{",
"ID",
":",
"MustParseMemberIDFromKey",
"(",
"n",
".",
"Key",
")",
"}",
"\n",
"attrs",
":=",
"make",
"(",
"map",
"[",
"string",
"]",
"[",
"]",
"byte",
")",
"\n",
"raftAttrKey",
":=",
"path",
".",
"Join",
"(",
"n",
".",
"Key",
",",
"raftAttributesSuffix",
")",
"\n",
"attrKey",
":=",
"path",
".",
"Join",
"(",
"n",
".",
"Key",
",",
"attributesSuffix",
")",
"\n",
"for",
"_",
",",
"nn",
":=",
"<mask>",
"n",
".",
"Nodes",
"{",
"if",
"nn",
".",
"Key",
"!=",
"raftAttrKey",
"&&",
"nn",
".",
"Key",
"!=",
"attrKey",
"{",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"nn",
".",
"Key",
")",
"\n",
"}",
"\n",
"attrs",
"[",
"nn",
".",
"Key",
"]",
"=",
"[",
"]",
"byte",
"(",
"*",
"nn",
".",
"Value",
")",
"\n",
"}",
"\n",
"if",
"data",
":=",
"attrs",
"[",
"raftAttrKey",
"]",
";",
"data",
"!=",
"nil",
"{",
"if",
"err",
":=",
"json",
".",
"Unmarshal",
"(",
"data",
",",
"&",
"m",
".",
"RaftAttributes",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"}",
"\n",
"}",
"else",
"{",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"if",
"data",
":=",
"attrs",
"[",
"attrKey",
"]",
";",
"data",
"!=",
"nil",
"{",
"if",
"err",
":=",
"json",
".",
"Unmarshal",
"(",
"data",
",",
"&",
"m",
".",
"Attributes",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"m",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"m",
",",
"nil",
"\n",
"}"
] |
9,856 | all-9857 | [
"summarize",
"summarizes",
"all",
"items",
"in",
"the",
"Group",
"and",
"stores",
"the",
"result"
] | [
"func",
"(",
"covList",
"*",
"CoverageList",
")",
"summarize",
"(",
")",
"{",
"covList",
".",
"NumCoveredStmts",
"=",
"0",
"\n",
"covList",
".",
"NumAllStmts",
"=",
"0",
"\n",
"for",
"_",
",",
"item",
":=",
"range",
"covList",
".",
"Group",
"{",
"covList",
".",
"NumCoveredStmts",
"+=",
"item",
".",
"NumCoveredStmts",
"\n",
"covList",
".",
"NumAllStmts",
"+=",
"<mask>",
".",
"NumAllStmts",
"\n",
"}",
"\n",
"}"
] |
9,857 | all-9858 | [
"LintCertificate",
"runs",
"all",
"registered",
"lints",
"on",
"c",
"producing",
"a",
"ZLint",
"."
] | [
"func",
"LintCertificate",
"(",
"c",
"*",
"x509",
".",
"Certificate",
")",
"*",
"ResultSet",
"{",
"// Instead of panicing on nil certificate, just returns nil and let the client",
"// panic when accessing ZLint, if they're into panicing.",
"if",
"c",
"==",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n\n",
"// Run all tests",
"<mask>",
":=",
"new",
"(",
"ResultSet",
")",
"\n",
"res",
".",
"execute",
"(",
"c",
")",
"\n",
"res",
".",
"Version",
"=",
"Version",
"\n",
"res",
".",
"Timestamp",
"=",
"time",
".",
"Now",
"(",
")",
".",
"Unix",
"(",
")",
"\n",
"return",
"res",
"\n",
"}"
] |
9,858 | all-9859 | [
"Debug",
"formats",
"message",
"using",
"the",
"default",
"formats",
"for",
"its",
"operands",
"prepends",
"the",
"prefix",
"as",
"necessary",
"and",
"writes",
"to",
"log",
"with",
"LevelDebug",
".",
"This",
"is",
"part",
"of",
"the",
"Logger",
"interface",
"implementation",
"."
] | [
"func",
"(",
"l",
"*",
"slog",
")",
"Debug",
"(",
"args",
"...",
"<mask>",
"{",
"}",
")",
"{",
"lvl",
":=",
"l",
".",
"Level",
"(",
")",
"\n",
"if",
"lvl",
"<=",
"LevelDebug",
"{",
"l",
".",
"b",
".",
"print",
"(",
"\"",
"\"",
",",
"l",
".",
"tag",
",",
"args",
"...",
")",
"\n",
"}",
"\n",
"}"
] |
9,859 | all-9860 | [
"NewContextWith",
"returns",
"a",
"fully",
"formed",
"context",
"using",
"the",
"data",
"provided",
"."
] | [
"func",
"NewContextWith",
"(",
"data",
"map",
"[",
"string",
"]",
"interface",
"{",
"}",
")",
"*",
"Context",
"{",
"c",
":=",
"&",
"Context",
"{",
"Context",
":",
"context",
".",
"Background",
"(",
")",
",",
"data",
":",
"data",
",",
"outer",
":",
"nil",
",",
"moot",
":",
"&",
"sync",
".",
"Mutex",
"{",
"}",
",",
"}",
"\n",
"for",
"k",
",",
"v",
":=",
"<mask>",
"Helpers",
".",
"helpers",
"{",
"if",
"!",
"c",
".",
"Has",
"(",
"k",
")",
"{",
"c",
".",
"Set",
"(",
"k",
",",
"v",
")",
"\n",
"}",
"\n",
"}",
"\n\n",
"return",
"c",
"\n",
"}"
] |
9,860 | all-9861 | [
"UnmarshalJSON",
"implements",
"the",
"json",
".",
"Unmarshaler",
"interface",
".",
"The",
"URI",
"is",
"expected",
"to",
"be",
"a",
"quoted",
"string",
"."
] | [
"func",
"(",
"u",
"*",
"URI",
")",
"UnmarshalJSON",
"(",
"data",
"[",
"]",
"byte",
")",
"error",
"{",
"// Ignore null, like in the main JSON package.",
"if",
"string",
"(",
"data",
")",
"==",
"\"",
"\"",
"{",
"return",
"nil",
"\n",
"}",
"\n",
"<mask>",
"s",
"string",
"\n",
"err",
":=",
"json",
".",
"Unmarshal",
"(",
"data",
",",
"&",
"s",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"u",
".",
"URL",
",",
"err",
"=",
"url",
".",
"Parse",
"(",
"s",
")",
"\n",
"return",
"err",
"\n",
"}"
] |
9,861 | all-9862 | [
"Creates",
"a",
"shader",
"object"
] | [
"func",
"CreateShader",
"(",
"xtype",
"uint32",
")",
"uint32",
"{",
"ret",
",",
"_",
",",
"_",
":=",
"syscall",
".",
"Syscall",
"(",
"gpCreateShader",
",",
"1",
",",
"uintptr",
"(",
"xtype",
")",
",",
"0",
",",
"0",
")",
"\n",
"return",
"(",
"uint32",
")",
"(",
"<mask>",
")",
"\n",
"}"
] |
9,862 | all-9863 | [
"String",
"returns",
"a",
"printable",
"version",
"of",
"the",
"value",
"."
] | [
"func",
"(",
"v",
"Value",
")",
"<mask>",
"(",
")",
"string",
"{",
"if",
"v",
".",
"typ",
"==",
"Null",
"{",
"return",
"\"",
"\"",
"\n",
"}",
"\n",
"if",
"v",
".",
"IsQuoted",
"(",
")",
"{",
"return",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"v",
".",
"typ",
",",
"v",
".",
"val",
")",
"\n",
"}",
"\n",
"return",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"v",
".",
"typ",
",",
"v",
".",
"val",
")",
"\n",
"}"
] |
9,863 | all-9864 | [
"initialize",
"implements",
"step",
"1",
"of",
"LT",
"."
] | [
"func",
"(",
"d",
"*",
"ltDom",
")",
"initialize",
"(",
")",
"{",
"type",
"workItem",
"struct",
"{",
"name",
"vName",
"\n",
"parentName",
"vName",
"\n",
"}",
"\n\n",
"// Initialize objs for mapping from object index back to Object.",
"i",
":=",
"0",
"\n",
"d",
".",
"p",
".",
"ForEachObject",
"(",
"func",
"(",
"x",
"Object",
")",
"bool",
"{",
"d",
".",
"objs",
"[",
"i",
"]",
"=",
"x",
"\n",
"i",
"++",
"\n",
"return",
"true",
"\n",
"}",
")",
"\n\n",
"// Add roots to the work stack, essentially pretending to visit",
"// the pseudo-root, numbering it 0.",
"d",
".",
"semis",
"[",
"pseudoRoot",
"]",
"=",
"0",
"\n",
"d",
".",
"parents",
"[",
"pseudoRoot",
"]",
"=",
"-",
"1",
"\n",
"d",
".",
"vertices",
"[",
"0",
"]",
"=",
"pseudoRoot",
"\n",
"var",
"work",
"[",
"]",
"workItem",
"\n",
"for",
"i",
":=",
"1",
";",
"i",
"<",
"1",
"+",
"d",
".",
"nRoots",
";",
"i",
"++",
"{",
"work",
"=",
"append",
"(",
"work",
",",
"workItem",
"{",
"name",
":",
"vName",
"(",
"i",
")",
",",
"parentName",
":",
"0",
"}",
")",
"\n",
"}",
"\n\n",
"n",
":=",
"vNumber",
"(",
"1",
")",
"// 0 was the pseudo-root.",
"\n\n",
"// Build the spanning tree, assigning vertex numbers to each object",
"// and initializing semi and parent.",
"for",
"len",
"(",
"work",
")",
"!=",
"0",
"{",
"item",
":=",
"work",
"[",
"len",
"(",
"work",
")",
"-",
"1",
"]",
"\n",
"work",
"=",
"work",
"[",
":",
"len",
"(",
"work",
")",
"-",
"1",
"]",
"\n\n",
"if",
"d",
".",
"semis",
"[",
"item",
".",
"name",
"]",
"!=",
"-",
"1",
"{",
"continue",
"\n",
"}",
"\n\n",
"d",
".",
"semis",
"[",
"item",
".",
"name",
"]",
"=",
"n",
"\n",
"d",
".",
"parents",
"[",
"item",
".",
"name",
"]",
"=",
"item",
".",
"parentName",
"\n",
"d",
".",
"vertices",
"[",
"n",
"]",
"=",
"item",
".",
"name",
"\n",
"n",
"++",
"\n\n",
"visitChild",
":=",
"func",
"(",
"_",
"int64",
",",
"child",
"Object",
",",
"_",
"int64",
")",
"bool",
"{",
"childIdx",
",",
"_",
":=",
"d",
".",
"p",
".",
"findObjectIndex",
"(",
"d",
".",
"p",
".",
"Addr",
"(",
"child",
")",
")",
"\n",
"<mask>",
"=",
"append",
"(",
"work",
",",
"workItem",
"{",
"name",
":",
"vName",
"(",
"childIdx",
"+",
"d",
".",
"nRoots",
"+",
"1",
")",
",",
"parentName",
":",
"item",
".",
"name",
"}",
")",
"\n",
"return",
"true",
"\n",
"}",
"\n\n",
"root",
",",
"object",
":=",
"d",
".",
"findVertexByName",
"(",
"item",
".",
"name",
")",
"\n",
"if",
"root",
"!=",
"nil",
"{",
"d",
".",
"p",
".",
"ForEachRootPtr",
"(",
"root",
",",
"visitChild",
")",
"\n",
"}",
"else",
"{",
"d",
".",
"p",
".",
"ForEachPtr",
"(",
"object",
",",
"visitChild",
")",
"\n",
"}",
"\n\n",
"}",
"\n",
"}"
] |
9,864 | all-9865 | [
"OutForward",
"...",
"recieve",
"FluentRecordSet",
"from",
"channel",
"and",
"send",
"it",
"to",
"passed",
"loggers",
"until",
"success",
"."
] | [
"func",
"NewOutForward",
"(",
"configServers",
"[",
"]",
"*",
"ConfigServer",
")",
"(",
"*",
"OutForward",
",",
"error",
")",
"{",
"loggers",
":=",
"make",
"(",
"[",
"]",
"*",
"fluent",
".",
"Fluent",
",",
"len",
"(",
"configServers",
")",
")",
"\n",
"for",
"i",
",",
"server",
":=",
"range",
"configServers",
"{",
"logger",
",",
"err",
":=",
"fluent",
".",
"New",
"(",
"fluent",
".",
"Config",
"{",
"Server",
":",
"server",
".",
"Address",
"(",
")",
"}",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"<mask>",
".",
"Println",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"}",
"else",
"{",
"log",
".",
"Println",
"(",
"\"",
"\"",
",",
"server",
".",
"Address",
"(",
")",
",",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"loggers",
"[",
"i",
"]",
"=",
"logger",
"\n",
"logger",
".",
"Send",
"(",
"[",
"]",
"byte",
"{",
"}",
")",
"\n",
"}",
"\n",
"return",
"&",
"OutForward",
"{",
"loggers",
":",
"loggers",
",",
"sent",
":",
"0",
",",
"}",
",",
"nil",
"\n",
"}"
] |
9,865 | all-9866 | [
"TextViewNewWithBuffer",
"is",
"a",
"wrapper",
"around",
"gtk_text_view_new_with_buffer",
"()",
"."
] | [
"func",
"TextViewNewWithBuffer",
"(",
"buf",
"*",
"TextBuffer",
")",
"(",
"*",
"TextView",
",",
"<mask>",
")",
"{",
"cbuf",
":=",
"buf",
".",
"native",
"(",
")",
"\n",
"c",
":=",
"C",
".",
"gtk_text_view_new_with_buffer",
"(",
"cbuf",
")",
"\n",
"return",
"wrapTextView",
"(",
"glib",
".",
"Take",
"(",
"unsafe",
".",
"Pointer",
"(",
"c",
")",
")",
")",
",",
"nil",
"\n",
"}"
] |
9,866 | all-9867 | [
"PropertyActionNew",
"is",
"a",
"wrapper",
"around",
"g_property_action_new"
] | [
"func",
"PropertyActionNew",
"(",
"name",
"string",
",",
"object",
"*",
"Object",
",",
"propertyName",
"string",
")",
"*",
"PropertyAction",
"{",
"c",
":=",
"C",
".",
"g_property_action_new",
"(",
"(",
"*",
"C",
".",
"gchar",
")",
"(",
"C",
".",
"CString",
"(",
"<mask>",
")",
")",
",",
"C",
".",
"gpointer",
"(",
"unsafe",
".",
"Pointer",
"(",
"object",
".",
"native",
"(",
")",
")",
")",
",",
"(",
"*",
"C",
".",
"gchar",
")",
"(",
"C",
".",
"CString",
"(",
"propertyName",
")",
")",
")",
"\n",
"if",
"c",
"==",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n",
"return",
"wrapPropertyAction",
"(",
"wrapObject",
"(",
"unsafe",
".",
"Pointer",
"(",
"c",
")",
")",
")",
"\n",
"}"
] |
9,867 | all-9868 | [
"NewPolicyFromBytes",
"returns",
"a",
"policy",
"parsed",
"from",
"the",
"specified",
"blob",
".",
"Use",
"this",
"function",
"instead",
"of",
"calling",
"json",
".",
"Unmarshal",
"directly",
"."
] | [
"func",
"NewPolicyFromBytes",
"(",
"data",
"[",
"]",
"<mask>",
")",
"(",
"*",
"Policy",
",",
"error",
")",
"{",
"p",
":=",
"Policy",
"{",
"}",
"\n",
"if",
"err",
":=",
"json",
".",
"Unmarshal",
"(",
"data",
",",
"&",
"p",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"InvalidPolicyFormatError",
"(",
"err",
".",
"Error",
"(",
")",
")",
"\n",
"}",
"\n",
"return",
"&",
"p",
",",
"nil",
"\n",
"}"
] |
9,868 | all-9869 | [
"write",
"a",
"block",
"of",
"pixels",
"to",
"the",
"frame",
"buffer"
] | [
"func",
"DrawPixels",
"(",
"width",
"int32",
",",
"height",
"int32",
",",
"format",
"uint32",
",",
"xtype",
"uint32",
",",
"pixels",
"unsafe",
".",
"Pointer",
")",
"{",
"syscall",
".",
"Syscall6",
"(",
"gpDrawPixels",
",",
"5",
",",
"uintptr",
"(",
"width",
")",
",",
"uintptr",
"(",
"<mask>",
")",
",",
"uintptr",
"(",
"format",
")",
",",
"uintptr",
"(",
"xtype",
")",
",",
"uintptr",
"(",
"pixels",
")",
",",
"0",
")",
"\n",
"}"
] |
9,869 | all-9870 | [
"UnmarshalEasyJSON",
"sets",
"the",
"RGBColor",
"from",
"a",
"easyjson",
".",
"Lexer"
] | [
"func",
"(",
"r",
"*",
"RGBColor",
")",
"UnmarshalEasyJSON",
"(",
"<mask>",
"*",
"jlexer",
".",
"Lexer",
")",
"{",
"if",
"data",
":=",
"in",
".",
"String",
"(",
")",
";",
"in",
".",
"Ok",
"(",
")",
"{",
"*",
"r",
"=",
"RGBColor",
"(",
"data",
")",
"\n",
"}",
"\n",
"}"
] |
9,870 | all-9871 | [
"Returns",
"an",
"map",
"[",
"string",
"]",
"int",
"Some",
"work",
"is",
"done",
"to",
"handle",
"the",
"fact",
"that",
"JSON",
"ints",
"are",
"represented",
"as",
"floats",
"."
] | [
"func",
"(",
"t",
"Typed",
")",
"StringInt",
"(",
"key",
"string",
")",
"map",
"[",
"string",
"]",
"int",
"{",
"raw",
",",
"ok",
":=",
"t",
".",
"getmap",
"(",
"key",
")",
"\n",
"if",
"ok",
"==",
"false",
"{",
"return",
"nil",
"\n",
"}",
"\n",
"m",
":=",
"make",
"(",
"map",
"[",
"string",
"]",
"int",
",",
"len",
"(",
"<mask>",
")",
")",
"\n",
"for",
"k",
",",
"value",
":=",
"range",
"raw",
"{",
"switch",
"t",
":=",
"value",
".",
"(",
"type",
")",
"{",
"case",
"int",
":",
"m",
"[",
"k",
"]",
"=",
"t",
"\n",
"case",
"float64",
":",
"m",
"[",
"k",
"]",
"=",
"int",
"(",
"t",
")",
"\n",
"case",
"string",
":",
"i",
",",
"err",
":=",
"strconv",
".",
"Atoi",
"(",
"t",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n",
"m",
"[",
"k",
"]",
"=",
"i",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"m",
"\n",
"}"
] |
9,871 | all-9872 | [
"quorumSize",
"is",
"used",
"to",
"return",
"the",
"quorum",
"size",
".",
"This",
"must",
"only",
"be",
"called",
"on",
"the",
"main",
"thread",
".",
"TODO",
":",
"revisit",
"usage"
] | [
"func",
"(",
"r",
"*",
"Raft",
")",
"quorumSize",
"(",
")",
"int",
"{",
"voters",
":=",
"0",
"\n",
"for",
"_",
",",
"server",
":=",
"range",
"r",
".",
"configurations",
".",
"latest",
".",
"Servers",
"{",
"if",
"<mask>",
".",
"Suffrage",
"==",
"Voter",
"{",
"voters",
"++",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"voters",
"/",
"2",
"+",
"1",
"\n",
"}"
] |
9,872 | all-9873 | [
"GetMaxChildrenPerLine",
"is",
"a",
"wrapper",
"around",
"gtk_flow_box_get_max_children_per_line",
"()"
] | [
"func",
"(",
"fb",
"*",
"FlowBox",
")",
"GetMaxChildrenPerLine",
"(",
")",
"uint",
"{",
"c",
":=",
"C",
".",
"gtk_flow_box_get_max_children_per_line",
"(",
"fb",
".",
"native",
"(",
")",
")",
"\n",
"<mask>",
"uint",
"(",
"c",
")",
"\n",
"}"
] |
9,873 | all-9874 | [
"retrieve",
"the",
"index",
"of",
"a",
"subroutine",
"uniform",
"of",
"a",
"given",
"shader",
"stage",
"within",
"a",
"program"
] | [
"func",
"GetSubroutineIndex",
"(",
"program",
"uint32",
",",
"shadertype",
"uint32",
",",
"name",
"*",
"uint8",
")",
"uint32",
"{",
"ret",
",",
"_",
",",
"_",
":=",
"syscall",
".",
"Syscall",
"(",
"gpGetSubroutineIndex",
",",
"3",
",",
"uintptr",
"(",
"program",
")",
",",
"uintptr",
"(",
"shadertype",
")",
",",
"uintptr",
"(",
"unsafe",
".",
"Pointer",
"(",
"name",
")",
")",
")",
"\n",
"return",
"(",
"uint32",
")",
"(",
"<mask>",
")",
"\n",
"}"
] |
9,874 | all-9875 | [
"Writer",
"returns",
"a",
"writer",
"that",
"overwrites",
"the",
"path",
"."
] | [
"func",
"(",
"o",
"opener",
")",
"Writer",
"(",
"ctx",
"context",
".",
"Context",
",",
"path",
"string",
")",
"(",
"io",
".",
"WriteCloser",
",",
"error",
")",
"{",
"g",
",",
"err",
":=",
"o",
".",
"openGCS",
"(",
"<mask>",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"}",
"\n",
"if",
"g",
"==",
"nil",
"{",
"return",
"os",
".",
"Create",
"(",
"path",
")",
"\n",
"}",
"\n",
"return",
"g",
".",
"NewWriter",
"(",
"ctx",
")",
",",
"nil",
"\n",
"}"
] |
9,875 | all-9876 | [
"MustAlphaNum12",
"retrieves",
"the",
"AlphaNum12",
"value",
"from",
"the",
"union",
"panicing",
"if",
"the",
"value",
"is",
"not",
"set",
"."
] | [
"func",
"(",
"u",
"<mask>",
")",
"MustAlphaNum12",
"(",
")",
"AssetAlphaNum12",
"{",
"val",
",",
"ok",
":=",
"u",
".",
"GetAlphaNum12",
"(",
")",
"\n\n",
"if",
"!",
"ok",
"{",
"panic",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"return",
"val",
"\n",
"}"
] |
9,876 | all-9877 | [
"best",
"-",
"effort",
"attempt",
"to",
"get",
"an",
"int",
"from",
"crypto",
"/",
"rand",
".",
"if",
"an",
"error",
"is",
"returned",
"it",
"will",
"fall",
"back",
"to",
"math",
"/",
"rand",
"."
] | [
"func",
"randInt",
"(",
"max",
"int",
")",
"int",
"{",
"i",
",",
"err",
":=",
"crypto",
".",
"Int",
"(",
"crypto",
".",
"Reader",
",",
"big",
".",
"NewInt",
"(",
"int64",
"(",
"max",
")",
")",
")",
"\n",
"if",
"err",
"==",
"nil",
"{",
"return",
"int",
"(",
"i",
".",
"Int64",
"(",
")",
")",
"\n",
"}",
"\n",
"return",
"<mask>",
".",
"Intn",
"(",
"max",
")",
"\n",
"}"
] |
9,877 | all-9878 | [
"NewOutgoingForward",
"creates",
"a",
"new",
"outgoing",
"forwarded",
"message",
"."
] | [
"func",
"(",
"api",
"*",
"TelegramBotAPI",
")",
"NewOutgoingForward",
"(",
"recipient",
"Recipient",
",",
"origin",
"Chat",
",",
"messageID",
"int",
")",
"*",
"OutgoingForward",
"{",
"return",
"&",
"OutgoingForward",
"{",
"outgoingMessageBase",
":",
"outgoingMessageBase",
"{",
"outgoingBase",
":",
"outgoingBase",
"{",
"api",
":",
"api",
",",
"Recipient",
":",
"recipient",
",",
"}",
",",
"}",
",",
"FromChatID",
":",
"NewRecipientFromChat",
"(",
"<mask>",
")",
",",
"MessageID",
":",
"messageID",
",",
"}",
"\n",
"}"
] |
9,878 | all-9879 | [
"/",
"*",
"Get2D",
"return",
"a",
"specific",
"element",
"from",
"a",
"2",
"-",
"dimensional",
"matrix",
"."
] | [
"func",
"(",
"img",
"*",
"IplImage",
")",
"Get2D",
"(",
"x",
",",
"y",
"int",
")",
"Scalar",
"{",
"<mask>",
":=",
"C",
".",
"cvGet2D",
"(",
"unsafe",
".",
"Pointer",
"(",
"img",
")",
",",
"C",
".",
"int",
"(",
"y",
")",
",",
"C",
".",
"int",
"(",
"x",
")",
")",
"\n",
"return",
"Scalar",
"(",
"ret",
")",
"\n",
"}"
] |
9,879 | all-9880 | [
"GetTitleSizeOk",
"returns",
"a",
"tuple",
"with",
"the",
"TitleSize",
"field",
"if",
"it",
"s",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"and",
"a",
"boolean",
"to",
"check",
"if",
"the",
"value",
"has",
"been",
"set",
"."
] | [
"func",
"(",
"m",
"*",
"ManageStatusDefinition",
")",
"GetTitleSizeOk",
"(",
")",
"(",
"string",
",",
"bool",
")",
"{",
"if",
"m",
"==",
"nil",
"||",
"m",
".",
"TitleSize",
"==",
"nil",
"{",
"return",
"\"",
"\"",
",",
"<mask>",
"\n",
"}",
"\n",
"return",
"*",
"m",
".",
"TitleSize",
",",
"true",
"\n",
"}"
] |
9,880 | all-9881 | [
"Requeue",
"must",
"be",
"called",
"on",
"messages",
"received",
"from",
"a",
"consumer",
"to",
"let",
"the",
"NSQ",
"server",
"know",
"that",
"the",
"message",
"could",
"not",
"be",
"proessed",
"and",
"should",
"be",
"retried",
".",
"The",
"timeout",
"is",
"the",
"amount",
"of",
"time",
"the",
"NSQ",
"server",
"waits",
"before",
"offering",
"this",
"message",
"again",
"to",
"its",
"consumers",
".",
"One",
"of",
"Finish",
"or",
"Requeue",
"should",
"be",
"called",
"on",
"every",
"message",
"and",
"the",
"methods",
"will",
"panic",
"if",
"they",
"are",
"called",
"more",
"than",
"once",
"."
] | [
"func",
"(",
"m",
"*",
"Message",
")",
"Requeue",
"(",
"timeout",
"time",
".",
"Duration",
")",
"{",
"if",
"m",
".",
"Complete",
"(",
")",
"{",
"panic",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"defer",
"func",
"(",
")",
"{",
"recover",
"(",
")",
"}",
"(",
")",
"// the connection may have been closed asynchronously",
"\n",
"m",
".",
"cmdChan",
"<-",
"Req",
"{",
"MessageID",
":",
"m",
".",
"<mask>",
",",
"Timeout",
":",
"timeout",
"}",
"\n",
"m",
".",
"cmdChan",
"=",
"nil",
"\n",
"}"
] |
9,881 | all-9882 | [
"NewWriterSize",
"creates",
"a",
"new",
"Writer",
"instance",
"with",
"given",
"size",
"for",
"bufio",
".",
"Writer",
"."
] | [
"func",
"NewWriterSize",
"(",
"w",
"io",
".",
"Writer",
",",
"size",
"int",
")",
"*",
"Writer",
"{",
"return",
"&",
"<mask>",
"{",
"wr",
":",
"bufio",
".",
"NewWriterSize",
"(",
"w",
",",
"size",
")",
",",
"b",
":",
"make",
"(",
"[",
"]",
"byte",
",",
"writerBufferSize",
")",
",",
"tr",
":",
"unicode",
".",
"Utf8ToCesu8Transformer",
",",
"}",
"\n",
"}"
] |
9,882 | all-9883 | [
"InitGitHubOAuthConfig",
"creates",
"an",
"OAuthClient",
"using",
"GitHubOAuth",
"config",
"and",
"a",
"Cookie",
"Store",
"to",
"retain",
"user",
"credentials",
"."
] | [
"func",
"(",
"gac",
"*",
"GitHubOAuthConfig",
")",
"InitGitHubOAuthConfig",
"(",
"<mask>",
"*",
"sessions",
".",
"CookieStore",
")",
"{",
"gob",
".",
"Register",
"(",
"&",
"oauth2",
".",
"Token",
"{",
"}",
")",
"\n",
"gac",
".",
"CookieStore",
"=",
"cookie",
"\n",
"}"
] |
9,883 | all-9884 | [
"getRBDSize",
"returns",
"the",
"size",
"the",
"RBD",
"storage",
"volume",
"is",
"supposed",
"to",
"be",
"created",
"with"
] | [
"func",
"(",
"s",
"*",
"storageCeph",
")",
"getRBDSize",
"(",
")",
"(",
"string",
",",
"error",
")",
"{",
"sz",
",",
"err",
":=",
"<mask>",
".",
"ParseByteSizeString",
"(",
"s",
".",
"volume",
".",
"Config",
"[",
"\"",
"\"",
"]",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"\"",
"\"",
",",
"err",
"\n",
"}",
"\n\n",
"// Safety net: Set to default value.",
"if",
"sz",
"==",
"0",
"{",
"sz",
",",
"_",
"=",
"shared",
".",
"ParseByteSizeString",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"return",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"sz",
")",
",",
"nil",
"\n",
"}"
] |
9,884 | all-9885 | [
"WithContext",
"adds",
"the",
"context",
"to",
"the",
"list",
"Vm",
"params"
] | [
"func",
"(",
"o",
"*",
"ListVMParams",
")",
"WithContext",
"(",
"ctx",
"<mask>",
".",
"Context",
")",
"*",
"ListVMParams",
"{",
"o",
".",
"SetContext",
"(",
"ctx",
")",
"\n",
"return",
"o",
"\n",
"}"
] |
9,885 | all-9886 | [
"New",
"returns",
"a",
"new",
"generator",
"for",
"build",
"actions",
"on",
"a",
"Buffalo",
"app"
] | [
"func",
"New",
"(",
"opts",
"*",
"<mask>",
")",
"(",
"*",
"genny",
".",
"Generator",
",",
"error",
")",
"{",
"g",
":=",
"genny",
".",
"New",
"(",
")",
"\n\n",
"if",
"err",
":=",
"opts",
".",
"Validate",
"(",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"g",
",",
"err",
"\n",
"}",
"\n\n",
"g",
".",
"RunFn",
"(",
"construct",
"(",
"opts",
")",
")",
"\n",
"return",
"g",
",",
"nil",
"\n",
"}"
] |
9,886 | all-9887 | [
"Respond",
"without",
"doing",
"anything",
".",
"This",
"endpoint",
"is",
"used",
"to",
"check",
"that",
"the",
"service",
"is",
"up",
".",
"See",
"#ping"
] | [
"func",
"(",
"hooks",
"*",
"Hooks",
")",
"Ping",
"(",
")",
"error",
"{",
"cd",
":=",
"tcclient",
".",
"<mask>",
"(",
"*",
"hooks",
")",
"\n",
"_",
",",
"_",
",",
"err",
":=",
"(",
"&",
"cd",
")",
".",
"APICall",
"(",
"nil",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"nil",
",",
"nil",
")",
"\n",
"return",
"err",
"\n",
"}"
] |
9,887 | all-9888 | [
"UnmarshalJSON",
"supports",
"json",
".",
"Unmarshaler",
"interface"
] | [
"func",
"(",
"v",
"*",
"EventAuthRequired",
")",
"UnmarshalJSON",
"(",
"<mask>",
"[",
"]",
"byte",
")",
"error",
"{",
"r",
":=",
"jlexer",
".",
"Lexer",
"{",
"Data",
":",
"data",
"}",
"\n",
"easyjsonC5a4559bDecodeGithubComChromedpCdprotoFetch9",
"(",
"&",
"r",
",",
"v",
")",
"\n",
"return",
"r",
".",
"Error",
"(",
")",
"\n",
"}"
] |
9,888 | all-9889 | [
"WithRawResponse",
"if",
"set",
"the",
"requests",
"completes",
"using",
"with",
"the",
"provided",
"base64",
"encoded",
"raw",
"response",
"including",
"HTTP",
"status",
"line",
"and",
"headers",
"etc",
"...",
"Must",
"not",
"be",
"set",
"in",
"response",
"to",
"an",
"authChallenge",
"."
] | [
"func",
"(",
"p",
"ContinueInterceptedRequestParams",
")",
"WithRawResponse",
"(",
"rawResponse",
"<mask>",
")",
"*",
"ContinueInterceptedRequestParams",
"{",
"p",
".",
"RawResponse",
"=",
"rawResponse",
"\n",
"return",
"&",
"p",
"\n",
"}"
] |
9,889 | all-9890 | [
"MarshalJSON",
"supports",
"json",
".",
"Marshaler",
"interface"
] | [
"func",
"(",
"v",
"EventPseudoElementAdded",
")",
"MarshalJSON",
"(",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"w",
":=",
"jwriter",
".",
"Writer",
"{",
"}",
"\n",
"easyjsonC5a4559bEncodeGithubComChromedpCdprotoDom59",
"(",
"&",
"w",
",",
"v",
")",
"\n",
"return",
"w",
".",
"Buffer",
".",
"BuildBytes",
"(",
")",
",",
"w",
".",
"<mask>",
"\n",
"}"
] |
9,890 | all-9891 | [
"NoneEquals",
"checks",
"one",
"element",
"of",
"a",
"slice",
"equals",
"a",
"value",
".",
"Like",
"EqualsOneOf",
"NoneEquals",
"unwraps",
"pointers",
"."
] | [
"func",
"NoneEquals",
"(",
"tb",
"testing",
".",
"TB",
",",
"<mask>",
"interface",
"{",
"}",
",",
"actuals",
"interface",
"{",
"}",
",",
"msgAndArgs",
"...",
"interface",
"{",
"}",
")",
"{",
"tb",
".",
"Helper",
"(",
")",
"\n",
"equal",
",",
"err",
":=",
"oneOfEquals",
"(",
"\"",
"\"",
",",
"actuals",
",",
"expected",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"fatal",
"(",
"tb",
",",
"msgAndArgs",
",",
"err",
".",
"Error",
"(",
")",
")",
"\n",
"}",
"\n",
"if",
"equal",
"{",
"fatal",
"(",
"tb",
",",
"msgAndArgs",
",",
"\"",
"\\n",
"\"",
",",
"expected",
",",
"actuals",
")",
"\n",
"}",
"\n",
"}"
] |
9,891 | all-9892 | [
"/",
"*",
"Warning",
"uses",
"msg",
"as",
"a",
"format",
"string",
"with",
"subsequent",
"parameters",
"as",
"values",
"and",
"logs",
"the",
"resulting",
"message",
"to",
"all",
"added",
"loggers",
"at",
"LogLevel",
".",
"LevelWarning"
] | [
"func",
"(",
"la",
"*",
"LogAdapter",
")",
"Warning",
"(",
"<mask>",
"string",
")",
"error",
"{",
"return",
"la",
".",
"Log",
"(",
"LevelWarning",
",",
"nil",
",",
"msg",
")",
"\n",
"}"
] |
9,892 | all-9893 | [
"Group",
"creates",
"a",
"new",
"router",
"group",
".",
"You",
"should",
"add",
"all",
"the",
"routes",
"that",
"have",
"common",
"middlwares",
"or",
"the",
"same",
"path",
"prefix",
".",
"For",
"example",
"all",
"the",
"routes",
"that",
"use",
"a",
"common",
"middlware",
"for",
"authorization",
"could",
"be",
"grouped",
"."
] | [
"func",
"(",
"group",
"*",
"RouterGroup",
")",
"Group",
"(",
"relativePath",
"string",
",",
"handlers",
"...",
"RouterHandler",
")",
"*",
"RouterGroup",
"{",
"return",
"&",
"RouterGroup",
"{",
"Handlers",
":",
"group",
".",
"combineHandlers",
"(",
"handlers",
")",
",",
"basePath",
":",
"group",
".",
"calculateAbsolutePath",
"(",
"relativePath",
")",
",",
"engine",
":",
"<mask>",
".",
"engine",
",",
"}",
"\n",
"}"
] |
9,893 | all-9894 | [
"GetCreatedAt",
"sets",
"the",
"timestamp",
"for",
"container",
"s",
"creation",
"time"
] | [
"func",
"(",
"c",
"*",
"Container",
")",
"GetCreatedAt",
"(",
")",
"time",
".",
"Time",
"{",
"c",
".",
"<mask>",
".",
"RLock",
"(",
")",
"\n",
"defer",
"c",
".",
"lock",
".",
"RUnlock",
"(",
")",
"\n\n",
"return",
"c",
".",
"createdAt",
"\n",
"}"
] |
9,894 | all-9895 | [
"Do",
"executes",
"DOM",
".",
"setOuterHTML",
"against",
"the",
"provided",
"context",
"."
] | [
"func",
"(",
"p",
"*",
"SetOuterHTMLParams",
")",
"Do",
"(",
"ctx",
"<mask>",
".",
"Context",
")",
"(",
"err",
"error",
")",
"{",
"return",
"cdp",
".",
"Execute",
"(",
"ctx",
",",
"CommandSetOuterHTML",
",",
"p",
",",
"nil",
")",
"\n",
"}"
] |
9,895 | all-9896 | [
"New",
"makes",
"a",
"new",
"Cron",
"object"
] | [
"func",
"New",
"(",
")",
"*",
"Cron",
"{",
"return",
"&",
"Cron",
"{",
"cronAgent",
":",
"cron",
".",
"New",
"(",
")",
",",
"<mask>",
":",
"map",
"[",
"string",
"]",
"*",
"jobStatus",
"{",
"}",
",",
"logger",
":",
"logrus",
".",
"WithField",
"(",
"\"",
"\"",
",",
"\"",
"\"",
")",
",",
"}",
"\n",
"}"
] |
9,896 | all-9897 | [
"sleepCtx",
"provides",
"a",
"cancelable",
"sleep"
] | [
"func",
"sleepCtx",
"(",
"ctx",
"<mask>",
".",
"Context",
",",
"duration",
"time",
".",
"Duration",
")",
"{",
"derivedCtx",
",",
"_",
":=",
"context",
".",
"WithDeadline",
"(",
"ctx",
",",
"time",
".",
"Now",
"(",
")",
".",
"Add",
"(",
"duration",
")",
")",
"\n",
"<-",
"derivedCtx",
".",
"Done",
"(",
")",
"\n",
"}"
] |
9,897 | all-9898 | [
"RaftNodesReplace",
"replaces",
"the",
"current",
"list",
"of",
"raft",
"nodes",
"."
] | [
"func",
"(",
"n",
"*",
"NodeTx",
")",
"RaftNodesReplace",
"(",
"nodes",
"[",
"]",
"RaftNode",
")",
"error",
"{",
"_",
",",
"err",
":=",
"n",
".",
"tx",
".",
"Exec",
"(",
"\"",
"\"",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"columns",
":=",
"[",
"]",
"string",
"{",
"\"",
"\"",
",",
"\"",
"\"",
"}",
"\n",
"for",
"_",
",",
"node",
":=",
"range",
"nodes",
"{",
"values",
":=",
"[",
"]",
"interface",
"{",
"}",
"{",
"node",
".",
"<mask>",
",",
"node",
".",
"Address",
"}",
"\n",
"_",
",",
"err",
":=",
"query",
".",
"UpsertObject",
"(",
"n",
".",
"tx",
",",
"\"",
"\"",
",",
"columns",
",",
"values",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
] |
9,898 | all-9899 | [
"AddWithDataAndDelay",
"is",
"convenience",
"method",
"to",
"add",
"a",
"job",
"with",
"given",
"data",
"and",
"delay",
"."
] | [
"func",
"AddWithDataAndDelay",
"(",
"q",
"Queue",
",",
"tx",
"*",
"reform",
".",
"TX",
",",
"jobType",
",",
"relatedType",
",",
"relatedID",
",",
"creator",
"string",
",",
"jobData",
"interface",
"{",
"}",
",",
"delay",
"time",
".",
"Duration",
")",
"error",
"{",
"data2",
",",
"err",
":=",
"json",
".",
"Marshal",
"(",
"jobData",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"return",
"q",
".",
"Add",
"(",
"tx",
",",
"&",
"data",
".",
"Job",
"{",
"Type",
":",
"jobType",
",",
"RelatedType",
":",
"relatedType",
",",
"RelatedID",
":",
"relatedID",
",",
"CreatedBy",
":",
"creator",
",",
"Data",
":",
"data2",
",",
"NotBefore",
":",
"<mask>",
".",
"Now",
"(",
")",
".",
"Add",
"(",
"delay",
")",
",",
"}",
")",
"\n",
"}"
] |
9,899 | all-9900 | [
"convertFromStatedCharset",
"returns",
"a",
"reader",
"that",
"will",
"convert",
"from",
"the",
"charset",
"specified",
"for",
"the",
"current",
"*",
"Part",
"to",
"UTF",
"-",
"8",
".",
"In",
"case",
"of",
"error",
"or",
"an",
"unhandled",
"character",
"set",
"a",
"warning",
"will",
"be",
"added",
"to",
"the",
"*",
"Part",
"and",
"the",
"original",
"io",
".",
"Reader",
"will",
"be",
"returned",
"."
] | [
"func",
"(",
"p",
"*",
"Part",
")",
"convertFromStatedCharset",
"(",
"r",
"io",
".",
"Reader",
")",
"<mask>",
".",
"Reader",
"{",
"if",
"p",
".",
"Charset",
"==",
"\"",
"\"",
"{",
"// US-ASCII. Just read.",
"return",
"r",
"\n",
"}",
"\n\n",
"reader",
",",
"err",
":=",
"coding",
".",
"NewCharsetReader",
"(",
"p",
".",
"Charset",
",",
"r",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"// Failed to get a conversion reader.",
"p",
".",
"addWarning",
"(",
"ErrorCharsetConversion",
",",
"\"",
"\"",
",",
"p",
".",
"Charset",
",",
"err",
")",
"\n",
"}",
"else",
"{",
"return",
"reader",
"\n",
"}",
"\n\n",
"// Try to parse charset again here to see if we can salvage some badly formed",
"// ones like charset=\"charset=utf-8\".",
"charsetp",
":=",
"strings",
".",
"Split",
"(",
"p",
".",
"Charset",
",",
"\"",
"\"",
")",
"\n",
"if",
"strings",
".",
"ToLower",
"(",
"charsetp",
"[",
"0",
"]",
")",
"==",
"\"",
"\"",
"&&",
"len",
"(",
"charsetp",
")",
">",
"1",
"{",
"p",
".",
"Charset",
"=",
"charsetp",
"[",
"1",
"]",
"\n",
"reader",
",",
"err",
"=",
"coding",
".",
"NewCharsetReader",
"(",
"p",
".",
"Charset",
",",
"r",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"// Failed to get a conversion reader.",
"p",
".",
"addWarning",
"(",
"ErrorCharsetConversion",
",",
"\"",
"\"",
",",
"p",
".",
"Charset",
",",
"err",
")",
"\n",
"}",
"else",
"{",
"return",
"reader",
"\n",
"}",
"\n",
"}",
"\n\n",
"return",
"r",
"\n",
"}"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.