id
int32 0
25.3k
| idx
stringlengths 5
9
| nl_tokens
sequencelengths 1
418
| pl_tokens
sequencelengths 22
4.98k
|
---|---|---|---|
2,300 | all-2301 | [
"sourceAttach",
"attaches",
"a",
"source",
"to",
"the",
"default",
"main",
"loop",
"context",
"."
] | [
"func",
"sourceAttach",
"(",
"src",
"*",
"C",
".",
"struct__GSource",
",",
"rf",
"reflect",
".",
"Value",
",",
"args",
"...",
"interface",
"{",
"}",
")",
"(",
"SourceHandle",
",",
"error",
")",
"{",
"if",
"src",
"==",
"nil",
"{",
"return",
"0",
",",
"errNilPtr",
"\n",
"}",
"\n\n",
"// rf must be a func with no parameters.",
"if",
"rf",
".",
"Type",
"(",
")",
".",
"Kind",
"(",
")",
"!=",
"reflect",
".",
"Func",
"{",
"C",
".",
"g_source_destroy",
"(",
"src",
")",
"\n",
"return",
"0",
",",
"errors",
".",
"New",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"// Create a new GClosure from f that invalidates itself when",
"// f returns false. The error is ignored here, as this will",
"// always be a function.",
"<mask>",
"closure",
"*",
"C",
".",
"GClosure",
"\n",
"closure",
",",
"_",
"=",
"ClosureNew",
"(",
"rf",
".",
"Interface",
"(",
")",
",",
"args",
"...",
")",
"\n\n",
"// Remove closure context when closure is finalized.",
"C",
".",
"_g_closure_add_finalize_notifier",
"(",
"closure",
")",
"\n\n",
"// Set closure to run as a callback when the idle source runs.",
"C",
".",
"g_source_set_closure",
"(",
"src",
",",
"closure",
")",
"\n\n",
"// Attach the idle source func to the default main event loop",
"// context.",
"cid",
":=",
"C",
".",
"g_source_attach",
"(",
"src",
",",
"nil",
")",
"\n",
"return",
"SourceHandle",
"(",
"cid",
")",
",",
"nil",
"\n",
"}"
] |
2,301 | all-2302 | [
"Object",
"returns",
"the",
"position",
"of",
"the",
"end",
"of",
"the",
"object",
"that",
"begins",
"at",
"the",
"specified",
"pos"
] | [
"func",
"Object",
"(",
"in",
"[",
"]",
"byte",
",",
"pos",
"int",
")",
"(",
"int",
",",
"error",
")",
"{",
"pos",
",",
"err",
":=",
"skipSpace",
"(",
"in",
",",
"pos",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"0",
",",
"err",
"\n",
"}",
"\n\n",
"if",
"v",
":=",
"in",
"[",
"pos",
"]",
";",
"v",
"!=",
"'{'",
"{",
"return",
"0",
",",
"newError",
"(",
"pos",
",",
"v",
")",
"\n",
"}",
"\n",
"pos",
"++",
"\n\n",
"// clean initial spaces",
"pos",
",",
"err",
"=",
"skipSpace",
"(",
"<mask>",
",",
"pos",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"0",
",",
"err",
"\n",
"}",
"\n\n",
"if",
"in",
"[",
"pos",
"]",
"==",
"'}'",
"{",
"return",
"pos",
"+",
"1",
",",
"nil",
"\n",
"}",
"\n\n",
"for",
"{",
"// key",
"pos",
",",
"err",
"=",
"String",
"(",
"in",
",",
"pos",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"0",
",",
"err",
"\n",
"}",
"\n\n",
"// leading spaces",
"pos",
",",
"err",
"=",
"skipSpace",
"(",
"in",
",",
"pos",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"0",
",",
"err",
"\n",
"}",
"\n\n",
"// colon",
"pos",
",",
"err",
"=",
"expect",
"(",
"in",
",",
"pos",
",",
"':'",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"0",
",",
"err",
"\n",
"}",
"\n\n",
"// data",
"pos",
",",
"err",
"=",
"Any",
"(",
"in",
",",
"pos",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"0",
",",
"err",
"\n",
"}",
"\n\n",
"pos",
",",
"err",
"=",
"skipSpace",
"(",
"in",
",",
"pos",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"0",
",",
"err",
"\n",
"}",
"\n\n",
"switch",
"in",
"[",
"pos",
"]",
"{",
"case",
"','",
":",
"pos",
"++",
"\n",
"case",
"'}'",
":",
"return",
"pos",
"+",
"1",
",",
"nil",
"\n",
"}",
"\n",
"}",
"\n",
"}"
] |
2,302 | all-2303 | [
"UnmarshalJSON",
"supports",
"json",
".",
"Unmarshaler",
"interface"
] | [
"func",
"(",
"v",
"*",
"EntryPreview",
")",
"UnmarshalJSON",
"(",
"<mask>",
"[",
"]",
"byte",
")",
"error",
"{",
"r",
":=",
"jlexer",
".",
"Lexer",
"{",
"Data",
":",
"data",
"}",
"\n",
"easyjsonC5a4559bDecodeGithubComChromedpCdprotoRuntime39",
"(",
"&",
"r",
",",
"v",
")",
"\n",
"return",
"r",
".",
"Error",
"(",
")",
"\n",
"}"
] |
2,303 | all-2304 | [
"AddUnmatch",
"adds",
"a",
"refular",
"expression",
"into",
"the",
"unmatch",
"list",
"."
] | [
"func",
"(",
"r",
"*",
"Rule",
")",
"AddUnmatch",
"(",
"unmatch",
"string",
")",
"error",
"{",
"unmatchRegexp",
",",
"err",
":=",
"regexp",
".",
"Compile",
"(",
"\"",
"\"",
"+",
"unmatch",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"r",
".",
"Unmatch",
"=",
"<mask>",
"(",
"r",
".",
"Unmatch",
",",
"unmatchRegexp",
")",
"\n\n",
"return",
"nil",
"\n",
"}"
] |
2,304 | all-2305 | [
"Age",
"gives",
"the",
"time",
"since",
"the",
"state",
"has",
"been",
"activated",
"."
] | [
"func",
"(",
"a",
"*",
"ActiveState",
")",
"Age",
"(",
"t",
"<mask>",
".",
"Time",
")",
"time",
".",
"Duration",
"{",
"return",
"t",
".",
"Sub",
"(",
"a",
".",
"startTime",
")",
"\n",
"}"
] |
2,305 | all-2306 | [
"isThresholdSet",
"returns",
"true",
"if",
"one",
"of",
"min",
"max",
"warn",
"or",
"crit",
"are",
"set",
"and",
"false",
"otherwise",
".",
"They",
"are",
"determined",
"to",
"be",
"set",
"if",
"they",
"are",
"not",
"a",
")",
"the",
"nil",
"pointer",
"b",
")",
"infinity",
"(",
"positive",
"or",
"negative",
")",
"or",
"c",
")",
"NaN",
"."
] | [
"func",
"isThresholdSet",
"(",
"t",
"*",
"float64",
")",
"bool",
"{",
"switch",
"{",
"case",
"t",
"==",
"nil",
":",
"return",
"false",
"\n",
"<mask>",
"math",
".",
"IsInf",
"(",
"*",
"t",
",",
"0",
")",
":",
"return",
"false",
"\n",
"case",
"math",
".",
"IsNaN",
"(",
"*",
"t",
")",
":",
"return",
"false",
"\n",
"}",
"\n",
"return",
"true",
"\n",
"}"
] |
2,306 | all-2307 | [
"Struct",
"validates",
"a",
"struct",
"even",
"it",
"s",
"nested",
"structs",
"and",
"returns",
"a",
"struct",
"containing",
"the",
"errors",
"NOTE",
":",
"Nested",
"Arrays",
"or",
"Maps",
"of",
"structs",
"do",
"not",
"get",
"validated",
"only",
"the",
"Array",
"or",
"Map",
"itself",
";",
"the",
"reason",
"is",
"that",
"there",
"is",
"no",
"good",
"way",
"to",
"represent",
"or",
"report",
"which",
"struct",
"within",
"the",
"array",
"has",
"the",
"error",
"besides",
"can",
"validate",
"the",
"struct",
"prior",
"to",
"adding",
"it",
"to",
"the",
"Array",
"or",
"Map",
"."
] | [
"func",
"(",
"v",
"*",
"Validate",
")",
"Struct",
"(",
"s",
"<mask>",
"{",
"}",
")",
"*",
"StructErrors",
"{",
"return",
"v",
".",
"structRecursive",
"(",
"s",
",",
"s",
",",
"s",
")",
"\n",
"}"
] |
2,307 | all-2308 | [
"printDash",
"-",
"Prints",
"dash",
"(",
"on",
"top",
"and",
"header",
")",
"."
] | [
"func",
"(",
"t",
"*",
"<mask>",
")",
"printDash",
"(",
")",
"{",
"s",
":=",
"\"",
"\"",
"\n",
"for",
"i",
":=",
"0",
";",
"i",
"<",
"t",
".",
"lineLength",
"(",
")",
"-",
"2",
";",
"i",
"++",
"{",
"s",
"+=",
"\"",
"\"",
"\n",
"}",
"\n",
"s",
"+=",
"\"",
"\"",
"\n",
"fmt",
".",
"Println",
"(",
"s",
")",
"\n",
"}"
] |
2,308 | all-2309 | [
"ServingURL",
"returns",
"a",
"URL",
"that",
"will",
"serve",
"an",
"image",
"from",
"Blobstore",
"."
] | [
"func",
"ServingURL",
"(",
"c",
"context",
".",
"Context",
",",
"key",
"appengine",
".",
"BlobKey",
",",
"opts",
"*",
"ServingURLOptions",
")",
"(",
"*",
"url",
".",
"URL",
",",
"error",
")",
"{",
"req",
":=",
"&",
"pb",
".",
"ImagesGetUrlBaseRequest",
"{",
"BlobKey",
":",
"(",
"*",
"string",
")",
"(",
"&",
"key",
")",
",",
"}",
"\n",
"if",
"opts",
"!=",
"nil",
"&&",
"opts",
".",
"Secure",
"{",
"req",
".",
"CreateSecureUrl",
"=",
"&",
"opts",
".",
"Secure",
"\n",
"}",
"\n",
"res",
":=",
"&",
"pb",
".",
"ImagesGetUrlBaseResponse",
"{",
"}",
"\n",
"if",
"err",
":=",
"internal",
".",
"Call",
"(",
"c",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"req",
",",
"<mask>",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"// The URL may have suffixes added to dynamically resize or crop:",
"// - adding \"=s32\" will serve the image resized to 32 pixels, preserving the aspect ratio.",
"// - adding \"=s32-c\" is the same as \"=s32\" except it will be cropped.",
"u",
":=",
"*",
"res",
".",
"Url",
"\n",
"if",
"opts",
"!=",
"nil",
"&&",
"opts",
".",
"Size",
">",
"0",
"{",
"u",
"+=",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"opts",
".",
"Size",
")",
"\n",
"if",
"opts",
".",
"Crop",
"{",
"u",
"+=",
"\"",
"\"",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"url",
".",
"Parse",
"(",
"u",
")",
"\n",
"}"
] |
2,309 | all-2310 | [
"Check",
"that",
"all",
"the",
"given",
"updates",
"are",
"applied",
"."
] | [
"func",
"checkAllUpdatesAreApplied",
"(",
"tx",
"*",
"sql",
".",
"Tx",
",",
"updates",
"[",
"]",
"Update",
")",
"error",
"{",
"versions",
",",
"err",
":=",
"selectSchemaVersions",
"(",
"tx",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"}",
"\n\n",
"if",
"len",
"(",
"versions",
")",
"==",
"0",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"err",
"=",
"checkSchemaVersionsHaveNoHoles",
"(",
"<mask>",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"current",
":=",
"versions",
"[",
"len",
"(",
"versions",
")",
"-",
"1",
"]",
"\n",
"if",
"current",
"!=",
"len",
"(",
"updates",
")",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"current",
",",
"len",
"(",
"updates",
")",
")",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
] |
2,310 | all-2311 | [
"filterAndFixLinks",
"removes",
"from",
"links",
"all",
"the",
"records",
"we",
"don",
"t",
"care",
"about",
"and",
"strops",
"the",
"/",
"REST",
"/",
"prefix"
] | [
"func",
"filterAndFixLinks",
"(",
"links",
"[",
"]",
"string",
",",
"filter",
"DomainFilter",
")",
"[",
"]",
"string",
"{",
"var",
"result",
"[",
"]",
"string",
"\n",
"for",
"_",
",",
"link",
":=",
"range",
"links",
"{",
"// link looks like /REST/CNAMERecord/acme.com/exchange.acme.com/349386875",
"// strip /REST/",
"link",
"=",
"strings",
".",
"TrimPrefix",
"(",
"link",
",",
"restAPIPrefix",
")",
"\n\n",
"// simply ignore all record types we don't care about",
"if",
"!",
"strings",
".",
"HasPrefix",
"(",
"link",
",",
"endpoint",
".",
"RecordTypeA",
")",
"&&",
"!",
"strings",
".",
"HasPrefix",
"(",
"link",
",",
"endpoint",
".",
"RecordTypeCNAME",
")",
"&&",
"!",
"strings",
".",
"HasPrefix",
"(",
"link",
",",
"endpoint",
".",
"RecordTypeTXT",
")",
"{",
"continue",
"\n",
"}",
"\n\n",
"// strip ID suffix",
"domain",
":=",
"link",
"[",
"0",
":",
"strings",
".",
"LastIndexByte",
"(",
"link",
",",
"'/'",
")",
"]",
"\n",
"// strip zone prefix",
"domain",
"=",
"domain",
"[",
"strings",
".",
"LastIndexByte",
"(",
"domain",
",",
"'/'",
")",
"+",
"1",
":",
"]",
"\n",
"if",
"filter",
".",
"Match",
"(",
"domain",
")",
"{",
"<mask>",
"=",
"append",
"(",
"result",
",",
"link",
")",
"\n",
"}",
"\n",
"}",
"\n\n",
"return",
"result",
"\n",
"}"
] |
2,311 | all-2312 | [
"flattenHostVirtualSwitchSpec",
"reads",
"various",
"fields",
"from",
"a",
"HostVirtualSwitchSpec",
"into",
"the",
"passed",
"in",
"ResourceData",
"."
] | [
"func",
"flattenHostVirtualSwitchSpec",
"(",
"d",
"*",
"schema",
".",
"ResourceData",
",",
"obj",
"*",
"types",
".",
"HostVirtualSwitchSpec",
")",
"error",
"{",
"d",
".",
"Set",
"(",
"\"",
"\"",
",",
"obj",
".",
"Mtu",
")",
"\n",
"d",
".",
"<mask>",
"(",
"\"",
"\"",
",",
"obj",
".",
"NumPorts",
")",
"\n",
"if",
"obj",
".",
"Bridge",
"!=",
"nil",
"{",
"if",
"err",
":=",
"flattenHostVirtualSwitchBondBridge",
"(",
"d",
",",
"obj",
".",
"Bridge",
".",
"(",
"*",
"types",
".",
"HostVirtualSwitchBondBridge",
")",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"}",
"\n",
"if",
"err",
":=",
"flattenHostNetworkPolicy",
"(",
"d",
",",
"obj",
".",
"Policy",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
] |
2,312 | all-2313 | [
"ExpandAliases",
"returns",
"members",
"of",
"multiple",
"aliases",
"duplicates",
"are",
"pruned"
] | [
"func",
"(",
"a",
"RepoAliases",
")",
"ExpandAliases",
"(",
"logins",
"sets",
".",
"String",
")",
"sets",
".",
"String",
"{",
"if",
"a",
"==",
"nil",
"{",
"return",
"logins",
"\n",
"}",
"\n",
"// Make logins a copy of the original set to avoid modifying the original.",
"logins",
"=",
"logins",
".",
"Union",
"(",
"nil",
")",
"\n",
"for",
"_",
",",
"login",
":=",
"range",
"logins",
".",
"<mask>",
"(",
")",
"{",
"if",
"expanded",
":=",
"a",
".",
"ExpandAlias",
"(",
"login",
")",
";",
"len",
"(",
"expanded",
")",
">",
"0",
"{",
"logins",
".",
"Delete",
"(",
"login",
")",
"\n",
"logins",
"=",
"logins",
".",
"Union",
"(",
"expanded",
")",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"logins",
"\n",
"}"
] |
2,313 | all-2314 | [
"GetRecordings",
"returns",
"an",
"array",
"of",
"recordings",
"for",
"this",
"Call",
".",
"Note",
"there",
"may",
"be",
"more",
"than",
"one",
"Page",
"of",
"results",
"."
] | [
"func",
"(",
"c",
"*",
"CallService",
")",
"GetRecordings",
"(",
"ctx",
"context",
".",
"Context",
",",
"callSid",
"string",
",",
"data",
"url",
".",
"Values",
")",
"(",
"*",
"RecordingPage",
",",
"error",
")",
"{",
"if",
"data",
"==",
"nil",
"{",
"data",
"=",
"url",
".",
"Values",
"{",
"}",
"\n",
"}",
"\n",
"// Cheat - hit the Recordings list view with a filter instead of",
"// GET /calls/CA123/Recordings. The former is probably more reliable",
"data",
".",
"Set",
"(",
"\"",
"\"",
",",
"callSid",
")",
"\n",
"return",
"c",
".",
"<mask>",
".",
"Recordings",
".",
"GetPage",
"(",
"ctx",
",",
"data",
")",
"\n",
"}"
] |
2,314 | all-2315 | [
"StringSize",
"is",
"like",
"Size",
"with",
"a",
"string",
"as",
"parameter",
"."
] | [
"func",
"StringSize",
"(",
"s",
"string",
")",
"int",
"{",
"n",
":=",
"0",
"\n",
"for",
"_",
",",
"r",
":=",
"<mask>",
"s",
"{",
"n",
"+=",
"RuneLen",
"(",
"r",
")",
"\n",
"}",
"\n",
"return",
"n",
"\n",
"}"
] |
2,315 | all-2316 | [
"TODO",
"(",
"spxtr",
")",
":",
"Cache",
"rate",
"limit",
"."
] | [
"func",
"handleLog",
"(",
"lc",
"logClient",
")",
"http",
".",
"HandlerFunc",
"{",
"return",
"func",
"(",
"w",
"http",
".",
"ResponseWriter",
",",
"r",
"*",
"http",
".",
"Request",
")",
"{",
"setHeadersNoCaching",
"(",
"w",
")",
"\n",
"w",
".",
"Header",
"(",
")",
".",
"Set",
"(",
"\"",
"\"",
",",
"\"",
"\"",
")",
"\n",
"job",
":=",
"r",
".",
"URL",
".",
"Query",
"(",
")",
".",
"Get",
"(",
"\"",
"\"",
")",
"\n",
"id",
":=",
"r",
".",
"<mask>",
".",
"Query",
"(",
")",
".",
"Get",
"(",
"\"",
"\"",
")",
"\n",
"logger",
":=",
"logrus",
".",
"WithFields",
"(",
"logrus",
".",
"Fields",
"{",
"\"",
"\"",
":",
"job",
",",
"\"",
"\"",
":",
"id",
"}",
")",
"\n",
"if",
"err",
":=",
"validateLogRequest",
"(",
"r",
")",
";",
"err",
"!=",
"nil",
"{",
"http",
".",
"Error",
"(",
"w",
",",
"err",
".",
"Error",
"(",
")",
",",
"http",
".",
"StatusBadRequest",
")",
"\n",
"return",
"\n",
"}",
"\n",
"log",
",",
"err",
":=",
"lc",
".",
"GetJobLog",
"(",
"job",
",",
"id",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"http",
".",
"Error",
"(",
"w",
",",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"err",
")",
",",
"http",
".",
"StatusNotFound",
")",
"\n",
"logger",
":=",
"logger",
".",
"WithError",
"(",
"err",
")",
"\n",
"msg",
":=",
"\"",
"\"",
"\n",
"if",
"strings",
".",
"Contains",
"(",
"err",
".",
"Error",
"(",
")",
",",
"\"",
"\"",
")",
"{",
"// PodInitializing is really common and not something",
"// that has any actionable items for administrators",
"// monitoring logs, so we should log it as information",
"logger",
".",
"Info",
"(",
"msg",
")",
"\n",
"}",
"else",
"{",
"logger",
".",
"Warning",
"(",
"msg",
")",
"\n",
"}",
"\n",
"return",
"\n",
"}",
"\n",
"if",
"_",
",",
"err",
"=",
"w",
".",
"Write",
"(",
"log",
")",
";",
"err",
"!=",
"nil",
"{",
"logger",
".",
"WithError",
"(",
"err",
")",
".",
"Warning",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"}",
"\n",
"}"
] |
2,316 | all-2317 | [
"FetchCheckBundles",
"retrieves",
"all",
"check",
"bundles",
"available",
"to",
"the",
"API",
"Token",
"."
] | [
"func",
"(",
"a",
"*",
"API",
")",
"FetchCheckBundles",
"(",
")",
"(",
"*",
"[",
"]",
"CheckBundle",
",",
"error",
")",
"{",
"<mask>",
",",
"err",
":=",
"a",
".",
"Get",
"(",
"config",
".",
"CheckBundlePrefix",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"var",
"checkBundles",
"[",
"]",
"CheckBundle",
"\n",
"if",
"err",
":=",
"json",
".",
"Unmarshal",
"(",
"result",
",",
"&",
"checkBundles",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"return",
"&",
"checkBundles",
",",
"nil",
"\n",
"}"
] |
2,317 | all-2318 | [
"isName",
"returns",
"true",
"if",
"n",
"is",
"an",
"identifier",
"with",
"the",
"given",
"name",
"."
] | [
"func",
"isName",
"(",
"n",
"ast",
".",
"Expr",
",",
"name",
"string",
")",
"bool",
"{",
"id",
",",
"<mask>",
":=",
"n",
".",
"(",
"*",
"ast",
".",
"Ident",
")",
"\n",
"return",
"ok",
"&&",
"id",
".",
"String",
"(",
")",
"==",
"name",
"\n",
"}"
] |
2,318 | all-2319 | [
"native",
"returns",
"a",
"pointer",
"to",
"the",
"underlying",
"GdkPixbuf",
"."
] | [
"func",
"(",
"v",
"*",
"PixbufFormat",
")",
"native",
"(",
")",
"*",
"C",
".",
"GdkPixbufFormat",
"{",
"if",
"v",
"==",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n\n",
"return",
"v",
".",
"<mask>",
"\n",
"}"
] |
2,319 | all-2320 | [
"getPatch",
"gets",
"the",
"patch",
"for",
"the",
"provided",
"PR",
"and",
"creates",
"a",
"local",
"copy",
"of",
"it",
".",
"It",
"returns",
"its",
"location",
"in",
"the",
"filesystem",
"and",
"any",
"encountered",
"error",
"."
] | [
"func",
"(",
"s",
"*",
"Server",
")",
"getPatch",
"(",
"org",
",",
"repo",
",",
"targetBranch",
"string",
",",
"num",
"int",
")",
"(",
"string",
",",
"error",
")",
"{",
"patch",
",",
"err",
":=",
"s",
".",
"ghc",
".",
"GetPullRequestPatch",
"(",
"org",
",",
"repo",
",",
"num",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"\"",
"\"",
",",
"err",
"\n",
"}",
"\n",
"localPath",
":=",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"org",
",",
"repo",
",",
"num",
",",
"normalize",
"(",
"targetBranch",
")",
")",
"\n",
"<mask>",
",",
"err",
":=",
"os",
".",
"Create",
"(",
"localPath",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"\"",
"\"",
",",
"err",
"\n",
"}",
"\n",
"defer",
"out",
".",
"Close",
"(",
")",
"\n",
"if",
"_",
",",
"err",
":=",
"io",
".",
"Copy",
"(",
"out",
",",
"bytes",
".",
"NewBuffer",
"(",
"patch",
")",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"\"",
"\"",
",",
"err",
"\n",
"}",
"\n",
"return",
"localPath",
",",
"nil",
"\n",
"}"
] |
2,320 | all-2321 | [
"ShiftACL",
"updates",
"uid",
"and",
"gid",
"for",
"file",
"ACLs",
"when",
"entering",
"/",
"exiting",
"a",
"namespace"
] | [
"func",
"ShiftACL",
"(",
"<mask>",
"string",
",",
"shiftIds",
"func",
"(",
"uid",
"int64",
",",
"gid",
"int64",
")",
"(",
"int64",
",",
"int64",
")",
")",
"error",
"{",
"err",
":=",
"shiftAclType",
"(",
"path",
",",
"C",
".",
"ACL_TYPE_ACCESS",
",",
"shiftIds",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"err",
"=",
"shiftAclType",
"(",
"path",
",",
"C",
".",
"ACL_TYPE_DEFAULT",
",",
"shiftIds",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"return",
"nil",
"\n",
"}"
] |
2,321 | all-2322 | [
"Command",
"returns",
"the",
"human",
"-",
"formatted",
"command",
"with",
"arguments",
"."
] | [
"func",
"(",
"c",
"*",
"Child",
")",
"Command",
"(",
")",
"string",
"{",
"list",
":=",
"append",
"(",
"[",
"]",
"string",
"{",
"c",
".",
"<mask>",
"}",
",",
"c",
".",
"args",
"...",
")",
"\n",
"return",
"strings",
".",
"Join",
"(",
"list",
",",
"\"",
"\"",
")",
"\n",
"}"
] |
2,322 | all-2323 | [
"recvMessage",
"blocks",
"waiting",
"for",
"a",
"standalone",
"response",
"message",
"(",
"typically",
"a",
"control",
"message",
")"
] | [
"func",
"(",
"c",
"*",
"Connection",
")",
"recvMessage",
"(",
"ctx",
"context",
".",
"Context",
",",
"<mask>",
"message",
",",
"mex",
"*",
"messageExchange",
")",
"error",
"{",
"frame",
",",
"err",
":=",
"mex",
".",
"recvPeerFrameOfType",
"(",
"msg",
".",
"messageType",
"(",
")",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"if",
"err",
",",
"ok",
":=",
"err",
".",
"(",
"errorMessage",
")",
";",
"ok",
"{",
"return",
"err",
".",
"AsSystemError",
"(",
")",
"\n",
"}",
"\n",
"return",
"err",
"\n",
"}",
"\n\n",
"err",
"=",
"frame",
".",
"read",
"(",
"msg",
")",
"\n",
"c",
".",
"opts",
".",
"FramePool",
".",
"Release",
"(",
"frame",
")",
"\n",
"return",
"err",
"\n",
"}"
] |
2,323 | all-2324 | [
"/",
"*"
] | [
"func",
"FrameSet_New",
"(",
"frange",
"*",
"C",
".",
"char",
")",
"(",
"FrameSetId",
",",
"Error",
")",
"{",
"fset",
",",
"e",
":=",
"fileseq",
".",
"NewFrameSet",
"(",
"C",
".",
"GoString",
"(",
"frange",
")",
")",
"\n",
"if",
"e",
"!=",
"nil",
"{",
"// err string is freed by caller",
"return",
"0",
",",
"C",
".",
"CString",
"(",
"e",
".",
"Error",
"(",
")",
")",
"\n",
"}",
"\n\n",
"id",
":=",
"sFrameSets",
".",
"Add",
"(",
"*",
"fset",
")",
"\n",
"return",
"<mask>",
",",
"nil",
"\n",
"}"
] |
2,324 | all-2325 | [
"func",
"(",
"s",
"*",
"KV",
")",
"debugPrintMore",
"()",
"{",
"s",
".",
"lc",
".",
"debugPrintMore",
"()",
"}",
"//",
"debugPrintMore",
"shows",
"key",
"ranges",
"of",
"each",
"level",
".",
"func",
"(",
"s",
"*",
"levelsController",
")",
"debugPrintMore",
"()",
"{",
"s",
".",
"Lock",
"()",
"defer",
"s",
".",
"Unlock",
"()",
"for",
"i",
":",
"=",
"0",
";",
"i",
"<",
"s",
".",
"kv",
".",
"opt",
".",
"MaxLevels",
";",
"i",
"++",
"{",
"s",
".",
"levels",
"[",
"i",
"]",
".",
"debugPrintMore",
"()",
"}",
"}",
"func",
"(",
"s",
"*",
"levelHandler",
")",
"debugPrintMore",
"()",
"{",
"s",
".",
"RLock",
"()",
"defer",
"s",
".",
"RUnlock",
"()",
"s",
".",
"elog",
".",
"Printf",
"(",
"Level",
"%d",
":",
"s",
".",
"level",
")",
"for",
"_",
"t",
":",
"=",
"range",
"s",
".",
"tables",
"{",
"y",
".",
"Printf",
"(",
"[",
"%s",
"%s",
"]",
"t",
".",
"Smallest",
"()",
"t",
".",
"Biggest",
"()",
")",
"}",
"y",
".",
"Printf",
"(",
"\\",
"n",
")",
"}",
"reserveFileID",
"reserves",
"a",
"unique",
"file",
"id",
"."
] | [
"func",
"(",
"s",
"*",
"levelsController",
")",
"reserveFileID",
"(",
")",
"uint64",
"{",
"<mask>",
":=",
"atomic",
".",
"AddUint64",
"(",
"&",
"s",
".",
"nextFileID",
",",
"1",
")",
"\n",
"return",
"id",
"-",
"1",
"\n",
"}"
] |
2,325 | all-2326 | [
"MarshalJSON",
"supports",
"json",
".",
"Marshaler",
"interface"
] | [
"func",
"(",
"v",
"WebSocketResponse",
")",
"MarshalJSON",
"(",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"w",
":=",
"jwriter",
".",
"<mask>",
"{",
"}",
"\n",
"easyjsonC5a4559bEncodeGithubComChromedpCdprotoNetwork",
"(",
"&",
"w",
",",
"v",
")",
"\n",
"return",
"w",
".",
"Buffer",
".",
"BuildBytes",
"(",
")",
",",
"w",
".",
"Error",
"\n",
"}"
] |
2,326 | all-2327 | [
"AddTCPPorts",
"adds",
"TCP",
"-",
"only",
"ports",
".",
"Similar",
"to",
"using",
"-",
"pT",
":",
"<port1",
">",
"<port2",
">",
"..."
] | [
"func",
"(",
"s",
"Scan",
")",
"AddTCPPorts",
"(",
"ports",
"...",
"uint16",
")",
"Scan",
"{",
"s",
".",
"configTCPPorts",
"=",
"append",
"(",
"s",
".",
"configTCPPorts",
",",
"<mask>",
"...",
")",
"\n",
"return",
"s",
"\n",
"}"
] |
2,327 | all-2328 | [
"UpdateRecords",
"updates",
"a",
"given",
"set",
"of",
"old",
"records",
"to",
"a",
"new",
"set",
"of",
"records",
"in",
"a",
"given",
"hosted",
"zone",
"."
] | [
"func",
"(",
"p",
"*",
"GoogleProvider",
")",
"UpdateRecords",
"(",
"records",
",",
"oldRecords",
"[",
"]",
"*",
"endpoint",
".",
"Endpoint",
")",
"error",
"{",
"change",
":=",
"&",
"dns",
".",
"Change",
"{",
"}",
"\n\n",
"change",
".",
"Additions",
"=",
"append",
"(",
"change",
".",
"Additions",
",",
"p",
".",
"newFilteredRecords",
"(",
"records",
")",
"...",
")",
"\n",
"change",
".",
"Deletions",
"=",
"<mask>",
"(",
"change",
".",
"Deletions",
",",
"p",
".",
"newFilteredRecords",
"(",
"oldRecords",
")",
"...",
")",
"\n\n",
"return",
"p",
".",
"submitChange",
"(",
"change",
")",
"\n",
"}"
] |
2,328 | all-2329 | [
"OptQueryShards",
"restricts",
"the",
"set",
"of",
"shards",
"on",
"which",
"a",
"query",
"operates",
"."
] | [
"func",
"OptQueryShards",
"(",
"shards",
"...",
"uint64",
")",
"QueryOption",
"{",
"return",
"func",
"(",
"options",
"*",
"QueryOptions",
")",
"error",
"{",
"<mask>",
".",
"Shards",
"=",
"append",
"(",
"options",
".",
"Shards",
",",
"shards",
"...",
")",
"\n",
"return",
"nil",
"\n",
"}",
"\n",
"}"
] |
2,329 | all-2330 | [
"New",
"creates",
"a",
"new",
"configured",
"certificate",
"signer",
"."
] | [
"func",
"New",
"(",
"config",
"Config",
")",
"(",
"<mask>",
".",
"CertSigner",
",",
"error",
")",
"{",
"newCertSigner",
":=",
"&",
"certSigner",
"{",
"Config",
":",
"config",
",",
"}",
"\n\n",
"// Dependencies.",
"if",
"newCertSigner",
".",
"VaultClient",
"==",
"nil",
"{",
"return",
"nil",
",",
"microerror",
".",
"Maskf",
"(",
"invalidConfigError",
",",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"return",
"newCertSigner",
",",
"nil",
"\n",
"}"
] |
2,330 | all-2331 | [
"GetTimeout",
"returns",
"the",
"status",
"code",
"and",
"body",
"of",
"url",
".",
"The",
"contents",
"of",
"dst",
"will",
"be",
"replaced",
"by",
"the",
"body",
"and",
"returned",
"if",
"the",
"dst",
"is",
"too",
"small",
"a",
"new",
"slice",
"will",
"be",
"allocated",
".",
"The",
"function",
"follows",
"redirects",
".",
"Use",
"Do",
"*",
"for",
"manually",
"handling",
"redirects",
".",
"ErrTimeout",
"error",
"is",
"returned",
"if",
"url",
"contents",
"couldn",
"t",
"be",
"fetched",
"during",
"the",
"given",
"timeout",
"."
] | [
"func",
"(",
"c",
"*",
"Client",
")",
"GetTimeout",
"(",
"dst",
"[",
"]",
"byte",
",",
"url",
"string",
",",
"timeout",
"time",
".",
"Duration",
")",
"(",
"statusCode",
"int",
",",
"body",
"[",
"]",
"byte",
",",
"err",
"error",
")",
"{",
"return",
"clientGetURLTimeout",
"(",
"dst",
",",
"<mask>",
",",
"timeout",
",",
"c",
")",
"\n",
"}"
] |
2,331 | all-2332 | [
"AdapterOf",
"returns",
"the",
"adapter",
"for",
"typ",
"setting",
"ok",
"to",
"true",
"if",
"one",
"was",
"found",
"false",
"otherwise",
"."
] | [
"func",
"AdapterOf",
"(",
"typ",
"reflect",
".",
"Type",
")",
"(",
"a",
"Adapter",
",",
"<mask>",
"bool",
")",
"{",
"adapterMutex",
".",
"RLock",
"(",
")",
"\n",
"a",
",",
"ok",
"=",
"adapterStore",
"[",
"typ",
"]",
"\n",
"adapterMutex",
".",
"RUnlock",
"(",
")",
"\n",
"return",
"\n",
"}"
] |
2,332 | all-2333 | [
"Verify",
"runs",
"the",
"current",
"test",
"case",
"against",
"a",
"Mock",
"Service",
".",
"Will",
"cleanup",
"interactions",
"between",
"tests",
"within",
"a",
"suite",
"."
] | [
"func",
"(",
"p",
"*",
"Pact",
")",
"Verify",
"(",
"integrationTest",
"func",
"(",
")",
"error",
")",
"error",
"{",
"p",
".",
"Setup",
"(",
"true",
")",
"\n",
"log",
".",
"Println",
"(",
"\"",
"\"",
")",
"\n\n",
"// Check if we are verifying messages or if we actually have interactions",
"if",
"len",
"(",
"p",
".",
"Interactions",
")",
"==",
"0",
"{",
"return",
"errors",
".",
"New",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"mockServer",
":=",
"&",
"MockService",
"{",
"BaseURL",
":",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"p",
".",
"Host",
",",
"p",
".",
"Server",
".",
"Port",
")",
",",
"Consumer",
":",
"p",
".",
"Consumer",
",",
"Provider",
":",
"p",
".",
"Provider",
",",
"}",
"\n\n",
"for",
"_",
",",
"interaction",
":=",
"range",
"p",
".",
"Interactions",
"{",
"err",
":=",
"mockServer",
".",
"AddInteraction",
"(",
"interaction",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"}",
"\n\n",
"// Run the integration test",
"err",
":=",
"integrationTest",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"// Run Verification Process",
"err",
"=",
"mockServer",
".",
"Verify",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"// Clear out interations",
"p",
".",
"Interactions",
"=",
"<mask>",
"(",
"[",
"]",
"*",
"Interaction",
",",
"0",
")",
"\n\n",
"return",
"mockServer",
".",
"DeleteInteractions",
"(",
")",
"\n",
"}"
] |
2,333 | all-2334 | [
"query",
"the",
"name",
"of",
"an",
"active",
"uniform"
] | [
"func",
"GetActiveUniformName",
"(",
"program",
"uint32",
",",
"uniformIndex",
"uint32",
",",
"bufSize",
"int32",
",",
"<mask>",
"*",
"int32",
",",
"uniformName",
"*",
"uint8",
")",
"{",
"syscall",
".",
"Syscall6",
"(",
"gpGetActiveUniformName",
",",
"5",
",",
"uintptr",
"(",
"program",
")",
",",
"uintptr",
"(",
"uniformIndex",
")",
",",
"uintptr",
"(",
"bufSize",
")",
",",
"uintptr",
"(",
"unsafe",
".",
"Pointer",
"(",
"length",
")",
")",
",",
"uintptr",
"(",
"unsafe",
".",
"Pointer",
"(",
"uniformName",
")",
")",
",",
"0",
")",
"\n",
"}"
] |
2,334 | all-2335 | [
"Validate",
"validates",
"Kubernetes",
"options",
"."
] | [
"func",
"(",
"o",
"*",
"ExperimentalKubernetesOptions",
")",
"Validate",
"(",
"dryRun",
"bool",
")",
"error",
"{",
"if",
"dryRun",
"&&",
"o",
".",
"DeckURI",
"==",
"\"",
"\"",
"{",
"return",
"errors",
".",
"New",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"if",
"o",
".",
"DeckURI",
"!=",
"\"",
"\"",
"{",
"if",
"_",
",",
"err",
":=",
"url",
".",
"ParseRequestURI",
"(",
"o",
".",
"DeckURI",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"o",
".",
"DeckURI",
")",
"\n",
"}",
"\n",
"}",
"\n\n",
"if",
"o",
".",
"kubeconfig",
"!=",
"\"",
"\"",
"{",
"if",
"_",
",",
"err",
":=",
"os",
".",
"Stat",
"(",
"o",
".",
"kubeconfig",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"}",
"\n",
"}",
"\n\n",
"if",
"o",
".",
"kubeconfig",
"!=",
"\"",
"\"",
"&&",
"o",
".",
"buildCluster",
"!=",
"\"",
"\"",
"{",
"return",
"<mask>",
".",
"New",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"return",
"nil",
"\n",
"}"
] |
2,335 | all-2336 | [
"Do",
"executes",
"DOMStorage",
".",
"removeDOMStorageItem",
"against",
"the",
"provided",
"context",
"."
] | [
"func",
"(",
"p",
"*",
"RemoveDOMStorageItemParams",
")",
"Do",
"(",
"ctx",
"context",
".",
"<mask>",
")",
"(",
"err",
"error",
")",
"{",
"return",
"cdp",
".",
"Execute",
"(",
"ctx",
",",
"CommandRemoveDOMStorageItem",
",",
"p",
",",
"nil",
")",
"\n",
"}"
] |
2,336 | all-2337 | [
"-----------------------------------------------------------------------------",
"window",
":",
"destroy",
"-----------------------------------------------------------------------------",
"/",
"*",
"destroy",
"window",
"and",
"all",
"the",
"trackers",
"associated",
"with",
"it"
] | [
"func",
"(",
"win",
"*",
"Window",
")",
"Destroy",
"(",
")",
"{",
"C",
".",
"cvDestroyWindow",
"(",
"win",
".",
"name_c",
")",
"\n",
"delete",
"(",
"allWindows",
",",
"win",
".",
"name",
")",
"\n\n",
"for",
"_",
",",
"bar_name",
":=",
"<mask>",
"win",
".",
"trackbarName",
"{",
"C",
".",
"GoOpenCV_DestroyTrackbar",
"(",
"bar_name",
",",
"win",
".",
"name_c",
")",
"\n",
"C",
".",
"free",
"(",
"unsafe",
".",
"Pointer",
"(",
"bar_name",
")",
")",
"\n",
"}",
"\n",
"C",
".",
"free",
"(",
"unsafe",
".",
"Pointer",
"(",
"win",
".",
"name_c",
")",
")",
"\n",
"win",
".",
"name_c",
"=",
"nil",
"\n",
"}"
] |
2,337 | all-2338 | [
"FirewallPolicy",
"retrieves",
"a",
"detailed",
"view",
"of",
"one",
"firewall",
"policy"
] | [
"func",
"(",
"c",
"*",
"Client",
")",
"FirewallPolicy",
"(",
"identifier",
"string",
")",
"(",
"*",
"FirewallPolicy",
",",
"error",
")",
"{",
"policy",
":=",
"new",
"(",
"FirewallPolicy",
")",
"\n",
"_",
",",
"err",
":=",
"c",
".",
"MakeApiRequest",
"(",
"\"",
"\"",
",",
"\"",
"\"",
"+",
"identifier",
",",
"nil",
",",
"policy",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"return",
"<mask>",
",",
"err",
"\n",
"}"
] |
2,338 | all-2339 | [
"NewURIFromAddress",
"parses",
"the",
"passed",
"address",
"and",
"returns",
"a",
"URI",
"."
] | [
"func",
"NewURIFromAddress",
"(",
"<mask>",
"string",
")",
"(",
"*",
"URI",
",",
"error",
")",
"{",
"uri",
",",
"err",
":=",
"parseAddress",
"(",
"address",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"&",
"URI",
"{",
"error",
":",
"err",
"}",
",",
"err",
"\n",
"}",
"\n",
"return",
"uri",
",",
"err",
"\n",
"}"
] |
2,339 | all-2340 | [
"/",
"*",
"FilterGet",
"retrieves",
"only",
"one",
"item",
"based",
"on",
"a",
"filter",
"It",
"is",
"used",
"as",
"a",
"shortcut",
"to",
"FilterGetAll",
"with",
"size",
"==",
"1"
] | [
"func",
"(",
"s",
"RethinkStore",
")",
"FilterGet",
"(",
"filter",
"map",
"[",
"string",
"]",
"interface",
"{",
"}",
",",
"store",
"string",
",",
"dst",
"interface",
"{",
"}",
",",
"opts",
"ObjectStoreOptions",
")",
"error",
"{",
"// var rootTerm = s.getRootTerm(store, filter, opts)",
"var",
"rootTerm",
"=",
"r",
".",
"DB",
"(",
"s",
".",
"Database",
")",
".",
"Table",
"(",
"store",
")",
"\n",
"if",
"opts",
"!=",
"nil",
"{",
"indexes",
":=",
"opts",
".",
"GetIndexes",
"(",
")",
"\n",
"for",
"k",
":=",
"range",
"indexes",
"{",
"if",
"val",
",",
"ok",
":=",
"filter",
"[",
"k",
"]",
".",
"(",
"string",
")",
";",
"ok",
"{",
"rootTerm",
"=",
"rootTerm",
".",
"GetAllByIndex",
"(",
"k",
",",
"val",
")",
"\n",
"break",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n",
"rootTerm",
"=",
"rootTerm",
".",
"Filter",
"(",
"s",
".",
"transformFilter",
"(",
"nil",
",",
"filter",
")",
")",
"\n",
"result",
",",
"err",
":=",
"rootTerm",
".",
"Limit",
"(",
"1",
")",
".",
"Run",
"(",
"s",
".",
"Session",
")",
"\n",
"logger",
".",
"Debug",
"(",
"\"",
"\"",
",",
"\"",
"\"",
",",
"store",
",",
"\"",
"\"",
",",
"rootTerm",
".",
"String",
"(",
")",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"logger",
".",
"Error",
"(",
"\"",
"\"",
",",
"\"",
"\"",
",",
"err",
".",
"Error",
"(",
")",
")",
"\n",
"return",
"err",
"\n",
"}",
"\n",
"defer",
"result",
".",
"Close",
"(",
")",
"\n",
"if",
"result",
".",
"Err",
"(",
")",
"!=",
"nil",
"{",
"return",
"result",
".",
"Err",
"(",
")",
"\n",
"}",
"\n",
"if",
"<mask>",
".",
"IsNil",
"(",
")",
"==",
"true",
"{",
"return",
"ErrNotFound",
"\n",
"}",
"\n",
"if",
"err",
":=",
"result",
".",
"One",
"(",
"dst",
")",
";",
"err",
"!=",
"nil",
"{",
"println",
"(",
"err",
".",
"Error",
"(",
")",
")",
"\n",
"if",
"err",
"==",
"r",
".",
"ErrEmptyResult",
"{",
"return",
"ErrNotFound",
"\n",
"}",
"else",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
] |
2,340 | all-2341 | [
"SetDeletable",
"is",
"a",
"wrapper",
"around",
"gtk_window_set_deletable",
"()",
"."
] | [
"func",
"(",
"v",
"*",
"Window",
")",
"SetDeletable",
"(",
"setting",
"bool",
")",
"{",
"C",
".",
"gtk_window_set_deletable",
"(",
"v",
".",
"native",
"(",
")",
",",
"gbool",
"(",
"<mask>",
")",
")",
"\n",
"}"
] |
2,341 | all-2342 | [
"Exec",
"executes",
"a",
"newImageCommand",
"."
] | [
"func",
"(",
"c",
"*",
"newImageCommand",
")",
"Exec",
"(",
"indexOffset",
"int",
")",
"error",
"{",
"i",
",",
"err",
":=",
"theGraphicsDriver",
".",
"NewImage",
"(",
"c",
".",
"width",
",",
"c",
".",
"height",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"c",
".",
"result",
".",
"<mask>",
"=",
"i",
"\n",
"return",
"nil",
"\n",
"}"
] |
2,342 | all-2343 | [
"Prev",
"moves",
"the",
"visible",
"list",
"back",
"one",
"item",
".",
"If",
"the",
"selected",
"item",
"is",
"out",
"of",
"view",
"the",
"new",
"select",
"item",
"becomes",
"the",
"last",
"visible",
"item",
".",
"If",
"the",
"list",
"is",
"already",
"at",
"the",
"top",
"nothing",
"happens",
"."
] | [
"func",
"(",
"l",
"*",
"<mask>",
")",
"Prev",
"(",
")",
"{",
"if",
"l",
".",
"cursor",
">",
"0",
"{",
"l",
".",
"cursor",
"--",
"\n",
"}",
"\n\n",
"if",
"l",
".",
"start",
">",
"l",
".",
"cursor",
"{",
"l",
".",
"start",
"=",
"l",
".",
"cursor",
"\n",
"}",
"\n",
"}"
] |
2,343 | all-2344 | [
"NewWriter",
"creates",
"a",
"Nitro",
"writer"
] | [
"func",
"(",
"m",
"*",
"Nitro",
")",
"NewWriter",
"(",
")",
"*",
"Writer",
"{",
"w",
":=",
"m",
".",
"newWriter",
"(",
")",
"\n",
"w",
".",
"next",
"=",
"m",
".",
"wlist",
"\n",
"m",
".",
"wlist",
"=",
"w",
"\n",
"w",
".",
"dwrCtx",
".",
"Init",
"(",
")",
"\n\n",
"m",
".",
"shutdownWg1",
".",
"Add",
"(",
"1",
")",
"\n",
"<mask>",
"m",
".",
"collectionWorker",
"(",
"w",
")",
"\n",
"if",
"m",
".",
"useMemoryMgmt",
"{",
"m",
".",
"shutdownWg2",
".",
"Add",
"(",
"1",
")",
"\n",
"go",
"m",
".",
"freeWorker",
"(",
"w",
")",
"\n",
"}",
"\n\n",
"return",
"w",
"\n",
"}"
] |
2,344 | all-2345 | [
"retrieve",
"the",
"info",
"log",
"string",
"from",
"a",
"program",
"pipeline",
"object"
] | [
"func",
"GetProgramPipelineInfoLog",
"(",
"pipeline",
"uint32",
",",
"bufSize",
"int32",
",",
"<mask>",
"*",
"int32",
",",
"infoLog",
"*",
"uint8",
")",
"{",
"syscall",
".",
"Syscall6",
"(",
"gpGetProgramPipelineInfoLog",
",",
"4",
",",
"uintptr",
"(",
"pipeline",
")",
",",
"uintptr",
"(",
"bufSize",
")",
",",
"uintptr",
"(",
"unsafe",
".",
"Pointer",
"(",
"length",
")",
")",
",",
"uintptr",
"(",
"unsafe",
".",
"Pointer",
"(",
"infoLog",
")",
")",
",",
"0",
",",
"0",
")",
"\n",
"}"
] |
2,345 | all-2346 | [
"ReleaseIPResource",
"mocks",
"base",
"method"
] | [
"func",
"(",
"m",
"*",
"MockCNIClient",
")",
"ReleaseIPResource",
"(",
"arg0",
"*",
"ecscni",
".",
"Config",
")",
"error",
"{",
"ret",
":=",
"m",
".",
"ctrl",
".",
"Call",
"(",
"m",
",",
"\"",
"\"",
",",
"arg0",
")",
"\n",
"ret0",
",",
"_",
":=",
"<mask>",
"[",
"0",
"]",
".",
"(",
"error",
")",
"\n",
"return",
"ret0",
"\n",
"}"
] |
2,346 | all-2347 | [
"MarshalJSON",
"supports",
"json",
".",
"Marshaler",
"interface"
] | [
"func",
"(",
"v",
"PostData",
")",
"MarshalJSON",
"(",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"w",
":=",
"jwriter",
".",
"Writer",
"{",
"}",
"\n",
"easyjsonC5a4559bEncodeGithubComChromedpCdprotoHar3",
"(",
"&",
"w",
",",
"v",
")",
"\n",
"return",
"w",
".",
"<mask>",
".",
"BuildBytes",
"(",
")",
",",
"w",
".",
"Error",
"\n",
"}"
] |
2,347 | all-2348 | [
"PixbufLoaderNewWithType",
"()",
"is",
"a",
"wrapper",
"around",
"gdk_pixbuf_loader_new_with_type",
"()",
"."
] | [
"func",
"PixbufLoaderNewWithType",
"(",
"t",
"string",
")",
"(",
"*",
"PixbufLoader",
",",
"error",
")",
"{",
"var",
"err",
"*",
"C",
".",
"GError",
"\n\n",
"cstr",
":=",
"C",
".",
"CString",
"(",
"t",
")",
"\n",
"defer",
"C",
".",
"free",
"(",
"unsafe",
".",
"Pointer",
"(",
"cstr",
")",
")",
"\n\n",
"c",
":=",
"C",
".",
"gdk_pixbuf_loader_new_with_type",
"(",
"(",
"*",
"C",
".",
"<mask>",
")",
"(",
"cstr",
")",
",",
"&",
"err",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"defer",
"C",
".",
"g_error_free",
"(",
"err",
")",
"\n",
"return",
"nil",
",",
"errors",
".",
"New",
"(",
"C",
".",
"GoString",
"(",
"(",
"*",
"C",
".",
"char",
")",
"(",
"err",
".",
"message",
")",
")",
")",
"\n",
"}",
"\n\n",
"if",
"c",
"==",
"nil",
"{",
"return",
"nil",
",",
"nilPtrErr",
"\n",
"}",
"\n\n",
"return",
"&",
"PixbufLoader",
"{",
"glib",
".",
"Take",
"(",
"unsafe",
".",
"Pointer",
"(",
"c",
")",
")",
"}",
",",
"nil",
"\n",
"}"
] |
2,348 | all-2349 | [
"Stem",
"a",
"word",
"in",
"the",
"specified",
"language",
"."
] | [
"func",
"Stem",
"(",
"word",
",",
"language",
"string",
",",
"stemStopWords",
"bool",
")",
"(",
"stemmed",
"string",
",",
"err",
"error",
")",
"{",
"var",
"f",
"func",
"(",
"string",
",",
"bool",
")",
"string",
"\n",
"switch",
"language",
"{",
"case",
"\"",
"\"",
":",
"f",
"=",
"english",
".",
"Stem",
"\n",
"case",
"\"",
"\"",
":",
"f",
"=",
"spanish",
".",
"Stem",
"\n",
"case",
"\"",
"\"",
":",
"f",
"=",
"french",
".",
"Stem",
"\n",
"case",
"\"",
"\"",
":",
"f",
"=",
"russian",
".",
"Stem",
"\n",
"case",
"\"",
"\"",
":",
"f",
"=",
"swedish",
".",
"Stem",
"\n",
"case",
"\"",
"\"",
":",
"f",
"=",
"norwegian",
".",
"Stem",
"\n",
"default",
":",
"err",
"=",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"language",
")",
"\n",
"return",
"\n",
"}",
"\n",
"stemmed",
"=",
"f",
"(",
"<mask>",
",",
"stemStopWords",
")",
"\n",
"return",
"\n\n",
"}"
] |
2,349 | all-2350 | [
"Static",
"returns",
"a",
"middleware",
"handler",
"that",
"serves",
"static",
"files",
"in",
"the",
"given",
"directory",
"."
] | [
"func",
"Serve",
"(",
"urlPrefix",
"string",
",",
"fs",
"ServeFileSystem",
")",
"gin",
".",
"HandlerFunc",
"{",
"fileserver",
":=",
"http",
".",
"FileServer",
"(",
"fs",
")",
"\n",
"if",
"urlPrefix",
"!=",
"\"",
"\"",
"{",
"fileserver",
"=",
"http",
".",
"StripPrefix",
"(",
"urlPrefix",
",",
"fileserver",
")",
"\n",
"}",
"\n",
"return",
"func",
"(",
"c",
"*",
"gin",
".",
"Context",
")",
"{",
"if",
"<mask>",
".",
"Exists",
"(",
"urlPrefix",
",",
"c",
".",
"Request",
".",
"URL",
".",
"Path",
")",
"{",
"fileserver",
".",
"ServeHTTP",
"(",
"c",
".",
"Writer",
",",
"c",
".",
"Request",
")",
"\n",
"c",
".",
"Abort",
"(",
")",
"\n",
"}",
"\n",
"}",
"\n",
"}"
] |
2,350 | all-2351 | [
"Use",
"loadPaths",
"to",
"load",
"a",
"file",
"of",
"new",
"-",
"line",
"delimited",
"paths",
"such",
"as",
"resolving",
"file",
"data",
"referenced",
"in",
"a",
"paths",
"-",
"from",
"-",
"repo",
"command",
"."
] | [
"func",
"(",
"g",
"*",
"Group",
")",
"loadPaths",
"(",
"r",
"<mask>",
".",
"Reader",
")",
"error",
"{",
"s",
":=",
"bufio",
".",
"NewScanner",
"(",
"r",
")",
"\n\n",
"for",
"s",
".",
"Scan",
"(",
")",
"{",
"l",
":=",
"strings",
".",
"TrimSpace",
"(",
"s",
".",
"Text",
"(",
")",
")",
"\n",
"if",
"l",
"==",
"\"",
"\"",
"||",
"l",
"[",
"0",
"]",
"==",
"'#'",
"{",
"// Ignore comments and empty lines.",
"continue",
"\n",
"}",
"\n\n",
"g",
".",
"Paths",
"[",
"l",
"]",
"=",
"true",
"\n",
"}",
"\n\n",
"if",
"err",
":=",
"s",
".",
"Err",
"(",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"}",
"\n\n",
"return",
"nil",
"\n",
"}"
] |
2,351 | all-2352 | [
"HasId",
"returns",
"a",
"boolean",
"if",
"a",
"field",
"has",
"been",
"set",
"."
] | [
"func",
"(",
"b",
"*",
"Board",
")",
"HasId",
"(",
")",
"bool",
"{",
"if",
"b",
"!=",
"nil",
"&&",
"b",
".",
"<mask>",
"!=",
"nil",
"{",
"return",
"true",
"\n",
"}",
"\n\n",
"return",
"false",
"\n",
"}"
] |
2,352 | all-2353 | [
"NewReporter",
"returns",
"a",
"new",
"Reporter",
".",
"You",
"must",
"specify",
"the",
"channel",
"bufferSize",
"and",
"the",
"goroutine",
"poolSize",
".",
"You",
"can",
"pass",
"in",
"nil",
"for",
"the",
"transport",
"and",
"it",
"will",
"create",
"an",
"http",
"transport",
"with",
"MaxIdleConnsPerHost",
"set",
"to",
"the",
"goroutine",
"poolSize",
".",
"Note",
"if",
"you",
"pass",
"in",
"your",
"own",
"transport",
"it",
"s",
"a",
"good",
"idea",
"to",
"have",
"its",
"MaxIdleConnsPerHost",
"be",
"set",
"to",
"at",
"least",
"the",
"poolSize",
"to",
"allow",
"for",
"effective",
"connection",
"reuse",
"."
] | [
"func",
"NewReporter",
"(",
"bufferSize",
",",
"poolSize",
"int",
",",
"transport",
"http",
".",
"RoundTripper",
")",
"Reporter",
"{",
"r",
":=",
"<mask>",
"(",
"BasicReporter",
")",
"\n",
"if",
"transport",
"==",
"nil",
"{",
"transport",
"=",
"&",
"http",
".",
"Transport",
"{",
"// Allow for an idle connection per goroutine.",
"MaxIdleConnsPerHost",
":",
"poolSize",
",",
"}",
"\n",
"}",
"\n",
"r",
".",
"client",
"=",
"&",
"http",
".",
"Client",
"{",
"Transport",
":",
"transport",
"}",
"\n",
"r",
".",
"reports",
"=",
"make",
"(",
"chan",
"*",
"statReport",
",",
"bufferSize",
")",
"\n",
"r",
".",
"done",
"=",
"make",
"(",
"chan",
"bool",
")",
"\n",
"r",
".",
"wg",
"=",
"new",
"(",
"sync",
".",
"WaitGroup",
")",
"\n",
"for",
"i",
":=",
"0",
";",
"i",
"<",
"poolSize",
";",
"i",
"++",
"{",
"r",
".",
"wg",
".",
"Add",
"(",
"1",
")",
"\n",
"go",
"r",
".",
"processReports",
"(",
")",
"\n",
"}",
"\n",
"return",
"r",
"\n",
"}"
] |
2,353 | all-2354 | [
"returns",
"the",
"cell",
"value",
"for",
"a",
"given",
"col",
"and",
"row",
".",
"Col",
"and",
"row",
"are",
"absolute",
"value",
".",
"But",
"cache",
"keeps",
"limited",
"number",
"of",
"rows",
"to",
"minimize",
"memory",
"usage",
".",
"So",
"the",
"position",
"of",
"the",
"value",
"of",
"the",
"cell",
"should",
"be",
"calculated",
"To",
"simplify",
"the",
"function",
"just",
"returns",
"empty",
"string",
"if",
"the",
"cell",
"is",
"not",
"cached",
".",
"It",
"is",
"unlikely",
"but",
"can",
"happen"
] | [
"func",
"(",
"d",
"*",
"dbCache",
")",
"value",
"(",
"row",
",",
"col",
"int",
")",
"string",
"{",
"rowId",
":=",
"<mask>",
"-",
"d",
".",
"firstRow",
"\n",
"if",
"rowId",
">=",
"len",
"(",
"d",
".",
"data",
")",
"{",
"return",
"\"",
"\"",
"\n",
"}",
"\n",
"rowValues",
":=",
"d",
".",
"data",
"[",
"rowId",
"]",
"\n",
"if",
"col",
">=",
"len",
"(",
"rowValues",
")",
"{",
"return",
"\"",
"\"",
"\n",
"}",
"\n",
"return",
"rowValues",
"[",
"col",
"]",
"\n",
"}"
] |
2,354 | all-2355 | [
"TODO",
"(",
"jrick",
")",
"Mask",
"(",
"depends",
"on",
"Pattern",
")",
"MaskSurface",
"is",
"a",
"wrapper",
"around",
"cairo_mask_surface",
"()",
"."
] | [
"func",
"(",
"v",
"*",
"<mask>",
")",
"MaskSurface",
"(",
"surface",
"*",
"Surface",
",",
"surfaceX",
",",
"surfaceY",
"float64",
")",
"{",
"C",
".",
"cairo_mask_surface",
"(",
"v",
".",
"native",
"(",
")",
",",
"surface",
".",
"native",
"(",
")",
",",
"C",
".",
"double",
"(",
"surfaceX",
")",
",",
"C",
".",
"double",
"(",
"surfaceY",
")",
")",
"\n",
"}"
] |
2,355 | all-2356 | [
"ParseFile",
"takes",
"an",
"argument",
"of",
"the",
"form",
"repo",
"["
] | [
"func",
"ParseFile",
"(",
"arg",
"string",
")",
"(",
"*",
"pfs",
".",
"<mask>",
",",
"error",
")",
"{",
"repoAndRest",
":=",
"strings",
".",
"SplitN",
"(",
"arg",
",",
"\"",
"\"",
",",
"2",
")",
"\n",
"if",
"repoAndRest",
"[",
"0",
"]",
"==",
"\"",
"\"",
"{",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\\\"",
"\\\"",
"\"",
",",
"arg",
")",
"\n",
"}",
"\n",
"file",
":=",
"&",
"pfs",
".",
"File",
"{",
"Commit",
":",
"&",
"pfs",
".",
"Commit",
"{",
"Repo",
":",
"&",
"pfs",
".",
"Repo",
"{",
"Name",
":",
"repoAndRest",
"[",
"0",
"]",
",",
"}",
",",
"ID",
":",
"\"",
"\"",
",",
"}",
",",
"Path",
":",
"\"",
"\"",
",",
"}",
"\n",
"if",
"len",
"(",
"repoAndRest",
")",
">",
"1",
"{",
"commitAndPath",
":=",
"strings",
".",
"SplitN",
"(",
"repoAndRest",
"[",
"1",
"]",
",",
"\"",
"\"",
",",
"2",
")",
"\n",
"if",
"commitAndPath",
"[",
"0",
"]",
"==",
"\"",
"\"",
"{",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\\\"",
"\\\"",
"\"",
",",
"arg",
")",
"\n",
"}",
"\n",
"file",
".",
"Commit",
".",
"ID",
"=",
"commitAndPath",
"[",
"0",
"]",
"\n",
"if",
"len",
"(",
"commitAndPath",
")",
">",
"1",
"{",
"file",
".",
"Path",
"=",
"commitAndPath",
"[",
"1",
"]",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"file",
",",
"nil",
"\n",
"}"
] |
2,356 | all-2357 | [
"refresh",
"updates",
"the",
"cookie",
"and",
"expiration",
"used",
"to",
"sign",
"requests",
"from",
"a",
"successful",
"session",
"creation",
"API",
"response",
"."
] | [
"func",
"(",
"s",
"*",
"cookieSigner",
")",
"refresh",
"(",
"resp",
"*",
"http",
".",
"Response",
")",
"error",
"{",
"if",
"resp",
".",
"StatusCode",
"!=",
"204",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"resp",
".",
"Status",
")",
"\n",
"}",
"\n",
"s",
".",
"cookies",
"=",
"resp",
".",
"Cookies",
"(",
")",
"\n",
"s",
".",
"refreshAt",
"=",
"time",
".",
"Now",
"(",
")",
".",
"Add",
"(",
"<mask>",
".",
"Duration",
"(",
"2",
")",
"*",
"time",
".",
"Hour",
")",
"\n",
"return",
"nil",
"\n",
"}"
] |
2,357 | all-2358 | [
"UnmarshalYAML",
"implements",
"the",
"yaml",
".",
"Unmarshaler",
"interface",
"."
] | [
"func",
"(",
"c",
"*",
"RemoteReadConfig",
")",
"UnmarshalYAML",
"(",
"unmarshal",
"func",
"(",
"interface",
"{",
"}",
")",
"error",
")",
"error",
"{",
"*",
"c",
"=",
"DefaultRemoteReadConfig",
"\n",
"type",
"<mask>",
"RemoteReadConfig",
"\n",
"if",
"err",
":=",
"unmarshal",
"(",
"(",
"*",
"plain",
")",
"(",
"c",
")",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"if",
"c",
".",
"URL",
"==",
"nil",
"{",
"return",
"errors",
".",
"New",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"// The UnmarshalYAML method of HTTPClientConfig is not being called because it's not a pointer.",
"// We cannot make it a pointer as the parser panics for inlined pointer structs.",
"// Thus we just do its validation here.",
"return",
"c",
".",
"HTTPClientConfig",
".",
"Validate",
"(",
")",
"\n",
"}"
] |
2,358 | all-2359 | [
"UnmarshalJSON",
"supports",
"json",
".",
"Unmarshaler",
"interface"
] | [
"func",
"(",
"v",
"*",
"SetDOMStorageItemParams",
")",
"UnmarshalJSON",
"(",
"data",
"[",
"]",
"byte",
")",
"error",
"{",
"r",
":=",
"jlexer",
".",
"Lexer",
"{",
"Data",
":",
"data",
"}",
"\n",
"easyjsonC5a4559bDecodeGithubComChromedpCdprotoDomstorage1",
"(",
"&",
"r",
",",
"v",
")",
"\n",
"return",
"r",
".",
"<mask>",
"(",
")",
"\n",
"}"
] |
2,359 | all-2360 | [
"UpdateSecretVersionStage",
"mocks",
"base",
"method"
] | [
"func",
"(",
"m",
"*",
"MockSecretsManagerAPI",
")",
"UpdateSecretVersionStage",
"(",
"arg0",
"*",
"secretsmanager",
".",
"UpdateSecretVersionStageInput",
")",
"(",
"*",
"secretsmanager",
".",
"UpdateSecretVersionStageOutput",
",",
"error",
")",
"{",
"ret",
":=",
"m",
".",
"ctrl",
".",
"Call",
"(",
"m",
",",
"\"",
"\"",
",",
"arg0",
")",
"\n",
"ret0",
",",
"_",
":=",
"<mask>",
"[",
"0",
"]",
".",
"(",
"*",
"secretsmanager",
".",
"UpdateSecretVersionStageOutput",
")",
"\n",
"ret1",
",",
"_",
":=",
"ret",
"[",
"1",
"]",
".",
"(",
"error",
")",
"\n",
"return",
"ret0",
",",
"ret1",
"\n",
"}"
] |
2,360 | all-2361 | [
"Locator",
"returns",
"a",
"locator",
"for",
"the",
"given",
"resource"
] | [
"func",
"(",
"r",
"*",
"CloudAccount",
")",
"Locator",
"(",
"api",
"*",
"API",
")",
"*",
"CloudAccountLocator",
"{",
"for",
"_",
",",
"l",
":=",
"<mask>",
"r",
".",
"Links",
"{",
"if",
"l",
"[",
"\"",
"\"",
"]",
"==",
"\"",
"\"",
"{",
"return",
"api",
".",
"CloudAccountLocator",
"(",
"l",
"[",
"\"",
"\"",
"]",
")",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
] |
2,361 | all-2362 | [
"EncodeSQL",
"encodes",
"the",
"value",
"into",
"an",
"SQL",
"statement",
".",
"Can",
"be",
"binary",
"."
] | [
"func",
"(",
"v",
"Value",
")",
"EncodeSQL",
"(",
"b",
"BinWriter",
")",
"{",
"<mask>",
"{",
"case",
"v",
".",
"typ",
"==",
"Null",
":",
"b",
".",
"Write",
"(",
"nullstr",
")",
"\n",
"case",
"v",
".",
"IsQuoted",
"(",
")",
":",
"encodeBytesSQL",
"(",
"v",
".",
"val",
",",
"b",
")",
"\n",
"default",
":",
"b",
".",
"Write",
"(",
"v",
".",
"val",
")",
"\n",
"}",
"\n",
"}"
] |
2,362 | all-2363 | [
"GetXOk",
"returns",
"a",
"tuple",
"with",
"the",
"X",
"field",
"if",
"it",
"s",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"and",
"a",
"boolean",
"to",
"check",
"if",
"the",
"value",
"has",
"been",
"set",
"."
] | [
"func",
"(",
"s",
"*",
"ScatterplotRequests",
")",
"GetXOk",
"(",
")",
"(",
"ScatterplotRequest",
",",
"bool",
")",
"{",
"if",
"s",
"==",
"nil",
"||",
"s",
".",
"X",
"==",
"nil",
"{",
"return",
"ScatterplotRequest",
"{",
"}",
",",
"<mask>",
"\n",
"}",
"\n",
"return",
"*",
"s",
".",
"X",
",",
"true",
"\n",
"}"
] |
2,363 | all-2364 | [
"unsetSocket",
"releases",
"any",
"slave",
"and",
"/",
"or",
"master",
"sockets",
"reserved",
"."
] | [
"func",
"(",
"s",
"*",
"<mask>",
")",
"unsetSocket",
"(",
")",
"{",
"if",
"s",
".",
"masterSocket",
"!=",
"nil",
"{",
"s",
".",
"masterSocket",
".",
"Release",
"(",
")",
"\n",
"}",
"\n",
"if",
"s",
".",
"slaveSocket",
"!=",
"nil",
"{",
"s",
".",
"slaveSocket",
".",
"Release",
"(",
")",
"\n",
"}",
"\n",
"s",
".",
"masterSocket",
"=",
"nil",
"\n",
"s",
".",
"slaveSocket",
"=",
"nil",
"\n",
"}"
] |
2,364 | all-2365 | [
"NewInlineQueryAnswer",
"creates",
"a",
"new",
"inline",
"query",
"answer",
"."
] | [
"func",
"(",
"api",
"*",
"TelegramBotAPI",
")",
"NewInlineQueryAnswer",
"(",
"queryID",
"string",
",",
"<mask>",
"[",
"]",
"InlineQueryResult",
")",
"*",
"InlineQueryAnswer",
"{",
"return",
"&",
"InlineQueryAnswer",
"{",
"api",
":",
"api",
",",
"QueryID",
":",
"queryID",
",",
"Results",
":",
"results",
",",
"}",
"\n",
"}"
] |
2,365 | all-2366 | [
"F",
"is",
"a",
"short",
"-",
"hand",
"function",
"to",
"extract",
"the",
"database",
"BSON",
"field",
"name",
"of",
"a",
"model",
"field",
".",
"Additionally",
"it",
"supports",
"the",
"-",
"prefix",
"for",
"retrieving",
"sort",
"keys",
".",
"Note",
":",
"F",
"will",
"panic",
"if",
"no",
"field",
"has",
"been",
"found",
"."
] | [
"func",
"F",
"(",
"m",
"Model",
",",
"field",
"string",
")",
"string",
"{",
"// check if prefixed",
"prefixed",
":=",
"strings",
".",
"HasPrefix",
"(",
"field",
",",
"\"",
"\"",
")",
"\n\n",
"// remove prefix",
"if",
"prefixed",
"{",
"field",
"=",
"strings",
".",
"TrimLeft",
"(",
"field",
",",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"// find field",
"f",
":=",
"Init",
"(",
"m",
")",
".",
"Meta",
"(",
")",
".",
"Fields",
"[",
"field",
"]",
"\n",
"if",
"f",
"==",
"nil",
"{",
"panic",
"(",
"fmt",
".",
"Sprintf",
"(",
"`coal: field \"%s\" not found on \"%s\"`",
",",
"<mask>",
",",
"m",
".",
"Meta",
"(",
")",
".",
"Name",
")",
")",
"\n",
"}",
"\n\n",
"// get field",
"bsonField",
":=",
"f",
".",
"BSONField",
"\n\n",
"// prefix field again",
"if",
"prefixed",
"{",
"bsonField",
"=",
"\"",
"\"",
"+",
"bsonField",
"\n",
"}",
"\n\n",
"return",
"bsonField",
"\n",
"}"
] |
2,366 | all-2367 | [
"enable",
"binds",
"the",
"array",
"buffer",
"the",
"given",
"program",
"to",
"use",
"the",
"array",
"buffer",
"."
] | [
"func",
"(",
"a",
"*",
"arrayBufferLayout",
")",
"<mask>",
"(",
"context",
"*",
"context",
",",
"program",
"program",
")",
"{",
"for",
"i",
":=",
"range",
"a",
".",
"parts",
"{",
"context",
".",
"enableVertexAttribArray",
"(",
"program",
",",
"i",
")",
"\n",
"}",
"\n",
"total",
":=",
"a",
".",
"totalBytes",
"(",
")",
"\n",
"offset",
":=",
"0",
"\n",
"for",
"i",
",",
"p",
":=",
"range",
"a",
".",
"parts",
"{",
"context",
".",
"vertexAttribPointer",
"(",
"program",
",",
"i",
",",
"p",
".",
"num",
",",
"float",
",",
"total",
",",
"offset",
")",
"\n",
"offset",
"+=",
"float",
".",
"SizeInBytes",
"(",
")",
"*",
"p",
".",
"num",
"\n",
"}",
"\n",
"}"
] |
2,367 | all-2368 | [
"Has",
"checks",
"the",
"existence",
"of",
"the",
"key",
"in",
"the",
"context",
"."
] | [
"func",
"(",
"c",
"*",
"<mask>",
")",
"Has",
"(",
"key",
"string",
")",
"bool",
"{",
"return",
"c",
".",
"Value",
"(",
"key",
")",
"!=",
"nil",
"\n",
"}"
] |
2,368 | all-2369 | [
"DisablePublicServiceAccess",
"-",
"will",
"ensure",
"any",
"public",
"plan",
"is",
"made",
"private"
] | [
"func",
"(",
"m",
"*",
"<mask>",
")",
"DisablePublicServiceAccess",
"(",
"serviceInfo",
"*",
"ServiceInfo",
")",
"error",
"{",
"for",
"_",
",",
"servicePlan",
":=",
"range",
"serviceInfo",
".",
"AllPlans",
"(",
")",
"{",
"for",
"_",
",",
"plan",
":=",
"range",
"servicePlan",
"{",
"if",
"plan",
".",
"Public",
"{",
"err",
":=",
"m",
".",
"Client",
".",
"MakeServicePlanPrivate",
"(",
"plan",
".",
"GUID",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
] |
2,369 | all-2370 | [
"BuyNumber",
"attempts",
"to",
"buy",
"the",
"provided",
"phoneNumber",
"and",
"returns",
"it",
"if",
"successful",
"."
] | [
"func",
"(",
"ipn",
"*",
"IncomingNumberService",
")",
"BuyNumber",
"(",
"phoneNumber",
"string",
")",
"(",
"*",
"IncomingPhoneNumber",
",",
"error",
")",
"{",
"data",
":=",
"url",
".",
"Values",
"{",
"\"",
"\"",
":",
"[",
"]",
"string",
"{",
"phoneNumber",
"}",
"}",
"\n",
"return",
"ipn",
".",
"NumberPurchasingService",
".",
"Create",
"(",
"<mask>",
".",
"Background",
"(",
")",
",",
"data",
")",
"\n",
"}"
] |
2,370 | all-2371 | [
"PublishNamedEvent",
"which",
"name",
"infered",
"from",
"eventBody",
"interface",
"name",
"."
] | [
"func",
"PublishNamedEvent",
"(",
"pub",
"Publisher",
",",
"eventBody",
"<mask>",
"{",
"}",
")",
"{",
"name",
":=",
"reflect",
".",
"TypeOf",
"(",
"eventBody",
")",
".",
"Name",
"(",
")",
"\n",
"pub",
".",
"Publish",
"(",
"name",
",",
"eventBody",
")",
"\n",
"}"
] |
2,371 | all-2372 | [
"SdNotify",
"sends",
"a",
"specified",
"string",
"to",
"the",
"systemd",
"notification",
"socket",
"."
] | [
"func",
"SdNotify",
"(",
"state",
"string",
")",
"error",
"{",
"name",
":=",
"os",
".",
"Getenv",
"(",
"\"",
"\"",
")",
"\n",
"if",
"name",
"==",
"\"",
"\"",
"{",
"return",
"ErrSdNotifyNoSocket",
"\n",
"}",
"\n\n",
"conn",
",",
"err",
":=",
"net",
".",
"DialUnix",
"(",
"\"",
"\"",
",",
"nil",
",",
"&",
"net",
".",
"UnixAddr",
"{",
"Name",
":",
"name",
",",
"Net",
":",
"\"",
"\"",
"}",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"defer",
"conn",
".",
"Close",
"(",
")",
"\n\n",
"_",
",",
"err",
"=",
"conn",
".",
"Write",
"(",
"[",
"]",
"byte",
"(",
"<mask>",
")",
")",
"\n",
"return",
"err",
"\n",
"}"
] |
2,372 | all-2373 | [
"NotFound",
"writes",
"a",
"404",
"HTTP",
"response"
] | [
"func",
"(",
"ctx",
"*",
"Cotex",
")",
"NotFound",
"(",
"message",
"string",
")",
"{",
"ctx",
".",
"ResponseWriter",
".",
"WriteHeader",
"(",
"404",
")",
"\n",
"ctx",
".",
"ResponseWriter",
".",
"Write",
"(",
"[",
"]",
"<mask>",
"(",
"message",
")",
")",
"\n",
"}"
] |
2,373 | all-2374 | [
"MenuItemNewWithLabel",
"()",
"is",
"a",
"wrapper",
"around",
"gtk_menu_item_new_with_label",
"()",
"."
] | [
"func",
"MenuItemNewWithLabel",
"(",
"label",
"string",
")",
"(",
"*",
"MenuItem",
",",
"error",
")",
"{",
"cstr",
":=",
"C",
".",
"CString",
"(",
"<mask>",
")",
"\n",
"defer",
"C",
".",
"free",
"(",
"unsafe",
".",
"Pointer",
"(",
"cstr",
")",
")",
"\n",
"c",
":=",
"C",
".",
"gtk_menu_item_new_with_label",
"(",
"(",
"*",
"C",
".",
"gchar",
")",
"(",
"cstr",
")",
")",
"\n",
"if",
"c",
"==",
"nil",
"{",
"return",
"nil",
",",
"nilPtrErr",
"\n",
"}",
"\n",
"return",
"wrapMenuItem",
"(",
"glib",
".",
"Take",
"(",
"unsafe",
".",
"Pointer",
"(",
"c",
")",
")",
")",
",",
"nil",
"\n",
"}"
] |
2,374 | all-2375 | [
"WindowSetDefaultIconName",
"is",
"a",
"wrapper",
"around",
"gtk_window_set_default_icon_name",
"()",
"."
] | [
"func",
"WindowSetDefaultIconName",
"(",
"s",
"string",
")",
"{",
"cstr",
":=",
"(",
"*",
"C",
".",
"gchar",
")",
"(",
"C",
".",
"CString",
"(",
"s",
")",
")",
"\n",
"defer",
"C",
".",
"<mask>",
"(",
"unsafe",
".",
"Pointer",
"(",
"cstr",
")",
")",
"\n",
"C",
".",
"gtk_window_set_default_icon_name",
"(",
"cstr",
")",
"\n",
"}"
] |
2,375 | all-2376 | [
"Load",
"is",
"a",
"modified",
"copy",
"of",
"k8s",
".",
"io",
"/",
"kubernetes",
"/",
"pkg",
"/",
"client",
"/",
"unversioned",
"/",
"clientcmd",
".",
"ClientConfigLoadingRules",
".",
"Load",
"Load",
"starts",
"by",
"running",
"the",
"MigrationRules",
"and",
"then",
"takes",
"the",
"loading",
"rules",
"and",
"returns",
"a",
"Config",
"object",
"based",
"on",
"following",
"rules",
".",
"if",
"the",
"ExplicitPath",
"return",
"the",
"unmerged",
"explicit",
"file",
"Otherwise",
"return",
"a",
"merged",
"config",
"based",
"on",
"the",
"Precedence",
"slice",
"A",
"missing",
"ExplicitPath",
"file",
"produces",
"an",
"error",
".",
"Empty",
"filenames",
"or",
"other",
"missing",
"files",
"are",
"ignored",
".",
"Read",
"errors",
"or",
"files",
"with",
"non",
"-",
"deserializable",
"content",
"produce",
"errors",
".",
"The",
"first",
"file",
"to",
"set",
"a",
"particular",
"map",
"key",
"wins",
"and",
"map",
"key",
"s",
"value",
"is",
"never",
"changed",
".",
"BUT",
"if",
"you",
"set",
"a",
"struct",
"value",
"that",
"is",
"NOT",
"contained",
"inside",
"of",
"map",
"the",
"value",
"WILL",
"be",
"changed",
".",
"This",
"results",
"in",
"some",
"odd",
"looking",
"logic",
"to",
"merge",
"in",
"one",
"direction",
"merge",
"in",
"the",
"other",
"and",
"then",
"merge",
"the",
"two",
".",
"It",
"also",
"means",
"that",
"if",
"two",
"files",
"specify",
"a",
"red",
"-",
"user",
"only",
"values",
"from",
"the",
"first",
"file",
"s",
"red",
"-",
"user",
"are",
"used",
".",
"Even",
"non",
"-",
"conflicting",
"entries",
"from",
"the",
"second",
"file",
"s",
"red",
"-",
"user",
"are",
"discarded",
".",
"Relative",
"paths",
"inside",
"of",
"the",
".",
"kubeconfig",
"files",
"are",
"resolved",
"against",
"the",
".",
"kubeconfig",
"file",
"s",
"parent",
"folder",
"and",
"only",
"absolute",
"file",
"paths",
"are",
"returned",
"."
] | [
"func",
"(",
"rules",
"*",
"clientConfigLoadingRules",
")",
"Load",
"(",
")",
"(",
"*",
"clientcmdConfig",
",",
"error",
")",
"{",
"errlist",
":=",
"[",
"]",
"error",
"{",
"}",
"\n\n",
"kubeConfigFiles",
":=",
"[",
"]",
"string",
"{",
"}",
"\n\n",
"// REMOVED: explicit path support",
"kubeConfigFiles",
"=",
"append",
"(",
"kubeConfigFiles",
",",
"rules",
".",
"Precedence",
"...",
")",
"\n\n",
"kubeconfigs",
":=",
"[",
"]",
"*",
"clientcmdConfig",
"{",
"}",
"\n",
"// read and cache the config files so that we only look at them once",
"for",
"_",
",",
"filename",
":=",
"range",
"kubeConfigFiles",
"{",
"if",
"len",
"(",
"filename",
")",
"==",
"0",
"{",
"// no work to do",
"continue",
"\n",
"}",
"\n\n",
"config",
",",
"err",
":=",
"loadFromFile",
"(",
"filename",
")",
"\n",
"if",
"os",
".",
"IsNotExist",
"(",
"err",
")",
"{",
"// skip missing files",
"continue",
"\n",
"}",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"errlist",
"=",
"append",
"(",
"errlist",
",",
"errors",
".",
"Wrapf",
"(",
"err",
",",
"\"",
"\\\"",
"\\\"",
"\"",
",",
"filename",
")",
")",
"\n",
"continue",
"\n",
"}",
"\n\n",
"kubeconfigs",
"=",
"<mask>",
"(",
"kubeconfigs",
",",
"config",
")",
"\n",
"}",
"\n\n",
"// first merge all of our maps",
"mapConfig",
":=",
"clientcmdNewConfig",
"(",
")",
"\n",
"for",
"_",
",",
"kubeconfig",
":=",
"range",
"kubeconfigs",
"{",
"mergo",
".",
"Merge",
"(",
"mapConfig",
",",
"kubeconfig",
")",
"\n",
"}",
"\n\n",
"// merge all of the struct values in the reverse order so that priority is given correctly",
"// errors are not added to the list the second time",
"nonMapConfig",
":=",
"clientcmdNewConfig",
"(",
")",
"\n",
"for",
"i",
":=",
"len",
"(",
"kubeconfigs",
")",
"-",
"1",
";",
"i",
">=",
"0",
";",
"i",
"--",
"{",
"kubeconfig",
":=",
"kubeconfigs",
"[",
"i",
"]",
"\n",
"mergo",
".",
"Merge",
"(",
"nonMapConfig",
",",
"kubeconfig",
")",
"\n",
"}",
"\n\n",
"// since values are overwritten, but maps values are not, we can merge the non-map config on top of the map config and",
"// get the values we expect.",
"config",
":=",
"clientcmdNewConfig",
"(",
")",
"\n",
"mergo",
".",
"Merge",
"(",
"config",
",",
"mapConfig",
")",
"\n",
"mergo",
".",
"Merge",
"(",
"config",
",",
"nonMapConfig",
")",
"\n\n",
"// REMOVED: Possibility to skip this.",
"if",
"err",
":=",
"resolveLocalPaths",
"(",
"config",
")",
";",
"err",
"!=",
"nil",
"{",
"errlist",
"=",
"append",
"(",
"errlist",
",",
"err",
")",
"\n",
"}",
"\n\n",
"return",
"config",
",",
"newAggregate",
"(",
"errlist",
")",
"\n",
"}"
] |
2,376 | all-2377 | [
"IsCreate",
"returns",
"true",
"if",
"the",
"event",
"tells",
"that",
"the",
"key",
"is",
"newly",
"created",
"."
] | [
"func",
"(",
"e",
"*",
"<mask>",
")",
"IsCreate",
"(",
")",
"bool",
"{",
"return",
"e",
".",
"Type",
"==",
"EventTypePut",
"&&",
"e",
".",
"Kv",
".",
"CreateRevision",
"==",
"e",
".",
"Kv",
".",
"ModRevision",
"\n",
"}"
] |
2,377 | all-2378 | [
"newApps",
"returns",
"a",
"Apps"
] | [
"func",
"newApps",
"(",
"c",
"*",
"TsuruV1Client",
",",
"namespace",
"string",
")",
"*",
"apps",
"{",
"return",
"&",
"apps",
"{",
"client",
":",
"c",
".",
"RESTClient",
"(",
")",
",",
"<mask>",
":",
"namespace",
",",
"}",
"\n",
"}"
] |
2,378 | all-2379 | [
"ReportInfo",
"returns",
"ChannelInfo",
"for",
"a",
"channel",
"."
] | [
"func",
"(",
"ch",
"*",
"Channel",
")",
"ReportInfo",
"(",
"opts",
"*",
"IntrospectionOptions",
")",
"ChannelInfo",
"{",
"return",
"ChannelInfo",
"{",
"<mask>",
":",
"ch",
".",
"chID",
",",
"CreatedStack",
":",
"ch",
".",
"createdStack",
",",
"LocalPeer",
":",
"ch",
".",
"PeerInfo",
"(",
")",
",",
"}",
"\n",
"}"
] |
2,379 | all-2380 | [
"Clear",
"function",
"clear",
"up",
"the",
"statsQueue"
] | [
"func",
"(",
"q",
"*",
"statsQueue",
")",
"Clear",
"(",
")",
"{",
"q",
".",
"rwl",
".",
"Lock",
"(",
")",
"\n",
"defer",
"q",
".",
"rwl",
".",
"Unlock",
"(",
")",
"\n",
"q",
".",
"back",
"=",
"-",
"1",
"\n",
"q",
".",
"front",
"=",
"0",
"\n",
"q",
".",
"<mask>",
"=",
"0",
"\n",
"q",
".",
"totalReqSize",
"=",
"0",
"\n",
"}"
] |
2,380 | all-2381 | [
"Upsert",
"-"
] | [
"func",
"(",
"s",
"*",
"MockMongo",
")",
"Upsert",
"(",
"selector",
"<mask>",
"{",
"}",
",",
"update",
"interface",
"{",
"}",
")",
"(",
"info",
"*",
"mgo",
".",
"ChangeInfo",
",",
"err",
"error",
")",
"{",
"err",
"=",
"s",
".",
"Err",
"\n",
"return",
"\n",
"}"
] |
2,381 | all-2382 | [
"Value",
"converts",
"a",
"value",
"to",
"a",
"database",
"driver",
"value"
] | [
"func",
"(",
"u",
"MAC",
")",
"Value",
"(",
")",
"(",
"driver",
".",
"Value",
",",
"error",
")",
"{",
"return",
"<mask>",
".",
"Value",
"(",
"string",
"(",
"u",
")",
")",
",",
"nil",
"\n",
"}"
] |
2,382 | all-2383 | [
"GetIssueLabels",
"returns",
"the",
"list",
"of",
"labels",
"currently",
"on",
"issue",
"org",
"/",
"repo#number",
".",
"See",
"https",
":",
"//",
"developer",
".",
"github",
".",
"com",
"/",
"v3",
"/",
"issues",
"/",
"labels",
"/",
"#list",
"-",
"labels",
"-",
"on",
"-",
"an",
"-",
"issue"
] | [
"func",
"(",
"c",
"*",
"<mask>",
")",
"GetIssueLabels",
"(",
"org",
",",
"repo",
"string",
",",
"number",
"int",
")",
"(",
"[",
"]",
"Label",
",",
"error",
")",
"{",
"c",
".",
"log",
"(",
"\"",
"\"",
",",
"org",
",",
"repo",
",",
"number",
")",
"\n",
"return",
"c",
".",
"getLabels",
"(",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"org",
",",
"repo",
",",
"number",
")",
")",
"\n",
"}"
] |
2,383 | all-2384 | [
"NewStack",
"-",
"create",
"new",
"stack",
"based",
"on",
"file"
] | [
"func",
"NewStack",
"(",
"<mask>",
"*",
"os",
".",
"File",
")",
"(",
"*",
"Stack",
",",
"error",
")",
"{",
"stack",
":=",
"&",
"Stack",
"{",
"file",
":",
"file",
",",
"fileName",
":",
"file",
".",
"Name",
"(",
")",
"}",
"\n",
"err",
":=",
"stack",
".",
"Repare",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"stack",
".",
"Close",
"(",
")",
"\n",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"return",
"stack",
",",
"nil",
"\n",
"}"
] |
2,384 | all-2385 | [
"/",
"*",
"Errorf",
"uses",
"msg",
"as",
"a",
"format",
"string",
"with",
"subsequent",
"parameters",
"as",
"values",
"and",
"logs",
"the",
"resulting",
"message",
"to",
"all",
"added",
"loggers",
"at",
"LogLevel",
".",
"LevelError"
] | [
"func",
"(",
"b",
"*",
"Base",
")",
"Errorf",
"(",
"msg",
"string",
",",
"a",
"...",
"<mask>",
"{",
"}",
")",
"error",
"{",
"return",
"b",
".",
"Log",
"(",
"LevelError",
",",
"nil",
",",
"msg",
",",
"a",
"...",
")",
"\n",
"}"
] |
2,385 | all-2386 | [
"Float64",
"returns",
"v",
"s",
"float64",
"value",
"converting",
"from",
"integer",
"if",
"necessary",
".",
"If",
"v",
".",
"Kind",
"()",
"!",
"=",
"Float64",
"and",
"v",
".",
"Kind",
"()",
"!",
"=",
"Int64",
"Float64",
"returns",
"0",
"."
] | [
"func",
"(",
"v",
"Value",
")",
"Float64",
"(",
")",
"float64",
"{",
"x",
",",
"<mask>",
":=",
"v",
".",
"data",
".",
"(",
"float64",
")",
"\n",
"if",
"!",
"ok",
"{",
"x",
",",
"ok",
":=",
"v",
".",
"data",
".",
"(",
"int64",
")",
"\n",
"if",
"ok",
"{",
"return",
"float64",
"(",
"x",
")",
"\n",
"}",
"\n",
"return",
"0",
"\n",
"}",
"\n",
"return",
"x",
"\n",
"}"
] |
2,386 | all-2387 | [
"Authorizer",
"returns",
"a",
"middleware",
"that",
"can",
"be",
"used",
"to",
"authorize",
"a",
"request",
"by",
"requiring",
"an",
"access",
"token",
"with",
"the",
"provided",
"scope",
"to",
"be",
"granted",
"."
] | [
"func",
"(",
"a",
"*",
"Authenticator",
")",
"Authorizer",
"(",
"scope",
"string",
",",
"force",
",",
"loadClient",
",",
"loadResourceOwner",
"bool",
")",
"func",
"(",
"http",
".",
"Handler",
")",
"http",
".",
"<mask>",
"{",
"return",
"func",
"(",
"next",
"http",
".",
"Handler",
")",
"http",
".",
"Handler",
"{",
"return",
"http",
".",
"HandlerFunc",
"(",
"func",
"(",
"w",
"http",
".",
"ResponseWriter",
",",
"r",
"*",
"http",
".",
"Request",
")",
"{",
"// create tracer",
"tracer",
":=",
"fire",
".",
"NewTracerFromRequest",
"(",
"r",
",",
"\"",
"\"",
")",
"\n",
"tracer",
".",
"Tag",
"(",
"\"",
"\"",
",",
"scope",
")",
"\n",
"tracer",
".",
"Tag",
"(",
"\"",
"\"",
",",
"force",
")",
"\n",
"tracer",
".",
"Tag",
"(",
"\"",
"\"",
",",
"loadClient",
")",
"\n",
"tracer",
".",
"Tag",
"(",
"\"",
"\"",
",",
"loadResourceOwner",
")",
"\n",
"defer",
"tracer",
".",
"Finish",
"(",
"true",
")",
"\n\n",
"// add span to context",
"r",
"=",
"r",
".",
"WithContext",
"(",
"tracer",
".",
"Context",
"(",
"r",
".",
"Context",
"(",
")",
")",
")",
"\n\n",
"// immediately pass on request if force is not set and there is",
"// no authentication information provided",
"if",
"!",
"force",
"&&",
"r",
".",
"Header",
".",
"Get",
"(",
"\"",
"\"",
")",
"==",
"\"",
"\"",
"{",
"// call next handler",
"next",
".",
"ServeHTTP",
"(",
"w",
",",
"r",
")",
"\n\n",
"return",
"\n",
"}",
"\n\n",
"// continue any previous aborts",
"defer",
"stack",
".",
"Resume",
"(",
"func",
"(",
"err",
"error",
")",
"{",
"// directly write bearer errors",
"if",
"bearerError",
",",
"ok",
":=",
"err",
".",
"(",
"*",
"bearer",
".",
"Error",
")",
";",
"ok",
"{",
"_",
"=",
"bearer",
".",
"WriteError",
"(",
"w",
",",
"bearerError",
")",
"\n",
"return",
"\n",
"}",
"\n\n",
"// set critical error on last span",
"tracer",
".",
"Tag",
"(",
"\"",
"\"",
",",
"true",
")",
"\n",
"tracer",
".",
"Log",
"(",
"\"",
"\"",
",",
"err",
".",
"Error",
"(",
")",
")",
"\n",
"tracer",
".",
"Log",
"(",
"\"",
"\"",
",",
"stack",
".",
"Trace",
"(",
")",
")",
"\n\n",
"// otherwise report critical errors",
"if",
"a",
".",
"Reporter",
"!=",
"nil",
"{",
"a",
".",
"Reporter",
"(",
"err",
")",
"\n",
"}",
"\n\n",
"// ignore errors caused by writing critical errors",
"_",
"=",
"bearer",
".",
"WriteError",
"(",
"w",
",",
"bearer",
".",
"ServerError",
"(",
")",
")",
"\n",
"}",
")",
"\n\n",
"// parse scope",
"s",
":=",
"oauth2",
".",
"ParseScope",
"(",
"scope",
")",
"\n\n",
"// parse bearer token",
"tk",
",",
"err",
":=",
"bearer",
".",
"ParseToken",
"(",
"r",
")",
"\n",
"stack",
".",
"AbortIf",
"(",
"err",
")",
"\n\n",
"// parse token",
"claims",
",",
"expired",
",",
"err",
":=",
"a",
".",
"policy",
".",
"ParseToken",
"(",
"tk",
")",
"\n",
"if",
"expired",
"{",
"stack",
".",
"Abort",
"(",
"bearer",
".",
"InvalidToken",
"(",
"\"",
"\"",
")",
")",
"\n",
"}",
"else",
"if",
"err",
"!=",
"nil",
"{",
"stack",
".",
"Abort",
"(",
"bearer",
".",
"InvalidToken",
"(",
"\"",
"\"",
")",
")",
"\n",
"}",
"\n\n",
"// copy store",
"store",
":=",
"a",
".",
"store",
".",
"Copy",
"(",
")",
"\n",
"defer",
"store",
".",
"Close",
"(",
")",
"\n\n",
"// create state",
"state",
":=",
"&",
"state",
"{",
"request",
":",
"r",
",",
"writer",
":",
"w",
",",
"store",
":",
"store",
",",
"tracer",
":",
"tracer",
",",
"}",
"\n\n",
"// get token",
"accessToken",
":=",
"a",
".",
"getToken",
"(",
"state",
",",
"a",
".",
"policy",
".",
"Token",
",",
"bson",
".",
"ObjectIdHex",
"(",
"claims",
".",
"Id",
")",
")",
"\n",
"if",
"accessToken",
"==",
"nil",
"{",
"stack",
".",
"Abort",
"(",
"bearer",
".",
"InvalidToken",
"(",
"\"",
"\"",
")",
")",
"\n",
"}",
"\n\n",
"// get additional data",
"typ",
",",
"scope",
",",
"expiresAt",
",",
"clientID",
",",
"resourceOwnerID",
":=",
"accessToken",
".",
"GetTokenData",
"(",
")",
"\n\n",
"// validate token type",
"if",
"typ",
"!=",
"AccessToken",
"{",
"stack",
".",
"Abort",
"(",
"bearer",
".",
"InvalidToken",
"(",
"\"",
"\"",
")",
")",
"\n",
"}",
"\n\n",
"// validate expiration",
"if",
"expiresAt",
".",
"Before",
"(",
"time",
".",
"Now",
"(",
")",
")",
"{",
"stack",
".",
"Abort",
"(",
"bearer",
".",
"InvalidToken",
"(",
"\"",
"\"",
")",
")",
"\n",
"}",
"\n\n",
"// validate scope",
"if",
"!",
"oauth2",
".",
"Scope",
"(",
"scope",
")",
".",
"Includes",
"(",
"s",
")",
"{",
"stack",
".",
"Abort",
"(",
"bearer",
".",
"InsufficientScope",
"(",
"s",
".",
"String",
"(",
")",
")",
")",
"\n",
"}",
"\n\n",
"// create new context with access token",
"ctx",
":=",
"context",
".",
"WithValue",
"(",
"r",
".",
"Context",
"(",
")",
",",
"AccessTokenContextKey",
",",
"accessToken",
")",
"\n\n",
"// call next handler if client should not be loaded",
"if",
"!",
"loadClient",
"{",
"// call next handler",
"next",
".",
"ServeHTTP",
"(",
"w",
",",
"r",
".",
"WithContext",
"(",
"ctx",
")",
")",
"\n\n",
"return",
"\n",
"}",
"\n\n",
"// get client",
"client",
":=",
"a",
".",
"getFirstClient",
"(",
"state",
",",
"clientID",
")",
"\n",
"if",
"client",
"==",
"nil",
"{",
"stack",
".",
"Abort",
"(",
"errors",
".",
"New",
"(",
"\"",
"\"",
")",
")",
"\n",
"}",
"\n\n",
"// create new context with client",
"ctx",
"=",
"context",
".",
"WithValue",
"(",
"ctx",
",",
"ClientContextKey",
",",
"client",
")",
"\n\n",
"// call next handler if resource owner does not exist or should not",
"// be loaded",
"if",
"resourceOwnerID",
"==",
"nil",
"||",
"!",
"loadResourceOwner",
"{",
"// call next handler",
"next",
".",
"ServeHTTP",
"(",
"w",
",",
"r",
".",
"WithContext",
"(",
"ctx",
")",
")",
"\n\n",
"return",
"\n",
"}",
"\n\n",
"// get resource owner",
"resourceOwner",
":=",
"a",
".",
"getFirstResourceOwner",
"(",
"state",
",",
"client",
",",
"*",
"resourceOwnerID",
")",
"\n",
"if",
"resourceOwner",
"==",
"nil",
"{",
"stack",
".",
"Abort",
"(",
"errors",
".",
"New",
"(",
"\"",
"\"",
")",
")",
"\n",
"}",
"\n\n",
"// create new context with resource owner",
"ctx",
"=",
"context",
".",
"WithValue",
"(",
"ctx",
",",
"ResourceOwnerContextKey",
",",
"resourceOwner",
")",
"\n\n",
"// call next handler",
"next",
".",
"ServeHTTP",
"(",
"w",
",",
"r",
".",
"WithContext",
"(",
"ctx",
")",
")",
"\n",
"}",
")",
"\n",
"}",
"\n",
"}"
] |
2,387 | all-2388 | [
"backup",
"does",
"a",
"backup",
"of",
"a",
"file",
"."
] | [
"func",
"backup",
"(",
"filename",
"string",
")",
"error",
"{",
"if",
"DO_BACKUP",
"{",
"if",
"_",
",",
"ok",
":=",
"_FILES_BACKUPED",
"[",
"filename",
"]",
";",
"!",
"ok",
"{",
"if",
"err",
":=",
"<mask>",
".",
"Backup",
"(",
"filename",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"_FILES_BACKUPED",
"[",
"filename",
"]",
"=",
"struct",
"{",
"}",
"{",
"}",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
] |
2,388 | all-2389 | [
"TempFile",
"mocks",
"base",
"method"
] | [
"func",
"(",
"m",
"*",
"MockFileSystem",
")",
"TempFile",
"(",
"arg0",
",",
"arg1",
"string",
")",
"(",
"*",
"os",
".",
"File",
",",
"error",
")",
"{",
"ret",
":=",
"m",
".",
"ctrl",
".",
"Call",
"(",
"m",
",",
"\"",
"\"",
",",
"arg0",
",",
"arg1",
")",
"\n",
"ret0",
",",
"_",
":=",
"ret",
"[",
"0",
"]",
".",
"(",
"*",
"os",
".",
"File",
")",
"\n",
"ret1",
",",
"_",
":=",
"<mask>",
"[",
"1",
"]",
".",
"(",
"error",
")",
"\n",
"return",
"ret0",
",",
"ret1",
"\n",
"}"
] |
2,389 | all-2390 | [
"NewPhoneNumberButton",
"creates",
"a",
"button",
"used",
"in",
"ButtonTemplate",
"that",
"upon",
"clicking",
"opens",
"a",
"native",
"dialer"
] | [
"func",
"NewPhoneNumberButton",
"(",
"title",
"string",
",",
"phone",
"string",
")",
"Button",
"{",
"return",
"Button",
"{",
"<mask>",
":",
"ButtonTypePhoneNumber",
",",
"Title",
":",
"title",
",",
"Payload",
":",
"phone",
",",
"}",
"\n",
"}"
] |
2,390 | all-2391 | [
"NewRemoteContext",
"returns",
"a",
"context",
"that",
"gives",
"access",
"to",
"the",
"production",
"APIs",
"for",
"the",
"application",
"at",
"the",
"given",
"host",
".",
"All",
"communication",
"will",
"be",
"performed",
"over",
"SSL",
"unless",
"the",
"host",
"is",
"localhost",
"."
] | [
"func",
"NewRemoteContext",
"(",
"host",
"string",
",",
"client",
"*",
"http",
".",
"<mask>",
")",
"(",
"context",
".",
"Context",
",",
"error",
")",
"{",
"c",
",",
"err",
":=",
"NewClient",
"(",
"host",
",",
"client",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"return",
"c",
".",
"NewContext",
"(",
"context",
".",
"Background",
"(",
")",
")",
",",
"nil",
"\n",
"}"
] |
2,391 | all-2392 | [
"GetElapsedTime",
"returns",
"the",
"elapsed",
"time",
"since",
"an",
"ExponentialBackOff",
"instance",
"is",
"created",
"and",
"is",
"reset",
"when",
"Reset",
"()",
"is",
"called",
".",
"The",
"elapsed",
"time",
"is",
"computed",
"using",
"time",
".",
"Now",
"()",
".",
"UnixNano",
"()",
"."
] | [
"func",
"(",
"b",
"*",
"ConstantBackOff",
")",
"GetElapsedTime",
"(",
")",
"time",
".",
"Duration",
"{",
"return",
"<mask>",
".",
"Now",
"(",
")",
".",
"Sub",
"(",
"b",
".",
"startTime",
")",
"\n",
"}"
] |
2,392 | all-2393 | [
"WithWindowsVirtualKeyCode",
"windows",
"virtual",
"key",
"code",
"(",
"default",
":",
"0",
")",
"."
] | [
"func",
"(",
"p",
"DispatchKeyEventParams",
")",
"WithWindowsVirtualKeyCode",
"(",
"windowsVirtualKeyCode",
"int64",
")",
"*",
"DispatchKeyEventParams",
"{",
"p",
".",
"WindowsVirtualKeyCode",
"=",
"windowsVirtualKeyCode",
"\n",
"<mask>",
"&",
"p",
"\n",
"}"
] |
2,393 | all-2394 | [
"Popmark",
"pops",
"the",
"mark",
"stored",
"at",
"the",
"top",
"of",
"the",
"mark",
"stack"
] | [
"func",
"(",
"st",
"*",
"State",
")",
"Popmark",
"(",
")",
"int",
"{",
"x",
":=",
"st",
".",
"markstack",
".",
"Pop",
"(",
")",
"\n",
"<mask>",
"x",
".",
"(",
"int",
")",
"\n",
"}"
] |
2,394 | all-2395 | [
"Rotate",
"is",
"a",
"wrapper",
"around",
"cairo_rotate",
"."
] | [
"func",
"(",
"v",
"*",
"<mask>",
")",
"Rotate",
"(",
"angle",
"float64",
")",
"{",
"C",
".",
"cairo_rotate",
"(",
"v",
".",
"native",
"(",
")",
",",
"C",
".",
"double",
"(",
"angle",
")",
")",
"\n",
"}"
] |
2,395 | all-2396 | [
"Get",
"target",
"language",
"string"
] | [
"func",
"(",
"d",
"*",
"localeStore",
")",
"Get",
"(",
"lang",
",",
"section",
",",
"format",
"string",
")",
"(",
"string",
",",
"bool",
")",
"{",
"if",
"locale",
",",
"ok",
":=",
"d",
".",
"store",
"[",
"lang",
"]",
";",
"ok",
"{",
"if",
"<mask>",
"==",
"\"",
"\"",
"{",
"section",
"=",
"goconfig",
".",
"DEFAULT_SECTION",
"\n",
"}",
"\n\n",
"if",
"value",
",",
"err",
":=",
"locale",
".",
"message",
".",
"GetValue",
"(",
"section",
",",
"format",
")",
";",
"err",
"==",
"nil",
"{",
"return",
"value",
",",
"true",
"\n",
"}",
"\n",
"}",
"\n\n",
"return",
"\"",
"\"",
",",
"false",
"\n",
"}"
] |
2,396 | all-2397 | [
"time"
] | [
"func",
"convertNvTime",
"(",
"v",
"interface",
"{",
"}",
")",
"(",
"driver",
".",
"Value",
",",
"error",
")",
"{",
"if",
"v",
"==",
"nil",
"{",
"return",
"nil",
",",
"nil",
"\n",
"}",
"\n\n",
"switch",
"v",
":=",
"v",
".",
"(",
"type",
")",
"{",
"case",
"time",
".",
"Time",
":",
"return",
"v",
",",
"nil",
"\n",
"}",
"\n\n",
"rv",
":=",
"reflect",
".",
"ValueOf",
"(",
"v",
")",
"\n\n",
"switch",
"rv",
".",
"Kind",
"(",
")",
"{",
"<mask>",
"reflect",
".",
"Ptr",
":",
"// indirect pointers",
"if",
"rv",
".",
"IsNil",
"(",
")",
"{",
"return",
"nil",
",",
"nil",
"\n",
"}",
"\n",
"return",
"convertNvTime",
"(",
"rv",
".",
"Elem",
"(",
")",
".",
"Interface",
"(",
")",
")",
"\n",
"}",
"\n\n",
"if",
"rv",
".",
"Type",
"(",
")",
".",
"ConvertibleTo",
"(",
"typeOfTime",
")",
"{",
"tv",
":=",
"rv",
".",
"Convert",
"(",
"typeOfTime",
")",
"\n",
"return",
"tv",
".",
"Interface",
"(",
")",
".",
"(",
"time",
".",
"Time",
")",
",",
"nil",
"\n",
"}",
"\n\n",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"v",
")",
"\n",
"}"
] |
2,397 | all-2398 | [
"PayWith",
"is",
"a",
"helper",
"to",
"create",
"PayWithPath",
"struct"
] | [
"func",
"PayWith",
"(",
"sendAsset",
"Asset",
",",
"maxAmount",
"string",
")",
"PayWithPath",
"{",
"return",
"PayWithPath",
"{",
"<mask>",
":",
"sendAsset",
",",
"MaxAmount",
":",
"maxAmount",
",",
"}",
"\n",
"}"
] |
2,398 | all-2399 | [
"findChild",
"finds",
"a",
"child",
"node",
"that",
"matches",
"the",
"given",
"node",
"It",
"returns",
"nil",
"if",
"no",
"node",
"found",
".",
"This",
"is",
"to",
"see",
"if",
"we",
"already",
"have",
"a",
"similar",
"node",
"registered"
] | [
"func",
"(",
"n",
"*",
"routeNode",
")",
"findChild",
"(",
"nn",
"*",
"routeNode",
")",
"*",
"routeNode",
"{",
"for",
"_",
",",
"c",
":=",
"range",
"n",
".",
"children",
"{",
"if",
"c",
".",
"path",
"==",
"nn",
".",
"<mask>",
"{",
"// same node",
"return",
"c",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
] |
2,399 | all-2400 | [
"fill",
"all",
"or",
"part",
"of",
"buffer",
"object",
"s",
"data",
"store",
"with",
"a",
"fixed",
"value"
] | [
"func",
"ClearBufferSubData",
"(",
"target",
"uint32",
",",
"internalformat",
"uint32",
",",
"offset",
"int",
",",
"size",
"int",
",",
"format",
"uint32",
",",
"xtype",
"uint32",
",",
"data",
"unsafe",
".",
"Pointer",
")",
"{",
"C",
".",
"glowClearBufferSubData",
"(",
"gpClearBufferSubData",
",",
"(",
"C",
".",
"GLenum",
")",
"(",
"target",
")",
",",
"(",
"C",
".",
"GLenum",
")",
"(",
"internalformat",
")",
",",
"(",
"C",
".",
"GLintptr",
")",
"(",
"<mask>",
")",
",",
"(",
"C",
".",
"GLsizeiptr",
")",
"(",
"size",
")",
",",
"(",
"C",
".",
"GLenum",
")",
"(",
"format",
")",
",",
"(",
"C",
".",
"GLenum",
")",
"(",
"xtype",
")",
",",
"data",
")",
"\n",
"}"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.