id
int32 0
25.3k
| idx
stringlengths 5
9
| nl_tokens
sequencelengths 1
418
| pl_tokens
sequencelengths 22
4.98k
|
---|---|---|---|
24,500 | all-24501 | [
"walk",
"walks",
"all",
"the",
"nodePath",
"and",
"apply",
"the",
"walkFunc",
"on",
"each",
"directory"
] | [
"func",
"(",
"s",
"*",
"store",
")",
"walk",
"(",
"nodePath",
"string",
",",
"walkFunc",
"func",
"(",
"prev",
"*",
"node",
",",
"component",
"string",
")",
"(",
"*",
"node",
",",
"*",
"v2error",
".",
"<mask>",
")",
")",
"(",
"*",
"node",
",",
"*",
"v2error",
".",
"Error",
")",
"{",
"components",
":=",
"strings",
".",
"Split",
"(",
"nodePath",
",",
"\"",
"\"",
")",
"\n\n",
"curr",
":=",
"s",
".",
"Root",
"\n",
"var",
"err",
"*",
"v2error",
".",
"Error",
"\n\n",
"for",
"i",
":=",
"1",
";",
"i",
"<",
"len",
"(",
"components",
")",
";",
"i",
"++",
"{",
"if",
"len",
"(",
"components",
"[",
"i",
"]",
")",
"==",
"0",
"{",
"// ignore empty string",
"return",
"curr",
",",
"nil",
"\n",
"}",
"\n\n",
"curr",
",",
"err",
"=",
"walkFunc",
"(",
"curr",
",",
"components",
"[",
"i",
"]",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"}",
"\n\n",
"return",
"curr",
",",
"nil",
"\n",
"}"
] |
24,501 | all-24502 | [
"NewImageSource",
"returns",
"a",
"types",
".",
"ImageSource",
"for",
"this",
"reference",
".",
"The",
"caller",
"must",
"call",
".",
"Close",
"()",
"on",
"the",
"returned",
"ImageSource",
"."
] | [
"func",
"(",
"ref",
"archiveReference",
")",
"NewImageSource",
"(",
"ctx",
"<mask>",
".",
"Context",
",",
"sys",
"*",
"types",
".",
"SystemContext",
")",
"(",
"types",
".",
"ImageSource",
",",
"error",
")",
"{",
"return",
"newImageSource",
"(",
"ctx",
",",
"ref",
")",
"\n",
"}"
] |
24,502 | all-24503 | [
"Write",
"compresses",
"data",
"from",
"the",
"supplied",
"buffer",
"into",
"the",
"underlying",
"io",
".",
"Writer",
".",
"Write",
"does",
"not",
"return",
"until",
"the",
"data",
"has",
"been",
"written",
"."
] | [
"func",
"(",
"z",
"*",
"Writer",
")",
"Write",
"(",
"buf",
"[",
"]",
"byte",
")",
"(",
"int",
",",
"error",
")",
"{",
"if",
"!",
"z",
".",
"Header",
".",
"<mask>",
"{",
"if",
"err",
":=",
"z",
".",
"writeHeader",
"(",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"0",
",",
"err",
"\n",
"}",
"\n",
"}",
"\n",
"if",
"debugFlag",
"{",
"debug",
"(",
"\"",
"\"",
",",
"len",
"(",
"buf",
")",
",",
"z",
".",
"idx",
")",
"\n",
"}",
"\n\n",
"zn",
":=",
"len",
"(",
"z",
".",
"data",
")",
"\n",
"var",
"n",
"int",
"\n",
"for",
"len",
"(",
"buf",
")",
">",
"0",
"{",
"if",
"z",
".",
"idx",
"==",
"0",
"&&",
"len",
"(",
"buf",
")",
">=",
"zn",
"{",
"// Avoid a copy as there is enough data for a block.",
"if",
"err",
":=",
"z",
".",
"compressBlock",
"(",
"buf",
"[",
":",
"zn",
"]",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"n",
",",
"err",
"\n",
"}",
"\n",
"n",
"+=",
"zn",
"\n",
"buf",
"=",
"buf",
"[",
"zn",
":",
"]",
"\n",
"continue",
"\n",
"}",
"\n",
"// Accumulate the data to be compressed.",
"m",
":=",
"copy",
"(",
"z",
".",
"data",
"[",
"z",
".",
"idx",
":",
"]",
",",
"buf",
")",
"\n",
"n",
"+=",
"m",
"\n",
"z",
".",
"idx",
"+=",
"m",
"\n",
"buf",
"=",
"buf",
"[",
"m",
":",
"]",
"\n",
"if",
"debugFlag",
"{",
"debug",
"(",
"\"",
"\"",
",",
"n",
",",
"z",
".",
"idx",
")",
"\n",
"}",
"\n\n",
"if",
"z",
".",
"idx",
"<",
"len",
"(",
"z",
".",
"data",
")",
"{",
"// Buffer not filled.",
"if",
"debugFlag",
"{",
"debug",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"return",
"n",
",",
"nil",
"\n",
"}",
"\n\n",
"// Buffer full.",
"if",
"err",
":=",
"z",
".",
"compressBlock",
"(",
"z",
".",
"data",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"n",
",",
"err",
"\n",
"}",
"\n",
"z",
".",
"idx",
"=",
"0",
"\n",
"}",
"\n\n",
"return",
"n",
",",
"nil",
"\n",
"}"
] |
24,503 | all-24504 | [
"NewReadonlyHandler",
"wraps",
"the",
"given",
"HTTP",
"handler",
"to",
"allow",
"only",
"GET",
"requests"
] | [
"func",
"NewReadonlyHandler",
"(",
"hdlr",
"http",
".",
"<mask>",
")",
"http",
".",
"Handler",
"{",
"readonly",
":=",
"readonlyHandlerFunc",
"(",
"hdlr",
")",
"\n",
"return",
"http",
".",
"HandlerFunc",
"(",
"readonly",
")",
"\n",
"}"
] |
24,504 | all-24505 | [
"Do",
"executes",
"Browser",
".",
"setDockTile",
"against",
"the",
"provided",
"context",
"."
] | [
"func",
"(",
"p",
"*",
"SetDockTileParams",
")",
"Do",
"(",
"ctx",
"<mask>",
".",
"Context",
")",
"(",
"err",
"error",
")",
"{",
"return",
"cdp",
".",
"Execute",
"(",
"ctx",
",",
"CommandSetDockTile",
",",
"p",
",",
"nil",
")",
"\n",
"}"
] |
24,505 | all-24506 | [
"Alias",
"creates",
"an",
"Alias",
"type",
"from",
"an",
"account"
] | [
"func",
"(",
"acc",
"*",
"Account",
")",
"Alias",
"(",
"name",
"string",
")",
"*",
"Alias",
"{",
"return",
"&",
"Alias",
"{",
"account",
":",
"<mask>",
",",
"Name",
":",
"name",
"}",
"\n",
"}"
] |
24,506 | all-24507 | [
"title",
":",
"index",
"path",
":",
"/",
"method",
":",
"GET",
"responses",
":",
"200",
":",
"OK"
] | [
"func",
"index",
"(",
"w",
"http",
".",
"ResponseWriter",
",",
"r",
"*",
"http",
".",
"Request",
")",
"error",
"{",
"host",
",",
"_",
":=",
"config",
".",
"GetString",
"(",
"\"",
"\"",
")",
"\n",
"userCreate",
",",
"_",
":=",
"config",
".",
"GetBool",
"(",
"\"",
"\"",
")",
"\n",
"scheme",
",",
"_",
":=",
"config",
".",
"GetString",
"(",
"\"",
"\"",
")",
"\n",
"repoManager",
",",
"_",
":=",
"config",
".",
"GetString",
"(",
"\"",
"\"",
")",
"\n",
"<mask>",
":=",
"map",
"[",
"string",
"]",
"interface",
"{",
"}",
"{",
"\"",
"\"",
":",
"host",
",",
"\"",
"\"",
":",
"userCreate",
",",
"\"",
"\"",
":",
"scheme",
"==",
"\"",
"\"",
"||",
"scheme",
"==",
"\"",
"\"",
",",
"\"",
"\"",
":",
"repoManager",
"==",
"\"",
"\"",
"||",
"repoManager",
"==",
"\"",
"\"",
",",
"}",
"\n",
"template",
",",
"err",
":=",
"getTemplate",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"return",
"template",
".",
"Execute",
"(",
"w",
",",
"data",
")",
"\n",
"}"
] |
24,507 | all-24508 | [
"InspectCluster",
"retrieves",
"cluster",
"state"
] | [
"func",
"(",
"c",
"APIClient",
")",
"InspectCluster",
"(",
")",
"(",
"*",
"admin",
".",
"ClusterInfo",
",",
"error",
")",
"{",
"clusterInfo",
",",
"err",
":=",
"c",
".",
"AdminAPIClient",
".",
"InspectCluster",
"(",
"c",
".",
"Ctx",
"(",
")",
",",
"&",
"<mask>",
".",
"Empty",
"{",
"}",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"grpcutil",
".",
"ScrubGRPC",
"(",
"err",
")",
"\n",
"}",
"\n",
"return",
"clusterInfo",
",",
"nil",
"\n",
"}"
] |
24,508 | all-24509 | [
"GetText",
"retrieves",
"the",
"Text",
"value",
"from",
"the",
"union",
"returning",
"ok",
"if",
"the",
"union",
"s",
"switch",
"indicated",
"the",
"value",
"is",
"valid",
"."
] | [
"func",
"(",
"u",
"Memo",
")",
"GetText",
"(",
")",
"(",
"result",
"string",
",",
"ok",
"bool",
")",
"{",
"armName",
",",
"_",
":=",
"u",
".",
"ArmForSwitch",
"(",
"int32",
"(",
"u",
".",
"Type",
")",
")",
"\n\n",
"if",
"armName",
"==",
"\"",
"\"",
"{",
"result",
"=",
"*",
"u",
".",
"Text",
"\n",
"<mask>",
"=",
"true",
"\n",
"}",
"\n\n",
"return",
"\n",
"}"
] |
24,509 | all-24510 | [
"SetCounterFunc",
"set",
"counter",
"to",
"a",
"function",
"[",
"called",
"at",
"flush",
"interval",
"]"
] | [
"func",
"(",
"m",
"*",
"CirconusMetrics",
")",
"SetCounterFunc",
"(",
"metric",
"<mask>",
",",
"fn",
"func",
"(",
")",
"uint64",
")",
"{",
"m",
".",
"cfm",
".",
"Lock",
"(",
")",
"\n",
"defer",
"m",
".",
"cfm",
".",
"Unlock",
"(",
")",
"\n",
"m",
".",
"counterFuncs",
"[",
"metric",
"]",
"=",
"fn",
"\n",
"}"
] |
24,510 | all-24511 | [
"/",
"*",
"Write",
"p",
"bytes",
"to",
"our",
"file",
"."
] | [
"func",
"(",
"l",
"*",
"Writer",
")",
"Write",
"(",
"p",
"[",
"]",
"<mask>",
")",
"(",
"int",
",",
"error",
")",
"{",
"l",
".",
"mutex",
".",
"Lock",
"(",
")",
"\n",
"defer",
"l",
".",
"mutex",
".",
"Unlock",
"(",
")",
"\n",
"inode",
",",
"err",
":=",
"l",
".",
"checkInode",
"(",
")",
"\n",
"if",
"os",
".",
"IsNotExist",
"(",
"err",
")",
"||",
"inode",
"!=",
"l",
".",
"inode",
"{",
"err",
"=",
"l",
".",
"reopen",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"0",
",",
"err",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"l",
".",
"file",
".",
"Write",
"(",
"p",
")",
"\n",
"}"
] |
24,511 | all-24512 | [
"ChangeHostModattr",
"creates",
"a",
"new",
"CHANGE_HOST_MODATTR",
"Nagios",
"command",
".",
"This",
"command",
"changes",
"the",
"modified",
"attributes",
"value",
"for",
"the",
"specified",
"host",
".",
"Modified",
"attributes",
"values",
"are",
"used",
"by",
"Nagios",
"to",
"determine",
"which",
"object",
"properties",
"should",
"be",
"retained",
"across",
"program",
"restarts",
".",
"Thus",
"modifying",
"the",
"value",
"of",
"the",
"attributes",
"can",
"affect",
"data",
"retention",
".",
"This",
"is",
"an",
"advanced",
"option",
"and",
"should",
"only",
"be",
"used",
"by",
"people",
"who",
"are",
"intimately",
"familiar",
"with",
"the",
"data",
"retention",
"logic",
"in",
"Nagios",
"."
] | [
"func",
"ChangeHostModattr",
"(",
"host_name",
"string",
",",
"value",
"string",
",",
")",
"*",
"livestatus",
".",
"Command",
"{",
"return",
"livestatus",
".",
"NewCommand",
"(",
"\"",
"\"",
",",
"stringifyArg",
"(",
"\"",
"\"",
",",
"\"",
"\"",
",",
"host_name",
")",
",",
"stringifyArg",
"(",
"\"",
"\"",
",",
"\"",
"\"",
",",
"<mask>",
")",
",",
")",
"\n",
"}"
] |
24,512 | all-24513 | [
"findAuthentication",
"looks",
"for",
"auth",
"of",
"registry",
"in",
"path"
] | [
"func",
"findAuthentication",
"(",
"registry",
",",
"path",
"string",
",",
"legacyFormat",
"bool",
")",
"(",
"string",
",",
"string",
",",
"error",
")",
"{",
"auths",
",",
"err",
":=",
"readJSONFile",
"(",
"path",
",",
"legacyFormat",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"\"",
"\"",
",",
"\"",
"\"",
",",
"errors",
".",
"Wrapf",
"(",
"err",
",",
"\"",
"\"",
",",
"path",
")",
"\n",
"}",
"\n\n",
"// First try cred helpers. They should always be normalized.",
"if",
"ch",
",",
"exists",
":=",
"auths",
".",
"CredHelpers",
"[",
"registry",
"]",
";",
"exists",
"{",
"return",
"getAuthFromCredHelper",
"(",
"ch",
",",
"registry",
")",
"\n",
"}",
"\n\n",
"// I'm feeling lucky",
"if",
"val",
",",
"exists",
":=",
"auths",
".",
"AuthConfigs",
"[",
"registry",
"]",
";",
"exists",
"{",
"return",
"decodeDockerAuth",
"(",
"val",
".",
"Auth",
")",
"\n",
"}",
"\n\n",
"// bad luck; let's normalize the entries first",
"registry",
"=",
"normalizeRegistry",
"(",
"registry",
")",
"\n",
"normalizedAuths",
":=",
"map",
"[",
"string",
"]",
"dockerAuthConfig",
"{",
"}",
"\n",
"for",
"k",
",",
"v",
":=",
"<mask>",
"auths",
".",
"AuthConfigs",
"{",
"normalizedAuths",
"[",
"normalizeRegistry",
"(",
"k",
")",
"]",
"=",
"v",
"\n",
"}",
"\n",
"if",
"val",
",",
"exists",
":=",
"normalizedAuths",
"[",
"registry",
"]",
";",
"exists",
"{",
"return",
"decodeDockerAuth",
"(",
"val",
".",
"Auth",
")",
"\n",
"}",
"\n",
"return",
"\"",
"\"",
",",
"\"",
"\"",
",",
"nil",
"\n",
"}"
] |
24,513 | all-24514 | [
"Performs",
"validation",
"and",
"combines",
"errors",
"from",
"validation",
"with",
"errors",
"from",
"deserialization",
"then",
"maps",
"both",
"the",
"resulting",
"struct",
"and",
"the",
"errors",
"to",
"the",
"context",
"."
] | [
"func",
"validateAndMap",
"(",
"obj",
"reflect",
".",
"Value",
",",
"context",
"martini",
".",
"Context",
",",
"errors",
"*",
"Errors",
",",
"ifacePtr",
"...",
"interface",
"{",
"}",
")",
"{",
"context",
".",
"Invoke",
"(",
"Validate",
"(",
"obj",
".",
"Interface",
"(",
")",
")",
")",
"\n",
"errors",
".",
"combine",
"(",
"getErrors",
"(",
"context",
")",
")",
"\n",
"context",
".",
"Map",
"(",
"*",
"errors",
")",
"\n",
"context",
".",
"<mask>",
"(",
"obj",
".",
"Elem",
"(",
")",
".",
"Interface",
"(",
")",
")",
"\n",
"if",
"len",
"(",
"ifacePtr",
")",
">",
"0",
"{",
"context",
".",
"MapTo",
"(",
"obj",
".",
"Elem",
"(",
")",
".",
"Interface",
"(",
")",
",",
"ifacePtr",
"[",
"0",
"]",
")",
"\n",
"}",
"\n",
"}"
] |
24,514 | all-24515 | [
"isInstanceLaunchedInVPC",
"returns",
"false",
"when",
"the",
"http",
"status",
"code",
"is",
"set",
"to",
"not",
"found",
"(",
"404",
")",
"when",
"querying",
"the",
"vpc",
"id",
"from",
"instance",
"metadata"
] | [
"func",
"isInstanceLaunchedInVPC",
"(",
"err",
"error",
")",
"bool",
"{",
"if",
"metadataErr",
",",
"<mask>",
":=",
"err",
".",
"(",
"*",
"ec2",
".",
"MetadataError",
")",
";",
"ok",
"&&",
"metadataErr",
".",
"GetStatusCode",
"(",
")",
"==",
"http",
".",
"StatusNotFound",
"{",
"return",
"false",
"\n",
"}",
"\n\n",
"return",
"true",
"\n",
"}"
] |
24,515 | all-24516 | [
"HasAPIToken",
"returns",
"a",
"boolean",
"if",
"a",
"field",
"has",
"been",
"set",
"."
] | [
"func",
"(",
"i",
"*",
"IntegrationPDRequest",
")",
"HasAPIToken",
"(",
")",
"bool",
"{",
"if",
"i",
"!=",
"nil",
"&&",
"i",
".",
"APIToken",
"!=",
"nil",
"{",
"return",
"<mask>",
"\n",
"}",
"\n\n",
"return",
"false",
"\n",
"}"
] |
24,516 | all-24517 | [
"GetChangeTypeOk",
"returns",
"a",
"tuple",
"with",
"the",
"ChangeType",
"field",
"if",
"it",
"s",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"and",
"a",
"boolean",
"to",
"check",
"if",
"the",
"value",
"has",
"been",
"set",
"."
] | [
"func",
"(",
"g",
"*",
"GraphDefinitionRequest",
")",
"GetChangeTypeOk",
"(",
")",
"(",
"string",
",",
"bool",
")",
"{",
"if",
"g",
"==",
"nil",
"||",
"g",
".",
"ChangeType",
"==",
"nil",
"{",
"return",
"\"",
"\"",
",",
"false",
"\n",
"}",
"\n",
"return",
"*",
"g",
".",
"ChangeType",
",",
"<mask>",
"\n",
"}"
] |
24,517 | all-24518 | [
"HasBin",
"check",
"whether",
"Docker",
"binary",
"is",
"available",
"."
] | [
"func",
"(",
"s",
"*",
"Docker",
")",
"HasBin",
"(",
")",
"bool",
"{",
"_",
",",
"err",
":=",
"<mask>",
".",
"LookPath",
"(",
"s",
".",
"binCmd",
")",
"\n",
"return",
"err",
"==",
"nil",
"\n",
"}"
] |
24,518 | all-24519 | [
"String",
"implements",
"the",
"Stringer",
"interface",
"."
] | [
"func",
"(",
"f",
"*",
"ResultField",
")",
"<mask>",
"(",
")",
"string",
"{",
"return",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"f",
".",
"columnOptions",
",",
"f",
".",
"tc",
",",
"f",
".",
"fraction",
",",
"f",
".",
"length",
",",
"f",
".",
"fieldNames",
".",
"name",
"(",
"f",
".",
"offsets",
"[",
"tableName",
"]",
")",
",",
"f",
".",
"fieldNames",
".",
"name",
"(",
"f",
".",
"offsets",
"[",
"schemaName",
"]",
")",
",",
"f",
".",
"fieldNames",
".",
"name",
"(",
"f",
".",
"offsets",
"[",
"columnName",
"]",
")",
",",
"f",
".",
"fieldNames",
".",
"name",
"(",
"f",
".",
"offsets",
"[",
"columnDisplayName",
"]",
")",
",",
")",
"\n",
"}"
] |
24,519 | all-24520 | [
"stacks",
"is",
"a",
"wrapper",
"for",
"runtime",
".",
"Stack",
"that",
"attempts",
"to",
"recover",
"the",
"data",
"for",
"all",
"goroutines",
"."
] | [
"func",
"stacks",
"(",
"all",
"bool",
",",
"max",
"int",
")",
"[",
"]",
"byte",
"{",
"// We don't know how big the traces are, so grow a few times if they don't fit. Start large, though.",
"n",
":=",
"initialMaxStackBufSize",
"\n",
"var",
"trace",
"[",
"]",
"byte",
"\n",
"for",
"n",
"<=",
"max",
"{",
"trace",
"=",
"<mask>",
"(",
"[",
"]",
"byte",
",",
"n",
")",
"\n",
"nbytes",
":=",
"runtime",
".",
"Stack",
"(",
"trace",
",",
"all",
")",
"\n",
"if",
"nbytes",
"<",
"len",
"(",
"trace",
")",
"{",
"return",
"trace",
"[",
":",
"nbytes",
"]",
"\n",
"}",
"\n",
"n",
"*=",
"2",
"\n",
"}",
"\n",
"return",
"trace",
"\n",
"}"
] |
24,520 | all-24521 | [
"SettingsNewWithBackend",
"is",
"a",
"wrapper",
"around",
"g_settings_new_with_backend",
"()",
"."
] | [
"func",
"SettingsNewWithBackend",
"(",
"schemaID",
"string",
",",
"backend",
"*",
"SettingsBackend",
")",
"*",
"Settings",
"{",
"cstr1",
":=",
"(",
"*",
"C",
".",
"gchar",
")",
"(",
"C",
".",
"CString",
"(",
"schemaID",
")",
")",
"\n",
"defer",
"C",
".",
"<mask>",
"(",
"unsafe",
".",
"Pointer",
"(",
"cstr1",
")",
")",
"\n\n",
"return",
"wrapFullSettings",
"(",
"C",
".",
"g_settings_new_with_backend",
"(",
"cstr1",
",",
"backend",
".",
"native",
"(",
")",
")",
")",
"\n",
"}"
] |
24,521 | all-24522 | [
"GetBackendSecretVolumeAndMount",
"returns",
"a",
"properly",
"configured",
"Volume",
"and",
"VolumeMount",
"object",
"given",
"a",
"backend",
".",
"The",
"backend",
"needs",
"to",
"be",
"one",
"of",
"the",
"constants",
"defined",
"in",
"pfs",
"/",
"server",
"."
] | [
"func",
"GetBackendSecretVolumeAndMount",
"(",
"backend",
"string",
")",
"(",
"v1",
".",
"Volume",
",",
"v1",
".",
"VolumeMount",
")",
"{",
"return",
"v1",
".",
"Volume",
"{",
"Name",
":",
"client",
".",
"StorageSecretName",
",",
"VolumeSource",
":",
"v1",
".",
"VolumeSource",
"{",
"Secret",
":",
"&",
"v1",
".",
"SecretVolumeSource",
"{",
"SecretName",
":",
"client",
".",
"StorageSecretName",
",",
"}",
",",
"}",
",",
"}",
",",
"v1",
".",
"VolumeMount",
"{",
"Name",
":",
"client",
".",
"StorageSecretName",
",",
"MountPath",
":",
"\"",
"\"",
"+",
"<mask>",
".",
"StorageSecretName",
",",
"}",
"\n",
"}"
] |
24,522 | all-24523 | [
"ForEachPtr",
"calls",
"fn",
"for",
"all",
"heap",
"pointers",
"it",
"finds",
"in",
"x",
".",
"It",
"calls",
"fn",
"with",
":",
"the",
"offset",
"of",
"the",
"pointer",
"slot",
"in",
"x",
"the",
"pointed",
"-",
"to",
"object",
"y",
"the",
"offset",
"in",
"y",
"where",
"the",
"pointer",
"points",
".",
"If",
"fn",
"returns",
"false",
"ForEachPtr",
"returns",
"immediately",
".",
"For",
"an",
"edge",
"from",
"an",
"object",
"to",
"its",
"finalizer",
"the",
"first",
"argument",
"passed",
"to",
"fn",
"will",
"be",
"-",
"1",
".",
"(",
"TODO",
":",
"implement",
")"
] | [
"func",
"(",
"p",
"*",
"Process",
")",
"ForEachPtr",
"(",
"x",
"Object",
",",
"fn",
"func",
"(",
"int64",
",",
"Object",
",",
"int64",
")",
"bool",
")",
"{",
"<mask>",
":=",
"p",
".",
"Size",
"(",
"x",
")",
"\n",
"for",
"i",
":=",
"int64",
"(",
"0",
")",
";",
"i",
"<",
"size",
";",
"i",
"+=",
"p",
".",
"proc",
".",
"PtrSize",
"(",
")",
"{",
"a",
":=",
"core",
".",
"Address",
"(",
"x",
")",
".",
"Add",
"(",
"i",
")",
"\n",
"if",
"!",
"p",
".",
"isPtrFromHeap",
"(",
"a",
")",
"{",
"continue",
"\n",
"}",
"\n",
"ptr",
":=",
"p",
".",
"proc",
".",
"ReadPtr",
"(",
"a",
")",
"\n",
"y",
",",
"off",
":=",
"p",
".",
"FindObject",
"(",
"ptr",
")",
"\n",
"if",
"y",
"!=",
"0",
"{",
"if",
"!",
"fn",
"(",
"i",
",",
"y",
",",
"off",
")",
"{",
"return",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n",
"}"
] |
24,523 | all-24524 | [
"handleError",
"tests",
"the",
"context",
"Error",
"and",
"assign",
"it",
"to",
"response",
"."
] | [
"func",
"(",
"mux",
"*",
"ServerMux",
")",
"handleError",
"(",
"ctx",
"*",
"Context",
",",
"err",
"error",
")",
"bool",
"{",
"if",
"err",
"==",
"nil",
"{",
"return",
"false",
"\n",
"}",
"\n",
"if",
"e",
",",
"ok",
":=",
"err",
".",
"(",
"Error",
")",
";",
"ok",
"{",
"ctx",
".",
"Response",
".",
"Status",
"=",
"e",
".",
"Status",
"\n",
"ctx",
".",
"Response",
".",
"Data",
"=",
"e",
"\n",
"return",
"<mask>",
"\n",
"}",
"\n",
"if",
"ctx",
".",
"Response",
".",
"Status",
"==",
"http",
".",
"StatusOK",
"{",
"ctx",
".",
"Response",
".",
"Status",
"=",
"http",
".",
"StatusInternalServerError",
"\n",
"}",
"\n",
"ctx",
".",
"Response",
".",
"Data",
"=",
"err",
".",
"Error",
"(",
")",
"\n",
"mux",
".",
"err",
"(",
"err",
")",
"\n",
"return",
"true",
"\n",
"}"
] |
24,524 | all-24525 | [
"FileMove",
"tries",
"to",
"move",
"a",
"file",
"by",
"using",
"os",
".",
"Rename",
"if",
"that",
"fails",
"it",
"tries",
"to",
"copy",
"the",
"file",
"and",
"remove",
"the",
"source",
"."
] | [
"func",
"FileMove",
"(",
"oldPath",
"string",
",",
"newPath",
"string",
")",
"error",
"{",
"err",
":=",
"os",
".",
"Rename",
"(",
"oldPath",
",",
"newPath",
")",
"\n",
"if",
"err",
"==",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n\n",
"err",
"=",
"FileCopy",
"(",
"oldPath",
",",
"newPath",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"<mask>",
".",
"Remove",
"(",
"oldPath",
")",
"\n\n",
"return",
"nil",
"\n",
"}"
] |
24,525 | all-24526 | [
"SyncSchema",
"updates",
"a",
"schema",
"with",
"the",
"indexes",
"and",
"fields",
"on",
"the",
"server",
"and",
"creates",
"the",
"indexes",
"and",
"fields",
"in",
"the",
"schema",
"on",
"the",
"server",
"side",
".",
"This",
"function",
"does",
"not",
"delete",
"indexes",
"and",
"the",
"fields",
"on",
"the",
"server",
"side",
"nor",
"in",
"the",
"schema",
"."
] | [
"func",
"(",
"c",
"*",
"Client",
")",
"SyncSchema",
"(",
"schema",
"*",
"Schema",
")",
"error",
"{",
"span",
":=",
"c",
".",
"tracer",
".",
"StartSpan",
"(",
"\"",
"\"",
")",
"\n",
"defer",
"<mask>",
".",
"Finish",
"(",
")",
"\n\n",
"serverSchema",
",",
"err",
":=",
"c",
".",
"Schema",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"return",
"c",
".",
"syncSchema",
"(",
"schema",
",",
"serverSchema",
")",
"\n",
"}"
] |
24,526 | all-24527 | [
"ReadLen8String",
"reads",
"an",
"8",
"-",
"bit",
"length",
"preceded",
"string",
"value"
] | [
"func",
"(",
"r",
"*",
"ReadBuffer",
")",
"ReadLen8String",
"(",
")",
"string",
"{",
"n",
":=",
"r",
".",
"ReadSingleByte",
"(",
")",
"\n",
"<mask>",
"r",
".",
"ReadString",
"(",
"int",
"(",
"n",
")",
")",
"\n",
"}"
] |
24,527 | all-24528 | [
"Enumerate",
"lists",
"each",
"element",
"present",
"in",
"the",
"collection"
] | [
"func",
"(",
"l",
"*",
"List",
")",
"Enumerate",
"(",
"cancel",
"<-",
"chan",
"struct",
"{",
"}",
")",
"Enumerator",
"{",
"retval",
":=",
"make",
"(",
"chan",
"interface",
"{",
"}",
")",
"\n\n",
"go",
"func",
"(",
")",
"{",
"l",
".",
"key",
".",
"RLock",
"(",
")",
"\n",
"defer",
"l",
".",
"key",
".",
"RUnlock",
"(",
")",
"\n",
"defer",
"close",
"(",
"retval",
")",
"\n\n",
"for",
"_",
",",
"entry",
":=",
"range",
"l",
".",
"underlyer",
"{",
"select",
"{",
"<mask>",
"retval",
"<-",
"entry",
":",
"break",
"\n",
"case",
"<-",
"cancel",
":",
"return",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"(",
")",
"\n\n",
"return",
"retval",
"\n",
"}"
] |
24,528 | all-24529 | [
"Specify",
"the",
"value",
"of",
"a",
"uniform",
"variable",
"for",
"the",
"current",
"program",
"object"
] | [
"func",
"Uniform4iv",
"(",
"location",
"int32",
",",
"<mask>",
"int32",
",",
"value",
"*",
"int32",
")",
"{",
"C",
".",
"glowUniform4iv",
"(",
"gpUniform4iv",
",",
"(",
"C",
".",
"GLint",
")",
"(",
"location",
")",
",",
"(",
"C",
".",
"GLsizei",
")",
"(",
"count",
")",
",",
"(",
"*",
"C",
".",
"GLint",
")",
"(",
"unsafe",
".",
"Pointer",
"(",
"value",
")",
")",
")",
"\n",
"}"
] |
24,529 | all-24530 | [
"ValueBytes",
"returns",
"the",
"byte",
"slice",
"holding",
"the",
"comparison",
"value",
"if",
"any",
"."
] | [
"func",
"(",
"cmp",
"*",
"Cmp",
")",
"ValueBytes",
"(",
")",
"[",
"]",
"byte",
"{",
"if",
"tu",
",",
"<mask>",
":=",
"cmp",
".",
"TargetUnion",
".",
"(",
"*",
"pb",
".",
"Compare_Value",
")",
";",
"ok",
"{",
"return",
"tu",
".",
"Value",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
] |
24,530 | all-24531 | [
"Int64",
"returns",
"v",
"s",
"int64",
"value",
".",
"If",
"v",
".",
"Kind",
"()",
"!",
"=",
"Int64",
"Int64",
"returns",
"0",
"."
] | [
"func",
"(",
"v",
"Value",
")",
"Int64",
"(",
")",
"int64",
"{",
"x",
",",
"<mask>",
":=",
"v",
".",
"data",
".",
"(",
"int64",
")",
"\n",
"if",
"!",
"ok",
"{",
"return",
"0",
"\n",
"}",
"\n",
"return",
"x",
"\n",
"}"
] |
24,531 | all-24532 | [
"StatusString",
"returns",
"the",
"string",
"of",
"the",
"cgroup",
"resource",
"status"
] | [
"func",
"(",
"secret",
"*",
"ASMSecretResource",
")",
"StatusString",
"(",
"status",
"resourcestatus",
".",
"ResourceStatus",
")",
"string",
"{",
"return",
"ASMSecretStatus",
"(",
"<mask>",
")",
".",
"String",
"(",
")",
"\n",
"}"
] |
24,532 | all-24533 | [
"StringVar",
"defines",
"a",
"string",
"flag",
"with",
"specified",
"name",
"default",
"value",
"and",
"usage",
"string",
".",
"The",
"argument",
"p",
"points",
"to",
"a",
"string",
"variable",
"in",
"which",
"to",
"store",
"the",
"value",
"of",
"the",
"flag",
"."
] | [
"func",
"StringVar",
"(",
"p",
"*",
"string",
",",
"<mask>",
"string",
",",
"value",
"string",
",",
"usage",
"string",
")",
"{",
"EnvironmentFlags",
".",
"StringVar",
"(",
"p",
",",
"name",
",",
"value",
",",
"usage",
")",
"\n",
"}"
] |
24,533 | all-24534 | [
"NewStreamHandler",
"creates",
"a",
"StreamHandler"
] | [
"func",
"NewStreamHandler",
"(",
"w",
"<mask>",
".",
"Writer",
")",
"(",
"*",
"StreamHandler",
",",
"error",
")",
"{",
"h",
":=",
"new",
"(",
"StreamHandler",
")",
"\n\n",
"h",
".",
"w",
"=",
"w",
"\n\n",
"return",
"h",
",",
"nil",
"\n",
"}"
] |
24,534 | all-24535 | [
"Do",
"executes",
"Runtime",
".",
"releaseObject",
"against",
"the",
"provided",
"context",
"."
] | [
"func",
"(",
"p",
"*",
"ReleaseObjectParams",
")",
"Do",
"(",
"ctx",
"context",
".",
"<mask>",
")",
"(",
"err",
"error",
")",
"{",
"return",
"cdp",
".",
"Execute",
"(",
"ctx",
",",
"CommandReleaseObject",
",",
"p",
",",
"nil",
")",
"\n",
"}"
] |
24,535 | all-24536 | [
"CheckUnexportedReturn",
"checks",
"that",
"exported",
"functions",
"on",
"exported",
"types",
"do",
"not",
"return",
"unexported",
"types",
"."
] | [
"func",
"(",
"c",
"*",
"Checker",
")",
"CheckUnexportedReturn",
"(",
"j",
"*",
"lint",
".",
"Job",
")",
"{",
"for",
"_",
",",
"fn",
":=",
"range",
"j",
".",
"Program",
".",
"InitialFunctions",
"{",
"if",
"fn",
".",
"Synthetic",
"!=",
"\"",
"\"",
"||",
"fn",
".",
"Parent",
"(",
")",
"!=",
"nil",
"{",
"continue",
"\n",
"}",
"\n",
"if",
"!",
"ast",
".",
"IsExported",
"(",
"fn",
".",
"Name",
"(",
")",
")",
"||",
"IsInMain",
"(",
"j",
",",
"fn",
")",
"||",
"IsInTest",
"(",
"j",
",",
"fn",
")",
"{",
"continue",
"\n",
"}",
"\n",
"sig",
":=",
"fn",
".",
"Type",
"(",
")",
".",
"(",
"*",
"types",
".",
"Signature",
")",
"\n",
"if",
"sig",
".",
"Recv",
"(",
")",
"!=",
"nil",
"&&",
"!",
"ast",
".",
"IsExported",
"(",
"Dereference",
"(",
"sig",
".",
"Recv",
"(",
")",
".",
"Type",
"(",
")",
")",
".",
"(",
"*",
"types",
".",
"Named",
")",
".",
"Obj",
"(",
")",
".",
"Name",
"(",
")",
")",
"{",
"continue",
"\n",
"}",
"\n",
"res",
":=",
"sig",
".",
"Results",
"(",
")",
"\n",
"for",
"i",
":=",
"0",
";",
"i",
"<",
"res",
".",
"Len",
"(",
")",
";",
"i",
"++",
"{",
"if",
"named",
",",
"ok",
":=",
"DereferenceR",
"(",
"res",
".",
"At",
"(",
"i",
")",
".",
"Type",
"(",
")",
")",
".",
"(",
"*",
"types",
".",
"Named",
")",
";",
"ok",
"&&",
"!",
"ast",
".",
"IsExported",
"(",
"named",
".",
"Obj",
"(",
")",
".",
"<mask>",
"(",
")",
")",
"&&",
"named",
"!=",
"types",
".",
"Universe",
".",
"Lookup",
"(",
"\"",
"\"",
")",
".",
"Type",
"(",
")",
"{",
"j",
".",
"Errorf",
"(",
"fn",
",",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n",
"}"
] |
24,536 | all-24537 | [
"specify",
"clear",
"values",
"for",
"the",
"accumulation",
"buffer"
] | [
"func",
"ClearAccum",
"(",
"red",
"float32",
",",
"green",
"float32",
",",
"blue",
"float32",
",",
"alpha",
"float32",
")",
"{",
"C",
".",
"glowClearAccum",
"(",
"gpClearAccum",
",",
"(",
"C",
".",
"GLfloat",
")",
"(",
"red",
")",
",",
"(",
"C",
".",
"GLfloat",
")",
"(",
"<mask>",
")",
",",
"(",
"C",
".",
"GLfloat",
")",
"(",
"blue",
")",
",",
"(",
"C",
".",
"GLfloat",
")",
"(",
"alpha",
")",
")",
"\n",
"}"
] |
24,537 | all-24538 | [
"CommitAndStop",
"commits",
"the",
"previous",
"tx",
"and",
"does",
"not",
"create",
"a",
"new",
"one",
"."
] | [
"func",
"(",
"t",
"*",
"batchTx",
")",
"CommitAndStop",
"(",
")",
"{",
"t",
".",
"Lock",
"(",
")",
"\n",
"t",
".",
"<mask>",
"(",
"true",
")",
"\n",
"t",
".",
"Unlock",
"(",
")",
"\n",
"}"
] |
24,538 | all-24539 | [
"Associates",
"a",
"generic",
"vertex",
"attribute",
"index",
"with",
"a",
"named",
"attribute",
"variable"
] | [
"func",
"BindAttribLocation",
"(",
"program",
"uint32",
",",
"index",
"uint32",
",",
"name",
"*",
"uint8",
")",
"{",
"syscall",
".",
"Syscall",
"(",
"gpBindAttribLocation",
",",
"3",
",",
"uintptr",
"(",
"program",
")",
",",
"uintptr",
"(",
"<mask>",
")",
",",
"uintptr",
"(",
"unsafe",
".",
"Pointer",
"(",
"name",
")",
")",
")",
"\n",
"}"
] |
24,539 | all-24540 | [
"HandlerFunc",
"can",
"be",
"used",
"to",
"handle",
"HTTP",
"requests",
"performed",
"against",
"the",
"LXD",
"API",
"RaftEndpoint",
"(",
"/",
"internal",
"/",
"raft",
")",
"in",
"order",
"to",
"join",
"/",
"leave",
"/",
"form",
"the",
"raft",
"cluster",
".",
"If",
"it",
"returns",
"nil",
"it",
"means",
"that",
"this",
"node",
"is",
"not",
"supposed",
"to",
"expose",
"a",
"raft",
"endpoint",
"over",
"the",
"network",
"because",
"it",
"s",
"running",
"as",
"a",
"non",
"-",
"clustered",
"single",
"node",
"."
] | [
"func",
"(",
"i",
"*",
"raftInstance",
")",
"HandlerFunc",
"(",
")",
"http",
".",
"HandlerFunc",
"{",
"if",
"i",
".",
"<mask>",
"==",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n",
"return",
"i",
".",
"handler",
".",
"ServeHTTP",
"\n",
"}"
] |
24,540 | all-24541 | [
"TeamHasMember",
"checks",
"if",
"a",
"user",
"belongs",
"to",
"a",
"team"
] | [
"func",
"(",
"f",
"*",
"FakeClient",
")",
"TeamHasMember",
"(",
"teamID",
"int",
",",
"memberLogin",
"string",
")",
"(",
"bool",
",",
"error",
")",
"{",
"teamMembers",
",",
"_",
":=",
"f",
".",
"ListTeamMembers",
"(",
"teamID",
",",
"github",
".",
"RoleAll",
")",
"\n",
"for",
"_",
",",
"member",
":=",
"range",
"teamMembers",
"{",
"if",
"<mask>",
".",
"Login",
"==",
"memberLogin",
"{",
"return",
"true",
",",
"nil",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"false",
",",
"nil",
"\n",
"}"
] |
24,541 | all-24542 | [
"Find",
"searches",
"from",
"the",
"given",
"dir",
"and",
"up",
"for",
"the",
"WORKSPACE",
"file",
"returning",
"the",
"directory",
"containing",
"it",
"or",
"an",
"error",
"if",
"none",
"found",
"in",
"the",
"tree",
"."
] | [
"func",
"Find",
"(",
"dir",
"string",
")",
"(",
"string",
",",
"error",
")",
"{",
"dir",
",",
"err",
":=",
"filepath",
".",
"Abs",
"(",
"dir",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"\"",
"\"",
",",
"err",
"\n",
"}",
"\n\n",
"for",
"{",
"_",
",",
"err",
"=",
"os",
".",
"Stat",
"(",
"filepath",
".",
"Join",
"(",
"dir",
",",
"workspaceFile",
")",
")",
"\n",
"if",
"err",
"==",
"nil",
"{",
"return",
"dir",
",",
"nil",
"\n",
"}",
"\n",
"if",
"!",
"os",
".",
"IsNotExist",
"(",
"err",
")",
"{",
"return",
"\"",
"\"",
",",
"err",
"\n",
"}",
"\n",
"if",
"strings",
".",
"HasSuffix",
"(",
"dir",
",",
"string",
"(",
"<mask>",
".",
"PathSeparator",
")",
")",
"{",
"// stop at root dir",
"return",
"\"",
"\"",
",",
"os",
".",
"ErrNotExist",
"\n",
"}",
"\n",
"dir",
"=",
"filepath",
".",
"Dir",
"(",
"dir",
")",
"\n",
"}",
"\n",
"}"
] |
24,542 | all-24543 | [
"Patch",
"applies",
"the",
"patch",
"and",
"returns",
"the",
"patched",
"prowJob",
"."
] | [
"func",
"(",
"c",
"*",
"FakeProwJobs",
")",
"Patch",
"(",
"name",
"string",
",",
"pt",
"types",
".",
"PatchType",
",",
"<mask>",
"[",
"]",
"byte",
",",
"subresources",
"...",
"string",
")",
"(",
"result",
"*",
"prowjobsv1",
".",
"ProwJob",
",",
"err",
"error",
")",
"{",
"obj",
",",
"err",
":=",
"c",
".",
"Fake",
".",
"Invokes",
"(",
"testing",
".",
"NewPatchSubresourceAction",
"(",
"prowjobsResource",
",",
"c",
".",
"ns",
",",
"name",
",",
"data",
",",
"subresources",
"...",
")",
",",
"&",
"prowjobsv1",
".",
"ProwJob",
"{",
"}",
")",
"\n\n",
"if",
"obj",
"==",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"return",
"obj",
".",
"(",
"*",
"prowjobsv1",
".",
"ProwJob",
")",
",",
"err",
"\n",
"}"
] |
24,543 | all-24544 | [
"GetOrAdd",
"a",
"subchannel",
"for",
"the",
"given",
"serviceName",
"on",
"the",
"map"
] | [
"func",
"(",
"subChMap",
"*",
"subChannelMap",
")",
"getOrAdd",
"(",
"serviceName",
"string",
",",
"ch",
"*",
"Channel",
")",
"(",
"_",
"*",
"SubChannel",
",",
"added",
"bool",
")",
"{",
"if",
"sc",
",",
"ok",
":=",
"subChMap",
".",
"get",
"(",
"serviceName",
")",
";",
"ok",
"{",
"return",
"sc",
",",
"<mask>",
"\n",
"}",
"\n\n",
"return",
"subChMap",
".",
"registerNewSubChannel",
"(",
"serviceName",
",",
"ch",
")",
"\n",
"}"
] |
24,544 | all-24545 | [
"HasFrame",
"returns",
"true",
"if",
"the",
"frameset",
"contains",
"the",
"given",
"frame",
"value",
"."
] | [
"func",
"(",
"s",
"*",
"FrameSet",
")",
"HasFrame",
"(",
"frame",
"int",
")",
"bool",
"{",
"return",
"s",
".",
"rangePtr",
".",
"Contains",
"(",
"<mask>",
")",
"\n",
"}"
] |
24,545 | all-24546 | [
"GetSecret",
"returns",
"the",
"value",
"of",
"a",
"secret",
"stored",
"in",
"a",
"map",
"."
] | [
"func",
"(",
"a",
"*",
"Agent",
")",
"GetSecret",
"(",
"secretPath",
"string",
")",
"[",
"]",
"<mask>",
"{",
"a",
".",
"RLock",
"(",
")",
"\n",
"defer",
"a",
".",
"RUnlock",
"(",
")",
"\n",
"return",
"a",
".",
"secretsMap",
"[",
"secretPath",
"]",
"\n",
"}"
] |
24,546 | all-24547 | [
"New",
"returns",
"a",
"new",
"Communigate",
"Pro",
"client"
] | [
"func",
"New",
"(",
"url",
",",
"<mask>",
",",
"pass",
"string",
")",
"*",
"CGP",
"{",
"return",
"&",
"CGP",
"{",
"url",
":",
"url",
",",
"user",
":",
"user",
",",
"pass",
":",
"pass",
"}",
"\n",
"}"
] |
24,547 | all-24548 | [
"NewController",
"returns",
"a",
"new",
"gerrit",
"controller",
"client"
] | [
"func",
"NewController",
"(",
"lastSyncFallback",
",",
"cookiefilePath",
"string",
",",
"projects",
"map",
"[",
"string",
"]",
"[",
"]",
"string",
",",
"kc",
"*",
"kube",
".",
"Client",
",",
"cfg",
"config",
".",
"Getter",
")",
"(",
"*",
"Controller",
",",
"error",
")",
"{",
"if",
"lastSyncFallback",
"==",
"\"",
"\"",
"{",
"return",
"nil",
",",
"errors",
".",
"New",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"<mask>",
"lastUpdate",
"time",
".",
"Time",
"\n",
"if",
"buf",
",",
"err",
":=",
"ioutil",
".",
"ReadFile",
"(",
"lastSyncFallback",
")",
";",
"err",
"==",
"nil",
"{",
"unix",
",",
"err",
":=",
"strconv",
".",
"ParseInt",
"(",
"string",
"(",
"buf",
")",
",",
"10",
",",
"64",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"lastUpdate",
"=",
"time",
".",
"Unix",
"(",
"unix",
",",
"0",
")",
"\n",
"}",
"else",
"if",
"err",
"!=",
"nil",
"&&",
"!",
"os",
".",
"IsNotExist",
"(",
"err",
")",
"{",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"}",
"else",
"{",
"logrus",
".",
"Warnf",
"(",
"\"",
"\"",
",",
"lastSyncFallback",
")",
"\n",
"lastUpdate",
"=",
"time",
".",
"Now",
"(",
")",
"\n",
"}",
"\n\n",
"c",
",",
"err",
":=",
"client",
".",
"NewClient",
"(",
"projects",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"c",
".",
"Start",
"(",
"cookiefilePath",
")",
"\n\n",
"return",
"&",
"Controller",
"{",
"kc",
":",
"kc",
",",
"config",
":",
"cfg",
",",
"gc",
":",
"c",
",",
"lastUpdate",
":",
"lastUpdate",
",",
"lastSyncFallback",
":",
"lastSyncFallback",
",",
"}",
",",
"nil",
"\n",
"}"
] |
24,548 | all-24549 | [
"signatureFunc",
"is",
"a",
"cached",
"version",
"of",
"signatureFunc",
"."
] | [
"func",
"(",
"enh",
"*",
"EvalNodeHelper",
")",
"signatureFunc",
"(",
"on",
"bool",
",",
"names",
"...",
"string",
")",
"func",
"(",
"labels",
".",
"Labels",
")",
"uint64",
"{",
"if",
"enh",
".",
"sigf",
"==",
"nil",
"{",
"enh",
".",
"sigf",
"=",
"make",
"(",
"map",
"[",
"uint64",
"]",
"uint64",
",",
"len",
"(",
"enh",
".",
"out",
")",
")",
"\n",
"}",
"\n",
"f",
":=",
"signatureFunc",
"(",
"on",
",",
"names",
"...",
")",
"\n",
"return",
"func",
"(",
"l",
"labels",
".",
"Labels",
")",
"uint64",
"{",
"h",
":=",
"l",
".",
"Hash",
"(",
")",
"\n",
"ret",
",",
"ok",
":=",
"enh",
".",
"sigf",
"[",
"h",
"]",
"\n",
"if",
"<mask>",
"{",
"return",
"ret",
"\n",
"}",
"\n",
"ret",
"=",
"f",
"(",
"l",
")",
"\n",
"enh",
".",
"sigf",
"[",
"h",
"]",
"=",
"ret",
"\n",
"return",
"ret",
"\n",
"}",
"\n",
"}"
] |
24,549 | all-24550 | [
"Write",
"serializes",
"the",
"frame",
"to",
"the",
"given",
"buffered",
"output",
"satisfies",
"the",
"Frame",
"interface",
"."
] | [
"func",
"(",
"e",
"Error",
")",
"Write",
"(",
"w",
"*",
"bufio",
".",
"<mask>",
")",
"(",
"err",
"error",
")",
"{",
"if",
"err",
"=",
"writeFrameHeader",
"(",
"w",
",",
"FrameTypeError",
",",
"len",
"(",
"e",
")",
")",
";",
"err",
"!=",
"nil",
"{",
"err",
"=",
"errors",
".",
"WithMessage",
"(",
"err",
",",
"\"",
"\"",
")",
"\n",
"return",
"\n",
"}",
"\n\n",
"if",
"_",
",",
"err",
"=",
"w",
".",
"WriteString",
"(",
"string",
"(",
"e",
")",
")",
";",
"err",
"!=",
"nil",
"{",
"err",
"=",
"errors",
".",
"Wrap",
"(",
"err",
",",
"\"",
"\"",
")",
"\n",
"return",
"\n",
"}",
"\n\n",
"return",
"\n",
"}"
] |
24,550 | all-24551 | [
"SetAvailabilityZone",
"mocks",
"base",
"method"
] | [
"func",
"(",
"m",
"*",
"MockManager",
")",
"SetAvailabilityZone",
"(",
"arg0",
"<mask>",
")",
"{",
"m",
".",
"ctrl",
".",
"Call",
"(",
"m",
",",
"\"",
"\"",
",",
"arg0",
")",
"\n",
"}"
] |
24,551 | all-24552 | [
"TODO",
":",
"Uncomment",
"when",
"gio",
"builds",
"successfully",
"AppChooserDialogNew",
"()",
"is",
"a",
"wrapper",
"around",
"gtk_app_chooser_dialog_new",
"()",
".",
"func",
"AppChooserDialogNew",
"(",
"parent",
"*",
"Window",
"flags",
"DialogFlags",
"file",
"*",
"gio",
".",
"File",
")",
"(",
"*",
"AppChooserDialog",
"error",
")",
"{",
"var",
"gfile",
"*",
"C",
".",
"GFile",
"if",
"file",
"!",
"=",
"nil",
"{",
"gfile",
"=",
"(",
"*",
"C",
".",
"GFile",
")",
"(",
"unsafe",
".",
"Pointer",
"(",
"file",
".",
"Native",
"()",
"))",
"}",
"c",
":",
"=",
"C",
".",
"gtk_app_chooser_dialog_new",
"(",
"parent",
".",
"native",
"()",
"C",
".",
"GtkDialogFlags",
"(",
"flags",
")",
"gfile",
")",
"if",
"c",
"==",
"nil",
"{",
"return",
"nil",
"nilPtrErr",
"}",
"return",
"wrapAppChooserDialog",
"(",
"glib",
".",
"Take",
"(",
"unsafe",
".",
"Pointer",
"(",
"c",
")))",
"nil",
"}",
"AppChooserDialogNewForContentType",
"()",
"is",
"a",
"wrapper",
"around",
"gtk_app_chooser_dialog_new_for_content_type",
"()",
"."
] | [
"func",
"AppChooserDialogNewForContentType",
"(",
"<mask>",
"*",
"Window",
",",
"flags",
"DialogFlags",
",",
"content_type",
"string",
")",
"(",
"*",
"AppChooserDialog",
",",
"error",
")",
"{",
"cstr",
":=",
"C",
".",
"CString",
"(",
"content_type",
")",
"\n",
"defer",
"C",
".",
"free",
"(",
"unsafe",
".",
"Pointer",
"(",
"cstr",
")",
")",
"\n",
"c",
":=",
"C",
".",
"gtk_app_chooser_dialog_new_for_content_type",
"(",
"parent",
".",
"native",
"(",
")",
",",
"C",
".",
"GtkDialogFlags",
"(",
"flags",
")",
",",
"(",
"*",
"C",
".",
"gchar",
")",
"(",
"cstr",
")",
")",
"\n",
"if",
"c",
"==",
"nil",
"{",
"return",
"nil",
",",
"nilPtrErr",
"\n",
"}",
"\n",
"return",
"wrapAppChooserDialog",
"(",
"glib",
".",
"Take",
"(",
"unsafe",
".",
"Pointer",
"(",
"c",
")",
")",
")",
",",
"nil",
"\n",
"}"
] |
24,552 | all-24553 | [
"datacentersFunc",
"returns",
"or",
"accumulates",
"datacenter",
"dependencies",
"."
] | [
"func",
"datacentersFunc",
"(",
"b",
"*",
"Brain",
",",
"used",
",",
"missing",
"*",
"dep",
".",
"Set",
")",
"func",
"(",
"ignore",
"...",
"bool",
")",
"(",
"[",
"]",
"string",
",",
"error",
")",
"{",
"return",
"func",
"(",
"i",
"...",
"bool",
")",
"(",
"[",
"]",
"string",
",",
"error",
")",
"{",
"result",
":=",
"[",
"]",
"string",
"{",
"}",
"\n\n",
"var",
"ignore",
"bool",
"\n",
"switch",
"len",
"(",
"i",
")",
"{",
"case",
"0",
":",
"ignore",
"=",
"false",
"\n",
"case",
"1",
":",
"ignore",
"=",
"i",
"[",
"0",
"]",
"\n",
"default",
":",
"return",
"<mask>",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
"+",
"\"",
"\"",
",",
"len",
"(",
"i",
")",
")",
"\n",
"}",
"\n\n",
"d",
",",
"err",
":=",
"dep",
".",
"NewCatalogDatacentersQuery",
"(",
"ignore",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"result",
",",
"err",
"\n",
"}",
"\n\n",
"used",
".",
"Add",
"(",
"d",
")",
"\n\n",
"if",
"value",
",",
"ok",
":=",
"b",
".",
"Recall",
"(",
"d",
")",
";",
"ok",
"{",
"return",
"value",
".",
"(",
"[",
"]",
"string",
")",
",",
"nil",
"\n",
"}",
"\n\n",
"missing",
".",
"Add",
"(",
"d",
")",
"\n\n",
"return",
"result",
",",
"nil",
"\n",
"}",
"\n",
"}"
] |
24,553 | all-24554 | [
"MarshalJSON",
"implements",
"json",
"marshaling",
"for",
"the",
"context"
] | [
"func",
"(",
"d",
"*",
"DefaultContext",
")",
"MarshalJSON",
"(",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"m",
":=",
"<mask>",
"[",
"string",
"]",
"interface",
"{",
"}",
"{",
"}",
"\n",
"data",
":=",
"d",
".",
"Data",
"(",
")",
"\n",
"for",
"k",
",",
"v",
":=",
"range",
"data",
"{",
"// don't try and marshal ourself",
"if",
"_",
",",
"ok",
":=",
"v",
".",
"(",
"*",
"DefaultContext",
")",
";",
"ok",
"{",
"continue",
"\n",
"}",
"\n",
"if",
"_",
",",
"err",
":=",
"json",
".",
"Marshal",
"(",
"v",
")",
";",
"err",
"==",
"nil",
"{",
"// it can be marshaled, so add it:",
"m",
"[",
"k",
"]",
"=",
"v",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"json",
".",
"Marshal",
"(",
"m",
")",
"\n",
"}"
] |
24,554 | all-24555 | [
"LoadFile",
"reads",
"a",
"schema",
"document",
"from",
"a",
"file",
"."
] | [
"func",
"LoadFile",
"(",
"filename",
"string",
",",
"parser",
"Parser",
")",
"(",
"Package",
",",
"error",
")",
"{",
"file",
",",
"err",
":=",
"os",
".",
"Open",
"(",
"filename",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"Package",
"{",
"}",
",",
"err",
"\n",
"}",
"\n",
"defer",
"file",
".",
"Close",
"(",
")",
"\n\n",
"// read file",
"bytes",
",",
"err",
":=",
"ioutil",
".",
"ReadAll",
"(",
"file",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"Package",
"{",
"}",
",",
"err",
"\n",
"}",
"\n\n",
"// convert to string and load",
"return",
"parser",
".",
"Parse",
"(",
"file",
".",
"<mask>",
"(",
")",
",",
"string",
"(",
"bytes",
")",
")",
"\n",
"}"
] |
24,555 | all-24556 | [
"GetOrg",
"returns",
"organization",
"from",
"org",
"or",
"user",
":",
"name",
"Org",
"can",
"be",
"organization",
"name",
"like",
"kubernetes",
"But",
"we",
"can",
"also",
"request",
"all",
"user",
"s",
"public",
"repos",
"via",
"user",
":",
"github_user_name"
] | [
"func",
"GetOrg",
"(",
"org",
"string",
")",
"(",
"string",
",",
"bool",
")",
"{",
"data",
":=",
"strings",
".",
"Split",
"(",
"org",
",",
"\"",
"\"",
")",
"\n",
"if",
"len",
"(",
"data",
")",
"==",
"2",
"&&",
"data",
"[",
"0",
"]",
"==",
"\"",
"\"",
"{",
"return",
"<mask>",
"[",
"1",
"]",
",",
"true",
"\n",
"}",
"\n",
"return",
"org",
",",
"false",
"\n",
"}"
] |
24,556 | all-24557 | [
"multiply",
"the",
"current",
"matrix",
"with",
"an",
"orthographic",
"matrix"
] | [
"func",
"Ortho",
"(",
"left",
"float64",
",",
"right",
"float64",
",",
"bottom",
"float64",
",",
"top",
"float64",
",",
"zNear",
"float64",
",",
"zFar",
"float64",
")",
"{",
"C",
".",
"glowOrtho",
"(",
"gpOrtho",
",",
"(",
"C",
".",
"GLdouble",
")",
"(",
"left",
")",
",",
"(",
"C",
".",
"GLdouble",
")",
"(",
"right",
")",
",",
"(",
"C",
".",
"GLdouble",
")",
"(",
"bottom",
")",
",",
"(",
"C",
".",
"GLdouble",
")",
"(",
"<mask>",
")",
",",
"(",
"C",
".",
"GLdouble",
")",
"(",
"zNear",
")",
",",
"(",
"C",
".",
"GLdouble",
")",
"(",
"zFar",
")",
")",
"\n",
"}"
] |
24,557 | all-24558 | [
"NewClient",
"creates",
"a",
"new",
"API",
"client",
"."
] | [
"func",
"NewClient",
"(",
"apiKey",
"string",
")",
"*",
"Client",
"{",
"return",
"&",
"Client",
"{",
"client",
":",
"&",
"http",
".",
"Client",
"{",
"Transport",
":",
"&",
"http",
".",
"Transport",
"{",
"<mask>",
":",
"http",
".",
"ProxyFromEnvironment",
",",
"DialContext",
":",
"(",
"&",
"net",
".",
"Dialer",
"{",
"Timeout",
":",
"30",
"*",
"time",
".",
"Second",
",",
"KeepAlive",
":",
"30",
"*",
"time",
".",
"Second",
",",
"DualStack",
":",
"true",
",",
"}",
")",
".",
"DialContext",
",",
"DisableKeepAlives",
":",
"true",
",",
"TLSHandshakeTimeout",
":",
"10",
"*",
"time",
".",
"Second",
",",
"ExpectContinueTimeout",
":",
"1",
"*",
"time",
".",
"Second",
",",
"}",
"}",
",",
"apiKey",
":",
"apiKey",
",",
"URL",
":",
"DefaultURL",
",",
"}",
"\n",
"}"
] |
24,558 | all-24559 | [
"UniqueStrings",
"returns",
"a",
"slice",
"of",
"randomly",
"generated",
"unique",
"strings",
"."
] | [
"func",
"UniqueStrings",
"(",
"slen",
"uint",
",",
"n",
"int",
")",
"(",
"ss",
"[",
"]",
"string",
")",
"{",
"exist",
":=",
"make",
"(",
"map",
"[",
"string",
"]",
"struct",
"{",
"}",
")",
"\n",
"ss",
"=",
"<mask>",
"(",
"[",
"]",
"string",
",",
"0",
",",
"n",
")",
"\n",
"for",
"len",
"(",
"ss",
")",
"<",
"n",
"{",
"s",
":=",
"randString",
"(",
"slen",
")",
"\n",
"if",
"_",
",",
"ok",
":=",
"exist",
"[",
"s",
"]",
";",
"!",
"ok",
"{",
"ss",
"=",
"append",
"(",
"ss",
",",
"s",
")",
"\n",
"exist",
"[",
"s",
"]",
"=",
"struct",
"{",
"}",
"{",
"}",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"ss",
"\n",
"}"
] |
24,559 | all-24560 | [
"specifies",
"the",
"parameters",
"for",
"patch",
"primitives"
] | [
"func",
"PatchParameteri",
"(",
"pname",
"uint32",
",",
"value",
"int32",
")",
"{",
"syscall",
".",
"Syscall",
"(",
"gpPatchParameteri",
",",
"2",
",",
"uintptr",
"(",
"pname",
")",
",",
"uintptr",
"(",
"<mask>",
")",
",",
"0",
")",
"\n",
"}"
] |
24,560 | all-24561 | [
"ReadLine",
"reads",
"unbuffered",
"until",
"a",
"newline",
"\\",
"n",
"byte",
"and",
"removes",
"an",
"optional",
"carriege",
"return",
"\\",
"r",
"at",
"the",
"end",
"of",
"the",
"line",
".",
"In",
"case",
"of",
"an",
"error",
"the",
"string",
"up",
"to",
"the",
"error",
"is",
"returned",
"."
] | [
"func",
"ReadLine",
"(",
"reader",
"io",
".",
"Reader",
")",
"(",
"<mask>",
"string",
",",
"err",
"error",
")",
"{",
"buffer",
":=",
"bytes",
".",
"NewBuffer",
"(",
"make",
"(",
"[",
"]",
"byte",
",",
"0",
",",
"4096",
")",
")",
"\n",
"p",
":=",
"make",
"(",
"[",
"]",
"byte",
",",
"1",
")",
"\n",
"for",
"{",
"var",
"n",
"int",
"\n",
"n",
",",
"err",
"=",
"reader",
".",
"Read",
"(",
"p",
")",
"\n",
"if",
"err",
"!=",
"nil",
"||",
"p",
"[",
"0",
"]",
"==",
"'\\n'",
"{",
"break",
"\n",
"}",
"\n",
"if",
"n",
">",
"0",
"{",
"buffer",
".",
"WriteByte",
"(",
"p",
"[",
"0",
"]",
")",
"\n",
"}",
"\n",
"}",
"\n",
"data",
":=",
"buffer",
".",
"Bytes",
"(",
")",
"\n",
"if",
"len",
"(",
"data",
")",
">",
"0",
"&&",
"data",
"[",
"len",
"(",
"data",
")",
"-",
"1",
"]",
"==",
"'\\r'",
"{",
"data",
"=",
"data",
"[",
":",
"len",
"(",
"data",
")",
"-",
"1",
"]",
"\n",
"}",
"\n",
"return",
"string",
"(",
"data",
")",
",",
"err",
"\n",
"}"
] |
24,561 | all-24562 | [
"leaseKeepAliveCommandFunc",
"executes",
"the",
"lease",
"keep",
"-",
"alive",
"command",
"."
] | [
"func",
"leaseKeepAliveCommandFunc",
"(",
"cmd",
"*",
"cobra",
".",
"Command",
",",
"args",
"[",
"]",
"string",
")",
"{",
"if",
"len",
"(",
"args",
")",
"!=",
"1",
"{",
"ExitWithError",
"(",
"ExitBadArgs",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
")",
")",
"\n",
"}",
"\n\n",
"id",
":=",
"leaseFromArgs",
"(",
"args",
"[",
"0",
"]",
")",
"\n\n",
"if",
"leaseKeepAliveOnce",
"{",
"respc",
",",
"kerr",
":=",
"mustClientFromCmd",
"(",
"cmd",
")",
".",
"KeepAliveOnce",
"(",
"context",
".",
"TODO",
"(",
")",
",",
"id",
")",
"\n",
"if",
"kerr",
"!=",
"nil",
"{",
"ExitWithError",
"(",
"ExitBadConnection",
",",
"kerr",
")",
"\n",
"}",
"\n",
"display",
".",
"KeepAlive",
"(",
"*",
"respc",
")",
"\n",
"return",
"\n",
"}",
"\n\n",
"respc",
",",
"kerr",
":=",
"mustClientFromCmd",
"(",
"cmd",
")",
".",
"KeepAlive",
"(",
"context",
".",
"TODO",
"(",
")",
",",
"id",
")",
"\n",
"if",
"kerr",
"!=",
"nil",
"{",
"ExitWithError",
"(",
"ExitBadConnection",
",",
"kerr",
")",
"\n",
"}",
"\n",
"for",
"resp",
":=",
"<mask>",
"respc",
"{",
"display",
".",
"KeepAlive",
"(",
"*",
"resp",
")",
"\n",
"}",
"\n\n",
"if",
"_",
",",
"ok",
":=",
"(",
"display",
")",
".",
"(",
"*",
"simplePrinter",
")",
";",
"ok",
"{",
"fmt",
".",
"Printf",
"(",
"\"",
"\\n",
"\"",
",",
"id",
")",
"\n",
"}",
"\n",
"}"
] |
24,562 | all-24563 | [
"MethodOverride",
"is",
"the",
"default",
"implementation",
"for",
"the",
"Options#MethodOverride",
".",
"By",
"default",
"it",
"will",
"look",
"for",
"a",
"form",
"value",
"name",
"_method",
"and",
"change",
"the",
"request",
"method",
"if",
"that",
"is",
"present",
"and",
"the",
"original",
"request",
"is",
"of",
"type",
"POST",
".",
"This",
"is",
"added",
"automatically",
"when",
"using",
"New",
"Buffalo",
"unless",
"an",
"alternative",
"is",
"defined",
"in",
"the",
"Options",
"."
] | [
"func",
"MethodOverride",
"(",
"<mask>",
"http",
".",
"ResponseWriter",
",",
"req",
"*",
"http",
".",
"Request",
")",
"{",
"if",
"req",
".",
"Method",
"==",
"\"",
"\"",
"{",
"req",
".",
"Method",
"=",
"defaults",
".",
"String",
"(",
"req",
".",
"FormValue",
"(",
"\"",
"\"",
")",
",",
"\"",
"\"",
")",
"\n",
"req",
".",
"Form",
".",
"Del",
"(",
"\"",
"\"",
")",
"\n",
"req",
".",
"PostForm",
".",
"Del",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"}"
] |
24,563 | all-24564 | [
"OSFamily",
"uses",
"the",
"compute",
"resource",
"s",
"environment",
"browser",
"to",
"get",
"the",
"OS",
"family",
"for",
"a",
"specific",
"guest",
"ID",
"."
] | [
"func",
"OSFamily",
"(",
"client",
"*",
"govmomi",
".",
"Client",
",",
"ref",
"types",
".",
"ManagedObjectReference",
",",
"guest",
"string",
")",
"(",
"string",
",",
"error",
")",
"{",
"b",
",",
"err",
":=",
"EnvironmentBrowserFromReference",
"(",
"<mask>",
",",
"ref",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"\"",
"\"",
",",
"err",
"\n",
"}",
"\n",
"ctx",
",",
"cancel",
":=",
"context",
".",
"WithTimeout",
"(",
"context",
".",
"Background",
"(",
")",
",",
"provider",
".",
"DefaultAPITimeout",
")",
"\n",
"defer",
"cancel",
"(",
")",
"\n",
"return",
"b",
".",
"OSFamily",
"(",
"ctx",
",",
"guest",
")",
"\n",
"}"
] |
24,564 | all-24565 | [
"MarshalJSON",
"supports",
"json",
".",
"Marshaler",
"interface"
] | [
"func",
"(",
"v",
"GetRelayoutBoundaryParams",
")",
"MarshalJSON",
"(",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"w",
":=",
"jwriter",
".",
"Writer",
"{",
"}",
"\n",
"easyjsonC5a4559bEncodeGithubComChromedpCdprotoDom35",
"(",
"&",
"w",
",",
"v",
")",
"\n",
"return",
"w",
".",
"<mask>",
".",
"BuildBytes",
"(",
")",
",",
"w",
".",
"Error",
"\n",
"}"
] |
24,565 | all-24566 | [
"PrintHeaders",
"prints",
"the",
"http",
"headers",
"as",
"k",
"v",
"pairs"
] | [
"func",
"(",
"r",
"*",
"Resp",
")",
"PrintHeaders",
"(",
")",
"{",
"for",
"key",
",",
"value",
":=",
"<mask>",
"r",
".",
"Headers",
"{",
"fmt",
".",
"Println",
"(",
"key",
",",
"\"",
"\"",
",",
"value",
"[",
"0",
"]",
")",
"\n",
"}",
"\n\n",
"}"
] |
24,566 | all-24567 | [
"MarshalJSON",
"supports",
"json",
".",
"Marshaler",
"interface"
] | [
"func",
"(",
"v",
"QuerySelectorAllParams",
")",
"MarshalJSON",
"(",
")",
"(",
"[",
"]",
"<mask>",
",",
"error",
")",
"{",
"w",
":=",
"jwriter",
".",
"Writer",
"{",
"}",
"\n",
"easyjsonC5a4559bEncodeGithubComChromedpCdprotoDom22",
"(",
"&",
"w",
",",
"v",
")",
"\n",
"return",
"w",
".",
"Buffer",
".",
"BuildBytes",
"(",
")",
",",
"w",
".",
"Error",
"\n",
"}"
] |
24,567 | all-24568 | [
"used",
"for",
"determine",
"the",
"fileLogger",
"f",
"is",
"time",
"to",
"split",
".",
"size",
":",
"once",
"the",
"current",
"fileLogger",
"s",
"fileSize",
">",
"=",
"config",
".",
"fileSize",
"need",
"to",
"split",
"daily",
":",
"once",
"the",
"current",
"fileLogger",
"stands",
"for",
"yesterday",
"need",
"to",
"split"
] | [
"func",
"(",
"f",
"*",
"FileLogger",
")",
"isMustSplit",
"(",
")",
"bool",
"{",
"switch",
"f",
".",
"splitType",
"{",
"<mask>",
"SplitType_Size",
":",
"logFile",
":=",
"joinFilePath",
"(",
"f",
".",
"fileDir",
",",
"f",
".",
"fileName",
")",
"\n",
"if",
"f",
".",
"fileCount",
">",
"1",
"{",
"if",
"fileSize",
"(",
"logFile",
")",
">=",
"f",
".",
"fileSize",
"{",
"return",
"true",
"\n",
"}",
"\n",
"}",
"\n",
"case",
"SplitType_Daily",
":",
"t",
",",
"_",
":=",
"time",
".",
"Parse",
"(",
"DATEFORMAT",
",",
"time",
".",
"Now",
"(",
")",
".",
"Format",
"(",
"DATEFORMAT",
")",
")",
"\n",
"if",
"t",
".",
"After",
"(",
"*",
"f",
".",
"date",
")",
"{",
"return",
"true",
"\n",
"}",
"\n",
"}",
"\n\n",
"return",
"false",
"\n",
"}"
] |
24,568 | all-24569 | [
"Delete",
"all",
"expired",
"items",
"from",
"the",
"cache",
"."
] | [
"func",
"(",
"c",
"*",
"cache",
")",
"DeleteExpired",
"(",
")",
"{",
"var",
"evictedItems",
"[",
"]",
"keyAndValue",
"\n",
"now",
":=",
"time",
".",
"Now",
"(",
")",
".",
"UnixNano",
"(",
")",
"\n",
"c",
".",
"mu",
".",
"Lock",
"(",
")",
"\n",
"for",
"k",
",",
"v",
":=",
"<mask>",
"c",
".",
"items",
"{",
"// \"Inlining\" of expired",
"if",
"v",
".",
"Expiration",
">",
"0",
"&&",
"now",
">",
"v",
".",
"Expiration",
"{",
"ov",
",",
"evicted",
":=",
"c",
".",
"delete",
"(",
"k",
")",
"\n",
"if",
"evicted",
"{",
"evictedItems",
"=",
"append",
"(",
"evictedItems",
",",
"keyAndValue",
"{",
"k",
",",
"ov",
"}",
")",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n",
"c",
".",
"mu",
".",
"Unlock",
"(",
")",
"\n",
"for",
"_",
",",
"v",
":=",
"range",
"evictedItems",
"{",
"c",
".",
"onEvicted",
"(",
"v",
".",
"key",
",",
"v",
".",
"value",
")",
"\n",
"}",
"\n",
"}"
] |
24,569 | all-24570 | [
"Lookup",
"()",
"is",
"a",
"wrapper",
"around",
"g_settings_schema_source_lookup",
"()",
"."
] | [
"func",
"(",
"v",
"*",
"SettingsSchemaSource",
")",
"Lookup",
"(",
"schema",
"string",
",",
"recursive",
"bool",
")",
"*",
"SettingsSchema",
"{",
"cstr",
":=",
"(",
"*",
"C",
".",
"gchar",
")",
"(",
"C",
".",
"CString",
"(",
"schema",
")",
")",
"\n",
"defer",
"C",
".",
"<mask>",
"(",
"unsafe",
".",
"Pointer",
"(",
"cstr",
")",
")",
"\n\n",
"return",
"wrapSettingsSchema",
"(",
"C",
".",
"g_settings_schema_source_lookup",
"(",
"v",
".",
"native",
"(",
")",
",",
"cstr",
",",
"gbool",
"(",
"recursive",
")",
")",
")",
"\n",
"}"
] |
24,570 | all-24571 | [
"DispatchOptional",
"implements",
"Dispatcher",
".",
"DispatchOptional"
] | [
"func",
"(",
"d",
"*",
"SerialDispatcher",
")",
"DispatchOptional",
"(",
"cmd",
"interface",
"{",
"}",
")",
"(",
"err",
"error",
")",
"{",
"d",
".",
"mutex",
".",
"RLock",
"(",
")",
"\n",
"defer",
"d",
".",
"mutex",
".",
"RUnlock",
"(",
")",
"\n\n",
"err",
"=",
"d",
".",
"Dispatch",
"(",
"cmd",
")",
"\n",
"<mask>",
"err",
".",
"(",
"type",
")",
"{",
"case",
"*",
"NoHandlerFoundError",
":",
"return",
"nil",
"\n",
"default",
":",
"return",
"err",
"\n",
"}",
"\n",
"}"
] |
24,571 | all-24572 | [
"Child",
"returns",
"the",
"child",
"snapshot",
"corresponding",
"to",
"the",
"index",
"parameter",
".",
"Parameters",
":",
"index",
":",
"Index",
"into",
"the",
"list",
"of",
"snapshots",
".",
"Remarks",
":",
"*",
"Snapshots",
"are",
"indexed",
"from",
"0",
"to",
"n",
"-",
"1",
"where",
"n",
"is",
"the",
"number",
"of",
"child",
"snapshots",
".",
"Use",
"the",
"function",
"Snapshot",
".",
"NumChildren",
"()",
"to",
"get",
"the",
"value",
"of",
"n",
".",
"*",
"This",
"function",
"is",
"not",
"supported",
"when",
"using",
"the",
"VMWARE_PLAYER",
"provider",
".",
"Since",
"VMware",
"Workstation",
"6",
".",
"0"
] | [
"func",
"(",
"s",
"*",
"Snapshot",
")",
"Child",
"(",
"index",
"int",
")",
"(",
"*",
"Snapshot",
",",
"error",
")",
"{",
"var",
"snapshotHandle",
"C",
".",
"VixHandle",
"=",
"C",
".",
"VIX_INVALID_HANDLE",
"\n",
"var",
"err",
"C",
".",
"VixError",
"=",
"C",
".",
"VIX_OK",
"\n\n",
"err",
"=",
"C",
".",
"VixSnapshot_GetChild",
"(",
"s",
".",
"handle",
",",
"C",
".",
"int",
"(",
"index",
")",
",",
"//index",
"&",
"snapshotHandle",
")",
"//(output) A handle to the child snapshot.",
"\n\n",
"if",
"C",
".",
"VIX_OK",
"!=",
"err",
"{",
"return",
"nil",
",",
"&",
"Error",
"{",
"Operation",
":",
"\"",
"\"",
",",
"Code",
":",
"int",
"(",
"err",
"&",
"0xFFFF",
")",
",",
"Text",
":",
"C",
".",
"GoString",
"(",
"C",
".",
"Vix_GetErrorText",
"(",
"err",
",",
"nil",
")",
")",
",",
"}",
"\n",
"}",
"\n\n",
"snapshot",
":=",
"&",
"Snapshot",
"{",
"<mask>",
":",
"snapshotHandle",
",",
"}",
"\n\n",
"runtime",
".",
"SetFinalizer",
"(",
"snapshot",
",",
"cleanupSnapshot",
")",
"\n\n",
"return",
"snapshot",
",",
"nil",
"\n",
"}"
] |
24,572 | all-24573 | [
"NewFieldError",
"initializes",
"FormErrors",
"with",
"one",
"field",
"error",
"."
] | [
"func",
"NewFieldError",
"(",
"field",
",",
"e",
"string",
")",
"FormErrors",
"{",
"errors",
":=",
"FormErrors",
"{",
"}",
"\n",
"errors",
".",
"AddFieldError",
"(",
"field",
",",
"e",
")",
"\n",
"return",
"<mask>",
"\n",
"}"
] |
24,573 | all-24574 | [
"baseVirtualEthernetCardToBaseVirtualDevice",
"converts",
"a",
"BaseVirtualEthernetCard",
"value",
"into",
"a",
"BaseVirtualDevice",
"."
] | [
"func",
"baseVirtualEthernetCardToBaseVirtualDevice",
"(",
"v",
"types",
".",
"BaseVirtualEthernetCard",
")",
"types",
".",
"BaseVirtualDevice",
"{",
"switch",
"t",
":=",
"v",
".",
"(",
"type",
")",
"{",
"case",
"*",
"types",
".",
"VirtualE1000",
":",
"return",
"types",
".",
"BaseVirtualDevice",
"(",
"t",
")",
"\n",
"case",
"*",
"types",
".",
"VirtualE1000e",
":",
"return",
"types",
".",
"BaseVirtualDevice",
"(",
"t",
")",
"\n",
"case",
"*",
"types",
".",
"VirtualPCNet32",
":",
"return",
"types",
".",
"BaseVirtualDevice",
"(",
"t",
")",
"\n",
"case",
"*",
"<mask>",
".",
"VirtualSriovEthernetCard",
":",
"return",
"types",
".",
"BaseVirtualDevice",
"(",
"t",
")",
"\n",
"case",
"*",
"types",
".",
"VirtualVmxnet2",
":",
"return",
"types",
".",
"BaseVirtualDevice",
"(",
"t",
")",
"\n",
"case",
"*",
"types",
".",
"VirtualVmxnet3",
":",
"return",
"types",
".",
"BaseVirtualDevice",
"(",
"t",
")",
"\n",
"}",
"\n",
"panic",
"(",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"v",
")",
")",
"\n",
"}"
] |
24,574 | all-24575 | [
"ListDatumF",
"returns",
"info",
"about",
"all",
"datums",
"in",
"a",
"Job",
"calling",
"f",
"with",
"each",
"datum",
"info",
"."
] | [
"func",
"(",
"c",
"APIClient",
")",
"ListDatumF",
"(",
"jobID",
"string",
",",
"pageSize",
"int64",
",",
"page",
"int64",
",",
"f",
"func",
"(",
"di",
"*",
"pps",
".",
"DatumInfo",
")",
"error",
")",
"error",
"{",
"client",
",",
"err",
":=",
"c",
".",
"PpsAPIClient",
".",
"ListDatumStream",
"(",
"c",
".",
"Ctx",
"(",
")",
",",
"&",
"pps",
".",
"ListDatumRequest",
"{",
"Job",
":",
"NewJob",
"(",
"jobID",
")",
",",
"PageSize",
":",
"pageSize",
",",
"Page",
":",
"<mask>",
",",
"}",
",",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"grpcutil",
".",
"ScrubGRPC",
"(",
"err",
")",
"\n",
"}",
"\n",
"for",
"{",
"resp",
",",
"err",
":=",
"client",
".",
"Recv",
"(",
")",
"\n",
"if",
"err",
"==",
"io",
".",
"EOF",
"{",
"return",
"nil",
"\n",
"}",
"else",
"if",
"err",
"!=",
"nil",
"{",
"return",
"grpcutil",
".",
"ScrubGRPC",
"(",
"err",
")",
"\n",
"}",
"\n",
"if",
"err",
":=",
"f",
"(",
"resp",
".",
"DatumInfo",
")",
";",
"err",
"!=",
"nil",
"{",
"if",
"err",
"==",
"errutil",
".",
"ErrBreak",
"{",
"return",
"nil",
"\n",
"}",
"\n",
"return",
"err",
"\n",
"}",
"\n",
"}",
"\n",
"}"
] |
24,575 | all-24576 | [
"pack14",
"packs",
"14",
"values",
"from",
"in",
"using",
"2",
"bits",
"each"
] | [
"func",
"pack14",
"(",
"in",
"[",
"]",
"uint32",
")",
"uint32",
"{",
"return",
"1",
"<<",
"28",
"|",
"in",
"[",
"0",
"]",
"|",
"in",
"[",
"1",
"]",
"<<",
"2",
"|",
"in",
"[",
"2",
"]",
"<<",
"4",
"|",
"in",
"[",
"3",
"]",
"<<",
"6",
"|",
"in",
"[",
"4",
"]",
"<<",
"8",
"|",
"in",
"[",
"5",
"]",
"<<",
"10",
"|",
"in",
"[",
"6",
"]",
"<<",
"12",
"|",
"in",
"[",
"7",
"]",
"<<",
"14",
"|",
"in",
"[",
"8",
"]",
"<<",
"16",
"|",
"in",
"[",
"9",
"]",
"<<",
"18",
"|",
"in",
"[",
"10",
"]",
"<<",
"20",
"|",
"in",
"[",
"11",
"]",
"<<",
"22",
"|",
"<mask>",
"[",
"12",
"]",
"<<",
"24",
"|",
"in",
"[",
"13",
"]",
"<<",
"26",
"\n",
"}"
] |
24,576 | all-24577 | [
"Compare",
"is",
"a",
"wrapper",
"around",
"gtk_text_iter_compare",
"()",
"."
] | [
"func",
"(",
"v",
"*",
"TextIter",
")",
"Compare",
"(",
"v1",
"*",
"TextIter",
")",
"int",
"{",
"<mask>",
"int",
"(",
"C",
".",
"gtk_text_iter_compare",
"(",
"v",
".",
"native",
"(",
")",
",",
"v1",
".",
"native",
"(",
")",
")",
")",
"\n",
"}"
] |
24,577 | all-24578 | [
"Execute",
"-",
"adds",
"a",
"named",
"org",
"to",
"the",
"configuration"
] | [
"func",
"(",
"c",
"*",
"AddOrgToConfigurationCommand",
")",
"Execute",
"(",
"[",
"]",
"string",
")",
"error",
"{",
"lo",
".",
"G",
".",
"Warning",
"(",
"\"",
"\"",
")",
"\n",
"orgConfig",
":=",
"&",
"config",
".",
"OrgConfig",
"{",
"Org",
":",
"c",
".",
"OrgName",
",",
"BillingManagerGroup",
":",
"c",
".",
"OrgBillingMgrGroup",
",",
"ManagerGroup",
":",
"c",
".",
"OrgMgrGroup",
",",
"AuditorGroup",
":",
"c",
".",
"OrgAuditorGroup",
",",
"RemoveUsers",
":",
"true",
",",
"RemovePrivateDomains",
":",
"true",
",",
"}",
"\n",
"spacesConfig",
":=",
"&",
"config",
".",
"Spaces",
"{",
"Org",
":",
"orgConfig",
".",
"Org",
",",
"EnableDeleteSpaces",
":",
"<mask>",
"}",
"\n",
"return",
"config",
".",
"NewManager",
"(",
"c",
".",
"ConfigDirectory",
")",
".",
"AddOrgToConfig",
"(",
"orgConfig",
",",
"spacesConfig",
")",
"\n",
"}"
] |
24,578 | all-24579 | [
"GetError",
"()",
"is",
"a",
"wrapper",
"around",
"gtk_print_operation_get_error",
"()",
"."
] | [
"func",
"(",
"<mask>",
"*",
"PrintOperation",
")",
"PrintOperationGetError",
"(",
")",
"error",
"{",
"var",
"err",
"*",
"C",
".",
"GError",
"=",
"nil",
"\n",
"C",
".",
"gtk_print_operation_get_error",
"(",
"po",
".",
"native",
"(",
")",
",",
"&",
"err",
")",
"\n",
"defer",
"C",
".",
"g_error_free",
"(",
"err",
")",
"\n",
"return",
"errors",
".",
"New",
"(",
"C",
".",
"GoString",
"(",
"(",
"*",
"C",
".",
"char",
")",
"(",
"err",
".",
"message",
")",
")",
")",
"\n",
"}"
] |
24,579 | all-24580 | [
"GetRef",
"returns",
"the",
"SHA",
"of",
"the",
"given",
"ref",
"such",
"as",
"heads",
"/",
"master",
".",
"See",
"https",
":",
"//",
"developer",
".",
"github",
".",
"com",
"/",
"v3",
"/",
"git",
"/",
"refs",
"/",
"#get",
"-",
"a",
"-",
"reference"
] | [
"func",
"(",
"c",
"*",
"Client",
")",
"GetRef",
"(",
"org",
",",
"repo",
",",
"ref",
"string",
")",
"(",
"string",
",",
"error",
")",
"{",
"c",
".",
"log",
"(",
"\"",
"\"",
",",
"org",
",",
"repo",
",",
"ref",
")",
"\n",
"var",
"res",
"struct",
"{",
"Object",
"map",
"[",
"string",
"]",
"string",
"`json:\"object\"`",
"\n",
"}",
"\n",
"_",
",",
"err",
":=",
"c",
".",
"<mask>",
"(",
"&",
"request",
"{",
"method",
":",
"http",
".",
"MethodGet",
",",
"path",
":",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"org",
",",
"repo",
",",
"ref",
")",
",",
"exitCodes",
":",
"[",
"]",
"int",
"{",
"200",
"}",
",",
"}",
",",
"&",
"res",
")",
"\n",
"return",
"res",
".",
"Object",
"[",
"\"",
"\"",
"]",
",",
"err",
"\n",
"}"
] |
24,580 | all-24581 | [
"CreateAlert",
"adds",
"a",
"new",
"alert",
"to",
"the",
"system",
".",
"This",
"returns",
"a",
"pointer",
"to",
"an",
"Alert",
"so",
"you",
"can",
"pass",
"that",
"to",
"UpdateAlert",
"later",
"if",
"needed",
"."
] | [
"func",
"(",
"client",
"*",
"Client",
")",
"CreateAlert",
"(",
"alert",
"*",
"Alert",
")",
"(",
"*",
"Alert",
",",
"error",
")",
"{",
"var",
"out",
"Alert",
"\n",
"if",
"err",
":=",
"client",
".",
"doJsonRequest",
"(",
"\"",
"\"",
",",
"\"",
"\"",
",",
"<mask>",
",",
"&",
"out",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"return",
"&",
"out",
",",
"nil",
"\n",
"}"
] |
24,581 | all-24582 | [
"osDiskStorageContainerURL",
"crafts",
"a",
"URL",
"with",
"a",
"trailing",
"slash",
"pointing",
"to",
"the",
"full",
"Azure",
"Blob",
"Container",
"URL",
"for",
"given",
"VM",
"name",
"."
] | [
"func",
"osDiskStorageContainerURL",
"(",
"account",
"*",
"<mask>",
".",
"AccountProperties",
",",
"vmName",
"string",
")",
"string",
"{",
"return",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"to",
".",
"String",
"(",
"account",
".",
"PrimaryEndpoints",
".",
"Blob",
")",
",",
"osDiskStorageContainerName",
"(",
"vmName",
")",
")",
"\n",
"}"
] |
24,582 | all-24583 | [
"Fetches",
"a",
"rant",
"and",
"its",
"comments",
"given",
"a",
"valid",
"rant",
"id"
] | [
"func",
"(",
"c",
"*",
"Client",
")",
"Rant",
"(",
"rantId",
"int",
")",
"(",
"RantModel",
",",
"[",
"]",
"CommentModel",
",",
"error",
")",
"{",
"url",
":=",
"fmt",
".",
"Sprintf",
"(",
"RANT_PATH",
",",
"API",
",",
"rantId",
",",
"APP_VERSION",
")",
"\n",
"res",
",",
"err",
":=",
"http",
".",
"Get",
"(",
"url",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"RantModel",
"{",
"}",
",",
"nil",
",",
"err",
"\n",
"}",
"\n",
"var",
"data",
"RantResponse",
"\n",
"json",
".",
"NewDecoder",
"(",
"res",
".",
"Body",
")",
".",
"Decode",
"(",
"&",
"data",
")",
"\n",
"if",
"!",
"data",
".",
"Success",
"&&",
"<mask>",
".",
"Error",
"!=",
"\"",
"\"",
"{",
"return",
"RantModel",
"{",
"}",
",",
"nil",
",",
"errors",
".",
"New",
"(",
"data",
".",
"Error",
")",
"\n",
"}",
"\n",
"return",
"data",
".",
"Rant",
",",
"data",
".",
"Comments",
",",
"nil",
"\n",
"}"
] |
24,583 | all-24584 | [
"updatePeer",
"updates",
"the",
"score",
"for",
"the",
"given",
"peer",
"."
] | [
"func",
"(",
"ph",
"*",
"peerHeap",
")",
"updatePeer",
"(",
"peerScore",
"*",
"peerScore",
")",
"{",
"heap",
".",
"Fix",
"(",
"ph",
",",
"peerScore",
".",
"<mask>",
")",
"\n",
"}"
] |
24,584 | all-24585 | [
"RunFilter",
"sorts",
"items",
"by",
"the",
"specified",
"sorting",
"keys",
".",
"It",
"implements",
"the",
"Filter",
"interface",
"."
] | [
"func",
"(",
"s",
"*",
"SortFilter",
")",
"RunFilter",
"(",
"arg",
"Arg",
")",
"error",
"{",
"state",
":=",
"sortState",
"{",
"s",
".",
"cmp",
",",
"nil",
"}",
"\n",
"for",
"item",
":=",
"range",
"arg",
".",
"In",
"{",
"state",
".",
"data",
"=",
"append",
"(",
"<mask>",
".",
"data",
",",
"item",
")",
"\n",
"}",
"\n",
"sort",
".",
"Sort",
"(",
"state",
")",
"\n",
"for",
"_",
",",
"item",
":=",
"range",
"state",
".",
"data",
"{",
"arg",
".",
"Out",
"<-",
"item",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
] |
24,585 | all-24586 | [
"IsAWSErrorCodeEqual",
"returns",
"true",
"if",
"the",
"err",
"implements",
"Error",
"interface",
"of",
"awserr",
"and",
"it",
"has",
"the",
"same",
"error",
"code",
"as",
"the",
"passed",
"in",
"error",
"code",
"."
] | [
"func",
"IsAWSErrorCodeEqual",
"(",
"err",
"error",
",",
"code",
"string",
")",
"bool",
"{",
"awsErr",
",",
"ok",
":=",
"err",
".",
"(",
"awserr",
".",
"<mask>",
")",
"\n",
"return",
"ok",
"&&",
"awsErr",
".",
"Code",
"(",
")",
"==",
"code",
"\n",
"}"
] |
24,586 | all-24587 | [
"FetchAccounts",
"retrieves",
"all",
"accounts",
"available",
"to",
"the",
"API",
"Token",
"."
] | [
"func",
"(",
"a",
"*",
"API",
")",
"FetchAccounts",
"(",
")",
"(",
"*",
"[",
"]",
"Account",
",",
"error",
")",
"{",
"<mask>",
",",
"err",
":=",
"a",
".",
"Get",
"(",
"config",
".",
"AccountPrefix",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"var",
"accounts",
"[",
"]",
"Account",
"\n",
"if",
"err",
":=",
"json",
".",
"Unmarshal",
"(",
"result",
",",
"&",
"accounts",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"return",
"&",
"accounts",
",",
"nil",
"\n",
"}"
] |
24,587 | all-24588 | [
"UnmarshalJSON",
"supports",
"json",
".",
"Unmarshaler",
"interface"
] | [
"func",
"(",
"v",
"*",
"SetEmitTouchEventsForMouseParams",
")",
"UnmarshalJSON",
"(",
"<mask>",
"[",
"]",
"byte",
")",
"error",
"{",
"r",
":=",
"jlexer",
".",
"Lexer",
"{",
"Data",
":",
"data",
"}",
"\n",
"easyjsonC5a4559bDecodeGithubComChromedpCdprotoEmulation10",
"(",
"&",
"r",
",",
"v",
")",
"\n",
"return",
"r",
".",
"Error",
"(",
")",
"\n",
"}"
] |
24,588 | all-24589 | [
"AddBytesKV",
"adds",
"the",
"given",
"key",
":",
"value",
"header",
".",
"Multiple",
"headers",
"with",
"the",
"same",
"key",
"may",
"be",
"added",
"with",
"this",
"function",
".",
"Use",
"SetBytesKV",
"for",
"setting",
"a",
"single",
"header",
"for",
"the",
"given",
"key",
"."
] | [
"func",
"(",
"h",
"*",
"ResponseHeader",
")",
"AddBytesKV",
"(",
"key",
",",
"value",
"[",
"]",
"byte",
")",
"{",
"h",
".",
"Add",
"(",
"b2s",
"(",
"<mask>",
")",
",",
"b2s",
"(",
"value",
")",
")",
"\n",
"}"
] |
24,589 | all-24590 | [
"Metric",
"gets",
"the",
"metric",
"value",
"for",
"a",
"member"
] | [
"func",
"(",
"m",
"*",
"member",
")",
"Metric",
"(",
"metricName",
"string",
")",
"(",
"string",
",",
"error",
")",
"{",
"cfgtls",
":=",
"transport",
".",
"TLSInfo",
"{",
"}",
"\n",
"tr",
",",
"err",
":=",
"transport",
".",
"NewTimeoutTransport",
"(",
"cfgtls",
",",
"time",
".",
"Second",
",",
"time",
".",
"Second",
",",
"<mask>",
".",
"Second",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"\"",
"\"",
",",
"err",
"\n",
"}",
"\n",
"cli",
":=",
"&",
"http",
".",
"Client",
"{",
"Transport",
":",
"tr",
"}",
"\n",
"resp",
",",
"err",
":=",
"cli",
".",
"Get",
"(",
"m",
".",
"ClientURLs",
"[",
"0",
"]",
".",
"String",
"(",
")",
"+",
"\"",
"\"",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"\"",
"\"",
",",
"err",
"\n",
"}",
"\n",
"defer",
"resp",
".",
"Body",
".",
"Close",
"(",
")",
"\n",
"b",
",",
"rerr",
":=",
"ioutil",
".",
"ReadAll",
"(",
"resp",
".",
"Body",
")",
"\n",
"if",
"rerr",
"!=",
"nil",
"{",
"return",
"\"",
"\"",
",",
"rerr",
"\n",
"}",
"\n",
"lines",
":=",
"strings",
".",
"Split",
"(",
"string",
"(",
"b",
")",
",",
"\"",
"\\n",
"\"",
")",
"\n",
"for",
"_",
",",
"l",
":=",
"range",
"lines",
"{",
"if",
"strings",
".",
"HasPrefix",
"(",
"l",
",",
"metricName",
")",
"{",
"return",
"strings",
".",
"Split",
"(",
"l",
",",
"\"",
"\"",
")",
"[",
"1",
"]",
",",
"nil",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"\"",
"\"",
",",
"nil",
"\n",
"}"
] |
24,590 | all-24591 | [
"Up",
"brings",
"up",
"all",
"configured",
"endpoints",
"and",
"starts",
"accepting",
"HTTP",
"requests",
"."
] | [
"func",
"(",
"e",
"*",
"Endpoints",
")",
"up",
"(",
"config",
"*",
"Config",
")",
"error",
"{",
"e",
".",
"mu",
".",
"Lock",
"(",
")",
"\n",
"defer",
"e",
".",
"mu",
".",
"Unlock",
"(",
")",
"\n\n",
"e",
".",
"servers",
"=",
"map",
"[",
"kind",
"]",
"*",
"http",
".",
"Server",
"{",
"devlxd",
":",
"config",
".",
"DevLxdServer",
",",
"local",
":",
"config",
".",
"RestServer",
",",
"network",
":",
"config",
".",
"RestServer",
",",
"cluster",
":",
"config",
".",
"RestServer",
",",
"pprof",
":",
"pprofCreateServer",
"(",
")",
",",
"}",
"\n",
"e",
".",
"cert",
"=",
"config",
".",
"Cert",
"\n",
"e",
".",
"inherited",
"=",
"map",
"[",
"kind",
"]",
"bool",
"{",
"}",
"\n\n",
"var",
"err",
"error",
"\n\n",
"// Check for socket activation.",
"systemdListeners",
":=",
"util",
".",
"GetListeners",
"(",
"e",
".",
"systemdListenFDsStart",
")",
"\n",
"if",
"len",
"(",
"systemdListeners",
")",
">",
"0",
"{",
"e",
".",
"listeners",
"=",
"activatedListeners",
"(",
"systemdListeners",
",",
"e",
".",
"cert",
")",
"\n",
"for",
"kind",
":=",
"range",
"e",
".",
"listeners",
"{",
"e",
".",
"inherited",
"[",
"kind",
"]",
"=",
"true",
"\n",
"}",
"\n",
"}",
"else",
"{",
"e",
".",
"listeners",
"=",
"map",
"[",
"kind",
"]",
"net",
".",
"Listener",
"{",
"}",
"\n\n",
"e",
".",
"listeners",
"[",
"local",
"]",
",",
"err",
"=",
"localCreateListener",
"(",
"config",
".",
"UnixSocket",
",",
"config",
".",
"LocalUnixSocketGroup",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"}",
"\n",
"}",
"\n\n",
"// Start the devlxd listener",
"e",
".",
"listeners",
"[",
"devlxd",
"]",
",",
"err",
"=",
"createDevLxdlListener",
"(",
"config",
".",
"Dir",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"if",
"config",
".",
"NetworkAddress",
"!=",
"\"",
"\"",
"{",
"listener",
",",
"ok",
":=",
"e",
".",
"listeners",
"[",
"network",
"]",
"\n",
"if",
"<mask>",
"{",
"logger",
".",
"Infof",
"(",
"\"",
"\"",
")",
"\n",
"listener",
".",
"Close",
"(",
")",
"\n",
"e",
".",
"inherited",
"[",
"network",
"]",
"=",
"false",
"\n",
"}",
"\n\n",
"// Errors here are not fatal and are just logged.",
"e",
".",
"listeners",
"[",
"network",
"]",
"=",
"networkCreateListener",
"(",
"config",
".",
"NetworkAddress",
",",
"e",
".",
"cert",
")",
"\n\n",
"isCovered",
":=",
"util",
".",
"IsAddressCovered",
"(",
"config",
".",
"ClusterAddress",
",",
"config",
".",
"NetworkAddress",
")",
"\n",
"if",
"config",
".",
"ClusterAddress",
"!=",
"\"",
"\"",
"&&",
"!",
"isCovered",
"{",
"e",
".",
"listeners",
"[",
"cluster",
"]",
",",
"err",
"=",
"clusterCreateListener",
"(",
"config",
".",
"ClusterAddress",
",",
"e",
".",
"cert",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"logger",
".",
"Infof",
"(",
"\"",
"\"",
")",
"\n",
"e",
".",
"serveHTTP",
"(",
"cluster",
")",
"\n",
"}",
"\n\n",
"}",
"\n\n",
"if",
"config",
".",
"DebugAddress",
"!=",
"\"",
"\"",
"{",
"e",
".",
"listeners",
"[",
"pprof",
"]",
",",
"err",
"=",
"pprofCreateListener",
"(",
"config",
".",
"DebugAddress",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"logger",
".",
"Infof",
"(",
"\"",
"\"",
")",
"\n",
"e",
".",
"serveHTTP",
"(",
"pprof",
")",
"\n",
"}",
"\n\n",
"logger",
".",
"Infof",
"(",
"\"",
"\"",
")",
"\n",
"e",
".",
"serveHTTP",
"(",
"devlxd",
")",
"\n\n",
"logger",
".",
"Infof",
"(",
"\"",
"\"",
")",
"\n",
"e",
".",
"serveHTTP",
"(",
"local",
")",
"\n",
"e",
".",
"serveHTTP",
"(",
"network",
")",
"\n\n",
"return",
"nil",
"\n",
"}"
] |
24,591 | all-24592 | [
"DeriveScale",
"fetches",
"an",
"instrument",
"from",
"the",
"registry",
"or",
"creates",
"a",
"new",
"one",
"with",
"a",
"custom",
"scale",
".",
"If",
"another",
"instrument",
"type",
"is",
"already",
"registered",
"with",
"the",
"same",
"name",
"/",
"tags",
"a",
"blank",
"one",
"will",
"be",
"returned",
"and",
"an",
"error",
"will",
"be",
"logged",
"to",
"the",
"Errors",
"()",
"channel",
"."
] | [
"func",
"(",
"r",
"*",
"Registry",
")",
"DeriveScale",
"(",
"name",
"string",
",",
"tags",
"[",
"]",
"string",
",",
"v",
"float64",
",",
"d",
"time",
".",
"Duration",
")",
"*",
"Derive",
"{",
"factory",
":=",
"func",
"(",
")",
"interface",
"{",
"}",
"{",
"return",
"NewDeriveScale",
"(",
"v",
",",
"d",
")",
"}",
"\n",
"return",
"r",
".",
"fetchDerive",
"(",
"name",
",",
"<mask>",
",",
"factory",
")",
"\n",
"}"
] |
24,592 | all-24593 | [
"Do",
"executes",
"Runtime",
".",
"callFunctionOn",
"against",
"the",
"provided",
"context",
".",
"returns",
":",
"result",
"-",
"Call",
"result",
".",
"exceptionDetails",
"-",
"Exception",
"details",
"."
] | [
"func",
"(",
"p",
"*",
"CallFunctionOnParams",
")",
"Do",
"(",
"ctx",
"context",
".",
"Context",
")",
"(",
"result",
"*",
"RemoteObject",
",",
"exceptionDetails",
"*",
"ExceptionDetails",
",",
"err",
"error",
")",
"{",
"// execute",
"var",
"res",
"CallFunctionOnReturns",
"\n",
"err",
"=",
"cdp",
".",
"Execute",
"(",
"ctx",
",",
"CommandCallFunctionOn",
",",
"p",
",",
"&",
"<mask>",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"return",
"res",
".",
"Result",
",",
"res",
".",
"ExceptionDetails",
",",
"nil",
"\n",
"}"
] |
24,593 | all-24594 | [
"Remove",
"removes",
"RangerEntry",
"identified",
"by",
"given",
"network",
"from",
"trie",
"."
] | [
"func",
"(",
"p",
"*",
"prefixTrie",
")",
"Remove",
"(",
"network",
"<mask>",
".",
"IPNet",
")",
"(",
"RangerEntry",
",",
"error",
")",
"{",
"return",
"p",
".",
"remove",
"(",
"rnet",
".",
"NewNetwork",
"(",
"network",
")",
")",
"\n",
"}"
] |
24,594 | all-24595 | [
"Status",
"returns",
"true",
"if",
"maintenance",
"is",
"enabled",
"."
] | [
"func",
"(",
"s",
"*",
"MemoryStore",
")",
"Status",
"(",
")",
"(",
"on",
"bool",
",",
"err",
"error",
")",
"{",
"s",
".",
"mu",
".",
"Lock",
"(",
")",
"\n",
"<mask>",
"=",
"s",
".",
"on",
"\n",
"s",
".",
"mu",
".",
"Unlock",
"(",
")",
"\n",
"return",
"\n",
"}"
] |
24,595 | all-24596 | [
"handleResourceStateChange",
"attempts",
"to",
"update",
"resource",
"s",
"known",
"status",
"depending",
"on",
"the",
"current",
"status",
"and",
"errors",
"during",
"transition"
] | [
"func",
"(",
"mtask",
"*",
"managedTask",
")",
"handleResourceStateChange",
"(",
"resChange",
"resourceStateChange",
")",
"{",
"// locate the resource",
"res",
":=",
"resChange",
".",
"resource",
"\n",
"if",
"!",
"mtask",
".",
"isResourceFound",
"(",
"res",
")",
"{",
"seelog",
".",
"Criticalf",
"(",
"\"",
"\"",
",",
"mtask",
".",
"Arn",
",",
"res",
".",
"GetName",
"(",
")",
")",
"\n",
"return",
"\n",
"}",
"\n\n",
"status",
":=",
"resChange",
".",
"nextState",
"\n",
"err",
":=",
"resChange",
".",
"err",
"\n",
"currentKnownStatus",
":=",
"res",
".",
"GetKnownStatus",
"(",
")",
"\n\n",
"if",
"status",
"<=",
"currentKnownStatus",
"{",
"seelog",
".",
"Infof",
"(",
"\"",
"\"",
",",
"mtask",
".",
"Arn",
",",
"res",
".",
"GetName",
"(",
")",
",",
"res",
".",
"StatusString",
"(",
"status",
")",
",",
"res",
".",
"StatusString",
"(",
"currentKnownStatus",
")",
")",
"\n",
"return",
"\n",
"}",
"\n\n",
"if",
"err",
"==",
"nil",
"{",
"res",
".",
"SetKnownStatus",
"(",
"status",
")",
"\n",
"mtask",
".",
"engine",
".",
"saver",
".",
"Save",
"(",
")",
"\n",
"return",
"\n",
"}",
"\n",
"seelog",
".",
"Debugf",
"(",
"\"",
"\"",
",",
"mtask",
".",
"Arn",
",",
"res",
".",
"GetName",
"(",
")",
",",
"res",
".",
"StatusString",
"(",
"status",
")",
",",
"err",
")",
"\n",
"if",
"status",
"==",
"res",
".",
"SteadyState",
"(",
")",
"{",
"seelog",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"mtask",
".",
"Arn",
",",
"res",
".",
"GetName",
"(",
")",
")",
"\n",
"mtask",
".",
"SetDesiredStatus",
"(",
"apitaskstatus",
".",
"TaskStopped",
")",
"\n",
"mtask",
".",
"<mask>",
".",
"SetTerminalReason",
"(",
"res",
".",
"GetTerminalReason",
"(",
")",
")",
"\n",
"mtask",
".",
"engine",
".",
"saver",
".",
"Save",
"(",
")",
"\n",
"}",
"\n",
"}"
] |
24,596 | all-24597 | [
"WithTimestamp",
"time",
"at",
"which",
"the",
"event",
"occurred",
"."
] | [
"func",
"(",
"p",
"DispatchMouseEventParams",
")",
"WithTimestamp",
"(",
"timestamp",
"*",
"TimeSinceEpoch",
")",
"*",
"DispatchMouseEventParams",
"{",
"p",
".",
"Timestamp",
"=",
"timestamp",
"\n",
"<mask>",
"&",
"p",
"\n",
"}"
] |
24,597 | all-24598 | [
"Retrieve",
"a",
"list",
"of",
"all",
"tables",
"in",
"an",
"account",
".",
"Required",
"scopes",
":",
"auth",
":",
"azure",
"-",
"table",
":",
"list",
"-",
"tables",
":",
"<account",
">",
"See",
"#azureTables"
] | [
"func",
"(",
"auth",
"*",
"Auth",
")",
"AzureTables",
"(",
"account",
",",
"continuationToken",
"string",
")",
"(",
"*",
"AzureListTableResponse",
",",
"error",
")",
"{",
"v",
":=",
"<mask>",
".",
"Values",
"{",
"}",
"\n",
"if",
"continuationToken",
"!=",
"\"",
"\"",
"{",
"v",
".",
"Add",
"(",
"\"",
"\"",
",",
"continuationToken",
")",
"\n",
"}",
"\n",
"cd",
":=",
"tcclient",
".",
"Client",
"(",
"*",
"auth",
")",
"\n",
"responseObject",
",",
"_",
",",
"err",
":=",
"(",
"&",
"cd",
")",
".",
"APICall",
"(",
"nil",
",",
"\"",
"\"",
",",
"\"",
"\"",
"+",
"url",
".",
"QueryEscape",
"(",
"account",
")",
"+",
"\"",
"\"",
",",
"new",
"(",
"AzureListTableResponse",
")",
",",
"v",
")",
"\n",
"return",
"responseObject",
".",
"(",
"*",
"AzureListTableResponse",
")",
",",
"err",
"\n",
"}"
] |
24,598 | all-24599 | [
"copy",
"a",
"block",
"of",
"pixels",
"from",
"one",
"framebuffer",
"object",
"to",
"another"
] | [
"func",
"BlitFramebuffer",
"(",
"srcX0",
"int32",
",",
"srcY0",
"int32",
",",
"srcX1",
"int32",
",",
"srcY1",
"int32",
",",
"dstX0",
"int32",
",",
"dstY0",
"int32",
",",
"dstX1",
"int32",
",",
"dstY1",
"int32",
",",
"mask",
"uint32",
",",
"<mask>",
"uint32",
")",
"{",
"syscall",
".",
"Syscall12",
"(",
"gpBlitFramebuffer",
",",
"10",
",",
"uintptr",
"(",
"srcX0",
")",
",",
"uintptr",
"(",
"srcY0",
")",
",",
"uintptr",
"(",
"srcX1",
")",
",",
"uintptr",
"(",
"srcY1",
")",
",",
"uintptr",
"(",
"dstX0",
")",
",",
"uintptr",
"(",
"dstY0",
")",
",",
"uintptr",
"(",
"dstX1",
")",
",",
"uintptr",
"(",
"dstY1",
")",
",",
"uintptr",
"(",
"mask",
")",
",",
"uintptr",
"(",
"filter",
")",
",",
"0",
",",
"0",
")",
"\n",
"}"
] |
24,599 | all-24600 | [
"Error",
"implements",
"error"
] | [
"func",
"(",
"u",
"*",
"NotMarshallableWSRequest",
")",
"Error",
"(",
")",
"string",
"{",
"ret",
":=",
"\"",
"\"",
"\n",
"if",
"u",
".",
"<mask>",
"!=",
"\"",
"\"",
"{",
"ret",
"+=",
"\"",
"\"",
"+",
"u",
".",
"Type",
"+",
"\"",
"\"",
"\n",
"}",
"\n",
"return",
"ret",
"+",
"\"",
"\"",
"+",
"u",
".",
"Err",
".",
"Error",
"(",
")",
"\n",
"}"
] |
Subsets and Splits