id
int32 0
25.3k
| idx
stringlengths 5
9
| nl_tokens
listlengths 1
418
| pl_tokens
listlengths 22
4.98k
|
---|---|---|---|
19,100 | all-19101 | [
"/",
"*",
"RespondWithJSONEncodedPtr",
"behaves",
"like",
"RespondWithJSONEncoded",
"but",
"takes",
"a",
"pointer",
"to",
"a",
"status",
"code",
"and",
"object",
"."
]
| [
"func",
"RespondWithJSONEncodedPtr",
"(",
"statusCode",
"*",
"int",
",",
"object",
"interface",
"{",
"}",
",",
"optionalHeader",
"...",
"http",
".",
"Header",
")",
"http",
".",
"HandlerFunc",
"{",
"return",
"func",
"(",
"w",
"http",
".",
"ResponseWriter",
",",
"req",
"*",
"http",
".",
"Request",
")",
"{",
"data",
",",
"err",
":=",
"json",
".",
"Marshal",
"(",
"object",
")",
"\n",
"Expect",
"(",
"err",
")",
".",
"ShouldNot",
"(",
"HaveOccurred",
"(",
")",
")",
"\n",
"var",
"headers",
"http",
".",
"Header",
"\n",
"if",
"len",
"(",
"optionalHeader",
")",
"==",
"1",
"{",
"<mask>",
"=",
"optionalHeader",
"[",
"0",
"]",
"\n",
"}",
"else",
"{",
"headers",
"=",
"make",
"(",
"http",
".",
"Header",
")",
"\n",
"}",
"\n",
"if",
"_",
",",
"found",
":=",
"headers",
"[",
"\"",
"\"",
"]",
";",
"!",
"found",
"{",
"headers",
"[",
"\"",
"\"",
"]",
"=",
"[",
"]",
"string",
"{",
"\"",
"\"",
"}",
"\n",
"}",
"\n",
"copyHeader",
"(",
"headers",
",",
"w",
".",
"Header",
"(",
")",
")",
"\n",
"w",
".",
"WriteHeader",
"(",
"*",
"statusCode",
")",
"\n",
"w",
".",
"Write",
"(",
"data",
")",
"\n",
"}",
"\n",
"}"
]
|
19,101 | all-19102 | [
"has",
"is",
"a",
"util",
"func",
"to",
"determine",
"if",
"a",
"contains",
"b",
"."
]
| [
"func",
"has",
"(",
"a",
"[",
"]",
"string",
",",
"b",
"string",
")",
"bool",
"{",
"for",
"_",
",",
"s",
":=",
"<mask>",
"a",
"{",
"if",
"s",
"==",
"b",
"{",
"return",
"true",
"\n",
"}",
"\n",
"}",
"\n\n",
"return",
"false",
"\n",
"}"
]
|
19,102 | all-19103 | [
"work",
"uses",
"fetcher",
"to",
"recursively",
"crawl",
"pages",
"starting",
"with",
"url",
"to",
"a",
"maximum",
"of",
"depth",
"."
]
| [
"func",
"work",
"(",
"args",
"...",
"interface",
"{",
"}",
")",
"interface",
"{",
"}",
"{",
"url",
":=",
"args",
"[",
"0",
"]",
".",
"(",
"string",
")",
"\n",
"depth",
":=",
"args",
"[",
"1",
"]",
".",
"(",
"int",
")",
"\n",
"fetcher",
":=",
"args",
"[",
"2",
"]",
".",
"(",
"Fetcher",
")",
"\n",
"if",
"depth",
"<=",
"0",
"{",
"return",
"crawlResult",
"{",
"}",
"\n",
"}",
"\n",
"<mask>",
",",
"urls",
",",
"err",
":=",
"fetcher",
".",
"Fetch",
"(",
"url",
")",
"\n",
"return",
"crawlResult",
"{",
"body",
",",
"urls",
",",
"err",
"}",
"\n",
"}"
]
|
19,103 | all-19104 | [
"StderrPrefix",
"sets",
"the",
"StderrPrefix"
]
| [
"func",
"(",
"e",
"*",
"execStreamerBuilder",
")",
"StderrPrefix",
"(",
"<mask>",
"string",
")",
"ExecStreamerBuilder",
"{",
"e",
".",
"d",
".",
"StderrPrefix",
"=",
"prefix",
"\n",
"return",
"e",
"\n",
"}"
]
|
19,104 | all-19105 | [
"FirstByLink",
"finds",
"the",
"first",
"anchor",
"element",
"by",
"its",
"text",
"content",
"."
]
| [
"func",
"(",
"s",
"*",
"selectable",
")",
"FirstByLink",
"(",
"text",
"string",
")",
"*",
"Selection",
"{",
"return",
"newSelection",
"(",
"s",
".",
"session",
",",
"s",
".",
"selectors",
".",
"Append",
"(",
"target",
".",
"Link",
",",
"<mask>",
")",
".",
"At",
"(",
"0",
")",
")",
"\n",
"}"
]
|
19,105 | all-19106 | [
"func",
"FileTail",
"(",
"filenameOrURL",
"string",
"numLines",
"int",
"timeout",
"...",
"time",
".",
"Duration",
")",
"(",
"lines",
"[]",
"string",
"err",
"error",
")",
"{",
"if",
"strings",
".",
"Index",
"(",
"filenameOrURL",
"file",
":",
"//",
")",
"==",
"0",
"{",
"filenameOrURL",
"=",
"filenameOrURL",
"[",
"len",
"(",
"file",
":",
"//",
")",
":",
"]",
"}",
"else",
"if",
"strings",
".",
"Contains",
"(",
"filenameOrURL",
":",
"//",
")",
"{",
"data",
"err",
":",
"=",
"FileGetBytes",
"(",
"filenameOrURL",
"timeout",
"...",
")",
"if",
"err",
"!",
"=",
"nil",
"{",
"return",
"nil",
"err",
"}",
"lines",
"_",
":",
"=",
"BytesTail",
"(",
"data",
"numLines",
")",
"return",
"lines",
"nil",
"}",
"//",
"data",
":",
"=",
"make",
"(",
"[]",
"byte",
"0",
"1024",
"*",
"256",
")",
"//",
"file",
"err",
":",
"=",
"os",
".",
"Open",
"(",
"filenameOrURL",
")",
"//",
"if",
"err",
"!",
"=",
"nil",
"{",
"//",
"return",
"nil",
"err",
"//",
"}",
"//",
"defer",
"file",
".",
"Close",
"()",
"//",
"info",
"err",
":",
"=",
"file",
".",
"Stat",
"()",
"//",
"if",
"err",
"!",
"=",
"nil",
"{",
"//",
"return",
"nil",
"err",
"//",
"}",
"//",
"if",
"start",
":",
"=",
"info",
".",
"Size",
"()",
"-",
"64",
"*",
"1024",
";",
"start",
">",
"0",
"{",
"//",
"file",
".",
"Seek",
"(",
"start",
"os",
".",
"SEEK_SET",
")",
"//",
"}",
"//",
"data",
"err",
"=",
"ioutil",
".",
"ReadAll",
"(",
"file",
")",
"//",
"if",
"err",
"!",
"=",
"nil",
"{",
"//",
"return",
"nil",
"err",
"//",
"}",
"return",
"lines",
"nil",
"}",
"FileTimeModified",
"returns",
"the",
"modified",
"time",
"of",
"a",
"file",
"or",
"the",
"zero",
"time",
"value",
"in",
"case",
"of",
"an",
"error",
"."
]
| [
"func",
"FileTimeModified",
"(",
"<mask>",
"string",
")",
"time",
".",
"Time",
"{",
"info",
",",
"err",
":=",
"os",
".",
"Stat",
"(",
"filename",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"time",
".",
"Time",
"{",
"}",
"\n",
"}",
"\n",
"return",
"info",
".",
"ModTime",
"(",
")",
"\n",
"}"
]
|
19,106 | all-19107 | [
"WithPostData",
"if",
"set",
"overrides",
"the",
"post",
"data",
"in",
"the",
"request",
"."
]
| [
"func",
"(",
"p",
"ContinueRequestParams",
")",
"WithPostData",
"(",
"postData",
"<mask>",
")",
"*",
"ContinueRequestParams",
"{",
"p",
".",
"PostData",
"=",
"postData",
"\n",
"return",
"&",
"p",
"\n",
"}"
]
|
19,107 | all-19108 | [
"MemoryResource",
"returns",
"the",
"system",
"memory",
"information"
]
| [
"func",
"MemoryResource",
"(",
")",
"(",
"*",
"api",
".",
"ResourcesMemory",
",",
"error",
")",
"{",
"var",
"buffers",
"uint64",
"\n",
"var",
"cached",
"uint64",
"\n",
"var",
"free",
"uint64",
"\n",
"var",
"total",
"uint64",
"\n\n",
"f",
",",
"err",
":=",
"os",
".",
"Open",
"(",
"\"",
"\"",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"defer",
"f",
".",
"Close",
"(",
")",
"\n\n",
"cleanLine",
":=",
"func",
"(",
"l",
"string",
")",
"(",
"string",
",",
"error",
")",
"{",
"l",
"=",
"strings",
".",
"TrimSpace",
"(",
"l",
")",
"\n",
"idx",
":=",
"strings",
".",
"LastIndex",
"(",
"l",
",",
"\"",
"\"",
")",
"\n",
"if",
"idx",
"<",
"0",
"{",
"return",
"\"",
"\"",
",",
"fmt",
".",
"Errorf",
"(",
"`Failed to detect \"kB\" suffix`",
")",
"\n",
"}",
"\n\n",
"return",
"strings",
".",
"TrimSpace",
"(",
"l",
"[",
":",
"idx",
"]",
")",
",",
"nil",
"\n",
"}",
"\n\n",
"mem",
":=",
"api",
".",
"ResourcesMemory",
"{",
"}",
"\n",
"scanner",
":=",
"bufio",
".",
"NewScanner",
"(",
"f",
")",
"\n",
"found",
":=",
"0",
"\n",
"for",
"scanner",
".",
"Scan",
"(",
")",
"{",
"var",
"err",
"error",
"\n",
"line",
":=",
"scanner",
".",
"Text",
"(",
")",
"\n\n",
"if",
"strings",
".",
"HasPrefix",
"(",
"line",
",",
"\"",
"\"",
")",
"{",
"line",
",",
"err",
"=",
"cleanLine",
"(",
"line",
"[",
"len",
"(",
"\"",
"\"",
")",
":",
"]",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"total",
",",
"err",
"=",
"strconv",
".",
"ParseUint",
"(",
"line",
",",
"10",
",",
"64",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"found",
"++",
"\n",
"}",
"else",
"if",
"strings",
".",
"HasPrefix",
"(",
"line",
",",
"\"",
"\"",
")",
"{",
"line",
",",
"err",
"=",
"cleanLine",
"(",
"line",
"[",
"len",
"(",
"\"",
"\"",
")",
":",
"]",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"free",
",",
"err",
"=",
"strconv",
".",
"ParseUint",
"(",
"line",
",",
"10",
",",
"64",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"found",
"++",
"\n",
"}",
"else",
"if",
"strings",
".",
"HasPrefix",
"(",
"line",
",",
"\"",
"\"",
")",
"{",
"line",
",",
"err",
"=",
"cleanLine",
"(",
"line",
"[",
"len",
"(",
"\"",
"\"",
")",
":",
"]",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"cached",
",",
"err",
"=",
"strconv",
".",
"ParseUint",
"(",
"line",
",",
"10",
",",
"64",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"found",
"++",
"\n",
"}",
"else",
"if",
"strings",
".",
"HasPrefix",
"(",
"line",
",",
"\"",
"\"",
")",
"{",
"line",
",",
"err",
"=",
"cleanLine",
"(",
"<mask>",
"[",
"len",
"(",
"\"",
"\"",
")",
":",
"]",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"buffers",
",",
"err",
"=",
"strconv",
".",
"ParseUint",
"(",
"line",
",",
"10",
",",
"64",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"found",
"++",
"\n",
"}",
"\n\n",
"if",
"found",
"==",
"4",
"{",
"break",
"\n",
"}",
"\n",
"}",
"\n\n",
"mem",
".",
"Total",
"=",
"total",
"*",
"1024",
"\n",
"mem",
".",
"Used",
"=",
"(",
"total",
"-",
"free",
"-",
"cached",
"-",
"buffers",
")",
"*",
"1024",
"\n\n",
"return",
"&",
"mem",
",",
"err",
"\n",
"}"
]
|
19,108 | all-19109 | [
"getGroups",
"is",
"a",
"helper",
"function",
"used",
"primarily",
"by",
"the",
"GRPC",
"API",
"GetGroups",
"but",
"also",
"by",
"Authorize",
"()",
"and",
"isAdmin",
"()",
"."
]
| [
"func",
"(",
"a",
"*",
"apiServer",
")",
"getGroups",
"(",
"ctx",
"context",
".",
"Context",
",",
"subject",
"string",
")",
"(",
"[",
"]",
"string",
",",
"error",
")",
"{",
"<mask>",
":=",
"a",
".",
"members",
".",
"ReadOnly",
"(",
"ctx",
")",
"\n",
"var",
"groupsProto",
"authclient",
".",
"Groups",
"\n",
"if",
"err",
":=",
"members",
".",
"Get",
"(",
"subject",
",",
"&",
"groupsProto",
")",
";",
"err",
"!=",
"nil",
"{",
"if",
"col",
".",
"IsErrNotFound",
"(",
"err",
")",
"{",
"return",
"[",
"]",
"string",
"{",
"}",
",",
"nil",
"\n",
"}",
"\n",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"return",
"setToList",
"(",
"groupsProto",
".",
"Groups",
")",
",",
"nil",
"\n",
"}"
]
|
19,109 | all-19110 | [
"void",
"pango_cairo_show_glyph_item",
"(",
"cairo_t",
"*",
"cr",
"const",
"char",
"*",
"text",
"PangoGlyphItem",
"*",
"glyph_item",
")",
";"
]
| [
"func",
"CairoShowGlyphItem",
"(",
"cr",
"*",
"cairo",
".",
"Context",
",",
"<mask>",
"string",
",",
"glyph_item",
"*",
"GlyphItem",
")",
"{",
"cstr",
":=",
"C",
".",
"CString",
"(",
"text",
")",
"\n",
"defer",
"C",
".",
"free",
"(",
"unsafe",
".",
"Pointer",
"(",
"cstr",
")",
")",
"\n",
"C",
".",
"pango_cairo_show_glyph_item",
"(",
"cairo_context",
"(",
"cr",
")",
",",
"(",
"*",
"C",
".",
"char",
")",
"(",
"cstr",
")",
",",
"glyph_item",
".",
"native",
"(",
")",
")",
"\n",
"}"
]
|
19,110 | all-19111 | [
"SetValue",
"is",
"a",
"wrapper",
"around",
"gtk_tree_store_set_value",
"()"
]
| [
"func",
"(",
"v",
"*",
"TreeStore",
")",
"SetValue",
"(",
"iter",
"*",
"TreeIter",
",",
"column",
"int",
",",
"value",
"interface",
"{",
"}",
")",
"error",
"{",
"<mask>",
"value",
".",
"(",
"type",
")",
"{",
"case",
"*",
"gdk",
".",
"Pixbuf",
":",
"pix",
":=",
"value",
".",
"(",
"*",
"gdk",
".",
"Pixbuf",
")",
"\n",
"C",
".",
"_gtk_tree_store_set",
"(",
"v",
".",
"native",
"(",
")",
",",
"iter",
".",
"native",
"(",
")",
",",
"C",
".",
"gint",
"(",
"column",
")",
",",
"unsafe",
".",
"Pointer",
"(",
"pix",
".",
"Native",
"(",
")",
")",
")",
"\n\n",
"default",
":",
"gv",
",",
"err",
":=",
"glib",
".",
"GValue",
"(",
"value",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"C",
".",
"gtk_tree_store_set_value",
"(",
"v",
".",
"native",
"(",
")",
",",
"iter",
".",
"native",
"(",
")",
",",
"C",
".",
"gint",
"(",
"column",
")",
",",
"(",
"*",
"C",
".",
"GValue",
")",
"(",
"C",
".",
"gpointer",
"(",
"gv",
".",
"Native",
"(",
")",
")",
")",
")",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
]
|
19,111 | all-19112 | [
"optionsForRepo",
"gets",
"the",
"plugins",
".",
"Welcome",
"struct",
"that",
"is",
"applicable",
"to",
"the",
"indicated",
"repo",
"."
]
| [
"func",
"optionsForRepo",
"(",
"config",
"*",
"plugins",
".",
"Configuration",
",",
"org",
",",
"repo",
"string",
")",
"*",
"plugins",
".",
"Welcome",
"{",
"fullName",
":=",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"org",
",",
"repo",
")",
"\n\n",
"// First search for repo config",
"for",
"_",
",",
"c",
":=",
"range",
"config",
".",
"Welcome",
"{",
"if",
"!",
"strInSlice",
"(",
"fullName",
",",
"c",
".",
"Repos",
")",
"{",
"continue",
"\n",
"}",
"\n",
"return",
"&",
"c",
"\n",
"}",
"\n\n",
"// If you don't find anything, loop again looking for an org config",
"for",
"_",
",",
"c",
":=",
"range",
"config",
".",
"Welcome",
"{",
"if",
"!",
"strInSlice",
"(",
"org",
",",
"c",
".",
"Repos",
")",
"{",
"<mask>",
"\n",
"}",
"\n",
"return",
"&",
"c",
"\n",
"}",
"\n\n",
"// Return an empty config, and default to defaultWelcomeMessage",
"return",
"&",
"plugins",
".",
"Welcome",
"{",
"}",
"\n",
"}"
]
|
19,112 | all-19113 | [
"getTLDData",
"fetches",
"the",
"ICANN_TLDS",
"list",
"and",
"uses",
"the",
"information",
"to",
"build",
"and",
"return",
"a",
"list",
"of",
"util",
".",
"GTLDPeriod",
"objects",
"(",
"or",
"an",
"error",
"if",
"anything",
"fails",
")",
".",
"Since",
"this",
"data",
"source",
"only",
"contains",
"TLD",
"names",
"and",
"not",
"any",
"information",
"about",
"delegation",
"/",
"removal",
"all",
"of",
"the",
"returned",
"util",
".",
"GTLDPeriod",
"objects",
"will",
"have",
"the",
"DelegationDate",
"1985",
"-",
"01",
"-",
"01",
"(",
"matching",
"the",
".",
"com",
"delegation",
"date",
")",
"and",
"no",
"RemovalDate",
"."
]
| [
"func",
"getTLDData",
"(",
")",
"(",
"[",
"]",
"util",
".",
"GTLDPeriod",
",",
"error",
")",
"{",
"respBody",
",",
"err",
":=",
"getData",
"(",
"ICANN_TLDS",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"}",
"\n",
"tlds",
":=",
"strings",
".",
"Split",
"(",
"string",
"(",
"respBody",
")",
",",
"\"",
"\\n",
"\"",
")",
"\n\n",
"var",
"<mask>",
"[",
"]",
"util",
".",
"GTLDPeriod",
"\n",
"for",
"_",
",",
"tld",
":=",
"range",
"tlds",
"{",
"// Skip empty lines and the header comment line",
"if",
"strings",
".",
"TrimSpace",
"(",
"tld",
")",
"==",
"\"",
"\"",
"||",
"strings",
".",
"HasPrefix",
"(",
"tld",
",",
"\"",
"\"",
")",
"{",
"continue",
"\n",
"}",
"\n",
"results",
"=",
"append",
"(",
"results",
",",
"util",
".",
"GTLDPeriod",
"{",
"GTLD",
":",
"strings",
".",
"ToLower",
"(",
"tld",
")",
",",
"// The TLD list doesn't indicate when any of the TLDs were delegated so",
"// assume these TLDs were all delegated at the same time as \"com\".",
"DelegationDate",
":",
"\"",
"\"",
",",
"}",
")",
"\n",
"}",
"\n",
"return",
"results",
",",
"nil",
"\n",
"}"
]
|
19,113 | all-19114 | [
"WriteObject",
"implements",
"ObjectCodec",
"."
]
| [
"func",
"(",
"VSCodeObjectCodec",
")",
"WriteObject",
"(",
"stream",
"io",
".",
"Writer",
",",
"obj",
"<mask>",
"{",
"}",
")",
"error",
"{",
"data",
",",
"err",
":=",
"json",
".",
"Marshal",
"(",
"obj",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"if",
"_",
",",
"err",
":=",
"fmt",
".",
"Fprintf",
"(",
"stream",
",",
"\"",
"\\r",
"\\n",
"\\r",
"\\n",
"\"",
",",
"len",
"(",
"data",
")",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"if",
"_",
",",
"err",
":=",
"stream",
".",
"Write",
"(",
"data",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
]
|
19,114 | all-19115 | [
"NOTE",
":",
"This",
"performs",
"a",
"blocking",
"handshake",
"before",
"the",
"peer",
"is",
"added",
".",
"CONTRACT",
":",
"If",
"error",
"is",
"returned",
"peer",
"is",
"nil",
"and",
"conn",
"is",
"immediately",
"closed",
"."
]
| [
"func",
"(",
"sw",
"*",
"Switch",
")",
"AddPeer",
"(",
"peer",
"*",
"Peer",
")",
"error",
"{",
"if",
"err",
":=",
"sw",
".",
"FilterConnByAddr",
"(",
"peer",
".",
"Addr",
"(",
")",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"if",
"err",
":=",
"sw",
".",
"FilterConnByPubKey",
"(",
"peer",
".",
"PubKey",
"(",
")",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"if",
"err",
":=",
"peer",
".",
"HandshakeTimeout",
"(",
"sw",
".",
"nodeInfo",
",",
"time",
".",
"Duration",
"(",
"sw",
".",
"config",
".",
"GetInt",
"(",
"configKeyHandshakeTimeoutSeconds",
")",
")",
"*",
"time",
".",
"Second",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"// Avoid self",
"if",
"sw",
".",
"nodeInfo",
".",
"PubKey",
".",
"Equals",
"(",
"peer",
".",
"PubKey",
"(",
")",
")",
"{",
"return",
"errors",
".",
"New",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"// Check version, chain id",
"if",
"err",
":=",
"sw",
".",
"nodeInfo",
".",
"CompatibleWith",
"(",
"peer",
".",
"NodeInfo",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"// Add the peer to .peers",
"// ignore if duplicate or if we already have too many for that IP range",
"if",
"err",
":=",
"sw",
".",
"peers",
".",
"Add",
"(",
"peer",
")",
";",
"err",
"!=",
"nil",
"{",
"log",
".",
"Notice",
"(",
"\"",
"\"",
",",
"\"",
"\"",
",",
"err",
",",
"\"",
"\"",
",",
"peer",
")",
"\n",
"peer",
".",
"Stop",
"(",
")",
"\n",
"return",
"err",
"\n",
"}",
"\n\n",
"// Start peer",
"if",
"sw",
".",
"IsRunning",
"(",
")",
"{",
"sw",
".",
"startInitPeer",
"(",
"<mask>",
")",
"\n",
"}",
"\n\n",
"log",
".",
"Notice",
"(",
"\"",
"\"",
",",
"\"",
"\"",
",",
"peer",
")",
"\n",
"return",
"nil",
"\n",
"}"
]
|
19,115 | all-19116 | [
"SetTabPos",
"()",
"is",
"a",
"wrapper",
"around",
"gtk_notebook_set_tab_pos",
"()",
"."
]
| [
"func",
"(",
"v",
"*",
"Notebook",
")",
"SetTabPos",
"(",
"pos",
"PositionType",
")",
"{",
"C",
".",
"gtk_notebook_set_tab_pos",
"(",
"v",
".",
"native",
"(",
")",
",",
"C",
".",
"GtkPositionType",
"(",
"<mask>",
")",
")",
"\n",
"}"
]
|
19,116 | all-19117 | [
"String",
"satisfies",
"stringer",
"and",
"attempts",
"to",
"strip",
"off",
"authentication",
"info",
"from",
"url",
"if",
"it",
"exists",
"."
]
| [
"func",
"(",
"r",
"RepoURL",
")",
"String",
"(",
")",
"string",
"{",
"u",
",",
"err",
":=",
"<mask>",
".",
"Parse",
"(",
"string",
"(",
"r",
")",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"string",
"(",
"r",
")",
"\n",
"}",
"\n",
"if",
"u",
".",
"User",
"!=",
"nil",
"{",
"u",
".",
"User",
"=",
"url",
".",
"User",
"(",
"u",
".",
"User",
".",
"Username",
"(",
")",
")",
"\n",
"}",
"\n",
"return",
"u",
".",
"String",
"(",
")",
"\n",
"}"
]
|
19,117 | all-19118 | [
"SetDrawableSize",
"sets",
"the",
"size",
"in",
"pixels",
"of",
"textures",
"for",
"rendering",
"layer",
"content",
".",
"Reference",
":",
"https",
":",
"//",
"developer",
".",
"apple",
".",
"com",
"/",
"documentation",
"/",
"quartzcore",
"/",
"cametallayer",
"/",
"1478174",
"-",
"drawablesize",
"."
]
| [
"func",
"(",
"ml",
"MetalLayer",
")",
"SetDrawableSize",
"(",
"width",
",",
"height",
"int",
")",
"{",
"C",
".",
"MetalLayer_SetDrawableSize",
"(",
"ml",
".",
"metalLayer",
",",
"C",
".",
"double",
"(",
"<mask>",
")",
",",
"C",
".",
"double",
"(",
"height",
")",
")",
"\n",
"}"
]
|
19,118 | all-19119 | [
"Seek",
"brings",
"us",
"to",
"the",
"first",
"block",
"element",
"that",
"is",
">",
"=",
"input",
"key",
"."
]
| [
"func",
"(",
"itr",
"*",
"blockIterator",
")",
"Seek",
"(",
"key",
"[",
"]",
"byte",
",",
"whence",
"int",
")",
"{",
"itr",
".",
"err",
"=",
"nil",
"\n\n",
"switch",
"whence",
"{",
"case",
"origin",
":",
"itr",
".",
"Reset",
"(",
")",
"\n",
"case",
"current",
":",
"}",
"\n\n",
"<mask>",
"done",
"bool",
"\n",
"for",
"itr",
".",
"Init",
"(",
")",
";",
"itr",
".",
"Valid",
"(",
")",
";",
"itr",
".",
"Next",
"(",
")",
"{",
"k",
":=",
"itr",
".",
"Key",
"(",
")",
"\n",
"if",
"y",
".",
"CompareKeys",
"(",
"k",
",",
"key",
")",
">=",
"0",
"{",
"// We are done as k is >= key.",
"done",
"=",
"true",
"\n",
"break",
"\n",
"}",
"\n",
"}",
"\n",
"if",
"!",
"done",
"{",
"itr",
".",
"err",
"=",
"io",
".",
"EOF",
"\n",
"}",
"\n",
"}"
]
|
19,119 | all-19120 | [
"handleDesiredStatusChange",
"updates",
"the",
"desired",
"status",
"on",
"the",
"task",
".",
"Updates",
"only",
"occur",
"if",
"the",
"new",
"desired",
"status",
"is",
"compatible",
"(",
"farther",
"along",
"than",
"the",
"current",
"desired",
"state",
")",
";",
"redundant",
"(",
"less",
"-",
"than",
"or",
"equal",
"desired",
"states",
")",
"are",
"ignored",
"and",
"dropped",
"."
]
| [
"func",
"(",
"mtask",
"*",
"managedTask",
")",
"handleDesiredStatusChange",
"(",
"desiredStatus",
"apitaskstatus",
".",
"TaskStatus",
",",
"seqnum",
"int64",
")",
"{",
"// Handle acs message changes this task's desired status to whatever",
"// acs says it should be if it is compatible",
"seelog",
".",
"Debugf",
"(",
"\"",
"\"",
",",
"mtask",
".",
"Arn",
",",
"desiredStatus",
".",
"String",
"(",
")",
",",
"seqnum",
",",
"mtask",
".",
"StopSequenceNumber",
")",
"\n",
"if",
"desiredStatus",
"<=",
"mtask",
".",
"GetDesiredStatus",
"(",
")",
"{",
"seelog",
".",
"Debugf",
"(",
"\"",
"\"",
",",
"mtask",
".",
"Arn",
",",
"mtask",
".",
"GetDesiredStatus",
"(",
")",
".",
"String",
"(",
")",
",",
"desiredStatus",
".",
"<mask>",
"(",
")",
")",
"\n",
"return",
"\n",
"}",
"\n",
"if",
"desiredStatus",
"==",
"apitaskstatus",
".",
"TaskStopped",
"&&",
"seqnum",
"!=",
"0",
"&&",
"mtask",
".",
"GetStopSequenceNumber",
"(",
")",
"==",
"0",
"{",
"seelog",
".",
"Debugf",
"(",
"\"",
"\"",
",",
"mtask",
".",
"Arn",
",",
"seqnum",
")",
"\n",
"mtask",
".",
"SetStopSequenceNumber",
"(",
"seqnum",
")",
"\n",
"mtask",
".",
"taskStopWG",
".",
"Add",
"(",
"seqnum",
",",
"1",
")",
"\n",
"}",
"\n",
"mtask",
".",
"SetDesiredStatus",
"(",
"desiredStatus",
")",
"\n",
"mtask",
".",
"UpdateDesiredStatus",
"(",
")",
"\n",
"}"
]
|
19,120 | all-19121 | [
"Check",
"the",
"content",
"encoding",
"against",
"a",
"list",
"of",
"acceptable",
"values",
"."
]
| [
"func",
"contentEncoding",
"(",
"ce",
"string",
",",
"charsets",
"...",
"string",
")",
"bool",
"{",
"_",
",",
"ce",
"=",
"split",
"(",
"strings",
".",
"ToLower",
"(",
"ce",
")",
",",
"\"",
"\"",
")",
"\n",
"_",
",",
"ce",
"=",
"split",
"(",
"ce",
",",
"\"",
"\"",
")",
"\n",
"ce",
",",
"_",
"=",
"split",
"(",
"ce",
",",
"\"",
"\"",
")",
"\n",
"for",
"_",
",",
"c",
":=",
"range",
"charsets",
"{",
"if",
"ce",
"==",
"c",
"{",
"return",
"<mask>",
"\n",
"}",
"\n",
"}",
"\n\n",
"return",
"false",
"\n",
"}"
]
|
19,121 | all-19122 | [
"ExtractURL",
"extracts",
"all",
"cluster",
"state",
"and",
"marshalls",
"it",
"to",
"object",
"storage",
"."
]
| [
"func",
"(",
"c",
"APIClient",
")",
"ExtractURL",
"(",
"url",
"string",
")",
"error",
"{",
"extractClient",
",",
"err",
":=",
"c",
".",
"AdminAPIClient",
".",
"Extract",
"(",
"c",
".",
"Ctx",
"(",
")",
",",
"&",
"admin",
".",
"ExtractRequest",
"{",
"URL",
":",
"<mask>",
"}",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"grpcutil",
".",
"ScrubGRPC",
"(",
"err",
")",
"\n",
"}",
"\n",
"resp",
",",
"err",
":=",
"extractClient",
".",
"Recv",
"(",
")",
"\n",
"if",
"err",
"==",
"nil",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"resp",
")",
"\n",
"}",
"\n",
"if",
"err",
"!=",
"io",
".",
"EOF",
"{",
"return",
"err",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
]
|
19,122 | all-19123 | [
"Len",
"returns",
"the",
"number",
"of",
"values",
"in",
"the",
"range"
]
| [
"func",
"(",
"r",
"*",
"InclusiveRange",
")",
"Len",
"(",
")",
"int",
"{",
"if",
"r",
".",
"isLenCached",
"{",
"return",
"r",
".",
"cachedLen",
"\n",
"}",
"\n\n",
"// Offset by one to include the end value",
"diff",
":=",
"math",
".",
"Abs",
"(",
"float64",
"(",
"r",
".",
"end",
"-",
"r",
".",
"start",
")",
")",
"+",
"1",
"\n",
"r",
".",
"cachedLen",
"=",
"int",
"(",
"math",
".",
"Ceil",
"(",
"diff",
"/",
"math",
".",
"Abs",
"(",
"float64",
"(",
"r",
".",
"<mask>",
")",
")",
")",
")",
"\n",
"r",
".",
"isLenCached",
"=",
"true",
"\n",
"return",
"r",
".",
"cachedLen",
"\n",
"}"
]
|
19,123 | all-19124 | [
"tmpl",
"executes",
"the",
"given",
"template",
"text",
"on",
"data",
"writing",
"the",
"result",
"to",
"w",
"."
]
| [
"func",
"tmpl",
"(",
"w",
"io",
".",
"Writer",
",",
"text",
"string",
",",
"data",
"interface",
"{",
"}",
")",
"{",
"t",
":=",
"template",
".",
"New",
"(",
"\"",
"\"",
")",
"\n",
"t",
".",
"Funcs",
"(",
"<mask>",
".",
"FuncMap",
"{",
"\"",
"\"",
":",
"strings",
".",
"TrimSpace",
",",
"\"",
"\"",
":",
"capitalize",
",",
"}",
")",
"\n",
"template",
".",
"Must",
"(",
"t",
".",
"Parse",
"(",
"text",
")",
")",
"\n",
"ew",
":=",
"&",
"errWriter",
"{",
"w",
":",
"w",
"}",
"\n",
"err",
":=",
"t",
".",
"Execute",
"(",
"ew",
",",
"data",
")",
"\n",
"if",
"ew",
".",
"err",
"!=",
"nil",
"{",
"// I/O error writing; ignore write on closed pipe",
"if",
"strings",
".",
"Contains",
"(",
"ew",
".",
"err",
".",
"Error",
"(",
")",
",",
"\"",
"\"",
")",
"{",
"os",
".",
"Exit",
"(",
"1",
")",
"\n",
"}",
"\n",
"fatalf",
"(",
"\"",
"\"",
",",
"ew",
".",
"err",
")",
"\n",
"}",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"panic",
"(",
"err",
")",
"\n",
"}",
"\n",
"}"
]
|
19,124 | all-19125 | [
"Die",
"will",
"log",
"a",
"message",
"using",
"Fatal",
"call",
"ShutdownLoggers",
"and",
"then",
"exit",
"the",
"application",
"with",
"the",
"provided",
"exit",
"code",
"."
]
| [
"func",
"(",
"la",
"*",
"LogAdapter",
")",
"Die",
"(",
"exitCode",
"int",
",",
"msg",
"string",
")",
"{",
"la",
".",
"<mask>",
"(",
"LevelFatal",
",",
"nil",
",",
"msg",
")",
"\n",
"la",
".",
"base",
".",
"ShutdownLoggers",
"(",
")",
"\n",
"curExiter",
".",
"Exit",
"(",
"exitCode",
")",
"\n",
"}"
]
|
19,125 | all-19126 | [
"Info",
"calls",
"UI",
".",
"Info",
"to",
"write",
".",
"Useful",
"when",
"you",
"want",
"separate",
"colors",
"or",
"prefixes",
".",
"InfoFGColor",
"and",
"InfoBGColor",
"are",
"used",
"for",
"color",
"."
]
| [
"func",
"(",
"ui",
"*",
"ColorUI",
")",
"Info",
"(",
"message",
"string",
")",
"{",
"<mask>",
".",
"ChangeColor",
"(",
"ui",
".",
"InfoFGColor",
".",
"Code",
",",
"ui",
".",
"InfoFGColor",
".",
"Bright",
",",
"ui",
".",
"InfoBGColor",
".",
"Code",
",",
"ui",
".",
"InfoBGColor",
".",
"Bright",
")",
"\n",
"ui",
".",
"UI",
".",
"Info",
"(",
"message",
")",
"\n",
"ct",
".",
"ResetColor",
"(",
")",
"\n",
"}"
]
|
19,126 | all-19127 | [
"GetHostNameOk",
"returns",
"a",
"tuple",
"with",
"the",
"HostName",
"field",
"if",
"it",
"s",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"and",
"a",
"boolean",
"to",
"check",
"if",
"the",
"value",
"has",
"been",
"set",
"."
]
| [
"func",
"(",
"c",
"*",
"Check",
")",
"GetHostNameOk",
"(",
")",
"(",
"string",
",",
"bool",
")",
"{",
"if",
"c",
"==",
"nil",
"||",
"c",
".",
"HostName",
"==",
"nil",
"{",
"return",
"\"",
"\"",
",",
"<mask>",
"\n",
"}",
"\n",
"return",
"*",
"c",
".",
"HostName",
",",
"true",
"\n",
"}"
]
|
19,127 | all-19128 | [
"renderGTLDMap",
"fetches",
"the",
"ICANN",
"gTLD",
"data",
"filters",
"out",
"undelegated",
"entries",
"validates",
"the",
"remaining",
"entries",
"have",
"parseable",
"dates",
"and",
"renders",
"the",
"gTLDMapTemplate",
"to",
"the",
"provided",
"writer",
"using",
"the",
"validated",
"entries",
"(",
"or",
"returns",
"an",
"error",
"if",
"any",
"of",
"the",
"aforementioned",
"steps",
"fail",
")",
".",
"It",
"then",
"fetches",
"the",
"ICANN",
"TLD",
"data",
"and",
"uses",
"it",
"to",
"populate",
"any",
"missing",
"entries",
"for",
"ccTLDs",
".",
"These",
"entries",
"will",
"have",
"a",
"default",
"delegationDate",
"because",
"the",
"data",
"source",
"is",
"not",
"specific",
"enough",
"to",
"provide",
"one",
".",
"The",
"produced",
"output",
"text",
"is",
"a",
"Golang",
"source",
"code",
"file",
"in",
"the",
"util",
"package",
"that",
"contains",
"a",
"single",
"map",
"variable",
"containing",
"GTLDPeriod",
"objects",
"created",
"with",
"the",
"ICANN",
"data",
"."
]
| [
"func",
"renderGTLDMap",
"(",
"writer",
"io",
".",
"Writer",
")",
"error",
"{",
"// Get all of ICANN's gTLDs including ones that haven't been delegated.",
"allGTLDs",
",",
"err",
":=",
"getGTLDData",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"// Filter out the non-delegated gTLD entries",
"delegatedGTLDs",
":=",
"delegatedGTLDs",
"(",
"allGTLDs",
")",
"\n\n",
"// Validate that all of the delegated gTLDs have correct dates",
"if",
"err",
":=",
"validateGTLDs",
"(",
"delegatedGTLDs",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"// Get all of the TLDs. This data source doesn't provide delegationDates and",
"// so we only want to use it to populate missing entries in `delegatedGTLDs`,",
"// not to replace any existing entries that have more specific information",
"// about the validity period for the TLD.",
"allTLDs",
",",
"err",
":=",
"getTLDData",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"tldMap",
":=",
"make",
"(",
"map",
"[",
"string",
"]",
"util",
".",
"GTLDPeriod",
")",
"\n\n",
"// Deduplicate delegatedGTLDs into the tldMap first",
"for",
"_",
",",
"tld",
":=",
"range",
"delegatedGTLDs",
"{",
"tldMap",
"[",
"tld",
".",
"GTLD",
"]",
"=",
"tld",
"\n",
"}",
"\n\n",
"// Then populate any missing entries from the allTLDs list",
"for",
"_",
",",
"tld",
":=",
"range",
"allTLDs",
"{",
"if",
"_",
",",
"found",
":=",
"tldMap",
"[",
"tld",
".",
"GTLD",
"]",
";",
"!",
"found",
"{",
"tldMap",
"[",
"tld",
".",
"GTLD",
"]",
"=",
"tld",
"\n",
"}",
"\n",
"}",
"\n\n",
"templateData",
":=",
"struct",
"{",
"GTLDs",
"<mask>",
"[",
"string",
"]",
"util",
".",
"GTLDPeriod",
"\n",
"}",
"{",
"GTLDs",
":",
"tldMap",
",",
"}",
"\n\n",
"// Render the gTLD map to a buffer with the delegated gTLD data",
"var",
"buf",
"bytes",
".",
"Buffer",
"\n",
"if",
"err",
":=",
"gTLDMapTemplate",
".",
"Execute",
"(",
"&",
"buf",
",",
"templateData",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"// format the buffer so it won't trip up the `gofmt_test.go` checks",
"formatted",
",",
"err",
":=",
"format",
".",
"Source",
"(",
"buf",
".",
"Bytes",
"(",
")",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"// Write the formatted buffer to the writer",
"_",
",",
"err",
"=",
"writer",
".",
"Write",
"(",
"formatted",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
]
|
19,128 | all-19129 | [
"Use",
"adds",
"middleware",
"to",
"the",
"group",
"see",
"example",
"code",
"in",
"github",
"."
]
| [
"func",
"(",
"group",
"*",
"RouterGroup",
")",
"Use",
"(",
"middleware",
"...",
"RouterHandler",
")",
"IRoutes",
"{",
"group",
".",
"Handlers",
"=",
"append",
"(",
"<mask>",
".",
"Handlers",
",",
"middleware",
"...",
")",
"\n",
"return",
"group",
".",
"returnObj",
"(",
")",
"\n",
"}"
]
|
19,129 | all-19130 | [
"Tells",
"if",
"the",
"given",
"value",
"can",
"be",
"assigned",
"to",
"this",
"particular",
"Value",
"instance",
"."
]
| [
"func",
"(",
"v",
"*",
"Key",
")",
"validate",
"(",
"value",
"string",
")",
"error",
"{",
"validator",
":=",
"v",
".",
"Validator",
"\n",
"if",
"validator",
"==",
"nil",
"{",
"// Dummy validator",
"validator",
"=",
"func",
"(",
"string",
")",
"error",
"{",
"return",
"nil",
"}",
"\n",
"}",
"\n\n",
"// Handle unsetting",
"if",
"value",
"==",
"\"",
"\"",
"{",
"return",
"validator",
"(",
"v",
".",
"Default",
")",
"\n",
"}",
"\n\n",
"switch",
"v",
".",
"Type",
"{",
"case",
"String",
":",
"case",
"Bool",
":",
"if",
"!",
"shared",
".",
"StringInSlice",
"(",
"strings",
".",
"ToLower",
"(",
"value",
")",
",",
"booleans",
")",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"case",
"Int64",
":",
"_",
",",
"err",
":=",
"strconv",
".",
"ParseInt",
"(",
"value",
",",
"10",
",",
"64",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"<mask>",
":",
"panic",
"(",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"v",
".",
"Type",
")",
")",
"\n",
"}",
"\n\n",
"if",
"v",
".",
"Deprecated",
"!=",
"\"",
"\"",
"&&",
"value",
"!=",
"v",
".",
"Default",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"v",
".",
"Deprecated",
")",
"\n",
"}",
"\n\n",
"// Run external validation function",
"return",
"validator",
"(",
"value",
")",
"\n",
"}"
]
|
19,130 | all-19131 | [
"Fill",
"fills",
"the",
"paths",
"with",
"the",
"color",
"specified",
"by",
"SetFillColor"
]
| [
"func",
"(",
"gc",
"*",
"GraphicContext",
")",
"Fill",
"(",
"paths",
"...",
"*",
"draw2d",
".",
"<mask>",
")",
"{",
"gc",
".",
"drawPaths",
"(",
"filled",
",",
"paths",
"...",
")",
"\n",
"gc",
".",
"Current",
".",
"Path",
".",
"Clear",
"(",
")",
"\n",
"}"
]
|
19,131 | all-19132 | [
"AddNoValue",
"adds",
"only",
"key",
"as",
"argument",
"without",
"the",
"=",
".",
"Multiple",
"values",
"for",
"the",
"same",
"key",
"may",
"be",
"added",
"."
]
| [
"func",
"(",
"a",
"*",
"Args",
")",
"AddNoValue",
"(",
"key",
"string",
")",
"{",
"a",
".",
"args",
"=",
"appendArg",
"(",
"a",
".",
"args",
",",
"<mask>",
",",
"\"",
"\"",
",",
"argsNoValue",
")",
"\n",
"}"
]
|
19,132 | all-19133 | [
"WriteCustomAssets",
"writes",
"assets",
"to",
"a",
"custom",
"combination",
"of",
"object",
"-",
"store",
"and",
"persistent",
"disk",
"."
]
| [
"func",
"WriteCustomAssets",
"(",
"encoder",
"Encoder",
",",
"opts",
"*",
"AssetOpts",
",",
"args",
"[",
"]",
"string",
",",
"objectStoreBackend",
"string",
",",
"persistentDiskBackend",
"string",
",",
"secure",
",",
"isS3V2",
"bool",
")",
"error",
"{",
"switch",
"objectStoreBackend",
"{",
"case",
"\"",
"\"",
":",
"if",
"len",
"(",
"args",
")",
"!=",
"s3CustomArgs",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"s3CustomArgs",
")",
"\n",
"}",
"\n",
"volumeSize",
",",
"err",
":=",
"strconv",
".",
"Atoi",
"(",
"args",
"[",
"1",
"]",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"args",
"[",
"1",
"]",
")",
"\n",
"}",
"\n",
"<mask>",
"persistentDiskBackend",
"{",
"case",
"\"",
"\"",
":",
"if",
"err",
":=",
"WriteAssets",
"(",
"encoder",
",",
"opts",
",",
"minioBackend",
",",
"amazonBackend",
",",
"volumeSize",
",",
"\"",
"\"",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"case",
"\"",
"\"",
":",
"if",
"err",
":=",
"WriteAssets",
"(",
"encoder",
",",
"opts",
",",
"minioBackend",
",",
"googleBackend",
",",
"volumeSize",
",",
"\"",
"\"",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"case",
"\"",
"\"",
":",
"if",
"err",
":=",
"WriteAssets",
"(",
"encoder",
",",
"opts",
",",
"minioBackend",
",",
"microsoftBackend",
",",
"volumeSize",
",",
"\"",
"\"",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"default",
":",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"return",
"WriteSecret",
"(",
"encoder",
",",
"MinioSecret",
"(",
"args",
"[",
"2",
"]",
",",
"args",
"[",
"3",
"]",
",",
"args",
"[",
"4",
"]",
",",
"args",
"[",
"5",
"]",
",",
"secure",
",",
"isS3V2",
")",
",",
"opts",
")",
"\n",
"default",
":",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"}"
]
|
19,133 | all-19134 | [
"GetFontSizeOk",
"returns",
"a",
"tuple",
"with",
"the",
"FontSize",
"field",
"if",
"it",
"s",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"and",
"a",
"boolean",
"to",
"check",
"if",
"the",
"value",
"has",
"been",
"set",
"."
]
| [
"func",
"(",
"n",
"*",
"NoteDefinition",
")",
"GetFontSizeOk",
"(",
")",
"(",
"string",
",",
"bool",
")",
"{",
"if",
"n",
"==",
"nil",
"||",
"n",
".",
"FontSize",
"==",
"nil",
"{",
"return",
"\"",
"\"",
",",
"<mask>",
"\n",
"}",
"\n",
"return",
"*",
"n",
".",
"FontSize",
",",
"true",
"\n",
"}"
]
|
19,134 | all-19135 | [
"ProxyInstance",
"is",
"a",
"proxy",
"between",
"tsuru",
"and",
"the",
"service",
"instance",
".",
"This",
"method",
"allow",
"customized",
"service",
"instance",
"methods",
"."
]
| [
"func",
"ProxyInstance",
"(",
"instance",
"*",
"ServiceInstance",
",",
"path",
"string",
",",
"evt",
"*",
"event",
".",
"Event",
",",
"requestID",
"string",
",",
"w",
"http",
".",
"ResponseWriter",
",",
"r",
"*",
"http",
".",
"Request",
")",
"error",
"{",
"service",
",",
"err",
":=",
"Get",
"(",
"instance",
".",
"ServiceName",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"endpoint",
",",
"err",
":=",
"service",
".",
"getClient",
"(",
"\"",
"\"",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"prefix",
":=",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"<mask>",
".",
"GetIdentifier",
"(",
")",
")",
"\n",
"path",
"=",
"strings",
".",
"Trim",
"(",
"strings",
".",
"TrimPrefix",
"(",
"path",
"+",
"\"",
"\"",
",",
"prefix",
")",
",",
"\"",
"\"",
")",
"\n",
"for",
"_",
",",
"reserved",
":=",
"range",
"reservedProxyPaths",
"{",
"if",
"path",
"==",
"reserved",
"&&",
"r",
".",
"Method",
"!=",
"\"",
"\"",
"{",
"return",
"&",
"tsuruErrors",
".",
"ValidationError",
"{",
"Message",
":",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"r",
".",
"Method",
",",
"path",
")",
",",
"}",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"endpoint",
".",
"Proxy",
"(",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"prefix",
",",
"path",
")",
",",
"evt",
",",
"requestID",
",",
"w",
",",
"r",
")",
"\n",
"}"
]
|
19,135 | all-19136 | [
"SetShowExpanders",
"is",
"a",
"wrapper",
"around",
"gtk_tree_view_set_show_expanders",
"()",
"."
]
| [
"func",
"(",
"v",
"*",
"TreeView",
")",
"SetShowExpanders",
"(",
"<mask>",
"bool",
")",
"{",
"C",
".",
"gtk_tree_view_set_show_expanders",
"(",
"v",
".",
"native",
"(",
")",
",",
"gbool",
"(",
"show",
")",
")",
"\n",
"}"
]
|
19,136 | all-19137 | [
"https",
":",
"//",
"www",
".",
"kernel",
".",
"org",
"/",
"doc",
"/",
"Documentation",
"/",
"cgroups",
"/",
"cgroups",
".",
"txt"
]
| [
"func",
"FindCgroupMountpoint",
"(",
"subsystem",
"string",
")",
"(",
"string",
",",
"error",
")",
"{",
"f",
",",
"err",
":=",
"os",
".",
"Open",
"(",
"\"",
"\"",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"\"",
"\"",
",",
"err",
"\n",
"}",
"\n",
"scanner",
":=",
"bufio",
".",
"NewScanner",
"(",
"f",
")",
"\n",
"for",
"scanner",
".",
"Scan",
"(",
")",
"{",
"txt",
":=",
"scanner",
".",
"Text",
"(",
")",
"\n",
"fields",
":=",
"strings",
".",
"Split",
"(",
"txt",
",",
"\"",
"\"",
")",
"\n",
"for",
"_",
",",
"opt",
":=",
"range",
"strings",
".",
"Split",
"(",
"fields",
"[",
"len",
"(",
"<mask>",
")",
"-",
"1",
"]",
",",
"\"",
"\"",
")",
"{",
"if",
"opt",
"==",
"subsystem",
"{",
"return",
"fields",
"[",
"4",
"]",
",",
"nil",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n",
"if",
"err",
":=",
"scanner",
".",
"Err",
"(",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"\"",
"\"",
",",
"err",
"\n",
"}",
"\n\n",
"return",
"\"",
"\"",
",",
"NewNotFoundError",
"(",
"subsystem",
")",
"\n",
"}"
]
|
19,137 | all-19138 | [
"UnmarshalJSON",
"supports",
"json",
".",
"Unmarshaler",
"interface"
]
| [
"func",
"(",
"v",
"*",
"EmulateTouchFromMouseEventParams",
")",
"UnmarshalJSON",
"(",
"data",
"[",
"]",
"<mask>",
")",
"error",
"{",
"r",
":=",
"jlexer",
".",
"Lexer",
"{",
"Data",
":",
"data",
"}",
"\n",
"easyjsonC5a4559bDecodeGithubComChromedpCdprotoInput6",
"(",
"&",
"r",
",",
"v",
")",
"\n",
"return",
"r",
".",
"Error",
"(",
")",
"\n",
"}"
]
|
19,138 | all-19139 | [
"Command",
"line",
"client",
"entry",
"point",
"."
]
| [
"func",
"main",
"(",
")",
"{",
"app",
":=",
"kingpin",
".",
"New",
"(",
"\"",
"\"",
",",
"\"",
"\"",
")",
"\n",
"app",
".",
"Writer",
"(",
"os",
".",
"Stdout",
")",
"\n",
"app",
".",
"Version",
"(",
"VV",
")",
"\n\n",
"cmdLine",
",",
"err",
":=",
"ParseCommandLine",
"(",
"app",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"line",
":=",
"strings",
".",
"Join",
"(",
"os",
".",
"Args",
",",
"\"",
"\"",
")",
"\n",
"PrintFatal",
"(",
"\"",
"\"",
",",
"line",
",",
"err",
".",
"Error",
"(",
")",
")",
"\n",
"}",
"\n\n",
"resp",
",",
"err",
":=",
"ExecuteCommand",
"(",
"app",
",",
"cmdLine",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"PrintFatal",
"(",
"\"",
"\"",
",",
"err",
".",
"<mask>",
"(",
")",
")",
"\n",
"}",
"\n",
"if",
"resp",
"==",
"nil",
"{",
"return",
"// No results, just exit (e.g. setup, printed help...)",
"\n",
"}",
"\n\n",
"var",
"notExactlyOneError",
"bool",
"\n",
"displayer",
",",
"err",
":=",
"NewDisplayer",
"(",
"resp",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"PrintFatal",
"(",
"\"",
"\"",
",",
"err",
".",
"Error",
"(",
")",
")",
"\n",
"}",
"\n",
"if",
"resp",
".",
"StatusCode",
"<",
"200",
"||",
"resp",
".",
"StatusCode",
">",
"299",
"{",
"// Let user know if something went wrong",
"fmt",
".",
"Fprintln",
"(",
"errOut",
",",
"resp",
".",
"Status",
")",
"\n",
"if",
"len",
"(",
"displayer",
".",
"body",
")",
">",
"0",
"{",
"fmt",
".",
"Fprintln",
"(",
"errOut",
",",
"displayer",
".",
"body",
")",
"\n",
"}",
"\n",
"}",
"else",
"if",
"cmdLine",
".",
"ExtractOneSelect",
"!=",
"\"",
"\"",
"{",
"err",
"=",
"displayer",
".",
"ApplySingleExtract",
"(",
"cmdLine",
".",
"ExtractOneSelect",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"notExactlyOneError",
"=",
"strings",
".",
"Contains",
"(",
"err",
".",
"Error",
"(",
")",
",",
"\"",
"\"",
")",
"// Ugh, there has to be a better way",
"\n",
"PrintError",
"(",
"err",
".",
"Error",
"(",
")",
")",
"\n",
"}",
"\n",
"fmt",
".",
"Fprint",
"(",
"out",
",",
"displayer",
".",
"Output",
"(",
")",
")",
"\n",
"}",
"else",
"{",
"if",
"cmdLine",
".",
"ExtractSelector",
"!=",
"\"",
"\"",
"{",
"err",
"=",
"displayer",
".",
"ApplyExtract",
"(",
"cmdLine",
".",
"ExtractSelector",
",",
"false",
")",
"\n",
"}",
"else",
"if",
"cmdLine",
".",
"ExtractSelectorJSON",
"!=",
"\"",
"\"",
"{",
"err",
"=",
"displayer",
".",
"ApplyExtract",
"(",
"cmdLine",
".",
"ExtractSelectorJSON",
",",
"true",
")",
"\n",
"}",
"else",
"if",
"cmdLine",
".",
"ExtractHeader",
"!=",
"\"",
"\"",
"{",
"err",
"=",
"displayer",
".",
"ApplyHeaderExtract",
"(",
"cmdLine",
".",
"ExtractHeader",
")",
"\n",
"}",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"PrintFatal",
"(",
"\"",
"\"",
",",
"err",
".",
"Error",
"(",
")",
")",
"\n",
"}",
"else",
"if",
"cmdLine",
".",
"Pretty",
"{",
"displayer",
".",
"Pretty",
"(",
")",
"\n",
"}",
"\n",
"fmt",
".",
"Fprint",
"(",
"out",
",",
"displayer",
".",
"Output",
"(",
")",
")",
"\n",
"}",
"\n",
"// Figure out exit code",
"exitStatus",
":=",
"0",
"\n",
"switch",
"{",
"case",
"notExactlyOneError",
":",
"exitStatus",
"=",
"6",
"\n",
"case",
"resp",
".",
"StatusCode",
"==",
"401",
":",
"exitStatus",
"=",
"1",
"\n",
"case",
"resp",
".",
"StatusCode",
"==",
"403",
":",
"exitStatus",
"=",
"3",
"\n",
"case",
"resp",
".",
"StatusCode",
"==",
"404",
":",
"exitStatus",
"=",
"4",
"\n",
"case",
"resp",
".",
"StatusCode",
">",
"399",
"&&",
"resp",
".",
"StatusCode",
"<",
"500",
":",
"exitStatus",
"=",
"2",
"\n",
"case",
"resp",
".",
"StatusCode",
">",
"499",
":",
"exitStatus",
"=",
"5",
"\n",
"}",
"\n",
"//fmt.Fprintf(os.Stderr, \"exitStatus=%d\\n\", exitStatus)",
"osExit",
"(",
"exitStatus",
")",
"\n",
"}"
]
|
19,139 | all-19140 | [
"SetFocusChild",
"is",
"a",
"wrapper",
"around",
"gtk_container_set_focus_child",
"()",
"."
]
| [
"func",
"(",
"v",
"*",
"<mask>",
")",
"SetFocusChild",
"(",
"child",
"IWidget",
")",
"{",
"C",
".",
"gtk_container_set_focus_child",
"(",
"v",
".",
"native",
"(",
")",
",",
"child",
".",
"toWidget",
"(",
")",
")",
"\n",
"}"
]
|
19,140 | all-19141 | [
"PackEnd",
"()",
"is",
"a",
"wrapper",
"around",
"gtk_tree_view_column_pack_end",
"()",
"."
]
| [
"func",
"(",
"v",
"*",
"TreeViewColumn",
")",
"PackEnd",
"(",
"<mask>",
"ICellRenderer",
",",
"expand",
"bool",
")",
"{",
"C",
".",
"gtk_tree_view_column_pack_end",
"(",
"v",
".",
"native",
"(",
")",
",",
"cell",
".",
"toCellRenderer",
"(",
")",
",",
"gbool",
"(",
"expand",
")",
")",
"\n",
"}"
]
|
19,141 | all-19142 | [
"Get",
"a",
"port",
"given",
"a",
"URL"
]
| [
"func",
"getPort",
"(",
"rawURL",
"string",
")",
"int",
"{",
"parsedURL",
",",
"err",
":=",
"url",
".",
"Parse",
"(",
"rawURL",
")",
"\n",
"if",
"err",
"==",
"nil",
"{",
"splitHost",
":=",
"strings",
".",
"Split",
"(",
"parsedURL",
".",
"Host",
",",
"\"",
"\"",
")",
"\n",
"if",
"len",
"(",
"splitHost",
")",
"==",
"2",
"{",
"<mask>",
",",
"err",
":=",
"strconv",
".",
"Atoi",
"(",
"splitHost",
"[",
"1",
"]",
")",
"\n",
"if",
"err",
"==",
"nil",
"{",
"return",
"port",
"\n",
"}",
"\n",
"}",
"\n",
"if",
"parsedURL",
".",
"Scheme",
"==",
"\"",
"\"",
"{",
"return",
"443",
"\n",
"}",
"\n",
"return",
"80",
"\n",
"}",
"\n\n",
"return",
"-",
"1",
"\n",
"}"
]
|
19,142 | all-19143 | [
"UserPreferenceInfoLocator",
"builds",
"a",
"locator",
"from",
"the",
"given",
"href",
"."
]
| [
"func",
"(",
"api",
"*",
"API",
")",
"UserPreferenceInfoLocator",
"(",
"href",
"string",
")",
"*",
"UserPreferenceInfoLocator",
"{",
"<mask>",
"&",
"UserPreferenceInfoLocator",
"{",
"Href",
"(",
"href",
")",
",",
"api",
"}",
"\n",
"}"
]
|
19,143 | all-19144 | [
"ReadTag",
"gets",
"an",
"object",
"by",
"tag",
"and",
"returns",
"it",
"directly",
"as",
"[]",
"byte",
"."
]
| [
"func",
"(",
"c",
"APIClient",
")",
"ReadTag",
"(",
"tag",
"string",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"var",
"<mask>",
"bytes",
".",
"Buffer",
"\n",
"if",
"err",
":=",
"c",
".",
"GetTag",
"(",
"tag",
",",
"&",
"buffer",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"return",
"buffer",
".",
"Bytes",
"(",
")",
",",
"nil",
"\n",
"}"
]
|
19,144 | all-19145 | [
"MarshalJSON",
"supports",
"json",
".",
"Marshaler",
"interface"
]
| [
"func",
"(",
"v",
"GetResourceTreeReturns",
")",
"MarshalJSON",
"(",
")",
"(",
"[",
"]",
"<mask>",
",",
"error",
")",
"{",
"w",
":=",
"jwriter",
".",
"Writer",
"{",
"}",
"\n",
"easyjsonC5a4559bEncodeGithubComChromedpCdprotoPage30",
"(",
"&",
"w",
",",
"v",
")",
"\n",
"return",
"w",
".",
"Buffer",
".",
"BuildBytes",
"(",
")",
",",
"w",
".",
"Error",
"\n",
"}"
]
|
19,145 | all-19146 | [
"getChangedFiles",
"returns",
"all",
"the",
"changed",
"files",
"for",
"the",
"provided",
"pull",
"request",
"."
]
| [
"func",
"getChangedFiles",
"(",
"gc",
"githubClient",
",",
"org",
",",
"repo",
"string",
",",
"number",
"int",
")",
"(",
"[",
"]",
"string",
",",
"error",
")",
"{",
"changes",
",",
"err",
":=",
"gc",
".",
"GetPullRequestChanges",
"(",
"org",
",",
"repo",
",",
"<mask>",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"org",
",",
"repo",
",",
"number",
")",
"\n",
"}",
"\n",
"var",
"filenames",
"[",
"]",
"string",
"\n",
"for",
"_",
",",
"change",
":=",
"range",
"changes",
"{",
"filenames",
"=",
"append",
"(",
"filenames",
",",
"change",
".",
"Filename",
")",
"\n",
"}",
"\n",
"return",
"filenames",
",",
"nil",
"\n",
"}"
]
|
19,146 | all-19147 | [
"NewPageIterator",
"returns",
"a",
"PageIterator",
"that",
"can",
"be",
"used",
"to",
"iterate",
"through",
"values",
".",
"Call",
"Next",
"()",
"to",
"get",
"the",
"first",
"page",
"of",
"values",
"(",
"and",
"again",
"to",
"get",
"subsequent",
"pages",
")",
".",
"If",
"there",
"are",
"no",
"more",
"results",
"NoMoreResults",
"is",
"returned",
"."
]
| [
"func",
"NewPageIterator",
"(",
"client",
"*",
"Client",
",",
"data",
"url",
".",
"Values",
",",
"pathPart",
"string",
")",
"*",
"PageIterator",
"{",
"return",
"&",
"PageIterator",
"{",
"data",
":",
"data",
",",
"client",
":",
"client",
",",
"count",
":",
"0",
",",
"nextPageURI",
":",
"<mask>",
".",
"NullString",
"{",
"}",
",",
"pathPart",
":",
"pathPart",
",",
"}",
"\n",
"}"
]
|
19,147 | all-19148 | [
"ResolveTask",
"resolves",
"the",
"api",
"task",
"object",
"given",
"container",
"id",
"."
]
| [
"func",
"(",
"resolver",
"*",
"DockerContainerMetadataResolver",
")",
"ResolveTask",
"(",
"dockerID",
"string",
")",
"(",
"*",
"apitask",
".",
"<mask>",
",",
"error",
")",
"{",
"if",
"resolver",
".",
"dockerTaskEngine",
"==",
"nil",
"{",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"task",
",",
"found",
":=",
"resolver",
".",
"dockerTaskEngine",
".",
"State",
"(",
")",
".",
"TaskByID",
"(",
"dockerID",
")",
"\n",
"if",
"!",
"found",
"{",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"dockerID",
")",
"\n",
"}",
"\n\n",
"return",
"task",
",",
"nil",
"\n",
"}"
]
|
19,148 | all-19149 | [
"This",
"function",
"increments",
"the",
"call",
"count",
"for",
"a",
"specific",
"API",
"call",
"This",
"is",
"invoked",
"at",
"the",
"API",
"call",
"s",
"start",
"whereas",
"the",
"duration",
"metrics",
"are",
"updated",
"at",
"the",
"API",
"call",
"s",
"end",
"."
]
| [
"func",
"(",
"gm",
"*",
"GenericMetrics",
")",
"IncrementCallCount",
"(",
"callName",
"string",
")",
"{",
"defer",
"func",
"(",
")",
"{",
"if",
"r",
":=",
"recover",
"(",
")",
";",
"r",
"!=",
"nil",
"{",
"seelog",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"callName",
",",
"r",
")",
"\n",
"}",
"\n",
"}",
"(",
")",
"\n",
"gm",
".",
"lock",
".",
"Lock",
"(",
")",
"\n",
"defer",
"gm",
".",
"<mask>",
".",
"Unlock",
"(",
")",
"\n",
"gm",
".",
"counterVec",
".",
"WithLabelValues",
"(",
"callName",
")",
".",
"Inc",
"(",
")",
"\n",
"}"
]
|
19,149 | all-19150 | [
"delete",
"transform",
"feedback",
"objects"
]
| [
"func",
"DeleteTransformFeedbacks",
"(",
"n",
"int32",
",",
"<mask>",
"*",
"uint32",
")",
"{",
"C",
".",
"glowDeleteTransformFeedbacks",
"(",
"gpDeleteTransformFeedbacks",
",",
"(",
"C",
".",
"GLsizei",
")",
"(",
"n",
")",
",",
"(",
"*",
"C",
".",
"GLuint",
")",
"(",
"unsafe",
".",
"Pointer",
"(",
"ids",
")",
")",
")",
"\n",
"}"
]
|
19,150 | all-19151 | [
"parseLocation",
"parses",
"the",
"input",
"string",
"performs",
"some",
"sanity",
"checks",
"and",
"returns",
"the",
"sanitized",
"input",
"string",
".",
"An",
"error",
"is",
"returned",
"if",
"the",
"input",
"string",
"is",
"empty",
"or",
"if",
"contains",
"an",
"http",
"{",
"s",
"}",
":",
"//",
"prefix",
"."
]
| [
"func",
"parseLocation",
"(",
"input",
"string",
")",
"(",
"string",
",",
"error",
")",
"{",
"trimmed",
":=",
"strings",
".",
"TrimRight",
"(",
"input",
",",
"\"",
"\"",
")",
"\n\n",
"if",
"trimmed",
"==",
"\"",
"\"",
"{",
"return",
"\"",
"\"",
",",
"&",
"InvalidRegistries",
"{",
"s",
":",
"\"",
"\"",
"}",
"\n",
"}",
"\n\n",
"if",
"strings",
".",
"HasPrefix",
"(",
"trimmed",
",",
"\"",
"\"",
")",
"||",
"strings",
".",
"HasPrefix",
"(",
"trimmed",
",",
"\"",
"\"",
")",
"{",
"<mask>",
":=",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"input",
")",
"\n",
"return",
"\"",
"\"",
",",
"&",
"InvalidRegistries",
"{",
"s",
":",
"msg",
"}",
"\n",
"}",
"\n\n",
"return",
"trimmed",
",",
"nil",
"\n",
"}"
]
|
19,151 | all-19152 | [
"UnmarshalJSON",
"supports",
"json",
".",
"Unmarshaler",
"interface"
]
| [
"func",
"(",
"v",
"*",
"ReleaseObjectGroupParams",
")",
"UnmarshalJSON",
"(",
"data",
"[",
"]",
"byte",
")",
"error",
"{",
"r",
":=",
"jlexer",
".",
"Lexer",
"{",
"Data",
":",
"<mask>",
"}",
"\n",
"easyjsonC5a4559bDecodeGithubComChromedpCdprotoRuntime11",
"(",
"&",
"r",
",",
"v",
")",
"\n",
"return",
"r",
".",
"Error",
"(",
")",
"\n",
"}"
]
|
19,152 | all-19153 | [
"ApplyChanges",
"applies",
"a",
"given",
"set",
"of",
"changes",
"in",
"a",
"given",
"zone",
"."
]
| [
"func",
"(",
"p",
"*",
"CloudFlareProvider",
")",
"ApplyChanges",
"(",
"changes",
"*",
"<mask>",
".",
"Changes",
")",
"error",
"{",
"proxiedByDefault",
":=",
"p",
".",
"proxiedByDefault",
"\n\n",
"combinedChanges",
":=",
"make",
"(",
"[",
"]",
"*",
"cloudFlareChange",
",",
"0",
",",
"len",
"(",
"changes",
".",
"Create",
")",
"+",
"len",
"(",
"changes",
".",
"UpdateNew",
")",
"+",
"len",
"(",
"changes",
".",
"Delete",
")",
")",
"\n\n",
"combinedChanges",
"=",
"append",
"(",
"combinedChanges",
",",
"newCloudFlareChanges",
"(",
"cloudFlareCreate",
",",
"changes",
".",
"Create",
",",
"proxiedByDefault",
")",
"...",
")",
"\n",
"combinedChanges",
"=",
"append",
"(",
"combinedChanges",
",",
"newCloudFlareChanges",
"(",
"cloudFlareUpdate",
",",
"changes",
".",
"UpdateNew",
",",
"proxiedByDefault",
")",
"...",
")",
"\n",
"combinedChanges",
"=",
"append",
"(",
"combinedChanges",
",",
"newCloudFlareChanges",
"(",
"cloudFlareDelete",
",",
"changes",
".",
"Delete",
",",
"proxiedByDefault",
")",
"...",
")",
"\n\n",
"return",
"p",
".",
"submitChanges",
"(",
"combinedChanges",
")",
"\n",
"}"
]
|
19,153 | all-19154 | [
"InFill",
"is",
"a",
"wrapper",
"around",
"cairo_in_fill",
"()",
"."
]
| [
"func",
"(",
"v",
"*",
"<mask>",
")",
"InFill",
"(",
"x",
",",
"y",
"float64",
")",
"bool",
"{",
"c",
":=",
"C",
".",
"cairo_in_fill",
"(",
"v",
".",
"native",
"(",
")",
",",
"C",
".",
"double",
"(",
"x",
")",
",",
"C",
".",
"double",
"(",
"y",
")",
")",
"\n",
"return",
"gobool",
"(",
"c",
")",
"\n",
"}"
]
|
19,154 | all-19155 | [
"$",
"{",
"LXD_DIR",
"}",
"/",
"storage",
"-",
"pools",
"/",
"<pool",
">",
"/",
"containers",
"-",
"snapshots",
"/",
"<snapshot_name",
">"
]
| [
"func",
"getSnapshotMountPoint",
"(",
"project",
",",
"poolName",
"string",
",",
"snapshotName",
"string",
")",
"string",
"{",
"return",
"shared",
".",
"VarPath",
"(",
"\"",
"\"",
",",
"poolName",
",",
"\"",
"\"",
",",
"projectPrefix",
"(",
"<mask>",
",",
"snapshotName",
")",
")",
"\n",
"}"
]
|
19,155 | all-19156 | [
"Returns",
"new",
"Path",
"with",
"flipped",
"y",
"axes"
]
| [
"func",
"(",
"path",
"*",
"Path",
")",
"VerticalFlip",
"(",
")",
"*",
"Path",
"{",
"p",
":=",
"path",
".",
"Copy",
"(",
")",
"\n",
"j",
":=",
"0",
"\n",
"for",
"_",
",",
"cmd",
":=",
"range",
"p",
".",
"Components",
"{",
"switch",
"cmd",
"{",
"case",
"MoveToCmp",
",",
"LineToCmp",
":",
"p",
".",
"Points",
"[",
"j",
"+",
"1",
"]",
"=",
"-",
"p",
".",
"Points",
"[",
"j",
"+",
"1",
"]",
"\n",
"j",
"=",
"j",
"+",
"2",
"\n",
"case",
"QuadCurveToCmp",
":",
"p",
".",
"Points",
"[",
"j",
"+",
"1",
"]",
"=",
"-",
"p",
".",
"Points",
"[",
"j",
"+",
"1",
"]",
"\n",
"p",
".",
"Points",
"[",
"j",
"+",
"3",
"]",
"=",
"-",
"p",
".",
"Points",
"[",
"j",
"+",
"3",
"]",
"\n",
"j",
"=",
"j",
"+",
"4",
"\n",
"case",
"CubicCurveToCmp",
":",
"p",
".",
"Points",
"[",
"j",
"+",
"1",
"]",
"=",
"-",
"p",
".",
"Points",
"[",
"j",
"+",
"1",
"]",
"\n",
"p",
".",
"Points",
"[",
"j",
"+",
"3",
"]",
"=",
"-",
"p",
".",
"Points",
"[",
"j",
"+",
"3",
"]",
"\n",
"p",
".",
"Points",
"[",
"j",
"+",
"5",
"]",
"=",
"-",
"p",
".",
"Points",
"[",
"j",
"+",
"5",
"]",
"\n",
"j",
"=",
"j",
"+",
"6",
"\n",
"<mask>",
"ArcToCmp",
":",
"p",
".",
"Points",
"[",
"j",
"+",
"1",
"]",
"=",
"-",
"p",
".",
"Points",
"[",
"j",
"+",
"1",
"]",
"\n",
"p",
".",
"Points",
"[",
"j",
"+",
"3",
"]",
"=",
"-",
"p",
".",
"Points",
"[",
"j",
"+",
"3",
"]",
"\n",
"p",
".",
"Points",
"[",
"j",
"+",
"4",
"]",
"=",
"-",
"p",
".",
"Points",
"[",
"j",
"+",
"4",
"]",
"// start angle",
"\n",
"p",
".",
"Points",
"[",
"j",
"+",
"5",
"]",
"=",
"-",
"p",
".",
"Points",
"[",
"j",
"+",
"5",
"]",
"// angle",
"\n",
"j",
"=",
"j",
"+",
"6",
"\n",
"case",
"CloseCmp",
":",
"}",
"\n",
"}",
"\n",
"p",
".",
"y",
"=",
"-",
"p",
".",
"y",
"\n",
"return",
"p",
"\n",
"}"
]
|
19,156 | all-19157 | [
"Helper",
"around",
"the",
"low",
"-",
"level",
"DB",
"API",
"which",
"also",
"updates",
"the",
"driver",
"names",
"cache",
"."
]
| [
"func",
"dbStoragePoolCreateAndUpdateCache",
"(",
"db",
"*",
"db",
".",
"Cluster",
",",
"poolName",
"string",
",",
"poolDescription",
"string",
",",
"poolDriver",
"string",
",",
"poolConfig",
"map",
"[",
"string",
"]",
"string",
")",
"(",
"int64",
",",
"error",
")",
"{",
"<mask>",
",",
"err",
":=",
"db",
".",
"StoragePoolCreate",
"(",
"poolName",
",",
"poolDescription",
",",
"poolDriver",
",",
"poolConfig",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"id",
",",
"err",
"\n",
"}",
"\n\n",
"// Update the storage drivers cache in api_1.0.go.",
"storagePoolDriversCacheUpdate",
"(",
"db",
")",
"\n\n",
"return",
"id",
",",
"nil",
"\n",
"}"
]
|
19,157 | all-19158 | [
"AddColorStopRGBA",
"is",
"a",
"wrapper",
"around",
"cairo_pattern_add_color_stop_rgba",
"()",
"."
]
| [
"func",
"(",
"v",
"*",
"Pattern",
")",
"AddColorStopRGBA",
"(",
"offset",
",",
"red",
",",
"green",
",",
"blue",
",",
"alpha",
"float64",
")",
"error",
"{",
"C",
".",
"cairo_pattern_add_color_stop_rgba",
"(",
"v",
".",
"native",
"(",
")",
",",
"C",
".",
"double",
"(",
"offset",
")",
",",
"C",
".",
"double",
"(",
"red",
")",
",",
"C",
".",
"double",
"(",
"green",
")",
",",
"C",
".",
"double",
"(",
"blue",
")",
",",
"C",
".",
"double",
"(",
"alpha",
")",
")",
"\n",
"return",
"v",
".",
"<mask>",
"(",
")",
".",
"ToError",
"(",
")",
"\n",
"}"
]
|
19,158 | all-19159 | [
"NewRelayer",
"constructs",
"a",
"Relayer",
"."
]
| [
"func",
"NewRelayer",
"(",
"ch",
"*",
"Channel",
",",
"conn",
"*",
"Connection",
")",
"*",
"Relayer",
"{",
"r",
":=",
"&",
"Relayer",
"{",
"relayHost",
":",
"ch",
".",
"RelayHost",
"(",
")",
",",
"maxTimeout",
":",
"ch",
".",
"relayMaxTimeout",
",",
"localHandler",
":",
"ch",
".",
"relayLocal",
",",
"outbound",
":",
"newRelayItems",
"(",
"conn",
".",
"log",
".",
"WithFields",
"(",
"LogField",
"{",
"\"",
"\"",
",",
"\"",
"\"",
"}",
")",
")",
",",
"inbound",
":",
"newRelayItems",
"(",
"conn",
".",
"log",
".",
"WithFields",
"(",
"LogField",
"{",
"\"",
"\"",
",",
"\"",
"\"",
"}",
")",
")",
",",
"peers",
":",
"ch",
".",
"RootPeers",
"(",
")",
",",
"conn",
":",
"conn",
",",
"relayConn",
":",
"&",
"relay",
".",
"Conn",
"{",
"RemoteAddr",
":",
"<mask>",
".",
"conn",
".",
"RemoteAddr",
"(",
")",
".",
"String",
"(",
")",
",",
"RemoteProcessName",
":",
"conn",
".",
"RemotePeerInfo",
"(",
")",
".",
"ProcessName",
",",
"IsOutbound",
":",
"conn",
".",
"connDirection",
"==",
"outbound",
",",
"}",
",",
"logger",
":",
"conn",
".",
"log",
",",
"}",
"\n",
"r",
".",
"timeouts",
"=",
"newRelayTimerPool",
"(",
"r",
".",
"timeoutRelayItem",
",",
"ch",
".",
"relayTimerVerify",
")",
"\n",
"return",
"r",
"\n",
"}"
]
|
19,159 | all-19160 | [
"Execute",
"-",
"updates",
"spaces"
]
| [
"func",
"(",
"c",
"*",
"UpdateSpacesCommand",
")",
"Execute",
"(",
"[",
"]",
"string",
")",
"error",
"{",
"var",
"cfMgmt",
"*",
"CFMgmt",
"\n",
"<mask>",
"err",
"error",
"\n",
"if",
"cfMgmt",
",",
"err",
"=",
"InitializePeekManagers",
"(",
"c",
".",
"BaseCFConfigCommand",
",",
"c",
".",
"Peek",
")",
";",
"err",
"==",
"nil",
"{",
"err",
"=",
"cfMgmt",
".",
"SpaceManager",
".",
"UpdateSpaces",
"(",
")",
"\n",
"}",
"\n",
"return",
"err",
"\n",
"}"
]
|
19,160 | all-19161 | [
"BackOffDelay",
"is",
"a",
"DelayType",
"which",
"increases",
"delay",
"between",
"consecutive",
"retries"
]
| [
"func",
"BackOffDelay",
"(",
"n",
"uint",
",",
"config",
"*",
"Config",
")",
"time",
".",
"Duration",
"{",
"return",
"config",
".",
"<mask>",
"*",
"(",
"1",
"<<",
"(",
"n",
"-",
"1",
")",
")",
"\n",
"}"
]
|
19,161 | all-19162 | [
"/",
"*",
"I",
"also",
"don",
"t",
"see",
"that",
"golang",
"exports",
"an",
"API",
"to",
"get",
"at",
"the",
"underlying",
"FD",
"but",
"we",
"need",
"it",
"to",
"get",
"at",
"SO_PEERCRED",
"so",
"let",
"s",
"grab",
"it",
"."
]
| [
"func",
"extractUnderlyingFd",
"(",
"unixConnPtr",
"*",
"net",
".",
"UnixConn",
")",
"(",
"int",
",",
"error",
")",
"{",
"<mask>",
":=",
"reflect",
".",
"Indirect",
"(",
"reflect",
".",
"ValueOf",
"(",
"unixConnPtr",
")",
")",
"\n\n",
"netFdPtr",
":=",
"conn",
".",
"FieldByName",
"(",
"\"",
"\"",
")",
"\n",
"if",
"!",
"netFdPtr",
".",
"IsValid",
"(",
")",
"{",
"return",
"-",
"1",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"netFd",
":=",
"reflect",
".",
"Indirect",
"(",
"netFdPtr",
")",
"\n\n",
"fd",
":=",
"netFd",
".",
"FieldByName",
"(",
"\"",
"\"",
")",
"\n",
"if",
"!",
"fd",
".",
"IsValid",
"(",
")",
"{",
"// Try under the new name",
"pfdPtr",
":=",
"netFd",
".",
"FieldByName",
"(",
"\"",
"\"",
")",
"\n",
"if",
"!",
"pfdPtr",
".",
"IsValid",
"(",
")",
"{",
"return",
"-",
"1",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"pfd",
":=",
"reflect",
".",
"Indirect",
"(",
"pfdPtr",
")",
"\n\n",
"fd",
"=",
"pfd",
".",
"FieldByName",
"(",
"\"",
"\"",
")",
"\n",
"if",
"!",
"fd",
".",
"IsValid",
"(",
")",
"{",
"return",
"-",
"1",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"}",
"\n\n",
"return",
"int",
"(",
"fd",
".",
"Int",
"(",
")",
")",
",",
"nil",
"\n",
"}"
]
|
19,162 | all-19163 | [
"createOCIRef",
"creates",
"the",
"oci",
"reference",
"of",
"the",
"image"
]
| [
"func",
"createOCIRef",
"(",
"image",
"string",
")",
"(",
"tempDirOCIRef",
",",
"error",
")",
"{",
"dir",
",",
"err",
":=",
"ioutil",
".",
"TempDir",
"(",
"tmpdir",
".",
"TemporaryDirectoryForBigFiles",
"(",
")",
",",
"\"",
"\"",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"tempDirOCIRef",
"{",
"}",
",",
"errors",
".",
"Wrapf",
"(",
"err",
",",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"ociRef",
",",
"err",
":=",
"ocilayout",
".",
"NewReference",
"(",
"dir",
",",
"<mask>",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"tempDirOCIRef",
"{",
"}",
",",
"err",
"\n",
"}",
"\n\n",
"tempDirRef",
":=",
"tempDirOCIRef",
"{",
"tempDirectory",
":",
"dir",
",",
"ociRefExtracted",
":",
"ociRef",
"}",
"\n",
"return",
"tempDirRef",
",",
"nil",
"\n",
"}"
]
|
19,163 | all-19164 | [
"GetSRVService",
"generates",
"a",
"SRV",
"service",
"including",
"an",
"optional",
"suffix",
"."
]
| [
"func",
"GetSRVService",
"(",
"service",
",",
"serviceName",
"string",
",",
"scheme",
"string",
")",
"(",
"SRVService",
"string",
")",
"{",
"if",
"scheme",
"==",
"\"",
"\"",
"{",
"<mask>",
"=",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"service",
")",
"\n",
"}",
"\n\n",
"if",
"serviceName",
"!=",
"\"",
"\"",
"{",
"return",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"service",
",",
"serviceName",
")",
"\n",
"}",
"\n",
"return",
"service",
"\n",
"}"
]
|
19,164 | all-19165 | [
"RateLimiter",
"creates",
"a",
"ratelimiting",
"queue",
"for",
"a",
"given",
"prow",
"controller",
"."
]
| [
"func",
"RateLimiter",
"(",
"controllerName",
"string",
")",
"workqueue",
".",
"RateLimitingInterface",
"{",
"rl",
":=",
"workqueue",
".",
"NewMaxOfRateLimiter",
"(",
"workqueue",
".",
"NewItemExponentialFailureRateLimiter",
"(",
"5",
"*",
"time",
".",
"Millisecond",
",",
"120",
"*",
"time",
".",
"Second",
")",
",",
"&",
"workqueue",
".",
"BucketRateLimiter",
"{",
"Limiter",
":",
"rate",
".",
"NewLimiter",
"(",
"<mask>",
".",
"Limit",
"(",
"1000",
")",
",",
"50000",
")",
"}",
",",
")",
"\n",
"return",
"workqueue",
".",
"NewNamedRateLimitingQueue",
"(",
"rl",
",",
"controllerName",
")",
"\n",
"}"
]
|
19,165 | all-19166 | [
"New",
"returns",
"a",
"BlobInfoCache",
"implementation",
"which",
"is",
"in",
"-",
"memory",
"only",
".",
"This",
"is",
"primarily",
"intended",
"for",
"tests",
"but",
"also",
"used",
"as",
"a",
"fallback",
"if",
"blobinfocache",
".",
"DefaultCache",
"can’t",
"determine",
"or",
"set",
"up",
"the",
"location",
"for",
"a",
"persistent",
"cache",
".",
"Most",
"users",
"should",
"use",
"blobinfocache",
".",
"DefaultCache",
".",
"instead",
"of",
"calling",
"this",
"directly",
".",
"Manual",
"users",
"of",
"types",
".",
"{",
"ImageSource",
"ImageDestination",
"}",
"might",
"also",
"use",
"this",
"instead",
"of",
"a",
"persistent",
"cache",
"."
]
| [
"func",
"New",
"(",
")",
"types",
".",
"BlobInfoCache",
"{",
"return",
"&",
"cache",
"{",
"uncompressedDigests",
":",
"map",
"[",
"digest",
".",
"Digest",
"]",
"digest",
".",
"Digest",
"{",
"}",
",",
"digestsByUncompressed",
":",
"map",
"[",
"digest",
".",
"Digest",
"]",
"map",
"[",
"digest",
".",
"Digest",
"]",
"struct",
"{",
"}",
"{",
"}",
",",
"knownLocations",
":",
"map",
"[",
"locationKey",
"]",
"<mask>",
"[",
"types",
".",
"BICLocationReference",
"]",
"time",
".",
"Time",
"{",
"}",
",",
"}",
"\n",
"}"
]
|
19,166 | all-19167 | [
"Encode",
"writes",
"the",
"YAML",
"encoding",
"of",
"v",
"to",
"the",
"stream",
".",
"If",
"multiple",
"items",
"are",
"encoded",
"to",
"the",
"stream",
"the",
"second",
"and",
"subsequent",
"document",
"will",
"be",
"preceded",
"with",
"a",
"---",
"document",
"separator",
"but",
"the",
"first",
"will",
"not",
".",
"See",
"the",
"documentation",
"for",
"Marshal",
"for",
"details",
"about",
"the",
"conversion",
"of",
"Go",
"values",
"to",
"YAML",
"."
]
| [
"func",
"(",
"e",
"*",
"Encoder",
")",
"Encode",
"(",
"v",
"<mask>",
"{",
"}",
")",
"(",
"err",
"error",
")",
"{",
"defer",
"handleErr",
"(",
"&",
"err",
")",
"\n",
"e",
".",
"encoder",
".",
"marshalDoc",
"(",
"\"",
"\"",
",",
"reflect",
".",
"ValueOf",
"(",
"v",
")",
")",
"\n",
"return",
"nil",
"\n",
"}"
]
|
19,167 | all-19168 | [
"/",
"*",
"btrfsSnapshot",
"creates",
"a",
"snapshot",
"of",
"source",
"to",
"dest",
"the",
"result",
"will",
"be",
"readonly",
"if",
"readonly",
"is",
"True",
"."
]
| [
"func",
"btrfsSnapshot",
"(",
"source",
"string",
",",
"dest",
"string",
",",
"readonly",
"bool",
")",
"error",
"{",
"var",
"output",
"string",
"\n",
"var",
"err",
"error",
"\n",
"if",
"readonly",
"{",
"output",
",",
"err",
"=",
"shared",
".",
"RunCommand",
"(",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"source",
",",
"dest",
")",
"\n",
"}",
"else",
"{",
"<mask>",
",",
"err",
"=",
"shared",
".",
"RunCommand",
"(",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"source",
",",
"dest",
")",
"\n",
"}",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"source",
",",
"dest",
",",
"output",
",",
")",
"\n",
"}",
"\n\n",
"return",
"err",
"\n",
"}"
]
|
19,168 | all-19169 | [
"UnmarshalEasyJSON",
"satisfies",
"easyjson",
".",
"Unmarshaler",
"."
]
| [
"func",
"(",
"t",
"*",
"KeyType",
")",
"UnmarshalEasyJSON",
"(",
"in",
"*",
"jlexer",
".",
"Lexer",
")",
"{",
"switch",
"KeyType",
"(",
"in",
".",
"String",
"(",
")",
")",
"{",
"case",
"KeyTypeNumber",
":",
"*",
"t",
"=",
"KeyTypeNumber",
"\n",
"case",
"KeyTypeString",
":",
"*",
"t",
"=",
"KeyTypeString",
"\n",
"case",
"KeyTypeDate",
":",
"*",
"t",
"=",
"KeyTypeDate",
"\n",
"case",
"KeyTypeArray",
":",
"*",
"t",
"=",
"KeyTypeArray",
"\n\n",
"<mask>",
":",
"in",
".",
"AddError",
"(",
"errors",
".",
"New",
"(",
"\"",
"\"",
")",
")",
"\n",
"}",
"\n",
"}"
]
|
19,169 | all-19170 | [
"Zones",
"returns",
"the",
"list",
"of",
"hosted",
"zones",
"."
]
| [
"func",
"(",
"p",
"*",
"GoogleProvider",
")",
"Zones",
"(",
")",
"(",
"map",
"[",
"string",
"]",
"*",
"dns",
".",
"ManagedZone",
",",
"error",
")",
"{",
"zones",
":=",
"make",
"(",
"map",
"[",
"string",
"]",
"*",
"dns",
".",
"ManagedZone",
")",
"\n\n",
"f",
":=",
"func",
"(",
"resp",
"*",
"dns",
".",
"ManagedZonesListResponse",
")",
"error",
"{",
"for",
"_",
",",
"zone",
":=",
"range",
"resp",
".",
"ManagedZones",
"{",
"if",
"p",
".",
"domainFilter",
".",
"Match",
"(",
"zone",
".",
"DnsName",
")",
"&&",
"p",
".",
"zoneIDFilter",
".",
"Match",
"(",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"zone",
".",
"Id",
")",
")",
"{",
"zones",
"[",
"zone",
".",
"Name",
"]",
"=",
"zone",
"\n",
"log",
".",
"Debugf",
"(",
"\"",
"\"",
",",
"zone",
".",
"DnsName",
",",
"zone",
".",
"Name",
")",
"\n",
"}",
"else",
"{",
"log",
".",
"Debugf",
"(",
"\"",
"\"",
",",
"zone",
".",
"DnsName",
",",
"zone",
".",
"Name",
")",
"\n",
"}",
"\n",
"}",
"\n\n",
"return",
"nil",
"\n",
"}",
"\n\n",
"log",
".",
"Debugf",
"(",
"\"",
"\"",
",",
"p",
".",
"domainFilter",
".",
"filters",
")",
"\n",
"if",
"err",
":=",
"p",
".",
"managedZonesClient",
".",
"List",
"(",
"p",
".",
"project",
")",
".",
"Pages",
"(",
"context",
".",
"TODO",
"(",
")",
",",
"f",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"if",
"len",
"(",
"zones",
")",
"==",
"0",
"{",
"if",
"p",
".",
"domainFilter",
".",
"IsConfigured",
"(",
")",
"{",
"log",
".",
"Warnf",
"(",
"\"",
"\"",
",",
"p",
".",
"project",
",",
"p",
".",
"domainFilter",
".",
"filters",
")",
"\n",
"}",
"else",
"{",
"<mask>",
".",
"Warnf",
"(",
"\"",
"\"",
",",
"p",
".",
"project",
")",
"\n",
"}",
"\n",
"}",
"\n\n",
"for",
"_",
",",
"zone",
":=",
"range",
"zones",
"{",
"log",
".",
"Debugf",
"(",
"\"",
"\"",
",",
"zone",
".",
"Name",
",",
"zone",
".",
"DnsName",
")",
"\n",
"}",
"\n\n",
"return",
"zones",
",",
"nil",
"\n",
"}"
]
|
19,170 | all-19171 | [
"SetDouble",
"is",
"a",
"wrapper",
"around",
"g_settings_set_double",
"()",
"."
]
| [
"func",
"(",
"v",
"*",
"Settings",
")",
"SetDouble",
"(",
"<mask>",
"string",
",",
"value",
"float64",
")",
"bool",
"{",
"cstr1",
":=",
"(",
"*",
"C",
".",
"gchar",
")",
"(",
"C",
".",
"CString",
"(",
"name",
")",
")",
"\n",
"defer",
"C",
".",
"free",
"(",
"unsafe",
".",
"Pointer",
"(",
"cstr1",
")",
")",
"\n\n",
"return",
"gobool",
"(",
"C",
".",
"g_settings_set_double",
"(",
"v",
".",
"native",
"(",
")",
",",
"cstr1",
",",
"C",
".",
"gdouble",
"(",
"value",
")",
")",
")",
"\n",
"}"
]
|
19,171 | all-19172 | [
"GetLegendSizeOk",
"returns",
"a",
"tuple",
"with",
"the",
"LegendSize",
"field",
"if",
"it",
"s",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"and",
"a",
"boolean",
"to",
"check",
"if",
"the",
"value",
"has",
"been",
"set",
"."
]
| [
"func",
"(",
"t",
"*",
"TimeseriesDefinition",
")",
"GetLegendSizeOk",
"(",
")",
"(",
"string",
",",
"bool",
")",
"{",
"if",
"t",
"==",
"nil",
"||",
"t",
".",
"LegendSize",
"==",
"nil",
"{",
"return",
"\"",
"\"",
",",
"<mask>",
"\n",
"}",
"\n",
"return",
"*",
"t",
".",
"LegendSize",
",",
"true",
"\n",
"}"
]
|
19,172 | all-19173 | [
"TODO",
":",
"allows",
"record",
"type",
"change",
"which",
"might",
"not",
"be",
"supported",
"by",
"all",
"dns",
"providers"
]
| [
"func",
"(",
"t",
"planTable",
")",
"getUpdates",
"(",
")",
"(",
"updateNew",
"[",
"]",
"*",
"endpoint",
".",
"Endpoint",
",",
"updateOld",
"[",
"]",
"*",
"endpoint",
".",
"Endpoint",
")",
"{",
"for",
"_",
",",
"row",
":=",
"<mask>",
"t",
".",
"rows",
"{",
"if",
"row",
".",
"current",
"!=",
"nil",
"&&",
"len",
"(",
"row",
".",
"candidates",
")",
">",
"0",
"{",
"//dns name is taken",
"update",
":=",
"t",
".",
"resolver",
".",
"ResolveUpdate",
"(",
"row",
".",
"current",
",",
"row",
".",
"candidates",
")",
"\n",
"// compare \"update\" to \"current\" to figure out if actual update is required",
"if",
"shouldUpdateTTL",
"(",
"update",
",",
"row",
".",
"current",
")",
"||",
"targetChanged",
"(",
"update",
",",
"row",
".",
"current",
")",
"||",
"shouldUpdateProviderSpecific",
"(",
"update",
",",
"row",
".",
"current",
")",
"{",
"inheritOwner",
"(",
"row",
".",
"current",
",",
"update",
")",
"\n",
"updateNew",
"=",
"append",
"(",
"updateNew",
",",
"update",
")",
"\n",
"updateOld",
"=",
"append",
"(",
"updateOld",
",",
"row",
".",
"current",
")",
"\n",
"}",
"\n",
"continue",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"\n",
"}"
]
|
19,173 | all-19174 | [
"PrintDefaultConfig",
"..."
]
| [
"func",
"PrintDefaultConfig",
"(",
")",
"error",
"{",
"cfg",
":=",
"NewConfig",
"(",
")",
"\n",
"buf",
":=",
"<mask>",
"(",
"bytes",
".",
"Buffer",
")",
"\n\n",
"if",
"cfg",
".",
"Logging",
"==",
"nil",
"{",
"cfg",
".",
"Logging",
"=",
"make",
"(",
"[",
"]",
"zapwriter",
".",
"Config",
",",
"0",
")",
"\n",
"}",
"\n\n",
"if",
"len",
"(",
"cfg",
".",
"Logging",
")",
"==",
"0",
"{",
"cfg",
".",
"Logging",
"=",
"append",
"(",
"cfg",
".",
"Logging",
",",
"NewLoggingConfig",
"(",
")",
")",
"\n",
"}",
"\n\n",
"encoder",
":=",
"toml",
".",
"NewEncoder",
"(",
"buf",
")",
"\n",
"encoder",
".",
"Indent",
"=",
"\"",
"\"",
"\n\n",
"if",
"err",
":=",
"encoder",
".",
"Encode",
"(",
"cfg",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"fmt",
".",
"Print",
"(",
"buf",
".",
"String",
"(",
")",
")",
"\n",
"return",
"nil",
"\n",
"}"
]
|
19,174 | all-19175 | [
"SupportsShapes",
"()",
"is",
"a",
"wrapper",
"around",
"gdk_display_supports_shapes",
"()",
"."
]
| [
"func",
"(",
"v",
"*",
"Display",
")",
"SupportsShapes",
"(",
")",
"bool",
"{",
"c",
":=",
"C",
".",
"gdk_display_supports_shapes",
"(",
"v",
".",
"native",
"(",
")",
")",
"\n",
"<mask>",
"gobool",
"(",
"c",
")",
"\n",
"}"
]
|
19,175 | all-19176 | [
"Handle",
"satisfies",
"hookHandler",
"."
]
| [
"func",
"(",
"t",
"TravisHook",
")",
"Handle",
"(",
"w",
"http",
".",
"ResponseWriter",
",",
"r",
"*",
"http",
".",
"Request",
",",
"repo",
"*",
"Repo",
")",
"(",
"int",
",",
"error",
")",
"{",
"if",
"r",
".",
"Method",
"!=",
"\"",
"\"",
"{",
"return",
"http",
".",
"StatusMethodNotAllowed",
",",
"errors",
".",
"New",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"if",
"err",
":=",
"t",
".",
"handleSignature",
"(",
"r",
",",
"repo",
".",
"Hook",
".",
"Secret",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"http",
".",
"StatusBadRequest",
",",
"err",
"\n",
"}",
"\n",
"if",
"err",
":=",
"r",
".",
"ParseForm",
"(",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"http",
".",
"StatusBadRequest",
",",
"err",
"\n",
"}",
"\n",
"payload",
":=",
"r",
".",
"FormValue",
"(",
"\"",
"\"",
")",
"\n",
"if",
"payload",
"==",
"\"",
"\"",
"{",
"return",
"http",
".",
"StatusBadRequest",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"data",
":=",
"&",
"travisPayload",
"{",
"}",
"\n",
"if",
"err",
":=",
"json",
".",
"Unmarshal",
"(",
"[",
"]",
"byte",
"(",
"payload",
")",
",",
"data",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"http",
".",
"StatusBadRequest",
",",
"err",
"\n",
"}",
"\n\n",
"// ignored webhooks",
"err",
":=",
"hookIgnoredError",
"{",
"hookType",
":",
"hookName",
"(",
"t",
")",
"}",
"\n",
"if",
"data",
".",
"Type",
"!=",
"\"",
"\"",
"||",
"data",
".",
"StatusMessage",
"!=",
"\"",
"\"",
"{",
"err",
".",
"err",
"=",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
")",
"\n",
"return",
"200",
",",
"err",
"\n",
"}",
"\n",
"if",
"repo",
".",
"Branch",
"!=",
"\"",
"\"",
"&&",
"data",
".",
"Branch",
"!=",
"repo",
".",
"Branch",
"{",
"err",
".",
"err",
"=",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"data",
".",
"Branch",
")",
"\n",
"return",
"200",
",",
"err",
"\n",
"}",
"\n\n",
"// attempt pull",
"if",
"err",
":=",
"repo",
".",
"Pull",
"(",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"http",
".",
"StatusInternalServerError",
",",
"err",
"\n",
"}",
"\n",
"if",
"err",
":=",
"repo",
".",
"checkoutCommit",
"(",
"<mask>",
".",
"Commit",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"http",
".",
"StatusInternalServerError",
",",
"err",
"\n",
"}",
"\n",
"return",
"200",
",",
"nil",
"\n",
"}"
]
|
19,176 | all-19177 | [
"RetryWithBackoffCtx",
"takes",
"a",
"context",
"a",
"Backoff",
"and",
"a",
"function",
"to",
"call",
"that",
"returns",
"an",
"error",
"If",
"the",
"context",
"is",
"done",
"nil",
"will",
"be",
"returned",
"If",
"the",
"error",
"is",
"nil",
"then",
"the",
"function",
"will",
"no",
"longer",
"be",
"called",
"If",
"the",
"error",
"is",
"Retriable",
"then",
"that",
"will",
"be",
"used",
"to",
"determine",
"if",
"it",
"should",
"be",
"retried"
]
| [
"func",
"RetryWithBackoffCtx",
"(",
"ctx",
"context",
".",
"Context",
",",
"backoff",
"Backoff",
",",
"fn",
"func",
"(",
")",
"error",
")",
"error",
"{",
"var",
"err",
"error",
"\n",
"for",
"{",
"select",
"{",
"<mask>",
"<-",
"ctx",
".",
"Done",
"(",
")",
":",
"return",
"nil",
"\n",
"default",
":",
"}",
"\n\n",
"err",
"=",
"fn",
"(",
")",
"\n\n",
"retriableErr",
",",
"isRetriableErr",
":=",
"err",
".",
"(",
"apierrors",
".",
"Retriable",
")",
"\n\n",
"if",
"err",
"==",
"nil",
"||",
"(",
"isRetriableErr",
"&&",
"!",
"retriableErr",
".",
"Retry",
"(",
")",
")",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"_time",
".",
"Sleep",
"(",
"backoff",
".",
"Duration",
"(",
")",
")",
"\n",
"}",
"\n",
"}"
]
|
19,177 | all-19178 | [
"FilterFieldByName",
"returns",
"the",
"field",
"with",
"the",
"given",
"name",
"if",
"that",
"field",
"can",
"be",
"used",
"as",
"query",
"filter",
"an",
"error",
"otherwise",
"."
]
| [
"func",
"(",
"m",
"*",
"Mapping",
")",
"FilterFieldByName",
"(",
"name",
"string",
")",
"(",
"*",
"Field",
",",
"error",
")",
"{",
"<mask>",
":=",
"m",
".",
"FieldByName",
"(",
"name",
")",
"\n",
"if",
"field",
"==",
"nil",
"{",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"name",
")",
"\n",
"}",
"\n\n",
"if",
"field",
".",
"Type",
".",
"Code",
"!=",
"TypeColumn",
"{",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"name",
")",
"\n",
"}",
"\n\n",
"return",
"field",
",",
"nil",
"\n",
"}"
]
|
19,178 | all-19179 | [
"SetFilename",
"is",
"a",
"wrapper",
"around",
"gtk_file_chooser_set_filename",
"()",
"."
]
| [
"func",
"(",
"v",
"*",
"FileChooser",
")",
"SetFilename",
"(",
"filename",
"string",
")",
"bool",
"{",
"cstr",
":=",
"C",
".",
"CString",
"(",
"<mask>",
")",
"\n",
"defer",
"C",
".",
"free",
"(",
"unsafe",
".",
"Pointer",
"(",
"cstr",
")",
")",
"\n",
"c",
":=",
"C",
".",
"gtk_file_chooser_set_filename",
"(",
"v",
".",
"native",
"(",
")",
",",
"cstr",
")",
"\n",
"return",
"gobool",
"(",
"c",
")",
"\n",
"}"
]
|
19,179 | all-19180 | [
"/",
"*"
]
| [
"func",
"FileSequence_New",
"(",
"frange",
"*",
"C",
".",
"char",
")",
"(",
"FileSeqId",
",",
"<mask>",
")",
"{",
"fs",
",",
"e",
":=",
"fileseq",
".",
"NewFileSequence",
"(",
"C",
".",
"GoString",
"(",
"frange",
")",
")",
"\n",
"if",
"e",
"!=",
"nil",
"{",
"// err string is freed by caller",
"return",
"0",
",",
"C",
".",
"CString",
"(",
"e",
".",
"Error",
"(",
")",
")",
"\n",
"}",
"\n\n",
"id",
":=",
"sFileSeqs",
".",
"Add",
"(",
"fs",
")",
"\n",
"return",
"id",
",",
"nil",
"\n",
"}"
]
|
19,180 | all-19181 | [
"title",
":",
"user",
"list",
"path",
":",
"/",
"users",
"method",
":",
"GET",
"produce",
":",
"application",
"/",
"json",
"responses",
":",
"200",
":",
"OK",
"401",
":",
"Unauthorized"
]
| [
"func",
"listUsers",
"(",
"w",
"http",
".",
"ResponseWriter",
",",
"r",
"*",
"http",
".",
"Request",
",",
"t",
"auth",
".",
"Token",
")",
"error",
"{",
"userEmail",
":=",
"r",
".",
"URL",
".",
"Query",
"(",
")",
".",
"Get",
"(",
"\"",
"\"",
")",
"\n",
"roleName",
":=",
"r",
".",
"URL",
".",
"Query",
"(",
")",
".",
"Get",
"(",
"\"",
"\"",
")",
"\n",
"contextValue",
":=",
"r",
".",
"URL",
".",
"Query",
"(",
")",
".",
"Get",
"(",
"\"",
"\"",
")",
"\n",
"users",
",",
"err",
":=",
"auth",
".",
"ListUsers",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"apiUsers",
":=",
"make",
"(",
"[",
"]",
"apiUser",
",",
"0",
",",
"len",
"(",
"users",
")",
")",
"\n",
"roleMap",
":=",
"make",
"(",
"map",
"[",
"string",
"]",
"*",
"permission",
".",
"Role",
")",
"\n",
"includeAll",
":=",
"permission",
".",
"Check",
"(",
"t",
",",
"permission",
".",
"PermUserUpdate",
")",
"\n",
"perms",
",",
"err",
":=",
"t",
".",
"Permissions",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"for",
"_",
",",
"user",
":=",
"range",
"users",
"{",
"usrData",
",",
"err",
":=",
"createAPIUser",
"(",
"perms",
",",
"&",
"user",
",",
"roleMap",
",",
"includeAll",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"if",
"usrData",
"==",
"nil",
"{",
"continue",
"\n",
"}",
"\n",
"if",
"userEmail",
"==",
"\"",
"\"",
"&&",
"roleName",
"==",
"\"",
"\"",
"{",
"apiUsers",
"=",
"append",
"(",
"apiUsers",
",",
"*",
"usrData",
")",
"\n",
"}",
"\n",
"if",
"userEmail",
"!=",
"\"",
"\"",
"&&",
"usrData",
".",
"Email",
"==",
"userEmail",
"{",
"apiUsers",
"=",
"append",
"(",
"apiUsers",
",",
"*",
"usrData",
")",
"\n",
"}",
"\n",
"if",
"roleName",
"!=",
"\"",
"\"",
"{",
"for",
"_",
",",
"role",
":=",
"range",
"usrData",
".",
"Roles",
"{",
"if",
"role",
".",
"Name",
"==",
"roleName",
"{",
"if",
"contextValue",
"!=",
"\"",
"\"",
"&&",
"role",
".",
"ContextValue",
"==",
"contextValue",
"{",
"apiUsers",
"=",
"append",
"(",
"apiUsers",
",",
"*",
"usrData",
")",
"\n",
"<mask>",
"\n",
"}",
"\n",
"if",
"contextValue",
"==",
"\"",
"\"",
"{",
"apiUsers",
"=",
"append",
"(",
"apiUsers",
",",
"*",
"usrData",
")",
"\n",
"break",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n",
"if",
"len",
"(",
"apiUsers",
")",
"==",
"0",
"{",
"if",
"contextValue",
"!=",
"\"",
"\"",
"{",
"return",
"&",
"errors",
".",
"HTTP",
"{",
"Code",
":",
"http",
".",
"StatusNotFound",
",",
"Message",
":",
"\"",
"\"",
"}",
"\n",
"}",
"\n",
"user",
",",
"err",
":=",
"auth",
".",
"ConvertNewUser",
"(",
"t",
".",
"User",
"(",
")",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"perm",
",",
"err",
":=",
"user",
".",
"Permissions",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"userData",
",",
"err",
":=",
"createAPIUser",
"(",
"perm",
",",
"user",
",",
"nil",
",",
"true",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"apiUsers",
"=",
"append",
"(",
"apiUsers",
",",
"*",
"userData",
")",
"\n",
"}",
"\n",
"w",
".",
"Header",
"(",
")",
".",
"Add",
"(",
"\"",
"\"",
",",
"\"",
"\"",
")",
"\n",
"return",
"json",
".",
"NewEncoder",
"(",
"w",
")",
".",
"Encode",
"(",
"apiUsers",
")",
"\n",
"}"
]
|
19,181 | all-19182 | [
"UnmarshalJSON",
"supports",
"json",
".",
"Unmarshaler",
"interface"
]
| [
"func",
"(",
"v",
"*",
"CompileScriptParams",
")",
"UnmarshalJSON",
"(",
"data",
"[",
"]",
"byte",
")",
"error",
"{",
"r",
":=",
"jlexer",
".",
"Lexer",
"{",
"Data",
":",
"<mask>",
"}",
"\n",
"easyjsonC5a4559bDecodeGithubComChromedpCdprotoRuntime45",
"(",
"&",
"r",
",",
"v",
")",
"\n",
"return",
"r",
".",
"Error",
"(",
")",
"\n",
"}"
]
|
19,182 | all-19183 | [
"NewVBoxManager",
"creates",
"a",
"VBoxManager",
"instance",
"."
]
| [
"func",
"NewVBoxManager",
"(",
")",
"*",
"VBoxCmdManager",
"{",
"return",
"&",
"VBoxCmdManager",
"{",
"runCmd",
":",
"func",
"(",
"cmd",
"*",
"<mask>",
".",
"Cmd",
")",
"error",
"{",
"return",
"cmd",
".",
"Run",
"(",
")",
"}",
",",
"}",
"\n",
"}"
]
|
19,183 | all-19184 | [
"/",
"*",
"Get3D",
"return",
"a",
"specific",
"element",
"from",
"a",
"3",
"-",
"dimensional",
"matrix",
"."
]
| [
"func",
"(",
"img",
"*",
"IplImage",
")",
"Get3D",
"(",
"x",
",",
"y",
",",
"z",
"int",
")",
"Scalar",
"{",
"ret",
":=",
"C",
".",
"cvGet3D",
"(",
"unsafe",
".",
"Pointer",
"(",
"img",
")",
",",
"C",
".",
"int",
"(",
"z",
")",
",",
"C",
".",
"int",
"(",
"y",
")",
",",
"C",
".",
"int",
"(",
"x",
")",
")",
"\n",
"return",
"Scalar",
"(",
"<mask>",
")",
"\n",
"}"
]
|
19,184 | all-19185 | [
"ZoomAll",
"zooms",
"to",
"the",
"maximum",
"extent",
"."
]
| [
"func",
"(",
"m",
"*",
"<mask>",
")",
"ZoomAll",
"(",
")",
"error",
"{",
"if",
"C",
".",
"mapnik_map_zoom_all",
"(",
"m",
".",
"m",
")",
"!=",
"0",
"{",
"return",
"m",
".",
"lastError",
"(",
")",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
]
|
19,185 | all-19186 | [
"GetSystemErrorCode",
"returns",
"the",
"code",
"to",
"report",
"for",
"the",
"given",
"error",
".",
"If",
"the",
"error",
"is",
"a",
"SystemError",
"we",
"can",
"get",
"the",
"code",
"directly",
".",
"Otherwise",
"treat",
"it",
"as",
"an",
"unexpected",
"error"
]
| [
"func",
"GetSystemErrorCode",
"(",
"err",
"error",
")",
"SystemErrCode",
"{",
"if",
"err",
"==",
"nil",
"{",
"return",
"ErrCodeInvalid",
"\n",
"}",
"\n\n",
"if",
"se",
",",
"ok",
":=",
"err",
".",
"(",
"SystemError",
")",
";",
"<mask>",
"{",
"return",
"se",
".",
"Code",
"(",
")",
"\n",
"}",
"\n\n",
"return",
"ErrCodeUnexpected",
"\n",
"}"
]
|
19,186 | all-19187 | [
"classifyLabels",
"will",
"put",
"labels",
"into",
"the",
"required",
"archaic",
"dead",
"maps",
"as",
"appropriate",
"."
]
| [
"func",
"classifyLabels",
"(",
"labels",
"[",
"]",
"Label",
",",
"required",
",",
"archaic",
",",
"dead",
"map",
"[",
"string",
"]",
"Label",
",",
"now",
"time",
".",
"Time",
",",
"parent",
"*",
"Label",
")",
"(",
"map",
"[",
"string",
"]",
"Label",
",",
"map",
"[",
"string",
"]",
"Label",
",",
"map",
"[",
"string",
"]",
"Label",
")",
"{",
"newRequired",
":=",
"copyLabelMap",
"(",
"required",
")",
"\n",
"newArchaic",
":=",
"copyLabelMap",
"(",
"archaic",
")",
"\n",
"newDead",
":=",
"copyLabelMap",
"(",
"dead",
")",
"\n",
"for",
"i",
",",
"l",
":=",
"range",
"labels",
"{",
"first",
":=",
"parent",
"\n",
"if",
"first",
"==",
"nil",
"{",
"first",
"=",
"&",
"labels",
"[",
"i",
"]",
"\n",
"}",
"\n",
"lower",
":=",
"strings",
".",
"ToLower",
"(",
"l",
".",
"Name",
")",
"\n",
"switch",
"{",
"case",
"parent",
"==",
"nil",
"&&",
"l",
".",
"DeleteAfter",
"==",
"nil",
":",
"// Live label",
"newRequired",
"[",
"lower",
"]",
"=",
"l",
"\n",
"case",
"l",
".",
"DeleteAfter",
"!=",
"nil",
"&&",
"<mask>",
".",
"After",
"(",
"*",
"l",
".",
"DeleteAfter",
")",
":",
"newDead",
"[",
"lower",
"]",
"=",
"l",
"\n",
"case",
"parent",
"!=",
"nil",
":",
"l",
".",
"parent",
"=",
"parent",
"\n",
"newArchaic",
"[",
"lower",
"]",
"=",
"l",
"\n",
"}",
"\n",
"newRequired",
",",
"newArchaic",
",",
"newDead",
"=",
"classifyLabels",
"(",
"l",
".",
"Previously",
",",
"newRequired",
",",
"newArchaic",
",",
"newDead",
",",
"now",
",",
"first",
")",
"\n",
"}",
"\n",
"return",
"newRequired",
",",
"newArchaic",
",",
"newDead",
"\n",
"}"
]
|
19,187 | all-19188 | [
"TimeoutCloser",
"returns",
"an",
"io",
".",
"Closer",
"that",
"wraps",
"the",
"passed",
"-",
"in",
"io",
".",
"Closer",
".",
"If",
"the",
"underlying",
"Closer",
"fails",
"to",
"close",
"within",
"the",
"alloted",
"timeout",
"ErrTimeout",
"is",
"returned",
"."
]
| [
"func",
"TimeoutCloser",
"(",
"c",
"<mask>",
".",
"Closer",
",",
"timeout",
"time",
".",
"Duration",
")",
"io",
".",
"Closer",
"{",
"return",
"timeoutReaderWriterCloser",
"{",
"c",
":",
"c",
",",
"d",
":",
"timeout",
"}",
"\n",
"}"
]
|
19,188 | all-19189 | [
"tagsFromField",
"returns",
"a",
"slice",
"of",
"option",
"strings",
"."
]
| [
"func",
"(",
"db",
"*",
"<mask>",
")",
"tagsFromField",
"(",
"field",
"*",
"reflect",
".",
"StructField",
")",
"(",
"options",
"[",
"]",
"string",
")",
"{",
"if",
"db",
".",
"hasSkipTag",
"(",
"field",
")",
"{",
"return",
"nil",
"\n",
"}",
"\n",
"for",
"_",
",",
"tag",
":=",
"range",
"strings",
".",
"Split",
"(",
"field",
".",
"Tag",
".",
"Get",
"(",
"dbTag",
")",
",",
"\"",
"\"",
")",
"{",
"if",
"t",
":=",
"strings",
".",
"ToLower",
"(",
"strings",
".",
"TrimSpace",
"(",
"tag",
")",
")",
";",
"t",
"!=",
"\"",
"\"",
"{",
"options",
"=",
"append",
"(",
"options",
",",
"t",
")",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"options",
"\n",
"}"
]
|
19,189 | all-19190 | [
"Record",
"the",
"status",
"code",
"."
]
| [
"func",
"(",
"w",
"*",
"recorderResponseWriter",
")",
"WriteHeader",
"(",
"code",
"int",
")",
"{",
"w",
".",
"ResponseWriter",
".",
"WriteHeader",
"(",
"code",
")",
"\n",
"if",
"w",
".",
"wroteHeader",
"{",
"return",
"\n",
"}",
"\n",
"w",
".",
"statusCode",
"=",
"code",
"\n",
"w",
".",
"wroteHeader",
"=",
"<mask>",
"\n",
"}"
]
|
19,190 | all-19191 | [
"NewSTMRepeatable",
"is",
"deprecated",
"."
]
| [
"func",
"NewSTMRepeatable",
"(",
"ctx",
"context",
".",
"<mask>",
",",
"c",
"*",
"v3",
".",
"Client",
",",
"apply",
"func",
"(",
"STM",
")",
"error",
")",
"(",
"*",
"v3",
".",
"TxnResponse",
",",
"error",
")",
"{",
"return",
"NewSTM",
"(",
"c",
",",
"apply",
",",
"WithAbortContext",
"(",
"ctx",
")",
",",
"WithIsolation",
"(",
"RepeatableReads",
")",
")",
"\n",
"}"
]
|
19,191 | all-19192 | [
"Error",
"returns",
"an",
"error",
"message",
"of",
"a",
"given",
"error",
"."
]
| [
"func",
"(",
"e",
"Error",
")",
"Error",
"(",
")",
"string",
"{",
"if",
"msg",
",",
"ok",
":=",
"<mask>",
"(",
"e",
")",
";",
"ok",
"{",
"return",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"msg",
",",
"e",
")",
"\n",
"}",
"\n",
"return",
"\"",
"\"",
"\n",
"}"
]
|
19,192 | all-19193 | [
"checkInclude",
"will",
"check",
"if",
"the",
"type",
"is",
"an",
"included",
"type",
"and",
"if",
"so",
"return",
"the",
"state",
"and",
"type",
"from",
"the",
"state",
"for",
"that",
"file",
"."
]
| [
"func",
"(",
"s",
"*",
"State",
")",
"checkInclude",
"(",
"thriftType",
"*",
"parser",
".",
"Type",
")",
"(",
"*",
"State",
",",
"*",
"parser",
".",
"Type",
",",
"*",
"Include",
")",
"{",
"parts",
":=",
"strings",
".",
"SplitN",
"(",
"thriftType",
".",
"Name",
",",
"\"",
"\"",
",",
"2",
")",
"\n",
"if",
"len",
"(",
"parts",
")",
"<",
"2",
"{",
"return",
"nil",
",",
"nil",
",",
"nil",
"\n",
"}",
"\n\n",
"newType",
":=",
"*",
"thriftType",
"\n",
"newType",
".",
"Name",
"=",
"parts",
"[",
"1",
"]",
"\n\n",
"include",
":=",
"s",
".",
"includes",
"[",
"parts",
"[",
"0",
"]",
"]",
"\n",
"state",
":=",
"s",
".",
"all",
"[",
"include",
".",
"<mask>",
"]",
"\n",
"return",
"state",
".",
"global",
",",
"&",
"newType",
",",
"include",
"\n",
"}"
]
|
19,193 | all-19194 | [
"Do",
"executes",
"Page",
".",
"startScreencast",
"against",
"the",
"provided",
"context",
"."
]
| [
"func",
"(",
"p",
"*",
"StartScreencastParams",
")",
"Do",
"(",
"ctx",
"context",
".",
"<mask>",
")",
"(",
"err",
"error",
")",
"{",
"return",
"cdp",
".",
"Execute",
"(",
"ctx",
",",
"CommandStartScreencast",
",",
"p",
",",
"nil",
")",
"\n",
"}"
]
|
19,194 | all-19195 | [
"GetMetric",
"returns",
"the",
"Metric",
"field",
"if",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"."
]
| [
"func",
"(",
"m",
"*",
"Metric",
")",
"GetMetric",
"(",
")",
"<mask>",
"{",
"if",
"m",
"==",
"nil",
"||",
"m",
".",
"Metric",
"==",
"nil",
"{",
"return",
"\"",
"\"",
"\n",
"}",
"\n",
"return",
"*",
"m",
".",
"Metric",
"\n",
"}"
]
|
19,195 | all-19196 | [
"Create",
"creates",
"a",
"vsphere_virtual_machine",
"disk",
"sub",
"-",
"resource",
"."
]
| [
"func",
"(",
"r",
"*",
"DiskSubresource",
")",
"Create",
"(",
"l",
"object",
".",
"VirtualDeviceList",
")",
"(",
"[",
"]",
"types",
".",
"BaseVirtualDeviceConfigSpec",
",",
"error",
")",
"{",
"log",
".",
"Printf",
"(",
"\"",
"\"",
",",
"r",
")",
"\n",
"var",
"spec",
"[",
"]",
"types",
".",
"BaseVirtualDeviceConfigSpec",
"\n\n",
"disk",
",",
"err",
":=",
"r",
".",
"createDisk",
"(",
"l",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"}",
"\n",
"// We now have the controller on which we can create our device on.",
"// Assign the disk to a controller.",
"ctlr",
",",
"err",
":=",
"r",
".",
"assignDisk",
"(",
"l",
",",
"disk",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"}",
"\n\n",
"if",
"err",
":=",
"r",
".",
"expandDiskSettings",
"(",
"disk",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"// Done here. Save ID, push the device to the new device list and return.",
"if",
"err",
":=",
"r",
".",
"SaveDevIDs",
"(",
"disk",
",",
"ctlr",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"dspec",
",",
"err",
":=",
"object",
".",
"VirtualDeviceList",
"{",
"disk",
"}",
".",
"ConfigSpec",
"(",
"types",
".",
"VirtualDeviceConfigSpecOperationAdd",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"if",
"len",
"(",
"dspec",
")",
"!=",
"1",
"{",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"len",
"(",
"dspec",
")",
")",
"\n",
"}",
"\n",
"// Clear the file operation if we are attaching.",
"if",
"r",
".",
"Get",
"(",
"\"",
"\"",
")",
".",
"(",
"bool",
")",
"{",
"dspec",
"[",
"0",
"]",
".",
"GetVirtualDeviceConfigSpec",
"(",
")",
".",
"FileOperation",
"=",
"\"",
"\"",
"\n",
"}",
"\n",
"spec",
"=",
"append",
"(",
"<mask>",
",",
"dspec",
"...",
")",
"\n",
"log",
".",
"Printf",
"(",
"\"",
"\"",
",",
"r",
",",
"DeviceChangeString",
"(",
"spec",
")",
")",
"\n",
"log",
".",
"Printf",
"(",
"\"",
"\"",
",",
"r",
")",
"\n",
"return",
"spec",
",",
"nil",
"\n",
"}"
]
|
19,196 | all-19197 | [
"title",
":",
"profile",
"cmdline",
"handler",
"path",
":",
"/",
"debug",
"/",
"pprof",
"/",
"cmdline",
"method",
":",
"GET",
"responses",
":",
"200",
":",
"Ok",
"401",
":",
"Unauthorized"
]
| [
"func",
"cmdlineHandler",
"(",
"w",
"http",
".",
"ResponseWriter",
",",
"r",
"*",
"http",
".",
"Request",
",",
"t",
"auth",
".",
"<mask>",
")",
"error",
"{",
"if",
"!",
"permission",
".",
"Check",
"(",
"t",
",",
"permission",
".",
"PermDebug",
")",
"{",
"return",
"permission",
".",
"ErrUnauthorized",
"\n",
"}",
"\n",
"pprof",
".",
"Cmdline",
"(",
"w",
",",
"r",
")",
"\n",
"return",
"nil",
"\n",
"}"
]
|
19,197 | all-19198 | [
"HasApmQuery",
"returns",
"a",
"boolean",
"if",
"a",
"field",
"has",
"been",
"set",
"."
]
| [
"func",
"(",
"t",
"*",
"TimeseriesRequest",
")",
"HasApmQuery",
"(",
")",
"bool",
"{",
"if",
"t",
"!=",
"nil",
"&&",
"t",
".",
"ApmQuery",
"!=",
"nil",
"{",
"return",
"true",
"\n",
"}",
"\n\n",
"return",
"<mask>",
"\n",
"}"
]
|
19,198 | all-19199 | [
"expiredClusterAdminCheck",
"enforces",
"that",
"if",
"the",
"cluster",
"s",
"enterprise",
"token",
"is",
"expired",
"only",
"admins",
"may",
"log",
"in",
"."
]
| [
"func",
"(",
"a",
"*",
"apiServer",
")",
"expiredClusterAdminCheck",
"(",
"ctx",
"context",
".",
"Context",
",",
"username",
"string",
")",
"error",
"{",
"state",
",",
"err",
":=",
"a",
".",
"getEnterpriseTokenState",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"}",
"\n\n",
"isAdmin",
",",
"err",
":=",
"a",
".",
"isAdmin",
"(",
"ctx",
",",
"username",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"if",
"<mask>",
"!=",
"enterpriseclient",
".",
"State_ACTIVE",
"&&",
"!",
"isAdmin",
"{",
"return",
"errors",
".",
"New",
"(",
"\"",
"\"",
"+",
"\"",
"\"",
"+",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
]
|
19,199 | all-19200 | [
"GetNoMetricHosts",
"returns",
"the",
"NoMetricHosts",
"field",
"if",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"."
]
| [
"func",
"(",
"h",
"*",
"HostmapDefinition",
")",
"GetNoMetricHosts",
"(",
")",
"bool",
"{",
"if",
"h",
"==",
"nil",
"||",
"h",
".",
"NoMetricHosts",
"==",
"nil",
"{",
"return",
"<mask>",
"\n",
"}",
"\n",
"return",
"*",
"h",
".",
"NoMetricHosts",
"\n",
"}"
]
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.