id
int32 0
25.3k
| idx
stringlengths 5
9
| nl_tokens
listlengths 1
418
| pl_tokens
listlengths 22
4.98k
|
---|---|---|---|
22,400 | all-22401 | [
"CleanupAvailabilitySetIfExists",
"removes",
"an",
"availability",
"set",
"if",
"there",
"are",
"no",
"virtual",
"machines",
"attached",
"to",
"it",
".",
"Note",
"that",
"this",
"method",
"is",
"not",
"safe",
"for",
"multiple",
"concurrent",
"writers",
"in",
"case",
"of",
"races",
"deployment",
"of",
"a",
"machine",
"could",
"fail",
"or",
"resource",
"might",
"not",
"be",
"cleaned",
"up",
"."
] | [
"func",
"(",
"a",
"AzureClient",
")",
"CleanupAvailabilitySetIfExists",
"(",
"resourceGroup",
",",
"name",
"string",
")",
"error",
"{",
"return",
"a",
".",
"cleanupResourceIfExists",
"(",
"&",
"avSetCleanup",
"{",
"rg",
":",
"resourceGroup",
",",
"name",
":",
"<mask>",
"}",
")",
"\n",
"}"
] |
22,401 | all-22402 | [
"A",
"is",
"a",
"short",
"-",
"hand",
"function",
"to",
"extract",
"the",
"attribute",
"JSON",
"key",
"of",
"a",
"model",
"field",
".",
"Note",
":",
"A",
"will",
"panic",
"if",
"no",
"field",
"has",
"been",
"found",
"."
] | [
"func",
"A",
"(",
"m",
"Model",
",",
"field",
"string",
")",
"string",
"{",
"// find field",
"f",
":=",
"Init",
"(",
"m",
")",
".",
"Meta",
"(",
")",
".",
"Fields",
"[",
"<mask>",
"]",
"\n",
"if",
"f",
"==",
"nil",
"{",
"panic",
"(",
"fmt",
".",
"Sprintf",
"(",
"`coal: field \"%s\" not found on \"%s\"`",
",",
"field",
",",
"m",
".",
"Meta",
"(",
")",
".",
"Name",
")",
")",
"\n",
"}",
"\n\n",
"return",
"f",
".",
"JSONKey",
"\n",
"}"
] |
22,402 | all-22403 | [
"MarshalJSON",
"overrides",
"the",
"logic",
"for",
"JSON",
"-",
"encoding",
"a",
"TaskVolume",
"object"
] | [
"func",
"(",
"tv",
"*",
"TaskVolume",
")",
"MarshalJSON",
"(",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"result",
":=",
"<mask>",
"(",
"map",
"[",
"string",
"]",
"interface",
"{",
"}",
")",
"\n\n",
"if",
"len",
"(",
"tv",
".",
"Type",
")",
"==",
"0",
"{",
"tv",
".",
"Type",
"=",
"HostVolumeType",
"\n",
"}",
"\n\n",
"result",
"[",
"\"",
"\"",
"]",
"=",
"tv",
".",
"Name",
"\n",
"result",
"[",
"\"",
"\"",
"]",
"=",
"tv",
".",
"Type",
"\n\n",
"switch",
"tv",
".",
"Type",
"{",
"case",
"DockerVolumeType",
":",
"result",
"[",
"\"",
"\"",
"]",
"=",
"tv",
".",
"Volume",
"\n",
"case",
"HostVolumeType",
":",
"result",
"[",
"\"",
"\"",
"]",
"=",
"tv",
".",
"Volume",
"\n",
"default",
":",
"return",
"nil",
",",
"errors",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"tv",
".",
"Type",
")",
"\n",
"}",
"\n\n",
"return",
"json",
".",
"Marshal",
"(",
"result",
")",
"\n",
"}"
] |
22,403 | all-22404 | [
"Special",
"implementation",
"for",
"Negroni",
"but",
"could",
"be",
"used",
"elsewhere",
"."
] | [
"func",
"(",
"m",
"*",
"JWTMiddleware",
")",
"HandlerWithNext",
"(",
"w",
"http",
".",
"ResponseWriter",
",",
"r",
"*",
"http",
".",
"Request",
",",
"<mask>",
"http",
".",
"HandlerFunc",
")",
"{",
"err",
":=",
"m",
".",
"CheckJWT",
"(",
"w",
",",
"r",
")",
"\n\n",
"// If there was an error, do not call next.",
"if",
"err",
"==",
"nil",
"&&",
"next",
"!=",
"nil",
"{",
"next",
"(",
"w",
",",
"r",
")",
"\n",
"}",
"\n",
"}"
] |
22,404 | all-22405 | [
"GetParent",
"is",
"a",
"wrapper",
"around",
"gtk_style_context_get_parent",
"()",
"."
] | [
"func",
"(",
"v",
"*",
"StyleContext",
")",
"GetParent",
"(",
")",
"(",
"*",
"StyleContext",
",",
"<mask>",
")",
"{",
"return",
"fromNativeStyleContext",
"(",
"C",
".",
"gtk_style_context_get_parent",
"(",
"v",
".",
"native",
"(",
")",
")",
")",
"\n",
"}"
] |
22,405 | all-22406 | [
"PushLinkToChannel",
"pushes",
"a",
"link",
"with",
"a",
"title",
"and",
"url",
"to",
"a",
"specific",
"PushBullet",
"device",
"."
] | [
"func",
"(",
"c",
"*",
"Client",
")",
"PushLinkToChannel",
"(",
"tag",
",",
"title",
",",
"u",
",",
"body",
"string",
")",
"error",
"{",
"data",
":=",
"Link",
"{",
"Tag",
":",
"tag",
",",
"Type",
":",
"\"",
"\"",
",",
"Title",
":",
"title",
",",
"URL",
":",
"u",
",",
"<mask>",
":",
"body",
",",
"}",
"\n",
"return",
"c",
".",
"Push",
"(",
"\"",
"\"",
",",
"data",
")",
"\n",
"}"
] |
22,406 | all-22407 | [
"Locator",
"returns",
"a",
"locator",
"for",
"the",
"given",
"resource"
] | [
"func",
"(",
"r",
"*",
"VolumeAttachment",
")",
"Locator",
"(",
"api",
"*",
"API",
")",
"*",
"VolumeAttachmentLocator",
"{",
"for",
"_",
",",
"l",
":=",
"<mask>",
"r",
".",
"Links",
"{",
"if",
"l",
"[",
"\"",
"\"",
"]",
"==",
"\"",
"\"",
"{",
"return",
"api",
".",
"VolumeAttachmentLocator",
"(",
"l",
"[",
"\"",
"\"",
"]",
")",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
] |
22,407 | all-22408 | [
"NewPipelineManifestReader",
"creates",
"a",
"new",
"manifest",
"reader",
"from",
"a",
"path",
"."
] | [
"func",
"NewPipelineManifestReader",
"(",
"path",
"string",
")",
"(",
"result",
"*",
"PipelineManifestReader",
",",
"retErr",
"error",
")",
"{",
"<mask>",
"=",
"&",
"PipelineManifestReader",
"{",
"}",
"\n",
"var",
"pipelineReader",
"io",
".",
"Reader",
"\n",
"if",
"path",
"==",
"\"",
"\"",
"{",
"pipelineReader",
"=",
"io",
".",
"TeeReader",
"(",
"os",
".",
"Stdin",
",",
"&",
"result",
".",
"buf",
")",
"\n",
"fmt",
".",
"Print",
"(",
"\"",
"\\n",
"\"",
")",
"\n",
"}",
"else",
"if",
"url",
",",
"err",
":=",
"url",
".",
"Parse",
"(",
"path",
")",
";",
"err",
"==",
"nil",
"&&",
"url",
".",
"Scheme",
"!=",
"\"",
"\"",
"{",
"resp",
",",
"err",
":=",
"http",
".",
"Get",
"(",
"url",
".",
"String",
"(",
")",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"defer",
"func",
"(",
")",
"{",
"if",
"err",
":=",
"resp",
".",
"Body",
".",
"Close",
"(",
")",
";",
"err",
"!=",
"nil",
"&&",
"retErr",
"==",
"nil",
"{",
"retErr",
"=",
"err",
"\n",
"}",
"\n",
"}",
"(",
")",
"\n",
"rawBytes",
",",
"err",
":=",
"ioutil",
".",
"ReadAll",
"(",
"resp",
".",
"Body",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"pipelineReader",
"=",
"io",
".",
"TeeReader",
"(",
"strings",
".",
"NewReader",
"(",
"string",
"(",
"rawBytes",
")",
")",
",",
"&",
"result",
".",
"buf",
")",
"\n",
"}",
"else",
"{",
"rawBytes",
",",
"err",
":=",
"ioutil",
".",
"ReadFile",
"(",
"path",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"pipelineReader",
"=",
"io",
".",
"TeeReader",
"(",
"strings",
".",
"NewReader",
"(",
"string",
"(",
"rawBytes",
")",
")",
",",
"&",
"result",
".",
"buf",
")",
"\n",
"}",
"\n",
"result",
".",
"decoder",
"=",
"json",
".",
"NewDecoder",
"(",
"pipelineReader",
")",
"\n",
"return",
"result",
",",
"nil",
"\n",
"}"
] |
22,408 | all-22409 | [
"WriteContainerStatsResponse",
"writes",
"the",
"container",
"stats",
"to",
"response",
"writer",
"."
] | [
"func",
"WriteContainerStatsResponse",
"(",
"w",
"http",
".",
"ResponseWriter",
",",
"taskARN",
"string",
",",
"containerID",
"string",
",",
"statsEngine",
"stats",
".",
"Engine",
")",
"{",
"dockerStats",
",",
"err",
":=",
"statsEngine",
".",
"ContainerDockerStats",
"(",
"taskARN",
",",
"containerID",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"errResponseJSON",
",",
"_",
":=",
"json",
".",
"Marshal",
"(",
"\"",
"\"",
"+",
"containerID",
")",
"\n",
"utils",
".",
"WriteJSONToResponse",
"(",
"w",
",",
"<mask>",
".",
"StatusBadRequest",
",",
"errResponseJSON",
",",
"utils",
".",
"RequestTypeContainerStats",
")",
"\n",
"return",
"\n",
"}",
"\n\n",
"responseJSON",
",",
"_",
":=",
"json",
".",
"Marshal",
"(",
"dockerStats",
")",
"\n",
"utils",
".",
"WriteJSONToResponse",
"(",
"w",
",",
"http",
".",
"StatusOK",
",",
"responseJSON",
",",
"utils",
".",
"RequestTypeContainerStats",
")",
"\n",
"}"
] |
22,409 | all-22410 | [
"DeepCopy",
"copies",
"the",
"receiver",
"into",
"a",
"new",
"IPv4",
"."
] | [
"func",
"(",
"u",
"*",
"IPv4",
")",
"DeepCopy",
"(",
")",
"*",
"IPv4",
"{",
"if",
"u",
"==",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n",
"out",
":=",
"<mask>",
"(",
"IPv4",
")",
"\n",
"u",
".",
"DeepCopyInto",
"(",
"out",
")",
"\n",
"return",
"out",
"\n",
"}"
] |
22,410 | all-22411 | [
"specify",
"a",
"one",
"-",
"dimensional",
"texture",
"image"
] | [
"func",
"TexImage1D",
"(",
"target",
"uint32",
",",
"level",
"int32",
",",
"internalformat",
"int32",
",",
"<mask>",
"int32",
",",
"border",
"int32",
",",
"format",
"uint32",
",",
"xtype",
"uint32",
",",
"pixels",
"unsafe",
".",
"Pointer",
")",
"{",
"syscall",
".",
"Syscall9",
"(",
"gpTexImage1D",
",",
"8",
",",
"uintptr",
"(",
"target",
")",
",",
"uintptr",
"(",
"level",
")",
",",
"uintptr",
"(",
"internalformat",
")",
",",
"uintptr",
"(",
"width",
")",
",",
"uintptr",
"(",
"border",
")",
",",
"uintptr",
"(",
"format",
")",
",",
"uintptr",
"(",
"xtype",
")",
",",
"uintptr",
"(",
"pixels",
")",
",",
"0",
")",
"\n",
"}"
] |
22,411 | all-22412 | [
"NewZapCoreLoggerBuilder",
"generates",
"a",
"zap",
"core",
"logger",
"builder",
"."
] | [
"func",
"NewZapCoreLoggerBuilder",
"(",
"lg",
"*",
"zap",
".",
"Logger",
",",
"cr",
"zapcore",
".",
"Core",
",",
"syncer",
"zapcore",
".",
"WriteSyncer",
")",
"func",
"(",
"*",
"Config",
")",
"error",
"{",
"return",
"func",
"(",
"cfg",
"*",
"Config",
")",
"error",
"{",
"cfg",
".",
"loggerMu",
".",
"Lock",
"(",
")",
"\n",
"defer",
"cfg",
".",
"loggerMu",
".",
"Unlock",
"(",
")",
"\n",
"cfg",
".",
"logger",
"=",
"lg",
"\n",
"cfg",
".",
"loggerConfig",
"=",
"nil",
"\n",
"cfg",
".",
"loggerCore",
"=",
"cr",
"\n",
"cfg",
".",
"loggerWriteSyncer",
"=",
"syncer",
"\n\n",
"grpcLogOnce",
".",
"Do",
"(",
"func",
"(",
")",
"{",
"grpclog",
".",
"SetLoggerV2",
"(",
"logutil",
".",
"NewGRPCLoggerV2FromZapCore",
"(",
"cr",
",",
"syncer",
")",
")",
"\n",
"}",
")",
"\n",
"<mask>",
"nil",
"\n",
"}",
"\n",
"}"
] |
22,412 | all-22413 | [
"NewLinter",
"returns",
"a",
"new",
"linter",
"from",
"a",
"config"
] | [
"func",
"NewLinter",
"(",
"name",
"string",
",",
"config",
"LinterConfig",
")",
"(",
"*",
"Linter",
",",
"error",
")",
"{",
"if",
"p",
",",
"ok",
":=",
"predefinedPatterns",
"[",
"config",
".",
"Pattern",
"]",
";",
"ok",
"{",
"config",
".",
"Pattern",
"=",
"p",
"\n",
"}",
"\n",
"regex",
",",
"err",
":=",
"regexp",
".",
"Compile",
"(",
"\"",
"\"",
"+",
"config",
".",
"Pattern",
"+",
"\"",
"\"",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"if",
"config",
".",
"PartitionStrategy",
"==",
"nil",
"{",
"config",
".",
"PartitionStrategy",
"=",
"partitionPathsAsDirectories",
"\n",
"}",
"\n",
"return",
"&",
"Linter",
"{",
"LinterConfig",
":",
"config",
",",
"<mask>",
":",
"name",
",",
"regex",
":",
"regex",
",",
"}",
",",
"nil",
"\n",
"}"
] |
22,413 | all-22414 | [
"SetContentType",
"sets",
"Content",
"-",
"Type",
"header",
"value",
"."
] | [
"func",
"(",
"h",
"*",
"ResponseHeader",
")",
"SetContentType",
"(",
"contentType",
"string",
")",
"{",
"h",
".",
"contentType",
"=",
"<mask>",
"(",
"h",
".",
"contentType",
"[",
":",
"0",
"]",
",",
"contentType",
"...",
")",
"\n",
"}"
] |
22,414 | all-22415 | [
"GetPrivateHostIPs",
"returns",
"a",
"list",
"of",
"host",
"s",
"private",
"IP",
"addresses",
"."
] | [
"func",
"GetPrivateHostIPs",
"(",
")",
"(",
"[",
"]",
"net",
".",
"IP",
",",
"error",
")",
"{",
"ips",
",",
"err",
":=",
"GetHostIPs",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"var",
"privateIPs",
"[",
"]",
"net",
".",
"IP",
"\n",
"for",
"_",
",",
"ip",
":=",
"range",
"ips",
"{",
"// skip loopback, non-IPv4 and non-private addresses",
"if",
"ip",
".",
"IsLoopback",
"(",
")",
"||",
"ip",
".",
"To4",
"(",
")",
"==",
"nil",
"||",
"!",
"IsPrivate",
"(",
"<mask>",
")",
"{",
"continue",
"\n",
"}",
"\n",
"privateIPs",
"=",
"append",
"(",
"privateIPs",
",",
"ip",
")",
"\n",
"}",
"\n\n",
"return",
"privateIPs",
",",
"nil",
"\n",
"}"
] |
22,415 | all-22416 | [
"parseTokens",
"parses",
"the",
"tokens",
"and",
"return",
"them"
] | [
"func",
"(",
"e",
"*",
"htmlTag",
")",
"parseTokens",
"(",
")",
"[",
"]",
"string",
"{",
"var",
"inQuote",
"bool",
"\n",
"var",
"inDelim",
"bool",
"\n",
"var",
"tokens",
"[",
"]",
"string",
"\n",
"var",
"token",
"string",
"\n\n",
"str",
":=",
"strings",
".",
"Join",
"(",
"e",
".",
"ln",
".",
"tokens",
"[",
"1",
":",
"]",
",",
"space",
")",
"\n",
"for",
"_",
",",
"chr",
":=",
"range",
"str",
"{",
"switch",
"c",
":=",
"string",
"(",
"chr",
")",
";",
"c",
"{",
"case",
"space",
":",
"if",
"inQuote",
"||",
"inDelim",
"{",
"token",
"+=",
"c",
"\n",
"}",
"else",
"{",
"tokens",
"=",
"append",
"(",
"tokens",
",",
"<mask>",
")",
"\n",
"token",
"=",
"\"",
"\"",
"\n",
"}",
"\n",
"case",
"doubleQuote",
":",
"if",
"!",
"inDelim",
"{",
"if",
"inQuote",
"{",
"inQuote",
"=",
"false",
"\n",
"}",
"else",
"{",
"inQuote",
"=",
"true",
"\n",
"}",
"\n",
"}",
"\n",
"token",
"+=",
"c",
"\n",
"default",
":",
"token",
"+=",
"c",
"\n",
"if",
"inDelim",
"{",
"if",
"strings",
".",
"HasSuffix",
"(",
"token",
",",
"e",
".",
"opts",
".",
"DelimRight",
")",
"{",
"inDelim",
"=",
"false",
"\n",
"}",
"\n",
"}",
"else",
"{",
"if",
"strings",
".",
"HasSuffix",
"(",
"token",
",",
"e",
".",
"opts",
".",
"DelimLeft",
")",
"{",
"inDelim",
"=",
"true",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n",
"if",
"len",
"(",
"token",
")",
">",
"0",
"{",
"tokens",
"=",
"append",
"(",
"tokens",
",",
"token",
")",
"\n",
"}",
"\n",
"return",
"tokens",
"\n",
"}"
] |
22,416 | all-22417 | [
"rangeAt",
"returns",
"the",
"underlying",
"InclusiveRange",
"instance",
"that",
"was",
"appended",
"at",
"a",
"given",
"index"
] | [
"func",
"(",
"l",
"*",
"InclusiveRanges",
")",
"rangeAt",
"(",
"idx",
"int",
")",
"*",
"InclusiveRange",
"{",
"if",
"idx",
"<",
"0",
"||",
"idx",
">=",
"l",
".",
"numRanges",
"(",
")",
"{",
"return",
"nil",
"\n",
"}",
"\n",
"return",
"l",
".",
"<mask>",
"[",
"idx",
"]",
"\n",
"}"
] |
22,417 | all-22418 | [
"ListTagsForResource",
"mocks",
"base",
"method"
] | [
"func",
"(",
"m",
"*",
"MockECSSDK",
")",
"ListTagsForResource",
"(",
"arg0",
"*",
"ecs",
".",
"ListTagsForResourceInput",
")",
"(",
"*",
"ecs",
".",
"ListTagsForResourceOutput",
",",
"error",
")",
"{",
"<mask>",
":=",
"m",
".",
"ctrl",
".",
"Call",
"(",
"m",
",",
"\"",
"\"",
",",
"arg0",
")",
"\n",
"ret0",
",",
"_",
":=",
"ret",
"[",
"0",
"]",
".",
"(",
"*",
"ecs",
".",
"ListTagsForResourceOutput",
")",
"\n",
"ret1",
",",
"_",
":=",
"ret",
"[",
"1",
"]",
".",
"(",
"error",
")",
"\n",
"return",
"ret0",
",",
"ret1",
"\n",
"}"
] |
22,418 | all-22419 | [
"Sync",
"dumps",
"the",
"content",
"of",
"the",
"database",
"to",
"disk",
".",
"This",
"is",
"useful",
"for",
"inspection",
"purposes",
"and",
"it",
"s",
"also",
"needed",
"by",
"the",
"activateifneeded",
"command",
"so",
"it",
"can",
"inspect",
"the",
"database",
"in",
"order",
"to",
"decide",
"whether",
"to",
"activate",
"the",
"daemon",
"or",
"not",
"."
] | [
"func",
"(",
"g",
"*",
"Gateway",
")",
"Sync",
"(",
")",
"{",
"if",
"g",
".",
"server",
"==",
"nil",
"{",
"return",
"\n",
"}",
"\n\n",
"dir",
":=",
"filepath",
".",
"Join",
"(",
"g",
".",
"db",
".",
"Dir",
"(",
")",
",",
"\"",
"\"",
")",
"\n",
"err",
":=",
"g",
".",
"<mask>",
".",
"Dump",
"(",
"\"",
"\"",
",",
"dir",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"// Just log a warning, since this is not fatal.",
"logger",
".",
"Warnf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"}",
"\n",
"}"
] |
22,419 | all-22420 | [
"LongestLine",
"returns",
"the",
"longest",
"step",
"line",
"in",
"a",
"feature",
"."
] | [
"func",
"(",
"f",
"*",
"Feature",
")",
"LongestLine",
"(",
")",
"int",
"{",
"if",
"f",
".",
"longestLine",
"==",
"0",
"{",
"f",
".",
"longestLine",
"=",
"len",
"(",
"\"",
"\"",
"+",
"f",
".",
"Title",
")",
"\n",
"for",
"_",
",",
"s",
":=",
"<mask>",
"f",
".",
"Scenarios",
"{",
"if",
"l",
":=",
"s",
".",
"LongestLine",
"(",
")",
";",
"l",
">",
"f",
".",
"longestLine",
"{",
"f",
".",
"longestLine",
"=",
"l",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"f",
".",
"longestLine",
"\n",
"}"
] |
22,420 | all-22421 | [
"GetCachePath",
"creates",
"a",
"string",
"describing",
"where",
"a",
"given",
"template",
"key",
"would",
"be",
"cached",
"in",
"the",
"file",
"system"
] | [
"func",
"(",
"c",
"*",
"FileCache",
")",
"GetCachePath",
"(",
"key",
"string",
")",
"string",
"{",
"// What's the best, portable way to remove make an absolute path into",
"// a relative path?",
"key",
"=",
"filepath",
".",
"Clean",
"(",
"key",
")",
"\n",
"key",
"=",
"strings",
".",
"TrimPrefix",
"(",
"<mask>",
",",
"\"",
"\"",
")",
"\n",
"return",
"filepath",
".",
"Join",
"(",
"c",
".",
"Dir",
",",
"key",
")",
"\n",
"}"
] |
22,421 | all-22422 | [
"String",
"reads",
"and",
"returns",
"content",
"of",
"request",
"body",
"in",
"string",
"."
] | [
"func",
"(",
"rb",
"*",
"RequestBody",
")",
"<mask>",
"(",
")",
"(",
"string",
",",
"error",
")",
"{",
"data",
",",
"err",
":=",
"rb",
".",
"Bytes",
"(",
")",
"\n",
"return",
"string",
"(",
"data",
")",
",",
"err",
"\n",
"}"
] |
22,422 | all-22423 | [
"CallList",
"creates",
"the",
"call",
"to",
"a",
"function",
"satisfying",
"Interface",
"from",
"an",
"Args",
"struct",
"."
] | [
"func",
"(",
"m",
"*",
"Method",
")",
"CallList",
"(",
"reqStruct",
"string",
")",
"string",
"{",
"args",
":=",
"[",
"]",
"string",
"{",
"\"",
"\"",
"}",
"\n",
"for",
"_",
",",
"arg",
":=",
"range",
"m",
".",
"Arguments",
"(",
")",
"{",
"args",
"=",
"<mask>",
"(",
"args",
",",
"reqStruct",
"+",
"\"",
"\"",
"+",
"arg",
".",
"ArgStructName",
"(",
")",
")",
"\n",
"}",
"\n",
"return",
"strings",
".",
"Join",
"(",
"args",
",",
"\"",
"\"",
")",
"\n",
"}"
] |
22,423 | all-22424 | [
"GetRole",
"returns",
"the",
"Role",
"field",
"if",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"."
] | [
"func",
"(",
"u",
"*",
"User",
")",
"GetRole",
"(",
")",
"string",
"{",
"if",
"u",
"==",
"nil",
"||",
"u",
".",
"Role",
"==",
"nil",
"{",
"return",
"\"",
"\"",
"\n",
"}",
"\n",
"return",
"*",
"u",
".",
"<mask>",
"\n",
"}"
] |
22,424 | all-22425 | [
"UnmarshalJSON",
"supports",
"json",
".",
"Unmarshaler",
"interface"
] | [
"func",
"(",
"v",
"*",
"QueryObjectsParams",
")",
"UnmarshalJSON",
"(",
"data",
"[",
"]",
"byte",
")",
"error",
"{",
"r",
":=",
"jlexer",
".",
"Lexer",
"{",
"Data",
":",
"<mask>",
"}",
"\n",
"easyjsonC5a4559bDecodeGithubComChromedpCdprotoRuntime13",
"(",
"&",
"r",
",",
"v",
")",
"\n",
"return",
"r",
".",
"Error",
"(",
")",
"\n",
"}"
] |
22,425 | all-22426 | [
"Records",
"returns",
"the",
"list",
"of",
"records",
"."
] | [
"func",
"(",
"p",
"*",
"CloudFlareProvider",
")",
"Records",
"(",
")",
"(",
"[",
"]",
"*",
"endpoint",
".",
"Endpoint",
",",
"error",
")",
"{",
"zones",
",",
"err",
":=",
"p",
".",
"Zones",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"endpoints",
":=",
"[",
"]",
"*",
"endpoint",
".",
"Endpoint",
"{",
"}",
"\n",
"for",
"_",
",",
"zone",
":=",
"range",
"zones",
"{",
"records",
",",
"err",
":=",
"p",
".",
"Client",
".",
"DNSRecords",
"(",
"zone",
".",
"ID",
",",
"cloudflare",
".",
"DNSRecord",
"{",
"}",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"for",
"_",
",",
"r",
":=",
"range",
"records",
"{",
"if",
"supportedRecordType",
"(",
"r",
".",
"Type",
")",
"{",
"endpoints",
"=",
"append",
"(",
"endpoints",
",",
"endpoint",
".",
"NewEndpointWithTTL",
"(",
"r",
".",
"Name",
",",
"r",
".",
"Type",
",",
"endpoint",
".",
"TTL",
"(",
"r",
".",
"TTL",
")",
",",
"r",
".",
"Content",
")",
".",
"WithProviderSpecific",
"(",
"<mask>",
".",
"CloudflareProxiedKey",
",",
"strconv",
".",
"FormatBool",
"(",
"r",
".",
"Proxied",
")",
")",
")",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n\n",
"return",
"endpoints",
",",
"nil",
"\n",
"}"
] |
22,426 | all-22427 | [
"query",
"the",
"name",
"of",
"an",
"indexed",
"resource",
"within",
"a",
"program"
] | [
"func",
"GetProgramResourceName",
"(",
"program",
"uint32",
",",
"programInterface",
"uint32",
",",
"index",
"uint32",
",",
"bufSize",
"int32",
",",
"length",
"*",
"int32",
",",
"name",
"*",
"uint8",
")",
"{",
"syscall",
".",
"Syscall6",
"(",
"gpGetProgramResourceName",
",",
"6",
",",
"uintptr",
"(",
"program",
")",
",",
"uintptr",
"(",
"programInterface",
")",
",",
"uintptr",
"(",
"index",
")",
",",
"uintptr",
"(",
"bufSize",
")",
",",
"uintptr",
"(",
"unsafe",
".",
"Pointer",
"(",
"<mask>",
")",
")",
",",
"uintptr",
"(",
"unsafe",
".",
"Pointer",
"(",
"name",
")",
")",
")",
"\n",
"}"
] |
22,427 | all-22428 | [
"Panicf",
"records",
"the",
"log",
"with",
"fatal",
"level",
"and",
"panics"
] | [
"func",
"Panicf",
"(",
"format",
"string",
",",
"args",
"...",
"<mask>",
"{",
"}",
")",
"{",
"msg",
":=",
"fmt",
".",
"Sprintf",
"(",
"format",
",",
"args",
"...",
")",
"\n",
"logger",
".",
"Output",
"(",
"2",
",",
"LevelError",
",",
"msg",
")",
"\n",
"panic",
"(",
"msg",
")",
"\n",
"}"
] |
22,428 | all-22429 | [
"Num",
"satisfies",
"the",
"HasNum",
"interface",
"for",
"String",
"s"
] | [
"func",
"(",
"s",
"<mask>",
")",
"Num",
"(",
")",
"Num",
"{",
"num",
",",
"err",
":=",
"strconv",
".",
"ParseFloat",
"(",
"strings",
".",
"TrimSpace",
"(",
"string",
"(",
"s",
")",
")",
",",
"64",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"Num",
"(",
"math",
".",
"NaN",
"(",
")",
")",
"\n",
"}",
"\n",
"return",
"Num",
"(",
"num",
")",
"\n",
"}"
] |
22,429 | all-22430 | [
"Read",
"reads",
"from",
"the",
"reader",
"into",
"the",
"byte",
"slice",
"."
] | [
"func",
"(",
"r",
"ArgReadHelper",
")",
"Read",
"(",
"bs",
"*",
"[",
"]",
"byte",
")",
"error",
"{",
"return",
"r",
".",
"read",
"(",
"func",
"(",
")",
"error",
"{",
"<mask>",
"err",
"error",
"\n",
"*",
"bs",
",",
"err",
"=",
"ioutil",
".",
"ReadAll",
"(",
"r",
".",
"reader",
")",
"\n",
"return",
"err",
"\n",
"}",
")",
"\n",
"}"
] |
22,430 | all-22431 | [
"GetEscalationMessageOk",
"returns",
"a",
"tuple",
"with",
"the",
"EscalationMessage",
"field",
"if",
"it",
"s",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"and",
"a",
"boolean",
"to",
"check",
"if",
"the",
"value",
"has",
"been",
"set",
"."
] | [
"func",
"(",
"o",
"*",
"Options",
")",
"GetEscalationMessageOk",
"(",
")",
"(",
"string",
",",
"bool",
")",
"{",
"if",
"o",
"==",
"nil",
"||",
"o",
".",
"EscalationMessage",
"==",
"nil",
"{",
"return",
"\"",
"\"",
",",
"false",
"\n",
"}",
"\n",
"return",
"*",
"o",
".",
"EscalationMessage",
",",
"<mask>",
"\n",
"}"
] |
22,431 | all-22432 | [
"GetInstanceMetrics",
"mocks",
"base",
"method"
] | [
"func",
"(",
"m",
"*",
"MockEngine",
")",
"GetInstanceMetrics",
"(",
")",
"(",
"*",
"ecstcs",
".",
"MetricsMetadata",
",",
"[",
"]",
"*",
"ecstcs",
".",
"TaskMetric",
",",
"error",
")",
"{",
"ret",
":=",
"m",
".",
"ctrl",
".",
"Call",
"(",
"m",
",",
"\"",
"\"",
")",
"\n",
"ret0",
",",
"_",
":=",
"<mask>",
"[",
"0",
"]",
".",
"(",
"*",
"ecstcs",
".",
"MetricsMetadata",
")",
"\n",
"ret1",
",",
"_",
":=",
"ret",
"[",
"1",
"]",
".",
"(",
"[",
"]",
"*",
"ecstcs",
".",
"TaskMetric",
")",
"\n",
"ret2",
",",
"_",
":=",
"ret",
"[",
"2",
"]",
".",
"(",
"error",
")",
"\n",
"return",
"ret0",
",",
"ret1",
",",
"ret2",
"\n",
"}"
] |
22,432 | all-22433 | [
"NewCountIndex",
"creates",
"an",
"index",
"which",
"counts",
"the",
"points",
"in",
"each",
"cell",
"."
] | [
"func",
"NewCountIndex",
"(",
"resolution",
"Meters",
")",
"*",
"CountIndex",
"{",
"newCounter",
":=",
"func",
"(",
")",
"interface",
"{",
"}",
"{",
"return",
"&",
"singleValueAccumulatingCounter",
"{",
"}",
"\n",
"}",
"\n\n",
"return",
"&",
"CountIndex",
"{",
"newGeoIndex",
"(",
"resolution",
",",
"newCounter",
")",
",",
"make",
"(",
"<mask>",
"[",
"string",
"]",
"Point",
")",
"}",
"\n",
"}"
] |
22,433 | all-22434 | [
"init",
"()",
"creates",
"the",
"Runner",
"s",
"underlying",
"data",
"structures",
"and",
"returns",
"an",
"error",
"if",
"any",
"problems",
"occur",
"."
] | [
"func",
"(",
"r",
"*",
"Runner",
")",
"init",
"(",
")",
"error",
"{",
"// Ensure default configuration values",
"r",
".",
"config",
"=",
"config",
".",
"DefaultConfig",
"(",
")",
".",
"Merge",
"(",
"r",
".",
"config",
")",
"\n",
"r",
".",
"config",
".",
"Finalize",
"(",
")",
"\n\n",
"// Print the final config for debugging",
"result",
",",
"err",
":=",
"json",
".",
"Marshal",
"(",
"r",
".",
"config",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"log",
".",
"Printf",
"(",
"\"",
"\"",
",",
"result",
")",
"\n\n",
"// Create the clientset",
"clients",
",",
"err",
":=",
"newClientSet",
"(",
"r",
".",
"config",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"}",
"\n\n",
"// Create the watcher",
"watcher",
",",
"err",
":=",
"newWatcher",
"(",
"r",
".",
"config",
",",
"clients",
",",
"r",
".",
"once",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"}",
"\n",
"r",
".",
"watcher",
"=",
"watcher",
"\n\n",
"numTemplates",
":=",
"len",
"(",
"*",
"r",
".",
"config",
".",
"Templates",
")",
"\n",
"templates",
":=",
"make",
"(",
"[",
"]",
"*",
"template",
".",
"Template",
",",
"0",
",",
"numTemplates",
")",
"\n",
"ctemplatesMap",
":=",
"make",
"(",
"map",
"[",
"string",
"]",
"config",
".",
"TemplateConfigs",
")",
"\n\n",
"// Iterate over each TemplateConfig, creating a new Template resource for each",
"// entry. Templates are parsed and saved, and a map of templates to their",
"// config templates is kept so templates can lookup their commands and output",
"// destinations.",
"for",
"_",
",",
"ctmpl",
":=",
"range",
"*",
"r",
".",
"config",
".",
"Templates",
"{",
"tmpl",
",",
"err",
":=",
"template",
".",
"NewTemplate",
"(",
"&",
"template",
".",
"NewTemplateInput",
"{",
"Source",
":",
"config",
".",
"StringVal",
"(",
"ctmpl",
".",
"Source",
")",
",",
"Contents",
":",
"config",
".",
"StringVal",
"(",
"ctmpl",
".",
"Contents",
")",
",",
"ErrMissingKey",
":",
"config",
".",
"BoolVal",
"(",
"ctmpl",
".",
"ErrMissingKey",
")",
",",
"LeftDelim",
":",
"config",
".",
"StringVal",
"(",
"ctmpl",
".",
"LeftDelim",
")",
",",
"RightDelim",
":",
"config",
".",
"StringVal",
"(",
"ctmpl",
".",
"RightDelim",
")",
",",
"}",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"if",
"_",
",",
"<mask>",
":=",
"ctemplatesMap",
"[",
"tmpl",
".",
"ID",
"(",
")",
"]",
";",
"!",
"ok",
"{",
"templates",
"=",
"append",
"(",
"templates",
",",
"tmpl",
")",
"\n",
"}",
"\n\n",
"if",
"_",
",",
"ok",
":=",
"ctemplatesMap",
"[",
"tmpl",
".",
"ID",
"(",
")",
"]",
";",
"!",
"ok",
"{",
"ctemplatesMap",
"[",
"tmpl",
".",
"ID",
"(",
")",
"]",
"=",
"make",
"(",
"[",
"]",
"*",
"config",
".",
"TemplateConfig",
",",
"0",
",",
"1",
")",
"\n",
"}",
"\n",
"ctemplatesMap",
"[",
"tmpl",
".",
"ID",
"(",
")",
"]",
"=",
"append",
"(",
"ctemplatesMap",
"[",
"tmpl",
".",
"ID",
"(",
")",
"]",
",",
"ctmpl",
")",
"\n",
"}",
"\n\n",
"// Convert the map of templates (which was only used to ensure uniqueness)",
"// back into an array of templates.",
"r",
".",
"templates",
"=",
"templates",
"\n\n",
"r",
".",
"renderEvents",
"=",
"make",
"(",
"map",
"[",
"string",
"]",
"*",
"RenderEvent",
",",
"numTemplates",
")",
"\n",
"r",
".",
"dependencies",
"=",
"make",
"(",
"map",
"[",
"string",
"]",
"dep",
".",
"Dependency",
")",
"\n\n",
"r",
".",
"renderedCh",
"=",
"make",
"(",
"chan",
"struct",
"{",
"}",
",",
"1",
")",
"\n",
"r",
".",
"renderEventCh",
"=",
"make",
"(",
"chan",
"struct",
"{",
"}",
",",
"1",
")",
"\n\n",
"r",
".",
"ctemplatesMap",
"=",
"ctemplatesMap",
"\n",
"r",
".",
"inStream",
"=",
"os",
".",
"Stdin",
"\n",
"r",
".",
"outStream",
"=",
"os",
".",
"Stdout",
"\n",
"r",
".",
"errStream",
"=",
"os",
".",
"Stderr",
"\n",
"r",
".",
"brain",
"=",
"template",
".",
"NewBrain",
"(",
")",
"\n\n",
"r",
".",
"ErrCh",
"=",
"make",
"(",
"chan",
"error",
")",
"\n",
"r",
".",
"DoneCh",
"=",
"make",
"(",
"chan",
"struct",
"{",
"}",
")",
"\n\n",
"r",
".",
"quiescenceMap",
"=",
"make",
"(",
"map",
"[",
"string",
"]",
"*",
"quiescence",
")",
"\n",
"r",
".",
"quiescenceCh",
"=",
"make",
"(",
"chan",
"*",
"template",
".",
"Template",
")",
"\n\n",
"if",
"*",
"r",
".",
"config",
".",
"Dedup",
".",
"Enabled",
"{",
"if",
"r",
".",
"once",
"{",
"log",
".",
"Printf",
"(",
"\"",
"\"",
")",
"\n",
"}",
"else",
"{",
"r",
".",
"dedup",
",",
"err",
"=",
"NewDedupManager",
"(",
"r",
".",
"config",
".",
"Dedup",
",",
"clients",
",",
"r",
".",
"brain",
",",
"r",
".",
"templates",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n\n",
"return",
"nil",
"\n",
"}"
] |
22,434 | all-22435 | [
"Load",
"parses",
"the",
"YAML",
"input",
"s",
"into",
"a",
"Config",
"."
] | [
"func",
"Load",
"(",
"s",
"string",
")",
"(",
"*",
"Config",
",",
"error",
")",
"{",
"cfg",
":=",
"&",
"Config",
"{",
"}",
"\n",
"// If the entire config body is empty the UnmarshalYAML method is",
"// never called. We thus have to set the DefaultConfig at the entry",
"// point as well.",
"*",
"cfg",
"=",
"DefaultConfig",
"\n\n",
"err",
":=",
"yaml",
".",
"UnmarshalStrict",
"(",
"[",
"]",
"<mask>",
"(",
"s",
")",
",",
"cfg",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"cfg",
".",
"original",
"=",
"s",
"\n",
"return",
"cfg",
",",
"nil",
"\n",
"}"
] |
22,435 | all-22436 | [
"NewContactGroup",
"returns",
"a",
"ContactGroup",
"(",
"with",
"defaults",
"if",
"applicable",
")"
] | [
"func",
"NewContactGroup",
"(",
")",
"*",
"ContactGroup",
"{",
"return",
"&",
"ContactGroup",
"{",
"Escalations",
":",
"<mask>",
"(",
"[",
"]",
"*",
"ContactGroupEscalation",
",",
"config",
".",
"NumSeverityLevels",
")",
",",
"Reminders",
":",
"make",
"(",
"[",
"]",
"uint",
",",
"config",
".",
"NumSeverityLevels",
")",
",",
"Contacts",
":",
"ContactGroupContacts",
"{",
"External",
":",
"[",
"]",
"ContactGroupContactsExternal",
"{",
"}",
",",
"Users",
":",
"[",
"]",
"ContactGroupContactsUser",
"{",
"}",
",",
"}",
",",
"}",
"\n",
"}"
] |
22,436 | all-22437 | [
"zoneIsManaged",
"checks",
"if",
"the",
"zone",
"should",
"be",
"managed",
"(",
"and",
"thus",
"have",
"records",
"deleted",
")",
"by",
"us"
] | [
"func",
"zoneIsManaged",
"(",
"z",
"*",
"route53",
".",
"HostedZone",
")",
"bool",
"{",
"// TODO: Move to a tag on the zone?",
"name",
":=",
"aws",
".",
"StringValue",
"(",
"z",
".",
"Name",
")",
"\n",
"if",
"\"",
"\"",
"==",
"name",
"{",
"return",
"<mask>",
"\n",
"}",
"\n\n",
"klog",
".",
"Infof",
"(",
"\"",
"\"",
",",
"name",
")",
"\n",
"return",
"false",
"\n",
"}"
] |
22,437 | all-22438 | [
"AllowContentType",
"enforces",
"a",
"whitelist",
"of",
"request",
"Content",
"-",
"Types",
"otherwise",
"responds",
"with",
"a",
"415",
"Unsupported",
"Media",
"Type",
"status",
"."
] | [
"func",
"AllowContentType",
"(",
"contentTypes",
"...",
"string",
")",
"func",
"(",
"next",
"http",
".",
"Handler",
")",
"http",
".",
"Handler",
"{",
"cT",
":=",
"[",
"]",
"string",
"{",
"}",
"\n",
"for",
"_",
",",
"t",
":=",
"range",
"contentTypes",
"{",
"cT",
"=",
"append",
"(",
"cT",
",",
"strings",
".",
"ToLower",
"(",
"t",
")",
")",
"\n",
"}",
"\n\n",
"return",
"func",
"(",
"next",
"http",
".",
"Handler",
")",
"http",
".",
"Handler",
"{",
"fn",
":=",
"func",
"(",
"w",
"http",
".",
"ResponseWriter",
",",
"r",
"*",
"http",
".",
"Request",
")",
"{",
"if",
"r",
".",
"ContentLength",
"==",
"0",
"{",
"// skip check for empty content body",
"next",
".",
"ServeHTTP",
"(",
"w",
",",
"r",
")",
"\n",
"return",
"\n",
"}",
"\n\n",
"s",
":=",
"strings",
".",
"ToLower",
"(",
"strings",
".",
"TrimSpace",
"(",
"r",
".",
"Header",
".",
"Get",
"(",
"\"",
"\"",
")",
")",
")",
"\n",
"if",
"i",
":=",
"strings",
".",
"Index",
"(",
"s",
",",
"\"",
"\"",
")",
";",
"i",
">",
"-",
"1",
"{",
"s",
"=",
"s",
"[",
"0",
":",
"i",
"]",
"\n",
"}",
"\n\n",
"for",
"_",
",",
"t",
":=",
"range",
"cT",
"{",
"if",
"t",
"==",
"s",
"{",
"<mask>",
".",
"ServeHTTP",
"(",
"w",
",",
"r",
")",
"\n",
"return",
"\n",
"}",
"\n",
"}",
"\n\n",
"w",
".",
"WriteHeader",
"(",
"http",
".",
"StatusUnsupportedMediaType",
")",
"\n",
"}",
"\n",
"return",
"http",
".",
"HandlerFunc",
"(",
"fn",
")",
"\n",
"}",
"\n",
"}"
] |
22,438 | all-22439 | [
"Get",
"retreives",
"the",
"value",
"stored",
"in",
"a",
"particular",
"position",
"of",
"the",
"list",
".",
"If",
"no",
"item",
"exists",
"at",
"the",
"given",
"position",
"the",
"second",
"parameter",
"will",
"be",
"returned",
"as",
"false",
"."
] | [
"func",
"(",
"l",
"*",
"List",
")",
"Get",
"(",
"pos",
"uint",
")",
"(",
"interface",
"{",
"}",
",",
"bool",
")",
"{",
"l",
".",
"key",
".",
"RLock",
"(",
")",
"\n",
"defer",
"l",
".",
"<mask>",
".",
"RUnlock",
"(",
")",
"\n\n",
"if",
"pos",
">",
"uint",
"(",
"len",
"(",
"l",
".",
"underlyer",
")",
")",
"{",
"return",
"nil",
",",
"false",
"\n",
"}",
"\n",
"return",
"l",
".",
"underlyer",
"[",
"pos",
"]",
",",
"true",
"\n",
"}"
] |
22,439 | all-22440 | [
"/",
"*",
"Allocates",
"and",
"initializes",
"CvMat",
"header",
"and",
"allocates",
"data"
] | [
"func",
"CreateMat",
"(",
"<mask>",
",",
"cols",
",",
"type_",
"int",
")",
"*",
"Mat",
"{",
"mat",
":=",
"C",
".",
"cvCreateMat",
"(",
"C",
".",
"int",
"(",
"rows",
")",
",",
"C",
".",
"int",
"(",
"cols",
")",
",",
"C",
".",
"int",
"(",
"type_",
")",
",",
")",
"\n",
"return",
"(",
"*",
"Mat",
")",
"(",
"mat",
")",
"\n",
"}"
] |
22,440 | all-22441 | [
"MarshalEasyJSON",
"satisfies",
"easyjson",
".",
"Marshaler",
"."
] | [
"func",
"(",
"t",
"CaptureScreenshotFormat",
")",
"MarshalEasyJSON",
"(",
"out",
"*",
"jwriter",
".",
"Writer",
")",
"{",
"out",
".",
"<mask>",
"(",
"string",
"(",
"t",
")",
")",
"\n",
"}"
] |
22,441 | all-22442 | [
"Apply",
"returns",
"a",
"policy",
"that",
"merges",
"the",
"child",
"into",
"the",
"parent"
] | [
"func",
"(",
"p",
"Policy",
")",
"Apply",
"(",
"child",
"Policy",
")",
"Policy",
"{",
"return",
"Policy",
"{",
"Protect",
":",
"selectBool",
"(",
"p",
".",
"Protect",
",",
"<mask>",
".",
"Protect",
")",
",",
"RequiredStatusChecks",
":",
"mergeContextPolicy",
"(",
"p",
".",
"RequiredStatusChecks",
",",
"child",
".",
"RequiredStatusChecks",
")",
",",
"Admins",
":",
"selectBool",
"(",
"p",
".",
"Admins",
",",
"child",
".",
"Admins",
")",
",",
"Restrictions",
":",
"mergeRestrictions",
"(",
"p",
".",
"Restrictions",
",",
"child",
".",
"Restrictions",
")",
",",
"RequiredPullRequestReviews",
":",
"mergeReviewPolicy",
"(",
"p",
".",
"RequiredPullRequestReviews",
",",
"child",
".",
"RequiredPullRequestReviews",
")",
",",
"}",
"\n",
"}"
] |
22,442 | all-22443 | [
"Jobs",
"returns",
"a",
"thread",
"-",
"safe",
"snapshot",
"of",
"the",
"current",
"job",
"state",
"."
] | [
"func",
"(",
"ja",
"*",
"JobAgent",
")",
"Jobs",
"(",
")",
"[",
"]",
"Job",
"{",
"ja",
".",
"mut",
".",
"Lock",
"(",
")",
"\n",
"defer",
"ja",
".",
"mut",
".",
"Unlock",
"(",
")",
"\n",
"res",
":=",
"<mask>",
"(",
"[",
"]",
"Job",
",",
"len",
"(",
"ja",
".",
"jobs",
")",
")",
"\n",
"copy",
"(",
"res",
",",
"ja",
".",
"jobs",
")",
"\n",
"return",
"res",
"\n",
"}"
] |
22,443 | all-22444 | [
"SettingsNewFull",
"is",
"a",
"wrapper",
"around",
"g_settings_new_full",
"()",
"."
] | [
"func",
"SettingsNewFull",
"(",
"schema",
"*",
"SettingsSchema",
",",
"backend",
"*",
"SettingsBackend",
",",
"path",
"string",
")",
"*",
"Settings",
"{",
"cstr1",
":=",
"(",
"*",
"C",
".",
"gchar",
")",
"(",
"C",
".",
"CString",
"(",
"<mask>",
")",
")",
"\n",
"defer",
"C",
".",
"free",
"(",
"unsafe",
".",
"Pointer",
"(",
"cstr1",
")",
")",
"\n\n",
"return",
"wrapFullSettings",
"(",
"C",
".",
"g_settings_new_full",
"(",
"schema",
".",
"native",
"(",
")",
",",
"backend",
".",
"native",
"(",
")",
",",
"cstr1",
")",
")",
"\n",
"}"
] |
22,444 | all-22445 | [
"Specify",
"the",
"value",
"of",
"a",
"uniform",
"variable",
"for",
"a",
"specified",
"program",
"object"
] | [
"func",
"ProgramUniform4uiv",
"(",
"program",
"uint32",
",",
"location",
"int32",
",",
"count",
"int32",
",",
"value",
"*",
"uint32",
")",
"{",
"syscall",
".",
"Syscall6",
"(",
"gpProgramUniform4uiv",
",",
"4",
",",
"uintptr",
"(",
"program",
")",
",",
"uintptr",
"(",
"location",
")",
",",
"uintptr",
"(",
"count",
")",
",",
"uintptr",
"(",
"unsafe",
".",
"Pointer",
"(",
"<mask>",
")",
")",
",",
"0",
",",
"0",
")",
"\n",
"}"
] |
22,445 | all-22446 | [
"NewTicker",
"calls",
"time",
".",
"NewTicker",
"."
] | [
"func",
"(",
"g",
"GitOS",
")",
"NewTicker",
"(",
"d",
"time",
".",
"Duration",
")",
"Ticker",
"{",
"return",
"&",
"GitTicker",
"{",
"<mask>",
".",
"NewTicker",
"(",
"d",
")",
"}",
"\n",
"}"
] |
22,446 | all-22447 | [
"readMeta",
"is",
"used",
"to",
"read",
"the",
"meta",
"data",
"for",
"a",
"given",
"named",
"backup"
] | [
"func",
"(",
"f",
"*",
"FileSnapshotStore",
")",
"readMeta",
"(",
"name",
"string",
")",
"(",
"*",
"fileSnapshotMeta",
",",
"error",
")",
"{",
"// Open the meta file",
"metaPath",
":=",
"filepath",
".",
"Join",
"(",
"f",
".",
"path",
",",
"name",
",",
"metaFilePath",
")",
"\n",
"fh",
",",
"err",
":=",
"<mask>",
".",
"Open",
"(",
"metaPath",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"defer",
"fh",
".",
"Close",
"(",
")",
"\n\n",
"// Buffer the file IO",
"buffered",
":=",
"bufio",
".",
"NewReader",
"(",
"fh",
")",
"\n\n",
"// Read in the JSON",
"meta",
":=",
"&",
"fileSnapshotMeta",
"{",
"}",
"\n",
"dec",
":=",
"json",
".",
"NewDecoder",
"(",
"buffered",
")",
"\n",
"if",
"err",
":=",
"dec",
".",
"Decode",
"(",
"meta",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"return",
"meta",
",",
"nil",
"\n",
"}"
] |
22,447 | all-22448 | [
"String",
"returns",
"the",
"NodeType",
"as",
"string",
"value",
"."
] | [
"func",
"(",
"t",
"NodeType",
")",
"String",
"(",
")",
"string",
"{",
"switch",
"t",
"{",
"case",
"NodeTypeElement",
":",
"return",
"\"",
"\"",
"\n",
"case",
"NodeTypeAttribute",
":",
"return",
"\"",
"\"",
"\n",
"case",
"NodeTypeText",
":",
"return",
"\"",
"\"",
"\n",
"case",
"NodeTypeCDATA",
":",
"return",
"\"",
"\"",
"\n",
"case",
"NodeTypeEntityReference",
":",
"return",
"\"",
"\"",
"\n",
"<mask>",
"NodeTypeEntity",
":",
"return",
"\"",
"\"",
"\n",
"case",
"NodeTypeProcessingInstruction",
":",
"return",
"\"",
"\"",
"\n",
"case",
"NodeTypeComment",
":",
"return",
"\"",
"\"",
"\n",
"case",
"NodeTypeDocument",
":",
"return",
"\"",
"\"",
"\n",
"case",
"NodeTypeDocumentType",
":",
"return",
"\"",
"\"",
"\n",
"case",
"NodeTypeDocumentFragment",
":",
"return",
"\"",
"\"",
"\n",
"case",
"NodeTypeNotation",
":",
"return",
"\"",
"\"",
"\n",
"}",
"\n\n",
"return",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"t",
")",
"\n",
"}"
] |
22,448 | all-22449 | [
"UnmarshalJSON",
"supports",
"json",
".",
"Unmarshaler",
"interface"
] | [
"func",
"(",
"v",
"*",
"SetKeyframeKeyReturns",
")",
"UnmarshalJSON",
"(",
"data",
"[",
"]",
"byte",
")",
"error",
"{",
"r",
":=",
"jlexer",
".",
"Lexer",
"{",
"Data",
":",
"data",
"}",
"\n",
"easyjsonC5a4559bDecodeGithubComChromedpCdprotoCss19",
"(",
"&",
"r",
",",
"v",
")",
"\n",
"return",
"r",
".",
"<mask>",
"(",
")",
"\n",
"}"
] |
22,449 | all-22450 | [
"TTL",
"returns",
"the",
"time",
"to",
"live",
"for",
"this",
"callReq",
"."
] | [
"func",
"(",
"f",
"lazyCallReq",
")",
"TTL",
"(",
")",
"<mask>",
".",
"Duration",
"{",
"ttl",
":=",
"binary",
".",
"BigEndian",
".",
"Uint32",
"(",
"f",
".",
"Payload",
"[",
"_ttlIndex",
":",
"_ttlIndex",
"+",
"_ttlLen",
"]",
")",
"\n",
"return",
"time",
".",
"Duration",
"(",
"ttl",
")",
"*",
"time",
".",
"Millisecond",
"\n",
"}"
] |
22,450 | all-22451 | [
"Retrieve",
"retrieves",
"and",
"processes",
"the",
"specified",
"asset",
"sources",
"and",
"returns",
"them",
"using",
"a",
"http",
".",
"FileSystem",
"interface",
"."
] | [
"func",
"Retrieve",
"(",
"sources",
"[",
"]",
"*",
"Source",
")",
"(",
"http",
".",
"FileSystem",
",",
"error",
")",
"{",
"files",
":=",
"make",
"(",
"mfs",
".",
"Files",
")",
"\n\n",
"for",
"i",
",",
"source",
":=",
"range",
"sources",
"{",
"log",
".",
"Printf",
"(",
"\"",
"\"",
",",
"i",
"+",
"1",
",",
"len",
"(",
"sources",
")",
",",
"source",
".",
"Location",
")",
"\n\n",
"// Retrieve the file or files",
"retFiles",
",",
"err",
":=",
"retrieve",
"(",
"source",
".",
"Location",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"&",
"RetrieveError",
"{",
"source",
".",
"Location",
",",
"err",
"}",
"\n",
"}",
"\n\n",
"// If multiple files are returned store them and finish processing.",
"// Chekcsum and archive not supported for multiple files.",
"if",
"len",
"(",
"retFiles",
")",
">",
"1",
"{",
"for",
"_",
",",
"file",
":=",
"range",
"retFiles",
"{",
"path",
":=",
"strings",
".",
"TrimSuffix",
"(",
"source",
".",
"Path",
",",
"\"",
"\"",
")",
"+",
"\"",
"\"",
"+",
"file",
".",
"path",
"\n",
"log",
".",
"Printf",
"(",
"\"",
"\"",
",",
"path",
")",
"\n",
"files",
"[",
"path",
"]",
"=",
"&",
"mfs",
".",
"File",
"{",
"file",
".",
"data",
",",
"file",
".",
"modTime",
"}",
"\n",
"}",
"\n",
"continue",
"\n",
"}",
"\n\n",
"// Process the single returned file",
"file",
":=",
"retFiles",
"[",
"0",
"]",
"\n\n",
"// Verify the file checksum if requested",
"if",
"source",
".",
"Checksum",
"!=",
"nil",
"{",
"err",
"=",
"verifyChecksum",
"(",
"source",
".",
"Checksum",
",",
"file",
".",
"data",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"&",
"ChecksumError",
"{",
"source",
".",
"Location",
",",
"err",
"}",
"\n",
"}",
"\n",
"}",
"\n\n",
"// If the file is not an archive store it and finish processing.",
"if",
"source",
".",
"Archive",
"==",
"nil",
"{",
"log",
".",
"Printf",
"(",
"\"",
"\"",
",",
"source",
".",
"Path",
")",
"\n",
"files",
"[",
"<mask>",
".",
"Path",
"]",
"=",
"&",
"mfs",
".",
"File",
"{",
"file",
".",
"data",
",",
"file",
".",
"modTime",
"}",
"\n",
"continue",
"\n",
"}",
"\n\n",
"// Extract files from the archive and store them.",
"archFiles",
",",
"err",
":=",
"processArchive",
"(",
"source",
".",
"Archive",
",",
"file",
".",
"data",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"&",
"ArchiveError",
"{",
"source",
".",
"Location",
",",
"err",
"}",
"\n",
"}",
"\n\n",
"for",
"_",
",",
"file",
":=",
"range",
"archFiles",
"{",
"log",
".",
"Printf",
"(",
"\"",
"\"",
",",
"file",
".",
"path",
")",
"\n",
"files",
"[",
"file",
".",
"path",
"]",
"=",
"&",
"mfs",
".",
"File",
"{",
"file",
".",
"data",
",",
"file",
".",
"modTime",
"}",
"\n",
"}",
"\n\n",
"}",
"\n\n",
"fs",
",",
"err",
":=",
"mfs",
".",
"New",
"(",
"files",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"return",
"httpfs",
".",
"New",
"(",
"fs",
")",
",",
"nil",
"\n",
"}"
] |
22,451 | all-22452 | [
"shouldWatch",
"returns",
"whether",
"the",
"service",
"of",
"the",
"given",
"name",
"should",
"be",
"watched",
"based",
"on",
"its",
"tags",
".",
"This",
"gets",
"called",
"when",
"the",
"user",
"doesn",
"t",
"specify",
"a",
"list",
"of",
"services",
"in",
"order",
"to",
"avoid",
"watching",
"*",
"all",
"*",
"services",
".",
"Details",
"in",
"https",
":",
"//",
"github",
".",
"com",
"/",
"prometheus",
"/",
"prometheus",
"/",
"pull",
"/",
"3814"
] | [
"func",
"(",
"d",
"*",
"Discovery",
")",
"shouldWatchFromTags",
"(",
"<mask>",
"[",
"]",
"string",
")",
"bool",
"{",
"// If there's no fixed set of watched tags, we watch everything.",
"if",
"len",
"(",
"d",
".",
"watchedTags",
")",
"==",
"0",
"{",
"return",
"true",
"\n",
"}",
"\n\n",
"tagOuter",
":",
"for",
"_",
",",
"wtag",
":=",
"range",
"d",
".",
"watchedTags",
"{",
"for",
"_",
",",
"tag",
":=",
"range",
"tags",
"{",
"if",
"wtag",
"==",
"tag",
"{",
"continue",
"tagOuter",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"false",
"\n",
"}",
"\n",
"return",
"true",
"\n",
"}"
] |
22,452 | all-22453 | [
"Do",
"executes",
"Browser",
".",
"getVersion",
"against",
"the",
"provided",
"context",
".",
"returns",
":",
"protocolVersion",
"-",
"Protocol",
"version",
".",
"product",
"-",
"Product",
"name",
".",
"revision",
"-",
"Product",
"revision",
".",
"userAgent",
"-",
"User",
"-",
"Agent",
".",
"jsVersion",
"-",
"V8",
"version",
"."
] | [
"func",
"(",
"p",
"*",
"GetVersionParams",
")",
"Do",
"(",
"ctx",
"context",
".",
"Context",
")",
"(",
"protocolVersion",
"string",
",",
"<mask>",
"string",
",",
"revision",
"string",
",",
"userAgent",
"string",
",",
"jsVersion",
"string",
",",
"err",
"error",
")",
"{",
"// execute",
"var",
"res",
"GetVersionReturns",
"\n",
"err",
"=",
"cdp",
".",
"Execute",
"(",
"ctx",
",",
"CommandGetVersion",
",",
"nil",
",",
"&",
"res",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"err",
"\n",
"}",
"\n\n",
"return",
"res",
".",
"ProtocolVersion",
",",
"res",
".",
"Product",
",",
"res",
".",
"Revision",
",",
"res",
".",
"UserAgent",
",",
"res",
".",
"JsVersion",
",",
"nil",
"\n",
"}"
] |
22,453 | all-22454 | [
"HasClientEmail",
"returns",
"a",
"boolean",
"if",
"a",
"field",
"has",
"been",
"set",
"."
] | [
"func",
"(",
"i",
"*",
"IntegrationGCPUpdateRequest",
")",
"HasClientEmail",
"(",
")",
"bool",
"{",
"if",
"i",
"!=",
"nil",
"&&",
"i",
".",
"ClientEmail",
"!=",
"nil",
"{",
"return",
"<mask>",
"\n",
"}",
"\n\n",
"return",
"false",
"\n",
"}"
] |
22,454 | all-22455 | [
"StoreNonce",
"generates",
"and",
"stores",
"a",
"nonce",
"in",
"the",
"outgoing",
"response",
"."
] | [
"func",
"StoreNonce",
"(",
"w",
"http",
".",
"ResponseWriter",
",",
"r",
"*",
"<mask>",
".",
"Request",
")",
"(",
"err",
"error",
")",
"{",
"if",
"c",
":=",
"r",
".",
"Context",
"(",
")",
".",
"Value",
"(",
"nonceSetterKey",
")",
";",
"c",
"!=",
"nil",
"{",
"if",
"setter",
",",
"ok",
":=",
"c",
".",
"(",
"func",
"(",
"http",
".",
"ResponseWriter",
",",
"*",
"http",
".",
"Request",
")",
"error",
")",
";",
"ok",
"{",
"err",
"=",
"setter",
"(",
"w",
",",
"r",
")",
"\n",
"}",
"\n",
"}",
"\n\n",
"return",
"err",
"\n",
"}"
] |
22,455 | all-22456 | [
"HasFocus",
"is",
"a",
"wrapper",
"around",
"gtk_widget_has_focus",
"()",
"."
] | [
"func",
"(",
"v",
"*",
"Widget",
")",
"HasFocus",
"(",
")",
"bool",
"{",
"c",
":=",
"C",
".",
"gtk_widget_has_focus",
"(",
"v",
".",
"native",
"(",
")",
")",
"\n",
"<mask>",
"gobool",
"(",
"c",
")",
"\n",
"}"
] |
22,456 | all-22457 | [
"UnmarshalJSON",
"supports",
"json",
".",
"Unmarshaler",
"interface"
] | [
"func",
"(",
"v",
"*",
"GetRelayoutBoundaryParams",
")",
"UnmarshalJSON",
"(",
"data",
"[",
"]",
"byte",
")",
"error",
"{",
"r",
":=",
"jlexer",
".",
"Lexer",
"{",
"Data",
":",
"data",
"}",
"\n",
"easyjsonC5a4559bDecodeGithubComChromedpCdprotoDom35",
"(",
"&",
"r",
",",
"v",
")",
"\n",
"return",
"r",
".",
"<mask>",
"(",
")",
"\n",
"}"
] |
22,457 | all-22458 | [
"ValueOrZero",
"returns",
"the",
"inner",
"value",
"if",
"valid",
"otherwise",
"zero",
"."
] | [
"func",
"(",
"t",
"Time",
")",
"ValueOrZero",
"(",
")",
"<mask>",
".",
"Time",
"{",
"if",
"!",
"t",
".",
"Valid",
"{",
"return",
"time",
".",
"Time",
"{",
"}",
"\n",
"}",
"\n",
"return",
"t",
".",
"Time",
"\n",
"}"
] |
22,458 | all-22459 | [
"ForArch",
"returns",
"a",
"correct",
"Sizes",
"for",
"the",
"given",
"architecture",
"."
] | [
"func",
"ForArch",
"(",
"arch",
"string",
")",
"*",
"Sizes",
"{",
"wordSize",
":=",
"int64",
"(",
"8",
")",
"\n",
"maxAlign",
":=",
"int64",
"(",
"8",
")",
"\n",
"<mask>",
"build",
".",
"Default",
".",
"GOARCH",
"{",
"case",
"\"",
"\"",
",",
"\"",
"\"",
":",
"wordSize",
",",
"maxAlign",
"=",
"4",
",",
"4",
"\n",
"case",
"\"",
"\"",
":",
"wordSize",
"=",
"4",
"\n",
"}",
"\n",
"return",
"&",
"Sizes",
"{",
"WordSize",
":",
"wordSize",
",",
"MaxAlign",
":",
"maxAlign",
"}",
"\n",
"}"
] |
22,459 | all-22460 | [
"RowsPreviousColumn",
"creates",
"a",
"Rows",
"query",
"with",
"the",
"given",
"previous",
"row",
"ID",
"/",
"key",
"and",
"column",
"ID",
"/",
"key"
] | [
"func",
"(",
"f",
"*",
"Field",
")",
"RowsPreviousColumn",
"(",
"rowIDOrKey",
"interface",
"{",
"}",
",",
"columnIDOrKey",
"interface",
"{",
"}",
")",
"*",
"PQLRowsQuery",
"{",
"rowIDKey",
",",
"err",
":=",
"formatIDKey",
"(",
"rowIDOrKey",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"NewPQLRowsQuery",
"(",
"\"",
"\"",
",",
"f",
".",
"index",
",",
"err",
")",
"\n",
"}",
"\n",
"columnIDKey",
",",
"err",
":=",
"formatIDKey",
"(",
"columnIDOrKey",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"NewPQLRowsQuery",
"(",
"\"",
"\"",
",",
"f",
".",
"index",
",",
"err",
")",
"\n",
"}",
"\n",
"<mask>",
":=",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"f",
".",
"name",
",",
"rowIDKey",
",",
"columnIDKey",
")",
"\n",
"return",
"NewPQLRowsQuery",
"(",
"text",
",",
"f",
".",
"index",
",",
"nil",
")",
"\n",
"}"
] |
22,460 | all-22461 | [
"NewOutgoingPhoto",
"creates",
"a",
"new",
"outgoing",
"photo",
"."
] | [
"func",
"(",
"api",
"*",
"TelegramBotAPI",
")",
"NewOutgoingPhoto",
"(",
"recipient",
"Recipient",
",",
"fileName",
"string",
",",
"reader",
"<mask>",
".",
"Reader",
")",
"*",
"OutgoingPhoto",
"{",
"return",
"&",
"OutgoingPhoto",
"{",
"outgoingMessageBase",
":",
"outgoingMessageBase",
"{",
"outgoingBase",
":",
"outgoingBase",
"{",
"api",
":",
"api",
",",
"Recipient",
":",
"recipient",
",",
"}",
",",
"}",
",",
"outgoingFileBase",
":",
"outgoingFileBase",
"{",
"fileName",
":",
"fileName",
",",
"r",
":",
"reader",
",",
"}",
",",
"}",
"\n",
"}"
] |
22,461 | all-22462 | [
"title",
":",
"list",
"app",
"certificates",
"path",
":",
"/",
"apps",
"/",
"{",
"app",
"}",
"/",
"certificate",
"method",
":",
"GET",
"consume",
":",
"application",
"/",
"x",
"-",
"www",
"-",
"form",
"-",
"urlencoded",
"responses",
":",
"200",
":",
"Ok",
"401",
":",
"Unauthorized",
"404",
":",
"App",
"not",
"found"
] | [
"func",
"listCertificates",
"(",
"w",
"http",
".",
"ResponseWriter",
",",
"r",
"*",
"http",
".",
"Request",
",",
"t",
"auth",
".",
"Token",
")",
"error",
"{",
"a",
",",
"err",
":=",
"getAppFromContext",
"(",
"r",
".",
"<mask>",
".",
"Query",
"(",
")",
".",
"Get",
"(",
"\"",
"\"",
")",
",",
"r",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"allowed",
":=",
"permission",
".",
"Check",
"(",
"t",
",",
"permission",
".",
"PermAppReadCertificate",
",",
"contextsForApp",
"(",
"&",
"a",
")",
"...",
",",
")",
"\n",
"if",
"!",
"allowed",
"{",
"return",
"permission",
".",
"ErrUnauthorized",
"\n",
"}",
"\n",
"w",
".",
"Header",
"(",
")",
".",
"Set",
"(",
"\"",
"\"",
",",
"\"",
"\"",
")",
"\n",
"result",
",",
"err",
":=",
"a",
".",
"GetCertificates",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"return",
"json",
".",
"NewEncoder",
"(",
"w",
")",
".",
"Encode",
"(",
"&",
"result",
")",
"\n",
"}"
] |
22,462 | all-22463 | [
"DelGroup",
"removes",
"a",
"group",
"from",
"the",
"system",
"."
] | [
"func",
"DelGroup",
"(",
"name",
"string",
")",
"(",
"err",
"error",
")",
"{",
"err",
"=",
"del",
"(",
"<mask>",
",",
"&",
"Group",
"{",
"}",
")",
"\n",
"if",
"err",
"==",
"nil",
"{",
"err",
"=",
"del",
"(",
"name",
",",
"&",
"GShadow",
"{",
"}",
")",
"\n",
"}",
"\n",
"return",
"\n",
"}"
] |
22,463 | all-22464 | [
"NewPQLBaseQuery",
"creates",
"a",
"new",
"PQLQuery",
"with",
"the",
"given",
"PQL",
"and",
"index",
"."
] | [
"func",
"NewPQLBaseQuery",
"(",
"pql",
"string",
",",
"index",
"*",
"Index",
",",
"err",
"error",
")",
"*",
"PQLBaseQuery",
"{",
"return",
"&",
"PQLBaseQuery",
"{",
"index",
":",
"index",
",",
"pql",
":",
"pql",
",",
"err",
":",
"err",
",",
"hasKeys",
":",
"<mask>",
".",
"options",
".",
"keys",
",",
"}",
"\n",
"}"
] |
22,464 | all-22465 | [
"MemorySize",
"returns",
"memory",
"size",
"of",
"the",
"virtual",
"machine",
"."
] | [
"func",
"(",
"v",
"*",
"VM",
")",
"MemorySize",
"(",
")",
"(",
"uint",
",",
"error",
")",
"{",
"<mask>",
"err",
"C",
".",
"VixError",
"=",
"C",
".",
"VIX_OK",
"\n",
"memsize",
":=",
"C",
".",
"VIX_PROPERTY_NONE",
"\n\n",
"err",
"=",
"C",
".",
"get_property",
"(",
"v",
".",
"handle",
",",
"C",
".",
"VIX_PROPERTY_VM_MEMORY_SIZE",
",",
"unsafe",
".",
"Pointer",
"(",
"&",
"memsize",
")",
")",
"\n\n",
"if",
"C",
".",
"VIX_OK",
"!=",
"err",
"{",
"return",
"0",
",",
"&",
"Error",
"{",
"Operation",
":",
"\"",
"\"",
",",
"Code",
":",
"int",
"(",
"err",
"&",
"0xFFFF",
")",
",",
"Text",
":",
"C",
".",
"GoString",
"(",
"C",
".",
"Vix_GetErrorText",
"(",
"err",
",",
"nil",
")",
")",
",",
"}",
"\n",
"}",
"\n\n",
"return",
"uint",
"(",
"memsize",
")",
",",
"nil",
"\n",
"}"
] |
22,465 | all-22466 | [
"LevelFromString",
"returns",
"a",
"level",
"based",
"on",
"the",
"input",
"string",
"s",
".",
"If",
"the",
"input",
"can",
"t",
"be",
"interpreted",
"as",
"a",
"valid",
"log",
"level",
"the",
"info",
"level",
"and",
"false",
"is",
"returned",
"."
] | [
"func",
"LevelFromString",
"(",
"s",
"string",
")",
"(",
"l",
"Level",
",",
"ok",
"bool",
")",
"{",
"<mask>",
"strings",
".",
"ToLower",
"(",
"s",
")",
"{",
"case",
"\"",
"\"",
",",
"\"",
"\"",
":",
"return",
"LevelTrace",
",",
"true",
"\n",
"case",
"\"",
"\"",
",",
"\"",
"\"",
":",
"return",
"LevelDebug",
",",
"true",
"\n",
"case",
"\"",
"\"",
",",
"\"",
"\"",
":",
"return",
"LevelInfo",
",",
"true",
"\n",
"case",
"\"",
"\"",
",",
"\"",
"\"",
":",
"return",
"LevelWarn",
",",
"true",
"\n",
"case",
"\"",
"\"",
",",
"\"",
"\"",
":",
"return",
"LevelError",
",",
"true",
"\n",
"case",
"\"",
"\"",
",",
"\"",
"\"",
":",
"return",
"LevelCritical",
",",
"true",
"\n",
"case",
"\"",
"\"",
":",
"return",
"LevelOff",
",",
"true",
"\n",
"default",
":",
"return",
"LevelInfo",
",",
"false",
"\n",
"}",
"\n",
"}"
] |
22,466 | all-22467 | [
"getExistingConn",
"is",
"used",
"to",
"grab",
"a",
"pooled",
"connection",
"."
] | [
"func",
"(",
"n",
"*",
"NetworkTransport",
")",
"getPooledConn",
"(",
"target",
"ServerAddress",
")",
"*",
"netConn",
"{",
"n",
".",
"connPoolLock",
".",
"Lock",
"(",
")",
"\n",
"defer",
"n",
".",
"connPoolLock",
".",
"Unlock",
"(",
")",
"\n\n",
"conns",
",",
"ok",
":=",
"n",
".",
"connPool",
"[",
"target",
"]",
"\n",
"if",
"!",
"ok",
"||",
"len",
"(",
"conns",
")",
"==",
"0",
"{",
"return",
"nil",
"\n",
"}",
"\n\n",
"var",
"conn",
"*",
"netConn",
"\n",
"num",
":=",
"len",
"(",
"conns",
")",
"\n",
"<mask>",
",",
"conns",
"[",
"num",
"-",
"1",
"]",
"=",
"conns",
"[",
"num",
"-",
"1",
"]",
",",
"nil",
"\n",
"n",
".",
"connPool",
"[",
"target",
"]",
"=",
"conns",
"[",
":",
"num",
"-",
"1",
"]",
"\n",
"return",
"conn",
"\n",
"}"
] |
22,467 | all-22468 | [
"RegisterContainerInstance",
"indicates",
"an",
"expected",
"call",
"of",
"RegisterContainerInstance"
] | [
"func",
"(",
"mr",
"*",
"MockECSClientMockRecorder",
")",
"RegisterContainerInstance",
"(",
"arg0",
",",
"arg1",
",",
"arg2",
",",
"arg3",
",",
"arg4",
"<mask>",
"{",
"}",
")",
"*",
"gomock",
".",
"Call",
"{",
"return",
"mr",
".",
"mock",
".",
"ctrl",
".",
"RecordCallWithMethodType",
"(",
"mr",
".",
"mock",
",",
"\"",
"\"",
",",
"reflect",
".",
"TypeOf",
"(",
"(",
"*",
"MockECSClient",
")",
"(",
"nil",
")",
".",
"RegisterContainerInstance",
")",
",",
"arg0",
",",
"arg1",
",",
"arg2",
",",
"arg3",
",",
"arg4",
")",
"\n",
"}"
] |
22,468 | all-22469 | [
"Warningf",
"calls",
"Logger",
".",
"Warningf",
"method",
"with",
"provided",
"arguments",
"."
] | [
"func",
"(",
"g",
"GRPCLoggerV2",
")",
"Warningf",
"(",
"<mask>",
"string",
",",
"args",
"...",
"interface",
"{",
"}",
")",
"{",
"g",
".",
"l",
".",
"Warningf",
"(",
"format",
",",
"args",
"...",
")",
"\n",
"}"
] |
22,469 | all-22470 | [
"copyGoModToTemp",
"copies",
"to",
"given",
"go",
".",
"mod",
"file",
"to",
"a",
"temporary",
"directory",
".",
"go",
"list",
"tends",
"to",
"mutate",
"go",
".",
"mod",
"files",
"but",
"gazelle",
"shouldn",
"t",
"do",
"that",
"."
] | [
"func",
"copyGoModToTemp",
"(",
"<mask>",
"string",
")",
"(",
"tempDir",
"string",
",",
"err",
"error",
")",
"{",
"goModOrig",
",",
"err",
":=",
"os",
".",
"Open",
"(",
"filename",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"\"",
"\"",
",",
"err",
"\n",
"}",
"\n",
"defer",
"goModOrig",
".",
"Close",
"(",
")",
"\n\n",
"tempDir",
",",
"err",
"=",
"ioutil",
".",
"TempDir",
"(",
"\"",
"\"",
",",
"\"",
"\"",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"\"",
"\"",
",",
"err",
"\n",
"}",
"\n\n",
"goModCopy",
",",
"err",
":=",
"os",
".",
"Create",
"(",
"filepath",
".",
"Join",
"(",
"tempDir",
",",
"\"",
"\"",
")",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"os",
".",
"Remove",
"(",
"tempDir",
")",
"\n",
"return",
"\"",
"\"",
",",
"err",
"\n",
"}",
"\n",
"defer",
"func",
"(",
")",
"{",
"if",
"cerr",
":=",
"goModCopy",
".",
"Close",
"(",
")",
";",
"err",
"==",
"nil",
"&&",
"cerr",
"!=",
"nil",
"{",
"err",
"=",
"cerr",
"\n",
"}",
"\n",
"}",
"(",
")",
"\n\n",
"_",
",",
"err",
"=",
"io",
".",
"Copy",
"(",
"goModCopy",
",",
"goModOrig",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"os",
".",
"RemoveAll",
"(",
"tempDir",
")",
"\n",
"return",
"\"",
"\"",
",",
"err",
"\n",
"}",
"\n",
"return",
"tempDir",
",",
"err",
"\n",
"}"
] |
22,470 | all-22471 | [
"Priority",
"returns",
"a",
"syslog",
".",
"Priority",
"representation",
"of",
"SyslogFacility",
"."
] | [
"func",
"(",
"s",
"SyslogFacility",
")",
"Priority",
"(",
")",
"syslog",
".",
"Priority",
"{",
"return",
"syslogPriorities",
"[",
"strings",
".",
"ToLower",
"(",
"s",
".",
"<mask>",
"(",
")",
")",
"]",
"\n",
"}"
] |
22,471 | all-22472 | [
"cephRBDGenerateUUID",
"regenerates",
"the",
"XFS",
"/",
"btrfs",
"UUID",
"as",
"needed"
] | [
"func",
"(",
"s",
"*",
"storageCeph",
")",
"cephRBDGenerateUUID",
"(",
"volumeName",
"string",
",",
"volumeType",
"string",
")",
"error",
"{",
"// Map the RBD volume",
"RBDDevPath",
",",
"err",
":=",
"cephRBDVolumeMap",
"(",
"s",
".",
"ClusterName",
",",
"s",
".",
"OSDPoolName",
",",
"volumeName",
",",
"volumeType",
",",
"s",
".",
"UserName",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"defer",
"cephRBDVolumeUnmap",
"(",
"s",
".",
"ClusterName",
",",
"s",
".",
"OSDPoolName",
",",
"volumeName",
",",
"volumeType",
",",
"s",
".",
"UserName",
",",
"<mask>",
")",
"\n\n",
"// Update the UUID",
"msg",
",",
"err",
":=",
"fsGenerateNewUUID",
"(",
"s",
".",
"getRBDFilesystem",
"(",
")",
",",
"RBDDevPath",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"volumeName",
",",
"err",
",",
"msg",
")",
"\n",
"}",
"\n\n",
"return",
"nil",
"\n",
"}"
] |
22,472 | all-22473 | [
"Value",
"converts",
"a",
"value",
"to",
"a",
"database",
"driver",
"value"
] | [
"func",
"(",
"u",
"UUID4",
")",
"Value",
"(",
")",
"(",
"<mask>",
".",
"Value",
",",
"error",
")",
"{",
"return",
"driver",
".",
"Value",
"(",
"string",
"(",
"u",
")",
")",
",",
"nil",
"\n",
"}"
] |
22,473 | all-22474 | [
"Release",
"removes",
"the",
"directory",
"lock",
"."
] | [
"func",
"(",
"g",
"*",
"directoryLockGuard",
")",
"<mask>",
"(",
")",
"error",
"{",
"g",
".",
"path",
"=",
"\"",
"\"",
"\n",
"return",
"syscall",
".",
"CloseHandle",
"(",
"g",
".",
"h",
")",
"\n",
"}"
] |
22,474 | all-22475 | [
"NewRotatingFileHandler",
"creates",
"a",
"RotatingFileHandler"
] | [
"func",
"NewRotatingFileHandler",
"(",
"fileName",
"string",
",",
"maxBytes",
"int",
",",
"backupCount",
"int",
")",
"(",
"*",
"RotatingFileHandler",
",",
"error",
")",
"{",
"dir",
":=",
"<mask>",
".",
"Dir",
"(",
"fileName",
")",
"\n",
"os",
".",
"MkdirAll",
"(",
"dir",
",",
"0777",
")",
"\n\n",
"h",
":=",
"new",
"(",
"RotatingFileHandler",
")",
"\n\n",
"if",
"maxBytes",
"<=",
"0",
"{",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"h",
".",
"fileName",
"=",
"fileName",
"\n",
"h",
".",
"maxBytes",
"=",
"maxBytes",
"\n",
"h",
".",
"backupCount",
"=",
"backupCount",
"\n\n",
"var",
"err",
"error",
"\n",
"h",
".",
"fd",
",",
"err",
"=",
"os",
".",
"OpenFile",
"(",
"fileName",
",",
"os",
".",
"O_CREATE",
"|",
"os",
".",
"O_WRONLY",
"|",
"os",
".",
"O_APPEND",
",",
"0666",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"f",
",",
"err",
":=",
"h",
".",
"fd",
".",
"Stat",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"h",
".",
"curBytes",
"=",
"int",
"(",
"f",
".",
"Size",
"(",
")",
")",
"\n\n",
"return",
"h",
",",
"nil",
"\n",
"}"
] |
22,475 | all-22476 | [
"DependenciesAreResolved",
"validates",
"that",
"the",
"target",
"container",
"can",
"be",
"transitioned",
"given",
"the",
"current",
"known",
"state",
"of",
"the",
"containers",
"in",
"by",
".",
"If",
"this",
"function",
"returns",
"true",
"target",
"should",
"be",
"technically",
"able",
"to",
"launch",
"without",
"issues",
".",
"Transitions",
"are",
"between",
"known",
"statuses",
"(",
"whether",
"the",
"container",
"can",
"move",
"to",
"the",
"next",
"known",
"status",
")",
"not",
"desired",
"statuses",
";",
"the",
"desired",
"status",
"typically",
"is",
"either",
"RUNNING",
"or",
"STOPPED",
"."
] | [
"func",
"DependenciesAreResolved",
"(",
"target",
"*",
"apicontainer",
".",
"Container",
",",
"by",
"[",
"]",
"*",
"apicontainer",
".",
"Container",
",",
"id",
"string",
",",
"manager",
"credentials",
".",
"Manager",
",",
"resources",
"[",
"]",
"taskresource",
".",
"TaskResource",
")",
"(",
"*",
"apicontainer",
".",
"DependsOn",
",",
"error",
")",
"{",
"if",
"!",
"executionCredentialsResolved",
"(",
"target",
",",
"id",
",",
"manager",
")",
"{",
"return",
"nil",
",",
"CredentialsNotResolvedErr",
"\n",
"}",
"\n\n",
"nameMap",
":=",
"make",
"(",
"map",
"[",
"string",
"]",
"*",
"apicontainer",
".",
"Container",
")",
"\n",
"for",
"_",
",",
"cont",
":=",
"range",
"by",
"{",
"nameMap",
"[",
"cont",
".",
"Name",
"]",
"=",
"cont",
"\n",
"}",
"\n",
"neededVolumeContainers",
":=",
"make",
"(",
"[",
"]",
"string",
",",
"len",
"(",
"target",
".",
"VolumesFrom",
")",
")",
"\n",
"for",
"i",
",",
"volume",
":=",
"range",
"target",
".",
"VolumesFrom",
"{",
"neededVolumeContainers",
"[",
"i",
"]",
"=",
"volume",
".",
"SourceContainer",
"\n",
"}",
"\n\n",
"resourcesMap",
":=",
"make",
"(",
"map",
"[",
"string",
"]",
"taskresource",
".",
"TaskResource",
")",
"\n",
"for",
"_",
",",
"resource",
":=",
"range",
"resources",
"{",
"resourcesMap",
"[",
"resource",
".",
"GetName",
"(",
")",
"]",
"=",
"<mask>",
"\n",
"}",
"\n\n",
"if",
"blocked",
",",
"err",
":=",
"verifyContainerOrderingStatusResolvable",
"(",
"target",
",",
"nameMap",
",",
"containerOrderingDependenciesIsResolved",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"blocked",
",",
"err",
"\n",
"}",
"\n\n",
"if",
"!",
"verifyStatusResolvable",
"(",
"target",
",",
"nameMap",
",",
"target",
".",
"SteadyStateDependencies",
",",
"onSteadyStateIsResolved",
")",
"{",
"return",
"nil",
",",
"DependentContainerNotResolvedErr",
"\n",
"}",
"\n",
"if",
"err",
":=",
"verifyTransitionDependenciesResolved",
"(",
"target",
",",
"nameMap",
",",
"resourcesMap",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"// If the target is desired terminal and isn't stopped, we should validate that it doesn't have any containers",
"// that are dependent on it that need to shut down first.",
"if",
"target",
".",
"DesiredTerminal",
"(",
")",
"&&",
"!",
"target",
".",
"KnownTerminal",
"(",
")",
"{",
"if",
"err",
":=",
"verifyShutdownOrder",
"(",
"target",
",",
"nameMap",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"}",
"\n\n",
"return",
"nil",
",",
"nil",
"\n",
"}"
] |
22,476 | all-22477 | [
"UnmarshalJSON",
"supports",
"json",
".",
"Unmarshaler",
"interface"
] | [
"func",
"(",
"v",
"*",
"StopSamplingReturns",
")",
"UnmarshalJSON",
"(",
"data",
"[",
"]",
"byte",
")",
"error",
"{",
"r",
":=",
"jlexer",
".",
"Lexer",
"{",
"Data",
":",
"data",
"}",
"\n",
"easyjsonC5a4559bDecodeGithubComChromedpCdprotoHeapprofiler2",
"(",
"&",
"r",
",",
"v",
")",
"\n",
"return",
"r",
".",
"<mask>",
"(",
")",
"\n",
"}"
] |
22,477 | all-22478 | [
"UnmarshalJSON",
"supports",
"json",
".",
"Unmarshaler",
"interface"
] | [
"func",
"(",
"v",
"*",
"EventStyleSheetRemoved",
")",
"UnmarshalJSON",
"(",
"data",
"[",
"]",
"byte",
")",
"error",
"{",
"r",
":=",
"jlexer",
".",
"Lexer",
"{",
"Data",
":",
"data",
"}",
"\n",
"easyjsonC5a4559bDecodeGithubComChromedpCdprotoCss51",
"(",
"&",
"r",
",",
"v",
")",
"\n",
"return",
"r",
".",
"<mask>",
"(",
")",
"\n",
"}"
] |
22,478 | all-22479 | [
"SignBytes",
"creates",
"a",
"signature",
"for",
"buf",
"."
] | [
"func",
"(",
"hs",
"*",
"HmacSigner",
")",
"SignBytes",
"(",
"buf",
"[",
"]",
"byte",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"var",
"err",
"error",
"\n\n",
"// check hs.key",
"if",
"hs",
".",
"key",
"==",
"nil",
"{",
"return",
"nil",
",",
"ErrMissingPrivateKey",
"\n",
"}",
"\n\n",
"// hash",
"h",
":=",
"hmac",
".",
"New",
"(",
"hs",
".",
"hash",
".",
"New",
",",
"hs",
".",
"<mask>",
")",
"\n",
"_",
",",
"err",
"=",
"h",
".",
"Write",
"(",
"buf",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"return",
"h",
".",
"Sum",
"(",
"nil",
")",
",",
"nil",
"\n",
"}"
] |
22,479 | all-22480 | [
"GetTitleOk",
"returns",
"a",
"tuple",
"with",
"the",
"Title",
"field",
"if",
"it",
"s",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"and",
"a",
"boolean",
"to",
"check",
"if",
"the",
"value",
"has",
"been",
"set",
"."
] | [
"func",
"(",
"w",
"*",
"Widget",
")",
"GetTitleOk",
"(",
")",
"(",
"bool",
",",
"bool",
")",
"{",
"if",
"w",
"==",
"nil",
"||",
"w",
".",
"Title",
"==",
"nil",
"{",
"return",
"false",
",",
"false",
"\n",
"}",
"\n",
"return",
"*",
"w",
".",
"Title",
",",
"<mask>",
"\n",
"}"
] |
22,480 | all-22481 | [
"UpdateAccount",
"updates",
"passed",
"account",
"."
] | [
"func",
"(",
"a",
"*",
"API",
")",
"UpdateAccount",
"(",
"cfg",
"*",
"Account",
")",
"(",
"*",
"Account",
",",
"error",
")",
"{",
"if",
"cfg",
"==",
"nil",
"{",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"accountCID",
":=",
"string",
"(",
"cfg",
".",
"CID",
")",
"\n\n",
"matched",
",",
"err",
":=",
"regexp",
".",
"MatchString",
"(",
"config",
".",
"AccountCIDRegex",
",",
"accountCID",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"if",
"!",
"<mask>",
"{",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"accountCID",
")",
"\n",
"}",
"\n\n",
"jsonCfg",
",",
"err",
":=",
"json",
".",
"Marshal",
"(",
"cfg",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"if",
"a",
".",
"Debug",
"{",
"a",
".",
"Log",
".",
"Printf",
"(",
"\"",
"\"",
",",
"string",
"(",
"jsonCfg",
")",
")",
"\n",
"}",
"\n\n",
"result",
",",
"err",
":=",
"a",
".",
"Put",
"(",
"accountCID",
",",
"jsonCfg",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"account",
":=",
"&",
"Account",
"{",
"}",
"\n",
"if",
"err",
":=",
"json",
".",
"Unmarshal",
"(",
"result",
",",
"account",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"return",
"account",
",",
"nil",
"\n",
"}"
] |
22,481 | all-22482 | [
"MarshalJSON",
"supports",
"json",
".",
"Marshaler",
"interface"
] | [
"func",
"(",
"v",
"CompositingReasonsParams",
")",
"MarshalJSON",
"(",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"w",
":=",
"jwriter",
".",
"<mask>",
"{",
"}",
"\n",
"easyjsonC5a4559bEncodeGithubComChromedpCdprotoLayertree20",
"(",
"&",
"w",
",",
"v",
")",
"\n",
"return",
"w",
".",
"Buffer",
".",
"BuildBytes",
"(",
")",
",",
"w",
".",
"Error",
"\n",
"}"
] |
22,482 | all-22483 | [
"Debug",
"logging"
] | [
"func",
"(",
"l",
"*",
"StdLevelLogger",
")",
"Debug",
"(",
"args",
"...",
"<mask>",
"{",
"}",
")",
"{",
"l",
".",
"logFunc",
"(",
"DebugLevel",
",",
"l",
".",
"context",
",",
"args",
"...",
")",
"\n",
"}"
] |
22,483 | all-22484 | [
"/",
"*",
"Identify",
"an",
"error",
"that",
"occurred",
"during",
"the",
"transaction",
".",
"The",
"first",
"identified",
"error",
"is",
"sent",
"with",
"each",
"transaction",
"."
] | [
"func",
"TransactionNoticeError",
"(",
"id",
"int64",
",",
"exceptionType",
",",
"errorMessage",
",",
"stackTrace",
",",
"stackFrameDelim",
"string",
")",
"(",
"int",
",",
"error",
")",
"{",
"cexceptionType",
":=",
"C",
".",
"CString",
"(",
"exceptionType",
")",
"\n",
"defer",
"C",
".",
"free",
"(",
"unsafe",
".",
"Pointer",
"(",
"cexceptionType",
")",
")",
"\n\n",
"cerrorMessage",
":=",
"C",
".",
"CString",
"(",
"errorMessage",
")",
"\n",
"defer",
"C",
".",
"<mask>",
"(",
"unsafe",
".",
"Pointer",
"(",
"cerrorMessage",
")",
")",
"\n\n",
"cstackTrace",
":=",
"C",
".",
"CString",
"(",
"stackTrace",
")",
"\n",
"defer",
"C",
".",
"free",
"(",
"unsafe",
".",
"Pointer",
"(",
"cstackTrace",
")",
")",
"\n\n",
"cstackFrameDelim",
":=",
"C",
".",
"CString",
"(",
"stackFrameDelim",
")",
"\n",
"defer",
"C",
".",
"free",
"(",
"unsafe",
".",
"Pointer",
"(",
"cstackFrameDelim",
")",
")",
"\n\n",
"return",
"errNo",
"(",
"C",
".",
"newrelic_transaction_notice_error",
"(",
"C",
".",
"long",
"(",
"id",
")",
",",
"cexceptionType",
",",
"cerrorMessage",
",",
"cstackTrace",
",",
"cstackFrameDelim",
")",
")",
"\n",
"}"
] |
22,484 | all-22485 | [
"Size",
"returns",
"r",
"s",
"width",
"height",
"and",
"depth",
"."
] | [
"func",
"(",
"r",
"Rectangle",
")",
"Size",
"(",
")",
"Vec3",
"{",
"<mask>",
"Vec3",
"{",
"r",
".",
"Max",
"[",
"0",
"]",
"-",
"r",
".",
"Min",
"[",
"0",
"]",
",",
"r",
".",
"Max",
"[",
"1",
"]",
"-",
"r",
".",
"Min",
"[",
"1",
"]",
",",
"r",
".",
"Max",
"[",
"2",
"]",
"-",
"r",
".",
"Min",
"[",
"2",
"]",
",",
"}",
"\n",
"}"
] |
22,485 | all-22486 | [
"DrawScrollBar",
"displays",
"a",
"scrollbar",
".",
"pos",
"is",
"the",
"position",
"of",
"the",
"thumb",
".",
"The",
"function",
"detects",
"direction",
"of",
"the",
"scrollbar",
"automatically",
":",
"if",
"w",
"is",
"greater",
"than",
"h",
"then",
"it",
"draws",
"horizontal",
"scrollbar",
"and",
"vertical",
"otherwise"
] | [
"func",
"DrawScrollBar",
"(",
"x",
",",
"y",
",",
"w",
",",
"h",
",",
"<mask>",
"int",
")",
"{",
"xx",
",",
"yy",
",",
"ww",
",",
"hh",
":=",
"clip",
"(",
"x",
",",
"y",
",",
"w",
",",
"h",
")",
"\n",
"if",
"ww",
"<",
"1",
"||",
"hh",
"<",
"1",
"{",
"return",
"\n",
"}",
"\n\n",
"PushAttributes",
"(",
")",
"\n",
"defer",
"PopAttributes",
"(",
")",
"\n\n",
"fg",
",",
"bg",
":=",
"RealColor",
"(",
"ColorDefault",
",",
"\"",
"\"",
",",
"ColorScrollText",
")",
",",
"RealColor",
"(",
"ColorDefault",
",",
"\"",
"\"",
",",
"ColorScrollBack",
")",
"\n",
"// TODO: add thumb styling",
"// fgThumb, bgThumb := RealColor(ColorDefault, \"\", ColorThumbText), RealColor(ColorDefault, \"\", ColorThumbBack)",
"SetTextColor",
"(",
"fg",
")",
"\n",
"SetBackColor",
"(",
"bg",
")",
"\n\n",
"parts",
":=",
"[",
"]",
"rune",
"(",
"SysObject",
"(",
"ObjScrollBar",
")",
")",
"\n",
"chLine",
",",
"chThumb",
",",
"chUp",
",",
"chDown",
":=",
"parts",
"[",
"0",
"]",
",",
"parts",
"[",
"1",
"]",
",",
"parts",
"[",
"2",
"]",
",",
"parts",
"[",
"3",
"]",
"\n",
"chLeft",
",",
"chRight",
":=",
"parts",
"[",
"4",
"]",
",",
"parts",
"[",
"5",
"]",
"\n\n",
"chStart",
",",
"chEnd",
":=",
"chUp",
",",
"chDown",
"\n",
"var",
"dx",
",",
"dy",
"int",
"\n",
"if",
"w",
">",
"h",
"{",
"chStart",
",",
"chEnd",
"=",
"chLeft",
",",
"chRight",
"\n",
"dx",
"=",
"w",
"-",
"1",
"\n",
"dy",
"=",
"0",
"\n",
"}",
"else",
"{",
"dx",
"=",
"0",
"\n",
"dy",
"=",
"h",
"-",
"1",
"\n",
"}",
"\n\n",
"if",
"InClipRect",
"(",
"x",
",",
"y",
")",
"{",
"putCharUnsafe",
"(",
"x",
",",
"y",
",",
"chStart",
")",
"\n",
"}",
"\n",
"if",
"InClipRect",
"(",
"x",
"+",
"dx",
",",
"y",
"+",
"dy",
")",
"{",
"putCharUnsafe",
"(",
"x",
"+",
"dx",
",",
"y",
"+",
"dy",
",",
"chEnd",
")",
"\n",
"}",
"\n",
"if",
"xx",
"==",
"x",
"&&",
"w",
">",
"h",
"{",
"xx",
"=",
"x",
"+",
"1",
"\n",
"ww",
"--",
"\n",
"}",
"\n",
"if",
"yy",
"==",
"y",
"&&",
"w",
"<",
"h",
"{",
"yy",
"=",
"y",
"+",
"1",
"\n",
"hh",
"--",
"\n",
"}",
"\n",
"if",
"xx",
"+",
"ww",
"==",
"x",
"+",
"w",
"&&",
"w",
">",
"h",
"{",
"ww",
"--",
"\n",
"}",
"\n",
"if",
"yy",
"+",
"hh",
"==",
"y",
"+",
"h",
"&&",
"w",
"<",
"h",
"{",
"hh",
"--",
"\n",
"}",
"\n\n",
"if",
"w",
">",
"h",
"{",
"DrawHorizontalLine",
"(",
"xx",
",",
"yy",
",",
"ww",
",",
"chLine",
")",
"\n",
"}",
"else",
"{",
"DrawVerticalLine",
"(",
"xx",
",",
"yy",
",",
"hh",
",",
"chLine",
")",
"\n",
"}",
"\n\n",
"if",
"pos",
">=",
"0",
"{",
"if",
"w",
">",
"h",
"{",
"if",
"pos",
"<",
"w",
"-",
"2",
"&&",
"InClipRect",
"(",
"x",
"+",
"1",
"+",
"pos",
",",
"y",
")",
"{",
"putCharUnsafe",
"(",
"x",
"+",
"1",
"+",
"pos",
",",
"y",
",",
"chThumb",
")",
"\n",
"}",
"\n",
"}",
"else",
"{",
"if",
"pos",
"<",
"h",
"-",
"2",
"&&",
"InClipRect",
"(",
"x",
",",
"y",
"+",
"1",
"+",
"pos",
")",
"{",
"putCharUnsafe",
"(",
"x",
",",
"y",
"+",
"1",
"+",
"pos",
",",
"chThumb",
")",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n",
"}"
] |
22,486 | all-22487 | [
"Callback",
"returns",
"a",
"callback",
"that",
"can",
"be",
"used",
"in",
"controllers",
"to",
"protect",
"resources",
"by",
"requiring",
"an",
"access",
"token",
"with",
"the",
"provided",
"scope",
"to",
"be",
"granted",
".",
"Note",
":",
"The",
"callback",
"requires",
"that",
"the",
"request",
"has",
"already",
"been",
"authorized",
"using",
"the",
"Authorizer",
"middleware",
"from",
"an",
"Authenticator",
"."
] | [
"func",
"Callback",
"(",
"force",
"bool",
",",
"scope",
"...",
"string",
")",
"*",
"fire",
".",
"Callback",
"{",
"return",
"fire",
".",
"C",
"(",
"\"",
"\"",
",",
"fire",
".",
"All",
"(",
")",
",",
"func",
"(",
"ctx",
"*",
"fire",
".",
"Context",
")",
"error",
"{",
"// coerce scope",
"s",
":=",
"oauth2",
".",
"Scope",
"(",
"scope",
")",
"\n\n",
"// get access token",
"accessToken",
",",
"_",
":=",
"ctx",
".",
"HTTPRequest",
".",
"Context",
"(",
")",
".",
"Value",
"(",
"AccessTokenContextKey",
")",
".",
"(",
"GenericToken",
")",
"\n\n",
"// check access token",
"if",
"accessToken",
"==",
"nil",
"{",
"// return error if authentication is required",
"if",
"force",
"{",
"return",
"fire",
".",
"ErrAccessDenied",
"\n",
"}",
"\n\n",
"return",
"nil",
"\n",
"}",
"\n\n",
"// validate scope",
"_",
",",
"scope",
",",
"_",
",",
"_",
",",
"_",
":=",
"accessToken",
".",
"GetTokenData",
"(",
")",
"\n",
"if",
"!",
"oauth2",
".",
"Scope",
"(",
"scope",
")",
".",
"Includes",
"(",
"s",
")",
"{",
"return",
"fire",
".",
"ErrAccessDenied",
"\n",
"}",
"\n\n",
"// get client",
"client",
":=",
"ctx",
".",
"HTTPRequest",
".",
"Context",
"(",
")",
".",
"Value",
"(",
"ClientContextKey",
")",
".",
"(",
"<mask>",
")",
"\n\n",
"// get resource owner",
"resourceOwner",
",",
"_",
":=",
"ctx",
".",
"HTTPRequest",
".",
"Context",
"(",
")",
".",
"Value",
"(",
"ResourceOwnerContextKey",
")",
".",
"(",
"ResourceOwner",
")",
"\n\n",
"// store auth info",
"ctx",
".",
"Data",
"[",
"AuthInfoDataKey",
"]",
"=",
"&",
"AuthInfo",
"{",
"Client",
":",
"client",
",",
"ResourceOwner",
":",
"resourceOwner",
",",
"AccessToken",
":",
"accessToken",
",",
"}",
"\n\n",
"return",
"nil",
"\n",
"}",
")",
"\n",
"}"
] |
22,487 | all-22488 | [
"MarshalJSON",
"supports",
"json",
".",
"Marshaler",
"interface"
] | [
"func",
"(",
"v",
"UnregisterParams",
")",
"MarshalJSON",
"(",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"w",
":=",
"jwriter",
".",
"Writer",
"{",
"}",
"\n",
"easyjsonC5a4559bEncodeGithubComChromedpCdprotoServiceworker2",
"(",
"&",
"w",
",",
"v",
")",
"\n",
"return",
"w",
".",
"<mask>",
".",
"BuildBytes",
"(",
")",
",",
"w",
".",
"Error",
"\n",
"}"
] |
22,488 | all-22489 | [
"CDDVD",
"returns",
"the",
"CD",
"/",
"DVD",
"drive",
"identified",
"by",
"ID",
".",
"This",
"function",
"depends",
"entirely",
"on",
"how",
"GoVMX",
"identifies",
"slice",
"s",
"elements"
] | [
"func",
"(",
"v",
"*",
"VM",
")",
"CDDVD",
"(",
"ID",
"string",
")",
"(",
"*",
"CDDVDDrive",
",",
"error",
")",
"{",
"err",
":=",
"v",
".",
"vmxfile",
".",
"Read",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"model",
":=",
"v",
".",
"vmxfile",
".",
"model",
"\n",
"bus",
":=",
"BusTypeFromID",
"(",
"ID",
")",
"\n\n",
"var",
"filename",
"string",
"\n",
"found",
":=",
"model",
".",
"FindDevice",
"(",
"func",
"(",
"d",
"vmx",
".",
"Device",
")",
"bool",
"{",
"if",
"ID",
"==",
"d",
".",
"VMXID",
"{",
"filename",
"=",
"d",
".",
"Filename",
"\n",
"}",
"\n",
"return",
"ID",
"==",
"d",
".",
"VMXID",
"\n",
"}",
",",
"bus",
")",
"\n\n",
"if",
"!",
"<mask>",
"{",
"return",
"nil",
",",
"nil",
"\n",
"}",
"\n\n",
"return",
"&",
"CDDVDDrive",
"{",
"Bus",
":",
"bus",
",",
"Filename",
":",
"filename",
"}",
",",
"nil",
"\n",
"}"
] |
22,489 | all-22490 | [
"MutateTransaction",
"for",
"ManageDataBuilder",
"causes",
"the",
"underylying",
"ManageData",
"to",
"be",
"added",
"to",
"the",
"operation",
"list",
"for",
"the",
"provided",
"transaction"
] | [
"func",
"(",
"m",
"ManageDataBuilder",
")",
"MutateTransaction",
"(",
"o",
"*",
"TransactionBuilder",
")",
"error",
"{",
"if",
"m",
".",
"Err",
"!=",
"nil",
"{",
"return",
"m",
".",
"Err",
"\n",
"}",
"\n\n",
"m",
".",
"O",
".",
"<mask>",
",",
"m",
".",
"Err",
"=",
"xdr",
".",
"NewOperationBody",
"(",
"xdr",
".",
"OperationTypeManageData",
",",
"m",
".",
"MD",
")",
"\n",
"o",
".",
"TX",
".",
"Operations",
"=",
"append",
"(",
"o",
".",
"TX",
".",
"Operations",
",",
"m",
".",
"O",
")",
"\n",
"return",
"m",
".",
"Err",
"\n",
"}"
] |
22,490 | all-22491 | [
"ListBoxNew",
"is",
"a",
"wrapper",
"around",
"gtk_list_box_new",
"()",
"."
] | [
"func",
"ListBoxNew",
"(",
")",
"(",
"*",
"ListBox",
",",
"<mask>",
")",
"{",
"c",
":=",
"C",
".",
"gtk_list_box_new",
"(",
")",
"\n",
"if",
"c",
"==",
"nil",
"{",
"return",
"nil",
",",
"nilPtrErr",
"\n",
"}",
"\n",
"return",
"wrapListBox",
"(",
"glib",
".",
"Take",
"(",
"unsafe",
".",
"Pointer",
"(",
"c",
")",
")",
")",
",",
"nil",
"\n",
"}"
] |
22,491 | all-22492 | [
"==",
"Lookup",
"lookUp",
"parses",
"the",
"user",
"line",
"searching",
"a",
"value",
"into",
"the",
"field",
".",
"Returns",
"nil",
"if",
"is",
"not",
"found",
"."
] | [
"func",
"(",
"*",
"User",
")",
"lookUp",
"(",
"line",
"string",
",",
"f",
"field",
",",
"value",
"interface",
"{",
"}",
")",
"interface",
"{",
"}",
"{",
"_field",
":=",
"f",
".",
"(",
"userField",
")",
"\n",
"allField",
":=",
"strings",
".",
"Split",
"(",
"line",
",",
"\"",
"\"",
")",
"\n",
"intField",
":=",
"make",
"(",
"map",
"[",
"int",
"]",
"int",
")",
"\n\n",
"// Check integers",
"var",
"err",
"error",
"\n",
"if",
"intField",
"[",
"2",
"]",
",",
"err",
"=",
"strconv",
".",
"Atoi",
"(",
"allField",
"[",
"2",
"]",
")",
";",
"err",
"!=",
"nil",
"{",
"panic",
"(",
"atoiError",
"{",
"_USER_FILE",
",",
"line",
",",
"\"",
"\"",
"}",
")",
"\n",
"}",
"\n",
"if",
"intField",
"[",
"3",
"]",
",",
"err",
"=",
"strconv",
".",
"Atoi",
"(",
"allField",
"[",
"3",
"]",
")",
";",
"err",
"!=",
"nil",
"{",
"panic",
"(",
"atoiError",
"{",
"_USER_FILE",
",",
"line",
",",
"\"",
"\"",
"}",
")",
"\n",
"}",
"\n\n",
"// Check fields",
"var",
"isField",
"bool",
"\n",
"if",
"U_NAME",
"&",
"_field",
"!=",
"0",
"&&",
"allField",
"[",
"0",
"]",
"==",
"value",
".",
"(",
"string",
")",
"{",
"isField",
"=",
"<mask>",
"\n",
"}",
"else",
"if",
"U_PASSWD",
"&",
"_field",
"!=",
"0",
"&&",
"allField",
"[",
"1",
"]",
"==",
"value",
".",
"(",
"string",
")",
"{",
"isField",
"=",
"true",
"\n",
"}",
"else",
"if",
"U_UID",
"&",
"_field",
"!=",
"0",
"&&",
"intField",
"[",
"2",
"]",
"==",
"value",
".",
"(",
"int",
")",
"{",
"isField",
"=",
"true",
"\n",
"}",
"else",
"if",
"U_GID",
"&",
"_field",
"!=",
"0",
"&&",
"intField",
"[",
"3",
"]",
"==",
"value",
".",
"(",
"int",
")",
"{",
"isField",
"=",
"true",
"\n",
"}",
"else",
"if",
"U_GECOS",
"&",
"_field",
"!=",
"0",
"&&",
"allField",
"[",
"4",
"]",
"==",
"value",
".",
"(",
"string",
")",
"{",
"isField",
"=",
"true",
"\n",
"}",
"else",
"if",
"U_DIR",
"&",
"_field",
"!=",
"0",
"&&",
"allField",
"[",
"5",
"]",
"==",
"value",
".",
"(",
"string",
")",
"{",
"isField",
"=",
"true",
"\n",
"}",
"else",
"if",
"U_SHELL",
"&",
"_field",
"!=",
"0",
"&&",
"allField",
"[",
"6",
"]",
"==",
"value",
".",
"(",
"string",
")",
"{",
"isField",
"=",
"true",
"\n",
"}",
"else",
"if",
"U_ALL",
"&",
"_field",
"!=",
"0",
"{",
"isField",
"=",
"true",
"\n",
"}",
"\n\n",
"if",
"isField",
"{",
"return",
"&",
"User",
"{",
"Name",
":",
"allField",
"[",
"0",
"]",
",",
"password",
":",
"allField",
"[",
"1",
"]",
",",
"UID",
":",
"intField",
"[",
"2",
"]",
",",
"GID",
":",
"intField",
"[",
"3",
"]",
",",
"Gecos",
":",
"allField",
"[",
"4",
"]",
",",
"Dir",
":",
"allField",
"[",
"5",
"]",
",",
"Shell",
":",
"allField",
"[",
"6",
"]",
",",
"}",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
] |
22,492 | all-22493 | [
"HasProjectID",
"returns",
"a",
"boolean",
"if",
"a",
"field",
"has",
"been",
"set",
"."
] | [
"func",
"(",
"i",
"*",
"IntegrationGCPUpdateRequest",
")",
"HasProjectID",
"(",
")",
"bool",
"{",
"if",
"i",
"!=",
"nil",
"&&",
"i",
".",
"ProjectID",
"!=",
"nil",
"{",
"return",
"true",
"\n",
"}",
"\n\n",
"return",
"<mask>",
"\n",
"}"
] |
22,493 | all-22494 | [
"NextSequence",
"returns",
"an",
"autoincrementing",
"integer",
"for",
"the",
"bucket",
"."
] | [
"func",
"(",
"b",
"Bucket",
")",
"NextSequence",
"(",
")",
"(",
"uint64",
",",
"error",
")",
"{",
"s",
",",
"err",
":=",
"b",
".",
"Bucket",
".",
"NextSequence",
"(",
")",
"\n",
"<mask>",
"s",
",",
"errorsp",
".",
"WithStacks",
"(",
"err",
")",
"\n",
"}"
] |
22,494 | all-22495 | [
"GetMetricOk",
"returns",
"a",
"tuple",
"with",
"the",
"Metric",
"field",
"if",
"it",
"s",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"and",
"a",
"boolean",
"to",
"check",
"if",
"the",
"value",
"has",
"been",
"set",
"."
] | [
"func",
"(",
"m",
"*",
"Metric",
")",
"GetMetricOk",
"(",
")",
"(",
"string",
",",
"bool",
")",
"{",
"if",
"m",
"==",
"nil",
"||",
"m",
".",
"Metric",
"==",
"nil",
"{",
"return",
"\"",
"\"",
",",
"<mask>",
"\n",
"}",
"\n",
"return",
"*",
"m",
".",
"Metric",
",",
"true",
"\n",
"}"
] |
22,495 | all-22496 | [
"PutBlob",
"writes",
"contents",
"of",
"stream",
"and",
"returns",
"data",
"representing",
"the",
"result",
".",
"inputInfo",
".",
"Digest",
"can",
"be",
"optionally",
"provided",
"if",
"known",
";",
"it",
"is",
"not",
"mandatory",
"for",
"the",
"implementation",
"to",
"verify",
"it",
".",
"inputInfo",
".",
"Size",
"is",
"the",
"expected",
"length",
"of",
"stream",
"if",
"known",
".",
"inputInfo",
".",
"MediaType",
"describes",
"the",
"blob",
"format",
"if",
"known",
".",
"May",
"update",
"cache",
".",
"WARNING",
":",
"The",
"contents",
"of",
"stream",
"are",
"being",
"verified",
"on",
"the",
"fly",
".",
"Until",
"stream",
".",
"Read",
"()",
"returns",
"io",
".",
"EOF",
"the",
"contents",
"of",
"the",
"data",
"SHOULD",
"NOT",
"be",
"available",
"to",
"any",
"other",
"readers",
"for",
"download",
"using",
"the",
"supplied",
"digest",
".",
"If",
"stream",
".",
"Read",
"()",
"at",
"any",
"time",
"ESPECIALLY",
"at",
"end",
"of",
"input",
"returns",
"an",
"error",
"PutBlob",
"MUST",
"1",
")",
"fail",
"and",
"2",
")",
"delete",
"any",
"data",
"stored",
"so",
"far",
"."
] | [
"func",
"(",
"d",
"*",
"ociArchiveImageDestination",
")",
"PutBlob",
"(",
"ctx",
"<mask>",
".",
"Context",
",",
"stream",
"io",
".",
"Reader",
",",
"inputInfo",
"types",
".",
"BlobInfo",
",",
"cache",
"types",
".",
"BlobInfoCache",
",",
"isConfig",
"bool",
")",
"(",
"types",
".",
"BlobInfo",
",",
"error",
")",
"{",
"return",
"d",
".",
"unpackedDest",
".",
"PutBlob",
"(",
"ctx",
",",
"stream",
",",
"inputInfo",
",",
"cache",
",",
"isConfig",
")",
"\n",
"}"
] |
22,496 | all-22497 | [
"Given",
"possibly",
"non",
"-",
"matched",
"pair",
"of",
"things",
"to",
"perform",
"arithmetic",
"operations",
"on",
"align",
"their",
"types",
"so",
"that",
"the",
"given",
"operation",
"can",
"be",
"performed",
"correctly",
".",
"e",
".",
"g",
".",
"given",
"int",
"float",
"we",
"align",
"them",
"to",
"float",
"float"
] | [
"func",
"alignTypesForArithmetic",
"(",
"left",
",",
"right",
"interface",
"{",
"}",
")",
"(",
"reflect",
".",
"Value",
",",
"reflect",
".",
"Value",
")",
"{",
"// These avoid crashes for accessing nil interfaces",
"if",
"left",
"==",
"nil",
"{",
"left",
"=",
"0",
"\n",
"}",
"\n",
"if",
"right",
"==",
"nil",
"{",
"right",
"=",
"0",
"\n",
"}",
"\n\n",
"leftV",
":=",
"interfaceToNumeric",
"(",
"left",
")",
"\n",
"rightV",
":=",
"interfaceToNumeric",
"(",
"right",
")",
"\n\n",
"if",
"leftV",
".",
"Kind",
"(",
")",
"==",
"rightV",
".",
"Kind",
"(",
")",
"{",
"return",
"leftV",
",",
"rightV",
"\n",
"}",
"\n\n",
"<mask>",
"alignTo",
"reflect",
".",
"Type",
"\n",
"if",
"leftV",
".",
"Kind",
"(",
")",
">",
"rightV",
".",
"Kind",
"(",
")",
"{",
"alignTo",
"=",
"leftV",
".",
"Type",
"(",
")",
"\n",
"}",
"else",
"{",
"alignTo",
"=",
"rightV",
".",
"Type",
"(",
")",
"\n",
"}",
"\n\n",
"return",
"leftV",
".",
"Convert",
"(",
"alignTo",
")",
",",
"rightV",
".",
"Convert",
"(",
"alignTo",
")",
"\n",
"}"
] |
22,497 | all-22498 | [
"serve",
"starts",
"a",
"http",
"server",
"and",
"serves",
"Jenkins",
"logs",
"and",
"prometheus",
"metrics",
".",
"Meant",
"to",
"be",
"called",
"inside",
"a",
"goroutine",
"."
] | [
"func",
"serve",
"(",
"jc",
"*",
"jenkins",
".",
"Client",
")",
"{",
"http",
".",
"Handle",
"(",
"\"",
"\"",
",",
"gziphandler",
".",
"GzipHandler",
"(",
"handleLog",
"(",
"jc",
")",
")",
")",
"\n",
"<mask>",
".",
"Handle",
"(",
"\"",
"\"",
",",
"promhttp",
".",
"Handler",
"(",
")",
")",
"\n",
"logrus",
".",
"WithError",
"(",
"http",
".",
"ListenAndServe",
"(",
"\"",
"\"",
",",
"nil",
")",
")",
".",
"Fatal",
"(",
"\"",
"\"",
")",
"\n",
"}"
] |
22,498 | all-22499 | [
"Leader",
"returns",
"the",
"node",
"that",
"is",
"currently",
"the",
"Leader",
"if",
"there",
"is",
"no",
"leader",
"this",
"function",
"blocks",
"until",
"a",
"leader",
"is",
"elected",
"(",
"or",
"a",
"timeout",
"occurs",
")"
] | [
"func",
"(",
"c",
"*",
"cluster",
")",
"Leader",
"(",
"timeout",
"time",
".",
"Duration",
")",
"*",
"raftNode",
"{",
"<mask>",
":=",
"time",
".",
"Now",
"(",
")",
"\n",
"for",
"true",
"{",
"for",
"_",
",",
"n",
":=",
"range",
"c",
".",
"nodes",
"{",
"if",
"n",
".",
"raft",
".",
"State",
"(",
")",
"==",
"raft",
".",
"Leader",
"{",
"return",
"n",
"\n",
"}",
"\n",
"}",
"\n",
"if",
"time",
".",
"Now",
"(",
")",
".",
"Sub",
"(",
"start",
")",
">",
"timeout",
"{",
"return",
"nil",
"\n",
"}",
"\n",
"time",
".",
"Sleep",
"(",
"time",
".",
"Millisecond",
")",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
] |
22,499 | all-22500 | [
"validateIAMRoleCredentialsMessage",
"validates",
"fields",
"in",
"the",
"IAMRoleCredentialsMessage",
"It",
"returns",
"an",
"error",
"if",
"any",
"of",
"the",
"following",
"fields",
"are",
"not",
"set",
"in",
"the",
"message",
":",
"messageId",
"taskArn",
"roleCredentials"
] | [
"func",
"validateIAMRoleCredentialsMessage",
"(",
"message",
"*",
"ecsacs",
".",
"IAMRoleCredentialsMessage",
")",
"error",
"{",
"if",
"message",
"==",
"nil",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"messageId",
":=",
"aws",
".",
"StringValue",
"(",
"<mask>",
".",
"MessageId",
")",
"\n",
"if",
"messageId",
"==",
"\"",
"\"",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"if",
"aws",
".",
"StringValue",
"(",
"message",
".",
"TaskArn",
")",
"==",
"\"",
"\"",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"if",
"message",
".",
"RoleCredentials",
"==",
"nil",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"messageId",
")",
"\n",
"}",
"\n\n",
"if",
"aws",
".",
"StringValue",
"(",
"message",
".",
"RoleCredentials",
".",
"CredentialsId",
")",
"==",
"\"",
"\"",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"messageId",
")",
"\n",
"}",
"\n\n",
"return",
"nil",
"\n",
"}"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.