id
int32 0
25.3k
| idx
stringlengths 5
9
| nl_tokens
sequencelengths 1
418
| pl_tokens
sequencelengths 22
4.98k
|
---|---|---|---|
5,200 | all-5201 | [
"Calculates",
"the",
"per",
"-",
"element",
"difference",
"between",
"a",
"scalar",
"and",
"an",
"array",
".",
"dst",
"=",
"value",
"-",
"src"
] | [
"func",
"SubScalarRev",
"(",
"<mask>",
"Scalar",
",",
"src",
",",
"dst",
"*",
"IplImage",
")",
"{",
"SubScalarWithMaskRev",
"(",
"value",
",",
"src",
",",
"dst",
",",
"nil",
")",
"\n",
"}"
] |
5,201 | all-5202 | [
"Letters",
"returns",
"an",
"array",
"of",
"runes",
"as",
"strings",
"so",
"it",
"can",
"be",
"indexed",
"into",
"."
] | [
"func",
"Letters",
"(",
"s",
"string",
")",
"[",
"]",
"string",
"{",
"result",
":=",
"[",
"]",
"string",
"{",
"}",
"\n",
"for",
"_",
",",
"r",
":=",
"range",
"s",
"{",
"<mask>",
"=",
"append",
"(",
"result",
",",
"string",
"(",
"r",
")",
")",
"\n",
"}",
"\n",
"return",
"result",
"\n",
"}"
] |
5,202 | all-5203 | [
"Combination",
"generator",
"for",
"int",
"slice"
] | [
"func",
"combinations",
"(",
"list",
"[",
"]",
"int",
",",
"select_num",
",",
"buf",
"int",
")",
"(",
"c",
"chan",
"[",
"]",
"int",
")",
"{",
"c",
"=",
"make",
"(",
"chan",
"[",
"]",
"int",
",",
"buf",
")",
"\n",
"go",
"func",
"(",
")",
"{",
"defer",
"close",
"(",
"c",
")",
"\n",
"switch",
"{",
"case",
"select_num",
"==",
"0",
":",
"c",
"<-",
"[",
"]",
"int",
"{",
"}",
"\n",
"case",
"select_num",
"==",
"len",
"(",
"<mask>",
")",
":",
"c",
"<-",
"list",
"\n",
"case",
"len",
"(",
"list",
")",
"<",
"select_num",
":",
"return",
"\n",
"default",
":",
"for",
"i",
":=",
"0",
";",
"i",
"<",
"len",
"(",
"list",
")",
";",
"i",
"++",
"{",
"for",
"sub_comb",
":=",
"range",
"combinations",
"(",
"list",
"[",
"i",
"+",
"1",
":",
"]",
",",
"select_num",
"-",
"1",
",",
"buf",
")",
"{",
"c",
"<-",
"append",
"(",
"[",
"]",
"int",
"{",
"list",
"[",
"i",
"]",
"}",
",",
"sub_comb",
"...",
")",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"(",
")",
"\n",
"return",
"\n",
"}"
] |
5,203 | all-5204 | [
"Build",
"action",
"param",
"struct",
"from",
"json",
"data"
] | [
"func",
"(",
"p",
"*",
"ParamAnalyzer",
")",
"parseParam",
"(",
"path",
"string",
",",
"param",
"map",
"[",
"string",
"]",
"interface",
"{",
"}",
",",
"child",
"*",
"<mask>",
".",
"ActionParam",
")",
"*",
"gen",
".",
"ActionParam",
"{",
"dType",
":=",
"p",
".",
"parseDataType",
"(",
"path",
",",
"child",
")",
"\n",
"return",
"p",
".",
"newParam",
"(",
"path",
",",
"param",
",",
"dType",
")",
"\n",
"}"
] |
5,204 | all-5205 | [
"PrintDetailedCommitInfo",
"pretty",
"-",
"prints",
"detailed",
"commit",
"info",
"."
] | [
"func",
"PrintDetailedCommitInfo",
"(",
"commitInfo",
"*",
"PrintableCommitInfo",
")",
"error",
"{",
"template",
",",
"err",
":=",
"template",
".",
"New",
"(",
"\"",
"\"",
")",
".",
"Funcs",
"(",
"funcMap",
")",
".",
"Parse",
"(",
"`Commit: {{.Commit.Repo.Name}}@{{.Commit.ID}}{{if .Branch}}\nOriginal Branch: {{.Branch.Name}}{{end}}{{if .Description}}\nDescription: {{.Description}}{{end}}{{if .ParentCommit}}\nParent: {{.ParentCommit.ID}}{{end}}{{if .FullTimestamps}}\nStarted: {{.Started}}{{else}}\nStarted: {{prettyAgo .Started}}{{end}}{{if .Finished}}{{if .FullTimestamps}}\nFinished: {{.Finished}}{{else}}\nFinished: {{prettyAgo .Finished}}{{end}}{{end}}\nSize: {{prettySize .SizeBytes}}{{if .Provenance}}\nProvenance: {{range .Provenance}} {{.Commit.Repo.Name}}@{{.Commit.ID}} ({{.Branch.Name}}) {{end}} {{end}}\n`",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"err",
"=",
"template",
".",
"Execute",
"(",
"<mask>",
".",
"Stdout",
",",
"commitInfo",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
] |
5,205 | all-5206 | [
"readByte",
"creates",
"a",
"single",
"random",
"byte",
"."
] | [
"func",
"(",
"s",
"*",
"Random",
")",
"readByte",
"(",
")",
"byte",
"{",
"before",
":=",
"<mask>",
".",
"Now",
"(",
")",
"\n",
"rndDuration",
":=",
"time",
".",
"Duration",
"(",
"getUInt16FromBytes",
"(",
"s",
".",
"val",
")",
")",
"\n\n",
"time",
".",
"Sleep",
"(",
"DEFAULT_SLEEP_TIME",
"+",
"rndDuration",
")",
"\n",
"diff",
":=",
"time",
".",
"Now",
"(",
")",
".",
"Sub",
"(",
"before",
")",
"\n",
"n",
":=",
"byte",
"(",
"diff",
".",
"Nanoseconds",
"(",
")",
")",
"\n\n",
"s",
".",
"val",
"[",
"s",
".",
"index",
"]",
"=",
"n",
"\n",
"s",
".",
"index",
"^=",
"1",
"\n\n",
"return",
"n",
"\n",
"}"
] |
5,206 | all-5207 | [
"DeepCopy",
"is",
"an",
"autogenerated",
"deepcopy",
"function",
"copying",
"the",
"receiver",
"creating",
"a",
"new",
"DNSEndpointStatus",
"."
] | [
"func",
"(",
"in",
"*",
"DNSEndpointStatus",
")",
"DeepCopy",
"(",
")",
"*",
"DNSEndpointStatus",
"{",
"if",
"<mask>",
"==",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n",
"out",
":=",
"new",
"(",
"DNSEndpointStatus",
")",
"\n",
"in",
".",
"DeepCopyInto",
"(",
"out",
")",
"\n",
"return",
"out",
"\n",
"}"
] |
5,207 | all-5208 | [
"makePipeline",
"creates",
"a",
"PipelineRun",
"from",
"a",
"prow",
"job",
"using",
"the",
"PipelineRunSpec",
"defined",
"in",
"the",
"prow",
"job"
] | [
"func",
"makePipelineRun",
"(",
"pj",
"prowjobv1",
".",
"ProwJob",
",",
"pr",
"*",
"pipelinev1alpha1",
".",
"PipelineResource",
")",
"(",
"*",
"pipelinev1alpha1",
".",
"PipelineRun",
",",
"error",
")",
"{",
"if",
"pj",
".",
"Spec",
".",
"PipelineRunSpec",
"==",
"nil",
"{",
"return",
"nil",
",",
"errors",
".",
"New",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"p",
":=",
"pipelinev1alpha1",
".",
"PipelineRun",
"{",
"ObjectMeta",
":",
"pipelineMeta",
"(",
"pj",
")",
",",
"Spec",
":",
"*",
"pj",
".",
"Spec",
".",
"PipelineRunSpec",
".",
"DeepCopy",
"(",
")",
",",
"}",
"\n",
"buildID",
":=",
"pj",
".",
"Status",
".",
"BuildID",
"\n",
"if",
"buildID",
"==",
"\"",
"\"",
"{",
"return",
"nil",
",",
"errors",
".",
"New",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"p",
".",
"Spec",
".",
"Params",
"=",
"append",
"(",
"p",
".",
"Spec",
".",
"Params",
",",
"pipelinev1alpha1",
".",
"Param",
"{",
"Name",
":",
"\"",
"\"",
",",
"Value",
":",
"buildID",
",",
"}",
")",
"\n",
"rb",
":=",
"pipelinev1alpha1",
".",
"PipelineResourceBinding",
"{",
"Name",
":",
"pr",
".",
"<mask>",
",",
"ResourceRef",
":",
"pipelinev1alpha1",
".",
"PipelineResourceRef",
"{",
"Name",
":",
"pr",
".",
"Name",
",",
"APIVersion",
":",
"pr",
".",
"APIVersion",
",",
"}",
",",
"}",
"\n",
"p",
".",
"Spec",
".",
"Resources",
"=",
"append",
"(",
"p",
".",
"Spec",
".",
"Resources",
",",
"rb",
")",
"\n\n",
"return",
"&",
"p",
",",
"nil",
"\n",
"}"
] |
5,208 | all-5209 | [
"RegisterFuncMap",
"register",
"FuncMap",
"for",
"render",
"."
] | [
"func",
"(",
"render",
"*",
"Render",
")",
"RegisterFuncMap",
"(",
"name",
"string",
",",
"fc",
"interface",
"{",
"}",
")",
"{",
"if",
"render",
".",
"funcMaps",
"==",
"nil",
"{",
"<mask>",
".",
"funcMaps",
"=",
"template",
".",
"FuncMap",
"{",
"}",
"\n",
"}",
"\n",
"render",
".",
"funcMaps",
"[",
"name",
"]",
"=",
"fc",
"\n",
"}"
] |
5,209 | all-5210 | [
"RequestDatabase",
"requests",
"database",
"with",
"given",
"name",
"in",
"given",
"frame",
".",
"See",
":",
"https",
":",
"//",
"chromedevtools",
".",
"github",
".",
"io",
"/",
"devtools",
"-",
"protocol",
"/",
"tot",
"/",
"IndexedDB#method",
"-",
"requestDatabase",
"parameters",
":",
"securityOrigin",
"-",
"Security",
"origin",
".",
"databaseName",
"-",
"Database",
"name",
"."
] | [
"func",
"RequestDatabase",
"(",
"securityOrigin",
"<mask>",
",",
"databaseName",
"string",
")",
"*",
"RequestDatabaseParams",
"{",
"return",
"&",
"RequestDatabaseParams",
"{",
"SecurityOrigin",
":",
"securityOrigin",
",",
"DatabaseName",
":",
"databaseName",
",",
"}",
"\n",
"}"
] |
5,210 | all-5211 | [
"bind",
"a",
"transform",
"feedback",
"object"
] | [
"func",
"BindTransformFeedback",
"(",
"target",
"uint32",
",",
"<mask>",
"uint32",
")",
"{",
"syscall",
".",
"Syscall",
"(",
"gpBindTransformFeedback",
",",
"2",
",",
"uintptr",
"(",
"target",
")",
",",
"uintptr",
"(",
"id",
")",
",",
"0",
")",
"\n",
"}"
] |
5,211 | all-5212 | [
"resourceVSphereDatastoreApplyFolderOrStorageClusterPath",
"returns",
"a",
"path",
"to",
"a",
"folder",
"or",
"a",
"datastore",
"cluster",
"depending",
"on",
"what",
"has",
"been",
"selected",
"in",
"the",
"resource",
"."
] | [
"func",
"resourceVSphereDatastoreApplyFolderOrStorageClusterPath",
"(",
"d",
"*",
"schema",
".",
"ResourceData",
",",
"meta",
"interface",
"{",
"}",
")",
"(",
"string",
",",
"error",
")",
"{",
"var",
"path",
"string",
"\n",
"fvalue",
",",
"fok",
":=",
"d",
".",
"GetOk",
"(",
"\"",
"\"",
")",
"\n",
"cvalue",
",",
"cok",
":=",
"d",
".",
"GetOk",
"(",
"\"",
"\"",
")",
"\n",
"switch",
"{",
"case",
"fok",
":",
"<mask>",
"=",
"fvalue",
".",
"(",
"string",
")",
"\n",
"case",
"cok",
":",
"return",
"resourceVSphereDatastoreStorageClusterPathNormalized",
"(",
"meta",
",",
"cvalue",
".",
"(",
"string",
")",
")",
"\n",
"}",
"\n",
"return",
"path",
",",
"nil",
"\n",
"}"
] |
5,212 | all-5213 | [
"flushableLine",
"returns",
"a",
"boolean",
"value",
"indicating",
"whether",
"the",
"line",
"j",
"is",
"flushabled",
"or",
"not",
"."
] | [
"func",
"(",
"f",
"*",
"Field",
")",
"flushableLine",
"(",
"j",
"int",
")",
"bool",
"{",
"for",
"i",
":=",
"0",
";",
"i",
"<",
"fieldBlockNumX",
";",
"i",
"++",
"{",
"if",
"f",
".",
"<mask>",
"[",
"i",
"]",
"[",
"j",
"]",
"==",
"BlockTypeNone",
"{",
"return",
"false",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"true",
"\n",
"}"
] |
5,213 | all-5214 | [
"/",
"*",
"Alternatively",
"you",
"can",
"instantiate",
"a",
"client",
"from",
"an",
"environment",
"variable",
".",
"This",
"is",
"particularly",
"relevant",
"if",
"you",
"are",
"using",
"Pusher",
"as",
"a",
"Heroku",
"add",
"-",
"on",
"which",
"stores",
"credentials",
"in",
"a",
"PUSHER_URL",
"environment",
"variable",
".",
"For",
"example",
":",
"client",
":",
"=",
"pusher",
".",
"ClientFromEnv",
"(",
"PUSHER_URL",
")"
] | [
"func",
"ClientFromEnv",
"(",
"<mask>",
"string",
")",
"(",
"*",
"Client",
",",
"error",
")",
"{",
"url",
":=",
"os",
".",
"Getenv",
"(",
"key",
")",
"\n",
"return",
"ClientFromURL",
"(",
"url",
")",
"\n",
"}"
] |
5,214 | all-5215 | [
"Do",
"executes",
"Page",
".",
"getInstallabilityErrors",
"against",
"the",
"provided",
"context",
".",
"returns",
":",
"errors"
] | [
"func",
"(",
"p",
"*",
"GetInstallabilityErrorsParams",
")",
"Do",
"(",
"ctx",
"context",
".",
"Context",
")",
"(",
"errors",
"[",
"]",
"string",
",",
"err",
"error",
")",
"{",
"// execute",
"var",
"res",
"GetInstallabilityErrorsReturns",
"\n",
"err",
"=",
"cdp",
".",
"Execute",
"(",
"ctx",
",",
"CommandGetInstallabilityErrors",
",",
"nil",
",",
"&",
"<mask>",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"return",
"res",
".",
"Errors",
",",
"nil",
"\n",
"}"
] |
5,215 | all-5216 | [
"PrivateKey",
"is",
"a",
"convenience",
"to",
"encode",
"the",
"underlying",
"private",
"key",
"."
] | [
"func",
"(",
"c",
"*",
"CertInfo",
")",
"PrivateKey",
"(",
")",
"[",
"]",
"byte",
"{",
"ecKey",
",",
"ok",
":=",
"c",
".",
"KeyPair",
"(",
")",
".",
"PrivateKey",
".",
"(",
"*",
"ecdsa",
".",
"PrivateKey",
")",
"\n",
"if",
"ok",
"{",
"data",
",",
"err",
":=",
"x509",
".",
"MarshalECPrivateKey",
"(",
"ecKey",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n\n",
"return",
"pem",
".",
"EncodeToMemory",
"(",
"&",
"pem",
".",
"Block",
"{",
"Type",
":",
"\"",
"\"",
",",
"Bytes",
":",
"data",
"}",
")",
"\n",
"}",
"\n\n",
"rsaKey",
",",
"ok",
":=",
"c",
".",
"KeyPair",
"(",
")",
".",
"PrivateKey",
".",
"(",
"*",
"rsa",
".",
"PrivateKey",
")",
"\n",
"if",
"<mask>",
"{",
"data",
":=",
"x509",
".",
"MarshalPKCS1PrivateKey",
"(",
"rsaKey",
")",
"\n",
"return",
"pem",
".",
"EncodeToMemory",
"(",
"&",
"pem",
".",
"Block",
"{",
"Type",
":",
"\"",
"\"",
",",
"Bytes",
":",
"data",
"}",
")",
"\n",
"}",
"\n\n",
"return",
"nil",
"\n",
"}"
] |
5,216 | all-5217 | [
"EscapePathFstab",
"escapes",
"a",
"path",
"fstab",
"-",
"style",
".",
"This",
"ensures",
"that",
"getmntent_r",
"()",
"and",
"friends",
"can",
"correctly",
"parse",
"stuff",
"like",
"/",
"some",
"/",
"wacky",
"path",
"with",
"spaces",
"/",
"some",
"/",
"wacky",
"target",
"with",
"spaces"
] | [
"func",
"EscapePathFstab",
"(",
"<mask>",
"string",
")",
"string",
"{",
"r",
":=",
"strings",
".",
"NewReplacer",
"(",
"\"",
"\"",
",",
"\"",
"\\\\",
"\"",
",",
"\"",
"\\t",
"\"",
",",
"\"",
"\\\\",
"\"",
",",
"\"",
"\\n",
"\"",
",",
"\"",
"\\\\",
"\"",
",",
"\"",
"\\\\",
"\"",
",",
"\"",
"\\\\",
"\\\\",
"\"",
")",
"\n",
"return",
"r",
".",
"Replace",
"(",
"path",
")",
"\n",
"}"
] |
5,217 | all-5218 | [
"Vec3Dist2DSqr",
"derives",
"the",
"square",
"of",
"the",
"distance",
"between",
"v1",
"and",
"v2",
"on",
"the",
"xz",
"-",
"plane",
".",
"The",
"vectors",
"are",
"projected",
"onto",
"the",
"xz",
"-",
"plane",
"so",
"the",
"y",
"-",
"values",
"are",
"ignored",
"."
] | [
"func",
"Vec3Dist2DSqr",
"(",
"v1",
",",
"v2",
"Vec3",
")",
"float32",
"{",
"dx",
":=",
"v1",
"[",
"0",
"]",
"-",
"v2",
"[",
"0",
"]",
"\n",
"dz",
":=",
"v1",
"[",
"2",
"]",
"-",
"v2",
"[",
"2",
"]",
"\n",
"<mask>",
"dx",
"*",
"dx",
"+",
"dz",
"*",
"dz",
"\n",
"}"
] |
5,218 | all-5219 | [
"WithTimeout",
"sets",
"the",
"timeout",
"to",
"use",
"for",
"each",
"call",
"."
] | [
"func",
"WithTimeout",
"(",
"timeout",
"<mask>",
".",
"Duration",
")",
"Option",
"{",
"return",
"func",
"(",
"opts",
"*",
"options",
")",
"{",
"opts",
".",
"timeout",
"=",
"timeout",
"\n",
"}",
"\n",
"}"
] |
5,219 | all-5220 | [
"GetBlob",
"returns",
"a",
"stream",
"for",
"the",
"specified",
"blob",
"and",
"the",
"blob’s",
"size",
"(",
"or",
"-",
"1",
"if",
"unknown",
")",
".",
"The",
"Digest",
"field",
"in",
"BlobInfo",
"is",
"guaranteed",
"to",
"be",
"provided",
"Size",
"may",
"be",
"-",
"1",
"and",
"MediaType",
"may",
"be",
"optionally",
"provided",
".",
"May",
"update",
"BlobInfoCache",
"preferably",
"after",
"it",
"knows",
"for",
"certain",
"that",
"a",
"blob",
"truly",
"exists",
"at",
"a",
"specific",
"location",
"."
] | [
"func",
"(",
"s",
"*",
"ociArchiveImageSource",
")",
"GetBlob",
"(",
"ctx",
"<mask>",
".",
"Context",
",",
"info",
"types",
".",
"BlobInfo",
",",
"cache",
"types",
".",
"BlobInfoCache",
")",
"(",
"io",
".",
"ReadCloser",
",",
"int64",
",",
"error",
")",
"{",
"return",
"s",
".",
"unpackedSrc",
".",
"GetBlob",
"(",
"ctx",
",",
"info",
",",
"cache",
")",
"\n",
"}"
] |
5,220 | all-5221 | [
"Addr",
"returns",
"the",
"starting",
"address",
"of",
"x",
"."
] | [
"func",
"(",
"p",
"*",
"Process",
")",
"Addr",
"(",
"x",
"Object",
")",
"core",
".",
"Address",
"{",
"return",
"core",
".",
"<mask>",
"(",
"x",
")",
"\n",
"}"
] |
5,221 | all-5222 | [
"GetScope",
"returns",
"the",
"Scope",
"field",
"if",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"."
] | [
"func",
"(",
"s",
"*",
"Series",
")",
"GetScope",
"(",
")",
"string",
"{",
"if",
"s",
"==",
"nil",
"||",
"s",
".",
"Scope",
"==",
"nil",
"{",
"<mask>",
"\"",
"\"",
"\n",
"}",
"\n",
"return",
"*",
"s",
".",
"Scope",
"\n",
"}"
] |
5,222 | all-5223 | [
"WithHTTPClient",
"adds",
"the",
"HTTPClient",
"to",
"the",
"get",
"apps",
"app",
"routes",
"route",
"params"
] | [
"func",
"(",
"o",
"*",
"GetAppsAppRoutesRouteParams",
")",
"WithHTTPClient",
"(",
"<mask>",
"*",
"http",
".",
"Client",
")",
"*",
"GetAppsAppRoutesRouteParams",
"{",
"o",
".",
"SetHTTPClient",
"(",
"client",
")",
"\n",
"return",
"o",
"\n",
"}"
] |
5,223 | all-5224 | [
"UpdateSpaces",
"-"
] | [
"func",
"(",
"m",
"*",
"DefaultManager",
")",
"UpdateSpaces",
"(",
")",
"error",
"{",
"m",
".",
"spaces",
"=",
"nil",
"\n",
"spaceConfigs",
",",
"err",
":=",
"m",
".",
"Cfg",
".",
"GetSpaceConfigs",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"err",
"=",
"m",
".",
"init",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"for",
"_",
",",
"input",
":=",
"range",
"spaceConfigs",
"{",
"space",
",",
"err",
":=",
"m",
".",
"FindSpace",
"(",
"input",
".",
"Org",
",",
"input",
".",
"Space",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"continue",
"\n",
"}",
"\n",
"lo",
".",
"G",
".",
"Debug",
"(",
"\"",
"\"",
",",
"space",
".",
"<mask>",
")",
"\n",
"if",
"input",
".",
"AllowSSHUntil",
"!=",
"\"",
"\"",
"{",
"allowUntil",
",",
"err",
":=",
"time",
".",
"Parse",
"(",
"time",
".",
"RFC3339",
",",
"input",
".",
"AllowSSHUntil",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"errors",
".",
"Wrap",
"(",
"err",
",",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"input",
".",
"AllowSSHUntil",
",",
"time",
".",
"RFC3339",
")",
")",
"\n",
"}",
"\n",
"if",
"allowUntil",
".",
"After",
"(",
"time",
".",
"Now",
"(",
")",
")",
"&&",
"!",
"space",
".",
"AllowSSH",
"{",
"if",
"m",
".",
"Peek",
"{",
"lo",
".",
"G",
".",
"Infof",
"(",
"\"",
"\"",
",",
"input",
".",
"Org",
",",
"space",
".",
"Name",
",",
"input",
".",
"AllowSSHUntil",
")",
"\n",
"continue",
"\n",
"}",
"\n",
"lo",
".",
"G",
".",
"Infof",
"(",
"\"",
"\"",
",",
"input",
".",
"Org",
",",
"space",
".",
"Name",
",",
"input",
".",
"AllowSSHUntil",
")",
"\n",
"if",
"err",
":=",
"m",
".",
"UpdateSpaceSSH",
"(",
"true",
",",
"space",
",",
"input",
".",
"Org",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"}",
"\n",
"if",
"allowUntil",
".",
"Before",
"(",
"time",
".",
"Now",
"(",
")",
")",
"&&",
"space",
".",
"AllowSSH",
"{",
"if",
"m",
".",
"Peek",
"{",
"lo",
".",
"G",
".",
"Infof",
"(",
"\"",
"\"",
",",
"input",
".",
"Org",
",",
"space",
".",
"Name",
",",
"input",
".",
"AllowSSHUntil",
")",
"\n",
"continue",
"\n",
"}",
"\n",
"lo",
".",
"G",
".",
"Infof",
"(",
"\"",
"\"",
",",
"input",
".",
"Org",
",",
"space",
".",
"Name",
",",
"input",
".",
"AllowSSHUntil",
")",
"\n",
"if",
"err",
":=",
"m",
".",
"UpdateSpaceSSH",
"(",
"false",
",",
"space",
",",
"input",
".",
"Org",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"else",
"{",
"if",
"input",
".",
"AllowSSH",
"!=",
"space",
".",
"AllowSSH",
"{",
"if",
"m",
".",
"Peek",
"{",
"lo",
".",
"G",
".",
"Infof",
"(",
"\"",
"\"",
",",
"input",
".",
"AllowSSH",
",",
"input",
".",
"Org",
",",
"space",
".",
"Name",
")",
"\n",
"continue",
"\n",
"}",
"\n",
"lo",
".",
"G",
".",
"Infof",
"(",
"\"",
"\"",
",",
"input",
".",
"AllowSSH",
",",
"input",
".",
"Org",
",",
"space",
".",
"Name",
")",
"\n",
"if",
"err",
":=",
"m",
".",
"UpdateSpaceSSH",
"(",
"input",
".",
"AllowSSH",
",",
"space",
",",
"input",
".",
"Org",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n",
"m",
".",
"spaces",
"=",
"nil",
"\n",
"return",
"nil",
"\n",
"}"
] |
5,224 | all-5225 | [
"MarshalJSON",
"supports",
"json",
".",
"Marshaler",
"interface"
] | [
"func",
"(",
"v",
"PrivatePropertyDescriptor",
")",
"MarshalJSON",
"(",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"w",
":=",
"jwriter",
".",
"<mask>",
"{",
"}",
"\n",
"easyjsonC5a4559bEncodeGithubComChromedpCdprotoRuntime16",
"(",
"&",
"w",
",",
"v",
")",
"\n",
"return",
"w",
".",
"Buffer",
".",
"BuildBytes",
"(",
")",
",",
"w",
".",
"Error",
"\n",
"}"
] |
5,225 | all-5226 | [
"findTeam",
"returns",
"teams",
"[",
"n",
"]",
"for",
"the",
"first",
"n",
"in",
"[",
"name",
"previousNames",
"...",
"]",
"that",
"is",
"in",
"teams",
"."
] | [
"func",
"findTeam",
"(",
"teams",
"map",
"[",
"string",
"]",
"github",
".",
"Team",
",",
"name",
"string",
",",
"previousNames",
"...",
"string",
")",
"*",
"github",
".",
"Team",
"{",
"if",
"t",
",",
"ok",
":=",
"teams",
"[",
"<mask>",
"]",
";",
"ok",
"{",
"return",
"&",
"t",
"\n",
"}",
"\n",
"for",
"_",
",",
"p",
":=",
"range",
"previousNames",
"{",
"if",
"t",
",",
"ok",
":=",
"teams",
"[",
"p",
"]",
";",
"ok",
"{",
"return",
"&",
"t",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
] |
5,226 | all-5227 | [
"ChangeHSV",
"changes",
"HSV",
"(",
"Hue",
"-",
"Saturation",
"-",
"Value",
")",
"elements",
".",
"hueTheta",
"is",
"a",
"radian",
"value",
"to",
"ratate",
"hue",
".",
"saturationScale",
"is",
"a",
"value",
"to",
"scale",
"saturation",
".",
"valueScale",
"is",
"a",
"value",
"to",
"scale",
"value",
"(",
"a",
".",
"k",
".",
"a",
".",
"brightness",
")",
".",
"This",
"conversion",
"uses",
"RGB",
"to",
"/",
"from",
"YCrCb",
"conversion",
"."
] | [
"func",
"(",
"c",
"*",
"ColorM",
")",
"ChangeHSV",
"(",
"hueTheta",
"float64",
",",
"saturationScale",
"float32",
",",
"valueScale",
"float32",
")",
"*",
"ColorM",
"{",
"sin",
",",
"cos",
":=",
"math",
".",
"Sincos",
"(",
"hueTheta",
")",
"\n",
"s32",
",",
"c32",
":=",
"float32",
"(",
"<mask>",
")",
",",
"float32",
"(",
"cos",
")",
"\n",
"c",
"=",
"c",
".",
"Concat",
"(",
"rgbToYCbCr",
")",
"\n",
"c",
"=",
"c",
".",
"Concat",
"(",
"&",
"ColorM",
"{",
"body",
":",
"[",
"]",
"float32",
"{",
"1",
",",
"0",
",",
"0",
",",
"0",
",",
"0",
",",
"c32",
",",
"s32",
",",
"0",
",",
"0",
",",
"-",
"s32",
",",
"c32",
",",
"0",
",",
"0",
",",
"0",
",",
"0",
",",
"1",
",",
"}",
",",
"}",
")",
"\n",
"s",
":=",
"saturationScale",
"\n",
"v",
":=",
"valueScale",
"\n",
"c",
"=",
"c",
".",
"Scale",
"(",
"v",
",",
"s",
"*",
"v",
",",
"s",
"*",
"v",
",",
"1",
")",
"\n",
"c",
"=",
"c",
".",
"Concat",
"(",
"yCbCrToRgb",
")",
"\n",
"return",
"c",
"\n",
"}"
] |
5,227 | all-5228 | [
"UnmarshalEasyJSON",
"satisfies",
"easyjson",
".",
"Unmarshaler",
"."
] | [
"func",
"(",
"t",
"*",
"OrientationType",
")",
"UnmarshalEasyJSON",
"(",
"in",
"*",
"jlexer",
".",
"Lexer",
")",
"{",
"switch",
"OrientationType",
"(",
"in",
".",
"String",
"(",
")",
")",
"{",
"case",
"OrientationTypePortraitPrimary",
":",
"*",
"t",
"=",
"OrientationTypePortraitPrimary",
"\n",
"case",
"OrientationTypePortraitSecondary",
":",
"*",
"t",
"=",
"OrientationTypePortraitSecondary",
"\n",
"<mask>",
"OrientationTypeLandscapePrimary",
":",
"*",
"t",
"=",
"OrientationTypeLandscapePrimary",
"\n",
"case",
"OrientationTypeLandscapeSecondary",
":",
"*",
"t",
"=",
"OrientationTypeLandscapeSecondary",
"\n\n",
"default",
":",
"in",
".",
"AddError",
"(",
"errors",
".",
"New",
"(",
"\"",
"\"",
")",
")",
"\n",
"}",
"\n",
"}"
] |
5,228 | all-5229 | [
"Delete",
"deletes",
"a",
"vsphere_virtual_machine",
"cdrom",
"sub",
"-",
"resource",
"."
] | [
"func",
"(",
"r",
"*",
"CdromSubresource",
")",
"Delete",
"(",
"l",
"object",
".",
"VirtualDeviceList",
")",
"(",
"[",
"]",
"types",
".",
"BaseVirtualDeviceConfigSpec",
",",
"error",
")",
"{",
"log",
".",
"Printf",
"(",
"\"",
"\"",
",",
"r",
")",
"\n",
"d",
",",
"err",
":=",
"r",
".",
"FindVirtualDevice",
"(",
"l",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"}",
"\n",
"<mask>",
",",
"ok",
":=",
"d",
".",
"(",
"*",
"types",
".",
"VirtualCdrom",
")",
"\n",
"if",
"!",
"ok",
"{",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"l",
".",
"Name",
"(",
"d",
")",
")",
"\n",
"}",
"\n",
"deleteSpec",
",",
"err",
":=",
"object",
".",
"VirtualDeviceList",
"{",
"device",
"}",
".",
"ConfigSpec",
"(",
"types",
".",
"VirtualDeviceConfigSpecOperationRemove",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"log",
".",
"Printf",
"(",
"\"",
"\"",
",",
"r",
",",
"DeviceChangeString",
"(",
"deleteSpec",
")",
")",
"\n",
"log",
".",
"Printf",
"(",
"\"",
"\"",
",",
"r",
")",
"\n",
"return",
"deleteSpec",
",",
"nil",
"\n",
"}"
] |
5,229 | all-5230 | [
"Orchestrate",
"runs",
"Stream",
".",
"It",
"picks",
"up",
"ranges",
"from",
"the",
"SSTables",
"then",
"runs",
"NumGo",
"number",
"of",
"goroutines",
"to",
"iterate",
"over",
"these",
"ranges",
"and",
"batch",
"up",
"KVs",
"in",
"lists",
".",
"It",
"concurrently",
"runs",
"a",
"single",
"goroutine",
"to",
"pick",
"these",
"lists",
"batch",
"them",
"up",
"further",
"and",
"send",
"to",
"Output",
".",
"Send",
".",
"Orchestrate",
"also",
"spits",
"logs",
"out",
"to",
"Infof",
"using",
"provided",
"LogPrefix",
".",
"Note",
"that",
"all",
"calls",
"to",
"Output",
".",
"Send",
"are",
"serial",
".",
"In",
"case",
"any",
"of",
"these",
"steps",
"encounter",
"an",
"error",
"Orchestrate",
"would",
"stop",
"execution",
"and",
"return",
"that",
"error",
".",
"Orchestrate",
"can",
"be",
"called",
"multiple",
"times",
"but",
"in",
"serial",
"order",
"."
] | [
"func",
"(",
"st",
"*",
"Stream",
")",
"Orchestrate",
"(",
"ctx",
"context",
".",
"Context",
")",
"error",
"{",
"st",
".",
"rangeCh",
"=",
"make",
"(",
"chan",
"keyRange",
",",
"3",
")",
"// Contains keys for posting lists.",
"\n\n",
"// kvChan should only have a small capacity to ensure that we don't buffer up too much data if",
"// sending is slow. Page size is set to 4MB, which is used to lazily cap the size of each",
"// KVList. To get around 64MB buffer, we can set the channel size to 16.",
"st",
".",
"kvChan",
"=",
"make",
"(",
"chan",
"*",
"pb",
".",
"KVList",
",",
"16",
")",
"\n\n",
"if",
"st",
".",
"KeyToList",
"==",
"nil",
"{",
"st",
".",
"KeyToList",
"=",
"st",
".",
"ToList",
"\n",
"}",
"\n\n",
"// Picks up ranges from Badger, and sends them to rangeCh.",
"go",
"st",
".",
"produceRanges",
"(",
"ctx",
")",
"\n\n",
"errCh",
":=",
"make",
"(",
"chan",
"error",
",",
"1",
")",
"// Stores error by consumeKeys.",
"\n",
"var",
"wg",
"sync",
".",
"WaitGroup",
"\n",
"for",
"i",
":=",
"0",
";",
"i",
"<",
"st",
".",
"NumGo",
";",
"i",
"++",
"{",
"wg",
".",
"Add",
"(",
"1",
")",
"\n",
"go",
"func",
"(",
")",
"{",
"defer",
"wg",
".",
"Done",
"(",
")",
"\n",
"// Picks up ranges from rangeCh, generates KV lists, and sends them to kvChan.",
"if",
"err",
":=",
"st",
".",
"produceKVs",
"(",
"ctx",
")",
";",
"err",
"!=",
"nil",
"{",
"select",
"{",
"case",
"errCh",
"<-",
"err",
":",
"default",
":",
"}",
"\n",
"}",
"\n",
"}",
"(",
")",
"\n",
"}",
"\n\n",
"// Pick up key-values from kvChan and send to stream.",
"kvErr",
":=",
"make",
"(",
"chan",
"error",
",",
"1",
")",
"\n",
"<mask>",
"func",
"(",
")",
"{",
"// Picks up KV lists from kvChan, and sends them to Output.",
"kvErr",
"<-",
"st",
".",
"streamKVs",
"(",
"ctx",
")",
"\n",
"}",
"(",
")",
"\n",
"wg",
".",
"Wait",
"(",
")",
"// Wait for produceKVs to be over.",
"\n",
"close",
"(",
"st",
".",
"kvChan",
")",
"// Now we can close kvChan.",
"\n\n",
"select",
"{",
"case",
"err",
":=",
"<-",
"errCh",
":",
"// Check error from produceKVs.",
"return",
"err",
"\n",
"default",
":",
"}",
"\n\n",
"// Wait for key streaming to be over.",
"err",
":=",
"<-",
"kvErr",
"\n",
"return",
"err",
"\n",
"}"
] |
5,230 | all-5231 | [
"Service",
"returns",
"the",
"goa",
".",
"v2",
"service"
] | [
"func",
"(",
"ep",
"*",
"Endpoint",
")",
"<mask>",
"(",
")",
"string",
"{",
"if",
"len",
"(",
"ep",
".",
"Tags",
")",
">",
"0",
"{",
"return",
"ep",
".",
"Tags",
"[",
"0",
"]",
"\n",
"}",
"\n",
"if",
"len",
"(",
"ep",
".",
"OperationID",
")",
">",
"0",
"{",
"return",
"strings",
".",
"Split",
"(",
"ep",
".",
"OperationID",
",",
"\"",
"\"",
")",
"[",
"0",
"]",
"\n",
"}",
"\n",
"return",
"\"",
"\"",
"\n",
"}"
] |
5,231 | all-5232 | [
"RevParse",
"does",
"git",
"rev",
"-",
"parse",
"."
] | [
"func",
"(",
"lg",
"*",
"LocalGit",
")",
"RevParse",
"(",
"org",
",",
"repo",
",",
"commitlike",
"<mask>",
")",
"(",
"string",
",",
"error",
")",
"{",
"rdir",
":=",
"filepath",
".",
"Join",
"(",
"lg",
".",
"Dir",
",",
"org",
",",
"repo",
")",
"\n",
"return",
"runCmdOutput",
"(",
"lg",
".",
"Git",
",",
"rdir",
",",
"\"",
"\"",
",",
"commitlike",
")",
"\n",
"}"
] |
5,232 | all-5233 | [
"IsHidden",
"function",
"checks",
"if",
"the",
"node",
"is",
"a",
"hidden",
"node",
".",
"A",
"hidden",
"node",
"will",
"begin",
"with",
"_",
"A",
"hidden",
"node",
"will",
"not",
"be",
"shown",
"via",
"get",
"command",
"under",
"a",
"directory",
"For",
"example",
"if",
"we",
"have",
"/",
"foo",
"/",
"_hidden",
"and",
"/",
"foo",
"/",
"notHidden",
"get",
"/",
"foo",
"will",
"only",
"return",
"/",
"foo",
"/",
"notHidden"
] | [
"func",
"(",
"n",
"*",
"node",
")",
"IsHidden",
"(",
")",
"bool",
"{",
"_",
",",
"name",
":=",
"path",
".",
"Split",
"(",
"n",
".",
"<mask>",
")",
"\n\n",
"return",
"name",
"[",
"0",
"]",
"==",
"'_'",
"\n",
"}"
] |
5,233 | all-5234 | [
"HasMessage",
"returns",
"a",
"boolean",
"if",
"a",
"field",
"has",
"been",
"set",
"."
] | [
"func",
"(",
"c",
"*",
"Check",
")",
"HasMessage",
"(",
")",
"bool",
"{",
"if",
"c",
"!=",
"nil",
"&&",
"c",
".",
"<mask>",
"!=",
"nil",
"{",
"return",
"true",
"\n",
"}",
"\n\n",
"return",
"false",
"\n",
"}"
] |
5,234 | all-5235 | [
"GetApprovers",
"returns",
"a",
"map",
"from",
"ownersFiles",
"-",
">",
"people",
"that",
"are",
"approvers",
"in",
"them"
] | [
"func",
"(",
"o",
"Owners",
")",
"GetApprovers",
"(",
")",
"map",
"[",
"string",
"]",
"sets",
".",
"<mask>",
"{",
"ownersToApprovers",
":=",
"map",
"[",
"string",
"]",
"sets",
".",
"String",
"{",
"}",
"\n\n",
"for",
"fn",
":=",
"range",
"o",
".",
"GetOwnersSet",
"(",
")",
"{",
"ownersToApprovers",
"[",
"fn",
"]",
"=",
"o",
".",
"repo",
".",
"Approvers",
"(",
"fn",
")",
"\n",
"}",
"\n\n",
"return",
"ownersToApprovers",
"\n",
"}"
] |
5,235 | all-5236 | [
"EtcdDeployment",
"returns",
"an",
"etcd",
"k8s",
"Deployment",
"."
] | [
"func",
"EtcdDeployment",
"(",
"opts",
"*",
"AssetOpts",
",",
"hostPath",
"string",
")",
"*",
"apps",
".",
"Deployment",
"{",
"cpu",
":=",
"resource",
".",
"MustParse",
"(",
"opts",
".",
"EtcdCPURequest",
")",
"\n",
"mem",
":=",
"<mask>",
".",
"MustParse",
"(",
"opts",
".",
"EtcdMemRequest",
")",
"\n",
"var",
"volumes",
"[",
"]",
"v1",
".",
"Volume",
"\n",
"if",
"hostPath",
"==",
"\"",
"\"",
"{",
"volumes",
"=",
"[",
"]",
"v1",
".",
"Volume",
"{",
"{",
"Name",
":",
"\"",
"\"",
",",
"VolumeSource",
":",
"v1",
".",
"VolumeSource",
"{",
"PersistentVolumeClaim",
":",
"&",
"v1",
".",
"PersistentVolumeClaimVolumeSource",
"{",
"ClaimName",
":",
"etcdVolumeClaimName",
",",
"}",
",",
"}",
",",
"}",
",",
"}",
"\n",
"}",
"else",
"{",
"volumes",
"=",
"[",
"]",
"v1",
".",
"Volume",
"{",
"{",
"Name",
":",
"\"",
"\"",
",",
"VolumeSource",
":",
"v1",
".",
"VolumeSource",
"{",
"HostPath",
":",
"&",
"v1",
".",
"HostPathVolumeSource",
"{",
"Path",
":",
"filepath",
".",
"Join",
"(",
"hostPath",
",",
"\"",
"\"",
")",
",",
"}",
",",
"}",
",",
"}",
",",
"}",
"\n",
"}",
"\n",
"resourceRequirements",
":=",
"v1",
".",
"ResourceRequirements",
"{",
"Requests",
":",
"v1",
".",
"ResourceList",
"{",
"v1",
".",
"ResourceCPU",
":",
"cpu",
",",
"v1",
".",
"ResourceMemory",
":",
"mem",
",",
"}",
",",
"}",
"\n",
"if",
"!",
"opts",
".",
"NoGuaranteed",
"{",
"resourceRequirements",
".",
"Limits",
"=",
"v1",
".",
"ResourceList",
"{",
"v1",
".",
"ResourceCPU",
":",
"cpu",
",",
"v1",
".",
"ResourceMemory",
":",
"mem",
",",
"}",
"\n",
"}",
"\n",
"// Don't want to strip the registry out of etcdImage since it's from quay",
"// not docker hub.",
"image",
":=",
"etcdImage",
"\n",
"if",
"opts",
".",
"Registry",
"!=",
"\"",
"\"",
"{",
"image",
"=",
"AddRegistry",
"(",
"opts",
".",
"Registry",
",",
"etcdImage",
")",
"\n",
"}",
"\n",
"return",
"&",
"apps",
".",
"Deployment",
"{",
"TypeMeta",
":",
"metav1",
".",
"TypeMeta",
"{",
"Kind",
":",
"\"",
"\"",
",",
"APIVersion",
":",
"\"",
"\"",
",",
"}",
",",
"ObjectMeta",
":",
"objectMeta",
"(",
"etcdName",
",",
"labels",
"(",
"etcdName",
")",
",",
"nil",
",",
"opts",
".",
"Namespace",
")",
",",
"Spec",
":",
"apps",
".",
"DeploymentSpec",
"{",
"Replicas",
":",
"replicas",
"(",
"1",
")",
",",
"Selector",
":",
"&",
"metav1",
".",
"LabelSelector",
"{",
"MatchLabels",
":",
"labels",
"(",
"etcdName",
")",
",",
"}",
",",
"Template",
":",
"v1",
".",
"PodTemplateSpec",
"{",
"ObjectMeta",
":",
"objectMeta",
"(",
"etcdName",
",",
"labels",
"(",
"etcdName",
")",
",",
"nil",
",",
"opts",
".",
"Namespace",
")",
",",
"Spec",
":",
"v1",
".",
"PodSpec",
"{",
"Containers",
":",
"[",
"]",
"v1",
".",
"Container",
"{",
"{",
"Name",
":",
"etcdName",
",",
"Image",
":",
"image",
",",
"//TODO figure out how to get a cluster of these to talk to each other",
"Command",
":",
"etcdCmd",
",",
"Ports",
":",
"[",
"]",
"v1",
".",
"ContainerPort",
"{",
"{",
"ContainerPort",
":",
"2379",
",",
"Name",
":",
"\"",
"\"",
",",
"}",
",",
"{",
"ContainerPort",
":",
"2380",
",",
"Name",
":",
"\"",
"\"",
",",
"}",
",",
"}",
",",
"VolumeMounts",
":",
"[",
"]",
"v1",
".",
"VolumeMount",
"{",
"{",
"Name",
":",
"\"",
"\"",
",",
"MountPath",
":",
"\"",
"\"",
",",
"}",
",",
"}",
",",
"ImagePullPolicy",
":",
"\"",
"\"",
",",
"Resources",
":",
"resourceRequirements",
",",
"}",
",",
"}",
",",
"Volumes",
":",
"volumes",
",",
"ImagePullSecrets",
":",
"imagePullSecrets",
"(",
"opts",
")",
",",
"}",
",",
"}",
",",
"}",
",",
"}",
"\n",
"}"
] |
5,236 | all-5237 | [
"Reticence",
"trucate",
"the",
"string",
"in",
"the",
"space",
"or",
"on",
"pontuation",
"mark",
"and",
"put",
"reticences",
"in",
"the",
"resulting",
"string",
"."
] | [
"func",
"Reticence",
"(",
"str",
"string",
",",
"length",
"int",
")",
"string",
"{",
"if",
"length",
">",
"len",
"(",
"str",
")",
"{",
"return",
"str",
"\n",
"}",
"\n",
"var",
"i",
"int",
"\n",
"F",
":",
"for",
"i",
"=",
"len",
"(",
"str",
")",
"-",
"1",
";",
"i",
">=",
"0",
";",
"i",
"--",
"{",
"<mask>",
"str",
"[",
"i",
"]",
"{",
"case",
"' '",
",",
"','",
",",
"'?'",
",",
"';'",
",",
"':'",
",",
"'\\''",
",",
"'\"'",
",",
"'!'",
":",
"if",
"i",
"<=",
"length",
"{",
"break",
"F",
"\n",
"}",
"\n",
"case",
"'.'",
":",
"if",
"i",
"-",
"2",
">=",
"0",
"{",
"s",
":=",
"str",
"[",
"i",
"-",
"2",
":",
"i",
"]",
"\n",
"if",
"s",
"==",
"\"",
"\"",
"{",
"i",
"=",
"i",
"-",
"2",
"\n",
"if",
"i",
"<=",
"length",
"{",
"break",
"F",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n",
"if",
"i",
"<=",
"length",
"{",
"break",
"F",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n",
"if",
"i",
"-",
"1",
">",
"0",
"{",
"switch",
"str",
"[",
"i",
"-",
"1",
"]",
"{",
"case",
"' '",
",",
"','",
",",
"'?'",
",",
"';'",
",",
"':'",
",",
"'\\''",
",",
"'\"'",
",",
"'!'",
":",
"i",
"--",
"\n",
"case",
"'.'",
":",
"if",
"i",
"-",
"2",
">",
"0",
"&&",
"str",
"[",
"i",
"-",
"2",
":",
"i",
"]",
"==",
"\"",
"\"",
"{",
"i",
"-=",
"3",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n",
"if",
"i",
">=",
"2",
"{",
"if",
"i",
"+",
"3",
">=",
"len",
"(",
"str",
")",
"{",
"return",
"str",
"\n",
"}",
"\n",
"return",
"str",
"[",
":",
"i",
"]",
"+",
"\"",
"\"",
"\n",
"}",
"\n",
"if",
"length",
">=",
"2",
"&&",
"length",
"<",
"len",
"(",
"str",
")",
"{",
"if",
"length",
"+",
"3",
">=",
"len",
"(",
"str",
")",
"{",
"return",
"str",
"\n",
"}",
"\n",
"return",
"str",
"[",
":",
"length",
"]",
"+",
"\"",
"\"",
"\n",
"}",
"\n",
"return",
"str",
"\n",
"}"
] |
5,237 | all-5238 | [
"GetData",
"retrieves",
"the",
"Data",
"value",
"from",
"the",
"union",
"returning",
"ok",
"if",
"the",
"union",
"s",
"switch",
"indicated",
"the",
"value",
"is",
"valid",
"."
] | [
"func",
"(",
"u",
"LedgerKey",
")",
"GetData",
"(",
")",
"(",
"result",
"LedgerKeyData",
",",
"ok",
"bool",
")",
"{",
"armName",
",",
"_",
":=",
"u",
".",
"ArmForSwitch",
"(",
"int32",
"(",
"u",
".",
"Type",
")",
")",
"\n\n",
"if",
"armName",
"==",
"\"",
"\"",
"{",
"result",
"=",
"*",
"u",
".",
"Data",
"\n",
"<mask>",
"=",
"true",
"\n",
"}",
"\n\n",
"return",
"\n",
"}"
] |
5,238 | all-5239 | [
"GetEnv",
"returns",
"the",
"Env",
"field",
"if",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"."
] | [
"func",
"(",
"t",
"*",
"TraceServiceDefinition",
")",
"GetEnv",
"(",
")",
"<mask>",
"{",
"if",
"t",
"==",
"nil",
"||",
"t",
".",
"Env",
"==",
"nil",
"{",
"return",
"\"",
"\"",
"\n",
"}",
"\n",
"return",
"*",
"t",
".",
"Env",
"\n",
"}"
] |
5,239 | all-5240 | [
"GetPeers",
"retrieves",
"the",
"Peers",
"value",
"from",
"the",
"union",
"returning",
"ok",
"if",
"the",
"union",
"s",
"switch",
"indicated",
"the",
"value",
"is",
"valid",
"."
] | [
"func",
"(",
"u",
"StellarMessage",
")",
"GetPeers",
"(",
")",
"(",
"result",
"[",
"]",
"PeerAddress",
",",
"<mask>",
"bool",
")",
"{",
"armName",
",",
"_",
":=",
"u",
".",
"ArmForSwitch",
"(",
"int32",
"(",
"u",
".",
"Type",
")",
")",
"\n\n",
"if",
"armName",
"==",
"\"",
"\"",
"{",
"result",
"=",
"*",
"u",
".",
"Peers",
"\n",
"ok",
"=",
"true",
"\n",
"}",
"\n\n",
"return",
"\n",
"}"
] |
5,240 | all-5241 | [
"Run",
"will",
"authorize",
"immediately",
"and",
"return",
"the",
"provided",
"list",
"of",
"enforcers",
"."
] | [
"func",
"Run",
"(",
"enforcers",
"...",
"*",
"Enforcer",
")",
"*",
"Authorizer",
"{",
"return",
"A",
"(",
"\"",
"\"",
",",
"fire",
".",
"All",
"(",
")",
",",
"func",
"(",
"ctx",
"*",
"fire",
".",
"<mask>",
")",
"(",
"[",
"]",
"*",
"Enforcer",
",",
"error",
")",
"{",
"return",
"enforcers",
",",
"nil",
"\n",
"}",
")",
"\n",
"}"
] |
5,241 | all-5242 | [
"handleSAMLResponse",
"is",
"the",
"HTTP",
"handler",
"for",
"Pachyderm",
"s",
"ACS",
"which",
"receives",
"signed",
"SAML",
"assertions",
"from",
"this",
"cluster",
"s",
"SAML",
"ID",
"provider",
"(",
"if",
"one",
"is",
"configured",
")"
] | [
"func",
"(",
"a",
"*",
"apiServer",
")",
"handleSAMLResponse",
"(",
"w",
"http",
".",
"ResponseWriter",
",",
"req",
"*",
"http",
".",
"Request",
")",
"{",
"var",
"subject",
",",
"authCode",
"string",
"\n",
"var",
"err",
"*",
"errutil",
".",
"HTTPError",
"\n\n",
"logRequest",
":=",
"\"",
"\"",
"\n",
"a",
".",
"LogReq",
"(",
"logRequest",
")",
"\n",
"defer",
"func",
"(",
"start",
"time",
".",
"Time",
")",
"{",
"if",
"subject",
"!=",
"\"",
"\"",
"{",
"logRequest",
"=",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"subject",
")",
"\n",
"}",
"\n",
"a",
".",
"LogResp",
"(",
"logRequest",
",",
"errutil",
".",
"PrettyPrintCode",
"(",
"err",
")",
",",
"err",
",",
"time",
".",
"Since",
"(",
"start",
")",
")",
"\n",
"}",
"(",
"time",
".",
"Now",
"(",
")",
")",
"\n\n",
"subject",
",",
"authCode",
",",
"err",
"=",
"a",
".",
"handleSAMLResponseInternal",
"(",
"req",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"<mask>",
".",
"Error",
"(",
"w",
",",
"err",
".",
"Error",
"(",
")",
",",
"err",
".",
"Code",
"(",
")",
")",
"\n",
"return",
"\n",
"}",
"\n\n",
"// Redirect caller back to dash with auth code",
"u",
":=",
"*",
"defaultDashRedirectURL",
"\n",
"if",
"a",
".",
"redirectAddress",
"!=",
"nil",
"{",
"u",
"=",
"*",
"a",
".",
"redirectAddress",
"\n",
"}",
"\n",
"u",
".",
"RawQuery",
"=",
"url",
".",
"Values",
"{",
"\"",
"\"",
":",
"[",
"]",
"string",
"{",
"authCode",
"}",
"}",
".",
"Encode",
"(",
")",
"\n",
"w",
".",
"Header",
"(",
")",
".",
"Set",
"(",
"\"",
"\"",
",",
"u",
".",
"String",
"(",
")",
")",
"\n",
"w",
".",
"WriteHeader",
"(",
"http",
".",
"StatusFound",
")",
"// Send redirect",
"\n",
"}"
] |
5,242 | all-5243 | [
"NewPlayer",
"creates",
"a",
"new",
"player",
"with",
"the",
"given",
"stream",
".",
"src",
"s",
"format",
"must",
"be",
"linear",
"PCM",
"(",
"16bits",
"little",
"endian",
"2",
"channel",
"stereo",
")",
"without",
"a",
"header",
"(",
"e",
".",
"g",
".",
"RIFF",
"header",
")",
".",
"The",
"sample",
"rate",
"must",
"be",
"same",
"as",
"that",
"of",
"the",
"audio",
"context",
".",
"The",
"player",
"is",
"seekable",
"when",
"src",
"is",
"io",
".",
"Seeker",
".",
"Attempt",
"to",
"seek",
"the",
"player",
"that",
"is",
"not",
"io",
".",
"Seeker",
"causes",
"panic",
".",
"Note",
"that",
"the",
"given",
"src",
"can",
"t",
"be",
"shared",
"with",
"other",
"Player",
"objects",
".",
"NewPlayer",
"tries",
"to",
"call",
"Seek",
"of",
"src",
"to",
"get",
"the",
"current",
"position",
".",
"NewPlayer",
"returns",
"error",
"when",
"the",
"Seek",
"returns",
"error",
".",
"NewPlayer",
"takes",
"the",
"ownership",
"of",
"src",
".",
"Player",
"s",
"Close",
"calls",
"src",
"s",
"Close",
"."
] | [
"func",
"NewPlayer",
"(",
"context",
"*",
"Context",
",",
"src",
"io",
".",
"ReadCloser",
")",
"(",
"*",
"Player",
",",
"error",
")",
"{",
"p",
":=",
"&",
"Player",
"{",
"&",
"playerImpl",
"{",
"context",
":",
"context",
",",
"src",
":",
"src",
",",
"sampleRate",
":",
"context",
".",
"sampleRate",
",",
"volume",
":",
"1",
",",
"}",
",",
"}",
"\n",
"if",
"seeker",
",",
"ok",
":=",
"p",
".",
"p",
".",
"src",
".",
"(",
"io",
".",
"Seeker",
")",
";",
"ok",
"{",
"// Get the current position of the source.",
"pos",
",",
"err",
":=",
"seeker",
".",
"Seek",
"(",
"0",
",",
"io",
".",
"SeekCurrent",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"p",
".",
"p",
".",
"pos",
"=",
"<mask>",
"\n",
"}",
"\n",
"runtime",
".",
"SetFinalizer",
"(",
"p",
",",
"(",
"*",
"Player",
")",
".",
"finalize",
")",
"\n\n",
"return",
"p",
",",
"nil",
"\n",
"}"
] |
5,243 | all-5244 | [
"HasStyle",
"returns",
"a",
"boolean",
"if",
"a",
"field",
"has",
"been",
"set",
"."
] | [
"func",
"(",
"t",
"*",
"TileDef",
")",
"HasStyle",
"(",
")",
"bool",
"{",
"if",
"t",
"!=",
"nil",
"&&",
"t",
".",
"Style",
"!=",
"nil",
"{",
"return",
"<mask>",
"\n",
"}",
"\n\n",
"return",
"false",
"\n",
"}"
] |
5,244 | all-5245 | [
"EqualOneOf",
"checks",
"if",
"a",
"value",
"is",
"equal",
"to",
"one",
"of",
"the",
"elements",
"of",
"a",
"slice",
".",
"Note",
"that",
"if",
"expecteds",
"and",
"actual",
"are",
"a",
"slice",
"of",
"pointers",
"and",
"a",
"pointer",
"respectively",
"then",
"the",
"pointers",
"are",
"unwrapped",
"before",
"comparison",
"(",
"so",
"this",
"functions",
"works",
"for",
"e",
".",
"g",
".",
"*",
"pfs",
".",
"Commit",
"and",
"[]",
"*",
"pfs",
".",
"Commit",
")"
] | [
"func",
"EqualOneOf",
"(",
"tb",
"testing",
".",
"TB",
",",
"expecteds",
"interface",
"{",
"}",
",",
"<mask>",
"interface",
"{",
"}",
",",
"msgAndArgs",
"...",
"interface",
"{",
"}",
")",
"{",
"tb",
".",
"Helper",
"(",
")",
"\n",
"equal",
",",
"err",
":=",
"oneOfEquals",
"(",
"\"",
"\"",
",",
"expecteds",
",",
"actual",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"fatal",
"(",
"tb",
",",
"msgAndArgs",
",",
"err",
".",
"Error",
"(",
")",
")",
"\n",
"}",
"\n",
"if",
"!",
"equal",
"{",
"fatal",
"(",
"tb",
",",
"msgAndArgs",
",",
"\"",
"\\n",
"\"",
"+",
"\"",
"\"",
",",
"expecteds",
",",
"actual",
")",
"\n",
"}",
"\n",
"}"
] |
5,245 | all-5246 | [
"URL",
"returns",
"the",
"Docker",
"host",
"URL"
] | [
"func",
"(",
"rd",
"*",
"RemoteDocker",
")",
"<mask>",
"(",
")",
"(",
"string",
",",
"error",
")",
"{",
"if",
"rd",
".",
"HostURL",
"==",
"\"",
"\"",
"{",
"return",
"\"",
"\"",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"return",
"rd",
".",
"HostURL",
",",
"nil",
"\n",
"}"
] |
5,246 | all-5247 | [
"Relay",
"all",
"pending",
"gossip",
"data",
"for",
"each",
"channel",
"via",
"conn",
"."
] | [
"func",
"(",
"router",
"*",
"Router",
")",
"sendAllGossipDown",
"(",
"conn",
"<mask>",
")",
"{",
"for",
"channel",
":=",
"range",
"router",
".",
"gossipChannelSet",
"(",
")",
"{",
"if",
"gossip",
":=",
"channel",
".",
"gossiper",
".",
"Gossip",
"(",
")",
";",
"gossip",
"!=",
"nil",
"{",
"channel",
".",
"SendDown",
"(",
"conn",
",",
"gossip",
")",
"\n",
"}",
"\n",
"}",
"\n",
"}"
] |
5,247 | all-5248 | [
"dispatchInbound",
"ispatches",
"an",
"inbound",
"call",
"to",
"the",
"appropriate",
"handler"
] | [
"func",
"(",
"c",
"*",
"Connection",
")",
"dispatchInbound",
"(",
"_",
"uint32",
",",
"_",
"uint32",
",",
"call",
"*",
"InboundCall",
",",
"frame",
"*",
"Frame",
")",
"{",
"if",
"call",
".",
"log",
".",
"Enabled",
"(",
"LogLevelDebug",
")",
"{",
"call",
".",
"log",
".",
"Debugf",
"(",
"\"",
"\"",
",",
"call",
".",
"ServiceName",
"(",
")",
",",
"c",
".",
"remotePeerInfo",
")",
"\n",
"}",
"\n\n",
"if",
"err",
":=",
"call",
".",
"readMethod",
"(",
")",
";",
"err",
"!=",
"nil",
"{",
"call",
".",
"log",
".",
"WithFields",
"(",
"LogField",
"{",
"\"",
"\"",
",",
"c",
".",
"remotePeerInfo",
"}",
",",
"ErrField",
"(",
"err",
")",
",",
")",
".",
"Error",
"(",
"\"",
"\"",
")",
"\n",
"c",
".",
"opts",
".",
"FramePool",
".",
"Release",
"(",
"frame",
")",
"\n",
"return",
"\n",
"}",
"\n\n",
"call",
".",
"commonStatsTags",
"[",
"\"",
"\"",
"]",
"=",
"call",
".",
"methodString",
"\n",
"call",
".",
"statsReporter",
".",
"IncCounter",
"(",
"\"",
"\"",
",",
"call",
".",
"commonStatsTags",
",",
"1",
")",
"\n",
"if",
"span",
":=",
"call",
".",
"response",
".",
"span",
";",
"span",
"!=",
"nil",
"{",
"span",
".",
"SetOperationName",
"(",
"call",
".",
"methodString",
")",
"\n",
"}",
"\n\n",
"// TODO(prashant): This is an expensive way to check for cancellation. Use a heap for timeouts.",
"go",
"func",
"(",
")",
"{",
"select",
"{",
"case",
"<-",
"call",
".",
"mex",
".",
"ctx",
".",
"Done",
"(",
")",
":",
"// checking if message exchange timedout or was cancelled",
"// only two possible errors at this step:",
"// context.DeadlineExceeded",
"// context.Canceled",
"if",
"call",
".",
"mex",
".",
"ctx",
".",
"Err",
"(",
")",
"!=",
"nil",
"{",
"call",
".",
"mex",
".",
"inboundExpired",
"(",
")",
"\n",
"}",
"\n",
"case",
"<-",
"call",
".",
"mex",
".",
"errCh",
".",
"c",
":",
"if",
"c",
".",
"log",
".",
"Enabled",
"(",
"LogLevelDebug",
")",
"{",
"call",
".",
"log",
".",
"Debugf",
"(",
"\"",
"\"",
",",
"call",
".",
"mex",
".",
"errCh",
".",
"err",
")",
"\n",
"}",
"\n",
"// when an exchange errors out, mark the exchange as expired",
"// and call cancel so the server handler's context is canceled",
"// TODO: move the cancel to the parent context at connnection level",
"call",
".",
"response",
".",
"cancel",
"(",
")",
"\n",
"call",
".",
"mex",
".",
"inboundExpired",
"(",
")",
"\n",
"}",
"\n",
"}",
"(",
")",
"\n\n",
"c",
".",
"handler",
".",
"Handle",
"(",
"<mask>",
".",
"mex",
".",
"ctx",
",",
"call",
")",
"\n",
"}"
] |
5,248 | all-5249 | [
"GetComparator",
"returns",
"the",
"Comparator",
"field",
"if",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"."
] | [
"func",
"(",
"w",
"*",
"WidgetConditionalFormat",
")",
"GetComparator",
"(",
")",
"<mask>",
"{",
"if",
"w",
"==",
"nil",
"||",
"w",
".",
"Comparator",
"==",
"nil",
"{",
"return",
"\"",
"\"",
"\n",
"}",
"\n",
"return",
"*",
"w",
".",
"Comparator",
"\n",
"}"
] |
5,249 | all-5250 | [
"Name",
"returns",
"user",
"defined",
"name",
"for",
"the",
"snapshot",
"."
] | [
"func",
"(",
"s",
"*",
"Snapshot",
")",
"Name",
"(",
")",
"(",
"string",
",",
"error",
")",
"{",
"var",
"err",
"C",
".",
"VixError",
"=",
"C",
".",
"VIX_OK",
"\n",
"var",
"name",
"*",
"C",
".",
"char",
"\n\n",
"err",
"=",
"C",
".",
"get_property",
"(",
"s",
".",
"handle",
",",
"C",
".",
"VIX_PROPERTY_SNAPSHOT_DISPLAYNAME",
",",
"unsafe",
".",
"Pointer",
"(",
"&",
"name",
")",
")",
"\n\n",
"defer",
"C",
".",
"Vix_FreeBuffer",
"(",
"unsafe",
".",
"Pointer",
"(",
"<mask>",
")",
")",
"\n\n",
"if",
"C",
".",
"VIX_OK",
"!=",
"err",
"{",
"return",
"\"",
"\"",
",",
"&",
"Error",
"{",
"Operation",
":",
"\"",
"\"",
",",
"Code",
":",
"int",
"(",
"err",
"&",
"0xFFFF",
")",
",",
"Text",
":",
"C",
".",
"GoString",
"(",
"C",
".",
"Vix_GetErrorText",
"(",
"err",
",",
"nil",
")",
")",
",",
"}",
"\n",
"}",
"\n\n",
"return",
"C",
".",
"GoString",
"(",
"name",
")",
",",
"nil",
"\n",
"}"
] |
5,250 | all-5251 | [
"plugin",
"executes",
"a",
"subprocess",
"as",
"the",
"given",
"command",
"string",
".",
"It",
"is",
"assumed",
"the",
"resulting",
"command",
"returns",
"JSON",
"which",
"is",
"then",
"parsed",
"and",
"returned",
"as",
"the",
"value",
"for",
"use",
"in",
"the",
"template",
"."
] | [
"func",
"plugin",
"(",
"<mask>",
"string",
",",
"args",
"...",
"string",
")",
"(",
"string",
",",
"error",
")",
"{",
"if",
"name",
"==",
"\"",
"\"",
"{",
"return",
"\"",
"\"",
",",
"nil",
"\n",
"}",
"\n\n",
"stdout",
",",
"stderr",
":=",
"new",
"(",
"bytes",
".",
"Buffer",
")",
",",
"new",
"(",
"bytes",
".",
"Buffer",
")",
"\n\n",
"// Strip and trim each arg or else some plugins get confused with the newline",
"// characters",
"jsons",
":=",
"make",
"(",
"[",
"]",
"string",
",",
"0",
",",
"len",
"(",
"args",
")",
")",
"\n",
"for",
"_",
",",
"arg",
":=",
"range",
"args",
"{",
"if",
"v",
":=",
"strings",
".",
"TrimSpace",
"(",
"arg",
")",
";",
"v",
"!=",
"\"",
"\"",
"{",
"jsons",
"=",
"append",
"(",
"jsons",
",",
"v",
")",
"\n",
"}",
"\n",
"}",
"\n\n",
"cmd",
":=",
"exec",
".",
"Command",
"(",
"name",
",",
"jsons",
"...",
")",
"\n",
"cmd",
".",
"Stdout",
"=",
"stdout",
"\n",
"cmd",
".",
"Stderr",
"=",
"stderr",
"\n",
"if",
"err",
":=",
"cmd",
".",
"Start",
"(",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"\"",
"\"",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\\n",
"\\n",
"\\n",
"\\n",
"\\n",
"\\n",
"\\n",
"\\n",
"\"",
",",
"name",
",",
"err",
",",
"stdout",
".",
"Bytes",
"(",
")",
",",
"stderr",
".",
"Bytes",
"(",
")",
")",
"\n",
"}",
"\n\n",
"done",
":=",
"make",
"(",
"chan",
"error",
",",
"1",
")",
"\n",
"go",
"func",
"(",
")",
"{",
"done",
"<-",
"cmd",
".",
"Wait",
"(",
")",
"\n",
"}",
"(",
")",
"\n\n",
"select",
"{",
"case",
"<-",
"time",
".",
"After",
"(",
"30",
"*",
"time",
".",
"Second",
")",
":",
"if",
"cmd",
".",
"Process",
"!=",
"nil",
"{",
"if",
"err",
":=",
"cmd",
".",
"Process",
".",
"Kill",
"(",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"\"",
"\"",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"name",
")",
"\n",
"}",
"\n",
"}",
"\n",
"<-",
"done",
"// Allow the goroutine to exit",
"\n",
"return",
"\"",
"\"",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"name",
")",
"\n",
"case",
"err",
":=",
"<-",
"done",
":",
"if",
"err",
"!=",
"nil",
"{",
"return",
"\"",
"\"",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\\n",
"\\n",
"\\n",
"\\n",
"\\n",
"\\n",
"\\n",
"\\n",
"\"",
",",
"name",
",",
"err",
",",
"stdout",
".",
"Bytes",
"(",
")",
",",
"stderr",
".",
"Bytes",
"(",
")",
")",
"\n",
"}",
"\n",
"}",
"\n\n",
"return",
"strings",
".",
"TrimSpace",
"(",
"stdout",
".",
"String",
"(",
")",
")",
",",
"nil",
"\n",
"}"
] |
5,251 | all-5252 | [
"IsTokenValid",
"checks",
"the",
"token",
"is",
"still",
"within",
"it",
"s",
"expiration",
"window",
".",
"We",
"early",
"expire",
"to",
"allow",
"for",
"timing",
"in",
"calls",
"and",
"add",
"jitter",
"to",
"avoid",
"refreshing",
"all",
"of",
"the",
"tokens",
"at",
"once",
"."
] | [
"func",
"(",
"authProvider",
"*",
"ecrAuthProvider",
")",
"IsTokenValid",
"(",
"authData",
"*",
"ecrapi",
".",
"AuthorizationData",
")",
"bool",
"{",
"if",
"authData",
"==",
"nil",
"||",
"authData",
".",
"ExpiresAt",
"==",
"nil",
"{",
"return",
"<mask>",
"\n",
"}",
"\n\n",
"refreshTime",
":=",
"aws",
".",
"TimeValue",
"(",
"authData",
".",
"ExpiresAt",
")",
".",
"Add",
"(",
"-",
"1",
"*",
"retry",
".",
"AddJitter",
"(",
"MinimumJitterDuration",
",",
"MinimumJitterDuration",
")",
")",
"\n\n",
"return",
"time",
".",
"Now",
"(",
")",
".",
"Before",
"(",
"refreshTime",
")",
"\n",
"}"
] |
5,252 | all-5253 | [
"Return",
"true",
"if",
"the",
"given",
"request",
"is",
"presenting",
"the",
"given",
"cluster",
"certificate",
"."
] | [
"func",
"tlsCheckCert",
"(",
"r",
"*",
"http",
".",
"Request",
",",
"info",
"*",
"shared",
".",
"CertInfo",
")",
"bool",
"{",
"cert",
",",
"err",
":=",
"x509",
".",
"ParseCertificate",
"(",
"info",
".",
"KeyPair",
"(",
")",
".",
"Certificate",
"[",
"0",
"]",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"// Since we have already loaded this certificate, typically",
"// using LoadX509KeyPair, an error should never happen, but",
"// check for good measure.",
"panic",
"(",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"err",
")",
")",
"\n",
"}",
"\n",
"trustedCerts",
":=",
"<mask>",
"[",
"string",
"]",
"x509",
".",
"Certificate",
"{",
"\"",
"\"",
":",
"*",
"cert",
"}",
"\n\n",
"trusted",
",",
"_",
":=",
"util",
".",
"CheckTrustState",
"(",
"*",
"r",
".",
"TLS",
".",
"PeerCertificates",
"[",
"0",
"]",
",",
"trustedCerts",
")",
"\n\n",
"return",
"r",
".",
"TLS",
"!=",
"nil",
"&&",
"trusted",
"\n",
"}"
] |
5,253 | all-5254 | [
"Run",
"matches",
"and",
"opens",
"external",
"network",
"ports",
"."
] | [
"func",
"Run",
"(",
"ctx",
"context",
".",
"Context",
",",
"conf",
"*",
"Config",
",",
"logger",
"log",
".",
"Logger",
",",
"ports",
"[",
"]",
"uint16",
")",
"{",
"if",
"conf",
".",
"Mechanism",
"==",
"\"",
"\"",
"{",
"logger",
".",
"Debug",
"(",
"\"",
"\"",
")",
"\n",
"return",
"\n",
"}",
"\n\n",
"service",
",",
"err",
":=",
"Parse",
"(",
"conf",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"logger",
".",
"Error",
"(",
"err",
".",
"Error",
"(",
")",
")",
"\n",
"return",
"\n",
"}",
"\n\n",
"for",
"k",
":=",
"range",
"ports",
"{",
"// Remove old rules.",
"service",
".",
"DeleteMapping",
"(",
"\"",
"\"",
",",
"int",
"(",
"ports",
"[",
"k",
"]",
")",
",",
"int",
"(",
"ports",
"[",
"k",
"]",
")",
")",
"\n\n",
"<mask>",
":=",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"k",
")",
"\n",
"if",
"err",
":=",
"Map",
"(",
"ctx",
",",
"conf",
",",
"logger",
",",
"service",
",",
"\"",
"\"",
",",
"int",
"(",
"ports",
"[",
"k",
"]",
")",
",",
"int",
"(",
"ports",
"[",
"k",
"]",
")",
",",
"name",
")",
";",
"err",
"!=",
"nil",
"{",
"msg",
":=",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
"+",
"\"",
"\"",
",",
"ports",
"[",
"k",
"]",
")",
"\n",
"logger",
".",
"Warn",
"(",
"msg",
")",
"\n",
"return",
"\n",
"}",
"\n",
"}",
"\n\n",
"extIP",
",",
"err",
":=",
"ipify",
".",
"GetIp",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"logger",
".",
"Warn",
"(",
"\"",
"\"",
"+",
"\"",
"\"",
"+",
"err",
".",
"Error",
"(",
")",
")",
"\n",
"return",
"\n",
"}",
"\n\n",
"logger",
"=",
"logger",
".",
"Add",
"(",
"\"",
"\"",
",",
"extIP",
")",
"\n\n",
"timeout",
":=",
"time",
".",
"Duration",
"(",
"conf",
".",
"CheckTimeout",
")",
"*",
"time",
".",
"Millisecond",
"\n\n",
"checkSrv",
":=",
"func",
"(",
"port",
"uint16",
")",
"{",
"if",
"util",
".",
"CheckConnection",
"(",
"\"",
"\"",
",",
"extIP",
",",
"int",
"(",
"port",
")",
",",
"timeout",
")",
"{",
"logger",
".",
"Info",
"(",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
"+",
"\"",
"\"",
",",
"port",
")",
")",
"\n",
"return",
"\n",
"}",
"\n",
"logger",
".",
"Warn",
"(",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
"+",
"\"",
"\"",
",",
"port",
")",
")",
"\n",
"}",
"\n\n",
"for",
"k",
":=",
"range",
"ports",
"{",
"checkSrv",
"(",
"ports",
"[",
"k",
"]",
")",
"\n",
"}",
"\n",
"}"
] |
5,254 | all-5255 | [
"Given",
"a",
"State",
"type",
"returns",
"its",
"string",
"representation"
] | [
"func",
"(",
"s",
"State",
")",
"<mask>",
"(",
")",
"string",
"{",
"if",
"int",
"(",
"s",
")",
">=",
"0",
"&&",
"int",
"(",
"s",
")",
"<",
"len",
"(",
"states",
")",
"{",
"return",
"states",
"[",
"s",
"]",
"\n",
"}",
"\n",
"return",
"\"",
"\"",
"\n",
"}"
] |
5,255 | all-5256 | [
"Uint64",
"defines",
"a",
"uint64",
"flag",
"with",
"specified",
"name",
"default",
"value",
"and",
"usage",
"string",
".",
"The",
"return",
"value",
"is",
"the",
"address",
"of",
"a",
"uint64",
"variable",
"that",
"stores",
"the",
"value",
"of",
"the",
"flag",
"."
] | [
"func",
"Uint64",
"(",
"name",
"string",
",",
"value",
"uint64",
",",
"<mask>",
"string",
")",
"*",
"uint64",
"{",
"return",
"EnvironmentFlags",
".",
"Uint64",
"(",
"name",
",",
"value",
",",
"usage",
")",
"\n",
"}"
] |
5,256 | all-5257 | [
"Commit",
"marks",
"the",
"process",
"of",
"storing",
"the",
"image",
"as",
"successful",
"and",
"asks",
"for",
"the",
"image",
"to",
"be",
"persisted",
".",
"WARNING",
":",
"This",
"does",
"not",
"have",
"any",
"transactional",
"semantics",
":",
"-",
"Uploaded",
"data",
"MAY",
"be",
"visible",
"to",
"others",
"before",
"Commit",
"()",
"is",
"called",
"-",
"Uploaded",
"data",
"MAY",
"be",
"removed",
"or",
"MAY",
"remain",
"around",
"if",
"Close",
"()",
"is",
"called",
"without",
"Commit",
"()",
"(",
"i",
".",
"e",
".",
"rollback",
"is",
"allowed",
"but",
"not",
"guaranteed",
")"
] | [
"func",
"(",
"d",
"*",
"daemonImageDestination",
")",
"Commit",
"(",
"ctx",
"context",
".",
"Context",
")",
"error",
"{",
"logrus",
".",
"Debugf",
"(",
"\"",
"\"",
")",
"\n",
"if",
"err",
":=",
"d",
".",
"Destination",
".",
"Commit",
"(",
"ctx",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"if",
"err",
":=",
"d",
".",
"writer",
".",
"Close",
"(",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"d",
".",
"committed",
"=",
"<mask>",
"// We may still fail, but we are done sending to imageLoadGoroutine.",
"\n\n",
"logrus",
".",
"Debugf",
"(",
"\"",
"\"",
")",
"\n",
"select",
"{",
"case",
"<-",
"ctx",
".",
"Done",
"(",
")",
":",
"return",
"ctx",
".",
"Err",
"(",
")",
"\n",
"case",
"err",
":=",
"<-",
"d",
".",
"statusChannel",
":",
"return",
"err",
"\n",
"}",
"\n",
"}"
] |
5,257 | all-5258 | [
"RegisterDatasources",
"adds",
"path",
"to",
"the",
"Mapnik",
"plugin",
"search",
"path",
"."
] | [
"func",
"RegisterDatasources",
"(",
"<mask>",
"string",
")",
"error",
"{",
"cs",
":=",
"C",
".",
"CString",
"(",
"path",
")",
"\n",
"defer",
"C",
".",
"free",
"(",
"unsafe",
".",
"Pointer",
"(",
"cs",
")",
")",
"\n",
"if",
"C",
".",
"mapnik_register_datasources",
"(",
"cs",
")",
"==",
"0",
"{",
"e",
":=",
"C",
".",
"GoString",
"(",
"C",
".",
"mapnik_register_last_error",
"(",
")",
")",
"\n",
"if",
"e",
"!=",
"\"",
"\"",
"{",
"return",
"errors",
".",
"New",
"(",
"\"",
"\"",
"+",
"e",
")",
"\n",
"}",
"\n",
"return",
"errors",
".",
"New",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
] |
5,258 | all-5259 | [
"Println",
"records",
"the",
"log",
"with",
"trace",
"level"
] | [
"func",
"(",
"l",
"*",
"Logger",
")",
"Println",
"(",
"args",
"...",
"<mask>",
"{",
"}",
")",
"{",
"l",
".",
"Output",
"(",
"2",
",",
"LevelTrace",
",",
"fmt",
".",
"Sprintln",
"(",
"args",
"...",
")",
")",
"\n",
"}"
] |
5,259 | all-5260 | [
"Zones",
"filters",
"map",
"[",
"zoneID",
"]",
"zoneName",
"for",
"names",
"having",
"f",
".",
"domain",
"as",
"suffix"
] | [
"func",
"(",
"f",
"*",
"zoneFilter",
")",
"Zones",
"(",
"zones",
"map",
"[",
"int64",
"]",
"string",
")",
"map",
"[",
"int64",
"]",
"string",
"{",
"result",
":=",
"<mask>",
"[",
"int64",
"]",
"string",
"{",
"}",
"\n",
"for",
"zoneID",
",",
"zoneName",
":=",
"range",
"zones",
"{",
"if",
"strings",
".",
"HasSuffix",
"(",
"zoneName",
",",
"f",
".",
"domain",
")",
"{",
"result",
"[",
"zoneID",
"]",
"=",
"zoneName",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"result",
"\n",
"}"
] |
5,260 | all-5261 | [
"MarshalEasyJSON",
"satisfies",
"easyjson",
".",
"Marshaler",
"."
] | [
"func",
"(",
"t",
"APIType",
")",
"MarshalEasyJSON",
"(",
"out",
"*",
"jwriter",
".",
"<mask>",
")",
"{",
"out",
".",
"String",
"(",
"string",
"(",
"t",
")",
")",
"\n",
"}"
] |
5,261 | all-5262 | [
"GetCookieFloat64",
"returns",
"cookie",
"result",
"in",
"float64",
"type",
"."
] | [
"func",
"(",
"ctx",
"*",
"Context",
")",
"GetCookieFloat64",
"(",
"name",
"string",
")",
"float64",
"{",
"v",
",",
"_",
":=",
"strconv",
".",
"ParseFloat",
"(",
"ctx",
".",
"GetCookie",
"(",
"<mask>",
")",
",",
"64",
")",
"\n",
"return",
"v",
"\n",
"}"
] |
5,262 | all-5263 | [
"Arg2Writer",
"returns",
"a",
"WriteCloser",
"that",
"can",
"be",
"used",
"to",
"write",
"the",
"second",
"argument",
".",
"The",
"returned",
"writer",
"must",
"be",
"closed",
"once",
"the",
"write",
"is",
"complete",
"."
] | [
"func",
"(",
"response",
"*",
"InboundCallResponse",
")",
"Arg2Writer",
"(",
")",
"(",
"ArgWriter",
",",
"error",
")",
"{",
"if",
"err",
":=",
"NewArgWriter",
"(",
"response",
".",
"arg1Writer",
"(",
")",
")",
".",
"Write",
"(",
"nil",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"return",
"<mask>",
".",
"arg2Writer",
"(",
")",
"\n",
"}"
] |
5,263 | all-5264 | [
"UnmarshalJSON",
"supports",
"json",
".",
"Unmarshaler",
"interface"
] | [
"func",
"(",
"v",
"*",
"EventHeapStatsUpdate",
")",
"UnmarshalJSON",
"(",
"data",
"[",
"]",
"<mask>",
")",
"error",
"{",
"r",
":=",
"jlexer",
".",
"Lexer",
"{",
"Data",
":",
"data",
"}",
"\n",
"easyjsonC5a4559bDecodeGithubComChromedpCdprotoHeapprofiler18",
"(",
"&",
"r",
",",
"v",
")",
"\n",
"return",
"r",
".",
"Error",
"(",
")",
"\n",
"}"
] |
5,264 | all-5265 | [
"Flush",
"the",
"output",
"buffer",
"."
] | [
"func",
"yaml_emitter_flush",
"(",
"emitter",
"*",
"yaml_emitter_t",
")",
"bool",
"{",
"if",
"emitter",
".",
"write_handler",
"==",
"nil",
"{",
"panic",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"// Check if the buffer is empty.",
"if",
"emitter",
".",
"buffer_pos",
"==",
"0",
"{",
"return",
"true",
"\n",
"}",
"\n\n",
"if",
"err",
":=",
"emitter",
".",
"write_handler",
"(",
"emitter",
",",
"emitter",
".",
"buffer",
"[",
":",
"emitter",
".",
"buffer_pos",
"]",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"yaml_emitter_set_writer_error",
"(",
"emitter",
",",
"\"",
"\"",
"+",
"err",
".",
"Error",
"(",
")",
")",
"\n",
"}",
"\n",
"emitter",
".",
"buffer_pos",
"=",
"0",
"\n",
"return",
"<mask>",
"\n",
"}"
] |
5,265 | all-5266 | [
"Fuzz",
"is",
"used",
"to",
"run",
"https",
":",
"//",
"github",
".",
"com",
"/",
"dvyukov",
"/",
"go",
"-",
"fuzz"
] | [
"func",
"Fuzz",
"(",
"data",
"[",
"]",
"byte",
")",
"int",
"{",
"<mask>",
":=",
"string",
"(",
"data",
")",
"\n\n",
"_",
"=",
"zxcvbn",
".",
"PasswordStrength",
"(",
"password",
",",
"nil",
")",
"\n",
"return",
"1",
"\n",
"}"
] |
5,266 | all-5267 | [
"GetMetricQueryOk",
"returns",
"a",
"tuple",
"with",
"the",
"MetricQuery",
"field",
"if",
"it",
"s",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"and",
"a",
"boolean",
"to",
"check",
"if",
"the",
"value",
"has",
"been",
"set",
"."
] | [
"func",
"(",
"s",
"*",
"ScatterplotRequest",
")",
"GetMetricQueryOk",
"(",
")",
"(",
"string",
",",
"bool",
")",
"{",
"if",
"s",
"==",
"nil",
"||",
"s",
".",
"MetricQuery",
"==",
"nil",
"{",
"return",
"\"",
"\"",
",",
"<mask>",
"\n",
"}",
"\n",
"return",
"*",
"s",
".",
"MetricQuery",
",",
"true",
"\n",
"}"
] |
5,267 | all-5268 | [
"handleEventError",
"handles",
"a",
"container",
"change",
"event",
"error",
"and",
"decides",
"whether",
"we",
"should",
"proceed",
"to",
"transition",
"the",
"container"
] | [
"func",
"(",
"mtask",
"*",
"managedTask",
")",
"handleEventError",
"(",
"containerChange",
"dockerContainerChange",
",",
"currentKnownStatus",
"apicontainerstatus",
".",
"ContainerStatus",
")",
"bool",
"{",
"container",
":=",
"containerChange",
".",
"container",
"\n",
"event",
":=",
"containerChange",
".",
"event",
"\n",
"if",
"container",
".",
"ApplyingError",
"==",
"nil",
"{",
"container",
".",
"ApplyingError",
"=",
"apierrors",
".",
"NewNamedError",
"(",
"event",
".",
"Error",
")",
"\n",
"}",
"\n",
"switch",
"event",
".",
"Status",
"{",
"// event.Status is the desired container transition from container's known status",
"// (* -> event.Status)",
"case",
"apicontainerstatus",
".",
"ContainerPulled",
":",
"// If the agent pull behavior is always or once, we receive the error because",
"// the image pull fails, the task should fail. If we don't fail task here,",
"// then the cached image will probably be used for creating container, and we",
"// don't want to use cached image for both cases.",
"if",
"mtask",
".",
"cfg",
".",
"ImagePullBehavior",
"==",
"config",
".",
"ImagePullAlwaysBehavior",
"||",
"mtask",
".",
"cfg",
".",
"ImagePullBehavior",
"==",
"config",
".",
"ImagePullOnceBehavior",
"{",
"seelog",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"mtask",
".",
"Arn",
",",
"container",
".",
"Image",
",",
"container",
".",
"Name",
",",
"event",
".",
"Error",
")",
"\n",
"// The task should be stopped regardless of whether this container is",
"// essential or non-essential.",
"mtask",
".",
"SetDesiredStatus",
"(",
"apitaskstatus",
".",
"TaskStopped",
")",
"\n",
"return",
"false",
"\n",
"}",
"\n",
"// If the agent pull behavior is prefer-cached, we receive the error because",
"// the image pull fails and there is no cached image in local, we don't make",
"// the task fail here, will let create container handle it instead.",
"// If the agent pull behavior is default, use local image cache directly,",
"// assuming it exists.",
"seelog",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"mtask",
".",
"Arn",
",",
"container",
".",
"Name",
",",
"container",
".",
"Image",
",",
"<mask>",
".",
"Error",
")",
"\n",
"// proceed anyway",
"return",
"true",
"\n",
"case",
"apicontainerstatus",
".",
"ContainerStopped",
":",
"// Container's desired transition was to 'STOPPED'",
"return",
"mtask",
".",
"handleContainerStoppedTransitionError",
"(",
"event",
",",
"container",
",",
"currentKnownStatus",
")",
"\n",
"case",
"apicontainerstatus",
".",
"ContainerStatusNone",
":",
"fallthrough",
"\n",
"case",
"apicontainerstatus",
".",
"ContainerCreated",
":",
"// No need to explicitly stop containers if this is a * -> NONE/CREATED transition",
"seelog",
".",
"Warnf",
"(",
"\"",
"\"",
",",
"mtask",
".",
"Arn",
",",
"container",
".",
"Name",
",",
"event",
".",
"Error",
")",
"\n",
"container",
".",
"SetKnownStatus",
"(",
"currentKnownStatus",
")",
"\n",
"container",
".",
"SetDesiredStatus",
"(",
"apicontainerstatus",
".",
"ContainerStopped",
")",
"\n",
"return",
"false",
"\n",
"default",
":",
"// If this is a * -> RUNNING / RESOURCES_PROVISIONED transition, we need to stop",
"// the container.",
"seelog",
".",
"Warnf",
"(",
"\"",
"\"",
",",
"mtask",
".",
"Arn",
",",
"container",
".",
"Name",
",",
"event",
".",
"Error",
")",
"\n",
"container",
".",
"SetKnownStatus",
"(",
"currentKnownStatus",
")",
"\n",
"container",
".",
"SetDesiredStatus",
"(",
"apicontainerstatus",
".",
"ContainerStopped",
")",
"\n",
"errorName",
":=",
"event",
".",
"Error",
".",
"ErrorName",
"(",
")",
"\n",
"if",
"errorName",
"==",
"dockerapi",
".",
"DockerTimeoutErrorName",
"||",
"errorName",
"==",
"dockerapi",
".",
"CannotInspectContainerErrorName",
"{",
"// If there's an error with inspecting the container or in case of timeout error,",
"// we'll also assume that the container has transitioned to RUNNING and issue",
"// a stop. See #1043 for details",
"seelog",
".",
"Warnf",
"(",
"\"",
"\"",
",",
"mtask",
".",
"Arn",
",",
"container",
".",
"Name",
")",
"\n",
"go",
"mtask",
".",
"engine",
".",
"transitionContainer",
"(",
"mtask",
".",
"Task",
",",
"container",
",",
"apicontainerstatus",
".",
"ContainerStopped",
")",
"\n",
"}",
"\n",
"// Container known status not changed, no need for further processing",
"return",
"false",
"\n",
"}",
"\n",
"}"
] |
5,268 | all-5269 | [
"Close",
"shuts",
"down",
"the",
"client",
"s",
"etcd",
"connections",
"."
] | [
"func",
"(",
"c",
"*",
"Client",
")",
"Close",
"(",
")",
"error",
"{",
"c",
".",
"cancel",
"(",
")",
"\n",
"c",
".",
"Watcher",
".",
"Close",
"(",
")",
"\n",
"c",
".",
"Lease",
".",
"Close",
"(",
")",
"\n",
"if",
"c",
".",
"resolverGroup",
"!=",
"nil",
"{",
"c",
".",
"resolverGroup",
".",
"Close",
"(",
")",
"\n",
"}",
"\n",
"if",
"c",
".",
"<mask>",
"!=",
"nil",
"{",
"return",
"toErr",
"(",
"c",
".",
"ctx",
",",
"c",
".",
"conn",
".",
"Close",
"(",
")",
")",
"\n",
"}",
"\n",
"return",
"c",
".",
"ctx",
".",
"Err",
"(",
")",
"\n",
"}"
] |
5,269 | all-5270 | [
"stopExchanges",
"stops",
"all",
"message",
"exchanges",
"to",
"unblock",
"all",
"waiters",
"on",
"the",
"mex",
".",
"This",
"should",
"only",
"be",
"called",
"on",
"connection",
"failures",
"."
] | [
"func",
"(",
"mexset",
"*",
"messageExchangeSet",
")",
"stopExchanges",
"(",
"err",
"error",
")",
"{",
"if",
"mexset",
".",
"log",
".",
"Enabled",
"(",
"LogLevelDebug",
")",
"{",
"mexset",
".",
"<mask>",
".",
"Debugf",
"(",
"\"",
"\"",
",",
"mexset",
".",
"count",
"(",
")",
",",
"err",
")",
"\n",
"}",
"\n\n",
"mexset",
".",
"Lock",
"(",
")",
"\n",
"shutdown",
",",
"exchanges",
":=",
"mexset",
".",
"copyExchanges",
"(",
")",
"\n",
"mexset",
".",
"shutdown",
"=",
"true",
"\n",
"mexset",
".",
"Unlock",
"(",
")",
"\n\n",
"if",
"shutdown",
"{",
"mexset",
".",
"log",
".",
"Debugf",
"(",
"\"",
"\"",
")",
"\n",
"return",
"\n",
"}",
"\n\n",
"for",
"_",
",",
"mex",
":=",
"range",
"exchanges",
"{",
"// When there's a connection failure, we want to notify blocked callers that the",
"// call will fail, but we don't want to shutdown the exchange as only the",
"// arg reader/writer should shutdown the exchange. Otherwise, our guarantee",
"// on sendChRefs that there's no references to sendCh is violated since",
"// readers/writers could still have a reference to sendCh even though",
"// we shutdown the exchange and called Done on sendChRefs.",
"if",
"mex",
".",
"errChNotified",
".",
"CAS",
"(",
"false",
",",
"true",
")",
"{",
"mex",
".",
"errCh",
".",
"Notify",
"(",
"err",
")",
"\n",
"}",
"\n",
"}",
"\n",
"}"
] |
5,270 | all-5271 | [
"MarshalJSON",
"supports",
"json",
".",
"Marshaler",
"interface"
] | [
"func",
"(",
"v",
"EventDomStorageItemsCleared",
")",
"MarshalJSON",
"(",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"w",
":=",
"jwriter",
".",
"Writer",
"{",
"}",
"\n",
"easyjsonC5a4559bEncodeGithubComChromedpCdprotoDomstorage5",
"(",
"&",
"w",
",",
"v",
")",
"\n",
"return",
"w",
".",
"Buffer",
".",
"BuildBytes",
"(",
")",
",",
"w",
".",
"<mask>",
"\n",
"}"
] |
5,271 | all-5272 | [
"CanAuthenticate",
"makes",
"a",
"test",
"authenticated",
"request",
"to",
"the",
"RightScale",
"API",
"and",
"returns",
"an",
"error",
"if",
"it",
"fails",
"."
] | [
"func",
"(",
"a",
"*",
"API",
")",
"CanAuthenticate",
"(",
")",
"error",
"{",
"<mask>",
":=",
"a",
".",
"Auth",
".",
"CanAuthenticate",
"(",
"a",
".",
"Host",
")",
"\n",
"return",
"res",
"\n",
"}"
] |
5,272 | all-5273 | [
"Infof",
"outputs",
"formatted",
"Info",
"level",
"log"
] | [
"func",
"(",
"g",
"*",
"Glg",
")",
"Infof",
"(",
"<mask>",
"string",
",",
"val",
"...",
"interface",
"{",
"}",
")",
"error",
"{",
"return",
"g",
".",
"out",
"(",
"INFO",
",",
"format",
",",
"val",
"...",
")",
"\n",
"}"
] |
5,273 | all-5274 | [
"TODO",
"(",
"jrick",
")",
"GtkIconSet",
"/",
"*",
"func",
"ImageNewFromIconSet",
"()",
"{",
"}",
"TODO",
"(",
"jrick",
")",
"GdkPixbufAnimation",
"/",
"*",
"func",
"ImageNewFromAnimation",
"()",
"{",
"}",
"ImageNewFromIconName",
"()",
"is",
"a",
"wrapper",
"around",
"gtk_image_new_from_icon_name",
"()",
"."
] | [
"func",
"ImageNewFromIconName",
"(",
"iconName",
"string",
",",
"size",
"IconSize",
")",
"(",
"*",
"Image",
",",
"error",
")",
"{",
"cstr",
":=",
"C",
".",
"CString",
"(",
"iconName",
")",
"\n",
"defer",
"C",
".",
"<mask>",
"(",
"unsafe",
".",
"Pointer",
"(",
"cstr",
")",
")",
"\n",
"c",
":=",
"C",
".",
"gtk_image_new_from_icon_name",
"(",
"(",
"*",
"C",
".",
"gchar",
")",
"(",
"cstr",
")",
",",
"C",
".",
"GtkIconSize",
"(",
"size",
")",
")",
"\n",
"if",
"c",
"==",
"nil",
"{",
"return",
"nil",
",",
"nilPtrErr",
"\n",
"}",
"\n",
"obj",
":=",
"glib",
".",
"Take",
"(",
"unsafe",
".",
"Pointer",
"(",
"c",
")",
")",
"\n",
"return",
"wrapImage",
"(",
"obj",
")",
",",
"nil",
"\n",
"}"
] |
5,274 | all-5275 | [
"Table",
"hash",
"from",
"random",
"value",
"and",
"key",
".",
"Generate",
"()",
"returns",
"these",
"random",
"values",
"."
] | [
"func",
"(",
"h",
"*",
"chdHasher",
")",
"<mask>",
"(",
"r",
"uint64",
",",
"b",
"[",
"]",
"byte",
")",
"uint64",
"{",
"return",
"(",
"hasher",
"(",
"b",
")",
"^",
"h",
".",
"r",
"[",
"0",
"]",
"^",
"r",
")",
"%",
"h",
".",
"size",
"\n",
"}"
] |
5,275 | all-5276 | [
"GetMessageOk",
"returns",
"a",
"tuple",
"with",
"the",
"Message",
"field",
"if",
"it",
"s",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"and",
"a",
"boolean",
"to",
"check",
"if",
"the",
"value",
"has",
"been",
"set",
"."
] | [
"func",
"(",
"h",
"*",
"HostActionMute",
")",
"GetMessageOk",
"(",
")",
"(",
"string",
",",
"bool",
")",
"{",
"if",
"h",
"==",
"nil",
"||",
"h",
".",
"<mask>",
"==",
"nil",
"{",
"return",
"\"",
"\"",
",",
"false",
"\n",
"}",
"\n",
"return",
"*",
"h",
".",
"Message",
",",
"true",
"\n",
"}"
] |
5,276 | all-5277 | [
"Leave",
"a",
"cluster",
".",
"If",
"the",
"force",
"flag",
"is",
"true",
"the",
"node",
"will",
"leave",
"even",
"if",
"it",
"still",
"has",
"containers",
"and",
"images",
".",
"The",
"node",
"will",
"only",
"leave",
"the",
"raft",
"cluster",
"and",
"won",
"t",
"be",
"removed",
"from",
"the",
"database",
".",
"That",
"s",
"done",
"by",
"Purge",
"()",
".",
"Upon",
"success",
"return",
"the",
"address",
"of",
"the",
"leaving",
"node",
"."
] | [
"func",
"Leave",
"(",
"state",
"*",
"state",
".",
"State",
",",
"gateway",
"*",
"Gateway",
",",
"name",
"string",
",",
"force",
"bool",
")",
"(",
"string",
",",
"error",
")",
"{",
"logger",
".",
"Debugf",
"(",
"\"",
"\"",
",",
"name",
")",
"\n\n",
"// Check if the node can be deleted and track its address.",
"var",
"address",
"string",
"\n",
"err",
":=",
"state",
".",
"Cluster",
".",
"Transaction",
"(",
"func",
"(",
"tx",
"*",
"db",
".",
"ClusterTx",
")",
"error",
"{",
"// Get the node (if it doesn't exists an error is returned).",
"node",
",",
"err",
":=",
"tx",
".",
"NodeByName",
"(",
"name",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"// Check that the node is eligeable for leaving.",
"if",
"!",
"force",
"{",
"err",
":=",
"membershipCheckClusterStateForLeave",
"(",
"tx",
",",
"node",
".",
"ID",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"}",
"\n\n",
"address",
"=",
"node",
".",
"Address",
"\n",
"return",
"nil",
"\n",
"}",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"\"",
"\"",
",",
"err",
"\n",
"}",
"\n\n",
"// If the node is a database node, leave the raft cluster too.",
"var",
"raftNodes",
"[",
"]",
"<mask>",
".",
"RaftNode",
"// Current raft nodes",
"\n",
"raftNodeRemoveIndex",
":=",
"-",
"1",
"// Index of the raft node to remove, if any.",
"\n",
"err",
"=",
"state",
".",
"Node",
".",
"Transaction",
"(",
"func",
"(",
"tx",
"*",
"db",
".",
"NodeTx",
")",
"error",
"{",
"var",
"err",
"error",
"\n",
"raftNodes",
",",
"err",
"=",
"tx",
".",
"RaftNodes",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"errors",
".",
"Wrap",
"(",
"err",
",",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"for",
"i",
",",
"node",
":=",
"range",
"raftNodes",
"{",
"if",
"node",
".",
"Address",
"==",
"address",
"{",
"raftNodeRemoveIndex",
"=",
"i",
"\n",
"break",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"\"",
"\"",
",",
"err",
"\n",
"}",
"\n\n",
"if",
"raftNodeRemoveIndex",
"==",
"-",
"1",
"{",
"// The node was not part of the raft cluster, nothing left to",
"// do.",
"return",
"address",
",",
"nil",
"\n",
"}",
"\n\n",
"id",
":=",
"strconv",
".",
"Itoa",
"(",
"int",
"(",
"raftNodes",
"[",
"raftNodeRemoveIndex",
"]",
".",
"ID",
")",
")",
"\n",
"// Get the address of another database node,",
"target",
":=",
"raftNodes",
"[",
"(",
"raftNodeRemoveIndex",
"+",
"1",
")",
"%",
"len",
"(",
"raftNodes",
")",
"]",
".",
"Address",
"\n",
"logger",
".",
"Info",
"(",
"\"",
"\"",
",",
"log15",
".",
"Ctx",
"{",
"\"",
"\"",
":",
"id",
",",
"\"",
"\"",
":",
"address",
",",
"\"",
"\"",
":",
"target",
"}",
")",
"\n",
"dial",
",",
"err",
":=",
"raftDial",
"(",
"gateway",
".",
"cert",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"\"",
"\"",
",",
"err",
"\n",
"}",
"\n",
"err",
"=",
"rafthttp",
".",
"ChangeMembership",
"(",
"raftmembership",
".",
"LeaveRequest",
",",
"raftEndpoint",
",",
"dial",
",",
"raft",
".",
"ServerID",
"(",
"id",
")",
",",
"address",
",",
"target",
",",
"5",
"*",
"time",
".",
"Second",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"\"",
"\"",
",",
"err",
"\n",
"}",
"\n",
"return",
"address",
",",
"nil",
"\n",
"}"
] |
5,277 | all-5278 | [
"Set",
"is",
"required",
"for",
"kingpin",
"interfaces",
"to",
"allow",
"command",
"line",
"params",
"to",
"be",
"set",
"to",
"our",
"map",
"datatype"
] | [
"func",
"(",
"o",
"*",
"MapUint64Option",
")",
"Set",
"(",
"value",
"string",
")",
"error",
"{",
"parts",
":=",
"stringMapRegex",
".",
"Split",
"(",
"value",
",",
"2",
")",
"\n",
"if",
"len",
"(",
"parts",
")",
"!=",
"2",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"<mask>",
")",
"\n",
"}",
"\n",
"val",
":=",
"Uint64Option",
"{",
"}",
"\n",
"val",
".",
"Set",
"(",
"parts",
"[",
"1",
"]",
")",
"\n",
"(",
"*",
"o",
")",
"[",
"parts",
"[",
"0",
"]",
"]",
"=",
"val",
"\n",
"return",
"nil",
"\n",
"}"
] |
5,278 | all-5279 | [
"Update",
"game",
"state",
"by",
"one",
"tick",
"."
] | [
"func",
"(",
"w",
"*",
"World",
")",
"Update",
"(",
")",
"{",
"width",
":=",
"w",
".",
"width",
"\n",
"height",
":=",
"w",
".",
"height",
"\n",
"next",
":=",
"make",
"(",
"[",
"]",
"bool",
",",
"width",
"*",
"height",
")",
"\n",
"for",
"y",
":=",
"0",
";",
"y",
"<",
"height",
";",
"y",
"++",
"{",
"for",
"x",
":=",
"0",
";",
"x",
"<",
"width",
";",
"x",
"++",
"{",
"pop",
":=",
"neighbourCount",
"(",
"w",
".",
"area",
",",
"width",
",",
"height",
",",
"x",
",",
"y",
")",
"\n",
"switch",
"{",
"case",
"pop",
"<",
"2",
":",
"// rule 1. Any live cell with fewer than two live neighbours",
"// dies, as if caused by under-population.",
"next",
"[",
"y",
"*",
"width",
"+",
"x",
"]",
"=",
"false",
"\n\n",
"case",
"(",
"pop",
"==",
"2",
"||",
"pop",
"==",
"3",
")",
"&&",
"w",
".",
"area",
"[",
"y",
"*",
"width",
"+",
"x",
"]",
":",
"// rule 2. Any live cell with two or three live neighbours",
"// lives on to the next generation.",
"next",
"[",
"y",
"*",
"width",
"+",
"x",
"]",
"=",
"true",
"\n\n",
"case",
"pop",
">",
"3",
":",
"// rule 3. Any live cell with more than three live neighbours",
"// dies, as if by over-population.",
"next",
"[",
"y",
"*",
"width",
"+",
"x",
"]",
"=",
"false",
"\n\n",
"case",
"pop",
"==",
"3",
":",
"// rule 4. Any dead cell with exactly three live neighbours",
"// becomes a live cell, as if by reproduction.",
"<mask>",
"[",
"y",
"*",
"width",
"+",
"x",
"]",
"=",
"true",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n",
"w",
".",
"area",
"=",
"next",
"\n",
"}"
] |
5,279 | all-5280 | [
"RemoveStream",
"will",
"remove",
"a",
"stream"
] | [
"func",
"(",
"s",
"*",
"Server",
")",
"RemoveStream",
"(",
"id",
"string",
")",
"{",
"s",
".",
"mu",
".",
"Lock",
"(",
")",
"\n",
"defer",
"s",
".",
"mu",
".",
"Unlock",
"(",
")",
"\n\n",
"if",
"s",
".",
"Streams",
"[",
"id",
"]",
"!=",
"nil",
"{",
"s",
".",
"Streams",
"[",
"id",
"]",
".",
"close",
"(",
")",
"\n",
"delete",
"(",
"s",
".",
"Streams",
",",
"<mask>",
")",
"\n",
"}",
"\n",
"}"
] |
5,280 | all-5281 | [
"Do",
"executes",
"Page",
".",
"getLayoutMetrics",
"against",
"the",
"provided",
"context",
".",
"returns",
":",
"layoutViewport",
"-",
"Metrics",
"relating",
"to",
"the",
"layout",
"viewport",
".",
"visualViewport",
"-",
"Metrics",
"relating",
"to",
"the",
"visual",
"viewport",
".",
"contentSize",
"-",
"Size",
"of",
"scrollable",
"area",
"."
] | [
"func",
"(",
"p",
"*",
"GetLayoutMetricsParams",
")",
"Do",
"(",
"ctx",
"context",
".",
"<mask>",
")",
"(",
"layoutViewport",
"*",
"LayoutViewport",
",",
"visualViewport",
"*",
"VisualViewport",
",",
"contentSize",
"*",
"dom",
".",
"Rect",
",",
"err",
"error",
")",
"{",
"// execute",
"var",
"res",
"GetLayoutMetricsReturns",
"\n",
"err",
"=",
"cdp",
".",
"Execute",
"(",
"ctx",
",",
"CommandGetLayoutMetrics",
",",
"nil",
",",
"&",
"res",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"nil",
",",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"return",
"res",
".",
"LayoutViewport",
",",
"res",
".",
"VisualViewport",
",",
"res",
".",
"ContentSize",
",",
"nil",
"\n",
"}"
] |
5,281 | all-5282 | [
"TODO",
"(",
"jrick",
")",
"PandoAttrList",
"/",
"*",
"func",
"(",
"v",
"*",
"Entry",
")",
"SetAttributes",
"()",
"{",
"}",
"TODO",
"(",
"jrick",
")",
"PandoAttrList",
"/",
"*",
"func",
"(",
"v",
"*",
"Entry",
")",
"GetAttributes",
"()",
"{",
"}",
"GetMaxLength",
"()",
"is",
"a",
"wrapper",
"around",
"gtk_entry_get_max_length",
"()",
"."
] | [
"func",
"(",
"v",
"*",
"<mask>",
")",
"GetMaxLength",
"(",
")",
"int",
"{",
"c",
":=",
"C",
".",
"gtk_entry_get_max_length",
"(",
"v",
".",
"native",
"(",
")",
")",
"\n",
"return",
"int",
"(",
"c",
")",
"\n",
"}"
] |
5,282 | all-5283 | [
"NewFromHash",
"returns",
"a",
"new",
"Crypter",
"using",
"the",
"prefix",
"in",
"the",
"given",
"hashed",
"key",
"."
] | [
"func",
"NewFromHash",
"(",
"hashedKey",
"string",
")",
"Crypter",
"{",
"var",
"f",
"func",
"(",
")",
"Crypter",
"\n\n",
"if",
"strings",
".",
"HasPrefix",
"(",
"hashedKey",
",",
"cryptPrefixes",
"[",
"SHA512",
"]",
")",
"{",
"f",
"=",
"crypts",
"[",
"SHA512",
"]",
"\n",
"}",
"else",
"if",
"strings",
".",
"HasPrefix",
"(",
"hashedKey",
",",
"cryptPrefixes",
"[",
"SHA256",
"]",
")",
"{",
"f",
"=",
"crypts",
"[",
"SHA256",
"]",
"\n",
"}",
"else",
"if",
"strings",
".",
"HasPrefix",
"(",
"hashedKey",
",",
"cryptPrefixes",
"[",
"MD5",
"]",
")",
"{",
"f",
"=",
"crypts",
"[",
"MD5",
"]",
"\n",
"}",
"else",
"if",
"strings",
".",
"HasPrefix",
"(",
"hashedKey",
",",
"cryptPrefixes",
"[",
"APR1",
"]",
")",
"{",
"f",
"=",
"crypts",
"[",
"APR1",
"]",
"\n",
"}",
"else",
"{",
"toks",
":=",
"strings",
".",
"SplitN",
"(",
"hashedKey",
",",
"\"",
"\"",
",",
"3",
")",
"\n",
"<mask>",
":=",
"\"",
"\"",
"+",
"toks",
"[",
"1",
"]",
"+",
"\"",
"\"",
"\n",
"panic",
"(",
"\"",
"\"",
"+",
"prefix",
")",
"\n",
"}",
"\n\n",
"if",
"f",
"!=",
"nil",
"{",
"return",
"f",
"(",
")",
"\n",
"}",
"\n",
"panic",
"(",
"\"",
"\"",
")",
"\n",
"}"
] |
5,283 | all-5284 | [
"getCell",
"returns",
"the",
"content",
"of",
"the",
"window",
"cell",
"at",
"the",
"x",
"and",
"y",
"coordinate",
".",
"getCell",
"shall",
"be",
"called",
"from",
"queue",
"context",
"."
] | [
"func",
"(",
"w",
"*",
"Window",
")",
"getCell",
"(",
"x",
",",
"y",
"int",
")",
"*",
"Cell",
"{",
"pos",
":=",
"x",
"+",
"(",
"y",
"*",
"w",
".",
"x",
")",
"\n",
"if",
"<mask>",
"<",
"len",
"(",
"w",
".",
"backingStore",
")",
"{",
"return",
"&",
"w",
".",
"backingStore",
"[",
"pos",
"]",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
] |
5,284 | all-5285 | [
"Profile",
"handling",
"functions",
"GetProfileNames",
"returns",
"a",
"list",
"of",
"available",
"profile",
"names"
] | [
"func",
"(",
"r",
"*",
"ProtocolLXD",
")",
"GetProfileNames",
"(",
")",
"(",
"[",
"]",
"string",
",",
"error",
")",
"{",
"urls",
":=",
"[",
"]",
"string",
"{",
"}",
"\n\n",
"// Fetch the raw value",
"_",
",",
"err",
":=",
"r",
".",
"queryStruct",
"(",
"\"",
"\"",
",",
"\"",
"\"",
",",
"nil",
",",
"\"",
"\"",
",",
"&",
"urls",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"// Parse it",
"names",
":=",
"[",
"]",
"string",
"{",
"}",
"\n",
"for",
"_",
",",
"url",
":=",
"range",
"urls",
"{",
"<mask>",
":=",
"strings",
".",
"Split",
"(",
"url",
",",
"\"",
"\"",
")",
"\n",
"names",
"=",
"append",
"(",
"names",
",",
"strings",
".",
"Split",
"(",
"fields",
"[",
"len",
"(",
"fields",
")",
"-",
"1",
"]",
",",
"\"",
"\"",
")",
"[",
"0",
"]",
")",
"\n",
"}",
"\n\n",
"return",
"names",
",",
"nil",
"\n",
"}"
] |
5,285 | all-5286 | [
"NewTCPTransport",
"returns",
"a",
"NetworkTransport",
"that",
"is",
"built",
"on",
"top",
"of",
"a",
"TCP",
"streaming",
"transport",
"layer",
"."
] | [
"func",
"NewTCPTransport",
"(",
"bindAddr",
"string",
",",
"advertise",
"net",
".",
"Addr",
",",
"maxPool",
"int",
",",
"timeout",
"time",
".",
"Duration",
",",
"logOutput",
"io",
".",
"<mask>",
",",
")",
"(",
"*",
"NetworkTransport",
",",
"error",
")",
"{",
"return",
"newTCPTransport",
"(",
"bindAddr",
",",
"advertise",
",",
"func",
"(",
"stream",
"StreamLayer",
")",
"*",
"NetworkTransport",
"{",
"return",
"NewNetworkTransport",
"(",
"stream",
",",
"maxPool",
",",
"timeout",
",",
"logOutput",
")",
"\n",
"}",
")",
"\n",
"}"
] |
5,286 | all-5287 | [
"GetTitleText",
"returns",
"the",
"TitleText",
"field",
"if",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"."
] | [
"func",
"(",
"w",
"*",
"Widget",
")",
"GetTitleText",
"(",
")",
"<mask>",
"{",
"if",
"w",
"==",
"nil",
"||",
"w",
".",
"TitleText",
"==",
"nil",
"{",
"return",
"\"",
"\"",
"\n",
"}",
"\n",
"return",
"*",
"w",
".",
"TitleText",
"\n",
"}"
] |
5,287 | all-5288 | [
"bind",
"a",
"buffer",
"object",
"to",
"an",
"indexed",
"buffer",
"target"
] | [
"func",
"BindBufferBase",
"(",
"target",
"uint32",
",",
"index",
"uint32",
",",
"buffer",
"uint32",
")",
"{",
"syscall",
".",
"Syscall",
"(",
"gpBindBufferBase",
",",
"3",
",",
"uintptr",
"(",
"<mask>",
")",
",",
"uintptr",
"(",
"index",
")",
",",
"uintptr",
"(",
"buffer",
")",
")",
"\n",
"}"
] |
5,288 | all-5289 | [
"SetNumberUpLayout",
"()",
"is",
"a",
"wrapper",
"around",
"gtk_print_settings_set_number_up_layout",
"()",
"."
] | [
"func",
"(",
"<mask>",
"*",
"PrintSettings",
")",
"SetNumberUpLayout",
"(",
"numberUpLayout",
"NumberUpLayout",
")",
"{",
"C",
".",
"gtk_print_settings_set_number_up_layout",
"(",
"ps",
".",
"native",
"(",
")",
",",
"C",
".",
"GtkNumberUpLayout",
"(",
"numberUpLayout",
")",
")",
"\n",
"}"
] |
5,289 | all-5290 | [
"OptQueryExcludeAttrs",
"enables",
"discarding",
"attributes",
"from",
"a",
"result"
] | [
"func",
"OptQueryExcludeAttrs",
"(",
"<mask>",
"bool",
")",
"QueryOption",
"{",
"return",
"func",
"(",
"options",
"*",
"QueryOptions",
")",
"error",
"{",
"options",
".",
"ExcludeRowAttrs",
"=",
"enable",
"\n",
"return",
"nil",
"\n",
"}",
"\n",
"}"
] |
5,290 | all-5291 | [
"SetMarkup",
"is",
"a",
"wrapper",
"around",
"gtk_tooltip_set_markup",
"()",
"."
] | [
"func",
"(",
"t",
"*",
"Tooltip",
")",
"SetMarkup",
"(",
"str",
"string",
")",
"{",
"cstr",
":=",
"C",
".",
"CString",
"(",
"str",
")",
"\n",
"defer",
"C",
".",
"<mask>",
"(",
"unsafe",
".",
"Pointer",
"(",
"cstr",
")",
")",
"\n",
"C",
".",
"gtk_tooltip_set_markup",
"(",
"t",
".",
"native",
"(",
")",
",",
"(",
"*",
"C",
".",
"gchar",
")",
"(",
"cstr",
")",
")",
"\n",
"}"
] |
5,291 | all-5292 | [
"UnmarshalJSON",
"supports",
"json",
".",
"Unmarshaler",
"interface"
] | [
"func",
"(",
"v",
"*",
"ShorthandEntry",
")",
"UnmarshalJSON",
"(",
"data",
"[",
"]",
"<mask>",
")",
"error",
"{",
"r",
":=",
"jlexer",
".",
"Lexer",
"{",
"Data",
":",
"data",
"}",
"\n",
"easyjsonC5a4559bDecodeGithubComChromedpCdprotoCss10",
"(",
"&",
"r",
",",
"v",
")",
"\n",
"return",
"r",
".",
"Error",
"(",
")",
"\n",
"}"
] |
5,292 | all-5293 | [
"Calculates",
"the",
"per",
"-",
"element",
"bit",
"-",
"wise",
"“exclusive",
"or”",
"operation",
"on",
"an",
"array",
"and",
"a",
"scalar",
"."
] | [
"func",
"XorScalar",
"(",
"src",
"*",
"IplImage",
",",
"<mask>",
"Scalar",
",",
"dst",
"*",
"IplImage",
")",
"{",
"XorScalarWithMask",
"(",
"src",
",",
"value",
",",
"dst",
",",
"nil",
")",
"\n",
"}"
] |
5,293 | all-5294 | [
"getRole",
"is",
"a",
"convenience",
"function",
"supplied",
"to",
"query",
"an",
"instance",
"(",
"master",
"or",
"slave",
")",
"for",
"its",
"role",
".",
"It",
"attempts",
"to",
"use",
"the",
"ROLE",
"command",
"introduced",
"in",
"redis",
"2",
".",
"8",
".",
"12",
"."
] | [
"func",
"getRole",
"(",
"c",
"redis",
".",
"Conn",
")",
"(",
"string",
",",
"error",
")",
"{",
"res",
",",
"err",
":=",
"c",
".",
"Do",
"(",
"\"",
"\"",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"\"",
"\"",
",",
"err",
"\n",
"}",
"\n",
"rres",
",",
"ok",
":=",
"res",
".",
"(",
"[",
"]",
"interface",
"{",
"}",
")",
"\n",
"if",
"ok",
"{",
"return",
"redis",
".",
"String",
"(",
"rres",
"[",
"0",
"]",
",",
"nil",
")",
"\n",
"}",
"\n",
"return",
"\"",
"\"",
",",
"<mask>",
".",
"New",
"(",
"\"",
"\"",
")",
"\n",
"}"
] |
5,294 | all-5295 | [
"parseMediaType",
"is",
"a",
"more",
"tolerant",
"implementation",
"of",
"Go",
"s",
"mime",
".",
"ParseMediaType",
"function",
"."
] | [
"func",
"parseMediaType",
"(",
"ctype",
"string",
")",
"(",
"mtype",
"string",
",",
"params",
"map",
"[",
"string",
"]",
"string",
",",
"invalidParams",
"[",
"]",
"string",
",",
"err",
"error",
")",
"{",
"mtype",
",",
"params",
",",
"err",
"=",
"mime",
".",
"ParseMediaType",
"(",
"ctype",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"// Small hack to remove harmless charset duplicate params.",
"mctype",
":=",
"fixMangledMediaType",
"(",
"ctype",
",",
"\"",
"\"",
")",
"\n",
"mtype",
",",
"params",
",",
"err",
"=",
"mime",
".",
"ParseMediaType",
"(",
"mctype",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"// Some badly formed media types forget to send ; between fields.",
"mctype",
":=",
"fixMangledMediaType",
"(",
"ctype",
",",
"\"",
"\"",
")",
"\n",
"if",
"strings",
".",
"Contains",
"(",
"mctype",
",",
"`name=\"\"`",
")",
"{",
"mctype",
"=",
"strings",
".",
"Replace",
"(",
"mctype",
",",
"`name=\"\"`",
",",
"`name=\" \"`",
",",
"-",
"1",
")",
"\n",
"}",
"\n",
"mtype",
",",
"params",
",",
"err",
"=",
"mime",
".",
"ParseMediaType",
"(",
"mctype",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"// If the media parameter has special characters, ensure that it is quoted.",
"mtype",
",",
"params",
",",
"err",
"=",
"mime",
".",
"ParseMediaType",
"(",
"fixUnquotedSpecials",
"(",
"mctype",
")",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"\"",
"\"",
",",
"nil",
",",
"nil",
",",
"errors",
".",
"WithStack",
"(",
"err",
")",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n",
"if",
"mtype",
"==",
"ctPlaceholder",
"{",
"mtype",
"=",
"\"",
"\"",
"\n",
"}",
"\n",
"for",
"name",
",",
"value",
":=",
"<mask>",
"params",
"{",
"if",
"value",
"!=",
"pvPlaceholder",
"{",
"continue",
"\n",
"}",
"\n",
"invalidParams",
"=",
"append",
"(",
"invalidParams",
",",
"name",
")",
"\n",
"delete",
"(",
"params",
",",
"name",
")",
"\n",
"}",
"\n",
"return",
"mtype",
",",
"params",
",",
"invalidParams",
",",
"err",
"\n",
"}"
] |
5,295 | all-5296 | [
"NonceValueFromRequest",
"validates",
"a",
"nonce",
"in",
"the",
"given",
"request",
"and",
"returns",
"the",
"validation",
"status",
"."
] | [
"func",
"NonceValueFromRequest",
"(",
"r",
"*",
"http",
".",
"Request",
")",
"NonceStatus",
"{",
"if",
"c",
":=",
"r",
".",
"Context",
"(",
")",
".",
"Value",
"(",
"nonceValueKey",
")",
";",
"c",
"!=",
"nil",
"{",
"if",
"v",
",",
"<mask>",
":=",
"c",
".",
"(",
"NonceStatus",
")",
";",
"ok",
"{",
"return",
"v",
"\n",
"}",
"\n",
"}",
"\n\n",
"return",
"NonceStatus",
"{",
"NonceNotRequested",
"}",
"\n",
"}"
] |
5,296 | all-5297 | [
"UpdateAccount",
"updates",
"an",
"account",
"."
] | [
"func",
"(",
"h",
"*",
"Handler",
")",
"UpdateAccount",
"(",
"tkn",
",",
"account",
",",
"name",
"string",
",",
"isDefault",
",",
"inUse",
"bool",
")",
"error",
"{",
"logger",
":=",
"h",
".",
"logger",
".",
"Add",
"(",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"account",
")",
"\n\n",
"if",
"!",
"h",
".",
"token",
".",
"Check",
"(",
"tkn",
")",
"{",
"logger",
".",
"Warn",
"(",
"\"",
"\"",
")",
"\n",
"return",
"ErrAccessDenied",
"\n",
"}",
"\n\n",
"acc",
":=",
"data",
".",
"Account",
"{",
"}",
"\n",
"err",
":=",
"h",
".",
"findByPrimaryKey",
"(",
"logger",
",",
"ErrAccountNotFound",
",",
"&",
"acc",
",",
"account",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"if",
"<mask>",
"!=",
"\"",
"\"",
"{",
"acc",
".",
"Name",
"=",
"name",
"\n",
"}",
"\n\n",
"acc",
".",
"IsDefault",
"=",
"isDefault",
"\n",
"acc",
".",
"InUse",
"=",
"inUse",
"\n\n",
"return",
"update",
"(",
"logger",
",",
"h",
".",
"db",
".",
"Querier",
",",
"&",
"acc",
")",
"\n",
"}"
] |
5,297 | all-5298 | [
"GetQuery",
"returns",
"the",
"Query",
"field",
"if",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"."
] | [
"func",
"(",
"t",
"*",
"TileDefEvent",
")",
"GetQuery",
"(",
")",
"string",
"{",
"if",
"t",
"==",
"nil",
"||",
"t",
".",
"Query",
"==",
"nil",
"{",
"return",
"\"",
"\"",
"\n",
"}",
"\n",
"return",
"*",
"t",
".",
"<mask>",
"\n",
"}"
] |
5,298 | all-5299 | [
"GetBgcolor",
"returns",
"the",
"Bgcolor",
"field",
"if",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"."
] | [
"func",
"(",
"w",
"*",
"Widget",
")",
"GetBgcolor",
"(",
")",
"<mask>",
"{",
"if",
"w",
"==",
"nil",
"||",
"w",
".",
"Bgcolor",
"==",
"nil",
"{",
"return",
"\"",
"\"",
"\n",
"}",
"\n",
"return",
"*",
"w",
".",
"Bgcolor",
"\n",
"}"
] |
5,299 | all-5300 | [
"Load",
"loads",
"all",
"of",
"the",
"provided",
"properties",
"into",
"l",
".",
"It",
"does",
"not",
"first",
"reset",
"*",
"l",
"to",
"an",
"empty",
"slice",
"."
] | [
"func",
"(",
"l",
"*",
"PropertyList",
")",
"Load",
"(",
"p",
"[",
"]",
"Property",
")",
"error",
"{",
"*",
"l",
"=",
"<mask>",
"(",
"*",
"l",
",",
"p",
"...",
")",
"\n",
"return",
"nil",
"\n",
"}"
] |
Subsets and Splits
No saved queries yet
Save your SQL queries to embed, download, and access them later. Queries will appear here once saved.