id
int32 0
25.3k
| idx
stringlengths 5
9
| nl_tokens
sequencelengths 1
418
| pl_tokens
sequencelengths 22
4.98k
|
---|---|---|---|
14,300 | all-14301 | [
"GetValueOk",
"returns",
"a",
"tuple",
"with",
"the",
"Value",
"field",
"if",
"it",
"s",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"and",
"a",
"boolean",
"to",
"check",
"if",
"the",
"value",
"has",
"been",
"set",
"."
] | [
"func",
"(",
"d",
"*",
"DashboardConditionalFormat",
")",
"GetValueOk",
"(",
")",
"(",
"json",
".",
"Number",
",",
"bool",
")",
"{",
"if",
"d",
"==",
"nil",
"||",
"d",
".",
"<mask>",
"==",
"nil",
"{",
"return",
"\"",
"\"",
",",
"false",
"\n",
"}",
"\n",
"return",
"*",
"d",
".",
"Value",
",",
"true",
"\n",
"}"
] |
14,301 | all-14302 | [
"DecodeData",
"decodes",
"a",
"raw",
"message",
"into",
"its",
"type",
".",
"E",
".",
"g",
".",
"An",
"ACS",
"message",
"of",
"the",
"form",
"{",
"type",
":",
"FooMessage",
"message",
":",
"{",
"foo",
":",
"1",
"}}",
"will",
"be",
"decoded",
"into",
"the",
"corresponding",
"*",
"ecsacs",
".",
"FooMessage",
"type",
".",
"The",
"type",
"string",
"FooMessage",
"will",
"also",
"be",
"returned",
"as",
"a",
"convenience",
"."
] | [
"func",
"DecodeData",
"(",
"data",
"[",
"]",
"byte",
",",
"dec",
"TypeDecoder",
")",
"(",
"interface",
"{",
"}",
",",
"string",
",",
"error",
")",
"{",
"<mask>",
":=",
"&",
"ReceivedMessage",
"{",
"}",
"\n",
"// Delay unmarshal until we know the type",
"err",
":=",
"json",
".",
"Unmarshal",
"(",
"data",
",",
"raw",
")",
"\n",
"if",
"err",
"!=",
"nil",
"||",
"raw",
".",
"Type",
"==",
"\"",
"\"",
"{",
"// Unframed messages can be of the {\"Type\":\"Message\"} form as well, try",
"// that.",
"connErr",
",",
"connErrType",
",",
"decodeErr",
":=",
"DecodeConnectionError",
"(",
"data",
",",
"dec",
")",
"\n",
"if",
"decodeErr",
"==",
"nil",
"&&",
"connErrType",
"!=",
"\"",
"\"",
"{",
"return",
"connErr",
",",
"connErrType",
",",
"nil",
"\n",
"}",
"\n",
"return",
"nil",
",",
"\"",
"\"",
",",
"decodeErr",
"\n",
"}",
"\n\n",
"reqMessage",
",",
"ok",
":=",
"dec",
".",
"NewOfType",
"(",
"raw",
".",
"Type",
")",
"\n",
"if",
"!",
"ok",
"{",
"return",
"nil",
",",
"raw",
".",
"Type",
",",
"&",
"UnrecognizedWSRequestType",
"{",
"raw",
".",
"Type",
"}",
"\n",
"}",
"\n",
"err",
"=",
"jsonutil",
".",
"UnmarshalJSON",
"(",
"reqMessage",
",",
"bytes",
".",
"NewReader",
"(",
"raw",
".",
"Message",
")",
")",
"\n",
"return",
"reqMessage",
",",
"raw",
".",
"Type",
",",
"err",
"\n",
"}"
] |
14,302 | all-14303 | [
"GetVizType",
"returns",
"the",
"VizType",
"field",
"if",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"."
] | [
"func",
"(",
"a",
"*",
"AlertGraphDefinition",
")",
"GetVizType",
"(",
")",
"<mask>",
"{",
"if",
"a",
"==",
"nil",
"||",
"a",
".",
"VizType",
"==",
"nil",
"{",
"return",
"\"",
"\"",
"\n",
"}",
"\n",
"return",
"*",
"a",
".",
"VizType",
"\n",
"}"
] |
14,303 | all-14304 | [
"Prefetch",
"sets",
"the",
"point",
"at",
"which",
"the",
"next",
"batch",
"of",
"results",
"will",
"be",
"requested",
".",
"When",
"there",
"are",
"p",
"*",
"batch_size",
"remaining",
"documents",
"cached",
"in",
"an",
"Iter",
"the",
"next",
"batch",
"will",
"be",
"requested",
"in",
"background",
".",
"For",
"instance",
"when",
"using",
"this",
":",
"query",
".",
"Batch",
"(",
"200",
")",
".",
"Prefetch",
"(",
"0",
".",
"25",
")",
"and",
"there",
"are",
"only",
"50",
"documents",
"cached",
"in",
"the",
"Iter",
"to",
"be",
"processed",
"the",
"next",
"batch",
"of",
"200",
"will",
"be",
"requested",
".",
"It",
"s",
"possible",
"to",
"change",
"this",
"setting",
"on",
"a",
"per",
"-",
"session",
"basis",
"as",
"well",
"using",
"the",
"SetPrefetch",
"method",
"of",
"Session",
".",
"The",
"default",
"prefetch",
"value",
"is",
"0",
".",
"25",
"."
] | [
"func",
"(",
"q",
"*",
"<mask>",
")",
"Prefetch",
"(",
"p",
"float64",
")",
"*",
"Query",
"{",
"q",
".",
"m",
".",
"Lock",
"(",
")",
"\n",
"q",
".",
"prefetch",
"=",
"p",
"\n",
"q",
".",
"m",
".",
"Unlock",
"(",
")",
"\n",
"return",
"q",
"\n",
"}"
] |
14,304 | all-14305 | [
"GetRepoLabels",
"gets",
"all",
"the",
"labels",
"that",
"valid",
"in",
"the",
"specified",
"repo",
"."
] | [
"func",
"(",
"c",
"*",
"Client",
")",
"GetRepoLabels",
"(",
"org",
",",
"repo",
"string",
")",
"(",
"[",
"]",
"*",
"github",
".",
"Label",
",",
"error",
")",
"{",
"opts",
":=",
"&",
"github",
".",
"ListOptions",
"{",
"}",
"\n",
"labels",
",",
"err",
":=",
"c",
".",
"depaginate",
"(",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"org",
",",
"repo",
")",
",",
"opts",
",",
"func",
"(",
")",
"(",
"[",
"]",
"interface",
"{",
"}",
",",
"*",
"github",
".",
"Response",
",",
"error",
")",
"{",
"page",
",",
"resp",
",",
"err",
":=",
"c",
".",
"issueService",
".",
"ListLabels",
"(",
"context",
".",
"Background",
"(",
")",
",",
"org",
",",
"repo",
",",
"opts",
")",
"\n\n",
"var",
"interfaceList",
"[",
"]",
"interface",
"{",
"}",
"\n",
"if",
"err",
"==",
"nil",
"{",
"interfaceList",
"=",
"make",
"(",
"[",
"]",
"interface",
"{",
"}",
",",
"0",
",",
"len",
"(",
"page",
")",
")",
"\n",
"for",
"_",
",",
"label",
":=",
"range",
"page",
"{",
"interfaceList",
"=",
"append",
"(",
"interfaceList",
",",
"label",
")",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"interfaceList",
",",
"resp",
",",
"err",
"\n",
"}",
",",
")",
"\n\n",
"result",
":=",
"make",
"(",
"[",
"]",
"*",
"github",
".",
"Label",
",",
"0",
",",
"len",
"(",
"labels",
")",
")",
"\n",
"for",
"_",
",",
"label",
":=",
"range",
"labels",
"{",
"result",
"=",
"append",
"(",
"result",
",",
"label",
".",
"(",
"*",
"github",
".",
"Label",
")",
")",
"\n",
"}",
"\n",
"return",
"<mask>",
",",
"err",
"\n",
"}"
] |
14,305 | all-14306 | [
"InnerText",
"gets",
"the",
"raw",
"string",
"representation",
"of",
"the",
"block",
"s",
"contents",
"."
] | [
"func",
"(",
"bs",
"*",
"BlockStatement",
")",
"InnerText",
"(",
")",
"string",
"{",
"<mask>",
"out",
"bytes",
".",
"Buffer",
"\n",
"for",
"_",
",",
"s",
":=",
"range",
"bs",
".",
"Statements",
"{",
"out",
".",
"WriteString",
"(",
"s",
".",
"String",
"(",
")",
")",
"\n",
"}",
"\n",
"return",
"out",
".",
"String",
"(",
")",
"\n",
"}"
] |
14,306 | all-14307 | [
"SetScreenSize",
"changes",
"the",
"(",
"logical",
")",
"size",
"of",
"the",
"screen",
".",
"This",
"doesn",
"t",
"affect",
"the",
"current",
"scale",
"of",
"the",
"screen",
".",
"Unit",
"is",
"device",
"-",
"independent",
"pixel",
".",
"SetScreenSize",
"is",
"concurrent",
"-",
"safe",
"."
] | [
"func",
"SetScreenSize",
"(",
"width",
",",
"height",
"int",
")",
"{",
"if",
"<mask>",
"<=",
"0",
"||",
"height",
"<=",
"0",
"{",
"panic",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"uiDriver",
"(",
")",
".",
"SetScreenSize",
"(",
"width",
",",
"height",
")",
"\n",
"}"
] |
14,307 | all-14308 | [
"Value",
"implements",
"the",
"database",
"/",
"sql",
"/",
"driver",
"Valuer",
"interface",
"."
] | [
"func",
"(",
"rat",
"Rat",
")",
"Value",
"(",
")",
"(",
"<mask>",
".",
"Value",
",",
"error",
")",
"{",
"return",
"rat",
".",
"FloatString",
"(",
"decimalScale",
")",
",",
"nil",
"\n",
"}"
] |
14,308 | all-14309 | [
"Deinit",
"switches",
"the",
"terminal",
"back",
"to",
"cooked",
"mode",
"and",
"it",
"terminates",
"managed",
"window",
"mode",
".",
"Init",
"must",
"be",
"called",
"again",
"if",
"a",
"switch",
"is",
"required",
"again",
".",
"Deinit",
"shall",
"be",
"called",
"on",
"application",
"exit",
";",
"failing",
"to",
"do",
"so",
"may",
"leave",
"the",
"terminal",
"corrupted",
".",
"If",
"that",
"does",
"happen",
"typing",
"reset",
"on",
"the",
"shell",
"usually",
"fixes",
"this",
"problem",
"."
] | [
"func",
"Deinit",
"(",
")",
"{",
"wait",
":=",
"make",
"(",
"chan",
"<mask>",
"{",
"}",
")",
"\n",
"Queue",
"(",
"func",
"(",
")",
"{",
"termbox",
".",
"Close",
"(",
")",
"\n",
"focus",
"=",
"nil",
"\n",
"prevFocus",
"=",
"nil",
"\n",
"windows",
"=",
"make",
"(",
"map",
"[",
"int",
"]",
"*",
"Window",
")",
"// toss all windows",
"\n\n",
"rawMtx",
".",
"Lock",
"(",
")",
"\n",
"termRaw",
"=",
"false",
"\n",
"rawMtx",
".",
"Unlock",
"(",
")",
"\n\n",
"wait",
"<-",
"true",
"\n",
"}",
")",
"\n",
"<-",
"wait",
"\n",
"}"
] |
14,309 | all-14310 | [
"ReadObjects",
"gets",
"several",
"objects",
"by",
"hash",
"and",
"returns",
"them",
"directly",
"as",
"[]",
"byte",
"."
] | [
"func",
"(",
"c",
"APIClient",
")",
"ReadObjects",
"(",
"hashes",
"[",
"]",
"string",
",",
"offset",
"uint64",
",",
"size",
"uint64",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"<mask>",
"buffer",
"bytes",
".",
"Buffer",
"\n",
"if",
"err",
":=",
"c",
".",
"GetObjects",
"(",
"hashes",
",",
"offset",
",",
"size",
",",
"0",
",",
"&",
"buffer",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"return",
"buffer",
".",
"Bytes",
"(",
")",
",",
"nil",
"\n",
"}"
] |
14,310 | all-14311 | [
"MustCreated",
"retrieves",
"the",
"Created",
"value",
"from",
"the",
"union",
"panicing",
"if",
"the",
"value",
"is",
"not",
"set",
"."
] | [
"func",
"(",
"u",
"LedgerEntryChange",
")",
"MustCreated",
"(",
")",
"LedgerEntry",
"{",
"val",
",",
"ok",
":=",
"u",
".",
"GetCreated",
"(",
")",
"\n\n",
"if",
"!",
"<mask>",
"{",
"panic",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"return",
"val",
"\n",
"}"
] |
14,311 | all-14312 | [
"SetAddr",
"sets",
"the",
"servers",
"address",
"if",
"it",
"hasn",
"t",
"already",
"been",
"set"
] | [
"func",
"(",
"s",
"*",
"Simple",
")",
"SetAddr",
"(",
"addr",
"string",
")",
"{",
"if",
"s",
".",
"<mask>",
".",
"Addr",
"==",
"\"",
"\"",
"{",
"s",
".",
"Server",
".",
"Addr",
"=",
"addr",
"\n",
"}",
"\n",
"}"
] |
14,312 | all-14313 | [
"Lists",
"all",
"GCS",
"keys",
"with",
"given",
"prefix",
"."
] | [
"func",
"(",
"bucket",
"gcsBucket",
")",
"listAll",
"(",
"prefix",
"string",
")",
"(",
"[",
"]",
"string",
",",
"error",
")",
"{",
"<mask>",
":=",
"[",
"]",
"string",
"{",
"}",
"\n",
"it",
":=",
"bucket",
".",
"Objects",
"(",
"context",
".",
"Background",
"(",
")",
",",
"&",
"storage",
".",
"Query",
"{",
"Prefix",
":",
"prefix",
",",
"}",
")",
"\n",
"for",
"{",
"attrs",
",",
"err",
":=",
"it",
".",
"Next",
"(",
")",
"\n",
"if",
"err",
"==",
"iterator",
".",
"Done",
"{",
"break",
"\n",
"}",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"keys",
",",
"err",
"\n",
"}",
"\n",
"keys",
"=",
"append",
"(",
"keys",
",",
"attrs",
".",
"Name",
")",
"\n",
"}",
"\n",
"return",
"keys",
",",
"nil",
"\n",
"}"
] |
14,313 | all-14314 | [
"MarshalJSON",
"supports",
"json",
".",
"Marshaler",
"interface"
] | [
"func",
"(",
"v",
"Page",
")",
"MarshalJSON",
"(",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"w",
":=",
"jwriter",
".",
"Writer",
"{",
"}",
"\n",
"easyjsonC5a4559bEncodeGithubComChromedpCdprotoHar6",
"(",
"&",
"w",
",",
"v",
")",
"\n",
"return",
"w",
".",
"Buffer",
".",
"BuildBytes",
"(",
")",
",",
"w",
".",
"<mask>",
"\n",
"}"
] |
14,314 | all-14315 | [
"truncate",
"converts",
"really",
"long",
"messages",
"into",
"really",
"...",
"messages",
"."
] | [
"func",
"truncate",
"(",
"in",
"string",
")",
"string",
"{",
"const",
"(",
"half",
"=",
"(",
"maxLen",
"-",
"len",
"(",
"elide",
")",
")",
"/",
"2",
"\n",
")",
"\n",
"if",
"len",
"(",
"in",
")",
"<=",
"maxLen",
"{",
"return",
"in",
"\n",
"}",
"\n",
"return",
"<mask>",
"[",
":",
"half",
"]",
"+",
"elide",
"+",
"in",
"[",
"len",
"(",
"in",
")",
"-",
"half",
":",
"]",
"\n",
"}"
] |
14,315 | all-14316 | [
"Pipe",
"prepares",
"a",
"pipeline",
"to",
"aggregate",
".",
"The",
"pipeline",
"document",
"must",
"be",
"a",
"slice",
"built",
"in",
"terms",
"of",
"the",
"aggregation",
"framework",
"language",
".",
"For",
"example",
":",
"pipe",
":",
"=",
"collection",
".",
"Pipe",
"(",
"[]",
"bson",
".",
"M",
"{{",
"$match",
":",
"bson",
".",
"M",
"{",
"name",
":",
"Otavio",
"}}}",
")",
"iter",
":",
"=",
"pipe",
".",
"Iter",
"()",
"Relevant",
"documentation",
":",
"http",
":",
"//",
"docs",
".",
"mongodb",
".",
"org",
"/",
"manual",
"/",
"reference",
"/",
"aggregation",
"http",
":",
"//",
"docs",
".",
"mongodb",
".",
"org",
"/",
"manual",
"/",
"applications",
"/",
"aggregation",
"http",
":",
"//",
"docs",
".",
"mongodb",
".",
"org",
"/",
"manual",
"/",
"tutorial",
"/",
"aggregation",
"-",
"examples"
] | [
"func",
"(",
"c",
"*",
"Collection",
")",
"Pipe",
"(",
"pipeline",
"interface",
"{",
"}",
")",
"*",
"Pipe",
"{",
"session",
":=",
"c",
".",
"Database",
".",
"Session",
"\n",
"session",
".",
"m",
".",
"RLock",
"(",
")",
"\n",
"batchSize",
":=",
"int",
"(",
"session",
".",
"queryConfig",
".",
"op",
".",
"<mask>",
")",
"\n",
"session",
".",
"m",
".",
"RUnlock",
"(",
")",
"\n",
"return",
"&",
"Pipe",
"{",
"session",
":",
"session",
",",
"collection",
":",
"c",
",",
"pipeline",
":",
"pipeline",
",",
"batchSize",
":",
"batchSize",
",",
"}",
"\n",
"}"
] |
14,316 | all-14317 | [
"/",
"*",
"RFC",
"7208",
":"
] | [
"func",
"(",
"s",
"*",
"SPF",
")",
"incDNSLookupCount",
"(",
"amt",
"int",
")",
"error",
"{",
"s",
".",
"dnsLookupCount",
"=",
"s",
".",
"dnsLookupCount",
"+",
"amt",
"\n",
"if",
"s",
".",
"dnsLookupCount",
">",
"DNSLookupLimit",
"{",
"return",
"&",
"PermError",
"{",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"s",
".",
"<mask>",
",",
"DNSLookupLimit",
")",
"}",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
] |
14,317 | all-14318 | [
"title",
":",
"saml",
"metadata",
"path",
":",
"/",
"auth",
"/",
"saml",
"method",
":",
"GET",
"produce",
":",
"application",
"/",
"xml",
"responses",
":",
"200",
":",
"Ok",
"400",
":",
"Invalid",
"data"
] | [
"func",
"samlMetadata",
"(",
"w",
"http",
".",
"ResponseWriter",
",",
"r",
"*",
"http",
".",
"Request",
")",
"error",
"{",
"if",
"app",
".",
"AuthScheme",
".",
"Name",
"(",
")",
"!=",
"\"",
"\"",
"{",
"return",
"&",
"errors",
".",
"HTTP",
"{",
"Code",
":",
"http",
".",
"StatusBadRequest",
",",
"Message",
":",
"\"",
"\"",
",",
"}",
"\n",
"}",
"\n",
"page",
",",
"err",
":=",
"saml",
".",
"Metadata",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"w",
".",
"<mask>",
"(",
")",
".",
"Set",
"(",
"\"",
"\"",
",",
"\"",
"\"",
")",
"\n",
"w",
".",
"Write",
"(",
"[",
"]",
"byte",
"(",
"page",
")",
")",
"\n",
"return",
"nil",
"\n",
"}"
] |
14,318 | all-14319 | [
"Check",
"if",
"CRIU",
"supports",
"pre",
"-",
"dumping",
"and",
"number",
"of",
"pre",
"-",
"dump",
"iterations"
] | [
"func",
"(",
"s",
"*",
"migrationSourceWs",
")",
"checkForPreDumpSupport",
"(",
")",
"(",
"bool",
",",
"int",
")",
"{",
"// Ask CRIU if this architecture/kernel/criu combination",
"// supports pre-copy (dirty memory tracking)",
"criuMigrationArgs",
":=",
"CriuMigrationArgs",
"{",
"cmd",
":",
"lxc",
".",
"MIGRATE_FEATURE_CHECK",
",",
"stateDir",
":",
"\"",
"\"",
",",
"function",
":",
"\"",
"\"",
",",
"stop",
":",
"false",
",",
"actionScript",
":",
"false",
",",
"dumpDir",
":",
"\"",
"\"",
",",
"preDumpDir",
":",
"\"",
"\"",
",",
"features",
":",
"lxc",
".",
"FEATURE_MEM_TRACK",
",",
"}",
"\n",
"err",
":=",
"s",
".",
"container",
".",
"Migrate",
"(",
"&",
"criuMigrationArgs",
")",
"\n\n",
"if",
"err",
"!=",
"nil",
"{",
"// CRIU says it does not know about dirty memory tracking.",
"// This means the rest of this function is irrelevant.",
"return",
"<mask>",
",",
"0",
"\n",
"}",
"\n\n",
"// CRIU says it can actually do pre-dump. Let's set it to true",
"// unless the user wants something else.",
"use_pre_dumps",
":=",
"true",
"\n\n",
"// What does the configuration say about pre-copy",
"tmp",
":=",
"s",
".",
"container",
".",
"ExpandedConfig",
"(",
")",
"[",
"\"",
"\"",
"]",
"\n\n",
"if",
"tmp",
"!=",
"\"",
"\"",
"{",
"use_pre_dumps",
"=",
"shared",
".",
"IsTrue",
"(",
"tmp",
")",
"\n",
"}",
"\n\n",
"var",
"max_iterations",
"int",
"\n\n",
"// migration.incremental.memory.iterations is the value after which the",
"// container will be definitely migrated, even if the remaining number",
"// of memory pages is below the defined threshold.",
"tmp",
"=",
"s",
".",
"container",
".",
"ExpandedConfig",
"(",
")",
"[",
"\"",
"\"",
"]",
"\n",
"if",
"tmp",
"!=",
"\"",
"\"",
"{",
"max_iterations",
",",
"_",
"=",
"strconv",
".",
"Atoi",
"(",
"tmp",
")",
"\n",
"}",
"else",
"{",
"// default to 10",
"max_iterations",
"=",
"10",
"\n",
"}",
"\n",
"if",
"max_iterations",
">",
"999",
"{",
"// the pre-dump directory is hardcoded to a string",
"// with maximal 3 digits. 999 pre-dumps makes no",
"// sense at all, but let's make sure the number",
"// is not higher than this.",
"max_iterations",
"=",
"999",
"\n",
"}",
"\n",
"logger",
".",
"Debugf",
"(",
"\"",
"\"",
",",
"max_iterations",
")",
"\n\n",
"return",
"use_pre_dumps",
",",
"max_iterations",
"\n",
"}"
] |
14,319 | all-14320 | [
"Make",
"returns",
"a",
"pointer",
"to",
"a",
"new",
"zero",
"initialized",
"model",
"e",
".",
"g",
".",
"*",
"Post",
".",
"Note",
":",
"Other",
"libraries",
"like",
"mgo",
"might",
"replace",
"the",
"pointer",
"content",
"with",
"a",
"new",
"structure",
"therefore",
"the",
"model",
"eventually",
"needs",
"to",
"be",
"initialized",
"again",
"using",
"Init",
"()",
"."
] | [
"func",
"(",
"m",
"*",
"Meta",
")",
"Make",
"(",
")",
"Model",
"{",
"pointer",
":=",
"reflect",
".",
"New",
"(",
"reflect",
".",
"TypeOf",
"(",
"m",
".",
"model",
")",
".",
"Elem",
"(",
")",
")",
".",
"Interface",
"(",
")",
"\n",
"return",
"Init",
"(",
"<mask>",
".",
"(",
"Model",
")",
")",
"\n",
"}"
] |
14,320 | all-14321 | [
"**************************************************************************************",
"\\",
"Array",
"allocation",
"deallocation",
"initialization",
"and",
"access",
"to",
"elements",
"*",
"\\",
"***************************************************************************************"
] | [
"func",
"Alloc",
"(",
"size",
"int",
")",
"unsafe",
".",
"Pointer",
"{",
"return",
"unsafe",
".",
"Pointer",
"(",
"C",
".",
"cvAlloc",
"(",
"C",
".",
"size_t",
"(",
"<mask>",
")",
")",
")",
"\n",
"}"
] |
14,321 | all-14322 | [
"SelectItem",
"makes",
"the",
"radio",
"selected",
".",
"The",
"function",
"returns",
"false",
"if",
"it",
"failed",
"to",
"find",
"the",
"radio",
"in",
"the",
"radio",
"group"
] | [
"func",
"(",
"c",
"*",
"RadioGroup",
")",
"SelectItem",
"(",
"r",
"*",
"Radio",
")",
"bool",
"{",
"found",
":=",
"false",
"\n\n",
"for",
"_",
",",
"item",
":=",
"range",
"c",
".",
"items",
"{",
"if",
"item",
"==",
"r",
"{",
"found",
"=",
"true",
"\n",
"<mask>",
".",
"SetSelected",
"(",
"true",
")",
"\n",
"}",
"else",
"{",
"item",
".",
"SetSelected",
"(",
"false",
")",
"\n",
"}",
"\n",
"}",
"\n\n",
"return",
"found",
"\n",
"}"
] |
14,322 | all-14323 | [
"NewMemberUpdateCommand",
"returns",
"the",
"cobra",
"command",
"for",
"member",
"update",
"."
] | [
"func",
"NewMemberUpdateCommand",
"(",
")",
"*",
"cobra",
".",
"Command",
"{",
"cc",
":=",
"&",
"cobra",
".",
"Command",
"{",
"Use",
":",
"\"",
"\"",
",",
"Short",
":",
"\"",
"\"",
",",
"Run",
":",
"memberUpdateCommandFunc",
",",
"}",
"\n\n",
"<mask>",
".",
"Flags",
"(",
")",
".",
"StringVar",
"(",
"&",
"memberPeerURLs",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
")",
"\n\n",
"return",
"cc",
"\n",
"}"
] |
14,323 | all-14324 | [
"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",
"(",
"s",
"*",
"ScatterplotDefinition",
")",
"GetTitleAlignOk",
"(",
")",
"(",
"string",
",",
"bool",
")",
"{",
"if",
"s",
"==",
"nil",
"||",
"s",
".",
"TitleAlign",
"==",
"nil",
"{",
"return",
"\"",
"\"",
",",
"false",
"\n",
"}",
"\n",
"return",
"*",
"s",
".",
"TitleAlign",
",",
"<mask>",
"\n",
"}"
] |
14,324 | all-14325 | [
"rowString",
"-",
"Creates",
"a",
"string",
"row",
"."
] | [
"func",
"(",
"t",
"*",
"Table",
")",
"rowString",
"(",
"row",
"<mask>",
"[",
"string",
"]",
"string",
")",
"string",
"{",
"s",
":=",
"\"",
"\"",
"\n",
"for",
"_",
",",
"name",
":=",
"range",
"t",
".",
"Fields",
"{",
"value",
":=",
"row",
"[",
"name",
"]",
"\n",
"s",
"+=",
"t",
".",
"fieldString",
"(",
"name",
",",
"value",
")",
"+",
"\"",
"\"",
"\n",
"}",
"\n",
"return",
"s",
"\n",
"}"
] |
14,325 | all-14326 | [
"HasFontSize",
"returns",
"a",
"boolean",
"if",
"a",
"field",
"has",
"been",
"set",
"."
] | [
"func",
"(",
"f",
"*",
"FreeTextDefinition",
")",
"HasFontSize",
"(",
")",
"bool",
"{",
"if",
"f",
"!=",
"nil",
"&&",
"f",
".",
"FontSize",
"!=",
"nil",
"{",
"return",
"true",
"\n",
"}",
"\n\n",
"return",
"<mask>",
"\n",
"}"
] |
14,326 | all-14327 | [
"GetLoadbalancer",
"pulls",
"data",
"for",
"the",
"Loadbalancer",
"where",
"id",
"=",
"lbalid",
"returns",
"a",
"Instance",
"struct"
] | [
"func",
"(",
"c",
"*",
"<mask>",
")",
"GetLoadbalancer",
"(",
"dcid",
",",
"lbalid",
"string",
")",
"(",
"*",
"Loadbalancer",
",",
"error",
")",
"{",
"url",
":=",
"lbalPath",
"(",
"dcid",
",",
"lbalid",
")",
"+",
"`?depth=`",
"+",
"c",
".",
"client",
".",
"depth",
"+",
"`&pretty=`",
"+",
"strconv",
".",
"FormatBool",
"(",
"c",
".",
"client",
".",
"pretty",
")",
"\n",
"ret",
":=",
"&",
"Loadbalancer",
"{",
"}",
"\n",
"err",
":=",
"c",
".",
"client",
".",
"Get",
"(",
"url",
",",
"ret",
",",
"http",
".",
"StatusOK",
")",
"\n",
"return",
"ret",
",",
"err",
"\n",
"}"
] |
14,327 | all-14328 | [
"WriteToRequest",
"writes",
"these",
"params",
"to",
"a",
"swagger",
"request"
] | [
"func",
"(",
"o",
"*",
"FindVmsByDeploymentParams",
")",
"WriteToRequest",
"(",
"r",
"runtime",
".",
"ClientRequest",
",",
"reg",
"strfmt",
".",
"Registry",
")",
"error",
"{",
"if",
"err",
":=",
"r",
".",
"SetTimeout",
"(",
"o",
".",
"timeout",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"<mask>",
"res",
"[",
"]",
"error",
"\n\n",
"valuesDeployment",
":=",
"o",
".",
"Deployment",
"\n\n",
"joinedDeployment",
":=",
"swag",
".",
"JoinByFormat",
"(",
"valuesDeployment",
",",
"\"",
"\"",
")",
"\n",
"// query array param deployment",
"if",
"err",
":=",
"r",
".",
"SetQueryParam",
"(",
"\"",
"\"",
",",
"joinedDeployment",
"...",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"if",
"len",
"(",
"res",
")",
">",
"0",
"{",
"return",
"errors",
".",
"CompositeValidationError",
"(",
"res",
"...",
")",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
] |
14,328 | all-14329 | [
"RowsPreviousLimit",
"creates",
"a",
"Rows",
"query",
"with",
"the",
"given",
"previous",
"row",
"ID",
"/",
"key",
"and",
"limit"
] | [
"func",
"(",
"f",
"*",
"Field",
")",
"RowsPreviousLimit",
"(",
"rowIDOrKey",
"interface",
"{",
"}",
",",
"limit",
"int64",
")",
"*",
"PQLRowsQuery",
"{",
"idKey",
",",
"err",
":=",
"formatIDKey",
"(",
"rowIDOrKey",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"NewPQLRowsQuery",
"(",
"\"",
"\"",
",",
"f",
".",
"index",
",",
"err",
")",
"\n",
"}",
"\n",
"if",
"<mask>",
"<",
"0",
"{",
"return",
"NewPQLRowsQuery",
"(",
"\"",
"\"",
",",
"f",
".",
"index",
",",
"errors",
".",
"New",
"(",
"\"",
"\"",
")",
")",
"\n",
"}",
"\n",
"text",
":=",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"f",
".",
"name",
",",
"idKey",
",",
"limit",
")",
"\n",
"return",
"NewPQLRowsQuery",
"(",
"text",
",",
"f",
".",
"index",
",",
"nil",
")",
"\n",
"}"
] |
14,329 | all-14330 | [
"Reset",
"restores",
"the",
"internal",
"state",
"of",
"the",
"logging",
"library",
"."
] | [
"func",
"Reset",
"(",
")",
"{",
"// TODO make a global Init() method to be less magic? or make it such that",
"// if there's no backends at all configured, we could use some tricks to",
"// automatically setup backends based if we have a TTY or not.",
"sequenceNo",
"=",
"0",
"\n",
"b",
":=",
"SetBackend",
"(",
"NewLogBackend",
"(",
"<mask>",
".",
"Stderr",
",",
"\"",
"\"",
",",
"log",
".",
"LstdFlags",
")",
")",
"\n",
"b",
".",
"SetLevel",
"(",
"DEBUG",
",",
"\"",
"\"",
")",
"\n",
"SetFormatter",
"(",
"DefaultFormatter",
")",
"\n",
"timeNow",
"=",
"time",
".",
"Now",
"\n",
"}"
] |
14,330 | all-14331 | [
"genOptionsODBC",
"is",
"a",
"util",
"wrapper",
"around",
"genOptions",
"that",
"uses",
"the",
"fixed",
"settings",
"for",
"ODBC",
"style",
"connection",
"strings",
"."
] | [
"func",
"genOptionsODBC",
"(",
"q",
"url",
".",
"Values",
",",
"skipWhenEmpty",
"bool",
",",
"ignore",
"...",
"string",
")",
"string",
"{",
"return",
"genOptions",
"(",
"q",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"skipWhenEmpty",
",",
"<mask>",
"...",
")",
"\n",
"}"
] |
14,331 | all-14332 | [
"title",
":",
"pool",
"create",
"path",
":",
"/",
"pools",
"method",
":",
"POST",
"consume",
":",
"application",
"/",
"x",
"-",
"www",
"-",
"form",
"-",
"urlencoded",
"responses",
":",
"201",
":",
"Pool",
"created",
"400",
":",
"Invalid",
"data",
"401",
":",
"Unauthorized",
"409",
":",
"Pool",
"already",
"exists"
] | [
"func",
"addPoolHandler",
"(",
"w",
"http",
".",
"ResponseWriter",
",",
"r",
"*",
"http",
".",
"Request",
",",
"t",
"auth",
".",
"Token",
")",
"(",
"err",
"error",
")",
"{",
"allowed",
":=",
"permission",
".",
"Check",
"(",
"t",
",",
"permission",
".",
"PermPoolCreate",
")",
"\n",
"if",
"!",
"allowed",
"{",
"return",
"permission",
".",
"ErrUnauthorized",
"\n",
"}",
"\n",
"<mask>",
"addOpts",
"pool",
".",
"AddPoolOptions",
"\n",
"err",
"=",
"ParseInput",
"(",
"r",
",",
"&",
"addOpts",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"if",
"addOpts",
".",
"Name",
"==",
"\"",
"\"",
"{",
"return",
"&",
"terrors",
".",
"HTTP",
"{",
"Code",
":",
"http",
".",
"StatusBadRequest",
",",
"Message",
":",
"pool",
".",
"ErrPoolNameIsRequired",
".",
"Error",
"(",
")",
",",
"}",
"\n",
"}",
"\n",
"evt",
",",
"err",
":=",
"event",
".",
"New",
"(",
"&",
"event",
".",
"Opts",
"{",
"Target",
":",
"event",
".",
"Target",
"{",
"Type",
":",
"event",
".",
"TargetTypePool",
",",
"Value",
":",
"addOpts",
".",
"Name",
"}",
",",
"Kind",
":",
"permission",
".",
"PermPoolCreate",
",",
"Owner",
":",
"t",
",",
"CustomData",
":",
"event",
".",
"FormToCustomData",
"(",
"InputFields",
"(",
"r",
")",
")",
",",
"Allowed",
":",
"event",
".",
"Allowed",
"(",
"permission",
".",
"PermPoolReadEvents",
",",
"permission",
".",
"Context",
"(",
"permTypes",
".",
"CtxPool",
",",
"addOpts",
".",
"Name",
")",
")",
",",
"}",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"defer",
"func",
"(",
")",
"{",
"evt",
".",
"Done",
"(",
"err",
")",
"}",
"(",
")",
"\n",
"err",
"=",
"pool",
".",
"AddPool",
"(",
"addOpts",
")",
"\n",
"if",
"err",
"==",
"pool",
".",
"ErrDefaultPoolAlreadyExists",
"||",
"err",
"==",
"pool",
".",
"ErrPoolAlreadyExists",
"{",
"return",
"&",
"terrors",
".",
"HTTP",
"{",
"Code",
":",
"http",
".",
"StatusConflict",
",",
"Message",
":",
"err",
".",
"Error",
"(",
")",
",",
"}",
"\n",
"}",
"\n",
"if",
"err",
"==",
"pool",
".",
"ErrPoolNameIsRequired",
"{",
"return",
"&",
"terrors",
".",
"HTTP",
"{",
"Code",
":",
"http",
".",
"StatusBadRequest",
",",
"Message",
":",
"err",
".",
"Error",
"(",
")",
",",
"}",
"\n",
"}",
"\n",
"if",
"err",
"==",
"nil",
"{",
"w",
".",
"WriteHeader",
"(",
"http",
".",
"StatusCreated",
")",
"\n",
"}",
"\n",
"return",
"err",
"\n",
"}"
] |
14,332 | all-14333 | [
"portGroupPortSchema",
"returns",
"a",
"sub",
"-",
"schema",
"for",
"a",
"port",
"group",
"s",
"connected",
"ports",
"."
] | [
"func",
"portGroupPortSchema",
"(",
")",
"*",
"schema",
".",
"Resource",
"{",
"return",
"&",
"schema",
".",
"Resource",
"{",
"Schema",
":",
"map",
"[",
"string",
"]",
"*",
"schema",
".",
"Schema",
"{",
"\"",
"\"",
":",
"{",
"Type",
":",
"schema",
".",
"TypeString",
",",
"Description",
":",
"\"",
"\"",
",",
"Computed",
":",
"true",
",",
"}",
",",
"\"",
"\"",
":",
"{",
"Type",
":",
"schema",
".",
"TypeList",
",",
"Description",
":",
"\"",
"\"",
",",
"Computed",
":",
"<mask>",
",",
"Elem",
":",
"&",
"schema",
".",
"Schema",
"{",
"Type",
":",
"schema",
".",
"TypeString",
"}",
",",
"}",
",",
"\"",
"\"",
":",
"{",
"Type",
":",
"schema",
".",
"TypeString",
",",
"Description",
":",
"\"",
"\"",
",",
"Computed",
":",
"true",
",",
"}",
",",
"}",
",",
"}",
"\n",
"}"
] |
14,333 | all-14334 | [
"title",
":",
"grant",
"access",
"to",
"service",
"instance",
"path",
":",
"/",
"services",
"/",
"{",
"service",
"}",
"/",
"instances",
"/",
"permission",
"/",
"{",
"instance",
"}",
"/",
"{",
"team",
"}",
"consume",
":",
"application",
"/",
"x",
"-",
"www",
"-",
"form",
"-",
"urlencoded",
"method",
":",
"PUT",
"responses",
":",
"200",
":",
"Access",
"granted",
"401",
":",
"Unauthorized",
"404",
":",
"Service",
"instance",
"not",
"found"
] | [
"func",
"serviceInstanceGrantTeam",
"(",
"w",
"http",
".",
"ResponseWriter",
",",
"r",
"*",
"http",
".",
"Request",
",",
"t",
"auth",
".",
"Token",
")",
"(",
"err",
"error",
")",
"{",
"instanceName",
":=",
"r",
".",
"URL",
".",
"Query",
"(",
")",
".",
"Get",
"(",
"\"",
"\"",
")",
"\n",
"serviceName",
":=",
"r",
".",
"URL",
".",
"<mask>",
"(",
")",
".",
"Get",
"(",
"\"",
"\"",
")",
"\n",
"serviceInstance",
",",
"err",
":=",
"getServiceInstanceOrError",
"(",
"serviceName",
",",
"instanceName",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"allowed",
":=",
"permission",
".",
"Check",
"(",
"t",
",",
"permission",
".",
"PermServiceInstanceUpdateGrant",
",",
"contextsForServiceInstance",
"(",
"serviceInstance",
",",
"serviceName",
")",
"...",
",",
")",
"\n",
"if",
"!",
"allowed",
"{",
"return",
"permission",
".",
"ErrUnauthorized",
"\n",
"}",
"\n",
"evt",
",",
"err",
":=",
"event",
".",
"New",
"(",
"&",
"event",
".",
"Opts",
"{",
"Target",
":",
"serviceInstanceTarget",
"(",
"serviceName",
",",
"instanceName",
")",
",",
"Kind",
":",
"permission",
".",
"PermServiceInstanceUpdateGrant",
",",
"Owner",
":",
"t",
",",
"CustomData",
":",
"event",
".",
"FormToCustomData",
"(",
"InputFields",
"(",
"r",
")",
")",
",",
"Allowed",
":",
"event",
".",
"Allowed",
"(",
"permission",
".",
"PermServiceInstanceReadEvents",
",",
"contextsForServiceInstance",
"(",
"serviceInstance",
",",
"serviceName",
")",
"...",
")",
",",
"}",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"defer",
"func",
"(",
")",
"{",
"evt",
".",
"Done",
"(",
"err",
")",
"}",
"(",
")",
"\n",
"teamName",
":=",
"r",
".",
"URL",
".",
"Query",
"(",
")",
".",
"Get",
"(",
"\"",
"\"",
")",
"\n",
"return",
"serviceInstance",
".",
"Grant",
"(",
"teamName",
")",
"\n",
"}"
] |
14,334 | all-14335 | [
"delete",
"transform",
"feedback",
"objects"
] | [
"func",
"DeleteTransformFeedbacks",
"(",
"n",
"int32",
",",
"ids",
"*",
"uint32",
")",
"{",
"syscall",
".",
"Syscall",
"(",
"gpDeleteTransformFeedbacks",
",",
"2",
",",
"uintptr",
"(",
"n",
")",
",",
"uintptr",
"(",
"unsafe",
".",
"Pointer",
"(",
"<mask>",
")",
")",
",",
"0",
")",
"\n",
"}"
] |
14,335 | all-14336 | [
"resizeAndRender",
"resizes",
"a",
"window",
"and",
"renders",
"it",
"."
] | [
"func",
"resizeAndRender",
"(",
"w",
"*",
"Window",
")",
"{",
"// render window",
"if",
"w",
"!=",
"nil",
"{",
"_",
"=",
"termbox",
".",
"Clear",
"(",
"bg",
",",
"bg",
")",
"\n",
"maxX",
",",
"maxY",
"=",
"termbox",
".",
"Size",
"(",
")",
"\n\n",
"w",
".",
"resize",
"(",
"maxX",
",",
"maxY",
")",
"\n",
"w",
".",
"<mask>",
"(",
")",
"\n\n",
"// display all the things",
"flush",
"(",
")",
"\n",
"}",
"\n",
"}"
] |
14,336 | all-14337 | [
"Code",
"implements",
"the",
"driver",
".",
"Error",
"interface",
"."
] | [
"func",
"(",
"e",
"*",
"hdbErrors",
")",
"Code",
"(",
")",
"int",
"{",
"return",
"int",
"(",
"e",
".",
"<mask>",
"[",
"e",
".",
"idx",
"]",
".",
"errorCode",
")",
"\n",
"}"
] |
14,337 | all-14338 | [
"UnmarshalYAML",
"implements",
"the",
"yaml",
".",
"Unmarshaler",
"interface",
"."
] | [
"func",
"(",
"c",
"*",
"SDConfig",
")",
"UnmarshalYAML",
"(",
"unmarshal",
"func",
"(",
"interface",
"{",
"}",
")",
"error",
")",
"error",
"{",
"*",
"c",
"=",
"DefaultSDConfig",
"\n",
"type",
"plain",
"SDConfig",
"\n",
"err",
":=",
"unmarshal",
"(",
"(",
"*",
"plain",
")",
"(",
"c",
")",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"if",
"len",
"(",
"c",
".",
"Servers",
")",
"==",
"0",
"{",
"return",
"errors",
".",
"New",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"if",
"len",
"(",
"c",
".",
"AuthToken",
")",
">",
"0",
"&&",
"len",
"(",
"c",
".",
"AuthTokenFile",
")",
">",
"0",
"{",
"return",
"<mask>",
".",
"New",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"if",
"c",
".",
"HTTPClientConfig",
".",
"BasicAuth",
"!=",
"nil",
"&&",
"(",
"len",
"(",
"c",
".",
"AuthToken",
")",
">",
"0",
"||",
"len",
"(",
"c",
".",
"AuthTokenFile",
")",
">",
"0",
")",
"{",
"return",
"errors",
".",
"New",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"if",
"(",
"len",
"(",
"c",
".",
"HTTPClientConfig",
".",
"BearerToken",
")",
">",
"0",
"||",
"len",
"(",
"c",
".",
"HTTPClientConfig",
".",
"BearerTokenFile",
")",
">",
"0",
")",
"&&",
"(",
"len",
"(",
"c",
".",
"AuthToken",
")",
">",
"0",
"||",
"len",
"(",
"c",
".",
"AuthTokenFile",
")",
">",
"0",
")",
"{",
"return",
"errors",
".",
"New",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"return",
"c",
".",
"HTTPClientConfig",
".",
"Validate",
"(",
")",
"\n",
"}"
] |
14,338 | all-14339 | [
"Fetch",
"queries",
"the",
"Consul",
"API",
"defined",
"by",
"the",
"given",
"client",
"."
] | [
"func",
"(",
"d",
"*",
"KVGetQuery",
")",
"Fetch",
"(",
"clients",
"*",
"ClientSet",
",",
"opts",
"*",
"QueryOptions",
")",
"(",
"interface",
"{",
"}",
",",
"*",
"ResponseMetadata",
",",
"error",
")",
"{",
"select",
"{",
"case",
"<-",
"d",
".",
"stopCh",
":",
"return",
"nil",
",",
"nil",
",",
"ErrStopped",
"\n",
"default",
":",
"}",
"\n\n",
"opts",
"=",
"opts",
".",
"Merge",
"(",
"&",
"QueryOptions",
"{",
"Datacenter",
":",
"d",
".",
"dc",
",",
"}",
")",
"\n\n",
"log",
".",
"Printf",
"(",
"\"",
"\"",
",",
"d",
",",
"&",
"url",
".",
"URL",
"{",
"Path",
":",
"\"",
"\"",
"+",
"d",
".",
"key",
",",
"RawQuery",
":",
"opts",
".",
"String",
"(",
")",
",",
"}",
")",
"\n\n",
"pair",
",",
"qm",
",",
"err",
":=",
"clients",
".",
"Consul",
"(",
")",
".",
"KV",
"(",
")",
".",
"Get",
"(",
"d",
".",
"key",
",",
"opts",
".",
"ToConsulOpts",
"(",
")",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"nil",
",",
"errors",
".",
"Wrap",
"(",
"err",
",",
"d",
".",
"<mask>",
"(",
")",
")",
"\n",
"}",
"\n\n",
"rm",
":=",
"&",
"ResponseMetadata",
"{",
"LastIndex",
":",
"qm",
".",
"LastIndex",
",",
"LastContact",
":",
"qm",
".",
"LastContact",
",",
"Block",
":",
"d",
".",
"block",
",",
"}",
"\n\n",
"if",
"pair",
"==",
"nil",
"{",
"log",
".",
"Printf",
"(",
"\"",
"\"",
",",
"d",
")",
"\n",
"return",
"nil",
",",
"rm",
",",
"nil",
"\n",
"}",
"\n\n",
"value",
":=",
"string",
"(",
"pair",
".",
"Value",
")",
"\n",
"log",
".",
"Printf",
"(",
"\"",
"\"",
",",
"d",
",",
"value",
")",
"\n",
"return",
"value",
",",
"rm",
",",
"nil",
"\n",
"}"
] |
14,339 | all-14340 | [
"UnmarshalJSON",
"supports",
"json",
".",
"Unmarshaler",
"interface"
] | [
"func",
"(",
"v",
"*",
"HandleJavaScriptDialogParams",
")",
"UnmarshalJSON",
"(",
"data",
"[",
"]",
"byte",
")",
"error",
"{",
"r",
":=",
"jlexer",
".",
"Lexer",
"{",
"Data",
":",
"data",
"}",
"\n",
"easyjsonC5a4559bDecodeGithubComChromedpCdprotoPage29",
"(",
"&",
"r",
",",
"v",
")",
"\n",
"return",
"r",
".",
"<mask>",
"(",
")",
"\n",
"}"
] |
14,340 | all-14341 | [
"SetFileLabel",
"modifies",
"the",
"path",
"label",
"to",
"the",
"specified",
"file",
"label"
] | [
"func",
"SetFileLabel",
"(",
"<mask>",
"string",
",",
"fileLabel",
"string",
")",
"error",
"{",
"if",
"selinux",
".",
"SelinuxEnabled",
"(",
")",
"&&",
"fileLabel",
"!=",
"\"",
"\"",
"{",
"return",
"selinux",
".",
"Setfilecon",
"(",
"path",
",",
"fileLabel",
")",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
] |
14,341 | all-14342 | [
"LoadSecrets",
"loads",
"multiple",
"paths",
"of",
"secrets",
"and",
"add",
"them",
"in",
"a",
"map",
"."
] | [
"func",
"LoadSecrets",
"(",
"paths",
"[",
"]",
"string",
")",
"(",
"map",
"[",
"string",
"]",
"[",
"]",
"<mask>",
",",
"error",
")",
"{",
"secretsMap",
":=",
"make",
"(",
"map",
"[",
"string",
"]",
"[",
"]",
"byte",
",",
"len",
"(",
"paths",
")",
")",
"\n\n",
"for",
"_",
",",
"path",
":=",
"range",
"paths",
"{",
"secretValue",
",",
"err",
":=",
"LoadSingleSecret",
"(",
"path",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"secretsMap",
"[",
"path",
"]",
"=",
"secretValue",
"\n",
"}",
"\n",
"return",
"secretsMap",
",",
"nil",
"\n",
"}"
] |
14,342 | all-14343 | [
"MailingLists",
"lists",
"the",
"mailing",
"lists",
"of",
"a",
"domain"
] | [
"func",
"(",
"dom",
"*",
"Domain",
")",
"MailingLists",
"(",
")",
"(",
"[",
"]",
"*",
"MailingList",
",",
"error",
")",
"{",
"var",
"vl",
"valueList",
"\n",
"err",
":=",
"dom",
".",
"cgp",
".",
"request",
"(",
"listLists",
"{",
"Domain",
":",
"dom",
".",
"Name",
"}",
",",
"&",
"vl",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"[",
"]",
"*",
"MailingList",
"{",
"}",
",",
"err",
"\n",
"}",
"\n",
"vals",
":=",
"vl",
".",
"compact",
"(",
")",
"\n",
"mls",
":=",
"make",
"(",
"[",
"]",
"*",
"MailingList",
",",
"len",
"(",
"vals",
")",
")",
"\n",
"for",
"i",
",",
"v",
":=",
"<mask>",
"vals",
"{",
"mls",
"[",
"i",
"]",
"=",
"dom",
".",
"MailingList",
"(",
"v",
")",
"\n",
"}",
"\n",
"return",
"mls",
",",
"nil",
"\n",
"}"
] |
14,343 | all-14344 | [
"Register",
"register",
"a",
"new",
"migration",
"for",
"later",
"execution",
"with",
"the",
"Run",
"functions",
"."
] | [
"func",
"Register",
"(",
"name",
"string",
",",
"fn",
"MigrateFunc",
")",
"error",
"{",
"return",
"<mask>",
"(",
"name",
",",
"false",
",",
"fn",
")",
"\n",
"}"
] |
14,344 | all-14345 | [
"MutateManageOffer",
"for",
"Amount",
"sets",
"the",
"ManageOfferOp",
"s",
"Amount",
"field"
] | [
"func",
"(",
"m",
"Amount",
")",
"MutateManageOffer",
"(",
"o",
"interface",
"{",
"}",
")",
"(",
"err",
"error",
")",
"{",
"switch",
"o",
":=",
"o",
".",
"(",
"type",
")",
"{",
"default",
":",
"err",
"=",
"errors",
".",
"New",
"(",
"\"",
"\"",
")",
"\n",
"case",
"*",
"xdr",
".",
"ManageOfferOp",
":",
"o",
".",
"Amount",
",",
"err",
"=",
"amount",
".",
"Parse",
"(",
"string",
"(",
"m",
")",
")",
"\n",
"<mask>",
"*",
"xdr",
".",
"CreatePassiveOfferOp",
":",
"o",
".",
"Amount",
",",
"err",
"=",
"amount",
".",
"Parse",
"(",
"string",
"(",
"m",
")",
")",
"\n",
"}",
"\n",
"return",
"\n",
"}"
] |
14,345 | all-14346 | [
"Require",
"will",
"check",
"if",
"the",
"specified",
"flags",
"are",
"set",
"on",
"the",
"specified",
"model",
"and",
"panic",
"if",
"one",
"is",
"missing",
"."
] | [
"func",
"Require",
"(",
"m",
"<mask>",
",",
"flags",
"...",
"string",
")",
"{",
"// check all flags",
"for",
"_",
",",
"f",
":=",
"range",
"flags",
"{",
"L",
"(",
"m",
",",
"f",
",",
"true",
")",
"\n",
"}",
"\n",
"}"
] |
14,346 | all-14347 | [
"Symbol",
"returns",
"the",
"character",
"and",
"its",
"attributes",
"by",
"its",
"coordinates"
] | [
"func",
"Symbol",
"(",
"x",
",",
"y",
"int",
")",
"(",
"term",
".",
"Cell",
",",
"bool",
")",
"{",
"if",
"x",
">=",
"0",
"&&",
"x",
"<",
"canvas",
".",
"width",
"&&",
"y",
">=",
"0",
"&&",
"y",
"<",
"canvas",
".",
"height",
"{",
"cells",
":=",
"<mask>",
".",
"CellBuffer",
"(",
")",
"\n",
"return",
"cells",
"[",
"y",
"*",
"canvas",
".",
"width",
"+",
"x",
"]",
",",
"true",
"\n",
"}",
"\n",
"return",
"term",
".",
"Cell",
"{",
"Ch",
":",
"' '",
"}",
",",
"false",
"\n",
"}"
] |
14,347 | all-14348 | [
"CheckUint64Bounds",
"verifies",
"that",
"v",
"is",
"smaller",
"than",
"max",
"t",
"represents",
"the",
"original",
"type",
"of",
"v",
"."
] | [
"func",
"CheckUint64Bounds",
"(",
"v",
"uint64",
",",
"max",
"uint64",
",",
"t",
"reflect",
".",
"<mask>",
")",
"(",
"err",
"error",
")",
"{",
"if",
"v",
">",
"max",
"{",
"err",
"=",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"v",
",",
"max",
",",
"t",
")",
"\n",
"}",
"\n",
"return",
"\n",
"}"
] |
14,348 | all-14349 | [
"TSDBSnapshot",
"implements",
"pb",
".",
"AdminServer",
"."
] | [
"func",
"(",
"s",
"*",
"Admin",
")",
"TSDBSnapshot",
"(",
"_",
"context",
".",
"Context",
",",
"req",
"*",
"pb",
".",
"TSDBSnapshotRequest",
")",
"(",
"*",
"pb",
".",
"TSDBSnapshotResponse",
",",
"error",
")",
"{",
"db",
":=",
"s",
".",
"db",
"(",
")",
"\n",
"if",
"db",
"==",
"nil",
"{",
"return",
"nil",
",",
"errTSDBNotReady",
"\n",
"}",
"\n",
"<mask>",
"(",
"snapdir",
"=",
"filepath",
".",
"Join",
"(",
"db",
".",
"Dir",
"(",
")",
",",
"\"",
"\"",
")",
"\n",
"name",
"=",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"time",
".",
"Now",
"(",
")",
".",
"UTC",
"(",
")",
".",
"Format",
"(",
"\"",
"\"",
")",
",",
"rand",
".",
"Int",
"(",
")",
")",
"\n",
"dir",
"=",
"filepath",
".",
"Join",
"(",
"snapdir",
",",
"name",
")",
"\n",
")",
"\n",
"if",
"err",
":=",
"os",
".",
"MkdirAll",
"(",
"dir",
",",
"0777",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"status",
".",
"Errorf",
"(",
"codes",
".",
"Internal",
",",
"\"",
"\"",
",",
"err",
")",
"\n",
"}",
"\n",
"if",
"err",
":=",
"db",
".",
"Snapshot",
"(",
"dir",
",",
"!",
"req",
".",
"SkipHead",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"status",
".",
"Errorf",
"(",
"codes",
".",
"Internal",
",",
"\"",
"\"",
",",
"err",
")",
"\n",
"}",
"\n",
"return",
"&",
"pb",
".",
"TSDBSnapshotResponse",
"{",
"Name",
":",
"name",
"}",
",",
"nil",
"\n",
"}"
] |
14,349 | all-14350 | [
"ValidateSecureEndpoints",
"scans",
"the",
"given",
"endpoints",
"against",
"tls",
"info",
"returning",
"only",
"those",
"endpoints",
"that",
"could",
"be",
"validated",
"as",
"secure",
"."
] | [
"func",
"ValidateSecureEndpoints",
"(",
"tlsInfo",
"TLSInfo",
",",
"eps",
"[",
"]",
"string",
")",
"(",
"[",
"]",
"string",
",",
"error",
")",
"{",
"t",
",",
"err",
":=",
"NewTransport",
"(",
"tlsInfo",
",",
"5",
"*",
"time",
".",
"Second",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"var",
"errs",
"[",
"]",
"string",
"\n",
"var",
"endpoints",
"[",
"]",
"string",
"\n",
"for",
"_",
",",
"ep",
":=",
"range",
"eps",
"{",
"if",
"!",
"strings",
".",
"HasPrefix",
"(",
"ep",
",",
"\"",
"\"",
")",
"{",
"errs",
"=",
"append",
"(",
"errs",
",",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"ep",
")",
")",
"\n",
"continue",
"\n",
"}",
"\n",
"conn",
",",
"cerr",
":=",
"t",
".",
"Dial",
"(",
"\"",
"\"",
",",
"ep",
"[",
"len",
"(",
"\"",
"\"",
")",
":",
"]",
")",
"\n",
"if",
"cerr",
"!=",
"nil",
"{",
"errs",
"=",
"append",
"(",
"errs",
",",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"ep",
",",
"cerr",
")",
")",
"\n",
"<mask>",
"\n",
"}",
"\n",
"conn",
".",
"Close",
"(",
")",
"\n",
"endpoints",
"=",
"append",
"(",
"endpoints",
",",
"ep",
")",
"\n",
"}",
"\n",
"if",
"len",
"(",
"errs",
")",
"!=",
"0",
"{",
"err",
"=",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"strings",
".",
"Join",
"(",
"errs",
",",
"\"",
"\"",
")",
")",
"\n",
"}",
"\n",
"return",
"endpoints",
",",
"err",
"\n",
"}"
] |
14,350 | all-14351 | [
"Flatten",
"convert",
"curves",
"into",
"straight",
"segments",
"keeping",
"join",
"segments",
"info"
] | [
"func",
"Flatten",
"(",
"path",
"*",
"draw2d",
".",
"Path",
",",
"flattener",
"Flattener",
",",
"scale",
"float64",
")",
"{",
"// First Point",
"var",
"startX",
",",
"startY",
"float64",
"=",
"0",
",",
"0",
"\n",
"// Current Point",
"var",
"x",
",",
"y",
"float64",
"=",
"0",
",",
"0",
"\n",
"i",
":=",
"0",
"\n",
"for",
"_",
",",
"cmp",
":=",
"range",
"<mask>",
".",
"Components",
"{",
"switch",
"cmp",
"{",
"case",
"draw2d",
".",
"MoveToCmp",
":",
"x",
",",
"y",
"=",
"path",
".",
"Points",
"[",
"i",
"]",
",",
"path",
".",
"Points",
"[",
"i",
"+",
"1",
"]",
"\n",
"startX",
",",
"startY",
"=",
"x",
",",
"y",
"\n",
"if",
"i",
"!=",
"0",
"{",
"flattener",
".",
"End",
"(",
")",
"\n",
"}",
"\n",
"flattener",
".",
"MoveTo",
"(",
"x",
",",
"y",
")",
"\n",
"i",
"+=",
"2",
"\n",
"case",
"draw2d",
".",
"LineToCmp",
":",
"x",
",",
"y",
"=",
"path",
".",
"Points",
"[",
"i",
"]",
",",
"path",
".",
"Points",
"[",
"i",
"+",
"1",
"]",
"\n",
"flattener",
".",
"LineTo",
"(",
"x",
",",
"y",
")",
"\n",
"flattener",
".",
"LineJoin",
"(",
")",
"\n",
"i",
"+=",
"2",
"\n",
"case",
"draw2d",
".",
"QuadCurveToCmp",
":",
"TraceQuad",
"(",
"flattener",
",",
"path",
".",
"Points",
"[",
"i",
"-",
"2",
":",
"]",
",",
"0.5",
")",
"\n",
"x",
",",
"y",
"=",
"path",
".",
"Points",
"[",
"i",
"+",
"2",
"]",
",",
"path",
".",
"Points",
"[",
"i",
"+",
"3",
"]",
"\n",
"flattener",
".",
"LineTo",
"(",
"x",
",",
"y",
")",
"\n",
"i",
"+=",
"4",
"\n",
"case",
"draw2d",
".",
"CubicCurveToCmp",
":",
"TraceCubic",
"(",
"flattener",
",",
"path",
".",
"Points",
"[",
"i",
"-",
"2",
":",
"]",
",",
"0.5",
")",
"\n",
"x",
",",
"y",
"=",
"path",
".",
"Points",
"[",
"i",
"+",
"4",
"]",
",",
"path",
".",
"Points",
"[",
"i",
"+",
"5",
"]",
"\n",
"flattener",
".",
"LineTo",
"(",
"x",
",",
"y",
")",
"\n",
"i",
"+=",
"6",
"\n",
"case",
"draw2d",
".",
"ArcToCmp",
":",
"x",
",",
"y",
"=",
"TraceArc",
"(",
"flattener",
",",
"path",
".",
"Points",
"[",
"i",
"]",
",",
"path",
".",
"Points",
"[",
"i",
"+",
"1",
"]",
",",
"path",
".",
"Points",
"[",
"i",
"+",
"2",
"]",
",",
"path",
".",
"Points",
"[",
"i",
"+",
"3",
"]",
",",
"path",
".",
"Points",
"[",
"i",
"+",
"4",
"]",
",",
"path",
".",
"Points",
"[",
"i",
"+",
"5",
"]",
",",
"scale",
")",
"\n",
"flattener",
".",
"LineTo",
"(",
"x",
",",
"y",
")",
"\n",
"i",
"+=",
"6",
"\n",
"case",
"draw2d",
".",
"CloseCmp",
":",
"flattener",
".",
"LineTo",
"(",
"startX",
",",
"startY",
")",
"\n",
"flattener",
".",
"Close",
"(",
")",
"\n",
"}",
"\n",
"}",
"\n",
"flattener",
".",
"End",
"(",
")",
"\n",
"}"
] |
14,351 | all-14352 | [
"NewMemoryKeyCacher",
"creates",
"a",
"new",
"Keycacher",
"interface",
"with",
"option",
"to",
"set",
"max",
"age",
"of",
"cached",
"keys",
"and",
"max",
"size",
"of",
"the",
"cache",
"."
] | [
"func",
"NewMemoryKeyCacher",
"(",
"maxKeyAge",
"time",
".",
"Duration",
",",
"maxCacheSize",
"int",
")",
"KeyCacher",
"{",
"return",
"&",
"memoryKeyCacher",
"{",
"entries",
":",
"<mask>",
"[",
"string",
"]",
"keyCacherEntry",
"{",
"}",
",",
"maxKeyAge",
":",
"maxKeyAge",
",",
"maxCacheSize",
":",
"maxCacheSize",
",",
"}",
"\n",
"}"
] |
14,352 | all-14353 | [
"Connect",
"opens",
"a",
"connection",
"to",
"the",
"backend",
"and",
"upgrades",
"it",
"to",
"a",
"websocket",
".",
"Calls",
"to",
"MakeRequest",
"can",
"be",
"made",
"after",
"calling",
"this",
"but",
"responses",
"will",
"not",
"be",
"receivable",
"until",
"Serve",
"is",
"also",
"called",
"."
] | [
"func",
"(",
"cs",
"*",
"ClientServerImpl",
")",
"Connect",
"(",
")",
"error",
"{",
"seelog",
".",
"Infof",
"(",
"\"",
"\"",
",",
"cs",
".",
"URL",
")",
"\n",
"parsedURL",
",",
"err",
":=",
"url",
".",
"Parse",
"(",
"cs",
".",
"URL",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"wsScheme",
",",
"err",
":=",
"websocketScheme",
"(",
"parsedURL",
".",
"Scheme",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"parsedURL",
".",
"Scheme",
"=",
"wsScheme",
"\n\n",
"// NewRequest never returns an error if the url parses and we just verified",
"// it did above",
"request",
",",
"_",
":=",
"http",
".",
"NewRequest",
"(",
"\"",
"\"",
",",
"parsedURL",
".",
"String",
"(",
")",
",",
"nil",
")",
"\n\n",
"// Sign the request; we'll send its headers via the websocket client which includes the signature",
"err",
"=",
"utils",
".",
"SignHTTPRequest",
"(",
"request",
",",
"cs",
".",
"AgentConfig",
".",
"AWSRegion",
",",
"ServiceName",
",",
"cs",
".",
"CredentialProvider",
",",
"nil",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"timeoutDialer",
":=",
"&",
"net",
".",
"Dialer",
"{",
"Timeout",
":",
"wsConnectTimeout",
"}",
"\n",
"tlsConfig",
":=",
"&",
"tls",
".",
"Config",
"{",
"ServerName",
":",
"parsedURL",
".",
"Host",
",",
"InsecureSkipVerify",
":",
"cs",
".",
"AgentConfig",
".",
"AcceptInsecureCert",
"}",
"\n",
"cipher",
".",
"WithSupportedCipherSuites",
"(",
"tlsConfig",
")",
"\n\n",
"// Ensure that NO_PROXY gets set",
"noProxy",
":=",
"os",
".",
"Getenv",
"(",
"\"",
"\"",
")",
"\n",
"if",
"noProxy",
"==",
"\"",
"\"",
"{",
"dockerHost",
",",
"err",
":=",
"url",
".",
"Parse",
"(",
"cs",
".",
"AgentConfig",
".",
"DockerEndpoint",
")",
"\n",
"if",
"err",
"==",
"nil",
"{",
"dockerHost",
".",
"Scheme",
"=",
"\"",
"\"",
"\n",
"<mask>",
".",
"Setenv",
"(",
"\"",
"\"",
",",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"defaultNoProxyIP",
",",
"dockerHost",
".",
"String",
"(",
")",
")",
")",
"\n",
"seelog",
".",
"Info",
"(",
"\"",
"\"",
",",
"os",
".",
"Getenv",
"(",
"\"",
"\"",
")",
")",
"\n",
"}",
"else",
"{",
"seelog",
".",
"Errorf",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"}",
"\n\n",
"dialer",
":=",
"websocket",
".",
"Dialer",
"{",
"ReadBufferSize",
":",
"readBufSize",
",",
"WriteBufferSize",
":",
"writeBufSize",
",",
"TLSClientConfig",
":",
"tlsConfig",
",",
"Proxy",
":",
"http",
".",
"ProxyFromEnvironment",
",",
"NetDial",
":",
"timeoutDialer",
".",
"Dial",
",",
"HandshakeTimeout",
":",
"wsHandshakeTimeout",
",",
"}",
"\n\n",
"websocketConn",
",",
"httpResponse",
",",
"err",
":=",
"dialer",
".",
"Dial",
"(",
"parsedURL",
".",
"String",
"(",
")",
",",
"request",
".",
"Header",
")",
"\n",
"if",
"httpResponse",
"!=",
"nil",
"{",
"defer",
"httpResponse",
".",
"Body",
".",
"Close",
"(",
")",
"\n",
"}",
"\n\n",
"if",
"err",
"!=",
"nil",
"{",
"var",
"resp",
"[",
"]",
"byte",
"\n",
"if",
"httpResponse",
"!=",
"nil",
"{",
"var",
"readErr",
"error",
"\n",
"resp",
",",
"readErr",
"=",
"ioutil",
".",
"ReadAll",
"(",
"httpResponse",
".",
"Body",
")",
"\n",
"if",
"readErr",
"!=",
"nil",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
"+",
"readErr",
".",
"Error",
"(",
")",
"+",
"\"",
"\"",
"+",
"err",
".",
"Error",
"(",
")",
")",
"\n",
"}",
"\n",
"// If there's a response, we can try to unmarshal it into one of the",
"// modeled error types",
"possibleError",
",",
"_",
",",
"decodeErr",
":=",
"DecodeData",
"(",
"resp",
",",
"cs",
".",
"TypeDecoder",
")",
"\n",
"if",
"decodeErr",
"==",
"nil",
"{",
"return",
"cs",
".",
"NewError",
"(",
"possibleError",
")",
"\n",
"}",
"\n",
"}",
"\n",
"seelog",
".",
"Warnf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"return",
"errors",
".",
"Wrapf",
"(",
"err",
",",
"\"",
"\"",
",",
"parsedURL",
".",
"Host",
",",
"string",
"(",
"resp",
")",
")",
"\n",
"}",
"\n\n",
"cs",
".",
"writeLock",
".",
"Lock",
"(",
")",
"\n",
"defer",
"cs",
".",
"writeLock",
".",
"Unlock",
"(",
")",
"\n\n",
"cs",
".",
"conn",
"=",
"websocketConn",
"\n",
"seelog",
".",
"Debugf",
"(",
"\"",
"\"",
",",
"cs",
".",
"URL",
")",
"\n",
"return",
"nil",
"\n",
"}"
] |
14,353 | all-14354 | [
"SetFocusOnMap",
"is",
"a",
"wrapper",
"around",
"gtk_window_set_focus_on_map",
"()",
"."
] | [
"func",
"(",
"v",
"*",
"Window",
")",
"SetFocusOnMap",
"(",
"<mask>",
"bool",
")",
"{",
"C",
".",
"gtk_window_set_focus_on_map",
"(",
"v",
".",
"native",
"(",
")",
",",
"gbool",
"(",
"setting",
")",
")",
"\n",
"}"
] |
14,354 | all-14355 | [
"DependenciesCanBeResolved",
"verifies",
"that",
"it",
"s",
"possible",
"to",
"transition",
"a",
"target",
"given",
"a",
"group",
"of",
"already",
"handled",
"containers",
"by",
".",
"Essentially",
"it",
"asks",
"is",
"target",
"resolved",
"by",
"by",
".",
"It",
"assumes",
"that",
"everything",
"in",
"by",
"has",
"reached",
"DesiredStatus",
"and",
"that",
"target",
"is",
"also",
"trying",
"to",
"get",
"there",
"This",
"function",
"is",
"used",
"for",
"verifying",
"that",
"a",
"state",
"should",
"be",
"resolvable",
"not",
"for",
"actually",
"deciding",
"what",
"to",
"do",
".",
"DependenciesAreResolved",
"should",
"be",
"used",
"for",
"that",
"purpose",
"instead",
"."
] | [
"func",
"dependenciesCanBeResolved",
"(",
"target",
"*",
"apicontainer",
".",
"Container",
",",
"by",
"[",
"]",
"*",
"apicontainer",
".",
"Container",
")",
"bool",
"{",
"nameMap",
":=",
"make",
"(",
"<mask>",
"[",
"string",
"]",
"*",
"apicontainer",
".",
"Container",
")",
"\n",
"for",
"_",
",",
"cont",
":=",
"range",
"by",
"{",
"nameMap",
"[",
"cont",
".",
"Name",
"]",
"=",
"cont",
"\n",
"}",
"\n\n",
"if",
"_",
",",
"err",
":=",
"verifyContainerOrderingStatusResolvable",
"(",
"target",
",",
"nameMap",
",",
"containerOrderingDependenciesCanResolve",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"false",
"\n",
"}",
"\n",
"return",
"verifyStatusResolvable",
"(",
"target",
",",
"nameMap",
",",
"target",
".",
"SteadyStateDependencies",
",",
"onSteadyStateCanResolve",
")",
"\n",
"}"
] |
14,355 | all-14356 | [
"Handle",
"writes",
"message",
"from",
"log",
"record",
"into",
"file",
"."
] | [
"func",
"(",
"handler",
"*",
"TimedFileHandler",
")",
"Handle",
"(",
"record",
"*",
"Record",
")",
"(",
"err",
"error",
")",
"{",
"handler",
".",
"lock",
".",
"Lock",
"(",
")",
"\n",
"defer",
"handler",
".",
"lock",
".",
"Unlock",
"(",
")",
"\n\n",
"if",
"handler",
".",
"FilenameLayout",
"==",
"\"",
"\"",
"{",
"handler",
".",
"FilenameLayout",
"=",
"\"",
"\"",
"\n",
"}",
"\n",
"timestamp",
":=",
"record",
".",
"Time",
".",
"Format",
"(",
"handler",
".",
"FilenameLayout",
")",
"\n",
"if",
"handler",
".",
"timestamp",
"!=",
"timestamp",
"||",
"handler",
".",
"file",
"==",
"nil",
"{",
"filename",
":=",
"filepath",
".",
"Join",
"(",
"handler",
".",
"Directory",
",",
"timestamp",
")",
"\n",
"if",
"handler",
".",
"FileExtension",
"!=",
"\"",
"\"",
"{",
"filename",
"+=",
"handler",
".",
"FileExtension",
"\n",
"}",
"\n",
"if",
"handler",
".",
"DirectoryMode",
"==",
"0",
"{",
"handler",
".",
"DirectoryMode",
"=",
"0750",
"\n",
"}",
"\n",
"if",
"err",
"=",
"os",
".",
"MkdirAll",
"(",
"filepath",
".",
"Dir",
"(",
"filename",
")",
",",
"handler",
".",
"DirectoryMode",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"if",
"handler",
".",
"FileMode",
"==",
"0",
"{",
"handler",
".",
"FileMode",
"=",
"0640",
"\n",
"}",
"\n",
"handler",
".",
"file",
",",
"err",
"=",
"os",
".",
"OpenFile",
"(",
"filename",
",",
"os",
".",
"O_APPEND",
"|",
"os",
".",
"O_WRONLY",
"|",
"os",
".",
"O_CREATE",
",",
"handler",
".",
"FileMode",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"}",
"\n\n",
"msg",
":=",
"handler",
".",
"Formatter",
".",
"Format",
"(",
"record",
")",
"+",
"\"",
"\\n",
"\"",
"\n\n",
"_",
",",
"err",
"=",
"handler",
".",
"file",
".",
"Write",
"(",
"[",
"]",
"<mask>",
"(",
"msg",
")",
")",
"\n",
"return",
"\n",
"}"
] |
14,356 | all-14357 | [
"HasDisabled",
"returns",
"a",
"boolean",
"if",
"a",
"field",
"has",
"been",
"set",
"."
] | [
"func",
"(",
"d",
"*",
"Downtime",
")",
"HasDisabled",
"(",
")",
"bool",
"{",
"if",
"d",
"!=",
"nil",
"&&",
"d",
".",
"Disabled",
"!=",
"nil",
"{",
"return",
"true",
"\n",
"}",
"\n\n",
"return",
"<mask>",
"\n",
"}"
] |
14,357 | all-14358 | [
"export",
"FindSequencesOnDisk"
] | [
"func",
"FindSequencesOnDisk",
"(",
"<mask>",
"*",
"C",
".",
"char",
",",
"opts",
"C",
".",
"FileOption",
")",
"(",
"FileSequences",
",",
"uint64",
",",
"Error",
")",
"{",
"fileOpts",
":=",
"[",
"]",
"fileseq",
".",
"FileOption",
"{",
"}",
"\n\n",
"if",
"opts",
".",
"hiddenFiles",
"{",
"fileOpts",
"=",
"append",
"(",
"fileOpts",
",",
"fileseq",
".",
"HiddenFiles",
")",
"\n",
"}",
"\n\n",
"if",
"opts",
".",
"singleFiles",
"{",
"fileOpts",
"=",
"append",
"(",
"fileOpts",
",",
"fileseq",
".",
"SingleFiles",
")",
"\n",
"}",
"\n\n",
"switch",
"fileseq",
".",
"PadStyle",
"(",
"opts",
".",
"padStyle",
")",
"{",
"case",
"fileseq",
".",
"PadStyleHash1",
":",
"fileOpts",
"=",
"append",
"(",
"fileOpts",
",",
"fileseq",
".",
"FileOptPadStyleHash1",
")",
"\n",
"fmt",
".",
"Println",
"(",
"\"",
"\"",
")",
"\n\n",
"case",
"fileseq",
".",
"PadStyleHash4",
":",
"fileOpts",
"=",
"append",
"(",
"fileOpts",
",",
"fileseq",
".",
"FileOptPadStyleHash4",
")",
"\n",
"fmt",
".",
"Println",
"(",
"\"",
"\"",
")",
"\n\n",
"}",
"\n\n",
"gopath",
":=",
"C",
".",
"GoString",
"(",
"path",
")",
"\n",
"seqs",
",",
"err",
":=",
"fileseq",
".",
"FindSequencesOnDisk",
"(",
"gopath",
",",
"fileOpts",
"...",
")",
"\n",
"// fmt.Printf(\"export.go::DEBUG:results: %v\\n\", seqs)",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"0",
",",
"C",
".",
"CString",
"(",
"err",
".",
"Error",
"(",
")",
")",
"\n",
"}",
"\n\n",
"num",
":=",
"uint64",
"(",
"len",
"(",
"seqs",
")",
")",
"\n",
"size",
":=",
"uint64",
"(",
"unsafe",
".",
"Sizeof",
"(",
"C",
".",
"uint64_t",
"(",
"0",
")",
")",
")",
"\n",
"list",
":=",
"C",
".",
"malloc",
"(",
"C",
".",
"size_t",
"(",
"num",
"*",
"size",
")",
")",
"\n",
"startPtr",
":=",
"uintptr",
"(",
"unsafe",
".",
"Pointer",
"(",
"list",
")",
")",
"\n\n",
"for",
"i",
",",
"seq",
":=",
"range",
"seqs",
"{",
"id",
":=",
"sFileSeqs",
".",
"Add",
"(",
"seq",
")",
"\n",
"// fmt.Printf(\"export.go::DEBUG:id: %v\\n\", id)",
"ptr",
":=",
"unsafe",
".",
"Pointer",
"(",
"startPtr",
"+",
"uintptr",
"(",
"size",
"*",
"uint64",
"(",
"i",
")",
")",
")",
"\n",
"*",
"(",
"*",
"C",
".",
"uint64_t",
")",
"(",
"ptr",
")",
"=",
"C",
".",
"uint64_t",
"(",
"id",
")",
"\n",
"}",
"\n\n",
"return",
"FileSequences",
"(",
"list",
")",
",",
"num",
",",
"nil",
"\n",
"}"
] |
14,358 | all-14359 | [
"ConnectIfVolumeIsRemote",
"figures",
"out",
"the",
"address",
"of",
"the",
"node",
"on",
"which",
"the",
"volume",
"with",
"the",
"given",
"name",
"is",
"defined",
".",
"If",
"it",
"s",
"not",
"the",
"local",
"node",
"will",
"connect",
"to",
"it",
"and",
"return",
"the",
"connected",
"client",
"otherwise",
"it",
"will",
"just",
"return",
"nil",
".",
"If",
"there",
"is",
"more",
"than",
"one",
"node",
"with",
"a",
"matching",
"volume",
"name",
"an",
"error",
"is",
"returned",
"."
] | [
"func",
"ConnectIfVolumeIsRemote",
"(",
"cluster",
"*",
"db",
".",
"Cluster",
",",
"poolID",
"int64",
",",
"volumeName",
"string",
",",
"volumeType",
"int",
",",
"cert",
"*",
"shared",
".",
"CertInfo",
")",
"(",
"lxd",
".",
"ContainerServer",
",",
"error",
")",
"{",
"var",
"addresses",
"[",
"]",
"string",
"// Node addresses",
"\n",
"err",
":=",
"cluster",
".",
"Transaction",
"(",
"func",
"(",
"tx",
"*",
"db",
".",
"ClusterTx",
")",
"error",
"{",
"var",
"err",
"error",
"\n",
"addresses",
",",
"err",
"=",
"tx",
".",
"StorageVolumeNodeAddresses",
"(",
"poolID",
",",
"\"",
"\"",
",",
"volumeName",
",",
"volumeType",
")",
"\n",
"return",
"err",
"\n",
"}",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"if",
"len",
"(",
"addresses",
")",
">",
"1",
"{",
"var",
"driver",
"string",
"\n",
"err",
":=",
"cluster",
".",
"Transaction",
"(",
"func",
"(",
"tx",
"*",
"db",
".",
"ClusterTx",
")",
"error",
"{",
"var",
"err",
"error",
"\n",
"driver",
",",
"err",
"=",
"tx",
".",
"StoragePoolDriver",
"(",
"poolID",
")",
"\n",
"return",
"err",
"\n",
"}",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"if",
"<mask>",
"==",
"\"",
"\"",
"{",
"return",
"nil",
",",
"nil",
"\n",
"}",
"\n\n",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"volumeName",
")",
"\n",
"}",
"\n\n",
"address",
":=",
"addresses",
"[",
"0",
"]",
"\n",
"if",
"address",
"==",
"\"",
"\"",
"{",
"return",
"nil",
",",
"nil",
"\n",
"}",
"\n\n",
"return",
"Connect",
"(",
"address",
",",
"cert",
",",
"false",
")",
"\n",
"}"
] |
14,359 | all-14360 | [
"IsMergeable",
"determines",
"if",
"a",
"PR",
"can",
"be",
"merged",
".",
"Mergeability",
"is",
"calculated",
"by",
"a",
"background",
"job",
"on",
"GitHub",
"and",
"is",
"not",
"immediately",
"available",
"when",
"new",
"commits",
"are",
"added",
"so",
"the",
"PR",
"must",
"be",
"polled",
"until",
"the",
"background",
"job",
"completes",
"."
] | [
"func",
"(",
"c",
"*",
"Client",
")",
"IsMergeable",
"(",
"org",
",",
"repo",
"string",
",",
"number",
"int",
",",
"SHA",
"string",
")",
"(",
"bool",
",",
"error",
")",
"{",
"backoff",
":=",
"time",
".",
"Second",
"*",
"3",
"\n",
"maxTries",
":=",
"3",
"\n",
"for",
"try",
":=",
"0",
";",
"try",
"<",
"maxTries",
";",
"try",
"++",
"{",
"pr",
",",
"err",
":=",
"c",
".",
"GetPullRequest",
"(",
"org",
",",
"repo",
",",
"number",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"<mask>",
",",
"err",
"\n",
"}",
"\n",
"if",
"pr",
".",
"Head",
".",
"SHA",
"!=",
"SHA",
"{",
"return",
"false",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"SHA",
",",
"pr",
".",
"Head",
".",
"SHA",
")",
"\n",
"}",
"\n",
"if",
"pr",
".",
"Merged",
"{",
"return",
"false",
",",
"errors",
".",
"New",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"if",
"pr",
".",
"Mergable",
"!=",
"nil",
"{",
"return",
"*",
"pr",
".",
"Mergable",
",",
"nil",
"\n",
"}",
"\n",
"if",
"try",
"+",
"1",
"<",
"maxTries",
"{",
"c",
".",
"time",
".",
"Sleep",
"(",
"backoff",
")",
"\n",
"backoff",
"*=",
"2",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"false",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"maxTries",
")",
"\n",
"}"
] |
14,360 | all-14361 | [
"Copy",
"a",
"container",
"on",
"a",
"storage",
"pool",
"that",
"does",
"not",
"use",
"a",
"thinpool",
"."
] | [
"func",
"(",
"s",
"*",
"storageLvm",
")",
"copyContainerLv",
"(",
"target",
"container",
",",
"source",
"container",
",",
"readonly",
"bool",
",",
"refresh",
"bool",
")",
"error",
"{",
"exists",
",",
"err",
":=",
"storageLVExists",
"(",
"getLvmDevPath",
"(",
"target",
".",
"Project",
"(",
")",
",",
"s",
".",
"getOnDiskPoolName",
"(",
")",
",",
"storagePoolVolumeAPIEndpointContainers",
",",
"containerNameToLVName",
"(",
"target",
".",
"Name",
"(",
")",
")",
")",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"// Only create container/snapshot if it doesn't already exist",
"if",
"!",
"exists",
"{",
"err",
":=",
"s",
".",
"ContainerCreate",
"(",
"target",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"}",
"\n\n",
"targetName",
":=",
"target",
".",
"Name",
"(",
")",
"\n",
"targetStart",
",",
"err",
":=",
"target",
".",
"StorageStart",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"if",
"targetStart",
"{",
"defer",
"target",
".",
"StorageStop",
"(",
")",
"\n",
"}",
"\n\n",
"sourceName",
":=",
"source",
".",
"Name",
"(",
")",
"\n",
"sourceStart",
",",
"err",
":=",
"source",
".",
"StorageStart",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"if",
"sourceStart",
"{",
"defer",
"source",
".",
"StorageStop",
"(",
")",
"\n",
"}",
"\n\n",
"sourcePool",
",",
"err",
":=",
"source",
".",
"StoragePool",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"sourceContainerMntPoint",
":=",
"getContainerMountPoint",
"(",
"source",
".",
"Project",
"(",
")",
",",
"sourcePool",
",",
"sourceName",
")",
"\n",
"if",
"source",
".",
"IsSnapshot",
"(",
")",
"{",
"sourceContainerMntPoint",
"=",
"getSnapshotMountPoint",
"(",
"source",
".",
"Project",
"(",
")",
",",
"sourcePool",
",",
"sourceName",
")",
"\n",
"}",
"\n\n",
"targetContainerMntPoint",
":=",
"getContainerMountPoint",
"(",
"target",
".",
"Project",
"(",
")",
",",
"s",
".",
"pool",
".",
"Name",
",",
"targetName",
")",
"\n",
"if",
"target",
".",
"IsSnapshot",
"(",
")",
"{",
"targetContainerMntPoint",
"=",
"getSnapshotMountPoint",
"(",
"source",
".",
"Project",
"(",
")",
",",
"s",
".",
"pool",
".",
"Name",
",",
"targetName",
")",
"\n",
"}",
"\n\n",
"if",
"<mask>",
".",
"IsRunning",
"(",
")",
"{",
"err",
"=",
"source",
".",
"Freeze",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"defer",
"source",
".",
"Unfreeze",
"(",
")",
"\n",
"}",
"\n\n",
"bwlimit",
":=",
"s",
".",
"pool",
".",
"Config",
"[",
"\"",
"\"",
"]",
"\n",
"output",
",",
"err",
":=",
"rsyncLocalCopy",
"(",
"sourceContainerMntPoint",
",",
"targetContainerMntPoint",
",",
"bwlimit",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"string",
"(",
"output",
")",
",",
"err",
")",
"\n",
"}",
"\n\n",
"if",
"readonly",
"{",
"targetLvmName",
":=",
"containerNameToLVName",
"(",
"targetName",
")",
"\n",
"poolName",
":=",
"s",
".",
"getOnDiskPoolName",
"(",
")",
"\n",
"output",
",",
"err",
":=",
"shared",
".",
"TryRunCommand",
"(",
"\"",
"\"",
",",
"\"",
"\"",
",",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"poolName",
",",
"storagePoolVolumeAPIEndpointContainers",
",",
"targetLvmName",
")",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"logger",
".",
"Errorf",
"(",
"\"",
"\\\"",
"\\\"",
"\"",
",",
"targetName",
",",
"output",
")",
"\n",
"return",
"err",
"\n",
"}",
"\n",
"}",
"\n\n",
"return",
"nil",
"\n",
"}"
] |
14,361 | all-14362 | [
"GetDockerAuthConfig",
"returns",
"the",
"pull",
"credentials",
"in",
"the",
"auth"
] | [
"func",
"(",
"auth",
"*",
"ASMAuthData",
")",
"GetDockerAuthConfig",
"(",
")",
"<mask>",
".",
"AuthConfig",
"{",
"auth",
".",
"lock",
".",
"RLock",
"(",
")",
"\n",
"defer",
"auth",
".",
"lock",
".",
"RUnlock",
"(",
")",
"\n\n",
"return",
"auth",
".",
"dockerAuthConfig",
"\n",
"}"
] |
14,362 | all-14363 | [
"SetPaperSizeAndDefaultMargins",
"()",
"is",
"a",
"wrapper",
"around",
"gtk_page_setup_set_paper_size_and_default_margins",
"()",
"."
] | [
"func",
"(",
"<mask>",
"*",
"PageSetup",
")",
"SetPaperSizeAndDefaultMargins",
"(",
"size",
"*",
"PaperSize",
")",
"{",
"C",
".",
"gtk_page_setup_set_paper_size_and_default_margins",
"(",
"ps",
".",
"native",
"(",
")",
",",
"size",
".",
"native",
"(",
")",
")",
"\n",
"}"
] |
14,363 | all-14364 | [
"Time",
"returns",
"the",
"time",
"of",
"the",
"event",
"in",
"milliseconds",
"."
] | [
"func",
"(",
"v",
"*",
"EventButton",
")",
"Time",
"(",
")",
"uint32",
"{",
"c",
":=",
"v",
".",
"native",
"(",
")",
".",
"<mask>",
"\n",
"return",
"uint32",
"(",
"c",
")",
"\n",
"}"
] |
14,364 | all-14365 | [
"Put",
"adds",
"the",
"route",
"pattern",
"that",
"matches",
"a",
"PUT",
"http",
"method",
"to",
"execute",
"the",
"handlerFn",
"http",
".",
"HandlerFunc",
"."
] | [
"func",
"(",
"mx",
"*",
"Mux",
")",
"Put",
"(",
"<mask>",
"string",
",",
"handlerFn",
"http",
".",
"HandlerFunc",
")",
"{",
"mx",
".",
"handle",
"(",
"mPUT",
",",
"pattern",
",",
"handlerFn",
")",
"\n",
"}"
] |
14,365 | all-14366 | [
"callsite",
"returns",
"the",
"file",
"name",
"and",
"line",
"number",
"of",
"the",
"callsite",
"to",
"the",
"subsystem",
"logger",
"."
] | [
"func",
"callsite",
"(",
"flag",
"uint32",
")",
"(",
"string",
",",
"int",
")",
"{",
"_",
",",
"file",
",",
"line",
",",
"ok",
":=",
"runtime",
".",
"Caller",
"(",
"calldepth",
")",
"\n",
"if",
"!",
"ok",
"{",
"return",
"\"",
"\"",
",",
"0",
"\n",
"}",
"\n",
"if",
"flag",
"&",
"Lshortfile",
"!=",
"0",
"{",
"short",
":=",
"file",
"\n",
"for",
"i",
":=",
"len",
"(",
"file",
")",
"-",
"1",
";",
"i",
">",
"0",
";",
"i",
"--",
"{",
"if",
"os",
".",
"IsPathSeparator",
"(",
"file",
"[",
"i",
"]",
")",
"{",
"short",
"=",
"file",
"[",
"i",
"+",
"1",
":",
"]",
"\n",
"break",
"\n",
"}",
"\n",
"}",
"\n",
"file",
"=",
"short",
"\n",
"}",
"\n",
"return",
"<mask>",
",",
"line",
"\n",
"}"
] |
14,366 | all-14367 | [
"KnownCreated",
"returns",
"true",
"if",
"the",
"cgroup",
"s",
"known",
"status",
"is",
"CREATED"
] | [
"func",
"(",
"cgroup",
"*",
"CgroupResource",
")",
"KnownCreated",
"(",
")",
"bool",
"{",
"cgroup",
".",
"lock",
".",
"RLock",
"(",
")",
"\n",
"defer",
"cgroup",
".",
"<mask>",
".",
"RUnlock",
"(",
")",
"\n\n",
"return",
"cgroup",
".",
"knownStatusUnsafe",
"==",
"resourcestatus",
".",
"ResourceStatus",
"(",
"CgroupCreated",
")",
"\n",
"}"
] |
14,367 | all-14368 | [
"NewObjectIdWithTime",
"returns",
"a",
"dummy",
"ObjectId",
"with",
"the",
"timestamp",
"part",
"filled",
"with",
"the",
"provided",
"number",
"of",
"seconds",
"from",
"epoch",
"UTC",
"and",
"all",
"other",
"parts",
"filled",
"with",
"zeroes",
".",
"It",
"s",
"not",
"safe",
"to",
"insert",
"a",
"document",
"with",
"an",
"id",
"generated",
"by",
"this",
"method",
"it",
"is",
"useful",
"only",
"for",
"queries",
"to",
"find",
"documents",
"with",
"ids",
"generated",
"before",
"or",
"after",
"the",
"specified",
"timestamp",
"."
] | [
"func",
"NewObjectIdWithTime",
"(",
"t",
"<mask>",
".",
"Time",
")",
"ObjectId",
"{",
"var",
"b",
"[",
"12",
"]",
"byte",
"\n",
"binary",
".",
"BigEndian",
".",
"PutUint32",
"(",
"b",
"[",
":",
"4",
"]",
",",
"uint32",
"(",
"t",
".",
"Unix",
"(",
")",
")",
")",
"\n",
"return",
"ObjectId",
"(",
"string",
"(",
"b",
"[",
":",
"]",
")",
")",
"\n",
"}"
] |
14,368 | all-14369 | [
"/",
"*",
"NewRadio",
"creates",
"a",
"new",
"radio",
"button",
".",
"view",
"-",
"is",
"a",
"View",
"that",
"manages",
"the",
"control",
"parent",
"-",
"is",
"container",
"that",
"keeps",
"the",
"control",
".",
"The",
"same",
"View",
"can",
"be",
"a",
"view",
"and",
"a",
"parent",
"at",
"the",
"same",
"time",
".",
"width",
"-",
"is",
"minimal",
"width",
"of",
"the",
"control",
".",
"title",
"-",
"radio",
"title",
".",
"scale",
"-",
"the",
"way",
"of",
"scaling",
"the",
"control",
"when",
"the",
"parent",
"is",
"resized",
".",
"Use",
"DoNotScale",
"constant",
"if",
"the",
"control",
"should",
"keep",
"its",
"original",
"size",
"."
] | [
"func",
"CreateRadio",
"(",
"parent",
"Control",
",",
"width",
"int",
",",
"title",
"string",
",",
"scale",
"int",
")",
"*",
"Radio",
"{",
"c",
":=",
"new",
"(",
"Radio",
")",
"\n",
"c",
".",
"BaseControl",
"=",
"NewBaseControl",
"(",
")",
"\n\n",
"if",
"width",
"==",
"AutoSize",
"{",
"width",
"=",
"xs",
".",
"Len",
"(",
"title",
")",
"+",
"4",
"\n",
"}",
"\n\n",
"c",
".",
"<mask>",
"=",
"parent",
"\n\n",
"c",
".",
"SetSize",
"(",
"width",
",",
"1",
")",
"// TODO: only one line heigth is supported at that moment",
"\n",
"c",
".",
"SetConstraints",
"(",
"width",
",",
"1",
")",
"\n",
"c",
".",
"SetTitle",
"(",
"title",
")",
"\n",
"c",
".",
"SetTabStop",
"(",
"true",
")",
"\n",
"c",
".",
"SetScale",
"(",
"scale",
")",
"\n\n",
"c",
".",
"onChange",
"=",
"nil",
"\n\n",
"if",
"parent",
"!=",
"nil",
"{",
"parent",
".",
"AddChild",
"(",
"c",
")",
"\n",
"}",
"\n\n",
"return",
"c",
"\n",
"}"
] |
14,369 | all-14370 | [
"Descriptor",
"returns",
"the",
"error",
"descriptor",
"from",
"any",
"error"
] | [
"func",
"Descriptor",
"(",
"in",
"error",
")",
"(",
"desc",
"*",
"ErrDescriptor",
")",
"{",
"err",
":=",
"From",
"(",
"in",
")",
"\n",
"descriptor",
":=",
"Get",
"(",
"err",
".",
"Code",
"(",
")",
")",
"\n",
"if",
"descriptor",
"!=",
"nil",
"{",
"return",
"descriptor",
"\n",
"}",
"\n\n",
"// return a new error descriptor with sane defaults",
"return",
"&",
"ErrDescriptor",
"{",
"MessageFormat",
":",
"err",
".",
"Error",
"(",
")",
",",
"<mask>",
":",
"err",
".",
"Type",
"(",
")",
",",
"Code",
":",
"err",
".",
"Code",
"(",
")",
",",
"}",
"\n",
"}"
] |
14,370 | all-14371 | [
"RemoveGaugeFunc",
"removes",
"a",
"gauge",
"function"
] | [
"func",
"(",
"m",
"*",
"CirconusMetrics",
")",
"RemoveGaugeFunc",
"(",
"metric",
"string",
")",
"{",
"m",
".",
"gfm",
".",
"Lock",
"(",
")",
"\n",
"defer",
"m",
".",
"gfm",
".",
"Unlock",
"(",
")",
"\n",
"<mask>",
"(",
"m",
".",
"gaugeFuncs",
",",
"metric",
")",
"\n",
"}"
] |
14,371 | all-14372 | [
"UnmarshalJSON",
"supports",
"json",
".",
"Unmarshaler",
"interface"
] | [
"func",
"(",
"v",
"*",
"ReleaseObjectParams",
")",
"UnmarshalJSON",
"(",
"<mask>",
"[",
"]",
"byte",
")",
"error",
"{",
"r",
":=",
"jlexer",
".",
"Lexer",
"{",
"Data",
":",
"data",
"}",
"\n",
"easyjsonC5a4559bDecodeGithubComChromedpCdprotoRuntime10",
"(",
"&",
"r",
",",
"v",
")",
"\n",
"return",
"r",
".",
"Error",
"(",
")",
"\n",
"}"
] |
14,372 | all-14373 | [
"GetPrimaryMonitor",
"is",
"a",
"wrapper",
"around",
"gdk_display_get_primary_monitor",
"()",
"."
] | [
"func",
"(",
"v",
"*",
"Display",
")",
"GetPrimaryMonitor",
"(",
")",
"(",
"*",
"Monitor",
",",
"<mask>",
")",
"{",
"c",
":=",
"C",
".",
"gdk_display_get_primary_monitor",
"(",
"v",
".",
"native",
"(",
")",
")",
"\n",
"if",
"c",
"==",
"nil",
"{",
"return",
"nil",
",",
"nilPtrErr",
"\n",
"}",
"\n\n",
"return",
"&",
"Monitor",
"{",
"glib",
".",
"Take",
"(",
"unsafe",
".",
"Pointer",
"(",
"c",
")",
")",
"}",
",",
"nil",
"\n",
"}"
] |
14,373 | all-14374 | [
"Insert",
"()",
"is",
"a",
"wrapper",
"around",
"gtk_text_buffer_insert",
"()",
"."
] | [
"func",
"(",
"v",
"*",
"TextBuffer",
")",
"Insert",
"(",
"iter",
"*",
"TextIter",
",",
"<mask>",
"string",
")",
"{",
"cstr",
":=",
"C",
".",
"CString",
"(",
"text",
")",
"\n",
"defer",
"C",
".",
"free",
"(",
"unsafe",
".",
"Pointer",
"(",
"cstr",
")",
")",
"\n",
"C",
".",
"gtk_text_buffer_insert",
"(",
"v",
".",
"native",
"(",
")",
",",
"(",
"*",
"C",
".",
"GtkTextIter",
")",
"(",
"iter",
")",
",",
"(",
"*",
"C",
".",
"gchar",
")",
"(",
"cstr",
")",
",",
"C",
".",
"gint",
"(",
"len",
"(",
"text",
")",
")",
")",
"\n",
"}"
] |
14,374 | all-14375 | [
"ActiveAlerts",
"returns",
"a",
"slice",
"of",
"active",
"alerts",
"."
] | [
"func",
"(",
"r",
"*",
"AlertingRule",
")",
"ActiveAlerts",
"(",
")",
"[",
"]",
"*",
"Alert",
"{",
"<mask>",
"res",
"[",
"]",
"*",
"Alert",
"\n",
"for",
"_",
",",
"a",
":=",
"range",
"r",
".",
"currentAlerts",
"(",
")",
"{",
"if",
"a",
".",
"ResolvedAt",
".",
"IsZero",
"(",
")",
"{",
"res",
"=",
"append",
"(",
"res",
",",
"a",
")",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"res",
"\n",
"}"
] |
14,375 | all-14376 | [
"List",
"the",
"nodes",
"of",
"the",
"cluster",
"."
] | [
"func",
"List",
"(",
"state",
"*",
"state",
".",
"State",
")",
"(",
"[",
"]",
"api",
".",
"ClusterMember",
",",
"error",
")",
"{",
"addresses",
":=",
"[",
"]",
"string",
"{",
"}",
"// Addresses of database nodes",
"\n",
"err",
":=",
"state",
".",
"Node",
".",
"Transaction",
"(",
"func",
"(",
"tx",
"*",
"db",
".",
"NodeTx",
")",
"error",
"{",
"nodes",
",",
"err",
":=",
"tx",
".",
"RaftNodes",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"errors",
".",
"Wrap",
"(",
"err",
",",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"for",
"_",
",",
"node",
":=",
"range",
"nodes",
"{",
"addresses",
"=",
"append",
"(",
"addresses",
",",
"node",
".",
"Address",
")",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"var",
"nodes",
"[",
"]",
"db",
".",
"NodeInfo",
"\n",
"var",
"offlineThreshold",
"time",
".",
"Duration",
"\n\n",
"err",
"=",
"state",
".",
"Cluster",
".",
"Transaction",
"(",
"func",
"(",
"tx",
"*",
"db",
".",
"ClusterTx",
")",
"error",
"{",
"nodes",
",",
"err",
"=",
"tx",
".",
"Nodes",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"offlineThreshold",
",",
"err",
"=",
"tx",
".",
"NodeOfflineThreshold",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"return",
"nil",
"\n",
"}",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"result",
":=",
"make",
"(",
"[",
"]",
"api",
".",
"ClusterMember",
",",
"len",
"(",
"nodes",
")",
")",
"\n",
"now",
":=",
"time",
".",
"Now",
"(",
")",
"\n",
"version",
":=",
"nodes",
"[",
"0",
"]",
".",
"Version",
"(",
")",
"\n",
"for",
"i",
",",
"node",
":=",
"range",
"nodes",
"{",
"result",
"[",
"i",
"]",
".",
"ServerName",
"=",
"node",
".",
"Name",
"\n",
"result",
"[",
"i",
"]",
".",
"URL",
"=",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"node",
".",
"Address",
")",
"\n",
"result",
"[",
"i",
"]",
".",
"Database",
"=",
"shared",
".",
"StringInSlice",
"(",
"node",
".",
"Address",
",",
"addresses",
")",
"\n",
"if",
"node",
".",
"IsOffline",
"(",
"offlineThreshold",
")",
"{",
"result",
"[",
"i",
"]",
".",
"Status",
"=",
"\"",
"\"",
"\n",
"result",
"[",
"i",
"]",
".",
"Message",
"=",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"now",
".",
"Sub",
"(",
"node",
".",
"Heartbeat",
")",
")",
"\n",
"}",
"else",
"{",
"result",
"[",
"i",
"]",
".",
"<mask>",
"=",
"\"",
"\"",
"\n",
"result",
"[",
"i",
"]",
".",
"Message",
"=",
"\"",
"\"",
"\n",
"}",
"\n\n",
"n",
",",
"err",
":=",
"util",
".",
"CompareVersions",
"(",
"version",
",",
"node",
".",
"Version",
"(",
")",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"result",
"[",
"i",
"]",
".",
"Status",
"=",
"\"",
"\"",
"\n",
"result",
"[",
"i",
"]",
".",
"Message",
"=",
"\"",
"\"",
"\n",
"continue",
"\n",
"}",
"\n\n",
"if",
"n",
"==",
"1",
"{",
"// This node's version is lower, which means the",
"// version that the previous node in the loop has been",
"// upgraded.",
"version",
"=",
"node",
".",
"Version",
"(",
")",
"\n",
"}",
"\n",
"}",
"\n\n",
"// Update the state of online nodes that have been upgraded and whose",
"// schema is more recent than the rest of the nodes.",
"for",
"i",
",",
"node",
":=",
"range",
"nodes",
"{",
"if",
"result",
"[",
"i",
"]",
".",
"Status",
"!=",
"\"",
"\"",
"{",
"continue",
"\n",
"}",
"\n",
"n",
",",
"err",
":=",
"util",
".",
"CompareVersions",
"(",
"version",
",",
"node",
".",
"Version",
"(",
")",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"continue",
"\n",
"}",
"\n",
"if",
"n",
"==",
"2",
"{",
"result",
"[",
"i",
"]",
".",
"Status",
"=",
"\"",
"\"",
"\n",
"result",
"[",
"i",
"]",
".",
"Message",
"=",
"\"",
"\"",
"\n",
"}",
"\n",
"}",
"\n\n",
"return",
"result",
",",
"nil",
"\n",
"}"
] |
14,376 | all-14377 | [
"newPlainText",
"creates",
"and",
"returns",
"a",
"plain",
"text",
"."
] | [
"func",
"newPlainText",
"(",
"ln",
"*",
"line",
",",
"rslt",
"*",
"result",
",",
"src",
"*",
"source",
",",
"parent",
"<mask>",
",",
"opts",
"*",
"Options",
")",
"*",
"plainText",
"{",
"return",
"&",
"plainText",
"{",
"elementBase",
":",
"newElementBase",
"(",
"ln",
",",
"rslt",
",",
"src",
",",
"parent",
",",
"opts",
")",
",",
"insertBr",
":",
"ln",
".",
"tokens",
"[",
"0",
"]",
"==",
"doublePipe",
",",
"}",
"\n",
"}"
] |
14,377 | all-14378 | [
"Bring",
"up",
"a",
"particular",
"network",
"interface",
".",
"This",
"is",
"identical",
"to",
"running",
":",
"ip",
"link",
"set",
"dev",
"$name",
"up"
] | [
"func",
"NetworkLinkUp",
"(",
"iface",
"*",
"<mask>",
".",
"Interface",
")",
"error",
"{",
"s",
",",
"err",
":=",
"getNetlinkSocket",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"defer",
"s",
".",
"Close",
"(",
")",
"\n\n",
"wb",
":=",
"newNetlinkRequest",
"(",
"syscall",
".",
"RTM_NEWLINK",
",",
"syscall",
".",
"NLM_F_ACK",
")",
"\n\n",
"msg",
":=",
"newIfInfomsg",
"(",
"syscall",
".",
"AF_UNSPEC",
")",
"\n",
"msg",
".",
"Index",
"=",
"int32",
"(",
"iface",
".",
"Index",
")",
"\n",
"msg",
".",
"Flags",
"=",
"syscall",
".",
"IFF_UP",
"\n",
"msg",
".",
"Change",
"=",
"syscall",
".",
"IFF_UP",
"\n",
"wb",
".",
"AddData",
"(",
"msg",
")",
"\n\n",
"if",
"err",
":=",
"s",
".",
"Send",
"(",
"wb",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"return",
"s",
".",
"HandleAck",
"(",
"wb",
".",
"Seq",
")",
"\n",
"}"
] |
14,378 | all-14379 | [
"WithApp",
"adds",
"the",
"app",
"to",
"the",
"get",
"apps",
"app",
"routes",
"params"
] | [
"func",
"(",
"o",
"*",
"GetAppsAppRoutesParams",
")",
"WithApp",
"(",
"app",
"string",
")",
"*",
"GetAppsAppRoutesParams",
"{",
"o",
".",
"SetApp",
"(",
"app",
")",
"\n",
"<mask>",
"o",
"\n",
"}"
] |
14,379 | all-14380 | [
"HasModifiedBy",
"returns",
"a",
"boolean",
"if",
"a",
"field",
"has",
"been",
"set",
"."
] | [
"func",
"(",
"s",
"*",
"SyntheticsTest",
")",
"HasModifiedBy",
"(",
")",
"bool",
"{",
"if",
"s",
"!=",
"nil",
"&&",
"s",
".",
"ModifiedBy",
"!=",
"nil",
"{",
"return",
"<mask>",
"\n",
"}",
"\n\n",
"return",
"false",
"\n",
"}"
] |
14,380 | all-14381 | [
"Read",
"implements",
"the",
"io",
".",
"Reader",
"interface"
] | [
"func",
"(",
"rws",
"*",
"ReadWriteSeeker",
")",
"Read",
"(",
"b",
"[",
"]",
"byte",
")",
"(",
"n",
"int",
",",
"err",
"error",
")",
"{",
"if",
"rws",
".",
"pos",
">=",
"len",
"(",
"rws",
".",
"buf",
")",
"{",
"return",
"0",
",",
"io",
".",
"EOF",
"\n",
"}",
"\n",
"n",
"=",
"copy",
"(",
"b",
",",
"rws",
".",
"buf",
"[",
"rws",
".",
"<mask>",
":",
"]",
")",
"\n",
"rws",
".",
"pos",
"+=",
"n",
"\n",
"return",
"\n",
"}"
] |
14,381 | all-14382 | [
"title",
":",
"api",
"info",
"path",
":",
"/",
"info",
"method",
":",
"GET",
"produce",
":",
"application",
"/",
"json",
"responses",
":",
"200",
":",
"OK"
] | [
"func",
"info",
"(",
"w",
"http",
".",
"ResponseWriter",
",",
"r",
"*",
"http",
".",
"Request",
")",
"error",
"{",
"data",
":=",
"<mask>",
"[",
"string",
"]",
"string",
"{",
"}",
"\n",
"data",
"[",
"\"",
"\"",
"]",
"=",
"Version",
"\n",
"w",
".",
"Header",
"(",
")",
".",
"Set",
"(",
"\"",
"\"",
",",
"\"",
"\"",
")",
"\n",
"return",
"json",
".",
"NewEncoder",
"(",
"w",
")",
".",
"Encode",
"(",
"data",
")",
"\n",
"}"
] |
14,382 | all-14383 | [
"GetTitle",
"returns",
"the",
"Title",
"field",
"if",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"."
] | [
"func",
"(",
"a",
"*",
"AlertGraphDefinition",
")",
"GetTitle",
"(",
")",
"string",
"{",
"if",
"a",
"==",
"nil",
"||",
"a",
".",
"Title",
"==",
"nil",
"{",
"<mask>",
"\"",
"\"",
"\n",
"}",
"\n",
"return",
"*",
"a",
".",
"Title",
"\n",
"}"
] |
14,383 | all-14384 | [
"SetLog",
"设置logrus日志配置,logPath参数表示记录日志的路径,logFileName表示日志名称前缀"
] | [
"func",
"SetLog",
"(",
"logPath",
"string",
",",
"logFileName",
"string",
")",
"{",
"if",
"Log",
"!=",
"nil",
"{",
"return",
"\n",
"}",
"\n",
"Log",
"=",
"logrus",
".",
"New",
"(",
")",
"\n",
"maxAge",
":=",
"time",
".",
"Hour",
"*",
"24",
"*",
"10",
"\n",
"rotationTime",
":=",
"time",
".",
"Hour",
"*",
"24",
"\n",
"//info用于记录http状态等一般日期",
"infoLogPaht",
":=",
"<mask>",
".",
"Join",
"(",
"logPath",
",",
"logFileName",
"+",
"\"",
"\"",
")",
"\n",
"infoWriter",
",",
"err",
":=",
"rotatelogs",
".",
"New",
"(",
"infoLogPaht",
"+",
"\"",
"\"",
",",
"rotatelogs",
".",
"WithLinkName",
"(",
"infoLogPaht",
")",
",",
"// 生成软链,指向最新日志文件",
"rotatelogs",
".",
"WithMaxAge",
"(",
"maxAge",
")",
",",
"// 文件最大保存时间",
"rotatelogs",
".",
"WithRotationTime",
"(",
"rotationTime",
")",
",",
"// 日志切割时间间隔",
")",
"\n",
"//error记录告警和错误信息",
"errorLogPaht",
":=",
"path",
".",
"Join",
"(",
"logPath",
",",
"logFileName",
"+",
"\"",
"\"",
")",
"\n",
"errorWriter",
",",
"err",
":=",
"rotatelogs",
".",
"New",
"(",
"errorLogPaht",
"+",
"\"",
"\"",
",",
"rotatelogs",
".",
"WithLinkName",
"(",
"errorLogPaht",
")",
",",
"// 生成软链,指向最新日志文件",
"rotatelogs",
".",
"WithMaxAge",
"(",
"maxAge",
")",
",",
"// 文件最大保存时间",
"rotatelogs",
".",
"WithRotationTime",
"(",
"rotationTime",
")",
",",
"// 日志切割时间间隔",
")",
"\n\n",
"if",
"err",
"!=",
"nil",
"{",
"logrus",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"errors",
".",
"WithStack",
"(",
"err",
")",
")",
"\n",
"}",
"\n",
"// 为不同级别设置不同的输出文件",
"lfHook",
":=",
"lfshook",
".",
"NewHook",
"(",
"lfshook",
".",
"WriterMap",
"{",
"logrus",
".",
"InfoLevel",
":",
"infoWriter",
",",
"logrus",
".",
"WarnLevel",
":",
"errorWriter",
",",
"logrus",
".",
"ErrorLevel",
":",
"errorWriter",
",",
"}",
",",
"&",
"logrus",
".",
"TextFormatter",
"{",
"TimestampFormat",
":",
"\"",
"\"",
",",
"}",
")",
"\n",
"Log",
".",
"AddHook",
"(",
"lfHook",
")",
"\n",
"}"
] |
14,384 | all-14385 | [
"updateTaskUnsafe",
"determines",
"if",
"a",
"new",
"transition",
"needs",
"to",
"be",
"applied",
"to",
"the",
"referenced",
"task",
"and",
"if",
"needed",
"applies",
"it",
".",
"It",
"should",
"not",
"be",
"called",
"anywhere",
"but",
"from",
"AddTask",
"and",
"is",
"protected",
"by",
"the",
"tasksLock",
"lock",
"there",
"."
] | [
"func",
"(",
"engine",
"*",
"DockerTaskEngine",
")",
"updateTaskUnsafe",
"(",
"task",
"*",
"apitask",
".",
"Task",
",",
"update",
"*",
"apitask",
".",
"<mask>",
")",
"{",
"managedTask",
",",
"ok",
":=",
"engine",
".",
"managedTasks",
"[",
"task",
".",
"Arn",
"]",
"\n",
"if",
"!",
"ok",
"{",
"seelog",
".",
"Criticalf",
"(",
"\"",
"\"",
",",
"task",
".",
"Arn",
")",
"\n",
"return",
"\n",
"}",
"\n",
"// Keep the lock because sequence numbers cannot be correct unless they are",
"// also read in the order addtask was called",
"// This does block the engine's ability to ingest any new events (including",
"// stops for past tasks, ack!), but this is necessary for correctness",
"updateDesiredStatus",
":=",
"update",
".",
"GetDesiredStatus",
"(",
")",
"\n",
"seelog",
".",
"Debugf",
"(",
"\"",
"\"",
",",
"task",
".",
"Arn",
",",
"updateDesiredStatus",
".",
"String",
"(",
")",
",",
"update",
".",
"StopSequenceNumber",
")",
"\n",
"managedTask",
".",
"emitACSTransition",
"(",
"acsTransition",
"{",
"desiredStatus",
":",
"updateDesiredStatus",
",",
"seqnum",
":",
"update",
".",
"StopSequenceNumber",
",",
"}",
")",
"\n",
"seelog",
".",
"Debugf",
"(",
"\"",
"\"",
",",
"task",
".",
"Arn",
",",
"updateDesiredStatus",
".",
"String",
"(",
")",
",",
"update",
".",
"StopSequenceNumber",
")",
"\n",
"}"
] |
14,385 | all-14386 | [
"HandleAll",
"checks",
"all",
"orgs",
"and",
"repos",
"that",
"enabled",
"this",
"plugin",
"for",
"open",
"PRs",
"to",
"determine",
"if",
"the",
"needs",
"-",
"rebase",
"label",
"needs",
"to",
"be",
"added",
"or",
"removed",
".",
"It",
"depends",
"on",
"GitHub",
"s",
"mergeability",
"check",
"to",
"decide",
"the",
"need",
"for",
"a",
"rebase",
"."
] | [
"func",
"HandleAll",
"(",
"log",
"*",
"logrus",
".",
"Entry",
",",
"ghc",
"githubClient",
",",
"config",
"*",
"plugins",
".",
"Configuration",
")",
"error",
"{",
"log",
".",
"Info",
"(",
"\"",
"\"",
")",
"\n",
"orgs",
",",
"repos",
":=",
"config",
".",
"EnabledReposForExternalPlugin",
"(",
"PluginName",
")",
"\n",
"if",
"len",
"(",
"orgs",
")",
"==",
"0",
"&&",
"len",
"(",
"repos",
")",
"==",
"0",
"{",
"log",
".",
"Warnf",
"(",
"\"",
"\"",
",",
"PluginName",
")",
"\n",
"return",
"nil",
"\n",
"}",
"\n",
"var",
"buf",
"bytes",
".",
"Buffer",
"\n",
"fmt",
".",
"Fprint",
"(",
"&",
"buf",
",",
"\"",
"\"",
")",
"\n",
"for",
"_",
",",
"org",
":=",
"range",
"orgs",
"{",
"fmt",
".",
"Fprintf",
"(",
"&",
"buf",
",",
"\"",
"\\\"",
"\\\"",
"\"",
",",
"org",
")",
"\n",
"}",
"\n",
"for",
"_",
",",
"repo",
":=",
"range",
"repos",
"{",
"fmt",
".",
"Fprintf",
"(",
"&",
"buf",
",",
"\"",
"\\\"",
"\\\"",
"\"",
",",
"repo",
")",
"\n",
"}",
"\n",
"prs",
",",
"err",
":=",
"search",
"(",
"context",
".",
"Background",
"(",
")",
",",
"log",
",",
"ghc",
",",
"buf",
".",
"String",
"(",
")",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"log",
".",
"Infof",
"(",
"\"",
"\"",
",",
"len",
"(",
"prs",
")",
")",
"\n\n",
"for",
"_",
",",
"pr",
":=",
"range",
"prs",
"{",
"// Skip PRs that are calculating mergeability. They will be updated by event or next loop.",
"if",
"pr",
".",
"Mergeable",
"==",
"githubql",
".",
"MergeableStateUnknown",
"{",
"continue",
"\n",
"}",
"\n",
"org",
":=",
"string",
"(",
"pr",
".",
"Repository",
".",
"Owner",
".",
"Login",
")",
"\n",
"repo",
":=",
"string",
"(",
"pr",
".",
"Repository",
".",
"Name",
")",
"\n",
"num",
":=",
"int",
"(",
"pr",
".",
"Number",
")",
"\n",
"l",
":=",
"log",
".",
"WithFields",
"(",
"logrus",
".",
"Fields",
"{",
"\"",
"\"",
":",
"org",
",",
"\"",
"\"",
":",
"repo",
",",
"\"",
"\"",
":",
"num",
",",
"}",
")",
"\n",
"hasLabel",
":=",
"false",
"\n",
"for",
"_",
",",
"label",
":=",
"range",
"pr",
".",
"Labels",
".",
"Nodes",
"{",
"if",
"label",
".",
"Name",
"==",
"labels",
".",
"NeedsRebase",
"{",
"hasLabel",
"=",
"true",
"\n",
"<mask>",
"\n",
"}",
"\n",
"}",
"\n",
"err",
":=",
"takeAction",
"(",
"l",
",",
"ghc",
",",
"org",
",",
"repo",
",",
"num",
",",
"string",
"(",
"pr",
".",
"Author",
".",
"Login",
")",
",",
"hasLabel",
",",
"pr",
".",
"Mergeable",
"==",
"githubql",
".",
"MergeableStateMergeable",
",",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"l",
".",
"WithError",
"(",
"err",
")",
".",
"Error",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
] |
14,386 | all-14387 | [
"OnChange",
"appends",
"callback",
"to",
"the",
"functions",
"that",
"will",
"be",
"called",
"whenever",
"the",
"routes",
"are",
"recalculated",
"."
] | [
"func",
"(",
"r",
"*",
"routes",
")",
"OnChange",
"(",
"<mask>",
"func",
"(",
")",
")",
"{",
"r",
".",
"Lock",
"(",
")",
"\n",
"defer",
"r",
".",
"Unlock",
"(",
")",
"\n",
"r",
".",
"onChange",
"=",
"append",
"(",
"r",
".",
"onChange",
",",
"callback",
")",
"\n",
"}"
] |
14,387 | all-14388 | [
"Observe",
"returns",
"a",
"channel",
"that",
"reliably",
"observes",
"ordered",
"leader",
"proposals",
"as",
"GetResponse",
"values",
"on",
"every",
"current",
"elected",
"leader",
"key",
".",
"It",
"will",
"not",
"necessarily",
"fetch",
"all",
"historical",
"leader",
"updates",
"but",
"will",
"always",
"post",
"the",
"most",
"recent",
"leader",
"value",
".",
"The",
"channel",
"closes",
"when",
"the",
"context",
"is",
"canceled",
"or",
"the",
"underlying",
"watcher",
"is",
"otherwise",
"disrupted",
"."
] | [
"func",
"(",
"e",
"*",
"Election",
")",
"Observe",
"(",
"ctx",
"<mask>",
".",
"Context",
")",
"<-",
"chan",
"v3",
".",
"GetResponse",
"{",
"retc",
":=",
"make",
"(",
"chan",
"v3",
".",
"GetResponse",
")",
"\n",
"go",
"e",
".",
"observe",
"(",
"ctx",
",",
"retc",
")",
"\n",
"return",
"retc",
"\n",
"}"
] |
14,388 | all-14389 | [
"NewGoogleClientFromSecret",
"creates",
"a",
"google",
"client",
"by",
"reading",
"credentials",
"from",
"a",
"mounted",
"GoogleSecret",
".",
"You",
"may",
"pass",
"for",
"bucket",
"in",
"which",
"case",
"it",
"will",
"read",
"the",
"bucket",
"from",
"the",
"secret",
"."
] | [
"func",
"NewGoogleClientFromSecret",
"(",
"bucket",
"string",
")",
"(",
"<mask>",
",",
"error",
")",
"{",
"var",
"err",
"error",
"\n",
"if",
"bucket",
"==",
"\"",
"\"",
"{",
"bucket",
",",
"err",
"=",
"readSecretFile",
"(",
"\"",
"\"",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"}",
"\n",
"cred",
",",
"err",
":=",
"readSecretFile",
"(",
"\"",
"\"",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"var",
"opts",
"[",
"]",
"option",
".",
"ClientOption",
"\n",
"if",
"cred",
"!=",
"\"",
"\"",
"{",
"opts",
"=",
"append",
"(",
"opts",
",",
"option",
".",
"WithCredentialsFile",
"(",
"secretFile",
"(",
"\"",
"\"",
")",
")",
")",
"\n",
"}",
"else",
"{",
"opts",
"=",
"append",
"(",
"opts",
",",
"option",
".",
"WithTokenSource",
"(",
"google",
".",
"ComputeTokenSource",
"(",
"\"",
"\"",
")",
")",
")",
"\n",
"}",
"\n",
"return",
"NewGoogleClient",
"(",
"bucket",
",",
"opts",
")",
"\n",
"}"
] |
14,389 | all-14390 | [
"NewOutgoingVoice",
"creates",
"a",
"new",
"outgoing",
"voice",
"note",
"."
] | [
"func",
"(",
"api",
"*",
"TelegramBotAPI",
")",
"NewOutgoingVoice",
"(",
"recipient",
"Recipient",
",",
"fileName",
"string",
",",
"reader",
"<mask>",
".",
"Reader",
")",
"*",
"OutgoingVoice",
"{",
"return",
"&",
"OutgoingVoice",
"{",
"outgoingMessageBase",
":",
"outgoingMessageBase",
"{",
"outgoingBase",
":",
"outgoingBase",
"{",
"api",
":",
"api",
",",
"Recipient",
":",
"recipient",
",",
"}",
",",
"}",
",",
"outgoingFileBase",
":",
"outgoingFileBase",
"{",
"fileName",
":",
"fileName",
",",
"r",
":",
"reader",
",",
"}",
",",
"}",
"\n",
"}"
] |
14,390 | all-14391 | [
"GetContainerBackups",
"returns",
"a",
"list",
"of",
"backups",
"for",
"the",
"container"
] | [
"func",
"(",
"r",
"*",
"ProtocolLXD",
")",
"GetContainerBackups",
"(",
"containerName",
"string",
")",
"(",
"[",
"]",
"api",
".",
"ContainerBackup",
",",
"error",
")",
"{",
"if",
"!",
"r",
".",
"HasExtension",
"(",
"\"",
"\"",
")",
"{",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\\\"",
"\\\"",
"\"",
")",
"\n",
"}",
"\n\n",
"// Fetch the raw value",
"backups",
":=",
"[",
"]",
"api",
".",
"ContainerBackup",
"{",
"}",
"\n\n",
"_",
",",
"err",
":=",
"r",
".",
"queryStruct",
"(",
"\"",
"\"",
",",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"<mask>",
".",
"QueryEscape",
"(",
"containerName",
")",
")",
",",
"nil",
",",
"\"",
"\"",
",",
"&",
"backups",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"return",
"backups",
",",
"nil",
"\n",
"}"
] |
14,391 | all-14392 | [
"HandleOnly",
"specific",
"type",
"of",
"event",
"."
] | [
"func",
"HandleOnly",
"(",
"h",
"Handler",
",",
"names",
"...",
"string",
")",
"<mask>",
"{",
"return",
"HandlerFunc",
"(",
"func",
"(",
"e",
"Event",
")",
"{",
"for",
"_",
",",
"name",
":=",
"range",
"names",
"{",
"if",
"e",
".",
"Name",
"(",
")",
"==",
"name",
"{",
"h",
".",
"Handle",
"(",
"e",
")",
"\n",
"break",
"\n",
"}",
"\n",
"}",
"\n",
"}",
")",
"\n",
"}"
] |
14,392 | all-14393 | [
"writeMessage",
"writes",
"an",
"IRC",
"message",
"to",
"the",
"connection",
"."
] | [
"func",
"(",
"c",
"<mask>",
")",
"writeMessage",
"(",
"m",
"irc",
".",
"Message",
")",
"error",
"{",
"buf",
",",
"err",
":=",
"m",
".",
"Encode",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"&&",
"err",
"!=",
"irc",
".",
"ErrTruncated",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"}",
"\n\n",
"if",
"err",
":=",
"c",
".",
"conn",
".",
"SetWriteDeadline",
"(",
"time",
".",
"Now",
"(",
")",
".",
"Add",
"(",
"c",
".",
"writeTimeout",
")",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"}",
"\n\n",
"sz",
",",
"err",
":=",
"c",
".",
"rw",
".",
"WriteString",
"(",
"buf",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"if",
"sz",
"!=",
"len",
"(",
"buf",
")",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"if",
"err",
":=",
"c",
".",
"rw",
".",
"Flush",
"(",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"}",
"\n\n",
"log",
".",
"Printf",
"(",
"\"",
"\"",
",",
"c",
".",
"nick",
",",
"strings",
".",
"TrimRight",
"(",
"buf",
",",
"\"",
"\\r",
"\\n",
"\"",
")",
")",
"\n",
"return",
"nil",
"\n",
"}"
] |
14,393 | all-14394 | [
"methodNotAllowedHandler",
"is",
"a",
"helper",
"function",
"to",
"respond",
"with",
"a",
"405",
"method",
"not",
"allowed",
"."
] | [
"func",
"methodNotAllowedHandler",
"(",
"w",
"<mask>",
".",
"ResponseWriter",
",",
"r",
"*",
"http",
".",
"Request",
")",
"{",
"w",
".",
"WriteHeader",
"(",
"405",
")",
"\n",
"w",
".",
"Write",
"(",
"nil",
")",
"\n",
"}"
] |
14,394 | all-14395 | [
"MarshalJSON",
"supports",
"json",
".",
"Marshaler",
"interface"
] | [
"func",
"(",
"v",
"SetInspectedNodeParams",
")",
"MarshalJSON",
"(",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"w",
":=",
"jwriter",
".",
"Writer",
"{",
"}",
"\n",
"easyjsonC5a4559bEncodeGithubComChromedpCdprotoDom6",
"(",
"&",
"w",
",",
"v",
")",
"\n",
"return",
"w",
".",
"<mask>",
".",
"BuildBytes",
"(",
")",
",",
"w",
".",
"Error",
"\n",
"}"
] |
14,395 | all-14396 | [
"ToError",
"returns",
"the",
"error",
"for",
"the",
"status",
".",
"Returns",
"nil",
"if",
"success",
"."
] | [
"func",
"(",
"s",
"Status",
")",
"ToError",
"(",
")",
"error",
"{",
"if",
"s",
"==",
"STATUS_SUCCESS",
"{",
"return",
"nil",
"\n",
"}",
"\n",
"return",
"<mask>",
".",
"New",
"(",
"s",
".",
"String",
"(",
")",
")",
"\n",
"}"
] |
14,396 | all-14397 | [
"NewSeededFormats",
"creates",
"a",
"new",
"formats",
"registry"
] | [
"func",
"NewSeededFormats",
"(",
"seeds",
"[",
"]",
"knownFormat",
",",
"normalizer",
"NameNormalizer",
")",
"Registry",
"{",
"if",
"normalizer",
"==",
"nil",
"{",
"normalizer",
"=",
"DefaultNameNormalizer",
"\n",
"}",
"\n",
"// copy here, don't modify original",
"d",
":=",
"<mask>",
"(",
"[",
"]",
"knownFormat",
"(",
"nil",
")",
",",
"seeds",
"...",
")",
"\n",
"return",
"&",
"defaultFormats",
"{",
"data",
":",
"d",
",",
"normalizeName",
":",
"normalizer",
",",
"}",
"\n",
"}"
] |
14,397 | all-14398 | [
"fill",
"fills",
"the",
"decodeReader",
"s",
"window"
] | [
"func",
"(",
"d",
"*",
"decodeReader",
")",
"fill",
"(",
")",
"{",
"if",
"d",
".",
"err",
"!=",
"nil",
"{",
"return",
"\n",
"}",
"\n",
"var",
"fl",
"[",
"]",
"*",
"filterBlock",
"\n",
"fl",
",",
"d",
".",
"err",
"=",
"d",
".",
"dec",
".",
"fill",
"(",
"&",
"d",
".",
"win",
")",
"// fill window using decoder",
"\n",
"for",
"_",
",",
"f",
":=",
"<mask>",
"fl",
"{",
"err",
":=",
"d",
".",
"queueFilter",
"(",
"f",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"d",
".",
"err",
"=",
"err",
"\n",
"return",
"\n",
"}",
"\n",
"}",
"\n",
"}"
] |
14,398 | all-14399 | [
"AuthenticateSession",
"will",
"mark",
"the",
"session",
"and",
"user",
"object",
"as",
"authenticated",
".",
"Then",
"the",
"Login",
"()",
"user",
"function",
"will",
"be",
"called",
".",
"This",
"function",
"should",
"be",
"called",
"after",
"you",
"have",
"validated",
"a",
"user",
"."
] | [
"func",
"AuthenticateSession",
"(",
"s",
"sessions",
".",
"<mask>",
",",
"user",
"User",
")",
"error",
"{",
"user",
".",
"Login",
"(",
")",
"\n",
"return",
"UpdateUser",
"(",
"s",
",",
"user",
")",
"\n",
"}"
] |
14,399 | all-14400 | [
"Push",
"visited",
"value",
"on",
"top",
"of",
"the",
"stack",
".",
"If",
"the",
"value",
"was",
"not",
"visited",
"return",
"false",
"and",
"push",
"nothing",
"."
] | [
"func",
"(",
"v",
"*",
"visitor",
")",
"push",
"(",
"val",
"reflect",
".",
"Value",
")",
"bool",
"{",
"ptr",
":=",
"val",
".",
"Pointer",
"(",
")",
"\n",
"v",
".",
"L",
".",
"RawGeti",
"(",
"lua",
".",
"LUA_REGISTRYINDEX",
",",
"v",
".",
"index",
")",
"\n",
"v",
".",
"L",
".",
"RawGeti",
"(",
"-",
"1",
",",
"int",
"(",
"ptr",
")",
")",
"\n",
"if",
"v",
".",
"L",
".",
"IsNil",
"(",
"-",
"1",
")",
"{",
"// Not visited.",
"v",
".",
"L",
".",
"Pop",
"(",
"2",
")",
"\n",
"return",
"false",
"\n",
"}",
"\n",
"v",
".",
"L",
".",
"Replace",
"(",
"-",
"2",
")",
"\n",
"return",
"<mask>",
"\n",
"}"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.