id
int32 0
25.3k
| idx
stringlengths 5
9
| nl_tokens
sequencelengths 1
418
| pl_tokens
sequencelengths 22
4.98k
|
---|---|---|---|
22,600 | all-22601 | [
"Extract",
"unique",
"audit",
"entries",
"from",
"the",
"newly",
"received",
"list",
"by",
"comparing",
"the",
"href",
"of",
"audit",
"entries",
"in",
"the",
"old",
"list",
"."
] | [
"func",
"extractUnique",
"(",
"oldEntries",
",",
"newEntries",
"[",
"]",
"*",
"cm15",
".",
"AuditEntry",
")",
"[",
"]",
"*",
"cm15",
".",
"AuditEntry",
"{",
"var",
"uniqueEntries",
"=",
"make",
"(",
"[",
"]",
"*",
"cm15",
".",
"AuditEntry",
",",
"0",
")",
"\n",
"<mask>",
"oldHrefs",
"=",
"make",
"(",
"[",
"]",
"string",
",",
"len",
"(",
"oldEntries",
")",
")",
"\n",
"for",
"i",
",",
"e",
":=",
"range",
"oldEntries",
"{",
"oldHrefs",
"[",
"i",
"]",
"=",
"getHref",
"(",
"e",
")",
"\n",
"}",
"\n",
"for",
"_",
",",
"newEntry",
":=",
"range",
"newEntries",
"{",
"if",
"!",
"stringInSlice",
"(",
"getHref",
"(",
"newEntry",
")",
",",
"oldHrefs",
")",
"{",
"uniqueEntries",
"=",
"append",
"(",
"uniqueEntries",
",",
"newEntry",
")",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"uniqueEntries",
"\n",
"}"
] |
22,601 | all-22602 | [
"produceKVs",
"picks",
"up",
"ranges",
"from",
"rangeCh",
"generates",
"KV",
"lists",
"and",
"sends",
"them",
"to",
"kvChan",
"."
] | [
"func",
"(",
"st",
"*",
"Stream",
")",
"produceKVs",
"(",
"ctx",
"context",
".",
"Context",
")",
"error",
"{",
"var",
"size",
"int",
"\n",
"var",
"txn",
"*",
"Txn",
"\n",
"if",
"st",
".",
"readTs",
">",
"0",
"{",
"txn",
"=",
"st",
".",
"db",
".",
"NewTransactionAt",
"(",
"st",
".",
"readTs",
",",
"false",
")",
"\n",
"}",
"else",
"{",
"txn",
"=",
"st",
".",
"db",
".",
"NewTransaction",
"(",
"false",
")",
"\n",
"}",
"\n",
"defer",
"txn",
".",
"Discard",
"(",
")",
"\n\n",
"iterate",
":=",
"func",
"(",
"kr",
"keyRange",
")",
"error",
"{",
"iterOpts",
":=",
"DefaultIteratorOptions",
"\n",
"iterOpts",
".",
"AllVersions",
"=",
"true",
"\n",
"iterOpts",
".",
"Prefix",
"=",
"st",
".",
"Prefix",
"\n",
"iterOpts",
".",
"PrefetchValues",
"=",
"false",
"\n",
"itr",
":=",
"txn",
".",
"NewIterator",
"(",
"iterOpts",
")",
"\n",
"defer",
"itr",
".",
"Close",
"(",
")",
"\n\n",
"outList",
":=",
"new",
"(",
"pb",
".",
"KVList",
")",
"\n",
"var",
"prevKey",
"[",
"]",
"byte",
"\n",
"for",
"itr",
".",
"Seek",
"(",
"kr",
".",
"left",
")",
";",
"itr",
".",
"Valid",
"(",
")",
";",
"{",
"// it.Valid would only return true for keys with the provided Prefix in iterOpts.",
"<mask>",
":=",
"itr",
".",
"Item",
"(",
")",
"\n",
"if",
"bytes",
".",
"Equal",
"(",
"item",
".",
"Key",
"(",
")",
",",
"prevKey",
")",
"{",
"itr",
".",
"Next",
"(",
")",
"\n",
"continue",
"\n",
"}",
"\n",
"prevKey",
"=",
"append",
"(",
"prevKey",
"[",
":",
"0",
"]",
",",
"item",
".",
"Key",
"(",
")",
"...",
")",
"\n\n",
"// Check if we reached the end of the key range.",
"if",
"len",
"(",
"kr",
".",
"right",
")",
">",
"0",
"&&",
"bytes",
".",
"Compare",
"(",
"item",
".",
"Key",
"(",
")",
",",
"kr",
".",
"right",
")",
">=",
"0",
"{",
"break",
"\n",
"}",
"\n",
"// Check if we should pick this key.",
"if",
"st",
".",
"ChooseKey",
"!=",
"nil",
"&&",
"!",
"st",
".",
"ChooseKey",
"(",
"item",
")",
"{",
"continue",
"\n",
"}",
"\n\n",
"// Now convert to key value.",
"list",
",",
"err",
":=",
"st",
".",
"KeyToList",
"(",
"item",
".",
"KeyCopy",
"(",
"nil",
")",
",",
"itr",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"if",
"list",
"==",
"nil",
"||",
"len",
"(",
"list",
".",
"Kv",
")",
"==",
"0",
"{",
"continue",
"\n",
"}",
"\n",
"outList",
".",
"Kv",
"=",
"append",
"(",
"outList",
".",
"Kv",
",",
"list",
".",
"Kv",
"...",
")",
"\n",
"size",
"+=",
"list",
".",
"Size",
"(",
")",
"\n",
"if",
"size",
">=",
"pageSize",
"{",
"st",
".",
"kvChan",
"<-",
"outList",
"\n",
"outList",
"=",
"new",
"(",
"pb",
".",
"KVList",
")",
"\n",
"size",
"=",
"0",
"\n",
"}",
"\n",
"}",
"\n",
"if",
"len",
"(",
"outList",
".",
"Kv",
")",
">",
"0",
"{",
"st",
".",
"kvChan",
"<-",
"outList",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}",
"\n\n",
"for",
"{",
"select",
"{",
"case",
"kr",
",",
"ok",
":=",
"<-",
"st",
".",
"rangeCh",
":",
"if",
"!",
"ok",
"{",
"// Done with the keys.",
"return",
"nil",
"\n",
"}",
"\n",
"if",
"err",
":=",
"iterate",
"(",
"kr",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"case",
"<-",
"ctx",
".",
"Done",
"(",
")",
":",
"return",
"ctx",
".",
"Err",
"(",
")",
"\n",
"}",
"\n",
"}",
"\n",
"}"
] |
22,602 | all-22603 | [
"TODO",
"(",
"jrick",
")",
"Pangolayout",
"/",
"*",
"func",
"(",
"v",
"*",
"Entry",
")",
"GetLayout",
"()",
"{",
"}",
"GetLayoutOffsets",
"()",
"is",
"a",
"wrapper",
"around",
"gtk_entry_get_layout_offsets",
"()",
"."
] | [
"func",
"(",
"v",
"*",
"<mask>",
")",
"GetLayoutOffsets",
"(",
")",
"(",
"x",
",",
"y",
"int",
")",
"{",
"var",
"gx",
",",
"gy",
"C",
".",
"gint",
"\n",
"C",
".",
"gtk_entry_get_layout_offsets",
"(",
"v",
".",
"native",
"(",
")",
",",
"&",
"gx",
",",
"&",
"gy",
")",
"\n",
"return",
"int",
"(",
"gx",
")",
",",
"int",
"(",
"gy",
")",
"\n",
"}"
] |
22,603 | all-22604 | [
"WithAccuracy",
"mock",
"accuracy",
"."
] | [
"func",
"(",
"p",
"SetGeolocationOverrideParams",
")",
"WithAccuracy",
"(",
"accuracy",
"float64",
")",
"*",
"SetGeolocationOverrideParams",
"{",
"p",
".",
"Accuracy",
"=",
"accuracy",
"\n",
"<mask>",
"&",
"p",
"\n",
"}"
] |
22,604 | all-22605 | [
"sendHeartbeat",
"sends",
"a",
"heartbeat",
"RPC",
"to",
"the",
"given",
"peer",
"."
] | [
"func",
"(",
"r",
"*",
"raft",
")",
"sendHeartbeat",
"(",
"to",
"uint64",
",",
"ctx",
"[",
"]",
"byte",
")",
"{",
"// Attach the commit as min(to.matched, r.committed).",
"// When the leader sends out heartbeat message,",
"// the receiver(follower) might not be matched with the leader",
"// or it might not have all the committed entries.",
"// The leader MUST NOT forward the follower's commit to",
"// an unmatched index.",
"commit",
":=",
"min",
"(",
"r",
".",
"getProgress",
"(",
"to",
")",
".",
"Match",
",",
"r",
".",
"raftLog",
".",
"committed",
")",
"\n",
"m",
":=",
"pb",
".",
"Message",
"{",
"To",
":",
"to",
",",
"Type",
":",
"pb",
".",
"MsgHeartbeat",
",",
"Commit",
":",
"commit",
",",
"<mask>",
":",
"ctx",
",",
"}",
"\n\n",
"r",
".",
"send",
"(",
"m",
")",
"\n",
"}"
] |
22,605 | all-22606 | [
"MarshalJSON",
"supports",
"json",
".",
"Marshaler",
"interface"
] | [
"func",
"(",
"v",
"GetEventListenersParams",
")",
"MarshalJSON",
"(",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"w",
":=",
"jwriter",
".",
"<mask>",
"{",
"}",
"\n",
"easyjsonC5a4559bEncodeGithubComChromedpCdprotoDomdebugger9",
"(",
"&",
"w",
",",
"v",
")",
"\n",
"return",
"w",
".",
"Buffer",
".",
"BuildBytes",
"(",
")",
",",
"w",
".",
"Error",
"\n",
"}"
] |
22,606 | all-22607 | [
"title",
":",
"logout",
"path",
":",
"/",
"users",
"/",
"tokens",
"method",
":",
"DELETE",
"responses",
":",
"200",
":",
"Ok"
] | [
"func",
"logout",
"(",
"w",
"http",
".",
"ResponseWriter",
",",
"r",
"*",
"http",
".",
"<mask>",
",",
"t",
"auth",
".",
"Token",
")",
"(",
"err",
"error",
")",
"{",
"return",
"app",
".",
"AuthScheme",
".",
"Logout",
"(",
"t",
".",
"GetValue",
"(",
")",
")",
"\n",
"}"
] |
22,607 | all-22608 | [
"Ask",
"will",
"call",
"output",
"with",
"message",
"then",
"wait",
"for",
"Reader",
"to",
"print",
"newline",
"(",
"\\",
"n",
")",
".",
"If",
"Reader",
"is",
"os",
".",
"Stdin",
"then",
"that",
"is",
"when",
"ever",
"a",
"user",
"presses",
"[",
"enter",
"]",
".",
"It",
"will",
"clean",
"the",
"response",
"by",
"removing",
"any",
"carriage",
"returns",
"and",
"new",
"lines",
"that",
"if",
"finds",
".",
"Then",
"it",
"will",
"trim",
"the",
"message",
"using",
"the",
"trim",
"variable",
".",
"Use",
"and",
"empty",
"string",
"to",
"specify",
"you",
"do",
"not",
"want",
"to",
"trim",
".",
"If",
"a",
"message",
"is",
"not",
"used",
"(",
")",
"then",
"it",
"will",
"not",
"prompt",
"user",
"before",
"waiting",
"on",
"a",
"response",
"."
] | [
"func",
"(",
"ui",
"*",
"BasicUI",
")",
"Ask",
"(",
"message",
",",
"trim",
"string",
")",
"(",
"string",
",",
"error",
")",
"{",
"if",
"<mask>",
"!=",
"\"",
"\"",
"{",
"ui",
".",
"Output",
"(",
"message",
")",
"\n",
"}",
"\n",
"reader",
":=",
"bufio",
".",
"NewReader",
"(",
"ui",
".",
"Reader",
")",
"\n",
"res",
",",
"err",
":=",
"reader",
".",
"ReadString",
"(",
"'\\n'",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"\"",
"\"",
",",
"err",
"\n",
"}",
"\n",
"res",
"=",
"strings",
".",
"Replace",
"(",
"res",
",",
"\"",
"\\r",
"\"",
",",
"\"",
"\"",
",",
"-",
"1",
")",
"//this will only be useful under windows",
"\n",
"res",
"=",
"strings",
".",
"Replace",
"(",
"res",
",",
"\"",
"\\n",
"\"",
",",
"\"",
"\"",
",",
"-",
"1",
")",
"\n",
"res",
"=",
"strings",
".",
"Trim",
"(",
"res",
",",
"trim",
")",
"\n",
"return",
"res",
",",
"err",
"\n",
"}"
] |
22,608 | all-22609 | [
"AgentAfterChannelTopUp",
"updates",
"deposit",
"of",
"a",
"channel",
"."
] | [
"func",
"(",
"w",
"*",
"Worker",
")",
"AgentAfterChannelTopUp",
"(",
"job",
"*",
"<mask>",
".",
"Job",
")",
"error",
"{",
"return",
"w",
".",
"afterChannelTopUp",
"(",
"job",
",",
"data",
".",
"JobAgentAfterChannelTopUp",
")",
"\n",
"}"
] |
22,609 | all-22610 | [
"GetZpool",
"retrieves",
"a",
"single",
"ZFS",
"zpool",
"by",
"name",
"."
] | [
"func",
"GetZpool",
"(",
"name",
"string",
")",
"(",
"*",
"Zpool",
",",
"error",
")",
"{",
"args",
":=",
"zpoolArgs",
"\n",
"args",
"=",
"append",
"(",
"args",
",",
"name",
")",
"\n",
"out",
",",
"err",
":=",
"zpool",
"(",
"args",
"...",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"// there is no -H",
"out",
"=",
"out",
"[",
"1",
":",
"]",
"\n\n",
"z",
":=",
"&",
"Zpool",
"{",
"Name",
":",
"<mask>",
"}",
"\n",
"for",
"_",
",",
"line",
":=",
"range",
"out",
"{",
"if",
"err",
":=",
"z",
".",
"parseLine",
"(",
"line",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"}",
"\n\n",
"return",
"z",
",",
"nil",
"\n",
"}"
] |
22,610 | all-22611 | [
"GetQueryOk",
"returns",
"a",
"tuple",
"with",
"the",
"Query",
"field",
"if",
"it",
"s",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"and",
"a",
"boolean",
"to",
"check",
"if",
"the",
"value",
"has",
"been",
"set",
"."
] | [
"func",
"(",
"l",
"*",
"LogStreamDefinition",
")",
"GetQueryOk",
"(",
")",
"(",
"string",
",",
"bool",
")",
"{",
"if",
"l",
"==",
"nil",
"||",
"l",
".",
"Query",
"==",
"nil",
"{",
"return",
"\"",
"\"",
",",
"false",
"\n",
"}",
"\n",
"return",
"*",
"l",
".",
"<mask>",
",",
"true",
"\n",
"}"
] |
22,611 | all-22612 | [
"UpdateConfig",
"updates",
"the",
"given",
"keys",
"in",
"the",
"given",
"table",
".",
"Config",
"keys",
"set",
"to",
"empty",
"values",
"will",
"be",
"deleted",
"."
] | [
"func",
"UpdateConfig",
"(",
"tx",
"*",
"sql",
".",
"Tx",
",",
"table",
"string",
",",
"values",
"map",
"[",
"string",
"]",
"string",
")",
"error",
"{",
"changes",
":=",
"map",
"[",
"string",
"]",
"string",
"{",
"}",
"\n",
"deletes",
":=",
"[",
"]",
"string",
"{",
"}",
"\n\n",
"for",
"key",
",",
"value",
":=",
"range",
"values",
"{",
"if",
"value",
"==",
"\"",
"\"",
"{",
"deletes",
"=",
"append",
"(",
"deletes",
",",
"key",
")",
"\n",
"continue",
"\n",
"}",
"\n",
"<mask>",
"[",
"key",
"]",
"=",
"value",
"\n",
"}",
"\n\n",
"err",
":=",
"upsertConfig",
"(",
"tx",
",",
"table",
",",
"changes",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"errors",
".",
"Wrap",
"(",
"err",
",",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"err",
"=",
"deleteConfig",
"(",
"tx",
",",
"table",
",",
"deletes",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"errors",
".",
"Wrap",
"(",
"err",
",",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"return",
"nil",
"\n",
"}"
] |
22,612 | all-22613 | [
"--------------------------------------------------------------------",
"Send",
"a",
"request",
"to",
"the",
"broker",
"to",
"join",
"group",
"on",
"rebalance",
"()"
] | [
"func",
"(",
"c",
"*",
"Consumer",
")",
"joinGroup",
"(",
")",
"(",
"*",
"balancer",
",",
"error",
")",
"{",
"memberID",
",",
"_",
":=",
"c",
".",
"membership",
"(",
")",
"\n",
"req",
":=",
"&",
"sarama",
".",
"JoinGroupRequest",
"{",
"GroupId",
":",
"c",
".",
"groupID",
",",
"MemberId",
":",
"memberID",
",",
"SessionTimeout",
":",
"int32",
"(",
"c",
".",
"client",
".",
"config",
".",
"Group",
".",
"Session",
".",
"Timeout",
"/",
"time",
".",
"Millisecond",
")",
",",
"ProtocolType",
":",
"\"",
"\"",
",",
"}",
"\n\n",
"meta",
":=",
"&",
"sarama",
".",
"ConsumerGroupMemberMetadata",
"{",
"<mask>",
":",
"1",
",",
"Topics",
":",
"append",
"(",
"c",
".",
"coreTopics",
",",
"c",
".",
"extraTopics",
"...",
")",
",",
"UserData",
":",
"c",
".",
"client",
".",
"config",
".",
"Group",
".",
"Member",
".",
"UserData",
",",
"}",
"\n",
"err",
":=",
"req",
".",
"AddGroupProtocolMetadata",
"(",
"string",
"(",
"StrategyRange",
")",
",",
"meta",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"err",
"=",
"req",
".",
"AddGroupProtocolMetadata",
"(",
"string",
"(",
"StrategyRoundRobin",
")",
",",
"meta",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"broker",
",",
"err",
":=",
"c",
".",
"client",
".",
"Coordinator",
"(",
"c",
".",
"groupID",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"c",
".",
"closeCoordinator",
"(",
"broker",
",",
"err",
")",
"\n",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"resp",
",",
"err",
":=",
"broker",
".",
"JoinGroup",
"(",
"req",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"c",
".",
"closeCoordinator",
"(",
"broker",
",",
"err",
")",
"\n",
"return",
"nil",
",",
"err",
"\n",
"}",
"else",
"if",
"resp",
".",
"Err",
"!=",
"sarama",
".",
"ErrNoError",
"{",
"c",
".",
"closeCoordinator",
"(",
"broker",
",",
"resp",
".",
"Err",
")",
"\n",
"return",
"nil",
",",
"resp",
".",
"Err",
"\n",
"}",
"\n\n",
"var",
"strategy",
"*",
"balancer",
"\n",
"if",
"resp",
".",
"LeaderId",
"==",
"resp",
".",
"MemberId",
"{",
"members",
",",
"err",
":=",
"resp",
".",
"GetMembers",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"strategy",
",",
"err",
"=",
"newBalancerFromMeta",
"(",
"c",
".",
"client",
",",
"Strategy",
"(",
"resp",
".",
"GroupProtocol",
")",
",",
"members",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"}",
"\n\n",
"c",
".",
"membershipMu",
".",
"Lock",
"(",
")",
"\n",
"c",
".",
"memberID",
"=",
"resp",
".",
"MemberId",
"\n",
"c",
".",
"generationID",
"=",
"resp",
".",
"GenerationId",
"\n",
"c",
".",
"membershipMu",
".",
"Unlock",
"(",
")",
"\n\n",
"return",
"strategy",
",",
"nil",
"\n",
"}"
] |
22,613 | all-22614 | [
"UnmarshalJSON",
"supports",
"json",
".",
"Unmarshaler",
"interface"
] | [
"func",
"(",
"v",
"*",
"SetEffectivePropertyValueForNodeParams",
")",
"UnmarshalJSON",
"(",
"data",
"[",
"]",
"byte",
")",
"error",
"{",
"r",
":=",
"jlexer",
".",
"Lexer",
"{",
"Data",
":",
"data",
"}",
"\n",
"easyjsonC5a4559bDecodeGithubComChromedpCdprotoCss21",
"(",
"&",
"r",
",",
"v",
")",
"\n",
"return",
"r",
".",
"<mask>",
"(",
")",
"\n",
"}"
] |
22,614 | all-22615 | [
"Parse",
"native",
"names",
"into",
"go",
"parameter",
"names"
] | [
"func",
"parseParamName",
"(",
"name",
"string",
")",
"string",
"{",
"if",
"name",
"==",
"\"",
"\"",
"{",
"return",
"\"",
"\"",
"\n",
"}",
"\n",
"if",
"name",
"==",
"\"",
"\"",
"{",
"return",
"\"",
"\"",
"\n",
"}",
"\n",
"if",
"<mask>",
"==",
"\"",
"\"",
"{",
"return",
"\"",
"\"",
"\n",
"}",
"\n",
"p",
":=",
"partsRegexp",
".",
"ReplaceAllString",
"(",
"name",
",",
"\"",
"\"",
")",
"\n",
"return",
"inflect",
".",
"CamelizeDownFirst",
"(",
"p",
")",
"\n",
"}"
] |
22,615 | all-22616 | [
"GetClient",
"creates",
"the",
"ECR",
"SDK",
"client",
"based",
"on",
"the",
"authdata"
] | [
"func",
"(",
"factory",
"*",
"ecrFactory",
")",
"GetClient",
"(",
"authData",
"*",
"apicontainer",
".",
"ECRAuthData",
")",
"(",
"ECRClient",
",",
"error",
")",
"{",
"clientConfig",
",",
"<mask>",
":=",
"getClientConfig",
"(",
"factory",
".",
"httpClient",
",",
"authData",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"&",
"ecrClient",
"{",
"}",
",",
"err",
"\n",
"}",
"\n\n",
"return",
"factory",
".",
"newClient",
"(",
"clientConfig",
")",
",",
"nil",
"\n",
"}"
] |
22,616 | all-22617 | [
"bind",
"a",
"range",
"within",
"a",
"buffer",
"object",
"to",
"an",
"indexed",
"buffer",
"target"
] | [
"func",
"BindBufferRange",
"(",
"target",
"uint32",
",",
"index",
"uint32",
",",
"buffer",
"uint32",
",",
"offset",
"int",
",",
"<mask>",
"int",
")",
"{",
"C",
".",
"glowBindBufferRange",
"(",
"gpBindBufferRange",
",",
"(",
"C",
".",
"GLenum",
")",
"(",
"target",
")",
",",
"(",
"C",
".",
"GLuint",
")",
"(",
"index",
")",
",",
"(",
"C",
".",
"GLuint",
")",
"(",
"buffer",
")",
",",
"(",
"C",
".",
"GLintptr",
")",
"(",
"offset",
")",
",",
"(",
"C",
".",
"GLsizeiptr",
")",
"(",
"size",
")",
")",
"\n",
"}"
] |
22,617 | all-22618 | [
"canRemove",
"returns",
"whether",
"this",
"peer",
"can",
"be",
"safely",
"removed",
"from",
"the",
"root",
"peer",
"list",
"."
] | [
"func",
"(",
"p",
"*",
"Peer",
")",
"canRemove",
"(",
")",
"bool",
"{",
"p",
".",
"RLock",
"(",
")",
"\n",
"<mask>",
":=",
"len",
"(",
"p",
".",
"inboundConnections",
")",
"+",
"len",
"(",
"p",
".",
"outboundConnections",
")",
"+",
"int",
"(",
"p",
".",
"scCount",
")",
"\n",
"p",
".",
"RUnlock",
"(",
")",
"\n",
"return",
"count",
"==",
"0",
"\n",
"}"
] |
22,618 | all-22619 | [
"Flush",
"flushes",
"the",
"Client",
"s",
"buffer",
"."
] | [
"func",
"(",
"c",
"*",
"Client",
")",
"Flush",
"(",
")",
"{",
"if",
"c",
".",
"muted",
"{",
"return",
"\n",
"}",
"\n",
"c",
".",
"<mask>",
".",
"mu",
".",
"Lock",
"(",
")",
"\n",
"c",
".",
"conn",
".",
"flush",
"(",
"0",
")",
"\n",
"c",
".",
"conn",
".",
"mu",
".",
"Unlock",
"(",
")",
"\n",
"}"
] |
22,619 | all-22620 | [
"processCgoExported",
"marks",
"functions",
"as",
"used",
"if",
"they",
"re",
"being",
"exported",
"to",
"cgo",
"."
] | [
"func",
"(",
"c",
"*",
"Checker",
")",
"processCgoExported",
"(",
"pkg",
"*",
"lint",
".",
"Pkg",
",",
"node",
"ast",
".",
"Node",
")",
"{",
"if",
"node",
",",
"ok",
":=",
"node",
".",
"(",
"*",
"ast",
".",
"FuncDecl",
")",
";",
"ok",
"{",
"if",
"node",
".",
"Doc",
"==",
"nil",
"{",
"return",
"\n",
"}",
"\n",
"for",
"_",
",",
"cmt",
":=",
"range",
"node",
".",
"Doc",
".",
"List",
"{",
"if",
"!",
"strings",
".",
"HasPrefix",
"(",
"cmt",
".",
"Text",
",",
"\"",
"\"",
")",
"{",
"return",
"\n",
"}",
"\n",
"obj",
":=",
"pkg",
".",
"TypesInfo",
".",
"ObjectOf",
"(",
"<mask>",
".",
"Name",
")",
"\n",
"c",
".",
"graph",
".",
"roots",
"=",
"append",
"(",
"c",
".",
"graph",
".",
"roots",
",",
"c",
".",
"graph",
".",
"getNode",
"(",
"obj",
")",
")",
"\n",
"}",
"\n",
"}",
"\n",
"}"
] |
22,620 | all-22621 | [
"String",
"returns",
"the",
"name",
"of",
"e"
] | [
"func",
"(",
"e",
"AccountMergeResultCode",
")",
"<mask>",
"(",
")",
"string",
"{",
"name",
",",
"_",
":=",
"accountMergeResultCodeMap",
"[",
"int32",
"(",
"e",
")",
"]",
"\n",
"return",
"name",
"\n",
"}"
] |
22,621 | all-22622 | [
"Do",
"-"
] | [
"func",
"(",
"s",
"*",
"MockClientDoer",
")",
"Do",
"(",
"rq",
"*",
"http",
".",
"<mask>",
")",
"(",
"rs",
"*",
"http",
".",
"Response",
",",
"e",
"error",
")",
"{",
"s",
".",
"Req",
"=",
"rq",
"\n",
"rs",
"=",
"s",
".",
"Res",
"\n",
"e",
"=",
"s",
".",
"Err",
"\n",
"return",
"\n",
"}"
] |
22,622 | all-22623 | [
"GetName",
"()",
"is",
"a",
"wrapper",
"around",
"gdk_display_get_name",
"()",
"."
] | [
"func",
"(",
"v",
"*",
"Display",
")",
"GetName",
"(",
")",
"(",
"string",
",",
"error",
")",
"{",
"c",
":=",
"C",
".",
"gdk_display_get_name",
"(",
"v",
".",
"native",
"(",
")",
")",
"\n",
"if",
"c",
"==",
"nil",
"{",
"return",
"\"",
"\"",
",",
"nilPtrErr",
"\n",
"}",
"\n",
"return",
"C",
".",
"GoString",
"(",
"(",
"*",
"C",
".",
"<mask>",
")",
"(",
"c",
")",
")",
",",
"nil",
"\n",
"}"
] |
22,623 | all-22624 | [
"ReadResponse",
"reads",
"a",
"server",
"response",
"into",
"the",
"received",
"o",
"."
] | [
"func",
"(",
"o",
"*",
"FindVmsByFiltersReader",
")",
"ReadResponse",
"(",
"response",
"runtime",
".",
"ClientResponse",
",",
"consumer",
"runtime",
".",
"Consumer",
")",
"(",
"interface",
"{",
"}",
",",
"error",
")",
"{",
"switch",
"response",
".",
"Code",
"(",
")",
"{",
"case",
"200",
":",
"result",
":=",
"NewFindVmsByFiltersOK",
"(",
")",
"\n",
"if",
"err",
":=",
"result",
".",
"readResponse",
"(",
"response",
",",
"consumer",
",",
"o",
".",
"formats",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"return",
"result",
",",
"nil",
"\n\n",
"case",
"404",
":",
"result",
":=",
"NewFindVmsByFiltersNotFound",
"(",
")",
"\n",
"if",
"err",
":=",
"result",
".",
"readResponse",
"(",
"response",
",",
"consumer",
",",
"o",
".",
"formats",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"return",
"nil",
",",
"result",
"\n\n",
"default",
":",
"result",
":=",
"NewFindVmsByFiltersDefault",
"(",
"response",
".",
"Code",
"(",
")",
")",
"\n",
"if",
"err",
":=",
"result",
".",
"readResponse",
"(",
"response",
",",
"<mask>",
",",
"o",
".",
"formats",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"return",
"nil",
",",
"result",
"\n",
"}",
"\n",
"}"
] |
22,624 | all-22625 | [
"GetIntegrationSlack",
"gets",
"all",
"the",
"Slack",
"Integrations",
"from",
"the",
"system",
"."
] | [
"func",
"(",
"client",
"*",
"Client",
")",
"GetIntegrationSlack",
"(",
")",
"(",
"*",
"IntegrationSlackRequest",
",",
"error",
")",
"{",
"var",
"out",
"IntegrationSlackRequest",
"\n",
"if",
"err",
":=",
"client",
".",
"doJsonRequest",
"(",
"\"",
"\"",
",",
"\"",
"\"",
",",
"nil",
",",
"&",
"<mask>",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"return",
"&",
"out",
",",
"nil",
"\n",
"}"
] |
22,625 | all-22626 | [
"Cleanup",
"performs",
"resource",
"cleanup"
] | [
"func",
"(",
"vol",
"*",
"VolumeResource",
")",
"Cleanup",
"(",
")",
"error",
"{",
"// Enable volume clean up if it's task scoped",
"if",
"vol",
".",
"VolumeConfig",
".",
"Scope",
"!=",
"TaskScope",
"{",
"seelog",
".",
"Debugf",
"(",
"\"",
"\"",
",",
"vol",
".",
"Name",
")",
"\n",
"return",
"nil",
"\n",
"}",
"\n\n",
"seelog",
".",
"Debugf",
"(",
"\"",
"\"",
",",
"vol",
".",
"<mask>",
")",
"\n",
"err",
":=",
"vol",
".",
"client",
".",
"RemoveVolume",
"(",
"vol",
".",
"ctx",
",",
"vol",
".",
"VolumeConfig",
".",
"DockerVolumeName",
",",
"dockerclient",
".",
"RemoveVolumeTimeout",
")",
"\n\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
] |
22,626 | all-22627 | [
"GetNameOk",
"returns",
"a",
"tuple",
"with",
"the",
"Name",
"field",
"if",
"it",
"s",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"and",
"a",
"boolean",
"to",
"check",
"if",
"the",
"value",
"has",
"been",
"set",
"."
] | [
"func",
"(",
"m",
"*",
"Monitor",
")",
"GetNameOk",
"(",
")",
"(",
"string",
",",
"bool",
")",
"{",
"if",
"m",
"==",
"nil",
"||",
"m",
".",
"Name",
"==",
"nil",
"{",
"return",
"\"",
"\"",
",",
"false",
"\n",
"}",
"\n",
"return",
"*",
"m",
".",
"Name",
",",
"<mask>",
"\n",
"}"
] |
22,627 | all-22628 | [
"IgnoreUnexported",
"returns",
"an",
"Option",
"that",
"only",
"ignores",
"the",
"immediate",
"unexported",
"fields",
"of",
"a",
"struct",
"including",
"anonymous",
"fields",
"of",
"unexported",
"types",
".",
"In",
"particular",
"unexported",
"fields",
"within",
"the",
"struct",
"s",
"exported",
"fields",
"of",
"struct",
"types",
"including",
"anonymous",
"fields",
"will",
"not",
"be",
"ignored",
"unless",
"the",
"type",
"of",
"the",
"field",
"itself",
"is",
"also",
"passed",
"to",
"IgnoreUnexported",
".",
"Avoid",
"ignoring",
"unexported",
"fields",
"of",
"a",
"type",
"which",
"you",
"do",
"not",
"control",
"(",
"i",
".",
"e",
".",
"a",
"type",
"from",
"another",
"repository",
")",
"as",
"changes",
"to",
"the",
"implementation",
"of",
"such",
"types",
"may",
"change",
"how",
"the",
"comparison",
"behaves",
".",
"Prefer",
"a",
"custom",
"Comparer",
"instead",
"."
] | [
"func",
"IgnoreUnexported",
"(",
"typs",
"...",
"<mask>",
"{",
"}",
")",
"cmp",
".",
"Option",
"{",
"ux",
":=",
"newUnexportedFilter",
"(",
"typs",
"...",
")",
"\n",
"return",
"cmp",
".",
"FilterPath",
"(",
"ux",
".",
"filter",
",",
"cmp",
".",
"Ignore",
"(",
")",
")",
"\n",
"}"
] |
22,628 | all-22629 | [
"loadLabels",
"returns",
"what",
"labels",
"exist",
"in",
"github"
] | [
"func",
"loadLabels",
"(",
"gc",
"client",
",",
"org",
"string",
",",
"repos",
"[",
"]",
"string",
")",
"(",
"*",
"RepoLabels",
",",
"error",
")",
"{",
"repoChan",
":=",
"make",
"(",
"chan",
"string",
",",
"len",
"(",
"repos",
")",
")",
"\n",
"for",
"_",
",",
"repo",
":=",
"range",
"repos",
"{",
"repoChan",
"<-",
"repo",
"\n",
"}",
"\n",
"close",
"(",
"repoChan",
")",
"\n\n",
"wg",
":=",
"sync",
".",
"WaitGroup",
"{",
"}",
"\n",
"wg",
".",
"Add",
"(",
"maxConcurrentWorkers",
")",
"\n",
"labels",
":=",
"make",
"(",
"chan",
"RepoLabels",
",",
"len",
"(",
"repos",
")",
")",
"\n",
"errChan",
":=",
"make",
"(",
"chan",
"error",
",",
"len",
"(",
"repos",
")",
")",
"\n",
"for",
"i",
":=",
"0",
";",
"i",
"<",
"maxConcurrentWorkers",
";",
"i",
"++",
"{",
"<mask>",
"func",
"(",
"repositories",
"<-",
"chan",
"string",
")",
"{",
"defer",
"wg",
".",
"Done",
"(",
")",
"\n",
"for",
"repository",
":=",
"range",
"repositories",
"{",
"logrus",
".",
"WithField",
"(",
"\"",
"\"",
",",
"org",
")",
".",
"WithField",
"(",
"\"",
"\"",
",",
"repository",
")",
".",
"Info",
"(",
"\"",
"\"",
")",
"\n",
"repoLabels",
",",
"err",
":=",
"gc",
".",
"GetRepoLabels",
"(",
"org",
",",
"repository",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"logrus",
".",
"WithField",
"(",
"\"",
"\"",
",",
"org",
")",
".",
"WithField",
"(",
"\"",
"\"",
",",
"repository",
")",
".",
"Error",
"(",
"\"",
"\"",
")",
"\n",
"errChan",
"<-",
"err",
"\n",
"}",
"\n",
"labels",
"<-",
"RepoLabels",
"{",
"repository",
":",
"repoLabels",
"}",
"\n",
"}",
"\n",
"}",
"(",
"repoChan",
")",
"\n",
"}",
"\n\n",
"wg",
".",
"Wait",
"(",
")",
"\n",
"close",
"(",
"labels",
")",
"\n",
"close",
"(",
"errChan",
")",
"\n\n",
"rl",
":=",
"RepoLabels",
"{",
"}",
"\n",
"for",
"data",
":=",
"range",
"labels",
"{",
"for",
"repo",
",",
"repoLabels",
":=",
"range",
"data",
"{",
"rl",
"[",
"repo",
"]",
"=",
"repoLabels",
"\n",
"}",
"\n",
"}",
"\n\n",
"var",
"overallErr",
"error",
"\n",
"if",
"len",
"(",
"errChan",
")",
">",
"0",
"{",
"var",
"listErrs",
"[",
"]",
"error",
"\n",
"for",
"listErr",
":=",
"range",
"errChan",
"{",
"listErrs",
"=",
"append",
"(",
"listErrs",
",",
"listErr",
")",
"\n",
"}",
"\n",
"overallErr",
"=",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"listErrs",
")",
"\n",
"}",
"\n\n",
"return",
"&",
"rl",
",",
"overallErr",
"\n",
"}"
] |
22,629 | all-22630 | [
"Equals",
"reports",
"whenever",
"2",
"peers",
"are",
"actually",
"represent",
"the",
"same",
"node",
"."
] | [
"func",
"(",
"p",
"*",
"Peer",
")",
"Equals",
"(",
"<mask>",
"*",
"Peer",
")",
"bool",
"{",
"return",
"p",
".",
"Key",
"==",
"other",
".",
"Key",
"\n",
"}"
] |
22,630 | all-22631 | [
"NewMeasuredWriter",
"wraps",
"a",
"writer",
"."
] | [
"func",
"NewMeasuredWriter",
"(",
"w",
"io",
".",
"<mask>",
")",
"*",
"MeasuredWriter",
"{",
"return",
"&",
"MeasuredWriter",
"{",
"wrap",
":",
"w",
",",
"rate",
":",
"newCounter",
"(",
")",
"}",
"\n",
"}"
] |
22,631 | all-22632 | [
"prop",
"value",
"enum"
] | [
"func",
"(",
"m",
"*",
"<mask>",
")",
"validateTypeEnum",
"(",
"path",
",",
"location",
"string",
",",
"value",
"interface",
"{",
"}",
")",
"error",
"{",
"if",
"err",
":=",
"validate",
".",
"Enum",
"(",
"path",
",",
"location",
",",
"value",
",",
"routeTypeTypePropEnum",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
] |
22,632 | all-22633 | [
"UnmarshalJSON",
"supports",
"json",
".",
"Unmarshaler",
"interface"
] | [
"func",
"(",
"v",
"*",
"SetDockTileParams",
")",
"UnmarshalJSON",
"(",
"data",
"[",
"]",
"byte",
")",
"error",
"{",
"r",
":=",
"jlexer",
".",
"Lexer",
"{",
"Data",
":",
"data",
"}",
"\n",
"easyjsonC5a4559bDecodeGithubComChromedpCdprotoBrowser1",
"(",
"&",
"r",
",",
"v",
")",
"\n",
"return",
"r",
".",
"<mask>",
"(",
")",
"\n",
"}"
] |
22,633 | all-22634 | [
"doImp",
"actually",
"performs",
"the",
"HTTP",
"request",
"logging",
"according",
"to",
"the",
"various",
"settings",
"."
] | [
"func",
"(",
"d",
"*",
"dumpClient",
")",
"doImp",
"(",
"req",
"*",
"http",
".",
"Request",
",",
"hidden",
"bool",
",",
"ctx",
"context",
".",
"Context",
")",
"(",
"*",
"http",
".",
"Response",
",",
"error",
")",
"{",
"if",
"req",
".",
"URL",
".",
"Scheme",
"==",
"\"",
"\"",
"{",
"if",
"d",
".",
"isInsecure",
"(",
")",
"{",
"req",
".",
"URL",
".",
"Scheme",
"=",
"\"",
"\"",
"\n",
"}",
"else",
"{",
"req",
".",
"URL",
".",
"Scheme",
"=",
"\"",
"\"",
"\n",
"}",
"\n",
"}",
"\n\n",
"//set user-agent if one is not provided.",
"ua",
":=",
"req",
".",
"Header",
".",
"Get",
"(",
"\"",
"\"",
")",
"\n",
"if",
"ua",
"==",
"\"",
"\"",
"{",
"req",
".",
"Header",
".",
"Set",
"(",
"\"",
"\"",
",",
"UA",
")",
"\n",
"}",
"\n\n",
"var",
"reqBody",
"[",
"]",
"byte",
"\n",
"startedAt",
":=",
"time",
".",
"Now",
"(",
")",
"\n\n",
"// prefer the X-Request-Id header as request token for logging, if present.",
"id",
":=",
"req",
".",
"Header",
".",
"Get",
"(",
"requestIdHeader",
")",
"\n",
"if",
"id",
"==",
"\"",
"\"",
"{",
"id",
"=",
"ShortToken",
"(",
")",
"\n",
"}",
"\n",
"<mask>",
".",
"Info",
"(",
"\"",
"\"",
",",
"\"",
"\"",
",",
"id",
",",
"req",
".",
"Method",
",",
"req",
".",
"URL",
".",
"String",
"(",
")",
")",
"\n",
"df",
":=",
"d",
".",
"dumpFormat",
"(",
")",
"\n",
"hide",
":=",
"(",
"df",
"==",
"NoDump",
")",
"||",
"(",
"hidden",
"&&",
"!",
"df",
".",
"IsVerbose",
"(",
")",
")",
"\n",
"if",
"!",
"hide",
"{",
"startedAt",
"=",
"time",
".",
"Now",
"(",
")",
"\n",
"reqBody",
"=",
"d",
".",
"dumpRequest",
"(",
"req",
")",
"\n",
"}",
"\n",
"var",
"resp",
"*",
"http",
".",
"Response",
"\n",
"var",
"err",
"error",
"\n",
"if",
"ctx",
"==",
"nil",
"{",
"resp",
",",
"err",
"=",
"d",
".",
"Client",
".",
"Do",
"(",
"req",
")",
"\n",
"}",
"else",
"{",
"resp",
",",
"err",
"=",
"ctxhttpDo",
"(",
"ctx",
",",
"d",
".",
"getClientWithoutTimeout",
"(",
")",
",",
"req",
")",
"\n",
"}",
"\n",
"if",
"urlError",
",",
"ok",
":=",
"err",
".",
"(",
"*",
"url",
".",
"Error",
")",
";",
"ok",
"{",
"if",
"urlError",
".",
"Err",
".",
"Error",
"(",
")",
"==",
"noRedirectError",
"{",
"err",
"=",
"nil",
"\n",
"}",
"\n",
"}",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"if",
"!",
"hide",
"{",
"d",
".",
"dumpResponse",
"(",
"resp",
",",
"req",
",",
"reqBody",
")",
"\n",
"}",
"\n",
"log",
".",
"Info",
"(",
"\"",
"\"",
",",
"\"",
"\"",
",",
"id",
",",
"\"",
"\"",
",",
"resp",
".",
"Status",
",",
"\"",
"\"",
",",
"time",
".",
"Since",
"(",
"startedAt",
")",
".",
"String",
"(",
")",
")",
"\n\n",
"return",
"resp",
",",
"nil",
"\n",
"}"
] |
22,634 | all-22635 | [
"transferLeadershipCommandFunc",
"executes",
"the",
"compaction",
"command",
"."
] | [
"func",
"transferLeadershipCommandFunc",
"(",
"cmd",
"*",
"cobra",
".",
"Command",
",",
"args",
"[",
"]",
"string",
")",
"{",
"if",
"len",
"(",
"args",
")",
"!=",
"1",
"{",
"ExitWithError",
"(",
"ExitBadArgs",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
")",
")",
"\n",
"}",
"\n",
"target",
",",
"err",
":=",
"strconv",
".",
"ParseUint",
"(",
"args",
"[",
"0",
"]",
",",
"16",
",",
"64",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"ExitWithError",
"(",
"ExitBadArgs",
",",
"err",
")",
"\n",
"}",
"\n\n",
"c",
":=",
"mustClientFromCmd",
"(",
"cmd",
")",
"\n",
"eps",
":=",
"c",
".",
"Endpoints",
"(",
")",
"\n",
"c",
".",
"Close",
"(",
")",
"\n\n",
"ctx",
",",
"cancel",
":=",
"commandCtx",
"(",
"cmd",
")",
"\n\n",
"// find current leader",
"var",
"leaderCli",
"*",
"clientv3",
".",
"Client",
"\n",
"var",
"leaderID",
"uint64",
"\n",
"for",
"_",
",",
"ep",
":=",
"range",
"eps",
"{",
"cfg",
":=",
"clientConfigFromCmd",
"(",
"cmd",
")",
"\n",
"cfg",
".",
"endpoints",
"=",
"[",
"]",
"string",
"{",
"ep",
"}",
"\n",
"cli",
":=",
"cfg",
".",
"mustClient",
"(",
")",
"\n",
"resp",
",",
"serr",
":=",
"cli",
".",
"Status",
"(",
"ctx",
",",
"ep",
")",
"\n",
"if",
"serr",
"!=",
"nil",
"{",
"ExitWithError",
"(",
"ExitError",
",",
"serr",
")",
"\n",
"}",
"\n\n",
"if",
"resp",
".",
"Header",
".",
"GetMemberId",
"(",
")",
"==",
"resp",
".",
"Leader",
"{",
"leaderCli",
"=",
"cli",
"\n",
"leaderID",
"=",
"resp",
".",
"Leader",
"\n",
"break",
"\n",
"}",
"\n",
"cli",
".",
"Close",
"(",
")",
"\n",
"}",
"\n",
"if",
"leaderCli",
"==",
"nil",
"{",
"ExitWithError",
"(",
"ExitBadArgs",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"eps",
")",
")",
"\n",
"}",
"\n\n",
"<mask>",
"resp",
"*",
"clientv3",
".",
"MoveLeaderResponse",
"\n",
"resp",
",",
"err",
"=",
"leaderCli",
".",
"MoveLeader",
"(",
"ctx",
",",
"target",
")",
"\n",
"cancel",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"ExitWithError",
"(",
"ExitError",
",",
"err",
")",
"\n",
"}",
"\n\n",
"display",
".",
"MoveLeader",
"(",
"leaderID",
",",
"target",
",",
"*",
"resp",
")",
"\n",
"}"
] |
22,635 | all-22636 | [
"MustCreateAccountResult",
"retrieves",
"the",
"CreateAccountResult",
"value",
"from",
"the",
"union",
"panicing",
"if",
"the",
"value",
"is",
"not",
"set",
"."
] | [
"func",
"(",
"u",
"OperationResultTr",
")",
"MustCreateAccountResult",
"(",
")",
"CreateAccountResult",
"{",
"val",
",",
"ok",
":=",
"u",
".",
"GetCreateAccountResult",
"(",
")",
"\n\n",
"if",
"!",
"<mask>",
"{",
"panic",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"return",
"val",
"\n",
"}"
] |
22,636 | all-22637 | [
"Printf",
"writes",
"a",
"formatted",
"string",
"to",
"c",
".",
"reportWriter",
".",
"Note",
"that",
"the",
"method",
"name",
"Printf",
"is",
"not",
"entirely",
"arbitrary",
":",
"(",
"go",
"tool",
"vet",
")",
"has",
"a",
"built",
"-",
"in",
"list",
"of",
"functions",
"/",
"methods",
"(",
"whatever",
"object",
"they",
"are",
"for",
")",
"which",
"have",
"their",
"format",
"strings",
"checked",
";",
"for",
"other",
"names",
"we",
"would",
"have",
"to",
"pass",
"a",
"parameter",
"to",
"every",
"(",
"go",
"tool",
"vet",
")",
"invocation",
"."
] | [
"func",
"(",
"c",
"*",
"copier",
")",
"Printf",
"(",
"format",
"string",
",",
"a",
"...",
"interface",
"{",
"}",
")",
"{",
"fmt",
".",
"Fprintf",
"(",
"c",
".",
"reportWriter",
",",
"<mask>",
",",
"a",
"...",
")",
"\n",
"}"
] |
22,637 | all-22638 | [
"Subscriber",
"create",
"a",
"Subscriber",
"type",
"from",
"a",
"MalingList",
"with",
"the",
"given",
"email",
"and",
"name"
] | [
"func",
"(",
"ml",
"*",
"MailingList",
")",
"Subscriber",
"(",
"email",
",",
"<mask>",
"string",
")",
"*",
"Subscriber",
"{",
"return",
"&",
"Subscriber",
"{",
"MailingList",
":",
"ml",
",",
"Email",
":",
"email",
",",
"RealName",
":",
"name",
"}",
"\n",
"}"
] |
22,638 | all-22639 | [
"ActivateMnemonic",
"is",
"a",
"wrapper",
"around",
"gtk_window_mnemonic_activate",
"()",
"."
] | [
"func",
"(",
"v",
"*",
"Window",
")",
"ActivateMnemonic",
"(",
"keyval",
"uint",
",",
"<mask>",
"gdk",
".",
"ModifierType",
")",
"bool",
"{",
"c",
":=",
"C",
".",
"gtk_window_mnemonic_activate",
"(",
"v",
".",
"native",
"(",
")",
",",
"C",
".",
"guint",
"(",
"keyval",
")",
",",
"C",
".",
"GdkModifierType",
"(",
"mods",
")",
")",
"\n",
"return",
"gobool",
"(",
"c",
")",
"\n",
"}"
] |
22,639 | all-22640 | [
"WillRespondWith",
"specifies",
"the",
"details",
"of",
"the",
"HTTP",
"response",
"that",
"will",
"be",
"used",
"to",
"confirm",
"that",
"the",
"Provider",
"must",
"satisfy",
".",
"Mandatory",
"."
] | [
"func",
"(",
"i",
"*",
"Interaction",
")",
"WillRespondWith",
"(",
"response",
"<mask>",
")",
"*",
"Interaction",
"{",
"i",
".",
"Response",
"=",
"response",
"\n\n",
"return",
"i",
"\n",
"}"
] |
22,640 | all-22641 | [
"Clear",
"fills",
"the",
"current",
"canvas",
"with",
"a",
"default",
"transparent",
"color"
] | [
"func",
"(",
"gc",
"*",
"GraphicContext",
")",
"Clear",
"(",
")",
"{",
"width",
",",
"<mask>",
":=",
"gc",
".",
"img",
".",
"Bounds",
"(",
")",
".",
"Dx",
"(",
")",
",",
"gc",
".",
"img",
".",
"Bounds",
"(",
")",
".",
"Dy",
"(",
")",
"\n",
"gc",
".",
"ClearRect",
"(",
"0",
",",
"0",
",",
"width",
",",
"height",
")",
"\n",
"}"
] |
22,641 | all-22642 | [
"HasType",
"returns",
"a",
"boolean",
"if",
"a",
"field",
"has",
"been",
"set",
"."
] | [
"func",
"(",
"c",
"*",
"ChangeDefinition",
")",
"HasType",
"(",
")",
"bool",
"{",
"if",
"c",
"!=",
"nil",
"&&",
"c",
".",
"<mask>",
"!=",
"nil",
"{",
"return",
"true",
"\n",
"}",
"\n\n",
"return",
"false",
"\n",
"}"
] |
22,642 | all-22643 | [
"parseImageName",
"parses",
"a",
"publisher",
":",
"offer",
":",
"sku",
":",
"version",
"into",
"those",
"parts",
"."
] | [
"func",
"parseImageName",
"(",
"image",
"string",
")",
"(",
"imageName",
",",
"error",
")",
"{",
"l",
":=",
"strings",
".",
"Split",
"(",
"<mask>",
",",
"\"",
"\"",
")",
"\n",
"if",
"len",
"(",
"l",
")",
"!=",
"4",
"{",
"return",
"imageName",
"{",
"}",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"image",
")",
"\n",
"}",
"\n",
"return",
"imageName",
"{",
"l",
"[",
"0",
"]",
",",
"l",
"[",
"1",
"]",
",",
"l",
"[",
"2",
"]",
",",
"l",
"[",
"3",
"]",
"}",
",",
"nil",
"\n",
"}"
] |
22,643 | all-22644 | [
"InitializeOptions",
"initializes",
"the",
"options",
"."
] | [
"func",
"InitializeOptions",
"(",
"opts",
"*",
"Options",
")",
"*",
"Options",
"{",
"if",
"opts",
"==",
"nil",
"{",
"opts",
"=",
"&",
"Options",
"{",
"}",
"\n",
"}",
"\n\n",
"if",
"opts",
".",
"Extension",
"==",
"\"",
"\"",
"{",
"opts",
".",
"Extension",
"=",
"defaultExtension",
"\n",
"}",
"\n\n",
"if",
"opts",
".",
"DelimLeft",
"==",
"\"",
"\"",
"{",
"opts",
".",
"DelimLeft",
"=",
"defaultDelimLeft",
"\n",
"}",
"\n\n",
"if",
"opts",
".",
"DelimRight",
"==",
"\"",
"\"",
"{",
"opts",
".",
"DelimRight",
"=",
"defaultDelimRight",
"\n",
"}",
"\n\n",
"if",
"opts",
".",
"AttributeNameClass",
"==",
"\"",
"\"",
"{",
"opts",
".",
"AttributeNameClass",
"=",
"defaultAttributeNameClass",
"\n",
"}",
"\n",
"if",
"opts",
".",
"NoCloseTagNames",
"==",
"nil",
"{",
"opts",
".",
"NoCloseTagNames",
"=",
"make",
"(",
"[",
"]",
"string",
",",
"len",
"(",
"defaultNoCloseTagNames",
")",
")",
"\n",
"<mask>",
"(",
"opts",
".",
"NoCloseTagNames",
",",
"defaultNoCloseTagNames",
")",
"\n",
"}",
"\n\n",
"if",
"opts",
".",
"Indent",
"!=",
"\"",
"\"",
"{",
"opts",
".",
"formatter",
"=",
"newFormatter",
"(",
"opts",
".",
"Indent",
")",
"\n",
"}",
"\n\n",
"return",
"opts",
"\n",
"}"
] |
22,644 | all-22645 | [
"Facets",
"returns",
"the",
"facets",
"found",
"within",
"the",
"search",
"results",
"if",
"any",
"facets",
"were",
"requested",
"in",
"the",
"SearchOptions",
"."
] | [
"func",
"(",
"t",
"*",
"Iterator",
")",
"Facets",
"(",
")",
"(",
"[",
"]",
"[",
"]",
"FacetResult",
",",
"error",
")",
"{",
"t",
".",
"fetchMore",
"(",
")",
"\n",
"if",
"t",
".",
"err",
"!=",
"nil",
"&&",
"t",
".",
"err",
"!=",
"Done",
"{",
"return",
"nil",
",",
"t",
".",
"err",
"\n",
"}",
"\n\n",
"var",
"facets",
"[",
"]",
"[",
"]",
"FacetResult",
"\n",
"for",
"_",
",",
"f",
":=",
"range",
"t",
".",
"facetRes",
"{",
"fres",
":=",
"make",
"(",
"[",
"]",
"FacetResult",
",",
"0",
",",
"len",
"(",
"f",
".",
"Value",
")",
")",
"\n",
"for",
"_",
",",
"v",
":=",
"range",
"f",
".",
"Value",
"{",
"ref",
":=",
"v",
".",
"Refinement",
"\n",
"facet",
":=",
"FacetResult",
"{",
"Facet",
":",
"Facet",
"{",
"Name",
":",
"ref",
".",
"GetName",
"(",
")",
"}",
",",
"Count",
":",
"int",
"(",
"v",
".",
"GetCount",
"(",
")",
")",
",",
"}",
"\n",
"if",
"ref",
".",
"Value",
"!=",
"nil",
"{",
"facet",
".",
"Value",
"=",
"Atom",
"(",
"*",
"ref",
".",
"Value",
")",
"\n",
"}",
"else",
"{",
"facet",
".",
"Value",
"=",
"protoToRange",
"(",
"ref",
".",
"Range",
")",
"\n",
"}",
"\n",
"fres",
"=",
"append",
"(",
"fres",
",",
"facet",
")",
"\n",
"}",
"\n",
"facets",
"=",
"<mask>",
"(",
"facets",
",",
"fres",
")",
"\n",
"}",
"\n",
"return",
"facets",
",",
"nil",
"\n",
"}"
] |
22,645 | all-22646 | [
"Sets",
"text",
"on",
"the",
"menu_item",
"label"
] | [
"func",
"(",
"v",
"*",
"MenuItem",
")",
"SetLabel",
"(",
"<mask>",
"string",
")",
"{",
"cstr",
":=",
"C",
".",
"CString",
"(",
"label",
")",
"\n",
"defer",
"C",
".",
"free",
"(",
"unsafe",
".",
"Pointer",
"(",
"cstr",
")",
")",
"\n",
"C",
".",
"gtk_menu_item_set_label",
"(",
"v",
".",
"native",
"(",
")",
",",
"(",
"*",
"C",
".",
"gchar",
")",
"(",
"cstr",
")",
")",
"\n",
"}"
] |
22,646 | all-22647 | [
"Check",
"if",
"the",
"provided",
"function",
"is",
"being",
"called",
"in",
"the",
"op",
"options",
"."
] | [
"func",
"isOpFuncCalled",
"(",
"op",
"string",
",",
"opts",
"[",
"]",
"OpOption",
")",
"bool",
"{",
"for",
"_",
",",
"opt",
":=",
"<mask>",
"opts",
"{",
"v",
":=",
"reflect",
".",
"ValueOf",
"(",
"opt",
")",
"\n",
"if",
"v",
".",
"Kind",
"(",
")",
"==",
"reflect",
".",
"Func",
"{",
"if",
"opFunc",
":=",
"runtime",
".",
"FuncForPC",
"(",
"v",
".",
"Pointer",
"(",
")",
")",
";",
"opFunc",
"!=",
"nil",
"{",
"if",
"strings",
".",
"Contains",
"(",
"opFunc",
".",
"Name",
"(",
")",
",",
"op",
")",
"{",
"return",
"true",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"false",
"\n",
"}"
] |
22,647 | all-22648 | [
"==",
"Set",
"system",
"-",
"wide",
"variables",
"Setsys",
"sets",
"the",
"value",
"of",
"the",
"environment",
"variable",
"named",
"by",
"the",
"key",
"that",
"affects",
"the",
"system",
"as",
"a",
"whole",
".",
"You",
"must",
"be",
"Root",
".",
"It",
"returns",
"an",
"error",
"if",
"any",
"."
] | [
"func",
"Setsys",
"(",
"key",
",",
"value",
"string",
")",
"error",
"{",
"if",
"!",
"_IS_ROOT",
"{",
"return",
"ErrNoRoot",
"\n",
"}",
"\n",
"return",
"_Set",
"(",
"_SETTINGS",
".",
"<mask>",
",",
"key",
",",
"value",
")",
"\n",
"}"
] |
22,648 | all-22649 | [
"endpointsFromGatewayConfig",
"extracts",
"the",
"endpoints",
"from",
"an",
"Istio",
"Gateway",
"Config",
"object"
] | [
"func",
"(",
"sc",
"*",
"gatewaySource",
")",
"endpointsFromGatewayConfig",
"(",
"config",
"istiomodel",
".",
"Config",
")",
"(",
"[",
"]",
"*",
"endpoint",
".",
"Endpoint",
",",
"error",
")",
"{",
"var",
"endpoints",
"[",
"]",
"*",
"endpoint",
".",
"Endpoint",
"\n\n",
"ttl",
",",
"err",
":=",
"getTTLFromAnnotations",
"(",
"config",
".",
"Annotations",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"log",
".",
"Warn",
"(",
"err",
")",
"\n",
"}",
"\n\n",
"targets",
":=",
"getTargetsFromTargetAnnotation",
"(",
"config",
".",
"Annotations",
")",
"\n\n",
"if",
"len",
"(",
"targets",
")",
"==",
"0",
"{",
"targets",
",",
"err",
"=",
"sc",
".",
"targetsFromIstioIngressGatewayServices",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"}",
"\n\n",
"gateway",
":=",
"config",
".",
"Spec",
".",
"(",
"*",
"istionetworking",
".",
"Gateway",
")",
"\n\n",
"providerSpecific",
":=",
"getProviderSpecificAnnotations",
"(",
"config",
".",
"Annotations",
")",
"\n\n",
"for",
"_",
",",
"server",
":=",
"range",
"gateway",
".",
"Servers",
"{",
"for",
"_",
",",
"host",
":=",
"range",
"server",
".",
"Hosts",
"{",
"if",
"host",
"==",
"\"",
"\"",
"{",
"continue",
"\n",
"}",
"\n",
"endpoints",
"=",
"append",
"(",
"endpoints",
",",
"endpointsForHostname",
"(",
"host",
",",
"targets",
",",
"ttl",
",",
"providerSpecific",
")",
"...",
")",
"\n",
"}",
"\n",
"}",
"\n\n",
"// Skip endpoints if we do not want entries from annotations",
"if",
"!",
"sc",
".",
"ignoreHostnameAnnotation",
"{",
"hostnameList",
":=",
"getHostnamesFromAnnotations",
"(",
"config",
".",
"Annotations",
")",
"\n",
"for",
"_",
",",
"hostname",
":=",
"range",
"hostnameList",
"{",
"endpoints",
"=",
"<mask>",
"(",
"endpoints",
",",
"endpointsForHostname",
"(",
"hostname",
",",
"targets",
",",
"ttl",
",",
"providerSpecific",
")",
"...",
")",
"\n",
"}",
"\n",
"}",
"\n\n",
"return",
"endpoints",
",",
"nil",
"\n",
"}"
] |
22,649 | all-22650 | [
"AccelMapSave",
"is",
"a",
"wrapper",
"around",
"gtk_accel_map_save",
"()",
"."
] | [
"func",
"AccelMapSave",
"(",
"fileName",
"string",
")",
"{",
"cstr",
":=",
"C",
".",
"CString",
"(",
"fileName",
")",
"\n",
"defer",
"C",
".",
"<mask>",
"(",
"unsafe",
".",
"Pointer",
"(",
"cstr",
")",
")",
"\n\n",
"C",
".",
"gtk_accel_map_save",
"(",
"(",
"*",
"C",
".",
"gchar",
")",
"(",
"cstr",
")",
")",
"\n",
"}"
] |
22,650 | all-22651 | [
"ParseScope",
"parses",
"the",
"string",
"s",
"to",
"a",
"scope",
"(",
"for",
"example",
"parsing",
"a",
"command",
"-",
"line",
"argument",
"."
] | [
"func",
"ParseScope",
"(",
"s",
"string",
")",
"(",
"Scope",
",",
"error",
")",
"{",
"for",
"<mask>",
",",
"value",
":=",
"range",
"Scope_value",
"{",
"if",
"strings",
".",
"EqualFold",
"(",
"s",
",",
"name",
")",
"{",
"return",
"Scope",
"(",
"value",
")",
",",
"nil",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"Scope_NONE",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"s",
")",
"\n",
"}"
] |
22,651 | all-22652 | [
"WithPanicResponse",
"sets",
"a",
"fixed",
"body",
"and",
"its",
"content",
"type",
"HTTP",
"header",
"that",
"will",
"be",
"returned",
"as",
"HTTP",
"response",
"on",
"panic",
"event",
".",
"If",
"WithPanicResponseHandler",
"is",
"defined",
"this",
"options",
"are",
"ignored",
"."
] | [
"func",
"WithPanicResponse",
"(",
"<mask>",
",",
"contentType",
"string",
")",
"Option",
"{",
"return",
"func",
"(",
"o",
"*",
"Handler",
")",
"{",
"o",
".",
"panicBody",
"=",
"body",
"\n",
"o",
".",
"panicContentType",
"=",
"contentType",
"\n",
"}",
"\n",
"}"
] |
22,652 | all-22653 | [
"UnmarshalJSON",
"supports",
"json",
".",
"Unmarshaler",
"interface"
] | [
"func",
"(",
"v",
"*",
"AddRuleParams",
")",
"UnmarshalJSON",
"(",
"<mask>",
"[",
"]",
"byte",
")",
"error",
"{",
"r",
":=",
"jlexer",
".",
"Lexer",
"{",
"Data",
":",
"data",
"}",
"\n",
"easyjsonC5a4559bDecodeGithubComChromedpCdprotoCss64",
"(",
"&",
"r",
",",
"v",
")",
"\n",
"return",
"r",
".",
"Error",
"(",
")",
"\n",
"}"
] |
22,653 | all-22654 | [
"removeAll",
"stops",
"the",
"periodic",
"usage",
"data",
"collection",
"for",
"all",
"containers"
] | [
"func",
"(",
"engine",
"*",
"DockerStatsEngine",
")",
"removeAll",
"(",
")",
"{",
"engine",
".",
"lock",
".",
"Lock",
"(",
")",
"\n",
"defer",
"engine",
".",
"lock",
".",
"Unlock",
"(",
")",
"\n\n",
"for",
"task",
",",
"containers",
":=",
"range",
"<mask>",
".",
"tasksToContainers",
"{",
"for",
"_",
",",
"statsContainer",
":=",
"range",
"containers",
"{",
"statsContainer",
".",
"StopStatsCollection",
"(",
")",
"\n",
"}",
"\n",
"delete",
"(",
"engine",
".",
"tasksToContainers",
",",
"task",
")",
"\n",
"}",
"\n\n",
"for",
"task",
":=",
"range",
"engine",
".",
"tasksToHealthCheckContainers",
"{",
"delete",
"(",
"engine",
".",
"tasksToContainers",
",",
"task",
")",
"\n",
"}",
"\n",
"}"
] |
22,654 | all-22655 | [
"ConfigureQorResourceBeforeInitialize",
"configure",
"qor",
"resource",
"for",
"qor",
"admin"
] | [
"func",
"(",
"serialize",
"*",
"SerializableMeta",
")",
"ConfigureQorResourceBeforeInitialize",
"(",
"res",
"resource",
".",
"Resourcer",
")",
"{",
"if",
"res",
",",
"ok",
":=",
"res",
".",
"(",
"*",
"admin",
".",
"Resource",
")",
";",
"ok",
"{",
"res",
".",
"GetAdmin",
"(",
")",
".",
"RegisterViewPath",
"(",
"\"",
"\"",
")",
"\n\n",
"if",
"_",
",",
"ok",
":=",
"res",
".",
"Value",
".",
"(",
"SerializableMetaInterface",
")",
";",
"ok",
"{",
"res",
".",
"Meta",
"(",
"&",
"admin",
".",
"Meta",
"{",
"Name",
":",
"\"",
"\"",
",",
"Type",
":",
"\"",
"\"",
",",
"Valuer",
":",
"func",
"(",
"value",
"interface",
"{",
"}",
",",
"context",
"*",
"qor",
".",
"Context",
")",
"interface",
"{",
"}",
"{",
"defer",
"func",
"(",
")",
"{",
"if",
"r",
":=",
"recover",
"(",
")",
";",
"r",
"!=",
"nil",
"{",
"utils",
".",
"ExitWithMsg",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"}",
"(",
")",
"\n\n",
"return",
"value",
".",
"(",
"SerializableMetaInterface",
")",
".",
"GetSerializableArgumentKind",
"(",
")",
"\n",
"}",
",",
"Setter",
":",
"func",
"(",
"value",
"interface",
"{",
"}",
",",
"metaValue",
"*",
"resource",
".",
"MetaValue",
",",
"context",
"*",
"qor",
".",
"Context",
")",
"{",
"value",
".",
"(",
"SerializableMetaInterface",
")",
".",
"SetSerializableArgumentKind",
"(",
"utils",
".",
"ToString",
"(",
"metaValue",
".",
"Value",
")",
")",
"\n",
"}",
",",
"}",
")",
"\n\n",
"res",
".",
"Meta",
"(",
"&",
"admin",
".",
"Meta",
"{",
"Name",
":",
"\"",
"\"",
",",
"Type",
":",
"\"",
"\"",
",",
"Valuer",
":",
"func",
"(",
"value",
"interface",
"{",
"}",
",",
"context",
"*",
"qor",
".",
"Context",
")",
"interface",
"{",
"}",
"{",
"if",
"serializeArgument",
",",
"ok",
":=",
"value",
".",
"(",
"SerializableMetaInterface",
")",
";",
"ok",
"{",
"return",
"struct",
"{",
"Value",
"interface",
"{",
"}",
"\n",
"Resource",
"*",
"admin",
".",
"Resource",
"\n",
"}",
"{",
"Value",
":",
"serializeArgument",
".",
"GetSerializableArgument",
"(",
"serializeArgument",
")",
",",
"Resource",
":",
"serializeArgument",
".",
"GetSerializableArgumentResource",
"(",
")",
",",
"}",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}",
",",
"FormattedValuer",
":",
"func",
"(",
"value",
"interface",
"{",
"}",
",",
"context",
"*",
"qor",
".",
"Context",
")",
"interface",
"{",
"}",
"{",
"if",
"serializeArgument",
",",
"ok",
":=",
"value",
".",
"(",
"SerializableMetaInterface",
")",
";",
"ok",
"{",
"return",
"serializeArgument",
".",
"GetSerializableArgument",
"(",
"serializeArgument",
")",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}",
",",
"Setter",
":",
"func",
"(",
"result",
"interface",
"{",
"}",
",",
"metaValue",
"*",
"resource",
".",
"MetaValue",
",",
"context",
"*",
"qor",
".",
"<mask>",
")",
"{",
"if",
"serializeArgument",
",",
"ok",
":=",
"result",
".",
"(",
"SerializableMetaInterface",
")",
";",
"ok",
"{",
"if",
"serializeArgumentResource",
":=",
"serializeArgument",
".",
"GetSerializableArgumentResource",
"(",
")",
";",
"serializeArgumentResource",
"!=",
"nil",
"{",
"var",
"clearUpRecord",
",",
"fillUpRecord",
"func",
"(",
"record",
"interface",
"{",
"}",
",",
"metaors",
"[",
"]",
"resource",
".",
"Metaor",
",",
"metaValues",
"[",
"]",
"*",
"resource",
".",
"MetaValue",
")",
"\n",
"// Keep original value, so if user don't have permission to update some fields, we won't lost the data",
"value",
":=",
"serializeArgument",
".",
"GetSerializableArgument",
"(",
"serializeArgument",
")",
"\n\n",
"for",
"_",
",",
"v",
":=",
"range",
"serializeArgumentResource",
".",
"Validators",
"{",
"context",
".",
"AddError",
"(",
"v",
".",
"Handler",
"(",
"value",
",",
"metaValue",
".",
"MetaValues",
",",
"context",
")",
")",
"\n",
"}",
"\n\n",
"// Clear all nested slices if has related form data",
"clearUpRecord",
"=",
"func",
"(",
"record",
"interface",
"{",
"}",
",",
"metaors",
"[",
"]",
"resource",
".",
"Metaor",
",",
"metaValues",
"[",
"]",
"*",
"resource",
".",
"MetaValue",
")",
"{",
"for",
"_",
",",
"meta",
":=",
"range",
"metaors",
"{",
"for",
"_",
",",
"metaValue",
":=",
"range",
"metaValues",
"{",
"if",
"meta",
".",
"GetName",
"(",
")",
"==",
"metaValue",
".",
"Name",
"{",
"if",
"metaResource",
",",
"ok",
":=",
"meta",
".",
"GetResource",
"(",
")",
".",
"(",
"*",
"admin",
".",
"Resource",
")",
";",
"ok",
"&&",
"metaResource",
"!=",
"nil",
"&&",
"metaValue",
".",
"MetaValues",
"!=",
"nil",
"{",
"nestedFieldValue",
":=",
"reflect",
".",
"Indirect",
"(",
"reflect",
".",
"ValueOf",
"(",
"record",
")",
")",
".",
"FieldByName",
"(",
"meta",
".",
"GetFieldName",
"(",
")",
")",
"\n",
"if",
"nestedFieldValue",
".",
"Kind",
"(",
")",
"==",
"reflect",
".",
"Struct",
"{",
"clearUpRecord",
"(",
"nestedFieldValue",
".",
"Addr",
"(",
")",
".",
"Interface",
"(",
")",
",",
"metaResource",
".",
"GetMetas",
"(",
"[",
"]",
"string",
"{",
"}",
")",
",",
"metaValue",
".",
"MetaValues",
".",
"Values",
")",
"\n",
"}",
"else",
"if",
"nestedFieldValue",
".",
"Kind",
"(",
")",
"==",
"reflect",
".",
"Slice",
"{",
"nestedFieldValue",
".",
"Set",
"(",
"reflect",
".",
"Zero",
"(",
"nestedFieldValue",
".",
"Type",
"(",
")",
")",
")",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n",
"clearUpRecord",
"(",
"value",
",",
"serializeArgumentResource",
".",
"GetMetas",
"(",
"[",
"]",
"string",
"{",
"}",
")",
",",
"metaValue",
".",
"MetaValues",
".",
"Values",
")",
"\n\n",
"fillUpRecord",
"=",
"func",
"(",
"record",
"interface",
"{",
"}",
",",
"metaors",
"[",
"]",
"resource",
".",
"Metaor",
",",
"metaValues",
"[",
"]",
"*",
"resource",
".",
"MetaValue",
")",
"{",
"for",
"_",
",",
"meta",
":=",
"range",
"metaors",
"{",
"for",
"_",
",",
"metaValue",
":=",
"range",
"metaValues",
"{",
"if",
"meta",
".",
"GetName",
"(",
")",
"==",
"metaValue",
".",
"Name",
"{",
"if",
"setter",
":=",
"meta",
".",
"GetSetter",
"(",
")",
";",
"setter",
"!=",
"nil",
"{",
"setter",
"(",
"record",
",",
"metaValue",
",",
"context",
")",
"\n",
"}",
"\n\n",
"if",
"metaResource",
",",
"ok",
":=",
"meta",
".",
"GetResource",
"(",
")",
".",
"(",
"*",
"admin",
".",
"Resource",
")",
";",
"ok",
"&&",
"metaResource",
"!=",
"nil",
"&&",
"metaValue",
".",
"MetaValues",
"!=",
"nil",
"{",
"nestedFieldValue",
":=",
"reflect",
".",
"Indirect",
"(",
"reflect",
".",
"ValueOf",
"(",
"record",
")",
")",
".",
"FieldByName",
"(",
"meta",
".",
"GetFieldName",
"(",
")",
")",
"\n",
"if",
"meta",
".",
"GetSetter",
"(",
")",
"==",
"nil",
"||",
"reflect",
".",
"Indirect",
"(",
"nestedFieldValue",
")",
".",
"Type",
"(",
")",
"==",
"utils",
".",
"ModelType",
"(",
"metaResource",
".",
"NewStruct",
"(",
")",
")",
"{",
"if",
"nestedFieldValue",
".",
"Kind",
"(",
")",
"==",
"reflect",
".",
"Struct",
"{",
"nestedValue",
":=",
"nestedFieldValue",
".",
"Addr",
"(",
")",
".",
"Interface",
"(",
")",
"\n",
"for",
"_",
",",
"v",
":=",
"range",
"metaResource",
".",
"Validators",
"{",
"context",
".",
"AddError",
"(",
"v",
".",
"Handler",
"(",
"nestedValue",
",",
"metaValue",
".",
"MetaValues",
",",
"context",
")",
")",
"\n",
"}",
"\n\n",
"fillUpRecord",
"(",
"nestedValue",
",",
"metaResource",
".",
"GetMetas",
"(",
"[",
"]",
"string",
"{",
"}",
")",
",",
"metaValue",
".",
"MetaValues",
".",
"Values",
")",
"\n\n",
"for",
"_",
",",
"p",
":=",
"range",
"metaResource",
".",
"Processors",
"{",
"context",
".",
"AddError",
"(",
"p",
".",
"Handler",
"(",
"nestedValue",
",",
"metaValue",
".",
"MetaValues",
",",
"context",
")",
")",
"\n",
"}",
"\n",
"}",
"\n\n",
"if",
"nestedFieldValue",
".",
"Kind",
"(",
")",
"==",
"reflect",
".",
"Slice",
"{",
"nestedValue",
":=",
"reflect",
".",
"New",
"(",
"nestedFieldValue",
".",
"Type",
"(",
")",
".",
"Elem",
"(",
")",
")",
"\n\n",
"for",
"_",
",",
"v",
":=",
"range",
"metaResource",
".",
"Validators",
"{",
"context",
".",
"AddError",
"(",
"v",
".",
"Handler",
"(",
"nestedValue",
",",
"metaValue",
".",
"MetaValues",
",",
"context",
")",
")",
"\n",
"}",
"\n\n",
"if",
"destroy",
":=",
"metaValue",
".",
"MetaValues",
".",
"Get",
"(",
"\"",
"\"",
")",
";",
"destroy",
"==",
"nil",
"||",
"fmt",
".",
"Sprint",
"(",
"destroy",
".",
"Value",
")",
"==",
"\"",
"\"",
"{",
"fillUpRecord",
"(",
"nestedValue",
".",
"Interface",
"(",
")",
",",
"metaResource",
".",
"GetMetas",
"(",
"[",
"]",
"string",
"{",
"}",
")",
",",
"metaValue",
".",
"MetaValues",
".",
"Values",
")",
"\n",
"if",
"!",
"reflect",
".",
"DeepEqual",
"(",
"reflect",
".",
"Zero",
"(",
"nestedFieldValue",
".",
"Type",
"(",
")",
".",
"Elem",
"(",
")",
")",
".",
"Interface",
"(",
")",
",",
"nestedValue",
".",
"Elem",
"(",
")",
".",
"Interface",
"(",
")",
")",
"{",
"nestedFieldValue",
".",
"Set",
"(",
"reflect",
".",
"Append",
"(",
"nestedFieldValue",
",",
"nestedValue",
".",
"Elem",
"(",
")",
")",
")",
"\n\n",
"for",
"_",
",",
"p",
":=",
"range",
"metaResource",
".",
"Processors",
"{",
"context",
".",
"AddError",
"(",
"p",
".",
"Handler",
"(",
"nestedValue",
",",
"metaValue",
".",
"MetaValues",
",",
"context",
")",
")",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n",
"continue",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n\n",
"fillUpRecord",
"(",
"value",
",",
"serializeArgumentResource",
".",
"GetMetas",
"(",
"[",
"]",
"string",
"{",
"}",
")",
",",
"metaValue",
".",
"MetaValues",
".",
"Values",
")",
"\n\n",
"for",
"_",
",",
"p",
":=",
"range",
"serializeArgumentResource",
".",
"Processors",
"{",
"context",
".",
"AddError",
"(",
"p",
".",
"Handler",
"(",
"value",
",",
"metaValue",
".",
"MetaValues",
",",
"context",
")",
")",
"\n",
"}",
"\n",
"serializeArgument",
".",
"SetSerializableArgumentValue",
"(",
"value",
")",
"\n",
"}",
"\n",
"}",
"\n",
"}",
",",
"}",
")",
"\n\n",
"res",
".",
"NewAttrs",
"(",
"\"",
"\"",
",",
"\"",
"\"",
")",
"\n",
"res",
".",
"EditAttrs",
"(",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"}",
"\n",
"}"
] |
22,655 | all-22656 | [
"Diff",
"computes",
"the",
"difference",
"between",
"old",
"and",
"new",
"according",
"to",
"the",
"bsdiff",
"algorithm",
"and",
"writes",
"the",
"result",
"to",
"patch",
"."
] | [
"func",
"Diff",
"(",
"<mask>",
",",
"new",
"io",
".",
"Reader",
",",
"patch",
"io",
".",
"Writer",
")",
"error",
"{",
"obuf",
",",
"err",
":=",
"ioutil",
".",
"ReadAll",
"(",
"old",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"nbuf",
",",
"err",
":=",
"ioutil",
".",
"ReadAll",
"(",
"new",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"pbuf",
",",
"err",
":=",
"diffBytes",
"(",
"obuf",
",",
"nbuf",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"_",
",",
"err",
"=",
"patch",
".",
"Write",
"(",
"pbuf",
")",
"\n",
"return",
"err",
"\n",
"}"
] |
22,656 | all-22657 | [
"NetworkUpdateCert",
"updates",
"the",
"TLS",
"keypair",
"and",
"CA",
"used",
"by",
"the",
"network",
"endpoint",
".",
"If",
"the",
"network",
"endpoint",
"is",
"active",
"in",
"-",
"flight",
"requests",
"will",
"continue",
"using",
"the",
"old",
"certificate",
"and",
"only",
"new",
"requests",
"will",
"use",
"the",
"new",
"one",
"."
] | [
"func",
"(",
"e",
"*",
"Endpoints",
")",
"NetworkUpdateCert",
"(",
"cert",
"*",
"shared",
".",
"CertInfo",
")",
"{",
"e",
".",
"mu",
".",
"Lock",
"(",
")",
"\n",
"defer",
"e",
".",
"mu",
".",
"Unlock",
"(",
")",
"\n",
"e",
".",
"cert",
"=",
"cert",
"\n",
"listener",
",",
"<mask>",
":=",
"e",
".",
"listeners",
"[",
"network",
"]",
"\n",
"if",
"!",
"ok",
"{",
"return",
"\n",
"}",
"\n",
"listener",
".",
"(",
"*",
"networkListener",
")",
".",
"Config",
"(",
"cert",
")",
"\n\n",
"// Update the cluster listener too, if enabled.",
"listener",
",",
"ok",
"=",
"e",
".",
"listeners",
"[",
"cluster",
"]",
"\n",
"if",
"!",
"ok",
"{",
"return",
"\n",
"}",
"\n",
"listener",
".",
"(",
"*",
"networkListener",
")",
".",
"Config",
"(",
"cert",
")",
"\n",
"}"
] |
22,657 | all-22658 | [
"IsDone",
"returns",
"false",
"while",
"the",
"iterator",
"is",
"valid",
"and",
"can",
"produce",
"another",
"value",
"via",
"a",
"call",
"to",
"Next",
"()"
] | [
"func",
"(",
"it",
"*",
"inclusiveRangeIt",
")",
"IsDone",
"(",
")",
"bool",
"{",
"if",
"<mask>",
".",
"pos",
">=",
"it",
".",
"ptr",
".",
"Len",
"(",
")",
"{",
"return",
"true",
"\n",
"}",
"\n",
"return",
"false",
"\n",
"}"
] |
22,658 | all-22659 | [
"Set",
"is",
"required",
"for",
"kingpin",
"interfaces",
"to",
"allow",
"command",
"line",
"params",
"to",
"be",
"set",
"to",
"our",
"map",
"datatype"
] | [
"func",
"(",
"o",
"*",
"MapBoolOption",
")",
"<mask>",
"(",
"value",
"string",
")",
"error",
"{",
"parts",
":=",
"stringMapRegex",
".",
"Split",
"(",
"value",
",",
"2",
")",
"\n",
"if",
"len",
"(",
"parts",
")",
"!=",
"2",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"value",
")",
"\n",
"}",
"\n",
"val",
":=",
"BoolOption",
"{",
"}",
"\n",
"val",
".",
"Set",
"(",
"parts",
"[",
"1",
"]",
")",
"\n",
"(",
"*",
"o",
")",
"[",
"parts",
"[",
"0",
"]",
"]",
"=",
"val",
"\n",
"return",
"nil",
"\n",
"}"
] |
22,659 | all-22660 | [
"set",
"rasterization",
"mode"
] | [
"func",
"RenderMode",
"(",
"mode",
"uint32",
")",
"int32",
"{",
"ret",
",",
"_",
",",
"_",
":=",
"syscall",
".",
"Syscall",
"(",
"gpRenderMode",
",",
"1",
",",
"uintptr",
"(",
"<mask>",
")",
",",
"0",
",",
"0",
")",
"\n",
"return",
"(",
"int32",
")",
"(",
"ret",
")",
"\n",
"}"
] |
22,660 | all-22661 | [
"getConfigPath",
"returns",
"the",
"system",
"-",
"registries",
"config",
"path",
"if",
"specified",
".",
"Otherwise",
"systemRegistriesConfPath",
"is",
"returned",
"."
] | [
"func",
"getConfigPath",
"(",
"ctx",
"*",
"<mask>",
".",
"SystemContext",
")",
"string",
"{",
"confPath",
":=",
"systemRegistriesConfPath",
"\n",
"if",
"ctx",
"!=",
"nil",
"{",
"if",
"ctx",
".",
"SystemRegistriesConfPath",
"!=",
"\"",
"\"",
"{",
"confPath",
"=",
"ctx",
".",
"SystemRegistriesConfPath",
"\n",
"}",
"else",
"if",
"ctx",
".",
"RootForImplicitAbsolutePaths",
"!=",
"\"",
"\"",
"{",
"confPath",
"=",
"filepath",
".",
"Join",
"(",
"ctx",
".",
"RootForImplicitAbsolutePaths",
",",
"systemRegistriesConfPath",
")",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"confPath",
"\n",
"}"
] |
22,661 | all-22662 | [
"makeChecks",
"renders",
"a",
"ContextPolicy",
"into",
"the",
"corresponding",
"GitHub",
"api",
"object",
".",
"Returns",
"nil",
"when",
"input",
"policy",
"is",
"nil",
".",
"Otherwise",
"returns",
"non",
"-",
"nil",
"Contexts",
"(",
"empty",
"if",
"unset",
")",
"and",
"Strict",
"iff",
"Strict",
"is",
"true"
] | [
"func",
"makeChecks",
"(",
"cp",
"*",
"branchprotection",
".",
"ContextPolicy",
")",
"*",
"github",
".",
"RequiredStatusChecks",
"{",
"if",
"cp",
"==",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n",
"return",
"&",
"github",
".",
"RequiredStatusChecks",
"{",
"Contexts",
":",
"<mask>",
"(",
"[",
"]",
"string",
"{",
"}",
",",
"sets",
".",
"NewString",
"(",
"cp",
".",
"Contexts",
"...",
")",
".",
"List",
"(",
")",
"...",
")",
",",
"Strict",
":",
"makeBool",
"(",
"cp",
".",
"Strict",
")",
",",
"}",
"\n",
"}"
] |
22,662 | all-22663 | [
"scratchFilePrefix",
"returns",
"an",
"etcd",
"prefix",
"that",
"s",
"used",
"to",
"temporarily",
"store",
"the",
"state",
"of",
"a",
"file",
"in",
"an",
"open",
"commit",
".",
"Once",
"the",
"commit",
"is",
"finished",
"the",
"scratch",
"space",
"is",
"removed",
"."
] | [
"func",
"(",
"d",
"*",
"driver",
")",
"scratchFilePrefix",
"(",
"file",
"*",
"pfs",
".",
"File",
")",
"(",
"string",
",",
"error",
")",
"{",
"return",
"path",
".",
"Join",
"(",
"d",
".",
"scratchCommitPrefix",
"(",
"<mask>",
".",
"Commit",
")",
",",
"file",
".",
"Path",
")",
",",
"nil",
"\n",
"}"
] |
22,663 | all-22664 | [
"link",
"is",
"LINK",
"from",
"the",
"papers",
"."
] | [
"func",
"(",
"d",
"*",
"ltDom",
")",
"<mask>",
"(",
"v",
",",
"w",
"vName",
")",
"{",
"d",
".",
"ancestor",
"[",
"w",
"]",
"=",
"v",
"\n",
"}"
] |
22,664 | all-22665 | [
"Jump",
"travels",
"from",
"a",
"node",
"from",
"to",
"another",
"node",
"to",
"by",
"following",
"the",
"path",
"path",
".",
"For",
"example",
"if",
"the",
"following",
"keys",
"were",
"inserted",
":",
"id",
"key",
"19",
"abc",
"23",
"ab",
"37",
"abcd",
"then",
"Jump",
"(",
"[]",
"byte",
"(",
"ab",
")",
"0",
")",
"=",
"23",
"nil",
"//",
"reach",
"ab",
"from",
"root",
"Jump",
"(",
"[]",
"byte",
"(",
"c",
")",
"23",
")",
"=",
"19",
"nil",
"//",
"reach",
"abc",
"from",
"ab",
"Jump",
"(",
"[]",
"byte",
"(",
"cd",
")",
"23",
")",
"=",
"37",
"nil",
"//",
"reach",
"abcd",
"from",
"ab"
] | [
"func",
"(",
"da",
"*",
"Cedar",
")",
"Jump",
"(",
"path",
"[",
"]",
"byte",
",",
"from",
"int",
")",
"(",
"to",
"int",
",",
"err",
"error",
")",
"{",
"for",
"_",
",",
"b",
":=",
"range",
"path",
"{",
"if",
"da",
".",
"Array",
"[",
"from",
"]",
".",
"<mask>",
">=",
"0",
"{",
"return",
"from",
",",
"ErrNoPath",
"\n",
"}",
"\n",
"to",
"=",
"da",
".",
"Array",
"[",
"from",
"]",
".",
"base",
"(",
")",
"^",
"int",
"(",
"b",
")",
"\n",
"if",
"da",
".",
"Array",
"[",
"to",
"]",
".",
"Check",
"!=",
"from",
"{",
"return",
"from",
",",
"ErrNoPath",
"\n",
"}",
"\n",
"from",
"=",
"to",
"\n",
"}",
"\n",
"return",
"to",
",",
"nil",
"\n",
"}"
] |
22,665 | all-22666 | [
"FuncMap",
"will",
"return",
"helper",
"to",
"render",
"inline",
"edit",
"button"
] | [
"func",
"(",
"<mask>",
"*",
"ActionBar",
")",
"FuncMap",
"(",
"w",
"http",
".",
"ResponseWriter",
",",
"r",
"*",
"http",
".",
"Request",
")",
"template",
".",
"FuncMap",
"{",
"funcMap",
":=",
"template",
".",
"FuncMap",
"{",
"}",
"\n\n",
"funcMap",
"[",
"\"",
"\"",
"]",
"=",
"func",
"(",
"value",
"interface",
"{",
"}",
",",
"resources",
"...",
"*",
"admin",
".",
"Resource",
")",
"template",
".",
"HTML",
"{",
"return",
"bar",
".",
"RenderEditButtonWithResource",
"(",
"w",
",",
"r",
",",
"value",
",",
"resources",
"...",
")",
"\n",
"}",
"\n\n",
"return",
"funcMap",
"\n",
"}"
] |
22,666 | all-22667 | [
"Name",
"sets",
"the",
"name",
"of",
"the",
"manager",
"."
] | [
"func",
"Name",
"(",
"n",
"string",
")",
"func",
"(",
"*",
"<mask>",
")",
"{",
"return",
"func",
"(",
"m",
"*",
"Manager",
")",
"{",
"m",
".",
"mtx",
".",
"Lock",
"(",
")",
"\n",
"defer",
"m",
".",
"mtx",
".",
"Unlock",
"(",
")",
"\n",
"m",
".",
"name",
"=",
"n",
"\n",
"}",
"\n",
"}"
] |
22,667 | all-22668 | [
"applyConfChange",
"applies",
"a",
"ConfChange",
"to",
"the",
"server",
".",
"It",
"is",
"only",
"invoked",
"with",
"a",
"ConfChange",
"that",
"has",
"already",
"passed",
"through",
"Raft"
] | [
"func",
"(",
"s",
"*",
"EtcdServer",
")",
"applyConfChange",
"(",
"cc",
"raftpb",
".",
"ConfChange",
",",
"confState",
"*",
"raftpb",
".",
"ConfState",
")",
"(",
"bool",
",",
"error",
")",
"{",
"if",
"err",
":=",
"s",
".",
"cluster",
".",
"ValidateConfigurationChange",
"(",
"cc",
")",
";",
"err",
"!=",
"nil",
"{",
"cc",
".",
"NodeID",
"=",
"raft",
".",
"None",
"\n",
"s",
".",
"r",
".",
"ApplyConfChange",
"(",
"cc",
")",
"\n",
"return",
"false",
",",
"err",
"\n",
"}",
"\n\n",
"lg",
":=",
"s",
".",
"getLogger",
"(",
")",
"\n",
"*",
"confState",
"=",
"*",
"s",
".",
"r",
".",
"ApplyConfChange",
"(",
"cc",
")",
"\n",
"switch",
"cc",
".",
"Type",
"{",
"case",
"raftpb",
".",
"ConfChangeAddNode",
":",
"m",
":=",
"new",
"(",
"membership",
".",
"Member",
")",
"\n",
"if",
"err",
":=",
"json",
".",
"Unmarshal",
"(",
"cc",
".",
"<mask>",
",",
"m",
")",
";",
"err",
"!=",
"nil",
"{",
"if",
"lg",
"!=",
"nil",
"{",
"lg",
".",
"Panic",
"(",
"\"",
"\"",
",",
"zap",
".",
"Error",
"(",
"err",
")",
")",
"\n",
"}",
"else",
"{",
"plog",
".",
"Panicf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"}",
"\n",
"}",
"\n",
"if",
"cc",
".",
"NodeID",
"!=",
"uint64",
"(",
"m",
".",
"ID",
")",
"{",
"if",
"lg",
"!=",
"nil",
"{",
"lg",
".",
"Panic",
"(",
"\"",
"\"",
",",
"zap",
".",
"String",
"(",
"\"",
"\"",
",",
"types",
".",
"ID",
"(",
"cc",
".",
"NodeID",
")",
".",
"String",
"(",
")",
")",
",",
"zap",
".",
"String",
"(",
"\"",
"\"",
",",
"m",
".",
"ID",
".",
"String",
"(",
")",
")",
",",
")",
"\n",
"}",
"else",
"{",
"plog",
".",
"Panicf",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"}",
"\n",
"s",
".",
"cluster",
".",
"AddMember",
"(",
"m",
")",
"\n",
"if",
"m",
".",
"ID",
"!=",
"s",
".",
"id",
"{",
"s",
".",
"r",
".",
"transport",
".",
"AddPeer",
"(",
"m",
".",
"ID",
",",
"m",
".",
"PeerURLs",
")",
"\n",
"}",
"\n\n",
"case",
"raftpb",
".",
"ConfChangeRemoveNode",
":",
"id",
":=",
"types",
".",
"ID",
"(",
"cc",
".",
"NodeID",
")",
"\n",
"s",
".",
"cluster",
".",
"RemoveMember",
"(",
"id",
")",
"\n",
"if",
"id",
"==",
"s",
".",
"id",
"{",
"return",
"true",
",",
"nil",
"\n",
"}",
"\n",
"s",
".",
"r",
".",
"transport",
".",
"RemovePeer",
"(",
"id",
")",
"\n\n",
"case",
"raftpb",
".",
"ConfChangeUpdateNode",
":",
"m",
":=",
"new",
"(",
"membership",
".",
"Member",
")",
"\n",
"if",
"err",
":=",
"json",
".",
"Unmarshal",
"(",
"cc",
".",
"Context",
",",
"m",
")",
";",
"err",
"!=",
"nil",
"{",
"if",
"lg",
"!=",
"nil",
"{",
"lg",
".",
"Panic",
"(",
"\"",
"\"",
",",
"zap",
".",
"Error",
"(",
"err",
")",
")",
"\n",
"}",
"else",
"{",
"plog",
".",
"Panicf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"}",
"\n",
"}",
"\n",
"if",
"cc",
".",
"NodeID",
"!=",
"uint64",
"(",
"m",
".",
"ID",
")",
"{",
"if",
"lg",
"!=",
"nil",
"{",
"lg",
".",
"Panic",
"(",
"\"",
"\"",
",",
"zap",
".",
"String",
"(",
"\"",
"\"",
",",
"types",
".",
"ID",
"(",
"cc",
".",
"NodeID",
")",
".",
"String",
"(",
")",
")",
",",
"zap",
".",
"String",
"(",
"\"",
"\"",
",",
"m",
".",
"ID",
".",
"String",
"(",
")",
")",
",",
")",
"\n",
"}",
"else",
"{",
"plog",
".",
"Panicf",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"}",
"\n",
"s",
".",
"cluster",
".",
"UpdateRaftAttributes",
"(",
"m",
".",
"ID",
",",
"m",
".",
"RaftAttributes",
")",
"\n",
"if",
"m",
".",
"ID",
"!=",
"s",
".",
"id",
"{",
"s",
".",
"r",
".",
"transport",
".",
"UpdatePeer",
"(",
"m",
".",
"ID",
",",
"m",
".",
"PeerURLs",
")",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"false",
",",
"nil",
"\n",
"}"
] |
22,668 | all-22669 | [
"SetTabLabel",
"()",
"is",
"a",
"wrapper",
"around",
"gtk_notebook_set_tab_label",
"()",
"."
] | [
"func",
"(",
"v",
"*",
"Notebook",
")",
"SetTabLabel",
"(",
"<mask>",
",",
"tabLabel",
"IWidget",
")",
"{",
"C",
".",
"gtk_notebook_set_tab_label",
"(",
"v",
".",
"native",
"(",
")",
",",
"child",
".",
"toWidget",
"(",
")",
",",
"tabLabel",
".",
"toWidget",
"(",
")",
")",
"\n",
"}"
] |
22,669 | all-22670 | [
"importBreakPaths",
"returns",
"a",
"slice",
"that",
"contains",
"the",
"import",
"paths",
"before",
"which",
"a",
"line",
"breaks",
"should",
"be",
"inserted",
"."
] | [
"func",
"importBreakPaths",
"(",
"file",
"*",
"ast",
".",
"File",
")",
"[",
"]",
"string",
"{",
"var",
"output",
"[",
"]",
"string",
"\n\n",
"for",
"_",
",",
"decl",
":=",
"range",
"file",
".",
"Decls",
"{",
"if",
"<mask>",
",",
"ok",
":=",
"decl",
".",
"(",
"*",
"ast",
".",
"GenDecl",
")",
";",
"ok",
"&&",
"gen",
".",
"Tok",
"==",
"token",
".",
"IMPORT",
"{",
"for",
"srcIndex",
",",
"currSpec",
":=",
"range",
"gen",
".",
"Specs",
"{",
"if",
"srcIndex",
">",
"0",
"{",
"// if there was a previous element, check if the group has changed",
"currGroup",
":=",
"importGroup",
"(",
"importPath",
"(",
"currSpec",
")",
")",
"\n",
"prevGroup",
":=",
"importGroup",
"(",
"importPath",
"(",
"gen",
".",
"Specs",
"[",
"srcIndex",
"-",
"1",
"]",
")",
")",
"\n",
"if",
"currGroup",
"!=",
"prevGroup",
"{",
"// if group has changed, add path to the output",
"output",
"=",
"append",
"(",
"output",
",",
"importPath",
"(",
"gen",
".",
"Specs",
"[",
"srcIndex",
"]",
")",
")",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n\n",
"// assume that only one import token block exists",
"break",
"\n",
"}",
"\n",
"}",
"\n\n",
"return",
"output",
"\n",
"}"
] |
22,670 | all-22671 | [
"copy",
"a",
"three",
"-",
"dimensional",
"texture",
"subimage"
] | [
"func",
"CopyTextureSubImage3D",
"(",
"texture",
"uint32",
",",
"level",
"int32",
",",
"xoffset",
"int32",
",",
"yoffset",
"int32",
",",
"zoffset",
"int32",
",",
"x",
"int32",
",",
"y",
"int32",
",",
"width",
"int32",
",",
"height",
"int32",
")",
"{",
"C",
".",
"glowCopyTextureSubImage3D",
"(",
"gpCopyTextureSubImage3D",
",",
"(",
"C",
".",
"GLuint",
")",
"(",
"texture",
")",
",",
"(",
"C",
".",
"GLint",
")",
"(",
"<mask>",
")",
",",
"(",
"C",
".",
"GLint",
")",
"(",
"xoffset",
")",
",",
"(",
"C",
".",
"GLint",
")",
"(",
"yoffset",
")",
",",
"(",
"C",
".",
"GLint",
")",
"(",
"zoffset",
")",
",",
"(",
"C",
".",
"GLint",
")",
"(",
"x",
")",
",",
"(",
"C",
".",
"GLint",
")",
"(",
"y",
")",
",",
"(",
"C",
".",
"GLsizei",
")",
"(",
"width",
")",
",",
"(",
"C",
".",
"GLsizei",
")",
"(",
"height",
")",
")",
"\n",
"}"
] |
22,671 | all-22672 | [
"doJsonRequestUnredacted",
"is",
"the",
"simplest",
"type",
"of",
"request",
":",
"a",
"method",
"on",
"a",
"URI",
"that",
"returns",
"some",
"JSON",
"result",
"which",
"we",
"unmarshal",
"into",
"the",
"passed",
"interface",
"."
] | [
"func",
"(",
"client",
"*",
"Client",
")",
"doJsonRequestUnredacted",
"(",
"method",
",",
"api",
"string",
",",
"reqbody",
",",
"out",
"<mask>",
"{",
"}",
")",
"error",
"{",
"req",
",",
"err",
":=",
"client",
".",
"createRequest",
"(",
"method",
",",
"api",
",",
"reqbody",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"// Perform the request and retry it if it's not a POST or PUT request",
"var",
"resp",
"*",
"http",
".",
"Response",
"\n",
"if",
"method",
"==",
"\"",
"\"",
"||",
"method",
"==",
"\"",
"\"",
"{",
"resp",
",",
"err",
"=",
"client",
".",
"HttpClient",
".",
"Do",
"(",
"req",
")",
"\n",
"}",
"else",
"{",
"resp",
",",
"err",
"=",
"client",
".",
"doRequestWithRetries",
"(",
"req",
",",
"client",
".",
"RetryTimeout",
")",
"\n",
"}",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"defer",
"resp",
".",
"Body",
".",
"Close",
"(",
")",
"\n\n",
"if",
"resp",
".",
"StatusCode",
"<",
"200",
"||",
"resp",
".",
"StatusCode",
">",
"299",
"{",
"body",
",",
"err",
":=",
"ioutil",
".",
"ReadAll",
"(",
"resp",
".",
"Body",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"resp",
".",
"Status",
",",
"body",
")",
"\n",
"}",
"\n\n",
"body",
",",
"err",
":=",
"ioutil",
".",
"ReadAll",
"(",
"resp",
".",
"Body",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"// If we got no body, by default let's just make an empty JSON dict. This",
"// saves us some work in other parts of the code.",
"if",
"len",
"(",
"body",
")",
"==",
"0",
"{",
"body",
"=",
"[",
"]",
"byte",
"{",
"'{'",
",",
"'}'",
"}",
"\n",
"}",
"\n\n",
"// Try to parse common response fields to check whether there's an error reported in a response.",
"var",
"common",
"*",
"Response",
"\n",
"err",
"=",
"json",
".",
"Unmarshal",
"(",
"body",
",",
"&",
"common",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"// UnmarshalTypeError errors are ignored, because in some cases API response is an array that cannot be",
"// unmarshalled into a struct.",
"_",
",",
"ok",
":=",
"err",
".",
"(",
"*",
"json",
".",
"UnmarshalTypeError",
")",
"\n",
"if",
"!",
"ok",
"{",
"return",
"err",
"\n",
"}",
"\n",
"}",
"\n",
"if",
"common",
"!=",
"nil",
"&&",
"common",
".",
"Status",
"==",
"\"",
"\"",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"common",
".",
"Error",
")",
"\n",
"}",
"\n\n",
"// If they don't care about the body, then we don't care to give them one,",
"// so bail out because we're done.",
"if",
"out",
"==",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n\n",
"return",
"json",
".",
"Unmarshal",
"(",
"body",
",",
"&",
"out",
")",
"\n",
"}"
] |
22,672 | all-22673 | [
"New",
"creates",
"Cmp",
"for",
"single",
"comparison",
"mode",
"."
] | [
"func",
"New",
"(",
"buf",
"[",
"]",
"byte",
",",
"options",
"<mask>",
")",
"*",
"Cmp",
"{",
"return",
"NewMultiple",
"(",
"buf",
",",
"options",
",",
"nil",
",",
"true",
")",
"\n",
"}"
] |
22,673 | all-22674 | [
"Debugf",
"logs",
"at",
"the",
"DEBUG",
"log",
"level",
"using",
"a",
"standard",
"printf",
"format",
"string"
] | [
"func",
"Debugf",
"(",
"format",
"string",
",",
"args",
"...",
"interface",
"{",
"}",
")",
"{",
"if",
"Log",
"!=",
"nil",
"{",
"<mask>",
".",
"Debug",
"(",
"fmt",
".",
"Sprintf",
"(",
"format",
",",
"args",
"...",
")",
")",
"\n",
"}",
"\n",
"}"
] |
22,674 | all-22675 | [
"MarshalJSON",
"overrides",
"the",
"logic",
"for",
"JSON",
"-",
"encoding",
"the",
"ResourceStatus",
"type"
] | [
"func",
"(",
"vs",
"*",
"VolumeStatus",
")",
"MarshalJSON",
"(",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"if",
"<mask>",
"==",
"nil",
"{",
"return",
"nil",
",",
"nil",
"\n",
"}",
"\n",
"return",
"[",
"]",
"byte",
"(",
"`\"`",
"+",
"vs",
".",
"String",
"(",
")",
"+",
"`\"`",
")",
",",
"nil",
"\n",
"}"
] |
22,675 | all-22676 | [
"You",
"can",
"call",
"this",
"as",
"many",
"times",
"as",
"you",
"d",
"like",
".",
"XXX",
"TODO",
"review"
] | [
"func",
"(",
"ri",
"*",
"randInfo",
")",
"MixEntropy",
"(",
"seedBytes",
"[",
"]",
"byte",
")",
"{",
"ri",
".",
"mtx",
".",
"Lock",
"(",
")",
"\n",
"defer",
"ri",
".",
"mtx",
".",
"Unlock",
"(",
")",
"\n",
"// Make new ri.seedBytes using passed seedBytes and current ri.seedBytes:",
"// ri.seedBytes = sha256( seedBytes || ri.seedBytes )",
"h",
":=",
"sha256",
".",
"New",
"(",
")",
"\n",
"h",
".",
"Write",
"(",
"seedBytes",
")",
"\n",
"h",
".",
"Write",
"(",
"ri",
".",
"seedBytes",
"[",
":",
"]",
")",
"\n",
"hashBytes",
":=",
"h",
".",
"Sum",
"(",
"nil",
")",
"\n",
"hashBytes32",
":=",
"[",
"32",
"]",
"byte",
"{",
"}",
"\n",
"copy",
"(",
"hashBytes32",
"[",
":",
"]",
",",
"hashBytes",
")",
"\n",
"ri",
".",
"seedBytes",
"=",
"xorBytes32",
"(",
"ri",
".",
"seedBytes",
",",
"hashBytes32",
")",
"\n",
"// Create new cipher.Block",
"<mask>",
"err",
"error",
"\n",
"ri",
".",
"cipherAES256",
",",
"err",
"=",
"aes",
".",
"NewCipher",
"(",
"ri",
".",
"seedBytes",
"[",
":",
"]",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"PanicSanity",
"(",
"\"",
"\"",
"+",
"err",
".",
"Error",
"(",
")",
")",
"\n",
"}",
"\n",
"// Create new stream",
"ri",
".",
"streamAES256",
"=",
"cipher",
".",
"NewCTR",
"(",
"ri",
".",
"cipherAES256",
",",
"randBytes",
"(",
"aes",
".",
"BlockSize",
")",
")",
"\n",
"// Create new reader",
"ri",
".",
"reader",
"=",
"&",
"cipher",
".",
"StreamReader",
"{",
"S",
":",
"ri",
".",
"streamAES256",
",",
"R",
":",
"crand",
".",
"Reader",
"}",
"\n",
"}"
] |
22,676 | all-22677 | [
"SetLevelWriter",
"sets",
"writer",
"to",
"glg",
"std",
"writer",
"per",
"logging",
"level"
] | [
"func",
"(",
"g",
"*",
"Glg",
")",
"SetLevelWriter",
"(",
"level",
"LEVEL",
",",
"<mask>",
"io",
".",
"Writer",
")",
"*",
"Glg",
"{",
"if",
"writer",
"==",
"nil",
"{",
"return",
"g",
"\n",
"}",
"\n\n",
"lev",
",",
"ok",
":=",
"g",
".",
"logger",
".",
"Load",
"(",
"level",
")",
"\n",
"if",
"ok",
"{",
"l",
":=",
"lev",
".",
"(",
"*",
"logger",
")",
"\n",
"l",
".",
"writer",
"=",
"writer",
"\n",
"l",
".",
"updateMode",
"(",
")",
"\n",
"g",
".",
"logger",
".",
"Store",
"(",
"level",
",",
"l",
")",
"\n",
"}",
"\n\n",
"return",
"g",
"\n",
"}"
] |
22,677 | all-22678 | [
"Distinct",
"unmarshals",
"into",
"result",
"the",
"list",
"of",
"distinct",
"values",
"for",
"the",
"given",
"key",
".",
"For",
"example",
":",
"var",
"result",
"[]",
"int",
"err",
":",
"=",
"collection",
".",
"Find",
"(",
"bson",
".",
"M",
"{",
"gender",
":",
"F",
"}",
")",
".",
"Distinct",
"(",
"age",
"&result",
")",
"Relevant",
"documentation",
":",
"http",
":",
"//",
"www",
".",
"mongodb",
".",
"org",
"/",
"display",
"/",
"DOCS",
"/",
"Aggregation"
] | [
"func",
"(",
"q",
"*",
"Query",
")",
"Distinct",
"(",
"key",
"string",
",",
"result",
"interface",
"{",
"}",
")",
"error",
"{",
"q",
".",
"m",
".",
"Lock",
"(",
")",
"\n",
"session",
":=",
"q",
".",
"session",
"\n",
"op",
":=",
"q",
".",
"op",
"// Copy.",
"\n",
"q",
".",
"m",
".",
"Unlock",
"(",
")",
"\n\n",
"c",
":=",
"strings",
".",
"Index",
"(",
"op",
".",
"collection",
",",
"\"",
"\"",
")",
"\n",
"if",
"c",
"<",
"0",
"{",
"return",
"errors",
".",
"New",
"(",
"\"",
"\"",
"+",
"op",
".",
"collection",
")",
"\n",
"}",
"\n\n",
"dbname",
":=",
"op",
".",
"collection",
"[",
":",
"c",
"]",
"\n",
"cname",
":=",
"op",
".",
"collection",
"[",
"c",
"+",
"1",
":",
"]",
"\n\n",
"var",
"doc",
"struct",
"{",
"Values",
"bson",
".",
"Raw",
"}",
"\n",
"err",
":=",
"session",
".",
"<mask>",
"(",
"dbname",
")",
".",
"Run",
"(",
"distinctCmd",
"{",
"cname",
",",
"key",
",",
"op",
".",
"query",
"}",
",",
"&",
"doc",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"return",
"doc",
".",
"Values",
".",
"Unmarshal",
"(",
"result",
")",
"\n",
"}"
] |
22,678 | all-22679 | [
"checkIsAuthorized",
"returns",
"an",
"error",
"if",
"the",
"current",
"user",
"(",
"in",
"pachClient",
")",
"has",
"authorization",
"scope",
"s",
"for",
"repo",
"r"
] | [
"func",
"(",
"d",
"*",
"driver",
")",
"checkIsAuthorized",
"(",
"pachClient",
"*",
"client",
".",
"APIClient",
",",
"r",
"*",
"pfs",
".",
"Repo",
",",
"s",
"auth",
".",
"Scope",
")",
"error",
"{",
"ctx",
":=",
"pachClient",
".",
"Ctx",
"(",
")",
"\n",
"me",
",",
"err",
":=",
"pachClient",
".",
"WhoAmI",
"(",
"ctx",
",",
"&",
"auth",
".",
"WhoAmIRequest",
"{",
"}",
")",
"\n",
"if",
"auth",
".",
"IsErrNotActivated",
"(",
"err",
")",
"{",
"return",
"nil",
"\n",
"}",
"\n",
"resp",
",",
"err",
":=",
"pachClient",
".",
"AuthAPIClient",
".",
"Authorize",
"(",
"ctx",
",",
"&",
"auth",
".",
"AuthorizeRequest",
"{",
"Repo",
":",
"r",
".",
"Name",
",",
"Scope",
":",
"s",
",",
"}",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\\\"",
"\\\"",
"\"",
",",
"r",
".",
"Name",
",",
"grpcutil",
".",
"ScrubGRPC",
"(",
"err",
")",
")",
"\n",
"}",
"\n",
"if",
"!",
"resp",
".",
"Authorized",
"{",
"return",
"&",
"auth",
".",
"ErrNotAuthorized",
"{",
"Subject",
":",
"<mask>",
".",
"Username",
",",
"Repo",
":",
"r",
".",
"Name",
",",
"Required",
":",
"s",
"}",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
] |
22,679 | all-22680 | [
"Enqueue",
"will",
"enqueue",
"a",
"job",
"using",
"the",
"specified",
"name",
"and",
"data",
".",
"If",
"a",
"delay",
"is",
"specified",
"the",
"job",
"will",
"not",
"be",
"dequeued",
"until",
"the",
"specified",
"time",
"has",
"passed",
"."
] | [
"func",
"Enqueue",
"(",
"store",
"*",
"coal",
".",
"SubStore",
",",
"name",
"string",
",",
"data",
"Model",
",",
"delay",
"time",
".",
"Duration",
")",
"(",
"*",
"Job",
",",
"error",
")",
"{",
"// set default data",
"if",
"data",
"==",
"nil",
"{",
"data",
"=",
"bson",
".",
"M",
"{",
"}",
"\n",
"}",
"\n\n",
"// get time",
"now",
":=",
"<mask>",
".",
"Now",
"(",
")",
"\n\n",
"// prepare job",
"job",
":=",
"coal",
".",
"Init",
"(",
"&",
"Job",
"{",
"Name",
":",
"name",
",",
"Status",
":",
"StatusEnqueued",
",",
"Created",
":",
"now",
",",
"Available",
":",
"now",
".",
"Add",
"(",
"delay",
")",
",",
"}",
")",
".",
"(",
"*",
"Job",
")",
"\n\n",
"// marshall data",
"raw",
",",
"err",
":=",
"bson",
".",
"Marshal",
"(",
"data",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"// marshall into job",
"err",
"=",
"bson",
".",
"Unmarshal",
"(",
"raw",
",",
"&",
"job",
".",
"Data",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"// insert job",
"err",
"=",
"store",
".",
"C",
"(",
"job",
")",
".",
"Insert",
"(",
"job",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"return",
"job",
",",
"nil",
"\n",
"}"
] |
22,680 | all-22681 | [
"Delete",
"deletes",
"specified",
"token",
"from",
"current",
"SessionCache",
"instance",
"."
] | [
"func",
"(",
"s",
"*",
"SessionCache",
")",
"Delete",
"(",
"token",
"string",
")",
"error",
"{",
"err",
":=",
"s",
".",
"cache",
".",
"Delete",
"(",
"token",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"s",
".",
"getInvalidTokenError",
"(",
"<mask>",
")",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
] |
22,681 | all-22682 | [
"LastNLines",
"reads",
"the",
"last",
"n",
"lines",
"from",
"an",
"artifact",
"."
] | [
"func",
"LastNLines",
"(",
"a",
"Artifact",
",",
"n",
"int64",
")",
"(",
"[",
"]",
"<mask>",
",",
"error",
")",
"{",
"// 300B, a reasonable log line length, probably a bit more scalable than a hard-coded value",
"return",
"LastNLinesChunked",
"(",
"a",
",",
"n",
",",
"300",
"*",
"n",
"+",
"1",
")",
"\n",
"}"
] |
22,682 | all-22683 | [
"Run",
"()",
"is",
"a",
"wrapper",
"around",
"gtk_native_dialog_run",
"()",
"."
] | [
"func",
"(",
"v",
"*",
"NativeDialog",
")",
"Run",
"(",
")",
"int",
"{",
"c",
":=",
"C",
".",
"gtk_native_dialog_run",
"(",
"v",
".",
"native",
"(",
")",
")",
"\n",
"<mask>",
"int",
"(",
"c",
")",
"\n",
"}"
] |
22,683 | all-22684 | [
"MarshalJSON",
"calls",
"json",
".",
"RawMessage",
"method",
"of",
"the",
"same",
"name",
".",
"Required",
"since",
"Var3",
"is",
"of",
"type",
"json",
".",
"RawMessage",
"..."
] | [
"func",
"(",
"this",
"*",
"Var3",
")",
"MarshalJSON",
"(",
")",
"(",
"[",
"]",
"<mask>",
",",
"error",
")",
"{",
"x",
":=",
"json",
".",
"RawMessage",
"(",
"*",
"this",
")",
"\n",
"return",
"(",
"&",
"x",
")",
".",
"MarshalJSON",
"(",
")",
"\n",
"}"
] |
22,684 | all-22685 | [
"SetTrustline",
"mutates",
"key",
"such",
"that",
"it",
"represents",
"the",
"identity",
"of",
"the",
"trustline",
"owned",
"by",
"account",
"and",
"for",
"asset",
"."
] | [
"func",
"(",
"key",
"*",
"LedgerKey",
")",
"SetTrustline",
"(",
"account",
"AccountId",
",",
"line",
"Asset",
")",
"error",
"{",
"data",
":=",
"LedgerKeyTrustLine",
"{",
"account",
",",
"<mask>",
"}",
"\n",
"nkey",
",",
"err",
":=",
"NewLedgerKey",
"(",
"LedgerEntryTypeTrustline",
",",
"data",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"*",
"key",
"=",
"nkey",
"\n",
"return",
"nil",
"\n",
"}"
] |
22,685 | all-22686 | [
"HasRoleName",
"returns",
"a",
"boolean",
"if",
"a",
"field",
"has",
"been",
"set",
"."
] | [
"func",
"(",
"i",
"*",
"IntegrationAWSAccountDeleteRequest",
")",
"HasRoleName",
"(",
")",
"bool",
"{",
"if",
"i",
"!=",
"nil",
"&&",
"i",
".",
"RoleName",
"!=",
"nil",
"{",
"return",
"<mask>",
"\n",
"}",
"\n\n",
"return",
"false",
"\n",
"}"
] |
22,686 | all-22687 | [
"Header",
"renders",
"the",
"content",
"of",
"<head",
">",
"from",
"template",
".",
"html",
"."
] | [
"func",
"(",
"lens",
"Lens",
")",
"Header",
"(",
"artifacts",
"[",
"]",
"lenses",
".",
"Artifact",
",",
"resourceDir",
"string",
")",
"string",
"{",
"t",
",",
"err",
":=",
"template",
".",
"ParseFiles",
"(",
"filepath",
".",
"Join",
"(",
"resourceDir",
",",
"\"",
"\"",
")",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"}",
"\n",
"var",
"buf",
"bytes",
".",
"<mask>",
"\n",
"if",
"err",
":=",
"t",
".",
"ExecuteTemplate",
"(",
"&",
"buf",
",",
"\"",
"\"",
",",
"nil",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"}",
"\n",
"return",
"buf",
".",
"String",
"(",
")",
"\n",
"}"
] |
22,687 | all-22688 | [
"Set",
"allows",
"to",
"set",
"a",
"list",
"of",
"values",
"into",
"a",
"particular",
"key",
"."
] | [
"func",
"(",
"f",
"Flash",
")",
"<mask>",
"(",
"key",
"string",
",",
"values",
"[",
"]",
"string",
")",
"{",
"f",
".",
"data",
"[",
"key",
"]",
"=",
"values",
"\n",
"}"
] |
22,688 | all-22689 | [
"MarshalEasyJSON",
"satisfies",
"easyjson",
".",
"Marshaler",
"."
] | [
"func",
"(",
"t",
"TimeSinceEpoch",
")",
"MarshalEasyJSON",
"(",
"out",
"*",
"jwriter",
".",
"Writer",
")",
"{",
"v",
":=",
"float64",
"(",
"time",
".",
"Time",
"(",
"t",
")",
".",
"UnixNano",
"(",
")",
"/",
"int64",
"(",
"time",
".",
"Second",
")",
")",
"\n\n",
"out",
".",
"Buffer",
".",
"EnsureSpace",
"(",
"20",
")",
"\n",
"out",
".",
"Buffer",
".",
"Buf",
"=",
"strconv",
".",
"AppendFloat",
"(",
"<mask>",
".",
"Buffer",
".",
"Buf",
",",
"v",
",",
"'f'",
",",
"-",
"1",
",",
"64",
")",
"\n",
"}"
] |
22,689 | all-22690 | [
"WriteFile",
"mocks",
"base",
"method"
] | [
"func",
"(",
"m",
"*",
"MockIOUtil",
")",
"WriteFile",
"(",
"arg0",
"string",
",",
"arg1",
"[",
"]",
"byte",
",",
"arg2",
"os",
".",
"FileMode",
")",
"error",
"{",
"ret",
":=",
"m",
".",
"ctrl",
".",
"Call",
"(",
"m",
",",
"\"",
"\"",
",",
"arg0",
",",
"arg1",
",",
"arg2",
")",
"\n",
"ret0",
",",
"_",
":=",
"<mask>",
"[",
"0",
"]",
".",
"(",
"error",
")",
"\n",
"return",
"ret0",
"\n",
"}"
] |
22,690 | all-22691 | [
"Do",
"executes",
"HeapProfiler",
".",
"stopSampling",
"against",
"the",
"provided",
"context",
".",
"returns",
":",
"profile",
"-",
"Recorded",
"sampling",
"heap",
"profile",
"."
] | [
"func",
"(",
"p",
"*",
"StopSamplingParams",
")",
"Do",
"(",
"ctx",
"<mask>",
".",
"Context",
")",
"(",
"profile",
"*",
"SamplingHeapProfile",
",",
"err",
"error",
")",
"{",
"// execute",
"var",
"res",
"StopSamplingReturns",
"\n",
"err",
"=",
"cdp",
".",
"Execute",
"(",
"ctx",
",",
"CommandStopSampling",
",",
"nil",
",",
"&",
"res",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"return",
"res",
".",
"Profile",
",",
"nil",
"\n",
"}"
] |
22,691 | all-22692 | [
"GenerateQuery",
"generates",
"a",
"query",
"by",
"substituting",
"the",
"specified",
"bindVariables",
".",
"The",
"extras",
"parameter",
"specifies",
"special",
"parameters",
"that",
"can",
"perform",
"custom",
"encoding",
"."
] | [
"func",
"(",
"pq",
"*",
"ParsedQuery",
")",
"GenerateQuery",
"(",
"bindVariables",
"map",
"[",
"string",
"]",
"*",
"querypb",
".",
"BindVariable",
",",
"extras",
"map",
"[",
"string",
"]",
"Encodable",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"if",
"len",
"(",
"pq",
".",
"bindLocations",
")",
"==",
"0",
"{",
"return",
"[",
"]",
"byte",
"(",
"pq",
".",
"Query",
")",
",",
"nil",
"\n",
"}",
"\n",
"buf",
":=",
"bytes",
".",
"NewBuffer",
"(",
"make",
"(",
"[",
"]",
"byte",
",",
"0",
",",
"len",
"(",
"pq",
".",
"Query",
")",
")",
")",
"\n",
"current",
":=",
"0",
"\n",
"for",
"_",
",",
"loc",
":=",
"range",
"pq",
".",
"bindLocations",
"{",
"buf",
".",
"WriteString",
"(",
"pq",
".",
"Query",
"[",
"current",
":",
"loc",
".",
"offset",
"]",
")",
"\n",
"name",
":=",
"pq",
".",
"Query",
"[",
"loc",
".",
"offset",
":",
"loc",
".",
"offset",
"+",
"loc",
".",
"length",
"]",
"\n",
"if",
"encodable",
",",
"ok",
":=",
"extras",
"[",
"name",
"[",
"1",
":",
"]",
"]",
";",
"ok",
"{",
"encodable",
".",
"EncodeSQL",
"(",
"buf",
")",
"\n",
"}",
"else",
"{",
"supplied",
",",
"_",
",",
"err",
":=",
"FetchBindVar",
"(",
"name",
",",
"bindVariables",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"EncodeValue",
"(",
"buf",
",",
"supplied",
")",
"\n",
"}",
"\n",
"current",
"=",
"loc",
".",
"offset",
"+",
"loc",
".",
"length",
"\n",
"}",
"\n",
"buf",
".",
"WriteString",
"(",
"pq",
".",
"Query",
"[",
"<mask>",
":",
"]",
")",
"\n",
"return",
"buf",
".",
"Bytes",
"(",
")",
",",
"nil",
"\n",
"}"
] |
22,692 | all-22693 | [
"String",
"satisfies",
"stringer",
"interface",
"."
] | [
"func",
"(",
"fs",
"FrameState",
")",
"<mask>",
"(",
")",
"string",
"{",
"var",
"s",
"[",
"]",
"string",
"\n",
"for",
"k",
",",
"v",
":=",
"range",
"frameStateNames",
"{",
"if",
"fs",
"&",
"k",
"!=",
"0",
"{",
"s",
"=",
"append",
"(",
"s",
",",
"v",
")",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"\"",
"\"",
"+",
"strings",
".",
"Join",
"(",
"s",
",",
"\"",
"\"",
")",
"+",
"\"",
"\"",
"\n",
"}"
] |
22,693 | all-22694 | [
"Return",
"a",
"Transport",
"object",
"that",
"defaults",
"to",
"using",
"the",
"same",
"store",
"that",
"we",
"used",
"to",
"build",
"this",
"reference",
"object",
"."
] | [
"func",
"(",
"s",
"storageReference",
")",
"Transport",
"(",
")",
"types",
".",
"ImageTransport",
"{",
"return",
"&",
"storageTransport",
"{",
"<mask>",
":",
"s",
".",
"transport",
".",
"store",
",",
"defaultUIDMap",
":",
"s",
".",
"transport",
".",
"defaultUIDMap",
",",
"defaultGIDMap",
":",
"s",
".",
"transport",
".",
"defaultGIDMap",
",",
"}",
"\n",
"}"
] |
22,694 | all-22695 | [
"Finds",
"a",
"Func",
"for",
"the",
"given",
"address",
".",
"Sort",
"must",
"have",
"been",
"called",
"already",
"."
] | [
"func",
"(",
"t",
"*",
"funcTab",
")",
"find",
"(",
"pc",
"core",
".",
"Address",
")",
"*",
"Func",
"{",
"n",
":=",
"sort",
".",
"Search",
"(",
"len",
"(",
"t",
".",
"entries",
")",
",",
"func",
"(",
"i",
"int",
")",
"bool",
"{",
"return",
"t",
".",
"entries",
"[",
"i",
"]",
".",
"max",
">",
"pc",
"\n",
"}",
")",
"\n",
"if",
"n",
"==",
"len",
"(",
"t",
".",
"entries",
")",
"||",
"pc",
"<",
"t",
".",
"entries",
"[",
"n",
"]",
".",
"min",
"||",
"pc",
">=",
"t",
".",
"entries",
"[",
"n",
"]",
".",
"<mask>",
"{",
"return",
"nil",
"\n",
"}",
"\n",
"return",
"t",
".",
"entries",
"[",
"n",
"]",
".",
"f",
"\n",
"}"
] |
22,695 | all-22696 | [
"Write",
"a",
"marker",
"file",
"to",
"GCS",
"named",
"after",
"this",
"node",
"to",
"indicate",
"logexporter",
"s",
"success",
".",
"The",
"directory",
"to",
"which",
"we",
"write",
"this",
"file",
"can",
"then",
"be",
"used",
"as",
"a",
"registry",
"to",
"quickly",
"fetch",
"the",
"list",
"of",
"nodes",
"on",
"which",
"logexporter",
"succeeded",
"."
] | [
"func",
"writeSuccessMarkerFile",
"(",
")",
"error",
"{",
"markerFilePath",
":=",
"*",
"gcsPath",
"+",
"\"",
"\"",
"+",
"*",
"nodeName",
"+",
"\"",
"\"",
"\n",
"cmd",
":=",
"<mask>",
".",
"Command",
"(",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"markerFilePath",
")",
"\n",
"stdin",
",",
"err",
":=",
"cmd",
".",
"StdinPipe",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"}",
"\n",
"io",
".",
"WriteString",
"(",
"stdin",
",",
"\"",
"\"",
")",
"\n",
"stdin",
".",
"Close",
"(",
")",
"\n",
"if",
"err",
"=",
"cmd",
".",
"Run",
"(",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
] |
22,696 | all-22697 | [
"chooseContainerToRemove",
"finds",
"a",
"container",
"from",
"the",
"the",
"node",
"with",
"maximum",
"number",
"of",
"containers",
"and",
"returns",
"it"
] | [
"func",
"(",
"s",
"*",
"segregatedScheduler",
")",
"chooseContainerToRemove",
"(",
"nodes",
"[",
"]",
"cluster",
".",
"Node",
",",
"appName",
",",
"process",
"string",
")",
"(",
"string",
",",
"error",
")",
"{",
"_",
",",
"chosenNode",
",",
"err",
":=",
"s",
".",
"minMaxNodes",
"(",
"nodes",
",",
"appName",
",",
"<mask>",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"\"",
"\"",
",",
"err",
"\n",
"}",
"\n",
"log",
".",
"Debugf",
"(",
"\"",
"\"",
",",
"chosenNode",
")",
"\n",
"containerID",
",",
"err",
":=",
"s",
".",
"getContainerPreferablyFromHost",
"(",
"chosenNode",
",",
"appName",
",",
"process",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"\"",
"\"",
",",
"err",
"\n",
"}",
"\n",
"return",
"containerID",
",",
"err",
"\n",
"}"
] |
22,697 | all-22698 | [
"GetXOk",
"returns",
"a",
"tuple",
"with",
"the",
"X",
"field",
"if",
"it",
"s",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"and",
"a",
"boolean",
"to",
"check",
"if",
"the",
"value",
"has",
"been",
"set",
"."
] | [
"func",
"(",
"w",
"*",
"Widget",
")",
"GetXOk",
"(",
")",
"(",
"int",
",",
"bool",
")",
"{",
"if",
"w",
"==",
"nil",
"||",
"w",
".",
"X",
"==",
"nil",
"{",
"return",
"0",
",",
"false",
"\n",
"}",
"\n",
"return",
"*",
"w",
".",
"X",
",",
"<mask>",
"\n",
"}"
] |
22,698 | all-22699 | [
"GetResourcePolicyWithContext",
"mocks",
"base",
"method"
] | [
"func",
"(",
"m",
"*",
"MockSecretsManagerAPI",
")",
"GetResourcePolicyWithContext",
"(",
"arg0",
"aws",
".",
"Context",
",",
"arg1",
"*",
"secretsmanager",
".",
"GetResourcePolicyInput",
",",
"arg2",
"...",
"request",
".",
"Option",
")",
"(",
"*",
"secretsmanager",
".",
"GetResourcePolicyOutput",
",",
"error",
")",
"{",
"varargs",
":=",
"[",
"]",
"interface",
"{",
"}",
"{",
"arg0",
",",
"arg1",
"}",
"\n",
"for",
"_",
",",
"a",
":=",
"range",
"arg2",
"{",
"varargs",
"=",
"append",
"(",
"varargs",
",",
"a",
")",
"\n",
"}",
"\n",
"<mask>",
":=",
"m",
".",
"ctrl",
".",
"Call",
"(",
"m",
",",
"\"",
"\"",
",",
"varargs",
"...",
")",
"\n",
"ret0",
",",
"_",
":=",
"ret",
"[",
"0",
"]",
".",
"(",
"*",
"secretsmanager",
".",
"GetResourcePolicyOutput",
")",
"\n",
"ret1",
",",
"_",
":=",
"ret",
"[",
"1",
"]",
".",
"(",
"error",
")",
"\n",
"return",
"ret0",
",",
"ret1",
"\n",
"}"
] |
22,699 | all-22700 | [
"NewDataReadWriteSeeker",
"returns",
"a",
"new",
"callback",
"based",
"data",
"buffer"
] | [
"func",
"NewDataReadWriteSeeker",
"(",
"rw",
"io",
".",
"ReadWriteSeeker",
")",
"(",
"*",
"Data",
",",
"error",
")",
"{",
"d",
":=",
"newData",
"(",
")",
"\n",
"d",
".",
"r",
"=",
"rw",
"\n",
"d",
".",
"w",
"=",
"rw",
"\n",
"d",
".",
"s",
"=",
"rw",
"\n",
"d",
".",
"cbs",
".",
"<mask>",
"=",
"C",
".",
"gpgme_data_read_cb_t",
"(",
"C",
".",
"gogpgme_readfunc",
")",
"\n",
"d",
".",
"cbs",
".",
"write",
"=",
"C",
".",
"gpgme_data_write_cb_t",
"(",
"C",
".",
"gogpgme_writefunc",
")",
"\n",
"d",
".",
"cbs",
".",
"seek",
"=",
"C",
".",
"gpgme_data_seek_cb_t",
"(",
"C",
".",
"gogpgme_seekfunc",
")",
"\n",
"cbc",
":=",
"callbackAdd",
"(",
"d",
")",
"\n",
"d",
".",
"cbc",
"=",
"cbc",
"\n",
"return",
"d",
",",
"handleError",
"(",
"C",
".",
"gogpgme_data_new_from_cbs",
"(",
"&",
"d",
".",
"dh",
",",
"&",
"d",
".",
"cbs",
",",
"C",
".",
"uintptr_t",
"(",
"cbc",
")",
")",
")",
"\n",
"}"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.