id
int32 0
25.3k
| idx
stringlengths 5
9
| nl_tokens
listlengths 1
418
| pl_tokens
listlengths 22
4.98k
|
---|---|---|---|
20,500 | all-20501 | [
"GetUnitOk",
"returns",
"a",
"tuple",
"with",
"the",
"Unit",
"field",
"if",
"it",
"s",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"and",
"a",
"boolean",
"to",
"check",
"if",
"the",
"value",
"has",
"been",
"set",
"."
] | [
"func",
"(",
"w",
"*",
"Widget",
")",
"GetUnitOk",
"(",
")",
"(",
"string",
",",
"bool",
")",
"{",
"if",
"w",
"==",
"nil",
"||",
"w",
".",
"Unit",
"==",
"nil",
"{",
"return",
"\"",
"\"",
",",
"false",
"\n",
"}",
"\n",
"return",
"*",
"w",
".",
"Unit",
",",
"<mask>",
"\n",
"}"
] |
20,501 | all-20502 | [
"UnmarshalJSON",
"supports",
"json",
".",
"Unmarshaler",
"interface"
] | [
"func",
"(",
"v",
"*",
"StartViolationsReportParams",
")",
"UnmarshalJSON",
"(",
"<mask>",
"[",
"]",
"byte",
")",
"error",
"{",
"r",
":=",
"jlexer",
".",
"Lexer",
"{",
"Data",
":",
"data",
"}",
"\n",
"easyjsonC5a4559bDecodeGithubComChromedpCdprotoLog2",
"(",
"&",
"r",
",",
"v",
")",
"\n",
"return",
"r",
".",
"Error",
"(",
")",
"\n",
"}"
] |
20,502 | all-20503 | [
"GetFocusOnClick",
"()",
"is",
"a",
"wrapper",
"around",
"gtk_button_get_focus_on_click",
"()",
"."
] | [
"func",
"(",
"v",
"*",
"Button",
")",
"GetFocusOnClick",
"(",
")",
"bool",
"{",
"c",
":=",
"C",
".",
"gtk_button_get_focus_on_click",
"(",
"v",
".",
"native",
"(",
")",
")",
"\n",
"<mask>",
"gobool",
"(",
"c",
")",
"\n",
"}"
] |
20,503 | all-20504 | [
"UnmarshalJSON",
"supports",
"json",
".",
"Unmarshaler",
"interface"
] | [
"func",
"(",
"v",
"*",
"InspectWorkerParams",
")",
"UnmarshalJSON",
"(",
"data",
"[",
"]",
"byte",
")",
"error",
"{",
"r",
":=",
"jlexer",
".",
"Lexer",
"{",
"Data",
":",
"<mask>",
"}",
"\n",
"easyjsonC5a4559bDecodeGithubComChromedpCdprotoServiceworker9",
"(",
"&",
"r",
",",
"v",
")",
"\n",
"return",
"r",
".",
"Error",
"(",
")",
"\n",
"}"
] |
20,504 | all-20505 | [
"Lookup",
"()",
"is",
"a",
"wrapper",
"around",
"gtk_text_tag_table_lookup",
"()",
"."
] | [
"func",
"(",
"v",
"*",
"TextTagTable",
")",
"Lookup",
"(",
"<mask>",
"string",
")",
"(",
"*",
"TextTag",
",",
"error",
")",
"{",
"cname",
":=",
"C",
".",
"CString",
"(",
"name",
")",
"\n",
"defer",
"C",
".",
"free",
"(",
"unsafe",
".",
"Pointer",
"(",
"cname",
")",
")",
"\n",
"c",
":=",
"C",
".",
"gtk_text_tag_table_lookup",
"(",
"v",
".",
"native",
"(",
")",
",",
"(",
"*",
"C",
".",
"gchar",
")",
"(",
"cname",
")",
")",
"\n",
"if",
"c",
"==",
"nil",
"{",
"return",
"nil",
",",
"nilPtrErr",
"\n",
"}",
"\n",
"return",
"wrapTextTag",
"(",
"glib",
".",
"Take",
"(",
"unsafe",
".",
"Pointer",
"(",
"c",
")",
")",
")",
",",
"nil",
"\n",
"}"
] |
20,505 | all-20506 | [
"WriteMultipartForm",
"writes",
"the",
"given",
"multipart",
"form",
"f",
"with",
"the",
"given",
"boundary",
"to",
"w",
"."
] | [
"func",
"WriteMultipartForm",
"(",
"w",
"io",
".",
"<mask>",
",",
"f",
"*",
"multipart",
".",
"Form",
",",
"boundary",
"string",
")",
"error",
"{",
"// Do not care about memory allocations here, since multipart",
"// form processing is slow.",
"if",
"len",
"(",
"boundary",
")",
"==",
"0",
"{",
"panic",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"mw",
":=",
"multipart",
".",
"NewWriter",
"(",
"w",
")",
"\n",
"if",
"err",
":=",
"mw",
".",
"SetBoundary",
"(",
"boundary",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"boundary",
",",
"err",
")",
"\n",
"}",
"\n\n",
"// marshal values",
"for",
"k",
",",
"vv",
":=",
"range",
"f",
".",
"Value",
"{",
"for",
"_",
",",
"v",
":=",
"range",
"vv",
"{",
"if",
"err",
":=",
"mw",
".",
"WriteField",
"(",
"k",
",",
"v",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"k",
",",
"v",
",",
"err",
")",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n\n",
"// marshal files",
"for",
"k",
",",
"fvv",
":=",
"range",
"f",
".",
"File",
"{",
"for",
"_",
",",
"fv",
":=",
"range",
"fvv",
"{",
"vw",
",",
"err",
":=",
"mw",
".",
"CreatePart",
"(",
"fv",
".",
"Header",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"k",
",",
"fv",
".",
"Filename",
",",
"err",
")",
"\n",
"}",
"\n",
"fh",
",",
"err",
":=",
"fv",
".",
"Open",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"k",
",",
"fv",
".",
"Filename",
",",
"err",
")",
"\n",
"}",
"\n",
"if",
"_",
",",
"err",
"=",
"copyZeroAlloc",
"(",
"vw",
",",
"fh",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"k",
",",
"fv",
".",
"Filename",
",",
"err",
")",
"\n",
"}",
"\n",
"if",
"err",
"=",
"fh",
".",
"Close",
"(",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"k",
",",
"fv",
".",
"Filename",
",",
"err",
")",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n\n",
"if",
"err",
":=",
"mw",
".",
"Close",
"(",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"}",
"\n\n",
"return",
"nil",
"\n",
"}"
] |
20,506 | all-20507 | [
"ValidateTemplates",
"returns",
"a",
"genny",
".",
"RunFn",
"that",
"will",
"walk",
"the",
"given",
"box",
"and",
"run",
"each",
"of",
"the",
"files",
"found",
"through",
"each",
"of",
"the",
"template",
"validators"
] | [
"func",
"ValidateTemplates",
"(",
"walk",
"packd",
".",
"Walker",
",",
"tvs",
"[",
"]",
"TemplateValidator",
")",
"genny",
".",
"RunFn",
"{",
"if",
"len",
"(",
"tvs",
")",
"==",
"0",
"{",
"return",
"func",
"(",
"r",
"*",
"genny",
".",
"Runner",
")",
"error",
"{",
"return",
"nil",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"func",
"(",
"r",
"*",
"genny",
".",
"Runner",
")",
"error",
"{",
"var",
"errs",
"[",
"]",
"string",
"\n",
"err",
":=",
"packd",
".",
"SkipWalker",
"(",
"walk",
",",
"packd",
".",
"CommonSkipPrefixes",
",",
"func",
"(",
"path",
"string",
",",
"file",
"packd",
".",
"File",
")",
"error",
"{",
"info",
",",
"err",
":=",
"file",
".",
"FileInfo",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"if",
"info",
".",
"IsDir",
"(",
")",
"{",
"return",
"nil",
"\n",
"}",
"\n\n",
"f",
":=",
"genny",
".",
"NewFile",
"(",
"path",
",",
"file",
")",
"\n",
"for",
"_",
",",
"tv",
":=",
"range",
"tvs",
"{",
"err",
":=",
"safe",
".",
"Run",
"(",
"func",
"(",
")",
"{",
"if",
"err",
":=",
"tv",
"(",
"f",
")",
";",
"err",
"!=",
"nil",
"{",
"errs",
"=",
"append",
"(",
"errs",
",",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"path",
",",
"err",
".",
"<mask>",
"(",
")",
")",
")",
"\n",
"}",
"\n",
"}",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"}",
"\n\n",
"return",
"nil",
"\n",
"}",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"if",
"len",
"(",
"errs",
")",
"==",
"0",
"{",
"return",
"nil",
"\n",
"}",
"\n",
"return",
"errors",
".",
"New",
"(",
"strings",
".",
"Join",
"(",
"errs",
",",
"\"",
"\\n",
"\"",
")",
")",
"\n",
"}",
"\n",
"}"
] |
20,507 | all-20508 | [
"AddShortcutFolder",
"is",
"a",
"wrapper",
"around",
"gtk_file_chooser_add_shortcut_folder",
"()",
"."
] | [
"func",
"(",
"v",
"*",
"FileChooser",
")",
"AddShortcutFolder",
"(",
"folder",
"string",
")",
"bool",
"{",
"cstr",
":=",
"C",
".",
"CString",
"(",
"folder",
")",
"\n",
"defer",
"C",
".",
"<mask>",
"(",
"unsafe",
".",
"Pointer",
"(",
"cstr",
")",
")",
"\n",
"c",
":=",
"C",
".",
"gtk_file_chooser_add_shortcut_folder",
"(",
"v",
".",
"native",
"(",
")",
",",
"cstr",
",",
"nil",
")",
"\n",
"return",
"gobool",
"(",
"c",
")",
"\n",
"}"
] |
20,508 | all-20509 | [
"Count",
"returns",
"the",
"number",
"of",
"elements",
"that",
"the",
"selection",
"refers",
"to",
"."
] | [
"func",
"(",
"s",
"*",
"Selection",
")",
"Count",
"(",
")",
"(",
"int",
",",
"error",
")",
"{",
"elements",
",",
"err",
":=",
"s",
".",
"elements",
".",
"Get",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"0",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"s",
",",
"<mask>",
")",
"\n",
"}",
"\n\n",
"return",
"len",
"(",
"elements",
")",
",",
"nil",
"\n",
"}"
] |
20,509 | all-20510 | [
"Format",
"formats",
"the",
"node",
"."
] | [
"func",
"(",
"node",
"*",
"SetExpr",
")",
"Format",
"(",
"buf",
"*",
"TrackedBuffer",
")",
"{",
"// We don't have to backtick set variable names.",
"if",
"node",
".",
"Name",
".",
"EqualString",
"(",
"\"",
"\"",
")",
"||",
"<mask>",
".",
"Name",
".",
"EqualString",
"(",
"\"",
"\"",
")",
"{",
"buf",
".",
"Myprintf",
"(",
"\"",
"\"",
",",
"node",
".",
"Name",
".",
"String",
"(",
")",
",",
"node",
".",
"Expr",
")",
"\n",
"}",
"else",
"{",
"buf",
".",
"Myprintf",
"(",
"\"",
"\"",
",",
"node",
".",
"Name",
".",
"String",
"(",
")",
",",
"node",
".",
"Expr",
")",
"\n",
"}",
"\n",
"}"
] |
20,510 | all-20511 | [
"Caller",
"returns",
"a",
"caller",
"s",
"call",
"location",
".",
"If",
"F1",
"calls",
"F2",
"which",
"in",
"its",
"turn",
"calls",
"Caller",
"then",
"this",
"function",
"will",
"return",
"a",
"location",
"within",
"F1",
"where",
"it",
"calls",
"F2",
"."
] | [
"func",
"Caller",
"(",
")",
"string",
"{",
"_",
",",
"file",
",",
"line",
",",
"ok",
":=",
"runtime",
".",
"Caller",
"(",
"2",
")",
"\n",
"if",
"!",
"ok",
"{",
"return",
"\"",
"\"",
"\n",
"}",
"\n\n",
"rel",
",",
"err",
":=",
"filepath",
".",
"Rel",
"(",
"RootPath",
"(",
")",
",",
"file",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"\"",
"\"",
"\n",
"}",
"\n\n",
"return",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"rel",
",",
"<mask>",
")",
"\n",
"}"
] |
20,511 | all-20512 | [
"ReceiveEvent",
"is",
"called",
"when",
"something",
"happens",
"on",
"an",
"issue",
".",
"The",
"state",
"for",
"that",
"issue",
"is",
"updated",
"."
] | [
"func",
"(",
"b",
"BundledStates",
")",
"ReceiveEvent",
"(",
"ID",
"string",
",",
"eventName",
",",
"label",
"string",
",",
"t",
"time",
".",
"Time",
")",
"bool",
"{",
"state",
",",
"ok",
":=",
"b",
".",
"states",
"[",
"<mask>",
"]",
"\n",
"if",
"!",
"ok",
"{",
"state",
"=",
"NewState",
"(",
"b",
".",
"description",
")",
"\n",
"}",
"\n",
"state",
",",
"changed",
":=",
"state",
".",
"ReceiveEvent",
"(",
"eventName",
",",
"label",
",",
"t",
")",
"\n",
"b",
".",
"states",
"[",
"ID",
"]",
"=",
"state",
"\n",
"return",
"changed",
"\n",
"}"
] |
20,512 | all-20513 | [
"NewDiscovery",
"returns",
"a",
"Discoverer",
"function",
"that",
"calls",
"a",
"refresh",
"()",
"function",
"at",
"every",
"interval",
"."
] | [
"func",
"NewDiscovery",
"(",
"l",
"log",
".",
"Logger",
",",
"mech",
"string",
",",
"interval",
"time",
".",
"Duration",
",",
"refreshf",
"func",
"(",
"ctx",
"context",
".",
"Context",
")",
"(",
"[",
"]",
"*",
"targetgroup",
".",
"<mask>",
",",
"error",
")",
")",
"*",
"Discovery",
"{",
"if",
"l",
"==",
"nil",
"{",
"l",
"=",
"log",
".",
"NewNopLogger",
"(",
")",
"\n",
"}",
"\n",
"return",
"&",
"Discovery",
"{",
"logger",
":",
"l",
",",
"interval",
":",
"interval",
",",
"refreshf",
":",
"refreshf",
",",
"failures",
":",
"failuresCount",
".",
"WithLabelValues",
"(",
"mech",
")",
",",
"duration",
":",
"duration",
".",
"WithLabelValues",
"(",
"mech",
")",
",",
"}",
"\n",
"}"
] |
20,513 | all-20514 | [
"UnmarshalJSON",
"supports",
"json",
".",
"Unmarshaler",
"interface"
] | [
"func",
"(",
"v",
"*",
"SetBreakpointByURLParams",
")",
"UnmarshalJSON",
"(",
"data",
"[",
"]",
"<mask>",
")",
"error",
"{",
"r",
":=",
"jlexer",
".",
"Lexer",
"{",
"Data",
":",
"data",
"}",
"\n",
"easyjsonC5a4559bDecodeGithubComChromedpCdprotoDebugger15",
"(",
"&",
"r",
",",
"v",
")",
"\n",
"return",
"r",
".",
"Error",
"(",
")",
"\n",
"}"
] |
20,514 | all-20515 | [
"ImagesGet",
"returns",
"the",
"names",
"of",
"all",
"images",
"(",
"optionally",
"only",
"the",
"public",
"ones",
")",
"."
] | [
"func",
"(",
"c",
"*",
"Cluster",
")",
"ImagesGet",
"(",
"project",
"string",
",",
"public",
"bool",
")",
"(",
"[",
"]",
"string",
",",
"error",
")",
"{",
"err",
":=",
"c",
".",
"Transaction",
"(",
"func",
"(",
"tx",
"*",
"ClusterTx",
")",
"error",
"{",
"enabled",
",",
"err",
":=",
"tx",
".",
"ProjectHasImages",
"(",
"<mask>",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"errors",
".",
"Wrap",
"(",
"err",
",",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"if",
"!",
"enabled",
"{",
"project",
"=",
"\"",
"\"",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"q",
":=",
"`\nSELECT fingerprint\n FROM images\n JOIN projects ON projects.id = images.project_id\n WHERE projects.name = ?\n`",
"\n",
"if",
"public",
"==",
"true",
"{",
"q",
"+=",
"\"",
"\"",
"\n",
"}",
"\n\n",
"var",
"fp",
"string",
"\n",
"inargs",
":=",
"[",
"]",
"interface",
"{",
"}",
"{",
"project",
"}",
"\n",
"outfmt",
":=",
"[",
"]",
"interface",
"{",
"}",
"{",
"fp",
"}",
"\n",
"dbResults",
",",
"err",
":=",
"queryScan",
"(",
"c",
".",
"db",
",",
"q",
",",
"inargs",
",",
"outfmt",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"[",
"]",
"string",
"{",
"}",
",",
"err",
"\n",
"}",
"\n\n",
"results",
":=",
"[",
"]",
"string",
"{",
"}",
"\n",
"for",
"_",
",",
"r",
":=",
"range",
"dbResults",
"{",
"results",
"=",
"append",
"(",
"results",
",",
"r",
"[",
"0",
"]",
".",
"(",
"string",
")",
")",
"\n",
"}",
"\n\n",
"return",
"results",
",",
"nil",
"\n",
"}"
] |
20,515 | all-20516 | [
"FindOne",
"-"
] | [
"func",
"(",
"s",
"*",
"FakeCollection",
")",
"FindOne",
"(",
"id",
"string",
",",
"result",
"interface",
"{",
"}",
")",
"(",
"err",
"error",
")",
"{",
"err",
"=",
"s",
".",
"ErrControl",
"\n",
"*",
"(",
"result",
".",
"(",
"*",
"taskmanager",
".",
"<mask>",
")",
")",
"=",
"s",
".",
"ControlTask",
"\n",
"return",
"\n",
"}"
] |
20,516 | all-20517 | [
"NewMockAuditLogger",
"creates",
"a",
"new",
"mock",
"instance"
] | [
"func",
"NewMockAuditLogger",
"(",
"ctrl",
"*",
"gomock",
".",
"<mask>",
")",
"*",
"MockAuditLogger",
"{",
"mock",
":=",
"&",
"MockAuditLogger",
"{",
"ctrl",
":",
"ctrl",
"}",
"\n",
"mock",
".",
"recorder",
"=",
"&",
"MockAuditLoggerMockRecorder",
"{",
"mock",
"}",
"\n",
"return",
"mock",
"\n",
"}"
] |
20,517 | all-20518 | [
"MarshalJSON",
"supports",
"json",
".",
"Marshaler",
"interface"
] | [
"func",
"(",
"v",
"QuerySelectorParams",
")",
"MarshalJSON",
"(",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"w",
":=",
"jwriter",
".",
"<mask>",
"{",
"}",
"\n",
"easyjsonC5a4559bEncodeGithubComChromedpCdprotoDom20",
"(",
"&",
"w",
",",
"v",
")",
"\n",
"return",
"w",
".",
"Buffer",
".",
"BuildBytes",
"(",
")",
",",
"w",
".",
"Error",
"\n",
"}"
] |
20,518 | all-20519 | [
"Start",
"a",
"single",
"task",
"executing",
"the",
"given",
"function",
"with",
"the",
"given",
"schedule",
".",
"This",
"is",
"a",
"convenience",
"around",
"Group",
"and",
"it",
"returns",
"two",
"functions",
"that",
"can",
"be",
"used",
"to",
"control",
"the",
"task",
".",
"The",
"first",
"is",
"a",
"stop",
"function",
"trying",
"to",
"terminate",
"the",
"task",
"gracefully",
"within",
"the",
"given",
"timeout",
"and",
"the",
"second",
"is",
"a",
"reset",
"function",
"to",
"reset",
"the",
"task",
"s",
"state",
".",
"See",
"Group",
".",
"Stop",
"()",
"and",
"Group",
".",
"Reset",
"()",
"for",
"more",
"details",
"."
] | [
"func",
"Start",
"(",
"f",
"Func",
",",
"schedule",
"Schedule",
")",
"(",
"func",
"(",
"time",
".",
"Duration",
")",
"error",
",",
"func",
"(",
")",
")",
"{",
"group",
":=",
"Group",
"{",
"}",
"\n",
"task",
":=",
"group",
".",
"Add",
"(",
"f",
",",
"schedule",
")",
"\n",
"group",
".",
"Start",
"(",
")",
"\n\n",
"stop",
":=",
"<mask>",
".",
"Stop",
"\n",
"reset",
":=",
"task",
".",
"Reset",
"\n\n",
"return",
"stop",
",",
"reset",
"\n",
"}"
] |
20,519 | all-20520 | [
"Specify",
"the",
"value",
"of",
"a",
"uniform",
"variable",
"for",
"a",
"specified",
"program",
"object"
] | [
"func",
"ProgramUniform1uiv",
"(",
"program",
"uint32",
",",
"<mask>",
"int32",
",",
"count",
"int32",
",",
"value",
"*",
"uint32",
")",
"{",
"C",
".",
"glowProgramUniform1uiv",
"(",
"gpProgramUniform1uiv",
",",
"(",
"C",
".",
"GLuint",
")",
"(",
"program",
")",
",",
"(",
"C",
".",
"GLint",
")",
"(",
"location",
")",
",",
"(",
"C",
".",
"GLsizei",
")",
"(",
"count",
")",
",",
"(",
"*",
"C",
".",
"GLuint",
")",
"(",
"unsafe",
".",
"Pointer",
"(",
"value",
")",
")",
")",
"\n",
"}"
] |
20,520 | all-20521 | [
"String",
"converts",
"TransportProtocol",
"to",
"a",
"string"
] | [
"func",
"(",
"tp",
"*",
"TransportProtocol",
")",
"String",
"(",
")",
"string",
"{",
"if",
"tp",
"==",
"nil",
"{",
"return",
"tcp",
"\n",
"}",
"\n",
"switch",
"*",
"tp",
"{",
"case",
"TransportProtocolUDP",
":",
"return",
"udp",
"\n",
"case",
"TransportProtocolTCP",
":",
"return",
"tcp",
"\n",
"<mask>",
":",
"seelog",
".",
"Critical",
"(",
"\"",
"\"",
")",
"\n",
"return",
"tcp",
"\n",
"}",
"\n",
"}"
] |
20,521 | all-20522 | [
"Used",
"to",
"promote",
"the",
"local",
"non",
"-",
"database",
"node",
"to",
"be",
"a",
"database",
"one",
"."
] | [
"func",
"internalClusterPostPromote",
"(",
"d",
"*",
"Daemon",
",",
"r",
"*",
"http",
".",
"Request",
")",
"Response",
"{",
"req",
":=",
"internalClusterPostPromoteRequest",
"{",
"}",
"\n\n",
"// Parse the request",
"err",
":=",
"json",
".",
"NewDecoder",
"(",
"r",
".",
"Body",
")",
".",
"Decode",
"(",
"&",
"req",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"BadRequest",
"(",
"err",
")",
"\n",
"}",
"\n\n",
"// Sanity checks",
"if",
"len",
"(",
"req",
".",
"RaftNodes",
")",
"==",
"0",
"{",
"return",
"BadRequest",
"(",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
")",
")",
"\n",
"}",
"\n\n",
"nodes",
":=",
"make",
"(",
"[",
"]",
"db",
".",
"RaftNode",
",",
"len",
"(",
"req",
".",
"RaftNodes",
")",
")",
"\n",
"for",
"i",
",",
"node",
":=",
"range",
"req",
".",
"RaftNodes",
"{",
"nodes",
"[",
"i",
"]",
".",
"ID",
"=",
"<mask>",
".",
"ID",
"\n",
"nodes",
"[",
"i",
"]",
".",
"Address",
"=",
"node",
".",
"Address",
"\n",
"}",
"\n",
"err",
"=",
"cluster",
".",
"Promote",
"(",
"d",
".",
"State",
"(",
")",
",",
"d",
".",
"gateway",
",",
"nodes",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"SmartError",
"(",
"err",
")",
"\n",
"}",
"\n\n",
"return",
"SyncResponse",
"(",
"true",
",",
"nil",
")",
"\n",
"}"
] |
20,522 | all-20523 | [
"create",
"transform",
"feedback",
"objects"
] | [
"func",
"CreateTransformFeedbacks",
"(",
"n",
"int32",
",",
"ids",
"*",
"uint32",
")",
"{",
"syscall",
".",
"Syscall",
"(",
"gpCreateTransformFeedbacks",
",",
"2",
",",
"uintptr",
"(",
"n",
")",
",",
"uintptr",
"(",
"unsafe",
".",
"Pointer",
"(",
"<mask>",
")",
")",
",",
"0",
")",
"\n",
"}"
] |
20,523 | all-20524 | [
"NetworkInterfaceDiffOperation",
"performs",
"operations",
"relevant",
"to",
"managing",
"the",
"diff",
"on",
"network_interface",
"sub",
"-",
"resources",
"."
] | [
"func",
"NetworkInterfaceDiffOperation",
"(",
"d",
"*",
"schema",
".",
"ResourceDiff",
",",
"c",
"*",
"govmomi",
".",
"Client",
")",
"error",
"{",
"// We just need the new values for now, as all we are doing is validating some values based on API version",
"n",
":=",
"d",
".",
"Get",
"(",
"subresourceTypeNetworkInterface",
")",
"\n",
"log",
".",
"Printf",
"(",
"\"",
"\"",
")",
"\n",
"for",
"ni",
",",
"<mask>",
":=",
"range",
"n",
".",
"(",
"[",
"]",
"interface",
"{",
"}",
")",
"{",
"nm",
":=",
"ne",
".",
"(",
"map",
"[",
"string",
"]",
"interface",
"{",
"}",
")",
"\n",
"r",
":=",
"NewNetworkInterfaceSubresource",
"(",
"c",
",",
"d",
",",
"nm",
",",
"nil",
",",
"ni",
")",
"\n",
"if",
"err",
":=",
"r",
".",
"ValidateDiff",
"(",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"r",
".",
"Addr",
"(",
")",
",",
"err",
")",
"\n",
"}",
"\n",
"}",
"\n",
"log",
".",
"Printf",
"(",
"\"",
"\"",
")",
"\n",
"return",
"nil",
"\n",
"}"
] |
20,524 | all-20525 | [
"GetEventSizeOk",
"returns",
"a",
"tuple",
"with",
"the",
"EventSize",
"field",
"if",
"it",
"s",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"and",
"a",
"boolean",
"to",
"check",
"if",
"the",
"value",
"has",
"been",
"set",
"."
] | [
"func",
"(",
"w",
"*",
"Widget",
")",
"GetEventSizeOk",
"(",
")",
"(",
"string",
",",
"bool",
")",
"{",
"if",
"w",
"==",
"nil",
"||",
"w",
".",
"EventSize",
"==",
"nil",
"{",
"return",
"\"",
"\"",
",",
"false",
"\n",
"}",
"\n",
"return",
"*",
"w",
".",
"EventSize",
",",
"<mask>",
"\n",
"}"
] |
20,525 | all-20526 | [
"UnmarshalJSON",
"supports",
"json",
".",
"Unmarshaler",
"interface"
] | [
"func",
"(",
"v",
"*",
"DataEntry",
")",
"UnmarshalJSON",
"(",
"data",
"[",
"]",
"<mask>",
")",
"error",
"{",
"r",
":=",
"jlexer",
".",
"Lexer",
"{",
"Data",
":",
"data",
"}",
"\n",
"easyjsonC5a4559bDecodeGithubComChromedpCdprotoIndexeddb18",
"(",
"&",
"r",
",",
"v",
")",
"\n",
"return",
"r",
".",
"Error",
"(",
")",
"\n",
"}"
] |
20,526 | all-20527 | [
"GetActiveIter",
"is",
"a",
"wrapper",
"around",
"gtk_combo_box_get_active_iter",
"()",
"."
] | [
"func",
"(",
"v",
"*",
"ComboBox",
")",
"GetActiveIter",
"(",
")",
"(",
"*",
"TreeIter",
",",
"error",
")",
"{",
"var",
"cIter",
"C",
".",
"GtkTreeIter",
"\n",
"c",
":=",
"C",
".",
"gtk_combo_box_get_active_iter",
"(",
"v",
".",
"native",
"(",
")",
",",
"&",
"cIter",
")",
"\n",
"if",
"!",
"gobool",
"(",
"c",
")",
"{",
"return",
"nil",
",",
"<mask>",
".",
"New",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"return",
"&",
"TreeIter",
"{",
"cIter",
"}",
",",
"nil",
"\n",
"}"
] |
20,527 | all-20528 | [
"getLabels",
"is",
"a",
"helper",
"function",
"that",
"retrieves",
"a",
"paginated",
"list",
"of",
"labels",
"from",
"a",
"github",
"URI",
"path",
"."
] | [
"func",
"(",
"c",
"*",
"Client",
")",
"getLabels",
"(",
"path",
"string",
")",
"(",
"[",
"]",
"Label",
",",
"error",
")",
"{",
"var",
"labels",
"[",
"]",
"Label",
"\n",
"if",
"c",
".",
"fake",
"{",
"return",
"labels",
",",
"nil",
"\n",
"}",
"\n",
"err",
":=",
"c",
".",
"readPaginatedResults",
"(",
"path",
",",
"\"",
"\"",
",",
"// allow the description field -- https://developer.github.com/changes/2018-02-22-label-description-search-preview/",
"func",
"(",
")",
"interface",
"{",
"}",
"{",
"return",
"&",
"[",
"]",
"Label",
"{",
"}",
"\n",
"}",
",",
"func",
"(",
"obj",
"interface",
"{",
"}",
")",
"{",
"labels",
"=",
"<mask>",
"(",
"labels",
",",
"*",
"(",
"obj",
".",
"(",
"*",
"[",
"]",
"Label",
")",
")",
"...",
")",
"\n",
"}",
",",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"return",
"labels",
",",
"nil",
"\n",
"}"
] |
20,528 | all-20529 | [
"Persist",
"the",
"flash",
"inside",
"the",
"session",
"."
] | [
"func",
"(",
"f",
"Flash",
")",
"persist",
"(",
"<mask>",
"*",
"Session",
")",
"{",
"b",
",",
"_",
":=",
"json",
".",
"Marshal",
"(",
"f",
".",
"data",
")",
"\n",
"session",
".",
"Set",
"(",
"flashKey",
",",
"b",
")",
"\n",
"session",
".",
"Save",
"(",
")",
"\n",
"}"
] |
20,529 | all-20530 | [
"specify",
"the",
"alpha",
"test",
"function"
] | [
"func",
"AlphaFunc",
"(",
"xfunc",
"uint32",
",",
"<mask>",
"float32",
")",
"{",
"syscall",
".",
"Syscall",
"(",
"gpAlphaFunc",
",",
"2",
",",
"uintptr",
"(",
"xfunc",
")",
",",
"uintptr",
"(",
"math",
".",
"Float32bits",
"(",
"ref",
")",
")",
",",
"0",
")",
"\n",
"}"
] |
20,530 | all-20531 | [
"newHelperMethodYield",
"creates",
"and",
"returns",
"a",
"helper",
"method",
"yield",
"."
] | [
"func",
"newHelperMethodYield",
"(",
"ln",
"*",
"line",
",",
"rslt",
"*",
"result",
",",
"src",
"*",
"source",
",",
"parent",
"<mask>",
",",
"opts",
"*",
"Options",
")",
"(",
"*",
"helperMethodYield",
",",
"error",
")",
"{",
"if",
"len",
"(",
"ln",
".",
"tokens",
")",
"<",
"3",
"{",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"ln",
".",
"fileName",
"(",
")",
",",
"ln",
".",
"no",
")",
"\n",
"}",
"\n\n",
"e",
":=",
"&",
"helperMethodYield",
"{",
"elementBase",
":",
"newElementBase",
"(",
"ln",
",",
"rslt",
",",
"src",
",",
"parent",
",",
"opts",
")",
",",
"templateName",
":",
"ln",
".",
"tokens",
"[",
"2",
"]",
",",
"}",
"\n\n",
"return",
"e",
",",
"nil",
"\n",
"}"
] |
20,531 | all-20532 | [
"New",
"mailer",
"generator",
".",
"It",
"will",
"init",
"the",
"mailers",
"directory",
"if",
"it",
"doesn",
"t",
"already",
"exist"
] | [
"func",
"New",
"(",
"opts",
"*",
"Options",
")",
"(",
"*",
"genny",
".",
"Group",
",",
"error",
")",
"{",
"gg",
":=",
"&",
"genny",
".",
"Group",
"{",
"}",
"\n\n",
"if",
"err",
":=",
"opts",
".",
"Validate",
"(",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"gg",
",",
"err",
"\n",
"}",
"\n\n",
"if",
"!",
"opts",
".",
"SkipInit",
"{",
"g",
",",
"err",
":=",
"initGenerator",
"(",
"opts",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"gg",
",",
"err",
"\n",
"}",
"\n",
"gg",
".",
"Add",
"(",
"g",
")",
"\n",
"}",
"\n\n",
"g",
":=",
"genny",
".",
"New",
"(",
")",
"\n",
"h",
":=",
"template",
".",
"FuncMap",
"{",
"}",
"\n",
"data",
":=",
"<mask>",
"[",
"string",
"]",
"interface",
"{",
"}",
"{",
"\"",
"\"",
":",
"opts",
",",
"}",
"\n",
"t",
":=",
"gogen",
".",
"TemplateTransformer",
"(",
"data",
",",
"h",
")",
"\n",
"g",
".",
"Transformer",
"(",
"t",
")",
"\n\n",
"fn",
":=",
"opts",
".",
"Name",
".",
"File",
"(",
")",
".",
"String",
"(",
")",
"\n",
"g",
".",
"File",
"(",
"genny",
".",
"NewFileS",
"(",
"\"",
"\"",
"+",
"fn",
"+",
"\"",
"\"",
",",
"mailerTmpl",
")",
")",
"\n",
"g",
".",
"File",
"(",
"genny",
".",
"NewFileS",
"(",
"\"",
"\"",
"+",
"fn",
"+",
"\"",
"\"",
",",
"mailTmpl",
")",
")",
"\n",
"gg",
".",
"Add",
"(",
"g",
")",
"\n\n",
"return",
"gg",
",",
"nil",
"\n",
"}"
] |
20,532 | all-20533 | [
"UnmarshalJSON",
"supports",
"json",
".",
"Unmarshaler",
"interface"
] | [
"func",
"(",
"v",
"*",
"ClearEventsParams",
")",
"UnmarshalJSON",
"(",
"<mask>",
"[",
"]",
"byte",
")",
"error",
"{",
"r",
":=",
"jlexer",
".",
"Lexer",
"{",
"Data",
":",
"data",
"}",
"\n",
"easyjsonC5a4559bDecodeGithubComChromedpCdprotoBackgroundservice7",
"(",
"&",
"r",
",",
"v",
")",
"\n",
"return",
"r",
".",
"Error",
"(",
")",
"\n",
"}"
] |
20,533 | all-20534 | [
"attach",
"a",
"renderbuffer",
"as",
"a",
"logical",
"buffer",
"of",
"a",
"framebuffer",
"object"
] | [
"func",
"FramebufferRenderbuffer",
"(",
"<mask>",
"uint32",
",",
"attachment",
"uint32",
",",
"renderbuffertarget",
"uint32",
",",
"renderbuffer",
"uint32",
")",
"{",
"syscall",
".",
"Syscall6",
"(",
"gpFramebufferRenderbuffer",
",",
"4",
",",
"uintptr",
"(",
"target",
")",
",",
"uintptr",
"(",
"attachment",
")",
",",
"uintptr",
"(",
"renderbuffertarget",
")",
",",
"uintptr",
"(",
"renderbuffer",
")",
",",
"0",
",",
"0",
")",
"\n",
"}"
] |
20,534 | all-20535 | [
"Var",
"returns",
"the",
"package",
"-",
"level",
"variable",
"of",
"the",
"specified",
"name",
"or",
"nil",
"if",
"not",
"found",
"."
] | [
"func",
"(",
"p",
"*",
"Package",
")",
"Var",
"(",
"name",
"string",
")",
"(",
"g",
"*",
"Global",
")",
"{",
"g",
",",
"_",
"=",
"p",
".",
"Members",
"[",
"<mask>",
"]",
".",
"(",
"*",
"Global",
")",
"\n",
"return",
"\n",
"}"
] |
20,535 | all-20536 | [
"getSignaturesFromLookaside",
"implements",
"GetSignatures",
"()",
"from",
"the",
"lookaside",
"location",
"configured",
"in",
"s",
".",
"c",
".",
"signatureBase",
"which",
"is",
"not",
"nil",
"."
] | [
"func",
"(",
"s",
"*",
"dockerImageSource",
")",
"getSignaturesFromLookaside",
"(",
"ctx",
"<mask>",
".",
"Context",
",",
"instanceDigest",
"*",
"digest",
".",
"Digest",
")",
"(",
"[",
"]",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"manifestDigest",
",",
"err",
":=",
"s",
".",
"manifestDigest",
"(",
"ctx",
",",
"instanceDigest",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"// NOTE: Keep this in sync with docs/signature-protocols.md!",
"signatures",
":=",
"[",
"]",
"[",
"]",
"byte",
"{",
"}",
"\n",
"for",
"i",
":=",
"0",
";",
";",
"i",
"++",
"{",
"url",
":=",
"signatureStorageURL",
"(",
"s",
".",
"c",
".",
"signatureBase",
",",
"manifestDigest",
",",
"i",
")",
"\n",
"if",
"url",
"==",
"nil",
"{",
"return",
"nil",
",",
"errors",
".",
"Errorf",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"signature",
",",
"missing",
",",
"err",
":=",
"s",
".",
"getOneSignature",
"(",
"ctx",
",",
"url",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"if",
"missing",
"{",
"break",
"\n",
"}",
"\n",
"signatures",
"=",
"append",
"(",
"signatures",
",",
"signature",
")",
"\n",
"}",
"\n",
"return",
"signatures",
",",
"nil",
"\n",
"}"
] |
20,536 | all-20537 | [
"UnmarshalEasyJSON",
"satisfies",
"easyjson",
".",
"Unmarshaler",
"."
] | [
"func",
"(",
"t",
"*",
"DispatchMouseEventPointerType",
")",
"UnmarshalEasyJSON",
"(",
"in",
"*",
"jlexer",
".",
"Lexer",
")",
"{",
"switch",
"DispatchMouseEventPointerType",
"(",
"in",
".",
"<mask>",
"(",
")",
")",
"{",
"case",
"Mouse",
":",
"*",
"t",
"=",
"Mouse",
"\n",
"case",
"Pen",
":",
"*",
"t",
"=",
"Pen",
"\n\n",
"default",
":",
"in",
".",
"AddError",
"(",
"errors",
".",
"New",
"(",
"\"",
"\"",
")",
")",
"\n",
"}",
"\n",
"}"
] |
20,537 | all-20538 | [
"IsClosedConnError",
"returns",
"true",
"if",
"the",
"error",
"is",
"from",
"closing",
"listener",
"cmux",
".",
"copied",
"from",
"golang",
".",
"org",
"/",
"x",
"/",
"net",
"/",
"http2",
"/",
"http2",
".",
"go"
] | [
"func",
"IsClosedConnError",
"(",
"err",
"error",
")",
"bool",
"{",
"// 'use of closed network connection' (Go <=1.8)",
"// 'use of closed file or network connection' (Go >1.8, internal/poll.ErrClosing)",
"// 'mux: listener closed' (cmux.ErrListenerClosed)",
"return",
"err",
"!=",
"nil",
"&&",
"strings",
".",
"Contains",
"(",
"err",
".",
"<mask>",
"(",
")",
",",
"\"",
"\"",
")",
"\n",
"}"
] |
20,538 | all-20539 | [
"----------------------------------------"
] | [
"func",
"DecodeDisambPrefixBytes",
"(",
"bz",
"[",
"]",
"byte",
")",
"(",
"db",
"DisambBytes",
",",
"hasDb",
"bool",
",",
"pb",
"PrefixBytes",
",",
"hasPb",
"bool",
",",
"n",
"int",
",",
"err",
"error",
")",
"{",
"// Validate",
"if",
"len",
"(",
"bz",
")",
"<",
"4",
"{",
"err",
"=",
"errors",
".",
"New",
"(",
"\"",
"\"",
")",
"\n",
"return",
"// hasPb = false",
"\n",
"}",
"\n",
"if",
"bz",
"[",
"0",
"]",
"==",
"0x00",
"{",
"// Disfix",
"// Validate",
"if",
"len",
"(",
"bz",
")",
"<",
"8",
"{",
"err",
"=",
"<mask>",
".",
"New",
"(",
"\"",
"\"",
")",
"\n",
"return",
"// hasPb = false",
"\n",
"}",
"\n",
"copy",
"(",
"db",
"[",
"0",
":",
"3",
"]",
",",
"bz",
"[",
"1",
":",
"4",
"]",
")",
"\n",
"copy",
"(",
"pb",
"[",
"0",
":",
"4",
"]",
",",
"bz",
"[",
"4",
":",
"8",
"]",
")",
"\n",
"hasDb",
"=",
"true",
"\n",
"hasPb",
"=",
"true",
"\n",
"n",
"=",
"8",
"\n",
"return",
"\n",
"}",
"else",
"{",
"// Prefix",
"// General case with no disambiguation",
"copy",
"(",
"pb",
"[",
"0",
":",
"4",
"]",
",",
"bz",
"[",
"0",
":",
"4",
"]",
")",
"\n",
"hasDb",
"=",
"false",
"\n",
"hasPb",
"=",
"true",
"\n",
"n",
"=",
"4",
"\n",
"return",
"\n",
"}",
"\n",
"}"
] |
20,539 | all-20540 | [
"GetApmQuery",
"returns",
"the",
"ApmQuery",
"field",
"if",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"."
] | [
"func",
"(",
"h",
"*",
"HostmapRequest",
")",
"GetApmQuery",
"(",
")",
"WidgetApmOrLogQuery",
"{",
"if",
"h",
"==",
"nil",
"||",
"h",
".",
"ApmQuery",
"==",
"nil",
"{",
"<mask>",
"WidgetApmOrLogQuery",
"{",
"}",
"\n",
"}",
"\n",
"return",
"*",
"h",
".",
"ApmQuery",
"\n",
"}"
] |
20,540 | all-20541 | [
"Close",
"removes",
"resources",
"associated",
"with",
"an",
"initialized",
"ImageSource",
"if",
"any",
".",
"Close",
"deletes",
"the",
"temporary",
"directory",
"at",
"dst"
] | [
"func",
"(",
"s",
"*",
"ociArchiveImageSource",
")",
"Close",
"(",
")",
"<mask>",
"{",
"defer",
"s",
".",
"tempDirRef",
".",
"deleteTempDir",
"(",
")",
"\n",
"return",
"s",
".",
"unpackedSrc",
".",
"Close",
"(",
")",
"\n",
"}"
] |
20,541 | all-20542 | [
"/",
"*",
"FindVmsByFilters",
"finds",
"vms",
"by",
"filters",
"cpu",
"memory",
"private",
"vlan",
"public",
"vlan",
"state"
] | [
"func",
"(",
"a",
"*",
"Client",
")",
"FindVmsByFilters",
"(",
"params",
"*",
"FindVmsByFiltersParams",
")",
"(",
"*",
"FindVmsByFiltersOK",
",",
"error",
")",
"{",
"// TODO: Validate the params before sending",
"if",
"params",
"==",
"nil",
"{",
"params",
"=",
"NewFindVmsByFiltersParams",
"(",
")",
"\n",
"}",
"\n\n",
"result",
",",
"err",
":=",
"a",
".",
"transport",
".",
"Submit",
"(",
"&",
"runtime",
".",
"ClientOperation",
"{",
"ID",
":",
"\"",
"\"",
",",
"Method",
":",
"\"",
"\"",
",",
"PathPattern",
":",
"\"",
"\"",
",",
"ProducesMediaTypes",
":",
"[",
"]",
"string",
"{",
"\"",
"\"",
"}",
",",
"ConsumesMediaTypes",
":",
"[",
"]",
"string",
"{",
"\"",
"\"",
"}",
",",
"Schemes",
":",
"[",
"]",
"string",
"{",
"\"",
"\"",
"}",
",",
"Params",
":",
"params",
",",
"Reader",
":",
"&",
"FindVmsByFiltersReader",
"{",
"formats",
":",
"a",
".",
"formats",
"}",
",",
"Context",
":",
"params",
".",
"Context",
",",
"}",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"return",
"<mask>",
".",
"(",
"*",
"FindVmsByFiltersOK",
")",
",",
"nil",
"\n\n",
"}"
] |
20,542 | all-20543 | [
"Returns",
"expected",
"status",
"state",
"and",
"description",
".",
"If",
"a",
"PR",
"is",
"not",
"mergeable",
"we",
"have",
"to",
"select",
"a",
"TideQuery",
"to",
"compare",
"it",
"against",
"in",
"order",
"to",
"generate",
"a",
"diff",
"for",
"the",
"status",
"description",
".",
"We",
"choose",
"the",
"query",
"for",
"the",
"repo",
"that",
"the",
"PR",
"is",
"closest",
"to",
"meeting",
"(",
"as",
"determined",
"by",
"the",
"number",
"of",
"unmet",
"/",
"violated",
"requirements",
")",
"."
] | [
"func",
"expectedStatus",
"(",
"queryMap",
"*",
"config",
".",
"QueryMap",
",",
"pr",
"*",
"PullRequest",
",",
"pool",
"<mask>",
"[",
"string",
"]",
"PullRequest",
",",
"cc",
"contextChecker",
")",
"(",
"string",
",",
"string",
")",
"{",
"if",
"_",
",",
"ok",
":=",
"pool",
"[",
"prKey",
"(",
"pr",
")",
"]",
";",
"!",
"ok",
"{",
"minDiffCount",
":=",
"-",
"1",
"\n",
"var",
"minDiff",
"string",
"\n",
"for",
"_",
",",
"q",
":=",
"range",
"queryMap",
".",
"ForRepo",
"(",
"string",
"(",
"pr",
".",
"Repository",
".",
"Owner",
".",
"Login",
")",
",",
"string",
"(",
"pr",
".",
"Repository",
".",
"Name",
")",
")",
"{",
"diff",
",",
"diffCount",
":=",
"requirementDiff",
"(",
"pr",
",",
"&",
"q",
",",
"cc",
")",
"\n",
"if",
"minDiffCount",
"==",
"-",
"1",
"||",
"diffCount",
"<",
"minDiffCount",
"{",
"minDiffCount",
"=",
"diffCount",
"\n",
"minDiff",
"=",
"diff",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"github",
".",
"StatusPending",
",",
"fmt",
".",
"Sprintf",
"(",
"statusNotInPool",
",",
"minDiff",
")",
"\n",
"}",
"\n",
"return",
"github",
".",
"StatusSuccess",
",",
"statusInPool",
"\n",
"}"
] |
20,543 | all-20544 | [
"GetCreateFlags",
"registers",
"the",
"flags",
"this",
"driver",
"adds",
"to",
"docker",
"hosts",
"create"
] | [
"func",
"(",
"d",
"*",
"Driver",
")",
"GetCreateFlags",
"(",
")",
"[",
"]",
"mcnflag",
".",
"Flag",
"{",
"return",
"[",
"]",
"mcnflag",
".",
"Flag",
"{",
"mcnflag",
".",
"StringFlag",
"{",
"EnvVar",
":",
"\"",
"\"",
",",
"<mask>",
":",
"\"",
"\"",
",",
"Usage",
":",
"\"",
"\"",
",",
"}",
",",
"mcnflag",
".",
"StringFlag",
"{",
"EnvVar",
":",
"\"",
"\"",
",",
"Name",
":",
"\"",
"\"",
",",
"Usage",
":",
"\"",
"\"",
",",
"Value",
":",
"defaultSSHUser",
",",
"}",
",",
"mcnflag",
".",
"StringFlag",
"{",
"EnvVar",
":",
"\"",
"\"",
",",
"Name",
":",
"\"",
"\"",
",",
"Usage",
":",
"\"",
"\"",
",",
"}",
",",
"mcnflag",
".",
"StringFlag",
"{",
"EnvVar",
":",
"\"",
"\"",
",",
"Name",
":",
"\"",
"\"",
",",
"Usage",
":",
"\"",
"\"",
",",
"}",
",",
"mcnflag",
".",
"IntFlag",
"{",
"EnvVar",
":",
"\"",
"\"",
",",
"Name",
":",
"\"",
"\"",
",",
"Usage",
":",
"\"",
"\"",
",",
"Value",
":",
"defaultSSHPort",
",",
"}",
",",
"mcnflag",
".",
"StringFlag",
"{",
"EnvVar",
":",
"\"",
"\"",
",",
"Name",
":",
"\"",
"\"",
",",
"Usage",
":",
"\"",
"\"",
",",
"Value",
":",
"defaultImage",
",",
"}",
",",
"mcnflag",
".",
"StringFlag",
"{",
"EnvVar",
":",
"\"",
"\"",
",",
"Name",
":",
"\"",
"\"",
",",
"Usage",
":",
"\"",
"\"",
",",
"Value",
":",
"defaultRegion",
",",
"}",
",",
"mcnflag",
".",
"StringFlag",
"{",
"EnvVar",
":",
"\"",
"\"",
",",
"Name",
":",
"\"",
"\"",
",",
"Usage",
":",
"\"",
"\"",
",",
"Value",
":",
"defaultSize",
",",
"}",
",",
"mcnflag",
".",
"BoolFlag",
"{",
"EnvVar",
":",
"\"",
"\"",
",",
"Name",
":",
"\"",
"\"",
",",
"Usage",
":",
"\"",
"\"",
",",
"}",
",",
"mcnflag",
".",
"BoolFlag",
"{",
"EnvVar",
":",
"\"",
"\"",
",",
"Name",
":",
"\"",
"\"",
",",
"Usage",
":",
"\"",
"\"",
",",
"}",
",",
"mcnflag",
".",
"BoolFlag",
"{",
"EnvVar",
":",
"\"",
"\"",
",",
"Name",
":",
"\"",
"\"",
",",
"Usage",
":",
"\"",
"\"",
",",
"}",
",",
"mcnflag",
".",
"StringFlag",
"{",
"EnvVar",
":",
"\"",
"\"",
",",
"Name",
":",
"\"",
"\"",
",",
"Usage",
":",
"\"",
"\"",
",",
"}",
",",
"mcnflag",
".",
"BoolFlag",
"{",
"EnvVar",
":",
"\"",
"\"",
",",
"Name",
":",
"\"",
"\"",
",",
"Usage",
":",
"\"",
"\"",
",",
"}",
",",
"mcnflag",
".",
"StringFlag",
"{",
"EnvVar",
":",
"\"",
"\"",
",",
"Name",
":",
"\"",
"\"",
",",
"Usage",
":",
"\"",
"\"",
",",
"}",
",",
"}",
"\n",
"}"
] |
20,544 | all-20545 | [
"HasApmQuery",
"returns",
"a",
"boolean",
"if",
"a",
"field",
"has",
"been",
"set",
"."
] | [
"func",
"(",
"h",
"*",
"HostmapRequest",
")",
"HasApmQuery",
"(",
")",
"bool",
"{",
"if",
"h",
"!=",
"nil",
"&&",
"h",
".",
"ApmQuery",
"!=",
"nil",
"{",
"return",
"true",
"\n",
"}",
"\n\n",
"return",
"<mask>",
"\n",
"}"
] |
20,545 | all-20546 | [
"ApplyConfig",
"updates",
"the",
"config",
"field",
"of",
"the",
"Handler",
"struct"
] | [
"func",
"(",
"h",
"*",
"<mask>",
")",
"ApplyConfig",
"(",
"conf",
"*",
"config",
".",
"Config",
")",
"error",
"{",
"h",
".",
"mtx",
".",
"Lock",
"(",
")",
"\n",
"defer",
"h",
".",
"mtx",
".",
"Unlock",
"(",
")",
"\n\n",
"h",
".",
"config",
"=",
"conf",
"\n\n",
"return",
"nil",
"\n",
"}"
] |
20,546 | all-20547 | [
"HasHideZeroCounts",
"returns",
"a",
"boolean",
"if",
"a",
"field",
"has",
"been",
"set",
"."
] | [
"func",
"(",
"m",
"*",
"ManageStatusDefinition",
")",
"HasHideZeroCounts",
"(",
")",
"bool",
"{",
"if",
"m",
"!=",
"nil",
"&&",
"m",
".",
"HideZeroCounts",
"!=",
"nil",
"{",
"return",
"true",
"\n",
"}",
"\n\n",
"return",
"<mask>",
"\n",
"}"
] |
20,547 | all-20548 | [
"UnmarshalJSON",
"supports",
"json",
".",
"Unmarshaler",
"interface"
] | [
"func",
"(",
"v",
"*",
"EventPseudoElementRemoved",
")",
"UnmarshalJSON",
"(",
"data",
"[",
"]",
"byte",
")",
"error",
"{",
"r",
":=",
"jlexer",
".",
"Lexer",
"{",
"Data",
":",
"data",
"}",
"\n",
"easyjsonC5a4559bDecodeGithubComChromedpCdprotoDom58",
"(",
"&",
"r",
",",
"v",
")",
"\n",
"return",
"r",
".",
"<mask>",
"(",
")",
"\n",
"}"
] |
20,548 | all-20549 | [
"Time",
"returns",
"the",
"time",
"in",
"100s",
"of",
"nanoseconds",
"since",
"15",
"Oct",
"1582",
"encoded",
"in",
"uuid",
".",
"The",
"time",
"is",
"only",
"defined",
"for",
"version",
"1",
"and",
"2",
"UUIDs",
"."
] | [
"func",
"(",
"uuid",
"UUID",
")",
"Time",
"(",
")",
"Time",
"{",
"time",
":=",
"int64",
"(",
"binary",
".",
"BigEndian",
".",
"Uint32",
"(",
"uuid",
"[",
"0",
":",
"4",
"]",
")",
")",
"\n",
"time",
"|=",
"int64",
"(",
"<mask>",
".",
"BigEndian",
".",
"Uint16",
"(",
"uuid",
"[",
"4",
":",
"6",
"]",
")",
")",
"<<",
"32",
"\n",
"time",
"|=",
"int64",
"(",
"binary",
".",
"BigEndian",
".",
"Uint16",
"(",
"uuid",
"[",
"6",
":",
"8",
"]",
")",
"&",
"0xfff",
")",
"<<",
"48",
"\n",
"return",
"Time",
"(",
"time",
")",
"\n",
"}"
] |
20,549 | all-20550 | [
"UpdateDashboardList",
"returns",
"a",
"single",
"dashboard",
"list",
"created",
"on",
"this",
"account",
"."
] | [
"func",
"(",
"<mask>",
"*",
"Client",
")",
"UpdateDashboardList",
"(",
"list",
"*",
"DashboardList",
")",
"error",
"{",
"req",
":=",
"reqUpdateDashboardList",
"{",
"list",
".",
"GetName",
"(",
")",
"}",
"\n",
"return",
"client",
".",
"doJsonRequest",
"(",
"\"",
"\"",
",",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"*",
"list",
".",
"Id",
")",
",",
"req",
",",
"nil",
")",
"\n",
"}"
] |
20,550 | all-20551 | [
"Helper",
"method",
"that",
"loads",
"file",
"file",
"content",
"and",
"(",
"JSON",
")",
"unmarshals",
"it",
"into",
"target"
] | [
"func",
"unmarshal",
"(",
"path",
"string",
",",
"target",
"*",
"map",
"[",
"string",
"]",
"interface",
"{",
"}",
")",
"error",
"{",
"<mask>",
",",
"err",
":=",
"loadFile",
"(",
"path",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"path",
",",
"err",
")",
"\n",
"}",
"\n",
"err",
"=",
"json",
".",
"Unmarshal",
"(",
"content",
",",
"target",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"path",
",",
"err",
")",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
] |
20,551 | all-20552 | [
"Trace",
"formats",
"a",
"given",
"message",
"according",
"to",
"given",
"params",
"to",
"log",
"with",
"level",
"Trace",
"."
] | [
"func",
"(",
"dl",
"*",
"DefaultLogger",
")",
"Trace",
"(",
"message",
"string",
",",
"params",
"...",
"<mask>",
"{",
"}",
")",
"{",
"dl",
".",
"logger",
".",
"Tracef",
"(",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"caller",
"(",
")",
",",
"message",
")",
",",
"params",
"...",
")",
"\n",
"}"
] |
20,552 | all-20553 | [
"SimpleHashFromHashers",
"computes",
"a",
"Merkle",
"tree",
"from",
"items",
"that",
"can",
"be",
"hashed",
"."
] | [
"func",
"SimpleHashFromHashers",
"(",
"items",
"[",
"]",
"Hasher",
")",
"[",
"]",
"byte",
"{",
"hashes",
":=",
"make",
"(",
"[",
"]",
"[",
"]",
"byte",
",",
"len",
"(",
"items",
")",
")",
"\n",
"for",
"i",
",",
"item",
":=",
"range",
"items",
"{",
"hash",
":=",
"item",
".",
"Hash",
"(",
")",
"\n",
"hashes",
"[",
"i",
"]",
"=",
"<mask>",
"\n",
"}",
"\n",
"return",
"simpleHashFromHashes",
"(",
"hashes",
")",
"\n",
"}"
] |
20,553 | all-20554 | [
"HasUnknown",
"returns",
"a",
"boolean",
"if",
"a",
"field",
"has",
"been",
"set",
"."
] | [
"func",
"(",
"t",
"*",
"ThresholdCount",
")",
"HasUnknown",
"(",
")",
"bool",
"{",
"if",
"t",
"!=",
"nil",
"&&",
"t",
".",
"<mask>",
"!=",
"nil",
"{",
"return",
"true",
"\n",
"}",
"\n\n",
"return",
"false",
"\n",
"}"
] |
20,554 | all-20555 | [
"UnmarshalJSON",
"satisfies",
"json",
".",
"Unmarshaler",
"."
] | [
"func",
"(",
"t",
"*",
"PseudoType",
")",
"UnmarshalJSON",
"(",
"buf",
"[",
"]",
"<mask>",
")",
"error",
"{",
"return",
"easyjson",
".",
"Unmarshal",
"(",
"buf",
",",
"t",
")",
"\n",
"}"
] |
20,555 | all-20556 | [
"NewClient",
"creates",
"a",
"client",
"of",
"ecscni",
"which",
"is",
"used",
"to",
"invoke",
"the",
"plugin"
] | [
"func",
"NewClient",
"(",
"cfg",
"*",
"Config",
")",
"CNIClient",
"{",
"libcniConfig",
":=",
"&",
"libcni",
".",
"CNIConfig",
"{",
"<mask>",
":",
"[",
"]",
"string",
"{",
"cfg",
".",
"PluginsPath",
"}",
",",
"}",
"\n\n",
"return",
"&",
"cniClient",
"{",
"pluginsPath",
":",
"cfg",
".",
"PluginsPath",
",",
"cniVersion",
":",
"cfg",
".",
"MinSupportedCNIVersion",
",",
"subnet",
":",
"ecsSubnet",
",",
"libcni",
":",
"libcniConfig",
",",
"}",
"\n",
"}"
] |
20,556 | all-20557 | [
"exitInfoText",
"returns",
"the",
"most",
"important",
"result",
"text",
"formatted",
"for",
"the",
"first",
"line",
"of",
"plugin",
"output",
".",
"Returns",
"joined",
"string",
"of",
"(",
"messageSeparator",
"-",
"separated",
")",
"info",
"text",
"from",
"results",
"which",
"have",
"a",
"status",
"of",
"at",
"least",
"c",
".",
"status",
"."
] | [
"func",
"(",
"c",
"Check",
")",
"exitInfoText",
"(",
")",
"string",
"{",
"<mask>",
"importantMessages",
"[",
"]",
"string",
"\n",
"for",
"_",
",",
"result",
":=",
"range",
"c",
".",
"results",
"{",
"if",
"result",
".",
"status",
"==",
"c",
".",
"status",
"{",
"importantMessages",
"=",
"append",
"(",
"importantMessages",
",",
"result",
".",
"message",
")",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"strings",
".",
"Join",
"(",
"importantMessages",
",",
"messageSeparator",
")",
"\n",
"}"
] |
20,557 | all-20558 | [
"RateLimit",
"write",
"to",
"a",
"logger",
"."
] | [
"func",
"RateLimit",
"(",
"next",
"log",
".",
"Logger",
",",
"<mask>",
"rate",
".",
"Limit",
")",
"log",
".",
"Logger",
"{",
"return",
"&",
"ratelimiter",
"{",
"limiter",
":",
"rate",
".",
"NewLimiter",
"(",
"limit",
",",
"int",
"(",
"limit",
")",
")",
",",
"next",
":",
"next",
",",
"}",
"\n",
"}"
] |
20,558 | all-20559 | [
"folderFromObject",
"returns",
"an",
"*",
"object",
".",
"Folder",
"from",
"a",
"given",
"object",
"of",
"specific",
"types",
"and",
"relative",
"path",
"of",
"a",
"type",
"defined",
"in",
"folderType",
".",
"If",
"no",
"such",
"folder",
"is",
"found",
"an",
"appropriate",
"error",
"will",
"be",
"returned",
".",
"The",
"list",
"of",
"supported",
"object",
"types",
"will",
"grow",
"as",
"the",
"provider",
"supports",
"more",
"resources",
"."
] | [
"func",
"folderFromObject",
"(",
"client",
"*",
"govmomi",
".",
"Client",
",",
"obj",
"<mask>",
"{",
"}",
",",
"folderType",
"RootPathParticle",
",",
"relative",
"string",
")",
"(",
"*",
"object",
".",
"Folder",
",",
"error",
")",
"{",
"// If we are using this for anything else other than the root folder on ESXi,",
"// return an error.",
"if",
"err",
":=",
"viapi",
".",
"ValidateVirtualCenter",
"(",
"client",
")",
";",
"err",
"!=",
"nil",
"&&",
"relative",
"!=",
"\"",
"\"",
"{",
"return",
"nil",
",",
"errors",
".",
"New",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"var",
"p",
"string",
"\n",
"var",
"err",
"error",
"\n",
"switch",
"o",
":=",
"obj",
".",
"(",
"type",
")",
"{",
"case",
"*",
"object",
".",
"VmwareDistributedVirtualSwitch",
":",
"p",
",",
"err",
"=",
"RootPathParticleNetwork",
".",
"PathFromNewRoot",
"(",
"o",
".",
"InventoryPath",
",",
"folderType",
",",
"relative",
")",
"\n",
"case",
"*",
"object",
".",
"Datastore",
":",
"p",
",",
"err",
"=",
"RootPathParticleDatastore",
".",
"PathFromNewRoot",
"(",
"o",
".",
"InventoryPath",
",",
"folderType",
",",
"relative",
")",
"\n",
"case",
"*",
"object",
".",
"StoragePod",
":",
"p",
",",
"err",
"=",
"RootPathParticleDatastore",
".",
"PathFromNewRoot",
"(",
"o",
".",
"InventoryPath",
",",
"folderType",
",",
"relative",
")",
"\n",
"case",
"*",
"object",
".",
"HostSystem",
":",
"p",
",",
"err",
"=",
"RootPathParticleHost",
".",
"PathFromNewRoot",
"(",
"o",
".",
"InventoryPath",
",",
"folderType",
",",
"relative",
")",
"\n",
"case",
"*",
"object",
".",
"ResourcePool",
":",
"p",
",",
"err",
"=",
"RootPathParticleHost",
".",
"PathFromNewRoot",
"(",
"o",
".",
"InventoryPath",
",",
"folderType",
",",
"relative",
")",
"\n",
"case",
"*",
"object",
".",
"ComputeResource",
":",
"p",
",",
"err",
"=",
"RootPathParticleHost",
".",
"PathFromNewRoot",
"(",
"o",
".",
"InventoryPath",
",",
"folderType",
",",
"relative",
")",
"\n",
"case",
"*",
"object",
".",
"ClusterComputeResource",
":",
"p",
",",
"err",
"=",
"RootPathParticleHost",
".",
"PathFromNewRoot",
"(",
"o",
".",
"InventoryPath",
",",
"folderType",
",",
"relative",
")",
"\n",
"case",
"*",
"object",
".",
"VirtualMachine",
":",
"p",
",",
"err",
"=",
"RootPathParticleVM",
".",
"PathFromNewRoot",
"(",
"o",
".",
"InventoryPath",
",",
"folderType",
",",
"relative",
")",
"\n",
"default",
":",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"o",
")",
"\n",
"}",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"return",
"FromAbsolutePath",
"(",
"client",
",",
"p",
")",
"\n",
"}"
] |
20,559 | all-20560 | [
"PutFileSplitWriter",
"writes",
"a",
"multiple",
"files",
"to",
"PFS",
"by",
"splitting",
"up",
"the",
"data",
"that",
"is",
"written",
"to",
"it",
".",
"NOTE",
":",
"PutFileSplitWriter",
"returns",
"an",
"io",
".",
"WriteCloser",
"you",
"must",
"call",
"Close",
"on",
"it",
"when",
"you",
"are",
"done",
"writing",
"."
] | [
"func",
"(",
"c",
"APIClient",
")",
"PutFileSplitWriter",
"(",
"repoName",
"string",
",",
"commitID",
"string",
",",
"path",
"string",
",",
"delimiter",
"pfs",
".",
"Delimiter",
",",
"targetFileDatums",
"int64",
",",
"targetFileBytes",
"int64",
",",
"headerRecords",
"int64",
",",
"overwrite",
"bool",
")",
"(",
"<mask>",
".",
"WriteCloser",
",",
"error",
")",
"{",
"pfc",
",",
"err",
":=",
"c",
".",
"newOneoffPutFileClient",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"return",
"pfc",
".",
"PutFileSplitWriter",
"(",
"repoName",
",",
"commitID",
",",
"path",
",",
"delimiter",
",",
"targetFileDatums",
",",
"targetFileBytes",
",",
"headerRecords",
",",
"overwrite",
")",
"\n",
"}"
] |
20,560 | all-20561 | [
"UnmarshalJSON",
"supports",
"json",
".",
"Unmarshaler",
"interface"
] | [
"func",
"(",
"v",
"*",
"GetSamplingProfileReturns",
")",
"UnmarshalJSON",
"(",
"data",
"[",
"]",
"byte",
")",
"error",
"{",
"r",
":=",
"jlexer",
".",
"Lexer",
"{",
"Data",
":",
"data",
"}",
"\n",
"easyjsonC5a4559bDecodeGithubComChromedpCdprotoHeapprofiler9",
"(",
"&",
"r",
",",
"v",
")",
"\n",
"return",
"r",
".",
"<mask>",
"(",
")",
"\n",
"}"
] |
20,561 | all-20562 | [
"Stat",
"calls",
"os",
".",
"Stat",
"."
] | [
"func",
"(",
"g",
"GitOS",
")",
"Stat",
"(",
"name",
"string",
")",
"(",
"os",
".",
"FileInfo",
",",
"error",
")",
"{",
"return",
"<mask>",
".",
"Stat",
"(",
"name",
")",
"\n",
"}"
] |
20,562 | all-20563 | [
"This",
"a",
"convenience",
"to",
"replicate",
"a",
"certain",
"volume",
"change",
"to",
"all",
"nodes",
"if",
"the",
"underlying",
"driver",
"is",
"ceph",
"."
] | [
"func",
"storagePoolVolumeReplicateIfCeph",
"(",
"tx",
"*",
"sql",
".",
"Tx",
",",
"volumeID",
"int64",
",",
"project",
",",
"volumeName",
"string",
",",
"volumeType",
"int",
",",
"poolID",
"int64",
",",
"f",
"func",
"(",
"int64",
")",
"error",
")",
"error",
"{",
"driver",
",",
"err",
":=",
"storagePoolDriverGet",
"(",
"tx",
",",
"poolID",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"volumeIDs",
":=",
"[",
"]",
"int64",
"{",
"volumeID",
"}",
"\n\n",
"// If this is a ceph volume, we want to duplicate the change across the",
"// the rows for all other nodes.",
"if",
"driver",
"==",
"\"",
"\"",
"{",
"volumeIDs",
",",
"err",
"=",
"storageVolumeIDsGet",
"(",
"tx",
",",
"<mask>",
",",
"volumeName",
",",
"volumeType",
",",
"poolID",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"}",
"\n\n",
"for",
"_",
",",
"volumeID",
":=",
"range",
"volumeIDs",
"{",
"err",
":=",
"f",
"(",
"volumeID",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"}",
"\n\n",
"return",
"nil",
"\n",
"}"
] |
20,563 | all-20564 | [
"MutateTransaction",
"for",
"ChangeTrustBuilder",
"causes",
"the",
"underylying",
"CreateAccountOp",
"to",
"be",
"added",
"to",
"the",
"operation",
"list",
"for",
"the",
"provided",
"transaction"
] | [
"func",
"(",
"m",
"ChangeTrustBuilder",
")",
"MutateTransaction",
"(",
"o",
"*",
"TransactionBuilder",
")",
"error",
"{",
"if",
"m",
".",
"Err",
"!=",
"nil",
"{",
"return",
"m",
".",
"Err",
"\n",
"}",
"\n\n",
"m",
".",
"O",
".",
"Body",
",",
"m",
".",
"Err",
"=",
"xdr",
".",
"NewOperationBody",
"(",
"xdr",
".",
"OperationTypeChangeTrust",
",",
"m",
".",
"CT",
")",
"\n",
"o",
".",
"TX",
".",
"Operations",
"=",
"<mask>",
"(",
"o",
".",
"TX",
".",
"Operations",
",",
"m",
".",
"O",
")",
"\n",
"return",
"m",
".",
"Err",
"\n",
"}"
] |
20,564 | all-20565 | [
"Do",
"executes",
"Emulation",
".",
"setVirtualTimePolicy",
"against",
"the",
"provided",
"context",
".",
"returns",
":",
"virtualTimeTicksBase",
"-",
"Absolute",
"timestamp",
"at",
"which",
"virtual",
"time",
"was",
"first",
"enabled",
"(",
"up",
"time",
"in",
"milliseconds",
")",
"."
] | [
"func",
"(",
"p",
"*",
"SetVirtualTimePolicyParams",
")",
"Do",
"(",
"ctx",
"context",
".",
"Context",
")",
"(",
"virtualTimeTicksBase",
"float64",
",",
"err",
"error",
")",
"{",
"// execute",
"<mask>",
"res",
"SetVirtualTimePolicyReturns",
"\n",
"err",
"=",
"cdp",
".",
"Execute",
"(",
"ctx",
",",
"CommandSetVirtualTimePolicy",
",",
"p",
",",
"&",
"res",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"0",
",",
"err",
"\n",
"}",
"\n\n",
"return",
"res",
".",
"VirtualTimeTicksBase",
",",
"nil",
"\n",
"}"
] |
20,565 | all-20566 | [
"newOpenShiftClientConfigLoadingRules",
"is",
"a",
"modified",
"copy",
"of",
"openshift",
"/",
"origin",
"/",
"pkg",
"/",
"cmd",
"/",
"cli",
"/",
"config",
".",
"NewOpenShiftClientConfigLoadingRules",
".",
"NewOpenShiftClientConfigLoadingRules",
"returns",
"file",
"priority",
"loading",
"rules",
"for",
"OpenShift",
".",
"1",
".",
"--",
"config",
"value",
"2",
".",
"if",
"KUBECONFIG",
"env",
"var",
"has",
"a",
"value",
"use",
"it",
".",
"Otherwise",
"~",
"/",
".",
"kube",
"/",
"config",
"file"
] | [
"func",
"newOpenShiftClientConfigLoadingRules",
"(",
")",
"*",
"clientConfigLoadingRules",
"{",
"chain",
":=",
"[",
"]",
"string",
"{",
"}",
"\n\n",
"envVarFile",
":=",
"os",
".",
"Getenv",
"(",
"\"",
"\"",
")",
"\n",
"if",
"len",
"(",
"envVarFile",
")",
"!=",
"0",
"{",
"chain",
"=",
"append",
"(",
"chain",
",",
"filepath",
".",
"SplitList",
"(",
"envVarFile",
")",
"...",
")",
"\n",
"}",
"else",
"{",
"chain",
"=",
"append",
"(",
"<mask>",
",",
"recommendedHomeFile",
")",
"\n",
"}",
"\n\n",
"return",
"&",
"clientConfigLoadingRules",
"{",
"Precedence",
":",
"chain",
",",
"// REMOVED: Migration support; run (oc login) to trigger migration",
"}",
"\n",
"}"
] |
20,566 | all-20567 | [
"newRefreshCredentialsHandler",
"returns",
"a",
"new",
"refreshCredentialsHandler",
"object"
] | [
"func",
"newRefreshCredentialsHandler",
"(",
"ctx",
"context",
".",
"Context",
",",
"cluster",
"string",
",",
"containerInstanceArn",
"string",
",",
"acsClient",
"wsclient",
".",
"ClientServer",
",",
"credentialsManager",
"credentials",
".",
"Manager",
",",
"taskEngine",
"engine",
".",
"TaskEngine",
")",
"refreshCredentialsHandler",
"{",
"// Create a cancelable context from the parent context",
"derivedContext",
",",
"cancel",
":=",
"context",
".",
"WithCancel",
"(",
"ctx",
")",
"\n",
"return",
"refreshCredentialsHandler",
"{",
"messageBuffer",
":",
"make",
"(",
"chan",
"*",
"ecsacs",
".",
"IAMRoleCredentialsMessage",
")",
",",
"ackRequest",
":",
"make",
"(",
"chan",
"*",
"ecsacs",
".",
"IAMRoleCredentialsAckRequest",
")",
",",
"ctx",
":",
"derivedContext",
",",
"cancel",
":",
"cancel",
",",
"cluster",
":",
"aws",
".",
"String",
"(",
"cluster",
")",
",",
"containerInstance",
":",
"aws",
".",
"<mask>",
"(",
"containerInstanceArn",
")",
",",
"acsClient",
":",
"acsClient",
",",
"credentialsManager",
":",
"credentialsManager",
",",
"taskEngine",
":",
"taskEngine",
",",
"}",
"\n",
"}"
] |
20,567 | all-20568 | [
"isCompairsonOperator",
"returns",
"true",
"if",
"the",
"item",
"corresponds",
"to",
"a",
"comparison",
"operator",
".",
"Returns",
"false",
"otherwise",
"."
] | [
"func",
"(",
"i",
"ItemType",
")",
"isComparisonOperator",
"(",
")",
"bool",
"{",
"switch",
"i",
"{",
"<mask>",
"ItemEQL",
",",
"ItemNEQ",
",",
"ItemLTE",
",",
"ItemLSS",
",",
"ItemGTE",
",",
"ItemGTR",
":",
"return",
"true",
"\n",
"default",
":",
"return",
"false",
"\n",
"}",
"\n",
"}"
] |
20,568 | all-20569 | [
"Helpers"
] | [
"func",
"generateVMName",
"(",
")",
"<mask>",
"{",
"randomID",
":=",
"mcnutils",
".",
"TruncateID",
"(",
"mcnutils",
".",
"GenerateRandomID",
"(",
")",
")",
"\n",
"return",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"randomID",
")",
"\n",
"}"
] |
20,569 | all-20570 | [
"attach",
"a",
"container",
"network",
"interface",
"to",
"an",
"external",
"network"
] | [
"func",
"(",
"v",
"*",
"veth",
")",
"attach",
"(",
"n",
"*",
"configs",
".",
"Network",
")",
"(",
"err",
"error",
")",
"{",
"bridge",
",",
"err",
":=",
"<mask>",
".",
"InterfaceByName",
"(",
"n",
".",
"Bridge",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"host",
",",
"err",
":=",
"net",
".",
"InterfaceByName",
"(",
"n",
".",
"HostInterfaceName",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"if",
"err",
":=",
"netlink",
".",
"AddToBridge",
"(",
"host",
",",
"bridge",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"if",
"err",
":=",
"netlink",
".",
"NetworkSetMTU",
"(",
"host",
",",
"n",
".",
"Mtu",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"if",
"n",
".",
"HairpinMode",
"{",
"if",
"err",
":=",
"netlink",
".",
"SetHairpinMode",
"(",
"host",
",",
"true",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"}",
"\n",
"if",
"err",
":=",
"netlink",
".",
"NetworkLinkUp",
"(",
"host",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"return",
"nil",
"\n",
"}"
] |
20,570 | all-20571 | [
"generate",
"a",
"contiguous",
"set",
"of",
"empty",
"display",
"lists"
] | [
"func",
"GenLists",
"(",
"xrange",
"int32",
")",
"uint32",
"{",
"ret",
",",
"_",
",",
"_",
":=",
"syscall",
".",
"Syscall",
"(",
"gpGenLists",
",",
"1",
",",
"uintptr",
"(",
"xrange",
")",
",",
"0",
",",
"0",
")",
"\n",
"return",
"(",
"uint32",
")",
"(",
"<mask>",
")",
"\n",
"}"
] |
20,571 | all-20572 | [
"newPolicyReferenceMatchFromJSON",
"parses",
"JSON",
"data",
"into",
"a",
"PolicyReferenceMatch",
"implementation",
"."
] | [
"func",
"newPolicyReferenceMatchFromJSON",
"(",
"data",
"[",
"]",
"byte",
")",
"(",
"PolicyReferenceMatch",
",",
"error",
")",
"{",
"var",
"typeField",
"prmCommon",
"\n",
"if",
"err",
":=",
"json",
".",
"Unmarshal",
"(",
"data",
",",
"&",
"typeField",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"var",
"res",
"PolicyReferenceMatch",
"\n",
"switch",
"typeField",
".",
"Type",
"{",
"case",
"prmTypeMatchExact",
":",
"res",
"=",
"&",
"prmMatchExact",
"{",
"}",
"\n",
"case",
"prmTypeMatchRepoDigestOrExact",
":",
"res",
"=",
"&",
"prmMatchRepoDigestOrExact",
"{",
"}",
"\n",
"case",
"prmTypeMatchRepository",
":",
"res",
"=",
"&",
"prmMatchRepository",
"{",
"}",
"\n",
"case",
"prmTypeExactReference",
":",
"<mask>",
"=",
"&",
"prmExactReference",
"{",
"}",
"\n",
"case",
"prmTypeExactRepository",
":",
"res",
"=",
"&",
"prmExactRepository",
"{",
"}",
"\n",
"default",
":",
"return",
"nil",
",",
"InvalidPolicyFormatError",
"(",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\\\"",
"\\\"",
"\"",
",",
"typeField",
".",
"Type",
")",
")",
"\n",
"}",
"\n",
"if",
"err",
":=",
"json",
".",
"Unmarshal",
"(",
"data",
",",
"&",
"res",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"return",
"res",
",",
"nil",
"\n",
"}"
] |
20,572 | all-20573 | [
"Sign",
"returns",
"a",
"signature",
"from",
"an",
"input",
"message",
"."
] | [
"func",
"(",
"k",
"*",
"Ed25519PrivateKey",
")",
"Sign",
"(",
"<mask>",
"[",
"]",
"byte",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"return",
"ed25519",
".",
"Sign",
"(",
"k",
".",
"k",
",",
"msg",
")",
",",
"nil",
"\n",
"}"
] |
20,573 | all-20574 | [
"HasName",
"returns",
"a",
"boolean",
"if",
"a",
"field",
"has",
"been",
"set",
"."
] | [
"func",
"(",
"d",
"*",
"DashboardList",
")",
"HasName",
"(",
")",
"bool",
"{",
"if",
"d",
"!=",
"nil",
"&&",
"d",
".",
"<mask>",
"!=",
"nil",
"{",
"return",
"true",
"\n",
"}",
"\n\n",
"return",
"false",
"\n",
"}"
] |
20,574 | all-20575 | [
"PutChar",
"sets",
"value",
"for",
"the",
"Canvas",
"cell",
":",
"rune",
"and",
"its",
"colors",
".",
"Returns",
"result",
"of",
"operation",
":",
"e",
".",
"g",
"if",
"the",
"symbol",
"position",
"is",
"outside",
"Canvas",
"the",
"operation",
"fails",
"and",
"the",
"function",
"returns",
"false"
] | [
"func",
"PutChar",
"(",
"x",
",",
"y",
"int",
",",
"r",
"rune",
")",
"bool",
"{",
"if",
"InClipRect",
"(",
"x",
",",
"y",
")",
"{",
"<mask>",
".",
"SetCell",
"(",
"x",
",",
"y",
",",
"r",
",",
"canvas",
".",
"textColor",
",",
"canvas",
".",
"backColor",
")",
"\n",
"return",
"true",
"\n",
"}",
"\n\n",
"return",
"false",
"\n",
"}"
] |
20,575 | all-20576 | [
"ParseAuthConfig",
"parses",
"the",
"auth",
"into",
"username",
":",
"password",
"."
] | [
"func",
"ParseAuthConfig",
"(",
"s",
"string",
")",
"(",
"*",
"AuthConfig",
",",
"error",
")",
"{",
"if",
"s",
"==",
"\"",
"\"",
"{",
"return",
"nil",
",",
"ErrAuthStringEmpty",
"\n",
"}",
"\n\n",
"var",
"a",
"AuthConfig",
"\n\n",
"if",
"strings",
".",
"Contains",
"(",
"s",
",",
"\"",
"\"",
")",
"{",
"<mask>",
":=",
"strings",
".",
"SplitN",
"(",
"s",
",",
"\"",
"\"",
",",
"2",
")",
"\n",
"a",
".",
"Username",
"=",
"String",
"(",
"split",
"[",
"0",
"]",
")",
"\n",
"a",
".",
"Password",
"=",
"String",
"(",
"split",
"[",
"1",
"]",
")",
"\n",
"}",
"else",
"{",
"a",
".",
"Username",
"=",
"String",
"(",
"s",
")",
"\n",
"}",
"\n\n",
"return",
"&",
"a",
",",
"nil",
"\n",
"}"
] |
20,576 | all-20577 | [
"Pack2",
"()",
"is",
"a",
"wrapper",
"around",
"gtk_paned_pack2",
"()",
"."
] | [
"func",
"(",
"v",
"*",
"Paned",
")",
"Pack2",
"(",
"child",
"IWidget",
",",
"resize",
",",
"shrink",
"bool",
")",
"{",
"C",
".",
"gtk_paned_pack2",
"(",
"v",
".",
"native",
"(",
")",
",",
"<mask>",
".",
"toWidget",
"(",
")",
",",
"gbool",
"(",
"resize",
")",
",",
"gbool",
"(",
"shrink",
")",
")",
"\n",
"}"
] |
20,577 | all-20578 | [
"Contains",
"returns",
"whether",
"other",
"is",
"contained",
"by",
"the",
"package",
"of",
"l",
"or",
"a",
"sub",
"-",
"package",
".",
"Neither",
"label",
"may",
"be",
"relative",
"."
] | [
"func",
"(",
"l",
"<mask>",
")",
"Contains",
"(",
"other",
"Label",
")",
"bool",
"{",
"if",
"l",
".",
"Relative",
"{",
"log",
".",
"Panicf",
"(",
"\"",
"\"",
",",
"l",
")",
"\n",
"}",
"\n",
"if",
"other",
".",
"Relative",
"{",
"log",
".",
"Panicf",
"(",
"\"",
"\"",
",",
"other",
")",
"\n",
"}",
"\n",
"result",
":=",
"l",
".",
"Repo",
"==",
"other",
".",
"Repo",
"&&",
"pathtools",
".",
"HasPrefix",
"(",
"other",
".",
"Pkg",
",",
"l",
".",
"Pkg",
")",
"\n",
"return",
"result",
"\n",
"}"
] |
20,578 | all-20579 | [
"MarshalEasyJSON",
"satisfies",
"easyjson",
".",
"Marshaler",
"."
] | [
"func",
"(",
"t",
"ContextState",
")",
"MarshalEasyJSON",
"(",
"out",
"*",
"jwriter",
".",
"<mask>",
")",
"{",
"out",
".",
"String",
"(",
"string",
"(",
"t",
")",
")",
"\n",
"}"
] |
20,579 | all-20580 | [
"expandClusterVMGroup",
"reads",
"certain",
"ResourceData",
"keys",
"and",
"returns",
"a",
"ClusterVmGroup",
"."
] | [
"func",
"expandClusterVMGroup",
"(",
"d",
"*",
"schema",
".",
"ResourceData",
",",
"meta",
"interface",
"{",
"}",
",",
"name",
"string",
")",
"(",
"*",
"types",
".",
"ClusterVmGroup",
",",
"error",
")",
"{",
"client",
",",
"err",
":=",
"resourceVSphereComputeClusterVMGroupClient",
"(",
"meta",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"results",
",",
"err",
":=",
"virtualmachine",
".",
"MOIDsForUUIDs",
"(",
"client",
",",
"structure",
".",
"SliceInterfacesToStrings",
"(",
"d",
".",
"Get",
"(",
"\"",
"\"",
")",
".",
"(",
"*",
"schema",
".",
"Set",
")",
".",
"List",
"(",
")",
")",
",",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"obj",
":=",
"&",
"types",
".",
"ClusterVmGroup",
"{",
"ClusterGroupInfo",
":",
"types",
".",
"ClusterGroupInfo",
"{",
"Name",
":",
"<mask>",
",",
"UserCreated",
":",
"structure",
".",
"BoolPtr",
"(",
"true",
")",
",",
"}",
",",
"Vm",
":",
"results",
".",
"ManagedObjectReferences",
"(",
")",
",",
"}",
"\n",
"return",
"obj",
",",
"nil",
"\n",
"}"
] |
20,580 | all-20581 | [
"Creates",
"new",
"group",
"from",
"current",
"context",
"attach",
"it",
"to",
"svg",
"and",
"return"
] | [
"func",
"(",
"gc",
"*",
"GraphicContext",
")",
"newGroup",
"(",
"drawType",
"drawType",
")",
"*",
"Group",
"{",
"group",
":=",
"Group",
"{",
"}",
"\n",
"// set attrs to group",
"if",
"drawType",
"&",
"stroked",
"==",
"stroked",
"{",
"group",
".",
"Stroke",
"=",
"toSvgRGBA",
"(",
"gc",
".",
"Current",
".",
"StrokeColor",
")",
"\n",
"group",
".",
"StrokeWidth",
"=",
"toSvgLength",
"(",
"gc",
".",
"Current",
".",
"LineWidth",
")",
"\n",
"group",
".",
"StrokeLinecap",
"=",
"gc",
".",
"Current",
".",
"Cap",
".",
"String",
"(",
")",
"\n",
"group",
".",
"StrokeLinejoin",
"=",
"gc",
".",
"Current",
".",
"Join",
".",
"String",
"(",
")",
"\n",
"if",
"len",
"(",
"gc",
".",
"Current",
".",
"Dash",
")",
">",
"0",
"{",
"group",
".",
"StrokeDasharray",
"=",
"toSvgArray",
"(",
"gc",
".",
"Current",
".",
"Dash",
")",
"\n",
"group",
".",
"StrokeDashoffset",
"=",
"toSvgLength",
"(",
"gc",
".",
"Current",
".",
"DashOffset",
")",
"\n",
"}",
"\n",
"}",
"\n\n",
"if",
"drawType",
"&",
"filled",
"==",
"filled",
"{",
"group",
".",
"Fill",
"=",
"toSvgRGBA",
"(",
"gc",
".",
"Current",
".",
"FillColor",
")",
"\n",
"<mask>",
".",
"FillRule",
"=",
"toSvgFillRule",
"(",
"gc",
".",
"Current",
".",
"FillRule",
")",
"\n",
"}",
"\n\n",
"group",
".",
"Transform",
"=",
"toSvgTransform",
"(",
"gc",
".",
"Current",
".",
"Tr",
")",
"\n\n",
"// attach",
"gc",
".",
"svg",
".",
"Groups",
"=",
"append",
"(",
"gc",
".",
"svg",
".",
"Groups",
",",
"&",
"group",
")",
"\n\n",
"return",
"&",
"group",
"\n",
"}"
] |
20,581 | all-20582 | [
"Creates",
"the",
"device",
"node",
"in",
"the",
"rootfs",
"of",
"the",
"container",
"."
] | [
"func",
"createDeviceNode",
"(",
"rootfs",
"string",
",",
"node",
"*",
"configs",
".",
"Device",
",",
"bind",
"bool",
")",
"error",
"{",
"dest",
":=",
"filepath",
".",
"Join",
"(",
"rootfs",
",",
"node",
".",
"Path",
")",
"\n",
"if",
"err",
":=",
"os",
".",
"MkdirAll",
"(",
"filepath",
".",
"Dir",
"(",
"<mask>",
")",
",",
"0755",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"if",
"bind",
"{",
"f",
",",
"err",
":=",
"os",
".",
"Create",
"(",
"dest",
")",
"\n",
"if",
"err",
"!=",
"nil",
"&&",
"!",
"os",
".",
"IsExist",
"(",
"err",
")",
"{",
"return",
"err",
"\n",
"}",
"\n",
"if",
"f",
"!=",
"nil",
"{",
"f",
".",
"Close",
"(",
")",
"\n",
"}",
"\n",
"return",
"syscall",
".",
"Mount",
"(",
"node",
".",
"Path",
",",
"dest",
",",
"\"",
"\"",
",",
"syscall",
".",
"MS_BIND",
",",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"if",
"err",
":=",
"mknodDevice",
"(",
"dest",
",",
"node",
")",
";",
"err",
"!=",
"nil",
"{",
"if",
"os",
".",
"IsExist",
"(",
"err",
")",
"{",
"return",
"nil",
"\n",
"}",
"\n",
"return",
"err",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
] |
20,582 | all-20583 | [
"NewConfig",
"returns",
"a",
"new",
"Config",
"from",
"a",
"supplied",
"ResourceData",
"."
] | [
"func",
"NewConfig",
"(",
"d",
"*",
"schema",
".",
"ResourceData",
")",
"(",
"*",
"Config",
",",
"error",
")",
"{",
"// Handle backcompat support for vcenter_server; once that is removed,",
"// vsphere_server can just become a Required field that is referenced inline",
"// in Config below.",
"server",
":=",
"d",
".",
"Get",
"(",
"\"",
"\"",
")",
".",
"(",
"string",
")",
"\n\n",
"if",
"server",
"==",
"\"",
"\"",
"{",
"server",
"=",
"d",
".",
"Get",
"(",
"\"",
"\"",
")",
".",
"(",
"string",
")",
"\n",
"}",
"\n\n",
"if",
"server",
"==",
"\"",
"\"",
"{",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"c",
":=",
"&",
"Config",
"{",
"User",
":",
"d",
".",
"Get",
"(",
"\"",
"\"",
")",
".",
"(",
"string",
")",
",",
"Password",
":",
"d",
".",
"Get",
"(",
"\"",
"\"",
")",
".",
"(",
"string",
")",
",",
"InsecureFlag",
":",
"d",
".",
"Get",
"(",
"\"",
"\"",
")",
".",
"(",
"bool",
")",
",",
"VSphereServer",
":",
"<mask>",
",",
"Debug",
":",
"d",
".",
"Get",
"(",
"\"",
"\"",
")",
".",
"(",
"bool",
")",
",",
"DebugPathRun",
":",
"d",
".",
"Get",
"(",
"\"",
"\"",
")",
".",
"(",
"string",
")",
",",
"DebugPath",
":",
"d",
".",
"Get",
"(",
"\"",
"\"",
")",
".",
"(",
"string",
")",
",",
"Persist",
":",
"d",
".",
"Get",
"(",
"\"",
"\"",
")",
".",
"(",
"bool",
")",
",",
"VimSessionPath",
":",
"d",
".",
"Get",
"(",
"\"",
"\"",
")",
".",
"(",
"string",
")",
",",
"RestSessionPath",
":",
"d",
".",
"Get",
"(",
"\"",
"\"",
")",
".",
"(",
"string",
")",
",",
"}",
"\n\n",
"return",
"c",
",",
"nil",
"\n",
"}"
] |
20,583 | all-20584 | [
"AddHandler",
"adds",
"a",
"function",
"to",
"be",
"called",
"whenever",
"an",
"event",
"is",
"received"
] | [
"func",
"(",
"e",
"*",
"EventListener",
")",
"AddHandler",
"(",
"types",
"[",
"]",
"string",
",",
"function",
"func",
"(",
"api",
".",
"Event",
")",
")",
"(",
"*",
"EventTarget",
",",
"error",
")",
"{",
"if",
"function",
"==",
"nil",
"{",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"// Handle locking",
"e",
".",
"targetsLock",
".",
"Lock",
"(",
")",
"\n",
"defer",
"e",
".",
"targetsLock",
".",
"Unlock",
"(",
")",
"\n\n",
"// Create a new target",
"target",
":=",
"EventTarget",
"{",
"function",
":",
"<mask>",
",",
"types",
":",
"types",
",",
"}",
"\n\n",
"// And add it to the targets",
"e",
".",
"targets",
"=",
"append",
"(",
"e",
".",
"targets",
",",
"&",
"target",
")",
"\n\n",
"return",
"&",
"target",
",",
"nil",
"\n",
"}"
] |
20,584 | all-20585 | [
"String",
"returns",
"the",
"name",
"of",
"e"
] | [
"func",
"(",
"e",
"LedgerEntryType",
")",
"String",
"(",
")",
"string",
"{",
"<mask>",
",",
"_",
":=",
"ledgerEntryTypeMap",
"[",
"int32",
"(",
"e",
")",
"]",
"\n",
"return",
"name",
"\n",
"}"
] |
20,585 | all-20586 | [
"UnmarshalJSON",
"satisfies",
"json",
".",
"Unmarshaler",
"."
] | [
"func",
"(",
"t",
"*",
"DispatchMouseEventPointerType",
")",
"UnmarshalJSON",
"(",
"buf",
"[",
"]",
"<mask>",
")",
"error",
"{",
"return",
"easyjson",
".",
"Unmarshal",
"(",
"buf",
",",
"t",
")",
"\n",
"}"
] |
20,586 | all-20587 | [
"HandlersMap",
"returns",
"handlers",
"map",
"needed",
"to",
"construct",
"job",
"queue",
"."
] | [
"func",
"HandlersMap",
"(",
"worker",
"*",
"worker",
".",
"Worker",
")",
"job",
".",
"HandlerMap",
"{",
"return",
"job",
".",
"HandlerMap",
"{",
"// Agent jobs.",
"data",
".",
"JobAgentAfterChannelCreate",
":",
"worker",
".",
"AgentAfterChannelCreate",
",",
"data",
".",
"JobAgentAfterChannelTopUp",
":",
"worker",
".",
"AgentAfterChannelTopUp",
",",
"data",
".",
"JobAgentAfterUncooperativeCloseRequest",
":",
"worker",
".",
"AgentAfterUncooperativeCloseRequest",
",",
"data",
".",
"JobAgentAfterUncooperativeClose",
":",
"worker",
".",
"AgentAfterUncooperativeClose",
",",
"data",
".",
"JobAgentAfterCooperativeClose",
":",
"worker",
".",
"AgentAfterCooperativeClose",
",",
"<mask>",
".",
"JobAgentPreServiceSuspend",
":",
"worker",
".",
"AgentPreServiceSuspend",
",",
"data",
".",
"JobAgentPreServiceUnsuspend",
":",
"worker",
".",
"AgentPreServiceUnsuspend",
",",
"data",
".",
"JobAgentPreServiceTerminate",
":",
"worker",
".",
"AgentPreServiceTerminate",
",",
"data",
".",
"JobAgentPreEndpointMsgCreate",
":",
"worker",
".",
"AgentPreEndpointMsgCreate",
",",
"data",
".",
"JobAgentPreOfferingMsgBCPublish",
":",
"worker",
".",
"AgentPreOfferingMsgBCPublish",
",",
"data",
".",
"JobAgentAfterOfferingMsgBCPublish",
":",
"worker",
".",
"AgentAfterOfferingMsgBCPublish",
",",
"data",
".",
"JobAgentPreOfferingPopUp",
":",
"worker",
".",
"AgentPreOfferingPopUp",
",",
"data",
".",
"JobAgentAfterOfferingPopUp",
":",
"worker",
".",
"AgentAfterOfferingPopUp",
",",
"data",
".",
"JobAgentPreOfferingDelete",
":",
"worker",
".",
"AgentPreOfferingDelete",
",",
"data",
".",
"JobAgentAfterOfferingDelete",
":",
"worker",
".",
"AgentAfterOfferingDelete",
",",
"// Client jobs.",
"data",
".",
"JobClientAfterOfferingDelete",
":",
"worker",
".",
"ClientAfterOfferingDelete",
",",
"data",
".",
"JobClientAfterOfferingPopUp",
":",
"worker",
".",
"ClientAfterOfferingPopUp",
",",
"data",
".",
"JobClientPreChannelCreate",
":",
"worker",
".",
"ClientPreChannelCreate",
",",
"data",
".",
"JobClientAfterChannelCreate",
":",
"worker",
".",
"ClientAfterChannelCreate",
",",
"data",
".",
"JobClientEndpointRestore",
":",
"worker",
".",
"ClientEndpointCreate",
",",
"data",
".",
"JobClientAfterUncooperativeClose",
":",
"worker",
".",
"ClientAfterUncooperativeClose",
",",
"data",
".",
"JobClientAfterCooperativeClose",
":",
"worker",
".",
"ClientAfterCooperativeClose",
",",
"data",
".",
"JobClientPreUncooperativeClose",
":",
"worker",
".",
"ClientPreUncooperativeClose",
",",
"data",
".",
"JobClientPreChannelTopUp",
":",
"worker",
".",
"ClientPreChannelTopUp",
",",
"data",
".",
"JobClientAfterChannelTopUp",
":",
"worker",
".",
"ClientAfterChannelTopUp",
",",
"data",
".",
"JobClientPreUncooperativeCloseRequest",
":",
"worker",
".",
"ClientPreUncooperativeCloseRequest",
",",
"data",
".",
"JobClientAfterUncooperativeCloseRequest",
":",
"worker",
".",
"ClientAfterUncooperativeCloseRequest",
",",
"data",
".",
"JobClientPreServiceTerminate",
":",
"worker",
".",
"ClientPreServiceTerminate",
",",
"data",
".",
"JobClientPreServiceSuspend",
":",
"worker",
".",
"ClientPreServiceSuspend",
",",
"data",
".",
"JobClientPreServiceUnsuspend",
":",
"worker",
".",
"ClientPreServiceUnsuspend",
",",
"data",
".",
"JobClientAfterOfferingMsgBCPublish",
":",
"worker",
".",
"ClientAfterOfferingMsgBCPublish",
",",
"data",
".",
"JobClientCompleteServiceTransition",
":",
"worker",
".",
"ClientCompleteServiceTransition",
",",
"// Common jobs.",
"data",
".",
"JobPreAccountAddBalanceApprove",
":",
"worker",
".",
"PreAccountAddBalanceApprove",
",",
"data",
".",
"JobPreAccountAddBalance",
":",
"worker",
".",
"PreAccountAddBalance",
",",
"data",
".",
"JobAfterAccountAddBalance",
":",
"worker",
".",
"AfterAccountAddBalance",
",",
"data",
".",
"JobPreAccountReturnBalance",
":",
"worker",
".",
"PreAccountReturnBalance",
",",
"data",
".",
"JobAfterAccountReturnBalance",
":",
"worker",
".",
"AfterAccountReturnBalance",
",",
"data",
".",
"JobAccountUpdateBalances",
":",
"worker",
".",
"AccountUpdateBalances",
",",
"data",
".",
"JobDecrementCurrentSupply",
":",
"worker",
".",
"DecrementCurrentSupply",
",",
"data",
".",
"JobIncrementCurrentSupply",
":",
"worker",
".",
"IncrementCurrentSupply",
",",
"}",
"\n",
"}"
] |
20,587 | all-20588 | [
"CreateBucketIfNotExists",
"creates",
"a",
"new",
"bucket",
"if",
"it",
"doesn",
"t",
"already",
"exist",
".",
"Returns",
"an",
"error",
"if",
"the",
"bucket",
"name",
"is",
"blank",
"or",
"if",
"the",
"bucket",
"name",
"is",
"too",
"long",
".",
"The",
"bucket",
"instance",
"is",
"only",
"valid",
"for",
"the",
"lifetime",
"of",
"the",
"transaction",
"."
] | [
"func",
"(",
"tx",
"Tx",
")",
"CreateBucketIfNotExists",
"(",
"folders",
"[",
"]",
"[",
"]",
"byte",
")",
"(",
"Bucket",
",",
"error",
")",
"{",
"b",
",",
"err",
":=",
"<mask>",
".",
"Tx",
".",
"CreateBucketIfNotExists",
"(",
"folders",
"[",
"0",
"]",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"Bucket",
"{",
"}",
",",
"nil",
"\n",
"}",
"\n",
"if",
"len",
"(",
"folders",
")",
"==",
"1",
"{",
"return",
"Bucket",
"{",
"b",
"}",
",",
"nil",
"\n",
"}",
"\n",
"return",
"Bucket",
"{",
"b",
"}",
".",
"CreateBucketIfNotExists",
"(",
"folders",
"[",
"1",
":",
"]",
")",
"\n",
"}"
] |
20,588 | all-20589 | [
"GetImage",
"downloads",
"a",
"Media",
"object",
"and",
"returns",
"an",
"image",
".",
"Image",
".",
"The",
"documentation",
"isn",
"t",
"great",
"on",
"what",
"happens",
"-",
"as",
"of",
"October",
"2016",
"we",
"make",
"a",
"request",
"to",
"the",
"Twilio",
"API",
"then",
"to",
"media",
".",
"twiliocdn",
".",
"com",
"then",
"to",
"a",
"S3",
"URL",
".",
"We",
"then",
"download",
"that",
"image",
"and",
"decode",
"it",
"based",
"on",
"the",
"provided",
"content",
"-",
"type",
"."
] | [
"func",
"(",
"m",
"*",
"MediaService",
")",
"GetImage",
"(",
"ctx",
"context",
".",
"Context",
",",
"messageSid",
"string",
",",
"sid",
"string",
")",
"(",
"image",
".",
"Image",
",",
"error",
")",
"{",
"u",
",",
"err",
":=",
"m",
".",
"GetURL",
"(",
"ctx",
",",
"messageSid",
",",
"sid",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"if",
"u",
".",
"Scheme",
"==",
"\"",
"\"",
"{",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"u",
".",
"String",
"(",
")",
")",
"\n",
"}",
"\n",
"req",
",",
"err",
":=",
"http",
".",
"NewRequest",
"(",
"\"",
"\"",
",",
"u",
".",
"String",
"(",
")",
",",
"nil",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"req",
"=",
"withContext",
"(",
"req",
",",
"ctx",
")",
"\n",
"req",
".",
"Header",
".",
"<mask>",
"(",
"\"",
"\"",
",",
"userAgent",
")",
"\n",
"resp",
",",
"err",
":=",
"MediaClient",
".",
"Do",
"(",
"req",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"defer",
"resp",
".",
"Body",
".",
"Close",
"(",
")",
"\n",
"// https://www.twilio.com/docs/api/rest/accepted-mime-types#supported",
"ctype",
":=",
"resp",
".",
"Header",
".",
"Get",
"(",
"\"",
"\"",
")",
"\n",
"switch",
"ctype",
"{",
"case",
"\"",
"\"",
":",
"return",
"jpeg",
".",
"Decode",
"(",
"resp",
".",
"Body",
")",
"\n",
"case",
"\"",
"\"",
":",
"return",
"gif",
".",
"Decode",
"(",
"resp",
".",
"Body",
")",
"\n",
"case",
"\"",
"\"",
":",
"return",
"png",
".",
"Decode",
"(",
"resp",
".",
"Body",
")",
"\n",
"default",
":",
"io",
".",
"Copy",
"(",
"ioutil",
".",
"Discard",
",",
"resp",
".",
"Body",
")",
"\n",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"ctype",
")",
"\n",
"}",
"\n",
"}"
] |
20,589 | all-20590 | [
"GenOracle",
"generates",
"a",
"ora",
"DSN",
"from",
"the",
"passed",
"URL",
"."
] | [
"func",
"GenOracle",
"(",
"u",
"*",
"URL",
")",
"(",
"string",
",",
"error",
")",
"{",
"// create dsn",
"dsn",
":=",
"u",
".",
"Host",
"+",
"u",
".",
"Path",
"\n\n",
"// build user/pass",
"var",
"un",
"string",
"\n",
"if",
"u",
".",
"User",
"!=",
"nil",
"{",
"if",
"un",
"=",
"u",
".",
"User",
".",
"Username",
"(",
")",
";",
"len",
"(",
"un",
")",
">",
"0",
"{",
"if",
"up",
",",
"ok",
":=",
"u",
".",
"User",
".",
"Password",
"(",
")",
";",
"<mask>",
"{",
"un",
"+=",
"\"",
"\"",
"+",
"up",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n\n",
"return",
"un",
"+",
"\"",
"\"",
"+",
"dsn",
",",
"nil",
"\n",
"}"
] |
20,590 | all-20591 | [
"GetRawUsageStats",
"gets",
"the",
"array",
"of",
"most",
"recent",
"raw",
"UsageStats",
"in",
"descending",
"order",
"of",
"timestamps",
"."
] | [
"func",
"(",
"queue",
"*",
"Queue",
")",
"GetRawUsageStats",
"(",
"numStats",
"int",
")",
"(",
"[",
"]",
"UsageStats",
",",
"error",
")",
"{",
"<mask>",
".",
"lock",
".",
"Lock",
"(",
")",
"\n",
"defer",
"queue",
".",
"lock",
".",
"Unlock",
"(",
")",
"\n\n",
"queueLength",
":=",
"len",
"(",
"queue",
".",
"buffer",
")",
"\n",
"if",
"queueLength",
"==",
"0",
"{",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"if",
"numStats",
">",
"queueLength",
"{",
"numStats",
"=",
"queueLength",
"\n",
"}",
"\n\n",
"usageStats",
":=",
"make",
"(",
"[",
"]",
"UsageStats",
",",
"numStats",
")",
"\n",
"for",
"i",
":=",
"0",
";",
"i",
"<",
"numStats",
";",
"i",
"++",
"{",
"// Order such that usageStats[i].timestamp > usageStats[i+1].timestamp",
"rawUsageStat",
":=",
"queue",
".",
"buffer",
"[",
"queueLength",
"-",
"i",
"-",
"1",
"]",
"\n",
"usageStats",
"[",
"i",
"]",
"=",
"UsageStats",
"{",
"CPUUsagePerc",
":",
"rawUsageStat",
".",
"CPUUsagePerc",
",",
"MemoryUsageInMegs",
":",
"rawUsageStat",
".",
"MemoryUsageInMegs",
",",
"Timestamp",
":",
"rawUsageStat",
".",
"Timestamp",
",",
"}",
"\n",
"}",
"\n\n",
"return",
"usageStats",
",",
"nil",
"\n",
"}"
] |
20,591 | all-20592 | [
"Do",
"executes",
"Page",
".",
"getAppManifest",
"against",
"the",
"provided",
"context",
".",
"returns",
":",
"url",
"-",
"Manifest",
"location",
".",
"errors",
"data",
"-",
"Manifest",
"content",
"."
] | [
"func",
"(",
"p",
"*",
"GetAppManifestParams",
")",
"Do",
"(",
"ctx",
"context",
".",
"Context",
")",
"(",
"url",
"string",
",",
"errors",
"[",
"]",
"*",
"AppManifestError",
",",
"data",
"string",
",",
"err",
"error",
")",
"{",
"// execute",
"<mask>",
"res",
"GetAppManifestReturns",
"\n",
"err",
"=",
"cdp",
".",
"Execute",
"(",
"ctx",
",",
"CommandGetAppManifest",
",",
"nil",
",",
"&",
"res",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"\"",
"\"",
",",
"nil",
",",
"\"",
"\"",
",",
"err",
"\n",
"}",
"\n\n",
"return",
"res",
".",
"URL",
",",
"res",
".",
"Errors",
",",
"res",
".",
"Data",
",",
"nil",
"\n",
"}"
] |
20,592 | all-20593 | [
"CreateOrgs",
"-"
] | [
"func",
"(",
"m",
"*",
"DefaultManager",
")",
"CreateOrgs",
"(",
")",
"error",
"{",
"m",
".",
"orgs",
"=",
"nil",
"\n",
"desiredOrgs",
",",
"err",
":=",
"m",
".",
"Cfg",
".",
"GetOrgConfigs",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"currentOrgs",
",",
"err",
":=",
"m",
".",
"ListOrgs",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"for",
"_",
",",
"org",
":=",
"<mask>",
"desiredOrgs",
"{",
"if",
"doesOrgExist",
"(",
"org",
".",
"Org",
",",
"currentOrgs",
")",
"{",
"lo",
".",
"G",
".",
"Debugf",
"(",
"\"",
"\"",
",",
"org",
".",
"Org",
")",
"\n",
"continue",
"\n",
"}",
"else",
"if",
"doesOrgExistFromRename",
"(",
"org",
".",
"OriginalOrg",
",",
"currentOrgs",
")",
"{",
"lo",
".",
"G",
".",
"Debugf",
"(",
"\"",
"\"",
",",
"org",
".",
"Org",
",",
"org",
".",
"OriginalOrg",
")",
"\n",
"if",
"err",
":=",
"m",
".",
"RenameOrg",
"(",
"org",
".",
"OriginalOrg",
",",
"org",
".",
"Org",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"continue",
"\n",
"}",
"else",
"{",
"lo",
".",
"G",
".",
"Debugf",
"(",
"\"",
"\"",
",",
"org",
".",
"Org",
",",
"desiredOrgs",
")",
"\n",
"}",
"\n",
"if",
"err",
":=",
"m",
".",
"CreateOrg",
"(",
"org",
".",
"Org",
",",
"m",
".",
"orgNames",
"(",
"currentOrgs",
")",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"}",
"\n",
"m",
".",
"orgs",
"=",
"nil",
"\n",
"return",
"nil",
"\n",
"}"
] |
20,593 | all-20594 | [
"Send",
"sends",
"a",
"crash",
"report",
"to",
"bugsnag",
"via",
"an",
"http",
"call",
"."
] | [
"func",
"(",
"r",
"*",
"BugsnagCrashReporter",
")",
"Send",
"(",
"err",
"CrashError",
")",
"error",
"{",
"if",
"r",
".",
"noReportFileExist",
"(",
")",
"||",
"r",
".",
"apiKey",
"==",
"noreportAPIKey",
"{",
"log",
".",
"Debug",
"(",
"\"",
"\"",
")",
"\n",
"return",
"nil",
"\n",
"}",
"\n\n",
"if",
"r",
".",
"apiKey",
"==",
"\"",
"\"",
"{",
"return",
"errors",
".",
"New",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"bugsnag",
".",
"Configure",
"(",
"bugsnag",
".",
"Configuration",
"{",
"APIKey",
":",
"r",
".",
"apiKey",
",",
"// XXX we need to abuse bugsnag metrics to get the OS/ARCH information as a usable filter",
"// Can do that with either \"stage\" or \"hostname\"",
"ReleaseStage",
":",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"runtime",
".",
"GOOS",
",",
"runtime",
".",
"GOARCH",
")",
",",
"ProjectPackages",
":",
"[",
"]",
"string",
"{",
"\"",
"\"",
"}",
",",
"AppVersion",
":",
"version",
".",
"FullVersion",
"(",
")",
",",
"Synchronous",
":",
"true",
",",
"PanicHandler",
":",
"func",
"(",
")",
"{",
"}",
",",
"Logger",
":",
"new",
"(",
"logger",
")",
",",
"}",
")",
"\n\n",
"metaData",
":=",
"bugsnag",
".",
"MetaData",
"{",
"}",
"\n\n",
"metaData",
".",
"Add",
"(",
"\"",
"\"",
",",
"\"",
"\"",
",",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"runtime",
".",
"Compiler",
",",
"runtime",
".",
"Version",
"(",
")",
")",
")",
"\n",
"metaData",
".",
"Add",
"(",
"\"",
"\"",
",",
"\"",
"\"",
",",
"runtime",
".",
"GOOS",
")",
"\n",
"metaData",
".",
"Add",
"(",
"\"",
"\"",
",",
"\"",
"\"",
",",
"runtime",
".",
"GOARCH",
")",
"\n\n",
"detectRunningShell",
"(",
"&",
"metaData",
")",
"\n",
"detectUname",
"(",
"&",
"metaData",
")",
"\n",
"detectOSVersion",
"(",
"&",
"metaData",
")",
"\n",
"addFile",
"(",
"err",
".",
"LogFilePath",
",",
"&",
"metaData",
")",
"\n\n",
"var",
"buffer",
"bytes",
".",
"Buffer",
"\n",
"for",
"_",
",",
"message",
":=",
"<mask>",
"log",
".",
"History",
"(",
")",
"{",
"buffer",
".",
"WriteString",
"(",
"message",
"+",
"\"",
"\\n",
"\"",
")",
"\n",
"}",
"\n",
"metaData",
".",
"Add",
"(",
"\"",
"\"",
",",
"\"",
"\"",
",",
"buffer",
".",
"String",
"(",
")",
")",
"\n\n",
"return",
"bugsnag",
".",
"Notify",
"(",
"err",
".",
"Cause",
",",
"metaData",
",",
"bugsnag",
".",
"SeverityError",
",",
"bugsnag",
".",
"Context",
"{",
"String",
":",
"err",
".",
"Context",
"}",
",",
"bugsnag",
".",
"ErrorClass",
"{",
"Name",
":",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"err",
".",
"DriverName",
",",
"err",
".",
"Command",
")",
"}",
")",
"\n",
"}"
] |
20,594 | all-20595 | [
"ContainerByName",
"returns",
"the",
"*",
"Container",
"for",
"the",
"given",
"name"
] | [
"func",
"(",
"task",
"*",
"Task",
")",
"ContainerByName",
"(",
"name",
"string",
")",
"(",
"*",
"apicontainer",
".",
"Container",
",",
"bool",
")",
"{",
"for",
"_",
",",
"container",
":=",
"range",
"<mask>",
".",
"Containers",
"{",
"if",
"container",
".",
"Name",
"==",
"name",
"{",
"return",
"container",
",",
"true",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"nil",
",",
"false",
"\n",
"}"
] |
20,595 | all-20596 | [
"ensureForkExists",
"ensures",
"a",
"fork",
"of",
"org",
"/",
"repo",
"exists",
"for",
"the",
"bot",
"."
] | [
"func",
"(",
"s",
"*",
"Server",
")",
"ensureForkExists",
"(",
"org",
",",
"repo",
"string",
")",
"error",
"{",
"s",
".",
"repoLock",
".",
"Lock",
"(",
")",
"\n",
"defer",
"s",
".",
"repoLock",
".",
"Unlock",
"(",
")",
"\n\n",
"// Fork repo if it doesn't exist.",
"fork",
":=",
"s",
".",
"botName",
"+",
"\"",
"\"",
"+",
"repo",
"\n",
"if",
"!",
"repoExists",
"(",
"fork",
",",
"s",
".",
"repos",
")",
"{",
"if",
"err",
":=",
"s",
".",
"ghc",
".",
"CreateFork",
"(",
"org",
",",
"repo",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"org",
",",
"repo",
",",
"err",
")",
"\n",
"}",
"\n",
"if",
"err",
":=",
"waitForRepo",
"(",
"s",
".",
"botName",
",",
"repo",
",",
"s",
".",
"ghc",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"org",
",",
"repo",
",",
"err",
")",
"\n",
"}",
"\n",
"s",
".",
"repos",
"=",
"append",
"(",
"s",
".",
"repos",
",",
"github",
".",
"Repo",
"{",
"FullName",
":",
"fork",
",",
"Fork",
":",
"<mask>",
"}",
")",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
] |
20,596 | all-20597 | [
"PerformRequestWithContext",
"performs",
"everything",
"the",
"PerformRequest",
"does",
"but",
"is",
"also",
"context",
"-",
"aware",
"."
] | [
"func",
"(",
"a",
"*",
"API",
")",
"PerformRequestWithContext",
"(",
"ctx",
"context",
".",
"Context",
",",
"req",
"*",
"http",
".",
"<mask>",
")",
"(",
"*",
"http",
".",
"Response",
",",
"error",
")",
"{",
"// Sign last so auth headers don't get printed or logged",
"if",
"a",
".",
"Auth",
"!=",
"nil",
"{",
"if",
"err",
":=",
"a",
".",
"Auth",
".",
"Sign",
"(",
"req",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"}",
"\n",
"resp",
",",
"err",
":=",
"a",
".",
"Client",
".",
"DoWithContext",
"(",
"ctx",
",",
"req",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"return",
"resp",
",",
"err",
"\n",
"}"
] |
20,597 | all-20598 | [
"EventuallyWithOffset",
"operates",
"like",
"Eventually",
"but",
"takes",
"an",
"additional",
"initial",
"argument",
"to",
"indicate",
"an",
"offset",
"in",
"the",
"call",
"stack",
".",
"This",
"is",
"useful",
"when",
"building",
"helper",
"functions",
"that",
"contain",
"matchers",
".",
"To",
"learn",
"more",
"read",
"about",
"ExpectWithOffset",
"."
] | [
"func",
"EventuallyWithOffset",
"(",
"offset",
"int",
",",
"actual",
"interface",
"{",
"}",
",",
"intervals",
"...",
"interface",
"{",
"}",
")",
"AsyncAssertion",
"{",
"if",
"globalFailWrapper",
"==",
"nil",
"{",
"panic",
"(",
"nilFailHandlerPanic",
")",
"\n",
"}",
"\n",
"timeoutInterval",
":=",
"defaultEventuallyTimeout",
"\n",
"pollingInterval",
":=",
"defaultEventuallyPollingInterval",
"\n",
"if",
"len",
"(",
"intervals",
")",
">",
"0",
"{",
"timeoutInterval",
"=",
"toDuration",
"(",
"intervals",
"[",
"0",
"]",
")",
"\n",
"}",
"\n",
"if",
"len",
"(",
"intervals",
")",
">",
"1",
"{",
"pollingInterval",
"=",
"toDuration",
"(",
"intervals",
"[",
"1",
"]",
")",
"\n",
"}",
"\n",
"return",
"asyncassertion",
".",
"New",
"(",
"asyncassertion",
".",
"AsyncAssertionTypeEventually",
",",
"actual",
",",
"globalFailWrapper",
",",
"timeoutInterval",
",",
"pollingInterval",
",",
"<mask>",
")",
"\n",
"}"
] |
20,598 | all-20599 | [
"maybeTerm",
"returns",
"the",
"term",
"of",
"the",
"entry",
"at",
"index",
"i",
"if",
"there",
"is",
"any",
"."
] | [
"func",
"(",
"u",
"*",
"unstable",
")",
"maybeTerm",
"(",
"i",
"uint64",
")",
"(",
"uint64",
",",
"bool",
")",
"{",
"if",
"i",
"<",
"u",
".",
"offset",
"{",
"if",
"u",
".",
"snapshot",
"==",
"nil",
"{",
"return",
"0",
",",
"false",
"\n",
"}",
"\n",
"if",
"u",
".",
"snapshot",
".",
"Metadata",
".",
"Index",
"==",
"i",
"{",
"return",
"u",
".",
"snapshot",
".",
"Metadata",
".",
"Term",
",",
"true",
"\n",
"}",
"\n",
"return",
"0",
",",
"false",
"\n",
"}",
"\n\n",
"last",
",",
"ok",
":=",
"u",
".",
"maybeLastIndex",
"(",
")",
"\n",
"if",
"!",
"ok",
"{",
"return",
"0",
",",
"<mask>",
"\n",
"}",
"\n",
"if",
"i",
">",
"last",
"{",
"return",
"0",
",",
"false",
"\n",
"}",
"\n",
"return",
"u",
".",
"entries",
"[",
"i",
"-",
"u",
".",
"offset",
"]",
".",
"Term",
",",
"true",
"\n",
"}"
] |
20,599 | all-20600 | [
"CanSign",
"returns",
"true",
"if",
"it",
"s",
"possible",
"for",
"a",
"public",
"key",
"of",
"the",
"given",
"type",
"to",
"sign",
"a",
"message",
"."
] | [
"func",
"(",
"pka",
"PublicKeyAlgorithm",
")",
"CanSign",
"(",
")",
"bool",
"{",
"switch",
"pka",
"{",
"<mask>",
"PubKeyAlgoRSA",
",",
"PubKeyAlgoRSASignOnly",
",",
"PubKeyAlgoDSA",
":",
"return",
"true",
"\n",
"}",
"\n",
"return",
"false",
"\n",
"}"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.