id
int32 0
25.3k
| idx
stringlengths 5
9
| nl_tokens
sequencelengths 1
418
| pl_tokens
sequencelengths 22
4.98k
|
---|---|---|---|
6,700 | all-6701 | [
"SetConsoleCursorInfo",
"sets",
"the",
"size",
"and",
"visiblity",
"of",
"the",
"console",
"cursor",
".",
"See",
"https",
":",
"//",
"msdn",
".",
"microsoft",
".",
"com",
"/",
"en",
"-",
"us",
"/",
"library",
"/",
"windows",
"/",
"desktop",
"/",
"ms686019",
"(",
"v",
"=",
"vs",
".",
"85",
")",
".",
"aspx",
"."
] | [
"func",
"SetConsoleCursorInfo",
"(",
"<mask>",
"uintptr",
",",
"cursorInfo",
"*",
"CONSOLE_CURSOR_INFO",
")",
"error",
"{",
"r1",
",",
"r2",
",",
"err",
":=",
"setConsoleCursorInfoProc",
".",
"Call",
"(",
"handle",
",",
"uintptr",
"(",
"unsafe",
".",
"Pointer",
"(",
"cursorInfo",
")",
")",
",",
"0",
")",
"\n",
"return",
"checkError",
"(",
"r1",
",",
"r2",
",",
"err",
")",
"\n",
"}"
] |
6,701 | all-6702 | [
"markObjects",
"finds",
"all",
"the",
"live",
"objects",
"in",
"the",
"heap",
"and",
"marks",
"them",
"in",
"the",
"p",
".",
"heapInfo",
"mark",
"fields",
"."
] | [
"func",
"(",
"p",
"*",
"Process",
")",
"markObjects",
"(",
")",
"{",
"ptrSize",
":=",
"p",
".",
"proc",
".",
"PtrSize",
"(",
")",
"\n\n",
"// number of live objects found so far",
"n",
":=",
"0",
"\n",
"// total size of live objects",
"var",
"live",
"int64",
"\n\n",
"var",
"q",
"[",
"]",
"Object",
"\n\n",
"// Function to call when we find a new pointer.",
"add",
":=",
"func",
"(",
"x",
"core",
".",
"Address",
")",
"{",
"h",
":=",
"p",
".",
"findHeapInfo",
"(",
"x",
")",
"\n",
"if",
"h",
"==",
"nil",
"{",
"// not in heap or not in a valid span",
"// Invalid spans can happen with intra-stack pointers.",
"return",
"\n",
"}",
"\n",
"// Round down to object start.",
"x",
"=",
"h",
".",
"base",
".",
"Add",
"(",
"x",
".",
"Sub",
"(",
"h",
".",
"base",
")",
"/",
"h",
".",
"size",
"*",
"h",
".",
"size",
")",
"\n",
"// Object start may map to a different info. Reload heap info.",
"h",
"=",
"p",
".",
"findHeapInfo",
"(",
"x",
")",
"\n",
"// Find mark bit",
"b",
":=",
"uint64",
"(",
"x",
")",
"%",
"heapInfoSize",
"/",
"8",
"\n",
"if",
"h",
".",
"mark",
"&",
"(",
"uint64",
"(",
"1",
")",
"<<",
"b",
")",
"!=",
"0",
"{",
"// already found",
"return",
"\n",
"}",
"\n",
"h",
".",
"mark",
"|=",
"uint64",
"(",
"1",
")",
"<<",
"b",
"\n",
"n",
"++",
"\n",
"live",
"+=",
"h",
".",
"size",
"\n",
"q",
"=",
"append",
"(",
"q",
",",
"Object",
"(",
"x",
")",
")",
"\n",
"}",
"\n\n",
"// Start with scanning all the roots.",
"// Note that we don't just use the DWARF roots, just in case DWARF isn't complete.",
"// Instead we use exactly what the runtime uses.",
"// Goroutine roots",
"for",
"_",
",",
"g",
":=",
"range",
"p",
".",
"goroutines",
"{",
"for",
"_",
",",
"f",
":=",
"range",
"g",
".",
"frames",
"{",
"for",
"a",
":=",
"range",
"f",
".",
"Live",
"{",
"add",
"(",
"p",
".",
"proc",
".",
"ReadPtr",
"(",
"a",
")",
")",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n\n",
"// Global roots",
"for",
"_",
",",
"m",
":=",
"range",
"p",
".",
"modules",
"{",
"for",
"_",
",",
"s",
":=",
"range",
"[",
"2",
"]",
"string",
"{",
"\"",
"\"",
",",
"\"",
"\"",
"}",
"{",
"min",
":=",
"core",
".",
"Address",
"(",
"m",
".",
"r",
".",
"<mask>",
"(",
"s",
")",
".",
"Uintptr",
"(",
")",
")",
"\n",
"max",
":=",
"core",
".",
"Address",
"(",
"m",
".",
"r",
".",
"Field",
"(",
"\"",
"\"",
"+",
"s",
")",
".",
"Uintptr",
"(",
")",
")",
"\n",
"gc",
":=",
"m",
".",
"r",
".",
"Field",
"(",
"\"",
"\"",
"+",
"s",
"+",
"\"",
"\"",
")",
".",
"Field",
"(",
"\"",
"\"",
")",
".",
"Address",
"(",
")",
"\n",
"num",
":=",
"max",
".",
"Sub",
"(",
"min",
")",
"/",
"ptrSize",
"\n",
"for",
"i",
":=",
"int64",
"(",
"0",
")",
";",
"i",
"<",
"num",
";",
"i",
"++",
"{",
"if",
"p",
".",
"proc",
".",
"ReadUint8",
"(",
"gc",
".",
"Add",
"(",
"i",
"/",
"8",
")",
")",
">>",
"uint",
"(",
"i",
"%",
"8",
")",
"&",
"1",
"!=",
"0",
"{",
"add",
"(",
"p",
".",
"proc",
".",
"ReadPtr",
"(",
"min",
".",
"Add",
"(",
"i",
"*",
"ptrSize",
")",
")",
")",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n\n",
"// Finalizers",
"for",
"_",
",",
"r",
":=",
"range",
"p",
".",
"globals",
"{",
"if",
"!",
"strings",
".",
"HasPrefix",
"(",
"r",
".",
"Name",
",",
"\"",
"\"",
")",
"{",
"continue",
"\n",
"}",
"\n",
"for",
"_",
",",
"f",
":=",
"range",
"r",
".",
"Type",
".",
"Fields",
"{",
"if",
"f",
".",
"Type",
".",
"Kind",
"==",
"KindPtr",
"{",
"add",
"(",
"p",
".",
"proc",
".",
"ReadPtr",
"(",
"r",
".",
"Addr",
".",
"Add",
"(",
"f",
".",
"Off",
")",
")",
")",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n\n",
"// Expand root set to all reachable objects.",
"for",
"len",
"(",
"q",
")",
">",
"0",
"{",
"x",
":=",
"q",
"[",
"len",
"(",
"q",
")",
"-",
"1",
"]",
"\n",
"q",
"=",
"q",
"[",
":",
"len",
"(",
"q",
")",
"-",
"1",
"]",
"\n\n",
"// Scan object for pointers.",
"size",
":=",
"p",
".",
"Size",
"(",
"x",
")",
"\n",
"for",
"i",
":=",
"int64",
"(",
"0",
")",
";",
"i",
"<",
"size",
";",
"i",
"+=",
"ptrSize",
"{",
"a",
":=",
"core",
".",
"Address",
"(",
"x",
")",
".",
"Add",
"(",
"i",
")",
"\n",
"if",
"p",
".",
"isPtrFromHeap",
"(",
"a",
")",
"{",
"add",
"(",
"p",
".",
"proc",
".",
"ReadPtr",
"(",
"a",
")",
")",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n\n",
"p",
".",
"nObj",
"=",
"n",
"\n\n",
"// Initialize firstIdx fields in the heapInfo, for fast object index lookups.",
"n",
"=",
"0",
"\n",
"p",
".",
"ForEachObject",
"(",
"func",
"(",
"x",
"Object",
")",
"bool",
"{",
"h",
":=",
"p",
".",
"findHeapInfo",
"(",
"p",
".",
"Addr",
"(",
"x",
")",
")",
"\n",
"if",
"h",
".",
"firstIdx",
"==",
"-",
"1",
"{",
"h",
".",
"firstIdx",
"=",
"n",
"\n",
"}",
"\n",
"n",
"++",
"\n",
"return",
"true",
"\n",
"}",
")",
"\n",
"if",
"n",
"!=",
"p",
".",
"nObj",
"{",
"panic",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"// Update stats to include the live/garbage distinction.",
"alloc",
":=",
"p",
".",
"Stats",
"(",
")",
".",
"Child",
"(",
"\"",
"\"",
")",
".",
"Child",
"(",
"\"",
"\"",
")",
".",
"Child",
"(",
"\"",
"\"",
")",
"\n",
"alloc",
".",
"Children",
"=",
"[",
"]",
"*",
"Stats",
"{",
"&",
"Stats",
"{",
"\"",
"\"",
",",
"live",
",",
"nil",
"}",
",",
"&",
"Stats",
"{",
"\"",
"\"",
",",
"alloc",
".",
"Size",
"-",
"live",
",",
"nil",
"}",
",",
"}",
"\n",
"}"
] |
6,702 | all-6703 | [
"SetOperator",
"is",
"a",
"wrapper",
"around",
"cairo_set_operator",
"()",
"."
] | [
"func",
"(",
"v",
"*",
"<mask>",
")",
"SetOperator",
"(",
"op",
"Operator",
")",
"{",
"C",
".",
"cairo_set_operator",
"(",
"v",
".",
"native",
"(",
")",
",",
"C",
".",
"cairo_operator_t",
"(",
"op",
")",
")",
"\n",
"}"
] |
6,703 | all-6704 | [
"WithContext",
"constructs",
"and",
"returns",
"a",
"Process",
"that",
"respects",
"given",
"context",
".",
"It",
"is",
"the",
"equivalent",
"of",
":",
"func",
"ProcessWithContext",
"(",
"ctx",
"context",
".",
"Context",
")",
"goprocess",
".",
"Process",
"{",
"p",
":",
"=",
"goprocess",
".",
"WithParent",
"(",
"goprocess",
".",
"Background",
"()",
")",
"CloseAfterContext",
"(",
"p",
"ctx",
")",
"return",
"p",
"}"
] | [
"func",
"WithContext",
"(",
"ctx",
"<mask>",
".",
"Context",
")",
"goprocess",
".",
"Process",
"{",
"p",
":=",
"goprocess",
".",
"WithParent",
"(",
"goprocess",
".",
"Background",
"(",
")",
")",
"\n",
"CloseAfterContext",
"(",
"p",
",",
"ctx",
")",
"\n",
"return",
"p",
"\n",
"}"
] |
6,704 | all-6705 | [
"DataWapper",
"sets",
"wrap",
"functions",
"which",
"is",
"called",
"during",
"NthDataWrapped",
"()",
"and",
"DataWrapped",
"()",
".",
"It",
"s",
"used",
"to",
"cast",
"raw",
"C",
"data",
"into",
"appropriate",
"Go",
"structures",
"and",
"types",
"every",
"time",
"that",
"data",
"is",
"retreived",
"."
] | [
"func",
"(",
"v",
"*",
"<mask>",
")",
"DataWrapper",
"(",
"fn",
"func",
"(",
"unsafe",
".",
"Pointer",
")",
"interface",
"{",
"}",
")",
"{",
"if",
"v",
"==",
"nil",
"{",
"return",
"\n",
"}",
"\n",
"v",
".",
"dataWrap",
"=",
"fn",
"\n",
"}"
] |
6,705 | all-6706 | [
"native",
"returns",
"a",
"pointer",
"to",
"the",
"underlying",
"GtkRecentFilter",
"."
] | [
"func",
"(",
"v",
"*",
"RecentFilter",
")",
"native",
"(",
")",
"*",
"C",
".",
"GtkRecentFilter",
"{",
"if",
"v",
"==",
"nil",
"||",
"v",
".",
"<mask>",
"==",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n",
"p",
":=",
"unsafe",
".",
"Pointer",
"(",
"v",
".",
"GObject",
")",
"\n",
"return",
"C",
".",
"toGtkRecentFilter",
"(",
"p",
")",
"\n",
"}"
] |
6,706 | all-6707 | [
"UnmarshalJSON",
"supports",
"json",
".",
"Unmarshaler",
"interface"
] | [
"func",
"(",
"v",
"*",
"SetRuleSelectorReturns",
")",
"UnmarshalJSON",
"(",
"data",
"[",
"]",
"byte",
")",
"error",
"{",
"r",
":=",
"jlexer",
".",
"Lexer",
"{",
"Data",
":",
"data",
"}",
"\n",
"easyjsonC5a4559bDecodeGithubComChromedpCdprotoCss15",
"(",
"&",
"r",
",",
"v",
")",
"\n",
"return",
"r",
".",
"<mask>",
"(",
")",
"\n",
"}"
] |
6,707 | all-6708 | [
"MiddlewareFunc",
"makes",
"RecoverMiddleware",
"implement",
"the",
"Middleware",
"interface",
"."
] | [
"func",
"(",
"mw",
"*",
"RecoverMiddleware",
")",
"MiddlewareFunc",
"(",
"h",
"HandlerFunc",
")",
"HandlerFunc",
"{",
"// set the default Logger",
"if",
"mw",
".",
"Logger",
"==",
"nil",
"{",
"mw",
".",
"Logger",
"=",
"log",
".",
"New",
"(",
"os",
".",
"Stderr",
",",
"\"",
"\"",
",",
"0",
")",
"\n",
"}",
"\n\n",
"return",
"func",
"(",
"w",
"ResponseWriter",
",",
"r",
"*",
"Request",
")",
"{",
"// catch user code's panic, and convert to http response",
"defer",
"func",
"(",
")",
"{",
"if",
"reco",
":=",
"recover",
"(",
")",
";",
"reco",
"!=",
"nil",
"{",
"trace",
":=",
"debug",
".",
"Stack",
"(",
")",
"\n\n",
"// log the trace",
"message",
":=",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\\n",
"\"",
",",
"reco",
",",
"trace",
")",
"\n",
"mw",
".",
"logError",
"(",
"message",
")",
"\n\n",
"// write error response",
"if",
"mw",
".",
"EnableResponseStackTrace",
"{",
"<mask>",
"(",
"w",
",",
"message",
",",
"http",
".",
"StatusInternalServerError",
")",
"\n",
"}",
"else",
"{",
"Error",
"(",
"w",
",",
"\"",
"\"",
",",
"http",
".",
"StatusInternalServerError",
")",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"(",
")",
"\n\n",
"// call the handler",
"h",
"(",
"w",
",",
"r",
")",
"\n",
"}",
"\n",
"}"
] |
6,708 | all-6709 | [
"UnmarshalJSON",
"supports",
"json",
".",
"Unmarshaler",
"interface"
] | [
"func",
"(",
"v",
"*",
"EventAddDatabase",
")",
"UnmarshalJSON",
"(",
"data",
"[",
"]",
"<mask>",
")",
"error",
"{",
"r",
":=",
"jlexer",
".",
"Lexer",
"{",
"Data",
":",
"data",
"}",
"\n",
"easyjsonC5a4559bDecodeGithubComChromedpCdprotoDatabase4",
"(",
"&",
"r",
",",
"v",
")",
"\n",
"return",
"r",
".",
"Error",
"(",
")",
"\n",
"}"
] |
6,709 | all-6710 | [
"Parameter",
"image",
"has",
"type",
"C",
".",
"GLeglImageOES",
"."
] | [
"func",
"EGLImageTargetTexStorageEXT",
"(",
"<mask>",
"uint32",
",",
"image",
"unsafe",
".",
"Pointer",
",",
"attrib_list",
"*",
"int32",
")",
"{",
"C",
".",
"glowEGLImageTargetTexStorageEXT",
"(",
"gpEGLImageTargetTexStorageEXT",
",",
"(",
"C",
".",
"GLenum",
")",
"(",
"target",
")",
",",
"(",
"C",
".",
"GLeglImageOES",
")",
"(",
"image",
")",
",",
"(",
"*",
"C",
".",
"GLint",
")",
"(",
"unsafe",
".",
"Pointer",
"(",
"attrib_list",
")",
")",
")",
"\n",
"}"
] |
6,710 | all-6711 | [
"BuildAndRunDirWithGoBuildTags",
"builds",
"the",
"given",
"director",
"s",
"features",
"into",
"Go",
"Code",
"using",
"the",
"filters",
"provided",
".",
"Also",
"takes",
"a",
"string",
"for",
"the",
"build",
"tags",
"to",
"be",
"passed",
"to",
"the",
"go",
"command",
".",
"An",
"error",
"is",
"returned",
"if",
"the",
"build",
"fails",
".",
"If",
"goBuildTags",
"is",
"empty",
"the",
"param",
"will",
"be",
"ignored",
"."
] | [
"func",
"BuildAndRunDirWithGoBuildTags",
"(",
"dir",
"string",
",",
"filters",
"[",
"]",
"string",
",",
"goBuildTags",
"string",
")",
"<mask>",
"{",
"return",
"buildAndRunDir",
"(",
"dir",
",",
"filters",
",",
"goBuildTags",
")",
"\n",
"}"
] |
6,711 | all-6712 | [
"StopServer",
"stops",
"a",
"remote",
"Pact",
"Mock",
"Server",
"."
] | [
"func",
"(",
"p",
"*",
"PactClient",
")",
"StopServer",
"(",
"server",
"*",
"<mask>",
".",
"MockServer",
")",
"(",
"*",
"types",
".",
"MockServer",
",",
"error",
")",
"{",
"log",
".",
"Println",
"(",
"\"",
"\"",
")",
"\n\n",
"// TODO: Need to be able to get a non-zero exit code here!",
"_",
",",
"server",
".",
"Error",
"=",
"p",
".",
"pactMockSvcManager",
".",
"Stop",
"(",
"server",
".",
"Pid",
")",
"\n",
"return",
"server",
",",
"server",
".",
"Error",
"\n",
"}"
] |
6,712 | all-6713 | [
"UnmarshalYAML",
"implements",
"yaml",
".",
"Unamrshaler",
"interface",
".",
"It",
"parses",
"time",
".",
"Duration",
"as",
"strings",
"."
] | [
"func",
"(",
"o",
"*",
"Options",
")",
"UnmarshalYAML",
"(",
"unmarshal",
"func",
"(",
"<mask>",
"{",
"}",
")",
"error",
")",
"error",
"{",
"v",
":=",
"&",
"optionsJSON",
"{",
"}",
"\n",
"if",
"err",
":=",
"unmarshal",
"(",
"v",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"*",
"o",
"=",
"Options",
"{",
"Timeout",
":",
"v",
".",
"Timeout",
".",
"Duration",
"(",
")",
",",
"KeepAlive",
":",
"v",
".",
"KeepAlive",
".",
"Duration",
"(",
")",
",",
"TLSHandshakeTimeout",
":",
"v",
".",
"TLSHandshakeTimeout",
".",
"Duration",
"(",
")",
",",
"TLSSkipVerify",
":",
"v",
".",
"TLSSkipVerify",
",",
"RetryTimeMax",
":",
"v",
".",
"RetryTimeMax",
".",
"Duration",
"(",
")",
",",
"RetrySleepMax",
":",
"v",
".",
"RetrySleepMax",
".",
"Duration",
"(",
")",
",",
"RetrySleepBase",
":",
"v",
".",
"RetrySleepBase",
".",
"Duration",
"(",
")",
",",
"}",
"\n",
"return",
"nil",
"\n",
"}"
] |
6,713 | all-6714 | [
"GetWebsiteLabel",
"is",
"a",
"wrapper",
"around",
"gtk_about_dialog_get_website_label",
"()",
"."
] | [
"func",
"(",
"v",
"*",
"AboutDialog",
")",
"GetWebsiteLabel",
"(",
")",
"string",
"{",
"c",
":=",
"C",
".",
"gtk_about_dialog_get_website_label",
"(",
"v",
".",
"native",
"(",
")",
")",
"\n",
"return",
"C",
".",
"GoString",
"(",
"(",
"*",
"C",
".",
"<mask>",
")",
"(",
"c",
")",
")",
"\n",
"}"
] |
6,714 | all-6715 | [
"name",
"returns",
"the",
"import",
"path",
"qualified",
"name",
"of",
"the",
"function",
"containing",
"the",
"call",
"."
] | [
"func",
"(",
"pc",
"Call",
")",
"name",
"(",
")",
"string",
"{",
"pcFix",
":=",
"uintptr",
"(",
"<mask>",
")",
"-",
"1",
"// work around for go issue #7690",
"\n",
"fn",
":=",
"runtime",
".",
"FuncForPC",
"(",
"pcFix",
")",
"\n",
"if",
"fn",
"==",
"nil",
"{",
"return",
"\"",
"\"",
"\n",
"}",
"\n",
"return",
"fn",
".",
"Name",
"(",
")",
"\n",
"}"
] |
6,715 | all-6716 | [
"ToWriter",
"downloads",
"the",
"specified",
"src",
"URL",
"to",
"w",
"writer",
"using",
"the",
"specified",
"Options",
"."
] | [
"func",
"ToWriter",
"(",
"src",
"string",
",",
"w",
"<mask>",
".",
"Writer",
",",
"options",
"Options",
")",
"error",
"{",
"u",
",",
"err",
":=",
"url",
".",
"Parse",
"(",
"src",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"errors",
".",
"Wrap",
"(",
"err",
",",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"return",
"FromURL",
"(",
"u",
",",
"w",
",",
"options",
")",
"\n",
"}"
] |
6,716 | all-6717 | [
"Info",
"indicates",
"an",
"expected",
"call",
"of",
"Info"
] | [
"func",
"(",
"mr",
"*",
"MockInfoLoggerMockRecorder",
")",
"Info",
"(",
"arg0",
"...",
"<mask>",
"{",
"}",
")",
"*",
"gomock",
".",
"Call",
"{",
"return",
"mr",
".",
"mock",
".",
"ctrl",
".",
"RecordCallWithMethodType",
"(",
"mr",
".",
"mock",
",",
"\"",
"\"",
",",
"reflect",
".",
"TypeOf",
"(",
"(",
"*",
"MockInfoLogger",
")",
"(",
"nil",
")",
".",
"Info",
")",
",",
"arg0",
"...",
")",
"\n",
"}"
] |
6,717 | all-6718 | [
"DeProvisionHost",
"-",
"make",
"a",
"deprovision",
"call",
"to",
"innkeeper",
"for",
"a",
"given",
"requestID"
] | [
"func",
"(",
"s",
"*",
"IKClient",
")",
"DeProvisionHost",
"(",
"requestID",
"string",
")",
"(",
"resp",
"*",
"innkeeperclient",
".",
"GetStatusResponse",
",",
"err",
"error",
")",
"{",
"s",
".",
"SpyRequestID",
"=",
"requestID",
"\n",
"return",
"nil",
",",
"s",
".",
"<mask>",
"\n",
"}"
] |
6,718 | all-6719 | [
"Open",
"the",
"node",
"-",
"local",
"database",
"object",
"."
] | [
"func",
"Open",
"(",
"dir",
"string",
")",
"(",
"*",
"sql",
".",
"DB",
",",
"error",
")",
"{",
"<mask>",
":=",
"filepath",
".",
"Join",
"(",
"dir",
",",
"\"",
"\"",
")",
"\n",
"db",
",",
"err",
":=",
"sqliteOpen",
"(",
"path",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"}",
"\n\n",
"return",
"db",
",",
"nil",
"\n",
"}"
] |
6,719 | all-6720 | [
"GetStatus",
"--"
] | [
"func",
"(",
"s",
"*",
"IKClient",
")",
"GetStatus",
"(",
"requestID",
"string",
")",
"(",
"resp",
"*",
"innkeeperclient",
".",
"GetStatusResponse",
",",
"err",
"error",
")",
"{",
"resp",
"=",
"<mask>",
"(",
"innkeeperclient",
".",
"GetStatusResponse",
")",
"\n",
"atomic",
".",
"AddInt64",
"(",
"s",
".",
"SpyStatusCallCount",
",",
"1",
")",
"\n",
"if",
"atomic",
".",
"LoadInt64",
"(",
"s",
".",
"SpyStatusCallCount",
")",
">",
"s",
".",
"StatusCallCountForComplete",
"{",
"resp",
".",
"Status",
"=",
"taskmanager",
".",
"AgentTaskStatusComplete",
"\n",
"resp",
".",
"Data",
".",
"Status",
"=",
"taskmanager",
".",
"AgentTaskStatusComplete",
"\n",
"}",
"\n",
"return",
"\n",
"}"
] |
6,720 | all-6721 | [
"Update",
"an",
"article"
] | [
"func",
"Update",
"(",
"c",
"*",
"gin",
".",
"Context",
")",
"{",
"db",
":=",
"c",
".",
"MustGet",
"(",
"\"",
"\"",
")",
".",
"(",
"*",
"mgo",
".",
"Database",
")",
"\n\n",
"article",
":=",
"models",
".",
"Article",
"{",
"}",
"\n",
"err",
":=",
"c",
".",
"Bind",
"(",
"&",
"article",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"c",
".",
"Error",
"(",
"err",
")",
"\n",
"return",
"\n",
"}",
"\n\n",
"query",
":=",
"bson",
".",
"M",
"{",
"\"",
"\"",
":",
"bson",
".",
"ObjectIdHex",
"(",
"c",
".",
"Param",
"(",
"\"",
"\"",
")",
")",
"}",
"\n",
"doc",
":=",
"bson",
".",
"M",
"{",
"\"",
"\"",
":",
"article",
".",
"Title",
",",
"\"",
"\"",
":",
"article",
".",
"Body",
",",
"\"",
"\"",
":",
"time",
".",
"Now",
"(",
")",
".",
"UnixNano",
"(",
")",
"/",
"int64",
"(",
"<mask>",
".",
"Millisecond",
")",
",",
"}",
"\n",
"err",
"=",
"db",
".",
"C",
"(",
"models",
".",
"CollectionArticle",
")",
".",
"Update",
"(",
"query",
",",
"doc",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"c",
".",
"Error",
"(",
"err",
")",
"\n",
"}",
"\n",
"c",
".",
"Redirect",
"(",
"http",
".",
"StatusMovedPermanently",
",",
"\"",
"\"",
")",
"\n",
"}"
] |
6,721 | all-6722 | [
"FetchOutlierReports",
"retrieves",
"all",
"outlier",
"reports",
"available",
"to",
"API",
"Token",
"."
] | [
"func",
"(",
"a",
"*",
"API",
")",
"FetchOutlierReports",
"(",
")",
"(",
"*",
"[",
"]",
"OutlierReport",
",",
"error",
")",
"{",
"result",
",",
"err",
":=",
"a",
".",
"Get",
"(",
"config",
".",
"OutlierReportPrefix",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"var",
"reports",
"[",
"]",
"OutlierReport",
"\n",
"if",
"err",
":=",
"json",
".",
"Unmarshal",
"(",
"<mask>",
",",
"&",
"reports",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"return",
"&",
"reports",
",",
"nil",
"\n",
"}"
] |
6,722 | all-6723 | [
"contains",
"code",
"taken",
"from",
"go1",
".",
"8",
"for",
"purposes",
"of",
"backwards",
"compatability",
"with",
"older",
"go",
"versions",
".",
"hostname",
"returns",
"u",
".",
"Host",
"without",
"any",
"port",
"number",
".",
"If",
"Host",
"is",
"an",
"IPv6",
"literal",
"with",
"a",
"port",
"number",
"Hostname",
"returns",
"the",
"IPv6",
"literal",
"without",
"the",
"square",
"brackets",
".",
"IPv6",
"literals",
"may",
"include",
"a",
"zone",
"identifier",
"."
] | [
"func",
"hostname",
"(",
"hostport",
"string",
")",
"<mask>",
"{",
"colon",
":=",
"strings",
".",
"IndexByte",
"(",
"hostport",
",",
"':'",
")",
"\n",
"if",
"colon",
"==",
"-",
"1",
"{",
"return",
"hostport",
"\n",
"}",
"\n",
"if",
"i",
":=",
"strings",
".",
"IndexByte",
"(",
"hostport",
",",
"']'",
")",
";",
"i",
"!=",
"-",
"1",
"{",
"return",
"strings",
".",
"TrimPrefix",
"(",
"hostport",
"[",
":",
"i",
"]",
",",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"return",
"hostport",
"[",
":",
"colon",
"]",
"\n",
"}"
] |
6,723 | all-6724 | [
"setJitterSeed",
"calculates",
"a",
"global",
"jitterSeed",
"per",
"server",
"relying",
"on",
"extra",
"label",
"set",
"."
] | [
"func",
"(",
"m",
"*",
"<mask>",
")",
"setJitterSeed",
"(",
"labels",
"labels",
".",
"Labels",
")",
"error",
"{",
"h",
":=",
"fnv",
".",
"New64a",
"(",
")",
"\n",
"hostname",
",",
"err",
":=",
"getFqdn",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"if",
"_",
",",
"err",
":=",
"fmt",
".",
"Fprintf",
"(",
"h",
",",
"\"",
"\"",
",",
"hostname",
",",
"labels",
".",
"String",
"(",
")",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"m",
".",
"jitterSeed",
"=",
"h",
".",
"Sum64",
"(",
")",
"\n",
"return",
"nil",
"\n",
"}"
] |
6,724 | all-6725 | [
"Add",
"appends",
"a",
"new",
"Problem",
"to",
"the",
"slice",
"for",
"the",
"specified",
"metric",
"with",
"the",
"specified",
"issue",
"text",
"."
] | [
"func",
"(",
"p",
"*",
"problems",
")",
"Add",
"(",
"mf",
"dto",
".",
"MetricFamily",
",",
"text",
"string",
")",
"{",
"*",
"p",
"=",
"append",
"(",
"*",
"p",
",",
"Problem",
"{",
"Metric",
":",
"mf",
".",
"GetName",
"(",
")",
",",
"Text",
":",
"<mask>",
",",
"}",
")",
"\n",
"}"
] |
6,725 | all-6726 | [
"Length",
"returns",
"the",
"number",
"of",
"elements",
"in",
"the",
"List",
"."
] | [
"func",
"(",
"l",
"*",
"List",
")",
"Length",
"(",
")",
"uint",
"{",
"l",
".",
"key",
".",
"RLock",
"(",
")",
"\n",
"defer",
"l",
".",
"<mask>",
".",
"RUnlock",
"(",
")",
"\n",
"return",
"uint",
"(",
"len",
"(",
"l",
".",
"underlyer",
")",
")",
"\n",
"}"
] |
6,726 | all-6727 | [
"ToPirateSpeak",
"will",
"format",
"the",
"provided",
"string",
"in",
"Pirate",
"Speak",
"."
] | [
"func",
"ToPirateSpeak",
"(",
"theString",
"string",
")",
"(",
"string",
",",
"error",
")",
"{",
"f",
":=",
"New",
"(",
"theString",
")",
"\n\n",
"if",
"f",
".",
"length",
"<",
"1",
"{",
"return",
"\"",
"\"",
",",
"errors",
".",
"New",
"(",
"lengthError",
")",
"\n",
"}",
"\n\n",
"f",
".",
"urlEncodeSpaces",
"(",
")",
"\n\n",
"<mask>",
",",
"err",
":=",
"http",
".",
"Get",
"(",
"fmt",
".",
"Sprintf",
"(",
"pirateLink",
",",
"f",
".",
"theString",
")",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"\"",
"\"",
",",
"errors",
".",
"New",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"defer",
"response",
".",
"Body",
".",
"Close",
"(",
")",
"\n\n",
"contents",
",",
"err",
":=",
"ioutil",
".",
"ReadAll",
"(",
"response",
".",
"Body",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"\"",
"\"",
",",
"err",
"\n",
"}",
"\n",
"return",
"string",
"(",
"contents",
")",
",",
"nil",
"\n",
"}"
] |
6,727 | all-6728 | [
"Arc",
"is",
"a",
"wrapper",
"around",
"cairo_arc",
"()",
"."
] | [
"func",
"(",
"v",
"*",
"<mask>",
")",
"Arc",
"(",
"xc",
",",
"yc",
",",
"radius",
",",
"angle1",
",",
"angle2",
"float64",
")",
"{",
"C",
".",
"cairo_arc",
"(",
"v",
".",
"native",
"(",
")",
",",
"C",
".",
"double",
"(",
"xc",
")",
",",
"C",
".",
"double",
"(",
"yc",
")",
",",
"C",
".",
"double",
"(",
"radius",
")",
",",
"C",
".",
"double",
"(",
"angle1",
")",
",",
"C",
".",
"double",
"(",
"angle2",
")",
")",
"\n",
"}"
] |
6,728 | all-6729 | [
"Clone",
"creates",
"a",
"copy",
"of",
"the",
"set",
"where",
"the",
"values",
"in",
"clone",
"set",
"point",
"to",
"the",
"same",
"underlying",
"reference",
"as",
"the",
"original",
"set"
] | [
"func",
"(",
"set",
"basicSet",
")",
"Clone",
"(",
")",
"set",
"{",
"clone",
":=",
"basicSet",
"(",
"<mask>",
"(",
"map",
"[",
"string",
"]",
"interface",
"{",
"}",
")",
")",
"\n",
"for",
"k",
",",
"v",
":=",
"range",
"set",
"{",
"clone",
"[",
"k",
"]",
"=",
"v",
"\n",
"}",
"\n\n",
"return",
"clone",
"\n",
"}"
] |
6,729 | all-6730 | [
"GetCaps",
"extracts",
"the",
"list",
"of",
"capabilities",
"effective",
"on",
"the",
"file"
] | [
"func",
"GetCaps",
"(",
"path",
"string",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"xattrs",
",",
"err",
":=",
"shared",
".",
"GetAllXattr",
"(",
"path",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"valueStr",
",",
"<mask>",
":=",
"xattrs",
"[",
"\"",
"\"",
"]",
"\n",
"if",
"!",
"ok",
"{",
"return",
"nil",
",",
"nil",
"\n",
"}",
"\n\n",
"return",
"[",
"]",
"byte",
"(",
"valueStr",
")",
",",
"nil",
"\n",
"}"
] |
6,730 | all-6731 | [
"return",
"the",
"pointer",
"to",
"a",
"mapped",
"buffer",
"object",
"s",
"data",
"store"
] | [
"func",
"GetBufferPointerv",
"(",
"<mask>",
"uint32",
",",
"pname",
"uint32",
",",
"params",
"*",
"unsafe",
".",
"Pointer",
")",
"{",
"C",
".",
"glowGetBufferPointerv",
"(",
"gpGetBufferPointerv",
",",
"(",
"C",
".",
"GLenum",
")",
"(",
"target",
")",
",",
"(",
"C",
".",
"GLenum",
")",
"(",
"pname",
")",
",",
"params",
")",
"\n",
"}"
] |
6,731 | all-6732 | [
"GetNoMetricHosts",
"returns",
"the",
"NoMetricHosts",
"field",
"if",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"."
] | [
"func",
"(",
"t",
"*",
"TileDef",
")",
"GetNoMetricHosts",
"(",
")",
"bool",
"{",
"if",
"t",
"==",
"nil",
"||",
"t",
".",
"NoMetricHosts",
"==",
"nil",
"{",
"return",
"<mask>",
"\n",
"}",
"\n",
"return",
"*",
"t",
".",
"NoMetricHosts",
"\n",
"}"
] |
6,732 | all-6733 | [
"Start",
"returns",
"a",
"derivative",
"query",
"with",
"the",
"given",
"start",
"point",
"."
] | [
"func",
"(",
"q",
"*",
"Query",
")",
"Start",
"(",
"c",
"Cursor",
")",
"*",
"<mask>",
"{",
"q",
"=",
"q",
".",
"clone",
"(",
")",
"\n",
"if",
"c",
".",
"cc",
"==",
"nil",
"{",
"q",
".",
"err",
"=",
"errors",
".",
"New",
"(",
"\"",
"\"",
")",
"\n",
"return",
"q",
"\n",
"}",
"\n",
"q",
".",
"start",
"=",
"c",
".",
"cc",
"\n",
"return",
"q",
"\n",
"}"
] |
6,733 | all-6734 | [
"SetCursor",
"is",
"a",
"wrapper",
"around",
"gtk_icon_view_set_selection_mode",
"()",
"."
] | [
"func",
"(",
"v",
"*",
"IconView",
")",
"SetCursor",
"(",
"path",
"*",
"TreePath",
",",
"<mask>",
"*",
"CellRenderer",
",",
"startEditing",
"bool",
")",
"{",
"C",
".",
"gtk_icon_view_set_cursor",
"(",
"v",
".",
"native",
"(",
")",
",",
"path",
".",
"native",
"(",
")",
",",
"cell",
".",
"native",
"(",
")",
",",
"gbool",
"(",
"startEditing",
")",
")",
"\n",
"}"
] |
6,734 | all-6735 | [
"Add",
"creates",
"a",
"Job",
"from",
"the",
"given",
"function",
"and",
"args",
"and",
"adds",
"it",
"to",
"the",
"Pool",
"."
] | [
"func",
"(",
"pool",
"*",
"Pool",
")",
"Add",
"(",
"f",
"func",
"(",
"...",
"interface",
"{",
"}",
")",
"interface",
"{",
"}",
",",
"args",
"...",
"interface",
"{",
"}",
")",
"{",
"job",
":=",
"&",
"Job",
"{",
"f",
",",
"args",
",",
"nil",
",",
"nil",
",",
"make",
"(",
"chan",
"bool",
")",
",",
"0",
",",
"pool",
".",
"getNextJobId",
"(",
")",
"}",
"\n",
"pool",
".",
"add_pipe",
"<-",
"job",
"\n",
"<-",
"<mask>",
".",
"added",
"\n",
"}"
] |
6,735 | all-6736 | [
"LabelsAndAnnotationsForJob",
"returns",
"a",
"standard",
"set",
"of",
"labels",
"to",
"add",
"to",
"pod",
"/",
"build",
"/",
"etc",
"resources",
"."
] | [
"func",
"LabelsAndAnnotationsForJob",
"(",
"pj",
"prowapi",
".",
"ProwJob",
")",
"(",
"map",
"[",
"string",
"]",
"string",
",",
"map",
"[",
"string",
"]",
"string",
")",
"{",
"var",
"extraLabels",
"map",
"[",
"string",
"]",
"string",
"\n",
"if",
"extraLabels",
"=",
"pj",
".",
"ObjectMeta",
".",
"Labels",
";",
"extraLabels",
"==",
"nil",
"{",
"extraLabels",
"=",
"<mask>",
"[",
"string",
"]",
"string",
"{",
"}",
"\n",
"}",
"\n",
"extraLabels",
"[",
"kube",
".",
"ProwJobIDLabel",
"]",
"=",
"pj",
".",
"ObjectMeta",
".",
"Name",
"\n",
"return",
"LabelsAndAnnotationsForSpec",
"(",
"pj",
".",
"Spec",
",",
"extraLabels",
",",
"nil",
")",
"\n",
"}"
] |
6,736 | all-6737 | [
"Core",
"takes",
"a",
"loaded",
"core",
"file",
"and",
"extracts",
"Go",
"information",
"from",
"it",
"."
] | [
"func",
"Core",
"(",
"proc",
"*",
"core",
".",
"Process",
")",
"(",
"p",
"*",
"Process",
",",
"err",
"error",
")",
"{",
"// Make sure we have DWARF info.",
"if",
"_",
",",
"err",
":=",
"proc",
".",
"DWARF",
"(",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"// Guard against failures of proc.Read* routines.",
"/*\n\t\tdefer func() {\n\t\t\te := recover()\n\t\t\tif e == nil {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tp = nil\n\t\t\tif x, ok := e.(error); ok {\n\t\t\t\terr = x\n\t\t\t\treturn\n\t\t\t}\n\t\t\tpanic(e) // Not an error, re-panic it.\n\t\t}()\n\t*/",
"p",
"=",
"&",
"<mask>",
"{",
"proc",
":",
"proc",
",",
"runtimeMap",
":",
"map",
"[",
"core",
".",
"Address",
"]",
"*",
"Type",
"{",
"}",
",",
"dwarfMap",
":",
"map",
"[",
"dwarf",
".",
"Type",
"]",
"*",
"Type",
"{",
"}",
",",
"}",
"\n\n",
"// Initialize everything that just depends on DWARF.",
"p",
".",
"readDWARFTypes",
"(",
")",
"\n",
"p",
".",
"readRuntimeConstants",
"(",
")",
"\n",
"p",
".",
"readGlobals",
"(",
")",
"\n\n",
"// Find runtime globals we care about. Initialize regions for them.",
"p",
".",
"rtGlobals",
"=",
"map",
"[",
"string",
"]",
"region",
"{",
"}",
"\n",
"for",
"_",
",",
"g",
":=",
"range",
"p",
".",
"globals",
"{",
"if",
"strings",
".",
"HasPrefix",
"(",
"g",
".",
"Name",
",",
"\"",
"\"",
")",
"{",
"p",
".",
"rtGlobals",
"[",
"g",
".",
"Name",
"[",
"8",
":",
"]",
"]",
"=",
"region",
"{",
"p",
":",
"p",
",",
"a",
":",
"g",
".",
"Addr",
",",
"typ",
":",
"g",
".",
"Type",
"}",
"\n",
"}",
"\n",
"}",
"\n\n",
"// Read all the data that depend on runtime globals.",
"p",
".",
"buildVersion",
"=",
"p",
".",
"rtGlobals",
"[",
"\"",
"\"",
"]",
".",
"String",
"(",
")",
"\n",
"p",
".",
"readModules",
"(",
")",
"\n",
"p",
".",
"readHeap",
"(",
")",
"\n",
"p",
".",
"readGs",
"(",
")",
"\n",
"p",
".",
"readStackVars",
"(",
")",
"// needs to be after readGs.",
"\n",
"p",
".",
"markObjects",
"(",
")",
"// needs to be after readGlobals, readStackVars.",
"\n\n",
"return",
"p",
",",
"nil",
"\n",
"}"
] |
6,737 | all-6738 | [
"Delete",
"executes",
"DELETE",
"request",
"to",
"the",
"endpoint",
"with",
"no",
"body",
"re",
"err",
":",
"=",
"c",
".",
"Delete",
"(",
"c",
".",
"Endpoint",
"(",
"users",
"id1",
"))"
] | [
"func",
"(",
"c",
"*",
"<mask>",
")",
"Delete",
"(",
"ctx",
"context",
".",
"Context",
",",
"endpoint",
"string",
")",
"(",
"*",
"Response",
",",
"error",
")",
"{",
"// If the sanitizer is enabled, make sure the requested path is safe.",
"if",
"c",
".",
"sanitizerEnabled",
"{",
"err",
":=",
"isPathSafe",
"(",
"endpoint",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"}",
"\n\n",
"tracer",
":=",
"c",
".",
"newTracer",
"(",
")",
"\n",
"return",
"tracer",
".",
"Done",
"(",
"c",
".",
"RoundTrip",
"(",
"func",
"(",
")",
"(",
"*",
"http",
".",
"Response",
",",
"error",
")",
"{",
"req",
",",
"err",
":=",
"http",
".",
"NewRequest",
"(",
"http",
".",
"MethodDelete",
",",
"endpoint",
",",
"nil",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"req",
"=",
"req",
".",
"WithContext",
"(",
"ctx",
")",
"\n",
"c",
".",
"addAuth",
"(",
"req",
")",
"\n",
"tracer",
".",
"Start",
"(",
"req",
")",
"\n",
"return",
"c",
".",
"client",
".",
"Do",
"(",
"req",
")",
"\n",
"}",
")",
")",
"\n",
"}"
] |
6,738 | all-6739 | [
"fuzzInterval",
"returns",
"a",
"fuzzed",
"version",
"of",
"the",
"interval",
"based",
"on",
"FullJitter",
"as",
"described",
"here",
":",
"http",
":",
"//",
"www",
".",
"awsarchitectureblog",
".",
"com",
"/",
"2015",
"/",
"03",
"/",
"backoff",
".",
"html"
] | [
"func",
"fuzzInterval",
"(",
"interval",
"<mask>",
".",
"Duration",
")",
"time",
".",
"Duration",
"{",
"return",
"time",
".",
"Duration",
"(",
"rand",
".",
"Int63n",
"(",
"int64",
"(",
"interval",
")",
")",
")",
"\n",
"}"
] |
6,739 | all-6740 | [
"ReplaceConfigMap",
"puts",
"the",
"configmap",
"into",
"name",
".",
"Analogous",
"to",
"kubectl",
"replace",
"configmap",
"If",
"config",
".",
"Namespace",
"is",
"empty",
"the",
"client",
"s",
"specified",
"namespace",
"is",
"used",
".",
"Returns",
"the",
"content",
"returned",
"by",
"the",
"apiserver"
] | [
"func",
"(",
"c",
"*",
"Client",
")",
"ReplaceConfigMap",
"(",
"name",
"string",
",",
"config",
"ConfigMap",
")",
"(",
"ConfigMap",
",",
"error",
")",
"{",
"c",
".",
"log",
"(",
"\"",
"\"",
",",
"name",
")",
"\n",
"namespace",
":=",
"c",
".",
"namespace",
"\n",
"if",
"config",
".",
"Namespace",
"!=",
"\"",
"\"",
"{",
"namespace",
"=",
"config",
".",
"Namespace",
"\n",
"}",
"\n",
"var",
"retConfigMap",
"ConfigMap",
"\n",
"err",
":=",
"c",
".",
"<mask>",
"(",
"&",
"request",
"{",
"method",
":",
"http",
".",
"MethodPut",
",",
"path",
":",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"namespace",
",",
"name",
")",
",",
"requestBody",
":",
"&",
"config",
",",
"}",
",",
"&",
"retConfigMap",
")",
"\n\n",
"return",
"retConfigMap",
",",
"err",
"\n",
"}"
] |
6,740 | all-6741 | [
"RemoveCounter",
"removes",
"the",
"named",
"counter"
] | [
"func",
"(",
"m",
"*",
"CirconusMetrics",
")",
"RemoveCounter",
"(",
"metric",
"string",
")",
"{",
"m",
".",
"cm",
".",
"Lock",
"(",
")",
"\n",
"defer",
"m",
".",
"cm",
".",
"Unlock",
"(",
")",
"\n",
"<mask>",
"(",
"m",
".",
"counters",
",",
"metric",
")",
"\n",
"}"
] |
6,741 | all-6742 | [
"Names",
"returns",
"the",
"names",
"of",
"the",
"configured",
"providers",
"."
] | [
"func",
"(",
"d",
"*",
"Discover",
")",
"Names",
"(",
")",
"[",
"]",
"string",
"{",
"d",
".",
"once",
".",
"Do",
"(",
"d",
".",
"initProviders",
")",
"\n\n",
"var",
"names",
"[",
"]",
"string",
"\n",
"for",
"n",
":=",
"range",
"d",
".",
"Providers",
"{",
"names",
"=",
"append",
"(",
"names",
",",
"n",
")",
"\n",
"}",
"\n",
"sort",
".",
"Strings",
"(",
"<mask>",
")",
"\n",
"return",
"names",
"\n",
"}"
] |
6,742 | all-6743 | [
"Transaction",
"creates",
"a",
"new",
"ClusterTx",
"object",
"and",
"transactionally",
"executes",
"the",
"cluster",
"database",
"interactions",
"invoked",
"by",
"the",
"given",
"function",
".",
"If",
"the",
"function",
"returns",
"no",
"error",
"all",
"database",
"changes",
"are",
"committed",
"to",
"the",
"cluster",
"database",
"database",
"otherwise",
"they",
"are",
"rolled",
"back",
".",
"If",
"EnterExclusive",
"has",
"been",
"called",
"before",
"calling",
"Transaction",
"will",
"block",
"until",
"ExitExclusive",
"has",
"been",
"called",
"as",
"well",
"to",
"release",
"the",
"lock",
"."
] | [
"func",
"(",
"c",
"*",
"Cluster",
")",
"<mask>",
"(",
"f",
"func",
"(",
"*",
"ClusterTx",
")",
"error",
")",
"error",
"{",
"c",
".",
"mu",
".",
"RLock",
"(",
")",
"\n",
"defer",
"c",
".",
"mu",
".",
"RUnlock",
"(",
")",
"\n",
"return",
"c",
".",
"transaction",
"(",
"f",
")",
"\n",
"}"
] |
6,743 | all-6744 | [
"NewASMClient",
"mocks",
"base",
"method"
] | [
"func",
"(",
"m",
"*",
"MockClientCreator",
")",
"NewASMClient",
"(",
"arg0",
"string",
",",
"arg1",
"credentials",
".",
"IAMRoleCredentials",
")",
"secretsmanageriface",
".",
"SecretsManagerAPI",
"{",
"ret",
":=",
"m",
".",
"ctrl",
".",
"Call",
"(",
"m",
",",
"\"",
"\"",
",",
"arg0",
",",
"arg1",
")",
"\n",
"ret0",
",",
"_",
":=",
"<mask>",
"[",
"0",
"]",
".",
"(",
"secretsmanageriface",
".",
"SecretsManagerAPI",
")",
"\n",
"return",
"ret0",
"\n",
"}"
] |
6,744 | all-6745 | [
"create",
"creates",
"a",
"new",
"log",
"file",
"and",
"returns",
"the",
"file",
"and",
"its",
"filename",
"which",
"contains",
"tag",
"(",
"INFO",
"FATAL",
"etc",
".",
")",
"and",
"t",
".",
"If",
"the",
"file",
"is",
"created",
"successfully",
"create",
"also",
"attempts",
"to",
"update",
"the",
"symlink",
"for",
"that",
"tag",
"ignoring",
"errors",
"."
] | [
"func",
"(",
"l",
"*",
"Log",
")",
"create",
"(",
"<mask>",
"string",
",",
"t",
"time",
".",
"Time",
")",
"(",
"f",
"*",
"os",
".",
"File",
",",
"filename",
"string",
",",
"err",
"error",
")",
"{",
"if",
"len",
"(",
"l",
".",
"logDirs",
")",
"==",
"0",
"{",
"return",
"nil",
",",
"\"",
"\"",
",",
"errors",
".",
"New",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"name",
",",
"link",
":=",
"logName",
"(",
"l",
".",
"name",
",",
"tag",
",",
"t",
")",
"\n",
"var",
"lastErr",
"error",
"\n",
"for",
"_",
",",
"dir",
":=",
"range",
"l",
".",
"logDirs",
"{",
"fname",
":=",
"filepath",
".",
"Join",
"(",
"dir",
",",
"name",
")",
"\n",
"f",
",",
"err",
":=",
"os",
".",
"Create",
"(",
"fname",
")",
"\n",
"if",
"err",
"==",
"nil",
"{",
"symlink",
":=",
"filepath",
".",
"Join",
"(",
"dir",
",",
"link",
")",
"\n",
"os",
".",
"Remove",
"(",
"symlink",
")",
"// ignore err",
"\n",
"os",
".",
"Symlink",
"(",
"name",
",",
"symlink",
")",
"// ignore err",
"\n",
"return",
"f",
",",
"fname",
",",
"nil",
"\n",
"}",
"\n",
"lastErr",
"=",
"err",
"\n",
"}",
"\n",
"return",
"nil",
",",
"\"",
"\"",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"lastErr",
")",
"\n",
"}"
] |
6,745 | all-6746 | [
"next",
"advances",
"the",
"openMetricsLexer",
"to",
"the",
"next",
"character",
"."
] | [
"func",
"(",
"l",
"*",
"openMetricsLexer",
")",
"<mask>",
"(",
")",
"byte",
"{",
"l",
".",
"i",
"++",
"\n",
"if",
"l",
".",
"i",
">=",
"len",
"(",
"l",
".",
"b",
")",
"{",
"l",
".",
"err",
"=",
"io",
".",
"EOF",
"\n",
"return",
"byte",
"(",
"tEOF",
")",
"\n",
"}",
"\n",
"// Lex struggles with null bytes. If we are in a label value or help string, where",
"// they are allowed, consume them here immediately.",
"for",
"l",
".",
"b",
"[",
"l",
".",
"i",
"]",
"==",
"0",
"&&",
"(",
"l",
".",
"state",
"==",
"sLValue",
"||",
"l",
".",
"state",
"==",
"sMeta2",
"||",
"l",
".",
"state",
"==",
"sComment",
")",
"{",
"l",
".",
"i",
"++",
"\n",
"if",
"l",
".",
"i",
">=",
"len",
"(",
"l",
".",
"b",
")",
"{",
"l",
".",
"err",
"=",
"io",
".",
"EOF",
"\n",
"return",
"byte",
"(",
"tEOF",
")",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"l",
".",
"b",
"[",
"l",
".",
"i",
"]",
"\n",
"}"
] |
6,746 | all-6747 | [
"NewQuery",
"creates",
"a",
"new",
"Livestatus",
"query",
"instance",
"."
] | [
"func",
"NewQuery",
"(",
"table",
"string",
")",
"*",
"Query",
"{",
"return",
"&",
"Query",
"{",
"table",
":",
"<mask>",
",",
"headers",
":",
"[",
"]",
"string",
"{",
"}",
",",
"columns",
":",
"[",
"]",
"string",
"{",
"}",
",",
"}",
"\n",
"}"
] |
6,747 | all-6748 | [
"LintRedundantNilCheckWithLen",
"checks",
"for",
"the",
"following",
"reduntant",
"nil",
"-",
"checks",
":",
"if",
"x",
"==",
"nil",
"||",
"len",
"(",
"x",
")",
"==",
"0",
"{}",
"if",
"x",
"!",
"=",
"nil",
"&&",
"len",
"(",
"x",
")",
"!",
"=",
"0",
"{}",
"if",
"x",
"!",
"=",
"nil",
"&&",
"len",
"(",
"x",
")",
"==",
"N",
"{}",
"(",
"where",
"N",
"!",
"=",
"0",
")",
"if",
"x",
"!",
"=",
"nil",
"&&",
"len",
"(",
"x",
")",
">",
"N",
"{}",
"if",
"x",
"!",
"=",
"nil",
"&&",
"len",
"(",
"x",
")",
">",
"=",
"N",
"{}",
"(",
"where",
"N",
"!",
"=",
"0",
")"
] | [
"func",
"(",
"c",
"*",
"Checker",
")",
"LintRedundantNilCheckWithLen",
"(",
"j",
"*",
"lint",
".",
"Job",
")",
"{",
"isConstZero",
":=",
"func",
"(",
"expr",
"ast",
".",
"Expr",
")",
"(",
"isConst",
"bool",
",",
"isZero",
"bool",
")",
"{",
"_",
",",
"ok",
":=",
"expr",
".",
"(",
"*",
"ast",
".",
"BasicLit",
")",
"\n",
"if",
"ok",
"{",
"return",
"true",
",",
"IsZero",
"(",
"expr",
")",
"\n",
"}",
"\n",
"id",
",",
"ok",
":=",
"expr",
".",
"(",
"*",
"ast",
".",
"Ident",
")",
"\n",
"if",
"!",
"ok",
"{",
"return",
"false",
",",
"false",
"\n",
"}",
"\n",
"c",
",",
"ok",
":=",
"ObjectOf",
"(",
"j",
",",
"id",
")",
".",
"(",
"*",
"<mask>",
".",
"Const",
")",
"\n",
"if",
"!",
"ok",
"{",
"return",
"false",
",",
"false",
"\n",
"}",
"\n",
"return",
"true",
",",
"c",
".",
"Val",
"(",
")",
".",
"Kind",
"(",
")",
"==",
"constant",
".",
"Int",
"&&",
"c",
".",
"Val",
"(",
")",
".",
"String",
"(",
")",
"==",
"\"",
"\"",
"\n",
"}",
"\n\n",
"fn",
":=",
"func",
"(",
"node",
"ast",
".",
"Node",
")",
"bool",
"{",
"// check that expr is \"x || y\" or \"x && y\"",
"expr",
",",
"ok",
":=",
"node",
".",
"(",
"*",
"ast",
".",
"BinaryExpr",
")",
"\n",
"if",
"!",
"ok",
"{",
"return",
"true",
"\n",
"}",
"\n",
"if",
"expr",
".",
"Op",
"!=",
"token",
".",
"LOR",
"&&",
"expr",
".",
"Op",
"!=",
"token",
".",
"LAND",
"{",
"return",
"true",
"\n",
"}",
"\n",
"eqNil",
":=",
"expr",
".",
"Op",
"==",
"token",
".",
"LOR",
"\n\n",
"// check that x is \"xx == nil\" or \"xx != nil\"",
"x",
",",
"ok",
":=",
"expr",
".",
"X",
".",
"(",
"*",
"ast",
".",
"BinaryExpr",
")",
"\n",
"if",
"!",
"ok",
"{",
"return",
"true",
"\n",
"}",
"\n",
"if",
"eqNil",
"&&",
"x",
".",
"Op",
"!=",
"token",
".",
"EQL",
"{",
"return",
"true",
"\n",
"}",
"\n",
"if",
"!",
"eqNil",
"&&",
"x",
".",
"Op",
"!=",
"token",
".",
"NEQ",
"{",
"return",
"true",
"\n",
"}",
"\n",
"xx",
",",
"ok",
":=",
"x",
".",
"X",
".",
"(",
"*",
"ast",
".",
"Ident",
")",
"\n",
"if",
"!",
"ok",
"{",
"return",
"true",
"\n",
"}",
"\n",
"if",
"!",
"IsNil",
"(",
"j",
",",
"x",
".",
"Y",
")",
"{",
"return",
"true",
"\n",
"}",
"\n\n",
"// check that y is \"len(xx) == 0\" or \"len(xx) ... \"",
"y",
",",
"ok",
":=",
"expr",
".",
"Y",
".",
"(",
"*",
"ast",
".",
"BinaryExpr",
")",
"\n",
"if",
"!",
"ok",
"{",
"return",
"true",
"\n",
"}",
"\n",
"if",
"eqNil",
"&&",
"y",
".",
"Op",
"!=",
"token",
".",
"EQL",
"{",
"// must be len(xx) *==* 0",
"return",
"false",
"\n",
"}",
"\n",
"yx",
",",
"ok",
":=",
"y",
".",
"X",
".",
"(",
"*",
"ast",
".",
"CallExpr",
")",
"\n",
"if",
"!",
"ok",
"{",
"return",
"true",
"\n",
"}",
"\n",
"yxFun",
",",
"ok",
":=",
"yx",
".",
"Fun",
".",
"(",
"*",
"ast",
".",
"Ident",
")",
"\n",
"if",
"!",
"ok",
"||",
"yxFun",
".",
"Name",
"!=",
"\"",
"\"",
"||",
"len",
"(",
"yx",
".",
"Args",
")",
"!=",
"1",
"{",
"return",
"true",
"\n",
"}",
"\n",
"yxArg",
",",
"ok",
":=",
"yx",
".",
"Args",
"[",
"Arg",
"(",
"\"",
"\"",
")",
"]",
".",
"(",
"*",
"ast",
".",
"Ident",
")",
"\n",
"if",
"!",
"ok",
"{",
"return",
"true",
"\n",
"}",
"\n",
"if",
"yxArg",
".",
"Name",
"!=",
"xx",
".",
"Name",
"{",
"return",
"true",
"\n",
"}",
"\n\n",
"if",
"eqNil",
"&&",
"!",
"IsZero",
"(",
"y",
".",
"Y",
")",
"{",
"// must be len(x) == *0*",
"return",
"true",
"\n",
"}",
"\n\n",
"if",
"!",
"eqNil",
"{",
"isConst",
",",
"isZero",
":=",
"isConstZero",
"(",
"y",
".",
"Y",
")",
"\n",
"if",
"!",
"isConst",
"{",
"return",
"true",
"\n",
"}",
"\n",
"switch",
"y",
".",
"Op",
"{",
"case",
"token",
".",
"EQL",
":",
"// avoid false positive for \"xx != nil && len(xx) == 0\"",
"if",
"isZero",
"{",
"return",
"true",
"\n",
"}",
"\n",
"case",
"token",
".",
"GEQ",
":",
"// avoid false positive for \"xx != nil && len(xx) >= 0\"",
"if",
"isZero",
"{",
"return",
"true",
"\n",
"}",
"\n",
"case",
"token",
".",
"NEQ",
":",
"// avoid false positive for \"xx != nil && len(xx) != <non-zero>\"",
"if",
"!",
"isZero",
"{",
"return",
"true",
"\n",
"}",
"\n",
"case",
"token",
".",
"GTR",
":",
"// ok",
"default",
":",
"return",
"true",
"\n",
"}",
"\n",
"}",
"\n\n",
"// finally check that xx type is one of array, slice, map or chan",
"// this is to prevent false positive in case if xx is a pointer to an array",
"var",
"nilType",
"string",
"\n",
"switch",
"TypeOf",
"(",
"j",
",",
"xx",
")",
".",
"(",
"type",
")",
"{",
"case",
"*",
"types",
".",
"Slice",
":",
"nilType",
"=",
"\"",
"\"",
"\n",
"case",
"*",
"types",
".",
"Map",
":",
"nilType",
"=",
"\"",
"\"",
"\n",
"case",
"*",
"types",
".",
"Chan",
":",
"nilType",
"=",
"\"",
"\"",
"\n",
"default",
":",
"return",
"true",
"\n",
"}",
"\n",
"j",
".",
"Errorf",
"(",
"expr",
",",
"\"",
"\"",
",",
"nilType",
")",
"\n",
"return",
"true",
"\n",
"}",
"\n",
"for",
"_",
",",
"f",
":=",
"range",
"j",
".",
"Program",
".",
"Files",
"{",
"ast",
".",
"Inspect",
"(",
"f",
",",
"fn",
")",
"\n",
"}",
"\n",
"}"
] |
6,748 | all-6749 | [
"UnmarshalJSON",
"supports",
"json",
".",
"Unmarshaler",
"interface"
] | [
"func",
"(",
"v",
"*",
"EventExecutionContextCreated",
")",
"UnmarshalJSON",
"(",
"data",
"[",
"]",
"byte",
")",
"error",
"{",
"r",
":=",
"jlexer",
".",
"Lexer",
"{",
"Data",
":",
"data",
"}",
"\n",
"easyjsonC5a4559bDecodeGithubComChromedpCdprotoRuntime32",
"(",
"&",
"r",
",",
"v",
")",
"\n",
"return",
"r",
".",
"<mask>",
"(",
")",
"\n",
"}"
] |
6,749 | all-6750 | [
"ContainerSetState",
"sets",
"the",
"the",
"power",
"state",
"of",
"the",
"container",
"with",
"the",
"given",
"ID",
"."
] | [
"func",
"(",
"c",
"*",
"Cluster",
")",
"ContainerSetState",
"(",
"id",
"int",
",",
"state",
"string",
")",
"error",
"{",
"err",
":=",
"c",
".",
"Transaction",
"(",
"func",
"(",
"tx",
"*",
"ClusterTx",
")",
"error",
"{",
"// Set the new value",
"str",
":=",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
")",
"\n",
"stmt",
",",
"err",
":=",
"tx",
".",
"tx",
".",
"Prepare",
"(",
"str",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"defer",
"stmt",
".",
"Close",
"(",
")",
"\n\n",
"if",
"_",
",",
"err",
"=",
"stmt",
".",
"Exec",
"(",
"id",
",",
"<mask>",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}",
")",
"\n",
"return",
"err",
"\n",
"}"
] |
6,750 | all-6751 | [
"GetAuthentication",
"returns",
"the",
"registry",
"credentials",
"stored",
"in",
"either",
"auth",
".",
"json",
"file",
"or",
".",
"docker",
"/",
"config",
".",
"json",
"If",
"an",
"entry",
"is",
"not",
"found",
"empty",
"strings",
"are",
"returned",
"for",
"the",
"username",
"and",
"password"
] | [
"func",
"GetAuthentication",
"(",
"sys",
"*",
"types",
".",
"SystemContext",
",",
"registry",
"string",
")",
"(",
"string",
",",
"string",
",",
"error",
")",
"{",
"if",
"sys",
"!=",
"nil",
"&&",
"sys",
".",
"DockerAuthConfig",
"!=",
"nil",
"{",
"return",
"sys",
".",
"DockerAuthConfig",
".",
"Username",
",",
"sys",
".",
"DockerAuthConfig",
".",
"Password",
",",
"nil",
"\n",
"}",
"\n\n",
"dockerLegacyPath",
":=",
"filepath",
".",
"Join",
"(",
"homedir",
".",
"Get",
"(",
")",
",",
"dockerLegacyHomePath",
")",
"\n",
"var",
"paths",
"[",
"]",
"string",
"\n",
"pathToAuth",
",",
"err",
":=",
"getPathToAuth",
"(",
"sys",
")",
"\n",
"if",
"err",
"==",
"nil",
"{",
"paths",
"=",
"<mask>",
"(",
"paths",
",",
"pathToAuth",
")",
"\n",
"}",
"else",
"{",
"// Error means that the path set for XDG_RUNTIME_DIR does not exist",
"// but we don't want to completely fail in the case that the user is pulling a public image",
"// Logging the error as a warning instead and moving on to pulling the image",
"logrus",
".",
"Warnf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"}",
"\n",
"paths",
"=",
"append",
"(",
"paths",
",",
"filepath",
".",
"Join",
"(",
"homedir",
".",
"Get",
"(",
")",
",",
"dockerHomePath",
")",
",",
"dockerLegacyPath",
")",
"\n\n",
"for",
"_",
",",
"path",
":=",
"range",
"paths",
"{",
"legacyFormat",
":=",
"path",
"==",
"dockerLegacyPath",
"\n",
"username",
",",
"password",
",",
"err",
":=",
"findAuthentication",
"(",
"registry",
",",
"path",
",",
"legacyFormat",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"\"",
"\"",
",",
"\"",
"\"",
",",
"err",
"\n",
"}",
"\n",
"if",
"username",
"!=",
"\"",
"\"",
"&&",
"password",
"!=",
"\"",
"\"",
"{",
"return",
"username",
",",
"password",
",",
"nil",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"\"",
"\"",
",",
"\"",
"\"",
",",
"nil",
"\n",
"}"
] |
6,751 | all-6752 | [
"NewAccessTokenContext",
"returns",
"a",
"new",
"Context",
"that",
"carries",
"token",
"value",
"."
] | [
"func",
"NewAccessTokenContext",
"(",
"ctx",
"context",
".",
"Context",
",",
"<mask>",
"string",
")",
"context",
".",
"Context",
"{",
"return",
"context",
".",
"WithValue",
"(",
"ctx",
",",
"accessTokenContextKey",
",",
"at",
")",
"\n",
"}"
] |
6,752 | all-6753 | [
"FromJSON",
"loads",
"service",
"account",
"credentials",
"from",
"the",
"JSON",
"encoded",
"buf",
"."
] | [
"func",
"FromJSON",
"(",
"buf",
"[",
"]",
"byte",
",",
"opts",
"...",
"Option",
")",
"(",
"*",
"GServiceAccount",
",",
"error",
")",
"{",
"var",
"err",
"error",
"\n\n",
"// unmarshal",
"gsa",
":=",
"new",
"(",
"GServiceAccount",
")",
"\n",
"if",
"err",
"=",
"json",
".",
"Unmarshal",
"(",
"buf",
",",
"gsa",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"// apply opts",
"for",
"_",
",",
"o",
":=",
"<mask>",
"opts",
"{",
"if",
"err",
"=",
"o",
"(",
"gsa",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"}",
"\n\n",
"return",
"gsa",
",",
"nil",
"\n",
"}"
] |
6,753 | all-6754 | [
"Curls",
"an",
"app",
"s",
"endpoint",
"and",
"exit",
"successfully",
"before",
"the",
"specified",
"timeout"
] | [
"func",
"CurlAppWithTimeout",
"(",
"cfg",
"helpersinternal",
".",
"CurlConfig",
",",
"appName",
",",
"path",
"string",
",",
"timeout",
"<mask>",
".",
"Duration",
",",
"args",
"...",
"string",
")",
"string",
"{",
"appCurler",
":=",
"helpersinternal",
".",
"NewAppCurler",
"(",
"Curl",
",",
"cfg",
")",
"\n",
"return",
"appCurler",
".",
"CurlAndWait",
"(",
"cfg",
",",
"appName",
",",
"path",
",",
"timeout",
",",
"args",
"...",
")",
"\n",
"}"
] |
6,754 | all-6755 | [
"Commit",
"commits",
"the",
"transaction",
"following",
"these",
"steps",
":",
"1",
".",
"If",
"there",
"are",
"no",
"writes",
"return",
"immediately",
".",
"2",
".",
"Check",
"if",
"read",
"rows",
"were",
"updated",
"since",
"txn",
"started",
".",
"If",
"so",
"return",
"ErrConflict",
".",
"3",
".",
"If",
"no",
"conflict",
"generate",
"a",
"commit",
"timestamp",
"and",
"update",
"written",
"rows",
"commit",
"ts",
".",
"4",
".",
"Batch",
"up",
"all",
"writes",
"write",
"them",
"to",
"value",
"log",
"and",
"LSM",
"tree",
".",
"5",
".",
"If",
"callback",
"is",
"provided",
"Badger",
"will",
"return",
"immediately",
"after",
"checking",
"for",
"conflicts",
".",
"Writes",
"to",
"the",
"database",
"will",
"happen",
"in",
"the",
"background",
".",
"If",
"there",
"is",
"a",
"conflict",
"an",
"error",
"will",
"be",
"returned",
"and",
"the",
"callback",
"will",
"not",
"run",
".",
"If",
"there",
"are",
"no",
"conflicts",
"the",
"callback",
"will",
"be",
"called",
"in",
"the",
"background",
"upon",
"successful",
"completion",
"of",
"writes",
"or",
"any",
"error",
"during",
"write",
".",
"If",
"error",
"is",
"nil",
"the",
"transaction",
"is",
"successfully",
"committed",
".",
"In",
"case",
"of",
"a",
"non",
"-",
"nil",
"error",
"the",
"LSM",
"tree",
"won",
"t",
"be",
"updated",
"so",
"there",
"s",
"no",
"need",
"for",
"any",
"rollback",
"."
] | [
"func",
"(",
"txn",
"*",
"Txn",
")",
"Commit",
"(",
")",
"<mask>",
"{",
"txn",
".",
"commitPrecheck",
"(",
")",
"// Precheck before discarding txn.",
"\n",
"defer",
"txn",
".",
"Discard",
"(",
")",
"\n\n",
"if",
"len",
"(",
"txn",
".",
"writes",
")",
"==",
"0",
"{",
"return",
"nil",
"// Nothing to do.",
"\n",
"}",
"\n\n",
"txnCb",
",",
"err",
":=",
"txn",
".",
"commitAndSend",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"// If batchSet failed, LSM would not have been updated. So, no need to rollback anything.",
"// TODO: What if some of the txns successfully make it to value log, but others fail.",
"// Nothing gets updated to LSM, until a restart happens.",
"return",
"txnCb",
"(",
")",
"\n",
"}"
] |
6,755 | all-6756 | [
"runFSM",
"is",
"a",
"long",
"running",
"goroutine",
"responsible",
"for",
"applying",
"logs",
"to",
"the",
"FSM",
".",
"This",
"is",
"done",
"async",
"of",
"other",
"logs",
"since",
"we",
"don",
"t",
"want",
"the",
"FSM",
"to",
"block",
"our",
"internal",
"operations",
"."
] | [
"func",
"(",
"r",
"*",
"Raft",
")",
"runFSM",
"(",
")",
"{",
"var",
"lastIndex",
",",
"lastTerm",
"uint64",
"\n\n",
"commit",
":=",
"func",
"(",
"req",
"*",
"commitTuple",
")",
"{",
"// Apply the log if a command",
"var",
"resp",
"interface",
"{",
"}",
"\n",
"if",
"req",
".",
"log",
".",
"Type",
"==",
"LogCommand",
"{",
"start",
":=",
"time",
".",
"Now",
"(",
")",
"\n",
"resp",
"=",
"r",
".",
"fsm",
".",
"Apply",
"(",
"req",
".",
"log",
")",
"\n",
"metrics",
".",
"MeasureSince",
"(",
"[",
"]",
"string",
"{",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
"}",
",",
"start",
")",
"\n",
"}",
"\n\n",
"// Update the indexes",
"lastIndex",
"=",
"req",
".",
"<mask>",
".",
"Index",
"\n",
"lastTerm",
"=",
"req",
".",
"log",
".",
"Term",
"\n\n",
"// Invoke the future if given",
"if",
"req",
".",
"future",
"!=",
"nil",
"{",
"req",
".",
"future",
".",
"response",
"=",
"resp",
"\n",
"req",
".",
"future",
".",
"respond",
"(",
"nil",
")",
"\n",
"}",
"\n",
"}",
"\n\n",
"restore",
":=",
"func",
"(",
"req",
"*",
"restoreFuture",
")",
"{",
"// Open the snapshot",
"meta",
",",
"source",
",",
"err",
":=",
"r",
".",
"snapshots",
".",
"Open",
"(",
"req",
".",
"ID",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"req",
".",
"respond",
"(",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"req",
".",
"ID",
",",
"err",
")",
")",
"\n",
"return",
"\n",
"}",
"\n\n",
"// Attempt to restore",
"start",
":=",
"time",
".",
"Now",
"(",
")",
"\n",
"if",
"err",
":=",
"r",
".",
"fsm",
".",
"Restore",
"(",
"source",
")",
";",
"err",
"!=",
"nil",
"{",
"req",
".",
"respond",
"(",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"req",
".",
"ID",
",",
"err",
")",
")",
"\n",
"source",
".",
"Close",
"(",
")",
"\n",
"return",
"\n",
"}",
"\n",
"source",
".",
"Close",
"(",
")",
"\n",
"metrics",
".",
"MeasureSince",
"(",
"[",
"]",
"string",
"{",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
"}",
",",
"start",
")",
"\n\n",
"// Update the last index and term",
"lastIndex",
"=",
"meta",
".",
"Index",
"\n",
"lastTerm",
"=",
"meta",
".",
"Term",
"\n",
"req",
".",
"respond",
"(",
"nil",
")",
"\n",
"}",
"\n\n",
"snapshot",
":=",
"func",
"(",
"req",
"*",
"reqSnapshotFuture",
")",
"{",
"// Is there something to snapshot?",
"if",
"lastIndex",
"==",
"0",
"{",
"req",
".",
"respond",
"(",
"ErrNothingNewToSnapshot",
")",
"\n",
"return",
"\n",
"}",
"\n\n",
"// Start a snapshot",
"start",
":=",
"time",
".",
"Now",
"(",
")",
"\n",
"snap",
",",
"err",
":=",
"r",
".",
"fsm",
".",
"Snapshot",
"(",
")",
"\n",
"metrics",
".",
"MeasureSince",
"(",
"[",
"]",
"string",
"{",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
"}",
",",
"start",
")",
"\n\n",
"// Respond to the request",
"req",
".",
"index",
"=",
"lastIndex",
"\n",
"req",
".",
"term",
"=",
"lastTerm",
"\n",
"req",
".",
"snapshot",
"=",
"snap",
"\n",
"req",
".",
"respond",
"(",
"err",
")",
"\n",
"}",
"\n\n",
"for",
"{",
"select",
"{",
"case",
"ptr",
":=",
"<-",
"r",
".",
"fsmMutateCh",
":",
"switch",
"req",
":=",
"ptr",
".",
"(",
"type",
")",
"{",
"case",
"*",
"commitTuple",
":",
"commit",
"(",
"req",
")",
"\n\n",
"case",
"*",
"restoreFuture",
":",
"restore",
"(",
"req",
")",
"\n\n",
"default",
":",
"panic",
"(",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"ptr",
")",
")",
"\n",
"}",
"\n\n",
"case",
"req",
":=",
"<-",
"r",
".",
"fsmSnapshotCh",
":",
"snapshot",
"(",
"req",
")",
"\n\n",
"case",
"<-",
"r",
".",
"shutdownCh",
":",
"return",
"\n",
"}",
"\n",
"}",
"\n",
"}"
] |
6,756 | all-6757 | [
"MustOperations",
"retrieves",
"the",
"Operations",
"value",
"from",
"the",
"union",
"panicing",
"if",
"the",
"value",
"is",
"not",
"set",
"."
] | [
"func",
"(",
"u",
"TransactionMeta",
")",
"MustOperations",
"(",
")",
"[",
"]",
"OperationMeta",
"{",
"val",
",",
"<mask>",
":=",
"u",
".",
"GetOperations",
"(",
")",
"\n\n",
"if",
"!",
"ok",
"{",
"panic",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"return",
"val",
"\n",
"}"
] |
6,757 | all-6758 | [
"NewCatalog",
"will",
"create",
"a",
"new",
"catalog",
"."
] | [
"func",
"NewCatalog",
"(",
"models",
"...",
"Model",
")",
"*",
"Catalog",
"{",
"// create catalog",
"c",
":=",
"&",
"Catalog",
"{",
"models",
":",
"<mask>",
"(",
"map",
"[",
"string",
"]",
"Model",
")",
",",
"}",
"\n\n",
"// add models",
"c",
".",
"Add",
"(",
"models",
"...",
")",
"\n\n",
"return",
"c",
"\n",
"}"
] |
6,758 | all-6759 | [
"Insert",
"a",
"row",
"in",
"one",
"of",
"the",
"nodes",
"association",
"tables",
"(",
"storage_pools_nodes",
"networks_nodes",
"images_nodes",
")",
"."
] | [
"func",
"importNodeAssociation",
"(",
"entity",
"string",
",",
"columns",
"[",
"]",
"string",
",",
"row",
"[",
"]",
"interface",
"{",
"}",
",",
"tx",
"*",
"sql",
".",
"Tx",
")",
"error",
"{",
"stmt",
":=",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"entity",
",",
"entity",
")",
"\n",
"var",
"id",
"int64",
"\n",
"for",
"i",
",",
"column",
":=",
"range",
"columns",
"{",
"if",
"column",
"==",
"\"",
"\"",
"{",
"id",
"=",
"row",
"[",
"i",
"]",
".",
"(",
"int64",
")",
"\n",
"break",
"\n",
"}",
"\n",
"}",
"\n",
"if",
"id",
"==",
"0",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"<mask>",
")",
"\n",
"}",
"\n",
"_",
",",
"err",
":=",
"tx",
".",
"Exec",
"(",
"stmt",
",",
"id",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"errors",
".",
"Wrapf",
"(",
"err",
",",
"\"",
"\"",
",",
"entity",
")",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
] |
6,759 | all-6760 | [
"Returns",
"a",
"random",
"base64",
"encoded",
"string",
"from",
"crypto",
"/",
"rand",
"."
] | [
"func",
"RandomCryptoString",
"(",
")",
"(",
"string",
",",
"error",
")",
"{",
"buf",
":=",
"make",
"(",
"[",
"]",
"byte",
",",
"32",
")",
"\n",
"n",
",",
"err",
":=",
"rand",
".",
"Read",
"(",
"buf",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"\"",
"\"",
",",
"err",
"\n",
"}",
"\n\n",
"if",
"n",
"!=",
"len",
"(",
"buf",
")",
"{",
"return",
"\"",
"\"",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"return",
"<mask>",
".",
"EncodeToString",
"(",
"buf",
")",
",",
"nil",
"\n",
"}"
] |
6,760 | all-6761 | [
"Helpers",
"--------------------------------------------------------------------",
"gorillaPattern",
"transforms",
"a",
"gorilla",
"pattern",
"into",
"a",
"regexp",
"pattern",
"."
] | [
"func",
"gorillaPattern",
"(",
"tpl",
"string",
",",
"matchHost",
",",
"prefixMatch",
",",
"strictSlash",
"bool",
")",
"(",
"string",
",",
"error",
")",
"{",
"// Check if it is well-formed.",
"idxs",
",",
"err",
":=",
"braceIndices",
"(",
"tpl",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"\"",
"\"",
",",
"err",
"\n",
"}",
"\n",
"// Now let's parse it.",
"defaultPattern",
":=",
"\"",
"\"",
"\n",
"if",
"matchHost",
"{",
"defaultPattern",
"=",
"\"",
"\"",
"\n",
"prefixMatch",
",",
"strictSlash",
"=",
"false",
",",
"false",
"\n",
"}",
"else",
"{",
"if",
"prefixMatch",
"{",
"strictSlash",
"=",
"false",
"\n",
"}",
"\n",
"if",
"strictSlash",
"&&",
"strings",
".",
"HasSuffix",
"(",
"tpl",
",",
"\"",
"\"",
")",
"{",
"tpl",
"=",
"tpl",
"[",
":",
"len",
"(",
"tpl",
")",
"-",
"1",
"]",
"\n",
"}",
"\n",
"}",
"\n",
"pattern",
":=",
"bytes",
".",
"NewBufferString",
"(",
"\"",
"\"",
")",
"\n",
"var",
"end",
"int",
"\n",
"for",
"i",
":=",
"0",
";",
"i",
"<",
"len",
"(",
"idxs",
")",
";",
"i",
"+=",
"2",
"{",
"// Set all values we are interested in.",
"<mask>",
":=",
"tpl",
"[",
"end",
":",
"idxs",
"[",
"i",
"]",
"]",
"\n",
"end",
"=",
"idxs",
"[",
"i",
"+",
"1",
"]",
"\n",
"parts",
":=",
"strings",
".",
"SplitN",
"(",
"tpl",
"[",
"idxs",
"[",
"i",
"]",
"+",
"1",
":",
"end",
"-",
"1",
"]",
",",
"\"",
"\"",
",",
"2",
")",
"\n",
"name",
":=",
"parts",
"[",
"0",
"]",
"\n",
"patt",
":=",
"defaultPattern",
"\n",
"if",
"len",
"(",
"parts",
")",
"==",
"2",
"{",
"patt",
"=",
"parts",
"[",
"1",
"]",
"\n",
"}",
"\n",
"// Name or pattern can't be empty.",
"if",
"name",
"==",
"\"",
"\"",
"||",
"patt",
"==",
"\"",
"\"",
"{",
"return",
"\"",
"\"",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"tpl",
"[",
"idxs",
"[",
"i",
"]",
":",
"end",
"]",
")",
"\n",
"}",
"\n",
"// Build the regexp pattern.",
"fmt",
".",
"Fprintf",
"(",
"pattern",
",",
"\"",
"\"",
",",
"regexp",
".",
"QuoteMeta",
"(",
"raw",
")",
",",
"name",
",",
"patt",
")",
"\n",
"}",
"\n",
"// Add the remaining.",
"raw",
":=",
"tpl",
"[",
"end",
":",
"]",
"\n",
"pattern",
".",
"WriteString",
"(",
"regexp",
".",
"QuoteMeta",
"(",
"raw",
")",
")",
"\n",
"if",
"strictSlash",
"{",
"pattern",
".",
"WriteString",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"if",
"!",
"prefixMatch",
"{",
"pattern",
".",
"WriteByte",
"(",
"'$'",
")",
"\n",
"}",
"\n",
"return",
"pattern",
".",
"String",
"(",
")",
",",
"nil",
"\n",
"}"
] |
6,761 | all-6762 | [
"Demangle",
"a",
"string",
"just",
"as",
"the",
"GNU",
"c",
"++",
"filt",
"program",
"does",
"."
] | [
"func",
"doDemangle",
"(",
"out",
"*",
"bufio",
".",
"Writer",
",",
"name",
"string",
")",
"{",
"skip",
":=",
"0",
"\n",
"if",
"name",
"[",
"0",
"]",
"==",
"'.'",
"||",
"name",
"[",
"0",
"]",
"==",
"'$'",
"{",
"skip",
"++",
"\n",
"}",
"\n",
"if",
"*",
"stripUnderscore",
"&&",
"name",
"[",
"skip",
"]",
"==",
"'_'",
"{",
"skip",
"++",
"\n",
"}",
"\n",
"result",
":=",
"demangle",
".",
"Filter",
"(",
"name",
"[",
"skip",
":",
"]",
",",
"options",
"(",
")",
"...",
")",
"\n",
"if",
"result",
"==",
"name",
"[",
"skip",
":",
"]",
"{",
"<mask>",
".",
"WriteString",
"(",
"name",
")",
"\n",
"}",
"else",
"{",
"if",
"name",
"[",
"0",
"]",
"==",
"'.'",
"{",
"out",
".",
"WriteByte",
"(",
"'.'",
")",
"\n",
"}",
"\n",
"out",
".",
"WriteString",
"(",
"result",
")",
"\n",
"}",
"\n",
"}"
] |
6,762 | all-6763 | [
"ParseImageName",
"parses",
"a",
"docker",
"image",
"into",
"an",
"ImageName",
"struct",
"."
] | [
"func",
"ParseImageName",
"(",
"image",
"string",
")",
"(",
"ImageName",
",",
"error",
")",
"{",
"ret",
":=",
"ImageName",
"{",
"}",
"\n\n",
"img",
",",
"err",
":=",
"registry",
".",
"ParseImage",
"(",
"image",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"ret",
",",
"err",
"\n",
"}",
"\n\n",
"ret",
".",
"Registry",
"=",
"img",
".",
"Domain",
"\n",
"ret",
".",
"<mask>",
"=",
"img",
".",
"Path",
"\n",
"ret",
".",
"Digest",
"=",
"img",
".",
"Digest",
".",
"String",
"(",
")",
"\n",
"ret",
".",
"Tag",
"=",
"img",
".",
"Tag",
"\n\n",
"return",
"ret",
",",
"nil",
"\n",
"}"
] |
6,763 | all-6764 | [
"record",
"the",
"GL",
"time",
"into",
"a",
"query",
"object",
"after",
"all",
"previous",
"commands",
"have",
"reached",
"the",
"GL",
"server",
"but",
"have",
"not",
"yet",
"necessarily",
"executed",
"."
] | [
"func",
"QueryCounter",
"(",
"<mask>",
"uint32",
",",
"target",
"uint32",
")",
"{",
"C",
".",
"glowQueryCounter",
"(",
"gpQueryCounter",
",",
"(",
"C",
".",
"GLuint",
")",
"(",
"id",
")",
",",
"(",
"C",
".",
"GLenum",
")",
"(",
"target",
")",
")",
"\n",
"}"
] |
6,764 | all-6765 | [
"UnmarshalJSON",
"supports",
"json",
".",
"Unmarshaler",
"interface"
] | [
"func",
"(",
"v",
"*",
"CallFrame",
")",
"UnmarshalJSON",
"(",
"data",
"[",
"]",
"<mask>",
")",
"error",
"{",
"r",
":=",
"jlexer",
".",
"Lexer",
"{",
"Data",
":",
"data",
"}",
"\n",
"easyjsonC5a4559bDecodeGithubComChromedpCdprotoDebugger48",
"(",
"&",
"r",
",",
"v",
")",
"\n",
"return",
"r",
".",
"Error",
"(",
")",
"\n",
"}"
] |
6,765 | all-6766 | [
"Leader",
"returns",
"the",
"leader",
"value",
"for",
"the",
"current",
"election",
"."
] | [
"func",
"(",
"e",
"*",
"Election",
")",
"Leader",
"(",
"ctx",
"context",
".",
"Context",
")",
"(",
"*",
"v3",
".",
"GetResponse",
",",
"error",
")",
"{",
"client",
":=",
"e",
".",
"session",
".",
"Client",
"(",
")",
"\n",
"resp",
",",
"err",
":=",
"<mask>",
".",
"Get",
"(",
"ctx",
",",
"e",
".",
"keyPrefix",
",",
"v3",
".",
"WithFirstCreate",
"(",
")",
"...",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"else",
"if",
"len",
"(",
"resp",
".",
"Kvs",
")",
"==",
"0",
"{",
"// no leader currently elected",
"return",
"nil",
",",
"ErrElectionNoLeader",
"\n",
"}",
"\n",
"return",
"resp",
",",
"nil",
"\n",
"}"
] |
6,766 | all-6767 | [
"uploads",
"a",
"part",
"checking",
"the",
"etag",
"against",
"the",
"calculated",
"value"
] | [
"func",
"(",
"p",
"*",
"putter",
")",
"putPart",
"(",
"part",
"*",
"part",
")",
"error",
"{",
"v",
":=",
"url",
".",
"Values",
"{",
"}",
"\n",
"v",
".",
"Set",
"(",
"\"",
"\"",
",",
"strconv",
".",
"Itoa",
"(",
"part",
".",
"PartNumber",
")",
")",
"\n",
"v",
".",
"Set",
"(",
"\"",
"\"",
",",
"p",
".",
"UploadID",
")",
"\n",
"if",
"_",
",",
"err",
":=",
"part",
".",
"r",
".",
"Seek",
"(",
"0",
",",
"0",
")",
";",
"err",
"!=",
"nil",
"{",
"// move back to beginning, if retrying",
"return",
"err",
"\n",
"}",
"\n",
"req",
",",
"err",
":=",
"http",
".",
"NewRequest",
"(",
"\"",
"\"",
",",
"p",
".",
"url",
".",
"String",
"(",
")",
"+",
"\"",
"\"",
"+",
"v",
".",
"Encode",
"(",
")",
",",
"part",
".",
"r",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"req",
".",
"ContentLength",
"=",
"part",
".",
"len",
"\n",
"req",
".",
"Header",
".",
"Set",
"(",
"md5Header",
",",
"part",
".",
"md5",
")",
"\n",
"req",
".",
"Header",
".",
"Set",
"(",
"sha256Header",
",",
"part",
".",
"sha256",
")",
"\n",
"p",
".",
"b",
".",
"Sign",
"(",
"req",
")",
"\n",
"resp",
",",
"err",
":=",
"p",
".",
"c",
".",
"<mask>",
".",
"Do",
"(",
"req",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"defer",
"checkClose",
"(",
"resp",
".",
"Body",
",",
"err",
")",
"\n",
"if",
"resp",
".",
"StatusCode",
"!=",
"200",
"{",
"return",
"newRespError",
"(",
"resp",
")",
"\n",
"}",
"\n",
"s",
":=",
"resp",
".",
"Header",
".",
"Get",
"(",
"\"",
"\"",
")",
"\n",
"if",
"len",
"(",
"s",
")",
"<",
"2",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"s",
")",
"\n",
"}",
"\n",
"s",
"=",
"s",
"[",
"1",
":",
"len",
"(",
"s",
")",
"-",
"1",
"]",
"// includes quote chars for some reason",
"\n",
"if",
"part",
".",
"ETag",
"!=",
"s",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"s",
",",
"p",
".",
"ETag",
")",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
] |
6,767 | all-6768 | [
"Call",
"invokes",
"the",
"appropriate",
"HTTP",
"method",
"on",
"a",
"given",
"Firebase",
"URL",
"."
] | [
"func",
"(",
"f",
"*",
"f",
")",
"Call",
"(",
"method",
",",
"<mask>",
",",
"auth",
"string",
",",
"body",
"[",
"]",
"byte",
",",
"params",
"map",
"[",
"string",
"]",
"string",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"if",
"!",
"strings",
".",
"HasSuffix",
"(",
"path",
",",
"\"",
"\"",
")",
"{",
"path",
"+=",
"\"",
"\"",
"\n",
"}",
"\n\n",
"path",
"+=",
"suffix",
"\n",
"qs",
":=",
"url",
".",
"Values",
"{",
"}",
"\n\n",
"// if the client has an auth, set it as a query string.",
"// the caller can also override this on a per-call basis",
"// which will happen via params below",
"if",
"len",
"(",
"auth",
")",
">",
"0",
"{",
"qs",
".",
"Set",
"(",
"\"",
"\"",
",",
"auth",
")",
"\n",
"}",
"\n\n",
"for",
"k",
",",
"v",
":=",
"range",
"params",
"{",
"qs",
".",
"Set",
"(",
"k",
",",
"v",
")",
"\n",
"}",
"\n\n",
"if",
"len",
"(",
"qs",
")",
">",
"0",
"{",
"path",
"+=",
"\"",
"\"",
"+",
"qs",
".",
"Encode",
"(",
")",
"\n",
"}",
"\n\n",
"req",
",",
"err",
":=",
"http",
".",
"NewRequest",
"(",
"method",
",",
"path",
",",
"bytes",
".",
"NewReader",
"(",
"body",
")",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"log",
".",
"Printf",
"(",
"\"",
"\\n",
"\"",
",",
"err",
")",
"\n",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"req",
".",
"Close",
"=",
"true",
"\n",
"log",
".",
"Printf",
"(",
"\"",
"\\n",
"\"",
",",
"method",
",",
"path",
")",
"\n\n",
"res",
",",
"err",
":=",
"httpClient",
".",
"Do",
"(",
"req",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"log",
".",
"Printf",
"(",
"\"",
"\\n",
"\"",
",",
"err",
")",
"\n",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"defer",
"res",
".",
"Body",
".",
"Close",
"(",
")",
"\n\n",
"ret",
",",
"err",
":=",
"ioutil",
".",
"ReadAll",
"(",
"res",
".",
"Body",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"log",
".",
"Printf",
"(",
"\"",
"\\n",
"\"",
",",
"err",
")",
"\n",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"if",
"res",
".",
"StatusCode",
">=",
"400",
"{",
"err",
"=",
"errors",
".",
"New",
"(",
"string",
"(",
"ret",
")",
")",
"\n",
"log",
".",
"Printf",
"(",
"\"",
"\\n",
"\"",
",",
"err",
")",
"\n",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"return",
"ret",
",",
"nil",
"\n",
"}"
] |
6,768 | all-6769 | [
"getSCSIController",
"picks",
"a",
"SCSI",
"controller",
"at",
"the",
"specific",
"bus",
"number",
"supplied",
"."
] | [
"func",
"pickSCSIController",
"(",
"l",
"object",
".",
"VirtualDeviceList",
",",
"bus",
"int",
")",
"(",
"types",
".",
"BaseVirtualController",
",",
"error",
")",
"{",
"<mask>",
".",
"Printf",
"(",
"\"",
"\"",
",",
"bus",
")",
"\n",
"l",
"=",
"l",
".",
"Select",
"(",
"func",
"(",
"device",
"types",
".",
"BaseVirtualDevice",
")",
"bool",
"{",
"switch",
"d",
":=",
"device",
".",
"(",
"type",
")",
"{",
"case",
"types",
".",
"BaseVirtualSCSIController",
":",
"return",
"d",
".",
"GetVirtualSCSIController",
"(",
")",
".",
"BusNumber",
"==",
"int32",
"(",
"bus",
")",
"\n",
"}",
"\n",
"return",
"false",
"\n",
"}",
")",
"\n\n",
"if",
"len",
"(",
"l",
")",
"==",
"0",
"{",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"bus",
")",
"\n",
"}",
"\n\n",
"log",
".",
"Printf",
"(",
"\"",
"\"",
",",
"l",
".",
"Name",
"(",
"l",
"[",
"0",
"]",
")",
")",
"\n",
"return",
"l",
"[",
"0",
"]",
".",
"(",
"types",
".",
"BaseVirtualController",
")",
",",
"nil",
"\n",
"}"
] |
6,769 | all-6770 | [
"Push",
"pushes",
"over",
"https",
"to",
"the",
"provided",
"owner",
"/",
"repo#branch",
"using",
"a",
"password",
"for",
"basic",
"auth",
"."
] | [
"func",
"(",
"r",
"*",
"Repo",
")",
"Push",
"(",
"repo",
",",
"branch",
"string",
")",
"error",
"{",
"if",
"r",
".",
"user",
"==",
"\"",
"\"",
"||",
"r",
".",
"pass",
"==",
"\"",
"\"",
"{",
"return",
"errors",
".",
"New",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"r",
".",
"logger",
".",
"Infof",
"(",
"\"",
"\"",
",",
"r",
".",
"user",
",",
"repo",
",",
"branch",
")",
"\n",
"<mask>",
":=",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"r",
".",
"user",
",",
"r",
".",
"pass",
",",
"github",
",",
"r",
".",
"user",
",",
"repo",
")",
"\n",
"co",
":=",
"r",
".",
"gitCommand",
"(",
"\"",
"\"",
",",
"remote",
",",
"branch",
")",
"\n",
"_",
",",
"err",
":=",
"co",
".",
"CombinedOutput",
"(",
")",
"\n",
"return",
"err",
"\n",
"}"
] |
6,770 | all-6771 | [
"Instruction",
".",
"String",
"()"
] | [
"func",
"(",
"v",
"*",
"Alloc",
")",
"String",
"(",
")",
"string",
"{",
"op",
":=",
"\"",
"\"",
"\n",
"if",
"v",
".",
"Heap",
"{",
"op",
"=",
"\"",
"\"",
"\n",
"}",
"\n",
"from",
":=",
"v",
".",
"Parent",
"(",
")",
".",
"pkg",
"(",
")",
"\n",
"return",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"op",
",",
"relType",
"(",
"deref",
"(",
"v",
".",
"<mask>",
"(",
")",
")",
",",
"from",
")",
",",
"v",
".",
"Comment",
")",
"\n",
"}"
] |
6,771 | all-6772 | [
"Delete",
"implements",
"storage",
"interface",
"."
] | [
"func",
"(",
"s",
"*",
"Storage",
")",
"Delete",
"(",
"ctx",
"context",
".",
"Context",
",",
"subjectID",
",",
"accessToken",
",",
"refreshToken",
"string",
",",
"expiredAtFrom",
",",
"expiredAtTo",
"*",
"time",
".",
"Time",
")",
"(",
"int64",
",",
"error",
")",
"{",
"span",
",",
"ctx",
":=",
"opentracing",
".",
"StartSpanFromContext",
"(",
"ctx",
",",
"\"",
"\"",
")",
"\n",
"defer",
"span",
".",
"Finish",
"(",
")",
"\n\n",
"where",
",",
"args",
":=",
"s",
".",
"where",
"(",
"subjectID",
",",
"accessToken",
",",
"refreshToken",
",",
"expiredAtFrom",
",",
"expiredAtTo",
")",
"\n",
"if",
"where",
".",
"Len",
"(",
")",
"==",
"0",
"{",
"return",
"0",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"where",
".",
"<mask>",
"(",
")",
")",
"\n",
"}",
"\n",
"query",
":=",
"\"",
"\"",
"+",
"s",
".",
"schema",
"+",
"\"",
"\"",
"+",
"s",
".",
"table",
"+",
"\"",
"\"",
"+",
"where",
".",
"String",
"(",
")",
"\n",
"labels",
":=",
"prometheus",
".",
"Labels",
"{",
"\"",
"\"",
":",
"\"",
"\"",
"}",
"\n",
"start",
":=",
"time",
".",
"Now",
"(",
")",
"\n\n",
"result",
",",
"err",
":=",
"s",
".",
"db",
".",
"Exec",
"(",
"query",
",",
"args",
"...",
")",
"\n",
"s",
".",
"incQueries",
"(",
"labels",
",",
"start",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"s",
".",
"incError",
"(",
"labels",
")",
"\n",
"return",
"0",
",",
"err",
"\n",
"}",
"\n\n",
"return",
"result",
".",
"RowsAffected",
"(",
")",
"\n",
"}"
] |
6,772 | all-6773 | [
"DefaultConfig",
"returns",
"the",
"default",
"configuration",
"struct",
".",
"Certain",
"environment",
"variables",
"may",
"be",
"set",
"which",
"control",
"the",
"values",
"for",
"the",
"default",
"configuration",
"."
] | [
"func",
"DefaultConfig",
"(",
")",
"*",
"Config",
"{",
"<mask>",
"&",
"Config",
"{",
"Consul",
":",
"DefaultConsulConfig",
"(",
")",
",",
"Dedup",
":",
"DefaultDedupConfig",
"(",
")",
",",
"Exec",
":",
"DefaultExecConfig",
"(",
")",
",",
"Syslog",
":",
"DefaultSyslogConfig",
"(",
")",
",",
"Templates",
":",
"DefaultTemplateConfigs",
"(",
")",
",",
"Vault",
":",
"DefaultVaultConfig",
"(",
")",
",",
"Wait",
":",
"DefaultWaitConfig",
"(",
")",
",",
"}",
"\n",
"}"
] |
6,773 | all-6774 | [
"Activate",
"is",
"a",
"wrapper",
"around",
"g_action_group_activate_action"
] | [
"func",
"(",
"v",
"*",
"ActionGroup",
")",
"Activate",
"(",
"actionName",
"<mask>",
",",
"parameter",
"*",
"Variant",
")",
"{",
"C",
".",
"g_action_group_activate_action",
"(",
"v",
".",
"native",
"(",
")",
",",
"(",
"*",
"C",
".",
"gchar",
")",
"(",
"C",
".",
"CString",
"(",
"actionName",
")",
")",
",",
"parameter",
".",
"native",
"(",
")",
")",
"\n",
"}"
] |
6,774 | all-6775 | [
"export",
"FileSequence_Format"
] | [
"func",
"FileSequence_Format",
"(",
"id",
"FileSeqId",
",",
"tpl",
"*",
"C",
".",
"char",
")",
"(",
"*",
"C",
".",
"char",
",",
"Error",
")",
"{",
"fs",
",",
"ok",
":=",
"sFileSeqs",
".",
"Get",
"(",
"id",
")",
"\n",
"if",
"!",
"<mask>",
"{",
"return",
"C",
".",
"CString",
"(",
"\"",
"\"",
")",
",",
"nil",
"\n",
"}",
"\n\n",
"str",
",",
"err",
":=",
"fs",
".",
"Format",
"(",
"C",
".",
"GoString",
"(",
"tpl",
")",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"C",
".",
"CString",
"(",
"err",
".",
"Error",
"(",
")",
")",
"\n",
"}",
"\n\n",
"// caller must free the string",
"return",
"C",
".",
"CString",
"(",
"str",
")",
",",
"nil",
"\n",
"}"
] |
6,775 | all-6776 | [
"Invariant",
":",
"Each",
"snapshot",
"n",
"is",
"dependent",
"on",
"snapshot",
"n",
"-",
"1",
".",
"Unless",
"snapshot",
"n",
"-",
"1",
"is",
"collected",
"snapshot",
"n",
"cannot",
"be",
"collected",
"."
] | [
"func",
"(",
"m",
"*",
"Nitro",
")",
"collectDead",
"(",
")",
"{",
"buf1",
":=",
"m",
".",
"snapshots",
".",
"MakeBuf",
"(",
")",
"\n",
"buf2",
":=",
"m",
".",
"snapshots",
".",
"MakeBuf",
"(",
")",
"\n",
"defer",
"m",
".",
"snapshots",
".",
"FreeBuf",
"(",
"buf1",
")",
"\n",
"defer",
"m",
".",
"snapshots",
".",
"FreeBuf",
"(",
"buf2",
")",
"\n\n",
"iter",
":=",
"m",
".",
"gcsnapshots",
".",
"NewIterator",
"(",
"CompareSnapshot",
",",
"buf1",
")",
"\n",
"defer",
"iter",
".",
"Close",
"(",
")",
"\n\n",
"for",
"iter",
".",
"SeekFirst",
"(",
")",
";",
"iter",
".",
"Valid",
"(",
")",
";",
"iter",
".",
"Next",
"(",
")",
"{",
"<mask>",
":=",
"iter",
".",
"GetNode",
"(",
")",
"\n",
"sn",
":=",
"(",
"*",
"Snapshot",
")",
"(",
"node",
".",
"Item",
"(",
")",
")",
"\n",
"if",
"sn",
".",
"sn",
"!=",
"m",
".",
"lastGCSn",
"+",
"1",
"{",
"return",
"\n",
"}",
"\n\n",
"m",
".",
"lastGCSn",
"=",
"sn",
".",
"sn",
"\n",
"m",
".",
"gcchan",
"<-",
"sn",
".",
"gclist",
"\n",
"m",
".",
"gcsnapshots",
".",
"DeleteNode",
"(",
"node",
",",
"CompareSnapshot",
",",
"buf2",
",",
"&",
"m",
".",
"gcsnapshots",
".",
"Stats",
")",
"\n",
"}",
"\n",
"}"
] |
6,776 | all-6777 | [
"Returns",
"information",
"about",
"several",
"active",
"uniform",
"variables",
"for",
"the",
"specified",
"program",
"object"
] | [
"func",
"GetActiveUniformsiv",
"(",
"<mask>",
"uint32",
",",
"uniformCount",
"int32",
",",
"uniformIndices",
"*",
"uint32",
",",
"pname",
"uint32",
",",
"params",
"*",
"int32",
")",
"{",
"syscall",
".",
"Syscall6",
"(",
"gpGetActiveUniformsiv",
",",
"5",
",",
"uintptr",
"(",
"program",
")",
",",
"uintptr",
"(",
"uniformCount",
")",
",",
"uintptr",
"(",
"unsafe",
".",
"Pointer",
"(",
"uniformIndices",
")",
")",
",",
"uintptr",
"(",
"pname",
")",
",",
"uintptr",
"(",
"unsafe",
".",
"Pointer",
"(",
"params",
")",
")",
",",
"0",
")",
"\n",
"}"
] |
6,777 | all-6778 | [
"UnmarshalJSON",
"supports",
"json",
".",
"Unmarshaler",
"interface"
] | [
"func",
"(",
"v",
"*",
"GetUsageAndQuotaParams",
")",
"UnmarshalJSON",
"(",
"data",
"[",
"]",
"byte",
")",
"error",
"{",
"r",
":=",
"jlexer",
".",
"Lexer",
"{",
"Data",
":",
"data",
"}",
"\n",
"easyjsonC5a4559bDecodeGithubComChromedpCdprotoStorage6",
"(",
"&",
"r",
",",
"v",
")",
"\n",
"return",
"r",
".",
"<mask>",
"(",
")",
"\n",
"}"
] |
6,778 | all-6779 | [
"Do",
"executes",
"CSS",
".",
"setStyleSheetText",
"against",
"the",
"provided",
"context",
".",
"returns",
":",
"sourceMapURL",
"-",
"URL",
"of",
"source",
"map",
"associated",
"with",
"script",
"(",
"if",
"any",
")",
"."
] | [
"func",
"(",
"p",
"*",
"SetStyleSheetTextParams",
")",
"Do",
"(",
"ctx",
"context",
".",
"Context",
")",
"(",
"sourceMapURL",
"string",
",",
"err",
"error",
")",
"{",
"// execute",
"<mask>",
"res",
"SetStyleSheetTextReturns",
"\n",
"err",
"=",
"cdp",
".",
"Execute",
"(",
"ctx",
",",
"CommandSetStyleSheetText",
",",
"p",
",",
"&",
"res",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"\"",
"\"",
",",
"err",
"\n",
"}",
"\n\n",
"return",
"res",
".",
"SourceMapURL",
",",
"nil",
"\n",
"}"
] |
6,779 | all-6780 | [
"findLast",
"returns",
"the",
"last",
"element",
".",
"If",
"head",
"(",
"empty",
"list",
")",
"we",
"return",
"nil",
".",
"All",
"the",
"find",
"functions",
"will",
"NEVER",
"return",
"the",
"head",
"nodes",
"."
] | [
"func",
"(",
"s",
"*",
"Skiplist",
")",
"findLast",
"(",
")",
"*",
"node",
"{",
"n",
":=",
"s",
".",
"head",
"\n",
"level",
":=",
"int",
"(",
"s",
".",
"getHeight",
"(",
")",
")",
"-",
"1",
"\n",
"for",
"{",
"next",
":=",
"s",
".",
"getNext",
"(",
"n",
",",
"level",
")",
"\n",
"if",
"next",
"!=",
"nil",
"{",
"n",
"=",
"next",
"\n",
"<mask>",
"\n",
"}",
"\n",
"if",
"level",
"==",
"0",
"{",
"if",
"n",
"==",
"s",
".",
"head",
"{",
"return",
"nil",
"\n",
"}",
"\n",
"return",
"n",
"\n",
"}",
"\n",
"level",
"--",
"\n",
"}",
"\n",
"}"
] |
6,780 | all-6781 | [
"CreateIndex",
"creates",
"the",
"index",
"into",
"database",
".",
"If",
"table",
"isn",
"t",
"direct",
"/",
"indirect",
"struct",
"it",
"returns",
"error",
"."
] | [
"func",
"(",
"<mask>",
"*",
"DB",
")",
"CreateIndex",
"(",
"table",
"interface",
"{",
"}",
",",
"name",
"string",
",",
"names",
"...",
"string",
")",
"error",
"{",
"return",
"db",
".",
"createIndex",
"(",
"table",
",",
"false",
",",
"name",
",",
"names",
"...",
")",
"\n",
"}"
] |
6,781 | all-6782 | [
"BCCAddrs",
"returns",
"a",
"copy",
"of",
"MailBuilder",
"with",
"the",
"specified",
"as",
"the",
"blind",
"CC",
"list",
".",
"This",
"method",
"only",
"has",
"an",
"effect",
"if",
"the",
"Send",
"method",
"is",
"used",
"to",
"transmit",
"the",
"message",
"there",
"is",
"no",
"effect",
"on",
"the",
"parts",
"returned",
"by",
"Build",
"()",
"."
] | [
"func",
"(",
"p",
"MailBuilder",
")",
"BCCAddrs",
"(",
"bcc",
"[",
"]",
"mail",
".",
"<mask>",
")",
"MailBuilder",
"{",
"p",
".",
"bcc",
"=",
"bcc",
"\n",
"return",
"p",
"\n",
"}"
] |
6,782 | all-6783 | [
"/",
"*",
"SetFetchSize",
"sets",
"the",
"fetchSize",
"of",
"the",
"connector",
"."
] | [
"func",
"(",
"c",
"*",
"Connector",
")",
"SetFetchSize",
"(",
"fetchSize",
"int",
")",
"error",
"{",
"c",
".",
"mu",
".",
"Lock",
"(",
")",
"\n",
"defer",
"c",
".",
"mu",
".",
"Unlock",
"(",
")",
"\n",
"if",
"fetchSize",
"<",
"minFetchSize",
"{",
"fetchSize",
"=",
"minFetchSize",
"\n",
"}",
"\n",
"c",
".",
"fetchSize",
"=",
"fetchSize",
"\n",
"<mask>",
"nil",
"\n",
"}"
] |
6,783 | all-6784 | [
"Create",
"a",
"new",
"Account",
"with",
"the",
"specified",
"values",
".",
"https",
":",
"//",
"www",
".",
"twilio",
".",
"com",
"/",
"docs",
"/",
"api",
"/",
"rest",
"/",
"subaccounts#creating",
"-",
"subaccounts"
] | [
"func",
"(",
"a",
"*",
"AccountService",
")",
"Create",
"(",
"ctx",
"context",
".",
"Context",
",",
"data",
"url",
".",
"Values",
")",
"(",
"*",
"Account",
",",
"error",
")",
"{",
"acct",
":=",
"new",
"(",
"Account",
")",
"\n",
"err",
":=",
"a",
".",
"<mask>",
".",
"CreateResource",
"(",
"ctx",
",",
"accountPathPart",
"+",
"\"",
"\"",
",",
"data",
",",
"acct",
")",
"\n",
"return",
"acct",
",",
"err",
"\n",
"}"
] |
6,784 | all-6785 | [
"GetYaxisOk",
"returns",
"a",
"tuple",
"with",
"the",
"Yaxis",
"field",
"if",
"it",
"s",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"and",
"a",
"boolean",
"to",
"check",
"if",
"the",
"value",
"has",
"been",
"set",
"."
] | [
"func",
"(",
"h",
"*",
"HeatmapDefinition",
")",
"GetYaxisOk",
"(",
")",
"(",
"WidgetAxis",
",",
"bool",
")",
"{",
"if",
"h",
"==",
"nil",
"||",
"h",
".",
"Yaxis",
"==",
"nil",
"{",
"return",
"WidgetAxis",
"{",
"}",
",",
"false",
"\n",
"}",
"\n",
"return",
"*",
"h",
".",
"Yaxis",
",",
"<mask>",
"\n",
"}"
] |
6,785 | all-6786 | [
"Error",
"returns",
"the",
"underlying",
"error",
"s",
"message",
"."
] | [
"func",
"(",
"err",
"*",
"Error",
")",
"<mask>",
"(",
")",
"string",
"{",
"msg",
":=",
"err",
".",
"Err",
".",
"Error",
"(",
")",
"\n",
"if",
"err",
".",
"prefix",
"!=",
"\"",
"\"",
"{",
"msg",
"=",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"err",
".",
"prefix",
",",
"msg",
")",
"\n",
"}",
"\n\n",
"return",
"msg",
"\n",
"}"
] |
6,786 | all-6787 | [
"WriteTo",
"writes",
"data",
"to",
"w",
"."
] | [
"func",
"(",
"e",
"*",
"htmlComment",
")",
"WriteTo",
"(",
"w",
"io",
".",
"<mask>",
")",
"(",
"int64",
",",
"error",
")",
"{",
"var",
"bf",
"bytes",
".",
"Buffer",
"\n\n",
"// Write an open tag.",
"bf",
".",
"WriteString",
"(",
"e",
".",
"opts",
".",
"DelimLeft",
")",
"\n",
"bf",
".",
"WriteString",
"(",
"preDefinedFuncNameHTML",
")",
"\n",
"bf",
".",
"WriteString",
"(",
"space",
")",
"\n",
"bf",
".",
"WriteString",
"(",
"doubleQuote",
")",
"\n",
"bf",
".",
"WriteString",
"(",
"lt",
")",
"\n",
"bf",
".",
"WriteString",
"(",
"exclamation",
")",
"\n",
"bf",
".",
"WriteString",
"(",
"doubleQuote",
")",
"\n",
"bf",
".",
"WriteString",
"(",
"e",
".",
"opts",
".",
"DelimRight",
")",
"\n",
"bf",
".",
"WriteString",
"(",
"hyphen",
")",
"\n",
"bf",
".",
"WriteString",
"(",
"hyphen",
")",
"\n\n",
"// Write the HTML comment",
"if",
"len",
"(",
"e",
".",
"ln",
".",
"tokens",
")",
">",
"1",
"{",
"bf",
".",
"WriteString",
"(",
"space",
")",
"\n",
"bf",
".",
"WriteString",
"(",
"strings",
".",
"Join",
"(",
"e",
".",
"ln",
".",
"tokens",
"[",
"1",
":",
"]",
",",
"space",
")",
")",
"\n",
"}",
"\n\n",
"// Write the children's HTML.",
"if",
"len",
"(",
"e",
".",
"children",
")",
">",
"0",
"{",
"bf",
".",
"WriteString",
"(",
"lf",
")",
"\n\n",
"if",
"i",
",",
"err",
":=",
"e",
".",
"writeChildren",
"(",
"&",
"bf",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"i",
",",
"err",
"\n",
"}",
"\n",
"}",
"else",
"{",
"bf",
".",
"WriteString",
"(",
"space",
")",
"\n\n",
"}",
"\n\n",
"// Write a close tag.",
"bf",
".",
"WriteString",
"(",
"hyphen",
")",
"\n",
"bf",
".",
"WriteString",
"(",
"hyphen",
")",
"\n",
"bf",
".",
"WriteString",
"(",
"gt",
")",
"\n\n",
"// Write the buffer.",
"i",
",",
"err",
":=",
"w",
".",
"Write",
"(",
"bf",
".",
"Bytes",
"(",
")",
")",
"\n\n",
"return",
"int64",
"(",
"i",
")",
",",
"err",
"\n",
"}"
] |
6,787 | all-6788 | [
"CvSeq",
"*",
"cvApproxPoly",
"(",
"const",
"void",
"*",
"src_seq",
"int",
"header_size",
"CvMemStorage",
"*",
"storage",
"int",
"method",
"double",
"eps",
"int",
"recursive",
"=",
"0",
")"
] | [
"func",
"ApproxPoly",
"(",
"src",
"*",
"Seq",
",",
"header_size",
"int",
",",
"storage",
"*",
"MemStorage",
",",
"method",
"int",
",",
"eps",
"float64",
",",
"recursive",
"int",
")",
"*",
"Seq",
"{",
"seq",
":=",
"C",
".",
"cvApproxPoly",
"(",
"unsafe",
".",
"Pointer",
"(",
"src",
")",
",",
"C",
".",
"int",
"(",
"header_size",
")",
",",
"(",
"*",
"C",
".",
"CvMemStorage",
")",
"(",
"storage",
")",
",",
"C",
".",
"int",
"(",
"<mask>",
")",
",",
"C",
".",
"double",
"(",
"eps",
")",
",",
"C",
".",
"int",
"(",
"recursive",
")",
")",
"\n",
"return",
"(",
"*",
"Seq",
")",
"(",
"seq",
")",
"\n",
"}"
] |
6,788 | all-6789 | [
"UnmarshalJSON",
"supports",
"json",
".",
"Unmarshaler",
"interface"
] | [
"func",
"(",
"v",
"*",
"Media",
")",
"UnmarshalJSON",
"(",
"data",
"[",
"]",
"<mask>",
")",
"error",
"{",
"r",
":=",
"jlexer",
".",
"Lexer",
"{",
"Data",
":",
"data",
"}",
"\n",
"easyjsonC5a4559bDecodeGithubComChromedpCdprotoCss31",
"(",
"&",
"r",
",",
"v",
")",
"\n",
"return",
"r",
".",
"Error",
"(",
")",
"\n",
"}"
] |
6,789 | all-6790 | [
"HaveAttribute",
"passes",
"when",
"the",
"expected",
"attribute",
"and",
"value",
"are",
"present",
"on",
"the",
"element",
".",
"This",
"matcher",
"will",
"fail",
"if",
"the",
"provided",
"selection",
"refers",
"to",
"more",
"than",
"one",
"element",
"."
] | [
"func",
"HaveAttribute",
"(",
"attribute",
"string",
",",
"value",
"string",
")",
"types",
".",
"GomegaMatcher",
"{",
"return",
"&",
"<mask>",
".",
"HaveAttributeMatcher",
"{",
"ExpectedAttribute",
":",
"attribute",
",",
"ExpectedValue",
":",
"value",
"}",
"\n",
"}"
] |
6,790 | all-6791 | [
"Header",
"returns",
"response",
"header",
"representation",
".",
"The",
"returned",
"value",
"is",
"valid",
"until",
"the",
"next",
"call",
"to",
"ResponseHeader",
"methods",
"."
] | [
"func",
"(",
"h",
"*",
"ResponseHeader",
")",
"Header",
"(",
")",
"[",
"]",
"byte",
"{",
"h",
".",
"bufKV",
".",
"value",
"=",
"h",
".",
"AppendBytes",
"(",
"h",
".",
"bufKV",
".",
"value",
"[",
":",
"0",
"]",
")",
"\n",
"return",
"h",
".",
"bufKV",
".",
"<mask>",
"\n",
"}"
] |
6,791 | all-6792 | [
"Execute",
"-",
"updates",
"org",
"configuration"
] | [
"func",
"(",
"c",
"*",
"UpdateOrgsConfigurationCommand",
")",
"Execute",
"(",
"args",
"[",
"]",
"string",
")",
"error",
"{",
"c",
".",
"initConfig",
"(",
")",
"\n",
"orgs",
",",
"err",
":=",
"c",
".",
"ConfigManager",
".",
"Orgs",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"errorString",
":=",
"\"",
"\"",
"\n",
"convertToBool",
"(",
"\"",
"\"",
",",
"&",
"orgs",
".",
"EnableDeleteOrgs",
",",
"c",
".",
"EnableDeleteOrgs",
",",
"&",
"errorString",
")",
"\n",
"orgs",
".",
"ProtectedOrgs",
"=",
"removeFromSlice",
"(",
"addToSlice",
"(",
"orgs",
".",
"ProtectedOrgs",
",",
"c",
".",
"ProtectedOrgsToAdd",
",",
"&",
"errorString",
")",
",",
"c",
".",
"ProtectedOrgsToRemove",
")",
"\n\n",
"if",
"errorString",
"!=",
"\"",
"\"",
"{",
"return",
"<mask>",
".",
"New",
"(",
"errorString",
")",
"\n",
"}",
"\n\n",
"if",
"err",
":=",
"c",
".",
"ConfigManager",
".",
"SaveOrgs",
"(",
"orgs",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"fmt",
".",
"Println",
"(",
"\"",
"\"",
")",
"\n",
"return",
"nil",
"\n",
"}"
] |
6,792 | all-6793 | [
"MarshalJSON",
"supports",
"json",
".",
"Marshaler",
"interface"
] | [
"func",
"(",
"v",
"Request",
")",
"MarshalJSON",
"(",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"w",
":=",
"jwriter",
".",
"Writer",
"{",
"}",
"\n",
"easyjsonC5a4559bEncodeGithubComChromedpCdprotoNetwork25",
"(",
"&",
"w",
",",
"v",
")",
"\n",
"return",
"w",
".",
"Buffer",
".",
"BuildBytes",
"(",
")",
",",
"w",
".",
"<mask>",
"\n",
"}"
] |
6,793 | all-6794 | [
"resourceVSphereDPMHostOverrideObjects",
"handles",
"the",
"fetching",
"of",
"the",
"cluster",
"and",
"host",
"depending",
"on",
"what",
"attributes",
"are",
"available",
":",
"*",
"If",
"the",
"resource",
"ID",
"is",
"available",
"the",
"data",
"is",
"derived",
"from",
"the",
"ID",
".",
"*",
"If",
"not",
"it",
"s",
"derived",
"from",
"the",
"compute_cluster_id",
"and",
"host_system_id",
"attributes",
"."
] | [
"func",
"resourceVSphereDPMHostOverrideObjects",
"(",
"d",
"*",
"schema",
".",
"ResourceData",
",",
"meta",
"interface",
"{",
"}",
",",
")",
"(",
"*",
"object",
".",
"ClusterComputeResource",
",",
"*",
"object",
".",
"HostSystem",
",",
"error",
")",
"{",
"if",
"d",
".",
"<mask>",
"(",
")",
"!=",
"\"",
"\"",
"{",
"return",
"resourceVSphereDPMHostOverrideObjectsFromID",
"(",
"d",
",",
"meta",
")",
"\n",
"}",
"\n",
"return",
"resourceVSphereDPMHostOverrideObjectsFromAttributes",
"(",
"d",
",",
"meta",
")",
"\n",
"}"
] |
6,794 | all-6795 | [
"MarshalEasyJSON",
"satisfies",
"easyjson",
".",
"Marshaler",
"."
] | [
"func",
"(",
"t",
"StreamFormat",
")",
"MarshalEasyJSON",
"(",
"out",
"*",
"jwriter",
".",
"Writer",
")",
"{",
"<mask>",
".",
"String",
"(",
"string",
"(",
"t",
")",
")",
"\n",
"}"
] |
6,795 | all-6796 | [
"watcherSetByKey",
"gets",
"the",
"set",
"of",
"watchers",
"that",
"receive",
"events",
"on",
"the",
"given",
"key",
"."
] | [
"func",
"(",
"wg",
"*",
"watcherGroup",
")",
"watcherSetByKey",
"(",
"key",
"string",
")",
"watcherSet",
"{",
"wkeys",
":=",
"wg",
".",
"keyWatchers",
"[",
"key",
"]",
"\n",
"wranges",
":=",
"wg",
".",
"ranges",
".",
"Stab",
"(",
"adt",
".",
"NewStringAffinePoint",
"(",
"key",
")",
")",
"\n\n",
"// zero-copy cases",
"switch",
"{",
"<mask>",
"len",
"(",
"wranges",
")",
"==",
"0",
":",
"// no need to merge ranges or copy; reuse single-key set",
"return",
"wkeys",
"\n",
"case",
"len",
"(",
"wranges",
")",
"==",
"0",
"&&",
"len",
"(",
"wkeys",
")",
"==",
"0",
":",
"return",
"nil",
"\n",
"case",
"len",
"(",
"wranges",
")",
"==",
"1",
"&&",
"len",
"(",
"wkeys",
")",
"==",
"0",
":",
"return",
"wranges",
"[",
"0",
"]",
".",
"Val",
".",
"(",
"watcherSet",
")",
"\n",
"}",
"\n\n",
"// copy case",
"ret",
":=",
"make",
"(",
"watcherSet",
")",
"\n",
"ret",
".",
"union",
"(",
"wg",
".",
"keyWatchers",
"[",
"key",
"]",
")",
"\n",
"for",
"_",
",",
"item",
":=",
"range",
"wranges",
"{",
"ret",
".",
"union",
"(",
"item",
".",
"Val",
".",
"(",
"watcherSet",
")",
")",
"\n",
"}",
"\n",
"return",
"ret",
"\n",
"}"
] |
6,796 | all-6797 | [
"MarshalJSON",
"supports",
"json",
".",
"Marshaler",
"interface"
] | [
"func",
"(",
"v",
"GetDOMCountersReturns",
")",
"MarshalJSON",
"(",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"w",
":=",
"jwriter",
".",
"Writer",
"{",
"}",
"\n",
"easyjsonC5a4559bEncodeGithubComChromedpCdprotoMemory10",
"(",
"&",
"w",
",",
"v",
")",
"\n",
"return",
"w",
".",
"<mask>",
".",
"BuildBytes",
"(",
")",
",",
"w",
".",
"Error",
"\n",
"}"
] |
6,797 | all-6798 | [
"NewGossipSenders",
"returns",
"a",
"usable",
"GossipSenders",
"leveraging",
"the",
"ProtocolSender",
".",
"TODO",
"(",
"pb",
")",
":",
"is",
"stop",
"chan",
"the",
"best",
"way",
"to",
"do",
"that?"
] | [
"func",
"newGossipSenders",
"(",
"sender",
"protocolSender",
",",
"stop",
"<-",
"chan",
"struct",
"{",
"}",
")",
"*",
"gossipSenders",
"{",
"return",
"&",
"gossipSenders",
"{",
"sender",
":",
"sender",
",",
"<mask>",
":",
"stop",
",",
"senders",
":",
"make",
"(",
"map",
"[",
"string",
"]",
"*",
"gossipSender",
")",
",",
"}",
"\n",
"}"
] |
6,798 | all-6799 | [
"WithTimeout",
"adds",
"the",
"timeout",
"to",
"the",
"patch",
"apps",
"app",
"params"
] | [
"func",
"(",
"o",
"*",
"PatchAppsAppParams",
")",
"WithTimeout",
"(",
"timeout",
"<mask>",
".",
"Duration",
")",
"*",
"PatchAppsAppParams",
"{",
"o",
".",
"SetTimeout",
"(",
"timeout",
")",
"\n",
"return",
"o",
"\n",
"}"
] |
6,799 | all-6800 | [
"the",
"actual",
"work",
"is",
"done",
"on",
"the",
"handler",
".",
"go",
"here",
"we",
"just",
"provide",
"a",
"helper",
"for",
"the",
"main",
"package",
"to",
"create",
"an",
"http",
".",
"Server",
"and",
"serve",
"a",
"cache",
"remote",
"service",
"without",
"any",
"user",
"touches",
"New",
"returns",
"a",
"http",
".",
"Server",
"which",
"hosts",
"the",
"server",
"-",
"side",
"handler",
"for",
"the",
"remote",
"cache",
"service",
".",
"it",
"doesn",
"t",
"listens",
"to",
"the",
"server"
] | [
"func",
"New",
"(",
"addr",
"string",
",",
"<mask>",
"Store",
")",
"*",
"http",
".",
"Server",
"{",
"if",
"store",
"==",
"nil",
"{",
"store",
"=",
"NewMemoryStore",
"(",
")",
"\n",
"}",
"\n",
"h",
":=",
"&",
"Handler",
"{",
"store",
":",
"store",
"}",
"\n",
"return",
"&",
"http",
".",
"Server",
"{",
"Addr",
":",
"addr",
",",
"Handler",
":",
"h",
",",
"}",
"\n",
"}"
] |
Subsets and Splits
No saved queries yet
Save your SQL queries to embed, download, and access them later. Queries will appear here once saved.