id
int32 0
25.3k
| idx
stringlengths 5
9
| nl_tokens
sequencelengths 1
418
| pl_tokens
sequencelengths 22
4.98k
|
---|---|---|---|
11,200 | all-11201 | [
"MiddlewareFunc",
"registers",
"middleware",
"function",
"to",
"handle",
"incoming",
"request",
"messages",
"."
] | [
"func",
"(",
"c",
"*",
"Conn",
")",
"MiddlewareFunc",
"(",
"middleware",
"...",
"func",
"(",
"ctx",
"*",
"ReqCtx",
")",
"error",
")",
"{",
"c",
".",
"middleware",
"=",
"<mask>",
"(",
"c",
".",
"middleware",
",",
"middleware",
"...",
")",
"\n",
"}"
] |
11,201 | all-11202 | [
"Clear",
"wipes",
"out",
"the",
"current",
"middleware",
"stack",
"for",
"the",
"App",
"/",
"Group",
"any",
"middleware",
"previously",
"defined",
"will",
"be",
"removed",
"leaving",
"an",
"empty",
"middleware",
"stack",
"."
] | [
"func",
"(",
"ms",
"*",
"MiddlewareStack",
")",
"Clear",
"(",
")",
"{",
"ms",
".",
"<mask>",
"=",
"[",
"]",
"MiddlewareFunc",
"{",
"}",
"\n",
"ms",
".",
"skips",
"=",
"map",
"[",
"string",
"]",
"bool",
"{",
"}",
"\n",
"}"
] |
11,202 | all-11203 | [
"resourceVSphereComputeClusterSaveDatacenter",
"saves",
"the",
"datacenter",
"that",
"the",
"cluster",
"is",
"a",
"member",
"of",
"for",
"correctness",
"on",
"imports",
"."
] | [
"func",
"resourceVSphereComputeClusterSaveDatacenter",
"(",
"d",
"*",
"schema",
".",
"ResourceData",
",",
"meta",
"interface",
"{",
"}",
",",
"cluster",
"*",
"object",
".",
"ClusterComputeResource",
",",
")",
"error",
"{",
"log",
".",
"Printf",
"(",
"\"",
"\"",
",",
"resourceVSphereComputeClusterIDString",
"(",
"d",
")",
")",
"\n",
"client",
",",
"err",
":=",
"resourceVSphereComputeClusterClient",
"(",
"meta",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"p",
",",
"err",
":=",
"folder",
".",
"RootPathParticleHost",
".",
"SplitDatacenter",
"(",
"cluster",
".",
"InventoryPath",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"}",
"\n\n",
"dc",
",",
"err",
":=",
"getDatacenter",
"(",
"client",
",",
"p",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"}",
"\n\n",
"return",
"d",
".",
"Set",
"(",
"\"",
"\"",
",",
"dc",
".",
"Reference",
"(",
")",
".",
"<mask>",
")",
"\n",
"}"
] |
11,203 | all-11204 | [
"Copy",
"returns",
"a",
"deep",
"copy",
"of",
"this",
"configuration",
"."
] | [
"func",
"(",
"c",
"*",
"TemplateConfig",
")",
"Copy",
"(",
")",
"*",
"TemplateConfig",
"{",
"if",
"c",
"==",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n\n",
"var",
"o",
"TemplateConfig",
"\n\n",
"o",
".",
"Backup",
"=",
"c",
".",
"Backup",
"\n\n",
"o",
".",
"Command",
"=",
"c",
".",
"Command",
"\n\n",
"o",
".",
"CommandTimeout",
"=",
"c",
".",
"CommandTimeout",
"\n\n",
"o",
".",
"Contents",
"=",
"c",
".",
"Contents",
"\n\n",
"o",
".",
"CreateDestDirs",
"=",
"c",
".",
"CreateDestDirs",
"\n\n",
"o",
".",
"Destination",
"=",
"c",
".",
"Destination",
"\n\n",
"o",
".",
"ErrMissingKey",
"=",
"c",
".",
"ErrMissingKey",
"\n\n",
"if",
"c",
".",
"Exec",
"!=",
"nil",
"{",
"o",
".",
"Exec",
"=",
"c",
".",
"Exec",
".",
"Copy",
"(",
")",
"\n",
"}",
"\n\n",
"o",
".",
"Perms",
"=",
"c",
".",
"Perms",
"\n\n",
"o",
".",
"<mask>",
"=",
"c",
".",
"Source",
"\n\n",
"if",
"c",
".",
"Wait",
"!=",
"nil",
"{",
"o",
".",
"Wait",
"=",
"c",
".",
"Wait",
".",
"Copy",
"(",
")",
"\n",
"}",
"\n\n",
"o",
".",
"LeftDelim",
"=",
"c",
".",
"LeftDelim",
"\n",
"o",
".",
"RightDelim",
"=",
"c",
".",
"RightDelim",
"\n\n",
"return",
"&",
"o",
"\n",
"}"
] |
11,204 | all-11205 | [
"NewOutgoingDocument",
"creates",
"a",
"new",
"outgoing",
"file",
"."
] | [
"func",
"(",
"api",
"*",
"TelegramBotAPI",
")",
"NewOutgoingDocument",
"(",
"recipient",
"Recipient",
",",
"fileName",
"string",
",",
"reader",
"<mask>",
".",
"Reader",
")",
"*",
"OutgoingDocument",
"{",
"return",
"&",
"OutgoingDocument",
"{",
"outgoingMessageBase",
":",
"outgoingMessageBase",
"{",
"outgoingBase",
":",
"outgoingBase",
"{",
"api",
":",
"api",
",",
"Recipient",
":",
"recipient",
",",
"}",
",",
"}",
",",
"outgoingFileBase",
":",
"outgoingFileBase",
"{",
"fileName",
":",
"fileName",
",",
"r",
":",
"reader",
",",
"}",
",",
"}",
"\n",
"}"
] |
11,205 | all-11206 | [
"Deal",
"with",
"the",
"logout",
"request",
"."
] | [
"func",
"(",
"c",
"*",
"Client",
")",
"logoutHandler",
"(",
"w",
"http",
".",
"ResponseWriter",
",",
"r",
"*",
"http",
".",
"<mask>",
")",
"{",
"c",
".",
"user",
"=",
"nil",
"\n",
"c",
".",
"err",
"=",
"nil",
"\n",
"http",
".",
"Redirect",
"(",
"w",
",",
"r",
",",
"\"",
"\"",
",",
"http",
".",
"StatusFound",
")",
"\n",
"return",
"\n",
"}"
] |
11,206 | all-11207 | [
"Term",
"specifies",
"that",
"the",
"matching",
"should",
"generate",
"a",
"value",
"and",
"also",
"match",
"using",
"a",
"regular",
"expression",
"."
] | [
"func",
"Term",
"(",
"generate",
"string",
",",
"matcher",
"string",
")",
"Matcher",
"{",
"return",
"term",
"{",
"Data",
":",
"termData",
"{",
"Generate",
":",
"generate",
",",
"Matcher",
":",
"termMatcher",
"{",
"<mask>",
":",
"\"",
"\"",
",",
"O",
":",
"0",
",",
"Regex",
":",
"matcher",
",",
"}",
",",
"}",
",",
"}",
"\n",
"}"
] |
11,207 | all-11208 | [
"MarshalJSON",
"overrides",
"the",
"logic",
"for",
"JSON",
"-",
"encoding",
"a",
"ContainerType",
"object"
] | [
"func",
"(",
"containerType",
"*",
"ContainerType",
")",
"MarshalJSON",
"(",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"if",
"containerType",
"==",
"nil",
"{",
"return",
"[",
"]",
"byte",
"(",
"\"",
"\"",
")",
",",
"nil",
"\n",
"}",
"\n\n",
"return",
"[",
"]",
"<mask>",
"(",
"`\"`",
"+",
"containerType",
".",
"String",
"(",
")",
"+",
"`\"`",
")",
",",
"nil",
"\n",
"}"
] |
11,208 | all-11209 | [
"Step",
"3",
"is",
"the",
"cleaning",
"up",
"of",
"Y",
"and",
"ç",
"suffixes",
"."
] | [
"func",
"step3",
"(",
"word",
"*",
"snowballword",
".",
"SnowballWord",
")",
"bool",
"{",
"// Replace final Y with i or final ç with c",
"if",
"idx",
":=",
"len",
"(",
"word",
".",
"RS",
")",
"-",
"1",
";",
"idx",
">=",
"0",
"{",
"<mask>",
"word",
".",
"RS",
"[",
"idx",
"]",
"{",
"case",
"89",
":",
"// Replace Y (89) with \"i\" (105)",
"word",
".",
"RS",
"[",
"idx",
"]",
"=",
"105",
"\n",
"return",
"true",
"\n\n",
"case",
"231",
":",
"// Replace ç (231) with \"c\" (99)",
"word",
".",
"RS",
"[",
"idx",
"]",
"=",
"99",
"\n",
"return",
"true",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"false",
"\n",
"}"
] |
11,209 | all-11210 | [
"GetTickEdge",
"returns",
"the",
"TickEdge",
"field",
"if",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"."
] | [
"func",
"(",
"w",
"*",
"Widget",
")",
"GetTickEdge",
"(",
")",
"<mask>",
"{",
"if",
"w",
"==",
"nil",
"||",
"w",
".",
"TickEdge",
"==",
"nil",
"{",
"return",
"\"",
"\"",
"\n",
"}",
"\n",
"return",
"*",
"w",
".",
"TickEdge",
"\n",
"}"
] |
11,210 | all-11211 | [
"gchar",
"*",
"pango_color_to_string",
"(",
"const",
"PangoColor",
"*",
"color",
")",
";"
] | [
"func",
"(",
"v",
"*",
"<mask>",
")",
"ToString",
"(",
")",
"string",
"{",
"c",
":=",
"C",
".",
"pango_color_to_string",
"(",
"v",
".",
"native",
"(",
")",
")",
"\n",
"return",
"C",
".",
"GoString",
"(",
"(",
"*",
"C",
".",
"char",
")",
"(",
"c",
")",
")",
"\n",
"}"
] |
11,211 | all-11212 | [
"Delete",
"deletes",
"the",
"node",
"at",
"the",
"given",
"path",
".",
"If",
"the",
"node",
"is",
"a",
"directory",
"recursive",
"must",
"be",
"true",
"to",
"delete",
"it",
"."
] | [
"func",
"(",
"s",
"*",
"store",
")",
"Delete",
"(",
"nodePath",
"string",
",",
"dir",
",",
"recursive",
"bool",
")",
"(",
"*",
"Event",
",",
"error",
")",
"{",
"var",
"err",
"*",
"v2error",
".",
"Error",
"\n\n",
"s",
".",
"worldLock",
".",
"Lock",
"(",
")",
"\n",
"defer",
"s",
".",
"worldLock",
".",
"Unlock",
"(",
")",
"\n\n",
"defer",
"func",
"(",
")",
"{",
"if",
"err",
"==",
"nil",
"{",
"s",
".",
"Stats",
".",
"Inc",
"(",
"DeleteSuccess",
")",
"\n",
"reportWriteSuccess",
"(",
"Delete",
")",
"\n",
"return",
"\n",
"}",
"\n\n",
"s",
".",
"Stats",
".",
"Inc",
"(",
"DeleteFail",
")",
"\n",
"reportWriteFailure",
"(",
"Delete",
")",
"\n",
"}",
"(",
")",
"\n\n",
"nodePath",
"=",
"path",
".",
"Clean",
"(",
"path",
".",
"Join",
"(",
"\"",
"\"",
",",
"nodePath",
")",
")",
"\n",
"// we do not allow the user to change \"/\"",
"if",
"s",
".",
"readonlySet",
".",
"Contains",
"(",
"nodePath",
")",
"{",
"return",
"nil",
",",
"v2error",
".",
"NewError",
"(",
"v2error",
".",
"EcodeRootROnly",
",",
"\"",
"\"",
",",
"s",
".",
"CurrentIndex",
")",
"\n",
"}",
"\n\n",
"// recursive implies dir",
"if",
"recursive",
"{",
"dir",
"=",
"true",
"\n",
"}",
"\n\n",
"n",
",",
"err",
":=",
"s",
".",
"internalGet",
"(",
"nodePath",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"// if the node does not exist, return error",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"nextIndex",
":=",
"s",
".",
"CurrentIndex",
"+",
"1",
"\n",
"e",
":=",
"newEvent",
"(",
"Delete",
",",
"nodePath",
",",
"nextIndex",
",",
"n",
".",
"CreatedIndex",
")",
"\n",
"e",
".",
"EtcdIndex",
"=",
"nextIndex",
"\n",
"e",
".",
"PrevNode",
"=",
"n",
".",
"Repr",
"(",
"false",
",",
"false",
",",
"s",
".",
"clock",
")",
"\n",
"eNode",
":=",
"e",
".",
"Node",
"\n\n",
"if",
"n",
".",
"IsDir",
"(",
")",
"{",
"eNode",
".",
"Dir",
"=",
"true",
"\n",
"}",
"\n\n",
"callback",
":=",
"func",
"(",
"path",
"string",
")",
"{",
"// notify function",
"// notify the watchers with deleted set true",
"s",
".",
"WatcherHub",
".",
"notifyWatchers",
"(",
"e",
",",
"path",
",",
"true",
")",
"\n",
"}",
"\n\n",
"err",
"=",
"n",
".",
"Remove",
"(",
"dir",
",",
"recursive",
",",
"<mask>",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"// update etcd index",
"s",
".",
"CurrentIndex",
"++",
"\n\n",
"s",
".",
"WatcherHub",
".",
"notify",
"(",
"e",
")",
"\n\n",
"return",
"e",
",",
"nil",
"\n",
"}"
] |
11,212 | all-11213 | [
"NewLager",
"-",
"constructor",
"for",
"a",
"Logger",
"object"
] | [
"func",
"NewLager",
"(",
"log",
"*",
"logger",
")",
"Logger",
"{",
"var",
"minLagerLogLevel",
"lager",
".",
"LogLevel",
"\n",
"switch",
"log",
".",
"LogLevel",
"{",
"case",
"DEBUG",
":",
"minLagerLogLevel",
"=",
"lager",
".",
"DEBUG",
"\n",
"case",
"INFO",
":",
"minLagerLogLevel",
"=",
"lager",
".",
"INFO",
"\n",
"case",
"ERROR",
":",
"minLagerLogLevel",
"=",
"lager",
".",
"ERROR",
"\n",
"case",
"FATAL",
":",
"minLagerLogLevel",
"=",
"lager",
".",
"FATAL",
"\n",
"default",
":",
"panic",
"(",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"<mask>",
".",
"LogLevel",
")",
")",
"\n",
"}",
"\n\n",
"logger",
":=",
"lager",
".",
"NewLogger",
"(",
"log",
".",
"Name",
")",
"\n",
"logger",
".",
"RegisterSink",
"(",
"lager",
".",
"NewWriterSink",
"(",
"log",
".",
"Writer",
",",
"minLagerLogLevel",
")",
")",
"\n",
"log",
".",
"Logger",
"=",
"logger",
"\n\n",
"return",
"log",
"\n",
"}"
] |
11,213 | all-11214 | [
"Make",
"sure",
"the",
"local",
"WriteHeader",
"is",
"called",
"and",
"encode",
"the",
"payload",
"if",
"necessary",
".",
"Provided",
"in",
"order",
"to",
"implement",
"the",
"http",
".",
"ResponseWriter",
"interface",
"."
] | [
"func",
"(",
"w",
"*",
"gzipResponseWriter",
")",
"Write",
"(",
"b",
"[",
"]",
"byte",
")",
"(",
"int",
",",
"error",
")",
"{",
"if",
"!",
"w",
".",
"wroteHeader",
"{",
"w",
".",
"WriteHeader",
"(",
"http",
".",
"StatusOK",
")",
"\n",
"}",
"\n\n",
"writer",
":=",
"w",
".",
"ResponseWriter",
".",
"(",
"http",
".",
"ResponseWriter",
")",
"\n\n",
"if",
"w",
".",
"canGzip",
"{",
"// Write can be called multiple times for a given response.",
"// (see the streaming example:",
"// https://github.com/ant0ine/go-json-rest-examples/tree/master/streaming)",
"// The gzipWriter is instantiated only once, and flushed after",
"// each write.",
"if",
"w",
".",
"gzipWriter",
"==",
"nil",
"{",
"w",
".",
"gzipWriter",
"=",
"gzip",
".",
"NewWriter",
"(",
"writer",
")",
"\n",
"}",
"\n",
"<mask>",
",",
"errW",
":=",
"w",
".",
"gzipWriter",
".",
"Write",
"(",
"b",
")",
"\n",
"errF",
":=",
"w",
".",
"gzipWriter",
".",
"Flush",
"(",
")",
"\n",
"if",
"errW",
"!=",
"nil",
"{",
"return",
"count",
",",
"errW",
"\n",
"}",
"\n",
"if",
"errF",
"!=",
"nil",
"{",
"return",
"count",
",",
"errF",
"\n",
"}",
"\n",
"return",
"count",
",",
"nil",
"\n",
"}",
"\n\n",
"return",
"writer",
".",
"Write",
"(",
"b",
")",
"\n",
"}"
] |
11,214 | all-11215 | [
"RadioButtonNewWithLabelFromWidget",
"is",
"a",
"wrapper",
"around",
"gtk_radio_button_new_with_label_from_widget",
"()",
"."
] | [
"func",
"RadioButtonNewWithLabelFromWidget",
"(",
"radioGroupMember",
"*",
"RadioButton",
",",
"label",
"string",
")",
"(",
"*",
"RadioButton",
",",
"error",
")",
"{",
"cstr",
":=",
"C",
".",
"CString",
"(",
"label",
")",
"\n",
"defer",
"C",
".",
"free",
"(",
"unsafe",
".",
"Pointer",
"(",
"cstr",
")",
")",
"\n",
"<mask>",
"cradio",
"*",
"C",
".",
"GtkRadioButton",
"\n",
"if",
"radioGroupMember",
"!=",
"nil",
"{",
"cradio",
"=",
"radioGroupMember",
".",
"native",
"(",
")",
"\n",
"}",
"\n",
"c",
":=",
"C",
".",
"gtk_radio_button_new_with_label_from_widget",
"(",
"cradio",
",",
"(",
"*",
"C",
".",
"gchar",
")",
"(",
"cstr",
")",
")",
"\n",
"if",
"c",
"==",
"nil",
"{",
"return",
"nil",
",",
"nilPtrErr",
"\n",
"}",
"\n",
"return",
"wrapRadioButton",
"(",
"glib",
".",
"Take",
"(",
"unsafe",
".",
"Pointer",
"(",
"c",
")",
")",
")",
",",
"nil",
"\n",
"}"
] |
11,215 | all-11216 | [
"Using",
"the",
"EZ",
"API",
"posts",
"a",
"count",
"to",
"a",
"stat",
"at",
"a",
"specific",
"time",
"using",
"DefaultReporter",
"."
] | [
"func",
"PostEZCountTime",
"(",
"statName",
",",
"ezkey",
"string",
",",
"count",
"int",
",",
"timestamp",
"int64",
")",
"error",
"{",
"return",
"DefaultReporter",
".",
"PostEZCountTime",
"(",
"statName",
",",
"ezkey",
",",
"<mask>",
",",
"timestamp",
")",
"\n",
"}"
] |
11,216 | all-11217 | [
"RegisterDatasources",
"adds",
"path",
"to",
"the",
"Mapnik",
"fonts",
"search",
"path",
"."
] | [
"func",
"RegisterFonts",
"(",
"path",
"string",
")",
"error",
"{",
"cs",
":=",
"C",
".",
"CString",
"(",
"path",
")",
"\n",
"defer",
"C",
".",
"free",
"(",
"unsafe",
".",
"Pointer",
"(",
"cs",
")",
")",
"\n",
"if",
"C",
".",
"mapnik_register_fonts",
"(",
"<mask>",
")",
"==",
"0",
"{",
"e",
":=",
"C",
".",
"GoString",
"(",
"C",
".",
"mapnik_register_last_error",
"(",
")",
")",
"\n",
"if",
"e",
"!=",
"\"",
"\"",
"{",
"return",
"errors",
".",
"New",
"(",
"\"",
"\"",
"+",
"e",
")",
"\n",
"}",
"\n",
"return",
"errors",
".",
"New",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
] |
11,217 | all-11218 | [
"AutoUpdateInterval",
"returns",
"the",
"configured",
"images",
"auto",
"update",
"interval",
"."
] | [
"func",
"(",
"c",
"*",
"Config",
")",
"AutoUpdateInterval",
"(",
")",
"<mask>",
".",
"Duration",
"{",
"n",
":=",
"c",
".",
"m",
".",
"GetInt64",
"(",
"\"",
"\"",
")",
"\n",
"return",
"time",
".",
"Duration",
"(",
"n",
")",
"*",
"time",
".",
"Hour",
"\n",
"}"
] |
11,218 | all-11219 | [
"bucketQuantile",
"calculates",
"the",
"quantile",
"q",
"based",
"on",
"the",
"given",
"buckets",
".",
"The",
"buckets",
"will",
"be",
"sorted",
"by",
"upperBound",
"by",
"this",
"function",
"(",
"i",
".",
"e",
".",
"no",
"sorting",
"needed",
"before",
"calling",
"this",
"function",
")",
".",
"The",
"quantile",
"value",
"is",
"interpolated",
"assuming",
"a",
"linear",
"distribution",
"within",
"a",
"bucket",
".",
"However",
"if",
"the",
"quantile",
"falls",
"into",
"the",
"highest",
"bucket",
"the",
"upper",
"bound",
"of",
"the",
"2nd",
"highest",
"bucket",
"is",
"returned",
".",
"A",
"natural",
"lower",
"bound",
"of",
"0",
"is",
"assumed",
"if",
"the",
"upper",
"bound",
"of",
"the",
"lowest",
"bucket",
"is",
"greater",
"0",
".",
"In",
"that",
"case",
"interpolation",
"in",
"the",
"lowest",
"bucket",
"happens",
"linearly",
"between",
"0",
"and",
"the",
"upper",
"bound",
"of",
"the",
"lowest",
"bucket",
".",
"However",
"if",
"the",
"lowest",
"bucket",
"has",
"an",
"upper",
"bound",
"less",
"or",
"equal",
"0",
"this",
"upper",
"bound",
"is",
"returned",
"if",
"the",
"quantile",
"falls",
"into",
"the",
"lowest",
"bucket",
".",
"There",
"are",
"a",
"number",
"of",
"special",
"cases",
"(",
"once",
"we",
"have",
"a",
"way",
"to",
"report",
"errors",
"happening",
"during",
"evaluations",
"of",
"AST",
"functions",
"we",
"should",
"report",
"those",
"explicitly",
")",
":",
"If",
"buckets",
"has",
"fewer",
"than",
"2",
"elements",
"NaN",
"is",
"returned",
".",
"If",
"the",
"highest",
"bucket",
"is",
"not",
"+",
"Inf",
"NaN",
"is",
"returned",
".",
"If",
"q<0",
"-",
"Inf",
"is",
"returned",
".",
"If",
"q",
">",
"1",
"+",
"Inf",
"is",
"returned",
"."
] | [
"func",
"bucketQuantile",
"(",
"q",
"float64",
",",
"buckets",
"buckets",
")",
"float64",
"{",
"if",
"q",
"<",
"0",
"{",
"return",
"math",
".",
"Inf",
"(",
"-",
"1",
")",
"\n",
"}",
"\n",
"if",
"q",
">",
"1",
"{",
"return",
"math",
".",
"Inf",
"(",
"+",
"1",
")",
"\n",
"}",
"\n",
"sort",
".",
"Sort",
"(",
"buckets",
")",
"\n",
"if",
"!",
"math",
".",
"IsInf",
"(",
"buckets",
"[",
"len",
"(",
"buckets",
")",
"-",
"1",
"]",
".",
"upperBound",
",",
"+",
"1",
")",
"{",
"return",
"math",
".",
"NaN",
"(",
")",
"\n",
"}",
"\n\n",
"buckets",
"=",
"coalesceBuckets",
"(",
"buckets",
")",
"\n",
"ensureMonotonic",
"(",
"buckets",
")",
"\n\n",
"if",
"len",
"(",
"buckets",
")",
"<",
"2",
"{",
"return",
"math",
".",
"NaN",
"(",
")",
"\n",
"}",
"\n\n",
"rank",
":=",
"q",
"*",
"buckets",
"[",
"len",
"(",
"buckets",
")",
"-",
"1",
"]",
".",
"count",
"\n",
"b",
":=",
"sort",
".",
"Search",
"(",
"len",
"(",
"buckets",
")",
"-",
"1",
",",
"func",
"(",
"i",
"int",
")",
"bool",
"{",
"return",
"buckets",
"[",
"i",
"]",
".",
"count",
">=",
"rank",
"}",
")",
"\n\n",
"if",
"b",
"==",
"len",
"(",
"buckets",
")",
"-",
"1",
"{",
"return",
"buckets",
"[",
"len",
"(",
"buckets",
")",
"-",
"2",
"]",
".",
"upperBound",
"\n",
"}",
"\n",
"if",
"b",
"==",
"0",
"&&",
"buckets",
"[",
"0",
"]",
".",
"upperBound",
"<=",
"0",
"{",
"return",
"buckets",
"[",
"0",
"]",
".",
"upperBound",
"\n",
"}",
"\n",
"var",
"(",
"bucketStart",
"float64",
"\n",
"bucketEnd",
"=",
"buckets",
"[",
"b",
"]",
".",
"upperBound",
"\n",
"count",
"=",
"buckets",
"[",
"b",
"]",
".",
"<mask>",
"\n",
")",
"\n",
"if",
"b",
">",
"0",
"{",
"bucketStart",
"=",
"buckets",
"[",
"b",
"-",
"1",
"]",
".",
"upperBound",
"\n",
"count",
"-=",
"buckets",
"[",
"b",
"-",
"1",
"]",
".",
"count",
"\n",
"rank",
"-=",
"buckets",
"[",
"b",
"-",
"1",
"]",
".",
"count",
"\n",
"}",
"\n",
"return",
"bucketStart",
"+",
"(",
"bucketEnd",
"-",
"bucketStart",
")",
"*",
"(",
"rank",
"/",
"count",
")",
"\n",
"}"
] |
11,219 | all-11220 | [
"Receive",
"implements",
"TCPReciever",
"by",
"Gob",
"decoding",
"into",
"a",
"byte",
"slice",
"directly",
"."
] | [
"func",
"(",
"receiver",
"*",
"gobTCPReceiver",
")",
"Receive",
"(",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"var",
"msg",
"[",
"]",
"byte",
"\n",
"err",
":=",
"receiver",
".",
"decoder",
".",
"Decode",
"(",
"&",
"msg",
")",
"\n",
"return",
"<mask>",
",",
"err",
"\n",
"}"
] |
11,220 | all-11221 | [
"//",
"Endpoint",
"returns",
"the",
"BOSH",
"Registry",
"endpoint",
".",
"func",
"(",
"o",
"ClientOptions",
")",
"Endpoint",
"()",
"string",
"{",
"return",
"fmt",
".",
"Sprintf",
"(",
"%s",
":",
"//",
"%s",
":",
"%d",
"http",
"o",
".",
"Address",
"o",
".",
"Port",
")",
"}",
"EndpointWithCredentials",
"returns",
"the",
"BOSH",
"Registry",
"endpoint",
"including",
"credentials",
"."
] | [
"func",
"(",
"o",
"ClientOptions",
")",
"EndpointWithCredentials",
"(",
")",
"string",
"{",
"return",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"\"",
"\"",
",",
"o",
".",
"HTTPOptions",
".",
"<mask>",
",",
"o",
".",
"HTTPOptions",
".",
"Password",
",",
"o",
".",
"Address",
",",
"o",
".",
"HTTPOptions",
".",
"Port",
")",
"\n",
"}"
] |
11,221 | all-11222 | [
"convertAndAppendContextFuncs",
"converts",
"and",
"appends",
"funcs",
"in",
"v",
"to",
"o",
"."
] | [
"func",
"convertAndAppendContextFuncs",
"(",
"o",
"[",
"]",
"func",
"(",
"context",
".",
"Context",
")",
"error",
",",
"v",
"...",
"interface",
"{",
"}",
")",
"(",
"[",
"]",
"func",
"(",
"context",
".",
"Context",
")",
"error",
",",
"error",
")",
"{",
"for",
"_",
",",
"z",
":=",
"range",
"v",
"{",
"var",
"t",
"func",
"(",
"context",
".",
"Context",
")",
"error",
"\n",
"switch",
"f",
":=",
"z",
".",
"(",
"type",
")",
"{",
"case",
"func",
"(",
"context",
".",
"Context",
")",
"error",
":",
"t",
"=",
"f",
"\n\n",
"case",
"func",
"(",
")",
":",
"t",
"=",
"func",
"(",
"<mask>",
".",
"Context",
")",
"error",
"{",
"f",
"(",
")",
"\n",
"return",
"nil",
"\n",
"}",
"\n\n",
"case",
"func",
"(",
")",
"error",
":",
"t",
"=",
"func",
"(",
"context",
".",
"Context",
")",
"error",
"{",
"return",
"f",
"(",
")",
"\n",
"}",
"\n",
"}",
"\n\n",
"if",
"t",
"==",
"nil",
"{",
"return",
"nil",
",",
"ErrInvalidType",
"\n",
"}",
"\n\n",
"o",
"=",
"append",
"(",
"o",
",",
"t",
")",
"\n",
"}",
"\n",
"return",
"o",
",",
"nil",
"\n",
"}"
] |
11,222 | all-11223 | [
"StringFindBetween",
"returns",
"the",
"string",
"between",
"the",
"first",
"occurrences",
"of",
"the",
"tokens",
"start",
"and",
"stop",
".",
"The",
"remainder",
"of",
"the",
"string",
"after",
"the",
"stop",
"token",
"will",
"be",
"returned",
"if",
"found",
".",
"If",
"the",
"tokens",
"couldn",
"t",
"be",
"found",
"then",
"the",
"whole",
"string",
"will",
"be",
"returned",
"as",
"remainder",
"."
] | [
"func",
"StringFindBetween",
"(",
"s",
",",
"start",
",",
"stop",
"string",
")",
"(",
"between",
",",
"remainder",
"string",
",",
"found",
"bool",
")",
"{",
"<mask>",
":=",
"strings",
".",
"Index",
"(",
"s",
",",
"start",
")",
"\n",
"if",
"begin",
"==",
"-",
"1",
"{",
"return",
"\"",
"\"",
",",
"s",
",",
"false",
"\n",
"}",
"\n",
"between",
"=",
"s",
"[",
"begin",
"+",
"len",
"(",
"start",
")",
":",
"]",
"\n",
"end",
":=",
"strings",
".",
"Index",
"(",
"between",
",",
"stop",
")",
"\n",
"if",
"end",
"==",
"-",
"1",
"{",
"return",
"\"",
"\"",
",",
"s",
",",
"false",
"\n",
"}",
"\n",
"return",
"between",
"[",
":",
"end",
"]",
",",
"s",
"[",
"begin",
"+",
"len",
"(",
"start",
")",
"+",
"end",
"+",
"len",
"(",
"stop",
")",
":",
"]",
",",
"true",
"\n",
"}"
] |
11,223 | all-11224 | [
"GetStartedAt",
"sets",
"the",
"timestamp",
"for",
"container",
"s",
"start",
"time"
] | [
"func",
"(",
"c",
"*",
"Container",
")",
"GetStartedAt",
"(",
")",
"<mask>",
".",
"Time",
"{",
"c",
".",
"lock",
".",
"RLock",
"(",
")",
"\n",
"defer",
"c",
".",
"lock",
".",
"RUnlock",
"(",
")",
"\n\n",
"return",
"c",
".",
"startedAt",
"\n",
"}"
] |
11,224 | all-11225 | [
"addCORSHeader",
"adds",
"the",
"correct",
"cors",
"headers",
"given",
"an",
"origin"
] | [
"func",
"addCORSHeader",
"(",
"w",
"http",
".",
"ResponseWriter",
",",
"origin",
"string",
")",
"{",
"w",
".",
"Header",
"(",
")",
".",
"Add",
"(",
"\"",
"\"",
",",
"\"",
"\"",
")",
"\n",
"w",
".",
"Header",
"(",
")",
".",
"Add",
"(",
"\"",
"\"",
",",
"origin",
")",
"\n",
"w",
".",
"<mask>",
"(",
")",
".",
"Add",
"(",
"\"",
"\"",
",",
"\"",
"\"",
")",
"\n",
"}"
] |
11,225 | all-11226 | [
"NewOutgoingAudio",
"creates",
"a",
"new",
"outgoing",
"audio",
"file",
"."
] | [
"func",
"(",
"api",
"*",
"TelegramBotAPI",
")",
"NewOutgoingAudio",
"(",
"recipient",
"Recipient",
",",
"fileName",
"string",
",",
"reader",
"<mask>",
".",
"Reader",
")",
"*",
"OutgoingAudio",
"{",
"return",
"&",
"OutgoingAudio",
"{",
"outgoingMessageBase",
":",
"outgoingMessageBase",
"{",
"outgoingBase",
":",
"outgoingBase",
"{",
"api",
":",
"api",
",",
"Recipient",
":",
"recipient",
",",
"}",
",",
"}",
",",
"outgoingFileBase",
":",
"outgoingFileBase",
"{",
"fileName",
":",
"fileName",
",",
"r",
":",
"reader",
",",
"}",
",",
"}",
"\n",
"}"
] |
11,226 | all-11227 | [
"GetSSHPort",
"returns",
"the",
"ssh",
"port",
"22",
"if",
"not",
"specified"
] | [
"func",
"(",
"d",
"*",
"BaseDriver",
")",
"GetSSHPort",
"(",
")",
"(",
"int",
",",
"<mask>",
")",
"{",
"if",
"d",
".",
"SSHPort",
"==",
"0",
"{",
"d",
".",
"SSHPort",
"=",
"DefaultSSHPort",
"\n",
"}",
"\n\n",
"return",
"d",
".",
"SSHPort",
",",
"nil",
"\n",
"}"
] |
11,227 | all-11228 | [
"DropCollection",
"removes",
"the",
"entire",
"collection",
"including",
"all",
"of",
"its",
"documents",
"."
] | [
"func",
"(",
"c",
"*",
"<mask>",
")",
"DropCollection",
"(",
")",
"error",
"{",
"return",
"c",
".",
"Database",
".",
"Run",
"(",
"bson",
".",
"D",
"{",
"{",
"\"",
"\"",
",",
"c",
".",
"Name",
"}",
"}",
",",
"nil",
")",
"\n",
"}"
] |
11,228 | all-11229 | [
"Functions",
"dealing",
"with",
"storage",
"pools",
"."
] | [
"func",
"(",
"s",
"*",
"storageZfs",
")",
"StoragePoolInit",
"(",
")",
"error",
"{",
"<mask>",
":=",
"s",
".",
"StorageCoreInit",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"// Detect whether we have been given a zfs dataset as source.",
"if",
"s",
".",
"pool",
".",
"Config",
"[",
"\"",
"\"",
"]",
"!=",
"\"",
"\"",
"{",
"s",
".",
"dataset",
"=",
"s",
".",
"pool",
".",
"Config",
"[",
"\"",
"\"",
"]",
"\n",
"}",
"\n\n",
"return",
"nil",
"\n",
"}"
] |
11,229 | all-11230 | [
"Noticef",
"logs",
"a",
"message",
"using",
"NOTICE",
"as",
"log",
"level",
"."
] | [
"func",
"(",
"l",
"*",
"Logger",
")",
"Noticef",
"(",
"format",
"string",
",",
"args",
"...",
"interface",
"{",
"}",
")",
"{",
"l",
".",
"<mask>",
"(",
"NOTICE",
",",
"&",
"format",
",",
"args",
"...",
")",
"\n",
"}"
] |
11,230 | all-11231 | [
"CreateSimilar",
"is",
"a",
"wrapper",
"around",
"cairo_surface_create_similar",
"()",
"."
] | [
"func",
"(",
"v",
"*",
"Surface",
")",
"CreateSimilar",
"(",
"<mask>",
"Content",
",",
"width",
",",
"height",
"int",
")",
"*",
"Surface",
"{",
"c",
":=",
"C",
".",
"cairo_surface_create_similar",
"(",
"v",
".",
"native",
"(",
")",
",",
"C",
".",
"cairo_content_t",
"(",
"content",
")",
",",
"C",
".",
"int",
"(",
"width",
")",
",",
"C",
".",
"int",
"(",
"height",
")",
")",
"\n",
"s",
":=",
"wrapSurface",
"(",
"c",
")",
"\n",
"runtime",
".",
"SetFinalizer",
"(",
"s",
",",
"(",
"*",
"Surface",
")",
".",
"destroy",
")",
"\n",
"return",
"s",
"\n",
"}"
] |
11,231 | all-11232 | [
"expandSliceOfDvsHostInfrastructureTrafficResource",
"expands",
"all",
"network",
"I",
"/",
"O",
"control",
"resource",
"entries",
"that",
"are",
"currently",
"supported",
"in",
"API",
"and",
"returns",
"a",
"slice",
"of",
"DvsHostInfrastructureTrafficResource",
"."
] | [
"func",
"expandSliceOfDvsHostInfrastructureTrafficResource",
"(",
"d",
"*",
"schema",
".",
"ResourceData",
")",
"[",
"]",
"types",
".",
"DvsHostInfrastructureTrafficResource",
"{",
"var",
"s",
"[",
"]",
"types",
".",
"DvsHostInfrastructureTrafficResource",
"\n",
"for",
"_",
",",
"<mask>",
":=",
"range",
"infrastructureTrafficClassValues",
"{",
"v",
":=",
"expandDvsHostInfrastructureTrafficResource",
"(",
"d",
",",
"key",
")",
"\n",
"if",
"v",
"!=",
"nil",
"{",
"s",
"=",
"append",
"(",
"s",
",",
"*",
"v",
")",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"s",
"\n",
"}"
] |
11,232 | all-11233 | [
"FlushCommitF",
"calls",
"f",
"with",
"commits",
"that",
"have",
"the",
"specified",
"commits",
"as",
"provenance",
".",
"Note",
"that",
"it",
"can",
"block",
"if",
"jobs",
"have",
"not",
"successfully",
"completed",
".",
"This",
"in",
"effect",
"waits",
"for",
"all",
"of",
"the",
"jobs",
"that",
"are",
"triggered",
"by",
"a",
"set",
"of",
"commits",
"to",
"complete",
".",
"If",
"toRepos",
"is",
"not",
"nil",
"then",
"only",
"the",
"commits",
"up",
"to",
"and",
"including",
"those",
"repos",
"will",
"be",
"considered",
"otherwise",
"all",
"repos",
"are",
"considered",
".",
"Note",
"that",
"it",
"s",
"never",
"necessary",
"to",
"call",
"FlushCommit",
"to",
"run",
"jobs",
"they",
"ll",
"run",
"no",
"matter",
"what",
"FlushCommitF",
"just",
"allows",
"you",
"to",
"wait",
"for",
"them",
"to",
"complete",
"and",
"see",
"their",
"output",
"once",
"they",
"do",
"."
] | [
"func",
"(",
"c",
"APIClient",
")",
"FlushCommitF",
"(",
"commits",
"[",
"]",
"*",
"pfs",
".",
"Commit",
",",
"toRepos",
"[",
"]",
"*",
"pfs",
".",
"Repo",
",",
"f",
"func",
"(",
"*",
"pfs",
".",
"CommitInfo",
")",
"error",
")",
"error",
"{",
"stream",
",",
"err",
":=",
"c",
".",
"PfsAPIClient",
".",
"FlushCommit",
"(",
"c",
".",
"Ctx",
"(",
")",
",",
"&",
"pfs",
".",
"FlushCommitRequest",
"{",
"Commits",
":",
"commits",
",",
"ToRepos",
":",
"toRepos",
",",
"}",
",",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"grpcutil",
".",
"ScrubGRPC",
"(",
"err",
")",
"\n",
"}",
"\n",
"for",
"{",
"ci",
",",
"err",
":=",
"stream",
".",
"Recv",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"if",
"err",
"==",
"<mask>",
".",
"EOF",
"{",
"return",
"nil",
"\n",
"}",
"\n",
"return",
"grpcutil",
".",
"ScrubGRPC",
"(",
"err",
")",
"\n",
"}",
"\n",
"if",
"err",
":=",
"f",
"(",
"ci",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"}",
"\n",
"}"
] |
11,233 | all-11234 | [
"Between",
"creates",
"a",
"between",
"query",
"."
] | [
"func",
"(",
"f",
"*",
"Field",
")",
"Between",
"(",
"a",
"int",
",",
"b",
"int",
")",
"*",
"PQLRowQuery",
"{",
"text",
":=",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"f",
".",
"name",
",",
"a",
",",
"b",
")",
"\n",
"q",
":=",
"NewPQLRowQuery",
"(",
"text",
",",
"f",
".",
"index",
",",
"nil",
")",
"\n",
"q",
".",
"hasKeys",
"=",
"f",
".",
"<mask>",
".",
"keys",
"||",
"f",
".",
"index",
".",
"options",
".",
"keys",
"\n",
"return",
"q",
"\n",
"}"
] |
11,234 | all-11235 | [
"GetInt64Ptr",
"reads",
"a",
"ResourceData",
"and",
"returns",
"an",
"appropriate",
"*",
"int64",
"for",
"the",
"state",
"of",
"the",
"definition",
".",
"nil",
"is",
"returned",
"if",
"it",
"does",
"not",
"exist",
"."
] | [
"func",
"GetInt64Ptr",
"(",
"d",
"*",
"schema",
".",
"ResourceData",
",",
"<mask>",
"string",
")",
"*",
"int64",
"{",
"v",
",",
"e",
":=",
"d",
".",
"GetOkExists",
"(",
"key",
")",
"\n",
"if",
"e",
"{",
"return",
"Int64Ptr",
"(",
"int64",
"(",
"v",
".",
"(",
"int",
")",
")",
")",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
] |
11,235 | all-11236 | [
"fill",
"all",
"or",
"part",
"of",
"buffer",
"object",
"s",
"data",
"store",
"with",
"a",
"fixed",
"value"
] | [
"func",
"ClearNamedBufferSubData",
"(",
"buffer",
"uint32",
",",
"internalformat",
"uint32",
",",
"offset",
"int",
",",
"size",
"int",
",",
"format",
"uint32",
",",
"xtype",
"uint32",
",",
"data",
"unsafe",
".",
"Pointer",
")",
"{",
"C",
".",
"glowClearNamedBufferSubData",
"(",
"gpClearNamedBufferSubData",
",",
"(",
"C",
".",
"GLuint",
")",
"(",
"buffer",
")",
",",
"(",
"C",
".",
"GLenum",
")",
"(",
"internalformat",
")",
",",
"(",
"C",
".",
"GLintptr",
")",
"(",
"offset",
")",
",",
"(",
"C",
".",
"GLsizeiptr",
")",
"(",
"<mask>",
")",
",",
"(",
"C",
".",
"GLenum",
")",
"(",
"format",
")",
",",
"(",
"C",
".",
"GLenum",
")",
"(",
"xtype",
")",
",",
"data",
")",
"\n",
"}"
] |
11,236 | all-11237 | [
"puts",
"is",
"the",
"list",
"of",
"ops",
"for",
"all",
"pending",
"writes"
] | [
"func",
"(",
"s",
"*",
"stm",
")",
"puts",
"(",
")",
"[",
"]",
"v3",
".",
"Op",
"{",
"puts",
":=",
"make",
"(",
"[",
"]",
"v3",
".",
"Op",
",",
"0",
",",
"len",
"(",
"s",
".",
"wset",
")",
")",
"\n",
"for",
"_",
",",
"v",
":=",
"<mask>",
"s",
".",
"wset",
"{",
"puts",
"=",
"append",
"(",
"puts",
",",
"v",
".",
"op",
")",
"\n",
"}",
"\n",
"return",
"puts",
"\n",
"}"
] |
11,237 | all-11238 | [
"NewCluster",
"will",
"initialize",
"a",
"new",
"Cluster"
] | [
"func",
"NewCluster",
"(",
"<mask>",
"string",
")",
"*",
"Cluster",
"{",
"return",
"&",
"Cluster",
"{",
"Name",
":",
"name",
",",
"ClusterAPI",
":",
"&",
"clusterv1",
".",
"Cluster",
"{",
"ObjectMeta",
":",
"metav1",
".",
"ObjectMeta",
"{",
"Name",
":",
"name",
",",
"}",
",",
"Spec",
":",
"clusterv1",
".",
"ClusterSpec",
"{",
"}",
",",
"}",
",",
"ControlPlane",
":",
"&",
"clusterv1",
".",
"MachineSet",
"{",
"}",
",",
"}",
"\n",
"}"
] |
11,238 | all-11239 | [
"helper",
"function",
"to",
"parse",
"policyMapping",
"extensions",
"returns",
"slices",
"of",
"CertPolicyIds",
"separated",
"by",
"domain"
] | [
"func",
"GetMappedPolicies",
"(",
"polMap",
"*",
"pkix",
".",
"Extension",
")",
"(",
"out",
"[",
"]",
"[",
"2",
"]",
"asn1",
".",
"ObjectIdentifier",
",",
"err",
"error",
")",
"{",
"if",
"polMap",
"==",
"nil",
"{",
"return",
"nil",
",",
"errors",
".",
"New",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"<mask>",
"outSeq",
",",
"inSeq",
"asn1",
".",
"RawValue",
"\n\n",
"empty",
",",
"err",
":=",
"asn1",
".",
"Unmarshal",
"(",
"polMap",
".",
"Value",
",",
"&",
"outSeq",
")",
"//strip outer sequence tag/length should be nothing extra",
"\n",
"if",
"err",
"!=",
"nil",
"||",
"len",
"(",
"empty",
")",
"!=",
"0",
"||",
"outSeq",
".",
"Class",
"!=",
"0",
"||",
"outSeq",
".",
"Tag",
"!=",
"16",
"||",
"outSeq",
".",
"IsCompound",
"==",
"false",
"{",
"return",
"nil",
",",
"errors",
".",
"New",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"for",
"done",
":=",
"false",
";",
"!",
"done",
";",
"{",
"//loop through SEQUENCE OF",
"outSeq",
".",
"Bytes",
",",
"err",
"=",
"asn1",
".",
"Unmarshal",
"(",
"outSeq",
".",
"Bytes",
",",
"&",
"inSeq",
")",
"//extract next inner SEQUENCE (OID pair)",
"\n",
"if",
"err",
"!=",
"nil",
"||",
"inSeq",
".",
"Class",
"!=",
"0",
"||",
"inSeq",
".",
"Tag",
"!=",
"16",
"||",
"inSeq",
".",
"IsCompound",
"==",
"false",
"{",
"err",
"=",
"errors",
".",
"New",
"(",
"\"",
"\"",
")",
"\n",
"return",
"\n",
"}",
"\n",
"if",
"len",
"(",
"outSeq",
".",
"Bytes",
")",
"==",
"0",
"{",
"//nothing remaining to parse, stop looping after",
"done",
"=",
"true",
"\n",
"}",
"\n\n",
"var",
"oidIssue",
",",
"oidSubject",
"asn1",
".",
"ObjectIdentifier",
"\n",
"var",
"restIn",
"asn1",
".",
"RawContent",
"\n",
"restIn",
",",
"err",
"=",
"asn1",
".",
"Unmarshal",
"(",
"inSeq",
".",
"Bytes",
",",
"&",
"oidIssue",
")",
"//extract first inner CertPolicyId (issuer domain)",
"\n",
"if",
"err",
"!=",
"nil",
"||",
"len",
"(",
"restIn",
")",
"==",
"0",
"{",
"err",
"=",
"errors",
".",
"New",
"(",
"\"",
"\"",
")",
"\n",
"return",
"\n",
"}",
"\n\n",
"empty",
",",
"err",
"=",
"asn1",
".",
"Unmarshal",
"(",
"restIn",
",",
"&",
"oidSubject",
")",
"//extract second inner CertPolicyId (subject domain)",
"\n",
"if",
"err",
"!=",
"nil",
"||",
"len",
"(",
"empty",
")",
"!=",
"0",
"{",
"err",
"=",
"errors",
".",
"New",
"(",
"\"",
"\"",
")",
"\n",
"return",
"\n",
"}",
"\n\n",
"//append found OIDs",
"out",
"=",
"append",
"(",
"out",
",",
"[",
"2",
"]",
"asn1",
".",
"ObjectIdentifier",
"{",
"oidIssue",
",",
"oidSubject",
"}",
")",
"\n",
"}",
"\n\n",
"return",
"\n",
"}"
] |
11,239 | all-11240 | [
"GetDiskUsage",
"wraps",
"syscall",
".",
"Statfs",
"for",
"usage",
"in",
"GCing",
"the",
"disk"
] | [
"func",
"GetDiskUsage",
"(",
"path",
"string",
")",
"(",
"percentBlocksFree",
"float64",
",",
"bytesFree",
",",
"bytesUsed",
"uint64",
",",
"err",
"error",
")",
"{",
"<mask>",
"stat",
"syscall",
".",
"Statfs_t",
"\n",
"err",
"=",
"syscall",
".",
"Statfs",
"(",
"path",
",",
"&",
"stat",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"0",
",",
"0",
",",
"0",
",",
"err",
"\n",
"}",
"\n",
"percentBlocksFree",
"=",
"float64",
"(",
"stat",
".",
"Bfree",
")",
"/",
"float64",
"(",
"stat",
".",
"Blocks",
")",
"*",
"100",
"\n",
"bytesFree",
"=",
"stat",
".",
"Bfree",
"*",
"uint64",
"(",
"stat",
".",
"Bsize",
")",
"\n",
"bytesUsed",
"=",
"(",
"stat",
".",
"Blocks",
"-",
"stat",
".",
"Bfree",
")",
"*",
"uint64",
"(",
"stat",
".",
"Bsize",
")",
"\n",
"return",
"percentBlocksFree",
",",
"bytesFree",
",",
"bytesUsed",
",",
"nil",
"\n",
"}"
] |
11,240 | all-11241 | [
"MarshalJSON",
"supports",
"json",
".",
"Marshaler",
"interface"
] | [
"func",
"(",
"v",
"EventIssueUpdated",
")",
"MarshalJSON",
"(",
")",
"(",
"[",
"]",
"<mask>",
",",
"error",
")",
"{",
"w",
":=",
"jwriter",
".",
"Writer",
"{",
"}",
"\n",
"easyjsonC5a4559bEncodeGithubComChromedpCdprotoCast4",
"(",
"&",
"w",
",",
"v",
")",
"\n",
"return",
"w",
".",
"Buffer",
".",
"BuildBytes",
"(",
")",
",",
"w",
".",
"Error",
"\n",
"}"
] |
11,241 | all-11242 | [
"checkInPeriod",
"checks",
"an",
"offering",
"being",
"in",
"period",
"specified",
"by",
"periodKey",
"."
] | [
"func",
"(",
"w",
"*",
"Worker",
")",
"checkInPeriod",
"(",
"logger",
"log",
".",
"Logger",
",",
"hash",
"common",
".",
"Hash",
",",
"periodKey",
"string",
",",
"periodErr",
"error",
")",
"error",
"{",
"updateBlockNumber",
",",
"err",
":=",
"w",
".",
"getOfferingBlockNumber",
"(",
"logger",
",",
"hash",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"lastBlock",
",",
"err",
":=",
"w",
".",
"ethBack",
".",
"LatestBlockNumber",
"(",
"context",
".",
"Background",
"(",
")",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"logger",
".",
"Error",
"(",
"err",
".",
"<mask>",
"(",
")",
")",
"\n",
"return",
"ErrInternal",
"\n",
"}",
"\n\n",
"removePeriod",
",",
"err",
":=",
"data",
".",
"ReadUintSetting",
"(",
"w",
".",
"db",
".",
"Querier",
",",
"periodKey",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"periodErr",
"\n",
"}",
"\n\n",
"if",
"uint64",
"(",
"updateBlockNumber",
")",
"+",
"uint64",
"(",
"removePeriod",
")",
">",
"lastBlock",
".",
"Uint64",
"(",
")",
"{",
"return",
"periodErr",
"\n",
"}",
"\n\n",
"return",
"nil",
"\n",
"}"
] |
11,242 | all-11243 | [
"GetImageAlias",
"returns",
"an",
"existing",
"alias",
"as",
"an",
"ImageAliasesEntry",
"struct"
] | [
"func",
"(",
"r",
"*",
"ProtocolSimpleStreams",
")",
"GetImageAlias",
"(",
"name",
"string",
")",
"(",
"*",
"api",
".",
"ImageAliasesEntry",
",",
"string",
",",
"error",
")",
"{",
"alias",
",",
"err",
":=",
"r",
".",
"ssClient",
".",
"GetAlias",
"(",
"<mask>",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"\"",
"\"",
",",
"err",
"\n",
"}",
"\n\n",
"return",
"alias",
",",
"\"",
"\"",
",",
"err",
"\n",
"}"
] |
11,243 | all-11244 | [
"UnmarshalJSON",
"supports",
"json",
".",
"Unmarshaler",
"interface"
] | [
"func",
"(",
"v",
"*",
"TakeResponseBodyAsStreamReturns",
")",
"UnmarshalJSON",
"(",
"data",
"[",
"]",
"<mask>",
")",
"error",
"{",
"r",
":=",
"jlexer",
".",
"Lexer",
"{",
"Data",
":",
"data",
"}",
"\n",
"easyjsonC5a4559bDecodeGithubComChromedpCdprotoFetch",
"(",
"&",
"r",
",",
"v",
")",
"\n",
"return",
"r",
".",
"Error",
"(",
")",
"\n",
"}"
] |
11,244 | all-11245 | [
"storeIDToContainerTaskUnsafe",
"stores",
"the",
"container",
"in",
"the",
"idToContainer",
"and",
"idToTask",
"maps",
".",
"The",
"key",
"to",
"the",
"maps",
"is",
"either",
"the",
"Docker",
"-",
"generated",
"ID",
"or",
"the",
"agent",
"-",
"generated",
"name",
"(",
"if",
"the",
"ID",
"is",
"not",
"available",
")",
".",
"If",
"the",
"container",
"is",
"updated",
"with",
"an",
"ID",
"a",
"subsequent",
"call",
"to",
"this",
"function",
"will",
"update",
"the",
"map",
"to",
"use",
"the",
"ID",
"as",
"the",
"key",
"."
] | [
"func",
"(",
"state",
"*",
"DockerTaskEngineState",
")",
"storeIDToContainerTaskUnsafe",
"(",
"container",
"*",
"apicontainer",
".",
"DockerContainer",
",",
"task",
"*",
"apitask",
".",
"Task",
")",
"{",
"if",
"container",
".",
"DockerID",
"!=",
"\"",
"\"",
"{",
"// Update the container id to the state",
"state",
".",
"idToContainer",
"[",
"container",
".",
"DockerID",
"]",
"=",
"container",
"\n",
"<mask>",
".",
"idToTask",
"[",
"container",
".",
"DockerID",
"]",
"=",
"task",
".",
"Arn",
"\n\n",
"// Remove the previously added name mapping",
"delete",
"(",
"state",
".",
"idToContainer",
",",
"container",
".",
"DockerName",
")",
"\n",
"delete",
"(",
"state",
".",
"idToTask",
",",
"container",
".",
"DockerName",
")",
"\n",
"}",
"else",
"if",
"container",
".",
"DockerName",
"!=",
"\"",
"\"",
"{",
"// Update the container name mapping to the state when the ID isn't available",
"state",
".",
"idToContainer",
"[",
"container",
".",
"DockerName",
"]",
"=",
"container",
"\n",
"state",
".",
"idToTask",
"[",
"container",
".",
"DockerName",
"]",
"=",
"task",
".",
"Arn",
"\n",
"}",
"\n",
"}"
] |
11,245 | all-11246 | [
"AfterFunc",
"waits",
"for",
"the",
"duration",
"to",
"elapse",
"and",
"then",
"calls",
"f",
"in",
"its",
"own",
"goroutine",
".",
"It",
"returns",
"a",
"Timer",
"that",
"can",
"be",
"used",
"to",
"cancel",
"the",
"call",
"using",
"its",
"Stop",
"method",
"."
] | [
"func",
"(",
"*",
"DefaultTime",
")",
"AfterFunc",
"(",
"d",
"<mask>",
".",
"Duration",
",",
"f",
"func",
"(",
")",
")",
"Timer",
"{",
"return",
"time",
".",
"AfterFunc",
"(",
"d",
",",
"f",
")",
"\n",
"}"
] |
11,246 | all-11247 | [
"UnmarshalJSON",
"satisfies",
"json",
".",
"Unmarshaler",
"."
] | [
"func",
"(",
"t",
"*",
"MediaSource",
")",
"UnmarshalJSON",
"(",
"buf",
"[",
"]",
"<mask>",
")",
"error",
"{",
"return",
"easyjson",
".",
"Unmarshal",
"(",
"buf",
",",
"t",
")",
"\n",
"}"
] |
11,247 | all-11248 | [
"Start",
"starts"
] | [
"func",
"(",
"app",
"*",
"App",
")",
"Start",
"(",
")",
"(",
"err",
"error",
")",
"{",
"app",
".",
"Lock",
"(",
")",
"\n",
"defer",
"app",
".",
"Unlock",
"(",
")",
"\n\n",
"defer",
"func",
"(",
")",
"{",
"if",
"err",
"!=",
"nil",
"{",
"app",
".",
"stopAll",
"(",
")",
"\n",
"}",
"\n",
"}",
"(",
")",
"\n\n",
"conf",
":=",
"app",
".",
"Config",
"\n\n",
"runtime",
".",
"GOMAXPROCS",
"(",
"conf",
".",
"Common",
".",
"MaxCPU",
")",
"\n\n",
"core",
":=",
"<mask>",
".",
"New",
"(",
")",
"\n",
"core",
".",
"SetMaxSize",
"(",
"conf",
".",
"Cache",
".",
"MaxSize",
")",
"\n",
"core",
".",
"SetWriteStrategy",
"(",
"conf",
".",
"Cache",
".",
"WriteStrategy",
")",
"\n",
"core",
".",
"SetTagsEnabled",
"(",
"conf",
".",
"Tags",
".",
"Enabled",
")",
"\n\n",
"app",
".",
"Cache",
"=",
"core",
"\n\n",
"/* API start */",
"if",
"conf",
".",
"Grpc",
".",
"Enabled",
"{",
"var",
"grpcAddr",
"*",
"net",
".",
"TCPAddr",
"\n",
"grpcAddr",
",",
"err",
"=",
"net",
".",
"ResolveTCPAddr",
"(",
"\"",
"\"",
",",
"conf",
".",
"Grpc",
".",
"Listen",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"\n",
"}",
"\n\n",
"grpcApi",
":=",
"api",
".",
"New",
"(",
"core",
")",
"\n\n",
"if",
"err",
"=",
"grpcApi",
".",
"Listen",
"(",
"grpcAddr",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"\n",
"}",
"\n\n",
"app",
".",
"Api",
"=",
"grpcApi",
"\n",
"}",
"\n",
"/* API end */",
"/* WHISPER and TAGS start */",
"app",
".",
"startPersister",
"(",
")",
"\n",
"/* WHISPER and TAGS end */",
"app",
".",
"Receivers",
"=",
"make",
"(",
"[",
"]",
"*",
"NamedReceiver",
",",
"0",
")",
"\n",
"var",
"rcv",
"receiver",
".",
"Receiver",
"\n",
"var",
"rcvOptions",
"map",
"[",
"string",
"]",
"interface",
"{",
"}",
"\n\n",
"/* UDP start */",
"if",
"conf",
".",
"Udp",
".",
"Enabled",
"{",
"if",
"rcvOptions",
",",
"err",
"=",
"receiver",
".",
"WithProtocol",
"(",
"conf",
".",
"Udp",
",",
"\"",
"\"",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"\n",
"}",
"\n\n",
"if",
"rcv",
",",
"err",
"=",
"receiver",
".",
"New",
"(",
"\"",
"\"",
",",
"rcvOptions",
",",
"core",
".",
"Add",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"\n",
"}",
"\n\n",
"app",
".",
"Receivers",
"=",
"append",
"(",
"app",
".",
"Receivers",
",",
"&",
"NamedReceiver",
"{",
"Receiver",
":",
"rcv",
",",
"Name",
":",
"\"",
"\"",
",",
"}",
")",
"\n",
"}",
"\n",
"/* UDP end */",
"/* TCP start */",
"if",
"conf",
".",
"Tcp",
".",
"Enabled",
"{",
"if",
"rcvOptions",
",",
"err",
"=",
"receiver",
".",
"WithProtocol",
"(",
"conf",
".",
"Tcp",
",",
"\"",
"\"",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"\n",
"}",
"\n\n",
"if",
"rcv",
",",
"err",
"=",
"receiver",
".",
"New",
"(",
"\"",
"\"",
",",
"rcvOptions",
",",
"core",
".",
"Add",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"\n",
"}",
"\n\n",
"app",
".",
"Receivers",
"=",
"append",
"(",
"app",
".",
"Receivers",
",",
"&",
"NamedReceiver",
"{",
"Receiver",
":",
"rcv",
",",
"Name",
":",
"\"",
"\"",
",",
"}",
")",
"\n",
"}",
"\n",
"/* TCP end */",
"/* PICKLE start */",
"if",
"conf",
".",
"Pickle",
".",
"Enabled",
"{",
"if",
"rcvOptions",
",",
"err",
"=",
"receiver",
".",
"WithProtocol",
"(",
"conf",
".",
"Pickle",
",",
"\"",
"\"",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"\n",
"}",
"\n\n",
"if",
"rcv",
",",
"err",
"=",
"receiver",
".",
"New",
"(",
"\"",
"\"",
",",
"rcvOptions",
",",
"core",
".",
"Add",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"\n",
"}",
"\n\n",
"app",
".",
"Receivers",
"=",
"append",
"(",
"app",
".",
"Receivers",
",",
"&",
"NamedReceiver",
"{",
"Receiver",
":",
"rcv",
",",
"Name",
":",
"\"",
"\"",
",",
"}",
")",
"\n",
"}",
"\n",
"/* PICKLE end */",
"/* CUSTOM RECEIVERS start */",
"for",
"receiverName",
",",
"receiverOptions",
":=",
"range",
"conf",
".",
"Receiver",
"{",
"if",
"rcv",
",",
"err",
"=",
"receiver",
".",
"New",
"(",
"receiverName",
",",
"receiverOptions",
",",
"core",
".",
"Add",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"\n",
"}",
"\n\n",
"app",
".",
"Receivers",
"=",
"append",
"(",
"app",
".",
"Receivers",
",",
"&",
"NamedReceiver",
"{",
"Receiver",
":",
"rcv",
",",
"Name",
":",
"receiverName",
",",
"}",
")",
"\n",
"}",
"\n",
"/* CUSTOM RECEIVERS end */",
"/* CARBONSERVER start */",
"if",
"conf",
".",
"Carbonserver",
".",
"Enabled",
"{",
"if",
"err",
"!=",
"nil",
"{",
"return",
"\n",
"}",
"\n\n",
"carbonserver",
":=",
"carbonserver",
".",
"NewCarbonserverListener",
"(",
"core",
".",
"Get",
")",
"\n",
"carbonserver",
".",
"SetWhisperData",
"(",
"conf",
".",
"Whisper",
".",
"DataDir",
")",
"\n",
"carbonserver",
".",
"SetMaxGlobs",
"(",
"conf",
".",
"Carbonserver",
".",
"MaxGlobs",
")",
"\n",
"carbonserver",
".",
"SetFLock",
"(",
"app",
".",
"Config",
".",
"Whisper",
".",
"FLock",
")",
"\n",
"carbonserver",
".",
"SetFailOnMaxGlobs",
"(",
"conf",
".",
"Carbonserver",
".",
"FailOnMaxGlobs",
")",
"\n",
"carbonserver",
".",
"SetBuckets",
"(",
"conf",
".",
"Carbonserver",
".",
"Buckets",
")",
"\n",
"carbonserver",
".",
"SetMetricsAsCounters",
"(",
"conf",
".",
"Carbonserver",
".",
"MetricsAsCounters",
")",
"\n",
"carbonserver",
".",
"SetScanFrequency",
"(",
"conf",
".",
"Carbonserver",
".",
"ScanFrequency",
".",
"Value",
"(",
")",
")",
"\n",
"carbonserver",
".",
"SetReadTimeout",
"(",
"conf",
".",
"Carbonserver",
".",
"ReadTimeout",
".",
"Value",
"(",
")",
")",
"\n",
"carbonserver",
".",
"SetIdleTimeout",
"(",
"conf",
".",
"Carbonserver",
".",
"IdleTimeout",
".",
"Value",
"(",
")",
")",
"\n",
"carbonserver",
".",
"SetWriteTimeout",
"(",
"conf",
".",
"Carbonserver",
".",
"WriteTimeout",
".",
"Value",
"(",
")",
")",
"\n",
"carbonserver",
".",
"SetQueryCacheEnabled",
"(",
"conf",
".",
"Carbonserver",
".",
"QueryCacheEnabled",
")",
"\n",
"carbonserver",
".",
"SetFindCacheEnabled",
"(",
"conf",
".",
"Carbonserver",
".",
"FindCacheEnabled",
")",
"\n",
"carbonserver",
".",
"SetQueryCacheSizeMB",
"(",
"conf",
".",
"Carbonserver",
".",
"QueryCacheSizeMB",
")",
"\n",
"carbonserver",
".",
"SetTrigramIndex",
"(",
"conf",
".",
"Carbonserver",
".",
"TrigramIndex",
")",
"\n",
"carbonserver",
".",
"SetInternalStatsDir",
"(",
"conf",
".",
"Carbonserver",
".",
"InternalStatsDir",
")",
"\n",
"carbonserver",
".",
"SetPercentiles",
"(",
"conf",
".",
"Carbonserver",
".",
"Percentiles",
")",
"\n",
"// carbonserver.SetQueryTimeout(conf.Carbonserver.QueryTimeout.Value())",
"if",
"conf",
".",
"Prometheus",
".",
"Enabled",
"{",
"carbonserver",
".",
"InitPrometheus",
"(",
"app",
".",
"PromRegisterer",
")",
"\n",
"}",
"\n\n",
"if",
"err",
"=",
"carbonserver",
".",
"Listen",
"(",
"conf",
".",
"Carbonserver",
".",
"Listen",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"\n",
"}",
"\n\n",
"app",
".",
"Carbonserver",
"=",
"carbonserver",
"\n",
"}",
"\n",
"/* CARBONSERVER end */",
"/* CARBONLINK start */",
"if",
"conf",
".",
"Carbonlink",
".",
"Enabled",
"{",
"var",
"linkAddr",
"*",
"net",
".",
"TCPAddr",
"\n",
"linkAddr",
",",
"err",
"=",
"net",
".",
"ResolveTCPAddr",
"(",
"\"",
"\"",
",",
"conf",
".",
"Carbonlink",
".",
"Listen",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"\n",
"}",
"\n\n",
"carbonlink",
":=",
"cache",
".",
"NewCarbonlinkListener",
"(",
"core",
")",
"\n",
"carbonlink",
".",
"SetReadTimeout",
"(",
"conf",
".",
"Carbonlink",
".",
"ReadTimeout",
".",
"Value",
"(",
")",
")",
"\n",
"// carbonlink.SetQueryTimeout(conf.Carbonlink.QueryTimeout.Value())",
"if",
"err",
"=",
"carbonlink",
".",
"Listen",
"(",
"linkAddr",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"\n",
"}",
"\n\n",
"app",
".",
"CarbonLink",
"=",
"carbonlink",
"\n",
"}",
"\n",
"/* CARBONLINK end */",
"/* RESTORE start */",
"if",
"conf",
".",
"Dump",
".",
"Enabled",
"{",
"go",
"app",
".",
"Restore",
"(",
"core",
".",
"Add",
",",
"conf",
".",
"Dump",
".",
"Path",
",",
"conf",
".",
"Dump",
".",
"RestorePerSecond",
")",
"\n",
"}",
"\n",
"/* RESTORE end */",
"/* COLLECTOR start */",
"app",
".",
"Collector",
"=",
"NewCollector",
"(",
"app",
")",
"\n",
"/* COLLECTOR end */",
"return",
"\n",
"}"
] |
11,248 | all-11249 | [
"MarshalString",
"appends",
"the",
"uint64",
"to",
"the",
"buffer",
"."
] | [
"func",
"(",
"m",
"*",
"Marshaller",
")",
"MarshalUint64",
"(",
"v",
"uint64",
")",
"{",
"if",
"m",
".",
"Error",
"!=",
"nil",
"{",
"return",
"\n",
"}",
"\n",
"if",
"len",
"(",
"m",
".",
"Data",
")",
"<",
"m",
".",
"offset",
"+",
"8",
"{",
"m",
".",
"Error",
"=",
"io",
".",
"ErrShortBuffer",
"\n",
"return",
"\n",
"}",
"\n\n",
"m",
".",
"Data",
"[",
"m",
".",
"offset",
"+",
"0",
"]",
"=",
"byte",
"(",
"v",
">>",
"56",
")",
"\n",
"m",
".",
"Data",
"[",
"m",
".",
"offset",
"+",
"1",
"]",
"=",
"byte",
"(",
"v",
">>",
"48",
")",
"\n",
"m",
".",
"Data",
"[",
"m",
".",
"offset",
"+",
"2",
"]",
"=",
"byte",
"(",
"v",
">>",
"40",
")",
"\n",
"m",
".",
"Data",
"[",
"m",
".",
"offset",
"+",
"3",
"]",
"=",
"byte",
"(",
"v",
">>",
"32",
")",
"\n",
"m",
".",
"Data",
"[",
"m",
".",
"offset",
"+",
"4",
"]",
"=",
"<mask>",
"(",
"v",
">>",
"24",
")",
"\n",
"m",
".",
"Data",
"[",
"m",
".",
"offset",
"+",
"5",
"]",
"=",
"byte",
"(",
"v",
">>",
"16",
")",
"\n",
"m",
".",
"Data",
"[",
"m",
".",
"offset",
"+",
"6",
"]",
"=",
"byte",
"(",
"v",
">>",
"8",
")",
"\n",
"m",
".",
"Data",
"[",
"m",
".",
"offset",
"+",
"7",
"]",
"=",
"byte",
"(",
"v",
")",
"\n",
"m",
".",
"offset",
"+=",
"8",
"\n",
"}"
] |
11,249 | all-11250 | [
"Type",
"determines",
"the",
"type",
"of",
"the",
"message",
".",
"Note",
"that",
"for",
"all",
"these",
"types",
"messages",
"can",
"still",
"be",
"replies",
"or",
"forwarded",
"."
] | [
"func",
"(",
"m",
"*",
"Message",
")",
"<mask>",
"(",
")",
"MessageType",
"{",
"if",
"m",
".",
"Text",
"!=",
"nil",
"{",
"return",
"TextMessage",
"\n",
"}",
"else",
"if",
"m",
".",
"Audio",
"!=",
"nil",
"{",
"return",
"AudioMessage",
"\n",
"}",
"else",
"if",
"m",
".",
"Document",
"!=",
"nil",
"{",
"return",
"DocumentMessage",
"\n",
"}",
"else",
"if",
"m",
".",
"Photo",
"!=",
"nil",
"{",
"return",
"PhotoMessage",
"\n",
"}",
"else",
"if",
"m",
".",
"Sticker",
"!=",
"nil",
"{",
"return",
"StickerMessage",
"\n",
"}",
"else",
"if",
"m",
".",
"Video",
"!=",
"nil",
"{",
"return",
"VideoMessage",
"\n",
"}",
"else",
"if",
"m",
".",
"Voice",
"!=",
"nil",
"{",
"return",
"VoiceMessage",
"\n",
"}",
"else",
"if",
"m",
".",
"Contact",
"!=",
"nil",
"{",
"return",
"ContactMessage",
"\n",
"}",
"else",
"if",
"m",
".",
"Location",
"!=",
"nil",
"{",
"return",
"LocationMessage",
"\n",
"}",
"else",
"if",
"m",
".",
"NewChatMember",
"!=",
"nil",
"{",
"return",
"NewChatMember",
"\n",
"}",
"else",
"if",
"m",
".",
"LeftChatMember",
"!=",
"nil",
"{",
"return",
"LeftChatMember",
"\n",
"}",
"else",
"if",
"m",
".",
"NewChatTitle",
"!=",
"nil",
"{",
"return",
"NewChatTitle",
"\n",
"}",
"else",
"if",
"m",
".",
"NewChatPhoto",
"!=",
"nil",
"{",
"return",
"NewChatPhoto",
"\n",
"}",
"else",
"if",
"m",
".",
"DeleteChatPhoto",
"{",
"return",
"DeletedChatPhoto",
"\n",
"}",
"else",
"if",
"m",
".",
"GroupChatCreated",
"{",
"return",
"GroupChatCreated",
"\n",
"}",
"else",
"if",
"m",
".",
"SupergroupChatCreated",
"{",
"return",
"SupergroupChatCreated",
"\n",
"}",
"else",
"if",
"m",
".",
"ChannelChatCreated",
"{",
"return",
"ChannelChatCreated",
"\n",
"}",
"else",
"if",
"m",
".",
"MigrateToChatID",
"!=",
"nil",
"{",
"return",
"MigrationToSupergroup",
"\n",
"}",
"else",
"if",
"m",
".",
"MigrateFromChatID",
"!=",
"nil",
"{",
"return",
"MigrationFromGroup",
"\n",
"}",
"else",
"if",
"m",
".",
"Venue",
"!=",
"nil",
"{",
"return",
"VenueMessage",
"\n",
"}",
"else",
"if",
"m",
".",
"PinnedMessage",
"!=",
"nil",
"{",
"return",
"PinnedMessage",
"\n",
"}",
"\n\n",
"return",
"UnknownMessage",
"\n",
"}"
] |
11,250 | all-11251 | [
"SetPostsubmits",
"updates",
"c",
".",
"Postsubmits",
"to",
"jobs",
"after",
"compiling",
"and",
"validating",
"their",
"regexes",
"."
] | [
"func",
"(",
"c",
"*",
"JobConfig",
")",
"SetPostsubmits",
"(",
"<mask>",
"map",
"[",
"string",
"]",
"[",
"]",
"Postsubmit",
")",
"error",
"{",
"nj",
":=",
"map",
"[",
"string",
"]",
"[",
"]",
"Postsubmit",
"{",
"}",
"\n",
"for",
"k",
",",
"v",
":=",
"range",
"jobs",
"{",
"nj",
"[",
"k",
"]",
"=",
"make",
"(",
"[",
"]",
"Postsubmit",
",",
"len",
"(",
"v",
")",
")",
"\n",
"copy",
"(",
"nj",
"[",
"k",
"]",
",",
"v",
")",
"\n",
"if",
"err",
":=",
"SetPostsubmitRegexes",
"(",
"nj",
"[",
"k",
"]",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"}",
"\n",
"c",
".",
"Postsubmits",
"=",
"nj",
"\n",
"return",
"nil",
"\n",
"}"
] |
11,251 | all-11252 | [
"ApplyTransition",
"calls",
"the",
"function",
"required",
"to",
"move",
"to",
"the",
"specified",
"status"
] | [
"func",
"(",
"vol",
"*",
"VolumeResource",
")",
"ApplyTransition",
"(",
"nextState",
"resourcestatus",
".",
"ResourceStatus",
")",
"error",
"{",
"transitionFunc",
",",
"ok",
":=",
"vol",
".",
"statusToTransitions",
"[",
"nextState",
"]",
"\n",
"if",
"!",
"<mask>",
"{",
"return",
"errors",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"vol",
".",
"Name",
",",
"vol",
".",
"StatusString",
"(",
"nextState",
")",
")",
"\n",
"}",
"\n",
"return",
"transitionFunc",
"(",
")",
"\n",
"}"
] |
11,252 | all-11253 | [
"writeMeta",
"is",
"used",
"to",
"write",
"out",
"the",
"metadata",
"we",
"have",
"."
] | [
"func",
"(",
"s",
"*",
"FileSnapshotSink",
")",
"writeMeta",
"(",
")",
"error",
"{",
"// Open the meta file",
"metaPath",
":=",
"filepath",
".",
"Join",
"(",
"s",
".",
"dir",
",",
"metaFilePath",
")",
"\n",
"fh",
",",
"err",
":=",
"<mask>",
".",
"Create",
"(",
"metaPath",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"defer",
"fh",
".",
"Close",
"(",
")",
"\n\n",
"// Buffer the file IO",
"buffered",
":=",
"bufio",
".",
"NewWriter",
"(",
"fh",
")",
"\n\n",
"// Write out as JSON",
"enc",
":=",
"json",
".",
"NewEncoder",
"(",
"buffered",
")",
"\n",
"if",
"err",
":=",
"enc",
".",
"Encode",
"(",
"&",
"s",
".",
"meta",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"if",
"err",
"=",
"buffered",
".",
"Flush",
"(",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"if",
"err",
"=",
"fh",
".",
"Sync",
"(",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"return",
"nil",
"\n",
"}"
] |
11,253 | all-11254 | [
"Warn",
"formats",
"message",
"using",
"the",
"default",
"formats",
"for",
"its",
"operands",
"prepends",
"the",
"prefix",
"as",
"necessary",
"and",
"writes",
"to",
"log",
"with",
"LevelWarn",
".",
"This",
"is",
"part",
"of",
"the",
"Logger",
"interface",
"implementation",
"."
] | [
"func",
"(",
"l",
"*",
"slog",
")",
"Warn",
"(",
"args",
"...",
"interface",
"{",
"}",
")",
"{",
"lvl",
":=",
"l",
".",
"Level",
"(",
")",
"\n",
"if",
"lvl",
"<=",
"LevelWarn",
"{",
"l",
".",
"b",
".",
"print",
"(",
"\"",
"\"",
",",
"l",
".",
"<mask>",
",",
"args",
"...",
")",
"\n",
"}",
"\n",
"}"
] |
11,254 | all-11255 | [
"InjectPartition",
"drops",
"connections",
"from",
"m",
"to",
"others",
"vice",
"versa",
"."
] | [
"func",
"(",
"m",
"*",
"member",
")",
"InjectPartition",
"(",
"t",
"testing",
".",
"TB",
",",
"others",
"...",
"*",
"member",
")",
"{",
"for",
"_",
",",
"<mask>",
":=",
"range",
"others",
"{",
"m",
".",
"s",
".",
"CutPeer",
"(",
"other",
".",
"s",
".",
"ID",
"(",
")",
")",
"\n",
"other",
".",
"s",
".",
"CutPeer",
"(",
"m",
".",
"s",
".",
"ID",
"(",
")",
")",
"\n",
"}",
"\n",
"}"
] |
11,255 | all-11256 | [
"UniqWithCount",
"squashes",
"adjacent",
"identical",
"items",
"in",
"arg",
".",
"In",
"into",
"a",
"single",
"output",
"prefixed",
"with",
"the",
"count",
"of",
"identical",
"items",
"followed",
"by",
"a",
"space",
"."
] | [
"func",
"UniqWithCount",
"(",
")",
"<mask>",
"{",
"return",
"FilterFunc",
"(",
"func",
"(",
"arg",
"Arg",
")",
"error",
"{",
"current",
":=",
"\"",
"\"",
"\n",
"count",
":=",
"0",
"\n",
"for",
"s",
":=",
"range",
"arg",
".",
"In",
"{",
"if",
"s",
"!=",
"current",
"{",
"if",
"count",
">",
"0",
"{",
"arg",
".",
"Out",
"<-",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"count",
",",
"current",
")",
"\n",
"}",
"\n",
"count",
"=",
"0",
"\n",
"current",
"=",
"s",
"\n",
"}",
"\n",
"count",
"++",
"\n",
"}",
"\n",
"if",
"count",
">",
"0",
"{",
"arg",
".",
"Out",
"<-",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"count",
",",
"current",
")",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}",
")",
"\n",
"}"
] |
11,256 | all-11257 | [
"NewASMClient",
"indicates",
"an",
"expected",
"call",
"of",
"NewASMClient"
] | [
"func",
"(",
"mr",
"*",
"MockClientCreatorMockRecorder",
")",
"NewASMClient",
"(",
"arg0",
",",
"arg1",
"<mask>",
"{",
"}",
")",
"*",
"gomock",
".",
"Call",
"{",
"return",
"mr",
".",
"mock",
".",
"ctrl",
".",
"RecordCallWithMethodType",
"(",
"mr",
".",
"mock",
",",
"\"",
"\"",
",",
"reflect",
".",
"TypeOf",
"(",
"(",
"*",
"MockClientCreator",
")",
"(",
"nil",
")",
".",
"NewASMClient",
")",
",",
"arg0",
",",
"arg1",
")",
"\n",
"}"
] |
11,257 | all-11258 | [
"roundRobinQuorumBackoff",
"retries",
"against",
"quorum",
"between",
"each",
"backoff",
".",
"This",
"is",
"intended",
"for",
"use",
"with",
"a",
"round",
"robin",
"load",
"balancer",
"."
] | [
"func",
"(",
"c",
"*",
"Client",
")",
"roundRobinQuorumBackoff",
"(",
"waitBetween",
"<mask>",
".",
"Duration",
",",
"jitterFraction",
"float64",
")",
"backoffFunc",
"{",
"return",
"func",
"(",
"attempt",
"uint",
")",
"time",
".",
"Duration",
"{",
"// after each round robin across quorum, backoff for our wait between duration",
"n",
":=",
"uint",
"(",
"len",
"(",
"c",
".",
"Endpoints",
"(",
")",
")",
")",
"\n",
"quorum",
":=",
"(",
"n",
"/",
"2",
"+",
"1",
")",
"\n",
"if",
"attempt",
"%",
"quorum",
"==",
"0",
"{",
"c",
".",
"lg",
".",
"Debug",
"(",
"\"",
"\"",
",",
"zap",
".",
"Uint",
"(",
"\"",
"\"",
",",
"attempt",
")",
",",
"zap",
".",
"Uint",
"(",
"\"",
"\"",
",",
"quorum",
")",
",",
"zap",
".",
"Duration",
"(",
"\"",
"\"",
",",
"waitBetween",
")",
",",
"zap",
".",
"Float64",
"(",
"\"",
"\"",
",",
"jitterFraction",
")",
")",
"\n",
"return",
"jitterUp",
"(",
"waitBetween",
",",
"jitterFraction",
")",
"\n",
"}",
"\n",
"c",
".",
"lg",
".",
"Debug",
"(",
"\"",
"\"",
",",
"zap",
".",
"Uint",
"(",
"\"",
"\"",
",",
"attempt",
")",
",",
"zap",
".",
"Uint",
"(",
"\"",
"\"",
",",
"quorum",
")",
")",
"\n",
"return",
"0",
"\n",
"}",
"\n",
"}"
] |
11,258 | all-11259 | [
"BatchSpec",
"initializes",
"a",
"ProwJobSpec",
"for",
"a",
"given",
"batch",
"job",
"and",
"ref",
"spec",
"."
] | [
"func",
"BatchSpec",
"(",
"p",
"config",
".",
"Presubmit",
",",
"refs",
"prowapi",
".",
"Refs",
")",
"prowapi",
".",
"ProwJobSpec",
"{",
"pjs",
":=",
"specFromJobBase",
"(",
"p",
".",
"JobBase",
")",
"\n",
"pjs",
".",
"Type",
"=",
"prowapi",
".",
"BatchJob",
"\n",
"pjs",
".",
"<mask>",
"=",
"p",
".",
"Context",
"\n",
"pjs",
".",
"Refs",
"=",
"completePrimaryRefs",
"(",
"refs",
",",
"p",
".",
"JobBase",
")",
"\n\n",
"return",
"pjs",
"\n",
"}"
] |
11,259 | all-11260 | [
"ListOrgHooks",
"returns",
"a",
"list",
"of",
"hooks",
"for",
"the",
"org",
".",
"https",
":",
"//",
"developer",
".",
"github",
".",
"com",
"/",
"v3",
"/",
"orgs",
"/",
"hooks",
"/",
"#list",
"-",
"hooks"
] | [
"func",
"(",
"c",
"*",
"<mask>",
")",
"ListOrgHooks",
"(",
"org",
"string",
")",
"(",
"[",
"]",
"Hook",
",",
"error",
")",
"{",
"c",
".",
"log",
"(",
"\"",
"\"",
",",
"org",
")",
"\n",
"return",
"c",
".",
"listHooks",
"(",
"org",
",",
"nil",
")",
"\n",
"}"
] |
11,260 | all-11261 | [
"GetRecoveryWindow",
"returns",
"the",
"RecoveryWindow",
"field",
"if",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"."
] | [
"func",
"(",
"t",
"*",
"ThresholdWindows",
")",
"GetRecoveryWindow",
"(",
")",
"string",
"{",
"if",
"t",
"==",
"nil",
"||",
"t",
".",
"RecoveryWindow",
"==",
"nil",
"{",
"return",
"\"",
"\"",
"\n",
"}",
"\n",
"<mask>",
"*",
"t",
".",
"RecoveryWindow",
"\n",
"}"
] |
11,261 | all-11262 | [
"SetDouble",
"()",
"is",
"a",
"wrapper",
"around",
"gtk_print_settings_set_double",
"()",
"."
] | [
"func",
"(",
"ps",
"*",
"PrintSettings",
")",
"SetDouble",
"(",
"<mask>",
"string",
",",
"value",
"float64",
")",
"{",
"cstr",
":=",
"C",
".",
"CString",
"(",
"key",
")",
"\n",
"defer",
"C",
".",
"free",
"(",
"unsafe",
".",
"Pointer",
"(",
"cstr",
")",
")",
"\n",
"C",
".",
"gtk_print_settings_set_double",
"(",
"ps",
".",
"native",
"(",
")",
",",
"(",
"*",
"C",
".",
"gchar",
")",
"(",
"cstr",
")",
",",
"C",
".",
"gdouble",
"(",
"value",
")",
")",
"\n",
"}"
] |
11,262 | all-11263 | [
"ParseInLocation",
"parse",
"string",
"to",
"time",
"in",
"location"
] | [
"func",
"ParseInLocation",
"(",
"loc",
"*",
"time",
".",
"Location",
",",
"strs",
"...",
"string",
")",
"(",
"time",
".",
"Time",
",",
"error",
")",
"{",
"return",
"New",
"(",
"<mask>",
".",
"Now",
"(",
")",
".",
"In",
"(",
"loc",
")",
")",
".",
"Parse",
"(",
"strs",
"...",
")",
"\n",
"}"
] |
11,263 | all-11264 | [
"uint16ListToStringList",
"is",
"used",
"to",
"reduce",
"lines",
"for",
"joining",
"strings",
"in",
"the",
"CreateNmapArgs",
"function"
] | [
"func",
"uint16ListToStringList",
"(",
"<mask>",
"[",
"]",
"uint16",
")",
"(",
"o",
"[",
"]",
"string",
")",
"{",
"for",
"_",
",",
"s",
":=",
"range",
"source",
"{",
"o",
"=",
"append",
"(",
"o",
",",
"strconv",
".",
"FormatUint",
"(",
"uint64",
"(",
"s",
")",
",",
"10",
")",
")",
"\n",
"}",
"\n",
"return",
"\n",
"}"
] |
11,264 | all-11265 | [
"DatastoreFolderFromObject",
"returns",
"an",
"*",
"object",
".",
"Folder",
"from",
"a",
"given",
"object",
"and",
"relative",
"datastore",
"folder",
"path",
".",
"If",
"no",
"such",
"folder",
"is",
"found",
"of",
"if",
"it",
"is",
"not",
"a",
"datastore",
"folder",
"an",
"appropriate",
"error",
"will",
"be",
"returned",
"."
] | [
"func",
"DatastoreFolderFromObject",
"(",
"client",
"*",
"govmomi",
".",
"Client",
",",
"obj",
"interface",
"{",
"}",
",",
"<mask>",
"string",
")",
"(",
"*",
"object",
".",
"Folder",
",",
"error",
")",
"{",
"folder",
",",
"err",
":=",
"folderFromObject",
"(",
"client",
",",
"obj",
",",
"RootPathParticleDatastore",
",",
"relative",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"return",
"validateDatastoreFolder",
"(",
"folder",
")",
"\n",
"}"
] |
11,265 | all-11266 | [
"OverrideFont",
"is",
"a",
"wrapper",
"around",
"gtk_widget_override_font",
"()",
"."
] | [
"func",
"(",
"v",
"*",
"Widget",
")",
"OverrideFont",
"(",
"<mask>",
"string",
")",
"{",
"cstr",
":=",
"C",
".",
"CString",
"(",
"description",
")",
"\n",
"defer",
"C",
".",
"free",
"(",
"unsafe",
".",
"Pointer",
"(",
"cstr",
")",
")",
"\n",
"c",
":=",
"C",
".",
"pango_font_description_from_string",
"(",
"cstr",
")",
"\n",
"C",
".",
"gtk_widget_override_font",
"(",
"v",
".",
"native",
"(",
")",
",",
"c",
")",
"\n",
"}"
] |
11,266 | all-11267 | [
"NewTemplateSet",
"initializes",
"a",
"new",
"empty",
"template",
"set",
"."
] | [
"func",
"NewTemplateSet",
"(",
")",
"*",
"TemplateSet",
"{",
"return",
"&",
"TemplateSet",
"{",
"sets",
":",
"make",
"(",
"<mask>",
"[",
"string",
"]",
"*",
"template",
".",
"Template",
")",
",",
"dirs",
":",
"make",
"(",
"map",
"[",
"string",
"]",
"string",
")",
",",
"}",
"\n",
"}"
] |
11,267 | all-11268 | [
"UnmarshalJSON",
"supports",
"json",
".",
"Unmarshaler",
"interface"
] | [
"func",
"(",
"v",
"*",
"StopReturns",
")",
"UnmarshalJSON",
"(",
"data",
"[",
"]",
"byte",
")",
"error",
"{",
"r",
":=",
"jlexer",
".",
"Lexer",
"{",
"Data",
":",
"<mask>",
"}",
"\n",
"easyjsonC5a4559bDecodeGithubComChromedpCdprotoProfiler7",
"(",
"&",
"r",
",",
"v",
")",
"\n",
"return",
"r",
".",
"Error",
"(",
")",
"\n",
"}"
] |
11,268 | all-11269 | [
"NewContextFunc",
"creates",
"a",
"new",
"function",
"that",
"can",
"be",
"used",
"to",
"store",
"and",
"access",
"arbitrary",
"data",
"by",
"keys",
"."
] | [
"func",
"NewContextFunc",
"(",
"m",
"map",
"[",
"string",
"]",
"interface",
"{",
"}",
")",
"func",
"(",
"string",
")",
"interface",
"{",
"}",
"{",
"return",
"func",
"(",
"key",
"string",
")",
"interface",
"{",
"}",
"{",
"if",
"value",
",",
"ok",
":=",
"m",
"[",
"key",
"]",
";",
"ok",
"{",
"return",
"<mask>",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}",
"\n",
"}"
] |
11,269 | all-11270 | [
"ValidateBoolStringPtr",
"validates",
"that",
"the",
"input",
"value",
"can",
"be",
"parsed",
"by",
"ParseBool",
".",
"It",
"also",
"succeeds",
"on",
"empty",
"strings",
".",
"This",
"is",
"designed",
"to",
"address",
"the",
"current",
"lack",
"of",
"HCL",
"and",
"Terraform",
"to",
"be",
"able",
"to",
"distinguish",
"between",
"nil",
"states",
"and",
"zero",
"values",
"properly",
".",
"This",
"is",
"a",
"systemic",
"issue",
"that",
"affects",
"reading",
"writing",
"and",
"diffing",
"of",
"these",
"values",
".",
"These",
"issues",
"will",
"eventually",
"be",
"addressed",
"in",
"HCL2",
"."
] | [
"func",
"ValidateBoolStringPtr",
"(",
")",
"schema",
".",
"SchemaValidateFunc",
"{",
"return",
"func",
"(",
"i",
"interface",
"{",
"}",
",",
"k",
"string",
")",
"(",
"s",
"[",
"]",
"string",
",",
"es",
"[",
"]",
"error",
")",
"{",
"v",
":=",
"i",
".",
"(",
"string",
")",
"\n",
"if",
"v",
"==",
"\"",
"\"",
"{",
"return",
"\n",
"}",
"\n",
"if",
"_",
",",
"err",
":=",
"strconv",
".",
"ParseBool",
"(",
"v",
")",
";",
"err",
"!=",
"nil",
"{",
"<mask>",
"=",
"append",
"(",
"es",
",",
"err",
")",
"\n",
"}",
"\n",
"return",
"\n",
"}",
"\n",
"}"
] |
11,270 | all-11271 | [
"String",
"returns",
"the",
"textual",
"representation",
"of",
"the",
"stack"
] | [
"func",
"(",
"s",
"*",
"Stack",
")",
"<mask>",
"(",
")",
"string",
"{",
"buf",
":=",
"bytes",
".",
"Buffer",
"{",
"}",
"\n",
"for",
"k",
",",
"v",
":=",
"range",
"*",
"s",
"{",
"fmt",
".",
"Fprintf",
"(",
"&",
"buf",
",",
"\"",
"\\n",
"\"",
",",
"k",
",",
"v",
")",
"\n",
"}",
"\n",
"return",
"buf",
".",
"String",
"(",
")",
"\n",
"}"
] |
11,271 | all-11272 | [
"GetTitle",
"returns",
"the",
"Title",
"field",
"if",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"."
] | [
"func",
"(",
"s",
"*",
"Screenboard",
")",
"GetTitle",
"(",
")",
"<mask>",
"{",
"if",
"s",
"==",
"nil",
"||",
"s",
".",
"Title",
"==",
"nil",
"{",
"return",
"\"",
"\"",
"\n",
"}",
"\n",
"return",
"*",
"s",
".",
"Title",
"\n",
"}"
] |
11,272 | all-11273 | [
"SetPrintSettings",
"()",
"is",
"a",
"wrapper",
"around",
"gtk_print_operation_set_print_settings",
"()",
"."
] | [
"func",
"(",
"po",
"*",
"PrintOperation",
")",
"SetPrintSettings",
"(",
"<mask>",
"*",
"PrintSettings",
")",
"{",
"C",
".",
"gtk_print_operation_set_print_settings",
"(",
"po",
".",
"native",
"(",
")",
",",
"ps",
".",
"native",
"(",
")",
")",
"\n",
"}"
] |
11,273 | all-11274 | [
"MutateTransaction",
"for",
"ManageOfferBuilder",
"causes",
"the",
"underylying",
"ManageData",
"to",
"be",
"added",
"to",
"the",
"operation",
"list",
"for",
"the",
"provided",
"transaction"
] | [
"func",
"(",
"m",
"ManageOfferBuilder",
")",
"MutateTransaction",
"(",
"o",
"*",
"TransactionBuilder",
")",
"error",
"{",
"if",
"m",
".",
"Err",
"!=",
"nil",
"{",
"return",
"m",
".",
"Err",
"\n",
"}",
"\n\n",
"if",
"m",
".",
"PassiveOffer",
"{",
"m",
".",
"O",
".",
"<mask>",
",",
"m",
".",
"Err",
"=",
"xdr",
".",
"NewOperationBody",
"(",
"xdr",
".",
"OperationTypeCreatePassiveOffer",
",",
"m",
".",
"PO",
")",
"\n",
"o",
".",
"TX",
".",
"Operations",
"=",
"append",
"(",
"o",
".",
"TX",
".",
"Operations",
",",
"m",
".",
"O",
")",
"\n",
"}",
"else",
"{",
"m",
".",
"O",
".",
"Body",
",",
"m",
".",
"Err",
"=",
"xdr",
".",
"NewOperationBody",
"(",
"xdr",
".",
"OperationTypeManageOffer",
",",
"m",
".",
"MO",
")",
"\n",
"o",
".",
"TX",
".",
"Operations",
"=",
"append",
"(",
"o",
".",
"TX",
".",
"Operations",
",",
"m",
".",
"O",
")",
"\n",
"}",
"\n",
"return",
"m",
".",
"Err",
"\n",
"}"
] |
11,274 | all-11275 | [
"TraceExternal",
"adds",
"an",
"external",
"segment",
"to",
"the",
"newrelic",
"transaction",
"if",
"one",
"exists",
"in",
"the",
"context",
"."
] | [
"func",
"TraceExternal",
"(",
"ctx",
"context",
".",
"Context",
",",
"host",
",",
"name",
"string",
")",
"*",
"Trace",
"{",
"return",
"trace",
"(",
"ctx",
",",
"name",
",",
"func",
"(",
"tx",
"Tx",
")",
"error",
"{",
"return",
"<mask>",
".",
"StartExternal",
"(",
"host",
",",
"name",
")",
"\n",
"}",
")",
"\n",
"}"
] |
11,275 | all-11276 | [
"virtualMachinesForTag",
"discovers",
"all",
"of",
"the",
"virtual",
"machines",
"that",
"match",
"a",
"specific",
"tag",
"ID",
"and",
"returns",
"their",
"higher",
"level",
"helper",
"objects",
"."
] | [
"func",
"virtualMachinesForTag",
"(",
"ctx",
"context",
".",
"Context",
",",
"client",
"*",
"vSphereClient",
",",
"id",
"string",
")",
"(",
"[",
"]",
"*",
"object",
".",
"VirtualMachine",
",",
"error",
")",
"{",
"logger",
".",
"Printf",
"(",
"\"",
"\"",
",",
"id",
")",
"\n\n",
"var",
"vms",
"[",
"]",
"*",
"object",
".",
"VirtualMachine",
"\n\n",
"objs",
",",
"err",
":=",
"client",
".",
"TagsClient",
".",
"ListAttachedObjects",
"(",
"ctx",
",",
"id",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"for",
"i",
",",
"obj",
":=",
"range",
"objs",
"{",
"<mask>",
"{",
"case",
"obj",
".",
"Type",
"==",
"nil",
"||",
"obj",
".",
"ID",
"==",
"nil",
":",
"logger",
".",
"Printf",
"(",
"\"",
"\"",
",",
"i",
")",
"\n",
"continue",
"\n",
"case",
"*",
"obj",
".",
"Type",
"!=",
"\"",
"\"",
":",
"logger",
".",
"Printf",
"(",
"\"",
"\"",
",",
"*",
"obj",
".",
"ID",
")",
"\n",
"continue",
"\n",
"}",
"\n",
"vm",
",",
"err",
":=",
"virtualMachineFromMOID",
"(",
"ctx",
",",
"client",
".",
"VimClient",
",",
"*",
"obj",
".",
"ID",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"*",
"obj",
".",
"ID",
",",
"err",
")",
"\n",
"}",
"\n",
"vms",
"=",
"append",
"(",
"vms",
",",
"vm",
")",
"\n",
"}",
"\n\n",
"logger",
".",
"Printf",
"(",
"\"",
"\"",
",",
"virtualMachineNames",
"(",
"vms",
")",
")",
"\n",
"return",
"vms",
",",
"nil",
"\n",
"}"
] |
11,276 | all-11277 | [
"DeleteNode",
"deletes",
"an",
"item",
"by",
"specifying",
"its",
"skiplist",
"Node",
".",
"Using",
"this",
"API",
"can",
"avoid",
"a",
"O",
"(",
"logn",
")",
"lookup",
"during",
"Delete",
"()",
"."
] | [
"func",
"(",
"w",
"*",
"Writer",
")",
"DeleteNode",
"(",
"x",
"*",
"skiplist",
".",
"Node",
")",
"(",
"success",
"bool",
")",
"{",
"defer",
"func",
"(",
")",
"{",
"if",
"<mask>",
"{",
"w",
".",
"count",
"--",
"\n",
"}",
"\n",
"}",
"(",
")",
"\n\n",
"x",
".",
"GClink",
"=",
"nil",
"\n",
"sn",
":=",
"w",
".",
"getCurrSn",
"(",
")",
"\n",
"gotItem",
":=",
"(",
"*",
"Item",
")",
"(",
"x",
".",
"Item",
"(",
")",
")",
"\n",
"if",
"gotItem",
".",
"bornSn",
"==",
"sn",
"{",
"success",
"=",
"w",
".",
"store",
".",
"DeleteNode",
"(",
"x",
",",
"w",
".",
"insCmp",
",",
"w",
".",
"buf",
",",
"&",
"w",
".",
"slSts1",
")",
"\n\n",
"barrier",
":=",
"w",
".",
"store",
".",
"GetAccesBarrier",
"(",
")",
"\n",
"barrier",
".",
"FlushSession",
"(",
"unsafe",
".",
"Pointer",
"(",
"x",
")",
")",
"\n",
"return",
"\n",
"}",
"\n\n",
"success",
"=",
"atomic",
".",
"CompareAndSwapUint32",
"(",
"&",
"gotItem",
".",
"deadSn",
",",
"0",
",",
"sn",
")",
"\n",
"if",
"success",
"{",
"if",
"w",
".",
"gctail",
"==",
"nil",
"{",
"w",
".",
"gctail",
"=",
"x",
"\n",
"w",
".",
"gchead",
"=",
"w",
".",
"gctail",
"\n",
"}",
"else",
"{",
"w",
".",
"gctail",
".",
"GClink",
"=",
"x",
"\n",
"w",
".",
"gctail",
"=",
"x",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"\n",
"}"
] |
11,277 | all-11278 | [
"Repaint",
"draws",
"the",
"control",
"on",
"its",
"View",
"surface"
] | [
"func",
"(",
"b",
"*",
"SparkChart",
")",
"Draw",
"(",
")",
"{",
"if",
"b",
".",
"hidden",
"{",
"return",
"\n",
"}",
"\n\n",
"b",
".",
"mtx",
".",
"RLock",
"(",
")",
"\n",
"defer",
"b",
".",
"mtx",
".",
"RUnlock",
"(",
")",
"\n\n",
"PushAttributes",
"(",
")",
"\n",
"defer",
"PopAttributes",
"(",
")",
"\n\n",
"fg",
",",
"bg",
":=",
"RealColor",
"(",
"b",
".",
"fg",
",",
"b",
".",
"Style",
"(",
")",
",",
"ColorSparkChartText",
")",
",",
"RealColor",
"(",
"b",
".",
"bg",
",",
"b",
".",
"Style",
"(",
")",
",",
"ColorSparkChartBack",
")",
"\n",
"SetTextColor",
"(",
"fg",
")",
"\n",
"SetBackColor",
"(",
"bg",
")",
"\n",
"FillRect",
"(",
"b",
".",
"x",
",",
"b",
".",
"y",
",",
"b",
".",
"width",
",",
"b",
".",
"<mask>",
",",
"' '",
")",
"\n\n",
"if",
"len",
"(",
"b",
".",
"data",
")",
"==",
"0",
"{",
"return",
"\n",
"}",
"\n\n",
"b",
".",
"drawValues",
"(",
")",
"\n",
"b",
".",
"drawBars",
"(",
")",
"\n",
"}"
] |
11,278 | all-11279 | [
"IconViewNew",
"is",
"a",
"wrapper",
"around",
"gtk_icon_view_new",
"()",
"."
] | [
"func",
"IconViewNew",
"(",
")",
"(",
"*",
"IconView",
",",
"error",
")",
"{",
"c",
":=",
"C",
".",
"gtk_icon_view_new",
"(",
")",
"\n",
"if",
"c",
"==",
"nil",
"{",
"return",
"nil",
",",
"nilPtrErr",
"\n",
"}",
"\n\n",
"<mask>",
"wrapIconView",
"(",
"glib",
".",
"Take",
"(",
"unsafe",
".",
"Pointer",
"(",
"c",
")",
")",
")",
",",
"nil",
"\n",
"}"
] |
11,279 | all-11280 | [
"CellRendererToggleNew",
"is",
"a",
"wrapper",
"around",
"gtk_cell_renderer_toggle_new",
"()",
"."
] | [
"func",
"CellRendererToggleNew",
"(",
")",
"(",
"*",
"CellRendererToggle",
",",
"<mask>",
")",
"{",
"c",
":=",
"C",
".",
"gtk_cell_renderer_toggle_new",
"(",
")",
"\n",
"if",
"c",
"==",
"nil",
"{",
"return",
"nil",
",",
"nilPtrErr",
"\n",
"}",
"\n",
"obj",
":=",
"glib",
".",
"Take",
"(",
"unsafe",
".",
"Pointer",
"(",
"c",
")",
")",
"\n",
"return",
"wrapCellRendererToggle",
"(",
"obj",
")",
",",
"nil",
"\n",
"}"
] |
11,280 | all-11281 | [
"NewPrettyEncoder",
"returns",
"a",
"new",
"JSON",
"encoder",
"that",
"writes",
"to",
"w",
"."
] | [
"func",
"NewPrettyEncoder",
"(",
"w",
"io",
".",
"<mask>",
")",
"*",
"objconv",
".",
"Encoder",
"{",
"return",
"objconv",
".",
"NewEncoder",
"(",
"NewPrettyEmitter",
"(",
"w",
")",
")",
"\n",
"}"
] |
11,281 | all-11282 | [
"Get",
"an",
"entry",
"from",
"the",
"hash",
"table",
"."
] | [
"func",
"(",
"c",
"*",
"CHD",
")",
"Get",
"(",
"key",
"[",
"]",
"byte",
")",
"[",
"]",
"byte",
"{",
"r0",
":=",
"c",
".",
"r",
"[",
"0",
"]",
"\n",
"h",
":=",
"hasher",
"(",
"key",
")",
"^",
"r0",
"\n",
"i",
":=",
"h",
"%",
"uint64",
"(",
"len",
"(",
"c",
".",
"indices",
")",
")",
"\n",
"ri",
":=",
"c",
".",
"indices",
"[",
"i",
"]",
"\n",
"// This can occur if there were unassigned slots in the hash table.",
"if",
"ri",
">=",
"uint16",
"(",
"len",
"(",
"c",
".",
"r",
")",
")",
"{",
"return",
"nil",
"\n",
"}",
"\n",
"r",
":=",
"c",
".",
"r",
"[",
"ri",
"]",
"\n",
"ti",
":=",
"(",
"h",
"^",
"r",
")",
"%",
"uint64",
"(",
"len",
"(",
"c",
".",
"keys",
")",
")",
"\n",
"// fmt.Printf(\"r[0]=%d, h=%d, i=%d, ri=%d, r=%d, ti=%d\\n\", c.r[0], h, i, ri, r, ti)",
"k",
":=",
"c",
".",
"<mask>",
"[",
"ti",
"]",
"\n",
"if",
"bytes",
".",
"Compare",
"(",
"k",
",",
"key",
")",
"!=",
"0",
"{",
"return",
"nil",
"\n",
"}",
"\n",
"v",
":=",
"c",
".",
"values",
"[",
"ti",
"]",
"\n",
"return",
"v",
"\n",
"}"
] |
11,282 | all-11283 | [
"UnmarshalJSON",
"supports",
"json",
".",
"Unmarshaler",
"interface"
] | [
"func",
"(",
"v",
"*",
"EventWorkerErrorReported",
")",
"UnmarshalJSON",
"(",
"data",
"[",
"]",
"<mask>",
")",
"error",
"{",
"r",
":=",
"jlexer",
".",
"Lexer",
"{",
"Data",
":",
"data",
"}",
"\n",
"easyjsonC5a4559bDecodeGithubComChromedpCdprotoServiceworker12",
"(",
"&",
"r",
",",
"v",
")",
"\n",
"return",
"r",
".",
"Error",
"(",
")",
"\n",
"}"
] |
11,283 | all-11284 | [
"processTagDiff",
"wraps",
"the",
"whole",
"tag",
"diffing",
"operation",
"into",
"a",
"nice",
"clean",
"function",
"that",
"resources",
"can",
"use",
"."
] | [
"func",
"processTagDiff",
"(",
"client",
"*",
"tags",
".",
"RestClient",
",",
"d",
"*",
"schema",
".",
"ResourceData",
",",
"obj",
"object",
".",
"Reference",
")",
"error",
"{",
"log",
".",
"Printf",
"(",
"\"",
"\"",
",",
"obj",
".",
"Reference",
"(",
")",
".",
"Value",
")",
"\n",
"old",
",",
"new",
":=",
"d",
".",
"GetChange",
"(",
"vSphereTagAttributeKey",
")",
"\n",
"tdp",
":=",
"&",
"tagDiffProcessor",
"{",
"<mask>",
":",
"client",
",",
"subject",
":",
"obj",
",",
"oldTagIDs",
":",
"structure",
".",
"SliceInterfacesToStrings",
"(",
"old",
".",
"(",
"*",
"schema",
".",
"Set",
")",
".",
"List",
"(",
")",
")",
",",
"newTagIDs",
":",
"structure",
".",
"SliceInterfacesToStrings",
"(",
"new",
".",
"(",
"*",
"schema",
".",
"Set",
")",
".",
"List",
"(",
")",
")",
",",
"}",
"\n",
"if",
"err",
":=",
"tdp",
".",
"processDetachOperations",
"(",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"obj",
".",
"Reference",
"(",
")",
".",
"Value",
",",
"err",
")",
"\n",
"}",
"\n",
"if",
"err",
":=",
"tdp",
".",
"processAttachOperations",
"(",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"obj",
".",
"Reference",
"(",
")",
".",
"Value",
",",
"err",
")",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
] |
11,284 | all-11285 | [
"SelectPath",
"is",
"a",
"wrapper",
"around",
"gtk_tree_selection_select_path",
"()",
"."
] | [
"func",
"(",
"v",
"*",
"TreeSelection",
")",
"SelectPath",
"(",
"<mask>",
"*",
"TreePath",
")",
"{",
"C",
".",
"gtk_tree_selection_select_path",
"(",
"v",
".",
"native",
"(",
")",
",",
"path",
".",
"native",
"(",
")",
")",
"\n",
"}"
] |
11,285 | all-11286 | [
"Run",
"will",
"start",
"the",
"initupload",
"job",
"to",
"upload",
"the",
"artifacts",
"logs",
"and",
"clone",
"status",
"."
] | [
"func",
"(",
"o",
"Options",
")",
"Run",
"(",
")",
"error",
"{",
"<mask>",
",",
"err",
":=",
"downwardapi",
".",
"ResolveSpecFromEnv",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"}",
"\n\n",
"uploadTargets",
":=",
"map",
"[",
"string",
"]",
"gcs",
".",
"UploadFunc",
"{",
"}",
"\n\n",
"var",
"failed",
"bool",
"\n",
"var",
"mainRefSHA",
"string",
"\n",
"if",
"o",
".",
"Log",
"!=",
"\"",
"\"",
"{",
"if",
"failed",
",",
"mainRefSHA",
",",
"err",
"=",
"processCloneLog",
"(",
"o",
".",
"Log",
",",
"uploadTargets",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"}",
"\n\n",
"started",
":=",
"specToStarted",
"(",
"spec",
",",
"mainRefSHA",
")",
"\n\n",
"startedData",
",",
"err",
":=",
"json",
".",
"Marshal",
"(",
"&",
"started",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"}",
"\n\n",
"uploadTargets",
"[",
"\"",
"\"",
"]",
"=",
"gcs",
".",
"DataUpload",
"(",
"bytes",
".",
"NewReader",
"(",
"startedData",
")",
")",
"\n\n",
"if",
"err",
":=",
"o",
".",
"Options",
".",
"Run",
"(",
"spec",
",",
"uploadTargets",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"}",
"\n\n",
"if",
"failed",
"{",
"return",
"errors",
".",
"New",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"return",
"nil",
"\n",
"}"
] |
11,286 | all-11287 | [
"acceptLoop",
"launches",
"each",
"TLS",
"handshake",
"in",
"a",
"separate",
"goroutine",
"to",
"prevent",
"a",
"hanging",
"TLS",
"connection",
"from",
"blocking",
"other",
"connections",
"."
] | [
"func",
"(",
"l",
"*",
"tlsListener",
")",
"acceptLoop",
"(",
")",
"{",
"var",
"wg",
"sync",
".",
"WaitGroup",
"\n",
"var",
"pendingMu",
"sync",
".",
"Mutex",
"\n\n",
"pending",
":=",
"make",
"(",
"map",
"[",
"net",
".",
"Conn",
"]",
"struct",
"{",
"}",
")",
"\n",
"ctx",
",",
"cancel",
":=",
"context",
".",
"WithCancel",
"(",
"context",
".",
"Background",
"(",
")",
")",
"\n",
"defer",
"func",
"(",
")",
"{",
"cancel",
"(",
")",
"\n",
"pendingMu",
".",
"Lock",
"(",
")",
"\n",
"for",
"c",
":=",
"range",
"pending",
"{",
"c",
".",
"Close",
"(",
")",
"\n",
"}",
"\n",
"pendingMu",
".",
"Unlock",
"(",
")",
"\n",
"wg",
".",
"Wait",
"(",
")",
"\n",
"close",
"(",
"l",
".",
"donec",
")",
"\n",
"}",
"(",
")",
"\n\n",
"for",
"{",
"conn",
",",
"err",
":=",
"l",
".",
"Listener",
".",
"Accept",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"l",
".",
"err",
"=",
"err",
"\n",
"return",
"\n",
"}",
"\n\n",
"pendingMu",
".",
"Lock",
"(",
")",
"\n",
"pending",
"[",
"conn",
"]",
"=",
"struct",
"{",
"}",
"{",
"}",
"\n",
"pendingMu",
".",
"Unlock",
"(",
")",
"\n\n",
"wg",
".",
"Add",
"(",
"1",
")",
"\n",
"go",
"func",
"(",
")",
"{",
"defer",
"func",
"(",
")",
"{",
"if",
"conn",
"!=",
"nil",
"{",
"conn",
".",
"Close",
"(",
")",
"\n",
"}",
"\n",
"wg",
".",
"Done",
"(",
")",
"\n",
"}",
"(",
")",
"\n\n",
"tlsConn",
":=",
"conn",
".",
"(",
"*",
"tls",
".",
"Conn",
")",
"\n",
"herr",
":=",
"tlsConn",
".",
"Handshake",
"(",
")",
"\n",
"pendingMu",
".",
"Lock",
"(",
")",
"\n",
"delete",
"(",
"pending",
",",
"conn",
")",
"\n",
"pendingMu",
".",
"Unlock",
"(",
")",
"\n\n",
"if",
"herr",
"!=",
"nil",
"{",
"l",
".",
"handshakeFailure",
"(",
"tlsConn",
",",
"herr",
")",
"\n",
"return",
"\n",
"}",
"\n",
"if",
"err",
":=",
"l",
".",
"<mask>",
"(",
"ctx",
",",
"tlsConn",
")",
";",
"err",
"!=",
"nil",
"{",
"l",
".",
"handshakeFailure",
"(",
"tlsConn",
",",
"err",
")",
"\n",
"return",
"\n",
"}",
"\n\n",
"select",
"{",
"case",
"l",
".",
"connc",
"<-",
"tlsConn",
":",
"conn",
"=",
"nil",
"\n",
"case",
"<-",
"ctx",
".",
"Done",
"(",
")",
":",
"}",
"\n",
"}",
"(",
")",
"\n",
"}",
"\n",
"}"
] |
11,287 | all-11288 | [
"UnmarshalJSON",
"supports",
"json",
".",
"Unmarshaler",
"interface"
] | [
"func",
"(",
"v",
"*",
"EventAddHeapSnapshotChunk",
")",
"UnmarshalJSON",
"(",
"data",
"[",
"]",
"byte",
")",
"error",
"{",
"r",
":=",
"jlexer",
".",
"Lexer",
"{",
"Data",
":",
"<mask>",
"}",
"\n",
"easyjsonC5a4559bDecodeGithubComChromedpCdprotoHeapprofiler19",
"(",
"&",
"r",
",",
"v",
")",
"\n",
"return",
"r",
".",
"Error",
"(",
")",
"\n",
"}"
] |
11,288 | all-11289 | [
"MainLoop",
"starts",
"the",
"main",
"application",
"event",
"loop"
] | [
"func",
"MainLoop",
"(",
")",
"{",
"RefreshScreen",
"(",
")",
"\n\n",
"eventQueue",
":=",
"<mask>",
"(",
"chan",
"term",
".",
"Event",
")",
"\n",
"go",
"func",
"(",
")",
"{",
"for",
"{",
"eventQueue",
"<-",
"term",
".",
"PollEvent",
"(",
")",
"\n",
"}",
"\n",
"}",
"(",
")",
"\n\n",
"for",
"{",
"RefreshScreen",
"(",
")",
"\n\n",
"select",
"{",
"case",
"ev",
":=",
"<-",
"eventQueue",
":",
"switch",
"ev",
".",
"Type",
"{",
"case",
"term",
".",
"EventError",
":",
"panic",
"(",
"ev",
".",
"Err",
")",
"\n",
"default",
":",
"ProcessEvent",
"(",
"termboxEventToLocal",
"(",
"ev",
")",
")",
"\n",
"}",
"\n",
"case",
"cmd",
":=",
"<-",
"loop",
".",
"channel",
":",
"if",
"cmd",
".",
"Type",
"==",
"EventQuit",
"{",
"return",
"\n",
"}",
"\n",
"ProcessEvent",
"(",
"cmd",
")",
"\n",
"}",
"\n",
"}",
"\n",
"}"
] |
11,289 | all-11290 | [
"ProxyRequestFromContext",
"extracts",
"the",
"APIGatewayProxyRequest",
"event",
"from",
"ctx",
"."
] | [
"func",
"ProxyRequestFromContext",
"(",
"ctx",
"context",
".",
"Context",
")",
"(",
"events",
".",
"APIGatewayProxyRequest",
",",
"bool",
")",
"{",
"event",
",",
"ok",
":=",
"ctx",
".",
"Value",
"(",
"requestContextKey",
")",
".",
"(",
"<mask>",
".",
"APIGatewayProxyRequest",
")",
"\n",
"return",
"event",
",",
"ok",
"\n",
"}"
] |
11,290 | all-11291 | [
"WriteString",
"appends",
"s",
"to",
"response",
"body",
"."
] | [
"func",
"(",
"ctx",
"*",
"RequestCtx",
")",
"WriteString",
"(",
"s",
"string",
")",
"(",
"int",
",",
"error",
")",
"{",
"ctx",
".",
"<mask>",
".",
"AppendBodyString",
"(",
"s",
")",
"\n",
"return",
"len",
"(",
"s",
")",
",",
"nil",
"\n",
"}"
] |
11,291 | all-11292 | [
"GetContainerNetworkMetadata",
"returns",
"the",
"network",
"metadata",
"for",
"the",
"container"
] | [
"func",
"GetContainerNetworkMetadata",
"(",
"containerID",
"string",
",",
"state",
"dockerstate",
".",
"TaskEngineState",
")",
"(",
"[",
"]",
"containermetadata",
".",
"Network",
",",
"error",
")",
"{",
"dockerContainer",
",",
"ok",
":=",
"state",
".",
"ContainerByID",
"(",
"containerID",
")",
"\n",
"if",
"!",
"ok",
"{",
"return",
"nil",
",",
"errors",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"containerID",
")",
"\n",
"}",
"\n",
"// the logic here has been reused from",
"// https://github.com/aws/amazon-ecs-agent/blob/0c8913ba33965cf6ffdd6253fad422458d9346bd/agent/containermetadata/parse_metadata.go#L123",
"settings",
":=",
"dockerContainer",
".",
"<mask>",
".",
"GetNetworkSettings",
"(",
")",
"\n",
"if",
"settings",
"==",
"nil",
"{",
"return",
"nil",
",",
"errors",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"containerID",
")",
"\n",
"}",
"\n",
"// This metadata is the information provided in older versions of the API",
"// We get the NetworkMode (Network interface name) from the HostConfig because this",
"// this is the network with which the container is created",
"ipv4AddressFromSettings",
":=",
"settings",
".",
"IPAddress",
"\n",
"networkModeFromHostConfig",
":=",
"dockerContainer",
".",
"Container",
".",
"GetNetworkMode",
"(",
")",
"\n\n",
"// Extensive Network information is not available for Docker API versions 1.17-1.20",
"// Instead we only get the details of the first network",
"networks",
":=",
"make",
"(",
"[",
"]",
"containermetadata",
".",
"Network",
",",
"0",
")",
"\n",
"if",
"len",
"(",
"settings",
".",
"Networks",
")",
">",
"0",
"{",
"for",
"modeFromSettings",
",",
"containerNetwork",
":=",
"range",
"settings",
".",
"Networks",
"{",
"networkMode",
":=",
"modeFromSettings",
"\n",
"ipv4Addresses",
":=",
"[",
"]",
"string",
"{",
"containerNetwork",
".",
"IPAddress",
"}",
"\n",
"network",
":=",
"containermetadata",
".",
"Network",
"{",
"NetworkMode",
":",
"networkMode",
",",
"IPv4Addresses",
":",
"ipv4Addresses",
"}",
"\n",
"networks",
"=",
"append",
"(",
"networks",
",",
"network",
")",
"\n",
"}",
"\n",
"}",
"else",
"{",
"ipv4Addresses",
":=",
"[",
"]",
"string",
"{",
"ipv4AddressFromSettings",
"}",
"\n",
"network",
":=",
"containermetadata",
".",
"Network",
"{",
"NetworkMode",
":",
"networkModeFromHostConfig",
",",
"IPv4Addresses",
":",
"ipv4Addresses",
"}",
"\n",
"networks",
"=",
"append",
"(",
"networks",
",",
"network",
")",
"\n",
"}",
"\n",
"return",
"networks",
",",
"nil",
"\n",
"}"
] |
11,292 | all-11293 | [
"IpAddressLocator",
"builds",
"a",
"locator",
"from",
"the",
"given",
"href",
"."
] | [
"func",
"(",
"api",
"*",
"API",
")",
"IpAddressLocator",
"(",
"href",
"<mask>",
")",
"*",
"IpAddressLocator",
"{",
"return",
"&",
"IpAddressLocator",
"{",
"Href",
"(",
"href",
")",
",",
"api",
"}",
"\n",
"}"
] |
11,293 | all-11294 | [
"/",
"*",
"FindVmsByStates",
"finds",
"vms",
"by",
"states"
] | [
"func",
"(",
"a",
"*",
"<mask>",
")",
"FindVmsByStates",
"(",
"params",
"*",
"FindVmsByStatesParams",
")",
"(",
"*",
"FindVmsByStatesOK",
",",
"error",
")",
"{",
"// TODO: Validate the params before sending",
"if",
"params",
"==",
"nil",
"{",
"params",
"=",
"NewFindVmsByStatesParams",
"(",
")",
"\n",
"}",
"\n\n",
"result",
",",
"err",
":=",
"a",
".",
"transport",
".",
"Submit",
"(",
"&",
"runtime",
".",
"ClientOperation",
"{",
"ID",
":",
"\"",
"\"",
",",
"Method",
":",
"\"",
"\"",
",",
"PathPattern",
":",
"\"",
"\"",
",",
"ProducesMediaTypes",
":",
"[",
"]",
"string",
"{",
"\"",
"\"",
"}",
",",
"ConsumesMediaTypes",
":",
"[",
"]",
"string",
"{",
"\"",
"\"",
"}",
",",
"Schemes",
":",
"[",
"]",
"string",
"{",
"\"",
"\"",
"}",
",",
"Params",
":",
"params",
",",
"Reader",
":",
"&",
"FindVmsByStatesReader",
"{",
"formats",
":",
"a",
".",
"formats",
"}",
",",
"Context",
":",
"params",
".",
"Context",
",",
"}",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"return",
"result",
".",
"(",
"*",
"FindVmsByStatesOK",
")",
",",
"nil",
"\n\n",
"}"
] |
11,294 | all-11295 | [
"SetEvents",
"is",
"a",
"wrapper",
"around",
"gtk_widget_set_events",
"()",
"."
] | [
"func",
"(",
"v",
"*",
"Widget",
")",
"SetEvents",
"(",
"events",
"int",
")",
"{",
"C",
".",
"gtk_widget_set_events",
"(",
"v",
".",
"native",
"(",
")",
",",
"C",
".",
"gint",
"(",
"<mask>",
")",
")",
"\n",
"}"
] |
11,295 | all-11296 | [
"Main",
"draws",
"the",
"tiger"
] | [
"func",
"Main",
"(",
"gc",
"draw2d",
".",
"GraphicContext",
",",
"ext",
"string",
")",
"(",
"string",
",",
"error",
")",
"{",
"gc",
".",
"Save",
"(",
")",
"\n\n",
"// flip the image",
"gc",
".",
"Translate",
"(",
"0",
",",
"200",
")",
"\n",
"gc",
".",
"Scale",
"(",
"0.35",
",",
"-",
"0.35",
")",
"\n",
"gc",
".",
"Translate",
"(",
"70",
",",
"-",
"200",
")",
"\n\n",
"// Tiger postscript drawing",
"tiger",
":=",
"samples",
".",
"<mask>",
"(",
"\"",
"\"",
",",
"\"",
"\"",
",",
"ext",
")",
"\n\n",
"// Draw tiger",
"Draw",
"(",
"gc",
",",
"tiger",
")",
"\n",
"gc",
".",
"Restore",
"(",
")",
"\n\n",
"// Return the output filename",
"return",
"samples",
".",
"Output",
"(",
"\"",
"\"",
",",
"ext",
")",
",",
"nil",
"\n",
"}"
] |
11,296 | all-11297 | [
"GetType",
"returns",
"the",
"Type",
"field",
"if",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"."
] | [
"func",
"(",
"g",
"*",
"GroupDefinition",
")",
"GetType",
"(",
")",
"string",
"{",
"if",
"g",
"==",
"nil",
"||",
"g",
".",
"Type",
"==",
"nil",
"{",
"return",
"\"",
"\"",
"\n",
"}",
"\n",
"return",
"*",
"g",
".",
"<mask>",
"\n",
"}"
] |
11,297 | all-11298 | [
"SetDevice",
"sets",
"the",
"Metal",
"device",
"responsible",
"for",
"the",
"layer",
"s",
"drawable",
"resources",
".",
"Reference",
":",
"https",
":",
"//",
"developer",
".",
"apple",
".",
"com",
"/",
"documentation",
"/",
"quartzcore",
"/",
"cametallayer",
"/",
"1478163",
"-",
"device",
"."
] | [
"func",
"(",
"ml",
"MetalLayer",
")",
"SetDevice",
"(",
"device",
"mtl",
".",
"Device",
")",
"{",
"C",
".",
"MetalLayer_SetDevice",
"(",
"ml",
".",
"metalLayer",
",",
"<mask>",
".",
"Device",
"(",
")",
")",
"\n",
"}"
] |
11,298 | all-11299 | [
"StorageVolumeNodeGet",
"returns",
"the",
"name",
"of",
"the",
"node",
"a",
"storage",
"volume",
"is",
"on",
"."
] | [
"func",
"(",
"c",
"*",
"Cluster",
")",
"StorageVolumeNodeGet",
"(",
"volumeID",
"int64",
")",
"(",
"string",
",",
"error",
")",
"{",
"name",
":=",
"\"",
"\"",
"\n",
"<mask>",
":=",
"`\nSELECT nodes.name FROM storage_volumes\n JOIN nodes ON nodes.id=storage_volumes.node_id\n WHERE storage_volumes.id=?\n`",
"\n",
"inargs",
":=",
"[",
"]",
"interface",
"{",
"}",
"{",
"volumeID",
"}",
"\n",
"outargs",
":=",
"[",
"]",
"interface",
"{",
"}",
"{",
"&",
"name",
"}",
"\n\n",
"err",
":=",
"dbQueryRowScan",
"(",
"c",
".",
"db",
",",
"query",
",",
"inargs",
",",
"outargs",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"if",
"err",
"==",
"sql",
".",
"ErrNoRows",
"{",
"return",
"\"",
"\"",
",",
"ErrNoSuchObject",
"\n",
"}",
"\n\n",
"return",
"\"",
"\"",
",",
"err",
"\n",
"}",
"\n\n",
"return",
"name",
",",
"nil",
"\n",
"}"
] |
11,299 | all-11300 | [
"Calls",
"putPart",
"up",
"to",
"nTry",
"times",
"to",
"recover",
"from",
"transient",
"errors",
"."
] | [
"func",
"(",
"p",
"*",
"putter",
")",
"retryPutPart",
"(",
"part",
"*",
"part",
")",
"{",
"defer",
"p",
".",
"wg",
".",
"Done",
"(",
")",
"\n",
"var",
"err",
"error",
"\n",
"for",
"i",
":=",
"0",
";",
"i",
"<",
"p",
".",
"c",
".",
"NTry",
";",
"i",
"++",
"{",
"err",
"=",
"p",
".",
"putPart",
"(",
"part",
")",
"\n",
"if",
"err",
"==",
"nil",
"{",
"p",
".",
"sp",
".",
"give",
"<-",
"part",
".",
"b",
"\n",
"<mask>",
".",
"b",
"=",
"nil",
"\n",
"return",
"\n",
"}",
"\n",
"logger",
".",
"debugPrintf",
"(",
"\"",
"\"",
",",
"i",
",",
"part",
".",
"PartNumber",
",",
"err",
")",
"\n",
"time",
".",
"Sleep",
"(",
"time",
".",
"Duration",
"(",
"math",
".",
"Exp2",
"(",
"float64",
"(",
"i",
")",
")",
")",
"*",
"100",
"*",
"time",
".",
"Millisecond",
")",
"// exponential back-off",
"\n",
"}",
"\n",
"p",
".",
"err",
"=",
"err",
"\n",
"}"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.