id
int32 0
25.3k
| idx
stringlengths 5
9
| nl_tokens
sequencelengths 1
418
| pl_tokens
sequencelengths 22
4.98k
|
---|---|---|---|
14,100 | all-14101 | [
"Size",
"returns",
"the",
"size",
"of",
"the",
"image",
"."
] | [
"func",
"(",
"i",
"*",
"Image",
")",
"Size",
"(",
")",
"(",
"<mask>",
",",
"height",
"int",
")",
"{",
"s",
":=",
"i",
".",
"Bounds",
"(",
")",
".",
"Size",
"(",
")",
"\n",
"return",
"s",
".",
"X",
",",
"s",
".",
"Y",
"\n",
"}"
] |
14,101 | all-14102 | [
"diskSpecForExtend",
"checks",
"to",
"make",
"sure",
"that",
"a",
"disk",
"is",
"available",
"to",
"be",
"used",
"to",
"extend",
"a",
"VMFS",
"datastore",
"specifically",
"in",
"its",
"entirety",
"and",
"returns",
"a",
"respective",
"VmfsDatastoreExtendSpec",
"if",
"it",
"is",
".",
"An",
"error",
"is",
"returned",
"if",
"it",
"s",
"not",
"."
] | [
"func",
"diskSpecForExtend",
"(",
"dss",
"*",
"object",
".",
"HostDatastoreSystem",
",",
"ds",
"*",
"object",
".",
"Datastore",
",",
"name",
"string",
")",
"(",
"*",
"types",
".",
"VmfsDatastoreExtendSpec",
",",
"error",
")",
"{",
"disk",
",",
"err",
":=",
"availableScsiDisk",
"(",
"dss",
",",
"name",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"props",
",",
"err",
":=",
"datastore",
".",
"Properties",
"(",
"ds",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"ds",
".",
"Reference",
"(",
")",
".",
"Value",
",",
"err",
")",
"\n",
"}",
"\n\n",
"ctx",
",",
"cancel",
":=",
"context",
".",
"WithTimeout",
"(",
"context",
".",
"Background",
"(",
")",
",",
"defaultAPITimeout",
")",
"\n",
"defer",
"cancel",
"(",
")",
"\n",
"options",
",",
"err",
":=",
"queryVmfsDatastoreExtendOptions",
"(",
"ctx",
",",
"dss",
",",
"ds",
",",
"disk",
".",
"DevicePath",
",",
"true",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"name",
",",
"err",
")",
"\n",
"}",
"\n",
"var",
"option",
"*",
"types",
".",
"VmfsDatastoreOption",
"\n",
"for",
"_",
",",
"o",
":=",
"range",
"options",
"{",
"if",
"_",
",",
"ok",
":=",
"o",
".",
"Info",
".",
"(",
"*",
"types",
".",
"VmfsDatastoreAllExtentOption",
")",
";",
"ok",
"{",
"option",
"=",
"&",
"o",
"\n",
"break",
"\n",
"}",
"\n",
"}",
"\n",
"if",
"<mask>",
"==",
"nil",
"{",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"name",
",",
"props",
".",
"Summary",
".",
"Name",
")",
"\n",
"}",
"\n",
"return",
"option",
".",
"Spec",
".",
"(",
"*",
"types",
".",
"VmfsDatastoreExtendSpec",
")",
",",
"nil",
"\n",
"}"
] |
14,102 | all-14103 | [
"This",
"is",
"kind",
"of",
"the",
"main",
"thing",
"you",
"want",
"to",
"do",
"with",
"DHT",
".",
"It",
"traverses",
"the",
"graph",
"toward",
"nodes",
"that",
"store",
"peers",
"for",
"the",
"infohash",
"streaming",
"them",
"to",
"the",
"caller",
"and",
"announcing",
"the",
"local",
"node",
"to",
"each",
"node",
"if",
"allowed",
"and",
"specified",
"."
] | [
"func",
"(",
"s",
"*",
"Server",
")",
"Announce",
"(",
"infoHash",
"[",
"20",
"]",
"byte",
",",
"port",
"int",
",",
"impliedPort",
"bool",
")",
"(",
"*",
"Announce",
",",
"error",
")",
"{",
"startAddrs",
",",
"err",
":=",
"s",
".",
"traversalStartingNodes",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"a",
":=",
"&",
"Announce",
"{",
"Peers",
":",
"make",
"(",
"chan",
"PeersValues",
",",
"100",
")",
",",
"values",
":",
"make",
"(",
"chan",
"PeersValues",
")",
",",
"triedAddrs",
":",
"newBloomFilterForTraversal",
"(",
")",
",",
"server",
":",
"s",
",",
"infoHash",
":",
"int160FromByteArray",
"(",
"infoHash",
")",
",",
"announcePort",
":",
"port",
",",
"announcePortImplied",
":",
"impliedPort",
",",
"contactRateLimiter",
":",
"make",
"(",
"chan",
"struct",
"{",
"}",
",",
"10",
")",
",",
"}",
"\n",
"a",
".",
"ctx",
",",
"a",
".",
"cancel",
"=",
"context",
".",
"WithCancel",
"(",
"context",
".",
"Background",
"(",
")",
")",
"\n",
"a",
".",
"stop",
"=",
"a",
".",
"ctx",
".",
"Done",
"(",
")",
"\n",
"a",
".",
"nodesPendingContact",
".",
"target",
"=",
"int160FromByteArray",
"(",
"infoHash",
")",
"\n",
"a",
".",
"nodeContactorCond",
".",
"L",
"=",
"&",
"a",
".",
"mu",
"\n",
"go",
"a",
".",
"rateUnlimiter",
"(",
")",
"\n",
"// Function ferries from values to Values until discovery is halted.",
"go",
"func",
"(",
")",
"{",
"defer",
"close",
"(",
"a",
".",
"Peers",
")",
"\n",
"for",
"{",
"select",
"{",
"case",
"psv",
":=",
"<-",
"a",
".",
"values",
":",
"select",
"{",
"case",
"a",
".",
"Peers",
"<-",
"psv",
":",
"case",
"<-",
"a",
".",
"<mask>",
":",
"return",
"\n",
"}",
"\n",
"case",
"<-",
"a",
".",
"stop",
":",
"return",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"(",
")",
"\n",
"for",
"_",
",",
"n",
":=",
"range",
"startAddrs",
"{",
"a",
".",
"pendContact",
"(",
"n",
")",
"\n",
"}",
"\n",
"a",
".",
"maybeClose",
"(",
")",
"\n",
"go",
"a",
".",
"nodeContactor",
"(",
")",
"\n",
"return",
"a",
",",
"nil",
"\n",
"}"
] |
14,103 | all-14104 | [
"setPipelineDefaults",
"sets",
"the",
"default",
"values",
"for",
"a",
"pipeline",
"info"
] | [
"func",
"setPipelineDefaults",
"(",
"pipelineInfo",
"*",
"pps",
".",
"PipelineInfo",
")",
"{",
"now",
":=",
"time",
".",
"Now",
"(",
")",
"\n",
"if",
"pipelineInfo",
".",
"Transform",
".",
"Image",
"==",
"\"",
"\"",
"{",
"pipelineInfo",
".",
"Transform",
".",
"Image",
"=",
"DefaultUserImage",
"\n",
"}",
"\n",
"pps",
".",
"VisitInput",
"(",
"pipelineInfo",
".",
"Input",
",",
"func",
"(",
"input",
"*",
"pps",
".",
"Input",
")",
"{",
"if",
"input",
".",
"Pfs",
"!=",
"nil",
"{",
"if",
"input",
".",
"Pfs",
".",
"Branch",
"==",
"\"",
"\"",
"{",
"input",
".",
"Pfs",
".",
"Branch",
"=",
"\"",
"\"",
"\n",
"}",
"\n",
"if",
"input",
".",
"Pfs",
".",
"Name",
"==",
"\"",
"\"",
"{",
"input",
".",
"Pfs",
".",
"Name",
"=",
"input",
".",
"Pfs",
".",
"Repo",
"\n",
"}",
"\n",
"}",
"\n",
"if",
"input",
".",
"Cron",
"!=",
"nil",
"{",
"if",
"input",
".",
"Cron",
".",
"Start",
"==",
"nil",
"{",
"start",
",",
"_",
":=",
"types",
".",
"TimestampProto",
"(",
"now",
")",
"\n",
"input",
".",
"Cron",
".",
"Start",
"=",
"start",
"\n",
"}",
"\n",
"if",
"input",
".",
"Cron",
".",
"Repo",
"==",
"\"",
"\"",
"{",
"<mask>",
".",
"Cron",
".",
"Repo",
"=",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"pipelineInfo",
".",
"Pipeline",
".",
"Name",
",",
"input",
".",
"Cron",
".",
"Name",
")",
"\n",
"}",
"\n",
"}",
"\n",
"if",
"input",
".",
"Git",
"!=",
"nil",
"{",
"if",
"input",
".",
"Git",
".",
"Branch",
"==",
"\"",
"\"",
"{",
"input",
".",
"Git",
".",
"Branch",
"=",
"\"",
"\"",
"\n",
"}",
"\n",
"if",
"input",
".",
"Git",
".",
"Name",
"==",
"\"",
"\"",
"{",
"// We know URL looks like:",
"// \"https://github.com/sjezewski/testgithook.git\",",
"tokens",
":=",
"strings",
".",
"Split",
"(",
"path",
".",
"Base",
"(",
"input",
".",
"Git",
".",
"URL",
")",
",",
"\"",
"\"",
")",
"\n",
"input",
".",
"Git",
".",
"Name",
"=",
"tokens",
"[",
"0",
"]",
"\n",
"}",
"\n",
"}",
"\n",
"}",
")",
"\n",
"if",
"pipelineInfo",
".",
"OutputBranch",
"==",
"\"",
"\"",
"{",
"// Output branches default to master",
"pipelineInfo",
".",
"OutputBranch",
"=",
"\"",
"\"",
"\n",
"}",
"\n",
"if",
"pipelineInfo",
".",
"CacheSize",
"==",
"\"",
"\"",
"{",
"pipelineInfo",
".",
"CacheSize",
"=",
"\"",
"\"",
"\n",
"}",
"\n",
"if",
"pipelineInfo",
".",
"ResourceRequests",
"==",
"nil",
"&&",
"pipelineInfo",
".",
"CacheSize",
"!=",
"\"",
"\"",
"{",
"pipelineInfo",
".",
"ResourceRequests",
"=",
"&",
"pps",
".",
"ResourceSpec",
"{",
"Memory",
":",
"pipelineInfo",
".",
"CacheSize",
",",
"}",
"\n",
"}",
"\n",
"if",
"pipelineInfo",
".",
"MaxQueueSize",
"<",
"1",
"{",
"pipelineInfo",
".",
"MaxQueueSize",
"=",
"1",
"\n",
"}",
"\n",
"if",
"pipelineInfo",
".",
"DatumTries",
"==",
"0",
"{",
"pipelineInfo",
".",
"DatumTries",
"=",
"DefaultDatumTries",
"\n",
"}",
"\n",
"}"
] |
14,104 | all-14105 | [
"SetReverse",
"()",
"is",
"a",
"wrapper",
"around",
"gtk_print_settings_set_reverse",
"()",
"."
] | [
"func",
"(",
"ps",
"*",
"PrintSettings",
")",
"SetReverse",
"(",
"reverse",
"bool",
")",
"{",
"C",
".",
"gtk_print_settings_set_reverse",
"(",
"ps",
".",
"native",
"(",
")",
",",
"gbool",
"(",
"<mask>",
")",
")",
"\n",
"}"
] |
14,105 | all-14106 | [
"NodeAdd",
"adds",
"a",
"node",
"to",
"the",
"current",
"list",
"of",
"LXD",
"nodes",
"that",
"are",
"part",
"of",
"the",
"cluster",
".",
"It",
"returns",
"the",
"ID",
"of",
"the",
"newly",
"inserted",
"row",
"."
] | [
"func",
"(",
"c",
"*",
"ClusterTx",
")",
"NodeAdd",
"(",
"name",
"string",
",",
"address",
"string",
")",
"(",
"int64",
",",
"error",
")",
"{",
"columns",
":=",
"[",
"]",
"string",
"{",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
"}",
"\n",
"values",
":=",
"[",
"]",
"<mask>",
"{",
"}",
"{",
"name",
",",
"address",
",",
"cluster",
".",
"SchemaVersion",
",",
"version",
".",
"APIExtensionsCount",
"(",
")",
"}",
"\n",
"return",
"query",
".",
"UpsertObject",
"(",
"c",
".",
"tx",
",",
"\"",
"\"",
",",
"columns",
",",
"values",
")",
"\n",
"}"
] |
14,106 | all-14107 | [
"HasName",
"returns",
"a",
"boolean",
"if",
"a",
"field",
"has",
"been",
"set",
"."
] | [
"func",
"(",
"g",
"*",
"GroupData",
")",
"HasName",
"(",
")",
"bool",
"{",
"if",
"g",
"!=",
"nil",
"&&",
"g",
".",
"<mask>",
"!=",
"nil",
"{",
"return",
"true",
"\n",
"}",
"\n\n",
"return",
"false",
"\n",
"}"
] |
14,107 | all-14108 | [
"URL",
"returns",
"a",
"suitable",
"URL",
"such",
"as",
"for",
"the",
"Google",
"Authenticator",
"app",
".",
"The",
"label",
"is",
"used",
"by",
"these",
"apps",
"to",
"identify",
"the",
"service",
"to",
"which",
"this",
"OTP",
"belongs",
".",
"The",
"digits",
"value",
"is",
"ignored",
"by",
"the",
"Google",
"authenticator",
"app",
"and",
"is",
"therefore",
"elided",
"in",
"the",
"resulting",
"URL",
"."
] | [
"func",
"(",
"otp",
"*",
"HOTP",
")",
"<mask>",
"(",
"label",
"string",
")",
"string",
"{",
"secret",
":=",
"base32",
".",
"StdEncoding",
".",
"EncodeToString",
"(",
"otp",
".",
"Key",
")",
"\n",
"u",
":=",
"url",
".",
"URL",
"{",
"}",
"\n",
"v",
":=",
"url",
".",
"Values",
"{",
"}",
"\n",
"u",
".",
"Scheme",
"=",
"\"",
"\"",
"\n",
"u",
".",
"Host",
"=",
"\"",
"\"",
"\n",
"u",
".",
"Path",
"=",
"label",
"\n",
"v",
".",
"Add",
"(",
"\"",
"\"",
",",
"secret",
")",
"\n",
"v",
".",
"Add",
"(",
"\"",
"\"",
",",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"otp",
".",
"Counter",
"(",
")",
")",
")",
"\n",
"u",
".",
"RawQuery",
"=",
"v",
".",
"Encode",
"(",
")",
"\n",
"return",
"u",
".",
"String",
"(",
")",
"\n",
"}"
] |
14,108 | all-14109 | [
"GoString",
"returns",
"the",
"path",
"to",
"a",
"specific",
"node",
"using",
"Go",
"syntax",
".",
"For",
"example",
":",
"(",
"*",
"root",
".",
"MyMap",
"[",
"key",
"]",
".",
"(",
"*",
"mypkg",
".",
"MyStruct",
")",
".",
"MySlices",
")",
"[",
"2",
"]",
"[",
"3",
"]",
".",
"MyField"
] | [
"func",
"(",
"pa",
"Path",
")",
"GoString",
"(",
")",
"string",
"{",
"var",
"ssPre",
",",
"ssPost",
"[",
"]",
"string",
"\n",
"var",
"numIndirect",
"int",
"\n",
"for",
"i",
",",
"s",
":=",
"range",
"pa",
"{",
"var",
"nextStep",
"PathStep",
"\n",
"if",
"i",
"+",
"1",
"<",
"len",
"(",
"pa",
")",
"{",
"nextStep",
"=",
"pa",
"[",
"i",
"+",
"1",
"]",
"\n",
"}",
"\n",
"switch",
"s",
":=",
"s",
".",
"(",
"type",
")",
"{",
"case",
"Indirect",
":",
"numIndirect",
"++",
"\n",
"pPre",
",",
"pPost",
":=",
"\"",
"\"",
",",
"\"",
"\"",
"\n",
"<mask>",
"nextStep",
".",
"(",
"type",
")",
"{",
"case",
"Indirect",
":",
"continue",
"// Next step is indirection, so let them batch up",
"\n",
"case",
"StructField",
":",
"numIndirect",
"--",
"// Automatic indirection on struct fields",
"\n",
"case",
"nil",
":",
"pPre",
",",
"pPost",
"=",
"\"",
"\"",
",",
"\"",
"\"",
"// Last step; no need for parenthesis",
"\n",
"}",
"\n",
"if",
"numIndirect",
">",
"0",
"{",
"ssPre",
"=",
"append",
"(",
"ssPre",
",",
"pPre",
"+",
"strings",
".",
"Repeat",
"(",
"\"",
"\"",
",",
"numIndirect",
")",
")",
"\n",
"ssPost",
"=",
"append",
"(",
"ssPost",
",",
"pPost",
")",
"\n",
"}",
"\n",
"numIndirect",
"=",
"0",
"\n",
"continue",
"\n",
"case",
"Transform",
":",
"ssPre",
"=",
"append",
"(",
"ssPre",
",",
"s",
".",
"trans",
".",
"name",
"+",
"\"",
"\"",
")",
"\n",
"ssPost",
"=",
"append",
"(",
"ssPost",
",",
"\"",
"\"",
")",
"\n",
"continue",
"\n",
"}",
"\n",
"ssPost",
"=",
"append",
"(",
"ssPost",
",",
"s",
".",
"String",
"(",
")",
")",
"\n",
"}",
"\n",
"for",
"i",
",",
"j",
":=",
"0",
",",
"len",
"(",
"ssPre",
")",
"-",
"1",
";",
"i",
"<",
"j",
";",
"i",
",",
"j",
"=",
"i",
"+",
"1",
",",
"j",
"-",
"1",
"{",
"ssPre",
"[",
"i",
"]",
",",
"ssPre",
"[",
"j",
"]",
"=",
"ssPre",
"[",
"j",
"]",
",",
"ssPre",
"[",
"i",
"]",
"\n",
"}",
"\n",
"return",
"strings",
".",
"Join",
"(",
"ssPre",
",",
"\"",
"\"",
")",
"+",
"strings",
".",
"Join",
"(",
"ssPost",
",",
"\"",
"\"",
")",
"\n",
"}"
] |
14,109 | all-14110 | [
"Index",
"returns",
"the",
"first",
"index",
"of",
"the",
"target",
"string",
"t",
"or",
"-",
"1",
"if",
"no",
"match",
"is",
"found",
"."
] | [
"func",
"Index",
"(",
"vs",
"[",
"]",
"string",
",",
"t",
"string",
")",
"int",
"{",
"for",
"i",
",",
"v",
":=",
"range",
"<mask>",
"{",
"if",
"v",
"==",
"t",
"{",
"return",
"i",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"-",
"1",
"\n",
"}"
] |
14,110 | all-14111 | [
"StringsFromFlag",
"returns",
"a",
"string",
"slice",
"from",
"the",
"flag",
"."
] | [
"func",
"StringsFromFlag",
"(",
"fs",
"*",
"flag",
".",
"FlagSet",
",",
"flagName",
"string",
")",
"[",
"]",
"string",
"{",
"return",
"[",
"]",
"string",
"(",
"*",
"<mask>",
".",
"Lookup",
"(",
"flagName",
")",
".",
"Value",
".",
"(",
"*",
"StringsValue",
")",
")",
"\n",
"}"
] |
14,111 | all-14112 | [
"GetLogs",
"returns",
"back",
"end",
"log",
"paginated",
"."
] | [
"func",
"(",
"h",
"*",
"Handler",
")",
"GetLogs",
"(",
"tkn",
"string",
",",
"levels",
"[",
"]",
"string",
",",
"searchText",
",",
"dateFrom",
",",
"dateTo",
"string",
",",
"offset",
",",
"limit",
"uint",
")",
"(",
"*",
"GetLogsResult",
",",
"error",
")",
"{",
"logger",
":=",
"h",
".",
"logger",
".",
"Add",
"(",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"searchText",
",",
"\"",
"\"",
",",
"levels",
",",
"\"",
"\"",
",",
"dateFrom",
",",
"\"",
"\"",
",",
"dateTo",
",",
"\"",
"\"",
",",
"offset",
",",
"\"",
"\"",
",",
"limit",
")",
"\n\n",
"if",
"!",
"h",
".",
"token",
".",
"Check",
"(",
"tkn",
")",
"{",
"logger",
".",
"Warn",
"(",
"\"",
"\"",
")",
"\n",
"return",
"nil",
",",
"ErrAccessDenied",
"\n",
"}",
"\n\n",
"args",
":=",
"&",
"getLogsArgs",
"{",
"<mask>",
":",
"levels",
",",
"dateTo",
":",
"dateTo",
",",
"dateFrom",
":",
"dateFrom",
",",
"searchText",
":",
"searchText",
",",
"}",
"\n\n",
"conditions",
",",
"arguments",
":=",
"h",
".",
"getLogsConditions",
"(",
"args",
")",
"\n",
"totalItems",
",",
"err",
":=",
"h",
".",
"getTotalLogEvents",
"(",
"logger",
",",
"conditions",
",",
"arguments",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"result",
",",
"err",
":=",
"h",
".",
"getLogs",
"(",
"logger",
",",
"conditions",
",",
"arguments",
",",
"offset",
",",
"limit",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"return",
"&",
"GetLogsResult",
"{",
"result",
",",
"totalItems",
"}",
",",
"err",
"\n",
"}"
] |
14,112 | all-14113 | [
"Claim",
"validator"
] | [
"func",
"(",
"h",
"*",
"headerRule",
")",
"Claim",
"(",
"reqCtx",
"*",
"fasthttp",
".",
"RequestCtx",
")",
"bool",
"{",
"j",
":=",
"func",
"(",
"reqCtx",
"*",
"fasthttp",
".",
"RequestCtx",
")",
"bool",
"{",
"get",
":=",
"func",
"(",
"key",
"string",
")",
"string",
"{",
"return",
"string",
"(",
"reqCtx",
".",
"Request",
".",
"<mask>",
".",
"Peek",
"(",
"key",
")",
")",
"\n",
"}",
"\n\n",
"return",
"h",
".",
"claim",
"(",
"get",
")",
"\n",
"}",
"\n",
"return",
"j",
"(",
"reqCtx",
")",
"\n",
"}"
] |
14,113 | all-14114 | [
"IsNameAttribute",
"returns",
"true",
"if",
"the",
"given",
"ObjectIdentifier",
"corresponds",
"with",
"the",
"type",
"of",
"any",
"name",
"attribute",
"for",
"PKIX",
"."
] | [
"func",
"IsNameAttribute",
"(",
"oid",
"asn1",
".",
"ObjectIdentifier",
")",
"bool",
"{",
"if",
"len",
"(",
"oid",
")",
"!=",
"4",
"{",
"return",
"false",
"\n",
"}",
"\n",
"if",
"!",
"nameAttributePrefix",
".",
"Equal",
"(",
"oid",
"[",
"0",
":",
"3",
"]",
")",
"{",
"return",
"<mask>",
"\n",
"}",
"\n",
"_",
",",
"ok",
":=",
"nameAttributeLeaves",
"[",
"oid",
"[",
"3",
"]",
"]",
"\n",
"return",
"ok",
"\n",
"}"
] |
14,114 | all-14115 | [
"UnmarshalEasyJSON",
"satisfies",
"easyjson",
".",
"Unmarshaler",
"."
] | [
"func",
"(",
"t",
"*",
"ErrorReason",
")",
"UnmarshalEasyJSON",
"(",
"in",
"*",
"jlexer",
".",
"Lexer",
")",
"{",
"switch",
"ErrorReason",
"(",
"in",
".",
"String",
"(",
")",
")",
"{",
"case",
"ErrorReasonFailed",
":",
"*",
"t",
"=",
"ErrorReasonFailed",
"\n",
"case",
"ErrorReasonAborted",
":",
"*",
"t",
"=",
"ErrorReasonAborted",
"\n",
"case",
"ErrorReasonTimedOut",
":",
"*",
"t",
"=",
"ErrorReasonTimedOut",
"\n",
"<mask>",
"ErrorReasonAccessDenied",
":",
"*",
"t",
"=",
"ErrorReasonAccessDenied",
"\n",
"case",
"ErrorReasonConnectionClosed",
":",
"*",
"t",
"=",
"ErrorReasonConnectionClosed",
"\n",
"case",
"ErrorReasonConnectionReset",
":",
"*",
"t",
"=",
"ErrorReasonConnectionReset",
"\n",
"case",
"ErrorReasonConnectionRefused",
":",
"*",
"t",
"=",
"ErrorReasonConnectionRefused",
"\n",
"case",
"ErrorReasonConnectionAborted",
":",
"*",
"t",
"=",
"ErrorReasonConnectionAborted",
"\n",
"case",
"ErrorReasonConnectionFailed",
":",
"*",
"t",
"=",
"ErrorReasonConnectionFailed",
"\n",
"case",
"ErrorReasonNameNotResolved",
":",
"*",
"t",
"=",
"ErrorReasonNameNotResolved",
"\n",
"case",
"ErrorReasonInternetDisconnected",
":",
"*",
"t",
"=",
"ErrorReasonInternetDisconnected",
"\n",
"case",
"ErrorReasonAddressUnreachable",
":",
"*",
"t",
"=",
"ErrorReasonAddressUnreachable",
"\n",
"case",
"ErrorReasonBlockedByClient",
":",
"*",
"t",
"=",
"ErrorReasonBlockedByClient",
"\n",
"case",
"ErrorReasonBlockedByResponse",
":",
"*",
"t",
"=",
"ErrorReasonBlockedByResponse",
"\n\n",
"default",
":",
"in",
".",
"AddError",
"(",
"errors",
".",
"New",
"(",
"\"",
"\"",
")",
")",
"\n",
"}",
"\n",
"}"
] |
14,115 | all-14116 | [
"parseClone",
"splits",
"a",
"strings",
"describing",
"an",
"RBD",
"storage",
"volume",
"For",
"example",
"a",
"string",
"like",
"<osd",
"-",
"pool",
"-",
"name",
">",
"/",
"<lxd",
"-",
"specific",
"-",
"prefix",
">",
"_<rbd",
"-",
"storage",
"-",
"volume",
">",
"will",
"be",
"split",
"into",
"<osd",
"-",
"pool",
"-",
"name",
">",
"<lxd",
"-",
"specific",
"-",
"prefix",
">",
"<rbd",
"-",
"storage",
"-",
"volume",
">"
] | [
"func",
"parseClone",
"(",
"clone",
"string",
")",
"(",
"string",
",",
"string",
",",
"string",
",",
"error",
")",
"{",
"idx",
":=",
"strings",
".",
"Index",
"(",
"clone",
",",
"\"",
"\"",
")",
"\n",
"if",
"idx",
"==",
"-",
"1",
"{",
"return",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"slider",
":=",
"clone",
"[",
"(",
"idx",
"+",
"1",
")",
":",
"]",
"\n",
"poolName",
":=",
"clone",
"[",
":",
"idx",
"]",
"\n\n",
"volumeType",
":=",
"slider",
"\n",
"idx",
"=",
"strings",
".",
"<mask>",
"(",
"slider",
",",
"\"",
"\"",
")",
"\n",
"if",
"idx",
"==",
"0",
"{",
"idx",
"+=",
"len",
"(",
"\"",
"\"",
")",
"\n",
"volumeType",
"=",
"slider",
"\n",
"slider",
"=",
"slider",
"[",
"idx",
":",
"]",
"\n",
"}",
"\n\n",
"idxType",
":=",
"strings",
".",
"Index",
"(",
"slider",
",",
"\"",
"\"",
")",
"\n",
"if",
"idxType",
"==",
"-",
"1",
"{",
"return",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"if",
"idx",
"==",
"len",
"(",
"\"",
"\"",
")",
"{",
"idxType",
"+=",
"idx",
"\n",
"}",
"\n",
"volumeType",
"=",
"volumeType",
"[",
":",
"idxType",
"]",
"\n\n",
"idx",
"=",
"strings",
".",
"Index",
"(",
"slider",
",",
"\"",
"\"",
")",
"\n",
"if",
"idx",
"==",
"-",
"1",
"{",
"return",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"volumeName",
":=",
"slider",
"\n",
"idx",
"=",
"strings",
".",
"Index",
"(",
"volumeName",
",",
"\"",
"\"",
")",
"\n",
"if",
"idx",
"==",
"-",
"1",
"{",
"return",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"volumeName",
"=",
"volumeName",
"[",
"(",
"idx",
"+",
"1",
")",
":",
"]",
"\n\n",
"return",
"poolName",
",",
"volumeType",
",",
"volumeName",
",",
"nil",
"\n",
"}"
] |
14,116 | all-14117 | [
"ScrollToPath",
"is",
"a",
"wrapper",
"around",
"gtk_icon_view_scroll_to_path",
"()",
"."
] | [
"func",
"(",
"v",
"*",
"IconView",
")",
"ScrollToPath",
"(",
"path",
"*",
"TreePath",
",",
"useAlign",
"bool",
",",
"rowAlign",
",",
"colAlign",
"float64",
")",
"{",
"C",
".",
"gtk_icon_view_scroll_to_path",
"(",
"v",
".",
"native",
"(",
")",
",",
"<mask>",
".",
"native",
"(",
")",
",",
"gbool",
"(",
"useAlign",
")",
",",
"C",
".",
"gfloat",
"(",
"rowAlign",
")",
",",
"C",
".",
"gfloat",
"(",
"colAlign",
")",
")",
"\n",
"}"
] |
14,117 | all-14118 | [
"cephRBDVolumeBackupCreate",
"creates",
"a",
"backup",
"of",
"a",
"container",
"or",
"snapshot",
"."
] | [
"func",
"(",
"s",
"*",
"storageCeph",
")",
"cephRBDVolumeBackupCreate",
"(",
"tmpPath",
"string",
",",
"backup",
"backup",
",",
"source",
"container",
")",
"error",
"{",
"sourceIsSnapshot",
":=",
"source",
".",
"IsSnapshot",
"(",
")",
"\n",
"sourceContainerName",
":=",
"source",
".",
"Name",
"(",
")",
"\n",
"sourceContainerOnlyName",
":=",
"projectPrefix",
"(",
"source",
".",
"Project",
"(",
")",
",",
"sourceContainerName",
")",
"\n",
"sourceSnapshotOnlyName",
":=",
"\"",
"\"",
"\n\n",
"// Prepare for rsync",
"rsync",
":=",
"func",
"(",
"oldPath",
"string",
",",
"newPath",
"string",
",",
"bwlimit",
"string",
")",
"error",
"{",
"output",
",",
"err",
":=",
"rsyncLocalCopy",
"(",
"oldPath",
",",
"newPath",
",",
"bwlimit",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"string",
"(",
"output",
")",
",",
"err",
")",
"\n",
"}",
"\n\n",
"return",
"nil",
"\n",
"}",
"\n\n",
"bwlimit",
":=",
"s",
".",
"pool",
".",
"Config",
"[",
"\"",
"\"",
"]",
"\n",
"// Create a temporary snapshot",
"snapshotName",
":=",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"uuid",
".",
"NewRandom",
"(",
")",
".",
"String",
"(",
")",
")",
"\n",
"if",
"sourceIsSnapshot",
"{",
"sourceContainerOnlyName",
",",
"sourceSnapshotOnlyName",
",",
"_",
"=",
"containerGetParentAndSnapshotName",
"(",
"sourceContainerName",
")",
"\n",
"sourceContainerOnlyName",
"=",
"projectPrefix",
"(",
"source",
".",
"Project",
"(",
")",
",",
"sourceContainerOnlyName",
")",
"\n",
"snapshotName",
"=",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"projectPrefix",
"(",
"source",
".",
"<mask>",
"(",
")",
",",
"sourceSnapshotOnlyName",
")",
")",
"\n",
"}",
"else",
"{",
"// This is costly but we need to ensure that all cached data has",
"// been committed to disk. If we don't then the rbd snapshot of",
"// the underlying filesystem can be inconsistent or - worst case",
"// - empty.",
"syscall",
".",
"Sync",
"(",
")",
"\n\n",
"// create snapshot",
"err",
":=",
"cephRBDSnapshotCreate",
"(",
"s",
".",
"ClusterName",
",",
"s",
".",
"OSDPoolName",
",",
"sourceContainerOnlyName",
",",
"storagePoolVolumeTypeNameContainer",
",",
"snapshotName",
",",
"s",
".",
"UserName",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"defer",
"cephRBDSnapshotDelete",
"(",
"s",
".",
"ClusterName",
",",
"s",
".",
"OSDPoolName",
",",
"sourceContainerOnlyName",
",",
"storagePoolVolumeTypeNameContainer",
",",
"snapshotName",
",",
"s",
".",
"UserName",
")",
"\n",
"}",
"\n\n",
"// Protect volume so we can create clones of it",
"err",
":=",
"cephRBDSnapshotProtect",
"(",
"s",
".",
"ClusterName",
",",
"s",
".",
"OSDPoolName",
",",
"sourceContainerOnlyName",
",",
"storagePoolVolumeTypeNameContainer",
",",
"snapshotName",
",",
"s",
".",
"UserName",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"defer",
"cephRBDSnapshotUnprotect",
"(",
"s",
".",
"ClusterName",
",",
"s",
".",
"OSDPoolName",
",",
"sourceContainerOnlyName",
",",
"storagePoolVolumeTypeNameContainer",
",",
"snapshotName",
",",
"s",
".",
"UserName",
")",
"\n\n",
"// Create a new volume from the snapshot",
"cloneName",
":=",
"uuid",
".",
"NewRandom",
"(",
")",
".",
"String",
"(",
")",
"\n",
"err",
"=",
"cephRBDCloneCreate",
"(",
"s",
".",
"ClusterName",
",",
"s",
".",
"OSDPoolName",
",",
"sourceContainerOnlyName",
",",
"storagePoolVolumeTypeNameContainer",
",",
"snapshotName",
",",
"s",
".",
"OSDPoolName",
",",
"cloneName",
",",
"\"",
"\"",
",",
"s",
".",
"UserName",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"defer",
"cephRBDVolumeDelete",
"(",
"s",
".",
"ClusterName",
",",
"s",
".",
"OSDPoolName",
",",
"cloneName",
",",
"\"",
"\"",
",",
"s",
".",
"UserName",
")",
"\n\n",
"// Map the new volume",
"RBDDevPath",
",",
"err",
":=",
"cephRBDVolumeMap",
"(",
"s",
".",
"ClusterName",
",",
"s",
".",
"OSDPoolName",
",",
"cloneName",
",",
"\"",
"\"",
",",
"s",
".",
"UserName",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"defer",
"cephRBDVolumeUnmap",
"(",
"s",
".",
"ClusterName",
",",
"s",
".",
"OSDPoolName",
",",
"cloneName",
",",
"\"",
"\"",
",",
"s",
".",
"UserName",
",",
"true",
")",
"\n\n",
"// Generate a new UUID if needed",
"RBDFilesystem",
":=",
"s",
".",
"getRBDFilesystem",
"(",
")",
"\n",
"msg",
",",
"err",
":=",
"fsGenerateNewUUID",
"(",
"RBDFilesystem",
",",
"RBDDevPath",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"logger",
".",
"Errorf",
"(",
"\"",
"\\\"",
"\\\"",
"\"",
",",
"RBDFilesystem",
",",
"msg",
",",
"err",
")",
"\n",
"return",
"err",
"\n",
"}",
"\n\n",
"// Create a temporary mountpoing",
"tmpContainerMntPoint",
",",
"err",
":=",
"ioutil",
".",
"TempDir",
"(",
"\"",
"\"",
",",
"\"",
"\"",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"defer",
"os",
".",
"RemoveAll",
"(",
"tmpContainerMntPoint",
")",
"\n\n",
"err",
"=",
"os",
".",
"Chmod",
"(",
"tmpContainerMntPoint",
",",
"0700",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"// Mount the volume",
"mountFlags",
",",
"mountOptions",
":=",
"lxdResolveMountoptions",
"(",
"s",
".",
"getRBDMountOptions",
"(",
")",
")",
"\n",
"err",
"=",
"tryMount",
"(",
"RBDDevPath",
",",
"tmpContainerMntPoint",
",",
"RBDFilesystem",
",",
"mountFlags",
",",
"mountOptions",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"logger",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"RBDDevPath",
",",
"tmpContainerMntPoint",
",",
"err",
")",
"\n",
"return",
"err",
"\n",
"}",
"\n",
"logger",
".",
"Debugf",
"(",
"\"",
"\"",
",",
"RBDDevPath",
",",
"tmpContainerMntPoint",
")",
"\n",
"defer",
"tryUnmount",
"(",
"tmpContainerMntPoint",
",",
"syscall",
".",
"MNT_DETACH",
")",
"\n\n",
"// Figure out the target name",
"targetName",
":=",
"sourceContainerName",
"\n",
"if",
"sourceIsSnapshot",
"{",
"_",
",",
"targetName",
",",
"_",
"=",
"containerGetParentAndSnapshotName",
"(",
"sourceContainerName",
")",
"\n",
"}",
"\n\n",
"// Create the path for the backup.",
"targetBackupMntPoint",
":=",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"tmpPath",
")",
"\n",
"if",
"sourceIsSnapshot",
"{",
"targetBackupMntPoint",
"=",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"tmpPath",
",",
"targetName",
")",
"\n",
"}",
"\n\n",
"err",
"=",
"os",
".",
"MkdirAll",
"(",
"targetBackupMntPoint",
",",
"0711",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"err",
"=",
"rsync",
"(",
"tmpContainerMntPoint",
",",
"targetBackupMntPoint",
",",
"bwlimit",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"return",
"nil",
"\n",
"}"
] |
14,118 | all-14119 | [
"IsEnabled",
"--",
"Check",
"if",
"this",
"sku",
"is",
"enabled",
"using",
"cf",
"env"
] | [
"func",
"IsEnabled",
"(",
")",
"bool",
"{",
"if",
"appEnv",
",",
"err",
":=",
"cfenv",
".",
"Current",
"(",
")",
";",
"err",
"==",
"nil",
"{",
"if",
"taskService",
",",
"err",
":=",
"appEnv",
".",
"Services",
".",
"WithName",
"(",
"\"",
"\"",
")",
";",
"err",
"==",
"nil",
"{",
"if",
"taskService",
".",
"Credentials",
"[",
"\"",
"\"",
"]",
".",
"(",
"string",
")",
"==",
"\"",
"\"",
"{",
"return",
"true",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n",
"lo",
".",
"G",
".",
"<mask>",
"(",
"\"",
"\"",
")",
"\n",
"return",
"false",
"\n",
"}"
] |
14,119 | all-14120 | [
"HasHandle",
"returns",
"a",
"boolean",
"if",
"a",
"field",
"has",
"been",
"set",
"."
] | [
"func",
"(",
"c",
"*",
"Comment",
")",
"HasHandle",
"(",
")",
"bool",
"{",
"if",
"c",
"!=",
"nil",
"&&",
"c",
".",
"Handle",
"!=",
"nil",
"{",
"return",
"true",
"\n",
"}",
"\n\n",
"return",
"<mask>",
"\n",
"}"
] |
14,120 | all-14121 | [
"GetNodeTypeOk",
"returns",
"a",
"tuple",
"with",
"the",
"NodeType",
"field",
"if",
"it",
"s",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"and",
"a",
"boolean",
"to",
"check",
"if",
"the",
"value",
"has",
"been",
"set",
"."
] | [
"func",
"(",
"g",
"*",
"GraphDefinition",
")",
"GetNodeTypeOk",
"(",
")",
"(",
"string",
",",
"bool",
")",
"{",
"if",
"g",
"==",
"nil",
"||",
"g",
".",
"NodeType",
"==",
"nil",
"{",
"return",
"\"",
"\"",
",",
"false",
"\n",
"}",
"\n",
"return",
"*",
"g",
".",
"NodeType",
",",
"<mask>",
"\n",
"}"
] |
14,121 | all-14122 | [
"PublicCertificates",
"retrieves",
"the",
"public",
"certificates",
"for",
"the",
"app",
".",
"They",
"can",
"be",
"used",
"to",
"verify",
"a",
"signature",
"returned",
"by",
"SignBytes",
"."
] | [
"func",
"PublicCertificates",
"(",
"c",
"context",
".",
"Context",
")",
"(",
"[",
"]",
"Certificate",
",",
"error",
")",
"{",
"req",
":=",
"&",
"pb",
".",
"GetPublicCertificateForAppRequest",
"{",
"}",
"\n",
"res",
":=",
"&",
"pb",
".",
"GetPublicCertificateForAppResponse",
"{",
"}",
"\n",
"if",
"err",
":=",
"internal",
".",
"Call",
"(",
"c",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"req",
",",
"res",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"var",
"cs",
"[",
"]",
"Certificate",
"\n",
"for",
"_",
",",
"pc",
":=",
"range",
"res",
".",
"PublicCertificateList",
"{",
"cs",
"=",
"append",
"(",
"cs",
",",
"Certificate",
"{",
"KeyName",
":",
"pc",
".",
"GetKeyName",
"(",
")",
",",
"Data",
":",
"[",
"]",
"byte",
"(",
"<mask>",
".",
"GetX509CertificatePem",
"(",
")",
")",
",",
"}",
")",
"\n",
"}",
"\n",
"return",
"cs",
",",
"nil",
"\n",
"}"
] |
14,122 | all-14123 | [
"RegisterAdminHandler",
"registers",
"the",
"http",
"handlers",
"for",
"service",
"Admin",
"to",
"mux",
".",
"The",
"handlers",
"forward",
"requests",
"to",
"the",
"grpc",
"endpoint",
"over",
"conn",
"."
] | [
"func",
"RegisterAdminHandler",
"(",
"ctx",
"context",
".",
"<mask>",
",",
"mux",
"*",
"runtime",
".",
"ServeMux",
",",
"conn",
"*",
"grpc",
".",
"ClientConn",
")",
"error",
"{",
"return",
"RegisterAdminHandlerClient",
"(",
"ctx",
",",
"mux",
",",
"NewAdminClient",
"(",
"conn",
")",
")",
"\n",
"}"
] |
14,123 | all-14124 | [
"WithInsertBeforeNodeID",
"drop",
"node",
"before",
"this",
"one",
"(",
"if",
"absent",
"the",
"moved",
"node",
"becomes",
"the",
"last",
"child",
"of",
"targetNodeId",
")",
"."
] | [
"func",
"(",
"p",
"MoveToParams",
")",
"WithInsertBeforeNodeID",
"(",
"insertBeforeNodeID",
"cdp",
".",
"NodeID",
")",
"*",
"MoveToParams",
"{",
"p",
".",
"InsertBeforeNodeID",
"=",
"insertBeforeNodeID",
"\n",
"<mask>",
"&",
"p",
"\n",
"}"
] |
14,124 | all-14125 | [
"InjectV3MetadataEndpoint",
"injects",
"the",
"v3",
"metadata",
"endpoint",
"as",
"an",
"environment",
"variable",
"for",
"a",
"container"
] | [
"func",
"(",
"c",
"*",
"Container",
")",
"InjectV3MetadataEndpoint",
"(",
")",
"{",
"c",
".",
"<mask>",
".",
"Lock",
"(",
")",
"\n",
"defer",
"c",
".",
"lock",
".",
"Unlock",
"(",
")",
"\n\n",
"// don't assume that the environment variable map has been initialized by others",
"if",
"c",
".",
"Environment",
"==",
"nil",
"{",
"c",
".",
"Environment",
"=",
"make",
"(",
"map",
"[",
"string",
"]",
"string",
")",
"\n",
"}",
"\n\n",
"c",
".",
"Environment",
"[",
"MetadataURIEnvironmentVariableName",
"]",
"=",
"fmt",
".",
"Sprintf",
"(",
"MetadataURIFormat",
",",
"c",
".",
"V3EndpointID",
")",
"\n",
"}"
] |
14,125 | all-14126 | [
"MarshalJSON",
"supports",
"json",
".",
"Marshaler",
"interface"
] | [
"func",
"(",
"v",
"EventNeedsBeginFramesChanged",
")",
"MarshalJSON",
"(",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"w",
":=",
"jwriter",
".",
"<mask>",
"{",
"}",
"\n",
"easyjsonC5a4559bEncodeGithubComChromedpCdprotoHeadlessexperimental1",
"(",
"&",
"w",
",",
"v",
")",
"\n",
"return",
"w",
".",
"Buffer",
".",
"BuildBytes",
"(",
")",
",",
"w",
".",
"Error",
"\n",
"}"
] |
14,126 | all-14127 | [
"BuildHealthCheck",
"creates",
"a",
"healthcheck",
"function",
"for",
"the",
"given",
"routerName",
".",
"It",
"will",
"call",
"the",
"HealthCheck",
"()",
"method",
"in",
"the",
"router",
"(",
"only",
"if",
"it",
"s",
"also",
"a",
"HealthChecker",
")",
"for",
"each",
"instance",
"of",
"it",
"(",
"including",
"the",
"main",
"instance",
"and",
"all",
"custom",
"routers",
")",
"."
] | [
"func",
"BuildHealthCheck",
"(",
"routerName",
"string",
")",
"func",
"(",
")",
"error",
"{",
"return",
"func",
"(",
")",
"error",
"{",
"routerConfig",
",",
"err",
":=",
"config",
".",
"Get",
"(",
"\"",
"\"",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"hc",
".",
"ErrDisabledComponent",
"\n",
"}",
"\n",
"routers",
",",
"_",
":=",
"routerConfig",
".",
"(",
"map",
"[",
"interface",
"{",
"}",
"]",
"interface",
"{",
"}",
")",
"\n",
"checkCount",
":=",
"0",
"\n",
"for",
"ifaceName",
":=",
"range",
"routers",
"{",
"<mask>",
":=",
"ifaceName",
".",
"(",
"string",
")",
"\n",
"if",
"name",
"!=",
"routerName",
"{",
"namedRouter",
":=",
"routers",
"[",
"name",
"]",
".",
"(",
"map",
"[",
"interface",
"{",
"}",
"]",
"interface",
"{",
"}",
")",
"\n",
"if",
"tp",
",",
"_",
":=",
"namedRouter",
"[",
"\"",
"\"",
"]",
".",
"(",
"string",
")",
";",
"tp",
"!=",
"routerName",
"{",
"continue",
"\n",
"}",
"\n",
"}",
"\n",
"checkCount",
"++",
"\n",
"err",
":=",
"healthCheck",
"(",
"name",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"}",
"\n",
"if",
"checkCount",
"==",
"0",
"{",
"return",
"hc",
".",
"ErrDisabledComponent",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}",
"\n",
"}"
] |
14,127 | all-14128 | [
"ReadWhisperAggregation",
"..."
] | [
"func",
"ReadWhisperAggregation",
"(",
"filename",
"string",
")",
"(",
"*",
"WhisperAggregation",
",",
"error",
")",
"{",
"config",
",",
"err",
":=",
"parseIniFile",
"(",
"filename",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"result",
":=",
"NewWhisperAggregation",
"(",
")",
"\n\n",
"for",
"_",
",",
"section",
":=",
"range",
"config",
"{",
"item",
":=",
"&",
"whisperAggregationItem",
"{",
"}",
"\n",
"// this is mildly stupid, but I don't feel like forking",
"// configparser just for this",
"item",
".",
"name",
"=",
"section",
"[",
"\"",
"\"",
"]",
"\n\n",
"item",
".",
"pattern",
",",
"err",
"=",
"regexp",
".",
"Compile",
"(",
"section",
"[",
"\"",
"\"",
"]",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"section",
"[",
"\"",
"\"",
"]",
",",
"item",
".",
"name",
",",
"err",
".",
"Error",
"(",
")",
")",
"\n",
"}",
"\n\n",
"item",
".",
"xFilesFactor",
",",
"err",
"=",
"strconv",
".",
"ParseFloat",
"(",
"section",
"[",
"\"",
"\"",
"]",
",",
"64",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"section",
"[",
"\"",
"\"",
"]",
",",
"item",
".",
"name",
",",
"err",
".",
"Error",
"(",
")",
")",
"\n",
"}",
"\n\n",
"item",
".",
"aggregationMethodStr",
"=",
"section",
"[",
"\"",
"\"",
"]",
"\n",
"switch",
"<mask>",
".",
"aggregationMethodStr",
"{",
"case",
"\"",
"\"",
",",
"\"",
"\"",
":",
"item",
".",
"aggregationMethod",
"=",
"whisper",
".",
"Average",
"\n",
"case",
"\"",
"\"",
":",
"item",
".",
"aggregationMethod",
"=",
"whisper",
".",
"Sum",
"\n",
"case",
"\"",
"\"",
":",
"item",
".",
"aggregationMethod",
"=",
"whisper",
".",
"Last",
"\n",
"case",
"\"",
"\"",
":",
"item",
".",
"aggregationMethod",
"=",
"whisper",
".",
"Max",
"\n",
"case",
"\"",
"\"",
":",
"item",
".",
"aggregationMethod",
"=",
"whisper",
".",
"Min",
"\n",
"default",
":",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"section",
"[",
"\"",
"\"",
"]",
")",
"\n",
"}",
"\n\n",
"result",
".",
"Data",
"=",
"append",
"(",
"result",
".",
"Data",
",",
"item",
")",
"\n",
"}",
"\n\n",
"return",
"result",
",",
"nil",
"\n",
"}"
] |
14,128 | all-14129 | [
"ApplyExtract",
"applies",
"selector",
"to",
"js",
"."
] | [
"func",
"(",
"d",
"*",
"Displayer",
")",
"ApplyExtract",
"(",
"selector",
"string",
",",
"js",
"bool",
")",
"error",
"{",
"parser",
",",
"err",
":=",
"jsonselect",
".",
"CreateParserFromString",
"(",
"d",
".",
"body",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\\n",
"\"",
",",
"err",
",",
"d",
".",
"<mask>",
")",
"\n",
"}",
"\n",
"outputs",
",",
"err",
":=",
"parser",
".",
"GetValues",
"(",
"selector",
")",
"\n",
"if",
"!",
"js",
"{",
"out",
":=",
"\"",
"\"",
"\n",
"for",
"_",
",",
"o",
":=",
"range",
"outputs",
"{",
"b",
",",
"_",
":=",
"json",
".",
"Marshal",
"(",
"o",
")",
"\n",
"out",
"+=",
"string",
"(",
"b",
")",
"+",
"\"",
"\\n",
"\"",
"\n",
"}",
"\n",
"d",
".",
"RawOutput",
"=",
"out",
"\n",
"}",
"else",
"{",
"d",
".",
"RawOutput",
"=",
"outputs",
"\n",
"}",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\\n",
"\"",
",",
"selector",
",",
"err",
",",
"d",
".",
"body",
")",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
] |
14,129 | all-14130 | [
"GetMonitorsByName",
"retrieves",
"monitors",
"by",
"name"
] | [
"func",
"(",
"self",
"*",
"Client",
")",
"GetMonitorsByName",
"(",
"name",
"string",
")",
"(",
"[",
"]",
"Monitor",
",",
"error",
")",
"{",
"var",
"out",
"reqMonitors",
"\n",
"query",
",",
"err",
":=",
"url",
".",
"ParseQuery",
"(",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"name",
")",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"err",
"=",
"self",
".",
"doJsonRequest",
"(",
"\"",
"\"",
",",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"query",
".",
"Encode",
"(",
")",
")",
",",
"nil",
",",
"&",
"out",
".",
"Monitors",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"return",
"<mask>",
".",
"Monitors",
",",
"nil",
"\n",
"}"
] |
14,130 | all-14131 | [
"initialize",
"a",
"texture",
"as",
"a",
"data",
"alias",
"of",
"another",
"texture",
"s",
"data",
"store"
] | [
"func",
"TextureView",
"(",
"texture",
"uint32",
",",
"<mask>",
"uint32",
",",
"origtexture",
"uint32",
",",
"internalformat",
"uint32",
",",
"minlevel",
"uint32",
",",
"numlevels",
"uint32",
",",
"minlayer",
"uint32",
",",
"numlayers",
"uint32",
")",
"{",
"C",
".",
"glowTextureView",
"(",
"gpTextureView",
",",
"(",
"C",
".",
"GLuint",
")",
"(",
"texture",
")",
",",
"(",
"C",
".",
"GLenum",
")",
"(",
"target",
")",
",",
"(",
"C",
".",
"GLuint",
")",
"(",
"origtexture",
")",
",",
"(",
"C",
".",
"GLenum",
")",
"(",
"internalformat",
")",
",",
"(",
"C",
".",
"GLuint",
")",
"(",
"minlevel",
")",
",",
"(",
"C",
".",
"GLuint",
")",
"(",
"numlevels",
")",
",",
"(",
"C",
".",
"GLuint",
")",
"(",
"minlayer",
")",
",",
"(",
"C",
".",
"GLuint",
")",
"(",
"numlayers",
")",
")",
"\n",
"}"
] |
14,131 | all-14132 | [
"GetPrivateImageFile",
"isn",
"t",
"relevant",
"for",
"the",
"simplestreams",
"protocol"
] | [
"func",
"(",
"r",
"*",
"ProtocolSimpleStreams",
")",
"GetPrivateImageFile",
"(",
"fingerprint",
"string",
",",
"<mask>",
"string",
",",
"req",
"ImageFileRequest",
")",
"(",
"*",
"ImageFileResponse",
",",
"error",
")",
"{",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
")",
"\n",
"}"
] |
14,132 | all-14133 | [
"CreateAlias",
"generates",
"a",
"nested",
"command",
"tree",
"for",
"the",
"invocation",
"specified",
"which",
"should",
"be",
"space",
"-",
"delimited",
"as",
"on",
"the",
"command",
"-",
"line",
".",
"The",
"Use",
"field",
"of",
"cmd",
"should",
"specify",
"{{",
"alias",
"}}",
"instead",
"of",
"the",
"command",
"name",
"as",
"that",
"will",
"be",
"filled",
"in",
"based",
"on",
"each",
"invocation",
".",
"Similarly",
"for",
"the",
"Example",
"field",
"{{",
"alias",
"}}",
"will",
"be",
"replaced",
"with",
"the",
"full",
"command",
"path",
".",
"These",
"commands",
"can",
"later",
"be",
"merged",
"into",
"the",
"final",
"Command",
"tree",
"using",
"MergeCommands",
"below",
"."
] | [
"func",
"CreateAlias",
"(",
"cmd",
"*",
"cobra",
".",
"Command",
",",
"invocation",
"string",
")",
"*",
"cobra",
".",
"Command",
"{",
"// Create logical commands for each substring in each invocation",
"var",
"root",
",",
"prev",
"*",
"cobra",
".",
"Command",
"\n",
"args",
":=",
"strings",
".",
"Split",
"(",
"invocation",
",",
"\"",
"\"",
")",
"\n\n",
"for",
"i",
",",
"arg",
":=",
"range",
"args",
"{",
"cur",
":=",
"&",
"cobra",
".",
"Command",
"{",
"}",
"\n\n",
"// The leaf command node should include the usage from the given cmd,",
"// while logical nodes just need one piece of the invocation.",
"if",
"i",
"==",
"len",
"(",
"args",
")",
"-",
"1",
"{",
"*",
"cur",
"=",
"*",
"cmd",
"\n",
"if",
"cmd",
".",
"Use",
"==",
"\"",
"\"",
"{",
"cur",
".",
"Use",
"=",
"arg",
"\n",
"}",
"else",
"{",
"cur",
".",
"Use",
"=",
"strings",
".",
"Replace",
"(",
"cmd",
".",
"Use",
",",
"\"",
"\"",
",",
"arg",
",",
"-",
"1",
")",
"\n",
"}",
"\n",
"cur",
".",
"Example",
"=",
"strings",
".",
"Replace",
"(",
"cmd",
".",
"Example",
",",
"\"",
"\"",
",",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"os",
".",
"Args",
"[",
"0",
"]",
",",
"invocation",
")",
",",
"-",
"1",
")",
"\n",
"}",
"else",
"{",
"cur",
".",
"Use",
"=",
"arg",
"\n",
"}",
"\n\n",
"if",
"<mask>",
"==",
"nil",
"{",
"root",
"=",
"cur",
"\n",
"}",
"else",
"if",
"prev",
"!=",
"nil",
"{",
"prev",
".",
"AddCommand",
"(",
"cur",
")",
"\n",
"}",
"\n",
"prev",
"=",
"cur",
"\n",
"}",
"\n\n",
"return",
"root",
"\n",
"}"
] |
14,133 | all-14134 | [
"configure",
"peer",
"handlers",
"after",
"rafthttp",
".",
"Transport",
"started"
] | [
"func",
"(",
"e",
"*",
"Etcd",
")",
"servePeers",
"(",
")",
"(",
"err",
"error",
")",
"{",
"ph",
":=",
"etcdhttp",
".",
"NewPeerHandler",
"(",
"e",
".",
"GetLogger",
"(",
")",
",",
"e",
".",
"Server",
")",
"\n",
"var",
"peerTLScfg",
"*",
"tls",
".",
"Config",
"\n",
"if",
"!",
"e",
".",
"cfg",
".",
"PeerTLSInfo",
".",
"Empty",
"(",
")",
"{",
"if",
"peerTLScfg",
",",
"err",
"=",
"e",
".",
"cfg",
".",
"PeerTLSInfo",
".",
"ServerConfig",
"(",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"}",
"\n\n",
"for",
"_",
",",
"p",
":=",
"range",
"e",
".",
"Peers",
"{",
"u",
":=",
"p",
".",
"Listener",
".",
"Addr",
"(",
")",
".",
"String",
"(",
")",
"\n",
"gs",
":=",
"v3rpc",
".",
"Server",
"(",
"e",
".",
"Server",
",",
"peerTLScfg",
")",
"\n",
"m",
":=",
"cmux",
".",
"New",
"(",
"p",
".",
"Listener",
")",
"\n",
"go",
"gs",
".",
"Serve",
"(",
"m",
".",
"Match",
"(",
"cmux",
".",
"HTTP2",
"(",
")",
")",
")",
"\n",
"srv",
":=",
"&",
"http",
".",
"Server",
"{",
"Handler",
":",
"grpcHandlerFunc",
"(",
"gs",
",",
"ph",
")",
",",
"ReadTimeout",
":",
"5",
"*",
"time",
".",
"Minute",
",",
"ErrorLog",
":",
"defaultLog",
".",
"New",
"(",
"ioutil",
".",
"Discard",
",",
"\"",
"\"",
",",
"0",
")",
",",
"// do not log user error",
"}",
"\n",
"go",
"srv",
".",
"Serve",
"(",
"m",
".",
"Match",
"(",
"cmux",
".",
"Any",
"(",
")",
")",
")",
"\n",
"p",
".",
"serve",
"=",
"func",
"(",
")",
"error",
"{",
"return",
"m",
".",
"Serve",
"(",
")",
"}",
"\n",
"p",
".",
"close",
"=",
"func",
"(",
"ctx",
"context",
".",
"Context",
")",
"error",
"{",
"// gracefully shutdown http.Server",
"// close open listeners, idle connections",
"// until context cancel or time-out",
"if",
"e",
".",
"cfg",
".",
"logger",
"!=",
"nil",
"{",
"e",
".",
"cfg",
".",
"logger",
".",
"Info",
"(",
"\"",
"\"",
",",
"zap",
".",
"String",
"(",
"\"",
"\"",
",",
"u",
")",
",",
")",
"\n",
"}",
"\n",
"stopServers",
"(",
"ctx",
",",
"&",
"servers",
"{",
"<mask>",
":",
"peerTLScfg",
"!=",
"nil",
",",
"grpc",
":",
"gs",
",",
"http",
":",
"srv",
"}",
")",
"\n",
"if",
"e",
".",
"cfg",
".",
"logger",
"!=",
"nil",
"{",
"e",
".",
"cfg",
".",
"logger",
".",
"Info",
"(",
"\"",
"\"",
",",
"zap",
".",
"String",
"(",
"\"",
"\"",
",",
"u",
")",
",",
")",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}",
"\n",
"}",
"\n\n",
"// start peer servers in a goroutine",
"for",
"_",
",",
"pl",
":=",
"range",
"e",
".",
"Peers",
"{",
"go",
"func",
"(",
"l",
"*",
"peerListener",
")",
"{",
"u",
":=",
"l",
".",
"Addr",
"(",
")",
".",
"String",
"(",
")",
"\n",
"if",
"e",
".",
"cfg",
".",
"logger",
"!=",
"nil",
"{",
"e",
".",
"cfg",
".",
"logger",
".",
"Info",
"(",
"\"",
"\"",
",",
"zap",
".",
"String",
"(",
"\"",
"\"",
",",
"u",
")",
",",
")",
"\n",
"}",
"else",
"{",
"plog",
".",
"Info",
"(",
"\"",
"\"",
",",
"u",
")",
"\n",
"}",
"\n",
"e",
".",
"errHandler",
"(",
"l",
".",
"serve",
"(",
")",
")",
"\n",
"}",
"(",
"pl",
")",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
] |
14,134 | all-14135 | [
"fileExists",
"reads",
"content",
"from",
"existing",
"file",
"and",
"returns",
"a",
"byte",
"array"
] | [
"func",
"fileExists",
"(",
"file",
"string",
")",
"bool",
"{",
"_",
",",
"err",
":=",
"os",
".",
"Stat",
"(",
"<mask>",
")",
"\n",
"return",
"err",
"==",
"nil",
"\n",
"}"
] |
14,135 | all-14136 | [
"NewCdromSubresource",
"returns",
"a",
"subresource",
"populated",
"with",
"all",
"of",
"the",
"necessary",
"fields",
"."
] | [
"func",
"NewCdromSubresource",
"(",
"client",
"*",
"govmomi",
".",
"Client",
",",
"rdd",
"resourceDataDiff",
",",
"d",
",",
"old",
"map",
"[",
"string",
"]",
"interface",
"{",
"}",
",",
"idx",
"int",
")",
"*",
"CdromSubresource",
"{",
"sr",
":=",
"&",
"CdromSubresource",
"{",
"Subresource",
":",
"&",
"Subresource",
"{",
"schema",
":",
"CdromSubresourceSchema",
"(",
")",
",",
"client",
":",
"client",
",",
"srtype",
":",
"subresourceTypeCdrom",
",",
"data",
":",
"d",
",",
"olddata",
":",
"<mask>",
",",
"rdd",
":",
"rdd",
",",
"}",
",",
"}",
"\n",
"sr",
".",
"Index",
"=",
"idx",
"\n",
"return",
"sr",
"\n",
"}"
] |
14,136 | all-14137 | [
"validateTeamNames",
"returns",
"an",
"error",
"if",
"any",
"current",
"/",
"previous",
"names",
"are",
"used",
"multiple",
"times",
"in",
"the",
"config",
"."
] | [
"func",
"validateTeamNames",
"(",
"orgConfig",
"org",
".",
"Config",
")",
"error",
"{",
"// Does the config duplicate any team names?",
"used",
":=",
"sets",
".",
"String",
"{",
"}",
"\n",
"dups",
":=",
"sets",
".",
"String",
"{",
"}",
"\n",
"for",
"<mask>",
",",
"orgTeam",
":=",
"range",
"orgConfig",
".",
"Teams",
"{",
"if",
"used",
".",
"Has",
"(",
"name",
")",
"{",
"dups",
".",
"Insert",
"(",
"name",
")",
"\n",
"}",
"else",
"{",
"used",
".",
"Insert",
"(",
"name",
")",
"\n",
"}",
"\n",
"for",
"_",
",",
"n",
":=",
"range",
"orgTeam",
".",
"Previously",
"{",
"if",
"used",
".",
"Has",
"(",
"n",
")",
"{",
"dups",
".",
"Insert",
"(",
"n",
")",
"\n",
"}",
"else",
"{",
"used",
".",
"Insert",
"(",
"n",
")",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n",
"if",
"n",
":=",
"len",
"(",
"dups",
")",
";",
"n",
">",
"0",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"n",
",",
"strings",
".",
"Join",
"(",
"dups",
".",
"List",
"(",
")",
",",
"\"",
"\"",
")",
")",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
] |
14,137 | all-14138 | [
"SetConfigFromFlags",
"initializes",
"driver",
"values",
"from",
"the",
"command",
"line",
"values",
"and",
"checks",
"if",
"the",
"arguments",
"have",
"values",
"."
] | [
"func",
"(",
"d",
"*",
"Driver",
")",
"SetConfigFromFlags",
"(",
"fl",
"drivers",
".",
"DriverOptions",
")",
"error",
"{",
"// Initialize driver context for machine",
"d",
".",
"ctx",
"=",
"&",
"azureutil",
".",
"DeploymentContext",
"{",
"}",
"\n\n",
"// Required string flags",
"flags",
":=",
"[",
"]",
"struct",
"{",
"target",
"*",
"string",
"\n",
"flag",
"string",
"\n",
"}",
"{",
"{",
"&",
"d",
".",
"BaseDriver",
".",
"SSHUser",
",",
"flAzureSSHUser",
"}",
",",
"{",
"&",
"d",
".",
"SubscriptionID",
",",
"flAzureSubscriptionID",
"}",
",",
"{",
"&",
"d",
".",
"ResourceGroup",
",",
"flAzureResourceGroup",
"}",
",",
"{",
"&",
"d",
".",
"Location",
",",
"flAzureLocation",
"}",
",",
"{",
"&",
"d",
".",
"Size",
",",
"flAzureSize",
"}",
",",
"{",
"&",
"d",
".",
"Image",
",",
"flAzureImage",
"}",
",",
"{",
"&",
"d",
".",
"VirtualNetwork",
",",
"flAzureVNet",
"}",
",",
"{",
"&",
"d",
".",
"SubnetName",
",",
"flAzureSubnet",
"}",
",",
"{",
"&",
"d",
".",
"SubnetPrefix",
",",
"flAzureSubnetPrefix",
"}",
",",
"{",
"&",
"d",
".",
"AvailabilitySet",
",",
"flAzureAvailabilitySet",
"}",
",",
"{",
"&",
"d",
".",
"StorageType",
",",
"flAzureStorageType",
"}",
",",
"}",
"\n",
"for",
"_",
",",
"f",
":=",
"range",
"flags",
"{",
"*",
"f",
".",
"<mask>",
"=",
"fl",
".",
"String",
"(",
"f",
".",
"flag",
")",
"\n",
"if",
"*",
"f",
".",
"target",
"==",
"\"",
"\"",
"{",
"return",
"requiredOptionError",
"(",
"f",
".",
"flag",
")",
"\n",
"}",
"\n",
"}",
"\n\n",
"// Optional flags or Flags of other types",
"d",
".",
"Environment",
"=",
"fl",
".",
"String",
"(",
"flAzureEnvironment",
")",
"\n",
"d",
".",
"OpenPorts",
"=",
"fl",
".",
"StringSlice",
"(",
"flAzurePorts",
")",
"\n",
"d",
".",
"PrivateIPAddr",
"=",
"fl",
".",
"String",
"(",
"flAzurePrivateIPAddr",
")",
"\n",
"d",
".",
"UsePrivateIP",
"=",
"fl",
".",
"Bool",
"(",
"flAzureUsePrivateIP",
")",
"\n",
"d",
".",
"NoPublicIP",
"=",
"fl",
".",
"Bool",
"(",
"flAzureNoPublicIP",
")",
"\n",
"d",
".",
"StaticPublicIP",
"=",
"fl",
".",
"Bool",
"(",
"flAzureStaticPublicIP",
")",
"\n",
"d",
".",
"DockerPort",
"=",
"fl",
".",
"Int",
"(",
"flAzureDockerPort",
")",
"\n",
"d",
".",
"DNSLabel",
"=",
"fl",
".",
"String",
"(",
"flAzureDNSLabel",
")",
"\n",
"d",
".",
"CustomDataFile",
"=",
"fl",
".",
"String",
"(",
"flAzureCustomData",
")",
"\n\n",
"d",
".",
"ClientID",
"=",
"fl",
".",
"String",
"(",
"flAzureClientID",
")",
"\n",
"d",
".",
"ClientSecret",
"=",
"fl",
".",
"String",
"(",
"flAzureClientSecret",
")",
"\n\n",
"// Set flags on the BaseDriver",
"d",
".",
"BaseDriver",
".",
"SSHPort",
"=",
"sshPort",
"\n",
"d",
".",
"SetSwarmConfigFromFlags",
"(",
"fl",
")",
"\n\n",
"log",
".",
"Debug",
"(",
"\"",
"\"",
")",
"\n",
"return",
"nil",
"\n",
"}"
] |
14,138 | all-14139 | [
"Returns",
"an",
"int",
"at",
"the",
"key",
"and",
"whether",
"or",
"not",
"the",
"key",
"existed",
"and",
"the",
"value",
"was",
"an",
"int"
] | [
"func",
"(",
"t",
"Typed",
")",
"IntIf",
"(",
"<mask>",
"string",
")",
"(",
"int",
",",
"bool",
")",
"{",
"value",
",",
"exists",
":=",
"t",
"[",
"key",
"]",
"\n",
"if",
"exists",
"==",
"false",
"{",
"return",
"0",
",",
"false",
"\n",
"}",
"\n\n",
"switch",
"t",
":=",
"value",
".",
"(",
"type",
")",
"{",
"case",
"int",
":",
"return",
"t",
",",
"true",
"\n",
"case",
"int16",
":",
"return",
"int",
"(",
"t",
")",
",",
"true",
"\n",
"case",
"int32",
":",
"return",
"int",
"(",
"t",
")",
",",
"true",
"\n",
"case",
"int64",
":",
"return",
"int",
"(",
"t",
")",
",",
"true",
"\n",
"case",
"float64",
":",
"return",
"int",
"(",
"t",
")",
",",
"true",
"\n",
"case",
"string",
":",
"i",
",",
"err",
":=",
"strconv",
".",
"Atoi",
"(",
"t",
")",
"\n",
"return",
"i",
",",
"err",
"==",
"nil",
"\n",
"}",
"\n",
"return",
"0",
",",
"false",
"\n",
"}"
] |
14,139 | all-14140 | [
"bind",
"one",
"or",
"more",
"named",
"sampler",
"objects",
"to",
"a",
"sequence",
"of",
"consecutive",
"sampler",
"units"
] | [
"func",
"BindSamplers",
"(",
"<mask>",
"uint32",
",",
"count",
"int32",
",",
"samplers",
"*",
"uint32",
")",
"{",
"syscall",
".",
"Syscall",
"(",
"gpBindSamplers",
",",
"3",
",",
"uintptr",
"(",
"first",
")",
",",
"uintptr",
"(",
"count",
")",
",",
"uintptr",
"(",
"unsafe",
".",
"Pointer",
"(",
"samplers",
")",
")",
")",
"\n",
"}"
] |
14,140 | all-14141 | [
"GetType",
"returns",
"the",
"Type",
"field",
"if",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"."
] | [
"func",
"(",
"h",
"*",
"HeatmapDefinition",
")",
"GetType",
"(",
")",
"string",
"{",
"if",
"h",
"==",
"nil",
"||",
"h",
".",
"Type",
"==",
"nil",
"{",
"return",
"\"",
"\"",
"\n",
"}",
"\n",
"return",
"*",
"h",
".",
"<mask>",
"\n",
"}"
] |
14,141 | all-14142 | [
"Creates",
"new",
"geo",
"index",
"with",
"resolution",
"a",
"function",
"that",
"returns",
"a",
"new",
"entry",
"that",
"is",
"stored",
"in",
"each",
"cell",
"."
] | [
"func",
"newGeoIndex",
"(",
"resolution",
"Meters",
",",
"newEntry",
"func",
"(",
")",
"interface",
"{",
"}",
")",
"*",
"geoIndex",
"{",
"return",
"&",
"geoIndex",
"{",
"resolution",
",",
"make",
"(",
"<mask>",
"[",
"cell",
"]",
"interface",
"{",
"}",
")",
",",
"newEntry",
"}",
"\n",
"}"
] |
14,142 | all-14143 | [
"Returns",
"string",
"representation",
"of",
"a",
"Status",
".",
"Panics",
"if",
"given",
"an",
"invalid",
"status",
"(",
"this",
"will",
"be",
"recovered",
"in",
"check",
".",
"Finish",
"if",
"it",
"has",
"been",
"deferred",
")",
"."
] | [
"func",
"(",
"s",
"Status",
")",
"String",
"(",
")",
"string",
"{",
"switch",
"s",
"{",
"<mask>",
"OK",
":",
"return",
"\"",
"\"",
"\n",
"case",
"WARNING",
":",
"return",
"\"",
"\"",
"\n",
"case",
"CRITICAL",
":",
"return",
"\"",
"\"",
"\n",
"case",
"UNKNOWN",
":",
"return",
"\"",
"\"",
"\n",
"}",
"\n",
"panic",
"(",
"\"",
"\"",
")",
"\n",
"}"
] |
14,143 | all-14144 | [
"StoragePoolNodeConfigs",
"returns",
"the",
"node",
"-",
"specific",
"configuration",
"of",
"all",
"nodes",
"grouped",
"by",
"node",
"name",
"for",
"the",
"given",
"poolID",
".",
"If",
"the",
"storage",
"pool",
"is",
"not",
"defined",
"on",
"all",
"nodes",
"an",
"error",
"is",
"returned",
"."
] | [
"func",
"(",
"c",
"*",
"ClusterTx",
")",
"StoragePoolNodeConfigs",
"(",
"poolID",
"int64",
")",
"(",
"map",
"[",
"string",
"]",
"map",
"[",
"string",
"]",
"string",
",",
"error",
")",
"{",
"// Fetch all nodes.",
"nodes",
",",
"err",
":=",
"c",
".",
"Nodes",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"// Fetch the names of the nodes where the storage pool is defined.",
"stmt",
":=",
"`\nSELECT nodes.name FROM nodes\n LEFT JOIN storage_pools_nodes ON storage_pools_nodes.node_id = nodes.id\n LEFT JOIN storage_pools ON storage_pools_nodes.storage_pool_id = storage_pools.id\nWHERE storage_pools.id = ? AND storage_pools.state = ?\n`",
"\n",
"defined",
",",
"err",
":=",
"query",
".",
"SelectStrings",
"(",
"c",
".",
"tx",
",",
"stmt",
",",
"poolID",
",",
"storagePoolPending",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"// Figure which nodes are missing",
"missing",
":=",
"[",
"]",
"string",
"{",
"}",
"\n",
"for",
"_",
",",
"node",
":=",
"range",
"nodes",
"{",
"if",
"!",
"shared",
".",
"StringInSlice",
"(",
"node",
".",
"Name",
",",
"defined",
")",
"{",
"missing",
"=",
"append",
"(",
"missing",
",",
"node",
".",
"Name",
")",
"\n",
"}",
"\n",
"}",
"\n\n",
"if",
"len",
"(",
"missing",
")",
">",
"0",
"{",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"strings",
".",
"Join",
"(",
"<mask>",
",",
"\"",
"\"",
")",
")",
"\n",
"}",
"\n\n",
"configs",
":=",
"map",
"[",
"string",
"]",
"map",
"[",
"string",
"]",
"string",
"{",
"}",
"\n",
"for",
"_",
",",
"node",
":=",
"range",
"nodes",
"{",
"config",
",",
"err",
":=",
"query",
".",
"SelectConfig",
"(",
"c",
".",
"tx",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"poolID",
",",
"node",
".",
"ID",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"configs",
"[",
"node",
".",
"Name",
"]",
"=",
"config",
"\n",
"}",
"\n\n",
"return",
"configs",
",",
"nil",
"\n",
"}"
] |
14,144 | all-14145 | [
"Load",
"all",
"containers",
"across",
"all",
"projects",
"."
] | [
"func",
"containerLoadFromAllProjects",
"(",
"s",
"*",
"state",
".",
"State",
")",
"(",
"[",
"]",
"container",
",",
"error",
")",
"{",
"var",
"<mask>",
"[",
"]",
"string",
"\n\n",
"err",
":=",
"s",
".",
"Cluster",
".",
"Transaction",
"(",
"func",
"(",
"tx",
"*",
"db",
".",
"ClusterTx",
")",
"error",
"{",
"var",
"err",
"error",
"\n",
"projects",
",",
"err",
"=",
"tx",
".",
"ProjectNames",
"(",
")",
"\n",
"return",
"err",
"\n",
"}",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"containers",
":=",
"[",
"]",
"container",
"{",
"}",
"\n",
"for",
"_",
",",
"project",
":=",
"range",
"projects",
"{",
"projectContainers",
",",
"err",
":=",
"containerLoadByProject",
"(",
"s",
",",
"project",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"errors",
".",
"Wrapf",
"(",
"nil",
",",
"\"",
"\"",
",",
"project",
")",
"\n",
"}",
"\n",
"containers",
"=",
"append",
"(",
"containers",
",",
"projectContainers",
"...",
")",
"\n",
"}",
"\n\n",
"return",
"containers",
",",
"nil",
"\n",
"}"
] |
14,145 | all-14146 | [
"DeepCopy",
"is",
"an",
"autogenerated",
"deepcopy",
"function",
"copying",
"the",
"receiver",
"creating",
"a",
"new",
"ProviderSpecific",
"."
] | [
"func",
"(",
"in",
"ProviderSpecific",
")",
"DeepCopy",
"(",
")",
"ProviderSpecific",
"{",
"if",
"<mask>",
"==",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n",
"out",
":=",
"new",
"(",
"ProviderSpecific",
")",
"\n",
"in",
".",
"DeepCopyInto",
"(",
"out",
")",
"\n",
"return",
"*",
"out",
"\n",
"}"
] |
14,146 | all-14147 | [
"expandClusterDasConfigInfo",
"reads",
"certain",
"ResourceData",
"keys",
"and",
"returns",
"a",
"ClusterDasConfigInfo",
"."
] | [
"func",
"expandClusterDasConfigInfo",
"(",
"d",
"*",
"schema",
".",
"ResourceData",
",",
"version",
"viapi",
".",
"VSphereVersion",
")",
"*",
"types",
".",
"ClusterDasConfigInfo",
"{",
"obj",
":=",
"&",
"types",
".",
"ClusterDasConfigInfo",
"{",
"DefaultVmSettings",
":",
"expandClusterDasVMSettings",
"(",
"d",
",",
"version",
")",
",",
"Enabled",
":",
"structure",
".",
"GetBool",
"(",
"d",
",",
"\"",
"\"",
")",
",",
"HBDatastoreCandidatePolicy",
":",
"d",
".",
"Get",
"(",
"\"",
"\"",
")",
".",
"(",
"string",
")",
",",
"HostMonitoring",
":",
"d",
".",
"Get",
"(",
"\"",
"\"",
")",
".",
"(",
"string",
")",
",",
"Option",
":",
"expandResourceVSphereComputeClusterDasAdvancedOptions",
"(",
"d",
")",
",",
"VmMonitoring",
":",
"d",
".",
"Get",
"(",
"\"",
"\"",
")",
".",
"(",
"string",
")",
",",
"HeartbeatDatastore",
":",
"structure",
".",
"SliceInterfacesToManagedObjectReferences",
"(",
"d",
".",
"Get",
"(",
"\"",
"\"",
")",
".",
"(",
"*",
"schema",
".",
"Set",
")",
".",
"List",
"(",
")",
",",
"\"",
"\"",
",",
")",
",",
"}",
"\n\n",
"policy",
":=",
"d",
".",
"Get",
"(",
"\"",
"\"",
")",
".",
"(",
"string",
")",
"\n",
"if",
"<mask>",
"!=",
"clusterAdmissionControlTypeDisabled",
"{",
"obj",
".",
"AdmissionControlEnabled",
"=",
"structure",
".",
"BoolPtr",
"(",
"true",
")",
"\n",
"}",
"else",
"{",
"obj",
".",
"AdmissionControlEnabled",
"=",
"structure",
".",
"BoolPtr",
"(",
"false",
")",
"\n",
"}",
"\n",
"obj",
".",
"AdmissionControlPolicy",
"=",
"expandBaseClusterDasAdmissionControlPolicy",
"(",
"d",
",",
"policy",
",",
"version",
")",
"\n\n",
"if",
"version",
".",
"Newer",
"(",
"viapi",
".",
"VSphereVersion",
"{",
"Product",
":",
"version",
".",
"Product",
",",
"Major",
":",
"6",
"}",
")",
"{",
"obj",
".",
"VmComponentProtecting",
"=",
"d",
".",
"Get",
"(",
"\"",
"\"",
")",
".",
"(",
"string",
")",
"\n",
"}",
"\n\n",
"return",
"obj",
"\n",
"}"
] |
14,147 | all-14148 | [
"ContainerDockerStats",
"mocks",
"base",
"method"
] | [
"func",
"(",
"m",
"*",
"MockEngine",
")",
"ContainerDockerStats",
"(",
"arg0",
",",
"arg1",
"string",
")",
"(",
"*",
"types",
".",
"StatsJSON",
",",
"error",
")",
"{",
"ret",
":=",
"m",
".",
"ctrl",
".",
"Call",
"(",
"m",
",",
"\"",
"\"",
",",
"arg0",
",",
"arg1",
")",
"\n",
"ret0",
",",
"_",
":=",
"ret",
"[",
"0",
"]",
".",
"(",
"*",
"<mask>",
".",
"StatsJSON",
")",
"\n",
"ret1",
",",
"_",
":=",
"ret",
"[",
"1",
"]",
".",
"(",
"error",
")",
"\n",
"return",
"ret0",
",",
"ret1",
"\n",
"}"
] |
14,148 | all-14149 | [
"NewClient",
"creates",
"a",
"new",
"Client",
"."
] | [
"func",
"NewClient",
"(",
"index",
"int",
",",
"conf",
"*",
"ClientConfig",
")",
"(",
"*",
"Client",
",",
"error",
")",
"{",
"httpClient",
",",
"err",
":=",
"config_util",
".",
"NewClientFromConfig",
"(",
"conf",
".",
"HTTPClientConfig",
",",
"\"",
"\"",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"return",
"&",
"Client",
"{",
"index",
":",
"index",
",",
"url",
":",
"conf",
".",
"URL",
",",
"<mask>",
":",
"httpClient",
",",
"timeout",
":",
"time",
".",
"Duration",
"(",
"conf",
".",
"Timeout",
")",
",",
"}",
",",
"nil",
"\n",
"}"
] |
14,149 | all-14150 | [
"NotFound",
"wraps",
"http",
".",
"NotFound"
] | [
"func",
"NotFound",
"(",
"ctx",
"context",
".",
"Context",
",",
"w",
"http",
".",
"ResponseWriter",
",",
"r",
"*",
"<mask>",
".",
"Request",
")",
"{",
"http",
".",
"NotFound",
"(",
"w",
",",
"r",
")",
"\n",
"}"
] |
14,150 | all-14151 | [
"NewSTMSerializable",
"is",
"deprecated",
"."
] | [
"func",
"NewSTMSerializable",
"(",
"ctx",
"context",
".",
"Context",
",",
"c",
"*",
"v3",
".",
"<mask>",
",",
"apply",
"func",
"(",
"STM",
")",
"error",
")",
"(",
"*",
"v3",
".",
"TxnResponse",
",",
"error",
")",
"{",
"return",
"NewSTM",
"(",
"c",
",",
"apply",
",",
"WithAbortContext",
"(",
"ctx",
")",
",",
"WithIsolation",
"(",
"Serializable",
")",
")",
"\n",
"}"
] |
14,151 | all-14152 | [
"FromStringStringMap",
"decodes",
"input",
"into",
"output",
"with",
"the",
"same",
"type",
"as",
"base",
".",
"Only",
"fields",
"tagged",
"by",
"tagName",
"get",
"decoded",
".",
"Optional",
"argument",
"properties",
"specifies",
"fields",
"to",
"decode",
"."
] | [
"func",
"FromStringStringMap",
"(",
"tagName",
"string",
",",
"base",
"interface",
"{",
"}",
",",
"input",
"map",
"[",
"string",
"]",
"string",
")",
"(",
"output",
"interface",
"{",
"}",
",",
"err",
"error",
")",
"{",
"baseType",
":=",
"reflect",
".",
"TypeOf",
"(",
"base",
")",
"\n\n",
"valType",
":=",
"baseType",
"\n",
"if",
"baseType",
".",
"Kind",
"(",
")",
"==",
"reflect",
".",
"Ptr",
"{",
"valType",
"=",
"valType",
".",
"Elem",
"(",
")",
"\n",
"}",
"\n\n",
"// If we get a pointer in, we'll return a pointer out",
"valPtr",
":=",
"reflect",
".",
"New",
"(",
"valType",
")",
"\n",
"val",
":=",
"valPtr",
".",
"Elem",
"(",
")",
"\n",
"output",
"=",
"valPtr",
".",
"Interface",
"(",
")",
"\n\n",
"defer",
"func",
"(",
")",
"{",
"if",
"err",
"==",
"nil",
"&&",
"baseType",
".",
"Kind",
"(",
")",
"!=",
"reflect",
".",
"Ptr",
"{",
"output",
"=",
"reflect",
".",
"Indirect",
"(",
"reflect",
".",
"ValueOf",
"(",
"output",
")",
")",
".",
"Interface",
"(",
")",
"\n",
"}",
"\n",
"}",
"(",
")",
"\n\n",
"for",
"i",
":=",
"0",
";",
"i",
"<",
"valType",
".",
"NumField",
"(",
")",
";",
"i",
"++",
"{",
"field",
":=",
"valType",
".",
"Field",
"(",
"i",
")",
"\n\n",
"if",
"field",
".",
"PkgPath",
"!=",
"\"",
"\"",
"{",
"continue",
"\n",
"}",
"\n\n",
"fieldName",
",",
"opts",
":=",
"parseTag",
"(",
"field",
".",
"Tag",
".",
"Get",
"(",
"tagName",
")",
")",
"\n",
"squash",
",",
"include",
":=",
"opts",
".",
"Has",
"(",
"\"",
"\"",
")",
",",
"opts",
".",
"Has",
"(",
"\"",
"\"",
")",
"\n",
"if",
"!",
"squash",
"&&",
"(",
"fieldName",
"==",
"\"",
"\"",
"||",
"fieldName",
"==",
"\"",
"\"",
")",
"{",
"continue",
"\n",
"}",
"\n\n",
"inputStr",
",",
"fieldInInput",
":=",
"<mask>",
"[",
"fieldName",
"]",
"\n\n",
"fieldType",
":=",
"field",
".",
"Type",
"\n",
"fieldKind",
":=",
"field",
".",
"Type",
".",
"Kind",
"(",
")",
"\n\n",
"isPointerField",
":=",
"fieldKind",
"==",
"reflect",
".",
"Ptr",
"\n",
"if",
"isPointerField",
"{",
"if",
"inputStr",
"==",
"\"",
"\"",
"{",
"continue",
"\n",
"}",
"\n",
"fieldType",
"=",
"fieldType",
".",
"Elem",
"(",
")",
"\n",
"fieldKind",
"=",
"fieldType",
".",
"Kind",
"(",
")",
"\n",
"}",
"\n\n",
"var",
"iface",
"interface",
"{",
"}",
"\n\n",
"if",
"(",
"squash",
"||",
"include",
")",
"&&",
"fieldKind",
"==",
"reflect",
".",
"Struct",
"{",
"var",
"subInput",
"map",
"[",
"string",
"]",
"string",
"\n\n",
"if",
"squash",
"{",
"subInput",
"=",
"input",
"\n",
"}",
"else",
"{",
"subInput",
"=",
"make",
"(",
"map",
"[",
"string",
"]",
"string",
")",
"\n",
"for",
"k",
",",
"v",
":=",
"range",
"input",
"{",
"if",
"strings",
".",
"HasPrefix",
"(",
"k",
",",
"fieldName",
"+",
"\"",
"\"",
")",
"{",
"subInput",
"[",
"strings",
".",
"TrimPrefix",
"(",
"k",
",",
"fieldName",
"+",
"\"",
"\"",
")",
"]",
"=",
"v",
"\n",
"}",
"\n",
"}",
"\n\n",
"if",
"len",
"(",
"subInput",
")",
"==",
"0",
"{",
"continue",
"\n",
"}",
"\n",
"}",
"\n\n",
"subOutput",
",",
"err",
":=",
"FromStringStringMap",
"(",
"tagName",
",",
"val",
".",
"Field",
"(",
"i",
")",
".",
"Interface",
"(",
")",
",",
"subInput",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"val",
".",
"Field",
"(",
"i",
")",
".",
"Set",
"(",
"reflect",
".",
"ValueOf",
"(",
"subOutput",
")",
")",
"\n",
"continue",
"\n",
"}",
"\n\n",
"if",
"!",
"fieldInInput",
"||",
"inputStr",
"==",
"\"",
"\"",
"{",
"continue",
"\n",
"}",
"\n\n",
"switch",
"fieldKind",
"{",
"case",
"reflect",
".",
"Struct",
",",
"reflect",
".",
"Array",
",",
"reflect",
".",
"Interface",
",",
"reflect",
".",
"Slice",
",",
"reflect",
".",
"Map",
":",
"iface",
",",
"err",
"=",
"unmarshalToType",
"(",
"fieldType",
",",
"inputStr",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"default",
":",
"iface",
"=",
"decodeToType",
"(",
"fieldKind",
",",
"inputStr",
")",
"\n",
"}",
"\n\n",
"if",
"v",
",",
"ok",
":=",
"iface",
".",
"(",
"time",
".",
"Time",
")",
";",
"ok",
"{",
"iface",
"=",
"v",
".",
"UTC",
"(",
")",
"\n",
"}",
"\n\n",
"fieldVal",
":=",
"reflect",
".",
"ValueOf",
"(",
"iface",
")",
".",
"Convert",
"(",
"fieldType",
")",
"\n\n",
"if",
"isPointerField",
"{",
"fieldValPtr",
":=",
"reflect",
".",
"New",
"(",
"fieldType",
")",
"\n",
"fieldValPtr",
".",
"Elem",
"(",
")",
".",
"Set",
"(",
"fieldVal",
")",
"\n",
"val",
".",
"Field",
"(",
"i",
")",
".",
"Set",
"(",
"fieldValPtr",
")",
"\n",
"}",
"else",
"{",
"val",
".",
"Field",
"(",
"i",
")",
".",
"Set",
"(",
"fieldVal",
")",
"\n",
"}",
"\n",
"}",
"\n\n",
"return",
"output",
",",
"nil",
"\n",
"}"
] |
14,152 | all-14153 | [
"/",
"*",
"GtkLabel",
"GetLines",
"()",
"is",
"a",
"wrapper",
"around",
"gtk_label_get_lines",
"()",
"."
] | [
"func",
"(",
"v",
"*",
"<mask>",
")",
"GetLines",
"(",
")",
"int",
"{",
"c",
":=",
"C",
".",
"gtk_label_get_lines",
"(",
"v",
".",
"native",
"(",
")",
")",
"\n",
"return",
"int",
"(",
"c",
")",
"\n",
"}"
] |
14,153 | all-14154 | [
"Start",
"starts",
"scanning",
"blockchain",
"for",
"events",
"."
] | [
"func",
"(",
"m",
"*",
"Monitor",
")",
"Start",
"(",
")",
"{",
"logger",
":=",
"m",
".",
"logger",
".",
"Add",
"(",
"\"",
"\"",
",",
"\"",
"\"",
")",
"\n",
"ctx",
",",
"cancel",
":=",
"context",
".",
"WithCancel",
"(",
"context",
".",
"Background",
"(",
")",
")",
"\n",
"ticker",
":=",
"time",
".",
"NewTicker",
"(",
"m",
".",
"queryPause",
")",
"\n",
"m",
".",
"stopMonitor",
"=",
"func",
"(",
")",
"{",
"ticker",
".",
"Stop",
"(",
")",
"\n",
"cancel",
"(",
")",
"\n",
"}",
"\n",
"go",
"func",
"(",
")",
"{",
"for",
"{",
"select",
"{",
"<mask>",
"<-",
"ctx",
".",
"Done",
"(",
")",
":",
"return",
"\n",
"case",
"<-",
"ticker",
".",
"C",
":",
"err",
":=",
"m",
".",
"queryLogsAndCreateJobs",
"(",
"m",
".",
"getFilterLogQueries",
",",
"m",
".",
"jobsProducers",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"logger",
".",
"Warn",
"(",
"err",
".",
"Error",
"(",
")",
")",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"(",
")",
"\n",
"}"
] |
14,154 | all-14155 | [
"New",
"returns",
"a",
"new",
"OUI",
"database",
"loaded",
"from",
"the",
"specified",
"file",
"."
] | [
"func",
"New",
"(",
"file",
"string",
")",
"*",
"OuiDb",
"{",
"db",
":=",
"&",
"OuiDb",
"{",
"}",
"\n",
"if",
"err",
":=",
"<mask>",
".",
"Load",
"(",
"file",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n",
"return",
"db",
"\n",
"}"
] |
14,155 | all-14156 | [
"ReflectSetStructFieldString",
"sets",
"the",
"field",
"with",
"name",
"to",
"value",
"."
] | [
"func",
"ReflectSetStructFieldString",
"(",
"structPtr",
"interface",
"{",
"}",
",",
"name",
",",
"value",
"string",
")",
"error",
"{",
"v",
":=",
"reflect",
".",
"ValueOf",
"(",
"structPtr",
")",
"\n",
"if",
"v",
".",
"Kind",
"(",
")",
"!=",
"reflect",
".",
"Ptr",
"||",
"v",
".",
"Elem",
"(",
")",
".",
"Kind",
"(",
")",
"!=",
"reflect",
".",
"Struct",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"structPtr",
")",
"\n",
"}",
"\n",
"v",
"=",
"v",
".",
"Elem",
"(",
")",
"\n\n",
"if",
"f",
":=",
"v",
".",
"FieldByName",
"(",
"<mask>",
")",
";",
"f",
".",
"IsValid",
"(",
")",
"{",
"if",
"f",
".",
"Kind",
"(",
")",
"==",
"reflect",
".",
"String",
"{",
"f",
".",
"SetString",
"(",
"value",
")",
"\n",
"}",
"else",
"{",
"_",
",",
"err",
":=",
"fmt",
".",
"Sscan",
"(",
"value",
",",
"f",
".",
"Addr",
"(",
")",
".",
"Interface",
"(",
")",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"else",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"v",
".",
"Interface",
"(",
")",
",",
"name",
")",
"\n",
"}",
"\n\n",
"return",
"nil",
"\n",
"}"
] |
14,156 | all-14157 | [
"AddBoshDeploymentResource",
"bosh",
"deployment",
"resource",
"add"
] | [
"func",
"(",
"s",
"*",
"ConcoursePipeline",
")",
"AddBoshDeploymentResource",
"(",
"name",
"string",
",",
"source",
"map",
"[",
"string",
"]",
"<mask>",
"{",
"}",
")",
"{",
"s",
".",
"AddResource",
"(",
"name",
",",
"BoshDeploymentResourceName",
",",
"source",
")",
"\n",
"}"
] |
14,157 | all-14158 | [
"ParseEndpoint",
"endpoint",
"parses",
"an",
"endpoint",
"of",
"the",
"form",
"(",
"http|https",
")",
":",
"//",
"<host",
">",
"*",
"|",
"(",
"unix|unixs",
")",
":",
"//",
"<path",
">",
")",
"and",
"returns",
"a",
"protocol",
"(",
"tcp",
"or",
"unix",
")",
"host",
"(",
"or",
"filepath",
"if",
"a",
"unix",
"socket",
")",
"scheme",
"(",
"http",
"https",
"unix",
"unixs",
")",
"."
] | [
"func",
"ParseEndpoint",
"(",
"endpoint",
"string",
")",
"(",
"proto",
"string",
",",
"host",
"string",
",",
"scheme",
"string",
")",
"{",
"proto",
"=",
"\"",
"\"",
"\n",
"host",
"=",
"endpoint",
"\n",
"url",
",",
"uerr",
":=",
"url",
".",
"Parse",
"(",
"endpoint",
")",
"\n",
"if",
"uerr",
"!=",
"nil",
"||",
"!",
"strings",
".",
"Contains",
"(",
"endpoint",
",",
"\"",
"\"",
")",
"{",
"return",
"proto",
",",
"host",
",",
"scheme",
"\n",
"}",
"\n",
"scheme",
"=",
"url",
".",
"Scheme",
"\n\n",
"// strip scheme:// prefix since grpc dials by host",
"<mask>",
"=",
"url",
".",
"Host",
"\n",
"switch",
"url",
".",
"Scheme",
"{",
"case",
"\"",
"\"",
",",
"\"",
"\"",
":",
"case",
"\"",
"\"",
",",
"\"",
"\"",
":",
"proto",
"=",
"\"",
"\"",
"\n",
"host",
"=",
"url",
".",
"Host",
"+",
"url",
".",
"Path",
"\n",
"default",
":",
"proto",
",",
"host",
"=",
"\"",
"\"",
",",
"\"",
"\"",
"\n",
"}",
"\n",
"return",
"proto",
",",
"host",
",",
"scheme",
"\n",
"}"
] |
14,158 | all-14159 | [
"MarshalJSON",
"supports",
"json",
".",
"Marshaler",
"interface"
] | [
"func",
"(",
"v",
"EventLoadEventFired",
")",
"MarshalJSON",
"(",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"w",
":=",
"jwriter",
".",
"Writer",
"{",
"}",
"\n",
"easyjsonC5a4559bEncodeGithubComChromedpCdprotoPage54",
"(",
"&",
"w",
",",
"v",
")",
"\n",
"return",
"w",
".",
"<mask>",
".",
"BuildBytes",
"(",
")",
",",
"w",
".",
"Error",
"\n",
"}"
] |
14,159 | all-14160 | [
"StringWithinTransport",
"returns",
"a",
"string",
"representation",
"of",
"the",
"reference",
"which",
"MUST",
"be",
"such",
"that",
"reference",
".",
"Transport",
"()",
".",
"ParseReference",
"(",
"reference",
".",
"StringWithinTransport",
"()",
")",
"returns",
"an",
"equivalent",
"reference",
".",
"NOTE",
":",
"The",
"returned",
"string",
"is",
"not",
"promised",
"to",
"be",
"equal",
"to",
"the",
"original",
"input",
"to",
"ParseReference",
";",
"e",
".",
"g",
".",
"default",
"attribute",
"values",
"omitted",
"by",
"the",
"user",
"may",
"be",
"filled",
"in",
"in",
"the",
"return",
"value",
"or",
"vice",
"versa",
".",
"WARNING",
":",
"Do",
"not",
"use",
"the",
"return",
"value",
"in",
"the",
"UI",
"to",
"describe",
"an",
"image",
"it",
"does",
"not",
"contain",
"the",
"Transport",
"()",
".",
"Name",
"()",
"prefix",
"."
] | [
"func",
"(",
"ref",
"ociReference",
")",
"StringWithinTransport",
"(",
")",
"string",
"{",
"return",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"ref",
".",
"dir",
",",
"<mask>",
".",
"image",
")",
"\n",
"}"
] |
14,160 | all-14161 | [
"GetNodeTypeOk",
"returns",
"a",
"tuple",
"with",
"the",
"NodeType",
"field",
"if",
"it",
"s",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"and",
"a",
"boolean",
"to",
"check",
"if",
"the",
"value",
"has",
"been",
"set",
"."
] | [
"func",
"(",
"h",
"*",
"HostmapDefinition",
")",
"GetNodeTypeOk",
"(",
")",
"(",
"string",
",",
"bool",
")",
"{",
"if",
"h",
"==",
"nil",
"||",
"h",
".",
"NodeType",
"==",
"nil",
"{",
"return",
"\"",
"\"",
",",
"false",
"\n",
"}",
"\n",
"return",
"*",
"h",
".",
"NodeType",
",",
"<mask>",
"\n",
"}"
] |
14,161 | all-14162 | [
"GetDash",
"is",
"a",
"wrapper",
"around",
"cairo_get_dash",
"()",
"."
] | [
"func",
"(",
"v",
"*",
"Context",
")",
"GetDash",
"(",
")",
"(",
"dashes",
"[",
"]",
"float64",
",",
"offset",
"float64",
")",
"{",
"dashCount",
":=",
"v",
".",
"GetDashCount",
"(",
")",
"\n",
"cdashes",
":=",
"(",
"*",
"C",
".",
"double",
")",
"(",
"C",
".",
"calloc",
"(",
"8",
",",
"C",
".",
"size_t",
"(",
"dashCount",
")",
")",
")",
"\n",
"var",
"coffset",
"C",
".",
"double",
"\n",
"C",
".",
"cairo_get_dash",
"(",
"v",
".",
"native",
"(",
")",
",",
"cdashes",
",",
"&",
"coffset",
")",
"\n",
"header",
":=",
"(",
"*",
"reflect",
".",
"SliceHeader",
")",
"(",
"(",
"unsafe",
".",
"Pointer",
"(",
"&",
"dashes",
")",
")",
")",
"\n",
"header",
".",
"Data",
"=",
"uintptr",
"(",
"unsafe",
".",
"Pointer",
"(",
"cdashes",
")",
")",
"\n",
"<mask>",
".",
"Len",
"=",
"dashCount",
"\n",
"header",
".",
"Cap",
"=",
"dashCount",
"\n",
"return",
"dashes",
",",
"float64",
"(",
"coffset",
")",
"\n",
"}"
] |
14,162 | all-14163 | [
"dial",
"configures",
"and",
"dials",
"any",
"grpc",
"balancer",
"target",
"."
] | [
"func",
"(",
"c",
"*",
"Client",
")",
"dial",
"(",
"target",
"string",
",",
"creds",
"*",
"credentials",
".",
"TransportCredentials",
",",
"dopts",
"...",
"grpc",
".",
"DialOption",
")",
"(",
"*",
"grpc",
".",
"ClientConn",
",",
"error",
")",
"{",
"opts",
",",
"err",
":=",
"c",
".",
"dialSetupOpts",
"(",
"creds",
",",
"dopts",
"...",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"}",
"\n\n",
"if",
"c",
".",
"Username",
"!=",
"\"",
"\"",
"&&",
"c",
".",
"Password",
"!=",
"\"",
"\"",
"{",
"c",
".",
"tokenCred",
"=",
"&",
"authTokenCredential",
"{",
"tokenMu",
":",
"&",
"sync",
".",
"RWMutex",
"{",
"}",
",",
"}",
"\n\n",
"ctx",
",",
"cancel",
":=",
"c",
".",
"ctx",
",",
"func",
"(",
")",
"{",
"}",
"\n",
"if",
"c",
".",
"cfg",
".",
"DialTimeout",
">",
"0",
"{",
"ctx",
",",
"cancel",
"=",
"context",
".",
"WithTimeout",
"(",
"ctx",
",",
"c",
".",
"cfg",
".",
"DialTimeout",
")",
"\n",
"}",
"\n\n",
"err",
"=",
"c",
".",
"getToken",
"(",
"ctx",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"if",
"toErr",
"(",
"ctx",
",",
"err",
")",
"!=",
"rpctypes",
".",
"ErrAuthNotEnabled",
"{",
"if",
"err",
"==",
"ctx",
".",
"Err",
"(",
")",
"&&",
"ctx",
".",
"Err",
"(",
")",
"!=",
"c",
".",
"ctx",
".",
"Err",
"(",
")",
"{",
"err",
"=",
"context",
".",
"DeadlineExceeded",
"\n",
"}",
"\n",
"cancel",
"(",
")",
"\n",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"}",
"else",
"{",
"opts",
"=",
"append",
"(",
"opts",
",",
"grpc",
".",
"WithPerRPCCredentials",
"(",
"c",
".",
"tokenCred",
")",
")",
"\n",
"}",
"\n",
"cancel",
"(",
")",
"\n",
"}",
"\n\n",
"opts",
"=",
"append",
"(",
"opts",
",",
"c",
".",
"cfg",
".",
"DialOptions",
"...",
")",
"\n\n",
"dctx",
":=",
"c",
".",
"ctx",
"\n",
"if",
"c",
".",
"cfg",
".",
"DialTimeout",
">",
"0",
"{",
"var",
"cancel",
"context",
".",
"CancelFunc",
"\n",
"dctx",
",",
"cancel",
"=",
"context",
".",
"WithTimeout",
"(",
"c",
".",
"ctx",
",",
"c",
".",
"cfg",
".",
"DialTimeout",
")",
"\n",
"defer",
"cancel",
"(",
")",
"// TODO: Is this right for cases where grpc.WithBlock() is not set on the dial options?",
"\n",
"}",
"\n\n",
"<mask>",
",",
"err",
":=",
"grpc",
".",
"DialContext",
"(",
"dctx",
",",
"target",
",",
"opts",
"...",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"return",
"conn",
",",
"nil",
"\n",
"}"
] |
14,163 | all-14164 | [
"GetAttachedTo",
"is",
"a",
"wrapper",
"around",
"gtk_window_get_attached_to",
"()",
"."
] | [
"func",
"(",
"v",
"*",
"Window",
")",
"GetAttachedTo",
"(",
")",
"(",
"*",
"Widget",
",",
"error",
")",
"{",
"c",
":=",
"C",
".",
"gtk_window_get_attached_to",
"(",
"v",
".",
"native",
"(",
")",
")",
"\n",
"if",
"c",
"==",
"nil",
"{",
"return",
"nil",
",",
"nilPtrErr",
"\n",
"}",
"\n",
"<mask>",
"wrapWidget",
"(",
"glib",
".",
"Take",
"(",
"unsafe",
".",
"Pointer",
"(",
"c",
")",
")",
")",
",",
"nil",
"\n",
"}"
] |
14,164 | all-14165 | [
"HasType",
"returns",
"a",
"boolean",
"if",
"a",
"field",
"has",
"been",
"set",
"."
] | [
"func",
"(",
"t",
"*",
"ToplistDefinition",
")",
"HasType",
"(",
")",
"bool",
"{",
"if",
"t",
"!=",
"nil",
"&&",
"t",
".",
"Type",
"!=",
"nil",
"{",
"return",
"<mask>",
"\n",
"}",
"\n\n",
"return",
"false",
"\n",
"}"
] |
14,165 | all-14166 | [
"GetDriverVersion",
"is",
"a",
"getter",
"for",
"nvidia",
"driver",
"version"
] | [
"func",
"(",
"n",
"*",
"NvidiaGPUManager",
")",
"GetDriverVersion",
"(",
")",
"string",
"{",
"n",
".",
"lock",
".",
"RLock",
"(",
")",
"\n",
"defer",
"n",
".",
"<mask>",
".",
"RUnlock",
"(",
")",
"\n",
"return",
"n",
".",
"DriverVersion",
"\n",
"}"
] |
14,166 | all-14167 | [
"NewPackageList",
"creates",
"a",
"new",
"package",
"registry"
] | [
"func",
"NewPackageList",
"(",
")",
"PackageList",
"{",
"var",
"<mask>",
"sync",
".",
"Mutex",
"\n",
"return",
"&",
"packageList",
"{",
"make",
"(",
"map",
"[",
"string",
"]",
"Package",
")",
",",
"lock",
"}",
"\n",
"}"
] |
14,167 | all-14168 | [
"/",
"1",
".",
"0",
"/",
"storage",
"-",
"pools",
"/",
"{",
"name",
"}",
"Delete",
"storage",
"pool",
"."
] | [
"func",
"storagePoolDelete",
"(",
"d",
"*",
"Daemon",
",",
"r",
"*",
"http",
".",
"Request",
")",
"Response",
"{",
"poolName",
":=",
"mux",
".",
"Vars",
"(",
"r",
")",
"[",
"\"",
"\"",
"]",
"\n\n",
"poolID",
",",
"err",
":=",
"d",
".",
"cluster",
".",
"StoragePoolGetID",
"(",
"poolName",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"NotFound",
"(",
"err",
")",
"\n",
"}",
"\n\n",
"// If this is not an internal cluster request, check if the storage",
"// pool has any volumes associated with it, if so error out.",
"if",
"!",
"isClusterNotification",
"(",
"r",
")",
"{",
"response",
":=",
"storagePoolDeleteCheckPreconditions",
"(",
"d",
".",
"cluster",
",",
"poolName",
",",
"poolID",
")",
"\n",
"if",
"<mask>",
"!=",
"nil",
"{",
"return",
"response",
"\n",
"}",
"\n",
"}",
"\n\n",
"// Check if the pool is pending, if so we just need to delete it from",
"// the database.",
"_",
",",
"pool",
",",
"err",
":=",
"d",
".",
"cluster",
".",
"StoragePoolGet",
"(",
"poolName",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"SmartError",
"(",
"err",
")",
"\n",
"}",
"\n",
"if",
"pool",
".",
"Status",
"==",
"\"",
"\"",
"{",
"_",
",",
"err",
":=",
"d",
".",
"cluster",
".",
"StoragePoolDelete",
"(",
"poolName",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"SmartError",
"(",
"err",
")",
"\n",
"}",
"\n",
"return",
"EmptySyncResponse",
"\n",
"}",
"\n\n",
"s",
",",
"err",
":=",
"storagePoolInit",
"(",
"d",
".",
"State",
"(",
")",
",",
"poolName",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"InternalError",
"(",
"err",
")",
"\n",
"}",
"\n\n",
"// If this is a notification for a ceph pool deletion, we don't want to",
"// actually delete the pool, since that will be done by the node that",
"// notified us. We just need to delete the local mountpoint.",
"if",
"s",
",",
"ok",
":=",
"s",
".",
"(",
"*",
"storageCeph",
")",
";",
"ok",
"&&",
"isClusterNotification",
"(",
"r",
")",
"{",
"// Delete the mountpoint for the storage pool.",
"poolMntPoint",
":=",
"getStoragePoolMountPoint",
"(",
"s",
".",
"pool",
".",
"Name",
")",
"\n",
"if",
"shared",
".",
"PathExists",
"(",
"poolMntPoint",
")",
"{",
"err",
":=",
"os",
".",
"RemoveAll",
"(",
"poolMntPoint",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"SmartError",
"(",
"err",
")",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"EmptySyncResponse",
"\n",
"}",
"\n\n",
"volumeNames",
",",
"err",
":=",
"d",
".",
"cluster",
".",
"StoragePoolVolumesGetNames",
"(",
"poolID",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"InternalError",
"(",
"err",
")",
"\n",
"}",
"\n\n",
"for",
"_",
",",
"volume",
":=",
"range",
"volumeNames",
"{",
"_",
",",
"imgInfo",
",",
"err",
":=",
"d",
".",
"cluster",
".",
"ImageGet",
"(",
"\"",
"\"",
",",
"volume",
",",
"false",
",",
"false",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"InternalError",
"(",
"err",
")",
"\n",
"}",
"\n\n",
"err",
"=",
"doDeleteImageFromPool",
"(",
"d",
".",
"State",
"(",
")",
",",
"imgInfo",
".",
"Fingerprint",
",",
"poolName",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"InternalError",
"(",
"err",
")",
"\n",
"}",
"\n",
"}",
"\n\n",
"err",
"=",
"s",
".",
"StoragePoolDelete",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"InternalError",
"(",
"err",
")",
"\n",
"}",
"\n\n",
"// If this is a cluster notification, we're done, any database work",
"// will be done by the node that is originally serving the request.",
"if",
"isClusterNotification",
"(",
"r",
")",
"{",
"return",
"EmptySyncResponse",
"\n",
"}",
"\n\n",
"// If we are clustered, also notify all other nodes, if any.",
"clustered",
",",
"err",
":=",
"cluster",
".",
"Enabled",
"(",
"d",
".",
"db",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"SmartError",
"(",
"err",
")",
"\n",
"}",
"\n",
"if",
"clustered",
"{",
"notifier",
",",
"err",
":=",
"cluster",
".",
"NewNotifier",
"(",
"d",
".",
"State",
"(",
")",
",",
"d",
".",
"endpoints",
".",
"NetworkCert",
"(",
")",
",",
"cluster",
".",
"NotifyAll",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"SmartError",
"(",
"err",
")",
"\n",
"}",
"\n",
"err",
"=",
"notifier",
"(",
"func",
"(",
"client",
"lxd",
".",
"ContainerServer",
")",
"error",
"{",
"_",
",",
"_",
",",
"err",
":=",
"client",
".",
"GetServer",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"return",
"client",
".",
"DeleteStoragePool",
"(",
"poolName",
")",
"\n",
"}",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"SmartError",
"(",
"err",
")",
"\n",
"}",
"\n",
"}",
"\n\n",
"err",
"=",
"dbStoragePoolDeleteAndUpdateCache",
"(",
"d",
".",
"cluster",
",",
"poolName",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"SmartError",
"(",
"err",
")",
"\n",
"}",
"\n\n",
"return",
"EmptySyncResponse",
"\n",
"}"
] |
14,168 | all-14169 | [
"PresubmitToJobSpec",
"generates",
"a",
"downwardapi",
".",
"JobSpec",
"out",
"of",
"a",
"Presubmit",
".",
"Useful",
"for",
"figuring",
"out",
"GCS",
"paths",
"when",
"parsing",
"jobs",
"out",
"of",
"a",
"prow",
"config",
"."
] | [
"func",
"PresubmitToJobSpec",
"(",
"pre",
"config",
".",
"Presubmit",
")",
"*",
"downwardapi",
".",
"JobSpec",
"{",
"return",
"&",
"downwardapi",
".",
"JobSpec",
"{",
"<mask>",
":",
"prowapi",
".",
"PresubmitJob",
",",
"Job",
":",
"pre",
".",
"Name",
",",
"}",
"\n",
"}"
] |
14,169 | all-14170 | [
"NewZipWalker",
"creates",
"a",
"new",
"Walker",
"instance",
"that",
"can",
"read",
"a",
".",
"zip",
"stream"
] | [
"func",
"NewZipWalker",
"(",
"zipFile",
"string",
")",
"Walker",
"{",
"return",
"zipWalker",
"{",
"zipPath",
":",
"zipFile",
",",
"callbacks",
":",
"<mask>",
"(",
"map",
"[",
"*",
"regexp",
".",
"Regexp",
"]",
"WalkFunc",
")",
",",
"}",
"\n",
"}"
] |
14,170 | all-14171 | [
"UnmarshalJSON",
"supports",
"json",
".",
"Unmarshaler",
"interface"
] | [
"func",
"(",
"v",
"*",
"SetRuleSelectorParams",
")",
"UnmarshalJSON",
"(",
"data",
"[",
"]",
"byte",
")",
"error",
"{",
"r",
":=",
"jlexer",
".",
"Lexer",
"{",
"Data",
":",
"data",
"}",
"\n",
"easyjsonC5a4559bDecodeGithubComChromedpCdprotoCss16",
"(",
"&",
"r",
",",
"v",
")",
"\n",
"return",
"r",
".",
"<mask>",
"(",
")",
"\n",
"}"
] |
14,171 | all-14172 | [
"Ptr",
"returns",
"a",
"pointer",
"to",
"this",
"Time",
"s",
"value",
"or",
"a",
"nil",
"pointer",
"if",
"this",
"Time",
"is",
"null",
"."
] | [
"func",
"(",
"t",
"Time",
")",
"Ptr",
"(",
")",
"*",
"<mask>",
".",
"Time",
"{",
"if",
"!",
"t",
".",
"Valid",
"{",
"return",
"nil",
"\n",
"}",
"\n",
"return",
"&",
"t",
".",
"Time",
"\n",
"}"
] |
14,172 | all-14173 | [
"UnmarshalJSON",
"supports",
"json",
".",
"Unmarshaler",
"interface"
] | [
"func",
"(",
"v",
"*",
"ComputedStyle",
")",
"UnmarshalJSON",
"(",
"<mask>",
"[",
"]",
"byte",
")",
"error",
"{",
"r",
":=",
"jlexer",
".",
"Lexer",
"{",
"Data",
":",
"data",
"}",
"\n",
"easyjsonC5a4559bDecodeGithubComChromedpCdprotoDomsnapshot13",
"(",
"&",
"r",
",",
"v",
")",
"\n",
"return",
"r",
".",
"Error",
"(",
")",
"\n",
"}"
] |
14,173 | all-14174 | [
"processCompositeLiteral",
"marks",
"fields",
"as",
"used",
"if",
"the",
"struct",
"is",
"used",
"in",
"a",
"composite",
"literal",
"."
] | [
"func",
"(",
"c",
"*",
"Checker",
")",
"processCompositeLiteral",
"(",
"pkg",
"*",
"lint",
".",
"Pkg",
",",
"node",
"ast",
".",
"Node",
")",
"{",
"// XXX how does this actually work? wouldn't it match t{}?",
"if",
"node",
",",
"ok",
":=",
"node",
".",
"(",
"*",
"ast",
".",
"CompositeLit",
")",
";",
"ok",
"{",
"typ",
":=",
"pkg",
".",
"TypesInfo",
".",
"TypeOf",
"(",
"node",
")",
"\n",
"if",
"_",
",",
"ok",
":=",
"typ",
".",
"(",
"*",
"types",
".",
"Named",
")",
";",
"ok",
"{",
"typ",
"=",
"typ",
".",
"Underlying",
"(",
")",
"\n",
"}",
"\n",
"if",
"_",
",",
"ok",
":=",
"typ",
".",
"(",
"*",
"<mask>",
".",
"Struct",
")",
";",
"!",
"ok",
"{",
"return",
"\n",
"}",
"\n\n",
"if",
"isBasicStruct",
"(",
"node",
".",
"Elts",
")",
"{",
"c",
".",
"markFields",
"(",
"typ",
")",
"\n",
"}",
"\n",
"}",
"\n",
"}"
] |
14,174 | all-14175 | [
"UInt32",
"returns",
"param",
"as",
"uint32"
] | [
"func",
"(",
"p",
"Param",
")",
"UInt32",
"(",
")",
"(",
"uint32",
",",
"error",
")",
"{",
"i",
",",
"<mask>",
":=",
"strconv",
".",
"ParseUint",
"(",
"string",
"(",
"p",
")",
",",
"10",
",",
"32",
")",
"\n",
"return",
"uint32",
"(",
"i",
")",
",",
"err",
"\n",
"}"
] |
14,175 | all-14176 | [
"DeleteServingURL",
"deletes",
"the",
"serving",
"URL",
"for",
"an",
"image",
"."
] | [
"func",
"DeleteServingURL",
"(",
"c",
"context",
".",
"Context",
",",
"key",
"appengine",
".",
"BlobKey",
")",
"error",
"{",
"req",
":=",
"&",
"<mask>",
".",
"ImagesDeleteUrlBaseRequest",
"{",
"BlobKey",
":",
"(",
"*",
"string",
")",
"(",
"&",
"key",
")",
",",
"}",
"\n",
"res",
":=",
"&",
"pb",
".",
"ImagesDeleteUrlBaseResponse",
"{",
"}",
"\n",
"return",
"internal",
".",
"Call",
"(",
"c",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"req",
",",
"res",
")",
"\n",
"}"
] |
14,176 | all-14177 | [
"CurrentSpan",
"extracts",
"OpenTracing",
"Span",
"from",
"the",
"Context",
"and",
"if",
"found",
"tries",
"to",
"extract",
"zipkin",
"-",
"style",
"trace",
"/",
"span",
"IDs",
"from",
"it",
"using",
"ZipkinSpanFormat",
"carrier",
".",
"If",
"there",
"is",
"no",
"OpenTracing",
"Span",
"in",
"the",
"Context",
"an",
"empty",
"span",
"is",
"returned",
"."
] | [
"func",
"CurrentSpan",
"(",
"ctx",
"context",
".",
"Context",
")",
"*",
"Span",
"{",
"if",
"sp",
":=",
"opentracing",
".",
"SpanFromContext",
"(",
"ctx",
")",
";",
"sp",
"!=",
"nil",
"{",
"var",
"injectable",
"injectableSpan",
"\n",
"if",
"err",
":=",
"injectable",
".",
"initFromOpenTracing",
"(",
"sp",
")",
";",
"err",
"==",
"nil",
"{",
"span",
":=",
"Span",
"(",
"injectable",
")",
"\n",
"return",
"&",
"<mask>",
"\n",
"}",
"\n",
"// return empty span on error, instead of possibly a partially filled one",
"}",
"\n",
"return",
"&",
"emptySpan",
"\n",
"}"
] |
14,177 | all-14178 | [
"/",
"*",
"IntegersFromSection",
"looks",
"for",
"an",
"array",
"of",
"integers",
"in",
"the",
"provided",
"section",
"and",
"under",
"the",
"provided",
"key",
".",
"If",
"no",
"matches",
"are",
"found",
"nil",
"is",
"returned",
"."
] | [
"func",
"(",
"config",
"*",
"Config",
")",
"IntegersFromSection",
"(",
"sectionName",
"string",
",",
"key",
"string",
")",
"[",
"]",
"int64",
"{",
"section",
":=",
"config",
".",
"sectionForName",
"(",
"sectionName",
")",
"\n\n",
"if",
"section",
"!=",
"nil",
"{",
"return",
"getIntegers",
"(",
"<mask>",
".",
"values",
",",
"key",
")",
"\n",
"}",
"\n\n",
"return",
"nil",
"\n",
"}"
] |
14,178 | all-14179 | [
"LoadVimClient",
"loads",
"a",
"saved",
"vSphere",
"SOAP",
"API",
"session",
"from",
"disk",
"previously",
"saved",
"by",
"SaveVimClient",
"checking",
"it",
"for",
"validity",
"before",
"returning",
"it",
".",
"A",
"nil",
"client",
"means",
"that",
"the",
"session",
"is",
"no",
"longer",
"valid",
"and",
"should",
"be",
"created",
"from",
"scratch",
".",
"Note",
"the",
"logic",
"in",
"this",
"function",
"has",
"been",
"largely",
"adapted",
"from",
"govc",
"and",
"is",
"designed",
"to",
"be",
"compatible",
"with",
"it",
"-",
"if",
"a",
"session",
"has",
"already",
"been",
"saved",
"with",
"govc",
"Terraform",
"will",
"attempt",
"to",
"use",
"that",
"session",
"first",
"."
] | [
"func",
"(",
"c",
"*",
"Config",
")",
"LoadVimClient",
"(",
")",
"(",
"*",
"govmomi",
".",
"Client",
",",
"error",
")",
"{",
"client",
":=",
"new",
"(",
"vim25",
".",
"Client",
")",
"\n",
"ok",
",",
"err",
":=",
"c",
".",
"restoreVimClient",
"(",
"client",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"if",
"!",
"ok",
"||",
"!",
"client",
".",
"Valid",
"(",
")",
"{",
"log",
".",
"Println",
"(",
"\"",
"\"",
")",
"\n",
"return",
"nil",
",",
"nil",
"\n",
"}",
"\n\n",
"m",
":=",
"session",
".",
"NewManager",
"(",
"client",
")",
"\n",
"u",
",",
"err",
":=",
"m",
".",
"UserSession",
"(",
"context",
".",
"TODO",
"(",
")",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"if",
"soap",
".",
"IsSoapFault",
"(",
"err",
")",
"{",
"fault",
":=",
"soap",
".",
"ToSoapFault",
"(",
"err",
")",
".",
"VimFault",
"(",
")",
"\n",
"// If the PropertyCollector is not found, the saved session for this URL is not valid",
"if",
"_",
",",
"ok",
":=",
"fault",
".",
"(",
"types",
".",
"ManagedObjectNotFound",
")",
";",
"ok",
"{",
"<mask>",
".",
"Println",
"(",
"\"",
"\"",
")",
"\n",
"return",
"nil",
",",
"nil",
"\n",
"}",
"\n",
"}",
"\n\n",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"// If the session is nil, the client is not authenticated",
"if",
"u",
"==",
"nil",
"{",
"log",
".",
"Println",
"(",
"\"",
"\"",
")",
"\n",
"return",
"nil",
",",
"nil",
"\n",
"}",
"\n\n",
"log",
".",
"Println",
"(",
"\"",
"\"",
")",
"\n",
"return",
"&",
"govmomi",
".",
"Client",
"{",
"Client",
":",
"client",
",",
"SessionManager",
":",
"m",
",",
"}",
",",
"nil",
"\n",
"}"
] |
14,179 | all-14180 | [
"LogMatrix",
"writes",
"a",
"visual",
"representation",
"of",
"the",
"given",
"matrix",
"for",
"the",
"given",
"strings",
"to",
"os",
".",
"Stderr",
".",
"This",
"function",
"is",
"deprecated",
"use",
"WriteMatrix",
"(",
"source",
"target",
"matrix",
"os",
".",
"Stderr",
")",
"instead",
"."
] | [
"func",
"LogMatrix",
"(",
"source",
"[",
"]",
"rune",
",",
"<mask>",
"[",
"]",
"rune",
",",
"matrix",
"[",
"]",
"[",
"]",
"int",
")",
"{",
"WriteMatrix",
"(",
"source",
",",
"target",
",",
"matrix",
",",
"os",
".",
"Stderr",
")",
"\n",
"}"
] |
14,180 | all-14181 | [
"DeleteConfigIfExists",
"deletes",
"config",
"directory",
"if",
"it",
"exists",
"."
] | [
"func",
"(",
"m",
"*",
"yamlManager",
")",
"DeleteConfigIfExists",
"(",
")",
"error",
"{",
"if",
"!",
"FileOrDirectoryExists",
"(",
"m",
".",
"ConfigDir",
")",
"{",
"lo",
".",
"G",
".",
"Infof",
"(",
"\"",
"\"",
",",
"m",
".",
"ConfigDir",
")",
"\n",
"return",
"nil",
"\n",
"}",
"\n",
"if",
"err",
":=",
"<mask>",
".",
"RemoveAll",
"(",
"m",
".",
"ConfigDir",
")",
";",
"err",
"!=",
"nil",
"{",
"lo",
".",
"G",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"m",
".",
"ConfigDir",
",",
"err",
")",
"\n",
"}",
"\n",
"lo",
".",
"G",
".",
"Info",
"(",
"\"",
"\"",
")",
"\n",
"return",
"nil",
"\n",
"}"
] |
14,181 | all-14182 | [
"GetPresubmit",
"returns",
"the",
"presubmit",
"job",
"for",
"the",
"provided",
"repo",
"and",
"job",
"name",
"."
] | [
"func",
"(",
"c",
"*",
"JobConfig",
")",
"GetPresubmit",
"(",
"repo",
",",
"jobName",
"string",
")",
"*",
"Presubmit",
"{",
"presubmits",
":=",
"c",
".",
"AllPresubmits",
"(",
"[",
"]",
"string",
"{",
"repo",
"}",
")",
"\n",
"for",
"i",
":=",
"range",
"presubmits",
"{",
"ps",
":=",
"presubmits",
"[",
"i",
"]",
"\n",
"if",
"ps",
".",
"<mask>",
"==",
"jobName",
"{",
"return",
"&",
"ps",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
] |
14,182 | all-14183 | [
"HasTitleSize",
"returns",
"a",
"boolean",
"if",
"a",
"field",
"has",
"been",
"set",
"."
] | [
"func",
"(",
"c",
"*",
"CheckStatusDefinition",
")",
"HasTitleSize",
"(",
")",
"bool",
"{",
"if",
"c",
"!=",
"nil",
"&&",
"c",
".",
"TitleSize",
"!=",
"nil",
"{",
"return",
"<mask>",
"\n",
"}",
"\n\n",
"return",
"false",
"\n",
"}"
] |
14,183 | all-14184 | [
"anyError",
"checks",
"an",
"http",
"Response",
"and",
"error",
"to",
"see",
"if",
"anything",
"went",
"wrong",
"with",
"a",
"request",
"(",
"either",
"locally",
"or",
"on",
"the",
"server",
")",
"and",
"returns",
"a",
"single",
"error",
"if",
"so",
"."
] | [
"func",
"anyError",
"(",
"resp",
"*",
"http",
".",
"Response",
",",
"err",
"error",
")",
"error",
"{",
"if",
"err",
"!=",
"nil",
"{",
"return",
"errors",
".",
"Wrap",
"(",
"err",
",",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"if",
"resp",
".",
"StatusCode",
"<",
"200",
"||",
"resp",
".",
"StatusCode",
">=",
"300",
"{",
"defer",
"resp",
".",
"<mask>",
".",
"Close",
"(",
")",
"\n",
"buf",
",",
"err",
":=",
"ioutil",
".",
"ReadAll",
"(",
"resp",
".",
"Body",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"errors",
".",
"Wrapf",
"(",
"err",
",",
"\"",
"\"",
",",
"resp",
".",
"Status",
")",
"\n",
"}",
"\n",
"msg",
":=",
"string",
"(",
"buf",
")",
"\n",
"return",
"errors",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"resp",
".",
"Status",
",",
"msg",
")",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
] |
14,184 | all-14185 | [
"NewHandler",
"returns",
"a",
"minifer",
"http",
"handler",
"that",
"implements",
"common",
"http",
".",
"Hander",
"related",
"interfaces",
"and",
"uses",
"a",
"common",
"configuration",
"for",
"github",
".",
"com",
"/",
"tdewolff",
"/",
"minify",
"."
] | [
"func",
"NewHandler",
"(",
"h",
"http",
".",
"Handler",
",",
"logFunc",
"LogFunc",
")",
"http",
".",
"<mask>",
"{",
"return",
"http",
".",
"HandlerFunc",
"(",
"func",
"(",
"w",
"http",
".",
"ResponseWriter",
",",
"r",
"*",
"http",
".",
"Request",
")",
"{",
"mw",
":=",
"&",
"minifyResponseWriter",
"{",
"mw",
":",
"minifier",
".",
"ResponseWriter",
"(",
"w",
",",
"r",
")",
",",
"w",
":",
"w",
"}",
"\n",
"h",
".",
"ServeHTTP",
"(",
"mw",
",",
"r",
")",
"\n",
"if",
"err",
":=",
"mw",
".",
"Close",
"(",
")",
";",
"err",
"!=",
"nil",
"&&",
"err",
"!=",
"minify",
".",
"ErrNotExist",
"&&",
"logFunc",
"!=",
"nil",
"{",
"logFunc",
"(",
"\"",
"\"",
",",
"r",
".",
"URL",
".",
"String",
"(",
")",
",",
"err",
")",
"\n",
"}",
"\n",
"}",
")",
"\n",
"}"
] |
14,185 | all-14186 | [
"reversedLabelsToIPv4",
"reverses",
"the",
"provided",
"labels",
"(",
"assumed",
"to",
"be",
"4",
"labels",
"one",
"per",
"byte",
"of",
"the",
"IPv6",
"address",
")",
"and",
"constructs",
"an",
"IPv4",
"address",
"returning",
"the",
"result",
"of",
"calling",
"net",
".",
"ParseIP",
"for",
"the",
"constructed",
"address",
"."
] | [
"func",
"reversedLabelsToIPv4",
"(",
"labels",
"[",
"]",
"string",
")",
"net",
".",
"IP",
"{",
"var",
"buf",
"strings",
".",
"Builder",
"\n\n",
"// If there aren't the right number of labels, it isn't an IPv4 address.",
"if",
"len",
"(",
"labels",
")",
"!=",
"rdnsIPv4Labels",
"{",
"return",
"nil",
"\n",
"}",
"\n\n",
"// An IPv4 address is represented as four groups of bytes separated by '.'",
"for",
"i",
":=",
"len",
"(",
"labels",
")",
"-",
"1",
";",
"i",
">=",
"0",
";",
"i",
"--",
"{",
"buf",
".",
"WriteString",
"(",
"labels",
"[",
"i",
"]",
")",
"\n",
"if",
"i",
"!=",
"0",
"{",
"buf",
".",
"WriteString",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"<mask>",
".",
"ParseIP",
"(",
"buf",
".",
"String",
"(",
")",
")",
"\n",
"}"
] |
14,186 | all-14187 | [
"AnalyzeResource",
"creates",
"an",
"API",
"descriptor",
"from",
"raw",
"resources",
"and",
"types",
"."
] | [
"func",
"(",
"a",
"*",
"APIAnalyzer",
")",
"AnalyzeResource",
"(",
"name",
"string",
",",
"res",
"map",
"[",
"string",
"]",
"interface",
"{",
"}",
",",
"desc",
"*",
"gen",
".",
"APIDescriptor",
")",
"error",
"{",
"name",
"=",
"inflect",
".",
"Singularize",
"(",
"name",
")",
"\n",
"resource",
":=",
"gen",
".",
"Resource",
"{",
"Name",
":",
"name",
",",
"ClientName",
":",
"a",
".",
"ClientName",
"}",
"\n\n",
"// Description",
"if",
"d",
",",
"ok",
":=",
"res",
"[",
"\"",
"\"",
"]",
";",
"ok",
"{",
"resource",
".",
"Description",
"=",
"removeBlankLines",
"(",
"d",
".",
"(",
"string",
")",
")",
"\n",
"}",
"\n\n",
"// Attributes",
"hasHref",
":=",
"false",
"\n",
"identifier",
":=",
"\"",
"\"",
"\n",
"attributes",
":=",
"[",
"]",
"*",
"gen",
".",
"Attribute",
"{",
"}",
"\n",
"links",
":=",
"map",
"[",
"string",
"]",
"string",
"{",
"}",
"\n",
"m",
",",
"ok",
":=",
"res",
"[",
"\"",
"\"",
"]",
".",
"(",
"string",
")",
"\n",
"if",
"ok",
"{",
"t",
",",
"ok",
":=",
"a",
".",
"RawTypes",
"[",
"m",
"]",
"\n",
"if",
"ok",
"{",
"attrs",
",",
"ok",
":=",
"t",
"[",
"\"",
"\"",
"]",
".",
"(",
"map",
"[",
"string",
"]",
"interface",
"{",
"}",
")",
"\n",
"if",
"ok",
"{",
"attributes",
"=",
"make",
"(",
"[",
"]",
"*",
"gen",
".",
"Attribute",
",",
"len",
"(",
"attrs",
")",
")",
"\n",
"for",
"idx",
",",
"n",
":=",
"range",
"sortedKeys",
"(",
"attrs",
")",
"{",
"if",
"n",
"==",
"\"",
"\"",
"{",
"hasHref",
"=",
"true",
"\n",
"}",
"\n",
"param",
",",
"err",
":=",
"a",
".",
"AnalyzeAttribute",
"(",
"n",
",",
"n",
",",
"attrs",
"[",
"n",
"]",
".",
"(",
"map",
"[",
"string",
"]",
"interface",
"{",
"}",
")",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"attributes",
"[",
"idx",
"]",
"=",
"&",
"gen",
".",
"Attribute",
"{",
"n",
",",
"inflect",
".",
"Camelize",
"(",
"n",
")",
",",
"param",
".",
"Signature",
"(",
")",
"}",
"\n",
"}",
"\n\n",
"// Extract links",
"if",
"l",
",",
"ok",
":=",
"attrs",
"[",
"\"",
"\"",
"]",
".",
"(",
"map",
"[",
"string",
"]",
"interface",
"{",
"}",
")",
";",
"<mask>",
"{",
"if",
"ltype",
",",
"ok",
":=",
"l",
"[",
"\"",
"\"",
"]",
".",
"(",
"map",
"[",
"string",
"]",
"interface",
"{",
"}",
")",
";",
"ok",
"{",
"if",
"lattrs",
",",
"ok",
":=",
"ltype",
"[",
"\"",
"\"",
"]",
".",
"(",
"map",
"[",
"string",
"]",
"interface",
"{",
"}",
")",
";",
"ok",
"{",
"links",
"=",
"make",
"(",
"map",
"[",
"string",
"]",
"string",
",",
"len",
"(",
"lattrs",
")",
")",
"\n",
"for",
"n",
",",
"d",
":=",
"range",
"lattrs",
"{",
"if",
"dm",
",",
"ok",
":=",
"d",
".",
"(",
"map",
"[",
"string",
"]",
"interface",
"{",
"}",
")",
";",
"ok",
"{",
"if",
"desc",
",",
"ok",
":=",
"dm",
"[",
"\"",
"\"",
"]",
".",
"(",
"string",
")",
";",
"ok",
"{",
"links",
"[",
"n",
"]",
"=",
"desc",
"\n",
"}",
"else",
"{",
"links",
"[",
"n",
"]",
"=",
"\"",
"\"",
"// No description in Skeletor :(",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n\n",
"// Extract media type identifier",
"if",
"id",
",",
"ok",
":=",
"t",
"[",
"\"",
"\"",
"]",
";",
"ok",
"{",
"// Praxis",
"identifier",
"=",
"id",
".",
"(",
"string",
")",
"\n",
"}",
"else",
"if",
"id",
",",
"ok",
":=",
"t",
"[",
"\"",
"\"",
"]",
";",
"ok",
"{",
"// Skeletor",
"identifier",
"=",
"id",
".",
"(",
"string",
")",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n",
"resource",
".",
"Attributes",
"=",
"attributes",
"\n",
"resource",
".",
"Identifier",
"=",
"identifier",
"\n",
"resource",
".",
"Links",
"=",
"links",
"\n",
"if",
"hasHref",
"{",
"resource",
".",
"LocatorFunc",
"=",
"locatorFunc",
"(",
"name",
")",
"\n",
"}",
"\n\n",
"// Actions",
"actions",
",",
"err",
":=",
"a",
".",
"AnalyzeActions",
"(",
"name",
",",
"res",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"resource",
".",
"Actions",
"=",
"actions",
"\n\n",
"// Name and done",
"resName",
":=",
"toGoTypeName",
"(",
"name",
")",
"\n",
"desc",
".",
"Resources",
"[",
"resName",
"]",
"=",
"&",
"resource",
"\n",
"desc",
".",
"ResourceNames",
"=",
"append",
"(",
"desc",
".",
"ResourceNames",
",",
"resName",
")",
"\n\n",
"return",
"nil",
"\n",
"}"
] |
14,187 | all-14188 | [
"NewAttrsFromMap",
"will",
"create",
"a",
"new",
"Attrs",
"struct",
"with",
"the",
"given",
"attributes",
"pre",
"-",
"populated"
] | [
"func",
"NewAttrsFromMap",
"(",
"attrs",
"map",
"[",
"string",
"]",
"<mask>",
"{",
"}",
")",
"*",
"Attrs",
"{",
"newAttrs",
":=",
"NewAttrs",
"(",
")",
"\n",
"for",
"attrKey",
",",
"attrVal",
":=",
"range",
"attrs",
"{",
"newAttrs",
".",
"SetAttr",
"(",
"attrKey",
",",
"attrVal",
")",
"\n",
"}",
"\n",
"return",
"newAttrs",
"\n",
"}"
] |
14,188 | all-14189 | [
"UnmarshalJSON",
"satisfies",
"json",
".",
"Unmarshaler",
"."
] | [
"func",
"(",
"t",
"*",
"CaptureSnapshotFormat",
")",
"UnmarshalJSON",
"(",
"buf",
"[",
"]",
"<mask>",
")",
"error",
"{",
"return",
"easyjson",
".",
"Unmarshal",
"(",
"buf",
",",
"t",
")",
"\n",
"}"
] |
14,189 | all-14190 | [
"NewEventClient",
"creates",
"an",
"EventClient",
"struct",
".",
"This",
"should",
"be",
"used",
"once",
"per",
"webhook",
"event",
"."
] | [
"func",
"NewEventClient",
"(",
"ghc",
"githubClient",
",",
"log",
"*",
"logrus",
".",
"Entry",
",",
"org",
",",
"repo",
"string",
",",
"number",
"int",
")",
"*",
"EventClient",
"{",
"return",
"&",
"EventClient",
"{",
"org",
":",
"org",
",",
"repo",
":",
"repo",
",",
"<mask>",
":",
"number",
",",
"ghc",
":",
"ghc",
",",
"log",
":",
"log",
",",
"}",
"\n",
"}"
] |
14,190 | all-14191 | [
"SendResponse",
"sends",
"a",
"JSON",
"-",
"RPC",
"response",
"message",
"through",
"the",
"connection",
"."
] | [
"func",
"(",
"c",
"*",
"Conn",
")",
"sendResponse",
"(",
"id",
"string",
",",
"result",
"interface",
"{",
"}",
",",
"err",
"*",
"ResError",
")",
"error",
"{",
"return",
"c",
".",
"send",
"(",
"response",
"{",
"<mask>",
":",
"id",
",",
"Result",
":",
"result",
",",
"Error",
":",
"err",
"}",
")",
"\n",
"}"
] |
14,191 | all-14192 | [
"fixMangledMediaType",
"is",
"used",
"to",
"insert",
";",
"separators",
"into",
"media",
"type",
"strings",
"that",
"lack",
"them",
"and",
"remove",
"repeated",
"parameters",
"."
] | [
"func",
"fixMangledMediaType",
"(",
"mtype",
",",
"sep",
"string",
")",
"string",
"{",
"if",
"mtype",
"==",
"\"",
"\"",
"{",
"return",
"\"",
"\"",
"\n",
"}",
"\n",
"<mask>",
":=",
"strings",
".",
"Split",
"(",
"mtype",
",",
"sep",
")",
"\n",
"mtype",
"=",
"\"",
"\"",
"\n",
"for",
"i",
",",
"p",
":=",
"range",
"parts",
"{",
"switch",
"i",
"{",
"case",
"0",
":",
"if",
"p",
"==",
"\"",
"\"",
"{",
"// The content type is completely missing. Put in a placeholder.",
"p",
"=",
"ctPlaceholder",
"\n",
"}",
"\n",
"default",
":",
"if",
"!",
"strings",
".",
"Contains",
"(",
"p",
",",
"\"",
"\"",
")",
"{",
"p",
"=",
"p",
"+",
"\"",
"\"",
"+",
"pvPlaceholder",
"\n",
"}",
"\n\n",
"// RFC-2047 encoded attribute name",
"p",
"=",
"rfc2047AttributeName",
"(",
"p",
")",
"\n\n",
"pair",
":=",
"strings",
".",
"Split",
"(",
"p",
",",
"\"",
"\"",
")",
"\n",
"if",
"strings",
".",
"Contains",
"(",
"mtype",
",",
"pair",
"[",
"0",
"]",
"+",
"\"",
"\"",
")",
"{",
"// Ignore repeated parameters.",
"continue",
"\n",
"}",
"\n\n",
"if",
"strings",
".",
"ContainsAny",
"(",
"pair",
"[",
"0",
"]",
",",
"\"",
"\\\"",
"\\\\",
"\"",
")",
"{",
"// attribute is a strict token and cannot be a quoted-string",
"// if any of the above characters are present in a token it",
"// must be quoted and is therefor an invalid attribute.",
"// Discard the pair.",
"continue",
"\n",
"}",
"\n",
"}",
"\n",
"mtype",
"+=",
"p",
"\n",
"// Only terminate with semicolon if not the last parameter and if it doesn't already have a",
"// semicolon.",
"if",
"i",
"!=",
"len",
"(",
"parts",
")",
"-",
"1",
"&&",
"!",
"strings",
".",
"HasSuffix",
"(",
"mtype",
",",
"\"",
"\"",
")",
"{",
"mtype",
"+=",
"\"",
"\"",
"\n",
"}",
"\n",
"}",
"\n",
"if",
"strings",
".",
"HasSuffix",
"(",
"mtype",
",",
"\"",
"\"",
")",
"{",
"mtype",
"=",
"mtype",
"[",
":",
"len",
"(",
"mtype",
")",
"-",
"1",
"]",
"\n",
"}",
"\n",
"return",
"mtype",
"\n",
"}"
] |
14,192 | all-14193 | [
"Validate",
"is",
"the",
"primary",
"entrypoint",
"into",
"this",
"class"
] | [
"func",
"(",
"s",
"*",
"OpenAPISchema",
")",
"Validate",
"(",
"obj",
"*",
"unstructured",
".",
"Unstructured",
")",
"[",
"]",
"error",
"{",
"gvk",
":=",
"obj",
".",
"GroupVersionKind",
"(",
")",
"\n",
"<mask>",
".",
"Infof",
"(",
"\"",
"\"",
",",
"gvk",
")",
"\n",
"return",
"validation",
".",
"ValidateModel",
"(",
"obj",
".",
"UnstructuredContent",
"(",
")",
",",
"s",
".",
"schema",
",",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"gvk",
".",
"Version",
",",
"gvk",
".",
"Kind",
")",
")",
"\n",
"}"
] |
14,193 | all-14194 | [
"CreateProjectCard",
"creates",
"a",
"project",
"card",
"under",
"a",
"given",
"column",
"."
] | [
"func",
"(",
"f",
"*",
"FakeClient",
")",
"CreateProjectCard",
"(",
"columnID",
"int",
",",
"projectCard",
"github",
".",
"ProjectCard",
")",
"(",
"*",
"github",
".",
"ProjectCard",
",",
"error",
")",
"{",
"if",
"f",
".",
"ColumnCardsMap",
"==",
"nil",
"{",
"f",
".",
"ColumnCardsMap",
"=",
"make",
"(",
"map",
"[",
"int",
"]",
"[",
"]",
"github",
".",
"ProjectCard",
")",
"\n",
"}",
"\n\n",
"for",
"project",
",",
"columnIDMap",
":=",
"range",
"f",
".",
"ColumnIDMap",
"{",
"columnName",
",",
"exists",
":=",
"columnIDMap",
"[",
"columnID",
"]",
"\n",
"if",
"exists",
"{",
"f",
".",
"ColumnCardsMap",
"[",
"columnID",
"]",
"=",
"append",
"(",
"f",
".",
"ColumnCardsMap",
"[",
"columnID",
"]",
",",
"projectCard",
",",
")",
"\n",
"f",
".",
"Column",
"=",
"columnName",
"\n",
"f",
".",
"Project",
"=",
"<mask>",
"\n",
"return",
"&",
"projectCard",
",",
"nil",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"columnID",
",",
"f",
".",
"ColumnIDMap",
")",
"\n",
"}"
] |
14,194 | all-14195 | [
"UnmarshalJSON",
"supports",
"json",
".",
"Unmarshaler",
"interface"
] | [
"func",
"(",
"v",
"*",
"SetAdBlockingEnabledParams",
")",
"UnmarshalJSON",
"(",
"data",
"[",
"]",
"byte",
")",
"error",
"{",
"r",
":=",
"jlexer",
".",
"Lexer",
"{",
"Data",
":",
"data",
"}",
"\n",
"easyjsonC5a4559bDecodeGithubComChromedpCdprotoPage14",
"(",
"&",
"r",
",",
"v",
")",
"\n",
"return",
"r",
".",
"<mask>",
"(",
")",
"\n",
"}"
] |
14,195 | all-14196 | [
"CreateTLSConfig",
"creates",
"tls",
".",
"Config",
"instance",
"from",
"TLS",
"parameters",
"passed",
"in",
"environment",
"variables",
"with",
"the",
"given",
"prefix"
] | [
"func",
"CreateTLSConfig",
"(",
"<mask>",
"string",
")",
"(",
"*",
"tls",
".",
"Config",
",",
"error",
")",
"{",
"caFile",
":=",
"os",
".",
"Getenv",
"(",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"prefix",
")",
")",
"\n",
"certFile",
":=",
"os",
".",
"Getenv",
"(",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"prefix",
")",
")",
"\n",
"keyFile",
":=",
"os",
".",
"Getenv",
"(",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"prefix",
")",
")",
"\n",
"serverName",
":=",
"os",
".",
"Getenv",
"(",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"prefix",
")",
")",
"\n",
"isInsecureStr",
":=",
"strings",
".",
"ToLower",
"(",
"os",
".",
"Getenv",
"(",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"prefix",
")",
")",
")",
"\n",
"isInsecure",
":=",
"isInsecureStr",
"==",
"\"",
"\"",
"||",
"isInsecureStr",
"==",
"\"",
"\"",
"||",
"isInsecureStr",
"==",
"\"",
"\"",
"\n",
"tlsConfig",
",",
"err",
":=",
"NewTLSConfig",
"(",
"certFile",
",",
"keyFile",
",",
"caFile",
",",
"serverName",
",",
"isInsecure",
",",
"defaultMinVersion",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"return",
"tlsConfig",
",",
"nil",
"\n",
"}"
] |
14,196 | all-14197 | [
"Returns",
"the",
"number",
"of",
"items",
"in",
"the",
"cache",
".",
"This",
"may",
"include",
"items",
"that",
"have",
"expired",
"but",
"have",
"not",
"yet",
"been",
"cleaned",
"up",
"."
] | [
"func",
"(",
"c",
"*",
"<mask>",
")",
"ItemCount",
"(",
")",
"int",
"{",
"c",
".",
"mu",
".",
"RLock",
"(",
")",
"\n",
"n",
":=",
"len",
"(",
"c",
".",
"items",
")",
"\n",
"c",
".",
"mu",
".",
"RUnlock",
"(",
")",
"\n",
"return",
"n",
"\n",
"}"
] |
14,197 | all-14198 | [
"AddPalette",
"()",
"is",
"a",
"wrapper",
"around",
"gtk_color_chooser_add_palette",
"()",
"."
] | [
"func",
"(",
"v",
"*",
"ColorChooser",
")",
"AddPalette",
"(",
"orientation",
"Orientation",
",",
"colors_per_line",
"int",
",",
"colors",
"[",
"]",
"*",
"gdk",
".",
"RGBA",
")",
"{",
"n_colors",
":=",
"len",
"(",
"colors",
")",
"\n",
"<mask>",
"c_colors",
"[",
"]",
"C",
".",
"GdkRGBA",
"\n",
"for",
"_",
",",
"c",
":=",
"range",
"colors",
"{",
"c_colors",
"=",
"append",
"(",
"c_colors",
",",
"*",
"(",
"*",
"C",
".",
"GdkRGBA",
")",
"(",
"unsafe",
".",
"Pointer",
"(",
"c",
".",
"Native",
"(",
")",
")",
")",
")",
"\n",
"}",
"\n",
"C",
".",
"gtk_color_chooser_add_palette",
"(",
"v",
".",
"native",
"(",
")",
",",
"C",
".",
"GtkOrientation",
"(",
"orientation",
")",
",",
"C",
".",
"gint",
"(",
"colors_per_line",
")",
",",
"C",
".",
"gint",
"(",
"n_colors",
")",
",",
"&",
"c_colors",
"[",
"0",
"]",
",",
")",
"\n",
"}"
] |
14,198 | all-14199 | [
"heartbeatHandler",
"resets",
"the",
"heartbeat",
"timer",
"when",
"HeartbeatMessage",
"message",
"is",
"received",
"from",
"tcs",
"."
] | [
"func",
"heartbeatHandler",
"(",
"<mask>",
"*",
"time",
".",
"Timer",
")",
"func",
"(",
"*",
"ecstcs",
".",
"HeartbeatMessage",
")",
"{",
"return",
"func",
"(",
"*",
"ecstcs",
".",
"HeartbeatMessage",
")",
"{",
"seelog",
".",
"Debug",
"(",
"\"",
"\"",
")",
"\n",
"timer",
".",
"Reset",
"(",
"retry",
".",
"AddJitter",
"(",
"defaultHeartbeatTimeout",
",",
"defaultHeartbeatJitter",
")",
")",
"\n",
"}",
"\n",
"}"
] |
14,199 | all-14200 | [
"SimpleActionNewStateful",
"is",
"a",
"wrapper",
"around",
"g_simple_action_new_stateful"
] | [
"func",
"SimpleActionNewStateful",
"(",
"name",
"string",
",",
"parameterType",
"*",
"VariantType",
",",
"state",
"*",
"Variant",
")",
"*",
"SimpleAction",
"{",
"c",
":=",
"C",
".",
"g_simple_action_new_stateful",
"(",
"(",
"*",
"C",
".",
"gchar",
")",
"(",
"C",
".",
"CString",
"(",
"<mask>",
")",
")",
",",
"parameterType",
".",
"native",
"(",
")",
",",
"state",
".",
"native",
"(",
")",
")",
"\n",
"if",
"c",
"==",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n",
"return",
"wrapSimpleAction",
"(",
"wrapObject",
"(",
"unsafe",
".",
"Pointer",
"(",
"c",
")",
")",
")",
"\n",
"}"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.