id
int32 0
25.3k
| idx
stringlengths 5
9
| nl_tokens
listlengths 1
418
| pl_tokens
listlengths 22
4.98k
|
---|---|---|---|
15,100 | all-15101 | [
"cephRBDCloneCreate",
"creates",
"a",
"clone",
"from",
"a",
"protected",
"RBD",
"snapshot"
] | [
"func",
"cephRBDCloneCreate",
"(",
"sourceClusterName",
"string",
",",
"sourcePoolName",
"string",
",",
"sourceVolumeName",
"string",
",",
"sourceVolumeType",
"string",
",",
"sourceSnapshotName",
"string",
",",
"targetPoolName",
"string",
",",
"targetVolumeName",
"string",
",",
"targetVolumeType",
"string",
",",
"userName",
"string",
")",
"error",
"{",
"_",
",",
"err",
":=",
"<mask>",
".",
"RunCommand",
"(",
"\"",
"\"",
",",
"\"",
"\"",
",",
"userName",
",",
"\"",
"\"",
",",
"sourceClusterName",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"sourcePoolName",
",",
"sourceVolumeType",
",",
"sourceVolumeName",
",",
"sourceSnapshotName",
")",
",",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"targetPoolName",
",",
"targetVolumeType",
",",
"targetVolumeName",
")",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"return",
"nil",
"\n",
"}"
] |
15,101 | all-15102 | [
"Notice",
"sends",
"a",
"NOTICE",
"message",
"to",
"who",
"(",
"user",
"or",
"channel",
")"
] | [
"func",
"(",
"<mask>",
"*",
"Bot",
")",
"Notice",
"(",
"who",
",",
"text",
"string",
")",
"{",
"for",
"len",
"(",
"text",
")",
">",
"400",
"{",
"bot",
".",
"Send",
"(",
"\"",
"\"",
"+",
"who",
"+",
"\"",
"\"",
"+",
"text",
"[",
":",
"400",
"]",
")",
"\n",
"text",
"=",
"text",
"[",
"400",
":",
"]",
"\n",
"}",
"\n",
"bot",
".",
"Send",
"(",
"\"",
"\"",
"+",
"who",
"+",
"\"",
"\"",
"+",
"text",
")",
"\n",
"}"
] |
15,102 | all-15103 | [
"TopologicalSort",
"does",
"topological",
"sort",
"(",
"ordering",
")",
"with",
"DFS",
".",
"It",
"returns",
"true",
"if",
"the",
"graph",
"is",
"a",
"DAG",
"(",
"no",
"cycle",
"with",
"a",
"topological",
"sort",
")",
".",
"False",
"if",
"the",
"graph",
"is",
"not",
"a",
"DAG",
"(",
"cycle",
"with",
"no",
"topological",
"sort",
")",
".",
"0",
".",
"TopologicalSort",
"(",
"G",
")",
"1",
".",
"2",
".",
"L",
"=",
"Empty",
"list",
"that",
"will",
"contain",
"the",
"sorted",
"nodes",
"3",
".",
"isDAG",
"=",
"true",
"4",
".",
"5",
".",
"for",
"each",
"vertex",
"v",
"in",
"G",
":",
"6",
".",
"7",
".",
"if",
"v",
".",
"color",
"==",
"white",
":",
"8",
".",
"9",
".",
"topologicalSortVisit",
"(",
"v",
"L",
"isDAG",
")",
"10",
".",
"11",
".",
"12",
".",
"13",
".",
"14",
".",
"topologicalSortVisit",
"(",
"v",
"L",
"isDAG",
")",
"15",
".",
"16",
".",
"if",
"v",
".",
"color",
"==",
"gray",
":",
"17",
".",
"isDAG",
"=",
"false",
"18",
".",
"return",
"19",
".",
"20",
".",
"if",
"v",
".",
"color",
"==",
"white",
":",
"21",
".",
"22",
".",
"v",
".",
"color",
"=",
"gray",
":",
"23",
".",
"24",
".",
"for",
"each",
"child",
"vertex",
"w",
"of",
"v",
":",
"25",
".",
"topologicalSortVisit",
"(",
"w",
"L",
"isDAG",
")",
"26",
".",
"27",
".",
"v",
".",
"color",
"=",
"black",
"28",
".",
"L",
".",
"push_front",
"(",
"v",
")"
] | [
"func",
"TopologicalSort",
"(",
"g",
"Graph",
")",
"(",
"[",
"]",
"ID",
",",
"bool",
")",
"{",
"// L = Empty list that will contain the sorted nodes",
"L",
":=",
"[",
"]",
"ID",
"{",
"}",
"\n",
"isDAG",
":=",
"true",
"\n",
"color",
":=",
"make",
"(",
"map",
"[",
"ID",
"]",
"string",
")",
"\n",
"for",
"v",
":=",
"<mask>",
"g",
".",
"GetNodes",
"(",
")",
"{",
"color",
"[",
"v",
"]",
"=",
"\"",
"\"",
"\n",
"}",
"\n\n",
"// for each vertex v in G:",
"for",
"v",
":=",
"range",
"g",
".",
"GetNodes",
"(",
")",
"{",
"// if v.color == \"white\":",
"if",
"color",
"[",
"v",
"]",
"==",
"\"",
"\"",
"{",
"// topologicalSortVisit(v, L, isDAG)",
"topologicalSortVisit",
"(",
"g",
",",
"v",
",",
"&",
"L",
",",
"&",
"isDAG",
",",
"&",
"color",
")",
"\n",
"}",
"\n",
"}",
"\n\n",
"return",
"L",
",",
"isDAG",
"\n",
"}"
] |
15,103 | all-15104 | [
"Query",
"runs",
"the",
"given",
"query",
"against",
"the",
"server",
"with",
"the",
"given",
"options",
".",
"Pass",
"nil",
"for",
"default",
"options",
"."
] | [
"func",
"(",
"c",
"*",
"Client",
")",
"Query",
"(",
"query",
"PQLQuery",
",",
"options",
"...",
"interface",
"{",
"}",
")",
"(",
"*",
"QueryResponse",
",",
"error",
")",
"{",
"span",
":=",
"c",
".",
"tracer",
".",
"StartSpan",
"(",
"\"",
"\"",
")",
"\n",
"defer",
"span",
".",
"Finish",
"(",
")",
"\n\n",
"if",
"err",
":=",
"query",
".",
"Error",
"(",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"queryOptions",
":=",
"&",
"QueryOptions",
"{",
"}",
"\n",
"err",
":=",
"queryOptions",
".",
"addOptions",
"(",
"options",
"...",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"serializedQuery",
":=",
"query",
".",
"Serialize",
"(",
")",
"\n",
"data",
",",
"err",
":=",
"makeRequestData",
"(",
"serializedQuery",
".",
"String",
"(",
")",
",",
"queryOptions",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"errors",
".",
"Wrap",
"(",
"err",
",",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"useCoordinator",
":=",
"serializedQuery",
".",
"HasWriteKeys",
"(",
")",
"\n",
"path",
":=",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"<mask>",
".",
"Index",
"(",
")",
".",
"name",
")",
"\n",
"_",
",",
"buf",
",",
"err",
":=",
"c",
".",
"httpRequest",
"(",
"\"",
"\"",
",",
"path",
",",
"data",
",",
"defaultProtobufHeaders",
"(",
")",
",",
"useCoordinator",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"iqr",
":=",
"&",
"pbuf",
".",
"QueryResponse",
"{",
"}",
"\n",
"err",
"=",
"proto",
".",
"Unmarshal",
"(",
"buf",
",",
"iqr",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"queryResponse",
",",
"err",
":=",
"newQueryResponseFromInternal",
"(",
"iqr",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"return",
"queryResponse",
",",
"nil",
"\n",
"}"
] |
15,104 | all-15105 | [
"export",
"FileSequence_InvertedFrameRange"
] | [
"func",
"FileSequence_InvertedFrameRange",
"(",
"id",
"FileSeqId",
")",
"*",
"C",
".",
"char",
"{",
"fs",
",",
"<mask>",
":=",
"sFileSeqs",
".",
"Get",
"(",
"id",
")",
"\n",
"// caller must free string",
"if",
"!",
"ok",
"{",
"return",
"C",
".",
"CString",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"return",
"C",
".",
"CString",
"(",
"fs",
".",
"InvertedFrameRange",
"(",
")",
")",
"\n",
"}"
] |
15,105 | all-15106 | [
"Do",
"executes",
"Profiler",
".",
"startPreciseCoverage",
"against",
"the",
"provided",
"context",
"."
] | [
"func",
"(",
"p",
"*",
"StartPreciseCoverageParams",
")",
"Do",
"(",
"ctx",
"context",
".",
"<mask>",
")",
"(",
"err",
"error",
")",
"{",
"return",
"cdp",
".",
"Execute",
"(",
"ctx",
",",
"CommandStartPreciseCoverage",
",",
"p",
",",
"nil",
")",
"\n",
"}"
] |
15,106 | all-15107 | [
"SetModuleSpec",
"sets",
"the",
"comma",
"-",
"separated",
"list",
"of",
"pattern",
"=",
"N",
"settings",
"for",
"file",
"-",
"filtered",
"logging"
] | [
"func",
"(",
"l",
"*",
"Log",
")",
"SetVModule",
"(",
"<mask>",
"ModuleSpec",
")",
"{",
"l",
".",
"mu",
".",
"Lock",
"(",
")",
"\n",
"defer",
"l",
".",
"mu",
".",
"Unlock",
"(",
")",
"\n",
"l",
".",
"setVState",
"(",
"l",
".",
"verbosity",
",",
"spec",
".",
"filter",
",",
"nil",
",",
"true",
")",
"\n",
"}"
] |
15,107 | all-15108 | [
"NewTime",
"creates",
"a",
"new",
"Time",
"."
] | [
"func",
"NewTime",
"(",
"t",
"<mask>",
".",
"Time",
",",
"valid",
"bool",
")",
"Time",
"{",
"return",
"Time",
"{",
"Time",
":",
"t",
",",
"Valid",
":",
"valid",
",",
"}",
"\n",
"}"
] |
15,108 | all-15109 | [
"NodeID",
"returns",
"a",
"slice",
"of",
"a",
"copy",
"of",
"the",
"current",
"Node",
"ID",
"setting",
"the",
"Node",
"ID",
"if",
"not",
"already",
"set",
"."
] | [
"func",
"NodeID",
"(",
")",
"[",
"]",
"<mask>",
"{",
"defer",
"nodeMu",
".",
"Unlock",
"(",
")",
"\n",
"nodeMu",
".",
"Lock",
"(",
")",
"\n",
"if",
"nodeID",
"==",
"zeroID",
"{",
"setNodeInterface",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"nid",
":=",
"nodeID",
"\n",
"return",
"nid",
"[",
":",
"]",
"\n",
"}"
] |
15,109 | all-15110 | [
"ContainerNodeMove",
"changes",
"the",
"node",
"associated",
"with",
"a",
"container",
".",
"It",
"s",
"meant",
"to",
"be",
"used",
"when",
"moving",
"a",
"non",
"-",
"running",
"container",
"backed",
"by",
"ceph",
"from",
"one",
"cluster",
"node",
"to",
"another",
"."
] | [
"func",
"(",
"c",
"*",
"ClusterTx",
")",
"ContainerNodeMove",
"(",
"oldName",
",",
"newName",
",",
"newNode",
"string",
")",
"error",
"{",
"// First check that the container to be moved is backed by a ceph",
"// volume.",
"poolName",
",",
"err",
":=",
"c",
".",
"ContainerPool",
"(",
"\"",
"\"",
",",
"oldName",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"errors",
".",
"Wrap",
"(",
"err",
",",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"poolID",
",",
"err",
":=",
"c",
".",
"StoragePoolID",
"(",
"poolName",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"errors",
".",
"Wrap",
"(",
"err",
",",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"poolDriver",
",",
"err",
":=",
"c",
".",
"StoragePoolDriver",
"(",
"poolID",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"errors",
".",
"Wrap",
"(",
"err",
",",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"if",
"poolDriver",
"!=",
"\"",
"\"",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"// Update the name of the container and of its snapshots, and the node",
"// ID they are associated with.",
"containerID",
",",
"err",
":=",
"c",
".",
"ContainerID",
"(",
"\"",
"\"",
",",
"oldName",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"errors",
".",
"Wrap",
"(",
"err",
",",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"snapshots",
",",
"err",
":=",
"c",
".",
"SnapshotIDsAndNames",
"(",
"oldName",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"errors",
".",
"Wrap",
"(",
"err",
",",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"node",
",",
"err",
":=",
"c",
".",
"NodeByName",
"(",
"newNode",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"errors",
".",
"Wrap",
"(",
"err",
",",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"stmt",
":=",
"\"",
"\"",
"\n",
"result",
",",
"err",
":=",
"c",
".",
"tx",
".",
"Exec",
"(",
"stmt",
",",
"node",
".",
"ID",
",",
"newName",
",",
"containerID",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"errors",
".",
"Wrap",
"(",
"err",
",",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"n",
",",
"err",
":=",
"result",
".",
"RowsAffected",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"<mask>",
".",
"Wrap",
"(",
"err",
",",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"if",
"n",
"!=",
"1",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"n",
")",
"\n",
"}",
"\n",
"for",
"snapshotID",
",",
"snapshotName",
":=",
"range",
"snapshots",
"{",
"newSnapshotName",
":=",
"newName",
"+",
"shared",
".",
"SnapshotDelimiter",
"+",
"snapshotName",
"\n",
"stmt",
":=",
"\"",
"\"",
"\n",
"result",
",",
"err",
":=",
"c",
".",
"tx",
".",
"Exec",
"(",
"stmt",
",",
"node",
".",
"ID",
",",
"newSnapshotName",
",",
"snapshotID",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"errors",
".",
"Wrap",
"(",
"err",
",",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"n",
",",
"err",
":=",
"result",
".",
"RowsAffected",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"errors",
".",
"Wrap",
"(",
"err",
",",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"if",
"n",
"!=",
"1",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"n",
")",
"\n",
"}",
"\n",
"}",
"\n\n",
"// No need to update storage_volumes if the name is identical",
"if",
"newName",
"==",
"oldName",
"{",
"return",
"nil",
"\n",
"}",
"\n\n",
"// Update the container's and snapshots' storage volume name (since this is ceph,",
"// there's a clone of the volume for each node).",
"count",
",",
"err",
":=",
"c",
".",
"NodesCount",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"errors",
".",
"Wrap",
"(",
"err",
",",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"stmt",
"=",
"\"",
"\"",
"\n",
"result",
",",
"err",
"=",
"c",
".",
"tx",
".",
"Exec",
"(",
"stmt",
",",
"newName",
",",
"oldName",
",",
"poolID",
",",
"StoragePoolVolumeTypeContainer",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"errors",
".",
"Wrap",
"(",
"err",
",",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"n",
",",
"err",
"=",
"result",
".",
"RowsAffected",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"errors",
".",
"Wrap",
"(",
"err",
",",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"if",
"n",
"!=",
"int64",
"(",
"count",
")",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"n",
")",
"\n",
"}",
"\n",
"for",
"_",
",",
"snapshotName",
":=",
"range",
"snapshots",
"{",
"oldSnapshotName",
":=",
"oldName",
"+",
"shared",
".",
"SnapshotDelimiter",
"+",
"snapshotName",
"\n",
"newSnapshotName",
":=",
"newName",
"+",
"shared",
".",
"SnapshotDelimiter",
"+",
"snapshotName",
"\n",
"stmt",
":=",
"\"",
"\"",
"\n",
"result",
",",
"err",
":=",
"c",
".",
"tx",
".",
"Exec",
"(",
"stmt",
",",
"newSnapshotName",
",",
"oldSnapshotName",
",",
"poolID",
",",
"StoragePoolVolumeTypeContainer",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"errors",
".",
"Wrap",
"(",
"err",
",",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"n",
",",
"err",
"=",
"result",
".",
"RowsAffected",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"errors",
".",
"Wrap",
"(",
"err",
",",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"if",
"n",
"!=",
"int64",
"(",
"count",
")",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"n",
")",
"\n",
"}",
"\n",
"}",
"\n\n",
"return",
"nil",
"\n",
"}"
] |
15,110 | all-15111 | [
"Fields",
"return",
"a",
"copy",
"of",
"the",
"fields",
"in",
"this",
"index"
] | [
"func",
"(",
"idx",
"*",
"Index",
")",
"Fields",
"(",
")",
"map",
"[",
"string",
"]",
"*",
"Field",
"{",
"result",
":=",
"make",
"(",
"map",
"[",
"string",
"]",
"*",
"Field",
")",
"\n",
"for",
"k",
",",
"v",
":=",
"range",
"idx",
".",
"fields",
"{",
"result",
"[",
"k",
"]",
"=",
"v",
".",
"copy",
"(",
")",
"\n",
"}",
"\n",
"return",
"<mask>",
"\n",
"}"
] |
15,111 | all-15112 | [
"ScrollToMark",
"is",
"a",
"wrapper",
"around",
"gtk_text_view_scroll_to_mark",
"()",
"."
] | [
"func",
"(",
"v",
"*",
"TextView",
")",
"ScrollToMark",
"(",
"<mask>",
"*",
"TextMark",
",",
"within_margin",
"float64",
",",
"use_align",
"bool",
",",
"xalign",
",",
"yalign",
"float64",
")",
"{",
"C",
".",
"gtk_text_view_scroll_to_mark",
"(",
"v",
".",
"native",
"(",
")",
",",
"mark",
".",
"native",
"(",
")",
",",
"C",
".",
"gdouble",
"(",
"within_margin",
")",
",",
"gbool",
"(",
"use_align",
")",
",",
"C",
".",
"gdouble",
"(",
"xalign",
")",
",",
"C",
".",
"gdouble",
"(",
"yalign",
")",
")",
"\n",
"}"
] |
15,112 | all-15113 | [
"New",
"returns",
"plain",
"glg",
"instance"
] | [
"func",
"New",
"(",
")",
"*",
"Glg",
"{",
"g",
":=",
"&",
"Glg",
"{",
"levelCounter",
":",
"new",
"(",
"uint32",
")",
",",
"buffer",
":",
"sync",
".",
"Pool",
"{",
"New",
":",
"func",
"(",
")",
"<mask>",
"{",
"}",
"{",
"return",
"bytes",
".",
"NewBuffer",
"(",
"make",
"(",
"[",
"]",
"byte",
",",
"0",
",",
"bufferSize",
")",
")",
"\n",
"}",
",",
"}",
",",
"}",
"\n\n",
"atomic",
".",
"StoreUint32",
"(",
"g",
".",
"levelCounter",
",",
"uint32",
"(",
"FATAL",
")",
")",
"\n\n",
"for",
"lev",
",",
"log",
":=",
"range",
"map",
"[",
"LEVEL",
"]",
"*",
"logger",
"{",
"// standard out",
"PRINT",
":",
"{",
"std",
":",
"os",
".",
"Stdout",
",",
"color",
":",
"Colorless",
",",
"isColor",
":",
"true",
",",
"mode",
":",
"STD",
",",
"}",
",",
"LOG",
":",
"{",
"std",
":",
"os",
".",
"Stdout",
",",
"color",
":",
"Colorless",
",",
"isColor",
":",
"true",
",",
"mode",
":",
"STD",
",",
"}",
",",
"INFO",
":",
"{",
"std",
":",
"os",
".",
"Stdout",
",",
"color",
":",
"Green",
",",
"isColor",
":",
"true",
",",
"mode",
":",
"STD",
",",
"}",
",",
"DEBG",
":",
"{",
"std",
":",
"os",
".",
"Stdout",
",",
"color",
":",
"Purple",
",",
"isColor",
":",
"true",
",",
"mode",
":",
"STD",
",",
"}",
",",
"OK",
":",
"{",
"std",
":",
"os",
".",
"Stdout",
",",
"color",
":",
"Cyan",
",",
"isColor",
":",
"true",
",",
"mode",
":",
"STD",
",",
"}",
",",
"WARN",
":",
"{",
"std",
":",
"os",
".",
"Stdout",
",",
"color",
":",
"Orange",
",",
"isColor",
":",
"true",
",",
"mode",
":",
"STD",
",",
"}",
",",
"// error out",
"ERR",
":",
"{",
"std",
":",
"os",
".",
"Stderr",
",",
"color",
":",
"Red",
",",
"isColor",
":",
"true",
",",
"mode",
":",
"STD",
",",
"}",
",",
"FAIL",
":",
"{",
"std",
":",
"os",
".",
"Stderr",
",",
"color",
":",
"Red",
",",
"isColor",
":",
"true",
",",
"mode",
":",
"STD",
",",
"}",
",",
"FATAL",
":",
"{",
"std",
":",
"os",
".",
"Stderr",
",",
"color",
":",
"Red",
",",
"isColor",
":",
"true",
",",
"mode",
":",
"STD",
",",
"}",
",",
"}",
"{",
"log",
".",
"tag",
"=",
"lev",
".",
"String",
"(",
")",
"\n",
"log",
".",
"updateMode",
"(",
")",
"\n",
"g",
".",
"logger",
".",
"Store",
"(",
"lev",
",",
"log",
")",
"\n",
"}",
"\n\n",
"return",
"g",
"\n",
"}"
] |
15,113 | all-15114 | [
"Do",
"executes",
"Log",
".",
"stopViolationsReport",
"against",
"the",
"provided",
"context",
"."
] | [
"func",
"(",
"p",
"*",
"StopViolationsReportParams",
")",
"Do",
"(",
"ctx",
"<mask>",
".",
"Context",
")",
"(",
"err",
"error",
")",
"{",
"return",
"cdp",
".",
"Execute",
"(",
"ctx",
",",
"CommandStopViolationsReport",
",",
"nil",
",",
"nil",
")",
"\n",
"}"
] |
15,114 | all-15115 | [
"WithToStep",
"the",
"last",
"step",
"to",
"replay",
"to",
"(",
"replay",
"till",
"the",
"end",
"if",
"not",
"specified",
")",
"."
] | [
"func",
"(",
"p",
"ReplaySnapshotParams",
")",
"WithToStep",
"(",
"toStep",
"int64",
")",
"*",
"ReplaySnapshotParams",
"{",
"p",
".",
"ToStep",
"=",
"toStep",
"\n",
"<mask>",
"&",
"p",
"\n",
"}"
] |
15,115 | all-15116 | [
"Mv",
"renames",
"a",
"file",
"or",
"directory",
"in",
"the",
"guest",
"operating",
"system",
".",
"Parameters",
":",
"path1",
":",
"The",
"path",
"to",
"the",
"file",
"to",
"be",
"renamed",
".",
"path2",
":",
"The",
"path",
"to",
"the",
"new",
"file",
".",
"Remarks",
":",
"*",
"Only",
"absolute",
"paths",
"should",
"be",
"used",
"for",
"files",
"in",
"the",
"guest",
";",
"the",
"resolution",
"of",
"relative",
"paths",
"is",
"not",
"specified",
".",
"*",
"On",
"Windows",
"guests",
"it",
"fails",
"on",
"directory",
"moves",
"when",
"the",
"destination",
"is",
"on",
"a",
"different",
"volume",
".",
"*",
"Because",
"of",
"the",
"differences",
"in",
"how",
"various",
"operating",
"systems",
"handle",
"filenames",
"Vix",
"may",
"return",
"either",
"VIX_E_INVALID_ARG",
"or",
"VIX_E_FILE_NAME_TOO_LONG",
"for",
"filenames",
"longer",
"than",
"255",
"characters",
".",
"Since",
"VMware",
"Workstation",
"6",
".",
"0",
"Minimum",
"Supported",
"Guest",
"OS",
":",
"Microsoft",
"Windows",
"NT",
"Series",
"Linux"
] | [
"func",
"(",
"g",
"*",
"Guest",
")",
"Mv",
"(",
"path1",
",",
"path2",
"string",
")",
"error",
"{",
"var",
"jobHandle",
"C",
".",
"VixHandle",
"=",
"C",
".",
"VIX_INVALID_HANDLE",
"\n",
"var",
"err",
"C",
".",
"VixError",
"=",
"C",
".",
"VIX_OK",
"\n\n",
"cpath1",
":=",
"C",
".",
"CString",
"(",
"path1",
")",
"\n",
"cpath2",
":=",
"C",
".",
"CString",
"(",
"path2",
")",
"\n",
"defer",
"C",
".",
"free",
"(",
"unsafe",
".",
"Pointer",
"(",
"cpath1",
")",
")",
"\n",
"defer",
"C",
".",
"free",
"(",
"unsafe",
".",
"Pointer",
"(",
"cpath2",
")",
")",
"\n\n",
"jobHandle",
"=",
"C",
".",
"VixVM_RenameFileInGuest",
"(",
"g",
".",
"handle",
",",
"cpath1",
",",
"//oldName",
"cpath2",
",",
"//newName",
"0",
",",
"//options",
"C",
".",
"VIX_INVALID_HANDLE",
",",
"//propertyListHandle",
"nil",
",",
"//callbackProc",
"nil",
")",
"//clientData",
"\n\n",
"defer",
"C",
".",
"Vix_ReleaseHandle",
"(",
"jobHandle",
")",
"\n\n",
"err",
"=",
"C",
".",
"vix_job_wait",
"(",
"jobHandle",
")",
"\n",
"if",
"C",
".",
"VIX_OK",
"!=",
"err",
"{",
"return",
"&",
"Error",
"{",
"<mask>",
":",
"\"",
"\"",
",",
"Code",
":",
"int",
"(",
"err",
"&",
"0xFFFF",
")",
",",
"Text",
":",
"C",
".",
"GoString",
"(",
"C",
".",
"Vix_GetErrorText",
"(",
"err",
",",
"nil",
")",
")",
",",
"}",
"\n",
"}",
"\n\n",
"return",
"nil",
"\n",
"}"
] |
15,116 | all-15117 | [
"Specify",
"the",
"value",
"of",
"a",
"uniform",
"variable",
"for",
"the",
"current",
"program",
"object"
] | [
"func",
"Uniform3fv",
"(",
"location",
"int32",
",",
"count",
"int32",
",",
"value",
"*",
"float32",
")",
"{",
"C",
".",
"glowUniform3fv",
"(",
"gpUniform3fv",
",",
"(",
"C",
".",
"GLint",
")",
"(",
"<mask>",
")",
",",
"(",
"C",
".",
"GLsizei",
")",
"(",
"count",
")",
",",
"(",
"*",
"C",
".",
"GLfloat",
")",
"(",
"unsafe",
".",
"Pointer",
"(",
"value",
")",
")",
")",
"\n",
"}"
] |
15,117 | all-15118 | [
"CopyFileToGuest",
"copies",
"a",
"file",
"or",
"directory",
"from",
"the",
"local",
"system",
"(",
"where",
"the",
"Vix",
"client",
"is",
"running",
")",
"to",
"the",
"guest",
"operating",
"system",
".",
"Parameters",
":",
"src",
":",
"The",
"path",
"name",
"of",
"a",
"file",
"on",
"a",
"file",
"system",
"available",
"to",
"the",
"Vix",
"client",
".",
"guest",
":",
"Guest",
"instance",
"where",
"the",
"file",
"is",
"going",
"to",
"be",
"copied",
"to",
"dest",
":",
"The",
"path",
"name",
"of",
"a",
"file",
"on",
"a",
"file",
"system",
"available",
"to",
"the",
"guest",
".",
"Remarks",
":",
"*",
"The",
"virtual",
"machine",
"must",
"be",
"running",
"while",
"the",
"file",
"is",
"copied",
"from",
"the",
"Vix",
"client",
"machine",
"to",
"the",
"guest",
"operating",
"system",
".",
"*",
"Existing",
"files",
"of",
"the",
"same",
"name",
"are",
"overwritten",
"and",
"folder",
"contents",
"are",
"merged",
".",
"*",
"The",
"copy",
"operation",
"requires",
"VMware",
"Tools",
"to",
"be",
"installed",
"and",
"running",
"in",
"the",
"guest",
"operating",
"system",
".",
"*",
"You",
"must",
"call",
"VM",
".",
"LoginInGuest",
"()",
"before",
"calling",
"this",
"function",
"in",
"order",
"to",
"get",
"a",
"Guest",
"instance",
".",
"*",
"The",
"format",
"of",
"the",
"file",
"name",
"depends",
"on",
"the",
"guest",
"or",
"local",
"operating",
"system",
".",
"For",
"example",
"a",
"path",
"name",
"for",
"a",
"Microsoft",
"Windows",
"guest",
"or",
"host",
"requires",
"backslash",
"as",
"a",
"directory",
"separator",
"whereas",
"a",
"Linux",
"guest",
"or",
"host",
"requires",
"a",
"forward",
"slash",
".",
"If",
"the",
"path",
"name",
"includes",
"backslash",
"characters",
"you",
"need",
"to",
"precede",
"each",
"one",
"with",
"an",
"escape",
"character",
".",
"*",
"Only",
"absolute",
"paths",
"should",
"be",
"used",
"for",
"files",
"in",
"the",
"guest",
";",
"the",
"resolution",
"of",
"relative",
"paths",
"is",
"not",
"specified",
".",
"*",
"If",
"any",
"file",
"fails",
"to",
"be",
"copied",
"Vix",
"aborts",
"the",
"operation",
"does",
"not",
"attempt",
"to",
"copy",
"the",
"remaining",
"files",
"and",
"returns",
"an",
"error",
".",
"*",
"In",
"order",
"to",
"copy",
"a",
"file",
"to",
"a",
"mapped",
"network",
"drive",
"in",
"a",
"Windows",
"guest",
"operating",
"system",
"it",
"is",
"necessary",
"to",
"call",
"VixVM_LoginInGuest",
"()",
"with",
"the",
"LOGIN_IN_GUEST_REQUIRE_INTERACTIVE_ENVIRONMENT",
"flag",
"set",
".",
"Using",
"the",
"interactive",
"session",
"option",
"incurs",
"an",
"overhead",
"in",
"file",
"transfer",
"speed",
".",
"Since",
"VMware",
"Server",
"1",
".",
"0",
"Minimum",
"Supported",
"Guest",
"OS",
":",
"Microsoft",
"Windows",
"NT",
"Series",
"Linux"
] | [
"func",
"(",
"h",
"*",
"Host",
")",
"CopyFileToGuest",
"(",
"src",
"string",
",",
"guest",
"*",
"Guest",
",",
"dest",
"string",
")",
"error",
"{",
"var",
"jobHandle",
"C",
".",
"VixHandle",
"=",
"C",
".",
"VIX_INVALID_HANDLE",
"\n",
"var",
"err",
"C",
".",
"VixError",
"=",
"C",
".",
"VIX_OK",
"\n\n",
"csrc",
":=",
"C",
".",
"CString",
"(",
"src",
")",
"\n",
"cdest",
":=",
"C",
".",
"CString",
"(",
"dest",
")",
"\n",
"defer",
"C",
".",
"free",
"(",
"unsafe",
".",
"Pointer",
"(",
"csrc",
")",
")",
"\n",
"defer",
"C",
".",
"free",
"(",
"unsafe",
".",
"Pointer",
"(",
"cdest",
")",
")",
"\n\n",
"jobHandle",
"=",
"C",
".",
"VixVM_CopyFileFromHostToGuest",
"(",
"guest",
".",
"<mask>",
",",
"// VM handle",
"csrc",
",",
"// src name",
"cdest",
",",
"// dest name",
"C",
".",
"int",
"(",
"0",
")",
",",
"// options",
"C",
".",
"VIX_INVALID_HANDLE",
",",
"// propertyListHandle",
"nil",
",",
"// callbackProc",
"nil",
")",
"// clientData",
"\n\n",
"defer",
"C",
".",
"Vix_ReleaseHandle",
"(",
"jobHandle",
")",
"\n\n",
"err",
"=",
"C",
".",
"vix_job_wait",
"(",
"jobHandle",
")",
"\n",
"if",
"C",
".",
"VIX_OK",
"!=",
"err",
"{",
"return",
"&",
"Error",
"{",
"Operation",
":",
"\"",
"\"",
",",
"Code",
":",
"int",
"(",
"err",
"&",
"0xFFFF",
")",
",",
"Text",
":",
"C",
".",
"GoString",
"(",
"C",
".",
"Vix_GetErrorText",
"(",
"err",
",",
"nil",
")",
")",
",",
"}",
"\n",
"}",
"\n\n",
"return",
"nil",
"\n",
"}"
] |
15,118 | all-15119 | [
"OOMEventFD",
"mocks",
"base",
"method"
] | [
"func",
"(",
"m",
"*",
"MockCgroup",
")",
"OOMEventFD",
"(",
")",
"(",
"uintptr",
",",
"error",
")",
"{",
"ret",
":=",
"m",
".",
"ctrl",
".",
"Call",
"(",
"m",
",",
"\"",
"\"",
")",
"\n",
"ret0",
",",
"_",
":=",
"<mask>",
"[",
"0",
"]",
".",
"(",
"uintptr",
")",
"\n",
"ret1",
",",
"_",
":=",
"ret",
"[",
"1",
"]",
".",
"(",
"error",
")",
"\n",
"return",
"ret0",
",",
"ret1",
"\n",
"}"
] |
15,119 | all-15120 | [
"AskPasswordOnce",
"asks",
"the",
"user",
"to",
"enter",
"a",
"password",
".",
"It",
"s",
"the",
"same",
"as",
"AskPassword",
"but",
"it",
"won",
"t",
"ask",
"to",
"enter",
"it",
"again",
"."
] | [
"func",
"AskPasswordOnce",
"(",
"<mask>",
"string",
")",
"string",
"{",
"fmt",
".",
"Printf",
"(",
"question",
")",
"\n",
"pwd",
",",
"_",
":=",
"terminal",
".",
"ReadPassword",
"(",
"0",
")",
"\n",
"fmt",
".",
"Println",
"(",
"\"",
"\"",
")",
"\n\n",
"return",
"string",
"(",
"pwd",
")",
"\n",
"}"
] |
15,120 | all-15121 | [
"getJenkinsJobs",
"returns",
"all",
"the",
"Jenkins",
"jobs",
"for",
"all",
"active",
"prowjobs",
"from",
"the",
"provided",
"list",
".",
"It",
"handles",
"deduplication",
"."
] | [
"func",
"getJenkinsJobs",
"(",
"pjs",
"[",
"]",
"prowapi",
".",
"ProwJob",
")",
"[",
"]",
"BuildQueryParams",
"{",
"jenkinsJobs",
":=",
"[",
"]",
"BuildQueryParams",
"{",
"}",
"\n\n",
"for",
"_",
",",
"pj",
":=",
"range",
"pjs",
"{",
"if",
"pj",
".",
"Complete",
"(",
")",
"{",
"continue",
"\n",
"}",
"\n\n",
"jenkinsJobs",
"=",
"append",
"(",
"jenkinsJobs",
",",
"BuildQueryParams",
"{",
"JobName",
":",
"getJobName",
"(",
"&",
"pj",
".",
"Spec",
")",
",",
"ProwJobID",
":",
"pj",
".",
"<mask>",
",",
"}",
")",
"\n",
"}",
"\n\n",
"return",
"jenkinsJobs",
"\n",
"}"
] |
15,121 | all-15122 | [
"WriteTarget",
"writes",
"the",
"given",
"endpoint",
"to",
"the",
"target",
"file",
"."
] | [
"func",
"WriteTarget",
"(",
"t",
"string",
")",
"error",
"{",
"targetPath",
":=",
"JoinWithUserDir",
"(",
"\"",
"\"",
",",
"\"",
"\"",
")",
"\n",
"targetFile",
",",
"err",
":=",
"filesystem",
"(",
")",
".",
"OpenFile",
"(",
"targetPath",
",",
"syscall",
".",
"O_WRONLY",
"|",
"syscall",
".",
"O_CREAT",
"|",
"syscall",
".",
"O_TRUNC",
",",
"0600",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"defer",
"targetFile",
".",
"Close",
"(",
")",
"\n",
"n",
",",
"err",
":=",
"targetFile",
".",
"WriteString",
"(",
"t",
")",
"\n",
"if",
"n",
"!=",
"len",
"(",
"t",
")",
"||",
"err",
"!=",
"nil",
"{",
"return",
"<mask>",
".",
"New",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
] |
15,122 | all-15123 | [
"Create",
"replaces",
"the",
"stored",
"snapshot",
"with",
"a",
"new",
"one",
"using",
"the",
"given",
"args"
] | [
"func",
"(",
"m",
"*",
"InmemSnapshotStore",
")",
"Create",
"(",
"version",
"SnapshotVersion",
",",
"index",
",",
"term",
"uint64",
",",
"configuration",
"Configuration",
",",
"configurationIndex",
"uint64",
",",
"trans",
"Transport",
")",
"(",
"SnapshotSink",
",",
"error",
")",
"{",
"// We only support version 1 snapshots at this time.",
"if",
"version",
"!=",
"1",
"{",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"version",
")",
"\n",
"}",
"\n\n",
"<mask>",
":=",
"snapshotName",
"(",
"term",
",",
"index",
")",
"\n\n",
"m",
".",
"Lock",
"(",
")",
"\n",
"defer",
"m",
".",
"Unlock",
"(",
")",
"\n\n",
"sink",
":=",
"&",
"InmemSnapshotSink",
"{",
"meta",
":",
"SnapshotMeta",
"{",
"Version",
":",
"version",
",",
"ID",
":",
"name",
",",
"Index",
":",
"index",
",",
"Term",
":",
"term",
",",
"Peers",
":",
"encodePeers",
"(",
"configuration",
",",
"trans",
")",
",",
"Configuration",
":",
"configuration",
",",
"ConfigurationIndex",
":",
"configurationIndex",
",",
"}",
",",
"contents",
":",
"&",
"bytes",
".",
"Buffer",
"{",
"}",
",",
"}",
"\n",
"m",
".",
"hasSnapshot",
"=",
"true",
"\n",
"m",
".",
"latest",
"=",
"sink",
"\n\n",
"return",
"sink",
",",
"nil",
"\n",
"}"
] |
15,123 | all-15124 | [
"CollectionFromDatabase",
"..."
] | [
"func",
"(",
"m",
"*",
"Connection",
")",
"CollectionFromDatabase",
"(",
"name",
"string",
",",
"database",
"string",
")",
"*",
"Collection",
"{",
"// Just create a new instance - it's cheap and only has name and a database name",
"return",
"&",
"Collection",
"{",
"Connection",
":",
"m",
",",
"Context",
":",
"m",
".",
"<mask>",
",",
"Database",
":",
"database",
",",
"Name",
":",
"name",
",",
"}",
"\n",
"}"
] |
15,124 | all-15125 | [
"See",
"bcd",
".",
"Tracer",
".",
"AddCallerGo",
"()",
"."
] | [
"func",
"(",
"t",
"*",
"BTTracer",
")",
"AddCallerGo",
"(",
"<mask>",
"[",
"]",
"string",
",",
"goid",
"int",
")",
"[",
"]",
"string",
"{",
"moduleOpt",
":=",
"\"",
"\"",
"+",
"strconv",
".",
"Itoa",
"(",
"goid",
")",
"\n",
"return",
"t",
".",
"AppendOptionWithPrefix",
"(",
"options",
",",
"\"",
"\"",
",",
"moduleOpt",
")",
"\n",
"}"
] |
15,125 | all-15126 | [
"newProgressPool",
"creates",
"a",
"*",
"mpb",
".",
"Progress",
"and",
"a",
"cleanup",
"function",
".",
"The",
"caller",
"must",
"eventually",
"call",
"the",
"returned",
"cleanup",
"function",
"after",
"the",
"pool",
"will",
"no",
"longer",
"be",
"updated",
"."
] | [
"func",
"(",
"c",
"*",
"copier",
")",
"newProgressPool",
"(",
"ctx",
"context",
".",
"<mask>",
")",
"(",
"*",
"mpb",
".",
"Progress",
",",
"func",
"(",
")",
")",
"{",
"ctx",
",",
"cancel",
":=",
"context",
".",
"WithCancel",
"(",
"ctx",
")",
"\n",
"pool",
":=",
"mpb",
".",
"New",
"(",
"mpb",
".",
"WithWidth",
"(",
"40",
")",
",",
"mpb",
".",
"WithOutput",
"(",
"c",
".",
"progressOutput",
")",
",",
"mpb",
".",
"WithContext",
"(",
"ctx",
")",
")",
"\n",
"return",
"pool",
",",
"func",
"(",
")",
"{",
"cancel",
"(",
")",
"\n",
"pool",
".",
"Wait",
"(",
")",
"\n",
"}",
"\n",
"}"
] |
15,126 | all-15127 | [
"newHTMLComment",
"creates",
"and",
"returns",
"an",
"HTML",
"comment",
"."
] | [
"func",
"newHTMLComment",
"(",
"ln",
"*",
"line",
",",
"rslt",
"*",
"<mask>",
",",
"src",
"*",
"source",
",",
"parent",
"element",
",",
"opts",
"*",
"Options",
")",
"*",
"htmlComment",
"{",
"return",
"&",
"htmlComment",
"{",
"elementBase",
":",
"newElementBase",
"(",
"ln",
",",
"rslt",
",",
"src",
",",
"parent",
",",
"opts",
")",
",",
"}",
"\n",
"}"
] |
15,127 | all-15128 | [
"GetActionStateType",
"is",
"a",
"wrapper",
"around",
"g_action_group_get_action_state_type",
"()",
"."
] | [
"func",
"(",
"v",
"*",
"ActionGroup",
")",
"GetActionStateType",
"(",
"actionName",
"string",
")",
"*",
"VariantType",
"{",
"c",
":=",
"C",
".",
"g_action_group_get_action_state_type",
"(",
"v",
".",
"native",
"(",
")",
",",
"(",
"*",
"C",
".",
"gchar",
")",
"(",
"C",
".",
"CString",
"(",
"actionName",
")",
")",
")",
"\n",
"if",
"c",
"==",
"nil",
"{",
"<mask>",
"nil",
"\n",
"}",
"\n",
"return",
"newVariantType",
"(",
"(",
"*",
"C",
".",
"GVariantType",
")",
"(",
"c",
")",
")",
"\n",
"}"
] |
15,128 | all-15129 | [
"Download",
"renders",
"a",
"file",
"attachment",
"automatically",
"setting",
"following",
"headers",
":",
"Content",
"-",
"Type",
"Content",
"-",
"Length",
"Content",
"-",
"Disposition",
"Content",
"-",
"Type",
"is",
"set",
"using",
"mime#TypeByExtension",
"with",
"the",
"filename",
"s",
"extension",
".",
"Content",
"-",
"Type",
"will",
"default",
"to",
"application",
"/",
"octet",
"-",
"stream",
"if",
"using",
"a",
"filename",
"with",
"an",
"unknown",
"extension",
"."
] | [
"func",
"Download",
"(",
"ctx",
"context",
".",
"Context",
",",
"<mask>",
"string",
",",
"r",
"io",
".",
"Reader",
")",
"Renderer",
"{",
"return",
"downloadRenderer",
"{",
"ctx",
":",
"ctx",
",",
"name",
":",
"name",
",",
"reader",
":",
"r",
",",
"}",
"\n",
"}"
] |
15,129 | all-15130 | [
"SetRoutingKey",
"sets",
"the",
"RoutingKey",
"call",
"options",
"(",
"rk",
"transport",
"header",
")",
"."
] | [
"func",
"(",
"cb",
"*",
"ContextBuilder",
")",
"SetRoutingKey",
"(",
"rk",
"string",
")",
"*",
"ContextBuilder",
"{",
"if",
"cb",
".",
"CallOptions",
"==",
"nil",
"{",
"cb",
".",
"CallOptions",
"=",
"<mask>",
"(",
"CallOptions",
")",
"\n",
"}",
"\n",
"cb",
".",
"CallOptions",
".",
"RoutingKey",
"=",
"rk",
"\n",
"return",
"cb",
"\n",
"}"
] |
15,130 | all-15131 | [
"NumPage",
"returns",
"the",
"number",
"of",
"pages",
"in",
"the",
"PDF",
"file",
"."
] | [
"func",
"(",
"r",
"*",
"Reader",
")",
"NumPage",
"(",
")",
"int",
"{",
"return",
"int",
"(",
"r",
".",
"Trailer",
"(",
")",
".",
"Key",
"(",
"\"",
"\"",
")",
".",
"Key",
"(",
"\"",
"\"",
")",
".",
"<mask>",
"(",
"\"",
"\"",
")",
".",
"Int64",
"(",
")",
")",
"\n",
"}"
] |
15,131 | all-15132 | [
"Read",
"a",
"mimetype",
"text",
"file",
".",
"Return",
"a",
"hash",
"map",
"from",
"ext",
"to",
"mimetype",
"."
] | [
"func",
"readMimetypes",
"(",
"filename",
"string",
")",
"(",
"map",
"[",
"string",
"]",
"string",
",",
"error",
")",
"{",
"mimetypes",
":=",
"make",
"(",
"<mask>",
"[",
"string",
"]",
"string",
")",
"\n",
"// Read the mimetype file",
"data",
",",
"err",
":=",
"ioutil",
".",
"ReadFile",
"(",
"filename",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"// For each line, store extensions and mimetypes in the hash map",
"for",
"_",
",",
"line",
":=",
"range",
"bytes",
".",
"Split",
"(",
"data",
",",
"[",
"]",
"byte",
"(",
"\"",
"\\n",
"\"",
")",
")",
"{",
"fields",
":=",
"bytes",
".",
"Fields",
"(",
"line",
")",
"\n",
"if",
"len",
"(",
"fields",
")",
">",
"1",
"{",
"for",
"_",
",",
"ext",
":=",
"range",
"fields",
"[",
"1",
":",
"]",
"{",
"mimetypes",
"[",
"string",
"(",
"ext",
")",
"]",
"=",
"string",
"(",
"fields",
"[",
"0",
"]",
")",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"mimetypes",
",",
"nil",
"\n",
"}"
] |
15,132 | all-15133 | [
"Copy",
"returns",
"a",
"copy",
"of",
"the",
"FileSequence"
] | [
"func",
"(",
"s",
"*",
"FileSequence",
")",
"Copy",
"(",
")",
"*",
"FileSequence",
"{",
"seq",
",",
"_",
":=",
"NewFileSequence",
"(",
"s",
".",
"<mask>",
"(",
")",
")",
"\n",
"return",
"seq",
"\n",
"}"
] |
15,133 | all-15134 | [
"TaskByShortID",
"retrieves",
"the",
"task",
"of",
"a",
"given",
"docker",
"short",
"container",
"id"
] | [
"func",
"(",
"state",
"*",
"DockerTaskEngineState",
")",
"TaskByShortID",
"(",
"cid",
"string",
")",
"(",
"[",
"]",
"*",
"apitask",
".",
"Task",
",",
"bool",
")",
"{",
"containerIDs",
":=",
"state",
".",
"GetAllContainerIDs",
"(",
")",
"\n",
"var",
"tasks",
"[",
"]",
"*",
"apitask",
".",
"Task",
"\n",
"for",
"_",
",",
"<mask>",
":=",
"range",
"containerIDs",
"{",
"if",
"strings",
".",
"HasPrefix",
"(",
"id",
",",
"cid",
")",
"{",
"if",
"task",
",",
"ok",
":=",
"state",
".",
"TaskByID",
"(",
"id",
")",
";",
"ok",
"{",
"tasks",
"=",
"append",
"(",
"tasks",
",",
"task",
")",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"tasks",
",",
"len",
"(",
"tasks",
")",
">",
"0",
"\n",
"}"
] |
15,134 | all-15135 | [
"ServerGroups",
"retrieves",
"a",
"list",
"of",
"all",
"server",
"groups"
] | [
"func",
"(",
"c",
"*",
"Client",
")",
"ServerGroups",
"(",
")",
"(",
"[",
"]",
"ServerGroup",
",",
"error",
")",
"{",
"var",
"groups",
"[",
"]",
"ServerGroup",
"\n",
"_",
",",
"err",
":=",
"c",
".",
"MakeApiRequest",
"(",
"\"",
"\"",
",",
"\"",
"\"",
",",
"nil",
",",
"&",
"<mask>",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"return",
"groups",
",",
"err",
"\n",
"}"
] |
15,135 | all-15136 | [
"VerifyForm",
"returns",
"a",
"handler",
"that",
"verifies",
"a",
"request",
"contains",
"the",
"specified",
"form",
"values",
".",
"The",
"request",
"must",
"contain",
"*",
"all",
"*",
"of",
"the",
"specified",
"values",
"but",
"it",
"is",
"allowed",
"to",
"have",
"additional",
"form",
"values",
"beyond",
"the",
"passed",
"in",
"set",
"."
] | [
"func",
"VerifyForm",
"(",
"values",
"url",
".",
"Values",
")",
"http",
".",
"HandlerFunc",
"{",
"return",
"func",
"(",
"w",
"http",
".",
"ResponseWriter",
",",
"r",
"*",
"<mask>",
".",
"Request",
")",
"{",
"err",
":=",
"r",
".",
"ParseForm",
"(",
")",
"\n",
"Expect",
"(",
"err",
")",
".",
"ShouldNot",
"(",
"HaveOccurred",
"(",
")",
")",
"\n",
"for",
"key",
",",
"vals",
":=",
"range",
"values",
"{",
"Expect",
"(",
"r",
".",
"Form",
"[",
"key",
"]",
")",
".",
"Should",
"(",
"Equal",
"(",
"vals",
")",
",",
"\"",
"\"",
",",
"key",
")",
"\n",
"}",
"\n",
"}",
"\n",
"}"
] |
15,136 | all-15137 | [
"StartSpanFromContext",
"starts",
"and",
"returns",
"a",
"Span",
"with",
"operationName",
"using",
"any",
"Span",
"found",
"within",
"ctx",
"as",
"a",
"ChildOfRef",
".",
"If",
"no",
"such",
"parent",
"could",
"be",
"found",
"StartSpanFromContext",
"creates",
"a",
"root",
"(",
"parentless",
")",
"Span",
".",
"The",
"second",
"return",
"value",
"is",
"a",
"context",
".",
"Context",
"object",
"built",
"around",
"the",
"returned",
"Span",
".",
"Example",
"usage",
":",
"SomeFunction",
"(",
"ctx",
"context",
".",
"Context",
"...",
")",
"{",
"sp",
"ctx",
":",
"=",
"opentracing",
".",
"StartSpanFromContext",
"(",
"ctx",
"SomeFunction",
")",
"defer",
"sp",
".",
"Finish",
"()",
"...",
"}"
] | [
"func",
"StartSpanFromContext",
"(",
"ctx",
"context",
".",
"Context",
",",
"operationName",
"string",
",",
"opts",
"...",
"StartSpanOption",
")",
"(",
"Span",
",",
"context",
".",
"<mask>",
")",
"{",
"return",
"StartSpanFromContextWithTracer",
"(",
"ctx",
",",
"GlobalTracer",
"(",
")",
",",
"operationName",
",",
"opts",
"...",
")",
"\n",
"}"
] |
15,137 | all-15138 | [
"HasGrab",
"is",
"a",
"wrapper",
"around",
"gtk_widget_has_grab",
"()",
"."
] | [
"func",
"(",
"v",
"*",
"Widget",
")",
"HasGrab",
"(",
")",
"bool",
"{",
"c",
":=",
"C",
".",
"gtk_widget_has_grab",
"(",
"v",
".",
"native",
"(",
")",
")",
"\n",
"<mask>",
"gobool",
"(",
"c",
")",
"\n",
"}"
] |
15,138 | all-15139 | [
"GetOpacity",
"is",
"a",
"wrapper",
"around",
"gtk_widget_get_opacity",
"()"
] | [
"func",
"(",
"v",
"*",
"Widget",
")",
"GetOpacity",
"(",
")",
"float64",
"{",
"c",
":=",
"C",
".",
"gtk_widget_get_opacity",
"(",
"v",
".",
"native",
"(",
")",
")",
"\n",
"<mask>",
"float64",
"(",
"c",
")",
"\n",
"}"
] |
15,139 | all-15140 | [
"SetDoOverwriteConfirmation",
"is",
"a",
"wrapper",
"around",
"gtk_file_chooser_set_do_overwrite_confirmation",
"()",
"."
] | [
"func",
"(",
"v",
"*",
"FileChooser",
")",
"SetDoOverwriteConfirmation",
"(",
"<mask>",
"bool",
")",
"{",
"C",
".",
"gtk_file_chooser_set_do_overwrite_confirmation",
"(",
"v",
".",
"native",
"(",
")",
",",
"gbool",
"(",
"value",
")",
")",
"\n",
"}"
] |
15,140 | all-15141 | [
"PeriodicSpec",
"initializes",
"a",
"ProwJobSpec",
"for",
"a",
"given",
"periodic",
"job",
"."
] | [
"func",
"PeriodicSpec",
"(",
"p",
"config",
".",
"Periodic",
")",
"prowapi",
".",
"ProwJobSpec",
"{",
"pjs",
":=",
"specFromJobBase",
"(",
"p",
".",
"JobBase",
")",
"\n",
"pjs",
".",
"<mask>",
"=",
"prowapi",
".",
"PeriodicJob",
"\n\n",
"return",
"pjs",
"\n",
"}"
] |
15,141 | all-15142 | [
"NewProtector",
"constructs",
"a",
"middleware",
"that",
"implements",
"basic",
"protection",
"measures",
"for",
"the",
"passed",
"endpoint",
".",
"Currently",
"the",
"protector",
"limits",
"the",
"body",
"size",
"to",
"a",
"the",
"passed",
"length",
"and",
"automatically",
"handles",
"CORS",
"using",
"the",
"specified",
"options",
".",
"Note",
":",
"Place",
"the",
"protector",
"as",
"early",
"as",
"possible",
"in",
"the",
"handler",
"chain",
"."
] | [
"func",
"NewProtector",
"(",
"maxBody",
"string",
",",
"corsOptions",
"cors",
".",
"Options",
")",
"func",
"(",
"http",
".",
"Handler",
")",
"http",
".",
"Handler",
"{",
"c",
":=",
"cors",
".",
"New",
"(",
"corsOptions",
")",
"\n\n",
"return",
"func",
"(",
"next",
"http",
".",
"Handler",
")",
"http",
".",
"Handler",
"{",
"return",
"c",
".",
"Handler",
"(",
"http",
".",
"HandlerFunc",
"(",
"func",
"(",
"w",
"http",
".",
"ResponseWriter",
",",
"r",
"*",
"<mask>",
".",
"Request",
")",
"{",
"// limit request body size",
"fire",
".",
"LimitBody",
"(",
"w",
",",
"r",
",",
"int64",
"(",
"fire",
".",
"DataSize",
"(",
"maxBody",
")",
")",
")",
"\n\n",
"// call next handler",
"next",
".",
"ServeHTTP",
"(",
"w",
",",
"r",
")",
"\n",
"}",
")",
")",
"\n",
"}",
"\n",
"}"
] |
15,142 | all-15143 | [
"Do",
"executes",
"Performance",
".",
"getMetrics",
"against",
"the",
"provided",
"context",
".",
"returns",
":",
"metrics",
"-",
"Current",
"values",
"for",
"run",
"-",
"time",
"metrics",
"."
] | [
"func",
"(",
"p",
"*",
"GetMetricsParams",
")",
"Do",
"(",
"ctx",
"context",
".",
"Context",
")",
"(",
"metrics",
"[",
"]",
"*",
"Metric",
",",
"err",
"error",
")",
"{",
"// execute",
"<mask>",
"res",
"GetMetricsReturns",
"\n",
"err",
"=",
"cdp",
".",
"Execute",
"(",
"ctx",
",",
"CommandGetMetrics",
",",
"nil",
",",
"&",
"res",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"return",
"res",
".",
"Metrics",
",",
"nil",
"\n",
"}"
] |
15,143 | all-15144 | [
"SetExpanderColumn",
"is",
"a",
"wrapper",
"around",
"gtk_tree_view_set_expander_column",
"()",
"."
] | [
"func",
"(",
"v",
"*",
"TreeView",
")",
"SetExpanderColumn",
"(",
"column",
"*",
"TreeViewColumn",
")",
"{",
"C",
".",
"gtk_tree_view_set_expander_column",
"(",
"v",
".",
"native",
"(",
")",
",",
"<mask>",
".",
"native",
"(",
")",
")",
"\n",
"}"
] |
15,144 | all-15145 | [
"Stem",
"an",
"Russian",
"word",
".",
"This",
"is",
"the",
"only",
"exported",
"function",
"in",
"this",
"package",
"."
] | [
"func",
"Stem",
"(",
"word",
"string",
",",
"stemStopwWords",
"bool",
")",
"string",
"{",
"word",
"=",
"strings",
".",
"ToLower",
"(",
"strings",
".",
"TrimSpace",
"(",
"word",
")",
")",
"\n",
"w",
":=",
"snowballword",
".",
"New",
"(",
"word",
")",
"\n\n",
"// Return small words and stop words",
"if",
"len",
"(",
"w",
".",
"RS",
")",
"<=",
"2",
"||",
"(",
"stemStopwWords",
"==",
"false",
"&&",
"isStopWord",
"(",
"<mask>",
")",
")",
"{",
"return",
"word",
"\n",
"}",
"\n\n",
"preprocess",
"(",
"w",
")",
"\n",
"step1",
"(",
"w",
")",
"\n",
"step2",
"(",
"w",
")",
"\n",
"step3",
"(",
"w",
")",
"\n",
"step4",
"(",
"w",
")",
"\n",
"return",
"w",
".",
"String",
"(",
")",
"\n\n",
"}"
] |
15,145 | all-15146 | [
"SetComplete",
"marks",
"the",
"job",
"as",
"completed",
"(",
"at",
"time",
"now",
")",
"."
] | [
"func",
"(",
"j",
"*",
"ProwJob",
")",
"SetComplete",
"(",
")",
"{",
"j",
".",
"Status",
".",
"CompletionTime",
"=",
"new",
"(",
"metav1",
".",
"Time",
")",
"\n",
"*",
"j",
".",
"<mask>",
".",
"CompletionTime",
"=",
"metav1",
".",
"Now",
"(",
")",
"\n",
"}"
] |
15,146 | all-15147 | [
"QueryContext",
"implements",
"the",
"database",
"/",
"sql",
"/",
"driver",
"/",
"QueryerContext",
"interface",
"."
] | [
"func",
"(",
"c",
"*",
"conn",
")",
"QueryContext",
"(",
"ctx",
"context",
".",
"Context",
",",
"query",
"string",
",",
"args",
"[",
"]",
"driver",
".",
"NamedValue",
")",
"(",
"rows",
"driver",
".",
"Rows",
",",
"err",
"error",
")",
"{",
"if",
"c",
".",
"session",
".",
"IsBad",
"(",
")",
"{",
"return",
"nil",
",",
"driver",
".",
"ErrBadConn",
"\n",
"}",
"\n\n",
"if",
"len",
"(",
"args",
")",
"!=",
"0",
"{",
"return",
"nil",
",",
"driver",
".",
"ErrSkip",
"//fast path not possible (prepare needed)",
"\n",
"}",
"\n\n",
"// direct execution of call procedure",
"// - returns no parameter metadata (sps 82) but only field values",
"// --> let's take the 'prepare way' for stored procedures",
"//\tif checkCallProcedure(query) {",
"//\t\treturn nil, driver.ErrSkip",
"//\t}",
"sqltrace",
".",
"Traceln",
"(",
"<mask>",
")",
"\n\n",
"done",
":=",
"make",
"(",
"chan",
"struct",
"{",
"}",
")",
"\n",
"go",
"func",
"(",
")",
"{",
"var",
"(",
"id",
"uint64",
"\n",
"resultFieldSet",
"*",
"p",
".",
"ResultFieldSet",
"\n",
"fieldValues",
"*",
"p",
".",
"FieldValues",
"\n",
"attributes",
"p",
".",
"PartAttributes",
"\n",
")",
"\n",
"id",
",",
"resultFieldSet",
",",
"fieldValues",
",",
"attributes",
",",
"err",
"=",
"c",
".",
"session",
".",
"QueryDirect",
"(",
"query",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"goto",
"done",
"\n",
"}",
"\n",
"select",
"{",
"default",
":",
"case",
"<-",
"ctx",
".",
"Done",
"(",
")",
":",
"return",
"\n",
"}",
"\n",
"if",
"id",
"==",
"0",
"{",
"// non select query",
"rows",
"=",
"noResult",
"\n",
"}",
"else",
"{",
"rows",
",",
"err",
"=",
"newQueryResult",
"(",
"c",
".",
"session",
",",
"id",
",",
"resultFieldSet",
",",
"fieldValues",
",",
"attributes",
")",
"\n",
"}",
"\n",
"done",
":",
"close",
"(",
"done",
")",
"\n",
"}",
"(",
")",
"\n\n",
"select",
"{",
"case",
"<-",
"ctx",
".",
"Done",
"(",
")",
":",
"return",
"nil",
",",
"ctx",
".",
"Err",
"(",
")",
"\n",
"case",
"<-",
"done",
":",
"return",
"rows",
",",
"err",
"\n",
"}",
"\n",
"}"
] |
15,147 | all-15148 | [
"RangeSince",
"returns",
"all",
"revisions",
"from",
"key",
"(",
"including",
")",
"to",
"end",
"(",
"excluding",
")",
"at",
"or",
"after",
"the",
"given",
"rev",
".",
"The",
"returned",
"slice",
"is",
"sorted",
"in",
"the",
"order",
"of",
"revision",
"."
] | [
"func",
"(",
"ti",
"*",
"treeIndex",
")",
"RangeSince",
"(",
"key",
",",
"end",
"[",
"]",
"byte",
",",
"rev",
"int64",
")",
"[",
"]",
"revision",
"{",
"keyi",
":=",
"&",
"keyIndex",
"{",
"key",
":",
"key",
"}",
"\n\n",
"ti",
".",
"RLock",
"(",
")",
"\n",
"defer",
"ti",
".",
"RUnlock",
"(",
")",
"\n\n",
"if",
"end",
"==",
"nil",
"{",
"item",
":=",
"ti",
".",
"tree",
".",
"Get",
"(",
"keyi",
")",
"\n",
"if",
"item",
"==",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n",
"keyi",
"=",
"item",
".",
"(",
"*",
"keyIndex",
")",
"\n",
"return",
"keyi",
".",
"since",
"(",
"ti",
".",
"lg",
",",
"rev",
")",
"\n",
"}",
"\n\n",
"endi",
":=",
"&",
"keyIndex",
"{",
"key",
":",
"end",
"}",
"\n",
"var",
"revs",
"[",
"]",
"revision",
"\n",
"ti",
".",
"tree",
".",
"AscendGreaterOrEqual",
"(",
"keyi",
",",
"func",
"(",
"item",
"btree",
".",
"Item",
")",
"bool",
"{",
"if",
"len",
"(",
"endi",
".",
"key",
")",
">",
"0",
"&&",
"!",
"item",
".",
"Less",
"(",
"endi",
")",
"{",
"return",
"false",
"\n",
"}",
"\n",
"curKeyi",
":=",
"item",
".",
"(",
"*",
"keyIndex",
")",
"\n",
"revs",
"=",
"<mask>",
"(",
"revs",
",",
"curKeyi",
".",
"since",
"(",
"ti",
".",
"lg",
",",
"rev",
")",
"...",
")",
"\n",
"return",
"true",
"\n",
"}",
")",
"\n",
"sort",
".",
"Sort",
"(",
"revisions",
"(",
"revs",
")",
")",
"\n\n",
"return",
"revs",
"\n",
"}"
] |
15,148 | all-15149 | [
"xpath",
"builds",
"the",
"xpath",
"string",
"."
] | [
"func",
"(",
"n",
"*",
"Node",
")",
"xpath",
"(",
"stopAtDocument",
",",
"stopAtID",
"bool",
")",
"string",
"{",
"n",
".",
"RLock",
"(",
")",
"\n",
"defer",
"n",
".",
"RUnlock",
"(",
")",
"\n\n",
"p",
":=",
"\"",
"\"",
"\n",
"pos",
":=",
"\"",
"\"",
"\n",
"id",
":=",
"n",
".",
"AttributeValue",
"(",
"\"",
"\"",
")",
"\n",
"switch",
"{",
"<mask>",
"n",
".",
"Parent",
"==",
"nil",
":",
"return",
"n",
".",
"LocalName",
"\n\n",
"case",
"stopAtDocument",
"&&",
"n",
".",
"NodeType",
"==",
"NodeTypeDocument",
":",
"return",
"\"",
"\"",
"\n\n",
"case",
"stopAtID",
"&&",
"id",
"!=",
"\"",
"\"",
":",
"p",
"=",
"\"",
"\"",
"\n",
"pos",
"=",
"`[@id='`",
"+",
"id",
"+",
"`']`",
"\n\n",
"case",
"n",
".",
"Parent",
"!=",
"nil",
":",
"var",
"i",
"int",
"\n",
"var",
"found",
"bool",
"\n\n",
"n",
".",
"Parent",
".",
"RLock",
"(",
")",
"\n",
"for",
"j",
":=",
"0",
";",
"j",
"<",
"len",
"(",
"n",
".",
"Parent",
".",
"Children",
")",
";",
"j",
"++",
"{",
"if",
"n",
".",
"Parent",
".",
"Children",
"[",
"j",
"]",
".",
"LocalName",
"==",
"n",
".",
"LocalName",
"{",
"i",
"++",
"\n",
"}",
"\n",
"if",
"n",
".",
"Parent",
".",
"Children",
"[",
"j",
"]",
".",
"NodeID",
"==",
"n",
".",
"NodeID",
"{",
"found",
"=",
"true",
"\n",
"break",
"\n",
"}",
"\n",
"}",
"\n",
"n",
".",
"Parent",
".",
"RUnlock",
"(",
")",
"\n\n",
"if",
"found",
"{",
"pos",
"=",
"\"",
"\"",
"+",
"strconv",
".",
"Itoa",
"(",
"i",
")",
"+",
"\"",
"\"",
"\n",
"}",
"\n\n",
"p",
"=",
"n",
".",
"Parent",
".",
"xpath",
"(",
"stopAtDocument",
",",
"stopAtID",
")",
"\n",
"}",
"\n\n",
"return",
"p",
"+",
"\"",
"\"",
"+",
"n",
".",
"LocalName",
"+",
"pos",
"\n",
"}"
] |
15,149 | all-15150 | [
"Where",
"returns",
"a",
"new",
"Condition",
"of",
"WHERE",
"clause",
"."
] | [
"func",
"(",
"db",
"*",
"DB",
")",
"Where",
"(",
"cond",
"<mask>",
"{",
"}",
",",
"args",
"...",
"interface",
"{",
"}",
")",
"*",
"Condition",
"{",
"return",
"newCondition",
"(",
"db",
")",
".",
"Where",
"(",
"cond",
",",
"args",
"...",
")",
"\n",
"}"
] |
15,150 | all-15151 | [
"DeepCopyObject",
"is",
"an",
"autogenerated",
"deepcopy",
"function",
"copying",
"the",
"receiver",
"creating",
"a",
"new",
"runtime",
".",
"Object",
"."
] | [
"func",
"(",
"in",
"*",
"ProwJobList",
")",
"DeepCopyObject",
"(",
")",
"runtime",
".",
"<mask>",
"{",
"if",
"c",
":=",
"in",
".",
"DeepCopy",
"(",
")",
";",
"c",
"!=",
"nil",
"{",
"return",
"c",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
] |
15,151 | all-15152 | [
"PachdService",
"returns",
"a",
"pachd",
"service",
"."
] | [
"func",
"PachdService",
"(",
"opts",
"*",
"AssetOpts",
")",
"*",
"v1",
".",
"Service",
"{",
"prometheusAnnotations",
":=",
"map",
"[",
"string",
"]",
"string",
"{",
"\"",
"\"",
":",
"\"",
"\"",
",",
"\"",
"\"",
":",
"strconv",
".",
"Itoa",
"(",
"PrometheusPort",
")",
",",
"}",
"\n",
"return",
"&",
"v1",
".",
"Service",
"{",
"TypeMeta",
":",
"metav1",
".",
"TypeMeta",
"{",
"Kind",
":",
"\"",
"\"",
",",
"APIVersion",
":",
"\"",
"\"",
",",
"}",
",",
"ObjectMeta",
":",
"objectMeta",
"(",
"pachdName",
",",
"labels",
"(",
"pachdName",
")",
",",
"prometheusAnnotations",
",",
"opts",
".",
"Namespace",
")",
",",
"Spec",
":",
"v1",
".",
"ServiceSpec",
"{",
"Type",
":",
"v1",
".",
"ServiceTypeNodePort",
",",
"Selector",
":",
"map",
"[",
"string",
"]",
"string",
"{",
"\"",
"\"",
":",
"pachdName",
",",
"}",
",",
"Ports",
":",
"[",
"]",
"v1",
".",
"ServicePort",
"{",
"{",
"Port",
":",
"600",
",",
"// also set in cmd/pachd/main.go",
"<mask>",
":",
"\"",
"\"",
",",
"NodePort",
":",
"30600",
",",
"}",
",",
"{",
"Port",
":",
"650",
",",
"// also set in cmd/pachd/main.go",
"Name",
":",
"\"",
"\"",
",",
"NodePort",
":",
"30650",
",",
"}",
",",
"{",
"Port",
":",
"651",
",",
"// also set in cmd/pachd/main.go",
"Name",
":",
"\"",
"\"",
",",
"NodePort",
":",
"30651",
",",
"}",
",",
"{",
"Port",
":",
"652",
",",
"// also set in cmd/pachd/main.go",
"Name",
":",
"\"",
"\"",
",",
"NodePort",
":",
"30652",
",",
"}",
",",
"{",
"Port",
":",
"auth",
".",
"SamlPort",
",",
"Name",
":",
"\"",
"\"",
",",
"NodePort",
":",
"30000",
"+",
"auth",
".",
"SamlPort",
",",
"}",
",",
"{",
"Port",
":",
"githook",
".",
"GitHookPort",
",",
"Name",
":",
"\"",
"\"",
",",
"NodePort",
":",
"githook",
".",
"NodePort",
"(",
")",
",",
"}",
",",
"}",
",",
"}",
",",
"}",
"\n",
"}"
] |
15,152 | all-15153 | [
"Successf",
"outputs",
"formatted",
"Success",
"level",
"log"
] | [
"func",
"(",
"g",
"*",
"Glg",
")",
"Successf",
"(",
"format",
"string",
",",
"val",
"...",
"interface",
"{",
"}",
")",
"error",
"{",
"return",
"g",
".",
"<mask>",
"(",
"OK",
",",
"format",
",",
"val",
"...",
")",
"\n",
"}"
] |
15,153 | all-15154 | [
"RetryWithBackoff",
"takes",
"a",
"Backoff",
"and",
"a",
"function",
"to",
"call",
"that",
"returns",
"an",
"error",
"If",
"the",
"error",
"is",
"nil",
"then",
"the",
"function",
"will",
"no",
"longer",
"be",
"called",
"If",
"the",
"error",
"is",
"Retriable",
"then",
"that",
"will",
"be",
"used",
"to",
"determine",
"if",
"it",
"should",
"be",
"retried"
] | [
"func",
"RetryWithBackoff",
"(",
"backoff",
"Backoff",
",",
"fn",
"func",
"(",
")",
"error",
")",
"error",
"{",
"return",
"RetryWithBackoffCtx",
"(",
"<mask>",
".",
"Background",
"(",
")",
",",
"backoff",
",",
"fn",
")",
"\n",
"}"
] |
15,154 | all-15155 | [
"Handle",
"all",
"frames",
"except",
"messageTypeCallReq",
"."
] | [
"func",
"(",
"r",
"*",
"Relayer",
")",
"handleNonCallReq",
"(",
"f",
"*",
"Frame",
")",
"error",
"{",
"frameType",
":=",
"frameTypeFor",
"(",
"f",
")",
"\n",
"finished",
":=",
"finishesCall",
"(",
"f",
")",
"\n\n",
"// If we read a request frame, we need to use the outbound map to decide",
"// the destination. Otherwise, we use the inbound map.",
"items",
":=",
"r",
".",
"outbound",
"\n",
"if",
"frameType",
"==",
"responseFrame",
"{",
"items",
"=",
"r",
".",
"inbound",
"\n",
"}",
"\n\n",
"item",
",",
"ok",
":=",
"items",
".",
"Get",
"(",
"f",
".",
"Header",
".",
"ID",
")",
"\n",
"if",
"!",
"ok",
"{",
"return",
"errUnknownID",
"\n",
"}",
"\n",
"if",
"item",
".",
"tomb",
"{",
"// Call timed out, ignore this frame. (We've already handled stats.)",
"// TODO: metrics for late-arriving frames.",
"return",
"nil",
"\n",
"}",
"\n\n",
"originalID",
":=",
"f",
".",
"Header",
".",
"ID",
"\n",
"f",
".",
"Header",
".",
"ID",
"=",
"<mask>",
".",
"remapID",
"\n\n",
"sent",
",",
"failure",
":=",
"item",
".",
"destination",
".",
"Receive",
"(",
"f",
",",
"frameType",
")",
"\n",
"if",
"!",
"sent",
"{",
"r",
".",
"failRelayItem",
"(",
"items",
",",
"originalID",
",",
"failure",
")",
"\n",
"return",
"nil",
"\n",
"}",
"\n\n",
"if",
"finished",
"{",
"r",
".",
"finishRelayItem",
"(",
"items",
",",
"originalID",
")",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
] |
15,155 | all-15156 | [
"absorbBlock",
"Performs",
"an",
"absorb",
"operation",
"for",
"a",
"single",
"block",
"(",
"BLOCK_LEN_INT64",
"words",
"of",
"type",
"uint64_t",
")",
"using",
"Blake2b",
"s",
"G",
"function",
"as",
"the",
"internal",
"permutation"
] | [
"func",
"absorbBlock",
"(",
"state",
"[",
"]",
"uint64",
",",
"in",
"[",
"]",
"uint64",
")",
"{",
"//XORs the first BLOCK_LEN_INT64 words of \"in\" with the current state",
"state",
"[",
"0",
"]",
"^=",
"in",
"[",
"0",
"]",
"\n",
"state",
"[",
"1",
"]",
"^=",
"in",
"[",
"1",
"]",
"\n",
"state",
"[",
"2",
"]",
"^=",
"in",
"[",
"2",
"]",
"\n",
"state",
"[",
"3",
"]",
"^=",
"in",
"[",
"3",
"]",
"\n",
"state",
"[",
"4",
"]",
"^=",
"in",
"[",
"4",
"]",
"\n",
"state",
"[",
"5",
"]",
"^=",
"in",
"[",
"5",
"]",
"\n",
"state",
"[",
"6",
"]",
"^=",
"in",
"[",
"6",
"]",
"\n",
"<mask>",
"[",
"7",
"]",
"^=",
"in",
"[",
"7",
"]",
"\n",
"state",
"[",
"8",
"]",
"^=",
"in",
"[",
"8",
"]",
"\n",
"state",
"[",
"9",
"]",
"^=",
"in",
"[",
"9",
"]",
"\n",
"state",
"[",
"10",
"]",
"^=",
"in",
"[",
"10",
"]",
"\n",
"state",
"[",
"11",
"]",
"^=",
"in",
"[",
"11",
"]",
"\n\n",
"//Applies the transformation f to the sponge's state",
"blake2bLyra",
"(",
"state",
")",
"\n",
"}"
] |
15,156 | all-15157 | [
"targetsFromGroup",
"builds",
"targets",
"based",
"on",
"the",
"given",
"TargetGroup",
"and",
"config",
"."
] | [
"func",
"targetsFromGroup",
"(",
"tg",
"*",
"targetgroup",
".",
"Group",
",",
"cfg",
"*",
"config",
".",
"ScrapeConfig",
")",
"(",
"[",
"]",
"*",
"Target",
",",
"error",
")",
"{",
"targets",
":=",
"make",
"(",
"[",
"]",
"*",
"Target",
",",
"0",
",",
"len",
"(",
"tg",
".",
"Targets",
")",
")",
"\n\n",
"for",
"i",
",",
"tlset",
":=",
"range",
"tg",
".",
"Targets",
"{",
"lbls",
":=",
"make",
"(",
"[",
"]",
"labels",
".",
"Label",
",",
"0",
",",
"len",
"(",
"tlset",
")",
"+",
"len",
"(",
"tg",
".",
"Labels",
")",
")",
"\n\n",
"for",
"ln",
",",
"lv",
":=",
"range",
"tlset",
"{",
"lbls",
"=",
"append",
"(",
"lbls",
",",
"labels",
".",
"Label",
"{",
"Name",
":",
"string",
"(",
"ln",
")",
",",
"<mask>",
":",
"string",
"(",
"lv",
")",
"}",
")",
"\n",
"}",
"\n",
"for",
"ln",
",",
"lv",
":=",
"range",
"tg",
".",
"Labels",
"{",
"if",
"_",
",",
"ok",
":=",
"tlset",
"[",
"ln",
"]",
";",
"!",
"ok",
"{",
"lbls",
"=",
"append",
"(",
"lbls",
",",
"labels",
".",
"Label",
"{",
"Name",
":",
"string",
"(",
"ln",
")",
",",
"Value",
":",
"string",
"(",
"lv",
")",
"}",
")",
"\n",
"}",
"\n",
"}",
"\n\n",
"lset",
":=",
"labels",
".",
"New",
"(",
"lbls",
"...",
")",
"\n\n",
"lbls",
",",
"origLabels",
",",
"err",
":=",
"populateLabels",
"(",
"lset",
",",
"cfg",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"errors",
".",
"Wrapf",
"(",
"err",
",",
"\"",
"\"",
",",
"i",
",",
"tg",
")",
"\n",
"}",
"\n",
"if",
"lbls",
"!=",
"nil",
"||",
"origLabels",
"!=",
"nil",
"{",
"targets",
"=",
"append",
"(",
"targets",
",",
"NewTarget",
"(",
"lbls",
",",
"origLabels",
",",
"cfg",
".",
"Params",
")",
")",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"targets",
",",
"nil",
"\n",
"}"
] |
15,157 | all-15158 | [
"FetchAccount",
"retrieves",
"account",
"with",
"passed",
"cid",
".",
"Pass",
"nil",
"for",
"/",
"account",
"/",
"current",
"."
] | [
"func",
"(",
"a",
"*",
"API",
")",
"FetchAccount",
"(",
"cid",
"CIDType",
")",
"(",
"*",
"Account",
",",
"error",
")",
"{",
"var",
"accountCID",
"string",
"\n\n",
"if",
"cid",
"==",
"nil",
"||",
"*",
"cid",
"==",
"\"",
"\"",
"{",
"accountCID",
"=",
"config",
".",
"AccountPrefix",
"+",
"\"",
"\"",
"\n",
"}",
"else",
"{",
"accountCID",
"=",
"string",
"(",
"*",
"cid",
")",
"\n",
"}",
"\n\n",
"matched",
",",
"err",
":=",
"regexp",
".",
"MatchString",
"(",
"config",
".",
"AccountCIDRegex",
",",
"accountCID",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"if",
"!",
"matched",
"{",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"accountCID",
")",
"\n",
"}",
"\n\n",
"result",
",",
"err",
":=",
"a",
".",
"Get",
"(",
"accountCID",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"if",
"a",
".",
"Debug",
"{",
"a",
".",
"Log",
".",
"Printf",
"(",
"\"",
"\"",
",",
"string",
"(",
"result",
")",
")",
"\n",
"}",
"\n\n",
"account",
":=",
"new",
"(",
"Account",
")",
"\n",
"if",
"err",
":=",
"json",
".",
"Unmarshal",
"(",
"result",
",",
"account",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"return",
"<mask>",
",",
"nil",
"\n",
"}"
] |
15,158 | all-15159 | [
"ContainerRemove",
"removes",
"the",
"container",
"with",
"the",
"given",
"name",
"from",
"the",
"database",
"."
] | [
"func",
"(",
"c",
"*",
"Cluster",
")",
"ContainerRemove",
"(",
"project",
",",
"<mask>",
"string",
")",
"error",
"{",
"return",
"c",
".",
"Transaction",
"(",
"func",
"(",
"tx",
"*",
"ClusterTx",
")",
"error",
"{",
"return",
"tx",
".",
"ContainerDelete",
"(",
"project",
",",
"name",
")",
"\n",
"}",
")",
"\n",
"}"
] |
15,159 | all-15160 | [
"ParseAddress",
"parses",
"a",
"standard",
"golang",
"network",
"address",
"and",
"returns",
"the",
"protocol",
"and",
"path",
"."
] | [
"func",
"ParseAddress",
"(",
"addr",
"string",
")",
"(",
"proto",
"string",
",",
"<mask>",
"string",
",",
"err",
"error",
")",
"{",
"m",
":=",
"netAddrRx",
".",
"FindStringSubmatch",
"(",
"addr",
")",
"\n",
"if",
"m",
"==",
"nil",
"{",
"return",
"\"",
"\"",
",",
"\"",
"\"",
",",
"goof",
".",
"WithField",
"(",
"\"",
"\"",
",",
"addr",
",",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"return",
"m",
"[",
"1",
"]",
",",
"m",
"[",
"2",
"]",
",",
"nil",
"\n",
"}"
] |
15,160 | all-15161 | [
"NewImageFromFile",
"loads",
"the",
"file",
"with",
"path",
"and",
"returns",
"ebiten",
".",
"Image",
"and",
"image",
".",
"Image",
".",
"Image",
"decoders",
"must",
"be",
"imported",
"when",
"using",
"NewImageFromFile",
".",
"For",
"example",
"if",
"you",
"want",
"to",
"load",
"a",
"PNG",
"image",
"you",
"d",
"need",
"to",
"add",
"_",
"image",
"/",
"png",
"to",
"the",
"import",
"section",
".",
"How",
"to",
"solve",
"path",
"depends",
"on",
"your",
"environment",
".",
"This",
"varies",
"on",
"your",
"desktop",
"or",
"web",
"browser",
".",
"Note",
"that",
"this",
"doesn",
"t",
"work",
"on",
"mobiles",
".",
"For",
"productions",
"instead",
"of",
"using",
"NewImageFromFile",
"it",
"is",
"safer",
"to",
"embed",
"your",
"resources",
"e",
".",
"g",
".",
"with",
"github",
".",
"com",
"/",
"rakyll",
"/",
"statik",
"."
] | [
"func",
"NewImageFromFile",
"(",
"path",
"string",
",",
"filter",
"ebiten",
".",
"<mask>",
")",
"(",
"*",
"ebiten",
".",
"Image",
",",
"image",
".",
"Image",
",",
"error",
")",
"{",
"file",
",",
"err",
":=",
"OpenFile",
"(",
"path",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"nil",
",",
"err",
"\n",
"}",
"\n",
"defer",
"func",
"(",
")",
"{",
"_",
"=",
"file",
".",
"Close",
"(",
")",
"\n",
"}",
"(",
")",
"\n",
"img",
",",
"_",
",",
"err",
":=",
"image",
".",
"Decode",
"(",
"file",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"nil",
",",
"err",
"\n",
"}",
"\n",
"img2",
",",
"err",
":=",
"ebiten",
".",
"NewImageFromImage",
"(",
"img",
",",
"filter",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"nil",
",",
"err",
"\n",
"}",
"\n",
"return",
"img2",
",",
"img",
",",
"err",
"\n",
"}"
] |
15,161 | all-15162 | [
"GetSuperSecureCookie",
"returns",
"given",
"cookie",
"value",
"from",
"request",
"header",
"with",
"secret",
"string",
"."
] | [
"func",
"(",
"ctx",
"*",
"Context",
")",
"GetSuperSecureCookie",
"(",
"secret",
",",
"name",
"string",
")",
"(",
"string",
",",
"bool",
")",
"{",
"val",
":=",
"ctx",
".",
"GetCookie",
"(",
"name",
")",
"\n",
"if",
"val",
"==",
"\"",
"\"",
"{",
"return",
"\"",
"\"",
",",
"false",
"\n",
"}",
"\n\n",
"text",
",",
"err",
":=",
"<mask>",
".",
"DecodeString",
"(",
"val",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"\"",
"\"",
",",
"false",
"\n",
"}",
"\n\n",
"key",
":=",
"pbkdf2",
".",
"Key",
"(",
"[",
"]",
"byte",
"(",
"secret",
")",
",",
"[",
"]",
"byte",
"(",
"secret",
")",
",",
"1000",
",",
"16",
",",
"sha256",
".",
"New",
")",
"\n",
"text",
",",
"err",
"=",
"com",
".",
"AESGCMDecrypt",
"(",
"key",
",",
"text",
")",
"\n",
"return",
"string",
"(",
"text",
")",
",",
"err",
"==",
"nil",
"\n",
"}"
] |
15,162 | all-15163 | [
"GetAdditionalGroupsPath",
"looks",
"up",
"a",
"list",
"of",
"groups",
"by",
"name",
"or",
"group",
"id",
"against",
"the",
"group",
"file",
".",
"If",
"a",
"group",
"name",
"cannot",
"be",
"found",
"an",
"error",
"will",
"be",
"returned",
".",
"If",
"a",
"group",
"id",
"cannot",
"be",
"found",
"it",
"will",
"be",
"returned",
"as",
"-",
"is",
"."
] | [
"func",
"GetAdditionalGroupsPath",
"(",
"additionalGroups",
"[",
"]",
"string",
",",
"groupPath",
"string",
")",
"(",
"[",
"]",
"int",
",",
"error",
")",
"{",
"groupReader",
",",
"err",
":=",
"os",
".",
"Open",
"(",
"groupPath",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"}",
"\n",
"defer",
"groupReader",
".",
"Close",
"(",
")",
"\n\n",
"groups",
",",
"err",
":=",
"ParseGroupFilter",
"(",
"groupReader",
",",
"func",
"(",
"g",
"<mask>",
")",
"bool",
"{",
"for",
"_",
",",
"ag",
":=",
"range",
"additionalGroups",
"{",
"if",
"g",
".",
"Name",
"==",
"ag",
"||",
"strconv",
".",
"Itoa",
"(",
"g",
".",
"Gid",
")",
"==",
"ag",
"{",
"return",
"true",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"false",
"\n",
"}",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"additionalGroups",
",",
"err",
")",
"\n",
"}",
"\n\n",
"gidMap",
":=",
"make",
"(",
"map",
"[",
"int",
"]",
"struct",
"{",
"}",
")",
"\n",
"for",
"_",
",",
"ag",
":=",
"range",
"additionalGroups",
"{",
"var",
"found",
"bool",
"\n",
"for",
"_",
",",
"g",
":=",
"range",
"groups",
"{",
"// if we found a matched group either by name or gid, take the",
"// first matched as correct",
"if",
"g",
".",
"Name",
"==",
"ag",
"||",
"strconv",
".",
"Itoa",
"(",
"g",
".",
"Gid",
")",
"==",
"ag",
"{",
"if",
"_",
",",
"ok",
":=",
"gidMap",
"[",
"g",
".",
"Gid",
"]",
";",
"!",
"ok",
"{",
"gidMap",
"[",
"g",
".",
"Gid",
"]",
"=",
"struct",
"{",
"}",
"{",
"}",
"\n",
"found",
"=",
"true",
"\n",
"break",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n",
"// we asked for a group but didn't find it. let's check to see",
"// if we wanted a numeric group",
"if",
"!",
"found",
"{",
"gid",
",",
"err",
":=",
"strconv",
".",
"Atoi",
"(",
"ag",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"ag",
")",
"\n",
"}",
"\n",
"// Ensure gid is inside gid range.",
"if",
"gid",
"<",
"minId",
"||",
"gid",
">",
"maxId",
"{",
"return",
"nil",
",",
"ErrRange",
"\n",
"}",
"\n",
"gidMap",
"[",
"gid",
"]",
"=",
"struct",
"{",
"}",
"{",
"}",
"\n",
"}",
"\n",
"}",
"\n",
"gids",
":=",
"[",
"]",
"int",
"{",
"}",
"\n",
"for",
"gid",
":=",
"range",
"gidMap",
"{",
"gids",
"=",
"append",
"(",
"gids",
",",
"gid",
")",
"\n",
"}",
"\n",
"return",
"gids",
",",
"nil",
"\n",
"}"
] |
15,163 | all-15164 | [
"SetPrefetch",
"sets",
"the",
"default",
"point",
"at",
"which",
"the",
"next",
"batch",
"of",
"results",
"will",
"be",
"requested",
".",
"When",
"there",
"are",
"p",
"*",
"batch_size",
"remaining",
"documents",
"cached",
"in",
"an",
"Iter",
"the",
"next",
"batch",
"will",
"be",
"requested",
"in",
"background",
".",
"For",
"instance",
"when",
"using",
"this",
":",
"session",
".",
"SetBatch",
"(",
"200",
")",
"session",
".",
"SetPrefetch",
"(",
"0",
".",
"25",
")",
"and",
"there",
"are",
"only",
"50",
"documents",
"cached",
"in",
"the",
"Iter",
"to",
"be",
"processed",
"the",
"next",
"batch",
"of",
"200",
"will",
"be",
"requested",
".",
"It",
"s",
"possible",
"to",
"change",
"this",
"setting",
"on",
"a",
"per",
"-",
"query",
"basis",
"as",
"well",
"using",
"the",
"Prefetch",
"method",
"of",
"Query",
".",
"The",
"default",
"prefetch",
"value",
"is",
"0",
".",
"25",
"."
] | [
"func",
"(",
"s",
"*",
"<mask>",
")",
"SetPrefetch",
"(",
"p",
"float64",
")",
"{",
"s",
".",
"m",
".",
"Lock",
"(",
")",
"\n",
"s",
".",
"queryConfig",
".",
"prefetch",
"=",
"p",
"\n",
"s",
".",
"m",
".",
"Unlock",
"(",
")",
"\n",
"}"
] |
15,164 | all-15165 | [
"RegisterFlags",
"registers",
"options",
"for",
"this",
"munger",
";",
"returns",
"any",
"that",
"require",
"a",
"restart",
"when",
"changed",
"."
] | [
"func",
"(",
"f",
"*",
"TriageFiler",
")",
"RegisterFlags",
"(",
")",
"{",
"flag",
".",
"IntVar",
"(",
"&",
"f",
".",
"topClustersCount",
",",
"\"",
"\"",
",",
"3",
",",
"\"",
"\"",
")",
"\n",
"<mask>",
".",
"IntVar",
"(",
"&",
"f",
".",
"windowDays",
",",
"\"",
"\"",
",",
"1",
",",
"\"",
"\"",
")",
"\n",
"}"
] |
15,165 | all-15166 | [
"LeafReviewers",
"returns",
"a",
"set",
"of",
"users",
"who",
"are",
"the",
"closest",
"reviewers",
"to",
"the",
"requested",
"file",
".",
"If",
"pkg",
"/",
"OWNERS",
"has",
"user1",
"and",
"pkg",
"/",
"util",
"/",
"OWNERS",
"has",
"user2",
"this",
"will",
"only",
"return",
"user2",
"for",
"the",
"path",
"pkg",
"/",
"util",
"/",
"sets",
"/",
"file",
".",
"go"
] | [
"func",
"(",
"o",
"*",
"RepoOwners",
")",
"LeafReviewers",
"(",
"path",
"string",
")",
"sets",
".",
"String",
"{",
"return",
"o",
".",
"entriesForFile",
"(",
"path",
",",
"o",
".",
"reviewers",
",",
"<mask>",
")",
"\n",
"}"
] |
15,166 | all-15167 | [
"post",
"posts",
"the",
"given",
"request",
".",
"It",
"returns",
"nil",
"when",
"request",
"is",
"sent",
"out",
"and",
"processed",
"successfully",
"."
] | [
"func",
"(",
"s",
"*",
"snapshotSender",
")",
"post",
"(",
"req",
"*",
"http",
".",
"<mask>",
")",
"(",
"err",
"error",
")",
"{",
"ctx",
",",
"cancel",
":=",
"context",
".",
"WithCancel",
"(",
"context",
".",
"Background",
"(",
")",
")",
"\n",
"req",
"=",
"req",
".",
"WithContext",
"(",
"ctx",
")",
"\n",
"defer",
"cancel",
"(",
")",
"\n\n",
"type",
"responseAndError",
"struct",
"{",
"resp",
"*",
"http",
".",
"Response",
"\n",
"body",
"[",
"]",
"byte",
"\n",
"err",
"error",
"\n",
"}",
"\n",
"result",
":=",
"make",
"(",
"chan",
"responseAndError",
",",
"1",
")",
"\n\n",
"go",
"func",
"(",
")",
"{",
"resp",
",",
"err",
":=",
"s",
".",
"tr",
".",
"pipelineRt",
".",
"RoundTrip",
"(",
"req",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"result",
"<-",
"responseAndError",
"{",
"resp",
",",
"nil",
",",
"err",
"}",
"\n",
"return",
"\n",
"}",
"\n\n",
"// close the response body when timeouts.",
"// prevents from reading the body forever when the other side dies right after",
"// successfully receives the request body.",
"time",
".",
"AfterFunc",
"(",
"snapResponseReadTimeout",
",",
"func",
"(",
")",
"{",
"httputil",
".",
"GracefulClose",
"(",
"resp",
")",
"}",
")",
"\n",
"body",
",",
"err",
":=",
"ioutil",
".",
"ReadAll",
"(",
"resp",
".",
"Body",
")",
"\n",
"result",
"<-",
"responseAndError",
"{",
"resp",
",",
"body",
",",
"err",
"}",
"\n",
"}",
"(",
")",
"\n\n",
"select",
"{",
"case",
"<-",
"s",
".",
"stopc",
":",
"return",
"errStopped",
"\n",
"case",
"r",
":=",
"<-",
"result",
":",
"if",
"r",
".",
"err",
"!=",
"nil",
"{",
"return",
"r",
".",
"err",
"\n",
"}",
"\n",
"return",
"checkPostResponse",
"(",
"r",
".",
"resp",
",",
"r",
".",
"body",
",",
"req",
",",
"s",
".",
"to",
")",
"\n",
"}",
"\n",
"}"
] |
15,167 | all-15168 | [
"GetDatacenter",
"gets",
"a",
"datacenter"
] | [
"func",
"(",
"c",
"*",
"Client",
")",
"GetDatacenter",
"(",
"dcid",
"string",
")",
"(",
"*",
"Datacenter",
",",
"error",
")",
"{",
"url",
":=",
"dcPath",
"(",
"dcid",
")",
"+",
"`?depth=`",
"+",
"c",
".",
"client",
".",
"depth",
"+",
"`&pretty=`",
"+",
"strconv",
".",
"FormatBool",
"(",
"c",
".",
"client",
".",
"pretty",
")",
"\n",
"ret",
":=",
"&",
"Datacenter",
"{",
"}",
"\n",
"err",
":=",
"c",
".",
"client",
".",
"Get",
"(",
"url",
",",
"ret",
",",
"<mask>",
".",
"StatusOK",
")",
"\n",
"return",
"ret",
",",
"err",
"\n",
"}"
] |
15,168 | all-15169 | [
"MarshalJSON",
"supports",
"json",
".",
"Marshaler",
"interface"
] | [
"func",
"(",
"v",
"GetFullAXTreeParams",
")",
"MarshalJSON",
"(",
")",
"(",
"[",
"]",
"<mask>",
",",
"error",
")",
"{",
"w",
":=",
"jwriter",
".",
"Writer",
"{",
"}",
"\n",
"easyjsonC5a4559bEncodeGithubComChromedpCdprotoAccessibility8",
"(",
"&",
"w",
",",
"v",
")",
"\n",
"return",
"w",
".",
"Buffer",
".",
"BuildBytes",
"(",
")",
",",
"w",
".",
"Error",
"\n",
"}"
] |
15,169 | all-15170 | [
"query",
"the",
"location",
"of",
"a",
"named",
"resource",
"within",
"a",
"program"
] | [
"func",
"GetProgramResourceLocation",
"(",
"program",
"uint32",
",",
"programInterface",
"uint32",
",",
"name",
"*",
"uint8",
")",
"int32",
"{",
"ret",
":=",
"C",
".",
"glowGetProgramResourceLocation",
"(",
"gpGetProgramResourceLocation",
",",
"(",
"C",
".",
"GLuint",
")",
"(",
"<mask>",
")",
",",
"(",
"C",
".",
"GLenum",
")",
"(",
"programInterface",
")",
",",
"(",
"*",
"C",
".",
"GLchar",
")",
"(",
"unsafe",
".",
"Pointer",
"(",
"name",
")",
")",
")",
"\n",
"return",
"(",
"int32",
")",
"(",
"ret",
")",
"\n",
"}"
] |
15,170 | all-15171 | [
"Cancel",
"cancels",
"the",
"currently",
"running",
"datum"
] | [
"func",
"(",
"a",
"*",
"APIServer",
")",
"Cancel",
"(",
"ctx",
"context",
".",
"Context",
",",
"request",
"*",
"CancelRequest",
")",
"(",
"*",
"CancelResponse",
",",
"error",
")",
"{",
"a",
".",
"statusMu",
".",
"Lock",
"(",
")",
"\n",
"defer",
"a",
".",
"statusMu",
".",
"Unlock",
"(",
")",
"\n",
"if",
"request",
".",
"JobID",
"!=",
"a",
".",
"jobID",
"{",
"return",
"&",
"CancelResponse",
"{",
"Success",
":",
"false",
"}",
",",
"nil",
"\n",
"}",
"\n",
"if",
"!",
"MatchDatum",
"(",
"request",
".",
"DataFilters",
",",
"a",
".",
"datum",
"(",
")",
")",
"{",
"return",
"&",
"CancelResponse",
"{",
"Success",
":",
"false",
"}",
",",
"nil",
"\n",
"}",
"\n",
"a",
".",
"cancel",
"(",
")",
"\n",
"// clear the status since we're no longer processing this datum",
"a",
".",
"jobID",
"=",
"\"",
"\"",
"\n",
"a",
".",
"data",
"=",
"nil",
"\n",
"a",
".",
"<mask>",
"=",
"time",
".",
"Time",
"{",
"}",
"\n",
"a",
".",
"cancel",
"=",
"nil",
"\n",
"return",
"&",
"CancelResponse",
"{",
"Success",
":",
"true",
"}",
",",
"nil",
"\n",
"}"
] |
15,171 | all-15172 | [
"GetChildren",
"returns",
"all",
"child",
"nodes",
"of",
"the",
"element"
] | [
"func",
"(",
"x",
"*",
"XMLEle",
")",
"GetChildren",
"(",
")",
"[",
"]",
"tree",
".",
"Node",
"{",
"ret",
":=",
"make",
"(",
"[",
"]",
"tree",
".",
"Node",
",",
"len",
"(",
"x",
".",
"Children",
")",
")",
"\n\n",
"for",
"i",
":=",
"<mask>",
"x",
".",
"Children",
"{",
"ret",
"[",
"i",
"]",
"=",
"x",
".",
"Children",
"[",
"i",
"]",
"\n",
"}",
"\n\n",
"return",
"ret",
"\n",
"}"
] |
15,172 | all-15173 | [
"GetLvar",
"gets",
"the",
"frame",
"local",
"variable",
"at",
"position",
"i"
] | [
"func",
"(",
"f",
"*",
"Frame",
")",
"GetLvar",
"(",
"i",
"int",
")",
"(",
"interface",
"{",
"}",
",",
"error",
")",
"{",
"v",
",",
"err",
":=",
"f",
".",
"stack",
".",
"Get",
"(",
"i",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"errors",
".",
"Wrap",
"(",
"err",
",",
"\"",
"\"",
"+",
"strconv",
".",
"Itoa",
"(",
"i",
"+",
"f",
".",
"<mask>",
")",
")",
"\n",
"}",
"\n",
"return",
"v",
",",
"nil",
"\n",
"}"
] |
15,173 | all-15174 | [
"HasHTML",
"returns",
"a",
"boolean",
"if",
"a",
"field",
"has",
"been",
"set",
"."
] | [
"func",
"(",
"w",
"*",
"Widget",
")",
"HasHTML",
"(",
")",
"bool",
"{",
"if",
"w",
"!=",
"nil",
"&&",
"w",
".",
"HTML",
"!=",
"nil",
"{",
"return",
"true",
"\n",
"}",
"\n\n",
"return",
"<mask>",
"\n",
"}"
] |
15,174 | all-15175 | [
"Stop",
"the",
"application",
"and",
"attempt",
"to",
"gracefully",
"shutdown"
] | [
"func",
"(",
"a",
"*",
"App",
")",
"Stop",
"(",
"err",
"error",
")",
"error",
"{",
"a",
".",
"cancel",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"&&",
"errors",
".",
"Cause",
"(",
"err",
")",
"!=",
"<mask>",
".",
"Canceled",
"{",
"a",
".",
"Logger",
".",
"Error",
"(",
"err",
")",
"\n",
"return",
"err",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
] |
15,175 | all-15176 | [
"GetWebsocket",
"returns",
"a",
"raw",
"websocket",
"connection",
"from",
"the",
"operation"
] | [
"func",
"(",
"op",
"*",
"operation",
")",
"GetWebsocket",
"(",
"secret",
"string",
")",
"(",
"*",
"websocket",
".",
"Conn",
",",
"error",
")",
"{",
"return",
"op",
".",
"r",
".",
"GetOperationWebsocket",
"(",
"op",
".",
"<mask>",
",",
"secret",
")",
"\n",
"}"
] |
15,176 | all-15177 | [
"GetExecPath",
"returns",
"the",
"path",
"to",
"the",
"current",
"binary"
] | [
"func",
"GetExecPath",
"(",
")",
"string",
"{",
"execPath",
":=",
"os",
".",
"Getenv",
"(",
"\"",
"\"",
")",
"\n",
"if",
"execPath",
"!=",
"\"",
"\"",
"{",
"return",
"execPath",
"\n",
"}",
"\n\n",
"execPath",
",",
"err",
":=",
"<mask>",
".",
"Readlink",
"(",
"\"",
"\"",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"execPath",
"=",
"\"",
"\"",
"\n",
"}",
"\n",
"return",
"execPath",
"\n",
"}"
] |
15,177 | all-15178 | [
"Rename",
"renames",
"a",
"container",
"backup"
] | [
"func",
"(",
"b",
"*",
"backup",
")",
"Rename",
"(",
"newName",
"string",
")",
"error",
"{",
"oldBackupPath",
":=",
"shared",
".",
"VarPath",
"(",
"\"",
"\"",
",",
"b",
".",
"name",
")",
"\n",
"newBackupPath",
":=",
"shared",
".",
"VarPath",
"(",
"\"",
"\"",
",",
"newName",
")",
"\n\n",
"// Create the new backup path",
"backupsPath",
":=",
"shared",
".",
"VarPath",
"(",
"\"",
"\"",
",",
"b",
".",
"container",
".",
"Name",
"(",
")",
")",
"\n",
"if",
"!",
"shared",
".",
"PathExists",
"(",
"backupsPath",
")",
"{",
"err",
":=",
"<mask>",
".",
"MkdirAll",
"(",
"backupsPath",
",",
"0700",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"}",
"\n\n",
"// Rename the backup directory",
"err",
":=",
"os",
".",
"Rename",
"(",
"oldBackupPath",
",",
"newBackupPath",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"// Check if we can remove the container directory",
"empty",
",",
"_",
":=",
"shared",
".",
"PathIsEmpty",
"(",
"backupsPath",
")",
"\n",
"if",
"empty",
"{",
"err",
":=",
"os",
".",
"Remove",
"(",
"backupsPath",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"}",
"\n\n",
"// Rename the database record",
"err",
"=",
"b",
".",
"state",
".",
"Cluster",
".",
"ContainerBackupRename",
"(",
"b",
".",
"name",
",",
"newName",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"return",
"nil",
"\n",
"}"
] |
15,178 | all-15179 | [
"NewHealthHandler",
"handles",
"/",
"health",
"requests",
"."
] | [
"func",
"NewHealthHandler",
"(",
"hfunc",
"func",
"(",
")",
"Health",
")",
"http",
".",
"HandlerFunc",
"{",
"return",
"func",
"(",
"w",
"http",
".",
"ResponseWriter",
",",
"r",
"*",
"http",
".",
"Request",
")",
"{",
"if",
"r",
".",
"Method",
"!=",
"http",
".",
"MethodGet",
"{",
"w",
".",
"Header",
"(",
")",
".",
"Set",
"(",
"\"",
"\"",
",",
"http",
".",
"MethodGet",
")",
"\n",
"<mask>",
".",
"Error",
"(",
"w",
",",
"\"",
"\"",
",",
"http",
".",
"StatusMethodNotAllowed",
")",
"\n",
"return",
"\n",
"}",
"\n",
"h",
":=",
"hfunc",
"(",
")",
"\n",
"d",
",",
"_",
":=",
"json",
".",
"Marshal",
"(",
"h",
")",
"\n",
"if",
"h",
".",
"Health",
"!=",
"\"",
"\"",
"{",
"http",
".",
"Error",
"(",
"w",
",",
"string",
"(",
"d",
")",
",",
"http",
".",
"StatusServiceUnavailable",
")",
"\n",
"return",
"\n",
"}",
"\n",
"w",
".",
"WriteHeader",
"(",
"http",
".",
"StatusOK",
")",
"\n",
"w",
".",
"Write",
"(",
"d",
")",
"\n",
"}",
"\n",
"}"
] |
15,179 | all-15180 | [
"Add",
"an",
"item",
"into",
"skiplist",
"segment"
] | [
"func",
"(",
"s",
"*",
"Segment",
")",
"Add",
"(",
"itm",
"unsafe",
".",
"Pointer",
")",
"{",
"itemLevel",
":=",
"s",
".",
"builder",
".",
"store",
".",
"NewLevel",
"(",
"s",
".",
"<mask>",
".",
"Float32",
")",
"\n",
"x",
":=",
"s",
".",
"builder",
".",
"store",
".",
"newNode",
"(",
"itm",
",",
"itemLevel",
")",
"\n",
"s",
".",
"sts",
".",
"AddInt64",
"(",
"&",
"s",
".",
"sts",
".",
"nodeAllocs",
",",
"1",
")",
"\n",
"s",
".",
"sts",
".",
"AddInt64",
"(",
"&",
"s",
".",
"sts",
".",
"levelNodesCount",
"[",
"itemLevel",
"]",
",",
"1",
")",
"\n",
"s",
".",
"sts",
".",
"AddInt64",
"(",
"&",
"s",
".",
"sts",
".",
"usedBytes",
",",
"int64",
"(",
"s",
".",
"builder",
".",
"store",
".",
"Size",
"(",
"x",
")",
")",
")",
"\n\n",
"for",
"l",
":=",
"0",
";",
"l",
"<=",
"itemLevel",
";",
"l",
"++",
"{",
"if",
"s",
".",
"tail",
"[",
"l",
"]",
"!=",
"nil",
"{",
"s",
".",
"tail",
"[",
"l",
"]",
".",
"setNext",
"(",
"l",
",",
"x",
",",
"false",
")",
"\n",
"}",
"else",
"{",
"s",
".",
"head",
"[",
"l",
"]",
"=",
"x",
"\n",
"}",
"\n",
"s",
".",
"tail",
"[",
"l",
"]",
"=",
"x",
"\n",
"}",
"\n\n",
"if",
"s",
".",
"callb",
"!=",
"nil",
"{",
"s",
".",
"callb",
"(",
"x",
")",
"\n",
"}",
"\n",
"}"
] |
15,180 | all-15181 | [
"label",
"a",
"a",
"sync",
"object",
"identified",
"by",
"a",
"pointer"
] | [
"func",
"ObjectPtrLabel",
"(",
"ptr",
"unsafe",
".",
"Pointer",
",",
"length",
"int32",
",",
"label",
"*",
"uint8",
")",
"{",
"syscall",
".",
"Syscall",
"(",
"gpObjectPtrLabel",
",",
"3",
",",
"uintptr",
"(",
"ptr",
")",
",",
"uintptr",
"(",
"<mask>",
")",
",",
"uintptr",
"(",
"unsafe",
".",
"Pointer",
"(",
"label",
")",
")",
")",
"\n",
"}"
] |
15,181 | all-15182 | [
"readPaginatedResultsWithValues",
"is",
"an",
"override",
"that",
"allows",
"control",
"over",
"the",
"query",
"string",
"."
] | [
"func",
"(",
"c",
"*",
"Client",
")",
"readPaginatedResultsWithValues",
"(",
"path",
"string",
",",
"values",
"url",
".",
"Values",
",",
"accept",
"string",
",",
"newObj",
"func",
"(",
")",
"interface",
"{",
"}",
",",
"accumulate",
"func",
"(",
"interface",
"{",
"}",
")",
")",
"error",
"{",
"pagedPath",
":=",
"path",
"\n",
"if",
"len",
"(",
"values",
")",
">",
"0",
"{",
"pagedPath",
"+=",
"\"",
"\"",
"+",
"values",
".",
"Encode",
"(",
")",
"\n",
"}",
"\n",
"for",
"{",
"resp",
",",
"err",
":=",
"c",
".",
"requestRetry",
"(",
"http",
".",
"MethodGet",
",",
"pagedPath",
",",
"accept",
",",
"nil",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"defer",
"resp",
".",
"<mask>",
".",
"Close",
"(",
")",
"\n",
"if",
"resp",
".",
"StatusCode",
"<",
"200",
"||",
"resp",
".",
"StatusCode",
">",
"299",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"resp",
".",
"Status",
")",
"\n",
"}",
"\n\n",
"b",
",",
"err",
":=",
"ioutil",
".",
"ReadAll",
"(",
"resp",
".",
"Body",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"obj",
":=",
"newObj",
"(",
")",
"\n",
"if",
"err",
":=",
"json",
".",
"Unmarshal",
"(",
"b",
",",
"obj",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"accumulate",
"(",
"obj",
")",
"\n\n",
"link",
":=",
"parseLinks",
"(",
"resp",
".",
"Header",
".",
"Get",
"(",
"\"",
"\"",
")",
")",
"[",
"\"",
"\"",
"]",
"\n",
"if",
"link",
"==",
"\"",
"\"",
"{",
"break",
"\n",
"}",
"\n",
"u",
",",
"err",
":=",
"url",
".",
"Parse",
"(",
"link",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"}",
"\n",
"pagedPath",
"=",
"u",
".",
"RequestURI",
"(",
")",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
] |
15,182 | all-15183 | [
"CalendarNew",
"is",
"a",
"wrapper",
"around",
"gtk_calendar_new",
"()",
"."
] | [
"func",
"CalendarNew",
"(",
")",
"(",
"*",
"Calendar",
",",
"<mask>",
")",
"{",
"c",
":=",
"C",
".",
"gtk_calendar_new",
"(",
")",
"\n",
"if",
"c",
"==",
"nil",
"{",
"return",
"nil",
",",
"nilPtrErr",
"\n",
"}",
"\n",
"obj",
":=",
"glib",
".",
"Take",
"(",
"unsafe",
".",
"Pointer",
"(",
"c",
")",
")",
"\n",
"return",
"wrapCalendar",
"(",
"obj",
")",
",",
"nil",
"\n",
"}"
] |
15,183 | all-15184 | [
"We",
"only",
"fill",
"in",
"the",
"first",
"20",
"bytes",
"with",
"ripemd160"
] | [
"func",
"hash24",
"(",
"input",
"[",
"]",
"byte",
")",
"(",
"res",
"*",
"[",
"24",
"]",
"byte",
")",
"{",
"hasher",
":=",
"ripemd160",
".",
"New",
"(",
")",
"\n",
"hasher",
".",
"Write",
"(",
"input",
")",
"// does not error",
"\n",
"resSlice",
":=",
"hasher",
".",
"Sum",
"(",
"nil",
")",
"\n",
"res",
"=",
"new",
"(",
"[",
"24",
"]",
"byte",
")",
"\n",
"copy",
"(",
"<mask>",
"[",
":",
"]",
",",
"resSlice",
")",
"\n",
"return",
"\n",
"}"
] |
15,184 | all-15185 | [
"title",
":",
"kind",
"list",
"path",
":",
"/",
"events",
"/",
"kinds",
"method",
":",
"GET",
"produce",
":",
"application",
"/",
"json",
"responses",
":",
"200",
":",
"OK",
"204",
":",
"No",
"content"
] | [
"func",
"kindList",
"(",
"w",
"http",
".",
"ResponseWriter",
",",
"r",
"*",
"http",
".",
"Request",
",",
"t",
"auth",
".",
"Token",
")",
"error",
"{",
"kinds",
",",
"err",
":=",
"event",
".",
"GetKinds",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"if",
"len",
"(",
"kinds",
")",
"==",
"0",
"{",
"w",
".",
"WriteHeader",
"(",
"<mask>",
".",
"StatusNoContent",
")",
"\n",
"return",
"nil",
"\n",
"}",
"\n",
"w",
".",
"Header",
"(",
")",
".",
"Add",
"(",
"\"",
"\"",
",",
"\"",
"\"",
")",
"\n",
"return",
"json",
".",
"NewEncoder",
"(",
"w",
")",
".",
"Encode",
"(",
"kinds",
")",
"\n",
"}"
] |
15,185 | all-15186 | [
"establish",
"a",
"buffer",
"for",
"selection",
"mode",
"values"
] | [
"func",
"SelectBuffer",
"(",
"size",
"int32",
",",
"buffer",
"*",
"uint32",
")",
"{",
"C",
".",
"glowSelectBuffer",
"(",
"gpSelectBuffer",
",",
"(",
"C",
".",
"GLsizei",
")",
"(",
"<mask>",
")",
",",
"(",
"*",
"C",
".",
"GLuint",
")",
"(",
"unsafe",
".",
"Pointer",
"(",
"buffer",
")",
")",
")",
"\n",
"}"
] |
15,186 | all-15187 | [
"isTaskManaged",
"checks",
"if",
"task",
"for",
"the",
"corresponding",
"arn",
"is",
"present"
] | [
"func",
"(",
"engine",
"*",
"DockerTaskEngine",
")",
"isTaskManaged",
"(",
"arn",
"string",
")",
"bool",
"{",
"engine",
".",
"tasksLock",
".",
"RLock",
"(",
")",
"\n",
"defer",
"engine",
".",
"tasksLock",
".",
"RUnlock",
"(",
")",
"\n",
"_",
",",
"ok",
":=",
"<mask>",
".",
"managedTasks",
"[",
"arn",
"]",
"\n",
"return",
"ok",
"\n",
"}"
] |
15,187 | all-15188 | [
"HasNotifyNoData",
"returns",
"a",
"boolean",
"if",
"a",
"field",
"has",
"been",
"set",
"."
] | [
"func",
"(",
"a",
"*",
"Alert",
")",
"HasNotifyNoData",
"(",
")",
"bool",
"{",
"if",
"a",
"!=",
"nil",
"&&",
"a",
".",
"NotifyNoData",
"!=",
"nil",
"{",
"return",
"true",
"\n",
"}",
"\n\n",
"return",
"<mask>",
"\n",
"}"
] |
15,188 | all-15189 | [
"invalidate",
"the",
"entirety",
"a",
"texture",
"image"
] | [
"func",
"InvalidateTexImage",
"(",
"texture",
"uint32",
",",
"level",
"int32",
")",
"{",
"C",
".",
"glowInvalidateTexImage",
"(",
"gpInvalidateTexImage",
",",
"(",
"C",
".",
"GLuint",
")",
"(",
"texture",
")",
",",
"(",
"C",
".",
"GLint",
")",
"(",
"<mask>",
")",
")",
"\n",
"}"
] |
15,189 | all-15190 | [
"IgnoreMapEntries",
"returns",
"an",
"Option",
"that",
"ignores",
"entries",
"of",
"map",
"[",
"K",
"]",
"V",
".",
"The",
"discard",
"function",
"must",
"be",
"of",
"the",
"form",
"func",
"(",
"T",
"R",
")",
"bool",
"which",
"is",
"used",
"to",
"ignore",
"map",
"entries",
"of",
"type",
"K",
"and",
"V",
"where",
"K",
"and",
"V",
"are",
"assignable",
"to",
"T",
"and",
"R",
".",
"Entries",
"are",
"ignored",
"if",
"the",
"function",
"reports",
"true",
"."
] | [
"func",
"IgnoreMapEntries",
"(",
"discardFunc",
"interface",
"{",
"}",
")",
"cmp",
".",
"Option",
"{",
"vf",
":=",
"reflect",
".",
"ValueOf",
"(",
"discardFunc",
")",
"\n",
"if",
"!",
"function",
".",
"IsType",
"(",
"vf",
".",
"Type",
"(",
")",
",",
"function",
".",
"KeyValuePredicate",
")",
"||",
"vf",
".",
"IsNil",
"(",
")",
"{",
"panic",
"(",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"discardFunc",
")",
")",
"\n",
"}",
"\n",
"return",
"cmp",
".",
"FilterPath",
"(",
"func",
"(",
"p",
"cmp",
".",
"Path",
")",
"bool",
"{",
"mi",
",",
"ok",
":=",
"p",
".",
"Index",
"(",
"-",
"1",
")",
".",
"(",
"cmp",
".",
"MapIndex",
")",
"\n",
"if",
"!",
"ok",
"{",
"return",
"false",
"\n",
"}",
"\n",
"if",
"!",
"mi",
".",
"Key",
"(",
")",
".",
"Type",
"(",
")",
".",
"AssignableTo",
"(",
"vf",
".",
"<mask>",
"(",
")",
".",
"In",
"(",
"0",
")",
")",
"||",
"!",
"mi",
".",
"Type",
"(",
")",
".",
"AssignableTo",
"(",
"vf",
".",
"Type",
"(",
")",
".",
"In",
"(",
"1",
")",
")",
"{",
"return",
"false",
"\n",
"}",
"\n",
"k",
":=",
"mi",
".",
"Key",
"(",
")",
"\n",
"vx",
",",
"vy",
":=",
"mi",
".",
"Values",
"(",
")",
"\n",
"if",
"vx",
".",
"IsValid",
"(",
")",
"&&",
"vf",
".",
"Call",
"(",
"[",
"]",
"reflect",
".",
"Value",
"{",
"k",
",",
"vx",
"}",
")",
"[",
"0",
"]",
".",
"Bool",
"(",
")",
"{",
"return",
"true",
"\n",
"}",
"\n",
"if",
"vy",
".",
"IsValid",
"(",
")",
"&&",
"vf",
".",
"Call",
"(",
"[",
"]",
"reflect",
".",
"Value",
"{",
"k",
",",
"vy",
"}",
")",
"[",
"0",
"]",
".",
"Bool",
"(",
")",
"{",
"return",
"true",
"\n",
"}",
"\n",
"return",
"false",
"\n",
"}",
",",
"cmp",
".",
"Ignore",
"(",
")",
")",
"\n",
"}"
] |
15,190 | all-15191 | [
"GetEtcdClient",
"returns",
"the",
"already",
"connected",
"etcd",
"client",
"without",
"modification",
"."
] | [
"func",
"(",
"env",
"*",
"ServiceEnv",
")",
"GetEtcdClient",
"(",
")",
"*",
"etcd",
".",
"<mask>",
"{",
"if",
"err",
":=",
"env",
".",
"etcdEg",
".",
"Wait",
"(",
")",
";",
"err",
"!=",
"nil",
"{",
"panic",
"(",
"err",
")",
"// If env can't connect, there's no sensible way to recover",
"\n",
"}",
"\n",
"if",
"env",
".",
"etcdClient",
"==",
"nil",
"{",
"panic",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"return",
"env",
".",
"etcdClient",
"\n",
"}"
] |
15,191 | all-15192 | [
"String",
"returns",
"the",
"name",
"of",
"e"
] | [
"func",
"(",
"e",
"ManageOfferResultCode",
")",
"String",
"(",
")",
"string",
"{",
"<mask>",
",",
"_",
":=",
"manageOfferResultCodeMap",
"[",
"int32",
"(",
"e",
")",
"]",
"\n",
"return",
"name",
"\n",
"}"
] |
15,192 | all-15193 | [
"SwarmConnect",
"opens",
"a",
"swarm",
"connection",
"to",
"a",
"specific",
"address",
"."
] | [
"func",
"(",
"s",
"*",
"Shell",
")",
"SwarmConnect",
"(",
"ctx",
"context",
".",
"Context",
",",
"addr",
"...",
"string",
")",
"error",
"{",
"<mask>",
"conn",
"*",
"swarmConnection",
"\n",
"err",
":=",
"s",
".",
"Request",
"(",
"\"",
"\"",
")",
".",
"Arguments",
"(",
"addr",
"...",
")",
".",
"Exec",
"(",
"ctx",
",",
"&",
"conn",
")",
"\n",
"return",
"err",
"\n",
"}"
] |
15,193 | all-15194 | [
"FormatPart",
"pretty",
"prints",
"the",
"Part",
"tree"
] | [
"func",
"FormatPart",
"(",
"w",
"io",
".",
"Writer",
",",
"p",
"*",
"enmime",
".",
"Part",
",",
"indent",
"string",
")",
"{",
"if",
"p",
"==",
"nil",
"{",
"return",
"\n",
"}",
"\n\n",
"sibling",
":=",
"p",
".",
"NextSibling",
"\n",
"child",
":=",
"p",
".",
"FirstChild",
"\n\n",
"// Compute indent strings",
"myindent",
":=",
"indent",
"+",
"\"",
"\"",
"\n",
"childindent",
":=",
"indent",
"+",
"\"",
"\"",
"\n",
"if",
"sibling",
"!=",
"nil",
"{",
"myindent",
"=",
"indent",
"+",
"\"",
"\"",
"\n",
"childindent",
"=",
"indent",
"+",
"\"",
"\"",
"\n",
"}",
"\n",
"if",
"p",
".",
"Parent",
"==",
"nil",
"{",
"// Root shouldn't be decorated, has no siblings",
"myindent",
"=",
"indent",
"\n",
"childindent",
"=",
"indent",
"\n",
"}",
"\n\n",
"// Format and print this node",
"ctype",
":=",
"\"",
"\"",
"\n",
"if",
"p",
".",
"ContentType",
"!=",
"\"",
"\"",
"{",
"ctype",
"=",
"p",
".",
"ContentType",
"\n",
"}",
"\n",
"disposition",
":=",
"\"",
"\"",
"\n",
"if",
"p",
".",
"Disposition",
"!=",
"\"",
"\"",
"{",
"disposition",
"=",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"p",
".",
"Disposition",
")",
"\n",
"}",
"\n",
"filename",
":=",
"\"",
"\"",
"\n",
"if",
"p",
".",
"FileName",
"!=",
"\"",
"\"",
"{",
"filename",
"=",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"p",
".",
"FileName",
")",
"\n",
"}",
"\n",
"<mask>",
":=",
"\"",
"\"",
"\n",
"if",
"len",
"(",
"p",
".",
"Errors",
")",
">",
"0",
"{",
"errors",
"=",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"len",
"(",
"p",
".",
"Errors",
")",
")",
"\n",
"}",
"\n",
"fmt",
".",
"Fprintf",
"(",
"w",
",",
"\"",
"\\n",
"\"",
",",
"myindent",
",",
"ctype",
",",
"disposition",
",",
"filename",
",",
"errors",
")",
"\n\n",
"// Recurse",
"FormatPart",
"(",
"w",
",",
"child",
",",
"childindent",
")",
"\n",
"FormatPart",
"(",
"w",
",",
"sibling",
",",
"indent",
")",
"\n",
"}"
] |
15,194 | all-15195 | [
"ApproxFuncEqual",
"takes",
"in",
"a",
"func",
"that",
"compares",
"two",
"floats",
"and",
"uses",
"it",
"to",
"do",
"an",
"element",
"-",
"wise",
"comparison",
"of",
"the",
"vector",
"to",
"another",
".",
"This",
"is",
"intended",
"to",
"be",
"used",
"with",
"FloatEqualFunc"
] | [
"func",
"(",
"v",
"Vec",
")",
"ApproxFuncEqual",
"(",
"v2",
"Vec",
",",
"eq",
"func",
"(",
"float64",
",",
"float64",
")",
"bool",
")",
"bool",
"{",
"if",
"!",
"eq",
"(",
"v",
".",
"X",
",",
"v2",
".",
"X",
")",
"{",
"return",
"false",
"\n",
"}",
"\n",
"if",
"!",
"<mask>",
"(",
"v",
".",
"Y",
",",
"v2",
".",
"Y",
")",
"{",
"return",
"false",
"\n",
"}",
"\n",
"return",
"true",
"\n",
"}"
] |
15,195 | all-15196 | [
"Range",
"is",
"a",
"utility",
"function",
"that",
"creates",
"a",
"code",
"builder",
".",
"Example",
":",
"var",
"code",
"=",
"Range",
"(",
"1000",
"2000",
")",
"var",
"ErrSomethingWasWrong",
":",
"=",
"&ErrDescriptor",
"{",
"//",
"...",
"Code",
":",
"code",
"(",
"77",
")",
"}",
"This",
"can",
"be",
"used",
"to",
"create",
"disjunct",
"code",
"ranges",
"and",
"be",
"strict",
"about",
"it",
".",
"The",
"codes",
"created",
"by",
"the",
"returned",
"function",
"will",
"range",
"from",
"start",
"(",
"inclusive",
")",
"to",
"end",
"(",
"exclusive",
")",
"or",
"the",
"function",
"will",
"panic",
"otherwise",
"."
] | [
"func",
"Range",
"(",
"start",
"uint32",
",",
"end",
"uint32",
")",
"func",
"(",
"uint32",
")",
"Code",
"{",
"if",
"end",
"<=",
"start",
"{",
"panic",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"return",
"func",
"(",
"i",
"uint32",
")",
"Code",
"{",
"if",
"i",
">=",
"(",
"end",
"-",
"start",
")",
"{",
"panic",
"(",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"i",
",",
"start",
",",
"end",
")",
")",
"\n",
"}",
"\n\n",
"return",
"Code",
"(",
"<mask>",
"+",
"i",
")",
"\n",
"}",
"\n",
"}"
] |
15,196 | all-15197 | [
"ShouldReport",
"returns",
"if",
"this",
"prowjob",
"should",
"be",
"reported",
"by",
"the",
"github",
"reporter"
] | [
"func",
"(",
"c",
"*",
"Client",
")",
"ShouldReport",
"(",
"pj",
"*",
"v1",
".",
"ProwJob",
")",
"bool",
"{",
"if",
"!",
"pj",
".",
"Spec",
".",
"Report",
"{",
"// Respect report field",
"return",
"false",
"\n",
"}",
"\n\n",
"if",
"pj",
".",
"Spec",
".",
"<mask>",
"!=",
"v1",
".",
"PresubmitJob",
"&&",
"pj",
".",
"Spec",
".",
"Type",
"!=",
"v1",
".",
"PostsubmitJob",
"{",
"// Report presubmit and postsubmit github jobs for github reporter",
"return",
"false",
"\n",
"}",
"\n\n",
"if",
"c",
".",
"reportAgent",
"!=",
"\"",
"\"",
"&&",
"pj",
".",
"Spec",
".",
"Agent",
"!=",
"c",
".",
"reportAgent",
"{",
"// Only report for specified agent",
"return",
"false",
"\n",
"}",
"\n\n",
"return",
"true",
"\n",
"}"
] |
15,197 | all-15198 | [
"Helper",
"around",
"the",
"low",
"-",
"level",
"DB",
"API",
"which",
"also",
"updates",
"the",
"driver",
"names",
"cache",
"."
] | [
"func",
"dbStoragePoolDeleteAndUpdateCache",
"(",
"<mask>",
"*",
"db",
".",
"Cluster",
",",
"poolName",
"string",
")",
"error",
"{",
"_",
",",
"err",
":=",
"db",
".",
"StoragePoolDelete",
"(",
"poolName",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"// Update the storage drivers cache in api_1.0.go.",
"storagePoolDriversCacheUpdate",
"(",
"db",
")",
"\n\n",
"return",
"err",
"\n",
"}"
] |
15,198 | all-15199 | [
"EscapeCommaSeparated",
"escapes",
"the",
"args",
"and",
"make",
"a",
"comma",
"separeted",
"list",
"with",
"it",
"."
] | [
"func",
"EscapeCommaSeparated",
"(",
"<mask>",
"...",
"string",
")",
"string",
"{",
"var",
"out",
"string",
"\n",
"for",
"i",
",",
"str",
":=",
"range",
"in",
"{",
"escaped",
":=",
"strings",
".",
"Replace",
"(",
"url",
".",
"QueryEscape",
"(",
"str",
")",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"-",
"1",
")",
"\n",
"escaped",
"=",
"strings",
".",
"Replace",
"(",
"escaped",
",",
"\"",
"\\\"",
"\"",
",",
"\"",
"\"",
",",
"-",
"1",
")",
"\n",
"escaped",
"=",
"strings",
".",
"Replace",
"(",
"escaped",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"-",
"1",
")",
"\n",
"out",
"+=",
"escaped",
"\n",
"if",
"i",
"<",
"len",
"(",
"in",
")",
"-",
"1",
"{",
"out",
"+=",
"\"",
"\"",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"out",
"\n",
"}"
] |
15,199 | all-15200 | [
"ListSchemas",
"is",
"a",
"wrapper",
"around",
"g_settings_schema_source_list_schemas",
"()",
"."
] | [
"func",
"(",
"v",
"*",
"SettingsSchemaSource",
")",
"ListSchemas",
"(",
"recursive",
"bool",
")",
"(",
"nonReolcatable",
",",
"relocatable",
"[",
"]",
"string",
")",
"{",
"<mask>",
"nonRel",
",",
"rel",
"*",
"*",
"C",
".",
"gchar",
"\n",
"C",
".",
"g_settings_schema_source_list_schemas",
"(",
"v",
".",
"native",
"(",
")",
",",
"gbool",
"(",
"recursive",
")",
",",
"&",
"nonRel",
",",
"&",
"rel",
")",
"\n",
"return",
"toGoStringArray",
"(",
"nonRel",
")",
",",
"toGoStringArray",
"(",
"rel",
")",
"\n",
"}"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.