id
int32 0
25.3k
| idx
stringlengths 5
9
| nl_tokens
sequencelengths 1
418
| pl_tokens
sequencelengths 22
4.98k
|
---|---|---|---|
23,600 | all-23601 | [
"Load",
"loads",
"a",
"dictionary",
"from",
"a",
"file",
"."
] | [
"func",
"Load",
"(",
"path",
"string",
")",
"(",
"d",
"*",
"Dic",
",",
"err",
"error",
")",
"{",
"d",
"=",
"new",
"(",
"Dic",
")",
"\n",
"r",
",",
"err",
":=",
"zip",
".",
"OpenReader",
"(",
"path",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"d",
",",
"err",
"\n",
"}",
"\n",
"defer",
"r",
".",
"Close",
"(",
")",
"\n\n",
"for",
"_",
",",
"f",
":=",
"range",
"r",
".",
"File",
"{",
"if",
"err",
"=",
"func",
"(",
")",
"error",
"{",
"rc",
",",
"e",
":=",
"f",
".",
"Open",
"(",
")",
"\n",
"if",
"e",
"!=",
"nil",
"{",
"return",
"e",
"\n",
"}",
"\n",
"defer",
"rc",
".",
"Close",
"(",
")",
"\n",
"<mask>",
"f",
".",
"Name",
"{",
"case",
"\"",
"\"",
":",
"if",
"e",
"=",
"d",
".",
"loadMorphDicPart",
"(",
"rc",
")",
";",
"e",
"!=",
"nil",
"{",
"return",
"e",
"\n",
"}",
"\n",
"case",
"\"",
"\"",
":",
"if",
"e",
"=",
"d",
".",
"loadPOSDicPart",
"(",
"rc",
")",
";",
"e",
"!=",
"nil",
"{",
"return",
"e",
"\n",
"}",
"\n",
"case",
"\"",
"\"",
":",
"if",
"e",
"=",
"d",
".",
"loadContentDicPart",
"(",
"rc",
")",
";",
"e",
"!=",
"nil",
"{",
"return",
"e",
"\n",
"}",
"\n",
"case",
"\"",
"\"",
":",
"if",
"e",
"=",
"d",
".",
"loadIndexDicPart",
"(",
"rc",
")",
";",
"e",
"!=",
"nil",
"{",
"return",
"e",
"\n",
"}",
"\n",
"case",
"\"",
"\"",
":",
"if",
"e",
"=",
"d",
".",
"loadConnectionDicPart",
"(",
"rc",
")",
";",
"e",
"!=",
"nil",
"{",
"return",
"e",
"\n",
"}",
"\n",
"case",
"\"",
"\"",
":",
"if",
"e",
"=",
"d",
".",
"loadCharDefDicPart",
"(",
"rc",
")",
";",
"e",
"!=",
"nil",
"{",
"return",
"e",
"\n",
"}",
"\n",
"case",
"\"",
"\"",
":",
"if",
"e",
"=",
"d",
".",
"loadUnkDicPart",
"(",
"rc",
")",
";",
"e",
"!=",
"nil",
"{",
"return",
"e",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}",
"(",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"\n",
"}"
] |
23,601 | all-23602 | [
"PackWithSignature",
"packs",
"message",
"with",
"signature",
"."
] | [
"func",
"PackWithSignature",
"(",
"msg",
"[",
"]",
"byte",
",",
"key",
"*",
"ecdsa",
".",
"PrivateKey",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"sig",
",",
"err",
":=",
"signature",
"(",
"key",
",",
"<mask>",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"return",
"packSignature",
"(",
"msg",
",",
"sig",
")",
",",
"nil",
"\n",
"}"
] |
23,602 | all-23603 | [
"Transport",
"communicates",
"with",
"etcd",
"tester",
"."
] | [
"func",
"(",
"srv",
"*",
"Server",
")",
"Transport",
"(",
"stream",
"rpcpb",
".",
"Transport_TransportServer",
")",
"(",
"err",
"error",
")",
"{",
"errc",
":=",
"make",
"(",
"chan",
"error",
")",
"\n",
"go",
"func",
"(",
")",
"{",
"for",
"{",
"var",
"req",
"*",
"rpcpb",
".",
"Request",
"\n",
"req",
",",
"err",
"=",
"stream",
".",
"Recv",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"errc",
"<-",
"err",
"\n",
"// TODO: handle error and retry",
"return",
"\n",
"}",
"\n",
"if",
"req",
".",
"Member",
"!=",
"nil",
"{",
"srv",
".",
"Member",
"=",
"req",
".",
"Member",
"\n",
"}",
"\n",
"if",
"req",
".",
"Tester",
"!=",
"nil",
"{",
"srv",
".",
"Tester",
"=",
"req",
".",
"Tester",
"\n",
"}",
"\n\n",
"var",
"resp",
"*",
"rpcpb",
".",
"Response",
"\n",
"resp",
",",
"err",
"=",
"srv",
".",
"handleTesterRequest",
"(",
"req",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"errc",
"<-",
"err",
"\n",
"// TODO: handle error and retry",
"return",
"\n",
"}",
"\n\n",
"if",
"err",
"=",
"stream",
".",
"Send",
"(",
"resp",
")",
";",
"err",
"!=",
"nil",
"{",
"errc",
"<-",
"err",
"\n",
"// TODO: handle error and retry",
"return",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"(",
")",
"\n\n",
"select",
"{",
"<mask>",
"err",
"=",
"<-",
"errc",
":",
"case",
"<-",
"stream",
".",
"Context",
"(",
")",
".",
"Done",
"(",
")",
":",
"err",
"=",
"stream",
".",
"Context",
"(",
")",
".",
"Err",
"(",
")",
"\n",
"}",
"\n",
"return",
"err",
"\n",
"}"
] |
23,603 | all-23604 | [
"Success",
"calls",
"UI",
".",
"Success",
"to",
"write",
".",
"Useful",
"when",
"you",
"want",
"separate",
"colors",
"or",
"prefixes",
".",
"SuccessPrefix",
"is",
"used",
"to",
"prefix",
"the",
"message",
"."
] | [
"func",
"(",
"ui",
"*",
"PrefixUI",
")",
"Success",
"(",
"message",
"string",
")",
"{",
"if",
"ui",
".",
"SuccessPrefix",
"==",
"\"",
"\"",
"{",
"//Lets keep the space if they want one",
"message",
"=",
"ui",
".",
"SuccessPrefix",
"+",
"message",
"\n",
"}",
"else",
"if",
"ui",
".",
"SuccessPrefix",
"!=",
"\"",
"\"",
"{",
"<mask>",
"=",
"ui",
".",
"SuccessPrefix",
"+",
"\"",
"\"",
"+",
"message",
"\n",
"}",
"\n",
"ui",
".",
"UI",
".",
"Success",
"(",
"message",
")",
"\n",
"}"
] |
23,604 | all-23605 | [
"Compile",
"satisfies",
"the",
"compiler",
".",
"Compiler",
"interface",
".",
"It",
"accepts",
"an",
"AST",
"created",
"by",
"parser",
".",
"Parser",
"and",
"returns",
"vm",
".",
"ByteCode",
"or",
"an",
"error"
] | [
"func",
"(",
"c",
"*",
"BasicCompiler",
")",
"Compile",
"(",
"ast",
"*",
"parser",
".",
"AST",
")",
"(",
"*",
"vm",
".",
"ByteCode",
",",
"error",
")",
"{",
"ctx",
":=",
"&",
"context",
"{",
"ByteCode",
":",
"vm",
".",
"NewByteCode",
"(",
")",
",",
"}",
"\n",
"for",
"_",
",",
"n",
":=",
"range",
"ast",
".",
"Root",
".",
"Nodes",
"{",
"compile",
"(",
"ctx",
",",
"n",
")",
"\n",
"}",
"\n\n",
"// When we're done compiling, always append an END op",
"ctx",
".",
"ByteCode",
".",
"AppendOp",
"(",
"vm",
".",
"TXOPEnd",
")",
"\n\n",
"<mask>",
":=",
"&",
"NaiveOptimizer",
"{",
"}",
"\n",
"opt",
".",
"Optimize",
"(",
"ctx",
".",
"ByteCode",
")",
"\n\n",
"ctx",
".",
"ByteCode",
".",
"Name",
"=",
"ast",
".",
"Name",
"\n",
"return",
"ctx",
".",
"ByteCode",
",",
"nil",
"\n",
"}"
] |
23,605 | all-23606 | [
"RegisterMethod",
"adds",
"support",
"for",
"custom",
"HTTP",
"method",
"handlers",
"available",
"via",
"Router#Method",
"and",
"Router#MethodFunc"
] | [
"func",
"RegisterMethod",
"(",
"method",
"string",
")",
"{",
"if",
"method",
"==",
"\"",
"\"",
"{",
"return",
"\n",
"}",
"\n",
"method",
"=",
"strings",
".",
"ToUpper",
"(",
"method",
")",
"\n",
"if",
"_",
",",
"ok",
":=",
"methodMap",
"[",
"<mask>",
"]",
";",
"ok",
"{",
"return",
"\n",
"}",
"\n",
"n",
":=",
"len",
"(",
"methodMap",
")",
"\n",
"if",
"n",
">",
"strconv",
".",
"IntSize",
"{",
"panic",
"(",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"strconv",
".",
"IntSize",
")",
")",
"\n",
"}",
"\n",
"mt",
":=",
"methodTyp",
"(",
"math",
".",
"Exp2",
"(",
"float64",
"(",
"n",
")",
")",
")",
"\n",
"methodMap",
"[",
"method",
"]",
"=",
"mt",
"\n",
"mALL",
"|=",
"mt",
"\n",
"}"
] |
23,606 | all-23607 | [
"returns",
"list",
"of",
"all",
"namespaces",
"matching",
"given",
"hostname"
] | [
"func",
"matchingNamespaces",
"(",
"hostname",
"string",
",",
"namespaces",
"[",
"]",
"*",
"sd",
".",
"NamespaceSummary",
")",
"[",
"]",
"*",
"sd",
".",
"NamespaceSummary",
"{",
"matchingNamespaces",
":=",
"make",
"(",
"[",
"]",
"*",
"sd",
".",
"NamespaceSummary",
",",
"0",
")",
"\n\n",
"for",
"_",
",",
"ns",
":=",
"<mask>",
"namespaces",
"{",
"if",
"*",
"ns",
".",
"Name",
"==",
"hostname",
"{",
"matchingNamespaces",
"=",
"append",
"(",
"matchingNamespaces",
",",
"ns",
")",
"\n",
"}",
"\n",
"}",
"\n\n",
"return",
"matchingNamespaces",
"\n",
"}"
] |
23,607 | all-23608 | [
"Row",
"creates",
"a",
"Row",
"query",
".",
"Row",
"retrieves",
"the",
"indices",
"of",
"all",
"the",
"set",
"columns",
"in",
"a",
"row",
".",
"It",
"also",
"retrieves",
"any",
"attributes",
"set",
"on",
"that",
"row",
"or",
"column",
"."
] | [
"func",
"(",
"f",
"*",
"Field",
")",
"Row",
"(",
"rowIDOrKey",
"interface",
"{",
"}",
")",
"*",
"PQLRowQuery",
"{",
"rowStr",
",",
"err",
":=",
"formatIDKeyBool",
"(",
"rowIDOrKey",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"NewPQLRowQuery",
"(",
"\"",
"\"",
",",
"f",
".",
"<mask>",
",",
"err",
")",
"\n",
"}",
"\n",
"text",
":=",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"f",
".",
"name",
",",
"rowStr",
")",
"\n",
"q",
":=",
"NewPQLRowQuery",
"(",
"text",
",",
"f",
".",
"index",
",",
"nil",
")",
"\n",
"return",
"q",
"\n",
"}"
] |
23,608 | all-23609 | [
"Key",
"is",
"the",
"index",
"key",
";",
"it",
"may",
"return",
"-",
"1",
"if",
"in",
"a",
"split",
"state"
] | [
"func",
"(",
"si",
"SliceIndex",
")",
"<mask>",
"(",
")",
"int",
"{",
"if",
"si",
".",
"xkey",
"!=",
"si",
".",
"ykey",
"{",
"return",
"-",
"1",
"\n",
"}",
"\n",
"return",
"si",
".",
"xkey",
"\n",
"}"
] |
23,609 | all-23610 | [
"Uses",
"id",
"or",
"address",
"this",
"is",
"only",
"used",
"because",
"previously",
"we",
"didn",
"t",
"have",
"iaas",
"-",
"id",
"in",
"node",
"metadata",
"."
] | [
"func",
"FindMachineByIdOrAddress",
"(",
"id",
"string",
",",
"address",
"string",
")",
"(",
"Machine",
",",
"error",
")",
"{",
"coll",
",",
"err",
":=",
"collection",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"Machine",
"{",
"}",
",",
"err",
"\n",
"}",
"\n",
"defer",
"coll",
".",
"Close",
"(",
")",
"\n",
"var",
"result",
"Machine",
"\n",
"query",
":=",
"bson",
".",
"M",
"{",
"}",
"\n",
"if",
"id",
"!=",
"\"",
"\"",
"{",
"query",
"[",
"\"",
"\"",
"]",
"=",
"id",
"\n",
"}",
"else",
"{",
"<mask>",
"[",
"\"",
"\"",
"]",
"=",
"address",
"\n",
"}",
"\n",
"err",
"=",
"coll",
".",
"Find",
"(",
"query",
")",
".",
"One",
"(",
"&",
"result",
")",
"\n",
"if",
"err",
"==",
"mgo",
".",
"ErrNotFound",
"{",
"err",
"=",
"ErrMachineNotFound",
"\n",
"}",
"\n",
"return",
"result",
",",
"err",
"\n",
"}"
] |
23,610 | all-23611 | [
"InitWithKube",
"is",
"like",
"InitServiceEnv",
"but",
"also",
"assumes",
"that",
"it",
"s",
"run",
"inside",
"a",
"kubernetes",
"cluster",
"and",
"tries",
"to",
"connect",
"to",
"the",
"kubernetes",
"API",
"server",
"."
] | [
"func",
"InitWithKube",
"(",
"config",
"*",
"<mask>",
")",
"*",
"ServiceEnv",
"{",
"env",
":=",
"InitServiceEnv",
"(",
"config",
")",
"\n",
"env",
".",
"kubeEg",
".",
"Go",
"(",
"env",
".",
"initKubeClient",
")",
"\n",
"return",
"env",
"// env is not ready yet",
"\n",
"}"
] |
23,611 | all-23612 | [
"RenameClusterMember",
"changes",
"the",
"name",
"of",
"an",
"existing",
"member"
] | [
"func",
"(",
"r",
"*",
"ProtocolLXD",
")",
"RenameClusterMember",
"(",
"name",
"string",
",",
"member",
"api",
".",
"ClusterMemberPost",
")",
"error",
"{",
"if",
"!",
"r",
".",
"HasExtension",
"(",
"\"",
"\"",
")",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\\\"",
"\\\"",
"\"",
")",
"\n",
"}",
"\n\n",
"_",
",",
"_",
",",
"err",
":=",
"r",
".",
"<mask>",
"(",
"\"",
"\"",
",",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"name",
")",
",",
"member",
",",
"\"",
"\"",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"return",
"nil",
"\n",
"}"
] |
23,612 | all-23613 | [
"GetNetworkLeases",
"returns",
"a",
"list",
"of",
"Network",
"struct"
] | [
"func",
"(",
"r",
"*",
"ProtocolLXD",
")",
"GetNetworkLeases",
"(",
"<mask>",
"string",
")",
"(",
"[",
"]",
"api",
".",
"NetworkLease",
",",
"error",
")",
"{",
"if",
"!",
"r",
".",
"HasExtension",
"(",
"\"",
"\"",
")",
"{",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\\\"",
"\\\"",
"\"",
")",
"\n",
"}",
"\n\n",
"leases",
":=",
"[",
"]",
"api",
".",
"NetworkLease",
"{",
"}",
"\n\n",
"// Fetch the raw value",
"_",
",",
"err",
":=",
"r",
".",
"queryStruct",
"(",
"\"",
"\"",
",",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"url",
".",
"QueryEscape",
"(",
"name",
")",
")",
",",
"nil",
",",
"\"",
"\"",
",",
"&",
"leases",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"return",
"leases",
",",
"nil",
"\n",
"}"
] |
23,613 | all-23614 | [
"/",
"*",
"Initializes",
"CvMat",
"header"
] | [
"func",
"(",
"mat",
"*",
"Mat",
")",
"InitHeader",
"(",
"<mask>",
",",
"cols",
",",
"type_",
"int",
",",
"data",
"unsafe",
".",
"Pointer",
",",
"step",
"int",
")",
"{",
"C",
".",
"cvInitMatHeader",
"(",
"(",
"*",
"C",
".",
"CvMat",
")",
"(",
"mat",
")",
",",
"C",
".",
"int",
"(",
"rows",
")",
",",
"C",
".",
"int",
"(",
"cols",
")",
",",
"C",
".",
"int",
"(",
"type_",
")",
",",
"data",
",",
"C",
".",
"int",
"(",
"step",
")",
",",
")",
"\n",
"}"
] |
23,614 | all-23615 | [
"HTTPLogger",
"is",
"simple",
"http",
"access",
"logger"
] | [
"func",
"HTTPLogger",
"(",
"name",
"string",
",",
"handler",
"http",
".",
"<mask>",
")",
"http",
".",
"Handler",
"{",
"return",
"glg",
".",
"HTTPLogger",
"(",
"name",
",",
"handler",
")",
"\n",
"}"
] |
23,615 | all-23616 | [
"Nonce",
"returns",
"a",
"handler",
"that",
"will",
"check",
"each",
"request",
"for",
"the",
"existence",
"of",
"a",
"nonce",
".",
"If",
"a",
"nonce",
"exists",
"it",
"will",
"be",
"checked",
"for",
"expiration",
".",
"A",
"status",
"will",
"be",
"recorded",
"in",
"the",
"request",
"s",
"context",
"indicating",
"whether",
"there",
"was",
"a",
"nonce",
"in",
"the",
"request",
"and",
"if",
"so",
"whether",
"it",
"is",
"valid",
"or",
"expired",
".",
"The",
"recorded",
"status",
"can",
"later",
"be",
"obtained",
"using",
"the",
"NonceValueFromRequest",
"function",
".",
"A",
"nonce",
"can",
"be",
"set",
"for",
"later",
"checking",
"using",
"the",
"StoreNonce",
"function",
"."
] | [
"func",
"Nonce",
"(",
"h",
"http",
".",
"Handler",
",",
"opts",
"...",
"Option",
")",
"http",
".",
"Handler",
"{",
"headerStorage",
":=",
"nonceHeaderStorage",
"{",
"}",
"\n",
"o",
":=",
"options",
"{",
"logger",
":",
"handler",
".",
"OutLogger",
"(",
")",
",",
"generator",
":",
"timeRandomGenerator",
",",
"getter",
":",
"headerStorage",
",",
"setter",
":",
"headerStorage",
",",
"age",
":",
"45",
"*",
"time",
".",
"Second",
",",
"}",
"\n",
"o",
".",
"apply",
"(",
"opts",
")",
"\n\n",
"<mask>",
":=",
"nonceStore",
"{",
"}",
"\n",
"opChan",
":=",
"make",
"(",
"chan",
"func",
"(",
"nonceStore",
")",
")",
"\n\n",
"go",
"func",
"(",
")",
"{",
"for",
"op",
":=",
"range",
"opChan",
"{",
"op",
"(",
"store",
")",
"\n",
"}",
"\n",
"}",
"(",
")",
"\n\n",
"go",
"func",
"(",
")",
"{",
"for",
"{",
"select",
"{",
"case",
"<-",
"time",
".",
"After",
"(",
"5",
"*",
"time",
".",
"Minute",
")",
":",
"cleanup",
"(",
"o",
".",
"age",
",",
"opChan",
")",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"(",
")",
"\n\n",
"setter",
":=",
"func",
"(",
"w",
"http",
".",
"ResponseWriter",
",",
"r",
"*",
"http",
".",
"Request",
")",
"error",
"{",
"nonce",
",",
"err",
":=",
"generateAndStore",
"(",
"o",
".",
"age",
",",
"o",
".",
"generator",
",",
"opChan",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"return",
"o",
".",
"setter",
".",
"SetNonce",
"(",
"nonce",
",",
"w",
",",
"r",
")",
"\n",
"}",
"\n\n",
"return",
"http",
".",
"HandlerFunc",
"(",
"func",
"(",
"w",
"http",
".",
"ResponseWriter",
",",
"r",
"*",
"http",
".",
"Request",
")",
"{",
"ctx",
":=",
"r",
".",
"Context",
"(",
")",
"\n\n",
"nonce",
":=",
"o",
".",
"getter",
".",
"GetNonce",
"(",
"r",
")",
"\n",
"if",
"nonce",
"!=",
"\"",
"\"",
"{",
"if",
"validateAndRemoveNonce",
"(",
"nonce",
",",
"o",
".",
"age",
",",
"opChan",
")",
"{",
"ctx",
"=",
"context",
".",
"WithValue",
"(",
"ctx",
",",
"nonceValueKey",
",",
"NonceStatus",
"{",
"NonceValid",
"}",
")",
"\n",
"}",
"else",
"{",
"ctx",
"=",
"context",
".",
"WithValue",
"(",
"ctx",
",",
"nonceValueKey",
",",
"NonceStatus",
"{",
"NonceInvalid",
"}",
")",
"\n",
"}",
"\n",
"}",
"\n\n",
"h",
".",
"ServeHTTP",
"(",
"w",
",",
"r",
".",
"WithContext",
"(",
"context",
".",
"WithValue",
"(",
"ctx",
",",
"nonceSetterKey",
",",
"setter",
")",
")",
")",
"\n",
"}",
")",
"\n",
"}"
] |
23,616 | all-23617 | [
"EmbeddedDockerReferenceConflicts",
"whether",
"a",
"Docker",
"reference",
"embedded",
"in",
"the",
"manifest",
"if",
"any",
"conflicts",
"with",
"destination",
"ref",
".",
"It",
"returns",
"false",
"if",
"the",
"manifest",
"does",
"not",
"embed",
"a",
"Docker",
"reference",
".",
"(",
"This",
"embedding",
"unfortunately",
"happens",
"for",
"Docker",
"schema1",
"please",
"do",
"not",
"add",
"support",
"for",
"this",
"in",
"any",
"new",
"formats",
".",
")"
] | [
"func",
"(",
"m",
"*",
"manifestSchema1",
")",
"EmbeddedDockerReferenceConflicts",
"(",
"ref",
"reference",
".",
"Named",
")",
"bool",
"{",
"// This is a bit convoluted: We can’t just have a \"get embedded docker reference\" method",
"// and have the “does it conflict” logic in the generic copy code, because the manifest does not actually",
"// embed a full docker/distribution reference, but only the repo name and tag (without the host name).",
"// So we would have to provide a “return repo without host name, and tag” getter for the generic code,",
"// which would be very awkward. Instead, we do the matching here in schema1-specific code, and all the",
"// generic copy code needs to know about is reference.Named and that a manifest may need updating",
"// for some destinations.",
"name",
":=",
"reference",
".",
"Path",
"(",
"ref",
")",
"\n",
"var",
"tag",
"string",
"\n",
"if",
"tagged",
",",
"isTagged",
":=",
"ref",
".",
"(",
"reference",
".",
"NamedTagged",
")",
";",
"isTagged",
"{",
"tag",
"=",
"tagged",
".",
"Tag",
"(",
")",
"\n",
"}",
"else",
"{",
"tag",
"=",
"\"",
"\"",
"\n",
"}",
"\n",
"return",
"m",
".",
"m",
".",
"Name",
"!=",
"name",
"||",
"m",
".",
"m",
".",
"Tag",
"!=",
"<mask>",
"\n",
"}"
] |
23,617 | all-23618 | [
"DeleteRecords",
"deletes",
"a",
"given",
"set",
"of",
"DNS",
"records",
"in",
"a",
"given",
"zone",
"."
] | [
"func",
"(",
"p",
"*",
"AWSProvider",
")",
"DeleteRecords",
"(",
"endpoints",
"[",
"]",
"*",
"endpoint",
".",
"Endpoint",
")",
"<mask>",
"{",
"return",
"p",
".",
"doRecords",
"(",
"route53",
".",
"ChangeActionDelete",
",",
"endpoints",
")",
"\n",
"}"
] |
23,618 | all-23619 | [
"EncodePeer",
"implements",
"the",
"Transport",
"interface",
"."
] | [
"func",
"(",
"i",
"*",
"InmemTransport",
")",
"EncodePeer",
"(",
"<mask>",
"ServerID",
",",
"p",
"ServerAddress",
")",
"[",
"]",
"byte",
"{",
"return",
"[",
"]",
"byte",
"(",
"p",
")",
"\n",
"}"
] |
23,619 | all-23620 | [
"SetSuperSecureCookie",
"sets",
"given",
"cookie",
"value",
"to",
"response",
"header",
"with",
"secret",
"string",
"."
] | [
"func",
"(",
"ctx",
"*",
"Context",
")",
"SetSuperSecureCookie",
"(",
"secret",
",",
"name",
",",
"value",
"string",
",",
"others",
"...",
"<mask>",
"{",
"}",
")",
"{",
"key",
":=",
"pbkdf2",
".",
"Key",
"(",
"[",
"]",
"byte",
"(",
"secret",
")",
",",
"[",
"]",
"byte",
"(",
"secret",
")",
",",
"1000",
",",
"16",
",",
"sha256",
".",
"New",
")",
"\n",
"text",
",",
"err",
":=",
"com",
".",
"AESGCMEncrypt",
"(",
"key",
",",
"[",
"]",
"byte",
"(",
"value",
")",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"panic",
"(",
"\"",
"\"",
"+",
"err",
".",
"Error",
"(",
")",
")",
"\n",
"}",
"\n\n",
"ctx",
".",
"SetCookie",
"(",
"name",
",",
"hex",
".",
"EncodeToString",
"(",
"text",
")",
",",
"others",
"...",
")",
"\n",
"}"
] |
23,620 | all-23621 | [
"TypeFromInstance",
"is",
"a",
"wrapper",
"around",
"g_type_from_instance",
"()",
"."
] | [
"func",
"(",
"v",
"*",
"Object",
")",
"TypeFromInstance",
"(",
")",
"<mask>",
"{",
"c",
":=",
"C",
".",
"_g_type_from_instance",
"(",
"C",
".",
"gpointer",
"(",
"unsafe",
".",
"Pointer",
"(",
"v",
".",
"native",
"(",
")",
")",
")",
")",
"\n",
"return",
"Type",
"(",
"c",
")",
"\n",
"}"
] |
23,621 | all-23622 | [
"PutString",
"writes",
"a",
"string",
"value",
"for",
"the",
"given",
"field",
".",
"The",
"field",
"type",
"must",
"be",
"a",
"StringField",
"otherwise",
"an",
"error",
"will",
"be",
"returned",
".",
"The",
"type",
"code",
"is",
"written",
"first",
"then",
"a",
"length",
"and",
"finally",
"the",
"value",
".",
"If",
"the",
"size",
"of",
"the",
"string",
"is",
"<",
"math",
".",
"MaxUint8",
"a",
"single",
"byte",
"will",
"represent",
"the",
"length",
".",
"If",
"the",
"size",
"of",
"the",
"string",
"is",
"<",
"math",
".",
"MaxUint16",
"a",
"uint16",
"value",
"will",
"represent",
"the",
"length",
"and",
"so",
"on",
".",
"If",
"the",
"buffer",
"does",
"not",
"have",
"enough",
"space",
"for",
"the",
"entire",
"string",
"and",
"field",
"header",
"an",
"error",
"will",
"be",
"returned",
".",
"If",
"successful",
"the",
"number",
"of",
"bytes",
"written",
"will",
"be",
"returned",
"as",
"well",
"as",
"a",
"nil",
"error",
"."
] | [
"func",
"(",
"b",
"*",
"TupleBuilder",
")",
"PutString",
"(",
"field",
"string",
",",
"value",
"string",
")",
"(",
"wrote",
"int",
",",
"err",
"error",
")",
"{",
"// field type should be",
"if",
"err",
"=",
"b",
".",
"typeCheck",
"(",
"field",
",",
"StringField",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"0",
",",
"err",
"\n",
"}",
"\n\n",
"size",
":=",
"len",
"(",
"value",
")",
"\n",
"if",
"size",
"<",
"math",
".",
"MaxUint8",
"{",
"if",
"b",
".",
"available",
"(",
")",
"<",
"size",
"+",
"2",
"{",
"return",
"0",
",",
"xbinary",
".",
"ErrOutOfRange",
"\n",
"}",
"\n\n",
"// write length",
"xbinary",
".",
"LittleEndian",
".",
"PutString",
"(",
"b",
".",
"buffer",
",",
"b",
".",
"pos",
"+",
"2",
",",
"value",
")",
"\n\n",
"// write type code",
"b",
".",
"buffer",
"[",
"b",
".",
"<mask>",
"]",
"=",
"byte",
"(",
"String8Code",
".",
"OpCode",
")",
"\n\n",
"// write length",
"b",
".",
"buffer",
"[",
"b",
".",
"pos",
"+",
"1",
"]",
"=",
"byte",
"(",
"size",
")",
"\n\n",
"wrote",
"+=",
"size",
"+",
"2",
"\n",
"}",
"else",
"if",
"size",
"<",
"math",
".",
"MaxUint16",
"{",
"if",
"b",
".",
"available",
"(",
")",
"<",
"size",
"+",
"3",
"{",
"return",
"0",
",",
"xbinary",
".",
"ErrOutOfRange",
"\n",
"}",
"\n\n",
"// write length",
"xbinary",
".",
"LittleEndian",
".",
"PutUint16",
"(",
"b",
".",
"buffer",
",",
"b",
".",
"pos",
"+",
"1",
",",
"uint16",
"(",
"size",
")",
")",
"\n\n",
"// write value",
"xbinary",
".",
"LittleEndian",
".",
"PutString",
"(",
"b",
".",
"buffer",
",",
"b",
".",
"pos",
"+",
"3",
",",
"value",
")",
"\n\n",
"// write type code",
"b",
".",
"buffer",
"[",
"b",
".",
"pos",
"]",
"=",
"byte",
"(",
"String16Code",
".",
"OpCode",
")",
"\n\n",
"wrote",
"+=",
"3",
"+",
"size",
"\n",
"}",
"else",
"if",
"size",
"<",
"math",
".",
"MaxUint32",
"{",
"if",
"b",
".",
"available",
"(",
")",
"<",
"size",
"+",
"5",
"{",
"return",
"0",
",",
"xbinary",
".",
"ErrOutOfRange",
"\n",
"}",
"\n\n",
"// write length",
"xbinary",
".",
"LittleEndian",
".",
"PutUint32",
"(",
"b",
".",
"buffer",
",",
"b",
".",
"pos",
"+",
"1",
",",
"uint32",
"(",
"size",
")",
")",
"\n\n",
"// write value",
"xbinary",
".",
"LittleEndian",
".",
"PutString",
"(",
"b",
".",
"buffer",
",",
"b",
".",
"pos",
"+",
"5",
",",
"value",
")",
"\n\n",
"// write type code",
"b",
".",
"buffer",
"[",
"b",
".",
"pos",
"]",
"=",
"byte",
"(",
"String32Code",
".",
"OpCode",
")",
"\n\n",
"wrote",
"+=",
"5",
"+",
"size",
"\n",
"}",
"else",
"{",
"if",
"b",
".",
"available",
"(",
")",
"<",
"size",
"+",
"9",
"{",
"return",
"0",
",",
"xbinary",
".",
"ErrOutOfRange",
"\n",
"}",
"\n\n",
"// write length",
"xbinary",
".",
"LittleEndian",
".",
"PutUint64",
"(",
"b",
".",
"buffer",
",",
"b",
".",
"pos",
"+",
"1",
",",
"uint64",
"(",
"size",
")",
")",
"\n\n",
"// write value",
"xbinary",
".",
"LittleEndian",
".",
"PutString",
"(",
"b",
".",
"buffer",
",",
"b",
".",
"pos",
"+",
"9",
",",
"value",
")",
"\n\n",
"// write type code",
"b",
".",
"buffer",
"[",
"b",
".",
"pos",
"]",
"=",
"byte",
"(",
"String64Code",
".",
"OpCode",
")",
"\n\n",
"wrote",
"+=",
"9",
"+",
"size",
"\n",
"}",
"\n\n",
"b",
".",
"offsets",
"[",
"field",
"]",
"=",
"b",
".",
"pos",
"\n",
"b",
".",
"pos",
"+=",
"wrote",
"\n",
"return",
"\n",
"}"
] |
23,622 | all-23623 | [
"ReadResponse",
"reads",
"a",
"server",
"response",
"into",
"the",
"received",
"o",
"."
] | [
"func",
"(",
"o",
"*",
"DeleteAppsAppRoutesRouteReader",
")",
"ReadResponse",
"(",
"response",
"runtime",
".",
"ClientResponse",
",",
"consumer",
"runtime",
".",
"Consumer",
")",
"(",
"interface",
"{",
"}",
",",
"error",
")",
"{",
"<mask>",
"response",
".",
"Code",
"(",
")",
"{",
"case",
"200",
":",
"result",
":=",
"NewDeleteAppsAppRoutesRouteOK",
"(",
")",
"\n",
"if",
"err",
":=",
"result",
".",
"readResponse",
"(",
"response",
",",
"consumer",
",",
"o",
".",
"formats",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"return",
"result",
",",
"nil",
"\n\n",
"case",
"404",
":",
"result",
":=",
"NewDeleteAppsAppRoutesRouteNotFound",
"(",
")",
"\n",
"if",
"err",
":=",
"result",
".",
"readResponse",
"(",
"response",
",",
"consumer",
",",
"o",
".",
"formats",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"return",
"nil",
",",
"result",
"\n\n",
"default",
":",
"result",
":=",
"NewDeleteAppsAppRoutesRouteDefault",
"(",
"response",
".",
"Code",
"(",
")",
")",
"\n",
"if",
"err",
":=",
"result",
".",
"readResponse",
"(",
"response",
",",
"consumer",
",",
"o",
".",
"formats",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"if",
"response",
".",
"Code",
"(",
")",
"/",
"100",
"==",
"2",
"{",
"return",
"result",
",",
"nil",
"\n",
"}",
"\n",
"return",
"nil",
",",
"result",
"\n",
"}",
"\n",
"}"
] |
23,623 | all-23624 | [
"UnmarshalJSON",
"supports",
"json",
".",
"Unmarshaler",
"interface"
] | [
"func",
"(",
"v",
"*",
"GetCertificateParams",
")",
"UnmarshalJSON",
"(",
"data",
"[",
"]",
"byte",
")",
"error",
"{",
"r",
":=",
"jlexer",
".",
"Lexer",
"{",
"Data",
":",
"data",
"}",
"\n",
"easyjsonC5a4559bDecodeGithubComChromedpCdprotoNetwork37",
"(",
"&",
"r",
",",
"v",
")",
"\n",
"return",
"r",
".",
"<mask>",
"(",
")",
"\n",
"}"
] |
23,624 | all-23625 | [
"NewTransactionExt",
"creates",
"a",
"new",
"TransactionExt",
"."
] | [
"func",
"NewTransactionExt",
"(",
"v",
"int32",
",",
"value",
"interface",
"{",
"}",
")",
"(",
"result",
"TransactionExt",
",",
"err",
"error",
")",
"{",
"result",
".",
"V",
"=",
"v",
"\n",
"switch",
"int32",
"(",
"v",
")",
"{",
"<mask>",
"0",
":",
"// void",
"}",
"\n",
"return",
"\n",
"}"
] |
23,625 | all-23626 | [
"SetTag",
"belongs",
"to",
"the",
"Span",
"interface"
] | [
"func",
"(",
"s",
"*",
"MockSpan",
")",
"SetTag",
"(",
"key",
"string",
",",
"value",
"<mask>",
"{",
"}",
")",
"opentracing",
".",
"Span",
"{",
"s",
".",
"Lock",
"(",
")",
"\n",
"defer",
"s",
".",
"Unlock",
"(",
")",
"\n",
"if",
"key",
"==",
"string",
"(",
"ext",
".",
"SamplingPriority",
")",
"{",
"if",
"v",
",",
"ok",
":=",
"value",
".",
"(",
"uint16",
")",
";",
"ok",
"{",
"s",
".",
"SpanContext",
".",
"Sampled",
"=",
"v",
">",
"0",
"\n",
"return",
"s",
"\n",
"}",
"\n",
"if",
"v",
",",
"ok",
":=",
"value",
".",
"(",
"int",
")",
";",
"ok",
"{",
"s",
".",
"SpanContext",
".",
"Sampled",
"=",
"v",
">",
"0",
"\n",
"return",
"s",
"\n",
"}",
"\n",
"}",
"\n",
"s",
".",
"tags",
"[",
"key",
"]",
"=",
"value",
"\n",
"return",
"s",
"\n",
"}"
] |
23,626 | all-23627 | [
"MarshalJSON",
"supports",
"json",
".",
"Marshaler",
"interface"
] | [
"func",
"(",
"v",
"GetObjectByHeapObjectIDReturns",
")",
"MarshalJSON",
"(",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"w",
":=",
"jwriter",
".",
"Writer",
"{",
"}",
"\n",
"easyjsonC5a4559bEncodeGithubComChromedpCdprotoHeapprofiler11",
"(",
"&",
"w",
",",
"v",
")",
"\n",
"return",
"w",
".",
"<mask>",
".",
"BuildBytes",
"(",
")",
",",
"w",
".",
"Error",
"\n",
"}"
] |
23,627 | all-23628 | [
"RenderView",
"renders",
"a",
"template",
"string",
"using",
"the",
"provided",
"template",
"and",
"vars",
"struct",
"and",
"returns",
"the",
"rendered",
"tamplate"
] | [
"func",
"(",
"c",
"*",
"<mask>",
")",
"RenderView",
"(",
"templateStr",
"string",
",",
"vars",
"interface",
"{",
"}",
")",
"[",
"]",
"byte",
"{",
"t",
",",
"err",
":=",
"template",
".",
"New",
"(",
"\"",
"\"",
")",
".",
"Parse",
"(",
"templateStr",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"panic",
"(",
"err",
".",
"Error",
"(",
")",
")",
"\n",
"}",
"\n",
"return",
"c",
".",
"RenderTemplate",
"(",
"t",
",",
"vars",
")",
"\n",
"}"
] |
23,628 | all-23629 | [
"MarshalJSON",
"supports",
"json",
".",
"Marshaler",
"interface"
] | [
"func",
"(",
"v",
"AttachToTargetReturns",
")",
"MarshalJSON",
"(",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"w",
":=",
"jwriter",
".",
"<mask>",
"{",
"}",
"\n",
"easyjsonC5a4559bEncodeGithubComChromedpCdprotoTarget28",
"(",
"&",
"w",
",",
"v",
")",
"\n",
"return",
"w",
".",
"Buffer",
".",
"BuildBytes",
"(",
")",
",",
"w",
".",
"Error",
"\n",
"}"
] |
23,629 | all-23630 | [
"LogFunc",
"outputs",
"Log",
"level",
"log",
"returned",
"from",
"the",
"function"
] | [
"func",
"(",
"g",
"*",
"Glg",
")",
"LogFunc",
"(",
"f",
"func",
"(",
")",
"string",
")",
"error",
"{",
"if",
"g",
".",
"isModeEnable",
"(",
"LOG",
")",
"{",
"return",
"g",
".",
"<mask>",
"(",
"LOG",
",",
"\"",
"\"",
",",
"f",
"(",
")",
")",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
] |
23,630 | all-23631 | [
"Extract",
"calls",
"f",
"(",
"r",
")"
] | [
"func",
"(",
"f",
"RequestTokenExtractorFunc",
")",
"Extract",
"(",
"r",
"*",
"<mask>",
".",
"Request",
")",
"(",
"*",
"jwt",
".",
"JSONWebToken",
",",
"error",
")",
"{",
"return",
"f",
"(",
"r",
")",
"\n",
"}"
] |
23,631 | all-23632 | [
"MarshalEasyJSON",
"satisfies",
"easyjson",
".",
"Marshaler",
"."
] | [
"func",
"(",
"t",
"VirtualTimePolicy",
")",
"MarshalEasyJSON",
"(",
"out",
"*",
"jwriter",
".",
"Writer",
")",
"{",
"out",
".",
"<mask>",
"(",
"string",
"(",
"t",
")",
")",
"\n",
"}"
] |
23,632 | all-23633 | [
"Call",
"the",
"parent",
"CloseNotify",
".",
"Provided",
"in",
"order",
"to",
"implement",
"the",
"http",
".",
"CloseNotifier",
"interface",
"."
] | [
"func",
"(",
"w",
"*",
"gzipResponseWriter",
")",
"CloseNotify",
"(",
")",
"<-",
"chan",
"bool",
"{",
"notifier",
":=",
"w",
".",
"ResponseWriter",
".",
"(",
"<mask>",
".",
"CloseNotifier",
")",
"\n",
"return",
"notifier",
".",
"CloseNotify",
"(",
")",
"\n",
"}"
] |
23,633 | all-23634 | [
"Write",
"implements",
"Handler",
"interface"
] | [
"func",
"(",
"h",
"*",
"StreamHandler",
")",
"Write",
"(",
"b",
"[",
"]",
"<mask>",
")",
"(",
"n",
"int",
",",
"err",
"error",
")",
"{",
"return",
"h",
".",
"w",
".",
"Write",
"(",
"b",
")",
"\n",
"}"
] |
23,634 | all-23635 | [
"Validate",
"options",
"are",
"useful"
] | [
"func",
"(",
"opts",
"*",
"Options",
")",
"Validate",
"(",
")",
"error",
"{",
"if",
"opts",
".",
"App",
".",
"IsZero",
"(",
")",
"{",
"opts",
".",
"App",
"=",
"meta",
".",
"New",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"if",
"len",
"(",
"opts",
".",
"Name",
".",
"String",
"(",
")",
")",
"==",
"0",
"{",
"return",
"<mask>",
".",
"New",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
] |
23,635 | all-23636 | [
"RuleGroups",
"returns",
"the",
"list",
"of",
"manager",
"s",
"rule",
"groups",
"."
] | [
"func",
"(",
"m",
"*",
"<mask>",
")",
"RuleGroups",
"(",
")",
"[",
"]",
"*",
"Group",
"{",
"m",
".",
"mtx",
".",
"RLock",
"(",
")",
"\n",
"defer",
"m",
".",
"mtx",
".",
"RUnlock",
"(",
")",
"\n\n",
"rgs",
":=",
"make",
"(",
"[",
"]",
"*",
"Group",
",",
"0",
",",
"len",
"(",
"m",
".",
"groups",
")",
")",
"\n",
"for",
"_",
",",
"g",
":=",
"range",
"m",
".",
"groups",
"{",
"rgs",
"=",
"append",
"(",
"rgs",
",",
"g",
")",
"\n",
"}",
"\n\n",
"// Sort rule groups by file, then by name.",
"sort",
".",
"Slice",
"(",
"rgs",
",",
"func",
"(",
"i",
",",
"j",
"int",
")",
"bool",
"{",
"if",
"rgs",
"[",
"i",
"]",
".",
"file",
"!=",
"rgs",
"[",
"j",
"]",
".",
"file",
"{",
"return",
"rgs",
"[",
"i",
"]",
".",
"file",
"<",
"rgs",
"[",
"j",
"]",
".",
"file",
"\n",
"}",
"\n",
"return",
"rgs",
"[",
"i",
"]",
".",
"name",
"<",
"rgs",
"[",
"j",
"]",
".",
"name",
"\n",
"}",
")",
"\n\n",
"return",
"rgs",
"\n",
"}"
] |
23,636 | all-23637 | [
"bind",
"a",
"named",
"buffer",
"object"
] | [
"func",
"BindBuffer",
"(",
"<mask>",
"uint32",
",",
"buffer",
"uint32",
")",
"{",
"syscall",
".",
"Syscall",
"(",
"gpBindBuffer",
",",
"2",
",",
"uintptr",
"(",
"target",
")",
",",
"uintptr",
"(",
"buffer",
")",
",",
"0",
")",
"\n",
"}"
] |
23,637 | all-23638 | [
"Serialize",
"converts",
"given",
"parts",
"into",
"compact",
"serialization",
"format"
] | [
"func",
"Serialize",
"(",
"parts",
"...",
"[",
"]",
"byte",
")",
"string",
"{",
"result",
":=",
"make",
"(",
"[",
"]",
"string",
",",
"len",
"(",
"parts",
")",
")",
"\n\n",
"for",
"i",
",",
"part",
":=",
"<mask>",
"parts",
"{",
"result",
"[",
"i",
"]",
"=",
"base64url",
".",
"Encode",
"(",
"part",
")",
"\n",
"}",
"\n\n",
"return",
"strings",
".",
"Join",
"(",
"result",
",",
"\"",
"\"",
")",
"\n",
"}"
] |
23,638 | all-23639 | [
"Lua",
"accepts",
"concatenation",
"with",
"string",
"and",
"number",
"."
] | [
"func",
"string__concat",
"(",
"L",
"*",
"lua",
".",
"State",
")",
"int",
"{",
"v1",
",",
"t1",
":=",
"luaToGoValue",
"(",
"L",
",",
"1",
")",
"\n",
"v2",
",",
"t2",
":=",
"luaToGoValue",
"(",
"L",
",",
"2",
")",
"\n",
"s1",
":=",
"valueToString",
"(",
"L",
",",
"v1",
")",
"\n",
"s2",
":=",
"valueToString",
"(",
"L",
",",
"v2",
")",
"\n",
"<mask>",
":=",
"s1",
"+",
"s2",
"\n\n",
"if",
"t1",
"==",
"t2",
"||",
"isPredeclaredType",
"(",
"t2",
")",
"{",
"v",
":=",
"reflect",
".",
"ValueOf",
"(",
"result",
")",
"\n",
"makeValueProxy",
"(",
"L",
",",
"v",
".",
"Convert",
"(",
"t1",
")",
",",
"cStringMeta",
")",
"\n",
"}",
"else",
"if",
"isPredeclaredType",
"(",
"t1",
")",
"{",
"v",
":=",
"reflect",
".",
"ValueOf",
"(",
"result",
")",
"\n",
"makeValueProxy",
"(",
"L",
",",
"v",
".",
"Convert",
"(",
"t2",
")",
",",
"cStringMeta",
")",
"\n",
"}",
"else",
"{",
"L",
".",
"PushString",
"(",
"result",
")",
"\n",
"}",
"\n\n",
"return",
"1",
"\n",
"}"
] |
23,639 | all-23640 | [
"MarshalJSON",
"supports",
"json",
".",
"Marshaler",
"interface"
] | [
"func",
"(",
"v",
"NavigateParams",
")",
"MarshalJSON",
"(",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"w",
":=",
"jwriter",
".",
"Writer",
"{",
"}",
"\n",
"easyjsonC5a4559bEncodeGithubComChromedpCdprotoPage27",
"(",
"&",
"w",
",",
"v",
")",
"\n",
"return",
"w",
".",
"Buffer",
".",
"BuildBytes",
"(",
")",
",",
"w",
".",
"<mask>",
"\n",
"}"
] |
23,640 | all-23641 | [
"Relay",
"is",
"called",
"for",
"each",
"frame",
"that",
"is",
"read",
"on",
"the",
"connection",
"."
] | [
"func",
"(",
"r",
"*",
"Relayer",
")",
"Relay",
"(",
"f",
"*",
"Frame",
")",
"error",
"{",
"if",
"f",
".",
"messageType",
"(",
")",
"!=",
"messageTypeCallReq",
"{",
"err",
":=",
"r",
".",
"handleNonCallReq",
"(",
"f",
")",
"\n",
"if",
"err",
"==",
"errUnknownID",
"{",
"// This ID may be owned by an outgoing call, so check the outbound",
"// message exchange, and if it succeeds, then the frame has been",
"// handled successfully.",
"if",
"err",
":=",
"r",
".",
"<mask>",
".",
"outbound",
".",
"forwardPeerFrame",
"(",
"f",
")",
";",
"err",
"==",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"err",
"\n",
"}",
"\n",
"return",
"r",
".",
"handleCallReq",
"(",
"newLazyCallReq",
"(",
"f",
")",
")",
"\n",
"}"
] |
23,641 | all-23642 | [
"WithSilent",
"in",
"silent",
"mode",
"exceptions",
"thrown",
"during",
"evaluation",
"are",
"not",
"reported",
"and",
"do",
"not",
"pause",
"execution",
".",
"Overrides",
"setPauseOnException",
"state",
"."
] | [
"func",
"(",
"p",
"CallFunctionOnParams",
")",
"WithSilent",
"(",
"silent",
"bool",
")",
"*",
"CallFunctionOnParams",
"{",
"p",
".",
"Silent",
"=",
"silent",
"\n",
"<mask>",
"&",
"p",
"\n",
"}"
] |
23,642 | all-23643 | [
"Handle",
"interprets",
"r",
"and",
"performs",
"an",
"operation",
"on",
"s",
".",
"store",
"according",
"to",
"r",
".",
"Method",
"and",
"other",
"fields",
".",
"If",
"r",
".",
"Method",
"is",
"POST",
"PUT",
"DELETE",
"or",
"a",
"GET",
"with",
"Quorum",
"==",
"true",
"r",
"will",
"be",
"sent",
"through",
"consensus",
"before",
"performing",
"its",
"respective",
"operation",
".",
"Do",
"will",
"block",
"until",
"an",
"action",
"is",
"performed",
"or",
"there",
"is",
"an",
"error",
"."
] | [
"func",
"(",
"r",
"*",
"RequestV2",
")",
"Handle",
"(",
"ctx",
"context",
".",
"Context",
",",
"v2api",
"RequestV2Handler",
")",
"(",
"Response",
",",
"error",
")",
"{",
"if",
"r",
".",
"Method",
"==",
"\"",
"\"",
"&&",
"r",
".",
"Quorum",
"{",
"r",
".",
"Method",
"=",
"\"",
"\"",
"\n",
"}",
"\n",
"switch",
"r",
".",
"Method",
"{",
"case",
"\"",
"\"",
":",
"return",
"v2api",
".",
"Post",
"(",
"ctx",
",",
"r",
")",
"\n",
"case",
"\"",
"\"",
":",
"return",
"v2api",
".",
"Put",
"(",
"ctx",
",",
"r",
")",
"\n",
"case",
"\"",
"\"",
":",
"return",
"v2api",
".",
"Delete",
"(",
"ctx",
",",
"r",
")",
"\n",
"<mask>",
"\"",
"\"",
":",
"return",
"v2api",
".",
"QGet",
"(",
"ctx",
",",
"r",
")",
"\n",
"case",
"\"",
"\"",
":",
"return",
"v2api",
".",
"Get",
"(",
"ctx",
",",
"r",
")",
"\n",
"case",
"\"",
"\"",
":",
"return",
"v2api",
".",
"Head",
"(",
"ctx",
",",
"r",
")",
"\n",
"}",
"\n",
"return",
"Response",
"{",
"}",
",",
"ErrUnknownMethod",
"\n",
"}"
] |
23,643 | all-23644 | [
"EnsureSchema",
"applies",
"all",
"relevant",
"schema",
"updates",
"to",
"the",
"cluster",
"database",
".",
"Before",
"actually",
"doing",
"anything",
"this",
"function",
"will",
"make",
"sure",
"that",
"all",
"nodes",
"in",
"the",
"cluster",
"have",
"a",
"schema",
"version",
"and",
"a",
"number",
"of",
"API",
"extensions",
"that",
"match",
"our",
"one",
".",
"If",
"it",
"s",
"not",
"the",
"case",
"we",
"either",
"return",
"an",
"error",
"(",
"if",
"some",
"nodes",
"have",
"version",
"greater",
"than",
"us",
"and",
"we",
"need",
"to",
"be",
"upgraded",
")",
"or",
"return",
"false",
"and",
"no",
"error",
"(",
"if",
"some",
"nodes",
"have",
"a",
"lower",
"version",
"and",
"we",
"need",
"to",
"wait",
"till",
"they",
"get",
"upgraded",
"and",
"restarted",
")",
"."
] | [
"func",
"EnsureSchema",
"(",
"db",
"*",
"sql",
".",
"DB",
",",
"address",
"string",
",",
"dir",
"string",
")",
"(",
"bool",
",",
"error",
")",
"{",
"someNodesAreBehind",
":=",
"false",
"\n",
"apiExtensions",
":=",
"version",
".",
"APIExtensionsCount",
"(",
")",
"\n\n",
"backupDone",
":=",
"false",
"\n",
"hook",
":=",
"(",
"func",
"(",
"version",
"int",
",",
"tx",
"*",
"sql",
".",
"Tx",
")",
"error",
"{",
"// Check if this is a fresh instance.",
"isUpdate",
",",
"err",
":=",
"schema",
".",
"DoesSchemaTableExist",
"(",
"tx",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"errors",
".",
"Wrap",
"(",
"err",
",",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"if",
"!",
"isUpdate",
"{",
"return",
"nil",
"\n",
"}",
"\n\n",
"// Check if we're clustered",
"clustered",
":=",
"true",
"\n",
"n",
",",
"err",
":=",
"selectUnclusteredNodesCount",
"(",
"tx",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"errors",
".",
"Wrap",
"(",
"err",
",",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"if",
"n",
">",
"1",
"{",
"// This should never happen, since we only add nodes",
"// with valid addresses, but check it for sanity.",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
")",
"\n",
"}",
"else",
"if",
"n",
"==",
"1",
"{",
"clustered",
"=",
"<mask>",
"\n",
"}",
"\n\n",
"// If we're not clustered, backup the local cluster database directory",
"// before performing any schema change. This makes sense only in the",
"// non-clustered case, because otherwise the directory would be",
"// re-populated by replication.",
"if",
"!",
"clustered",
"&&",
"!",
"backupDone",
"{",
"logger",
".",
"Infof",
"(",
"\"",
"\\\"",
"\\\"",
"\"",
")",
"\n",
"err",
":=",
"shared",
".",
"DirCopy",
"(",
"filepath",
".",
"Join",
"(",
"dir",
",",
"\"",
"\"",
")",
",",
"filepath",
".",
"Join",
"(",
"dir",
",",
"\"",
"\"",
")",
",",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"errors",
".",
"Wrap",
"(",
"err",
",",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"backupDone",
"=",
"true",
"\n",
"}",
"\n\n",
"if",
"version",
"==",
"-",
"1",
"{",
"logger",
".",
"Debugf",
"(",
"\"",
"\"",
")",
"\n",
"}",
"else",
"{",
"logger",
".",
"Debugf",
"(",
"\"",
"\"",
",",
"version",
",",
"version",
"+",
"1",
")",
"\n",
"}",
"\n\n",
"return",
"nil",
"\n",
"}",
")",
"\n\n",
"check",
":=",
"func",
"(",
"current",
"int",
",",
"tx",
"*",
"sql",
".",
"Tx",
")",
"error",
"{",
"// If we're bootstrapping a fresh schema, skip any check, since",
"// it's safe to assume we are the only node.",
"if",
"current",
"==",
"0",
"{",
"return",
"nil",
"\n",
"}",
"\n\n",
"// Check if we're clustered",
"n",
",",
"err",
":=",
"selectUnclusteredNodesCount",
"(",
"tx",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"errors",
".",
"Wrap",
"(",
"err",
",",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"if",
"n",
">",
"1",
"{",
"// This should never happen, since we only add nodes",
"// with valid addresses, but check it for sanity.",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
")",
"\n",
"}",
"else",
"if",
"n",
"==",
"1",
"{",
"address",
"=",
"\"",
"\"",
"// We're not clustered",
"\n",
"}",
"\n\n",
"// Update the schema and api_extension columns of ourselves.",
"err",
"=",
"updateNodeVersion",
"(",
"tx",
",",
"address",
",",
"apiExtensions",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"errors",
".",
"Wrap",
"(",
"err",
",",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"err",
"=",
"checkClusterIsUpgradable",
"(",
"tx",
",",
"[",
"2",
"]",
"int",
"{",
"len",
"(",
"updates",
")",
",",
"apiExtensions",
"}",
")",
"\n",
"if",
"err",
"==",
"errSomeNodesAreBehind",
"{",
"someNodesAreBehind",
"=",
"true",
"\n",
"return",
"schema",
".",
"ErrGracefulAbort",
"\n",
"}",
"\n",
"return",
"err",
"\n",
"}",
"\n\n",
"schema",
":=",
"Schema",
"(",
")",
"\n",
"schema",
".",
"File",
"(",
"filepath",
".",
"Join",
"(",
"dir",
",",
"\"",
"\"",
")",
")",
"// Optional custom queries",
"\n",
"schema",
".",
"Check",
"(",
"check",
")",
"\n",
"schema",
".",
"Hook",
"(",
"hook",
")",
"\n\n",
"var",
"initial",
"int",
"\n",
"err",
":=",
"query",
".",
"Retry",
"(",
"func",
"(",
")",
"error",
"{",
"var",
"err",
"error",
"\n",
"initial",
",",
"err",
"=",
"schema",
".",
"Ensure",
"(",
"db",
")",
"\n",
"return",
"err",
"\n",
"}",
")",
"\n",
"if",
"someNodesAreBehind",
"{",
"return",
"false",
",",
"nil",
"\n",
"}",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"false",
",",
"err",
"\n",
"}",
"\n\n",
"// When creating a database from scratch, insert an entry for node",
"// 1. This is needed for referential integrity with other tables. Also,",
"// create a default profile.",
"if",
"initial",
"==",
"0",
"{",
"tx",
",",
"err",
":=",
"db",
".",
"Begin",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"false",
",",
"err",
"\n",
"}",
"\n",
"stmt",
":=",
"`\nINSERT INTO nodes(id, name, address, schema, api_extensions) VALUES(1, 'none', '0.0.0.0', ?, ?)\n`",
"\n",
"_",
",",
"err",
"=",
"tx",
".",
"Exec",
"(",
"stmt",
",",
"SchemaVersion",
",",
"apiExtensions",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"tx",
".",
"Rollback",
"(",
")",
"\n",
"return",
"false",
",",
"err",
"\n",
"}",
"\n\n",
"// Default project",
"stmt",
"=",
"`\nINSERT INTO projects (name, description) VALUES ('default', 'Default LXD project');\nINSERT INTO projects_config (project_id, key, value) VALUES (1, 'features.images', 'true');\nINSERT INTO projects_config (project_id, key, value) VALUES (1, 'features.profiles', 'true');\n`",
"\n",
"_",
",",
"err",
"=",
"tx",
".",
"Exec",
"(",
"stmt",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"tx",
".",
"Rollback",
"(",
")",
"\n",
"return",
"false",
",",
"err",
"\n",
"}",
"\n\n",
"// Default profile",
"stmt",
"=",
"`\nINSERT INTO profiles (name, description, project_id) VALUES ('default', 'Default LXD profile', 1)\n`",
"\n",
"_",
",",
"err",
"=",
"tx",
".",
"Exec",
"(",
"stmt",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"tx",
".",
"Rollback",
"(",
")",
"\n",
"return",
"false",
",",
"err",
"\n",
"}",
"\n\n",
"err",
"=",
"tx",
".",
"Commit",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"false",
",",
"err",
"\n",
"}",
"\n",
"}",
"\n\n",
"return",
"true",
",",
"err",
"\n",
"}"
] |
23,644 | all-23645 | [
"Contains",
"returns",
"true",
"if",
"NetworkNumber",
"is",
"in",
"range",
"of",
"Network",
"false",
"otherwise",
"."
] | [
"func",
"(",
"n",
"Network",
")",
"Contains",
"(",
"nn",
"NetworkNumber",
")",
"bool",
"{",
"if",
"len",
"(",
"n",
".",
"Mask",
")",
"!=",
"len",
"(",
"nn",
")",
"{",
"return",
"false",
"\n",
"}",
"\n",
"if",
"nn",
"[",
"0",
"]",
"&",
"n",
".",
"Mask",
"[",
"0",
"]",
"!=",
"n",
".",
"Number",
"[",
"0",
"]",
"{",
"return",
"false",
"\n",
"}",
"\n",
"if",
"len",
"(",
"nn",
")",
"==",
"IPv6Uint32Count",
"{",
"return",
"nn",
"[",
"1",
"]",
"&",
"n",
".",
"Mask",
"[",
"1",
"]",
"==",
"n",
".",
"Number",
"[",
"1",
"]",
"&&",
"nn",
"[",
"2",
"]",
"&",
"n",
".",
"Mask",
"[",
"2",
"]",
"==",
"n",
".",
"Number",
"[",
"2",
"]",
"&&",
"nn",
"[",
"3",
"]",
"&",
"n",
".",
"Mask",
"[",
"3",
"]",
"==",
"n",
".",
"Number",
"[",
"3",
"]",
"\n",
"}",
"\n",
"return",
"<mask>",
"\n",
"}"
] |
23,645 | all-23646 | [
"ServiceOAuth",
"instantiates",
"ServiceOAuthAuthentication",
"with",
"the",
"coinbase",
"certificate",
"file"
] | [
"func",
"serviceOAuth",
"(",
"certFilePath",
"string",
")",
"(",
"*",
"serviceOAuthAuthentication",
",",
"error",
")",
"{",
"// First we read the cert",
"certs",
":=",
"x509",
".",
"NewCertPool",
"(",
")",
"\n",
"pemData",
",",
"err",
":=",
"ioutil",
".",
"ReadFile",
"(",
"certFilePath",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"certs",
".",
"AppendCertsFromPEM",
"(",
"pemData",
")",
"\n",
"mTLSConfig",
":=",
"&",
"tls",
".",
"Config",
"{",
"RootCAs",
":",
"certs",
",",
"//Add the cert as a TLS config",
"}",
"\n",
"a",
":=",
"serviceOAuthAuthentication",
"{",
"BaseUrl",
":",
"\"",
"\"",
",",
"Client",
":",
"http",
".",
"Client",
"{",
"Transport",
":",
"&",
"<mask>",
".",
"Transport",
"{",
"Dial",
":",
"dialTimeout",
",",
"TLSClientConfig",
":",
"mTLSConfig",
",",
"}",
",",
"}",
",",
"}",
"\n",
"return",
"&",
"a",
",",
"nil",
"\n",
"}"
] |
23,646 | all-23647 | [
"GetMuxValueFromRequest",
"extracts",
"the",
"mux",
"value",
"from",
"the",
"request",
"using",
"a",
"gorilla",
"mux",
"name"
] | [
"func",
"GetMuxValueFromRequest",
"(",
"r",
"*",
"http",
".",
"Request",
",",
"gorillaMuxName",
"string",
")",
"(",
"string",
",",
"bool",
")",
"{",
"vars",
":=",
"mux",
".",
"Vars",
"(",
"r",
")",
"\n",
"val",
",",
"<mask>",
":=",
"vars",
"[",
"gorillaMuxName",
"]",
"\n",
"return",
"val",
",",
"ok",
"\n",
"}"
] |
23,647 | all-23648 | [
"expandClusterAffinityRuleSpec",
"reads",
"certain",
"ResourceData",
"keys",
"and",
"returns",
"a",
"ClusterAffinityRuleSpec",
"."
] | [
"func",
"expandClusterAffinityRuleSpec",
"(",
"d",
"*",
"schema",
".",
"ResourceData",
",",
"meta",
"interface",
"{",
"}",
")",
"(",
"*",
"types",
".",
"ClusterAffinityRuleSpec",
",",
"error",
")",
"{",
"<mask>",
",",
"err",
":=",
"resourceVSphereComputeClusterVMGroupClient",
"(",
"meta",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"results",
",",
"err",
":=",
"virtualmachine",
".",
"MOIDsForUUIDs",
"(",
"client",
",",
"structure",
".",
"SliceInterfacesToStrings",
"(",
"d",
".",
"Get",
"(",
"\"",
"\"",
")",
".",
"(",
"*",
"schema",
".",
"Set",
")",
".",
"List",
"(",
")",
")",
",",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"obj",
":=",
"&",
"types",
".",
"ClusterAffinityRuleSpec",
"{",
"ClusterRuleInfo",
":",
"types",
".",
"ClusterRuleInfo",
"{",
"Enabled",
":",
"structure",
".",
"GetBool",
"(",
"d",
",",
"\"",
"\"",
")",
",",
"Mandatory",
":",
"structure",
".",
"GetBool",
"(",
"d",
",",
"\"",
"\"",
")",
",",
"Name",
":",
"d",
".",
"Get",
"(",
"\"",
"\"",
")",
".",
"(",
"string",
")",
",",
"UserCreated",
":",
"structure",
".",
"BoolPtr",
"(",
"true",
")",
",",
"}",
",",
"Vm",
":",
"results",
".",
"ManagedObjectReferences",
"(",
")",
",",
"}",
"\n",
"return",
"obj",
",",
"nil",
"\n",
"}"
] |
23,648 | all-23649 | [
"Define",
"VirtualDisk",
"args"
] | [
"func",
"resourceVSphereVirtualDisk",
"(",
")",
"*",
"schema",
".",
"Resource",
"{",
"return",
"&",
"schema",
".",
"Resource",
"{",
"Create",
":",
"resourceVSphereVirtualDiskCreate",
",",
"Read",
":",
"resourceVSphereVirtualDiskRead",
",",
"Delete",
":",
"resourceVSphereVirtualDiskDelete",
",",
"Schema",
":",
"map",
"[",
"string",
"]",
"*",
"schema",
".",
"Schema",
"{",
"// Size in GB",
"\"",
"\"",
":",
"{",
"Type",
":",
"schema",
".",
"TypeInt",
",",
"Required",
":",
"true",
",",
"ForceNew",
":",
"true",
",",
"//TODO Can this be optional (resize)?",
"}",
",",
"// TODO:",
"//",
"// * Add extra lifecycles (move, rename, etc). May not be possible",
"// without breaking other resources though.",
"// * Add validation (make sure it ends in .vmdk)",
"\"",
"\"",
":",
"{",
"Type",
":",
"schema",
".",
"TypeString",
",",
"Required",
":",
"true",
",",
"ForceNew",
":",
"true",
",",
"}",
",",
"\"",
"\"",
":",
"{",
"Type",
":",
"schema",
".",
"TypeString",
",",
"Required",
":",
"true",
",",
"ForceNew",
":",
"true",
",",
"}",
",",
"\"",
"\"",
":",
"{",
"Type",
":",
"schema",
".",
"TypeString",
",",
"Optional",
":",
"true",
",",
"ForceNew",
":",
"true",
",",
"Default",
":",
"\"",
"\"",
",",
"ValidateFunc",
":",
"func",
"(",
"v",
"interface",
"{",
"}",
",",
"k",
"string",
")",
"(",
"ws",
"[",
"]",
"string",
",",
"<mask>",
"[",
"]",
"error",
")",
"{",
"value",
":=",
"v",
".",
"(",
"string",
")",
"\n",
"if",
"value",
"!=",
"\"",
"\"",
"&&",
"value",
"!=",
"\"",
"\"",
"&&",
"value",
"!=",
"\"",
"\"",
"{",
"errors",
"=",
"append",
"(",
"errors",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
")",
")",
"\n",
"}",
"\n",
"return",
"\n",
"}",
",",
"}",
",",
"\"",
"\"",
":",
"{",
"Type",
":",
"schema",
".",
"TypeString",
",",
"Optional",
":",
"true",
",",
"ForceNew",
":",
"true",
",",
"Default",
":",
"\"",
"\"",
",",
"// TODO: Move this to removed after we remove the support to specify this in later versions",
"Deprecated",
":",
"\"",
"\"",
",",
"ValidateFunc",
":",
"func",
"(",
"v",
"interface",
"{",
"}",
",",
"k",
"string",
")",
"(",
"ws",
"[",
"]",
"string",
",",
"errors",
"[",
"]",
"error",
")",
"{",
"value",
":=",
"v",
".",
"(",
"string",
")",
"\n",
"if",
"value",
"!=",
"\"",
"\"",
"&&",
"value",
"!=",
"\"",
"\"",
"&&",
"value",
"!=",
"\"",
"\"",
"{",
"errors",
"=",
"append",
"(",
"errors",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
")",
")",
"\n",
"}",
"\n",
"return",
"\n",
"}",
",",
"}",
",",
"\"",
"\"",
":",
"{",
"Type",
":",
"schema",
".",
"TypeString",
",",
"Optional",
":",
"true",
",",
"ForceNew",
":",
"true",
",",
"}",
",",
"\"",
"\"",
":",
"{",
"Type",
":",
"schema",
".",
"TypeBool",
",",
"Optional",
":",
"true",
",",
"ForceNew",
":",
"true",
",",
"}",
",",
"}",
",",
"}",
"\n",
"}"
] |
23,649 | all-23650 | [
"LoadWithEnv",
"loads",
"YAML",
"files",
"with",
"Env",
"replace",
"{{",
"env",
"ENV",
"}}",
"to",
"os",
".",
"Getenv",
"(",
"ENV",
")",
"if",
"you",
"set",
"default",
"value",
"then",
"{{",
"env",
"ENV",
"default",
"}}"
] | [
"func",
"LoadWithEnv",
"(",
"conf",
"<mask>",
"{",
"}",
",",
"configPaths",
"...",
"string",
")",
"error",
"{",
"return",
"loadWithFunc",
"(",
"conf",
",",
"configPaths",
",",
"envReplacer",
",",
"yaml",
".",
"Unmarshal",
")",
"\n",
"}"
] |
23,650 | all-23651 | [
"export",
"goMouseCallback"
] | [
"func",
"goMouseCallback",
"(",
"name",
"*",
"C",
".",
"char",
",",
"event",
",",
"x",
",",
"y",
",",
"flags",
"C",
".",
"int",
")",
"{",
"runtime",
".",
"LockOSThread",
"(",
")",
"\n",
"defer",
"runtime",
".",
"UnlockOSThread",
"(",
")",
"\n\n",
"winName",
":=",
"C",
".",
"GoString",
"(",
"name",
")",
"\n",
"win",
",",
"ok",
":=",
"allWindows",
"[",
"winName",
"]",
"\n\n",
"if",
"!",
"ok",
"{",
"return",
"\n",
"}",
"\n",
"if",
"win",
".",
"mouseHandle",
"==",
"nil",
"{",
"return",
"\n",
"}",
"\n\n",
"if",
"fa",
",",
"ok",
":=",
"win",
".",
"mouseHandle",
".",
"(",
"func",
"(",
"event",
",",
"x",
",",
"y",
",",
"flags",
"int",
")",
")",
";",
"ok",
"{",
"fa",
"(",
"int",
"(",
"event",
")",
",",
"int",
"(",
"x",
")",
",",
"int",
"(",
"y",
")",
",",
"int",
"(",
"flags",
")",
")",
"\n",
"return",
"\n",
"}",
"\n\n",
"if",
"fb",
",",
"ok",
":=",
"win",
".",
"mouseHandle",
".",
"(",
"func",
"(",
"event",
",",
"x",
",",
"y",
",",
"flags",
"int",
",",
"param",
"...",
"interface",
"{",
"}",
")",
")",
";",
"ok",
"{",
"if",
"win",
".",
"param",
"!=",
"nil",
"{",
"fb",
"(",
"int",
"(",
"event",
")",
",",
"int",
"(",
"x",
")",
",",
"int",
"(",
"y",
")",
",",
"int",
"(",
"flags",
")",
",",
"win",
".",
"param",
"...",
")",
"\n",
"}",
"else",
"{",
"fb",
"(",
"int",
"(",
"<mask>",
")",
",",
"int",
"(",
"x",
")",
",",
"int",
"(",
"y",
")",
",",
"int",
"(",
"flags",
")",
")",
"\n",
"}",
"\n",
"return",
"\n",
"}",
"\n",
"}"
] |
23,651 | all-23652 | [
"WithExecutionContextID",
"specifies",
"in",
"which",
"execution",
"context",
"to",
"perform",
"script",
"run",
".",
"If",
"the",
"parameter",
"is",
"omitted",
"the",
"evaluation",
"will",
"be",
"performed",
"in",
"the",
"context",
"of",
"the",
"inspected",
"page",
"."
] | [
"func",
"(",
"p",
"RunScriptParams",
")",
"WithExecutionContextID",
"(",
"executionContextID",
"ExecutionContextID",
")",
"*",
"RunScriptParams",
"{",
"p",
".",
"ExecutionContextID",
"=",
"executionContextID",
"\n",
"<mask>",
"&",
"p",
"\n",
"}"
] |
23,652 | all-23653 | [
"AddSimple",
"is",
"convenience",
"method",
"to",
"add",
"a",
"job",
"."
] | [
"func",
"AddSimple",
"(",
"q",
"Queue",
",",
"tx",
"*",
"reform",
".",
"TX",
",",
"jobType",
",",
"relatedType",
",",
"relatedID",
",",
"creator",
"string",
")",
"error",
"{",
"return",
"AddWithData",
"(",
"q",
",",
"<mask>",
",",
"jobType",
",",
"relatedType",
",",
"relatedID",
",",
"creator",
",",
"&",
"struct",
"{",
"}",
"{",
"}",
")",
"\n",
"}"
] |
23,653 | all-23654 | [
"Execute",
"-",
"adds",
"a",
"named",
"org",
"to",
"the",
"configuration"
] | [
"func",
"(",
"c",
"*",
"AddOrgToConfigurationCommand",
")",
"Execute",
"(",
"[",
"]",
"string",
")",
"error",
"{",
"orgConfig",
":=",
"&",
"config",
".",
"OrgConfig",
"{",
"Org",
":",
"c",
".",
"OrgName",
",",
"}",
"\n\n",
"c",
".",
"initConfig",
"(",
")",
"\n\n",
"if",
"c",
".",
"Quota",
".",
"EnableOrgQuota",
"==",
"\"",
"\"",
"&&",
"c",
".",
"NamedQuota",
"!=",
"\"",
"\"",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"errorString",
":=",
"\"",
"\"",
"\n\n",
"if",
"c",
".",
"DefaultIsolationSegment",
"!=",
"\"",
"\"",
"{",
"orgConfig",
".",
"DefaultIsoSegment",
"=",
"c",
".",
"DefaultIsolationSegment",
"\n",
"}",
"\n",
"orgConfig",
".",
"RemoveUsers",
"=",
"true",
"\n",
"orgConfig",
".",
"RemovePrivateDomains",
"=",
"true",
"\n",
"orgConfig",
".",
"PrivateDomains",
"=",
"addToSlice",
"(",
"orgConfig",
".",
"PrivateDomains",
",",
"c",
".",
"PrivateDomains",
",",
"&",
"errorString",
")",
"\n\n",
"orgConfig",
".",
"RemoveSharedPrivateDomains",
"=",
"true",
"\n",
"orgConfig",
".",
"SharedPrivateDomains",
"=",
"addToSlice",
"(",
"orgConfig",
".",
"SharedPrivateDomains",
",",
"c",
".",
"SharedPrivateDomains",
",",
"&",
"errorString",
")",
"\n\n",
"updateOrgQuotaConfig",
"(",
"orgConfig",
",",
"c",
".",
"Quota",
",",
"&",
"errorString",
")",
"\n",
"orgConfig",
".",
"NamedQuota",
"=",
"c",
".",
"NamedQuota",
"\n\n",
"c",
".",
"updateUsers",
"(",
"orgConfig",
",",
"&",
"errorString",
")",
"\n\n",
"orgConfig",
".",
"ServiceAccess",
"=",
"make",
"(",
"map",
"[",
"string",
"]",
"[",
"]",
"string",
")",
"\n",
"for",
"_",
",",
"service",
":=",
"range",
"c",
".",
"ServiceAccess",
".",
"ServiceNames",
"{",
"orgConfig",
".",
"ServiceAccess",
"[",
"<mask>",
"]",
"=",
"[",
"]",
"string",
"{",
"\"",
"\"",
"}",
"\n",
"}",
"\n\n",
"orgSpaces",
":=",
"&",
"config",
".",
"Spaces",
"{",
"Org",
":",
"orgConfig",
".",
"Org",
",",
"EnableDeleteSpaces",
":",
"true",
"}",
"\n",
"convertToBool",
"(",
"\"",
"\"",
",",
"&",
"orgSpaces",
".",
"EnableDeleteSpaces",
",",
"c",
".",
"EnableRemoveSpaces",
",",
"&",
"errorString",
")",
"\n",
"if",
"errorString",
"!=",
"\"",
"\"",
"{",
"return",
"errors",
".",
"New",
"(",
"errorString",
")",
"\n",
"}",
"\n\n",
"if",
"err",
":=",
"config",
".",
"NewManager",
"(",
"c",
".",
"ConfigDirectory",
")",
".",
"AddOrgToConfig",
"(",
"orgConfig",
",",
"orgSpaces",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"fmt",
".",
"Println",
"(",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"c",
".",
"OrgName",
")",
")",
"\n",
"return",
"nil",
"\n",
"}"
] |
23,654 | all-23655 | [
"define",
"an",
"array",
"of",
"texture",
"coordinates"
] | [
"func",
"TexCoordPointer",
"(",
"size",
"int32",
",",
"xtype",
"uint32",
",",
"stride",
"int32",
",",
"pointer",
"unsafe",
".",
"Pointer",
")",
"{",
"syscall",
".",
"Syscall6",
"(",
"gpTexCoordPointer",
",",
"4",
",",
"uintptr",
"(",
"<mask>",
")",
",",
"uintptr",
"(",
"xtype",
")",
",",
"uintptr",
"(",
"stride",
")",
",",
"uintptr",
"(",
"pointer",
")",
",",
"0",
",",
"0",
")",
"\n",
"}"
] |
23,655 | all-23656 | [
"RemoveDOMBreakpoint",
"removes",
"DOM",
"breakpoint",
"that",
"was",
"set",
"using",
"setDOMBreakpoint",
".",
"See",
":",
"https",
":",
"//",
"chromedevtools",
".",
"github",
".",
"io",
"/",
"devtools",
"-",
"protocol",
"/",
"tot",
"/",
"DOMDebugger#method",
"-",
"removeDOMBreakpoint",
"parameters",
":",
"nodeID",
"-",
"Identifier",
"of",
"the",
"node",
"to",
"remove",
"breakpoint",
"from",
".",
"type",
"-",
"Type",
"of",
"the",
"breakpoint",
"to",
"remove",
"."
] | [
"func",
"RemoveDOMBreakpoint",
"(",
"nodeID",
"cdp",
".",
"NodeID",
",",
"typeVal",
"DOMBreakpointType",
")",
"*",
"RemoveDOMBreakpointParams",
"{",
"return",
"&",
"RemoveDOMBreakpointParams",
"{",
"NodeID",
":",
"nodeID",
",",
"<mask>",
":",
"typeVal",
",",
"}",
"\n",
"}"
] |
23,656 | all-23657 | [
"Do",
"executes",
"Page",
".",
"reload",
"against",
"the",
"provided",
"context",
"."
] | [
"func",
"(",
"p",
"*",
"ReloadParams",
")",
"Do",
"(",
"ctx",
"<mask>",
".",
"Context",
")",
"(",
"err",
"error",
")",
"{",
"return",
"cdp",
".",
"Execute",
"(",
"ctx",
",",
"CommandReload",
",",
"p",
",",
"nil",
")",
"\n",
"}"
] |
23,657 | all-23658 | [
"Bubble",
"draws",
"a",
"text",
"balloon",
"."
] | [
"func",
"Bubble",
"(",
"gc",
"draw2d",
".",
"GraphicContext",
",",
"x",
",",
"y",
",",
"<mask>",
",",
"height",
"float64",
")",
"{",
"sx",
",",
"sy",
":=",
"width",
"/",
"100",
",",
"height",
"/",
"100",
"\n",
"gc",
".",
"MoveTo",
"(",
"x",
"+",
"sx",
"*",
"50",
",",
"y",
")",
"\n",
"gc",
".",
"QuadCurveTo",
"(",
"x",
",",
"y",
",",
"x",
",",
"y",
"+",
"sy",
"*",
"37.5",
")",
"\n",
"gc",
".",
"QuadCurveTo",
"(",
"x",
",",
"y",
"+",
"sy",
"*",
"75",
",",
"x",
"+",
"sx",
"*",
"25",
",",
"y",
"+",
"sy",
"*",
"75",
")",
"\n",
"gc",
".",
"QuadCurveTo",
"(",
"x",
"+",
"sx",
"*",
"25",
",",
"y",
"+",
"sy",
"*",
"95",
",",
"x",
"+",
"sx",
"*",
"5",
",",
"y",
"+",
"sy",
"*",
"100",
")",
"\n",
"gc",
".",
"QuadCurveTo",
"(",
"x",
"+",
"sx",
"*",
"35",
",",
"y",
"+",
"sy",
"*",
"95",
",",
"x",
"+",
"sx",
"*",
"40",
",",
"y",
"+",
"sy",
"*",
"75",
")",
"\n",
"gc",
".",
"QuadCurveTo",
"(",
"x",
"+",
"sx",
"*",
"100",
",",
"y",
"+",
"sy",
"*",
"75",
",",
"x",
"+",
"sx",
"*",
"100",
",",
"y",
"+",
"sy",
"*",
"37.5",
")",
"\n",
"gc",
".",
"QuadCurveTo",
"(",
"x",
"+",
"sx",
"*",
"100",
",",
"y",
",",
"x",
"+",
"sx",
"*",
"50",
",",
"y",
")",
"\n",
"gc",
".",
"Stroke",
"(",
")",
"\n",
"}"
] |
23,658 | all-23659 | [
"Fill",
"fills",
"all",
"of",
"the",
"fields",
"the",
"selection",
"refers",
"to",
"with",
"the",
"provided",
"text",
"."
] | [
"func",
"(",
"s",
"*",
"Selection",
")",
"Fill",
"(",
"text",
"string",
")",
"error",
"{",
"return",
"s",
".",
"forEachElement",
"(",
"func",
"(",
"selectedElement",
"element",
".",
"Element",
")",
"error",
"{",
"if",
"err",
":=",
"selectedElement",
".",
"Clear",
"(",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"s",
",",
"err",
")",
"\n",
"}",
"\n",
"if",
"err",
":=",
"selectedElement",
".",
"<mask>",
"(",
"text",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"s",
",",
"err",
")",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}",
")",
"\n",
"}"
] |
23,659 | all-23660 | [
"DeleteResourcePolicyWithContext",
"mocks",
"base",
"method"
] | [
"func",
"(",
"m",
"*",
"MockSecretsManagerAPI",
")",
"DeleteResourcePolicyWithContext",
"(",
"arg0",
"aws",
".",
"<mask>",
",",
"arg1",
"*",
"secretsmanager",
".",
"DeleteResourcePolicyInput",
",",
"arg2",
"...",
"request",
".",
"Option",
")",
"(",
"*",
"secretsmanager",
".",
"DeleteResourcePolicyOutput",
",",
"error",
")",
"{",
"varargs",
":=",
"[",
"]",
"interface",
"{",
"}",
"{",
"arg0",
",",
"arg1",
"}",
"\n",
"for",
"_",
",",
"a",
":=",
"range",
"arg2",
"{",
"varargs",
"=",
"append",
"(",
"varargs",
",",
"a",
")",
"\n",
"}",
"\n",
"ret",
":=",
"m",
".",
"ctrl",
".",
"Call",
"(",
"m",
",",
"\"",
"\"",
",",
"varargs",
"...",
")",
"\n",
"ret0",
",",
"_",
":=",
"ret",
"[",
"0",
"]",
".",
"(",
"*",
"secretsmanager",
".",
"DeleteResourcePolicyOutput",
")",
"\n",
"ret1",
",",
"_",
":=",
"ret",
"[",
"1",
"]",
".",
"(",
"error",
")",
"\n",
"return",
"ret0",
",",
"ret1",
"\n",
"}"
] |
23,660 | all-23661 | [
"WriteSingleByte",
"writes",
"a",
"single",
"byte",
"to",
"the",
"buffer"
] | [
"func",
"(",
"w",
"*",
"WriteBuffer",
")",
"WriteSingleByte",
"(",
"n",
"<mask>",
")",
"{",
"if",
"w",
".",
"err",
"!=",
"nil",
"{",
"return",
"\n",
"}",
"\n\n",
"if",
"len",
"(",
"w",
".",
"remaining",
")",
"==",
"0",
"{",
"w",
".",
"setErr",
"(",
"ErrBufferFull",
")",
"\n",
"return",
"\n",
"}",
"\n\n",
"w",
".",
"remaining",
"[",
"0",
"]",
"=",
"n",
"\n",
"w",
".",
"remaining",
"=",
"w",
".",
"remaining",
"[",
"1",
":",
"]",
"\n",
"}"
] |
23,661 | all-23662 | [
"runWorker",
"executes",
"the",
"loop",
"to",
"process",
"new",
"items",
"added",
"to",
"the",
"queue",
"."
] | [
"func",
"(",
"c",
"*",
"<mask>",
")",
"runWorker",
"(",
")",
"{",
"c",
".",
"wg",
".",
"Add",
"(",
"1",
")",
"\n",
"for",
"c",
".",
"processNextItem",
"(",
")",
"{",
"}",
"\n",
"c",
".",
"wg",
".",
"Done",
"(",
")",
"\n",
"}"
] |
23,662 | all-23663 | [
"Quote",
"returns",
"a",
"quoted",
"s",
"for",
"a",
"column",
"name",
"."
] | [
"func",
"(",
"d",
"*",
"MySQLDialect",
")",
"Quote",
"(",
"s",
"string",
")",
"<mask>",
"{",
"return",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"strings",
".",
"Replace",
"(",
"s",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"-",
"1",
")",
")",
"\n",
"}"
] |
23,663 | all-23664 | [
"Contents",
"returns",
"a",
"slice",
"that",
"contains",
"all",
"items",
"that",
"are",
"the",
"output",
"of",
"filters",
"."
] | [
"func",
"Contents",
"(",
"filters",
"...",
"Filter",
")",
"(",
"[",
"]",
"string",
",",
"error",
")",
"{",
"var",
"result",
"[",
"]",
"string",
"\n",
"err",
":=",
"ForEach",
"(",
"Sequence",
"(",
"filters",
"...",
")",
",",
"func",
"(",
"s",
"string",
")",
"{",
"<mask>",
"=",
"append",
"(",
"result",
",",
"s",
")",
"\n",
"}",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"result",
"=",
"nil",
"// Discard results on error",
"\n",
"}",
"\n",
"return",
"result",
",",
"err",
"\n",
"}"
] |
23,664 | all-23665 | [
"GetStore",
"provides",
"a",
"mock",
"function",
"with",
"given",
"fields",
":"
] | [
"func",
"(",
"_m",
"*",
"ObjectStore",
")",
"GetStore",
"(",
")",
"interface",
"{",
"}",
"{",
"ret",
":=",
"_m",
".",
"Called",
"(",
")",
"\n\n",
"var",
"r0",
"interface",
"{",
"}",
"\n",
"if",
"rf",
",",
"ok",
":=",
"<mask>",
".",
"Get",
"(",
"0",
")",
".",
"(",
"func",
"(",
")",
"interface",
"{",
"}",
")",
";",
"ok",
"{",
"r0",
"=",
"rf",
"(",
")",
"\n",
"}",
"else",
"{",
"if",
"ret",
".",
"Get",
"(",
"0",
")",
"!=",
"nil",
"{",
"r0",
"=",
"ret",
".",
"Get",
"(",
"0",
")",
".",
"(",
"interface",
"{",
"}",
")",
"\n",
"}",
"\n",
"}",
"\n\n",
"return",
"r0",
"\n",
"}"
] |
23,665 | all-23666 | [
"WithObjectID",
"JavaScript",
"object",
"id",
"of",
"the",
"node",
"to",
"be",
"highlighted",
"."
] | [
"func",
"(",
"p",
"HighlightNodeParams",
")",
"WithObjectID",
"(",
"objectID",
"runtime",
".",
"RemoteObjectID",
")",
"*",
"HighlightNodeParams",
"{",
"p",
".",
"ObjectID",
"=",
"objectID",
"\n",
"<mask>",
"&",
"p",
"\n",
"}"
] |
23,666 | all-23667 | [
"PointsWithin",
"returns",
"all",
"points",
"with",
"distance",
"of",
"point",
"that",
"match",
"the",
"accept",
"criteria",
"."
] | [
"func",
"(",
"points",
"*",
"PointsIndex",
")",
"PointsWithin",
"(",
"point",
"Point",
",",
"distance",
"Meters",
",",
"accept",
"func",
"(",
"p",
"Point",
")",
"bool",
")",
"[",
"]",
"Point",
"{",
"d",
":=",
"int",
"(",
"distance",
"/",
"<mask>",
".",
"index",
".",
"resolution",
")",
"\n\n",
"if",
"d",
"==",
"0",
"{",
"d",
"=",
"1",
"\n",
"}",
"\n\n",
"idx",
":=",
"cellOf",
"(",
"point",
",",
"points",
".",
"index",
".",
"resolution",
")",
"\n\n",
"nearbyPoints",
":=",
"make",
"(",
"[",
"]",
"Point",
",",
"0",
")",
"\n",
"nearbyPoints",
"=",
"getPointsAppend",
"(",
"nearbyPoints",
",",
"points",
".",
"index",
".",
"get",
"(",
"idx",
".",
"x",
"-",
"d",
",",
"idx",
".",
"x",
"+",
"d",
",",
"idx",
".",
"y",
"-",
"d",
",",
"idx",
".",
"y",
"+",
"d",
")",
",",
"accept",
")",
"\n\n",
"// filter points which longer than maxDistance away from point.",
"withinPoints",
":=",
"make",
"(",
"[",
"]",
"Point",
",",
"0",
")",
"\n",
"for",
"_",
",",
"nearbyPoint",
":=",
"range",
"nearbyPoints",
"{",
"if",
"Distance",
"(",
"point",
",",
"nearbyPoint",
")",
"<",
"distance",
"{",
"withinPoints",
"=",
"append",
"(",
"withinPoints",
",",
"nearbyPoint",
")",
"\n",
"}",
"\n",
"}",
"\n\n",
"return",
"withinPoints",
"\n",
"}"
] |
23,667 | all-23668 | [
"Get",
"returns",
"an",
"instrument",
"from",
"the",
"Registry",
"."
] | [
"func",
"(",
"r",
"*",
"Registry",
")",
"Get",
"(",
"name",
"string",
",",
"tags",
"[",
"]",
"string",
")",
"interface",
"{",
"}",
"{",
"key",
":=",
"MetricID",
"(",
"name",
",",
"<mask>",
")",
"\n",
"r",
".",
"mutex",
".",
"RLock",
"(",
")",
"\n",
"v",
":=",
"r",
".",
"instruments",
"[",
"key",
"]",
"\n",
"r",
".",
"mutex",
".",
"RUnlock",
"(",
")",
"\n",
"return",
"v",
"\n",
"}"
] |
23,668 | all-23669 | [
"Do",
"executes",
"Network",
".",
"getCookies",
"against",
"the",
"provided",
"context",
".",
"returns",
":",
"cookies",
"-",
"Array",
"of",
"cookie",
"objects",
"."
] | [
"func",
"(",
"p",
"*",
"GetCookiesParams",
")",
"Do",
"(",
"ctx",
"context",
".",
"Context",
")",
"(",
"cookies",
"[",
"]",
"*",
"Cookie",
",",
"err",
"error",
")",
"{",
"// execute",
"var",
"res",
"GetCookiesReturns",
"\n",
"err",
"=",
"cdp",
".",
"Execute",
"(",
"ctx",
",",
"CommandGetCookies",
",",
"p",
",",
"&",
"res",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"return",
"<mask>",
".",
"Cookies",
",",
"nil",
"\n",
"}"
] |
23,669 | all-23670 | [
"Render",
"writes",
"HTML",
"representing",
"this",
"gcsDir",
"to",
"the",
"provided",
"output",
"."
] | [
"func",
"(",
"dir",
"*",
"gcsDir",
")",
"Render",
"(",
"out",
"http",
".",
"ResponseWriter",
",",
"inPath",
"string",
")",
"{",
"htmlPageHeader",
"(",
"out",
",",
"dir",
".",
"Name",
")",
"\n\n",
"if",
"!",
"strings",
".",
"HasSuffix",
"(",
"inPath",
",",
"\"",
"\"",
")",
"{",
"inPath",
"+=",
"\"",
"\"",
"\n",
"}",
"\n\n",
"htmlContentHeader",
"(",
"out",
",",
"dir",
".",
"Name",
",",
"inPath",
")",
"\n\n",
"if",
"dir",
".",
"NextMarker",
"!=",
"\"",
"\"",
"{",
"htmlNextButton",
"(",
"out",
",",
"gcsPath",
"+",
"inPath",
",",
"dir",
".",
"NextMarker",
")",
"\n",
"}",
"\n\n",
"htmlGridHeader",
"(",
"out",
")",
"\n",
"if",
"parent",
":=",
"dirname",
"(",
"inPath",
")",
";",
"parent",
"!=",
"\"",
"\"",
"{",
"url",
":=",
"gcsPath",
"+",
"parent",
"\n",
"htmlGridItem",
"(",
"out",
",",
"iconBack",
",",
"url",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"for",
"i",
":=",
"range",
"dir",
".",
"CommonPrefixes",
"{",
"dir",
".",
"CommonPrefixes",
"[",
"i",
"]",
".",
"Render",
"(",
"out",
",",
"inPath",
")",
"\n",
"}",
"\n",
"for",
"i",
":=",
"<mask>",
"dir",
".",
"Contents",
"{",
"dir",
".",
"Contents",
"[",
"i",
"]",
".",
"Render",
"(",
"out",
",",
"inPath",
")",
"\n",
"}",
"\n\n",
"if",
"dir",
".",
"NextMarker",
"!=",
"\"",
"\"",
"{",
"htmlNextButton",
"(",
"out",
",",
"gcsPath",
"+",
"inPath",
",",
"dir",
".",
"NextMarker",
")",
"\n",
"}",
"\n\n",
"htmlContentFooter",
"(",
"out",
")",
"\n\n",
"htmlPageFooter",
"(",
"out",
")",
"\n",
"}"
] |
23,670 | all-23671 | [
"Not",
"thread",
"-",
"safe",
"-",
"callers",
"need",
"to",
"hold",
"c",
".",
"mut",
"."
] | [
"func",
"(",
"c",
"*",
"Client",
")",
"getUserData",
"(",
")",
"error",
"{",
"c",
".",
"log",
"(",
"\"",
"\"",
")",
"\n",
"var",
"u",
"User",
"\n",
"_",
",",
"err",
":=",
"c",
".",
"request",
"(",
"&",
"request",
"{",
"method",
":",
"http",
".",
"MethodGet",
",",
"<mask>",
":",
"\"",
"\"",
",",
"exitCodes",
":",
"[",
"]",
"int",
"{",
"200",
"}",
",",
"}",
",",
"&",
"u",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"c",
".",
"botName",
"=",
"u",
".",
"Login",
"\n",
"// email needs to be publicly accessible via the profile",
"// of the current account. Read below for more info",
"// https://developer.github.com/v3/users/#get-a-single-user",
"c",
".",
"email",
"=",
"u",
".",
"Email",
"\n",
"return",
"nil",
"\n",
"}"
] |
23,671 | all-23672 | [
"Token",
"returns",
"a",
"new",
"access",
"token"
] | [
"func",
"(",
"c",
"*",
"OAuth2Controller",
")",
"Token",
"(",
"w",
"http",
".",
"ResponseWriter",
",",
"r",
"*",
"http",
".",
"Request",
")",
"{",
"grantType",
":=",
"r",
".",
"URL",
".",
"Query",
"(",
")",
".",
"Get",
"(",
"\"",
"\"",
")",
"\n",
"code",
":=",
"r",
".",
"URL",
".",
"Query",
"(",
")",
".",
"Get",
"(",
"\"",
"\"",
")",
"\n",
"if",
"strings",
".",
"Compare",
"(",
"grantType",
",",
"\"",
"\"",
")",
"!=",
"0",
"{",
"http",
".",
"Error",
"(",
"w",
",",
"errors",
".",
"New",
"(",
"\"",
"\"",
")",
".",
"Error",
"(",
")",
",",
"http",
".",
"StatusBadRequest",
")",
"\n",
"return",
"\n",
"}",
"\n",
"if",
"strings",
".",
"Compare",
"(",
"code",
",",
"\"",
"\"",
")",
"==",
"0",
"{",
"http",
".",
"Error",
"(",
"w",
",",
"errors",
".",
"New",
"(",
"\"",
"\"",
")",
".",
"Error",
"(",
")",
",",
"http",
".",
"StatusBadRequest",
")",
"\n",
"return",
"\n",
"}",
"\n",
"response",
",",
"err",
":=",
"DecodeOAuth2Code",
"(",
"code",
",",
"c",
".",
"cnf",
".",
"Jwt",
".",
"<mask>",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"http",
".",
"Error",
"(",
"w",
",",
"err",
".",
"Error",
"(",
")",
",",
"http",
".",
"StatusBadRequest",
")",
"\n",
"return",
"\n",
"}",
"\n",
"i",
",",
"err",
":=",
"strconv",
".",
"ParseInt",
"(",
"response",
".",
"Exp",
",",
"10",
",",
"64",
")",
"\n",
"exp",
":=",
"time",
".",
"Unix",
"(",
"i",
",",
"0",
")",
"\n",
"if",
"exp",
".",
"After",
"(",
"time",
".",
"Now",
"(",
")",
")",
"{",
"log",
".",
"Printf",
"(",
"\"",
"\"",
")",
"\n",
"}",
"else",
"{",
"token",
":=",
"jwt",
".",
"New",
"(",
"jwt",
".",
"GetSigningMethod",
"(",
"\"",
"\"",
")",
")",
"\n",
"claims",
":=",
"token",
".",
"Claims",
".",
"(",
"jwt",
".",
"MapClaims",
")",
"\n",
"claims",
"[",
"\"",
"\"",
"]",
"=",
"time",
".",
"Now",
"(",
")",
".",
"Add",
"(",
"time",
".",
"Hour",
"*",
"1",
")",
".",
"Unix",
"(",
")",
"\n",
"tokenString",
",",
"_",
":=",
"token",
".",
"SignedString",
"(",
"[",
"]",
"byte",
"(",
"c",
".",
"cnf",
".",
"Jwt",
".",
"Key",
")",
")",
"\n\n",
"refreshToken",
":=",
"jwt",
".",
"New",
"(",
"jwt",
".",
"GetSigningMethod",
"(",
"\"",
"\"",
")",
")",
"\n",
"refreshClaims",
":=",
"refreshToken",
".",
"Claims",
".",
"(",
"jwt",
".",
"MapClaims",
")",
"\n",
"refreshClaims",
"[",
"\"",
"\"",
"]",
"=",
"0",
"\n",
"refreshTokenString",
",",
"_",
":=",
"refreshToken",
".",
"SignedString",
"(",
"[",
"]",
"byte",
"(",
"c",
".",
"cnf",
".",
"Jwt",
".",
"Key",
")",
")",
"\n",
"data",
":=",
"map",
"[",
"string",
"]",
"string",
"{",
"\"",
"\"",
":",
"tokenString",
",",
"\"",
"\"",
":",
"\"",
"\"",
",",
"\"",
"\"",
":",
"refreshTokenString",
",",
"\"",
"\"",
":",
"\"",
"\"",
",",
"}",
"\n",
"js",
",",
"_",
":=",
"json",
".",
"Marshal",
"(",
"data",
")",
"\n",
"w",
".",
"Write",
"(",
"js",
")",
"\n",
"}",
"\n",
"}"
] |
23,672 | all-23673 | [
"Version",
"returns",
"the",
"version",
"of",
"the",
"plugin"
] | [
"func",
"(",
"client",
"*",
"cniClient",
")",
"Version",
"(",
"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",
"\"",
"\"",
",",
"err",
"\n",
"}",
"\n\n",
"cmd",
":=",
"exec",
".",
"Command",
"(",
"file",
",",
"versionCommand",
")",
"\n",
"versionInfo",
",",
"err",
":=",
"cmd",
".",
"Output",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"\"",
"\"",
",",
"err",
"\n",
"}",
"\n\n",
"version",
":=",
"&",
"cniPluginVersion",
"{",
"}",
"\n",
"// versionInfo is of the format",
"// {\"version\":\"2017.06.0\",\"dirty\":true,\"gitShortHash\":\"226db36\"}",
"// Unmarshal this",
"err",
"=",
"json",
".",
"Unmarshal",
"(",
"versionInfo",
",",
"version",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"\"",
"\"",
",",
"<mask>",
".",
"Wrapf",
"(",
"err",
",",
"\"",
"\"",
",",
"versionInfo",
")",
"\n",
"}",
"\n\n",
"return",
"version",
".",
"str",
"(",
")",
",",
"nil",
"\n",
"}"
] |
23,673 | all-23674 | [
"getEarliestKnownTaskStatusForContainers",
"gets",
"the",
"lowest",
"(",
"earliest",
")",
"task",
"status",
"based",
"on",
"the",
"known",
"statuses",
"of",
"all",
"containers",
"in",
"the",
"task"
] | [
"func",
"(",
"task",
"*",
"Task",
")",
"getEarliestKnownTaskStatusForContainers",
"(",
")",
"apitaskstatus",
".",
"TaskStatus",
"{",
"if",
"len",
"(",
"task",
".",
"Containers",
")",
"==",
"0",
"{",
"seelog",
".",
"Criticalf",
"(",
"\"",
"\"",
",",
"task",
".",
"String",
"(",
")",
")",
"\n",
"return",
"apitaskstatus",
".",
"TaskStatusNone",
"\n",
"}",
"\n",
"// Set earliest container status to an impossible to reach 'high' task status",
"earliest",
":=",
"apitaskstatus",
".",
"TaskZombie",
"\n",
"for",
"_",
",",
"<mask>",
":=",
"range",
"task",
".",
"Containers",
"{",
"containerTaskStatus",
":=",
"apitaskstatus",
".",
"MapContainerToTaskStatus",
"(",
"container",
".",
"GetKnownStatus",
"(",
")",
",",
"container",
".",
"GetSteadyStateStatus",
"(",
")",
")",
"\n",
"if",
"containerTaskStatus",
"<",
"earliest",
"{",
"earliest",
"=",
"containerTaskStatus",
"\n",
"}",
"\n",
"}",
"\n\n",
"return",
"earliest",
"\n",
"}"
] |
23,674 | all-23675 | [
"FilterCount",
"provides",
"a",
"mock",
"function",
"with",
"given",
"fields",
":",
"filter",
"store",
"opts"
] | [
"func",
"(",
"_m",
"*",
"ObjectStore",
")",
"FilterCount",
"(",
"filter",
"map",
"[",
"string",
"]",
"interface",
"{",
"}",
",",
"<mask>",
"string",
",",
"opts",
"gostore",
".",
"ObjectStoreOptions",
")",
"(",
"int64",
",",
"error",
")",
"{",
"ret",
":=",
"_m",
".",
"Called",
"(",
"filter",
",",
"store",
",",
"opts",
")",
"\n\n",
"var",
"r0",
"int64",
"\n",
"if",
"rf",
",",
"ok",
":=",
"ret",
".",
"Get",
"(",
"0",
")",
".",
"(",
"func",
"(",
"map",
"[",
"string",
"]",
"interface",
"{",
"}",
",",
"string",
",",
"gostore",
".",
"ObjectStoreOptions",
")",
"int64",
")",
";",
"ok",
"{",
"r0",
"=",
"rf",
"(",
"filter",
",",
"store",
",",
"opts",
")",
"\n",
"}",
"else",
"{",
"r0",
"=",
"ret",
".",
"Get",
"(",
"0",
")",
".",
"(",
"int64",
")",
"\n",
"}",
"\n\n",
"var",
"r1",
"error",
"\n",
"if",
"rf",
",",
"ok",
":=",
"ret",
".",
"Get",
"(",
"1",
")",
".",
"(",
"func",
"(",
"map",
"[",
"string",
"]",
"interface",
"{",
"}",
",",
"string",
",",
"gostore",
".",
"ObjectStoreOptions",
")",
"error",
")",
";",
"ok",
"{",
"r1",
"=",
"rf",
"(",
"filter",
",",
"store",
",",
"opts",
")",
"\n",
"}",
"else",
"{",
"r1",
"=",
"ret",
".",
"Error",
"(",
"1",
")",
"\n",
"}",
"\n\n",
"return",
"r0",
",",
"r1",
"\n",
"}"
] |
23,675 | all-23676 | [
"Do",
"executes",
"Animation",
".",
"getCurrentTime",
"against",
"the",
"provided",
"context",
".",
"returns",
":",
"currentTime",
"-",
"Current",
"time",
"of",
"the",
"page",
"."
] | [
"func",
"(",
"p",
"*",
"GetCurrentTimeParams",
")",
"Do",
"(",
"ctx",
"context",
".",
"Context",
")",
"(",
"currentTime",
"float64",
",",
"err",
"error",
")",
"{",
"// execute",
"var",
"<mask>",
"GetCurrentTimeReturns",
"\n",
"err",
"=",
"cdp",
".",
"Execute",
"(",
"ctx",
",",
"CommandGetCurrentTime",
",",
"p",
",",
"&",
"res",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"0",
",",
"err",
"\n",
"}",
"\n\n",
"return",
"res",
".",
"CurrentTime",
",",
"nil",
"\n",
"}"
] |
23,676 | all-23677 | [
"diskPathOrName",
"is",
"a",
"helper",
"method",
"that",
"returns",
"the",
"path",
"for",
"a",
"disk",
"-",
"either",
"its",
"path",
"attribute",
"or",
"name",
"as",
"a",
"fallback",
".",
"TODO",
":",
"This",
"method",
"will",
"be",
"removed",
"in",
"future",
"releases",
"."
] | [
"func",
"diskPathOrName",
"(",
"<mask>",
"map",
"[",
"string",
"]",
"interface",
"{",
"}",
")",
"string",
"{",
"var",
"path",
",",
"name",
"string",
"\n",
"if",
"v",
",",
"ok",
":=",
"data",
"[",
"\"",
"\"",
"]",
";",
"ok",
"&&",
"v",
"!=",
"nil",
"{",
"path",
"=",
"v",
".",
"(",
"string",
")",
"\n",
"}",
"\n",
"if",
"v",
",",
"ok",
":=",
"data",
"[",
"\"",
"\"",
"]",
";",
"ok",
"&&",
"v",
"!=",
"nil",
"{",
"name",
"=",
"v",
".",
"(",
"string",
")",
"\n",
"}",
"\n",
"if",
"path",
"!=",
"\"",
"\"",
"{",
"log",
".",
"Printf",
"(",
"\"",
"\"",
",",
"path",
")",
"\n",
"return",
"path",
"\n",
"}",
"\n",
"log",
".",
"Printf",
"(",
"\"",
"\"",
",",
"name",
")",
"\n",
"return",
"name",
"\n",
"}"
] |
23,677 | all-23678 | [
"typeFieldName",
"returns",
"the",
"name",
"of",
"the",
"field",
"at",
"offset",
"off",
"in",
"t",
"."
] | [
"func",
"typeFieldName",
"(",
"t",
"*",
"gocore",
".",
"Type",
",",
"off",
"int64",
")",
"string",
"{",
"switch",
"t",
".",
"Kind",
"{",
"case",
"gocore",
".",
"KindBool",
",",
"gocore",
".",
"KindInt",
",",
"gocore",
".",
"KindUint",
",",
"gocore",
".",
"KindFloat",
":",
"return",
"\"",
"\"",
"\n",
"case",
"gocore",
".",
"KindComplex",
":",
"if",
"off",
"==",
"0",
"{",
"return",
"\"",
"\"",
"\n",
"}",
"\n",
"return",
"\"",
"\"",
"\n",
"case",
"gocore",
".",
"KindIface",
",",
"gocore",
".",
"KindEface",
":",
"if",
"off",
"==",
"0",
"{",
"return",
"\"",
"\"",
"\n",
"}",
"\n",
"return",
"\"",
"\"",
"\n",
"case",
"gocore",
".",
"KindPtr",
",",
"gocore",
".",
"KindFunc",
":",
"return",
"\"",
"\"",
"\n",
"case",
"gocore",
".",
"KindString",
":",
"if",
"off",
"==",
"0",
"{",
"return",
"\"",
"\"",
"\n",
"}",
"\n",
"return",
"\"",
"\"",
"\n",
"case",
"gocore",
".",
"KindSlice",
":",
"if",
"off",
"==",
"0",
"{",
"return",
"\"",
"\"",
"\n",
"}",
"\n",
"if",
"off",
"<=",
"t",
".",
"Size",
"/",
"2",
"{",
"return",
"\"",
"\"",
"\n",
"}",
"\n",
"return",
"\"",
"\"",
"\n",
"<mask>",
"gocore",
".",
"KindArray",
":",
"s",
":=",
"t",
".",
"Elem",
".",
"Size",
"\n",
"i",
":=",
"off",
"/",
"s",
"\n",
"return",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"i",
",",
"typeFieldName",
"(",
"t",
".",
"Elem",
",",
"off",
"-",
"i",
"*",
"s",
")",
")",
"\n",
"case",
"gocore",
".",
"KindStruct",
":",
"for",
"_",
",",
"f",
":=",
"range",
"t",
".",
"Fields",
"{",
"if",
"f",
".",
"Off",
"<=",
"off",
"&&",
"off",
"<",
"f",
".",
"Off",
"+",
"f",
".",
"Type",
".",
"Size",
"{",
"return",
"\"",
"\"",
"+",
"f",
".",
"Name",
"+",
"typeFieldName",
"(",
"f",
".",
"Type",
",",
"off",
"-",
"f",
".",
"Off",
")",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"\"",
"\"",
"\n",
"}"
] |
23,678 | all-23679 | [
"PushGroupWithContent",
"is",
"a",
"wrapper",
"around",
"cairo_push_group_with_content",
"()",
"."
] | [
"func",
"(",
"v",
"*",
"Context",
")",
"PushGroupWithContent",
"(",
"content",
"Content",
")",
"{",
"C",
".",
"cairo_push_group_with_content",
"(",
"v",
".",
"native",
"(",
")",
",",
"C",
".",
"cairo_content_t",
"(",
"<mask>",
")",
")",
"\n",
"}"
] |
23,679 | all-23680 | [
"writeKeyError",
"logs",
"and",
"writes",
"the",
"given",
"Error",
"to",
"the",
"ResponseWriter",
".",
"If",
"Error",
"is",
"not",
"an",
"etcdErr",
"the",
"error",
"will",
"be",
"converted",
"to",
"an",
"etcd",
"error",
"."
] | [
"func",
"writeKeyError",
"(",
"lg",
"*",
"zap",
".",
"Logger",
",",
"w",
"http",
".",
"ResponseWriter",
",",
"err",
"error",
")",
"{",
"if",
"err",
"==",
"nil",
"{",
"return",
"\n",
"}",
"\n",
"switch",
"e",
":=",
"err",
".",
"(",
"type",
")",
"{",
"case",
"*",
"v2error",
".",
"Error",
":",
"e",
".",
"WriteTo",
"(",
"w",
")",
"\n",
"default",
":",
"switch",
"err",
"{",
"case",
"etcdserver",
".",
"ErrTimeoutDueToLeaderFail",
",",
"etcdserver",
".",
"ErrTimeoutDueToConnectionLost",
":",
"if",
"lg",
"!=",
"nil",
"{",
"lg",
".",
"Warn",
"(",
"\"",
"\"",
",",
"zap",
".",
"<mask>",
"(",
"\"",
"\"",
",",
"err",
".",
"Error",
"(",
")",
")",
",",
")",
"\n",
"}",
"else",
"{",
"mlog",
".",
"MergeError",
"(",
"err",
")",
"\n",
"}",
"\n",
"default",
":",
"if",
"lg",
"!=",
"nil",
"{",
"lg",
".",
"Warn",
"(",
"\"",
"\"",
",",
"zap",
".",
"String",
"(",
"\"",
"\"",
",",
"err",
".",
"Error",
"(",
")",
")",
",",
")",
"\n",
"}",
"else",
"{",
"mlog",
".",
"MergeErrorf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"}",
"\n",
"}",
"\n",
"ee",
":=",
"v2error",
".",
"NewError",
"(",
"v2error",
".",
"EcodeRaftInternal",
",",
"err",
".",
"Error",
"(",
")",
",",
"0",
")",
"\n",
"ee",
".",
"WriteTo",
"(",
"w",
")",
"\n",
"}",
"\n",
"}"
] |
23,680 | all-23681 | [
"Resolve",
"resolves",
"the",
"URL",
"host",
"to",
"its",
"IP",
"address",
"."
] | [
"func",
"Resolve",
"(",
"u",
"*",
"<mask>",
".",
"URL",
")",
"(",
"*",
"net",
".",
"IPAddr",
",",
"error",
")",
"{",
"host",
",",
"_",
",",
"err",
":=",
"SplitHostPort",
"(",
"u",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"addr",
",",
"err",
":=",
"net",
".",
"ResolveIPAddr",
"(",
"\"",
"\"",
",",
"host",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"return",
"addr",
",",
"nil",
"\n",
"}"
] |
23,681 | all-23682 | [
"MarshalJSON",
"supports",
"json",
".",
"Marshaler",
"interface"
] | [
"func",
"(",
"v",
"StyleSheetHeader",
")",
"MarshalJSON",
"(",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"w",
":=",
"jwriter",
".",
"<mask>",
"{",
"}",
"\n",
"easyjsonC5a4559bEncodeGithubComChromedpCdprotoCss3",
"(",
"&",
"w",
",",
"v",
")",
"\n",
"return",
"w",
".",
"Buffer",
".",
"BuildBytes",
"(",
")",
",",
"w",
".",
"Error",
"\n",
"}"
] |
23,682 | all-23683 | [
"Claims",
"returns",
"the",
"claims",
"stored",
"in",
"the",
"request"
] | [
"func",
"Claims",
"(",
"r",
"*",
"http",
".",
"Request",
")",
"jwt",
".",
"Claims",
"{",
"if",
"claims",
",",
"ok",
":=",
"r",
".",
"Context",
"(",
")",
".",
"<mask>",
"(",
"ClaimsKey",
")",
".",
"(",
"jwt",
".",
"Claims",
")",
";",
"ok",
"{",
"return",
"claims",
"\n",
"}",
"\n\n",
"return",
"nil",
"\n",
"}"
] |
23,683 | all-23684 | [
"Calculates",
"up",
"-",
"right",
"bounding",
"rectangle",
"of",
"point",
"set",
"points",
"can",
"be",
"either",
"CvSeq",
"*",
"or",
"CvMat",
"*"
] | [
"func",
"BoundingRect",
"(",
"points",
"unsafe",
".",
"Pointer",
")",
"Rect",
"{",
"return",
"(",
"Rect",
")",
"(",
"C",
".",
"cvBoundingRect",
"(",
"<mask>",
",",
"C",
".",
"int",
"(",
"0",
")",
")",
")",
"\n",
"}"
] |
23,684 | all-23685 | [
"SetLastError",
"sets",
"the",
"current",
"error",
"seen",
"by",
"the",
"alerting",
"rule",
"."
] | [
"func",
"(",
"r",
"*",
"AlertingRule",
")",
"SetLastError",
"(",
"<mask>",
"error",
")",
"{",
"r",
".",
"mtx",
".",
"Lock",
"(",
")",
"\n",
"defer",
"r",
".",
"mtx",
".",
"Unlock",
"(",
")",
"\n",
"r",
".",
"lastError",
"=",
"err",
"\n",
"}"
] |
23,685 | all-23686 | [
"GetAccessRoleOk",
"returns",
"a",
"tuple",
"with",
"the",
"AccessRole",
"field",
"if",
"it",
"s",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"and",
"a",
"boolean",
"to",
"check",
"if",
"the",
"value",
"has",
"been",
"set",
"."
] | [
"func",
"(",
"c",
"*",
"CreatedBy",
")",
"GetAccessRoleOk",
"(",
")",
"(",
"string",
",",
"bool",
")",
"{",
"if",
"c",
"==",
"nil",
"||",
"c",
".",
"AccessRole",
"==",
"nil",
"{",
"return",
"\"",
"\"",
",",
"false",
"\n",
"}",
"\n",
"return",
"*",
"c",
".",
"AccessRole",
",",
"<mask>",
"\n",
"}"
] |
23,686 | all-23687 | [
"--------------------------------------------------------------------------",
"Parsers",
"of",
"basic",
"types",
"."
] | [
"func",
"(",
"d",
"*",
"decoder",
")",
"readRegEx",
"(",
")",
"RegEx",
"{",
"<mask>",
":=",
"RegEx",
"{",
"}",
"\n",
"re",
".",
"Pattern",
"=",
"d",
".",
"readCStr",
"(",
")",
"\n",
"re",
".",
"Options",
"=",
"d",
".",
"readCStr",
"(",
")",
"\n",
"return",
"re",
"\n",
"}"
] |
23,687 | all-23688 | [
"Returns",
"a",
"float",
"at",
"the",
"key",
"or",
"the",
"specified",
"value",
"if",
"it",
"doesn",
"t",
"exist",
"or",
"isn",
"t",
"a",
"float"
] | [
"func",
"(",
"t",
"Typed",
")",
"FloatOr",
"(",
"<mask>",
"string",
",",
"d",
"float64",
")",
"float64",
"{",
"if",
"value",
",",
"exists",
":=",
"t",
".",
"FloatIf",
"(",
"key",
")",
";",
"exists",
"{",
"return",
"value",
"\n",
"}",
"\n",
"return",
"d",
"\n",
"}"
] |
23,688 | all-23689 | [
"GetModifiedByOk",
"returns",
"a",
"tuple",
"with",
"the",
"ModifiedBy",
"field",
"if",
"it",
"s",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"and",
"a",
"boolean",
"to",
"check",
"if",
"the",
"value",
"has",
"been",
"set",
"."
] | [
"func",
"(",
"s",
"*",
"SyntheticsTest",
")",
"GetModifiedByOk",
"(",
")",
"(",
"SyntheticsUser",
",",
"bool",
")",
"{",
"if",
"s",
"==",
"nil",
"||",
"s",
".",
"ModifiedBy",
"==",
"nil",
"{",
"return",
"SyntheticsUser",
"{",
"}",
",",
"<mask>",
"\n",
"}",
"\n",
"return",
"*",
"s",
".",
"ModifiedBy",
",",
"true",
"\n",
"}"
] |
23,689 | all-23690 | [
"EncodeWithPrecision",
"encodes",
"the",
"point",
"(",
"lat",
"lng",
")",
"as",
"a",
"string",
"geohash",
"with",
"the",
"specified",
"number",
"of",
"characters",
"of",
"precision",
"(",
"max",
"12",
")",
"."
] | [
"func",
"EncodeWithPrecision",
"(",
"lat",
",",
"lng",
"float64",
",",
"chars",
"uint",
")",
"string",
"{",
"bits",
":=",
"5",
"*",
"chars",
"\n",
"inthash",
":=",
"EncodeIntWithPrecision",
"(",
"<mask>",
",",
"lng",
",",
"bits",
")",
"\n",
"enc",
":=",
"base32encoding",
".",
"Encode",
"(",
"inthash",
")",
"\n",
"return",
"enc",
"[",
"12",
"-",
"chars",
":",
"]",
"\n",
"}"
] |
23,690 | all-23691 | [
"Execute",
"-",
"renames",
"space",
"config"
] | [
"func",
"(",
"c",
"*",
"RenameSpaceConfigurationCommand",
")",
"Execute",
"(",
"args",
"[",
"]",
"string",
")",
"error",
"{",
"c",
".",
"initConfig",
"(",
")",
"\n",
"spaceConfig",
",",
"err",
":=",
"c",
".",
"ConfigManager",
".",
"GetSpaceConfig",
"(",
"c",
".",
"OrgName",
",",
"c",
".",
"SpaceName",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"<mask>",
"\n",
"}",
"\n\n",
"spaces",
",",
"err",
":=",
"c",
".",
"ConfigManager",
".",
"OrgSpaces",
"(",
"c",
".",
"OrgName",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"spaceConfig",
".",
"Space",
"=",
"c",
".",
"NewSpaceName",
"\n",
"spaceConfig",
".",
"OriginalSpace",
"=",
"c",
".",
"SpaceName",
"\n\n",
"err",
"=",
"c",
".",
"ConfigManager",
".",
"RenameSpaceConfig",
"(",
"spaceConfig",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"spaces",
".",
"Replace",
"(",
"c",
".",
"SpaceName",
",",
"c",
".",
"NewSpaceName",
")",
"\n",
"err",
"=",
"c",
".",
"ConfigManager",
".",
"SaveOrgSpaces",
"(",
"spaces",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"fmt",
".",
"Println",
"(",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"c",
".",
"OrgName",
",",
"c",
".",
"SpaceName",
",",
"c",
".",
"OrgName",
",",
"c",
".",
"NewSpaceName",
")",
")",
"\n",
"return",
"nil",
"\n",
"}"
] |
23,691 | all-23692 | [
"Logf",
"logs",
"the",
"line",
"Sprintf",
"(",
"formatString",
"args",
"...",
")",
"but",
"formatted",
"as",
"a",
"json",
"message",
"and",
"annotated",
"with",
"all",
"of",
"the",
"metadata",
"stored",
"in",
"loginfo",
".",
"Note",
":",
"this",
"is",
"not",
"thread",
"-",
"safe",
"as",
"it",
"modifies",
"fields",
"of",
"logger",
".",
"template"
] | [
"func",
"(",
"logger",
"*",
"taggedLogger",
")",
"Logf",
"(",
"formatString",
"string",
",",
"args",
"...",
"<mask>",
"{",
"}",
")",
"{",
"logger",
".",
"template",
".",
"Message",
"=",
"fmt",
".",
"Sprintf",
"(",
"formatString",
",",
"args",
"...",
")",
"\n",
"if",
"ts",
",",
"err",
":=",
"types",
".",
"TimestampProto",
"(",
"time",
".",
"Now",
"(",
")",
")",
";",
"err",
"==",
"nil",
"{",
"logger",
".",
"template",
".",
"Ts",
"=",
"ts",
"\n",
"}",
"else",
"{",
"logger",
".",
"stderrLog",
".",
"Printf",
"(",
"\"",
"\\n",
"\"",
",",
"err",
")",
"\n",
"return",
"\n",
"}",
"\n",
"msg",
",",
"err",
":=",
"logger",
".",
"marshaler",
".",
"MarshalToString",
"(",
"&",
"logger",
".",
"template",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"logger",
".",
"stderrLog",
".",
"Printf",
"(",
"\"",
"\\n",
"\"",
",",
"&",
"logger",
".",
"template",
",",
"err",
")",
"\n",
"return",
"\n",
"}",
"\n",
"fmt",
".",
"Println",
"(",
"msg",
")",
"\n",
"if",
"logger",
".",
"putObjClient",
"!=",
"nil",
"{",
"logger",
".",
"msgCh",
"<-",
"msg",
"+",
"\"",
"\\n",
"\"",
"\n",
"}",
"\n",
"}"
] |
23,692 | all-23693 | [
"Name",
"allows",
"users",
"to",
"set",
"custom",
"names",
"for",
"the",
"routes",
"."
] | [
"func",
"(",
"ri",
"*",
"RouteInfo",
")",
"Name",
"(",
"<mask>",
"string",
")",
"*",
"RouteInfo",
"{",
"routeIndex",
":=",
"-",
"1",
"\n",
"for",
"index",
",",
"route",
":=",
"range",
"ri",
".",
"App",
".",
"Routes",
"(",
")",
"{",
"if",
"route",
".",
"Path",
"==",
"ri",
".",
"Path",
"&&",
"route",
".",
"Method",
"==",
"ri",
".",
"Method",
"{",
"routeIndex",
"=",
"index",
"\n",
"break",
"\n",
"}",
"\n",
"}",
"\n\n",
"name",
"=",
"flect",
".",
"Camelize",
"(",
"name",
")",
"\n\n",
"if",
"!",
"strings",
".",
"HasSuffix",
"(",
"name",
",",
"\"",
"\"",
")",
"{",
"name",
"=",
"name",
"+",
"\"",
"\"",
"\n",
"}",
"\n\n",
"ri",
".",
"PathName",
"=",
"name",
"\n",
"if",
"routeIndex",
"!=",
"-",
"1",
"{",
"ri",
".",
"App",
".",
"Routes",
"(",
")",
"[",
"routeIndex",
"]",
"=",
"reflect",
".",
"ValueOf",
"(",
"ri",
")",
".",
"Interface",
"(",
")",
".",
"(",
"*",
"RouteInfo",
")",
"\n",
"}",
"\n\n",
"return",
"ri",
"\n",
"}"
] |
23,693 | all-23694 | [
"GoPaths",
"returns",
"all",
"possible",
"GOPATHS",
"that",
"are",
"set",
"."
] | [
"func",
"GoPaths",
"(",
")",
"[",
"]",
"string",
"{",
"gp",
":=",
"Get",
"(",
"\"",
"\"",
",",
"\"",
"\"",
")",
"\n",
"if",
"runtime",
".",
"GOOS",
"==",
"\"",
"\"",
"{",
"<mask>",
"strings",
".",
"Split",
"(",
"gp",
",",
"\"",
"\"",
")",
"// Windows uses a different separator",
"\n",
"}",
"\n",
"return",
"strings",
".",
"Split",
"(",
"gp",
",",
"\"",
"\"",
")",
"\n",
"}"
] |
23,694 | all-23695 | [
"UnmarshalJSON",
"supports",
"json",
".",
"Unmarshaler",
"interface"
] | [
"func",
"(",
"v",
"*",
"UntrackIndexedDBForOriginParams",
")",
"UnmarshalJSON",
"(",
"data",
"[",
"]",
"<mask>",
")",
"error",
"{",
"r",
":=",
"jlexer",
".",
"Lexer",
"{",
"Data",
":",
"data",
"}",
"\n",
"easyjsonC5a4559bDecodeGithubComChromedpCdprotoStorage1",
"(",
"&",
"r",
",",
"v",
")",
"\n",
"return",
"r",
".",
"Error",
"(",
")",
"\n",
"}"
] |
23,695 | all-23696 | [
"NewExplicitRepoPathBuilder",
"returns",
"a",
"builder",
"that",
"handles",
"the",
"path",
"encoding",
"where",
"a",
"path",
"will",
"always",
"have",
"an",
"explicit",
"org_repo",
"path",
"segment"
] | [
"func",
"NewExplicitRepoPathBuilder",
"(",
")",
"RepoPathBuilder",
"{",
"return",
"func",
"(",
"org",
",",
"repo",
"<mask>",
")",
"string",
"{",
"// handle gerrit repo",
"repo",
"=",
"strings",
".",
"Replace",
"(",
"repo",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"-",
"1",
")",
"\n",
"return",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"org",
",",
"repo",
")",
"\n",
"}",
"\n",
"}"
] |
23,696 | all-23697 | [
"keyExistsFunc",
"returns",
"true",
"if",
"a",
"key",
"exists",
"false",
"otherwise",
"."
] | [
"func",
"keyExistsFunc",
"(",
"b",
"*",
"Brain",
",",
"used",
",",
"missing",
"*",
"dep",
".",
"Set",
")",
"func",
"(",
"string",
")",
"(",
"bool",
",",
"error",
")",
"{",
"return",
"func",
"(",
"s",
"string",
")",
"(",
"bool",
",",
"error",
")",
"{",
"if",
"len",
"(",
"s",
")",
"==",
"0",
"{",
"return",
"false",
",",
"nil",
"\n",
"}",
"\n\n",
"d",
",",
"err",
":=",
"dep",
".",
"NewKVGetQuery",
"(",
"s",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"false",
",",
"err",
"\n",
"}",
"\n\n",
"used",
".",
"Add",
"(",
"d",
")",
"\n\n",
"if",
"value",
",",
"ok",
":=",
"b",
".",
"Recall",
"(",
"d",
")",
";",
"ok",
"{",
"return",
"value",
"!=",
"nil",
",",
"nil",
"\n",
"}",
"\n\n",
"<mask>",
".",
"Add",
"(",
"d",
")",
"\n\n",
"return",
"false",
",",
"nil",
"\n",
"}",
"\n",
"}"
] |
23,697 | all-23698 | [
"UnmarshalJSON",
"supports",
"json",
".",
"Unmarshaler",
"interface"
] | [
"func",
"(",
"v",
"*",
"AuthChallenge",
")",
"UnmarshalJSON",
"(",
"<mask>",
"[",
"]",
"byte",
")",
"error",
"{",
"r",
":=",
"jlexer",
".",
"Lexer",
"{",
"Data",
":",
"data",
"}",
"\n",
"easyjsonC5a4559bDecodeGithubComChromedpCdprotoFetch15",
"(",
"&",
"r",
",",
"v",
")",
"\n",
"return",
"r",
".",
"Error",
"(",
")",
"\n",
"}"
] |
23,698 | all-23699 | [
"NewEncoder",
"creates",
"a",
"new",
"encoder",
"with",
"the",
"given",
"io",
".",
"Writer"
] | [
"func",
"NewEncoder",
"(",
"w",
"io",
".",
"Writer",
")",
"Encoder",
"{",
"return",
"versionOneEncoder",
"{",
"w",
",",
"make",
"(",
"[",
"]",
"byte",
",",
"9",
")",
",",
"bytes",
".",
"NewBuffer",
"(",
"<mask>",
"(",
"[",
"]",
"byte",
",",
"0",
",",
"4096",
")",
")",
"}",
"\n",
"}"
] |
23,699 | all-23700 | [
"Init",
"our",
"internal",
"data",
"structures",
"."
] | [
"func",
"(",
"s",
"*",
"OS",
")",
"Init",
"(",
")",
"error",
"{",
"err",
":=",
"s",
".",
"initDirs",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"s",
".",
"Architectures",
",",
"err",
"=",
"util",
".",
"GetArchitectures",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"s",
".",
"LxcPath",
"=",
"filepath",
".",
"Join",
"(",
"s",
".",
"VarDir",
",",
"\"",
"\"",
")",
"\n\n",
"s",
".",
"BackingFS",
",",
"err",
"=",
"util",
".",
"FilesystemDetect",
"(",
"s",
".",
"LxcPath",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"logger",
".",
"Error",
"(",
"\"",
"\"",
",",
"log",
".",
"Ctx",
"{",
"\"",
"\"",
":",
"err",
"}",
")",
"\n",
"}",
"\n\n",
"s",
".",
"IdmapSet",
"=",
"util",
".",
"GetIdmapSet",
"(",
")",
"\n",
"s",
".",
"ExecPath",
"=",
"util",
".",
"GetExecPath",
"(",
")",
"\n",
"s",
".",
"RunningInUserNS",
"=",
"<mask>",
".",
"RunningInUserNS",
"(",
")",
"\n\n",
"s",
".",
"initAppArmor",
"(",
")",
"\n",
"s",
".",
"initCGroup",
"(",
")",
"\n\n",
"return",
"nil",
"\n",
"}"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.