id
int32 0
25.3k
| idx
stringlengths 5
9
| nl_tokens
sequencelengths 1
418
| pl_tokens
sequencelengths 22
4.98k
|
---|---|---|---|
3,100 | all-3101 | [
"CreateAlertDialog",
"creates",
"a",
"new",
"alert",
"dialog",
".",
"title",
"is",
"a",
"dialog",
"title",
"message",
"is",
"a",
"text",
"inside",
"dialog",
"for",
"user",
"to",
"be",
"notified",
"of",
"a",
"fact",
"button",
"is",
"a",
"title",
"for",
"button",
"inside",
"dialog",
"."
] | [
"func",
"CreateAlertDialog",
"(",
"title",
",",
"<mask>",
"string",
",",
"button",
"string",
")",
"*",
"ConfirmationDialog",
"{",
"return",
"CreateConfirmationDialog",
"(",
"title",
",",
"message",
",",
"[",
"]",
"string",
"{",
"button",
"}",
",",
"0",
")",
"\n",
"}"
] |
3,101 | all-3102 | [
"saveWALAndSnap",
"creates",
"a",
"WAL",
"for",
"the",
"initial",
"cluster"
] | [
"func",
"(",
"s",
"*",
"v3Manager",
")",
"saveWALAndSnap",
"(",
")",
"error",
"{",
"if",
"err",
":=",
"fileutil",
".",
"CreateDirAll",
"(",
"s",
".",
"walDir",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"// add members again to persist them to the store we create.",
"st",
":=",
"v2store",
".",
"New",
"(",
"etcdserver",
".",
"StoreClusterPrefix",
",",
"etcdserver",
".",
"StoreKeysPrefix",
")",
"\n",
"s",
".",
"cl",
".",
"SetStore",
"(",
"st",
")",
"\n",
"for",
"_",
",",
"m",
":=",
"range",
"s",
".",
"cl",
".",
"Members",
"(",
")",
"{",
"s",
".",
"cl",
".",
"AddMember",
"(",
"m",
")",
"\n",
"}",
"\n\n",
"m",
":=",
"s",
".",
"cl",
".",
"MemberByName",
"(",
"s",
".",
"name",
")",
"\n",
"md",
":=",
"&",
"etcdserverpb",
".",
"Metadata",
"{",
"NodeID",
":",
"uint64",
"(",
"m",
".",
"ID",
")",
",",
"ClusterID",
":",
"uint64",
"(",
"s",
".",
"cl",
".",
"ID",
"(",
")",
")",
"}",
"\n",
"metadata",
",",
"merr",
":=",
"md",
".",
"Marshal",
"(",
")",
"\n",
"if",
"merr",
"!=",
"nil",
"{",
"return",
"merr",
"\n",
"}",
"\n",
"w",
",",
"walerr",
":=",
"wal",
".",
"Create",
"(",
"s",
".",
"lg",
",",
"s",
".",
"walDir",
",",
"metadata",
")",
"\n",
"if",
"walerr",
"!=",
"nil",
"{",
"return",
"walerr",
"\n",
"}",
"\n",
"defer",
"w",
".",
"Close",
"(",
")",
"\n\n",
"peers",
":=",
"make",
"(",
"[",
"]",
"raft",
".",
"Peer",
",",
"len",
"(",
"s",
".",
"cl",
".",
"MemberIDs",
"(",
")",
")",
")",
"\n",
"for",
"i",
",",
"id",
":=",
"range",
"s",
".",
"cl",
".",
"MemberIDs",
"(",
")",
"{",
"ctx",
",",
"err",
":=",
"json",
".",
"Marshal",
"(",
"(",
"*",
"s",
".",
"cl",
")",
".",
"Member",
"(",
"id",
")",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"peers",
"[",
"i",
"]",
"=",
"raft",
".",
"Peer",
"{",
"ID",
":",
"uint64",
"(",
"id",
")",
",",
"Context",
":",
"ctx",
"}",
"\n",
"}",
"\n\n",
"ents",
":=",
"make",
"(",
"[",
"]",
"raftpb",
".",
"Entry",
",",
"len",
"(",
"peers",
")",
")",
"\n",
"nodeIDs",
":=",
"make",
"(",
"[",
"]",
"uint64",
",",
"len",
"(",
"peers",
")",
")",
"\n",
"for",
"i",
",",
"p",
":=",
"range",
"peers",
"{",
"nodeIDs",
"[",
"i",
"]",
"=",
"p",
".",
"ID",
"\n",
"<mask>",
":=",
"raftpb",
".",
"ConfChange",
"{",
"Type",
":",
"raftpb",
".",
"ConfChangeAddNode",
",",
"NodeID",
":",
"p",
".",
"ID",
",",
"Context",
":",
"p",
".",
"Context",
",",
"}",
"\n",
"d",
",",
"err",
":=",
"cc",
".",
"Marshal",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"ents",
"[",
"i",
"]",
"=",
"raftpb",
".",
"Entry",
"{",
"Type",
":",
"raftpb",
".",
"EntryConfChange",
",",
"Term",
":",
"1",
",",
"Index",
":",
"uint64",
"(",
"i",
"+",
"1",
")",
",",
"Data",
":",
"d",
",",
"}",
"\n",
"}",
"\n\n",
"commit",
",",
"term",
":=",
"uint64",
"(",
"len",
"(",
"ents",
")",
")",
",",
"uint64",
"(",
"1",
")",
"\n",
"if",
"err",
":=",
"w",
".",
"Save",
"(",
"raftpb",
".",
"HardState",
"{",
"Term",
":",
"term",
",",
"Vote",
":",
"peers",
"[",
"0",
"]",
".",
"ID",
",",
"Commit",
":",
"commit",
",",
"}",
",",
"ents",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"b",
",",
"berr",
":=",
"st",
".",
"Save",
"(",
")",
"\n",
"if",
"berr",
"!=",
"nil",
"{",
"return",
"berr",
"\n",
"}",
"\n",
"raftSnap",
":=",
"raftpb",
".",
"Snapshot",
"{",
"Data",
":",
"b",
",",
"Metadata",
":",
"raftpb",
".",
"SnapshotMetadata",
"{",
"Index",
":",
"commit",
",",
"Term",
":",
"term",
",",
"ConfState",
":",
"raftpb",
".",
"ConfState",
"{",
"Nodes",
":",
"nodeIDs",
",",
"}",
",",
"}",
",",
"}",
"\n",
"sn",
":=",
"snap",
".",
"New",
"(",
"s",
".",
"lg",
",",
"s",
".",
"snapDir",
")",
"\n",
"if",
"err",
":=",
"sn",
".",
"SaveSnap",
"(",
"raftSnap",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"return",
"w",
".",
"SaveSnapshot",
"(",
"walpb",
".",
"Snapshot",
"{",
"Index",
":",
"commit",
",",
"Term",
":",
"term",
"}",
")",
"\n",
"}"
] |
3,102 | all-3103 | [
"ParseMessage",
"takes",
"a",
"string",
"and",
"attempts",
"to",
"create",
"a",
"Message",
"struct",
".",
"Returns",
"nil",
"if",
"the",
"Message",
"is",
"invalid",
".",
"TODO",
":",
"Maybe",
"just",
"use",
"sorbix",
"/",
"irc",
"if",
"we",
"can",
"be",
"without",
"the",
"custom",
"stuff?"
] | [
"func",
"ParseMessage",
"(",
"raw",
"string",
")",
"(",
"m",
"*",
"Message",
")",
"{",
"m",
"=",
"new",
"(",
"Message",
")",
"\n",
"m",
".",
"Message",
"=",
"irc",
".",
"ParseMessage",
"(",
"raw",
")",
"\n",
"m",
".",
"Content",
"=",
"m",
".",
"Trailing",
"\n\n",
"if",
"len",
"(",
"m",
".",
"Params",
")",
">",
"0",
"{",
"m",
".",
"To",
"=",
"m",
".",
"Params",
"[",
"0",
"]",
"\n",
"}",
"else",
"if",
"m",
".",
"Command",
"==",
"\"",
"\"",
"{",
"m",
".",
"To",
"=",
"m",
".",
"Trailing",
"\n",
"}",
"\n",
"if",
"m",
".",
"Prefix",
"!=",
"nil",
"{",
"m",
".",
"From",
"=",
"m",
".",
"Prefix",
".",
"Name",
"\n",
"}",
"\n",
"m",
".",
"TimeStamp",
"=",
"<mask>",
".",
"Now",
"(",
")",
"\n\n",
"return",
"m",
"\n",
"}"
] |
3,103 | all-3104 | [
"Handle",
"payload",
"params",
".",
"Each",
"payload",
"param",
"gets",
"its",
"own",
"multipart",
"form",
"section",
"with",
"the",
"section",
"name",
"being",
"the",
"variable",
"name",
"and",
"section",
"contents",
"being",
"the",
"variable",
"contents",
".",
"Handle",
"recursion",
"as",
"well",
"."
] | [
"func",
"writeMultipartParams",
"(",
"w",
"*",
"multipart",
".",
"Writer",
",",
"payload",
"APIParams",
",",
"prefix",
"string",
")",
"error",
"{",
"for",
"k",
",",
"v",
":=",
"range",
"payload",
"{",
"fieldName",
":=",
"k",
"\n",
"if",
"prefix",
"!=",
"\"",
"\"",
"{",
"fieldName",
"=",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"prefix",
",",
"k",
")",
"\n",
"}",
"\n",
"// Add more types as needed. These two cover both CM15 and SS.",
"<mask>",
"v",
".",
"(",
"type",
")",
"{",
"case",
"string",
":",
"err",
":=",
"w",
".",
"WriteField",
"(",
"fieldName",
",",
"v",
".",
"(",
"string",
")",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"case",
"APIParams",
":",
"err",
":=",
"writeMultipartParams",
"(",
"w",
",",
"v",
".",
"(",
"APIParams",
")",
",",
"fieldName",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"default",
":",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"fieldName",
",",
"v",
")",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
] |
3,104 | all-3105 | [
"SetTitle",
"is",
"a",
"wrapper",
"around",
"gtk_native_dialog_set_title",
"()",
"."
] | [
"func",
"(",
"v",
"*",
"NativeDialog",
")",
"SetTitle",
"(",
"title",
"string",
")",
"{",
"cstr",
":=",
"C",
".",
"CString",
"(",
"<mask>",
")",
"\n",
"defer",
"C",
".",
"free",
"(",
"unsafe",
".",
"Pointer",
"(",
"cstr",
")",
")",
"\n",
"C",
".",
"gtk_native_dialog_set_title",
"(",
"v",
".",
"native",
"(",
")",
",",
"(",
"*",
"C",
".",
"char",
")",
"(",
"cstr",
")",
")",
"\n",
"}"
] |
3,105 | all-3106 | [
"AddIP",
"adds",
"an",
"IP",
"address",
"to",
"Pinger",
".",
"ipaddr",
"arg",
"should",
"be",
"a",
"string",
"like",
"192",
".",
"0",
".",
"2",
".",
"1",
"."
] | [
"func",
"(",
"p",
"*",
"Pinger",
")",
"AddIP",
"(",
"ipaddr",
"string",
")",
"error",
"{",
"addr",
":=",
"<mask>",
".",
"ParseIP",
"(",
"ipaddr",
")",
"\n",
"if",
"addr",
"==",
"nil",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"ipaddr",
")",
"\n",
"}",
"\n",
"p",
".",
"mu",
".",
"Lock",
"(",
")",
"\n",
"p",
".",
"addrs",
"[",
"addr",
".",
"String",
"(",
")",
"]",
"=",
"&",
"net",
".",
"IPAddr",
"{",
"IP",
":",
"addr",
"}",
"\n",
"if",
"isIPv4",
"(",
"addr",
")",
"{",
"p",
".",
"hasIPv4",
"=",
"true",
"\n",
"}",
"else",
"if",
"isIPv6",
"(",
"addr",
")",
"{",
"p",
".",
"hasIPv6",
"=",
"true",
"\n",
"}",
"\n",
"p",
".",
"mu",
".",
"Unlock",
"(",
")",
"\n",
"return",
"nil",
"\n",
"}"
] |
3,106 | all-3107 | [
"GetRefreshInfo",
"is",
"a",
"wrapper",
"around",
"gdk_frame_clock_get_refresh_info",
"()",
"."
] | [
"func",
"(",
"v",
"*",
"FrameClock",
")",
"GetRefreshInfo",
"(",
"baseTime",
"int64",
")",
"(",
"int64",
",",
"int64",
")",
"{",
"var",
"cr",
",",
"cp",
"(",
"*",
"C",
".",
"gint64",
")",
"\n",
"defer",
"C",
".",
"free",
"(",
"unsafe",
".",
"Pointer",
"(",
"cr",
")",
")",
";",
"defer",
"C",
".",
"<mask>",
"(",
"unsafe",
".",
"Pointer",
"(",
"cp",
")",
")",
"\n",
"b",
":=",
"C",
".",
"gint64",
"(",
"baseTime",
")",
"\n",
"C",
".",
"gdk_frame_clock_get_refresh_info",
"(",
"v",
".",
"native",
"(",
")",
",",
"b",
",",
"cr",
",",
"cp",
")",
"\n",
"r",
",",
"p",
":=",
"int64",
"(",
"*",
"cr",
")",
",",
"int64",
"(",
"*",
"cp",
")",
"\n",
"return",
"r",
",",
"p",
"\n",
"}"
] |
3,107 | all-3108 | [
"newStream",
"returns",
"a",
"new",
"stream"
] | [
"func",
"newStream",
"(",
"bufsize",
"int",
",",
"replay",
"bool",
")",
"*",
"Stream",
"{",
"return",
"&",
"Stream",
"{",
"AutoReplay",
":",
"replay",
",",
"subscribers",
":",
"make",
"(",
"[",
"]",
"*",
"Subscriber",
",",
"0",
")",
",",
"register",
":",
"make",
"(",
"chan",
"*",
"Subscriber",
")",
",",
"deregister",
":",
"make",
"(",
"chan",
"*",
"Subscriber",
")",
",",
"event",
":",
"make",
"(",
"chan",
"*",
"<mask>",
",",
"bufsize",
")",
",",
"quit",
":",
"make",
"(",
"chan",
"bool",
")",
",",
"Eventlog",
":",
"make",
"(",
"EventLog",
",",
"0",
")",
",",
"}",
"\n",
"}"
] |
3,108 | all-3109 | [
"GetPod",
"is",
"analogous",
"to",
"kubectl",
"get",
"pods",
"/",
"NAME",
"namespace",
"=",
"client",
".",
"namespace"
] | [
"func",
"(",
"c",
"*",
"Client",
")",
"GetPod",
"(",
"name",
"string",
")",
"(",
"Pod",
",",
"error",
")",
"{",
"c",
".",
"log",
"(",
"\"",
"\"",
",",
"name",
")",
"\n",
"var",
"retPod",
"Pod",
"\n",
"err",
":=",
"c",
".",
"request",
"(",
"&",
"<mask>",
"{",
"path",
":",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"c",
".",
"namespace",
",",
"name",
")",
",",
"}",
",",
"&",
"retPod",
")",
"\n",
"return",
"retPod",
",",
"err",
"\n",
"}"
] |
3,109 | all-3110 | [
"Info",
"formats",
"message",
"using",
"the",
"default",
"formats",
"for",
"its",
"operands",
"prepends",
"the",
"prefix",
"as",
"necessary",
"and",
"writes",
"to",
"log",
"with",
"LevelInfo",
".",
"This",
"is",
"part",
"of",
"the",
"Logger",
"interface",
"implementation",
"."
] | [
"func",
"(",
"l",
"*",
"slog",
")",
"Info",
"(",
"args",
"...",
"interface",
"{",
"}",
")",
"{",
"lvl",
":=",
"l",
".",
"Level",
"(",
")",
"\n",
"if",
"lvl",
"<=",
"LevelInfo",
"{",
"l",
".",
"b",
".",
"<mask>",
"(",
"\"",
"\"",
",",
"l",
".",
"tag",
",",
"args",
"...",
")",
"\n",
"}",
"\n",
"}"
] |
3,110 | all-3111 | [
"AbendSocket",
"notifies",
"the",
"server",
"that",
"the",
"given",
"socket",
"has",
"terminated",
"abnormally",
"and",
"thus",
"should",
"be",
"discarded",
"rather",
"than",
"cached",
"."
] | [
"func",
"(",
"server",
"*",
"mongoServer",
")",
"AbendSocket",
"(",
"socket",
"*",
"mongoSocket",
")",
"{",
"server",
".",
"Lock",
"(",
")",
"\n",
"server",
".",
"abended",
"=",
"true",
"\n",
"if",
"server",
".",
"<mask>",
"{",
"server",
".",
"Unlock",
"(",
")",
"\n",
"return",
"\n",
"}",
"\n",
"server",
".",
"liveSockets",
"=",
"removeSocket",
"(",
"server",
".",
"liveSockets",
",",
"socket",
")",
"\n",
"server",
".",
"unusedSockets",
"=",
"removeSocket",
"(",
"server",
".",
"unusedSockets",
",",
"socket",
")",
"\n",
"server",
".",
"Unlock",
"(",
")",
"\n",
"// Maybe just a timeout, but suggest a cluster sync up just in case.",
"select",
"{",
"case",
"server",
".",
"sync",
"<-",
"true",
":",
"default",
":",
"}",
"\n",
"}"
] |
3,111 | all-3112 | [
"MarshalJSON",
"supports",
"json",
".",
"Marshaler",
"interface"
] | [
"func",
"(",
"v",
"SamplingProfile",
")",
"MarshalJSON",
"(",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"w",
":=",
"jwriter",
".",
"<mask>",
"{",
"}",
"\n",
"easyjsonC5a4559bEncodeGithubComChromedpCdprotoMemory5",
"(",
"&",
"w",
",",
"v",
")",
"\n",
"return",
"w",
".",
"Buffer",
".",
"BuildBytes",
"(",
")",
",",
"w",
".",
"Error",
"\n",
"}"
] |
3,112 | all-3113 | [
"SetProgressFraction",
"()",
"is",
"a",
"wrapper",
"around",
"gtk_entry_set_progress_fraction",
"()",
"."
] | [
"func",
"(",
"v",
"*",
"<mask>",
")",
"SetProgressFraction",
"(",
"fraction",
"float64",
")",
"{",
"C",
".",
"gtk_entry_set_progress_fraction",
"(",
"v",
".",
"native",
"(",
")",
",",
"C",
".",
"gdouble",
"(",
"fraction",
")",
")",
"\n",
"}"
] |
3,113 | all-3114 | [
"Create",
"is",
"the",
"wrapper",
"method",
"which",
"covers",
"all",
"of",
"the",
"boilerplate",
"around",
"actually",
"creating",
"provisioning",
"and",
"persisting",
"an",
"instance",
"in",
"the",
"store",
"."
] | [
"func",
"(",
"api",
"*",
"Client",
")",
"Create",
"(",
"h",
"*",
"<mask>",
".",
"Host",
")",
"error",
"{",
"if",
"err",
":=",
"cert",
".",
"BootstrapCertificates",
"(",
"h",
".",
"AuthOptions",
"(",
")",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"}",
"\n\n",
"log",
".",
"Info",
"(",
"\"",
"\"",
")",
"\n\n",
"if",
"err",
":=",
"h",
".",
"Driver",
".",
"PreCreateCheck",
"(",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"mcnerror",
".",
"ErrDuringPreCreate",
"{",
"Cause",
":",
"err",
",",
"}",
"\n",
"}",
"\n\n",
"if",
"err",
":=",
"api",
".",
"Save",
"(",
"h",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"}",
"\n\n",
"log",
".",
"Info",
"(",
"\"",
"\"",
")",
"\n\n",
"if",
"err",
":=",
"api",
".",
"performCreate",
"(",
"h",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"}",
"\n\n",
"log",
".",
"Debug",
"(",
"\"",
"\"",
")",
"\n\n",
"return",
"nil",
"\n",
"}"
] |
3,114 | all-3115 | [
"Stream",
"listens",
"indefinitely",
"for",
"all",
"log",
"and",
"event",
"messages",
".",
"Messages",
"are",
"presented",
"in",
"the",
"order",
"received",
"from",
"the",
"loggregator",
"server",
".",
"Chronological",
"or",
"other",
"ordering",
"is",
"not",
"guaranteed",
".",
"It",
"is",
"the",
"responsibility",
"of",
"the",
"consumer",
"of",
"these",
"channels",
"to",
"provide",
"any",
"desired",
"sorting",
"mechanism",
".",
"Whenever",
"an",
"error",
"is",
"encountered",
"the",
"error",
"will",
"be",
"sent",
"down",
"the",
"error",
"channel",
"and",
"Stream",
"will",
"attempt",
"to",
"reconnect",
"indefinitely",
"."
] | [
"func",
"(",
"c",
"*",
"Consumer",
")",
"Stream",
"(",
"appGuid",
"string",
",",
"authToken",
"string",
")",
"(",
"outputChan",
"<-",
"chan",
"*",
"<mask>",
".",
"Envelope",
",",
"errorChan",
"<-",
"chan",
"error",
")",
"{",
"return",
"c",
".",
"runStream",
"(",
"appGuid",
",",
"authToken",
",",
"true",
")",
"\n",
"}"
] |
3,115 | all-3116 | [
"StartProducer",
"starts",
"and",
"returns",
"a",
"new",
"producer",
"p",
"configured",
"with",
"the",
"variables",
"from",
"the",
"config",
"parameter",
"or",
"returning",
"an",
"non",
"-",
"nil",
"error",
"if",
"some",
"of",
"the",
"configuration",
"variables",
"were",
"invalid",
"."
] | [
"func",
"StartProducer",
"(",
"config",
"ProducerConfig",
")",
"(",
"p",
"*",
"Producer",
",",
"err",
"error",
")",
"{",
"p",
",",
"<mask>",
"=",
"NewProducer",
"(",
"config",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"\n",
"}",
"\n\n",
"p",
".",
"Start",
"(",
")",
"\n",
"return",
"\n",
"}"
] |
3,116 | all-3117 | [
"SettingsNew",
"is",
"a",
"wrapper",
"around",
"g_settings_new",
"()",
"."
] | [
"func",
"SettingsNew",
"(",
"schemaID",
"string",
")",
"*",
"Settings",
"{",
"cstr",
":=",
"(",
"*",
"C",
".",
"gchar",
")",
"(",
"C",
".",
"CString",
"(",
"schemaID",
")",
")",
"\n",
"defer",
"C",
".",
"<mask>",
"(",
"unsafe",
".",
"Pointer",
"(",
"cstr",
")",
")",
"\n\n",
"return",
"wrapFullSettings",
"(",
"C",
".",
"g_settings_new",
"(",
"cstr",
")",
")",
"\n",
"}"
] |
3,117 | all-3118 | [
"GetResource",
"gets",
"an",
"existing",
"resource",
"errors",
"otherwise"
] | [
"func",
"(",
"s",
"*",
"Storage",
")",
"GetResource",
"(",
"name",
"string",
")",
"(",
"common",
".",
"Resource",
",",
"error",
")",
"{",
"i",
",",
"err",
":=",
"s",
".",
"resources",
".",
"Get",
"(",
"name",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"common",
".",
"Resource",
"{",
"}",
",",
"err",
"\n",
"}",
"\n",
"var",
"res",
"common",
".",
"<mask>",
"\n",
"res",
",",
"err",
"=",
"common",
".",
"ItemToResource",
"(",
"i",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"common",
".",
"Resource",
"{",
"}",
",",
"err",
"\n",
"}",
"\n",
"return",
"res",
",",
"nil",
"\n",
"}"
] |
3,118 | all-3119 | [
"VerifyBootstrap",
"sanity",
"-",
"checks",
"the",
"initial",
"config",
"for",
"bootstrap",
"case",
"and",
"returns",
"an",
"error",
"for",
"things",
"that",
"should",
"never",
"happen",
"."
] | [
"func",
"(",
"c",
"*",
"ServerConfig",
")",
"VerifyBootstrap",
"(",
")",
"error",
"{",
"if",
"err",
":=",
"c",
".",
"hasLocalMember",
"(",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"if",
"err",
":=",
"c",
".",
"advertiseMatchesCluster",
"(",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"if",
"checkDuplicateURL",
"(",
"c",
".",
"InitialPeerURLsMap",
")",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"c",
".",
"InitialPeerURLsMap",
")",
"\n",
"}",
"\n",
"if",
"c",
".",
"InitialPeerURLsMap",
".",
"<mask>",
"(",
")",
"==",
"\"",
"\"",
"&&",
"c",
".",
"DiscoveryURL",
"==",
"\"",
"\"",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
] |
3,119 | all-3120 | [
"Key",
"returns",
"the",
"key",
"at",
"the",
"current",
"position",
"."
] | [
"func",
"(",
"s",
"*",
"Iterator",
")",
"Key",
"(",
")",
"[",
"]",
"<mask>",
"{",
"return",
"s",
".",
"list",
".",
"arena",
".",
"getKey",
"(",
"s",
".",
"n",
".",
"keyOffset",
",",
"s",
".",
"n",
".",
"keySize",
")",
"\n",
"}"
] |
3,120 | all-3121 | [
"title",
":",
"webhook",
"update",
"path",
":",
"/",
"events",
"/",
"webhooks",
"/",
"{",
"name",
"}",
"method",
":",
"PUT",
"responses",
":",
"200",
":",
"Webhook",
"updated",
"401",
":",
"Unauthorized",
"400",
":",
"Invalid",
"webhook",
"404",
":",
"Webhook",
"not",
"found"
] | [
"func",
"webhookUpdate",
"(",
"w",
"http",
".",
"ResponseWriter",
",",
"r",
"*",
"http",
".",
"Request",
",",
"t",
"auth",
".",
"Token",
")",
"error",
"{",
"var",
"webhook",
"eventTypes",
".",
"Webhook",
"\n",
"err",
":=",
"ParseInput",
"(",
"r",
",",
"&",
"webhook",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"webhook",
".",
"<mask>",
"=",
"r",
".",
"URL",
".",
"Query",
"(",
")",
".",
"Get",
"(",
"\"",
"\"",
")",
"\n",
"ctx",
":=",
"permission",
".",
"Context",
"(",
"permTypes",
".",
"CtxTeam",
",",
"webhook",
".",
"TeamOwner",
")",
"\n",
"if",
"!",
"permission",
".",
"Check",
"(",
"t",
",",
"permission",
".",
"PermWebhookUpdate",
",",
"ctx",
")",
"{",
"return",
"permission",
".",
"ErrUnauthorized",
"\n",
"}",
"\n",
"evt",
",",
"err",
":=",
"event",
".",
"New",
"(",
"&",
"event",
".",
"Opts",
"{",
"Target",
":",
"event",
".",
"Target",
"{",
"Type",
":",
"event",
".",
"TargetTypeWebhook",
",",
"Value",
":",
"webhook",
".",
"Name",
"}",
",",
"Kind",
":",
"permission",
".",
"PermWebhookUpdate",
",",
"Owner",
":",
"t",
",",
"CustomData",
":",
"event",
".",
"FormToCustomData",
"(",
"InputFields",
"(",
"r",
")",
")",
",",
"Allowed",
":",
"event",
".",
"Allowed",
"(",
"permission",
".",
"PermWebhookReadEvents",
",",
"ctx",
")",
",",
"}",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"defer",
"func",
"(",
")",
"{",
"evt",
".",
"Done",
"(",
"err",
")",
"\n",
"}",
"(",
")",
"\n",
"err",
"=",
"servicemanager",
".",
"Webhook",
".",
"Update",
"(",
"webhook",
")",
"\n",
"if",
"err",
"==",
"eventTypes",
".",
"ErrWebhookNotFound",
"{",
"w",
".",
"WriteHeader",
"(",
"http",
".",
"StatusNotFound",
")",
"\n",
"}",
"\n",
"return",
"err",
"\n",
"}"
] |
3,121 | all-3122 | [
"SetBSON",
"sets",
"the",
"Date",
"from",
"raw",
"bson",
"data"
] | [
"func",
"(",
"d",
"*",
"Date",
")",
"SetBSON",
"(",
"raw",
"bson",
".",
"Raw",
")",
"error",
"{",
"var",
"m",
"bson",
".",
"M",
"\n",
"if",
"err",
":=",
"<mask>",
".",
"Unmarshal",
"(",
"&",
"m",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"if",
"data",
",",
"ok",
":=",
"m",
"[",
"\"",
"\"",
"]",
".",
"(",
"string",
")",
";",
"ok",
"{",
"rd",
",",
"err",
":=",
"time",
".",
"Parse",
"(",
"RFC3339FullDate",
",",
"data",
")",
"\n",
"*",
"d",
"=",
"Date",
"(",
"rd",
")",
"\n",
"return",
"err",
"\n",
"}",
"\n\n",
"return",
"errors",
".",
"New",
"(",
"\"",
"\"",
")",
"\n",
"}"
] |
3,122 | all-3123 | [
"PublicKey",
"returns",
"the",
"stored",
"public",
"key",
"for",
"the",
"keystore",
"alternately",
"generating",
"the",
"public",
"key",
"from",
"the",
"private",
"key",
"if",
"the",
"public",
"key",
"was",
"not",
"supplied",
"and",
"the",
"private",
"key",
"was",
"."
] | [
"func",
"(",
"ks",
"*",
"Keystore",
")",
"PublicKey",
"(",
")",
"(",
"crypto",
".",
"PublicKey",
",",
"bool",
")",
"{",
"<mask>",
".",
"rw",
".",
"RLock",
"(",
")",
"\n",
"key",
",",
"pub",
":=",
"ks",
".",
"Key",
",",
"ks",
".",
"PubKey",
"\n",
"ks",
".",
"rw",
".",
"RUnlock",
"(",
")",
"\n",
"if",
"pub",
"!=",
"nil",
"{",
"return",
"pub",
",",
"true",
"\n",
"}",
"\n\n",
"// generate the public key",
"if",
"key",
"!=",
"nil",
"{",
"ks",
".",
"rw",
".",
"Lock",
"(",
")",
"\n",
"defer",
"ks",
".",
"rw",
".",
"Unlock",
"(",
")",
"\n\n",
"if",
"x",
",",
"ok",
":=",
"key",
".",
"(",
"interface",
"{",
"Public",
"(",
")",
"crypto",
".",
"PublicKey",
"\n",
"}",
")",
";",
"ok",
"{",
"ks",
".",
"PubKey",
"=",
"x",
".",
"Public",
"(",
")",
"\n",
"}",
"\n\n",
"return",
"ks",
".",
"PubKey",
",",
"ks",
".",
"PubKey",
"!=",
"nil",
"\n",
"}",
"\n\n",
"return",
"nil",
",",
"false",
"\n",
"}"
] |
3,123 | all-3124 | [
"removeV3EndpointIDToTaskContainerUnsafe",
"removes",
"the",
"container",
"from",
"v3EndpointIDToTask",
"and",
"v3EndpointIDToDockerID",
"maps"
] | [
"func",
"(",
"state",
"*",
"DockerTaskEngineState",
")",
"removeV3EndpointIDToTaskContainerUnsafe",
"(",
"v3EndpointID",
"string",
")",
"{",
"if",
"v3EndpointID",
"!=",
"\"",
"\"",
"{",
"delete",
"(",
"state",
".",
"v3EndpointIDToTask",
",",
"v3EndpointID",
")",
"\n",
"delete",
"(",
"<mask>",
".",
"v3EndpointIDToDockerID",
",",
"v3EndpointID",
")",
"\n",
"}",
"\n",
"}"
] |
3,124 | all-3125 | [
"IsOffline",
"returns",
"true",
"if",
"the",
"last",
"successful",
"heartbeat",
"time",
"of",
"the",
"node",
"is",
"older",
"than",
"the",
"given",
"threshold",
"."
] | [
"func",
"(",
"n",
"NodeInfo",
")",
"IsOffline",
"(",
"threshold",
"<mask>",
".",
"Duration",
")",
"bool",
"{",
"return",
"nodeIsOffline",
"(",
"threshold",
",",
"n",
".",
"Heartbeat",
")",
"\n",
"}"
] |
3,125 | all-3126 | [
"GetProject",
"retrieves",
"a",
"specific",
"project",
"Returns",
"nil",
"of",
"the",
"project",
"is",
"not",
"in",
"the",
"list",
"of",
"watched",
"projects"
] | [
"func",
"(",
"c",
"*",
"Client",
")",
"GetProject",
"(",
"account",
",",
"repo",
"string",
")",
"(",
"*",
"Project",
",",
"error",
")",
"{",
"projects",
",",
"err",
":=",
"c",
".",
"ListProjects",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"for",
"_",
",",
"project",
":=",
"<mask>",
"projects",
"{",
"if",
"account",
"==",
"project",
".",
"Username",
"&&",
"repo",
"==",
"project",
".",
"Reponame",
"{",
"return",
"project",
",",
"nil",
"\n",
"}",
"\n",
"}",
"\n\n",
"return",
"nil",
",",
"nil",
"\n",
"}"
] |
3,126 | all-3127 | [
"Returns",
"an",
"typed",
"object",
"or",
"panics"
] | [
"func",
"(",
"t",
"Typed",
")",
"ObjectMust",
"(",
"<mask>",
"string",
")",
"Typed",
"{",
"t",
",",
"exists",
":=",
"t",
".",
"ObjectIf",
"(",
"key",
")",
"\n",
"if",
"exists",
"==",
"false",
"{",
"panic",
"(",
"\"",
"\"",
"+",
"key",
")",
"\n",
"}",
"\n",
"return",
"t",
"\n",
"}"
] |
3,127 | all-3128 | [
"LogFunc",
"outputs",
"Log",
"level",
"log",
"returned",
"from",
"the",
"function"
] | [
"func",
"LogFunc",
"(",
"f",
"func",
"(",
")",
"string",
")",
"error",
"{",
"if",
"isModeEnable",
"(",
"LOG",
")",
"{",
"return",
"glg",
".",
"<mask>",
"(",
"LOG",
",",
"\"",
"\"",
",",
"f",
"(",
")",
")",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
] |
3,128 | all-3129 | [
"Close",
"implements",
"io",
".",
"Closer",
"interface",
"."
] | [
"func",
"(",
"d",
"*",
"Daemon",
")",
"Close",
"(",
")",
"(",
"err",
"error",
")",
"{",
"d",
".",
"<mask>",
"<-",
"struct",
"{",
"}",
"{",
"}",
"\n",
"d",
".",
"server",
".",
"GracefulStop",
"(",
")",
"\n",
"if",
"d",
".",
"postgres",
"!=",
"nil",
"{",
"if",
"err",
"=",
"d",
".",
"postgres",
".",
"Close",
"(",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"\n",
"}",
"\n",
"}",
"\n",
"if",
"d",
".",
"debugListener",
"!=",
"nil",
"{",
"if",
"err",
"=",
"d",
".",
"debugListener",
".",
"Close",
"(",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"\n",
"}",
"\n",
"}",
"\n",
"if",
"d",
".",
"tracerCloser",
"!=",
"nil",
"{",
"if",
"err",
"=",
"d",
".",
"tracerCloser",
".",
"Close",
"(",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
] |
3,129 | all-3130 | [
"OpPut",
"returns",
"put",
"operation",
"based",
"on",
"given",
"key",
"-",
"value",
"and",
"operation",
"options",
"."
] | [
"func",
"OpPut",
"(",
"key",
",",
"val",
"string",
",",
"opts",
"...",
"OpOption",
")",
"Op",
"{",
"ret",
":=",
"Op",
"{",
"t",
":",
"tPut",
",",
"key",
":",
"[",
"]",
"byte",
"(",
"key",
")",
",",
"val",
":",
"[",
"]",
"byte",
"(",
"val",
")",
"}",
"\n",
"ret",
".",
"applyOpts",
"(",
"opts",
")",
"\n",
"switch",
"{",
"case",
"ret",
".",
"end",
"!=",
"nil",
":",
"panic",
"(",
"\"",
"\"",
")",
"\n",
"case",
"ret",
".",
"limit",
"!=",
"0",
":",
"panic",
"(",
"\"",
"\"",
")",
"\n",
"<mask>",
"ret",
".",
"rev",
"!=",
"0",
":",
"panic",
"(",
"\"",
"\"",
")",
"\n",
"case",
"ret",
".",
"sort",
"!=",
"nil",
":",
"panic",
"(",
"\"",
"\"",
")",
"\n",
"case",
"ret",
".",
"serializable",
":",
"panic",
"(",
"\"",
"\"",
")",
"\n",
"case",
"ret",
".",
"countOnly",
":",
"panic",
"(",
"\"",
"\"",
")",
"\n",
"case",
"ret",
".",
"minModRev",
"!=",
"0",
",",
"ret",
".",
"maxModRev",
"!=",
"0",
":",
"panic",
"(",
"\"",
"\"",
")",
"\n",
"case",
"ret",
".",
"minCreateRev",
"!=",
"0",
",",
"ret",
".",
"maxCreateRev",
"!=",
"0",
":",
"panic",
"(",
"\"",
"\"",
")",
"\n",
"case",
"ret",
".",
"filterDelete",
",",
"ret",
".",
"filterPut",
":",
"panic",
"(",
"\"",
"\"",
")",
"\n",
"case",
"ret",
".",
"createdNotify",
":",
"panic",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"return",
"ret",
"\n",
"}"
] |
3,130 | all-3131 | [
"WithBody",
"adds",
"the",
"body",
"to",
"the",
"patch",
"apps",
"app",
"routes",
"route",
"params"
] | [
"func",
"(",
"o",
"*",
"PatchAppsAppRoutesRouteParams",
")",
"WithBody",
"(",
"<mask>",
"*",
"models",
".",
"RouteWrapper",
")",
"*",
"PatchAppsAppRoutesRouteParams",
"{",
"o",
".",
"SetBody",
"(",
"body",
")",
"\n",
"return",
"o",
"\n",
"}"
] |
3,131 | all-3132 | [
"SetBodyStream",
"sets",
"response",
"body",
"stream",
"and",
"optionally",
"body",
"size",
".",
"bodyStream",
".",
"Close",
"()",
"is",
"called",
"after",
"finishing",
"reading",
"all",
"body",
"data",
"if",
"it",
"implements",
"io",
".",
"Closer",
".",
"If",
"bodySize",
"is",
">",
"=",
"0",
"then",
"bodySize",
"bytes",
"must",
"be",
"provided",
"by",
"bodyStream",
"before",
"returning",
"io",
".",
"EOF",
".",
"If",
"bodySize",
"<",
"0",
"then",
"bodyStream",
"is",
"read",
"until",
"io",
".",
"EOF",
".",
"See",
"also",
"SetBodyStreamWriter",
"."
] | [
"func",
"(",
"ctx",
"*",
"RequestCtx",
")",
"SetBodyStream",
"(",
"bodyStream",
"io",
".",
"Reader",
",",
"bodySize",
"int",
")",
"{",
"ctx",
".",
"<mask>",
".",
"SetBodyStream",
"(",
"bodyStream",
",",
"bodySize",
")",
"\n",
"}"
] |
3,132 | all-3133 | [
"WrapCORS",
"wraps",
"existing",
"handler",
"with",
"CORS",
".",
"TODO",
":",
"deprecate",
"this",
"after",
"v2",
"proxy",
"deprecate"
] | [
"func",
"WrapCORS",
"(",
"cors",
"map",
"[",
"string",
"]",
"struct",
"{",
"}",
",",
"h",
"http",
".",
"<mask>",
")",
"http",
".",
"Handler",
"{",
"return",
"&",
"corsHandler",
"{",
"ac",
":",
"&",
"etcdserver",
".",
"AccessController",
"{",
"CORS",
":",
"cors",
"}",
",",
"h",
":",
"h",
",",
"}",
"\n",
"}"
] |
3,133 | all-3134 | [
"WriteImageToHTTP",
"Sends",
"an",
"image",
"via",
"http",
"."
] | [
"func",
"WriteImageToHTTP",
"(",
"w",
"http",
".",
"ResponseWriter",
",",
"img",
"image",
".",
"Image",
")",
"error",
"{",
"buffer",
":=",
"new",
"(",
"bytes",
".",
"Buffer",
")",
"\n",
"if",
"err",
":=",
"png",
".",
"Encode",
"(",
"buffer",
",",
"img",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"w",
".",
"<mask>",
"(",
")",
".",
"Set",
"(",
"\"",
"\"",
",",
"\"",
"\"",
")",
"\n",
"w",
".",
"Header",
"(",
")",
".",
"Set",
"(",
"\"",
"\"",
",",
"strconv",
".",
"Itoa",
"(",
"len",
"(",
"buffer",
".",
"Bytes",
"(",
")",
")",
")",
")",
"\n",
"if",
"_",
",",
"err",
":=",
"w",
".",
"Write",
"(",
"buffer",
".",
"Bytes",
"(",
")",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
] |
3,134 | all-3135 | [
"DNSResolveCheck",
"returns",
"a",
"Check",
"that",
"makes",
"sure",
"the",
"provided",
"host",
"can",
"resolve",
"to",
"at",
"least",
"one",
"IP",
"address",
"within",
"the",
"specified",
"timeout",
"."
] | [
"func",
"DNSResolveCheck",
"(",
"host",
"string",
",",
"timeout",
"time",
".",
"Duration",
")",
"Check",
"{",
"resolver",
":=",
"net",
".",
"Resolver",
"{",
"}",
"\n",
"return",
"func",
"(",
")",
"error",
"{",
"ctx",
",",
"cancel",
":=",
"context",
".",
"WithTimeout",
"(",
"<mask>",
".",
"Background",
"(",
")",
",",
"timeout",
")",
"\n",
"defer",
"cancel",
"(",
")",
"\n",
"addrs",
",",
"err",
":=",
"resolver",
".",
"LookupHost",
"(",
"ctx",
",",
"host",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"if",
"len",
"(",
"addrs",
")",
"<",
"1",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}",
"\n",
"}"
] |
3,135 | all-3136 | [
"ParseToken",
"extracts",
"token",
"from",
"a",
"header",
":",
"type",
"token",
"or",
"token"
] | [
"func",
"ParseToken",
"(",
"header",
"string",
")",
"(",
"string",
",",
"error",
")",
"{",
"s",
":=",
"strings",
".",
"Split",
"(",
"header",
",",
"\"",
"\"",
")",
"\n",
"var",
"value",
"string",
"\n",
"if",
"len",
"(",
"s",
")",
"<",
"3",
"{",
"value",
"=",
"s",
"[",
"len",
"(",
"s",
")",
"-",
"1",
"]",
"\n",
"}",
"\n",
"if",
"value",
"!=",
"\"",
"\"",
"{",
"return",
"<mask>",
",",
"nil",
"\n",
"}",
"\n",
"return",
"value",
",",
"ErrInvalidToken",
"\n",
"}"
] |
3,136 | all-3137 | [
"getTemplateName",
"returns",
"the",
"name",
"of",
"the",
"template",
"For",
"example",
"if",
"the",
"template",
"path",
"is",
"templates",
"/",
"articles",
"/",
"list",
".",
"html",
"getTemplateName",
"would",
"return",
"articles",
"/",
"list"
] | [
"func",
"(",
"r",
"*",
"Render",
")",
"getTemplateName",
"(",
"tpl",
"string",
")",
"string",
"{",
"dir",
",",
"file",
":=",
"filepath",
".",
"Split",
"(",
"tpl",
")",
"\n",
"dir",
"=",
"strings",
".",
"Replace",
"(",
"dir",
",",
"r",
".",
"TemplatesDir",
",",
"\"",
"\"",
",",
"1",
")",
"\n",
"file",
"=",
"strings",
".",
"TrimSuffix",
"(",
"<mask>",
",",
"r",
".",
"Ext",
")",
"\n",
"return",
"dir",
"+",
"file",
"\n",
"}"
] |
3,137 | all-3138 | [
"NewRfc2136Provider",
"is",
"a",
"factory",
"function",
"for",
"OpenStack",
"rfc2136",
"providers"
] | [
"func",
"NewRfc2136Provider",
"(",
"host",
"string",
",",
"port",
"int",
",",
"zoneName",
"string",
",",
"insecure",
"bool",
",",
"keyName",
"string",
",",
"secret",
"string",
",",
"secretAlg",
"string",
",",
"axfr",
"bool",
",",
"domainFilter",
"DomainFilter",
",",
"dryRun",
"bool",
",",
"actions",
"rfc2136Actions",
")",
"(",
"<mask>",
",",
"error",
")",
"{",
"secretAlgChecked",
",",
"ok",
":=",
"tsigAlgs",
"[",
"secretAlg",
"]",
"\n",
"if",
"!",
"ok",
"&&",
"!",
"insecure",
"{",
"return",
"nil",
",",
"errors",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"secretAlg",
")",
"\n",
"}",
"\n\n",
"r",
":=",
"&",
"rfc2136Provider",
"{",
"nameserver",
":",
"net",
".",
"JoinHostPort",
"(",
"host",
",",
"strconv",
".",
"Itoa",
"(",
"port",
")",
")",
",",
"zoneName",
":",
"dns",
".",
"Fqdn",
"(",
"zoneName",
")",
",",
"insecure",
":",
"insecure",
",",
"domainFilter",
":",
"domainFilter",
",",
"dryRun",
":",
"dryRun",
",",
"axfr",
":",
"axfr",
",",
"}",
"\n",
"if",
"actions",
"!=",
"nil",
"{",
"r",
".",
"actions",
"=",
"actions",
"\n",
"}",
"else",
"{",
"r",
".",
"actions",
"=",
"r",
"\n",
"}",
"\n\n",
"if",
"!",
"insecure",
"{",
"r",
".",
"tsigKeyName",
"=",
"dns",
".",
"Fqdn",
"(",
"keyName",
")",
"\n",
"r",
".",
"tsigSecret",
"=",
"secret",
"\n",
"r",
".",
"tsigSecretAlg",
"=",
"secretAlgChecked",
"\n",
"}",
"\n\n",
"log",
".",
"Infof",
"(",
"\"",
"\"",
",",
"r",
".",
"zoneName",
",",
"r",
".",
"nameserver",
")",
"\n",
"return",
"r",
",",
"nil",
"\n",
"}"
] |
3,138 | all-3139 | [
"expandClusterFailoverLevelAdmissionControlPolicy",
"reads",
"certain",
"ResourceData",
"keys",
"and",
"returns",
"a",
"ClusterFailoverLevelAdmissionControlPolicy",
"."
] | [
"func",
"expandClusterFailoverLevelAdmissionControlPolicy",
"(",
"d",
"*",
"schema",
".",
"ResourceData",
")",
"*",
"<mask>",
".",
"ClusterFailoverLevelAdmissionControlPolicy",
"{",
"obj",
":=",
"&",
"types",
".",
"ClusterFailoverLevelAdmissionControlPolicy",
"{",
"FailoverLevel",
":",
"int32",
"(",
"d",
".",
"Get",
"(",
"\"",
"\"",
")",
".",
"(",
"int",
")",
")",
",",
"}",
"\n\n",
"if",
"d",
".",
"Get",
"(",
"\"",
"\"",
")",
".",
"(",
"bool",
")",
"{",
"obj",
".",
"SlotPolicy",
"=",
"&",
"types",
".",
"ClusterFixedSizeSlotPolicy",
"{",
"Cpu",
":",
"int32",
"(",
"d",
".",
"Get",
"(",
"\"",
"\"",
")",
".",
"(",
"int",
")",
")",
",",
"Memory",
":",
"int32",
"(",
"d",
".",
"Get",
"(",
"\"",
"\"",
")",
".",
"(",
"int",
")",
")",
",",
"}",
"\n",
"}",
"\n\n",
"return",
"obj",
"\n",
"}"
] |
3,139 | all-3140 | [
"SwitchToRootFrame",
"focuses",
"on",
"the",
"original",
"default",
"page",
"frame",
"before",
"any",
"calls",
"to",
"Selection",
".",
"Frame",
"were",
"made",
".",
"After",
"switching",
"all",
"new",
"and",
"existing",
"selections",
"will",
"refer",
"to",
"the",
"root",
"frame",
".",
"All",
"further",
"Page",
"methods",
"will",
"apply",
"to",
"this",
"frame",
"as",
"well",
"."
] | [
"func",
"(",
"p",
"*",
"Page",
")",
"SwitchToRootFrame",
"(",
")",
"error",
"{",
"if",
"err",
":=",
"p",
".",
"<mask>",
".",
"Frame",
"(",
"nil",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
] |
3,140 | all-3141 | [
"Fill",
"fills",
"the",
"paths",
"with",
"the",
"color",
"specified",
"by",
"SetFillColor"
] | [
"func",
"(",
"gc",
"*",
"GraphicContext",
")",
"Fill",
"(",
"paths",
"...",
"*",
"draw2d",
".",
"Path",
")",
"{",
"style",
":=",
"\"",
"\"",
"\n",
"if",
"gc",
".",
"Current",
".",
"FillRule",
"!=",
"draw2d",
".",
"FillRuleWinding",
"{",
"<mask>",
"+=",
"\"",
"\"",
"\n",
"}",
"\n",
"_",
",",
"_",
",",
"_",
",",
"alphaF",
":=",
"gc",
".",
"Current",
".",
"FillColor",
".",
"RGBA",
"(",
")",
"\n",
"gc",
".",
"draw",
"(",
"style",
",",
"alphaF",
",",
"paths",
"...",
")",
"\n",
"gc",
".",
"Current",
".",
"Path",
".",
"Clear",
"(",
")",
"\n",
"}"
] |
3,141 | all-3142 | [
"Handle",
"arranges",
"for",
"f",
"to",
"be",
"called",
"for",
"incoming",
"XMPP",
"messages",
".",
"Only",
"messages",
"of",
"type",
"chat",
"or",
"normal",
"will",
"be",
"handled",
"."
] | [
"func",
"Handle",
"(",
"f",
"func",
"(",
"c",
"context",
".",
"Context",
",",
"m",
"*",
"Message",
")",
")",
"{",
"http",
".",
"HandleFunc",
"(",
"\"",
"\"",
",",
"func",
"(",
"_",
"http",
".",
"ResponseWriter",
",",
"r",
"*",
"<mask>",
".",
"Request",
")",
"{",
"f",
"(",
"appengine",
".",
"NewContext",
"(",
"r",
")",
",",
"&",
"Message",
"{",
"Sender",
":",
"r",
".",
"FormValue",
"(",
"\"",
"\"",
")",
",",
"To",
":",
"[",
"]",
"string",
"{",
"r",
".",
"FormValue",
"(",
"\"",
"\"",
")",
"}",
",",
"Body",
":",
"r",
".",
"FormValue",
"(",
"\"",
"\"",
")",
",",
"}",
")",
"\n",
"}",
")",
"\n",
"}"
] |
3,142 | all-3143 | [
"GetTimeOk",
"returns",
"a",
"tuple",
"with",
"the",
"Time",
"field",
"if",
"it",
"s",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"and",
"a",
"boolean",
"to",
"check",
"if",
"the",
"value",
"has",
"been",
"set",
"."
] | [
"func",
"(",
"t",
"*",
"TraceServiceDefinition",
")",
"GetTimeOk",
"(",
")",
"(",
"WidgetTime",
",",
"bool",
")",
"{",
"if",
"t",
"==",
"nil",
"||",
"t",
".",
"Time",
"==",
"nil",
"{",
"return",
"WidgetTime",
"{",
"}",
",",
"false",
"\n",
"}",
"\n",
"return",
"*",
"t",
".",
"Time",
",",
"<mask>",
"\n",
"}"
] |
3,143 | all-3144 | [
"MergeCommands",
"merges",
"several",
"command",
"aliases",
"(",
"generated",
"by",
"CreateAlias",
"above",
")",
"into",
"a",
"single",
"coherent",
"cobra",
"command",
"tree",
"(",
"with",
"root",
"command",
"root",
")",
".",
"Because",
"CreateAlias",
"generates",
"empty",
"commands",
"to",
"preserve",
"the",
"right",
"hierarchy",
"we",
"go",
"through",
"a",
"little",
"extra",
"effort",
"to",
"allow",
"intermediate",
"docs",
"commands",
"to",
"be",
"preserved",
"in",
"the",
"final",
"command",
"structure",
"."
] | [
"func",
"MergeCommands",
"(",
"root",
"*",
"cobra",
".",
"Command",
",",
"children",
"[",
"]",
"*",
"cobra",
".",
"Command",
")",
"{",
"// Implement our own 'find' function because Command.Find is not reliable?",
"findCommand",
":=",
"func",
"(",
"parent",
"*",
"cobra",
".",
"Command",
",",
"name",
"string",
")",
"*",
"cobra",
".",
"Command",
"{",
"for",
"_",
",",
"cmd",
":=",
"range",
"parent",
".",
"Commands",
"(",
")",
"{",
"if",
"cmd",
".",
"Name",
"(",
")",
"==",
"name",
"{",
"return",
"cmd",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}",
"\n\n",
"// Sort children by max nesting depth - this will put 'docs' commands first,",
"// so they are not overwritten by logical commands added by aliases.",
"var",
"depth",
"func",
"(",
"*",
"cobra",
".",
"Command",
")",
"int",
"\n",
"depth",
"=",
"func",
"(",
"cmd",
"*",
"cobra",
".",
"Command",
")",
"int",
"{",
"maxDepth",
":=",
"0",
"\n",
"for",
"_",
",",
"subcmd",
":=",
"<mask>",
"cmd",
".",
"Commands",
"(",
")",
"{",
"subcmdDepth",
":=",
"depth",
"(",
"subcmd",
")",
"\n",
"if",
"subcmdDepth",
">",
"maxDepth",
"{",
"maxDepth",
"=",
"subcmdDepth",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"maxDepth",
"+",
"1",
"\n",
"}",
"\n\n",
"sort",
".",
"Slice",
"(",
"children",
",",
"func",
"(",
"i",
",",
"j",
"int",
")",
"bool",
"{",
"return",
"depth",
"(",
"children",
"[",
"i",
"]",
")",
"<",
"depth",
"(",
"children",
"[",
"j",
"]",
")",
"\n",
"}",
")",
"\n\n",
"// Move each child command over to the main command tree recursively",
"for",
"_",
",",
"cmd",
":=",
"range",
"children",
"{",
"parent",
":=",
"findCommand",
"(",
"root",
",",
"cmd",
".",
"Name",
"(",
")",
")",
"\n",
"if",
"parent",
"==",
"nil",
"{",
"root",
".",
"AddCommand",
"(",
"cmd",
")",
"\n",
"}",
"else",
"{",
"MergeCommands",
"(",
"parent",
",",
"cmd",
".",
"Commands",
"(",
")",
")",
"\n",
"}",
"\n",
"}",
"\n",
"}"
] |
3,144 | all-3145 | [
"WithBrowserContextID",
"browserContext",
"to",
"override",
"permissions",
".",
"When",
"omitted",
"default",
"browser",
"context",
"is",
"used",
"."
] | [
"func",
"(",
"p",
"GrantPermissionsParams",
")",
"WithBrowserContextID",
"(",
"browserContextID",
"<mask>",
".",
"BrowserContextID",
")",
"*",
"GrantPermissionsParams",
"{",
"p",
".",
"BrowserContextID",
"=",
"browserContextID",
"\n",
"return",
"&",
"p",
"\n",
"}"
] |
3,145 | all-3146 | [
"Retrieves",
"a",
"Task",
"s",
"IPCMode"
] | [
"func",
"(",
"<mask>",
"*",
"Task",
")",
"getIPCMode",
"(",
")",
"string",
"{",
"task",
".",
"lock",
".",
"RLock",
"(",
")",
"\n",
"defer",
"task",
".",
"lock",
".",
"RUnlock",
"(",
")",
"\n\n",
"return",
"task",
".",
"IPCMode",
"\n",
"}"
] |
3,146 | all-3147 | [
"SetActiveID",
"is",
"a",
"wrapper",
"around",
"gtk_combo_box_set_active_id",
"()",
"."
] | [
"func",
"(",
"v",
"*",
"ComboBox",
")",
"SetActiveID",
"(",
"<mask>",
"string",
")",
"bool",
"{",
"cid",
":=",
"C",
".",
"CString",
"(",
"id",
")",
"\n",
"defer",
"C",
".",
"free",
"(",
"unsafe",
".",
"Pointer",
"(",
"cid",
")",
")",
"\n",
"c",
":=",
"C",
".",
"gtk_combo_box_set_active_id",
"(",
"v",
".",
"native",
"(",
")",
",",
"(",
"*",
"C",
".",
"gchar",
")",
"(",
"cid",
")",
")",
"\n",
"return",
"gobool",
"(",
"c",
")",
"\n",
"}"
] |
3,147 | all-3148 | [
"Del",
"function",
"deletes",
"a",
"key",
"from",
"the",
"configuration",
"."
] | [
"func",
"(",
"c",
"*",
"Config",
")",
"Del",
"(",
"section",
"string",
",",
"<mask>",
"string",
")",
"{",
"_",
",",
"ok",
":=",
"c",
".",
"config",
"[",
"section",
"]",
"\n",
"if",
"ok",
"{",
"delete",
"(",
"c",
".",
"config",
"[",
"section",
"]",
",",
"key",
")",
"\n",
"if",
"len",
"(",
"c",
".",
"config",
"[",
"section",
"]",
")",
"==",
"0",
"{",
"delete",
"(",
"c",
".",
"config",
",",
"section",
")",
"\n",
"}",
"\n",
"}",
"\n",
"}"
] |
3,148 | all-3149 | [
"WithTimeout",
"adds",
"the",
"timeout",
"to",
"the",
"find",
"vms",
"by",
"states",
"params"
] | [
"func",
"(",
"o",
"*",
"FindVmsByStatesParams",
")",
"WithTimeout",
"(",
"timeout",
"<mask>",
".",
"Duration",
")",
"*",
"FindVmsByStatesParams",
"{",
"o",
".",
"SetTimeout",
"(",
"timeout",
")",
"\n",
"return",
"o",
"\n",
"}"
] |
3,149 | all-3150 | [
"Used",
"by",
"Part",
"matchers",
"to",
"locate",
"the",
"HTML",
"body",
".",
"Not",
"inlined",
"because",
"it",
"s",
"used",
"in",
"multiple",
"places",
"."
] | [
"func",
"matchHTMLBodyPart",
"(",
"p",
"*",
"<mask>",
")",
"bool",
"{",
"return",
"p",
".",
"ContentType",
"==",
"ctTextHTML",
"&&",
"p",
".",
"Disposition",
"!=",
"cdAttachment",
"\n",
"}"
] |
3,150 | all-3151 | [
"NewMockClientServer",
"creates",
"a",
"new",
"mock",
"instance"
] | [
"func",
"NewMockClientServer",
"(",
"ctrl",
"*",
"gomock",
".",
"<mask>",
")",
"*",
"MockClientServer",
"{",
"mock",
":=",
"&",
"MockClientServer",
"{",
"ctrl",
":",
"ctrl",
"}",
"\n",
"mock",
".",
"recorder",
"=",
"&",
"MockClientServerMockRecorder",
"{",
"mock",
"}",
"\n",
"return",
"mock",
"\n",
"}"
] |
3,151 | all-3152 | [
"GetPaletteFlip",
"returns",
"the",
"PaletteFlip",
"field",
"if",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"."
] | [
"func",
"(",
"h",
"*",
"HostmapStyle",
")",
"GetPaletteFlip",
"(",
")",
"bool",
"{",
"if",
"h",
"==",
"nil",
"||",
"h",
".",
"PaletteFlip",
"==",
"nil",
"{",
"return",
"<mask>",
"\n",
"}",
"\n",
"return",
"*",
"h",
".",
"PaletteFlip",
"\n",
"}"
] |
3,152 | all-3153 | [
"SetAppliedStatus",
"indicates",
"an",
"expected",
"call",
"of",
"SetAppliedStatus"
] | [
"func",
"(",
"mr",
"*",
"MockTaskResourceMockRecorder",
")",
"SetAppliedStatus",
"(",
"arg0",
"<mask>",
"{",
"}",
")",
"*",
"gomock",
".",
"Call",
"{",
"return",
"mr",
".",
"mock",
".",
"ctrl",
".",
"RecordCallWithMethodType",
"(",
"mr",
".",
"mock",
",",
"\"",
"\"",
",",
"reflect",
".",
"TypeOf",
"(",
"(",
"*",
"MockTaskResource",
")",
"(",
"nil",
")",
".",
"SetAppliedStatus",
")",
",",
"arg0",
")",
"\n",
"}"
] |
3,153 | all-3154 | [
"specify",
"a",
"three",
"-",
"dimensional",
"texture",
"image",
"in",
"a",
"compressed",
"format"
] | [
"func",
"CompressedTexImage3D",
"(",
"target",
"uint32",
",",
"level",
"int32",
",",
"internalformat",
"uint32",
",",
"width",
"int32",
",",
"height",
"int32",
",",
"depth",
"int32",
",",
"border",
"int32",
",",
"imageSize",
"int32",
",",
"data",
"unsafe",
".",
"Pointer",
")",
"{",
"C",
".",
"glowCompressedTexImage3D",
"(",
"gpCompressedTexImage3D",
",",
"(",
"C",
".",
"GLenum",
")",
"(",
"target",
")",
",",
"(",
"C",
".",
"GLint",
")",
"(",
"level",
")",
",",
"(",
"C",
".",
"GLenum",
")",
"(",
"internalformat",
")",
",",
"(",
"C",
".",
"GLsizei",
")",
"(",
"<mask>",
")",
",",
"(",
"C",
".",
"GLsizei",
")",
"(",
"height",
")",
",",
"(",
"C",
".",
"GLsizei",
")",
"(",
"depth",
")",
",",
"(",
"C",
".",
"GLint",
")",
"(",
"border",
")",
",",
"(",
"C",
".",
"GLsizei",
")",
"(",
"imageSize",
")",
",",
"data",
")",
"\n",
"}"
] |
3,154 | all-3155 | [
"GetFocusHAdjustment",
"is",
"a",
"wrapper",
"around",
"gtk_container_get_focus_hadjustment",
"()",
"."
] | [
"func",
"(",
"v",
"*",
"<mask>",
")",
"GetFocusHAdjustment",
"(",
")",
"*",
"Adjustment",
"{",
"c",
":=",
"C",
".",
"gtk_container_get_focus_hadjustment",
"(",
"v",
".",
"native",
"(",
")",
")",
"\n",
"if",
"c",
"==",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n",
"obj",
":=",
"glib",
".",
"Take",
"(",
"unsafe",
".",
"Pointer",
"(",
"c",
")",
")",
"\n",
"return",
"wrapAdjustment",
"(",
"obj",
")",
"\n",
"}"
] |
3,155 | all-3156 | [
"return",
"a",
"texture",
"image"
] | [
"func",
"GetTextureImage",
"(",
"texture",
"uint32",
",",
"<mask>",
"int32",
",",
"format",
"uint32",
",",
"xtype",
"uint32",
",",
"bufSize",
"int32",
",",
"pixels",
"unsafe",
".",
"Pointer",
")",
"{",
"syscall",
".",
"Syscall6",
"(",
"gpGetTextureImage",
",",
"6",
",",
"uintptr",
"(",
"texture",
")",
",",
"uintptr",
"(",
"level",
")",
",",
"uintptr",
"(",
"format",
")",
",",
"uintptr",
"(",
"xtype",
")",
",",
"uintptr",
"(",
"bufSize",
")",
",",
"uintptr",
"(",
"pixels",
")",
")",
"\n",
"}"
] |
3,156 | all-3157 | [
"Create",
"is",
"a",
"helper",
"method",
"to",
"initialize",
"a",
"simple",
"Pushy",
"struct",
"&Pushy",
"{",
"APIToken",
":",
"token",
"APIEndpoint",
":",
"https",
":",
"//",
"api",
".",
"pushy",
".",
"me",
"}",
"can",
"be",
"used"
] | [
"func",
"Create",
"(",
"APIToken",
"string",
",",
"APIEndpoint",
"<mask>",
")",
"*",
"Pushy",
"{",
"return",
"&",
"Pushy",
"{",
"APIToken",
":",
"APIToken",
",",
"APIEndpoint",
":",
"APIEndpoint",
",",
"}",
"\n",
"}"
] |
3,157 | all-3158 | [
"NewUser",
"returns",
"a",
"new",
"User",
"with",
"both",
"fields",
"Dir",
"and",
"Shell",
"got",
"from",
"the",
"system",
"configuration",
"."
] | [
"func",
"NewUser",
"(",
"name",
"string",
",",
"gid",
"int",
")",
"*",
"User",
"{",
"loadConfig",
"(",
")",
"\n\n",
"return",
"&",
"User",
"{",
"Name",
":",
"name",
",",
"Dir",
":",
"path",
".",
"Join",
"(",
"config",
".",
"useradd",
".",
"HOME",
",",
"<mask>",
")",
",",
"Shell",
":",
"config",
".",
"useradd",
".",
"SHELL",
",",
"UID",
":",
"-",
"1",
",",
"GID",
":",
"gid",
",",
"}",
"\n",
"}"
] |
3,158 | all-3159 | [
"Locator",
"returns",
"a",
"locator",
"for",
"the",
"given",
"resource"
] | [
"func",
"(",
"r",
"*",
"CookbookAttachment",
")",
"Locator",
"(",
"api",
"*",
"API",
")",
"*",
"CookbookAttachmentLocator",
"{",
"for",
"_",
",",
"l",
":=",
"<mask>",
"r",
".",
"Links",
"{",
"if",
"l",
"[",
"\"",
"\"",
"]",
"==",
"\"",
"\"",
"{",
"return",
"api",
".",
"CookbookAttachmentLocator",
"(",
"l",
"[",
"\"",
"\"",
"]",
")",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
] |
3,159 | all-3160 | [
"TaskContainerMetadataHandler",
"returns",
"the",
"handler",
"method",
"for",
"handling",
"task",
"and",
"container",
"metadata",
"requests",
"."
] | [
"func",
"TaskContainerMetadataHandler",
"(",
"state",
"dockerstate",
".",
"TaskEngineState",
",",
"ecsClient",
"api",
".",
"ECSClient",
",",
"cluster",
",",
"az",
",",
"containerInstanceArn",
"string",
",",
"propagateTags",
"bool",
")",
"func",
"(",
"http",
".",
"ResponseWriter",
",",
"*",
"http",
".",
"Request",
")",
"{",
"return",
"func",
"(",
"w",
"http",
".",
"ResponseWriter",
",",
"r",
"*",
"http",
".",
"<mask>",
")",
"{",
"taskARN",
",",
"err",
":=",
"getTaskARNByRequest",
"(",
"r",
",",
"state",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"responseJSON",
",",
"_",
":=",
"json",
".",
"Marshal",
"(",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"err",
".",
"Error",
"(",
")",
")",
")",
"\n",
"utils",
".",
"WriteJSONToResponse",
"(",
"w",
",",
"http",
".",
"StatusBadRequest",
",",
"responseJSON",
",",
"utils",
".",
"RequestTypeTaskMetadata",
")",
"\n",
"return",
"\n",
"}",
"\n",
"if",
"containerID",
",",
"ok",
":=",
"utils",
".",
"GetMuxValueFromRequest",
"(",
"r",
",",
"metadataContainerIDMuxName",
")",
";",
"ok",
"{",
"seelog",
".",
"Infof",
"(",
"\"",
"\"",
",",
"containerID",
")",
"\n",
"WriteContainerMetadataResponse",
"(",
"w",
",",
"containerID",
",",
"state",
")",
"\n",
"return",
"\n",
"}",
"\n\n",
"seelog",
".",
"Infof",
"(",
"\"",
"\"",
",",
"taskARN",
")",
"\n",
"WriteTaskMetadataResponse",
"(",
"w",
",",
"taskARN",
",",
"cluster",
",",
"state",
",",
"ecsClient",
",",
"az",
",",
"containerInstanceArn",
",",
"propagateTags",
")",
"\n",
"}",
"\n",
"}"
] |
3,160 | all-3161 | [
"hasChild",
":",
"wherether",
"the",
"from",
"node",
"has",
"children"
] | [
"func",
"(",
"da",
"*",
"cedar",
")",
"pushSibling",
"(",
"from",
",",
"base",
"int",
",",
"label",
"byte",
",",
"hasChild",
"bool",
")",
"{",
"c",
":=",
"&",
"da",
".",
"Ninfos",
"[",
"from",
"]",
".",
"Child",
"\n",
"keepOrder",
":=",
"*",
"c",
"==",
"0",
"\n",
"if",
"da",
".",
"Ordered",
"{",
"keepOrder",
"=",
"label",
">",
"*",
"c",
"\n",
"}",
"\n",
"if",
"hasChild",
"&&",
"keepOrder",
"{",
"c",
"=",
"&",
"da",
".",
"Ninfos",
"[",
"base",
"^",
"int",
"(",
"*",
"c",
")",
"]",
".",
"Sibling",
"\n",
"for",
"da",
".",
"Ordered",
"&&",
"*",
"c",
"!=",
"0",
"&&",
"*",
"c",
"<",
"label",
"{",
"c",
"=",
"&",
"da",
".",
"Ninfos",
"[",
"base",
"^",
"int",
"(",
"*",
"c",
")",
"]",
".",
"Sibling",
"\n",
"}",
"\n",
"}",
"\n",
"da",
".",
"Ninfos",
"[",
"base",
"^",
"int",
"(",
"<mask>",
")",
"]",
".",
"Sibling",
"=",
"*",
"c",
"\n",
"*",
"c",
"=",
"label",
"\n",
"}"
] |
3,161 | all-3162 | [
"gtk_box_bar_set_center_widget",
"(",
"GtkBox",
"*",
"box",
"GtkWidget",
"*",
"center_widget",
")"
] | [
"func",
"(",
"a",
"*",
"Box",
")",
"SetCenterWidget",
"(",
"<mask>",
"IWidget",
")",
"{",
"if",
"child",
"==",
"nil",
"{",
"C",
".",
"gtk_box_set_center_widget",
"(",
"a",
".",
"native",
"(",
")",
",",
"nil",
")",
"\n",
"}",
"else",
"{",
"C",
".",
"gtk_box_set_center_widget",
"(",
"a",
".",
"native",
"(",
")",
",",
"child",
".",
"toWidget",
"(",
")",
")",
"\n",
"}",
"\n",
"}"
] |
3,162 | all-3163 | [
"title",
":",
"remove",
"node",
"container",
"list",
"path",
":",
"/",
"docker",
"/",
"nodecontainers",
"method",
":",
"GET",
"produce",
":",
"application",
"/",
"json",
"responses",
":",
"200",
":",
"Ok",
"401",
":",
"Unauthorized"
] | [
"func",
"nodeContainerList",
"(",
"w",
"http",
".",
"ResponseWriter",
",",
"r",
"*",
"http",
".",
"Request",
",",
"t",
"auth",
".",
"Token",
")",
"error",
"{",
"pools",
",",
"err",
":=",
"permission",
".",
"ListContextValues",
"(",
"t",
",",
"permission",
".",
"PermNodecontainerRead",
",",
"<mask>",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"lst",
",",
"err",
":=",
"nodecontainer",
".",
"AllNodeContainers",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"if",
"pools",
"!=",
"nil",
"{",
"poolMap",
":=",
"map",
"[",
"string",
"]",
"struct",
"{",
"}",
"{",
"}",
"\n",
"for",
"_",
",",
"p",
":=",
"range",
"pools",
"{",
"poolMap",
"[",
"p",
"]",
"=",
"struct",
"{",
"}",
"{",
"}",
"\n",
"}",
"\n",
"for",
"i",
",",
"entry",
":=",
"range",
"lst",
"{",
"for",
"poolName",
":=",
"range",
"entry",
".",
"ConfigPools",
"{",
"if",
"poolName",
"==",
"\"",
"\"",
"{",
"continue",
"\n",
"}",
"\n",
"if",
"_",
",",
"ok",
":=",
"poolMap",
"[",
"poolName",
"]",
";",
"!",
"ok",
"{",
"delete",
"(",
"entry",
".",
"ConfigPools",
",",
"poolName",
")",
"\n",
"}",
"\n",
"}",
"\n",
"lst",
"[",
"i",
"]",
"=",
"entry",
"\n",
"}",
"\n",
"}",
"\n",
"w",
".",
"Header",
"(",
")",
".",
"Set",
"(",
"\"",
"\"",
",",
"\"",
"\"",
")",
"\n",
"return",
"json",
".",
"NewEncoder",
"(",
"w",
")",
".",
"Encode",
"(",
"lst",
")",
"\n",
"}"
] |
3,163 | all-3164 | [
"Compact",
"discards",
"all",
"log",
"entries",
"prior",
"to",
"compactIndex",
".",
"It",
"is",
"the",
"application",
"s",
"responsibility",
"to",
"not",
"attempt",
"to",
"compact",
"an",
"index",
"greater",
"than",
"raftLog",
".",
"applied",
"."
] | [
"func",
"(",
"ms",
"*",
"MemoryStorage",
")",
"Compact",
"(",
"compactIndex",
"uint64",
")",
"error",
"{",
"ms",
".",
"Lock",
"(",
")",
"\n",
"defer",
"ms",
".",
"Unlock",
"(",
")",
"\n",
"offset",
":=",
"ms",
".",
"ents",
"[",
"0",
"]",
".",
"Index",
"\n",
"if",
"compactIndex",
"<=",
"offset",
"{",
"return",
"ErrCompacted",
"\n",
"}",
"\n",
"if",
"compactIndex",
">",
"ms",
".",
"lastIndex",
"(",
")",
"{",
"raftLogger",
".",
"Panicf",
"(",
"\"",
"\"",
",",
"compactIndex",
",",
"ms",
".",
"lastIndex",
"(",
")",
")",
"\n",
"}",
"\n\n",
"i",
":=",
"compactIndex",
"-",
"offset",
"\n",
"ents",
":=",
"make",
"(",
"[",
"]",
"pb",
".",
"Entry",
",",
"1",
",",
"1",
"+",
"uint64",
"(",
"len",
"(",
"ms",
".",
"ents",
")",
")",
"-",
"i",
")",
"\n",
"ents",
"[",
"0",
"]",
".",
"Index",
"=",
"ms",
".",
"ents",
"[",
"i",
"]",
".",
"Index",
"\n",
"ents",
"[",
"0",
"]",
".",
"Term",
"=",
"ms",
".",
"ents",
"[",
"i",
"]",
".",
"Term",
"\n",
"ents",
"=",
"append",
"(",
"ents",
",",
"ms",
".",
"ents",
"[",
"i",
"+",
"1",
":",
"]",
"...",
")",
"\n",
"<mask>",
".",
"ents",
"=",
"ents",
"\n",
"return",
"nil",
"\n",
"}"
] |
3,164 | all-3165 | [
"ValidateOU",
"checks",
"the",
"OU",
"of",
"a",
"verified",
"peer",
"cert",
"and",
"raises",
"403",
"if",
"the",
"OU",
"doesn",
"t",
"match",
"any",
"OU",
"in",
"the",
"AllowedOUs",
"list",
"."
] | [
"func",
"(",
"a",
"*",
"Auth",
")",
"ValidateOU",
"(",
"verifiedCert",
"*",
"x509",
".",
"Certificate",
")",
"error",
"{",
"var",
"failed",
"[",
"]",
"string",
"\n\n",
"for",
"_",
",",
"ou",
":=",
"range",
"a",
".",
"opt",
".",
"AllowedOUs",
"{",
"for",
"_",
",",
"clientOU",
":=",
"range",
"verifiedCert",
".",
"Subject",
".",
"OrganizationalUnit",
"{",
"if",
"ou",
"==",
"clientOU",
"{",
"return",
"nil",
"\n",
"}",
"\n",
"failed",
"=",
"append",
"(",
"<mask>",
",",
"clientOU",
")",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"failed",
",",
"a",
".",
"opt",
".",
"AllowedOUs",
")",
"\n",
"}"
] |
3,165 | all-3166 | [
"CreateNmapArgs",
"takes",
"a",
"Scan",
"object",
"and",
"returns",
"a",
"list",
"of",
"strings",
"that",
"map",
"to",
"arguments",
"for",
"an",
"nmap",
"scan",
"."
] | [
"func",
"(",
"s",
"Scan",
")",
"CreateNmapArgs",
"(",
")",
"(",
"[",
"]",
"string",
",",
"error",
")",
"{",
"// Parse arguments",
"args",
":=",
"[",
"]",
"string",
"{",
"\"",
"\"",
",",
"\"",
"\"",
"}",
"\n",
"const",
"seperator",
"string",
"=",
"\"",
"\"",
"\n\n",
"// Set up ports",
"portList",
":=",
"\"",
"\"",
"\n",
"portList",
"+=",
"strings",
".",
"Join",
"(",
"uint16ListToStringList",
"(",
"s",
".",
"configPorts",
")",
",",
"seperator",
")",
"\n",
"if",
"len",
"(",
"s",
".",
"configUDPPorts",
")",
"!=",
"0",
"{",
"if",
"portList",
"!=",
"\"",
"\"",
"{",
"portList",
"+=",
"\"",
"\"",
"\n",
"}",
"\n",
"portList",
"+=",
"\"",
"\"",
"\n",
"}",
"\n",
"portList",
"+=",
"strings",
".",
"Join",
"(",
"uint16ListToStringList",
"(",
"s",
".",
"configUDPPorts",
")",
",",
"seperator",
")",
"\n",
"if",
"len",
"(",
"s",
".",
"configTCPPorts",
")",
"!=",
"0",
"{",
"if",
"portList",
"!=",
"\"",
"\"",
"{",
"portList",
"+=",
"\"",
"\"",
"\n",
"}",
"\n",
"portList",
"+=",
"\"",
"\"",
"\n",
"}",
"\n",
"portList",
"+=",
"strings",
".",
"Join",
"(",
"uint16ListToStringList",
"(",
"s",
".",
"configTCPPorts",
")",
",",
"seperator",
")",
"\n\n",
"// Check to make sure all TCP/UDP flags are correct",
"// Check TCP flags",
"tcpOptions",
":=",
"[",
"]",
"string",
"{",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
"}",
"\n",
"iflag",
":=",
"<mask>",
".",
"Intersection",
"(",
"tcpOptions",
",",
"s",
".",
"configOpts",
")",
".",
"(",
"[",
"]",
"string",
")",
"\n",
"if",
"len",
"(",
"iflag",
")",
"==",
"0",
"{",
"s",
".",
"configOpts",
"=",
"append",
"(",
"s",
".",
"configOpts",
",",
"tcpOptions",
"[",
"1",
"]",
")",
"\n",
"}",
"\n\n",
"// Check UDP flag",
"if",
"len",
"(",
"s",
".",
"configUDPPorts",
")",
"!=",
"0",
"&&",
"!",
"array",
".",
"In",
"(",
"\"",
"\"",
",",
"s",
".",
"configOpts",
")",
"{",
"s",
".",
"configOpts",
"=",
"append",
"(",
"s",
".",
"configOpts",
",",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"// Append arguments",
"args",
"=",
"append",
"(",
"args",
",",
"s",
".",
"configOpts",
"...",
")",
"\n\n",
"// Append port list",
"if",
"portList",
"!=",
"\"",
"\"",
"{",
"args",
"=",
"append",
"(",
"args",
",",
"\"",
"\"",
"+",
"portList",
")",
"\n",
"}",
"\n",
"// Append hosts",
"if",
"len",
"(",
"s",
".",
"configHosts",
")",
"==",
"0",
"{",
"s",
".",
"configErr",
"=",
"errors",
".",
"New",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"args",
"=",
"append",
"(",
"args",
",",
"s",
".",
"configHosts",
"...",
")",
"\n\n",
"fmt",
".",
"Println",
"(",
"args",
")",
"\n",
"return",
"args",
",",
"nil",
"\n",
"}"
] |
3,166 | all-3167 | [
"MarshalJSON",
"supports",
"json",
".",
"Marshaler",
"interface"
] | [
"func",
"(",
"v",
"SetRecordingParams",
")",
"MarshalJSON",
"(",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"w",
":=",
"jwriter",
".",
"Writer",
"{",
"}",
"\n",
"easyjsonC5a4559bEncodeGithubComChromedpCdprotoBackgroundservice2",
"(",
"&",
"w",
",",
"v",
")",
"\n",
"return",
"w",
".",
"Buffer",
".",
"BuildBytes",
"(",
")",
",",
"w",
".",
"<mask>",
"\n",
"}"
] |
3,167 | all-3168 | [
"Scheme",
"---------------------------------------------------------------------",
"NewScheme",
"retuns",
"a",
"URL",
"scheme",
"matcher",
"converting",
"values",
"to",
"lower",
"-",
"case",
"."
] | [
"func",
"NewScheme",
"(",
"m",
"[",
"]",
"string",
")",
"Scheme",
"{",
"for",
"k",
",",
"v",
":=",
"<mask>",
"m",
"{",
"m",
"[",
"k",
"]",
"=",
"strings",
".",
"ToLower",
"(",
"v",
")",
"\n",
"}",
"\n",
"return",
"Scheme",
"(",
"m",
")",
"\n",
"}"
] |
3,168 | all-3169 | [
"Do",
"executes",
"Emulation",
".",
"setGeolocationOverride",
"against",
"the",
"provided",
"context",
"."
] | [
"func",
"(",
"p",
"*",
"SetGeolocationOverrideParams",
")",
"Do",
"(",
"ctx",
"<mask>",
".",
"Context",
")",
"(",
"err",
"error",
")",
"{",
"return",
"cdp",
".",
"Execute",
"(",
"ctx",
",",
"CommandSetGeolocationOverride",
",",
"p",
",",
"nil",
")",
"\n",
"}"
] |
3,169 | all-3170 | [
"returns",
"the",
"singular",
"form",
"of",
"a",
"plural",
"word"
] | [
"func",
"(",
"rs",
"*",
"Ruleset",
")",
"Singularize",
"(",
"word",
"string",
")",
"string",
"{",
"if",
"len",
"(",
"word",
")",
"==",
"0",
"{",
"return",
"word",
"\n",
"}",
"\n",
"if",
"rs",
".",
"isUncountable",
"(",
"word",
")",
"{",
"return",
"word",
"\n",
"}",
"\n",
"for",
"_",
",",
"rule",
":=",
"range",
"rs",
".",
"singulars",
"{",
"if",
"<mask>",
".",
"exact",
"{",
"if",
"word",
"==",
"rule",
".",
"suffix",
"{",
"return",
"rule",
".",
"replacement",
"\n",
"}",
"\n",
"}",
"else",
"{",
"if",
"strings",
".",
"HasSuffix",
"(",
"word",
",",
"rule",
".",
"suffix",
")",
"{",
"return",
"replaceLast",
"(",
"word",
",",
"rule",
".",
"suffix",
",",
"rule",
".",
"replacement",
")",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"word",
"\n",
"}"
] |
3,170 | all-3171 | [
"Subscribe",
"to",
"a",
"data",
"stream"
] | [
"func",
"(",
"c",
"*",
"Client",
")",
"Subscribe",
"(",
"stream",
"string",
",",
"handler",
"func",
"(",
"msg",
"*",
"Event",
")",
")",
"error",
"{",
"operation",
":=",
"func",
"(",
")",
"error",
"{",
"resp",
",",
"err",
":=",
"c",
".",
"request",
"(",
"<mask>",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"defer",
"resp",
".",
"Body",
".",
"Close",
"(",
")",
"\n\n",
"reader",
":=",
"NewEventStreamReader",
"(",
"resp",
".",
"Body",
")",
"\n\n",
"for",
"{",
"// Read each new line and process the type of event",
"event",
",",
"err",
":=",
"reader",
".",
"ReadEvent",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"if",
"err",
"==",
"io",
".",
"EOF",
"{",
"return",
"nil",
"\n",
"}",
"\n\n",
"// run user specified disconnect function",
"if",
"c",
".",
"disconnectcb",
"!=",
"nil",
"{",
"c",
".",
"disconnectcb",
"(",
"c",
")",
"\n",
"}",
"\n\n",
"return",
"err",
"\n",
"}",
"\n\n",
"// If we get an error, ignore it.",
"if",
"msg",
",",
"err",
":=",
"c",
".",
"processEvent",
"(",
"event",
")",
";",
"err",
"==",
"nil",
"{",
"if",
"len",
"(",
"msg",
".",
"ID",
")",
">",
"0",
"{",
"c",
".",
"EventID",
"=",
"string",
"(",
"msg",
".",
"ID",
")",
"\n",
"}",
"else",
"{",
"msg",
".",
"ID",
"=",
"[",
"]",
"byte",
"(",
"c",
".",
"EventID",
")",
"\n",
"}",
"\n\n",
"handler",
"(",
"msg",
")",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"backoff",
".",
"Retry",
"(",
"operation",
",",
"backoff",
".",
"NewExponentialBackOff",
"(",
")",
")",
"\n",
"}"
] |
3,171 | all-3172 | [
"MouseToElement",
"moves",
"the",
"mouse",
"over",
"exactly",
"one",
"element",
"in",
"the",
"selection",
"."
] | [
"func",
"(",
"s",
"*",
"Selection",
")",
"MouseToElement",
"(",
")",
"error",
"{",
"selectedElement",
",",
"err",
":=",
"s",
".",
"elements",
".",
"GetExactlyOne",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"s",
",",
"err",
")",
"\n",
"}",
"\n\n",
"if",
"err",
":=",
"s",
".",
"<mask>",
".",
"MoveTo",
"(",
"selectedElement",
".",
"(",
"*",
"api",
".",
"Element",
")",
",",
"nil",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"s",
",",
"err",
")",
"\n",
"}",
"\n\n",
"return",
"nil",
"\n",
"}"
] |
3,172 | all-3173 | [
"WithColor",
"rGBA",
"of",
"the",
"default",
"background",
"color",
".",
"If",
"not",
"specified",
"any",
"existing",
"override",
"will",
"be",
"cleared",
"."
] | [
"func",
"(",
"p",
"SetDefaultBackgroundColorOverrideParams",
")",
"WithColor",
"(",
"color",
"*",
"cdp",
".",
"RGBA",
")",
"*",
"SetDefaultBackgroundColorOverrideParams",
"{",
"p",
".",
"Color",
"=",
"<mask>",
"\n",
"return",
"&",
"p",
"\n",
"}"
] |
3,173 | all-3174 | [
"Stability",
":",
"***",
"EXPERIMENTAL",
"***",
"Request",
"an",
"instance",
"of",
"a",
"worker",
"type",
"Required",
"scopes",
":",
"ec2",
"-",
"manager",
":",
"manage",
"-",
"resources",
":",
"<workerType",
">",
"See",
"https",
":",
"//",
"docs",
".",
"taskcluster",
".",
"net",
"/",
"reference",
"/",
"core",
"/",
"ec2",
"-",
"manager",
"/",
"api",
"-",
"docs#runInstance"
] | [
"func",
"(",
"eC2Manager",
"*",
"EC2Manager",
")",
"RunInstance",
"(",
"workerType",
"string",
",",
"payload",
"*",
"MakeASpotRequest",
")",
"error",
"{",
"cd",
":=",
"tcclient",
".",
"Client",
"(",
"*",
"eC2Manager",
")",
"\n",
"_",
",",
"_",
",",
"err",
":=",
"(",
"&",
"cd",
")",
".",
"APICall",
"(",
"payload",
",",
"\"",
"\"",
",",
"\"",
"\"",
"+",
"<mask>",
".",
"QueryEscape",
"(",
"workerType",
")",
"+",
"\"",
"\"",
",",
"nil",
",",
"nil",
")",
"\n",
"return",
"err",
"\n",
"}"
] |
3,174 | all-3175 | [
"HasMustShowResourceList",
"returns",
"a",
"boolean",
"if",
"a",
"field",
"has",
"been",
"set",
"."
] | [
"func",
"(",
"w",
"*",
"Widget",
")",
"HasMustShowResourceList",
"(",
")",
"bool",
"{",
"if",
"w",
"!=",
"nil",
"&&",
"w",
".",
"MustShowResourceList",
"!=",
"nil",
"{",
"return",
"true",
"\n",
"}",
"\n\n",
"return",
"<mask>",
"\n",
"}"
] |
3,175 | all-3176 | [
"createAzureClient",
"is",
"a",
"helper",
"function",
"for",
"creating",
"an",
"Azure",
"compute",
"client",
"to",
"ARM",
"."
] | [
"func",
"createAzureClient",
"(",
"cfg",
"SDConfig",
")",
"(",
"azureClient",
",",
"error",
")",
"{",
"env",
",",
"err",
":=",
"azure",
".",
"EnvironmentFromName",
"(",
"cfg",
".",
"Environment",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"azureClient",
"{",
"}",
",",
"err",
"\n",
"}",
"\n\n",
"activeDirectoryEndpoint",
":=",
"env",
".",
"ActiveDirectoryEndpoint",
"\n",
"resourceManagerEndpoint",
":=",
"env",
".",
"ResourceManagerEndpoint",
"\n\n",
"var",
"c",
"azureClient",
"\n\n",
"var",
"spt",
"*",
"adal",
".",
"ServicePrincipalToken",
"\n\n",
"switch",
"cfg",
".",
"AuthenticationMethod",
"{",
"case",
"authMethodManagedIdentity",
":",
"msiEndpoint",
",",
"err",
":=",
"adal",
".",
"GetMSIVMEndpoint",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"azureClient",
"{",
"}",
",",
"err",
"\n",
"}",
"\n\n",
"spt",
",",
"err",
"=",
"adal",
".",
"NewServicePrincipalTokenFromMSI",
"(",
"msiEndpoint",
",",
"resourceManagerEndpoint",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"azureClient",
"{",
"}",
",",
"err",
"\n",
"}",
"\n",
"<mask>",
"authMethodOAuth",
":",
"oauthConfig",
",",
"err",
":=",
"adal",
".",
"NewOAuthConfig",
"(",
"activeDirectoryEndpoint",
",",
"cfg",
".",
"TenantID",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"azureClient",
"{",
"}",
",",
"err",
"\n",
"}",
"\n\n",
"spt",
",",
"err",
"=",
"adal",
".",
"NewServicePrincipalToken",
"(",
"*",
"oauthConfig",
",",
"cfg",
".",
"ClientID",
",",
"string",
"(",
"cfg",
".",
"ClientSecret",
")",
",",
"resourceManagerEndpoint",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"azureClient",
"{",
"}",
",",
"err",
"\n",
"}",
"\n",
"}",
"\n\n",
"bearerAuthorizer",
":=",
"autorest",
".",
"NewBearerAuthorizer",
"(",
"spt",
")",
"\n\n",
"c",
".",
"vm",
"=",
"compute",
".",
"NewVirtualMachinesClientWithBaseURI",
"(",
"resourceManagerEndpoint",
",",
"cfg",
".",
"SubscriptionID",
")",
"\n",
"c",
".",
"vm",
".",
"Authorizer",
"=",
"bearerAuthorizer",
"\n\n",
"c",
".",
"nic",
"=",
"network",
".",
"NewInterfacesClientWithBaseURI",
"(",
"resourceManagerEndpoint",
",",
"cfg",
".",
"SubscriptionID",
")",
"\n",
"c",
".",
"nic",
".",
"Authorizer",
"=",
"bearerAuthorizer",
"\n\n",
"c",
".",
"vmss",
"=",
"compute",
".",
"NewVirtualMachineScaleSetsClientWithBaseURI",
"(",
"resourceManagerEndpoint",
",",
"cfg",
".",
"SubscriptionID",
")",
"\n",
"c",
".",
"vmss",
".",
"Authorizer",
"=",
"bearerAuthorizer",
"\n\n",
"c",
".",
"vmssvm",
"=",
"compute",
".",
"NewVirtualMachineScaleSetVMsClientWithBaseURI",
"(",
"resourceManagerEndpoint",
",",
"cfg",
".",
"SubscriptionID",
")",
"\n",
"c",
".",
"vmssvm",
".",
"Authorizer",
"=",
"bearerAuthorizer",
"\n\n",
"return",
"c",
",",
"nil",
"\n",
"}"
] |
3,176 | all-3177 | [
"Copy",
"()",
"is",
"a",
"wrapper",
"around",
"gtk_page_setup_copy",
"()",
"."
] | [
"func",
"(",
"<mask>",
"*",
"PageSetup",
")",
"Copy",
"(",
")",
"(",
"*",
"PageSetup",
",",
"error",
")",
"{",
"c",
":=",
"C",
".",
"gtk_page_setup_copy",
"(",
"ps",
".",
"native",
"(",
")",
")",
"\n",
"if",
"c",
"==",
"nil",
"{",
"return",
"nil",
",",
"nilPtrErr",
"\n",
"}",
"\n",
"obj",
":=",
"glib",
".",
"Take",
"(",
"unsafe",
".",
"Pointer",
"(",
"c",
")",
")",
"\n",
"return",
"wrapPageSetup",
"(",
"obj",
")",
",",
"nil",
"\n",
"}"
] |
3,177 | all-3178 | [
"GetOutputBin",
"()",
"is",
"a",
"wrapper",
"around",
"gtk_print_settings_get_output_bin",
"()",
"."
] | [
"func",
"(",
"ps",
"*",
"PrintSettings",
")",
"GetOutputBin",
"(",
")",
"string",
"{",
"c",
":=",
"C",
".",
"gtk_print_settings_get_output_bin",
"(",
"<mask>",
".",
"native",
"(",
")",
")",
"\n",
"return",
"C",
".",
"GoString",
"(",
"(",
"*",
"C",
".",
"char",
")",
"(",
"c",
")",
")",
"\n",
"}"
] |
3,178 | all-3179 | [
"GenOpaque",
"generates",
"a",
"opaque",
"file",
"path",
"DSN",
"from",
"the",
"passed",
"URL",
"."
] | [
"func",
"GenOpaque",
"(",
"u",
"*",
"URL",
")",
"(",
"string",
",",
"error",
")",
"{",
"if",
"u",
".",
"Opaque",
"==",
"\"",
"\"",
"{",
"return",
"\"",
"\"",
",",
"ErrMissingPath",
"\n",
"}",
"\n\n",
"return",
"u",
".",
"Opaque",
"+",
"genQueryOptions",
"(",
"u",
".",
"<mask>",
"(",
")",
")",
",",
"nil",
"\n",
"}"
] |
3,179 | all-3180 | [
"Fallback",
"for",
"old",
"drivers",
"which",
"don",
"t",
"provide",
"Device",
"Minor",
":"
] | [
"func",
"findNvidiaMinorOld",
"(",
")",
"(",
"string",
",",
"error",
")",
"{",
"var",
"minor",
"string",
"\n\n",
"// For now, just handle most common case (single nvidia card)",
"ents",
",",
"err",
":=",
"ioutil",
".",
"ReadDir",
"(",
"\"",
"\"",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"\"",
"\"",
",",
"err",
"\n",
"}",
"\n\n",
"rp",
":=",
"regexp",
".",
"MustCompile",
"(",
"\"",
"\"",
")",
"\n",
"for",
"_",
",",
"ent",
":=",
"<mask>",
"ents",
"{",
"matches",
":=",
"rp",
".",
"FindStringSubmatch",
"(",
"ent",
".",
"Name",
"(",
")",
")",
"\n",
"if",
"matches",
"==",
"nil",
"{",
"continue",
"\n",
"}",
"\n\n",
"if",
"minor",
"!=",
"\"",
"\"",
"{",
"return",
"\"",
"\"",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"minor",
"=",
"matches",
"[",
"1",
"]",
"\n",
"}",
"\n\n",
"if",
"minor",
"==",
"\"",
"\"",
"{",
"return",
"\"",
"\"",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"return",
"minor",
",",
"nil",
"\n",
"}"
] |
3,180 | all-3181 | [
"MarshalJSON",
"calls",
"json",
".",
"RawMessage",
"method",
"of",
"the",
"same",
"name",
".",
"Required",
"since",
"Var",
"is",
"of",
"type",
"json",
".",
"RawMessage",
"..."
] | [
"func",
"(",
"this",
"*",
"Var",
")",
"MarshalJSON",
"(",
")",
"(",
"[",
"]",
"<mask>",
",",
"error",
")",
"{",
"x",
":=",
"json",
".",
"RawMessage",
"(",
"*",
"this",
")",
"\n",
"return",
"(",
"&",
"x",
")",
".",
"MarshalJSON",
"(",
")",
"\n",
"}"
] |
3,181 | all-3182 | [
"NewHTTPRequestWithURL",
"creates",
"a",
"new",
"HTTP",
"request",
"for",
"a",
"given",
"url",
"."
] | [
"func",
"NewHTTPRequestWithURL",
"(",
"method",
",",
"url",
"string",
",",
"req",
"*",
"Request",
")",
"(",
"*",
"http",
".",
"<mask>",
",",
"error",
")",
"{",
"data",
",",
"err",
":=",
"json",
".",
"Marshal",
"(",
"req",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"return",
"http",
".",
"NewRequest",
"(",
"method",
",",
"url",
",",
"bytes",
".",
"NewReader",
"(",
"data",
")",
")",
"\n",
"}"
] |
3,182 | all-3183 | [
"RecordCountForValue",
"adds",
"count",
"n",
"for",
"value",
"to",
"a",
"histogram"
] | [
"func",
"(",
"m",
"*",
"CirconusMetrics",
")",
"RecordCountForValue",
"(",
"metric",
"<mask>",
",",
"val",
"float64",
",",
"n",
"int64",
")",
"{",
"hist",
":=",
"m",
".",
"NewHistogram",
"(",
"metric",
")",
"\n\n",
"m",
".",
"hm",
".",
"Lock",
"(",
")",
"\n",
"hist",
".",
"rw",
".",
"Lock",
"(",
")",
"\n",
"hist",
".",
"hist",
".",
"RecordValues",
"(",
"val",
",",
"n",
")",
"\n",
"hist",
".",
"rw",
".",
"Unlock",
"(",
")",
"\n",
"m",
".",
"hm",
".",
"Unlock",
"(",
")",
"\n",
"}"
] |
3,183 | all-3184 | [
"Insert",
"is",
"a",
"wrapper",
"around",
"gtk_tree_store_insert"
] | [
"func",
"(",
"v",
"*",
"TreeStore",
")",
"Insert",
"(",
"parent",
"*",
"TreeIter",
",",
"position",
"int",
")",
"*",
"TreeIter",
"{",
"var",
"ti",
"C",
".",
"GtkTreeIter",
"\n",
"<mask>",
"cParent",
"*",
"C",
".",
"GtkTreeIter",
"\n",
"if",
"parent",
"!=",
"nil",
"{",
"cParent",
"=",
"parent",
".",
"native",
"(",
")",
"\n",
"}",
"\n",
"C",
".",
"gtk_tree_store_insert",
"(",
"v",
".",
"native",
"(",
")",
",",
"&",
"ti",
",",
"cParent",
",",
"C",
".",
"gint",
"(",
"position",
")",
")",
"\n",
"iter",
":=",
"&",
"TreeIter",
"{",
"ti",
"}",
"\n",
"return",
"iter",
"\n",
"}"
] |
3,184 | all-3185 | [
"WithTimeout",
"adds",
"the",
"timeout",
"to",
"the",
"get",
"apps",
"app",
"routes",
"route",
"params"
] | [
"func",
"(",
"o",
"*",
"GetAppsAppRoutesRouteParams",
")",
"WithTimeout",
"(",
"timeout",
"<mask>",
".",
"Duration",
")",
"*",
"GetAppsAppRoutesRouteParams",
"{",
"o",
".",
"SetTimeout",
"(",
"timeout",
")",
"\n",
"return",
"o",
"\n",
"}"
] |
3,185 | all-3186 | [
"/",
"*",
"Segment",
"needs",
"us",
"to",
"identify",
"a",
"user",
"before",
"we",
"report",
"any",
"events",
"for",
"that",
"user",
".",
"We",
"have",
"no",
"way",
"of",
"knowing",
"if",
"a",
"user",
"has",
"previously",
"been",
"identified",
"so",
"we",
"call",
"this",
"before",
"every",
"Track",
"()",
"call",
"containing",
"user",
"data",
"."
] | [
"func",
"identifyUser",
"(",
"client",
"*",
"analytics",
".",
"Client",
",",
"userID",
"string",
")",
"{",
"err",
":=",
"client",
".",
"Identify",
"(",
"&",
"analytics",
".",
"Identify",
"{",
"UserId",
":",
"userID",
",",
"}",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"log",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"err",
".",
"<mask>",
"(",
")",
")",
"\n",
"}",
"\n",
"}"
] |
3,186 | all-3187 | [
"MarshalJSON",
"supports",
"json",
".",
"Marshaler",
"interface"
] | [
"func",
"(",
"v",
"ValueSource",
")",
"MarshalJSON",
"(",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"w",
":=",
"jwriter",
".",
"Writer",
"{",
"}",
"\n",
"easyjsonC5a4559bEncodeGithubComChromedpCdprotoAccessibility",
"(",
"&",
"w",
",",
"v",
")",
"\n",
"return",
"w",
".",
"<mask>",
".",
"BuildBytes",
"(",
")",
",",
"w",
".",
"Error",
"\n",
"}"
] |
3,187 | all-3188 | [
"InjectMessages",
"injects",
"errors",
"messages",
"into",
"a",
"global",
"message",
"map",
".",
"Any",
"package",
"with",
"own",
"errors",
"defined",
"should",
"call",
"this",
"function",
"during",
"its",
"initialisation",
"(",
"i",
".",
"e",
".",
"in",
"init",
"()",
"function",
")",
"."
] | [
"func",
"InjectMessages",
"(",
"m",
"Messages",
")",
"{",
"for",
"k",
",",
"v",
":=",
"range",
"m",
"{",
"if",
"_",
",",
"ok",
":=",
"msgs",
"[",
"k",
"]",
";",
"<mask>",
"{",
"panic",
"(",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"k",
")",
")",
"\n",
"}",
"\n",
"msgs",
"[",
"k",
"]",
"=",
"v",
"\n",
"}",
"\n",
"}"
] |
3,188 | all-3189 | [
"Send",
"broadcasts",
"a",
"message",
"from",
"one",
"Member",
"to",
"the",
"channels",
"of",
"all",
"the",
"other",
"members",
"in",
"its",
"group",
"."
] | [
"func",
"(",
"m",
"*",
"Member",
")",
"Send",
"(",
"val",
"interface",
"{",
"}",
")",
"{",
"m",
".",
"<mask>",
".",
"in",
"<-",
"Message",
"{",
"sender",
":",
"m",
",",
"payload",
":",
"val",
"}",
"\n",
"}"
] |
3,189 | all-3190 | [
"void",
"pango_layout_set_wrap",
"(",
"PangoLayout",
"*",
"layout",
"PangoWrapMode",
"wrap",
")",
";"
] | [
"func",
"(",
"v",
"*",
"Layout",
")",
"SetWrap",
"(",
"wrap",
"WrapMode",
")",
"{",
"C",
".",
"pango_layout_set_wrap",
"(",
"v",
".",
"native",
"(",
")",
",",
"C",
".",
"PangoWrapMode",
"(",
"<mask>",
")",
")",
"\n",
"}"
] |
3,190 | all-3191 | [
"UnmarshalEasyJSON",
"satisfies",
"easyjson",
".",
"Unmarshaler",
"."
] | [
"func",
"(",
"t",
"*",
"State",
")",
"UnmarshalEasyJSON",
"(",
"in",
"*",
"jlexer",
".",
"Lexer",
")",
"{",
"switch",
"State",
"(",
"in",
".",
"String",
"(",
")",
")",
"{",
"case",
"StateUnknown",
":",
"*",
"t",
"=",
"StateUnknown",
"\n",
"case",
"StateNeutral",
":",
"*",
"t",
"=",
"StateNeutral",
"\n",
"case",
"StateInsecure",
":",
"*",
"t",
"=",
"StateInsecure",
"\n",
"case",
"StateSecure",
":",
"*",
"t",
"=",
"StateSecure",
"\n",
"<mask>",
"StateInfo",
":",
"*",
"t",
"=",
"StateInfo",
"\n\n",
"default",
":",
"in",
".",
"AddError",
"(",
"errors",
".",
"New",
"(",
"\"",
"\"",
")",
")",
"\n",
"}",
"\n",
"}"
] |
3,191 | all-3192 | [
"ToString",
"demangles",
"a",
"C",
"++",
"symbol",
"name",
"returning",
"human",
"-",
"readable",
"C",
"++",
"name",
"or",
"an",
"error",
".",
"If",
"the",
"name",
"does",
"not",
"appear",
"to",
"be",
"a",
"C",
"++",
"symbol",
"name",
"at",
"all",
"the",
"error",
"will",
"be",
"ErrNotMangledName",
"."
] | [
"func",
"ToString",
"(",
"<mask>",
"string",
",",
"options",
"...",
"Option",
")",
"(",
"string",
",",
"error",
")",
"{",
"a",
",",
"err",
":=",
"ToAST",
"(",
"name",
",",
"options",
"...",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"\"",
"\"",
",",
"err",
"\n",
"}",
"\n",
"return",
"ASTToString",
"(",
"a",
",",
"options",
"...",
")",
",",
"nil",
"\n",
"}"
] |
3,192 | all-3193 | [
"Check",
"that",
"node",
"-",
"related",
"preconditions",
"are",
"met",
"for",
"bootstrapping",
"or",
"joining",
"a",
"cluster",
"."
] | [
"func",
"membershipCheckNodeStateForBootstrapOrJoin",
"(",
"<mask>",
"*",
"db",
".",
"NodeTx",
",",
"address",
"string",
")",
"error",
"{",
"nodes",
",",
"err",
":=",
"tx",
".",
"RaftNodes",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"errors",
".",
"Wrap",
"(",
"err",
",",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"hasClusterAddress",
":=",
"address",
"!=",
"\"",
"\"",
"\n",
"hasRaftNodes",
":=",
"len",
"(",
"nodes",
")",
">",
"0",
"\n\n",
"// Sanity check that we're not in an inconsistent situation, where no",
"// cluster address is set, but still there are entries in the",
"// raft_nodes table.",
"if",
"!",
"hasClusterAddress",
"&&",
"hasRaftNodes",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"if",
"!",
"hasClusterAddress",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"if",
"hasRaftNodes",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"return",
"nil",
"\n",
"}"
] |
3,193 | all-3194 | [
"RunForSAMLACS",
"creates",
"a",
"port",
"forwarder",
"for",
"SAML",
"ACS",
"."
] | [
"func",
"(",
"f",
"*",
"PortForwarder",
")",
"RunForSAMLACS",
"(",
"localPort",
"uint16",
")",
"<mask>",
"{",
"if",
"localPort",
"==",
"0",
"{",
"localPort",
"=",
"samlAcsLocalPort",
"\n",
"}",
"\n",
"return",
"f",
".",
"Run",
"(",
"\"",
"\"",
",",
"localPort",
",",
"654",
")",
"\n",
"}"
] |
3,194 | all-3195 | [
"UnmarshalJSON",
"satisfies",
"json",
".",
"Unmarshaler",
"."
] | [
"func",
"(",
"t",
"*",
"KeyPathType",
")",
"UnmarshalJSON",
"(",
"buf",
"[",
"]",
"<mask>",
")",
"error",
"{",
"return",
"easyjson",
".",
"Unmarshal",
"(",
"buf",
",",
"t",
")",
"\n",
"}"
] |
3,195 | all-3196 | [
"GetBalancedNic",
"gets",
"a",
"balanced",
"nic"
] | [
"func",
"(",
"c",
"*",
"Client",
")",
"GetBalancedNic",
"(",
"dcid",
",",
"lbalid",
",",
"balnicid",
"string",
")",
"(",
"*",
"Nic",
",",
"error",
")",
"{",
"<mask>",
":=",
"balnicPath",
"(",
"dcid",
",",
"lbalid",
",",
"balnicid",
")",
"+",
"`?depth=`",
"+",
"c",
".",
"client",
".",
"depth",
"+",
"`&pretty=`",
"+",
"strconv",
".",
"FormatBool",
"(",
"c",
".",
"client",
".",
"pretty",
")",
"\n",
"ret",
":=",
"&",
"Nic",
"{",
"}",
"\n",
"err",
":=",
"c",
".",
"client",
".",
"Get",
"(",
"url",
",",
"ret",
",",
"http",
".",
"StatusOK",
")",
"\n",
"return",
"ret",
",",
"err",
"\n",
"}"
] |
3,196 | all-3197 | [
"Token",
"implements",
"oauth2",
".",
"TokenSource",
"interface",
"."
] | [
"func",
"(",
"s",
"*",
"Session",
")",
"Token",
"(",
")",
"(",
"*",
"oauth2",
".",
"Token",
",",
"error",
")",
"{",
"var",
"(",
"err",
"error",
"\n",
"expireAt",
"<mask>",
".",
"Time",
"\n",
")",
"\n",
"if",
"s",
".",
"ExpireAt",
"!=",
"nil",
"{",
"expireAt",
",",
"err",
"=",
"ptypes",
".",
"Timestamp",
"(",
"s",
".",
"ExpireAt",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"}",
"\n",
"token",
":=",
"&",
"oauth2",
".",
"Token",
"{",
"AccessToken",
":",
"string",
"(",
"s",
".",
"AccessToken",
")",
",",
"Expiry",
":",
"expireAt",
",",
"}",
"\n",
"if",
"s",
".",
"Bag",
"!=",
"nil",
"&&",
"len",
"(",
"s",
".",
"Bag",
")",
">",
"0",
"{",
"token",
"=",
"token",
".",
"WithExtra",
"(",
"bagToURLValues",
"(",
"s",
".",
"Bag",
")",
")",
"\n",
"}",
"\n\n",
"return",
"token",
",",
"nil",
"\n",
"}"
] |
3,197 | all-3198 | [
"UnmarshalJSON",
"supports",
"json",
".",
"Unmarshaler",
"interface"
] | [
"func",
"(",
"v",
"*",
"GetBackgroundColorsReturns",
")",
"UnmarshalJSON",
"(",
"data",
"[",
"]",
"byte",
")",
"error",
"{",
"r",
":=",
"jlexer",
".",
"Lexer",
"{",
"Data",
":",
"<mask>",
"}",
"\n",
"easyjsonC5a4559bDecodeGithubComChromedpCdprotoCss47",
"(",
"&",
"r",
",",
"v",
")",
"\n",
"return",
"r",
".",
"Error",
"(",
")",
"\n",
"}"
] |
3,198 | all-3199 | [
"MarshalJSON",
"supports",
"json",
".",
"Marshaler",
"interface"
] | [
"func",
"(",
"v",
"CaptureScreenshotReturns",
")",
"MarshalJSON",
"(",
")",
"(",
"[",
"]",
"<mask>",
",",
"error",
")",
"{",
"w",
":=",
"jwriter",
".",
"Writer",
"{",
"}",
"\n",
"easyjsonC5a4559bEncodeGithubComChromedpCdprotoPage79",
"(",
"&",
"w",
",",
"v",
")",
"\n",
"return",
"w",
".",
"Buffer",
".",
"BuildBytes",
"(",
")",
",",
"w",
".",
"Error",
"\n",
"}"
] |
3,199 | all-3200 | [
"assign",
"a",
"binding",
"point",
"to",
"an",
"active",
"uniform",
"block"
] | [
"func",
"UniformBlockBinding",
"(",
"program",
"uint32",
",",
"uniformBlockIndex",
"uint32",
",",
"uniformBlockBinding",
"uint32",
")",
"{",
"syscall",
".",
"Syscall",
"(",
"gpUniformBlockBinding",
",",
"3",
",",
"uintptr",
"(",
"<mask>",
")",
",",
"uintptr",
"(",
"uniformBlockIndex",
")",
",",
"uintptr",
"(",
"uniformBlockBinding",
")",
")",
"\n",
"}"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.