id
int32 0
25.3k
| idx
stringlengths 5
9
| nl_tokens
sequencelengths 1
418
| pl_tokens
sequencelengths 22
4.98k
|
---|---|---|---|
5,500 | all-5501 | [
"JSONSpec",
"loads",
"a",
"spec",
"from",
"a",
"json",
"document"
] | [
"func",
"JSONSpec",
"(",
"<mask>",
"string",
")",
"(",
"*",
"Document",
",",
"error",
")",
"{",
"data",
",",
"err",
":=",
"JSONDoc",
"(",
"path",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"// convert to json",
"return",
"Analyzed",
"(",
"data",
",",
"\"",
"\"",
")",
"\n",
"}"
] |
5,501 | all-5502 | [
"URL",
"prefixes",
"a",
"url",
"string",
"with",
"the",
"request",
"language",
"."
] | [
"func",
"URL",
"(",
"url",
",",
"prefix",
"string",
",",
"data",
"ContextValue",
")",
"string",
"{",
"if",
"data",
".",
"Current",
".",
"IsRoot",
"(",
")",
"{",
"return",
"url",
"\n",
"}",
"\n\n",
"if",
"prefix",
"==",
"\"",
"\"",
"{",
"prefix",
"=",
"\"",
"\"",
"\n",
"}",
"else",
"if",
"<mask>",
"[",
"len",
"(",
"prefix",
")",
"-",
"1",
"]",
"!=",
"'/'",
"{",
"prefix",
"+=",
"\"",
"\"",
"\n",
"}",
"\n\n",
"if",
"url",
"==",
"\"",
"\"",
"{",
"url",
"=",
"\"",
"\"",
"\n",
"}",
"\n\n",
"if",
"url",
"[",
"0",
"]",
"!=",
"'/'",
"{",
"url",
"=",
"\"",
"\"",
"+",
"url",
"\n",
"}",
"\n\n",
"return",
"prefix",
"+",
"data",
".",
"Current",
".",
"String",
"(",
")",
"+",
"url",
"\n",
"}"
] |
5,502 | all-5503 | [
"flattenExtraConfig",
"reads",
"in",
"the",
"extraConfig",
"from",
"a",
"running",
"virtual",
"machine",
"and",
"*",
"only",
"*",
"sets",
"the",
"keys",
"in",
"extra_config",
"that",
"we",
"know",
"about",
".",
"This",
"is",
"to",
"prevent",
"Terraform",
"from",
"interfering",
"with",
"values",
"that",
"are",
"maintained",
"out",
"-",
"of",
"-",
"band",
"by",
"vSphere",
"which",
"could",
"lead",
"to",
"spurious",
"diffs",
"and",
"unstable",
"operation",
".",
"Note",
"the",
"side",
"-",
"effect",
"here",
"is",
"that",
"Terraform",
"cannot",
"track",
"manual",
"drift",
"that",
"is",
"not",
"a",
"part",
"of",
"normal",
"vSphere",
"operation",
".",
"Removing",
"keys",
"that",
"have",
"been",
"in",
"configuration",
"through",
"at",
"least",
"one",
"successful",
"apply",
"though",
"are",
"safe",
"as",
"removing",
"them",
"will",
"add",
"a",
"nil",
"value",
"for",
"that",
"key",
"in",
"the",
"next",
"chnageset",
"properly",
"effecting",
"its",
"removal",
"."
] | [
"func",
"flattenExtraConfig",
"(",
"d",
"*",
"schema",
".",
"ResourceData",
",",
"opts",
"[",
"]",
"types",
".",
"BaseOptionValue",
")",
"error",
"{",
"if",
"len",
"(",
"opts",
")",
"<",
"1",
"{",
"// No opts to read is a no-op",
"return",
"nil",
"\n",
"}",
"\n",
"ec",
":=",
"make",
"(",
"map",
"[",
"string",
"]",
"interface",
"{",
"}",
")",
"\n",
"for",
"_",
",",
"v",
":=",
"range",
"opts",
"{",
"ov",
":=",
"v",
".",
"GetOptionValue",
"(",
")",
"\n",
"for",
"k",
":=",
"range",
"d",
".",
"Get",
"(",
"\"",
"\"",
")",
".",
"(",
"map",
"[",
"string",
"]",
"<mask>",
"{",
"}",
")",
"{",
"if",
"ov",
".",
"Key",
"==",
"k",
"{",
"ec",
"[",
"ov",
".",
"Key",
"]",
"=",
"ov",
".",
"Value",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"d",
".",
"Set",
"(",
"\"",
"\"",
",",
"ec",
")",
"\n",
"}"
] |
5,503 | all-5504 | [
"ResolveSpecFromEnv",
"will",
"determine",
"the",
"Refs",
"being",
"tested",
"in",
"by",
"parsing",
"Prow",
"environment",
"variable",
"contents"
] | [
"func",
"ResolveSpecFromEnv",
"(",
")",
"(",
"*",
"JobSpec",
",",
"error",
")",
"{",
"specEnv",
",",
"<mask>",
":=",
"os",
".",
"LookupEnv",
"(",
"JobSpecEnv",
")",
"\n",
"if",
"!",
"ok",
"{",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"JobSpecEnv",
")",
"\n",
"}",
"\n\n",
"spec",
":=",
"&",
"JobSpec",
"{",
"}",
"\n",
"if",
"err",
":=",
"json",
".",
"Unmarshal",
"(",
"[",
"]",
"byte",
"(",
"specEnv",
")",
",",
"spec",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"JobSpecEnv",
",",
"err",
")",
"\n",
"}",
"\n\n",
"return",
"spec",
",",
"nil",
"\n",
"}"
] |
5,504 | all-5505 | [
"ConvertResponse",
"converts",
"http",
"error",
"to",
"internal",
"error",
"type",
"based",
"on",
"HTTP",
"response",
"code",
"and",
"HTTP",
"body",
"contents"
] | [
"func",
"ConvertResponse",
"(",
"re",
"*",
"Response",
",",
"err",
"error",
")",
"(",
"*",
"Response",
",",
"error",
")",
"{",
"if",
"err",
"!=",
"nil",
"{",
"if",
"uerr",
",",
"ok",
":=",
"err",
".",
"(",
"*",
"url",
".",
"Error",
")",
";",
"ok",
"&&",
"uerr",
"!=",
"nil",
"&&",
"uerr",
".",
"Err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"trace",
".",
"Wrap",
"(",
"uerr",
".",
"Err",
")",
"\n",
"}",
"\n",
"return",
"nil",
",",
"trace",
".",
"Wrap",
"(",
"err",
")",
"\n",
"}",
"\n",
"return",
"re",
",",
"trace",
".",
"ReadError",
"(",
"re",
".",
"Code",
"(",
")",
",",
"<mask>",
".",
"Bytes",
"(",
")",
")",
"\n",
"}"
] |
5,505 | all-5506 | [
"Host",
"returns",
"Host",
"header",
"value",
"."
] | [
"func",
"(",
"h",
"*",
"RequestHeader",
")",
"Host",
"(",
")",
"[",
"]",
"byte",
"{",
"if",
"len",
"(",
"h",
".",
"host",
")",
">",
"0",
"{",
"return",
"h",
".",
"host",
"\n",
"}",
"\n",
"if",
"!",
"h",
".",
"rawHeadersParsed",
"{",
"// fast path without employing full headers parsing.",
"host",
":=",
"peekRawHeader",
"(",
"h",
".",
"rawHeaders",
",",
"strHost",
")",
"\n",
"if",
"len",
"(",
"<mask>",
")",
">",
"0",
"{",
"h",
".",
"host",
"=",
"append",
"(",
"h",
".",
"host",
"[",
":",
"0",
"]",
",",
"host",
"...",
")",
"\n",
"return",
"h",
".",
"host",
"\n",
"}",
"\n",
"}",
"\n\n",
"// slow path.",
"h",
".",
"parseRawHeaders",
"(",
")",
"\n",
"return",
"h",
".",
"host",
"\n",
"}"
] |
5,506 | all-5507 | [
"MarshalJSON",
"supports",
"json",
".",
"Marshaler",
"interface"
] | [
"func",
"(",
"v",
"SetStyleTextsReturns",
")",
"MarshalJSON",
"(",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"w",
":=",
"jwriter",
".",
"Writer",
"{",
"}",
"\n",
"easyjsonC5a4559bEncodeGithubComChromedpCdprotoCss11",
"(",
"&",
"w",
",",
"v",
")",
"\n",
"return",
"w",
".",
"<mask>",
".",
"BuildBytes",
"(",
")",
",",
"w",
".",
"Error",
"\n",
"}"
] |
5,507 | all-5508 | [
"WriteTo",
"writes",
"data",
"to",
"w",
"."
] | [
"func",
"(",
"e",
"*",
"action",
")",
"WriteTo",
"(",
"w",
"io",
".",
"Writer",
")",
"(",
"int64",
",",
"error",
")",
"{",
"var",
"bf",
"<mask>",
".",
"Buffer",
"\n\n",
"// Write the action",
"bf",
".",
"WriteString",
"(",
"strings",
".",
"TrimSpace",
"(",
"e",
".",
"ln",
".",
"str",
")",
")",
"\n\n",
"// Write the children's HTML.",
"if",
"i",
",",
"err",
":=",
"e",
".",
"writeChildren",
"(",
"&",
"bf",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"i",
",",
"err",
"\n",
"}",
"\n\n",
"// Write the buffer.",
"i",
",",
"err",
":=",
"w",
".",
"Write",
"(",
"bf",
".",
"Bytes",
"(",
")",
")",
"\n\n",
"return",
"int64",
"(",
"i",
")",
",",
"err",
"\n\n",
"}"
] |
5,508 | all-5509 | [
"checkQuorumActive",
"returns",
"true",
"if",
"the",
"quorum",
"is",
"active",
"from",
"the",
"view",
"of",
"the",
"local",
"raft",
"state",
"machine",
".",
"Otherwise",
"it",
"returns",
"false",
".",
"checkQuorumActive",
"also",
"resets",
"all",
"RecentActive",
"to",
"false",
"."
] | [
"func",
"(",
"r",
"*",
"raft",
")",
"checkQuorumActive",
"(",
")",
"bool",
"{",
"var",
"act",
"int",
"\n\n",
"r",
".",
"forEachProgress",
"(",
"func",
"(",
"id",
"uint64",
",",
"pr",
"*",
"Progress",
")",
"{",
"if",
"id",
"==",
"r",
".",
"id",
"{",
"// self is always active",
"act",
"++",
"\n",
"return",
"\n",
"}",
"\n\n",
"if",
"pr",
".",
"RecentActive",
"&&",
"!",
"pr",
".",
"IsLearner",
"{",
"act",
"++",
"\n",
"}",
"\n\n",
"pr",
".",
"RecentActive",
"=",
"false",
"\n",
"}",
")",
"\n\n",
"return",
"<mask>",
">=",
"r",
".",
"quorum",
"(",
")",
"\n",
"}"
] |
5,509 | all-5510 | [
"SetUInt64",
"is",
"a",
"wrapper",
"around",
"g_value_set_uint64",
"()",
"."
] | [
"func",
"(",
"v",
"*",
"<mask>",
")",
"SetUInt64",
"(",
"val",
"uint64",
")",
"{",
"C",
".",
"g_value_set_uint64",
"(",
"v",
".",
"native",
"(",
")",
",",
"C",
".",
"guint64",
"(",
"val",
")",
")",
"\n",
"}"
] |
5,510 | all-5511 | [
"CreateMetricCluster",
"creates",
"a",
"new",
"metric",
"cluster",
"."
] | [
"func",
"(",
"a",
"*",
"API",
")",
"CreateMetricCluster",
"(",
"cfg",
"*",
"MetricCluster",
")",
"(",
"*",
"MetricCluster",
",",
"error",
")",
"{",
"if",
"cfg",
"==",
"nil",
"{",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"jsonCfg",
",",
"err",
":=",
"json",
".",
"Marshal",
"(",
"cfg",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"if",
"a",
".",
"Debug",
"{",
"a",
".",
"Log",
".",
"Printf",
"(",
"\"",
"\"",
",",
"string",
"(",
"jsonCfg",
")",
")",
"\n",
"}",
"\n\n",
"<mask>",
",",
"err",
":=",
"a",
".",
"Post",
"(",
"config",
".",
"MetricClusterPrefix",
",",
"jsonCfg",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"cluster",
":=",
"&",
"MetricCluster",
"{",
"}",
"\n",
"if",
"err",
":=",
"json",
".",
"Unmarshal",
"(",
"result",
",",
"cluster",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"return",
"cluster",
",",
"nil",
"\n",
"}"
] |
5,511 | all-5512 | [
"GetMustShowResourceListOk",
"returns",
"a",
"tuple",
"with",
"the",
"MustShowResourceList",
"field",
"if",
"it",
"s",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"and",
"a",
"boolean",
"to",
"check",
"if",
"the",
"value",
"has",
"been",
"set",
"."
] | [
"func",
"(",
"w",
"*",
"Widget",
")",
"GetMustShowResourceListOk",
"(",
")",
"(",
"bool",
",",
"bool",
")",
"{",
"if",
"w",
"==",
"nil",
"||",
"w",
".",
"MustShowResourceList",
"==",
"nil",
"{",
"return",
"false",
",",
"<mask>",
"\n",
"}",
"\n",
"return",
"*",
"w",
".",
"MustShowResourceList",
",",
"true",
"\n",
"}"
] |
5,512 | all-5513 | [
"Flush",
"implements",
"instruments",
".",
"Reporter"
] | [
"func",
"(",
"r",
"*",
"Reporter",
")",
"Flush",
"(",
")",
"error",
"{",
"r",
".",
"<mask>",
"(",
"strings",
".",
"Join",
"(",
"r",
".",
"metrics",
",",
"\"",
"\"",
")",
")",
"\n",
"r",
".",
"metrics",
"=",
"r",
".",
"metrics",
"[",
":",
"0",
"]",
"\n",
"return",
"nil",
"\n",
"}"
] |
5,513 | all-5514 | [
"InsertSection",
"is",
"a",
"wrapper",
"around",
"g_menu_insert_section",
"()",
"."
] | [
"func",
"(",
"v",
"*",
"Menu",
")",
"InsertSection",
"(",
"position",
"int",
",",
"label",
"string",
",",
"section",
"*",
"MenuModel",
")",
"{",
"cstr1",
":=",
"(",
"*",
"C",
".",
"gchar",
")",
"(",
"C",
".",
"CString",
"(",
"label",
")",
")",
"\n",
"defer",
"C",
".",
"free",
"(",
"unsafe",
".",
"Pointer",
"(",
"cstr1",
")",
")",
"\n\n",
"C",
".",
"g_menu_insert_section",
"(",
"v",
".",
"native",
"(",
")",
",",
"C",
".",
"gint",
"(",
"<mask>",
")",
",",
"cstr1",
",",
"section",
".",
"native",
"(",
")",
")",
"\n",
"}"
] |
5,514 | all-5515 | [
"Returns",
"the",
"source",
"code",
"to",
"add",
"to",
"the",
"target",
"file",
"."
] | [
"func",
"(",
"b",
"*",
"Buffer",
")",
"code",
"(",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"code",
",",
"err",
":=",
"format",
".",
"<mask>",
"(",
"b",
".",
"buf",
".",
"Bytes",
"(",
")",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"errors",
".",
"Wrap",
"(",
"err",
",",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"return",
"code",
",",
"nil",
"\n",
"}"
] |
5,515 | all-5516 | [
"errNo",
"returns",
"an",
"error",
"if",
"the",
"errno",
"is",
"<",
"0"
] | [
"func",
"errNo",
"(",
"i",
"C",
".",
"int",
")",
"(",
"int",
",",
"error",
")",
"{",
"errno",
":=",
"int",
"(",
"i",
")",
"\n",
"if",
"errno",
"<",
"0",
"{",
"errMsg",
":=",
"\"",
"\"",
"\n",
"if",
"e",
",",
"ok",
":=",
"errNoMap",
"[",
"errno",
"]",
";",
"ok",
"{",
"errMsg",
"=",
"e",
"\n",
"}",
"\n",
"return",
"errno",
",",
"<mask>",
".",
"New",
"(",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"caller",
"(",
")",
",",
"errMsg",
")",
")",
"\n",
"}",
"\n",
"return",
"errno",
",",
"nil",
"\n",
"}"
] |
5,516 | all-5517 | [
"ConvertEndpointsToZones",
"marshals",
"endpoints",
"into",
"pdns",
"compatible",
"Zone",
"structs"
] | [
"func",
"(",
"p",
"*",
"PDNSProvider",
")",
"ConvertEndpointsToZones",
"(",
"eps",
"[",
"]",
"*",
"endpoint",
".",
"Endpoint",
",",
"changetype",
"pdnsChangeType",
")",
"(",
"zonelist",
"[",
"]",
"pgo",
".",
"Zone",
",",
"_",
"error",
")",
"{",
"zonelist",
"=",
"[",
"]",
"pgo",
".",
"Zone",
"{",
"}",
"\n",
"endpoints",
":=",
"make",
"(",
"[",
"]",
"*",
"endpoint",
".",
"Endpoint",
",",
"len",
"(",
"eps",
")",
")",
"\n",
"copy",
"(",
"endpoints",
",",
"eps",
")",
"\n\n",
"// Sort the endpoints array so we have deterministic inserts",
"sort",
".",
"SliceStable",
"(",
"endpoints",
",",
"func",
"(",
"i",
",",
"j",
"int",
")",
"bool",
"{",
"// We only care about sorting endpoints with the same dnsname",
"if",
"endpoints",
"[",
"i",
"]",
".",
"DNSName",
"==",
"endpoints",
"[",
"j",
"]",
".",
"DNSName",
"{",
"return",
"endpoints",
"[",
"i",
"]",
".",
"RecordType",
"<",
"endpoints",
"[",
"j",
"]",
".",
"RecordType",
"\n",
"}",
"\n",
"return",
"endpoints",
"[",
"i",
"]",
".",
"DNSName",
"<",
"endpoints",
"[",
"j",
"]",
".",
"DNSName",
"\n",
"}",
")",
"\n\n",
"zones",
",",
"_",
",",
"err",
":=",
"p",
".",
"client",
".",
"ListZones",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"filteredZones",
",",
"residualZones",
":=",
"p",
".",
"client",
".",
"PartitionZones",
"(",
"zones",
")",
"\n\n",
"// Sort the zone by length of the name in descending order, we use this",
"// property later to ensure we add a record to the longest matching zone",
"sort",
".",
"SliceStable",
"(",
"filteredZones",
",",
"func",
"(",
"i",
",",
"j",
"int",
")",
"bool",
"{",
"return",
"len",
"(",
"filteredZones",
"[",
"i",
"]",
".",
"Name",
")",
">",
"len",
"(",
"filteredZones",
"[",
"j",
"]",
".",
"Name",
")",
"}",
")",
"\n\n",
"// NOTE: Complexity of this loop is O(FilteredZones*Endpoints).",
"// A possibly faster implementation would be a search of the reversed",
"// DNSName in a trie of Zone names, which should be O(Endpoints), but at this point it's not",
"// necessary.",
"for",
"_",
",",
"zone",
":=",
"range",
"filteredZones",
"{",
"zone",
".",
"Rrsets",
"=",
"[",
"]",
"pgo",
".",
"RrSet",
"{",
"}",
"\n",
"for",
"i",
":=",
"0",
";",
"i",
"<",
"len",
"(",
"endpoints",
")",
";",
"{",
"ep",
":=",
"endpoints",
"[",
"i",
"]",
"\n",
"dnsname",
":=",
"ensureTrailingDot",
"(",
"ep",
".",
"DNSName",
")",
"\n",
"if",
"dnsname",
"==",
"zone",
".",
"Name",
"||",
"strings",
".",
"HasSuffix",
"(",
"dnsname",
",",
"\"",
"\"",
"+",
"<mask>",
".",
"Name",
")",
"{",
"// The assumption here is that there will only ever be one target",
"// per (ep.DNSName, ep.RecordType) tuple, which holds true for",
"// external-dns v5.0.0-alpha onwards",
"records",
":=",
"[",
"]",
"pgo",
".",
"Record",
"{",
"}",
"\n",
"for",
"_",
",",
"t",
":=",
"range",
"ep",
".",
"Targets",
"{",
"if",
"\"",
"\"",
"==",
"ep",
".",
"RecordType",
"{",
"t",
"=",
"ensureTrailingDot",
"(",
"t",
")",
"\n",
"}",
"\n\n",
"records",
"=",
"append",
"(",
"records",
",",
"pgo",
".",
"Record",
"{",
"Content",
":",
"t",
"}",
")",
"\n",
"}",
"\n",
"rrset",
":=",
"pgo",
".",
"RrSet",
"{",
"Name",
":",
"dnsname",
",",
"Type_",
":",
"ep",
".",
"RecordType",
",",
"Records",
":",
"records",
",",
"Changetype",
":",
"string",
"(",
"changetype",
")",
",",
"}",
"\n\n",
"// DELETEs explicitly forbid a TTL, therefore only PATCHes need the TTL",
"if",
"changetype",
"==",
"PdnsReplace",
"{",
"if",
"int64",
"(",
"ep",
".",
"RecordTTL",
")",
">",
"int64",
"(",
"math",
".",
"MaxInt32",
")",
"{",
"return",
"nil",
",",
"errors",
".",
"New",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"if",
"ep",
".",
"RecordTTL",
"==",
"0",
"{",
"// No TTL was specified for the record, we use the default",
"rrset",
".",
"Ttl",
"=",
"int32",
"(",
"defaultTTL",
")",
"\n",
"}",
"else",
"{",
"rrset",
".",
"Ttl",
"=",
"int32",
"(",
"ep",
".",
"RecordTTL",
")",
"\n",
"}",
"\n",
"}",
"\n\n",
"zone",
".",
"Rrsets",
"=",
"append",
"(",
"zone",
".",
"Rrsets",
",",
"rrset",
")",
"\n\n",
"// \"pop\" endpoint if it's matched",
"endpoints",
"=",
"append",
"(",
"endpoints",
"[",
"0",
":",
"i",
"]",
",",
"endpoints",
"[",
"i",
"+",
"1",
":",
"]",
"...",
")",
"\n",
"}",
"else",
"{",
"// If we didn't pop anything, we move to the next item in the list",
"i",
"++",
"\n",
"}",
"\n\n",
"}",
"\n\n",
"if",
"len",
"(",
"zone",
".",
"Rrsets",
")",
">",
"0",
"{",
"zonelist",
"=",
"append",
"(",
"zonelist",
",",
"zone",
")",
"\n",
"}",
"\n\n",
"}",
"\n\n",
"// residualZones is unsorted by name length like its counterpart",
"// since we only care to remove endpoints that do not match domain filter",
"for",
"_",
",",
"zone",
":=",
"range",
"residualZones",
"{",
"for",
"i",
":=",
"0",
";",
"i",
"<",
"len",
"(",
"endpoints",
")",
";",
"{",
"ep",
":=",
"endpoints",
"[",
"i",
"]",
"\n",
"dnsname",
":=",
"ensureTrailingDot",
"(",
"ep",
".",
"DNSName",
")",
"\n",
"if",
"dnsname",
"==",
"zone",
".",
"Name",
"||",
"strings",
".",
"HasSuffix",
"(",
"dnsname",
",",
"\"",
"\"",
"+",
"zone",
".",
"Name",
")",
"{",
"// \"pop\" endpoint if it's matched to a residual zone... essentially a no-op",
"log",
".",
"Debugf",
"(",
"\"",
"\"",
",",
"dnsname",
")",
"\n",
"endpoints",
"=",
"append",
"(",
"endpoints",
"[",
"0",
":",
"i",
"]",
",",
"endpoints",
"[",
"i",
"+",
"1",
":",
"]",
"...",
")",
"\n",
"}",
"else",
"{",
"i",
"++",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n\n",
"// If we still have some endpoints left, it means we couldn't find a matching zone (filtered or residual) for them",
"// We warn instead of hard fail here because we don't want a misconfig to cause everything to go down",
"if",
"len",
"(",
"endpoints",
")",
">",
"0",
"{",
"log",
".",
"Warnf",
"(",
"\"",
"\"",
",",
"endpoints",
")",
"\n",
"}",
"\n\n",
"log",
".",
"Debugf",
"(",
"\"",
"\"",
",",
"zonelist",
")",
"\n\n",
"return",
"zonelist",
",",
"nil",
"\n",
"}"
] |
5,517 | all-5518 | [
"setCache",
"sets",
"the",
"template",
"to",
"the",
"cache",
"."
] | [
"func",
"setCache",
"(",
"name",
"string",
",",
"tpl",
"template",
".",
"<mask>",
")",
"{",
"cacheMutex",
".",
"Lock",
"(",
")",
"\n",
"cache",
"[",
"name",
"]",
"=",
"tpl",
"\n",
"cacheMutex",
".",
"Unlock",
"(",
")",
"\n",
"}"
] |
5,518 | all-5519 | [
"ParseRemote",
"splits",
"remote",
"and",
"object"
] | [
"func",
"(",
"c",
"*",
"Config",
")",
"ParseRemote",
"(",
"raw",
"string",
")",
"(",
"string",
",",
"string",
",",
"error",
")",
"{",
"result",
":=",
"strings",
".",
"SplitN",
"(",
"<mask>",
",",
"\"",
"\"",
",",
"2",
")",
"\n",
"if",
"len",
"(",
"result",
")",
"==",
"1",
"{",
"return",
"c",
".",
"DefaultRemote",
",",
"raw",
",",
"nil",
"\n",
"}",
"\n\n",
"_",
",",
"ok",
":=",
"c",
".",
"Remotes",
"[",
"result",
"[",
"0",
"]",
"]",
"\n",
"if",
"!",
"ok",
"{",
"// Attempt to play nice with snapshots containing \":\"",
"if",
"shared",
".",
"IsSnapshot",
"(",
"raw",
")",
"&&",
"shared",
".",
"IsSnapshot",
"(",
"result",
"[",
"0",
"]",
")",
"{",
"return",
"c",
".",
"DefaultRemote",
",",
"raw",
",",
"nil",
"\n",
"}",
"\n\n",
"return",
"\"",
"\"",
",",
"\"",
"\"",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\\\"",
"\\\"",
"\"",
",",
"result",
"[",
"0",
"]",
")",
"\n",
"}",
"\n\n",
"return",
"result",
"[",
"0",
"]",
",",
"result",
"[",
"1",
"]",
",",
"nil",
"\n",
"}"
] |
5,519 | all-5520 | [
"GetSizeOk",
"returns",
"a",
"tuple",
"with",
"the",
"Size",
"field",
"if",
"it",
"s",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"and",
"a",
"boolean",
"to",
"check",
"if",
"the",
"value",
"has",
"been",
"set",
"."
] | [
"func",
"(",
"h",
"*",
"HostmapRequests",
")",
"GetSizeOk",
"(",
")",
"(",
"HostmapRequest",
",",
"bool",
")",
"{",
"if",
"h",
"==",
"nil",
"||",
"h",
".",
"Size",
"==",
"nil",
"{",
"return",
"HostmapRequest",
"{",
"}",
",",
"false",
"\n",
"}",
"\n",
"return",
"*",
"h",
".",
"Size",
",",
"<mask>",
"\n",
"}"
] |
5,520 | all-5521 | [
"Cause",
"returns",
"the",
"cause",
"of",
"an",
"error"
] | [
"func",
"Cause",
"(",
"err",
"<mask>",
")",
"error",
"{",
"attributes",
":=",
"err",
".",
"Attributes",
"(",
")",
"\n",
"if",
"attributes",
"==",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n\n",
"cause",
",",
"ok",
":=",
"attributes",
"[",
"causeKey",
"]",
"\n",
"if",
"!",
"ok",
"{",
"return",
"nil",
"\n",
"}",
"\n\n",
"switch",
"v",
":=",
"cause",
".",
"(",
"type",
")",
"{",
"case",
"error",
":",
"return",
"v",
"\n",
"case",
"string",
":",
"return",
"errors",
".",
"New",
"(",
"v",
")",
"\n",
"default",
":",
"return",
"nil",
"\n",
"}",
"\n",
"}"
] |
5,521 | all-5522 | [
"flattenStorageDrsVmConfigInfo",
"saves",
"a",
"StorageDrsVmConfigInfo",
"into",
"the",
"supplied",
"ResourceData",
"."
] | [
"func",
"flattenStorageDrsVMConfigInfo",
"(",
"d",
"*",
"schema",
".",
"ResourceData",
",",
"obj",
"*",
"types",
".",
"StorageDrsVmConfigInfo",
")",
"error",
"{",
"if",
"err",
":=",
"d",
".",
"<mask>",
"(",
"\"",
"\"",
",",
"obj",
".",
"Behavior",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\\\"",
"\\\"",
"\"",
",",
"err",
")",
"\n",
"}",
"\n",
"if",
"err",
":=",
"structure",
".",
"SetBoolStringPtr",
"(",
"d",
",",
"\"",
"\"",
",",
"obj",
".",
"Enabled",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\\\"",
"\\\"",
"\"",
",",
"err",
")",
"\n",
"}",
"\n",
"if",
"err",
":=",
"structure",
".",
"SetBoolStringPtr",
"(",
"d",
",",
"\"",
"\"",
",",
"obj",
".",
"IntraVmAffinity",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\\\"",
"\\\"",
"\"",
",",
"err",
")",
"\n",
"}",
"\n\n",
"return",
"nil",
"\n",
"}"
] |
5,522 | all-5523 | [
"waitForHostResources",
"waits",
"for",
"host",
"resources",
"to",
"become",
"available",
"to",
"start",
"the",
"task",
".",
"This",
"involves",
"waiting",
"for",
"previous",
"stops",
"to",
"complete",
"so",
"the",
"resources",
"become",
"free",
"."
] | [
"func",
"(",
"mtask",
"*",
"managedTask",
")",
"waitForHostResources",
"(",
")",
"{",
"if",
"mtask",
".",
"StartSequenceNumber",
"==",
"0",
"{",
"// This is the first transition on this host. No need to wait",
"return",
"\n",
"}",
"\n",
"if",
"mtask",
".",
"GetDesiredStatus",
"(",
")",
".",
"Terminal",
"(",
")",
"{",
"// Task's desired status is STOPPED. No need to wait in this case either",
"return",
"\n",
"}",
"\n\n",
"seelog",
".",
"Infof",
"(",
"\"",
"\"",
",",
"mtask",
".",
"Arn",
",",
"mtask",
".",
"StartSequenceNumber",
")",
"\n\n",
"othersStoppedCtx",
",",
"cancel",
":=",
"context",
".",
"WithCancel",
"(",
"mtask",
".",
"ctx",
")",
"\n",
"defer",
"cancel",
"(",
")",
"\n\n",
"go",
"func",
"(",
")",
"{",
"mtask",
".",
"taskStopWG",
".",
"Wait",
"(",
"mtask",
".",
"StartSequenceNumber",
")",
"\n",
"cancel",
"(",
")",
"\n",
"}",
"(",
")",
"\n\n",
"for",
"!",
"mtask",
".",
"waitEvent",
"(",
"othersStoppedCtx",
".",
"Done",
"(",
")",
")",
"{",
"if",
"mtask",
".",
"GetDesiredStatus",
"(",
")",
".",
"Terminal",
"(",
")",
"{",
"// If we end up here, that means we received a start then stop for this",
"// task before a task that was expected to stop before it could",
"// actually stop",
"break",
"\n",
"}",
"\n",
"}",
"\n",
"seelog",
".",
"Infof",
"(",
"\"",
"\"",
",",
"mtask",
".",
"Arn",
",",
"mtask",
".",
"GetDesiredStatus",
"(",
")",
".",
"<mask>",
"(",
")",
")",
"\n",
"}"
] |
5,523 | all-5524 | [
"Receive",
"succeeds",
"if",
"there",
"is",
"a",
"value",
"to",
"be",
"received",
"on",
"actual",
".",
"Actual",
"must",
"be",
"a",
"channel",
"(",
"and",
"cannot",
"be",
"a",
"send",
"-",
"only",
"channel",
")",
"--",
"anything",
"else",
"is",
"an",
"error",
".",
"Receive",
"returns",
"immediately",
"and",
"never",
"blocks",
":",
"-",
"If",
"there",
"is",
"nothing",
"on",
"the",
"channel",
"c",
"then",
"Expect",
"(",
"c",
")",
".",
"Should",
"(",
"Receive",
"()",
")",
"will",
"fail",
"and",
"Ω",
"(",
"c",
")",
".",
"ShouldNot",
"(",
"Receive",
"()",
")",
"will",
"pass",
".",
"-",
"If",
"the",
"channel",
"c",
"is",
"closed",
"then",
"Expect",
"(",
"c",
")",
".",
"Should",
"(",
"Receive",
"()",
")",
"will",
"fail",
"and",
"Ω",
"(",
"c",
")",
".",
"ShouldNot",
"(",
"Receive",
"()",
")",
"will",
"pass",
".",
"-",
"If",
"there",
"is",
"something",
"on",
"the",
"channel",
"c",
"ready",
"to",
"be",
"read",
"then",
"Expect",
"(",
"c",
")",
".",
"Should",
"(",
"Receive",
"()",
")",
"will",
"pass",
"and",
"Ω",
"(",
"c",
")",
".",
"ShouldNot",
"(",
"Receive",
"()",
")",
"will",
"fail",
".",
"If",
"you",
"have",
"a",
"go",
"-",
"routine",
"running",
"in",
"the",
"background",
"that",
"will",
"write",
"to",
"channel",
"c",
"you",
"can",
":",
"Eventually",
"(",
"c",
")",
".",
"Should",
"(",
"Receive",
"()",
")",
"This",
"will",
"timeout",
"if",
"nothing",
"gets",
"sent",
"to",
"c",
"(",
"you",
"can",
"modify",
"the",
"timeout",
"interval",
"as",
"you",
"normally",
"do",
"with",
"Eventually",
")",
"A",
"similar",
"use",
"-",
"case",
"is",
"to",
"assert",
"that",
"no",
"go",
"-",
"routine",
"writes",
"to",
"a",
"channel",
"(",
"for",
"a",
"period",
"of",
"time",
")",
".",
"You",
"can",
"do",
"this",
"with",
"Consistently",
":",
"Consistently",
"(",
"c",
")",
".",
"ShouldNot",
"(",
"Receive",
"()",
")",
"You",
"can",
"pass",
"Receive",
"a",
"matcher",
".",
"If",
"you",
"do",
"so",
"it",
"will",
"match",
"the",
"received",
"object",
"against",
"the",
"matcher",
".",
"For",
"example",
":",
"Expect",
"(",
"c",
")",
".",
"Should",
"(",
"Receive",
"(",
"Equal",
"(",
"foo",
")))",
"When",
"given",
"a",
"matcher",
"Receive",
"will",
"always",
"fail",
"if",
"there",
"is",
"nothing",
"to",
"be",
"received",
"on",
"the",
"channel",
".",
"Passing",
"Receive",
"a",
"matcher",
"is",
"especially",
"useful",
"when",
"paired",
"with",
"Eventually",
":",
"Eventually",
"(",
"c",
")",
".",
"Should",
"(",
"Receive",
"(",
"ContainSubstring",
"(",
"bar",
")))",
"will",
"repeatedly",
"attempt",
"to",
"pull",
"values",
"out",
"of",
"c",
"until",
"a",
"value",
"matching",
"bar",
"is",
"received",
".",
"Finally",
"if",
"you",
"want",
"to",
"have",
"a",
"reference",
"to",
"the",
"value",
"*",
"sent",
"*",
"to",
"the",
"channel",
"you",
"can",
"pass",
"the",
"Receive",
"matcher",
"a",
"pointer",
"to",
"a",
"variable",
"of",
"the",
"appropriate",
"type",
":",
"var",
"myThing",
"thing",
"Eventually",
"(",
"thingChan",
")",
".",
"Should",
"(",
"Receive",
"(",
"&myThing",
"))",
"Expect",
"(",
"myThing",
".",
"Sprocket",
")",
".",
"Should",
"(",
"Equal",
"(",
"foo",
"))",
"Expect",
"(",
"myThing",
".",
"IsValid",
"()",
")",
".",
"Should",
"(",
"BeTrue",
"()",
")"
] | [
"func",
"Receive",
"(",
"args",
"...",
"interface",
"{",
"}",
")",
"types",
".",
"GomegaMatcher",
"{",
"<mask>",
"arg",
"interface",
"{",
"}",
"\n",
"if",
"len",
"(",
"args",
")",
">",
"0",
"{",
"arg",
"=",
"args",
"[",
"0",
"]",
"\n",
"}",
"\n\n",
"return",
"&",
"matchers",
".",
"ReceiveMatcher",
"{",
"Arg",
":",
"arg",
",",
"}",
"\n",
"}"
] |
5,524 | all-5525 | [
"cleanZoneID",
"removes",
"the",
"/",
"hostedzone",
"/",
"prefix"
] | [
"func",
"cleanZoneID",
"(",
"<mask>",
"string",
")",
"string",
"{",
"if",
"strings",
".",
"HasPrefix",
"(",
"ID",
",",
"\"",
"\"",
")",
"{",
"ID",
"=",
"strings",
".",
"TrimPrefix",
"(",
"ID",
",",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"return",
"ID",
"\n",
"}"
] |
5,525 | all-5526 | [
"title",
":",
"grant",
"access",
"to",
"a",
"service",
"path",
":",
"/",
"services",
"/",
"{",
"service",
"}",
"/",
"team",
"/",
"{",
"team",
"}",
"method",
":",
"PUT",
"responses",
":",
"200",
":",
"Service",
"updated",
"400",
":",
"Team",
"not",
"found",
"401",
":",
"Unauthorized",
"404",
":",
"Service",
"not",
"found",
"409",
":",
"Team",
"already",
"has",
"access",
"to",
"this",
"service"
] | [
"func",
"grantServiceAccess",
"(",
"w",
"http",
".",
"ResponseWriter",
",",
"r",
"*",
"http",
".",
"Request",
",",
"t",
"auth",
".",
"Token",
")",
"(",
"err",
"error",
")",
"{",
"serviceName",
":=",
"r",
".",
"URL",
".",
"Query",
"(",
")",
".",
"Get",
"(",
"\"",
"\"",
")",
"\n",
"s",
",",
"err",
":=",
"getService",
"(",
"serviceName",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"allowed",
":=",
"permission",
".",
"Check",
"(",
"t",
",",
"permission",
".",
"PermServiceUpdateGrantAccess",
",",
"contextsForServiceProvision",
"(",
"&",
"s",
")",
"...",
",",
")",
"\n",
"if",
"!",
"allowed",
"{",
"return",
"permission",
".",
"ErrUnauthorized",
"\n",
"}",
"\n",
"teamName",
":=",
"r",
".",
"URL",
".",
"Query",
"(",
")",
".",
"Get",
"(",
"\"",
"\"",
")",
"\n",
"team",
",",
"err",
":=",
"servicemanager",
".",
"Team",
".",
"FindByName",
"(",
"teamName",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"if",
"err",
"==",
"authTypes",
".",
"ErrTeamNotFound",
"{",
"return",
"&",
"errors",
".",
"HTTP",
"{",
"Code",
":",
"http",
".",
"StatusBadRequest",
",",
"Message",
":",
"\"",
"\"",
"}",
"\n",
"}",
"\n",
"return",
"err",
"\n",
"}",
"\n",
"evt",
",",
"err",
":=",
"event",
".",
"New",
"(",
"&",
"event",
".",
"Opts",
"{",
"Target",
":",
"serviceTarget",
"(",
"s",
".",
"Name",
")",
",",
"Kind",
":",
"permission",
".",
"PermServiceUpdateGrantAccess",
",",
"Owner",
":",
"t",
",",
"CustomData",
":",
"event",
".",
"FormToCustomData",
"(",
"InputFields",
"(",
"r",
")",
")",
",",
"Allowed",
":",
"event",
".",
"Allowed",
"(",
"permission",
".",
"PermServiceReadEvents",
",",
"contextsForServiceProvision",
"(",
"&",
"s",
")",
"...",
")",
",",
"}",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"defer",
"func",
"(",
")",
"{",
"evt",
".",
"Done",
"(",
"err",
")",
"}",
"(",
")",
"\n",
"err",
"=",
"s",
".",
"GrantAccess",
"(",
"team",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"&",
"errors",
".",
"HTTP",
"{",
"Code",
":",
"http",
".",
"StatusConflict",
",",
"Message",
":",
"err",
".",
"<mask>",
"(",
")",
"}",
"\n",
"}",
"\n",
"return",
"service",
".",
"Update",
"(",
"s",
")",
"\n",
"}"
] |
5,526 | all-5527 | [
"IsEquivalent",
"returns",
"true",
"if",
"other",
"represents",
"the",
"same",
"data",
"type",
"as",
"the",
"target",
"."
] | [
"func",
"(",
"a",
"*",
"ArrayDataType",
")",
"IsEquivalent",
"(",
"other",
"DataType",
")",
"bool",
"{",
"t",
",",
"ok",
":=",
"other",
".",
"(",
"*",
"ArrayDataType",
")",
"\n",
"if",
"!",
"ok",
"{",
"return",
"<mask>",
"\n",
"}",
"\n",
"return",
"a",
".",
"ElemType",
".",
"IsEquivalent",
"(",
"t",
".",
"ElemType",
")",
"\n",
"}"
] |
5,527 | all-5528 | [
"RawString",
"returns",
"raw",
"log",
"string",
"exclude",
"time",
"&",
"tags"
] | [
"func",
"(",
"g",
"*",
"Glg",
")",
"RawString",
"(",
"data",
"[",
"]",
"byte",
")",
"string",
"{",
"str",
":=",
"*",
"(",
"*",
"string",
")",
"(",
"unsafe",
".",
"Pointer",
"(",
"&",
"<mask>",
")",
")",
"\n",
"return",
"str",
"[",
"strings",
".",
"Index",
"(",
"str",
",",
"sep",
")",
"+",
"sepl",
":",
"len",
"(",
"str",
")",
"-",
"rcl",
"]",
"\n",
"}"
] |
5,528 | all-5529 | [
"Offset",
"returns",
"a",
"new",
"Condition",
"of",
"OFFSET",
"clause",
"."
] | [
"func",
"(",
"db",
"*",
"DB",
")",
"Offset",
"(",
"<mask>",
"int",
")",
"*",
"Condition",
"{",
"return",
"newCondition",
"(",
"db",
")",
".",
"Offset",
"(",
"offset",
")",
"\n",
"}"
] |
5,529 | all-5530 | [
"grpcHandlerFunc",
"returns",
"an",
"http",
".",
"Handler",
"that",
"delegates",
"to",
"grpcServer",
"on",
"incoming",
"gRPC",
"connections",
"or",
"otherHandler",
"otherwise",
".",
"Given",
"in",
"gRPC",
"docs",
"."
] | [
"func",
"grpcHandlerFunc",
"(",
"grpcServer",
"*",
"grpc",
".",
"Server",
",",
"otherHandler",
"<mask>",
".",
"Handler",
")",
"http",
".",
"Handler",
"{",
"if",
"otherHandler",
"==",
"nil",
"{",
"return",
"http",
".",
"HandlerFunc",
"(",
"func",
"(",
"w",
"http",
".",
"ResponseWriter",
",",
"r",
"*",
"http",
".",
"Request",
")",
"{",
"grpcServer",
".",
"ServeHTTP",
"(",
"w",
",",
"r",
")",
"\n",
"}",
")",
"\n",
"}",
"\n",
"return",
"http",
".",
"HandlerFunc",
"(",
"func",
"(",
"w",
"http",
".",
"ResponseWriter",
",",
"r",
"*",
"http",
".",
"Request",
")",
"{",
"if",
"r",
".",
"ProtoMajor",
"==",
"2",
"&&",
"strings",
".",
"Contains",
"(",
"r",
".",
"Header",
".",
"Get",
"(",
"\"",
"\"",
")",
",",
"\"",
"\"",
")",
"{",
"grpcServer",
".",
"ServeHTTP",
"(",
"w",
",",
"r",
")",
"\n",
"}",
"else",
"{",
"otherHandler",
".",
"ServeHTTP",
"(",
"w",
",",
"r",
")",
"\n",
"}",
"\n",
"}",
")",
"\n",
"}"
] |
5,530 | all-5531 | [
"SetTitle",
"is",
"a",
"wrapper",
"around",
"gtk_window_set_title",
"()",
"."
] | [
"func",
"(",
"v",
"*",
"Window",
")",
"SetTitle",
"(",
"<mask>",
"string",
")",
"{",
"cstr",
":=",
"C",
".",
"CString",
"(",
"title",
")",
"\n",
"defer",
"C",
".",
"free",
"(",
"unsafe",
".",
"Pointer",
"(",
"cstr",
")",
")",
"\n",
"C",
".",
"gtk_window_set_title",
"(",
"v",
".",
"native",
"(",
")",
",",
"(",
"*",
"C",
".",
"gchar",
")",
"(",
"cstr",
")",
")",
"\n",
"}"
] |
5,531 | all-5532 | [
"UnmarshalJSON",
"supports",
"json",
".",
"Unmarshaler",
"interface"
] | [
"func",
"(",
"v",
"*",
"StepOverParams",
")",
"UnmarshalJSON",
"(",
"data",
"[",
"]",
"byte",
")",
"error",
"{",
"r",
":=",
"jlexer",
".",
"Lexer",
"{",
"Data",
":",
"data",
"}",
"\n",
"easyjsonC5a4559bDecodeGithubComChromedpCdprotoDebugger",
"(",
"&",
"r",
",",
"v",
")",
"\n",
"return",
"r",
".",
"<mask>",
"(",
")",
"\n",
"}"
] |
5,532 | all-5533 | [
"WriteHealthKey",
"writes",
"a",
"health",
"key",
"to",
"this",
"member",
"."
] | [
"func",
"(",
"m",
"*",
"Member",
")",
"WriteHealthKey",
"(",
")",
"error",
"{",
"cli",
",",
"err",
":=",
"m",
".",
"CreateEtcdClient",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"err",
",",
"m",
".",
"EtcdClientEndpoint",
")",
"\n",
"}",
"\n",
"defer",
"cli",
".",
"Close",
"(",
")",
"\n\n",
"// give enough time-out in case expensive requests (range/delete) are pending",
"ctx",
",",
"cancel",
":=",
"context",
".",
"WithTimeout",
"(",
"context",
".",
"Background",
"(",
")",
",",
"5",
"*",
"<mask>",
".",
"Second",
")",
"\n",
"_",
",",
"err",
"=",
"cli",
".",
"Put",
"(",
"ctx",
",",
"\"",
"\"",
",",
"\"",
"\"",
")",
"\n",
"cancel",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"err",
",",
"m",
".",
"EtcdClientEndpoint",
")",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
] |
5,533 | all-5534 | [
"ValidEnum",
"validates",
"a",
"proposed",
"value",
"for",
"this",
"enum",
".",
"Implements",
"the",
"Enum",
"interface",
"for",
"PathPaymentResultCode"
] | [
"func",
"(",
"e",
"PathPaymentResultCode",
")",
"ValidEnum",
"(",
"v",
"int32",
")",
"bool",
"{",
"_",
",",
"ok",
":=",
"pathPaymentResultCodeMap",
"[",
"v",
"]",
"\n",
"return",
"<mask>",
"\n",
"}"
] |
5,534 | all-5535 | [
"Domain",
"creates",
"a",
"domain",
"type",
"with",
"the",
"given",
"name"
] | [
"func",
"(",
"cgp",
"*",
"CGP",
")",
"Domain",
"(",
"name",
"string",
")",
"*",
"Domain",
"{",
"return",
"&",
"Domain",
"{",
"cgp",
":",
"cgp",
",",
"<mask>",
":",
"name",
"}",
"\n",
"}"
] |
5,535 | all-5536 | [
"expandStorageDrsAutomationConfig",
"reads",
"certain",
"ResourceData",
"keys",
"and",
"returns",
"a",
"StorageDrsAutomationConfig",
"."
] | [
"func",
"expandStorageDrsAutomationConfig",
"(",
"d",
"*",
"schema",
".",
"ResourceData",
")",
"*",
"types",
".",
"StorageDrsAutomationConfig",
"{",
"obj",
":=",
"&",
"<mask>",
".",
"StorageDrsAutomationConfig",
"{",
"IoLoadBalanceAutomationMode",
":",
"d",
".",
"Get",
"(",
"\"",
"\"",
")",
".",
"(",
"string",
")",
",",
"PolicyEnforcementAutomationMode",
":",
"d",
".",
"Get",
"(",
"\"",
"\"",
")",
".",
"(",
"string",
")",
",",
"RuleEnforcementAutomationMode",
":",
"d",
".",
"Get",
"(",
"\"",
"\"",
")",
".",
"(",
"string",
")",
",",
"SpaceLoadBalanceAutomationMode",
":",
"d",
".",
"Get",
"(",
"\"",
"\"",
")",
".",
"(",
"string",
")",
",",
"VmEvacuationAutomationMode",
":",
"d",
".",
"Get",
"(",
"\"",
"\"",
")",
".",
"(",
"string",
")",
",",
"}",
"\n",
"return",
"obj",
"\n",
"}"
] |
5,536 | all-5537 | [
"RunAnnotated",
"annotates",
"a",
"task",
"with",
"a",
"description",
"and",
"a",
"sequence",
"of",
"symbols",
"indicating",
"task",
"activity",
"until",
"it",
"terminates"
] | [
"func",
"RunAnnotated",
"(",
"task",
"Task",
",",
"description",
"string",
",",
"symbol",
"string",
",",
"options",
"...",
"interface",
"{",
"}",
")",
"error",
"{",
"doneCh",
":=",
"make",
"(",
"chan",
"bool",
")",
"\n",
"errCh",
":=",
"make",
"(",
"chan",
"error",
")",
"\n\n",
"l",
":=",
"logger",
".",
"Log",
"\n",
"t",
":=",
"DefaultTicker",
"\n\n",
"for",
"_",
",",
"o",
":=",
"range",
"options",
"{",
"if",
"value",
",",
"ok",
":=",
"o",
".",
"(",
"logger",
".",
"Logger",
")",
";",
"ok",
"{",
"l",
"=",
"value",
"\n",
"}",
"else",
"if",
"value",
",",
"ok",
":=",
"o",
".",
"(",
"*",
"time",
".",
"Ticker",
")",
";",
"ok",
"{",
"t",
"=",
"value",
"\n",
"}",
"\n",
"}",
"\n\n",
"go",
"func",
"(",
")",
"{",
"errCh",
"<-",
"<mask>",
"(",
")",
"\n",
"}",
"(",
")",
"\n\n",
"l",
"(",
"description",
")",
"\n",
"logActivity",
"(",
"symbol",
",",
"l",
",",
"t",
",",
"doneCh",
")",
"\n\n",
"err",
":=",
"<-",
"errCh",
"\n",
"doneCh",
"<-",
"true",
"\n\n",
"return",
"err",
"\n",
"}"
] |
5,537 | all-5538 | [
"Elements",
"returns",
"a",
"[]",
"*",
"api",
".",
"Element",
"that",
"can",
"be",
"used",
"to",
"send",
"direct",
"commands",
"to",
"WebDriver",
"elements",
".",
"See",
":",
"https",
":",
"//",
"code",
".",
"google",
".",
"com",
"/",
"p",
"/",
"selenium",
"/",
"wiki",
"/",
"JsonWireProtocol"
] | [
"func",
"(",
"s",
"*",
"Selection",
")",
"Elements",
"(",
")",
"(",
"[",
"]",
"*",
"api",
".",
"Element",
",",
"error",
")",
"{",
"elements",
",",
"err",
":=",
"s",
".",
"elements",
".",
"Get",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"apiElements",
":=",
"[",
"]",
"*",
"api",
".",
"Element",
"{",
"}",
"\n",
"for",
"_",
",",
"selectedElement",
":=",
"range",
"elements",
"{",
"apiElements",
"=",
"<mask>",
"(",
"apiElements",
",",
"selectedElement",
".",
"(",
"*",
"api",
".",
"Element",
")",
")",
"\n",
"}",
"\n",
"return",
"apiElements",
",",
"nil",
"\n",
"}"
] |
5,538 | all-5539 | [
"Range",
"implements",
"gRPC",
"KVServer",
".",
"Range",
"gets",
"the",
"keys",
"in",
"the",
"range",
"from",
"the",
"store",
"."
] | [
"func",
"(",
"s",
"*",
"etcdStore",
")",
"Range",
"(",
"ctx",
"<mask>",
".",
"Context",
",",
"req",
"*",
"etcdserverpb",
".",
"RangeRequest",
")",
"(",
"*",
"etcdserverpb",
".",
"RangeResponse",
",",
"error",
")",
"{",
"ireq",
":=",
"etcdserverpb",
".",
"InternalRaftRequest",
"{",
"ID",
":",
"<-",
"s",
".",
"idgen",
",",
"Range",
":",
"req",
"}",
"\n",
"msgc",
",",
"errc",
",",
"err",
":=",
"s",
".",
"proposeInternalRaftRequest",
"(",
"ireq",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"select",
"{",
"case",
"<-",
"ctx",
".",
"Done",
"(",
")",
":",
"s",
".",
"cancelInternalRaftRequest",
"(",
"ireq",
")",
"\n",
"return",
"nil",
",",
"ctx",
".",
"Err",
"(",
")",
"\n",
"case",
"msg",
":=",
"<-",
"msgc",
":",
"return",
"msg",
".",
"(",
"*",
"etcdserverpb",
".",
"RangeResponse",
")",
",",
"nil",
"\n",
"case",
"err",
":=",
"<-",
"errc",
":",
"return",
"nil",
",",
"err",
"\n",
"case",
"<-",
"s",
".",
"quitc",
":",
"return",
"nil",
",",
"errStopped",
"\n",
"}",
"\n",
"}"
] |
5,539 | all-5540 | [
"Valid",
"implements",
"y",
".",
"Interface"
] | [
"func",
"(",
"s",
"*",
"ConcatIterator",
")",
"Valid",
"(",
")",
"bool",
"{",
"<mask>",
"s",
".",
"cur",
"!=",
"nil",
"&&",
"s",
".",
"cur",
".",
"Valid",
"(",
")",
"\n",
"}"
] |
5,540 | all-5541 | [
"publishMetrics",
"invokes",
"the",
"PublishMetricsRequest",
"on",
"the",
"clientserver",
"object",
"."
] | [
"func",
"(",
"cs",
"*",
"clientServer",
")",
"publishMetrics",
"(",
")",
"{",
"if",
"cs",
".",
"publishTicker",
"==",
"nil",
"{",
"seelog",
".",
"Debug",
"(",
"\"",
"\"",
")",
"\n",
"return",
"\n",
"}",
"\n\n",
"// Publish metrics immediately after we connect and wait for ticks. This makes",
"// sure that there is no data loss when a scheduled metrics publishing fails",
"// due to a connection reset.",
"err",
":=",
"cs",
".",
"publishMetricsOnce",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"&&",
"err",
"!=",
"stats",
".",
"EmptyMetricsError",
"{",
"seelog",
".",
"Warnf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"}",
"\n",
"// don't simply range over the ticker since its channel doesn't ever get closed",
"for",
"{",
"select",
"{",
"case",
"<-",
"cs",
".",
"publishTicker",
".",
"C",
":",
"err",
":=",
"<mask>",
".",
"publishMetricsOnce",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"seelog",
".",
"Warnf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"}",
"\n",
"case",
"<-",
"cs",
".",
"ctx",
".",
"Done",
"(",
")",
":",
"return",
"\n",
"}",
"\n",
"}",
"\n",
"}"
] |
5,541 | all-5542 | [
"Start",
"-",
"starts",
"the",
"client",
"service",
"to",
"listen",
"to",
"remote",
"events"
] | [
"func",
"(",
"client",
"*",
"Client",
")",
"Start",
"(",
")",
"error",
"{",
"var",
"err",
"error",
"\n",
"service",
":=",
"client",
".",
"service",
"\n",
"if",
"!",
"service",
".",
"started",
"{",
"server",
":=",
"rpc",
".",
"NewServer",
"(",
")",
"\n",
"server",
".",
"Register",
"(",
"service",
")",
"\n",
"server",
".",
"HandleHTTP",
"(",
"client",
".",
"<mask>",
",",
"\"",
"\"",
"+",
"client",
".",
"path",
")",
"\n",
"l",
",",
"err",
":=",
"net",
".",
"Listen",
"(",
"\"",
"\"",
",",
"client",
".",
"address",
")",
"\n",
"if",
"err",
"==",
"nil",
"{",
"service",
".",
"wg",
".",
"Add",
"(",
"1",
")",
"\n",
"service",
".",
"started",
"=",
"true",
"\n",
"go",
"http",
".",
"Serve",
"(",
"l",
",",
"nil",
")",
"\n",
"}",
"\n",
"}",
"else",
"{",
"err",
"=",
"errors",
".",
"New",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"return",
"err",
"\n",
"}"
] |
5,542 | all-5543 | [
"AccelMapUnlockPath",
"is",
"a",
"wrapper",
"around",
"gtk_accel_map_unlock_path",
"()",
"."
] | [
"func",
"AccelMapUnlockPath",
"(",
"<mask>",
"string",
")",
"{",
"cstr",
":=",
"C",
".",
"CString",
"(",
"path",
")",
"\n",
"defer",
"C",
".",
"free",
"(",
"unsafe",
".",
"Pointer",
"(",
"cstr",
")",
")",
"\n\n",
"C",
".",
"gtk_accel_map_unlock_path",
"(",
"(",
"*",
"C",
".",
"gchar",
")",
"(",
"cstr",
")",
")",
"\n",
"}"
] |
5,543 | all-5544 | [
"specify",
"a",
"one",
"-",
"dimensional",
"texture",
"image"
] | [
"func",
"TexImage1D",
"(",
"target",
"uint32",
",",
"level",
"int32",
",",
"internalformat",
"int32",
",",
"width",
"int32",
",",
"border",
"int32",
",",
"format",
"uint32",
",",
"xtype",
"uint32",
",",
"pixels",
"unsafe",
".",
"Pointer",
")",
"{",
"C",
".",
"glowTexImage1D",
"(",
"gpTexImage1D",
",",
"(",
"C",
".",
"GLenum",
")",
"(",
"<mask>",
")",
",",
"(",
"C",
".",
"GLint",
")",
"(",
"level",
")",
",",
"(",
"C",
".",
"GLint",
")",
"(",
"internalformat",
")",
",",
"(",
"C",
".",
"GLsizei",
")",
"(",
"width",
")",
",",
"(",
"C",
".",
"GLint",
")",
"(",
"border",
")",
",",
"(",
"C",
".",
"GLenum",
")",
"(",
"format",
")",
",",
"(",
"C",
".",
"GLenum",
")",
"(",
"xtype",
")",
",",
"pixels",
")",
"\n",
"}"
] |
5,544 | all-5545 | [
"Take",
"retreives",
"just",
"the",
"first",
"n",
"elements",
"from",
"an",
"Enumerable",
"."
] | [
"func",
"Take",
"(",
"subject",
"Enumerable",
",",
"n",
"uint",
")",
"Enumerable",
"{",
"return",
"taker",
"{",
"original",
":",
"<mask>",
",",
"n",
":",
"n",
",",
"}",
"\n",
"}"
] |
5,545 | all-5546 | [
"QueueStats",
"retrieves",
"statistics",
"about",
"queues",
"."
] | [
"func",
"QueueStats",
"(",
"c",
"context",
".",
"Context",
",",
"queueNames",
"[",
"]",
"string",
")",
"(",
"[",
"]",
"QueueStatistics",
",",
"error",
")",
"{",
"req",
":=",
"&",
"pb",
".",
"TaskQueueFetchQueueStatsRequest",
"{",
"QueueName",
":",
"make",
"(",
"[",
"]",
"[",
"]",
"byte",
",",
"len",
"(",
"queueNames",
")",
")",
",",
"}",
"\n",
"for",
"i",
",",
"q",
":=",
"range",
"queueNames",
"{",
"if",
"q",
"==",
"\"",
"\"",
"{",
"q",
"=",
"\"",
"\"",
"\n",
"}",
"\n",
"req",
".",
"QueueName",
"[",
"i",
"]",
"=",
"[",
"]",
"byte",
"(",
"q",
")",
"\n",
"}",
"\n",
"res",
":=",
"&",
"pb",
".",
"TaskQueueFetchQueueStatsResponse",
"{",
"}",
"\n",
"if",
"err",
":=",
"internal",
".",
"Call",
"(",
"c",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"req",
",",
"res",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"qs",
":=",
"make",
"(",
"[",
"]",
"QueueStatistics",
",",
"len",
"(",
"<mask>",
".",
"Queuestats",
")",
")",
"\n",
"for",
"i",
",",
"qsg",
":=",
"range",
"res",
".",
"Queuestats",
"{",
"qs",
"[",
"i",
"]",
"=",
"QueueStatistics",
"{",
"Tasks",
":",
"int",
"(",
"*",
"qsg",
".",
"NumTasks",
")",
",",
"}",
"\n",
"if",
"eta",
":=",
"*",
"qsg",
".",
"OldestEtaUsec",
";",
"eta",
">",
"-",
"1",
"{",
"qs",
"[",
"i",
"]",
".",
"OldestETA",
"=",
"time",
".",
"Unix",
"(",
"0",
",",
"eta",
"*",
"1e3",
")",
"\n",
"}",
"\n",
"if",
"si",
":=",
"qsg",
".",
"ScannerInfo",
";",
"si",
"!=",
"nil",
"{",
"qs",
"[",
"i",
"]",
".",
"Executed1Minute",
"=",
"int",
"(",
"*",
"si",
".",
"ExecutedLastMinute",
")",
"\n",
"qs",
"[",
"i",
"]",
".",
"InFlight",
"=",
"int",
"(",
"si",
".",
"GetRequestsInFlight",
"(",
")",
")",
"\n",
"qs",
"[",
"i",
"]",
".",
"EnforcedRate",
"=",
"si",
".",
"GetEnforcedRate",
"(",
")",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"qs",
",",
"nil",
"\n",
"}"
] |
5,546 | all-5547 | [
"UnmarshalJSON",
"supports",
"json",
".",
"Unmarshaler",
"interface"
] | [
"func",
"(",
"v",
"*",
"StopParams",
")",
"UnmarshalJSON",
"(",
"data",
"[",
"]",
"<mask>",
")",
"error",
"{",
"r",
":=",
"jlexer",
".",
"Lexer",
"{",
"Data",
":",
"data",
"}",
"\n",
"easyjsonC5a4559bDecodeGithubComChromedpCdprotoProfiler9",
"(",
"&",
"r",
",",
"v",
")",
"\n",
"return",
"r",
".",
"Error",
"(",
")",
"\n",
"}"
] |
5,547 | all-5548 | [
"MutateSetOptions",
"for",
"InflationDest",
"sets",
"the",
"SetOptionsOp",
"s",
"InflationDest",
"field"
] | [
"func",
"(",
"m",
"InflationDest",
")",
"MutateSetOptions",
"(",
"o",
"*",
"xdr",
".",
"SetOptionsOp",
")",
"(",
"err",
"error",
")",
"{",
"o",
".",
"InflationDest",
"=",
"&",
"xdr",
".",
"AccountId",
"{",
"}",
"\n",
"<mask>",
"=",
"setAccountId",
"(",
"string",
"(",
"m",
")",
",",
"o",
".",
"InflationDest",
")",
"\n",
"return",
"\n",
"}"
] |
5,548 | all-5549 | [
"SetModuleSpec",
"sets",
"the",
"comma",
"-",
"separated",
"list",
"of",
"pattern",
"=",
"N",
"settings",
"for",
"file",
"-",
"filtered",
"logging"
] | [
"func",
"(",
"l",
"*",
"Log",
")",
"SetVFilepath",
"(",
"spec",
"FilepathSpec",
")",
"{",
"l",
".",
"mu",
".",
"Lock",
"(",
")",
"\n",
"defer",
"l",
".",
"mu",
".",
"Unlock",
"(",
")",
"\n",
"l",
".",
"setVState",
"(",
"l",
".",
"verbosity",
",",
"nil",
",",
"spec",
".",
"filter",
",",
"<mask>",
")",
"\n",
"}"
] |
5,549 | all-5550 | [
"Querier",
"returns",
"a",
"storage",
".",
"MergeQuerier",
"combining",
"the",
"remote",
"client",
"queriers",
"of",
"each",
"configured",
"remote",
"read",
"endpoint",
"."
] | [
"func",
"(",
"s",
"*",
"Storage",
")",
"Querier",
"(",
"ctx",
"context",
".",
"Context",
",",
"mint",
",",
"maxt",
"int64",
")",
"(",
"storage",
".",
"Querier",
",",
"error",
")",
"{",
"s",
".",
"mtx",
".",
"Lock",
"(",
")",
"\n",
"queryables",
":=",
"s",
".",
"queryables",
"\n",
"s",
".",
"mtx",
".",
"Unlock",
"(",
")",
"\n\n",
"queriers",
":=",
"<mask>",
"(",
"[",
"]",
"storage",
".",
"Querier",
",",
"0",
",",
"len",
"(",
"queryables",
")",
")",
"\n",
"for",
"_",
",",
"queryable",
":=",
"range",
"queryables",
"{",
"q",
",",
"err",
":=",
"queryable",
".",
"Querier",
"(",
"ctx",
",",
"mint",
",",
"maxt",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"queriers",
"=",
"append",
"(",
"queriers",
",",
"q",
")",
"\n",
"}",
"\n",
"return",
"storage",
".",
"NewMergeQuerier",
"(",
"nil",
",",
"queriers",
")",
",",
"nil",
"\n",
"}"
] |
5,550 | all-5551 | [
"Allows",
"unmarshaling",
"from",
"byte",
"to",
"MetadataStatus",
"text",
"form"
] | [
"func",
"(",
"status",
"*",
"MetadataStatus",
")",
"UnmarshalText",
"(",
"text",
"[",
"]",
"byte",
")",
"error",
"{",
"t",
":=",
"string",
"(",
"text",
")",
"\n",
"switch",
"t",
"{",
"case",
"MetadataInitialText",
":",
"*",
"status",
"=",
"MetadataInitial",
"\n",
"case",
"MetadataReadyText",
":",
"*",
"status",
"=",
"MetadataReady",
"\n",
"<mask>",
":",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"text",
")",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
] |
5,551 | all-5552 | [
"attach",
"a",
"single",
"layer",
"of",
"a",
"texture",
"object",
"as",
"a",
"logical",
"buffer",
"of",
"a",
"framebuffer",
"object"
] | [
"func",
"NamedFramebufferTextureLayer",
"(",
"framebuffer",
"uint32",
",",
"attachment",
"uint32",
",",
"texture",
"uint32",
",",
"<mask>",
"int32",
",",
"layer",
"int32",
")",
"{",
"syscall",
".",
"Syscall6",
"(",
"gpNamedFramebufferTextureLayer",
",",
"5",
",",
"uintptr",
"(",
"framebuffer",
")",
",",
"uintptr",
"(",
"attachment",
")",
",",
"uintptr",
"(",
"texture",
")",
",",
"uintptr",
"(",
"level",
")",
",",
"uintptr",
"(",
"layer",
")",
",",
"0",
")",
"\n",
"}"
] |
5,552 | all-5553 | [
"for",
"testing"
] | [
"func",
"(",
"router",
"*",
"Router",
")",
"sendPendingGossip",
"(",
")",
"bool",
"{",
"sentSomething",
":=",
"false",
"\n",
"for",
"<mask>",
":=",
"range",
"router",
".",
"Ourself",
".",
"getConnections",
"(",
")",
"{",
"sentSomething",
"=",
"conn",
".",
"(",
"gossipConnection",
")",
".",
"gossipSenders",
"(",
")",
".",
"Flush",
"(",
")",
"||",
"sentSomething",
"\n",
"}",
"\n",
"return",
"sentSomething",
"\n",
"}"
] |
5,553 | all-5554 | [
"UniqueFieldValidator",
"ensures",
"that",
"the",
"specified",
"field",
"of",
"the",
"current",
"model",
"will",
"remain",
"unique",
"among",
"the",
"specified",
"filters",
".",
"If",
"the",
"value",
"matches",
"the",
"provided",
"zero",
"value",
"the",
"check",
"is",
"skipped",
".",
"fire",
".",
"UniqueFieldValidator",
"(",
"Name",
"Creator",
")",
"The",
"special",
"NoZero",
"value",
"can",
"be",
"provided",
"to",
"skip",
"the",
"zero",
"check",
".",
"The",
"callback",
"supports",
"models",
"that",
"use",
"the",
"soft",
"delete",
"mechanism",
"."
] | [
"func",
"UniqueFieldValidator",
"(",
"field",
"string",
",",
"zero",
"interface",
"{",
"}",
",",
"filters",
"...",
"string",
")",
"*",
"Callback",
"{",
"return",
"C",
"(",
"\"",
"\"",
",",
"Only",
"(",
"Create",
",",
"Update",
")",
",",
"func",
"(",
"ctx",
"*",
"Context",
")",
"error",
"{",
"// check if field has changed",
"if",
"ctx",
".",
"Operation",
"==",
"Update",
"{",
"// get original model",
"original",
",",
"err",
":=",
"ctx",
".",
"Original",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"// return if field has not been changed",
"if",
"reflect",
".",
"DeepEqual",
"(",
"ctx",
".",
"Model",
".",
"MustGet",
"(",
"field",
")",
",",
"original",
".",
"MustGet",
"(",
"field",
")",
")",
"{",
"return",
"nil",
"\n",
"}",
"\n",
"}",
"\n\n",
"// get value",
"value",
":=",
"ctx",
".",
"Model",
".",
"MustGet",
"(",
"field",
")",
"\n\n",
"// return if value is the zero value",
"if",
"value",
"!=",
"NoZero",
"&&",
"reflect",
".",
"DeepEqual",
"(",
"value",
",",
"zero",
")",
"{",
"return",
"nil",
"\n",
"}",
"\n\n",
"// prepare query",
"query",
":=",
"bson",
".",
"M",
"{",
"coal",
".",
"F",
"(",
"ctx",
".",
"Model",
",",
"field",
")",
":",
"value",
",",
"}",
"\n\n",
"// add filters",
"for",
"_",
",",
"field",
":=",
"range",
"filters",
"{",
"query",
"[",
"coal",
".",
"F",
"(",
"ctx",
".",
"Model",
",",
"field",
")",
"]",
"=",
"ctx",
".",
"Model",
".",
"MustGet",
"(",
"field",
")",
"\n",
"}",
"\n\n",
"// exclude soft deleted documents if supported",
"if",
"sdm",
":=",
"coal",
".",
"L",
"(",
"ctx",
".",
"<mask>",
",",
"\"",
"\"",
",",
"false",
")",
";",
"sdm",
"!=",
"\"",
"\"",
"{",
"query",
"[",
"coal",
".",
"F",
"(",
"ctx",
".",
"Model",
",",
"sdm",
")",
"]",
"=",
"nil",
"\n",
"}",
"\n\n",
"// count",
"ctx",
".",
"Tracer",
".",
"Push",
"(",
"\"",
"\"",
")",
"\n",
"ctx",
".",
"Tracer",
".",
"Tag",
"(",
"\"",
"\"",
",",
"query",
")",
"\n",
"n",
",",
"err",
":=",
"ctx",
".",
"Store",
".",
"C",
"(",
"ctx",
".",
"Model",
")",
".",
"Find",
"(",
"query",
")",
".",
"Limit",
"(",
"1",
")",
".",
"Count",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"else",
"if",
"n",
"!=",
"0",
"{",
"return",
"E",
"(",
"\"",
"\"",
",",
"field",
")",
"\n",
"}",
"\n",
"ctx",
".",
"Tracer",
".",
"Pop",
"(",
")",
"\n\n",
"return",
"nil",
"\n",
"}",
")",
"\n",
"}"
] |
5,554 | all-5555 | [
"/",
"*",
"GdkDisplay",
"GetNMonitors",
"is",
"a",
"wrapper",
"around",
"gdk_display_get_n_monitors",
"()",
"."
] | [
"func",
"(",
"v",
"*",
"Display",
")",
"GetNMonitors",
"(",
")",
"int",
"{",
"c",
":=",
"C",
".",
"gdk_display_get_n_monitors",
"(",
"v",
".",
"native",
"(",
")",
")",
"\n",
"<mask>",
"int",
"(",
"c",
")",
"\n",
"}"
] |
5,555 | all-5556 | [
"Plain",
"renders",
"the",
"named",
"files",
"using",
"the",
"text",
"/",
"html",
"content",
"type",
"and",
"the",
"github",
".",
"com",
"/",
"gobuffalo",
"/",
"plush",
"package",
"for",
"templating",
".",
"If",
"more",
"than",
"1",
"file",
"is",
"provided",
"the",
"second",
"file",
"will",
"be",
"considered",
"a",
"layout",
"file",
"and",
"the",
"first",
"file",
"will",
"be",
"the",
"content",
"file",
"which",
"will",
"be",
"placed",
"into",
"the",
"layout",
"using",
"<%",
"=",
"yield",
"%",
">",
"."
] | [
"func",
"Plain",
"(",
"names",
"...",
"string",
")",
"Renderer",
"{",
"e",
":=",
"New",
"(",
"<mask>",
"{",
"}",
")",
"\n",
"return",
"e",
".",
"Plain",
"(",
"names",
"...",
")",
"\n",
"}"
] |
5,556 | all-5557 | [
"fills",
"all",
"a",
"texture",
"image",
"with",
"a",
"constant",
"value"
] | [
"func",
"ClearTexImage",
"(",
"texture",
"uint32",
",",
"level",
"int32",
",",
"<mask>",
"uint32",
",",
"xtype",
"uint32",
",",
"data",
"unsafe",
".",
"Pointer",
")",
"{",
"syscall",
".",
"Syscall6",
"(",
"gpClearTexImage",
",",
"5",
",",
"uintptr",
"(",
"texture",
")",
",",
"uintptr",
"(",
"level",
")",
",",
"uintptr",
"(",
"format",
")",
",",
"uintptr",
"(",
"xtype",
")",
",",
"uintptr",
"(",
"data",
")",
",",
"0",
")",
"\n",
"}"
] |
5,557 | all-5558 | [
"Copy",
"copies",
"a",
"hashtree",
"reader",
"in",
"a",
"writer",
"."
] | [
"func",
"(",
"w",
"*",
"<mask>",
")",
"Copy",
"(",
"r",
"*",
"Reader",
")",
"error",
"{",
"for",
"{",
"n",
",",
"err",
":=",
"r",
".",
"Read",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"if",
"err",
"==",
"io",
".",
"EOF",
"{",
"return",
"nil",
"\n",
"}",
"\n",
"return",
"err",
"\n",
"}",
"\n",
"if",
"err",
":=",
"w",
".",
"Write",
"(",
"n",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"}",
"\n",
"}"
] |
5,558 | all-5559 | [
"Domain",
"returns",
"the",
"Chrome",
"DevTools",
"Protocol",
"domain",
"of",
"the",
"event",
"or",
"command",
"."
] | [
"func",
"(",
"t",
"MethodType",
")",
"<mask>",
"(",
")",
"string",
"{",
"return",
"string",
"(",
"t",
"[",
":",
"strings",
".",
"IndexByte",
"(",
"string",
"(",
"t",
")",
",",
"'.'",
")",
"]",
")",
"\n",
"}"
] |
5,559 | all-5560 | [
"Finalize",
"ensures",
"there",
"no",
"nil",
"pointers",
"."
] | [
"func",
"(",
"c",
"*",
"ExecConfig",
")",
"Finalize",
"(",
")",
"{",
"if",
"c",
".",
"Enabled",
"==",
"nil",
"{",
"c",
".",
"Enabled",
"=",
"Bool",
"(",
"StringPresent",
"(",
"c",
".",
"Command",
")",
")",
"\n",
"}",
"\n\n",
"if",
"c",
".",
"Command",
"==",
"nil",
"{",
"c",
".",
"Command",
"=",
"<mask>",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"if",
"c",
".",
"Env",
"==",
"nil",
"{",
"c",
".",
"Env",
"=",
"DefaultEnvConfig",
"(",
")",
"\n",
"}",
"\n",
"c",
".",
"Env",
".",
"Finalize",
"(",
")",
"\n\n",
"if",
"c",
".",
"KillSignal",
"==",
"nil",
"{",
"c",
".",
"KillSignal",
"=",
"Signal",
"(",
"DefaultExecKillSignal",
")",
"\n",
"}",
"\n\n",
"if",
"c",
".",
"KillTimeout",
"==",
"nil",
"{",
"c",
".",
"KillTimeout",
"=",
"TimeDuration",
"(",
"DefaultExecKillTimeout",
")",
"\n",
"}",
"\n\n",
"if",
"c",
".",
"ReloadSignal",
"==",
"nil",
"{",
"c",
".",
"ReloadSignal",
"=",
"Signal",
"(",
"DefaultExecReloadSignal",
")",
"\n",
"}",
"\n\n",
"if",
"c",
".",
"Splay",
"==",
"nil",
"{",
"c",
".",
"Splay",
"=",
"TimeDuration",
"(",
"0",
"*",
"time",
".",
"Second",
")",
"\n",
"}",
"\n\n",
"if",
"c",
".",
"Timeout",
"==",
"nil",
"{",
"c",
".",
"Timeout",
"=",
"TimeDuration",
"(",
"DefaultExecTimeout",
")",
"\n",
"}",
"\n",
"}"
] |
5,560 | all-5561 | [
"StateAfter",
"returns",
"the",
"state",
"of",
"entry",
"key",
"after",
"the",
"application",
"of",
"the",
"operation",
"at",
"opidx"
] | [
"func",
"(",
"b",
"*",
"Bundle",
")",
"StateAfter",
"(",
"key",
"xdr",
".",
"LedgerKey",
",",
"opidx",
"int",
")",
"(",
"*",
"xdr",
".",
"LedgerEntry",
",",
"error",
")",
"{",
"all",
":=",
"b",
".",
"changes",
"(",
"key",
",",
"opidx",
")",
"\n\n",
"if",
"len",
"(",
"all",
")",
"==",
"0",
"{",
"return",
"nil",
",",
"ErrMetaNotFound",
"\n",
"}",
"\n\n",
"change",
":=",
"all",
"[",
"len",
"(",
"all",
")",
"-",
"1",
"]",
"\n\n",
"switch",
"change",
".",
"Type",
"{",
"case",
"xdr",
".",
"LedgerEntryChangeTypeLedgerEntryCreated",
":",
"entry",
":=",
"change",
".",
"MustCreated",
"(",
")",
"\n",
"return",
"&",
"entry",
",",
"nil",
"\n",
"case",
"xdr",
".",
"LedgerEntryChangeTypeLedgerEntryRemoved",
":",
"return",
"nil",
",",
"nil",
"\n",
"case",
"xdr",
".",
"LedgerEntryChangeTypeLedgerEntryUpdated",
":",
"entry",
":=",
"change",
".",
"MustUpdated",
"(",
")",
"\n",
"return",
"&",
"<mask>",
",",
"nil",
"\n",
"case",
"xdr",
".",
"LedgerEntryChangeTypeLedgerEntryState",
":",
"// scott: stellar-core should not emit a lone state entry, and we are",
"// retrieving changes from the end of the collection. If this situation",
"// occurs, it means that I didn't understand something correctly or there is",
"// a bug in stellar-core.",
"panic",
"(",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
")",
")",
"\n",
"default",
":",
"panic",
"(",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"change",
".",
"Type",
")",
")",
"\n",
"}",
"\n",
"}"
] |
5,561 | all-5562 | [
"Tick",
"increments",
"the",
"internal",
"logical",
"clock",
"for",
"this",
"Node",
".",
"Election",
"timeouts",
"and",
"heartbeat",
"timeouts",
"are",
"in",
"units",
"of",
"ticks",
"."
] | [
"func",
"(",
"n",
"*",
"node",
")",
"Tick",
"(",
")",
"{",
"select",
"{",
"case",
"n",
".",
"tickc",
"<-",
"struct",
"{",
"}",
"{",
"}",
":",
"case",
"<-",
"n",
".",
"<mask>",
":",
"default",
":",
"n",
".",
"logger",
".",
"Warningf",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"}"
] |
5,562 | all-5563 | [
"GetTitleAlignOk",
"returns",
"a",
"tuple",
"with",
"the",
"TitleAlign",
"field",
"if",
"it",
"s",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"and",
"a",
"boolean",
"to",
"check",
"if",
"the",
"value",
"has",
"been",
"set",
"."
] | [
"func",
"(",
"h",
"*",
"HostmapDefinition",
")",
"GetTitleAlignOk",
"(",
")",
"(",
"string",
",",
"bool",
")",
"{",
"if",
"h",
"==",
"nil",
"||",
"h",
".",
"TitleAlign",
"==",
"nil",
"{",
"return",
"\"",
"\"",
",",
"false",
"\n",
"}",
"\n",
"return",
"*",
"h",
".",
"TitleAlign",
",",
"<mask>",
"\n",
"}"
] |
5,563 | all-5564 | [
"NewOpener",
"returns",
"an",
"opener",
"that",
"can",
"read",
"GCS",
"and",
"local",
"paths",
"."
] | [
"func",
"NewOpener",
"(",
"ctx",
"context",
".",
"Context",
",",
"creds",
"string",
")",
"(",
"Opener",
",",
"error",
")",
"{",
"var",
"options",
"[",
"]",
"option",
".",
"ClientOption",
"\n",
"if",
"creds",
"!=",
"\"",
"\"",
"{",
"options",
"=",
"append",
"(",
"options",
",",
"option",
".",
"WithCredentialsFile",
"(",
"creds",
")",
")",
"\n",
"}",
"\n",
"client",
",",
"err",
":=",
"storage",
".",
"NewClient",
"(",
"ctx",
",",
"options",
"...",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"if",
"creds",
"!=",
"\"",
"\"",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"logrus",
".",
"WithError",
"(",
"err",
")",
".",
"Debug",
"(",
"\"",
"\"",
")",
"\n",
"<mask>",
"=",
"nil",
"\n",
"}",
"\n",
"return",
"opener",
"{",
"gcs",
":",
"client",
"}",
",",
"nil",
"\n",
"}"
] |
5,564 | all-5565 | [
"GetStyleOk",
"returns",
"a",
"tuple",
"with",
"the",
"Style",
"field",
"if",
"it",
"s",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"and",
"a",
"boolean",
"to",
"check",
"if",
"the",
"value",
"has",
"been",
"set",
"."
] | [
"func",
"(",
"t",
"*",
"TimeseriesRequest",
")",
"GetStyleOk",
"(",
")",
"(",
"TimeseriesRequestStyle",
",",
"bool",
")",
"{",
"if",
"t",
"==",
"nil",
"||",
"t",
".",
"Style",
"==",
"nil",
"{",
"return",
"TimeseriesRequestStyle",
"{",
"}",
",",
"false",
"\n",
"}",
"\n",
"return",
"*",
"t",
".",
"Style",
",",
"<mask>",
"\n",
"}"
] |
5,565 | all-5566 | [
"UnmarshalJSON",
"supports",
"json",
".",
"Unmarshaler",
"interface"
] | [
"func",
"(",
"v",
"*",
"SetBreakpointOnFunctionCallParams",
")",
"UnmarshalJSON",
"(",
"data",
"[",
"]",
"byte",
")",
"error",
"{",
"r",
":=",
"jlexer",
".",
"Lexer",
"{",
"Data",
":",
"<mask>",
"}",
"\n",
"easyjsonC5a4559bDecodeGithubComChromedpCdprotoDebugger13",
"(",
"&",
"r",
",",
"v",
")",
"\n",
"return",
"r",
".",
"Error",
"(",
")",
"\n",
"}"
] |
5,566 | all-5567 | [
"Update",
"updates",
"the",
"current",
"input",
"states",
"."
] | [
"func",
"(",
"i",
"*",
"Input",
")",
"Update",
"(",
")",
"{",
"switch",
"i",
".",
"mouseState",
"{",
"case",
"mouseStateNone",
":",
"if",
"ebiten",
".",
"IsMouseButtonPressed",
"(",
"ebiten",
".",
"MouseButtonLeft",
")",
"{",
"x",
",",
"y",
":=",
"ebiten",
".",
"CursorPosition",
"(",
")",
"\n",
"i",
".",
"mouseInitPosX",
"=",
"x",
"\n",
"i",
".",
"mouseInitPosY",
"=",
"y",
"\n",
"i",
".",
"mouseState",
"=",
"mouseStatePressing",
"\n",
"}",
"\n",
"case",
"mouseStatePressing",
":",
"if",
"!",
"ebiten",
".",
"IsMouseButtonPressed",
"(",
"ebiten",
".",
"MouseButtonLeft",
")",
"{",
"x",
",",
"y",
":=",
"ebiten",
".",
"CursorPosition",
"(",
")",
"\n",
"dx",
":=",
"x",
"-",
"i",
".",
"mouseInitPosX",
"\n",
"dy",
":=",
"y",
"-",
"i",
".",
"mouseInitPosY",
"\n",
"d",
",",
"ok",
":=",
"vecToDir",
"(",
"dx",
",",
"dy",
")",
"\n",
"if",
"!",
"ok",
"{",
"i",
".",
"mouseState",
"=",
"mouseStateNone",
"\n",
"break",
"\n",
"}",
"\n",
"i",
".",
"mouseDir",
"=",
"d",
"\n",
"i",
".",
"mouseState",
"=",
"mouseStateSettled",
"\n",
"}",
"\n",
"case",
"mouseStateSettled",
":",
"i",
".",
"mouseState",
"=",
"mouseStateNone",
"\n",
"}",
"\n",
"switch",
"i",
".",
"touchState",
"{",
"case",
"touchStateNone",
":",
"ts",
":=",
"ebiten",
".",
"TouchIDs",
"(",
")",
"\n",
"if",
"len",
"(",
"ts",
")",
"==",
"1",
"{",
"i",
".",
"touchID",
"=",
"ts",
"[",
"0",
"]",
"\n",
"x",
",",
"y",
":=",
"ebiten",
".",
"TouchPosition",
"(",
"ts",
"[",
"0",
"]",
")",
"\n",
"i",
".",
"touchInitPosX",
"=",
"x",
"\n",
"i",
".",
"touchInitPosY",
"=",
"y",
"\n",
"i",
".",
"touchLastPosX",
"=",
"x",
"\n",
"i",
".",
"touchLastPosX",
"=",
"y",
"\n",
"i",
".",
"touchState",
"=",
"touchStatePressing",
"\n",
"}",
"\n",
"case",
"touchStatePressing",
":",
"ts",
":=",
"ebiten",
".",
"TouchIDs",
"(",
")",
"\n",
"if",
"len",
"(",
"ts",
")",
">=",
"2",
"{",
"break",
"\n",
"}",
"\n",
"if",
"len",
"(",
"ts",
")",
"==",
"1",
"{",
"if",
"ts",
"[",
"0",
"]",
"!=",
"i",
".",
"touchID",
"{",
"i",
".",
"touchState",
"=",
"touchStateInvalid",
"\n",
"}",
"else",
"{",
"x",
",",
"y",
":=",
"ebiten",
".",
"TouchPosition",
"(",
"ts",
"[",
"0",
"]",
")",
"\n",
"i",
".",
"touchLastPosX",
"=",
"x",
"\n",
"i",
".",
"touchLastPosY",
"=",
"y",
"\n",
"}",
"\n",
"break",
"\n",
"}",
"\n",
"if",
"len",
"(",
"<mask>",
")",
"==",
"0",
"{",
"dx",
":=",
"i",
".",
"touchLastPosX",
"-",
"i",
".",
"touchInitPosX",
"\n",
"dy",
":=",
"i",
".",
"touchLastPosY",
"-",
"i",
".",
"touchInitPosY",
"\n",
"d",
",",
"ok",
":=",
"vecToDir",
"(",
"dx",
",",
"dy",
")",
"\n",
"if",
"!",
"ok",
"{",
"i",
".",
"touchState",
"=",
"touchStateNone",
"\n",
"break",
"\n",
"}",
"\n",
"i",
".",
"touchDir",
"=",
"d",
"\n",
"i",
".",
"touchState",
"=",
"touchStateSettled",
"\n",
"}",
"\n",
"case",
"touchStateSettled",
":",
"i",
".",
"touchState",
"=",
"touchStateNone",
"\n",
"case",
"touchStateInvalid",
":",
"if",
"len",
"(",
"ebiten",
".",
"TouchIDs",
"(",
")",
")",
"==",
"0",
"{",
"i",
".",
"touchState",
"=",
"touchStateNone",
"\n",
"}",
"\n",
"}",
"\n",
"}"
] |
5,567 | all-5568 | [
"Pull",
"clones",
"an",
"entire",
"repo",
"at",
"a",
"certain",
"commit",
".",
"root",
"is",
"the",
"local",
"path",
"you",
"want",
"to",
"clone",
"to",
".",
"fileInfo",
"is",
"the",
"file",
"/",
"dir",
"we",
"are",
"puuling",
".",
"pipes",
"causes",
"the",
"function",
"to",
"create",
"named",
"pipes",
"in",
"place",
"of",
"files",
"thus",
"lazily",
"downloading",
"the",
"data",
"as",
"it",
"s",
"needed",
".",
"emptyFiles",
"causes",
"the",
"function",
"to",
"create",
"empty",
"files",
"with",
"no",
"content",
"it",
"s",
"mutually",
"exclusive",
"with",
"pipes",
".",
"tree",
"is",
"a",
"hashtree",
"to",
"mirror",
"the",
"pulled",
"content",
"into",
"(",
"it",
"may",
"be",
"left",
"nil",
")",
"treeRoot",
"is",
"the",
"root",
"the",
"data",
"is",
"mirrored",
"to",
"within",
"tree"
] | [
"func",
"(",
"p",
"*",
"Puller",
")",
"Pull",
"(",
"client",
"*",
"pachclient",
".",
"APIClient",
",",
"root",
"string",
",",
"repo",
",",
"commit",
",",
"file",
"string",
",",
"pipes",
"bool",
",",
"emptyFiles",
"bool",
",",
"concurrency",
"int",
",",
"statsTree",
"*",
"hashtree",
".",
"Ordered",
",",
"statsRoot",
"string",
")",
"error",
"{",
"limiter",
":=",
"limit",
".",
"New",
"(",
"concurrency",
")",
"\n",
"var",
"eg",
"errgroup",
".",
"Group",
"\n",
"if",
"err",
":=",
"client",
".",
"Walk",
"(",
"repo",
",",
"commit",
",",
"file",
",",
"func",
"(",
"fileInfo",
"*",
"pfs",
".",
"FileInfo",
")",
"error",
"{",
"basepath",
",",
"err",
":=",
"filepath",
".",
"Rel",
"(",
"file",
",",
"fileInfo",
".",
"File",
".",
"Path",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"if",
"statsTree",
"!=",
"nil",
"{",
"statsPath",
":=",
"filepath",
".",
"Join",
"(",
"statsRoot",
",",
"basepath",
")",
"\n",
"if",
"fileInfo",
".",
"FileType",
"==",
"pfs",
".",
"FileType_DIR",
"{",
"statsTree",
".",
"PutDir",
"(",
"statsPath",
")",
"\n",
"}",
"else",
"{",
"var",
"blockRefs",
"[",
"]",
"*",
"pfs",
".",
"BlockRef",
"\n",
"for",
"_",
",",
"object",
":=",
"<mask>",
"fileInfo",
".",
"Objects",
"{",
"objectInfo",
",",
"err",
":=",
"client",
".",
"InspectObject",
"(",
"object",
".",
"Hash",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"blockRefs",
"=",
"append",
"(",
"blockRefs",
",",
"objectInfo",
".",
"BlockRef",
")",
"\n",
"}",
"\n",
"blockRefs",
"=",
"append",
"(",
"blockRefs",
",",
"fileInfo",
".",
"BlockRefs",
"...",
")",
"\n",
"statsTree",
".",
"PutFile",
"(",
"statsPath",
",",
"fileInfo",
".",
"Hash",
",",
"int64",
"(",
"fileInfo",
".",
"SizeBytes",
")",
",",
"&",
"hashtree",
".",
"FileNodeProto",
"{",
"BlockRefs",
":",
"blockRefs",
"}",
")",
"\n",
"}",
"\n",
"}",
"\n",
"path",
":=",
"filepath",
".",
"Join",
"(",
"root",
",",
"basepath",
")",
"\n",
"if",
"fileInfo",
".",
"FileType",
"==",
"pfs",
".",
"FileType_DIR",
"{",
"return",
"os",
".",
"MkdirAll",
"(",
"path",
",",
"0700",
")",
"\n",
"}",
"\n",
"if",
"pipes",
"{",
"return",
"p",
".",
"makePipe",
"(",
"path",
",",
"func",
"(",
"w",
"io",
".",
"Writer",
")",
"error",
"{",
"return",
"client",
".",
"GetFile",
"(",
"repo",
",",
"commit",
",",
"fileInfo",
".",
"File",
".",
"Path",
",",
"0",
",",
"0",
",",
"w",
")",
"\n",
"}",
")",
"\n",
"}",
"\n",
"if",
"emptyFiles",
"{",
"return",
"p",
".",
"makeFile",
"(",
"path",
",",
"func",
"(",
"w",
"io",
".",
"Writer",
")",
"error",
"{",
"return",
"nil",
"}",
")",
"\n",
"}",
"\n",
"eg",
".",
"Go",
"(",
"func",
"(",
")",
"(",
"retErr",
"error",
")",
"{",
"limiter",
".",
"Acquire",
"(",
")",
"\n",
"defer",
"limiter",
".",
"Release",
"(",
")",
"\n",
"return",
"p",
".",
"makeFile",
"(",
"path",
",",
"func",
"(",
"w",
"io",
".",
"Writer",
")",
"error",
"{",
"return",
"client",
".",
"GetFile",
"(",
"repo",
",",
"commit",
",",
"fileInfo",
".",
"File",
".",
"Path",
",",
"0",
",",
"0",
",",
"w",
")",
"\n",
"}",
")",
"\n",
"}",
")",
"\n",
"return",
"nil",
"\n",
"}",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"return",
"eg",
".",
"Wait",
"(",
")",
"\n",
"}"
] |
5,568 | all-5569 | [
"ServeContent",
"serves",
"given",
"content",
"to",
"response",
"."
] | [
"func",
"(",
"ctx",
"*",
"Context",
")",
"ServeContent",
"(",
"name",
"string",
",",
"r",
"io",
".",
"ReadSeeker",
",",
"params",
"...",
"interface",
"{",
"}",
")",
"{",
"modtime",
":=",
"time",
".",
"Now",
"(",
")",
"\n",
"for",
"_",
",",
"p",
":=",
"range",
"params",
"{",
"switch",
"v",
":=",
"p",
".",
"(",
"type",
")",
"{",
"case",
"time",
".",
"Time",
":",
"modtime",
"=",
"v",
"\n",
"}",
"\n",
"}",
"\n\n",
"ctx",
".",
"setRawContentHeader",
"(",
")",
"\n",
"<mask>",
".",
"ServeContent",
"(",
"ctx",
".",
"Resp",
",",
"ctx",
".",
"Req",
".",
"Request",
",",
"name",
",",
"modtime",
",",
"r",
")",
"\n",
"}"
] |
5,569 | all-5570 | [
"updateLastAppended",
"is",
"used",
"to",
"update",
"follower",
"replication",
"state",
"after",
"a",
"successful",
"AppendEntries",
"RPC",
".",
"TODO",
":",
"This",
"isn",
"t",
"used",
"during",
"InstallSnapshot",
"but",
"the",
"code",
"there",
"is",
"similar",
"."
] | [
"func",
"updateLastAppended",
"(",
"s",
"*",
"followerReplication",
",",
"req",
"*",
"AppendEntriesRequest",
")",
"{",
"// Mark any inflight logs as committed",
"if",
"logs",
":=",
"req",
".",
"Entries",
";",
"len",
"(",
"logs",
")",
">",
"0",
"{",
"last",
":=",
"logs",
"[",
"len",
"(",
"logs",
")",
"-",
"1",
"]",
"\n",
"s",
".",
"nextIndex",
"=",
"last",
".",
"Index",
"+",
"1",
"\n",
"s",
".",
"commitment",
".",
"<mask>",
"(",
"s",
".",
"peer",
".",
"ID",
",",
"last",
".",
"Index",
")",
"\n",
"}",
"\n\n",
"// Notify still leader",
"s",
".",
"notifyAll",
"(",
"true",
")",
"\n",
"}"
] |
5,570 | all-5571 | [
"LoginCmd",
"returns",
"a",
"cobra",
".",
"Command",
"to",
"login",
"to",
"a",
"Pachyderm",
"cluster",
"with",
"your",
"GitHub",
"account",
".",
"Any",
"resources",
"that",
"have",
"been",
"restricted",
"to",
"the",
"email",
"address",
"registered",
"with",
"your",
"GitHub",
"account",
"will",
"subsequently",
"be",
"accessible",
"."
] | [
"func",
"LoginCmd",
"(",
"noMetrics",
",",
"noPortForwarding",
"*",
"bool",
")",
"*",
"cobra",
".",
"Command",
"{",
"var",
"useOTP",
"bool",
"\n",
"login",
":=",
"&",
"cobra",
".",
"Command",
"{",
"Short",
":",
"\"",
"\"",
",",
"Long",
":",
"\"",
"\"",
"+",
"\"",
"\"",
"+",
"\"",
"\"",
",",
"Run",
":",
"cmdutil",
".",
"Run",
"(",
"func",
"(",
"[",
"]",
"string",
")",
"error",
"{",
"c",
",",
"err",
":=",
"client",
".",
"NewOnUserMachine",
"(",
"!",
"*",
"noMetrics",
",",
"!",
"*",
"noPortForwarding",
",",
"\"",
"\"",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"}",
"\n",
"defer",
"c",
".",
"Close",
"(",
")",
"\n\n",
"// Issue authentication request to Pachyderm and get response",
"<mask>",
"resp",
"*",
"auth",
".",
"AuthenticateResponse",
"\n",
"var",
"authErr",
"error",
"\n",
"if",
"useOTP",
"{",
"// Exhange short-lived Pachyderm auth code for long-lived Pachyderm token",
"fmt",
".",
"Println",
"(",
"\"",
"\"",
")",
"\n",
"code",
",",
"err",
":=",
"bufio",
".",
"NewReader",
"(",
"os",
".",
"Stdin",
")",
".",
"ReadString",
"(",
"'\\n'",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"}",
"\n",
"code",
"=",
"strings",
".",
"TrimSpace",
"(",
"code",
")",
"// drop trailing newline",
"\n",
"resp",
",",
"authErr",
"=",
"c",
".",
"Authenticate",
"(",
"c",
".",
"Ctx",
"(",
")",
",",
"&",
"auth",
".",
"AuthenticateRequest",
"{",
"OneTimePassword",
":",
"code",
"}",
")",
"\n",
"}",
"else",
"{",
"// Exchange GitHub token for Pachyderm token",
"token",
",",
"err",
":=",
"githubLogin",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"fmt",
".",
"Println",
"(",
"\"",
"\"",
")",
"\n",
"resp",
",",
"authErr",
"=",
"c",
".",
"Authenticate",
"(",
"c",
".",
"Ctx",
"(",
")",
",",
"&",
"auth",
".",
"AuthenticateRequest",
"{",
"GitHubToken",
":",
"token",
"}",
")",
"\n",
"}",
"\n\n",
"// Write new Pachyderm token to config",
"if",
"authErr",
"!=",
"nil",
"{",
"if",
"auth",
".",
"IsErrPartiallyActivated",
"(",
"authErr",
")",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
"+",
"\"",
"\"",
"+",
"\"",
"\"",
",",
"authErr",
")",
"\n",
"}",
"\n",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"grpcutil",
".",
"ScrubGRPC",
"(",
"authErr",
")",
")",
"\n",
"}",
"\n",
"return",
"writePachTokenToCfg",
"(",
"resp",
".",
"PachToken",
")",
"\n",
"}",
")",
",",
"}",
"\n",
"login",
".",
"PersistentFlags",
"(",
")",
".",
"BoolVarP",
"(",
"&",
"useOTP",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"false",
",",
"\"",
"\"",
"+",
"\"",
"\"",
")",
"\n",
"return",
"cmdutil",
".",
"CreateAlias",
"(",
"login",
",",
"\"",
"\"",
")",
"\n",
"}"
] |
5,571 | all-5572 | [
"makeRaftPeer",
"converts",
"a",
"net",
".",
"Addr",
"into",
"a",
"raft",
".",
"Peer",
".",
"All",
"peers",
"must",
"perform",
"the",
"Addr",
"-",
"to",
"-",
"Peer",
"mapping",
"in",
"the",
"same",
"way",
".",
"The",
"etcd",
"Raft",
"implementation",
"tracks",
"the",
"committed",
"entry",
"for",
"each",
"node",
"ID",
"and",
"panics",
"if",
"it",
"discovers",
"a",
"node",
"has",
"lost",
"previously",
"committed",
"entries",
".",
"In",
"effect",
"it",
"assumes",
"commitment",
"implies",
"durability",
".",
"But",
"our",
"storage",
"is",
"explicitly",
"non",
"-",
"durable",
".",
"So",
"whenever",
"a",
"node",
"restarts",
"we",
"need",
"to",
"give",
"it",
"a",
"brand",
"new",
"ID",
".",
"That",
"is",
"the",
"peer",
"UID",
"."
] | [
"func",
"makeRaftPeer",
"(",
"addr",
"net",
".",
"Addr",
")",
"raft",
".",
"Peer",
"{",
"return",
"raft",
".",
"Peer",
"{",
"ID",
":",
"uint64",
"(",
"addr",
".",
"(",
"meshconn",
".",
"MeshAddr",
")",
".",
"PeerUID",
")",
",",
"<mask>",
":",
"nil",
",",
"// TODO(pb): ??",
"}",
"\n",
"}"
] |
5,572 | all-5573 | [
"SetPaperWidth",
"()",
"is",
"a",
"wrapper",
"around",
"gtk_print_settings_set_paper_width",
"()",
"."
] | [
"func",
"(",
"ps",
"*",
"PrintSettings",
")",
"SetPaperWidth",
"(",
"width",
"float64",
",",
"<mask>",
"Unit",
")",
"{",
"C",
".",
"gtk_print_settings_set_paper_width",
"(",
"ps",
".",
"native",
"(",
")",
",",
"C",
".",
"gdouble",
"(",
"width",
")",
",",
"C",
".",
"GtkUnit",
"(",
"unit",
")",
")",
"\n",
"}"
] |
5,573 | all-5574 | [
"handleToken",
"checks",
"for",
"an",
"optional",
"token",
"in",
"the",
"request",
".",
"GitLab",
"s",
"webhook",
"tokens",
"are",
"just",
"simple",
"strings",
"that",
"get",
"sent",
"as",
"a",
"header",
"with",
"the",
"hook",
"request",
".",
"If",
"one",
"exists",
"verify",
"that",
"it",
"matches",
"the",
"secret",
"in",
"the",
"Caddy",
"configuration",
"."
] | [
"func",
"(",
"g",
"GitlabHook",
")",
"handleToken",
"(",
"r",
"*",
"http",
".",
"Request",
",",
"body",
"[",
"]",
"byte",
",",
"secret",
"string",
")",
"error",
"{",
"token",
":=",
"r",
".",
"Header",
".",
"Get",
"(",
"\"",
"\"",
")",
"\n",
"if",
"<mask>",
"!=",
"\"",
"\"",
"{",
"if",
"secret",
"==",
"\"",
"\"",
"{",
"Logger",
"(",
")",
".",
"Print",
"(",
"\"",
"\\n",
"\"",
")",
"\n",
"}",
"else",
"{",
"if",
"token",
"!=",
"secret",
"{",
"return",
"errors",
".",
"New",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n\n",
"return",
"nil",
"\n",
"}"
] |
5,574 | all-5575 | [
"RegisterClientCommands",
"registers",
"all",
"API",
"client",
"commands",
"."
] | [
"func",
"RegisterClientCommands",
"(",
"app",
"*",
"kingpin",
".",
"Application",
")",
"{",
"cm15Cmd",
":=",
"app",
".",
"Command",
"(",
"Cm15Command",
",",
"cm15",
".",
"APIName",
")",
"\n",
"registrar",
":=",
"rsapi",
".",
"Registrar",
"{",
"APICmd",
":",
"cm15Cmd",
"}",
"\n",
"cm15",
".",
"RegisterCommands",
"(",
"&",
"registrar",
")",
"\n\n",
"cm16Cmd",
":=",
"app",
".",
"Command",
"(",
"Cm16Command",
",",
"cm16",
".",
"APIName",
")",
"\n",
"registrar",
"=",
"rsapi",
".",
"Registrar",
"{",
"APICmd",
":",
"cm16Cmd",
"}",
"\n",
"cm16",
".",
"RegisterCommands",
"(",
"&",
"registrar",
")",
"\n\n",
"ssCmd",
":=",
"app",
".",
"Command",
"(",
"SsCommand",
",",
"<mask>",
".",
"APIName",
")",
"\n",
"registrar",
"=",
"rsapi",
".",
"Registrar",
"{",
"APICmd",
":",
"ssCmd",
"}",
"\n",
"ss",
".",
"RegisterCommands",
"(",
"&",
"registrar",
")",
"\n\n",
"rl10Cmd",
":=",
"app",
".",
"Command",
"(",
"Rl10Command",
",",
"rl10",
".",
"APIName",
")",
"\n",
"registrar",
"=",
"rsapi",
".",
"Registrar",
"{",
"APICmd",
":",
"rl10Cmd",
"}",
"\n",
"rl10",
".",
"RegisterCommands",
"(",
"&",
"registrar",
")",
"\n\n",
"caCmd",
":=",
"app",
".",
"Command",
"(",
"CaCommand",
",",
"ca",
".",
"APIName",
")",
"\n",
"registrar",
"=",
"rsapi",
".",
"Registrar",
"{",
"APICmd",
":",
"caCmd",
"}",
"\n",
"ca",
".",
"RegisterCommands",
"(",
"&",
"registrar",
")",
"\n\n",
"policyCmd",
":=",
"app",
".",
"Command",
"(",
"PolicyCommand",
",",
"policy",
".",
"APIName",
")",
"\n",
"registrar",
"=",
"rsapi",
".",
"Registrar",
"{",
"APICmd",
":",
"policyCmd",
"}",
"\n",
"policy",
".",
"RegisterCommands",
"(",
"&",
"registrar",
")",
"\n",
"}"
] |
5,575 | all-5576 | [
"NewSegment",
"creates",
"a",
"new",
"skiplist",
"segment"
] | [
"func",
"(",
"b",
"*",
"Builder",
")",
"NewSegment",
"(",
")",
"*",
"Segment",
"{",
"seg",
":=",
"&",
"Segment",
"{",
"tail",
":",
"make",
"(",
"[",
"]",
"*",
"Node",
",",
"MaxLevel",
"+",
"1",
")",
",",
"head",
":",
"make",
"(",
"[",
"]",
"*",
"Node",
",",
"MaxLevel",
"+",
"1",
")",
",",
"builder",
":",
"b",
",",
"<mask>",
":",
"rand",
".",
"New",
"(",
"rand",
".",
"NewSource",
"(",
"int64",
"(",
"rand",
".",
"Int",
"(",
")",
")",
")",
")",
",",
"}",
"\n\n",
"seg",
".",
"sts",
".",
"IsLocal",
"(",
"true",
")",
"\n",
"return",
"seg",
"\n",
"}"
] |
5,576 | all-5577 | [
"WithHTTPOnly",
"true",
"if",
"cookie",
"is",
"http",
"-",
"only",
"."
] | [
"func",
"(",
"p",
"SetCookieParams",
")",
"WithHTTPOnly",
"(",
"httpOnly",
"bool",
")",
"*",
"SetCookieParams",
"{",
"p",
".",
"HTTPOnly",
"=",
"httpOnly",
"\n",
"<mask>",
"&",
"p",
"\n",
"}"
] |
5,577 | all-5578 | [
"AgentAfterUncooperativeClose",
"marks",
"channel",
"closed",
"uncoop",
"."
] | [
"func",
"(",
"w",
"*",
"Worker",
")",
"AgentAfterUncooperativeClose",
"(",
"job",
"*",
"data",
".",
"Job",
")",
"error",
"{",
"logger",
":=",
"w",
".",
"logger",
".",
"Add",
"(",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"job",
")",
"\n\n",
"channel",
",",
"err",
":=",
"w",
".",
"relatedChannel",
"(",
"logger",
",",
"job",
",",
"data",
".",
"JobAgentAfterUncooperativeClose",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"if",
"channel",
".",
"ServiceStatus",
"!=",
"data",
".",
"ServiceTerminated",
"{",
"_",
",",
"err",
"=",
"w",
".",
"processor",
".",
"TerminateChannel",
"(",
"channel",
".",
"ID",
",",
"data",
".",
"JobTask",
",",
"true",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"logger",
".",
"Error",
"(",
"err",
".",
"Error",
"(",
")",
")",
"\n",
"return",
"ErrTerminateChannel",
"\n",
"}",
"\n",
"}",
"\n\n",
"channel",
".",
"ChannelStatus",
"=",
"data",
".",
"ChannelClosedUncoop",
"\n",
"if",
"err",
"=",
"w",
".",
"db",
".",
"Update",
"(",
"<mask>",
")",
";",
"err",
"!=",
"nil",
"{",
"logger",
".",
"Error",
"(",
"err",
".",
"Error",
"(",
")",
")",
"\n",
"return",
"ErrInternal",
"\n",
"}",
"\n\n",
"if",
"err",
":=",
"w",
".",
"incrementCurrentSupply",
"(",
"logger",
",",
"w",
".",
"db",
".",
"Querier",
",",
"channel",
".",
"Offering",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"agent",
",",
"err",
":=",
"w",
".",
"account",
"(",
"logger",
",",
"channel",
".",
"Agent",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"return",
"w",
".",
"addJob",
"(",
"logger",
",",
"nil",
",",
"data",
".",
"JobAccountUpdateBalances",
",",
"data",
".",
"JobAccount",
",",
"agent",
".",
"ID",
")",
"\n",
"}"
] |
5,578 | all-5579 | [
"NewPortForwarder",
"creates",
"a",
"new",
"port",
"forwarder"
] | [
"func",
"NewPortForwarder",
"(",
"namespace",
"string",
")",
"(",
"*",
"PortForwarder",
",",
"error",
")",
"{",
"if",
"namespace",
"==",
"\"",
"\"",
"{",
"namespace",
"=",
"\"",
"\"",
"\n",
"}",
"\n\n",
"rules",
":=",
"clientcmd",
".",
"NewDefaultClientConfigLoadingRules",
"(",
")",
"\n",
"overrides",
":=",
"&",
"clientcmd",
".",
"ConfigOverrides",
"{",
"}",
"\n",
"kubeConfig",
":=",
"clientcmd",
".",
"NewNonInteractiveDeferredLoadingClientConfig",
"(",
"rules",
",",
"overrides",
")",
"\n",
"config",
",",
"err",
":=",
"kubeConfig",
".",
"ClientConfig",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"client",
",",
"err",
":=",
"kubernetes",
".",
"NewForConfig",
"(",
"config",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"core",
":=",
"client",
".",
"CoreV1",
"(",
")",
"\n\n",
"return",
"&",
"PortForwarder",
"{",
"core",
":",
"core",
",",
"client",
":",
"core",
".",
"RESTClient",
"(",
")",
",",
"config",
":",
"config",
",",
"namespace",
":",
"namespace",
",",
"logger",
":",
"<mask>",
".",
"StandardLogger",
"(",
")",
".",
"Writer",
"(",
")",
",",
"stopChansLock",
":",
"&",
"sync",
".",
"Mutex",
"{",
"}",
",",
"stopChans",
":",
"[",
"]",
"chan",
"struct",
"{",
"}",
"{",
"}",
",",
"shutdown",
":",
"false",
",",
"}",
",",
"nil",
"\n",
"}"
] |
5,579 | all-5580 | [
"SubImage",
"returns",
"an",
"image",
"representing",
"the",
"portion",
"of",
"the",
"image",
"p",
"visible",
"through",
"r",
".",
"The",
"returned",
"value",
"shares",
"pixels",
"with",
"the",
"original",
"image",
".",
"The",
"returned",
"value",
"is",
"always",
"*",
"ebiten",
".",
"Image",
".",
"If",
"the",
"image",
"is",
"disposed",
"SubImage",
"returns",
"nil",
".",
"In",
"the",
"current",
"Ebiten",
"implementation",
"SubImage",
"is",
"available",
"only",
"as",
"a",
"rendering",
"source",
"."
] | [
"func",
"(",
"i",
"*",
"Image",
")",
"SubImage",
"(",
"r",
"image",
".",
"Rectangle",
")",
"<mask>",
".",
"Image",
"{",
"i",
".",
"copyCheck",
"(",
")",
"\n",
"if",
"i",
".",
"isDisposed",
"(",
")",
"{",
"return",
"nil",
"\n",
"}",
"\n\n",
"img",
":=",
"&",
"Image",
"{",
"mipmap",
":",
"i",
".",
"mipmap",
",",
"filter",
":",
"i",
".",
"filter",
",",
"}",
"\n\n",
"// Keep the original image's reference not to dispose that by GC.",
"if",
"i",
".",
"isSubImage",
"(",
")",
"{",
"img",
".",
"original",
"=",
"i",
".",
"original",
"\n",
"}",
"else",
"{",
"img",
".",
"original",
"=",
"i",
"\n",
"}",
"\n",
"img",
".",
"addr",
"=",
"img",
"\n\n",
"r",
"=",
"r",
".",
"Intersect",
"(",
"i",
".",
"Bounds",
"(",
")",
")",
"\n",
"// Need to check Empty explicitly. See the standard image package implementations.",
"if",
"r",
".",
"Empty",
"(",
")",
"{",
"img",
".",
"bounds",
"=",
"image",
".",
"ZR",
"\n",
"}",
"else",
"{",
"img",
".",
"bounds",
"=",
"r",
"\n",
"}",
"\n",
"return",
"img",
"\n",
"}"
] |
5,580 | all-5581 | [
"Set",
"()",
"is",
"a",
"wrapper",
"around",
"gtk_print_settings_set",
"()",
".",
"TODO",
":",
"Since",
"value",
"can",
"t",
"be",
"nil",
"we",
"can",
"t",
"unset",
"values",
"here",
"."
] | [
"func",
"(",
"ps",
"*",
"PrintSettings",
")",
"Set",
"(",
"key",
",",
"value",
"string",
")",
"{",
"cKey",
":=",
"C",
".",
"CString",
"(",
"key",
")",
"\n",
"defer",
"C",
".",
"<mask>",
"(",
"unsafe",
".",
"Pointer",
"(",
"cKey",
")",
")",
"\n",
"cValue",
":=",
"C",
".",
"CString",
"(",
"value",
")",
"\n",
"defer",
"C",
".",
"free",
"(",
"unsafe",
".",
"Pointer",
"(",
"cValue",
")",
")",
"\n",
"C",
".",
"gtk_print_settings_set",
"(",
"ps",
".",
"native",
"(",
")",
",",
"(",
"*",
"C",
".",
"gchar",
")",
"(",
"cKey",
")",
",",
"(",
"*",
"C",
".",
"gchar",
")",
"(",
"cValue",
")",
")",
"\n",
"}"
] |
5,581 | all-5582 | [
"title",
":",
"assign",
"role",
"to",
"token",
"path",
":",
"/",
"roles",
"/",
"{",
"name",
"}",
"/",
"token",
"method",
":",
"POST",
"consume",
":",
"application",
"/",
"x",
"-",
"www",
"-",
"form",
"-",
"urlencoded",
"responses",
":",
"200",
":",
"Ok",
"400",
":",
"Invalid",
"data",
"401",
":",
"Unauthorized",
"404",
":",
"Role",
"or",
"team",
"token",
"not",
"found"
] | [
"func",
"assignRoleToToken",
"(",
"w",
"http",
".",
"ResponseWriter",
",",
"r",
"*",
"http",
".",
"Request",
",",
"t",
"auth",
".",
"Token",
")",
"error",
"{",
"if",
"!",
"permission",
".",
"Check",
"(",
"t",
",",
"permission",
".",
"PermRoleUpdateAssign",
")",
"{",
"return",
"permission",
".",
"ErrUnauthorized",
"\n",
"}",
"\n",
"tokenID",
":=",
"InputValue",
"(",
"r",
",",
"\"",
"\"",
")",
"\n",
"contextValue",
":=",
"InputValue",
"(",
"r",
",",
"\"",
"\"",
")",
"\n",
"roleName",
":=",
"r",
".",
"URL",
".",
"Query",
"(",
")",
".",
"Get",
"(",
"\"",
"\"",
")",
"\n",
"evt",
",",
"err",
":=",
"event",
".",
"New",
"(",
"&",
"event",
".",
"Opts",
"{",
"Target",
":",
"event",
".",
"Target",
"{",
"<mask>",
":",
"event",
".",
"TargetTypeRole",
",",
"Value",
":",
"roleName",
"}",
",",
"Kind",
":",
"permission",
".",
"PermRoleUpdateAssign",
",",
"Owner",
":",
"t",
",",
"CustomData",
":",
"event",
".",
"FormToCustomData",
"(",
"InputFields",
"(",
"r",
")",
")",
",",
"Allowed",
":",
"event",
".",
"Allowed",
"(",
"permission",
".",
"PermRoleReadEvents",
")",
",",
"}",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"defer",
"func",
"(",
")",
"{",
"evt",
".",
"Done",
"(",
"err",
")",
"}",
"(",
")",
"\n",
"err",
"=",
"canUseRole",
"(",
"t",
",",
"roleName",
",",
"contextValue",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"err",
"=",
"servicemanager",
".",
"TeamToken",
".",
"AddRole",
"(",
"tokenID",
",",
"roleName",
",",
"contextValue",
")",
"\n",
"if",
"err",
"==",
"authTypes",
".",
"ErrTeamTokenNotFound",
"{",
"w",
".",
"WriteHeader",
"(",
"http",
".",
"StatusNotFound",
")",
"\n",
"return",
"nil",
"\n",
"}",
"\n",
"return",
"err",
"\n",
"}"
] |
5,582 | all-5583 | [
"GetSourceAccountBalance",
"retrieves",
"the",
"SourceAccountBalance",
"value",
"from",
"the",
"union",
"returning",
"ok",
"if",
"the",
"union",
"s",
"switch",
"indicated",
"the",
"value",
"is",
"valid",
"."
] | [
"func",
"(",
"u",
"AccountMergeResult",
")",
"GetSourceAccountBalance",
"(",
")",
"(",
"<mask>",
"Int64",
",",
"ok",
"bool",
")",
"{",
"armName",
",",
"_",
":=",
"u",
".",
"ArmForSwitch",
"(",
"int32",
"(",
"u",
".",
"Code",
")",
")",
"\n\n",
"if",
"armName",
"==",
"\"",
"\"",
"{",
"result",
"=",
"*",
"u",
".",
"SourceAccountBalance",
"\n",
"ok",
"=",
"true",
"\n",
"}",
"\n\n",
"return",
"\n",
"}"
] |
5,583 | all-5584 | [
"operator_name",
"::",
"=",
"many",
"different",
"two",
"character",
"encodings",
".",
"::",
"=",
"cv",
"<type",
">",
"::",
"=",
"v",
"<digit",
">",
"<source",
"-",
"name",
">",
"We",
"need",
"to",
"know",
"whether",
"we",
"are",
"in",
"an",
"expression",
"because",
"it",
"affects",
"how",
"we",
"handle",
"template",
"parameters",
"in",
"the",
"type",
"of",
"a",
"cast",
"operator",
"."
] | [
"func",
"(",
"st",
"*",
"state",
")",
"operatorName",
"(",
"inExpression",
"bool",
")",
"(",
"AST",
",",
"int",
")",
"{",
"if",
"len",
"(",
"st",
".",
"str",
")",
"<",
"2",
"{",
"st",
".",
"fail",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"code",
":=",
"st",
".",
"str",
"[",
":",
"2",
"]",
"\n",
"st",
".",
"advance",
"(",
"2",
")",
"\n",
"if",
"code",
"[",
"0",
"]",
"==",
"'v'",
"&&",
"isDigit",
"(",
"code",
"[",
"1",
"]",
")",
"{",
"name",
":=",
"st",
".",
"sourceName",
"(",
")",
"\n",
"return",
"&",
"Operator",
"{",
"Name",
":",
"<mask>",
".",
"(",
"*",
"Name",
")",
".",
"Name",
"}",
",",
"int",
"(",
"code",
"[",
"1",
"]",
"-",
"'0'",
")",
"\n",
"}",
"else",
"if",
"code",
"==",
"\"",
"\"",
"{",
"// Push a nil on templates to indicate that template",
"// parameters will have their template filled in",
"// later.",
"if",
"!",
"inExpression",
"{",
"st",
".",
"templates",
"=",
"append",
"(",
"st",
".",
"templates",
",",
"nil",
")",
"\n",
"}",
"\n\n",
"t",
":=",
"st",
".",
"demangleType",
"(",
"!",
"inExpression",
")",
"\n\n",
"if",
"!",
"inExpression",
"{",
"st",
".",
"templates",
"=",
"st",
".",
"templates",
"[",
":",
"len",
"(",
"st",
".",
"templates",
")",
"-",
"1",
"]",
"\n",
"}",
"\n\n",
"return",
"&",
"Cast",
"{",
"To",
":",
"t",
"}",
",",
"1",
"\n",
"}",
"else",
"if",
"op",
",",
"ok",
":=",
"operators",
"[",
"code",
"]",
";",
"ok",
"{",
"return",
"&",
"Operator",
"{",
"Name",
":",
"op",
".",
"name",
"}",
",",
"op",
".",
"args",
"\n",
"}",
"else",
"{",
"st",
".",
"failEarlier",
"(",
"\"",
"\"",
",",
"2",
")",
"\n",
"panic",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"}"
] |
5,584 | all-5585 | [
"SetBaggageItem",
"belongs",
"to",
"the",
"Span",
"interface"
] | [
"func",
"(",
"s",
"*",
"MockSpan",
")",
"SetBaggageItem",
"(",
"<mask>",
",",
"val",
"string",
")",
"opentracing",
".",
"Span",
"{",
"s",
".",
"Lock",
"(",
")",
"\n",
"defer",
"s",
".",
"Unlock",
"(",
")",
"\n",
"s",
".",
"SpanContext",
"=",
"s",
".",
"SpanContext",
".",
"WithBaggageItem",
"(",
"key",
",",
"val",
")",
"\n",
"return",
"s",
"\n",
"}"
] |
5,585 | all-5586 | [
"defaultLookingDHCPOptions",
":",
"This",
"part",
"is",
"a",
"little",
"annoying",
".",
"If",
"you",
"re",
"running",
"in",
"a",
"region",
"with",
"where",
"there",
"is",
"no",
"default",
"-",
"looking",
"DHCP",
"option",
"set",
"when",
"you",
"create",
"any",
"VPC",
"AWS",
"will",
"create",
"a",
"default",
"-",
"looking",
"DHCP",
"option",
"set",
"for",
"you",
".",
"If",
"you",
"then",
"re",
"-",
"associate",
"or",
"delete",
"the",
"VPC",
"the",
"option",
"set",
"will",
"hang",
"around",
".",
"However",
"if",
"you",
"have",
"a",
"default",
"-",
"looking",
"DHCP",
"option",
"set",
"(",
"even",
"with",
"no",
"default",
"VPC",
")",
"and",
"create",
"a",
"VPC",
"AWS",
"will",
"associate",
"the",
"VPC",
"with",
"the",
"DHCP",
"option",
"set",
"of",
"the",
"default",
"VPC",
".",
"There",
"s",
"no",
"signal",
"as",
"to",
"whether",
"the",
"option",
"set",
"returned",
"is",
"the",
"default",
"or",
"was",
"created",
"along",
"with",
"the",
"VPC",
".",
"Because",
"of",
"this",
"we",
"just",
"skip",
"these",
"during",
"cleanup",
"-",
"there",
"will",
"only",
"ever",
"be",
"one",
"default",
"set",
"per",
"region",
"."
] | [
"func",
"defaultLookingDHCPOptions",
"(",
"dhcp",
"*",
"ec2",
".",
"DhcpOptions",
",",
"region",
"string",
")",
"bool",
"{",
"if",
"len",
"(",
"dhcp",
".",
"Tags",
")",
"!=",
"0",
"{",
"return",
"false",
"\n",
"}",
"\n\n",
"for",
"_",
",",
"conf",
":=",
"range",
"dhcp",
".",
"DhcpConfigurations",
"{",
"switch",
"*",
"conf",
".",
"Key",
"{",
"case",
"\"",
"\"",
":",
"var",
"domain",
"string",
"\n",
"// TODO(akutz): Should this be updated to regions.Default, or is",
"// this relying on the default region for EC2 for North America?",
"// Because EC2's default region changed from us-east-1 to us-east-2",
"// depending on when the account was created.",
"if",
"<mask>",
"==",
"\"",
"\"",
"{",
"domain",
"=",
"\"",
"\"",
"\n",
"}",
"else",
"{",
"domain",
"=",
"region",
"+",
"\"",
"\"",
"\n",
"}",
"\n\n",
"// TODO(vincepri): Investigate this line, seems it might segfault if conf.Values is 0?",
"if",
"len",
"(",
"conf",
".",
"Values",
")",
"!=",
"1",
"||",
"*",
"conf",
".",
"Values",
"[",
"0",
"]",
".",
"Value",
"!=",
"domain",
"{",
"return",
"false",
"\n",
"}",
"\n",
"case",
"\"",
"\"",
":",
"// TODO(vincepri): Same as above.",
"if",
"len",
"(",
"conf",
".",
"Values",
")",
"!=",
"1",
"||",
"*",
"conf",
".",
"Values",
"[",
"0",
"]",
".",
"Value",
"!=",
"\"",
"\"",
"{",
"return",
"false",
"\n",
"}",
"\n",
"default",
":",
"return",
"false",
"\n",
"}",
"\n",
"}",
"\n\n",
"return",
"true",
"\n",
"}"
] |
5,586 | all-5587 | [
"UseTLS",
"enables",
"Transport",
"Layer",
"Security",
"for",
"the",
"connections",
".",
"cert",
"key",
"=",
"Server",
"certificate",
"/",
"private",
"key",
"pair",
".",
"clientCACert",
"=",
"Optional",
"certificate",
"for",
"verifying",
"client",
"certificates",
".",
"All",
"certificates",
"/",
"private",
"keys",
"are",
"in",
"PEM",
"encoded",
"X",
".",
"509",
"format",
"."
] | [
"func",
"(",
"s",
"*",
"Server",
")",
"UseTLS",
"(",
"cert",
",",
"privKey",
",",
"clientCACert",
"[",
"]",
"byte",
")",
"error",
"{",
"tlsCert",
",",
"err",
":=",
"tls",
".",
"X509KeyPair",
"(",
"cert",
",",
"privKey",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"}",
"\n\n",
"c",
",",
"_",
":=",
"pem",
".",
"Decode",
"(",
"<mask>",
")",
"\n",
"if",
"tlsCert",
".",
"Leaf",
",",
"err",
"=",
"x509",
".",
"ParseCertificate",
"(",
"c",
".",
"Bytes",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"}",
"\n\n",
"pool",
":=",
"x509",
".",
"NewCertPool",
"(",
")",
"\n",
"ok",
":=",
"pool",
".",
"AppendCertsFromPEM",
"(",
"clientCACert",
")",
"\n",
"if",
"!",
"ok",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"}",
"\n\n",
"s",
".",
"wsConfig",
".",
"TlsConfig",
"=",
"&",
"tls",
".",
"Config",
"{",
"Certificates",
":",
"[",
"]",
"tls",
".",
"Certificate",
"{",
"tlsCert",
"}",
",",
"ClientCAs",
":",
"pool",
",",
"ClientAuth",
":",
"tls",
".",
"VerifyClientCertIfGiven",
",",
"}",
"\n\n",
"return",
"nil",
"\n",
"}"
] |
5,587 | all-5588 | [
"GetUnitsOk",
"returns",
"a",
"tuple",
"with",
"the",
"Units",
"field",
"if",
"it",
"s",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"and",
"a",
"boolean",
"to",
"check",
"if",
"the",
"value",
"has",
"been",
"set",
"."
] | [
"func",
"(",
"s",
"*",
"Series",
")",
"GetUnitsOk",
"(",
")",
"(",
"UnitPair",
",",
"bool",
")",
"{",
"if",
"s",
"==",
"nil",
"||",
"s",
".",
"Units",
"==",
"nil",
"{",
"return",
"UnitPair",
"{",
"}",
",",
"false",
"\n",
"}",
"\n",
"return",
"*",
"s",
".",
"Units",
",",
"<mask>",
"\n",
"}"
] |
5,588 | all-5589 | [
"NewMockGPUManager",
"creates",
"a",
"new",
"mock",
"instance"
] | [
"func",
"NewMockGPUManager",
"(",
"ctrl",
"*",
"gomock",
".",
"<mask>",
")",
"*",
"MockGPUManager",
"{",
"mock",
":=",
"&",
"MockGPUManager",
"{",
"ctrl",
":",
"ctrl",
"}",
"\n",
"mock",
".",
"recorder",
"=",
"&",
"MockGPUManagerMockRecorder",
"{",
"mock",
"}",
"\n",
"return",
"mock",
"\n",
"}"
] |
5,589 | all-5590 | [
"Count",
"returns",
"COUNT",
"function",
"."
] | [
"func",
"(",
"db",
"*",
"DB",
")",
"Count",
"(",
"column",
"...",
"interface",
"{",
"}",
")",
"*",
"Function",
"{",
"switch",
"len",
"(",
"column",
")",
"{",
"<mask>",
"0",
",",
"1",
":",
"// do nothing.",
"default",
":",
"panic",
"(",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"len",
"(",
"column",
")",
")",
")",
"\n",
"}",
"\n",
"return",
"&",
"Function",
"{",
"Name",
":",
"\"",
"\"",
",",
"Args",
":",
"column",
",",
"}",
"\n",
"}"
] |
5,590 | all-5591 | [
"Warn",
"records",
"the",
"log",
"with",
"warn",
"level"
] | [
"func",
"(",
"l",
"*",
"Logger",
")",
"Warn",
"(",
"args",
"...",
"<mask>",
"{",
"}",
")",
"{",
"l",
".",
"Output",
"(",
"2",
",",
"LevelWarn",
",",
"fmt",
".",
"Sprint",
"(",
"args",
"...",
")",
")",
"\n",
"}"
] |
5,591 | all-5592 | [
"HasHandlerForIdentity",
"verifies",
"if",
"the",
"given",
"identity",
"has",
"a",
"registered",
"handler",
"."
] | [
"func",
"(",
"p",
"*",
"PushCenter",
")",
"HasHandlerForIdentity",
"(",
"identity",
"Identity",
")",
"bool",
"{",
"if",
"identity",
".",
"Name",
"==",
"AllIdentity",
".",
"<mask>",
"{",
"return",
"p",
".",
"defaultHander",
"!=",
"nil",
"\n",
"}",
"\n",
"_",
",",
"exists",
":=",
"p",
".",
"handlers",
"[",
"identity",
".",
"Name",
"]",
"\n",
"return",
"exists",
"\n",
"}"
] |
5,592 | all-5593 | [
"IsFloating",
"is",
"a",
"wrapper",
"around",
"g_object_is_floating",
"()",
"."
] | [
"func",
"(",
"v",
"*",
"<mask>",
")",
"IsFloating",
"(",
")",
"bool",
"{",
"c",
":=",
"C",
".",
"g_object_is_floating",
"(",
"C",
".",
"gpointer",
"(",
"v",
".",
"GObject",
")",
")",
"\n",
"return",
"gobool",
"(",
"c",
")",
"\n",
"}"
] |
5,593 | all-5594 | [
"CVAPI",
"(",
"void",
")",
"cvDilate",
"(",
"const",
"CvArr",
"*",
"src",
"CvArr",
"*",
"dst",
"IplConvKernel",
"*",
"element",
"=",
"NULL",
"int",
"iterations",
"=",
"1",
")",
";",
"/",
"*",
"Erodes",
"an",
"image",
"by",
"using",
"a",
"specific",
"structuring",
"element",
"."
] | [
"func",
"Erode",
"(",
"src",
",",
"dst",
"*",
"IplImage",
",",
"element",
"*",
"IplConvKernel",
",",
"iterations",
"int",
")",
"{",
"C",
".",
"cvErode",
"(",
"unsafe",
".",
"Pointer",
"(",
"src",
")",
",",
"unsafe",
".",
"Pointer",
"(",
"dst",
")",
",",
"(",
"*",
"C",
".",
"IplConvKernel",
")",
"(",
"unsafe",
".",
"Pointer",
"(",
"<mask>",
")",
")",
",",
"C",
".",
"int",
"(",
"iterations",
")",
",",
")",
"\n",
"}"
] |
5,594 | all-5595 | [
"checkStreamSupport",
"checks",
"whether",
"the",
"stream",
"type",
"is",
"supported",
"in",
"the",
"given",
"version",
"."
] | [
"func",
"checkStreamSupport",
"(",
"v",
"*",
"semver",
".",
"Version",
",",
"t",
"streamType",
")",
"bool",
"{",
"nv",
":=",
"&",
"semver",
".",
"Version",
"{",
"Major",
":",
"v",
".",
"Major",
",",
"Minor",
":",
"v",
".",
"Minor",
"}",
"\n",
"for",
"_",
",",
"s",
":=",
"range",
"supportedStream",
"[",
"nv",
".",
"String",
"(",
")",
"]",
"{",
"if",
"s",
"==",
"t",
"{",
"return",
"true",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"<mask>",
"\n",
"}"
] |
5,595 | all-5596 | [
"SetThresholds",
"creates",
"Thresholds",
"mutator"
] | [
"func",
"SetThresholds",
"(",
"low",
",",
"medium",
",",
"high",
"uint32",
")",
"Thresholds",
"{",
"<mask>",
"Thresholds",
"{",
"Low",
":",
"&",
"low",
",",
"Medium",
":",
"&",
"medium",
",",
"High",
":",
"&",
"high",
",",
"}",
"\n",
"}"
] |
5,596 | all-5597 | [
"defaultJobBase",
"configures",
"common",
"parameters",
"currently",
"Agent",
"and",
"Namespace",
"."
] | [
"func",
"(",
"c",
"*",
"ProwConfig",
")",
"defaultJobBase",
"(",
"base",
"*",
"JobBase",
")",
"{",
"if",
"base",
".",
"Agent",
"==",
"\"",
"\"",
"{",
"// Use kubernetes by default",
"base",
".",
"Agent",
"=",
"string",
"(",
"prowapi",
".",
"KubernetesAgent",
")",
"\n",
"}",
"\n",
"if",
"base",
".",
"Namespace",
"==",
"nil",
"||",
"*",
"base",
".",
"Namespace",
"==",
"\"",
"\"",
"{",
"s",
":=",
"c",
".",
"PodNamespace",
"\n",
"base",
".",
"Namespace",
"=",
"&",
"s",
"\n",
"}",
"\n",
"if",
"base",
".",
"Cluster",
"==",
"\"",
"\"",
"{",
"<mask>",
".",
"Cluster",
"=",
"kube",
".",
"DefaultClusterAlias",
"\n",
"}",
"\n",
"}"
] |
5,597 | all-5598 | [
"expandMemorySizeConfig",
"is",
"a",
"helper",
"for",
"expandVirtualMachineConfigSpec",
"that",
"determines",
"if",
"we",
"need",
"to",
"restart",
"the",
"system",
"to",
"increase",
"the",
"amount",
"of",
"available",
"memory",
"on",
"the",
"system",
".",
"This",
"is",
"determined",
"by",
"the",
"current",
"(",
"or",
"in",
"other",
"words",
"the",
"old",
"pre",
"-",
"update",
"setting",
")",
"of",
"memory_hot_add_enabled",
"."
] | [
"func",
"expandMemorySizeConfig",
"(",
"d",
"*",
"schema",
".",
"ResourceData",
")",
"int64",
"{",
"om",
",",
"nm",
":=",
"d",
".",
"GetChange",
"(",
"\"",
"\"",
")",
"\n",
"cha",
",",
"_",
":=",
"d",
".",
"GetChange",
"(",
"\"",
"\"",
")",
"\n",
"currentHotAdd",
":=",
"cha",
".",
"(",
"bool",
")",
"\n",
"oldMem",
":=",
"int64",
"(",
"om",
".",
"(",
"int",
")",
")",
"\n",
"newMem",
":=",
"int64",
"(",
"nm",
".",
"(",
"int",
")",
")",
"\n\n",
"<mask>",
"{",
"case",
"oldMem",
"<",
"newMem",
":",
"// Adding CPUs",
"if",
"!",
"currentHotAdd",
"{",
"log",
".",
"Printf",
"(",
"\"",
"\"",
",",
"resourceVSphereVirtualMachineIDString",
"(",
"d",
")",
")",
"\n",
"d",
".",
"Set",
"(",
"\"",
"\"",
",",
"true",
")",
"\n",
"}",
"\n",
"case",
"oldMem",
">",
"newMem",
":",
"// Removing memory always requires a reboot",
"log",
".",
"Printf",
"(",
"\"",
"\"",
",",
"resourceVSphereVirtualMachineIDString",
"(",
"d",
")",
")",
"\n",
"d",
".",
"Set",
"(",
"\"",
"\"",
",",
"true",
")",
"\n",
"}",
"\n",
"return",
"newMem",
"\n",
"}"
] |
5,598 | all-5599 | [
"clearASMSecretValue",
"cycles",
"through",
"the",
"collection",
"of",
"secret",
"value",
"data",
"and",
"removes",
"them",
"from",
"the",
"task"
] | [
"func",
"(",
"secret",
"*",
"ASMSecretResource",
")",
"clearASMSecretValue",
"(",
")",
"{",
"secret",
".",
"lock",
".",
"Lock",
"(",
")",
"\n",
"defer",
"secret",
".",
"<mask>",
".",
"Unlock",
"(",
")",
"\n\n",
"for",
"key",
":=",
"range",
"secret",
".",
"secretData",
"{",
"delete",
"(",
"secret",
".",
"secretData",
",",
"key",
")",
"\n",
"}",
"\n",
"}"
] |
5,599 | all-5600 | [
"NewBatchingWriter",
"creates",
"new",
"BatchingWriter",
".",
"If",
"WithScalingInterval",
"is",
"not",
"specified",
"DefaultScalingInterval",
"value",
"is",
"used",
".",
"If",
"WithInstanceLimit",
"is",
"not",
"specified",
"DefaultInstanceLimit",
"is",
"used",
"."
] | [
"func",
"NewBatchingWriter",
"(",
"log",
"ttnlog",
".",
"Interface",
",",
"w",
"BatchPointsWriter",
",",
"opts",
"...",
"BatchingWriterOption",
")",
"*",
"BatchingWriter",
"{",
"bw",
":=",
"&",
"BatchingWriter",
"{",
"log",
":",
"<mask>",
",",
"writer",
":",
"w",
",",
"scalingInterval",
":",
"DefaultScalingInterval",
",",
"limit",
":",
"DefaultInstanceLimit",
",",
"pointChans",
":",
"make",
"(",
"map",
"[",
"influxdb",
".",
"BatchPointsConfig",
"]",
"chan",
"*",
"batchPoint",
")",
",",
"}",
"\n",
"for",
"_",
",",
"opt",
":=",
"range",
"opts",
"{",
"opt",
"(",
"bw",
")",
"\n",
"}",
"\n",
"bw",
".",
"log",
"=",
"bw",
".",
"log",
".",
"WithFields",
"(",
"ttnlog",
".",
"Fields",
"{",
"\"",
"\"",
":",
"bw",
".",
"limit",
",",
"\"",
"\"",
":",
"bw",
".",
"scalingInterval",
",",
"}",
")",
"\n",
"return",
"bw",
"\n",
"}"
] |
Subsets and Splits
No saved queries yet
Save your SQL queries to embed, download, and access them later. Queries will appear here once saved.