id
int32 0
25.3k
| idx
stringlengths 5
9
| nl_tokens
listlengths 1
418
| pl_tokens
listlengths 22
4.98k
|
---|---|---|---|
22,800 | all-22801 | [
"UnmarshalEd25519PrivateKey",
"returns",
"a",
"private",
"key",
"from",
"input",
"bytes",
"."
] | [
"func",
"UnmarshalEd25519PrivateKey",
"(",
"data",
"[",
"]",
"byte",
")",
"(",
"PrivKey",
",",
"error",
")",
"{",
"switch",
"len",
"(",
"data",
")",
"{",
"case",
"ed25519",
".",
"PrivateKeySize",
"+",
"ed25519",
".",
"PublicKeySize",
":",
"// Remove the redundant public key. See issue #36.",
"redundantPk",
":=",
"<mask>",
"[",
"ed25519",
".",
"PrivateKeySize",
":",
"]",
"\n",
"pk",
":=",
"data",
"[",
"ed25519",
".",
"PrivateKeySize",
"-",
"ed25519",
".",
"PublicKeySize",
":",
"ed25519",
".",
"PrivateKeySize",
"]",
"\n",
"if",
"!",
"bytes",
".",
"Equal",
"(",
"pk",
",",
"redundantPk",
")",
"{",
"return",
"nil",
",",
"errors",
".",
"New",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"// No point in storing the extra data.",
"newKey",
":=",
"make",
"(",
"[",
"]",
"byte",
",",
"ed25519",
".",
"PrivateKeySize",
")",
"\n",
"copy",
"(",
"newKey",
",",
"data",
"[",
":",
"ed25519",
".",
"PrivateKeySize",
"]",
")",
"\n",
"data",
"=",
"newKey",
"\n",
"case",
"ed25519",
".",
"PrivateKeySize",
":",
"default",
":",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"ed25519",
".",
"PrivateKeySize",
",",
"ed25519",
".",
"PrivateKeySize",
"+",
"ed25519",
".",
"PublicKeySize",
",",
"len",
"(",
"data",
")",
",",
")",
"\n",
"}",
"\n\n",
"return",
"&",
"Ed25519PrivateKey",
"{",
"k",
":",
"ed25519",
".",
"PrivateKey",
"(",
"data",
")",
",",
"}",
",",
"nil",
"\n",
"}"
] |
22,801 | all-22802 | [
"writeByte",
"adds",
"a",
"byte",
"to",
"the",
"string",
"being",
"printed",
"."
] | [
"func",
"(",
"ps",
"*",
"printState",
")",
"writeByte",
"(",
"b",
"byte",
")",
"{",
"ps",
".",
"last",
"=",
"b",
"\n",
"<mask>",
".",
"buf",
".",
"WriteByte",
"(",
"b",
")",
"\n",
"}"
] |
22,802 | all-22803 | [
"Returns",
"an",
"slice",
"of",
"map",
"[",
"string",
"]",
"interfaces",
"or",
"a",
"nil",
"slice"
] | [
"func",
"(",
"t",
"Typed",
")",
"Maps",
"(",
"key",
"string",
")",
"[",
"]",
"map",
"[",
"string",
"]",
"interface",
"{",
"}",
"{",
"value",
",",
"exists",
":=",
"t",
"[",
"key",
"]",
"\n",
"if",
"exists",
"==",
"true",
"{",
"if",
"a",
",",
"ok",
":=",
"value",
".",
"(",
"[",
"]",
"interface",
"{",
"}",
")",
";",
"<mask>",
"{",
"l",
":=",
"len",
"(",
"a",
")",
"\n",
"n",
":=",
"make",
"(",
"[",
"]",
"map",
"[",
"string",
"]",
"interface",
"{",
"}",
",",
"l",
")",
"\n",
"for",
"i",
":=",
"0",
";",
"i",
"<",
"l",
";",
"i",
"++",
"{",
"n",
"[",
"i",
"]",
"=",
"a",
"[",
"i",
"]",
".",
"(",
"map",
"[",
"string",
"]",
"interface",
"{",
"}",
")",
"\n",
"}",
"\n",
"return",
"n",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
] |
22,803 | all-22804 | [
"ConstructMuxVar",
"constructs",
"the",
"mux",
"var",
"that",
"is",
"used",
"in",
"the",
"gorilla",
"/",
"mux",
"styled",
"path",
"example",
":",
"{",
"id",
"}",
"{",
"id",
":",
"[",
"0",
"-",
"9",
"]",
"+",
"}",
"."
] | [
"func",
"ConstructMuxVar",
"(",
"name",
"string",
",",
"pattern",
"string",
")",
"string",
"{",
"if",
"pattern",
"==",
"\"",
"\"",
"{",
"return",
"\"",
"\"",
"+",
"<mask>",
"+",
"\"",
"\"",
"\n",
"}",
"\n\n",
"return",
"\"",
"\"",
"+",
"name",
"+",
"\"",
"\"",
"+",
"pattern",
"+",
"\"",
"\"",
"\n",
"}"
] |
22,804 | all-22805 | [
"AddTagsToHost",
"does",
"exactly",
"what",
"it",
"says",
"on",
"the",
"tin",
".",
"Given",
"a",
"list",
"of",
"tags",
"add",
"them",
"to",
"the",
"host",
".",
"The",
"source",
"is",
"optionally",
"specified",
"and",
"defaults",
"to",
"users",
"as",
"per",
"the",
"API",
"documentation",
"."
] | [
"func",
"(",
"client",
"*",
"Client",
")",
"AddTagsToHost",
"(",
"host",
",",
"source",
"string",
",",
"tags",
"[",
"]",
"string",
")",
"error",
"{",
"uri",
":=",
"\"",
"\"",
"+",
"host",
"\n",
"if",
"source",
"!=",
"\"",
"\"",
"{",
"uri",
"+=",
"\"",
"\"",
"+",
"source",
"\n",
"}",
"\n",
"return",
"<mask>",
".",
"doJsonRequest",
"(",
"\"",
"\"",
",",
"uri",
",",
"reqGetHostTags",
"{",
"Tags",
":",
"tags",
"}",
",",
"nil",
")",
"\n",
"}"
] |
22,805 | all-22806 | [
"expandVirtualMachineConfigSpecChanged",
"compares",
"an",
"existing",
"VirtualMachineConfigInfo",
"with",
"a",
"VirtualMachineConfigSpec",
"generated",
"from",
"existing",
"resource",
"data",
"and",
"compares",
"them",
"to",
"see",
"if",
"there",
"is",
"a",
"change",
".",
"The",
"new",
"spec",
"It",
"does",
"this",
"be",
"creating",
"a",
"fake",
"ResourceData",
"off",
"of",
"the",
"VM",
"resource",
"schema",
"flattening",
"the",
"config",
"info",
"into",
"that",
"and",
"then",
"expanding",
"both",
"ResourceData",
"instances",
"and",
"comparing",
"the",
"resultant",
"ConfigSpecs",
"."
] | [
"func",
"expandVirtualMachineConfigSpecChanged",
"(",
"d",
"*",
"schema",
".",
"ResourceData",
",",
"client",
"*",
"govmomi",
".",
"Client",
",",
"info",
"*",
"types",
".",
"VirtualMachineConfigInfo",
")",
"(",
"types",
".",
"VirtualMachineConfigSpec",
",",
"bool",
",",
"error",
")",
"{",
"// Create the fake ResourceData from the VM resource",
"oldData",
":=",
"resourceVSphereVirtualMachine",
"(",
")",
".",
"Data",
"(",
"&",
"terraform",
".",
"InstanceState",
"{",
"}",
")",
"\n",
"oldData",
".",
"SetId",
"(",
"d",
".",
"Id",
"(",
")",
")",
"\n",
"// Flatten the old config info into it",
"flattenVirtualMachineConfigInfo",
"(",
"oldData",
",",
"info",
")",
"\n",
"// Read state back in. This is necessary to ensure GetChange calls work",
"// correctly.",
"oldData",
"=",
"resourceVSphereVirtualMachine",
"(",
")",
".",
"Data",
"(",
"oldData",
".",
"State",
"(",
")",
")",
"\n",
"// Get both specs.",
"<mask>",
".",
"Printf",
"(",
"\"",
"\"",
",",
"resourceVSphereVirtualMachineIDString",
"(",
"d",
")",
")",
"\n",
"oldSpec",
",",
"err",
":=",
"expandVirtualMachineConfigSpec",
"(",
"oldData",
",",
"client",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"types",
".",
"VirtualMachineConfigSpec",
"{",
"}",
",",
"false",
",",
"err",
"\n",
"}",
"\n",
"log",
".",
"Printf",
"(",
"\"",
"\"",
",",
"resourceVSphereVirtualMachineIDString",
"(",
"d",
")",
")",
"\n\n",
"newSpec",
",",
"err",
":=",
"expandVirtualMachineConfigSpec",
"(",
"d",
",",
"client",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"types",
".",
"VirtualMachineConfigSpec",
"{",
"}",
",",
"false",
",",
"err",
"\n",
"}",
"\n\n",
"// Return the new spec and compare",
"return",
"newSpec",
",",
"!",
"reflect",
".",
"DeepEqual",
"(",
"oldSpec",
",",
"newSpec",
")",
",",
"nil",
"\n",
"}"
] |
22,806 | all-22807 | [
"IsDateTime",
"returns",
"true",
"when",
"the",
"string",
"is",
"a",
"valid",
"date",
"-",
"time"
] | [
"func",
"IsDateTime",
"(",
"str",
"string",
")",
"bool",
"{",
"if",
"len",
"(",
"str",
")",
"<",
"4",
"{",
"return",
"false",
"\n",
"}",
"\n",
"s",
":=",
"strings",
".",
"Split",
"(",
"strings",
".",
"ToLower",
"(",
"str",
")",
",",
"\"",
"\"",
")",
"\n",
"if",
"len",
"(",
"s",
")",
"<",
"2",
"||",
"!",
"IsDate",
"(",
"s",
"[",
"0",
"]",
")",
"{",
"return",
"false",
"\n",
"}",
"\n\n",
"matches",
":=",
"rxDateTime",
".",
"FindAllStringSubmatch",
"(",
"s",
"[",
"1",
"]",
",",
"-",
"1",
")",
"\n",
"if",
"len",
"(",
"matches",
")",
"==",
"0",
"||",
"len",
"(",
"matches",
"[",
"0",
"]",
")",
"==",
"0",
"{",
"return",
"false",
"\n",
"}",
"\n",
"m",
":=",
"matches",
"[",
"0",
"]",
"\n",
"<mask>",
":=",
"m",
"[",
"1",
"]",
"<=",
"\"",
"\"",
"&&",
"m",
"[",
"2",
"]",
"<=",
"\"",
"\"",
"&&",
"m",
"[",
"3",
"]",
"<=",
"\"",
"\"",
"\n",
"return",
"res",
"\n",
"}"
] |
22,807 | all-22808 | [
"Decodes",
"the",
"next",
"value",
"from",
"the",
"stream",
"into",
"v",
"."
] | [
"func",
"(",
"d",
"*",
"StreamDecoder",
")",
"Decode",
"(",
"v",
"<mask>",
"{",
"}",
")",
"error",
"{",
"if",
"d",
".",
"err",
"!=",
"nil",
"{",
"return",
"d",
".",
"err",
"\n",
"}",
"\n\n",
"err",
":=",
"error",
"(",
"nil",
")",
"\n",
"cnt",
":=",
"d",
".",
"cnt",
"\n",
"max",
":=",
"d",
".",
"max",
"\n",
"dec",
":=",
"Decoder",
"{",
"Parser",
":",
"d",
".",
"Parser",
",",
"MapType",
":",
"d",
".",
"MapType",
",",
"}",
"\n\n",
"switch",
"d",
".",
"typ",
"{",
"case",
"Unknown",
":",
"err",
"=",
"d",
".",
"init",
"(",
")",
"\n",
"max",
"=",
"d",
".",
"max",
"\n",
"case",
"Array",
":",
"if",
"cnt",
"==",
"max",
"{",
"err",
"=",
"dec",
".",
"Parser",
".",
"ParseArrayEnd",
"(",
"cnt",
")",
"\n",
"}",
"else",
"if",
"cnt",
"!=",
"0",
"{",
"err",
"=",
"dec",
".",
"Parser",
".",
"ParseArrayNext",
"(",
"cnt",
")",
"\n",
"}",
"\n",
"}",
"\n\n",
"if",
"err",
"==",
"nil",
"{",
"if",
"cnt",
"==",
"max",
"{",
"err",
"=",
"End",
"\n",
"}",
"else",
"{",
"switch",
"err",
"=",
"dec",
".",
"Decode",
"(",
"v",
")",
";",
"err",
"{",
"case",
"nil",
":",
"cnt",
"++",
"\n",
"case",
"End",
":",
"cnt",
"++",
"\n",
"max",
"=",
"cnt",
"\n",
"default",
":",
"if",
"max",
"<",
"0",
"&&",
"dec",
".",
"Parser",
".",
"ParseArrayEnd",
"(",
"cnt",
")",
"==",
"nil",
"{",
"err",
"=",
"End",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n\n",
"d",
".",
"err",
"=",
"err",
"\n",
"d",
".",
"cnt",
"=",
"cnt",
"\n",
"d",
".",
"max",
"=",
"max",
"\n",
"return",
"err",
"\n",
"}"
] |
22,808 | all-22809 | [
"CSS",
"returns",
"a",
"CSS",
"style",
"property",
"value",
"for",
"exactly",
"one",
"element",
"."
] | [
"func",
"(",
"s",
"*",
"Selection",
")",
"CSS",
"(",
"property",
"string",
")",
"(",
"string",
",",
"error",
")",
"{",
"return",
"s",
".",
"hasProperty",
"(",
"<mask>",
".",
"Element",
".",
"GetCSS",
",",
"property",
",",
"\"",
"\"",
")",
"\n",
"}"
] |
22,809 | all-22810 | [
"String",
"returns",
"a",
"human",
"readable",
"representation",
"of",
"the",
"type",
"."
] | [
"func",
"(",
"t",
"Type",
")",
"String",
"(",
")",
"string",
"{",
"switch",
"t",
"{",
"case",
"Nil",
":",
"return",
"\"",
"\"",
"\n",
"case",
"Bool",
":",
"return",
"\"",
"\"",
"\n",
"case",
"Int",
":",
"return",
"\"",
"\"",
"\n",
"case",
"Uint",
":",
"return",
"\"",
"\"",
"\n",
"case",
"Float",
":",
"return",
"\"",
"\"",
"\n",
"<mask>",
"String",
":",
"return",
"\"",
"\"",
"\n",
"case",
"Bytes",
":",
"return",
"\"",
"\"",
"\n",
"case",
"Time",
":",
"return",
"\"",
"\"",
"\n",
"case",
"Duration",
":",
"return",
"\"",
"\"",
"\n",
"case",
"Error",
":",
"return",
"\"",
"\"",
"\n",
"case",
"Array",
":",
"return",
"\"",
"\"",
"\n",
"case",
"Map",
":",
"return",
"\"",
"\"",
"\n",
"default",
":",
"return",
"\"",
"\"",
"\n",
"}",
"\n",
"}"
] |
22,810 | all-22811 | [
"GetLink",
"is",
"a",
"wrapper",
"around",
"g_menu_item_get_link",
"()",
"."
] | [
"func",
"(",
"v",
"*",
"MenuItem",
")",
"GetLink",
"(",
"link",
"string",
")",
"*",
"MenuModel",
"{",
"cstr1",
":=",
"(",
"*",
"C",
".",
"gchar",
")",
"(",
"C",
".",
"CString",
"(",
"<mask>",
")",
")",
"\n",
"defer",
"C",
".",
"free",
"(",
"unsafe",
".",
"Pointer",
"(",
"cstr1",
")",
")",
"\n\n",
"c",
":=",
"C",
".",
"g_menu_item_get_link",
"(",
"v",
".",
"native",
"(",
")",
",",
"cstr1",
")",
"\n",
"if",
"c",
"==",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n",
"return",
"wrapMenuModel",
"(",
"wrapObject",
"(",
"unsafe",
".",
"Pointer",
"(",
"c",
")",
")",
")",
"\n",
"}"
] |
22,811 | all-22812 | [
"NewFileTemplateFetcher",
"creates",
"a",
"new",
"struct",
".",
"paths",
"must",
"give",
"us",
"the",
"directories",
"for",
"us",
"to",
"look",
"the",
"templates",
"in"
] | [
"func",
"NewFileTemplateFetcher",
"(",
"paths",
"[",
"]",
"string",
")",
"(",
"*",
"FileTemplateFetcher",
",",
"error",
")",
"{",
"l",
":=",
"&",
"FileTemplateFetcher",
"{",
"Paths",
":",
"make",
"(",
"[",
"]",
"string",
",",
"len",
"(",
"paths",
")",
")",
",",
"}",
"\n",
"for",
"k",
",",
"v",
":=",
"range",
"paths",
"{",
"<mask>",
",",
"err",
":=",
"filepath",
".",
"Abs",
"(",
"v",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"l",
".",
"Paths",
"[",
"k",
"]",
"=",
"abs",
"\n",
"}",
"\n",
"return",
"l",
",",
"nil",
"\n",
"}"
] |
22,812 | all-22813 | [
"InitialState",
"implements",
"the",
"Storage",
"interface",
"."
] | [
"func",
"(",
"ms",
"*",
"MemoryStorage",
")",
"InitialState",
"(",
")",
"(",
"<mask>",
".",
"HardState",
",",
"pb",
".",
"ConfState",
",",
"error",
")",
"{",
"return",
"ms",
".",
"hardState",
",",
"ms",
".",
"snapshot",
".",
"Metadata",
".",
"ConfState",
",",
"nil",
"\n",
"}"
] |
22,813 | all-22814 | [
"Add",
"entry",
".",
"Input",
"and",
"entry",
".",
"Output",
"to",
"schemaURLs",
"if",
"they",
"are",
"set"
] | [
"func",
"(",
"entry",
"*",
"APIEntry",
")",
"postPopulate",
"(",
"apiDef",
"*",
"APIDefinition",
")",
"{",
"if",
"x",
":=",
"&",
"entry",
".",
"Parent",
".",
"apiDef",
".",
"schemaURLs",
";",
"entry",
".",
"Input",
"!=",
"\"",
"\"",
"{",
"entry",
".",
"InputURL",
"=",
"tcurls",
".",
"Schema",
"(",
"tcclient",
".",
"RootURLFromEnvVars",
"(",
")",
",",
"entry",
".",
"Parent",
".",
"ServiceName",
",",
"entry",
".",
"Input",
")",
"\n",
"*",
"x",
"=",
"append",
"(",
"*",
"x",
",",
"entry",
".",
"InputURL",
")",
"\n",
"}",
"\n",
"if",
"x",
":=",
"&",
"<mask>",
".",
"Parent",
".",
"apiDef",
".",
"schemaURLs",
";",
"entry",
".",
"Output",
"!=",
"\"",
"\"",
"{",
"entry",
".",
"OutputURL",
"=",
"tcurls",
".",
"Schema",
"(",
"tcclient",
".",
"RootURLFromEnvVars",
"(",
")",
",",
"entry",
".",
"Parent",
".",
"ServiceName",
",",
"entry",
".",
"Output",
")",
"\n",
"*",
"x",
"=",
"append",
"(",
"*",
"x",
",",
"entry",
".",
"OutputURL",
")",
"\n",
"}",
"\n",
"}"
] |
22,814 | all-22815 | [
"PrintFile",
"values",
"for",
"a",
"pfs",
"file",
"."
] | [
"func",
"PrintFile",
"(",
"w",
"io",
".",
"Writer",
",",
"file",
"*",
"pfsclient",
".",
"File",
")",
"{",
"fmt",
".",
"Fprintf",
"(",
"w",
",",
"\"",
"\\t",
"\\t",
"\\t",
"\\n",
"\"",
",",
"file",
".",
"Commit",
".",
"Repo",
".",
"Name",
",",
"file",
".",
"Commit",
".",
"ID",
",",
"file",
".",
"<mask>",
")",
"\n",
"}"
] |
22,815 | all-22816 | [
"/",
"*",
"Error",
"uses",
"msg",
"as",
"a",
"format",
"string",
"with",
"subsequent",
"parameters",
"as",
"values",
"and",
"logs",
"the",
"resulting",
"message",
"to",
"all",
"added",
"loggers",
"at",
"LogLevel",
".",
"LevelError"
] | [
"func",
"(",
"b",
"*",
"<mask>",
")",
"Error",
"(",
"msg",
"string",
")",
"error",
"{",
"return",
"b",
".",
"Log",
"(",
"LevelError",
",",
"nil",
",",
"msg",
")",
"\n",
"}"
] |
22,816 | all-22817 | [
"Returns",
"a",
"string",
"slice",
"+",
"true",
"if",
"valid",
"Returns",
"nil",
"+",
"false",
"otherwise",
"(",
"returns",
"nil",
"+",
"false",
"if",
"one",
"of",
"the",
"values",
"is",
"not",
"a",
"valid",
"string",
")"
] | [
"func",
"(",
"t",
"Typed",
")",
"StringsIf",
"(",
"key",
"string",
")",
"(",
"[",
"]",
"string",
",",
"bool",
")",
"{",
"value",
",",
"exists",
":=",
"t",
"[",
"key",
"]",
"\n",
"if",
"exists",
"==",
"false",
"{",
"return",
"nil",
",",
"false",
"\n",
"}",
"\n",
"if",
"n",
",",
"<mask>",
":=",
"value",
".",
"(",
"[",
"]",
"string",
")",
";",
"ok",
"{",
"return",
"n",
",",
"true",
"\n",
"}",
"\n",
"if",
"a",
",",
"ok",
":=",
"value",
".",
"(",
"[",
"]",
"interface",
"{",
"}",
")",
";",
"ok",
"{",
"l",
":=",
"len",
"(",
"a",
")",
"\n",
"n",
":=",
"make",
"(",
"[",
"]",
"string",
",",
"l",
")",
"\n",
"var",
"ok",
"bool",
"\n",
"for",
"i",
":=",
"0",
";",
"i",
"<",
"l",
";",
"i",
"++",
"{",
"if",
"n",
"[",
"i",
"]",
",",
"ok",
"=",
"a",
"[",
"i",
"]",
".",
"(",
"string",
")",
";",
"ok",
"==",
"false",
"{",
"return",
"n",
",",
"false",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"n",
",",
"true",
"\n",
"}",
"\n",
"return",
"nil",
",",
"false",
"\n",
"}"
] |
22,817 | all-22818 | [
"WithTimeout",
"adds",
"the",
"timeout",
"to",
"the",
"add",
"Vm",
"params"
] | [
"func",
"(",
"o",
"*",
"AddVMParams",
")",
"WithTimeout",
"(",
"timeout",
"<mask>",
".",
"Duration",
")",
"*",
"AddVMParams",
"{",
"o",
".",
"SetTimeout",
"(",
"timeout",
")",
"\n",
"return",
"o",
"\n",
"}"
] |
22,818 | all-22819 | [
"DateValue",
"returns",
"the",
"value",
"of",
"the",
"Date",
"pointer",
"passed",
"in",
"or",
"the",
"default",
"value",
"if",
"the",
"pointer",
"is",
"nil",
"."
] | [
"func",
"DateValue",
"(",
"v",
"*",
"strfmt",
".",
"<mask>",
")",
"strfmt",
".",
"Date",
"{",
"if",
"v",
"==",
"nil",
"{",
"return",
"strfmt",
".",
"Date",
"{",
"}",
"\n",
"}",
"\n\n",
"return",
"*",
"v",
"\n",
"}"
] |
22,819 | all-22820 | [
"Add",
"adds",
"the",
"response",
"of",
"a",
"request",
"to",
"the",
"cache",
"if",
"its",
"revision",
"is",
"larger",
"than",
"the",
"compacted",
"revision",
"of",
"the",
"cache",
"."
] | [
"func",
"(",
"c",
"*",
"cache",
")",
"Add",
"(",
"req",
"*",
"pb",
".",
"RangeRequest",
",",
"resp",
"*",
"pb",
".",
"RangeResponse",
")",
"{",
"key",
":=",
"keyFunc",
"(",
"req",
")",
"\n\n",
"c",
".",
"mu",
".",
"Lock",
"(",
")",
"\n",
"defer",
"c",
".",
"mu",
".",
"Unlock",
"(",
")",
"\n\n",
"if",
"req",
".",
"Revision",
">",
"c",
".",
"compactedRev",
"{",
"c",
".",
"lru",
".",
"Add",
"(",
"key",
",",
"resp",
")",
"\n",
"}",
"\n",
"// we do not need to invalidate a request with a revision specified.",
"// so we do not need to add it into the reverse index.",
"if",
"req",
".",
"Revision",
"!=",
"0",
"{",
"return",
"\n",
"}",
"\n\n",
"var",
"(",
"iv",
"*",
"adt",
".",
"IntervalValue",
"\n",
"ivl",
"adt",
".",
"Interval",
"\n",
")",
"\n",
"if",
"len",
"(",
"req",
".",
"RangeEnd",
")",
"!=",
"0",
"{",
"ivl",
"=",
"adt",
".",
"NewStringAffineInterval",
"(",
"string",
"(",
"req",
".",
"Key",
")",
",",
"string",
"(",
"req",
".",
"RangeEnd",
")",
")",
"\n",
"}",
"else",
"{",
"ivl",
"=",
"adt",
".",
"NewStringAffinePoint",
"(",
"string",
"(",
"req",
".",
"Key",
")",
")",
"\n",
"}",
"\n\n",
"iv",
"=",
"c",
".",
"cachedRanges",
".",
"Find",
"(",
"ivl",
")",
"\n\n",
"if",
"iv",
"==",
"nil",
"{",
"val",
":=",
"map",
"[",
"string",
"]",
"struct",
"{",
"}",
"{",
"key",
":",
"{",
"}",
"}",
"\n",
"c",
".",
"cachedRanges",
".",
"Insert",
"(",
"ivl",
",",
"val",
")",
"\n",
"}",
"else",
"{",
"val",
":=",
"<mask>",
".",
"Val",
".",
"(",
"map",
"[",
"string",
"]",
"struct",
"{",
"}",
")",
"\n",
"val",
"[",
"key",
"]",
"=",
"struct",
"{",
"}",
"{",
"}",
"\n",
"iv",
".",
"Val",
"=",
"val",
"\n",
"}",
"\n",
"}"
] |
22,820 | all-22821 | [
"Add",
"new",
"storage",
"pool",
"config",
"."
] | [
"func",
"storagePoolConfigAdd",
"(",
"<mask>",
"*",
"sql",
".",
"Tx",
",",
"poolID",
",",
"nodeID",
"int64",
",",
"poolConfig",
"map",
"[",
"string",
"]",
"string",
")",
"error",
"{",
"str",
":=",
"\"",
"\"",
"\n",
"stmt",
",",
"err",
":=",
"tx",
".",
"Prepare",
"(",
"str",
")",
"\n",
"defer",
"stmt",
".",
"Close",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"for",
"k",
",",
"v",
":=",
"range",
"poolConfig",
"{",
"if",
"v",
"==",
"\"",
"\"",
"{",
"continue",
"\n",
"}",
"\n",
"var",
"nodeIDValue",
"interface",
"{",
"}",
"\n",
"if",
"!",
"shared",
".",
"StringInSlice",
"(",
"k",
",",
"StoragePoolNodeConfigKeys",
")",
"{",
"nodeIDValue",
"=",
"nil",
"\n",
"}",
"else",
"{",
"nodeIDValue",
"=",
"nodeID",
"\n",
"}",
"\n\n",
"_",
",",
"err",
"=",
"stmt",
".",
"Exec",
"(",
"poolID",
",",
"nodeIDValue",
",",
"k",
",",
"v",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"}",
"\n\n",
"return",
"nil",
"\n",
"}"
] |
22,821 | all-22822 | [
"Next",
"()",
"returns",
"the",
"current",
"value",
"in",
"the",
"iteration",
"and",
"advances",
"the",
"interator",
".",
"Next",
"()",
"will",
"produce",
"a",
"valid",
"result",
"as",
"long",
"as",
"a",
"call",
"to",
"isDone",
"()",
"returns",
"false",
"."
] | [
"func",
"(",
"it",
"*",
"inclusiveRangeIt",
")",
"Next",
"(",
")",
"int",
"{",
"val",
",",
"err",
":=",
"it",
".",
"ptr",
".",
"Value",
"(",
"it",
".",
"pos",
")",
"\n",
"it",
".",
"pos",
"++",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"<mask>",
".",
"ptr",
".",
"End",
"(",
")",
"\n",
"}",
"\n",
"return",
"val",
"\n",
"}"
] |
22,822 | all-22823 | [
"ScaleButtonNew",
"()",
"is",
"a",
"wrapper",
"around",
"gtk_scale_button_new",
"()",
"."
] | [
"func",
"ScaleButtonNew",
"(",
"size",
"IconSize",
",",
"min",
",",
"max",
",",
"<mask>",
"float64",
",",
"icons",
"[",
"]",
"string",
")",
"(",
"*",
"ScaleButton",
",",
"error",
")",
"{",
"cicons",
":=",
"make",
"(",
"[",
"]",
"*",
"C",
".",
"gchar",
",",
"len",
"(",
"icons",
")",
")",
"\n",
"for",
"i",
",",
"icon",
":=",
"range",
"icons",
"{",
"cicons",
"[",
"i",
"]",
"=",
"(",
"*",
"C",
".",
"gchar",
")",
"(",
"C",
".",
"CString",
"(",
"icon",
")",
")",
"\n",
"defer",
"C",
".",
"free",
"(",
"unsafe",
".",
"Pointer",
"(",
"cicons",
"[",
"i",
"]",
")",
")",
"\n",
"}",
"\n",
"cicons",
"=",
"append",
"(",
"cicons",
",",
"nil",
")",
"\n\n",
"c",
":=",
"C",
".",
"gtk_scale_button_new",
"(",
"C",
".",
"GtkIconSize",
"(",
"size",
")",
",",
"C",
".",
"gdouble",
"(",
"min",
")",
",",
"C",
".",
"gdouble",
"(",
"max",
")",
",",
"C",
".",
"gdouble",
"(",
"step",
")",
",",
"&",
"cicons",
"[",
"0",
"]",
")",
"\n",
"if",
"c",
"==",
"nil",
"{",
"return",
"nil",
",",
"nilPtrErr",
"\n",
"}",
"\n",
"return",
"wrapScaleButton",
"(",
"glib",
".",
"Take",
"(",
"unsafe",
".",
"Pointer",
"(",
"c",
")",
")",
")",
",",
"nil",
"\n",
"}"
] |
22,823 | all-22824 | [
"Do",
"executes",
"DOM",
".",
"getNodeForLocation",
"against",
"the",
"provided",
"context",
".",
"returns",
":",
"backendNodeID",
"-",
"Resulting",
"node",
".",
"nodeID",
"-",
"Id",
"of",
"the",
"node",
"at",
"given",
"coordinates",
"only",
"when",
"enabled",
"and",
"requested",
"document",
"."
] | [
"func",
"(",
"p",
"*",
"GetNodeForLocationParams",
")",
"Do",
"(",
"ctx",
"context",
".",
"Context",
")",
"(",
"backendNodeID",
"cdp",
".",
"BackendNodeID",
",",
"nodeID",
"cdp",
".",
"NodeID",
",",
"err",
"error",
")",
"{",
"// execute",
"var",
"res",
"GetNodeForLocationReturns",
"\n",
"err",
"=",
"cdp",
".",
"Execute",
"(",
"ctx",
",",
"CommandGetNodeForLocation",
",",
"p",
",",
"&",
"res",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"0",
",",
"0",
",",
"err",
"\n",
"}",
"\n\n",
"return",
"res",
".",
"BackendNodeID",
",",
"<mask>",
".",
"NodeID",
",",
"nil",
"\n",
"}"
] |
22,824 | all-22825 | [
"cleanHost",
"is",
"used",
"to",
"conver",
"from",
"the",
"rawHost",
"format",
"to",
"a",
"more",
"usable",
"format"
] | [
"func",
"(",
"host",
"rawHost",
")",
"cleanHost",
"(",
")",
"Host",
"{",
"output",
":=",
"Host",
"{",
"nil",
",",
"host",
".",
"Status",
".",
"State",
",",
"host",
".",
"Address",
".",
"Address",
",",
"host",
".",
"Address",
".",
"AddressType",
",",
"[",
"]",
"Hostname",
"{",
"}",
",",
"[",
"]",
"Port",
"{",
"}",
",",
"}",
"\n\n",
"for",
"_",
",",
"hostname",
":=",
"range",
"host",
".",
"Hostnames",
".",
"Hostnames",
"{",
"output",
".",
"Hostnames",
"=",
"append",
"(",
"output",
".",
"Hostnames",
",",
"Hostname",
"{",
"hostname",
".",
"Name",
",",
"hostname",
".",
"<mask>",
"}",
")",
"\n",
"}",
"\n",
"for",
"_",
",",
"port",
":=",
"range",
"host",
".",
"Ports",
".",
"Ports",
"{",
"output",
".",
"Ports",
"=",
"append",
"(",
"output",
".",
"Ports",
",",
"port",
".",
"cleanPort",
"(",
")",
")",
"\n",
"}",
"\n\n",
"return",
"output",
"\n",
"}"
] |
22,825 | all-22826 | [
"endpointsFromIngress",
"extracts",
"the",
"endpoints",
"from",
"ingress",
"object"
] | [
"func",
"endpointsFromIngress",
"(",
"ing",
"*",
"v1beta1",
".",
"Ingress",
",",
"ignoreHostnameAnnotation",
"bool",
")",
"[",
"]",
"*",
"endpoint",
".",
"Endpoint",
"{",
"var",
"endpoints",
"[",
"]",
"*",
"endpoint",
".",
"Endpoint",
"\n\n",
"ttl",
",",
"err",
":=",
"getTTLFromAnnotations",
"(",
"ing",
".",
"Annotations",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"log",
".",
"Warn",
"(",
"err",
")",
"\n",
"}",
"\n\n",
"targets",
":=",
"getTargetsFromTargetAnnotation",
"(",
"ing",
".",
"Annotations",
")",
"\n\n",
"if",
"len",
"(",
"targets",
")",
"==",
"0",
"{",
"targets",
"=",
"targetsFromIngressStatus",
"(",
"ing",
".",
"<mask>",
")",
"\n",
"}",
"\n\n",
"providerSpecific",
":=",
"getProviderSpecificAnnotations",
"(",
"ing",
".",
"Annotations",
")",
"\n\n",
"for",
"_",
",",
"rule",
":=",
"range",
"ing",
".",
"Spec",
".",
"Rules",
"{",
"if",
"rule",
".",
"Host",
"==",
"\"",
"\"",
"{",
"continue",
"\n",
"}",
"\n",
"endpoints",
"=",
"append",
"(",
"endpoints",
",",
"endpointsForHostname",
"(",
"rule",
".",
"Host",
",",
"targets",
",",
"ttl",
",",
"providerSpecific",
")",
"...",
")",
"\n",
"}",
"\n\n",
"for",
"_",
",",
"tls",
":=",
"range",
"ing",
".",
"Spec",
".",
"TLS",
"{",
"for",
"_",
",",
"host",
":=",
"range",
"tls",
".",
"Hosts",
"{",
"if",
"host",
"==",
"\"",
"\"",
"{",
"continue",
"\n",
"}",
"\n",
"endpoints",
"=",
"append",
"(",
"endpoints",
",",
"endpointsForHostname",
"(",
"host",
",",
"targets",
",",
"ttl",
",",
"providerSpecific",
")",
"...",
")",
"\n",
"}",
"\n",
"}",
"\n\n",
"// Skip endpoints if we do not want entries from annotations",
"if",
"!",
"ignoreHostnameAnnotation",
"{",
"hostnameList",
":=",
"getHostnamesFromAnnotations",
"(",
"ing",
".",
"Annotations",
")",
"\n",
"for",
"_",
",",
"hostname",
":=",
"range",
"hostnameList",
"{",
"endpoints",
"=",
"append",
"(",
"endpoints",
",",
"endpointsForHostname",
"(",
"hostname",
",",
"targets",
",",
"ttl",
",",
"providerSpecific",
")",
"...",
")",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"endpoints",
"\n",
"}"
] |
22,826 | all-22827 | [
"ListZones",
"wraps",
"the",
"List",
"method",
"of",
"the",
"API",
"s",
"Zones",
"service"
] | [
"func",
"(",
"n",
"NS1DomainService",
")",
"ListZones",
"(",
")",
"(",
"[",
"]",
"*",
"dns",
".",
"Zone",
",",
"*",
"<mask>",
".",
"Response",
",",
"error",
")",
"{",
"return",
"n",
".",
"service",
".",
"Zones",
".",
"List",
"(",
")",
"\n",
"}"
] |
22,827 | all-22828 | [
"/",
"*",
"Given",
"a",
"planner",
"creates",
"a",
"function",
"which",
"will",
"evaluate",
"a",
"specific",
"precedence",
"level",
"of",
"operators",
"and",
"link",
"it",
"to",
"other",
"precedent",
"s",
"which",
"recurse",
"to",
"parse",
"other",
"precedence",
"levels",
"."
] | [
"func",
"makePrecedentFromPlanner",
"(",
"planner",
"*",
"precedencePlanner",
")",
"precedent",
"{",
"var",
"generated",
"precedent",
"\n",
"var",
"nextRight",
"precedent",
"\n\n",
"generated",
"=",
"func",
"(",
"stream",
"*",
"tokenStream",
")",
"(",
"*",
"evaluationStage",
",",
"error",
")",
"{",
"return",
"planPrecedenceLevel",
"(",
"stream",
",",
"planner",
".",
"typeErrorFormat",
",",
"planner",
".",
"validSymbols",
",",
"planner",
".",
"validKinds",
",",
"nextRight",
",",
"planner",
".",
"<mask>",
",",
")",
"\n",
"}",
"\n\n",
"if",
"planner",
".",
"nextRight",
"!=",
"nil",
"{",
"nextRight",
"=",
"planner",
".",
"nextRight",
"\n",
"}",
"else",
"{",
"nextRight",
"=",
"generated",
"\n",
"}",
"\n\n",
"return",
"generated",
"\n",
"}"
] |
22,828 | all-22829 | [
"ReStock",
"-",
"this",
"will",
"reclaim",
"resources",
"for",
"a",
"given",
"lease"
] | [
"func",
"(",
"s",
"*",
"Lease",
")",
"ReStock",
"(",
")",
"(",
"skuTask",
"*",
"taskmanager",
".",
"Task",
")",
"{",
"if",
"skuConstructor",
",",
"ok",
":=",
"s",
".",
"availableSkus",
"[",
"s",
".",
"Sku",
"]",
";",
"ok",
"{",
"leaseMap",
":=",
"structs",
".",
"<mask>",
"(",
"s",
")",
"\n",
"sku",
":=",
"skuConstructor",
".",
"New",
"(",
"s",
".",
"taskManager",
",",
"leaseMap",
")",
"\n",
"skuTask",
"=",
"sku",
".",
"ReStock",
"(",
")",
"\n",
"s",
".",
"Task",
"=",
"skuTask",
".",
"GetRedactedVersion",
"(",
")",
"\n\n",
"}",
"else",
"{",
"s",
".",
"Task",
".",
"Status",
"=",
"TaskStatusUnavailable",
"\n",
"}",
"\n",
"return",
"\n",
"}"
] |
22,829 | all-22830 | [
"PSCSettle",
"calls",
"settle",
"method",
"of",
"Privatix",
"service",
"contract",
"."
] | [
"func",
"(",
"b",
"*",
"backendInstance",
")",
"PSCSettle",
"(",
"opts",
"*",
"bind",
".",
"TransactOpts",
",",
"agent",
"common",
".",
"Address",
",",
"blockNumber",
"uint32",
",",
"<mask>",
"[",
"common",
".",
"HashLength",
"]",
"byte",
")",
"(",
"*",
"types",
".",
"Transaction",
",",
"error",
")",
"{",
"ctx2",
",",
"cancel",
":=",
"b",
".",
"addTimeout",
"(",
"opts",
".",
"Context",
")",
"\n",
"defer",
"cancel",
"(",
")",
"\n\n",
"opts",
".",
"Context",
"=",
"ctx2",
"\n\n",
"tx",
",",
"err",
":=",
"b",
".",
"psc",
".",
"Settle",
"(",
"opts",
",",
"agent",
",",
"blockNumber",
",",
"hash",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"err",
"=",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
"+",
"\"",
"\"",
",",
"err",
")",
"\n",
"}",
"\n",
"return",
"tx",
",",
"err",
"\n",
"}"
] |
22,830 | all-22831 | [
"readBlockHeader",
"determines",
"and",
"initializes",
"the",
"current",
"decoder",
"for",
"a",
"new",
"decode",
"block",
"."
] | [
"func",
"(",
"d",
"*",
"decoder29",
")",
"readBlockHeader",
"(",
")",
"error",
"{",
"d",
".",
"br",
".",
"alignByte",
"(",
")",
"\n",
"n",
",",
"err",
":=",
"d",
".",
"br",
".",
"readBits",
"(",
"1",
")",
"\n",
"if",
"err",
"==",
"nil",
"{",
"if",
"n",
">",
"0",
"{",
"d",
".",
"decode",
"=",
"d",
".",
"ppm",
".",
"decode",
"\n",
"err",
"=",
"d",
".",
"ppm",
".",
"init",
"(",
"d",
".",
"br",
")",
"\n",
"}",
"else",
"{",
"d",
".",
"decode",
"=",
"d",
".",
"lz",
".",
"decode",
"\n",
"err",
"=",
"d",
".",
"lz",
".",
"init",
"(",
"d",
".",
"<mask>",
")",
"\n",
"}",
"\n",
"}",
"\n",
"if",
"err",
"==",
"io",
".",
"EOF",
"{",
"err",
"=",
"errDecoderOutOfData",
"\n",
"}",
"\n",
"return",
"err",
"\n\n",
"}"
] |
22,831 | all-22832 | [
"Step",
"advances",
"the",
"state",
"machine",
"using",
"the",
"given",
"message",
"."
] | [
"func",
"(",
"rn",
"*",
"RawNode",
")",
"Step",
"(",
"m",
"<mask>",
".",
"Message",
")",
"error",
"{",
"// ignore unexpected local messages receiving over network",
"if",
"IsLocalMsg",
"(",
"m",
".",
"Type",
")",
"{",
"return",
"ErrStepLocalMsg",
"\n",
"}",
"\n",
"if",
"pr",
":=",
"rn",
".",
"raft",
".",
"getProgress",
"(",
"m",
".",
"From",
")",
";",
"pr",
"!=",
"nil",
"||",
"!",
"IsResponseMsg",
"(",
"m",
".",
"Type",
")",
"{",
"return",
"rn",
".",
"raft",
".",
"Step",
"(",
"m",
")",
"\n",
"}",
"\n",
"return",
"ErrStepPeerNotFound",
"\n",
"}"
] |
22,832 | all-22833 | [
"GetActiveWindow",
"is",
"a",
"wrapper",
"around",
"gdk_screen_get_active_window",
"()",
"."
] | [
"func",
"(",
"v",
"*",
"Screen",
")",
"GetActiveWindow",
"(",
")",
"(",
"*",
"Window",
",",
"<mask>",
")",
"{",
"return",
"toWindow",
"(",
"C",
".",
"gdk_screen_get_active_window",
"(",
"v",
".",
"native",
"(",
")",
")",
")",
"\n",
"}"
] |
22,833 | all-22834 | [
"clientcmdNewConfig",
"is",
"a",
"modified",
"copy",
"of",
"k8s",
".",
"io",
"/",
"kubernetes",
"/",
"pkg",
"/",
"client",
"/",
"unversioned",
"/",
"clientcmd",
"/",
"api",
".",
"NewConfig",
".",
"NewConfig",
"is",
"a",
"convenience",
"function",
"that",
"returns",
"a",
"new",
"Config",
"object",
"with",
"non",
"-",
"nil",
"maps"
] | [
"func",
"clientcmdNewConfig",
"(",
")",
"*",
"clientcmdConfig",
"{",
"return",
"&",
"clientcmdConfig",
"{",
"Clusters",
":",
"<mask>",
"(",
"map",
"[",
"string",
"]",
"*",
"clientcmdCluster",
")",
",",
"AuthInfos",
":",
"make",
"(",
"map",
"[",
"string",
"]",
"*",
"clientcmdAuthInfo",
")",
",",
"Contexts",
":",
"make",
"(",
"map",
"[",
"string",
"]",
"*",
"clientcmdContext",
")",
",",
"}",
"\n",
"}"
] |
22,834 | all-22835 | [
"ReadUint64",
"returns",
"the",
"next",
"value",
"in",
"the",
"buffer",
"as",
"a",
"uint64"
] | [
"func",
"(",
"r",
"*",
"ReadBuffer",
")",
"ReadUint64",
"(",
")",
"uint64",
"{",
"if",
"b",
":=",
"r",
".",
"ReadBytes",
"(",
"8",
")",
";",
"b",
"!=",
"nil",
"{",
"return",
"<mask>",
".",
"BigEndian",
".",
"Uint64",
"(",
"b",
")",
"\n",
"}",
"\n\n",
"return",
"0",
"\n",
"}"
] |
22,835 | all-22836 | [
"IsEquivalent",
"returns",
"true",
"if",
"other",
"represents",
"the",
"same",
"data",
"type",
"as",
"the",
"target",
"."
] | [
"func",
"(",
"e",
"*",
"EnumerableDataType",
")",
"IsEquivalent",
"(",
"other",
"DataType",
")",
"bool",
"{",
"_",
",",
"<mask>",
":=",
"other",
".",
"(",
"*",
"EnumerableDataType",
")",
"\n",
"return",
"ok",
"\n",
"}"
] |
22,836 | all-22837 | [
"GetType",
"returns",
"the",
"Type",
"field",
"if",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"."
] | [
"func",
"(",
"h",
"*",
"HostmapDefinition",
")",
"GetType",
"(",
")",
"string",
"{",
"if",
"h",
"==",
"nil",
"||",
"h",
".",
"Type",
"==",
"nil",
"{",
"return",
"\"",
"\"",
"\n",
"}",
"\n",
"return",
"*",
"h",
".",
"<mask>",
"\n",
"}"
] |
22,837 | all-22838 | [
"GetUrlOk",
"returns",
"a",
"tuple",
"with",
"the",
"Url",
"field",
"if",
"it",
"s",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"and",
"a",
"boolean",
"to",
"check",
"if",
"the",
"value",
"has",
"been",
"set",
"."
] | [
"func",
"(",
"c",
"*",
"<mask>",
")",
"GetUrlOk",
"(",
")",
"(",
"string",
",",
"bool",
")",
"{",
"if",
"c",
"==",
"nil",
"||",
"c",
".",
"Url",
"==",
"nil",
"{",
"return",
"\"",
"\"",
",",
"false",
"\n",
"}",
"\n",
"return",
"*",
"c",
".",
"Url",
",",
"true",
"\n",
"}"
] |
22,838 | all-22839 | [
"retrieve",
"the",
"name",
"of",
"an",
"active",
"uniform",
"block"
] | [
"func",
"GetActiveUniformBlockName",
"(",
"program",
"uint32",
",",
"uniformBlockIndex",
"uint32",
",",
"bufSize",
"int32",
",",
"length",
"*",
"int32",
",",
"uniformBlockName",
"*",
"uint8",
")",
"{",
"syscall",
".",
"Syscall6",
"(",
"gpGetActiveUniformBlockName",
",",
"5",
",",
"uintptr",
"(",
"program",
")",
",",
"uintptr",
"(",
"uniformBlockIndex",
")",
",",
"uintptr",
"(",
"bufSize",
")",
",",
"uintptr",
"(",
"unsafe",
".",
"Pointer",
"(",
"<mask>",
")",
")",
",",
"uintptr",
"(",
"unsafe",
".",
"Pointer",
"(",
"uniformBlockName",
")",
")",
",",
"0",
")",
"\n",
"}"
] |
22,839 | all-22840 | [
"NewHistogram",
"returns",
"a",
"histogram",
"instance",
"."
] | [
"func",
"(",
"m",
"*",
"CirconusMetrics",
")",
"NewHistogram",
"(",
"metric",
"string",
")",
"*",
"Histogram",
"{",
"m",
".",
"hm",
".",
"Lock",
"(",
")",
"\n",
"defer",
"m",
".",
"hm",
".",
"Unlock",
"(",
")",
"\n\n",
"if",
"hist",
",",
"ok",
":=",
"m",
".",
"histograms",
"[",
"metric",
"]",
";",
"ok",
"{",
"return",
"hist",
"\n",
"}",
"\n\n",
"hist",
":=",
"&",
"Histogram",
"{",
"<mask>",
":",
"metric",
",",
"hist",
":",
"circonusllhist",
".",
"New",
"(",
")",
",",
"}",
"\n\n",
"m",
".",
"histograms",
"[",
"metric",
"]",
"=",
"hist",
"\n\n",
"return",
"hist",
"\n",
"}"
] |
22,840 | all-22841 | [
"WriteFile",
"indicates",
"an",
"expected",
"call",
"of",
"WriteFile"
] | [
"func",
"(",
"mr",
"*",
"MockIOUtilMockRecorder",
")",
"WriteFile",
"(",
"arg0",
",",
"arg1",
",",
"arg2",
"<mask>",
"{",
"}",
")",
"*",
"gomock",
".",
"Call",
"{",
"return",
"mr",
".",
"mock",
".",
"ctrl",
".",
"RecordCallWithMethodType",
"(",
"mr",
".",
"mock",
",",
"\"",
"\"",
",",
"reflect",
".",
"TypeOf",
"(",
"(",
"*",
"MockIOUtil",
")",
"(",
"nil",
")",
".",
"WriteFile",
")",
",",
"arg0",
",",
"arg1",
",",
"arg2",
")",
"\n",
"}"
] |
22,841 | all-22842 | [
"specify",
"clear",
"values",
"for",
"the",
"accumulation",
"buffer"
] | [
"func",
"ClearAccum",
"(",
"red",
"float32",
",",
"green",
"float32",
",",
"blue",
"float32",
",",
"alpha",
"float32",
")",
"{",
"syscall",
".",
"Syscall6",
"(",
"gpClearAccum",
",",
"4",
",",
"uintptr",
"(",
"math",
".",
"Float32bits",
"(",
"red",
")",
")",
",",
"uintptr",
"(",
"math",
".",
"Float32bits",
"(",
"<mask>",
")",
")",
",",
"uintptr",
"(",
"math",
".",
"Float32bits",
"(",
"blue",
")",
")",
",",
"uintptr",
"(",
"math",
".",
"Float32bits",
"(",
"alpha",
")",
")",
",",
"0",
",",
"0",
")",
"\n",
"}"
] |
22,842 | all-22843 | [
"BaggageItem",
"belongs",
"to",
"the",
"Span",
"interface"
] | [
"func",
"(",
"s",
"*",
"MockSpan",
")",
"BaggageItem",
"(",
"key",
"string",
")",
"string",
"{",
"s",
".",
"RLock",
"(",
")",
"\n",
"defer",
"s",
".",
"RUnlock",
"(",
")",
"\n",
"return",
"s",
".",
"SpanContext",
".",
"Baggage",
"[",
"<mask>",
"]",
"\n",
"}"
] |
22,843 | all-22844 | [
"NewRadioGroup",
"creates",
"a",
"new",
"RadioGroup"
] | [
"func",
"CreateRadioGroup",
"(",
")",
"*",
"RadioGroup",
"{",
"c",
":=",
"<mask>",
"(",
"RadioGroup",
")",
"\n",
"c",
".",
"items",
"=",
"make",
"(",
"[",
"]",
"*",
"Radio",
",",
"0",
")",
"\n",
"return",
"c",
"\n",
"}"
] |
22,844 | all-22845 | [
"next",
"advances",
"to",
"the",
"next",
"file",
"block",
"in",
"the",
"archive"
] | [
"func",
"(",
"a",
"*",
"archive15",
")",
"next",
"(",
")",
"(",
"*",
"fileBlockHeader",
",",
"error",
")",
"{",
"for",
"{",
"// could return an io.EOF here as 1.5 archives may not have an end block.",
"h",
",",
"err",
":=",
"a",
".",
"readBlockHeader",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"a",
".",
"byteReader",
"=",
"limitByteReader",
"(",
"a",
".",
"v",
",",
"h",
".",
"dataSize",
")",
"// reader for block data",
"\n\n",
"switch",
"h",
".",
"htype",
"{",
"case",
"blockFile",
":",
"return",
"a",
".",
"parseFileHeader",
"(",
"h",
")",
"\n",
"case",
"blockArc",
":",
"a",
".",
"encrypted",
"=",
"h",
".",
"flags",
"&",
"arcEncrypted",
">",
"0",
"\n",
"a",
".",
"multi",
"=",
"h",
".",
"flags",
"&",
"arcVolume",
">",
"0",
"\n",
"a",
".",
"old",
"=",
"h",
".",
"flags",
"&",
"arcNewNaming",
"==",
"0",
"\n",
"a",
".",
"solid",
"=",
"h",
".",
"flags",
"&",
"arcSolid",
">",
"0",
"\n",
"case",
"blockEnd",
":",
"if",
"h",
".",
"<mask>",
"&",
"endArcNotLast",
"==",
"0",
"||",
"!",
"a",
".",
"multi",
"{",
"return",
"nil",
",",
"errArchiveEnd",
"\n",
"}",
"\n",
"return",
"nil",
",",
"errArchiveContinues",
"\n",
"default",
":",
"_",
",",
"err",
"=",
"io",
".",
"Copy",
"(",
"ioutil",
".",
"Discard",
",",
"a",
".",
"byteReader",
")",
"\n",
"}",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"}",
"\n",
"}"
] |
22,845 | all-22846 | [
"newCloudFlareChanges",
"returns",
"a",
"collection",
"of",
"Changes",
"based",
"on",
"the",
"given",
"records",
"and",
"action",
"."
] | [
"func",
"newCloudFlareChanges",
"(",
"action",
"string",
",",
"endpoints",
"[",
"]",
"*",
"endpoint",
".",
"Endpoint",
",",
"proxiedByDefault",
"bool",
")",
"[",
"]",
"*",
"cloudFlareChange",
"{",
"changes",
":=",
"make",
"(",
"[",
"]",
"*",
"cloudFlareChange",
",",
"0",
",",
"len",
"(",
"endpoints",
")",
")",
"\n\n",
"for",
"_",
",",
"endpoint",
":=",
"range",
"endpoints",
"{",
"changes",
"=",
"append",
"(",
"changes",
",",
"newCloudFlareChange",
"(",
"<mask>",
",",
"endpoint",
",",
"proxiedByDefault",
")",
")",
"\n",
"}",
"\n\n",
"return",
"changes",
"\n",
"}"
] |
22,846 | all-22847 | [
"DeleteCheckBundle",
"deletes",
"passed",
"check",
"bundle",
"."
] | [
"func",
"(",
"a",
"*",
"API",
")",
"DeleteCheckBundle",
"(",
"cfg",
"*",
"CheckBundle",
")",
"(",
"bool",
",",
"error",
")",
"{",
"if",
"cfg",
"==",
"nil",
"{",
"return",
"<mask>",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"return",
"a",
".",
"DeleteCheckBundleByCID",
"(",
"CIDType",
"(",
"&",
"cfg",
".",
"CID",
")",
")",
"\n",
"}"
] |
22,847 | all-22848 | [
"GRPCCode",
"returns",
"the",
"corresponding",
"http",
"status",
"code",
"from",
"an",
"error",
"type"
] | [
"func",
"(",
"t",
"Type",
")",
"GRPCCode",
"(",
")",
"codes",
".",
"Code",
"{",
"switch",
"t",
"{",
"case",
"InvalidArgument",
":",
"return",
"codes",
".",
"InvalidArgument",
"\n",
"case",
"OutOfRange",
":",
"return",
"codes",
".",
"OutOfRange",
"\n",
"case",
"NotFound",
":",
"return",
"codes",
".",
"NotFound",
"\n",
"case",
"Conflict",
":",
"case",
"AlreadyExists",
":",
"return",
"codes",
".",
"AlreadyExists",
"\n",
"case",
"Unauthorized",
":",
"return",
"codes",
".",
"Unauthenticated",
"\n",
"case",
"PermissionDenied",
":",
"return",
"codes",
".",
"PermissionDenied",
"\n",
"case",
"Timeout",
":",
"return",
"codes",
".",
"DeadlineExceeded",
"\n",
"case",
"NotImplemented",
":",
"return",
"codes",
".",
"Unimplemented",
"\n",
"case",
"TemporarilyUnavailable",
":",
"return",
"codes",
".",
"Unavailable",
"\n",
"case",
"PermanentlyUnavailable",
":",
"return",
"codes",
".",
"FailedPrecondition",
"\n",
"<mask>",
"Canceled",
":",
"return",
"codes",
".",
"Canceled",
"\n",
"case",
"ResourceExhausted",
":",
"return",
"codes",
".",
"ResourceExhausted",
"\n",
"case",
"Internal",
":",
"case",
"Unknown",
":",
"return",
"codes",
".",
"Unknown",
"\n",
"}",
"\n\n",
"return",
"codes",
".",
"Unknown",
"\n",
"}"
] |
22,848 | all-22849 | [
"put",
"puts",
"the",
"connection",
"back",
"to",
"the",
"pool",
".",
"If",
"the",
"pool",
"is",
"closed",
"put",
"simply",
"close",
"any",
"connections",
"received",
"and",
"return",
"immediately",
".",
"A",
"nil",
"net",
".",
"Conn",
"is",
"illegal",
"and",
"will",
"be",
"rejected",
"."
] | [
"func",
"(",
"p",
"*",
"blockingPool",
")",
"put",
"(",
"conn",
"*",
"WrappedConn",
")",
"error",
"{",
"//in case that pool is closed and pool.conns is set to nil",
"conns",
":=",
"p",
".",
"conns",
"\n",
"if",
"conns",
"==",
"nil",
"{",
"//conn.Conn is possibly nil coz factory() may fail, in which case conn is immediately ",
"//put back to the pool",
"if",
"conn",
".",
"Conn",
"!=",
"nil",
"{",
"conn",
".",
"Conn",
".",
"Close",
"(",
")",
"\n",
"conn",
".",
"Conn",
"=",
"nil",
"\n",
"}",
"\n",
"return",
"ErrClosed",
"\n",
"}",
"\n\n",
"//if conn is marked unusable, underlying net.Conn is set to nil",
"if",
"conn",
".",
"unusable",
"{",
"if",
"<mask>",
".",
"Conn",
"!=",
"nil",
"{",
"conn",
".",
"Conn",
".",
"Close",
"(",
")",
"\n",
"conn",
".",
"Conn",
"=",
"nil",
"\n",
"}",
"\n",
"}",
"\n\n",
"//It is impossible to block as number of connections is never more than length of channel",
"conns",
"<-",
"conn",
"\n",
"return",
"nil",
"\n",
"}"
] |
22,849 | all-22850 | [
"GetHandle",
"returns",
"the",
"Handle",
"field",
"if",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"."
] | [
"func",
"(",
"c",
"*",
"<mask>",
")",
"GetHandle",
"(",
")",
"string",
"{",
"if",
"c",
"==",
"nil",
"||",
"c",
".",
"Handle",
"==",
"nil",
"{",
"return",
"\"",
"\"",
"\n",
"}",
"\n",
"return",
"*",
"c",
".",
"Handle",
"\n",
"}"
] |
22,850 | all-22851 | [
"openBackend",
"returns",
"a",
"backend",
"using",
"the",
"current",
"etcd",
"db",
"."
] | [
"func",
"openBackend",
"(",
"cfg",
"ServerConfig",
")",
"backend",
".",
"Backend",
"{",
"fn",
":=",
"cfg",
".",
"backendPath",
"(",
")",
"\n\n",
"now",
",",
"beOpened",
":=",
"time",
".",
"Now",
"(",
")",
",",
"make",
"(",
"chan",
"backend",
".",
"Backend",
")",
"\n",
"go",
"func",
"(",
")",
"{",
"beOpened",
"<-",
"newBackend",
"(",
"cfg",
")",
"\n",
"}",
"(",
")",
"\n\n",
"select",
"{",
"case",
"be",
":=",
"<-",
"beOpened",
":",
"if",
"cfg",
".",
"Logger",
"!=",
"nil",
"{",
"cfg",
".",
"Logger",
".",
"Info",
"(",
"\"",
"\"",
",",
"zap",
".",
"String",
"(",
"\"",
"\"",
",",
"fn",
")",
",",
"zap",
".",
"Duration",
"(",
"\"",
"\"",
",",
"<mask>",
".",
"Since",
"(",
"now",
")",
")",
")",
"\n",
"}",
"\n",
"return",
"be",
"\n\n",
"case",
"<-",
"time",
".",
"After",
"(",
"10",
"*",
"time",
".",
"Second",
")",
":",
"if",
"cfg",
".",
"Logger",
"!=",
"nil",
"{",
"cfg",
".",
"Logger",
".",
"Info",
"(",
"\"",
"\"",
",",
"zap",
".",
"String",
"(",
"\"",
"\"",
",",
"fn",
")",
",",
"zap",
".",
"Duration",
"(",
"\"",
"\"",
",",
"time",
".",
"Since",
"(",
"now",
")",
")",
",",
")",
"\n",
"}",
"else",
"{",
"plog",
".",
"Warningf",
"(",
"\"",
"\"",
",",
"fn",
")",
"\n",
"plog",
".",
"Warningf",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"}",
"\n\n",
"return",
"<-",
"beOpened",
"\n",
"}"
] |
22,851 | all-22852 | [
"Broadcast",
"runs",
"a",
"go",
"routine",
"for",
"each",
"attempted",
"send",
"which",
"will",
"block",
"trying",
"to",
"send",
"for",
"defaultSendTimeoutSeconds",
".",
"Returns",
"a",
"channel",
"which",
"receives",
"success",
"values",
"for",
"each",
"attempted",
"send",
"(",
"false",
"if",
"times",
"out",
")",
"NOTE",
":",
"Broadcast",
"uses",
"goroutines",
"so",
"order",
"of",
"broadcast",
"may",
"not",
"be",
"preserved",
"."
] | [
"func",
"(",
"sw",
"*",
"Switch",
")",
"Broadcast",
"(",
"chID",
"byte",
",",
"msg",
"interface",
"{",
"}",
")",
"chan",
"bool",
"{",
"successChan",
":=",
"make",
"(",
"chan",
"bool",
",",
"len",
"(",
"sw",
".",
"peers",
".",
"List",
"(",
")",
")",
")",
"\n",
"log",
".",
"Debug",
"(",
"\"",
"\"",
",",
"\"",
"\"",
",",
"chID",
",",
"\"",
"\"",
",",
"msg",
")",
"\n",
"for",
"_",
",",
"peer",
":=",
"range",
"sw",
".",
"peers",
".",
"<mask>",
"(",
")",
"{",
"go",
"func",
"(",
"peer",
"*",
"Peer",
")",
"{",
"success",
":=",
"peer",
".",
"Send",
"(",
"chID",
",",
"msg",
")",
"\n",
"successChan",
"<-",
"success",
"\n",
"}",
"(",
"peer",
")",
"\n",
"}",
"\n",
"return",
"successChan",
"\n",
"}"
] |
22,852 | all-22853 | [
"Querier",
"implements",
"the",
"Storage",
"interface",
"."
] | [
"func",
"(",
"s",
"*",
"ReadyStorage",
")",
"Querier",
"(",
"ctx",
"context",
".",
"Context",
",",
"mint",
",",
"maxt",
"int64",
")",
"(",
"storage",
".",
"Querier",
",",
"error",
")",
"{",
"if",
"x",
":=",
"s",
".",
"<mask>",
"(",
")",
";",
"x",
"!=",
"nil",
"{",
"return",
"x",
".",
"Querier",
"(",
"ctx",
",",
"mint",
",",
"maxt",
")",
"\n",
"}",
"\n",
"return",
"nil",
",",
"ErrNotReady",
"\n",
"}"
] |
22,853 | all-22854 | [
"WithPrefetch",
"is",
"a",
"hint",
"to",
"prefetch",
"a",
"list",
"of",
"keys",
"before",
"trying",
"to",
"apply",
".",
"If",
"an",
"STM",
"transaction",
"will",
"unconditionally",
"fetch",
"a",
"set",
"of",
"keys",
"prefetching",
"those",
"keys",
"will",
"save",
"the",
"round",
"-",
"trip",
"cost",
"from",
"requesting",
"each",
"key",
"one",
"by",
"one",
"with",
"Get",
"()",
"."
] | [
"func",
"WithPrefetch",
"(",
"keys",
"...",
"string",
")",
"stmOption",
"{",
"return",
"func",
"(",
"so",
"*",
"stmOptions",
")",
"{",
"so",
".",
"prefetch",
"=",
"append",
"(",
"so",
".",
"prefetch",
",",
"<mask>",
"...",
")",
"}",
"\n",
"}"
] |
22,854 | all-22855 | [
"UnmarshalJSON",
"supports",
"json",
".",
"Unmarshaler",
"interface"
] | [
"func",
"(",
"v",
"*",
"EventStyleSheetAdded",
")",
"UnmarshalJSON",
"(",
"data",
"[",
"]",
"<mask>",
")",
"error",
"{",
"r",
":=",
"jlexer",
".",
"Lexer",
"{",
"Data",
":",
"data",
"}",
"\n",
"easyjsonC5a4559bDecodeGithubComChromedpCdprotoCss53",
"(",
"&",
"r",
",",
"v",
")",
"\n",
"return",
"r",
".",
"Error",
"(",
")",
"\n",
"}"
] |
22,855 | all-22856 | [
"TerminateChannel",
"tries",
"to",
"terminate",
"a",
"given",
"channel",
"."
] | [
"func",
"(",
"p",
"*",
"Processor",
")",
"TerminateChannel",
"(",
"<mask>",
",",
"jobCreator",
"string",
",",
"agent",
"bool",
")",
"(",
"string",
",",
"error",
")",
"{",
"var",
"jobType",
"string",
"\n",
"if",
"agent",
"{",
"jobType",
"=",
"data",
".",
"JobAgentPreServiceTerminate",
"\n",
"}",
"else",
"{",
"jobType",
"=",
"data",
".",
"JobClientPreServiceTerminate",
"\n",
"}",
"\n\n",
"return",
"p",
".",
"alterServiceStatus",
"(",
"id",
",",
"jobCreator",
",",
"jobType",
",",
"jobType",
",",
"terminateTransitions",
",",
"true",
")",
"\n",
"}"
] |
22,856 | all-22857 | [
"Add",
"adds",
"a",
"key",
"into",
"the",
"cache",
"and",
"handles",
"overflow"
] | [
"func",
"(",
"mkc",
"*",
"memoryKeyCacher",
")",
"Add",
"(",
"keyID",
"string",
",",
"downloadedKeys",
"[",
"]",
"jose",
".",
"JSONWebKey",
")",
"(",
"*",
"jose",
".",
"JSONWebKey",
",",
"error",
")",
"{",
"var",
"addingKey",
"jose",
".",
"JSONWebKey",
"\n\n",
"for",
"_",
",",
"key",
":=",
"range",
"downloadedKeys",
"{",
"if",
"key",
".",
"KeyID",
"==",
"keyID",
"{",
"addingKey",
"=",
"key",
"\n",
"}",
"\n",
"if",
"mkc",
".",
"maxCacheSize",
"==",
"-",
"1",
"{",
"mkc",
".",
"entries",
"[",
"key",
".",
"KeyID",
"]",
"=",
"keyCacherEntry",
"{",
"addedAt",
":",
"<mask>",
".",
"Now",
"(",
")",
",",
"JSONWebKey",
":",
"key",
",",
"}",
"\n",
"}",
"\n",
"}",
"\n",
"if",
"addingKey",
".",
"Key",
"!=",
"nil",
"{",
"if",
"mkc",
".",
"maxCacheSize",
"!=",
"-",
"1",
"{",
"mkc",
".",
"entries",
"[",
"addingKey",
".",
"KeyID",
"]",
"=",
"keyCacherEntry",
"{",
"addedAt",
":",
"time",
".",
"Now",
"(",
")",
",",
"JSONWebKey",
":",
"addingKey",
",",
"}",
"\n",
"mkc",
".",
"handleOverflow",
"(",
")",
"\n",
"}",
"\n",
"return",
"&",
"addingKey",
",",
"nil",
"\n",
"}",
"\n",
"return",
"nil",
",",
"ErrNoKeyFound",
"\n",
"}"
] |
22,857 | all-22858 | [
"Done",
"is",
"called",
"on",
"a",
"completed",
"request"
] | [
"func",
"(",
"t",
"*",
"WriterTracer",
")",
"Done",
"(",
"re",
"*",
"Response",
",",
"err",
"error",
")",
"(",
"*",
"Response",
",",
"error",
")",
"{",
"t",
".",
"EndTime",
"=",
"time",
".",
"Now",
"(",
")",
".",
"UTC",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"fmt",
".",
"Fprintf",
"(",
"t",
",",
"\"",
"\"",
",",
"t",
".",
"EndTime",
".",
"Sub",
"(",
"t",
".",
"StartTime",
")",
",",
"t",
".",
"Request",
".",
"Method",
",",
"t",
".",
"Request",
".",
"URL",
",",
"err",
")",
"\n",
"return",
"re",
",",
"err",
"\n",
"}",
"\n",
"fmt",
".",
"Fprintf",
"(",
"t",
",",
"\"",
"\"",
",",
"t",
".",
"EndTime",
".",
"Sub",
"(",
"t",
".",
"StartTime",
")",
",",
"t",
".",
"Request",
".",
"Method",
",",
"t",
".",
"Request",
".",
"URL",
",",
"<mask>",
".",
"Code",
"(",
")",
")",
"\n",
"return",
"re",
",",
"err",
"\n",
"}"
] |
22,858 | all-22859 | [
"SetDesiredStatus",
"sets",
"the",
"desired",
"status",
"of",
"the",
"task"
] | [
"func",
"(",
"task",
"*",
"Task",
")",
"SetDesiredStatus",
"(",
"status",
"apitaskstatus",
".",
"TaskStatus",
")",
"{",
"task",
".",
"lock",
".",
"Lock",
"(",
")",
"\n",
"defer",
"task",
".",
"lock",
".",
"Unlock",
"(",
")",
"\n\n",
"<mask>",
".",
"DesiredStatusUnsafe",
"=",
"status",
"\n",
"}"
] |
22,859 | all-22860 | [
"SetDefaultGeometry",
"is",
"a",
"wrapper",
"around",
"gtk_window_set_default_geometry",
"()",
"."
] | [
"func",
"(",
"v",
"*",
"Window",
")",
"SetDefaultGeometry",
"(",
"width",
",",
"height",
"int",
")",
"{",
"C",
".",
"gtk_window_set_default_geometry",
"(",
"v",
".",
"native",
"(",
")",
",",
"C",
".",
"gint",
"(",
"<mask>",
")",
",",
"C",
".",
"gint",
"(",
"height",
")",
")",
"\n",
"}"
] |
22,860 | all-22861 | [
"WriteOnTargetList",
"writes",
"the",
"given",
"target",
"in",
"the",
"target",
"list",
"file",
"."
] | [
"func",
"WriteOnTargetList",
"(",
"label",
",",
"target",
"string",
")",
"error",
"{",
"label",
"=",
"strings",
".",
"TrimSpace",
"(",
"label",
")",
"\n",
"target",
"=",
"strings",
".",
"TrimSpace",
"(",
"target",
")",
"\n",
"targetExist",
",",
"err",
":=",
"CheckIfTargetLabelExists",
"(",
"label",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"if",
"targetExist",
"{",
"return",
"errors",
".",
"New",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"targetsPath",
":=",
"JoinWithUserDir",
"(",
"\"",
"\"",
",",
"\"",
"\"",
")",
"\n",
"targetsFile",
",",
"err",
":=",
"filesystem",
"(",
")",
".",
"OpenFile",
"(",
"targetsPath",
",",
"syscall",
".",
"O_RDWR",
"|",
"syscall",
".",
"O_CREAT",
"|",
"syscall",
".",
"O_APPEND",
",",
"0600",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"defer",
"targetsFile",
".",
"Close",
"(",
")",
"\n",
"content",
":=",
"label",
"+",
"\"",
"\\t",
"\"",
"+",
"target",
"+",
"\"",
"\\n",
"\"",
"\n",
"n",
",",
"err",
":=",
"targetsFile",
".",
"WriteString",
"(",
"content",
")",
"\n",
"if",
"n",
"!=",
"len",
"(",
"<mask>",
")",
"||",
"err",
"!=",
"nil",
"{",
"return",
"errors",
".",
"New",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
] |
22,861 | all-22862 | [
"HasMargin",
"returns",
"a",
"boolean",
"if",
"a",
"field",
"has",
"been",
"set",
"."
] | [
"func",
"(",
"i",
"*",
"ImageDefinition",
")",
"HasMargin",
"(",
")",
"bool",
"{",
"if",
"i",
"!=",
"nil",
"&&",
"i",
".",
"Margin",
"!=",
"nil",
"{",
"return",
"<mask>",
"\n",
"}",
"\n\n",
"return",
"false",
"\n",
"}"
] |
22,862 | all-22863 | [
"NewDnsimpleProvider",
"initializes",
"a",
"new",
"Dnsimple",
"based",
"provider"
] | [
"func",
"NewDnsimpleProvider",
"(",
"domainFilter",
"DomainFilter",
",",
"zoneIDFilter",
"ZoneIDFilter",
",",
"dryRun",
"bool",
")",
"(",
"<mask>",
",",
"error",
")",
"{",
"oauthToken",
":=",
"os",
".",
"Getenv",
"(",
"\"",
"\"",
")",
"\n",
"if",
"len",
"(",
"oauthToken",
")",
"==",
"0",
"{",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"client",
":=",
"dnsimple",
".",
"NewClient",
"(",
"dnsimple",
".",
"NewOauthTokenCredentials",
"(",
"oauthToken",
")",
")",
"\n",
"provider",
":=",
"&",
"dnsimpleProvider",
"{",
"client",
":",
"dnsimpleZoneService",
"{",
"service",
":",
"client",
".",
"Zones",
"}",
",",
"identity",
":",
"identityService",
"{",
"service",
":",
"client",
".",
"Identity",
"}",
",",
"domainFilter",
":",
"domainFilter",
",",
"zoneIDFilter",
":",
"zoneIDFilter",
",",
"dryRun",
":",
"dryRun",
",",
"}",
"\n",
"whoamiResponse",
",",
"err",
":=",
"provider",
".",
"identity",
".",
"service",
".",
"Whoami",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"provider",
".",
"accountID",
"=",
"strconv",
".",
"Itoa",
"(",
"whoamiResponse",
".",
"Data",
".",
"Account",
".",
"ID",
")",
"\n",
"return",
"provider",
",",
"nil",
"\n",
"}"
] |
22,863 | all-22864 | [
"GetKnownStatus",
"gets",
"the",
"KnownStatus",
"of",
"the",
"task"
] | [
"func",
"(",
"task",
"*",
"Task",
")",
"GetKnownStatus",
"(",
")",
"apitaskstatus",
".",
"TaskStatus",
"{",
"task",
".",
"lock",
".",
"RLock",
"(",
")",
"\n",
"defer",
"task",
".",
"<mask>",
".",
"RUnlock",
"(",
")",
"\n\n",
"return",
"task",
".",
"KnownStatusUnsafe",
"\n",
"}"
] |
22,864 | all-22865 | [
"Authenticate",
"validates",
"an",
"incoming",
"http",
"Request",
"It",
"will",
"check",
"over",
"what",
"protocol",
"it",
"came",
"what",
"type",
"of",
"request",
"it",
"is",
"and",
"will",
"validate",
"the",
"TLS",
"certificate",
"or",
"Macaroon",
".",
"This",
"does",
"not",
"perform",
"authorization",
"only",
"validates",
"authentication"
] | [
"func",
"(",
"d",
"*",
"Daemon",
")",
"Authenticate",
"(",
"r",
"*",
"http",
".",
"Request",
")",
"(",
"bool",
",",
"string",
",",
"string",
",",
"error",
")",
"{",
"// Allow internal cluster traffic",
"if",
"r",
".",
"TLS",
"!=",
"nil",
"{",
"<mask>",
",",
"_",
":=",
"x509",
".",
"ParseCertificate",
"(",
"d",
".",
"endpoints",
".",
"NetworkCert",
"(",
")",
".",
"KeyPair",
"(",
")",
".",
"Certificate",
"[",
"0",
"]",
")",
"\n",
"clusterCerts",
":=",
"map",
"[",
"string",
"]",
"x509",
".",
"Certificate",
"{",
"\"",
"\"",
":",
"*",
"cert",
"}",
"\n",
"for",
"i",
":=",
"range",
"r",
".",
"TLS",
".",
"PeerCertificates",
"{",
"trusted",
",",
"_",
":=",
"util",
".",
"CheckTrustState",
"(",
"*",
"r",
".",
"TLS",
".",
"PeerCertificates",
"[",
"i",
"]",
",",
"clusterCerts",
")",
"\n",
"if",
"trusted",
"{",
"return",
"true",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"nil",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n\n",
"// Local unix socket queries",
"if",
"r",
".",
"RemoteAddr",
"==",
"\"",
"\"",
"{",
"return",
"true",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"nil",
"\n",
"}",
"\n\n",
"// Devlxd unix socket credentials on main API",
"if",
"r",
".",
"RemoteAddr",
"==",
"\"",
"\"",
"{",
"return",
"false",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"// Cluster notification with wrong certificate",
"if",
"isClusterNotification",
"(",
"r",
")",
"{",
"return",
"false",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"// Bad query, no TLS found",
"if",
"r",
".",
"TLS",
"==",
"nil",
"{",
"return",
"false",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"if",
"d",
".",
"externalAuth",
"!=",
"nil",
"&&",
"r",
".",
"Header",
".",
"Get",
"(",
"httpbakery",
".",
"BakeryProtocolHeader",
")",
"!=",
"\"",
"\"",
"{",
"// Validate external authentication",
"ctx",
":=",
"httpbakery",
".",
"ContextWithRequest",
"(",
"context",
".",
"TODO",
"(",
")",
",",
"r",
")",
"\n",
"authChecker",
":=",
"d",
".",
"externalAuth",
".",
"bakery",
".",
"Checker",
".",
"Auth",
"(",
"httpbakery",
".",
"RequestMacaroons",
"(",
"r",
")",
"...",
")",
"\n\n",
"ops",
":=",
"[",
"]",
"bakery",
".",
"Op",
"{",
"{",
"Entity",
":",
"r",
".",
"URL",
".",
"Path",
",",
"Action",
":",
"r",
".",
"Method",
",",
"}",
"}",
"\n\n",
"info",
",",
"err",
":=",
"authChecker",
".",
"Allow",
"(",
"ctx",
",",
"ops",
"...",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"// Bad macaroon",
"return",
"false",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"err",
"\n",
"}",
"\n\n",
"if",
"info",
"!=",
"nil",
"&&",
"info",
".",
"Identity",
"!=",
"nil",
"{",
"// Valid identity macaroon found",
"return",
"true",
",",
"info",
".",
"Identity",
".",
"Id",
"(",
")",
",",
"\"",
"\"",
",",
"nil",
"\n",
"}",
"\n\n",
"// Valid macaroon with no identity information",
"return",
"true",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"nil",
"\n",
"}",
"\n\n",
"// Validate normal TLS access",
"for",
"i",
":=",
"range",
"r",
".",
"TLS",
".",
"PeerCertificates",
"{",
"trusted",
",",
"username",
":=",
"util",
".",
"CheckTrustState",
"(",
"*",
"r",
".",
"TLS",
".",
"PeerCertificates",
"[",
"i",
"]",
",",
"d",
".",
"clientCerts",
")",
"\n",
"if",
"trusted",
"{",
"return",
"true",
",",
"username",
",",
"\"",
"\"",
",",
"nil",
"\n",
"}",
"\n",
"}",
"\n\n",
"// Reject unauthorized",
"return",
"false",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"nil",
"\n",
"}"
] |
22,865 | all-22866 | [
"Step",
"6",
"Un",
"-",
"accent"
] | [
"func",
"step6",
"(",
"<mask>",
"*",
"snowballword",
".",
"SnowballWord",
")",
"bool",
"{",
"// If the words ends é or è (unicode code points 233 and 232)",
"// followed by at least one non-vowel, remove the accent from the e.",
"// Note, this step is oddly articulated on Porter's Snowball website:",
"// http://snowball.tartarus.org/algorithms/french/stemmer.html",
"// More clearly stated, we should replace é or è with e in the",
"// case where the suffix of the word is é or è followed by",
"// one-or-more non-vowels.",
"numNonVowels",
":=",
"0",
"\n",
"for",
"i",
":=",
"len",
"(",
"word",
".",
"RS",
")",
"-",
"1",
";",
"i",
">=",
"0",
";",
"i",
"--",
"{",
"r",
":=",
"word",
".",
"RS",
"[",
"i",
"]",
"\n\n",
"if",
"isLowerVowel",
"(",
"r",
")",
"==",
"false",
"{",
"numNonVowels",
"+=",
"1",
"\n",
"}",
"else",
"{",
"// `r` is a vowel",
"if",
"(",
"r",
"==",
"233",
"||",
"r",
"==",
"232",
")",
"&&",
"numNonVowels",
">",
"0",
"{",
"// Replace with \"e\", or unicode code point 101",
"word",
".",
"RS",
"[",
"i",
"]",
"=",
"101",
"\n",
"return",
"true",
"\n\n",
"}",
"\n",
"return",
"false",
"\n",
"}",
"\n\n",
"}",
"\n",
"return",
"false",
"\n",
"}"
] |
22,866 | all-22867 | [
"lookupProject",
"retrieves",
"the",
"project",
"name",
"from",
"the",
"metadata",
"of",
"the",
"current",
"node",
"."
] | [
"func",
"lookupProject",
"(",
")",
"(",
"string",
",",
"error",
")",
"{",
"req",
",",
"err",
":=",
"http",
".",
"NewRequest",
"(",
"\"",
"\"",
",",
"\"",
"\"",
",",
"nil",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"\"",
"\"",
",",
"err",
"\n",
"}",
"\n",
"req",
".",
"Header",
".",
"Add",
"(",
"\"",
"\"",
",",
"\"",
"\"",
")",
"\n\n",
"resp",
",",
"err",
":=",
"http",
".",
"DefaultClient",
".",
"Do",
"(",
"req",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"\"",
"\"",
",",
"err",
"\n",
"}",
"\n",
"defer",
"resp",
".",
"Body",
".",
"Close",
"(",
")",
"\n\n",
"if",
"resp",
".",
"StatusCode",
"!=",
"200",
"{",
"return",
"\"",
"\"",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"resp",
".",
"StatusCode",
")",
"\n",
"}",
"\n\n",
"project",
",",
"err",
":=",
"ioutil",
".",
"ReadAll",
"(",
"resp",
".",
"Body",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"\"",
"\"",
",",
"err",
"\n",
"}",
"\n",
"return",
"string",
"(",
"<mask>",
")",
",",
"nil",
"\n",
"}"
] |
22,867 | all-22868 | [
"AddHandler",
"adds",
"a",
"function",
"to",
"be",
"called",
"whenever",
"an",
"event",
"is",
"received"
] | [
"func",
"(",
"op",
"*",
"remoteOperation",
")",
"AddHandler",
"(",
"function",
"func",
"(",
"api",
".",
"Operation",
")",
")",
"(",
"*",
"EventTarget",
",",
"error",
")",
"{",
"var",
"err",
"error",
"\n",
"var",
"target",
"*",
"EventTarget",
"\n\n",
"// Attach to the existing target operation",
"if",
"op",
".",
"targetOp",
"!=",
"nil",
"{",
"target",
",",
"err",
"=",
"op",
".",
"targetOp",
".",
"AddHandler",
"(",
"function",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"}",
"else",
"{",
"// Generate a mock EventTarget",
"target",
"=",
"&",
"EventTarget",
"{",
"function",
":",
"func",
"(",
"api",
".",
"Event",
")",
"{",
"<mask>",
"(",
"api",
".",
"Operation",
"{",
"}",
")",
"}",
",",
"types",
":",
"[",
"]",
"string",
"{",
"\"",
"\"",
"}",
",",
"}",
"\n",
"}",
"\n\n",
"// Add the handler to our list",
"op",
".",
"handlers",
"=",
"append",
"(",
"op",
".",
"handlers",
",",
"function",
")",
"\n\n",
"return",
"target",
",",
"nil",
"\n",
"}"
] |
22,868 | all-22869 | [
"UnmarshalJSON",
"satisfies",
"json",
".",
"Unmarshaler",
"."
] | [
"func",
"(",
"t",
"*",
"ContinueToLocationTargetCallFrames",
")",
"UnmarshalJSON",
"(",
"buf",
"[",
"]",
"<mask>",
")",
"error",
"{",
"return",
"easyjson",
".",
"Unmarshal",
"(",
"buf",
",",
"t",
")",
"\n",
"}"
] |
22,869 | all-22870 | [
"simultaneously",
"specify",
"storage",
"for",
"all",
"levels",
"of",
"a",
"three",
"-",
"dimensional",
"two",
"-",
"dimensional",
"array",
"or",
"cube",
"-",
"map",
"array",
"texture"
] | [
"func",
"TextureStorage3D",
"(",
"texture",
"uint32",
",",
"levels",
"int32",
",",
"internalformat",
"uint32",
",",
"width",
"int32",
",",
"height",
"int32",
",",
"depth",
"int32",
")",
"{",
"syscall",
".",
"Syscall6",
"(",
"gpTextureStorage3D",
",",
"6",
",",
"uintptr",
"(",
"texture",
")",
",",
"uintptr",
"(",
"levels",
")",
",",
"uintptr",
"(",
"internalformat",
")",
",",
"uintptr",
"(",
"<mask>",
")",
",",
"uintptr",
"(",
"height",
")",
",",
"uintptr",
"(",
"depth",
")",
")",
"\n",
"}"
] |
22,870 | all-22871 | [
"NewTransactionAt",
"follows",
"the",
"same",
"logic",
"as",
"DB",
".",
"NewTransaction",
"()",
"but",
"uses",
"the",
"provided",
"read",
"timestamp",
".",
"This",
"is",
"only",
"useful",
"for",
"databases",
"built",
"on",
"top",
"of",
"Badger",
"(",
"like",
"Dgraph",
")",
"and",
"can",
"be",
"ignored",
"by",
"most",
"users",
"."
] | [
"func",
"(",
"db",
"*",
"DB",
")",
"NewTransactionAt",
"(",
"readTs",
"uint64",
",",
"update",
"bool",
")",
"*",
"Txn",
"{",
"if",
"!",
"db",
".",
"opt",
".",
"managedTxns",
"{",
"panic",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"txn",
":=",
"db",
".",
"newTransaction",
"(",
"<mask>",
",",
"true",
")",
"\n",
"txn",
".",
"readTs",
"=",
"readTs",
"\n",
"return",
"txn",
"\n",
"}"
] |
22,871 | all-22872 | [
"RemoveDuplicates",
"removes",
"duplicate",
"items",
"from",
"a",
"list"
] | [
"func",
"RemoveDuplicates",
"(",
"elements",
"[",
"]",
"string",
")",
"[",
"]",
"string",
"{",
"// Use map to record duplicates as we find them.",
"encountered",
":=",
"map",
"[",
"string",
"]",
"bool",
"{",
"}",
"\n",
"result",
":=",
"[",
"]",
"string",
"{",
"}",
"\n\n",
"for",
"v",
":=",
"range",
"elements",
"{",
"if",
"encountered",
"[",
"elements",
"[",
"v",
"]",
"]",
"==",
"true",
"{",
"// Do not add duplicate.",
"}",
"else",
"{",
"// Record this element as an encountered element.",
"encountered",
"[",
"elements",
"[",
"v",
"]",
"]",
"=",
"true",
"\n",
"// Append to result slice.",
"result",
"=",
"<mask>",
"(",
"result",
",",
"elements",
"[",
"v",
"]",
")",
"\n",
"}",
"\n",
"}",
"\n",
"// Return the new slice.",
"return",
"result",
"\n",
"}"
] |
22,872 | all-22873 | [
"DebugPrint",
"draws",
"the",
"string",
"str",
"on",
"the",
"image",
"on",
"left",
"top",
"corner",
".",
"The",
"available",
"runes",
"are",
"in",
"U",
"+",
"0000",
"to",
"U",
"+",
"00FF",
"which",
"is",
"C0",
"Controls",
"and",
"Basic",
"Latin",
"and",
"C1",
"Controls",
"and",
"Latin",
"-",
"1",
"Supplement",
".",
"DebugPrint",
"always",
"returns",
"nil",
"as",
"of",
"1",
".",
"5",
".",
"0",
"-",
"alpha",
"."
] | [
"func",
"DebugPrint",
"(",
"<mask>",
"*",
"ebiten",
".",
"Image",
",",
"str",
"string",
")",
"error",
"{",
"DebugPrintAt",
"(",
"image",
",",
"str",
",",
"0",
",",
"0",
")",
"\n",
"return",
"nil",
"\n",
"}"
] |
22,873 | all-22874 | [
"MarshalJSON",
"supports",
"json",
".",
"Marshaler",
"interface"
] | [
"func",
"(",
"v",
"GetMetricsParams",
")",
"MarshalJSON",
"(",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"w",
":=",
"jwriter",
".",
"Writer",
"{",
"}",
"\n",
"easyjsonC5a4559bEncodeGithubComChromedpCdprotoPerformance3",
"(",
"&",
"w",
",",
"v",
")",
"\n",
"return",
"w",
".",
"Buffer",
".",
"BuildBytes",
"(",
")",
",",
"w",
".",
"<mask>",
"\n",
"}"
] |
22,874 | all-22875 | [
"SetSize",
"()",
"is",
"a",
"wrapper",
"around",
"gtk_paper_size_set_size",
"()",
"."
] | [
"func",
"(",
"ps",
"*",
"PaperSize",
")",
"SetSize",
"(",
"width",
",",
"<mask>",
"float64",
",",
"unit",
"Unit",
")",
"{",
"C",
".",
"gtk_paper_size_set_size",
"(",
"ps",
".",
"native",
"(",
")",
",",
"C",
".",
"gdouble",
"(",
"width",
")",
",",
"C",
".",
"gdouble",
"(",
"height",
")",
",",
"C",
".",
"GtkUnit",
"(",
"unit",
")",
")",
"\n",
"}"
] |
22,875 | all-22876 | [
"Properties",
"is",
"a",
"convenience",
"method",
"that",
"wraps",
"fetching",
"the",
"ClusterComputeResource",
"MO",
"from",
"its",
"higher",
"-",
"level",
"object",
"."
] | [
"func",
"Properties",
"(",
"cluster",
"*",
"object",
".",
"ClusterComputeResource",
")",
"(",
"*",
"mo",
".",
"ClusterComputeResource",
",",
"error",
")",
"{",
"ctx",
",",
"cancel",
":=",
"<mask>",
".",
"WithTimeout",
"(",
"context",
".",
"Background",
"(",
")",
",",
"provider",
".",
"DefaultAPITimeout",
")",
"\n",
"defer",
"cancel",
"(",
")",
"\n",
"var",
"props",
"mo",
".",
"ClusterComputeResource",
"\n",
"if",
"err",
":=",
"cluster",
".",
"Properties",
"(",
"ctx",
",",
"cluster",
".",
"Reference",
"(",
")",
",",
"nil",
",",
"&",
"props",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"return",
"&",
"props",
",",
"nil",
"\n",
"}"
] |
22,876 | all-22877 | [
"Series",
"returns",
"the",
"bytes",
"of",
"the",
"series",
"the",
"timestamp",
"if",
"set",
"and",
"the",
"value",
"of",
"the",
"current",
"sample",
"."
] | [
"func",
"(",
"p",
"*",
"PromParser",
")",
"Series",
"(",
")",
"(",
"[",
"]",
"byte",
",",
"*",
"int64",
",",
"float64",
")",
"{",
"if",
"p",
".",
"hasTS",
"{",
"return",
"p",
".",
"series",
",",
"&",
"p",
".",
"<mask>",
",",
"p",
".",
"val",
"\n",
"}",
"\n",
"return",
"p",
".",
"series",
",",
"nil",
",",
"p",
".",
"val",
"\n",
"}"
] |
22,877 | all-22878 | [
"vectorSelector",
"evaluates",
"a",
"*",
"VectorSelector",
"expression",
"."
] | [
"func",
"(",
"ev",
"*",
"evaluator",
")",
"vectorSelector",
"(",
"node",
"*",
"VectorSelector",
",",
"ts",
"int64",
")",
"Vector",
"{",
"checkForSeriesSetExpansion",
"(",
"ev",
".",
"ctx",
",",
"node",
")",
"\n\n",
"var",
"(",
"vec",
"=",
"make",
"(",
"Vector",
",",
"0",
",",
"len",
"(",
"node",
".",
"series",
")",
")",
"\n",
")",
"\n\n",
"it",
":=",
"storage",
".",
"NewBuffer",
"(",
"durationMilliseconds",
"(",
"LookbackDelta",
")",
")",
"\n",
"for",
"i",
",",
"s",
":=",
"<mask>",
"node",
".",
"series",
"{",
"it",
".",
"Reset",
"(",
"s",
".",
"Iterator",
"(",
")",
")",
"\n\n",
"t",
",",
"v",
",",
"ok",
":=",
"ev",
".",
"vectorSelectorSingle",
"(",
"it",
",",
"node",
",",
"ts",
")",
"\n",
"if",
"ok",
"{",
"vec",
"=",
"append",
"(",
"vec",
",",
"Sample",
"{",
"Metric",
":",
"node",
".",
"series",
"[",
"i",
"]",
".",
"Labels",
"(",
")",
",",
"Point",
":",
"Point",
"{",
"V",
":",
"v",
",",
"T",
":",
"t",
"}",
",",
"}",
")",
"\n",
"ev",
".",
"currentSamples",
"++",
"\n",
"}",
"\n\n",
"if",
"ev",
".",
"currentSamples",
">=",
"ev",
".",
"maxSamples",
"{",
"ev",
".",
"error",
"(",
"ErrTooManySamples",
"(",
"env",
")",
")",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"vec",
"\n",
"}"
] |
22,878 | all-22879 | [
"Get",
"gets",
"the",
"item",
"for",
"the",
"given",
"key",
".",
"ErrCacheMiss",
"is",
"returned",
"for",
"a",
"memcache",
"cache",
"miss",
".",
"The",
"key",
"must",
"be",
"at",
"most",
"250",
"bytes",
"in",
"length",
"."
] | [
"func",
"Get",
"(",
"c",
"context",
".",
"Context",
",",
"key",
"string",
")",
"(",
"*",
"Item",
",",
"error",
")",
"{",
"m",
",",
"err",
":=",
"GetMulti",
"(",
"c",
",",
"[",
"]",
"string",
"{",
"key",
"}",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"if",
"_",
",",
"ok",
":=",
"m",
"[",
"key",
"]",
";",
"!",
"ok",
"{",
"return",
"nil",
",",
"ErrCacheMiss",
"\n",
"}",
"\n",
"return",
"m",
"[",
"<mask>",
"]",
",",
"nil",
"\n",
"}"
] |
22,879 | all-22880 | [
"MarshalJSON",
"supports",
"json",
".",
"Marshaler",
"interface"
] | [
"func",
"(",
"v",
"DispatchKeyEventParams",
")",
"MarshalJSON",
"(",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"w",
":=",
"jwriter",
".",
"Writer",
"{",
"}",
"\n",
"easyjsonC5a4559bEncodeGithubComChromedpCdprotoInput9",
"(",
"&",
"w",
",",
"v",
")",
"\n",
"return",
"w",
".",
"Buffer",
".",
"BuildBytes",
"(",
")",
",",
"w",
".",
"<mask>",
"\n",
"}"
] |
22,880 | all-22881 | [
"GetLength",
"()",
"is",
"a",
"wrapper",
"around",
"gtk_print_settings_get_length",
"()",
"."
] | [
"func",
"(",
"<mask>",
"*",
"PrintSettings",
")",
"GetLength",
"(",
"key",
"string",
",",
"unit",
"Unit",
")",
"float64",
"{",
"cstr",
":=",
"C",
".",
"CString",
"(",
"key",
")",
"\n",
"defer",
"C",
".",
"free",
"(",
"unsafe",
".",
"Pointer",
"(",
"cstr",
")",
")",
"\n",
"c",
":=",
"C",
".",
"gtk_print_settings_get_length",
"(",
"ps",
".",
"native",
"(",
")",
",",
"(",
"*",
"C",
".",
"gchar",
")",
"(",
"cstr",
")",
",",
"C",
".",
"GtkUnit",
"(",
"unit",
")",
")",
"\n",
"return",
"float64",
"(",
"c",
")",
"\n",
"}"
] |
22,881 | all-22882 | [
"FindByName",
"finds",
"exactly",
"element",
"with",
"the",
"provided",
"name",
"attribute",
"."
] | [
"func",
"(",
"s",
"*",
"selectable",
")",
"FindByName",
"(",
"name",
"string",
")",
"*",
"Selection",
"{",
"return",
"newSelection",
"(",
"s",
".",
"<mask>",
",",
"s",
".",
"selectors",
".",
"Append",
"(",
"target",
".",
"Name",
",",
"name",
")",
".",
"Single",
"(",
")",
")",
"\n",
"}"
] |
22,882 | all-22883 | [
"IndexOfIgnoreCase",
"looks",
"for",
"specified",
"string",
"disregarding",
"letter",
"casing",
"into",
"current",
"slice",
"."
] | [
"func",
"(",
"s",
"StringSlice",
")",
"IndexOfIgnoreCase",
"(",
"str",
"string",
")",
"int",
"{",
"str",
"=",
"strings",
".",
"ToLower",
"(",
"str",
")",
"\n",
"for",
"i",
",",
"v",
":=",
"<mask>",
"s",
"{",
"if",
"str",
"==",
"strings",
".",
"ToLower",
"(",
"v",
")",
"{",
"return",
"i",
"\n",
"}",
"\n",
"}",
"\n\n",
"return",
"-",
"1",
"\n",
"}"
] |
22,883 | all-22884 | [
"Capabilities",
"returns",
"the",
"capabilities",
"supported",
"by",
"a",
"plugin"
] | [
"func",
"(",
"client",
"*",
"cniClient",
")",
"Capabilities",
"(",
"name",
"string",
")",
"(",
"[",
"]",
"string",
",",
"error",
")",
"{",
"file",
":=",
"filepath",
".",
"Join",
"(",
"client",
".",
"pluginsPath",
",",
"name",
")",
"\n\n",
"// Check if the plugin file exists before executing it",
"_",
",",
"err",
":=",
"os",
".",
"Stat",
"(",
"file",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"errors",
".",
"Wrapf",
"(",
"err",
",",
"\"",
"\"",
",",
"file",
")",
"\n",
"}",
"\n\n",
"cmd",
":=",
"exec",
".",
"Command",
"(",
"file",
",",
"capabilitiesCommand",
")",
"\n",
"capabilitiesInfo",
",",
"err",
":=",
"cmd",
".",
"Output",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"<mask>",
".",
"Wrapf",
"(",
"err",
",",
"\"",
"\"",
",",
"name",
")",
"\n",
"}",
"\n\n",
"capabilities",
":=",
"&",
"struct",
"{",
"Capabilities",
"[",
"]",
"string",
"`json:\"capabilities\"`",
"\n",
"}",
"{",
"}",
"\n",
"err",
"=",
"json",
".",
"Unmarshal",
"(",
"capabilitiesInfo",
",",
"capabilities",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"errors",
".",
"Wrapf",
"(",
"err",
",",
"\"",
"\"",
",",
"name",
",",
"capabilitiesInfo",
")",
"\n",
"}",
"\n\n",
"return",
"capabilities",
".",
"Capabilities",
",",
"nil",
"\n",
"}"
] |
22,884 | all-22885 | [
"Execute",
"-",
"updates",
"space",
"quotas"
] | [
"func",
"(",
"c",
"*",
"UpdateSpaceQuotasCommand",
")",
"Execute",
"(",
"[",
"]",
"string",
")",
"error",
"{",
"var",
"cfMgmt",
"*",
"CFMgmt",
"\n",
"<mask>",
"err",
"error",
"\n",
"if",
"cfMgmt",
",",
"err",
"=",
"InitializePeekManagers",
"(",
"c",
".",
"BaseCFConfigCommand",
",",
"c",
".",
"Peek",
")",
";",
"err",
"==",
"nil",
"{",
"err",
"=",
"cfMgmt",
".",
"QuotaManager",
".",
"CreateSpaceQuotas",
"(",
")",
"\n",
"}",
"\n",
"return",
"err",
"\n",
"}"
] |
22,885 | all-22886 | [
"UnmarshalJSON",
"supports",
"json",
".",
"Unmarshaler",
"interface"
] | [
"func",
"(",
"v",
"*",
"GetRequestPostDataParams",
")",
"UnmarshalJSON",
"(",
"<mask>",
"[",
"]",
"byte",
")",
"error",
"{",
"r",
":=",
"jlexer",
".",
"Lexer",
"{",
"Data",
":",
"data",
"}",
"\n",
"easyjsonC5a4559bDecodeGithubComChromedpCdprotoNetwork33",
"(",
"&",
"r",
",",
"v",
")",
"\n",
"return",
"r",
".",
"Error",
"(",
")",
"\n",
"}"
] |
22,886 | all-22887 | [
"HasServiceKey",
"returns",
"a",
"boolean",
"if",
"a",
"field",
"has",
"been",
"set",
"."
] | [
"func",
"(",
"s",
"*",
"servicePD",
")",
"HasServiceKey",
"(",
")",
"bool",
"{",
"if",
"s",
"!=",
"nil",
"&&",
"s",
".",
"ServiceKey",
"!=",
"nil",
"{",
"return",
"true",
"\n",
"}",
"\n\n",
"return",
"<mask>",
"\n",
"}"
] |
22,887 | all-22888 | [
"Locator",
"returns",
"a",
"locator",
"for",
"the",
"given",
"resource"
] | [
"func",
"(",
"r",
"*",
"RunnableBinding",
")",
"Locator",
"(",
"api",
"*",
"API",
")",
"*",
"RunnableBindingLocator",
"{",
"for",
"_",
",",
"l",
":=",
"<mask>",
"r",
".",
"Links",
"{",
"if",
"l",
"[",
"\"",
"\"",
"]",
"==",
"\"",
"\"",
"{",
"return",
"api",
".",
"RunnableBindingLocator",
"(",
"l",
"[",
"\"",
"\"",
"]",
")",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
] |
22,888 | all-22889 | [
"readFrames",
"is",
"the",
"loop",
"that",
"reads",
"frames",
"from",
"the",
"network",
"connection",
"and",
"dispatches",
"to",
"the",
"appropriate",
"handler",
".",
"Run",
"within",
"its",
"own",
"goroutine",
"to",
"prevent",
"overlapping",
"reads",
"on",
"the",
"socket",
".",
"Most",
"handlers",
"simply",
"send",
"the",
"incoming",
"frame",
"to",
"a",
"channel",
";",
"the",
"init",
"handlers",
"are",
"a",
"notable",
"exception",
"since",
"we",
"cannot",
"process",
"new",
"frames",
"until",
"the",
"initialization",
"is",
"complete",
"."
] | [
"func",
"(",
"c",
"*",
"<mask>",
")",
"readFrames",
"(",
"_",
"uint32",
")",
"{",
"headerBuf",
":=",
"make",
"(",
"[",
"]",
"byte",
",",
"FrameHeaderSize",
")",
"\n\n",
"handleErr",
":=",
"func",
"(",
"err",
"error",
")",
"{",
"if",
"!",
"c",
".",
"closeNetworkCalled",
".",
"Load",
"(",
")",
"{",
"c",
".",
"connectionError",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"}",
"else",
"{",
"c",
".",
"log",
".",
"Debugf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"}",
"\n",
"}",
"\n\n",
"for",
"{",
"// Read the header, avoid allocating the frame till we know the size",
"// we need to allocate.",
"if",
"_",
",",
"err",
":=",
"io",
".",
"ReadFull",
"(",
"c",
".",
"conn",
",",
"headerBuf",
")",
";",
"err",
"!=",
"nil",
"{",
"handleErr",
"(",
"err",
")",
"\n",
"return",
"\n",
"}",
"\n\n",
"frame",
":=",
"c",
".",
"opts",
".",
"FramePool",
".",
"Get",
"(",
")",
"\n",
"if",
"err",
":=",
"frame",
".",
"ReadBody",
"(",
"headerBuf",
",",
"c",
".",
"conn",
")",
";",
"err",
"!=",
"nil",
"{",
"handleErr",
"(",
"err",
")",
"\n",
"c",
".",
"opts",
".",
"FramePool",
".",
"Release",
"(",
"frame",
")",
"\n",
"return",
"\n",
"}",
"\n\n",
"c",
".",
"updateLastActivity",
"(",
"frame",
")",
"\n\n",
"var",
"releaseFrame",
"bool",
"\n",
"if",
"c",
".",
"relay",
"==",
"nil",
"{",
"releaseFrame",
"=",
"c",
".",
"handleFrameNoRelay",
"(",
"frame",
")",
"\n",
"}",
"else",
"{",
"releaseFrame",
"=",
"c",
".",
"handleFrameRelay",
"(",
"frame",
")",
"\n",
"}",
"\n",
"if",
"releaseFrame",
"{",
"c",
".",
"opts",
".",
"FramePool",
".",
"Release",
"(",
"frame",
")",
"\n",
"}",
"\n",
"}",
"\n",
"}"
] |
22,889 | all-22890 | [
"NewLuaObject",
"creates",
"a",
"new",
"LuaObject",
"from",
"stack",
"index",
"."
] | [
"func",
"NewLuaObject",
"(",
"L",
"*",
"lua",
".",
"State",
",",
"idx",
"int",
")",
"*",
"LuaObject",
"{",
"L",
".",
"PushValue",
"(",
"idx",
")",
"\n",
"ref",
":=",
"L",
".",
"Ref",
"(",
"lua",
".",
"LUA_REGISTRYINDEX",
")",
"\n",
"return",
"&",
"LuaObject",
"{",
"l",
":",
"L",
",",
"ref",
":",
"<mask>",
"}",
"\n",
"}"
] |
22,890 | all-22891 | [
"ConvertIterToChildIter",
"is",
"a",
"wrapper",
"around",
"gtk_tree_model_filter_convert_child_iter_to_iter",
"()",
"."
] | [
"func",
"(",
"v",
"*",
"TreeModelFilter",
")",
"ConvertIterToChildIter",
"(",
"filterIter",
"*",
"TreeIter",
")",
"*",
"TreeIter",
"{",
"<mask>",
"iter",
"C",
".",
"GtkTreeIter",
"\n",
"C",
".",
"gtk_tree_model_filter_convert_iter_to_child_iter",
"(",
"v",
".",
"native",
"(",
")",
",",
"&",
"iter",
",",
"filterIter",
".",
"native",
"(",
")",
")",
"\n",
"t",
":=",
"&",
"TreeIter",
"{",
"iter",
"}",
"\n",
"return",
"t",
"\n",
"}"
] |
22,891 | all-22892 | [
"UnmarshalYAML",
"implements",
"the",
"yaml",
".",
"Unmarshaler",
"interface",
"."
] | [
"func",
"(",
"c",
"*",
"SDConfig",
")",
"UnmarshalYAML",
"(",
"unmarshal",
"func",
"(",
"<mask>",
"{",
"}",
")",
"error",
")",
"error",
"{",
"*",
"c",
"=",
"DefaultSDConfig",
"\n",
"type",
"plain",
"SDConfig",
"\n",
"err",
":=",
"unmarshal",
"(",
"(",
"*",
"plain",
")",
"(",
"c",
")",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"if",
"len",
"(",
"c",
".",
"Files",
")",
"==",
"0",
"{",
"return",
"errors",
".",
"New",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"for",
"_",
",",
"name",
":=",
"range",
"c",
".",
"Files",
"{",
"if",
"!",
"patFileSDName",
".",
"MatchString",
"(",
"name",
")",
"{",
"return",
"errors",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"name",
")",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
] |
22,892 | all-22893 | [
"NewEventMatcher",
"returns",
"the",
"correct",
"EventMatcher",
"based",
"on",
"description",
"Incoming",
"event",
"should",
"have",
"the",
"following",
"form",
":",
"eventName",
":",
"labelName",
".",
"If",
"eventName",
"is",
"not",
"label",
"then",
"the",
"second",
"part",
"can",
"be",
"omitted",
"."
] | [
"func",
"NewEventMatcher",
"(",
"eventDescription",
"string",
")",
"EventMatcher",
"{",
"split",
":=",
"strings",
".",
"SplitN",
"(",
"eventDescription",
",",
"\"",
"\"",
",",
"2",
")",
"\n",
"switch",
"split",
"[",
"0",
"]",
"{",
"<mask>",
"\"",
"\"",
":",
"return",
"FalseEvent",
"{",
"}",
"\n",
"case",
"\"",
"\"",
":",
"return",
"CommentEvent",
"{",
"}",
"\n",
"case",
"\"",
"\"",
":",
"return",
"OpenEvent",
"{",
"}",
"\n",
"case",
"\"",
"\"",
":",
"return",
"ReopenEvent",
"{",
"}",
"\n",
"case",
"\"",
"\"",
":",
"return",
"MergeEvent",
"{",
"}",
"\n",
"case",
"\"",
"\"",
":",
"return",
"CloseEvent",
"{",
"}",
"\n",
"case",
"\"",
"\"",
":",
"if",
"len",
"(",
"split",
")",
"!=",
"2",
"{",
"panic",
"(",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
")",
")",
"\n",
"}",
"\n",
"return",
"LabelEvent",
"{",
"split",
"[",
"1",
"]",
"}",
"\n",
"case",
"\"",
"\"",
":",
"if",
"len",
"(",
"split",
")",
"!=",
"2",
"{",
"panic",
"(",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
")",
")",
"\n",
"}",
"\n",
"return",
"UnlabelEvent",
"{",
"split",
"[",
"1",
"]",
"}",
"\n",
"default",
":",
"panic",
"(",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"split",
"[",
"0",
"]",
")",
")",
"\n",
"}",
"\n",
"}"
] |
22,893 | all-22894 | [
"ArmForSwitch",
"returns",
"which",
"field",
"name",
"should",
"be",
"used",
"for",
"storing",
"the",
"value",
"for",
"an",
"instance",
"of",
"ManageOfferResult"
] | [
"func",
"(",
"u",
"ManageOfferResult",
")",
"ArmForSwitch",
"(",
"sw",
"int32",
")",
"(",
"string",
",",
"bool",
")",
"{",
"switch",
"ManageOfferResultCode",
"(",
"sw",
")",
"{",
"case",
"ManageOfferResultCodeManageOfferSuccess",
":",
"return",
"\"",
"\"",
",",
"true",
"\n",
"<mask>",
":",
"return",
"\"",
"\"",
",",
"true",
"\n",
"}",
"\n",
"}"
] |
22,894 | all-22895 | [
"NewPublishHealthMetricsRequest",
"creates",
"a",
"PublishHealthRequest"
] | [
"func",
"NewPublishHealthMetricsRequest",
"(",
"<mask>",
"*",
"HealthMetadata",
",",
"healthMetrics",
"[",
"]",
"*",
"TaskHealth",
")",
"*",
"PublishHealthRequest",
"{",
"return",
"&",
"PublishHealthRequest",
"{",
"Metadata",
":",
"metadata",
",",
"Tasks",
":",
"healthMetrics",
",",
"Timestamp",
":",
"aws",
".",
"Time",
"(",
"time",
".",
"Now",
"(",
")",
")",
",",
"}",
"\n",
"}"
] |
22,895 | all-22896 | [
"UnmarshalPublicKey",
"converts",
"a",
"protobuf",
"serialized",
"public",
"key",
"into",
"its",
"representative",
"object"
] | [
"func",
"UnmarshalPublicKey",
"(",
"data",
"[",
"]",
"byte",
")",
"(",
"PubKey",
",",
"error",
")",
"{",
"pmes",
":=",
"new",
"(",
"pb",
".",
"PublicKey",
")",
"\n",
"err",
":=",
"proto",
".",
"Unmarshal",
"(",
"data",
",",
"pmes",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"um",
",",
"ok",
":=",
"PubKeyUnmarshallers",
"[",
"pmes",
".",
"GetType",
"(",
")",
"]",
"\n",
"if",
"!",
"<mask>",
"{",
"return",
"nil",
",",
"ErrBadKeyType",
"\n",
"}",
"\n\n",
"return",
"um",
"(",
"pmes",
".",
"GetData",
"(",
")",
")",
"\n",
"}"
] |
22,896 | all-22897 | [
"StorageVolumeDescriptionUpdate",
"updates",
"the",
"description",
"of",
"a",
"storage",
"volume",
"."
] | [
"func",
"StorageVolumeDescriptionUpdate",
"(",
"tx",
"*",
"sql",
".",
"Tx",
",",
"volumeID",
"int64",
",",
"description",
"string",
")",
"error",
"{",
"_",
",",
"err",
":=",
"tx",
".",
"Exec",
"(",
"\"",
"\"",
",",
"<mask>",
",",
"volumeID",
")",
"\n",
"return",
"err",
"\n",
"}"
] |
22,897 | all-22898 | [
"TODO",
"(",
"krzyzacy",
")",
":",
"Move",
"this",
"logic",
"into",
"github",
"/",
"reporter",
"once",
"we",
"unify",
"all",
"reporting",
"logic",
"to",
"crier"
] | [
"func",
"ShouldReport",
"(",
"pj",
"prowapi",
".",
"ProwJob",
",",
"validTypes",
"[",
"]",
"prowapi",
".",
"ProwJobType",
")",
"bool",
"{",
"valid",
":=",
"false",
"\n",
"for",
"_",
",",
"t",
":=",
"range",
"validTypes",
"{",
"if",
"pj",
".",
"Spec",
".",
"Type",
"==",
"t",
"{",
"<mask>",
"=",
"true",
"\n",
"}",
"\n",
"}",
"\n\n",
"if",
"!",
"valid",
"{",
"return",
"false",
"\n",
"}",
"\n\n",
"if",
"!",
"pj",
".",
"Spec",
".",
"Report",
"{",
"return",
"false",
"\n",
"}",
"\n\n",
"return",
"true",
"\n",
"}"
] |
22,898 | all-22899 | [
"UnmarshalJSON",
"supports",
"json",
".",
"Unmarshaler",
"interface"
] | [
"func",
"(",
"v",
"*",
"ReplaySnapshotParams",
")",
"UnmarshalJSON",
"(",
"data",
"[",
"]",
"byte",
")",
"error",
"{",
"r",
":=",
"jlexer",
".",
"Lexer",
"{",
"Data",
":",
"data",
"}",
"\n",
"easyjsonC5a4559bDecodeGithubComChromedpCdprotoLayertree5",
"(",
"&",
"r",
",",
"v",
")",
"\n",
"return",
"r",
".",
"<mask>",
"(",
")",
"\n",
"}"
] |
22,899 | all-22900 | [
"MarshalJSON",
"supports",
"json",
".",
"Marshaler",
"interface"
] | [
"func",
"(",
"v",
"KeyframeRule",
")",
"MarshalJSON",
"(",
")",
"(",
"[",
"]",
"<mask>",
",",
"error",
")",
"{",
"w",
":=",
"jwriter",
".",
"Writer",
"{",
"}",
"\n",
"easyjsonC5a4559bEncodeGithubComChromedpCdprotoCss33",
"(",
"&",
"w",
",",
"v",
")",
"\n",
"return",
"w",
".",
"Buffer",
".",
"BuildBytes",
"(",
")",
",",
"w",
".",
"Error",
"\n",
"}"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.