id
int32 0
25.3k
| idx
stringlengths 5
9
| nl_tokens
sequencelengths 1
418
| pl_tokens
sequencelengths 22
4.98k
|
---|---|---|---|
4,000 | all-4001 | [
"UniqueURLsMapFromFlag",
"returns",
"a",
"map",
"from",
"url",
"strings",
"got",
"from",
"the",
"flag",
"."
] | [
"func",
"UniqueURLsMapFromFlag",
"(",
"fs",
"*",
"flag",
".",
"FlagSet",
",",
"urlsFlagName",
"string",
")",
"map",
"[",
"string",
"]",
"struct",
"{",
"}",
"{",
"return",
"(",
"*",
"<mask>",
".",
"Lookup",
"(",
"urlsFlagName",
")",
".",
"Value",
".",
"(",
"*",
"UniqueURLs",
")",
")",
".",
"Values",
"\n",
"}"
] |
4,001 | all-4002 | [
"run",
"is",
"a",
"long",
"running",
"goroutine",
"that",
"runs",
"the",
"Raft",
"FSM",
"."
] | [
"func",
"(",
"r",
"*",
"Raft",
")",
"run",
"(",
")",
"{",
"for",
"{",
"// Check if we are doing a shutdown",
"select",
"{",
"case",
"<-",
"r",
".",
"shutdownCh",
":",
"// Clear the leader to prevent forwarding",
"r",
".",
"setLeader",
"(",
"\"",
"\"",
")",
"\n",
"return",
"\n",
"default",
":",
"}",
"\n\n",
"// Enter into a sub-FSM",
"switch",
"r",
".",
"getState",
"(",
")",
"{",
"case",
"Follower",
":",
"r",
".",
"runFollower",
"(",
")",
"\n",
"case",
"Candidate",
":",
"r",
".",
"runCandidate",
"(",
")",
"\n",
"<mask>",
"Leader",
":",
"r",
".",
"runLeader",
"(",
")",
"\n",
"}",
"\n",
"}",
"\n",
"}"
] |
4,002 | all-4003 | [
"UnmarshalJSON",
"supports",
"json",
".",
"Unmarshaler",
"interface"
] | [
"func",
"(",
"v",
"*",
"EventShadowRootPushed",
")",
"UnmarshalJSON",
"(",
"data",
"[",
"]",
"byte",
")",
"error",
"{",
"r",
":=",
"jlexer",
".",
"Lexer",
"{",
"Data",
":",
"data",
"}",
"\n",
"easyjsonC5a4559bDecodeGithubComChromedpCdprotoDom55",
"(",
"&",
"r",
",",
"v",
")",
"\n",
"return",
"r",
".",
"<mask>",
"(",
")",
"\n",
"}"
] |
4,003 | all-4004 | [
"DisableExponentialBackoff",
"disables",
"use",
"of",
"exponential",
"backoff",
".",
"If",
"a",
"request",
"using",
"exponential",
"backoff",
"is",
"currently",
"running",
"it",
"will",
"stop",
"using",
"exponential",
"backoff",
"on",
"its",
"next",
"iteration",
"(",
"if",
"needed",
")",
"."
] | [
"func",
"(",
"a",
"*",
"API",
")",
"DisableExponentialBackoff",
"(",
")",
"{",
"a",
".",
"useExponentialBackoffmu",
".",
"Lock",
"(",
")",
"\n",
"a",
".",
"useExponentialBackoff",
"=",
"<mask>",
"\n",
"a",
".",
"useExponentialBackoffmu",
".",
"Unlock",
"(",
")",
"\n",
"}"
] |
4,004 | all-4005 | [
"MarshalJSON",
"supports",
"json",
".",
"Marshaler",
"interface"
] | [
"func",
"(",
"v",
"StartWorkerParams",
")",
"MarshalJSON",
"(",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"w",
":=",
"jwriter",
".",
"<mask>",
"{",
"}",
"\n",
"easyjsonC5a4559bEncodeGithubComChromedpCdprotoServiceworker5",
"(",
"&",
"w",
",",
"v",
")",
"\n",
"return",
"w",
".",
"Buffer",
".",
"BuildBytes",
"(",
")",
",",
"w",
".",
"Error",
"\n",
"}"
] |
4,005 | all-4006 | [
"GetSlice",
"returns",
"a",
"slice",
"of",
"interface",
"value",
"for",
"a",
"specific",
"column",
"."
] | [
"func",
"(",
"r",
"Record",
")",
"GetSlice",
"(",
"column",
"string",
")",
"(",
"[",
"]",
"<mask>",
"{",
"}",
",",
"error",
")",
"{",
"v",
",",
"err",
":=",
"r",
".",
"getKey",
"(",
"reflect",
".",
"Slice",
",",
"column",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"rv",
":=",
"reflect",
".",
"ValueOf",
"(",
"v",
")",
"\n",
"n",
":=",
"rv",
".",
"Len",
"(",
")",
"\n",
"out",
":=",
"make",
"(",
"[",
"]",
"interface",
"{",
"}",
",",
"n",
")",
"\n\n",
"for",
"i",
":=",
"0",
";",
"i",
"<",
"n",
";",
"i",
"++",
"{",
"out",
"[",
"i",
"]",
"=",
"rv",
".",
"Index",
"(",
"i",
")",
".",
"Interface",
"(",
")",
"\n",
"}",
"\n\n",
"return",
"out",
",",
"nil",
"\n",
"}"
] |
4,006 | all-4007 | [
"CreateRecords",
"creates",
"a",
"given",
"set",
"of",
"DNS",
"records",
"in",
"the",
"given",
"hosted",
"zone",
"."
] | [
"func",
"(",
"p",
"*",
"AWSProvider",
")",
"CreateRecords",
"(",
"endpoints",
"[",
"]",
"*",
"endpoint",
".",
"Endpoint",
")",
"error",
"{",
"<mask>",
"p",
".",
"doRecords",
"(",
"route53",
".",
"ChangeActionCreate",
",",
"endpoints",
")",
"\n",
"}"
] |
4,007 | all-4008 | [
"Constructs",
"an",
"http",
"response",
"from",
"JSON",
"input",
"from",
"Stdin"
] | [
"func",
"CreateJSONResponse",
"(",
"b",
"[",
"]",
"byte",
")",
"(",
"resp",
"*",
"http",
".",
"Response",
")",
"{",
"// Remove UTF-8 Byte Order Mark if it exists",
"b",
"=",
"<mask>",
".",
"TrimPrefix",
"(",
"b",
",",
"[",
"]",
"byte",
"{",
"0xef",
",",
"0xbb",
",",
"0xbf",
"}",
")",
"\n",
"resp",
"=",
"&",
"http",
".",
"Response",
"{",
"StatusCode",
":",
"200",
",",
"Body",
":",
"ioutil",
".",
"NopCloser",
"(",
"bytes",
".",
"NewBuffer",
"(",
"b",
")",
")",
",",
"}",
"\n",
"return",
"resp",
"\n",
"}"
] |
4,008 | all-4009 | [
"ErrorHandler",
"is",
"a",
"middleware",
"to",
"handle",
"errors",
"encountered",
"during",
"requests"
] | [
"func",
"ErrorHandler",
"(",
"c",
"*",
"gin",
".",
"Context",
")",
"{",
"c",
".",
"Next",
"(",
")",
"\n\n",
"// TODO: Handle it in a better way",
"if",
"len",
"(",
"c",
".",
"Errors",
")",
">",
"0",
"{",
"c",
".",
"<mask>",
"(",
"http",
".",
"StatusBadRequest",
",",
"\"",
"\"",
",",
"gin",
".",
"H",
"{",
"\"",
"\"",
":",
"c",
".",
"Errors",
",",
"}",
")",
"\n",
"}",
"\n",
"}"
] |
4,009 | all-4010 | [
"GetRemoved",
"retrieves",
"the",
"Removed",
"value",
"from",
"the",
"union",
"returning",
"ok",
"if",
"the",
"union",
"s",
"switch",
"indicated",
"the",
"value",
"is",
"valid",
"."
] | [
"func",
"(",
"u",
"LedgerEntryChange",
")",
"GetRemoved",
"(",
")",
"(",
"result",
"LedgerKey",
",",
"<mask>",
"bool",
")",
"{",
"armName",
",",
"_",
":=",
"u",
".",
"ArmForSwitch",
"(",
"int32",
"(",
"u",
".",
"Type",
")",
")",
"\n\n",
"if",
"armName",
"==",
"\"",
"\"",
"{",
"result",
"=",
"*",
"u",
".",
"Removed",
"\n",
"ok",
"=",
"true",
"\n",
"}",
"\n\n",
"return",
"\n",
"}"
] |
4,010 | all-4011 | [
"ReachedMaxMsgCountForPeer",
"returns",
"true",
"if",
"we",
"received",
"too",
"many",
"messages",
"from",
"peer",
"with",
"address",
"addr",
".",
"NOTE",
":",
"assumes",
"the",
"value",
"in",
"the",
"CMap",
"is",
"non",
"-",
"nil"
] | [
"func",
"(",
"r",
"*",
"PEXReactor",
")",
"ReachedMaxMsgCountForPeer",
"(",
"addr",
"string",
")",
"bool",
"{",
"<mask>",
"r",
".",
"msgCountByPeer",
".",
"Get",
"(",
"addr",
")",
".",
"(",
"uint16",
")",
">=",
"r",
".",
"maxMsgCountByPeer",
"\n",
"}"
] |
4,011 | all-4012 | [
"RegisterServiceOffering",
"calls",
"registerServiceOffering",
"method",
"of",
"Privatix",
"service",
"contract",
"."
] | [
"func",
"(",
"b",
"*",
"backendInstance",
")",
"RegisterServiceOffering",
"(",
"opts",
"*",
"bind",
".",
"TransactOpts",
",",
"offeringHash",
"[",
"common",
".",
"HashLength",
"]",
"byte",
",",
"minDeposit",
"uint64",
",",
"maxSupply",
"uint16",
",",
"somcType",
"uint8",
",",
"somcData",
"data",
".",
"Base64String",
")",
"(",
"*",
"<mask>",
".",
"Transaction",
",",
"error",
")",
"{",
"ctx2",
",",
"cancel",
":=",
"b",
".",
"addTimeout",
"(",
"opts",
".",
"Context",
")",
"\n",
"defer",
"cancel",
"(",
")",
"\n\n",
"opts",
".",
"Context",
"=",
"ctx2",
"\n\n",
"tx",
",",
"err",
":=",
"b",
".",
"psc",
".",
"RegisterServiceOffering",
"(",
"opts",
",",
"offeringHash",
",",
"minDeposit",
",",
"maxSupply",
",",
"somcType",
",",
"string",
"(",
"somcData",
")",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"}",
"\n",
"return",
"tx",
",",
"nil",
"\n",
"}"
] |
4,012 | all-4013 | [
"Match",
"returns",
"whether",
"the",
"regexp",
"matches",
"the",
"given",
"string",
"."
] | [
"func",
"(",
"r",
"*",
"Regexp",
")",
"MatchString",
"(",
"s",
"<mask>",
")",
"bool",
"{",
"return",
"r",
".",
"compiled",
".",
"MatchString",
"(",
"s",
")",
"\n",
"}"
] |
4,013 | all-4014 | [
"Ping",
"returns",
"pong"
] | [
"func",
"Ping",
"(",
"w",
"http",
".",
"ResponseWriter",
",",
"r",
"*",
"http",
".",
"Request",
")",
"{",
"w",
".",
"Write",
"(",
"[",
"]",
"<mask>",
"(",
"\"",
"\"",
")",
")",
"\n",
"}"
] |
4,014 | all-4015 | [
"HashedPath",
"returns",
"a",
"URL",
"path",
"with",
"hash",
"injected",
"into",
"the",
"filename",
"."
] | [
"func",
"(",
"s",
"*",
"Server",
")",
"HashedPath",
"(",
"p",
"string",
")",
"(",
"string",
",",
"error",
")",
"{",
"if",
"s",
".",
"Hasher",
"==",
"nil",
"{",
"return",
"path",
".",
"Join",
"(",
"s",
".",
"root",
",",
"p",
")",
",",
"nil",
"\n",
"}",
"\n",
"h",
",",
"cont",
",",
"err",
":=",
"s",
".",
"<mask>",
"(",
"p",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"if",
"cont",
"{",
"h",
",",
"_",
",",
"err",
"=",
"s",
".",
"hashFromFilename",
"(",
"p",
")",
"\n",
"}",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"\"",
"\"",
",",
"err",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"path",
".",
"Join",
"(",
"s",
".",
"root",
",",
"s",
".",
"hashedPath",
"(",
"p",
",",
"h",
")",
")",
",",
"nil",
"\n",
"}"
] |
4,015 | all-4016 | [
"MustPathPaymentResult",
"retrieves",
"the",
"PathPaymentResult",
"value",
"from",
"the",
"union",
"panicing",
"if",
"the",
"value",
"is",
"not",
"set",
"."
] | [
"func",
"(",
"u",
"OperationResultTr",
")",
"MustPathPaymentResult",
"(",
")",
"PathPaymentResult",
"{",
"val",
",",
"<mask>",
":=",
"u",
".",
"GetPathPaymentResult",
"(",
")",
"\n\n",
"if",
"!",
"ok",
"{",
"panic",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"return",
"val",
"\n",
"}"
] |
4,016 | all-4017 | [
"PreCreateCheck",
"is",
"called",
"to",
"enforce",
"pre",
"-",
"creation",
"steps"
] | [
"func",
"(",
"d",
"*",
"Driver",
")",
"PreCreateCheck",
"(",
")",
"error",
"{",
"c",
",",
"err",
":=",
"newComputeUtil",
"(",
"d",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"// Check that the project exists. It will also check the credentials",
"// at the same time.",
"log",
".",
"Infof",
"(",
"\"",
"\"",
")",
"\n\n",
"if",
"_",
",",
"err",
"=",
"c",
".",
"service",
".",
"Projects",
".",
"Get",
"(",
"d",
".",
"Project",
")",
".",
"Do",
"(",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"d",
".",
"<mask>",
",",
"err",
")",
"\n",
"}",
"\n\n",
"// Check if the instance already exists. There will be an error if the instance",
"// doesn't exist, so just check instance for nil.",
"log",
".",
"Infof",
"(",
"\"",
"\"",
")",
"\n\n",
"instance",
",",
"_",
":=",
"c",
".",
"instance",
"(",
")",
"\n",
"if",
"d",
".",
"UseExisting",
"{",
"if",
"instance",
"==",
"nil",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"d",
".",
"MachineName",
",",
"d",
".",
"Zone",
")",
"\n",
"}",
"\n",
"}",
"else",
"{",
"if",
"instance",
"!=",
"nil",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"d",
".",
"MachineName",
",",
"d",
".",
"Zone",
")",
"\n",
"}",
"\n",
"}",
"\n\n",
"return",
"nil",
"\n",
"}"
] |
4,017 | all-4018 | [
"Process",
"returns",
"a",
"relabeled",
"copy",
"of",
"the",
"given",
"label",
"set",
".",
"The",
"relabel",
"configurations",
"are",
"applied",
"in",
"order",
"of",
"input",
".",
"If",
"a",
"label",
"set",
"is",
"dropped",
"nil",
"is",
"returned",
".",
"May",
"return",
"the",
"input",
"labelSet",
"modified",
"."
] | [
"func",
"Process",
"(",
"labels",
"labels",
".",
"Labels",
",",
"cfgs",
"...",
"*",
"Config",
")",
"labels",
".",
"Labels",
"{",
"for",
"_",
",",
"cfg",
":=",
"<mask>",
"cfgs",
"{",
"labels",
"=",
"relabel",
"(",
"labels",
",",
"cfg",
")",
"\n",
"if",
"labels",
"==",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"labels",
"\n",
"}"
] |
4,018 | all-4019 | [
"diskRelocateListString",
"pretty",
"-",
"prints",
"a",
"list",
"of",
"VirtualMachineRelocateSpecDiskLocator",
"."
] | [
"func",
"diskRelocateListString",
"(",
"relocators",
"[",
"]",
"types",
".",
"VirtualMachineRelocateSpecDiskLocator",
")",
"string",
"{",
"var",
"out",
"[",
"]",
"string",
"\n",
"for",
"_",
",",
"relocate",
":=",
"range",
"relocators",
"{",
"<mask>",
"=",
"append",
"(",
"out",
",",
"diskRelocateString",
"(",
"relocate",
")",
")",
"\n",
"}",
"\n",
"return",
"strings",
".",
"Join",
"(",
"out",
",",
"\"",
"\"",
")",
"\n",
"}"
] |
4,019 | all-4020 | [
"Parameter",
"callback",
"has",
"type",
"C",
".",
"GLDEBUGPROCARB",
"."
] | [
"func",
"DebugMessageCallbackARB",
"(",
"callback",
"unsafe",
".",
"Pointer",
",",
"userParam",
"unsafe",
".",
"Pointer",
")",
"{",
"C",
".",
"glowDebugMessageCallbackARB",
"(",
"gpDebugMessageCallbackARB",
",",
"(",
"C",
".",
"GLDEBUGPROCARB",
")",
"(",
"unsafe",
".",
"Pointer",
"(",
"&",
"<mask>",
")",
")",
",",
"userParam",
")",
"\n",
"}"
] |
4,020 | all-4021 | [
"pickCompactLevel",
"determines",
"which",
"level",
"to",
"compact",
".",
"Based",
"on",
":",
"https",
":",
"//",
"github",
".",
"com",
"/",
"facebook",
"/",
"rocksdb",
"/",
"wiki",
"/",
"Leveled",
"-",
"Compaction"
] | [
"func",
"(",
"s",
"*",
"levelsController",
")",
"pickCompactLevels",
"(",
")",
"(",
"prios",
"[",
"]",
"compactionPriority",
")",
"{",
"// This function must use identical criteria for guaranteeing compaction's progress that",
"// addLevel0Table uses.",
"// cstatus is checked to see if level 0's tables are already being compacted",
"if",
"!",
"s",
".",
"cstatus",
".",
"overlapsWith",
"(",
"0",
",",
"infRange",
")",
"&&",
"s",
".",
"isLevel0Compactable",
"(",
")",
"{",
"pri",
":=",
"compactionPriority",
"{",
"level",
":",
"0",
",",
"score",
":",
"float64",
"(",
"s",
".",
"levels",
"[",
"0",
"]",
".",
"numTables",
"(",
")",
")",
"/",
"float64",
"(",
"s",
".",
"kv",
".",
"opt",
".",
"NumLevelZeroTables",
")",
",",
"}",
"\n",
"prios",
"=",
"append",
"(",
"prios",
",",
"pri",
")",
"\n",
"}",
"\n\n",
"for",
"i",
",",
"l",
":=",
"range",
"s",
".",
"levels",
"[",
"1",
":",
"]",
"{",
"// Don't consider those tables that are already being compacted right now.",
"delSize",
":=",
"s",
".",
"cstatus",
".",
"delSize",
"(",
"i",
"+",
"1",
")",
"\n\n",
"if",
"l",
".",
"isCompactable",
"(",
"delSize",
")",
"{",
"pri",
":=",
"compactionPriority",
"{",
"level",
":",
"i",
"+",
"1",
",",
"score",
":",
"float64",
"(",
"l",
".",
"getTotalSize",
"(",
")",
"-",
"delSize",
")",
"/",
"float64",
"(",
"l",
".",
"maxTotalSize",
")",
",",
"}",
"\n",
"prios",
"=",
"<mask>",
"(",
"prios",
",",
"pri",
")",
"\n",
"}",
"\n",
"}",
"\n",
"sort",
".",
"Slice",
"(",
"prios",
",",
"func",
"(",
"i",
",",
"j",
"int",
")",
"bool",
"{",
"return",
"prios",
"[",
"i",
"]",
".",
"score",
">",
"prios",
"[",
"j",
"]",
".",
"score",
"\n",
"}",
")",
"\n",
"return",
"prios",
"\n",
"}"
] |
4,021 | all-4022 | [
"Title",
"yields",
"the",
"initial",
"title",
"text",
"of",
"the",
"github",
"issue",
"."
] | [
"func",
"(",
"fj",
"*",
"FlakyJob",
")",
"Title",
"(",
")",
"string",
"{",
"return",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"fj",
".",
"<mask>",
",",
"*",
"fj",
".",
"FlakeCount",
")",
"\n",
"}"
] |
4,022 | all-4023 | [
"Run",
"runs",
"the",
"ECS",
"Agent",
"App",
".",
"It",
"returns",
"an",
"exit",
"code",
"which",
"is",
"used",
"by",
"main",
"()",
"to",
"set",
"the",
"status",
"code",
"for",
"the",
"program"
] | [
"func",
"Run",
"(",
"arguments",
"[",
"]",
"string",
")",
"int",
"{",
"defer",
"log",
".",
"Flush",
"(",
")",
"\n\n",
"parsedArgs",
",",
"err",
":=",
"args",
".",
"New",
"(",
"arguments",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"exitcodes",
".",
"ExitTerminal",
"\n",
"}",
"\n\n",
"if",
"*",
"parsedArgs",
".",
"License",
"{",
"return",
"printLicense",
"(",
")",
"\n",
"}",
"else",
"if",
"*",
"parsedArgs",
".",
"Version",
"{",
"return",
"version",
".",
"PrintVersion",
"(",
")",
"\n",
"}",
"\n\n",
"logger",
".",
"SetLevel",
"(",
"*",
"parsedArgs",
".",
"LogLevel",
")",
"\n\n",
"// Create an Agent object",
"agent",
",",
"err",
":=",
"newAgent",
"(",
"context",
".",
"Background",
"(",
")",
",",
"aws",
".",
"BoolValue",
"(",
"parsedArgs",
".",
"BlackholeEC2Metadata",
")",
",",
"parsedArgs",
".",
"AcceptInsecureCert",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"// Failure to initialize either the docker client or the EC2 metadata",
"// service client are non terminal errors as they could be transient",
"return",
"exitcodes",
".",
"ExitError",
"\n",
"}",
"\n\n",
"switch",
"{",
"<mask>",
"*",
"parsedArgs",
".",
"ECSAttributes",
":",
"// Print agent's ecs attributes based on its environment and exit",
"return",
"agent",
".",
"printECSAttributes",
"(",
")",
"\n",
"case",
"*",
"parsedArgs",
".",
"WindowsService",
":",
"// Enable Windows Service",
"return",
"agent",
".",
"startWindowsService",
"(",
")",
"\n",
"default",
":",
"// Start the agent",
"return",
"agent",
".",
"start",
"(",
")",
"\n",
"}",
"\n",
"}"
] |
4,023 | all-4024 | [
"IncrementByValue",
"updates",
"counter",
"by",
"supplied",
"value"
] | [
"func",
"(",
"m",
"*",
"CirconusMetrics",
")",
"IncrementByValue",
"(",
"metric",
"<mask>",
",",
"val",
"uint64",
")",
"{",
"m",
".",
"Add",
"(",
"metric",
",",
"val",
")",
"\n",
"}"
] |
4,024 | all-4025 | [
"WaitForAllUnprocessedRecords",
"blocks",
"execution",
"until",
"all",
"unprocessed",
"log",
"records",
"are",
"processed",
".",
"Since",
"this",
"library",
"implements",
"async",
"logging",
"it",
"is",
"possible",
"to",
"have",
"unprocessed",
"logs",
"at",
"the",
"moment",
"when",
"application",
"is",
"terminating",
".",
"In",
"that",
"case",
"log",
"messages",
"can",
"be",
"lost",
".",
"This",
"mehtods",
"blocks",
"execution",
"until",
"all",
"log",
"records",
"are",
"processed",
"to",
"ensure",
"that",
"all",
"log",
"messages",
"are",
"handled",
"."
] | [
"func",
"WaitForAllUnprocessedRecords",
"(",
")",
"{",
"<mask>",
".",
"Lock",
"(",
")",
"\n",
"var",
"wg",
"sync",
".",
"WaitGroup",
"\n",
"for",
"_",
",",
"logger",
":=",
"range",
"loggers",
"{",
"wg",
".",
"Add",
"(",
"1",
")",
"\n",
"go",
"func",
"(",
"logger",
"*",
"Logger",
")",
"{",
"logger",
".",
"WaitForUnprocessedRecords",
"(",
")",
"\n",
"wg",
".",
"Done",
"(",
")",
"\n",
"}",
"(",
"logger",
")",
"\n",
"}",
"\n",
"wg",
".",
"Wait",
"(",
")",
"\n",
"lock",
".",
"Unlock",
"(",
")",
"\n",
"}"
] |
4,025 | all-4026 | [
"KindProperties",
"returns",
"all",
"the",
"indexed",
"properties",
"for",
"the",
"given",
"kind",
".",
"The",
"properties",
"are",
"returned",
"as",
"a",
"map",
"of",
"property",
"names",
"to",
"a",
"slice",
"of",
"the",
"representation",
"types",
".",
"The",
"representation",
"types",
"for",
"the",
"supported",
"Go",
"property",
"types",
"are",
":",
"INT64",
":",
"signed",
"integers",
"and",
"time",
".",
"Time",
"DOUBLE",
":",
"float32",
"and",
"float64",
"BOOLEAN",
":",
"bool",
"STRING",
":",
"string",
"[]",
"byte",
"and",
"ByteString",
"POINT",
":",
"appengine",
".",
"GeoPoint",
"REFERENCE",
":",
"*",
"Key",
"USER",
":",
"(",
"not",
"used",
"in",
"the",
"Go",
"runtime",
")"
] | [
"func",
"KindProperties",
"(",
"ctx",
"context",
".",
"<mask>",
",",
"kind",
"string",
")",
"(",
"map",
"[",
"string",
"]",
"[",
"]",
"string",
",",
"error",
")",
"{",
"// TODO(djd): Support range queries.",
"kindKey",
":=",
"NewKey",
"(",
"ctx",
",",
"kindKind",
",",
"kind",
",",
"0",
",",
"nil",
")",
"\n",
"q",
":=",
"NewQuery",
"(",
"propertyKind",
")",
".",
"Ancestor",
"(",
"kindKey",
")",
"\n\n",
"propMap",
":=",
"map",
"[",
"string",
"]",
"[",
"]",
"string",
"{",
"}",
"\n",
"props",
":=",
"[",
"]",
"struct",
"{",
"Repr",
"[",
"]",
"string",
"`datastore:\"property_representation\"`",
"\n",
"}",
"{",
"}",
"\n\n",
"keys",
",",
"err",
":=",
"q",
".",
"GetAll",
"(",
"ctx",
",",
"&",
"props",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"for",
"i",
",",
"p",
":=",
"range",
"props",
"{",
"propMap",
"[",
"keys",
"[",
"i",
"]",
".",
"StringID",
"(",
")",
"]",
"=",
"p",
".",
"Repr",
"\n",
"}",
"\n",
"return",
"propMap",
",",
"nil",
"\n",
"}"
] |
4,026 | all-4027 | [
"Disconnect",
"is",
"a",
"wrapper",
"around",
"gtk_accel_group_disconnect",
"()",
"."
] | [
"func",
"(",
"v",
"*",
"AccelGroup",
")",
"Disconnect",
"(",
"f",
"<mask>",
"{",
"}",
")",
"{",
"closure",
",",
"_",
":=",
"glib",
".",
"ClosureNew",
"(",
"f",
")",
"\n",
"cl",
":=",
"(",
"*",
"C",
".",
"struct__GClosure",
")",
"(",
"unsafe",
".",
"Pointer",
"(",
"closure",
")",
")",
"\n",
"C",
".",
"gtk_accel_group_disconnect",
"(",
"v",
".",
"native",
"(",
")",
",",
"cl",
")",
"\n",
"}"
] |
4,027 | all-4028 | [
"Locator",
"returns",
"a",
"locator",
"for",
"the",
"given",
"resource"
] | [
"func",
"(",
"r",
"*",
"<mask>",
")",
"Locator",
"(",
"api",
"*",
"API",
")",
"*",
"ServerLocator",
"{",
"return",
"api",
".",
"ServerLocator",
"(",
"r",
".",
"Href",
")",
"\n",
"}"
] |
4,028 | all-4029 | [
"Specify",
"the",
"value",
"of",
"a",
"uniform",
"variable",
"for",
"a",
"specified",
"program",
"object"
] | [
"func",
"ProgramUniform4iv",
"(",
"program",
"uint32",
",",
"location",
"int32",
",",
"count",
"int32",
",",
"<mask>",
"*",
"int32",
")",
"{",
"syscall",
".",
"Syscall6",
"(",
"gpProgramUniform4iv",
",",
"4",
",",
"uintptr",
"(",
"program",
")",
",",
"uintptr",
"(",
"location",
")",
",",
"uintptr",
"(",
"count",
")",
",",
"uintptr",
"(",
"unsafe",
".",
"Pointer",
"(",
"value",
")",
")",
",",
"0",
",",
"0",
")",
"\n",
"}"
] |
4,029 | all-4030 | [
"Kind",
"is",
"an",
"option",
"for",
"Dag",
".",
"Put",
"which",
"specifies",
"the",
"format",
"that",
"the",
"dag",
"will",
"be",
"added",
"as",
".",
"Default",
"is",
"cbor",
"."
] | [
"func",
"(",
"dagOpts",
")",
"Kind",
"(",
"<mask>",
"string",
")",
"DagPutOption",
"{",
"return",
"func",
"(",
"opts",
"*",
"DagPutSettings",
")",
"error",
"{",
"opts",
".",
"Kind",
"=",
"kind",
"\n",
"return",
"nil",
"\n",
"}",
"\n",
"}"
] |
4,030 | all-4031 | [
"PutSignatures",
"adds",
"the",
"given",
"signatures",
"to",
"the",
"docker",
"tarfile",
"(",
"currently",
"not",
"supported",
")",
".",
"MUST",
"be",
"called",
"after",
"PutManifest",
"(",
"signatures",
"reference",
"manifest",
"contents",
")"
] | [
"func",
"(",
"d",
"*",
"Destination",
")",
"PutSignatures",
"(",
"ctx",
"context",
".",
"Context",
",",
"signatures",
"[",
"]",
"[",
"]",
"<mask>",
")",
"error",
"{",
"if",
"len",
"(",
"signatures",
")",
"!=",
"0",
"{",
"return",
"errors",
".",
"Errorf",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
] |
4,031 | all-4032 | [
"GetTitleAlignOk",
"returns",
"a",
"tuple",
"with",
"the",
"TitleAlign",
"field",
"if",
"it",
"s",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"and",
"a",
"boolean",
"to",
"check",
"if",
"the",
"value",
"has",
"been",
"set",
"."
] | [
"func",
"(",
"d",
"*",
"DistributionDefinition",
")",
"GetTitleAlignOk",
"(",
")",
"(",
"string",
",",
"bool",
")",
"{",
"if",
"d",
"==",
"nil",
"||",
"d",
".",
"TitleAlign",
"==",
"nil",
"{",
"return",
"\"",
"\"",
",",
"<mask>",
"\n",
"}",
"\n",
"return",
"*",
"d",
".",
"TitleAlign",
",",
"true",
"\n",
"}"
] |
4,032 | all-4033 | [
"Stability",
":",
"***",
"EXPERIMENTAL",
"***",
"Get",
"all",
"active",
"provisioners",
".",
"The",
"term",
"provisioner",
"is",
"taken",
"broadly",
"to",
"mean",
"anything",
"with",
"a",
"provisionerId",
".",
"This",
"does",
"not",
"necessarily",
"mean",
"there",
"is",
"an",
"associated",
"service",
"performing",
"any",
"provisioning",
"activity",
".",
"The",
"response",
"is",
"paged",
".",
"If",
"this",
"end",
"-",
"point",
"returns",
"a",
"continuationToken",
"you",
"should",
"call",
"the",
"end",
"-",
"point",
"again",
"with",
"the",
"continuationToken",
"as",
"a",
"query",
"-",
"string",
"option",
".",
"By",
"default",
"this",
"end",
"-",
"point",
"will",
"list",
"up",
"to",
"1000",
"provisioners",
"in",
"a",
"single",
"page",
".",
"You",
"may",
"limit",
"this",
"with",
"the",
"query",
"-",
"string",
"parameter",
"limit",
".",
"See",
"#listProvisioners"
] | [
"func",
"(",
"queue",
"*",
"Queue",
")",
"ListProvisioners",
"(",
"continuationToken",
",",
"limit",
"string",
")",
"(",
"*",
"ListProvisionersResponse",
",",
"error",
")",
"{",
"v",
":=",
"url",
".",
"Values",
"{",
"}",
"\n",
"if",
"continuationToken",
"!=",
"\"",
"\"",
"{",
"v",
".",
"Add",
"(",
"\"",
"\"",
",",
"continuationToken",
")",
"\n",
"}",
"\n",
"if",
"limit",
"!=",
"\"",
"\"",
"{",
"v",
".",
"Add",
"(",
"\"",
"\"",
",",
"<mask>",
")",
"\n",
"}",
"\n",
"cd",
":=",
"tcclient",
".",
"Client",
"(",
"*",
"queue",
")",
"\n",
"responseObject",
",",
"_",
",",
"err",
":=",
"(",
"&",
"cd",
")",
".",
"APICall",
"(",
"nil",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"new",
"(",
"ListProvisionersResponse",
")",
",",
"v",
")",
"\n",
"return",
"responseObject",
".",
"(",
"*",
"ListProvisionersResponse",
")",
",",
"err",
"\n",
"}"
] |
4,033 | all-4034 | [
"acquireDirectoryLock",
"gets",
"a",
"lock",
"on",
"the",
"directory",
"(",
"using",
"flock",
")",
".",
"If",
"this",
"is",
"not",
"read",
"-",
"only",
"it",
"will",
"also",
"write",
"our",
"pid",
"to",
"dirPath",
"/",
"pidFileName",
"for",
"convenience",
"."
] | [
"func",
"acquireDirectoryLock",
"(",
"dirPath",
"string",
",",
"pidFileName",
"string",
",",
"readOnly",
"bool",
")",
"(",
"*",
"directoryLockGuard",
",",
"error",
")",
"{",
"// Convert to absolute path so that Release still works even if we do an unbalanced",
"// chdir in the meantime.",
"absPidFilePath",
",",
"err",
":=",
"filepath",
".",
"Abs",
"(",
"filepath",
".",
"Join",
"(",
"dirPath",
",",
"pidFileName",
")",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"<mask>",
".",
"Wrap",
"(",
"err",
",",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"f",
",",
"err",
":=",
"os",
".",
"Open",
"(",
"dirPath",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"errors",
".",
"Wrapf",
"(",
"err",
",",
"\"",
"\"",
",",
"dirPath",
")",
"\n",
"}",
"\n",
"opts",
":=",
"unix",
".",
"LOCK_EX",
"|",
"unix",
".",
"LOCK_NB",
"\n",
"if",
"readOnly",
"{",
"opts",
"=",
"unix",
".",
"LOCK_SH",
"|",
"unix",
".",
"LOCK_NB",
"\n",
"}",
"\n\n",
"err",
"=",
"unix",
".",
"Flock",
"(",
"int",
"(",
"f",
".",
"Fd",
"(",
")",
")",
",",
"opts",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"f",
".",
"Close",
"(",
")",
"\n",
"return",
"nil",
",",
"errors",
".",
"Wrapf",
"(",
"err",
",",
"\"",
"\"",
",",
"dirPath",
")",
"\n",
"}",
"\n\n",
"if",
"!",
"readOnly",
"{",
"// Yes, we happily overwrite a pre-existing pid file. We're the",
"// only read-write badger process using this directory.",
"err",
"=",
"ioutil",
".",
"WriteFile",
"(",
"absPidFilePath",
",",
"[",
"]",
"byte",
"(",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\\n",
"\"",
",",
"os",
".",
"Getpid",
"(",
")",
")",
")",
",",
"0666",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"f",
".",
"Close",
"(",
")",
"\n",
"return",
"nil",
",",
"errors",
".",
"Wrapf",
"(",
"err",
",",
"\"",
"\"",
",",
"absPidFilePath",
")",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"&",
"directoryLockGuard",
"{",
"f",
",",
"absPidFilePath",
",",
"readOnly",
"}",
",",
"nil",
"\n",
"}"
] |
4,034 | all-4035 | [
"export",
"FindSequenceOnDiskPad"
] | [
"func",
"FindSequenceOnDiskPad",
"(",
"pattern",
"*",
"C",
".",
"char",
",",
"padStyle",
"C",
".",
"int",
")",
"(",
"FileSeqId",
",",
"Error",
")",
"{",
"str",
":=",
"C",
".",
"GoString",
"(",
"pattern",
")",
"\n",
"// Caller is responsible for freeing error string",
"if",
"str",
"==",
"\"",
"\"",
"{",
"return",
"0",
",",
"C",
".",
"CString",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"fs",
",",
"err",
":=",
"fileseq",
".",
"FindSequenceOnDiskPad",
"(",
"str",
",",
"fileseq",
".",
"PadStyle",
"(",
"padStyle",
")",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"0",
",",
"C",
".",
"CString",
"(",
"err",
".",
"Error",
"(",
")",
")",
"\n",
"}",
"\n\n",
"// No Match",
"if",
"fs",
"==",
"nil",
"{",
"return",
"0",
",",
"nil",
"\n",
"}",
"\n\n",
"id",
":=",
"sFileSeqs",
".",
"Add",
"(",
"fs",
")",
"\n",
"return",
"<mask>",
",",
"nil",
"\n",
"}"
] |
4,035 | all-4036 | [
"tryMerge",
"attempts",
"1",
"merge",
"and",
"returns",
"a",
"bool",
"indicating",
"if",
"we",
"should",
"try",
"to",
"merge",
"the",
"remaining",
"PRs",
"and",
"possibly",
"an",
"error",
"."
] | [
"func",
"tryMerge",
"(",
"mergeFunc",
"func",
"(",
")",
"error",
")",
"(",
"bool",
",",
"error",
")",
"{",
"var",
"err",
"error",
"\n",
"const",
"maxRetries",
"=",
"3",
"\n",
"backoff",
":=",
"time",
".",
"Second",
"*",
"4",
"\n",
"for",
"retry",
":=",
"0",
";",
"retry",
"<",
"maxRetries",
";",
"retry",
"++",
"{",
"if",
"err",
"=",
"mergeFunc",
"(",
")",
";",
"err",
"==",
"nil",
"{",
"// Successful merge!",
"return",
"true",
",",
"nil",
"\n",
"}",
"\n",
"// TODO: Add a config option to abort batches if a PR in the batch",
"// cannot be merged for any reason. This would skip merging",
"// not just the changed PR, but also the other PRs in the batch.",
"// This shouldn't be the default behavior as merging batches is high",
"// priority and this is unlikely to be problematic.",
"// Note: We would also need to be able to roll back any merges for the",
"// batch that were already successfully completed before the failure.",
"// Ref: https://github.com/kubernetes/test-infra/issues/10621",
"if",
"_",
",",
"ok",
":=",
"err",
".",
"(",
"github",
".",
"ModifiedHeadError",
")",
";",
"ok",
"{",
"// This is a possible source of incorrect behavior. If someone",
"// modifies their PR as we try to merge it in a batch then we",
"// end up in an untested state. This is unlikely to cause any",
"// real problems.",
"return",
"<mask>",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"}",
"else",
"if",
"_",
",",
"ok",
"=",
"err",
".",
"(",
"github",
".",
"UnmergablePRBaseChangedError",
")",
";",
"ok",
"{",
"// complained that the base branch was modified. This is a",
"// strange error because the API doesn't even allow the request to",
"// specify the base branch sha, only the head sha.",
"// We suspect that github is complaining because we are making the",
"// merge requests too rapidly and it cannot recompute mergability",
"// in time. https://github.com/kubernetes/test-infra/issues/5171",
"// We handle this by sleeping for a few seconds before trying to",
"// merge again.",
"err",
"=",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"if",
"retry",
"+",
"1",
"<",
"maxRetries",
"{",
"sleep",
"(",
"backoff",
")",
"\n",
"backoff",
"*=",
"2",
"\n",
"}",
"\n",
"}",
"else",
"if",
"_",
",",
"ok",
"=",
"err",
".",
"(",
"github",
".",
"UnauthorizedToPushError",
")",
";",
"ok",
"{",
"// GitHub let us know that the token used cannot push to the branch.",
"// Even if the robot is set up to have write access to the repo, an",
"// overzealous branch protection setting will not allow the robot to",
"// push to a specific branch.",
"// We won't be able to merge the other PRs.",
"return",
"false",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"}",
"else",
"if",
"_",
",",
"ok",
"=",
"err",
".",
"(",
"github",
".",
"MergeCommitsForbiddenError",
")",
";",
"ok",
"{",
"// GitHub let us know that the merge method configured for this repo",
"// is not allowed by other repo settings, so we should let the admins",
"// know that the configuration needs to be updated.",
"// We won't be able to merge the other PRs.",
"return",
"false",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"}",
"else",
"if",
"_",
",",
"ok",
"=",
"err",
".",
"(",
"github",
".",
"UnmergablePRError",
")",
";",
"ok",
"{",
"return",
"true",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"}",
"else",
"{",
"return",
"true",
",",
"err",
"\n",
"}",
"\n",
"}",
"\n",
"// We ran out of retries. Return the last transient error.",
"return",
"true",
",",
"err",
"\n",
"}"
] |
4,036 | all-4037 | [
"Copy",
"returns",
"a",
"deep",
"copy",
"of",
"the",
"current",
"configuration",
".",
"This",
"is",
"useful",
"because",
"the",
"nested",
"data",
"structures",
"may",
"be",
"shared",
"."
] | [
"func",
"(",
"c",
"*",
"Config",
")",
"Copy",
"(",
")",
"*",
"Config",
"{",
"<mask>",
"o",
"Config",
"\n\n",
"o",
".",
"Consul",
"=",
"c",
".",
"Consul",
"\n\n",
"if",
"c",
".",
"Consul",
"!=",
"nil",
"{",
"o",
".",
"Consul",
"=",
"c",
".",
"Consul",
".",
"Copy",
"(",
")",
"\n",
"}",
"\n\n",
"if",
"c",
".",
"Dedup",
"!=",
"nil",
"{",
"o",
".",
"Dedup",
"=",
"c",
".",
"Dedup",
".",
"Copy",
"(",
")",
"\n",
"}",
"\n\n",
"if",
"c",
".",
"Exec",
"!=",
"nil",
"{",
"o",
".",
"Exec",
"=",
"c",
".",
"Exec",
".",
"Copy",
"(",
")",
"\n",
"}",
"\n\n",
"o",
".",
"KillSignal",
"=",
"c",
".",
"KillSignal",
"\n\n",
"o",
".",
"LogLevel",
"=",
"c",
".",
"LogLevel",
"\n\n",
"o",
".",
"MaxStale",
"=",
"c",
".",
"MaxStale",
"\n\n",
"o",
".",
"PidFile",
"=",
"c",
".",
"PidFile",
"\n\n",
"o",
".",
"ReloadSignal",
"=",
"c",
".",
"ReloadSignal",
"\n\n",
"if",
"c",
".",
"Syslog",
"!=",
"nil",
"{",
"o",
".",
"Syslog",
"=",
"c",
".",
"Syslog",
".",
"Copy",
"(",
")",
"\n",
"}",
"\n\n",
"if",
"c",
".",
"Templates",
"!=",
"nil",
"{",
"o",
".",
"Templates",
"=",
"c",
".",
"Templates",
".",
"Copy",
"(",
")",
"\n",
"}",
"\n\n",
"if",
"c",
".",
"Vault",
"!=",
"nil",
"{",
"o",
".",
"Vault",
"=",
"c",
".",
"Vault",
".",
"Copy",
"(",
")",
"\n",
"}",
"\n\n",
"if",
"c",
".",
"Wait",
"!=",
"nil",
"{",
"o",
".",
"Wait",
"=",
"c",
".",
"Wait",
".",
"Copy",
"(",
")",
"\n",
"}",
"\n\n",
"return",
"&",
"o",
"\n",
"}"
] |
4,037 | all-4038 | [
"Merge",
"combines",
"all",
"values",
"in",
"this",
"configuration",
"with",
"the",
"values",
"in",
"the",
"other",
"configuration",
"with",
"values",
"in",
"the",
"other",
"configuration",
"taking",
"precedence",
".",
"Maps",
"and",
"slices",
"are",
"merged",
"most",
"other",
"values",
"are",
"overwritten",
".",
"Complex",
"structs",
"define",
"their",
"own",
"merge",
"functionality",
"."
] | [
"func",
"(",
"c",
"*",
"VaultConfig",
")",
"Merge",
"(",
"o",
"*",
"VaultConfig",
")",
"*",
"VaultConfig",
"{",
"if",
"c",
"==",
"nil",
"{",
"if",
"o",
"==",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n",
"return",
"o",
".",
"Copy",
"(",
")",
"\n",
"}",
"\n\n",
"if",
"o",
"==",
"nil",
"{",
"return",
"c",
".",
"Copy",
"(",
")",
"\n",
"}",
"\n\n",
"r",
":=",
"c",
".",
"Copy",
"(",
")",
"\n\n",
"if",
"o",
".",
"<mask>",
"!=",
"nil",
"{",
"r",
".",
"Address",
"=",
"o",
".",
"Address",
"\n",
"}",
"\n\n",
"if",
"o",
".",
"Enabled",
"!=",
"nil",
"{",
"r",
".",
"Enabled",
"=",
"o",
".",
"Enabled",
"\n",
"}",
"\n\n",
"if",
"o",
".",
"Grace",
"!=",
"nil",
"{",
"r",
".",
"Grace",
"=",
"o",
".",
"Grace",
"\n",
"}",
"\n\n",
"if",
"o",
".",
"Namespace",
"!=",
"nil",
"{",
"r",
".",
"Namespace",
"=",
"o",
".",
"Namespace",
"\n",
"}",
"\n\n",
"if",
"o",
".",
"RenewToken",
"!=",
"nil",
"{",
"r",
".",
"RenewToken",
"=",
"o",
".",
"RenewToken",
"\n",
"}",
"\n\n",
"if",
"o",
".",
"Retry",
"!=",
"nil",
"{",
"r",
".",
"Retry",
"=",
"r",
".",
"Retry",
".",
"Merge",
"(",
"o",
".",
"Retry",
")",
"\n",
"}",
"\n\n",
"if",
"o",
".",
"SSL",
"!=",
"nil",
"{",
"r",
".",
"SSL",
"=",
"r",
".",
"SSL",
".",
"Merge",
"(",
"o",
".",
"SSL",
")",
"\n",
"}",
"\n\n",
"if",
"o",
".",
"Token",
"!=",
"nil",
"{",
"r",
".",
"Token",
"=",
"o",
".",
"Token",
"\n",
"}",
"\n\n",
"if",
"o",
".",
"VaultAgentTokenFile",
"!=",
"nil",
"{",
"r",
".",
"VaultAgentTokenFile",
"=",
"o",
".",
"VaultAgentTokenFile",
"\n",
"}",
"\n\n",
"if",
"o",
".",
"Transport",
"!=",
"nil",
"{",
"r",
".",
"Transport",
"=",
"r",
".",
"Transport",
".",
"Merge",
"(",
"o",
".",
"Transport",
")",
"\n",
"}",
"\n\n",
"if",
"o",
".",
"UnwrapToken",
"!=",
"nil",
"{",
"r",
".",
"UnwrapToken",
"=",
"o",
".",
"UnwrapToken",
"\n",
"}",
"\n\n",
"return",
"r",
"\n",
"}"
] |
4,038 | all-4039 | [
"SetDecorationLayout",
"is",
"a",
"wrapper",
"around",
"gtk_header_bar_set_decoration_layout",
"()",
"."
] | [
"func",
"(",
"v",
"*",
"HeaderBar",
")",
"SetDecorationLayout",
"(",
"layout",
"string",
")",
"{",
"cstr",
":=",
"C",
".",
"CString",
"(",
"<mask>",
")",
"\n",
"defer",
"C",
".",
"free",
"(",
"unsafe",
".",
"Pointer",
"(",
"cstr",
")",
")",
"\n",
"C",
".",
"gtk_header_bar_set_decoration_layout",
"(",
"v",
".",
"native",
"(",
")",
",",
"(",
"*",
"C",
".",
"gchar",
")",
"(",
"cstr",
")",
")",
"\n",
"}"
] |
4,039 | all-4040 | [
"/",
"*",
"polymorph",
"RouteWrapper",
"error",
"false",
"/",
"*",
"polymorph",
"RouteWrapper",
"message",
"false",
"/",
"*",
"polymorph",
"RouteWrapper",
"route",
"false",
"Validate",
"validates",
"this",
"route",
"wrapper"
] | [
"func",
"(",
"m",
"*",
"RouteWrapper",
")",
"Validate",
"(",
"formats",
"strfmt",
".",
"Registry",
")",
"error",
"{",
"var",
"res",
"[",
"]",
"error",
"\n\n",
"if",
"err",
":=",
"m",
".",
"validateError",
"(",
"formats",
")",
";",
"err",
"!=",
"nil",
"{",
"// prop",
"res",
"=",
"append",
"(",
"<mask>",
",",
"err",
")",
"\n",
"}",
"\n\n",
"if",
"err",
":=",
"m",
".",
"validateRoute",
"(",
"formats",
")",
";",
"err",
"!=",
"nil",
"{",
"// prop",
"res",
"=",
"append",
"(",
"res",
",",
"err",
")",
"\n",
"}",
"\n\n",
"if",
"len",
"(",
"res",
")",
">",
"0",
"{",
"return",
"errors",
".",
"CompositeValidationError",
"(",
"res",
"...",
")",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
] |
4,040 | all-4041 | [
"UnmarshalJSON",
"supports",
"json",
".",
"Unmarshaler",
"interface"
] | [
"func",
"(",
"v",
"*",
"GetInlineStylesForNodeParams",
")",
"UnmarshalJSON",
"(",
"data",
"[",
"]",
"<mask>",
")",
"error",
"{",
"r",
":=",
"jlexer",
".",
"Lexer",
"{",
"Data",
":",
"data",
"}",
"\n",
"easyjsonC5a4559bDecodeGithubComChromedpCdprotoCss44",
"(",
"&",
"r",
",",
"v",
")",
"\n",
"return",
"r",
".",
"Error",
"(",
")",
"\n",
"}"
] |
4,041 | all-4042 | [
"MarshalJSON",
"supports",
"json",
".",
"Marshaler",
"interface"
] | [
"func",
"(",
"v",
"TakeResponseBodyAsStreamReturns",
")",
"MarshalJSON",
"(",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"w",
":=",
"jwriter",
".",
"Writer",
"{",
"}",
"\n",
"easyjsonC5a4559bEncodeGithubComChromedpCdprotoFetch",
"(",
"&",
"w",
",",
"v",
")",
"\n",
"return",
"w",
".",
"<mask>",
".",
"BuildBytes",
"(",
")",
",",
"w",
".",
"Error",
"\n",
"}"
] |
4,042 | all-4043 | [
"GetLabelOk",
"returns",
"a",
"tuple",
"with",
"the",
"Label",
"field",
"if",
"it",
"s",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"and",
"a",
"boolean",
"to",
"check",
"if",
"the",
"value",
"has",
"been",
"set",
"."
] | [
"func",
"(",
"t",
"*",
"TileDefMarker",
")",
"GetLabelOk",
"(",
")",
"(",
"string",
",",
"bool",
")",
"{",
"if",
"t",
"==",
"nil",
"||",
"t",
".",
"<mask>",
"==",
"nil",
"{",
"return",
"\"",
"\"",
",",
"false",
"\n",
"}",
"\n",
"return",
"*",
"t",
".",
"Label",
",",
"true",
"\n",
"}"
] |
4,043 | all-4044 | [
"Write",
"writes",
"p",
"into",
"response",
"body",
"."
] | [
"func",
"(",
"ctx",
"*",
"RequestCtx",
")",
"Write",
"(",
"p",
"[",
"]",
"byte",
")",
"(",
"int",
",",
"error",
")",
"{",
"ctx",
".",
"<mask>",
".",
"AppendBody",
"(",
"p",
")",
"\n",
"return",
"len",
"(",
"p",
")",
",",
"nil",
"\n",
"}"
] |
4,044 | all-4045 | [
"Compact",
"implements",
"gRPC",
"KVServer",
".",
"Compact",
"compacts",
"the",
"event",
"history",
"in",
"s",
".",
"User",
"should",
"compact",
"the",
"event",
"history",
"periodically",
"or",
"it",
"will",
"grow",
"infinitely",
"."
] | [
"func",
"(",
"s",
"*",
"etcdStore",
")",
"Compact",
"(",
"ctx",
"context",
".",
"Context",
",",
"req",
"*",
"etcdserverpb",
".",
"CompactionRequest",
")",
"(",
"*",
"etcdserverpb",
".",
"CompactionResponse",
",",
"error",
")",
"{",
"// We don't have snapshotting yet, so compact just puts us in a bad state.",
"// TODO(pb): fix this when we implement snapshotting.",
"return",
"nil",
",",
"<mask>",
".",
"New",
"(",
"\"",
"\"",
")",
"\n",
"}"
] |
4,045 | all-4046 | [
"DisconnectKey",
"is",
"a",
"wrapper",
"around",
"gtk_accel_group_disconnect_key",
"()",
"."
] | [
"func",
"(",
"v",
"*",
"AccelGroup",
")",
"DisconnectKey",
"(",
"key",
"uint",
",",
"mods",
"gdk",
".",
"ModifierType",
")",
"{",
"C",
".",
"gtk_accel_group_disconnect_key",
"(",
"v",
".",
"native",
"(",
")",
",",
"C",
".",
"guint",
"(",
"key",
")",
",",
"C",
".",
"GdkModifierType",
"(",
"<mask>",
")",
")",
"\n",
"}"
] |
4,046 | all-4047 | [
"/",
"*",
"1"
] | [
"func",
"(",
"n",
"ACFullname",
")",
"Version",
"(",
")",
"string",
"{",
"split",
":=",
"strings",
".",
"Split",
"(",
"string",
"(",
"n",
")",
",",
"\"",
"\"",
")",
"\n",
"if",
"len",
"(",
"split",
")",
"==",
"1",
"{",
"return",
"\"",
"\"",
"\n",
"}",
"\n",
"return",
"<mask>",
"[",
"1",
"]",
"\n",
"}"
] |
4,047 | all-4048 | [
"Count",
"returns",
"the",
"total",
"number",
"of",
"documents",
"in",
"the",
"collection",
"."
] | [
"func",
"(",
"c",
"*",
"<mask>",
")",
"Count",
"(",
")",
"(",
"n",
"int",
",",
"err",
"error",
")",
"{",
"return",
"c",
".",
"Find",
"(",
"nil",
")",
".",
"Count",
"(",
")",
"\n",
"}"
] |
4,048 | all-4049 | [
"The",
"Add",
"method",
"takes",
"a",
"variable",
"number",
"of",
"string",
"arguments",
"and",
"adds",
"those",
"files",
"to",
"the",
"watch",
"list",
"returning",
"the",
"number",
"of",
"files",
"added",
"."
] | [
"func",
"(",
"w",
"*",
"Watcher",
")",
"Add",
"(",
"inpaths",
"...",
"string",
")",
"{",
"var",
"paths",
"[",
"]",
"string",
"\n",
"for",
"_",
",",
"path",
":=",
"range",
"inpaths",
"{",
"matches",
",",
"err",
":=",
"filepath",
".",
"Glob",
"(",
"path",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"continue",
"\n",
"}",
"\n",
"paths",
"=",
"append",
"(",
"paths",
",",
"matches",
"...",
")",
"\n",
"}",
"\n",
"if",
"w",
".",
"auto_watch",
"&&",
"w",
".",
"notify_chan",
"!=",
"nil",
"{",
"for",
"_",
",",
"path",
":=",
"range",
"paths",
"{",
"wi",
":=",
"watchPath",
"(",
"path",
")",
"\n",
"w",
".",
"addPaths",
"(",
"wi",
")",
"\n",
"}",
"\n",
"}",
"else",
"if",
"w",
".",
"auto_watch",
"{",
"w",
".",
"syncAddPaths",
"(",
"paths",
"...",
")",
"\n",
"}",
"else",
"{",
"for",
"_",
",",
"<mask>",
":=",
"range",
"paths",
"{",
"w",
".",
"paths",
"[",
"path",
"]",
"=",
"watchPath",
"(",
"path",
")",
"\n",
"}",
"\n",
"}",
"\n",
"}"
] |
4,049 | all-4050 | [
"Fill",
"fills",
"the",
"image",
"with",
"a",
"color",
".",
"This",
"affects",
"not",
"only",
"the",
"(",
"0",
"0",
")",
"-",
"(",
"width",
"height",
")",
"region",
"but",
"also",
"the",
"whole",
"framebuffer",
"region",
"."
] | [
"func",
"(",
"i",
"*",
"<mask>",
")",
"Fill",
"(",
"r",
",",
"g",
",",
"b",
",",
"a",
"uint8",
")",
"{",
"backendsM",
".",
"Lock",
"(",
")",
"\n",
"if",
"i",
".",
"disposed",
"{",
"panic",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"i",
".",
"ensureNotShared",
"(",
")",
"\n\n",
"i",
".",
"backend",
".",
"restorable",
".",
"Fill",
"(",
"r",
",",
"g",
",",
"b",
",",
"a",
")",
"\n\n",
"backendsM",
".",
"Unlock",
"(",
")",
"\n",
"}"
] |
4,050 | all-4051 | [
"NewMemoryStore",
"创建敏感词内存存储"
] | [
"func",
"NewMemoryStore",
"(",
"config",
"MemoryConfig",
")",
"(",
"*",
"MemoryStore",
",",
"error",
")",
"{",
"memStore",
":=",
"&",
"MemoryStore",
"{",
"dataStore",
":",
"cmap",
".",
"NewConcurrencyMap",
"(",
")",
",",
"}",
"\n",
"if",
"config",
".",
"Delim",
"==",
"0",
"{",
"config",
".",
"Delim",
"=",
"DefaultDelim",
"\n",
"}",
"\n",
"if",
"dataLen",
":=",
"len",
"(",
"config",
".",
"DataSource",
")",
";",
"dataLen",
">",
"0",
"{",
"for",
"i",
":=",
"0",
";",
"i",
"<",
"dataLen",
";",
"i",
"++",
"{",
"memStore",
".",
"dataStore",
".",
"Set",
"(",
"config",
".",
"DataSource",
"[",
"i",
"]",
",",
"1",
")",
"\n",
"}",
"\n",
"}",
"else",
"if",
"config",
".",
"Reader",
"!=",
"nil",
"{",
"buf",
":=",
"new",
"(",
"bytes",
".",
"Buffer",
")",
"\n",
"io",
".",
"Copy",
"(",
"buf",
",",
"config",
".",
"Reader",
")",
"\n",
"buf",
".",
"WriteByte",
"(",
"config",
".",
"Delim",
")",
"\n",
"for",
"{",
"<mask>",
",",
"err",
":=",
"buf",
".",
"ReadString",
"(",
"config",
".",
"Delim",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"if",
"err",
"==",
"io",
".",
"EOF",
"{",
"break",
"\n",
"}",
"\n",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"memStore",
".",
"dataStore",
".",
"Set",
"(",
"line",
",",
"1",
")",
"\n",
"}",
"\n",
"buf",
".",
"Reset",
"(",
")",
"\n",
"}",
"\n",
"return",
"memStore",
",",
"nil",
"\n",
"}"
] |
4,051 | all-4052 | [
"pack9",
"packs",
"9",
"values",
"from",
"in",
"using",
"3",
"bits",
"each"
] | [
"func",
"pack9",
"(",
"in",
"[",
"]",
"uint32",
")",
"uint32",
"{",
"return",
"2",
"<<",
"28",
"|",
"in",
"[",
"0",
"]",
"<<",
"1",
"|",
"in",
"[",
"1",
"]",
"<<",
"4",
"|",
"in",
"[",
"2",
"]",
"<<",
"7",
"|",
"<mask>",
"[",
"3",
"]",
"<<",
"10",
"|",
"in",
"[",
"4",
"]",
"<<",
"13",
"|",
"in",
"[",
"5",
"]",
"<<",
"16",
"|",
"in",
"[",
"6",
"]",
"<<",
"19",
"|",
"in",
"[",
"7",
"]",
"<<",
"22",
"|",
"in",
"[",
"8",
"]",
"<<",
"25",
"\n",
"}"
] |
4,052 | all-4053 | [
"isHTMLComment",
"returns",
"true",
"if",
"the",
"line",
"is",
"an",
"HTML",
"comment",
"."
] | [
"func",
"(",
"l",
"*",
"<mask>",
")",
"isHTMLComment",
"(",
")",
"bool",
"{",
"return",
"len",
"(",
"l",
".",
"tokens",
")",
">",
"0",
"&&",
"l",
".",
"tokens",
"[",
"0",
"]",
"==",
"slash",
"+",
"slash",
"\n",
"}"
] |
4,053 | all-4054 | [
"expandVMwareDVSConfigSpec",
"reads",
"certain",
"ResourceData",
"keys",
"and",
"returns",
"a",
"VMwareDVSConfigSpec",
"."
] | [
"func",
"expandVMwareDVSConfigSpec",
"(",
"d",
"*",
"schema",
".",
"ResourceData",
")",
"*",
"<mask>",
".",
"VMwareDVSConfigSpec",
"{",
"obj",
":=",
"&",
"types",
".",
"VMwareDVSConfigSpec",
"{",
"DVSConfigSpec",
":",
"types",
".",
"DVSConfigSpec",
"{",
"Name",
":",
"d",
".",
"Get",
"(",
"\"",
"\"",
")",
".",
"(",
"string",
")",
",",
"ConfigVersion",
":",
"d",
".",
"Get",
"(",
"\"",
"\"",
")",
".",
"(",
"string",
")",
",",
"DefaultPortConfig",
":",
"expandVMwareDVSPortSetting",
"(",
"d",
")",
",",
"Host",
":",
"expandSliceOfDistributedVirtualSwitchHostMemberConfigSpec",
"(",
"d",
")",
",",
"Description",
":",
"d",
".",
"Get",
"(",
"\"",
"\"",
")",
".",
"(",
"string",
")",
",",
"Contact",
":",
"expandDVSContactInfo",
"(",
"d",
")",
",",
"SwitchIpAddress",
":",
"d",
".",
"Get",
"(",
"\"",
"\"",
")",
".",
"(",
"string",
")",
",",
"InfrastructureTrafficResourceConfig",
":",
"expandSliceOfDvsHostInfrastructureTrafficResource",
"(",
"d",
")",
",",
"NetworkResourceControlVersion",
":",
"d",
".",
"Get",
"(",
"\"",
"\"",
")",
".",
"(",
"string",
")",
",",
"UplinkPortPolicy",
":",
"expandDVSNameArrayUplinkPortPolicy",
"(",
"d",
")",
",",
"}",
",",
"MaxMtu",
":",
"int32",
"(",
"d",
".",
"Get",
"(",
"\"",
"\"",
")",
".",
"(",
"int",
")",
")",
",",
"LinkDiscoveryProtocolConfig",
":",
"expandLinkDiscoveryProtocolConfig",
"(",
"d",
")",
",",
"IpfixConfig",
":",
"expandVMwareIpfixConfig",
"(",
"d",
")",
",",
"LacpApiVersion",
":",
"d",
".",
"Get",
"(",
"\"",
"\"",
")",
".",
"(",
"string",
")",
",",
"MulticastFilteringMode",
":",
"d",
".",
"Get",
"(",
"\"",
"\"",
")",
".",
"(",
"string",
")",
",",
"}",
"\n",
"return",
"obj",
"\n",
"}"
] |
4,054 | all-4055 | [
"inventoryMetrics",
"creates",
"list",
"of",
"active",
"metrics",
"in",
"check",
"bundle"
] | [
"func",
"(",
"cm",
"*",
"CheckManager",
")",
"inventoryMetrics",
"(",
")",
"{",
"availableMetrics",
":=",
"<mask>",
"(",
"map",
"[",
"string",
"]",
"bool",
")",
"\n",
"for",
"_",
",",
"metric",
":=",
"range",
"cm",
".",
"checkBundle",
".",
"Metrics",
"{",
"availableMetrics",
"[",
"metric",
".",
"Name",
"]",
"=",
"metric",
".",
"Status",
"==",
"\"",
"\"",
"\n",
"}",
"\n",
"cm",
".",
"availableMetricsmu",
".",
"Lock",
"(",
")",
"\n",
"cm",
".",
"availableMetrics",
"=",
"availableMetrics",
"\n",
"cm",
".",
"availableMetricsmu",
".",
"Unlock",
"(",
")",
"\n",
"}"
] |
4,055 | all-4056 | [
"readPixelsFromGPU",
"reads",
"the",
"pixels",
"from",
"GPU",
"and",
"resolves",
"the",
"image",
"s",
"stale",
"state",
"."
] | [
"func",
"(",
"i",
"*",
"<mask>",
")",
"readPixelsFromGPU",
"(",
")",
"{",
"pix",
":=",
"i",
".",
"image",
".",
"Pixels",
"(",
")",
"\n",
"i",
".",
"basePixels",
"=",
"&",
"Pixels",
"{",
"pixels",
":",
"pix",
",",
"length",
":",
"len",
"(",
"pix",
")",
",",
"}",
"\n",
"i",
".",
"drawTrianglesHistory",
"=",
"nil",
"\n",
"i",
".",
"stale",
"=",
"false",
"\n",
"}"
] |
4,056 | all-4057 | [
"AddSystemGroup",
"adds",
"a",
"system",
"group",
"."
] | [
"func",
"AddSystemGroup",
"(",
"name",
"string",
",",
"members",
"...",
"string",
")",
"(",
"gid",
"int",
",",
"err",
"error",
")",
"{",
"s",
":=",
"NewGShadow",
"(",
"name",
",",
"<mask>",
"...",
")",
"\n",
"if",
"err",
"=",
"s",
".",
"Add",
"(",
"nil",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"\n",
"}",
"\n\n",
"return",
"NewSystemGroup",
"(",
"name",
",",
"members",
"...",
")",
".",
"Add",
"(",
")",
"\n",
"}"
] |
4,057 | all-4058 | [
"SetLevel",
"sets",
"an",
"individual",
"level",
"and",
"its",
"associated",
"display",
"effect",
"."
] | [
"func",
"(",
"w",
"*",
"<mask>",
")",
"SetLevel",
"(",
"level",
"string",
",",
"effect",
"string",
")",
"{",
"levels",
":=",
"w",
".",
"Levels",
"(",
")",
"\n",
"levels",
"[",
"level",
"]",
"=",
"effect",
"\n",
"w",
".",
"SetLevels",
"(",
"levels",
")",
"\n",
"}"
] |
4,058 | all-4059 | [
"GetProjectUsage",
"returns",
"the",
"current",
"consumption"
] | [
"func",
"GetProjectUsage",
"(",
"path",
"string",
",",
"id",
"uint32",
")",
"(",
"int64",
",",
"error",
")",
"{",
"// Get the backing device",
"devPath",
",",
"err",
":=",
"devForPath",
"(",
"path",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"-",
"1",
",",
"err",
"\n",
"}",
"\n\n",
"// Call quotactl through CGo",
"cDevPath",
":=",
"C",
".",
"CString",
"(",
"devPath",
")",
"\n",
"defer",
"C",
".",
"free",
"(",
"unsafe",
".",
"Pointer",
"(",
"cDevPath",
")",
")",
"\n\n",
"size",
":=",
"C",
".",
"quota_get_usage",
"(",
"cDevPath",
",",
"C",
".",
"uint32_t",
"(",
"id",
")",
")",
"\n",
"if",
"size",
"<",
"0",
"{",
"return",
"-",
"1",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"<mask>",
",",
"path",
")",
"\n",
"}",
"\n\n",
"return",
"int64",
"(",
"size",
")",
",",
"nil",
"\n",
"}"
] |
4,059 | all-4060 | [
"interface",
"similar",
"to",
"fmt",
"package",
"Errorm",
"returns",
"error",
"instance",
"with",
"formatted",
"error",
"message",
".",
"This",
"is",
"same",
"as",
"fmt",
".",
"Errorf",
"but",
"uses",
"gstring",
"formatting",
"."
] | [
"func",
"Errorm",
"(",
"format",
"string",
",",
"args",
"map",
"[",
"string",
"]",
"interface",
"{",
"}",
")",
"error",
"{",
"f",
",",
"a",
":=",
"gformat",
"(",
"<mask>",
",",
"args",
")",
"\n",
"return",
"fmt",
".",
"Errorf",
"(",
"f",
",",
"a",
"...",
")",
"\n",
"}"
] |
4,060 | all-4061 | [
"NewShowCmd",
"creates",
"a",
"new",
"ShowCmd",
"instance",
"."
] | [
"func",
"NewShowCmd",
"(",
"releaseRepo",
"<mask>",
".",
"Release",
",",
"release",
"string",
")",
"*",
"ShowCmd",
"{",
"return",
"&",
"ShowCmd",
"{",
"releaseRepo",
":",
"releaseRepo",
",",
"release",
":",
"release",
",",
"}",
"\n",
"}"
] |
4,061 | all-4062 | [
"GetLayoutTypeOk",
"returns",
"a",
"tuple",
"with",
"the",
"LayoutType",
"field",
"if",
"it",
"s",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"and",
"a",
"boolean",
"to",
"check",
"if",
"the",
"value",
"has",
"been",
"set",
"."
] | [
"func",
"(",
"g",
"*",
"GroupDefinition",
")",
"GetLayoutTypeOk",
"(",
")",
"(",
"string",
",",
"bool",
")",
"{",
"if",
"g",
"==",
"nil",
"||",
"g",
".",
"LayoutType",
"==",
"nil",
"{",
"return",
"\"",
"\"",
",",
"false",
"\n",
"}",
"\n",
"return",
"*",
"g",
".",
"LayoutType",
",",
"<mask>",
"\n",
"}"
] |
4,062 | all-4063 | [
"NewState",
"creates",
"a",
"MultiState",
"instance",
"based",
"on",
"the",
"statesDescription",
"string",
".",
"statesDescription",
"is",
"a",
"comma",
"separated",
"list",
"of",
"events",
".",
"Events",
"can",
"be",
"prepended",
"with",
"!",
"(",
"bang",
")",
"to",
"say",
"that",
"the",
"state",
"will",
"be",
"activated",
"only",
"if",
"this",
"event",
"doesn",
"t",
"happen",
"(",
"or",
"is",
"inverted",
")",
"."
] | [
"func",
"NewState",
"(",
"statesDescription",
"string",
")",
"State",
"{",
"states",
":=",
"[",
"]",
"State",
"{",
"}",
"\n\n",
"if",
"statesDescription",
"==",
"\"",
"\"",
"{",
"// Create an infinite inactive state",
"return",
"&",
"InactiveState",
"{",
"entry",
":",
"FalseEvent",
"{",
"}",
",",
"}",
"\n",
"}",
"\n\n",
"splitDescription",
":=",
"strings",
".",
"Split",
"(",
"statesDescription",
",",
"\"",
"\"",
")",
"\n",
"for",
"_",
",",
"description",
":=",
"range",
"splitDescription",
"{",
"description",
"=",
"strings",
".",
"TrimSpace",
"(",
"description",
")",
"\n",
"if",
"strings",
".",
"HasPrefix",
"(",
"description",
",",
"\"",
"\"",
")",
"{",
"states",
"=",
"append",
"(",
"states",
",",
"&",
"ActiveState",
"{",
"startTime",
":",
"time",
".",
"Time",
"{",
"}",
",",
"exit",
":",
"NewEventMatcher",
"(",
"description",
"[",
"1",
":",
"]",
")",
",",
"}",
")",
"\n",
"}",
"else",
"{",
"states",
"=",
"append",
"(",
"states",
",",
"&",
"InactiveState",
"{",
"entry",
":",
"NewEventMatcher",
"(",
"<mask>",
")",
",",
"}",
")",
"\n",
"}",
"\n",
"}",
"\n\n",
"return",
"&",
"MultiState",
"{",
"states",
":",
"states",
"}",
"\n",
"}"
] |
4,063 | all-4064 | [
"/",
"*",
"func",
"(",
"ipvs",
"*",
"IpvsClient",
")",
"modifyFWMDest",
"(",
"method",
"string",
"fwmark",
"uint32",
"rip",
"string",
"vaf",
"uint16",
"port",
"uint16",
"amap",
"map",
"[",
"string",
"]",
"SerDes",
")",
"{"
] | [
"func",
"(",
"ipvs",
"*",
"IpvsClient",
")",
"AddFWMDest",
"(",
"fwmark",
"uint32",
",",
"rip",
"string",
",",
"vaf",
"uint16",
",",
"port",
"uint16",
",",
"weight",
"int32",
")",
"error",
"{",
"return",
"ipvs",
".",
"AddFWMDestFWD",
"(",
"fwmark",
",",
"rip",
",",
"vaf",
",",
"port",
",",
"<mask>",
",",
"IPVS_TUNNELING",
")",
"\n",
"}"
] |
4,064 | all-4065 | [
"cmps",
"guards",
"the",
"txn",
"from",
"updates",
"to",
"read",
"set"
] | [
"func",
"(",
"<mask>",
"readSet",
")",
"cmps",
"(",
")",
"[",
"]",
"v3",
".",
"Cmp",
"{",
"cmps",
":=",
"make",
"(",
"[",
"]",
"v3",
".",
"Cmp",
",",
"0",
",",
"len",
"(",
"rs",
")",
")",
"\n",
"for",
"k",
",",
"rk",
":=",
"range",
"rs",
"{",
"cmps",
"=",
"append",
"(",
"cmps",
",",
"isKeyCurrent",
"(",
"k",
",",
"rk",
")",
")",
"\n",
"}",
"\n",
"return",
"cmps",
"\n",
"}"
] |
4,065 | all-4066 | [
"GetTransactions",
"gets",
"transactions",
"associated",
"with",
"an",
"account"
] | [
"func",
"(",
"c",
"Client",
")",
"GetTransactions",
"(",
"<mask>",
"int",
")",
"(",
"*",
"transactions",
",",
"error",
")",
"{",
"params",
":=",
"map",
"[",
"string",
"]",
"int",
"{",
"\"",
"\"",
":",
"page",
",",
"}",
"\n",
"holder",
":=",
"transactionsHolder",
"{",
"}",
"\n",
"if",
"err",
":=",
"c",
".",
"Get",
"(",
"\"",
"\"",
",",
"params",
",",
"&",
"holder",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"transactions",
":=",
"transactions",
"{",
"paginationStats",
":",
"holder",
".",
"paginationStats",
",",
"}",
"\n",
"// Remove one layer of nesting",
"for",
"_",
",",
"tx",
":=",
"range",
"holder",
".",
"Transactions",
"{",
"transactions",
".",
"Transactions",
"=",
"append",
"(",
"transactions",
".",
"Transactions",
",",
"tx",
".",
"Transaction",
")",
"\n",
"}",
"\n",
"return",
"&",
"transactions",
",",
"nil",
"\n",
"}"
] |
4,066 | all-4067 | [
"GorillaHost",
"----------------------------------------------------------------"
] | [
"func",
"NewGorillaHost",
"(",
"<mask>",
"string",
")",
"(",
"*",
"GorillaHost",
",",
"error",
")",
"{",
"pattern",
",",
"err",
":=",
"gorillaPattern",
"(",
"pattern",
",",
"true",
",",
"false",
",",
"false",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"r",
",",
"err",
":=",
"CompileRegexp",
"(",
"pattern",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"return",
"&",
"GorillaHost",
"{",
"*",
"r",
"}",
",",
"nil",
"\n",
"}"
] |
4,067 | all-4068 | [
"NewLogger",
"returns",
"a",
"Logger",
"that",
"writes",
"to",
"the",
"given",
"writer",
"."
] | [
"func",
"NewLogger",
"(",
"writer",
"<mask>",
".",
"Writer",
",",
"fields",
"...",
"LogField",
")",
"Logger",
"{",
"return",
"&",
"writerLogger",
"{",
"writer",
",",
"fields",
"}",
"\n",
"}"
] |
4,068 | all-4069 | [
"ClientIP",
"returns",
"the",
"client",
"IP",
"embedded",
"in",
"the",
"context",
"or",
"nil",
"if",
"none",
"were",
"found",
"."
] | [
"func",
"ClientIP",
"(",
"ctx",
"context",
".",
"<mask>",
")",
"net",
".",
"IP",
"{",
"ip",
",",
"_",
":=",
"ctx",
".",
"Value",
"(",
"clientIPKey",
"{",
"}",
")",
".",
"(",
"net",
".",
"IP",
")",
"\n",
"return",
"ip",
"\n",
"}"
] |
4,069 | all-4070 | [
"VerifyLeader",
"is",
"used",
"to",
"ensure",
"the",
"current",
"node",
"is",
"still",
"the",
"leader",
".",
"This",
"can",
"be",
"done",
"to",
"prevent",
"stale",
"reads",
"when",
"a",
"new",
"leader",
"has",
"potentially",
"been",
"elected",
"."
] | [
"func",
"(",
"r",
"*",
"Raft",
")",
"VerifyLeader",
"(",
")",
"Future",
"{",
"metrics",
".",
"IncrCounter",
"(",
"[",
"]",
"string",
"{",
"\"",
"\"",
",",
"\"",
"\"",
"}",
",",
"1",
")",
"\n",
"verifyFuture",
":=",
"&",
"verifyFuture",
"{",
"}",
"\n",
"verifyFuture",
".",
"init",
"(",
")",
"\n",
"<mask>",
"{",
"case",
"<-",
"r",
".",
"shutdownCh",
":",
"return",
"errorFuture",
"{",
"ErrRaftShutdown",
"}",
"\n",
"case",
"r",
".",
"verifyCh",
"<-",
"verifyFuture",
":",
"return",
"verifyFuture",
"\n",
"}",
"\n",
"}"
] |
4,070 | all-4071 | [
"UseProbe",
"returns",
"an",
"option",
"that",
"specifies",
"an",
"APICheckProbe",
"implementation",
"to",
"use",
"."
] | [
"func",
"UseProbe",
"(",
"probe",
"APICheckProbe",
")",
"APICheckOption",
"{",
"<mask>",
"func",
"(",
"s",
"*",
"APICheckSuite",
")",
"{",
"s",
".",
"opts",
".",
"Probe",
"=",
"probe",
"\n",
"}",
"\n",
"}"
] |
4,071 | all-4072 | [
"Do",
"executes",
"Runtime",
".",
"awaitPromise",
"against",
"the",
"provided",
"context",
".",
"returns",
":",
"result",
"-",
"Promise",
"result",
".",
"Will",
"contain",
"rejected",
"value",
"if",
"promise",
"was",
"rejected",
".",
"exceptionDetails",
"-",
"Exception",
"details",
"if",
"stack",
"strace",
"is",
"available",
"."
] | [
"func",
"(",
"p",
"*",
"AwaitPromiseParams",
")",
"Do",
"(",
"ctx",
"context",
".",
"Context",
")",
"(",
"result",
"*",
"RemoteObject",
",",
"exceptionDetails",
"*",
"ExceptionDetails",
",",
"err",
"error",
")",
"{",
"// execute",
"var",
"res",
"AwaitPromiseReturns",
"\n",
"err",
"=",
"cdp",
".",
"Execute",
"(",
"ctx",
",",
"CommandAwaitPromise",
",",
"p",
",",
"&",
"res",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"return",
"res",
".",
"<mask>",
",",
"res",
".",
"ExceptionDetails",
",",
"nil",
"\n",
"}"
] |
4,072 | all-4073 | [
"SetTolerance",
"is",
"a",
"wrapper",
"around",
"cairo_set_tolerance",
"()",
"."
] | [
"func",
"(",
"v",
"*",
"<mask>",
")",
"SetTolerance",
"(",
"tolerance",
"float64",
")",
"{",
"C",
".",
"cairo_set_tolerance",
"(",
"v",
".",
"native",
"(",
")",
",",
"C",
".",
"double",
"(",
"tolerance",
")",
")",
"\n",
"}"
] |
4,073 | all-4074 | [
"BindUnit",
"makes",
"the",
"bind",
"between",
"the",
"binder",
"and",
"an",
"unit",
"."
] | [
"func",
"(",
"si",
"*",
"ServiceInstance",
")",
"BindUnit",
"(",
"app",
"bind",
".",
"App",
",",
"unit",
"bind",
".",
"Unit",
")",
"error",
"{",
"s",
",",
"err",
":=",
"Get",
"(",
"si",
".",
"ServiceName",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"endpoint",
",",
"err",
":=",
"s",
".",
"getClient",
"(",
"\"",
"\"",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"conn",
",",
"err",
":=",
"db",
".",
"Conn",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"updateOp",
":=",
"bson",
".",
"M",
"{",
"\"",
"\"",
":",
"bson",
".",
"M",
"{",
"\"",
"\"",
":",
"bson",
".",
"D",
"(",
"[",
"]",
"bson",
".",
"DocElem",
"{",
"{",
"<mask>",
":",
"\"",
"\"",
",",
"Value",
":",
"app",
".",
"GetName",
"(",
")",
"}",
",",
"{",
"Name",
":",
"\"",
"\"",
",",
"Value",
":",
"unit",
".",
"GetID",
"(",
")",
"}",
",",
"{",
"Name",
":",
"\"",
"\"",
",",
"Value",
":",
"unit",
".",
"GetIp",
"(",
")",
"}",
",",
"}",
")",
",",
"}",
",",
"}",
"\n",
"err",
"=",
"conn",
".",
"ServiceInstances",
"(",
")",
".",
"Update",
"(",
"bson",
".",
"M",
"{",
"\"",
"\"",
":",
"si",
".",
"Name",
",",
"\"",
"\"",
":",
"si",
".",
"ServiceName",
",",
"\"",
"\"",
":",
"bson",
".",
"M",
"{",
"\"",
"\"",
":",
"unit",
".",
"GetID",
"(",
")",
"}",
"}",
",",
"updateOp",
")",
"\n",
"conn",
".",
"Close",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"if",
"err",
"==",
"mgo",
".",
"ErrNotFound",
"{",
"return",
"nil",
"\n",
"}",
"\n",
"return",
"err",
"\n",
"}",
"\n",
"err",
"=",
"endpoint",
".",
"BindUnit",
"(",
"si",
",",
"app",
",",
"unit",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"updateOp",
"=",
"bson",
".",
"M",
"{",
"\"",
"\"",
":",
"bson",
".",
"M",
"{",
"\"",
"\"",
":",
"bson",
".",
"D",
"(",
"[",
"]",
"bson",
".",
"DocElem",
"{",
"{",
"Name",
":",
"\"",
"\"",
",",
"Value",
":",
"app",
".",
"GetName",
"(",
")",
"}",
",",
"{",
"Name",
":",
"\"",
"\"",
",",
"Value",
":",
"unit",
".",
"GetID",
"(",
")",
"}",
",",
"{",
"Name",
":",
"\"",
"\"",
",",
"Value",
":",
"unit",
".",
"GetIp",
"(",
")",
"}",
",",
"}",
")",
",",
"}",
",",
"}",
"\n",
"rollbackErr",
":=",
"si",
".",
"updateData",
"(",
"updateOp",
")",
"\n",
"if",
"rollbackErr",
"!=",
"nil",
"{",
"log",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"rollbackErr",
")",
"\n",
"}",
"\n",
"return",
"err",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
] |
4,074 | all-4075 | [
"DropDatabase",
"drop",
"database",
"of",
"any",
"given",
"name"
] | [
"func",
"(",
"s",
"*",
"<mask>",
")",
"DropDatabase",
"(",
"name",
"string",
")",
"error",
"{",
"return",
"s",
".",
"session",
".",
"DB",
"(",
"name",
")",
".",
"DropDatabase",
"(",
")",
"\n",
"}"
] |
4,075 | all-4076 | [
"SelectedItemText",
"returns",
"text",
"of",
"currently",
"selected",
"item",
"or",
"empty",
"sting",
"if",
"nothing",
"is",
"selected",
"or",
"ListBox",
"is",
"empty",
"."
] | [
"func",
"(",
"l",
"*",
"ListBox",
")",
"SelectedItemText",
"(",
")",
"string",
"{",
"if",
"l",
".",
"currSelection",
"==",
"-",
"1",
"{",
"return",
"\"",
"\"",
"\n",
"}",
"\n\n",
"return",
"l",
".",
"<mask>",
"[",
"l",
".",
"currSelection",
"]",
"\n",
"}"
] |
4,076 | all-4077 | [
"FirstError",
"returns",
"the",
"first",
"non",
"nil",
"error",
"or",
"nil"
] | [
"func",
"FirstError",
"(",
"errs",
"...",
"error",
")",
"error",
"{",
"for",
"_",
",",
"err",
":=",
"<mask>",
"errs",
"{",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
] |
4,077 | all-4078 | [
"SetNodeValue",
"sets",
"node",
"value",
"for",
"a",
"node",
"with",
"given",
"id",
".",
"See",
":",
"https",
":",
"//",
"chromedevtools",
".",
"github",
".",
"io",
"/",
"devtools",
"-",
"protocol",
"/",
"tot",
"/",
"DOM#method",
"-",
"setNodeValue",
"parameters",
":",
"nodeID",
"-",
"Id",
"of",
"the",
"node",
"to",
"set",
"value",
"for",
".",
"value",
"-",
"New",
"node",
"s",
"value",
"."
] | [
"func",
"SetNodeValue",
"(",
"nodeID",
"cdp",
".",
"NodeID",
",",
"value",
"string",
")",
"*",
"SetNodeValueParams",
"{",
"return",
"&",
"SetNodeValueParams",
"{",
"NodeID",
":",
"nodeID",
",",
"Value",
":",
"<mask>",
",",
"}",
"\n",
"}"
] |
4,078 | all-4079 | [
"MarshalJSON",
"supports",
"json",
".",
"Marshaler",
"interface"
] | [
"func",
"(",
"v",
"EventContextChanged",
")",
"MarshalJSON",
"(",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"w",
":=",
"jwriter",
".",
"Writer",
"{",
"}",
"\n",
"easyjsonC5a4559bEncodeGithubComChromedpCdprotoWebaudio4",
"(",
"&",
"w",
",",
"v",
")",
"\n",
"return",
"w",
".",
"Buffer",
".",
"BuildBytes",
"(",
")",
",",
"w",
".",
"<mask>",
"\n",
"}"
] |
4,079 | all-4080 | [
"Do",
"executes",
"DOM",
".",
"setFileInputFiles",
"against",
"the",
"provided",
"context",
"."
] | [
"func",
"(",
"p",
"*",
"SetFileInputFilesParams",
")",
"Do",
"(",
"ctx",
"context",
".",
"<mask>",
")",
"(",
"err",
"error",
")",
"{",
"return",
"cdp",
".",
"Execute",
"(",
"ctx",
",",
"CommandSetFileInputFiles",
",",
"p",
",",
"nil",
")",
"\n",
"}"
] |
4,080 | all-4081 | [
"GenericCommentHandlers",
"returns",
"a",
"map",
"of",
"plugin",
"names",
"to",
"handlers",
"for",
"the",
"repo",
"."
] | [
"func",
"(",
"pa",
"*",
"ConfigAgent",
")",
"GenericCommentHandlers",
"(",
"owner",
",",
"repo",
"string",
")",
"<mask>",
"[",
"string",
"]",
"GenericCommentHandler",
"{",
"pa",
".",
"mut",
".",
"Lock",
"(",
")",
"\n",
"defer",
"pa",
".",
"mut",
".",
"Unlock",
"(",
")",
"\n\n",
"hs",
":=",
"map",
"[",
"string",
"]",
"GenericCommentHandler",
"{",
"}",
"\n",
"for",
"_",
",",
"p",
":=",
"range",
"pa",
".",
"getPlugins",
"(",
"owner",
",",
"repo",
")",
"{",
"if",
"h",
",",
"ok",
":=",
"genericCommentHandlers",
"[",
"p",
"]",
";",
"ok",
"{",
"hs",
"[",
"p",
"]",
"=",
"h",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"hs",
"\n",
"}"
] |
4,081 | all-4082 | [
"Labels",
"returns",
"the",
"labels",
"from",
"the",
"builder",
".",
"If",
"no",
"modifications",
"were",
"made",
"the",
"original",
"labels",
"are",
"returned",
"."
] | [
"func",
"(",
"b",
"*",
"Builder",
")",
"Labels",
"(",
")",
"Labels",
"{",
"if",
"len",
"(",
"b",
".",
"del",
")",
"==",
"0",
"&&",
"len",
"(",
"b",
".",
"add",
")",
"==",
"0",
"{",
"return",
"b",
".",
"base",
"\n",
"}",
"\n\n",
"// In the general case, labels are removed, modified or moved",
"// rather than added.",
"res",
":=",
"make",
"(",
"Labels",
",",
"0",
",",
"len",
"(",
"b",
".",
"base",
")",
")",
"\n",
"Outer",
":",
"for",
"_",
",",
"l",
":=",
"range",
"b",
".",
"base",
"{",
"for",
"_",
",",
"n",
":=",
"range",
"b",
".",
"del",
"{",
"if",
"l",
".",
"Name",
"==",
"n",
"{",
"<mask>",
"Outer",
"\n",
"}",
"\n",
"}",
"\n",
"for",
"_",
",",
"la",
":=",
"range",
"b",
".",
"add",
"{",
"if",
"l",
".",
"Name",
"==",
"la",
".",
"Name",
"{",
"continue",
"Outer",
"\n",
"}",
"\n",
"}",
"\n",
"res",
"=",
"append",
"(",
"res",
",",
"l",
")",
"\n",
"}",
"\n",
"res",
"=",
"append",
"(",
"res",
",",
"b",
".",
"add",
"...",
")",
"\n",
"sort",
".",
"Sort",
"(",
"res",
")",
"\n\n",
"return",
"res",
"\n",
"}"
] |
4,082 | all-4083 | [
"export",
"FileSequence_Copy"
] | [
"func",
"FileSequence_Copy",
"(",
"id",
"FileSeqId",
")",
"FileSeqId",
"{",
"fs",
",",
"ok",
":=",
"sFileSeqs",
".",
"Get",
"(",
"id",
")",
"\n",
"if",
"!",
"ok",
"{",
"return",
"0",
"\n",
"}",
"\n\n",
"copyFs",
",",
"_",
":=",
"fileseq",
".",
"NewFileSequence",
"(",
"fs",
".",
"<mask>",
"(",
")",
")",
"\n",
"copyId",
":=",
"sFileSeqs",
".",
"Add",
"(",
"copyFs",
")",
"\n",
"return",
"copyId",
"\n",
"}"
] |
4,083 | all-4084 | [
"goAttach",
"creates",
"a",
"goroutine",
"on",
"a",
"given",
"function",
"and",
"tracks",
"it",
"using",
"the",
"etcdserver",
"waitgroup",
"."
] | [
"func",
"(",
"s",
"*",
"EtcdServer",
")",
"goAttach",
"(",
"f",
"func",
"(",
")",
")",
"{",
"s",
".",
"wgMu",
".",
"RLock",
"(",
")",
"// this blocks with ongoing close(s.stopping)",
"\n",
"defer",
"s",
".",
"wgMu",
".",
"RUnlock",
"(",
")",
"\n",
"<mask>",
"{",
"case",
"<-",
"s",
".",
"stopping",
":",
"if",
"lg",
":=",
"s",
".",
"getLogger",
"(",
")",
";",
"lg",
"!=",
"nil",
"{",
"lg",
".",
"Warn",
"(",
"\"",
"\"",
")",
"\n",
"}",
"else",
"{",
"plog",
".",
"Warning",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"return",
"\n",
"default",
":",
"}",
"\n\n",
"// now safe to add since waitgroup wait has not started yet",
"s",
".",
"wg",
".",
"Add",
"(",
"1",
")",
"\n",
"go",
"func",
"(",
")",
"{",
"defer",
"s",
".",
"wg",
".",
"Done",
"(",
")",
"\n",
"f",
"(",
")",
"\n",
"}",
"(",
")",
"\n",
"}"
] |
4,084 | all-4085 | [
"Draw",
"the",
"droid",
"on",
"a",
"certain",
"position",
"."
] | [
"func",
"Draw",
"(",
"gc",
"draw2d",
".",
"GraphicContext",
",",
"x",
",",
"y",
"float64",
")",
"{",
"// set the fill and stroke color of the droid",
"gc",
".",
"SetFillColor",
"(",
"<mask>",
".",
"RGBA",
"{",
"0x44",
",",
"0xff",
",",
"0x44",
",",
"0xff",
"}",
")",
"\n",
"gc",
".",
"SetStrokeColor",
"(",
"color",
".",
"RGBA",
"{",
"0x44",
",",
"0x44",
",",
"0x44",
",",
"0xff",
"}",
")",
"\n\n",
"// set line properties",
"gc",
".",
"SetLineCap",
"(",
"draw2d",
".",
"RoundCap",
")",
"\n",
"gc",
".",
"SetLineWidth",
"(",
"5",
")",
"\n\n",
"// head",
"gc",
".",
"MoveTo",
"(",
"x",
"+",
"30",
",",
"y",
"+",
"70",
")",
"\n",
"gc",
".",
"ArcTo",
"(",
"x",
"+",
"80",
",",
"y",
"+",
"70",
",",
"50",
",",
"50",
",",
"180",
"*",
"(",
"math",
".",
"Pi",
"/",
"180",
")",
",",
"180",
"*",
"(",
"math",
".",
"Pi",
"/",
"180",
")",
")",
"\n",
"gc",
".",
"Close",
"(",
")",
"\n",
"gc",
".",
"FillStroke",
"(",
")",
"\n",
"gc",
".",
"MoveTo",
"(",
"x",
"+",
"60",
",",
"y",
"+",
"25",
")",
"\n",
"gc",
".",
"LineTo",
"(",
"x",
"+",
"50",
",",
"y",
"+",
"10",
")",
"\n",
"gc",
".",
"MoveTo",
"(",
"x",
"+",
"100",
",",
"y",
"+",
"25",
")",
"\n",
"gc",
".",
"LineTo",
"(",
"x",
"+",
"110",
",",
"y",
"+",
"10",
")",
"\n",
"gc",
".",
"Stroke",
"(",
")",
"\n\n",
"// left eye",
"draw2dkit",
".",
"Circle",
"(",
"gc",
",",
"x",
"+",
"60",
",",
"y",
"+",
"45",
",",
"5",
")",
"\n",
"gc",
".",
"FillStroke",
"(",
")",
"\n\n",
"// right eye",
"draw2dkit",
".",
"Circle",
"(",
"gc",
",",
"x",
"+",
"100",
",",
"y",
"+",
"45",
",",
"5",
")",
"\n",
"gc",
".",
"FillStroke",
"(",
")",
"\n\n",
"// body",
"draw2dkit",
".",
"RoundedRectangle",
"(",
"gc",
",",
"x",
"+",
"30",
",",
"y",
"+",
"75",
",",
"x",
"+",
"30",
"+",
"100",
",",
"y",
"+",
"75",
"+",
"90",
",",
"10",
",",
"10",
")",
"\n",
"gc",
".",
"FillStroke",
"(",
")",
"\n",
"draw2dkit",
".",
"Rectangle",
"(",
"gc",
",",
"x",
"+",
"30",
",",
"y",
"+",
"75",
",",
"x",
"+",
"30",
"+",
"100",
",",
"y",
"+",
"75",
"+",
"80",
")",
"\n",
"gc",
".",
"FillStroke",
"(",
")",
"\n\n",
"// left arm",
"draw2dkit",
".",
"RoundedRectangle",
"(",
"gc",
",",
"x",
"+",
"5",
",",
"y",
"+",
"80",
",",
"x",
"+",
"5",
"+",
"20",
",",
"y",
"+",
"80",
"+",
"70",
",",
"10",
",",
"10",
")",
"\n",
"gc",
".",
"FillStroke",
"(",
")",
"\n\n",
"// right arm",
"draw2dkit",
".",
"RoundedRectangle",
"(",
"gc",
",",
"x",
"+",
"135",
",",
"y",
"+",
"80",
",",
"x",
"+",
"135",
"+",
"20",
",",
"y",
"+",
"80",
"+",
"70",
",",
"10",
",",
"10",
")",
"\n",
"gc",
".",
"FillStroke",
"(",
")",
"\n\n",
"// left leg",
"draw2dkit",
".",
"RoundedRectangle",
"(",
"gc",
",",
"x",
"+",
"50",
",",
"y",
"+",
"150",
",",
"x",
"+",
"50",
"+",
"20",
",",
"y",
"+",
"150",
"+",
"50",
",",
"10",
",",
"10",
")",
"\n",
"gc",
".",
"FillStroke",
"(",
")",
"\n\n",
"// right leg",
"draw2dkit",
".",
"RoundedRectangle",
"(",
"gc",
",",
"x",
"+",
"90",
",",
"y",
"+",
"150",
",",
"x",
"+",
"90",
"+",
"20",
",",
"y",
"+",
"150",
"+",
"50",
",",
"10",
",",
"10",
")",
"\n",
"gc",
".",
"FillStroke",
"(",
")",
"\n",
"}"
] |
4,085 | all-4086 | [
"Various",
"ways",
"to",
"sort",
"the",
"player",
"standings",
"using",
"helper",
"structs",
"that",
"implement",
"different",
"comparison",
"methods",
"."
] | [
"func",
"(",
"s",
"PlayerStandings",
")",
"ByWinnings",
"(",
"oldTieBreak",
"bool",
")",
"{",
"if",
"oldTieBreak",
"{",
"sort",
".",
"Sort",
"(",
"<mask>",
".",
"Reverse",
"(",
"ByWinningsOld",
"{",
"s",
"}",
")",
")",
"\n",
"}",
"else",
"{",
"sort",
".",
"Sort",
"(",
"sort",
".",
"Reverse",
"(",
"ByWinnings",
"{",
"s",
"}",
")",
")",
"\n",
"}",
"\n",
"}"
] |
4,086 | all-4087 | [
"NewFloodsubWithProtocols",
"returns",
"a",
"new",
"floodsub",
"-",
"enabled",
"PubSub",
"objecting",
"using",
"the",
"protocols",
"specified",
"in",
"ps",
"."
] | [
"func",
"NewFloodsubWithProtocols",
"(",
"ctx",
"context",
".",
"Context",
",",
"h",
"<mask>",
".",
"Host",
",",
"ps",
"[",
"]",
"protocol",
".",
"ID",
",",
"opts",
"...",
"Option",
")",
"(",
"*",
"PubSub",
",",
"error",
")",
"{",
"rt",
":=",
"&",
"FloodSubRouter",
"{",
"protocols",
":",
"ps",
",",
"}",
"\n",
"return",
"NewPubSub",
"(",
"ctx",
",",
"h",
",",
"rt",
",",
"opts",
"...",
")",
"\n",
"}"
] |
4,087 | all-4088 | [
"GetOther",
"returns",
"node",
"for",
"given",
"access",
"token",
".",
"Returns",
"false",
"if",
"cluster",
"is",
"nil",
"has",
"only",
"one",
"element",
"or",
"if",
"node",
"that",
"was",
"found",
"has",
"same",
"listen",
"address",
"as",
"current",
"one",
"."
] | [
"func",
"(",
"c",
"*",
"Cluster",
")",
"GetOther",
"(",
"accessToken",
"string",
")",
"(",
"*",
"Node",
",",
"bool",
")",
"{",
"if",
"c",
"==",
"nil",
"{",
"return",
"nil",
",",
"false",
"\n",
"}",
"\n",
"if",
"c",
".",
"Len",
"(",
")",
"==",
"1",
"{",
"return",
"nil",
",",
"false",
"\n",
"}",
"\n\n",
"if",
"node",
",",
"ok",
":=",
"c",
".",
"Get",
"(",
"jump",
".",
"HashString",
"(",
"accessToken",
",",
"c",
".",
"Len",
"(",
")",
")",
")",
";",
"<mask>",
"{",
"if",
"node",
".",
"Addr",
"!=",
"c",
".",
"listen",
"{",
"if",
"node",
".",
"Client",
"!=",
"nil",
"{",
"return",
"node",
",",
"true",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"nil",
",",
"false",
"\n",
"}"
] |
4,088 | all-4089 | [
"Restart",
"a",
"host",
".",
"This",
"may",
"just",
"call",
"Stop",
"()",
";",
"Start",
"()",
"if",
"the",
"provider",
"does",
"not",
"have",
"any",
"special",
"restart",
"behaviour",
"."
] | [
"func",
"(",
"d",
"*",
"SerialDriver",
")",
"Restart",
"(",
")",
"<mask>",
"{",
"d",
".",
"Lock",
"(",
")",
"\n",
"defer",
"d",
".",
"Unlock",
"(",
")",
"\n",
"return",
"d",
".",
"Driver",
".",
"Restart",
"(",
")",
"\n",
"}"
] |
4,089 | all-4090 | [
"Helper",
"function"
] | [
"func",
"rcodezeroChangesByZone",
"(",
"zones",
"[",
"]",
"*",
"rc0",
".",
"Zone",
",",
"changeSet",
"[",
"]",
"*",
"rc0",
".",
"RRSetChange",
")",
"map",
"[",
"string",
"]",
"[",
"]",
"*",
"rc0",
".",
"RRSetChange",
"{",
"changes",
":=",
"make",
"(",
"map",
"[",
"string",
"]",
"[",
"]",
"*",
"rc0",
".",
"RRSetChange",
")",
"\n",
"zoneNameIDMapper",
":=",
"zoneIDName",
"{",
"}",
"\n",
"for",
"_",
",",
"z",
":=",
"range",
"zones",
"{",
"zoneNameIDMapper",
".",
"Add",
"(",
"z",
".",
"Domain",
",",
"z",
".",
"Domain",
")",
"\n",
"changes",
"[",
"z",
".",
"Domain",
"]",
"=",
"[",
"]",
"*",
"rc0",
".",
"RRSetChange",
"{",
"}",
"\n",
"}",
"\n\n",
"for",
"_",
",",
"c",
":=",
"range",
"changeSet",
"{",
"zone",
",",
"_",
":=",
"zoneNameIDMapper",
".",
"FindZone",
"(",
"c",
".",
"Name",
")",
"\n",
"if",
"zone",
"==",
"\"",
"\"",
"{",
"log",
".",
"Debugf",
"(",
"\"",
"\"",
",",
"c",
".",
"Name",
")",
"\n",
"continue",
"\n",
"}",
"\n",
"<mask>",
"[",
"zone",
"]",
"=",
"append",
"(",
"changes",
"[",
"zone",
"]",
",",
"c",
")",
"\n",
"}",
"\n\n",
"return",
"changes",
"\n",
"}"
] |
4,090 | all-4091 | [
"SetLevel",
"sets",
"the",
"log",
"level",
"for",
"the",
"given",
"module",
"."
] | [
"func",
"(",
"l",
"*",
"moduleLeveled",
")",
"SetLevel",
"(",
"level",
"Level",
",",
"module",
"string",
")",
"{",
"l",
".",
"levels",
"[",
"module",
"]",
"=",
"<mask>",
"\n",
"}"
] |
4,091 | all-4092 | [
"MarshalJSON",
"supports",
"json",
".",
"Marshaler",
"interface"
] | [
"func",
"(",
"v",
"SetShowHitTestBordersParams",
")",
"MarshalJSON",
"(",
")",
"(",
"[",
"]",
"<mask>",
",",
"error",
")",
"{",
"w",
":=",
"jwriter",
".",
"Writer",
"{",
"}",
"\n",
"easyjsonC5a4559bEncodeGithubComChromedpCdprotoOverlay3",
"(",
"&",
"w",
",",
"v",
")",
"\n",
"return",
"w",
".",
"Buffer",
".",
"BuildBytes",
"(",
")",
",",
"w",
".",
"Error",
"\n",
"}"
] |
4,092 | all-4093 | [
"ListIssueEvents",
"returns",
"issue",
"events"
] | [
"func",
"(",
"f",
"*",
"FakeClient",
")",
"ListIssueEvents",
"(",
"<mask>",
",",
"repo",
"string",
",",
"number",
"int",
")",
"(",
"[",
"]",
"github",
".",
"ListedIssueEvent",
",",
"error",
")",
"{",
"return",
"append",
"(",
"[",
"]",
"github",
".",
"ListedIssueEvent",
"{",
"}",
",",
"f",
".",
"IssueEvents",
"[",
"number",
"]",
"...",
")",
",",
"nil",
"\n",
"}"
] |
4,093 | all-4094 | [
"ReceiveComment",
"calls",
"plugin",
".",
"ReceiveComment",
"()",
"if",
"the",
"author",
"is",
"not",
"filtered"
] | [
"func",
"(",
"a",
"*",
"AuthorFilterPluginWrapper",
")",
"ReceiveComment",
"(",
"comment",
"sql",
".",
"Comment",
")",
"[",
"]",
"Point",
"{",
"if",
"a",
".",
"<mask>",
"(",
"comment",
".",
"User",
")",
"{",
"return",
"nil",
"\n",
"}",
"\n",
"return",
"a",
".",
"plugin",
".",
"ReceiveComment",
"(",
"comment",
")",
"\n",
"}"
] |
4,094 | all-4095 | [
"Write",
"writes",
"the",
"configuration",
"in",
"c",
"to",
"this",
"machine",
"s",
"Pachyderm",
"config",
"file",
"."
] | [
"func",
"(",
"c",
"*",
"Config",
")",
"Write",
"(",
")",
"error",
"{",
"rawConfig",
",",
"err",
":=",
"json",
".",
"MarshalIndent",
"(",
"c",
",",
"\"",
"\"",
",",
"\"",
"\"",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"// If we're not using a custom config path, create the default config path",
"p",
":=",
"configPath",
"(",
")",
"\n",
"if",
"_",
",",
"ok",
":=",
"os",
".",
"LookupEnv",
"(",
"configEnvVar",
")",
";",
"ok",
"{",
"// using overridden config path -- just make sure the parent dir exists",
"d",
":=",
"filepath",
".",
"Dir",
"(",
"p",
")",
"\n",
"if",
"_",
",",
"err",
":=",
"os",
".",
"Stat",
"(",
"d",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"p",
",",
"err",
")",
"\n",
"}",
"\n",
"}",
"else",
"{",
"// using the default config path, create the config directory",
"err",
"=",
"<mask>",
".",
"MkdirAll",
"(",
"defaultConfigDir",
",",
"0755",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"ioutil",
".",
"WriteFile",
"(",
"p",
",",
"rawConfig",
",",
"0644",
")",
"\n",
"}"
] |
4,095 | all-4096 | [
"ParseURL",
"parses",
"a",
"MongoDB",
"URL",
"as",
"accepted",
"by",
"the",
"Dial",
"function",
"and",
"returns",
"a",
"value",
"suitable",
"for",
"providing",
"into",
"DialWithInfo",
".",
"See",
"Dial",
"for",
"more",
"details",
"on",
"the",
"format",
"of",
"url",
"."
] | [
"func",
"ParseURL",
"(",
"url",
"string",
")",
"(",
"*",
"DialInfo",
",",
"error",
")",
"{",
"uinfo",
",",
"err",
":=",
"extractURL",
"(",
"url",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"direct",
":=",
"false",
"\n",
"mechanism",
":=",
"\"",
"\"",
"\n",
"service",
":=",
"\"",
"\"",
"\n",
"source",
":=",
"\"",
"\"",
"\n",
"setName",
":=",
"\"",
"\"",
"\n",
"poolLimit",
":=",
"0",
"\n",
"for",
"k",
",",
"v",
":=",
"range",
"uinfo",
".",
"options",
"{",
"switch",
"k",
"{",
"case",
"\"",
"\"",
":",
"source",
"=",
"v",
"\n",
"case",
"\"",
"\"",
":",
"mechanism",
"=",
"v",
"\n",
"case",
"\"",
"\"",
":",
"service",
"=",
"v",
"\n",
"case",
"\"",
"\"",
":",
"setName",
"=",
"v",
"\n",
"case",
"\"",
"\"",
":",
"poolLimit",
",",
"err",
"=",
"strconv",
".",
"Atoi",
"(",
"v",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"errors",
".",
"New",
"(",
"\"",
"\"",
"+",
"v",
")",
"\n",
"}",
"\n",
"case",
"\"",
"\"",
":",
"if",
"v",
"==",
"\"",
"\"",
"{",
"direct",
"=",
"true",
"\n",
"break",
"\n",
"}",
"\n",
"if",
"v",
"==",
"\"",
"\"",
"{",
"break",
"\n",
"}",
"\n",
"fallthrough",
"\n",
"default",
":",
"return",
"nil",
",",
"errors",
".",
"New",
"(",
"\"",
"\"",
"+",
"k",
"+",
"\"",
"\"",
"+",
"v",
")",
"\n",
"}",
"\n",
"}",
"\n",
"info",
":=",
"DialInfo",
"{",
"Addrs",
":",
"uinfo",
".",
"addrs",
",",
"Direct",
":",
"direct",
",",
"Database",
":",
"uinfo",
".",
"db",
",",
"Username",
":",
"uinfo",
".",
"user",
",",
"Password",
":",
"uinfo",
".",
"pass",
",",
"Mechanism",
":",
"mechanism",
",",
"Service",
":",
"service",
",",
"Source",
":",
"<mask>",
",",
"PoolLimit",
":",
"poolLimit",
",",
"ReplicaSetName",
":",
"setName",
",",
"}",
"\n",
"return",
"&",
"info",
",",
"nil",
"\n",
"}"
] |
4,096 | all-4097 | [
"newPolicyRequirementFromJSON",
"parses",
"JSON",
"data",
"into",
"a",
"PolicyRequirement",
"implementation",
"."
] | [
"func",
"newPolicyRequirementFromJSON",
"(",
"data",
"[",
"]",
"byte",
")",
"(",
"PolicyRequirement",
",",
"error",
")",
"{",
"var",
"typeField",
"prCommon",
"\n",
"if",
"err",
":=",
"json",
".",
"Unmarshal",
"(",
"data",
",",
"&",
"typeField",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"var",
"res",
"PolicyRequirement",
"\n",
"switch",
"typeField",
".",
"Type",
"{",
"case",
"prTypeInsecureAcceptAnything",
":",
"res",
"=",
"&",
"prInsecureAcceptAnything",
"{",
"}",
"\n",
"case",
"prTypeReject",
":",
"res",
"=",
"&",
"prReject",
"{",
"}",
"\n",
"case",
"prTypeSignedBy",
":",
"res",
"=",
"&",
"prSignedBy",
"{",
"}",
"\n",
"case",
"prTypeSignedBaseLayer",
":",
"res",
"=",
"&",
"prSignedBaseLayer",
"{",
"}",
"\n",
"<mask>",
":",
"return",
"nil",
",",
"InvalidPolicyFormatError",
"(",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\\\"",
"\\\"",
"\"",
",",
"typeField",
".",
"Type",
")",
")",
"\n",
"}",
"\n",
"if",
"err",
":=",
"json",
".",
"Unmarshal",
"(",
"data",
",",
"&",
"res",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"return",
"res",
",",
"nil",
"\n",
"}"
] |
4,097 | all-4098 | [
"needDemux",
"returns",
"whether",
"there",
"are",
"any",
"external",
"plugins",
"that",
"need",
"to",
"get",
"the",
"present",
"event",
"."
] | [
"func",
"(",
"s",
"*",
"Server",
")",
"needDemux",
"(",
"eventType",
",",
"srcRepo",
"string",
")",
"[",
"]",
"plugins",
".",
"ExternalPlugin",
"{",
"var",
"matching",
"[",
"]",
"plugins",
".",
"ExternalPlugin",
"\n",
"srcOrg",
":=",
"strings",
".",
"Split",
"(",
"srcRepo",
",",
"\"",
"\"",
")",
"[",
"0",
"]",
"\n\n",
"for",
"repo",
",",
"plugins",
":=",
"range",
"s",
".",
"Plugins",
".",
"Config",
"(",
")",
".",
"ExternalPlugins",
"{",
"// Make sure the repositories match",
"if",
"repo",
"!=",
"srcRepo",
"&&",
"repo",
"!=",
"srcOrg",
"{",
"continue",
"\n",
"}",
"\n\n",
"// Make sure the events match",
"for",
"_",
",",
"p",
":=",
"range",
"plugins",
"{",
"if",
"len",
"(",
"p",
".",
"Events",
")",
"==",
"0",
"{",
"matching",
"=",
"<mask>",
"(",
"matching",
",",
"p",
")",
"\n",
"}",
"else",
"{",
"for",
"_",
",",
"et",
":=",
"range",
"p",
".",
"Events",
"{",
"if",
"et",
"!=",
"eventType",
"{",
"continue",
"\n",
"}",
"\n",
"matching",
"=",
"append",
"(",
"matching",
",",
"p",
")",
"\n",
"break",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"matching",
"\n",
"}"
] |
4,098 | all-4099 | [
"change",
"an",
"active",
"shader",
"storage",
"block",
"binding"
] | [
"func",
"ShaderStorageBlockBinding",
"(",
"<mask>",
"uint32",
",",
"storageBlockIndex",
"uint32",
",",
"storageBlockBinding",
"uint32",
")",
"{",
"C",
".",
"glowShaderStorageBlockBinding",
"(",
"gpShaderStorageBlockBinding",
",",
"(",
"C",
".",
"GLuint",
")",
"(",
"program",
")",
",",
"(",
"C",
".",
"GLuint",
")",
"(",
"storageBlockIndex",
")",
",",
"(",
"C",
".",
"GLuint",
")",
"(",
"storageBlockBinding",
")",
")",
"\n",
"}"
] |
4,099 | all-4100 | [
"ReplaceRegion",
"copies",
"a",
"block",
"of",
"pixels",
"from",
"the",
"caller",
"s",
"pointer",
"into",
"the",
"storage",
"allocation",
"for",
"slice",
"0",
"of",
"a",
"texture",
".",
"Reference",
":",
"https",
":",
"//",
"developer",
".",
"apple",
".",
"com",
"/",
"documentation",
"/",
"metal",
"/",
"mtltexture",
"/",
"1515464",
"-",
"replaceregion"
] | [
"func",
"(",
"t",
"Texture",
")",
"ReplaceRegion",
"(",
"region",
"Region",
",",
"level",
"int",
",",
"pixelBytes",
"unsafe",
".",
"Pointer",
",",
"bytesPerRow",
"int",
")",
"{",
"r",
":=",
"region",
".",
"c",
"(",
")",
"\n",
"C",
".",
"Texture_ReplaceRegion",
"(",
"t",
".",
"texture",
",",
"r",
",",
"C",
".",
"uint_t",
"(",
"<mask>",
")",
",",
"pixelBytes",
",",
"C",
".",
"uint_t",
"(",
"bytesPerRow",
")",
")",
"\n",
"}"
] |
Subsets and Splits
No saved queries yet
Save your SQL queries to embed, download, and access them later. Queries will appear here once saved.