id
int32 0
25.3k
| idx
stringlengths 5
9
| nl_tokens
listlengths 1
418
| pl_tokens
listlengths 22
4.98k
|
---|---|---|---|
21,400 | all-21401 | [
"Asset",
"loads",
"and",
"returns",
"the",
"asset",
"for",
"the",
"given",
"name",
".",
"It",
"returns",
"an",
"error",
"if",
"the",
"asset",
"could",
"not",
"be",
"found",
"or",
"could",
"not",
"be",
"loaded",
"."
] | [
"func",
"<mask>",
"(",
"name",
"string",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"if",
"f",
",",
"ok",
":=",
"_bindata",
"[",
"name",
"]",
";",
"ok",
"{",
"return",
"f",
"(",
")",
"\n",
"}",
"\n",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"name",
")",
"\n",
"}"
] |
21,401 | all-21402 | [
"Generate",
"-",
"used",
"to",
"generate",
"a",
"struct",
"for",
"a",
"given",
"job"
] | [
"func",
"Generate",
"(",
"packagename",
"string",
",",
"fileBytes",
"[",
"]",
"byte",
",",
"outputDir",
"string",
")",
"{",
"b",
":=",
"preprocessJobManifest",
"(",
"fileBytes",
")",
"\n",
"objects",
":=",
"make",
"(",
"map",
"[",
"string",
"]",
"map",
"[",
"string",
"]",
"ObjectField",
")",
"\n",
"var",
"properties",
"[",
"]",
"string",
"\n",
"for",
"_",
",",
"v",
":=",
"range",
"b",
".",
"recs",
"{",
"properties",
"=",
"append",
"(",
"properties",
",",
"v",
".",
"Orig",
")",
"\n",
"}",
"\n",
"for",
"i",
":=",
"0",
";",
"i",
"<",
"b",
".",
"max",
";",
"i",
"++",
"{",
"for",
"_",
",",
"v",
":=",
"range",
"b",
".",
"recs",
"{",
"if",
"v",
".",
"Length",
"-",
"1",
">=",
"i",
"{",
"var",
"structname",
"=",
"v",
".",
"StructName",
"(",
"i",
",",
"packagename",
",",
"properties",
")",
"\n",
"var",
"typeName",
"=",
"v",
".",
"TypeName",
"(",
"i",
",",
"properties",
")",
"\n",
"elementName",
":=",
"v",
".",
"Slice",
"[",
"i",
"]",
"\n",
"attributeName",
":=",
"FormatName",
"(",
"elementName",
")",
"\n\n",
"if",
"_",
",",
"ok",
":=",
"objects",
"[",
"structname",
"]",
";",
"!",
"ok",
"{",
"objects",
"[",
"structname",
"]",
"=",
"make",
"(",
"map",
"[",
"string",
"]",
"ObjectField",
")",
"\n",
"}",
"\n\n",
"if",
"previousElement",
",",
"ok",
":=",
"<mask>",
"[",
"structname",
"]",
"[",
"attributeName",
"]",
";",
"!",
"ok",
"{",
"lo",
".",
"G",
".",
"Debug",
"(",
"\"",
"\"",
",",
"attributeName",
",",
"\"",
"\"",
",",
"structname",
",",
"\"",
"\"",
",",
"typeName",
")",
"\n",
"objects",
"[",
"structname",
"]",
"[",
"attributeName",
"]",
"=",
"ObjectField",
"{",
"ElementName",
":",
"attributeName",
",",
"ElementType",
":",
"typeName",
",",
"ElementAnnotation",
":",
"createElementAnnotation",
"(",
"elementName",
")",
",",
"Meta",
":",
"v",
".",
"Yaml",
",",
"}",
"\n",
"}",
"else",
"{",
"if",
"previousElement",
".",
"ElementAnnotation",
"!=",
"createElementAnnotation",
"(",
"elementName",
")",
"{",
"lo",
".",
"G",
".",
"Warning",
"(",
"\"",
"\"",
",",
"structname",
",",
"\"",
"\"",
",",
"attributeName",
",",
"\"",
"\"",
")",
"\n",
"previousElement",
".",
"ElementAnnotation",
"=",
"\"",
"\\\"",
"\\\"",
"\"",
"\n",
"objects",
"[",
"structname",
"]",
"[",
"attributeName",
"]",
"=",
"previousElement",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n",
"structs",
":=",
"generateStructs",
"(",
"objects",
",",
"packagename",
")",
"\n",
"writeStructsToDisk",
"(",
"structs",
",",
"outputDir",
")",
"\n",
"}"
] |
21,402 | all-21403 | [
"newImageDestination",
"sets",
"us",
"up",
"to",
"write",
"a",
"new",
"image",
"caching",
"blobs",
"in",
"a",
"temporary",
"directory",
"until",
"it",
"s",
"time",
"to",
"Commit",
"()",
"the",
"image"
] | [
"func",
"newImageDestination",
"(",
"imageRef",
"storageReference",
")",
"(",
"*",
"storageImageDestination",
",",
"error",
")",
"{",
"directory",
",",
"err",
":=",
"ioutil",
".",
"TempDir",
"(",
"tmpdir",
".",
"TemporaryDirectoryForBigFiles",
"(",
")",
",",
"\"",
"\"",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"errors",
".",
"Wrapf",
"(",
"err",
",",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"image",
":=",
"&",
"storageImageDestination",
"{",
"imageRef",
":",
"imageRef",
",",
"directory",
":",
"directory",
",",
"blobDiffIDs",
":",
"make",
"(",
"map",
"[",
"digest",
".",
"Digest",
"]",
"digest",
".",
"Digest",
")",
",",
"fileSizes",
":",
"make",
"(",
"<mask>",
"[",
"digest",
".",
"Digest",
"]",
"int64",
")",
",",
"filenames",
":",
"make",
"(",
"map",
"[",
"digest",
".",
"Digest",
"]",
"string",
")",
",",
"SignatureSizes",
":",
"[",
"]",
"int",
"{",
"}",
",",
"}",
"\n",
"return",
"image",
",",
"nil",
"\n",
"}"
] |
21,403 | all-21404 | [
"formatPointer",
"prints",
"the",
"address",
"of",
"the",
"pointer",
"."
] | [
"func",
"formatPointer",
"(",
"v",
"reflect",
".",
"<mask>",
")",
"string",
"{",
"p",
":=",
"v",
".",
"Pointer",
"(",
")",
"\n",
"if",
"flags",
".",
"Deterministic",
"{",
"p",
"=",
"0xdeadf00f",
"// Only used for stable testing purposes",
"\n",
"}",
"\n",
"return",
"fmt",
".",
"Sprintf",
"(",
"\"",
")",
"",
"",
"",
"\n",
"}"
] |
21,404 | all-21405 | [
"newBuffersFromFiles",
"wraps",
"the",
"specified",
"files",
"with",
"a",
"reader",
"that",
"caches",
"data",
"into",
"a",
"memory",
"buffer"
] | [
"func",
"newBuffersFromFiles",
"(",
"files",
"[",
"]",
"File",
")",
"[",
"]",
"fileBuffer",
"{",
"buffers",
":=",
"make",
"(",
"[",
"]",
"fileBuffer",
",",
"0",
",",
"len",
"(",
"<mask>",
")",
")",
"\n",
"for",
"_",
",",
"file",
":=",
"range",
"files",
"{",
"buffers",
"=",
"append",
"(",
"buffers",
",",
"newFileBuffer",
"(",
"file",
")",
")",
"\n",
"}",
"\n",
"return",
"buffers",
"\n",
"}"
] |
21,405 | all-21406 | [
"UnmarshalJSON",
"implements",
"the",
"json",
".",
"Unmarshaler",
"interface"
] | [
"func",
"(",
"s",
"*",
"untrustedSignature",
")",
"UnmarshalJSON",
"(",
"data",
"[",
"]",
"byte",
")",
"error",
"{",
"err",
":=",
"s",
".",
"strictUnmarshalJSON",
"(",
"data",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"if",
"_",
",",
"ok",
":=",
"err",
".",
"(",
"jsonFormatError",
")",
";",
"ok",
"{",
"err",
"=",
"InvalidSignatureError",
"{",
"<mask>",
":",
"err",
".",
"Error",
"(",
")",
"}",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"err",
"\n",
"}"
] |
21,406 | all-21407 | [
"SupportedFunc",
"returns",
"a",
"function",
"that",
"checks",
"if",
"the",
"server",
"can",
"support",
"a",
"specific",
"request",
"."
] | [
"func",
"SupportedFunc",
"(",
"opts",
"*",
"ServerOptions",
")",
"func",
"(",
"*",
"Request",
")",
"error",
"{",
"subjectMap",
":=",
"map",
"[",
"SubjectType",
"]",
"bool",
"{",
"}",
"\n",
"for",
"_",
",",
"subjectType",
":=",
"range",
"opts",
".",
"SubjectTypes",
"{",
"subjectMap",
"[",
"subjectType",
"]",
"=",
"true",
"\n",
"}",
"\n",
"identityMap",
":=",
"map",
"[",
"string",
"]",
"bool",
"{",
"}",
"\n",
"for",
"_",
",",
"identity",
":=",
"range",
"opts",
".",
"Identities",
"{",
"identityMap",
"[",
"string",
"(",
"identity",
".",
"Type",
")",
"+",
"string",
"(",
"identity",
".",
"Format",
")",
"]",
"=",
"true",
"\n",
"}",
"\n",
"return",
"func",
"(",
"req",
"*",
"Request",
")",
"error",
"{",
"if",
"_",
",",
"ok",
":=",
"subjectMap",
"[",
"req",
".",
"SubjectRequestType",
"]",
";",
"!",
"ok",
"{",
"return",
"ErrUnsupportedRequestType",
"(",
"req",
".",
"SubjectRequestType",
")",
"\n",
"}",
"\n",
"for",
"_",
",",
"identity",
":=",
"range",
"req",
".",
"SubjectIdentities",
"{",
"if",
"_",
",",
"ok",
":=",
"identityMap",
"[",
"string",
"(",
"identity",
".",
"<mask>",
")",
"+",
"string",
"(",
"identity",
".",
"Format",
")",
"]",
";",
"!",
"ok",
"{",
"return",
"ErrUnsupportedIdentity",
"(",
"identity",
")",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}",
"\n",
"}"
] |
21,407 | all-21408 | [
"newCommitment",
"returns",
"an",
"commitment",
"struct",
"that",
"notifies",
"the",
"provided",
"channel",
"when",
"log",
"entries",
"have",
"been",
"committed",
".",
"A",
"new",
"commitment",
"struct",
"is",
"created",
"each",
"time",
"this",
"server",
"becomes",
"leader",
"for",
"a",
"particular",
"term",
".",
"configuration",
"is",
"the",
"servers",
"in",
"the",
"cluster",
".",
"startIndex",
"is",
"the",
"first",
"index",
"created",
"in",
"this",
"term",
"(",
"see",
"its",
"description",
"above",
")",
"."
] | [
"func",
"newCommitment",
"(",
"commitCh",
"chan",
"struct",
"{",
"}",
",",
"configuration",
"Configuration",
",",
"startIndex",
"uint64",
")",
"*",
"commitment",
"{",
"matchIndexes",
":=",
"make",
"(",
"map",
"[",
"ServerID",
"]",
"uint64",
")",
"\n",
"for",
"_",
",",
"server",
":=",
"range",
"configuration",
".",
"Servers",
"{",
"if",
"<mask>",
".",
"Suffrage",
"==",
"Voter",
"{",
"matchIndexes",
"[",
"server",
".",
"ID",
"]",
"=",
"0",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"&",
"commitment",
"{",
"commitCh",
":",
"commitCh",
",",
"matchIndexes",
":",
"matchIndexes",
",",
"commitIndex",
":",
"0",
",",
"startIndex",
":",
"startIndex",
",",
"}",
"\n",
"}"
] |
21,408 | all-21409 | [
"title",
":",
"service",
"instance",
"update",
"path",
":",
"/",
"services",
"/",
"{",
"service",
"}",
"/",
"instances",
"/",
"{",
"instance",
"}",
"method",
":",
"PUT",
"consume",
":",
"application",
"/",
"x",
"-",
"www",
"-",
"form",
"-",
"urlencoded",
"responses",
":",
"200",
":",
"Service",
"instance",
"updated",
"400",
":",
"Invalid",
"data",
"401",
":",
"Unauthorized",
"404",
":",
"Service",
"instance",
"not",
"found"
] | [
"func",
"updateServiceInstance",
"(",
"w",
"http",
".",
"ResponseWriter",
",",
"r",
"*",
"http",
".",
"Request",
",",
"t",
"auth",
".",
"Token",
")",
"(",
"err",
"error",
")",
"{",
"serviceName",
":=",
"r",
".",
"URL",
".",
"Query",
"(",
")",
".",
"Get",
"(",
"\"",
"\"",
")",
"\n",
"instanceName",
":=",
"r",
".",
"URL",
".",
"Query",
"(",
")",
".",
"Get",
"(",
"\"",
"\"",
")",
"\n",
"updateData",
":=",
"struct",
"{",
"Description",
"string",
"\n",
"Plan",
"string",
"\n",
"TeamOwner",
"string",
"\n",
"Tags",
"[",
"]",
"string",
"\n",
"}",
"{",
"}",
"\n",
"err",
"=",
"ParseInput",
"(",
"r",
",",
"&",
"updateData",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"tags",
",",
"_",
":=",
"InputValues",
"(",
"r",
",",
"\"",
"\"",
")",
"\n",
"updateData",
".",
"Tags",
"=",
"append",
"(",
"updateData",
".",
"Tags",
",",
"tags",
"...",
")",
"// for compatibility",
"\n",
"srv",
",",
"err",
":=",
"getService",
"(",
"serviceName",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"si",
",",
"err",
":=",
"getServiceInstanceOrError",
"(",
"serviceName",
",",
"instanceName",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"var",
"wantedPerms",
"[",
"]",
"*",
"permission",
".",
"PermissionScheme",
"\n",
"if",
"updateData",
".",
"<mask>",
"!=",
"\"",
"\"",
"{",
"wantedPerms",
"=",
"append",
"(",
"wantedPerms",
",",
"permission",
".",
"PermServiceInstanceUpdateDescription",
")",
"\n",
"si",
".",
"Description",
"=",
"updateData",
".",
"Description",
"\n",
"}",
"\n",
"if",
"updateData",
".",
"TeamOwner",
"!=",
"\"",
"\"",
"{",
"wantedPerms",
"=",
"append",
"(",
"wantedPerms",
",",
"permission",
".",
"PermServiceInstanceUpdateTeamowner",
")",
"\n",
"si",
".",
"TeamOwner",
"=",
"updateData",
".",
"TeamOwner",
"\n",
"}",
"\n",
"if",
"updateData",
".",
"Tags",
"!=",
"nil",
"{",
"wantedPerms",
"=",
"append",
"(",
"wantedPerms",
",",
"permission",
".",
"PermServiceInstanceUpdateTags",
")",
"\n",
"si",
".",
"Tags",
"=",
"updateData",
".",
"Tags",
"\n",
"}",
"\n",
"if",
"updateData",
".",
"Plan",
"!=",
"\"",
"\"",
"{",
"wantedPerms",
"=",
"append",
"(",
"wantedPerms",
",",
"permission",
".",
"PermServiceInstanceUpdatePlan",
")",
"\n",
"si",
".",
"PlanName",
"=",
"updateData",
".",
"Plan",
"\n",
"}",
"\n",
"if",
"len",
"(",
"wantedPerms",
")",
"==",
"0",
"{",
"return",
"&",
"tsuruErrors",
".",
"HTTP",
"{",
"Code",
":",
"http",
".",
"StatusBadRequest",
",",
"Message",
":",
"\"",
"\"",
",",
"}",
"\n",
"}",
"\n",
"for",
"_",
",",
"perm",
":=",
"range",
"wantedPerms",
"{",
"allowed",
":=",
"permission",
".",
"Check",
"(",
"t",
",",
"perm",
",",
"contextsForServiceInstance",
"(",
"si",
",",
"serviceName",
")",
"...",
",",
")",
"\n",
"if",
"!",
"allowed",
"{",
"return",
"permission",
".",
"ErrUnauthorized",
"\n",
"}",
"\n",
"}",
"\n",
"evt",
",",
"err",
":=",
"event",
".",
"New",
"(",
"&",
"event",
".",
"Opts",
"{",
"Target",
":",
"serviceInstanceTarget",
"(",
"serviceName",
",",
"instanceName",
")",
",",
"Kind",
":",
"permission",
".",
"PermServiceInstanceUpdate",
",",
"Owner",
":",
"t",
",",
"CustomData",
":",
"event",
".",
"FormToCustomData",
"(",
"InputFields",
"(",
"r",
")",
")",
",",
"Allowed",
":",
"event",
".",
"Allowed",
"(",
"permission",
".",
"PermServiceInstanceReadEvents",
",",
"contextsForServiceInstance",
"(",
"si",
",",
"serviceName",
")",
"...",
")",
",",
"}",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"defer",
"func",
"(",
")",
"{",
"evt",
".",
"Done",
"(",
"err",
")",
"}",
"(",
")",
"\n",
"requestID",
":=",
"requestIDHeader",
"(",
"r",
")",
"\n",
"return",
"si",
".",
"Update",
"(",
"srv",
",",
"*",
"si",
",",
"evt",
",",
"requestID",
")",
"\n",
"}"
] |
21,409 | all-21410 | [
"HasMonitor",
"returns",
"a",
"boolean",
"if",
"a",
"field",
"has",
"been",
"set",
"."
] | [
"func",
"(",
"w",
"*",
"Widget",
")",
"HasMonitor",
"(",
")",
"bool",
"{",
"if",
"w",
"!=",
"nil",
"&&",
"w",
".",
"Monitor",
"!=",
"nil",
"{",
"return",
"<mask>",
"\n",
"}",
"\n\n",
"return",
"false",
"\n",
"}"
] |
21,410 | all-21411 | [
"WrapHTMLF",
"is",
"the",
"filter",
"form",
"of",
"WrapHTML",
"."
] | [
"func",
"WrapHTMLF",
"(",
"tag",
"string",
",",
"attrs",
"map",
"[",
"string",
"]",
"string",
")",
"func",
"(",
"string",
")",
"string",
"{",
"return",
"func",
"(",
"s",
"string",
")",
"string",
"{",
"return",
"WrapHTML",
"(",
"s",
",",
"<mask>",
",",
"attrs",
")",
"\n",
"}",
"\n",
"}"
] |
21,411 | all-21412 | [
"GetPreferredHeight",
"is",
"a",
"wrapper",
"around",
"gtk_widget_get_preferred_height",
"()",
"."
] | [
"func",
"(",
"v",
"*",
"Widget",
")",
"GetPreferredHeight",
"(",
")",
"(",
"int",
",",
"int",
")",
"{",
"<mask>",
"minimum",
",",
"natural",
"C",
".",
"gint",
"\n",
"C",
".",
"gtk_widget_get_preferred_height",
"(",
"v",
".",
"native",
"(",
")",
",",
"&",
"minimum",
",",
"&",
"natural",
")",
"\n",
"return",
"int",
"(",
"minimum",
")",
",",
"int",
"(",
"natural",
")",
"\n",
"}"
] |
21,412 | all-21413 | [
"RenderInto",
"combines",
"Render",
"()",
"and",
"writing",
"its",
"results",
"into",
"an",
"io",
".",
"Writer",
".",
"This",
"is",
"a",
"convenience",
"method",
"for",
"frameworks",
"providing",
"a",
"Writer",
"interface",
"such",
"as",
"net",
"/",
"http",
"s",
"ServeHTTP",
"()"
] | [
"func",
"(",
"tx",
"*",
"Xslate",
")",
"RenderInto",
"(",
"w",
"io",
".",
"Writer",
",",
"template",
"string",
",",
"vars",
"Vars",
")",
"error",
"{",
"bc",
",",
"err",
":=",
"<mask>",
".",
"Loader",
".",
"Load",
"(",
"template",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"tx",
".",
"VM",
".",
"Run",
"(",
"bc",
",",
"vm",
".",
"Vars",
"(",
"vars",
")",
",",
"w",
")",
"\n",
"return",
"nil",
"\n",
"}"
] |
21,413 | all-21414 | [
"Client",
"OAuth",
"authentication",
"requires",
"us",
"to",
"attach",
"an",
"unexpired",
"OAuth",
"token",
"to",
"the",
"request",
"header"
] | [
"func",
"(",
"a",
"clientOAuthAuthentication",
")",
"authenticate",
"(",
"req",
"*",
"http",
".",
"Request",
",",
"endpoint",
"string",
",",
"params",
"[",
"]",
"byte",
")",
"error",
"{",
"// Ensure tokens havent expired",
"if",
"time",
".",
"Now",
"(",
")",
".",
"UTC",
"(",
")",
".",
"Unix",
"(",
")",
">",
"a",
".",
"Tokens",
".",
"ExpireTime",
"{",
"return",
"<mask>",
".",
"New",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"req",
".",
"Header",
".",
"Set",
"(",
"\"",
"\"",
",",
"\"",
"\"",
"+",
"a",
".",
"Tokens",
".",
"AccessToken",
")",
"\n",
"return",
"nil",
"\n",
"}"
] |
21,414 | all-21415 | [
"worker",
"gets",
"a",
"job",
"from",
"the",
"job_pipe",
"passes",
"it",
"to",
"a",
"subworker",
"and",
"puts",
"the",
"job",
"in",
"the",
"done_pipe",
"when",
"finished",
"."
] | [
"func",
"(",
"pool",
"*",
"Pool",
")",
"worker",
"(",
"worker_id",
"uint",
")",
"{",
"job_pipe",
":=",
"make",
"(",
"chan",
"*",
"Job",
")",
"\n",
"WORKER_LOOP",
":",
"for",
"{",
"pool",
".",
"job_wanted_pipe",
"<-",
"job_pipe",
"\n",
"job",
":=",
"<-",
"job_pipe",
"\n",
"if",
"job",
"==",
"nil",
"{",
"time",
".",
"Sleep",
"(",
"pool",
".",
"interval",
"*",
"time",
".",
"Millisecond",
")",
"\n",
"}",
"else",
"{",
"job",
".",
"Worker_id",
"=",
"worker_id",
"\n",
"pool",
".",
"subworker",
"(",
"job",
")",
"\n",
"pool",
".",
"done_pipe",
"<-",
"<mask>",
"\n",
"}",
"\n",
"select",
"{",
"case",
"<-",
"pool",
".",
"worker_kill_pipe",
":",
"break",
"WORKER_LOOP",
"\n",
"default",
":",
"}",
"\n",
"}",
"\n",
"pool",
".",
"worker_wg",
".",
"Done",
"(",
")",
"\n",
"}"
] |
21,415 | all-21416 | [
"/",
"*",
"close",
"video",
"file",
"writer"
] | [
"func",
"(",
"<mask>",
"*",
"VideoWriter",
")",
"Release",
"(",
")",
"{",
"writer_c",
":=",
"(",
"*",
"C",
".",
"CvVideoWriter",
")",
"(",
"writer",
")",
"\n",
"C",
".",
"cvReleaseVideoWriter",
"(",
"&",
"writer_c",
")",
"\n",
"}"
] |
21,416 | all-21417 | [
"GetSetOptionsOp",
"retrieves",
"the",
"SetOptionsOp",
"value",
"from",
"the",
"union",
"returning",
"ok",
"if",
"the",
"union",
"s",
"switch",
"indicated",
"the",
"value",
"is",
"valid",
"."
] | [
"func",
"(",
"u",
"OperationBody",
")",
"GetSetOptionsOp",
"(",
")",
"(",
"result",
"SetOptionsOp",
",",
"ok",
"bool",
")",
"{",
"armName",
",",
"_",
":=",
"u",
".",
"ArmForSwitch",
"(",
"int32",
"(",
"u",
".",
"Type",
")",
")",
"\n\n",
"if",
"armName",
"==",
"\"",
"\"",
"{",
"result",
"=",
"*",
"u",
".",
"SetOptionsOp",
"\n",
"<mask>",
"=",
"true",
"\n",
"}",
"\n\n",
"return",
"\n",
"}"
] |
21,417 | all-21418 | [
"UnmarshalJSON",
"supports",
"json",
".",
"Unmarshaler",
"interface"
] | [
"func",
"(",
"v",
"*",
"EventDomStorageItemAdded",
")",
"UnmarshalJSON",
"(",
"data",
"[",
"]",
"byte",
")",
"error",
"{",
"r",
":=",
"jlexer",
".",
"Lexer",
"{",
"Data",
":",
"<mask>",
"}",
"\n",
"easyjsonC5a4559bDecodeGithubComChromedpCdprotoDomstorage8",
"(",
"&",
"r",
",",
"v",
")",
"\n",
"return",
"r",
".",
"Error",
"(",
")",
"\n",
"}"
] |
21,418 | all-21419 | [
"Unlock",
"a",
"lock",
"again",
"if",
"we",
"owned",
"it",
".",
"Returns",
"any",
"error",
"that",
"happend",
"during",
"release",
"of",
"lock",
"."
] | [
"func",
"(",
"l",
"Lockfile",
")",
"Unlock",
"(",
")",
"error",
"{",
"proc",
",",
"err",
":=",
"l",
".",
"GetOwner",
"(",
")",
"\n",
"<mask>",
"err",
"{",
"case",
"ErrInvalidPid",
",",
"ErrDeadOwner",
":",
"return",
"ErrRogueDeletion",
"\n",
"case",
"nil",
":",
"if",
"proc",
".",
"Pid",
"==",
"os",
".",
"Getpid",
"(",
")",
"{",
"// we really own it, so let's remove it.",
"return",
"os",
".",
"Remove",
"(",
"string",
"(",
"l",
")",
")",
"\n",
"}",
"\n",
"// Not owned by me, so don't delete it.",
"return",
"ErrRogueDeletion",
"\n",
"default",
":",
"// This is an application error or system error.",
"// So give a better error for logging here.",
"if",
"os",
".",
"IsNotExist",
"(",
"err",
")",
"{",
"return",
"ErrRogueDeletion",
"\n",
"}",
"\n",
"// Other errors -> defensively fail and let caller handle this",
"return",
"err",
"\n",
"}",
"\n",
"}"
] |
21,419 | all-21420 | [
"DagPutOptions",
"applies",
"the",
"given",
"options",
"to",
"a",
"DagPutSettings",
"instance",
"."
] | [
"func",
"DagPutOptions",
"(",
"opts",
"...",
"DagPutOption",
")",
"(",
"*",
"DagPutSettings",
",",
"error",
")",
"{",
"options",
":=",
"&",
"DagPutSettings",
"{",
"InputEnc",
":",
"\"",
"\"",
",",
"Kind",
":",
"\"",
"\"",
",",
"Pin",
":",
"\"",
"\"",
",",
"Hash",
":",
"\"",
"\"",
",",
"}",
"\n\n",
"for",
"_",
",",
"<mask>",
":=",
"range",
"opts",
"{",
"err",
":=",
"opt",
"(",
"options",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"options",
",",
"nil",
"\n",
"}"
] |
21,420 | all-21421 | [
"AttachCDDVD",
"attaches",
"a",
"CD",
"/",
"DVD",
"drive",
"to",
"the",
"virtual",
"machine",
"."
] | [
"func",
"(",
"v",
"*",
"VM",
")",
"AttachCDDVD",
"(",
"drive",
"*",
"CDDVDDrive",
")",
"error",
"{",
"if",
"running",
",",
"_",
":=",
"v",
".",
"IsRunning",
"(",
")",
";",
"running",
"{",
"return",
"&",
"Error",
"{",
"<mask>",
":",
"\"",
"\"",
",",
"Code",
":",
"200000",
",",
"Text",
":",
"\"",
"\"",
",",
"}",
"\n",
"}",
"\n\n",
"// Loads VMX file in memory",
"v",
".",
"vmxfile",
".",
"Read",
"(",
")",
"\n",
"model",
":=",
"v",
".",
"vmxfile",
".",
"model",
"\n\n",
"device",
":=",
"vmx",
".",
"Device",
"{",
"}",
"\n",
"if",
"drive",
".",
"Filename",
"!=",
"\"",
"\"",
"{",
"device",
".",
"Filename",
"=",
"drive",
".",
"Filename",
"\n",
"device",
".",
"Type",
"=",
"vmx",
".",
"CDROM_IMAGE",
"\n",
"}",
"else",
"{",
"device",
".",
"Type",
"=",
"vmx",
".",
"CDROM_RAW",
"\n",
"device",
".",
"Autodetect",
"=",
"true",
"\n",
"}",
"\n\n",
"device",
".",
"Present",
"=",
"true",
"\n",
"device",
".",
"StartConnected",
"=",
"true",
"\n\n",
"if",
"drive",
".",
"Bus",
"==",
"\"",
"\"",
"{",
"drive",
".",
"Bus",
"=",
"vmx",
".",
"IDE",
"\n",
"}",
"\n\n",
"switch",
"drive",
".",
"Bus",
"{",
"case",
"vmx",
".",
"IDE",
":",
"model",
".",
"IDEDevices",
"=",
"append",
"(",
"model",
".",
"IDEDevices",
",",
"vmx",
".",
"IDEDevice",
"{",
"Device",
":",
"device",
"}",
")",
"\n",
"case",
"vmx",
".",
"SCSI",
":",
"model",
".",
"SCSIDevices",
"=",
"append",
"(",
"model",
".",
"SCSIDevices",
",",
"vmx",
".",
"SCSIDevice",
"{",
"Device",
":",
"device",
"}",
")",
"\n",
"case",
"vmx",
".",
"SATA",
":",
"model",
".",
"SATADevices",
"=",
"append",
"(",
"model",
".",
"SATADevices",
",",
"vmx",
".",
"SATADevice",
"{",
"Device",
":",
"device",
"}",
")",
"\n",
"default",
":",
"return",
"&",
"Error",
"{",
"Operation",
":",
"\"",
"\"",
",",
"Code",
":",
"200001",
",",
"Text",
":",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\\n",
"\"",
",",
"drive",
".",
"Bus",
")",
",",
"}",
"\n",
"}",
"\n\n",
"return",
"v",
".",
"vmxfile",
".",
"Write",
"(",
")",
"\n",
"}"
] |
21,421 | all-21422 | [
"ReadUint16",
"returns",
"a",
"uint16",
"read",
"from",
"address",
"a",
"of",
"the",
"inferior",
"."
] | [
"func",
"(",
"p",
"*",
"Process",
")",
"ReadUint16",
"(",
"a",
"Address",
")",
"uint16",
"{",
"m",
":=",
"p",
".",
"findMapping",
"(",
"a",
")",
"\n",
"if",
"m",
"==",
"nil",
"{",
"panic",
"(",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"a",
")",
")",
"\n",
"}",
"\n",
"b",
":=",
"m",
".",
"contents",
"[",
"a",
".",
"Sub",
"(",
"m",
".",
"min",
")",
":",
"]",
"\n",
"if",
"len",
"(",
"b",
")",
"<",
"2",
"{",
"var",
"buf",
"[",
"2",
"]",
"byte",
"\n",
"b",
"=",
"buf",
"[",
":",
"]",
"\n",
"p",
".",
"ReadAt",
"(",
"b",
",",
"a",
")",
"\n",
"}",
"\n",
"if",
"p",
".",
"littleEndian",
"{",
"return",
"<mask>",
".",
"LittleEndian",
".",
"Uint16",
"(",
"b",
")",
"\n",
"}",
"\n",
"return",
"binary",
".",
"BigEndian",
".",
"Uint16",
"(",
"b",
")",
"\n",
"}"
] |
21,422 | all-21423 | [
"return",
"parameters",
"of",
"a",
"query",
"object"
] | [
"func",
"GetQueryObjectuiv",
"(",
"<mask>",
"uint32",
",",
"pname",
"uint32",
",",
"params",
"*",
"uint32",
")",
"{",
"C",
".",
"glowGetQueryObjectuiv",
"(",
"gpGetQueryObjectuiv",
",",
"(",
"C",
".",
"GLuint",
")",
"(",
"id",
")",
",",
"(",
"C",
".",
"GLenum",
")",
"(",
"pname",
")",
",",
"(",
"*",
"C",
".",
"GLuint",
")",
"(",
"unsafe",
".",
"Pointer",
"(",
"params",
")",
")",
")",
"\n",
"}"
] |
21,423 | all-21424 | [
"Has",
"returns",
"whether",
"the",
"rate",
"limiter",
"has",
"seen",
"a",
"request",
"for",
"a",
"specific",
"id",
"during",
"the",
"current",
"period",
"."
] | [
"func",
"(",
"r",
"*",
"RateLimiter",
")",
"Has",
"(",
"id",
"string",
")",
"(",
"bool",
",",
"error",
")",
"{",
"hash",
":=",
"r",
".",
"hasher",
".",
"Hash",
"(",
"<mask>",
")",
"\n",
"return",
"r",
".",
"redisClient",
".",
"Exists",
"(",
"hash",
")",
".",
"Result",
"(",
")",
"\n",
"}"
] |
21,424 | all-21425 | [
"TrimBelow",
"returns",
"a",
"slice",
"of",
"the",
"Trace",
"with",
"all",
"entries",
"below",
"pc",
"removed",
"."
] | [
"func",
"(",
"pcs",
"Trace",
")",
"TrimBelow",
"(",
"pc",
"Call",
")",
"Trace",
"{",
"for",
"len",
"(",
"pcs",
")",
">",
"0",
"&&",
"pcs",
"[",
"0",
"]",
"!=",
"<mask>",
"{",
"pcs",
"=",
"pcs",
"[",
"1",
":",
"]",
"\n",
"}",
"\n",
"return",
"pcs",
"\n",
"}"
] |
21,425 | all-21426 | [
"Fill",
"free",
"blocks",
"with",
"a",
"const",
"This",
"can",
"help",
"debugging",
"of",
"memory",
"reclaimer",
"bugs"
] | [
"func",
"debugMarkFree",
"(",
"n",
"*",
"Node",
")",
"{",
"var",
"block",
"[",
"]",
"byte",
"\n",
"l",
":=",
"int",
"(",
"nodeTypes",
"[",
"n",
".",
"level",
"]",
".",
"Size",
"(",
")",
")",
"\n",
"sh",
":=",
"(",
"*",
"reflect",
".",
"SliceHeader",
")",
"(",
"unsafe",
".",
"Pointer",
"(",
"&",
"block",
")",
")",
"\n",
"sh",
".",
"Data",
"=",
"uintptr",
"(",
"unsafe",
".",
"Pointer",
"(",
"n",
")",
")",
"\n",
"sh",
".",
"Len",
"=",
"l",
"\n",
"sh",
".",
"Cap",
"=",
"l",
"\n\n",
"copy",
"(",
"<mask>",
",",
"freeBlockContent",
")",
"\n",
"}"
] |
21,426 | all-21427 | [
"PartialFindItem",
"looks",
"for",
"an",
"item",
"in",
"list",
"which",
"text",
"starts",
"from",
"the",
"given",
"substring",
"by",
"default",
"the",
"search",
"is",
"casesensitive",
".",
"Returns",
"item",
"number",
"in",
"item",
"list",
"or",
"-",
"1",
"if",
"nothing",
"is",
"found",
"."
] | [
"func",
"(",
"l",
"*",
"ListBox",
")",
"PartialFindItem",
"(",
"text",
"string",
",",
"caseSensitive",
"bool",
")",
"int",
"{",
"if",
"!",
"caseSensitive",
"{",
"text",
"=",
"strings",
".",
"ToLower",
"(",
"text",
")",
"\n",
"}",
"\n\n",
"for",
"idx",
",",
"itm",
":=",
"range",
"l",
".",
"items",
"{",
"if",
"caseSensitive",
"{",
"if",
"strings",
".",
"HasPrefix",
"(",
"itm",
",",
"<mask>",
")",
"{",
"return",
"idx",
"\n",
"}",
"\n",
"}",
"else",
"{",
"low",
":=",
"strings",
".",
"ToLower",
"(",
"itm",
")",
"\n",
"if",
"strings",
".",
"HasPrefix",
"(",
"low",
",",
"text",
")",
"{",
"return",
"idx",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n\n",
"return",
"-",
"1",
"\n",
"}"
] |
21,427 | all-21428 | [
"ServeHTTP",
"or",
"remote",
"cache",
"client",
"whatever",
"you",
"like",
"it",
"s",
"the",
"client",
"-",
"side",
"function",
"of",
"the",
"ServeHTTP",
"sends",
"a",
"request",
"to",
"the",
"server",
"-",
"side",
"remote",
"cache",
"Service",
"and",
"sends",
"the",
"cached",
"response",
"to",
"the",
"frontend",
"client",
"it",
"is",
"used",
"only",
"when",
"you",
"achieved",
"something",
"like",
"horizontal",
"scaling",
"(",
"separate",
"machines",
")",
"look",
"..",
"/",
"remote",
"/",
"remote",
".",
"ServeHTTP",
"for",
"more",
"if",
"cache",
"din",
"t",
"find",
"then",
"it",
"sends",
"a",
"POST",
"request",
"and",
"save",
"the",
"bodyHandler",
"s",
"body",
"to",
"the",
"remote",
"cache",
".",
"It",
"takes",
"3",
"parameters",
"the",
"first",
"is",
"the",
"remote",
"address",
"(",
"it",
"s",
"the",
"address",
"you",
"started",
"your",
"http",
"server",
"which",
"handled",
"by",
"the",
"Service",
".",
"ServeHTTP",
")",
"the",
"second",
"is",
"the",
"handler",
"(",
"or",
"the",
"mux",
")",
"you",
"want",
"to",
"cache",
"and",
"the",
"third",
"is",
"the",
"optionally",
"cache",
"expiration",
"which",
"is",
"used",
"to",
"set",
"cache",
"duration",
"of",
"this",
"specific",
"cache",
"entry",
"to",
"the",
"remote",
"cache",
"service",
"if",
"<",
"=",
"minimumAllowedCacheDuration",
"then",
"the",
"server",
"will",
"try",
"to",
"parse",
"from",
"cache",
"-",
"control",
"header",
"client",
"-",
"side",
"function"
] | [
"func",
"(",
"h",
"*",
"ClientHandler",
")",
"ServeHTTP",
"(",
"w",
"http",
".",
"ResponseWriter",
",",
"r",
"*",
"http",
".",
"Request",
")",
"{",
"// check for deniers, if at least one of them return true",
"// for this specific request, then skip the whole cache",
"if",
"!",
"h",
".",
"rule",
".",
"Claim",
"(",
"r",
")",
"{",
"h",
".",
"bodyHandler",
".",
"ServeHTTP",
"(",
"w",
",",
"r",
")",
"\n",
"return",
"\n",
"}",
"\n\n",
"uri",
":=",
"&",
"uri",
".",
"URIBuilder",
"{",
"}",
"\n",
"uri",
".",
"ServerAddr",
"(",
"h",
".",
"remoteHandlerURL",
")",
".",
"ClientURI",
"(",
"r",
".",
"URL",
".",
"RequestURI",
"(",
")",
")",
".",
"ClientMethod",
"(",
"r",
".",
"Method",
")",
"\n\n",
"// set the full url here because below we have other issues, probably net/http bugs",
"request",
",",
"err",
":=",
"<mask>",
".",
"NewRequest",
"(",
"methodGet",
",",
"uri",
".",
"String",
"(",
")",
",",
"nil",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"//// println(\"error when requesting to the remote service: \" + err.Error())",
"// somehing very bad happens, just execute the user's handler and return",
"h",
".",
"bodyHandler",
".",
"ServeHTTP",
"(",
"w",
",",
"r",
")",
"\n",
"return",
"\n",
"}",
"\n\n",
"// println(\"GET Do to the remote cache service with the url: \" + request.URL.String())",
"response",
",",
"err",
":=",
"Client",
".",
"Do",
"(",
"request",
")",
"\n\n",
"if",
"err",
"!=",
"nil",
"||",
"response",
".",
"StatusCode",
"==",
"cfg",
".",
"FailStatus",
"{",
"// if not found on cache, then execute the handler and save the cache to the remote server",
"recorder",
":=",
"AcquireResponseRecorder",
"(",
"w",
")",
"\n",
"defer",
"ReleaseResponseRecorder",
"(",
"recorder",
")",
"\n\n",
"h",
".",
"bodyHandler",
".",
"ServeHTTP",
"(",
"recorder",
",",
"r",
")",
"\n\n",
"// check if it's a valid response, if it's not then just return.",
"if",
"!",
"h",
".",
"rule",
".",
"Valid",
"(",
"recorder",
",",
"r",
")",
"{",
"return",
"\n",
"}",
"\n",
"// save to the remote cache",
"// we re-create the request for any case",
"body",
":=",
"recorder",
".",
"Body",
"(",
")",
"[",
"0",
":",
"]",
"\n",
"if",
"len",
"(",
"body",
")",
"==",
"0",
"{",
"//// println(\"Request: len body is zero, do nothing\")",
"return",
"\n",
"}",
"\n",
"uri",
".",
"StatusCode",
"(",
"recorder",
".",
"StatusCode",
"(",
")",
")",
"\n",
"uri",
".",
"Lifetime",
"(",
"h",
".",
"life",
")",
"\n",
"uri",
".",
"ContentType",
"(",
"recorder",
".",
"ContentType",
"(",
")",
")",
"\n\n",
"request",
",",
"err",
"=",
"http",
".",
"NewRequest",
"(",
"methodPost",
",",
"uri",
".",
"String",
"(",
")",
",",
"bytes",
".",
"NewBuffer",
"(",
"body",
")",
")",
"// yes new buffer every time",
"\n\n",
"// println(\"POST Do to the remote cache service with the url: \" + request.URL.String())",
"if",
"err",
"!=",
"nil",
"{",
"//// println(\"Request: error on method Post of request to the remote: \" + err.Error())",
"return",
"\n",
"}",
"\n",
"// go Client.Do(request)",
"Client",
".",
"Do",
"(",
"request",
")",
"\n",
"}",
"else",
"{",
"// get the status code , content type and the write the response body",
"w",
".",
"Header",
"(",
")",
".",
"Set",
"(",
"cfg",
".",
"ContentTypeHeader",
",",
"response",
".",
"Header",
".",
"Get",
"(",
"cfg",
".",
"ContentTypeHeader",
")",
")",
"\n",
"w",
".",
"WriteHeader",
"(",
"response",
".",
"StatusCode",
")",
"\n",
"responseBody",
",",
"err",
":=",
"ioutil",
".",
"ReadAll",
"(",
"response",
".",
"Body",
")",
"\n",
"response",
".",
"Body",
".",
"Close",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"\n",
"}",
"\n",
"w",
".",
"Write",
"(",
"responseBody",
")",
"\n\n",
"}",
"\n",
"}"
] |
21,428 | all-21429 | [
"CPUResource",
"returns",
"the",
"system",
"CPU",
"information"
] | [
"func",
"CPUResource",
"(",
")",
"(",
"*",
"api",
".",
"ResourcesCPU",
",",
"error",
")",
"{",
"c",
":=",
"api",
".",
"ResourcesCPU",
"{",
"}",
"\n\n",
"threads",
",",
"err",
":=",
"getThreads",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"var",
"cur",
"*",
"api",
".",
"ResourcesCPUSocket",
"\n",
"c",
".",
"Total",
"=",
"uint64",
"(",
"len",
"(",
"threads",
")",
")",
"\n\n",
"for",
"_",
",",
"v",
":=",
"range",
"threads",
"{",
"if",
"uint64",
"(",
"len",
"(",
"c",
".",
"Sockets",
")",
")",
"<=",
"v",
".",
"socketID",
"{",
"c",
".",
"Sockets",
"=",
"append",
"(",
"c",
".",
"Sockets",
",",
"api",
".",
"ResourcesCPUSocket",
"{",
"}",
")",
"\n",
"cur",
"=",
"&",
"c",
".",
"Sockets",
"[",
"v",
".",
"socketID",
"]",
"\n\n",
"// Count the number of cores on the socket",
"// Note that we can't assume sequential core IDs",
"socketCores",
":=",
"map",
"[",
"uint64",
"]",
"bool",
"{",
"}",
"\n",
"for",
"_",
",",
"thread",
":=",
"range",
"threads",
"{",
"if",
"<mask>",
".",
"socketID",
"!=",
"v",
".",
"socketID",
"{",
"continue",
"\n",
"}",
"\n\n",
"socketCores",
"[",
"thread",
".",
"coreID",
"]",
"=",
"true",
"\n",
"}",
"\n",
"cur",
".",
"Cores",
"=",
"uint64",
"(",
"len",
"(",
"socketCores",
")",
")",
"\n",
"}",
"else",
"{",
"cur",
"=",
"&",
"c",
".",
"Sockets",
"[",
"v",
".",
"socketID",
"]",
"\n",
"}",
"\n\n",
"cur",
".",
"Socket",
"=",
"v",
".",
"socketID",
"\n",
"cur",
".",
"NUMANode",
"=",
"v",
".",
"numaNode",
"\n",
"cur",
".",
"Threads",
"++",
"\n",
"cur",
".",
"Name",
"=",
"v",
".",
"name",
"\n",
"cur",
".",
"Vendor",
"=",
"v",
".",
"vendor",
"\n",
"cur",
".",
"Frequency",
"=",
"v",
".",
"frequency",
"\n",
"cur",
".",
"FrequencyTurbo",
"=",
"v",
".",
"frequencyTurbo",
"\n",
"}",
"\n\n",
"return",
"&",
"c",
",",
"nil",
"\n",
"}"
] |
21,429 | all-21430 | [
"title",
":",
"app",
"create",
"path",
":",
"/",
"apps",
"method",
":",
"POST",
"consume",
":",
"application",
"/",
"x",
"-",
"www",
"-",
"form",
"-",
"urlencoded",
"produce",
":",
"application",
"/",
"json",
"responses",
":",
"201",
":",
"App",
"created",
"400",
":",
"Invalid",
"data",
"401",
":",
"Unauthorized",
"403",
":",
"Quota",
"exceeded",
"409",
":",
"App",
"already",
"exists"
] | [
"func",
"createApp",
"(",
"w",
"http",
".",
"ResponseWriter",
",",
"r",
"*",
"http",
".",
"Request",
",",
"t",
"auth",
".",
"Token",
")",
"(",
"err",
"error",
")",
"{",
"var",
"ia",
"inputApp",
"\n",
"err",
"=",
"ParseInput",
"(",
"r",
",",
"&",
"ia",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"a",
":=",
"app",
".",
"App",
"{",
"TeamOwner",
":",
"ia",
".",
"TeamOwner",
",",
"Platform",
":",
"ia",
".",
"Platform",
",",
"Plan",
":",
"appTypes",
".",
"Plan",
"{",
"Name",
":",
"ia",
".",
"Plan",
"}",
",",
"Name",
":",
"ia",
".",
"Name",
",",
"Description",
":",
"ia",
".",
"Description",
",",
"Pool",
":",
"ia",
".",
"Pool",
",",
"RouterOpts",
":",
"ia",
".",
"RouterOpts",
",",
"Router",
":",
"ia",
".",
"Router",
",",
"Tags",
":",
"ia",
".",
"Tags",
",",
"Quota",
":",
"quota",
".",
"UnlimitedQuota",
",",
"}",
"\n",
"tags",
",",
"_",
":=",
"InputValues",
"(",
"r",
",",
"\"",
"\"",
")",
"\n",
"a",
".",
"Tags",
"=",
"append",
"(",
"a",
".",
"Tags",
",",
"tags",
"...",
")",
"// for compatibility",
"\n",
"if",
"a",
".",
"TeamOwner",
"==",
"\"",
"\"",
"{",
"a",
".",
"TeamOwner",
",",
"err",
"=",
"autoTeamOwner",
"(",
"t",
",",
"permission",
".",
"PermAppCreate",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"}",
"\n",
"canCreate",
":=",
"permission",
".",
"Check",
"(",
"t",
",",
"permission",
".",
"PermAppCreate",
",",
"permission",
".",
"<mask>",
"(",
"permTypes",
".",
"CtxTeam",
",",
"a",
".",
"TeamOwner",
")",
",",
")",
"\n",
"if",
"!",
"canCreate",
"{",
"return",
"permission",
".",
"ErrUnauthorized",
"\n",
"}",
"\n",
"u",
",",
"err",
":=",
"auth",
".",
"ConvertNewUser",
"(",
"t",
".",
"User",
"(",
")",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"if",
"a",
".",
"Platform",
"!=",
"\"",
"\"",
"{",
"repo",
",",
"_",
":=",
"image",
".",
"SplitImageName",
"(",
"a",
".",
"Platform",
")",
"\n",
"platform",
",",
"errPlat",
":=",
"servicemanager",
".",
"Platform",
".",
"FindByName",
"(",
"repo",
")",
"\n",
"if",
"errPlat",
"!=",
"nil",
"{",
"return",
"errPlat",
"\n",
"}",
"\n",
"if",
"platform",
".",
"Disabled",
"{",
"canUsePlat",
":=",
"permission",
".",
"Check",
"(",
"t",
",",
"permission",
".",
"PermPlatformUpdate",
")",
"||",
"permission",
".",
"Check",
"(",
"t",
",",
"permission",
".",
"PermPlatformCreate",
")",
"\n",
"if",
"!",
"canUsePlat",
"{",
"return",
"&",
"errors",
".",
"HTTP",
"{",
"Code",
":",
"http",
".",
"StatusBadRequest",
",",
"Message",
":",
"appTypes",
".",
"ErrInvalidPlatform",
".",
"Error",
"(",
")",
"}",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n",
"evt",
",",
"err",
":=",
"event",
".",
"New",
"(",
"&",
"event",
".",
"Opts",
"{",
"Target",
":",
"appTarget",
"(",
"a",
".",
"Name",
")",
",",
"Kind",
":",
"permission",
".",
"PermAppCreate",
",",
"Owner",
":",
"t",
",",
"CustomData",
":",
"event",
".",
"FormToCustomData",
"(",
"InputFields",
"(",
"r",
")",
")",
",",
"Allowed",
":",
"event",
".",
"Allowed",
"(",
"permission",
".",
"PermAppReadEvents",
",",
"contextsForApp",
"(",
"&",
"a",
")",
"...",
")",
",",
"}",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"defer",
"func",
"(",
")",
"{",
"evt",
".",
"Done",
"(",
"err",
")",
"}",
"(",
")",
"\n",
"err",
"=",
"app",
".",
"CreateApp",
"(",
"&",
"a",
",",
"u",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"log",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"if",
"_",
",",
"ok",
":=",
"err",
".",
"(",
"appTypes",
".",
"NoTeamsError",
")",
";",
"ok",
"{",
"return",
"&",
"errors",
".",
"HTTP",
"{",
"Code",
":",
"http",
".",
"StatusBadRequest",
",",
"Message",
":",
"\"",
"\"",
",",
"}",
"\n",
"}",
"\n",
"if",
"e",
",",
"ok",
":=",
"err",
".",
"(",
"*",
"appTypes",
".",
"AppCreationError",
")",
";",
"ok",
"{",
"if",
"e",
".",
"Err",
"==",
"app",
".",
"ErrAppAlreadyExists",
"{",
"return",
"&",
"errors",
".",
"HTTP",
"{",
"Code",
":",
"http",
".",
"StatusConflict",
",",
"Message",
":",
"e",
".",
"Error",
"(",
")",
"}",
"\n",
"}",
"\n",
"if",
"_",
",",
"ok",
":=",
"e",
".",
"Err",
".",
"(",
"*",
"quota",
".",
"QuotaExceededError",
")",
";",
"ok",
"{",
"return",
"&",
"errors",
".",
"HTTP",
"{",
"Code",
":",
"http",
".",
"StatusForbidden",
",",
"Message",
":",
"\"",
"\"",
",",
"}",
"\n",
"}",
"\n",
"}",
"\n",
"if",
"err",
"==",
"appTypes",
".",
"ErrInvalidPlatform",
"{",
"return",
"&",
"errors",
".",
"HTTP",
"{",
"Code",
":",
"http",
".",
"StatusBadRequest",
",",
"Message",
":",
"err",
".",
"Error",
"(",
")",
"}",
"\n",
"}",
"\n",
"return",
"err",
"\n",
"}",
"\n",
"repo",
",",
"err",
":=",
"repository",
".",
"Manager",
"(",
")",
".",
"GetRepository",
"(",
"a",
".",
"Name",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"msg",
":=",
"map",
"[",
"string",
"]",
"interface",
"{",
"}",
"{",
"\"",
"\"",
":",
"\"",
"\"",
",",
"\"",
"\"",
":",
"repo",
".",
"ReadWriteURL",
",",
"}",
"\n",
"addrs",
",",
"err",
":=",
"a",
".",
"GetAddresses",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"if",
"len",
"(",
"addrs",
")",
">",
"0",
"{",
"msg",
"[",
"\"",
"\"",
"]",
"=",
"addrs",
"[",
"0",
"]",
"\n",
"}",
"\n",
"jsonMsg",
",",
"err",
":=",
"json",
".",
"Marshal",
"(",
"msg",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"w",
".",
"Header",
"(",
")",
".",
"Set",
"(",
"\"",
"\"",
",",
"\"",
"\"",
")",
"\n",
"w",
".",
"WriteHeader",
"(",
"http",
".",
"StatusCreated",
")",
"\n",
"w",
".",
"Write",
"(",
"jsonMsg",
")",
"\n",
"return",
"nil",
"\n",
"}"
] |
21,430 | all-21431 | [
"DeleteAll",
"deletes",
"all",
"of",
"the",
"chunks",
"in",
"object",
"storage",
"."
] | [
"func",
"(",
"s",
"*",
"Storage",
")",
"DeleteAll",
"(",
"ctx",
"<mask>",
".",
"Context",
")",
"error",
"{",
"return",
"s",
".",
"objC",
".",
"Walk",
"(",
"ctx",
",",
"s",
".",
"prefix",
",",
"func",
"(",
"hash",
"string",
")",
"error",
"{",
"return",
"s",
".",
"objC",
".",
"Delete",
"(",
"ctx",
",",
"hash",
")",
"\n",
"}",
")",
"\n",
"}"
] |
21,431 | all-21432 | [
"Close",
"is",
"implementation",
"of",
"io",
".",
"Closer",
"s",
"Close",
"."
] | [
"func",
"(",
"s",
"*",
"Stream",
")",
"Close",
"(",
")",
"error",
"{",
"runtime",
".",
"SetFinalizer",
"(",
"s",
",",
"nil",
")",
"\n",
"if",
"<mask>",
":=",
"s",
".",
"decoded",
".",
"Close",
"(",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
] |
21,432 | all-21433 | [
"MustAuth",
"retrieves",
"the",
"Auth",
"value",
"from",
"the",
"union",
"panicing",
"if",
"the",
"value",
"is",
"not",
"set",
"."
] | [
"func",
"(",
"u",
"StellarMessage",
")",
"MustAuth",
"(",
")",
"Auth",
"{",
"val",
",",
"<mask>",
":=",
"u",
".",
"GetAuth",
"(",
")",
"\n\n",
"if",
"!",
"ok",
"{",
"panic",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"return",
"val",
"\n",
"}"
] |
21,433 | all-21434 | [
"schemaDvsHostInfrastructureTrafficResource",
"returns",
"the",
"respective",
"schema",
"keys",
"for",
"the",
"various",
"kinds",
"of",
"network",
"I",
"/",
"O",
"control",
"traffic",
"classes",
".",
"The",
"schema",
"items",
"are",
"generated",
"dynamically",
"off",
"of",
"the",
"list",
"of",
"available",
"traffic",
"classes",
"for",
"the",
"currently",
"supported",
"vSphere",
"API",
".",
"Not",
"all",
"traffic",
"classes",
"may",
"be",
"supported",
"across",
"all",
"DVS",
"and",
"network",
"I",
"/",
"O",
"control",
"versions",
"."
] | [
"func",
"schemaDvsHostInfrastructureTrafficResource",
"(",
")",
"map",
"[",
"string",
"]",
"*",
"schema",
".",
"Schema",
"{",
"s",
":=",
"make",
"(",
"<mask>",
"[",
"string",
"]",
"*",
"schema",
".",
"Schema",
")",
"\n",
"shareLevelFmt",
":=",
"\"",
"\"",
"\n",
"shareCountFmt",
":=",
"\"",
"\"",
"\n",
"maxMbitFmt",
":=",
"\"",
"\"",
"\n",
"resMbitFmt",
":=",
"\"",
"\"",
"\n\n",
"for",
"_",
",",
"class",
":=",
"range",
"infrastructureTrafficClassValues",
"{",
"shareLevelKey",
":=",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"strings",
".",
"ToLower",
"(",
"class",
")",
")",
"\n",
"shareCountKey",
":=",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"strings",
".",
"ToLower",
"(",
"class",
")",
")",
"\n",
"maxMbitKey",
":=",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"strings",
".",
"ToLower",
"(",
"class",
")",
")",
"\n",
"resMbitKey",
":=",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"strings",
".",
"ToLower",
"(",
"class",
")",
")",
"\n\n",
"s",
"[",
"shareLevelKey",
"]",
"=",
"&",
"schema",
".",
"Schema",
"{",
"Type",
":",
"schema",
".",
"TypeString",
",",
"Optional",
":",
"true",
",",
"Computed",
":",
"true",
",",
"Description",
":",
"fmt",
".",
"Sprintf",
"(",
"shareLevelFmt",
",",
"class",
")",
",",
"ValidateFunc",
":",
"validation",
".",
"StringInSlice",
"(",
"sharesLevelAllowedValues",
",",
"false",
")",
",",
"}",
"\n",
"s",
"[",
"shareCountKey",
"]",
"=",
"&",
"schema",
".",
"Schema",
"{",
"Type",
":",
"schema",
".",
"TypeInt",
",",
"Optional",
":",
"true",
",",
"Computed",
":",
"true",
",",
"Description",
":",
"fmt",
".",
"Sprintf",
"(",
"shareCountFmt",
",",
"class",
")",
",",
"ValidateFunc",
":",
"validation",
".",
"IntAtLeast",
"(",
"0",
")",
",",
"}",
"\n",
"s",
"[",
"maxMbitKey",
"]",
"=",
"&",
"schema",
".",
"Schema",
"{",
"Type",
":",
"schema",
".",
"TypeInt",
",",
"Optional",
":",
"true",
",",
"Computed",
":",
"true",
",",
"Description",
":",
"fmt",
".",
"Sprintf",
"(",
"maxMbitFmt",
",",
"class",
")",
",",
"ValidateFunc",
":",
"validation",
".",
"IntAtLeast",
"(",
"-",
"1",
")",
",",
"}",
"\n",
"s",
"[",
"resMbitKey",
"]",
"=",
"&",
"schema",
".",
"Schema",
"{",
"Type",
":",
"schema",
".",
"TypeInt",
",",
"Optional",
":",
"true",
",",
"Computed",
":",
"true",
",",
"Description",
":",
"fmt",
".",
"Sprintf",
"(",
"resMbitFmt",
",",
"class",
")",
",",
"ValidateFunc",
":",
"validation",
".",
"IntAtLeast",
"(",
"-",
"1",
")",
",",
"}",
"\n",
"}",
"\n\n",
"return",
"s",
"\n",
"}"
] |
21,434 | all-21435 | [
"Read",
"meta",
"-",
"info",
"at",
"specified",
"place"
] | [
"func",
"readBlockAt",
"(",
"reader",
"io",
".",
"ReadSeeker",
",",
"offset",
"int64",
")",
"(",
"fileBlock",
",",
"error",
")",
"{",
"var",
"block",
"fileBlock",
"\n",
"_",
",",
"err",
":=",
"reader",
".",
"Seek",
"(",
"offset",
",",
"os",
".",
"SEEK_SET",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"block",
",",
"err",
"\n",
"}",
"\n",
"return",
"block",
",",
"binary",
".",
"Read",
"(",
"reader",
",",
"<mask>",
".",
"LittleEndian",
",",
"&",
"block",
")",
"\n",
"}"
] |
21,435 | all-21436 | [
"GetTypeOk",
"returns",
"a",
"tuple",
"with",
"the",
"Type",
"field",
"if",
"it",
"s",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"and",
"a",
"boolean",
"to",
"check",
"if",
"the",
"value",
"has",
"been",
"set",
"."
] | [
"func",
"(",
"c",
"*",
"CheckStatusDefinition",
")",
"GetTypeOk",
"(",
")",
"(",
"string",
",",
"bool",
")",
"{",
"if",
"c",
"==",
"nil",
"||",
"c",
".",
"Type",
"==",
"nil",
"{",
"return",
"\"",
"\"",
",",
"false",
"\n",
"}",
"\n",
"return",
"*",
"c",
".",
"<mask>",
",",
"true",
"\n",
"}"
] |
21,436 | all-21437 | [
"Free",
"is",
"a",
"wrapper",
"around",
"g_slist_free",
"()",
"."
] | [
"func",
"(",
"v",
"*",
"SList",
")",
"Free",
"(",
")",
"{",
"C",
".",
"g_slist_free",
"(",
"v",
".",
"native",
"(",
")",
")",
"\n",
"v",
".",
"<mask>",
"=",
"nil",
"\n",
"}"
] |
21,437 | all-21438 | [
"HTTPLoggerFunc",
"is",
"simple",
"http",
"access",
"logger"
] | [
"func",
"HTTPLoggerFunc",
"(",
"name",
"string",
",",
"hf",
"http",
".",
"HandlerFunc",
")",
"http",
".",
"<mask>",
"{",
"return",
"glg",
".",
"HTTPLoggerFunc",
"(",
"name",
",",
"hf",
")",
"\n",
"}"
] |
21,438 | all-21439 | [
"Rectangle",
"is",
"a",
"wrapper",
"around",
"cairo_rectangle",
"()",
"."
] | [
"func",
"(",
"v",
"*",
"<mask>",
")",
"Rectangle",
"(",
"x",
",",
"y",
",",
"w",
",",
"h",
"float64",
")",
"{",
"C",
".",
"cairo_rectangle",
"(",
"v",
".",
"native",
"(",
")",
",",
"C",
".",
"double",
"(",
"x",
")",
",",
"C",
".",
"double",
"(",
"y",
")",
",",
"C",
".",
"double",
"(",
"w",
")",
",",
"C",
".",
"double",
"(",
"h",
")",
")",
"\n",
"}"
] |
21,439 | all-21440 | [
"getConn",
"treats",
"inbound",
"and",
"outbound",
"connections",
"as",
"a",
"single",
"virtual",
"list",
"that",
"can",
"be",
"indexed",
".",
"The",
"peer",
"must",
"be",
"read",
"-",
"locked",
"."
] | [
"func",
"(",
"p",
"*",
"Peer",
")",
"getConn",
"(",
"i",
"int",
")",
"*",
"<mask>",
"{",
"inboundLen",
":=",
"len",
"(",
"p",
".",
"inboundConnections",
")",
"\n",
"if",
"i",
"<",
"inboundLen",
"{",
"return",
"p",
".",
"inboundConnections",
"[",
"i",
"]",
"\n",
"}",
"\n\n",
"return",
"p",
".",
"outboundConnections",
"[",
"i",
"-",
"inboundLen",
"]",
"\n",
"}"
] |
21,440 | all-21441 | [
"UnmarshalJSON",
"overrides",
"the",
"logic",
"for",
"parsing",
"the",
"JSON",
"-",
"encoded",
"TaskStatus",
"data"
] | [
"func",
"(",
"ts",
"*",
"TaskStatus",
")",
"UnmarshalJSON",
"(",
"b",
"[",
"]",
"byte",
")",
"error",
"{",
"if",
"strings",
".",
"ToLower",
"(",
"string",
"(",
"b",
")",
")",
"==",
"\"",
"\"",
"{",
"*",
"ts",
"=",
"TaskStatusNone",
"\n",
"return",
"nil",
"\n",
"}",
"\n",
"if",
"b",
"[",
"0",
"]",
"!=",
"'\"'",
"||",
"b",
"[",
"len",
"(",
"b",
")",
"-",
"1",
"]",
"!=",
"'\"'",
"{",
"*",
"ts",
"=",
"TaskStatusNone",
"\n",
"return",
"errors",
".",
"New",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"strStatus",
":=",
"string",
"(",
"b",
"[",
"1",
":",
"len",
"(",
"b",
")",
"-",
"1",
"]",
")",
"\n",
"// 'UNKNOWN' and 'DEAD' for Compatibility with v1.0.0 state files",
"if",
"strStatus",
"==",
"\"",
"\"",
"{",
"*",
"ts",
"=",
"TaskStatusNone",
"\n",
"return",
"nil",
"\n",
"}",
"\n",
"if",
"strStatus",
"==",
"\"",
"\"",
"{",
"*",
"ts",
"=",
"TaskStopped",
"\n",
"return",
"nil",
"\n",
"}",
"\n\n",
"stat",
",",
"ok",
":=",
"taskStatusMap",
"[",
"strStatus",
"]",
"\n",
"if",
"!",
"<mask>",
"{",
"*",
"ts",
"=",
"TaskStatusNone",
"\n",
"return",
"errors",
".",
"New",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"*",
"ts",
"=",
"stat",
"\n",
"return",
"nil",
"\n",
"}"
] |
21,441 | all-21442 | [
"Verify",
"compares",
"data",
"to",
"a",
"signature"
] | [
"func",
"(",
"ePub",
"*",
"ECDSAPublicKey",
")",
"Verify",
"(",
"data",
",",
"sigBytes",
"[",
"]",
"byte",
")",
"(",
"bool",
",",
"error",
")",
"{",
"sig",
":=",
"<mask>",
"(",
"ECDSASig",
")",
"\n",
"if",
"_",
",",
"err",
":=",
"asn1",
".",
"Unmarshal",
"(",
"sigBytes",
",",
"sig",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"false",
",",
"err",
"\n",
"}",
"\n",
"if",
"sig",
"==",
"nil",
"{",
"return",
"false",
",",
"ErrNilSig",
"\n",
"}",
"\n\n",
"hash",
":=",
"sha256",
".",
"Sum256",
"(",
"data",
")",
"\n\n",
"return",
"ecdsa",
".",
"Verify",
"(",
"ePub",
".",
"pub",
",",
"hash",
"[",
":",
"]",
",",
"sig",
".",
"R",
",",
"sig",
".",
"S",
")",
",",
"nil",
"\n",
"}"
] |
21,442 | all-21443 | [
"u",
".",
"offset",
"<",
"=",
"lo",
"<",
"=",
"hi",
"<",
"=",
"u",
".",
"offset",
"+",
"len",
"(",
"u",
".",
"entries",
")"
] | [
"func",
"(",
"u",
"*",
"unstable",
")",
"mustCheckOutOfBounds",
"(",
"lo",
",",
"hi",
"uint64",
")",
"{",
"if",
"lo",
">",
"hi",
"{",
"u",
".",
"logger",
".",
"Panicf",
"(",
"\"",
"\"",
",",
"lo",
",",
"hi",
")",
"\n",
"}",
"\n",
"upper",
":=",
"u",
".",
"offset",
"+",
"uint64",
"(",
"len",
"(",
"u",
".",
"entries",
")",
")",
"\n",
"if",
"lo",
"<",
"u",
".",
"<mask>",
"||",
"hi",
">",
"upper",
"{",
"u",
".",
"logger",
".",
"Panicf",
"(",
"\"",
"\"",
",",
"lo",
",",
"hi",
",",
"u",
".",
"offset",
",",
"upper",
")",
"\n",
"}",
"\n",
"}"
] |
21,443 | all-21444 | [
"AllAlternateNameWithTagAreIA5",
"returns",
"true",
"if",
"all",
"sequence",
"members",
"with",
"the",
"given",
"tag",
"are",
"encoded",
"as",
"IA5",
"strings",
"and",
"false",
"otherwise",
".",
"If",
"it",
"encounters",
"errors",
"parsing",
"asn1",
"err",
"will",
"be",
"non",
"-",
"nil",
"."
] | [
"func",
"AllAlternateNameWithTagAreIA5",
"(",
"ext",
"*",
"pkix",
".",
"Extension",
",",
"tag",
"int",
")",
"(",
"bool",
",",
"error",
")",
"{",
"var",
"seq",
"asn1",
".",
"RawValue",
"\n",
"var",
"err",
"error",
"\n",
"// Unmarshal the extension as a sequence",
"if",
"_",
",",
"err",
"=",
"asn1",
".",
"Unmarshal",
"(",
"ext",
".",
"<mask>",
",",
"&",
"seq",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"false",
",",
"err",
"\n",
"}",
"\n",
"// Ensure the sequence matches what we expect for SAN/IAN",
"if",
"!",
"seq",
".",
"IsCompound",
"||",
"seq",
".",
"Tag",
"!=",
"asn1",
".",
"TagSequence",
"||",
"seq",
".",
"Class",
"!=",
"asn1",
".",
"ClassUniversal",
"{",
"err",
"=",
"asn1",
".",
"StructuralError",
"{",
"Msg",
":",
"\"",
"\"",
"}",
"\n",
"return",
"false",
",",
"err",
"\n",
"}",
"\n\n",
"// Iterate over the sequence and look for items tagged with tag",
"rest",
":=",
"seq",
".",
"Bytes",
"\n",
"for",
"len",
"(",
"rest",
")",
">",
"0",
"{",
"var",
"v",
"asn1",
".",
"RawValue",
"\n",
"rest",
",",
"err",
"=",
"asn1",
".",
"Unmarshal",
"(",
"rest",
",",
"&",
"v",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"false",
",",
"err",
"\n",
"}",
"\n",
"if",
"v",
".",
"Tag",
"==",
"tag",
"{",
"if",
"!",
"IsIA5String",
"(",
"v",
".",
"Bytes",
")",
"{",
"return",
"false",
",",
"nil",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n\n",
"return",
"true",
",",
"nil",
"\n",
"}"
] |
21,444 | all-21445 | [
"Count",
"gets",
"the",
"number",
"of",
"cached",
"values",
"by",
"current",
"instance",
"."
] | [
"func",
"(",
"s",
"*",
"Cache",
")",
"Count",
"(",
")",
"int",
"{",
"if",
"s",
".",
"removeExpired",
"(",
")",
"==",
"raiqub",
".",
"WriteLocked",
"{",
"defer",
"s",
".",
"Unlock",
"(",
")",
"\n",
"}",
"else",
"{",
"defer",
"s",
".",
"RUnlock",
"(",
")",
"\n",
"}",
"\n\n",
"return",
"len",
"(",
"s",
".",
"<mask>",
")",
"\n",
"}"
] |
21,445 | all-21446 | [
"RestoreFromDir",
"cache",
"and",
"input",
"dumps",
"from",
"disk",
"to",
"memory"
] | [
"func",
"(",
"app",
"*",
"App",
")",
"RestoreFromDir",
"(",
"dumpDir",
"string",
",",
"storeFunc",
"func",
"(",
"*",
"points",
".",
"Points",
")",
")",
"{",
"startTime",
":=",
"time",
".",
"Now",
"(",
")",
"\n\n",
"logger",
":=",
"zapwriter",
".",
"Logger",
"(",
"\"",
"\"",
")",
".",
"With",
"(",
"zap",
".",
"String",
"(",
"\"",
"\"",
",",
"dumpDir",
")",
")",
"\n\n",
"defer",
"func",
"(",
")",
"{",
"logger",
".",
"Info",
"(",
"\"",
"\"",
",",
"zap",
".",
"Duration",
"(",
"\"",
"\"",
",",
"time",
".",
"Since",
"(",
"startTime",
")",
")",
",",
")",
"\n",
"}",
"(",
")",
"\n\n",
"files",
",",
"err",
":=",
"ioutil",
".",
"ReadDir",
"(",
"dumpDir",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"logger",
".",
"Error",
"(",
"\"",
"\"",
",",
"zap",
".",
"Error",
"(",
"err",
")",
")",
"\n",
"return",
"\n",
"}",
"\n\n",
"// read files and lazy sorting",
"list",
":=",
"make",
"(",
"[",
"]",
"string",
",",
"0",
")",
"\n\n",
"FilesLoop",
":",
"for",
"_",
",",
"file",
":=",
"range",
"files",
"{",
"if",
"file",
".",
"IsDir",
"(",
")",
"{",
"continue",
"\n",
"}",
"\n\n",
"r",
":=",
"strings",
".",
"Split",
"(",
"file",
".",
"Name",
"(",
")",
",",
"\"",
"\"",
")",
"\n",
"if",
"len",
"(",
"r",
")",
"<",
"3",
"{",
"// {input,cache}.pid.nanotimestamp(.+)?",
"continue",
"\n",
"}",
"\n\n",
"<mask>",
"fileWithSortPrefix",
"string",
"\n\n",
"switch",
"r",
"[",
"0",
"]",
"{",
"case",
"\"",
"\"",
":",
"fileWithSortPrefix",
"=",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"r",
"[",
"2",
"]",
",",
"\"",
"\"",
",",
"file",
".",
"Name",
"(",
")",
")",
"\n",
"case",
"\"",
"\"",
":",
"fileWithSortPrefix",
"=",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"r",
"[",
"2",
"]",
",",
"\"",
"\"",
",",
"file",
".",
"Name",
"(",
")",
")",
"\n",
"default",
":",
"continue",
"FilesLoop",
"\n",
"}",
"\n\n",
"list",
"=",
"append",
"(",
"list",
",",
"fileWithSortPrefix",
")",
"\n",
"}",
"\n\n",
"if",
"len",
"(",
"list",
")",
"==",
"0",
"{",
"logger",
".",
"Info",
"(",
"\"",
"\"",
")",
"\n",
"return",
"\n",
"}",
"\n\n",
"sort",
".",
"Strings",
"(",
"list",
")",
"\n\n",
"for",
"index",
",",
"fileWithSortPrefix",
":=",
"range",
"list",
"{",
"list",
"[",
"index",
"]",
"=",
"strings",
".",
"SplitN",
"(",
"fileWithSortPrefix",
",",
"\"",
"\"",
",",
"2",
")",
"[",
"1",
"]",
"\n",
"}",
"\n\n",
"logger",
".",
"Info",
"(",
"\"",
"\"",
",",
"zap",
".",
"Int",
"(",
"\"",
"\"",
",",
"len",
"(",
"list",
")",
")",
")",
"\n\n",
"for",
"_",
",",
"fn",
":=",
"range",
"list",
"{",
"filename",
":=",
"path",
".",
"Join",
"(",
"dumpDir",
",",
"fn",
")",
"\n",
"app",
".",
"RestoreFromFile",
"(",
"filename",
",",
"storeFunc",
")",
"\n\n",
"err",
"=",
"os",
".",
"Remove",
"(",
"filename",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"logger",
".",
"Error",
"(",
"\"",
"\"",
",",
"zap",
".",
"String",
"(",
"\"",
"\"",
",",
"filename",
")",
",",
"zap",
".",
"Error",
"(",
"err",
")",
")",
"\n",
"}",
"\n",
"}",
"\n",
"}"
] |
21,446 | all-21447 | [
"NewTransportProtocol",
"returns",
"a",
"TransportProtocol",
"from",
"a",
"string",
"in",
"the",
"task"
] | [
"func",
"NewTransportProtocol",
"(",
"protocol",
"string",
")",
"(",
"TransportProtocol",
",",
"error",
")",
"{",
"switch",
"protocol",
"{",
"<mask>",
"tcp",
":",
"return",
"TransportProtocolTCP",
",",
"nil",
"\n",
"case",
"udp",
":",
"return",
"TransportProtocolUDP",
",",
"nil",
"\n",
"default",
":",
"return",
"TransportProtocolTCP",
",",
"errors",
".",
"New",
"(",
"protocol",
"+",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"}"
] |
21,447 | all-21448 | [
"GetClientEmail",
"returns",
"the",
"ClientEmail",
"field",
"if",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"."
] | [
"func",
"(",
"i",
"*",
"IntegrationGCPCreateRequest",
")",
"GetClientEmail",
"(",
")",
"<mask>",
"{",
"if",
"i",
"==",
"nil",
"||",
"i",
".",
"ClientEmail",
"==",
"nil",
"{",
"return",
"\"",
"\"",
"\n",
"}",
"\n",
"return",
"*",
"i",
".",
"ClientEmail",
"\n",
"}"
] |
21,448 | all-21449 | [
"HasFillMin",
"returns",
"a",
"boolean",
"if",
"a",
"field",
"has",
"been",
"set",
"."
] | [
"func",
"(",
"s",
"*",
"Style",
")",
"HasFillMin",
"(",
")",
"bool",
"{",
"if",
"s",
"!=",
"nil",
"&&",
"s",
".",
"FillMin",
"!=",
"nil",
"{",
"return",
"<mask>",
"\n",
"}",
"\n\n",
"return",
"false",
"\n",
"}"
] |
21,449 | all-21450 | [
"MarshalJSON",
"supports",
"json",
".",
"Marshaler",
"interface"
] | [
"func",
"(",
"v",
"GetDOMCountersParams",
")",
"MarshalJSON",
"(",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"w",
":=",
"jwriter",
".",
"Writer",
"{",
"}",
"\n",
"easyjsonC5a4559bEncodeGithubComChromedpCdprotoMemory11",
"(",
"&",
"w",
",",
"v",
")",
"\n",
"return",
"w",
".",
"<mask>",
".",
"BuildBytes",
"(",
")",
",",
"w",
".",
"Error",
"\n",
"}"
] |
21,450 | all-21451 | [
"Substitute",
"returns",
"string",
"with",
"superseded",
"all",
"substrings",
"from",
"provided",
"substitution",
"map",
".",
"Substitution",
"map",
"will",
"be",
"applied",
"in",
"alphabetic",
"order",
".",
"Many",
"passes",
"on",
"one",
"substitution",
"another",
"one",
"could",
"apply",
"."
] | [
"func",
"Substitute",
"(",
"s",
"string",
",",
"sub",
"<mask>",
"[",
"string",
"]",
"string",
")",
"(",
"buf",
"string",
")",
"{",
"buf",
"=",
"s",
"\n",
"var",
"keys",
"[",
"]",
"string",
"\n",
"for",
"k",
":=",
"range",
"sub",
"{",
"keys",
"=",
"append",
"(",
"keys",
",",
"k",
")",
"\n",
"}",
"\n",
"sort",
".",
"Strings",
"(",
"keys",
")",
"\n\n",
"for",
"_",
",",
"key",
":=",
"range",
"keys",
"{",
"buf",
"=",
"strings",
".",
"Replace",
"(",
"buf",
",",
"key",
",",
"sub",
"[",
"key",
"]",
",",
"-",
"1",
")",
"\n",
"}",
"\n",
"return",
"\n",
"}"
] |
21,451 | all-21452 | [
"NewTypeRegistry",
"creates",
"a",
"type",
"registry",
"."
] | [
"func",
"NewTypeRegistry",
"(",
")",
"*",
"TypeRegistry",
"{",
"return",
"&",
"TypeRegistry",
"{",
"NamedTypes",
":",
"make",
"(",
"map",
"[",
"string",
"]",
"*",
"gen",
".",
"ObjectDataType",
")",
",",
"InlineTypes",
":",
"<mask>",
"(",
"map",
"[",
"string",
"]",
"[",
"]",
"*",
"gen",
".",
"ObjectDataType",
")",
",",
"}",
"\n",
"}"
] |
21,452 | all-21453 | [
"GetDashboards",
"returns",
"a",
"list",
"of",
"all",
"dashboards",
"created",
"on",
"this",
"account",
"."
] | [
"func",
"(",
"client",
"*",
"Client",
")",
"GetDashboards",
"(",
")",
"(",
"[",
"]",
"DashboardLite",
",",
"error",
")",
"{",
"var",
"<mask>",
"reqGetDashboards",
"\n",
"if",
"err",
":=",
"client",
".",
"doJsonRequest",
"(",
"\"",
"\"",
",",
"\"",
"\"",
",",
"nil",
",",
"&",
"out",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"return",
"out",
".",
"Dashboards",
",",
"nil",
"\n",
"}"
] |
21,453 | all-21454 | [
"copy",
"a",
"one",
"-",
"dimensional",
"texture",
"subimage"
] | [
"func",
"CopyTexSubImage1D",
"(",
"target",
"uint32",
",",
"level",
"int32",
",",
"xoffset",
"int32",
",",
"x",
"int32",
",",
"y",
"int32",
",",
"width",
"int32",
")",
"{",
"C",
".",
"glowCopyTexSubImage1D",
"(",
"gpCopyTexSubImage1D",
",",
"(",
"C",
".",
"GLenum",
")",
"(",
"target",
")",
",",
"(",
"C",
".",
"GLint",
")",
"(",
"level",
")",
",",
"(",
"C",
".",
"GLint",
")",
"(",
"xoffset",
")",
",",
"(",
"C",
".",
"GLint",
")",
"(",
"x",
")",
",",
"(",
"C",
".",
"GLint",
")",
"(",
"y",
")",
",",
"(",
"C",
".",
"GLsizei",
")",
"(",
"<mask>",
")",
")",
"\n",
"}"
] |
21,454 | all-21455 | [
"UnmarshalJSON",
"supports",
"json",
".",
"Unmarshaler",
"interface"
] | [
"func",
"(",
"v",
"*",
"ReplaySnapshotReturns",
")",
"UnmarshalJSON",
"(",
"data",
"[",
"]",
"byte",
")",
"error",
"{",
"r",
":=",
"jlexer",
".",
"Lexer",
"{",
"Data",
":",
"data",
"}",
"\n",
"easyjsonC5a4559bDecodeGithubComChromedpCdprotoLayertree4",
"(",
"&",
"r",
",",
"v",
")",
"\n",
"return",
"r",
".",
"<mask>",
"(",
")",
"\n",
"}"
] |
21,455 | all-21456 | [
"GetContainerLogfile",
"returns",
"the",
"content",
"of",
"the",
"requested",
"logfile",
"Note",
"that",
"it",
"s",
"the",
"caller",
"s",
"responsibility",
"to",
"close",
"the",
"returned",
"ReadCloser"
] | [
"func",
"(",
"r",
"*",
"ProtocolLXD",
")",
"GetContainerLogfile",
"(",
"name",
"string",
",",
"filename",
"string",
")",
"(",
"io",
".",
"ReadCloser",
",",
"error",
")",
"{",
"// Prepare the HTTP request",
"url",
":=",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"r",
".",
"httpHost",
",",
"url",
".",
"QueryEscape",
"(",
"<mask>",
")",
",",
"url",
".",
"QueryEscape",
"(",
"filename",
")",
")",
"\n\n",
"url",
",",
"err",
":=",
"r",
".",
"setQueryAttributes",
"(",
"url",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"req",
",",
"err",
":=",
"http",
".",
"NewRequest",
"(",
"\"",
"\"",
",",
"url",
",",
"nil",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"// Set the user agent",
"if",
"r",
".",
"httpUserAgent",
"!=",
"\"",
"\"",
"{",
"req",
".",
"Header",
".",
"Set",
"(",
"\"",
"\"",
",",
"r",
".",
"httpUserAgent",
")",
"\n",
"}",
"\n\n",
"// Send the request",
"resp",
",",
"err",
":=",
"r",
".",
"do",
"(",
"req",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"// Check the return value for a cleaner error",
"if",
"resp",
".",
"StatusCode",
"!=",
"http",
".",
"StatusOK",
"{",
"_",
",",
"_",
",",
"err",
":=",
"lxdParseResponse",
"(",
"resp",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"}",
"\n\n",
"return",
"resp",
".",
"Body",
",",
"err",
"\n",
"}"
] |
21,456 | all-21457 | [
"GetYaxis",
"returns",
"the",
"Yaxis",
"field",
"if",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"."
] | [
"func",
"(",
"s",
"*",
"ScatterplotDefinition",
")",
"GetYaxis",
"(",
")",
"WidgetAxis",
"{",
"if",
"s",
"==",
"nil",
"||",
"s",
".",
"Yaxis",
"==",
"nil",
"{",
"return",
"WidgetAxis",
"{",
"}",
"\n",
"}",
"\n",
"<mask>",
"*",
"s",
".",
"Yaxis",
"\n",
"}"
] |
21,457 | all-21458 | [
"Close",
"shuts",
"down",
"this",
"client",
".",
"Until",
"Close",
"returns",
"new",
"updates",
"and",
"errors",
"will",
"be",
"put",
"into",
"the",
"respective",
"channels",
".",
"Note",
"that",
"if",
"no",
"updates",
"are",
"received",
"this",
"function",
"may",
"block",
"for",
"up",
"to",
"one",
"minute",
"which",
"is",
"the",
"time",
"interval",
"for",
"long",
"polling",
"."
] | [
"func",
"(",
"api",
"*",
"TelegramBotAPI",
")",
"Close",
"(",
")",
"{",
"select",
"{",
"case",
"<-",
"api",
".",
"closed",
":",
"return",
"\n",
"<mask>",
":",
"}",
"\n",
"close",
"(",
"api",
".",
"closed",
")",
"\n",
"api",
".",
"wg",
".",
"Wait",
"(",
")",
"\n",
"}"
] |
21,458 | all-21459 | [
"Delete",
"adds",
"the",
"route",
"pattern",
"that",
"matches",
"a",
"DELETE",
"http",
"method",
"to",
"execute",
"the",
"handlerFn",
"http",
".",
"HandlerFunc",
"."
] | [
"func",
"(",
"mx",
"*",
"Mux",
")",
"Delete",
"(",
"pattern",
"string",
",",
"handlerFn",
"http",
".",
"HandlerFunc",
")",
"{",
"mx",
".",
"handle",
"(",
"mDELETE",
",",
"<mask>",
",",
"handlerFn",
")",
"\n",
"}"
] |
21,459 | all-21460 | [
"Do",
"executes",
"Network",
".",
"setCookies",
"against",
"the",
"provided",
"context",
"."
] | [
"func",
"(",
"p",
"*",
"SetCookiesParams",
")",
"Do",
"(",
"ctx",
"context",
".",
"<mask>",
")",
"(",
"err",
"error",
")",
"{",
"return",
"cdp",
".",
"Execute",
"(",
"ctx",
",",
"CommandSetCookies",
",",
"p",
",",
"nil",
")",
"\n",
"}"
] |
21,460 | all-21461 | [
"GetChannel",
"gets",
"or",
"creates",
"new",
"pubsub",
"channel",
"."
] | [
"func",
"(",
"hub",
"*",
"hub",
")",
"getChannel",
"(",
"name",
"string",
")",
"*",
"<mask>",
"{",
"hub",
".",
"Lock",
"(",
")",
"\n",
"defer",
"hub",
".",
"Unlock",
"(",
")",
"\n",
"cn",
",",
"ok",
":=",
"hub",
".",
"channels",
"[",
"name",
"]",
"\n",
"if",
"ok",
"{",
"return",
"cn",
"\n",
"}",
"\n",
"cn",
"=",
"makeChannel",
"(",
"hub",
",",
"name",
")",
"\n",
"hub",
".",
"channels",
"[",
"name",
"]",
"=",
"cn",
"\n",
"go",
"cn",
".",
"start",
"(",
")",
"\n",
"return",
"cn",
"\n",
"}"
] |
21,461 | all-21462 | [
"delete",
"a",
"contiguous",
"group",
"of",
"display",
"lists"
] | [
"func",
"DeleteLists",
"(",
"<mask>",
"uint32",
",",
"xrange",
"int32",
")",
"{",
"syscall",
".",
"Syscall",
"(",
"gpDeleteLists",
",",
"2",
",",
"uintptr",
"(",
"list",
")",
",",
"uintptr",
"(",
"xrange",
")",
",",
"0",
")",
"\n",
"}"
] |
21,462 | all-21463 | [
"GetAggregator",
"returns",
"the",
"Aggregator",
"field",
"if",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"."
] | [
"func",
"(",
"s",
"*",
"ScatterplotRequest",
")",
"GetAggregator",
"(",
")",
"string",
"{",
"if",
"s",
"==",
"nil",
"||",
"s",
".",
"Aggregator",
"==",
"nil",
"{",
"return",
"\"",
"\"",
"\n",
"}",
"\n",
"<mask>",
"*",
"s",
".",
"Aggregator",
"\n",
"}"
] |
21,463 | all-21464 | [
"First",
"yields",
"the",
"first",
"n",
"items",
"that",
"it",
"receives",
"."
] | [
"func",
"First",
"(",
"n",
"int",
")",
"Filter",
"{",
"return",
"FilterFunc",
"(",
"func",
"(",
"arg",
"Arg",
")",
"error",
"{",
"seen",
":=",
"0",
"\n",
"for",
"s",
":=",
"range",
"arg",
".",
"In",
"{",
"if",
"seen",
">=",
"n",
"{",
"break",
"\n",
"}",
"\n",
"arg",
".",
"Out",
"<-",
"s",
"\n",
"<mask>",
"++",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}",
")",
"\n",
"}"
] |
21,464 | all-21465 | [
"MarshalJSON",
"supports",
"json",
".",
"Marshaler",
"interface"
] | [
"func",
"(",
"v",
"GetPartialAXTreeParams",
")",
"MarshalJSON",
"(",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"w",
":=",
"jwriter",
".",
"Writer",
"{",
"}",
"\n",
"easyjsonC5a4559bEncodeGithubComChromedpCdprotoAccessibility6",
"(",
"&",
"w",
",",
"v",
")",
"\n",
"return",
"w",
".",
"Buffer",
".",
"BuildBytes",
"(",
")",
",",
"w",
".",
"<mask>",
"\n",
"}"
] |
21,465 | all-21466 | [
"GetTagReader",
"returns",
"a",
"reader",
"for",
"an",
"object",
"in",
"object",
"store",
"by",
"tag",
"."
] | [
"func",
"(",
"c",
"APIClient",
")",
"GetTagReader",
"(",
"tag",
"string",
")",
"(",
"io",
".",
"ReadCloser",
",",
"error",
")",
"{",
"ctx",
",",
"cancel",
":=",
"context",
".",
"WithCancel",
"(",
"c",
".",
"Ctx",
"(",
")",
")",
"\n",
"getTagClient",
",",
"err",
":=",
"c",
".",
"ObjectAPIClient",
".",
"GetTag",
"(",
"ctx",
",",
"&",
"pfs",
".",
"<mask>",
"{",
"Name",
":",
"tag",
"}",
",",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"grpcutil",
".",
"ScrubGRPC",
"(",
"err",
")",
"\n",
"}",
"\n",
"return",
"grpcutil",
".",
"NewStreamingBytesReader",
"(",
"getTagClient",
",",
"cancel",
")",
",",
"nil",
"\n",
"}"
] |
21,466 | all-21467 | [
"HTML",
"renders",
"the",
"named",
"files",
"using",
"the",
"text",
"/",
"html",
"content",
"type",
"and",
"the",
"github",
".",
"com",
"/",
"gobuffalo",
"/",
"plush",
"package",
"for",
"templating",
".",
"If",
"more",
"than",
"1",
"file",
"is",
"provided",
"the",
"second",
"file",
"will",
"be",
"considered",
"a",
"layout",
"file",
"and",
"the",
"first",
"file",
"will",
"be",
"the",
"content",
"file",
"which",
"will",
"be",
"placed",
"into",
"the",
"layout",
"using",
"<%",
"=",
"yield",
"%",
">",
"."
] | [
"func",
"HTML",
"(",
"names",
"...",
"string",
")",
"Renderer",
"{",
"e",
":=",
"New",
"(",
"<mask>",
"{",
"}",
")",
"\n",
"return",
"e",
".",
"HTML",
"(",
"names",
"...",
")",
"\n",
"}"
] |
21,467 | all-21468 | [
"Info",
"calls",
"UI",
".",
"Info",
"to",
"write",
".",
"Useful",
"when",
"you",
"want",
"separate",
"colors",
"or",
"prefixes",
".",
"InfoPrefix",
"is",
"used",
"to",
"prefix",
"the",
"message",
"."
] | [
"func",
"(",
"ui",
"*",
"PrefixUI",
")",
"Info",
"(",
"message",
"string",
")",
"{",
"if",
"ui",
".",
"InfoPrefix",
"==",
"\"",
"\"",
"{",
"//Lets keep the space if they want one",
"message",
"=",
"ui",
".",
"InfoPrefix",
"+",
"message",
"\n",
"}",
"else",
"if",
"ui",
".",
"InfoPrefix",
"!=",
"\"",
"\"",
"{",
"message",
"=",
"ui",
".",
"InfoPrefix",
"+",
"\"",
"\"",
"+",
"<mask>",
"\n",
"}",
"\n",
"ui",
".",
"UI",
".",
"Info",
"(",
"message",
")",
"\n",
"}"
] |
21,468 | all-21469 | [
"resourceVSphereDatastoreClusterApplyCustomAttributes",
"processes",
"the",
"custom",
"attributes",
"step",
"for",
"both",
"create",
"and",
"update",
"for",
"vsphere_datastore_cluster",
"."
] | [
"func",
"resourceVSphereDatastoreClusterApplyCustomAttributes",
"(",
"d",
"*",
"schema",
".",
"ResourceData",
",",
"meta",
"interface",
"{",
"}",
",",
"pod",
"*",
"object",
".",
"StoragePod",
")",
"error",
"{",
"<mask>",
":=",
"meta",
".",
"(",
"*",
"VSphereClient",
")",
".",
"vimClient",
"\n",
"// Verify a proper vCenter before proceeding if custom attributes are defined",
"attrsProcessor",
",",
"err",
":=",
"customattribute",
".",
"GetDiffProcessorIfAttributesDefined",
"(",
"client",
",",
"d",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"if",
"attrsProcessor",
"==",
"nil",
"{",
"log",
".",
"Printf",
"(",
"\"",
"\"",
",",
"resourceVSphereDatastoreClusterIDString",
"(",
"d",
")",
")",
"\n",
"return",
"nil",
"\n",
"}",
"\n\n",
"log",
".",
"Printf",
"(",
"\"",
"\"",
",",
"resourceVSphereDatastoreClusterIDString",
"(",
"d",
")",
")",
"\n",
"return",
"attrsProcessor",
".",
"ProcessDiff",
"(",
"pod",
")",
"\n",
"}"
] |
21,469 | all-21470 | [
"Do",
"executes",
"CSS",
".",
"takeCoverageDelta",
"against",
"the",
"provided",
"context",
".",
"returns",
":",
"coverage"
] | [
"func",
"(",
"p",
"*",
"TakeCoverageDeltaParams",
")",
"Do",
"(",
"ctx",
"<mask>",
".",
"Context",
")",
"(",
"coverage",
"[",
"]",
"*",
"RuleUsage",
",",
"err",
"error",
")",
"{",
"// execute",
"var",
"res",
"TakeCoverageDeltaReturns",
"\n",
"err",
"=",
"cdp",
".",
"Execute",
"(",
"ctx",
",",
"CommandTakeCoverageDelta",
",",
"nil",
",",
"&",
"res",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"return",
"res",
".",
"Coverage",
",",
"nil",
"\n",
"}"
] |
21,470 | all-21471 | [
"GetRole",
"is",
"a",
"wrapper",
"around",
"gtk_window_get_role",
"()",
"."
] | [
"func",
"(",
"v",
"*",
"Window",
")",
"GetRole",
"(",
")",
"(",
"string",
",",
"error",
")",
"{",
"<mask>",
"stringReturn",
"(",
"C",
".",
"gtk_window_get_role",
"(",
"v",
".",
"native",
"(",
")",
")",
")",
"\n",
"}"
] |
21,471 | all-21472 | [
"NetworkNodes",
"returns",
"the",
"network",
"addresses",
"and",
"exposed",
"ports",
"of",
"current",
"container",
"."
] | [
"func",
"(",
"s",
"*",
"Container",
")",
"NetworkNodes",
"(",
")",
"(",
"[",
"]",
"NetworkNode",
",",
"error",
")",
"{",
"inspect",
",",
"err",
":=",
"s",
".",
"Inspect",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"if",
"len",
"(",
"inspect",
")",
"==",
"0",
"{",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"nodes",
":=",
"make",
"(",
"[",
"]",
"NetworkNode",
",",
"0",
")",
"\n",
"for",
"_",
",",
"i",
":=",
"range",
"inspect",
"{",
"ip",
":=",
"i",
".",
"NetworkSettings",
".",
"IPAddress",
"\n",
"if",
"ip",
"==",
"\"",
"\"",
"{",
"continue",
"\n",
"}",
"\n\n",
"if",
"len",
"(",
"i",
".",
"NetworkSettings",
".",
"Ports",
")",
"==",
"0",
"{",
"nodes",
"=",
"append",
"(",
"nodes",
",",
"NetworkNode",
"{",
"IpAddress",
":",
"ip",
",",
"}",
")",
"\n",
"}",
"else",
"{",
"for",
"k",
",",
"_",
":=",
"range",
"i",
".",
"NetworkSettings",
".",
"Ports",
"{",
"node",
":=",
"NetworkNode",
"{",
"}",
"\n",
"node",
".",
"IpAddress",
"=",
"ip",
"\n",
"node",
".",
"SetFromDocker",
"(",
"k",
")",
"\n",
"nodes",
"=",
"<mask>",
"(",
"nodes",
",",
"node",
")",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n\n",
"return",
"nodes",
",",
"nil",
"\n",
"}"
] |
21,472 | all-21473 | [
"NewCloudFlareProvider",
"initializes",
"a",
"new",
"CloudFlare",
"DNS",
"based",
"Provider",
"."
] | [
"func",
"NewCloudFlareProvider",
"(",
"domainFilter",
"DomainFilter",
",",
"zoneIDFilter",
"ZoneIDFilter",
",",
"zonesPerPage",
"int",
",",
"proxiedByDefault",
"bool",
",",
"dryRun",
"bool",
")",
"(",
"*",
"CloudFlareProvider",
",",
"error",
")",
"{",
"// initialize via API email and API key and returns new API object",
"config",
",",
"err",
":=",
"cloudflare",
".",
"New",
"(",
"os",
".",
"Getenv",
"(",
"\"",
"\"",
")",
",",
"os",
".",
"Getenv",
"(",
"\"",
"\"",
")",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"}",
"\n",
"provider",
":=",
"&",
"CloudFlareProvider",
"{",
"//Client: config,",
"<mask>",
":",
"zoneService",
"{",
"config",
"}",
",",
"domainFilter",
":",
"domainFilter",
",",
"zoneIDFilter",
":",
"zoneIDFilter",
",",
"proxiedByDefault",
":",
"proxiedByDefault",
",",
"DryRun",
":",
"dryRun",
",",
"PaginationOptions",
":",
"cloudflare",
".",
"PaginationOptions",
"{",
"PerPage",
":",
"zonesPerPage",
",",
"Page",
":",
"1",
",",
"}",
",",
"}",
"\n",
"return",
"provider",
",",
"nil",
"\n",
"}"
] |
21,473 | all-21474 | [
"GetRequestID",
"returns",
"a",
"request",
"ID",
"from",
"the",
"given",
"context",
"if",
"one",
"is",
"present",
".",
"Returns",
"the",
"empty",
"string",
"if",
"a",
"request",
"ID",
"cannot",
"be",
"found",
"."
] | [
"func",
"GetRequestID",
"(",
"ctx",
"context",
".",
"Context",
")",
"(",
"string",
",",
"error",
")",
"{",
"if",
"ctx",
"==",
"nil",
"{",
"return",
"\"",
"\"",
",",
"errors",
".",
"New",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"reqID",
",",
"<mask>",
":=",
"ctx",
".",
"Value",
"(",
"contextRequestID",
")",
".",
"(",
"string",
")",
"\n",
"if",
"!",
"ok",
"{",
"return",
"\"",
"\"",
",",
"errors",
".",
"New",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"if",
"len",
"(",
"reqID",
")",
"==",
"0",
"{",
"return",
"\"",
"\"",
",",
"errors",
".",
"New",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"return",
"reqID",
",",
"nil",
"\n",
"}"
] |
21,474 | all-21475 | [
"strip",
"Prefix",
"for",
"every",
"incoming",
"http",
"request"
] | [
"func",
"Prefix",
"(",
"prefix",
"string",
")",
"martini",
".",
"Handler",
"{",
"return",
"func",
"(",
"w",
"http",
".",
"ResponseWriter",
",",
"r",
"*",
"http",
".",
"Request",
")",
"{",
"if",
"prefix",
"==",
"\"",
"\"",
"{",
"return",
"\n",
"}",
"\n",
"if",
"p",
":=",
"strings",
".",
"TrimPrefix",
"(",
"r",
".",
"URL",
".",
"Path",
",",
"prefix",
")",
";",
"len",
"(",
"p",
")",
"<",
"len",
"(",
"r",
".",
"<mask>",
".",
"Path",
")",
"{",
"r",
".",
"URL",
".",
"Path",
"=",
"p",
"\n",
"}",
"else",
"{",
"http",
".",
"NotFound",
"(",
"w",
",",
"r",
")",
"\n",
"}",
"\n",
"}",
"\n",
"}"
] |
21,475 | all-21476 | [
"title",
":",
"register",
"unit",
"path",
":",
"/",
"apps",
"/",
"{",
"app",
"}",
"/",
"units",
"/",
"register",
"method",
":",
"POST",
"consume",
":",
"application",
"/",
"x",
"-",
"www",
"-",
"form",
"-",
"urlencoded",
"produce",
":",
"application",
"/",
"json",
"responses",
":",
"200",
":",
"Ok",
"401",
":",
"Unauthorized",
"404",
":",
"App",
"not",
"found"
] | [
"func",
"registerUnit",
"(",
"w",
"http",
".",
"ResponseWriter",
",",
"r",
"*",
"http",
".",
"Request",
",",
"t",
"auth",
".",
"Token",
")",
"error",
"{",
"appName",
":=",
"r",
".",
"URL",
".",
"Query",
"(",
")",
".",
"Get",
"(",
"\"",
"\"",
")",
"\n",
"a",
",",
"err",
":=",
"app",
".",
"GetByName",
"(",
"appName",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"allowed",
":=",
"permission",
".",
"Check",
"(",
"t",
",",
"permission",
".",
"PermAppUpdateUnitRegister",
",",
"contextsForApp",
"(",
"a",
")",
"...",
",",
")",
"\n",
"if",
"!",
"allowed",
"{",
"return",
"permission",
".",
"ErrUnauthorized",
"\n",
"}",
"\n",
"if",
"isDeployAgentUA",
"(",
"r",
")",
"&&",
"r",
".",
"Header",
".",
"Get",
"(",
"\"",
"\"",
")",
"==",
"\"",
"\"",
"{",
"// Filtering the user-agent is not pretty, but it's safer than doing",
"// the header check for every request, otherwise calling directly the",
"// API would always fail without this header that only makes sense to",
"// the agent.",
"msgError",
":=",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"a",
".",
"GetPlatform",
"(",
")",
")",
"\n",
"return",
"&",
"errors",
".",
"HTTP",
"{",
"Code",
":",
"http",
".",
"StatusBadRequest",
",",
"Message",
":",
"msgError",
"}",
"\n",
"}",
"\n",
"defer",
"r",
".",
"Body",
".",
"Close",
"(",
")",
"\n",
"data",
",",
"err",
":=",
"ioutil",
".",
"ReadAll",
"(",
"r",
".",
"Body",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"val",
",",
"err",
":=",
"url",
".",
"ParseQuery",
"(",
"string",
"(",
"data",
")",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"hostname",
":=",
"val",
".",
"Get",
"(",
"\"",
"\"",
")",
"\n",
"var",
"customData",
"map",
"[",
"string",
"]",
"interface",
"{",
"}",
"\n",
"rawCustomData",
":=",
"val",
".",
"Get",
"(",
"\"",
"\"",
")",
"\n",
"if",
"rawCustomData",
"!=",
"\"",
"\"",
"{",
"err",
"=",
"json",
".",
"Unmarshal",
"(",
"[",
"]",
"byte",
"(",
"rawCustomData",
")",
",",
"&",
"customData",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"}",
"\n",
"err",
"=",
"a",
".",
"RegisterUnit",
"(",
"hostname",
",",
"customData",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"if",
"err",
",",
"ok",
":=",
"err",
".",
"(",
"*",
"provision",
".",
"UnitNotFoundError",
")",
";",
"ok",
"{",
"return",
"&",
"errors",
".",
"HTTP",
"{",
"Code",
":",
"http",
".",
"StatusNotFound",
",",
"<mask>",
":",
"err",
".",
"Error",
"(",
")",
"}",
"\n",
"}",
"\n",
"return",
"err",
"\n",
"}",
"\n",
"return",
"writeEnvVars",
"(",
"w",
",",
"a",
")",
"\n",
"}"
] |
21,476 | all-21477 | [
"Parameter",
"image",
"has",
"type",
"C",
".",
"GLeglImageOES",
"."
] | [
"func",
"EGLImageTargetTextureStorageEXT",
"(",
"texture",
"uint32",
",",
"<mask>",
"unsafe",
".",
"Pointer",
",",
"attrib_list",
"*",
"int32",
")",
"{",
"syscall",
".",
"Syscall",
"(",
"gpEGLImageTargetTextureStorageEXT",
",",
"3",
",",
"uintptr",
"(",
"texture",
")",
",",
"uintptr",
"(",
"image",
")",
",",
"uintptr",
"(",
"unsafe",
".",
"Pointer",
"(",
"attrib_list",
")",
")",
")",
"\n",
"}"
] |
21,477 | all-21478 | [
"MarshalJSON",
"supports",
"json",
".",
"Marshaler",
"interface"
] | [
"func",
"(",
"v",
"StateExplanation",
")",
"MarshalJSON",
"(",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"w",
":=",
"jwriter",
".",
"Writer",
"{",
"}",
"\n",
"easyjsonC5a4559bEncodeGithubComChromedpCdprotoSecurity",
"(",
"&",
"w",
",",
"v",
")",
"\n",
"return",
"w",
".",
"<mask>",
".",
"BuildBytes",
"(",
")",
",",
"w",
".",
"Error",
"\n",
"}"
] |
21,478 | all-21479 | [
"createBindsEnv",
"will",
"do",
"the",
"appropriate",
"formatting",
"to",
"add",
"a",
"new",
"mount",
"in",
"a",
"container",
"s",
"HostConfig",
"and",
"add",
"the",
"metadata",
"file",
"path",
"as",
"an",
"environment",
"variable",
"ECS_CONTAINER_METADATA_FILE",
"We",
"add",
"an",
"additional",
"uuid",
"to",
"the",
"path",
"to",
"ensure",
"it",
"does",
"not",
"conflict",
"with",
"user",
"mounts"
] | [
"func",
"createBindsEnv",
"(",
"binds",
"[",
"]",
"string",
",",
"env",
"[",
"]",
"string",
",",
"dataDirOnHost",
"string",
",",
"metadataDirectoryPath",
"string",
")",
"(",
"[",
"]",
"string",
",",
"[",
"]",
"string",
")",
"{",
"randID",
":=",
"uuid",
".",
"New",
"(",
")",
"\n",
"instanceBind",
":=",
"fmt",
".",
"Sprintf",
"(",
"`%s/%s:%s/%s`",
",",
"dataDirOnHost",
",",
"metadataDirectoryPath",
",",
"mountPoint",
",",
"randID",
")",
"\n",
"metadataEnvVariable",
":=",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"metadataEnvironmentVariable",
",",
"mountPoint",
",",
"randID",
",",
"metadataFile",
")",
"\n",
"binds",
"=",
"append",
"(",
"binds",
",",
"instanceBind",
")",
"\n",
"env",
"=",
"<mask>",
"(",
"env",
",",
"metadataEnvVariable",
")",
"\n",
"return",
"binds",
",",
"env",
"\n",
"}"
] |
21,479 | all-21480 | [
"Grant",
"adds",
"a",
"set",
"of",
"permissions",
"to",
"the",
"permission",
"object",
"on",
"which",
"it",
"is",
"called",
"returning",
"a",
"new",
"permission",
"object",
"."
] | [
"func",
"(",
"p",
"Permissions",
")",
"Grant",
"(",
"n",
"*",
"Permissions",
")",
"(",
"Permissions",
",",
"error",
")",
"{",
"var",
"<mask>",
"Permissions",
"\n",
"var",
"err",
"error",
"\n",
"if",
"n",
"==",
"nil",
"{",
"return",
"p",
",",
"nil",
"\n",
"}",
"\n",
"out",
".",
"KV",
",",
"err",
"=",
"p",
".",
"KV",
".",
"Grant",
"(",
"n",
".",
"KV",
")",
"\n",
"return",
"out",
",",
"err",
"\n",
"}"
] |
21,480 | all-21481 | [
"UpdateSchema",
"updates",
"the",
"schema",
".",
"go",
"file",
"of",
"the",
"cluster",
"and",
"node",
"databases",
"."
] | [
"func",
"UpdateSchema",
"(",
")",
"error",
"{",
"err",
":=",
"cluster",
".",
"SchemaDotGo",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"errors",
".",
"Wrap",
"(",
"err",
",",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"err",
"=",
"node",
".",
"SchemaDotGo",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"<mask>",
".",
"Wrap",
"(",
"err",
",",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"return",
"nil",
"\n",
"}"
] |
21,481 | all-21482 | [
"Setup",
"--",
"allows",
"us",
"to",
"setup",
"our",
"fake",
"server"
] | [
"func",
"(",
"s",
"*",
"HTTPServer",
")",
"Setup",
"(",
")",
"{",
"s",
".",
"Mux",
"=",
"<mask>",
".",
"NewServeMux",
"(",
")",
"\n",
"s",
".",
"Server",
"=",
"httptest",
".",
"NewServer",
"(",
"s",
".",
"Mux",
")",
"\n",
"}"
] |
21,482 | all-21483 | [
"export",
"goTickCallbacks"
] | [
"func",
"goTickCallbacks",
"(",
"widget",
"*",
"C",
".",
"GtkWidget",
",",
"frameClock",
"*",
"C",
".",
"GdkFrameClock",
",",
"userData",
"C",
".",
"gpointer",
")",
"C",
".",
"gboolean",
"{",
"id",
":=",
"int",
"(",
"uintptr",
"(",
"userData",
")",
")",
"\n\n",
"tickCallbackRegistry",
".",
"Lock",
"(",
")",
"\n",
"r",
":=",
"tickCallbackRegistry",
".",
"m",
"[",
"<mask>",
"]",
"\n",
"tickCallbackRegistry",
".",
"Unlock",
"(",
")",
"\n\n",
"return",
"gbool",
"(",
"r",
".",
"fn",
"(",
"wrapWidget",
"(",
"glib",
".",
"Take",
"(",
"unsafe",
".",
"Pointer",
"(",
"widget",
")",
")",
")",
",",
"gdk",
".",
"WrapFrameClock",
"(",
"unsafe",
".",
"Pointer",
"(",
"frameClock",
")",
")",
",",
"r",
".",
"userData",
",",
")",
")",
"\n",
"}"
] |
21,483 | all-21484 | [
"GetString",
"returns",
"the",
"string",
"value",
"of",
"the",
"variant",
"."
] | [
"func",
"(",
"v",
"*",
"Variant",
")",
"GetString",
"(",
")",
"string",
"{",
"var",
"len",
"C",
".",
"gsize",
"\n",
"gc",
":=",
"C",
".",
"g_variant_get_string",
"(",
"v",
".",
"native",
"(",
")",
",",
"&",
"len",
")",
"\n",
"defer",
"C",
".",
"g_free",
"(",
"C",
".",
"gpointer",
"(",
"gc",
")",
")",
"\n",
"return",
"C",
".",
"GoStringN",
"(",
"(",
"*",
"C",
".",
"<mask>",
")",
"(",
"gc",
")",
",",
"(",
"C",
".",
"int",
")",
"(",
"len",
")",
")",
"\n",
"}"
] |
21,484 | all-21485 | [
"Add",
"adds",
"a",
"new",
"group",
".",
"Whether",
"GID",
"is",
"<",
"0",
"it",
"will",
"choose",
"the",
"first",
"id",
"available",
"in",
"the",
"range",
"set",
"in",
"the",
"system",
"configuration",
"."
] | [
"func",
"(",
"g",
"*",
"<mask>",
")",
"Add",
"(",
")",
"(",
"gid",
"int",
",",
"err",
"error",
")",
"{",
"loadConfig",
"(",
")",
"\n\n",
"group",
",",
"err",
":=",
"LookupGroup",
"(",
"g",
".",
"Name",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"if",
"_",
",",
"ok",
":=",
"err",
".",
"(",
"NoFoundError",
")",
";",
"!",
"ok",
"{",
"return",
"0",
",",
"err",
"\n",
"}",
"\n",
"}",
"\n",
"if",
"group",
"!=",
"nil",
"{",
"return",
"0",
",",
"ErrGroupExist",
"\n",
"}",
"\n\n",
"if",
"g",
".",
"Name",
"==",
"\"",
"\"",
"{",
"return",
"0",
",",
"RequiredError",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"var",
"db",
"*",
"dbfile",
"\n",
"if",
"g",
".",
"GID",
"<",
"0",
"{",
"db",
",",
"gid",
",",
"err",
"=",
"nextGUID",
"(",
"g",
".",
"addSystemGroup",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"db",
".",
"close",
"(",
")",
"\n",
"return",
"0",
",",
"err",
"\n",
"}",
"\n",
"g",
".",
"GID",
"=",
"gid",
"\n",
"}",
"else",
"{",
"db",
",",
"err",
"=",
"openDBFile",
"(",
"_GROUP_FILE",
",",
"os",
".",
"O_WRONLY",
"|",
"os",
".",
"O_APPEND",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"\n",
"}",
"\n\n",
"// Check if Id is unique.",
"_",
",",
"err",
"=",
"LookupGID",
"(",
"g",
".",
"GID",
")",
"\n",
"if",
"err",
"==",
"nil",
"{",
"return",
"0",
",",
"IdUsedError",
"(",
"g",
".",
"GID",
")",
"\n",
"}",
"else",
"if",
"_",
",",
"ok",
":=",
"err",
".",
"(",
"NoFoundError",
")",
";",
"!",
"ok",
"{",
"return",
"0",
",",
"err",
"\n",
"}",
"\n",
"}",
"\n\n",
"g",
".",
"password",
"=",
"\"",
"\"",
"\n\n",
"_",
",",
"err",
"=",
"db",
".",
"file",
".",
"WriteString",
"(",
"g",
".",
"String",
"(",
")",
")",
"\n",
"err2",
":=",
"db",
".",
"close",
"(",
")",
"\n",
"if",
"err2",
"!=",
"nil",
"&&",
"err",
"==",
"nil",
"{",
"err",
"=",
"err2",
"\n",
"}",
"\n",
"return",
"\n",
"}"
] |
21,485 | all-21486 | [
"Ping",
"mocks",
"base",
"method"
] | [
"func",
"(",
"m",
"*",
"MockClient",
")",
"Ping",
"(",
"arg0",
"context",
".",
"Context",
")",
"(",
"types",
".",
"Ping",
",",
"error",
")",
"{",
"<mask>",
":=",
"m",
".",
"ctrl",
".",
"Call",
"(",
"m",
",",
"\"",
"\"",
",",
"arg0",
")",
"\n",
"ret0",
",",
"_",
":=",
"ret",
"[",
"0",
"]",
".",
"(",
"types",
".",
"Ping",
")",
"\n",
"ret1",
",",
"_",
":=",
"ret",
"[",
"1",
"]",
".",
"(",
"error",
")",
"\n",
"return",
"ret0",
",",
"ret1",
"\n",
"}"
] |
21,486 | all-21487 | [
"DatabaseSnapshots",
"retrieves",
"a",
"list",
"of",
"all",
"database",
"snapshot"
] | [
"func",
"(",
"c",
"*",
"<mask>",
")",
"DatabaseSnapshots",
"(",
")",
"(",
"[",
"]",
"DatabaseSnapshot",
",",
"error",
")",
"{",
"var",
"database_snapshot",
"[",
"]",
"DatabaseSnapshot",
"\n",
"_",
",",
"err",
":=",
"c",
".",
"MakeApiRequest",
"(",
"\"",
"\"",
",",
"\"",
"\"",
",",
"nil",
",",
"&",
"database_snapshot",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"return",
"database_snapshot",
",",
"err",
"\n",
"}"
] |
21,487 | all-21488 | [
"DelUsersInGroup",
"removes",
"the",
"specific",
"members",
"from",
"a",
"group",
"."
] | [
"func",
"DelUsersInGroup",
"(",
"name",
"string",
",",
"members",
"...",
"string",
")",
"error",
"{",
"if",
"len",
"(",
"members",
")",
"==",
"0",
"{",
"return",
"ErrNoMembers",
"\n",
"}",
"\n",
"for",
"i",
",",
"v",
":=",
"range",
"members",
"{",
"if",
"v",
"==",
"\"",
"\"",
"{",
"return",
"EmptyMemberError",
"(",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"strconv",
".",
"Itoa",
"(",
"i",
")",
")",
")",
"\n",
"}",
"\n",
"}",
"\n\n",
"// Group",
"gr",
",",
"err",
":=",
"LookupGroup",
"(",
"name",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"if",
"err",
"=",
"_delMembers",
"(",
"&",
"gr",
".",
"UserList",
",",
"members",
"...",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"// Shadow group",
"sg",
",",
"err",
":=",
"LookupGShadow",
"(",
"<mask>",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"if",
"err",
"=",
"_delMembers",
"(",
"&",
"sg",
".",
"UserList",
",",
"members",
"...",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"// Editing",
"if",
"err",
"=",
"edit",
"(",
"name",
",",
"gr",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"if",
"err",
"=",
"edit",
"(",
"name",
",",
"sg",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"return",
"nil",
"\n",
"}"
] |
21,488 | all-21489 | [
"InfrastructureClusterClient",
"returns",
"a",
"Kubernetes",
"client",
"for",
"the",
"infrastructure",
"cluster",
"."
] | [
"func",
"(",
"o",
"*",
"ExperimentalKubernetesOptions",
")",
"InfrastructureClusterClient",
"(",
"dryRun",
"bool",
")",
"(",
"kubernetesClient",
"kubernetes",
".",
"Interface",
",",
"err",
"error",
")",
"{",
"if",
"err",
":=",
"o",
".",
"resolve",
"(",
"dryRun",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"if",
"o",
".",
"dryRun",
"{",
"return",
"nil",
",",
"<mask>",
".",
"New",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"return",
"o",
".",
"kubernetesClientsByContext",
"[",
"kube",
".",
"InClusterContext",
"]",
",",
"nil",
"\n",
"}"
] |
21,489 | all-21490 | [
"MutateTransactionEnvelope",
"for",
"TransactionBuilder",
"causes",
"the",
"underylying",
"transaction",
"to",
"be",
"set",
"as",
"the",
"provided",
"envelope",
"s",
"Tx",
"field"
] | [
"func",
"(",
"m",
"*",
"TransactionBuilder",
")",
"MutateTransactionEnvelope",
"(",
"txe",
"*",
"TransactionEnvelopeBuilder",
")",
"error",
"{",
"if",
"m",
".",
"Err",
"!=",
"nil",
"{",
"return",
"m",
".",
"Err",
"\n",
"}",
"\n\n",
"txe",
".",
"E",
".",
"Tx",
"=",
"*",
"m",
".",
"TX",
"\n",
"newChild",
":=",
"*",
"m",
"\n",
"txe",
".",
"<mask>",
"=",
"&",
"newChild",
"\n",
"m",
".",
"TX",
"=",
"&",
"txe",
".",
"E",
".",
"Tx",
"\n",
"return",
"nil",
"\n",
"}"
] |
21,490 | all-21491 | [
"Add",
"is",
"deprecated",
"as",
"of",
"1",
".",
"5",
".",
"0",
"-",
"alpha",
".",
"Note",
"that",
"this",
"doesn",
"t",
"make",
"sense",
"as",
"an",
"operation",
"for",
"affine",
"matrices",
"."
] | [
"func",
"(",
"c",
"*",
"ColorM",
")",
"Add",
"(",
"<mask>",
"ColorM",
")",
"{",
"c",
".",
"impl",
"=",
"c",
".",
"impl",
".",
"Add",
"(",
"other",
".",
"impl",
")",
"\n",
"}"
] |
21,491 | all-21492 | [
"Off",
"disables",
"maintenance",
"."
] | [
"func",
"(",
"s",
"*",
"FileStore",
")",
"Off",
"(",
")",
"(",
"changed",
"bool",
",",
"err",
"error",
")",
"{",
"_",
",",
"err",
"=",
"os",
".",
"Stat",
"(",
"s",
".",
"filename",
")",
"\n",
"if",
"os",
".",
"IsNotExist",
"(",
"err",
")",
"{",
"err",
"=",
"nil",
"\n",
"return",
"\n",
"}",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"\n",
"}",
"\n",
"if",
"err",
"=",
"os",
".",
"Remove",
"(",
"s",
".",
"filename",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"\n",
"}",
"\n",
"changed",
"=",
"<mask>",
"\n",
"return",
"\n",
"}"
] |
21,492 | all-21493 | [
"ExpectFunc",
"returns",
"the",
"first",
"line",
"satisfying",
"the",
"function",
"f",
"."
] | [
"func",
"(",
"ep",
"*",
"ExpectProcess",
")",
"ExpectFunc",
"(",
"f",
"func",
"(",
"string",
")",
"bool",
")",
"(",
"string",
",",
"error",
")",
"{",
"ep",
".",
"mu",
".",
"Lock",
"(",
")",
"\n",
"for",
"{",
"for",
"len",
"(",
"ep",
".",
"lines",
")",
"==",
"0",
"&&",
"ep",
".",
"err",
"==",
"nil",
"{",
"ep",
".",
"cond",
".",
"Wait",
"(",
")",
"\n",
"}",
"\n",
"if",
"len",
"(",
"ep",
".",
"lines",
")",
"==",
"0",
"{",
"break",
"\n",
"}",
"\n",
"l",
":=",
"ep",
".",
"<mask>",
"[",
"0",
"]",
"\n",
"ep",
".",
"lines",
"=",
"ep",
".",
"lines",
"[",
"1",
":",
"]",
"\n",
"if",
"f",
"(",
"l",
")",
"{",
"ep",
".",
"mu",
".",
"Unlock",
"(",
")",
"\n",
"return",
"l",
",",
"nil",
"\n",
"}",
"\n",
"}",
"\n",
"ep",
".",
"mu",
".",
"Unlock",
"(",
")",
"\n",
"return",
"\"",
"\"",
",",
"ep",
".",
"err",
"\n",
"}"
] |
21,493 | all-21494 | [
"Make",
"makes",
"new",
"random",
"token",
"."
] | [
"func",
"(",
"t",
"*",
"SimpleToken",
")",
"Make",
"(",
")",
"(",
"string",
",",
"error",
")",
"{",
"b",
":=",
"make",
"(",
"[",
"]",
"byte",
",",
"32",
")",
"\n",
"_",
",",
"err",
":=",
"rand",
".",
"Read",
"(",
"b",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"\"",
"\"",
",",
"err",
"\n",
"}",
"\n",
"t",
".",
"mtx",
".",
"Lock",
"(",
")",
"\n",
"defer",
"t",
".",
"mtx",
".",
"Unlock",
"(",
")",
"\n",
"t",
".",
"<mask>",
"=",
"string",
"(",
"data",
".",
"FromBytes",
"(",
"b",
")",
")",
"\n",
"return",
"t",
".",
"token",
",",
"nil",
"\n",
"}"
] |
21,494 | all-21495 | [
"retrieve",
"the",
"location",
"of",
"a",
"subroutine",
"uniform",
"of",
"a",
"given",
"shader",
"stage",
"within",
"a",
"program"
] | [
"func",
"GetSubroutineUniformLocation",
"(",
"program",
"uint32",
",",
"shadertype",
"uint32",
",",
"name",
"*",
"uint8",
")",
"int32",
"{",
"<mask>",
",",
"_",
",",
"_",
":=",
"syscall",
".",
"Syscall",
"(",
"gpGetSubroutineUniformLocation",
",",
"3",
",",
"uintptr",
"(",
"program",
")",
",",
"uintptr",
"(",
"shadertype",
")",
",",
"uintptr",
"(",
"unsafe",
".",
"Pointer",
"(",
"name",
")",
")",
")",
"\n",
"return",
"(",
"int32",
")",
"(",
"ret",
")",
"\n",
"}"
] |
21,495 | all-21496 | [
"normalizeOption",
"normalizes",
"the",
"input",
"options",
"such",
"that",
"all",
"Options",
"groups",
"are",
"flattened",
"and",
"groups",
"with",
"a",
"single",
"element",
"are",
"reduced",
"to",
"that",
"element",
".",
"Only",
"coreOptions",
"and",
"Options",
"containing",
"coreOptions",
"are",
"allowed",
"."
] | [
"func",
"normalizeOption",
"(",
"src",
"Option",
")",
"Option",
"{",
"switch",
"opts",
":=",
"flattenOptions",
"(",
"nil",
",",
"Options",
"{",
"src",
"}",
")",
";",
"len",
"(",
"opts",
")",
"{",
"<mask>",
"0",
":",
"return",
"nil",
"\n",
"case",
"1",
":",
"return",
"opts",
"[",
"0",
"]",
"\n",
"default",
":",
"return",
"opts",
"\n",
"}",
"\n",
"}"
] |
21,496 | all-21497 | [
"resourceVSphereDatastoreClusterApplyDelete",
"process",
"the",
"removal",
"of",
"a",
"datastore",
"cluster",
"."
] | [
"func",
"resourceVSphereDatastoreClusterApplyDelete",
"(",
"d",
"*",
"schema",
".",
"ResourceData",
",",
"pod",
"*",
"object",
".",
"StoragePod",
")",
"error",
"{",
"<mask>",
".",
"Printf",
"(",
"\"",
"\"",
",",
"resourceVSphereDatastoreClusterIDString",
"(",
"d",
")",
")",
"\n",
"if",
"err",
":=",
"storagepod",
".",
"Delete",
"(",
"pod",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"d",
".",
"SetId",
"(",
"\"",
"\"",
")",
"\n",
"return",
"nil",
"\n",
"}"
] |
21,497 | all-21498 | [
"Sign",
"calls",
"the",
"ledger",
"and",
"stores",
"the",
"PubKey",
"for",
"future",
"use",
"Communication",
"is",
"checked",
"on",
"NewPrivKeyLedger",
"and",
"PrivKeyFromBytes",
"returning",
"an",
"error",
"so",
"this",
"should",
"only",
"trigger",
"if",
"the",
"privkey",
"is",
"held",
"in",
"memory",
"for",
"a",
"while",
"before",
"use",
"."
] | [
"func",
"(",
"pk",
"PrivKeyLedgerSecp256k1",
")",
"Sign",
"(",
"msg",
"[",
"]",
"<mask>",
")",
"(",
"Signature",
",",
"error",
")",
"{",
"dev",
",",
"err",
":=",
"getLedger",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"sig",
",",
"err",
":=",
"signLedgerSecp256k1",
"(",
"dev",
",",
"pk",
".",
"Path",
",",
"msg",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"return",
"sig",
",",
"nil",
"\n",
"}"
] |
21,498 | all-21499 | [
"MarshalJSON",
"supports",
"json",
".",
"Marshaler",
"interface"
] | [
"func",
"(",
"v",
"StartTrackingHeapObjectsParams",
")",
"MarshalJSON",
"(",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"w",
":=",
"jwriter",
".",
"Writer",
"{",
"}",
"\n",
"easyjsonC5a4559bEncodeGithubComChromedpCdprotoHeapprofiler4",
"(",
"&",
"w",
",",
"v",
")",
"\n",
"return",
"w",
".",
"Buffer",
".",
"BuildBytes",
"(",
")",
",",
"w",
".",
"<mask>",
"\n",
"}"
] |
21,499 | all-21500 | [
"InjectOutboundSpan",
"retrieves",
"OpenTracing",
"Span",
"from",
"response",
"where",
"it",
"is",
"stored",
"when",
"the",
"outbound",
"call",
"is",
"initiated",
".",
"The",
"tracing",
"API",
"is",
"used",
"to",
"serialize",
"the",
"span",
"into",
"the",
"application",
"headers",
"which",
"will",
"propagate",
"tracing",
"context",
"to",
"the",
"server",
".",
"Returns",
"modified",
"headers",
"containing",
"serialized",
"tracing",
"context",
".",
"Sometimes",
"caller",
"pass",
"a",
"shared",
"instance",
"of",
"the",
"headers",
"map",
"so",
"instead",
"of",
"modifying",
"it",
"we",
"clone",
"it",
"into",
"the",
"new",
"map",
"(",
"assuming",
"that",
"Tracer",
"actually",
"injects",
"some",
"tracing",
"keys",
")",
"."
] | [
"func",
"InjectOutboundSpan",
"(",
"response",
"*",
"OutboundCallResponse",
",",
"headers",
"map",
"[",
"string",
"]",
"string",
")",
"map",
"[",
"string",
"]",
"string",
"{",
"span",
":=",
"response",
".",
"span",
"\n",
"if",
"span",
"==",
"nil",
"{",
"return",
"<mask>",
"\n",
"}",
"\n",
"newHeaders",
":=",
"make",
"(",
"map",
"[",
"string",
"]",
"string",
")",
"\n",
"carrier",
":=",
"tracingHeadersCarrier",
"(",
"newHeaders",
")",
"\n",
"if",
"err",
":=",
"span",
".",
"Tracer",
"(",
")",
".",
"Inject",
"(",
"span",
".",
"Context",
"(",
")",
",",
"opentracing",
".",
"TextMap",
",",
"carrier",
")",
";",
"err",
"!=",
"nil",
"{",
"// Something had to go seriously wrong for Inject to fail, usually a setup problem.",
"// A good Tracer implementation may also emit a metric.",
"response",
".",
"log",
".",
"WithFields",
"(",
"ErrField",
"(",
"err",
")",
")",
".",
"Error",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"if",
"len",
"(",
"newHeaders",
")",
"==",
"0",
"{",
"return",
"headers",
"// Tracer did not add any tracing headers, so return the original map",
"\n",
"}",
"\n",
"for",
"k",
",",
"v",
":=",
"range",
"headers",
"{",
"// Some applications propagate all inbound application headers to outbound calls (issue #682).",
"// If those headers include tracing headers we want to make sure to keep the new tracing headers.",
"if",
"_",
",",
"ok",
":=",
"newHeaders",
"[",
"k",
"]",
";",
"!",
"ok",
"{",
"newHeaders",
"[",
"k",
"]",
"=",
"v",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"newHeaders",
"\n",
"}"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.