id
int32 0
25.3k
| idx
stringlengths 5
9
| nl_tokens
sequencelengths 1
418
| pl_tokens
sequencelengths 22
4.98k
|
---|---|---|---|
22,500 | all-22501 | [
"Get",
"takes",
"name",
"of",
"the",
"prowJob",
"and",
"returns",
"the",
"corresponding",
"prowJob",
"object",
"and",
"an",
"error",
"if",
"there",
"is",
"any",
"."
] | [
"func",
"(",
"c",
"*",
"FakeProwJobs",
")",
"Get",
"(",
"<mask>",
"string",
",",
"options",
"v1",
".",
"GetOptions",
")",
"(",
"result",
"*",
"prowjobsv1",
".",
"ProwJob",
",",
"err",
"error",
")",
"{",
"obj",
",",
"err",
":=",
"c",
".",
"Fake",
".",
"Invokes",
"(",
"testing",
".",
"NewGetAction",
"(",
"prowjobsResource",
",",
"c",
".",
"ns",
",",
"name",
")",
",",
"&",
"prowjobsv1",
".",
"ProwJob",
"{",
"}",
")",
"\n\n",
"if",
"obj",
"==",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"return",
"obj",
".",
"(",
"*",
"prowjobsv1",
".",
"ProwJob",
")",
",",
"err",
"\n",
"}"
] |
22,501 | all-22502 | [
"Do",
"executes",
"Network",
".",
"emulateNetworkConditions",
"against",
"the",
"provided",
"context",
"."
] | [
"func",
"(",
"p",
"*",
"EmulateNetworkConditionsParams",
")",
"Do",
"(",
"ctx",
"context",
".",
"<mask>",
")",
"(",
"err",
"error",
")",
"{",
"return",
"cdp",
".",
"Execute",
"(",
"ctx",
",",
"CommandEmulateNetworkConditions",
",",
"p",
",",
"nil",
")",
"\n",
"}"
] |
22,502 | all-22503 | [
"MarshalJSON",
"supports",
"json",
".",
"Marshaler",
"interface"
] | [
"func",
"(",
"v",
"ScriptTypeProfile",
")",
"MarshalJSON",
"(",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"w",
":=",
"jwriter",
".",
"Writer",
"{",
"}",
"\n",
"easyjsonC5a4559bEncodeGithubComChromedpCdprotoProfiler14",
"(",
"&",
"w",
",",
"v",
")",
"\n",
"return",
"w",
".",
"Buffer",
".",
"BuildBytes",
"(",
")",
",",
"w",
".",
"<mask>",
"\n",
"}"
] |
22,503 | all-22504 | [
"RenderImage",
"returns",
"the",
"map",
"as",
"an",
"unencoded",
"image",
".",
"Image",
"."
] | [
"func",
"(",
"m",
"*",
"Map",
")",
"RenderImage",
"(",
"opts",
"RenderOpts",
")",
"(",
"*",
"image",
".",
"NRGBA",
",",
"error",
")",
"{",
"scaleFactor",
":=",
"opts",
".",
"ScaleFactor",
"\n",
"if",
"scaleFactor",
"==",
"0.0",
"{",
"scaleFactor",
"=",
"1.0",
"\n",
"}",
"\n",
"i",
":=",
"C",
".",
"mapnik_map_render_to_image",
"(",
"m",
".",
"m",
",",
"C",
".",
"double",
"(",
"opts",
".",
"Scale",
")",
",",
"C",
".",
"double",
"(",
"scaleFactor",
")",
")",
"\n",
"if",
"i",
"==",
"nil",
"{",
"return",
"nil",
",",
"m",
".",
"lastError",
"(",
")",
"\n",
"}",
"\n",
"defer",
"C",
".",
"mapnik_image_free",
"(",
"i",
")",
"\n",
"size",
":=",
"0",
"\n",
"raw",
":=",
"C",
".",
"mapnik_image_to_raw",
"(",
"i",
",",
"(",
"*",
"C",
".",
"size_t",
")",
"(",
"unsafe",
".",
"Pointer",
"(",
"&",
"size",
")",
")",
")",
"\n",
"b",
":=",
"C",
".",
"GoBytes",
"(",
"unsafe",
".",
"Pointer",
"(",
"raw",
")",
",",
"C",
".",
"int",
"(",
"size",
")",
")",
"\n",
"img",
":=",
"&",
"image",
".",
"NRGBA",
"{",
"Pix",
":",
"b",
",",
"Stride",
":",
"int",
"(",
"m",
".",
"width",
"*",
"4",
")",
",",
"Rect",
":",
"image",
".",
"Rect",
"(",
"0",
",",
"0",
",",
"int",
"(",
"m",
".",
"width",
")",
",",
"int",
"(",
"m",
".",
"<mask>",
")",
")",
",",
"}",
"\n",
"return",
"img",
",",
"nil",
"\n",
"}"
] |
22,504 | all-22505 | [
"findVirtualDisk",
"locates",
"a",
"virtual",
"disk",
"by",
"it",
"UUID",
"or",
"by",
"its",
"device",
"address",
"if",
"UUID",
"is",
"missing",
".",
"The",
"device",
"address",
"search",
"is",
"only",
"used",
"if",
"fallback",
"is",
"true",
"-",
"this",
"is",
"so",
"that",
"we",
"can",
"distinguish",
"situations",
"where",
"it",
"should",
"be",
"used",
"such",
"as",
"a",
"read",
"versus",
"situations",
"where",
"it",
"should",
"never",
"be",
"used",
"such",
"as",
"an",
"update",
"or",
"delete",
"."
] | [
"func",
"(",
"r",
"*",
"DiskSubresource",
")",
"findVirtualDisk",
"(",
"l",
"object",
".",
"VirtualDeviceList",
",",
"fallback",
"bool",
")",
"(",
"*",
"types",
".",
"VirtualDisk",
",",
"error",
")",
"{",
"device",
",",
"err",
":=",
"r",
".",
"findVirtualDiskByUUIDOrAddress",
"(",
"l",
",",
"fallback",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"return",
"<mask>",
".",
"(",
"*",
"types",
".",
"VirtualDisk",
")",
",",
"nil",
"\n",
"}"
] |
22,505 | all-22506 | [
"HTTPStatusCode",
"returns",
"the",
"corresponding",
"http",
"status",
"code",
"from",
"an",
"error",
"type"
] | [
"func",
"(",
"t",
"Type",
")",
"HTTPStatusCode",
"(",
")",
"int",
"{",
"switch",
"t",
"{",
"case",
"Canceled",
":",
"return",
"http",
".",
"StatusRequestTimeout",
"\n",
"case",
"InvalidArgument",
":",
"return",
"http",
".",
"StatusBadRequest",
"\n",
"case",
"OutOfRange",
":",
"return",
"http",
".",
"StatusBadRequest",
"\n",
"case",
"NotFound",
":",
"return",
"http",
".",
"StatusNotFound",
"\n",
"case",
"Conflict",
":",
"return",
"http",
".",
"StatusConflict",
"\n",
"case",
"AlreadyExists",
":",
"return",
"http",
".",
"StatusConflict",
"\n",
"case",
"Unauthorized",
":",
"return",
"http",
".",
"StatusUnauthorized",
"\n",
"case",
"PermissionDenied",
":",
"return",
"http",
".",
"StatusForbidden",
"\n",
"case",
"Timeout",
":",
"return",
"http",
".",
"StatusRequestTimeout",
"\n",
"case",
"NotImplemented",
":",
"return",
"http",
".",
"StatusNotImplemented",
"\n",
"case",
"TemporarilyUnavailable",
":",
"return",
"http",
".",
"StatusBadGateway",
"\n",
"case",
"PermanentlyUnavailable",
":",
"return",
"http",
".",
"StatusGone",
"\n",
"case",
"ResourceExhausted",
":",
"return",
"http",
".",
"StatusForbidden",
"\n",
"case",
"Internal",
":",
"return",
"http",
".",
"StatusInternalServerError",
"\n",
"case",
"Unknown",
":",
"return",
"http",
".",
"StatusInternalServerError",
"\n",
"}",
"\n\n",
"return",
"<mask>",
".",
"StatusInternalServerError",
"\n",
"}"
] |
22,506 | all-22507 | [
"InspectDatum",
"returns",
"info",
"about",
"a",
"single",
"datum"
] | [
"func",
"(",
"c",
"APIClient",
")",
"InspectDatum",
"(",
"jobID",
"string",
",",
"datumID",
"string",
")",
"(",
"*",
"pps",
".",
"DatumInfo",
",",
"error",
")",
"{",
"datumInfo",
",",
"err",
":=",
"c",
".",
"PpsAPIClient",
".",
"InspectDatum",
"(",
"c",
".",
"Ctx",
"(",
")",
",",
"&",
"pps",
".",
"InspectDatumRequest",
"{",
"Datum",
":",
"&",
"pps",
".",
"Datum",
"{",
"<mask>",
":",
"datumID",
",",
"Job",
":",
"NewJob",
"(",
"jobID",
")",
",",
"}",
",",
"}",
",",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"grpcutil",
".",
"ScrubGRPC",
"(",
"err",
")",
"\n",
"}",
"\n",
"return",
"datumInfo",
",",
"nil",
"\n",
"}"
] |
22,507 | all-22508 | [
"GetConfig",
"returns",
"an",
"existing",
"if",
"it",
"exists",
"errors",
"out",
"otherwise"
] | [
"func",
"(",
"s",
"*",
"Storage",
")",
"GetConfig",
"(",
"name",
"string",
")",
"(",
"common",
".",
"ResourcesConfig",
",",
"error",
")",
"{",
"i",
",",
"err",
":=",
"s",
".",
"configs",
".",
"Get",
"(",
"name",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"common",
".",
"ResourcesConfig",
"{",
"}",
",",
"err",
"\n",
"}",
"\n",
"var",
"conf",
"common",
".",
"ResourcesConfig",
"\n",
"conf",
",",
"err",
"=",
"<mask>",
".",
"ItemToResourcesConfig",
"(",
"i",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"common",
".",
"ResourcesConfig",
"{",
"}",
",",
"err",
"\n",
"}",
"\n",
"return",
"conf",
",",
"nil",
"\n",
"}"
] |
22,508 | all-22509 | [
"schemaDVPortgroupConfigSpec",
"returns",
"schema",
"items",
"for",
"resources",
"that",
"need",
"to",
"work",
"with",
"a",
"DVPortgroupConfigSpec",
"."
] | [
"func",
"schemaDVPortgroupConfigSpec",
"(",
")",
"map",
"[",
"string",
"]",
"*",
"schema",
".",
"Schema",
"{",
"s",
":=",
"map",
"[",
"string",
"]",
"*",
"schema",
".",
"Schema",
"{",
"// VMwareDVSPortgroupPolicy",
"\"",
"\"",
":",
"{",
"Type",
":",
"schema",
".",
"TypeBool",
",",
"Optional",
":",
"true",
",",
"Description",
":",
"\"",
"\"",
",",
"}",
",",
"\"",
"\"",
":",
"{",
"Type",
":",
"schema",
".",
"TypeBool",
",",
"Optional",
":",
"true",
",",
"Description",
":",
"\"",
"\"",
",",
"}",
",",
"\"",
"\"",
":",
"{",
"Type",
":",
"schema",
".",
"TypeBool",
",",
"Optional",
":",
"true",
",",
"Description",
":",
"\"",
"\"",
",",
"}",
",",
"\"",
"\"",
":",
"{",
"Type",
":",
"schema",
".",
"TypeBool",
",",
"Optional",
":",
"true",
",",
"<mask>",
":",
"\"",
"\"",
",",
"}",
",",
"\"",
"\"",
":",
"{",
"Type",
":",
"schema",
".",
"TypeBool",
",",
"Optional",
":",
"true",
",",
"Description",
":",
"\"",
"\"",
",",
"}",
",",
"\"",
"\"",
":",
"{",
"Type",
":",
"schema",
".",
"TypeBool",
",",
"Optional",
":",
"true",
",",
"Description",
":",
"\"",
"\"",
",",
"}",
",",
"\"",
"\"",
":",
"{",
"Type",
":",
"schema",
".",
"TypeBool",
",",
"Optional",
":",
"true",
",",
"Description",
":",
"\"",
"\"",
",",
"}",
",",
"\"",
"\"",
":",
"{",
"Type",
":",
"schema",
".",
"TypeBool",
",",
"Optional",
":",
"true",
",",
"Description",
":",
"\"",
"\"",
",",
"}",
",",
"\"",
"\"",
":",
"{",
"Type",
":",
"schema",
".",
"TypeBool",
",",
"Optional",
":",
"true",
",",
"Description",
":",
"\"",
"\"",
",",
"}",
",",
"\"",
"\"",
":",
"{",
"Type",
":",
"schema",
".",
"TypeBool",
",",
"Optional",
":",
"true",
",",
"Description",
":",
"\"",
"\"",
",",
"}",
",",
"// DVPortgroupConfigSpec",
"\"",
"\"",
":",
"{",
"Type",
":",
"schema",
".",
"TypeBool",
",",
"Optional",
":",
"true",
",",
"Default",
":",
"true",
",",
"Description",
":",
"\"",
"\"",
",",
"}",
",",
"\"",
"\"",
":",
"{",
"Type",
":",
"schema",
".",
"TypeString",
",",
"Computed",
":",
"true",
",",
"Description",
":",
"\"",
"\"",
",",
"}",
",",
"\"",
"\"",
":",
"{",
"Type",
":",
"schema",
".",
"TypeString",
",",
"Optional",
":",
"true",
",",
"Description",
":",
"\"",
"\"",
",",
"}",
",",
"\"",
"\"",
":",
"{",
"Type",
":",
"schema",
".",
"TypeString",
",",
"Required",
":",
"true",
",",
"Description",
":",
"\"",
"\"",
",",
"}",
",",
"\"",
"\"",
":",
"{",
"Type",
":",
"schema",
".",
"TypeInt",
",",
"Optional",
":",
"true",
",",
"Computed",
":",
"true",
",",
"Description",
":",
"\"",
"\"",
",",
"ValidateFunc",
":",
"validation",
".",
"IntAtLeast",
"(",
"0",
")",
",",
"}",
",",
"\"",
"\"",
":",
"{",
"Type",
":",
"schema",
".",
"TypeString",
",",
"Optional",
":",
"true",
",",
"Description",
":",
"\"",
"\"",
",",
"}",
",",
"\"",
"\"",
":",
"{",
"Type",
":",
"schema",
".",
"TypeString",
",",
"Optional",
":",
"true",
",",
"Default",
":",
"string",
"(",
"types",
".",
"DistributedVirtualPortgroupPortgroupTypeEarlyBinding",
")",
",",
"Description",
":",
"\"",
"\"",
",",
"ValidateFunc",
":",
"validation",
".",
"StringInSlice",
"(",
"distributedVirtualPortgroupPortgroupTypeAllowedValues",
",",
"false",
")",
",",
"}",
",",
"\"",
"\"",
":",
"{",
"Type",
":",
"schema",
".",
"TypeString",
",",
"Optional",
":",
"true",
",",
"Default",
":",
"\"",
"\"",
",",
"Description",
":",
"\"",
"\"",
",",
"}",
",",
"}",
"\n",
"structure",
".",
"MergeSchema",
"(",
"s",
",",
"schemaVMwareDVSPortSetting",
"(",
")",
")",
"\n",
"return",
"s",
"\n",
"}"
] |
22,509 | all-22510 | [
"flattenClusterVmToolsMonitoringSettings",
"saves",
"a",
"ClusterVmToolsMonitoringSettings",
"into",
"the",
"supplied",
"ResourceData",
"."
] | [
"func",
"flattenClusterVMToolsMonitoringSettings",
"(",
"d",
"*",
"schema",
".",
"ResourceData",
",",
"obj",
"*",
"<mask>",
".",
"ClusterVmToolsMonitoringSettings",
")",
"error",
"{",
"return",
"structure",
".",
"SetBatch",
"(",
"d",
",",
"map",
"[",
"string",
"]",
"interface",
"{",
"}",
"{",
"\"",
"\"",
":",
"obj",
".",
"FailureInterval",
",",
"\"",
"\"",
":",
"obj",
".",
"MaxFailures",
",",
"\"",
"\"",
":",
"obj",
".",
"MaxFailureWindow",
",",
"\"",
"\"",
":",
"obj",
".",
"MinUpTime",
",",
"\"",
"\"",
":",
"obj",
".",
"VmMonitoring",
",",
"}",
")",
"\n",
"}"
] |
22,510 | all-22511 | [
"SplitHostPort",
"splits",
"network",
"address",
"of",
"the",
"form",
"host",
":",
"port",
"into",
"host",
"and",
"port",
".",
"Unlike",
"net",
".",
"SplitHostPort",
"()",
"it",
"doesn",
"t",
"remove",
"brackets",
"from",
"[",
"IPv6",
"]",
"host",
"and",
"it",
"accepts",
"net",
"/",
"url",
".",
"URL",
"struct",
"instead",
"of",
"a",
"string",
"."
] | [
"func",
"SplitHostPort",
"(",
"u",
"*",
"url",
".",
"URL",
")",
"(",
"host",
",",
"port",
"string",
",",
"err",
"error",
")",
"{",
"if",
"u",
"==",
"nil",
"{",
"return",
"\"",
"\"",
",",
"\"",
"\"",
",",
"&",
"url",
".",
"Error",
"{",
"Op",
":",
"\"",
"\"",
",",
"URL",
":",
"host",
",",
"Err",
":",
"errors",
".",
"New",
"(",
"\"",
"\"",
")",
"}",
"\n",
"}",
"\n",
"host",
"=",
"u",
".",
"Host",
"\n\n",
"// Find last colon.",
"if",
"i",
":=",
"strings",
".",
"LastIndex",
"(",
"host",
",",
"\"",
"\"",
")",
";",
"i",
"!=",
"-",
"1",
"{",
"// If we're not inside [IPv6] brackets, split host:port.",
"if",
"len",
"(",
"<mask>",
")",
">",
"i",
"&&",
"!",
"strings",
".",
"Contains",
"(",
"host",
"[",
"i",
":",
"]",
",",
"\"",
"\"",
")",
"{",
"port",
"=",
"host",
"[",
"i",
"+",
"1",
":",
"]",
"\n",
"host",
"=",
"host",
"[",
":",
"i",
"]",
"\n",
"}",
"\n",
"}",
"\n\n",
"// Port is optional. But if it's set, is it a number?",
"if",
"port",
"!=",
"\"",
"\"",
"{",
"if",
"_",
",",
"err",
":=",
"strconv",
".",
"Atoi",
"(",
"port",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"\"",
"\"",
",",
"\"",
"\"",
",",
"&",
"url",
".",
"Error",
"{",
"Op",
":",
"\"",
"\"",
",",
"URL",
":",
"host",
",",
"Err",
":",
"err",
"}",
"\n",
"}",
"\n",
"}",
"\n\n",
"return",
"host",
",",
"port",
",",
"nil",
"\n",
"}"
] |
22,511 | all-22512 | [
"newLoadIndex",
"returns",
"the",
"index",
"in",
"stmts",
"where",
"a",
"new",
"load",
"statement",
"should",
"be",
"inserted",
".",
"after",
"is",
"a",
"list",
"of",
"function",
"names",
"that",
"the",
"load",
"should",
"not",
"be",
"inserted",
"before",
"."
] | [
"func",
"newLoadIndex",
"(",
"f",
"*",
"<mask>",
".",
"File",
",",
"after",
"[",
"]",
"string",
")",
"int",
"{",
"if",
"len",
"(",
"after",
")",
"==",
"0",
"{",
"return",
"0",
"\n",
"}",
"\n",
"index",
":=",
"0",
"\n",
"for",
"_",
",",
"r",
":=",
"range",
"f",
".",
"Rules",
"{",
"for",
"_",
",",
"a",
":=",
"range",
"after",
"{",
"if",
"r",
".",
"Kind",
"(",
")",
"==",
"a",
"&&",
"r",
".",
"Index",
"(",
")",
">=",
"index",
"{",
"index",
"=",
"r",
".",
"Index",
"(",
")",
"+",
"1",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"index",
"\n",
"}"
] |
22,512 | all-22513 | [
"MarshalJSON",
"returns",
"the",
"Duration",
"as",
"JSON"
] | [
"func",
"(",
"d",
"Duration",
")",
"MarshalJSON",
"(",
")",
"(",
"[",
"]",
"<mask>",
",",
"error",
")",
"{",
"var",
"w",
"jwriter",
".",
"Writer",
"\n",
"d",
".",
"MarshalEasyJSON",
"(",
"&",
"w",
")",
"\n",
"return",
"w",
".",
"BuildBytes",
"(",
")",
"\n",
"}"
] |
22,513 | all-22514 | [
"MarshalJSON",
"supports",
"json",
".",
"Marshaler",
"interface"
] | [
"func",
"(",
"v",
"RGBA",
")",
"MarshalJSON",
"(",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"w",
":=",
"jwriter",
".",
"<mask>",
"{",
"}",
"\n",
"easyjsonC5a4559bEncodeGithubComChromedpCdprotoCdp",
"(",
"&",
"w",
",",
"v",
")",
"\n",
"return",
"w",
".",
"Buffer",
".",
"BuildBytes",
"(",
")",
",",
"w",
".",
"Error",
"\n",
"}"
] |
22,514 | all-22515 | [
"AgentPreOfferingDelete",
"calls",
"psc",
"remove",
"an",
"offering",
"."
] | [
"func",
"(",
"w",
"*",
"Worker",
")",
"AgentPreOfferingDelete",
"(",
"job",
"*",
"data",
".",
"<mask>",
")",
"error",
"{",
"logger",
":=",
"w",
".",
"logger",
".",
"Add",
"(",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"job",
")",
"\n\n",
"offering",
",",
"err",
":=",
"w",
".",
"relatedOffering",
"(",
"logger",
",",
"job",
",",
"data",
".",
"JobAgentPreOfferingDelete",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"if",
"offering",
".",
"Status",
"!=",
"data",
".",
"OfferRegistered",
"&&",
"offering",
".",
"Status",
"!=",
"data",
".",
"OfferPoppedUp",
"{",
"return",
"ErrOfferNotRegistered",
"\n",
"}",
"\n\n",
"jobDate",
",",
"err",
":=",
"w",
".",
"publishData",
"(",
"logger",
",",
"job",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"key",
",",
"err",
":=",
"w",
".",
"accountKey",
"(",
"logger",
",",
"offering",
".",
"Agent",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"offeringHash",
",",
"err",
":=",
"data",
".",
"HexToHash",
"(",
"offering",
".",
"Hash",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"logger",
".",
"Error",
"(",
"err",
".",
"Error",
"(",
")",
")",
"\n",
"return",
"err",
"\n",
"}",
"\n\n",
"err",
"=",
"w",
".",
"checkInPeriod",
"(",
"logger",
",",
"offeringHash",
",",
"data",
".",
"SettingsPeriodRemove",
",",
"ErrOfferingDeletePeriodIsNotOver",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"auth",
":=",
"bind",
".",
"NewKeyedTransactor",
"(",
"key",
")",
"\n",
"auth",
".",
"GasLimit",
"=",
"w",
".",
"gasConf",
".",
"PSC",
".",
"RemoveServiceOffering",
"\n",
"auth",
".",
"GasPrice",
"=",
"new",
"(",
"big",
".",
"Int",
")",
".",
"SetUint64",
"(",
"jobDate",
".",
"GasPrice",
")",
"\n\n",
"tx",
",",
"err",
":=",
"w",
".",
"ethBack",
".",
"PSCRemoveServiceOffering",
"(",
"auth",
",",
"offeringHash",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"logger",
".",
"Add",
"(",
"\"",
"\"",
",",
"auth",
".",
"GasLimit",
",",
"\"",
"\"",
",",
"auth",
".",
"GasPrice",
")",
".",
"Error",
"(",
"err",
".",
"Error",
"(",
")",
")",
"\n",
"return",
"ErrPSCRemoveOffering",
"\n",
"}",
"\n\n",
"offering",
".",
"Status",
"=",
"data",
".",
"OfferRemoving",
"\n",
"if",
"err",
":=",
"w",
".",
"saveRecord",
"(",
"logger",
",",
"w",
".",
"db",
".",
"Querier",
",",
"offering",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"return",
"w",
".",
"saveEthTX",
"(",
"logger",
",",
"job",
",",
"tx",
",",
"\"",
"\"",
",",
"job",
".",
"RelatedType",
",",
"job",
".",
"RelatedID",
",",
"offering",
".",
"Agent",
",",
"data",
".",
"HexFromBytes",
"(",
"w",
".",
"pscAddr",
".",
"Bytes",
"(",
")",
")",
")",
"\n",
"}"
] |
22,515 | all-22516 | [
"HasKey",
"()",
"is",
"a",
"wrapper",
"around",
"g_settings_schema_has_key",
"()",
"."
] | [
"func",
"(",
"v",
"*",
"SettingsSchema",
")",
"HasKey",
"(",
"v1",
"string",
")",
"bool",
"{",
"cstr",
":=",
"(",
"*",
"C",
".",
"gchar",
")",
"(",
"C",
".",
"CString",
"(",
"v1",
")",
")",
"\n",
"defer",
"C",
".",
"<mask>",
"(",
"unsafe",
".",
"Pointer",
"(",
"cstr",
")",
")",
"\n\n",
"return",
"gobool",
"(",
"C",
".",
"g_settings_schema_has_key",
"(",
"v",
".",
"native",
"(",
")",
",",
"cstr",
")",
")",
"\n",
"}"
] |
22,516 | all-22517 | [
"CreateProfile",
"defines",
"a",
"new",
"container",
"profile"
] | [
"func",
"(",
"r",
"*",
"ProtocolLXD",
")",
"CreateProfile",
"(",
"profile",
"api",
".",
"ProfilesPost",
")",
"error",
"{",
"// Send the request",
"_",
",",
"_",
",",
"err",
":=",
"r",
".",
"<mask>",
"(",
"\"",
"\"",
",",
"\"",
"\"",
",",
"profile",
",",
"\"",
"\"",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"return",
"nil",
"\n",
"}"
] |
22,517 | all-22518 | [
"Prevpos",
"returns",
"the",
"index",
"of",
"the",
"element",
"before",
"from",
"or",
"-",
"1",
"if",
"no",
"more",
"and",
"from",
"is",
"the",
"first",
"in",
"the",
"ring",
".",
"Returns",
"-",
"2",
"on",
"bad",
"from",
"position",
"."
] | [
"func",
"(",
"f",
"*",
"FixedSizeRingBuf",
")",
"Prevpos",
"(",
"from",
"int",
")",
"int",
"{",
"if",
"from",
">=",
"f",
".",
"N",
"||",
"from",
"<",
"0",
"{",
"return",
"-",
"2",
"\n",
"}",
"\n",
"if",
"f",
".",
"Readable",
"==",
"0",
"{",
"return",
"-",
"1",
"\n",
"}",
"\n",
"if",
"from",
"==",
"f",
".",
"Beg",
"{",
"return",
"-",
"1",
"\n",
"}",
"\n",
"a0",
",",
"a1",
",",
"b0",
",",
"b1",
":=",
"f",
".",
"LegalPos",
"(",
")",
"\n",
"switch",
"{",
"case",
"from",
"==",
"a0",
":",
"return",
"-",
"1",
"\n",
"<mask>",
"from",
">",
"a0",
"&&",
"from",
"<=",
"a1",
":",
"return",
"from",
"-",
"1",
"\n",
"case",
"from",
"==",
"b0",
":",
"return",
"a1",
"\n",
"case",
"from",
">",
"b0",
"&&",
"from",
"<=",
"b1",
":",
"return",
"from",
"-",
"1",
"\n",
"}",
"\n",
"return",
"-",
"1",
"\n",
"}"
] |
22,518 | all-22519 | [
"PushCloudConfig",
"uploads",
"a",
"cloud",
"config",
"to",
"bosh",
"."
] | [
"func",
"(",
"s",
"*",
"Client",
")",
"PushCloudConfig",
"(",
"manifest",
"[",
"]",
"byte",
")",
"error",
"{",
"ccm",
":=",
"enaml",
".",
"NewCloudConfigManifest",
"(",
"manifest",
")",
"\n",
"req",
",",
"err",
":=",
"s",
".",
"newCloudConfigRequest",
"(",
"*",
"ccm",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"res",
",",
"err",
":=",
"s",
".",
"http",
".",
"Do",
"(",
"req",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"defer",
"res",
".",
"Body",
".",
"Close",
"(",
")",
"\n",
"if",
"res",
".",
"StatusCode",
">=",
"400",
"{",
"body",
",",
"err",
":=",
"ioutil",
".",
"ReadAll",
"(",
"res",
".",
"<mask>",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"res",
".",
"Status",
",",
"string",
"(",
"body",
")",
")",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
] |
22,519 | all-22520 | [
"ScrollFinger",
"performs",
"a",
"scroll",
"touch",
"action",
"by",
"the",
"provided",
"offset",
"on",
"exactly",
"one",
"element",
"."
] | [
"func",
"(",
"s",
"*",
"Selection",
")",
"ScrollFinger",
"(",
"xOffset",
",",
"yOffset",
"int",
")",
"error",
"{",
"selectedElement",
",",
"err",
":=",
"s",
".",
"elements",
".",
"GetExactlyOne",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"s",
",",
"err",
")",
"\n",
"}",
"\n\n",
"if",
"err",
":=",
"s",
".",
"<mask>",
".",
"TouchScroll",
"(",
"selectedElement",
".",
"(",
"*",
"api",
".",
"Element",
")",
",",
"api",
".",
"XYOffset",
"{",
"X",
":",
"xOffset",
",",
"Y",
":",
"yOffset",
"}",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"s",
",",
"err",
")",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
] |
22,520 | all-22521 | [
"HTTPGetCheck",
"returns",
"a",
"Check",
"that",
"performs",
"an",
"HTTP",
"GET",
"request",
"against",
"the",
"specified",
"URL",
".",
"The",
"check",
"fails",
"if",
"the",
"response",
"times",
"out",
"or",
"returns",
"a",
"non",
"-",
"200",
"status",
"code",
"."
] | [
"func",
"HTTPGetCheck",
"(",
"<mask>",
"string",
",",
"timeout",
"time",
".",
"Duration",
")",
"Check",
"{",
"client",
":=",
"http",
".",
"Client",
"{",
"Timeout",
":",
"timeout",
",",
"// never follow redirects",
"CheckRedirect",
":",
"func",
"(",
"*",
"http",
".",
"Request",
",",
"[",
"]",
"*",
"http",
".",
"Request",
")",
"error",
"{",
"return",
"http",
".",
"ErrUseLastResponse",
"\n",
"}",
",",
"}",
"\n",
"return",
"func",
"(",
")",
"error",
"{",
"resp",
",",
"err",
":=",
"client",
".",
"Get",
"(",
"url",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"resp",
".",
"Body",
".",
"Close",
"(",
")",
"\n",
"if",
"resp",
".",
"StatusCode",
"!=",
"200",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"resp",
".",
"StatusCode",
")",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}",
"\n",
"}"
] |
22,521 | all-22522 | [
"CancelRequest",
"cancels",
"a",
"transaction",
"request",
"referenced",
"by",
"id"
] | [
"func",
"(",
"c",
"Client",
")",
"CancelRequest",
"(",
"id",
"string",
")",
"(",
"bool",
",",
"error",
")",
"{",
"holder",
":=",
"map",
"[",
"string",
"]",
"interface",
"{",
"}",
"{",
"}",
"\n",
"if",
"err",
":=",
"c",
".",
"Delete",
"(",
"\"",
"\"",
"+",
"id",
"+",
"\"",
"\"",
",",
"nil",
",",
"&",
"holder",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"false",
",",
"err",
"\n",
"}",
"\n",
"if",
"holder",
"[",
"\"",
"\"",
"]",
".",
"(",
"bool",
")",
"{",
"return",
"<mask>",
",",
"nil",
"\n",
"}",
"\n",
"return",
"false",
",",
"nil",
"\n",
"}"
] |
22,522 | all-22523 | [
"Unquote",
"interprets",
"s",
"as",
"a",
"single",
"-",
"quoted",
"double",
"-",
"quoted",
"or",
"backquoted",
"Prometheus",
"query",
"language",
"string",
"literal",
"returning",
"the",
"string",
"value",
"that",
"s",
"quotes",
".",
"NOTE",
":",
"This",
"function",
"as",
"well",
"as",
"the",
"necessary",
"helper",
"functions",
"below",
"(",
"unquoteChar",
"contains",
"unhex",
")",
"and",
"associated",
"tests",
"have",
"been",
"adapted",
"from",
"the",
"corresponding",
"functions",
"in",
"the",
"strconv",
"package",
"of",
"the",
"Go",
"standard",
"library",
"to",
"work",
"for",
"Prometheus",
"-",
"style",
"strings",
".",
"Go",
"s",
"special",
"-",
"casing",
"for",
"single",
"quotes",
"was",
"removed",
"and",
"single",
"quoted",
"strings",
"are",
"now",
"treated",
"the",
"same",
"as",
"double",
"quoted",
"ones",
"."
] | [
"func",
"Unquote",
"(",
"s",
"string",
")",
"(",
"t",
"string",
",",
"err",
"error",
")",
"{",
"n",
":=",
"len",
"(",
"s",
")",
"\n",
"if",
"n",
"<",
"2",
"{",
"return",
"\"",
"\"",
",",
"ErrSyntax",
"\n",
"}",
"\n",
"quote",
":=",
"s",
"[",
"0",
"]",
"\n",
"if",
"quote",
"!=",
"s",
"[",
"n",
"-",
"1",
"]",
"{",
"return",
"\"",
"\"",
",",
"ErrSyntax",
"\n",
"}",
"\n",
"s",
"=",
"s",
"[",
"1",
":",
"n",
"-",
"1",
"]",
"\n\n",
"if",
"quote",
"==",
"'`'",
"{",
"if",
"contains",
"(",
"s",
",",
"'`'",
")",
"{",
"return",
"\"",
"\"",
",",
"ErrSyntax",
"\n",
"}",
"\n",
"return",
"s",
",",
"nil",
"\n",
"}",
"\n",
"if",
"quote",
"!=",
"'\"'",
"&&",
"<mask>",
"!=",
"'\\''",
"{",
"return",
"\"",
"\"",
",",
"ErrSyntax",
"\n",
"}",
"\n",
"if",
"contains",
"(",
"s",
",",
"'\\n'",
")",
"{",
"return",
"\"",
"\"",
",",
"ErrSyntax",
"\n",
"}",
"\n\n",
"// Is it trivial? Avoid allocation.",
"if",
"!",
"contains",
"(",
"s",
",",
"'\\\\'",
")",
"&&",
"!",
"contains",
"(",
"s",
",",
"quote",
")",
"{",
"return",
"s",
",",
"nil",
"\n",
"}",
"\n\n",
"var",
"runeTmp",
"[",
"utf8",
".",
"UTFMax",
"]",
"byte",
"\n",
"buf",
":=",
"make",
"(",
"[",
"]",
"byte",
",",
"0",
",",
"3",
"*",
"len",
"(",
"s",
")",
"/",
"2",
")",
"// Try to avoid more allocations.",
"\n",
"for",
"len",
"(",
"s",
")",
">",
"0",
"{",
"c",
",",
"multibyte",
",",
"ss",
",",
"err",
":=",
"unquoteChar",
"(",
"s",
",",
"quote",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"\"",
"\"",
",",
"err",
"\n",
"}",
"\n",
"s",
"=",
"ss",
"\n",
"if",
"c",
"<",
"utf8",
".",
"RuneSelf",
"||",
"!",
"multibyte",
"{",
"buf",
"=",
"append",
"(",
"buf",
",",
"byte",
"(",
"c",
")",
")",
"\n",
"}",
"else",
"{",
"n",
":=",
"utf8",
".",
"EncodeRune",
"(",
"runeTmp",
"[",
":",
"]",
",",
"c",
")",
"\n",
"buf",
"=",
"append",
"(",
"buf",
",",
"runeTmp",
"[",
":",
"n",
"]",
"...",
")",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"string",
"(",
"buf",
")",
",",
"nil",
"\n",
"}"
] |
22,523 | all-22524 | [
"MarshalJSON",
"supports",
"json",
".",
"Marshaler",
"interface"
] | [
"func",
"(",
"v",
"GetHistogramReturns",
")",
"MarshalJSON",
"(",
")",
"(",
"[",
"]",
"<mask>",
",",
"error",
")",
"{",
"w",
":=",
"jwriter",
".",
"Writer",
"{",
"}",
"\n",
"easyjsonC5a4559bEncodeGithubComChromedpCdprotoBrowser13",
"(",
"&",
"w",
",",
"v",
")",
"\n",
"return",
"w",
".",
"Buffer",
".",
"BuildBytes",
"(",
")",
",",
"w",
".",
"Error",
"\n",
"}"
] |
22,524 | all-22525 | [
"RemoveOrgMembership",
"removes",
"the",
"user",
"from",
"the",
"org",
".",
"https",
":",
"//",
"developer",
".",
"github",
".",
"com",
"/",
"v3",
"/",
"orgs",
"/",
"members",
"/",
"#remove",
"-",
"organization",
"-",
"membership"
] | [
"func",
"(",
"c",
"*",
"Client",
")",
"RemoveOrgMembership",
"(",
"org",
",",
"<mask>",
"string",
")",
"error",
"{",
"c",
".",
"log",
"(",
"\"",
"\"",
",",
"org",
",",
"user",
")",
"\n",
"_",
",",
"err",
":=",
"c",
".",
"request",
"(",
"&",
"request",
"{",
"method",
":",
"http",
".",
"MethodDelete",
",",
"path",
":",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"org",
",",
"user",
")",
",",
"exitCodes",
":",
"[",
"]",
"int",
"{",
"204",
"}",
",",
"}",
",",
"nil",
")",
"\n",
"return",
"err",
"\n",
"}"
] |
22,525 | all-22526 | [
"Misc",
"gets"
] | [
"func",
"(",
"s",
"ScribbleStore",
")",
"GetByField",
"(",
"name",
",",
"val",
",",
"store",
"string",
",",
"dst",
"<mask>",
"{",
"}",
")",
"error",
"{",
"return",
"ErrNotImplemented",
"\n",
"}"
] |
22,526 | all-22527 | [
"CreateUser",
"creates",
"a",
"new",
"user",
"given",
"an",
"email",
"and",
"password"
] | [
"func",
"(",
"c",
"Client",
")",
"CreateUser",
"(",
"email",
"string",
",",
"password",
"string",
")",
"(",
"*",
"user",
",",
"error",
")",
"{",
"params",
":=",
"map",
"[",
"string",
"]",
"interface",
"{",
"}",
"{",
"\"",
"\"",
":",
"<mask>",
",",
"\"",
"\"",
":",
"password",
",",
"}",
"\n",
"holder",
":=",
"userHolder",
"{",
"}",
"\n",
"if",
"err",
":=",
"c",
".",
"Post",
"(",
"\"",
"\"",
",",
"params",
",",
"&",
"holder",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"if",
"err",
":=",
"checkApiErrors",
"(",
"holder",
".",
"response",
",",
"\"",
"\"",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"return",
"&",
"holder",
".",
"User",
",",
"nil",
"\n",
"}"
] |
22,527 | all-22528 | [
"GetPeriod",
"returns",
"the",
"Period",
"field",
"if",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"."
] | [
"func",
"(",
"r",
"*",
"Recurrence",
")",
"GetPeriod",
"(",
")",
"int",
"{",
"if",
"r",
"==",
"nil",
"||",
"r",
".",
"Period",
"==",
"nil",
"{",
"return",
"0",
"\n",
"}",
"\n",
"<mask>",
"*",
"r",
".",
"Period",
"\n",
"}"
] |
22,528 | all-22529 | [
"ReadBody",
"takes",
"in",
"a",
"previously",
"read",
"frame",
"header",
"and",
"only",
"reads",
"in",
"the",
"body",
"based",
"on",
"the",
"size",
"specified",
"in",
"the",
"header",
".",
"This",
"allows",
"callers",
"to",
"defer",
"the",
"frame",
"allocation",
"till",
"the",
"body",
"needs",
"to",
"be",
"read",
"."
] | [
"func",
"(",
"f",
"*",
"Frame",
")",
"ReadBody",
"(",
"header",
"[",
"]",
"<mask>",
",",
"r",
"io",
".",
"Reader",
")",
"error",
"{",
"// Copy the header into the underlying buffer so we have an assembled frame",
"// that can be directly forwarded.",
"copy",
"(",
"f",
".",
"buffer",
",",
"header",
")",
"\n\n",
"// Parse the header into our typed struct.",
"if",
"err",
":=",
"f",
".",
"Header",
".",
"read",
"(",
"typed",
".",
"NewReadBuffer",
"(",
"header",
")",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"switch",
"payloadSize",
":=",
"f",
".",
"Header",
".",
"PayloadSize",
"(",
")",
";",
"{",
"case",
"payloadSize",
">",
"MaxFramePayloadSize",
":",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"f",
".",
"Header",
".",
"size",
")",
"\n",
"case",
"payloadSize",
">",
"0",
":",
"_",
",",
"err",
":=",
"io",
".",
"ReadFull",
"(",
"r",
",",
"f",
".",
"SizedPayload",
"(",
")",
")",
"\n",
"return",
"err",
"\n",
"default",
":",
"// No payload to read",
"return",
"nil",
"\n",
"}",
"\n",
"}"
] |
22,529 | all-22530 | [
"EventualConsistency",
"returns",
"a",
"derivative",
"query",
"that",
"returns",
"eventually",
"consistent",
"results",
".",
"It",
"only",
"has",
"an",
"effect",
"on",
"ancestor",
"queries",
"."
] | [
"func",
"(",
"q",
"*",
"Query",
")",
"EventualConsistency",
"(",
")",
"*",
"Query",
"{",
"q",
"=",
"q",
".",
"<mask>",
"(",
")",
"\n",
"q",
".",
"eventual",
"=",
"true",
"\n",
"return",
"q",
"\n",
"}"
] |
22,530 | all-22531 | [
"Close",
"is",
"the",
"external",
"close",
"function",
".",
"it",
"s",
"a",
"wrapper",
"around",
"internalClose",
"that",
"waits",
"on",
"Closed",
"()"
] | [
"func",
"(",
"p",
"*",
"process",
")",
"Close",
"(",
")",
"error",
"{",
"p",
".",
"Lock",
"(",
")",
"\n\n",
"// if already closing, or closed, get out. (but wait!)",
"select",
"{",
"<mask>",
"<-",
"p",
".",
"Closing",
"(",
")",
":",
"p",
".",
"Unlock",
"(",
")",
"\n",
"<-",
"p",
".",
"Closed",
"(",
")",
"\n",
"return",
"p",
".",
"closeErr",
"\n",
"default",
":",
"}",
"\n\n",
"p",
".",
"doClose",
"(",
")",
"\n",
"p",
".",
"Unlock",
"(",
")",
"\n",
"return",
"p",
".",
"closeErr",
"\n",
"}"
] |
22,531 | all-22532 | [
"establish",
"data",
"storage",
"format",
"and",
"dimensions",
"of",
"a",
"renderbuffer",
"object",
"s",
"image"
] | [
"func",
"NamedRenderbufferStorage",
"(",
"renderbuffer",
"uint32",
",",
"internalformat",
"uint32",
",",
"width",
"int32",
",",
"height",
"int32",
")",
"{",
"syscall",
".",
"Syscall6",
"(",
"gpNamedRenderbufferStorage",
",",
"4",
",",
"uintptr",
"(",
"renderbuffer",
")",
",",
"uintptr",
"(",
"internalformat",
")",
",",
"uintptr",
"(",
"<mask>",
")",
",",
"uintptr",
"(",
"height",
")",
",",
"0",
",",
"0",
")",
"\n",
"}"
] |
22,532 | all-22533 | [
"RenameNetwork",
"renames",
"an",
"existing",
"network",
"entry"
] | [
"func",
"(",
"r",
"*",
"ProtocolLXD",
")",
"RenameNetwork",
"(",
"name",
"string",
",",
"<mask>",
"api",
".",
"NetworkPost",
")",
"error",
"{",
"if",
"!",
"r",
".",
"HasExtension",
"(",
"\"",
"\"",
")",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\\\"",
"\\\"",
"\"",
")",
"\n",
"}",
"\n\n",
"// Send the request",
"_",
",",
"_",
",",
"err",
":=",
"r",
".",
"query",
"(",
"\"",
"\"",
",",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"url",
".",
"QueryEscape",
"(",
"name",
")",
")",
",",
"network",
",",
"\"",
"\"",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"return",
"nil",
"\n",
"}"
] |
22,533 | all-22534 | [
"String",
"implements",
"the",
"Stringer",
"interface",
"."
] | [
"func",
"(",
"f",
"*",
"ParameterField",
")",
"String",
"(",
")",
"string",
"{",
"return",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"f",
".",
"parameterOptions",
",",
"f",
".",
"tc",
",",
"f",
".",
"mode",
",",
"f",
".",
"fraction",
",",
"f",
".",
"length",
",",
"f",
".",
"<mask>",
"(",
")",
",",
")",
"\n",
"}"
] |
22,534 | all-22535 | [
"Float64",
"adds",
"a",
"float64",
"-",
"valued",
"key",
":",
"value",
"pair",
"to",
"a",
"Span",
".",
"LogFields",
"()",
"record"
] | [
"func",
"Float64",
"(",
"key",
"string",
",",
"val",
"float64",
")",
"Field",
"{",
"return",
"Field",
"{",
"key",
":",
"<mask>",
",",
"fieldType",
":",
"float64Type",
",",
"numericVal",
":",
"int64",
"(",
"math",
".",
"Float64bits",
"(",
"val",
")",
")",
",",
"}",
"\n",
"}"
] |
22,535 | all-22536 | [
"Sync",
"does",
"one",
"sync",
"iteration",
"."
] | [
"func",
"(",
"c",
"*",
"Controller",
")",
"Sync",
"(",
")",
"error",
"{",
"pjs",
",",
"err",
":=",
"c",
".",
"prowJobClient",
".",
"List",
"(",
"metav1",
".",
"ListOptions",
"{",
"LabelSelector",
":",
"c",
".",
"selector",
"}",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"}",
"\n",
"// Share what we have for gathering metrics.",
"c",
".",
"pjLock",
".",
"Lock",
"(",
")",
"\n",
"c",
".",
"pjs",
"=",
"pjs",
".",
"Items",
"\n",
"c",
".",
"pjLock",
".",
"Unlock",
"(",
")",
"\n\n",
"// TODO: Replace the following filtering with a field selector once CRDs support field selectors.",
"// https://github.com/kubernetes/kubernetes/issues/53459",
"var",
"jenkinsJobs",
"[",
"]",
"prowapi",
".",
"ProwJob",
"\n",
"for",
"_",
",",
"pj",
":=",
"range",
"pjs",
".",
"Items",
"{",
"if",
"pj",
".",
"Spec",
".",
"Agent",
"==",
"prowapi",
".",
"JenkinsAgent",
"{",
"jenkinsJobs",
"=",
"append",
"(",
"jenkinsJobs",
",",
"pj",
")",
"\n",
"}",
"\n",
"}",
"\n",
"jbs",
",",
"err",
":=",
"c",
".",
"jc",
".",
"ListBuilds",
"(",
"getJenkinsJobs",
"(",
"jenkinsJobs",
")",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"}",
"\n\n",
"var",
"syncErrs",
"[",
"]",
"error",
"\n",
"if",
"err",
":=",
"c",
".",
"terminateDupes",
"(",
"jenkinsJobs",
",",
"jbs",
")",
";",
"err",
"!=",
"nil",
"{",
"syncErrs",
"=",
"append",
"(",
"syncErrs",
",",
"err",
")",
"\n",
"}",
"\n\n",
"pendingCh",
",",
"triggeredCh",
":=",
"pjutil",
".",
"PartitionActive",
"(",
"jenkinsJobs",
")",
"\n",
"errCh",
":=",
"make",
"(",
"chan",
"error",
",",
"len",
"(",
"jenkinsJobs",
")",
")",
"\n",
"reportCh",
":=",
"make",
"(",
"chan",
"prowapi",
".",
"ProwJob",
",",
"len",
"(",
"jenkinsJobs",
")",
")",
"\n\n",
"// Reinstantiate on every resync of the controller instead of trying",
"// to keep this in sync with the state of the world.",
"c",
".",
"pendingJobs",
"=",
"<mask>",
"(",
"map",
"[",
"string",
"]",
"int",
")",
"\n",
"// Sync pending jobs first so we can determine what is the maximum",
"// number of new jobs we can trigger when syncing the non-pendings.",
"maxSyncRoutines",
":=",
"c",
".",
"config",
"(",
")",
".",
"MaxGoroutines",
"\n",
"c",
".",
"log",
".",
"Debugf",
"(",
"\"",
"\"",
",",
"len",
"(",
"pendingCh",
")",
")",
"\n",
"syncProwJobs",
"(",
"c",
".",
"log",
",",
"c",
".",
"syncPendingJob",
",",
"maxSyncRoutines",
",",
"pendingCh",
",",
"reportCh",
",",
"errCh",
",",
"jbs",
")",
"\n",
"c",
".",
"log",
".",
"Debugf",
"(",
"\"",
"\"",
",",
"len",
"(",
"triggeredCh",
")",
")",
"\n",
"syncProwJobs",
"(",
"c",
".",
"log",
",",
"c",
".",
"syncTriggeredJob",
",",
"maxSyncRoutines",
",",
"triggeredCh",
",",
"reportCh",
",",
"errCh",
",",
"jbs",
")",
"\n\n",
"close",
"(",
"errCh",
")",
"\n",
"close",
"(",
"reportCh",
")",
"\n\n",
"for",
"err",
":=",
"range",
"errCh",
"{",
"syncErrs",
"=",
"append",
"(",
"syncErrs",
",",
"err",
")",
"\n",
"}",
"\n\n",
"var",
"reportErrs",
"[",
"]",
"error",
"\n",
"reportTemplate",
":=",
"c",
".",
"config",
"(",
")",
".",
"ReportTemplate",
"\n",
"reportTypes",
":=",
"c",
".",
"cfg",
"(",
")",
".",
"GitHubReporter",
".",
"JobTypesToReport",
"\n",
"for",
"report",
":=",
"range",
"reportCh",
"{",
"if",
"err",
":=",
"reportlib",
".",
"Report",
"(",
"c",
".",
"ghc",
",",
"reportTemplate",
",",
"report",
",",
"reportTypes",
")",
";",
"err",
"!=",
"nil",
"{",
"reportErrs",
"=",
"append",
"(",
"reportErrs",
",",
"err",
")",
"\n",
"c",
".",
"log",
".",
"WithFields",
"(",
"pjutil",
".",
"ProwJobFields",
"(",
"&",
"report",
")",
")",
".",
"WithError",
"(",
"err",
")",
".",
"Warn",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"}",
"\n\n",
"if",
"len",
"(",
"syncErrs",
")",
"==",
"0",
"&&",
"len",
"(",
"reportErrs",
")",
"==",
"0",
"{",
"return",
"nil",
"\n",
"}",
"\n",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"syncErrs",
",",
"reportErrs",
")",
"\n",
"}"
] |
22,536 | all-22537 | [
"newPayloadRequestHandler",
"returns",
"a",
"new",
"payloadRequestHandler",
"object"
] | [
"func",
"newPayloadRequestHandler",
"(",
"ctx",
"context",
".",
"Context",
",",
"taskEngine",
"engine",
".",
"TaskEngine",
",",
"ecsClient",
"api",
".",
"ECSClient",
",",
"cluster",
"string",
",",
"containerInstanceArn",
"string",
",",
"acsClient",
"wsclient",
".",
"ClientServer",
",",
"saver",
"statemanager",
".",
"Saver",
",",
"refreshHandler",
"refreshCredentialsHandler",
",",
"credentialsManager",
"credentials",
".",
"Manager",
",",
"taskHandler",
"*",
"eventhandler",
".",
"TaskHandler",
")",
"payloadRequestHandler",
"{",
"// Create a cancelable context from the parent context",
"derivedContext",
",",
"cancel",
":=",
"context",
".",
"WithCancel",
"(",
"ctx",
")",
"\n",
"return",
"payloadRequestHandler",
"{",
"messageBuffer",
":",
"<mask>",
"(",
"chan",
"*",
"ecsacs",
".",
"PayloadMessage",
",",
"payloadMessageBufferSize",
")",
",",
"ackRequest",
":",
"make",
"(",
"chan",
"string",
",",
"payloadMessageBufferSize",
")",
",",
"taskEngine",
":",
"taskEngine",
",",
"ecsClient",
":",
"ecsClient",
",",
"saver",
":",
"saver",
",",
"taskHandler",
":",
"taskHandler",
",",
"ctx",
":",
"derivedContext",
",",
"cancel",
":",
"cancel",
",",
"cluster",
":",
"cluster",
",",
"containerInstanceArn",
":",
"containerInstanceArn",
",",
"acsClient",
":",
"acsClient",
",",
"refreshHandler",
":",
"refreshHandler",
",",
"credentialsManager",
":",
"credentialsManager",
",",
"}",
"\n",
"}"
] |
22,537 | all-22538 | [
"WithScale",
"scale",
"of",
"the",
"webpage",
"rendering",
".",
"Defaults",
"to",
"1",
"."
] | [
"func",
"(",
"p",
"PrintToPDFParams",
")",
"WithScale",
"(",
"scale",
"float64",
")",
"*",
"PrintToPDFParams",
"{",
"p",
".",
"Scale",
"=",
"<mask>",
"\n",
"return",
"&",
"p",
"\n",
"}"
] |
22,538 | all-22539 | [
"refresh",
"refreshes",
"the",
"expiry",
"of",
"the",
"lease",
"."
] | [
"func",
"(",
"l",
"*",
"Lease",
")",
"refresh",
"(",
"extend",
"time",
".",
"Duration",
")",
"{",
"newExpiry",
":=",
"time",
".",
"Now",
"(",
")",
".",
"Add",
"(",
"extend",
"+",
"<mask>",
".",
"Duration",
"(",
"l",
".",
"RemainingTTL",
"(",
")",
")",
"*",
"time",
".",
"Second",
")",
"\n",
"l",
".",
"expiryMu",
".",
"Lock",
"(",
")",
"\n",
"defer",
"l",
".",
"expiryMu",
".",
"Unlock",
"(",
")",
"\n",
"l",
".",
"expiry",
"=",
"newExpiry",
"\n",
"}"
] |
22,539 | all-22540 | [
"PushEvent",
"-",
"exported",
"service",
"to",
"listening",
"to",
"remote",
"events"
] | [
"func",
"(",
"service",
"*",
"ClientService",
")",
"PushEvent",
"(",
"arg",
"*",
"ClientArg",
",",
"reply",
"*",
"bool",
")",
"error",
"{",
"service",
".",
"client",
".",
"eventBus",
".",
"Publish",
"(",
"arg",
".",
"<mask>",
",",
"arg",
".",
"Args",
"...",
")",
"\n",
"*",
"reply",
"=",
"true",
"\n",
"return",
"nil",
"\n",
"}"
] |
22,540 | all-22541 | [
"ScalarFields",
"returns",
"the",
"fields",
"that",
"map",
"directly",
"to",
"a",
"single",
"database",
"column",
"on",
"another",
"table",
"that",
"can",
"be",
"joined",
"to",
"this",
"one",
"."
] | [
"func",
"(",
"m",
"*",
"Mapping",
")",
"ScalarFields",
"(",
")",
"[",
"]",
"*",
"Field",
"{",
"fields",
":=",
"[",
"]",
"*",
"Field",
"{",
"}",
"\n\n",
"for",
"_",
",",
"<mask>",
":=",
"range",
"m",
".",
"Fields",
"{",
"if",
"field",
".",
"Config",
".",
"Get",
"(",
"\"",
"\"",
")",
"!=",
"\"",
"\"",
"{",
"fields",
"=",
"append",
"(",
"fields",
",",
"field",
")",
"\n",
"}",
"\n",
"}",
"\n\n",
"return",
"fields",
"\n",
"}"
] |
22,541 | all-22542 | [
"SetLabel",
"is",
"a",
"wrapper",
"around",
"gtk_label_set_label",
"()",
"."
] | [
"func",
"(",
"v",
"*",
"Label",
")",
"SetLabel",
"(",
"str",
"string",
")",
"{",
"cstr",
":=",
"C",
".",
"CString",
"(",
"str",
")",
"\n",
"defer",
"C",
".",
"<mask>",
"(",
"unsafe",
".",
"Pointer",
"(",
"cstr",
")",
")",
"\n",
"C",
".",
"gtk_label_set_label",
"(",
"v",
".",
"native",
"(",
")",
",",
"(",
"*",
"C",
".",
"gchar",
")",
"(",
"cstr",
")",
")",
"\n",
"}"
] |
22,542 | all-22543 | [
"NewTaskStatsResponse",
"returns",
"a",
"new",
"task",
"stats",
"response",
"object"
] | [
"func",
"NewTaskStatsResponse",
"(",
"taskARN",
"string",
",",
"state",
"dockerstate",
".",
"TaskEngineState",
",",
"statsEngine",
"stats",
".",
"Engine",
")",
"(",
"map",
"[",
"string",
"]",
"*",
"types",
".",
"StatsJSON",
",",
"error",
")",
"{",
"containerMap",
",",
"ok",
":=",
"state",
".",
"ContainerMapByArn",
"(",
"taskARN",
")",
"\n",
"if",
"!",
"ok",
"{",
"return",
"nil",
",",
"errors",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"taskARN",
")",
"\n",
"}",
"\n\n",
"resp",
":=",
"<mask>",
"(",
"map",
"[",
"string",
"]",
"*",
"types",
".",
"StatsJSON",
")",
"\n",
"for",
"_",
",",
"dockerContainer",
":=",
"range",
"containerMap",
"{",
"containerID",
":=",
"dockerContainer",
".",
"DockerID",
"\n",
"dockerStats",
",",
"err",
":=",
"statsEngine",
".",
"ContainerDockerStats",
"(",
"taskARN",
",",
"containerID",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"seelog",
".",
"Warnf",
"(",
"\"",
"\"",
",",
"containerID",
",",
"taskARN",
",",
"err",
")",
"\n",
"resp",
"[",
"containerID",
"]",
"=",
"nil",
"\n",
"continue",
"\n",
"}",
"\n\n",
"resp",
"[",
"containerID",
"]",
"=",
"dockerStats",
"\n",
"}",
"\n\n",
"return",
"resp",
",",
"nil",
"\n",
"}"
] |
22,543 | all-22544 | [
"IsUnixSocket",
"returns",
"true",
"if",
"the",
"given",
"path",
"is",
"either",
"a",
"Unix",
"socket",
"or",
"a",
"symbolic",
"link",
"pointing",
"at",
"a",
"Unix",
"socket",
"."
] | [
"func",
"IsUnixSocket",
"(",
"path",
"string",
")",
"bool",
"{",
"stat",
",",
"err",
":=",
"os",
".",
"Stat",
"(",
"path",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"<mask>",
"\n",
"}",
"\n",
"return",
"(",
"stat",
".",
"Mode",
"(",
")",
"&",
"os",
".",
"ModeSocket",
")",
"==",
"os",
".",
"ModeSocket",
"\n",
"}"
] |
22,544 | all-22545 | [
"FirewallPolicies",
"retrieves",
"a",
"list",
"of",
"all",
"firewall",
"policies"
] | [
"func",
"(",
"c",
"*",
"<mask>",
")",
"FirewallPolicies",
"(",
")",
"(",
"[",
"]",
"FirewallPolicy",
",",
"error",
")",
"{",
"var",
"policies",
"[",
"]",
"FirewallPolicy",
"\n",
"_",
",",
"err",
":=",
"c",
".",
"MakeApiRequest",
"(",
"\"",
"\"",
",",
"\"",
"\"",
",",
"nil",
",",
"&",
"policies",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"return",
"policies",
",",
"err",
"\n",
"}"
] |
22,545 | all-22546 | [
"MigrateContainerSnapshot",
"requests",
"that",
"LXD",
"prepares",
"for",
"a",
"snapshot",
"migration"
] | [
"func",
"(",
"r",
"*",
"ProtocolLXD",
")",
"MigrateContainerSnapshot",
"(",
"containerName",
"string",
",",
"name",
"string",
",",
"container",
"api",
".",
"ContainerSnapshotPost",
")",
"(",
"Operation",
",",
"error",
")",
"{",
"// Sanity check",
"if",
"!",
"container",
".",
"Migration",
"{",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"// Send the request",
"op",
",",
"_",
",",
"err",
":=",
"r",
".",
"queryOperation",
"(",
"\"",
"\"",
",",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"url",
".",
"QueryEscape",
"(",
"containerName",
")",
",",
"<mask>",
".",
"QueryEscape",
"(",
"name",
")",
")",
",",
"container",
",",
"\"",
"\"",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"return",
"op",
",",
"nil",
"\n",
"}"
] |
22,546 | all-22547 | [
"rfc2047AttributeName",
"checks",
"if",
"the",
"attribute",
"name",
"is",
"encoded",
"in",
"RFC2047",
"format",
"RFC2047",
"Example",
":",
"=",
"?UTF",
"-",
"8?B?bmFtZT0iw7DCn8KUwoo",
"=",
"?",
"="
] | [
"func",
"rfc2047AttributeName",
"(",
"s",
"string",
")",
"string",
"{",
"if",
"!",
"strings",
".",
"Contains",
"(",
"s",
",",
"\"",
"\"",
")",
"{",
"return",
"s",
"\n",
"}",
"\n",
"<mask>",
":=",
"strings",
".",
"SplitAfter",
"(",
"s",
",",
"\"",
"\"",
")",
"\n",
"pair",
"[",
"0",
"]",
"=",
"decodeHeader",
"(",
"pair",
"[",
"0",
"]",
")",
"\n",
"return",
"strings",
".",
"Join",
"(",
"pair",
",",
"\"",
"\"",
")",
"\n",
"}"
] |
22,547 | all-22548 | [
"HasOrderBy",
"returns",
"a",
"boolean",
"if",
"a",
"field",
"has",
"been",
"set",
"."
] | [
"func",
"(",
"c",
"*",
"ChangeRequest",
")",
"HasOrderBy",
"(",
")",
"bool",
"{",
"if",
"c",
"!=",
"nil",
"&&",
"c",
".",
"OrderBy",
"!=",
"nil",
"{",
"return",
"true",
"\n",
"}",
"\n\n",
"return",
"<mask>",
"\n",
"}"
] |
22,548 | all-22549 | [
"Debugln",
"logging"
] | [
"func",
"(",
"l",
"*",
"StdLevelLogger",
")",
"Debugln",
"(",
"args",
"...",
"<mask>",
"{",
"}",
")",
"{",
"l",
".",
"loglnFunc",
"(",
"DebugLevel",
",",
"l",
".",
"context",
",",
"args",
"...",
")",
"\n",
"}"
] |
22,549 | all-22550 | [
"UnmarshalJSON",
"satisfies",
"json",
".",
"Unmarshaler",
"."
] | [
"func",
"(",
"t",
"*",
"NodeID",
")",
"UnmarshalJSON",
"(",
"buf",
"[",
"]",
"<mask>",
")",
"error",
"{",
"return",
"easyjson",
".",
"Unmarshal",
"(",
"buf",
",",
"t",
")",
"\n",
"}"
] |
22,550 | all-22551 | [
"UpdateOp",
"is",
"a",
"helper",
"to",
"update",
"the",
"status",
"using",
"a",
"LXD",
"API",
"operation"
] | [
"func",
"(",
"p",
"*",
"ProgressRenderer",
")",
"UpdateOp",
"(",
"op",
"api",
".",
"Operation",
")",
"{",
"if",
"op",
".",
"Metadata",
"==",
"nil",
"{",
"return",
"\n",
"}",
"\n\n",
"for",
"<mask>",
",",
"value",
":=",
"range",
"op",
".",
"Metadata",
"{",
"if",
"!",
"strings",
".",
"HasSuffix",
"(",
"key",
",",
"\"",
"\"",
")",
"{",
"continue",
"\n",
"}",
"\n\n",
"p",
".",
"Update",
"(",
"value",
".",
"(",
"string",
")",
")",
"\n",
"break",
"\n",
"}",
"\n",
"}"
] |
22,551 | all-22552 | [
"NewTemplateMsg",
"will",
"create",
"a",
"new",
"TemplateMsg",
"with",
"values",
"from",
"the",
"given",
"parameters"
] | [
"func",
"NewTemplateMsg",
"(",
"timestamp",
"time",
".",
"Time",
",",
"level",
"LogLevel",
",",
"m",
"map",
"[",
"string",
"]",
"interface",
"{",
"}",
",",
"msg",
"string",
")",
"*",
"TemplateMsg",
"{",
"msgAttrs",
":=",
"m",
"\n",
"if",
"msgAttrs",
"==",
"nil",
"{",
"msgAttrs",
"=",
"make",
"(",
"map",
"[",
"string",
"]",
"interface",
"{",
"}",
")",
"\n",
"}",
"\n",
"tplMsg",
":=",
"&",
"TemplateMsg",
"{",
"Timestamp",
":",
"timestamp",
",",
"Message",
":",
"msg",
",",
"Level",
":",
"<mask>",
",",
"LevelName",
":",
"level",
".",
"String",
"(",
")",
",",
"Attrs",
":",
"msgAttrs",
",",
"}",
"\n",
"return",
"tplMsg",
"\n",
"}"
] |
22,552 | all-22553 | [
"Do",
"executes",
"Overlay",
".",
"highlightQuad",
"against",
"the",
"provided",
"context",
"."
] | [
"func",
"(",
"p",
"*",
"HighlightQuadParams",
")",
"Do",
"(",
"ctx",
"<mask>",
".",
"Context",
")",
"(",
"err",
"error",
")",
"{",
"return",
"cdp",
".",
"Execute",
"(",
"ctx",
",",
"CommandHighlightQuad",
",",
"p",
",",
"nil",
")",
"\n",
"}"
] |
22,553 | all-22554 | [
"GetContainerTemplateFiles",
"returns",
"the",
"list",
"of",
"names",
"of",
"template",
"files",
"for",
"a",
"container",
"."
] | [
"func",
"(",
"r",
"*",
"ProtocolLXD",
")",
"GetContainerTemplateFiles",
"(",
"containerName",
"string",
")",
"(",
"[",
"]",
"string",
",",
"error",
")",
"{",
"if",
"!",
"r",
".",
"HasExtension",
"(",
"\"",
"\"",
")",
"{",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\\\"",
"\\\"",
"\"",
")",
"\n",
"}",
"\n\n",
"templates",
":=",
"[",
"]",
"string",
"{",
"}",
"\n\n",
"url",
":=",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"url",
".",
"QueryEscape",
"(",
"containerName",
")",
")",
"\n",
"_",
",",
"err",
":=",
"r",
".",
"queryStruct",
"(",
"\"",
"\"",
",",
"<mask>",
",",
"nil",
",",
"\"",
"\"",
",",
"&",
"templates",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"return",
"templates",
",",
"nil",
"\n",
"}"
] |
22,554 | all-22555 | [
"SimpleProofsFromHashers",
"computes",
"inclusion",
"proof",
"for",
"given",
"items",
".",
"proofs",
"[",
"0",
"]",
"is",
"the",
"proof",
"for",
"items",
"[",
"0",
"]",
"."
] | [
"func",
"SimpleProofsFromHashers",
"(",
"items",
"[",
"]",
"Hasher",
")",
"(",
"rootHash",
"[",
"]",
"byte",
",",
"proofs",
"[",
"]",
"*",
"SimpleProof",
")",
"{",
"trails",
",",
"rootSPN",
":=",
"trailsFromHashers",
"(",
"items",
")",
"\n",
"rootHash",
"=",
"rootSPN",
".",
"Hash",
"\n",
"proofs",
"=",
"make",
"(",
"[",
"]",
"*",
"SimpleProof",
",",
"len",
"(",
"items",
")",
")",
"\n",
"for",
"i",
",",
"trail",
":=",
"<mask>",
"trails",
"{",
"proofs",
"[",
"i",
"]",
"=",
"&",
"SimpleProof",
"{",
"Aunts",
":",
"trail",
".",
"FlattenAunts",
"(",
")",
",",
"}",
"\n",
"}",
"\n",
"return",
"\n",
"}"
] |
22,555 | all-22556 | [
"UnmarshalJSON",
"supports",
"json",
".",
"Unmarshaler",
"interface"
] | [
"func",
"(",
"v",
"*",
"GetApplicationCacheForFrameReturns",
")",
"UnmarshalJSON",
"(",
"data",
"[",
"]",
"byte",
")",
"error",
"{",
"r",
":=",
"jlexer",
".",
"Lexer",
"{",
"Data",
":",
"data",
"}",
"\n",
"easyjsonC5a4559bDecodeGithubComChromedpCdprotoApplicationcache5",
"(",
"&",
"r",
",",
"v",
")",
"\n",
"return",
"r",
".",
"<mask>",
"(",
")",
"\n",
"}"
] |
22,556 | all-22557 | [
"Main",
"is",
"implemented",
"here",
"so",
"both",
"pp",
"and",
"panicparse",
"executables",
"can",
"be",
"compiled",
".",
"This",
"is",
"to",
"work",
"around",
"the",
"Perl",
"Package",
"manager",
"pp",
"that",
"is",
"preinstalled",
"on",
"some",
"OSes",
"."
] | [
"func",
"Main",
"(",
")",
"error",
"{",
"aggressive",
":=",
"flag",
".",
"Bool",
"(",
"\"",
"\"",
",",
"false",
",",
"\"",
"\"",
")",
"\n",
"parse",
":=",
"flag",
".",
"Bool",
"(",
"\"",
"\"",
",",
"true",
",",
"\"",
"\"",
")",
"\n",
"rebase",
":=",
"flag",
".",
"Bool",
"(",
"\"",
"\"",
",",
"true",
",",
"\"",
"\"",
")",
"\n",
"verboseFlag",
":=",
"flag",
".",
"Bool",
"(",
"\"",
"\"",
",",
"false",
",",
"\"",
"\"",
")",
"\n",
"filterFlag",
":=",
"flag",
".",
"String",
"(",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
")",
"\n",
"matchFlag",
":=",
"flag",
".",
"String",
"(",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
")",
"\n",
"// Console only.",
"fullPath",
":=",
"flag",
".",
"Bool",
"(",
"\"",
"\"",
",",
"false",
",",
"\"",
"\"",
")",
"\n",
"noColor",
":=",
"flag",
".",
"Bool",
"(",
"\"",
"\"",
",",
"!",
"isatty",
".",
"IsTerminal",
"(",
"os",
".",
"Stdout",
".",
"Fd",
"(",
")",
")",
"||",
"os",
".",
"Getenv",
"(",
"\"",
"\"",
")",
"==",
"\"",
"\"",
",",
"\"",
"\"",
")",
"\n",
"forceColor",
":=",
"flag",
".",
"Bool",
"(",
"\"",
"\"",
",",
"false",
",",
"\"",
"\"",
")",
"\n",
"// HTML only.",
"html",
":=",
"<mask>",
".",
"String",
"(",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
")",
"\n",
"flag",
".",
"Parse",
"(",
")",
"\n\n",
"log",
".",
"SetFlags",
"(",
"log",
".",
"Lmicroseconds",
")",
"\n",
"if",
"!",
"*",
"verboseFlag",
"{",
"log",
".",
"SetOutput",
"(",
"ioutil",
".",
"Discard",
")",
"\n",
"}",
"\n\n",
"var",
"err",
"error",
"\n",
"var",
"filter",
"*",
"regexp",
".",
"Regexp",
"\n",
"if",
"*",
"filterFlag",
"!=",
"\"",
"\"",
"{",
"if",
"filter",
",",
"err",
"=",
"regexp",
".",
"Compile",
"(",
"*",
"filterFlag",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"}",
"\n\n",
"var",
"match",
"*",
"regexp",
".",
"Regexp",
"\n",
"if",
"*",
"matchFlag",
"!=",
"\"",
"\"",
"{",
"if",
"match",
",",
"err",
"=",
"regexp",
".",
"Compile",
"(",
"*",
"matchFlag",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"}",
"\n\n",
"s",
":=",
"stack",
".",
"AnyPointer",
"\n",
"if",
"*",
"aggressive",
"{",
"s",
"=",
"stack",
".",
"AnyValue",
"\n",
"}",
"\n\n",
"var",
"out",
"io",
".",
"Writer",
"=",
"os",
".",
"Stdout",
"\n",
"p",
":=",
"&",
"defaultPalette",
"\n",
"if",
"*",
"html",
"==",
"\"",
"\"",
"{",
"if",
"*",
"noColor",
"&&",
"!",
"*",
"forceColor",
"{",
"p",
"=",
"&",
"Palette",
"{",
"}",
"\n",
"}",
"else",
"{",
"out",
"=",
"colorable",
".",
"NewColorableStdout",
"(",
")",
"\n",
"}",
"\n",
"}",
"\n\n",
"var",
"in",
"*",
"os",
".",
"File",
"\n",
"switch",
"flag",
".",
"NArg",
"(",
")",
"{",
"case",
"0",
":",
"in",
"=",
"os",
".",
"Stdin",
"\n",
"// Explicitly silence SIGQUIT, as it is useful to gather the stack dump",
"// from the piped command..",
"signals",
":=",
"make",
"(",
"chan",
"os",
".",
"Signal",
")",
"\n",
"go",
"func",
"(",
")",
"{",
"for",
"{",
"<-",
"signals",
"\n",
"}",
"\n",
"}",
"(",
")",
"\n",
"signal",
".",
"Notify",
"(",
"signals",
",",
"os",
".",
"Interrupt",
",",
"syscall",
".",
"SIGQUIT",
")",
"\n\n",
"case",
"1",
":",
"// Do not handle SIGQUIT when passed a file to process.",
"name",
":=",
"flag",
".",
"Arg",
"(",
"0",
")",
"\n",
"if",
"in",
",",
"err",
"=",
"os",
".",
"Open",
"(",
"name",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"}",
"\n",
"defer",
"in",
".",
"Close",
"(",
")",
"\n\n",
"default",
":",
"return",
"errors",
".",
"New",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"return",
"process",
"(",
"in",
",",
"out",
",",
"p",
",",
"s",
",",
"*",
"fullPath",
",",
"*",
"parse",
",",
"*",
"rebase",
",",
"*",
"html",
",",
"filter",
",",
"match",
")",
"\n",
"}"
] |
22,557 | all-22558 | [
"setupRootfs",
"sets",
"up",
"the",
"devices",
"mount",
"points",
"and",
"filesystems",
"for",
"use",
"inside",
"a",
"new",
"mount",
"namespace",
"."
] | [
"func",
"setupRootfs",
"(",
"config",
"*",
"configs",
".",
"Config",
",",
"console",
"*",
"linuxConsole",
")",
"(",
"err",
"error",
")",
"{",
"if",
"err",
":=",
"prepareRoot",
"(",
"config",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"newSystemError",
"(",
"err",
")",
"\n",
"}",
"\n",
"for",
"_",
",",
"m",
":=",
"range",
"config",
".",
"Mounts",
"{",
"for",
"_",
",",
"precmd",
":=",
"<mask>",
"m",
".",
"PremountCmds",
"{",
"if",
"err",
":=",
"mountCmd",
"(",
"precmd",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"newSystemError",
"(",
"err",
")",
"\n",
"}",
"\n",
"}",
"\n",
"if",
"err",
":=",
"mountToRootfs",
"(",
"m",
",",
"config",
".",
"Rootfs",
",",
"config",
".",
"MountLabel",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"newSystemError",
"(",
"err",
")",
"\n",
"}",
"\n\n",
"for",
"_",
",",
"postcmd",
":=",
"range",
"m",
".",
"PostmountCmds",
"{",
"if",
"err",
":=",
"mountCmd",
"(",
"postcmd",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"newSystemError",
"(",
"err",
")",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n",
"if",
"err",
":=",
"createDevices",
"(",
"config",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"newSystemError",
"(",
"err",
")",
"\n",
"}",
"\n",
"if",
"err",
":=",
"setupPtmx",
"(",
"config",
",",
"console",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"newSystemError",
"(",
"err",
")",
"\n",
"}",
"\n",
"if",
"err",
":=",
"setupDevSymlinks",
"(",
"config",
".",
"Rootfs",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"newSystemError",
"(",
"err",
")",
"\n",
"}",
"\n",
"if",
"err",
":=",
"syscall",
".",
"Chdir",
"(",
"config",
".",
"Rootfs",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"newSystemError",
"(",
"err",
")",
"\n",
"}",
"\n",
"if",
"config",
".",
"NoPivotRoot",
"{",
"err",
"=",
"msMoveRoot",
"(",
"config",
".",
"Rootfs",
")",
"\n",
"}",
"else",
"{",
"err",
"=",
"pivotRoot",
"(",
"config",
".",
"Rootfs",
",",
"config",
".",
"PivotDir",
")",
"\n",
"}",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"newSystemError",
"(",
"err",
")",
"\n",
"}",
"\n",
"if",
"err",
":=",
"reOpenDevNull",
"(",
"config",
".",
"Rootfs",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"newSystemError",
"(",
"err",
")",
"\n",
"}",
"\n",
"if",
"config",
".",
"Readonlyfs",
"{",
"if",
"err",
":=",
"setReadonly",
"(",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"newSystemError",
"(",
"err",
")",
"\n",
"}",
"\n",
"}",
"\n",
"syscall",
".",
"Umask",
"(",
"0022",
")",
"\n",
"return",
"nil",
"\n",
"}"
] |
22,558 | all-22559 | [
"Claim",
"validator"
] | [
"func",
"(",
"c",
"*",
"chainedRule",
")",
"Claim",
"(",
"r",
"*",
"http",
".",
"<mask>",
")",
"bool",
"{",
"if",
"!",
"c",
".",
"Rule",
".",
"Claim",
"(",
"r",
")",
"{",
"return",
"false",
"\n",
"}",
"\n",
"return",
"c",
".",
"next",
".",
"Claim",
"(",
"r",
")",
"\n",
"}"
] |
22,559 | all-22560 | [
"fetchAllRecordLinksInZone",
"list",
"all",
"records",
"in",
"a",
"zone",
"with",
"a",
"single",
"call",
".",
"Records",
"not",
"matched",
"by",
"the",
"DomainFilter",
"are",
"ignored",
".",
"The",
"response",
"is",
"a",
"list",
"of",
"links",
"that",
"can",
"be",
"fed",
"to",
"dynect",
".",
"Client",
".",
"Do",
"()",
"directly"
] | [
"func",
"(",
"d",
"*",
"dynProviderState",
")",
"fetchAllRecordLinksInZone",
"(",
"client",
"*",
"dynect",
".",
"Client",
",",
"<mask>",
"string",
")",
"(",
"[",
"]",
"string",
",",
"error",
")",
"{",
"var",
"allRecords",
"dynect",
".",
"AllRecordsResponse",
"\n",
"err",
":=",
"client",
".",
"Do",
"(",
"\"",
"\"",
",",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"zone",
")",
",",
"nil",
",",
"&",
"allRecords",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"return",
"filterAndFixLinks",
"(",
"allRecords",
".",
"Data",
",",
"d",
".",
"DomainFilter",
")",
",",
"nil",
"\n",
"}"
] |
22,560 | all-22561 | [
"<local",
"-",
"name",
">",
"::",
"=",
"Z",
"<",
"(",
"function",
")",
"encoding",
">",
"E",
"<",
"(",
"entity",
")",
"name",
">",
"[",
"<discriminator",
">",
"]",
"::",
"=",
"Z",
"<",
"(",
"function",
")",
"encoding",
">",
"E",
"s",
"[",
"<discriminator",
">",
"]",
"::",
"=",
"Z",
"<",
"(",
"function",
")",
"encoding",
">",
"E",
"d",
"[",
"<parameter",
">",
"number",
">",
"]",
"_",
"<entity",
"name",
">"
] | [
"func",
"(",
"st",
"*",
"state",
")",
"localName",
"(",
")",
"AST",
"{",
"st",
".",
"checkChar",
"(",
"'Z'",
")",
"\n",
"fn",
":=",
"st",
".",
"encoding",
"(",
"true",
",",
"forLocalName",
")",
"\n",
"if",
"len",
"(",
"st",
".",
"str",
")",
"==",
"0",
"||",
"st",
".",
"str",
"[",
"0",
"]",
"!=",
"'E'",
"{",
"st",
".",
"fail",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"st",
".",
"advance",
"(",
"1",
")",
"\n",
"if",
"len",
"(",
"st",
".",
"str",
")",
">",
"0",
"&&",
"st",
".",
"str",
"[",
"0",
"]",
"==",
"'s'",
"{",
"st",
".",
"advance",
"(",
"1",
")",
"\n",
"var",
"n",
"AST",
"=",
"&",
"Name",
"{",
"Name",
":",
"\"",
"\"",
"}",
"\n",
"n",
"=",
"st",
".",
"discriminator",
"(",
"n",
")",
"\n",
"return",
"&",
"Qualified",
"{",
"Scope",
":",
"fn",
",",
"Name",
":",
"n",
",",
"LocalName",
":",
"true",
"}",
"\n",
"}",
"else",
"{",
"num",
":=",
"-",
"1",
"\n",
"if",
"len",
"(",
"st",
".",
"str",
")",
">",
"0",
"&&",
"st",
".",
"str",
"[",
"0",
"]",
"==",
"'d'",
"{",
"// Default argument scope.",
"st",
".",
"advance",
"(",
"1",
")",
"\n",
"num",
"=",
"st",
".",
"compactNumber",
"(",
")",
"\n",
"}",
"\n",
"n",
":=",
"st",
".",
"<mask>",
"(",
")",
"\n",
"n",
"=",
"st",
".",
"discriminator",
"(",
"n",
")",
"\n",
"if",
"num",
">=",
"0",
"{",
"n",
"=",
"&",
"DefaultArg",
"{",
"Num",
":",
"num",
",",
"Arg",
":",
"n",
"}",
"\n",
"}",
"\n",
"return",
"&",
"Qualified",
"{",
"Scope",
":",
"fn",
",",
"Name",
":",
"n",
",",
"LocalName",
":",
"true",
"}",
"\n",
"}",
"\n",
"}"
] |
22,561 | all-22562 | [
"return",
"the",
"values",
"of",
"the",
"current",
"matrix"
] | [
"func",
"QueryMatrixxOES",
"(",
"mantissa",
"*",
"int32",
",",
"exponent",
"*",
"int32",
")",
"uint32",
"{",
"ret",
",",
"_",
",",
"_",
":=",
"syscall",
".",
"Syscall",
"(",
"gpQueryMatrixxOES",
",",
"2",
",",
"uintptr",
"(",
"unsafe",
".",
"Pointer",
"(",
"mantissa",
")",
")",
",",
"uintptr",
"(",
"unsafe",
".",
"Pointer",
"(",
"exponent",
")",
")",
",",
"0",
")",
"\n",
"return",
"(",
"uint32",
")",
"(",
"<mask>",
")",
"\n",
"}"
] |
22,562 | all-22563 | [
"Vector",
"returns",
"a",
"[",
"-",
"1",
"1",
"]",
"value",
"for",
"each",
"axis",
"."
] | [
"func",
"(",
"d",
"Dir",
")",
"Vector",
"(",
")",
"(",
"x",
",",
"y",
"int",
")",
"{",
"<mask>",
"d",
"{",
"case",
"DirUp",
":",
"return",
"0",
",",
"-",
"1",
"\n",
"case",
"DirRight",
":",
"return",
"1",
",",
"0",
"\n",
"case",
"DirDown",
":",
"return",
"0",
",",
"1",
"\n",
"case",
"DirLeft",
":",
"return",
"-",
"1",
",",
"0",
"\n",
"}",
"\n",
"panic",
"(",
"\"",
"\"",
")",
"\n",
"}"
] |
22,563 | all-22564 | [
"Warnf",
"is",
"a",
"short",
"-",
"hand",
"version",
"of",
"Warningf"
] | [
"func",
"(",
"b",
"*",
"Base",
")",
"Warnf",
"(",
"<mask>",
"string",
",",
"a",
"...",
"interface",
"{",
"}",
")",
"error",
"{",
"return",
"b",
".",
"Warningf",
"(",
"msg",
",",
"a",
"...",
")",
"\n",
"}"
] |
22,564 | all-22565 | [
"MustNewRegexp",
"works",
"like",
"NewRegexp",
"but",
"panics",
"if",
"the",
"regular",
"expression",
"does",
"not",
"compile",
"."
] | [
"func",
"MustNewRegexp",
"(",
"s",
"string",
")",
"Regexp",
"{",
"<mask>",
",",
"err",
":=",
"NewRegexp",
"(",
"s",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"panic",
"(",
"err",
")",
"\n",
"}",
"\n",
"return",
"re",
"\n",
"}"
] |
22,565 | all-22566 | [
"JustPressedTouchIDs",
"returns",
"touch",
"IDs",
"that",
"are",
"created",
"just",
"in",
"the",
"current",
"frame",
".",
"JustPressedTouchIDs",
"might",
"return",
"nil",
"when",
"there",
"is",
"not",
"touch",
".",
"JustPressedTouchIDs",
"is",
"concurrent",
"safe",
"."
] | [
"func",
"JustPressedTouchIDs",
"(",
")",
"[",
"]",
"int",
"{",
"var",
"ids",
"[",
"]",
"int",
"\n",
"theInputState",
".",
"m",
".",
"RLock",
"(",
")",
"\n",
"for",
"id",
",",
"s",
":=",
"range",
"theInputState",
".",
"touchDurations",
"{",
"if",
"s",
"==",
"1",
"{",
"ids",
"=",
"<mask>",
"(",
"ids",
",",
"id",
")",
"\n",
"}",
"\n",
"}",
"\n",
"theInputState",
".",
"m",
".",
"RUnlock",
"(",
")",
"\n",
"sort",
".",
"Ints",
"(",
"ids",
")",
"\n",
"return",
"ids",
"\n",
"}"
] |
22,566 | all-22567 | [
"AddMulti",
"adds",
"multiple",
"tasks",
"to",
"a",
"named",
"queue",
".",
"An",
"empty",
"queue",
"name",
"means",
"that",
"the",
"default",
"queue",
"will",
"be",
"used",
".",
"AddMulti",
"returns",
"a",
"slice",
"of",
"equivalent",
"tasks",
"with",
"defaults",
"filled",
"in",
"including",
"setting",
"each",
"task",
"s",
"Name",
"field",
"to",
"the",
"chosen",
"name",
"if",
"the",
"original",
"was",
"empty",
".",
"If",
"a",
"given",
"task",
"is",
"badly",
"formed",
"or",
"could",
"not",
"be",
"added",
"an",
"appengine",
".",
"MultiError",
"is",
"returned",
"."
] | [
"func",
"AddMulti",
"(",
"c",
"context",
".",
"Context",
",",
"tasks",
"[",
"]",
"*",
"Task",
",",
"queueName",
"string",
")",
"(",
"[",
"]",
"*",
"Task",
",",
"error",
")",
"{",
"req",
":=",
"&",
"pb",
".",
"TaskQueueBulkAddRequest",
"{",
"AddRequest",
":",
"make",
"(",
"[",
"]",
"*",
"pb",
".",
"TaskQueueAddRequest",
",",
"len",
"(",
"tasks",
")",
")",
",",
"}",
"\n",
"me",
",",
"any",
":=",
"make",
"(",
"appengine",
".",
"MultiError",
",",
"len",
"(",
"tasks",
")",
")",
",",
"false",
"\n",
"for",
"i",
",",
"t",
":=",
"range",
"tasks",
"{",
"req",
".",
"AddRequest",
"[",
"i",
"]",
",",
"me",
"[",
"i",
"]",
"=",
"newAddReq",
"(",
"c",
",",
"t",
",",
"queueName",
")",
"\n",
"any",
"=",
"any",
"||",
"me",
"[",
"i",
"]",
"!=",
"nil",
"\n",
"}",
"\n",
"if",
"any",
"{",
"return",
"nil",
",",
"me",
"\n",
"}",
"\n",
"res",
":=",
"&",
"pb",
".",
"TaskQueueBulkAddResponse",
"{",
"}",
"\n",
"if",
"err",
":=",
"internal",
".",
"Call",
"(",
"c",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"req",
",",
"res",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"if",
"len",
"(",
"res",
".",
"Taskresult",
")",
"!=",
"len",
"(",
"tasks",
")",
"{",
"return",
"nil",
",",
"errors",
".",
"New",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"tasksOut",
":=",
"make",
"(",
"[",
"]",
"*",
"Task",
",",
"len",
"(",
"tasks",
")",
")",
"\n",
"for",
"i",
",",
"tr",
":=",
"range",
"res",
".",
"Taskresult",
"{",
"tasksOut",
"[",
"i",
"]",
"=",
"new",
"(",
"Task",
")",
"\n",
"*",
"tasksOut",
"[",
"i",
"]",
"=",
"*",
"tasks",
"[",
"i",
"]",
"\n",
"tasksOut",
"[",
"i",
"]",
".",
"Method",
"=",
"tasksOut",
"[",
"i",
"]",
".",
"method",
"(",
")",
"\n",
"if",
"tasksOut",
"[",
"i",
"]",
".",
"Name",
"==",
"\"",
"\"",
"{",
"tasksOut",
"[",
"i",
"]",
".",
"Name",
"=",
"string",
"(",
"tr",
".",
"ChosenTaskName",
")",
"\n",
"}",
"\n",
"if",
"*",
"tr",
".",
"Result",
"!=",
"pb",
".",
"TaskQueueServiceError_OK",
"{",
"if",
"alreadyAddedErrors",
"[",
"*",
"tr",
".",
"Result",
"]",
"{",
"me",
"[",
"i",
"]",
"=",
"ErrTaskAlreadyAdded",
"\n",
"}",
"else",
"{",
"me",
"[",
"i",
"]",
"=",
"&",
"internal",
".",
"APIError",
"{",
"Service",
":",
"\"",
"\"",
",",
"Code",
":",
"int32",
"(",
"*",
"tr",
".",
"Result",
")",
",",
"}",
"\n",
"}",
"\n",
"any",
"=",
"<mask>",
"\n",
"}",
"\n",
"}",
"\n",
"if",
"any",
"{",
"return",
"tasksOut",
",",
"me",
"\n",
"}",
"\n",
"return",
"tasksOut",
",",
"nil",
"\n",
"}"
] |
22,567 | all-22568 | [
"Close",
"closes",
"the",
"storage",
"and",
"all",
"its",
"underlying",
"resources",
"."
] | [
"func",
"(",
"f",
"*",
"fanout",
")",
"Close",
"(",
")",
"error",
"{",
"if",
"err",
":=",
"f",
".",
"primary",
".",
"Close",
"(",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"// TODO return multiple errors?",
"var",
"lastErr",
"error",
"\n",
"for",
"_",
",",
"<mask>",
":=",
"range",
"f",
".",
"secondaries",
"{",
"if",
"err",
":=",
"storage",
".",
"Close",
"(",
")",
";",
"err",
"!=",
"nil",
"{",
"lastErr",
"=",
"err",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"lastErr",
"\n",
"}"
] |
22,568 | all-22569 | [
"GetMonitors",
"returns",
"a",
"slice",
"of",
"all",
"monitors"
] | [
"func",
"(",
"<mask>",
"*",
"Client",
")",
"GetMonitors",
"(",
")",
"(",
"[",
"]",
"Monitor",
",",
"error",
")",
"{",
"var",
"out",
"reqMonitors",
"\n",
"if",
"err",
":=",
"client",
".",
"doJsonRequest",
"(",
"\"",
"\"",
",",
"\"",
"\"",
",",
"nil",
",",
"&",
"out",
".",
"Monitors",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"return",
"out",
".",
"Monitors",
",",
"nil",
"\n",
"}"
] |
22,569 | all-22570 | [
"InspectBranch",
"returns",
"information",
"on",
"a",
"specific",
"PFS",
"branch"
] | [
"func",
"(",
"c",
"APIClient",
")",
"InspectBranch",
"(",
"repoName",
"string",
",",
"branch",
"string",
")",
"(",
"*",
"pfs",
".",
"BranchInfo",
",",
"error",
")",
"{",
"branchInfo",
",",
"<mask>",
":=",
"c",
".",
"PfsAPIClient",
".",
"InspectBranch",
"(",
"c",
".",
"Ctx",
"(",
")",
",",
"&",
"pfs",
".",
"InspectBranchRequest",
"{",
"Branch",
":",
"NewBranch",
"(",
"repoName",
",",
"branch",
")",
",",
"}",
",",
")",
"\n",
"return",
"branchInfo",
",",
"grpcutil",
".",
"ScrubGRPC",
"(",
"err",
")",
"\n",
"}"
] |
22,570 | all-22571 | [
"BytesHead",
"returns",
"at",
"most",
"numLines",
"from",
"data",
"starting",
"at",
"the",
"beginning",
".",
"A",
"slice",
"of",
"the",
"remaining",
"data",
"is",
"returned",
"as",
"rest",
".",
"\\",
"n",
"is",
"used",
"to",
"detect",
"line",
"ends",
"a",
"preceding",
"\\",
"r",
"will",
"be",
"stripped",
"away",
".",
"BytesHead",
"resembles",
"the",
"Unix",
"head",
"command",
"."
] | [
"func",
"BytesHead",
"(",
"data",
"[",
"]",
"byte",
",",
"numLines",
"int",
")",
"(",
"lines",
"[",
"]",
"string",
",",
"rest",
"[",
"]",
"byte",
")",
"{",
"if",
"numLines",
"<=",
"0",
"{",
"panic",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"lines",
"=",
"make",
"(",
"[",
"]",
"string",
",",
"0",
",",
"numLines",
")",
"\n",
"begin",
":=",
"0",
"\n",
"for",
"i",
":=",
"range",
"data",
"{",
"if",
"data",
"[",
"i",
"]",
"==",
"'\\n'",
"{",
"end",
":=",
"i",
"\n",
"if",
"i",
">",
"0",
"&&",
"data",
"[",
"i",
"-",
"1",
"]",
"==",
"'\\r'",
"{",
"end",
"--",
"\n",
"}",
"\n",
"lines",
"=",
"append",
"(",
"<mask>",
",",
"string",
"(",
"data",
"[",
"begin",
":",
"end",
"]",
")",
")",
"\n",
"begin",
"=",
"i",
"+",
"1",
"\n",
"if",
"len",
"(",
"lines",
")",
"==",
"numLines",
"{",
"break",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n",
"if",
"len",
"(",
"lines",
")",
"!=",
"numLines",
"{",
"lines",
"=",
"append",
"(",
"lines",
",",
"string",
"(",
"data",
"[",
"begin",
":",
"]",
")",
")",
"\n",
"begin",
"=",
"len",
"(",
"data",
")",
"\n",
"}",
"\n",
"return",
"lines",
",",
"data",
"[",
"begin",
":",
"]",
"\n",
"}"
] |
22,571 | all-22572 | [
"close",
"connection",
"pool",
"to",
"Sentinel",
".",
"Lock",
"must",
"be",
"hold",
"by",
"caller",
"."
] | [
"func",
"(",
"s",
"*",
"Sentinel",
")",
"<mask>",
"(",
")",
"{",
"if",
"s",
".",
"pools",
"!=",
"nil",
"{",
"for",
"_",
",",
"pool",
":=",
"range",
"s",
".",
"pools",
"{",
"pool",
".",
"Close",
"(",
")",
"\n",
"}",
"\n",
"}",
"\n",
"s",
".",
"pools",
"=",
"nil",
"\n",
"}"
] |
22,572 | all-22573 | [
"VirtualMachineFolderFromObject",
"returns",
"an",
"*",
"object",
".",
"Folder",
"from",
"a",
"given",
"object",
"and",
"relative",
"datastore",
"folder",
"path",
".",
"If",
"no",
"such",
"folder",
"is",
"found",
"or",
"if",
"it",
"is",
"not",
"a",
"VM",
"folder",
"an",
"appropriate",
"error",
"will",
"be",
"returned",
"."
] | [
"func",
"VirtualMachineFolderFromObject",
"(",
"<mask>",
"*",
"govmomi",
".",
"Client",
",",
"obj",
"interface",
"{",
"}",
",",
"relative",
"string",
")",
"(",
"*",
"object",
".",
"Folder",
",",
"error",
")",
"{",
"log",
".",
"Printf",
"(",
"\"",
"\"",
",",
"relative",
")",
"\n",
"folder",
",",
"err",
":=",
"folderFromObject",
"(",
"client",
",",
"obj",
",",
"RootPathParticleVM",
",",
"relative",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"return",
"validateVirtualMachineFolder",
"(",
"folder",
")",
"\n",
"}"
] |
22,573 | all-22574 | [
"CheckFlags",
"is",
"delegated",
"to",
"EventMatcher"
] | [
"func",
"(",
"e",
"*",
"EventCounterPlugin",
")",
"CheckFlags",
"(",
")",
"<mask>",
"{",
"e",
".",
"matcher",
"=",
"NewEventMatcher",
"(",
"e",
".",
"desc",
")",
"\n",
"return",
"nil",
"\n",
"}"
] |
22,574 | all-22575 | [
"Encrypt",
"produces",
"encrypted",
"JWT",
"token",
"given",
"arbitrary",
"string",
"payload",
"key",
"management",
"and",
"encryption",
"algorithms",
"to",
"use",
"(",
"see",
"constants",
"for",
"list",
"of",
"supported",
"algs",
")",
"and",
"management",
"key",
".",
"Management",
"key",
"is",
"of",
"different",
"type",
"for",
"different",
"key",
"management",
"alg",
"see",
"specific",
"key",
"management",
"alg",
"implementation",
"documentation",
".",
"It",
"returns",
"5",
"parts",
"encrypted",
"JWT",
"token",
"as",
"string",
"and",
"not",
"nil",
"error",
"if",
"something",
"went",
"wrong",
"."
] | [
"func",
"Encrypt",
"(",
"payload",
"string",
",",
"alg",
"string",
",",
"enc",
"string",
",",
"key",
"interface",
"{",
"}",
",",
"options",
"...",
"func",
"(",
"*",
"JoseConfig",
")",
")",
"(",
"token",
"string",
",",
"err",
"error",
")",
"{",
"return",
"EncryptBytes",
"(",
"[",
"]",
"byte",
"(",
"payload",
")",
",",
"alg",
",",
"enc",
",",
"key",
",",
"<mask>",
"...",
")",
"\n",
"}"
] |
22,575 | all-22576 | [
"UnmarshalJSON",
"supports",
"json",
".",
"Unmarshaler",
"interface"
] | [
"func",
"(",
"v",
"*",
"GetDocumentReturns",
")",
"UnmarshalJSON",
"(",
"<mask>",
"[",
"]",
"byte",
")",
"error",
"{",
"r",
":=",
"jlexer",
".",
"Lexer",
"{",
"Data",
":",
"data",
"}",
"\n",
"easyjsonC5a4559bDecodeGithubComChromedpCdprotoDom46",
"(",
"&",
"r",
",",
"v",
")",
"\n",
"return",
"r",
".",
"Error",
"(",
")",
"\n",
"}"
] |
22,576 | all-22577 | [
"ResourceIDString",
"prints",
"a",
"friendly",
"string",
"for",
"a",
"resource",
"supplied",
"by",
"name",
"."
] | [
"func",
"ResourceIDString",
"(",
"d",
"ResourceIDStringer",
",",
"<mask>",
"string",
")",
"string",
"{",
"id",
":=",
"d",
".",
"Id",
"(",
")",
"\n",
"if",
"id",
"==",
"\"",
"\"",
"{",
"id",
"=",
"\"",
"\"",
"\n",
"}",
"\n",
"return",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"name",
",",
"id",
")",
"\n",
"}"
] |
22,577 | all-22578 | [
"Flush",
"must",
"be",
"called",
"at",
"the",
"end",
"to",
"ensure",
"that",
"any",
"pending",
"writes",
"get",
"committed",
"to",
"Badger",
".",
"Flush",
"returns",
"any",
"error",
"stored",
"by",
"WriteBatch",
"."
] | [
"func",
"(",
"wb",
"*",
"WriteBatch",
")",
"Flush",
"(",
")",
"error",
"{",
"wb",
".",
"Lock",
"(",
")",
"\n",
"_",
"=",
"wb",
".",
"<mask>",
"(",
")",
"\n",
"wb",
".",
"txn",
".",
"Discard",
"(",
")",
"\n",
"wb",
".",
"Unlock",
"(",
")",
"\n\n",
"wb",
".",
"wg",
".",
"Wait",
"(",
")",
"\n",
"// Safe to access error without any synchronization here.",
"return",
"wb",
".",
"err",
"\n",
"}"
] |
22,578 | all-22579 | [
"Next",
"returns",
"the",
"next",
"page",
"of",
"resources",
".",
"If",
"there",
"are",
"no",
"more",
"resources",
"NoMoreResults",
"is",
"returned",
"."
] | [
"func",
"(",
"r",
"*",
"RecordingPageIterator",
")",
"Next",
"(",
"ctx",
"context",
".",
"<mask>",
")",
"(",
"*",
"RecordingPage",
",",
"error",
")",
"{",
"rp",
":=",
"new",
"(",
"RecordingPage",
")",
"\n",
"err",
":=",
"r",
".",
"p",
".",
"Next",
"(",
"ctx",
",",
"rp",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"r",
".",
"p",
".",
"SetNextPageURI",
"(",
"rp",
".",
"NextPageURI",
")",
"\n",
"return",
"rp",
",",
"nil",
"\n",
"}"
] |
22,579 | all-22580 | [
"Stop",
"stops",
"the",
"indicator"
] | [
"func",
"(",
"s",
"*",
"Spinner",
")",
"Stop",
"(",
")",
"{",
"s",
".",
"lock",
".",
"Lock",
"(",
")",
"\n",
"defer",
"s",
".",
"lock",
".",
"Unlock",
"(",
")",
"\n",
"if",
"s",
".",
"active",
"{",
"s",
".",
"active",
"=",
"false",
"\n",
"if",
"s",
".",
"HideCursor",
"&&",
"runtime",
".",
"GOOS",
"!=",
"\"",
"\"",
"{",
"// makes the cursor visible",
"fmt",
".",
"Print",
"(",
"\"",
"\\033",
"\"",
")",
"\n",
"}",
"\n",
"s",
".",
"erase",
"(",
")",
"\n",
"if",
"s",
".",
"FinalMSG",
"!=",
"\"",
"\"",
"{",
"fmt",
".",
"Fprintf",
"(",
"s",
".",
"<mask>",
",",
"s",
".",
"FinalMSG",
")",
"\n",
"}",
"\n",
"s",
".",
"stopChan",
"<-",
"struct",
"{",
"}",
"{",
"}",
"\n",
"}",
"\n",
"}"
] |
22,580 | all-22581 | [
"HasLineType",
"returns",
"a",
"boolean",
"if",
"a",
"field",
"has",
"been",
"set",
"."
] | [
"func",
"(",
"t",
"*",
"TimeseriesRequestStyle",
")",
"HasLineType",
"(",
")",
"bool",
"{",
"if",
"t",
"!=",
"nil",
"&&",
"t",
".",
"LineType",
"!=",
"nil",
"{",
"return",
"true",
"\n",
"}",
"\n\n",
"return",
"<mask>",
"\n",
"}"
] |
22,581 | all-22582 | [
"SetWithExpirationTime",
"sets",
"a",
"cookie",
"that",
"will",
"expire",
"at",
"a",
"specific",
"time",
".",
"Note",
"that",
"the",
"time",
"is",
"determined",
"by",
"the",
"client",
"s",
"browser",
"so",
"it",
"might",
"not",
"expire",
"at",
"the",
"expected",
"time",
"for",
"example",
"if",
"the",
"client",
"has",
"changed",
"the",
"time",
"on",
"their",
"computer",
"."
] | [
"func",
"(",
"c",
"*",
"Cookies",
")",
"SetWithExpirationTime",
"(",
"name",
",",
"value",
"string",
",",
"expires",
"time",
".",
"Time",
")",
"{",
"ck",
":=",
"<mask>",
".",
"Cookie",
"{",
"Name",
":",
"name",
",",
"Value",
":",
"value",
",",
"Expires",
":",
"expires",
",",
"}",
"\n\n",
"http",
".",
"SetCookie",
"(",
"c",
".",
"res",
",",
"&",
"ck",
")",
"\n",
"}"
] |
22,582 | all-22583 | [
"WaitForJob",
"blocks",
"until",
"a",
"completed",
"job",
"is",
"available",
"and",
"returns",
"it",
".",
"If",
"there",
"are",
"no",
"jobs",
"running",
"it",
"returns",
"nil",
"."
] | [
"func",
"(",
"pool",
"*",
"Pool",
")",
"WaitForJob",
"(",
")",
"*",
"Job",
"{",
"result_pipe",
":=",
"make",
"(",
"chan",
"*",
"Job",
")",
"\n",
"var",
"job",
"*",
"Job",
"\n",
"var",
"ok",
"bool",
"\n",
"for",
"{",
"pool",
".",
"result_wanted_pipe",
"<-",
"result_pipe",
"\n",
"job",
",",
"ok",
"=",
"<-",
"result_pipe",
"\n",
"if",
"!",
"<mask>",
"{",
"// no more results available",
"return",
"nil",
"\n",
"}",
"\n",
"if",
"job",
"==",
"(",
"*",
"Job",
")",
"(",
"nil",
")",
"{",
"// no result available right now but there are jobs running",
"time",
".",
"Sleep",
"(",
"pool",
".",
"interval",
"*",
"time",
".",
"Millisecond",
")",
"\n",
"}",
"else",
"{",
"break",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"job",
"\n",
"}"
] |
22,583 | all-22584 | [
"MetricsKey",
"is",
"a",
"string",
"representation",
"of",
"the",
"error",
"code",
"that",
"s",
"suitable",
"for",
"inclusion",
"in",
"metrics",
"tags",
"."
] | [
"func",
"(",
"c",
"SystemErrCode",
")",
"MetricsKey",
"(",
")",
"string",
"{",
"switch",
"c",
"{",
"case",
"ErrCodeInvalid",
":",
"// Shouldn't ever need this.",
"return",
"\"",
"\"",
"\n",
"<mask>",
"ErrCodeTimeout",
":",
"return",
"\"",
"\"",
"\n",
"case",
"ErrCodeCancelled",
":",
"return",
"\"",
"\"",
"\n",
"case",
"ErrCodeBusy",
":",
"return",
"\"",
"\"",
"\n",
"case",
"ErrCodeDeclined",
":",
"return",
"\"",
"\"",
"\n",
"case",
"ErrCodeUnexpected",
":",
"return",
"\"",
"\"",
"\n",
"case",
"ErrCodeBadRequest",
":",
"return",
"\"",
"\"",
"\n",
"case",
"ErrCodeNetwork",
":",
"return",
"\"",
"\"",
"\n",
"case",
"ErrCodeProtocol",
":",
"return",
"\"",
"\"",
"\n",
"default",
":",
"return",
"c",
".",
"String",
"(",
")",
"\n",
"}",
"\n",
"}"
] |
22,584 | all-22585 | [
"doneSending",
"shuts",
"down",
"the",
"message",
"exchange",
"for",
"this",
"call",
".",
"For",
"incoming",
"calls",
"the",
"last",
"message",
"is",
"sending",
"the",
"call",
"response",
"."
] | [
"func",
"(",
"response",
"*",
"InboundCallResponse",
")",
"doneSending",
"(",
")",
"{",
"// TODO(prashant): Move this to when the message is actually being sent.",
"<mask>",
":=",
"response",
".",
"timeNow",
"(",
")",
"\n\n",
"if",
"span",
":=",
"response",
".",
"span",
";",
"span",
"!=",
"nil",
"{",
"if",
"response",
".",
"applicationError",
"||",
"response",
".",
"systemError",
"{",
"ext",
".",
"Error",
".",
"Set",
"(",
"span",
",",
"true",
")",
"\n",
"}",
"\n",
"span",
".",
"FinishWithOptions",
"(",
"opentracing",
".",
"FinishOptions",
"{",
"FinishTime",
":",
"now",
"}",
")",
"\n",
"}",
"\n\n",
"latency",
":=",
"now",
".",
"Sub",
"(",
"response",
".",
"calledAt",
")",
"\n",
"response",
".",
"statsReporter",
".",
"RecordTimer",
"(",
"\"",
"\"",
",",
"response",
".",
"commonStatsTags",
",",
"latency",
")",
"\n\n",
"if",
"response",
".",
"systemError",
"{",
"// TODO(prashant): Report the error code type as per metrics doc and enable.",
"// response.statsReporter.IncCounter(\"inbound.calls.system-errors\", response.commonStatsTags, 1)",
"}",
"else",
"if",
"response",
".",
"applicationError",
"{",
"response",
".",
"statsReporter",
".",
"IncCounter",
"(",
"\"",
"\"",
",",
"response",
".",
"commonStatsTags",
",",
"1",
")",
"\n",
"}",
"else",
"{",
"response",
".",
"statsReporter",
".",
"IncCounter",
"(",
"\"",
"\"",
",",
"response",
".",
"commonStatsTags",
",",
"1",
")",
"\n",
"}",
"\n\n",
"// Cancel the context since the response is complete.",
"response",
".",
"cancel",
"(",
")",
"\n\n",
"// The message exchange is still open if there are no errors, call shutdown.",
"if",
"response",
".",
"err",
"==",
"nil",
"{",
"response",
".",
"mex",
".",
"shutdown",
"(",
")",
"\n",
"}",
"\n",
"}"
] |
22,585 | all-22586 | [
"GetPageIterator",
"returns",
"a",
"TranscriptionPageIterator",
"with",
"the",
"given",
"page",
"filters",
".",
"Call",
"iterator",
".",
"Next",
"()",
"to",
"get",
"the",
"first",
"page",
"of",
"resources",
"(",
"and",
"again",
"to",
"retrieve",
"subsequent",
"pages",
")",
"."
] | [
"func",
"(",
"c",
"*",
"TranscriptionService",
")",
"GetPageIterator",
"(",
"data",
"url",
".",
"Values",
")",
"*",
"TranscriptionPageIterator",
"{",
"iter",
":=",
"NewPageIterator",
"(",
"c",
".",
"client",
",",
"<mask>",
",",
"transcriptionPathPart",
")",
"\n",
"return",
"&",
"TranscriptionPageIterator",
"{",
"p",
":",
"iter",
",",
"}",
"\n",
"}"
] |
22,586 | all-22587 | [
"flattenStorageDrsPodConfigInfo",
"saves",
"a",
"StorageDrsPodConfigInfo",
"into",
"the",
"supplied",
"ResourceData",
"."
] | [
"func",
"flattenStorageDrsPodConfigInfo",
"(",
"d",
"*",
"schema",
".",
"ResourceData",
",",
"obj",
"types",
".",
"StorageDrsPodConfigInfo",
",",
"version",
"viapi",
".",
"VSphereVersion",
")",
"error",
"{",
"attrs",
":=",
"map",
"[",
"string",
"]",
"interface",
"{",
"}",
"{",
"\"",
"\"",
":",
"obj",
".",
"DefaultIntraVmAffinity",
",",
"\"",
"\"",
":",
"obj",
".",
"DefaultVmBehavior",
",",
"\"",
"\"",
":",
"obj",
".",
"Enabled",
",",
"\"",
"\"",
":",
"obj",
".",
"IoLoadBalanceEnabled",
",",
"\"",
"\"",
":",
"obj",
".",
"LoadBalanceInterval",
",",
"}",
"\n",
"for",
"k",
",",
"v",
":=",
"<mask>",
"attrs",
"{",
"if",
"err",
":=",
"d",
".",
"Set",
"(",
"k",
",",
"v",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"k",
",",
"err",
")",
"\n",
"}",
"\n",
"}",
"\n\n",
"if",
"err",
":=",
"flattenStorageDrsIoLoadBalanceConfig",
"(",
"d",
",",
"obj",
".",
"IoLoadBalanceConfig",
",",
"version",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"if",
"err",
":=",
"flattenStorageDrsSpaceLoadBalanceConfig",
"(",
"d",
",",
"obj",
".",
"SpaceLoadBalanceConfig",
",",
"version",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"if",
"err",
":=",
"flattenStorageDrsOptionSpec",
"(",
"d",
",",
"obj",
".",
"Option",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"if",
"version",
".",
"Newer",
"(",
"viapi",
".",
"VSphereVersion",
"{",
"Product",
":",
"version",
".",
"Product",
",",
"Major",
":",
"6",
"}",
")",
"{",
"if",
"err",
":=",
"flattenStorageDrsAutomationConfig",
"(",
"d",
",",
"obj",
".",
"AutomationOverrides",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"}",
"\n\n",
"return",
"nil",
"\n",
"}"
] |
22,587 | all-22588 | [
"IsEquivalent",
"returns",
"true",
"if",
"other",
"represents",
"the",
"same",
"data",
"type",
"as",
"the",
"target",
"."
] | [
"func",
"(",
"u",
"*",
"UploadDataType",
")",
"IsEquivalent",
"(",
"other",
"DataType",
")",
"bool",
"{",
"o",
",",
"ok",
":=",
"other",
".",
"(",
"*",
"UploadDataType",
")",
"\n",
"if",
"!",
"ok",
"{",
"return",
"false",
"\n",
"}",
"\n",
"if",
"o",
".",
"TypeName",
"!=",
"u",
".",
"TypeName",
"{",
"return",
"<mask>",
"\n",
"}",
"\n",
"return",
"true",
"\n",
"}"
] |
22,588 | all-22589 | [
"Creates",
"a",
"shader",
"object"
] | [
"func",
"CreateShader",
"(",
"xtype",
"uint32",
")",
"uint32",
"{",
"<mask>",
":=",
"C",
".",
"glowCreateShader",
"(",
"gpCreateShader",
",",
"(",
"C",
".",
"GLenum",
")",
"(",
"xtype",
")",
")",
"\n",
"return",
"(",
"uint32",
")",
"(",
"ret",
")",
"\n",
"}"
] |
22,589 | all-22590 | [
"lexEscape",
"scans",
"a",
"string",
"escape",
"sequence",
".",
"The",
"initial",
"escaping",
"character",
"(",
"\\",
")",
"has",
"already",
"been",
"seen",
".",
"NOTE",
":",
"This",
"function",
"as",
"well",
"as",
"the",
"helper",
"function",
"digitVal",
"()",
"and",
"associated",
"tests",
"have",
"been",
"adapted",
"from",
"the",
"corresponding",
"functions",
"in",
"the",
"go",
"/",
"scanner",
"package",
"of",
"the",
"Go",
"standard",
"library",
"to",
"work",
"for",
"Prometheus",
"-",
"style",
"strings",
".",
"None",
"of",
"the",
"actual",
"escaping",
"/",
"quoting",
"logic",
"was",
"changed",
"in",
"this",
"function",
"-",
"it",
"was",
"only",
"modified",
"to",
"integrate",
"with",
"our",
"lexer",
"."
] | [
"func",
"lexEscape",
"(",
"l",
"*",
"lexer",
")",
"{",
"var",
"n",
"int",
"\n",
"var",
"base",
",",
"max",
"uint32",
"\n\n",
"ch",
":=",
"l",
".",
"next",
"(",
")",
"\n",
"switch",
"ch",
"{",
"case",
"'a'",
",",
"'b'",
",",
"'f'",
",",
"'n'",
",",
"'r'",
",",
"'t'",
",",
"'v'",
",",
"'\\\\'",
",",
"l",
".",
"stringOpen",
":",
"return",
"\n",
"case",
"'0'",
",",
"'1'",
",",
"'2'",
",",
"'3'",
",",
"'4'",
",",
"'5'",
",",
"'6'",
",",
"'7'",
":",
"n",
",",
"base",
",",
"max",
"=",
"3",
",",
"8",
",",
"255",
"\n",
"case",
"'x'",
":",
"ch",
"=",
"l",
".",
"next",
"(",
")",
"\n",
"n",
",",
"base",
",",
"max",
"=",
"2",
",",
"16",
",",
"255",
"\n",
"case",
"'u'",
":",
"ch",
"=",
"l",
".",
"next",
"(",
")",
"\n",
"n",
",",
"base",
",",
"max",
"=",
"4",
",",
"16",
",",
"unicode",
".",
"MaxRune",
"\n",
"case",
"'U'",
":",
"ch",
"=",
"l",
".",
"next",
"(",
")",
"\n",
"n",
",",
"base",
",",
"max",
"=",
"8",
",",
"16",
",",
"unicode",
".",
"MaxRune",
"\n",
"case",
"eof",
":",
"l",
".",
"errorf",
"(",
"\"",
"\"",
")",
"\n",
"<mask>",
":",
"l",
".",
"errorf",
"(",
"\"",
"\"",
",",
"ch",
")",
"\n",
"}",
"\n\n",
"var",
"x",
"uint32",
"\n",
"for",
"n",
">",
"0",
"{",
"d",
":=",
"uint32",
"(",
"digitVal",
"(",
"ch",
")",
")",
"\n",
"if",
"d",
">=",
"base",
"{",
"if",
"ch",
"==",
"eof",
"{",
"l",
".",
"errorf",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"l",
".",
"errorf",
"(",
"\"",
"\"",
",",
"ch",
")",
"\n",
"}",
"\n",
"x",
"=",
"x",
"*",
"base",
"+",
"d",
"\n",
"ch",
"=",
"l",
".",
"next",
"(",
")",
"\n",
"n",
"--",
"\n",
"}",
"\n\n",
"if",
"x",
">",
"max",
"||",
"0xD800",
"<=",
"x",
"&&",
"x",
"<",
"0xE000",
"{",
"l",
".",
"errorf",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"}"
] |
22,590 | all-22591 | [
"GetTimeAggregatorOk",
"returns",
"a",
"tuple",
"with",
"the",
"TimeAggregator",
"field",
"if",
"it",
"s",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"and",
"a",
"boolean",
"to",
"check",
"if",
"the",
"value",
"has",
"been",
"set",
"."
] | [
"func",
"(",
"t",
"*",
"ThresholdCount",
")",
"GetTimeAggregatorOk",
"(",
")",
"(",
"string",
",",
"bool",
")",
"{",
"if",
"t",
"==",
"nil",
"||",
"t",
".",
"TimeAggregator",
"==",
"nil",
"{",
"return",
"\"",
"\"",
",",
"<mask>",
"\n",
"}",
"\n",
"return",
"*",
"t",
".",
"TimeAggregator",
",",
"true",
"\n",
"}"
] |
22,591 | all-22592 | [
"SendCustomSvcNotification",
"creates",
"a",
"new",
"SEND_CUSTOM_SVC_NOTIFICATION",
"Nagios",
"command",
".",
"Allows",
"you",
"to",
"send",
"a",
"custom",
"service",
"notification",
".",
"Very",
"useful",
"in",
"dire",
"situations",
"emergencies",
"or",
"to",
"communicate",
"with",
"all",
"admins",
"that",
"are",
"responsible",
"for",
"a",
"particular",
"service",
".",
"When",
"the",
"service",
"notification",
"is",
"sent",
"out",
"the",
"$NOTIFICATIONTYPE$",
"macro",
"will",
"be",
"set",
"to",
"CUSTOM",
".",
"The",
"<options",
">",
"field",
"is",
"a",
"logical",
"OR",
"of",
"the",
"following",
"integer",
"values",
"that",
"affect",
"aspects",
"of",
"the",
"notification",
"that",
"are",
"sent",
"out",
":",
"0",
"=",
"No",
"option",
"(",
"default",
")",
"1",
"=",
"Broadcast",
"(",
"send",
"notification",
"to",
"all",
"normal",
"and",
"all",
"escalated",
"contacts",
"for",
"the",
"service",
")",
"2",
"=",
"Forced",
"(",
"notification",
"is",
"sent",
"out",
"regardless",
"of",
"current",
"time",
"whether",
"or",
"not",
"notifications",
"are",
"enabled",
"etc",
".",
")",
"4",
"=",
"Increment",
"current",
"notification",
"#",
"for",
"the",
"service",
"(",
"this",
"is",
"not",
"done",
"by",
"default",
"for",
"custom",
"notifications",
")",
".",
"The",
"comment",
"field",
"can",
"be",
"used",
"with",
"the",
"$NOTIFICATIONCOMMENT$",
"macro",
"in",
"notification",
"commands",
"."
] | [
"func",
"SendCustomSvcNotification",
"(",
"host_name",
"string",
",",
"service_description",
"string",
",",
"options",
"int",
",",
"<mask>",
"string",
",",
"comment",
"string",
",",
")",
"*",
"livestatus",
".",
"Command",
"{",
"return",
"livestatus",
".",
"NewCommand",
"(",
"\"",
"\"",
",",
"stringifyArg",
"(",
"\"",
"\"",
",",
"\"",
"\"",
",",
"host_name",
")",
",",
"stringifyArg",
"(",
"\"",
"\"",
",",
"\"",
"\"",
",",
"service_description",
")",
",",
"stringifyArg",
"(",
"\"",
"\"",
",",
"\"",
"\"",
",",
"options",
")",
",",
"stringifyArg",
"(",
"\"",
"\"",
",",
"\"",
"\"",
",",
"author",
")",
",",
"stringifyArg",
"(",
"\"",
"\"",
",",
"\"",
"\"",
",",
"comment",
")",
",",
")",
"\n",
"}"
] |
22,592 | all-22593 | [
"Create",
"exposes",
"the",
"CreateDVPortgroup_Task",
"method",
"of",
"the",
"DistributedVirtualSwitch",
"MO",
".",
"This",
"local",
"implementation",
"may",
"go",
"away",
"if",
"this",
"is",
"exposed",
"in",
"the",
"higher",
"-",
"level",
"object",
"upstream",
"."
] | [
"func",
"Create",
"(",
"client",
"*",
"govmomi",
".",
"Client",
",",
"dvs",
"*",
"object",
".",
"VmwareDistributedVirtualSwitch",
",",
"spec",
"types",
".",
"DVPortgroupConfigSpec",
")",
"(",
"*",
"object",
".",
"Task",
",",
"error",
")",
"{",
"req",
":=",
"&",
"types",
".",
"CreateDVPortgroup_Task",
"{",
"This",
":",
"dvs",
".",
"Reference",
"(",
")",
",",
"Spec",
":",
"<mask>",
",",
"}",
"\n\n",
"ctx",
",",
"cancel",
":=",
"context",
".",
"WithTimeout",
"(",
"context",
".",
"Background",
"(",
")",
",",
"provider",
".",
"DefaultAPITimeout",
")",
"\n",
"defer",
"cancel",
"(",
")",
"\n",
"resp",
",",
"err",
":=",
"methods",
".",
"CreateDVPortgroup_Task",
"(",
"ctx",
",",
"client",
",",
"req",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"return",
"object",
".",
"NewTask",
"(",
"client",
".",
"Client",
",",
"resp",
".",
"Returnval",
".",
"Reference",
"(",
")",
")",
",",
"nil",
"\n",
"}"
] |
22,593 | all-22594 | [
"ParseUrls",
"extracts",
"the",
"path",
"patterns",
"from",
"an",
"action",
"URLs",
".",
"Urls",
"consist",
"of",
"an",
"array",
"of",
"map",
"each",
"map",
"has",
"the",
"following",
"keys",
":",
"verb",
"path",
"version",
"Also",
"make",
"it",
"support",
"the",
"resticle",
"format",
":",
"array",
"of",
"pairs",
"of",
"verb",
"+",
"path",
"."
] | [
"func",
"(",
"a",
"*",
"APIAnalyzer",
")",
"ParseUrls",
"(",
"urls",
"interface",
"{",
"}",
")",
"(",
"[",
"]",
"*",
"gen",
".",
"PathPattern",
",",
"error",
")",
"{",
"var",
"patterns",
"[",
"]",
"*",
"gen",
".",
"PathPattern",
"\n",
"if",
"urlElems",
",",
"ok",
":=",
"urls",
".",
"(",
"[",
"]",
"interface",
"{",
"}",
")",
";",
"ok",
"{",
"patterns",
"=",
"make",
"(",
"[",
"]",
"*",
"gen",
".",
"PathPattern",
",",
"len",
"(",
"urlElems",
")",
")",
"\n",
"for",
"i",
",",
"elem",
":=",
"range",
"urlElems",
"{",
"if",
"pair",
",",
"ok",
":=",
"elem",
".",
"(",
"[",
"]",
"interface",
"{",
"}",
")",
";",
"ok",
"{",
"if",
"len",
"(",
"pair",
")",
"!=",
"2",
"{",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"pair",
")",
"\n",
"}",
"\n",
"patterns",
"[",
"i",
"]",
"=",
"toPattern",
"(",
"pair",
"[",
"0",
"]",
".",
"(",
"string",
")",
",",
"pair",
"[",
"1",
"]",
".",
"(",
"string",
")",
")",
"\n",
"}",
"else",
"if",
"url",
",",
"ok",
":=",
"elem",
".",
"(",
"map",
"[",
"string",
"]",
"interface",
"{",
"}",
")",
";",
"ok",
"{",
"verb",
",",
"ok",
":=",
"url",
"[",
"\"",
"\"",
"]",
".",
"(",
"string",
")",
"\n",
"if",
"!",
"<mask>",
"{",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"url",
")",
"\n",
"}",
"\n",
"path",
",",
"ok",
":=",
"url",
"[",
"\"",
"\"",
"]",
".",
"(",
"string",
")",
"\n",
"if",
"!",
"ok",
"{",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"url",
")",
"\n",
"}",
"\n",
"patterns",
"[",
"i",
"]",
"=",
"toPattern",
"(",
"verb",
",",
"path",
")",
"\n",
"}",
"else",
"{",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"elem",
")",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"else",
"{",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\\\"",
"\\\"",
"\"",
",",
"prettify",
"(",
"urls",
")",
")",
"\n",
"}",
"\n",
"return",
"patterns",
",",
"nil",
"\n",
"}"
] |
22,594 | all-22595 | [
"Common",
"logic",
"between",
"PUT",
"and",
"PATCH",
"."
] | [
"func",
"projectChange",
"(",
"d",
"*",
"Daemon",
",",
"project",
"*",
"api",
".",
"Project",
",",
"req",
"api",
".",
"ProjectPut",
")",
"Response",
"{",
"// Flag indicating if any feature has changed.",
"featuresChanged",
":=",
"req",
".",
"Config",
"[",
"\"",
"\"",
"]",
"!=",
"project",
".",
"Config",
"[",
"\"",
"\"",
"]",
"||",
"req",
".",
"Config",
"[",
"\"",
"\"",
"]",
"!=",
"<mask>",
".",
"Config",
"[",
"\"",
"\"",
"]",
"\n\n",
"// Sanity checks",
"if",
"project",
".",
"Name",
"==",
"\"",
"\"",
"&&",
"featuresChanged",
"{",
"return",
"BadRequest",
"(",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
")",
")",
"\n",
"}",
"\n\n",
"if",
"!",
"projectIsEmpty",
"(",
"project",
")",
"&&",
"featuresChanged",
"{",
"return",
"BadRequest",
"(",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
")",
")",
"\n",
"}",
"\n\n",
"// Validate the configuration",
"err",
":=",
"projectValidateConfig",
"(",
"req",
".",
"Config",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"BadRequest",
"(",
"err",
")",
"\n",
"}",
"\n\n",
"// Update the database entry",
"err",
"=",
"d",
".",
"cluster",
".",
"Transaction",
"(",
"func",
"(",
"tx",
"*",
"db",
".",
"ClusterTx",
")",
"error",
"{",
"err",
":=",
"tx",
".",
"ProjectUpdate",
"(",
"project",
".",
"Name",
",",
"req",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"errors",
".",
"Wrap",
"(",
"err",
",",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"if",
"req",
".",
"Config",
"[",
"\"",
"\"",
"]",
"!=",
"project",
".",
"Config",
"[",
"\"",
"\"",
"]",
"{",
"if",
"req",
".",
"Config",
"[",
"\"",
"\"",
"]",
"==",
"\"",
"\"",
"{",
"err",
"=",
"projectCreateDefaultProfile",
"(",
"tx",
",",
"project",
".",
"Name",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"}",
"else",
"{",
"// Delete the project-specific default profile.",
"err",
"=",
"tx",
".",
"ProfileDelete",
"(",
"project",
".",
"Name",
",",
"\"",
"\"",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"errors",
".",
"Wrap",
"(",
"err",
",",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n\n",
"return",
"nil",
"\n\n",
"}",
")",
"\n\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"SmartError",
"(",
"err",
")",
"\n",
"}",
"\n\n",
"return",
"EmptySyncResponse",
"\n",
"}"
] |
22,595 | all-22596 | [
"This",
"is",
"not",
"a",
"recoverable",
"error",
"--",
"opening",
"the",
"KV",
"store",
"fails",
"because",
"the",
"MANIFEST",
"file",
"is",
"just",
"plain",
"broken",
"."
] | [
"func",
"applyChangeSet",
"(",
"build",
"*",
"Manifest",
",",
"changeSet",
"*",
"pb",
".",
"ManifestChangeSet",
")",
"error",
"{",
"for",
"_",
",",
"change",
":=",
"range",
"changeSet",
".",
"Changes",
"{",
"if",
"err",
":=",
"applyManifestChange",
"(",
"<mask>",
",",
"change",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
] |
22,596 | all-22597 | [
"BuilderNewFromResource",
"is",
"a",
"wrapper",
"around",
"gtk_builder_new_from_resource",
"()",
"."
] | [
"func",
"BuilderNewFromResource",
"(",
"resourcePath",
"string",
")",
"(",
"*",
"Builder",
",",
"error",
")",
"{",
"cstr",
":=",
"C",
".",
"CString",
"(",
"resourcePath",
")",
"\n",
"defer",
"C",
".",
"<mask>",
"(",
"unsafe",
".",
"Pointer",
"(",
"cstr",
")",
")",
"\n\n",
"c",
":=",
"C",
".",
"gtk_builder_new_from_resource",
"(",
"(",
"*",
"C",
".",
"gchar",
")",
"(",
"cstr",
")",
")",
"\n",
"if",
"c",
"==",
"nil",
"{",
"return",
"nil",
",",
"nilPtrErr",
"\n",
"}",
"\n\n",
"obj",
":=",
"glib",
".",
"Take",
"(",
"unsafe",
".",
"Pointer",
"(",
"c",
")",
")",
"\n",
"return",
"&",
"Builder",
"{",
"obj",
"}",
",",
"nil",
"\n",
"}"
] |
22,597 | all-22598 | [
"resourceVSphereComputeClusterVMGroupFindEntry",
"attempts",
"to",
"locate",
"an",
"existing",
"VM",
"group",
"config",
"in",
"a",
"cluster",
"s",
"configuration",
".",
"It",
"s",
"used",
"by",
"the",
"resource",
"s",
"read",
"functionality",
"and",
"tests",
".",
"nil",
"is",
"returned",
"if",
"the",
"entry",
"cannot",
"be",
"found",
"."
] | [
"func",
"resourceVSphereComputeClusterVMGroupFindEntry",
"(",
"cluster",
"*",
"object",
".",
"ClusterComputeResource",
",",
"name",
"string",
",",
")",
"(",
"*",
"types",
".",
"ClusterVmGroup",
",",
"error",
")",
"{",
"props",
",",
"err",
":=",
"clustercomputeresource",
".",
"Properties",
"(",
"cluster",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"}",
"\n\n",
"for",
"_",
",",
"info",
":=",
"range",
"props",
".",
"ConfigurationEx",
".",
"(",
"*",
"types",
".",
"ClusterConfigInfoEx",
")",
".",
"Group",
"{",
"if",
"info",
".",
"GetClusterGroupInfo",
"(",
")",
".",
"Name",
"==",
"name",
"{",
"if",
"vmInfo",
",",
"ok",
":=",
"info",
".",
"(",
"*",
"types",
".",
"ClusterVmGroup",
")",
";",
"ok",
"{",
"log",
".",
"Printf",
"(",
"\"",
"\"",
",",
"name",
",",
"cluster",
".",
"<mask>",
"(",
")",
")",
"\n",
"return",
"vmInfo",
",",
"nil",
"\n",
"}",
"\n",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"name",
",",
"cluster",
".",
"Name",
"(",
")",
")",
"\n",
"}",
"\n",
"}",
"\n\n",
"log",
".",
"Printf",
"(",
"\"",
"\"",
",",
"name",
",",
"cluster",
".",
"Name",
"(",
")",
")",
"\n",
"return",
"nil",
",",
"nil",
"\n",
"}"
] |
22,598 | all-22599 | [
"title",
":",
"update",
"application",
"quota",
"path",
":",
"/",
"apps",
"/",
"{",
"appname",
"}",
"/",
"quota",
"method",
":",
"PUT",
"consume",
":",
"application",
"/",
"x",
"-",
"www",
"-",
"form",
"-",
"urlencoded",
"responses",
":",
"200",
":",
"Quota",
"updated",
"400",
":",
"Invalid",
"data",
"401",
":",
"Unauthorized",
"403",
":",
"Limit",
"lower",
"than",
"allocated",
"404",
":",
"Application",
"not",
"found"
] | [
"func",
"changeAppQuota",
"(",
"w",
"http",
".",
"ResponseWriter",
",",
"r",
"*",
"http",
".",
"Request",
",",
"t",
"auth",
".",
"Token",
")",
"(",
"err",
"error",
")",
"{",
"appName",
":=",
"r",
".",
"URL",
".",
"Query",
"(",
")",
".",
"Get",
"(",
"\"",
"\"",
")",
"\n",
"a",
",",
"err",
":=",
"getAppFromContext",
"(",
"appName",
",",
"r",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"allowed",
":=",
"permission",
".",
"Check",
"(",
"t",
",",
"permission",
".",
"PermAppAdminQuota",
",",
"contextsForApp",
"(",
"&",
"a",
")",
"...",
")",
"\n",
"if",
"!",
"allowed",
"{",
"return",
"permission",
".",
"ErrUnauthorized",
"\n",
"}",
"\n",
"evt",
",",
"err",
":=",
"event",
".",
"New",
"(",
"&",
"<mask>",
".",
"Opts",
"{",
"Target",
":",
"event",
".",
"Target",
"{",
"Type",
":",
"event",
".",
"TargetTypeApp",
",",
"Value",
":",
"appName",
"}",
",",
"Kind",
":",
"permission",
".",
"PermAppAdminQuota",
",",
"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",
"limit",
",",
"err",
":=",
"strconv",
".",
"Atoi",
"(",
"InputValue",
"(",
"r",
",",
"\"",
"\"",
")",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"&",
"errors",
".",
"HTTP",
"{",
"Code",
":",
"http",
".",
"StatusBadRequest",
",",
"Message",
":",
"\"",
"\"",
",",
"}",
"\n",
"}",
"\n",
"err",
"=",
"a",
".",
"SetQuotaLimit",
"(",
"limit",
")",
"\n",
"if",
"err",
"==",
"quota",
".",
"ErrLimitLowerThanAllocated",
"{",
"return",
"&",
"errors",
".",
"HTTP",
"{",
"Code",
":",
"http",
".",
"StatusForbidden",
",",
"Message",
":",
"err",
".",
"Error",
"(",
")",
",",
"}",
"\n",
"}",
"\n",
"return",
"err",
"\n",
"}"
] |
22,599 | all-22600 | [
"reloadSecret",
"will",
"begin",
"polling",
"the",
"secret",
"file",
"at",
"the",
"path",
".",
"If",
"the",
"first",
"load",
"fails",
"Start",
"with",
"return",
"the",
"error",
"and",
"abort",
".",
"Future",
"load",
"failures",
"will",
"log",
"the",
"failure",
"message",
"but",
"continue",
"attempting",
"to",
"load",
"."
] | [
"func",
"(",
"a",
"*",
"Agent",
")",
"reloadSecret",
"(",
"secretPath",
"string",
")",
"{",
"var",
"lastModTime",
"time",
".",
"Time",
"\n",
"logger",
":=",
"logrus",
".",
"NewEntry",
"(",
"logrus",
".",
"StandardLogger",
"(",
")",
")",
"\n\n",
"skips",
":=",
"0",
"\n",
"for",
"range",
"time",
".",
"Tick",
"(",
"1",
"*",
"time",
".",
"Second",
")",
"{",
"if",
"skips",
"<",
"600",
"{",
"// Check if the file changed to see if it needs to be re-read.",
"secretStat",
",",
"err",
":=",
"os",
".",
"Stat",
"(",
"secretPath",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"logger",
".",
"WithField",
"(",
"\"",
"\"",
",",
"secretPath",
")",
".",
"WithError",
"(",
"err",
")",
".",
"Error",
"(",
"\"",
"\"",
")",
"\n",
"continue",
"\n",
"}",
"\n\n",
"recentModTime",
":=",
"secretStat",
".",
"ModTime",
"(",
")",
"\n",
"if",
"!",
"recentModTime",
".",
"After",
"(",
"lastModTime",
")",
"{",
"skips",
"++",
"\n",
"continue",
"// file hasn't been modified",
"\n",
"}",
"\n",
"lastModTime",
"=",
"recentModTime",
"\n",
"}",
"\n\n",
"if",
"secretValue",
",",
"err",
":=",
"LoadSingleSecret",
"(",
"secretPath",
")",
";",
"err",
"!=",
"nil",
"{",
"logger",
".",
"WithField",
"(",
"\"",
"\"",
",",
"secretPath",
")",
".",
"WithError",
"(",
"err",
")",
".",
"<mask>",
"(",
"\"",
"\"",
")",
"\n",
"}",
"else",
"{",
"a",
".",
"setSecret",
"(",
"secretPath",
",",
"secretValue",
")",
"\n",
"skips",
"=",
"0",
"\n",
"}",
"\n",
"}",
"\n",
"}"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.