id
int32 0
25.3k
| idx
stringlengths 5
9
| nl_tokens
sequencelengths 1
418
| pl_tokens
sequencelengths 22
4.98k
|
---|---|---|---|
8,900 | all-8901 | [
"Vcpus",
"returns",
"number",
"of",
"virtual",
"CPUs",
"configured",
"for",
"the",
"virtual",
"machine",
"."
] | [
"func",
"(",
"v",
"*",
"VM",
")",
"Vcpus",
"(",
")",
"(",
"uint8",
",",
"error",
")",
"{",
"var",
"err",
"C",
".",
"VixError",
"=",
"C",
".",
"VIX_OK",
"\n",
"vcpus",
":=",
"C",
".",
"VIX_PROPERTY_NONE",
"\n\n",
"err",
"=",
"C",
".",
"get_property",
"(",
"v",
".",
"handle",
",",
"C",
".",
"VIX_PROPERTY_VM_NUM_VCPUS",
",",
"unsafe",
".",
"Pointer",
"(",
"&",
"vcpus",
")",
")",
"\n\n",
"if",
"C",
".",
"VIX_OK",
"!=",
"err",
"{",
"return",
"0",
",",
"&",
"<mask>",
"{",
"Operation",
":",
"\"",
"\"",
",",
"Code",
":",
"int",
"(",
"err",
"&",
"0xFFFF",
")",
",",
"Text",
":",
"C",
".",
"GoString",
"(",
"C",
".",
"Vix_GetErrorText",
"(",
"err",
",",
"nil",
")",
")",
",",
"}",
"\n",
"}",
"\n\n",
"return",
"uint8",
"(",
"vcpus",
")",
",",
"nil",
"\n",
"}"
] |
8,901 | all-8902 | [
"NewMatcher",
"returns",
"a",
"matcher",
"object",
"."
] | [
"func",
"NewMatcher",
"(",
"t",
"MatchType",
",",
"n",
",",
"v",
"string",
")",
"(",
"*",
"Matcher",
",",
"error",
")",
"{",
"m",
":=",
"&",
"Matcher",
"{",
"Type",
":",
"t",
",",
"<mask>",
":",
"n",
",",
"Value",
":",
"v",
",",
"}",
"\n",
"if",
"t",
"==",
"MatchRegexp",
"||",
"t",
"==",
"MatchNotRegexp",
"{",
"re",
",",
"err",
":=",
"regexp",
".",
"Compile",
"(",
"\"",
"\"",
"+",
"v",
"+",
"\"",
"\"",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"m",
".",
"re",
"=",
"re",
"\n",
"}",
"\n",
"return",
"m",
",",
"nil",
"\n",
"}"
] |
8,902 | all-8903 | [
"GetExecutionCredentialsID",
"gets",
"the",
"credentials",
"ID",
"for",
"the",
"task"
] | [
"func",
"(",
"task",
"*",
"Task",
")",
"GetExecutionCredentialsID",
"(",
")",
"string",
"{",
"<mask>",
".",
"lock",
".",
"RLock",
"(",
")",
"\n",
"defer",
"task",
".",
"lock",
".",
"RUnlock",
"(",
")",
"\n\n",
"return",
"task",
".",
"ExecutionCredentialsID",
"\n",
"}"
] |
8,903 | all-8904 | [
"WithTransform",
"applies",
"the",
"transform",
"to",
"the",
"actual",
"value",
"and",
"matches",
"it",
"against",
"matcher",
".",
"The",
"given",
"transform",
"must",
"be",
"a",
"function",
"of",
"one",
"parameter",
"that",
"returns",
"one",
"value",
".",
"var",
"plus1",
"=",
"func",
"(",
"i",
"int",
")",
"int",
"{",
"return",
"i",
"+",
"1",
"}",
"Expect",
"(",
"1",
")",
".",
"To",
"(",
"WithTransform",
"(",
"plus1",
"Equal",
"(",
"2",
"))",
"And",
"()",
"Or",
"()",
"Not",
"()",
"and",
"WithTransform",
"()",
"allow",
"matchers",
"to",
"be",
"composed",
"into",
"complex",
"expressions",
"."
] | [
"func",
"WithTransform",
"(",
"<mask>",
"interface",
"{",
"}",
",",
"matcher",
"types",
".",
"GomegaMatcher",
")",
"types",
".",
"GomegaMatcher",
"{",
"return",
"matchers",
".",
"NewWithTransformMatcher",
"(",
"transform",
",",
"matcher",
")",
"\n",
"}"
] |
8,904 | all-8905 | [
"Create",
"goes",
"through",
"the",
"TemplatesDir",
"creating",
"the",
"template",
"structure",
"for",
"rendering",
".",
"Returns",
"the",
"Render",
"instance",
"."
] | [
"func",
"(",
"r",
"*",
"Render",
")",
"Create",
"(",
")",
"*",
"Render",
"{",
"r",
".",
"Validate",
"(",
")",
"\n\n",
"<mask>",
":=",
"r",
".",
"TemplatesDir",
"+",
"r",
".",
"Layout",
"+",
"r",
".",
"Ext",
"\n\n",
"// root dir",
"tplRoot",
",",
"err",
":=",
"filepath",
".",
"Glob",
"(",
"r",
".",
"TemplatesDir",
"+",
"\"",
"\"",
"+",
"r",
".",
"Ext",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"panic",
"(",
"err",
".",
"Error",
"(",
")",
")",
"\n",
"}",
"\n\n",
"// sub dirs",
"tplSub",
",",
"err",
":=",
"filepath",
".",
"Glob",
"(",
"r",
".",
"TemplatesDir",
"+",
"\"",
"\"",
"+",
"r",
".",
"Ext",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"panic",
"(",
"err",
".",
"Error",
"(",
")",
")",
"\n",
"}",
"\n\n",
"for",
"_",
",",
"tpl",
":=",
"range",
"append",
"(",
"tplRoot",
",",
"tplSub",
"...",
")",
"{",
"// This check is to prevent `panic: template: redefinition of template \"layout\"`",
"name",
":=",
"r",
".",
"getTemplateName",
"(",
"tpl",
")",
"\n",
"if",
"name",
"==",
"r",
".",
"Layout",
"{",
"continue",
"\n",
"}",
"\n\n",
"r",
".",
"AddFromFiles",
"(",
"name",
",",
"layout",
",",
"tpl",
")",
"\n",
"}",
"\n\n",
"return",
"r",
"\n",
"}"
] |
8,905 | all-8906 | [
"Specify",
"the",
"value",
"of",
"a",
"uniform",
"variable",
"for",
"a",
"specified",
"program",
"object"
] | [
"func",
"ProgramUniform1fv",
"(",
"<mask>",
"uint32",
",",
"location",
"int32",
",",
"count",
"int32",
",",
"value",
"*",
"float32",
")",
"{",
"syscall",
".",
"Syscall6",
"(",
"gpProgramUniform1fv",
",",
"4",
",",
"uintptr",
"(",
"program",
")",
",",
"uintptr",
"(",
"location",
")",
",",
"uintptr",
"(",
"count",
")",
",",
"uintptr",
"(",
"unsafe",
".",
"Pointer",
"(",
"value",
")",
")",
",",
"0",
",",
"0",
")",
"\n",
"}"
] |
8,906 | all-8907 | [
"RemoveAttr",
"will",
"remove",
"the",
"attribute",
"with",
"the",
"provided",
"name",
"."
] | [
"func",
"(",
"a",
"*",
"Attrs",
")",
"RemoveAttr",
"(",
"key",
"string",
")",
"{",
"a",
".",
"attrsLock",
".",
"Lock",
"(",
")",
"\n",
"defer",
"a",
".",
"attrsLock",
".",
"Unlock",
"(",
")",
"\n\n",
"<mask>",
"(",
"a",
".",
"attrs",
",",
"getAttrHash",
"(",
"key",
")",
")",
"\n",
"}"
] |
8,907 | all-8908 | [
"GetYOk",
"returns",
"a",
"tuple",
"with",
"the",
"Y",
"field",
"if",
"it",
"s",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"and",
"a",
"boolean",
"to",
"check",
"if",
"the",
"value",
"has",
"been",
"set",
"."
] | [
"func",
"(",
"w",
"*",
"WidgetLayout",
")",
"GetYOk",
"(",
")",
"(",
"float64",
",",
"bool",
")",
"{",
"if",
"w",
"==",
"nil",
"||",
"w",
".",
"Y",
"==",
"nil",
"{",
"return",
"0",
",",
"false",
"\n",
"}",
"\n",
"return",
"*",
"w",
".",
"Y",
",",
"<mask>",
"\n",
"}"
] |
8,908 | all-8909 | [
"Extract",
"is",
"a",
"helper",
"function",
"to",
"extract",
"information",
"from",
"an",
"xdr",
".",
"Asset",
"structure",
".",
"It",
"extracts",
"the",
"asset",
"s",
"type",
"to",
"the",
"typ",
"input",
"parameter",
"(",
"which",
"must",
"be",
"either",
"a",
"*",
"string",
"or",
"*",
"xdr",
".",
"AssetType",
")",
".",
"It",
"also",
"extracts",
"the",
"asset",
"s",
"code",
"and",
"issuer",
"to",
"code",
"and",
"issuer",
"respectively",
"if",
"they",
"are",
"of",
"type",
"*",
"string",
"and",
"the",
"asset",
"is",
"non",
"-",
"native"
] | [
"func",
"(",
"a",
"Asset",
")",
"Extract",
"(",
"typ",
"interface",
"{",
"}",
",",
"code",
"interface",
"{",
"}",
",",
"issuer",
"interface",
"{",
"}",
")",
"error",
"{",
"switch",
"typ",
":=",
"typ",
".",
"(",
"type",
")",
"{",
"case",
"*",
"AssetType",
":",
"*",
"typ",
"=",
"a",
".",
"Type",
"\n",
"case",
"*",
"string",
":",
"switch",
"a",
".",
"Type",
"{",
"case",
"AssetTypeAssetTypeNative",
":",
"*",
"typ",
"=",
"\"",
"\"",
"\n",
"case",
"AssetTypeAssetTypeCreditAlphanum4",
":",
"*",
"typ",
"=",
"\"",
"\"",
"\n",
"case",
"AssetTypeAssetTypeCreditAlphanum12",
":",
"*",
"typ",
"=",
"\"",
"\"",
"\n",
"}",
"\n",
"default",
":",
"return",
"<mask>",
".",
"New",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"if",
"code",
"!=",
"nil",
"{",
"switch",
"code",
":=",
"code",
".",
"(",
"type",
")",
"{",
"case",
"*",
"string",
":",
"switch",
"a",
".",
"Type",
"{",
"case",
"AssetTypeAssetTypeCreditAlphanum4",
":",
"an",
":=",
"a",
".",
"MustAlphaNum4",
"(",
")",
"\n",
"*",
"code",
"=",
"strings",
".",
"TrimRight",
"(",
"string",
"(",
"an",
".",
"AssetCode",
"[",
":",
"]",
")",
",",
"\"",
"\\x00",
"\"",
")",
"\n",
"case",
"AssetTypeAssetTypeCreditAlphanum12",
":",
"an",
":=",
"a",
".",
"MustAlphaNum12",
"(",
")",
"\n",
"*",
"code",
"=",
"strings",
".",
"TrimRight",
"(",
"string",
"(",
"an",
".",
"AssetCode",
"[",
":",
"]",
")",
",",
"\"",
"\\x00",
"\"",
")",
"\n",
"}",
"\n",
"default",
":",
"return",
"errors",
".",
"New",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"}",
"\n\n",
"if",
"issuer",
"!=",
"nil",
"{",
"switch",
"issuer",
":=",
"issuer",
".",
"(",
"type",
")",
"{",
"case",
"*",
"string",
":",
"switch",
"a",
".",
"Type",
"{",
"case",
"AssetTypeAssetTypeCreditAlphanum4",
":",
"an",
":=",
"a",
".",
"MustAlphaNum4",
"(",
")",
"\n",
"raw",
":=",
"an",
".",
"Issuer",
".",
"MustEd25519",
"(",
")",
"\n",
"*",
"issuer",
"=",
"strkey",
".",
"MustEncode",
"(",
"strkey",
".",
"VersionByteAccountID",
",",
"raw",
"[",
":",
"]",
")",
"\n",
"case",
"AssetTypeAssetTypeCreditAlphanum12",
":",
"an",
":=",
"a",
".",
"MustAlphaNum12",
"(",
")",
"\n",
"raw",
":=",
"an",
".",
"Issuer",
".",
"MustEd25519",
"(",
")",
"\n",
"*",
"issuer",
"=",
"strkey",
".",
"MustEncode",
"(",
"strkey",
".",
"VersionByteAccountID",
",",
"raw",
"[",
":",
"]",
")",
"\n",
"}",
"\n",
"default",
":",
"return",
"errors",
".",
"New",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"}",
"\n\n",
"return",
"nil",
"\n",
"}"
] |
8,909 | all-8910 | [
"listChangedFiles",
"lists",
"(",
"in",
"lexicographic",
"order",
")",
"the",
"files",
"changed",
"as",
"part",
"of",
"a",
"Gerrit",
"patchset"
] | [
"func",
"listChangedFiles",
"(",
"changeInfo",
"client",
".",
"ChangeInfo",
")",
"config",
".",
"ChangedFilesProvider",
"{",
"return",
"func",
"(",
")",
"(",
"[",
"]",
"string",
",",
"error",
")",
"{",
"var",
"<mask>",
"[",
"]",
"string",
"\n",
"revision",
":=",
"changeInfo",
".",
"Revisions",
"[",
"changeInfo",
".",
"CurrentRevision",
"]",
"\n",
"for",
"file",
":=",
"range",
"revision",
".",
"Files",
"{",
"changed",
"=",
"append",
"(",
"changed",
",",
"file",
")",
"\n",
"}",
"\n",
"return",
"changed",
",",
"nil",
"\n",
"}",
"\n",
"}"
] |
8,910 | all-8911 | [
"Flush",
"sends",
"all",
"pending",
"data",
"and",
"returns",
"true",
"if",
"anything",
"was",
"sent",
"since",
"the",
"previous",
"flush",
".",
"For",
"testing",
"."
] | [
"func",
"(",
"s",
"*",
"gossipSender",
")",
"Flush",
"(",
")",
"bool",
"{",
"ch",
":=",
"<mask>",
"(",
"chan",
"bool",
")",
"\n",
"s",
".",
"flush",
"<-",
"ch",
"\n",
"return",
"<-",
"ch",
"\n",
"}"
] |
8,911 | all-8912 | [
"Return",
"the",
"time",
"-",
"based",
"OTP",
"for",
"the",
"given",
"period",
"."
] | [
"func",
"(",
"totp",
"*",
"TOTP",
")",
"ForPeriod",
"(",
"period",
"int64",
")",
"int32",
"{",
"data",
":=",
"int_to_bytestring",
"(",
"period",
")",
"\n\n",
"hmacHash",
":=",
"hmac",
".",
"New",
"(",
"sha1",
".",
"New",
",",
"totp",
".",
"key",
")",
"\n",
"hmacHash",
".",
"Write",
"(",
"data",
")",
"\n",
"digest",
":=",
"hmacHash",
".",
"Sum",
"(",
"nil",
")",
"\n",
"offset",
":=",
"int",
"(",
"digest",
"[",
"19",
"]",
"&",
"0xf",
")",
"\n",
"code",
":=",
"int32",
"(",
"digest",
"[",
"offset",
"]",
"&",
"0x7f",
")",
"<<",
"24",
"|",
"int32",
"(",
"digest",
"[",
"<mask>",
"+",
"1",
"]",
"&",
"0xff",
")",
"<<",
"16",
"|",
"int32",
"(",
"digest",
"[",
"offset",
"+",
"2",
"]",
"&",
"0xff",
")",
"<<",
"8",
"|",
"int32",
"(",
"digest",
"[",
"offset",
"+",
"3",
"]",
"&",
"0xff",
")",
"\n\n",
"code",
"=",
"int32",
"(",
"int64",
"(",
"code",
")",
"%",
"int64",
"(",
"math",
".",
"Pow10",
"(",
"totp",
".",
"Digits",
")",
")",
")",
"\n",
"return",
"code",
"\n",
"}"
] |
8,912 | all-8913 | [
"Match",
"searches",
"the",
"routing",
"tree",
"for",
"a",
"handler",
"that",
"matches",
"the",
"method",
"/",
"path",
".",
"It",
"s",
"similar",
"to",
"routing",
"a",
"http",
"request",
"but",
"without",
"executing",
"the",
"handler",
"thereafter",
".",
"Note",
":",
"the",
"*",
"Context",
"state",
"is",
"updated",
"during",
"execution",
"so",
"manage",
"the",
"state",
"carefully",
"or",
"make",
"a",
"NewRouteContext",
"()",
"."
] | [
"func",
"(",
"mx",
"*",
"Mux",
")",
"Match",
"(",
"rctx",
"*",
"Context",
",",
"method",
",",
"<mask>",
"string",
")",
"bool",
"{",
"m",
",",
"ok",
":=",
"methodMap",
"[",
"method",
"]",
"\n",
"if",
"!",
"ok",
"{",
"return",
"false",
"\n",
"}",
"\n\n",
"node",
",",
"_",
",",
"h",
":=",
"mx",
".",
"tree",
".",
"FindRoute",
"(",
"rctx",
",",
"m",
",",
"path",
")",
"\n\n",
"if",
"node",
"!=",
"nil",
"&&",
"node",
".",
"subroutes",
"!=",
"nil",
"{",
"rctx",
".",
"RoutePath",
"=",
"mx",
".",
"nextRoutePath",
"(",
"rctx",
")",
"\n",
"return",
"node",
".",
"subroutes",
".",
"Match",
"(",
"rctx",
",",
"method",
",",
"rctx",
".",
"RoutePath",
")",
"\n",
"}",
"\n\n",
"return",
"h",
"!=",
"nil",
"\n",
"}"
] |
8,913 | all-8914 | [
"Less",
"helps",
"implement",
"sort",
".",
"Interface",
"for",
"virtualDeviceListSorter",
".",
"A",
"BaseVirtualDevice",
"is",
"less",
"than",
"another",
"device",
"if",
"its",
"controller",
"s",
"bus",
"number",
"and",
"unit",
"number",
"combination",
"are",
"earlier",
"in",
"the",
"order",
"than",
"the",
"other",
"."
] | [
"func",
"(",
"l",
"virtualDeviceListSorter",
")",
"Less",
"(",
"i",
",",
"j",
"int",
")",
"bool",
"{",
"li",
":=",
"l",
".",
"Sort",
"[",
"i",
"]",
"\n",
"lj",
":=",
"l",
".",
"Sort",
"[",
"j",
"]",
"\n",
"liCtlr",
":=",
"l",
".",
"DeviceList",
".",
"FindByKey",
"(",
"li",
".",
"GetVirtualDevice",
"(",
")",
".",
"ControllerKey",
")",
"\n",
"ljCtlr",
":=",
"l",
".",
"DeviceList",
".",
"FindByKey",
"(",
"lj",
".",
"GetVirtualDevice",
"(",
")",
".",
"ControllerKey",
")",
"\n",
"if",
"liCtlr",
"==",
"nil",
"||",
"ljCtlr",
"==",
"nil",
"{",
"panic",
"(",
"<mask>",
".",
"New",
"(",
"\"",
"\"",
")",
")",
"\n",
"}",
"\n",
"if",
"liCtlr",
".",
"(",
"types",
".",
"BaseVirtualController",
")",
".",
"GetVirtualController",
"(",
")",
".",
"BusNumber",
"<",
"liCtlr",
".",
"(",
"types",
".",
"BaseVirtualController",
")",
".",
"GetVirtualController",
"(",
")",
".",
"BusNumber",
"{",
"return",
"true",
"\n",
"}",
"\n",
"liUnit",
":=",
"li",
".",
"GetVirtualDevice",
"(",
")",
".",
"UnitNumber",
"\n",
"ljUnit",
":=",
"lj",
".",
"GetVirtualDevice",
"(",
")",
".",
"UnitNumber",
"\n",
"if",
"liUnit",
"==",
"nil",
"||",
"ljUnit",
"==",
"nil",
"{",
"panic",
"(",
"errors",
".",
"New",
"(",
"\"",
"\"",
")",
")",
"\n",
"}",
"\n",
"return",
"*",
"liUnit",
"<",
"*",
"ljUnit",
"\n",
"}"
] |
8,914 | all-8915 | [
"Errorf",
"formats",
"message",
"according",
"to",
"format",
"specifier",
"prepends",
"the",
"prefix",
"as",
"necessary",
"and",
"writes",
"to",
"log",
"with",
"LevelError",
".",
"This",
"is",
"part",
"of",
"the",
"Logger",
"interface",
"implementation",
"."
] | [
"func",
"(",
"l",
"*",
"slog",
")",
"Errorf",
"(",
"format",
"string",
",",
"args",
"...",
"interface",
"{",
"}",
")",
"{",
"lvl",
":=",
"l",
".",
"Level",
"(",
")",
"\n",
"if",
"lvl",
"<=",
"LevelError",
"{",
"l",
".",
"b",
".",
"printf",
"(",
"\"",
"\"",
",",
"l",
".",
"<mask>",
",",
"format",
",",
"args",
"...",
")",
"\n",
"}",
"\n",
"}"
] |
8,915 | all-8916 | [
"HasOptionalParams",
"returns",
"true",
"if",
"the",
"action",
"takes",
"optional",
"parameters",
"false",
"otherwise",
"."
] | [
"func",
"(",
"a",
"*",
"<mask>",
")",
"HasOptionalParams",
"(",
")",
"bool",
"{",
"for",
"_",
",",
"param",
":=",
"range",
"a",
".",
"Params",
"{",
"if",
"!",
"param",
".",
"Mandatory",
"{",
"return",
"true",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"false",
"\n",
"}"
] |
8,916 | all-8917 | [
"DeleteRef",
"deletes",
"the",
"given",
"ref",
"See",
"https",
":",
"//",
"developer",
".",
"github",
".",
"com",
"/",
"v3",
"/",
"git",
"/",
"refs",
"/",
"#delete",
"-",
"a",
"-",
"reference"
] | [
"func",
"(",
"c",
"*",
"Client",
")",
"DeleteRef",
"(",
"org",
",",
"repo",
",",
"ref",
"string",
")",
"error",
"{",
"c",
".",
"<mask>",
"(",
"\"",
"\"",
",",
"org",
",",
"repo",
",",
"ref",
")",
"\n",
"_",
",",
"err",
":=",
"c",
".",
"request",
"(",
"&",
"request",
"{",
"method",
":",
"http",
".",
"MethodDelete",
",",
"path",
":",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"org",
",",
"repo",
",",
"ref",
")",
",",
"exitCodes",
":",
"[",
"]",
"int",
"{",
"204",
"}",
",",
"}",
",",
"nil",
")",
"\n",
"return",
"err",
"\n",
"}"
] |
8,917 | all-8918 | [
"Expands",
"a",
"start",
"end",
"and",
"stepping",
"value",
"into",
"the",
"full",
"range",
"of",
"int",
"values",
"."
] | [
"func",
"toRange",
"(",
"start",
",",
"end",
",",
"step",
"int",
")",
"[",
"]",
"int",
"{",
"nums",
":=",
"[",
"]",
"int",
"{",
"}",
"\n",
"if",
"step",
"<",
"1",
"{",
"step",
"=",
"1",
"\n",
"}",
"\n",
"if",
"start",
"<=",
"end",
"{",
"for",
"i",
":=",
"start",
";",
"i",
"<=",
"end",
";",
"{",
"nums",
"=",
"append",
"(",
"nums",
",",
"i",
")",
"\n",
"i",
"+=",
"step",
"\n",
"}",
"\n",
"}",
"else",
"{",
"for",
"i",
":=",
"start",
";",
"i",
">=",
"end",
";",
"{",
"nums",
"=",
"append",
"(",
"nums",
",",
"i",
")",
"\n",
"i",
"-=",
"<mask>",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"nums",
"\n",
"}"
] |
8,918 | all-8919 | [
"UnmarshalJSON",
"satisfies",
"json",
".",
"Unmarshaler",
"."
] | [
"func",
"(",
"t",
"*",
"ScrollRectType",
")",
"UnmarshalJSON",
"(",
"buf",
"[",
"]",
"<mask>",
")",
"error",
"{",
"return",
"easyjson",
".",
"Unmarshal",
"(",
"buf",
",",
"t",
")",
"\n",
"}"
] |
8,919 | all-8920 | [
"Warnf",
"is",
"a",
"short",
"-",
"hand",
"version",
"of",
"Warningf"
] | [
"func",
"(",
"la",
"*",
"LogAdapter",
")",
"Warnf",
"(",
"<mask>",
"string",
",",
"a",
"...",
"interface",
"{",
"}",
")",
"error",
"{",
"return",
"la",
".",
"Warningf",
"(",
"msg",
",",
"a",
"...",
")",
"\n",
"}"
] |
8,920 | all-8921 | [
"AccelGroupFromClosure",
"is",
"a",
"wrapper",
"around",
"gtk_accel_group_from_accel_closure",
"()",
"."
] | [
"func",
"AccelGroupFromClosure",
"(",
"f",
"<mask>",
"{",
"}",
")",
"*",
"AccelGroup",
"{",
"closure",
",",
"_",
":=",
"glib",
".",
"ClosureNew",
"(",
"f",
")",
"\n",
"cl",
":=",
"(",
"*",
"C",
".",
"struct__GClosure",
")",
"(",
"unsafe",
".",
"Pointer",
"(",
"closure",
")",
")",
"\n",
"c",
":=",
"C",
".",
"gtk_accel_group_from_accel_closure",
"(",
"cl",
")",
"\n",
"if",
"c",
"==",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n",
"return",
"wrapAccelGroup",
"(",
"glib",
".",
"Take",
"(",
"unsafe",
".",
"Pointer",
"(",
"c",
")",
")",
")",
"\n",
"}"
] |
8,921 | all-8922 | [
"title",
":",
"logs",
"config",
"set",
"path",
":",
"/",
"docker",
"/",
"logs",
"method",
":",
"POST",
"consume",
":",
"application",
"/",
"x",
"-",
"www",
"-",
"form",
"-",
"urlencoded",
"produce",
":",
"application",
"/",
"x",
"-",
"json",
"-",
"stream",
"responses",
":",
"200",
":",
"Ok",
"400",
":",
"Invalid",
"data",
"401",
":",
"Unauthorized"
] | [
"func",
"logsConfigSetHandler",
"(",
"w",
"http",
".",
"ResponseWriter",
",",
"r",
"*",
"http",
".",
"Request",
",",
"t",
"auth",
".",
"Token",
")",
"(",
"err",
"error",
")",
"{",
"pool",
":=",
"api",
".",
"InputValue",
"(",
"r",
",",
"\"",
"\"",
")",
"\n",
"restart",
",",
"_",
":=",
"strconv",
".",
"ParseBool",
"(",
"api",
".",
"InputValue",
"(",
"r",
",",
"\"",
"\"",
")",
")",
"\n",
"var",
"conf",
"container",
".",
"DockerLogConfig",
"\n",
"err",
"=",
"api",
".",
"ParseInput",
"(",
"r",
",",
"&",
"conf",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"var",
"ctxs",
"[",
"]",
"permTypes",
".",
"PermissionContext",
"\n",
"if",
"pool",
"!=",
"\"",
"\"",
"{",
"ctxs",
"=",
"append",
"(",
"ctxs",
",",
"permission",
".",
"Context",
"(",
"permTypes",
".",
"CtxPool",
",",
"pool",
")",
")",
"\n",
"}",
"\n",
"hasPermission",
":=",
"permission",
".",
"Check",
"(",
"t",
",",
"permission",
".",
"PermPoolUpdateLogs",
",",
"ctxs",
"...",
")",
"\n",
"if",
"!",
"hasPermission",
"{",
"return",
"permission",
".",
"ErrUnauthorized",
"\n",
"}",
"\n",
"evt",
",",
"err",
":=",
"event",
".",
"New",
"(",
"&",
"<mask>",
".",
"Opts",
"{",
"Target",
":",
"event",
".",
"Target",
"{",
"Type",
":",
"event",
".",
"TargetTypePool",
",",
"Value",
":",
"pool",
"}",
",",
"Kind",
":",
"permission",
".",
"PermPoolUpdateLogs",
",",
"Owner",
":",
"t",
",",
"CustomData",
":",
"event",
".",
"FormToCustomData",
"(",
"r",
".",
"Form",
")",
",",
"DisableLock",
":",
"true",
",",
"Allowed",
":",
"event",
".",
"Allowed",
"(",
"permission",
".",
"PermPoolReadEvents",
",",
"ctxs",
"...",
")",
",",
"}",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"defer",
"func",
"(",
")",
"{",
"evt",
".",
"Done",
"(",
"err",
")",
"}",
"(",
")",
"\n",
"err",
"=",
"conf",
".",
"Save",
"(",
"pool",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"w",
".",
"Header",
"(",
")",
".",
"Set",
"(",
"\"",
"\"",
",",
"\"",
"\"",
")",
"\n",
"keepAliveWriter",
":=",
"tsuruIo",
".",
"NewKeepAliveWriter",
"(",
"w",
",",
"15",
"*",
"time",
".",
"Second",
",",
"\"",
"\"",
")",
"\n",
"defer",
"keepAliveWriter",
".",
"Stop",
"(",
")",
"\n",
"writer",
":=",
"&",
"tsuruIo",
".",
"SimpleJsonMessageEncoderWriter",
"{",
"Encoder",
":",
"json",
".",
"NewEncoder",
"(",
"keepAliveWriter",
")",
"}",
"\n",
"evt",
".",
"SetLogWriter",
"(",
"writer",
")",
"\n",
"fmt",
".",
"Fprintln",
"(",
"evt",
",",
"\"",
"\"",
")",
"\n",
"if",
"restart",
"{",
"filter",
":=",
"&",
"app",
".",
"Filter",
"{",
"}",
"\n",
"if",
"pool",
"!=",
"\"",
"\"",
"{",
"filter",
".",
"Pools",
"=",
"[",
"]",
"string",
"{",
"pool",
"}",
"\n",
"}",
"\n",
"return",
"tryRestartAppsByFilter",
"(",
"filter",
",",
"evt",
")",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
] |
8,922 | all-8923 | [
"title",
":",
"list",
"units",
"by",
"app",
"path",
":",
"/",
"docker",
"/",
"node",
"/",
"apps",
"/",
"{",
"appname",
"}",
"/",
"containers",
"method",
":",
"GET",
"produce",
":",
"application",
"/",
"json",
"responses",
":",
"200",
":",
"Ok",
"204",
":",
"No",
"content",
"401",
":",
"Unauthorized",
"404",
":",
"Not",
"found"
] | [
"func",
"listUnitsByApp",
"(",
"w",
"http",
".",
"ResponseWriter",
",",
"r",
"*",
"http",
".",
"Request",
",",
"t",
"auth",
".",
"Token",
")",
"error",
"{",
"appName",
":=",
"r",
".",
"URL",
".",
"Query",
"(",
")",
".",
"Get",
"(",
"\"",
"\"",
")",
"\n",
"a",
",",
"err",
":=",
"app",
".",
"GetByName",
"(",
"appName",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"if",
"err",
"==",
"appTypes",
".",
"ErrAppNotFound",
"{",
"return",
"&",
"tsuruErrors",
".",
"HTTP",
"{",
"Code",
":",
"http",
".",
"StatusNotFound",
",",
"<mask>",
":",
"err",
".",
"Error",
"(",
")",
",",
"}",
"\n",
"}",
"\n",
"return",
"err",
"\n",
"}",
"\n",
"canRead",
":=",
"permission",
".",
"Check",
"(",
"t",
",",
"permission",
".",
"PermAppRead",
",",
"contextsForApp",
"(",
"a",
")",
"...",
",",
")",
"\n",
"if",
"!",
"canRead",
"{",
"return",
"permission",
".",
"ErrUnauthorized",
"\n",
"}",
"\n",
"units",
",",
"err",
":=",
"a",
".",
"Units",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"if",
"len",
"(",
"units",
")",
"==",
"0",
"{",
"w",
".",
"WriteHeader",
"(",
"http",
".",
"StatusNoContent",
")",
"\n",
"return",
"nil",
"\n",
"}",
"\n",
"w",
".",
"Header",
"(",
")",
".",
"Set",
"(",
"\"",
"\"",
",",
"\"",
"\"",
")",
"\n",
"return",
"json",
".",
"NewEncoder",
"(",
"w",
")",
".",
"Encode",
"(",
"units",
")",
"\n",
"}"
] |
8,923 | all-8924 | [
"Finish",
"ends",
"the",
"check",
"prints",
"its",
"output",
"(",
"to",
"stdout",
")",
"and",
"exits",
"with",
"the",
"correct",
"status",
"."
] | [
"func",
"(",
"c",
"*",
"Check",
")",
"Finish",
"(",
")",
"{",
"if",
"r",
":=",
"recover",
"(",
")",
";",
"r",
"!=",
"nil",
"{",
"c",
".",
"Exitf",
"(",
"CRITICAL",
",",
"\"",
"\"",
",",
"r",
")",
"\n",
"}",
"\n",
"if",
"len",
"(",
"c",
".",
"<mask>",
")",
"==",
"0",
"{",
"c",
".",
"AddResult",
"(",
"UNKNOWN",
",",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"fmt",
".",
"Println",
"(",
"c",
")",
"\n",
"os",
".",
"Exit",
"(",
"int",
"(",
"c",
".",
"status",
")",
")",
"\n",
"}"
] |
8,924 | all-8925 | [
"Send",
"sends",
"the",
"callback",
"response",
"."
] | [
"func",
"(",
"cbr",
"*",
"OutgoingCallbackQueryResponse",
")",
"Send",
"(",
")",
"error",
"{",
"resp",
":=",
"&",
"baseResponse",
"{",
"}",
"\n",
"_",
",",
"err",
":=",
"cbr",
".",
"api",
".",
"c",
".",
"postJSON",
"(",
"answerCallbackQuery",
",",
"resp",
",",
"cbr",
")",
"\n\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"return",
"<mask>",
"(",
"resp",
")",
"\n",
"}"
] |
8,925 | all-8926 | [
"Run",
"dispatches",
"notifications",
"continuously",
"."
] | [
"func",
"(",
"n",
"*",
"Manager",
")",
"Run",
"(",
"tsets",
"<-",
"chan",
"map",
"[",
"string",
"]",
"[",
"]",
"*",
"targetgroup",
".",
"Group",
")",
"{",
"for",
"{",
"<mask>",
"{",
"case",
"<-",
"n",
".",
"ctx",
".",
"Done",
"(",
")",
":",
"return",
"\n",
"case",
"ts",
":=",
"<-",
"tsets",
":",
"n",
".",
"reload",
"(",
"ts",
")",
"\n",
"case",
"<-",
"n",
".",
"more",
":",
"}",
"\n",
"alerts",
":=",
"n",
".",
"nextBatch",
"(",
")",
"\n\n",
"if",
"!",
"n",
".",
"sendAll",
"(",
"alerts",
"...",
")",
"{",
"n",
".",
"metrics",
".",
"dropped",
".",
"Add",
"(",
"float64",
"(",
"len",
"(",
"alerts",
")",
")",
")",
"\n",
"}",
"\n",
"// If the queue still has items left, kick off the next iteration.",
"if",
"n",
".",
"queueLen",
"(",
")",
">",
"0",
"{",
"n",
".",
"setMore",
"(",
")",
"\n",
"}",
"\n",
"}",
"\n",
"}"
] |
8,926 | all-8927 | [
"TryReusingBlob",
"checks",
"whether",
"the",
"transport",
"already",
"contains",
"or",
"can",
"efficiently",
"reuse",
"a",
"blob",
"and",
"if",
"so",
"applies",
"it",
"to",
"the",
"current",
"destination",
"(",
"e",
".",
"g",
".",
"if",
"the",
"blob",
"is",
"a",
"filesystem",
"layer",
"this",
"signifies",
"that",
"the",
"changes",
"it",
"describes",
"need",
"to",
"be",
"applied",
"again",
"when",
"composing",
"a",
"filesystem",
"tree",
")",
".",
"info",
".",
"Digest",
"must",
"not",
"be",
"empty",
".",
"If",
"canSubstitute",
"TryReusingBlob",
"can",
"use",
"an",
"equivalent",
"equivalent",
"of",
"the",
"desired",
"blob",
";",
"in",
"that",
"case",
"the",
"returned",
"info",
"may",
"not",
"match",
"the",
"input",
".",
"If",
"the",
"blob",
"has",
"been",
"succesfully",
"reused",
"returns",
"(",
"true",
"info",
"nil",
")",
";",
"info",
"must",
"contain",
"at",
"least",
"a",
"digest",
"and",
"size",
".",
"If",
"the",
"transport",
"can",
"not",
"reuse",
"the",
"requested",
"blob",
"TryReusingBlob",
"returns",
"(",
"false",
"{}",
"nil",
")",
";",
"it",
"returns",
"a",
"non",
"-",
"nil",
"error",
"only",
"on",
"an",
"unexpected",
"failure",
".",
"May",
"use",
"and",
"/",
"or",
"update",
"cache",
"."
] | [
"func",
"(",
"d",
"*",
"openshiftImageDestination",
")",
"TryReusingBlob",
"(",
"ctx",
"context",
".",
"Context",
",",
"info",
"types",
".",
"BlobInfo",
",",
"cache",
"<mask>",
".",
"BlobInfoCache",
",",
"canSubstitute",
"bool",
")",
"(",
"bool",
",",
"types",
".",
"BlobInfo",
",",
"error",
")",
"{",
"return",
"d",
".",
"docker",
".",
"TryReusingBlob",
"(",
"ctx",
",",
"info",
",",
"cache",
",",
"canSubstitute",
")",
"\n",
"}"
] |
8,927 | all-8928 | [
"newChanges",
"returns",
"a",
"collection",
"of",
"Changes",
"based",
"on",
"the",
"given",
"records",
"and",
"action",
"."
] | [
"func",
"(",
"p",
"*",
"AWSProvider",
")",
"newChanges",
"(",
"action",
"string",
",",
"endpoints",
"[",
"]",
"*",
"endpoint",
".",
"Endpoint",
",",
"recordsCache",
"[",
"]",
"*",
"endpoint",
".",
"Endpoint",
",",
"zones",
"map",
"[",
"string",
"]",
"*",
"route53",
".",
"HostedZone",
")",
"[",
"]",
"*",
"route53",
".",
"Change",
"{",
"changes",
":=",
"make",
"(",
"[",
"]",
"*",
"route53",
".",
"Change",
",",
"0",
",",
"len",
"(",
"endpoints",
")",
")",
"\n\n",
"for",
"_",
",",
"endpoint",
":=",
"range",
"endpoints",
"{",
"changes",
"=",
"<mask>",
"(",
"changes",
",",
"p",
".",
"newChange",
"(",
"action",
",",
"endpoint",
",",
"recordsCache",
",",
"zones",
")",
")",
"\n",
"}",
"\n\n",
"return",
"changes",
"\n",
"}"
] |
8,928 | all-8929 | [
"Valid",
"determines",
"if",
"the",
"provided",
"when",
"time",
"is",
"within",
"the",
"GTLDPeriod",
"for",
"the",
"gTLD",
".",
"E",
".",
"g",
".",
"whether",
"a",
"certificate",
"issued",
"at",
"when",
"with",
"a",
"subject",
"identifier",
"using",
"the",
"specified",
"gTLD",
"can",
"be",
"considered",
"a",
"valid",
"use",
"of",
"the",
"gTLD",
"."
] | [
"func",
"(",
"p",
"GTLDPeriod",
")",
"Valid",
"(",
"when",
"time",
".",
"Time",
")",
"error",
"{",
"// NOTE: We can throw away the errors from time.Parse in this function because",
"// the zlint-gtld-update command only writes entries to the generated gTLD map",
"// after the dates have been verified as parseable",
"notBefore",
",",
"_",
":=",
"<mask>",
".",
"Parse",
"(",
"GTLDPeriodDateFormat",
",",
"p",
".",
"DelegationDate",
")",
"\n",
"if",
"when",
".",
"Before",
"(",
"notBefore",
")",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"`gTLD \".%s\" is not valid until %s`",
",",
"p",
".",
"GTLD",
",",
"p",
".",
"DelegationDate",
")",
"\n",
"}",
"\n",
"// The removal date may be empty. We only need to check `when` against the",
"// removal when it isn't empty",
"if",
"p",
".",
"RemovalDate",
"!=",
"\"",
"\"",
"{",
"notAfter",
",",
"_",
":=",
"time",
".",
"Parse",
"(",
"GTLDPeriodDateFormat",
",",
"p",
".",
"RemovalDate",
")",
"\n",
"if",
"when",
".",
"After",
"(",
"notAfter",
")",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"`gTLD \".%s\" is not valid after %s`",
",",
"p",
".",
"GTLD",
",",
"p",
".",
"RemovalDate",
")",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
] |
8,929 | all-8930 | [
"Write",
"writes",
"the",
"next",
"merge",
"node",
"."
] | [
"func",
"(",
"w",
"*",
"Writer",
")",
"Write",
"(",
"n",
"*",
"MergeNode",
")",
"error",
"{",
"// Marshal node if it was merged",
"if",
"n",
".",
"nodeProto",
"!=",
"nil",
"{",
"<mask>",
"err",
"error",
"\n",
"n",
".",
"v",
",",
"err",
"=",
"n",
".",
"nodeProto",
".",
"Marshal",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"}",
"\n",
"// Get size info from root node",
"if",
"bytes",
".",
"Equal",
"(",
"n",
".",
"k",
",",
"nullByte",
")",
"{",
"if",
"n",
".",
"nodeProto",
"==",
"nil",
"{",
"n",
".",
"nodeProto",
"=",
"&",
"NodeProto",
"{",
"}",
"\n",
"if",
"err",
":=",
"n",
".",
"nodeProto",
".",
"Unmarshal",
"(",
"n",
".",
"v",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"}",
"\n",
"w",
".",
"size",
"=",
"uint64",
"(",
"n",
".",
"nodeProto",
".",
"SubtreeSize",
")",
"\n",
"}",
"\n",
"// Write index for every index size bytes",
"if",
"w",
".",
"offset",
">",
"uint64",
"(",
"len",
"(",
"w",
".",
"idxs",
")",
"+",
"1",
")",
"*",
"IndexSize",
"{",
"w",
".",
"idxs",
"=",
"append",
"(",
"w",
".",
"idxs",
",",
"&",
"Index",
"{",
"K",
":",
"n",
".",
"k",
",",
"Offset",
":",
"w",
".",
"offset",
",",
"}",
")",
"\n",
"}",
"\n",
"b",
",",
"err",
":=",
"w",
".",
"pbw",
".",
"WriteBytes",
"(",
"n",
".",
"k",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"w",
".",
"offset",
"+=",
"uint64",
"(",
"b",
")",
"\n",
"b",
",",
"err",
"=",
"w",
".",
"pbw",
".",
"WriteBytes",
"(",
"n",
".",
"v",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"w",
".",
"offset",
"+=",
"uint64",
"(",
"b",
")",
"\n",
"return",
"nil",
"\n",
"}"
] |
8,930 | all-8931 | [
"GetTitleTextOk",
"returns",
"a",
"tuple",
"with",
"the",
"TitleText",
"field",
"if",
"it",
"s",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"and",
"a",
"boolean",
"to",
"check",
"if",
"the",
"value",
"has",
"been",
"set",
"."
] | [
"func",
"(",
"w",
"*",
"Widget",
")",
"GetTitleTextOk",
"(",
")",
"(",
"string",
",",
"bool",
")",
"{",
"if",
"w",
"==",
"nil",
"||",
"w",
".",
"TitleText",
"==",
"nil",
"{",
"return",
"\"",
"\"",
",",
"false",
"\n",
"}",
"\n",
"return",
"*",
"w",
".",
"TitleText",
",",
"<mask>",
"\n",
"}"
] |
8,931 | all-8932 | [
"GetProjectColumns",
"returns",
"the",
"list",
"of",
"columns",
"in",
"a",
"project",
".",
"See",
"https",
":",
"//",
"developer",
".",
"github",
".",
"com",
"/",
"v3",
"/",
"projects",
"/",
"columns",
"/",
"#list",
"-",
"project",
"-",
"columns"
] | [
"func",
"(",
"c",
"*",
"Client",
")",
"GetProjectColumns",
"(",
"projectID",
"int",
")",
"(",
"[",
"]",
"ProjectColumn",
",",
"error",
")",
"{",
"c",
".",
"log",
"(",
"\"",
"\"",
",",
"projectID",
")",
"\n",
"path",
":=",
"(",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"projectID",
")",
")",
"\n",
"var",
"projectColumns",
"[",
"]",
"ProjectColumn",
"\n",
"err",
":=",
"c",
".",
"readPaginatedResults",
"(",
"path",
",",
"\"",
"\"",
",",
"func",
"(",
")",
"interface",
"{",
"}",
"{",
"return",
"&",
"[",
"]",
"ProjectColumn",
"{",
"}",
"\n",
"}",
",",
"func",
"(",
"obj",
"<mask>",
"{",
"}",
")",
"{",
"projectColumns",
"=",
"append",
"(",
"projectColumns",
",",
"*",
"(",
"obj",
".",
"(",
"*",
"[",
"]",
"ProjectColumn",
")",
")",
"...",
")",
"\n",
"}",
",",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"return",
"projectColumns",
",",
"nil",
"\n",
"}"
] |
8,932 | all-8933 | [
"New",
"returns",
"the",
"interface",
"to",
"handle",
"the",
"package",
"manager",
"."
] | [
"func",
"New",
"(",
"pkg",
"PackageType",
")",
"Packager",
"{",
"switch",
"pkg",
"{",
"case",
"Deb",
":",
"return",
"new",
"(",
"deb",
")",
"\n",
"case",
"RPM",
":",
"return",
"new",
"(",
"rpm",
")",
"\n",
"case",
"Pacman",
":",
"return",
"new",
"(",
"pacman",
")",
"\n",
"case",
"Ebuild",
":",
"return",
"<mask>",
"(",
"ebuild",
")",
"\n",
"case",
"ZYpp",
":",
"return",
"new",
"(",
"zypp",
")",
"\n",
"}",
"\n",
"panic",
"(",
"\"",
"\"",
")",
"\n",
"}"
] |
8,933 | all-8934 | [
"HasMustShowLatency",
"returns",
"a",
"boolean",
"if",
"a",
"field",
"has",
"been",
"set",
"."
] | [
"func",
"(",
"w",
"*",
"Widget",
")",
"HasMustShowLatency",
"(",
")",
"bool",
"{",
"if",
"w",
"!=",
"nil",
"&&",
"w",
".",
"MustShowLatency",
"!=",
"nil",
"{",
"return",
"true",
"\n",
"}",
"\n\n",
"return",
"<mask>",
"\n",
"}"
] |
8,934 | all-8935 | [
"Specify",
"the",
"value",
"of",
"a",
"uniform",
"variable",
"for",
"a",
"specified",
"program",
"object"
] | [
"func",
"ProgramUniformMatrix3x2fv",
"(",
"program",
"uint32",
",",
"<mask>",
"int32",
",",
"count",
"int32",
",",
"transpose",
"bool",
",",
"value",
"*",
"float32",
")",
"{",
"C",
".",
"glowProgramUniformMatrix3x2fv",
"(",
"gpProgramUniformMatrix3x2fv",
",",
"(",
"C",
".",
"GLuint",
")",
"(",
"program",
")",
",",
"(",
"C",
".",
"GLint",
")",
"(",
"location",
")",
",",
"(",
"C",
".",
"GLsizei",
")",
"(",
"count",
")",
",",
"(",
"C",
".",
"GLboolean",
")",
"(",
"boolToInt",
"(",
"transpose",
")",
")",
",",
"(",
"*",
"C",
".",
"GLfloat",
")",
"(",
"unsafe",
".",
"Pointer",
"(",
"value",
")",
")",
")",
"\n",
"}"
] |
8,935 | all-8936 | [
"NewHTTPClient",
"creates",
"a",
"new",
"soft",
"layer",
"VM",
"pool",
"HTTP",
"client",
"."
] | [
"func",
"NewHTTPClient",
"(",
"formats",
"strfmt",
".",
"Registry",
")",
"*",
"SoftLayerVMPool",
"{",
"if",
"formats",
"==",
"nil",
"{",
"formats",
"=",
"strfmt",
".",
"<mask>",
"\n",
"}",
"\n",
"transport",
":=",
"httptransport",
".",
"New",
"(",
"\"",
"\"",
",",
"\"",
"\"",
",",
"[",
"]",
"string",
"{",
"\"",
"\"",
"}",
")",
"\n",
"return",
"New",
"(",
"transport",
",",
"formats",
")",
"\n",
"}"
] |
8,936 | all-8937 | [
"GetAccountMergeResult",
"retrieves",
"the",
"AccountMergeResult",
"value",
"from",
"the",
"union",
"returning",
"ok",
"if",
"the",
"union",
"s",
"switch",
"indicated",
"the",
"value",
"is",
"valid",
"."
] | [
"func",
"(",
"u",
"OperationResultTr",
")",
"GetAccountMergeResult",
"(",
")",
"(",
"result",
"AccountMergeResult",
",",
"<mask>",
"bool",
")",
"{",
"armName",
",",
"_",
":=",
"u",
".",
"ArmForSwitch",
"(",
"int32",
"(",
"u",
".",
"Type",
")",
")",
"\n\n",
"if",
"armName",
"==",
"\"",
"\"",
"{",
"result",
"=",
"*",
"u",
".",
"AccountMergeResult",
"\n",
"ok",
"=",
"true",
"\n",
"}",
"\n\n",
"return",
"\n",
"}"
] |
8,937 | all-8938 | [
"CheckCmd",
"returns",
"a",
"cobra",
"command",
"that",
"sends",
"an",
"Authorize",
"RPC",
"to",
"Pachd",
"to",
"determine",
"whether",
"the",
"specified",
"user",
"has",
"access",
"to",
"the",
"specified",
"repo",
"."
] | [
"func",
"CheckCmd",
"(",
"noMetrics",
",",
"noPortForwarding",
"*",
"bool",
")",
"*",
"cobra",
".",
"Command",
"{",
"check",
":=",
"&",
"cobra",
".",
"Command",
"{",
"Use",
":",
"\"",
"\"",
",",
"Short",
":",
"\"",
"\"",
",",
"Long",
":",
"\"",
"\"",
"+",
"\"",
"\\\"",
"\\\"",
"\"",
"+",
"\"",
"\\\"",
"\\\"",
"\"",
"+",
"\"",
"\\\"",
"\\\"",
"\"",
"+",
"\"",
"\"",
"+",
"\"",
"\"",
",",
"Run",
":",
"cmdutil",
".",
"RunFixedArgs",
"(",
"2",
",",
"func",
"(",
"args",
"[",
"]",
"string",
")",
"error",
"{",
"<mask>",
",",
"err",
":=",
"auth",
".",
"ParseScope",
"(",
"args",
"[",
"0",
"]",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"repo",
":=",
"args",
"[",
"1",
"]",
"\n",
"c",
",",
"err",
":=",
"client",
".",
"NewOnUserMachine",
"(",
"!",
"*",
"noMetrics",
",",
"!",
"*",
"noPortForwarding",
",",
"\"",
"\"",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"}",
"\n",
"defer",
"c",
".",
"Close",
"(",
")",
"\n",
"resp",
",",
"err",
":=",
"c",
".",
"Authorize",
"(",
"c",
".",
"Ctx",
"(",
")",
",",
"&",
"auth",
".",
"AuthorizeRequest",
"{",
"Repo",
":",
"repo",
",",
"Scope",
":",
"scope",
",",
"}",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"grpcutil",
".",
"ScrubGRPC",
"(",
"err",
")",
"\n",
"}",
"\n",
"fmt",
".",
"Printf",
"(",
"\"",
"\\n",
"\"",
",",
"resp",
".",
"Authorized",
")",
"\n",
"return",
"nil",
"\n",
"}",
")",
",",
"}",
"\n",
"return",
"cmdutil",
".",
"CreateAlias",
"(",
"check",
",",
"\"",
"\"",
")",
"\n",
"}"
] |
8,938 | all-8939 | [
"MarshalJSON",
"supports",
"json",
".",
"Marshaler",
"interface"
] | [
"func",
"(",
"v",
"GetPropertiesReturns",
")",
"MarshalJSON",
"(",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"w",
":=",
"jwriter",
".",
"Writer",
"{",
"}",
"\n",
"easyjsonC5a4559bEncodeGithubComChromedpCdprotoRuntime21",
"(",
"&",
"w",
",",
"v",
")",
"\n",
"return",
"w",
".",
"<mask>",
".",
"BuildBytes",
"(",
")",
",",
"w",
".",
"Error",
"\n",
"}"
] |
8,939 | all-8940 | [
"StartContainers",
"starts",
"containers",
"created",
"by",
"the",
"benchmark",
"."
] | [
"func",
"StartContainers",
"(",
"c",
"lxd",
".",
"ContainerServer",
",",
"containers",
"[",
"]",
"api",
".",
"Container",
",",
"parallel",
"int",
")",
"(",
"time",
".",
"Duration",
",",
"error",
")",
"{",
"var",
"duration",
"time",
".",
"Duration",
"\n\n",
"batchSize",
",",
"err",
":=",
"getBatchSize",
"(",
"parallel",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"duration",
",",
"err",
"\n",
"}",
"\n\n",
"count",
":=",
"len",
"(",
"containers",
")",
"\n",
"logf",
"(",
"\"",
"\"",
",",
"count",
")",
"\n\n",
"batchStart",
":=",
"func",
"(",
"index",
"int",
",",
"wg",
"*",
"<mask>",
".",
"WaitGroup",
")",
"{",
"defer",
"wg",
".",
"Done",
"(",
")",
"\n\n",
"container",
":=",
"containers",
"[",
"index",
"]",
"\n",
"if",
"!",
"container",
".",
"IsActive",
"(",
")",
"{",
"err",
":=",
"startContainer",
"(",
"c",
",",
"container",
".",
"Name",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"logf",
"(",
"\"",
"\"",
",",
"container",
".",
"Name",
",",
"err",
")",
"\n",
"return",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n\n",
"duration",
"=",
"processBatch",
"(",
"count",
",",
"batchSize",
",",
"batchStart",
")",
"\n",
"return",
"duration",
",",
"nil",
"\n",
"}"
] |
8,940 | all-8941 | [
"JUnitReportXML",
"writes",
"a",
"JUnit",
"xml",
"representation",
"of",
"the",
"given",
"report",
"to",
"w",
"in",
"the",
"format",
"described",
"at",
"http",
":",
"//",
"windyroad",
".",
"org",
"/",
"dl",
"/",
"Open%20Source",
"/",
"JUnit",
".",
"xsd"
] | [
"func",
"JUnitReportXML",
"(",
"report",
"*",
"parser",
".",
"Report",
",",
"noXMLHeader",
"bool",
",",
"goVersion",
"string",
",",
"w",
"io",
".",
"Writer",
")",
"error",
"{",
"suites",
":=",
"JUnitTestSuites",
"{",
"}",
"\n\n",
"// convert Report to JUnit test suites",
"for",
"_",
",",
"pkg",
":=",
"range",
"report",
".",
"Packages",
"{",
"pkg",
".",
"Benchmarks",
"=",
"mergeBenchmarks",
"(",
"pkg",
".",
"Benchmarks",
")",
"\n",
"ts",
":=",
"JUnitTestSuite",
"{",
"Tests",
":",
"len",
"(",
"pkg",
".",
"Tests",
")",
"+",
"len",
"(",
"pkg",
".",
"Benchmarks",
")",
",",
"Failures",
":",
"0",
",",
"Time",
":",
"formatTime",
"(",
"pkg",
".",
"Duration",
")",
",",
"<mask>",
":",
"pkg",
".",
"Name",
",",
"Properties",
":",
"[",
"]",
"JUnitProperty",
"{",
"}",
",",
"TestCases",
":",
"[",
"]",
"JUnitTestCase",
"{",
"}",
",",
"}",
"\n\n",
"classname",
":=",
"pkg",
".",
"Name",
"\n",
"if",
"idx",
":=",
"strings",
".",
"LastIndex",
"(",
"classname",
",",
"\"",
"\"",
")",
";",
"idx",
">",
"-",
"1",
"&&",
"idx",
"<",
"len",
"(",
"pkg",
".",
"Name",
")",
"{",
"classname",
"=",
"pkg",
".",
"Name",
"[",
"idx",
"+",
"1",
":",
"]",
"\n",
"}",
"\n\n",
"// properties",
"if",
"goVersion",
"==",
"\"",
"\"",
"{",
"// if goVersion was not specified as a flag, fall back to version reported by runtime",
"goVersion",
"=",
"runtime",
".",
"Version",
"(",
")",
"\n",
"}",
"\n",
"ts",
".",
"Properties",
"=",
"append",
"(",
"ts",
".",
"Properties",
",",
"JUnitProperty",
"{",
"\"",
"\"",
",",
"goVersion",
"}",
")",
"\n",
"if",
"pkg",
".",
"CoveragePct",
"!=",
"\"",
"\"",
"{",
"ts",
".",
"Properties",
"=",
"append",
"(",
"ts",
".",
"Properties",
",",
"JUnitProperty",
"{",
"\"",
"\"",
",",
"pkg",
".",
"CoveragePct",
"}",
")",
"\n",
"}",
"\n\n",
"// individual test cases",
"for",
"_",
",",
"test",
":=",
"range",
"pkg",
".",
"Tests",
"{",
"testCase",
":=",
"JUnitTestCase",
"{",
"Classname",
":",
"classname",
",",
"Name",
":",
"test",
".",
"Name",
",",
"Time",
":",
"formatTime",
"(",
"test",
".",
"Duration",
")",
",",
"Failure",
":",
"nil",
",",
"}",
"\n\n",
"if",
"test",
".",
"Result",
"==",
"parser",
".",
"FAIL",
"{",
"ts",
".",
"Failures",
"++",
"\n",
"testCase",
".",
"Failure",
"=",
"&",
"JUnitFailure",
"{",
"Message",
":",
"\"",
"\"",
",",
"Type",
":",
"\"",
"\"",
",",
"Contents",
":",
"strings",
".",
"Join",
"(",
"test",
".",
"Output",
",",
"\"",
"\\n",
"\"",
")",
",",
"}",
"\n",
"}",
"\n\n",
"if",
"test",
".",
"Result",
"==",
"parser",
".",
"SKIP",
"{",
"testCase",
".",
"SkipMessage",
"=",
"&",
"JUnitSkipMessage",
"{",
"strings",
".",
"Join",
"(",
"test",
".",
"Output",
",",
"\"",
"\\n",
"\"",
")",
"}",
"\n",
"}",
"\n\n",
"ts",
".",
"TestCases",
"=",
"append",
"(",
"ts",
".",
"TestCases",
",",
"testCase",
")",
"\n",
"}",
"\n\n",
"// individual benchmarks",
"for",
"_",
",",
"benchmark",
":=",
"range",
"pkg",
".",
"Benchmarks",
"{",
"benchmarkCase",
":=",
"JUnitTestCase",
"{",
"Classname",
":",
"classname",
",",
"Name",
":",
"benchmark",
".",
"Name",
",",
"Time",
":",
"formatBenchmarkTime",
"(",
"benchmark",
".",
"Duration",
")",
",",
"}",
"\n\n",
"ts",
".",
"TestCases",
"=",
"append",
"(",
"ts",
".",
"TestCases",
",",
"benchmarkCase",
")",
"\n",
"}",
"\n\n",
"suites",
".",
"Suites",
"=",
"append",
"(",
"suites",
".",
"Suites",
",",
"ts",
")",
"\n",
"}",
"\n\n",
"// to xml",
"bytes",
",",
"err",
":=",
"xml",
".",
"MarshalIndent",
"(",
"suites",
",",
"\"",
"\"",
",",
"\"",
"\\t",
"\"",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"writer",
":=",
"bufio",
".",
"NewWriter",
"(",
"w",
")",
"\n\n",
"if",
"!",
"noXMLHeader",
"{",
"writer",
".",
"WriteString",
"(",
"xml",
".",
"Header",
")",
"\n",
"}",
"\n\n",
"writer",
".",
"Write",
"(",
"bytes",
")",
"\n",
"writer",
".",
"WriteByte",
"(",
"'\\n'",
")",
"\n",
"writer",
".",
"Flush",
"(",
")",
"\n\n",
"return",
"nil",
"\n",
"}"
] |
8,941 | all-8942 | [
"GetStacked",
"returns",
"the",
"Stacked",
"field",
"if",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"."
] | [
"func",
"(",
"g",
"*",
"GraphDefinitionRequest",
")",
"GetStacked",
"(",
")",
"bool",
"{",
"if",
"g",
"==",
"nil",
"||",
"g",
".",
"Stacked",
"==",
"nil",
"{",
"return",
"<mask>",
"\n",
"}",
"\n",
"return",
"*",
"g",
".",
"Stacked",
"\n",
"}"
] |
8,942 | all-8943 | [
"GetPageType",
"is",
"a",
"wrapper",
"around",
"gtk_assistant_get_page_type",
"()",
"."
] | [
"func",
"(",
"v",
"*",
"Assistant",
")",
"GetPageType",
"(",
"<mask>",
"IWidget",
")",
"AssistantPageType",
"{",
"c",
":=",
"C",
".",
"gtk_assistant_get_page_type",
"(",
"v",
".",
"native",
"(",
")",
",",
"page",
".",
"toWidget",
"(",
")",
")",
"\n",
"return",
"AssistantPageType",
"(",
"c",
")",
"\n",
"}"
] |
8,943 | all-8944 | [
"Zones",
"returns",
"the",
"list",
"of",
"hosted",
"zones",
"."
] | [
"func",
"(",
"p",
"*",
"CloudFlareProvider",
")",
"Zones",
"(",
")",
"(",
"[",
"]",
"cloudflare",
".",
"Zone",
",",
"error",
")",
"{",
"result",
":=",
"[",
"]",
"cloudflare",
".",
"Zone",
"{",
"}",
"\n",
"ctx",
":=",
"context",
".",
"TODO",
"(",
")",
"\n",
"p",
".",
"PaginationOptions",
".",
"Page",
"=",
"1",
"\n\n",
"for",
"{",
"zonesResponse",
",",
"err",
":=",
"p",
".",
"Client",
".",
"ListZonesContext",
"(",
"ctx",
",",
"cloudflare",
".",
"WithPagination",
"(",
"p",
".",
"PaginationOptions",
")",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"for",
"_",
",",
"zone",
":=",
"range",
"zonesResponse",
".",
"Result",
"{",
"if",
"!",
"p",
".",
"domainFilter",
".",
"Match",
"(",
"zone",
".",
"Name",
")",
"{",
"continue",
"\n",
"}",
"\n\n",
"if",
"!",
"p",
".",
"zoneIDFilter",
".",
"Match",
"(",
"zone",
".",
"ID",
")",
"{",
"<mask>",
"\n",
"}",
"\n",
"result",
"=",
"append",
"(",
"result",
",",
"zone",
")",
"\n",
"}",
"\n",
"if",
"p",
".",
"PaginationOptions",
".",
"Page",
"==",
"zonesResponse",
".",
"ResultInfo",
".",
"TotalPages",
"{",
"break",
"\n",
"}",
"\n",
"p",
".",
"PaginationOptions",
".",
"Page",
"++",
"\n",
"}",
"\n",
"return",
"result",
",",
"nil",
"\n",
"}"
] |
8,944 | all-8945 | [
"UnmarshalJSON",
"supports",
"json",
".",
"Unmarshaler",
"interface"
] | [
"func",
"(",
"v",
"*",
"CreateBrowserContextReturns",
")",
"UnmarshalJSON",
"(",
"data",
"[",
"]",
"byte",
")",
"error",
"{",
"r",
":=",
"jlexer",
".",
"Lexer",
"{",
"Data",
":",
"<mask>",
"}",
"\n",
"easyjsonC5a4559bDecodeGithubComChromedpCdprotoTarget24",
"(",
"&",
"r",
",",
"v",
")",
"\n",
"return",
"r",
".",
"Error",
"(",
")",
"\n",
"}"
] |
8,945 | all-8946 | [
"NewValue",
"builds",
"a",
"Value",
"using",
"typ",
"and",
"val",
".",
"If",
"the",
"value",
"and",
"typ",
"don",
"t",
"match",
"it",
"returns",
"an",
"error",
"."
] | [
"func",
"NewValue",
"(",
"typ",
"querypb",
".",
"Type",
",",
"val",
"[",
"]",
"byte",
")",
"(",
"v",
"<mask>",
",",
"err",
"error",
")",
"{",
"switch",
"{",
"case",
"IsSigned",
"(",
"typ",
")",
":",
"if",
"_",
",",
"err",
":=",
"strconv",
".",
"ParseInt",
"(",
"string",
"(",
"val",
")",
",",
"0",
",",
"64",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"NULL",
",",
"err",
"\n",
"}",
"\n",
"return",
"MakeTrusted",
"(",
"typ",
",",
"val",
")",
",",
"nil",
"\n",
"case",
"IsUnsigned",
"(",
"typ",
")",
":",
"if",
"_",
",",
"err",
":=",
"strconv",
".",
"ParseUint",
"(",
"string",
"(",
"val",
")",
",",
"0",
",",
"64",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"NULL",
",",
"err",
"\n",
"}",
"\n",
"return",
"MakeTrusted",
"(",
"typ",
",",
"val",
")",
",",
"nil",
"\n",
"case",
"IsFloat",
"(",
"typ",
")",
"||",
"typ",
"==",
"Decimal",
":",
"if",
"_",
",",
"err",
":=",
"strconv",
".",
"ParseFloat",
"(",
"string",
"(",
"val",
")",
",",
"64",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"NULL",
",",
"err",
"\n",
"}",
"\n",
"return",
"MakeTrusted",
"(",
"typ",
",",
"val",
")",
",",
"nil",
"\n",
"case",
"IsQuoted",
"(",
"typ",
")",
"||",
"typ",
"==",
"Null",
":",
"return",
"MakeTrusted",
"(",
"typ",
",",
"val",
")",
",",
"nil",
"\n",
"}",
"\n",
"// All other types are unsafe or invalid.",
"return",
"NULL",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"typ",
")",
"\n",
"}"
] |
8,946 | all-8947 | [
"readVarint",
"reads",
"a",
"varint",
"from",
"the",
"core",
"file",
".",
"val",
"is",
"the",
"value",
"n",
"is",
"the",
"number",
"of",
"bytes",
"consumed",
"."
] | [
"func",
"readVarint",
"(",
"core",
"*",
"core",
".",
"<mask>",
",",
"a",
"core",
".",
"Address",
")",
"(",
"val",
",",
"n",
"int64",
")",
"{",
"for",
"{",
"b",
":=",
"core",
".",
"ReadUint8",
"(",
"a",
")",
"\n",
"val",
"|=",
"int64",
"(",
"b",
"&",
"0x7f",
")",
"<<",
"uint",
"(",
"n",
"*",
"7",
")",
"\n",
"n",
"++",
"\n",
"a",
"++",
"\n",
"if",
"b",
"&",
"0x80",
"==",
"0",
"{",
"return",
"\n",
"}",
"\n",
"}",
"\n",
"}"
] |
8,947 | all-8948 | [
"upgradeDVS",
"upgrades",
"a",
"DVS",
"to",
"a",
"specific",
"version",
".",
"Downgrades",
"are",
"not",
"supported",
"and",
"will",
"result",
"in",
"an",
"error",
".",
"This",
"should",
"be",
"checked",
"before",
"running",
"this",
"function",
"."
] | [
"func",
"upgradeDVS",
"(",
"client",
"*",
"govmomi",
".",
"Client",
",",
"dvs",
"*",
"object",
".",
"VmwareDistributedVirtualSwitch",
",",
"version",
"string",
")",
"error",
"{",
"req",
":=",
"&",
"types",
".",
"PerformDvsProductSpecOperation_Task",
"{",
"This",
":",
"dvs",
".",
"Reference",
"(",
")",
",",
"Operation",
":",
"\"",
"\"",
",",
"ProductSpec",
":",
"&",
"types",
".",
"DistributedVirtualSwitchProductSpec",
"{",
"Version",
":",
"version",
",",
"}",
",",
"}",
"\n\n",
"ctx",
",",
"cancel",
":=",
"context",
".",
"WithTimeout",
"(",
"context",
".",
"Background",
"(",
")",
",",
"defaultAPITimeout",
")",
"\n",
"defer",
"cancel",
"(",
")",
"\n",
"resp",
",",
"err",
":=",
"methods",
".",
"PerformDvsProductSpecOperation_Task",
"(",
"ctx",
",",
"<mask>",
",",
"req",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"task",
":=",
"object",
".",
"NewTask",
"(",
"client",
".",
"Client",
",",
"resp",
".",
"Returnval",
")",
"\n",
"tctx",
",",
"tcancel",
":=",
"context",
".",
"WithTimeout",
"(",
"context",
".",
"Background",
"(",
")",
",",
"defaultAPITimeout",
")",
"\n",
"defer",
"tcancel",
"(",
")",
"\n",
"if",
"err",
":=",
"task",
".",
"Wait",
"(",
"tctx",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"return",
"nil",
"\n",
"}"
] |
8,948 | all-8949 | [
"ConfirmPopup",
"confirms",
"an",
"alert",
"confirm",
"or",
"prompt",
"popup",
"."
] | [
"func",
"(",
"p",
"*",
"Page",
")",
"ConfirmPopup",
"(",
")",
"error",
"{",
"if",
"err",
":=",
"p",
".",
"<mask>",
".",
"AcceptAlert",
"(",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
] |
8,949 | all-8950 | [
"creates",
"and",
"initializes",
"a",
"buffer",
"object",
"s",
"data",
"store"
] | [
"func",
"NamedBufferData",
"(",
"buffer",
"uint32",
",",
"size",
"int",
",",
"<mask>",
"unsafe",
".",
"Pointer",
",",
"usage",
"uint32",
")",
"{",
"C",
".",
"glowNamedBufferData",
"(",
"gpNamedBufferData",
",",
"(",
"C",
".",
"GLuint",
")",
"(",
"buffer",
")",
",",
"(",
"C",
".",
"GLsizeiptr",
")",
"(",
"size",
")",
",",
"data",
",",
"(",
"C",
".",
"GLenum",
")",
"(",
"usage",
")",
")",
"\n",
"}"
] |
8,950 | all-8951 | [
"This",
"task",
"function",
"expires",
"logs",
"when",
"executed",
".",
"It",
"s",
"started",
"by",
"the",
"Daemon",
"and",
"will",
"run",
"once",
"every",
"24h",
"."
] | [
"func",
"expireLogsTask",
"(",
"state",
"*",
"state",
".",
"State",
")",
"(",
"task",
".",
"Func",
",",
"task",
".",
"Schedule",
")",
"{",
"f",
":=",
"func",
"(",
"ctx",
"context",
".",
"Context",
")",
"{",
"opRun",
":=",
"func",
"(",
"op",
"*",
"<mask>",
")",
"error",
"{",
"return",
"expireLogs",
"(",
"ctx",
",",
"state",
")",
"\n",
"}",
"\n\n",
"op",
",",
"err",
":=",
"operationCreate",
"(",
"state",
".",
"Cluster",
",",
"\"",
"\"",
",",
"operationClassTask",
",",
"db",
".",
"OperationLogsExpire",
",",
"nil",
",",
"nil",
",",
"opRun",
",",
"nil",
",",
"nil",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"logger",
".",
"Error",
"(",
"\"",
"\"",
",",
"log",
".",
"Ctx",
"{",
"\"",
"\"",
":",
"err",
"}",
")",
"\n",
"return",
"\n",
"}",
"\n\n",
"logger",
".",
"Infof",
"(",
"\"",
"\"",
")",
"\n",
"_",
",",
"err",
"=",
"op",
".",
"Run",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"logger",
".",
"Error",
"(",
"\"",
"\"",
",",
"log",
".",
"Ctx",
"{",
"\"",
"\"",
":",
"err",
"}",
")",
"\n",
"}",
"\n",
"logger",
".",
"Infof",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"return",
"f",
",",
"task",
".",
"Daily",
"(",
")",
"\n",
"}"
] |
8,951 | all-8952 | [
"Send",
"sends",
"emails",
"using",
"the",
"given",
"Sender",
"."
] | [
"func",
"Send",
"(",
"s",
"Sender",
",",
"msg",
"...",
"*",
"Message",
")",
"error",
"{",
"for",
"i",
",",
"m",
":=",
"range",
"msg",
"{",
"if",
"err",
":=",
"<mask>",
"(",
"s",
",",
"m",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"&",
"SendError",
"{",
"Cause",
":",
"err",
",",
"Index",
":",
"uint",
"(",
"i",
")",
"}",
"\n",
"}",
"\n",
"}",
"\n\n",
"return",
"nil",
"\n",
"}"
] |
8,952 | all-8953 | [
"Parse",
"a",
"size",
"string",
"in",
"bytes",
"(",
"e",
".",
"g",
".",
"200kB",
"or",
"5GB",
")",
"into",
"the",
"number",
"of",
"bytes",
"it",
"represents",
".",
"Supports",
"suffixes",
"up",
"to",
"EB",
".",
"==",
"0",
"."
] | [
"func",
"ParseByteSizeString",
"(",
"input",
"string",
")",
"(",
"int64",
",",
"error",
")",
"{",
"// Empty input",
"if",
"input",
"==",
"\"",
"\"",
"{",
"return",
"0",
",",
"nil",
"\n",
"}",
"\n\n",
"// Find where the suffix begins",
"suffixLen",
":=",
"0",
"\n",
"for",
"i",
",",
"chr",
":=",
"range",
"[",
"]",
"byte",
"(",
"<mask>",
")",
"{",
"_",
",",
"err",
":=",
"strconv",
".",
"Atoi",
"(",
"string",
"(",
"[",
"]",
"byte",
"{",
"chr",
"}",
")",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"suffixLen",
"=",
"len",
"(",
"input",
")",
"-",
"i",
"\n",
"break",
"\n",
"}",
"\n",
"}",
"\n\n",
"if",
"suffixLen",
"==",
"len",
"(",
"input",
")",
"{",
"return",
"-",
"1",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"input",
")",
"\n",
"}",
"\n\n",
"// Extract the suffix",
"suffix",
":=",
"input",
"[",
"len",
"(",
"input",
")",
"-",
"suffixLen",
":",
"]",
"\n\n",
"// Extract the value",
"value",
":=",
"input",
"[",
"0",
":",
"len",
"(",
"input",
")",
"-",
"suffixLen",
"]",
"\n",
"valueInt",
",",
"err",
":=",
"strconv",
".",
"ParseInt",
"(",
"value",
",",
"10",
",",
"64",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"-",
"1",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"input",
")",
"\n",
"}",
"\n\n",
"// Figure out the multiplicator",
"multiplicator",
":=",
"int64",
"(",
"0",
")",
"\n",
"switch",
"suffix",
"{",
"case",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
":",
"multiplicator",
"=",
"1",
"\n",
"case",
"\"",
"\"",
":",
"multiplicator",
"=",
"1000",
"\n",
"case",
"\"",
"\"",
":",
"multiplicator",
"=",
"1000",
"*",
"1000",
"\n",
"case",
"\"",
"\"",
":",
"multiplicator",
"=",
"1000",
"*",
"1000",
"*",
"1000",
"\n",
"case",
"\"",
"\"",
":",
"multiplicator",
"=",
"1000",
"*",
"1000",
"*",
"1000",
"*",
"1000",
"\n",
"case",
"\"",
"\"",
":",
"multiplicator",
"=",
"1000",
"*",
"1000",
"*",
"1000",
"*",
"1000",
"*",
"1000",
"\n",
"case",
"\"",
"\"",
":",
"multiplicator",
"=",
"1000",
"*",
"1000",
"*",
"1000",
"*",
"1000",
"*",
"1000",
"*",
"1000",
"\n",
"case",
"\"",
"\"",
":",
"multiplicator",
"=",
"1024",
"\n",
"case",
"\"",
"\"",
":",
"multiplicator",
"=",
"1024",
"*",
"1024",
"\n",
"case",
"\"",
"\"",
":",
"multiplicator",
"=",
"1024",
"*",
"1024",
"*",
"1024",
"\n",
"case",
"\"",
"\"",
":",
"multiplicator",
"=",
"1024",
"*",
"1024",
"*",
"1024",
"*",
"1024",
"\n",
"case",
"\"",
"\"",
":",
"multiplicator",
"=",
"1024",
"*",
"1024",
"*",
"1024",
"*",
"1024",
"*",
"1024",
"\n",
"case",
"\"",
"\"",
":",
"multiplicator",
"=",
"1024",
"*",
"1024",
"*",
"1024",
"*",
"1024",
"*",
"1024",
"*",
"1024",
"\n",
"default",
":",
"return",
"-",
"1",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"input",
")",
"\n",
"}",
"\n\n",
"return",
"valueInt",
"*",
"multiplicator",
",",
"nil",
"\n",
"}"
] |
8,953 | all-8954 | [
"Stop",
"the",
"WALWatcher",
"."
] | [
"func",
"(",
"w",
"*",
"WALWatcher",
")",
"Stop",
"(",
")",
"{",
"close",
"(",
"w",
".",
"quit",
")",
"\n",
"<-",
"w",
".",
"done",
"\n\n",
"// Records read metric has series and samples.",
"watcherRecordsRead",
".",
"DeleteLabelValues",
"(",
"w",
".",
"name",
",",
"\"",
"\"",
")",
"\n",
"watcherRecordsRead",
".",
"DeleteLabelValues",
"(",
"w",
".",
"<mask>",
",",
"\"",
"\"",
")",
"\n",
"watcherRecordDecodeFails",
".",
"DeleteLabelValues",
"(",
"w",
".",
"name",
")",
"\n",
"watcherSamplesSentPreTailing",
".",
"DeleteLabelValues",
"(",
"w",
".",
"name",
")",
"\n",
"watcherCurrentSegment",
".",
"DeleteLabelValues",
"(",
"w",
".",
"name",
")",
"\n\n",
"level",
".",
"Info",
"(",
"w",
".",
"logger",
")",
".",
"Log",
"(",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"w",
".",
"name",
")",
"\n",
"}"
] |
8,954 | all-8955 | [
"NewUniIterator",
"returns",
"a",
"UniIterator",
"."
] | [
"func",
"(",
"s",
"*",
"Skiplist",
")",
"NewUniIterator",
"(",
"reversed",
"bool",
")",
"*",
"UniIterator",
"{",
"<mask>",
"&",
"UniIterator",
"{",
"iter",
":",
"s",
".",
"NewIterator",
"(",
")",
",",
"reversed",
":",
"reversed",
",",
"}",
"\n",
"}"
] |
8,955 | all-8956 | [
"statement"
] | [
"func",
"(",
"s",
"*",
"stmt",
")",
"QueryContext",
"(",
"ctx",
"context",
".",
"Context",
",",
"args",
"[",
"]",
"driver",
".",
"NamedValue",
")",
"(",
"rows",
"driver",
".",
"Rows",
",",
"err",
"error",
")",
"{",
"if",
"s",
".",
"session",
".",
"IsBad",
"(",
")",
"{",
"return",
"nil",
",",
"driver",
".",
"ErrBadConn",
"\n",
"}",
"\n\n",
"done",
":=",
"make",
"(",
"chan",
"struct",
"{",
"}",
")",
"\n",
"go",
"func",
"(",
")",
"{",
"switch",
"s",
".",
"qt",
"{",
"default",
":",
"rows",
",",
"err",
"=",
"s",
".",
"defaultQuery",
"(",
"ctx",
",",
"args",
")",
"\n",
"case",
"p",
".",
"QtProcedureCall",
":",
"rows",
",",
"err",
"=",
"s",
".",
"procedureCall",
"(",
"ctx",
",",
"args",
")",
"\n",
"}",
"\n",
"close",
"(",
"done",
")",
"\n",
"}",
"(",
")",
"\n\n",
"select",
"{",
"case",
"<-",
"ctx",
".",
"Done",
"(",
")",
":",
"return",
"nil",
",",
"ctx",
".",
"Err",
"(",
")",
"\n",
"<mask>",
"<-",
"done",
":",
"return",
"rows",
",",
"err",
"\n",
"}",
"\n",
"}"
] |
8,956 | all-8957 | [
"String",
"returns",
"a",
"string",
"representation",
"of",
"GeoM",
"."
] | [
"func",
"(",
"g",
"*",
"GeoM",
")",
"<mask>",
"(",
")",
"string",
"{",
"return",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"g",
".",
"a_1",
"+",
"1",
",",
"g",
".",
"b",
",",
"g",
".",
"tx",
",",
"g",
".",
"c",
",",
"g",
".",
"d_1",
"+",
"1",
",",
"g",
".",
"ty",
")",
"\n",
"}"
] |
8,957 | all-8958 | [
"MarshalJSON",
"supports",
"json",
".",
"Marshaler",
"interface"
] | [
"func",
"(",
"v",
"EventDistributedNodesUpdated",
")",
"MarshalJSON",
"(",
")",
"(",
"[",
"]",
"<mask>",
",",
"error",
")",
"{",
"w",
":=",
"jwriter",
".",
"Writer",
"{",
"}",
"\n",
"easyjsonC5a4559bEncodeGithubComChromedpCdprotoDom62",
"(",
"&",
"w",
",",
"v",
")",
"\n",
"return",
"w",
".",
"Buffer",
".",
"BuildBytes",
"(",
")",
",",
"w",
".",
"Error",
"\n",
"}"
] |
8,958 | all-8959 | [
"UnmarshalJSON",
"supports",
"json",
".",
"Unmarshaler",
"interface"
] | [
"func",
"(",
"v",
"*",
"RequestMemoryDumpParams",
")",
"UnmarshalJSON",
"(",
"data",
"[",
"]",
"byte",
")",
"error",
"{",
"r",
":=",
"jlexer",
".",
"Lexer",
"{",
"Data",
":",
"data",
"}",
"\n",
"easyjsonC5a4559bDecodeGithubComChromedpCdprotoTracing3",
"(",
"&",
"r",
",",
"v",
")",
"\n",
"return",
"r",
".",
"<mask>",
"(",
")",
"\n",
"}"
] |
8,959 | all-8960 | [
"Convert",
"the",
"Apache",
"access",
"log",
"format",
"into",
"a",
"text",
"/",
"template"
] | [
"func",
"(",
"mw",
"*",
"AccessLogApacheMiddleware",
")",
"convertFormat",
"(",
")",
"{",
"tmplText",
":=",
"apacheAdapter",
".",
"Replace",
"(",
"string",
"(",
"mw",
".",
"Format",
")",
")",
"\n\n",
"funcMap",
":=",
"<mask>",
".",
"FuncMap",
"{",
"\"",
"\"",
":",
"func",
"(",
"value",
"string",
")",
"string",
"{",
"if",
"value",
"==",
"\"",
"\"",
"{",
"return",
"\"",
"\"",
"\n",
"}",
"\n",
"return",
"value",
"\n",
"}",
",",
"\"",
"\"",
":",
"func",
"(",
"value",
"int64",
")",
"string",
"{",
"if",
"value",
"==",
"0",
"{",
"return",
"\"",
"\"",
"\n",
"}",
"\n",
"return",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"value",
")",
"\n",
"}",
",",
"\"",
"\"",
":",
"func",
"(",
"dur",
"*",
"time",
".",
"Duration",
")",
"string",
"{",
"if",
"dur",
"!=",
"nil",
"{",
"return",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"dur",
".",
"Nanoseconds",
"(",
")",
"/",
"1000",
")",
"\n",
"}",
"\n",
"return",
"\"",
"\"",
"\n",
"}",
",",
"\"",
"\"",
":",
"func",
"(",
"statusCode",
"int",
")",
"string",
"{",
"if",
"statusCode",
">=",
"400",
"&&",
"statusCode",
"<",
"500",
"{",
"return",
"\"",
"\"",
"\n",
"}",
"else",
"if",
"statusCode",
">=",
"500",
"{",
"return",
"\"",
"\"",
"\n",
"}",
"\n",
"return",
"\"",
"\"",
"\n",
"}",
",",
"}",
"\n\n",
"var",
"err",
"error",
"\n",
"mw",
".",
"textTemplate",
",",
"err",
"=",
"template",
".",
"New",
"(",
"\"",
"\"",
")",
".",
"Funcs",
"(",
"funcMap",
")",
".",
"Parse",
"(",
"tmplText",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"panic",
"(",
"err",
")",
"\n",
"}",
"\n",
"}"
] |
8,960 | all-8961 | [
"WithScriptToEvaluateOnLoad",
"if",
"set",
"the",
"script",
"will",
"be",
"injected",
"into",
"all",
"frames",
"of",
"the",
"inspected",
"page",
"after",
"reload",
".",
"Argument",
"will",
"be",
"ignored",
"if",
"reloading",
"dataURL",
"origin",
"."
] | [
"func",
"(",
"p",
"ReloadParams",
")",
"WithScriptToEvaluateOnLoad",
"(",
"scriptToEvaluateOnLoad",
"<mask>",
")",
"*",
"ReloadParams",
"{",
"p",
".",
"ScriptToEvaluateOnLoad",
"=",
"scriptToEvaluateOnLoad",
"\n",
"return",
"&",
"p",
"\n",
"}"
] |
8,961 | all-8962 | [
"getAccessToken",
"retrieves",
"Azure",
"API",
"access",
"token",
"."
] | [
"func",
"getAccessToken",
"(",
"cfg",
"config",
",",
"environment",
"azure",
".",
"Environment",
")",
"(",
"*",
"adal",
".",
"ServicePrincipalToken",
",",
"error",
")",
"{",
"// Try to retrive token with MSI.",
"if",
"cfg",
".",
"UseManagedIdentityExtension",
"{",
"log",
".",
"Info",
"(",
"\"",
"\"",
")",
"\n",
"msiEndpoint",
",",
"err",
":=",
"adal",
".",
"GetMSIVMEndpoint",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"}",
"\n\n",
"token",
",",
"err",
":=",
"adal",
".",
"NewServicePrincipalTokenFromMSI",
"(",
"msiEndpoint",
",",
"environment",
".",
"ServiceManagementEndpoint",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"}",
"\n",
"return",
"<mask>",
",",
"nil",
"\n",
"}",
"\n\n",
"// Try to retrieve token with service principal credentials.",
"if",
"len",
"(",
"cfg",
".",
"ClientID",
")",
">",
"0",
"&&",
"len",
"(",
"cfg",
".",
"ClientSecret",
")",
">",
"0",
"{",
"log",
".",
"Info",
"(",
"\"",
"\"",
")",
"\n",
"oauthConfig",
",",
"err",
":=",
"adal",
".",
"NewOAuthConfig",
"(",
"environment",
".",
"ActiveDirectoryEndpoint",
",",
"cfg",
".",
"TenantID",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"}",
"\n\n",
"token",
",",
"err",
":=",
"adal",
".",
"NewServicePrincipalToken",
"(",
"*",
"oauthConfig",
",",
"cfg",
".",
"ClientID",
",",
"cfg",
".",
"ClientSecret",
",",
"environment",
".",
"ResourceManagerEndpoint",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"}",
"\n",
"return",
"token",
",",
"nil",
"\n",
"}",
"\n\n",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
")",
"\n",
"}"
] |
8,962 | all-8963 | [
"Get",
"returns",
"the",
"status",
"code",
"and",
"body",
"of",
"url",
".",
"The",
"contents",
"of",
"dst",
"will",
"be",
"replaced",
"by",
"the",
"body",
"and",
"returned",
"if",
"the",
"dst",
"is",
"too",
"small",
"a",
"new",
"slice",
"will",
"be",
"allocated",
".",
"The",
"function",
"follows",
"redirects",
".",
"Use",
"Do",
"*",
"for",
"manually",
"handling",
"redirects",
"."
] | [
"func",
"(",
"c",
"*",
"HostClient",
")",
"Get",
"(",
"dst",
"[",
"]",
"byte",
",",
"url",
"string",
")",
"(",
"statusCode",
"int",
",",
"body",
"[",
"]",
"<mask>",
",",
"err",
"error",
")",
"{",
"return",
"clientGetURL",
"(",
"dst",
",",
"url",
",",
"c",
")",
"\n",
"}"
] |
8,963 | all-8964 | [
"IsRepoNotFoundErr",
"returns",
"true",
"if",
"err",
"is",
"an",
"error",
"message",
"about",
"a",
"repo",
"not",
"being",
"found"
] | [
"func",
"IsRepoNotFoundErr",
"(",
"err",
"error",
")",
"bool",
"{",
"if",
"err",
"==",
"nil",
"{",
"return",
"false",
"\n",
"}",
"\n",
"return",
"repoNotFoundRe",
".",
"MatchString",
"(",
"err",
".",
"<mask>",
"(",
")",
")",
"\n",
"}"
] |
8,964 | all-8965 | [
"DialTimeout",
"dials",
"the",
"given",
"TCP",
"addr",
"using",
"tcp4",
"using",
"the",
"given",
"timeout",
".",
"This",
"function",
"has",
"the",
"following",
"additional",
"features",
"comparing",
"to",
"net",
".",
"Dial",
":",
"*",
"It",
"reduces",
"load",
"on",
"DNS",
"resolver",
"by",
"caching",
"resolved",
"TCP",
"addressed",
"for",
"DefaultDNSCacheDuration",
".",
"*",
"It",
"dials",
"all",
"the",
"resolved",
"TCP",
"addresses",
"in",
"round",
"-",
"robin",
"manner",
"until",
"connection",
"is",
"established",
".",
"This",
"may",
"be",
"useful",
"if",
"certain",
"addresses",
"are",
"temporarily",
"unreachable",
".",
"This",
"dialer",
"is",
"intended",
"for",
"custom",
"code",
"wrapping",
"before",
"passing",
"to",
"Client",
".",
"Dial",
"or",
"HostClient",
".",
"Dial",
".",
"For",
"instance",
"per",
"-",
"host",
"counters",
"and",
"/",
"or",
"limits",
"may",
"be",
"implemented",
"by",
"such",
"wrappers",
".",
"The",
"addr",
"passed",
"to",
"the",
"function",
"must",
"contain",
"port",
".",
"Example",
"addr",
"values",
":",
"*",
"foobar",
".",
"baz",
":",
"443",
"*",
"foo",
".",
"bar",
":",
"80",
"*",
"aaa",
".",
"com",
":",
"8080"
] | [
"func",
"DialTimeout",
"(",
"addr",
"string",
",",
"timeout",
"time",
".",
"Duration",
")",
"(",
"<mask>",
".",
"Conn",
",",
"error",
")",
"{",
"return",
"defaultDialer",
".",
"DialTimeout",
"(",
"addr",
",",
"timeout",
")",
"\n",
"}"
] |
8,965 | all-8966 | [
"MarshalJSON",
"supports",
"json",
".",
"Marshaler",
"interface"
] | [
"func",
"(",
"v",
"RemoveAttributeParams",
")",
"MarshalJSON",
"(",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"w",
":=",
"jwriter",
".",
"<mask>",
"{",
"}",
"\n",
"easyjsonC5a4559bEncodeGithubComChromedpCdprotoDom16",
"(",
"&",
"w",
",",
"v",
")",
"\n",
"return",
"w",
".",
"Buffer",
".",
"BuildBytes",
"(",
")",
",",
"w",
".",
"Error",
"\n",
"}"
] |
8,966 | all-8967 | [
"Call",
"Parse",
"()",
"on",
"the",
"FlagSet"
] | [
"func",
"parse",
"(",
"args",
"[",
"]",
"string",
")",
"{",
"if",
"!",
"FlagSet",
".",
"Parsed",
"(",
")",
"{",
"FlagSet",
".",
"Parse",
"(",
"args",
")",
"\n",
"}",
"\n\n",
"for",
"_",
",",
"name",
":=",
"<mask>",
"defaultedFlags",
"(",
")",
"{",
"if",
"value",
",",
"ok",
":=",
"getenv",
"(",
"name",
")",
";",
"ok",
"{",
"FlagSet",
".",
"Set",
"(",
"name",
",",
"value",
")",
"\n",
"}",
"\n",
"}",
"\n",
"}"
] |
8,967 | all-8968 | [
"expectOneOf",
"consumes",
"the",
"next",
"token",
"and",
"guarantees",
"it",
"has",
"one",
"of",
"the",
"required",
"types",
"."
] | [
"func",
"(",
"p",
"*",
"<mask>",
")",
"expectOneOf",
"(",
"exp1",
",",
"exp2",
"ItemType",
",",
"context",
"string",
")",
"item",
"{",
"token",
":=",
"p",
".",
"next",
"(",
")",
"\n",
"if",
"token",
".",
"typ",
"!=",
"exp1",
"&&",
"token",
".",
"typ",
"!=",
"exp2",
"{",
"p",
".",
"errorf",
"(",
"\"",
"\"",
",",
"token",
".",
"desc",
"(",
")",
",",
"context",
",",
"exp1",
".",
"desc",
"(",
")",
",",
"exp2",
".",
"desc",
"(",
")",
")",
"\n",
"}",
"\n",
"return",
"token",
"\n",
"}"
] |
8,968 | all-8969 | [
"ReadSCSIBusType",
"checks",
"the",
"SCSI",
"bus",
"state",
"and",
"returns",
"a",
"device",
"type",
"depending",
"on",
"if",
"all",
"controllers",
"are",
"one",
"specific",
"kind",
"or",
"not",
".",
"Only",
"the",
"first",
"number",
"of",
"controllers",
"specified",
"by",
"count",
"are",
"checked",
"."
] | [
"func",
"ReadSCSIBusType",
"(",
"l",
"object",
".",
"VirtualDeviceList",
",",
"count",
"int",
")",
"string",
"{",
"ctlrs",
":=",
"make",
"(",
"[",
"]",
"types",
".",
"BaseVirtualSCSIController",
",",
"count",
")",
"\n",
"for",
"_",
",",
"dev",
":=",
"range",
"l",
"{",
"if",
"sc",
",",
"ok",
":=",
"dev",
".",
"(",
"types",
".",
"BaseVirtualSCSIController",
")",
";",
"ok",
"&&",
"sc",
".",
"GetVirtualSCSIController",
"(",
")",
".",
"BusNumber",
"<",
"int32",
"(",
"<mask>",
")",
"{",
"ctlrs",
"[",
"sc",
".",
"GetVirtualSCSIController",
"(",
")",
".",
"BusNumber",
"]",
"=",
"sc",
"\n",
"}",
"\n",
"}",
"\n",
"log",
".",
"Printf",
"(",
"\"",
"\"",
",",
"count",
",",
"scsiControllerListString",
"(",
"ctlrs",
")",
")",
"\n",
"if",
"ctlrs",
"[",
"0",
"]",
"==",
"nil",
"{",
"return",
"subresourceControllerTypeUnknown",
"\n",
"}",
"\n",
"last",
":=",
"l",
".",
"Type",
"(",
"ctlrs",
"[",
"0",
"]",
".",
"(",
"types",
".",
"BaseVirtualDevice",
")",
")",
"\n",
"for",
"_",
",",
"ctlr",
":=",
"range",
"ctlrs",
"[",
"1",
":",
"]",
"{",
"if",
"ctlr",
"==",
"nil",
"||",
"l",
".",
"Type",
"(",
"ctlr",
".",
"(",
"types",
".",
"BaseVirtualDevice",
")",
")",
"!=",
"last",
"{",
"return",
"subresourceControllerTypeMixed",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"last",
"\n",
"}"
] |
8,969 | all-8970 | [
"render",
"primitives",
"using",
"a",
"count",
"derived",
"from",
"a",
"specifed",
"stream",
"of",
"a",
"transform",
"feedback",
"object"
] | [
"func",
"DrawTransformFeedbackStream",
"(",
"mode",
"uint32",
",",
"id",
"uint32",
",",
"stream",
"uint32",
")",
"{",
"C",
".",
"glowDrawTransformFeedbackStream",
"(",
"gpDrawTransformFeedbackStream",
",",
"(",
"C",
".",
"GLenum",
")",
"(",
"mode",
")",
",",
"(",
"C",
".",
"GLuint",
")",
"(",
"id",
")",
",",
"(",
"C",
".",
"GLuint",
")",
"(",
"<mask>",
")",
")",
"\n",
"}"
] |
8,970 | all-8971 | [
"Get",
"gets",
"a",
"hashtree",
"node",
"."
] | [
"func",
"(",
"h",
"*",
"dbHashTree",
")",
"Get",
"(",
"path",
"string",
")",
"(",
"*",
"NodeProto",
",",
"error",
")",
"{",
"path",
"=",
"clean",
"(",
"path",
")",
"\n",
"var",
"node",
"*",
"NodeProto",
"\n",
"if",
"err",
":=",
"h",
".",
"View",
"(",
"func",
"(",
"tx",
"*",
"bolt",
".",
"Tx",
")",
"error",
"{",
"<mask>",
"err",
"error",
"\n",
"node",
",",
"err",
"=",
"get",
"(",
"tx",
",",
"path",
")",
"\n",
"return",
"err",
"\n",
"}",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"return",
"node",
",",
"nil",
"\n",
"}"
] |
8,971 | all-8972 | [
"Pause",
"pauses",
"periodic",
"compactor",
"."
] | [
"func",
"(",
"pc",
"*",
"Periodic",
")",
"Pause",
"(",
")",
"{",
"<mask>",
".",
"mu",
".",
"Lock",
"(",
")",
"\n",
"pc",
".",
"paused",
"=",
"true",
"\n",
"pc",
".",
"mu",
".",
"Unlock",
"(",
")",
"\n",
"}"
] |
8,972 | all-8973 | [
"Printf",
"logs",
"internal",
"messages",
"from",
"a",
"reporter",
"."
] | [
"func",
"(",
"l",
"*",
"reportLogger",
")",
"Printf",
"(",
"format",
"string",
",",
"v",
"...",
"<mask>",
"{",
"}",
")",
"{",
"if",
"l",
".",
"logger",
"!=",
"nil",
"{",
"l",
".",
"logger",
".",
"Debug",
"(",
"fmt",
".",
"Sprintf",
"(",
"format",
",",
"v",
"...",
")",
")",
"\n",
"}",
"\n",
"}"
] |
8,973 | all-8974 | [
"/",
"*",
"Kill",
"sends",
"a",
"SIGKILL",
"signal",
"to",
"all",
"the",
"processes",
"started",
"by",
"Run",
".",
"It",
"does",
"not",
"wait",
"for",
"the",
"processes",
"to",
"exit",
"."
] | [
"func",
"Kill",
"(",
")",
"{",
"trackedSessionsMutex",
".",
"Lock",
"(",
")",
"\n",
"defer",
"trackedSessionsMutex",
".",
"Unlock",
"(",
")",
"\n",
"for",
"_",
",",
"session",
":=",
"<mask>",
"trackedSessions",
"{",
"session",
".",
"Kill",
"(",
")",
"\n",
"}",
"\n",
"}"
] |
8,974 | all-8975 | [
"HasValue",
"returns",
"a",
"boolean",
"if",
"a",
"field",
"has",
"been",
"set",
"."
] | [
"func",
"(",
"c",
"*",
"ConditionalFormat",
")",
"HasValue",
"(",
")",
"bool",
"{",
"if",
"c",
"!=",
"nil",
"&&",
"c",
".",
"Value",
"!=",
"nil",
"{",
"return",
"<mask>",
"\n",
"}",
"\n\n",
"return",
"false",
"\n",
"}"
] |
8,975 | all-8976 | [
"Stop",
"the",
"server",
"."
] | [
"func",
"(",
"s",
"*",
"Server",
")",
"Stop",
"(",
")",
"{",
"if",
"s",
".",
"isStarted",
"&&",
"s",
".",
"quit",
"!=",
"nil",
"{",
"log",
".",
"Info",
"(",
"\"",
"\"",
")",
"\n",
"s",
".",
"quit",
"<-",
"true",
"\n",
"}",
"else",
"{",
"<mask>",
".",
"Info",
"(",
"\"",
"\"",
")",
"\n",
"s",
".",
"Error",
"<-",
"errors",
".",
"New",
"(",
"\"",
"\"",
")",
"\n",
"s",
".",
"Done",
"<-",
"false",
"\n",
"}",
"\n",
"}"
] |
8,976 | all-8977 | [
"Run",
"implements",
"the",
"Discoverer",
"interface",
"."
] | [
"func",
"(",
"d",
"*",
"Discovery",
")",
"Run",
"(",
"ctx",
"context",
".",
"Context",
",",
"ch",
"chan",
"<-",
"[",
"]",
"*",
"targetgroup",
".",
"Group",
")",
"{",
"watcher",
",",
"err",
":=",
"fsnotify",
".",
"NewWatcher",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"level",
".",
"Error",
"(",
"d",
".",
"logger",
")",
".",
"Log",
"(",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"err",
")",
"\n",
"return",
"\n",
"}",
"\n",
"d",
".",
"watcher",
"=",
"watcher",
"\n",
"defer",
"d",
".",
"stop",
"(",
")",
"\n\n",
"d",
".",
"refresh",
"(",
"ctx",
",",
"ch",
")",
"\n\n",
"ticker",
":=",
"time",
".",
"NewTicker",
"(",
"d",
".",
"interval",
")",
"\n",
"defer",
"ticker",
".",
"Stop",
"(",
")",
"\n\n",
"for",
"{",
"select",
"{",
"case",
"<-",
"ctx",
".",
"Done",
"(",
")",
":",
"return",
"\n\n",
"case",
"event",
":=",
"<-",
"d",
".",
"watcher",
".",
"Events",
":",
"// fsnotify sometimes sends a bunch of events without name or operation.",
"// It's unclear what they are and why they are sent - filter them out.",
"if",
"len",
"(",
"event",
".",
"Name",
")",
"==",
"0",
"{",
"break",
"\n",
"}",
"\n",
"// Everything but a chmod requires rereading.",
"if",
"event",
".",
"Op",
"^",
"fsnotify",
".",
"Chmod",
"==",
"0",
"{",
"break",
"\n",
"}",
"\n",
"// Changes to a file can spawn various sequences of events with",
"// different combinations of operations. For all practical purposes",
"// this is inaccurate.",
"// The most reliable solution is to reload everything if anything happens.",
"d",
".",
"refresh",
"(",
"ctx",
",",
"ch",
")",
"\n\n",
"case",
"<-",
"ticker",
".",
"C",
":",
"// Setting a new watch after an update might fail. Make sure we don't lose",
"// those files forever.",
"d",
".",
"refresh",
"(",
"ctx",
",",
"ch",
")",
"\n\n",
"<mask>",
"err",
":=",
"<-",
"d",
".",
"watcher",
".",
"Errors",
":",
"if",
"err",
"!=",
"nil",
"{",
"level",
".",
"Error",
"(",
"d",
".",
"logger",
")",
".",
"Log",
"(",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"err",
")",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n",
"}"
] |
8,977 | all-8978 | [
"NewSystemGroup",
"adds",
"a",
"system",
"group",
"."
] | [
"func",
"NewSystemGroup",
"(",
"name",
"string",
",",
"members",
"...",
"string",
")",
"*",
"<mask>",
"{",
"return",
"&",
"Group",
"{",
"Name",
":",
"name",
",",
"password",
":",
"\"",
"\"",
",",
"GID",
":",
"-",
"1",
",",
"UserList",
":",
"members",
",",
"addSystemGroup",
":",
"true",
",",
"}",
"\n",
"}"
] |
8,978 | all-8979 | [
"----------------------------------------",
"*",
"Codec",
"methods",
"MarshalBinaryLengthPrefixed",
"encodes",
"the",
"object",
"o",
"according",
"to",
"the",
"Amino",
"spec",
"but",
"prefixed",
"by",
"a",
"uvarint",
"encoding",
"of",
"the",
"object",
"to",
"encode",
".",
"Use",
"MarshalBinaryBare",
"if",
"you",
"don",
"t",
"want",
"byte",
"-",
"length",
"prefixing",
".",
"For",
"consistency",
"MarshalBinaryLengthPrefixed",
"will",
"first",
"dereference",
"pointers",
"before",
"encoding",
".",
"MarshalBinaryLengthPrefixed",
"will",
"panic",
"if",
"o",
"is",
"a",
"nil",
"-",
"pointer",
"or",
"if",
"o",
"is",
"invalid",
"."
] | [
"func",
"(",
"cdc",
"*",
"Codec",
")",
"MarshalBinaryLengthPrefixed",
"(",
"o",
"interface",
"{",
"}",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"// Write the bytes here.",
"var",
"buf",
"=",
"new",
"(",
"<mask>",
".",
"Buffer",
")",
"\n\n",
"// Write the bz without length-prefixing.",
"bz",
",",
"err",
":=",
"cdc",
".",
"MarshalBinaryBare",
"(",
"o",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"// Write uvarint(len(bz)).",
"err",
"=",
"EncodeUvarint",
"(",
"buf",
",",
"uint64",
"(",
"len",
"(",
"bz",
")",
")",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"// Write bz.",
"_",
",",
"err",
"=",
"buf",
".",
"Write",
"(",
"bz",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"return",
"buf",
".",
"Bytes",
"(",
")",
",",
"nil",
"\n",
"}"
] |
8,979 | all-8980 | [
"NewFolderFontCache",
"creates",
"FolderFontCache"
] | [
"func",
"NewFolderFontCache",
"(",
"folder",
"string",
")",
"*",
"FolderFontCache",
"{",
"return",
"&",
"FolderFontCache",
"{",
"fonts",
":",
"make",
"(",
"<mask>",
"[",
"string",
"]",
"*",
"truetype",
".",
"Font",
")",
",",
"folder",
":",
"folder",
",",
"namer",
":",
"FontFileName",
",",
"}",
"\n",
"}"
] |
8,980 | all-8981 | [
"Locator",
"returns",
"a",
"locator",
"for",
"the",
"given",
"resource"
] | [
"func",
"(",
"r",
"*",
"NetworkInterface",
")",
"Locator",
"(",
"api",
"*",
"API",
")",
"*",
"NetworkInterfaceLocator",
"{",
"<mask>",
"api",
".",
"NetworkInterfaceLocator",
"(",
"r",
".",
"Href",
")",
"\n",
"}"
] |
8,981 | all-8982 | [
"Mask",
"returns",
"a",
"new",
"masked",
"NetworkNumber",
"from",
"given",
"NetworkNumber",
"."
] | [
"func",
"(",
"m",
"NetworkNumberMask",
")",
"Mask",
"(",
"n",
"NetworkNumber",
")",
"(",
"NetworkNumber",
",",
"error",
")",
"{",
"if",
"len",
"(",
"m",
")",
"!=",
"len",
"(",
"n",
")",
"{",
"return",
"nil",
",",
"ErrVersionMismatch",
"\n",
"}",
"\n",
"result",
":=",
"make",
"(",
"NetworkNumber",
",",
"len",
"(",
"m",
")",
")",
"\n",
"result",
"[",
"0",
"]",
"=",
"m",
"[",
"0",
"]",
"&",
"n",
"[",
"0",
"]",
"\n",
"if",
"len",
"(",
"m",
")",
"==",
"IPv6Uint32Count",
"{",
"result",
"[",
"1",
"]",
"=",
"m",
"[",
"1",
"]",
"&",
"n",
"[",
"1",
"]",
"\n",
"result",
"[",
"2",
"]",
"=",
"m",
"[",
"2",
"]",
"&",
"n",
"[",
"2",
"]",
"\n",
"result",
"[",
"3",
"]",
"=",
"m",
"[",
"3",
"]",
"&",
"n",
"[",
"3",
"]",
"\n",
"}",
"\n",
"return",
"<mask>",
",",
"nil",
"\n",
"}"
] |
8,982 | all-8983 | [
"NewClient",
"return",
"SOAP",
"client"
] | [
"func",
"NewClient",
"(",
"url",
"string",
",",
"tls",
"bool",
",",
"header",
"interface",
"{",
"}",
")",
"*",
"Client",
"{",
"return",
"&",
"Client",
"{",
"<mask>",
":",
"url",
",",
"tls",
":",
"tls",
",",
"header",
":",
"header",
",",
"}",
"\n",
"}"
] |
8,983 | all-8984 | [
"SetShowTitles",
"turns",
"on",
"and",
"off",
"horizontal",
"axis",
"and",
"bar",
"titles"
] | [
"func",
"(",
"b",
"*",
"BarChart",
")",
"SetShowTitles",
"(",
"show",
"bool",
")",
"{",
"b",
".",
"mtx",
".",
"Lock",
"(",
")",
"\n",
"defer",
"b",
".",
"mtx",
".",
"Unlock",
"(",
")",
"\n\n",
"b",
".",
"showTitles",
"=",
"<mask>",
"\n",
"}"
] |
8,984 | all-8985 | [
"Writers",
"sets",
"the",
"Writers"
] | [
"func",
"(",
"e",
"*",
"execStreamerBuilder",
")",
"Writers",
"(",
"writers",
"<mask>",
".",
"Writer",
")",
"ExecStreamerBuilder",
"{",
"e",
".",
"d",
".",
"StdoutWriter",
"=",
"writers",
"\n",
"e",
".",
"d",
".",
"StderrWriter",
"=",
"writers",
"\n",
"return",
"e",
"\n",
"}"
] |
8,985 | all-8986 | [
"assert",
"verifies",
"that",
"all",
"assertions",
"in",
"t",
"match",
"the",
"content",
"that",
"t",
"will",
"be",
"applied",
"upon",
".",
"If",
"an",
"assertion",
"fails",
"the",
"transaction",
"state",
"is",
"changed",
"to",
"aborted",
"."
] | [
"func",
"(",
"f",
"*",
"flusher",
")",
"assert",
"(",
"t",
"*",
"transaction",
",",
"revnos",
"[",
"]",
"int64",
",",
"pull",
"map",
"[",
"bson",
".",
"ObjectId",
"]",
"*",
"transaction",
")",
"error",
"{",
"f",
".",
"debugf",
"(",
"\"",
"\"",
",",
"t",
",",
"revnos",
")",
"\n",
"if",
"t",
".",
"State",
"!=",
"tprepared",
"{",
"panic",
"(",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"t",
".",
"State",
")",
")",
"\n",
"}",
"\n",
"qdoc",
":=",
"make",
"(",
"bson",
".",
"D",
",",
"3",
")",
"\n",
"revno",
":=",
"make",
"(",
"map",
"[",
"docKey",
"]",
"int64",
")",
"\n",
"for",
"i",
",",
"op",
":=",
"range",
"t",
".",
"Ops",
"{",
"dkey",
":=",
"op",
".",
"docKey",
"(",
")",
"\n",
"if",
"_",
",",
"ok",
":=",
"revno",
"[",
"dkey",
"]",
";",
"!",
"ok",
"{",
"revno",
"[",
"dkey",
"]",
"=",
"revnos",
"[",
"i",
"]",
"\n",
"}",
"\n",
"if",
"op",
".",
"Assert",
"==",
"nil",
"{",
"continue",
"\n",
"}",
"\n",
"if",
"op",
".",
"Assert",
"==",
"DocMissing",
"{",
"if",
"revnos",
"[",
"i",
"]",
">=",
"0",
"{",
"return",
"f",
".",
"abortOrReload",
"(",
"t",
",",
"revnos",
",",
"pull",
")",
"\n",
"}",
"\n",
"<mask>",
"\n",
"}",
"\n",
"if",
"op",
".",
"Insert",
"!=",
"nil",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"op",
".",
"Assert",
")",
"\n",
"}",
"\n",
"// if revnos[i] < 0 { abort }?",
"qdoc",
"=",
"append",
"(",
"qdoc",
"[",
":",
"0",
"]",
",",
"bson",
".",
"DocElem",
"{",
"\"",
"\"",
",",
"op",
".",
"Id",
"}",
")",
"\n",
"if",
"op",
".",
"Assert",
"!=",
"DocMissing",
"{",
"var",
"revnoq",
"interface",
"{",
"}",
"\n",
"if",
"n",
":=",
"revno",
"[",
"dkey",
"]",
";",
"n",
"==",
"0",
"{",
"revnoq",
"=",
"bson",
".",
"D",
"{",
"{",
"\"",
"\"",
",",
"false",
"}",
"}",
"\n",
"}",
"else",
"{",
"revnoq",
"=",
"n",
"\n",
"}",
"\n",
"// XXX Add tt to the query here, once we're sure it's all working.",
"// Not having it increases the chances of breaking on bad logic.",
"qdoc",
"=",
"append",
"(",
"qdoc",
",",
"bson",
".",
"DocElem",
"{",
"\"",
"\"",
",",
"revnoq",
"}",
")",
"\n",
"if",
"op",
".",
"Assert",
"!=",
"DocExists",
"{",
"qdoc",
"=",
"append",
"(",
"qdoc",
",",
"bson",
".",
"DocElem",
"{",
"\"",
"\"",
",",
"[",
"]",
"interface",
"{",
"}",
"{",
"op",
".",
"Assert",
"}",
"}",
")",
"\n",
"}",
"\n",
"}",
"\n\n",
"c",
":=",
"f",
".",
"tc",
".",
"Database",
".",
"C",
"(",
"op",
".",
"C",
")",
"\n",
"if",
"err",
":=",
"c",
".",
"Find",
"(",
"qdoc",
")",
".",
"Select",
"(",
"bson",
".",
"D",
"{",
"{",
"\"",
"\"",
",",
"1",
"}",
"}",
")",
".",
"One",
"(",
"nil",
")",
";",
"err",
"==",
"mgo",
".",
"ErrNotFound",
"{",
"// Assertion failed or someone else started applying.",
"return",
"f",
".",
"abortOrReload",
"(",
"t",
",",
"revnos",
",",
"pull",
")",
"\n",
"}",
"else",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"}",
"\n",
"f",
".",
"debugf",
"(",
"\"",
"\"",
",",
"t",
")",
"\n",
"return",
"nil",
"\n",
"}"
] |
8,986 | all-8987 | [
"queueFilter",
"adds",
"a",
"filterBlock",
"to",
"the",
"end",
"decodeReader",
"s",
"filters",
"."
] | [
"func",
"(",
"d",
"*",
"decodeReader",
")",
"queueFilter",
"(",
"f",
"*",
"filterBlock",
")",
"error",
"{",
"if",
"f",
".",
"reset",
"{",
"d",
".",
"filters",
"=",
"nil",
"\n",
"}",
"\n",
"if",
"len",
"(",
"d",
".",
"filters",
")",
">=",
"maxQueuedFilters",
"{",
"return",
"errTooManyFilters",
"\n",
"}",
"\n",
"// offset & length must be < window size",
"f",
".",
"offset",
"&=",
"d",
".",
"win",
".",
"mask",
"\n",
"f",
".",
"length",
"&=",
"d",
".",
"win",
".",
"mask",
"\n",
"// make offset relative to previous filter in list",
"for",
"_",
",",
"fb",
":=",
"<mask>",
"d",
".",
"filters",
"{",
"if",
"f",
".",
"offset",
"<",
"fb",
".",
"offset",
"{",
"// filter block must not start before previous filter",
"return",
"errInvalidFilter",
"\n",
"}",
"\n",
"f",
".",
"offset",
"-=",
"fb",
".",
"offset",
"\n",
"}",
"\n",
"d",
".",
"filters",
"=",
"append",
"(",
"d",
".",
"filters",
",",
"f",
")",
"\n",
"return",
"nil",
"\n",
"}"
] |
8,987 | all-8988 | [
"MutatePayment",
"for",
"PayWithPath",
"sets",
"the",
"PathPaymentOp",
"s",
"SendAsset",
"SendMax",
"and",
"Path",
"fields"
] | [
"func",
"(",
"m",
"PayWithPath",
")",
"MutatePayment",
"(",
"o",
"interface",
"{",
"}",
")",
"(",
"err",
"error",
")",
"{",
"var",
"pathPaymentOp",
"*",
"xdr",
".",
"PathPaymentOp",
"\n",
"var",
"ok",
"bool",
"\n",
"if",
"pathPaymentOp",
",",
"ok",
"=",
"o",
".",
"(",
"*",
"xdr",
".",
"PathPaymentOp",
")",
";",
"!",
"ok",
"{",
"return",
"<mask>",
".",
"New",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"// MaxAmount",
"pathPaymentOp",
".",
"SendMax",
",",
"err",
"=",
"amount",
".",
"Parse",
"(",
"m",
".",
"MaxAmount",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"\n",
"}",
"\n\n",
"// Path",
"var",
"path",
"[",
"]",
"xdr",
".",
"Asset",
"\n",
"var",
"xdrAsset",
"xdr",
".",
"Asset",
"\n\n",
"for",
"_",
",",
"asset",
":=",
"range",
"m",
".",
"Path",
"{",
"xdrAsset",
",",
"err",
"=",
"asset",
".",
"ToXdrObject",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"path",
"=",
"append",
"(",
"path",
",",
"xdrAsset",
")",
"\n",
"}",
"\n\n",
"pathPaymentOp",
".",
"Path",
"=",
"path",
"\n\n",
"// Asset",
"pathPaymentOp",
".",
"SendAsset",
",",
"err",
"=",
"m",
".",
"Asset",
".",
"ToXdrObject",
"(",
")",
"\n",
"return",
"\n",
"}"
] |
8,988 | all-8989 | [
"ContainerLastUsedUpdate",
"updates",
"the",
"last_use_date",
"field",
"of",
"the",
"container",
"with",
"the",
"given",
"ID",
"."
] | [
"func",
"(",
"c",
"*",
"Cluster",
")",
"ContainerLastUsedUpdate",
"(",
"id",
"int",
",",
"<mask>",
"time",
".",
"Time",
")",
"error",
"{",
"stmt",
":=",
"`UPDATE containers SET last_use_date=? WHERE id=?`",
"\n",
"err",
":=",
"exec",
"(",
"c",
".",
"db",
",",
"stmt",
",",
"date",
",",
"id",
")",
"\n",
"return",
"err",
"\n",
"}"
] |
8,989 | all-8990 | [
"PutDir",
"creates",
"a",
"directory",
"(",
"or",
"does",
"nothing",
"if",
"one",
"exists",
")",
"."
] | [
"func",
"(",
"h",
"*",
"dbHashTree",
")",
"PutDir",
"(",
"path",
"string",
")",
"error",
"{",
"path",
"=",
"clean",
"(",
"path",
")",
"\n",
"return",
"h",
".",
"Batch",
"(",
"func",
"(",
"tx",
"*",
"bolt",
".",
"Tx",
")",
"error",
"{",
"node",
",",
"err",
":=",
"get",
"(",
"tx",
",",
"path",
")",
"\n",
"if",
"err",
"!=",
"nil",
"&&",
"Code",
"(",
"err",
")",
"!=",
"PathNotFound",
"{",
"return",
"err",
"\n",
"}",
"\n",
"if",
"node",
"!=",
"nil",
"{",
"if",
"node",
".",
"nodetype",
"(",
")",
"==",
"directory",
"{",
"return",
"nil",
"\n",
"}",
"else",
"if",
"node",
".",
"nodetype",
"(",
")",
"!=",
"none",
"{",
"return",
"errorf",
"(",
"PathConflict",
",",
"\"",
"\\\"",
"\\\"",
"\"",
"+",
"\"",
"\"",
",",
"path",
",",
"node",
".",
"nodetype",
"(",
")",
")",
"\n",
"}",
"\n",
"}",
"\n",
"node",
"=",
"&",
"NodeProto",
"{",
"Name",
":",
"base",
"(",
"path",
")",
",",
"DirNode",
":",
"&",
"DirectoryNodeProto",
"{",
"}",
",",
"}",
"\n",
"if",
"err",
":=",
"put",
"(",
"tx",
",",
"path",
",",
"<mask>",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"return",
"visit",
"(",
"tx",
",",
"path",
",",
"func",
"(",
"node",
"*",
"NodeProto",
",",
"parent",
",",
"child",
"string",
")",
"error",
"{",
"if",
"node",
".",
"DirNode",
"==",
"nil",
"{",
"// node created as part of this visit call, fill in the basics",
"node",
".",
"Name",
"=",
"base",
"(",
"parent",
")",
"\n",
"node",
".",
"DirNode",
"=",
"&",
"DirectoryNodeProto",
"{",
"}",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}",
")",
"\n",
"}",
")",
"\n",
"}"
] |
8,990 | all-8991 | [
"maybeAppend",
"returns",
"(",
"0",
"false",
")",
"if",
"the",
"entries",
"cannot",
"be",
"appended",
".",
"Otherwise",
"it",
"returns",
"(",
"last",
"index",
"of",
"new",
"entries",
"true",
")",
"."
] | [
"func",
"(",
"l",
"*",
"raftLog",
")",
"maybeAppend",
"(",
"index",
",",
"logTerm",
",",
"committed",
"uint64",
",",
"ents",
"...",
"pb",
".",
"Entry",
")",
"(",
"lastnewi",
"uint64",
",",
"ok",
"bool",
")",
"{",
"if",
"l",
".",
"matchTerm",
"(",
"index",
",",
"logTerm",
")",
"{",
"lastnewi",
"=",
"index",
"+",
"uint64",
"(",
"len",
"(",
"ents",
")",
")",
"\n",
"ci",
":=",
"l",
".",
"findConflict",
"(",
"ents",
")",
"\n",
"switch",
"{",
"<mask>",
"ci",
"==",
"0",
":",
"case",
"ci",
"<=",
"l",
".",
"committed",
":",
"l",
".",
"logger",
".",
"Panicf",
"(",
"\"",
"\"",
",",
"ci",
",",
"l",
".",
"committed",
")",
"\n",
"default",
":",
"offset",
":=",
"index",
"+",
"1",
"\n",
"l",
".",
"append",
"(",
"ents",
"[",
"ci",
"-",
"offset",
":",
"]",
"...",
")",
"\n",
"}",
"\n",
"l",
".",
"commitTo",
"(",
"min",
"(",
"committed",
",",
"lastnewi",
")",
")",
"\n",
"return",
"lastnewi",
",",
"true",
"\n",
"}",
"\n",
"return",
"0",
",",
"false",
"\n",
"}"
] |
8,991 | all-8992 | [
"GetATime",
"the",
"atime",
"for",
"a",
"file",
"logging",
"errors",
"instead",
"of",
"failing",
"and",
"returning",
"defaultTime",
"instead"
] | [
"func",
"GetATime",
"(",
"path",
"string",
",",
"defaultTime",
"<mask>",
".",
"Time",
")",
"time",
".",
"Time",
"{",
"at",
",",
"err",
":=",
"atime",
".",
"Stat",
"(",
"path",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"log",
".",
"WithError",
"(",
"err",
")",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"path",
")",
"\n",
"return",
"defaultTime",
"\n",
"}",
"\n",
"return",
"at",
"\n",
"}"
] |
8,992 | all-8993 | [
"GetAccelsForAction",
"is",
"a",
"wrapper",
"around",
"gtk_application_get_accels_for_action",
"()",
"."
] | [
"func",
"(",
"v",
"*",
"Application",
")",
"GetAccelsForAction",
"(",
"act",
"string",
")",
"[",
"]",
"string",
"{",
"cstr1",
":=",
"(",
"*",
"C",
".",
"gchar",
")",
"(",
"C",
".",
"CString",
"(",
"act",
")",
")",
"\n",
"defer",
"C",
".",
"free",
"(",
"unsafe",
".",
"Pointer",
"(",
"cstr1",
")",
")",
"\n\n",
"var",
"descs",
"[",
"]",
"string",
"\n",
"c",
":=",
"C",
".",
"gtk_application_get_accels_for_action",
"(",
"v",
".",
"native",
"(",
")",
",",
"cstr1",
")",
"\n",
"originalc",
":=",
"c",
"\n",
"defer",
"C",
".",
"g_strfreev",
"(",
"originalc",
")",
"\n\n",
"for",
"*",
"c",
"!=",
"nil",
"{",
"descs",
"=",
"append",
"(",
"descs",
",",
"C",
".",
"GoString",
"(",
"(",
"*",
"C",
".",
"<mask>",
")",
"(",
"*",
"c",
")",
")",
")",
"\n",
"c",
"=",
"C",
".",
"next_gcharptr",
"(",
"c",
")",
"\n",
"}",
"\n\n",
"return",
"descs",
"\n",
"}"
] |
8,993 | all-8994 | [
"NewServer",
"initializes",
"a",
"new",
"DHT",
"node",
"server",
"."
] | [
"func",
"NewServer",
"(",
"c",
"*",
"ServerConfig",
")",
"(",
"s",
"*",
"Server",
",",
"err",
"error",
")",
"{",
"if",
"c",
"==",
"nil",
"{",
"c",
"=",
"&",
"ServerConfig",
"{",
"Conn",
":",
"mustListen",
"(",
"\"",
"\"",
")",
",",
"NoSecurity",
":",
"true",
",",
"StartingNodes",
":",
"GlobalBootstrapAddrs",
",",
"ConnectionTracking",
":",
"conntrack",
".",
"NewInstance",
"(",
")",
",",
"}",
"\n",
"}",
"\n",
"if",
"c",
".",
"Conn",
"==",
"nil",
"{",
"return",
"nil",
",",
"errors",
".",
"New",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"if",
"missinggo",
".",
"IsZeroValue",
"(",
"c",
".",
"NodeId",
")",
"{",
"c",
".",
"NodeId",
"=",
"RandomNodeID",
"(",
")",
"\n",
"if",
"!",
"c",
".",
"NoSecurity",
"&&",
"c",
".",
"PublicIP",
"!=",
"nil",
"{",
"SecureNodeId",
"(",
"&",
"c",
".",
"NodeId",
",",
"c",
".",
"PublicIP",
")",
"\n",
"}",
"\n",
"}",
"\n",
"s",
"=",
"&",
"Server",
"{",
"config",
":",
"*",
"c",
",",
"ipBlockList",
":",
"c",
".",
"IPBlocklist",
",",
"tokenServer",
":",
"tokenServer",
"{",
"maxIntervalDelta",
":",
"2",
",",
"interval",
":",
"5",
"*",
"time",
".",
"Minute",
",",
"secret",
":",
"make",
"(",
"[",
"]",
"byte",
",",
"20",
")",
",",
"}",
",",
"transactions",
":",
"make",
"(",
"map",
"[",
"transactionKey",
"]",
"*",
"Transaction",
")",
",",
"<mask>",
":",
"table",
"{",
"k",
":",
"8",
",",
"}",
",",
"}",
"\n",
"if",
"s",
".",
"config",
".",
"ConnectionTracking",
"==",
"nil",
"{",
"s",
".",
"config",
".",
"ConnectionTracking",
"=",
"conntrack",
".",
"NewInstance",
"(",
")",
"\n",
"}",
"\n",
"rand",
".",
"Read",
"(",
"s",
".",
"tokenServer",
".",
"secret",
")",
"\n",
"s",
".",
"socket",
"=",
"c",
".",
"Conn",
"\n",
"s",
".",
"id",
"=",
"int160FromByteArray",
"(",
"c",
".",
"NodeId",
")",
"\n",
"s",
".",
"table",
".",
"rootID",
"=",
"s",
".",
"id",
"\n",
"go",
"s",
".",
"serveUntilClosed",
"(",
")",
"\n",
"return",
"\n",
"}"
] |
8,994 | all-8995 | [
"Stop",
"listening",
"for",
"changes",
"to",
"the",
"files",
"."
] | [
"func",
"(",
"w",
"*",
"Watcher",
")",
"Stop",
"(",
")",
"{",
"if",
"w",
".",
"notify_chan",
"!=",
"nil",
"{",
"close",
"(",
"w",
".",
"notify_chan",
")",
"\n",
"}",
"\n\n",
"if",
"w",
".",
"add_chan",
"!=",
"nil",
"{",
"<mask>",
"(",
"w",
".",
"add_chan",
")",
"\n",
"}",
"\n",
"}"
] |
8,995 | all-8996 | [
"ScheduleForcedSvcCheck",
"creates",
"a",
"new",
"SCHEDULE_FORCED_SVC_CHECK",
"Nagios",
"command",
".",
"Schedules",
"a",
"forced",
"active",
"check",
"of",
"a",
"particular",
"service",
"at",
"check_time",
".",
"The",
"check_time",
"argument",
"is",
"specified",
"in",
"time_t",
"format",
"(",
"seconds",
"since",
"the",
"UNIX",
"epoch",
")",
".",
"Forced",
"checks",
"are",
"performed",
"regardless",
"of",
"what",
"time",
"it",
"is",
"(",
"e",
".",
"g",
".",
"timeperiod",
"restrictions",
"are",
"ignored",
")",
"and",
"whether",
"or",
"not",
"active",
"checks",
"are",
"enabled",
"on",
"a",
"service",
"-",
"specific",
"or",
"program",
"-",
"wide",
"basis",
"."
] | [
"func",
"ScheduleForcedSvcCheck",
"(",
"host_name",
"string",
",",
"service_description",
"string",
",",
"check_time",
"<mask>",
".",
"Time",
",",
")",
"*",
"livestatus",
".",
"Command",
"{",
"return",
"livestatus",
".",
"NewCommand",
"(",
"\"",
"\"",
",",
"stringifyArg",
"(",
"\"",
"\"",
",",
"\"",
"\"",
",",
"host_name",
")",
",",
"stringifyArg",
"(",
"\"",
"\"",
",",
"\"",
"\"",
",",
"service_description",
")",
",",
"stringifyArg",
"(",
"\"",
"\"",
",",
"\"",
"\"",
",",
"check_time",
")",
",",
")",
"\n",
"}"
] |
8,996 | all-8997 | [
"setLog",
"sets",
"the",
"logger",
"."
] | [
"func",
"setLog",
"(",
"l",
"*",
"log",
".",
"Logger",
")",
"{",
"if",
"l",
"!=",
"nil",
"{",
"logger",
"=",
"l",
"\n",
"}",
"else",
"{",
"logger",
"=",
"<mask>",
".",
"New",
"(",
"ioutil",
".",
"Discard",
",",
"\"",
"\"",
",",
"0",
")",
"\n",
"}",
"\n",
"}"
] |
8,997 | all-8998 | [
"UpdateAll",
"finds",
"all",
"documents",
"matching",
"the",
"provided",
"selector",
"document",
"and",
"modifies",
"them",
"according",
"to",
"the",
"update",
"document",
".",
"If",
"the",
"session",
"is",
"in",
"safe",
"mode",
"(",
"see",
"SetSafe",
")",
"details",
"of",
"the",
"executed",
"operation",
"are",
"returned",
"in",
"info",
"or",
"an",
"error",
"of",
"type",
"*",
"LastError",
"when",
"some",
"problem",
"is",
"detected",
".",
"It",
"is",
"not",
"an",
"error",
"for",
"the",
"update",
"to",
"not",
"be",
"applied",
"on",
"any",
"documents",
"because",
"the",
"selector",
"doesn",
"t",
"match",
".",
"Relevant",
"documentation",
":",
"http",
":",
"//",
"www",
".",
"mongodb",
".",
"org",
"/",
"display",
"/",
"DOCS",
"/",
"Updating",
"http",
":",
"//",
"www",
".",
"mongodb",
".",
"org",
"/",
"display",
"/",
"DOCS",
"/",
"Atomic",
"+",
"Operations"
] | [
"func",
"(",
"c",
"*",
"Collection",
")",
"UpdateAll",
"(",
"selector",
"<mask>",
"{",
"}",
",",
"update",
"interface",
"{",
"}",
")",
"(",
"info",
"*",
"ChangeInfo",
",",
"err",
"error",
")",
"{",
"lerr",
",",
"err",
":=",
"c",
".",
"writeQuery",
"(",
"&",
"updateOp",
"{",
"c",
".",
"FullName",
",",
"selector",
",",
"update",
",",
"2",
"}",
")",
"\n",
"if",
"err",
"==",
"nil",
"&&",
"lerr",
"!=",
"nil",
"{",
"info",
"=",
"&",
"ChangeInfo",
"{",
"Updated",
":",
"lerr",
".",
"N",
"}",
"\n",
"}",
"\n",
"return",
"info",
",",
"err",
"\n",
"}"
] |
8,998 | all-8999 | [
"MarshalEasyJSON",
"satisfies",
"easyjson",
".",
"Marshaler",
"."
] | [
"func",
"(",
"t",
"ExceptionsState",
")",
"MarshalEasyJSON",
"(",
"out",
"*",
"jwriter",
".",
"Writer",
")",
"{",
"<mask>",
".",
"String",
"(",
"string",
"(",
"t",
")",
")",
"\n",
"}"
] |
8,999 | all-9000 | [
"MenuNew",
"()",
"is",
"a",
"wrapper",
"around",
"gtk_menu_new",
"()",
"."
] | [
"func",
"MenuNew",
"(",
")",
"(",
"*",
"<mask>",
",",
"error",
")",
"{",
"c",
":=",
"C",
".",
"gtk_menu_new",
"(",
")",
"\n",
"if",
"c",
"==",
"nil",
"{",
"return",
"nil",
",",
"nilPtrErr",
"\n",
"}",
"\n",
"return",
"wrapMenu",
"(",
"glib",
".",
"Take",
"(",
"unsafe",
".",
"Pointer",
"(",
"c",
")",
")",
")",
",",
"nil",
"\n",
"}"
] |
Subsets and Splits
No saved queries yet
Save your SQL queries to embed, download, and access them later. Queries will appear here once saved.