id
int32 0
25.3k
| idx
stringlengths 5
9
| nl_tokens
sequencelengths 1
418
| pl_tokens
sequencelengths 22
4.98k
|
---|---|---|---|
24,800 | all-24801 | [
"Insert",
"adds",
"a",
"node",
"with",
"the",
"given",
"interval",
"into",
"the",
"tree",
"."
] | [
"func",
"(",
"ivt",
"*",
"IntervalTree",
")",
"Insert",
"(",
"ivl",
"Interval",
",",
"val",
"interface",
"{",
"}",
")",
"{",
"<mask>",
"y",
"*",
"intervalNode",
"\n",
"z",
":=",
"&",
"intervalNode",
"{",
"iv",
":",
"IntervalValue",
"{",
"ivl",
",",
"val",
"}",
",",
"max",
":",
"ivl",
".",
"End",
",",
"c",
":",
"red",
"}",
"\n",
"x",
":=",
"ivt",
".",
"root",
"\n",
"for",
"x",
"!=",
"nil",
"{",
"y",
"=",
"x",
"\n",
"if",
"z",
".",
"iv",
".",
"Ivl",
".",
"Begin",
".",
"Compare",
"(",
"x",
".",
"iv",
".",
"Ivl",
".",
"Begin",
")",
"<",
"0",
"{",
"x",
"=",
"x",
".",
"left",
"\n",
"}",
"else",
"{",
"x",
"=",
"x",
".",
"right",
"\n",
"}",
"\n",
"}",
"\n\n",
"z",
".",
"parent",
"=",
"y",
"\n",
"if",
"y",
"==",
"nil",
"{",
"ivt",
".",
"root",
"=",
"z",
"\n",
"}",
"else",
"{",
"if",
"z",
".",
"iv",
".",
"Ivl",
".",
"Begin",
".",
"Compare",
"(",
"y",
".",
"iv",
".",
"Ivl",
".",
"Begin",
")",
"<",
"0",
"{",
"y",
".",
"left",
"=",
"z",
"\n",
"}",
"else",
"{",
"y",
".",
"right",
"=",
"z",
"\n",
"}",
"\n",
"y",
".",
"updateMax",
"(",
")",
"\n",
"}",
"\n",
"z",
".",
"c",
"=",
"red",
"\n",
"ivt",
".",
"insertFixup",
"(",
"z",
")",
"\n",
"ivt",
".",
"count",
"++",
"\n",
"}"
] |
24,801 | all-24802 | [
"Do",
"executes",
"Page",
".",
"setBypassCSP",
"against",
"the",
"provided",
"context",
"."
] | [
"func",
"(",
"p",
"*",
"SetBypassCSPParams",
")",
"Do",
"(",
"ctx",
"context",
".",
"<mask>",
")",
"(",
"err",
"error",
")",
"{",
"return",
"cdp",
".",
"Execute",
"(",
"ctx",
",",
"CommandSetBypassCSP",
",",
"p",
",",
"nil",
")",
"\n",
"}"
] |
24,802 | all-24803 | [
"Finalize",
"ensures",
"there",
"no",
"nil",
"pointers",
"."
] | [
"func",
"(",
"c",
"*",
"AuthConfig",
")",
"Finalize",
"(",
")",
"{",
"if",
"c",
".",
"Enabled",
"==",
"nil",
"{",
"c",
".",
"Enabled",
"=",
"Bool",
"(",
"<mask>",
"||",
"StringPresent",
"(",
"c",
".",
"Username",
")",
"||",
"StringPresent",
"(",
"c",
".",
"Password",
")",
")",
"\n",
"}",
"\n",
"if",
"c",
".",
"Username",
"==",
"nil",
"{",
"c",
".",
"Username",
"=",
"String",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"if",
"c",
".",
"Password",
"==",
"nil",
"{",
"c",
".",
"Password",
"=",
"String",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"if",
"c",
".",
"Enabled",
"==",
"nil",
"{",
"c",
".",
"Enabled",
"=",
"Bool",
"(",
"*",
"c",
".",
"Username",
"!=",
"\"",
"\"",
"||",
"*",
"c",
".",
"Password",
"!=",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"}"
] |
24,803 | all-24804 | [
"AddAllImageStates",
"indicates",
"an",
"expected",
"call",
"of",
"AddAllImageStates"
] | [
"func",
"(",
"mr",
"*",
"MockImageManagerMockRecorder",
")",
"AddAllImageStates",
"(",
"arg0",
"<mask>",
"{",
"}",
")",
"*",
"gomock",
".",
"Call",
"{",
"return",
"mr",
".",
"mock",
".",
"ctrl",
".",
"RecordCallWithMethodType",
"(",
"mr",
".",
"mock",
",",
"\"",
"\"",
",",
"reflect",
".",
"TypeOf",
"(",
"(",
"*",
"MockImageManager",
")",
"(",
"nil",
")",
".",
"AddAllImageStates",
")",
",",
"arg0",
")",
"\n",
"}"
] |
24,804 | all-24805 | [
"UnmarshalEasyJSON",
"sets",
"the",
"HexColor",
"from",
"a",
"easyjson",
".",
"Lexer"
] | [
"func",
"(",
"h",
"*",
"HexColor",
")",
"UnmarshalEasyJSON",
"(",
"<mask>",
"*",
"jlexer",
".",
"Lexer",
")",
"{",
"if",
"data",
":=",
"in",
".",
"String",
"(",
")",
";",
"in",
".",
"Ok",
"(",
")",
"{",
"*",
"h",
"=",
"HexColor",
"(",
"data",
")",
"\n",
"}",
"\n",
"}"
] |
24,805 | all-24806 | [
"UnmarshalJSON",
"supports",
"json",
".",
"Unmarshaler",
"interface"
] | [
"func",
"(",
"v",
"*",
"EventRequestIntercepted",
")",
"UnmarshalJSON",
"(",
"<mask>",
"[",
"]",
"byte",
")",
"error",
"{",
"r",
":=",
"jlexer",
".",
"Lexer",
"{",
"Data",
":",
"data",
"}",
"\n",
"easyjsonC5a4559bDecodeGithubComChromedpCdprotoNetwork52",
"(",
"&",
"r",
",",
"v",
")",
"\n",
"return",
"r",
".",
"Error",
"(",
")",
"\n",
"}"
] |
24,806 | all-24807 | [
"GetVisibleSlice",
"is",
"a",
"wrapper",
"around",
"gtk_text_iter_get_visible_slice",
"()",
"."
] | [
"func",
"(",
"v",
"*",
"TextIter",
")",
"GetVisibleSlice",
"(",
"<mask>",
"*",
"TextIter",
")",
"string",
"{",
"c",
":=",
"C",
".",
"gtk_text_iter_get_visible_slice",
"(",
"v",
".",
"native",
"(",
")",
",",
"end",
".",
"native",
"(",
")",
")",
"\n",
"return",
"C",
".",
"GoString",
"(",
"(",
"*",
"C",
".",
"char",
")",
"(",
"c",
")",
")",
"\n",
"}"
] |
24,807 | all-24808 | [
"Update",
"mocks",
"base",
"method"
] | [
"func",
"(",
"m",
"*",
"MockCgroup",
")",
"Update",
"(",
"arg0",
"*",
"specs_go",
".",
"LinuxResources",
")",
"error",
"{",
"ret",
":=",
"m",
".",
"ctrl",
".",
"Call",
"(",
"m",
",",
"\"",
"\"",
",",
"arg0",
")",
"\n",
"ret0",
",",
"_",
":=",
"<mask>",
"[",
"0",
"]",
".",
"(",
"error",
")",
"\n",
"return",
"ret0",
"\n",
"}"
] |
24,808 | all-24809 | [
"Call",
".",
"MarshalAmino",
"()",
"and",
".",
"UnmarshalAmino",
"to",
"copy",
"if",
"possible",
".",
"Panics",
"if",
".",
"MarshalAmino",
"()",
"or",
".",
"UnmarshalAmino",
"()",
"return",
"an",
"error",
".",
"CONTRACT",
":",
"src",
"and",
"dst",
"are",
"of",
"equal",
"types",
"."
] | [
"func",
"callAminoCopy",
"(",
"src",
",",
"dst",
"reflect",
".",
"Value",
")",
"bool",
"{",
"if",
"src",
".",
"Type",
"(",
")",
"!=",
"dst",
".",
"Type",
"(",
")",
"{",
"panic",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"if",
"src",
".",
"Kind",
"(",
")",
"==",
"reflect",
".",
"Ptr",
"{",
"cpy",
":=",
"reflect",
".",
"New",
"(",
"src",
".",
"Type",
"(",
")",
".",
"Elem",
"(",
")",
")",
"\n",
"dst",
".",
"Set",
"(",
"cpy",
")",
"\n",
"}",
"else",
"if",
"src",
".",
"CanAddr",
"(",
")",
"{",
"if",
"!",
"dst",
".",
"CanAddr",
"(",
")",
"{",
"panic",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"src",
"=",
"src",
".",
"Addr",
"(",
")",
"\n",
"dst",
"=",
"dst",
".",
"Addr",
"(",
")",
"\n",
"}",
"else",
"{",
"return",
"false",
"\n",
"}",
"\n",
"if",
"!",
"canAminoCopy",
"(",
"src",
")",
"{",
"return",
"<mask>",
"\n",
"}",
"\n",
"cpy",
":=",
"reflect",
".",
"New",
"(",
"src",
".",
"Type",
"(",
")",
".",
"Elem",
"(",
")",
")",
"\n",
"dst",
".",
"Set",
"(",
"cpy",
")",
"\n",
"ma",
":=",
"src",
".",
"MethodByName",
"(",
"\"",
"\"",
")",
"\n",
"ua",
":=",
"dst",
".",
"MethodByName",
"(",
"\"",
"\"",
")",
"\n",
"outs",
":=",
"ma",
".",
"Call",
"(",
"nil",
")",
"\n",
"repr",
",",
"err",
":=",
"outs",
"[",
"0",
"]",
",",
"outs",
"[",
"1",
"]",
"\n",
"if",
"!",
"err",
".",
"IsNil",
"(",
")",
"{",
"panic",
"(",
"err",
".",
"Interface",
"(",
")",
")",
"\n",
"}",
"\n",
"outs",
"=",
"ua",
".",
"Call",
"(",
"[",
"]",
"reflect",
".",
"Value",
"{",
"repr",
"}",
")",
"\n",
"err",
"=",
"outs",
"[",
"0",
"]",
"\n",
"if",
"!",
"err",
".",
"IsNil",
"(",
")",
"{",
"panic",
"(",
"err",
".",
"Interface",
"(",
")",
")",
"\n",
"}",
"\n",
"return",
"true",
"\n",
"}"
] |
24,809 | all-24810 | [
"imageMatchesRepo",
"returns",
"true",
"iff",
"image",
".",
"Names",
"contains",
"an",
"element",
"with",
"the",
"same",
"repo",
"as",
"ref"
] | [
"func",
"imageMatchesRepo",
"(",
"image",
"*",
"storage",
".",
"Image",
",",
"ref",
"reference",
".",
"Named",
")",
"bool",
"{",
"repo",
":=",
"ref",
".",
"Name",
"(",
")",
"\n",
"for",
"_",
",",
"name",
":=",
"range",
"image",
".",
"Names",
"{",
"if",
"named",
",",
"err",
":=",
"reference",
".",
"ParseNormalizedNamed",
"(",
"<mask>",
")",
";",
"err",
"==",
"nil",
"{",
"if",
"named",
".",
"Name",
"(",
")",
"==",
"repo",
"{",
"return",
"true",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"false",
"\n",
"}"
] |
24,810 | all-24811 | [
"LoginDialog",
"creates",
"a",
"new",
"login",
"dialog",
"*",
"title",
"-",
"custom",
"dialog",
"title",
"*",
"userName",
"-",
"initial",
"username",
".",
"Maybe",
"useful",
"if",
"you",
"want",
"to",
"implement",
"a",
"feature",
"remember",
"me",
"The",
"active",
"control",
"depends",
"on",
"userName",
":",
"if",
"it",
"is",
"empty",
"then",
"the",
"cursor",
"is",
"in",
"Username",
"field",
"and",
"in",
"Password",
"field",
"otherwise",
".",
"By",
"default",
"the",
"dialog",
"is",
"closed",
"when",
"button",
"OK",
"is",
"clicked",
".",
"But",
"if",
"you",
"set",
"OnCheck",
"callback",
"the",
"dialog",
"closes",
"only",
"if",
"callback",
"returns",
"true",
"or",
"button",
"Cancel",
"is",
"clicked",
".",
"This",
"is",
"helpful",
"if",
"you",
"do",
"not",
"want",
"to",
"recreate",
"the",
"dialog",
"after",
"every",
"incorrect",
"credentials",
".",
"So",
"you",
"define",
"a",
"callback",
"that",
"checks",
"whether",
"pair",
"of",
"Usename",
"and",
"Password",
"is",
"correct",
"and",
"then",
"the",
"button",
"OK",
"closed",
"the",
"dialog",
"only",
"if",
"the",
"callback",
"returns",
"true",
".",
"If",
"the",
"credentials",
"are",
"not",
"valid",
"then",
"the",
"dialog",
"shows",
"a",
"warning",
".",
"The",
"warning",
"automatically",
"disappears",
"when",
"a",
"user",
"starts",
"typing",
"in",
"Password",
"or",
"Username",
"field",
"."
] | [
"func",
"CreateLoginDialog",
"(",
"title",
",",
"userName",
"string",
")",
"*",
"LoginDialog",
"{",
"dlg",
":=",
"new",
"(",
"LoginDialog",
")",
"\n\n",
"dlg",
".",
"View",
"=",
"AddWindow",
"(",
"15",
",",
"8",
",",
"10",
",",
"4",
",",
"title",
")",
"\n",
"WindowManager",
"(",
")",
".",
"BeginUpdate",
"(",
")",
"\n",
"defer",
"WindowManager",
"(",
")",
".",
"EndUpdate",
"(",
")",
"\n\n",
"dlg",
".",
"View",
".",
"SetModal",
"(",
"true",
")",
"\n",
"dlg",
".",
"View",
".",
"SetPack",
"(",
"Vertical",
")",
"\n\n",
"userfrm",
":=",
"CreateFrame",
"(",
"dlg",
".",
"<mask>",
",",
"1",
",",
"1",
",",
"BorderNone",
",",
"Fixed",
")",
"\n",
"userfrm",
".",
"SetPaddings",
"(",
"1",
",",
"1",
")",
"\n",
"userfrm",
".",
"SetPack",
"(",
"Horizontal",
")",
"\n",
"userfrm",
".",
"SetGaps",
"(",
"1",
",",
"0",
")",
"\n",
"CreateLabel",
"(",
"userfrm",
",",
"AutoSize",
",",
"AutoSize",
",",
"\"",
"\"",
",",
"Fixed",
")",
"\n",
"edUser",
":=",
"CreateEditField",
"(",
"userfrm",
",",
"20",
",",
"userName",
",",
"1",
")",
"\n\n",
"passfrm",
":=",
"CreateFrame",
"(",
"dlg",
".",
"View",
",",
"1",
",",
"1",
",",
"BorderNone",
",",
"1",
")",
"\n",
"passfrm",
".",
"SetPaddings",
"(",
"1",
",",
"1",
")",
"\n",
"passfrm",
".",
"SetPack",
"(",
"Horizontal",
")",
"\n",
"passfrm",
".",
"SetGaps",
"(",
"1",
",",
"0",
")",
"\n",
"CreateLabel",
"(",
"passfrm",
",",
"AutoSize",
",",
"AutoSize",
",",
"\"",
"\"",
",",
"Fixed",
")",
"\n",
"edPass",
":=",
"CreateEditField",
"(",
"passfrm",
",",
"20",
",",
"\"",
"\"",
",",
"1",
")",
"\n",
"edPass",
".",
"SetPasswordMode",
"(",
"true",
")",
"\n\n",
"filler",
":=",
"CreateFrame",
"(",
"dlg",
".",
"View",
",",
"1",
",",
"1",
",",
"BorderNone",
",",
"1",
")",
"\n",
"filler",
".",
"SetPack",
"(",
"Horizontal",
")",
"\n",
"lbRes",
":=",
"CreateLabel",
"(",
"filler",
",",
"AutoSize",
",",
"AutoSize",
",",
"\"",
"\"",
",",
"1",
")",
"\n\n",
"blist",
":=",
"CreateFrame",
"(",
"dlg",
".",
"View",
",",
"1",
",",
"1",
",",
"BorderNone",
",",
"Fixed",
")",
"\n",
"blist",
".",
"SetPack",
"(",
"Horizontal",
")",
"\n",
"blist",
".",
"SetPaddings",
"(",
"1",
",",
"1",
")",
"\n",
"btnOk",
":=",
"CreateButton",
"(",
"blist",
",",
"10",
",",
"4",
",",
"\"",
"\"",
",",
"Fixed",
")",
"\n",
"btnCancel",
":=",
"CreateButton",
"(",
"blist",
",",
"10",
",",
"4",
",",
"\"",
"\"",
",",
"Fixed",
")",
"\n\n",
"btnCancel",
".",
"OnClick",
"(",
"func",
"(",
"ev",
"Event",
")",
"{",
"WindowManager",
"(",
")",
".",
"DestroyWindow",
"(",
"dlg",
".",
"View",
")",
"\n",
"WindowManager",
"(",
")",
".",
"BeginUpdate",
"(",
")",
"\n",
"dlg",
".",
"Action",
"=",
"LoginCanceled",
"\n",
"closeFunc",
":=",
"dlg",
".",
"onClose",
"\n",
"WindowManager",
"(",
")",
".",
"EndUpdate",
"(",
")",
"\n",
"if",
"closeFunc",
"!=",
"nil",
"{",
"closeFunc",
"(",
")",
"\n",
"}",
"\n",
"}",
")",
"\n\n",
"btnOk",
".",
"OnClick",
"(",
"func",
"(",
"ev",
"Event",
")",
"{",
"if",
"dlg",
".",
"onCheck",
"!=",
"nil",
"&&",
"!",
"dlg",
".",
"onCheck",
"(",
"edUser",
".",
"Title",
"(",
")",
",",
"edPass",
".",
"Title",
"(",
")",
")",
"{",
"lbRes",
".",
"SetTitle",
"(",
"\"",
"\"",
")",
"\n",
"dlg",
".",
"Action",
"=",
"LoginInvalid",
"\n",
"return",
"\n",
"}",
"\n\n",
"dlg",
".",
"Action",
"=",
"LoginOk",
"\n",
"if",
"dlg",
".",
"onCheck",
"==",
"nil",
"{",
"dlg",
".",
"Username",
"=",
"edUser",
".",
"Title",
"(",
")",
"\n",
"dlg",
".",
"Password",
"=",
"edPass",
".",
"Title",
"(",
")",
"\n",
"}",
"\n\n",
"WindowManager",
"(",
")",
".",
"DestroyWindow",
"(",
"dlg",
".",
"View",
")",
"\n",
"WindowManager",
"(",
")",
".",
"BeginUpdate",
"(",
")",
"\n\n",
"closeFunc",
":=",
"dlg",
".",
"onClose",
"\n",
"WindowManager",
"(",
")",
".",
"EndUpdate",
"(",
")",
"\n",
"if",
"closeFunc",
"!=",
"nil",
"{",
"closeFunc",
"(",
")",
"\n",
"}",
"\n",
"}",
")",
"\n\n",
"dlg",
".",
"View",
".",
"OnClose",
"(",
"func",
"(",
"ev",
"Event",
")",
"bool",
"{",
"if",
"dlg",
".",
"result",
"==",
"DialogAlive",
"{",
"dlg",
".",
"result",
"=",
"DialogClosed",
"\n",
"if",
"ev",
".",
"X",
"!=",
"1",
"{",
"WindowManager",
"(",
")",
".",
"DestroyWindow",
"(",
"dlg",
".",
"View",
")",
"\n",
"}",
"\n",
"if",
"dlg",
".",
"onClose",
"!=",
"nil",
"{",
"dlg",
".",
"onClose",
"(",
")",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"true",
"\n",
"}",
")",
"\n\n",
"edUser",
".",
"OnChange",
"(",
"func",
"(",
"ev",
"Event",
")",
"{",
"lbRes",
".",
"SetTitle",
"(",
"\"",
"\"",
")",
"\n",
"}",
")",
"\n",
"edPass",
".",
"OnChange",
"(",
"func",
"(",
"ev",
"Event",
")",
"{",
"lbRes",
".",
"SetTitle",
"(",
"\"",
"\"",
")",
"\n",
"}",
")",
"\n\n",
"if",
"userName",
"==",
"\"",
"\"",
"{",
"ActivateControl",
"(",
"dlg",
".",
"View",
",",
"edUser",
")",
"\n",
"}",
"else",
"{",
"ActivateControl",
"(",
"dlg",
".",
"View",
",",
"edPass",
")",
"\n",
"}",
"\n",
"return",
"dlg",
"\n",
"}"
] |
24,811 | all-24812 | [
"Copy",
"returns",
"a",
"deep",
"copy",
"of",
"this",
"configuration",
"."
] | [
"func",
"(",
"c",
"*",
"WaitConfig",
")",
"Copy",
"(",
")",
"*",
"WaitConfig",
"{",
"if",
"c",
"==",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n\n",
"<mask>",
"o",
"WaitConfig",
"\n",
"o",
".",
"Enabled",
"=",
"c",
".",
"Enabled",
"\n",
"o",
".",
"Min",
"=",
"c",
".",
"Min",
"\n",
"o",
".",
"Max",
"=",
"c",
".",
"Max",
"\n",
"return",
"&",
"o",
"\n",
"}"
] |
24,812 | all-24813 | [
"SetTaskTimestamps",
"adds",
"the",
"timestamp",
"information",
"of",
"task",
"into",
"the",
"event",
"to",
"be",
"sent",
"by",
"SubmitTaskStateChange"
] | [
"func",
"(",
"change",
"*",
"TaskStateChange",
")",
"SetTaskTimestamps",
"(",
")",
"{",
"if",
"change",
".",
"Task",
"==",
"nil",
"{",
"return",
"\n",
"}",
"\n\n",
"// Send the task timestamp if set",
"if",
"timestamp",
":=",
"change",
".",
"Task",
".",
"GetPullStartedAt",
"(",
")",
";",
"!",
"timestamp",
".",
"IsZero",
"(",
")",
"{",
"change",
".",
"PullStartedAt",
"=",
"aws",
".",
"Time",
"(",
"timestamp",
".",
"UTC",
"(",
")",
")",
"\n",
"}",
"\n",
"if",
"timestamp",
":=",
"change",
".",
"Task",
".",
"GetPullStoppedAt",
"(",
")",
";",
"!",
"timestamp",
".",
"IsZero",
"(",
")",
"{",
"change",
".",
"PullStoppedAt",
"=",
"aws",
".",
"Time",
"(",
"timestamp",
".",
"UTC",
"(",
")",
")",
"\n",
"}",
"\n",
"if",
"timestamp",
":=",
"<mask>",
".",
"Task",
".",
"GetExecutionStoppedAt",
"(",
")",
";",
"!",
"timestamp",
".",
"IsZero",
"(",
")",
"{",
"change",
".",
"ExecutionStoppedAt",
"=",
"aws",
".",
"Time",
"(",
"timestamp",
".",
"UTC",
"(",
")",
")",
"\n",
"}",
"\n",
"}"
] |
24,813 | all-24814 | [
"GetResults",
"retrieves",
"the",
"Results",
"value",
"from",
"the",
"union",
"returning",
"ok",
"if",
"the",
"union",
"s",
"switch",
"indicated",
"the",
"value",
"is",
"valid",
"."
] | [
"func",
"(",
"u",
"TransactionResultResult",
")",
"GetResults",
"(",
")",
"(",
"<mask>",
"[",
"]",
"OperationResult",
",",
"ok",
"bool",
")",
"{",
"armName",
",",
"_",
":=",
"u",
".",
"ArmForSwitch",
"(",
"int32",
"(",
"u",
".",
"Code",
")",
")",
"\n\n",
"if",
"armName",
"==",
"\"",
"\"",
"{",
"result",
"=",
"*",
"u",
".",
"Results",
"\n",
"ok",
"=",
"true",
"\n",
"}",
"\n\n",
"return",
"\n",
"}"
] |
24,814 | all-24815 | [
"PutBlob",
"writes",
"contents",
"of",
"stream",
"and",
"returns",
"data",
"representing",
"the",
"result",
".",
"inputInfo",
".",
"Digest",
"can",
"be",
"optionally",
"provided",
"if",
"known",
";",
"it",
"is",
"not",
"mandatory",
"for",
"the",
"implementation",
"to",
"verify",
"it",
".",
"inputInfo",
".",
"Size",
"is",
"the",
"expected",
"length",
"of",
"stream",
"if",
"known",
".",
"inputInfo",
".",
"MediaType",
"describes",
"the",
"blob",
"format",
"if",
"known",
".",
"May",
"update",
"cache",
".",
"WARNING",
":",
"The",
"contents",
"of",
"stream",
"are",
"being",
"verified",
"on",
"the",
"fly",
".",
"Until",
"stream",
".",
"Read",
"()",
"returns",
"io",
".",
"EOF",
"the",
"contents",
"of",
"the",
"data",
"SHOULD",
"NOT",
"be",
"available",
"to",
"any",
"other",
"readers",
"for",
"download",
"using",
"the",
"supplied",
"digest",
".",
"If",
"stream",
".",
"Read",
"()",
"at",
"any",
"time",
"ESPECIALLY",
"at",
"end",
"of",
"input",
"returns",
"an",
"error",
"PutBlob",
"MUST",
"1",
")",
"fail",
"and",
"2",
")",
"delete",
"any",
"data",
"stored",
"so",
"far",
"."
] | [
"func",
"(",
"d",
"*",
"ociImageDestination",
")",
"PutBlob",
"(",
"ctx",
"context",
".",
"Context",
",",
"stream",
"io",
".",
"Reader",
",",
"inputInfo",
"types",
".",
"BlobInfo",
",",
"<mask>",
"types",
".",
"BlobInfoCache",
",",
"isConfig",
"bool",
")",
"(",
"types",
".",
"BlobInfo",
",",
"error",
")",
"{",
"blobFile",
",",
"err",
":=",
"ioutil",
".",
"TempFile",
"(",
"d",
".",
"ref",
".",
"dir",
",",
"\"",
"\"",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"types",
".",
"BlobInfo",
"{",
"}",
",",
"err",
"\n",
"}",
"\n",
"succeeded",
":=",
"false",
"\n",
"explicitClosed",
":=",
"false",
"\n",
"defer",
"func",
"(",
")",
"{",
"if",
"!",
"explicitClosed",
"{",
"blobFile",
".",
"Close",
"(",
")",
"\n",
"}",
"\n",
"if",
"!",
"succeeded",
"{",
"os",
".",
"Remove",
"(",
"blobFile",
".",
"Name",
"(",
")",
")",
"\n",
"}",
"\n",
"}",
"(",
")",
"\n\n",
"digester",
":=",
"digest",
".",
"Canonical",
".",
"Digester",
"(",
")",
"\n",
"tee",
":=",
"io",
".",
"TeeReader",
"(",
"stream",
",",
"digester",
".",
"Hash",
"(",
")",
")",
"\n\n",
"// TODO: This can take quite some time, and should ideally be cancellable using ctx.Done().",
"size",
",",
"err",
":=",
"io",
".",
"Copy",
"(",
"blobFile",
",",
"tee",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"types",
".",
"BlobInfo",
"{",
"}",
",",
"err",
"\n",
"}",
"\n",
"computedDigest",
":=",
"digester",
".",
"Digest",
"(",
")",
"\n",
"if",
"inputInfo",
".",
"Size",
"!=",
"-",
"1",
"&&",
"size",
"!=",
"inputInfo",
".",
"Size",
"{",
"return",
"types",
".",
"BlobInfo",
"{",
"}",
",",
"errors",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"computedDigest",
",",
"inputInfo",
".",
"Size",
",",
"size",
")",
"\n",
"}",
"\n",
"if",
"err",
":=",
"blobFile",
".",
"Sync",
"(",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"types",
".",
"BlobInfo",
"{",
"}",
",",
"err",
"\n",
"}",
"\n\n",
"// On POSIX systems, blobFile was created with mode 0600, so we need to make it readable.",
"// On Windows, the “permissions of newly created files” argument to syscall.Open is",
"// ignored and the file is already readable; besides, blobFile.Chmod, i.e. syscall.Fchmod,",
"// always fails on Windows.",
"if",
"runtime",
".",
"GOOS",
"!=",
"\"",
"\"",
"{",
"if",
"err",
":=",
"blobFile",
".",
"Chmod",
"(",
"0644",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"types",
".",
"BlobInfo",
"{",
"}",
",",
"err",
"\n",
"}",
"\n",
"}",
"\n\n",
"blobPath",
",",
"err",
":=",
"d",
".",
"ref",
".",
"blobPath",
"(",
"computedDigest",
",",
"d",
".",
"sharedBlobDir",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"types",
".",
"BlobInfo",
"{",
"}",
",",
"err",
"\n",
"}",
"\n",
"if",
"err",
":=",
"ensureParentDirectoryExists",
"(",
"blobPath",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"types",
".",
"BlobInfo",
"{",
"}",
",",
"err",
"\n",
"}",
"\n\n",
"// need to explicitly close the file, since a rename won't otherwise not work on Windows",
"blobFile",
".",
"Close",
"(",
")",
"\n",
"explicitClosed",
"=",
"true",
"\n",
"if",
"err",
":=",
"os",
".",
"Rename",
"(",
"blobFile",
".",
"Name",
"(",
")",
",",
"blobPath",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"types",
".",
"BlobInfo",
"{",
"}",
",",
"err",
"\n",
"}",
"\n",
"succeeded",
"=",
"true",
"\n",
"return",
"types",
".",
"BlobInfo",
"{",
"Digest",
":",
"computedDigest",
",",
"Size",
":",
"size",
"}",
",",
"nil",
"\n",
"}"
] |
24,815 | all-24816 | [
"GetMonitorStatusOk",
"returns",
"a",
"tuple",
"with",
"the",
"MonitorStatus",
"field",
"if",
"it",
"s",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"and",
"a",
"boolean",
"to",
"check",
"if",
"the",
"value",
"has",
"been",
"set",
"."
] | [
"func",
"(",
"s",
"*",
"SyntheticsTest",
")",
"GetMonitorStatusOk",
"(",
")",
"(",
"string",
",",
"bool",
")",
"{",
"if",
"s",
"==",
"nil",
"||",
"s",
".",
"MonitorStatus",
"==",
"nil",
"{",
"return",
"\"",
"\"",
",",
"false",
"\n",
"}",
"\n",
"return",
"*",
"s",
".",
"MonitorStatus",
",",
"<mask>",
"\n",
"}"
] |
24,816 | all-24817 | [
"ParseDump",
"processes",
"the",
"output",
"from",
"runtime",
".",
"Stack",
"()",
".",
"Returns",
"nil",
"*",
"Context",
"if",
"no",
"stack",
"trace",
"was",
"detected",
".",
"It",
"pipes",
"anything",
"not",
"detected",
"as",
"a",
"panic",
"stack",
"trace",
"from",
"r",
"into",
"out",
".",
"It",
"assumes",
"there",
"is",
"junk",
"before",
"the",
"actual",
"stack",
"trace",
".",
"The",
"junk",
"is",
"streamed",
"to",
"out",
".",
"If",
"guesspaths",
"is",
"false",
"no",
"guessing",
"of",
"GOROOT",
"and",
"GOPATH",
"is",
"done",
"and",
"Call",
"entites",
"do",
"not",
"have",
"LocalSrcPath",
"and",
"IsStdlib",
"filled",
"in",
"."
] | [
"func",
"ParseDump",
"(",
"r",
"io",
".",
"Reader",
",",
"<mask>",
"io",
".",
"Writer",
",",
"guesspaths",
"bool",
")",
"(",
"*",
"Context",
",",
"error",
")",
"{",
"goroutines",
",",
"err",
":=",
"parseDump",
"(",
"r",
",",
"out",
")",
"\n",
"if",
"len",
"(",
"goroutines",
")",
"==",
"0",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"c",
":=",
"&",
"Context",
"{",
"Goroutines",
":",
"goroutines",
",",
"localgoroot",
":",
"runtime",
".",
"GOROOT",
"(",
")",
",",
"localgopaths",
":",
"getGOPATHs",
"(",
")",
",",
"}",
"\n",
"nameArguments",
"(",
"goroutines",
")",
"\n",
"// Corresponding local values on the host for Context.",
"if",
"guesspaths",
"{",
"c",
".",
"findRoots",
"(",
")",
"\n",
"for",
"_",
",",
"r",
":=",
"range",
"c",
".",
"Goroutines",
"{",
"// Note that this is important to call it even if",
"// c.GOROOT == c.localgoroot.",
"r",
".",
"updateLocations",
"(",
"c",
".",
"GOROOT",
",",
"c",
".",
"localgoroot",
",",
"c",
".",
"GOPATHs",
")",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"c",
",",
"err",
"\n",
"}"
] |
24,817 | all-24818 | [
"Mount",
"mounts",
"ZFS",
"file",
"systems",
"."
] | [
"func",
"(",
"d",
"*",
"Dataset",
")",
"Mount",
"(",
"overlay",
"bool",
",",
"options",
"[",
"]",
"string",
")",
"(",
"*",
"Dataset",
",",
"error",
")",
"{",
"if",
"d",
".",
"Type",
"==",
"DatasetSnapshot",
"{",
"return",
"nil",
",",
"errors",
".",
"New",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"args",
":=",
"make",
"(",
"[",
"]",
"string",
",",
"1",
",",
"5",
")",
"\n",
"args",
"[",
"0",
"]",
"=",
"\"",
"\"",
"\n",
"if",
"overlay",
"{",
"args",
"=",
"append",
"(",
"args",
",",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"if",
"options",
"!=",
"nil",
"{",
"args",
"=",
"<mask>",
"(",
"args",
",",
"\"",
"\"",
")",
"\n",
"args",
"=",
"append",
"(",
"args",
",",
"strings",
".",
"Join",
"(",
"options",
",",
"\"",
"\"",
")",
")",
"\n",
"}",
"\n",
"args",
"=",
"append",
"(",
"args",
",",
"d",
".",
"Name",
")",
"\n",
"_",
",",
"err",
":=",
"zfs",
"(",
"args",
"...",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"return",
"GetDataset",
"(",
"d",
".",
"Name",
")",
"\n",
"}"
] |
24,818 | all-24819 | [
"attach",
"a",
"level",
"of",
"a",
"texture",
"object",
"as",
"a",
"logical",
"buffer",
"to",
"the",
"currently",
"bound",
"framebuffer",
"object"
] | [
"func",
"FramebufferTexture2D",
"(",
"target",
"uint32",
",",
"attachment",
"uint32",
",",
"textarget",
"uint32",
",",
"texture",
"uint32",
",",
"level",
"int32",
")",
"{",
"syscall",
".",
"Syscall6",
"(",
"gpFramebufferTexture2D",
",",
"5",
",",
"uintptr",
"(",
"target",
")",
",",
"uintptr",
"(",
"attachment",
")",
",",
"uintptr",
"(",
"textarget",
")",
",",
"uintptr",
"(",
"texture",
")",
",",
"uintptr",
"(",
"<mask>",
")",
",",
"0",
")",
"\n",
"}"
] |
24,819 | all-24820 | [
"GetAppPaintable",
"is",
"a",
"wrapper",
"around",
"gtk_widget_get_app_paintable",
"()",
"."
] | [
"func",
"(",
"v",
"*",
"Widget",
")",
"GetAppPaintable",
"(",
")",
"bool",
"{",
"c",
":=",
"C",
".",
"gtk_widget_get_app_paintable",
"(",
"v",
".",
"native",
"(",
")",
")",
"\n",
"<mask>",
"gobool",
"(",
"c",
")",
"\n",
"}"
] |
24,820 | all-24821 | [
"WriteToPNG",
"is",
"a",
"wrapper",
"around",
"cairo_surface_write_png",
"()",
".",
"It",
"writes",
"the",
"Cairo",
"surface",
"to",
"the",
"given",
"file",
"in",
"PNG",
"format",
"."
] | [
"func",
"(",
"v",
"*",
"Surface",
")",
"WriteToPNG",
"(",
"fileName",
"string",
")",
"error",
"{",
"cstr",
":=",
"C",
".",
"CString",
"(",
"fileName",
")",
"\n",
"defer",
"C",
".",
"free",
"(",
"unsafe",
".",
"Pointer",
"(",
"cstr",
")",
")",
"\n\n",
"<mask>",
":=",
"Status",
"(",
"C",
".",
"cairo_surface_write_to_png",
"(",
"v",
".",
"surface",
",",
"cstr",
")",
")",
"\n\n",
"if",
"status",
"!=",
"STATUS_SUCCESS",
"{",
"return",
"ErrorStatus",
"(",
"status",
")",
"\n",
"}",
"\n\n",
"return",
"nil",
"\n",
"}"
] |
24,821 | all-24822 | [
"Success",
"sets",
"response",
"Content",
"-",
"Type",
"and",
"body",
"to",
"the",
"given",
"values",
"."
] | [
"func",
"(",
"ctx",
"*",
"RequestCtx",
")",
"Success",
"(",
"contentType",
"string",
",",
"body",
"[",
"]",
"byte",
")",
"{",
"ctx",
".",
"SetContentType",
"(",
"contentType",
")",
"\n",
"ctx",
".",
"SetBody",
"(",
"<mask>",
")",
"\n",
"}"
] |
24,822 | all-24823 | [
"GetEmailOk",
"returns",
"a",
"tuple",
"with",
"the",
"Email",
"field",
"if",
"it",
"s",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"and",
"a",
"boolean",
"to",
"check",
"if",
"the",
"value",
"has",
"been",
"set",
"."
] | [
"func",
"(",
"s",
"*",
"SyntheticsUser",
")",
"GetEmailOk",
"(",
")",
"(",
"string",
",",
"bool",
")",
"{",
"if",
"s",
"==",
"nil",
"||",
"s",
".",
"Email",
"==",
"nil",
"{",
"return",
"\"",
"\"",
",",
"<mask>",
"\n",
"}",
"\n",
"return",
"*",
"s",
".",
"Email",
",",
"true",
"\n",
"}"
] |
24,823 | all-24824 | [
"User",
"sets",
"the",
"query",
"key",
"from",
"which",
"to",
"obtain",
"the",
"user",
"."
] | [
"func",
"User",
"(",
"user",
"string",
")",
"TokenOpt",
"{",
"return",
"TokenOpt",
"{",
"func",
"(",
"o",
"*",
"options",
")",
"{",
"o",
".",
"user",
"=",
"<mask>",
"\n",
"}",
"}",
"\n",
"}"
] |
24,824 | all-24825 | [
"Validate",
"options"
] | [
"func",
"(",
"opts",
"*",
"<mask>",
")",
"Validate",
"(",
")",
"error",
"{",
"if",
"opts",
".",
"App",
".",
"IsZero",
"(",
")",
"{",
"opts",
".",
"App",
"=",
"meta",
".",
"New",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
] |
24,825 | all-24826 | [
"keyRange",
"is",
"[",
"start",
"end",
")",
"including",
"start",
"excluding",
"end",
".",
"Do",
"ensure",
"that",
"the",
"start",
"end",
"byte",
"slices",
"are",
"owned",
"by",
"keyRange",
"struct",
"."
] | [
"func",
"(",
"st",
"*",
"Stream",
")",
"produceRanges",
"(",
"ctx",
"context",
".",
"Context",
")",
"{",
"splits",
":=",
"st",
".",
"db",
".",
"KeySplits",
"(",
"st",
".",
"Prefix",
")",
"\n",
"start",
":=",
"y",
".",
"SafeCopy",
"(",
"nil",
",",
"st",
".",
"Prefix",
")",
"\n",
"for",
"_",
",",
"key",
":=",
"range",
"splits",
"{",
"st",
".",
"rangeCh",
"<-",
"keyRange",
"{",
"left",
":",
"<mask>",
",",
"right",
":",
"y",
".",
"SafeCopy",
"(",
"nil",
",",
"[",
"]",
"byte",
"(",
"key",
")",
")",
"}",
"\n",
"start",
"=",
"y",
".",
"SafeCopy",
"(",
"nil",
",",
"[",
"]",
"byte",
"(",
"key",
")",
")",
"\n",
"}",
"\n",
"// Edge case: prefix is empty and no splits exist. In that case, we should have at least one",
"// keyRange output.",
"st",
".",
"rangeCh",
"<-",
"keyRange",
"{",
"left",
":",
"start",
"}",
"\n",
"close",
"(",
"st",
".",
"rangeCh",
")",
"\n",
"}"
] |
24,826 | all-24827 | [
"ApplyTagByName",
"()",
"is",
"a",
"wrapper",
"around",
"gtk_text_buffer_apply_tag_by_name",
"()",
"."
] | [
"func",
"(",
"v",
"*",
"TextBuffer",
")",
"ApplyTagByName",
"(",
"name",
"string",
",",
"start",
",",
"end",
"*",
"TextIter",
")",
"{",
"cstr",
":=",
"C",
".",
"CString",
"(",
"name",
")",
"\n",
"defer",
"C",
".",
"free",
"(",
"unsafe",
".",
"Pointer",
"(",
"cstr",
")",
")",
"\n",
"C",
".",
"gtk_text_buffer_apply_tag_by_name",
"(",
"v",
".",
"native",
"(",
")",
",",
"(",
"*",
"C",
".",
"gchar",
")",
"(",
"cstr",
")",
",",
"(",
"*",
"C",
".",
"GtkTextIter",
")",
"(",
"start",
")",
",",
"(",
"*",
"C",
".",
"GtkTextIter",
")",
"(",
"<mask>",
")",
")",
"\n",
"}"
] |
24,827 | all-24828 | [
"NewReader",
"returns",
"a",
"reader",
"for",
"a",
"blob",
".",
"It",
"always",
"succeeds",
";",
"if",
"the",
"blob",
"does",
"not",
"exist",
"then",
"an",
"error",
"will",
"be",
"reported",
"upon",
"first",
"read",
"."
] | [
"func",
"NewReader",
"(",
"c",
"context",
".",
"<mask>",
",",
"blobKey",
"appengine",
".",
"BlobKey",
")",
"Reader",
"{",
"return",
"openBlob",
"(",
"c",
",",
"blobKey",
")",
"\n",
"}"
] |
24,828 | all-24829 | [
"Add",
"adds",
"a",
"value",
"to",
"the",
"series",
"and",
"updates",
"the",
"moving",
"average",
"."
] | [
"func",
"(",
"e",
"*",
"VariableEWMA",
")",
"Add",
"(",
"value",
"float64",
")",
"{",
"switch",
"{",
"case",
"e",
".",
"count",
"<",
"WARMUP_SAMPLES",
":",
"e",
".",
"count",
"++",
"\n",
"e",
".",
"value",
"+=",
"value",
"\n",
"case",
"e",
".",
"count",
"==",
"WARMUP_SAMPLES",
":",
"e",
".",
"count",
"++",
"\n",
"e",
".",
"value",
"=",
"e",
".",
"value",
"/",
"float64",
"(",
"WARMUP_SAMPLES",
")",
"\n",
"e",
".",
"value",
"=",
"(",
"value",
"*",
"e",
".",
"decay",
")",
"+",
"(",
"e",
".",
"value",
"*",
"(",
"1",
"-",
"e",
".",
"decay",
")",
")",
"\n",
"default",
":",
"e",
".",
"value",
"=",
"(",
"value",
"*",
"e",
".",
"decay",
")",
"+",
"(",
"e",
".",
"<mask>",
"*",
"(",
"1",
"-",
"e",
".",
"decay",
")",
")",
"\n",
"}",
"\n",
"}"
] |
24,829 | all-24830 | [
"GetUser",
"gets",
"the",
"user",
"associated",
"with",
"the",
"authentication"
] | [
"func",
"(",
"c",
"Client",
")",
"GetUser",
"(",
")",
"(",
"*",
"<mask>",
",",
"error",
")",
"{",
"holder",
":=",
"usersHolder",
"{",
"}",
"\n",
"if",
"err",
":=",
"c",
".",
"Get",
"(",
"\"",
"\"",
",",
"nil",
",",
"&",
"holder",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"return",
"&",
"holder",
".",
"Users",
"[",
"0",
"]",
".",
"User",
",",
"nil",
"\n",
"}"
] |
24,830 | all-24831 | [
"MakeCommand",
"returns",
"an",
"aggregate",
"command",
"."
] | [
"func",
"MakeCommand",
"(",
")",
"*",
"cobra",
".",
"Command",
"{",
"<mask>",
":=",
"&",
"flags",
"{",
"}",
"\n",
"cmd",
":=",
"&",
"cobra",
".",
"Command",
"{",
"Use",
":",
"\"",
"\"",
",",
"Short",
":",
"\"",
"\"",
",",
"Long",
":",
"`Given multiple Go coverage files from identical binaries recorded in\n\"count\" or \"atomic\" mode, produces a new Go coverage file in the same mode\nthat counts how many of those coverage profiles hit a block at least once.`",
",",
"Run",
":",
"func",
"(",
"cmd",
"*",
"cobra",
".",
"Command",
",",
"args",
"[",
"]",
"string",
")",
"{",
"run",
"(",
"flags",
",",
"cmd",
",",
"args",
")",
"\n",
"}",
",",
"}",
"\n",
"cmd",
".",
"Flags",
"(",
")",
".",
"StringVarP",
"(",
"&",
"flags",
".",
"OutputFile",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
")",
"\n",
"return",
"cmd",
"\n",
"}"
] |
24,831 | all-24832 | [
"Stroke",
"strokes",
"the",
"paths",
"with",
"the",
"color",
"specified",
"by",
"SetStrokeColor"
] | [
"func",
"(",
"gc",
"*",
"GraphicContext",
")",
"Stroke",
"(",
"paths",
"...",
"*",
"draw2d",
".",
"Path",
")",
"{",
"_",
",",
"_",
",",
"_",
",",
"alphaS",
":=",
"gc",
".",
"Current",
".",
"StrokeColor",
".",
"RGBA",
"(",
")",
"\n",
"gc",
".",
"<mask>",
"(",
"\"",
"\"",
",",
"alphaS",
",",
"paths",
"...",
")",
"\n",
"gc",
".",
"Current",
".",
"Path",
".",
"Clear",
"(",
")",
"\n",
"}"
] |
24,832 | all-24833 | [
"SetTitle",
"changes",
"the",
"EditField",
"content",
"and",
"emits",
"OnChage",
"eventif",
"the",
"new",
"value",
"does",
"not",
"equal",
"to",
"old",
"one"
] | [
"func",
"(",
"e",
"*",
"EditField",
")",
"SetTitle",
"(",
"<mask>",
"string",
")",
"{",
"e",
".",
"setTitleInternal",
"(",
"title",
")",
"\n",
"e",
".",
"offset",
"=",
"0",
"\n",
"e",
".",
"end",
"(",
")",
"\n",
"}"
] |
24,833 | all-24834 | [
"Create",
"a",
"dial",
"function",
"that",
"connects",
"to",
"the",
"given",
"listener",
"."
] | [
"func",
"dqliteMemoryDial",
"(",
"listener",
"net",
".",
"Listener",
")",
"dqlite",
".",
"DialFunc",
"{",
"return",
"func",
"(",
"ctx",
"context",
".",
"Context",
",",
"address",
"string",
")",
"(",
"<mask>",
".",
"Conn",
",",
"error",
")",
"{",
"return",
"net",
".",
"Dial",
"(",
"\"",
"\"",
",",
"listener",
".",
"Addr",
"(",
")",
".",
"String",
"(",
")",
")",
"\n",
"}",
"\n",
"}"
] |
24,834 | all-24835 | [
"GetState",
"returns",
"a",
"docker",
".",
"hosts",
".",
"state",
".",
"State",
"value",
"representing",
"the",
"current",
"state",
"of",
"the",
"host",
"."
] | [
"func",
"(",
"d",
"*",
"Driver",
")",
"GetState",
"(",
")",
"(",
"state",
".",
"State",
",",
"error",
")",
"{",
"c",
",",
"err",
":=",
"newComputeUtil",
"(",
"d",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"state",
".",
"None",
",",
"err",
"\n",
"}",
"\n\n",
"// All we care about is whether the disk exists, so we just check disk for a nil value.",
"// There will be no error if disk is not nil.",
"instance",
",",
"_",
":=",
"c",
".",
"instance",
"(",
")",
"\n",
"if",
"instance",
"==",
"nil",
"{",
"disk",
",",
"_",
":=",
"c",
".",
"disk",
"(",
")",
"\n",
"if",
"disk",
"==",
"nil",
"{",
"return",
"state",
".",
"None",
",",
"nil",
"\n",
"}",
"\n",
"return",
"state",
".",
"Stopped",
",",
"nil",
"\n",
"}",
"\n\n",
"switch",
"<mask>",
".",
"Status",
"{",
"case",
"\"",
"\"",
",",
"\"",
"\"",
":",
"return",
"state",
".",
"Starting",
",",
"nil",
"\n",
"case",
"\"",
"\"",
":",
"return",
"state",
".",
"Running",
",",
"nil",
"\n",
"case",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
":",
"return",
"state",
".",
"Stopped",
",",
"nil",
"\n",
"}",
"\n",
"return",
"state",
".",
"None",
",",
"nil",
"\n",
"}"
] |
24,835 | all-24836 | [
"NewAgent",
"bootstraps",
"a",
"new",
"config",
".",
"Agent",
"struct",
"from",
"the",
"passed",
"dependencies",
"."
] | [
"func",
"NewAgent",
"(",
"configAgent",
"*",
"config",
".",
"<mask>",
",",
"pluginConfigAgent",
"*",
"ConfigAgent",
",",
"clientAgent",
"*",
"ClientAgent",
",",
"logger",
"*",
"logrus",
".",
"Entry",
")",
"Agent",
"{",
"prowConfig",
":=",
"configAgent",
".",
"Config",
"(",
")",
"\n",
"pluginConfig",
":=",
"pluginConfigAgent",
".",
"Config",
"(",
")",
"\n",
"return",
"Agent",
"{",
"GitHubClient",
":",
"clientAgent",
".",
"GitHubClient",
",",
"KubernetesClient",
":",
"clientAgent",
".",
"KubernetesClient",
",",
"ProwJobClient",
":",
"clientAgent",
".",
"ProwJobClient",
",",
"GitClient",
":",
"clientAgent",
".",
"GitClient",
",",
"SlackClient",
":",
"clientAgent",
".",
"SlackClient",
",",
"OwnersClient",
":",
"clientAgent",
".",
"OwnersClient",
",",
"Config",
":",
"prowConfig",
",",
"PluginConfig",
":",
"pluginConfig",
",",
"Logger",
":",
"logger",
",",
"}",
"\n",
"}"
] |
24,836 | all-24837 | [
"NewBackoff",
"creates",
"a",
"new",
"Backoff",
"using",
"the",
"specified",
"BackoffStrategy",
"start",
"duration",
"and",
"limit",
"."
] | [
"func",
"NewBackoff",
"(",
"strategy",
"BackoffStrategy",
",",
"start",
"time",
".",
"Duration",
",",
"limit",
"time",
".",
"Duration",
")",
"*",
"Backoff",
"{",
"backoff",
":=",
"Backoff",
"{",
"strategy",
":",
"strategy",
",",
"start",
":",
"start",
",",
"limit",
":",
"<mask>",
"}",
"\n",
"backoff",
".",
"Reset",
"(",
")",
"\n",
"return",
"&",
"backoff",
"\n",
"}"
] |
24,837 | all-24838 | [
"Do",
"executes",
"ServiceWorker",
".",
"dispatchSyncEvent",
"against",
"the",
"provided",
"context",
"."
] | [
"func",
"(",
"p",
"*",
"DispatchSyncEventParams",
")",
"Do",
"(",
"ctx",
"<mask>",
".",
"Context",
")",
"(",
"err",
"error",
")",
"{",
"return",
"cdp",
".",
"Execute",
"(",
"ctx",
",",
"CommandDispatchSyncEvent",
",",
"p",
",",
"nil",
")",
"\n",
"}"
] |
24,838 | all-24839 | [
"MarshalJSON",
"supports",
"json",
".",
"Marshaler",
"interface"
] | [
"func",
"(",
"v",
"GetFullAXTreeReturns",
")",
"MarshalJSON",
"(",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"w",
":=",
"jwriter",
".",
"<mask>",
"{",
"}",
"\n",
"easyjsonC5a4559bEncodeGithubComChromedpCdprotoAccessibility7",
"(",
"&",
"w",
",",
"v",
")",
"\n",
"return",
"w",
".",
"Buffer",
".",
"BuildBytes",
"(",
")",
",",
"w",
".",
"Error",
"\n",
"}"
] |
24,839 | all-24840 | [
"HasType",
"returns",
"a",
"boolean",
"if",
"a",
"field",
"has",
"been",
"set",
"."
] | [
"func",
"(",
"g",
"*",
"GraphDefinitionRequest",
")",
"HasType",
"(",
")",
"bool",
"{",
"if",
"g",
"!=",
"nil",
"&&",
"g",
".",
"<mask>",
"!=",
"nil",
"{",
"return",
"true",
"\n",
"}",
"\n\n",
"return",
"false",
"\n",
"}"
] |
24,840 | all-24841 | [
"OptClientTotalPoolSize",
"is",
"the",
"maximum",
"number",
"of",
"connections",
"in",
"the",
"pool",
"."
] | [
"func",
"OptClientTotalPoolSize",
"(",
"<mask>",
"int",
")",
"ClientOption",
"{",
"return",
"func",
"(",
"options",
"*",
"ClientOptions",
")",
"error",
"{",
"options",
".",
"TotalPoolSize",
"=",
"size",
"\n",
"return",
"nil",
"\n",
"}",
"\n",
"}"
] |
24,841 | all-24842 | [
"TODO",
":",
"Should",
"map",
"[",
"string",
"]",
"and",
"struct",
"allow",
"direct",
"method",
"calls?",
"Check",
"if",
"first",
"letter",
"is",
"uppercase?"
] | [
"func",
"map__index",
"(",
"L",
"*",
"lua",
".",
"State",
")",
"int",
"{",
"v",
",",
"t",
":=",
"valueOfProxy",
"(",
"L",
",",
"1",
")",
"\n",
"key",
":=",
"reflect",
".",
"New",
"(",
"t",
".",
"Key",
"(",
")",
")",
"\n",
"err",
":=",
"LuaToGo",
"(",
"L",
",",
"2",
",",
"key",
".",
"Interface",
"(",
")",
")",
"\n",
"if",
"err",
"==",
"nil",
"{",
"key",
"=",
"key",
".",
"Elem",
"(",
")",
"\n",
"val",
":=",
"v",
".",
"MapIndex",
"(",
"key",
")",
"\n",
"if",
"val",
".",
"IsValid",
"(",
")",
"{",
"GoToLuaProxy",
"(",
"L",
",",
"val",
")",
"\n",
"return",
"1",
"\n",
"}",
"\n",
"}",
"\n",
"if",
"!",
"L",
".",
"IsNumber",
"(",
"2",
")",
"&&",
"L",
".",
"IsString",
"(",
"2",
")",
"{",
"name",
":=",
"L",
".",
"ToString",
"(",
"2",
")",
"\n",
"pushGoMethod",
"(",
"L",
",",
"name",
",",
"v",
")",
"\n",
"return",
"1",
"\n",
"}",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"L",
".",
"RaiseError",
"(",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"t",
".",
"<mask>",
"(",
")",
")",
")",
"\n",
"}",
"\n",
"return",
"0",
"\n",
"}"
] |
24,842 | all-24843 | [
"Merge",
"combines",
"all",
"values",
"in",
"this",
"configuration",
"with",
"the",
"values",
"in",
"the",
"other",
"configuration",
"with",
"values",
"in",
"the",
"other",
"configuration",
"taking",
"precedence",
".",
"Maps",
"and",
"slices",
"are",
"merged",
"most",
"other",
"values",
"are",
"overwritten",
".",
"Complex",
"structs",
"define",
"their",
"own",
"merge",
"functionality",
"."
] | [
"func",
"(",
"c",
"*",
"EnvConfig",
")",
"Merge",
"(",
"o",
"*",
"EnvConfig",
")",
"*",
"EnvConfig",
"{",
"if",
"c",
"==",
"nil",
"{",
"if",
"o",
"==",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n",
"return",
"o",
".",
"Copy",
"(",
")",
"\n",
"}",
"\n\n",
"if",
"o",
"==",
"nil",
"{",
"return",
"c",
".",
"Copy",
"(",
")",
"\n",
"}",
"\n\n",
"r",
":=",
"c",
".",
"Copy",
"(",
")",
"\n\n",
"if",
"o",
".",
"Blacklist",
"!=",
"nil",
"{",
"r",
".",
"Blacklist",
"=",
"append",
"(",
"r",
".",
"Blacklist",
",",
"o",
".",
"Blacklist",
"...",
")",
"\n",
"}",
"\n\n",
"if",
"o",
".",
"Custom",
"!=",
"nil",
"{",
"r",
".",
"Custom",
"=",
"<mask>",
"(",
"r",
".",
"Custom",
",",
"o",
".",
"Custom",
"...",
")",
"\n",
"}",
"\n\n",
"if",
"o",
".",
"Pristine",
"!=",
"nil",
"{",
"r",
".",
"Pristine",
"=",
"o",
".",
"Pristine",
"\n",
"}",
"\n\n",
"if",
"o",
".",
"Whitelist",
"!=",
"nil",
"{",
"r",
".",
"Whitelist",
"=",
"append",
"(",
"r",
".",
"Whitelist",
",",
"o",
".",
"Whitelist",
"...",
")",
"\n",
"}",
"\n\n",
"return",
"r",
"\n",
"}"
] |
24,843 | all-24844 | [
"sessionFile",
"is",
"a",
"helper",
"that",
"generates",
"a",
"unique",
"hash",
"of",
"the",
"client",
"s",
"URL",
"to",
"use",
"as",
"the",
"session",
"file",
"name",
".",
"This",
"is",
"the",
"same",
"logic",
"used",
"as",
"part",
"of",
"govmomi",
"and",
"is",
"designed",
"to",
"be",
"consistent",
"so",
"that",
"sessions",
"can",
"be",
"shared",
"if",
"possible",
"between",
"both",
"tools",
"."
] | [
"func",
"(",
"c",
"*",
"Config",
")",
"sessionFile",
"(",
")",
"(",
"string",
",",
"error",
")",
"{",
"u",
",",
"err",
":=",
"c",
".",
"vimURLWithoutPassword",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"\"",
"\"",
",",
"err",
"\n",
"}",
"\n\n",
"// Key session file off of full URI and insecure setting.",
"// Hash key to get a predictable, canonical format.",
"<mask>",
":=",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"u",
".",
"String",
"(",
")",
",",
"c",
".",
"InsecureFlag",
")",
"\n",
"name",
":=",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"sha1",
".",
"Sum",
"(",
"[",
"]",
"byte",
"(",
"key",
")",
")",
")",
"\n",
"return",
"name",
",",
"nil",
"\n",
"}"
] |
24,844 | all-24845 | [
"copy",
"a",
"block",
"of",
"pixels",
"from",
"one",
"framebuffer",
"object",
"to",
"another"
] | [
"func",
"BlitNamedFramebuffer",
"(",
"readFramebuffer",
"uint32",
",",
"drawFramebuffer",
"uint32",
",",
"srcX0",
"int32",
",",
"srcY0",
"int32",
",",
"srcX1",
"int32",
",",
"srcY1",
"int32",
",",
"dstX0",
"int32",
",",
"dstY0",
"int32",
",",
"dstX1",
"int32",
",",
"dstY1",
"int32",
",",
"mask",
"uint32",
",",
"<mask>",
"uint32",
")",
"{",
"syscall",
".",
"Syscall12",
"(",
"gpBlitNamedFramebuffer",
",",
"12",
",",
"uintptr",
"(",
"readFramebuffer",
")",
",",
"uintptr",
"(",
"drawFramebuffer",
")",
",",
"uintptr",
"(",
"srcX0",
")",
",",
"uintptr",
"(",
"srcY0",
")",
",",
"uintptr",
"(",
"srcX1",
")",
",",
"uintptr",
"(",
"srcY1",
")",
",",
"uintptr",
"(",
"dstX0",
")",
",",
"uintptr",
"(",
"dstY0",
")",
",",
"uintptr",
"(",
"dstX1",
")",
",",
"uintptr",
"(",
"dstY1",
")",
",",
"uintptr",
"(",
"mask",
")",
",",
"uintptr",
"(",
"filter",
")",
")",
"\n",
"}"
] |
24,845 | all-24846 | [
"UnmarshalJSON",
"supports",
"json",
".",
"Unmarshaler",
"interface"
] | [
"func",
"(",
"v",
"*",
"GetContentQuadsParams",
")",
"UnmarshalJSON",
"(",
"<mask>",
"[",
"]",
"byte",
")",
"error",
"{",
"r",
":=",
"jlexer",
".",
"Lexer",
"{",
"Data",
":",
"data",
"}",
"\n",
"easyjsonC5a4559bDecodeGithubComChromedpCdprotoDom49",
"(",
"&",
"r",
",",
"v",
")",
"\n",
"return",
"r",
".",
"Error",
"(",
")",
"\n",
"}"
] |
24,846 | all-24847 | [
"Repaint",
"draws",
"the",
"control",
"on",
"its",
"View",
"surface"
] | [
"func",
"(",
"b",
"*",
"Button",
")",
"Draw",
"(",
")",
"{",
"if",
"b",
".",
"hidden",
"{",
"return",
"\n",
"}",
"\n\n",
"b",
".",
"mtx",
".",
"RLock",
"(",
")",
"\n",
"defer",
"b",
".",
"mtx",
".",
"RUnlock",
"(",
")",
"\n",
"PushAttributes",
"(",
")",
"\n",
"defer",
"PopAttributes",
"(",
")",
"\n\n",
"x",
",",
"y",
":=",
"b",
".",
"Pos",
"(",
")",
"\n",
"w",
",",
"h",
":=",
"b",
".",
"Size",
"(",
")",
"\n\n",
"fg",
",",
"bg",
":=",
"b",
".",
"fg",
",",
"b",
".",
"bg",
"\n",
"shadow",
":=",
"RealColor",
"(",
"b",
".",
"shadowColor",
",",
"b",
".",
"Style",
"(",
")",
",",
"ColorButtonShadow",
")",
"\n",
"if",
"b",
".",
"<mask>",
"{",
"fg",
",",
"bg",
"=",
"RealColor",
"(",
"fg",
",",
"b",
".",
"Style",
"(",
")",
",",
"ColorButtonDisabledText",
")",
",",
"RealColor",
"(",
"bg",
",",
"b",
".",
"Style",
"(",
")",
",",
"ColorButtonDisabledBack",
")",
"\n",
"}",
"else",
"if",
"b",
".",
"Active",
"(",
")",
"{",
"fg",
",",
"bg",
"=",
"RealColor",
"(",
"b",
".",
"fgActive",
",",
"b",
".",
"Style",
"(",
")",
",",
"ColorButtonActiveText",
")",
",",
"RealColor",
"(",
"b",
".",
"bgActive",
",",
"b",
".",
"Style",
"(",
")",
",",
"ColorButtonActiveBack",
")",
"\n",
"}",
"else",
"{",
"fg",
",",
"bg",
"=",
"RealColor",
"(",
"fg",
",",
"b",
".",
"Style",
"(",
")",
",",
"ColorButtonText",
")",
",",
"RealColor",
"(",
"bg",
",",
"b",
".",
"Style",
"(",
")",
",",
"ColorButtonBack",
")",
"\n",
"}",
"\n\n",
"dy",
":=",
"int",
"(",
"(",
"h",
"-",
"1",
")",
"/",
"2",
")",
"\n",
"SetTextColor",
"(",
"fg",
")",
"\n",
"shift",
",",
"text",
":=",
"AlignColorizedText",
"(",
"b",
".",
"title",
",",
"w",
"-",
"1",
",",
"b",
".",
"align",
")",
"\n",
"if",
"b",
".",
"isPressed",
"(",
")",
"==",
"0",
"{",
"SetBackColor",
"(",
"shadow",
")",
"\n",
"FillRect",
"(",
"x",
"+",
"1",
",",
"y",
"+",
"1",
",",
"w",
"-",
"1",
",",
"h",
"-",
"1",
",",
"' '",
")",
"\n",
"SetBackColor",
"(",
"bg",
")",
"\n",
"FillRect",
"(",
"x",
",",
"y",
",",
"w",
"-",
"1",
",",
"h",
"-",
"1",
",",
"' '",
")",
"\n",
"DrawText",
"(",
"x",
"+",
"shift",
",",
"y",
"+",
"dy",
",",
"text",
")",
"\n",
"}",
"else",
"{",
"SetBackColor",
"(",
"bg",
")",
"\n",
"FillRect",
"(",
"x",
"+",
"1",
",",
"y",
"+",
"1",
",",
"w",
"-",
"1",
",",
"h",
"-",
"1",
",",
"' '",
")",
"\n",
"DrawText",
"(",
"x",
"+",
"1",
"+",
"shift",
",",
"y",
"+",
"1",
"+",
"dy",
",",
"b",
".",
"title",
")",
"\n",
"}",
"\n",
"}"
] |
24,847 | all-24848 | [
"===",
"deriv",
"(",
"node",
"ValueTypeMatrix",
")",
"Vector",
"==="
] | [
"func",
"funcDeriv",
"(",
"vals",
"[",
"]",
"Value",
",",
"args",
"Expressions",
",",
"enh",
"*",
"EvalNodeHelper",
")",
"Vector",
"{",
"mat",
":=",
"vals",
"[",
"0",
"]",
".",
"(",
"Matrix",
")",
"\n\n",
"for",
"_",
",",
"samples",
":=",
"range",
"mat",
"{",
"// No sense in trying to compute a derivative without at least two points.",
"// Drop this Vector element.",
"if",
"len",
"(",
"samples",
".",
"Points",
")",
"<",
"2",
"{",
"continue",
"\n",
"}",
"\n\n",
"// We pass in an arbitrary timestamp that is near the values in use",
"// to avoid floating point accuracy issues, see",
"// https://github.com/prometheus/prometheus/issues/2674",
"slope",
",",
"_",
":=",
"linearRegression",
"(",
"samples",
".",
"Points",
",",
"samples",
".",
"Points",
"[",
"0",
"]",
".",
"T",
")",
"\n",
"enh",
".",
"out",
"=",
"append",
"(",
"enh",
".",
"out",
",",
"Sample",
"{",
"Point",
":",
"<mask>",
"{",
"V",
":",
"slope",
"}",
",",
"}",
")",
"\n",
"}",
"\n",
"return",
"enh",
".",
"out",
"\n",
"}"
] |
24,848 | all-24849 | [
"newImageDestination",
"creates",
"a",
"new",
"ImageDestination",
"for",
"the",
"specified",
"reference",
"."
] | [
"func",
"newImageDestination",
"(",
"ctx",
"context",
".",
"<mask>",
",",
"sys",
"*",
"types",
".",
"SystemContext",
",",
"ref",
"openshiftReference",
")",
"(",
"types",
".",
"ImageDestination",
",",
"error",
")",
"{",
"client",
",",
"err",
":=",
"newOpenshiftClient",
"(",
"ref",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"// FIXME: Should this always use a digest, not a tag? Uploading to Docker by tag requires the tag _inside_ the manifest to match,",
"// i.e. a single signed image cannot be available under multiple tags. But with types.ImageDestination, we don't know",
"// the manifest digest at this point.",
"dockerRefString",
":=",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"reference",
".",
"Domain",
"(",
"client",
".",
"ref",
".",
"dockerReference",
")",
",",
"client",
".",
"ref",
".",
"namespace",
",",
"client",
".",
"ref",
".",
"stream",
",",
"client",
".",
"ref",
".",
"dockerReference",
".",
"Tag",
"(",
")",
")",
"\n",
"dockerRef",
",",
"err",
":=",
"docker",
".",
"ParseReference",
"(",
"dockerRefString",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"docker",
",",
"err",
":=",
"dockerRef",
".",
"NewImageDestination",
"(",
"ctx",
",",
"sys",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"return",
"&",
"openshiftImageDestination",
"{",
"client",
":",
"client",
",",
"docker",
":",
"docker",
",",
"}",
",",
"nil",
"\n",
"}"
] |
24,849 | all-24850 | [
"NewMonitor",
"creates",
"new",
"instance",
"of",
"billing",
"monitor",
".",
"interval",
"specifies",
"how",
"often",
"channels",
"checks",
"must",
"be",
"performed",
"."
] | [
"func",
"NewMonitor",
"(",
"interval",
"uint64",
",",
"<mask>",
"*",
"reform",
".",
"DB",
",",
"logger",
"log",
".",
"Logger",
",",
"pr",
"*",
"proc",
".",
"Processor",
")",
"(",
"*",
"Monitor",
",",
"error",
")",
"{",
"if",
"db",
"==",
"nil",
"||",
"logger",
"==",
"nil",
"||",
"pr",
"==",
"nil",
"||",
"interval",
"==",
"0",
"{",
"return",
"nil",
",",
"ErrInput",
"\n",
"}",
"\n\n",
"return",
"&",
"Monitor",
"{",
"db",
":",
"db",
",",
"logger",
":",
"logger",
".",
"Add",
"(",
"\"",
"\"",
",",
"\"",
"\"",
")",
",",
"pr",
":",
"pr",
",",
"interval",
":",
"interval",
",",
"}",
",",
"nil",
"\n",
"}"
] |
24,850 | all-24851 | [
"Sync",
"synchronizes",
"client",
"s",
"endpoints",
"with",
"the",
"known",
"endpoints",
"from",
"the",
"etcd",
"membership",
"."
] | [
"func",
"(",
"c",
"*",
"Client",
")",
"Sync",
"(",
"ctx",
"context",
".",
"Context",
")",
"error",
"{",
"mresp",
",",
"err",
":=",
"c",
".",
"MemberList",
"(",
"ctx",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"var",
"eps",
"[",
"]",
"string",
"\n",
"for",
"_",
",",
"m",
":=",
"<mask>",
"mresp",
".",
"Members",
"{",
"eps",
"=",
"append",
"(",
"eps",
",",
"m",
".",
"ClientURLs",
"...",
")",
"\n",
"}",
"\n",
"c",
".",
"SetEndpoints",
"(",
"eps",
"...",
")",
"\n",
"return",
"nil",
"\n",
"}"
] |
24,851 | all-24852 | [
"=====",
"Actions",
"POST",
"/",
"api",
"/",
"scenarios",
"Create",
"a",
"new",
"Scenario",
"."
] | [
"func",
"(",
"loc",
"*",
"ScenarioLocator",
")",
"Create",
"(",
"snapshotTimestamp",
"*",
"time",
".",
"Time",
",",
"options",
"rsapi",
".",
"APIParams",
")",
"(",
"*",
"ScenarioLocator",
",",
"error",
")",
"{",
"var",
"res",
"*",
"ScenarioLocator",
"\n",
"var",
"params",
"rsapi",
".",
"APIParams",
"\n",
"params",
"=",
"rsapi",
".",
"APIParams",
"{",
"}",
"\n",
"var",
"viewOpt",
"=",
"options",
"[",
"\"",
"\"",
"]",
"\n",
"if",
"viewOpt",
"!=",
"nil",
"{",
"params",
"[",
"\"",
"\"",
"]",
"=",
"viewOpt",
"\n",
"}",
"\n",
"var",
"p",
"rsapi",
".",
"APIParams",
"\n",
"p",
"=",
"rsapi",
".",
"APIParams",
"{",
"\"",
"\"",
":",
"snapshotTimestamp",
",",
"}",
"\n",
"var",
"filtersOpt",
"=",
"options",
"[",
"\"",
"\"",
"]",
"\n",
"if",
"filtersOpt",
"!=",
"nil",
"{",
"p",
"[",
"\"",
"\"",
"]",
"=",
"filtersOpt",
"\n",
"}",
"\n",
"var",
"isBlankOpt",
"=",
"options",
"[",
"\"",
"\"",
"]",
"\n",
"if",
"isBlankOpt",
"!=",
"nil",
"{",
"p",
"[",
"\"",
"\"",
"]",
"=",
"isBlankOpt",
"\n",
"}",
"\n",
"var",
"isPersistedOpt",
"=",
"<mask>",
"[",
"\"",
"\"",
"]",
"\n",
"if",
"isPersistedOpt",
"!=",
"nil",
"{",
"p",
"[",
"\"",
"\"",
"]",
"=",
"isPersistedOpt",
"\n",
"}",
"\n",
"var",
"nameOpt",
"=",
"options",
"[",
"\"",
"\"",
"]",
"\n",
"if",
"nameOpt",
"!=",
"nil",
"{",
"p",
"[",
"\"",
"\"",
"]",
"=",
"nameOpt",
"\n",
"}",
"\n",
"var",
"privateCloudInstanceCountOpt",
"=",
"options",
"[",
"\"",
"\"",
"]",
"\n",
"if",
"privateCloudInstanceCountOpt",
"!=",
"nil",
"{",
"p",
"[",
"\"",
"\"",
"]",
"=",
"privateCloudInstanceCountOpt",
"\n",
"}",
"\n",
"uri",
",",
"err",
":=",
"loc",
".",
"ActionPath",
"(",
"\"",
"\"",
",",
"\"",
"\"",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"res",
",",
"err",
"\n",
"}",
"\n",
"req",
",",
"err",
":=",
"loc",
".",
"api",
".",
"BuildHTTPRequest",
"(",
"uri",
".",
"HTTPMethod",
",",
"uri",
".",
"Path",
",",
"APIVersion",
",",
"params",
",",
"p",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"res",
",",
"err",
"\n",
"}",
"\n",
"resp",
",",
"err",
":=",
"loc",
".",
"api",
".",
"PerformRequest",
"(",
"req",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"res",
",",
"err",
"\n",
"}",
"\n",
"defer",
"resp",
".",
"Body",
".",
"Close",
"(",
")",
"\n",
"if",
"resp",
".",
"StatusCode",
"<",
"200",
"||",
"resp",
".",
"StatusCode",
">",
"299",
"{",
"respBody",
",",
"_",
":=",
"ioutil",
".",
"ReadAll",
"(",
"resp",
".",
"Body",
")",
"\n",
"sr",
":=",
"string",
"(",
"respBody",
")",
"\n",
"if",
"sr",
"!=",
"\"",
"\"",
"{",
"sr",
"=",
"\"",
"\"",
"+",
"sr",
"\n",
"}",
"\n",
"return",
"res",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"resp",
".",
"Status",
",",
"sr",
")",
"\n",
"}",
"\n",
"location",
":=",
"resp",
".",
"Header",
".",
"Get",
"(",
"\"",
"\"",
")",
"\n",
"if",
"len",
"(",
"location",
")",
"==",
"0",
"{",
"return",
"res",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
")",
"\n",
"}",
"else",
"{",
"return",
"&",
"ScenarioLocator",
"{",
"Href",
"(",
"location",
")",
",",
"loc",
".",
"api",
"}",
",",
"nil",
"\n",
"}",
"\n",
"}"
] |
24,852 | all-24853 | [
"List",
"through",
"all",
"Tag",
"-",
"related",
"(",
"i",
".",
"e",
"starting",
"with",
"Tag",
")",
"method",
"of",
"the",
"Parameter",
"type",
"and",
"execute",
"them",
"."
] | [
"func",
"(",
"p",
"*",
"Parameter",
")",
"DiscoverProperties",
"(",
"tag",
"reflect",
".",
"StructTag",
")",
"error",
"{",
"if",
"len",
"(",
"tag",
")",
">",
"0",
"{",
"paramtype",
":=",
"reflect",
".",
"TypeOf",
"(",
"(",
"*",
"Parameter",
")",
"(",
"nil",
")",
")",
"\n",
"prefix",
":=",
"\"",
"\"",
"\n",
"paramvalue",
":=",
"reflect",
".",
"ValueOf",
"(",
"p",
")",
"\n\n",
"for",
"idx",
":=",
"0",
";",
"idx",
"<",
"paramtype",
".",
"NumMethod",
"(",
")",
";",
"idx",
"++",
"{",
"method",
":=",
"paramtype",
".",
"Method",
"(",
"idx",
")",
"\n",
"if",
"!",
"strings",
".",
"HasPrefix",
"(",
"method",
".",
"Name",
",",
"prefix",
")",
"{",
"continue",
"\n",
"}",
"\n\n",
"tagname",
":=",
"\"",
"\"",
"+",
"strings",
".",
"ToLower",
"(",
"method",
".",
"Name",
"[",
"len",
"(",
"prefix",
")",
":",
"]",
")",
"\n",
"if",
"tagval",
":=",
"<mask>",
".",
"Get",
"(",
"tagname",
")",
";",
"tagval",
"!=",
"\"",
"\"",
"{",
"methodValue",
":=",
"paramvalue",
".",
"MethodByName",
"(",
"method",
".",
"Name",
")",
"\n\n",
"err",
":=",
"methodValue",
".",
"Call",
"(",
"[",
"]",
"reflect",
".",
"Value",
"{",
"reflect",
".",
"ValueOf",
"(",
"tagval",
")",
"}",
")",
"[",
"0",
"]",
".",
"Interface",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"(",
"err",
")",
".",
"(",
"error",
")",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
] |
24,853 | all-24854 | [
"GetFacet",
"returns",
"the",
"Facet",
"field",
"if",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"."
] | [
"func",
"(",
"a",
"*",
"ApmOrLogQueryGroupBySort",
")",
"GetFacet",
"(",
")",
"<mask>",
"{",
"if",
"a",
"==",
"nil",
"||",
"a",
".",
"Facet",
"==",
"nil",
"{",
"return",
"\"",
"\"",
"\n",
"}",
"\n",
"return",
"*",
"a",
".",
"Facet",
"\n",
"}"
] |
24,854 | all-24855 | [
"MarshalJSON",
"supports",
"json",
".",
"Marshaler",
"interface"
] | [
"func",
"(",
"v",
"EventExecutionContextDestroyed",
")",
"MarshalJSON",
"(",
")",
"(",
"[",
"]",
"<mask>",
",",
"error",
")",
"{",
"w",
":=",
"jwriter",
".",
"Writer",
"{",
"}",
"\n",
"easyjsonC5a4559bEncodeGithubComChromedpCdprotoRuntime31",
"(",
"&",
"w",
",",
"v",
")",
"\n",
"return",
"w",
".",
"Buffer",
".",
"BuildBytes",
"(",
")",
",",
"w",
".",
"Error",
"\n",
"}"
] |
24,855 | all-24856 | [
"GetString",
"is",
"a",
"wrapper",
"around",
"g_value_get_string",
"()",
".",
"GetString",
"()",
"returns",
"a",
"non",
"-",
"nil",
"error",
"if",
"g_value_get_string",
"()",
"returned",
"a",
"NULL",
"pointer",
"to",
"distinguish",
"between",
"returning",
"a",
"NULL",
"pointer",
"and",
"returning",
"an",
"empty",
"string",
"."
] | [
"func",
"(",
"v",
"*",
"Value",
")",
"GetString",
"(",
")",
"(",
"string",
",",
"error",
")",
"{",
"c",
":=",
"C",
".",
"g_value_get_string",
"(",
"v",
".",
"native",
"(",
")",
")",
"\n",
"if",
"c",
"==",
"nil",
"{",
"return",
"\"",
"\"",
",",
"errNilPtr",
"\n",
"}",
"\n",
"return",
"C",
".",
"GoString",
"(",
"(",
"*",
"C",
".",
"<mask>",
")",
"(",
"c",
")",
")",
",",
"nil",
"\n",
"}"
] |
24,856 | all-24857 | [
"Connect",
"connect",
"the",
"client",
"to",
"the",
"irc",
"server"
] | [
"func",
"(",
"c",
"*",
"Client",
")",
"Connect",
"(",
")",
"error",
"{",
"if",
"c",
".",
"IrcAddress",
"==",
"\"",
"\"",
"&&",
"c",
".",
"TLS",
"{",
"c",
".",
"IrcAddress",
"=",
"ircTwitchTLS",
"\n",
"}",
"else",
"if",
"c",
".",
"IrcAddress",
"==",
"\"",
"\"",
"&&",
"!",
"c",
".",
"TLS",
"{",
"c",
".",
"IrcAddress",
"=",
"ircTwitch",
"\n",
"}",
"\n\n",
"dialer",
":=",
"&",
"net",
".",
"Dialer",
"{",
"KeepAlive",
":",
"time",
".",
"Second",
"*",
"10",
",",
"}",
"\n\n",
"var",
"conf",
"*",
"tls",
".",
"Config",
"\n",
"// This means we are connecting to \"localhost\". Disable certificate chain check",
"if",
"strings",
".",
"HasPrefix",
"(",
"c",
".",
"IrcAddress",
",",
"\"",
"\"",
")",
"{",
"conf",
"=",
"&",
"tls",
".",
"Config",
"{",
"InsecureSkipVerify",
":",
"true",
",",
"}",
"\n",
"}",
"else",
"{",
"conf",
"=",
"&",
"tls",
".",
"Config",
"{",
"}",
"\n",
"}",
"\n\n",
"for",
"{",
"err",
":=",
"c",
".",
"makeConnection",
"(",
"dialer",
",",
"conf",
")",
"\n\n",
"switch",
"err",
"{",
"<mask>",
"errReconnect",
":",
"continue",
"\n\n",
"default",
":",
"return",
"err",
"\n",
"}",
"\n",
"}",
"\n",
"}"
] |
24,857 | all-24858 | [
"Make",
"sure",
"the",
"local",
"Write",
"is",
"called",
"."
] | [
"func",
"(",
"w",
"*",
"jsonpResponseWriter",
")",
"WriteJson",
"(",
"v",
"<mask>",
"{",
"}",
")",
"error",
"{",
"b",
",",
"err",
":=",
"w",
".",
"EncodeJson",
"(",
"v",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"// JSONP security fix (http://miki.it/blog/2014/7/8/abusing-jsonp-with-rosetta-flash/)",
"w",
".",
"Header",
"(",
")",
".",
"Set",
"(",
"\"",
"\"",
",",
"\"",
"\"",
")",
"\n",
"w",
".",
"Header",
"(",
")",
".",
"Set",
"(",
"\"",
"\"",
",",
"\"",
"\"",
")",
"\n",
"w",
".",
"Write",
"(",
"[",
"]",
"byte",
"(",
"\"",
"\"",
"+",
"w",
".",
"callbackName",
"+",
"\"",
"\"",
")",
")",
"\n",
"w",
".",
"Write",
"(",
"b",
")",
"\n",
"w",
".",
"Write",
"(",
"[",
"]",
"byte",
"(",
"\"",
"\"",
")",
")",
"\n",
"return",
"nil",
"\n",
"}"
] |
24,858 | all-24859 | [
"redactError",
"removes",
"api",
"and",
"application",
"keys",
"from",
"error",
"strings"
] | [
"func",
"(",
"client",
"*",
"Client",
")",
"redactError",
"(",
"err",
"error",
")",
"error",
"{",
"if",
"err",
"==",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n",
"errString",
":=",
"err",
".",
"Error",
"(",
")",
"\n\n",
"if",
"len",
"(",
"client",
".",
"apiKey",
")",
">",
"0",
"{",
"errString",
"=",
"strings",
".",
"Replace",
"(",
"errString",
",",
"client",
".",
"apiKey",
",",
"\"",
"\"",
",",
"-",
"1",
")",
"\n",
"}",
"\n",
"if",
"len",
"(",
"client",
".",
"appKey",
")",
">",
"0",
"{",
"errString",
"=",
"strings",
".",
"Replace",
"(",
"errString",
",",
"<mask>",
".",
"appKey",
",",
"\"",
"\"",
",",
"-",
"1",
")",
"\n",
"}",
"\n\n",
"// Return original error if no replacements were made to keep the original,",
"// probably more useful error type information.",
"if",
"errString",
"==",
"err",
".",
"Error",
"(",
")",
"{",
"return",
"err",
"\n",
"}",
"\n",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"errString",
")",
"\n",
"}"
] |
24,859 | all-24860 | [
"OfflineThreshold",
"returns",
"the",
"configured",
"heartbeat",
"threshold",
"i",
".",
"e",
".",
"the",
"number",
"of",
"seconds",
"before",
"after",
"which",
"an",
"unresponsive",
"node",
"is",
"considered",
"offline",
".."
] | [
"func",
"(",
"c",
"*",
"Config",
")",
"OfflineThreshold",
"(",
")",
"time",
".",
"Duration",
"{",
"n",
":=",
"c",
".",
"m",
".",
"GetInt64",
"(",
"\"",
"\"",
")",
"\n",
"return",
"<mask>",
".",
"Duration",
"(",
"n",
")",
"*",
"time",
".",
"Second",
"\n",
"}"
] |
24,860 | all-24861 | [
"computeDevAddr",
"handles",
"the",
"logic",
"for",
"SaveDevIDs",
"and",
"allows",
"it",
"to",
"be",
"used",
"outside",
"of",
"a",
"subresource",
"."
] | [
"func",
"computeDevAddr",
"(",
"device",
"types",
".",
"BaseVirtualDevice",
",",
"ctlr",
"types",
".",
"BaseVirtualController",
")",
"(",
"string",
",",
"error",
")",
"{",
"vd",
":=",
"device",
".",
"GetVirtualDevice",
"(",
")",
"\n",
"vc",
":=",
"ctlr",
".",
"GetVirtualController",
"(",
")",
"\n",
"ctype",
",",
"err",
":=",
"controllerTypeToClass",
"(",
"ctlr",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"\"",
"\"",
",",
"err",
"\n",
"}",
"\n",
"parts",
":=",
"[",
"]",
"string",
"{",
"ctype",
",",
"strconv",
".",
"Itoa",
"(",
"int",
"(",
"vc",
".",
"BusNumber",
")",
")",
",",
"strconv",
".",
"Itoa",
"(",
"int",
"(",
"structure",
".",
"DeRef",
"(",
"vd",
".",
"UnitNumber",
")",
".",
"(",
"int32",
")",
")",
")",
",",
"}",
"\n",
"return",
"strings",
".",
"Join",
"(",
"<mask>",
",",
"\"",
"\"",
")",
",",
"nil",
"\n",
"}"
] |
24,861 | all-24862 | [
"NewV1",
"creates",
"a",
"new",
"UUID",
"with",
"variant",
"1",
"as",
"described",
"in",
"RFC",
"4122",
".",
"Variant",
"1",
"is",
"based",
"on",
"hosts",
"MAC",
"address",
"and",
"actual",
"timestamp",
"(",
"as",
"count",
"of",
"100",
"-",
"nanosecond",
"intervals",
"since",
"00",
":",
"00",
":",
"00",
".",
"00",
"15",
"October",
"1582",
"(",
"the",
"date",
"of",
"Gregorian",
"reform",
"to",
"the",
"Christian",
"calendar",
")",
"."
] | [
"func",
"NewV1",
"(",
")",
"*",
"UUID",
"{",
"var",
"uuid",
"UUID",
"\n",
"requests",
"<-",
"true",
"\n",
"s",
":=",
"<-",
"answers",
"\n",
"copy",
"(",
"uuid",
"[",
":",
"4",
"]",
",",
"s",
"[",
"4",
":",
"]",
")",
"\n",
"copy",
"(",
"uuid",
"[",
"4",
":",
"6",
"]",
",",
"s",
"[",
"2",
":",
"4",
"]",
")",
"\n",
"copy",
"(",
"uuid",
"[",
"6",
":",
"8",
"]",
",",
"s",
"[",
":",
"2",
"]",
")",
"\n",
"uuid",
"[",
"6",
"]",
"=",
"(",
"uuid",
"[",
"6",
"]",
"&",
"0x0f",
")",
"|",
"0x10",
"\n",
"<mask>",
"(",
"uuid",
"[",
"8",
":",
"10",
"]",
",",
"s",
"[",
"8",
":",
"]",
")",
"\n",
"copy",
"(",
"uuid",
"[",
"10",
":",
"]",
",",
"mac",
")",
"\n",
"uuid",
".",
"variantRFC4122",
"(",
")",
"\n",
"return",
"&",
"uuid",
"\n",
"}"
] |
24,862 | all-24863 | [
"Exec",
"executes",
"a",
"pixelsCommand",
"."
] | [
"func",
"(",
"c",
"*",
"pixelsCommand",
")",
"Exec",
"(",
"indexOffset",
"int",
")",
"error",
"{",
"p",
",",
"err",
":=",
"c",
".",
"img",
".",
"<mask>",
".",
"Pixels",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"c",
".",
"result",
"=",
"p",
"\n",
"return",
"nil",
"\n",
"}"
] |
24,863 | all-24864 | [
"UnmarshalJSON",
"supports",
"json",
".",
"Unmarshaler",
"interface"
] | [
"func",
"(",
"v",
"*",
"PrepareForLeakDetectionParams",
")",
"UnmarshalJSON",
"(",
"data",
"[",
"]",
"byte",
")",
"error",
"{",
"r",
":=",
"jlexer",
".",
"Lexer",
"{",
"Data",
":",
"data",
"}",
"\n",
"easyjsonC5a4559bDecodeGithubComChromedpCdprotoMemory6",
"(",
"&",
"r",
",",
"v",
")",
"\n",
"return",
"r",
".",
"<mask>",
"(",
")",
"\n",
"}"
] |
24,864 | all-24865 | [
"Scan",
"read",
"a",
"value",
"from",
"a",
"database",
"driver"
] | [
"func",
"(",
"r",
"*",
"Password",
")",
"Scan",
"(",
"raw",
"<mask>",
"{",
"}",
")",
"error",
"{",
"switch",
"v",
":=",
"raw",
".",
"(",
"type",
")",
"{",
"case",
"[",
"]",
"byte",
":",
"*",
"r",
"=",
"Password",
"(",
"string",
"(",
"v",
")",
")",
"\n",
"case",
"string",
":",
"*",
"r",
"=",
"Password",
"(",
"v",
")",
"\n",
"default",
":",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"v",
")",
"\n",
"}",
"\n\n",
"return",
"nil",
"\n",
"}"
] |
24,865 | all-24866 | [
"Stability",
":",
"***",
"EXPERIMENTAL",
"***",
"Idempotently",
"ensure",
"that",
"a",
"keypair",
"of",
"a",
"given",
"name",
"exists",
"Required",
"scopes",
":",
"ec2",
"-",
"manager",
":",
"manage",
"-",
"key",
"-",
"pairs",
":",
"<name",
">",
"See",
"https",
":",
"//",
"docs",
".",
"taskcluster",
".",
"net",
"/",
"reference",
"/",
"core",
"/",
"ec2",
"-",
"manager",
"/",
"api",
"-",
"docs#ensureKeyPair"
] | [
"func",
"(",
"eC2Manager",
"*",
"EC2Manager",
")",
"EnsureKeyPair",
"(",
"name",
"string",
",",
"payload",
"*",
"SSHPublicKey",
")",
"error",
"{",
"cd",
":=",
"tcclient",
".",
"Client",
"(",
"*",
"eC2Manager",
")",
"\n",
"_",
",",
"_",
",",
"err",
":=",
"(",
"&",
"cd",
")",
".",
"APICall",
"(",
"payload",
",",
"\"",
"\"",
",",
"\"",
"\"",
"+",
"url",
".",
"QueryEscape",
"(",
"<mask>",
")",
",",
"nil",
",",
"nil",
")",
"\n",
"return",
"err",
"\n",
"}"
] |
24,866 | all-24867 | [
"Less",
"implements",
"sort",
".",
"Interface",
"."
] | [
"func",
"(",
"lop",
"listOfPeers",
")",
"Less",
"(",
"i",
",",
"j",
"int",
")",
"bool",
"{",
"return",
"lop",
"[",
"i",
"]",
".",
"Name",
"<",
"lop",
"[",
"j",
"]",
".",
"<mask>",
"\n",
"}"
] |
24,867 | all-24868 | [
"Upsert",
"is",
"like",
"Update",
"but",
"key",
"is",
"not",
"required",
"to",
"be",
"present"
] | [
"func",
"(",
"c",
"*",
"readWriteCollection",
")",
"Upsert",
"(",
"key",
"string",
",",
"val",
"proto",
".",
"Message",
",",
"f",
"func",
"(",
")",
"error",
")",
"error",
"{",
"if",
"err",
":=",
"<mask>",
".",
"CheckType",
"(",
"c",
".",
"template",
",",
"val",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"if",
"err",
":=",
"c",
".",
"Get",
"(",
"key",
",",
"val",
")",
";",
"err",
"!=",
"nil",
"&&",
"!",
"IsErrNotFound",
"(",
"err",
")",
"{",
"return",
"err",
"\n",
"}",
"\n",
"if",
"err",
":=",
"f",
"(",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"return",
"c",
".",
"Put",
"(",
"key",
",",
"val",
")",
"\n",
"}"
] |
24,868 | all-24869 | [
"SetHostPublicIPv4Address",
"mocks",
"base",
"method"
] | [
"func",
"(",
"m",
"*",
"MockManager",
")",
"SetHostPublicIPv4Address",
"(",
"arg0",
"<mask>",
")",
"{",
"m",
".",
"ctrl",
".",
"Call",
"(",
"m",
",",
"\"",
"\"",
",",
"arg0",
")",
"\n",
"}"
] |
24,869 | all-24870 | [
"Run",
"lexes",
"the",
"input",
"by",
"executing",
"state",
"functions",
"until",
"the",
"state",
"is",
"nil"
] | [
"func",
"(",
"l",
"*",
"Lexer",
")",
"run",
"(",
")",
"{",
"for",
"<mask>",
":=",
"lexText",
";",
"state",
"!=",
"nil",
";",
"{",
"state",
"=",
"state",
"(",
"l",
")",
"\n",
"}",
"\n",
"}"
] |
24,870 | all-24871 | [
"OptFieldTypeInt",
"adds",
"an",
"integer",
"field",
"."
] | [
"func",
"OptFieldTypeInt",
"(",
"min",
"int64",
",",
"max",
"int64",
")",
"FieldOption",
"{",
"return",
"func",
"(",
"options",
"*",
"FieldOptions",
")",
"{",
"options",
".",
"fieldType",
"=",
"FieldTypeInt",
"\n",
"<mask>",
".",
"min",
"=",
"min",
"\n",
"options",
".",
"max",
"=",
"max",
"\n",
"}",
"\n",
"}"
] |
24,871 | all-24872 | [
"session",
"session处理"
] | [
"func",
"session",
"(",
"ctx",
"*",
"Context",
")",
"{",
"var",
"cookie",
"*",
"http",
".",
"Cookie",
"\n",
"cookies",
":=",
"ctx",
".",
"Request",
".",
"Cookies",
"(",
")",
"\n",
"if",
"len",
"(",
"cookies",
")",
"==",
"0",
"{",
"ctx",
".",
"Next",
"(",
")",
"\n",
"return",
"\n",
"}",
"\n\n",
"for",
"_",
",",
"v",
":=",
"range",
"cookies",
"{",
"if",
"v",
".",
"Name",
"==",
"httpCookie",
".",
"Name",
"{",
"cookie",
"=",
"v",
"\n",
"break",
"\n",
"}",
"\n",
"}",
"\n",
"if",
"cookie",
"==",
"nil",
"{",
"ctx",
".",
"Next",
"(",
")",
"\n",
"return",
"\n",
"}",
"\n\n",
"sid",
":=",
"cookie",
".",
"Value",
"\n",
"store",
",",
"err",
":=",
"provider",
".",
"Get",
"(",
"sid",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"log",
".",
"WithFields",
"(",
"log",
".",
"Fields",
"{",
"\"",
"\"",
":",
"sid",
",",
"\"",
"\"",
":",
"err",
"}",
")",
".",
"Warnln",
"(",
"\"",
"",
"",
"\n",
"ctx",
".",
"Fail",
"(",
"err",
")",
"\n",
"return",
"\n",
"}",
"\n",
"if",
"len",
"(",
"store",
".",
"Values",
")",
">",
"0",
"{",
"//err := provider.refresh(store)",
"err",
":=",
"provider",
".",
"UpExpire",
"(",
"sid",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"log",
".",
"WithFields",
"(",
"<mask>",
".",
"Fields",
"{",
"\"",
"\"",
":",
"sid",
",",
"\"",
"\"",
":",
"err",
"}",
")",
".",
"Warnln",
"(",
"\"",
"",
"",
"\n",
"ctx",
".",
"Fail",
"(",
"err",
")",
"\n",
"return",
"\n",
"}",
"\n",
"cookie",
":=",
"httpCookie",
"\n",
"cookie",
".",
"Value",
"=",
"sid",
"\n",
"ctx",
".",
"Data",
"[",
"\"",
"\"",
"]",
"=",
"store",
"\n",
"ctx",
".",
"Data",
"[",
"\"",
"\"",
"]",
"=",
"sid",
"\n",
"http",
".",
"SetCookie",
"(",
"ctx",
".",
"ResponseWriter",
",",
"&",
"cookie",
")",
"\n",
"}",
"\n\n",
"ctx",
".",
"Next",
"(",
")",
"\n",
"}"
] |
24,872 | all-24873 | [
"Comment",
"adds",
"a",
"comment",
"to",
"the",
"query",
"to",
"identify",
"it",
"in",
"the",
"database",
"profiler",
"output",
".",
"Relevant",
"documentation",
":",
"http",
":",
"//",
"docs",
".",
"mongodb",
".",
"org",
"/",
"manual",
"/",
"reference",
"/",
"operator",
"/",
"meta",
"/",
"comment",
"http",
":",
"//",
"docs",
".",
"mongodb",
".",
"org",
"/",
"manual",
"/",
"reference",
"/",
"command",
"/",
"profile",
"http",
":",
"//",
"docs",
".",
"mongodb",
".",
"org",
"/",
"manual",
"/",
"administration",
"/",
"analyzing",
"-",
"mongodb",
"-",
"performance",
"/",
"#database",
"-",
"profiling"
] | [
"func",
"(",
"q",
"*",
"Query",
")",
"Comment",
"(",
"comment",
"string",
")",
"*",
"Query",
"{",
"q",
".",
"m",
".",
"Lock",
"(",
")",
"\n",
"q",
".",
"op",
".",
"<mask>",
".",
"Comment",
"=",
"comment",
"\n",
"q",
".",
"op",
".",
"hasOptions",
"=",
"true",
"\n",
"q",
".",
"m",
".",
"Unlock",
"(",
")",
"\n",
"return",
"q",
"\n",
"}"
] |
24,873 | all-24874 | [
"CreateStream",
"will",
"create",
"a",
"new",
"stream",
"and",
"register",
"it"
] | [
"func",
"(",
"s",
"*",
"Server",
")",
"CreateStream",
"(",
"id",
"string",
")",
"*",
"Stream",
"{",
"s",
".",
"mu",
".",
"Lock",
"(",
")",
"\n",
"defer",
"s",
".",
"mu",
".",
"Unlock",
"(",
")",
"\n\n",
"if",
"s",
".",
"Streams",
"[",
"id",
"]",
"!=",
"nil",
"{",
"return",
"s",
".",
"Streams",
"[",
"id",
"]",
"\n",
"}",
"\n\n",
"str",
":=",
"newStream",
"(",
"s",
".",
"BufferSize",
",",
"s",
".",
"AutoReplay",
")",
"\n",
"str",
".",
"run",
"(",
")",
"\n\n",
"s",
".",
"Streams",
"[",
"<mask>",
"]",
"=",
"str",
"\n\n",
"return",
"str",
"\n",
"}"
] |
24,874 | all-24875 | [
"Flush",
"waits",
"until",
"all",
"records",
"in",
"the",
"buffered",
"channel",
"have",
"been",
"processed",
"."
] | [
"func",
"(",
"b",
"*",
"ChannelMemoryBackend",
")",
"Flush",
"(",
")",
"{",
"b",
".",
"flushWg",
".",
"Add",
"(",
"1",
")",
"\n",
"b",
".",
"<mask>",
"<-",
"eventFlush",
"\n",
"b",
".",
"flushWg",
".",
"Wait",
"(",
")",
"\n",
"}"
] |
24,875 | all-24876 | [
"ReadIndexTable",
"loads",
"a",
"index",
"table",
"."
] | [
"func",
"ReadIndexTable",
"(",
"r",
"<mask>",
".",
"Reader",
")",
"(",
"IndexTable",
",",
"error",
")",
"{",
"idx",
":=",
"IndexTable",
"{",
"}",
"\n",
"d",
",",
"err",
":=",
"da",
".",
"Read",
"(",
"r",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"idx",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"}",
"\n",
"idx",
".",
"Da",
"=",
"d",
"\n\n",
"dec",
":=",
"gob",
".",
"NewDecoder",
"(",
"r",
")",
"\n",
"if",
"e",
":=",
"dec",
".",
"Decode",
"(",
"&",
"idx",
".",
"Dup",
")",
";",
"e",
"!=",
"nil",
"{",
"return",
"idx",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"e",
")",
"\n",
"}",
"\n\n",
"return",
"idx",
",",
"nil",
"\n",
"}"
] |
24,876 | all-24877 | [
"SetShowAll",
"()",
"is",
"a",
"wrapper",
"around",
"gtk_app_chooser_widget_set_show_all",
"()",
"."
] | [
"func",
"(",
"v",
"*",
"AppChooserWidget",
")",
"SetShowAll",
"(",
"setting",
"bool",
")",
"{",
"C",
".",
"gtk_app_chooser_widget_set_show_all",
"(",
"v",
".",
"native",
"(",
")",
",",
"gbool",
"(",
"<mask>",
")",
")",
"\n",
"}"
] |
24,877 | all-24878 | [
"Takes",
"values",
"from",
"the",
"form",
"data",
"and",
"puts",
"them",
"into",
"a",
"struct"
] | [
"func",
"mapForm",
"(",
"formStruct",
"reflect",
".",
"Value",
",",
"form",
"map",
"[",
"string",
"]",
"[",
"]",
"string",
",",
"formfile",
"map",
"[",
"string",
"]",
"[",
"]",
"*",
"multipart",
".",
"FileHeader",
",",
"errors",
"Errors",
")",
"{",
"if",
"formStruct",
".",
"Kind",
"(",
")",
"==",
"reflect",
".",
"Ptr",
"{",
"formStruct",
"=",
"formStruct",
".",
"Elem",
"(",
")",
"\n",
"}",
"\n",
"typ",
":=",
"formStruct",
".",
"Type",
"(",
")",
"\n\n",
"for",
"i",
":=",
"0",
";",
"i",
"<",
"typ",
".",
"NumField",
"(",
")",
";",
"i",
"++",
"{",
"typeField",
":=",
"typ",
".",
"Field",
"(",
"i",
")",
"\n",
"structField",
":=",
"formStruct",
".",
"Field",
"(",
"i",
")",
"\n\n",
"if",
"typeField",
".",
"Type",
".",
"Kind",
"(",
")",
"==",
"reflect",
".",
"Ptr",
"&&",
"typeField",
".",
"Anonymous",
"{",
"structField",
".",
"<mask>",
"(",
"reflect",
".",
"New",
"(",
"typeField",
".",
"Type",
".",
"Elem",
"(",
")",
")",
")",
"\n",
"mapForm",
"(",
"structField",
".",
"Elem",
"(",
")",
",",
"form",
",",
"formfile",
",",
"errors",
")",
"\n",
"if",
"reflect",
".",
"DeepEqual",
"(",
"structField",
".",
"Elem",
"(",
")",
".",
"Interface",
"(",
")",
",",
"reflect",
".",
"Zero",
"(",
"structField",
".",
"Elem",
"(",
")",
".",
"Type",
"(",
")",
")",
".",
"Interface",
"(",
")",
")",
"{",
"structField",
".",
"Set",
"(",
"reflect",
".",
"Zero",
"(",
"structField",
".",
"Type",
"(",
")",
")",
")",
"\n",
"}",
"\n",
"}",
"else",
"if",
"typeField",
".",
"Type",
".",
"Kind",
"(",
")",
"==",
"reflect",
".",
"Struct",
"{",
"mapForm",
"(",
"structField",
",",
"form",
",",
"formfile",
",",
"errors",
")",
"\n",
"}",
"else",
"if",
"inputFieldName",
":=",
"typeField",
".",
"Tag",
".",
"Get",
"(",
"\"",
"\"",
")",
";",
"inputFieldName",
"!=",
"\"",
"\"",
"{",
"if",
"!",
"structField",
".",
"CanSet",
"(",
")",
"{",
"continue",
"\n",
"}",
"\n\n",
"inputValue",
",",
"exists",
":=",
"form",
"[",
"inputFieldName",
"]",
"\n",
"inputFile",
",",
"existsFile",
":=",
"formfile",
"[",
"inputFieldName",
"]",
"\n",
"if",
"exists",
"&&",
"!",
"existsFile",
"{",
"numElems",
":=",
"len",
"(",
"inputValue",
")",
"\n",
"if",
"structField",
".",
"Kind",
"(",
")",
"==",
"reflect",
".",
"Slice",
"&&",
"numElems",
">",
"0",
"{",
"sliceOf",
":=",
"structField",
".",
"Type",
"(",
")",
".",
"Elem",
"(",
")",
".",
"Kind",
"(",
")",
"\n",
"slice",
":=",
"reflect",
".",
"MakeSlice",
"(",
"structField",
".",
"Type",
"(",
")",
",",
"numElems",
",",
"numElems",
")",
"\n",
"for",
"i",
":=",
"0",
";",
"i",
"<",
"numElems",
";",
"i",
"++",
"{",
"setWithProperType",
"(",
"sliceOf",
",",
"inputValue",
"[",
"i",
"]",
",",
"slice",
".",
"Index",
"(",
"i",
")",
",",
"inputFieldName",
",",
"errors",
")",
"\n",
"}",
"\n",
"formStruct",
".",
"Field",
"(",
"i",
")",
".",
"Set",
"(",
"slice",
")",
"\n",
"}",
"else",
"{",
"kind",
":=",
"typeField",
".",
"Type",
".",
"Kind",
"(",
")",
"\n",
"if",
"structField",
".",
"Kind",
"(",
")",
"==",
"reflect",
".",
"Ptr",
"{",
"structField",
".",
"Set",
"(",
"reflect",
".",
"New",
"(",
"typeField",
".",
"Type",
".",
"Elem",
"(",
")",
")",
")",
"\n",
"structField",
"=",
"structField",
".",
"Elem",
"(",
")",
"\n",
"kind",
"=",
"typeField",
".",
"Type",
".",
"Elem",
"(",
")",
".",
"Kind",
"(",
")",
"\n",
"}",
"\n",
"setWithProperType",
"(",
"kind",
",",
"inputValue",
"[",
"0",
"]",
",",
"structField",
",",
"inputFieldName",
",",
"errors",
")",
"\n",
"}",
"\n",
"continue",
"\n",
"}",
"\n\n",
"if",
"!",
"existsFile",
"{",
"continue",
"\n",
"}",
"\n",
"fhType",
":=",
"reflect",
".",
"TypeOf",
"(",
"(",
"*",
"multipart",
".",
"FileHeader",
")",
"(",
"nil",
")",
")",
"\n",
"numElems",
":=",
"len",
"(",
"inputFile",
")",
"\n",
"if",
"structField",
".",
"Kind",
"(",
")",
"==",
"reflect",
".",
"Slice",
"&&",
"numElems",
">",
"0",
"&&",
"structField",
".",
"Type",
"(",
")",
".",
"Elem",
"(",
")",
"==",
"fhType",
"{",
"slice",
":=",
"reflect",
".",
"MakeSlice",
"(",
"structField",
".",
"Type",
"(",
")",
",",
"numElems",
",",
"numElems",
")",
"\n",
"for",
"i",
":=",
"0",
";",
"i",
"<",
"numElems",
";",
"i",
"++",
"{",
"slice",
".",
"Index",
"(",
"i",
")",
".",
"Set",
"(",
"reflect",
".",
"ValueOf",
"(",
"inputFile",
"[",
"i",
"]",
")",
")",
"\n",
"}",
"\n",
"structField",
".",
"Set",
"(",
"slice",
")",
"\n",
"}",
"else",
"if",
"structField",
".",
"Type",
"(",
")",
"==",
"fhType",
"{",
"structField",
".",
"Set",
"(",
"reflect",
".",
"ValueOf",
"(",
"inputFile",
"[",
"0",
"]",
")",
")",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n",
"}"
] |
24,878 | all-24879 | [
"AddTask",
"adds",
"a",
"new",
"task",
"to",
"the",
"state"
] | [
"func",
"(",
"state",
"*",
"DockerTaskEngineState",
")",
"AddTask",
"(",
"task",
"*",
"apitask",
".",
"Task",
")",
"{",
"state",
".",
"lock",
".",
"Lock",
"(",
")",
"\n",
"defer",
"state",
".",
"<mask>",
".",
"Unlock",
"(",
")",
"\n\n",
"state",
".",
"tasks",
"[",
"task",
".",
"Arn",
"]",
"=",
"task",
"\n",
"}"
] |
24,879 | all-24880 | [
"UpdateGraph",
"updates",
"passed",
"graph",
"."
] | [
"func",
"(",
"a",
"*",
"API",
")",
"UpdateGraph",
"(",
"cfg",
"*",
"Graph",
")",
"(",
"*",
"Graph",
",",
"error",
")",
"{",
"if",
"cfg",
"==",
"nil",
"{",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"graphCID",
":=",
"string",
"(",
"cfg",
".",
"CID",
")",
"\n\n",
"<mask>",
",",
"err",
":=",
"regexp",
".",
"MatchString",
"(",
"config",
".",
"GraphCIDRegex",
",",
"graphCID",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"if",
"!",
"matched",
"{",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"graphCID",
")",
"\n",
"}",
"\n\n",
"jsonCfg",
",",
"err",
":=",
"json",
".",
"Marshal",
"(",
"cfg",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"if",
"a",
".",
"Debug",
"{",
"a",
".",
"Log",
".",
"Printf",
"(",
"\"",
"\"",
",",
"string",
"(",
"jsonCfg",
")",
")",
"\n",
"}",
"\n\n",
"result",
",",
"err",
":=",
"a",
".",
"Put",
"(",
"graphCID",
",",
"jsonCfg",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"graph",
":=",
"&",
"Graph",
"{",
"}",
"\n",
"if",
"err",
":=",
"json",
".",
"Unmarshal",
"(",
"result",
",",
"graph",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"return",
"graph",
",",
"nil",
"\n",
"}"
] |
24,880 | all-24881 | [
"Properties",
"is",
"a",
"convenience",
"method",
"that",
"wraps",
"fetching",
"the",
"Folder",
"MO",
"from",
"its",
"higher",
"-",
"level",
"object",
"."
] | [
"func",
"Properties",
"(",
"<mask>",
"*",
"object",
".",
"Folder",
")",
"(",
"*",
"mo",
".",
"Folder",
",",
"error",
")",
"{",
"ctx",
",",
"cancel",
":=",
"context",
".",
"WithTimeout",
"(",
"context",
".",
"Background",
"(",
")",
",",
"provider",
".",
"DefaultAPITimeout",
")",
"\n",
"defer",
"cancel",
"(",
")",
"\n",
"var",
"props",
"mo",
".",
"Folder",
"\n",
"if",
"err",
":=",
"folder",
".",
"Properties",
"(",
"ctx",
",",
"folder",
".",
"Reference",
"(",
")",
",",
"nil",
",",
"&",
"props",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"return",
"&",
"props",
",",
"nil",
"\n",
"}"
] |
24,881 | all-24882 | [
"Specify",
"the",
"value",
"of",
"a",
"uniform",
"variable",
"for",
"a",
"specified",
"program",
"object"
] | [
"func",
"ProgramUniform2uiv",
"(",
"<mask>",
"uint32",
",",
"location",
"int32",
",",
"count",
"int32",
",",
"value",
"*",
"uint32",
")",
"{",
"syscall",
".",
"Syscall6",
"(",
"gpProgramUniform2uiv",
",",
"4",
",",
"uintptr",
"(",
"program",
")",
",",
"uintptr",
"(",
"location",
")",
",",
"uintptr",
"(",
"count",
")",
",",
"uintptr",
"(",
"unsafe",
".",
"Pointer",
"(",
"value",
")",
")",
",",
"0",
",",
"0",
")",
"\n",
"}"
] |
24,882 | all-24883 | [
"getNode",
"returns",
"a",
"pointer",
"to",
"the",
"node",
"located",
"at",
"offset",
".",
"If",
"the",
"offset",
"is",
"zero",
"then",
"the",
"nil",
"node",
"pointer",
"is",
"returned",
"."
] | [
"func",
"(",
"s",
"*",
"Arena",
")",
"getNode",
"(",
"offset",
"uint32",
")",
"*",
"node",
"{",
"if",
"<mask>",
"==",
"0",
"{",
"return",
"nil",
"\n",
"}",
"\n\n",
"return",
"(",
"*",
"node",
")",
"(",
"unsafe",
".",
"Pointer",
"(",
"&",
"s",
".",
"buf",
"[",
"offset",
"]",
")",
")",
"\n",
"}"
] |
24,883 | all-24884 | [
"WhitelistWritableFields",
"will",
"enforce",
"the",
"authorization",
"by",
"making",
"sure",
"only",
"the",
"specified",
"fields",
"can",
"be",
"changed",
"by",
"the",
"client",
".",
"Note",
":",
"This",
"enforcer",
"can",
"only",
"be",
"used",
"to",
"authorize",
"Create",
"and",
"Update",
"operations",
"."
] | [
"func",
"WhitelistWritableFields",
"(",
"fields",
"...",
"string",
")",
"*",
"Enforcer",
"{",
"return",
"E",
"(",
"\"",
"\"",
",",
"fire",
".",
"Only",
"(",
"fire",
".",
"Create",
",",
"fire",
".",
"Update",
")",
",",
"func",
"(",
"ctx",
"*",
"<mask>",
".",
"Context",
")",
"error",
"{",
"// set new list",
"ctx",
".",
"WritableFields",
"=",
"fire",
".",
"Intersect",
"(",
"ctx",
".",
"WritableFields",
",",
"fields",
")",
"\n\n",
"return",
"nil",
"\n",
"}",
")",
"\n",
"}"
] |
24,884 | all-24885 | [
"GetPeriod",
"returns",
"the",
"Period",
"field",
"if",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"."
] | [
"func",
"(",
"t",
"*",
"ThresholdCount",
")",
"GetPeriod",
"(",
")",
"Period",
"{",
"if",
"t",
"==",
"nil",
"||",
"t",
".",
"Period",
"==",
"nil",
"{",
"<mask>",
"Period",
"{",
"}",
"\n",
"}",
"\n",
"return",
"*",
"t",
".",
"Period",
"\n",
"}"
] |
24,885 | all-24886 | [
"GetPath",
"()",
"is",
"a",
"wrapper",
"around",
"g_settings_schema_get_path",
"()",
"."
] | [
"func",
"(",
"v",
"*",
"SettingsSchema",
")",
"GetPath",
"(",
")",
"string",
"{",
"return",
"C",
".",
"GoString",
"(",
"(",
"*",
"C",
".",
"<mask>",
")",
"(",
"C",
".",
"g_settings_schema_get_path",
"(",
"v",
".",
"native",
"(",
")",
")",
")",
")",
"\n",
"}"
] |
24,886 | all-24887 | [
"Convenience",
"function",
"to",
"ensure",
"that",
"SRV",
"names",
"are",
"well",
"-",
"formed",
"."
] | [
"func",
"(",
"ds",
"*",
"DNSServer",
")",
"qualifySrv",
"(",
"service",
",",
"protocol",
"string",
")",
"string",
"{",
"return",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"service",
",",
"protocol",
",",
"ds",
".",
"<mask>",
")",
"\n",
"}"
] |
24,887 | all-24888 | [
"UnmarshalJSON",
"supports",
"json",
".",
"Unmarshaler",
"interface"
] | [
"func",
"(",
"v",
"*",
"StopScreencastParams",
")",
"UnmarshalJSON",
"(",
"data",
"[",
"]",
"<mask>",
")",
"error",
"{",
"r",
":=",
"jlexer",
".",
"Lexer",
"{",
"Data",
":",
"data",
"}",
"\n",
"easyjsonC5a4559bDecodeGithubComChromedpCdprotoPage3",
"(",
"&",
"r",
",",
"v",
")",
"\n",
"return",
"r",
".",
"Error",
"(",
")",
"\n",
"}"
] |
24,888 | all-24889 | [
"TokenHandler",
"manage",
"authorizations"
] | [
"func",
"TokenHandler",
"(",
"next",
"http",
".",
"<mask>",
",",
"cnf",
"web",
".",
"Config",
")",
"http",
".",
"Handler",
"{",
"return",
"http",
".",
"HandlerFunc",
"(",
"func",
"(",
"w",
"http",
".",
"ResponseWriter",
",",
"r",
"*",
"http",
".",
"Request",
")",
"{",
"token",
",",
"err",
":=",
"request",
".",
"ParseFromRequest",
"(",
"r",
",",
"request",
".",
"AuthorizationHeaderExtractor",
",",
"func",
"(",
"token",
"*",
"jwt",
".",
"Token",
")",
"(",
"interface",
"{",
"}",
",",
"error",
")",
"{",
"if",
"_",
",",
"ok",
":=",
"token",
".",
"Method",
".",
"(",
"*",
"jwt",
".",
"SigningMethodHMAC",
")",
";",
"!",
"ok",
"{",
"//TODO: On ne passe jamais à l'intérieur",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"token",
".",
"Header",
"[",
"\"",
"\"",
"]",
")",
"\n",
"}",
"\n",
"return",
"[",
"]",
"byte",
"(",
"cnf",
".",
"Jwt",
".",
"Key",
")",
",",
"nil",
"\n",
"}",
")",
"\n",
"if",
"err",
"==",
"nil",
"&&",
"token",
".",
"Valid",
"{",
"next",
".",
"ServeHTTP",
"(",
"w",
",",
"r",
")",
"\n",
"}",
"else",
"{",
"if",
"r",
".",
"URL",
".",
"String",
"(",
")",
"==",
"\"",
"\"",
"{",
"next",
".",
"ServeHTTP",
"(",
"w",
",",
"r",
")",
"\n",
"}",
"else",
"{",
"w",
".",
"WriteHeader",
"(",
"http",
".",
"StatusUnauthorized",
")",
"\n",
"}",
"\n",
"}",
"\n",
"}",
")",
"\n",
"}"
] |
24,889 | all-24890 | [
"UnmarshalJSON",
"supports",
"json",
".",
"Unmarshaler",
"interface"
] | [
"func",
"(",
"v",
"*",
"EventMetadata",
")",
"UnmarshalJSON",
"(",
"data",
"[",
"]",
"byte",
")",
"error",
"{",
"r",
":=",
"jlexer",
".",
"Lexer",
"{",
"Data",
":",
"data",
"}",
"\n",
"easyjsonC5a4559bDecodeGithubComChromedpCdprotoBackgroundservice4",
"(",
"&",
"r",
",",
"v",
")",
"\n",
"return",
"r",
".",
"<mask>",
"(",
")",
"\n",
"}"
] |
24,890 | all-24891 | [
"printf",
"prints",
"into",
"the",
"backend",
"buffer",
".",
"This",
"will",
"not",
"show",
"immediately",
".",
"printf",
"shall",
"be",
"called",
"from",
"queue",
"context",
"."
] | [
"func",
"(",
"w",
"*",
"Window",
")",
"printf",
"(",
"x",
",",
"y",
"int",
",",
"a",
"Attributes",
",",
"<mask>",
"string",
",",
"args",
"...",
"interface",
"{",
"}",
")",
"{",
"out",
":=",
"fmt",
".",
"Sprintf",
"(",
"format",
",",
"args",
"...",
")",
"\n",
"xx",
":=",
"0",
"\n",
"c",
":=",
"Cell",
"{",
"}",
"\n",
"c",
".",
"Fg",
"=",
"a",
".",
"Fg",
"\n",
"c",
".",
"Bg",
"=",
"a",
".",
"Bg",
"\n",
"mx",
":=",
"w",
".",
"x",
"-",
"x",
"\n",
"var",
"rw",
"int",
"\n",
"for",
"i",
":=",
"0",
";",
"i",
"<",
"len",
"(",
"out",
")",
";",
"i",
"+=",
"rw",
"{",
"if",
"x",
"+",
"xx",
"+",
"1",
">",
"mx",
"{",
"break",
"\n",
"}",
"\n\n",
"v",
",",
"width",
":=",
"utf8",
".",
"DecodeRuneInString",
"(",
"out",
"[",
"i",
":",
"]",
")",
"\n",
"if",
"v",
"==",
"'\\x1b'",
"{",
"// see if we understand this escape seqeunce",
"cc",
",",
"skip",
",",
"err",
":=",
"DecodeColor",
"(",
"out",
"[",
"i",
":",
"]",
")",
"\n",
"if",
"err",
"==",
"nil",
"{",
"c",
".",
"Fg",
"=",
"cc",
".",
"Fg",
"\n",
"c",
".",
"Bg",
"=",
"cc",
".",
"Bg",
"\n",
"rw",
"=",
"skip",
"\n",
"continue",
"\n\n",
"}",
"\n",
"}",
"\n\n",
"rw",
"=",
"width",
"\n",
"c",
".",
"Ch",
"=",
"v",
"\n",
"w",
".",
"setCell",
"(",
"x",
"+",
"xx",
",",
"y",
",",
"c",
")",
"\n",
"xx",
"++",
"\n",
"}",
"\n",
"}"
] |
24,891 | all-24892 | [
"TeamHasMember",
"checks",
"if",
"a",
"user",
"belongs",
"to",
"a",
"team"
] | [
"func",
"(",
"c",
"*",
"Client",
")",
"TeamHasMember",
"(",
"teamID",
"int",
",",
"memberLogin",
"string",
")",
"(",
"bool",
",",
"error",
")",
"{",
"c",
".",
"log",
"(",
"\"",
"\"",
",",
"teamID",
",",
"memberLogin",
")",
"\n",
"projectMaintainers",
",",
"err",
":=",
"c",
".",
"ListTeamMembers",
"(",
"teamID",
",",
"RoleAll",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"false",
",",
"err",
"\n",
"}",
"\n",
"for",
"_",
",",
"person",
":=",
"range",
"projectMaintainers",
"{",
"if",
"NormLogin",
"(",
"person",
".",
"Login",
")",
"==",
"NormLogin",
"(",
"memberLogin",
")",
"{",
"return",
"true",
",",
"nil",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"<mask>",
",",
"nil",
"\n",
"}"
] |
24,892 | all-24893 | [
"OnStart",
"implements",
"BaseService",
"."
] | [
"func",
"(",
"p",
"*",
"Peer",
")",
"OnStart",
"(",
")",
"<mask>",
"{",
"p",
".",
"BaseService",
".",
"OnStart",
"(",
")",
"\n",
"_",
",",
"err",
":=",
"p",
".",
"mconn",
".",
"Start",
"(",
")",
"\n",
"return",
"err",
"\n",
"}"
] |
24,893 | all-24894 | [
"SetPixbufColumn",
"is",
"a",
"wrapper",
"around",
"gtk_icon_view_set_pixbuf_column",
"()",
"."
] | [
"func",
"(",
"v",
"*",
"IconView",
")",
"SetPixbufColumn",
"(",
"<mask>",
"int",
")",
"{",
"C",
".",
"gtk_icon_view_set_pixbuf_column",
"(",
"v",
".",
"native",
"(",
")",
",",
"C",
".",
"gint",
"(",
"column",
")",
")",
"\n",
"}"
] |
24,894 | all-24895 | [
"parseMetadataAtContainerCreate",
"gathers",
"metadata",
"from",
"task",
"and",
"cluster",
"configurations",
"then",
"packages",
"it",
"for",
"JSON",
"Marshaling",
".",
"We",
"use",
"this",
"version",
"to",
"get",
"data",
"available",
"prior",
"to",
"container",
"creation",
"Since",
"we",
"accept",
"incomplete",
"metadata",
"fields",
"we",
"should",
"not",
"return",
"errors",
"here",
"and",
"handle",
"them",
"at",
"this",
"or",
"the",
"above",
"stage",
"."
] | [
"func",
"(",
"manager",
"*",
"metadataManager",
")",
"parseMetadataAtContainerCreate",
"(",
"task",
"*",
"apitask",
".",
"Task",
",",
"containerName",
"string",
")",
"Metadata",
"{",
"return",
"Metadata",
"{",
"cluster",
":",
"manager",
".",
"cluster",
",",
"taskMetadata",
":",
"TaskMetadata",
"{",
"containerName",
":",
"containerName",
",",
"taskARN",
":",
"task",
".",
"Arn",
",",
"taskDefinitionFamily",
":",
"task",
".",
"Family",
",",
"taskDefinitionRevision",
":",
"task",
".",
"<mask>",
",",
"}",
",",
"containerInstanceARN",
":",
"manager",
".",
"containerInstanceARN",
",",
"metadataStatus",
":",
"MetadataInitial",
",",
"availabilityZone",
":",
"manager",
".",
"availabilityZone",
",",
"hostPublicIPv4Address",
":",
"manager",
".",
"hostPublicIPv4Address",
",",
"}",
"\n",
"}"
] |
24,895 | all-24896 | [
"MarshalJSON",
"supports",
"json",
".",
"Marshaler",
"interface"
] | [
"func",
"(",
"v",
"DOMNode",
")",
"MarshalJSON",
"(",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"w",
":=",
"jwriter",
".",
"Writer",
"{",
"}",
"\n",
"easyjsonC5a4559bEncodeGithubComChromedpCdprotoDomsnapshot12",
"(",
"&",
"w",
",",
"v",
")",
"\n",
"return",
"w",
".",
"<mask>",
".",
"BuildBytes",
"(",
")",
",",
"w",
".",
"Error",
"\n",
"}"
] |
24,896 | all-24897 | [
"CreateAPIKey",
"creates",
"an",
"API",
"key",
"from",
"given",
"struct",
"and",
"fills",
"the",
"rest",
"of",
"its",
"fields",
"or",
"returns",
"an",
"error",
"on",
"failure"
] | [
"func",
"(",
"client",
"*",
"Client",
")",
"CreateAPIKey",
"(",
"<mask>",
"string",
")",
"(",
"*",
"APIKey",
",",
"error",
")",
"{",
"toPost",
":=",
"struct",
"{",
"Name",
"*",
"string",
"`json:\"name,omitempty\"`",
"\n",
"}",
"{",
"&",
"name",
",",
"}",
"\n",
"var",
"out",
"reqAPIKey",
"\n",
"if",
"err",
":=",
"client",
".",
"doJsonRequest",
"(",
"\"",
"\"",
",",
"\"",
"\"",
",",
"toPost",
",",
"&",
"out",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"return",
"out",
".",
"APIKey",
",",
"nil",
"\n",
"}"
] |
24,897 | all-24898 | [
"UnmarshalText",
"hydrates",
"this",
"instance",
"from",
"text"
] | [
"func",
"(",
"u",
"*",
"MAC",
")",
"UnmarshalText",
"(",
"data",
"[",
"]",
"<mask>",
")",
"error",
"{",
"// validation is performed later on",
"*",
"u",
"=",
"MAC",
"(",
"string",
"(",
"data",
")",
")",
"\n",
"return",
"nil",
"\n",
"}"
] |
24,898 | all-24899 | [
"Command",
"executes",
"command",
"args",
"...",
".",
"The",
"filter",
"s",
"input",
"items",
"are",
"fed",
"as",
"standard",
"input",
"to",
"the",
"command",
"one",
"line",
"per",
"input",
"item",
".",
"The",
"standard",
"output",
"of",
"the",
"command",
"is",
"split",
"into",
"lines",
"and",
"the",
"lines",
"form",
"the",
"output",
"of",
"the",
"filter",
"(",
"with",
"trailing",
"newlines",
"removed",
")",
"."
] | [
"func",
"Command",
"(",
"command",
"string",
",",
"args",
"...",
"string",
")",
"Filter",
"{",
"return",
"FilterFunc",
"(",
"func",
"(",
"arg",
"Arg",
")",
"error",
"{",
"cmd",
":=",
"exec",
".",
"Command",
"(",
"command",
",",
"args",
"...",
")",
"\n",
"input",
",",
"err",
":=",
"cmd",
".",
"StdinPipe",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"output",
",",
"err",
":=",
"cmd",
".",
"StdoutPipe",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"if",
"err",
":=",
"cmd",
".",
"Start",
"(",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"var",
"ierr",
"error",
"// Records error writing to command input",
"\n",
"<mask>",
"wg",
"sync",
".",
"WaitGroup",
"\n",
"wg",
".",
"Add",
"(",
"1",
")",
"\n",
"go",
"func",
"(",
")",
"{",
"defer",
"wg",
".",
"Done",
"(",
")",
"\n",
"for",
"s",
":=",
"range",
"arg",
".",
"In",
"{",
"_",
",",
"ierr",
"=",
"fmt",
".",
"Fprintln",
"(",
"input",
",",
"s",
")",
"\n",
"if",
"ierr",
"!=",
"nil",
"{",
"input",
".",
"Close",
"(",
")",
"\n",
"return",
"\n",
"}",
"\n",
"}",
"\n",
"ierr",
"=",
"input",
".",
"Close",
"(",
")",
"\n",
"}",
"(",
")",
"\n",
"if",
"err",
":=",
"splitIntoLines",
"(",
"output",
",",
"arg",
")",
";",
"err",
"!=",
"nil",
"{",
"wg",
".",
"Wait",
"(",
")",
"\n",
"cmd",
".",
"Wait",
"(",
")",
"\n",
"return",
"err",
"\n",
"}",
"\n",
"err",
"=",
"cmd",
".",
"Wait",
"(",
")",
"\n",
"wg",
".",
"Wait",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"return",
"ierr",
"\n",
"}",
")",
"\n",
"}"
] |
24,899 | all-24900 | [
"NotFound",
"configurates",
"http",
".",
"HandlerFunc",
"which",
"is",
"called",
"when",
"no",
"matching",
"route",
"is",
"found",
".",
"If",
"it",
"is",
"not",
"set",
"http",
".",
"NotFound",
"is",
"used",
".",
"Be",
"sure",
"to",
"set",
"404",
"response",
"code",
"in",
"your",
"handler",
"."
] | [
"func",
"(",
"r",
"*",
"Router",
")",
"NotFound",
"(",
"handlers",
"...",
"Handler",
")",
"{",
"handlers",
"=",
"validateAndWrapHandlers",
"(",
"handlers",
")",
"\n",
"r",
".",
"notFound",
"=",
"func",
"(",
"rw",
"http",
".",
"ResponseWriter",
",",
"req",
"*",
"<mask>",
".",
"Request",
")",
"{",
"c",
":=",
"r",
".",
"m",
".",
"createContext",
"(",
"rw",
",",
"req",
")",
"\n",
"c",
".",
"handlers",
"=",
"make",
"(",
"[",
"]",
"Handler",
",",
"0",
",",
"len",
"(",
"r",
".",
"m",
".",
"handlers",
")",
"+",
"len",
"(",
"handlers",
")",
")",
"\n",
"c",
".",
"handlers",
"=",
"append",
"(",
"c",
".",
"handlers",
",",
"r",
".",
"m",
".",
"handlers",
"...",
")",
"\n",
"c",
".",
"handlers",
"=",
"append",
"(",
"c",
".",
"handlers",
",",
"handlers",
"...",
")",
"\n",
"c",
".",
"run",
"(",
")",
"\n",
"}",
"\n",
"}"
] |
Subsets and Splits