id
int32 0
25.3k
| idx
stringlengths 5
9
| nl_tokens
sequencelengths 1
418
| pl_tokens
sequencelengths 22
4.98k
|
---|---|---|---|
1,500 | all-1501 | [
"SearchMetrics",
"searches",
"through",
"the",
"metrics",
"facet",
"returning",
"matching",
"ones",
"."
] | [
"func",
"(",
"client",
"*",
"Client",
")",
"SearchMetrics",
"(",
"search",
"string",
")",
"(",
"[",
"]",
"string",
",",
"error",
")",
"{",
"var",
"out",
"reqSearch",
"\n",
"if",
"err",
":=",
"client",
".",
"doJsonRequest",
"(",
"\"",
"\"",
",",
"\"",
"\"",
"+",
"search",
",",
"nil",
",",
"&",
"out",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"return",
"<mask>",
".",
"Results",
".",
"Metrics",
",",
"nil",
"\n",
"}"
] |
1,501 | all-1502 | [
"PrintPipelineInfo",
"pretty",
"-",
"prints",
"pipeline",
"info",
"."
] | [
"func",
"PrintPipelineInfo",
"(",
"w",
"io",
".",
"<mask>",
",",
"pipelineInfo",
"*",
"ppsclient",
".",
"PipelineInfo",
",",
"fullTimestamps",
"bool",
")",
"{",
"fmt",
".",
"Fprintf",
"(",
"w",
",",
"\"",
"\\t",
"\"",
",",
"pipelineInfo",
".",
"Pipeline",
".",
"Name",
")",
"\n",
"fmt",
".",
"Fprintf",
"(",
"w",
",",
"\"",
"\\t",
"\"",
",",
"ShorthandInput",
"(",
"pipelineInfo",
".",
"Input",
")",
")",
"\n",
"if",
"fullTimestamps",
"{",
"fmt",
".",
"Fprintf",
"(",
"w",
",",
"\"",
"\\t",
"\"",
",",
"pipelineInfo",
".",
"CreatedAt",
".",
"String",
"(",
")",
")",
"\n",
"}",
"else",
"{",
"fmt",
".",
"Fprintf",
"(",
"w",
",",
"\"",
"\\t",
"\"",
",",
"pretty",
".",
"Ago",
"(",
"pipelineInfo",
".",
"CreatedAt",
")",
")",
"\n",
"}",
"\n",
"fmt",
".",
"Fprintf",
"(",
"w",
",",
"\"",
"\\t",
"\\n",
"\"",
",",
"pipelineState",
"(",
"pipelineInfo",
".",
"State",
")",
",",
"jobState",
"(",
"pipelineInfo",
".",
"LastJobState",
")",
")",
"\n",
"}"
] |
1,502 | all-1503 | [
"MarshalJSON",
"supports",
"json",
".",
"Marshaler",
"interface"
] | [
"func",
"(",
"v",
"InspectWorkerParams",
")",
"MarshalJSON",
"(",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"w",
":=",
"jwriter",
".",
"Writer",
"{",
"}",
"\n",
"easyjsonC5a4559bEncodeGithubComChromedpCdprotoServiceworker9",
"(",
"&",
"w",
",",
"v",
")",
"\n",
"return",
"w",
".",
"<mask>",
".",
"BuildBytes",
"(",
")",
",",
"w",
".",
"Error",
"\n",
"}"
] |
1,503 | all-1504 | [
"PrintTypes",
"writes",
"all",
"registered",
"types",
"in",
"a",
"markdown",
"-",
"style",
"table",
".",
"The",
"table",
"s",
"header",
"is",
":",
"|",
"Type",
"|",
"Name",
"|",
"Prefix",
"|",
"Notes",
"|",
"Where",
"Type",
"is",
"the",
"golang",
"type",
"name",
"and",
"Name",
"is",
"the",
"name",
"the",
"type",
"was",
"registered",
"with",
"."
] | [
"func",
"(",
"cdc",
"*",
"Codec",
")",
"PrintTypes",
"(",
"out",
"io",
".",
"Writer",
")",
"error",
"{",
"cdc",
".",
"mtx",
".",
"RLock",
"(",
")",
"\n",
"defer",
"cdc",
".",
"mtx",
".",
"RUnlock",
"(",
")",
"\n",
"// print header",
"if",
"_",
",",
"err",
":=",
"io",
".",
"WriteString",
"(",
"out",
",",
"\"",
"\\n",
"\"",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"if",
"_",
",",
"err",
":=",
"io",
".",
"WriteString",
"(",
"out",
",",
"\"",
"\\n",
"\"",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"// only print concrete types for now (if we want everything, we can iterate over the typeInfos map instead)",
"for",
"_",
",",
"i",
":=",
"range",
"cdc",
".",
"concreteInfos",
"{",
"io",
".",
"WriteString",
"(",
"out",
",",
"\"",
"\"",
")",
"\n",
"// TODO(ismail): optionally create a link to code on github:",
"if",
"_",
",",
"err",
":=",
"io",
".",
"WriteString",
"(",
"out",
",",
"i",
".",
"Type",
".",
"Name",
"(",
")",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"if",
"_",
",",
"err",
":=",
"io",
".",
"WriteString",
"(",
"<mask>",
",",
"\"",
"\"",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"if",
"_",
",",
"err",
":=",
"io",
".",
"WriteString",
"(",
"out",
",",
"i",
".",
"Name",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"if",
"_",
",",
"err",
":=",
"io",
".",
"WriteString",
"(",
"out",
",",
"\"",
"\"",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"if",
"_",
",",
"err",
":=",
"io",
".",
"WriteString",
"(",
"out",
",",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"i",
".",
"Prefix",
")",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"if",
"_",
",",
"err",
":=",
"io",
".",
"WriteString",
"(",
"out",
",",
"\"",
"\"",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"if",
"_",
",",
"err",
":=",
"io",
".",
"WriteString",
"(",
"out",
",",
"getLengthStr",
"(",
"i",
")",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"if",
"_",
",",
"err",
":=",
"io",
".",
"WriteString",
"(",
"out",
",",
"\"",
"\"",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"// empty notes table data by default // TODO(ismail): make this configurable",
"io",
".",
"WriteString",
"(",
"out",
",",
"\"",
"\\n",
"\"",
")",
"\n",
"}",
"\n",
"// finish table",
"return",
"nil",
"\n",
"}"
] |
1,504 | all-1505 | [
"QueryTemplate",
"-",
"fake",
"querying",
"for",
"a",
"template"
] | [
"func",
"(",
"s",
"*",
"FakeVCDClient",
")",
"QueryTemplate",
"(",
"templateName",
"<mask>",
")",
"(",
"vappTemplate",
"*",
"vcloudclient",
".",
"VAppTemplateRecord",
",",
"err",
"error",
")",
"{",
"return",
"s",
".",
"FakeVAppTemplateRecord",
",",
"s",
".",
"ErrDeployFake",
"\n",
"}"
] |
1,505 | all-1506 | [
"Size",
"returns",
"the",
"size",
"of",
"a",
"node"
] | [
"func",
"(",
"s",
"*",
"Skiplist",
")",
"Size",
"(",
"n",
"*",
"<mask>",
")",
"int",
"{",
"return",
"s",
".",
"ItemSize",
"(",
"n",
".",
"Item",
"(",
")",
")",
"+",
"n",
".",
"Size",
"(",
")",
"\n",
"}"
] |
1,506 | all-1507 | [
"WithContext",
"returns",
"a",
"copy",
"of",
"the",
"parent",
"context",
"and",
"associates",
"it",
"with",
"an",
"in",
"-",
"flight",
"HTTP",
"request",
".",
"This",
"function",
"is",
"cheap",
"."
] | [
"func",
"WithContext",
"(",
"parent",
"context",
".",
"Context",
",",
"req",
"*",
"http",
".",
"Request",
")",
"<mask>",
".",
"Context",
"{",
"return",
"internal",
".",
"WithContext",
"(",
"parent",
",",
"req",
")",
"\n",
"}"
] |
1,507 | all-1508 | [
"dataRaw",
"is",
"a",
"wrapper",
"around",
"the",
"data",
"struct",
"field"
] | [
"func",
"(",
"v",
"*",
"List",
")",
"dataRaw",
"(",
")",
"unsafe",
".",
"Pointer",
"{",
"return",
"unsafe",
".",
"Pointer",
"(",
"v",
".",
"native",
"(",
")",
".",
"<mask>",
")",
"\n",
"}"
] |
1,508 | all-1509 | [
"Insert",
"is",
"a",
"wrapper",
"around",
"gtk_combo_box_text_insert",
"()",
"."
] | [
"func",
"(",
"v",
"*",
"ComboBoxText",
")",
"Insert",
"(",
"position",
"int",
",",
"id",
",",
"text",
"string",
")",
"{",
"cid",
":=",
"C",
".",
"CString",
"(",
"id",
")",
"\n",
"ctext",
":=",
"C",
".",
"CString",
"(",
"<mask>",
")",
"\n",
"defer",
"C",
".",
"free",
"(",
"unsafe",
".",
"Pointer",
"(",
"cid",
")",
")",
"\n",
"defer",
"C",
".",
"free",
"(",
"unsafe",
".",
"Pointer",
"(",
"ctext",
")",
")",
"\n",
"C",
".",
"gtk_combo_box_text_insert",
"(",
"v",
".",
"native",
"(",
")",
",",
"C",
".",
"gint",
"(",
"position",
")",
",",
"(",
"*",
"C",
".",
"gchar",
")",
"(",
"cid",
")",
",",
"(",
"*",
"C",
".",
"gchar",
")",
"(",
"ctext",
")",
")",
"\n",
"}"
] |
1,509 | all-1510 | [
"OpenForRead",
"only",
"opens",
"the",
"wal",
"files",
"for",
"read",
".",
"Write",
"on",
"a",
"read",
"only",
"wal",
"panics",
"."
] | [
"func",
"OpenForRead",
"(",
"lg",
"*",
"zap",
".",
"Logger",
",",
"dirpath",
"string",
",",
"snap",
"walpb",
".",
"Snapshot",
")",
"(",
"*",
"WAL",
",",
"error",
")",
"{",
"return",
"openAtIndex",
"(",
"lg",
",",
"dirpath",
",",
"snap",
",",
"<mask>",
")",
"\n",
"}"
] |
1,510 | all-1511 | [
"GetHandleOk",
"returns",
"a",
"tuple",
"with",
"the",
"Handle",
"field",
"if",
"it",
"s",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"and",
"a",
"boolean",
"to",
"check",
"if",
"the",
"value",
"has",
"been",
"set",
"."
] | [
"func",
"(",
"s",
"*",
"SyntheticsUser",
")",
"GetHandleOk",
"(",
")",
"(",
"string",
",",
"bool",
")",
"{",
"if",
"s",
"==",
"nil",
"||",
"s",
".",
"Handle",
"==",
"nil",
"{",
"return",
"\"",
"\"",
",",
"false",
"\n",
"}",
"\n",
"return",
"*",
"s",
".",
"Handle",
",",
"<mask>",
"\n",
"}"
] |
1,511 | all-1512 | [
"createContext",
"has",
"the",
"user",
"create",
"a",
"context",
"."
] | [
"func",
"createContext",
"(",
"co",
"contextOptions",
")",
"(",
"string",
",",
"error",
")",
"{",
"proj",
",",
"err",
":=",
"selectProject",
"(",
"co",
".",
"project",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"logrus",
".",
"Info",
"(",
"\"",
"\"",
")",
"\n",
"return",
"\"",
"\"",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"}",
"\n\n",
"fmt",
".",
"Printf",
"(",
"\"",
"\"",
",",
"proj",
")",
"\n",
"fmt",
".",
"Println",
"(",
")",
"\n",
"clusters",
",",
"err",
":=",
"currentClusters",
"(",
"proj",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"\"",
"\"",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"proj",
",",
"err",
")",
"\n",
"}",
"\n",
"for",
"name",
":=",
"range",
"clusters",
"{",
"fmt",
".",
"Println",
"(",
"\"",
"\"",
",",
"name",
")",
"\n",
"}",
"\n",
"if",
"len",
"(",
"clusters",
")",
"==",
"0",
"{",
"fmt",
".",
"Println",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"var",
"choice",
"string",
"\n",
"create",
":=",
"co",
".",
"create",
"\n",
"reuse",
":=",
"co",
".",
"reuse",
"\n",
"switch",
"{",
"case",
"create",
"!=",
"\"",
"\"",
"&&",
"reuse",
"!=",
"\"",
"\"",
":",
"return",
"\"",
"\"",
",",
"errors",
".",
"New",
"(",
"\"",
"\"",
")",
"\n",
"case",
"create",
"!=",
"\"",
"\"",
":",
"fmt",
".",
"Println",
"(",
"\"",
"\"",
"+",
"create",
"+",
"\"",
"\"",
")",
"\n",
"<mask>",
"=",
"\"",
"\"",
"\n",
"case",
"reuse",
"!=",
"\"",
"\"",
":",
"fmt",
".",
"Println",
"(",
"\"",
"\"",
"+",
"reuse",
"+",
"\"",
"\"",
")",
"\n",
"choice",
"=",
"reuse",
"\n",
"default",
":",
"fmt",
".",
"Print",
"(",
"\"",
"\"",
")",
"\n",
"fmt",
".",
"Scanln",
"(",
"&",
"choice",
")",
"\n",
"}",
"\n\n",
"if",
"choice",
"==",
"\"",
"\"",
"||",
"choice",
"==",
"\"",
"\"",
"{",
"cluster",
",",
"err",
":=",
"createCluster",
"(",
"proj",
",",
"create",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"\"",
"\"",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"proj",
",",
"err",
")",
"\n",
"}",
"\n",
"return",
"cluster",
".",
"context",
"(",
")",
",",
"nil",
"\n",
"}",
"\n\n",
"cluster",
",",
"ok",
":=",
"clusters",
"[",
"choice",
"]",
"\n",
"if",
"!",
"ok",
"{",
"return",
"\"",
"\"",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"choice",
")",
"\n",
"}",
"\n",
"cmd",
":=",
"exec",
".",
"Command",
"(",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"cluster",
".",
"name",
",",
"\"",
"\"",
"+",
"cluster",
".",
"project",
",",
"\"",
"\"",
"+",
"cluster",
".",
"zone",
")",
"\n",
"cmd",
".",
"Stdin",
"=",
"os",
".",
"Stdin",
"\n",
"cmd",
".",
"Stdout",
"=",
"os",
".",
"Stdout",
"\n",
"cmd",
".",
"Stderr",
"=",
"os",
".",
"Stderr",
"\n",
"if",
"err",
":=",
"cmd",
".",
"Run",
"(",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"\"",
"\"",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"}",
"\n",
"return",
"cluster",
".",
"context",
"(",
")",
",",
"nil",
"\n",
"}"
] |
1,512 | all-1513 | [
"Specify",
"the",
"value",
"of",
"a",
"uniform",
"variable",
"for",
"the",
"current",
"program",
"object"
] | [
"func",
"Uniform4fv",
"(",
"location",
"int32",
",",
"<mask>",
"int32",
",",
"value",
"*",
"float32",
")",
"{",
"syscall",
".",
"Syscall",
"(",
"gpUniform4fv",
",",
"3",
",",
"uintptr",
"(",
"location",
")",
",",
"uintptr",
"(",
"count",
")",
",",
"uintptr",
"(",
"unsafe",
".",
"Pointer",
"(",
"value",
")",
")",
")",
"\n",
"}"
] |
1,513 | all-1514 | [
"StorageVolumeConfigClear",
"deletes",
"storage",
"volume",
"config",
"."
] | [
"func",
"StorageVolumeConfigClear",
"(",
"<mask>",
"*",
"sql",
".",
"Tx",
",",
"volumeID",
"int64",
")",
"error",
"{",
"_",
",",
"err",
":=",
"tx",
".",
"Exec",
"(",
"\"",
"\"",
",",
"volumeID",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"return",
"nil",
"\n",
"}"
] |
1,514 | all-1515 | [
"Union",
"unions",
"two",
"DisjointSet",
"with",
"ds1",
"s",
"represent",
"."
] | [
"func",
"Union",
"(",
"forests",
"*",
"Forests",
",",
"ds1",
",",
"ds2",
"*",
"DisjointSet",
")",
"{",
"newDS",
":=",
"&",
"DisjointSet",
"{",
"}",
"\n",
"newDS",
".",
"represent",
"=",
"ds1",
".",
"represent",
"\n",
"newDS",
".",
"members",
"=",
"ds1",
".",
"members",
"\n",
"for",
"k",
":=",
"range",
"ds2",
".",
"members",
"{",
"newDS",
".",
"members",
"[",
"k",
"]",
"=",
"struct",
"{",
"}",
"{",
"}",
"\n",
"}",
"\n",
"forests",
".",
"mu",
".",
"Lock",
"(",
")",
"\n",
"defer",
"forests",
".",
"mu",
".",
"Unlock",
"(",
")",
"\n",
"forests",
".",
"<mask>",
"[",
"newDS",
"]",
"=",
"struct",
"{",
"}",
"{",
"}",
"\n",
"delete",
"(",
"forests",
".",
"data",
",",
"ds1",
")",
"\n",
"delete",
"(",
"forests",
".",
"data",
",",
"ds2",
")",
"\n",
"}"
] |
1,515 | all-1516 | [
"GetToken",
"returns",
"the",
"xml",
".",
"Token",
"representation",
"of",
"the",
"node"
] | [
"func",
"(",
"a",
"XMLNode",
")",
"GetToken",
"(",
")",
"xml",
".",
"Token",
"{",
"if",
"a",
".",
"NodeType",
"==",
"tree",
".",
"NtAttr",
"{",
"ret",
":=",
"a",
".",
"Token",
".",
"(",
"*",
"xml",
".",
"Attr",
")",
"\n",
"return",
"*",
"ret",
"\n",
"}",
"\n",
"return",
"a",
".",
"<mask>",
"\n",
"}"
] |
1,516 | all-1517 | [
"validateFields",
"verifies",
"that",
"no",
"bad",
"arguments",
"were",
"given",
"to",
"the",
"request",
"."
] | [
"func",
"validateFields",
"(",
"req",
"*",
"logical",
".",
"Request",
",",
"data",
"*",
"framework",
".",
"FieldData",
")",
"error",
"{",
"var",
"unknownFields",
"[",
"]",
"string",
"\n",
"for",
"k",
":=",
"range",
"req",
".",
"Data",
"{",
"if",
"_",
",",
"ok",
":=",
"<mask>",
".",
"Schema",
"[",
"k",
"]",
";",
"!",
"ok",
"{",
"unknownFields",
"=",
"append",
"(",
"unknownFields",
",",
"k",
")",
"\n",
"}",
"\n",
"}",
"\n\n",
"if",
"len",
"(",
"unknownFields",
")",
">",
"0",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"unknownFields",
")",
"\n",
"}",
"\n\n",
"return",
"nil",
"\n",
"}"
] |
1,517 | all-1518 | [
"SetMethodHandler",
"reigsters",
"the",
"given",
"handler",
"for",
"the",
"method",
"."
] | [
"func",
"(",
"e",
"*",
"Entry",
")",
"SetMethodHandler",
"(",
"method",
"string",
",",
"h",
"*",
"<mask>",
")",
"error",
"{",
"if",
"e",
".",
"GetHandler",
"(",
"method",
")",
"!=",
"nil",
"{",
"return",
"errors",
".",
"New",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"e",
".",
"handlers",
"[",
"method",
"]",
"=",
"h",
"\n",
"return",
"nil",
"\n",
"}"
] |
1,518 | all-1519 | [
"ParseFile",
"parses",
"the",
"netrc",
"file",
"identified",
"by",
"filename",
"and",
"returns",
"the",
"set",
"of",
"machine",
"information",
"and",
"macros",
"defined",
"in",
"it",
".",
"The",
"default",
"machine",
"which",
"is",
"intended",
"to",
"be",
"used",
"when",
"no",
"machine",
"name",
"matches",
"is",
"identified",
"by",
"an",
"empty",
"machine",
"name",
".",
"There",
"can",
"be",
"only",
"one",
"default",
"machine",
".",
"If",
"there",
"is",
"a",
"parsing",
"error",
"an",
"Error",
"is",
"returned",
"."
] | [
"func",
"ParseFile",
"(",
"filename",
"string",
")",
"(",
"[",
"]",
"*",
"Machine",
",",
"Macros",
",",
"error",
")",
"{",
"// TODO(fhs): Check if file is readable by anyone besides the user if there is password in it.",
"fd",
",",
"err",
":=",
"os",
".",
"Open",
"(",
"<mask>",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"nil",
",",
"err",
"\n",
"}",
"\n",
"defer",
"fd",
".",
"Close",
"(",
")",
"\n",
"return",
"parse",
"(",
"fd",
",",
"&",
"filePos",
"{",
"filename",
",",
"1",
"}",
")",
"\n",
"}"
] |
1,519 | all-1520 | [
"GetOperationWebsocket",
"returns",
"a",
"websocket",
"connection",
"for",
"the",
"provided",
"operation"
] | [
"func",
"(",
"r",
"*",
"ProtocolLXD",
")",
"GetOperationWebsocket",
"(",
"uuid",
"string",
",",
"secret",
"string",
")",
"(",
"*",
"websocket",
".",
"Conn",
",",
"error",
")",
"{",
"path",
":=",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"url",
".",
"QueryEscape",
"(",
"uuid",
")",
")",
"\n",
"if",
"secret",
"!=",
"\"",
"\"",
"{",
"path",
"=",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"path",
",",
"url",
".",
"QueryEscape",
"(",
"secret",
")",
")",
"\n",
"}",
"\n\n",
"return",
"r",
".",
"websocket",
"(",
"<mask>",
")",
"\n",
"}"
] |
1,520 | all-1521 | [
"WarnFunc",
"outputs",
"Warn",
"level",
"log",
"returned",
"from",
"the",
"function"
] | [
"func",
"WarnFunc",
"(",
"f",
"func",
"(",
")",
"string",
")",
"error",
"{",
"if",
"isModeEnable",
"(",
"<mask>",
")",
"{",
"return",
"glg",
".",
"out",
"(",
"WARN",
",",
"\"",
"\"",
",",
"f",
"(",
")",
")",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
] |
1,521 | all-1522 | [
"DoesSchemaTableExist",
"return",
"whether",
"the",
"schema",
"table",
"is",
"present",
"in",
"the",
"database",
"."
] | [
"func",
"DoesSchemaTableExist",
"(",
"tx",
"*",
"sql",
".",
"Tx",
")",
"(",
"bool",
",",
"error",
")",
"{",
"statement",
":=",
"`\nSELECT COUNT(name) FROM sqlite_master WHERE type = 'table' AND name = 'schema'\n`",
"\n",
"rows",
",",
"err",
":=",
"tx",
".",
"Query",
"(",
"statement",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"<mask>",
",",
"err",
"\n",
"}",
"\n",
"defer",
"rows",
".",
"Close",
"(",
")",
"\n\n",
"if",
"!",
"rows",
".",
"Next",
"(",
")",
"{",
"return",
"false",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"var",
"count",
"int",
"\n\n",
"err",
"=",
"rows",
".",
"Scan",
"(",
"&",
"count",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"false",
",",
"err",
"\n",
"}",
"\n\n",
"return",
"count",
"==",
"1",
",",
"nil",
"\n",
"}"
] |
1,522 | all-1523 | [
"GetContainers",
"returns",
"a",
"list",
"of",
"containers"
] | [
"func",
"(",
"r",
"*",
"ProtocolLXD",
")",
"GetContainers",
"(",
")",
"(",
"[",
"]",
"api",
".",
"Container",
",",
"error",
")",
"{",
"containers",
":=",
"[",
"]",
"api",
".",
"<mask>",
"{",
"}",
"\n\n",
"// Fetch the raw value",
"_",
",",
"err",
":=",
"r",
".",
"queryStruct",
"(",
"\"",
"\"",
",",
"\"",
"\"",
",",
"nil",
",",
"\"",
"\"",
",",
"&",
"containers",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"return",
"containers",
",",
"nil",
"\n",
"}"
] |
1,523 | all-1524 | [
"GetSubChannel",
"returns",
"a",
"SubChannel",
"for",
"the",
"given",
"service",
"name",
".",
"If",
"the",
"subchannel",
"does",
"not",
"exist",
"it",
"is",
"created",
"."
] | [
"func",
"(",
"ch",
"*",
"Channel",
")",
"GetSubChannel",
"(",
"serviceName",
"string",
",",
"opts",
"...",
"SubChannelOption",
")",
"*",
"SubChannel",
"{",
"sub",
",",
"added",
":=",
"ch",
".",
"subChannels",
".",
"getOrAdd",
"(",
"serviceName",
",",
"ch",
")",
"\n",
"if",
"added",
"{",
"for",
"_",
",",
"opt",
":=",
"<mask>",
"opts",
"{",
"opt",
"(",
"sub",
")",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"sub",
"\n",
"}"
] |
1,524 | all-1525 | [
"ParameterizedBuild",
"triggers",
"a",
"new",
"parameterized",
"build",
"for",
"the",
"given",
"project",
"on",
"the",
"given",
"branch",
"Marshaling",
"the",
"struct",
"into",
"json",
"and",
"passing",
"in",
"the",
"post",
"body",
".",
"Returns",
"the",
"new",
"build",
"information"
] | [
"func",
"(",
"c",
"*",
"Client",
")",
"ParameterizedBuild",
"(",
"account",
",",
"repo",
",",
"branch",
"string",
",",
"buildParameters",
"map",
"[",
"string",
"]",
"string",
")",
"(",
"*",
"Build",
",",
"error",
")",
"{",
"opts",
":=",
"map",
"[",
"string",
"]",
"interface",
"{",
"}",
"{",
"\"",
"\"",
":",
"buildParameters",
"}",
"\n",
"return",
"c",
".",
"BuildOpts",
"(",
"<mask>",
",",
"repo",
",",
"branch",
",",
"opts",
")",
"\n",
"}"
] |
1,525 | all-1526 | [
"HasPermission",
"check",
"has",
"permission",
"for",
"permissioners",
"or",
"not"
] | [
"func",
"(",
"ps",
"permissioners",
")",
"HasPermission",
"(",
"mode",
"PermissionMode",
",",
"roles",
"...",
"interface",
"{",
"}",
")",
"bool",
"{",
"for",
"_",
",",
"p",
":=",
"range",
"<mask>",
"{",
"if",
"p",
"!=",
"nil",
"&&",
"!",
"p",
".",
"HasPermission",
"(",
"mode",
",",
"roles",
")",
"{",
"return",
"false",
"\n",
"}",
"\n",
"}",
"\n\n",
"return",
"true",
"\n",
"}"
] |
1,526 | all-1527 | [
"UnmarshalEasyJSON",
"satisfies",
"easyjson",
".",
"Unmarshaler",
"."
] | [
"func",
"(",
"t",
"*",
"SetEmitTouchEventsForMouseConfiguration",
")",
"UnmarshalEasyJSON",
"(",
"in",
"*",
"jlexer",
".",
"Lexer",
")",
"{",
"switch",
"SetEmitTouchEventsForMouseConfiguration",
"(",
"in",
".",
"String",
"(",
")",
")",
"{",
"<mask>",
"SetEmitTouchEventsForMouseConfigurationMobile",
":",
"*",
"t",
"=",
"SetEmitTouchEventsForMouseConfigurationMobile",
"\n",
"case",
"SetEmitTouchEventsForMouseConfigurationDesktop",
":",
"*",
"t",
"=",
"SetEmitTouchEventsForMouseConfigurationDesktop",
"\n\n",
"default",
":",
"in",
".",
"AddError",
"(",
"errors",
".",
"New",
"(",
"\"",
"\"",
")",
")",
"\n",
"}",
"\n",
"}"
] |
1,527 | all-1528 | [
"AppendBytes",
"appends",
"cookie",
"representation",
"to",
"dst",
"and",
"returns",
"the",
"extended",
"dst",
"."
] | [
"func",
"(",
"c",
"*",
"Cookie",
")",
"AppendBytes",
"(",
"dst",
"[",
"]",
"byte",
")",
"[",
"]",
"byte",
"{",
"if",
"len",
"(",
"c",
".",
"key",
")",
">",
"0",
"{",
"dst",
"=",
"append",
"(",
"dst",
",",
"c",
".",
"key",
"...",
")",
"\n",
"dst",
"=",
"append",
"(",
"dst",
",",
"'='",
")",
"\n",
"}",
"\n",
"dst",
"=",
"append",
"(",
"dst",
",",
"c",
".",
"value",
"...",
")",
"\n\n",
"if",
"c",
".",
"maxAge",
">",
"0",
"{",
"dst",
"=",
"append",
"(",
"dst",
",",
"';'",
",",
"' '",
")",
"\n",
"dst",
"=",
"append",
"(",
"dst",
",",
"strCookieMaxAge",
"...",
")",
"\n",
"dst",
"=",
"append",
"(",
"dst",
",",
"'='",
")",
"\n",
"dst",
"=",
"AppendUint",
"(",
"dst",
",",
"c",
".",
"maxAge",
")",
"\n",
"}",
"else",
"if",
"!",
"c",
".",
"expire",
".",
"IsZero",
"(",
")",
"{",
"c",
".",
"bufKV",
".",
"value",
"=",
"AppendHTTPDate",
"(",
"c",
".",
"bufKV",
".",
"value",
"[",
":",
"0",
"]",
",",
"c",
".",
"expire",
")",
"\n",
"dst",
"=",
"append",
"(",
"dst",
",",
"';'",
",",
"' '",
")",
"\n",
"dst",
"=",
"append",
"(",
"dst",
",",
"strCookieExpires",
"...",
")",
"\n",
"dst",
"=",
"append",
"(",
"dst",
",",
"'='",
")",
"\n",
"dst",
"=",
"append",
"(",
"dst",
",",
"c",
".",
"bufKV",
".",
"value",
"...",
")",
"\n",
"}",
"\n",
"if",
"len",
"(",
"c",
".",
"domain",
")",
">",
"0",
"{",
"dst",
"=",
"appendCookiePart",
"(",
"dst",
",",
"strCookieDomain",
",",
"c",
".",
"domain",
")",
"\n",
"}",
"\n",
"if",
"len",
"(",
"c",
".",
"path",
")",
">",
"0",
"{",
"dst",
"=",
"appendCookiePart",
"(",
"dst",
",",
"strCookiePath",
",",
"c",
".",
"path",
")",
"\n",
"}",
"\n",
"if",
"c",
".",
"httpOnly",
"{",
"dst",
"=",
"append",
"(",
"dst",
",",
"';'",
",",
"' '",
")",
"\n",
"dst",
"=",
"append",
"(",
"dst",
",",
"strCookieHTTPOnly",
"...",
")",
"\n",
"}",
"\n",
"if",
"c",
".",
"secure",
"{",
"dst",
"=",
"append",
"(",
"dst",
",",
"';'",
",",
"' '",
")",
"\n",
"dst",
"=",
"append",
"(",
"dst",
",",
"strCookieSecure",
"...",
")",
"\n",
"}",
"\n",
"switch",
"c",
".",
"sameSite",
"{",
"case",
"CookieSameSiteDefaultMode",
":",
"dst",
"=",
"append",
"(",
"dst",
",",
"';'",
",",
"' '",
")",
"\n",
"dst",
"=",
"append",
"(",
"dst",
",",
"strCookieSameSite",
"...",
")",
"\n",
"<mask>",
"CookieSameSiteLaxMode",
":",
"dst",
"=",
"append",
"(",
"dst",
",",
"';'",
",",
"' '",
")",
"\n",
"dst",
"=",
"append",
"(",
"dst",
",",
"strCookieSameSite",
"...",
")",
"\n",
"dst",
"=",
"append",
"(",
"dst",
",",
"'='",
")",
"\n",
"dst",
"=",
"append",
"(",
"dst",
",",
"strCookieSameSiteLax",
"...",
")",
"\n",
"case",
"CookieSameSiteStrictMode",
":",
"dst",
"=",
"append",
"(",
"dst",
",",
"';'",
",",
"' '",
")",
"\n",
"dst",
"=",
"append",
"(",
"dst",
",",
"strCookieSameSite",
"...",
")",
"\n",
"dst",
"=",
"append",
"(",
"dst",
",",
"'='",
")",
"\n",
"dst",
"=",
"append",
"(",
"dst",
",",
"strCookieSameSiteStrict",
"...",
")",
"\n",
"}",
"\n",
"return",
"dst",
"\n",
"}"
] |
1,528 | all-1529 | [
"-----------------------------------------------------------------------------",
"window",
":",
"track",
"bar",
"-----------------------------------------------------------------------------",
"/",
"*",
"create",
"trackbar",
"and",
"display",
"it",
"on",
"top",
"of",
"given",
"window",
"set",
"callback"
] | [
"func",
"(",
"win",
"*",
"Window",
")",
"CreateTrackbar",
"(",
"name",
"string",
",",
"value",
",",
"count",
"int",
",",
"on_changed",
"TrackbarFunc",
",",
"param",
"...",
"<mask>",
"{",
"}",
")",
"bool",
"{",
"bar_name",
":=",
"C",
".",
"CString",
"(",
"name",
")",
"\n\n",
"switch",
"f",
":=",
"on_changed",
".",
"(",
"type",
")",
"{",
"case",
"TrackbarFuncA",
":",
"win",
".",
"trackbarHandle",
"[",
"name",
"]",
"=",
"TrackbarFunc",
"(",
"f",
")",
"\n",
"case",
"TrackbarFuncB",
":",
"win",
".",
"trackbarHandle",
"[",
"name",
"]",
"=",
"TrackbarFunc",
"(",
"f",
")",
"\n",
"case",
"func",
"(",
"pos",
"int",
")",
":",
"win",
".",
"trackbarHandle",
"[",
"name",
"]",
"=",
"TrackbarFunc",
"(",
"f",
")",
"\n",
"case",
"func",
"(",
"pos",
"int",
",",
"param",
"...",
"interface",
"{",
"}",
")",
":",
"win",
".",
"trackbarHandle",
"[",
"name",
"]",
"=",
"TrackbarFunc",
"(",
"f",
")",
"\n",
"default",
":",
"panic",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"win",
".",
"trackbarVal",
"[",
"name",
"]",
"=",
"value",
"\n",
"win",
".",
"trackbarMax",
"[",
"name",
"]",
"=",
"count",
"\n",
"//win.trackbarHandle[name] = on_changed",
"win",
".",
"trackbarName",
"[",
"name",
"]",
"=",
"bar_name",
"\n\n",
"if",
"len",
"(",
"param",
")",
">",
"0",
"{",
"win",
".",
"trackbarParam",
"[",
"name",
"]",
"=",
"param",
"\n",
"}",
"else",
"{",
"win",
".",
"trackbarParam",
"[",
"name",
"]",
"=",
"nil",
"\n",
"}",
"\n\n",
"rv",
":=",
"C",
".",
"GoOpenCV_CreateTrackbar",
"(",
"bar_name",
",",
"win",
".",
"name_c",
",",
"C",
".",
"int",
"(",
"value",
")",
",",
"C",
".",
"int",
"(",
"count",
")",
")",
"\n",
"return",
"bool",
"(",
"rv",
"!=",
"0",
")",
"\n",
"}"
] |
1,529 | all-1530 | [
"call",
"sends",
"a",
"message",
"to",
"the",
"Pact",
"service"
] | [
"func",
"(",
"m",
"*",
"MockService",
")",
"call",
"(",
"method",
"string",
",",
"url",
"string",
",",
"content",
"interface",
"{",
"}",
")",
"error",
"{",
"body",
",",
"err",
":=",
"json",
".",
"Marshal",
"(",
"content",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"fmt",
".",
"Println",
"(",
"err",
")",
"\n",
"return",
"err",
"\n",
"}",
"\n\n",
"client",
":=",
"&",
"http",
".",
"Client",
"{",
"}",
"\n",
"var",
"req",
"*",
"http",
".",
"Request",
"\n",
"if",
"method",
"==",
"\"",
"\"",
"{",
"req",
",",
"err",
"=",
"http",
".",
"NewRequest",
"(",
"method",
",",
"url",
",",
"bytes",
".",
"NewReader",
"(",
"body",
")",
")",
"\n",
"}",
"else",
"{",
"req",
",",
"err",
"=",
"http",
".",
"NewRequest",
"(",
"method",
",",
"url",
",",
"nil",
")",
"\n",
"}",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"req",
".",
"Header",
".",
"<mask>",
"(",
"\"",
"\"",
",",
"\"",
"\"",
")",
"\n",
"req",
".",
"Header",
".",
"Set",
"(",
"\"",
"\"",
",",
"\"",
"\"",
")",
"\n\n",
"res",
",",
"err",
":=",
"client",
".",
"Do",
"(",
"req",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"responseBody",
",",
"err",
":=",
"ioutil",
".",
"ReadAll",
"(",
"res",
".",
"Body",
")",
"\n",
"res",
".",
"Body",
".",
"Close",
"(",
")",
"\n",
"if",
"res",
".",
"StatusCode",
"<",
"200",
"||",
"res",
".",
"StatusCode",
">=",
"300",
"{",
"return",
"errors",
".",
"New",
"(",
"string",
"(",
"responseBody",
")",
")",
"\n",
"}",
"\n",
"return",
"err",
"\n",
"}"
] |
1,530 | all-1531 | [
"roleAddCommandFunc",
"executes",
"the",
"role",
"add",
"command",
"."
] | [
"func",
"roleAddCommandFunc",
"(",
"cmd",
"*",
"cobra",
".",
"Command",
",",
"args",
"[",
"]",
"string",
")",
"{",
"if",
"len",
"(",
"args",
")",
"!=",
"1",
"{",
"ExitWithError",
"(",
"ExitBadArgs",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
")",
")",
"\n",
"}",
"\n\n",
"resp",
",",
"err",
":=",
"mustClientFromCmd",
"(",
"cmd",
")",
".",
"Auth",
".",
"RoleAdd",
"(",
"<mask>",
".",
"TODO",
"(",
")",
",",
"args",
"[",
"0",
"]",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"ExitWithError",
"(",
"ExitError",
",",
"err",
")",
"\n",
"}",
"\n\n",
"display",
".",
"RoleAdd",
"(",
"args",
"[",
"0",
"]",
",",
"*",
"resp",
")",
"\n",
"}"
] |
1,531 | all-1532 | [
"Warn",
"outputs",
"Warn",
"level",
"log"
] | [
"func",
"(",
"g",
"*",
"Glg",
")",
"Warn",
"(",
"val",
"...",
"interface",
"{",
"}",
")",
"error",
"{",
"return",
"g",
".",
"<mask>",
"(",
"WARN",
",",
"blankFormat",
"(",
"len",
"(",
"val",
")",
")",
",",
"val",
"...",
")",
"\n",
"}"
] |
1,532 | all-1533 | [
"CancelTarget",
"attempts",
"to",
"cancel",
"the",
"target",
"operation"
] | [
"func",
"(",
"op",
"*",
"remoteOperation",
")",
"CancelTarget",
"(",
")",
"<mask>",
"{",
"if",
"op",
".",
"targetOp",
"==",
"nil",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"return",
"op",
".",
"targetOp",
".",
"Cancel",
"(",
")",
"\n",
"}"
] |
1,533 | all-1534 | [
"WithTx",
"inserts",
"a",
"newrelic",
".",
"Tx",
"into",
"the",
"provided",
"context",
"."
] | [
"func",
"WithTx",
"(",
"ctx",
"context",
".",
"Context",
",",
"t",
"Tx",
")",
"context",
".",
"Context",
"{",
"return",
"<mask>",
".",
"WithValue",
"(",
"ctx",
",",
"txKey",
",",
"t",
")",
"\n",
"}"
] |
1,534 | all-1535 | [
"SetScale",
"()",
"is",
"a",
"wrapper",
"around",
"gtk_print_settings_set_scale",
"()",
"."
] | [
"func",
"(",
"ps",
"*",
"PrintSettings",
")",
"SetScale",
"(",
"scale",
"float64",
")",
"{",
"C",
".",
"gtk_print_settings_set_scale",
"(",
"ps",
".",
"native",
"(",
")",
",",
"C",
".",
"gdouble",
"(",
"<mask>",
")",
")",
"\n",
"}"
] |
1,535 | all-1536 | [
"WriteMessage",
"adds",
"text",
"to",
"channel"
] | [
"func",
"(",
"sl",
"*",
"<mask>",
")",
"WriteMessage",
"(",
"text",
",",
"channel",
"string",
")",
"error",
"{",
"sl",
".",
"log",
"(",
"\"",
"\"",
",",
"text",
",",
"channel",
")",
"\n",
"if",
"sl",
".",
"fake",
"{",
"return",
"nil",
"\n",
"}",
"\n\n",
"var",
"uv",
"=",
"sl",
".",
"urlValues",
"(",
")",
"\n",
"uv",
".",
"Add",
"(",
"\"",
"\"",
",",
"channel",
")",
"\n",
"uv",
".",
"Add",
"(",
"\"",
"\"",
",",
"text",
")",
"\n\n",
"_",
",",
"err",
":=",
"sl",
".",
"postMessage",
"(",
"chatPostMessage",
",",
"uv",
")",
"\n",
"return",
"err",
"\n",
"}"
] |
1,536 | all-1537 | [
"Identify",
"identifies",
"a",
"customer",
"and",
"sets",
"their",
"attributes"
] | [
"func",
"(",
"c",
"*",
"CustomerIO",
")",
"Identify",
"(",
"customerID",
"string",
",",
"attributes",
"map",
"[",
"string",
"]",
"interface",
"{",
"}",
")",
"error",
"{",
"j",
",",
"err",
":=",
"json",
".",
"Marshal",
"(",
"attributes",
")",
"\n\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"<mask>",
",",
"responseBody",
",",
"err",
":=",
"c",
".",
"request",
"(",
"\"",
"\"",
",",
"c",
".",
"customerURL",
"(",
"customerID",
")",
",",
"j",
")",
"\n\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"else",
"if",
"status",
"!=",
"200",
"{",
"return",
"&",
"CustomerIOError",
"{",
"status",
",",
"c",
".",
"customerURL",
"(",
"customerID",
")",
",",
"responseBody",
"}",
"\n",
"}",
"\n\n",
"return",
"nil",
"\n",
"}"
] |
1,537 | all-1538 | [
"Do",
"executes",
"Accessibility",
".",
"getPartialAXTree",
"against",
"the",
"provided",
"context",
".",
"returns",
":",
"nodes",
"-",
"The",
"Accessibility",
".",
"AXNode",
"for",
"this",
"DOM",
"node",
"if",
"it",
"exists",
"plus",
"its",
"ancestors",
"siblings",
"and",
"children",
"if",
"requested",
"."
] | [
"func",
"(",
"p",
"*",
"GetPartialAXTreeParams",
")",
"Do",
"(",
"ctx",
"context",
".",
"Context",
")",
"(",
"nodes",
"[",
"]",
"*",
"Node",
",",
"err",
"error",
")",
"{",
"// execute",
"var",
"res",
"GetPartialAXTreeReturns",
"\n",
"err",
"=",
"cdp",
".",
"Execute",
"(",
"ctx",
",",
"CommandGetPartialAXTree",
",",
"p",
",",
"&",
"res",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"return",
"<mask>",
".",
"Nodes",
",",
"nil",
"\n",
"}"
] |
1,538 | all-1539 | [
"helper",
"to",
"update",
"disk",
"metrics",
"(",
"copied",
"from",
"greenhouse",
")"
] | [
"func",
"diskMonitor",
"(",
"interval",
"time",
".",
"Duration",
",",
"diskRoot",
"string",
")",
"{",
"logger",
":=",
"logrus",
".",
"WithField",
"(",
"\"",
"\"",
",",
"\"",
"\"",
")",
"\n",
"ticker",
":=",
"<mask>",
".",
"NewTicker",
"(",
"interval",
")",
"\n",
"for",
";",
"true",
";",
"<-",
"ticker",
".",
"C",
"{",
"logger",
".",
"Info",
"(",
"\"",
"\"",
")",
"\n",
"_",
",",
"bytesFree",
",",
"bytesUsed",
",",
"err",
":=",
"diskutil",
".",
"GetDiskUsage",
"(",
"diskRoot",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"logger",
".",
"WithError",
"(",
"err",
")",
".",
"Error",
"(",
"\"",
"\"",
")",
"\n",
"}",
"else",
"{",
"diskFree",
".",
"Set",
"(",
"float64",
"(",
"bytesFree",
")",
"/",
"1e9",
")",
"\n",
"diskUsed",
".",
"Set",
"(",
"float64",
"(",
"bytesUsed",
")",
"/",
"1e9",
")",
"\n",
"diskTotal",
".",
"Set",
"(",
"float64",
"(",
"bytesFree",
"+",
"bytesUsed",
")",
"/",
"1e9",
")",
"\n",
"}",
"\n",
"}",
"\n",
"}"
] |
1,539 | all-1540 | [
"ListSecretsRequest",
"mocks",
"base",
"method"
] | [
"func",
"(",
"m",
"*",
"MockSecretsManagerAPI",
")",
"ListSecretsRequest",
"(",
"arg0",
"*",
"secretsmanager",
".",
"ListSecretsInput",
")",
"(",
"*",
"request",
".",
"Request",
",",
"*",
"secretsmanager",
".",
"ListSecretsOutput",
")",
"{",
"ret",
":=",
"m",
".",
"ctrl",
".",
"Call",
"(",
"m",
",",
"\"",
"\"",
",",
"arg0",
")",
"\n",
"ret0",
",",
"_",
":=",
"ret",
"[",
"0",
"]",
".",
"(",
"*",
"<mask>",
".",
"Request",
")",
"\n",
"ret1",
",",
"_",
":=",
"ret",
"[",
"1",
"]",
".",
"(",
"*",
"secretsmanager",
".",
"ListSecretsOutput",
")",
"\n",
"return",
"ret0",
",",
"ret1",
"\n",
"}"
] |
1,540 | all-1541 | [
"SetTitle",
"sets",
"a",
"title",
"for",
"the",
"audio",
"file",
"(",
"optional",
")",
"."
] | [
"func",
"(",
"oa",
"*",
"OutgoingAudio",
")",
"SetTitle",
"(",
"to",
"<mask>",
")",
"*",
"OutgoingAudio",
"{",
"oa",
".",
"Title",
"=",
"to",
"\n",
"return",
"oa",
"\n",
"}"
] |
1,541 | all-1542 | [
"Config",
"returns",
"the",
"latest",
"config",
".",
"Do",
"not",
"modify",
"the",
"config",
"."
] | [
"func",
"(",
"ca",
"*",
"Agent",
")",
"Config",
"(",
")",
"*",
"Config",
"{",
"ca",
".",
"mut",
".",
"RLock",
"(",
")",
"\n",
"defer",
"<mask>",
".",
"mut",
".",
"RUnlock",
"(",
")",
"\n",
"return",
"ca",
".",
"c",
"\n",
"}"
] |
1,542 | all-1543 | [
"Fingerprint",
"calculates",
"the",
"fingerprint",
"of",
"the",
"public",
"key"
] | [
"func",
"(",
"kp",
"*",
"KeyPair",
")",
"Fingerprint",
"(",
")",
"string",
"{",
"b",
",",
"_",
":=",
"base64",
".",
"StdEncoding",
".",
"DecodeString",
"(",
"string",
"(",
"kp",
".",
"PublicKey",
")",
")",
"\n",
"h",
":=",
"md5",
".",
"New",
"(",
")",
"\n\n",
"<mask>",
".",
"WriteString",
"(",
"h",
",",
"string",
"(",
"b",
")",
")",
"\n\n",
"return",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"h",
".",
"Sum",
"(",
"nil",
")",
")",
"\n",
"}"
] |
1,543 | all-1544 | [
"options",
"returns",
"the",
"demangling",
"options",
"to",
"use",
"based",
"on",
"the",
"command",
"line",
"flags",
"."
] | [
"func",
"options",
"(",
")",
"[",
"]",
"demangle",
".",
"Option",
"{",
"var",
"options",
"[",
"]",
"demangle",
".",
"Option",
"\n",
"if",
"*",
"noParams",
"{",
"options",
"=",
"append",
"(",
"options",
",",
"demangle",
".",
"NoParams",
")",
"\n",
"}",
"\n",
"if",
"!",
"*",
"noVerbose",
"{",
"options",
"=",
"append",
"(",
"<mask>",
",",
"demangle",
".",
"Verbose",
")",
"\n",
"}",
"\n",
"return",
"options",
"\n",
"}"
] |
1,544 | all-1545 | [
"MarshalJSON",
"supports",
"json",
".",
"Marshaler",
"interface"
] | [
"func",
"(",
"v",
"GetWindowForTargetParams",
")",
"MarshalJSON",
"(",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"w",
":=",
"jwriter",
".",
"Writer",
"{",
"}",
"\n",
"easyjsonC5a4559bEncodeGithubComChromedpCdprotoBrowser6",
"(",
"&",
"w",
",",
"v",
")",
"\n",
"return",
"w",
".",
"<mask>",
".",
"BuildBytes",
"(",
")",
",",
"w",
".",
"Error",
"\n",
"}"
] |
1,545 | all-1546 | [
"verifyContainerMetadata",
"verifies",
"the",
"container",
"name",
"of",
"the",
"container",
"metadata",
"and",
"each",
"necessary",
"field",
"is",
"not",
"empty",
"."
] | [
"func",
"verifyContainerMetadata",
"(",
"containerMetadataRawMsg",
"json",
".",
"RawMessage",
")",
"error",
"{",
"containerMetadataMap",
":=",
"make",
"(",
"<mask>",
"[",
"string",
"]",
"json",
".",
"RawMessage",
")",
"\n",
"json",
".",
"Unmarshal",
"(",
"containerMetadataRawMsg",
",",
"&",
"containerMetadataMap",
")",
"\n\n",
"if",
"containerMetadataMap",
"[",
"\"",
"\"",
"]",
"==",
"nil",
"{",
"return",
"notEmptyErrMsg",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"var",
"actualContainerName",
"string",
"\n",
"json",
".",
"Unmarshal",
"(",
"containerMetadataMap",
"[",
"\"",
"\"",
"]",
",",
"&",
"actualContainerName",
")",
"\n\n",
"if",
"actualContainerName",
"!=",
"containerName",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"containerName",
",",
"actualContainerName",
")",
"\n",
"}",
"\n\n",
"if",
"containerMetadataMap",
"[",
"\"",
"\"",
"]",
"==",
"nil",
"{",
"return",
"notEmptyErrMsg",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"if",
"containerMetadataMap",
"[",
"\"",
"\"",
"]",
"==",
"nil",
"{",
"return",
"notEmptyErrMsg",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"if",
"containerMetadataMap",
"[",
"\"",
"\"",
"]",
"==",
"nil",
"{",
"return",
"notEmptyErrMsg",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"return",
"nil",
"\n",
"}"
] |
1,546 | all-1547 | [
"FetchProvisionBroker",
"retrieves",
"provision",
"broker",
"[",
"request",
"]",
"with",
"passed",
"cid",
"."
] | [
"func",
"(",
"a",
"*",
"API",
")",
"FetchProvisionBroker",
"(",
"cid",
"CIDType",
")",
"(",
"*",
"ProvisionBroker",
",",
"error",
")",
"{",
"if",
"cid",
"==",
"nil",
"||",
"*",
"cid",
"==",
"\"",
"\"",
"{",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"brokerCID",
":=",
"string",
"(",
"*",
"cid",
")",
"\n\n",
"matched",
",",
"err",
":=",
"regexp",
".",
"MatchString",
"(",
"config",
".",
"ProvisionBrokerCIDRegex",
",",
"brokerCID",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"if",
"!",
"<mask>",
"{",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"brokerCID",
")",
"\n",
"}",
"\n\n",
"result",
",",
"err",
":=",
"a",
".",
"Get",
"(",
"brokerCID",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"if",
"a",
".",
"Debug",
"{",
"a",
".",
"Log",
".",
"Printf",
"(",
"\"",
"\"",
",",
"string",
"(",
"result",
")",
")",
"\n",
"}",
"\n\n",
"broker",
":=",
"&",
"ProvisionBroker",
"{",
"}",
"\n",
"if",
"err",
":=",
"json",
".",
"Unmarshal",
"(",
"result",
",",
"broker",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"return",
"broker",
",",
"nil",
"\n",
"}"
] |
1,547 | all-1548 | [
"ValueSize",
"returns",
"the",
"exact",
"size",
"of",
"the",
"value",
".",
"This",
"can",
"be",
"called",
"to",
"quickly",
"estimate",
"the",
"size",
"of",
"a",
"value",
"without",
"fetching",
"it",
"."
] | [
"func",
"(",
"item",
"*",
"Item",
")",
"ValueSize",
"(",
")",
"int64",
"{",
"if",
"!",
"item",
".",
"hasValue",
"(",
")",
"{",
"return",
"0",
"\n",
"}",
"\n",
"if",
"(",
"item",
".",
"meta",
"&",
"bitValuePointer",
")",
"==",
"0",
"{",
"return",
"int64",
"(",
"len",
"(",
"item",
".",
"vptr",
")",
")",
"\n",
"}",
"\n",
"var",
"vp",
"valuePointer",
"\n",
"vp",
".",
"Decode",
"(",
"item",
".",
"vptr",
")",
"\n\n",
"klen",
":=",
"int64",
"(",
"len",
"(",
"<mask>",
".",
"key",
")",
"+",
"8",
")",
"// 8 bytes for timestamp.",
"\n",
"return",
"int64",
"(",
"vp",
".",
"Len",
")",
"-",
"klen",
"-",
"headerBufSize",
"-",
"crc32",
".",
"Size",
"\n",
"}"
] |
1,548 | all-1549 | [
"GetDescription",
"returns",
"the",
"Description",
"field",
"if",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"."
] | [
"func",
"(",
"m",
"*",
"MetricMetadata",
")",
"GetDescription",
"(",
")",
"string",
"{",
"if",
"m",
"==",
"nil",
"||",
"m",
".",
"Description",
"==",
"nil",
"{",
"return",
"\"",
"\"",
"\n",
"}",
"\n",
"return",
"*",
"m",
".",
"<mask>",
"\n",
"}"
] |
1,549 | all-1550 | [
"stats",
"returns",
"a",
"histogram",
"of",
"the",
"number",
"of",
"each",
"type",
"of",
"edit",
"operation",
"."
] | [
"func",
"(",
"es",
"EditScript",
")",
"stats",
"(",
")",
"(",
"s",
"struct",
"{",
"NI",
",",
"NX",
",",
"NY",
",",
"NM",
"int",
"}",
")",
"{",
"for",
"_",
",",
"e",
":=",
"range",
"es",
"{",
"switch",
"e",
"{",
"case",
"Identity",
":",
"s",
".",
"NI",
"++",
"\n",
"case",
"UniqueX",
":",
"s",
".",
"NX",
"++",
"\n",
"case",
"UniqueY",
":",
"s",
".",
"NY",
"++",
"\n",
"<mask>",
"Modified",
":",
"s",
".",
"NM",
"++",
"\n",
"default",
":",
"panic",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"\n",
"}"
] |
1,550 | all-1551 | [
"Flush",
"flushes",
"any",
"pending",
"compressed",
"data",
"to",
"the",
"underlying",
"writer",
".",
"Flush",
"does",
"not",
"return",
"until",
"the",
"data",
"has",
"been",
"written",
".",
"If",
"the",
"underlying",
"writer",
"returns",
"an",
"error",
"Flush",
"returns",
"that",
"error",
"."
] | [
"func",
"(",
"z",
"*",
"Writer",
")",
"Flush",
"(",
")",
"error",
"{",
"if",
"debugFlag",
"{",
"debug",
"(",
"\"",
"\"",
",",
"z",
".",
"idx",
")",
"\n",
"}",
"\n",
"if",
"z",
".",
"idx",
"==",
"0",
"{",
"return",
"nil",
"\n",
"}",
"\n\n",
"if",
"err",
":=",
"z",
".",
"compressBlock",
"(",
"z",
".",
"<mask>",
"[",
":",
"z",
".",
"idx",
"]",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"z",
".",
"idx",
"=",
"0",
"\n",
"return",
"nil",
"\n",
"}"
] |
1,551 | all-1552 | [
"Recover",
"recovers",
"form",
"panics",
".",
"It",
"logs",
"the",
"stack",
"and",
"uses",
"the",
"PanicHandler",
"(",
"or",
"a",
"classic",
"Internal",
"Server",
"Error",
")",
"to",
"write",
"the",
"response",
".",
"Usage",
":",
"defer",
"c",
".",
"Recover",
"()"
] | [
"func",
"(",
"ctx",
"*",
"Context",
")",
"Recover",
"(",
")",
"{",
"if",
"err",
":=",
"recover",
"(",
")",
";",
"err",
"!=",
"nil",
"{",
"if",
"e",
",",
"ok",
":=",
"err",
".",
"(",
"*",
"ValidationError",
")",
";",
"ok",
"==",
"true",
"{",
"ctx",
".",
"Fail",
"(",
"e",
")",
"\n",
"return",
"\n",
"}",
"\n\n",
"stack",
":=",
"make",
"(",
"[",
"]",
"byte",
",",
"64",
"<<",
"10",
")",
"\n",
"n",
":=",
"runtime",
".",
"Stack",
"(",
"stack",
"[",
":",
"]",
",",
"<mask>",
")",
"\n",
"log",
".",
"WithFields",
"(",
"log",
".",
"Fields",
"{",
"\"",
"\"",
":",
"ctx",
".",
"Request",
".",
"URL",
".",
"Path",
"}",
")",
".",
"Errorln",
"(",
"string",
"(",
"stack",
"[",
":",
"n",
"]",
")",
")",
"\n",
"if",
"!",
"ctx",
".",
"Written",
"(",
")",
"{",
"ctx",
".",
"ResponseWriter",
".",
"Header",
"(",
")",
".",
"Del",
"(",
"\"",
"\"",
")",
"\n\n",
"if",
"ctx",
".",
"handlersStack",
".",
"PanicHandler",
"!=",
"nil",
"{",
"ctx",
".",
"Data",
"[",
"\"",
"\"",
"]",
"=",
"err",
"\n",
"ctx",
".",
"handlersStack",
".",
"PanicHandler",
"(",
"ctx",
")",
"\n",
"}",
"else",
"{",
"ctx",
".",
"Fail",
"(",
"(",
"&",
"ServerError",
"{",
"}",
")",
".",
"New",
"(",
"http",
".",
"StatusText",
"(",
"http",
".",
"StatusInternalServerError",
")",
")",
")",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n",
"}"
] |
1,552 | all-1553 | [
"isDelimiter",
"returns",
"true",
"for",
"--",
"BOUNDARY",
"\\",
"r",
"\\",
"n",
"but",
"not",
"--",
"BOUNDARY",
"--"
] | [
"func",
"(",
"b",
"*",
"boundaryReader",
")",
"isDelimiter",
"(",
"buf",
"[",
"]",
"byte",
")",
"bool",
"{",
"idx",
":=",
"bytes",
".",
"Index",
"(",
"buf",
",",
"b",
".",
"prefix",
")",
"\n",
"if",
"idx",
"==",
"-",
"1",
"{",
"return",
"false",
"\n",
"}",
"\n\n",
"// Fast forward to the end of the boundary prefix",
"buf",
"=",
"buf",
"[",
"idx",
"+",
"len",
"(",
"b",
".",
"prefix",
")",
":",
"]",
"\n",
"buf",
"=",
"bytes",
".",
"TrimLeft",
"(",
"buf",
",",
"\"",
"\\t",
"\"",
")",
"\n",
"if",
"len",
"(",
"buf",
")",
">",
"0",
"{",
"if",
"buf",
"[",
"0",
"]",
"==",
"'\\r'",
"||",
"buf",
"[",
"0",
"]",
"==",
"'\\n'",
"{",
"return",
"<mask>",
"\n",
"}",
"\n",
"}",
"\n\n",
"return",
"false",
"\n",
"}"
] |
1,553 | all-1554 | [
"DeepCopy",
"copies",
"the",
"receiver",
"into",
"a",
"new",
"Password",
"."
] | [
"func",
"(",
"r",
"*",
"Password",
")",
"DeepCopy",
"(",
")",
"*",
"Password",
"{",
"if",
"r",
"==",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n",
"out",
":=",
"new",
"(",
"Password",
")",
"\n",
"r",
".",
"DeepCopyInto",
"(",
"out",
")",
"\n",
"return",
"<mask>",
"\n",
"}"
] |
1,554 | all-1555 | [
"lintOnionURL",
"verifies",
"that",
"an",
"Onion",
"URI",
"value",
"from",
"a",
"TorServiceDescriptorHash",
"is",
":",
"1",
")",
"a",
"valid",
"parseable",
"url",
".",
"2",
")",
"a",
"URL",
"with",
"a",
"non",
"-",
"empty",
"hostname",
"3",
")",
"a",
"URL",
"with",
"an",
"https",
":",
"//",
"protocol",
"scheme",
"If",
"all",
"of",
"the",
"above",
"hold",
"then",
"nil",
"is",
"returned",
".",
"If",
"any",
"of",
"the",
"above",
"conditions",
"are",
"not",
"met",
"an",
"error",
"lint",
"result",
"pointer",
"is",
"returned",
"."
] | [
"func",
"lintOnionURL",
"(",
"onion",
"string",
")",
"*",
"LintResult",
"{",
"if",
"onionURL",
",",
"err",
":=",
"<mask>",
".",
"Parse",
"(",
"onion",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"failResult",
"(",
"\"",
"\"",
"+",
"\"",
"\"",
",",
"torServiceDescExtName",
")",
"\n",
"}",
"else",
"if",
"onionURL",
".",
"Host",
"==",
"\"",
"\"",
"{",
"return",
"failResult",
"(",
"\"",
"\"",
"+",
"\"",
"\"",
",",
"torServiceDescExtName",
")",
"\n",
"}",
"else",
"if",
"onionURL",
".",
"Scheme",
"!=",
"\"",
"\"",
"{",
"return",
"failResult",
"(",
"\"",
"\"",
"+",
"\"",
"\"",
"+",
"\"",
"\"",
",",
"torServiceDescExtName",
")",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
] |
1,555 | all-1556 | [
"set",
"sets",
"the",
"value",
"of",
"the",
"severity",
"."
] | [
"func",
"(",
"s",
"*",
"Severity",
")",
"<mask>",
"(",
"val",
"Severity",
")",
"{",
"atomic",
".",
"StoreInt32",
"(",
"(",
"*",
"int32",
")",
"(",
"s",
")",
",",
"int32",
"(",
"val",
")",
")",
"\n",
"}"
] |
1,556 | all-1557 | [
"Locator",
"returns",
"a",
"locator",
"for",
"the",
"given",
"resource"
] | [
"func",
"(",
"r",
"*",
"<mask>",
")",
"Locator",
"(",
"api",
"*",
"API",
")",
"*",
"ApplicationLocator",
"{",
"return",
"api",
".",
"ApplicationLocator",
"(",
"r",
".",
"Href",
")",
"\n",
"}"
] |
1,557 | all-1558 | [
"ReceiveComment",
"is",
"a",
"wrapper",
"on",
"plugin",
".",
"ReceiveComment",
"()",
"logging",
"the",
"author"
] | [
"func",
"(",
"a",
"*",
"AuthorLoggerPluginWrapper",
")",
"ReceiveComment",
"(",
"comment",
"sql",
".",
"Comment",
")",
"[",
"]",
"Point",
"{",
"points",
":=",
"a",
".",
"plugin",
".",
"ReceiveComment",
"(",
"comment",
")",
"\n\n",
"if",
"a",
".",
"enabled",
"{",
"for",
"i",
":=",
"range",
"points",
"{",
"if",
"points",
"[",
"i",
"]",
".",
"Values",
"==",
"nil",
"{",
"points",
"[",
"i",
"]",
".",
"Values",
"=",
"map",
"[",
"string",
"]",
"interface",
"{",
"}",
"{",
"}",
"\n",
"}",
"\n",
"points",
"[",
"i",
"]",
".",
"Values",
"[",
"\"",
"\"",
"]",
"=",
"comment",
".",
"<mask>",
"\n",
"}",
"\n",
"}",
"\n\n",
"return",
"points",
"\n",
"}"
] |
1,558 | all-1559 | [
"GetAccountIDOk",
"returns",
"a",
"tuple",
"with",
"the",
"AccountID",
"field",
"if",
"it",
"s",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"and",
"a",
"boolean",
"to",
"check",
"if",
"the",
"value",
"has",
"been",
"set",
"."
] | [
"func",
"(",
"i",
"*",
"IntegrationAWSAccountDeleteRequest",
")",
"GetAccountIDOk",
"(",
")",
"(",
"string",
",",
"bool",
")",
"{",
"if",
"i",
"==",
"nil",
"||",
"i",
".",
"AccountID",
"==",
"nil",
"{",
"return",
"\"",
"\"",
",",
"false",
"\n",
"}",
"\n",
"return",
"*",
"i",
".",
"AccountID",
",",
"<mask>",
"\n",
"}"
] |
1,559 | all-1560 | [
"Metric",
"writes",
"the",
"labels",
"of",
"the",
"current",
"sample",
"into",
"the",
"passed",
"labels",
".",
"It",
"returns",
"the",
"string",
"from",
"which",
"the",
"metric",
"was",
"parsed",
"."
] | [
"func",
"(",
"p",
"*",
"OpenMetricsParser",
")",
"Metric",
"(",
"l",
"*",
"labels",
".",
"Labels",
")",
"string",
"{",
"// Allocate the full immutable string immediately, so we just",
"// have to create references on it below.",
"s",
":=",
"string",
"(",
"p",
".",
"series",
")",
"\n\n",
"*",
"l",
"=",
"append",
"(",
"*",
"l",
",",
"labels",
".",
"Label",
"{",
"Name",
":",
"labels",
".",
"MetricName",
",",
"Value",
":",
"s",
"[",
":",
"p",
".",
"offsets",
"[",
"0",
"]",
"-",
"p",
".",
"start",
"]",
",",
"}",
")",
"\n\n",
"for",
"i",
":=",
"1",
";",
"i",
"<",
"len",
"(",
"p",
".",
"offsets",
")",
";",
"i",
"+=",
"4",
"{",
"a",
":=",
"p",
".",
"offsets",
"[",
"i",
"]",
"-",
"p",
".",
"start",
"\n",
"b",
":=",
"p",
".",
"offsets",
"[",
"i",
"+",
"1",
"]",
"-",
"p",
".",
"start",
"\n",
"c",
":=",
"p",
".",
"offsets",
"[",
"i",
"+",
"2",
"]",
"-",
"p",
".",
"start",
"\n",
"d",
":=",
"p",
".",
"offsets",
"[",
"i",
"+",
"3",
"]",
"-",
"p",
".",
"start",
"\n\n",
"// Replacer causes allocations. Replace only when necessary.",
"if",
"strings",
".",
"IndexByte",
"(",
"s",
"[",
"c",
":",
"d",
"]",
",",
"byte",
"(",
"'\\\\'",
")",
")",
">=",
"0",
"{",
"*",
"l",
"=",
"append",
"(",
"*",
"l",
",",
"labels",
".",
"Label",
"{",
"Name",
":",
"s",
"[",
"a",
":",
"b",
"]",
",",
"Value",
":",
"lvalReplacer",
".",
"Replace",
"(",
"s",
"[",
"c",
":",
"d",
"]",
")",
"}",
")",
"\n",
"continue",
"\n",
"}",
"\n",
"*",
"l",
"=",
"append",
"(",
"*",
"l",
",",
"labels",
".",
"<mask>",
"{",
"Name",
":",
"s",
"[",
"a",
":",
"b",
"]",
",",
"Value",
":",
"s",
"[",
"c",
":",
"d",
"]",
"}",
")",
"\n",
"}",
"\n\n",
"// Sort labels. We can skip the first entry since the metric name is",
"// already at the right place.",
"sort",
".",
"Sort",
"(",
"(",
"*",
"l",
")",
"[",
"1",
":",
"]",
")",
"\n\n",
"return",
"s",
"\n",
"}"
] |
1,560 | all-1561 | [
"SetTransientFor",
"is",
"a",
"wrapper",
"around",
"gtk_window_set_transient_for",
"()",
"."
] | [
"func",
"(",
"v",
"*",
"Window",
")",
"SetTransientFor",
"(",
"parent",
"IWindow",
")",
"{",
"<mask>",
"pw",
"*",
"C",
".",
"GtkWindow",
"=",
"nil",
"\n",
"if",
"parent",
"!=",
"nil",
"{",
"pw",
"=",
"parent",
".",
"toWindow",
"(",
")",
"\n",
"}",
"\n",
"C",
".",
"gtk_window_set_transient_for",
"(",
"v",
".",
"native",
"(",
")",
",",
"pw",
")",
"\n",
"}"
] |
1,561 | all-1562 | [
"rPrint",
"recursively",
"prints",
"out",
"the",
"nodes",
"in",
"the",
"node",
"structure",
"."
] | [
"func",
"rPrint",
"(",
"c",
"*",
"cli",
".",
"Context",
",",
"n",
"*",
"client",
".",
"Node",
")",
"{",
"if",
"n",
".",
"Dir",
"&&",
"c",
".",
"Bool",
"(",
"\"",
"\"",
")",
"{",
"fmt",
".",
"Println",
"(",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"n",
".",
"Key",
")",
")",
"\n",
"}",
"else",
"{",
"fmt",
".",
"Println",
"(",
"n",
".",
"<mask>",
")",
"\n",
"}",
"\n\n",
"for",
"_",
",",
"node",
":=",
"range",
"n",
".",
"Nodes",
"{",
"rPrint",
"(",
"c",
",",
"node",
")",
"\n",
"}",
"\n",
"}"
] |
1,562 | all-1563 | [
"IsDirWriteable",
"checks",
"if",
"dir",
"is",
"writable",
"by",
"writing",
"and",
"removing",
"a",
"file",
"to",
"dir",
".",
"It",
"returns",
"nil",
"if",
"dir",
"is",
"writable",
"."
] | [
"func",
"IsDirWriteable",
"(",
"dir",
"string",
")",
"error",
"{",
"f",
":=",
"filepath",
".",
"Join",
"(",
"dir",
",",
"\"",
"\"",
")",
"\n",
"if",
"err",
":=",
"ioutil",
".",
"WriteFile",
"(",
"f",
",",
"[",
"]",
"<mask>",
"(",
"\"",
"\"",
")",
",",
"PrivateFileMode",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"return",
"os",
".",
"Remove",
"(",
"f",
")",
"\n",
"}"
] |
1,563 | all-1564 | [
"GetSignaturesWithAcceptedAuthor",
"returns",
"those",
"signatures",
"from",
"an",
"image",
"for",
"which",
"the",
"policy",
"accepts",
"the",
"author",
"(",
"and",
"which",
"have",
"been",
"successfully",
"verified",
")",
".",
"NOTE",
":",
"This",
"may",
"legitimately",
"return",
"an",
"empty",
"list",
"and",
"no",
"error",
"if",
"the",
"image",
"has",
"no",
"signatures",
"or",
"only",
"invalid",
"signatures",
".",
"WARNING",
":",
"This",
"makes",
"the",
"signature",
"contents",
"acceptable",
"for",
"futher",
"processing",
"but",
"it",
"does",
"not",
"necessarily",
"mean",
"that",
"the",
"contents",
"of",
"the",
"signature",
"are",
"consistent",
"with",
"local",
"policy",
".",
"For",
"example",
":",
"-",
"Do",
"not",
"use",
"a",
"an",
"existence",
"of",
"an",
"accepted",
"signature",
"to",
"determine",
"whether",
"to",
"run",
"a",
"container",
"based",
"on",
"this",
"image",
";",
"use",
"IsRunningImageAllowed",
"instead",
".",
"-",
"Just",
"because",
"a",
"signature",
"is",
"accepted",
"does",
"not",
"automatically",
"mean",
"the",
"contents",
"of",
"the",
"signature",
"are",
"authorized",
"to",
"run",
"code",
"as",
"root",
"or",
"to",
"affect",
"system",
"or",
"cluster",
"configuration",
"."
] | [
"func",
"(",
"pc",
"*",
"PolicyContext",
")",
"GetSignaturesWithAcceptedAuthor",
"(",
"ctx",
"context",
".",
"Context",
",",
"image",
"types",
".",
"UnparsedImage",
")",
"(",
"sigs",
"[",
"]",
"*",
"Signature",
",",
"finalErr",
"error",
")",
"{",
"if",
"err",
":=",
"pc",
".",
"changeState",
"(",
"pcReady",
",",
"pcInUse",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"defer",
"func",
"(",
")",
"{",
"if",
"err",
":=",
"pc",
".",
"changeState",
"(",
"pcInUse",
",",
"pcReady",
")",
";",
"err",
"!=",
"nil",
"{",
"sigs",
"=",
"nil",
"\n",
"finalErr",
"=",
"err",
"\n",
"}",
"\n",
"}",
"(",
")",
"\n\n",
"logrus",
".",
"Debugf",
"(",
"\"",
"\"",
",",
"policyIdentityLogName",
"(",
"image",
".",
"Reference",
"(",
")",
")",
")",
"\n",
"reqs",
":=",
"pc",
".",
"requirementsForImageRef",
"(",
"image",
".",
"Reference",
"(",
")",
")",
"\n\n",
"// FIXME: rename Signatures to UnverifiedSignatures",
"// FIXME: pass context.Context",
"unverifiedSignatures",
",",
"err",
":=",
"image",
".",
"Signatures",
"(",
"ctx",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"res",
":=",
"make",
"(",
"[",
"]",
"*",
"Signature",
",",
"0",
",",
"len",
"(",
"unverifiedSignatures",
")",
")",
"\n",
"for",
"sigNumber",
",",
"sig",
":=",
"range",
"unverifiedSignatures",
"{",
"var",
"acceptedSig",
"*",
"Signature",
"// non-nil if accepted",
"\n",
"rejected",
":=",
"false",
"\n",
"// FIXME? Say more about the contents of the signature, i.e. parse it even before verification?!",
"logrus",
".",
"Debugf",
"(",
"\"",
"\"",
",",
"sigNumber",
")",
"\n",
"interpretingReqs",
":",
"for",
"reqNumber",
",",
"req",
":=",
"range",
"reqs",
"{",
"// FIXME: Log the requirement itself? For now, we use just the number.",
"// FIXME: supply state",
"switch",
"res",
",",
"as",
",",
"err",
":=",
"req",
".",
"isSignatureAuthorAccepted",
"(",
"ctx",
",",
"<mask>",
",",
"sig",
")",
";",
"res",
"{",
"case",
"sarAccepted",
":",
"if",
"as",
"==",
"nil",
"{",
"// Coverage: this should never happen",
"logrus",
".",
"Debugf",
"(",
"\"",
"\"",
",",
"reqNumber",
")",
"\n",
"rejected",
"=",
"true",
"\n",
"break",
"interpretingReqs",
"\n",
"}",
"\n",
"logrus",
".",
"Debugf",
"(",
"\"",
"\"",
",",
"reqNumber",
")",
"\n",
"if",
"acceptedSig",
"==",
"nil",
"{",
"acceptedSig",
"=",
"as",
"\n",
"}",
"else",
"if",
"*",
"as",
"!=",
"*",
"acceptedSig",
"{",
"// Coverage: this should never happen",
"// Huh?! Two ways of verifying the same signature blob resulted in two different parses of its already accepted contents?",
"logrus",
".",
"Debugf",
"(",
"\"",
"\"",
",",
"reqNumber",
")",
"\n",
"rejected",
"=",
"true",
"\n",
"acceptedSig",
"=",
"nil",
"\n",
"break",
"interpretingReqs",
"\n",
"}",
"\n",
"case",
"sarRejected",
":",
"logrus",
".",
"Debugf",
"(",
"\"",
"\"",
",",
"reqNumber",
",",
"err",
".",
"Error",
"(",
")",
")",
"\n",
"rejected",
"=",
"true",
"\n",
"break",
"interpretingReqs",
"\n",
"case",
"sarUnknown",
":",
"if",
"err",
"!=",
"nil",
"{",
"// Coverage: this should never happen",
"logrus",
".",
"Debugf",
"(",
"\"",
"\"",
",",
"reqNumber",
",",
"err",
".",
"Error",
"(",
")",
")",
"\n",
"rejected",
"=",
"true",
"\n",
"break",
"interpretingReqs",
"\n",
"}",
"\n",
"logrus",
".",
"Debugf",
"(",
"\"",
"\"",
",",
"reqNumber",
")",
"\n",
"default",
":",
"// Coverage: this should never happen",
"logrus",
".",
"Debugf",
"(",
"\"",
"\"",
",",
"reqNumber",
",",
"string",
"(",
"res",
")",
")",
"\n",
"rejected",
"=",
"true",
"\n",
"break",
"interpretingReqs",
"\n",
"}",
"\n",
"}",
"\n",
"// This also handles the (invalid) case of empty reqs, by rejecting the signature.",
"if",
"acceptedSig",
"!=",
"nil",
"&&",
"!",
"rejected",
"{",
"logrus",
".",
"Debugf",
"(",
"\"",
"\"",
")",
"\n",
"res",
"=",
"append",
"(",
"res",
",",
"acceptedSig",
")",
"\n",
"}",
"else",
"{",
"logrus",
".",
"Debugf",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"res",
",",
"nil",
"\n",
"}"
] |
1,564 | all-1565 | [
"SleepString",
"returns",
"a",
"string",
"N",
"-",
"M",
"minutes",
"if",
"the",
"goroutine",
"(",
"s",
")",
"slept",
"for",
"a",
"long",
"time",
".",
"Returns",
"an",
"empty",
"string",
"otherwise",
"."
] | [
"func",
"(",
"s",
"*",
"Signature",
")",
"SleepString",
"(",
")",
"<mask>",
"{",
"if",
"s",
".",
"SleepMax",
"==",
"0",
"{",
"return",
"\"",
"\"",
"\n",
"}",
"\n",
"if",
"s",
".",
"SleepMin",
"!=",
"s",
".",
"SleepMax",
"{",
"return",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"s",
".",
"SleepMin",
",",
"s",
".",
"SleepMax",
")",
"\n",
"}",
"\n",
"return",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"s",
".",
"SleepMax",
")",
"\n",
"}"
] |
1,565 | all-1566 | [
"Value",
"converts",
"a",
"value",
"to",
"a",
"database",
"driver",
"value"
] | [
"func",
"(",
"u",
"CIDR",
")",
"Value",
"(",
")",
"(",
"<mask>",
".",
"Value",
",",
"error",
")",
"{",
"return",
"driver",
".",
"Value",
"(",
"string",
"(",
"u",
")",
")",
",",
"nil",
"\n",
"}"
] |
1,566 | all-1567 | [
"ServeConn",
"serves",
"HTTP",
"requests",
"from",
"the",
"given",
"connection",
".",
"ServeConn",
"returns",
"nil",
"if",
"all",
"requests",
"from",
"the",
"c",
"are",
"successfully",
"served",
".",
"It",
"returns",
"non",
"-",
"nil",
"error",
"otherwise",
".",
"Connection",
"c",
"must",
"immediately",
"propagate",
"all",
"the",
"data",
"passed",
"to",
"Write",
"()",
"to",
"the",
"client",
".",
"Otherwise",
"requests",
"processing",
"may",
"hang",
".",
"ServeConn",
"closes",
"c",
"before",
"returning",
"."
] | [
"func",
"(",
"s",
"*",
"Server",
")",
"ServeConn",
"(",
"c",
"net",
".",
"Conn",
")",
"error",
"{",
"if",
"s",
".",
"MaxConnsPerIP",
">",
"0",
"{",
"pic",
":=",
"wrapPerIPConn",
"(",
"s",
",",
"c",
")",
"\n",
"if",
"pic",
"==",
"nil",
"{",
"return",
"ErrPerIPConnLimit",
"\n",
"}",
"\n",
"c",
"=",
"pic",
"\n",
"}",
"\n\n",
"n",
":=",
"atomic",
".",
"AddUint32",
"(",
"&",
"s",
".",
"concurrency",
",",
"1",
")",
"\n",
"if",
"n",
">",
"uint32",
"(",
"s",
".",
"getConcurrency",
"(",
")",
")",
"{",
"atomic",
".",
"AddUint32",
"(",
"&",
"s",
".",
"concurrency",
",",
"^",
"uint32",
"(",
"0",
")",
")",
"\n",
"s",
".",
"writeFastError",
"(",
"c",
",",
"StatusServiceUnavailable",
",",
"\"",
"\"",
")",
"\n",
"c",
".",
"Close",
"(",
")",
"\n",
"return",
"ErrConcurrencyLimit",
"\n",
"}",
"\n\n",
"atomic",
".",
"AddInt32",
"(",
"&",
"s",
".",
"<mask>",
",",
"1",
")",
"\n\n",
"err",
":=",
"s",
".",
"serveConn",
"(",
"c",
")",
"\n\n",
"atomic",
".",
"AddUint32",
"(",
"&",
"s",
".",
"concurrency",
",",
"^",
"uint32",
"(",
"0",
")",
")",
"\n\n",
"if",
"err",
"!=",
"errHijacked",
"{",
"err1",
":=",
"c",
".",
"Close",
"(",
")",
"\n",
"s",
".",
"setState",
"(",
"c",
",",
"StateClosed",
")",
"\n",
"if",
"err",
"==",
"nil",
"{",
"err",
"=",
"err1",
"\n",
"}",
"\n",
"}",
"else",
"{",
"err",
"=",
"nil",
"\n",
"s",
".",
"setState",
"(",
"c",
",",
"StateHijacked",
")",
"\n",
"}",
"\n",
"return",
"err",
"\n",
"}"
] |
1,567 | all-1568 | [
"SecurityGroupLocator",
"builds",
"a",
"locator",
"from",
"the",
"given",
"href",
"."
] | [
"func",
"(",
"api",
"*",
"API",
")",
"SecurityGroupLocator",
"(",
"href",
"string",
")",
"*",
"SecurityGroupLocator",
"{",
"<mask>",
"&",
"SecurityGroupLocator",
"{",
"Href",
"(",
"href",
")",
",",
"api",
"}",
"\n",
"}"
] |
1,568 | all-1569 | [
"Accept",
"waits",
"for",
"and",
"returns",
"the",
"next",
"connection",
"to",
"the",
"listener",
"."
] | [
"func",
"(",
"l",
"*",
"listener",
")",
"Accept",
"(",
")",
"(",
"transport",
".",
"Conn",
",",
"error",
")",
"{",
"if",
"c",
",",
"ok",
":=",
"<-",
"l",
".",
"incoming",
";",
"<mask>",
"{",
"return",
"c",
".",
"conn",
",",
"c",
".",
"err",
"\n",
"}",
"\n",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
")",
"\n",
"}"
] |
1,569 | all-1570 | [
"Colon",
"matches",
"path",
"with",
"REST",
"-",
"full",
"resources",
"URI",
"in",
"perfix",
"colon",
"form",
".",
"e",
".",
"g",
".",
"/",
"foo",
"/",
"v1",
"/",
"bar",
"/",
"v2",
"will",
"map",
"to",
"/",
":",
"foo",
"/",
":",
"bar",
"form",
"while",
"the",
"value",
"of",
"foo",
"and",
"bar",
"are",
"v1",
"and",
"v2",
"respectively",
"."
] | [
"func",
"Colon",
"(",
"<mask>",
"string",
")",
"*",
"colon",
"{",
"matches",
":=",
"strings",
".",
"Split",
"(",
"path",
",",
"\"",
"\"",
")",
"\n",
"return",
"&",
"colon",
"{",
"matches",
":",
"matches",
",",
"}",
"\n",
"}"
] |
1,570 | all-1571 | [
"Stability",
":",
"***",
"DEPRECATED",
"***",
"claim",
"a",
"task",
"-",
"never",
"documented",
"Required",
"scopes",
":",
"Any",
"of",
":",
"-",
"All",
"of",
":",
"*",
"queue",
":",
"claim",
"-",
"task",
":",
"<provisionerId",
">",
"/",
"<workerType",
">",
"*",
"queue",
":",
"worker",
"-",
"id",
":",
"<workerGroup",
">",
"/",
"<workerId",
">",
"-",
"All",
"of",
":",
"*",
"queue",
":",
"claim",
"-",
"task",
"*",
"assume",
":",
"worker",
"-",
"type",
":",
"<provisionerId",
">",
"/",
"<workerType",
">",
"*",
"assume",
":",
"worker",
"-",
"id",
":",
"<workerGroup",
">",
"/",
"<workerId",
">",
"See",
"#claimTask"
] | [
"func",
"(",
"queue",
"*",
"Queue",
")",
"ClaimTask",
"(",
"taskId",
",",
"runId",
"string",
",",
"payload",
"*",
"TaskClaimRequest",
")",
"(",
"*",
"TaskClaimResponse",
",",
"error",
")",
"{",
"cd",
":=",
"tcclient",
".",
"<mask>",
"(",
"*",
"queue",
")",
"\n",
"responseObject",
",",
"_",
",",
"err",
":=",
"(",
"&",
"cd",
")",
".",
"APICall",
"(",
"payload",
",",
"\"",
"\"",
",",
"\"",
"\"",
"+",
"url",
".",
"QueryEscape",
"(",
"taskId",
")",
"+",
"\"",
"\"",
"+",
"url",
".",
"QueryEscape",
"(",
"runId",
")",
"+",
"\"",
"\"",
",",
"new",
"(",
"TaskClaimResponse",
")",
",",
"nil",
")",
"\n",
"return",
"responseObject",
".",
"(",
"*",
"TaskClaimResponse",
")",
",",
"err",
"\n",
"}"
] |
1,571 | all-1572 | [
"SetVisibleChild",
"is",
"a",
"wrapper",
"around",
"gtk_stack_set_visible_child",
"()",
"."
] | [
"func",
"(",
"v",
"*",
"Stack",
")",
"SetVisibleChild",
"(",
"<mask>",
"IWidget",
")",
"{",
"C",
".",
"gtk_stack_set_visible_child",
"(",
"v",
".",
"native",
"(",
")",
",",
"child",
".",
"toWidget",
"(",
")",
")",
"\n",
"}"
] |
1,572 | all-1573 | [
"KNearest",
"returns",
"the",
"k",
"nearest",
"points",
"near",
"point",
"within",
"maxDistance",
"that",
"match",
"the",
"accept",
"criteria",
"."
] | [
"func",
"(",
"points",
"*",
"PointsIndex",
")",
"KNearest",
"(",
"point",
"Point",
",",
"k",
"int",
",",
"maxDistance",
"Meters",
",",
"accept",
"func",
"(",
"p",
"Point",
")",
"bool",
")",
"[",
"]",
"Point",
"{",
"nearbyPoints",
":=",
"make",
"(",
"[",
"]",
"Point",
",",
"0",
")",
"\n",
"pointEntry",
":=",
"points",
".",
"index",
".",
"GetEntryAt",
"(",
"point",
")",
".",
"(",
"set",
")",
"\n",
"nearbyPoints",
"=",
"append",
"(",
"nearbyPoints",
",",
"getPoints",
"(",
"[",
"]",
"interface",
"{",
"}",
"{",
"pointEntry",
"}",
",",
"accept",
")",
"...",
")",
"\n\n",
"totalCount",
":=",
"0",
"\n",
"idx",
":=",
"cellOf",
"(",
"point",
",",
"points",
".",
"index",
".",
"resolution",
")",
"\n",
"// Explicitely assign a greater max distance so that we definitely return enough points",
"// and make sure it searches at least one square away.",
"coarseMaxDistance",
":=",
"math",
".",
"Max",
"(",
"float64",
"(",
"maxDistance",
")",
"*",
"2.0",
",",
"float64",
"(",
"points",
".",
"index",
".",
"resolution",
")",
"*",
"2.0",
"+",
"0.01",
")",
"\n\n",
"for",
"d",
":=",
"1",
";",
"float64",
"(",
"d",
")",
"*",
"float64",
"(",
"points",
".",
"<mask>",
".",
"resolution",
")",
"<=",
"coarseMaxDistance",
";",
"d",
"++",
"{",
"oldCount",
":=",
"len",
"(",
"nearbyPoints",
")",
"\n\n",
"nearbyPoints",
"=",
"getPointsAppend",
"(",
"nearbyPoints",
",",
"points",
".",
"index",
".",
"get",
"(",
"idx",
".",
"x",
"-",
"d",
",",
"idx",
".",
"x",
"+",
"d",
",",
"idx",
".",
"y",
"+",
"d",
",",
"idx",
".",
"y",
"+",
"d",
")",
",",
"accept",
")",
"\n",
"nearbyPoints",
"=",
"getPointsAppend",
"(",
"nearbyPoints",
",",
"points",
".",
"index",
".",
"get",
"(",
"idx",
".",
"x",
"-",
"d",
",",
"idx",
".",
"x",
"+",
"d",
",",
"idx",
".",
"y",
"-",
"d",
",",
"idx",
".",
"y",
"-",
"d",
")",
",",
"accept",
")",
"\n",
"nearbyPoints",
"=",
"getPointsAppend",
"(",
"nearbyPoints",
",",
"points",
".",
"index",
".",
"get",
"(",
"idx",
".",
"x",
"-",
"d",
",",
"idx",
".",
"x",
"-",
"d",
",",
"idx",
".",
"y",
"-",
"d",
"+",
"1",
",",
"idx",
".",
"y",
"+",
"d",
"-",
"1",
")",
",",
"accept",
")",
"\n",
"nearbyPoints",
"=",
"getPointsAppend",
"(",
"nearbyPoints",
",",
"points",
".",
"index",
".",
"get",
"(",
"idx",
".",
"x",
"+",
"d",
",",
"idx",
".",
"x",
"+",
"d",
",",
"idx",
".",
"y",
"-",
"d",
"+",
"1",
",",
"idx",
".",
"y",
"+",
"d",
"-",
"1",
")",
",",
"accept",
")",
"\n\n",
"totalCount",
"+=",
"len",
"(",
"nearbyPoints",
")",
"-",
"oldCount",
"\n\n",
"if",
"totalCount",
">",
"k",
"{",
"break",
"\n",
"}",
"\n",
"}",
"\n\n",
"sortedPoints",
":=",
"&",
"sortedPoints",
"{",
"nearbyPoints",
",",
"point",
"}",
"\n",
"sort",
".",
"Sort",
"(",
"sortedPoints",
")",
"\n\n",
"k",
"=",
"min",
"(",
"k",
",",
"len",
"(",
"sortedPoints",
".",
"points",
")",
")",
"\n\n",
"// filter points which longer than maxDistance away from point.",
"for",
"i",
",",
"nearbyPoint",
":=",
"range",
"sortedPoints",
".",
"points",
"{",
"if",
"Distance",
"(",
"point",
",",
"nearbyPoint",
")",
">",
"maxDistance",
"||",
"i",
"==",
"k",
"{",
"k",
"=",
"i",
"\n",
"break",
"\n",
"}",
"\n",
"}",
"\n\n",
"return",
"sortedPoints",
".",
"points",
"[",
"0",
":",
"k",
"]",
"\n",
"}"
] |
1,573 | all-1574 | [
"Needed",
"for",
"live",
"migration",
"where",
"an",
"empty",
"snapshot",
"needs",
"to",
"be",
"created",
"before",
"rsyncing",
"into",
"it",
"."
] | [
"func",
"(",
"s",
"*",
"storageBtrfs",
")",
"ContainerSnapshotCreateEmpty",
"(",
"snapshotContainer",
"container",
")",
"error",
"{",
"logger",
".",
"Debugf",
"(",
"\"",
"\\\"",
"\\\"",
"\\\"",
"\\\"",
"\"",
",",
"s",
".",
"volume",
".",
"Name",
",",
"s",
".",
"pool",
".",
"Name",
")",
"\n\n",
"// Mount the storage pool.",
"_",
",",
"err",
":=",
"s",
".",
"StoragePoolMount",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"// Create the snapshot subvole path on the storage pool.",
"sourceName",
",",
"_",
",",
"_",
":=",
"containerGetParentAndSnapshotName",
"(",
"snapshotContainer",
".",
"Name",
"(",
")",
")",
"\n",
"snapshotSubvolumePath",
":=",
"getSnapshotSubvolumePath",
"(",
"snapshotContainer",
".",
"Project",
"(",
")",
",",
"s",
".",
"pool",
".",
"Name",
",",
"sourceName",
")",
"\n",
"snapshotSubvolumeName",
":=",
"getSnapshotMountPoint",
"(",
"snapshotContainer",
".",
"Project",
"(",
")",
",",
"s",
".",
"pool",
".",
"<mask>",
",",
"snapshotContainer",
".",
"Name",
"(",
")",
")",
"\n",
"if",
"!",
"shared",
".",
"PathExists",
"(",
"snapshotSubvolumePath",
")",
"{",
"err",
":=",
"os",
".",
"MkdirAll",
"(",
"snapshotSubvolumePath",
",",
"containersDirMode",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"}",
"\n\n",
"err",
"=",
"btrfsSubVolumeCreate",
"(",
"snapshotSubvolumeName",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"snapshotMntPointSymlinkTarget",
":=",
"shared",
".",
"VarPath",
"(",
"\"",
"\"",
",",
"s",
".",
"pool",
".",
"Name",
",",
"\"",
"\"",
",",
"projectPrefix",
"(",
"snapshotContainer",
".",
"Project",
"(",
")",
",",
"sourceName",
")",
")",
"\n",
"snapshotMntPointSymlink",
":=",
"shared",
".",
"VarPath",
"(",
"\"",
"\"",
",",
"projectPrefix",
"(",
"snapshotContainer",
".",
"Project",
"(",
")",
",",
"sourceName",
")",
")",
"\n",
"if",
"!",
"shared",
".",
"PathExists",
"(",
"snapshotMntPointSymlink",
")",
"{",
"err",
":=",
"createContainerMountpoint",
"(",
"snapshotMntPointSymlinkTarget",
",",
"snapshotMntPointSymlink",
",",
"snapshotContainer",
".",
"IsPrivileged",
"(",
")",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"}",
"\n\n",
"logger",
".",
"Debugf",
"(",
"\"",
"\\\"",
"\\\"",
"\\\"",
"\\\"",
"\"",
",",
"s",
".",
"volume",
".",
"Name",
",",
"s",
".",
"pool",
".",
"Name",
")",
"\n",
"return",
"nil",
"\n",
"}"
] |
1,574 | all-1575 | [
"Do",
"executes",
"Overlay",
".",
"highlightFrame",
"against",
"the",
"provided",
"context",
"."
] | [
"func",
"(",
"p",
"*",
"HighlightFrameParams",
")",
"Do",
"(",
"ctx",
"context",
".",
"<mask>",
")",
"(",
"err",
"error",
")",
"{",
"return",
"cdp",
".",
"Execute",
"(",
"ctx",
",",
"CommandHighlightFrame",
",",
"p",
",",
"nil",
")",
"\n",
"}"
] |
1,575 | all-1576 | [
"Returns",
"the",
"source",
"code",
"string",
"from",
"a",
"shader",
"object"
] | [
"func",
"GetShaderSource",
"(",
"shader",
"uint32",
",",
"bufSize",
"int32",
",",
"length",
"*",
"int32",
",",
"source",
"*",
"uint8",
")",
"{",
"syscall",
".",
"Syscall6",
"(",
"gpGetShaderSource",
",",
"4",
",",
"uintptr",
"(",
"shader",
")",
",",
"uintptr",
"(",
"bufSize",
")",
",",
"uintptr",
"(",
"unsafe",
".",
"Pointer",
"(",
"length",
")",
")",
",",
"uintptr",
"(",
"unsafe",
".",
"Pointer",
"(",
"<mask>",
")",
")",
",",
"0",
",",
"0",
")",
"\n",
"}"
] |
1,576 | all-1577 | [
"SetServerBytes",
"sets",
"Server",
"header",
"value",
"."
] | [
"func",
"(",
"h",
"*",
"ResponseHeader",
")",
"SetServerBytes",
"(",
"server",
"[",
"]",
"byte",
")",
"{",
"h",
".",
"server",
"=",
"append",
"(",
"h",
".",
"<mask>",
"[",
":",
"0",
"]",
",",
"server",
"...",
")",
"\n",
"}"
] |
1,577 | all-1578 | [
"Warnf",
"records",
"the",
"log",
"with",
"warn",
"level"
] | [
"func",
"(",
"l",
"*",
"Logger",
")",
"Warnf",
"(",
"format",
"string",
",",
"args",
"...",
"<mask>",
"{",
"}",
")",
"{",
"l",
".",
"Output",
"(",
"2",
",",
"LevelWarn",
",",
"fmt",
".",
"Sprintf",
"(",
"format",
",",
"args",
"...",
")",
")",
"\n",
"}"
] |
1,578 | all-1579 | [
"UpdateImageAlias",
"updates",
"the",
"image",
"alias",
"definition"
] | [
"func",
"(",
"r",
"*",
"ProtocolLXD",
")",
"UpdateImageAlias",
"(",
"<mask>",
"string",
",",
"alias",
"api",
".",
"ImageAliasesEntryPut",
",",
"ETag",
"string",
")",
"error",
"{",
"// Send the request",
"_",
",",
"_",
",",
"err",
":=",
"r",
".",
"query",
"(",
"\"",
"\"",
",",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"url",
".",
"QueryEscape",
"(",
"name",
")",
")",
",",
"alias",
",",
"ETag",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"return",
"nil",
"\n",
"}"
] |
1,579 | all-1580 | [
"Method",
"returns",
"HTTP",
"request",
"method",
"."
] | [
"func",
"(",
"h",
"*",
"RequestHeader",
")",
"Method",
"(",
")",
"[",
"]",
"byte",
"{",
"if",
"len",
"(",
"h",
".",
"method",
")",
"==",
"0",
"{",
"return",
"strGet",
"\n",
"}",
"\n",
"return",
"h",
".",
"<mask>",
"\n",
"}"
] |
1,580 | all-1581 | [
"NewReader",
"creates",
"a",
"new",
"Reader",
"instance",
"."
] | [
"func",
"NewReader",
"(",
"r",
"<mask>",
".",
"Reader",
")",
"*",
"Reader",
"{",
"return",
"&",
"Reader",
"{",
"rd",
":",
"bufio",
".",
"NewReader",
"(",
"r",
")",
",",
"tr",
":",
"unicode",
".",
"Cesu8ToUtf8Transformer",
",",
"}",
"\n",
"}"
] |
1,581 | all-1582 | [
"CountAll",
"returns",
"a",
"map",
"associating",
"each",
"table",
"name",
"in",
"the",
"database",
"with",
"the",
"total",
"count",
"of",
"its",
"rows",
"."
] | [
"func",
"CountAll",
"(",
"tx",
"*",
"sql",
".",
"Tx",
")",
"(",
"map",
"[",
"string",
"]",
"int",
",",
"error",
")",
"{",
"tables",
",",
"err",
":=",
"SelectStrings",
"(",
"tx",
",",
"\"",
"\"",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"errors",
".",
"Wrap",
"(",
"err",
",",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"counts",
":=",
"map",
"[",
"string",
"]",
"int",
"{",
"}",
"\n",
"for",
"_",
",",
"table",
":=",
"range",
"tables",
"{",
"count",
",",
"err",
":=",
"Count",
"(",
"tx",
",",
"table",
",",
"\"",
"\"",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"errors",
".",
"Wrapf",
"(",
"err",
",",
"\"",
"\"",
",",
"table",
")",
"\n",
"}",
"\n",
"counts",
"[",
"table",
"]",
"=",
"<mask>",
"\n",
"}",
"\n\n",
"return",
"counts",
",",
"nil",
"\n",
"}"
] |
1,582 | all-1583 | [
"If",
"emits",
"every",
"input",
"x",
"for",
"which",
"fn",
"(",
"x",
")",
"is",
"true",
"."
] | [
"func",
"If",
"(",
"fn",
"func",
"(",
"string",
")",
"bool",
")",
"<mask>",
"{",
"return",
"FilterFunc",
"(",
"func",
"(",
"arg",
"Arg",
")",
"error",
"{",
"for",
"s",
":=",
"range",
"arg",
".",
"In",
"{",
"if",
"fn",
"(",
"s",
")",
"{",
"arg",
".",
"Out",
"<-",
"s",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}",
")",
"\n",
"}"
] |
1,583 | all-1584 | [
"NewPubSub",
"returns",
"a",
"new",
"PubSub",
"management",
"object",
"."
] | [
"func",
"NewPubSub",
"(",
"ctx",
"context",
".",
"Context",
",",
"h",
"host",
".",
"Host",
",",
"rt",
"PubSubRouter",
",",
"opts",
"...",
"Option",
")",
"(",
"*",
"PubSub",
",",
"error",
")",
"{",
"ps",
":=",
"&",
"PubSub",
"{",
"host",
":",
"h",
",",
"ctx",
":",
"ctx",
",",
"rt",
":",
"rt",
",",
"signID",
":",
"h",
".",
"ID",
"(",
")",
",",
"signKey",
":",
"h",
".",
"Peerstore",
"(",
")",
".",
"PrivKey",
"(",
"h",
".",
"ID",
"(",
")",
")",
",",
"signStrict",
":",
"true",
",",
"incoming",
":",
"make",
"(",
"chan",
"*",
"RPC",
",",
"32",
")",
",",
"publish",
":",
"make",
"(",
"chan",
"*",
"Message",
")",
",",
"newPeers",
":",
"make",
"(",
"chan",
"peer",
".",
"ID",
")",
",",
"newPeerStream",
":",
"make",
"(",
"chan",
"inet",
".",
"Stream",
")",
",",
"newPeerError",
":",
"make",
"(",
"chan",
"peer",
".",
"ID",
")",
",",
"peerDead",
":",
"make",
"(",
"chan",
"peer",
".",
"ID",
")",
",",
"cancelCh",
":",
"make",
"(",
"chan",
"*",
"Subscription",
")",
",",
"getPeers",
":",
"make",
"(",
"chan",
"*",
"listPeerReq",
")",
",",
"addSub",
":",
"make",
"(",
"chan",
"*",
"addSubReq",
")",
",",
"getTopics",
":",
"make",
"(",
"chan",
"*",
"topicReq",
")",
",",
"sendMsg",
":",
"make",
"(",
"chan",
"*",
"sendReq",
",",
"32",
")",
",",
"addVal",
":",
"make",
"(",
"chan",
"*",
"addValReq",
")",
",",
"rmVal",
":",
"make",
"(",
"chan",
"*",
"rmValReq",
")",
",",
"validateThrottle",
":",
"make",
"(",
"chan",
"struct",
"{",
"}",
",",
"defaultValidateThrottle",
")",
",",
"eval",
":",
"<mask>",
"(",
"chan",
"func",
"(",
")",
")",
",",
"myTopics",
":",
"make",
"(",
"map",
"[",
"string",
"]",
"map",
"[",
"*",
"Subscription",
"]",
"struct",
"{",
"}",
")",
",",
"topics",
":",
"make",
"(",
"map",
"[",
"string",
"]",
"map",
"[",
"peer",
".",
"ID",
"]",
"struct",
"{",
"}",
")",
",",
"peers",
":",
"make",
"(",
"map",
"[",
"peer",
".",
"ID",
"]",
"chan",
"*",
"RPC",
")",
",",
"topicVals",
":",
"make",
"(",
"map",
"[",
"string",
"]",
"*",
"topicVal",
")",
",",
"blacklist",
":",
"NewMapBlacklist",
"(",
")",
",",
"blacklistPeer",
":",
"make",
"(",
"chan",
"peer",
".",
"ID",
")",
",",
"seenMessages",
":",
"timecache",
".",
"NewTimeCache",
"(",
"TimeCacheDuration",
")",
",",
"counter",
":",
"uint64",
"(",
"time",
".",
"Now",
"(",
")",
".",
"UnixNano",
"(",
")",
")",
",",
"}",
"\n\n",
"for",
"_",
",",
"opt",
":=",
"range",
"opts",
"{",
"err",
":=",
"opt",
"(",
"ps",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"}",
"\n\n",
"if",
"ps",
".",
"signStrict",
"&&",
"ps",
".",
"signKey",
"==",
"nil",
"{",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"rt",
".",
"Attach",
"(",
"ps",
")",
"\n\n",
"for",
"_",
",",
"id",
":=",
"range",
"rt",
".",
"Protocols",
"(",
")",
"{",
"h",
".",
"SetStreamHandler",
"(",
"id",
",",
"ps",
".",
"handleNewStream",
")",
"\n",
"}",
"\n",
"h",
".",
"Network",
"(",
")",
".",
"Notify",
"(",
"(",
"*",
"PubSubNotif",
")",
"(",
"ps",
")",
")",
"\n\n",
"go",
"ps",
".",
"processLoop",
"(",
"ctx",
")",
"\n\n",
"return",
"ps",
",",
"nil",
"\n",
"}"
] |
1,584 | all-1585 | [
"Stop",
"cancels",
"all",
"running",
"scrape",
"pools",
"and",
"blocks",
"until",
"all",
"have",
"exited",
"."
] | [
"func",
"(",
"m",
"*",
"Manager",
")",
"Stop",
"(",
")",
"{",
"m",
".",
"mtxScrape",
".",
"Lock",
"(",
")",
"\n",
"defer",
"m",
".",
"mtxScrape",
".",
"Unlock",
"(",
")",
"\n\n",
"for",
"_",
",",
"sp",
":=",
"range",
"m",
".",
"scrapePools",
"{",
"sp",
".",
"<mask>",
"(",
")",
"\n",
"}",
"\n",
"close",
"(",
"m",
".",
"graceShut",
")",
"\n",
"}"
] |
1,585 | all-1586 | [
"NewConfiguration",
"creates",
"a",
"generic",
"configuration",
"from",
"a",
"specific",
"type",
"of",
"configuration",
"."
] | [
"func",
"NewConfiguration",
"(",
"config",
"interface",
"{",
"}",
")",
"*",
"Configuration",
"{",
"configuration",
":=",
"&",
"Configuration",
"{",
"}",
"\n",
"switch",
"config",
".",
"(",
"type",
")",
"{",
"<mask>",
"*",
"GlobalConfiguration",
":",
"configuration",
".",
"GlobalConfiguration",
"=",
"config",
".",
"(",
"*",
"GlobalConfiguration",
")",
"\n",
"return",
"configuration",
"\n",
"case",
"*",
"PachdFullConfiguration",
":",
"configuration",
".",
"GlobalConfiguration",
"=",
"&",
"config",
".",
"(",
"*",
"PachdFullConfiguration",
")",
".",
"GlobalConfiguration",
"\n",
"configuration",
".",
"PachdSpecificConfiguration",
"=",
"&",
"config",
".",
"(",
"*",
"PachdFullConfiguration",
")",
".",
"PachdSpecificConfiguration",
"\n",
"return",
"configuration",
"\n",
"case",
"*",
"WorkerFullConfiguration",
":",
"configuration",
".",
"GlobalConfiguration",
"=",
"&",
"config",
".",
"(",
"*",
"WorkerFullConfiguration",
")",
".",
"GlobalConfiguration",
"\n",
"configuration",
".",
"WorkerSpecificConfiguration",
"=",
"&",
"config",
".",
"(",
"*",
"WorkerFullConfiguration",
")",
".",
"WorkerSpecificConfiguration",
"\n",
"return",
"configuration",
"\n",
"default",
":",
"return",
"nil",
"\n",
"}",
"\n",
"}"
] |
1,586 | all-1587 | [
"HasLastNoDataTs",
"returns",
"a",
"boolean",
"if",
"a",
"field",
"has",
"been",
"set",
"."
] | [
"func",
"(",
"g",
"*",
"GroupData",
")",
"HasLastNoDataTs",
"(",
")",
"bool",
"{",
"if",
"g",
"!=",
"nil",
"&&",
"g",
".",
"LastNoDataTs",
"!=",
"nil",
"{",
"return",
"<mask>",
"\n",
"}",
"\n\n",
"return",
"false",
"\n",
"}"
] |
1,587 | all-1588 | [
"SetBytesK",
"sets",
"the",
"given",
"key",
":",
"value",
"header",
".",
"Use",
"AddBytesK",
"for",
"setting",
"multiple",
"header",
"values",
"under",
"the",
"same",
"key",
"."
] | [
"func",
"(",
"h",
"*",
"ResponseHeader",
")",
"SetBytesK",
"(",
"key",
"[",
"]",
"byte",
",",
"value",
"string",
")",
"{",
"h",
".",
"bufKV",
".",
"value",
"=",
"append",
"(",
"h",
".",
"bufKV",
".",
"<mask>",
"[",
":",
"0",
"]",
",",
"value",
"...",
")",
"\n",
"h",
".",
"SetBytesKV",
"(",
"key",
",",
"h",
".",
"bufKV",
".",
"value",
")",
"\n",
"}"
] |
1,588 | all-1589 | [
"PrintableString",
"parsePrintableString",
"parses",
"a",
"ASN",
".",
"1",
"PrintableString",
"from",
"the",
"given",
"byte",
"array",
"and",
"returns",
"it",
"."
] | [
"func",
"parsePrintableString",
"(",
"bytes",
"[",
"]",
"byte",
")",
"(",
"ret",
"string",
",",
"err",
"error",
")",
"{",
"for",
"_",
",",
"b",
":=",
"range",
"<mask>",
"{",
"if",
"!",
"isPrintable",
"(",
"b",
")",
"{",
"err",
"=",
"asn1",
".",
"SyntaxError",
"{",
"Msg",
":",
"\"",
"\"",
"}",
"\n",
"return",
"\n",
"}",
"\n",
"}",
"\n",
"ret",
"=",
"string",
"(",
"bytes",
")",
"\n",
"return",
"\n",
"}"
] |
1,589 | all-1590 | [
"StackWithCaller",
"logs",
"the",
"error",
"err",
"with",
"the",
"caller",
"package",
"name",
"and",
"the",
"stack",
"trace",
"."
] | [
"func",
"StackWithCaller",
"(",
"err",
"interface",
"{",
"}",
")",
"{",
"stack",
":=",
"make",
"(",
"[",
"]",
"byte",
",",
"64",
"<<",
"10",
")",
"\n",
"stack",
"=",
"<mask>",
"[",
":",
"runtime",
".",
"Stack",
"(",
"stack",
",",
"false",
")",
"]",
"\n\n",
"if",
"pack",
",",
"ok",
":=",
"callerPackage",
"(",
")",
";",
"ok",
"{",
"log",
".",
"Printf",
"(",
"\"",
"\\n",
"\"",
",",
"pack",
",",
"err",
",",
"stack",
")",
"\n",
"}",
"else",
"{",
"log",
".",
"Printf",
"(",
"\"",
"\\n",
"\"",
",",
"err",
",",
"stack",
")",
"\n",
"}",
"\n",
"}"
] |
1,590 | all-1591 | [
"disk",
"returns",
"the",
"persistent",
"disk",
"attached",
"to",
"the",
"vm",
"."
] | [
"func",
"(",
"c",
"*",
"ComputeUtil",
")",
"disk",
"(",
")",
"(",
"*",
"<mask>",
".",
"Disk",
",",
"error",
")",
"{",
"return",
"c",
".",
"service",
".",
"Disks",
".",
"Get",
"(",
"c",
".",
"project",
",",
"c",
".",
"zone",
",",
"c",
".",
"diskName",
"(",
")",
")",
".",
"Do",
"(",
")",
"\n",
"}"
] |
1,591 | all-1592 | [
"DrawImage",
"draws",
"an",
"image",
"as",
"PNG",
"TODO",
":",
"add",
"type",
"(",
"tp",
")",
"as",
"parameter",
"to",
"argument",
"list?"
] | [
"func",
"(",
"gc",
"*",
"GraphicContext",
")",
"DrawImage",
"(",
"image",
"image",
".",
"<mask>",
")",
"{",
"name",
":=",
"strconv",
".",
"Itoa",
"(",
"int",
"(",
"imageCount",
")",
")",
"\n",
"imageCount",
"++",
"\n",
"tp",
":=",
"\"",
"\"",
"// \"JPG\", \"JPEG\", \"PNG\" and \"GIF\"",
"\n",
"b",
":=",
"&",
"bytes",
".",
"Buffer",
"{",
"}",
"\n",
"png",
".",
"Encode",
"(",
"b",
",",
"image",
")",
"\n",
"gc",
".",
"pdf",
".",
"RegisterImageReader",
"(",
"name",
",",
"tp",
",",
"b",
")",
"\n",
"bounds",
":=",
"image",
".",
"Bounds",
"(",
")",
"\n",
"x0",
",",
"y0",
":=",
"float64",
"(",
"bounds",
".",
"Min",
".",
"X",
")",
",",
"float64",
"(",
"bounds",
".",
"Min",
".",
"Y",
")",
"\n",
"w",
",",
"h",
":=",
"float64",
"(",
"bounds",
".",
"Dx",
"(",
")",
")",
",",
"float64",
"(",
"bounds",
".",
"Dy",
"(",
")",
")",
"\n",
"gc",
".",
"pdf",
".",
"Image",
"(",
"name",
",",
"x0",
",",
"y0",
",",
"w",
",",
"h",
",",
"false",
",",
"tp",
",",
"0",
",",
"\"",
"\"",
")",
"\n",
"}"
] |
1,592 | all-1593 | [
"GetRequiredVersion",
"is",
"a",
"wrapper",
"around",
"gtk_gl_area_get_required_version",
"()",
"."
] | [
"func",
"(",
"v",
"*",
"GLArea",
")",
"GetRequiredVersion",
"(",
")",
"(",
"MajorVersion",
",",
"MinorVersion",
")",
"{",
"<mask>",
"major",
",",
"minor",
"int",
"\n",
"C",
".",
"gtk_gl_area_get_required_version",
"(",
"v",
".",
"native",
"(",
")",
",",
"(",
"*",
"C",
".",
"int",
")",
"(",
"unsafe",
".",
"Pointer",
"(",
"&",
"major",
")",
")",
",",
"(",
"*",
"C",
".",
"int",
")",
"(",
"unsafe",
".",
"Pointer",
"(",
"&",
"minor",
")",
")",
")",
"\n\n",
"return",
"MajorVersion",
"(",
"major",
")",
",",
"MinorVersion",
"(",
"minor",
")",
"\n",
"}"
] |
1,593 | all-1594 | [
"read",
"unsigned",
"128",
"-",
"bit",
"integer"
] | [
"func",
"readuint128",
"(",
"pos",
"uint32",
")",
"*",
"big",
".",
"Int",
"{",
"pos2",
":=",
"int64",
"(",
"pos",
")",
"\n",
"retval",
":=",
"big",
".",
"NewInt",
"(",
"0",
")",
"\n",
"data",
":=",
"make",
"(",
"[",
"]",
"byte",
",",
"16",
")",
"\n",
"_",
",",
"err",
":=",
"f",
".",
"ReadAt",
"(",
"data",
",",
"pos2",
"-",
"1",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"fmt",
".",
"Println",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"}",
"\n",
"// little endian to big endian",
"for",
"i",
",",
"j",
":=",
"0",
",",
"len",
"(",
"data",
")",
"-",
"1",
";",
"i",
"<",
"j",
";",
"i",
",",
"j",
"=",
"i",
"+",
"1",
",",
"j",
"-",
"1",
"{",
"<mask>",
"[",
"i",
"]",
",",
"data",
"[",
"j",
"]",
"=",
"data",
"[",
"j",
"]",
",",
"data",
"[",
"i",
"]",
"\n",
"}",
"\n",
"retval",
".",
"SetBytes",
"(",
"data",
")",
"\n",
"return",
"retval",
"\n",
"}"
] |
1,594 | all-1595 | [
"GetIconTooltipMarkup",
"()",
"is",
"a",
"wrapper",
"around",
"gtk_entry_get_icon_tooltip_markup",
"()",
"."
] | [
"func",
"(",
"v",
"*",
"<mask>",
")",
"GetIconTooltipMarkup",
"(",
"iconPos",
"EntryIconPosition",
")",
"(",
"string",
",",
"error",
")",
"{",
"c",
":=",
"C",
".",
"gtk_entry_get_icon_tooltip_markup",
"(",
"v",
".",
"native",
"(",
")",
",",
"C",
".",
"GtkEntryIconPosition",
"(",
"iconPos",
")",
")",
"\n",
"if",
"c",
"==",
"nil",
"{",
"return",
"\"",
"\"",
",",
"nilPtrErr",
"\n",
"}",
"\n",
"return",
"goString",
"(",
"c",
")",
",",
"nil",
"\n",
"}"
] |
1,595 | all-1596 | [
"GetAction",
"returns",
"the",
"action",
"with",
"the",
"given",
"name",
"returns",
"nil",
"if",
"none",
"is",
"found",
"."
] | [
"func",
"(",
"r",
"*",
"Resource",
")",
"GetAction",
"(",
"name",
"string",
")",
"*",
"Action",
"{",
"for",
"_",
",",
"a",
":=",
"range",
"r",
".",
"Actions",
"{",
"if",
"a",
".",
"Name",
"==",
"<mask>",
"{",
"return",
"a",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
] |
1,596 | all-1597 | [
"invalidate",
"the",
"content",
"of",
"a",
"region",
"of",
"some",
"or",
"all",
"of",
"a",
"framebuffer",
"s",
"attachments"
] | [
"func",
"InvalidateSubFramebuffer",
"(",
"target",
"uint32",
",",
"numAttachments",
"int32",
",",
"attachments",
"*",
"uint32",
",",
"x",
"int32",
",",
"y",
"int32",
",",
"<mask>",
"int32",
",",
"height",
"int32",
")",
"{",
"C",
".",
"glowInvalidateSubFramebuffer",
"(",
"gpInvalidateSubFramebuffer",
",",
"(",
"C",
".",
"GLenum",
")",
"(",
"target",
")",
",",
"(",
"C",
".",
"GLsizei",
")",
"(",
"numAttachments",
")",
",",
"(",
"*",
"C",
".",
"GLenum",
")",
"(",
"unsafe",
".",
"Pointer",
"(",
"attachments",
")",
")",
",",
"(",
"C",
".",
"GLint",
")",
"(",
"x",
")",
",",
"(",
"C",
".",
"GLint",
")",
"(",
"y",
")",
",",
"(",
"C",
".",
"GLsizei",
")",
"(",
"width",
")",
",",
"(",
"C",
".",
"GLsizei",
")",
"(",
"height",
")",
")",
"\n",
"}"
] |
1,597 | all-1598 | [
"Finalize",
"ensures",
"there",
"no",
"nil",
"pointers",
"."
] | [
"func",
"(",
"c",
"*",
"SSLConfig",
")",
"Finalize",
"(",
")",
"{",
"if",
"c",
".",
"Enabled",
"==",
"nil",
"{",
"c",
".",
"Enabled",
"=",
"Bool",
"(",
"<mask>",
"||",
"StringPresent",
"(",
"c",
".",
"Cert",
")",
"||",
"StringPresent",
"(",
"c",
".",
"CaCert",
")",
"||",
"StringPresent",
"(",
"c",
".",
"CaPath",
")",
"||",
"StringPresent",
"(",
"c",
".",
"Key",
")",
"||",
"StringPresent",
"(",
"c",
".",
"ServerName",
")",
"||",
"BoolPresent",
"(",
"c",
".",
"Verify",
")",
")",
"\n",
"}",
"\n\n",
"if",
"c",
".",
"Cert",
"==",
"nil",
"{",
"c",
".",
"Cert",
"=",
"String",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"if",
"c",
".",
"CaCert",
"==",
"nil",
"{",
"c",
".",
"CaCert",
"=",
"String",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"if",
"c",
".",
"CaPath",
"==",
"nil",
"{",
"c",
".",
"CaPath",
"=",
"String",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"if",
"c",
".",
"Key",
"==",
"nil",
"{",
"c",
".",
"Key",
"=",
"String",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"if",
"c",
".",
"ServerName",
"==",
"nil",
"{",
"c",
".",
"ServerName",
"=",
"String",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"if",
"c",
".",
"Verify",
"==",
"nil",
"{",
"c",
".",
"Verify",
"=",
"Bool",
"(",
"DefaultSSLVerify",
")",
"\n",
"}",
"\n",
"}"
] |
1,598 | all-1599 | [
"specify",
"multisample",
"coverage",
"parameters"
] | [
"func",
"SampleCoverage",
"(",
"value",
"float32",
",",
"invert",
"bool",
")",
"{",
"C",
".",
"glowSampleCoverage",
"(",
"gpSampleCoverage",
",",
"(",
"C",
".",
"GLfloat",
")",
"(",
"<mask>",
")",
",",
"(",
"C",
".",
"GLboolean",
")",
"(",
"boolToInt",
"(",
"invert",
")",
")",
")",
"\n",
"}"
] |
1,599 | all-1600 | [
"BumpPatch",
"increments",
"the",
"Patch",
"field",
"by",
"1",
"and",
"resets",
"all",
"other",
"fields",
"to",
"their",
"default",
"values"
] | [
"func",
"(",
"v",
"*",
"<mask>",
")",
"BumpPatch",
"(",
")",
"{",
"v",
".",
"Patch",
"+=",
"1",
"\n",
"v",
".",
"PreRelease",
"=",
"PreRelease",
"(",
"\"",
"\"",
")",
"\n",
"v",
".",
"Metadata",
"=",
"\"",
"\"",
"\n",
"}"
] |
Subsets and Splits