id
int32 0
25.3k
| idx
stringlengths 5
9
| nl_tokens
sequencelengths 1
418
| pl_tokens
sequencelengths 22
4.98k
|
---|---|---|---|
4,500 | all-4501 | [
"Profiles",
"returns",
"a",
"string",
"list",
"of",
"profiles",
"."
] | [
"func",
"(",
"c",
"*",
"Cluster",
")",
"Profiles",
"(",
"project",
"string",
")",
"(",
"[",
"]",
"string",
",",
"error",
")",
"{",
"err",
":=",
"c",
".",
"Transaction",
"(",
"func",
"(",
"tx",
"*",
"ClusterTx",
")",
"error",
"{",
"enabled",
",",
"err",
":=",
"tx",
".",
"ProjectHasProfiles",
"(",
"project",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"errors",
".",
"Wrap",
"(",
"err",
",",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"if",
"!",
"enabled",
"{",
"project",
"=",
"\"",
"\"",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"q",
":=",
"fmt",
".",
"Sprintf",
"(",
"`\nSELECT profiles.name\n FROM profiles\n JOIN projects ON projects.id = profiles.project_id\nWHERE projects.name = ?\n`",
")",
"\n",
"inargs",
":=",
"[",
"]",
"interface",
"{",
"}",
"{",
"<mask>",
"}",
"\n",
"var",
"name",
"string",
"\n",
"outfmt",
":=",
"[",
"]",
"interface",
"{",
"}",
"{",
"name",
"}",
"\n",
"result",
",",
"err",
":=",
"queryScan",
"(",
"c",
".",
"db",
",",
"q",
",",
"inargs",
",",
"outfmt",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"[",
"]",
"string",
"{",
"}",
",",
"err",
"\n",
"}",
"\n\n",
"response",
":=",
"[",
"]",
"string",
"{",
"}",
"\n",
"for",
"_",
",",
"r",
":=",
"range",
"result",
"{",
"response",
"=",
"append",
"(",
"response",
",",
"r",
"[",
"0",
"]",
".",
"(",
"string",
")",
")",
"\n",
"}",
"\n\n",
"return",
"response",
",",
"nil",
"\n",
"}"
] |
4,501 | all-4502 | [
"EnterPopupText",
"enters",
"text",
"into",
"an",
"open",
"prompt",
"popup",
"."
] | [
"func",
"(",
"p",
"*",
"Page",
")",
"EnterPopupText",
"(",
"text",
"string",
")",
"error",
"{",
"if",
"err",
":=",
"p",
".",
"<mask>",
".",
"SetAlertText",
"(",
"text",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
] |
4,502 | all-4503 | [
"Open",
"the",
"cluster",
"database",
"object",
".",
"The",
"name",
"argument",
"is",
"the",
"name",
"of",
"the",
"cluster",
"database",
".",
"It",
"defaults",
"to",
"db",
".",
"bin",
"but",
"can",
"be",
"overwritten",
"for",
"testing",
".",
"The",
"dialer",
"argument",
"is",
"a",
"function",
"that",
"returns",
"a",
"gRPC",
"dialer",
"that",
"can",
"be",
"used",
"to",
"connect",
"to",
"a",
"database",
"node",
"using",
"the",
"gRPC",
"SQL",
"package",
"."
] | [
"func",
"Open",
"(",
"name",
"string",
",",
"store",
"dqlite",
".",
"ServerStore",
",",
"options",
"...",
"dqlite",
".",
"DriverOption",
")",
"(",
"*",
"sql",
".",
"DB",
",",
"error",
")",
"{",
"driver",
",",
"err",
":=",
"dqlite",
".",
"NewDriver",
"(",
"store",
",",
"options",
"...",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"errors",
".",
"Wrap",
"(",
"err",
",",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"driverName",
":=",
"dqliteDriverName",
"(",
")",
"\n",
"sql",
".",
"Register",
"(",
"driverName",
",",
"driver",
")",
"\n\n",
"// Create the cluster db. This won't immediately establish any network",
"// connection, that will happen only when a db transaction is started",
"// (see the database/sql connection pooling code for more details).",
"if",
"name",
"==",
"\"",
"\"",
"{",
"name",
"=",
"\"",
"\"",
"\n",
"}",
"\n",
"db",
",",
"err",
":=",
"sql",
".",
"Open",
"(",
"driverName",
",",
"<mask>",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"}",
"\n\n",
"return",
"db",
",",
"nil",
"\n",
"}"
] |
4,503 | all-4504 | [
"UnmarshalJSON",
"supports",
"json",
".",
"Unmarshaler",
"interface"
] | [
"func",
"(",
"v",
"*",
"EventScriptParsed",
")",
"UnmarshalJSON",
"(",
"data",
"[",
"]",
"byte",
")",
"error",
"{",
"r",
":=",
"jlexer",
".",
"Lexer",
"{",
"Data",
":",
"<mask>",
"}",
"\n",
"easyjsonC5a4559bDecodeGithubComChromedpCdprotoDebugger37",
"(",
"&",
"r",
",",
"v",
")",
"\n",
"return",
"r",
".",
"Error",
"(",
")",
"\n",
"}"
] |
4,504 | all-4505 | [
"PendingNonceAt",
"returns",
"the",
"account",
"nonce",
"of",
"the",
"given",
"account",
"in",
"the",
"pending",
"state",
".",
"This",
"is",
"the",
"nonce",
"that",
"should",
"be",
"used",
"for",
"the",
"next",
"transaction",
"."
] | [
"func",
"(",
"b",
"*",
"backendInstance",
")",
"PendingNonceAt",
"(",
"ctx",
"context",
".",
"Context",
",",
"account",
"common",
".",
"<mask>",
")",
"(",
"uint64",
",",
"error",
")",
"{",
"ctx",
",",
"cancel",
":=",
"b",
".",
"addTimeout",
"(",
"ctx",
")",
"\n",
"defer",
"cancel",
"(",
")",
"\n",
"return",
"b",
".",
"conn",
".",
"ethClient",
"(",
")",
".",
"PendingNonceAt",
"(",
"ctx",
",",
"account",
")",
"\n",
"}"
] |
4,505 | all-4506 | [
"GetAngle",
"is",
"a",
"wrapper",
"around",
"gtk_label_get_angle",
"()",
"."
] | [
"func",
"(",
"v",
"*",
"<mask>",
")",
"GetAngle",
"(",
")",
"float64",
"{",
"c",
":=",
"C",
".",
"gtk_label_get_angle",
"(",
"v",
".",
"native",
"(",
")",
")",
"\n",
"return",
"float64",
"(",
"c",
")",
"\n",
"}"
] |
4,506 | all-4507 | [
"PackEnd",
"()",
"is",
"a",
"wrapper",
"around",
"gtk_box_pack_end",
"()",
"."
] | [
"func",
"(",
"v",
"*",
"Box",
")",
"PackEnd",
"(",
"child",
"IWidget",
",",
"expand",
",",
"fill",
"bool",
",",
"padding",
"uint",
")",
"{",
"C",
".",
"gtk_box_pack_end",
"(",
"v",
".",
"native",
"(",
")",
",",
"child",
".",
"toWidget",
"(",
")",
",",
"gbool",
"(",
"expand",
")",
",",
"gbool",
"(",
"fill",
")",
",",
"C",
".",
"guint",
"(",
"<mask>",
")",
")",
"\n",
"}"
] |
4,507 | all-4508 | [
"Match",
"checks",
"whether",
"a",
"zone",
"matches",
"one",
"of",
"the",
"provided",
"zone",
"ids"
] | [
"func",
"(",
"f",
"ZoneIDFilter",
")",
"Match",
"(",
"zoneID",
"string",
")",
"bool",
"{",
"// An empty filter includes all zones.",
"if",
"len",
"(",
"f",
".",
"zoneIDs",
")",
"==",
"0",
"{",
"return",
"true",
"\n",
"}",
"\n\n",
"for",
"_",
",",
"id",
":=",
"<mask>",
"f",
".",
"zoneIDs",
"{",
"if",
"strings",
".",
"HasSuffix",
"(",
"zoneID",
",",
"id",
")",
"{",
"return",
"true",
"\n",
"}",
"\n",
"}",
"\n\n",
"return",
"false",
"\n",
"}"
] |
4,508 | all-4509 | [
"Extract",
"returns",
"positional",
"and",
"named",
"variables",
"extracted",
"from",
"the",
"URL",
"path",
"."
] | [
"func",
"(",
"m",
"*",
"GorillaPath",
")",
"Extract",
"(",
"result",
"*",
"Result",
",",
"r",
"*",
"http",
".",
"Request",
")",
"{",
"result",
".",
"Values",
"=",
"mergeValues",
"(",
"result",
".",
"Values",
",",
"m",
".",
"Values",
"(",
"r",
".",
"URL",
".",
"Path",
")",
")",
"\n",
"if",
"result",
".",
"Handler",
"==",
"nil",
"&&",
"m",
".",
"strictSlash",
"{",
"result",
".",
"<mask>",
"=",
"redirectPath",
"(",
"m",
".",
"pattern",
",",
"r",
")",
"\n",
"}",
"\n",
"}"
] |
4,509 | all-4510 | [
"GetAggregatorOk",
"returns",
"a",
"tuple",
"with",
"the",
"Aggregator",
"field",
"if",
"it",
"s",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"and",
"a",
"boolean",
"to",
"check",
"if",
"the",
"value",
"has",
"been",
"set",
"."
] | [
"func",
"(",
"q",
"*",
"QueryValueRequest",
")",
"GetAggregatorOk",
"(",
")",
"(",
"string",
",",
"bool",
")",
"{",
"if",
"q",
"==",
"nil",
"||",
"q",
".",
"Aggregator",
"==",
"nil",
"{",
"return",
"\"",
"\"",
",",
"<mask>",
"\n",
"}",
"\n",
"return",
"*",
"q",
".",
"Aggregator",
",",
"true",
"\n",
"}"
] |
4,510 | all-4511 | [
"Patch",
"applies",
"the",
"patch",
"and",
"returns",
"the",
"patched",
"app",
"."
] | [
"func",
"(",
"c",
"*",
"FakeApps",
")",
"Patch",
"(",
"name",
"string",
",",
"pt",
"types",
".",
"PatchType",
",",
"<mask>",
"[",
"]",
"byte",
",",
"subresources",
"...",
"string",
")",
"(",
"result",
"*",
"tsuru_v1",
".",
"App",
",",
"err",
"error",
")",
"{",
"obj",
",",
"err",
":=",
"c",
".",
"Fake",
".",
"Invokes",
"(",
"testing",
".",
"NewPatchSubresourceAction",
"(",
"appsResource",
",",
"c",
".",
"ns",
",",
"name",
",",
"data",
",",
"subresources",
"...",
")",
",",
"&",
"tsuru_v1",
".",
"App",
"{",
"}",
")",
"\n\n",
"if",
"obj",
"==",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"return",
"obj",
".",
"(",
"*",
"tsuru_v1",
".",
"App",
")",
",",
"err",
"\n",
"}"
] |
4,511 | all-4512 | [
"OCIConfig",
"returns",
"the",
"image",
"configuration",
"as",
"per",
"OCI",
"v1",
"image",
"-",
"spec",
".",
"Information",
"about",
"layers",
"in",
"the",
"resulting",
"configuration",
"isn",
"t",
"guaranteed",
"to",
"be",
"returned",
"to",
"due",
"how",
"old",
"image",
"manifests",
"work",
"(",
"docker",
"v2s1",
"especially",
")",
"."
] | [
"func",
"(",
"m",
"*",
"manifestSchema2",
")",
"OCIConfig",
"(",
"ctx",
"<mask>",
".",
"Context",
")",
"(",
"*",
"imgspecv1",
".",
"Image",
",",
"error",
")",
"{",
"configBlob",
",",
"err",
":=",
"m",
".",
"ConfigBlob",
"(",
"ctx",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"// docker v2s2 and OCI v1 are mostly compatible but v2s2 contains more fields",
"// than OCI v1. This unmarshal makes sure we drop docker v2s2",
"// fields that aren't needed in OCI v1.",
"configOCI",
":=",
"&",
"imgspecv1",
".",
"Image",
"{",
"}",
"\n",
"if",
"err",
":=",
"json",
".",
"Unmarshal",
"(",
"configBlob",
",",
"configOCI",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"return",
"configOCI",
",",
"nil",
"\n",
"}"
] |
4,512 | all-4513 | [
"flattenDVSTrafficShapingPolicyIngress",
"reads",
"various",
"fields",
"from",
"the",
"DVSTrafficShapingPolicy",
"ingress",
"policy",
"into",
"the",
"passed",
"in",
"ResourceData",
"."
] | [
"func",
"flattenDVSTrafficShapingPolicyIngress",
"(",
"d",
"*",
"schema",
".",
"ResourceData",
",",
"obj",
"*",
"<mask>",
".",
"DVSTrafficShapingPolicy",
")",
"error",
"{",
"if",
"obj",
"==",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n\n",
"structure",
".",
"SetBoolPolicy",
"(",
"d",
",",
"\"",
"\"",
",",
"obj",
".",
"Enabled",
")",
"\n",
"structure",
".",
"SetLongPolicy",
"(",
"d",
",",
"\"",
"\"",
",",
"obj",
".",
"AverageBandwidth",
")",
"\n",
"structure",
".",
"SetLongPolicy",
"(",
"d",
",",
"\"",
"\"",
",",
"obj",
".",
"PeakBandwidth",
")",
"\n",
"structure",
".",
"SetLongPolicy",
"(",
"d",
",",
"\"",
"\"",
",",
"obj",
".",
"BurstSize",
")",
"\n\n",
"return",
"nil",
"\n",
"}"
] |
4,513 | all-4514 | [
"NewRequestTx",
"returns",
"a",
"new",
"transaction",
"with",
"a",
"request",
"url",
"."
] | [
"func",
"NewRequestTx",
"(",
"name",
"string",
",",
"url",
"string",
")",
"*",
"<mask>",
"{",
"t",
":=",
"NewTx",
"(",
"name",
")",
"\n",
"t",
".",
"url",
"=",
"url",
"\n",
"return",
"t",
"\n",
"}"
] |
4,514 | all-4515 | [
"newGraph",
"returns",
"a",
"new",
"graph",
"."
] | [
"func",
"newGraph",
"(",
")",
"*",
"graph",
"{",
"return",
"&",
"graph",
"{",
"idToNodes",
":",
"make",
"(",
"map",
"[",
"<mask>",
"]",
"Node",
")",
",",
"nodeToSources",
":",
"make",
"(",
"map",
"[",
"ID",
"]",
"map",
"[",
"ID",
"]",
"float64",
")",
",",
"nodeToTargets",
":",
"make",
"(",
"map",
"[",
"ID",
"]",
"map",
"[",
"ID",
"]",
"float64",
")",
",",
"//",
"// without this",
"// panic: assignment to entry in nil map",
"}",
"\n",
"}"
] |
4,515 | all-4516 | [
"Range",
"creates",
"a",
"Range",
"query",
".",
"Similar",
"to",
"Row",
"but",
"only",
"returns",
"columns",
"which",
"were",
"set",
"with",
"timestamps",
"between",
"the",
"given",
"start",
"and",
"end",
"timestamps",
".",
"*",
"Deprecated",
"at",
"Pilosa",
"1",
".",
"3",
"*"
] | [
"func",
"(",
"f",
"*",
"Field",
")",
"Range",
"(",
"rowIDOrKey",
"interface",
"{",
"}",
",",
"start",
"<mask>",
".",
"Time",
",",
"end",
"time",
".",
"Time",
")",
"*",
"PQLRowQuery",
"{",
"rowStr",
",",
"err",
":=",
"formatIDKeyBool",
"(",
"rowIDOrKey",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"NewPQLRowQuery",
"(",
"\"",
"\"",
",",
"f",
".",
"index",
",",
"err",
")",
"\n",
"}",
"\n",
"text",
":=",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"f",
".",
"name",
",",
"rowStr",
",",
"start",
".",
"Format",
"(",
"timeFormat",
")",
",",
"end",
".",
"Format",
"(",
"timeFormat",
")",
")",
"\n",
"q",
":=",
"NewPQLRowQuery",
"(",
"text",
",",
"f",
".",
"index",
",",
"nil",
")",
"\n",
"return",
"q",
"\n",
"}"
] |
4,516 | all-4517 | [
"GetMaxWidthChars",
"()",
"is",
"a",
"wrapper",
"around",
"gtk_entry_get_max_width_chars",
"()",
"."
] | [
"func",
"(",
"v",
"*",
"<mask>",
")",
"GetMaxWidthChars",
"(",
")",
"int",
"{",
"c",
":=",
"C",
".",
"gtk_entry_get_max_width_chars",
"(",
"v",
".",
"native",
"(",
")",
")",
"\n",
"return",
"int",
"(",
"c",
")",
"\n",
"}"
] |
4,517 | all-4518 | [
"NewDigitalOceanProvider",
"initializes",
"a",
"new",
"DigitalOcean",
"DNS",
"based",
"Provider",
"."
] | [
"func",
"NewDigitalOceanProvider",
"(",
"domainFilter",
"DomainFilter",
",",
"dryRun",
"bool",
")",
"(",
"*",
"DigitalOceanProvider",
",",
"error",
")",
"{",
"token",
",",
"ok",
":=",
"os",
".",
"LookupEnv",
"(",
"\"",
"\"",
")",
"\n",
"if",
"!",
"ok",
"{",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"oauthClient",
":=",
"oauth2",
".",
"NewClient",
"(",
"oauth2",
".",
"NoContext",
",",
"oauth2",
".",
"StaticTokenSource",
"(",
"&",
"oauth2",
".",
"Token",
"{",
"AccessToken",
":",
"token",
",",
"}",
")",
")",
"\n",
"client",
":=",
"godo",
".",
"NewClient",
"(",
"oauthClient",
")",
"\n\n",
"provider",
":=",
"&",
"DigitalOceanProvider",
"{",
"<mask>",
":",
"client",
".",
"Domains",
",",
"domainFilter",
":",
"domainFilter",
",",
"DryRun",
":",
"dryRun",
",",
"}",
"\n",
"return",
"provider",
",",
"nil",
"\n",
"}"
] |
4,518 | all-4519 | [
"newState",
"parses",
"the",
"type",
"information",
"for",
"a",
"parsed",
"Thrift",
"file",
"and",
"returns",
"the",
"state",
"."
] | [
"func",
"newState",
"(",
"v",
"*",
"<mask>",
".",
"Thrift",
",",
"all",
"map",
"[",
"string",
"]",
"parseState",
")",
"*",
"State",
"{",
"typedefs",
":=",
"make",
"(",
"map",
"[",
"string",
"]",
"*",
"parser",
".",
"Type",
")",
"\n",
"for",
"k",
",",
"v",
":=",
"range",
"v",
".",
"Typedefs",
"{",
"typedefs",
"[",
"k",
"]",
"=",
"v",
".",
"Type",
"\n",
"}",
"\n\n",
"// Enums are typedefs to an int64.",
"i64Type",
":=",
"&",
"parser",
".",
"Type",
"{",
"Name",
":",
"\"",
"\"",
"}",
"\n",
"for",
"k",
":=",
"range",
"v",
".",
"Enums",
"{",
"typedefs",
"[",
"k",
"]",
"=",
"i64Type",
"\n",
"}",
"\n\n",
"return",
"&",
"State",
"{",
"typedefs",
",",
"nil",
",",
"all",
"}",
"\n",
"}"
] |
4,519 | all-4520 | [
"GetRepoProjects",
"returns",
"the",
"list",
"of",
"projects",
"in",
"this",
"repo",
".",
"See",
"https",
":",
"//",
"developer",
".",
"github",
".",
"com",
"/",
"v3",
"/",
"projects",
"/",
"#list",
"-",
"repository",
"-",
"projects"
] | [
"func",
"(",
"c",
"*",
"Client",
")",
"GetRepoProjects",
"(",
"owner",
",",
"repo",
"string",
")",
"(",
"[",
"]",
"Project",
",",
"error",
")",
"{",
"c",
".",
"log",
"(",
"\"",
"\"",
",",
"owner",
",",
"repo",
")",
"\n",
"path",
":=",
"(",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"owner",
",",
"repo",
")",
")",
"\n",
"var",
"projects",
"[",
"]",
"Project",
"\n",
"err",
":=",
"c",
".",
"readPaginatedResults",
"(",
"path",
",",
"\"",
"\"",
",",
"func",
"(",
")",
"interface",
"{",
"}",
"{",
"return",
"&",
"[",
"]",
"Project",
"{",
"}",
"\n",
"}",
",",
"func",
"(",
"obj",
"<mask>",
"{",
"}",
")",
"{",
"projects",
"=",
"append",
"(",
"projects",
",",
"*",
"(",
"obj",
".",
"(",
"*",
"[",
"]",
"Project",
")",
")",
"...",
")",
"\n",
"}",
",",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"return",
"projects",
",",
"nil",
"\n",
"}"
] |
4,520 | all-4521 | [
"HasThresholdWindows",
"returns",
"a",
"boolean",
"if",
"a",
"field",
"has",
"been",
"set",
"."
] | [
"func",
"(",
"o",
"*",
"<mask>",
")",
"HasThresholdWindows",
"(",
")",
"bool",
"{",
"if",
"o",
"!=",
"nil",
"&&",
"o",
".",
"ThresholdWindows",
"!=",
"nil",
"{",
"return",
"true",
"\n",
"}",
"\n\n",
"return",
"false",
"\n",
"}"
] |
4,521 | all-4522 | [
"UnmarshalJSON",
"supports",
"json",
".",
"Unmarshaler",
"interface"
] | [
"func",
"(",
"v",
"*",
"Registration",
")",
"UnmarshalJSON",
"(",
"data",
"[",
"]",
"byte",
")",
"error",
"{",
"r",
":=",
"jlexer",
".",
"Lexer",
"{",
"Data",
":",
"data",
"}",
"\n",
"easyjsonC5a4559bDecodeGithubComChromedpCdprotoServiceworker8",
"(",
"&",
"r",
",",
"v",
")",
"\n",
"return",
"r",
".",
"<mask>",
"(",
")",
"\n",
"}"
] |
4,522 | all-4523 | [
"Run",
"executes",
"the",
"select",
"list",
".",
"Its",
"displays",
"the",
"label",
"and",
"the",
"list",
"of",
"items",
"asking",
"the",
"user",
"to",
"chose",
"any",
"value",
"within",
"to",
"list",
"or",
"add",
"his",
"own",
".",
"Run",
"will",
"keep",
"the",
"prompt",
"alive",
"until",
"it",
"has",
"been",
"canceled",
"from",
"the",
"command",
"prompt",
"or",
"it",
"has",
"received",
"a",
"valid",
"value",
".",
"If",
"the",
"addLabel",
"is",
"selected",
"in",
"the",
"list",
"this",
"function",
"will",
"return",
"a",
"-",
"1",
"index",
"with",
"the",
"added",
"label",
"and",
"no",
"error",
".",
"Otherwise",
"it",
"will",
"return",
"the",
"index",
"and",
"the",
"value",
"of",
"the",
"selected",
"item",
".",
"In",
"any",
"case",
"if",
"an",
"error",
"is",
"triggered",
"it",
"will",
"also",
"return",
"the",
"error",
"as",
"its",
"third",
"return",
"value",
"."
] | [
"func",
"(",
"sa",
"*",
"SelectWithAdd",
")",
"Run",
"(",
")",
"(",
"int",
",",
"string",
",",
"error",
")",
"{",
"if",
"len",
"(",
"sa",
".",
"Items",
")",
">",
"0",
"{",
"newItems",
":=",
"append",
"(",
"[",
"]",
"string",
"{",
"sa",
".",
"AddLabel",
"}",
",",
"sa",
".",
"Items",
"...",
")",
"\n\n",
"list",
",",
"err",
":=",
"list",
".",
"New",
"(",
"newItems",
",",
"5",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"0",
",",
"\"",
"\"",
",",
"err",
"\n",
"}",
"\n\n",
"s",
":=",
"Select",
"{",
"Label",
":",
"sa",
".",
"Label",
",",
"Items",
":",
"newItems",
",",
"IsVimMode",
":",
"sa",
".",
"IsVimMode",
",",
"HideHelp",
":",
"sa",
".",
"HideHelp",
",",
"Size",
":",
"5",
",",
"<mask>",
":",
"list",
",",
"Pointer",
":",
"sa",
".",
"Pointer",
",",
"}",
"\n",
"s",
".",
"setKeys",
"(",
")",
"\n\n",
"err",
"=",
"s",
".",
"prepareTemplates",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"0",
",",
"\"",
"\"",
",",
"err",
"\n",
"}",
"\n\n",
"selected",
",",
"value",
",",
"err",
":=",
"s",
".",
"innerRun",
"(",
"1",
",",
"0",
",",
"'+'",
")",
"\n",
"if",
"err",
"!=",
"nil",
"||",
"selected",
"!=",
"0",
"{",
"return",
"selected",
"-",
"1",
",",
"value",
",",
"err",
"\n",
"}",
"\n\n",
"// XXX run through terminal for windows",
"os",
".",
"Stdout",
".",
"Write",
"(",
"[",
"]",
"byte",
"(",
"upLine",
"(",
"1",
")",
"+",
"\"",
"\\r",
"\"",
"+",
"clearLine",
")",
")",
"\n",
"}",
"\n\n",
"p",
":=",
"Prompt",
"{",
"Label",
":",
"sa",
".",
"AddLabel",
",",
"Validate",
":",
"sa",
".",
"Validate",
",",
"IsVimMode",
":",
"sa",
".",
"IsVimMode",
",",
"Pointer",
":",
"sa",
".",
"Pointer",
",",
"}",
"\n",
"value",
",",
"err",
":=",
"p",
".",
"Run",
"(",
")",
"\n",
"return",
"SelectedAdd",
",",
"value",
",",
"err",
"\n",
"}"
] |
4,523 | all-4524 | [
"Register",
"a",
"new",
"subchannel",
"for",
"the",
"given",
"serviceName"
] | [
"func",
"(",
"subChMap",
"*",
"subChannelMap",
")",
"registerNewSubChannel",
"(",
"serviceName",
"string",
",",
"ch",
"*",
"Channel",
")",
"(",
"_",
"*",
"SubChannel",
",",
"added",
"bool",
")",
"{",
"subChMap",
".",
"Lock",
"(",
")",
"\n",
"defer",
"subChMap",
".",
"Unlock",
"(",
")",
"\n\n",
"if",
"subChMap",
".",
"subchannels",
"==",
"nil",
"{",
"subChMap",
".",
"subchannels",
"=",
"make",
"(",
"map",
"[",
"string",
"]",
"*",
"SubChannel",
")",
"\n",
"}",
"\n\n",
"if",
"sc",
",",
"<mask>",
":=",
"subChMap",
".",
"subchannels",
"[",
"serviceName",
"]",
";",
"ok",
"{",
"return",
"sc",
",",
"false",
"\n",
"}",
"\n\n",
"sc",
":=",
"newSubChannel",
"(",
"serviceName",
",",
"ch",
")",
"\n",
"subChMap",
".",
"subchannels",
"[",
"serviceName",
"]",
"=",
"sc",
"\n",
"return",
"sc",
",",
"true",
"\n",
"}"
] |
4,524 | all-4525 | [
"WithFromStep",
"the",
"first",
"step",
"to",
"replay",
"from",
"(",
"replay",
"from",
"the",
"very",
"start",
"if",
"not",
"specified",
")",
"."
] | [
"func",
"(",
"p",
"ReplaySnapshotParams",
")",
"WithFromStep",
"(",
"fromStep",
"int64",
")",
"*",
"ReplaySnapshotParams",
"{",
"p",
".",
"FromStep",
"=",
"fromStep",
"\n",
"<mask>",
"&",
"p",
"\n",
"}"
] |
4,525 | all-4526 | [
"GetIdmapSet",
"reads",
"the",
"uid",
"/",
"gid",
"allocation",
"."
] | [
"func",
"GetIdmapSet",
"(",
")",
"*",
"idmap",
".",
"IdmapSet",
"{",
"idmapSet",
",",
"err",
":=",
"idmap",
".",
"DefaultIdmapSet",
"(",
"\"",
"\"",
",",
"\"",
"\"",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"logger",
".",
"Warn",
"(",
"\"",
"\"",
",",
"log",
".",
"Ctx",
"{",
"\"",
"\"",
":",
"err",
".",
"Error",
"(",
")",
"}",
")",
"\n",
"logger",
".",
"Warnf",
"(",
"\"",
"\"",
")",
"\n",
"idmapSet",
"=",
"nil",
"\n",
"}",
"else",
"{",
"kernelIdmapSet",
",",
"err",
":=",
"idmap",
".",
"CurrentIdmapSet",
"(",
")",
"\n",
"if",
"err",
"==",
"nil",
"{",
"logger",
".",
"Infof",
"(",
"\"",
"\"",
")",
"\n",
"for",
"_",
",",
"lxcmap",
":=",
"<mask>",
"kernelIdmapSet",
".",
"ToLxcString",
"(",
")",
"{",
"logger",
".",
"Infof",
"(",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"lxcmap",
")",
")",
"\n",
"}",
"\n",
"}",
"\n\n",
"if",
"len",
"(",
"idmapSet",
".",
"Idmap",
")",
"==",
"0",
"{",
"logger",
".",
"Warnf",
"(",
"\"",
"\"",
")",
"\n",
"logger",
".",
"Warnf",
"(",
"\"",
"\"",
")",
"\n",
"idmapSet",
"=",
"nil",
"\n",
"}",
"else",
"{",
"logger",
".",
"Infof",
"(",
"\"",
"\"",
")",
"\n",
"for",
"_",
",",
"lxcmap",
":=",
"range",
"idmapSet",
".",
"Idmap",
"{",
"suffix",
":=",
"\"",
"\"",
"\n\n",
"if",
"lxcmap",
".",
"Usable",
"(",
")",
"!=",
"nil",
"{",
"suffix",
"=",
"\"",
"\"",
"\n",
"}",
"\n\n",
"for",
"_",
",",
"lxcEntry",
":=",
"range",
"lxcmap",
".",
"ToLxcString",
"(",
")",
"{",
"logger",
".",
"Infof",
"(",
"\"",
"\"",
",",
"lxcEntry",
",",
"suffix",
")",
"\n",
"}",
"\n",
"}",
"\n\n",
"err",
"=",
"idmapSet",
".",
"Usable",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"logger",
".",
"Warnf",
"(",
"\"",
"\"",
")",
"\n",
"logger",
".",
"Warnf",
"(",
"\"",
"\"",
")",
"\n",
"idmapSet",
"=",
"nil",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"idmapSet",
"\n",
"}"
] |
4,526 | all-4527 | [
"EnableSvcCheck",
"creates",
"a",
"new",
"ENABLE_SVC_CHECK",
"Nagios",
"command",
".",
"Enables",
"active",
"checks",
"for",
"a",
"particular",
"service",
"."
] | [
"func",
"EnableSvcCheck",
"(",
"host_name",
"string",
",",
"service_description",
"<mask>",
",",
")",
"*",
"livestatus",
".",
"Command",
"{",
"return",
"livestatus",
".",
"NewCommand",
"(",
"\"",
"\"",
",",
"stringifyArg",
"(",
"\"",
"\"",
",",
"\"",
"\"",
",",
"host_name",
")",
",",
"stringifyArg",
"(",
"\"",
"\"",
",",
"\"",
"\"",
",",
"service_description",
")",
",",
")",
"\n",
"}"
] |
4,527 | all-4528 | [
"HasMetric",
"returns",
"a",
"boolean",
"if",
"a",
"field",
"has",
"been",
"set",
"."
] | [
"func",
"(",
"m",
"*",
"Metric",
")",
"HasMetric",
"(",
")",
"bool",
"{",
"if",
"m",
"!=",
"nil",
"&&",
"m",
".",
"Metric",
"!=",
"nil",
"{",
"return",
"true",
"\n",
"}",
"\n\n",
"return",
"<mask>",
"\n",
"}"
] |
4,528 | all-4529 | [
"MarkComplete",
"figures",
"out",
"which",
"ARNs",
"were",
"in",
"previous",
"passes",
"but",
"not",
"this",
"one",
"and",
"eliminates",
"them",
".",
"It",
"should",
"only",
"be",
"run",
"after",
"all",
"resources",
"have",
"been",
"marked",
"."
] | [
"func",
"(",
"s",
"*",
"<mask>",
")",
"MarkComplete",
"(",
")",
"int",
"{",
"var",
"gone",
"[",
"]",
"string",
"\n",
"for",
"key",
":=",
"range",
"s",
".",
"firstSeen",
"{",
"if",
"!",
"s",
".",
"marked",
"[",
"key",
"]",
"{",
"gone",
"=",
"append",
"(",
"gone",
",",
"key",
")",
"\n",
"}",
"\n",
"}",
"\n\n",
"for",
"_",
",",
"key",
":=",
"range",
"gone",
"{",
"klog",
".",
"V",
"(",
"1",
")",
".",
"Infof",
"(",
"\"",
"\"",
",",
"key",
")",
"\n",
"delete",
"(",
"s",
".",
"firstSeen",
",",
"key",
")",
"\n",
"}",
"\n\n",
"if",
"len",
"(",
"s",
".",
"swept",
")",
">",
"0",
"{",
"klog",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"len",
"(",
"s",
".",
"swept",
")",
",",
"s",
".",
"swept",
")",
"\n",
"}",
"\n\n",
"return",
"len",
"(",
"s",
".",
"swept",
")",
"\n",
"}"
] |
4,529 | all-4530 | [
"Exec",
"runs",
"the",
"system",
"command",
".",
"If",
"multiple",
"arguments",
"are",
"given",
"they",
"re",
"concatenated",
"to",
"one",
"command",
".",
"Example",
":",
"t",
".",
"Exec",
"(",
"ls",
"-",
"ltr",
")",
"t",
".",
"Exec",
"(",
"ls",
"FILE1",
"FILE2",
")"
] | [
"func",
"(",
"t",
"*",
"T",
")",
"Exec",
"(",
"cmd",
"...",
"string",
")",
"(",
"err",
"error",
")",
"{",
"toRun",
":=",
"strings",
".",
"Join",
"(",
"cmd",
",",
"\"",
"\"",
")",
"\n",
"<mask>",
",",
"err",
":=",
"shellquote",
".",
"Split",
"(",
"toRun",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"\n",
"}",
"\n",
"err",
"=",
"execCmd",
"(",
"input",
")",
"\n\n",
"return",
"\n",
"}"
] |
4,530 | all-4531 | [
"UnmarshalJSON",
"supports",
"json",
".",
"Unmarshaler",
"interface"
] | [
"func",
"(",
"v",
"*",
"GetAttributesReturns",
")",
"UnmarshalJSON",
"(",
"data",
"[",
"]",
"byte",
")",
"error",
"{",
"r",
":=",
"jlexer",
".",
"Lexer",
"{",
"Data",
":",
"data",
"}",
"\n",
"easyjsonC5a4559bDecodeGithubComChromedpCdprotoDom52",
"(",
"&",
"r",
",",
"v",
")",
"\n",
"return",
"r",
".",
"<mask>",
"(",
")",
"\n",
"}"
] |
4,531 | all-4532 | [
"PrintDefaults",
"prints",
"to",
"standard",
"error",
"unless",
"configured",
"otherwise",
"the",
"default",
"values",
"of",
"all",
"defined",
"flags",
"in",
"the",
"set",
".",
"If",
"there",
"is",
"more",
"than",
"one",
"name",
"for",
"a",
"given",
"flag",
"the",
"usage",
"information",
"and",
"default",
"value",
"from",
"the",
"shortest",
"will",
"be",
"printed",
"(",
"or",
"the",
"least",
"alphabetically",
"if",
"there",
"are",
"several",
"equally",
"short",
"flag",
"names",
")",
"."
] | [
"func",
"(",
"f",
"*",
"FlagSet",
")",
"PrintDefaults",
"(",
")",
"{",
"// group together all flags for a given value",
"flags",
":=",
"make",
"(",
"map",
"[",
"interface",
"{",
"}",
"]",
"flagsByLength",
")",
"\n",
"f",
".",
"VisitAll",
"(",
"func",
"(",
"f",
"*",
"Flag",
")",
"{",
"flags",
"[",
"f",
".",
"Value",
"]",
"=",
"append",
"(",
"flags",
"[",
"f",
".",
"Value",
"]",
",",
"f",
")",
"\n",
"}",
")",
"\n\n",
"// sort the output flags by shortest name for each group.",
"var",
"byName",
"flagsByName",
"\n",
"for",
"_",
",",
"f",
":=",
"range",
"flags",
"{",
"sort",
".",
"Sort",
"(",
"f",
")",
"\n",
"byName",
"=",
"append",
"(",
"byName",
",",
"f",
")",
"\n",
"}",
"\n",
"sort",
".",
"Sort",
"(",
"byName",
")",
"\n\n",
"var",
"line",
"bytes",
".",
"Buffer",
"\n",
"for",
"_",
",",
"fs",
":=",
"range",
"byName",
"{",
"line",
".",
"Reset",
"(",
")",
"\n",
"for",
"i",
",",
"f",
":=",
"range",
"fs",
"{",
"if",
"i",
">",
"0",
"{",
"line",
".",
"WriteString",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"line",
".",
"WriteString",
"(",
"flagWithMinus",
"(",
"f",
".",
"Name",
")",
")",
"\n",
"}",
"\n",
"format",
":=",
"\"",
"\\n",
"\\n",
"\"",
"\n",
"if",
"_",
",",
"ok",
":=",
"fs",
"[",
"0",
"]",
".",
"Value",
".",
"(",
"*",
"stringValue",
")",
";",
"ok",
"{",
"// put quotes on the value",
"format",
"=",
"\"",
"\\n",
"\\n",
"\"",
"\n",
"}",
"\n",
"fmt",
".",
"Fprintf",
"(",
"f",
".",
"out",
"(",
")",
",",
"<mask>",
",",
"line",
".",
"Bytes",
"(",
")",
",",
"fs",
"[",
"0",
"]",
".",
"DefValue",
",",
"fs",
"[",
"0",
"]",
".",
"Usage",
")",
"\n",
"}",
"\n",
"}"
] |
4,532 | all-4533 | [
"title",
":",
"rebuild",
"routes",
"path",
":",
"/",
"apps",
"/",
"{",
"app",
"}",
"/",
"routes",
"method",
":",
"POST",
"produce",
":",
"application",
"/",
"json",
"responses",
":",
"200",
":",
"Ok",
"401",
":",
"Unauthorized",
"404",
":",
"App",
"not",
"found"
] | [
"func",
"appRebuildRoutes",
"(",
"w",
"http",
".",
"ResponseWriter",
",",
"r",
"*",
"http",
".",
"<mask>",
",",
"t",
"auth",
".",
"Token",
")",
"(",
"err",
"error",
")",
"{",
"a",
",",
"err",
":=",
"getAppFromContext",
"(",
"r",
".",
"URL",
".",
"Query",
"(",
")",
".",
"Get",
"(",
"\"",
"\"",
")",
",",
"r",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"allowed",
":=",
"permission",
".",
"Check",
"(",
"t",
",",
"permission",
".",
"PermAppAdminRoutes",
",",
"contextsForApp",
"(",
"&",
"a",
")",
"...",
",",
")",
"\n",
"if",
"!",
"allowed",
"{",
"return",
"permission",
".",
"ErrUnauthorized",
"\n",
"}",
"\n",
"dry",
",",
"_",
":=",
"strconv",
".",
"ParseBool",
"(",
"InputValue",
"(",
"r",
",",
"\"",
"\"",
")",
")",
"\n",
"evt",
",",
"err",
":=",
"event",
".",
"New",
"(",
"&",
"event",
".",
"Opts",
"{",
"Target",
":",
"appTarget",
"(",
"a",
".",
"Name",
")",
",",
"Kind",
":",
"permission",
".",
"PermAppAdminRoutes",
",",
"Owner",
":",
"t",
",",
"CustomData",
":",
"event",
".",
"FormToCustomData",
"(",
"InputFields",
"(",
"r",
")",
")",
",",
"Allowed",
":",
"event",
".",
"Allowed",
"(",
"permission",
".",
"PermAppReadEvents",
",",
"contextsForApp",
"(",
"&",
"a",
")",
"...",
")",
",",
"}",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"result",
":=",
"map",
"[",
"string",
"]",
"rebuild",
".",
"RebuildRoutesResult",
"{",
"}",
"\n",
"defer",
"func",
"(",
")",
"{",
"evt",
".",
"DoneCustomData",
"(",
"err",
",",
"result",
")",
"}",
"(",
")",
"\n",
"w",
".",
"Header",
"(",
")",
".",
"Set",
"(",
"\"",
"\"",
",",
"\"",
"\"",
")",
"\n",
"result",
",",
"err",
"=",
"rebuild",
".",
"RebuildRoutes",
"(",
"&",
"a",
",",
"dry",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"return",
"json",
".",
"NewEncoder",
"(",
"w",
")",
".",
"Encode",
"(",
"&",
"result",
")",
"\n",
"}"
] |
4,533 | all-4534 | [
"newBatchPoints",
"creates",
"new",
"influxdb",
".",
"BatchPoints",
"with",
"specified",
"bpConf",
".",
"Panics",
"on",
"errors",
"."
] | [
"func",
"newBatchPoints",
"(",
"bpConf",
"influxdb",
".",
"BatchPointsConfig",
")",
"influxdb",
".",
"BatchPoints",
"{",
"bp",
",",
"err",
":=",
"influxdb",
".",
"NewBatchPoints",
"(",
"bpConf",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"// Can only happen if there's an error in the code",
"panic",
"(",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"err",
")",
")",
"\n",
"}",
"\n",
"<mask>",
"bp",
"\n",
"}"
] |
4,534 | all-4535 | [
"CredentialsFromEnvVars",
"creates",
"and",
"returns",
"Taskcluster",
"credentials",
"initialised",
"from",
"the",
"values",
"of",
"environment",
"variables",
":",
"TASKCLUSTER_CLIENT_ID",
"TASKCLUSTER_ACCESS_TOKEN",
"TASKCLUSTER_CERTIFICATE",
"No",
"validation",
"is",
"performed",
"on",
"the",
"assigned",
"values",
"and",
"unset",
"environment",
"variables",
"will",
"result",
"in",
"empty",
"string",
"values",
"."
] | [
"func",
"CredentialsFromEnvVars",
"(",
")",
"*",
"Credentials",
"{",
"return",
"&",
"Credentials",
"{",
"ClientID",
":",
"<mask>",
".",
"Getenv",
"(",
"\"",
"\"",
")",
",",
"AccessToken",
":",
"os",
".",
"Getenv",
"(",
"\"",
"\"",
")",
",",
"Certificate",
":",
"os",
".",
"Getenv",
"(",
"\"",
"\"",
")",
",",
"}",
"\n",
"}"
] |
4,535 | all-4536 | [
"NewDBHashTree",
"creates",
"a",
"database",
"(",
"bolt",
")",
"backed",
"hashtree",
"."
] | [
"func",
"NewDBHashTree",
"(",
"storageRoot",
"string",
")",
"(",
"HashTree",
",",
"error",
")",
"{",
"file",
":=",
"dbFile",
"(",
"storageRoot",
")",
"\n",
"if",
"err",
":=",
"os",
".",
"MkdirAll",
"(",
"pathlib",
".",
"Dir",
"(",
"file",
")",
",",
"0777",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"<mask>",
",",
"err",
":=",
"newDBHashTree",
"(",
"file",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"if",
"err",
":=",
"result",
".",
"PutDir",
"(",
"\"",
"\"",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"return",
"result",
",",
"err",
"\n",
"}"
] |
4,536 | all-4537 | [
"GetActiveID",
"is",
"a",
"wrapper",
"around",
"gtk_combo_box_get_active_id",
"()",
"."
] | [
"func",
"(",
"v",
"*",
"ComboBox",
")",
"GetActiveID",
"(",
")",
"string",
"{",
"c",
":=",
"C",
".",
"gtk_combo_box_get_active_id",
"(",
"v",
".",
"native",
"(",
")",
")",
"\n",
"return",
"C",
".",
"GoString",
"(",
"(",
"*",
"C",
".",
"<mask>",
")",
"(",
"c",
")",
")",
"\n",
"}"
] |
4,537 | all-4538 | [
"ForEachRootPtr",
"behaves",
"like",
"ForEachPtr",
"but",
"it",
"starts",
"with",
"a",
"Root",
"instead",
"of",
"an",
"Object",
"."
] | [
"func",
"(",
"p",
"*",
"Process",
")",
"ForEachRootPtr",
"(",
"r",
"*",
"Root",
",",
"fn",
"func",
"(",
"int64",
",",
"Object",
",",
"int64",
")",
"bool",
")",
"{",
"edges1",
"(",
"p",
",",
"r",
",",
"0",
",",
"r",
".",
"<mask>",
",",
"fn",
")",
"\n",
"}"
] |
4,538 | all-4539 | [
"SetProgramName",
"is",
"a",
"wrapper",
"around",
"gtk_about_dialog_set_program_name",
"()",
"."
] | [
"func",
"(",
"v",
"*",
"AboutDialog",
")",
"SetProgramName",
"(",
"name",
"string",
")",
"{",
"cstr",
":=",
"C",
".",
"CString",
"(",
"name",
")",
"\n",
"defer",
"C",
".",
"<mask>",
"(",
"unsafe",
".",
"Pointer",
"(",
"cstr",
")",
")",
"\n",
"C",
".",
"gtk_about_dialog_set_program_name",
"(",
"v",
".",
"native",
"(",
")",
",",
"(",
"*",
"C",
".",
"gchar",
")",
"(",
"cstr",
")",
")",
"\n",
"}"
] |
4,539 | all-4540 | [
"Cmds",
"returns",
"a",
"slice",
"containing",
"pps",
"commands",
"."
] | [
"func",
"Cmds",
"(",
"noMetrics",
"*",
"bool",
",",
"noPortForwarding",
"*",
"bool",
")",
"[",
"]",
"*",
"cobra",
".",
"Command",
"{",
"var",
"commands",
"[",
"]",
"*",
"cobra",
".",
"Command",
"\n\n",
"raw",
":=",
"false",
"\n",
"rawFlags",
":=",
"pflag",
".",
"NewFlagSet",
"(",
"\"",
"\"",
",",
"pflag",
".",
"ContinueOnError",
")",
"\n",
"rawFlags",
".",
"BoolVar",
"(",
"&",
"raw",
",",
"\"",
"\"",
",",
"false",
",",
"\"",
"\"",
")",
"\n\n",
"fullTimestamps",
":=",
"false",
"\n",
"fullTimestampsFlags",
":=",
"pflag",
".",
"NewFlagSet",
"(",
"\"",
"\"",
",",
"pflag",
".",
"ContinueOnError",
")",
"\n",
"fullTimestampsFlags",
".",
"BoolVar",
"(",
"&",
"fullTimestamps",
",",
"\"",
"\"",
",",
"false",
",",
"\"",
"\"",
")",
"\n\n",
"marshaller",
":=",
"&",
"jsonpb",
".",
"Marshaler",
"{",
"Indent",
":",
"\"",
"\"",
",",
"OrigName",
":",
"true",
",",
"}",
"\n\n",
"jobDocs",
":=",
"&",
"cobra",
".",
"Command",
"{",
"Short",
":",
"\"",
"\"",
",",
"Long",
":",
"`Jobs are the basic units of computation in Pachyderm.\n\nJobs run a containerized workload over a set of finished input commits. Jobs are\ncreated by pipelines and will write output to a commit in the pipeline's output\nrepo. A job can have multiple datums, each processed independently and the\nresults will be merged together at the end.\n\nIf the job fails, the output commit will not be populated with data.`",
",",
"}",
"\n",
"cmdutil",
".",
"SetDocsUsage",
"(",
"jobDocs",
")",
"\n",
"commands",
"=",
"append",
"(",
"commands",
",",
"cmdutil",
".",
"CreateAlias",
"(",
"jobDocs",
",",
"\"",
"\"",
")",
")",
"\n\n",
"var",
"block",
"bool",
"\n",
"inspectJob",
":=",
"&",
"cobra",
".",
"Command",
"{",
"Use",
":",
"\"",
"\"",
",",
"Short",
":",
"\"",
"\"",
",",
"Long",
":",
"\"",
"\"",
",",
"Run",
":",
"cmdutil",
".",
"RunFixedArgs",
"(",
"1",
",",
"func",
"(",
"args",
"[",
"]",
"string",
")",
"error",
"{",
"client",
",",
"err",
":=",
"pachdclient",
".",
"NewOnUserMachine",
"(",
"!",
"*",
"noMetrics",
",",
"!",
"*",
"noPortForwarding",
",",
"\"",
"\"",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"defer",
"client",
".",
"Close",
"(",
")",
"\n",
"jobInfo",
",",
"err",
":=",
"<mask>",
".",
"InspectJob",
"(",
"args",
"[",
"0",
"]",
",",
"block",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"cmdutil",
".",
"ErrorAndExit",
"(",
"\"",
"\"",
",",
"err",
".",
"Error",
"(",
")",
")",
"\n",
"}",
"\n",
"if",
"jobInfo",
"==",
"nil",
"{",
"cmdutil",
".",
"ErrorAndExit",
"(",
"\"",
"\"",
",",
"args",
"[",
"0",
"]",
")",
"\n",
"}",
"\n",
"if",
"raw",
"{",
"return",
"marshaller",
".",
"Marshal",
"(",
"os",
".",
"Stdout",
",",
"jobInfo",
")",
"\n",
"}",
"\n",
"ji",
":=",
"&",
"pretty",
".",
"PrintableJobInfo",
"{",
"JobInfo",
":",
"jobInfo",
",",
"FullTimestamps",
":",
"fullTimestamps",
",",
"}",
"\n",
"return",
"pretty",
".",
"PrintDetailedJobInfo",
"(",
"ji",
")",
"\n",
"}",
")",
",",
"}",
"\n",
"inspectJob",
".",
"Flags",
"(",
")",
".",
"BoolVarP",
"(",
"&",
"block",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"false",
",",
"\"",
"\"",
")",
"\n",
"inspectJob",
".",
"Flags",
"(",
")",
".",
"AddFlagSet",
"(",
"rawFlags",
")",
"\n",
"inspectJob",
".",
"Flags",
"(",
")",
".",
"AddFlagSet",
"(",
"fullTimestampsFlags",
")",
"\n",
"commands",
"=",
"append",
"(",
"commands",
",",
"cmdutil",
".",
"CreateAlias",
"(",
"inspectJob",
",",
"\"",
"\"",
")",
")",
"\n\n",
"var",
"pipelineName",
"string",
"\n",
"var",
"outputCommitStr",
"string",
"\n",
"var",
"inputCommitStrs",
"[",
"]",
"string",
"\n",
"listJob",
":=",
"&",
"cobra",
".",
"Command",
"{",
"Short",
":",
"\"",
"\"",
",",
"Long",
":",
"\"",
"\"",
",",
"Example",
":",
"`\n# Return all jobs\n$ {{alias}}\n\n# Return all jobs in pipeline foo\n$ {{alias}} -p foo\n\n# Return all jobs whose input commits include foo@XXX and bar@YYY\n$ {{alias}} -i foo@XXX -i bar@YYY\n\n# Return all jobs in pipeline foo and whose input commits include bar@YYY\n$ {{alias}} -p foo -i bar@YYY`",
",",
"Run",
":",
"cmdutil",
".",
"RunFixedArgs",
"(",
"0",
",",
"func",
"(",
"args",
"[",
"]",
"string",
")",
"error",
"{",
"commits",
",",
"err",
":=",
"cmdutil",
".",
"ParseCommits",
"(",
"inputCommitStrs",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"var",
"outputCommit",
"*",
"pfs",
".",
"Commit",
"\n",
"if",
"outputCommitStr",
"!=",
"\"",
"\"",
"{",
"outputCommit",
",",
"err",
"=",
"cmdutil",
".",
"ParseCommit",
"(",
"outputCommitStr",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"}",
"\n\n",
"client",
",",
"err",
":=",
"pachdclient",
".",
"NewOnUserMachine",
"(",
"!",
"*",
"noMetrics",
",",
"!",
"*",
"noPortForwarding",
",",
"\"",
"\"",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"defer",
"client",
".",
"Close",
"(",
")",
"\n\n",
"if",
"raw",
"{",
"return",
"client",
".",
"ListJobF",
"(",
"pipelineName",
",",
"commits",
",",
"outputCommit",
",",
"func",
"(",
"ji",
"*",
"ppsclient",
".",
"JobInfo",
")",
"error",
"{",
"if",
"err",
":=",
"marshaller",
".",
"Marshal",
"(",
"os",
".",
"Stdout",
",",
"ji",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}",
")",
"\n",
"}",
"\n",
"writer",
":=",
"tabwriter",
".",
"NewWriter",
"(",
"os",
".",
"Stdout",
",",
"pretty",
".",
"JobHeader",
")",
"\n",
"if",
"err",
":=",
"client",
".",
"ListJobF",
"(",
"pipelineName",
",",
"commits",
",",
"outputCommit",
",",
"func",
"(",
"ji",
"*",
"ppsclient",
".",
"JobInfo",
")",
"error",
"{",
"pretty",
".",
"PrintJobInfo",
"(",
"writer",
",",
"ji",
",",
"fullTimestamps",
")",
"\n",
"return",
"nil",
"\n",
"}",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"return",
"writer",
".",
"Flush",
"(",
")",
"\n",
"}",
")",
",",
"}",
"\n",
"listJob",
".",
"Flags",
"(",
")",
".",
"StringVarP",
"(",
"&",
"pipelineName",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
")",
"\n",
"listJob",
".",
"MarkFlagCustom",
"(",
"\"",
"\"",
",",
"\"",
"\"",
")",
"\n",
"listJob",
".",
"Flags",
"(",
")",
".",
"StringVarP",
"(",
"&",
"outputCommitStr",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
")",
"\n",
"listJob",
".",
"MarkFlagCustom",
"(",
"\"",
"\"",
",",
"\"",
"\"",
")",
"\n",
"listJob",
".",
"Flags",
"(",
")",
".",
"StringSliceVarP",
"(",
"&",
"inputCommitStrs",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"[",
"]",
"string",
"{",
"}",
",",
"\"",
"\"",
")",
"\n",
"listJob",
".",
"MarkFlagCustom",
"(",
"\"",
"\"",
",",
"\"",
"\"",
")",
"\n",
"listJob",
".",
"Flags",
"(",
")",
".",
"AddFlagSet",
"(",
"rawFlags",
")",
"\n",
"listJob",
".",
"Flags",
"(",
")",
".",
"AddFlagSet",
"(",
"fullTimestampsFlags",
")",
"\n",
"commands",
"=",
"append",
"(",
"commands",
",",
"cmdutil",
".",
"CreateAlias",
"(",
"listJob",
",",
"\"",
"\"",
")",
")",
"\n\n",
"var",
"pipelines",
"cmdutil",
".",
"RepeatedStringArg",
"\n",
"flushJob",
":=",
"&",
"cobra",
".",
"Command",
"{",
"Use",
":",
"\"",
"\"",
",",
"Short",
":",
"\"",
"\"",
",",
"Long",
":",
"\"",
"\"",
",",
"Example",
":",
"`\n# Return jobs caused by foo@XXX and bar@YYY.\n$ {{alias}} foo@XXX bar@YYY\n\n# Return jobs caused by foo@XXX leading to pipelines bar and baz.\n$ {{alias}} foo@XXX -p bar -p baz`",
",",
"Run",
":",
"cmdutil",
".",
"Run",
"(",
"func",
"(",
"args",
"[",
"]",
"string",
")",
"error",
"{",
"commits",
",",
"err",
":=",
"cmdutil",
".",
"ParseCommits",
"(",
"args",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"c",
",",
"err",
":=",
"pachdclient",
".",
"NewOnUserMachine",
"(",
"!",
"*",
"noMetrics",
",",
"!",
"*",
"noPortForwarding",
",",
"\"",
"\"",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"defer",
"c",
".",
"Close",
"(",
")",
"\n\n",
"jobInfos",
",",
"err",
":=",
"c",
".",
"FlushJobAll",
"(",
"commits",
",",
"pipelines",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"if",
"raw",
"{",
"for",
"_",
",",
"jobInfo",
":=",
"range",
"jobInfos",
"{",
"if",
"err",
":=",
"marshaller",
".",
"Marshal",
"(",
"os",
".",
"Stdout",
",",
"jobInfo",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}",
"\n",
"writer",
":=",
"tabwriter",
".",
"NewWriter",
"(",
"os",
".",
"Stdout",
",",
"pretty",
".",
"JobHeader",
")",
"\n",
"for",
"_",
",",
"jobInfo",
":=",
"range",
"jobInfos",
"{",
"pretty",
".",
"PrintJobInfo",
"(",
"writer",
",",
"jobInfo",
",",
"fullTimestamps",
")",
"\n",
"}",
"\n\n",
"return",
"writer",
".",
"Flush",
"(",
")",
"\n",
"}",
")",
",",
"}",
"\n",
"flushJob",
".",
"Flags",
"(",
")",
".",
"VarP",
"(",
"&",
"pipelines",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
")",
"\n",
"flushJob",
".",
"MarkFlagCustom",
"(",
"\"",
"\"",
",",
"\"",
"\"",
")",
"\n",
"flushJob",
".",
"Flags",
"(",
")",
".",
"AddFlagSet",
"(",
"rawFlags",
")",
"\n",
"flushJob",
".",
"Flags",
"(",
")",
".",
"AddFlagSet",
"(",
"fullTimestampsFlags",
")",
"\n",
"commands",
"=",
"append",
"(",
"commands",
",",
"cmdutil",
".",
"CreateAlias",
"(",
"flushJob",
",",
"\"",
"\"",
")",
")",
"\n\n",
"deleteJob",
":=",
"&",
"cobra",
".",
"Command",
"{",
"Use",
":",
"\"",
"\"",
",",
"Short",
":",
"\"",
"\"",
",",
"Long",
":",
"\"",
"\"",
",",
"Run",
":",
"cmdutil",
".",
"RunFixedArgs",
"(",
"1",
",",
"func",
"(",
"args",
"[",
"]",
"string",
")",
"error",
"{",
"client",
",",
"err",
":=",
"pachdclient",
".",
"NewOnUserMachine",
"(",
"!",
"*",
"noMetrics",
",",
"!",
"*",
"noPortForwarding",
",",
"\"",
"\"",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"defer",
"client",
".",
"Close",
"(",
")",
"\n",
"if",
"err",
":=",
"client",
".",
"DeleteJob",
"(",
"args",
"[",
"0",
"]",
")",
";",
"err",
"!=",
"nil",
"{",
"cmdutil",
".",
"ErrorAndExit",
"(",
"\"",
"\"",
",",
"err",
".",
"Error",
"(",
")",
")",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}",
")",
",",
"}",
"\n",
"commands",
"=",
"append",
"(",
"commands",
",",
"cmdutil",
".",
"CreateAlias",
"(",
"deleteJob",
",",
"\"",
"\"",
")",
")",
"\n\n",
"stopJob",
":=",
"&",
"cobra",
".",
"Command",
"{",
"Use",
":",
"\"",
"\"",
",",
"Short",
":",
"\"",
"\"",
",",
"Long",
":",
"\"",
"\"",
",",
"Run",
":",
"cmdutil",
".",
"RunFixedArgs",
"(",
"1",
",",
"func",
"(",
"args",
"[",
"]",
"string",
")",
"error",
"{",
"client",
",",
"err",
":=",
"pachdclient",
".",
"NewOnUserMachine",
"(",
"!",
"*",
"noMetrics",
",",
"!",
"*",
"noPortForwarding",
",",
"\"",
"\"",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"defer",
"client",
".",
"Close",
"(",
")",
"\n",
"if",
"err",
":=",
"client",
".",
"StopJob",
"(",
"args",
"[",
"0",
"]",
")",
";",
"err",
"!=",
"nil",
"{",
"cmdutil",
".",
"ErrorAndExit",
"(",
"\"",
"\"",
",",
"err",
".",
"Error",
"(",
")",
")",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}",
")",
",",
"}",
"\n",
"commands",
"=",
"append",
"(",
"commands",
",",
"cmdutil",
".",
"CreateAlias",
"(",
"stopJob",
",",
"\"",
"\"",
")",
")",
"\n\n",
"datumDocs",
":=",
"&",
"cobra",
".",
"Command",
"{",
"Short",
":",
"\"",
"\"",
",",
"Long",
":",
"`Datums are the small independent units of processing for Pachyderm jobs.\n\nA datum is defined by applying a glob pattern (in the pipeline spec) to the file\npaths in the input repo. A datum can include one or more files or directories.\n\nDatums within a job will be processed independently, sometimes distributed\nacross separate workers. A separate execution of user code will be run for\neach datum.`",
",",
"}",
"\n",
"cmdutil",
".",
"SetDocsUsage",
"(",
"datumDocs",
")",
"\n",
"commands",
"=",
"append",
"(",
"commands",
",",
"cmdutil",
".",
"CreateAlias",
"(",
"datumDocs",
",",
"\"",
"\"",
")",
")",
"\n\n",
"restartDatum",
":=",
"&",
"cobra",
".",
"Command",
"{",
"Use",
":",
"\"",
"\"",
",",
"Short",
":",
"\"",
"\"",
",",
"Long",
":",
"\"",
"\"",
",",
"Run",
":",
"cmdutil",
".",
"RunFixedArgs",
"(",
"2",
",",
"func",
"(",
"args",
"[",
"]",
"string",
")",
"error",
"{",
"client",
",",
"err",
":=",
"pachdclient",
".",
"NewOnUserMachine",
"(",
"!",
"*",
"noMetrics",
",",
"!",
"*",
"noPortForwarding",
",",
"\"",
"\"",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"defer",
"client",
".",
"Close",
"(",
")",
"\n",
"datumFilter",
":=",
"strings",
".",
"Split",
"(",
"args",
"[",
"1",
"]",
",",
"\"",
"\"",
")",
"\n",
"for",
"i",
":=",
"0",
";",
"i",
"<",
"len",
"(",
"datumFilter",
")",
";",
"{",
"if",
"len",
"(",
"datumFilter",
"[",
"i",
"]",
")",
"==",
"0",
"{",
"if",
"i",
"+",
"1",
"<",
"len",
"(",
"datumFilter",
")",
"{",
"copy",
"(",
"datumFilter",
"[",
"i",
":",
"]",
",",
"datumFilter",
"[",
"i",
"+",
"1",
":",
"]",
")",
"\n",
"}",
"\n",
"datumFilter",
"=",
"datumFilter",
"[",
":",
"len",
"(",
"datumFilter",
")",
"-",
"1",
"]",
"\n",
"}",
"else",
"{",
"i",
"++",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"client",
".",
"RestartDatum",
"(",
"args",
"[",
"0",
"]",
",",
"datumFilter",
")",
"\n",
"}",
")",
",",
"}",
"\n",
"commands",
"=",
"append",
"(",
"commands",
",",
"cmdutil",
".",
"CreateAlias",
"(",
"restartDatum",
",",
"\"",
"\"",
")",
")",
"\n\n",
"var",
"pageSize",
"int64",
"\n",
"var",
"page",
"int64",
"\n",
"listDatum",
":=",
"&",
"cobra",
".",
"Command",
"{",
"Use",
":",
"\"",
"\"",
",",
"Short",
":",
"\"",
"\"",
",",
"Long",
":",
"\"",
"\"",
",",
"Run",
":",
"cmdutil",
".",
"RunFixedArgs",
"(",
"1",
",",
"func",
"(",
"args",
"[",
"]",
"string",
")",
"error",
"{",
"client",
",",
"err",
":=",
"pachdclient",
".",
"NewOnUserMachine",
"(",
"!",
"*",
"noMetrics",
",",
"!",
"*",
"noPortForwarding",
",",
"\"",
"\"",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"defer",
"client",
".",
"Close",
"(",
")",
"\n",
"if",
"pageSize",
"<",
"0",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"if",
"page",
"<",
"0",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"if",
"raw",
"{",
"return",
"client",
".",
"ListDatumF",
"(",
"args",
"[",
"0",
"]",
",",
"pageSize",
",",
"page",
",",
"func",
"(",
"di",
"*",
"ppsclient",
".",
"DatumInfo",
")",
"error",
"{",
"return",
"marshaller",
".",
"Marshal",
"(",
"os",
".",
"Stdout",
",",
"di",
")",
"\n",
"}",
")",
"\n",
"}",
"\n",
"writer",
":=",
"tabwriter",
".",
"NewWriter",
"(",
"os",
".",
"Stdout",
",",
"pretty",
".",
"DatumHeader",
")",
"\n",
"if",
"err",
":=",
"client",
".",
"ListDatumF",
"(",
"args",
"[",
"0",
"]",
",",
"pageSize",
",",
"page",
",",
"func",
"(",
"di",
"*",
"ppsclient",
".",
"DatumInfo",
")",
"error",
"{",
"pretty",
".",
"PrintDatumInfo",
"(",
"writer",
",",
"di",
")",
"\n",
"return",
"nil",
"\n",
"}",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"return",
"writer",
".",
"Flush",
"(",
")",
"\n",
"}",
")",
",",
"}",
"\n",
"listDatum",
".",
"Flags",
"(",
")",
".",
"Int64Var",
"(",
"&",
"pageSize",
",",
"\"",
"\"",
",",
"0",
",",
"\"",
"\"",
")",
"\n",
"listDatum",
".",
"Flags",
"(",
")",
".",
"Int64Var",
"(",
"&",
"page",
",",
"\"",
"\"",
",",
"0",
",",
"\"",
"\"",
")",
"\n",
"listDatum",
".",
"Flags",
"(",
")",
".",
"AddFlagSet",
"(",
"rawFlags",
")",
"\n",
"commands",
"=",
"append",
"(",
"commands",
",",
"cmdutil",
".",
"CreateAlias",
"(",
"listDatum",
",",
"\"",
"\"",
")",
")",
"\n\n",
"inspectDatum",
":=",
"&",
"cobra",
".",
"Command",
"{",
"Use",
":",
"\"",
"\"",
",",
"Short",
":",
"\"",
"\"",
",",
"Long",
":",
"\"",
"\"",
",",
"Run",
":",
"cmdutil",
".",
"RunFixedArgs",
"(",
"2",
",",
"func",
"(",
"args",
"[",
"]",
"string",
")",
"error",
"{",
"client",
",",
"err",
":=",
"pachdclient",
".",
"NewOnUserMachine",
"(",
"!",
"*",
"noMetrics",
",",
"!",
"*",
"noPortForwarding",
",",
"\"",
"\"",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"defer",
"client",
".",
"Close",
"(",
")",
"\n",
"datumInfo",
",",
"err",
":=",
"client",
".",
"InspectDatum",
"(",
"args",
"[",
"0",
"]",
",",
"args",
"[",
"1",
"]",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"if",
"raw",
"{",
"return",
"marshaller",
".",
"Marshal",
"(",
"os",
".",
"Stdout",
",",
"datumInfo",
")",
"\n",
"}",
"\n",
"pretty",
".",
"PrintDetailedDatumInfo",
"(",
"os",
".",
"Stdout",
",",
"datumInfo",
")",
"\n",
"return",
"nil",
"\n",
"}",
")",
",",
"}",
"\n",
"inspectDatum",
".",
"Flags",
"(",
")",
".",
"AddFlagSet",
"(",
"rawFlags",
")",
"\n",
"commands",
"=",
"append",
"(",
"commands",
",",
"cmdutil",
".",
"CreateAlias",
"(",
"inspectDatum",
",",
"\"",
"\"",
")",
")",
"\n\n",
"var",
"(",
"jobID",
"string",
"\n",
"datumID",
"string",
"\n",
"commaInputs",
"string",
"// comma-separated list of input files of interest",
"\n",
"master",
"bool",
"\n",
"follow",
"bool",
"\n",
"tail",
"int64",
"\n",
")",
"\n",
"getLogs",
":=",
"&",
"cobra",
".",
"Command",
"{",
"Use",
":",
"\"",
"\"",
",",
"Short",
":",
"\"",
"\"",
",",
"Long",
":",
"\"",
"\"",
",",
"Example",
":",
"`\n# Return logs emitted by recent jobs in the \"filter\" pipeline\n$ {{alias}} --pipeline=filter\n\n# Return logs emitted by the job aedfa12aedf\n$ {{alias}} --job=aedfa12aedf\n\n# Return logs emitted by the pipeline \\\"filter\\\" while processing /apple.txt and a file with the hash 123aef\n$ {{alias}} --pipeline=filter --inputs=/apple.txt,123aef`",
",",
"Run",
":",
"cmdutil",
".",
"RunFixedArgs",
"(",
"0",
",",
"func",
"(",
"args",
"[",
"]",
"string",
")",
"error",
"{",
"client",
",",
"err",
":=",
"pachdclient",
".",
"NewOnUserMachine",
"(",
"!",
"*",
"noMetrics",
",",
"!",
"*",
"noPortForwarding",
",",
"\"",
"\"",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"}",
"\n",
"defer",
"client",
".",
"Close",
"(",
")",
"\n\n",
"// Break up comma-separated input paths, and filter out empty entries",
"data",
":=",
"strings",
".",
"Split",
"(",
"commaInputs",
",",
"\"",
"\"",
")",
"\n",
"for",
"i",
":=",
"0",
";",
"i",
"<",
"len",
"(",
"data",
")",
";",
"{",
"if",
"len",
"(",
"data",
"[",
"i",
"]",
")",
"==",
"0",
"{",
"if",
"i",
"+",
"1",
"<",
"len",
"(",
"data",
")",
"{",
"copy",
"(",
"data",
"[",
"i",
":",
"]",
",",
"data",
"[",
"i",
"+",
"1",
":",
"]",
")",
"\n",
"}",
"\n",
"data",
"=",
"data",
"[",
":",
"len",
"(",
"data",
")",
"-",
"1",
"]",
"\n",
"}",
"else",
"{",
"i",
"++",
"\n",
"}",
"\n",
"}",
"\n\n",
"// Issue RPC",
"marshaler",
":=",
"&",
"jsonpb",
".",
"Marshaler",
"{",
"}",
"\n",
"iter",
":=",
"client",
".",
"GetLogs",
"(",
"pipelineName",
",",
"jobID",
",",
"data",
",",
"datumID",
",",
"master",
",",
"follow",
",",
"tail",
")",
"\n",
"for",
"iter",
".",
"Next",
"(",
")",
"{",
"var",
"messageStr",
"string",
"\n",
"if",
"raw",
"{",
"var",
"err",
"error",
"\n",
"messageStr",
",",
"err",
"=",
"marshaler",
".",
"MarshalToString",
"(",
"iter",
".",
"Message",
"(",
")",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"fmt",
".",
"Fprintf",
"(",
"os",
".",
"Stderr",
",",
"\"",
"\\\"",
"\\\"",
"\\n",
"\"",
",",
"iter",
".",
"Message",
"(",
")",
",",
"err",
")",
"\n",
"}",
"\n",
"fmt",
".",
"Println",
"(",
"messageStr",
")",
"\n",
"}",
"else",
"if",
"iter",
".",
"Message",
"(",
")",
".",
"User",
"{",
"fmt",
".",
"Println",
"(",
"iter",
".",
"Message",
"(",
")",
".",
"Message",
")",
"\n",
"}",
"else",
"if",
"iter",
".",
"Message",
"(",
")",
".",
"Master",
"&&",
"master",
"{",
"fmt",
".",
"Println",
"(",
"iter",
".",
"Message",
"(",
")",
".",
"Message",
")",
"\n",
"}",
"else",
"if",
"pipelineName",
"==",
"\"",
"\"",
"&&",
"jobID",
"==",
"\"",
"\"",
"{",
"fmt",
".",
"Println",
"(",
"iter",
".",
"Message",
"(",
")",
".",
"Message",
")",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"iter",
".",
"Err",
"(",
")",
"\n",
"}",
")",
",",
"}",
"\n",
"getLogs",
".",
"Flags",
"(",
")",
".",
"StringVarP",
"(",
"&",
"pipelineName",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
"+",
"\"",
"\"",
")",
"\n",
"getLogs",
".",
"MarkFlagCustom",
"(",
"\"",
"\"",
",",
"\"",
"\"",
")",
"\n",
"getLogs",
".",
"Flags",
"(",
")",
".",
"StringVar",
"(",
"&",
"jobID",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
"+",
"\"",
"\"",
")",
"\n",
"getLogs",
".",
"MarkFlagCustom",
"(",
"\"",
"\"",
",",
"\"",
"\"",
")",
"\n",
"getLogs",
".",
"Flags",
"(",
")",
".",
"StringVar",
"(",
"&",
"datumID",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
")",
"\n",
"getLogs",
".",
"Flags",
"(",
")",
".",
"StringVar",
"(",
"&",
"commaInputs",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
"+",
"\"",
"\"",
")",
"\n",
"getLogs",
".",
"Flags",
"(",
")",
".",
"BoolVar",
"(",
"&",
"master",
",",
"\"",
"\"",
",",
"false",
",",
"\"",
"\"",
")",
"\n",
"getLogs",
".",
"Flags",
"(",
")",
".",
"BoolVar",
"(",
"&",
"raw",
",",
"\"",
"\"",
",",
"false",
",",
"\"",
"\"",
")",
"\n",
"getLogs",
".",
"Flags",
"(",
")",
".",
"BoolVarP",
"(",
"&",
"follow",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"false",
",",
"\"",
"\"",
")",
"\n",
"getLogs",
".",
"Flags",
"(",
")",
".",
"Int64VarP",
"(",
"&",
"tail",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"0",
",",
"\"",
"\"",
")",
"\n",
"commands",
"=",
"append",
"(",
"commands",
",",
"cmdutil",
".",
"CreateAlias",
"(",
"getLogs",
",",
"\"",
"\"",
")",
")",
"\n\n",
"pipelineDocs",
":=",
"&",
"cobra",
".",
"Command",
"{",
"Short",
":",
"\"",
"\"",
",",
"Long",
":",
"`Pipelines are a powerful abstraction for automating jobs.\n\nPipelines take a set of repos and branches as inputs and will write to a single\noutput repo of the same name. Pipelines then subscribe to commits on those repos\nand launch a job to process each incoming commit.\n\nAll jobs created by a pipeline will create commits in the pipeline's output repo.`",
",",
"}",
"\n",
"cmdutil",
".",
"SetDocsUsage",
"(",
"pipelineDocs",
")",
"\n",
"commands",
"=",
"append",
"(",
"commands",
",",
"cmdutil",
".",
"CreateAlias",
"(",
"pipelineDocs",
",",
"\"",
"\"",
")",
")",
"\n\n",
"var",
"build",
"bool",
"\n",
"var",
"pushImages",
"bool",
"\n",
"var",
"registry",
"string",
"\n",
"var",
"username",
"string",
"\n",
"var",
"pipelinePath",
"string",
"\n",
"createPipeline",
":=",
"&",
"cobra",
".",
"Command",
"{",
"Short",
":",
"\"",
"\"",
",",
"Long",
":",
"\"",
"\"",
",",
"Run",
":",
"cmdutil",
".",
"RunFixedArgs",
"(",
"0",
",",
"func",
"(",
"args",
"[",
"]",
"string",
")",
"(",
"retErr",
"error",
")",
"{",
"return",
"pipelineHelper",
"(",
"!",
"*",
"noMetrics",
",",
"!",
"*",
"noPortForwarding",
",",
"false",
",",
"build",
",",
"pushImages",
",",
"registry",
",",
"username",
",",
"pipelinePath",
",",
"false",
")",
"\n",
"}",
")",
",",
"}",
"\n",
"createPipeline",
".",
"Flags",
"(",
")",
".",
"StringVarP",
"(",
"&",
"pipelinePath",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
")",
"\n",
"createPipeline",
".",
"Flags",
"(",
")",
".",
"BoolVarP",
"(",
"&",
"build",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"false",
",",
"\"",
"\"",
")",
"\n",
"createPipeline",
".",
"Flags",
"(",
")",
".",
"BoolVarP",
"(",
"&",
"pushImages",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"false",
",",
"\"",
"\"",
")",
"\n",
"createPipeline",
".",
"Flags",
"(",
")",
".",
"StringVarP",
"(",
"&",
"registry",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
")",
"\n",
"createPipeline",
".",
"Flags",
"(",
")",
".",
"StringVarP",
"(",
"&",
"username",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
")",
"\n",
"commands",
"=",
"append",
"(",
"commands",
",",
"cmdutil",
".",
"CreateAlias",
"(",
"createPipeline",
",",
"\"",
"\"",
")",
")",
"\n\n",
"var",
"reprocess",
"bool",
"\n",
"updatePipeline",
":=",
"&",
"cobra",
".",
"Command",
"{",
"Short",
":",
"\"",
"\"",
",",
"Long",
":",
"\"",
"\"",
",",
"Run",
":",
"cmdutil",
".",
"RunFixedArgs",
"(",
"0",
",",
"func",
"(",
"args",
"[",
"]",
"string",
")",
"(",
"retErr",
"error",
")",
"{",
"return",
"pipelineHelper",
"(",
"!",
"*",
"noMetrics",
",",
"!",
"*",
"noPortForwarding",
",",
"reprocess",
",",
"build",
",",
"pushImages",
",",
"registry",
",",
"username",
",",
"pipelinePath",
",",
"true",
")",
"\n",
"}",
")",
",",
"}",
"\n",
"updatePipeline",
".",
"Flags",
"(",
")",
".",
"StringVarP",
"(",
"&",
"pipelinePath",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
")",
"\n",
"updatePipeline",
".",
"Flags",
"(",
")",
".",
"BoolVarP",
"(",
"&",
"build",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"false",
",",
"\"",
"\"",
")",
"\n",
"updatePipeline",
".",
"Flags",
"(",
")",
".",
"BoolVarP",
"(",
"&",
"pushImages",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"false",
",",
"\"",
"\"",
")",
"\n",
"updatePipeline",
".",
"Flags",
"(",
")",
".",
"StringVarP",
"(",
"&",
"registry",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
")",
"\n",
"updatePipeline",
".",
"Flags",
"(",
")",
".",
"StringVarP",
"(",
"&",
"username",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
")",
"\n",
"updatePipeline",
".",
"Flags",
"(",
")",
".",
"BoolVar",
"(",
"&",
"reprocess",
",",
"\"",
"\"",
",",
"false",
",",
"\"",
"\"",
")",
"\n",
"commands",
"=",
"append",
"(",
"commands",
",",
"cmdutil",
".",
"CreateAlias",
"(",
"updatePipeline",
",",
"\"",
"\"",
")",
")",
"\n\n",
"inspectPipeline",
":=",
"&",
"cobra",
".",
"Command",
"{",
"Use",
":",
"\"",
"\"",
",",
"Short",
":",
"\"",
"\"",
",",
"Long",
":",
"\"",
"\"",
",",
"Run",
":",
"cmdutil",
".",
"RunFixedArgs",
"(",
"1",
",",
"func",
"(",
"args",
"[",
"]",
"string",
")",
"error",
"{",
"client",
",",
"err",
":=",
"pachdclient",
".",
"NewOnUserMachine",
"(",
"!",
"*",
"noMetrics",
",",
"!",
"*",
"noPortForwarding",
",",
"\"",
"\"",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"defer",
"client",
".",
"Close",
"(",
")",
"\n",
"pipelineInfo",
",",
"err",
":=",
"client",
".",
"InspectPipeline",
"(",
"args",
"[",
"0",
"]",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"if",
"pipelineInfo",
"==",
"nil",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"args",
"[",
"0",
"]",
")",
"\n",
"}",
"\n",
"if",
"raw",
"{",
"return",
"marshaller",
".",
"Marshal",
"(",
"os",
".",
"Stdout",
",",
"pipelineInfo",
")",
"\n",
"}",
"\n",
"pi",
":=",
"&",
"pretty",
".",
"PrintablePipelineInfo",
"{",
"PipelineInfo",
":",
"pipelineInfo",
",",
"FullTimestamps",
":",
"fullTimestamps",
",",
"}",
"\n",
"return",
"pretty",
".",
"PrintDetailedPipelineInfo",
"(",
"pi",
")",
"\n",
"}",
")",
",",
"}",
"\n",
"inspectPipeline",
".",
"Flags",
"(",
")",
".",
"AddFlagSet",
"(",
"rawFlags",
")",
"\n",
"inspectPipeline",
".",
"Flags",
"(",
")",
".",
"AddFlagSet",
"(",
"fullTimestampsFlags",
")",
"\n",
"commands",
"=",
"append",
"(",
"commands",
",",
"cmdutil",
".",
"CreateAlias",
"(",
"inspectPipeline",
",",
"\"",
"\"",
")",
")",
"\n\n",
"extractPipeline",
":=",
"&",
"cobra",
".",
"Command",
"{",
"Use",
":",
"\"",
"\"",
",",
"Short",
":",
"\"",
"\"",
",",
"Long",
":",
"\"",
"\"",
",",
"Run",
":",
"cmdutil",
".",
"RunFixedArgs",
"(",
"1",
",",
"func",
"(",
"args",
"[",
"]",
"string",
")",
"error",
"{",
"client",
",",
"err",
":=",
"pachdclient",
".",
"NewOnUserMachine",
"(",
"!",
"*",
"noMetrics",
",",
"!",
"*",
"noPortForwarding",
",",
"\"",
"\"",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"defer",
"client",
".",
"Close",
"(",
")",
"\n",
"createPipelineRequest",
",",
"err",
":=",
"client",
".",
"ExtractPipeline",
"(",
"args",
"[",
"0",
"]",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"return",
"marshaller",
".",
"Marshal",
"(",
"os",
".",
"Stdout",
",",
"createPipelineRequest",
")",
"\n",
"}",
")",
",",
"}",
"\n",
"commands",
"=",
"append",
"(",
"commands",
",",
"cmdutil",
".",
"CreateAlias",
"(",
"extractPipeline",
",",
"\"",
"\"",
")",
")",
"\n\n",
"var",
"editor",
"string",
"\n",
"editPipeline",
":=",
"&",
"cobra",
".",
"Command",
"{",
"Use",
":",
"\"",
"\"",
",",
"Short",
":",
"\"",
"\"",
",",
"Long",
":",
"\"",
"\"",
",",
"Run",
":",
"cmdutil",
".",
"RunFixedArgs",
"(",
"1",
",",
"func",
"(",
"args",
"[",
"]",
"string",
")",
"(",
"retErr",
"error",
")",
"{",
"client",
",",
"err",
":=",
"pachdclient",
".",
"NewOnUserMachine",
"(",
"!",
"*",
"noMetrics",
",",
"!",
"*",
"noPortForwarding",
",",
"\"",
"\"",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"defer",
"client",
".",
"Close",
"(",
")",
"\n",
"createPipelineRequest",
",",
"err",
":=",
"client",
".",
"ExtractPipeline",
"(",
"args",
"[",
"0",
"]",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"f",
",",
"err",
":=",
"ioutil",
".",
"TempFile",
"(",
"\"",
"\"",
",",
"args",
"[",
"0",
"]",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"if",
"err",
":=",
"marshaller",
".",
"Marshal",
"(",
"f",
",",
"createPipelineRequest",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"defer",
"func",
"(",
")",
"{",
"if",
"err",
":=",
"f",
".",
"Close",
"(",
")",
";",
"err",
"!=",
"nil",
"&&",
"retErr",
"==",
"nil",
"{",
"retErr",
"=",
"err",
"\n",
"}",
"\n",
"}",
"(",
")",
"\n",
"if",
"editor",
"==",
"\"",
"\"",
"{",
"editor",
"=",
"os",
".",
"Getenv",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"if",
"editor",
"==",
"\"",
"\"",
"{",
"editor",
"=",
"\"",
"\"",
"\n",
"}",
"\n",
"if",
"err",
":=",
"cmdutil",
".",
"RunIO",
"(",
"cmdutil",
".",
"IO",
"{",
"Stdin",
":",
"os",
".",
"Stdin",
",",
"Stdout",
":",
"os",
".",
"Stdout",
",",
"Stderr",
":",
"os",
".",
"Stderr",
",",
"}",
",",
"editor",
",",
"f",
".",
"Name",
"(",
")",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"cfgReader",
",",
"err",
":=",
"ppsutil",
".",
"NewPipelineManifestReader",
"(",
"f",
".",
"Name",
"(",
")",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"request",
",",
"err",
":=",
"cfgReader",
".",
"NextCreatePipelineRequest",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"if",
"proto",
".",
"Equal",
"(",
"createPipelineRequest",
",",
"request",
")",
"{",
"fmt",
".",
"Println",
"(",
"\"",
"\"",
")",
"\n",
"return",
"nil",
"\n",
"}",
"\n",
"request",
".",
"Update",
"=",
"true",
"\n",
"request",
".",
"Reprocess",
"=",
"reprocess",
"\n",
"if",
"_",
",",
"err",
":=",
"client",
".",
"PpsAPIClient",
".",
"CreatePipeline",
"(",
"client",
".",
"Ctx",
"(",
")",
",",
"request",
",",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"grpcutil",
".",
"ScrubGRPC",
"(",
"err",
")",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}",
")",
",",
"}",
"\n",
"editPipeline",
".",
"Flags",
"(",
")",
".",
"BoolVar",
"(",
"&",
"reprocess",
",",
"\"",
"\"",
",",
"false",
",",
"\"",
"\"",
")",
"\n",
"editPipeline",
".",
"Flags",
"(",
")",
".",
"StringVar",
"(",
"&",
"editor",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
")",
"\n",
"commands",
"=",
"append",
"(",
"commands",
",",
"cmdutil",
".",
"CreateAlias",
"(",
"editPipeline",
",",
"\"",
"\"",
")",
")",
"\n\n",
"var",
"spec",
"bool",
"\n",
"listPipeline",
":=",
"&",
"cobra",
".",
"Command",
"{",
"Short",
":",
"\"",
"\"",
",",
"Long",
":",
"\"",
"\"",
",",
"Run",
":",
"cmdutil",
".",
"RunFixedArgs",
"(",
"0",
",",
"func",
"(",
"args",
"[",
"]",
"string",
")",
"error",
"{",
"client",
",",
"err",
":=",
"pachdclient",
".",
"NewOnUserMachine",
"(",
"!",
"*",
"noMetrics",
",",
"!",
"*",
"noPortForwarding",
",",
"\"",
"\"",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"}",
"\n",
"defer",
"client",
".",
"Close",
"(",
")",
"\n",
"pipelineInfos",
",",
"err",
":=",
"client",
".",
"ListPipeline",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"if",
"raw",
"{",
"for",
"_",
",",
"pipelineInfo",
":=",
"range",
"pipelineInfos",
"{",
"if",
"err",
":=",
"marshaller",
".",
"Marshal",
"(",
"os",
".",
"Stdout",
",",
"pipelineInfo",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}",
"\n",
"if",
"spec",
"{",
"for",
"_",
",",
"pipelineInfo",
":=",
"range",
"pipelineInfos",
"{",
"if",
"err",
":=",
"marshaller",
".",
"Marshal",
"(",
"os",
".",
"Stdout",
",",
"ppsutil",
".",
"PipelineReqFromInfo",
"(",
"pipelineInfo",
")",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}",
"\n",
"writer",
":=",
"tabwriter",
".",
"NewWriter",
"(",
"os",
".",
"Stdout",
",",
"pretty",
".",
"PipelineHeader",
")",
"\n",
"for",
"_",
",",
"pipelineInfo",
":=",
"range",
"pipelineInfos",
"{",
"pretty",
".",
"PrintPipelineInfo",
"(",
"writer",
",",
"pipelineInfo",
",",
"fullTimestamps",
")",
"\n",
"}",
"\n",
"return",
"writer",
".",
"Flush",
"(",
")",
"\n",
"}",
")",
",",
"}",
"\n",
"listPipeline",
".",
"Flags",
"(",
")",
".",
"BoolVarP",
"(",
"&",
"spec",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"false",
",",
"\"",
"\"",
")",
"\n",
"listPipeline",
".",
"Flags",
"(",
")",
".",
"AddFlagSet",
"(",
"rawFlags",
")",
"\n",
"listPipeline",
".",
"Flags",
"(",
")",
".",
"AddFlagSet",
"(",
"fullTimestampsFlags",
")",
"\n",
"commands",
"=",
"append",
"(",
"commands",
",",
"cmdutil",
".",
"CreateAlias",
"(",
"listPipeline",
",",
"\"",
"\"",
")",
")",
"\n\n",
"var",
"all",
"bool",
"\n",
"var",
"force",
"bool",
"\n",
"deletePipeline",
":=",
"&",
"cobra",
".",
"Command",
"{",
"Use",
":",
"\"",
"\"",
",",
"Short",
":",
"\"",
"\"",
",",
"Long",
":",
"\"",
"\"",
",",
"Run",
":",
"cmdutil",
".",
"RunBoundedArgs",
"(",
"0",
",",
"1",
",",
"func",
"(",
"args",
"[",
"]",
"string",
")",
"error",
"{",
"client",
",",
"err",
":=",
"pachdclient",
".",
"NewOnUserMachine",
"(",
"!",
"*",
"noMetrics",
",",
"!",
"*",
"noPortForwarding",
",",
"\"",
"\"",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"defer",
"client",
".",
"Close",
"(",
")",
"\n",
"if",
"len",
"(",
"args",
")",
">",
"0",
"&&",
"all",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"if",
"len",
"(",
"args",
")",
"==",
"0",
"&&",
"!",
"all",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"if",
"all",
"{",
"_",
",",
"err",
"=",
"client",
".",
"PpsAPIClient",
".",
"DeletePipeline",
"(",
"client",
".",
"Ctx",
"(",
")",
",",
"&",
"ppsclient",
".",
"DeletePipelineRequest",
"{",
"All",
":",
"all",
",",
"Force",
":",
"force",
",",
"}",
")",
"\n",
"}",
"else",
"{",
"err",
"=",
"client",
".",
"DeletePipeline",
"(",
"args",
"[",
"0",
"]",
",",
"force",
")",
"\n",
"}",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"grpcutil",
".",
"ScrubGRPC",
"(",
"err",
")",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}",
")",
",",
"}",
"\n",
"deletePipeline",
".",
"Flags",
"(",
")",
".",
"BoolVar",
"(",
"&",
"all",
",",
"\"",
"\"",
",",
"false",
",",
"\"",
"\"",
")",
"\n",
"deletePipeline",
".",
"Flags",
"(",
")",
".",
"BoolVarP",
"(",
"&",
"force",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"false",
",",
"\"",
"\"",
")",
"\n",
"commands",
"=",
"append",
"(",
"commands",
",",
"cmdutil",
".",
"CreateAlias",
"(",
"deletePipeline",
",",
"\"",
"\"",
")",
")",
"\n\n",
"startPipeline",
":=",
"&",
"cobra",
".",
"Command",
"{",
"Use",
":",
"\"",
"\"",
",",
"Short",
":",
"\"",
"\"",
",",
"Long",
":",
"\"",
"\"",
",",
"Run",
":",
"cmdutil",
".",
"RunFixedArgs",
"(",
"1",
",",
"func",
"(",
"args",
"[",
"]",
"string",
")",
"error",
"{",
"client",
",",
"err",
":=",
"pachdclient",
".",
"NewOnUserMachine",
"(",
"!",
"*",
"noMetrics",
",",
"!",
"*",
"noPortForwarding",
",",
"\"",
"\"",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"defer",
"client",
".",
"Close",
"(",
")",
"\n",
"if",
"err",
":=",
"client",
".",
"StartPipeline",
"(",
"args",
"[",
"0",
"]",
")",
";",
"err",
"!=",
"nil",
"{",
"cmdutil",
".",
"ErrorAndExit",
"(",
"\"",
"\"",
",",
"err",
".",
"Error",
"(",
")",
")",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}",
")",
",",
"}",
"\n",
"commands",
"=",
"append",
"(",
"commands",
",",
"cmdutil",
".",
"CreateAlias",
"(",
"startPipeline",
",",
"\"",
"\"",
")",
")",
"\n\n",
"stopPipeline",
":=",
"&",
"cobra",
".",
"Command",
"{",
"Use",
":",
"\"",
"\"",
",",
"Short",
":",
"\"",
"\"",
",",
"Long",
":",
"\"",
"\"",
",",
"Run",
":",
"cmdutil",
".",
"RunFixedArgs",
"(",
"1",
",",
"func",
"(",
"args",
"[",
"]",
"string",
")",
"error",
"{",
"client",
",",
"err",
":=",
"pachdclient",
".",
"NewOnUserMachine",
"(",
"!",
"*",
"noMetrics",
",",
"!",
"*",
"noPortForwarding",
",",
"\"",
"\"",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"defer",
"client",
".",
"Close",
"(",
")",
"\n",
"if",
"err",
":=",
"client",
".",
"StopPipeline",
"(",
"args",
"[",
"0",
"]",
")",
";",
"err",
"!=",
"nil",
"{",
"cmdutil",
".",
"ErrorAndExit",
"(",
"\"",
"\"",
",",
"err",
".",
"Error",
"(",
")",
")",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}",
")",
",",
"}",
"\n",
"commands",
"=",
"append",
"(",
"commands",
",",
"cmdutil",
".",
"CreateAlias",
"(",
"stopPipeline",
",",
"\"",
"\"",
")",
")",
"\n\n",
"var",
"memory",
"string",
"\n",
"garbageCollect",
":=",
"&",
"cobra",
".",
"Command",
"{",
"Short",
":",
"\"",
"\"",
",",
"Long",
":",
"`Garbage collect unused data.\n\nWhen a file/commit/repo is deleted, the data is not immediately removed from\nthe underlying storage system (e.g. S3) for performance and architectural\nreasons. This is similar to how when you delete a file on your computer, the\nfile is not necessarily wiped from disk immediately.\n\nTo actually remove the data, you will need to manually invoke garbage\ncollection with \"pachctl garbage-collect\".\n\nCurrently \"pachctl garbage-collect\" can only be started when there are no\npipelines running. You also need to ensure that there's no ongoing \"put file\".\nGarbage collection puts the cluster into a readonly mode where no new jobs can\nbe created and no data can be added.\n\nPachyderm's garbage collection uses bloom filters to index live objects. This\nmeans that some dead objects may erronously not be deleted during garbage\ncollection. The probability of this happening depends on how many objects you\nhave; at around 10M objects it starts to become likely with the default values.\nTo lower Pachyderm's error rate and make garbage-collection more comprehensive,\nyou can increase the amount of memory used for the bloom filters with the\n--memory flag. The default value is 10MB.\n`",
",",
"Run",
":",
"cmdutil",
".",
"RunFixedArgs",
"(",
"0",
",",
"func",
"(",
"args",
"[",
"]",
"string",
")",
"(",
"retErr",
"error",
")",
"{",
"client",
",",
"err",
":=",
"pachdclient",
".",
"NewOnUserMachine",
"(",
"!",
"*",
"noMetrics",
",",
"!",
"*",
"noPortForwarding",
",",
"\"",
"\"",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"defer",
"client",
".",
"Close",
"(",
")",
"\n",
"memoryBytes",
",",
"err",
":=",
"units",
".",
"RAMInBytes",
"(",
"memory",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"return",
"client",
".",
"GarbageCollect",
"(",
"memoryBytes",
")",
"\n",
"}",
")",
",",
"}",
"\n",
"garbageCollect",
".",
"Flags",
"(",
")",
".",
"StringVarP",
"(",
"&",
"memory",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
")",
"\n",
"commands",
"=",
"append",
"(",
"commands",
",",
"cmdutil",
".",
"CreateAlias",
"(",
"garbageCollect",
",",
"\"",
"\"",
")",
")",
"\n\n",
"return",
"commands",
"\n",
"}"
] |
4,540 | all-4541 | [
"UnmarshalJSON",
"supports",
"json",
".",
"Unmarshaler",
"interface"
] | [
"func",
"(",
"v",
"*",
"EventRequestWillBeSent",
")",
"UnmarshalJSON",
"(",
"data",
"[",
"]",
"byte",
")",
"error",
"{",
"r",
":=",
"jlexer",
".",
"Lexer",
"{",
"Data",
":",
"<mask>",
"}",
"\n",
"easyjsonC5a4559bDecodeGithubComChromedpCdprotoNetwork50",
"(",
"&",
"r",
",",
"v",
")",
"\n",
"return",
"r",
".",
"Error",
"(",
")",
"\n",
"}"
] |
4,541 | all-4542 | [
"resourceVSphereComputeClusterHostGroupFetchObjects",
"fetches",
"the",
"objects",
"for",
"a",
"cluster",
"host",
"group",
".",
"This",
"is",
"currently",
"just",
"the",
"cluster",
"object",
"as",
"the",
"name",
"of",
"the",
"group",
"is",
"a",
"static",
"value",
"and",
"a",
"pass",
"-",
"through",
"-",
"this",
"is",
"to",
"keep",
"its",
"workflow",
"consistent",
"with",
"other",
"cluster",
"-",
"dependent",
"resources",
"that",
"derive",
"from",
"ArrayUpdateSpec",
"that",
"have",
"managed",
"object",
"as",
"keys",
"such",
"as",
"VM",
"and",
"host",
"overrides",
"."
] | [
"func",
"resourceVSphereComputeClusterHostGroupFetchObjects",
"(",
"meta",
"interface",
"{",
"}",
",",
"clusterID",
"string",
",",
"name",
"string",
",",
")",
"(",
"*",
"object",
".",
"ClusterComputeResource",
",",
"string",
",",
"error",
")",
"{",
"client",
",",
"err",
":=",
"resourceVSphereComputeClusterHostGroupClient",
"(",
"meta",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"\"",
"\"",
",",
"err",
"\n",
"}",
"\n\n",
"cluster",
",",
"err",
":=",
"clustercomputeresource",
".",
"FromID",
"(",
"<mask>",
",",
"clusterID",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"\"",
"\"",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"}",
"\n\n",
"return",
"cluster",
",",
"name",
",",
"nil",
"\n",
"}"
] |
4,542 | all-4543 | [
"GoogleServiceAccountCredentialsJSON",
"is",
"an",
"option",
"that",
"creates",
"the",
"Stackdriver",
"logging",
"service",
"using",
"the",
"supplied",
"Google",
"service",
"account",
"credentials",
".",
"Google",
"Service",
"Account",
"credentials",
"can",
"be",
"downloaded",
"from",
"the",
"Google",
"Cloud",
"console",
":",
"https",
":",
"//",
"console",
".",
"cloud",
".",
"google",
".",
"com",
"/",
"iam",
"-",
"admin",
"/",
"serviceaccounts",
"/"
] | [
"func",
"GoogleServiceAccountCredentialsJSON",
"(",
"buf",
"[",
"]",
"byte",
")",
"Option",
"{",
"return",
"func",
"(",
"sh",
"*",
"StackdriverHook",
")",
"error",
"{",
"var",
"err",
"error",
"\n\n",
"// load credentials",
"gsa",
",",
"err",
":=",
"gserviceaccount",
".",
"FromJSON",
"(",
"buf",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"// check project id",
"if",
"gsa",
".",
"ProjectID",
"==",
"\"",
"\"",
"{",
"return",
"errors",
".",
"New",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"// set project id",
"err",
"=",
"ProjectID",
"(",
"gsa",
".",
"ProjectID",
")",
"(",
"sh",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"// set resource type",
"err",
"=",
"Resource",
"(",
"ResTypeProject",
",",
"map",
"[",
"string",
"]",
"string",
"{",
"\"",
"\"",
":",
"gsa",
".",
"ProjectID",
",",
"}",
")",
"(",
"sh",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"// create token source",
"<mask>",
",",
"err",
":=",
"gsa",
".",
"TokenSource",
"(",
"nil",
",",
"requiredScopes",
"...",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"// set client",
"return",
"HTTPClient",
"(",
"&",
"http",
".",
"Client",
"{",
"Transport",
":",
"&",
"oauth2",
".",
"Transport",
"{",
"Source",
":",
"oauth2",
".",
"ReuseTokenSource",
"(",
"nil",
",",
"ts",
")",
",",
"}",
",",
"}",
")",
"(",
"sh",
")",
"\n",
"}",
"\n",
"}"
] |
4,543 | all-4544 | [
"processRegexMatches",
"processes",
"the",
"user",
"command",
"regex",
"matches",
"and",
"returns",
"the",
"proposed",
"project",
"name",
"proposed",
"column",
"name",
"whether",
"the",
"command",
"is",
"to",
"remove",
"issue",
"/",
"PR",
"from",
"project",
"and",
"the",
"error",
"message"
] | [
"func",
"processRegexMatches",
"(",
"matches",
"[",
"]",
"string",
")",
"(",
"string",
",",
"string",
",",
"bool",
",",
"string",
")",
"{",
"var",
"shouldClear",
"=",
"false",
"\n",
"proposedProject",
":=",
"matches",
"[",
"1",
"]",
"\n",
"proposedColumnName",
":=",
"\"",
"\"",
"\n",
"if",
"len",
"(",
"matches",
")",
">",
"1",
"&&",
"proposedProject",
"!=",
"clearKeyword",
"{",
"proposedColumnName",
"=",
"matches",
"[",
"2",
"]",
"\n",
"}",
"\n",
"// If command is to clear and the project is provided",
"if",
"proposedProject",
"==",
"clearKeyword",
"{",
"if",
"len",
"(",
"matches",
")",
">",
"2",
"&&",
"matches",
"[",
"2",
"]",
"!=",
"\"",
"\"",
"{",
"proposedProject",
"=",
"matches",
"[",
"2",
"]",
"\n",
"shouldClear",
"=",
"<mask>",
"\n",
"}",
"else",
"{",
"msg",
":=",
"invalidNumArgs",
"\n",
"return",
"\"",
"\"",
",",
"\"",
"\"",
",",
"false",
",",
"msg",
"\n",
"}",
"\n",
"}",
"\n\n",
"return",
"proposedProject",
",",
"proposedColumnName",
",",
"shouldClear",
",",
"\"",
"\"",
"\n",
"}"
] |
4,544 | all-4545 | [
"Will",
"connect",
"switches",
"i",
"and",
"j",
"via",
"net",
".",
"Pipe",
"()",
"Blocks",
"until",
"a",
"conection",
"is",
"established",
".",
"NOTE",
":",
"caller",
"ensures",
"i",
"and",
"j",
"are",
"within",
"bounds"
] | [
"func",
"Connect2Switches",
"(",
"switches",
"[",
"]",
"*",
"Switch",
",",
"i",
",",
"j",
"int",
")",
"{",
"switchI",
":=",
"switches",
"[",
"i",
"]",
"\n",
"switchJ",
":=",
"switches",
"[",
"j",
"]",
"\n",
"c1",
",",
"c2",
":=",
"net",
".",
"Pipe",
"(",
")",
"\n",
"doneCh",
":=",
"make",
"(",
"chan",
"struct",
"{",
"}",
")",
"\n",
"<mask>",
"func",
"(",
")",
"{",
"err",
":=",
"switchI",
".",
"addPeerWithConnection",
"(",
"c1",
")",
"\n",
"if",
"PanicOnAddPeerErr",
"&&",
"err",
"!=",
"nil",
"{",
"panic",
"(",
"err",
")",
"\n",
"}",
"\n",
"doneCh",
"<-",
"struct",
"{",
"}",
"{",
"}",
"\n",
"}",
"(",
")",
"\n",
"go",
"func",
"(",
")",
"{",
"err",
":=",
"switchJ",
".",
"addPeerWithConnection",
"(",
"c2",
")",
"\n",
"if",
"PanicOnAddPeerErr",
"&&",
"err",
"!=",
"nil",
"{",
"panic",
"(",
"err",
")",
"\n",
"}",
"\n",
"doneCh",
"<-",
"struct",
"{",
"}",
"{",
"}",
"\n",
"}",
"(",
")",
"\n",
"<-",
"doneCh",
"\n",
"<-",
"doneCh",
"\n",
"}"
] |
4,545 | all-4546 | [
"batchSet",
"applies",
"a",
"list",
"of",
"badger",
".",
"Entry",
".",
"If",
"a",
"request",
"level",
"error",
"occurs",
"it",
"will",
"be",
"returned",
".",
"Check",
"(",
"kv",
".",
"BatchSet",
"(",
"entries",
"))"
] | [
"func",
"(",
"db",
"*",
"DB",
")",
"batchSet",
"(",
"entries",
"[",
"]",
"*",
"<mask>",
")",
"error",
"{",
"req",
",",
"err",
":=",
"db",
".",
"sendToWriteCh",
"(",
"entries",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"return",
"req",
".",
"Wait",
"(",
")",
"\n",
"}"
] |
4,546 | all-4547 | [
"SearchCheckBundles",
"returns",
"check",
"bundles",
"matching",
"the",
"specified",
"search",
"query",
"and",
"/",
"or",
"filter",
".",
"If",
"nil",
"is",
"passed",
"for",
"both",
"parameters",
"all",
"check",
"bundles",
"will",
"be",
"returned",
"."
] | [
"func",
"(",
"a",
"*",
"API",
")",
"SearchCheckBundles",
"(",
"searchCriteria",
"*",
"SearchQueryType",
",",
"filterCriteria",
"*",
"map",
"[",
"string",
"]",
"[",
"]",
"string",
")",
"(",
"*",
"[",
"]",
"CheckBundle",
",",
"error",
")",
"{",
"q",
":=",
"url",
".",
"Values",
"{",
"}",
"\n\n",
"if",
"searchCriteria",
"!=",
"nil",
"&&",
"*",
"searchCriteria",
"!=",
"\"",
"\"",
"{",
"q",
".",
"Set",
"(",
"\"",
"\"",
",",
"string",
"(",
"*",
"searchCriteria",
")",
")",
"\n",
"}",
"\n\n",
"if",
"filterCriteria",
"!=",
"nil",
"&&",
"len",
"(",
"*",
"filterCriteria",
")",
">",
"0",
"{",
"for",
"filter",
",",
"criteria",
":=",
"range",
"*",
"filterCriteria",
"{",
"for",
"_",
",",
"val",
":=",
"range",
"criteria",
"{",
"q",
".",
"Add",
"(",
"filter",
",",
"val",
")",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n\n",
"if",
"q",
".",
"Encode",
"(",
")",
"==",
"\"",
"\"",
"{",
"return",
"a",
".",
"FetchCheckBundles",
"(",
")",
"\n",
"}",
"\n\n",
"reqURL",
":=",
"url",
".",
"<mask>",
"{",
"Path",
":",
"config",
".",
"CheckBundlePrefix",
",",
"RawQuery",
":",
"q",
".",
"Encode",
"(",
")",
",",
"}",
"\n\n",
"resp",
",",
"err",
":=",
"a",
".",
"Get",
"(",
"reqURL",
".",
"String",
"(",
")",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"}",
"\n\n",
"var",
"results",
"[",
"]",
"CheckBundle",
"\n",
"if",
"err",
":=",
"json",
".",
"Unmarshal",
"(",
"resp",
",",
"&",
"results",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"return",
"&",
"results",
",",
"nil",
"\n",
"}"
] |
4,547 | all-4548 | [
"render",
"multiple",
"sets",
"of",
"primitives",
"by",
"specifying",
"indices",
"of",
"array",
"data",
"elements"
] | [
"func",
"MultiDrawElements",
"(",
"mode",
"uint32",
",",
"count",
"*",
"int32",
",",
"xtype",
"uint32",
",",
"indices",
"*",
"unsafe",
".",
"Pointer",
",",
"drawcount",
"int32",
")",
"{",
"C",
".",
"glowMultiDrawElements",
"(",
"gpMultiDrawElements",
",",
"(",
"C",
".",
"GLenum",
")",
"(",
"mode",
")",
",",
"(",
"*",
"C",
".",
"GLsizei",
")",
"(",
"unsafe",
".",
"Pointer",
"(",
"<mask>",
")",
")",
",",
"(",
"C",
".",
"GLenum",
")",
"(",
"xtype",
")",
",",
"indices",
",",
"(",
"C",
".",
"GLsizei",
")",
"(",
"drawcount",
")",
")",
"\n",
"}"
] |
4,548 | all-4549 | [
"Main",
"callback",
"for",
"miekg",
"/",
"dns",
".",
"Collects",
"information",
"about",
"the",
"query",
"constructs",
"a",
"response",
"and",
"returns",
"it",
"to",
"the",
"connector",
"."
] | [
"func",
"(",
"ds",
"*",
"DNSServer",
")",
"ServeDNS",
"(",
"w",
"dns",
".",
"ResponseWriter",
",",
"r",
"*",
"dns",
".",
"Msg",
")",
"{",
"m",
":=",
"&",
"dns",
".",
"Msg",
"{",
"}",
"\n",
"m",
".",
"SetReply",
"(",
"r",
")",
"\n\n",
"answers",
":=",
"[",
"]",
"dns",
".",
"RR",
"{",
"}",
"\n\n",
"for",
"_",
",",
"question",
":=",
"range",
"r",
".",
"Question",
"{",
"// nil records == not found",
"switch",
"question",
".",
"Qtype",
"{",
"case",
"dns",
".",
"TypeA",
":",
"a",
":=",
"ds",
".",
"GetA",
"(",
"question",
".",
"Name",
")",
"\n",
"if",
"a",
"!=",
"nil",
"{",
"answers",
"=",
"append",
"(",
"answers",
",",
"a",
")",
"\n",
"}",
"\n",
"<mask>",
"dns",
".",
"TypeSRV",
":",
"srv",
":=",
"ds",
".",
"GetSRV",
"(",
"question",
".",
"Name",
")",
"\n\n",
"if",
"srv",
"!=",
"nil",
"{",
"for",
"_",
",",
"record",
":=",
"range",
"srv",
"{",
"answers",
"=",
"append",
"(",
"answers",
",",
"record",
")",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n\n",
"// If we have no answers, that means we found nothing or didn't get a query",
"// we can reply to. Reply with no answers so we ensure the query moves on to",
"// the next server.",
"if",
"len",
"(",
"answers",
")",
"==",
"0",
"{",
"m",
".",
"SetRcode",
"(",
"r",
",",
"dns",
".",
"RcodeSuccess",
")",
"\n",
"w",
".",
"WriteMsg",
"(",
"m",
")",
"\n",
"return",
"\n",
"}",
"\n\n",
"// Without these the glibc resolver gets very angry.",
"m",
".",
"Authoritative",
"=",
"true",
"\n",
"m",
".",
"RecursionAvailable",
"=",
"true",
"\n",
"m",
".",
"Answer",
"=",
"answers",
"\n\n",
"w",
".",
"WriteMsg",
"(",
"m",
")",
"\n",
"}"
] |
4,549 | all-4550 | [
"SetBody",
"sets",
"the",
"body",
"of",
"the",
"message",
".",
"It",
"replaces",
"any",
"content",
"previously",
"set",
"by",
"SetBody",
"SetBodyWriter",
"AddAlternative",
"or",
"AddAlternativeWriter",
"."
] | [
"func",
"(",
"m",
"*",
"<mask>",
")",
"SetBody",
"(",
"contentType",
",",
"body",
"string",
",",
"settings",
"...",
"PartSetting",
")",
"{",
"m",
".",
"SetBodyWriter",
"(",
"contentType",
",",
"newCopier",
"(",
"body",
")",
",",
"settings",
"...",
")",
"\n",
"}"
] |
4,550 | all-4551 | [
"UnmarshalJSON",
"supports",
"json",
".",
"Unmarshaler",
"interface"
] | [
"func",
"(",
"v",
"*",
"HeaderEntry",
")",
"UnmarshalJSON",
"(",
"data",
"[",
"]",
"<mask>",
")",
"error",
"{",
"r",
":=",
"jlexer",
".",
"Lexer",
"{",
"Data",
":",
"data",
"}",
"\n",
"easyjsonC5a4559bDecodeGithubComChromedpCdprotoFetch3",
"(",
"&",
"r",
",",
"v",
")",
"\n",
"return",
"r",
".",
"Error",
"(",
")",
"\n",
"}"
] |
4,551 | all-4552 | [
"Create",
"a",
"worker",
"type",
".",
"A",
"worker",
"type",
"contains",
"all",
"the",
"configuration",
"needed",
"for",
"the",
"provisioner",
"to",
"manage",
"the",
"instances",
".",
"Each",
"worker",
"type",
"knows",
"which",
"regions",
"and",
"which",
"instance",
"types",
"are",
"allowed",
"for",
"that",
"worker",
"type",
".",
"Remember",
"that",
"Capacity",
"is",
"the",
"number",
"of",
"concurrent",
"tasks",
"that",
"can",
"be",
"run",
"on",
"a",
"given",
"EC2",
"resource",
"and",
"that",
"Utility",
"is",
"the",
"relative",
"performance",
"rate",
"between",
"different",
"instance",
"types",
".",
"There",
"is",
"no",
"way",
"to",
"configure",
"different",
"regions",
"to",
"have",
"different",
"sets",
"of",
"instance",
"types",
"so",
"ensure",
"that",
"all",
"instance",
"types",
"are",
"available",
"in",
"all",
"regions",
".",
"This",
"function",
"is",
"idempotent",
".",
"Once",
"a",
"worker",
"type",
"is",
"in",
"the",
"provisioner",
"a",
"back",
"ground",
"process",
"will",
"begin",
"creating",
"instances",
"for",
"it",
"based",
"on",
"its",
"capacity",
"bounds",
"and",
"its",
"pending",
"task",
"count",
"from",
"the",
"Queue",
".",
"It",
"is",
"the",
"worker",
"s",
"responsibility",
"to",
"shut",
"itself",
"down",
".",
"The",
"provisioner",
"has",
"a",
"limit",
"(",
"currently",
"96hours",
")",
"for",
"all",
"instances",
"to",
"prevent",
"zombie",
"instances",
"from",
"running",
"indefinitely",
".",
"The",
"provisioner",
"will",
"ensure",
"that",
"all",
"instances",
"created",
"are",
"tagged",
"with",
"aws",
"resource",
"tags",
"containing",
"the",
"provisioner",
"id",
"and",
"the",
"worker",
"type",
".",
"If",
"provided",
"the",
"secrets",
"in",
"the",
"global",
"region",
"and",
"instance",
"type",
"sections",
"are",
"available",
"using",
"the",
"secrets",
"api",
".",
"If",
"specified",
"the",
"scopes",
"provided",
"will",
"be",
"used",
"to",
"generate",
"a",
"set",
"of",
"temporary",
"credentials",
"available",
"with",
"the",
"other",
"secrets",
".",
"Required",
"scopes",
":",
"aws",
"-",
"provisioner",
":",
"manage",
"-",
"worker",
"-",
"type",
":",
"<workerType",
">",
"See",
"https",
":",
"//",
"docs",
".",
"taskcluster",
".",
"net",
"/",
"reference",
"/",
"core",
"/",
"aws",
"-",
"provisioner",
"/",
"api",
"-",
"docs#createWorkerType"
] | [
"func",
"(",
"awsProvisioner",
"*",
"AwsProvisioner",
")",
"CreateWorkerType",
"(",
"workerType",
"string",
",",
"payload",
"*",
"CreateWorkerTypeRequest",
")",
"(",
"*",
"WorkerTypeResponse",
",",
"error",
")",
"{",
"<mask>",
":=",
"tcclient",
".",
"Client",
"(",
"*",
"awsProvisioner",
")",
"\n",
"responseObject",
",",
"_",
",",
"err",
":=",
"(",
"&",
"cd",
")",
".",
"APICall",
"(",
"payload",
",",
"\"",
"\"",
",",
"\"",
"\"",
"+",
"url",
".",
"QueryEscape",
"(",
"workerType",
")",
",",
"new",
"(",
"WorkerTypeResponse",
")",
",",
"nil",
")",
"\n",
"return",
"responseObject",
".",
"(",
"*",
"WorkerTypeResponse",
")",
",",
"err",
"\n",
"}"
] |
4,552 | all-4553 | [
"NeighborIntWithPrecision",
"returns",
"a",
"uint64s",
"that",
"corresponds",
"to",
"the",
"provided",
"hash",
"s",
"neighbor",
"in",
"the",
"provided",
"direction",
"at",
"the",
"given",
"precision",
"."
] | [
"func",
"NeighborIntWithPrecision",
"(",
"hash",
"uint64",
",",
"<mask>",
"uint",
",",
"direction",
"Direction",
")",
"uint64",
"{",
"return",
"NeighborsIntWithPrecision",
"(",
"hash",
",",
"bits",
")",
"[",
"direction",
"]",
"\n",
"}"
] |
4,553 | all-4554 | [
"Errorf",
"is",
"like",
"Printf",
"but",
"it",
"marks",
"this",
"event",
"as",
"an",
"error",
"."
] | [
"func",
"(",
"e",
"*",
"EventLog",
")",
"Errorf",
"(",
"format",
"string",
",",
"a",
"...",
"interface",
"{",
"}",
")",
"{",
"<mask>",
".",
"Printf",
"(",
"\"",
"\"",
"+",
"format",
",",
"a",
"...",
")",
"\n",
"e",
".",
"el",
".",
"Errorf",
"(",
"format",
",",
"a",
"...",
")",
"\n",
"}"
] |
4,554 | all-4555 | [
"List",
"function",
"return",
"a",
"slice",
"of",
"nodes",
"under",
"the",
"receiver",
"node",
".",
"If",
"the",
"receiver",
"node",
"is",
"not",
"a",
"directory",
"a",
"Not",
"A",
"Directory",
"error",
"will",
"be",
"returned",
"."
] | [
"func",
"(",
"n",
"*",
"node",
")",
"List",
"(",
")",
"(",
"[",
"]",
"*",
"<mask>",
",",
"*",
"v2error",
".",
"Error",
")",
"{",
"if",
"!",
"n",
".",
"IsDir",
"(",
")",
"{",
"return",
"nil",
",",
"v2error",
".",
"NewError",
"(",
"v2error",
".",
"EcodeNotDir",
",",
"\"",
"\"",
",",
"n",
".",
"store",
".",
"CurrentIndex",
")",
"\n",
"}",
"\n\n",
"nodes",
":=",
"make",
"(",
"[",
"]",
"*",
"node",
",",
"len",
"(",
"n",
".",
"Children",
")",
")",
"\n\n",
"i",
":=",
"0",
"\n",
"for",
"_",
",",
"node",
":=",
"range",
"n",
".",
"Children",
"{",
"nodes",
"[",
"i",
"]",
"=",
"node",
"\n",
"i",
"++",
"\n",
"}",
"\n\n",
"return",
"nodes",
",",
"nil",
"\n",
"}"
] |
4,555 | all-4556 | [
"Purpose",
"of",
"BytesTwo",
"()",
"and",
"AdvanceBytesTwo",
"()",
":",
"avoid",
"extra",
"copying",
"of",
"data",
".",
"AdvanceBytesTwo",
"()",
"takes",
"a",
"TwoBuffers",
"as",
"input",
"this",
"must",
"have",
"been",
"from",
"a",
"previous",
"call",
"to",
"BytesTwo",
"()",
";",
"no",
"intervening",
"calls",
"to",
"Bytes",
"()",
"or",
"Adopt",
"()",
"are",
"allowed",
"(",
"or",
"any",
"other",
"future",
"routine",
"or",
"client",
"data",
"access",
"that",
"changes",
"the",
"internal",
"data",
"location",
"or",
"contents",
")",
"can",
"have",
"been",
"made",
".",
"After",
"sanity",
"checks",
"AdvanceBytesTwo",
"()",
"advances",
"the",
"internal",
"buffer",
"effectively",
"calling",
"Advance",
"(",
"len",
"(",
"tb",
".",
"First",
")",
"+",
"len",
"(",
"tb",
".",
"Second",
"))",
".",
"If",
"intervening",
"-",
"calls",
"that",
"changed",
"the",
"buffers",
"(",
"other",
"than",
"appending",
"data",
"to",
"the",
"buffer",
")",
"are",
"detected",
"we",
"will",
"panic",
"as",
"a",
"safety",
"/",
"sanity",
"/",
"aid",
"-",
"to",
"-",
"debugging",
"measure",
"."
] | [
"func",
"(",
"b",
"*",
"AtomicFixedSizeRingBuf",
")",
"AdvanceBytesTwo",
"(",
"tb",
"TwoBuffers",
")",
"{",
"b",
".",
"tex",
".",
"Lock",
"(",
")",
"\n",
"defer",
"b",
".",
"tex",
".",
"Unlock",
"(",
")",
"\n\n",
"tblen",
":=",
"len",
"(",
"tb",
".",
"First",
")",
"+",
"len",
"(",
"tb",
".",
"Second",
")",
"\n\n",
"if",
"tblen",
"==",
"0",
"{",
"return",
"// nothing to do",
"\n",
"}",
"\n\n",
"// sanity check: insure we have re-located in the meantime",
"if",
"tblen",
">",
"b",
".",
"readable",
"{",
"panic",
"(",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"tblen",
",",
"b",
".",
"readable",
")",
")",
"\n",
"}",
"\n\n",
"tbnow",
":=",
"b",
".",
"unatomic_BytesTwo",
"(",
")",
"\n\n",
"if",
"len",
"(",
"tb",
".",
"First",
")",
">",
"0",
"{",
"if",
"tb",
".",
"First",
"[",
"0",
"]",
"!=",
"tbnow",
".",
"First",
"[",
"0",
"]",
"{",
"panic",
"(",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"string",
"(",
"tb",
".",
"First",
")",
",",
"<mask>",
"(",
"tbnow",
".",
"First",
")",
")",
")",
"\n",
"}",
"\n",
"}",
"\n",
"if",
"len",
"(",
"tb",
".",
"Second",
")",
">",
"0",
"{",
"if",
"len",
"(",
"tb",
".",
"First",
")",
">",
"len",
"(",
"tbnow",
".",
"First",
")",
"{",
"panic",
"(",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"len",
"(",
"tbnow",
".",
"First",
")",
",",
"len",
"(",
"tb",
".",
"First",
")",
")",
")",
"\n",
"}",
"\n",
"if",
"len",
"(",
"tbnow",
".",
"Second",
")",
"==",
"0",
"{",
"panic",
"(",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
")",
")",
"\n",
"}",
"\n",
"if",
"tb",
".",
"Second",
"[",
"0",
"]",
"!=",
"tbnow",
".",
"Second",
"[",
"0",
"]",
"{",
"panic",
"(",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"string",
"(",
"tb",
".",
"Second",
")",
",",
"string",
"(",
"tbnow",
".",
"Second",
")",
")",
")",
"\n",
"}",
"\n",
"}",
"\n\n",
"b",
".",
"unatomic_advance",
"(",
"tblen",
")",
"\n",
"}"
] |
4,556 | all-4557 | [
"AppendEntries",
"is",
"used",
"to",
"add",
"another",
"request",
"to",
"the",
"pipeline",
".",
"The",
"send",
"may",
"block",
"which",
"is",
"an",
"effective",
"form",
"of",
"back",
"-",
"pressure",
"."
] | [
"func",
"(",
"p",
"*",
"pipeline",
")",
"AppendEntries",
"(",
"args",
"*",
"raft",
".",
"AppendEntriesRequest",
",",
"resp",
"*",
"raft",
".",
"AppendEntriesResponse",
")",
"(",
"raft",
".",
"AppendFuture",
",",
"error",
")",
"{",
"e",
":=",
"&",
"appendEntry",
"{",
"req",
":",
"args",
",",
"res",
":",
"resp",
",",
"start",
":",
"time",
".",
"Now",
"(",
")",
",",
"ready",
":",
"make",
"(",
"chan",
"error",
")",
",",
"consumer",
":",
"p",
".",
"consumer",
",",
"}",
"\n",
"p",
".",
"<mask>",
"<-",
"e",
"\n",
"return",
"e",
",",
"nil",
"\n",
"}"
] |
4,557 | all-4558 | [
"Do",
"executes",
"Runtime",
".",
"terminateExecution",
"against",
"the",
"provided",
"context",
"."
] | [
"func",
"(",
"p",
"*",
"TerminateExecutionParams",
")",
"Do",
"(",
"ctx",
"<mask>",
".",
"Context",
")",
"(",
"err",
"error",
")",
"{",
"return",
"cdp",
".",
"Execute",
"(",
"ctx",
",",
"CommandTerminateExecution",
",",
"nil",
",",
"nil",
")",
"\n",
"}"
] |
4,558 | all-4559 | [
"GetAliasNameOk",
"returns",
"a",
"tuple",
"with",
"the",
"AliasName",
"field",
"if",
"it",
"s",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"and",
"a",
"boolean",
"to",
"check",
"if",
"the",
"value",
"has",
"been",
"set",
"."
] | [
"func",
"(",
"w",
"*",
"WidgetMetadata",
")",
"GetAliasNameOk",
"(",
")",
"(",
"string",
",",
"bool",
")",
"{",
"if",
"w",
"==",
"nil",
"||",
"w",
".",
"AliasName",
"==",
"nil",
"{",
"return",
"\"",
"\"",
",",
"<mask>",
"\n",
"}",
"\n",
"return",
"*",
"w",
".",
"AliasName",
",",
"true",
"\n",
"}"
] |
4,559 | all-4560 | [
"check",
"the",
"completeness",
"status",
"of",
"a",
"framebuffer"
] | [
"func",
"CheckNamedFramebufferStatus",
"(",
"framebuffer",
"uint32",
",",
"target",
"uint32",
")",
"uint32",
"{",
"ret",
",",
"_",
",",
"_",
":=",
"syscall",
".",
"Syscall",
"(",
"gpCheckNamedFramebufferStatus",
",",
"2",
",",
"uintptr",
"(",
"framebuffer",
")",
",",
"uintptr",
"(",
"target",
")",
",",
"0",
")",
"\n",
"return",
"(",
"uint32",
")",
"(",
"<mask>",
")",
"\n",
"}"
] |
4,560 | all-4561 | [
"return",
"length",
"in",
"bytes",
"for",
"regular",
"files"
] | [
"func",
"fileSize",
"(",
"file",
"string",
")",
"int64",
"{",
"f",
",",
"e",
":=",
"os",
".",
"Stat",
"(",
"<mask>",
")",
"\n",
"if",
"e",
"!=",
"nil",
"{",
"return",
"0",
"\n",
"}",
"\n\n",
"return",
"f",
".",
"Size",
"(",
")",
"\n",
"}"
] |
4,561 | all-4562 | [
"UnmarshalText",
"hydrates",
"this",
"instance",
"from",
"text"
] | [
"func",
"(",
"u",
"*",
"SSN",
")",
"UnmarshalText",
"(",
"data",
"[",
"]",
"byte",
")",
"error",
"{",
"// validation is performed later on",
"*",
"u",
"=",
"SSN",
"(",
"string",
"(",
"<mask>",
")",
")",
"\n",
"return",
"nil",
"\n",
"}"
] |
4,562 | all-4563 | [
"Returns",
"information",
"about",
"an",
"active",
"uniform",
"variable",
"for",
"the",
"specified",
"program",
"object"
] | [
"func",
"GetActiveUniform",
"(",
"program",
"uint32",
",",
"index",
"uint32",
",",
"bufSize",
"int32",
",",
"length",
"*",
"int32",
",",
"size",
"*",
"int32",
",",
"xtype",
"*",
"uint32",
",",
"name",
"*",
"uint8",
")",
"{",
"C",
".",
"glowGetActiveUniform",
"(",
"gpGetActiveUniform",
",",
"(",
"C",
".",
"GLuint",
")",
"(",
"program",
")",
",",
"(",
"C",
".",
"GLuint",
")",
"(",
"index",
")",
",",
"(",
"C",
".",
"GLsizei",
")",
"(",
"bufSize",
")",
",",
"(",
"*",
"C",
".",
"GLsizei",
")",
"(",
"unsafe",
".",
"Pointer",
"(",
"<mask>",
")",
")",
",",
"(",
"*",
"C",
".",
"GLint",
")",
"(",
"unsafe",
".",
"Pointer",
"(",
"size",
")",
")",
",",
"(",
"*",
"C",
".",
"GLenum",
")",
"(",
"unsafe",
".",
"Pointer",
"(",
"xtype",
")",
")",
",",
"(",
"*",
"C",
".",
"GLchar",
")",
"(",
"unsafe",
".",
"Pointer",
"(",
"name",
")",
")",
")",
"\n",
"}"
] |
4,563 | all-4564 | [
"SetHostBytes",
"sets",
"host",
"for",
"the",
"uri",
"."
] | [
"func",
"(",
"u",
"*",
"URI",
")",
"SetHostBytes",
"(",
"<mask>",
"[",
"]",
"byte",
")",
"{",
"u",
".",
"host",
"=",
"append",
"(",
"u",
".",
"host",
"[",
":",
"0",
"]",
",",
"host",
"...",
")",
"\n",
"lowercaseBytes",
"(",
"u",
".",
"host",
")",
"\n",
"}"
] |
4,564 | all-4565 | [
"PSCAddress",
"returns",
"Privatix",
"service",
"contract",
"address",
"."
] | [
"func",
"(",
"b",
"*",
"backendInstance",
")",
"PSCAddress",
"(",
")",
"common",
".",
"<mask>",
"{",
"return",
"common",
".",
"HexToAddress",
"(",
"b",
".",
"cfg",
".",
"Contract",
".",
"PSCAddrHex",
")",
"\n",
"}"
] |
4,565 | all-4566 | [
"HasQuery",
"returns",
"a",
"boolean",
"if",
"a",
"field",
"has",
"been",
"set",
"."
] | [
"func",
"(",
"g",
"*",
"GraphDefinitionRequest",
")",
"HasQuery",
"(",
")",
"bool",
"{",
"if",
"g",
"!=",
"nil",
"&&",
"g",
".",
"Query",
"!=",
"nil",
"{",
"return",
"true",
"\n",
"}",
"\n\n",
"return",
"<mask>",
"\n",
"}"
] |
4,566 | all-4567 | [
"Stability",
":",
"***",
"EXPERIMENTAL",
"***",
"For",
"a",
"given",
"changeset",
"(",
"SHA",
")",
"of",
"a",
"repository",
"this",
"will",
"attach",
"a",
"commit",
"status",
"on",
"github",
".",
"These",
"statuses",
"are",
"links",
"displayed",
"next",
"to",
"each",
"revision",
".",
"The",
"status",
"is",
"either",
"OK",
"(",
"green",
"check",
")",
"or",
"FAILURE",
"(",
"red",
"cross",
")",
"made",
"of",
"a",
"custom",
"title",
"and",
"link",
".",
"Required",
"scopes",
":",
"github",
":",
"create",
"-",
"status",
":",
"<owner",
">",
"/",
"<repo",
">",
"See",
"#createStatus"
] | [
"func",
"(",
"github",
"*",
"Github",
")",
"CreateStatus",
"(",
"owner",
",",
"repo",
",",
"sha",
"string",
",",
"payload",
"*",
"CreateStatusRequest",
")",
"error",
"{",
"cd",
":=",
"tcclient",
".",
"Client",
"(",
"*",
"github",
")",
"\n",
"_",
",",
"_",
",",
"err",
":=",
"(",
"&",
"cd",
")",
".",
"APICall",
"(",
"payload",
",",
"\"",
"\"",
",",
"\"",
"\"",
"+",
"url",
".",
"QueryEscape",
"(",
"owner",
")",
"+",
"\"",
"\"",
"+",
"<mask>",
".",
"QueryEscape",
"(",
"repo",
")",
"+",
"\"",
"\"",
"+",
"url",
".",
"QueryEscape",
"(",
"sha",
")",
",",
"nil",
",",
"nil",
")",
"\n",
"return",
"err",
"\n",
"}"
] |
4,567 | all-4568 | [
"getSize",
"must",
"be",
"called",
"from",
"the",
"main",
"thread",
"."
] | [
"func",
"(",
"u",
"*",
"UserInterface",
")",
"glfwSize",
"(",
")",
"(",
"int",
",",
"int",
")",
"{",
"w",
":=",
"int",
"(",
"float64",
"(",
"u",
".",
"windowWidth",
")",
"*",
"u",
".",
"getScale",
"(",
")",
"*",
"u",
".",
"glfwScale",
"(",
")",
")",
"\n",
"h",
":=",
"int",
"(",
"float64",
"(",
"u",
".",
"<mask>",
")",
"*",
"u",
".",
"getScale",
"(",
")",
"*",
"u",
".",
"glfwScale",
"(",
")",
")",
"\n",
"return",
"w",
",",
"h",
"\n",
"}"
] |
4,568 | all-4569 | [
"ValidatePayload",
"ensures",
"that",
"the",
"request",
"payload",
"signature",
"matches",
"the",
"key",
"."
] | [
"func",
"ValidatePayload",
"(",
"payload",
"[",
"]",
"byte",
",",
"sig",
"string",
",",
"key",
"[",
"]",
"byte",
")",
"bool",
"{",
"if",
"!",
"strings",
".",
"HasPrefix",
"(",
"sig",
",",
"\"",
"\"",
")",
"{",
"return",
"false",
"\n",
"}",
"\n",
"sig",
"=",
"sig",
"[",
"5",
":",
"]",
"\n",
"sb",
",",
"err",
":=",
"hex",
".",
"DecodeString",
"(",
"sig",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"false",
"\n",
"}",
"\n",
"mac",
":=",
"hmac",
".",
"New",
"(",
"sha1",
".",
"New",
",",
"key",
")",
"\n",
"<mask>",
".",
"Write",
"(",
"payload",
")",
"\n",
"expected",
":=",
"mac",
".",
"Sum",
"(",
"nil",
")",
"\n",
"return",
"hmac",
".",
"Equal",
"(",
"sb",
",",
"expected",
")",
"\n",
"}"
] |
4,569 | all-4570 | [
"ParseByteRange",
"parses",
"Range",
":",
"bytes",
"=",
"...",
"header",
"value",
".",
"It",
"follows",
"https",
":",
"//",
"www",
".",
"w3",
".",
"org",
"/",
"Protocols",
"/",
"rfc2616",
"/",
"rfc2616",
"-",
"sec14",
".",
"html#sec14",
".",
"35",
"."
] | [
"func",
"ParseByteRange",
"(",
"byteRange",
"[",
"]",
"byte",
",",
"contentLength",
"int",
")",
"(",
"startPos",
",",
"endPos",
"int",
",",
"err",
"error",
")",
"{",
"b",
":=",
"byteRange",
"\n",
"if",
"!",
"bytes",
".",
"HasPrefix",
"(",
"b",
",",
"strBytes",
")",
"{",
"return",
"0",
",",
"0",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"byteRange",
",",
"strBytes",
")",
"\n",
"}",
"\n\n",
"b",
"=",
"b",
"[",
"len",
"(",
"strBytes",
")",
":",
"]",
"\n",
"if",
"len",
"(",
"b",
")",
"==",
"0",
"||",
"b",
"[",
"0",
"]",
"!=",
"'='",
"{",
"return",
"0",
",",
"0",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"byteRange",
")",
"\n",
"}",
"\n",
"b",
"=",
"b",
"[",
"1",
":",
"]",
"\n\n",
"n",
":=",
"<mask>",
".",
"IndexByte",
"(",
"b",
",",
"'-'",
")",
"\n",
"if",
"n",
"<",
"0",
"{",
"return",
"0",
",",
"0",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"byteRange",
")",
"\n",
"}",
"\n\n",
"if",
"n",
"==",
"0",
"{",
"v",
",",
"err",
":=",
"ParseUint",
"(",
"b",
"[",
"n",
"+",
"1",
":",
"]",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"0",
",",
"0",
",",
"err",
"\n",
"}",
"\n",
"startPos",
":=",
"contentLength",
"-",
"v",
"\n",
"if",
"startPos",
"<",
"0",
"{",
"startPos",
"=",
"0",
"\n",
"}",
"\n",
"return",
"startPos",
",",
"contentLength",
"-",
"1",
",",
"nil",
"\n",
"}",
"\n\n",
"if",
"startPos",
",",
"err",
"=",
"ParseUint",
"(",
"b",
"[",
":",
"n",
"]",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"0",
",",
"0",
",",
"err",
"\n",
"}",
"\n",
"if",
"startPos",
">=",
"contentLength",
"{",
"return",
"0",
",",
"0",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"contentLength",
"-",
"1",
",",
"byteRange",
")",
"\n",
"}",
"\n\n",
"b",
"=",
"b",
"[",
"n",
"+",
"1",
":",
"]",
"\n",
"if",
"len",
"(",
"b",
")",
"==",
"0",
"{",
"return",
"startPos",
",",
"contentLength",
"-",
"1",
",",
"nil",
"\n",
"}",
"\n\n",
"if",
"endPos",
",",
"err",
"=",
"ParseUint",
"(",
"b",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"0",
",",
"0",
",",
"err",
"\n",
"}",
"\n",
"if",
"endPos",
">=",
"contentLength",
"{",
"endPos",
"=",
"contentLength",
"-",
"1",
"\n",
"}",
"\n",
"if",
"endPos",
"<",
"startPos",
"{",
"return",
"0",
",",
"0",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"byteRange",
")",
"\n",
"}",
"\n",
"return",
"startPos",
",",
"endPos",
",",
"nil",
"\n",
"}"
] |
4,570 | all-4571 | [
"Get",
"()",
"is",
"a",
"wrapper",
"around",
"gtk_print_settings_get",
"()",
"."
] | [
"func",
"(",
"ps",
"*",
"PrintSettings",
")",
"Get",
"(",
"key",
"string",
")",
"string",
"{",
"cstr",
":=",
"C",
".",
"CString",
"(",
"key",
")",
"\n",
"defer",
"C",
".",
"<mask>",
"(",
"unsafe",
".",
"Pointer",
"(",
"cstr",
")",
")",
"\n",
"c",
":=",
"C",
".",
"gtk_print_settings_get",
"(",
"ps",
".",
"native",
"(",
")",
",",
"(",
"*",
"C",
".",
"gchar",
")",
"(",
"cstr",
")",
")",
"\n",
"return",
"C",
".",
"GoString",
"(",
"(",
"*",
"C",
".",
"char",
")",
"(",
"c",
")",
")",
"\n",
"}"
] |
4,571 | all-4572 | [
"DrawingAreaNew",
"is",
"a",
"wrapper",
"around",
"gtk_drawing_area_new",
"()",
"."
] | [
"func",
"DrawingAreaNew",
"(",
")",
"(",
"*",
"DrawingArea",
",",
"<mask>",
")",
"{",
"c",
":=",
"C",
".",
"gtk_drawing_area_new",
"(",
")",
"\n",
"if",
"c",
"==",
"nil",
"{",
"return",
"nil",
",",
"nilPtrErr",
"\n",
"}",
"\n",
"obj",
":=",
"glib",
".",
"Take",
"(",
"unsafe",
".",
"Pointer",
"(",
"c",
")",
")",
"\n",
"return",
"wrapDrawingArea",
"(",
"obj",
")",
",",
"nil",
"\n",
"}"
] |
4,572 | all-4573 | [
"Reader",
"returns",
"the",
"io",
".",
"Reader",
"instance",
"for",
"the",
"file",
"source"
] | [
"func",
"(",
"s",
"*",
"FileSource",
")",
"Reader",
"(",
")",
"(",
"io",
".",
"Reader",
",",
"error",
")",
"{",
"fh",
",",
"err",
":=",
"os",
".",
"Open",
"(",
"s",
".",
"<mask>",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"return",
"fh",
",",
"nil",
"\n",
"}"
] |
4,573 | all-4574 | [
"QueryRange",
"performs",
"a",
"range",
"query",
"against",
"a",
"Prometheus",
"server",
"."
] | [
"func",
"QueryRange",
"(",
"<mask>",
",",
"query",
",",
"start",
",",
"end",
"string",
",",
"step",
"time",
".",
"Duration",
",",
"p",
"printer",
")",
"int",
"{",
"config",
":=",
"api",
".",
"Config",
"{",
"Address",
":",
"url",
",",
"}",
"\n\n",
"// Create new client.",
"c",
",",
"err",
":=",
"api",
".",
"NewClient",
"(",
"config",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"fmt",
".",
"Fprintln",
"(",
"os",
".",
"Stderr",
",",
"\"",
"\"",
",",
"err",
")",
"\n",
"return",
"1",
"\n",
"}",
"\n\n",
"var",
"stime",
",",
"etime",
"time",
".",
"Time",
"\n\n",
"if",
"end",
"==",
"\"",
"\"",
"{",
"etime",
"=",
"time",
".",
"Now",
"(",
")",
"\n",
"}",
"else",
"{",
"etime",
",",
"err",
"=",
"parseTime",
"(",
"end",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"fmt",
".",
"Fprintln",
"(",
"os",
".",
"Stderr",
",",
"\"",
"\"",
",",
"err",
")",
"\n",
"return",
"1",
"\n",
"}",
"\n",
"}",
"\n\n",
"if",
"start",
"==",
"\"",
"\"",
"{",
"stime",
"=",
"etime",
".",
"Add",
"(",
"-",
"5",
"*",
"time",
".",
"Minute",
")",
"\n",
"}",
"else",
"{",
"stime",
",",
"err",
"=",
"parseTime",
"(",
"start",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"fmt",
".",
"Fprintln",
"(",
"os",
".",
"Stderr",
",",
"\"",
"\"",
",",
"err",
")",
"\n",
"}",
"\n",
"}",
"\n\n",
"if",
"!",
"stime",
".",
"Before",
"(",
"etime",
")",
"{",
"fmt",
".",
"Fprintln",
"(",
"os",
".",
"Stderr",
",",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"if",
"step",
"==",
"0",
"{",
"resolution",
":=",
"math",
".",
"Max",
"(",
"math",
".",
"Floor",
"(",
"etime",
".",
"Sub",
"(",
"stime",
")",
".",
"Seconds",
"(",
")",
"/",
"250",
")",
",",
"1",
")",
"\n",
"// Convert seconds to nanoseconds such that time.Duration parses correctly.",
"step",
"=",
"time",
".",
"Duration",
"(",
"resolution",
")",
"*",
"time",
".",
"Second",
"\n",
"}",
"\n\n",
"// Run query against client.",
"api",
":=",
"v1",
".",
"NewAPI",
"(",
"c",
")",
"\n",
"r",
":=",
"v1",
".",
"Range",
"{",
"Start",
":",
"stime",
",",
"End",
":",
"etime",
",",
"Step",
":",
"step",
"}",
"\n",
"ctx",
",",
"cancel",
":=",
"context",
".",
"WithTimeout",
"(",
"context",
".",
"Background",
"(",
")",
",",
"2",
"*",
"time",
".",
"Minute",
")",
"\n",
"val",
",",
"err",
":=",
"api",
".",
"QueryRange",
"(",
"ctx",
",",
"query",
",",
"r",
")",
"\n",
"cancel",
"(",
")",
"\n\n",
"if",
"err",
"!=",
"nil",
"{",
"fmt",
".",
"Fprintln",
"(",
"os",
".",
"Stderr",
",",
"\"",
"\"",
",",
"err",
")",
"\n",
"return",
"1",
"\n",
"}",
"\n\n",
"p",
".",
"printValue",
"(",
"val",
")",
"\n",
"return",
"0",
"\n",
"}"
] |
4,574 | all-4575 | [
"Read",
"is",
"implementation",
"of",
"ReadSeekCloser",
"s",
"Read",
"."
] | [
"func",
"(",
"i",
"*",
"InfiniteLoop",
")",
"Read",
"(",
"b",
"[",
"]",
"byte",
")",
"(",
"int",
",",
"error",
")",
"{",
"if",
"err",
":=",
"i",
".",
"ensurePos",
"(",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"0",
",",
"err",
"\n",
"}",
"\n\n",
"if",
"i",
".",
"pos",
"+",
"int64",
"(",
"len",
"(",
"b",
")",
")",
">",
"i",
".",
"length",
"(",
")",
"{",
"b",
"=",
"b",
"[",
":",
"i",
".",
"length",
"(",
")",
"-",
"i",
".",
"pos",
"]",
"\n",
"}",
"\n\n",
"n",
",",
"err",
":=",
"i",
".",
"src",
".",
"Read",
"(",
"b",
")",
"\n",
"i",
".",
"pos",
"+=",
"int64",
"(",
"n",
")",
"\n",
"if",
"i",
".",
"pos",
">",
"i",
".",
"length",
"(",
")",
"{",
"panic",
"(",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"i",
".",
"pos",
",",
"i",
".",
"length",
"(",
")",
")",
")",
"\n",
"}",
"\n\n",
"if",
"err",
"!=",
"nil",
"&&",
"err",
"!=",
"io",
".",
"EOF",
"{",
"return",
"0",
",",
"err",
"\n",
"}",
"\n\n",
"if",
"err",
"==",
"io",
".",
"EOF",
"||",
"i",
".",
"pos",
"==",
"i",
".",
"<mask>",
"(",
")",
"{",
"pos",
",",
"err",
":=",
"i",
".",
"Seek",
"(",
"i",
".",
"lstart",
",",
"io",
".",
"SeekStart",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"0",
",",
"err",
"\n",
"}",
"\n",
"i",
".",
"pos",
"=",
"pos",
"\n",
"}",
"\n",
"return",
"n",
",",
"nil",
"\n",
"}"
] |
4,575 | all-4576 | [
"Remove",
"removes",
"a",
"RangerEntry",
"identified",
"by",
"given",
"network",
"from",
"ranger",
"."
] | [
"func",
"(",
"b",
"*",
"bruteRanger",
")",
"Remove",
"(",
"network",
"net",
".",
"IPNet",
")",
"(",
"RangerEntry",
",",
"error",
")",
"{",
"networks",
",",
"err",
":=",
"b",
".",
"getEntriesByVersion",
"(",
"network",
".",
"IP",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"key",
":=",
"<mask>",
".",
"String",
"(",
")",
"\n",
"if",
"networkToDelete",
",",
"found",
":=",
"networks",
"[",
"key",
"]",
";",
"found",
"{",
"delete",
"(",
"networks",
",",
"key",
")",
"\n",
"return",
"networkToDelete",
",",
"nil",
"\n",
"}",
"\n",
"return",
"nil",
",",
"nil",
"\n",
"}"
] |
4,576 | all-4577 | [
"Pop",
"removes",
"an",
"element",
"from",
"the",
"front",
"of",
"the",
"queue",
"."
] | [
"func",
"(",
"queue",
"*",
"queue",
")",
"Pop",
"(",
")",
"interface",
"{",
"}",
"{",
"if",
"queue",
".",
"size",
"==",
"0",
"{",
"return",
"nil",
"\n",
"}",
"\n\n",
"if",
"queue",
".",
"size",
"<",
"<mask>",
".",
"cap",
"/",
"4",
"&&",
"queue",
".",
"size",
">",
"4",
"{",
"queue",
".",
"resize",
"(",
"queue",
".",
"cap",
"/",
"2",
")",
"\n",
"}",
"\n\n",
"result",
":=",
"queue",
".",
"elements",
"[",
"queue",
".",
"start",
"%",
"int64",
"(",
"queue",
".",
"cap",
")",
"]",
"\n",
"queue",
".",
"start",
"++",
"\n",
"queue",
".",
"size",
"--",
"\n\n",
"return",
"result",
"\n",
"}"
] |
4,577 | all-4578 | [
"SetUnitStatus",
"changes",
"the",
"status",
"of",
"the",
"given",
"unit",
"."
] | [
"func",
"(",
"app",
"*",
"App",
")",
"SetUnitStatus",
"(",
"unitName",
"string",
",",
"<mask>",
"provision",
".",
"Status",
")",
"error",
"{",
"units",
",",
"err",
":=",
"app",
".",
"Units",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"for",
"_",
",",
"unit",
":=",
"range",
"units",
"{",
"if",
"strings",
".",
"HasPrefix",
"(",
"unit",
".",
"ID",
",",
"unitName",
")",
"{",
"prov",
",",
"err",
":=",
"app",
".",
"getProvisioner",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"unitProv",
",",
"ok",
":=",
"prov",
".",
"(",
"provision",
".",
"UnitStatusProvisioner",
")",
"\n",
"if",
"!",
"ok",
"{",
"return",
"nil",
"\n",
"}",
"\n",
"return",
"unitProv",
".",
"SetUnitStatus",
"(",
"unit",
",",
"status",
")",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"&",
"provision",
".",
"UnitNotFoundError",
"{",
"ID",
":",
"unitName",
"}",
"\n",
"}"
] |
4,578 | all-4579 | [
"HTTPPostJSON",
"marshalles",
"data",
"as",
"JSON",
"and",
"sends",
"it",
"as",
"HTTP",
"POST",
"request",
"to",
"url",
".",
"If",
"the",
"response",
"status",
"code",
"is",
"not",
"200",
"OK",
"then",
"the",
"status",
"is",
"returned",
"as",
"an",
"error",
"."
] | [
"func",
"HTTPPostJSON",
"(",
"url",
"string",
",",
"data",
"interface",
"{",
"}",
")",
"error",
"{",
"b",
",",
"err",
":=",
"json",
".",
"MarshalIndent",
"(",
"data",
",",
"\"",
"\"",
",",
"\"",
"\"",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"response",
",",
"err",
":=",
"http",
".",
"Post",
"(",
"<mask>",
",",
"\"",
"\"",
",",
"bytes",
".",
"NewBuffer",
"(",
"b",
")",
")",
"\n",
"if",
"err",
"==",
"nil",
"&&",
"(",
"response",
".",
"StatusCode",
"<",
"200",
"||",
"response",
".",
"StatusCode",
">",
"299",
")",
"{",
"err",
"=",
"errors",
".",
"New",
"(",
"response",
".",
"Status",
")",
"\n",
"}",
"\n",
"return",
"err",
"\n",
"}"
] |
4,579 | all-4580 | [
"ForEachReversePtr",
"calls",
"fn",
"for",
"all",
"pointers",
"it",
"finds",
"pointing",
"to",
"y",
".",
"It",
"calls",
"fn",
"with",
":",
"the",
"object",
"or",
"root",
"which",
"points",
"to",
"y",
"(",
"exactly",
"one",
"will",
"be",
"non",
"-",
"nil",
")",
"the",
"offset",
"i",
"in",
"that",
"object",
"or",
"root",
"where",
"the",
"pointer",
"appears",
".",
"the",
"offset",
"j",
"in",
"y",
"where",
"the",
"pointer",
"points",
".",
"If",
"fn",
"returns",
"false",
"ForEachReversePtr",
"returns",
"immediately",
"."
] | [
"func",
"(",
"p",
"*",
"Process",
")",
"ForEachReversePtr",
"(",
"y",
"Object",
",",
"fn",
"func",
"(",
"x",
"<mask>",
",",
"r",
"*",
"Root",
",",
"i",
",",
"j",
"int64",
")",
"bool",
")",
"{",
"p",
".",
"reverseEdges",
"(",
")",
"\n\n",
"idx",
",",
"_",
":=",
"p",
".",
"findObjectIndex",
"(",
"p",
".",
"Addr",
"(",
"y",
")",
")",
"\n",
"for",
"_",
",",
"a",
":=",
"range",
"p",
".",
"redge",
"[",
"p",
".",
"ridx",
"[",
"idx",
"]",
":",
"p",
".",
"ridx",
"[",
"idx",
"+",
"1",
"]",
"]",
"{",
"// Read pointer, compute offset in y.",
"ptr",
":=",
"p",
".",
"proc",
".",
"ReadPtr",
"(",
"a",
")",
"\n",
"j",
":=",
"ptr",
".",
"Sub",
"(",
"p",
".",
"Addr",
"(",
"y",
")",
")",
"\n\n",
"// Find source of pointer.",
"x",
",",
"i",
":=",
"p",
".",
"FindObject",
"(",
"a",
")",
"\n",
"if",
"x",
"!=",
"0",
"{",
"// Source is an object.",
"if",
"!",
"fn",
"(",
"x",
",",
"nil",
",",
"i",
",",
"j",
")",
"{",
"return",
"\n",
"}",
"\n",
"continue",
"\n",
"}",
"\n",
"// Source is a root.",
"k",
":=",
"sort",
".",
"Search",
"(",
"len",
"(",
"p",
".",
"rootIdx",
")",
",",
"func",
"(",
"k",
"int",
")",
"bool",
"{",
"r",
":=",
"p",
".",
"rootIdx",
"[",
"k",
"]",
"\n",
"return",
"a",
"<",
"r",
".",
"Addr",
".",
"Add",
"(",
"r",
".",
"Type",
".",
"Size",
")",
"\n",
"}",
")",
"\n",
"r",
":=",
"p",
".",
"rootIdx",
"[",
"k",
"]",
"\n",
"if",
"!",
"fn",
"(",
"0",
",",
"r",
",",
"a",
".",
"Sub",
"(",
"r",
".",
"Addr",
")",
",",
"j",
")",
"{",
"return",
"\n",
"}",
"\n",
"}",
"\n",
"}"
] |
4,580 | all-4581 | [
"CreateSpaces",
"-"
] | [
"func",
"(",
"m",
"*",
"DefaultManager",
")",
"CreateSpaces",
"(",
")",
"error",
"{",
"m",
".",
"spaces",
"=",
"nil",
"\n",
"configSpaceList",
",",
"err",
":=",
"m",
".",
"Cfg",
".",
"GetSpaceConfigs",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"err",
"=",
"m",
".",
"init",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"for",
"_",
",",
"space",
":=",
"range",
"configSpaceList",
"{",
"orgGUID",
",",
"err",
":=",
"m",
".",
"OrgMgr",
".",
"GetOrgGUID",
"(",
"space",
".",
"Org",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"spaces",
",",
"err",
":=",
"m",
".",
"ListSpaces",
"(",
"orgGUID",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"continue",
"\n",
"}",
"\n\n",
"if",
"m",
".",
"doesSpaceExist",
"(",
"spaces",
",",
"space",
".",
"Space",
")",
"{",
"lo",
".",
"G",
".",
"Debugf",
"(",
"\"",
"\"",
",",
"space",
".",
"Space",
",",
"space",
".",
"Org",
")",
"\n",
"continue",
"\n",
"}",
"else",
"if",
"doesSpaceExistFromRename",
"(",
"space",
".",
"OriginalSpace",
",",
"spaces",
")",
"{",
"lo",
".",
"G",
".",
"Debugf",
"(",
"\"",
"\"",
",",
"<mask>",
".",
"Space",
",",
"space",
".",
"OriginalSpace",
")",
"\n",
"if",
"err",
"=",
"m",
".",
"RenameSpace",
"(",
"space",
".",
"OriginalSpace",
",",
"space",
".",
"Space",
",",
"space",
".",
"Org",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"continue",
"\n",
"}",
"else",
"{",
"lo",
".",
"G",
".",
"Debugf",
"(",
"\"",
"\"",
",",
"space",
".",
"Space",
",",
"spaces",
")",
"\n",
"}",
"\n",
"if",
"err",
"=",
"m",
".",
"CreateSpace",
"(",
"space",
".",
"Space",
",",
"space",
".",
"Org",
",",
"orgGUID",
")",
";",
"err",
"!=",
"nil",
"{",
"lo",
".",
"G",
".",
"Error",
"(",
"err",
")",
"\n",
"return",
"err",
"\n",
"}",
"\n",
"}",
"\n",
"m",
".",
"spaces",
"=",
"nil",
"\n",
"return",
"nil",
"\n",
"}"
] |
4,581 | all-4582 | [
"GetCount",
"returns",
"the",
"Count",
"field",
"if",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"."
] | [
"func",
"(",
"p",
"*",
"Params",
")",
"GetCount",
"(",
")",
"string",
"{",
"if",
"p",
"==",
"nil",
"||",
"p",
".",
"Count",
"==",
"nil",
"{",
"return",
"\"",
"\"",
"\n",
"}",
"\n",
"<mask>",
"*",
"p",
".",
"Count",
"\n",
"}"
] |
4,582 | all-4583 | [
"/",
"*",
"Similar",
"to",
"[",
"NewEvaluableExpression",
"]",
"except",
"that",
"instead",
"of",
"a",
"string",
"an",
"already",
"-",
"tokenized",
"expression",
"is",
"given",
".",
"This",
"is",
"useful",
"in",
"cases",
"where",
"you",
"may",
"be",
"generating",
"an",
"expression",
"automatically",
"or",
"using",
"some",
"other",
"parser",
"(",
"e",
".",
"g",
".",
"to",
"parse",
"from",
"a",
"query",
"language",
")"
] | [
"func",
"NewEvaluableExpressionFromTokens",
"(",
"tokens",
"[",
"]",
"ExpressionToken",
")",
"(",
"*",
"EvaluableExpression",
",",
"error",
")",
"{",
"var",
"ret",
"*",
"EvaluableExpression",
"\n",
"<mask>",
"err",
"error",
"\n\n",
"ret",
"=",
"new",
"(",
"EvaluableExpression",
")",
"\n",
"ret",
".",
"QueryDateFormat",
"=",
"isoDateFormat",
"\n\n",
"err",
"=",
"checkBalance",
"(",
"tokens",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"err",
"=",
"checkExpressionSyntax",
"(",
"tokens",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"ret",
".",
"tokens",
",",
"err",
"=",
"optimizeTokens",
"(",
"tokens",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"ret",
".",
"evaluationStages",
",",
"err",
"=",
"planStages",
"(",
"ret",
".",
"tokens",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"ret",
".",
"ChecksTypes",
"=",
"true",
"\n",
"return",
"ret",
",",
"nil",
"\n",
"}"
] |
4,583 | all-4584 | [
"PathForSpec",
"determines",
"the",
"GCS",
"path",
"prefix",
"for",
"files",
"uploaded",
"for",
"a",
"specific",
"job",
"spec"
] | [
"func",
"PathForSpec",
"(",
"spec",
"*",
"downwardapi",
".",
"JobSpec",
",",
"pathSegment",
"RepoPathBuilder",
")",
"string",
"{",
"switch",
"spec",
".",
"<mask>",
"{",
"case",
"prowapi",
".",
"PeriodicJob",
",",
"prowapi",
".",
"PostsubmitJob",
":",
"return",
"path",
".",
"Join",
"(",
"NonPRLogs",
",",
"spec",
".",
"Job",
",",
"spec",
".",
"BuildID",
")",
"\n",
"case",
"prowapi",
".",
"PresubmitJob",
":",
"return",
"path",
".",
"Join",
"(",
"PRLogs",
",",
"\"",
"\"",
",",
"pathSegment",
"(",
"spec",
".",
"Refs",
".",
"Org",
",",
"spec",
".",
"Refs",
".",
"Repo",
")",
",",
"strconv",
".",
"Itoa",
"(",
"spec",
".",
"Refs",
".",
"Pulls",
"[",
"0",
"]",
".",
"Number",
")",
",",
"spec",
".",
"Job",
",",
"spec",
".",
"BuildID",
")",
"\n",
"case",
"prowapi",
".",
"BatchJob",
":",
"return",
"path",
".",
"Join",
"(",
"PRLogs",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"spec",
".",
"Job",
",",
"spec",
".",
"BuildID",
")",
"\n",
"default",
":",
"logrus",
".",
"Fatalf",
"(",
"\"",
"\"",
",",
"spec",
".",
"Type",
")",
"\n",
"}",
"\n",
"return",
"\"",
"\"",
"\n",
"}"
] |
4,584 | all-4585 | [
"Configure",
"is",
"called",
"automatically",
"from",
"New",
"()",
"to",
"configure",
"the",
"xslate",
"instance",
"from",
"arguments"
] | [
"func",
"(",
"tx",
"*",
"Xslate",
")",
"Configure",
"(",
"args",
"ConfigureArgs",
")",
"error",
"{",
"// The compiler currently does not have any configurable options, but",
"// one may want to replace the entire compiler struct",
"defaults",
":=",
"map",
"[",
"string",
"]",
"func",
"(",
"*",
"Xslate",
",",
"Args",
")",
"error",
"{",
"\"",
"\"",
":",
"DefaultCompiler",
",",
"\"",
"\"",
":",
"DefaultParser",
",",
"\"",
"\"",
":",
"DefaultLoader",
",",
"\"",
"\"",
":",
"DefaultVM",
",",
"}",
"\n\n",
"for",
"_",
",",
"key",
":=",
"<mask>",
"[",
"]",
"string",
"{",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
"}",
"{",
"configKey",
":=",
"\"",
"\"",
"+",
"key",
"\n",
"configuror",
",",
"ok",
":=",
"args",
".",
"Get",
"(",
"configKey",
")",
"\n",
"if",
"!",
"ok",
"{",
"configuror",
"=",
"defaults",
"[",
"key",
"]",
"\n",
"}",
"\n\n",
"args",
",",
"ok",
":=",
"args",
".",
"Get",
"(",
"key",
")",
"\n",
"if",
"!",
"ok",
"{",
"args",
"=",
"Args",
"{",
"}",
"\n",
"}",
"\n\n",
"err",
":=",
"tx",
".",
"configureGeneric",
"(",
"configuror",
",",
"args",
".",
"(",
"Args",
")",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"}",
"\n\n",
"// Configure Functions",
"if",
"funcs",
",",
"ok",
":=",
"args",
".",
"Get",
"(",
"\"",
"\"",
")",
";",
"ok",
"{",
"tx",
".",
"VM",
".",
"SetFunctions",
"(",
"vm",
".",
"Vars",
"(",
"funcs",
".",
"(",
"Args",
")",
")",
")",
"\n",
"}",
"\n\n",
"if",
"Debug",
"{",
"tx",
".",
"DumpAST",
"(",
"true",
")",
"\n",
"tx",
".",
"DumpByteCode",
"(",
"true",
")",
"\n",
"}",
"\n\n",
"return",
"nil",
"\n",
"}"
] |
4,585 | all-4586 | [
"DeleteFile",
"deletes",
"a",
"file",
"from",
"a",
"Commit",
".",
"DeleteFile",
"leaves",
"a",
"tombstone",
"in",
"the",
"Commit",
"assuming",
"the",
"file",
"isn",
"t",
"written",
"to",
"later",
"attempting",
"to",
"get",
"the",
"file",
"from",
"the",
"finished",
"commit",
"will",
"result",
"in",
"not",
"found",
"error",
".",
"The",
"file",
"will",
"of",
"course",
"remain",
"intact",
"in",
"the",
"Commit",
"s",
"parent",
"."
] | [
"func",
"(",
"c",
"APIClient",
")",
"DeleteFile",
"(",
"repoName",
"string",
",",
"commitID",
"string",
",",
"<mask>",
"string",
")",
"error",
"{",
"_",
",",
"err",
":=",
"c",
".",
"PfsAPIClient",
".",
"DeleteFile",
"(",
"c",
".",
"Ctx",
"(",
")",
",",
"&",
"pfs",
".",
"DeleteFileRequest",
"{",
"File",
":",
"NewFile",
"(",
"repoName",
",",
"commitID",
",",
"path",
")",
",",
"}",
",",
")",
"\n",
"return",
"err",
"\n",
"}"
] |
4,586 | all-4587 | [
"Equal",
"reports",
"whether",
"tokens",
"a",
"and",
"b",
"are",
"equal",
".",
"Two",
"tokens",
"are",
"equal",
"if",
"both",
"their",
"types",
"and",
"values",
"are",
"equal",
".",
"A",
"nil",
"token",
"can",
"never",
"be",
"equal",
"to",
"another",
"token",
"."
] | [
"func",
"(",
"a",
"*",
"Token",
")",
"Equal",
"(",
"b",
"*",
"Token",
")",
"bool",
"{",
"if",
"a",
"==",
"nil",
"||",
"b",
"==",
"nil",
"{",
"return",
"false",
"\n",
"}",
"\n",
"if",
"a",
".",
"tokenType",
"!=",
"b",
".",
"tokenType",
"{",
"return",
"false",
"\n",
"}",
"\n",
"return",
"a",
".",
"value",
"==",
"b",
".",
"<mask>",
"\n",
"}"
] |
4,587 | all-4588 | [
"SetTraceInfo",
"sets",
"the",
"trace",
"info",
"for",
"the",
"trace",
".",
"This",
"is",
"currently",
"unused",
"."
] | [
"func",
"(",
"t",
"*",
"trace",
")",
"SetTraceInfo",
"(",
"traceID",
"uint64",
",",
"spanID",
"uint64",
")",
"{",
"t",
".",
"<mask>",
".",
"SetTraceInfo",
"(",
"traceID",
",",
"spanID",
")",
"\n",
"}"
] |
4,588 | all-4589 | [
"resourceVSphereComputeClusterSaveNameAndPath",
"saves",
"the",
"name",
"and",
"path",
"of",
"a",
"StoragePod",
"into",
"the",
"supplied",
"ResourceData",
"."
] | [
"func",
"resourceVSphereComputeClusterSaveNameAndPath",
"(",
"d",
"*",
"schema",
".",
"ResourceData",
",",
"cluster",
"*",
"<mask>",
".",
"ClusterComputeResource",
")",
"error",
"{",
"log",
".",
"Printf",
"(",
"\"",
"\"",
",",
"resourceVSphereComputeClusterIDString",
"(",
"d",
")",
",",
"cluster",
".",
"InventoryPath",
",",
")",
"\n\n",
"if",
"err",
":=",
"d",
".",
"Set",
"(",
"\"",
"\"",
",",
"cluster",
".",
"Name",
"(",
")",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"}",
"\n\n",
"f",
",",
"err",
":=",
"folder",
".",
"RootPathParticleHost",
".",
"SplitRelativeFolder",
"(",
"cluster",
".",
"InventoryPath",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"cluster",
".",
"InventoryPath",
",",
"err",
")",
"\n",
"}",
"\n",
"if",
"err",
":=",
"d",
".",
"Set",
"(",
"\"",
"\"",
",",
"folder",
".",
"NormalizePath",
"(",
"f",
")",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
] |
4,589 | all-4590 | [
"GenerateECDSAKeyPairWithCurve",
"generates",
"a",
"new",
"ecdsa",
"private",
"and",
"public",
"key",
"with",
"a",
"speicified",
"curve"
] | [
"func",
"GenerateECDSAKeyPairWithCurve",
"(",
"curve",
"elliptic",
".",
"Curve",
",",
"src",
"<mask>",
".",
"Reader",
")",
"(",
"PrivKey",
",",
"PubKey",
",",
"error",
")",
"{",
"priv",
",",
"err",
":=",
"ecdsa",
".",
"GenerateKey",
"(",
"curve",
",",
"src",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"return",
"&",
"ECDSAPrivateKey",
"{",
"priv",
"}",
",",
"&",
"ECDSAPublicKey",
"{",
"&",
"priv",
".",
"PublicKey",
"}",
",",
"nil",
"\n",
"}"
] |
4,590 | all-4591 | [
"CreateJob",
"creates",
"a",
"basic",
"empty",
"configuration",
"with",
"some",
"defaults",
"."
] | [
"func",
"CreateJob",
"(",
")",
"Config",
"{",
"return",
"Config",
"{",
"LockProvider",
":",
"nil",
",",
"RuntimeProcessor",
":",
"nil",
",",
"ResultProcessor",
":",
"nil",
",",
"RuntimeProcessingFrequency",
":",
"200",
"*",
"<mask>",
".",
"Millisecond",
",",
"SummaryBuffer",
":",
"1",
",",
"}",
"\n",
"}"
] |
4,591 | all-4592 | [
"ReadTimeout",
"sets",
"the",
"connection",
"timeout",
"for",
"read",
"operations",
".",
"Be",
"careful",
"when",
"using",
"a",
"read",
"timeout",
"in",
"conjunction",
"with",
"wait",
"conditions",
".",
"A",
"value",
"of",
"0",
"disables",
"the",
"timeout",
"."
] | [
"func",
"(",
"q",
"*",
"<mask>",
")",
"ReadTimeout",
"(",
"timeout",
"time",
".",
"Duration",
")",
"*",
"Query",
"{",
"q",
".",
"readTimeout",
"=",
"timeout",
"\n",
"return",
"q",
"\n",
"}"
] |
4,592 | all-4593 | [
"Validate",
"validates",
"this",
"error",
"type"
] | [
"func",
"(",
"m",
"ErrorType",
")",
"Validate",
"(",
"formats",
"strfmt",
".",
"Registry",
")",
"error",
"{",
"var",
"<mask>",
"[",
"]",
"error",
"\n\n",
"// value enum",
"if",
"err",
":=",
"m",
".",
"validateErrorTypeEnum",
"(",
"\"",
"\"",
",",
"\"",
"\"",
",",
"m",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"if",
"len",
"(",
"res",
")",
">",
"0",
"{",
"return",
"errors",
".",
"CompositeValidationError",
"(",
"res",
"...",
")",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
] |
4,593 | all-4594 | [
"UnmarshalJSON",
"supports",
"json",
".",
"Unmarshaler",
"interface"
] | [
"func",
"(",
"v",
"*",
"PushNodesByBackendIdsToFrontendReturns",
")",
"UnmarshalJSON",
"(",
"data",
"[",
"]",
"byte",
")",
"error",
"{",
"r",
":=",
"jlexer",
".",
"Lexer",
"{",
"Data",
":",
"<mask>",
"}",
"\n",
"easyjsonC5a4559bDecodeGithubComChromedpCdprotoDom23",
"(",
"&",
"r",
",",
"v",
")",
"\n",
"return",
"r",
".",
"Error",
"(",
")",
"\n",
"}"
] |
4,594 | all-4595 | [
"Store",
"stores",
"the",
"app",
"name",
"related",
"with",
"the",
"router",
"name",
"."
] | [
"func",
"Store",
"(",
"appName",
",",
"routerName",
",",
"kind",
"string",
")",
"error",
"{",
"coll",
",",
"err",
":=",
"collection",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"defer",
"coll",
".",
"Close",
"(",
")",
"\n",
"data",
":=",
"routerAppEntry",
"{",
"App",
":",
"appName",
",",
"Router",
":",
"routerName",
",",
"Kind",
":",
"<mask>",
",",
"}",
"\n",
"_",
",",
"err",
"=",
"coll",
".",
"Upsert",
"(",
"bson",
".",
"M",
"{",
"\"",
"\"",
":",
"appName",
"}",
",",
"data",
")",
"\n",
"return",
"err",
"\n",
"}"
] |
4,595 | all-4596 | [
"ClientPreChannelTopUp",
"checks",
"client",
"balance",
"and",
"creates",
"transaction",
"for",
"increase",
"the",
"channel",
"deposit",
"."
] | [
"func",
"(",
"w",
"*",
"Worker",
")",
"ClientPreChannelTopUp",
"(",
"job",
"*",
"<mask>",
".",
"Job",
")",
"error",
"{",
"logger",
":=",
"w",
".",
"logger",
".",
"Add",
"(",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"job",
")",
"\n\n",
"ch",
",",
"err",
":=",
"w",
".",
"relatedChannel",
"(",
"logger",
",",
"job",
",",
"data",
".",
"JobClientPreChannelTopUp",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"offer",
",",
"err",
":=",
"w",
".",
"offering",
"(",
"logger",
",",
"ch",
".",
"Offering",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"acc",
",",
"err",
":=",
"w",
".",
"account",
"(",
"logger",
",",
"ch",
".",
"Client",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"logger",
"=",
"logger",
".",
"Add",
"(",
"\"",
"\"",
",",
"ch",
",",
"\"",
"\"",
",",
"offer",
")",
"\n\n",
"var",
"jdata",
"data",
".",
"JobTopUpChannelData",
"\n",
"if",
"err",
":=",
"w",
".",
"unmarshalDataTo",
"(",
"logger",
",",
"job",
".",
"Data",
",",
"&",
"jdata",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"if",
"err",
":=",
"w",
".",
"checkDeposit",
"(",
"logger",
",",
"acc",
",",
"offer",
",",
"jdata",
".",
"Deposit",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"return",
"w",
".",
"clientPreChannelTopUpSaveTx",
"(",
"logger",
",",
"job",
",",
"ch",
",",
"acc",
",",
"offer",
",",
"jdata",
".",
"GasPrice",
",",
"uint64",
"(",
"jdata",
".",
"Deposit",
")",
")",
"\n",
"}"
] |
4,596 | all-4597 | [
"/",
"1",
".",
"0",
"/",
"storage",
"-",
"pools",
"/",
"{",
"name",
"}",
"Replace",
"pool",
"properties",
"."
] | [
"func",
"storagePoolPut",
"(",
"d",
"*",
"Daemon",
",",
"r",
"*",
"http",
".",
"Request",
")",
"Response",
"{",
"poolName",
":=",
"mux",
".",
"Vars",
"(",
"r",
")",
"[",
"\"",
"\"",
"]",
"\n\n",
"// Get the existing storage pool.",
"_",
",",
"dbInfo",
",",
"err",
":=",
"d",
".",
"cluster",
".",
"StoragePoolGet",
"(",
"poolName",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"SmartError",
"(",
"err",
")",
"\n",
"}",
"\n\n",
"req",
":=",
"api",
".",
"StoragePoolPut",
"{",
"}",
"\n",
"if",
"err",
":=",
"json",
".",
"NewDecoder",
"(",
"r",
".",
"Body",
")",
".",
"Decode",
"(",
"&",
"req",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"BadRequest",
"(",
"err",
")",
"\n",
"}",
"\n\n",
"clustered",
",",
"err",
":=",
"cluster",
".",
"Enabled",
"(",
"d",
".",
"db",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"SmartError",
"(",
"err",
")",
"\n",
"}",
"\n\n",
"config",
":=",
"dbInfo",
".",
"Config",
"\n",
"if",
"clustered",
"{",
"err",
":=",
"storagePoolValidateClusterConfig",
"(",
"req",
".",
"Config",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"BadRequest",
"(",
"err",
")",
"\n",
"}",
"\n",
"config",
"=",
"storagePoolClusterConfigForEtag",
"(",
"config",
")",
"\n",
"}",
"\n\n",
"// Validate the ETag",
"etag",
":=",
"[",
"]",
"interface",
"{",
"}",
"{",
"dbInfo",
".",
"Name",
",",
"dbInfo",
".",
"Driver",
",",
"config",
"}",
"\n\n",
"err",
"=",
"util",
".",
"EtagCheck",
"(",
"r",
",",
"etag",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"PreconditionFailed",
"(",
"err",
")",
"\n",
"}",
"\n\n",
"// Validate the configuration",
"err",
"=",
"storagePoolValidateConfig",
"(",
"poolName",
",",
"dbInfo",
".",
"Driver",
",",
"req",
".",
"Config",
",",
"dbInfo",
".",
"Config",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"BadRequest",
"(",
"err",
")",
"\n",
"}",
"\n\n",
"config",
"=",
"req",
".",
"Config",
"\n",
"if",
"clustered",
"{",
"// For clustered requests, we need to complement the request's config",
"// with our node-specific values.",
"config",
"=",
"storagePoolClusterFillWithNodeConfig",
"(",
"dbInfo",
".",
"Config",
",",
"config",
")",
"\n",
"}",
"\n\n",
"// Notify the other nodes, unless this is itself a notification.",
"if",
"clustered",
"&&",
"!",
"isClusterNotification",
"(",
"r",
")",
"{",
"cert",
":=",
"d",
".",
"endpoints",
".",
"NetworkCert",
"(",
")",
"\n",
"notifier",
",",
"err",
":=",
"cluster",
".",
"NewNotifier",
"(",
"d",
".",
"State",
"(",
")",
",",
"cert",
",",
"cluster",
".",
"NotifyAll",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"SmartError",
"(",
"err",
")",
"\n",
"}",
"\n",
"err",
"=",
"notifier",
"(",
"func",
"(",
"client",
"lxd",
".",
"ContainerServer",
")",
"error",
"{",
"return",
"<mask>",
".",
"UpdateStoragePool",
"(",
"poolName",
",",
"req",
",",
"r",
".",
"Header",
".",
"Get",
"(",
"\"",
"\"",
")",
")",
"\n",
"}",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"SmartError",
"(",
"err",
")",
"\n",
"}",
"\n",
"}",
"\n\n",
"withDB",
":=",
"!",
"isClusterNotification",
"(",
"r",
")",
"\n",
"err",
"=",
"storagePoolUpdate",
"(",
"d",
".",
"State",
"(",
")",
",",
"poolName",
",",
"req",
".",
"Description",
",",
"config",
",",
"withDB",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"InternalError",
"(",
"err",
")",
"\n",
"}",
"\n\n",
"return",
"EmptySyncResponse",
"\n",
"}"
] |
4,597 | all-4598 | [
"LabelNames",
"returns",
"all",
"the",
"unique",
"label",
"names",
"present",
"in",
"the",
"block",
"in",
"sorted",
"order",
"."
] | [
"func",
"(",
"q",
"*",
"mergeQuerier",
")",
"LabelNames",
"(",
")",
"(",
"[",
"]",
"string",
",",
"error",
")",
"{",
"labelNamesMap",
":=",
"make",
"(",
"map",
"[",
"string",
"]",
"struct",
"{",
"}",
")",
"\n",
"for",
"_",
",",
"b",
":=",
"range",
"q",
".",
"queriers",
"{",
"names",
",",
"err",
":=",
"b",
".",
"LabelNames",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"errors",
".",
"Wrap",
"(",
"err",
",",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"for",
"_",
",",
"name",
":=",
"range",
"names",
"{",
"labelNamesMap",
"[",
"name",
"]",
"=",
"struct",
"{",
"}",
"{",
"}",
"\n",
"}",
"\n",
"}",
"\n\n",
"labelNames",
":=",
"<mask>",
"(",
"[",
"]",
"string",
",",
"0",
",",
"len",
"(",
"labelNamesMap",
")",
")",
"\n",
"for",
"name",
":=",
"range",
"labelNamesMap",
"{",
"labelNames",
"=",
"append",
"(",
"labelNames",
",",
"name",
")",
"\n",
"}",
"\n",
"sort",
".",
"Strings",
"(",
"labelNames",
")",
"\n\n",
"return",
"labelNames",
",",
"nil",
"\n",
"}"
] |
4,598 | all-4599 | [
"GetTolerance",
"is",
"a",
"wrapper",
"around",
"cairo_get_tolerance",
"()",
"."
] | [
"func",
"(",
"v",
"*",
"<mask>",
")",
"GetTolerance",
"(",
")",
"float64",
"{",
"c",
":=",
"C",
".",
"cairo_get_tolerance",
"(",
"v",
".",
"native",
"(",
")",
")",
"\n",
"return",
"float64",
"(",
"c",
")",
"\n",
"}"
] |
4,599 | all-4600 | [
"SetBackend",
"overrides",
"any",
"previously",
"defined",
"backend",
"for",
"this",
"logger",
"."
] | [
"func",
"(",
"l",
"*",
"Logger",
")",
"SetBackend",
"(",
"backend",
"LeveledBackend",
")",
"{",
"l",
".",
"backend",
"=",
"backend",
"\n",
"l",
".",
"haveBackend",
"=",
"<mask>",
"\n",
"}"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.