id
int32 0
25.3k
| idx
stringlengths 5
9
| nl_tokens
sequencelengths 1
418
| pl_tokens
sequencelengths 22
4.98k
|
---|---|---|---|
5,900 | all-5901 | [
"$",
"{",
"LXD_DIR",
"}",
"/",
"storage",
"-",
"pools",
"/",
"<pool",
">",
"/",
"images",
"/",
"<fingerprint",
">"
] | [
"func",
"getImageMountPoint",
"(",
"poolName",
"string",
",",
"fingerprint",
"string",
")",
"string",
"{",
"return",
"<mask>",
".",
"VarPath",
"(",
"\"",
"\"",
",",
"poolName",
",",
"\"",
"\"",
",",
"fingerprint",
")",
"\n",
"}"
] |
5,901 | all-5902 | [
"MarshalJSON",
"supports",
"json",
".",
"Marshaler",
"interface"
] | [
"func",
"(",
"v",
"DeleteObjectStoreEntriesParams",
")",
"MarshalJSON",
"(",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"w",
":=",
"jwriter",
".",
"Writer",
"{",
"}",
"\n",
"easyjsonC5a4559bEncodeGithubComChromedpCdprotoIndexeddb15",
"(",
"&",
"w",
",",
"v",
")",
"\n",
"return",
"w",
".",
"<mask>",
".",
"BuildBytes",
"(",
")",
",",
"w",
".",
"Error",
"\n",
"}"
] |
5,902 | all-5903 | [
"PointerOf",
"returns",
"a",
"Pointer",
"from",
"v",
"which",
"must",
"be",
"a",
"reflect",
".",
"Ptr",
"reflect",
".",
"Slice",
"or",
"reflect",
".",
"Map",
"."
] | [
"func",
"PointerOf",
"(",
"v",
"reflect",
".",
"<mask>",
")",
"Pointer",
"{",
"// The proper representation of a pointer is unsafe.Pointer,",
"// which is necessary if the GC ever uses a moving collector.",
"return",
"Pointer",
"{",
"unsafe",
".",
"Pointer",
"(",
"v",
".",
"Pointer",
"(",
")",
")",
",",
"v",
".",
"Type",
"(",
")",
"}",
"\n",
"}"
] |
5,903 | all-5904 | [
"HasMetricQuery",
"returns",
"a",
"boolean",
"if",
"a",
"field",
"has",
"been",
"set",
"."
] | [
"func",
"(",
"h",
"*",
"HostmapRequest",
")",
"HasMetricQuery",
"(",
")",
"bool",
"{",
"if",
"h",
"!=",
"nil",
"&&",
"h",
".",
"MetricQuery",
"!=",
"nil",
"{",
"return",
"<mask>",
"\n",
"}",
"\n\n",
"return",
"false",
"\n",
"}"
] |
5,904 | all-5905 | [
"UnregisterHandlerForIdentity",
"unegisters",
"the",
"given",
"EventHandler",
"for",
"the",
"given",
"Entity",
"Identity",
"."
] | [
"func",
"(",
"p",
"*",
"PushCenter",
")",
"UnregisterHandlerForIdentity",
"(",
"identity",
"Identity",
")",
"{",
"if",
"identity",
".",
"Name",
"==",
"AllIdentity",
".",
"Name",
"{",
"p",
".",
"defaultHander",
"=",
"nil",
"\n",
"return",
"\n",
"}",
"\n\n",
"if",
"_",
",",
"exists",
":=",
"p",
".",
"handlers",
"[",
"identity",
".",
"Name",
"]",
";",
"exists",
"{",
"delete",
"(",
"p",
".",
"handlers",
",",
"identity",
".",
"<mask>",
")",
"\n",
"}",
"\n",
"}"
] |
5,905 | all-5906 | [
"GetTitle",
"returns",
"the",
"Title",
"field",
"if",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"."
] | [
"func",
"(",
"s",
"*",
"ScreenboardLite",
")",
"GetTitle",
"(",
")",
"string",
"{",
"if",
"s",
"==",
"nil",
"||",
"s",
".",
"Title",
"==",
"nil",
"{",
"<mask>",
"\"",
"\"",
"\n",
"}",
"\n",
"return",
"*",
"s",
".",
"Title",
"\n",
"}"
] |
5,906 | all-5907 | [
"AddSecurityGroupToSpace",
"-",
"adds",
"security",
"group",
"json",
"to",
"org",
"/",
"space",
"location"
] | [
"func",
"(",
"m",
"*",
"yamlManager",
")",
"AddSecurityGroupToSpace",
"(",
"orgName",
",",
"spaceName",
"string",
",",
"securityGroupDefinition",
"[",
"]",
"<mask>",
")",
"error",
"{",
"return",
"WriteFileBytes",
"(",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"m",
".",
"ConfigDir",
",",
"orgName",
",",
"spaceName",
")",
",",
"securityGroupDefinition",
")",
"\n",
"}"
] |
5,907 | all-5908 | [
"UseHandler",
"appends",
"a",
"Handler",
"to",
"the",
"route",
"."
] | [
"func",
"(",
"r",
"*",
"Route",
")",
"UseHandler",
"(",
"h",
"Handler",
")",
"{",
"if",
"r",
".",
"f",
"==",
"nil",
"{",
"r",
".",
"f",
"=",
"h",
"\n",
"return",
"\n",
"}",
"\n\n",
"route",
":=",
"r",
".",
"getLeaf",
"(",
")",
"\n",
"route",
".",
"<mask>",
"=",
"&",
"Route",
"{",
"f",
":",
"h",
"}",
"\n",
"}"
] |
5,908 | all-5909 | [
"SetHeading",
"()",
"is",
"a",
"wrapper",
"around",
"gtk_app_chooser_button_set_heading",
"()",
"."
] | [
"func",
"(",
"v",
"*",
"AppChooserButton",
")",
"SetHeading",
"(",
"heading",
"string",
")",
"{",
"cstr",
":=",
"C",
".",
"CString",
"(",
"<mask>",
")",
"\n",
"defer",
"C",
".",
"free",
"(",
"unsafe",
".",
"Pointer",
"(",
"cstr",
")",
")",
"\n",
"C",
".",
"gtk_app_chooser_button_set_heading",
"(",
"v",
".",
"native",
"(",
")",
",",
"(",
"*",
"C",
".",
"gchar",
")",
"(",
"cstr",
")",
")",
"\n",
"}"
] |
5,909 | all-5910 | [
"CreateVolume",
"creates",
"a",
"new",
"ZFS",
"volume",
"with",
"the",
"specified",
"name",
"size",
"and",
"properties",
".",
"A",
"full",
"list",
"of",
"available",
"ZFS",
"properties",
"may",
"be",
"found",
"here",
":",
"https",
":",
"//",
"www",
".",
"freebsd",
".",
"org",
"/",
"cgi",
"/",
"man",
".",
"cgi?zfs",
"(",
"8",
")",
"."
] | [
"func",
"CreateVolume",
"(",
"name",
"string",
",",
"size",
"uint64",
",",
"properties",
"<mask>",
"[",
"string",
"]",
"string",
")",
"(",
"*",
"Dataset",
",",
"error",
")",
"{",
"args",
":=",
"make",
"(",
"[",
"]",
"string",
",",
"4",
",",
"5",
")",
"\n",
"args",
"[",
"0",
"]",
"=",
"\"",
"\"",
"\n",
"args",
"[",
"1",
"]",
"=",
"\"",
"\"",
"\n",
"args",
"[",
"2",
"]",
"=",
"\"",
"\"",
"\n",
"args",
"[",
"3",
"]",
"=",
"strconv",
".",
"FormatUint",
"(",
"size",
",",
"10",
")",
"\n",
"if",
"properties",
"!=",
"nil",
"{",
"args",
"=",
"append",
"(",
"args",
",",
"propsSlice",
"(",
"properties",
")",
"...",
")",
"\n",
"}",
"\n",
"args",
"=",
"append",
"(",
"args",
",",
"name",
")",
"\n",
"_",
",",
"err",
":=",
"zfs",
"(",
"args",
"...",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"return",
"GetDataset",
"(",
"name",
")",
"\n",
"}"
] |
5,910 | all-5911 | [
"GetManifest",
"()",
"reads",
"the",
"image",
"s",
"manifest",
"."
] | [
"func",
"(",
"s",
"*",
"storageImageSource",
")",
"GetManifest",
"(",
"ctx",
"context",
".",
"Context",
",",
"instanceDigest",
"*",
"digest",
".",
"Digest",
")",
"(",
"manifestBlob",
"[",
"]",
"byte",
",",
"MIMEType",
"string",
",",
"err",
"error",
")",
"{",
"if",
"instanceDigest",
"!=",
"nil",
"{",
"return",
"nil",
",",
"\"",
"\"",
",",
"ErrNoManifestLists",
"\n",
"}",
"\n",
"if",
"len",
"(",
"s",
".",
"cachedManifest",
")",
"==",
"0",
"{",
"// The manifest is stored as a big data item.",
"// Prefer the manifest corresponding to the user-specified digest, if available.",
"if",
"s",
".",
"imageRef",
".",
"named",
"!=",
"nil",
"{",
"if",
"digested",
",",
"ok",
":=",
"s",
".",
"imageRef",
".",
"named",
".",
"(",
"reference",
".",
"Digested",
")",
";",
"ok",
"{",
"key",
":=",
"manifestBigDataKey",
"(",
"digested",
".",
"Digest",
"(",
")",
")",
"\n",
"blob",
",",
"err",
":=",
"s",
".",
"imageRef",
".",
"transport",
".",
"store",
".",
"ImageBigData",
"(",
"s",
".",
"image",
".",
"ID",
",",
"<mask>",
")",
"\n",
"if",
"err",
"!=",
"nil",
"&&",
"!",
"os",
".",
"IsNotExist",
"(",
"err",
")",
"{",
"// os.IsNotExist is true if the image exists but there is no data corresponding to key",
"return",
"nil",
",",
"\"",
"\"",
",",
"err",
"\n",
"}",
"\n",
"if",
"err",
"==",
"nil",
"{",
"s",
".",
"cachedManifest",
"=",
"blob",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n",
"// If the user did not specify a digest, or this is an old image stored before manifestBigDataKey was introduced, use the default manifest.",
"// Note that the manifest may not match the expected digest, and that is likely to fail eventually, e.g. in c/image/image/UnparsedImage.Manifest().",
"if",
"len",
"(",
"s",
".",
"cachedManifest",
")",
"==",
"0",
"{",
"cachedBlob",
",",
"err",
":=",
"s",
".",
"imageRef",
".",
"transport",
".",
"store",
".",
"ImageBigData",
"(",
"s",
".",
"image",
".",
"ID",
",",
"storage",
".",
"ImageDigestBigDataKey",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"\"",
"\"",
",",
"err",
"\n",
"}",
"\n",
"s",
".",
"cachedManifest",
"=",
"cachedBlob",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"s",
".",
"cachedManifest",
",",
"manifest",
".",
"GuessMIMEType",
"(",
"s",
".",
"cachedManifest",
")",
",",
"err",
"\n",
"}"
] |
5,911 | all-5912 | [
"Dial",
"implements",
"the",
"StreamLayer",
"interface",
"."
] | [
"func",
"(",
"t",
"*",
"TCPStreamLayer",
")",
"Dial",
"(",
"address",
"ServerAddress",
",",
"timeout",
"time",
".",
"Duration",
")",
"(",
"net",
".",
"Conn",
",",
"error",
")",
"{",
"return",
"net",
".",
"DialTimeout",
"(",
"\"",
"\"",
",",
"string",
"(",
"<mask>",
")",
",",
"timeout",
")",
"\n",
"}"
] |
5,912 | all-5913 | [
"runCmd",
"is",
"a",
"helper",
"function",
"to",
"run",
"commands",
".",
"It",
"runs",
"command",
"with",
"args",
"from",
"directory",
"at",
"dir",
".",
"The",
"executed",
"process",
"outputs",
"to",
"os",
".",
"Stderr"
] | [
"func",
"runCmd",
"(",
"command",
"string",
",",
"args",
"[",
"]",
"string",
",",
"dir",
"string",
")",
"error",
"{",
"cmd",
":=",
"gos",
".",
"Command",
"(",
"command",
",",
"args",
"...",
")",
"\n",
"cmd",
".",
"Stdout",
"(",
"os",
".",
"Stderr",
")",
"\n",
"cmd",
".",
"Stderr",
"(",
"<mask>",
".",
"Stderr",
")",
"\n",
"cmd",
".",
"Dir",
"(",
"dir",
")",
"\n",
"if",
"err",
":=",
"cmd",
".",
"Start",
"(",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"return",
"cmd",
".",
"Wait",
"(",
")",
"\n",
"}"
] |
5,913 | all-5914 | [
"clearSSMSecretValue",
"cycles",
"through",
"the",
"collection",
"of",
"secret",
"value",
"data",
"and",
"removes",
"them",
"from",
"the",
"task"
] | [
"func",
"(",
"secret",
"*",
"SSMSecretResource",
")",
"clearSSMSecretValue",
"(",
")",
"{",
"secret",
".",
"lock",
".",
"Lock",
"(",
")",
"\n",
"defer",
"<mask>",
".",
"lock",
".",
"Unlock",
"(",
")",
"\n\n",
"for",
"key",
":=",
"range",
"secret",
".",
"secretData",
"{",
"delete",
"(",
"secret",
".",
"secretData",
",",
"key",
")",
"\n",
"}",
"\n",
"}"
] |
5,914 | all-5915 | [
"splitDirective",
"splits",
"a",
"comma",
"-",
"separated",
"directive",
"value",
"into",
"its",
"component",
"parts",
"trimming",
"each",
"of",
"any",
"whitespace",
"characters",
"."
] | [
"func",
"splitValue",
"(",
"value",
"string",
")",
"[",
"]",
"string",
"{",
"parts",
":=",
"strings",
".",
"Split",
"(",
"value",
",",
"\"",
"\"",
")",
"\n",
"values",
":=",
"make",
"(",
"[",
"]",
"string",
",",
"0",
",",
"len",
"(",
"parts",
")",
")",
"\n",
"for",
"_",
",",
"part",
":=",
"range",
"parts",
"{",
"values",
"=",
"append",
"(",
"values",
",",
"strings",
".",
"TrimSpace",
"(",
"<mask>",
")",
")",
"\n",
"}",
"\n",
"return",
"values",
"\n",
"}"
] |
5,915 | all-5916 | [
"GetToplevel",
"is",
"a",
"wrapper",
"around",
"gtk_widget_get_toplevel",
"()",
"."
] | [
"func",
"(",
"v",
"*",
"Widget",
")",
"GetToplevel",
"(",
")",
"(",
"*",
"Widget",
",",
"error",
")",
"{",
"c",
":=",
"C",
".",
"gtk_widget_get_toplevel",
"(",
"v",
".",
"native",
"(",
")",
")",
"\n",
"if",
"c",
"==",
"nil",
"{",
"return",
"nil",
",",
"nilPtrErr",
"\n",
"}",
"\n",
"<mask>",
"wrapWidget",
"(",
"glib",
".",
"Take",
"(",
"unsafe",
".",
"Pointer",
"(",
"c",
")",
")",
")",
",",
"nil",
"\n",
"}"
] |
5,916 | all-5917 | [
"command",
"main"
] | [
"func",
"command",
"(",
"opt",
"*",
"option",
")",
"error",
"{",
"var",
"dic",
"tokenizer",
".",
"Dic",
"\n",
"if",
"<mask>",
".",
"sysdic",
"==",
"\"",
"\"",
"{",
"dic",
"=",
"tokenizer",
".",
"SysDicIPASimple",
"(",
")",
"\n",
"}",
"else",
"{",
"dic",
"=",
"tokenizer",
".",
"SysDic",
"(",
")",
"\n",
"}",
"\n",
"t",
":=",
"tokenizer",
".",
"NewWithDic",
"(",
"dic",
")",
"\n\n",
"var",
"udic",
"tokenizer",
".",
"UserDic",
"\n",
"if",
"opt",
".",
"udic",
"!=",
"\"",
"\"",
"{",
"var",
"err",
"error",
"\n",
"if",
"udic",
",",
"err",
"=",
"tokenizer",
".",
"NewUserDic",
"(",
"opt",
".",
"udic",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"}",
"\n",
"t",
".",
"SetUserDic",
"(",
"udic",
")",
"\n\n",
"mux",
":=",
"http",
".",
"NewServeMux",
"(",
")",
"\n",
"mux",
".",
"Handle",
"(",
"\"",
"\"",
",",
"&",
"TokenizeDemoHandler",
"{",
"tokenizer",
":",
"t",
"}",
")",
"\n",
"mux",
".",
"Handle",
"(",
"\"",
"\"",
",",
"&",
"TokenizeHandler",
"{",
"tokenizer",
":",
"t",
"}",
")",
"\n",
"log",
".",
"Fatal",
"(",
"http",
".",
"ListenAndServe",
"(",
"opt",
".",
"http",
",",
"mux",
")",
")",
"\n\n",
"return",
"nil",
"\n",
"}"
] |
5,917 | all-5918 | [
"DeletePipeline",
"deletes",
"a",
"pipeline",
"along",
"with",
"its",
"output",
"Repo",
"."
] | [
"func",
"(",
"c",
"APIClient",
")",
"DeletePipeline",
"(",
"name",
"string",
",",
"force",
"bool",
")",
"error",
"{",
"_",
",",
"err",
":=",
"c",
".",
"PpsAPIClient",
".",
"DeletePipeline",
"(",
"c",
".",
"Ctx",
"(",
")",
",",
"&",
"pps",
".",
"DeletePipelineRequest",
"{",
"Pipeline",
":",
"NewPipeline",
"(",
"<mask>",
")",
",",
"Force",
":",
"force",
",",
"}",
",",
")",
"\n",
"return",
"grpcutil",
".",
"ScrubGRPC",
"(",
"err",
")",
"\n",
"}"
] |
5,918 | all-5919 | [
"Create",
"an",
"array",
"of",
"Typed",
"helpers",
"from",
"a",
"file",
"Used",
"for",
"when",
"the",
"root",
"is",
"an",
"array",
"which",
"contains",
"objects"
] | [
"func",
"JsonFileArray",
"(",
"path",
"string",
")",
"(",
"[",
"]",
"Typed",
",",
"error",
")",
"{",
"data",
",",
"err",
":=",
"ioutil",
".",
"ReadFile",
"(",
"<mask>",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"return",
"JsonArray",
"(",
"data",
")",
"\n",
"}"
] |
5,919 | all-5920 | [
"Disable",
"clustering",
"on",
"a",
"node",
"."
] | [
"func",
"clusterPutDisable",
"(",
"d",
"*",
"Daemon",
")",
"Response",
"{",
"// Close the cluster database",
"err",
":=",
"d",
".",
"cluster",
".",
"Close",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"SmartError",
"(",
"err",
")",
"\n",
"}",
"\n\n",
"// Update our TLS configuration using our original certificate.",
"for",
"_",
",",
"suffix",
":=",
"range",
"[",
"]",
"string",
"{",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
"}",
"{",
"path",
":=",
"filepath",
".",
"Join",
"(",
"d",
".",
"os",
".",
"VarDir",
",",
"\"",
"\"",
"+",
"suffix",
")",
"\n",
"if",
"!",
"shared",
".",
"PathExists",
"(",
"path",
")",
"{",
"continue",
"\n",
"}",
"\n",
"err",
":=",
"os",
".",
"Remove",
"(",
"path",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"InternalError",
"(",
"err",
")",
"\n",
"}",
"\n",
"}",
"\n",
"cert",
",",
"err",
":=",
"util",
".",
"LoadCert",
"(",
"d",
".",
"os",
".",
"VarDir",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"InternalError",
"(",
"<mask>",
".",
"Wrap",
"(",
"err",
",",
"\"",
"\"",
")",
")",
"\n",
"}",
"\n\n",
"// Reset the cluster database and make it local to this node.",
"d",
".",
"endpoints",
".",
"NetworkUpdateCert",
"(",
"cert",
")",
"\n",
"err",
"=",
"d",
".",
"gateway",
".",
"Reset",
"(",
"cert",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"SmartError",
"(",
"err",
")",
"\n",
"}",
"\n\n",
"// Re-open the cluster database",
"address",
",",
"err",
":=",
"node",
".",
"HTTPSAddress",
"(",
"d",
".",
"db",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"SmartError",
"(",
"err",
")",
"\n",
"}",
"\n",
"store",
":=",
"d",
".",
"gateway",
".",
"ServerStore",
"(",
")",
"\n",
"d",
".",
"cluster",
",",
"err",
"=",
"db",
".",
"OpenCluster",
"(",
"\"",
"\"",
",",
"store",
",",
"address",
",",
"\"",
"\"",
",",
"d",
".",
"config",
".",
"DqliteSetupTimeout",
",",
"dqlite",
".",
"WithDialFunc",
"(",
"d",
".",
"gateway",
".",
"DialFunc",
"(",
")",
")",
",",
"dqlite",
".",
"WithContext",
"(",
"d",
".",
"gateway",
".",
"Context",
"(",
")",
")",
",",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"SmartError",
"(",
"err",
")",
"\n",
"}",
"\n\n",
"// Stop the clustering tasks",
"d",
".",
"stopClusterTasks",
"(",
")",
"\n\n",
"// Remove the cluster flag from the agent",
"version",
".",
"UserAgentFeatures",
"(",
"nil",
")",
"\n\n",
"return",
"EmptySyncResponse",
"\n",
"}"
] |
5,920 | all-5921 | [
"From",
"Lua",
"s",
"specs",
":",
"A",
"metamethod",
"only",
"is",
"selected",
"when",
"both",
"objects",
"being",
"compared",
"have",
"the",
"same",
"type",
"and",
"the",
"same",
"metamethod",
"for",
"the",
"selected",
"operation",
".",
"Thus",
"both",
"arguments",
"must",
"be",
"proxies",
"for",
"this",
"function",
"to",
"be",
"called",
".",
"No",
"need",
"to",
"check",
"for",
"type",
"equality",
":",
"Go",
"s",
"==",
"operator",
"will",
"do",
"it",
"for",
"us",
"."
] | [
"func",
"proxy__eq",
"(",
"L",
"*",
"lua",
".",
"State",
")",
"int",
"{",
"<mask>",
"a1",
"interface",
"{",
"}",
"\n",
"_",
"=",
"LuaToGo",
"(",
"L",
",",
"1",
",",
"&",
"a1",
")",
"\n",
"var",
"a2",
"interface",
"{",
"}",
"\n",
"_",
"=",
"LuaToGo",
"(",
"L",
",",
"2",
",",
"&",
"a2",
")",
"\n",
"L",
".",
"PushBoolean",
"(",
"a1",
"==",
"a2",
")",
"\n",
"return",
"1",
"\n",
"}"
] |
5,921 | all-5922 | [
"set",
"a",
"named",
"parameter",
"of",
"a",
"framebuffer",
"object"
] | [
"func",
"FramebufferParameteri",
"(",
"target",
"uint32",
",",
"pname",
"uint32",
",",
"param",
"int32",
")",
"{",
"C",
".",
"glowFramebufferParameteri",
"(",
"gpFramebufferParameteri",
",",
"(",
"C",
".",
"GLenum",
")",
"(",
"<mask>",
")",
",",
"(",
"C",
".",
"GLenum",
")",
"(",
"pname",
")",
",",
"(",
"C",
".",
"GLint",
")",
"(",
"param",
")",
")",
"\n",
"}"
] |
5,922 | all-5923 | [
"Determines",
"if",
"a",
"name",
"corresponds",
"to",
"a",
"shader",
"object"
] | [
"func",
"IsShader",
"(",
"shader",
"uint32",
")",
"bool",
"{",
"<mask>",
",",
"_",
",",
"_",
":=",
"syscall",
".",
"Syscall",
"(",
"gpIsShader",
",",
"1",
",",
"uintptr",
"(",
"shader",
")",
",",
"0",
",",
"0",
")",
"\n",
"return",
"ret",
"!=",
"0",
"\n",
"}"
] |
5,923 | all-5924 | [
"GetDefaultSource",
"()",
"is",
"a",
"wrapper",
"around",
"gtk_print_settings_get_default_source",
"()",
"."
] | [
"func",
"(",
"<mask>",
"*",
"PrintSettings",
")",
"GetDefaultSource",
"(",
")",
"string",
"{",
"c",
":=",
"C",
".",
"gtk_print_settings_get_default_source",
"(",
"ps",
".",
"native",
"(",
")",
")",
"\n",
"return",
"C",
".",
"GoString",
"(",
"(",
"*",
"C",
".",
"char",
")",
"(",
"c",
")",
")",
"\n",
"}"
] |
5,924 | all-5925 | [
"newBoundaryReader",
"returns",
"an",
"initialized",
"boundaryReader"
] | [
"func",
"newBoundaryReader",
"(",
"reader",
"*",
"bufio",
".",
"Reader",
",",
"boundary",
"string",
")",
"*",
"boundaryReader",
"{",
"fullBoundary",
":=",
"[",
"]",
"byte",
"(",
"\"",
"\\n",
"\"",
"+",
"boundary",
"+",
"\"",
"\"",
")",
"\n",
"return",
"&",
"boundaryReader",
"{",
"r",
":",
"reader",
",",
"nlPrefix",
":",
"fullBoundary",
"[",
":",
"len",
"(",
"fullBoundary",
")",
"-",
"2",
"]",
",",
"prefix",
":",
"fullBoundary",
"[",
"1",
":",
"len",
"(",
"fullBoundary",
")",
"-",
"2",
"]",
",",
"final",
":",
"fullBoundary",
"[",
"1",
":",
"]",
",",
"buffer",
":",
"new",
"(",
"bytes",
".",
"<mask>",
")",
",",
"}",
"\n",
"}"
] |
5,925 | all-5926 | [
"NewSensitiveRawMessage",
"returns",
"a",
"new",
"encapsulated",
"json",
".",
"RawMessage",
"or",
"nil",
"if",
"the",
"data",
"is",
"empty",
".",
"It",
"cannot",
"be",
"accidentally",
"logged",
"via",
".",
"String",
"/",
".",
"GoString",
"/",
"%v",
"/",
"%#v"
] | [
"func",
"NewSensitiveRawMessage",
"(",
"data",
"json",
".",
"RawMessage",
")",
"*",
"SensitiveRawMessage",
"{",
"if",
"len",
"(",
"data",
")",
"==",
"0",
"{",
"return",
"nil",
"\n",
"}",
"\n",
"return",
"&",
"SensitiveRawMessage",
"{",
"contents",
":",
"<mask>",
"}",
"\n",
"}"
] |
5,926 | all-5927 | [
"UnmarshalJSON",
"supports",
"json",
".",
"Unmarshaler",
"interface"
] | [
"func",
"(",
"v",
"*",
"CopyToReturns",
")",
"UnmarshalJSON",
"(",
"data",
"[",
"]",
"<mask>",
")",
"error",
"{",
"r",
":=",
"jlexer",
".",
"Lexer",
"{",
"Data",
":",
"data",
"}",
"\n",
"easyjsonC5a4559bDecodeGithubComChromedpCdprotoDom74",
"(",
"&",
"r",
",",
"v",
")",
"\n",
"return",
"r",
".",
"Error",
"(",
")",
"\n",
"}"
] |
5,927 | all-5928 | [
"EventWindowStateNewFromEvent",
"returns",
"an",
"EventWindowState",
"from",
"an",
"Event",
".",
"Using",
"widget",
".",
"Connect",
"()",
"for",
"the",
"window",
"-",
"state",
"-",
"event",
"signal",
"results",
"in",
"a",
"*",
"Event",
"being",
"passed",
"as",
"the",
"callback",
"s",
"second",
"argument",
".",
"The",
"argument",
"is",
"actually",
"a",
"*",
"EventWindowState",
".",
"EventWindowStateNewFromEvent",
"provides",
"a",
"means",
"of",
"creating",
"an",
"EventWindowState",
"from",
"the",
"Event",
"."
] | [
"func",
"EventWindowStateNewFromEvent",
"(",
"event",
"*",
"Event",
")",
"*",
"EventWindowState",
"{",
"ee",
":=",
"(",
"*",
"C",
".",
"GdkEvent",
")",
"(",
"unsafe",
".",
"Pointer",
"(",
"<mask>",
".",
"native",
"(",
")",
")",
")",
"\n",
"ev",
":=",
"Event",
"{",
"ee",
"}",
"\n",
"return",
"&",
"EventWindowState",
"{",
"&",
"ev",
"}",
"\n",
"}"
] |
5,928 | all-5929 | [
"SetBSON",
"sets",
"the",
"Email",
"from",
"raw",
"bson",
"data"
] | [
"func",
"(",
"e",
"*",
"Email",
")",
"SetBSON",
"(",
"raw",
"bson",
".",
"Raw",
")",
"error",
"{",
"var",
"m",
"bson",
".",
"M",
"\n",
"if",
"err",
":=",
"raw",
".",
"Unmarshal",
"(",
"&",
"m",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"if",
"data",
",",
"ok",
":=",
"m",
"[",
"\"",
"\"",
"]",
".",
"(",
"string",
")",
";",
"ok",
"{",
"*",
"e",
"=",
"Email",
"(",
"data",
")",
"\n",
"return",
"nil",
"\n",
"}",
"\n\n",
"return",
"<mask>",
".",
"New",
"(",
"\"",
"\"",
")",
"\n",
"}"
] |
5,929 | all-5930 | [
"GetScaleOk",
"returns",
"a",
"tuple",
"with",
"the",
"Scale",
"field",
"if",
"it",
"s",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"and",
"a",
"boolean",
"to",
"check",
"if",
"the",
"value",
"has",
"been",
"set",
"."
] | [
"func",
"(",
"y",
"*",
"Yaxis",
")",
"GetScaleOk",
"(",
")",
"(",
"string",
",",
"bool",
")",
"{",
"if",
"y",
"==",
"nil",
"||",
"y",
".",
"Scale",
"==",
"nil",
"{",
"return",
"\"",
"\"",
",",
"false",
"\n",
"}",
"\n",
"return",
"*",
"y",
".",
"Scale",
",",
"<mask>",
"\n",
"}"
] |
5,930 | all-5931 | [
"GetCompareToOk",
"returns",
"a",
"tuple",
"with",
"the",
"CompareTo",
"field",
"if",
"it",
"s",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"and",
"a",
"boolean",
"to",
"check",
"if",
"the",
"value",
"has",
"been",
"set",
"."
] | [
"func",
"(",
"g",
"*",
"GraphDefinitionRequest",
")",
"GetCompareToOk",
"(",
")",
"(",
"string",
",",
"bool",
")",
"{",
"if",
"g",
"==",
"nil",
"||",
"g",
".",
"CompareTo",
"==",
"nil",
"{",
"return",
"\"",
"\"",
",",
"false",
"\n",
"}",
"\n",
"return",
"*",
"g",
".",
"CompareTo",
",",
"<mask>",
"\n",
"}"
] |
5,931 | all-5932 | [
"/",
"*",
"Create",
"a",
"new",
"default",
"idmap"
] | [
"func",
"DefaultIdmapSet",
"(",
"rootfs",
"string",
",",
"username",
"string",
")",
"(",
"*",
"IdmapSet",
",",
"error",
")",
"{",
"idmapset",
":=",
"new",
"(",
"IdmapSet",
")",
"\n\n",
"if",
"username",
"==",
"\"",
"\"",
"{",
"currentUser",
",",
"err",
":=",
"user",
".",
"Current",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"username",
"=",
"currentUser",
".",
"Username",
"\n",
"}",
"\n\n",
"// Check if shadow's uidmap tools are installed",
"subuidPath",
":=",
"path",
".",
"Join",
"(",
"rootfs",
",",
"\"",
"\"",
")",
"\n",
"subgidPath",
":=",
"path",
".",
"Join",
"(",
"rootfs",
",",
"\"",
"\"",
")",
"\n",
"if",
"shared",
".",
"PathExists",
"(",
"subuidPath",
")",
"&&",
"shared",
".",
"PathExists",
"(",
"subgidPath",
")",
"{",
"// Parse the shadow uidmap",
"entries",
",",
"err",
":=",
"getFromShadow",
"(",
"subuidPath",
",",
"username",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"for",
"_",
",",
"entry",
":=",
"range",
"entries",
"{",
"// Check that it's big enough to be useful",
"if",
"int",
"(",
"entry",
"[",
"1",
"]",
")",
"<",
"65536",
"{",
"continue",
"\n",
"}",
"\n\n",
"e",
":=",
"IdmapEntry",
"{",
"Isuid",
":",
"true",
",",
"Nsid",
":",
"0",
",",
"Hostid",
":",
"entry",
"[",
"0",
"]",
",",
"Maprange",
":",
"entry",
"[",
"1",
"]",
"}",
"\n",
"idmapset",
".",
"Idmap",
"=",
"Extend",
"(",
"idmapset",
".",
"Idmap",
",",
"e",
")",
"\n\n",
"// NOTE: Remove once LXD can deal with multiple shadow maps",
"break",
"\n",
"}",
"\n\n",
"// Parse the shadow gidmap",
"entries",
",",
"err",
"=",
"getFromShadow",
"(",
"subgidPath",
",",
"username",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"for",
"_",
",",
"entry",
":=",
"range",
"entries",
"{",
"// Check that it's big enough to be useful",
"if",
"int",
"(",
"entry",
"[",
"1",
"]",
")",
"<",
"65536",
"{",
"continue",
"\n",
"}",
"\n\n",
"e",
":=",
"IdmapEntry",
"{",
"Isgid",
":",
"true",
",",
"Nsid",
":",
"0",
",",
"Hostid",
":",
"entry",
"[",
"0",
"]",
",",
"Maprange",
":",
"<mask>",
"[",
"1",
"]",
"}",
"\n",
"idmapset",
".",
"Idmap",
"=",
"Extend",
"(",
"idmapset",
".",
"Idmap",
",",
"e",
")",
"\n\n",
"// NOTE: Remove once LXD can deal with multiple shadow maps",
"break",
"\n",
"}",
"\n\n",
"return",
"idmapset",
",",
"nil",
"\n",
"}",
"\n\n",
"// No shadow available, figure out a default map",
"kernelMap",
",",
"err",
":=",
"CurrentIdmapSet",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"// Hardcoded fallback map",
"e",
":=",
"IdmapEntry",
"{",
"Isuid",
":",
"true",
",",
"Isgid",
":",
"false",
",",
"Nsid",
":",
"0",
",",
"Hostid",
":",
"1000000",
",",
"Maprange",
":",
"1000000000",
"}",
"\n",
"idmapset",
".",
"Idmap",
"=",
"Extend",
"(",
"idmapset",
".",
"Idmap",
",",
"e",
")",
"\n\n",
"e",
"=",
"IdmapEntry",
"{",
"Isuid",
":",
"false",
",",
"Isgid",
":",
"true",
",",
"Nsid",
":",
"0",
",",
"Hostid",
":",
"1000000",
",",
"Maprange",
":",
"1000000000",
"}",
"\n",
"idmapset",
".",
"Idmap",
"=",
"Extend",
"(",
"idmapset",
".",
"Idmap",
",",
"e",
")",
"\n",
"return",
"idmapset",
",",
"nil",
"\n",
"}",
"\n\n",
"// Look for mapped ranges",
"kernelRanges",
",",
"err",
":=",
"kernelMap",
".",
"ValidRanges",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"// Special case for when we have the full kernel range",
"fullKernelRanges",
":=",
"[",
"]",
"*",
"IdRange",
"{",
"{",
"true",
",",
"false",
",",
"int64",
"(",
"0",
")",
",",
"int64",
"(",
"4294967294",
")",
"}",
",",
"{",
"false",
",",
"true",
",",
"int64",
"(",
"0",
")",
",",
"int64",
"(",
"4294967294",
")",
"}",
"}",
"\n\n",
"if",
"reflect",
".",
"DeepEqual",
"(",
"kernelRanges",
",",
"fullKernelRanges",
")",
"{",
"// Hardcoded fallback map",
"e",
":=",
"IdmapEntry",
"{",
"Isuid",
":",
"true",
",",
"Isgid",
":",
"false",
",",
"Nsid",
":",
"0",
",",
"Hostid",
":",
"1000000",
",",
"Maprange",
":",
"1000000000",
"}",
"\n",
"idmapset",
".",
"Idmap",
"=",
"Extend",
"(",
"idmapset",
".",
"Idmap",
",",
"e",
")",
"\n\n",
"e",
"=",
"IdmapEntry",
"{",
"Isuid",
":",
"false",
",",
"Isgid",
":",
"true",
",",
"Nsid",
":",
"0",
",",
"Hostid",
":",
"1000000",
",",
"Maprange",
":",
"1000000000",
"}",
"\n",
"idmapset",
".",
"Idmap",
"=",
"Extend",
"(",
"idmapset",
".",
"Idmap",
",",
"e",
")",
"\n",
"return",
"idmapset",
",",
"nil",
"\n",
"}",
"\n\n",
"// Find a suitable uid range",
"for",
"_",
",",
"entry",
":=",
"range",
"kernelRanges",
"{",
"// We only care about uids right now",
"if",
"!",
"entry",
".",
"Isuid",
"{",
"continue",
"\n",
"}",
"\n\n",
"// We want a map that's separate from the system's own POSIX allocation",
"if",
"entry",
".",
"Endid",
"<",
"100000",
"{",
"continue",
"\n",
"}",
"\n\n",
"// Don't use the first 65536 ids",
"if",
"entry",
".",
"Startid",
"<",
"100000",
"{",
"entry",
".",
"Startid",
"=",
"100000",
"\n",
"}",
"\n\n",
"// Check if we have enough ids",
"if",
"entry",
".",
"Endid",
"-",
"entry",
".",
"Startid",
"<",
"65536",
"{",
"continue",
"\n",
"}",
"\n\n",
"// Add the map",
"e",
":=",
"IdmapEntry",
"{",
"Isuid",
":",
"true",
",",
"Isgid",
":",
"false",
",",
"Nsid",
":",
"0",
",",
"Hostid",
":",
"entry",
".",
"Startid",
",",
"Maprange",
":",
"entry",
".",
"Endid",
"-",
"entry",
".",
"Startid",
"+",
"1",
"}",
"\n",
"idmapset",
".",
"Idmap",
"=",
"Extend",
"(",
"idmapset",
".",
"Idmap",
",",
"e",
")",
"\n\n",
"// NOTE: Remove once LXD can deal with multiple shadow maps",
"break",
"\n",
"}",
"\n\n",
"// Find a suitable gid range",
"for",
"_",
",",
"entry",
":=",
"range",
"kernelRanges",
"{",
"// We only care about gids right now",
"if",
"!",
"entry",
".",
"Isgid",
"{",
"continue",
"\n",
"}",
"\n\n",
"// We want a map that's separate from the system's own POSIX allocation",
"if",
"entry",
".",
"Endid",
"<",
"100000",
"{",
"continue",
"\n",
"}",
"\n\n",
"// Don't use the first 65536 ids",
"if",
"entry",
".",
"Startid",
"<",
"100000",
"{",
"entry",
".",
"Startid",
"=",
"100000",
"\n",
"}",
"\n\n",
"// Check if we have enough ids",
"if",
"entry",
".",
"Endid",
"-",
"entry",
".",
"Startid",
"<",
"65536",
"{",
"continue",
"\n",
"}",
"\n\n",
"// Add the map",
"e",
":=",
"IdmapEntry",
"{",
"Isuid",
":",
"false",
",",
"Isgid",
":",
"true",
",",
"Nsid",
":",
"0",
",",
"Hostid",
":",
"entry",
".",
"Startid",
",",
"Maprange",
":",
"entry",
".",
"Endid",
"-",
"entry",
".",
"Startid",
"+",
"1",
"}",
"\n",
"idmapset",
".",
"Idmap",
"=",
"Extend",
"(",
"idmapset",
".",
"Idmap",
",",
"e",
")",
"\n\n",
"// NOTE: Remove once LXD can deal with multiple shadow maps",
"break",
"\n",
"}",
"\n\n",
"return",
"idmapset",
",",
"nil",
"\n",
"}"
] |
5,932 | all-5933 | [
"Parse",
"is",
"a",
"representation",
"of",
"gdk_rgba_parse",
"()",
"."
] | [
"func",
"(",
"v",
"*",
"RGBA",
")",
"Parse",
"(",
"<mask>",
"string",
")",
"bool",
"{",
"cstr",
":=",
"(",
"*",
"C",
".",
"gchar",
")",
"(",
"C",
".",
"CString",
"(",
"spec",
")",
")",
"\n",
"defer",
"C",
".",
"free",
"(",
"unsafe",
".",
"Pointer",
"(",
"cstr",
")",
")",
"\n\n",
"return",
"gobool",
"(",
"C",
".",
"gdk_rgba_parse",
"(",
"v",
".",
"rgba",
",",
"cstr",
")",
")",
"\n",
"}"
] |
5,933 | all-5934 | [
"RemoveAction",
"is",
"a",
"wrapper",
"around",
"g_action_map_remove_action"
] | [
"func",
"(",
"v",
"*",
"ActionMap",
")",
"RemoveAction",
"(",
"actionName",
"<mask>",
")",
"{",
"C",
".",
"g_action_map_remove_action",
"(",
"v",
".",
"native",
"(",
")",
",",
"(",
"*",
"C",
".",
"gchar",
")",
"(",
"C",
".",
"CString",
"(",
"actionName",
")",
")",
")",
"\n",
"}"
] |
5,934 | all-5935 | [
"GetFloat",
"returns",
"float",
"value",
"for",
"the",
"given",
"key"
] | [
"func",
"(",
"c",
"GConfig",
")",
"GetFloat",
"(",
"key",
"string",
")",
"float64",
"{",
"v",
",",
"_",
":=",
"strconv",
".",
"ParseFloat",
"(",
"c",
".",
"getStringValue",
"(",
"<mask>",
")",
",",
"32",
")",
"\n",
"return",
"v",
"\n",
"}"
] |
5,935 | all-5936 | [
"Currently",
"only",
"used",
"for",
"loop",
"-",
"backed",
"LVM",
"storage",
"pools",
".",
"Can",
"be",
"called",
"without",
"overhead",
"since",
"it",
"is",
"essentially",
"a",
"noop",
"for",
"non",
"-",
"loop",
"-",
"backed",
"LVM",
"storage",
"pools",
"."
] | [
"func",
"(",
"s",
"*",
"storageLvm",
")",
"StoragePoolMount",
"(",
")",
"(",
"bool",
",",
"error",
")",
"{",
"source",
":=",
"s",
".",
"pool",
".",
"Config",
"[",
"\"",
"\"",
"]",
"\n",
"if",
"source",
"==",
"\"",
"\"",
"{",
"return",
"false",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\\\"",
"\\\"",
"\"",
")",
"\n",
"}",
"\n\n",
"if",
"!",
"filepath",
".",
"IsAbs",
"(",
"source",
")",
"{",
"return",
"true",
",",
"nil",
"\n",
"}",
"\n\n",
"poolMountLockID",
":=",
"getPoolMountLockID",
"(",
"s",
".",
"pool",
".",
"Name",
")",
"\n",
"lxdStorageMapLock",
".",
"Lock",
"(",
")",
"\n",
"if",
"waitChannel",
",",
"ok",
":=",
"lxdStorageOngoingOperationMap",
"[",
"poolMountLockID",
"]",
";",
"ok",
"{",
"lxdStorageMapLock",
".",
"Unlock",
"(",
")",
"\n",
"if",
"_",
",",
"ok",
":=",
"<-",
"waitChannel",
";",
"ok",
"{",
"logger",
".",
"Warnf",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"// Give the benefit of the doubt and assume that the other",
"// thread actually succeeded in mounting the storage pool.",
"return",
"false",
",",
"nil",
"\n",
"}",
"\n\n",
"lxdStorageOngoingOperationMap",
"[",
"poolMountLockID",
"]",
"=",
"make",
"(",
"chan",
"bool",
")",
"\n",
"lxdStorageMapLock",
".",
"Unlock",
"(",
")",
"\n\n",
"removeLockFromMap",
":=",
"func",
"(",
")",
"{",
"lxdStorageMapLock",
".",
"Lock",
"(",
")",
"\n",
"if",
"waitChannel",
",",
"ok",
":=",
"lxdStorageOngoingOperationMap",
"[",
"poolMountLockID",
"]",
";",
"ok",
"{",
"close",
"(",
"waitChannel",
")",
"\n",
"delete",
"(",
"lxdStorageOngoingOperationMap",
",",
"poolMountLockID",
")",
"\n",
"}",
"\n",
"lxdStorageMapLock",
".",
"Unlock",
"(",
")",
"\n",
"}",
"\n\n",
"defer",
"removeLockFromMap",
"(",
")",
"\n\n",
"if",
"filepath",
".",
"IsAbs",
"(",
"<mask>",
")",
"&&",
"!",
"shared",
".",
"IsBlockdevPath",
"(",
"source",
")",
"{",
"// Try to prepare new loop device.",
"loopF",
",",
"loopErr",
":=",
"prepareLoopDev",
"(",
"source",
",",
"0",
")",
"\n",
"if",
"loopErr",
"!=",
"nil",
"{",
"return",
"false",
",",
"loopErr",
"\n",
"}",
"\n",
"// Make sure that LO_FLAGS_AUTOCLEAR is unset.",
"loopErr",
"=",
"unsetAutoclearOnLoopDev",
"(",
"int",
"(",
"loopF",
".",
"Fd",
"(",
")",
")",
")",
"\n",
"if",
"loopErr",
"!=",
"nil",
"{",
"return",
"false",
",",
"loopErr",
"\n",
"}",
"\n",
"s",
".",
"loopInfo",
"=",
"loopF",
"\n",
"}",
"\n\n",
"return",
"true",
",",
"nil",
"\n",
"}"
] |
5,936 | all-5937 | [
"Leave",
"removes",
"the",
"provided",
"member",
"from",
"the",
"group",
"and",
"closes",
"him"
] | [
"func",
"(",
"g",
"*",
"Group",
")",
"Leave",
"(",
"leaving",
"*",
"Member",
")",
"error",
"{",
"g",
".",
"memberLock",
".",
"Lock",
"(",
")",
"\n",
"memberIndex",
":=",
"-",
"1",
"\n",
"for",
"<mask>",
",",
"member",
":=",
"range",
"g",
".",
"members",
"{",
"if",
"member",
"==",
"leaving",
"{",
"memberIndex",
"=",
"index",
"\n",
"break",
"\n",
"}",
"\n",
"}",
"\n",
"if",
"memberIndex",
"==",
"-",
"1",
"{",
"g",
".",
"memberLock",
".",
"Unlock",
"(",
")",
"\n",
"return",
"errors",
".",
"New",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"g",
".",
"members",
"=",
"append",
"(",
"g",
".",
"members",
"[",
":",
"memberIndex",
"]",
",",
"g",
".",
"members",
"[",
"memberIndex",
"+",
"1",
":",
"]",
"...",
")",
"\n",
"leaving",
".",
"close",
"<-",
"true",
"// TODO: need to handle the case where there",
"\n",
"close",
"(",
"leaving",
".",
"Read",
")",
"\n\n",
"// is still stuff in this Members priorityQueue",
"g",
".",
"memberLock",
".",
"Unlock",
"(",
")",
"\n",
"return",
"nil",
"\n",
"}"
] |
5,937 | all-5938 | [
"Documentation",
":",
"https",
":",
"//",
"developers",
".",
"facebook",
".",
"com",
"/",
"docs",
"/",
"messenger",
"-",
"platform",
"/",
"send",
"-",
"api",
"-",
"reference",
"/",
"quick",
"-",
"replies#quick_reply"
] | [
"func",
"(",
"mq",
"*",
"MessageQuery",
")",
"QuickReply",
"(",
"qr",
"QuickReply",
")",
"error",
"{",
"//max 10 quick replies",
"if",
"len",
"(",
"mq",
".",
"Message",
".",
"QuickReplies",
")",
">=",
"10",
"{",
"return",
"errors",
".",
"New",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"//if location then no title or payload",
"if",
"qr",
".",
"ContentType",
"==",
"ContentTypeLocation",
"&&",
"(",
"len",
"(",
"qr",
".",
"Title",
")",
"!=",
"0",
"||",
"len",
"(",
"qr",
".",
"Payload",
")",
"!=",
"0",
")",
"{",
"return",
"errors",
".",
"New",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"//title has a 20 character limit",
"if",
"len",
"(",
"qr",
".",
"Title",
")",
">",
"20",
"{",
"return",
"errors",
".",
"New",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"//payload has a 1000 character limit",
"if",
"len",
"(",
"qr",
".",
"Payload",
")",
">",
"1000",
"{",
"return",
"<mask>",
".",
"New",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"if",
"len",
"(",
"qr",
".",
"ContentType",
")",
"==",
"0",
"{",
"qr",
".",
"ContentType",
"=",
"ContentTypeText",
"\n",
"}",
"\n\n",
"mq",
".",
"Message",
".",
"QuickReplies",
"=",
"append",
"(",
"mq",
".",
"Message",
".",
"QuickReplies",
",",
"qr",
")",
"\n",
"return",
"nil",
"\n",
"}"
] |
5,938 | all-5939 | [
"Get",
"a",
"temporary",
"token",
"suitable",
"for",
"use",
"connecting",
"to",
"a",
"[",
"websocktunnel",
"]",
"(",
"https",
":",
"//",
"github",
".",
"com",
"/",
"taskcluster",
"/",
"websocktunnel",
")",
"server",
".",
"The",
"resulting",
"token",
"will",
"only",
"be",
"accepted",
"by",
"servers",
"with",
"a",
"matching",
"audience",
"value",
".",
"Reaching",
"such",
"a",
"server",
"is",
"the",
"callers",
"responsibility",
".",
"In",
"general",
"a",
"server",
"URL",
"or",
"set",
"of",
"URLs",
"should",
"be",
"provided",
"to",
"the",
"caller",
"as",
"configuration",
"along",
"with",
"the",
"audience",
"value",
".",
"The",
"token",
"is",
"valid",
"for",
"a",
"limited",
"time",
"(",
"on",
"the",
"scale",
"of",
"hours",
")",
".",
"Callers",
"should",
"refresh",
"it",
"before",
"expiration",
".",
"Required",
"scopes",
":",
"auth",
":",
"websocktunnel",
"-",
"token",
":",
"<wstAudience",
">",
"/",
"<wstClient",
">",
"See",
"#websocktunnelToken"
] | [
"func",
"(",
"auth",
"*",
"Auth",
")",
"WebsocktunnelToken",
"(",
"wstAudience",
",",
"wstClient",
"string",
")",
"(",
"*",
"WebsocktunnelTokenResponse",
",",
"error",
")",
"{",
"cd",
":=",
"tcclient",
".",
"Client",
"(",
"*",
"auth",
")",
"\n",
"responseObject",
",",
"_",
",",
"err",
":=",
"(",
"&",
"cd",
")",
".",
"APICall",
"(",
"nil",
",",
"\"",
"\"",
",",
"\"",
"\"",
"+",
"<mask>",
".",
"QueryEscape",
"(",
"wstAudience",
")",
"+",
"\"",
"\"",
"+",
"url",
".",
"QueryEscape",
"(",
"wstClient",
")",
",",
"new",
"(",
"WebsocktunnelTokenResponse",
")",
",",
"nil",
")",
"\n",
"return",
"responseObject",
".",
"(",
"*",
"WebsocktunnelTokenResponse",
")",
",",
"err",
"\n",
"}"
] |
5,939 | all-5940 | [
"Do",
"executes",
"Debugger",
".",
"stepInto",
"against",
"the",
"provided",
"context",
"."
] | [
"func",
"(",
"p",
"*",
"StepIntoParams",
")",
"Do",
"(",
"ctx",
"<mask>",
".",
"Context",
")",
"(",
"err",
"error",
")",
"{",
"return",
"cdp",
".",
"Execute",
"(",
"ctx",
",",
"CommandStepInto",
",",
"p",
",",
"nil",
")",
"\n",
"}"
] |
5,940 | all-5941 | [
"HasTitleSize",
"returns",
"a",
"boolean",
"if",
"a",
"field",
"has",
"been",
"set",
"."
] | [
"func",
"(",
"a",
"*",
"AlertValueDefinition",
")",
"HasTitleSize",
"(",
")",
"bool",
"{",
"if",
"a",
"!=",
"nil",
"&&",
"a",
".",
"TitleSize",
"!=",
"nil",
"{",
"return",
"<mask>",
"\n",
"}",
"\n\n",
"return",
"false",
"\n",
"}"
] |
5,941 | all-5942 | [
"ApplicationWindowNew",
"is",
"a",
"wrapper",
"around",
"gtk_application_window_new",
"()",
"."
] | [
"func",
"ApplicationWindowNew",
"(",
"app",
"*",
"<mask>",
")",
"(",
"*",
"ApplicationWindow",
",",
"error",
")",
"{",
"c",
":=",
"C",
".",
"gtk_application_window_new",
"(",
"app",
".",
"native",
"(",
")",
")",
"\n",
"if",
"c",
"==",
"nil",
"{",
"return",
"nil",
",",
"nilPtrErr",
"\n",
"}",
"\n",
"return",
"wrapApplicationWindow",
"(",
"glib",
".",
"Take",
"(",
"unsafe",
".",
"Pointer",
"(",
"c",
")",
")",
")",
",",
"nil",
"\n",
"}"
] |
5,942 | all-5943 | [
"decodeResponse",
"is",
"used",
"to",
"decode",
"an",
"RPC",
"response",
"and",
"reports",
"whether",
"the",
"connection",
"can",
"be",
"reused",
"."
] | [
"func",
"decodeResponse",
"(",
"conn",
"*",
"netConn",
",",
"resp",
"interface",
"{",
"}",
")",
"(",
"bool",
",",
"error",
")",
"{",
"// Decode the error if any",
"var",
"rpcError",
"string",
"\n",
"if",
"err",
":=",
"<mask>",
".",
"dec",
".",
"Decode",
"(",
"&",
"rpcError",
")",
";",
"err",
"!=",
"nil",
"{",
"conn",
".",
"Release",
"(",
")",
"\n",
"return",
"false",
",",
"err",
"\n",
"}",
"\n\n",
"// Decode the response",
"if",
"err",
":=",
"conn",
".",
"dec",
".",
"Decode",
"(",
"resp",
")",
";",
"err",
"!=",
"nil",
"{",
"conn",
".",
"Release",
"(",
")",
"\n",
"return",
"false",
",",
"err",
"\n",
"}",
"\n\n",
"// Format an error if any",
"if",
"rpcError",
"!=",
"\"",
"\"",
"{",
"return",
"true",
",",
"fmt",
".",
"Errorf",
"(",
"rpcError",
")",
"\n",
"}",
"\n",
"return",
"true",
",",
"nil",
"\n",
"}"
] |
5,943 | all-5944 | [
"HostFolderFromObject",
"returns",
"an",
"*",
"object",
".",
"Folder",
"from",
"a",
"given",
"object",
"and",
"relative",
"host",
"folder",
"path",
".",
"If",
"no",
"such",
"folder",
"is",
"found",
"or",
"if",
"it",
"is",
"not",
"a",
"host",
"folder",
"an",
"appropriate",
"error",
"will",
"be",
"returned",
"."
] | [
"func",
"HostFolderFromObject",
"(",
"<mask>",
"*",
"govmomi",
".",
"Client",
",",
"obj",
"interface",
"{",
"}",
",",
"relative",
"string",
")",
"(",
"*",
"object",
".",
"Folder",
",",
"error",
")",
"{",
"folder",
",",
"err",
":=",
"folderFromObject",
"(",
"client",
",",
"obj",
",",
"RootPathParticleHost",
",",
"relative",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"return",
"validateHostFolder",
"(",
"folder",
")",
"\n",
"}"
] |
5,944 | all-5945 | [
"GcvInitCameraMatrix2D",
"takes",
"one",
"3",
"-",
"by",
"-",
"N",
"matrix",
"and",
"one",
"2",
"-",
"by",
"-",
"N",
"Matrix",
"as",
"input",
".",
"Each",
"column",
"in",
"the",
"input",
"matrix",
"represents",
"a",
"point",
"in",
"real",
"world",
"(",
"objPts",
")",
"or",
"in",
"image",
"(",
"imgPts",
")",
".",
"Return",
":",
"the",
"camera",
"matrix",
"."
] | [
"func",
"GcvInitCameraMatrix2D",
"(",
"objPts",
",",
"imgPts",
"*",
"mat64",
".",
"Dense",
",",
"dims",
"[",
"2",
"]",
"int",
",",
"aspectRatio",
"float64",
")",
"(",
"camMat",
"*",
"mat64",
".",
"Dense",
")",
"{",
"objDim",
",",
"nObjPts",
":=",
"objPts",
".",
"Dims",
"(",
")",
"\n",
"imgDim",
",",
"nImgPts",
":=",
"imgPts",
".",
"Dims",
"(",
")",
"\n\n",
"if",
"objDim",
"!=",
"3",
"||",
"imgDim",
"!=",
"2",
"||",
"nObjPts",
"!=",
"nImgPts",
"{",
"panic",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"objPtsVec",
":=",
"NewGcvPoint3f32Vector",
"(",
"int64",
"(",
"nObjPts",
")",
")",
"\n",
"imgPtsVec",
":=",
"NewGcvPoint2f32Vector",
"(",
"int64",
"(",
"nObjPts",
")",
")",
"\n\n",
"for",
"j",
":=",
"0",
";",
"j",
"<",
"nObjPts",
";",
"j",
"++",
"{",
"objPtsVec",
".",
"<mask>",
"(",
"j",
",",
"NewGcvPoint3f32",
"(",
"mat64",
".",
"Col",
"(",
"nil",
",",
"j",
",",
"objPts",
")",
"...",
")",
")",
"\n",
"}",
"\n\n",
"for",
"j",
":=",
"0",
";",
"j",
"<",
"nObjPts",
";",
"j",
"++",
"{",
"imgPtsVec",
".",
"Set",
"(",
"j",
",",
"NewGcvPoint2f32",
"(",
"mat64",
".",
"Col",
"(",
"nil",
",",
"j",
",",
"imgPts",
")",
"...",
")",
")",
"\n",
"}",
"\n\n",
"_imgSize",
":=",
"NewGcvSize2i",
"(",
"dims",
"[",
"0",
"]",
",",
"dims",
"[",
"1",
"]",
")",
"\n\n",
"camMat",
"=",
"GcvMatToMat64",
"(",
"GcvInitCameraMatrix2D_",
"(",
"objPtsVec",
",",
"imgPtsVec",
",",
"_imgSize",
",",
"aspectRatio",
")",
")",
"\n",
"return",
"camMat",
"\n",
"}"
] |
5,945 | all-5946 | [
"Close",
"stops",
"the",
"member",
"s",
"etcdserver",
"and",
"closes",
"its",
"connections"
] | [
"func",
"(",
"m",
"*",
"<mask>",
")",
"Close",
"(",
")",
"{",
"if",
"m",
".",
"grpcBridge",
"!=",
"nil",
"{",
"m",
".",
"grpcBridge",
".",
"Close",
"(",
")",
"\n",
"m",
".",
"grpcBridge",
"=",
"nil",
"\n",
"}",
"\n",
"if",
"m",
".",
"serverClient",
"!=",
"nil",
"{",
"m",
".",
"serverClient",
".",
"Close",
"(",
")",
"\n",
"m",
".",
"serverClient",
"=",
"nil",
"\n",
"}",
"\n",
"if",
"m",
".",
"grpcServer",
"!=",
"nil",
"{",
"m",
".",
"grpcServer",
".",
"Stop",
"(",
")",
"\n",
"m",
".",
"grpcServer",
".",
"GracefulStop",
"(",
")",
"\n",
"m",
".",
"grpcServer",
"=",
"nil",
"\n",
"m",
".",
"grpcServerPeer",
".",
"Stop",
"(",
")",
"\n",
"m",
".",
"grpcServerPeer",
".",
"GracefulStop",
"(",
")",
"\n",
"m",
".",
"grpcServerPeer",
"=",
"nil",
"\n",
"}",
"\n",
"m",
".",
"s",
".",
"HardStop",
"(",
")",
"\n",
"for",
"_",
",",
"f",
":=",
"range",
"m",
".",
"serverClosers",
"{",
"f",
"(",
")",
"\n",
"}",
"\n",
"}"
] |
5,946 | all-5947 | [
"UnmarshalJSON",
"supports",
"json",
".",
"Unmarshaler",
"interface"
] | [
"func",
"(",
"v",
"*",
"ShapeOutsideInfo",
")",
"UnmarshalJSON",
"(",
"<mask>",
"[",
"]",
"byte",
")",
"error",
"{",
"r",
":=",
"jlexer",
".",
"Lexer",
"{",
"Data",
":",
"data",
"}",
"\n",
"easyjsonC5a4559bDecodeGithubComChromedpCdprotoDom1",
"(",
"&",
"r",
",",
"v",
")",
"\n",
"return",
"r",
".",
"Error",
"(",
")",
"\n",
"}"
] |
5,947 | all-5948 | [
"MakeDiskImage",
"makes",
"a",
"boot2docker",
"VM",
"disk",
"image",
".",
"See",
"https",
":",
"//",
"github",
".",
"com",
"/",
"boot2docker",
"/",
"boot2docker",
"/",
"blob",
"/",
"master",
"/",
"rootfs",
"/",
"rootfs",
"/",
"etc",
"/",
"rc",
".",
"d",
"/",
"automount"
] | [
"func",
"MakeDiskImage",
"(",
"publicSSHKeyPath",
"string",
")",
"(",
"*",
"bytes",
".",
"Buffer",
",",
"error",
")",
"{",
"magicString",
":=",
"\"",
"\"",
"\n\n",
"buf",
":=",
"new",
"(",
"bytes",
".",
"Buffer",
")",
"\n",
"tw",
":=",
"tar",
".",
"NewWriter",
"(",
"buf",
")",
"\n\n",
"// magicString first so the automount script knows to format the disk",
"file",
":=",
"&",
"tar",
".",
"Header",
"{",
"Name",
":",
"magicString",
",",
"Size",
":",
"int64",
"(",
"len",
"(",
"magicString",
")",
")",
"}",
"\n\n",
"log",
".",
"Debug",
"(",
"\"",
"\"",
")",
"\n\n",
"if",
"err",
":=",
"tw",
".",
"WriteHeader",
"(",
"file",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"if",
"_",
",",
"err",
":=",
"tw",
".",
"Write",
"(",
"[",
"]",
"byte",
"(",
"magicString",
")",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"// .ssh/key.pub => authorized_keys",
"file",
"=",
"&",
"tar",
".",
"Header",
"{",
"Name",
":",
"\"",
"\"",
",",
"Typeflag",
":",
"tar",
".",
"TypeDir",
",",
"Mode",
":",
"0700",
"}",
"\n",
"if",
"err",
":=",
"tw",
".",
"WriteHeader",
"(",
"file",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"log",
".",
"Debug",
"(",
"\"",
"\"",
")",
"\n\n",
"pubKey",
",",
"err",
":=",
"ioutil",
".",
"ReadFile",
"(",
"publicSSHKeyPath",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"file",
"=",
"&",
"tar",
".",
"Header",
"{",
"Name",
":",
"\"",
"\"",
",",
"Size",
":",
"int64",
"(",
"len",
"(",
"pubKey",
")",
")",
",",
"Mode",
":",
"0644",
"}",
"\n",
"if",
"err",
":=",
"tw",
".",
"WriteHeader",
"(",
"file",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"if",
"_",
",",
"err",
":=",
"tw",
".",
"Write",
"(",
"[",
"]",
"byte",
"(",
"pubKey",
")",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"<mask>",
"=",
"&",
"tar",
".",
"Header",
"{",
"Name",
":",
"\"",
"\"",
",",
"Size",
":",
"int64",
"(",
"len",
"(",
"pubKey",
")",
")",
",",
"Mode",
":",
"0644",
"}",
"\n",
"if",
"err",
":=",
"tw",
".",
"WriteHeader",
"(",
"file",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"if",
"_",
",",
"err",
":=",
"tw",
".",
"Write",
"(",
"[",
"]",
"byte",
"(",
"pubKey",
")",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"if",
"err",
":=",
"tw",
".",
"Close",
"(",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"return",
"buf",
",",
"nil",
"\n",
"}"
] |
5,948 | all-5949 | [
"ChangeHostCheckCommand",
"creates",
"a",
"new",
"CHANGE_HOST_CHECK_COMMAND",
"Nagios",
"command",
".",
"Changes",
"the",
"check",
"command",
"for",
"a",
"particular",
"host",
"to",
"be",
"that",
"specified",
"by",
"the",
"check_command",
"option",
".",
"The",
"check_command",
"option",
"specifies",
"the",
"short",
"name",
"of",
"the",
"command",
"that",
"should",
"be",
"used",
"as",
"the",
"new",
"host",
"check",
"command",
".",
"The",
"command",
"must",
"have",
"been",
"configured",
"in",
"Nagios",
"before",
"it",
"was",
"last",
"(",
"re",
")",
"started",
"."
] | [
"func",
"ChangeHostCheckCommand",
"(",
"host_name",
"<mask>",
",",
"check_command",
"string",
",",
")",
"*",
"livestatus",
".",
"Command",
"{",
"return",
"livestatus",
".",
"NewCommand",
"(",
"\"",
"\"",
",",
"stringifyArg",
"(",
"\"",
"\"",
",",
"\"",
"\"",
",",
"host_name",
")",
",",
"stringifyArg",
"(",
"\"",
"\"",
",",
"\"",
"\"",
",",
"check_command",
")",
",",
")",
"\n",
"}"
] |
5,949 | all-5950 | [
"HasShowBreakdown",
"returns",
"a",
"boolean",
"if",
"a",
"field",
"has",
"been",
"set",
"."
] | [
"func",
"(",
"t",
"*",
"TraceServiceDefinition",
")",
"HasShowBreakdown",
"(",
")",
"bool",
"{",
"if",
"t",
"!=",
"nil",
"&&",
"t",
".",
"ShowBreakdown",
"!=",
"nil",
"{",
"return",
"<mask>",
"\n",
"}",
"\n\n",
"return",
"false",
"\n",
"}"
] |
5,950 | all-5951 | [
"expandClusterDasVMSettings",
"reads",
"certain",
"ResourceData",
"keys",
"and",
"returns",
"a",
"ClusterDasVmSettings",
"."
] | [
"func",
"expandClusterDasVMSettings",
"(",
"d",
"*",
"schema",
".",
"ResourceData",
",",
"<mask>",
"viapi",
".",
"VSphereVersion",
")",
"*",
"types",
".",
"ClusterDasVmSettings",
"{",
"obj",
":=",
"&",
"types",
".",
"ClusterDasVmSettings",
"{",
"IsolationResponse",
":",
"d",
".",
"Get",
"(",
"\"",
"\"",
")",
".",
"(",
"string",
")",
",",
"RestartPriority",
":",
"d",
".",
"Get",
"(",
"\"",
"\"",
")",
".",
"(",
"string",
")",
",",
"VmToolsMonitoringSettings",
":",
"expandClusterVMToolsMonitoringSettings",
"(",
"d",
")",
",",
"}",
"\n\n",
"if",
"version",
".",
"Newer",
"(",
"viapi",
".",
"VSphereVersion",
"{",
"Product",
":",
"version",
".",
"Product",
",",
"Major",
":",
"6",
"}",
")",
"{",
"obj",
".",
"VmComponentProtectionSettings",
"=",
"expandClusterVMComponentProtectionSettings",
"(",
"d",
")",
"\n",
"}",
"\n",
"if",
"version",
".",
"Newer",
"(",
"viapi",
".",
"VSphereVersion",
"{",
"Product",
":",
"version",
".",
"Product",
",",
"Major",
":",
"6",
",",
"Minor",
":",
"5",
"}",
")",
"{",
"obj",
".",
"RestartPriorityTimeout",
"=",
"int32",
"(",
"d",
".",
"Get",
"(",
"\"",
"\"",
")",
".",
"(",
"int",
")",
")",
"\n",
"}",
"\n\n",
"return",
"obj",
"\n",
"}"
] |
5,951 | all-5952 | [
"HTMLSet",
"renders",
"the",
"HTML",
"with",
"given",
"template",
"set",
"name",
"."
] | [
"func",
"(",
"ctx",
"*",
"Context",
")",
"HTMLSet",
"(",
"status",
"int",
",",
"setName",
",",
"tplName",
"string",
",",
"data",
"...",
"interface",
"{",
"}",
")",
"{",
"ctx",
".",
"renderHTML",
"(",
"status",
",",
"setName",
",",
"tplName",
",",
"<mask>",
"...",
")",
"\n",
"}"
] |
5,952 | all-5953 | [
"Set",
"sets",
"the",
"element",
"at",
"position",
"i",
"to",
"v",
".",
"The",
"stack",
"size",
"is",
"automatically",
"adjusted",
"."
] | [
"func",
"(",
"s",
"*",
"Stack",
")",
"Set",
"(",
"i",
"int",
",",
"v",
"interface",
"{",
"}",
")",
"error",
"{",
"if",
"i",
"<",
"0",
"{",
"return",
"errors",
".",
"New",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"if",
"i",
">=",
"s",
".",
"BufferSize",
"(",
")",
"{",
"s",
".",
"Resize",
"(",
"calcNewSize",
"(",
"i",
")",
")",
"\n",
"}",
"\n\n",
"for",
"len",
"(",
"*",
"s",
")",
"<",
"i",
"+",
"1",
"{",
"*",
"s",
"=",
"<mask>",
"(",
"*",
"s",
",",
"nil",
")",
"\n",
"}",
"\n\n",
"(",
"*",
"s",
")",
"[",
"i",
"]",
"=",
"v",
"\n",
"return",
"nil",
"\n",
"}"
] |
5,953 | all-5954 | [
"UnmarshalJSON",
"supports",
"json",
".",
"Unmarshaler",
"interface"
] | [
"func",
"(",
"v",
"*",
"HighlightQuadParams",
")",
"UnmarshalJSON",
"(",
"data",
"[",
"]",
"<mask>",
")",
"error",
"{",
"r",
":=",
"jlexer",
".",
"Lexer",
"{",
"Data",
":",
"data",
"}",
"\n",
"easyjsonC5a4559bDecodeGithubComChromedpCdprotoOverlay10",
"(",
"&",
"r",
",",
"v",
")",
"\n",
"return",
"r",
".",
"Error",
"(",
")",
"\n",
"}"
] |
5,954 | all-5955 | [
"SetPixelFormat",
"controls",
"the",
"pixel",
"format",
"of",
"textures",
"for",
"rendering",
"layer",
"content",
".",
"The",
"pixel",
"format",
"for",
"a",
"Metal",
"layer",
"must",
"be",
"PixelFormatBGRA8UNorm",
"PixelFormatBGRA8UNormSRGB",
"PixelFormatRGBA16Float",
"PixelFormatBGRA10XR",
"or",
"PixelFormatBGRA10XRSRGB",
".",
"SetPixelFormat",
"panics",
"for",
"other",
"values",
".",
"Reference",
":",
"https",
":",
"//",
"developer",
".",
"apple",
".",
"com",
"/",
"documentation",
"/",
"quartzcore",
"/",
"cametallayer",
"/",
"1478155",
"-",
"pixelformat",
"."
] | [
"func",
"(",
"ml",
"MetalLayer",
")",
"SetPixelFormat",
"(",
"pf",
"mtl",
".",
"PixelFormat",
")",
"{",
"e",
":=",
"C",
".",
"MetalLayer_SetPixelFormat",
"(",
"ml",
".",
"metalLayer",
",",
"C",
".",
"uint16_t",
"(",
"pf",
")",
")",
"\n",
"if",
"e",
"!=",
"nil",
"{",
"panic",
"(",
"<mask>",
".",
"New",
"(",
"C",
".",
"GoString",
"(",
"e",
")",
")",
")",
"\n",
"}",
"\n",
"}"
] |
5,955 | all-5956 | [
"GetgroupsName",
"returns",
"a",
"list",
"of",
"the",
"groups",
"that",
"the",
"caller",
"belongs",
"to",
"."
] | [
"func",
"GetgroupsName",
"(",
")",
"[",
"]",
"string",
"{",
"user",
":=",
"GetUsername",
"(",
")",
"\n",
"list",
":=",
"make",
"(",
"[",
"]",
"string",
",",
"0",
")",
"\n\n",
"// The user could have its own group.",
"if",
"_",
",",
"err",
":=",
"LookupGroup",
"(",
"user",
")",
";",
"err",
"==",
"nil",
"{",
"list",
"=",
"append",
"(",
"list",
",",
"user",
")",
"\n",
"}",
"\n\n",
"groups",
",",
"err",
":=",
"LookupInGroup",
"(",
"G_MEMBER",
",",
"user",
",",
"-",
"1",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"if",
"_",
",",
"ok",
":=",
"err",
".",
"(",
"NoFoundError",
")",
";",
"!",
"<mask>",
"{",
"panic",
"(",
"err",
")",
"\n",
"}",
"\n",
"}",
"\n",
"for",
"_",
",",
"v",
":=",
"range",
"groups",
"{",
"list",
"=",
"append",
"(",
"list",
",",
"v",
".",
"Name",
")",
"\n",
"}",
"\n\n",
"return",
"list",
"\n",
"}"
] |
5,956 | all-5957 | [
"UnmarshalJSON",
"supports",
"json",
".",
"Unmarshaler",
"interface"
] | [
"func",
"(",
"v",
"*",
"ExecutionContextDescription",
")",
"UnmarshalJSON",
"(",
"data",
"[",
"]",
"byte",
")",
"error",
"{",
"r",
":=",
"jlexer",
".",
"Lexer",
"{",
"Data",
":",
"data",
"}",
"\n",
"easyjsonC5a4559bDecodeGithubComChromedpCdprotoRuntime27",
"(",
"&",
"r",
",",
"v",
")",
"\n",
"return",
"r",
".",
"<mask>",
"(",
")",
"\n",
"}"
] |
5,957 | all-5958 | [
"Marshal",
"serialises",
"an",
"HOTP",
"key",
"value",
"as",
"a",
"DER",
"-",
"encoded",
"byte",
"slice",
"."
] | [
"func",
"Marshal",
"(",
"otp",
"*",
"HOTP",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"<mask>",
"asnHOTP",
"struct",
"{",
"Key",
"[",
"]",
"byte",
"\n",
"Counter",
"*",
"big",
".",
"Int",
"\n",
"Digits",
"int",
"\n",
"}",
"\n",
"asnHOTP",
".",
"Key",
"=",
"otp",
".",
"Key",
"[",
":",
"]",
"\n",
"asnHOTP",
".",
"Counter",
"=",
"new",
"(",
"big",
".",
"Int",
")",
".",
"SetUint64",
"(",
"otp",
".",
"Counter",
"(",
")",
")",
"\n",
"asnHOTP",
".",
"Digits",
"=",
"otp",
".",
"Digits",
"\n",
"return",
"asn1",
".",
"Marshal",
"(",
"asnHOTP",
")",
"\n",
"}"
] |
5,958 | all-5959 | [
"String",
"formats",
"the",
"cachKey",
"as",
"a",
"string"
] | [
"func",
"(",
"key",
"*",
"cacheKey",
")",
"String",
"(",
")",
"string",
"{",
"return",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"key",
".",
"roleARN",
",",
"key",
".",
"region",
",",
"<mask>",
".",
"registryID",
",",
"key",
".",
"endpointOverride",
")",
"\n",
"}"
] |
5,959 | all-5960 | [
"HasMetricQuery",
"returns",
"a",
"boolean",
"if",
"a",
"field",
"has",
"been",
"set",
"."
] | [
"func",
"(",
"s",
"*",
"ScatterplotRequest",
")",
"HasMetricQuery",
"(",
")",
"bool",
"{",
"if",
"s",
"!=",
"nil",
"&&",
"s",
".",
"MetricQuery",
"!=",
"nil",
"{",
"return",
"<mask>",
"\n",
"}",
"\n\n",
"return",
"false",
"\n",
"}"
] |
5,960 | all-5961 | [
"SnakeUpper",
"returns",
"a",
"SNAKE_CASED",
"string",
"with",
"all",
"upper",
"case",
"letters",
"."
] | [
"func",
"(",
"k",
"*",
"Kace",
")",
"SnakeUpper",
"(",
"s",
"string",
")",
"string",
"{",
"return",
"delimitedCase",
"(",
"s",
",",
"snakeDelim",
",",
"<mask>",
")",
"\n",
"}"
] |
5,961 | all-5962 | [
"HasHost",
"returns",
"a",
"boolean",
"if",
"a",
"field",
"has",
"been",
"set",
"."
] | [
"func",
"(",
"e",
"*",
"Event",
")",
"HasHost",
"(",
")",
"bool",
"{",
"if",
"e",
"!=",
"nil",
"&&",
"e",
".",
"Host",
"!=",
"nil",
"{",
"return",
"<mask>",
"\n",
"}",
"\n\n",
"return",
"false",
"\n",
"}"
] |
5,962 | all-5963 | [
"SetShowMarks",
"turns",
"on",
"and",
"off",
"marks",
"under",
"horizontal",
"axis"
] | [
"func",
"(",
"b",
"*",
"BarChart",
")",
"SetShowMarks",
"(",
"show",
"bool",
")",
"{",
"b",
".",
"mtx",
".",
"Lock",
"(",
")",
"\n",
"defer",
"b",
".",
"mtx",
".",
"Unlock",
"(",
")",
"\n\n",
"b",
".",
"showMarks",
"=",
"<mask>",
"\n",
"}"
] |
5,963 | all-5964 | [
"CreateNode",
"is",
"an",
"implementation",
"of",
"xmlbuilder",
".",
"XMLBuilder",
".",
"It",
"appends",
"the",
"node",
"specified",
"in",
"opts",
"and",
"returns",
"the",
"child",
"if",
"it",
"is",
"an",
"element",
".",
"Otherwise",
"it",
"returns",
"x",
"."
] | [
"func",
"(",
"x",
"*",
"XMLEle",
")",
"CreateNode",
"(",
"opts",
"*",
"xmlbuilder",
".",
"BuilderOpts",
")",
"xmlbuilder",
".",
"XMLBuilder",
"{",
"if",
"opts",
".",
"NodeType",
"==",
"tree",
".",
"NtElem",
"{",
"ele",
":=",
"&",
"XMLEle",
"{",
"StartElement",
":",
"opts",
".",
"Tok",
".",
"(",
"xml",
".",
"StartElement",
")",
",",
"NSBuilder",
":",
"<mask>",
".",
"NSBuilder",
"{",
"NS",
":",
"opts",
".",
"NS",
"}",
",",
"Attrs",
":",
"make",
"(",
"[",
"]",
"tree",
".",
"Node",
",",
"len",
"(",
"opts",
".",
"Attrs",
")",
")",
",",
"Parent",
":",
"x",
",",
"NodePos",
":",
"tree",
".",
"NodePos",
"(",
"opts",
".",
"NodePos",
")",
",",
"NodeType",
":",
"opts",
".",
"NodeType",
",",
"}",
"\n",
"for",
"i",
":=",
"range",
"opts",
".",
"Attrs",
"{",
"ele",
".",
"Attrs",
"[",
"i",
"]",
"=",
"xmlnode",
".",
"XMLNode",
"{",
"Token",
":",
"opts",
".",
"Attrs",
"[",
"i",
"]",
",",
"NodePos",
":",
"tree",
".",
"NodePos",
"(",
"opts",
".",
"AttrStartPos",
"+",
"i",
")",
",",
"NodeType",
":",
"tree",
".",
"NtAttr",
",",
"Parent",
":",
"ele",
",",
"}",
"\n",
"}",
"\n",
"x",
".",
"Children",
"=",
"append",
"(",
"x",
".",
"Children",
",",
"ele",
")",
"\n",
"return",
"ele",
"\n",
"}",
"\n\n",
"node",
":=",
"xmlnode",
".",
"XMLNode",
"{",
"Token",
":",
"opts",
".",
"Tok",
",",
"NodePos",
":",
"tree",
".",
"NodePos",
"(",
"opts",
".",
"NodePos",
")",
",",
"NodeType",
":",
"opts",
".",
"NodeType",
",",
"Parent",
":",
"x",
",",
"}",
"\n",
"x",
".",
"Children",
"=",
"append",
"(",
"x",
".",
"Children",
",",
"node",
")",
"\n",
"return",
"x",
"\n",
"}"
] |
5,964 | all-5965 | [
"GetDeadline",
"returns",
"the",
"status",
"code",
"and",
"body",
"of",
"url",
".",
"The",
"contents",
"of",
"dst",
"will",
"be",
"replaced",
"by",
"the",
"body",
"and",
"returned",
"if",
"the",
"dst",
"is",
"too",
"small",
"a",
"new",
"slice",
"will",
"be",
"allocated",
".",
"The",
"function",
"follows",
"redirects",
".",
"Use",
"Do",
"*",
"for",
"manually",
"handling",
"redirects",
".",
"ErrTimeout",
"error",
"is",
"returned",
"if",
"url",
"contents",
"couldn",
"t",
"be",
"fetched",
"until",
"the",
"given",
"deadline",
"."
] | [
"func",
"(",
"c",
"*",
"Client",
")",
"GetDeadline",
"(",
"dst",
"[",
"]",
"byte",
",",
"url",
"string",
",",
"deadline",
"<mask>",
".",
"Time",
")",
"(",
"statusCode",
"int",
",",
"body",
"[",
"]",
"byte",
",",
"err",
"error",
")",
"{",
"return",
"clientGetURLDeadline",
"(",
"dst",
",",
"url",
",",
"deadline",
",",
"c",
")",
"\n",
"}"
] |
5,965 | all-5966 | [
"GetWidthOk",
"returns",
"a",
"tuple",
"with",
"the",
"Width",
"field",
"if",
"it",
"s",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"and",
"a",
"boolean",
"to",
"check",
"if",
"the",
"value",
"has",
"been",
"set",
"."
] | [
"func",
"(",
"w",
"*",
"Widget",
")",
"GetWidthOk",
"(",
")",
"(",
"int",
",",
"bool",
")",
"{",
"if",
"w",
"==",
"nil",
"||",
"w",
".",
"Width",
"==",
"nil",
"{",
"return",
"0",
",",
"false",
"\n",
"}",
"\n",
"return",
"*",
"w",
".",
"Width",
",",
"<mask>",
"\n",
"}"
] |
5,966 | all-5967 | [
"separateChange",
"separates",
"a",
"multi",
"-",
"zone",
"change",
"into",
"a",
"single",
"change",
"per",
"zone",
"."
] | [
"func",
"separateChange",
"(",
"zones",
"map",
"[",
"string",
"]",
"*",
"dns",
".",
"ManagedZone",
",",
"change",
"*",
"dns",
".",
"Change",
")",
"map",
"[",
"string",
"]",
"*",
"dns",
".",
"Change",
"{",
"changes",
":=",
"make",
"(",
"map",
"[",
"string",
"]",
"*",
"dns",
".",
"Change",
")",
"\n",
"zoneNameIDMapper",
":=",
"zoneIDName",
"{",
"}",
"\n",
"for",
"_",
",",
"z",
":=",
"<mask>",
"zones",
"{",
"zoneNameIDMapper",
"[",
"z",
".",
"Name",
"]",
"=",
"z",
".",
"DnsName",
"\n",
"changes",
"[",
"z",
".",
"Name",
"]",
"=",
"&",
"dns",
".",
"Change",
"{",
"Additions",
":",
"[",
"]",
"*",
"dns",
".",
"ResourceRecordSet",
"{",
"}",
",",
"Deletions",
":",
"[",
"]",
"*",
"dns",
".",
"ResourceRecordSet",
"{",
"}",
",",
"}",
"\n",
"}",
"\n",
"for",
"_",
",",
"a",
":=",
"range",
"change",
".",
"Additions",
"{",
"if",
"zoneName",
",",
"_",
":=",
"zoneNameIDMapper",
".",
"FindZone",
"(",
"ensureTrailingDot",
"(",
"a",
".",
"Name",
")",
")",
";",
"zoneName",
"!=",
"\"",
"\"",
"{",
"changes",
"[",
"zoneName",
"]",
".",
"Additions",
"=",
"append",
"(",
"changes",
"[",
"zoneName",
"]",
".",
"Additions",
",",
"a",
")",
"\n",
"}",
"else",
"{",
"log",
".",
"Warnf",
"(",
"\"",
"\"",
",",
"a",
".",
"Name",
",",
"a",
".",
"Type",
",",
"a",
".",
"Rrdatas",
",",
"a",
".",
"Ttl",
")",
"\n",
"}",
"\n",
"}",
"\n\n",
"for",
"_",
",",
"d",
":=",
"range",
"change",
".",
"Deletions",
"{",
"if",
"zoneName",
",",
"_",
":=",
"zoneNameIDMapper",
".",
"FindZone",
"(",
"ensureTrailingDot",
"(",
"d",
".",
"Name",
")",
")",
";",
"zoneName",
"!=",
"\"",
"\"",
"{",
"changes",
"[",
"zoneName",
"]",
".",
"Deletions",
"=",
"append",
"(",
"changes",
"[",
"zoneName",
"]",
".",
"Deletions",
",",
"d",
")",
"\n",
"}",
"else",
"{",
"log",
".",
"Warnf",
"(",
"\"",
"\"",
",",
"d",
".",
"Name",
",",
"d",
".",
"Type",
",",
"d",
".",
"Rrdatas",
",",
"d",
".",
"Ttl",
")",
"\n",
"}",
"\n",
"}",
"\n\n",
"// separating a change could lead to empty sub changes, remove them here.",
"for",
"zone",
",",
"change",
":=",
"range",
"changes",
"{",
"if",
"len",
"(",
"change",
".",
"Additions",
")",
"==",
"0",
"&&",
"len",
"(",
"change",
".",
"Deletions",
")",
"==",
"0",
"{",
"delete",
"(",
"changes",
",",
"zone",
")",
"\n",
"}",
"\n",
"}",
"\n\n",
"return",
"changes",
"\n",
"}"
] |
5,967 | all-5968 | [
"NewStreamDecoder",
"returns",
"a",
"new",
"stream",
"decoder",
"that",
"takes",
"input",
"from",
"p",
".",
"The",
"function",
"panics",
"if",
"p",
"is",
"nil",
"."
] | [
"func",
"NewStreamDecoder",
"(",
"p",
"<mask>",
")",
"*",
"StreamDecoder",
"{",
"if",
"p",
"==",
"nil",
"{",
"panic",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"return",
"&",
"StreamDecoder",
"{",
"Parser",
":",
"p",
"}",
"\n",
"}"
] |
5,968 | all-5969 | [
"Parse",
"the",
"profile",
"without",
"loading",
"it",
"into",
"the",
"kernel",
"."
] | [
"func",
"AAParseProfile",
"(",
"c",
"container",
")",
"error",
"{",
"<mask>",
":=",
"c",
".",
"DaemonState",
"(",
")",
"\n",
"if",
"!",
"state",
".",
"OS",
".",
"AppArmorAvailable",
"{",
"return",
"nil",
"\n",
"}",
"\n\n",
"return",
"runApparmor",
"(",
"APPARMOR_CMD_PARSE",
",",
"c",
")",
"\n",
"}"
] |
5,969 | all-5970 | [
"String",
"returns",
"a",
"string",
"representation",
"of",
"v",
"like",
"(",
"3",
"4",
")",
"."
] | [
"func",
"(",
"v",
"Vec2",
")",
"<mask>",
"(",
")",
"string",
"{",
"if",
"len",
"(",
"v",
")",
"<",
"2",
"{",
"return",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"return",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"v",
"[",
"0",
"]",
",",
"v",
"[",
"1",
"]",
")",
"\n",
"}"
] |
5,970 | all-5971 | [
"GetReader",
"provides",
"a",
"reader",
"and",
"downloads",
"data",
"using",
"parallel",
"ranged",
"get",
"requests",
".",
"Data",
"from",
"the",
"requests",
"are",
"ordered",
"and",
"written",
"sequentially",
".",
"Data",
"integrity",
"is",
"verified",
"via",
"the",
"option",
"specified",
"in",
"c",
".",
"Header",
"data",
"from",
"the",
"downloaded",
"object",
"is",
"also",
"returned",
"useful",
"for",
"reading",
"object",
"metadata",
".",
"DefaultConfig",
"is",
"used",
"if",
"c",
"is",
"nil",
"Callers",
"should",
"call",
"Close",
"on",
"r",
"to",
"ensure",
"that",
"all",
"resources",
"are",
"released",
".",
"To",
"specify",
"an",
"object",
"version",
"in",
"a",
"versioned",
"bucket",
"the",
"version",
"ID",
"may",
"be",
"included",
"in",
"the",
"path",
"as",
"a",
"url",
"parameter",
".",
"See",
"http",
":",
"//",
"docs",
".",
"aws",
".",
"amazon",
".",
"com",
"/",
"AmazonS3",
"/",
"latest",
"/",
"dev",
"/",
"RetrievingObjectVersions",
".",
"html"
] | [
"func",
"(",
"b",
"*",
"Bucket",
")",
"GetReader",
"(",
"<mask>",
"string",
",",
"c",
"*",
"Config",
")",
"(",
"r",
"io",
".",
"ReadCloser",
",",
"h",
"http",
".",
"Header",
",",
"err",
"error",
")",
"{",
"if",
"path",
"==",
"\"",
"\"",
"{",
"return",
"nil",
",",
"nil",
",",
"errors",
".",
"New",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"if",
"c",
"==",
"nil",
"{",
"c",
"=",
"b",
".",
"conf",
"(",
")",
"\n",
"}",
"\n",
"u",
",",
"err",
":=",
"b",
".",
"url",
"(",
"path",
",",
"c",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"nil",
",",
"err",
"\n",
"}",
"\n",
"return",
"newGetter",
"(",
"*",
"u",
",",
"c",
",",
"b",
")",
"\n",
"}"
] |
5,971 | all-5972 | [
"zfsPoolVolumeCreate",
"creates",
"a",
"ZFS",
"dataset",
"with",
"a",
"set",
"of",
"given",
"properties",
"."
] | [
"func",
"zfsPoolVolumeCreate",
"(",
"dataset",
"string",
",",
"properties",
"...",
"string",
")",
"(",
"string",
",",
"error",
")",
"{",
"cmd",
":=",
"[",
"]",
"string",
"{",
"\"",
"\"",
",",
"\"",
"\"",
"}",
"\n\n",
"for",
"_",
",",
"<mask>",
":=",
"range",
"properties",
"{",
"cmd",
"=",
"append",
"(",
"cmd",
",",
"[",
"]",
"string",
"{",
"\"",
"\"",
",",
"prop",
"}",
"...",
")",
"\n",
"}",
"\n\n",
"cmd",
"=",
"append",
"(",
"cmd",
",",
"[",
"]",
"string",
"{",
"\"",
"\"",
",",
"dataset",
"}",
"...",
")",
"\n\n",
"return",
"shared",
".",
"RunCommand",
"(",
"cmd",
"[",
"0",
"]",
",",
"cmd",
"[",
"1",
":",
"]",
"...",
")",
"\n",
"}"
] |
5,972 | all-5973 | [
"Specify",
"the",
"value",
"of",
"a",
"uniform",
"variable",
"for",
"a",
"specified",
"program",
"object"
] | [
"func",
"ProgramUniform1f",
"(",
"program",
"uint32",
",",
"location",
"int32",
",",
"v0",
"float32",
")",
"{",
"C",
".",
"glowProgramUniform1f",
"(",
"gpProgramUniform1f",
",",
"(",
"C",
".",
"GLuint",
")",
"(",
"<mask>",
")",
",",
"(",
"C",
".",
"GLint",
")",
"(",
"location",
")",
",",
"(",
"C",
".",
"GLfloat",
")",
"(",
"v0",
")",
")",
"\n",
"}"
] |
5,973 | all-5974 | [
"Write",
"implements",
"the",
"corresponding",
"method",
"of",
"net",
".",
"Conn"
] | [
"func",
"(",
"l",
"*",
"loggingConn",
")",
"Write",
"(",
"b",
"[",
"]",
"<mask>",
")",
"(",
"n",
"int",
",",
"err",
"error",
")",
"{",
"return",
"l",
".",
"w",
".",
"Write",
"(",
"b",
")",
"\n",
"}"
] |
5,974 | all-5975 | [
"qauntile",
"calculates",
"the",
"given",
"quantile",
"of",
"a",
"vector",
"of",
"samples",
".",
"The",
"Vector",
"will",
"be",
"sorted",
".",
"If",
"values",
"has",
"zero",
"elements",
"NaN",
"is",
"returned",
".",
"If",
"q<0",
"-",
"Inf",
"is",
"returned",
".",
"If",
"q",
">",
"1",
"+",
"Inf",
"is",
"returned",
"."
] | [
"func",
"quantile",
"(",
"q",
"float64",
",",
"values",
"vectorByValueHeap",
")",
"float64",
"{",
"if",
"len",
"(",
"values",
")",
"==",
"0",
"{",
"return",
"math",
".",
"NaN",
"(",
")",
"\n",
"}",
"\n",
"if",
"q",
"<",
"0",
"{",
"return",
"math",
".",
"Inf",
"(",
"-",
"1",
")",
"\n",
"}",
"\n",
"if",
"q",
">",
"1",
"{",
"return",
"math",
".",
"Inf",
"(",
"+",
"1",
")",
"\n",
"}",
"\n",
"sort",
".",
"Sort",
"(",
"values",
")",
"\n\n",
"n",
":=",
"float64",
"(",
"len",
"(",
"values",
")",
")",
"\n",
"// When the quantile lies between two samples,",
"// we use a weighted average of the two samples.",
"rank",
":=",
"q",
"*",
"(",
"n",
"-",
"1",
")",
"\n\n",
"lowerIndex",
":=",
"math",
".",
"Max",
"(",
"0",
",",
"math",
".",
"Floor",
"(",
"rank",
")",
")",
"\n",
"upperIndex",
":=",
"math",
".",
"Min",
"(",
"n",
"-",
"1",
",",
"lowerIndex",
"+",
"1",
")",
"\n\n",
"weight",
":=",
"rank",
"-",
"math",
".",
"Floor",
"(",
"rank",
")",
"\n",
"return",
"values",
"[",
"int",
"(",
"lowerIndex",
")",
"]",
".",
"V",
"*",
"(",
"1",
"-",
"weight",
")",
"+",
"values",
"[",
"int",
"(",
"upperIndex",
")",
"]",
".",
"V",
"*",
"<mask>",
"\n",
"}"
] |
5,975 | all-5976 | [
"Do",
"executes",
"CSS",
".",
"setMediaText",
"against",
"the",
"provided",
"context",
".",
"returns",
":",
"media",
"-",
"The",
"resulting",
"CSS",
"media",
"rule",
"after",
"modification",
"."
] | [
"func",
"(",
"p",
"*",
"SetMediaTextParams",
")",
"Do",
"(",
"ctx",
"context",
".",
"Context",
")",
"(",
"media",
"*",
"Media",
",",
"err",
"error",
")",
"{",
"// execute",
"var",
"res",
"SetMediaTextReturns",
"\n",
"err",
"=",
"cdp",
".",
"Execute",
"(",
"ctx",
",",
"CommandSetMediaText",
",",
"p",
",",
"&",
"res",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"return",
"<mask>",
".",
"Media",
",",
"nil",
"\n",
"}"
] |
5,976 | all-5977 | [
"Alertmanagers",
"returns",
"a",
"slice",
"of",
"Alertmanager",
"URLs",
"."
] | [
"func",
"(",
"n",
"*",
"Manager",
")",
"Alertmanagers",
"(",
")",
"[",
"]",
"*",
"url",
".",
"URL",
"{",
"n",
".",
"mtx",
".",
"RLock",
"(",
")",
"\n",
"amSets",
":=",
"n",
".",
"alertmanagers",
"\n",
"n",
".",
"mtx",
".",
"RUnlock",
"(",
")",
"\n\n",
"<mask>",
"res",
"[",
"]",
"*",
"url",
".",
"URL",
"\n\n",
"for",
"_",
",",
"ams",
":=",
"range",
"amSets",
"{",
"ams",
".",
"mtx",
".",
"RLock",
"(",
")",
"\n",
"for",
"_",
",",
"am",
":=",
"range",
"ams",
".",
"ams",
"{",
"res",
"=",
"append",
"(",
"res",
",",
"am",
".",
"url",
"(",
")",
")",
"\n",
"}",
"\n",
"ams",
".",
"mtx",
".",
"RUnlock",
"(",
")",
"\n",
"}",
"\n\n",
"return",
"res",
"\n",
"}"
] |
5,977 | all-5978 | [
"Print",
"mocks",
"base",
"method"
] | [
"func",
"(",
"m",
"*",
"MockResult",
")",
"Print",
"(",
")",
"error",
"{",
"ret",
":=",
"m",
".",
"ctrl",
".",
"Call",
"(",
"m",
",",
"\"",
"\"",
")",
"\n",
"ret0",
",",
"_",
":=",
"<mask>",
"[",
"0",
"]",
".",
"(",
"error",
")",
"\n",
"return",
"ret0",
"\n",
"}"
] |
5,978 | all-5979 | [
"Endpoint",
"returns",
"endpoint",
"msg",
"for",
"a",
"channel",
"with",
"given",
"key",
"."
] | [
"func",
"(",
"h",
"*",
"Handler",
")",
"Endpoint",
"(",
"key",
"data",
".",
"Base64String",
")",
"(",
"*",
"data",
".",
"Base64String",
",",
"error",
")",
"{",
"logger",
":=",
"h",
".",
"logger",
".",
"Add",
"(",
"\"",
"\"",
",",
"\"",
"\"",
")",
"\n\n",
"channelsStructs",
",",
"err",
":=",
"h",
".",
"db",
".",
"SelectAllFrom",
"(",
"data",
".",
"ChannelTable",
",",
"\"",
"\"",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"h",
".",
"logger",
".",
"Error",
"(",
"err",
".",
"Error",
"(",
")",
")",
"\n",
"return",
"nil",
",",
"ErrInternal",
"\n",
"}",
"\n\n",
"for",
"_",
",",
"chanStruct",
":=",
"range",
"channelsStructs",
"{",
"channel",
":=",
"chanStruct",
".",
"(",
"*",
"data",
".",
"Channel",
")",
"\n",
"channelKey",
",",
"err",
":=",
"h",
".",
"channelKey",
"(",
"logger",
",",
"<mask>",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"h",
".",
"logger",
".",
"Error",
"(",
"err",
".",
"Error",
"(",
")",
")",
"\n",
"return",
"nil",
",",
"ErrInternal",
"\n",
"}",
"\n",
"if",
"channelKey",
"==",
"key",
"{",
"endpoint",
",",
"err",
":=",
"h",
".",
"endpointByChannelID",
"(",
"logger",
",",
"channel",
".",
"ID",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"return",
"&",
"endpoint",
".",
"RawMsg",
",",
"nil",
"\n",
"}",
"\n",
"}",
"\n\n",
"return",
"nil",
",",
"ErrChannelNotFound",
"\n",
"}"
] |
5,979 | all-5980 | [
"Sets",
"the",
"EditField",
"value",
"with",
"the",
"selected",
"item",
"in",
"ListBox",
"if",
":",
"*",
"a",
"directory",
"is",
"selected",
"and",
"option",
"select",
"directory",
"is",
"set",
"*",
"a",
"file",
"is",
"selected",
"and",
"option",
"select",
"directory",
"is",
"not",
"set"
] | [
"func",
"(",
"d",
"*",
"FileSelectDialog",
")",
"updateEditBox",
"(",
")",
"{",
"s",
":=",
"d",
".",
"listBox",
".",
"SelectedItemText",
"(",
")",
"\n",
"if",
"s",
"==",
"\"",
"\"",
"||",
"s",
"==",
"\"",
"\"",
"||",
"(",
"strings",
".",
"HasSuffix",
"(",
"s",
",",
"string",
"(",
"<mask>",
".",
"PathSeparator",
")",
")",
"&&",
"!",
"d",
".",
"selectDir",
")",
"{",
"d",
".",
"edFile",
".",
"Clear",
"(",
")",
"\n",
"return",
"\n",
"}",
"\n",
"d",
".",
"edFile",
".",
"SetTitle",
"(",
"strings",
".",
"TrimSuffix",
"(",
"s",
",",
"string",
"(",
"os",
".",
"PathSeparator",
")",
")",
")",
"\n",
"}"
] |
5,980 | all-5981 | [
"FindClientAPIVersion",
"mocks",
"base",
"method"
] | [
"func",
"(",
"m",
"*",
"MockFactory",
")",
"FindClientAPIVersion",
"(",
"arg0",
"sdkclient",
".",
"<mask>",
")",
"dockerclient",
".",
"DockerVersion",
"{",
"ret",
":=",
"m",
".",
"ctrl",
".",
"Call",
"(",
"m",
",",
"\"",
"\"",
",",
"arg0",
")",
"\n",
"ret0",
",",
"_",
":=",
"ret",
"[",
"0",
"]",
".",
"(",
"dockerclient",
".",
"DockerVersion",
")",
"\n",
"return",
"ret0",
"\n",
"}"
] |
5,981 | all-5982 | [
"requestRaw",
"makes",
"a",
"request",
"with",
"retries",
"and",
"returns",
"the",
"response",
"body",
".",
"Returns",
"an",
"error",
"if",
"the",
"exit",
"code",
"is",
"not",
"one",
"of",
"the",
"provided",
"codes",
"."
] | [
"func",
"(",
"c",
"*",
"Client",
")",
"requestRaw",
"(",
"r",
"*",
"request",
")",
"(",
"int",
",",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"if",
"c",
".",
"fake",
"||",
"(",
"c",
".",
"dry",
"&&",
"r",
".",
"method",
"!=",
"http",
".",
"MethodGet",
")",
"{",
"return",
"r",
".",
"exitCodes",
"[",
"0",
"]",
",",
"nil",
",",
"nil",
"\n",
"}",
"\n",
"resp",
",",
"err",
":=",
"c",
".",
"requestRetry",
"(",
"r",
".",
"method",
",",
"r",
".",
"path",
",",
"r",
".",
"accept",
",",
"r",
".",
"requestBody",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"0",
",",
"nil",
",",
"err",
"\n",
"}",
"\n",
"defer",
"resp",
".",
"<mask>",
".",
"Close",
"(",
")",
"\n",
"b",
",",
"err",
":=",
"ioutil",
".",
"ReadAll",
"(",
"resp",
".",
"Body",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"0",
",",
"nil",
",",
"err",
"\n",
"}",
"\n",
"var",
"okCode",
"bool",
"\n",
"for",
"_",
",",
"code",
":=",
"range",
"r",
".",
"exitCodes",
"{",
"if",
"code",
"==",
"resp",
".",
"StatusCode",
"{",
"okCode",
"=",
"true",
"\n",
"break",
"\n",
"}",
"\n",
"}",
"\n",
"if",
"!",
"okCode",
"{",
"clientError",
":=",
"unmarshalClientError",
"(",
"b",
")",
"\n",
"err",
"=",
"requestError",
"{",
"ClientError",
":",
"clientError",
",",
"ErrorString",
":",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"resp",
".",
"StatusCode",
",",
"r",
".",
"exitCodes",
",",
"string",
"(",
"b",
")",
")",
",",
"}",
"\n",
"}",
"\n",
"return",
"resp",
".",
"StatusCode",
",",
"b",
",",
"err",
"\n",
"}"
] |
5,982 | all-5983 | [
"PostCheque",
"sends",
"a",
"payment",
"cheque",
"to",
"a",
"payment",
"server",
"."
] | [
"func",
"PostCheque",
"(",
"db",
"*",
"reform",
".",
"DB",
",",
"channel",
"string",
",",
"pscAddr",
"<mask>",
".",
"HexString",
",",
"pass",
"string",
",",
"amount",
"uint64",
",",
"tls",
"bool",
",",
"timeout",
"uint",
",",
"pr",
"*",
"proc",
".",
"Processor",
")",
"error",
"{",
"pld",
",",
"err",
":=",
"newPayload",
"(",
"db",
",",
"channel",
",",
"pscAddr",
",",
"pass",
",",
"amount",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"return",
"postPayload",
"(",
"db",
",",
"channel",
",",
"pld",
",",
"tls",
",",
"timeout",
",",
"pr",
",",
"srv",
".",
"Send",
")",
"\n",
"}"
] |
5,983 | all-5984 | [
"UnmarshalJSON",
"supports",
"json",
".",
"Unmarshaler",
"interface"
] | [
"func",
"(",
"v",
"*",
"GetRealtimeDataParams",
")",
"UnmarshalJSON",
"(",
"<mask>",
"[",
"]",
"byte",
")",
"error",
"{",
"r",
":=",
"jlexer",
".",
"Lexer",
"{",
"Data",
":",
"data",
"}",
"\n",
"easyjsonC5a4559bDecodeGithubComChromedpCdprotoWebaudio1",
"(",
"&",
"r",
",",
"v",
")",
"\n",
"return",
"r",
".",
"Error",
"(",
")",
"\n",
"}"
] |
5,984 | all-5985 | [
"MarshalJSON",
"supports",
"json",
".",
"Marshaler",
"interface"
] | [
"func",
"(",
"v",
"KeyRange",
")",
"MarshalJSON",
"(",
")",
"(",
"[",
"]",
"<mask>",
",",
"error",
")",
"{",
"w",
":=",
"jwriter",
".",
"Writer",
"{",
"}",
"\n",
"easyjsonC5a4559bEncodeGithubComChromedpCdprotoIndexeddb8",
"(",
"&",
"w",
",",
"v",
")",
"\n",
"return",
"w",
".",
"Buffer",
".",
"BuildBytes",
"(",
")",
",",
"w",
".",
"Error",
"\n",
"}"
] |
5,985 | all-5986 | [
"UnmarshalJSON",
"supports",
"json",
".",
"Unmarshaler",
"interface"
] | [
"func",
"(",
"v",
"*",
"EventCacheStorageContentUpdated",
")",
"UnmarshalJSON",
"(",
"data",
"[",
"]",
"byte",
")",
"error",
"{",
"r",
":=",
"jlexer",
".",
"Lexer",
"{",
"Data",
":",
"data",
"}",
"\n",
"easyjsonC5a4559bDecodeGithubComChromedpCdprotoStorage10",
"(",
"&",
"r",
",",
"v",
")",
"\n",
"return",
"r",
".",
"<mask>",
"(",
")",
"\n",
"}"
] |
5,986 | all-5987 | [
"handleDockerEvent",
"is",
"the",
"entrypoint",
"for",
"task",
"modifications",
"originating",
"with",
"events",
"occurring",
"through",
"Docker",
"outside",
"the",
"task",
"engine",
"itself",
".",
"handleDockerEvent",
"is",
"responsible",
"for",
"taking",
"an",
"event",
"that",
"correlates",
"to",
"a",
"container",
"and",
"placing",
"it",
"in",
"the",
"context",
"of",
"the",
"task",
"to",
"which",
"that",
"container",
"belongs",
"."
] | [
"func",
"(",
"engine",
"*",
"DockerTaskEngine",
")",
"handleDockerEvent",
"(",
"event",
"dockerapi",
".",
"DockerContainerChangeEvent",
")",
"{",
"seelog",
".",
"Debugf",
"(",
"\"",
"\"",
",",
"event",
".",
"String",
"(",
")",
")",
"\n\n",
"task",
",",
"ok",
":=",
"engine",
".",
"state",
".",
"TaskByID",
"(",
"event",
".",
"DockerID",
")",
"\n",
"if",
"!",
"ok",
"{",
"seelog",
".",
"Debugf",
"(",
"\"",
"\"",
",",
"event",
".",
"DockerID",
")",
"\n",
"return",
"\n",
"}",
"\n",
"cont",
",",
"ok",
":=",
"engine",
".",
"state",
".",
"ContainerByID",
"(",
"event",
".",
"DockerID",
")",
"\n",
"if",
"!",
"ok",
"{",
"seelog",
".",
"Debugf",
"(",
"\"",
"\"",
",",
"event",
".",
"DockerID",
")",
"\n",
"return",
"\n",
"}",
"\n\n",
"// Container health status change does not affect the container status",
"// no need to process this in task manager",
"if",
"event",
".",
"Type",
"==",
"apicontainer",
".",
"ContainerHealthEvent",
"{",
"if",
"cont",
".",
"Container",
".",
"HealthStatusShouldBeReported",
"(",
")",
"{",
"seelog",
".",
"Debugf",
"(",
"\"",
"\"",
",",
"cont",
".",
"Container",
".",
"Name",
",",
"cont",
".",
"DockerID",
",",
"event",
".",
"DockerContainerMetadata",
".",
"Health",
")",
"\n",
"cont",
".",
"Container",
".",
"SetHealthStatus",
"(",
"event",
".",
"DockerContainerMetadata",
".",
"Health",
")",
"\n",
"}",
"\n",
"return",
"\n",
"}",
"\n\n",
"engine",
".",
"tasksLock",
".",
"RLock",
"(",
")",
"\n",
"managedTask",
",",
"ok",
":=",
"engine",
".",
"managedTasks",
"[",
"<mask>",
".",
"Arn",
"]",
"\n",
"// hold the lock until the message is sent so we don't send on a closed channel",
"defer",
"engine",
".",
"tasksLock",
".",
"RUnlock",
"(",
")",
"\n",
"if",
"!",
"ok",
"{",
"seelog",
".",
"Criticalf",
"(",
"\"",
"\"",
",",
"task",
".",
"Arn",
",",
"event",
".",
"String",
"(",
")",
")",
"\n",
"return",
"\n",
"}",
"\n",
"seelog",
".",
"Debugf",
"(",
"\"",
"\"",
",",
"task",
".",
"Arn",
",",
"event",
".",
"String",
"(",
")",
")",
"\n",
"managedTask",
".",
"emitDockerContainerChange",
"(",
"dockerContainerChange",
"{",
"container",
":",
"cont",
".",
"Container",
",",
"event",
":",
"event",
"}",
")",
"\n",
"seelog",
".",
"Debugf",
"(",
"\"",
"\"",
",",
"task",
".",
"Arn",
",",
"event",
".",
"String",
"(",
")",
")",
"\n",
"}"
] |
5,987 | all-5988 | [
"BeforeInsert",
"sets",
"current",
"time",
"to",
"CreatedAt",
"and",
"UpdatedAt",
"field",
".",
"It",
"always",
"returns",
"nil",
"."
] | [
"func",
"(",
"ts",
"*",
"TimeStamp",
")",
"BeforeInsert",
"(",
")",
"error",
"{",
"n",
":=",
"now",
"(",
")",
"\n",
"ts",
".",
"CreatedAt",
"=",
"n",
"\n",
"<mask>",
".",
"UpdatedAt",
"=",
"n",
"\n",
"return",
"nil",
"\n",
"}"
] |
5,988 | all-5989 | [
"PutFloat32",
"writes",
"a",
"32",
"-",
"bit",
"float",
"for",
"the",
"given",
"string",
"field",
".",
"The",
"field",
"type",
"must",
"be",
"Float32Field",
"otherwise",
"an",
"error",
"is",
"returned",
".",
"The",
"type",
"code",
"is",
"written",
"first",
"then",
"the",
"value",
".",
"Upon",
"success",
"the",
"number",
"of",
"bytes",
"written",
"is",
"returned",
"along",
"with",
"a",
"nil",
"error",
"."
] | [
"func",
"(",
"b",
"*",
"TupleBuilder",
")",
"PutFloat32",
"(",
"field",
"string",
",",
"value",
"float32",
")",
"(",
"wrote",
"uint64",
",",
"err",
"error",
")",
"{",
"// field type should be",
"if",
"err",
"=",
"b",
".",
"typeCheck",
"(",
"field",
",",
"Float32Field",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"0",
",",
"err",
"\n",
"}",
"\n\n",
"// write value",
"// length check performed by xbinary",
"wrote",
",",
"err",
"=",
"xbinary",
".",
"LittleEndian",
".",
"PutFloat32",
"(",
"b",
".",
"buffer",
",",
"b",
".",
"pos",
"+",
"1",
",",
"value",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"0",
",",
"err",
"\n",
"}",
"\n\n",
"// write type code",
"b",
".",
"buffer",
"[",
"b",
".",
"pos",
"]",
"=",
"byte",
"(",
"FloatCode",
".",
"OpCode",
")",
"\n\n",
"// set field offset",
"b",
".",
"offsets",
"[",
"field",
"]",
"=",
"b",
".",
"pos",
"\n\n",
"// incr pos",
"b",
".",
"<mask>",
"+=",
"5",
"\n\n",
"return",
"5",
",",
"nil",
"\n",
"}"
] |
5,989 | all-5990 | [
"MarshalEasyJSON",
"writes",
"the",
"ISBN",
"to",
"a",
"easyjson",
".",
"Writer"
] | [
"func",
"(",
"u",
"ISBN",
")",
"MarshalEasyJSON",
"(",
"w",
"*",
"jwriter",
".",
"<mask>",
")",
"{",
"w",
".",
"String",
"(",
"string",
"(",
"u",
")",
")",
"\n",
"}"
] |
5,990 | all-5991 | [
"IsEncrypted",
"will",
"return",
"true",
"if",
"the",
"client",
"is",
"connected",
"using",
"a",
"TLS",
"transport",
"either",
"because",
"it",
"used",
".",
"TLS",
"to",
"connect",
"from",
"the",
"outset",
"or",
"because",
"it",
"successfully",
"used",
"STARTTLS",
"to",
"promote",
"a",
"TCP",
"connection",
"to",
"TLS",
"."
] | [
"func",
"(",
"c",
"*",
"Client",
")",
"IsEncrypted",
"(",
")",
"bool",
"{",
"_",
",",
"<mask>",
":=",
"c",
".",
"conn",
".",
"(",
"*",
"tls",
".",
"Conn",
")",
"\n",
"return",
"ok",
"\n",
"}"
] |
5,991 | all-5992 | [
"SetAllow3State",
"sets",
"if",
"ComboBox",
"should",
"use",
"3",
"states",
".",
"If",
"the",
"current",
"state",
"is",
"unknown",
"and",
"one",
"disables",
"Allow3State",
"option",
"then",
"the",
"current",
"value",
"resets",
"to",
"off"
] | [
"func",
"(",
"c",
"*",
"CheckBox",
")",
"SetAllow3State",
"(",
"<mask>",
"bool",
")",
"{",
"if",
"!",
"enable",
"&&",
"c",
".",
"state",
"==",
"2",
"{",
"c",
".",
"state",
"=",
"0",
"\n",
"}",
"\n",
"c",
".",
"allow3state",
"=",
"enable",
"\n",
"}"
] |
5,992 | all-5993 | [
"GetLabel",
"is",
"a",
"wrapper",
"around",
"gtk_label_get_label",
"()",
"."
] | [
"func",
"(",
"v",
"*",
"Label",
")",
"GetLabel",
"(",
")",
"string",
"{",
"c",
":=",
"C",
".",
"gtk_label_get_label",
"(",
"v",
".",
"native",
"(",
")",
")",
"\n",
"if",
"c",
"==",
"nil",
"{",
"return",
"\"",
"\"",
"\n",
"}",
"\n",
"return",
"C",
".",
"GoString",
"(",
"(",
"*",
"C",
".",
"<mask>",
")",
"(",
"c",
")",
")",
"\n",
"}"
] |
5,993 | all-5994 | [
"WrapTLS",
"Server",
"converts",
"a",
"standard",
"*",
"http",
".",
"Server",
"to",
"a",
"buffalo",
".",
"Server",
"but",
"makes",
"sure",
"it",
"is",
"run",
"with",
"TLS",
"."
] | [
"func",
"WrapTLS",
"(",
"s",
"*",
"<mask>",
".",
"Server",
",",
"certFile",
"string",
",",
"keyFile",
"string",
")",
"Server",
"{",
"return",
"&",
"TLS",
"{",
"Server",
":",
"s",
",",
"CertFile",
":",
"certFile",
",",
"KeyFile",
":",
"keyFile",
",",
"}",
"\n",
"}"
] |
5,994 | all-5995 | [
"ResolveContainer",
"resolves",
"the",
"api",
"container",
"object",
"given",
"container",
"id",
"."
] | [
"func",
"(",
"resolver",
"*",
"DockerContainerMetadataResolver",
")",
"ResolveContainer",
"(",
"dockerID",
"string",
")",
"(",
"*",
"apicontainer",
".",
"DockerContainer",
",",
"error",
")",
"{",
"if",
"resolver",
".",
"dockerTaskEngine",
"==",
"nil",
"{",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"container",
",",
"<mask>",
":=",
"resolver",
".",
"dockerTaskEngine",
".",
"State",
"(",
")",
".",
"ContainerByID",
"(",
"dockerID",
")",
"\n",
"if",
"!",
"found",
"{",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"dockerID",
")",
"\n",
"}",
"\n\n",
"return",
"container",
",",
"nil",
"\n",
"}"
] |
5,995 | all-5996 | [
"AddCommand",
"registers",
"new",
"help",
"text",
"for",
"a",
"bot",
"command",
"."
] | [
"func",
"(",
"pluginHelp",
"*",
"PluginHelp",
")",
"AddCommand",
"(",
"<mask>",
"Command",
")",
"{",
"pluginHelp",
".",
"Commands",
"=",
"append",
"(",
"pluginHelp",
".",
"Commands",
",",
"command",
")",
"\n",
"}"
] |
5,996 | all-5997 | [
"NewLevel",
"returns",
"a",
"random",
"level",
"for",
"the",
"next",
"node"
] | [
"func",
"(",
"s",
"*",
"Skiplist",
")",
"NewLevel",
"(",
"randFn",
"func",
"(",
")",
"float32",
")",
"int",
"{",
"var",
"nextLevel",
"int",
"\n\n",
"for",
";",
"randFn",
"(",
")",
"<",
"p",
";",
"nextLevel",
"++",
"{",
"}",
"\n\n",
"if",
"nextLevel",
">",
"MaxLevel",
"{",
"nextLevel",
"=",
"MaxLevel",
"\n",
"}",
"\n\n",
"level",
":=",
"int",
"(",
"atomic",
".",
"LoadInt32",
"(",
"&",
"s",
".",
"level",
")",
")",
"\n",
"if",
"nextLevel",
">",
"level",
"{",
"if",
"atomic",
".",
"CompareAndSwapInt32",
"(",
"&",
"s",
".",
"level",
",",
"int32",
"(",
"level",
")",
",",
"int32",
"(",
"<mask>",
"+",
"1",
")",
")",
"{",
"nextLevel",
"=",
"level",
"+",
"1",
"\n",
"}",
"else",
"{",
"nextLevel",
"=",
"level",
"\n",
"}",
"\n",
"}",
"\n\n",
"return",
"nextLevel",
"\n",
"}"
] |
5,997 | all-5998 | [
"CreatePipelineService",
"creates",
"a",
"new",
"pipeline",
"service",
"."
] | [
"func",
"(",
"c",
"APIClient",
")",
"CreatePipelineService",
"(",
"name",
"string",
",",
"<mask>",
"string",
",",
"cmd",
"[",
"]",
"string",
",",
"stdin",
"[",
"]",
"string",
",",
"parallelismSpec",
"*",
"pps",
".",
"ParallelismSpec",
",",
"input",
"*",
"pps",
".",
"Input",
",",
"update",
"bool",
",",
"internalPort",
"int32",
",",
"externalPort",
"int32",
",",
")",
"error",
"{",
"_",
",",
"err",
":=",
"c",
".",
"PpsAPIClient",
".",
"CreatePipeline",
"(",
"c",
".",
"Ctx",
"(",
")",
",",
"&",
"pps",
".",
"CreatePipelineRequest",
"{",
"Pipeline",
":",
"NewPipeline",
"(",
"name",
")",
",",
"Transform",
":",
"&",
"pps",
".",
"Transform",
"{",
"Image",
":",
"image",
",",
"Cmd",
":",
"cmd",
",",
"Stdin",
":",
"stdin",
",",
"}",
",",
"ParallelismSpec",
":",
"parallelismSpec",
",",
"Input",
":",
"input",
",",
"Update",
":",
"update",
",",
"Service",
":",
"&",
"pps",
".",
"Service",
"{",
"InternalPort",
":",
"internalPort",
",",
"ExternalPort",
":",
"externalPort",
",",
"}",
",",
"}",
",",
")",
"\n",
"return",
"grpcutil",
".",
"ScrubGRPC",
"(",
"err",
")",
"\n",
"}"
] |
5,998 | all-5999 | [
"InitSlice",
"initializes",
"all",
"models",
"in",
"a",
"slice",
"of",
"the",
"form",
"*",
"[]",
"*",
"Post",
"and",
"returns",
"a",
"new",
"slice",
"that",
"contains",
"all",
"initialized",
"models",
"."
] | [
"func",
"InitSlice",
"(",
"ptr",
"interface",
"{",
"}",
")",
"[",
"]",
"Model",
"{",
"// get slice",
"slice",
":=",
"reflect",
".",
"ValueOf",
"(",
"ptr",
")",
".",
"Elem",
"(",
")",
"\n\n",
"// make model slice",
"models",
":=",
"make",
"(",
"[",
"]",
"Model",
",",
"slice",
".",
"Len",
"(",
")",
")",
"\n\n",
"// iterate over entries",
"for",
"i",
":=",
"0",
";",
"i",
"<",
"slice",
".",
"Len",
"(",
")",
";",
"i",
"++",
"{",
"m",
":=",
"Init",
"(",
"slice",
".",
"Index",
"(",
"i",
")",
".",
"Interface",
"(",
")",
".",
"(",
"Model",
")",
")",
"\n",
"models",
"[",
"i",
"]",
"=",
"m",
"\n",
"}",
"\n\n",
"return",
"<mask>",
"\n",
"}"
] |
5,999 | all-6000 | [
"MarshalJSON",
"supports",
"json",
".",
"Marshaler",
"interface"
] | [
"func",
"(",
"v",
"ScreencastFrameAckParams",
")",
"MarshalJSON",
"(",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"w",
":=",
"jwriter",
".",
"<mask>",
"{",
"}",
"\n",
"easyjsonC5a4559bEncodeGithubComChromedpCdprotoPage18",
"(",
"&",
"w",
",",
"v",
")",
"\n",
"return",
"w",
".",
"Buffer",
".",
"BuildBytes",
"(",
")",
",",
"w",
".",
"Error",
"\n",
"}"
] |
Subsets and Splits
No saved queries yet
Save your SQL queries to embed, download, and access them later. Queries will appear here once saved.