id
int32 0
25.3k
| idx
stringlengths 5
9
| nl_tokens
sequencelengths 1
418
| pl_tokens
sequencelengths 22
4.98k
|
---|---|---|---|
8,700 | all-8701 | [
"GetFillMin",
"returns",
"the",
"FillMin",
"field",
"if",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"."
] | [
"func",
"(",
"t",
"*",
"TileDefStyle",
")",
"GetFillMin",
"(",
")",
"json",
".",
"Number",
"{",
"if",
"t",
"==",
"nil",
"||",
"t",
".",
"FillMin",
"==",
"nil",
"{",
"<mask>",
"\"",
"\"",
"\n",
"}",
"\n",
"return",
"*",
"t",
".",
"FillMin",
"\n",
"}"
] |
8,701 | all-8702 | [
"Features",
"returns",
"VM",
"supported",
"features",
".",
"func",
"(",
"v",
"*",
"VM",
")",
"Features",
"()",
"(",
"string",
"error",
")",
"{",
"var",
"err",
"C",
".",
"VixError",
"=",
"C",
".",
"VIX_OK",
"var",
"features",
"*",
"C",
".",
"char",
"err",
"=",
"C",
".",
"get_property",
"(",
"v",
".",
"handle",
"C",
".",
"VIX_PROPERTY_VM_SUPPORTED_FEATURES",
"unsafe",
".",
"Pointer",
"(",
"&features",
"))",
"defer",
"C",
".",
"Vix_FreeBuffer",
"(",
"unsafe",
".",
"Pointer",
"(",
"features",
"))",
"if",
"C",
".",
"VIX_OK",
"!",
"=",
"err",
"{",
"return",
"&VixError",
"{",
"code",
":",
"int",
"(",
"err",
"&",
"0xFFFF",
")",
"text",
":",
"C",
".",
"GoString",
"(",
"C",
".",
"Vix_GetErrorText",
"(",
"err",
"nil",
"))",
"}",
"}",
"return",
"C",
".",
"GoString",
"(",
"features",
")",
"nil",
"}",
"EnableSharedFolders",
"enables",
"or",
"disables",
"all",
"shared",
"folders",
"as",
"a",
"feature",
"for",
"a",
"virtual",
"machine",
".",
"Remarks",
":",
"*",
"This",
"function",
"enables",
"/",
"disables",
"all",
"shared",
"folders",
"as",
"a",
"feature",
"on",
"a",
"virtual",
"machine",
".",
"In",
"order",
"to",
"access",
"shared",
"folders",
"on",
"a",
"guest",
"the",
"feature",
"has",
"to",
"be",
"enabled",
"and",
"in",
"addition",
"the",
"individual",
"shared",
"folder",
"has",
"to",
"be",
"enabled",
".",
"*",
"It",
"is",
"not",
"necessary",
"to",
"call",
"VM",
".",
"LoginInGuest",
"()",
"before",
"calling",
"this",
"function",
".",
"*",
"In",
"this",
"release",
"this",
"function",
"requires",
"the",
"virtual",
"machine",
"to",
"be",
"powered",
"on",
"with",
"VMware",
"Tools",
"installed",
".",
"*",
"Shared",
"folders",
"are",
"not",
"supported",
"for",
"the",
"following",
"guest",
"operating",
"systems",
":",
"Windows",
"ME",
"Windows",
"98",
"Windows",
"95",
"Windows",
"3",
".",
"x",
"and",
"DOS",
".",
"*",
"On",
"Linux",
"virtual",
"machines",
"calling",
"this",
"function",
"will",
"automatically",
"mount",
"shared",
"folder",
"(",
"s",
")",
"in",
"the",
"guest",
".",
"Since",
"VMware",
"Workstation",
"6",
".",
"0",
"not",
"available",
"on",
"Server",
"2",
".",
"0",
".",
"Minimum",
"Supported",
"Guest",
"OS",
":",
"Microsoft",
"Windows",
"NT",
"Series",
"Linux"
] | [
"func",
"(",
"v",
"*",
"VM",
")",
"EnableSharedFolders",
"(",
"enabled",
"bool",
")",
"error",
"{",
"var",
"jobHandle",
"C",
".",
"VixHandle",
"=",
"C",
".",
"VIX_INVALID_HANDLE",
"\n",
"var",
"err",
"C",
".",
"VixError",
"=",
"C",
".",
"VIX_OK",
"\n\n",
"var",
"share",
"C",
".",
"Bool",
"=",
"C",
".",
"FALSE",
"\n",
"if",
"enabled",
"{",
"share",
"=",
"C",
".",
"TRUE",
"\n",
"}",
"\n\n",
"jobHandle",
"=",
"C",
".",
"VixVM_EnableSharedFolders",
"(",
"v",
".",
"<mask>",
",",
"share",
",",
"0",
",",
"nil",
",",
"nil",
")",
"\n\n",
"defer",
"C",
".",
"Vix_ReleaseHandle",
"(",
"jobHandle",
")",
"\n\n",
"err",
"=",
"C",
".",
"vix_job_wait",
"(",
"jobHandle",
")",
"\n",
"if",
"C",
".",
"VIX_OK",
"!=",
"err",
"{",
"return",
"&",
"Error",
"{",
"Operation",
":",
"\"",
"\"",
",",
"Code",
":",
"int",
"(",
"err",
"&",
"0xFFFF",
")",
",",
"Text",
":",
"C",
".",
"GoString",
"(",
"C",
".",
"Vix_GetErrorText",
"(",
"err",
",",
"nil",
")",
")",
",",
"}",
"\n",
"}",
"\n\n",
"return",
"nil",
"\n",
"}"
] |
8,702 | all-8703 | [
"LogFactory",
"-",
"a",
"log",
"creator"
] | [
"func",
"LogFactory",
"(",
"name",
"string",
",",
"logType",
"LogType",
",",
"writer",
"io",
".",
"Writer",
")",
"Logger",
"{",
"log",
":=",
"&",
"logger",
"{",
"Name",
":",
"name",
",",
"LogLevel",
":",
"minLogLevel",
",",
"Writer",
":",
"writer",
"}",
"\n",
"if",
"logType",
"==",
"Lager",
"{",
"return",
"NewLager",
"(",
"log",
")",
"\n",
"}",
"\n",
"return",
"NewLager",
"(",
"<mask>",
")",
"\n",
"}"
] |
8,703 | all-8704 | [
"getSystemHandler",
"on",
"Linux",
"writes",
"messages",
"to",
"syslog",
"."
] | [
"func",
"getSystemHandler",
"(",
"syslog",
"string",
",",
"debug",
"bool",
",",
"format",
"log",
".",
"Format",
")",
"log",
".",
"Handler",
"{",
"// SyslogHandler",
"if",
"syslog",
"!=",
"\"",
"\"",
"{",
"if",
"!",
"debug",
"{",
"return",
"log",
".",
"LvlFilterHandler",
"(",
"log",
".",
"LvlInfo",
",",
"log",
".",
"Must",
".",
"SyslogHandler",
"(",
"syslog",
",",
"format",
")",
",",
")",
"\n",
"}",
"\n\n",
"return",
"<mask>",
".",
"Must",
".",
"SyslogHandler",
"(",
"syslog",
",",
"format",
")",
"\n",
"}",
"\n\n",
"return",
"nil",
"\n",
"}"
] |
8,704 | all-8705 | [
"determine",
"if",
"a",
"name",
"corresponds",
"to",
"a",
"renderbuffer",
"object"
] | [
"func",
"IsRenderbuffer",
"(",
"renderbuffer",
"uint32",
")",
"bool",
"{",
"<mask>",
",",
"_",
",",
"_",
":=",
"syscall",
".",
"Syscall",
"(",
"gpIsRenderbuffer",
",",
"1",
",",
"uintptr",
"(",
"renderbuffer",
")",
",",
"0",
",",
"0",
")",
"\n",
"return",
"ret",
"!=",
"0",
"\n",
"}"
] |
8,705 | all-8706 | [
"SetAppliedStatus",
"sets",
"the",
"applied",
"status",
"of",
"container",
"and",
"returns",
"whether",
"the",
"container",
"is",
"already",
"in",
"a",
"transition"
] | [
"func",
"(",
"c",
"*",
"Container",
")",
"SetAppliedStatus",
"(",
"<mask>",
"apicontainerstatus",
".",
"ContainerStatus",
")",
"bool",
"{",
"c",
".",
"lock",
".",
"Lock",
"(",
")",
"\n",
"defer",
"c",
".",
"lock",
".",
"Unlock",
"(",
")",
"\n\n",
"if",
"c",
".",
"AppliedStatus",
"!=",
"apicontainerstatus",
".",
"ContainerStatusNone",
"{",
"// return false to indicate the set operation failed",
"return",
"false",
"\n",
"}",
"\n\n",
"c",
".",
"AppliedStatus",
"=",
"status",
"\n",
"return",
"true",
"\n",
"}"
] |
8,706 | all-8707 | [
"SetConsoleCursorPosition",
"location",
"of",
"the",
"console",
"cursor",
".",
"See",
"https",
":",
"//",
"msdn",
".",
"microsoft",
".",
"com",
"/",
"en",
"-",
"us",
"/",
"library",
"/",
"windows",
"/",
"desktop",
"/",
"ms686025",
"(",
"v",
"=",
"vs",
".",
"85",
")",
".",
"aspx",
"."
] | [
"func",
"SetConsoleCursorPosition",
"(",
"handle",
"uintptr",
",",
"coord",
"COORD",
")",
"error",
"{",
"r1",
",",
"r2",
",",
"err",
":=",
"setConsoleCursorPositionProc",
".",
"Call",
"(",
"handle",
",",
"coordToPointer",
"(",
"coord",
")",
")",
"\n",
"<mask>",
"(",
"coord",
")",
"\n",
"return",
"checkError",
"(",
"r1",
",",
"r2",
",",
"err",
")",
"\n",
"}"
] |
8,707 | all-8708 | [
"Draw",
"a",
"gopher",
"head",
"(",
"not",
"rotated",
")"
] | [
"func",
"Draw",
"(",
"gc",
"draw2d",
".",
"GraphicContext",
",",
"x",
",",
"y",
",",
"w",
",",
"h",
"float64",
")",
"{",
"h23",
":=",
"(",
"h",
"*",
"2",
")",
"/",
"3",
"\n\n",
"blf",
":=",
"color",
".",
"RGBA",
"{",
"0",
",",
"0",
",",
"0",
",",
"0xff",
"}",
"// black",
"\n",
"wf",
":=",
"color",
".",
"RGBA",
"{",
"0xff",
",",
"0xff",
",",
"0xff",
",",
"0xff",
"}",
"// white",
"\n",
"nf",
":=",
"<mask>",
".",
"RGBA",
"{",
"0x8B",
",",
"0x45",
",",
"0x13",
",",
"0xff",
"}",
"// brown opaque",
"\n",
"brf",
":=",
"color",
".",
"RGBA",
"{",
"0x8B",
",",
"0x45",
",",
"0x13",
",",
"0x99",
"}",
"// brown transparant",
"\n",
"brb",
":=",
"color",
".",
"RGBA",
"{",
"0x8B",
",",
"0x45",
",",
"0x13",
",",
"0xBB",
"}",
"// brown transparant",
"\n\n",
"// round head top",
"gc",
".",
"MoveTo",
"(",
"x",
",",
"y",
"+",
"h",
"*",
"1.002",
")",
"\n",
"gc",
".",
"CubicCurveTo",
"(",
"x",
"+",
"w",
"/",
"4",
",",
"y",
"-",
"h",
"/",
"3",
",",
"x",
"+",
"3",
"*",
"w",
"/",
"4",
",",
"y",
"-",
"h",
"/",
"3",
",",
"x",
"+",
"w",
",",
"y",
"+",
"h",
"*",
"1.002",
")",
"\n",
"gc",
".",
"Close",
"(",
")",
"\n",
"gc",
".",
"SetFillColor",
"(",
"brb",
")",
"\n",
"gc",
".",
"Fill",
"(",
")",
"\n\n",
"// rectangle head bottom",
"draw2dkit",
".",
"RoundedRectangle",
"(",
"gc",
",",
"x",
",",
"y",
"+",
"h",
",",
"x",
"+",
"w",
",",
"y",
"+",
"h",
"+",
"h",
",",
"h",
"/",
"5",
",",
"h",
"/",
"5",
")",
"\n",
"gc",
".",
"Fill",
"(",
")",
"\n\n",
"// left ear outside",
"draw2dkit",
".",
"Circle",
"(",
"gc",
",",
"x",
",",
"y",
"+",
"h",
",",
"w",
"/",
"12",
")",
"\n",
"gc",
".",
"SetFillColor",
"(",
"brf",
")",
"\n",
"gc",
".",
"Fill",
"(",
")",
"\n\n",
"// left ear inside",
"draw2dkit",
".",
"Circle",
"(",
"gc",
",",
"x",
",",
"y",
"+",
"h",
",",
"0.5",
"*",
"w",
"/",
"12",
")",
"\n",
"gc",
".",
"SetFillColor",
"(",
"nf",
")",
"\n",
"gc",
".",
"Fill",
"(",
")",
"\n\n",
"// right ear outside",
"draw2dkit",
".",
"Circle",
"(",
"gc",
",",
"x",
"+",
"w",
",",
"y",
"+",
"h",
",",
"w",
"/",
"12",
")",
"\n",
"gc",
".",
"SetFillColor",
"(",
"brf",
")",
"\n",
"gc",
".",
"Fill",
"(",
")",
"\n\n",
"// right ear inside",
"draw2dkit",
".",
"Circle",
"(",
"gc",
",",
"x",
"+",
"w",
",",
"y",
"+",
"h",
",",
"0.5",
"*",
"w",
"/",
"12",
")",
"\n",
"gc",
".",
"SetFillColor",
"(",
"nf",
")",
"\n",
"gc",
".",
"Fill",
"(",
")",
"\n\n",
"// left eye outside white",
"draw2dkit",
".",
"Circle",
"(",
"gc",
",",
"x",
"+",
"w",
"/",
"3",
",",
"y",
"+",
"h23",
",",
"w",
"/",
"9",
")",
"\n",
"gc",
".",
"SetFillColor",
"(",
"wf",
")",
"\n",
"gc",
".",
"Fill",
"(",
")",
"\n\n",
"// left eye black",
"draw2dkit",
".",
"Circle",
"(",
"gc",
",",
"x",
"+",
"w",
"/",
"3",
"+",
"w",
"/",
"24",
",",
"y",
"+",
"h23",
",",
"0.5",
"*",
"w",
"/",
"9",
")",
"\n",
"gc",
".",
"SetFillColor",
"(",
"blf",
")",
"\n",
"gc",
".",
"Fill",
"(",
")",
"\n\n",
"// left eye inside white",
"draw2dkit",
".",
"Circle",
"(",
"gc",
",",
"x",
"+",
"w",
"/",
"3",
"+",
"w",
"/",
"24",
"+",
"w",
"/",
"48",
",",
"y",
"+",
"h23",
",",
"0.2",
"*",
"w",
"/",
"9",
")",
"\n",
"gc",
".",
"SetFillColor",
"(",
"wf",
")",
"\n",
"gc",
".",
"Fill",
"(",
")",
"\n\n",
"// right eye outside white",
"draw2dkit",
".",
"Circle",
"(",
"gc",
",",
"x",
"+",
"w",
"-",
"w",
"/",
"3",
",",
"y",
"+",
"h23",
",",
"w",
"/",
"9",
")",
"\n",
"gc",
".",
"Fill",
"(",
")",
"\n\n",
"// right eye black",
"draw2dkit",
".",
"Circle",
"(",
"gc",
",",
"x",
"+",
"w",
"-",
"w",
"/",
"3",
"+",
"w",
"/",
"24",
",",
"y",
"+",
"h23",
",",
"0.5",
"*",
"w",
"/",
"9",
")",
"\n",
"gc",
".",
"SetFillColor",
"(",
"blf",
")",
"\n",
"gc",
".",
"Fill",
"(",
")",
"\n\n",
"// right eye inside white",
"draw2dkit",
".",
"Circle",
"(",
"gc",
",",
"x",
"+",
"w",
"-",
"(",
"w",
"/",
"3",
")",
"+",
"w",
"/",
"24",
"+",
"w",
"/",
"48",
",",
"y",
"+",
"h23",
",",
"0.2",
"*",
"w",
"/",
"9",
")",
"\n",
"gc",
".",
"SetFillColor",
"(",
"wf",
")",
"\n",
"gc",
".",
"Fill",
"(",
")",
"\n\n",
"// left tooth",
"gc",
".",
"SetFillColor",
"(",
"wf",
")",
"\n",
"draw2dkit",
".",
"RoundedRectangle",
"(",
"gc",
",",
"x",
"+",
"w",
"/",
"2",
"-",
"w",
"/",
"8",
",",
"y",
"+",
"h",
"+",
"h",
"/",
"2.5",
",",
"x",
"+",
"w",
"/",
"2",
"-",
"w",
"/",
"8",
"+",
"w",
"/",
"8",
",",
"y",
"+",
"h",
"+",
"h",
"/",
"2.5",
"+",
"w",
"/",
"6",
",",
"w",
"/",
"10",
",",
"w",
"/",
"10",
")",
"\n",
"gc",
".",
"Fill",
"(",
")",
"\n\n",
"// right tooth",
"draw2dkit",
".",
"RoundedRectangle",
"(",
"gc",
",",
"x",
"+",
"w",
"/",
"2",
",",
"y",
"+",
"h",
"+",
"h",
"/",
"2.5",
",",
"x",
"+",
"w",
"/",
"2",
"+",
"w",
"/",
"8",
",",
"y",
"+",
"h",
"+",
"h",
"/",
"2.5",
"+",
"w",
"/",
"6",
",",
"w",
"/",
"10",
",",
"w",
"/",
"10",
")",
"\n",
"gc",
".",
"Fill",
"(",
")",
"\n\n",
"// snout",
"draw2dkit",
".",
"Ellipse",
"(",
"gc",
",",
"x",
"+",
"(",
"w",
"/",
"2",
")",
",",
"y",
"+",
"h",
"+",
"h",
"/",
"2.5",
",",
"w",
"/",
"6",
",",
"w",
"/",
"12",
")",
"\n",
"gc",
".",
"SetFillColor",
"(",
"nf",
")",
"\n",
"gc",
".",
"Fill",
"(",
")",
"\n\n",
"// nose",
"draw2dkit",
".",
"Ellipse",
"(",
"gc",
",",
"x",
"+",
"(",
"w",
"/",
"2",
")",
",",
"y",
"+",
"h",
"+",
"h",
"/",
"7",
",",
"w",
"/",
"10",
",",
"w",
"/",
"12",
")",
"\n",
"gc",
".",
"SetFillColor",
"(",
"blf",
")",
"\n",
"gc",
".",
"Fill",
"(",
")",
"\n",
"}"
] |
8,708 | all-8709 | [
"DeepCopy",
"is",
"an",
"autogenerated",
"deepcopy",
"function",
"copying",
"the",
"receiver",
"creating",
"a",
"new",
"JenkinsSpec",
"."
] | [
"func",
"(",
"in",
"*",
"JenkinsSpec",
")",
"DeepCopy",
"(",
")",
"*",
"JenkinsSpec",
"{",
"if",
"in",
"==",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n",
"out",
":=",
"new",
"(",
"JenkinsSpec",
")",
"\n",
"in",
".",
"DeepCopyInto",
"(",
"<mask>",
")",
"\n",
"return",
"out",
"\n",
"}"
] |
8,709 | all-8710 | [
"UnrequestReview",
"tries",
"to",
"remove",
"the",
"users",
"listed",
"in",
"logins",
"from",
"the",
"requested",
"reviewers",
"of",
"the",
"specified",
"PR",
".",
"The",
"GitHub",
"API",
"treats",
"deletions",
"of",
"review",
"requests",
"differently",
"than",
"creations",
".",
"Specifically",
"if",
"logins",
"contains",
"a",
"user",
"that",
"isn",
"t",
"a",
"requested",
"reviewer",
"other",
"users",
"that",
"are",
"valid",
"are",
"still",
"removed",
".",
"Furthermore",
"the",
"API",
"response",
"lists",
"the",
"set",
"of",
"requested",
"reviewers",
"after",
"the",
"deletion",
"(",
"unlike",
"request",
"creations",
")",
"so",
"we",
"can",
"determine",
"if",
"each",
"deletion",
"was",
"successful",
".",
"The",
"API",
"responds",
"with",
"http",
"status",
"code",
"200",
"no",
"matter",
"what",
"the",
"content",
"of",
"logins",
"is",
".",
"See",
"https",
":",
"//",
"developer",
".",
"github",
".",
"com",
"/",
"v3",
"/",
"pulls",
"/",
"review_requests",
"/",
"#delete",
"-",
"a",
"-",
"review",
"-",
"request"
] | [
"func",
"(",
"c",
"*",
"Client",
")",
"UnrequestReview",
"(",
"org",
",",
"repo",
"string",
",",
"number",
"int",
",",
"logins",
"[",
"]",
"string",
")",
"error",
"{",
"c",
".",
"log",
"(",
"\"",
"\"",
",",
"org",
",",
"repo",
",",
"number",
",",
"logins",
")",
"\n",
"var",
"pr",
"PullRequest",
"\n",
"body",
",",
"err",
":=",
"prepareReviewersBody",
"(",
"logins",
",",
"org",
")",
"\n",
"if",
"len",
"(",
"body",
")",
"==",
"0",
"{",
"// No point in doing request for none,",
"// if some logins didn't make it to body, extras.Users will catch them.",
"return",
"err",
"\n",
"}",
"\n",
"_",
",",
"err",
"=",
"c",
".",
"request",
"(",
"&",
"request",
"{",
"method",
":",
"http",
".",
"MethodDelete",
",",
"path",
":",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"org",
",",
"repo",
",",
"number",
")",
",",
"accept",
":",
"\"",
"\"",
",",
"requestBody",
":",
"<mask>",
",",
"exitCodes",
":",
"[",
"]",
"int",
"{",
"http",
".",
"StatusOK",
"/*200*/",
"}",
",",
"}",
",",
"&",
"pr",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"extras",
":=",
"ExtraUsers",
"{",
"action",
":",
"\"",
"\"",
"}",
"\n",
"for",
"_",
",",
"user",
":=",
"range",
"pr",
".",
"RequestedReviewers",
"{",
"found",
":=",
"false",
"\n",
"for",
"_",
",",
"toDelete",
":=",
"range",
"logins",
"{",
"if",
"NormLogin",
"(",
"user",
".",
"Login",
")",
"==",
"NormLogin",
"(",
"toDelete",
")",
"{",
"found",
"=",
"true",
"\n",
"break",
"\n",
"}",
"\n",
"}",
"\n",
"if",
"found",
"{",
"extras",
".",
"Users",
"=",
"append",
"(",
"extras",
".",
"Users",
",",
"user",
".",
"Login",
")",
"\n",
"}",
"\n",
"}",
"\n",
"if",
"len",
"(",
"extras",
".",
"Users",
")",
">",
"0",
"{",
"return",
"extras",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
] |
8,710 | all-8711 | [
"CreateDatabaseClient",
"creates",
"and",
"connects",
"a",
"new",
"instance",
"of",
"an",
"InfluxDB",
"It",
"is",
"created",
"based",
"on",
"the",
"fields",
"set",
"in",
"the",
"configuration",
"."
] | [
"func",
"(",
"config",
"*",
"InfluxConfig",
")",
"CreateDatabaseClient",
"(",
")",
"(",
"*",
"InfluxDB",
",",
"error",
")",
"{",
"client",
",",
"err",
":=",
"influxdb",
".",
"NewHTTPClient",
"(",
"influxdb",
".",
"HTTPConfig",
"{",
"Addr",
":",
"config",
".",
"Host",
",",
"Username",
":",
"config",
".",
"User",
",",
"Password",
":",
"config",
".",
"Password",
",",
"}",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"return",
"&",
"InfluxDB",
"{",
"client",
":",
"client",
",",
"<mask>",
":",
"config",
".",
"DB",
",",
"}",
",",
"nil",
"\n",
"}"
] |
8,711 | all-8712 | [
"PutTimestamp",
"writes",
"a",
"64",
"-",
"bit",
"signed",
"integer",
"(",
"using",
"time",
".",
"UnixNano",
"()",
")",
"for",
"the",
"given",
"time",
".",
"Time",
"value",
".",
"The",
"timestamp",
"field",
"type",
"must",
"be",
"a",
"TimestampField",
".",
"If",
"the",
"buffer",
"does",
"not",
"have",
"enough",
"space",
"available",
"an",
"error",
"is",
"returned",
".",
"Upon",
"successful",
"write",
"the",
"number",
"of",
"bytes",
"written",
"will",
"be",
"returned",
"as",
"well",
"as",
"a",
"nil",
"error",
"."
] | [
"func",
"(",
"b",
"*",
"TupleBuilder",
")",
"PutTimestamp",
"(",
"field",
"string",
",",
"value",
"<mask>",
".",
"Time",
")",
"(",
"wrote",
"uint64",
",",
"err",
"error",
")",
"{",
"// field type should be",
"if",
"err",
"=",
"b",
".",
"typeCheck",
"(",
"field",
",",
"TimestampField",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"0",
",",
"err",
"\n",
"}",
"\n\n",
"// write value",
"// length check performed by xbinary",
"wrote",
",",
"err",
"=",
"xbinary",
".",
"LittleEndian",
".",
"PutInt64",
"(",
"b",
".",
"buffer",
",",
"b",
".",
"pos",
"+",
"1",
",",
"value",
".",
"UnixNano",
"(",
")",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"0",
",",
"err",
"\n",
"}",
"\n\n",
"// write type code",
"b",
".",
"buffer",
"[",
"b",
".",
"pos",
"]",
"=",
"byte",
"(",
"TimestampCode",
".",
"OpCode",
")",
"\n\n",
"// set field offset",
"b",
".",
"offsets",
"[",
"field",
"]",
"=",
"b",
".",
"pos",
"\n\n",
"// incr pos",
"b",
".",
"pos",
"+=",
"9",
"\n\n",
"// wrote 9 bytes",
"return",
"9",
",",
"nil",
"\n",
"}"
] |
8,712 | all-8713 | [
"Labels",
"returns",
"the",
"labels",
"to",
"apply",
"to",
"the",
"issue",
"created",
"for",
"this",
"flaky",
"job",
"on",
"github",
"."
] | [
"func",
"(",
"fj",
"*",
"FlakyJob",
")",
"Labels",
"(",
")",
"[",
"]",
"string",
"{",
"labels",
":=",
"[",
"]",
"string",
"{",
"\"",
"\"",
"}",
"\n",
"// get sig labels",
"for",
"sig",
":=",
"range",
"fj",
".",
"reporter",
".",
"<mask>",
".",
"TestsSIGs",
"(",
"fj",
".",
"TestsSorted",
"(",
")",
")",
"{",
"labels",
"=",
"append",
"(",
"labels",
",",
"\"",
"\"",
"+",
"sig",
")",
"\n",
"}",
"\n",
"return",
"labels",
"\n",
"}"
] |
8,713 | all-8714 | [
"Patch",
"is",
"a",
"shortcut",
"for",
"r",
".",
"Handle",
"(",
"PATCH",
"pattern",
"handlers",
")"
] | [
"func",
"(",
"r",
"*",
"Router",
")",
"Patch",
"(",
"pattern",
"string",
",",
"h",
"...",
"Handler",
")",
"*",
"Route",
"{",
"return",
"r",
".",
"Handle",
"(",
"\"",
"\"",
",",
"<mask>",
",",
"h",
")",
"\n",
"}"
] |
8,714 | all-8715 | [
"Connect",
"..."
] | [
"func",
"(",
"c",
"*",
"Cluster",
")",
"Connect",
"(",
"ctx",
"context",
".",
"Context",
",",
"opts",
"...",
"grpc",
".",
"DialOption",
")",
"error",
"{",
"for",
"i",
",",
"n",
":=",
"range",
"c",
".",
"nodes",
"{",
"if",
"n",
".",
"Addr",
"==",
"c",
".",
"listen",
"{",
"continue",
"\n",
"}",
"\n\n",
"if",
"c",
".",
"logger",
"!=",
"nil",
"{",
"c",
".",
"logger",
".",
"Debug",
"(",
"\"",
"\"",
",",
"zap",
".",
"String",
"(",
"\"",
"\"",
",",
"n",
".",
"Addr",
")",
",",
"zap",
".",
"Int",
"(",
"\"",
"\"",
",",
"i",
")",
")",
"\n",
"}",
"\n\n",
"<mask>",
",",
"err",
":=",
"grpc",
".",
"DialContext",
"(",
"ctx",
",",
"n",
".",
"Addr",
",",
"opts",
"...",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"if",
"c",
".",
"logger",
"!=",
"nil",
"{",
"c",
".",
"logger",
".",
"Debug",
"(",
"\"",
"\"",
",",
"zap",
".",
"String",
"(",
"\"",
"\"",
",",
"n",
".",
"Addr",
")",
",",
"zap",
".",
"Int",
"(",
"\"",
"\"",
",",
"i",
")",
")",
"\n",
"}",
"\n\n",
"n",
".",
"Client",
"=",
"mnemosynerpc",
".",
"NewSessionManagerClient",
"(",
"conn",
")",
"\n",
"n",
".",
"Health",
"=",
"grpc_health_v1",
".",
"NewHealthClient",
"(",
"conn",
")",
"\n",
"}",
"\n\n",
"return",
"nil",
"\n",
"}"
] |
8,715 | all-8716 | [
"Start",
"runs",
"the",
"goroutine",
"responsible",
"for",
"checking",
"idle",
"connections",
"."
] | [
"func",
"(",
"is",
"*",
"idleSweep",
")",
"start",
"(",
")",
"{",
"if",
"is",
".",
"started",
"||",
"is",
".",
"idleCheckInterval",
"<=",
"0",
"{",
"return",
"\n",
"}",
"\n\n",
"is",
".",
"ch",
".",
"log",
".",
"WithFields",
"(",
"LogField",
"{",
"\"",
"\"",
",",
"is",
".",
"idleCheckInterval",
"}",
",",
"LogField",
"{",
"\"",
"\"",
",",
"is",
".",
"maxIdleTime",
"}",
",",
")",
".",
"Info",
"(",
"\"",
"\"",
")",
"\n\n",
"is",
".",
"started",
"=",
"true",
"\n",
"is",
".",
"stopCh",
"=",
"<mask>",
"(",
"chan",
"struct",
"{",
"}",
")",
"\n",
"go",
"is",
".",
"pollerLoop",
"(",
")",
"\n",
"}"
] |
8,716 | all-8717 | [
"HasSourceType",
"returns",
"a",
"boolean",
"if",
"a",
"field",
"has",
"been",
"set",
"."
] | [
"func",
"(",
"e",
"*",
"<mask>",
")",
"HasSourceType",
"(",
")",
"bool",
"{",
"if",
"e",
"!=",
"nil",
"&&",
"e",
".",
"SourceType",
"!=",
"nil",
"{",
"return",
"true",
"\n",
"}",
"\n\n",
"return",
"false",
"\n",
"}"
] |
8,717 | all-8718 | [
"Add",
"adds",
"the",
"given",
"dependency",
"to",
"the",
"list",
"of",
"monitored",
"dependencies",
"and",
"start",
"the",
"associated",
"view",
".",
"If",
"the",
"dependency",
"already",
"exists",
"no",
"action",
"is",
"taken",
".",
"If",
"the",
"Dependency",
"already",
"existed",
"it",
"this",
"function",
"will",
"return",
"false",
".",
"If",
"the",
"view",
"was",
"successfully",
"created",
"it",
"will",
"return",
"true",
".",
"If",
"an",
"error",
"occurs",
"while",
"creating",
"the",
"view",
"it",
"will",
"be",
"returned",
"here",
"(",
"but",
"future",
"errors",
"returned",
"by",
"the",
"view",
"will",
"happen",
"on",
"the",
"channel",
")",
"."
] | [
"func",
"(",
"w",
"*",
"Watcher",
")",
"Add",
"(",
"d",
"dep",
".",
"Dependency",
")",
"(",
"bool",
",",
"error",
")",
"{",
"w",
".",
"Lock",
"(",
")",
"\n",
"defer",
"w",
".",
"Unlock",
"(",
")",
"\n\n",
"log",
".",
"Printf",
"(",
"\"",
"\"",
",",
"d",
")",
"\n\n",
"if",
"_",
",",
"ok",
":=",
"w",
".",
"depViewMap",
"[",
"d",
".",
"String",
"(",
")",
"]",
";",
"ok",
"{",
"<mask>",
".",
"Printf",
"(",
"\"",
"\"",
",",
"d",
")",
"\n",
"return",
"false",
",",
"nil",
"\n",
"}",
"\n\n",
"// Choose the correct retry function based off of the dependency's type.",
"var",
"retryFunc",
"RetryFunc",
"\n",
"switch",
"d",
".",
"Type",
"(",
")",
"{",
"case",
"dep",
".",
"TypeConsul",
":",
"retryFunc",
"=",
"w",
".",
"retryFuncConsul",
"\n",
"case",
"dep",
".",
"TypeVault",
":",
"retryFunc",
"=",
"w",
".",
"retryFuncVault",
"\n",
"default",
":",
"retryFunc",
"=",
"w",
".",
"retryFuncDefault",
"\n",
"}",
"\n\n",
"v",
",",
"err",
":=",
"NewView",
"(",
"&",
"NewViewInput",
"{",
"Dependency",
":",
"d",
",",
"Clients",
":",
"w",
".",
"clients",
",",
"MaxStale",
":",
"w",
".",
"maxStale",
",",
"Once",
":",
"w",
".",
"once",
",",
"RetryFunc",
":",
"retryFunc",
",",
"VaultGrace",
":",
"w",
".",
"vaultGrace",
",",
"}",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"false",
",",
"errors",
".",
"Wrap",
"(",
"err",
",",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"log",
".",
"Printf",
"(",
"\"",
"\"",
",",
"d",
")",
"\n\n",
"w",
".",
"depViewMap",
"[",
"d",
".",
"String",
"(",
")",
"]",
"=",
"v",
"\n",
"go",
"v",
".",
"poll",
"(",
"w",
".",
"dataCh",
",",
"w",
".",
"errCh",
")",
"\n\n",
"return",
"true",
",",
"nil",
"\n",
"}"
] |
8,718 | all-8719 | [
"Returns",
"a",
"new",
"object",
"implementing",
"the",
"bcd",
".",
"Tracer",
"and",
"bcd",
".",
"TracerSig",
"interfaces",
"using",
"the",
"Backtrace",
"debugging",
"platform",
".",
"Currently",
"only",
"Linux",
"and",
"FreeBSD",
"are",
"supported",
".",
"Relevant",
"default",
"values",
":",
"Tracer",
"path",
":",
"/",
"opt",
"/",
"backtrace",
"/",
"bin",
"/",
"ptrace",
".",
"Output",
"directory",
":",
"Current",
"working",
"directory",
"of",
"process",
".",
"Signal",
"set",
":",
"ABRT",
"FPE",
"SEGV",
"ILL",
"BUS",
".",
"Note",
":",
"Go",
"converts",
"BUS",
"FPE",
"and",
"SEGV",
"arising",
"from",
"process",
"execution",
"into",
"run",
"-",
"time",
"panics",
"which",
"cannot",
"be",
"handled",
"by",
"signal",
"handlers",
".",
"These",
"signals",
"are",
"caught",
"when",
"sent",
"from",
"os",
".",
"Process",
".",
"Kill",
"or",
"similar",
".",
"The",
"default",
"logger",
"prints",
"to",
"stderr",
".",
"DefaultTraceOptions",
":",
"Faulted",
":",
"true",
"CallerOnly",
":",
"false",
"ErrClassification",
":",
"true",
"Timeout",
":",
"120s"
] | [
"func",
"New",
"(",
"options",
"NewOptions",
")",
"*",
"BTTracer",
"{",
"moduleOpt",
":=",
"\"",
"\"",
"\n",
"if",
"!",
"options",
".",
"IncludeSystemGs",
"{",
"moduleOpt",
"+=",
"\"",
"\"",
"\n",
"}",
"\n\n",
"return",
"&",
"BTTracer",
"{",
"cmd",
":",
"\"",
"\"",
",",
"kvp",
":",
"\"",
"\"",
",",
"kvd",
":",
"\"",
"\"",
",",
"options",
":",
"[",
"]",
"string",
"{",
"\"",
"\"",
",",
"moduleOpt",
",",
"\"",
"\"",
",",
"strconv",
".",
"Itoa",
"(",
"os",
".",
"Getpid",
"(",
")",
")",
"}",
",",
"ss",
":",
"[",
"]",
"os",
".",
"Signal",
"{",
"syscall",
".",
"SIGABRT",
",",
"syscall",
".",
"SIGFPE",
",",
"syscall",
".",
"SIGSEGV",
",",
"syscall",
".",
"SIGILL",
",",
"syscall",
".",
"SIGBUS",
"}",
",",
"logger",
":",
"&",
"defaultLogger",
"{",
"logger",
":",
"log",
".",
"New",
"(",
"os",
".",
"Stderr",
",",
"\"",
"\"",
",",
"log",
".",
"LstdFlags",
")",
",",
"level",
":",
"LogError",
"}",
",",
"defaultTraceOptions",
":",
"TraceOptions",
"{",
"Faulted",
":",
"true",
",",
"CallerOnly",
":",
"false",
",",
"ErrClassification",
":",
"true",
",",
"Timeout",
":",
"<mask>",
".",
"Second",
"*",
"120",
"}",
"}",
"\n",
"}"
] |
8,719 | all-8720 | [
"Click",
"clicks",
"on",
"all",
"of",
"the",
"elements",
"that",
"the",
"selection",
"refers",
"to",
"."
] | [
"func",
"(",
"s",
"*",
"Selection",
")",
"Click",
"(",
")",
"error",
"{",
"return",
"s",
".",
"forEachElement",
"(",
"func",
"(",
"selectedElement",
"<mask>",
".",
"Element",
")",
"error",
"{",
"if",
"err",
":=",
"selectedElement",
".",
"Click",
"(",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"s",
",",
"err",
")",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}",
")",
"\n",
"}"
] |
8,720 | all-8721 | [
"EntryNew",
"()",
"is",
"a",
"wrapper",
"around",
"gtk_entry_new",
"()",
"."
] | [
"func",
"EntryNew",
"(",
")",
"(",
"*",
"<mask>",
",",
"error",
")",
"{",
"c",
":=",
"C",
".",
"gtk_entry_new",
"(",
")",
"\n",
"if",
"c",
"==",
"nil",
"{",
"return",
"nil",
",",
"nilPtrErr",
"\n",
"}",
"\n",
"obj",
":=",
"glib",
".",
"Take",
"(",
"unsafe",
".",
"Pointer",
"(",
"c",
")",
")",
"\n",
"return",
"wrapEntry",
"(",
"obj",
")",
",",
"nil",
"\n",
"}"
] |
8,721 | all-8722 | [
"Notify",
"takes",
"three",
"arguments",
":",
"err",
"-",
"standard",
"error",
";",
"sync",
"-",
"if",
"true",
"then",
"the",
"function",
"waits",
"for",
"the",
"end",
"of",
"sending",
";",
"skip",
"-",
"how",
"many",
"errors",
"to",
"remove",
"from",
"stacktrace",
"."
] | [
"func",
"(",
"c",
"*",
"<mask>",
")",
"Notify",
"(",
"err",
"error",
",",
"sync",
"bool",
",",
"skip",
"int",
")",
"{",
"if",
"c",
".",
"enable",
"{",
"c",
".",
"notify",
"(",
"err",
",",
"sync",
",",
"skip",
")",
"\n",
"}",
"\n",
"}"
] |
8,722 | all-8723 | [
"Parse",
"initializes",
"URI",
"from",
"the",
"given",
"host",
"and",
"uri",
".",
"host",
"may",
"be",
"nil",
".",
"In",
"this",
"case",
"uri",
"must",
"contain",
"fully",
"qualified",
"uri",
"i",
".",
"e",
".",
"with",
"scheme",
"and",
"host",
".",
"http",
"is",
"assumed",
"if",
"scheme",
"is",
"omitted",
".",
"uri",
"may",
"contain",
"e",
".",
"g",
".",
"RequestURI",
"without",
"scheme",
"and",
"host",
"if",
"host",
"is",
"non",
"-",
"empty",
"."
] | [
"func",
"(",
"u",
"*",
"URI",
")",
"Parse",
"(",
"<mask>",
",",
"uri",
"[",
"]",
"byte",
")",
"{",
"u",
".",
"parse",
"(",
"host",
",",
"uri",
",",
"nil",
")",
"\n",
"}"
] |
8,723 | all-8724 | [
"Record",
"appends",
"an",
"entry",
"to",
"the",
"recordlog",
"specified",
"by",
"the",
"poolKey",
"."
] | [
"func",
"(",
"h",
"*",
"History",
")",
"Record",
"(",
"poolKey",
",",
"action",
",",
"baseSHA",
",",
"err",
"string",
",",
"targets",
"[",
"]",
"prowapi",
".",
"Pull",
")",
"{",
"t",
":=",
"<mask>",
"(",
")",
"\n",
"sort",
".",
"Sort",
"(",
"ByNum",
"(",
"targets",
")",
")",
"\n",
"h",
".",
"addRecord",
"(",
"poolKey",
",",
"&",
"Record",
"{",
"Time",
":",
"t",
",",
"Action",
":",
"action",
",",
"BaseSHA",
":",
"baseSHA",
",",
"Target",
":",
"targets",
",",
"Err",
":",
"err",
",",
"}",
",",
")",
"\n",
"}"
] |
8,724 | all-8725 | [
"export",
"goBuilderConnect"
] | [
"func",
"goBuilderConnect",
"(",
"builder",
"*",
"C",
".",
"GtkBuilder",
",",
"object",
"*",
"C",
".",
"GObject",
",",
"signal_name",
"*",
"C",
".",
"gchar",
",",
"handler_name",
"*",
"C",
".",
"gchar",
",",
"connect_object",
"*",
"C",
".",
"GObject",
",",
"flags",
"C",
".",
"GConnectFlags",
",",
"user_data",
"C",
".",
"gpointer",
")",
"{",
"builderSignals",
".",
"Lock",
"(",
")",
"\n",
"signals",
",",
"ok",
":=",
"builderSignals",
".",
"m",
"[",
"builder",
"]",
"\n",
"builderSignals",
".",
"Unlock",
"(",
")",
"\n\n",
"if",
"!",
"ok",
"{",
"panic",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"h",
":=",
"C",
".",
"GoString",
"(",
"(",
"*",
"C",
".",
"char",
")",
"(",
"handler_name",
")",
")",
"\n",
"s",
":=",
"C",
".",
"GoString",
"(",
"(",
"*",
"C",
".",
"char",
")",
"(",
"signal_name",
")",
")",
"\n\n",
"handler",
",",
"ok",
":=",
"signals",
"[",
"h",
"]",
"\n",
"if",
"!",
"ok",
"{",
"return",
"\n",
"}",
"\n\n",
"if",
"<mask>",
"==",
"nil",
"{",
"panic",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"//TODO: figure out a better way to get a glib.Object from a *C.GObject",
"gobj",
":=",
"glib",
".",
"Object",
"{",
"glib",
".",
"ToGObject",
"(",
"unsafe",
".",
"Pointer",
"(",
"object",
")",
")",
"}",
"\n",
"gobj",
".",
"Connect",
"(",
"s",
",",
"handler",
")",
"\n",
"}"
] |
8,725 | all-8726 | [
"ServeUDP",
"serves",
"requests",
"over",
"UDP",
"connection",
"."
] | [
"func",
"(",
"s",
"*",
"Server",
")",
"ServeUDP",
"(",
"<mask>",
"*",
"net",
".",
"UDPConn",
")",
"(",
"err",
"error",
")",
"{",
"s",
".",
"Server",
".",
"Server",
".",
"Addr",
"=",
"conn",
".",
"LocalAddr",
"(",
")",
".",
"String",
"(",
")",
"\n",
"return",
"s",
".",
"Server",
".",
"Serve",
"(",
"conn",
")",
"\n",
"}"
] |
8,726 | all-8727 | [
"resolveDirectory",
"returns",
"a",
"full",
"directory",
"path",
"based",
"on",
"the",
"supplied",
"dir",
"path",
"if",
"the",
"supplied",
"dir",
"path",
"is",
"absolute",
"(",
"i",
".",
"e",
".",
"it",
"starts",
"with",
"/",
")",
"then",
"it",
"is",
"returned",
"as",
"is",
"if",
"it",
"s",
"a",
"relative",
"path",
"then",
"it",
"is",
"assumed",
"to",
"be",
"relative",
"to",
"the",
"executable",
"and",
"that",
"is",
"computed",
"and",
"returned",
".",
"if",
"create",
"is",
"true",
"then",
"the",
"directory",
"path",
"will",
"be",
"created",
"if",
"it",
"doesn",
"t",
"already",
"exist",
"if",
"create",
"is",
"false",
"then",
"it",
"s",
"upto",
"the",
"caller",
"to",
"ensure",
"it",
"exists",
"and",
"/",
"or",
"create",
"it",
"as",
"needed",
"[",
"this",
"won",
"t",
"verify",
"that",
"it",
"exists",
"]"
] | [
"func",
"resolveDirectory",
"(",
"dir",
"string",
",",
"<mask>",
"bool",
")",
"(",
"string",
",",
"error",
")",
"{",
"var",
"resolved",
"string",
"\n",
"if",
"filepath",
".",
"IsAbs",
"(",
"dir",
")",
"{",
"resolved",
"=",
"dir",
"\n",
"}",
"else",
"{",
"execdir",
",",
"err",
":=",
"filepath",
".",
"Abs",
"(",
"filepath",
".",
"Dir",
"(",
"os",
".",
"Args",
"[",
"0",
"]",
")",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"\"",
"\"",
",",
"err",
"\n",
"}",
"\n",
"resolved",
"=",
"filepath",
".",
"Join",
"(",
"execdir",
",",
"dir",
")",
"\n",
"}",
"\n",
"if",
"create",
"{",
"if",
"_",
",",
"err",
":=",
"os",
".",
"Stat",
"(",
"resolved",
")",
";",
"os",
".",
"IsNotExist",
"(",
"err",
")",
"{",
"if",
"err",
":=",
"os",
".",
"MkdirAll",
"(",
"resolved",
",",
"0744",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"\"",
"\"",
",",
"err",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"resolved",
",",
"nil",
"\n",
"}"
] |
8,727 | all-8728 | [
"uriForAPI",
"is",
"to",
"be",
"called",
"with",
"something",
"like",
"/",
"v1",
"/",
"events",
"and",
"it",
"will",
"give",
"the",
"proper",
"request",
"URI",
"to",
"be",
"posted",
"to",
"."
] | [
"func",
"(",
"client",
"*",
"Client",
")",
"uriForAPI",
"(",
"api",
"string",
")",
"(",
"string",
",",
"error",
")",
"{",
"apiBase",
",",
"err",
":=",
"url",
".",
"Parse",
"(",
"client",
".",
"baseUrl",
"+",
"\"",
"\"",
"+",
"api",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"\"",
"\"",
",",
"err",
"\n",
"}",
"\n",
"q",
":=",
"apiBase",
".",
"Query",
"(",
")",
"\n",
"q",
".",
"Add",
"(",
"\"",
"\"",
",",
"<mask>",
".",
"apiKey",
")",
"\n",
"q",
".",
"Add",
"(",
"\"",
"\"",
",",
"client",
".",
"appKey",
")",
"\n",
"apiBase",
".",
"RawQuery",
"=",
"q",
".",
"Encode",
"(",
")",
"\n",
"return",
"apiBase",
".",
"String",
"(",
")",
",",
"nil",
"\n",
"}"
] |
8,728 | all-8729 | [
"WriteToRequest",
"writes",
"these",
"params",
"to",
"a",
"swagger",
"request"
] | [
"func",
"(",
"o",
"*",
"GetVMByCidParams",
")",
"WriteToRequest",
"(",
"r",
"runtime",
".",
"ClientRequest",
",",
"reg",
"strfmt",
".",
"Registry",
")",
"error",
"{",
"if",
"err",
":=",
"r",
".",
"SetTimeout",
"(",
"o",
".",
"timeout",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"var",
"<mask>",
"[",
"]",
"error",
"\n\n",
"// path param cid",
"if",
"err",
":=",
"r",
".",
"SetPathParam",
"(",
"\"",
"\"",
",",
"swag",
".",
"FormatInt32",
"(",
"o",
".",
"Cid",
")",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"if",
"len",
"(",
"res",
")",
">",
"0",
"{",
"return",
"errors",
".",
"CompositeValidationError",
"(",
"res",
"...",
")",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
] |
8,729 | all-8730 | [
"WriteTo",
"writes",
"data",
"to",
"w",
"."
] | [
"func",
"(",
"e",
"*",
"helperMethodYield",
")",
"WriteTo",
"(",
"w",
"io",
".",
"Writer",
")",
"(",
"int64",
",",
"error",
")",
"{",
"var",
"bf",
"bytes",
".",
"<mask>",
"\n\n",
"inner",
":=",
"e",
".",
"src",
".",
"inner",
"\n",
"if",
"inner",
"==",
"nil",
"{",
"return",
"0",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"e",
".",
"ln",
".",
"fileName",
"(",
")",
",",
"e",
".",
"ln",
".",
"no",
")",
"\n",
"}",
"\n\n",
"var",
"templateExists",
"bool",
"\n\n",
"for",
"_",
",",
"innerE",
":=",
"range",
"e",
".",
"rslt",
".",
"inner",
"{",
"ln",
":=",
"innerE",
".",
"Base",
"(",
")",
".",
"ln",
"\n",
"if",
"ln",
".",
"isHelperMethodOf",
"(",
"helperMethodNameContent",
")",
"&&",
"len",
"(",
"ln",
".",
"tokens",
")",
">",
"2",
"&&",
"ln",
".",
"tokens",
"[",
"2",
"]",
"==",
"e",
".",
"templateName",
"{",
"templateExists",
"=",
"true",
"\n",
"break",
"\n",
"}",
"\n",
"}",
"\n\n",
"if",
"templateExists",
"{",
"bf",
".",
"WriteString",
"(",
"fmt",
".",
"Sprintf",
"(",
"actionTemplateWithPipeline",
",",
"e",
".",
"opts",
".",
"DelimLeft",
",",
"inner",
".",
"path",
"+",
"doubleColon",
"+",
"e",
".",
"templateName",
",",
"dot",
",",
"e",
".",
"opts",
".",
"DelimRight",
")",
")",
"\n",
"}",
"else",
"{",
"// Write the children's HTML.",
"if",
"i",
",",
"err",
":=",
"e",
".",
"writeChildren",
"(",
"&",
"bf",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"i",
",",
"err",
"\n",
"}",
"\n",
"}",
"\n\n",
"i",
",",
"err",
":=",
"w",
".",
"Write",
"(",
"bf",
".",
"Bytes",
"(",
")",
")",
"\n\n",
"return",
"int64",
"(",
"i",
")",
",",
"err",
"\n",
"}"
] |
8,730 | all-8731 | [
"Create",
"creates",
"a",
"ResourcePool",
"."
] | [
"func",
"Create",
"(",
"rp",
"*",
"object",
".",
"ResourcePool",
",",
"<mask>",
"string",
",",
"spec",
"*",
"types",
".",
"ResourceConfigSpec",
")",
"(",
"*",
"object",
".",
"ResourcePool",
",",
"error",
")",
"{",
"log",
".",
"Printf",
"(",
"\"",
"\"",
",",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"rp",
".",
"InventoryPath",
",",
"name",
")",
")",
"\n",
"ctx",
",",
"cancel",
":=",
"context",
".",
"WithTimeout",
"(",
"context",
".",
"Background",
"(",
")",
",",
"provider",
".",
"DefaultAPITimeout",
")",
"\n",
"defer",
"cancel",
"(",
")",
"\n",
"nrp",
",",
"err",
":=",
"rp",
".",
"Create",
"(",
"ctx",
",",
"name",
",",
"*",
"spec",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"return",
"nrp",
",",
"nil",
"\n",
"}"
] |
8,731 | all-8732 | [
"ConvertColors",
"takes",
"a",
"list",
"of",
"ints",
"representing",
"colors",
"for",
"log",
"levels",
"and",
"converts",
"them",
"into",
"strings",
"for",
"ANSI",
"color",
"formatting"
] | [
"func",
"ConvertColors",
"(",
"colors",
"[",
"]",
"int",
",",
"bold",
"bool",
")",
"[",
"]",
"string",
"{",
"converted",
":=",
"[",
"]",
"string",
"{",
"}",
"\n",
"for",
"_",
",",
"i",
":=",
"range",
"colors",
"{",
"if",
"bold",
"{",
"converted",
"=",
"append",
"(",
"converted",
",",
"ColorSeqBold",
"(",
"<mask>",
"(",
"i",
")",
")",
")",
"\n",
"}",
"else",
"{",
"converted",
"=",
"append",
"(",
"converted",
",",
"ColorSeq",
"(",
"color",
"(",
"i",
")",
")",
")",
"\n",
"}",
"\n",
"}",
"\n\n",
"return",
"converted",
"\n",
"}"
] |
8,732 | all-8733 | [
"RegionMake2D",
"returns",
"a",
"2D",
"rectangular",
"region",
"for",
"image",
"or",
"texture",
"data",
".",
"Reference",
":",
"https",
":",
"//",
"developer",
".",
"apple",
".",
"com",
"/",
"documentation",
"/",
"metal",
"/",
"1515675",
"-",
"mtlregionmake2d",
"."
] | [
"func",
"RegionMake2D",
"(",
"x",
",",
"y",
",",
"width",
",",
"<mask>",
"int",
")",
"Region",
"{",
"return",
"Region",
"{",
"Origin",
":",
"Origin",
"{",
"x",
",",
"y",
",",
"0",
"}",
",",
"Size",
":",
"Size",
"{",
"width",
",",
"height",
",",
"1",
"}",
",",
"}",
"\n",
"}"
] |
8,733 | all-8734 | [
"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",
"(",
"c",
"*",
"ChangeRequest",
")",
"GetChangeTypeOk",
"(",
")",
"(",
"string",
",",
"bool",
")",
"{",
"if",
"c",
"==",
"nil",
"||",
"c",
".",
"ChangeType",
"==",
"nil",
"{",
"return",
"\"",
"\"",
",",
"false",
"\n",
"}",
"\n",
"return",
"*",
"c",
".",
"ChangeType",
",",
"<mask>",
"\n",
"}"
] |
8,734 | all-8735 | [
"MustSetOptionsResult",
"retrieves",
"the",
"SetOptionsResult",
"value",
"from",
"the",
"union",
"panicing",
"if",
"the",
"value",
"is",
"not",
"set",
"."
] | [
"func",
"(",
"u",
"OperationResultTr",
")",
"MustSetOptionsResult",
"(",
")",
"SetOptionsResult",
"{",
"val",
",",
"ok",
":=",
"u",
".",
"GetSetOptionsResult",
"(",
")",
"\n\n",
"if",
"!",
"<mask>",
"{",
"panic",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"return",
"val",
"\n",
"}"
] |
8,735 | all-8736 | [
"restSessionFile",
"is",
"takes",
"the",
"session",
"file",
"name",
"generated",
"by",
"sessionFile",
"and",
"then",
"prefixes",
"the",
"REST",
"client",
"session",
"path",
"to",
"it",
"."
] | [
"func",
"(",
"c",
"*",
"Config",
")",
"restSessionFile",
"(",
")",
"(",
"string",
",",
"error",
")",
"{",
"p",
",",
"err",
":=",
"c",
".",
"sessionFile",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"\"",
"\"",
",",
"<mask>",
"\n",
"}",
"\n",
"return",
"filepath",
".",
"Join",
"(",
"c",
".",
"RestSessionPath",
",",
"p",
")",
",",
"nil",
"\n",
"}"
] |
8,736 | all-8737 | [
"GRPCServer",
"converts",
"a",
"metcd",
".",
"Server",
"to",
"a",
"*",
"grpc",
".",
"Server",
"."
] | [
"func",
"GRPCServer",
"(",
"s",
"Server",
",",
"options",
"...",
"grpc",
".",
"ServerOption",
")",
"*",
"grpc",
".",
"Server",
"{",
"srv",
":=",
"grpc",
".",
"NewServer",
"(",
"<mask>",
"...",
")",
"\n",
"//etcdserverpb.RegisterAuthServer(srv, s)",
"//etcdserverpb.RegisterClusterServer(srv, s)",
"etcdserverpb",
".",
"RegisterKVServer",
"(",
"srv",
",",
"s",
")",
"\n",
"//etcdserverpb.RegisterLeaseServer(srv, s)",
"//etcdserverpb.RegisterMaintenanceServer(srv, s)",
"//etcdserverpb.RegisterWatchServer(srv, s)",
"return",
"srv",
"\n",
"}"
] |
8,737 | all-8738 | [
"BeginCall",
"starts",
"a",
"new",
"call",
"to",
"a",
"remote",
"peer",
"returning",
"an",
"OutboundCall",
"that",
"can",
"be",
"used",
"to",
"write",
"the",
"arguments",
"of",
"the",
"call",
"."
] | [
"func",
"(",
"c",
"*",
"SubChannel",
")",
"BeginCall",
"(",
"ctx",
"context",
".",
"<mask>",
",",
"methodName",
"string",
",",
"callOptions",
"*",
"CallOptions",
")",
"(",
"*",
"OutboundCall",
",",
"error",
")",
"{",
"if",
"callOptions",
"==",
"nil",
"{",
"callOptions",
"=",
"defaultCallOptions",
"\n",
"}",
"\n\n",
"peer",
",",
"err",
":=",
"c",
".",
"peers",
".",
"Get",
"(",
"callOptions",
".",
"RequestState",
".",
"PrevSelectedPeers",
"(",
")",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"return",
"peer",
".",
"BeginCall",
"(",
"ctx",
",",
"c",
".",
"ServiceName",
"(",
")",
",",
"methodName",
",",
"callOptions",
")",
"\n",
"}"
] |
8,738 | all-8739 | [
"Write",
"writes",
"the",
"provided",
"data",
"to",
"the",
"file",
"and",
"returns",
"the",
"number",
"of",
"bytes",
"written",
"and",
"an",
"error",
"in",
"case",
"something",
"wrong",
"happened",
".",
"The",
"file",
"will",
"internally",
"cache",
"the",
"data",
"so",
"that",
"all",
"but",
"the",
"last",
"chunk",
"sent",
"to",
"the",
"database",
"have",
"the",
"size",
"defined",
"by",
"SetChunkSize",
".",
"This",
"also",
"means",
"that",
"errors",
"may",
"be",
"deferred",
"until",
"a",
"future",
"call",
"to",
"Write",
"or",
"Close",
".",
"The",
"parameters",
"and",
"behavior",
"of",
"this",
"function",
"turn",
"the",
"file",
"into",
"an",
"io",
".",
"Writer",
"."
] | [
"func",
"(",
"file",
"*",
"GridFile",
")",
"Write",
"(",
"data",
"[",
"]",
"byte",
")",
"(",
"n",
"int",
",",
"err",
"error",
")",
"{",
"file",
".",
"assertMode",
"(",
"gfsWriting",
")",
"\n",
"file",
".",
"m",
".",
"Lock",
"(",
")",
"\n",
"debugf",
"(",
"\"",
"\"",
",",
"file",
",",
"len",
"(",
"data",
")",
")",
"\n",
"defer",
"file",
".",
"m",
".",
"Unlock",
"(",
")",
"\n\n",
"if",
"file",
".",
"err",
"!=",
"nil",
"{",
"return",
"0",
",",
"file",
".",
"err",
"\n",
"}",
"\n\n",
"n",
"=",
"len",
"(",
"data",
")",
"\n",
"file",
".",
"doc",
".",
"Length",
"+=",
"int64",
"(",
"n",
")",
"\n",
"chunkSize",
":=",
"file",
".",
"<mask>",
".",
"ChunkSize",
"\n\n",
"if",
"len",
"(",
"file",
".",
"wbuf",
")",
"+",
"len",
"(",
"data",
")",
"<",
"chunkSize",
"{",
"file",
".",
"wbuf",
"=",
"append",
"(",
"file",
".",
"wbuf",
",",
"data",
"...",
")",
"\n",
"return",
"\n",
"}",
"\n\n",
"// First, flush file.wbuf complementing with data.",
"if",
"len",
"(",
"file",
".",
"wbuf",
")",
">",
"0",
"{",
"missing",
":=",
"chunkSize",
"-",
"len",
"(",
"file",
".",
"wbuf",
")",
"\n",
"if",
"missing",
">",
"len",
"(",
"data",
")",
"{",
"missing",
"=",
"len",
"(",
"data",
")",
"\n",
"}",
"\n",
"file",
".",
"wbuf",
"=",
"append",
"(",
"file",
".",
"wbuf",
",",
"data",
"[",
":",
"missing",
"]",
"...",
")",
"\n",
"data",
"=",
"data",
"[",
"missing",
":",
"]",
"\n",
"file",
".",
"insertChunk",
"(",
"file",
".",
"wbuf",
")",
"\n",
"file",
".",
"wbuf",
"=",
"file",
".",
"wbuf",
"[",
"0",
":",
"0",
"]",
"\n",
"}",
"\n\n",
"// Then, flush all chunks from data without copying.",
"for",
"len",
"(",
"data",
")",
">",
"chunkSize",
"{",
"size",
":=",
"chunkSize",
"\n",
"if",
"size",
">",
"len",
"(",
"data",
")",
"{",
"size",
"=",
"len",
"(",
"data",
")",
"\n",
"}",
"\n",
"file",
".",
"insertChunk",
"(",
"data",
"[",
":",
"size",
"]",
")",
"\n",
"data",
"=",
"data",
"[",
"size",
":",
"]",
"\n",
"}",
"\n\n",
"// And append the rest for a future call.",
"file",
".",
"wbuf",
"=",
"append",
"(",
"file",
".",
"wbuf",
",",
"data",
"...",
")",
"\n\n",
"return",
"n",
",",
"file",
".",
"err",
"\n",
"}"
] |
8,739 | all-8740 | [
"SelfProxyCmderSupplier",
"returns",
"a",
"supplier",
"that",
"given",
"a",
"command",
"re",
"-",
"invokes",
"the",
"current",
"executable",
"with",
"a",
"proxy",
"version",
"of",
"the",
"provided",
"command",
"."
] | [
"func",
"SelfProxyCmderSupplier",
"(",
")",
"CmderSupplier",
"{",
"return",
"func",
"(",
"cmd",
"Cmd",
")",
"(",
"Cmder",
",",
"error",
")",
"{",
"selfCmder",
",",
"err",
":=",
"selfCmder",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"return",
"CmderWithPrependedArgs",
"(",
"selfCmder",
",",
"proxyCmd",
"(",
"cmd",
")",
".",
"<mask>",
"(",
")",
")",
",",
"nil",
"\n",
"}",
"\n",
"}"
] |
8,740 | all-8741 | [
"Wrap",
"for",
"wrapping",
"a",
"handler",
"to",
"After",
"middleware",
"Be",
"aware",
"that",
"it",
"will",
"not",
"be",
"able",
"to",
"stop",
"execution",
"propagation",
"That",
"is",
"it",
"will",
"continue",
"to",
"execute",
"the",
"next",
"middleware",
"/",
"handler"
] | [
"func",
"Wrap",
"(",
"handler",
"HandlerFunc",
")",
"After",
"{",
"return",
"func",
"(",
"next",
"Handler",
")",
"Handler",
"{",
"return",
"HandlerFunc",
"(",
"func",
"(",
"w",
"<mask>",
".",
"ResponseWriter",
",",
"req",
"*",
"http",
".",
"Request",
",",
"params",
"Params",
")",
"{",
"handler",
"(",
"w",
",",
"req",
",",
"params",
")",
"\n",
"next",
".",
"ServeHTTP",
"(",
"w",
",",
"req",
",",
"params",
")",
"\n",
"}",
")",
"\n",
"}",
"\n",
"}"
] |
8,741 | all-8742 | [
"expireExchange",
"is",
"similar",
"to",
"removeExchange",
"but",
"it",
"marks",
"the",
"exchange",
"as",
"expired",
"."
] | [
"func",
"(",
"mexset",
"*",
"messageExchangeSet",
")",
"expireExchange",
"(",
"msgID",
"uint32",
")",
"{",
"mexset",
".",
"log",
".",
"Debugf",
"(",
"\"",
"\"",
",",
"mexset",
".",
"<mask>",
",",
"msgID",
",",
")",
"\n\n",
"mexset",
".",
"Lock",
"(",
")",
"\n",
"// TODO(aniketp): explore if cancel can be called everytime we expire an exchange",
"found",
",",
"expired",
":=",
"mexset",
".",
"deleteExchange",
"(",
"msgID",
")",
"\n",
"if",
"found",
"||",
"expired",
"{",
"// Record in expiredExchanges if we deleted the exchange.",
"mexset",
".",
"expiredExchanges",
"[",
"msgID",
"]",
"=",
"struct",
"{",
"}",
"{",
"}",
"\n",
"}",
"\n",
"mexset",
".",
"Unlock",
"(",
")",
"\n\n",
"if",
"expired",
"{",
"mexset",
".",
"log",
".",
"WithFields",
"(",
"LogField",
"{",
"\"",
"\"",
",",
"msgID",
"}",
")",
".",
"Info",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"mexset",
".",
"onRemoved",
"(",
")",
"\n",
"}"
] |
8,742 | all-8743 | [
"GetOrgConfigs",
"reads",
"all",
"orgs",
"from",
"the",
"cf",
"-",
"mgmt",
"configuration",
"."
] | [
"func",
"(",
"m",
"*",
"yamlManager",
")",
"GetOrgConfigs",
"(",
")",
"(",
"[",
"]",
"OrgConfig",
",",
"error",
")",
"{",
"files",
",",
"err",
":=",
"FindFiles",
"(",
"m",
".",
"ConfigDir",
",",
"\"",
"\"",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"result",
":=",
"make",
"(",
"[",
"]",
"OrgConfig",
",",
"len",
"(",
"files",
")",
")",
"\n",
"for",
"i",
",",
"f",
":=",
"range",
"files",
"{",
"result",
"[",
"i",
"]",
".",
"AppTaskLimit",
"=",
"unlimited",
"\n",
"<mask>",
"[",
"i",
"]",
".",
"AppInstanceLimit",
"=",
"unlimited",
"\n",
"result",
"[",
"i",
"]",
".",
"TotalReservedRoutePorts",
"=",
"\"",
"\"",
"\n",
"result",
"[",
"i",
"]",
".",
"TotalPrivateDomains",
"=",
"unlimited",
"\n",
"result",
"[",
"i",
"]",
".",
"TotalServiceKeys",
"=",
"unlimited",
"\n",
"result",
"[",
"i",
"]",
".",
"InstanceMemoryLimit",
"=",
"unlimited",
"\n\n",
"if",
"err",
"=",
"LoadFile",
"(",
"f",
",",
"&",
"result",
"[",
"i",
"]",
")",
";",
"err",
"!=",
"nil",
"{",
"lo",
".",
"G",
".",
"Error",
"(",
"err",
")",
"\n",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"result",
",",
"nil",
"\n",
"}"
] |
8,743 | all-8744 | [
"NewFIFOScheduler",
"returns",
"a",
"Scheduler",
"that",
"schedules",
"jobs",
"in",
"FIFO",
"order",
"sequentially"
] | [
"func",
"NewFIFOScheduler",
"(",
")",
"Scheduler",
"{",
"f",
":=",
"&",
"fifo",
"{",
"resume",
":",
"make",
"(",
"chan",
"struct",
"{",
"}",
",",
"1",
")",
",",
"donec",
":",
"make",
"(",
"chan",
"struct",
"{",
"}",
",",
"1",
")",
",",
"}",
"\n",
"f",
".",
"finishCond",
"=",
"sync",
".",
"NewCond",
"(",
"&",
"f",
".",
"mu",
")",
"\n",
"f",
".",
"ctx",
",",
"f",
".",
"cancel",
"=",
"context",
".",
"WithCancel",
"(",
"context",
".",
"Background",
"(",
")",
")",
"\n",
"<mask>",
"f",
".",
"run",
"(",
")",
"\n",
"return",
"f",
"\n",
"}"
] |
8,744 | all-8745 | [
"/",
"*",
"SetAttr",
"will",
"set",
"the",
"value",
"for",
"the",
"attribute",
"with",
"the",
"name",
"key",
".",
"If",
"the",
"key",
"already",
"exists",
"it",
"will",
"be",
"overwritten",
"with",
"the",
"new",
"value",
"."
] | [
"func",
"(",
"b",
"*",
"Base",
")",
"SetAttr",
"(",
"key",
"string",
",",
"<mask>",
"interface",
"{",
"}",
")",
"{",
"b",
".",
"BaseAttrs",
".",
"SetAttr",
"(",
"key",
",",
"value",
")",
"\n",
"}"
] |
8,745 | all-8746 | [
"SetValid",
"changes",
"this",
"Time",
"s",
"value",
"and",
"sets",
"it",
"to",
"be",
"non",
"-",
"null",
"."
] | [
"func",
"(",
"t",
"*",
"Time",
")",
"SetValid",
"(",
"v",
"time",
".",
"Time",
")",
"{",
"t",
".",
"Time",
"=",
"v",
"\n",
"t",
".",
"Valid",
"=",
"<mask>",
"\n",
"}"
] |
8,746 | all-8747 | [
"UnmarshalEasyJSON",
"satisfies",
"easyjson",
".",
"Unmarshaler",
"."
] | [
"func",
"(",
"t",
"*",
"SetDownloadBehaviorBehavior",
")",
"UnmarshalEasyJSON",
"(",
"in",
"*",
"jlexer",
".",
"Lexer",
")",
"{",
"switch",
"SetDownloadBehaviorBehavior",
"(",
"in",
".",
"String",
"(",
")",
")",
"{",
"case",
"SetDownloadBehaviorBehaviorDeny",
":",
"*",
"t",
"=",
"SetDownloadBehaviorBehaviorDeny",
"\n",
"case",
"SetDownloadBehaviorBehaviorAllow",
":",
"*",
"t",
"=",
"SetDownloadBehaviorBehaviorAllow",
"\n",
"case",
"SetDownloadBehaviorBehaviorDefault",
":",
"*",
"t",
"=",
"SetDownloadBehaviorBehaviorDefault",
"\n\n",
"<mask>",
":",
"in",
".",
"AddError",
"(",
"errors",
".",
"New",
"(",
"\"",
"\"",
")",
")",
"\n",
"}",
"\n",
"}"
] |
8,747 | all-8748 | [
"Malloc",
"implements",
"C",
"like",
"memory",
"allocator"
] | [
"func",
"Malloc",
"(",
"l",
"int",
")",
"unsafe",
".",
"Pointer",
"{",
"if",
"Debug",
"{",
"atomic",
".",
"AddUint64",
"(",
"&",
"stats",
".",
"allocs",
",",
"1",
")",
"\n",
"}",
"\n",
"<mask>",
"C",
".",
"mm_malloc",
"(",
"C",
".",
"size_t",
"(",
"l",
")",
")",
"\n",
"}"
] |
8,748 | all-8749 | [
"EndpointZoneID",
"determines",
"zoneID",
"for",
"endpoint",
"from",
"map",
"[",
"zoneID",
"]",
"zoneName",
"by",
"taking",
"longest",
"suffix",
"zoneName",
"match",
"in",
"endpoint",
"DNSName",
"returns",
"0",
"if",
"no",
"matches",
"are",
"found"
] | [
"func",
"(",
"f",
"*",
"zoneFilter",
")",
"EndpointZoneID",
"(",
"endpoint",
"*",
"endpoint",
".",
"Endpoint",
",",
"zones",
"<mask>",
"[",
"int64",
"]",
"string",
")",
"(",
"zoneID",
"int64",
",",
"name",
"string",
")",
"{",
"var",
"matchZoneID",
"int64",
"\n",
"var",
"matchZoneName",
"string",
"\n",
"for",
"zoneID",
",",
"zoneName",
":=",
"range",
"zones",
"{",
"if",
"strings",
".",
"HasSuffix",
"(",
"endpoint",
".",
"DNSName",
",",
"\"",
"\"",
"+",
"zoneName",
")",
"&&",
"len",
"(",
"zoneName",
")",
">",
"len",
"(",
"matchZoneName",
")",
"{",
"matchZoneName",
"=",
"zoneName",
"\n",
"matchZoneID",
"=",
"zoneID",
"\n",
"name",
"=",
"strings",
".",
"TrimSuffix",
"(",
"endpoint",
".",
"DNSName",
",",
"\"",
"\"",
"+",
"zoneName",
")",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"matchZoneID",
",",
"name",
"\n",
"}"
] |
8,749 | all-8750 | [
"bind",
"a",
"buffer",
"to",
"a",
"vertex",
"buffer",
"bind",
"point"
] | [
"func",
"VertexArrayVertexBuffer",
"(",
"vaobj",
"uint32",
",",
"bindingindex",
"uint32",
",",
"buffer",
"uint32",
",",
"offset",
"int",
",",
"stride",
"int32",
")",
"{",
"C",
".",
"glowVertexArrayVertexBuffer",
"(",
"gpVertexArrayVertexBuffer",
",",
"(",
"C",
".",
"GLuint",
")",
"(",
"vaobj",
")",
",",
"(",
"C",
".",
"GLuint",
")",
"(",
"bindingindex",
")",
",",
"(",
"C",
".",
"GLuint",
")",
"(",
"buffer",
")",
",",
"(",
"C",
".",
"GLintptr",
")",
"(",
"<mask>",
")",
",",
"(",
"C",
".",
"GLsizei",
")",
"(",
"stride",
")",
")",
"\n",
"}"
] |
8,750 | all-8751 | [
"Describe",
"generates",
"a",
"human",
"readable",
"description",
"of",
"the",
"behavior",
"that",
"this",
"configuration",
"specifies",
"."
] | [
"func",
"(",
"r",
"RequireMatchingLabel",
")",
"Describe",
"(",
")",
"string",
"{",
"str",
":=",
"&",
"strings",
".",
"Builder",
"{",
"}",
"\n",
"fmt",
".",
"Fprintf",
"(",
"str",
",",
"\"",
"\"",
",",
"r",
".",
"MissingLabel",
")",
"\n",
"if",
"r",
".",
"MissingComment",
"==",
"\"",
"\"",
"{",
"fmt",
".",
"Fprint",
"(",
"str",
",",
"\"",
"\"",
")",
"\n",
"}",
"else",
"{",
"fmt",
".",
"Fprint",
"(",
"str",
",",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"if",
"r",
".",
"Issues",
"{",
"fmt",
".",
"Fprint",
"(",
"str",
",",
"\"",
"\"",
")",
"\n",
"if",
"r",
".",
"PRs",
"{",
"fmt",
".",
"Fprint",
"(",
"str",
",",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"}",
"\n",
"if",
"r",
".",
"PRs",
"{",
"if",
"r",
".",
"Branch",
"!=",
"\"",
"\"",
"{",
"fmt",
".",
"Fprintf",
"(",
"str",
",",
"\"",
"\"",
",",
"r",
".",
"Branch",
")",
"\n",
"}",
"\n",
"fmt",
".",
"Fprint",
"(",
"str",
",",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"if",
"r",
".",
"Repo",
"==",
"\"",
"\"",
"{",
"fmt",
".",
"Fprintf",
"(",
"str",
",",
"\"",
"\"",
",",
"r",
".",
"Org",
")",
"\n",
"}",
"else",
"{",
"fmt",
".",
"Fprintf",
"(",
"str",
",",
"\"",
"\"",
",",
"r",
".",
"Org",
",",
"r",
".",
"Repo",
")",
"\n",
"}",
"\n",
"fmt",
".",
"Fprintf",
"(",
"str",
",",
"\"",
"\"",
",",
"r",
".",
"Regexp",
")",
"\n",
"return",
"str",
".",
"<mask>",
"(",
")",
"\n",
"}"
] |
8,751 | all-8752 | [
"arrayLen",
"returns",
"the",
"length",
"of",
"the",
"array",
"whose",
"composite",
"literal",
"elements",
"are",
"elts",
"."
] | [
"func",
"(",
"b",
"*",
"builder",
")",
"arrayLen",
"(",
"fn",
"*",
"Function",
",",
"elts",
"[",
"]",
"ast",
".",
"Expr",
")",
"int64",
"{",
"var",
"max",
"int64",
"=",
"-",
"1",
"\n",
"var",
"i",
"int64",
"=",
"-",
"1",
"\n",
"for",
"_",
",",
"e",
":=",
"range",
"elts",
"{",
"if",
"kv",
",",
"ok",
":=",
"e",
".",
"(",
"*",
"ast",
".",
"KeyValueExpr",
")",
";",
"ok",
"{",
"i",
"=",
"b",
".",
"expr",
"(",
"fn",
",",
"kv",
".",
"Key",
")",
".",
"(",
"*",
"Const",
")",
".",
"Int64",
"(",
")",
"\n",
"}",
"else",
"{",
"i",
"++",
"\n",
"}",
"\n",
"if",
"i",
">",
"max",
"{",
"<mask>",
"=",
"i",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"max",
"+",
"1",
"\n",
"}"
] |
8,752 | all-8753 | [
"Validate",
"inspects",
"the",
"fields",
"of",
"the",
"type",
"to",
"determine",
"if",
"they",
"are",
"valid",
"."
] | [
"func",
"(",
"s",
"*",
"ContainerDefinition",
")",
"Validate",
"(",
")",
"error",
"{",
"invalidParams",
":=",
"request",
".",
"ErrInvalidParams",
"{",
"Context",
":",
"\"",
"\"",
"}",
"\n",
"if",
"s",
".",
"DependsOn",
"!=",
"nil",
"{",
"for",
"i",
",",
"v",
":=",
"range",
"s",
".",
"DependsOn",
"{",
"if",
"v",
"==",
"nil",
"{",
"continue",
"\n",
"}",
"\n",
"if",
"err",
":=",
"v",
".",
"Validate",
"(",
")",
";",
"err",
"!=",
"nil",
"{",
"invalidParams",
".",
"AddNested",
"(",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"\"",
"\"",
",",
"i",
")",
",",
"err",
".",
"(",
"request",
".",
"ErrInvalidParams",
")",
")",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n",
"if",
"s",
".",
"ExtraHosts",
"!=",
"nil",
"{",
"for",
"i",
",",
"v",
":=",
"range",
"s",
".",
"ExtraHosts",
"{",
"if",
"v",
"==",
"nil",
"{",
"continue",
"\n",
"}",
"\n",
"if",
"err",
":=",
"v",
".",
"Validate",
"(",
")",
";",
"err",
"!=",
"nil",
"{",
"invalidParams",
".",
"AddNested",
"(",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"\"",
"\"",
",",
"i",
")",
",",
"err",
".",
"(",
"request",
".",
"ErrInvalidParams",
")",
")",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n",
"if",
"s",
".",
"HealthCheck",
"!=",
"nil",
"{",
"if",
"err",
":=",
"s",
".",
"HealthCheck",
".",
"Validate",
"(",
")",
";",
"err",
"!=",
"nil",
"{",
"invalidParams",
".",
"AddNested",
"(",
"\"",
"\"",
",",
"err",
".",
"(",
"request",
".",
"ErrInvalidParams",
")",
")",
"\n",
"}",
"\n",
"}",
"\n",
"if",
"s",
".",
"LinuxParameters",
"!=",
"nil",
"{",
"if",
"err",
":=",
"s",
".",
"LinuxParameters",
".",
"Validate",
"(",
")",
";",
"err",
"!=",
"nil",
"{",
"invalidParams",
".",
"AddNested",
"(",
"\"",
"\"",
",",
"err",
".",
"(",
"request",
".",
"ErrInvalidParams",
")",
")",
"\n",
"}",
"\n",
"}",
"\n",
"if",
"s",
".",
"LogConfiguration",
"!=",
"nil",
"{",
"if",
"err",
":=",
"s",
".",
"LogConfiguration",
".",
"Validate",
"(",
")",
";",
"err",
"!=",
"nil",
"{",
"invalidParams",
".",
"AddNested",
"(",
"\"",
"\"",
",",
"err",
".",
"(",
"<mask>",
".",
"ErrInvalidParams",
")",
")",
"\n",
"}",
"\n",
"}",
"\n",
"if",
"s",
".",
"RepositoryCredentials",
"!=",
"nil",
"{",
"if",
"err",
":=",
"s",
".",
"RepositoryCredentials",
".",
"Validate",
"(",
")",
";",
"err",
"!=",
"nil",
"{",
"invalidParams",
".",
"AddNested",
"(",
"\"",
"\"",
",",
"err",
".",
"(",
"request",
".",
"ErrInvalidParams",
")",
")",
"\n",
"}",
"\n",
"}",
"\n",
"if",
"s",
".",
"Secrets",
"!=",
"nil",
"{",
"for",
"i",
",",
"v",
":=",
"range",
"s",
".",
"Secrets",
"{",
"if",
"v",
"==",
"nil",
"{",
"continue",
"\n",
"}",
"\n",
"if",
"err",
":=",
"v",
".",
"Validate",
"(",
")",
";",
"err",
"!=",
"nil",
"{",
"invalidParams",
".",
"AddNested",
"(",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"\"",
"\"",
",",
"i",
")",
",",
"err",
".",
"(",
"request",
".",
"ErrInvalidParams",
")",
")",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n",
"if",
"s",
".",
"Ulimits",
"!=",
"nil",
"{",
"for",
"i",
",",
"v",
":=",
"range",
"s",
".",
"Ulimits",
"{",
"if",
"v",
"==",
"nil",
"{",
"continue",
"\n",
"}",
"\n",
"if",
"err",
":=",
"v",
".",
"Validate",
"(",
")",
";",
"err",
"!=",
"nil",
"{",
"invalidParams",
".",
"AddNested",
"(",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"\"",
"\"",
",",
"i",
")",
",",
"err",
".",
"(",
"request",
".",
"ErrInvalidParams",
")",
")",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n\n",
"if",
"invalidParams",
".",
"Len",
"(",
")",
">",
"0",
"{",
"return",
"invalidParams",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
] |
8,753 | all-8754 | [
"GetTitleSize",
"returns",
"the",
"TitleSize",
"field",
"if",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"."
] | [
"func",
"(",
"e",
"*",
"EventTimelineDefinition",
")",
"GetTitleSize",
"(",
")",
"<mask>",
"{",
"if",
"e",
"==",
"nil",
"||",
"e",
".",
"TitleSize",
"==",
"nil",
"{",
"return",
"\"",
"\"",
"\n",
"}",
"\n",
"return",
"*",
"e",
".",
"TitleSize",
"\n",
"}"
] |
8,754 | all-8755 | [
"ArmForSwitch",
"returns",
"which",
"field",
"name",
"should",
"be",
"used",
"for",
"storing",
"the",
"value",
"for",
"an",
"instance",
"of",
"PublicKey"
] | [
"func",
"(",
"u",
"NodeId",
")",
"ArmForSwitch",
"(",
"sw",
"int32",
")",
"(",
"<mask>",
",",
"bool",
")",
"{",
"return",
"PublicKey",
"(",
"u",
")",
".",
"ArmForSwitch",
"(",
"sw",
")",
"\n",
"}"
] |
8,755 | all-8756 | [
"BootstrapCluster",
"is",
"equivalent",
"to",
"non",
"-",
"member",
"BootstrapCluster",
"but",
"can",
"be",
"called",
"on",
"an",
"un",
"-",
"bootstrapped",
"Raft",
"instance",
"after",
"it",
"has",
"been",
"created",
".",
"This",
"should",
"only",
"be",
"called",
"at",
"the",
"beginning",
"of",
"time",
"for",
"the",
"cluster",
"and",
"you",
"absolutely",
"must",
"make",
"sure",
"that",
"you",
"call",
"it",
"with",
"the",
"same",
"configuration",
"on",
"all",
"the",
"Voter",
"servers",
".",
"There",
"is",
"no",
"need",
"to",
"bootstrap",
"Nonvoter",
"and",
"Staging",
"servers",
"."
] | [
"func",
"(",
"r",
"*",
"Raft",
")",
"BootstrapCluster",
"(",
"configuration",
"Configuration",
")",
"<mask>",
"{",
"bootstrapReq",
":=",
"&",
"bootstrapFuture",
"{",
"}",
"\n",
"bootstrapReq",
".",
"init",
"(",
")",
"\n",
"bootstrapReq",
".",
"configuration",
"=",
"configuration",
"\n",
"select",
"{",
"case",
"<-",
"r",
".",
"shutdownCh",
":",
"return",
"errorFuture",
"{",
"ErrRaftShutdown",
"}",
"\n",
"case",
"r",
".",
"bootstrapCh",
"<-",
"bootstrapReq",
":",
"return",
"bootstrapReq",
"\n",
"}",
"\n",
"}"
] |
8,756 | all-8757 | [
"SetData",
"assign",
"a",
"new",
"bar",
"list",
"to",
"a",
"chart"
] | [
"func",
"(",
"b",
"*",
"BarChart",
")",
"SetData",
"(",
"data",
"[",
"]",
"BarData",
")",
"{",
"b",
".",
"mtx",
".",
"Lock",
"(",
")",
"\n",
"defer",
"b",
".",
"mtx",
".",
"Unlock",
"(",
")",
"\n\n",
"b",
".",
"data",
"=",
"make",
"(",
"[",
"]",
"BarData",
",",
"len",
"(",
"<mask>",
")",
")",
"\n",
"copy",
"(",
"b",
".",
"data",
",",
"data",
")",
"\n",
"}"
] |
8,757 | all-8758 | [
"Error",
"returns",
"an",
"error",
"string",
"for",
"the",
"ContainerNotFound",
"error"
] | [
"func",
"(",
"cnferror",
"ContainerNotFound",
")",
"<mask>",
"(",
")",
"string",
"{",
"return",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"cnferror",
".",
"ContainerName",
",",
"cnferror",
".",
"TaskArn",
")",
"\n",
"}"
] |
8,758 | all-8759 | [
"HostPort",
"returns",
"Host",
":",
"Port"
] | [
"func",
"(",
"u",
"*",
"URI",
")",
"HostPort",
"(",
")",
"string",
"{",
"s",
":=",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"u",
".",
"host",
",",
"u",
".",
"<mask>",
")",
"\n",
"return",
"s",
"\n",
"}"
] |
8,759 | all-8760 | [
"resourceVSphereComputeClusterDeleteProcessForceRemoveHosts",
"process",
"force",
"-",
"evacuation",
"if",
"the",
"resource",
"has",
"been",
"configured",
"to",
"do",
"so",
".",
"NOTE",
":",
"As",
"documented",
"this",
"should",
"only",
"be",
"used",
"in",
"testing",
".",
"Improper",
"use",
"of",
"this",
"option",
"can",
"lead",
"to",
"service",
"disruptions",
"and",
"/",
"or",
"may",
"fail",
"to",
"actually",
"succeed",
"depending",
"on",
"the",
"resources",
"actually",
"in",
"use",
"in",
"the",
"cluster",
"and",
"specific",
"constraints",
"that",
"exist",
"in",
"the",
"cluster",
"."
] | [
"func",
"resourceVSphereComputeClusterDeleteProcessForceRemoveHosts",
"(",
"d",
"*",
"schema",
".",
"ResourceData",
",",
"meta",
"interface",
"{",
"}",
",",
"cluster",
"*",
"object",
".",
"ClusterComputeResource",
",",
")",
"error",
"{",
"if",
"!",
"d",
".",
"Get",
"(",
"\"",
"\"",
")",
".",
"(",
"bool",
")",
"{",
"return",
"nil",
"\n",
"}",
"\n\n",
"client",
",",
"err",
":=",
"resourceVSphereComputeClusterClient",
"(",
"meta",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"log",
".",
"Printf",
"(",
"\"",
"\"",
",",
"resourceVSphereComputeClusterIDString",
"(",
"d",
")",
")",
"\n",
"hosts",
",",
"err",
":=",
"resourceVSphereComputeClusterGetHostSystemObjects",
"(",
"<mask>",
",",
"structure",
".",
"SliceInterfacesToStrings",
"(",
"d",
".",
"Get",
"(",
"\"",
"\"",
")",
".",
"(",
"*",
"schema",
".",
"Set",
")",
".",
"List",
"(",
")",
")",
",",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"if",
"err",
":=",
"clustercomputeresource",
".",
"MoveHostsOutOf",
"(",
"cluster",
",",
"hosts",
",",
"d",
".",
"Get",
"(",
"\"",
"\"",
")",
".",
"(",
"int",
")",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"}",
"\n\n",
"return",
"nil",
"\n",
"}"
] |
8,760 | all-8761 | [
"ensureDefault",
"creates",
"and",
"stores",
"an",
"autogenerated",
"plan",
"in",
"case",
"of",
"no",
"plans",
"exists",
"."
] | [
"func",
"(",
"s",
"*",
"planService",
")",
"ensureDefault",
"(",
")",
"error",
"{",
"plans",
",",
"err",
":=",
"s",
".",
"storage",
".",
"FindAll",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"if",
"len",
"(",
"plans",
")",
">",
"0",
"{",
"return",
"nil",
"\n",
"}",
"\n",
"configMemory",
",",
"_",
":=",
"config",
".",
"GetInt",
"(",
"\"",
"\"",
")",
"\n",
"configSwap",
",",
"_",
":=",
"config",
".",
"GetInt",
"(",
"\"",
"\"",
")",
"\n",
"dp",
":=",
"appTypes",
".",
"Plan",
"{",
"Name",
":",
"\"",
"\"",
",",
"Memory",
":",
"int64",
"(",
"configMemory",
")",
"*",
"1024",
"*",
"1024",
",",
"Swap",
":",
"int64",
"(",
"configSwap",
"-",
"configMemory",
")",
"*",
"1024",
"*",
"1024",
",",
"CpuShare",
":",
"100",
",",
"Default",
":",
"true",
",",
"}",
"\n",
"return",
"s",
".",
"storage",
".",
"Insert",
"(",
"<mask>",
")",
"\n",
"}"
] |
8,761 | all-8762 | [
"MarshalBinary",
"is",
"used",
"to",
"serialize",
"an",
"Op",
"into",
"a",
"binary",
"form",
".",
"This",
"is",
"used",
"to",
"cache",
"the",
"ByteCode"
] | [
"func",
"(",
"o",
"op",
")",
"MarshalBinary",
"(",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"buf",
":=",
"rbpool",
".",
"Get",
"(",
")",
"\n",
"defer",
"rbpool",
".",
"Release",
"(",
"buf",
")",
"\n\n",
"// Write the code/opcode",
"if",
"err",
":=",
"binary",
".",
"Write",
"(",
"buf",
",",
"binary",
".",
"LittleEndian",
",",
"int64",
"(",
"o",
".",
"OpType",
")",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"errors",
".",
"Wrap",
"(",
"err",
",",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"// If this has args, we need to encode the args",
"tArg",
":=",
"reflect",
".",
"TypeOf",
"(",
"o",
".",
"uArg",
")",
"\n",
"hasArg",
":=",
"tArg",
"!=",
"nil",
"\n",
"if",
"hasArg",
"{",
"binary",
".",
"Write",
"(",
"buf",
",",
"binary",
".",
"LittleEndian",
",",
"int8",
"(",
"1",
")",
")",
"\n",
"}",
"else",
"{",
"binary",
".",
"Write",
"(",
"buf",
",",
"binary",
".",
"LittleEndian",
",",
"int8",
"(",
"0",
")",
")",
"\n",
"}",
"\n\n",
"if",
"hasArg",
"{",
"switch",
"tArg",
".",
"Kind",
"(",
")",
"{",
"case",
"reflect",
".",
"Int",
":",
"binary",
".",
"Write",
"(",
"buf",
",",
"binary",
".",
"LittleEndian",
",",
"int64",
"(",
"2",
")",
")",
"\n",
"binary",
".",
"Write",
"(",
"buf",
",",
"binary",
".",
"LittleEndian",
",",
"int64",
"(",
"o",
".",
"uArg",
".",
"(",
"int",
")",
")",
")",
"\n",
"case",
"reflect",
".",
"Int64",
":",
"binary",
".",
"Write",
"(",
"buf",
",",
"binary",
".",
"LittleEndian",
",",
"int64",
"(",
"2",
")",
")",
"\n",
"binary",
".",
"Write",
"(",
"buf",
",",
"binary",
".",
"LittleEndian",
",",
"int64",
"(",
"o",
".",
"uArg",
".",
"(",
"int64",
")",
")",
")",
"\n",
"case",
"reflect",
".",
"Slice",
":",
"if",
"tArg",
".",
"Elem",
"(",
")",
".",
"Kind",
"(",
")",
"!=",
"reflect",
".",
"Uint8",
"{",
"panic",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"binary",
".",
"Write",
"(",
"buf",
",",
"binary",
".",
"LittleEndian",
",",
"int64",
"(",
"5",
")",
")",
"\n",
"binary",
".",
"Write",
"(",
"buf",
",",
"binary",
".",
"LittleEndian",
",",
"int64",
"(",
"len",
"(",
"o",
".",
"uArg",
".",
"(",
"[",
"]",
"byte",
")",
")",
")",
")",
"\n",
"for",
"_",
",",
"v",
":=",
"range",
"o",
".",
"uArg",
".",
"(",
"[",
"]",
"byte",
")",
"{",
"binary",
".",
"Write",
"(",
"buf",
",",
"binary",
".",
"LittleEndian",
",",
"v",
")",
"\n",
"}",
"\n",
"case",
"reflect",
".",
"String",
":",
"binary",
".",
"Write",
"(",
"buf",
",",
"binary",
".",
"LittleEndian",
",",
"int64",
"(",
"6",
")",
")",
"\n",
"binary",
".",
"Write",
"(",
"buf",
",",
"<mask>",
".",
"LittleEndian",
",",
"int64",
"(",
"len",
"(",
"o",
".",
"uArg",
".",
"(",
"string",
")",
")",
")",
")",
"\n",
"for",
"_",
",",
"v",
":=",
"range",
"[",
"]",
"byte",
"(",
"o",
".",
"uArg",
".",
"(",
"string",
")",
")",
"{",
"binary",
".",
"Write",
"(",
"buf",
",",
"binary",
".",
"LittleEndian",
",",
"v",
")",
"\n",
"}",
"\n",
"default",
":",
"panic",
"(",
"\"",
"\"",
"+",
"tArg",
".",
"String",
"(",
")",
")",
"\n",
"}",
"\n",
"}",
"\n\n",
"v",
":=",
"o",
".",
"comment",
"\n",
"hasComment",
":=",
"v",
"!=",
"\"",
"\"",
"\n",
"if",
"hasComment",
"{",
"binary",
".",
"Write",
"(",
"buf",
",",
"binary",
".",
"LittleEndian",
",",
"int8",
"(",
"1",
")",
")",
"\n",
"binary",
".",
"Write",
"(",
"buf",
",",
"binary",
".",
"LittleEndian",
",",
"v",
")",
"\n",
"}",
"else",
"{",
"binary",
".",
"Write",
"(",
"buf",
",",
"binary",
".",
"LittleEndian",
",",
"int8",
"(",
"0",
")",
")",
"\n",
"}",
"\n\n",
"return",
"buf",
".",
"Bytes",
"(",
")",
",",
"nil",
"\n",
"}"
] |
8,762 | all-8763 | [
"GetOperator",
"is",
"a",
"wrapper",
"around",
"cairo_get_operator",
"()",
"."
] | [
"func",
"(",
"v",
"*",
"<mask>",
")",
"GetOperator",
"(",
")",
"Operator",
"{",
"c",
":=",
"C",
".",
"cairo_get_operator",
"(",
"v",
".",
"native",
"(",
")",
")",
"\n",
"return",
"Operator",
"(",
"c",
")",
"\n",
"}"
] |
8,763 | all-8764 | [
"Errorf",
"logs",
"provided",
"message",
"with",
"formatting",
"in",
"ERROR",
"level",
"."
] | [
"func",
"(",
"logger",
"*",
"Logger",
")",
"Errorf",
"(",
"<mask>",
"string",
",",
"a",
"...",
"interface",
"{",
"}",
")",
"{",
"logger",
".",
"log",
"(",
"ERROR",
",",
"format",
",",
"a",
"...",
")",
"\n",
"}"
] |
8,764 | all-8765 | [
"ClientOpen",
"decrypts",
"message",
"using",
"client",
"s",
"key",
"and",
"verifies",
"using",
"agent",
"s",
"key",
"."
] | [
"func",
"ClientOpen",
"(",
"c",
",",
"agentPub",
"[",
"]",
"byte",
",",
"clientPrv",
"*",
"ecdsa",
".",
"PrivateKey",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"sealed",
",",
"sig",
":=",
"UnpackSignature",
"(",
"c",
")",
"\n",
"hash",
":=",
"ethcrypto",
".",
"Keccak256",
"(",
"sealed",
")",
"\n\n",
"if",
"!",
"VerifySignature",
"(",
"agentPub",
",",
"<mask>",
",",
"sig",
")",
"{",
"return",
"nil",
",",
"ErrWrongSignature",
"\n",
"}",
"\n\n",
"prv",
":=",
"ecies",
".",
"ImportECDSA",
"(",
"clientPrv",
")",
"\n\n",
"opened",
",",
"err",
":=",
"prv",
".",
"Decrypt",
"(",
"sealed",
",",
"nil",
",",
"nil",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"return",
"opened",
",",
"nil",
"\n",
"}"
] |
8,765 | all-8766 | [
"GetTooltipContext",
"is",
"a",
"wrapper",
"around",
"gtk_icon_view_get_tooltip_context",
"()",
"."
] | [
"func",
"(",
"v",
"*",
"IconView",
")",
"GetTooltipContext",
"(",
"x",
",",
"y",
"int",
",",
"keyboardTip",
"bool",
")",
"(",
"*",
"TreeModel",
",",
"*",
"TreePath",
",",
"*",
"TreeIter",
")",
"{",
"var",
"(",
"cmodel",
"*",
"C",
".",
"GtkTreeModel",
"\n",
"cpath",
"*",
"C",
".",
"GtkTreePath",
"\n",
"citer",
"*",
"C",
".",
"GtkTreeIter",
"\n",
"model",
"*",
"TreeModel",
"\n",
"path",
"*",
"TreePath",
"\n",
"iter",
"*",
"TreeIter",
"\n",
")",
"\n\n",
"px",
":=",
"C",
".",
"gint",
"(",
"x",
")",
"\n",
"py",
":=",
"C",
".",
"gint",
"(",
"y",
")",
"\n",
"if",
"!",
"gobool",
"(",
"C",
".",
"gtk_icon_view_get_tooltip_context",
"(",
"v",
".",
"native",
"(",
")",
",",
"&",
"px",
",",
"&",
"py",
",",
"gbool",
"(",
"keyboardTip",
")",
",",
"&",
"cmodel",
",",
"&",
"cpath",
",",
"citer",
",",
")",
")",
"{",
"return",
"nil",
",",
"nil",
",",
"nil",
"\n",
"}",
"\n\n",
"if",
"cmodel",
"!=",
"nil",
"{",
"model",
"=",
"wrapTreeModel",
"(",
"glib",
".",
"Take",
"(",
"unsafe",
".",
"Pointer",
"(",
"cmodel",
")",
")",
")",
"\n",
"}",
"\n\n",
"if",
"cpath",
"!=",
"nil",
"{",
"path",
"=",
"&",
"TreePath",
"{",
"cpath",
"}",
"\n",
"runtime",
".",
"SetFinalizer",
"(",
"path",
",",
"(",
"*",
"TreePath",
")",
".",
"free",
")",
"\n",
"}",
"\n\n",
"if",
"citer",
"!=",
"nil",
"{",
"iter",
"=",
"&",
"TreeIter",
"{",
"*",
"citer",
"}",
"\n",
"runtime",
".",
"SetFinalizer",
"(",
"iter",
",",
"(",
"*",
"TreeIter",
")",
".",
"free",
")",
"\n",
"}",
"\n\n",
"return",
"<mask>",
",",
"path",
",",
"iter",
"\n",
"}"
] |
8,766 | all-8767 | [
"Repaint",
"draws",
"the",
"control",
"on",
"its",
"View",
"surface"
] | [
"func",
"(",
"f",
"*",
"Frame",
")",
"Draw",
"(",
")",
"{",
"if",
"f",
".",
"hidden",
"{",
"return",
"\n",
"}",
"\n\n",
"PushAttributes",
"(",
")",
"\n",
"defer",
"PopAttributes",
"(",
")",
"\n\n",
"x",
",",
"y",
",",
"w",
",",
"h",
":=",
"f",
".",
"Clipper",
"(",
")",
"\n",
"fx",
",",
"fy",
":=",
"f",
".",
"Pos",
"(",
")",
"\n",
"fw",
",",
"fh",
":=",
"f",
".",
"Size",
"(",
")",
"\n\n",
"if",
"f",
".",
"scrollable",
"{",
"_",
",",
"fpy",
":=",
"f",
".",
"Paddings",
"(",
")",
"\n\n",
"var",
"dist",
"float64",
"\n",
"prop",
":=",
"0",
"\n",
"ctrl",
":=",
"ActiveControl",
"(",
"f",
")",
"\n\n",
"if",
"ctrl",
"!=",
"nil",
"{",
"var",
"frameProp",
"float64",
"\n\n",
"_",
",",
"ty",
":=",
"ctrl",
".",
"Pos",
"(",
")",
"\n\n",
"dist",
"=",
"(",
"float64",
"(",
"fy",
")",
"+",
"float64",
"(",
"fpy",
")",
")",
"-",
"float64",
"(",
"ty",
")",
"\n",
"dist",
"=",
"math",
".",
"Sqrt",
"(",
"dist",
"*",
"dist",
")",
"\n\n",
"if",
"dist",
">",
"0",
"{",
"frameProp",
"=",
"(",
"dist",
"*",
"100",
")",
"/",
"float64",
"(",
"fh",
")",
"\n",
"}",
"\n\n",
"if",
"frameProp",
">",
"0",
"{",
"prop",
"=",
"int",
"(",
"math",
".",
"Round",
"(",
"(",
"float64",
"(",
"h",
"-",
"2",
")",
"/",
"(",
"100",
"/",
"frameProp",
")",
")",
")",
")",
"\n",
"}",
"\n\n",
"f",
".",
"lastScrollProp",
"=",
"prop",
"\n",
"}",
"\n\n",
"DrawScrollBar",
"(",
"x",
"+",
"w",
",",
"y",
",",
"1",
",",
"h",
",",
"f",
".",
"lastScrollProp",
")",
"\n",
"}",
"\n\n",
"fg",
",",
"bg",
":=",
"RealColor",
"(",
"f",
".",
"fg",
",",
"f",
".",
"Style",
"(",
")",
",",
"ColorViewText",
")",
",",
"RealColor",
"(",
"f",
".",
"bg",
",",
"f",
".",
"Style",
"(",
")",
",",
"ColorViewBack",
")",
"\n\n",
"if",
"f",
".",
"border",
"==",
"BorderNone",
"{",
"if",
"bg",
"!=",
"ColorDefault",
"{",
"SetBackColor",
"(",
"bg",
")",
"\n",
"FillRect",
"(",
"x",
",",
"y",
",",
"w",
",",
"h",
",",
"' '",
")",
"\n",
"}",
"\n\n",
"f",
".",
"DrawChildren",
"(",
")",
"\n",
"return",
"\n",
"}",
"\n\n",
"SetTextColor",
"(",
"fg",
")",
"\n",
"SetBackColor",
"(",
"bg",
")",
"\n",
"DrawFrame",
"(",
"fx",
",",
"fy",
",",
"fw",
",",
"fh",
",",
"f",
".",
"border",
")",
"\n\n",
"if",
"f",
".",
"title",
"!=",
"\"",
"\"",
"{",
"str",
":=",
"f",
".",
"<mask>",
"\n",
"raw",
":=",
"UnColorizeText",
"(",
"str",
")",
"\n",
"if",
"xs",
".",
"Len",
"(",
"raw",
")",
">",
"fw",
"-",
"2",
"{",
"str",
"=",
"SliceColorized",
"(",
"str",
",",
"0",
",",
"fw",
"-",
"2",
"-",
"3",
")",
"+",
"\"",
"\"",
"\n",
"}",
"\n",
"DrawText",
"(",
"fx",
"+",
"1",
",",
"fy",
",",
"str",
")",
"\n",
"}",
"\n\n",
"f",
".",
"DrawChildren",
"(",
")",
"\n",
"}"
] |
8,767 | all-8768 | [
"GetClientOfferings",
"returns",
"active",
"offerings",
"available",
"for",
"a",
"client",
"."
] | [
"func",
"(",
"h",
"*",
"Handler",
")",
"GetClientOfferings",
"(",
"tkn",
"string",
",",
"agent",
"data",
".",
"HexString",
",",
"minUnitPrice",
",",
"maxUnitPrice",
"uint64",
",",
"countries",
"[",
"]",
"string",
",",
"offset",
",",
"limit",
"uint",
")",
"(",
"*",
"GetClientOfferingsResult",
",",
"error",
")",
"{",
"logger",
":=",
"h",
".",
"logger",
".",
"Add",
"(",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"agent",
",",
"\"",
"\"",
",",
"minUnitPrice",
",",
"\"",
"\"",
",",
"maxUnitPrice",
",",
"\"",
"\"",
",",
"countries",
",",
"\"",
"\"",
",",
"offset",
",",
"\"",
"\"",
",",
"limit",
")",
"\n\n",
"if",
"!",
"h",
".",
"token",
".",
"Check",
"(",
"tkn",
")",
"{",
"logger",
".",
"Warn",
"(",
"\"",
"\"",
")",
"\n",
"return",
"nil",
",",
"ErrAccessDenied",
"\n",
"}",
"\n\n",
"if",
"minUnitPrice",
"!=",
"0",
"&&",
"maxUnitPrice",
"!=",
"0",
"&&",
"minUnitPrice",
">",
"maxUnitPrice",
"{",
"logger",
".",
"Error",
"(",
"ErrBadUnitPriceRange",
".",
"Error",
"(",
")",
")",
"\n",
"return",
"nil",
",",
"ErrBadUnitPriceRange",
"\n",
"}",
"\n\n",
"cond",
",",
"args",
":=",
"h",
".",
"getClientOfferingsConditions",
"(",
"agent",
",",
"minUnitPrice",
",",
"maxUnitPrice",
",",
"countries",
")",
"\n\n",
"count",
",",
"err",
":=",
"h",
".",
"numberOfObjects",
"(",
"logger",
",",
"data",
".",
"OfferingTable",
".",
"Name",
"(",
")",
",",
"cond",
",",
"args",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"offsetLimit",
":=",
"h",
".",
"offsetLimit",
"(",
"offset",
",",
"<mask>",
")",
"\n\n",
"tail",
":=",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"cond",
",",
"activeOfferingSorting",
",",
"offsetLimit",
")",
"\n\n",
"result",
",",
"err",
":=",
"h",
".",
"selectAllFrom",
"(",
"logger",
",",
"data",
".",
"OfferingTable",
",",
"tail",
",",
"args",
"...",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"offerings",
":=",
"make",
"(",
"[",
"]",
"data",
".",
"Offering",
",",
"len",
"(",
"result",
")",
")",
"\n\n",
"for",
"k",
",",
"v",
":=",
"range",
"result",
"{",
"offerings",
"[",
"k",
"]",
"=",
"*",
"v",
".",
"(",
"*",
"data",
".",
"Offering",
")",
"\n",
"}",
"\n\n",
"return",
"&",
"GetClientOfferingsResult",
"{",
"offerings",
",",
"count",
"}",
",",
"nil",
"\n",
"}"
] |
8,768 | all-8769 | [
"AddFieldError",
"appends",
"an",
"error",
"to",
"a",
"list",
"of",
"field",
"specific",
"errors",
"."
] | [
"func",
"(",
"f",
"*",
"FormErrors",
")",
"AddFieldError",
"(",
"<mask>",
",",
"e",
"string",
")",
"{",
"if",
"f",
".",
"FieldErrors",
"==",
"nil",
"{",
"f",
".",
"FieldErrors",
"=",
"map",
"[",
"string",
"]",
"[",
"]",
"string",
"{",
"}",
"\n",
"}",
"\n",
"if",
"_",
",",
"ok",
":=",
"f",
".",
"FieldErrors",
"[",
"field",
"]",
";",
"!",
"ok",
"{",
"f",
".",
"FieldErrors",
"[",
"field",
"]",
"=",
"[",
"]",
"string",
"{",
"}",
"\n",
"}",
"\n",
"f",
".",
"FieldErrors",
"[",
"field",
"]",
"=",
"append",
"(",
"f",
".",
"FieldErrors",
"[",
"field",
"]",
",",
"e",
")",
"\n",
"}"
] |
8,769 | all-8770 | [
"AddVoter",
"will",
"add",
"the",
"given",
"server",
"to",
"the",
"cluster",
"as",
"a",
"staging",
"server",
".",
"If",
"the",
"server",
"is",
"already",
"in",
"the",
"cluster",
"as",
"a",
"voter",
"this",
"updates",
"the",
"server",
"s",
"address",
".",
"This",
"must",
"be",
"run",
"on",
"the",
"leader",
"or",
"it",
"will",
"fail",
".",
"The",
"leader",
"will",
"promote",
"the",
"staging",
"server",
"to",
"a",
"voter",
"once",
"that",
"server",
"is",
"ready",
".",
"If",
"nonzero",
"prevIndex",
"is",
"the",
"index",
"of",
"the",
"only",
"configuration",
"upon",
"which",
"this",
"change",
"may",
"be",
"applied",
";",
"if",
"another",
"configuration",
"entry",
"has",
"been",
"added",
"in",
"the",
"meantime",
"this",
"request",
"will",
"fail",
".",
"If",
"nonzero",
"timeout",
"is",
"how",
"long",
"this",
"server",
"should",
"wait",
"before",
"the",
"configuration",
"change",
"log",
"entry",
"is",
"appended",
"."
] | [
"func",
"(",
"r",
"*",
"Raft",
")",
"AddVoter",
"(",
"id",
"ServerID",
",",
"address",
"ServerAddress",
",",
"prevIndex",
"uint64",
",",
"timeout",
"time",
".",
"Duration",
")",
"IndexFuture",
"{",
"if",
"r",
".",
"protocolVersion",
"<",
"2",
"{",
"return",
"errorFuture",
"{",
"ErrUnsupportedProtocol",
"}",
"\n",
"}",
"\n\n",
"return",
"r",
".",
"requestConfigChange",
"(",
"configurationChangeRequest",
"{",
"<mask>",
":",
"AddStaging",
",",
"serverID",
":",
"id",
",",
"serverAddress",
":",
"address",
",",
"prevIndex",
":",
"prevIndex",
",",
"}",
",",
"timeout",
")",
"\n",
"}"
] |
8,770 | all-8771 | [
"deprecated",
"since",
"2",
".",
"38",
":",
"g_simple_action_group_lookup",
"()",
"g_simple_action_group_insert",
"()",
"g_simple_action_group_remove",
"()",
"g_simple_action_group_add_entries",
"()",
"-",
">",
"See",
"implementations",
"in",
"ActionMap",
"native",
"()",
"returns",
"a",
"pointer",
"to",
"the",
"underlying",
"GSimpleActionGroup",
"."
] | [
"func",
"(",
"v",
"*",
"SimpleActionGroup",
")",
"native",
"(",
")",
"*",
"C",
".",
"GSimpleActionGroup",
"{",
"if",
"v",
"==",
"nil",
"||",
"v",
".",
"GObject",
"==",
"nil",
"{",
"<mask>",
"nil",
"\n",
"}",
"\n",
"return",
"C",
".",
"toGSimpleActionGroup",
"(",
"unsafe",
".",
"Pointer",
"(",
"v",
".",
"GObject",
")",
")",
"\n",
"}"
] |
8,771 | all-8772 | [
"lexKeywordOrIdentifier",
"scans",
"an",
"alphanumeric",
"identifier",
"which",
"may",
"contain",
"a",
"colon",
"rune",
".",
"If",
"the",
"identifier",
"is",
"a",
"keyword",
"the",
"respective",
"keyword",
"item",
"is",
"scanned",
"."
] | [
"func",
"lexKeywordOrIdentifier",
"(",
"l",
"*",
"lexer",
")",
"stateFn",
"{",
"Loop",
":",
"for",
"{",
"switch",
"r",
":=",
"l",
".",
"next",
"(",
")",
";",
"{",
"case",
"isAlphaNumeric",
"(",
"r",
")",
"||",
"r",
"==",
"':'",
":",
"// absorb.",
"default",
":",
"l",
".",
"backup",
"(",
")",
"\n",
"word",
":=",
"l",
".",
"input",
"[",
"l",
".",
"start",
":",
"l",
".",
"pos",
"]",
"\n",
"if",
"kw",
",",
"ok",
":=",
"<mask>",
"[",
"strings",
".",
"ToLower",
"(",
"word",
")",
"]",
";",
"ok",
"{",
"l",
".",
"emit",
"(",
"kw",
")",
"\n",
"}",
"else",
"if",
"!",
"strings",
".",
"Contains",
"(",
"word",
",",
"\"",
"\"",
")",
"{",
"l",
".",
"emit",
"(",
"ItemIdentifier",
")",
"\n",
"}",
"else",
"{",
"l",
".",
"emit",
"(",
"ItemMetricIdentifier",
")",
"\n",
"}",
"\n",
"break",
"Loop",
"\n",
"}",
"\n",
"}",
"\n",
"if",
"l",
".",
"seriesDesc",
"&&",
"l",
".",
"peek",
"(",
")",
"!=",
"'{'",
"{",
"return",
"lexValueSequence",
"\n",
"}",
"\n",
"return",
"lexStatements",
"\n",
"}"
] |
8,772 | all-8773 | [
"Func",
"returns",
"the",
"package",
"-",
"level",
"function",
"of",
"the",
"specified",
"name",
"or",
"nil",
"if",
"not",
"found",
"."
] | [
"func",
"(",
"p",
"*",
"Package",
")",
"Func",
"(",
"name",
"string",
")",
"(",
"f",
"*",
"Function",
")",
"{",
"f",
",",
"_",
"=",
"p",
".",
"Members",
"[",
"<mask>",
"]",
".",
"(",
"*",
"Function",
")",
"\n",
"return",
"\n",
"}"
] |
8,773 | all-8774 | [
"Signature",
"returns",
"the",
"signature",
"of",
"the",
"called",
"function",
".",
"For",
"an",
"invoke",
"-",
"mode",
"call",
"the",
"signature",
"of",
"the",
"interface",
"method",
"is",
"returned",
".",
"In",
"either",
"call",
"or",
"invoke",
"mode",
"if",
"the",
"callee",
"is",
"a",
"method",
"its",
"receiver",
"is",
"represented",
"by",
"sig",
".",
"Recv",
"not",
"sig",
".",
"Params",
"()",
".",
"At",
"(",
"0",
")",
"."
] | [
"func",
"(",
"c",
"*",
"CallCommon",
")",
"Signature",
"(",
")",
"*",
"types",
".",
"Signature",
"{",
"if",
"c",
".",
"Method",
"!=",
"nil",
"{",
"return",
"c",
".",
"Method",
".",
"Type",
"(",
")",
".",
"(",
"*",
"types",
".",
"Signature",
")",
"\n",
"}",
"\n",
"return",
"c",
".",
"Value",
".",
"Type",
"(",
")",
".",
"Underlying",
"(",
")",
".",
"(",
"*",
"<mask>",
".",
"Signature",
")",
"\n",
"}"
] |
8,774 | all-8775 | [
"UnmarshalJSON",
"supports",
"json",
".",
"Unmarshaler",
"interface"
] | [
"func",
"(",
"v",
"*",
"EventExecutionContextsCleared",
")",
"UnmarshalJSON",
"(",
"data",
"[",
"]",
"byte",
")",
"error",
"{",
"r",
":=",
"jlexer",
".",
"Lexer",
"{",
"Data",
":",
"<mask>",
"}",
"\n",
"easyjsonC5a4559bDecodeGithubComChromedpCdprotoRuntime30",
"(",
"&",
"r",
",",
"v",
")",
"\n",
"return",
"r",
".",
"Error",
"(",
")",
"\n",
"}"
] |
8,775 | all-8776 | [
"StrIn",
"param",
"is",
"a",
"string",
"the",
"string",
"is",
"in",
"array"
] | [
"func",
"(",
"c",
"*",
"Controller",
")",
"StrIn",
"(",
"fieldName",
"string",
",",
"p",
"interface",
"{",
"}",
",",
"l",
"...",
"string",
")",
"string",
"{",
"if",
"p",
"==",
"nil",
"{",
"p",
"=",
"\"",
"\"",
"\n",
"}",
"\n",
"v",
",",
"ok",
":=",
"p",
".",
"(",
"string",
")",
"\n",
"if",
"ok",
"==",
"false",
"{",
"panic",
"(",
"(",
"&",
"ValidationError",
"{",
"}",
")",
".",
"New",
"(",
"fieldName",
"+",
"\"",
"",
"",
"",
"\n",
"}",
"\n",
"b",
":=",
"<mask>",
"\n",
"for",
"i",
":=",
"0",
";",
"i",
"<",
"len",
"(",
"l",
")",
";",
"i",
"++",
"{",
"if",
"l",
"[",
"i",
"]",
"==",
"v",
"{",
"b",
"=",
"true",
"\n",
"}",
"\n",
"}",
"\n",
"if",
"b",
"==",
"false",
"{",
"panic",
"(",
"(",
"&",
"ValidationError",
"{",
"}",
")",
".",
"New",
"(",
"fieldName",
"+",
"\"",
"n",
"s",
"Replace",
"(",
"strings",
".",
"Trim(fm",
"t",
".Spr",
"i",
"nt(",
"l",
"), \"[]",
"\"",
")",
",",
" ",
" ",
" ",
"\"",
",",
",",
"-",
"1",
" ",
" ",
"\"",
"\"",
")",
")",
"",
"",
"",
"",
"",
"\n",
"}",
"\n",
"return",
"v",
"\n",
"}"
] |
8,776 | all-8777 | [
"Used",
"for",
"user",
"&",
"password",
"based",
"authentication"
] | [
"func",
"(",
"s",
"*",
"Session",
")",
"makeAuthorizationHeaders",
"(",
")",
"(",
"string",
",",
"*",
"<mask>",
")",
"{",
"if",
"s",
".",
"Username",
"==",
"\"",
"\"",
"{",
"return",
"\"",
"\"",
",",
"NewBambouError",
"(",
"\"",
"\"",
",",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"if",
"s",
".",
"root",
"==",
"nil",
"{",
"return",
"\"",
"\"",
",",
"NewBambouError",
"(",
"\"",
"\"",
",",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"key",
":=",
"s",
".",
"root",
".",
"APIKey",
"(",
")",
"\n",
"if",
"s",
".",
"Password",
"==",
"\"",
"\"",
"&&",
"key",
"==",
"\"",
"\"",
"{",
"return",
"\"",
"\"",
",",
"NewBambouError",
"(",
"\"",
"\"",
",",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"if",
"key",
"==",
"\"",
"\"",
"{",
"key",
"=",
"s",
".",
"Password",
"\n",
"}",
"\n\n",
"return",
"\"",
"\"",
"+",
"base64",
".",
"StdEncoding",
".",
"EncodeToString",
"(",
"[",
"]",
"byte",
"(",
"s",
".",
"Username",
"+",
"\"",
"\"",
"+",
"key",
")",
")",
",",
"nil",
"\n",
"}"
] |
8,777 | all-8778 | [
"FinalHandlerFunc",
"is",
"a",
"helper",
"function",
"to",
"wrap",
"the",
"last",
"function",
"with",
"signature",
"func",
"(",
"w",
"http",
".",
"ResponseWriter",
"r",
"*",
"http",
".",
"Request",
")",
"in",
"the",
"ChainHandlers",
"function",
"."
] | [
"func",
"FinalHandlerFunc",
"(",
"h",
"func",
"(",
"w",
"http",
".",
"ResponseWriter",
",",
"r",
"*",
"http",
".",
"Request",
")",
")",
"func",
"(",
"http",
".",
"Handler",
")",
"http",
".",
"Handler",
"{",
"return",
"func",
"(",
"_",
"http",
".",
"Handler",
")",
"<mask>",
".",
"Handler",
"{",
"return",
"http",
".",
"HandlerFunc",
"(",
"h",
")",
"\n",
"}",
"\n",
"}"
] |
8,778 | all-8779 | [
"SetIconFromPixbuf",
"is",
"a",
"wrapper",
"around",
"gtk_entry_set_icon_from_pixbuf",
"()",
"."
] | [
"func",
"(",
"v",
"*",
"<mask>",
")",
"SetIconFromPixbuf",
"(",
"iconPos",
"EntryIconPosition",
",",
"pixbuf",
"*",
"gdk",
".",
"Pixbuf",
")",
"{",
"C",
".",
"gtk_entry_set_icon_from_pixbuf",
"(",
"v",
".",
"native",
"(",
")",
",",
"C",
".",
"GtkEntryIconPosition",
"(",
"iconPos",
")",
",",
"(",
"*",
"C",
".",
"GdkPixbuf",
")",
"(",
"unsafe",
".",
"Pointer",
"(",
"pixbuf",
".",
"Native",
"(",
")",
")",
")",
")",
"\n",
"}"
] |
8,779 | all-8780 | [
"RegisterContainerInstance",
"indicates",
"an",
"expected",
"call",
"of",
"RegisterContainerInstance"
] | [
"func",
"(",
"mr",
"*",
"MockECSSDKMockRecorder",
")",
"RegisterContainerInstance",
"(",
"arg0",
"<mask>",
"{",
"}",
")",
"*",
"gomock",
".",
"Call",
"{",
"return",
"mr",
".",
"mock",
".",
"ctrl",
".",
"RecordCallWithMethodType",
"(",
"mr",
".",
"mock",
",",
"\"",
"\"",
",",
"reflect",
".",
"TypeOf",
"(",
"(",
"*",
"MockECSSDK",
")",
"(",
"nil",
")",
".",
"RegisterContainerInstance",
")",
",",
"arg0",
")",
"\n",
"}"
] |
8,780 | all-8781 | [
"Events",
"mocks",
"base",
"method"
] | [
"func",
"(",
"m",
"*",
"MockClient",
")",
"Events",
"(",
"arg0",
"context",
".",
"Context",
",",
"arg1",
"types",
".",
"EventsOptions",
")",
"(",
"<-",
"chan",
"events",
".",
"Message",
",",
"<-",
"chan",
"error",
")",
"{",
"ret",
":=",
"m",
".",
"ctrl",
".",
"Call",
"(",
"m",
",",
"\"",
"\"",
",",
"arg0",
",",
"arg1",
")",
"\n",
"ret0",
",",
"_",
":=",
"<mask>",
"[",
"0",
"]",
".",
"(",
"<-",
"chan",
"events",
".",
"Message",
")",
"\n",
"ret1",
",",
"_",
":=",
"ret",
"[",
"1",
"]",
".",
"(",
"<-",
"chan",
"error",
")",
"\n",
"return",
"ret0",
",",
"ret1",
"\n",
"}"
] |
8,781 | all-8782 | [
"WriteTaskStatsResponse",
"writes",
"the",
"task",
"stats",
"to",
"response",
"writer",
"."
] | [
"func",
"WriteTaskStatsResponse",
"(",
"w",
"http",
".",
"ResponseWriter",
",",
"taskARN",
"string",
",",
"state",
"dockerstate",
".",
"TaskEngineState",
",",
"statsEngine",
"stats",
".",
"<mask>",
")",
"{",
"taskStatsResponse",
",",
"err",
":=",
"NewTaskStatsResponse",
"(",
"taskARN",
",",
"state",
",",
"statsEngine",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"seelog",
".",
"Warnf",
"(",
"\"",
"\"",
",",
"taskARN",
",",
"err",
")",
"\n",
"errResponseJSON",
",",
"_",
":=",
"json",
".",
"Marshal",
"(",
"\"",
"\"",
"+",
"taskARN",
")",
"\n",
"utils",
".",
"WriteJSONToResponse",
"(",
"w",
",",
"http",
".",
"StatusBadRequest",
",",
"errResponseJSON",
",",
"utils",
".",
"RequestTypeTaskStats",
")",
"\n",
"return",
"\n",
"}",
"\n\n",
"responseJSON",
",",
"_",
":=",
"json",
".",
"Marshal",
"(",
"taskStatsResponse",
")",
"\n",
"utils",
".",
"WriteJSONToResponse",
"(",
"w",
",",
"http",
".",
"StatusOK",
",",
"responseJSON",
",",
"utils",
".",
"RequestTypeTaskStats",
")",
"\n",
"}"
] |
8,782 | all-8783 | [
"SetsysForUid",
"sets",
"the",
"value",
"of",
"the",
"environment",
"variable",
"named",
"by",
"the",
"key",
"that",
"affects",
"the",
"system",
"as",
"a",
"whole",
".",
"You",
"must",
"be",
"Root",
".",
"It",
"returns",
"an",
"error",
"if",
"any",
"."
] | [
"func",
"SetsysForUid",
"(",
"id",
"int",
",",
"key",
",",
"value",
"string",
")",
"error",
"{",
"if",
"!",
"_IS_ROOT",
"{",
"return",
"ErrNoRoot",
"\n",
"}",
"\n\n",
"_settings",
",",
"err",
":=",
"getSettingsForUid",
"(",
"id",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"return",
"_Set",
"(",
"_settings",
".",
"<mask>",
",",
"key",
",",
"value",
")",
"\n",
"}"
] |
8,783 | all-8784 | [
"GrepNot",
"emits",
"every",
"input",
"x",
"that",
"does",
"not",
"match",
"the",
"regular",
"expression",
"r",
"."
] | [
"func",
"GrepNot",
"(",
"r",
"string",
")",
"Filter",
"{",
"re",
",",
"err",
":=",
"regexp",
".",
"Compile",
"(",
"r",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"FilterFunc",
"(",
"func",
"(",
"Arg",
")",
"error",
"{",
"return",
"err",
"}",
")",
"\n",
"}",
"\n",
"return",
"If",
"(",
"func",
"(",
"s",
"string",
")",
"bool",
"{",
"return",
"!",
"<mask>",
".",
"MatchString",
"(",
"s",
")",
"}",
")",
"\n",
"}"
] |
8,784 | all-8785 | [
"ContainerDockerStats",
"returns",
"the",
"last",
"stored",
"raw",
"docker",
"stats",
"object",
"for",
"a",
"container"
] | [
"func",
"(",
"engine",
"*",
"DockerStatsEngine",
")",
"ContainerDockerStats",
"(",
"taskARN",
"string",
",",
"containerID",
"string",
")",
"(",
"*",
"types",
".",
"StatsJSON",
",",
"error",
")",
"{",
"engine",
".",
"lock",
".",
"RLock",
"(",
")",
"\n",
"defer",
"engine",
".",
"lock",
".",
"RUnlock",
"(",
")",
"\n\n",
"containerIDToStatsContainer",
",",
"ok",
":=",
"<mask>",
".",
"tasksToContainers",
"[",
"taskARN",
"]",
"\n",
"if",
"!",
"ok",
"{",
"return",
"nil",
",",
"errors",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"taskARN",
",",
"containerID",
")",
"\n",
"}",
"\n\n",
"container",
",",
"ok",
":=",
"containerIDToStatsContainer",
"[",
"containerID",
"]",
"\n",
"if",
"!",
"ok",
"{",
"return",
"nil",
",",
"errors",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"containerID",
")",
"\n",
"}",
"\n",
"return",
"container",
".",
"statsQueue",
".",
"GetLastStat",
"(",
")",
",",
"nil",
"\n\n",
"}"
] |
8,785 | all-8786 | [
"GetChildSecondary",
"()",
"is",
"a",
"wrapper",
"around",
"gtk_button_box_get_child_secondary",
"()",
"."
] | [
"func",
"(",
"v",
"*",
"ButtonBox",
")",
"GetChildSecondary",
"(",
"child",
"IWidget",
")",
"bool",
"{",
"c",
":=",
"C",
".",
"gtk_button_box_get_child_secondary",
"(",
"v",
".",
"native",
"(",
")",
",",
"<mask>",
".",
"toWidget",
"(",
")",
")",
"\n",
"return",
"gobool",
"(",
"c",
")",
"\n",
"}"
] |
8,786 | all-8787 | [
"HexToAddress",
"returns",
"ethereum",
"s",
"address",
"from",
"base",
"64",
"encoded",
"string",
"."
] | [
"func",
"HexToAddress",
"(",
"addr",
"HexString",
")",
"(",
"common",
".",
"<mask>",
",",
"error",
")",
"{",
"addrBytes",
",",
"err",
":=",
"HexToBytes",
"(",
"addr",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"err",
"=",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"}",
"\n",
"return",
"common",
".",
"BytesToAddress",
"(",
"addrBytes",
")",
",",
"err",
"\n",
"}"
] |
8,787 | all-8788 | [
"MarshalJSON",
"supports",
"json",
".",
"Marshaler",
"interface"
] | [
"func",
"(",
"v",
"ObjectStore",
")",
"MarshalJSON",
"(",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"w",
":=",
"jwriter",
".",
"<mask>",
"{",
"}",
"\n",
"easyjsonC5a4559bEncodeGithubComChromedpCdprotoIndexeddb7",
"(",
"&",
"w",
",",
"v",
")",
"\n",
"return",
"w",
".",
"Buffer",
".",
"BuildBytes",
"(",
")",
",",
"w",
".",
"Error",
"\n",
"}"
] |
8,788 | all-8789 | [
"GetColumnsOk",
"returns",
"a",
"tuple",
"with",
"the",
"Columns",
"field",
"if",
"it",
"s",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"and",
"a",
"boolean",
"to",
"check",
"if",
"the",
"value",
"has",
"been",
"set",
"."
] | [
"func",
"(",
"w",
"*",
"Widget",
")",
"GetColumnsOk",
"(",
")",
"(",
"string",
",",
"bool",
")",
"{",
"if",
"w",
"==",
"nil",
"||",
"w",
".",
"Columns",
"==",
"nil",
"{",
"return",
"\"",
"\"",
",",
"false",
"\n",
"}",
"\n",
"return",
"*",
"w",
".",
"Columns",
",",
"<mask>",
"\n",
"}"
] |
8,789 | all-8790 | [
"Manager",
"returns",
"the",
"current",
"configured",
"manager",
"as",
"defined",
"in",
"the",
"configuration",
"file",
"."
] | [
"func",
"Manager",
"(",
")",
"RepositoryManager",
"{",
"managerName",
",",
"err",
":=",
"config",
".",
"GetString",
"(",
"\"",
"\"",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"managerName",
"=",
"defaultManager",
"\n",
"}",
"\n",
"if",
"_",
",",
"ok",
":=",
"managers",
"[",
"managerName",
"]",
";",
"!",
"<mask>",
"{",
"managerName",
"=",
"\"",
"\"",
"\n",
"}",
"\n",
"return",
"managers",
"[",
"managerName",
"]",
"\n",
"}"
] |
8,790 | all-8791 | [
"GetLineWidthOk",
"returns",
"a",
"tuple",
"with",
"the",
"LineWidth",
"field",
"if",
"it",
"s",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"and",
"a",
"boolean",
"to",
"check",
"if",
"the",
"value",
"has",
"been",
"set",
"."
] | [
"func",
"(",
"t",
"*",
"TimeseriesRequestStyle",
")",
"GetLineWidthOk",
"(",
")",
"(",
"string",
",",
"bool",
")",
"{",
"if",
"t",
"==",
"nil",
"||",
"t",
".",
"LineWidth",
"==",
"nil",
"{",
"return",
"\"",
"\"",
",",
"false",
"\n",
"}",
"\n",
"return",
"*",
"t",
".",
"LineWidth",
",",
"<mask>",
"\n",
"}"
] |
8,791 | all-8792 | [
"ExportPubKey",
"returns",
"public",
"keys",
"in",
"ASCII",
"armored",
"format",
".",
"Retrieve",
"a",
"Info",
"object",
"by",
"its",
"name",
"and",
"return",
"the",
"public",
"key",
"in",
"a",
"portable",
"format",
"."
] | [
"func",
"(",
"kb",
"dbKeybase",
")",
"ExportPubKey",
"(",
"name",
"string",
")",
"(",
"armor",
"string",
",",
"err",
"error",
")",
"{",
"bz",
":=",
"kb",
".",
"db",
".",
"Get",
"(",
"infoKey",
"(",
"name",
")",
")",
"\n",
"if",
"bz",
"==",
"nil",
"{",
"return",
"\"",
"\"",
",",
"errors",
".",
"New",
"(",
"\"",
"\"",
"+",
"name",
")",
"\n",
"}",
"\n",
"info",
",",
"err",
":=",
"readInfo",
"(",
"bz",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"\n",
"}",
"\n",
"return",
"armorPubKeyBytes",
"(",
"<mask>",
".",
"GetPubKey",
"(",
")",
".",
"Bytes",
"(",
")",
")",
",",
"nil",
"\n",
"}"
] |
8,792 | all-8793 | [
"dirname",
"returns",
"the",
"logical",
"parent",
"directory",
"of",
"the",
"path",
".",
"This",
"is",
"different",
"than",
"path",
".",
"Split",
"()",
"in",
"that",
"we",
"want",
"dirname",
"(",
"foo",
"/",
"bar",
"/",
")",
"-",
">",
"foo",
"/",
"whereas",
"path",
".",
"Split",
"()",
"returns",
"foo",
"/",
"bar",
"/",
"."
] | [
"func",
"dirname",
"(",
"path",
"string",
")",
"string",
"{",
"leading",
":=",
"\"",
"\"",
"\n",
"if",
"strings",
".",
"HasPrefix",
"(",
"path",
",",
"\"",
"\"",
")",
"{",
"leading",
"=",
"\"",
"\"",
"\n",
"}",
"\n",
"<mask>",
":=",
"strings",
".",
"Split",
"(",
"strings",
".",
"Trim",
"(",
"path",
",",
"\"",
"\"",
")",
",",
"\"",
"\"",
")",
"\n",
"if",
"len",
"(",
"parts",
")",
">",
"1",
"{",
"return",
"leading",
"+",
"strings",
".",
"Join",
"(",
"parts",
"[",
"0",
":",
"len",
"(",
"parts",
")",
"-",
"1",
"]",
",",
"\"",
"\"",
")",
"+",
"\"",
"\"",
"\n",
"}",
"\n",
"return",
"leading",
"\n",
"}"
] |
8,793 | all-8794 | [
"userGetCommandFunc",
"executes",
"the",
"user",
"get",
"command",
"."
] | [
"func",
"userGetCommandFunc",
"(",
"cmd",
"*",
"cobra",
".",
"Command",
",",
"args",
"[",
"]",
"string",
")",
"{",
"if",
"len",
"(",
"args",
")",
"!=",
"1",
"{",
"ExitWithError",
"(",
"ExitBadArgs",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
")",
")",
"\n",
"}",
"\n\n",
"name",
":=",
"args",
"[",
"0",
"]",
"\n",
"client",
":=",
"mustClientFromCmd",
"(",
"cmd",
")",
"\n",
"resp",
",",
"err",
":=",
"client",
".",
"Auth",
".",
"UserGet",
"(",
"context",
".",
"TODO",
"(",
")",
",",
"name",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"ExitWithError",
"(",
"ExitError",
",",
"err",
")",
"\n",
"}",
"\n\n",
"if",
"userShowDetail",
"{",
"fmt",
".",
"Printf",
"(",
"\"",
"\\n",
"\"",
",",
"name",
")",
"\n",
"for",
"_",
",",
"role",
":=",
"range",
"resp",
".",
"Roles",
"{",
"fmt",
".",
"Printf",
"(",
"\"",
"\\n",
"\"",
")",
"\n",
"roleResp",
",",
"err",
":=",
"client",
".",
"Auth",
".",
"RoleGet",
"(",
"context",
".",
"TODO",
"(",
")",
",",
"role",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"ExitWithError",
"(",
"ExitError",
",",
"err",
")",
"\n",
"}",
"\n",
"display",
".",
"RoleGet",
"(",
"<mask>",
",",
"*",
"roleResp",
")",
"\n",
"}",
"\n",
"}",
"else",
"{",
"display",
".",
"UserGet",
"(",
"name",
",",
"*",
"resp",
")",
"\n",
"}",
"\n",
"}"
] |
8,794 | all-8795 | [
"WriteToRequest",
"writes",
"these",
"params",
"to",
"a",
"swagger",
"request"
] | [
"func",
"(",
"o",
"*",
"OrderVMByFilterParams",
")",
"WriteToRequest",
"(",
"r",
"runtime",
".",
"ClientRequest",
",",
"reg",
"strfmt",
".",
"Registry",
")",
"error",
"{",
"if",
"err",
":=",
"r",
".",
"SetTimeout",
"(",
"o",
".",
"timeout",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"<mask>",
"res",
"[",
"]",
"error",
"\n\n",
"if",
"o",
".",
"Body",
"==",
"nil",
"{",
"o",
".",
"Body",
"=",
"new",
"(",
"models",
".",
"VMFilter",
")",
"\n",
"}",
"\n\n",
"if",
"err",
":=",
"r",
".",
"SetBodyParam",
"(",
"o",
".",
"Body",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"if",
"len",
"(",
"res",
")",
">",
"0",
"{",
"return",
"errors",
".",
"CompositeValidationError",
"(",
"res",
"...",
")",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
] |
8,795 | all-8796 | [
"return",
"the",
"result",
"that",
"has",
"the",
"route",
"defined",
"the",
"earliest"
] | [
"func",
"(",
"rt",
"*",
"router",
")",
"ofFirstDefinedRoute",
"(",
"matches",
"[",
"]",
"*",
"trie",
".",
"Match",
")",
"*",
"trie",
".",
"Match",
"{",
"minIndex",
":=",
"-",
"1",
"\n",
"<mask>",
"bestMatch",
"*",
"trie",
".",
"Match",
"\n\n",
"for",
"_",
",",
"result",
":=",
"range",
"matches",
"{",
"route",
":=",
"result",
".",
"Route",
".",
"(",
"*",
"Route",
")",
"\n",
"routeIndex",
":=",
"rt",
".",
"index",
"[",
"route",
"]",
"\n",
"if",
"minIndex",
"==",
"-",
"1",
"||",
"routeIndex",
"<",
"minIndex",
"{",
"minIndex",
"=",
"routeIndex",
"\n",
"bestMatch",
"=",
"result",
"\n",
"}",
"\n",
"}",
"\n\n",
"return",
"bestMatch",
"\n",
"}"
] |
8,796 | all-8797 | [
"ContainsSameLabelset",
"checks",
"if",
"a",
"vector",
"has",
"samples",
"with",
"the",
"same",
"labelset",
"Such",
"a",
"behavior",
"is",
"semantically",
"undefined",
"https",
":",
"//",
"github",
".",
"com",
"/",
"prometheus",
"/",
"prometheus",
"/",
"issues",
"/",
"4562"
] | [
"func",
"(",
"vec",
"Vector",
")",
"ContainsSameLabelset",
"(",
")",
"bool",
"{",
"l",
":=",
"make",
"(",
"map",
"[",
"uint64",
"]",
"struct",
"{",
"}",
",",
"len",
"(",
"vec",
")",
")",
"\n",
"for",
"_",
",",
"s",
":=",
"range",
"vec",
"{",
"<mask>",
":=",
"s",
".",
"Metric",
".",
"Hash",
"(",
")",
"\n",
"if",
"_",
",",
"ok",
":=",
"l",
"[",
"hash",
"]",
";",
"ok",
"{",
"return",
"true",
"\n",
"}",
"\n",
"l",
"[",
"hash",
"]",
"=",
"struct",
"{",
"}",
"{",
"}",
"\n",
"}",
"\n",
"return",
"false",
"\n",
"}"
] |
8,797 | all-8798 | [
"GetRequiredVersion",
"is",
"a",
"wrapper",
"around",
"gdk_gl_context_get_required_version",
"()",
"."
] | [
"func",
"(",
"v",
"*",
"GLContext",
")",
"GetRequiredVersion",
"(",
")",
"(",
"MajorVersion",
",",
"MinorVersion",
")",
"{",
"var",
"major",
",",
"minor",
"int",
"\n",
"C",
".",
"gdk_gl_context_get_required_version",
"(",
"v",
".",
"native",
"(",
")",
",",
"(",
"*",
"C",
".",
"int",
")",
"(",
"unsafe",
".",
"Pointer",
"(",
"&",
"major",
")",
")",
",",
"(",
"*",
"C",
".",
"int",
")",
"(",
"unsafe",
".",
"Pointer",
"(",
"&",
"minor",
")",
")",
")",
"\n\n",
"return",
"MajorVersion",
"(",
"<mask>",
")",
",",
"MinorVersion",
"(",
"minor",
")",
"\n",
"}"
] |
8,798 | all-8799 | [
"NewPublishMetricsRequest",
"creates",
"a",
"PublishMetricsRequest",
"object",
"."
] | [
"func",
"NewPublishMetricsRequest",
"(",
"metadata",
"*",
"MetricsMetadata",
",",
"taskMetrics",
"[",
"]",
"*",
"TaskMetric",
")",
"*",
"PublishMetricsRequest",
"{",
"return",
"&",
"PublishMetricsRequest",
"{",
"Metadata",
":",
"<mask>",
",",
"TaskMetrics",
":",
"taskMetrics",
",",
"Timestamp",
":",
"aws",
".",
"Time",
"(",
"time",
".",
"Now",
"(",
")",
")",
",",
"}",
"\n",
"}"
] |
8,799 | all-8800 | [
"MarshalJSON",
"supports",
"json",
".",
"Marshaler",
"interface"
] | [
"func",
"(",
"v",
"ResetPageScaleFactorParams",
")",
"MarshalJSON",
"(",
")",
"(",
"[",
"]",
"<mask>",
",",
"error",
")",
"{",
"w",
":=",
"jwriter",
".",
"Writer",
"{",
"}",
"\n",
"easyjsonC5a4559bEncodeGithubComChromedpCdprotoEmulation16",
"(",
"&",
"w",
",",
"v",
")",
"\n",
"return",
"w",
".",
"Buffer",
".",
"BuildBytes",
"(",
")",
",",
"w",
".",
"Error",
"\n",
"}"
] |
Subsets and Splits
No saved queries yet
Save your SQL queries to embed, download, and access them later. Queries will appear here once saved.