id
int32 0
25.3k
| idx
stringlengths 5
9
| nl_tokens
listlengths 1
418
| pl_tokens
listlengths 22
4.98k
|
---|---|---|---|
18,800 | all-18801 | [
"fills",
"all",
"a",
"texture",
"image",
"with",
"a",
"constant",
"value"
]
| [
"func",
"ClearTexImage",
"(",
"texture",
"uint32",
",",
"level",
"int32",
",",
"format",
"uint32",
",",
"xtype",
"uint32",
",",
"data",
"unsafe",
".",
"Pointer",
")",
"{",
"C",
".",
"glowClearTexImage",
"(",
"gpClearTexImage",
",",
"(",
"C",
".",
"GLuint",
")",
"(",
"texture",
")",
",",
"(",
"C",
".",
"GLint",
")",
"(",
"level",
")",
",",
"(",
"C",
".",
"GLenum",
")",
"(",
"<mask>",
")",
",",
"(",
"C",
".",
"GLenum",
")",
"(",
"xtype",
")",
",",
"data",
")",
"\n",
"}"
]
|
18,801 | all-18802 | [
"HasProjectID",
"returns",
"a",
"boolean",
"if",
"a",
"field",
"has",
"been",
"set",
"."
]
| [
"func",
"(",
"i",
"*",
"IntegrationGCPDeleteRequest",
")",
"HasProjectID",
"(",
")",
"bool",
"{",
"if",
"i",
"!=",
"nil",
"&&",
"i",
".",
"ProjectID",
"!=",
"nil",
"{",
"return",
"<mask>",
"\n",
"}",
"\n\n",
"return",
"false",
"\n",
"}"
]
|
18,802 | all-18803 | [
"New",
"creates",
"a",
"new",
"Handler",
"from",
"the",
"handler",
"that",
"is",
"wrapped",
"and",
"protected",
"with",
"recover",
"function",
"."
]
| [
"func",
"New",
"(",
"<mask>",
"http",
".",
"Handler",
",",
"options",
"...",
"Option",
")",
"(",
"h",
"*",
"Handler",
")",
"{",
"h",
"=",
"&",
"Handler",
"{",
"handler",
":",
"handler",
",",
"logf",
":",
"log",
".",
"Printf",
",",
"}",
"\n",
"for",
"_",
",",
"option",
":=",
"range",
"options",
"{",
"option",
"(",
"h",
")",
"\n",
"}",
"\n",
"return",
"\n",
"}"
]
|
18,803 | all-18804 | [
"hasPathPrefix",
"returns",
"true",
"if",
"any",
"of",
"s",
"is",
"the",
"prefix",
"of",
"p",
"."
]
| [
"func",
"hasPathPrefix",
"(",
"p",
"string",
",",
"s",
"map",
"[",
"string",
"]",
"string",
")",
"bool",
"{",
"for",
"<mask>",
":=",
"range",
"s",
"{",
"if",
"strings",
".",
"HasPrefix",
"(",
"p",
",",
"prefix",
"+",
"\"",
"\"",
")",
"{",
"return",
"true",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"false",
"\n",
"}"
]
|
18,804 | all-18805 | [
"Clients",
"returns",
"a",
"slice",
"of",
"worker",
"clients",
"for",
"a",
"pipeline",
".",
"pipelineRcName",
"is",
"the",
"name",
"of",
"the",
"pipeline",
"s",
"RC",
"and",
"can",
"be",
"gotten",
"with",
"ppsutil",
".",
"PipelineRcName",
".",
"You",
"can",
"also",
"pass",
"for",
"pipelineRcName",
"to",
"get",
"all",
"clients",
"for",
"all",
"workers",
"."
]
| [
"func",
"Clients",
"(",
"ctx",
"<mask>",
".",
"Context",
",",
"pipelineRcName",
"string",
",",
"etcdClient",
"*",
"etcd",
".",
"Client",
",",
"etcdPrefix",
"string",
",",
"workerGrpcPort",
"uint16",
")",
"(",
"[",
"]",
"Client",
",",
"error",
")",
"{",
"conns",
",",
"err",
":=",
"Conns",
"(",
"ctx",
",",
"pipelineRcName",
",",
"etcdClient",
",",
"etcdPrefix",
",",
"workerGrpcPort",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"var",
"result",
"[",
"]",
"Client",
"\n",
"for",
"_",
",",
"conn",
":=",
"range",
"conns",
"{",
"result",
"=",
"append",
"(",
"result",
",",
"newClient",
"(",
"conn",
")",
")",
"\n",
"}",
"\n",
"return",
"result",
",",
"nil",
"\n",
"}"
]
|
18,805 | all-18806 | [
"OrgExceptionsAndRepos",
"determines",
"which",
"orgs",
"and",
"repos",
"a",
"set",
"of",
"queries",
"cover",
".",
"Output",
"is",
"returned",
"as",
"a",
"mapping",
"from",
"included",
"org",
"-",
">",
"repos",
"excluded",
"in",
"the",
"org",
"and",
"a",
"set",
"of",
"included",
"repos",
"."
]
| [
"func",
"(",
"tqs",
"TideQueries",
")",
"OrgExceptionsAndRepos",
"(",
")",
"(",
"map",
"[",
"string",
"]",
"sets",
".",
"String",
",",
"sets",
".",
"String",
")",
"{",
"orgs",
":=",
"<mask>",
"(",
"map",
"[",
"string",
"]",
"sets",
".",
"String",
")",
"\n",
"for",
"i",
":=",
"range",
"tqs",
"{",
"for",
"_",
",",
"org",
":=",
"range",
"tqs",
"[",
"i",
"]",
".",
"Orgs",
"{",
"applicableRepos",
":=",
"sets",
".",
"NewString",
"(",
"reposInOrg",
"(",
"org",
",",
"tqs",
"[",
"i",
"]",
".",
"ExcludedRepos",
")",
"...",
")",
"\n",
"if",
"excepts",
",",
"ok",
":=",
"orgs",
"[",
"org",
"]",
";",
"!",
"ok",
"{",
"// We have not seen this org so the exceptions are just applicable",
"// members of 'excludedRepos'.",
"orgs",
"[",
"org",
"]",
"=",
"applicableRepos",
"\n",
"}",
"else",
"{",
"// We have seen this org so the exceptions are the applicable",
"// members of 'excludedRepos' intersected with existing exceptions.",
"orgs",
"[",
"org",
"]",
"=",
"excepts",
".",
"Intersection",
"(",
"applicableRepos",
")",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n",
"repos",
":=",
"sets",
".",
"NewString",
"(",
")",
"\n",
"for",
"i",
":=",
"range",
"tqs",
"{",
"repos",
".",
"Insert",
"(",
"tqs",
"[",
"i",
"]",
".",
"Repos",
"...",
")",
"\n",
"}",
"\n",
"// Remove any org exceptions that are explicitly included in a different query.",
"reposList",
":=",
"repos",
".",
"UnsortedList",
"(",
")",
"\n",
"for",
"_",
",",
"excepts",
":=",
"range",
"orgs",
"{",
"excepts",
".",
"Delete",
"(",
"reposList",
"...",
")",
"\n",
"}",
"\n",
"return",
"orgs",
",",
"repos",
"\n",
"}"
]
|
18,806 | all-18807 | [
"MarshalJSON",
"returns",
"the",
"Password",
"as",
"JSON"
]
| [
"func",
"(",
"r",
"Password",
")",
"MarshalJSON",
"(",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"<mask>",
"w",
"jwriter",
".",
"Writer",
"\n",
"r",
".",
"MarshalEasyJSON",
"(",
"&",
"w",
")",
"\n",
"return",
"w",
".",
"BuildBytes",
"(",
")",
"\n",
"}"
]
|
18,807 | all-18808 | [
"ExpectWithOffset",
"wraps",
"an",
"actual",
"value",
"allowing",
"assertions",
"to",
"be",
"made",
"on",
"it",
":",
"ExpectWithOffset",
"(",
"1",
"foo",
")",
".",
"To",
"(",
"Equal",
"(",
"foo",
"))",
"Unlike",
"Expect",
"and",
"Ω",
"ExpectWithOffset",
"takes",
"an",
"additional",
"integer",
"argument",
"this",
"is",
"used",
"to",
"modify",
"the",
"call",
"-",
"stack",
"offset",
"when",
"computing",
"line",
"numbers",
".",
"This",
"is",
"most",
"useful",
"in",
"helper",
"functions",
"that",
"make",
"assertions",
".",
"If",
"you",
"want",
"Gomega",
"s",
"error",
"message",
"to",
"refer",
"to",
"the",
"calling",
"line",
"in",
"the",
"test",
"(",
"as",
"opposed",
"to",
"the",
"line",
"in",
"the",
"helper",
"function",
")",
"set",
"the",
"first",
"argument",
"of",
"ExpectWithOffset",
"appropriately",
"."
]
| [
"func",
"ExpectWithOffset",
"(",
"offset",
"int",
",",
"actual",
"interface",
"{",
"}",
",",
"extra",
"...",
"<mask>",
"{",
"}",
")",
"Assertion",
"{",
"if",
"globalFailWrapper",
"==",
"nil",
"{",
"panic",
"(",
"nilFailHandlerPanic",
")",
"\n",
"}",
"\n",
"return",
"assertion",
".",
"New",
"(",
"actual",
",",
"globalFailWrapper",
",",
"offset",
",",
"extra",
"...",
")",
"\n",
"}"
]
|
18,808 | all-18809 | [
"Execute",
"render",
"template",
"with",
"default",
"application",
"layout",
"."
]
| [
"func",
"(",
"render",
"*",
"Render",
")",
"Execute",
"(",
"name",
"string",
",",
"context",
"interface",
"{",
"}",
",",
"request",
"*",
"http",
".",
"Request",
",",
"writer",
"<mask>",
".",
"ResponseWriter",
")",
"error",
"{",
"tmpl",
":=",
"&",
"Template",
"{",
"render",
":",
"render",
",",
"usingDefaultLayout",
":",
"true",
"}",
"\n",
"return",
"tmpl",
".",
"Execute",
"(",
"name",
",",
"context",
",",
"request",
",",
"writer",
")",
"\n",
"}"
]
|
18,809 | all-18810 | [
"/",
"*",
"polymorph",
"App",
"config",
"false",
"/",
"*",
"polymorph",
"App",
"name",
"false",
"Validate",
"validates",
"this",
"app"
]
| [
"func",
"(",
"m",
"*",
"App",
")",
"Validate",
"(",
"formats",
"strfmt",
".",
"Registry",
")",
"error",
"{",
"var",
"res",
"[",
"]",
"error",
"\n\n",
"if",
"len",
"(",
"res",
")",
">",
"0",
"{",
"return",
"errors",
".",
"CompositeValidationError",
"(",
"<mask>",
"...",
")",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
]
|
18,810 | all-18811 | [
"Like",
"doProfileUpdate",
"but",
"does",
"not",
"update",
"the",
"database",
"since",
"it",
"was",
"already",
"updated",
"by",
"doProfileUpdate",
"itself",
"called",
"on",
"the",
"notifying",
"node",
"."
]
| [
"func",
"doProfileUpdateCluster",
"(",
"d",
"*",
"Daemon",
",",
"project",
",",
"name",
"string",
",",
"old",
"api",
".",
"ProfilePut",
")",
"error",
"{",
"nodeName",
":=",
"\"",
"\"",
"\n",
"err",
":=",
"d",
".",
"cluster",
".",
"<mask>",
"(",
"func",
"(",
"tx",
"*",
"db",
".",
"ClusterTx",
")",
"error",
"{",
"var",
"err",
"error",
"\n",
"nodeName",
",",
"err",
"=",
"tx",
".",
"NodeName",
"(",
")",
"\n",
"return",
"err",
"\n",
"}",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"errors",
".",
"Wrap",
"(",
"err",
",",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"containers",
",",
"err",
":=",
"getProfileContainersInfo",
"(",
"d",
".",
"cluster",
",",
"project",
",",
"name",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"errors",
".",
"Wrapf",
"(",
"err",
",",
"\"",
"\"",
",",
"name",
")",
"\n",
"}",
"\n\n",
"failures",
":=",
"map",
"[",
"string",
"]",
"error",
"{",
"}",
"\n",
"for",
"_",
",",
"args",
":=",
"range",
"containers",
"{",
"err",
":=",
"doProfileUpdateContainer",
"(",
"d",
",",
"name",
",",
"old",
",",
"nodeName",
",",
"args",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"failures",
"[",
"args",
".",
"Name",
"]",
"=",
"err",
"\n",
"}",
"\n",
"}",
"\n\n",
"if",
"len",
"(",
"failures",
")",
"!=",
"0",
"{",
"msg",
":=",
"\"",
"\\n",
"\"",
"\n",
"for",
"cname",
",",
"err",
":=",
"range",
"failures",
"{",
"msg",
"+=",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\\n",
"\"",
",",
"cname",
",",
"err",
")",
"\n",
"}",
"\n",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"msg",
")",
"\n",
"}",
"\n\n",
"return",
"nil",
"\n",
"}"
]
|
18,811 | all-18812 | [
"Execute",
"substitutes",
"template",
"tags",
"(",
"placeholders",
")",
"with",
"the",
"corresponding",
"values",
"from",
"the",
"map",
"m",
"and",
"writes",
"the",
"result",
"to",
"the",
"given",
"writer",
"w",
".",
"Substitution",
"map",
"m",
"may",
"contain",
"values",
"with",
"the",
"following",
"types",
":",
"*",
"[]",
"byte",
"-",
"the",
"fastest",
"value",
"type",
"*",
"string",
"-",
"convenient",
"value",
"type",
"*",
"TagFunc",
"-",
"flexible",
"value",
"type",
"Returns",
"the",
"number",
"of",
"bytes",
"written",
"to",
"w",
".",
"This",
"function",
"is",
"optimized",
"for",
"constantly",
"changing",
"templates",
".",
"Use",
"Template",
".",
"Execute",
"for",
"frozen",
"templates",
"."
]
| [
"func",
"Execute",
"(",
"template",
",",
"startTag",
",",
"endTag",
"string",
",",
"w",
"io",
".",
"<mask>",
",",
"m",
"map",
"[",
"string",
"]",
"interface",
"{",
"}",
")",
"(",
"int64",
",",
"error",
")",
"{",
"return",
"ExecuteFunc",
"(",
"template",
",",
"startTag",
",",
"endTag",
",",
"w",
",",
"func",
"(",
"w",
"io",
".",
"Writer",
",",
"tag",
"string",
")",
"(",
"int",
",",
"error",
")",
"{",
"return",
"stdTagFunc",
"(",
"w",
",",
"tag",
",",
"m",
")",
"}",
")",
"\n",
"}"
]
|
18,812 | all-18813 | [
"Do",
"executes",
"Memory",
".",
"simulatePressureNotification",
"against",
"the",
"provided",
"context",
"."
]
| [
"func",
"(",
"p",
"*",
"SimulatePressureNotificationParams",
")",
"Do",
"(",
"ctx",
"context",
".",
"<mask>",
")",
"(",
"err",
"error",
")",
"{",
"return",
"cdp",
".",
"Execute",
"(",
"ctx",
",",
"CommandSimulatePressureNotification",
",",
"p",
",",
"nil",
")",
"\n",
"}"
]
|
18,813 | all-18814 | [
"SignalVal",
"returns",
"the",
"value",
"of",
"the",
"os",
".",
"Signal",
"at",
"the",
"pointer",
"or",
"0",
"if",
"the",
"pointer",
"is",
"nil",
"."
]
| [
"func",
"SignalVal",
"(",
"s",
"*",
"os",
".",
"Signal",
")",
"<mask>",
".",
"Signal",
"{",
"if",
"s",
"==",
"nil",
"{",
"return",
"(",
"os",
".",
"Signal",
")",
"(",
"nil",
")",
"\n",
"}",
"\n",
"return",
"*",
"s",
"\n",
"}"
]
|
18,814 | all-18815 | [
"retrieve",
"the",
"index",
"of",
"a",
"named",
"uniform",
"block"
]
| [
"func",
"GetUniformBlockIndex",
"(",
"program",
"uint32",
",",
"uniformBlockName",
"*",
"uint8",
")",
"uint32",
"{",
"<mask>",
":=",
"C",
".",
"glowGetUniformBlockIndex",
"(",
"gpGetUniformBlockIndex",
",",
"(",
"C",
".",
"GLuint",
")",
"(",
"program",
")",
",",
"(",
"*",
"C",
".",
"GLchar",
")",
"(",
"unsafe",
".",
"Pointer",
"(",
"uniformBlockName",
")",
")",
")",
"\n",
"return",
"(",
"uint32",
")",
"(",
"ret",
")",
"\n",
"}"
]
|
18,815 | all-18816 | [
"MarshalJSON",
"supports",
"json",
".",
"Marshaler",
"interface"
]
| [
"func",
"(",
"v",
"MoveToParams",
")",
"MarshalJSON",
"(",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"w",
":=",
"jwriter",
".",
"Writer",
"{",
"}",
"\n",
"easyjsonC5a4559bEncodeGithubComChromedpCdprotoDom30",
"(",
"&",
"w",
",",
"v",
")",
"\n",
"return",
"w",
".",
"<mask>",
".",
"BuildBytes",
"(",
")",
",",
"w",
".",
"Error",
"\n",
"}"
]
|
18,816 | all-18817 | [
"PadLeftF",
"is",
"the",
"filter",
"form",
"of",
"PadLeft",
"."
]
| [
"func",
"PadLeftF",
"(",
"c",
"<mask>",
",",
"n",
"int",
")",
"func",
"(",
"string",
")",
"string",
"{",
"return",
"func",
"(",
"s",
"string",
")",
"string",
"{",
"return",
"PadLeft",
"(",
"s",
",",
"c",
",",
"n",
")",
"\n",
"}",
"\n",
"}"
]
|
18,817 | all-18818 | [
"Unmarshal",
"decodes",
"the",
"first",
"document",
"found",
"within",
"the",
"in",
"byte",
"slice",
"and",
"assigns",
"decoded",
"values",
"into",
"the",
"out",
"value",
".",
"Maps",
"and",
"pointers",
"(",
"to",
"a",
"struct",
"string",
"int",
"etc",
")",
"are",
"accepted",
"as",
"out",
"values",
".",
"If",
"an",
"internal",
"pointer",
"within",
"a",
"struct",
"is",
"not",
"initialized",
"the",
"yaml",
"package",
"will",
"initialize",
"it",
"if",
"necessary",
"for",
"unmarshalling",
"the",
"provided",
"data",
".",
"The",
"out",
"parameter",
"must",
"not",
"be",
"nil",
".",
"The",
"type",
"of",
"the",
"decoded",
"values",
"should",
"be",
"compatible",
"with",
"the",
"respective",
"values",
"in",
"out",
".",
"If",
"one",
"or",
"more",
"values",
"cannot",
"be",
"decoded",
"due",
"to",
"a",
"type",
"mismatches",
"decoding",
"continues",
"partially",
"until",
"the",
"end",
"of",
"the",
"YAML",
"content",
"and",
"a",
"*",
"yaml",
".",
"TypeError",
"is",
"returned",
"with",
"details",
"for",
"all",
"missed",
"values",
".",
"Struct",
"fields",
"are",
"only",
"unmarshalled",
"if",
"they",
"are",
"exported",
"(",
"have",
"an",
"upper",
"case",
"first",
"letter",
")",
"and",
"are",
"unmarshalled",
"using",
"the",
"field",
"name",
"lowercased",
"as",
"the",
"default",
"key",
".",
"Custom",
"keys",
"may",
"be",
"defined",
"via",
"the",
"yaml",
"name",
"in",
"the",
"field",
"tag",
":",
"the",
"content",
"preceding",
"the",
"first",
"comma",
"is",
"used",
"as",
"the",
"key",
"and",
"the",
"following",
"comma",
"-",
"separated",
"options",
"are",
"used",
"to",
"tweak",
"the",
"marshalling",
"process",
"(",
"see",
"Marshal",
")",
".",
"Conflicting",
"names",
"result",
"in",
"a",
"runtime",
"error",
".",
"For",
"example",
":",
"type",
"T",
"struct",
"{",
"F",
"int",
"yaml",
":",
"a",
"omitempty",
"B",
"int",
"}",
"var",
"t",
"T",
"yaml",
".",
"Unmarshal",
"(",
"[]",
"byte",
"(",
"a",
":",
"1",
"\\",
"nb",
":",
"2",
")",
"&t",
")",
"See",
"the",
"documentation",
"of",
"Marshal",
"for",
"the",
"format",
"of",
"tags",
"and",
"a",
"list",
"of",
"supported",
"tag",
"options",
"."
]
| [
"func",
"Unmarshal",
"(",
"<mask>",
"[",
"]",
"byte",
",",
"out",
"interface",
"{",
"}",
")",
"(",
"err",
"error",
")",
"{",
"return",
"unmarshal",
"(",
"in",
",",
"out",
",",
"false",
")",
"\n",
"}"
]
|
18,818 | all-18819 | [
"Insert",
"calls",
"db",
".",
"Insert",
"()",
"returning",
"more",
"descriptive",
"error",
"."
]
| [
"func",
"Insert",
"(",
"db",
"*",
"reform",
".",
"Querier",
",",
"str",
"reform",
".",
"Struct",
")",
"error",
"{",
"if",
"err",
":=",
"<mask>",
".",
"Insert",
"(",
"str",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"str",
",",
"err",
")",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
]
|
18,819 | all-18820 | [
"RotateSecretWithContext",
"mocks",
"base",
"method"
]
| [
"func",
"(",
"m",
"*",
"MockSecretsManagerAPI",
")",
"RotateSecretWithContext",
"(",
"arg0",
"aws",
".",
"Context",
",",
"arg1",
"*",
"secretsmanager",
".",
"RotateSecretInput",
",",
"arg2",
"...",
"request",
".",
"Option",
")",
"(",
"*",
"secretsmanager",
".",
"RotateSecretOutput",
",",
"error",
")",
"{",
"varargs",
":=",
"[",
"]",
"interface",
"{",
"}",
"{",
"arg0",
",",
"arg1",
"}",
"\n",
"for",
"_",
",",
"a",
":=",
"range",
"arg2",
"{",
"varargs",
"=",
"append",
"(",
"varargs",
",",
"a",
")",
"\n",
"}",
"\n",
"ret",
":=",
"m",
".",
"ctrl",
".",
"Call",
"(",
"m",
",",
"\"",
"\"",
",",
"varargs",
"...",
")",
"\n",
"ret0",
",",
"_",
":=",
"ret",
"[",
"0",
"]",
".",
"(",
"*",
"secretsmanager",
".",
"RotateSecretOutput",
")",
"\n",
"ret1",
",",
"_",
":=",
"<mask>",
"[",
"1",
"]",
".",
"(",
"error",
")",
"\n",
"return",
"ret0",
",",
"ret1",
"\n",
"}"
]
|
18,820 | all-18821 | [
"Increment",
"or",
"initialize",
"the",
"msg",
"count",
"for",
"the",
"peer",
"in",
"the",
"CMap"
]
| [
"func",
"(",
"r",
"*",
"PEXReactor",
")",
"IncrementMsgCountForPeer",
"(",
"addr",
"string",
")",
"{",
"var",
"count",
"uint16",
"\n",
"countI",
":=",
"r",
".",
"msgCountByPeer",
".",
"Get",
"(",
"addr",
")",
"\n",
"if",
"countI",
"!=",
"nil",
"{",
"count",
"=",
"countI",
".",
"(",
"uint16",
")",
"\n",
"}",
"\n",
"count",
"++",
"\n",
"r",
".",
"msgCountByPeer",
".",
"<mask>",
"(",
"addr",
",",
"count",
")",
"\n",
"}"
]
|
18,821 | all-18822 | [
"NewClientV3",
"creates",
"a",
"new",
"grpc",
"client",
"connection",
"to",
"the",
"member"
]
| [
"func",
"NewClientV3",
"(",
"m",
"*",
"member",
")",
"(",
"*",
"clientv3",
".",
"Client",
",",
"error",
")",
"{",
"if",
"m",
".",
"grpcAddr",
"==",
"\"",
"\"",
"{",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"cfg",
":=",
"clientv3",
".",
"Config",
"{",
"Endpoints",
":",
"[",
"]",
"string",
"{",
"m",
".",
"grpcAddr",
"}",
",",
"DialTimeout",
":",
"5",
"*",
"<mask>",
".",
"Second",
",",
"DialOptions",
":",
"[",
"]",
"grpc",
".",
"DialOption",
"{",
"grpc",
".",
"WithBlock",
"(",
")",
"}",
",",
"MaxCallSendMsgSize",
":",
"m",
".",
"clientMaxCallSendMsgSize",
",",
"MaxCallRecvMsgSize",
":",
"m",
".",
"clientMaxCallRecvMsgSize",
",",
"}",
"\n\n",
"if",
"m",
".",
"ClientTLSInfo",
"!=",
"nil",
"{",
"tls",
",",
"err",
":=",
"m",
".",
"ClientTLSInfo",
".",
"ClientConfig",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"cfg",
".",
"TLS",
"=",
"tls",
"\n",
"}",
"\n",
"if",
"m",
".",
"DialOptions",
"!=",
"nil",
"{",
"cfg",
".",
"DialOptions",
"=",
"append",
"(",
"cfg",
".",
"DialOptions",
",",
"m",
".",
"DialOptions",
"...",
")",
"\n",
"}",
"\n",
"return",
"newClientV3",
"(",
"cfg",
")",
"\n",
"}"
]
|
18,822 | all-18823 | [
"tagsSchema",
"returns",
"the",
"schema",
"for",
"the",
"tags",
"configuration",
"attribute",
"for",
"each",
"resource",
"that",
"needs",
"it",
".",
"The",
"key",
"is",
"usually",
"tags",
"and",
"should",
"be",
"a",
"list",
"of",
"tag",
"IDs",
"to",
"associate",
"with",
"this",
"resource",
"."
]
| [
"func",
"tagsSchema",
"(",
")",
"*",
"schema",
".",
"Schema",
"{",
"return",
"&",
"schema",
".",
"Schema",
"{",
"Type",
":",
"schema",
".",
"TypeSet",
",",
"<mask>",
":",
"\"",
"\"",
",",
"Optional",
":",
"true",
",",
"Elem",
":",
"&",
"schema",
".",
"Schema",
"{",
"Type",
":",
"schema",
".",
"TypeString",
"}",
",",
"}",
"\n",
"}"
]
|
18,823 | all-18824 | [
"http",
"Handler",
"Interface"
]
| [
"func",
"(",
"r",
"*",
"Router",
")",
"ServeHTTP",
"(",
"w",
"http",
".",
"ResponseWriter",
",",
"req",
"*",
"http",
".",
"Request",
")",
"{",
"//now := time.Now()",
"if",
"root",
",",
"exist",
":=",
"r",
".",
"roots",
"[",
"req",
".",
"Method",
"]",
";",
"exist",
"{",
"<mask>",
",",
"params",
",",
"_",
":=",
"root",
".",
"match",
"(",
"req",
".",
"URL",
".",
"Path",
")",
"\n",
"if",
"handler",
"!=",
"nil",
"{",
"handler",
".",
"ServeHTTP",
"(",
"w",
",",
"req",
",",
"params",
")",
"\n",
"//log.Println(time.Now().Sub(now))",
"return",
"\n",
"}",
"\n",
"}",
"\n",
"r",
".",
"handleMissing",
"(",
"w",
",",
"req",
")",
"\n",
"}"
]
|
18,824 | all-18825 | [
"ReadObject",
"implements",
"ObjectCodec",
"."
]
| [
"func",
"(",
"VSCodeObjectCodec",
")",
"ReadObject",
"(",
"stream",
"*",
"bufio",
".",
"Reader",
",",
"v",
"interface",
"{",
"}",
")",
"error",
"{",
"var",
"contentLength",
"uint64",
"\n",
"for",
"{",
"line",
",",
"err",
":=",
"stream",
".",
"ReadString",
"(",
"'\\r'",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"b",
",",
"err",
":=",
"stream",
".",
"ReadByte",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"if",
"b",
"!=",
"'\\n'",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"`jsonrpc2: line endings must be \\r\\n`",
")",
"\n",
"}",
"\n",
"if",
"line",
"==",
"\"",
"\\r",
"\"",
"{",
"break",
"\n",
"}",
"\n",
"if",
"strings",
".",
"HasPrefix",
"(",
"line",
",",
"\"",
"\"",
")",
"{",
"line",
"=",
"strings",
".",
"TrimPrefix",
"(",
"line",
",",
"\"",
"\"",
")",
"\n",
"<mask>",
"=",
"strings",
".",
"TrimSpace",
"(",
"line",
")",
"\n",
"var",
"err",
"error",
"\n",
"contentLength",
",",
"err",
"=",
"strconv",
".",
"ParseUint",
"(",
"line",
",",
"10",
",",
"32",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n",
"if",
"contentLength",
"==",
"0",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"return",
"json",
".",
"NewDecoder",
"(",
"io",
".",
"LimitReader",
"(",
"stream",
",",
"int64",
"(",
"contentLength",
")",
")",
")",
".",
"Decode",
"(",
"v",
")",
"\n",
"}"
]
|
18,825 | all-18826 | [
"GetIterAtLine",
"()",
"is",
"a",
"wrapper",
"around",
"gtk_text_buffer_get_iter_at_line",
"()",
"."
]
| [
"func",
"(",
"v",
"*",
"TextBuffer",
")",
"GetIterAtLine",
"(",
"line",
"int",
")",
"*",
"TextIter",
"{",
"var",
"iter",
"C",
".",
"GtkTextIter",
"\n",
"C",
".",
"gtk_text_buffer_get_iter_at_line",
"(",
"v",
".",
"native",
"(",
")",
",",
"&",
"iter",
",",
"C",
".",
"gint",
"(",
"<mask>",
")",
")",
"\n",
"return",
"(",
"*",
"TextIter",
")",
"(",
"&",
"iter",
")",
"\n",
"}"
]
|
18,826 | all-18827 | [
"Email",
"returns",
"the",
"user",
"-",
"configured",
"email",
"for",
"the",
"authenticated",
"identity",
".",
"See",
"https",
":",
"//",
"developer",
".",
"github",
".",
"com",
"/",
"v3",
"/",
"users",
"/",
"#get",
"-",
"the",
"-",
"authenticated",
"-",
"user"
]
| [
"func",
"(",
"c",
"*",
"<mask>",
")",
"Email",
"(",
")",
"(",
"string",
",",
"error",
")",
"{",
"c",
".",
"mut",
".",
"Lock",
"(",
")",
"\n",
"defer",
"c",
".",
"mut",
".",
"Unlock",
"(",
")",
"\n",
"if",
"c",
".",
"email",
"==",
"\"",
"\"",
"{",
"if",
"err",
":=",
"c",
".",
"getUserData",
"(",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"\"",
"\"",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"c",
".",
"email",
",",
"nil",
"\n",
"}"
]
|
18,827 | all-18828 | [
"Move",
"a",
"particular",
"network",
"interface",
"to",
"a",
"particular",
"network",
"namespace",
"specified",
"by",
"PID",
".",
"This",
"is",
"identical",
"to",
"running",
":",
"ip",
"link",
"set",
"dev",
"$name",
"netns",
"$pid"
]
| [
"func",
"NetworkSetNsPid",
"(",
"iface",
"*",
"net",
".",
"Interface",
",",
"nspid",
"int",
")",
"error",
"{",
"data",
":=",
"uint32Attr",
"(",
"syscall",
".",
"IFLA_NET_NS_PID",
",",
"uint32",
"(",
"nspid",
")",
")",
"\n",
"return",
"networkSetNsAction",
"(",
"iface",
",",
"<mask>",
")",
"\n",
"}"
]
|
18,828 | all-18829 | [
"WithGeneratePreview",
"whether",
"preview",
"should",
"be",
"generated",
"for",
"the",
"result",
"."
]
| [
"func",
"(",
"p",
"EvaluateParams",
")",
"WithGeneratePreview",
"(",
"generatePreview",
"bool",
")",
"*",
"EvaluateParams",
"{",
"p",
".",
"GeneratePreview",
"=",
"generatePreview",
"\n",
"<mask>",
"&",
"p",
"\n",
"}"
]
|
18,829 | all-18830 | [
"DeleteWithParams",
"executes",
"DELETE",
"request",
"to",
"the",
"endpoint",
"with",
"optional",
"query",
"arguments",
"re",
"err",
":",
"=",
"c",
".",
"DeleteWithParams",
"(",
"c",
".",
"Endpoint",
"(",
"users",
"id1",
")",
"url",
".",
"Values",
"{",
"force",
":",
"[]",
"string",
"{",
"true",
"}}",
")"
]
| [
"func",
"(",
"c",
"*",
"<mask>",
")",
"DeleteWithParams",
"(",
"ctx",
"context",
".",
"Context",
",",
"endpoint",
"string",
",",
"params",
"url",
".",
"Values",
")",
"(",
"*",
"Response",
",",
"error",
")",
"{",
"baseURL",
",",
"err",
":=",
"url",
".",
"Parse",
"(",
"endpoint",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"baseURL",
".",
"RawQuery",
"=",
"params",
".",
"Encode",
"(",
")",
"\n",
"return",
"c",
".",
"Delete",
"(",
"ctx",
",",
"baseURL",
".",
"String",
"(",
")",
")",
"\n",
"}"
]
|
18,830 | all-18831 | [
"NewNerveDiscovery",
"returns",
"a",
"new",
"Discovery",
"for",
"the",
"given",
"Nerve",
"config",
"."
]
| [
"func",
"NewNerveDiscovery",
"(",
"conf",
"*",
"NerveSDConfig",
",",
"logger",
"log",
".",
"Logger",
")",
"(",
"*",
"Discovery",
",",
"error",
")",
"{",
"return",
"NewDiscovery",
"(",
"conf",
".",
"Servers",
",",
"<mask>",
".",
"Duration",
"(",
"conf",
".",
"Timeout",
")",
",",
"conf",
".",
"Paths",
",",
"logger",
",",
"parseNerveMember",
")",
"\n",
"}"
]
|
18,831 | all-18832 | [
"NewOp",
"creates",
"a",
"new",
"Op",
"."
]
| [
"func",
"NewOp",
"(",
"o",
"OpType",
",",
"args",
"...",
"<mask>",
"{",
"}",
")",
"Op",
"{",
"h",
":=",
"optypeToHandler",
"(",
"o",
")",
"\n\n",
"var",
"arg",
"interface",
"{",
"}",
"\n",
"if",
"len",
"(",
"args",
")",
">",
"0",
"{",
"arg",
"=",
"args",
"[",
"0",
"]",
"\n",
"}",
"\n\n",
"return",
"&",
"op",
"{",
"OpType",
":",
"o",
",",
"OpHandler",
":",
"h",
",",
"uArg",
":",
"arg",
",",
"}",
"\n",
"}"
]
|
18,832 | all-18833 | [
"ClusterAddress",
"returns",
"the",
"cluster",
"addresss",
"of",
"the",
"cluster",
"endpoint",
"or",
"an",
"empty",
"string",
"if",
"there",
"s",
"no",
"cluster",
"endpoint",
"."
]
| [
"func",
"(",
"e",
"*",
"Endpoints",
")",
"ClusterAddress",
"(",
")",
"string",
"{",
"e",
".",
"mu",
".",
"RLock",
"(",
")",
"\n",
"defer",
"e",
".",
"mu",
".",
"RUnlock",
"(",
")",
"\n\n",
"listener",
":=",
"e",
".",
"listeners",
"[",
"cluster",
"]",
"\n",
"if",
"listener",
"==",
"nil",
"{",
"return",
"\"",
"\"",
"\n",
"}",
"\n",
"return",
"listener",
".",
"Addr",
"(",
")",
".",
"<mask>",
"(",
")",
"\n",
"}"
]
|
18,833 | all-18834 | [
"Return",
"first",
"character",
"position",
"where",
"the",
"character",
"has",
"to",
"be",
"escaped"
]
| [
"func",
"(",
"e",
"*",
"encoder",
")",
"nextSpecialChar",
"(",
"p",
"[",
"]",
"byte",
")",
"(",
"i",
"int",
")",
"{",
"for",
"i",
"=",
"0",
";",
"i",
"<",
"len",
"(",
"p",
")",
";",
"i",
"++",
"{",
"// ASCII 32-126 (printable) + '\\t' - '=' can appear in the qprintable stream",
"if",
"!",
"(",
"(",
"p",
"[",
"i",
"]",
">=",
"32",
"&&",
"p",
"[",
"i",
"]",
"<=",
"126",
"&&",
"p",
"[",
"i",
"]",
"!=",
"<mask>",
"(",
"'='",
")",
")",
"||",
"p",
"[",
"i",
"]",
"==",
"byte",
"(",
"'\\t'",
")",
")",
"{",
"return",
"i",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"i",
"\n",
"}"
]
|
18,834 | all-18835 | [
"UnmarshalJSON",
"supports",
"json",
".",
"Unmarshaler",
"interface"
]
| [
"func",
"(",
"v",
"*",
"GetProcessInfoParams",
")",
"UnmarshalJSON",
"(",
"<mask>",
"[",
"]",
"byte",
")",
"error",
"{",
"r",
":=",
"jlexer",
".",
"Lexer",
"{",
"Data",
":",
"data",
"}",
"\n",
"easyjsonC5a4559bDecodeGithubComChromedpCdprotoSysteminfo2",
"(",
"&",
"r",
",",
"v",
")",
"\n",
"return",
"r",
".",
"Error",
"(",
")",
"\n",
"}"
]
|
18,835 | all-18836 | [
"Save",
"saves",
"the",
"book",
"."
]
| [
"func",
"(",
"a",
"*",
"AddrBook",
")",
"Save",
"(",
")",
"{",
"<mask>",
".",
"Info",
"(",
"\"",
"\"",
",",
"\"",
"\"",
",",
"a",
".",
"Size",
"(",
")",
")",
"\n",
"a",
".",
"saveToFile",
"(",
"a",
".",
"filePath",
")",
"\n",
"}"
]
|
18,836 | all-18837 | [
"StoragePoolVolumeTypeToName",
"converts",
"a",
"volume",
"integer",
"type",
"code",
"to",
"its",
"human",
"-",
"readable",
"name",
"."
]
| [
"func",
"StoragePoolVolumeTypeToName",
"(",
"volumeType",
"int",
")",
"(",
"string",
",",
"error",
")",
"{",
"switch",
"volumeType",
"{",
"<mask>",
"StoragePoolVolumeTypeContainer",
":",
"return",
"StoragePoolVolumeTypeNameContainer",
",",
"nil",
"\n",
"case",
"StoragePoolVolumeTypeImage",
":",
"return",
"StoragePoolVolumeTypeNameImage",
",",
"nil",
"\n",
"case",
"StoragePoolVolumeTypeCustom",
":",
"return",
"StoragePoolVolumeTypeNameCustom",
",",
"nil",
"\n",
"}",
"\n\n",
"return",
"\"",
"\"",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
")",
"\n",
"}"
]
|
18,837 | all-18838 | [
"NewTransactionResultResult",
"creates",
"a",
"new",
"TransactionResultResult",
"."
]
| [
"func",
"NewTransactionResultResult",
"(",
"code",
"TransactionResultCode",
",",
"value",
"interface",
"{",
"}",
")",
"(",
"result",
"TransactionResultResult",
",",
"err",
"error",
")",
"{",
"result",
".",
"Code",
"=",
"<mask>",
"\n",
"switch",
"TransactionResultCode",
"(",
"code",
")",
"{",
"case",
"TransactionResultCodeTxSuccess",
":",
"tv",
",",
"ok",
":=",
"value",
".",
"(",
"[",
"]",
"OperationResult",
")",
"\n",
"if",
"!",
"ok",
"{",
"err",
"=",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
")",
"\n",
"return",
"\n",
"}",
"\n",
"result",
".",
"Results",
"=",
"&",
"tv",
"\n",
"case",
"TransactionResultCodeTxFailed",
":",
"tv",
",",
"ok",
":=",
"value",
".",
"(",
"[",
"]",
"OperationResult",
")",
"\n",
"if",
"!",
"ok",
"{",
"err",
"=",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
")",
"\n",
"return",
"\n",
"}",
"\n",
"result",
".",
"Results",
"=",
"&",
"tv",
"\n",
"default",
":",
"// void",
"}",
"\n",
"return",
"\n",
"}"
]
|
18,838 | all-18839 | [
"DeleteEnvVar",
"deletes",
"the",
"specified",
"environment",
"variable",
"from",
"the",
"project"
]
| [
"func",
"(",
"c",
"*",
"<mask>",
")",
"DeleteEnvVar",
"(",
"account",
",",
"repo",
",",
"name",
"string",
")",
"error",
"{",
"return",
"c",
".",
"request",
"(",
"\"",
"\"",
",",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"account",
",",
"repo",
",",
"name",
")",
",",
"nil",
",",
"nil",
",",
"nil",
")",
"\n",
"}"
]
|
18,839 | all-18840 | [
"NewMockFileSystem",
"creates",
"a",
"new",
"mock",
"instance"
]
| [
"func",
"NewMockFileSystem",
"(",
"ctrl",
"*",
"gomock",
".",
"<mask>",
")",
"*",
"MockFileSystem",
"{",
"mock",
":=",
"&",
"MockFileSystem",
"{",
"ctrl",
":",
"ctrl",
"}",
"\n",
"mock",
".",
"recorder",
"=",
"&",
"MockFileSystemMockRecorder",
"{",
"mock",
"}",
"\n",
"return",
"mock",
"\n",
"}"
]
|
18,840 | all-18841 | [
"makeRestrictions",
"renders",
"restrictions",
"into",
"the",
"corresponding",
"GitHub",
"api",
"object",
".",
"Returns",
"nil",
"when",
"input",
"restrictions",
"is",
"nil",
".",
"Otherwise",
"Teams",
"and",
"Users",
"are",
"both",
"non",
"-",
"nil",
"(",
"empty",
"list",
"if",
"unset",
")"
]
| [
"func",
"makeRestrictions",
"(",
"rp",
"*",
"branchprotection",
".",
"Restrictions",
")",
"*",
"github",
".",
"Restrictions",
"{",
"if",
"rp",
"==",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n",
"teams",
":=",
"append",
"(",
"[",
"]",
"string",
"{",
"}",
",",
"sets",
".",
"NewString",
"(",
"rp",
".",
"Teams",
"...",
")",
".",
"List",
"(",
")",
"...",
")",
"\n",
"users",
":=",
"<mask>",
"(",
"[",
"]",
"string",
"{",
"}",
",",
"sets",
".",
"NewString",
"(",
"rp",
".",
"Users",
"...",
")",
".",
"List",
"(",
")",
"...",
")",
"\n",
"return",
"&",
"github",
".",
"Restrictions",
"{",
"Teams",
":",
"&",
"teams",
",",
"Users",
":",
"&",
"users",
",",
"}",
"\n",
"}"
]
|
18,841 | all-18842 | [
"Do",
"executes",
"Memory",
".",
"getBrowserSamplingProfile",
"against",
"the",
"provided",
"context",
".",
"returns",
":",
"profile"
]
| [
"func",
"(",
"p",
"*",
"GetBrowserSamplingProfileParams",
")",
"Do",
"(",
"ctx",
"context",
".",
"<mask>",
")",
"(",
"profile",
"*",
"SamplingProfile",
",",
"err",
"error",
")",
"{",
"// execute",
"var",
"res",
"GetBrowserSamplingProfileReturns",
"\n",
"err",
"=",
"cdp",
".",
"Execute",
"(",
"ctx",
",",
"CommandGetBrowserSamplingProfile",
",",
"nil",
",",
"&",
"res",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"return",
"res",
".",
"Profile",
",",
"nil",
"\n",
"}"
]
|
18,842 | all-18843 | [
"MakeCommand",
"returns",
"a",
"junit",
"command",
"."
]
| [
"func",
"MakeCommand",
"(",
")",
"*",
"cobra",
".",
"Command",
"{",
"flags",
":=",
"&",
"flags",
"{",
"}",
"\n",
"cmd",
":=",
"&",
"cobra",
".",
"Command",
"{",
"Use",
":",
"\"",
"\"",
",",
"Short",
":",
"\"",
"\"",
",",
"Long",
":",
"`Summarize coverage profile and produce the result in junit xml format.\nSummary done at per-file and per-package level. Any coverage below coverage-threshold will be marked\nwith a <failure> tag in the xml produced.`",
",",
"Run",
":",
"func",
"(",
"cmd",
"*",
"cobra",
".",
"Command",
",",
"args",
"[",
"]",
"string",
")",
"{",
"<mask>",
"(",
"flags",
",",
"cmd",
",",
"args",
")",
"\n",
"}",
",",
"}",
"\n",
"cmd",
".",
"Flags",
"(",
")",
".",
"StringVarP",
"(",
"&",
"flags",
".",
"outputFile",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
")",
"\n",
"cmd",
".",
"Flags",
"(",
")",
".",
"Float32VarP",
"(",
"&",
"flags",
".",
"threshold",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
".8",
",",
"\"",
"\"",
")",
"\n",
"return",
"cmd",
"\n",
"}"
]
|
18,843 | all-18844 | [
"Deletes",
"a",
"SRV",
"record",
"based",
"on",
"the",
"service",
"and",
"protocol",
"."
]
| [
"func",
"(",
"ds",
"*",
"DNSServer",
")",
"DeleteSRV",
"(",
"service",
",",
"protocol",
"string",
")",
"{",
"ds",
".",
"srvMutex",
".",
"Lock",
"(",
")",
"\n",
"delete",
"(",
"<mask>",
".",
"srvRecords",
",",
"ds",
".",
"qualifySrv",
"(",
"service",
",",
"protocol",
")",
")",
"\n",
"ds",
".",
"srvMutex",
".",
"Unlock",
"(",
")",
"\n",
"}"
]
|
18,844 | all-18845 | [
"checkExchanges",
"is",
"called",
"whenever",
"an",
"exchange",
"is",
"removed",
"and",
"when",
"Close",
"is",
"called",
"."
]
| [
"func",
"(",
"c",
"*",
"Connection",
")",
"checkExchanges",
"(",
")",
"{",
"c",
".",
"callOnExchangeChange",
"(",
")",
"\n\n",
"moveState",
":=",
"func",
"(",
"fromState",
",",
"toState",
"connectionState",
")",
"bool",
"{",
"err",
":=",
"c",
".",
"withStateLock",
"(",
"func",
"(",
")",
"error",
"{",
"if",
"c",
".",
"<mask>",
"!=",
"fromState",
"{",
"return",
"errors",
".",
"New",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"c",
".",
"state",
"=",
"toState",
"\n",
"return",
"nil",
"\n",
"}",
")",
"\n",
"return",
"err",
"==",
"nil",
"\n",
"}",
"\n\n",
"curState",
":=",
"c",
".",
"readState",
"(",
")",
"\n",
"origState",
":=",
"curState",
"\n\n",
"if",
"curState",
"!=",
"connectionClosed",
"&&",
"c",
".",
"stoppedExchanges",
".",
"Load",
"(",
")",
"{",
"if",
"moveState",
"(",
"curState",
",",
"connectionClosed",
")",
"{",
"curState",
"=",
"connectionClosed",
"\n",
"}",
"\n",
"}",
"\n\n",
"if",
"curState",
"==",
"connectionStartClose",
"{",
"if",
"!",
"c",
".",
"relay",
".",
"canClose",
"(",
")",
"{",
"return",
"\n",
"}",
"\n",
"if",
"c",
".",
"inbound",
".",
"count",
"(",
")",
"==",
"0",
"&&",
"moveState",
"(",
"connectionStartClose",
",",
"connectionInboundClosed",
")",
"{",
"curState",
"=",
"connectionInboundClosed",
"\n",
"}",
"\n",
"}",
"\n\n",
"if",
"curState",
"==",
"connectionInboundClosed",
"{",
"// Safety check -- this should never happen since we already did the check",
"// when transitioning to connectionInboundClosed.",
"if",
"!",
"c",
".",
"relay",
".",
"canClose",
"(",
")",
"{",
"c",
".",
"relay",
".",
"logger",
".",
"Error",
"(",
"\"",
"\"",
")",
"\n",
"return",
"\n",
"}",
"\n\n",
"if",
"c",
".",
"outbound",
".",
"count",
"(",
")",
"==",
"0",
"&&",
"moveState",
"(",
"connectionInboundClosed",
",",
"connectionClosed",
")",
"{",
"curState",
"=",
"connectionClosed",
"\n",
"}",
"\n",
"}",
"\n\n",
"if",
"curState",
"!=",
"origState",
"{",
"// If the connection is closed, we can notify writeFrames to stop which",
"// closes the underlying network connection. We never close sendCh to avoid",
"// races causing panics, see 93ef5c112c8b321367ae52d2bd79396e2e874f31",
"if",
"curState",
"==",
"connectionClosed",
"{",
"close",
"(",
"c",
".",
"stopCh",
")",
"\n",
"}",
"\n\n",
"c",
".",
"log",
".",
"WithFields",
"(",
"LogField",
"{",
"\"",
"\"",
",",
"curState",
"}",
",",
")",
".",
"Debug",
"(",
"\"",
"\"",
")",
"\n",
"c",
".",
"callOnCloseStateChange",
"(",
")",
"\n",
"}",
"\n",
"}"
]
|
18,845 | all-18846 | [
"changes",
"returns",
"any",
"changes",
"within",
"the",
"bundle",
"that",
"apply",
"to",
"the",
"entry",
"identified",
"by",
"key",
"that",
"occurred",
"at",
"or",
"before",
"maxOp",
"."
]
| [
"func",
"(",
"b",
"*",
"Bundle",
")",
"changes",
"(",
"target",
"xdr",
".",
"LedgerKey",
",",
"maxOp",
"int",
")",
"(",
"ret",
"[",
"]",
"xdr",
".",
"LedgerEntryChange",
")",
"{",
"for",
"_",
",",
"change",
":=",
"range",
"b",
".",
"FeeMeta",
"{",
"key",
":=",
"change",
".",
"LedgerKey",
"(",
")",
"\n\n",
"if",
"!",
"key",
".",
"Equals",
"(",
"target",
")",
"{",
"continue",
"\n",
"}",
"\n\n",
"ret",
"=",
"<mask>",
"(",
"ret",
",",
"change",
")",
"\n",
"}",
"\n\n",
"for",
"i",
",",
"op",
":=",
"range",
"b",
".",
"TransactionMeta",
".",
"MustOperations",
"(",
")",
"{",
"if",
"i",
">",
"maxOp",
"{",
"break",
"\n",
"}",
"\n\n",
"for",
"_",
",",
"change",
":=",
"range",
"op",
".",
"Changes",
"{",
"key",
":=",
"change",
".",
"LedgerKey",
"(",
")",
"\n\n",
"if",
"!",
"key",
".",
"Equals",
"(",
"target",
")",
"{",
"continue",
"\n",
"}",
"\n\n",
"ret",
"=",
"append",
"(",
"ret",
",",
"change",
")",
"\n",
"}",
"\n",
"}",
"\n\n",
"return",
"\n",
"}"
]
|
18,846 | all-18847 | [
"GetCreateFlags",
"registers",
"the",
"flags",
"this",
"driver",
"adds",
"to",
"docker",
"hosts",
"create"
]
| [
"func",
"(",
"d",
"*",
"Driver",
")",
"GetCreateFlags",
"(",
")",
"[",
"]",
"mcnflag",
".",
"Flag",
"{",
"return",
"[",
"]",
"mcnflag",
".",
"Flag",
"{",
"mcnflag",
".",
"StringFlag",
"{",
"EnvVar",
":",
"\"",
"\"",
",",
"Name",
":",
"\"",
"\"",
",",
"Usage",
":",
"\"",
"\"",
",",
"}",
",",
"mcnflag",
".",
"StringFlag",
"{",
"EnvVar",
":",
"\"",
"\"",
",",
"Name",
":",
"\"",
"\"",
",",
"Usage",
":",
"\"",
"\"",
",",
"}",
",",
"mcnflag",
".",
"StringFlag",
"{",
"EnvVar",
":",
"\"",
"\"",
",",
"<mask>",
":",
"\"",
"\"",
",",
"Usage",
":",
"\"",
"\"",
",",
"}",
",",
"mcnflag",
".",
"StringFlag",
"{",
"EnvVar",
":",
"\"",
"\"",
",",
"Name",
":",
"\"",
"\"",
",",
"Usage",
":",
"\"",
"\"",
",",
"}",
",",
"mcnflag",
".",
"StringFlag",
"{",
"EnvVar",
":",
"\"",
"\"",
",",
"Name",
":",
"\"",
"\"",
",",
"Usage",
":",
"\"",
"\"",
",",
"}",
",",
"mcnflag",
".",
"StringFlag",
"{",
"EnvVar",
":",
"\"",
"\"",
",",
"Name",
":",
"\"",
"\"",
",",
"Usage",
":",
"\"",
"\"",
",",
"}",
",",
"mcnflag",
".",
"StringFlag",
"{",
"EnvVar",
":",
"\"",
"\"",
",",
"Name",
":",
"\"",
"\"",
",",
"Usage",
":",
"\"",
"\"",
",",
"}",
",",
"mcnflag",
".",
"StringFlag",
"{",
"EnvVar",
":",
"\"",
"\"",
",",
"Name",
":",
"\"",
"\"",
",",
"Usage",
":",
"\"",
"\"",
",",
"Value",
":",
"defaultCatalog",
",",
"}",
",",
"mcnflag",
".",
"StringFlag",
"{",
"EnvVar",
":",
"\"",
"\"",
",",
"Name",
":",
"\"",
"\"",
",",
"Usage",
":",
"\"",
"\"",
",",
"Value",
":",
"defaultCatalogItem",
",",
"}",
",",
"mcnflag",
".",
"IntFlag",
"{",
"EnvVar",
":",
"\"",
"\"",
",",
"Name",
":",
"\"",
"\"",
",",
"Usage",
":",
"\"",
"\"",
",",
"Value",
":",
"defaultCpus",
",",
"}",
",",
"mcnflag",
".",
"IntFlag",
"{",
"EnvVar",
":",
"\"",
"\"",
",",
"Name",
":",
"\"",
"\"",
",",
"Usage",
":",
"\"",
"\"",
",",
"Value",
":",
"defaultMemory",
",",
"}",
",",
"mcnflag",
".",
"IntFlag",
"{",
"EnvVar",
":",
"\"",
"\"",
",",
"Name",
":",
"\"",
"\"",
",",
"Usage",
":",
"\"",
"\"",
",",
"Value",
":",
"defaultSSHPort",
",",
"}",
",",
"mcnflag",
".",
"IntFlag",
"{",
"EnvVar",
":",
"\"",
"\"",
",",
"Name",
":",
"\"",
"\"",
",",
"Usage",
":",
"\"",
"\"",
",",
"Value",
":",
"defaultDockerPort",
",",
"}",
",",
"}",
"\n",
"}"
]
|
18,847 | all-18848 | [
"errorf",
"is",
"analogous",
"to",
"fmt",
".",
"Errorf",
"but",
"generates",
"hashTreeErrors",
"instead",
"of",
"errorStrings",
"."
]
| [
"func",
"errorf",
"(",
"c",
"ErrCode",
",",
"fmtStr",
"string",
",",
"args",
"...",
"<mask>",
"{",
"}",
")",
"error",
"{",
"return",
"&",
"hashTreeError",
"{",
"code",
":",
"c",
",",
"s",
":",
"fmt",
".",
"Sprintf",
"(",
"fmtStr",
",",
"args",
"...",
")",
",",
"}",
"\n",
"}"
]
|
18,848 | all-18849 | [
"Converts",
"[",
"k8s",
".",
"io",
"]",
"hello",
"world",
"[",
"foo",
"]",
"into",
"hello",
"world",
"[]",
"string",
"{",
"k8s",
".",
"io",
"foo",
"}"
]
| [
"func",
"stripTags",
"(",
"str",
"string",
")",
"(",
"string",
",",
"[",
"]",
"string",
")",
"{",
"tags",
":=",
"<mask>",
".",
"FindAllString",
"(",
"str",
",",
"-",
"1",
")",
"\n",
"for",
"i",
",",
"w",
":=",
"range",
"tags",
"{",
"w",
"=",
"strings",
".",
"TrimSpace",
"(",
"w",
")",
"\n",
"tags",
"[",
"i",
"]",
"=",
"w",
"[",
"1",
":",
"len",
"(",
"w",
")",
"-",
"1",
"]",
"\n",
"}",
"\n",
"var",
"reals",
"[",
"]",
"string",
"\n",
"for",
"_",
",",
"p",
":=",
"range",
"re",
".",
"Split",
"(",
"str",
",",
"-",
"1",
")",
"{",
"if",
"p",
"==",
"\"",
"\"",
"{",
"continue",
"\n",
"}",
"\n",
"reals",
"=",
"append",
"(",
"reals",
",",
"p",
")",
"\n",
"}",
"\n",
"return",
"strings",
".",
"Join",
"(",
"reals",
",",
"\"",
"\"",
")",
",",
"tags",
"\n",
"}"
]
|
18,849 | all-18850 | [
"flattenBaseVmwareDistributedVirtualSwitchVlanSpec",
"reads",
"various",
"fields",
"from",
"a",
"BaseVmwareDistributedVirtualSwitchVlanSpec",
"into",
"the",
"passed",
"in",
"ResourceData",
"."
]
| [
"func",
"flattenBaseVmwareDistributedVirtualSwitchVlanSpec",
"(",
"d",
"*",
"schema",
".",
"ResourceData",
",",
"obj",
"types",
".",
"BaseVmwareDistributedVirtualSwitchVlanSpec",
")",
"error",
"{",
"if",
"obj",
"==",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n\n",
"<mask>",
"err",
"error",
"\n\n",
"switch",
"t",
":=",
"obj",
".",
"(",
"type",
")",
"{",
"case",
"*",
"types",
".",
"VmwareDistributedVirtualSwitchVlanIdSpec",
":",
"err",
"=",
"flattenVmwareDistributedVirtualSwitchVlanIDSpec",
"(",
"d",
",",
"t",
")",
"\n",
"case",
"*",
"types",
".",
"VmwareDistributedVirtualSwitchTrunkVlanSpec",
":",
"err",
"=",
"flattenVmwareDistributedVirtualSwitchTrunkVlanSpec",
"(",
"d",
",",
"t",
")",
"\n",
"case",
"*",
"types",
".",
"VmwareDistributedVirtualSwitchPvlanSpec",
":",
"err",
"=",
"flattenVmwareDistributedVirtualSwitchPvlanSpec",
"(",
"d",
",",
"t",
")",
"\n",
"}",
"\n\n",
"return",
"err",
"\n",
"}"
]
|
18,850 | all-18851 | [
"SetBytesV",
"sets",
"key",
"=",
"value",
"argument",
"."
]
| [
"func",
"(",
"a",
"*",
"Args",
")",
"SetBytesV",
"(",
"key",
"string",
",",
"<mask>",
"[",
"]",
"byte",
")",
"{",
"a",
".",
"args",
"=",
"setArg",
"(",
"a",
".",
"args",
",",
"key",
",",
"b2s",
"(",
"value",
")",
",",
"argsHasValue",
")",
"\n",
"}"
]
|
18,851 | all-18852 | [
"Helper",
"function",
"that",
"checks",
"for",
"a",
"name",
"type",
"in",
"a",
"pkix",
".",
"Name"
]
| [
"func",
"TypeInName",
"(",
"name",
"*",
"pkix",
".",
"Name",
",",
"oid",
"asn1",
".",
"ObjectIdentifier",
")",
"bool",
"{",
"for",
"_",
",",
"v",
":=",
"range",
"name",
".",
"Names",
"{",
"if",
"oid",
".",
"Equal",
"(",
"v",
".",
"Type",
")",
"{",
"return",
"<mask>",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"false",
"\n",
"}"
]
|
18,852 | all-18853 | [
"NewPFSInputOpts",
"returns",
"a",
"new",
"PFS",
"input",
".",
"It",
"includes",
"all",
"options",
"."
]
| [
"func",
"NewPFSInputOpts",
"(",
"name",
"string",
",",
"repo",
"string",
",",
"branch",
"string",
",",
"glob",
"string",
",",
"lazy",
"bool",
")",
"*",
"pps",
".",
"Input",
"{",
"return",
"&",
"pps",
".",
"Input",
"{",
"Pfs",
":",
"&",
"pps",
".",
"PFSInput",
"{",
"Name",
":",
"<mask>",
",",
"Repo",
":",
"repo",
",",
"Branch",
":",
"branch",
",",
"Glob",
":",
"glob",
",",
"Lazy",
":",
"lazy",
",",
"}",
",",
"}",
"\n",
"}"
]
|
18,853 | all-18854 | [
"CreateOffering",
"creates",
"an",
"offering",
"."
]
| [
"func",
"(",
"h",
"*",
"Handler",
")",
"CreateOffering",
"(",
"tkn",
"string",
",",
"offering",
"*",
"data",
".",
"Offering",
")",
"(",
"*",
"string",
",",
"error",
")",
"{",
"logger",
":=",
"h",
".",
"logger",
".",
"Add",
"(",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"offering",
")",
"\n\n",
"if",
"!",
"h",
".",
"token",
".",
"Check",
"(",
"tkn",
")",
"{",
"logger",
".",
"Warn",
"(",
"\"",
"\"",
")",
"\n",
"return",
"nil",
",",
"ErrAccessDenied",
"\n",
"}",
"\n\n",
"err",
":=",
"h",
".",
"prepareOffering",
"(",
"logger",
",",
"offering",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"err",
"=",
"insert",
"(",
"logger",
",",
"h",
".",
"db",
".",
"Querier",
",",
"offering",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"return",
"&",
"offering",
".",
"<mask>",
",",
"nil",
"\n",
"}"
]
|
18,854 | all-18855 | [
"Value",
"returns",
"the",
"value",
"at",
"the",
"given",
"index",
"in",
"the",
"range",
".",
"If",
"the",
"index",
"is",
"invalid",
"/",
"exceeds",
"the",
"valid",
"range",
"an",
"error",
"will",
"be",
"returned",
"."
]
| [
"func",
"(",
"r",
"*",
"InclusiveRange",
")",
"Value",
"(",
"idx",
"int",
")",
"(",
"int",
",",
"error",
")",
"{",
"if",
"idx",
"<",
"0",
"{",
"return",
"0",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"idx",
")",
"\n",
"}",
"\n\n",
"// Calculate the value as an offset from the start",
"start",
":=",
"r",
".",
"Start",
"(",
")",
"\n",
"<mask>",
":=",
"r",
".",
"End",
"(",
")",
"\n",
"step",
":=",
"r",
".",
"Step",
"(",
")",
"\n\n",
"val",
":=",
"start",
"+",
"(",
"step",
"*",
"idx",
")",
"\n\n",
"if",
"start",
"<=",
"end",
"&&",
"(",
"val",
"<",
"start",
"||",
"val",
">",
"end",
")",
"{",
"return",
"0",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"idx",
",",
"r",
".",
"Len",
"(",
")",
"-",
"1",
")",
"\n\n",
"}",
"else",
"if",
"end",
"<",
"start",
"&&",
"(",
"val",
">",
"start",
"||",
"val",
"<",
"end",
")",
"{",
"return",
"0",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"idx",
",",
"r",
".",
"Len",
"(",
")",
"-",
"1",
")",
"\n",
"}",
"\n\n",
"return",
"val",
",",
"nil",
"\n",
"}"
]
|
18,855 | all-18856 | [
"TotalSharedFolders",
"returns",
"the",
"number",
"of",
"shared",
"folders",
"mounted",
"in",
"the",
"virtual",
"machine",
".",
"Remarks",
":",
"*",
"This",
"function",
"returns",
"the",
"number",
"of",
"shared",
"folders",
"mounted",
"in",
"the",
"virtual",
"machine",
".",
"*",
"It",
"is",
"not",
"necessary",
"to",
"call",
"VM",
".",
"LoginInGuest",
"()",
"before",
"calling",
"this",
"function",
".",
"*",
"Shared",
"folders",
"are",
"not",
"supported",
"for",
"the",
"following",
"guest",
"operating",
"systems",
":",
"Windows",
"ME",
"Windows",
"98",
"Windows",
"95",
"Windows",
"3",
".",
"x",
"and",
"DOS",
".",
"*",
"In",
"this",
"release",
"this",
"function",
"requires",
"the",
"virtual",
"machine",
"to",
"be",
"powered",
"on",
"with",
"VMware",
"Tools",
"installed",
".",
"Since",
"VMware",
"Workstation",
"6",
".",
"0"
]
| [
"func",
"(",
"v",
"*",
"VM",
")",
"TotalSharedFolders",
"(",
")",
"(",
"int",
",",
"error",
")",
"{",
"var",
"jobHandle",
"C",
".",
"VixHandle",
"=",
"C",
".",
"VIX_INVALID_HANDLE",
"\n",
"var",
"err",
"C",
".",
"VixError",
"=",
"C",
".",
"VIX_OK",
"\n",
"<mask>",
"numSharedFolders",
"C",
".",
"int",
"\n\n",
"jobHandle",
"=",
"C",
".",
"VixVM_GetNumSharedFolders",
"(",
"v",
".",
"handle",
",",
"nil",
",",
"nil",
")",
"\n",
"defer",
"C",
".",
"Vix_ReleaseHandle",
"(",
"jobHandle",
")",
"\n\n",
"err",
"=",
"C",
".",
"get_num_shared_folders",
"(",
"jobHandle",
",",
"&",
"numSharedFolders",
")",
"\n\n",
"if",
"C",
".",
"VIX_OK",
"!=",
"err",
"{",
"return",
"0",
",",
"&",
"Error",
"{",
"Operation",
":",
"\"",
"\"",
",",
"Code",
":",
"int",
"(",
"err",
"&",
"0xFFFF",
")",
",",
"Text",
":",
"C",
".",
"GoString",
"(",
"C",
".",
"Vix_GetErrorText",
"(",
"err",
",",
"nil",
")",
")",
",",
"}",
"\n",
"}",
"\n\n",
"return",
"int",
"(",
"numSharedFolders",
")",
",",
"nil",
"\n",
"}"
]
|
18,856 | all-18857 | [
"getKey",
"returns",
"byte",
"slice",
"at",
"offset",
"."
]
| [
"func",
"(",
"s",
"*",
"Arena",
")",
"getKey",
"(",
"offset",
"uint32",
",",
"size",
"uint16",
")",
"[",
"]",
"byte",
"{",
"return",
"s",
".",
"buf",
"[",
"<mask>",
":",
"offset",
"+",
"uint32",
"(",
"size",
")",
"]",
"\n",
"}"
]
|
18,857 | all-18858 | [
"spawnChild",
"spawns",
"a",
"child",
"process",
"with",
"the",
"given",
"inputs",
"and",
"returns",
"the",
"resulting",
"child",
"."
]
| [
"func",
"spawnChild",
"(",
"i",
"*",
"spawnChildInput",
")",
"(",
"*",
"child",
".",
"Child",
",",
"error",
")",
"{",
"p",
":=",
"shellwords",
".",
"NewParser",
"(",
")",
"\n",
"p",
".",
"ParseEnv",
"=",
"true",
"\n",
"p",
".",
"ParseBacktick",
"=",
"true",
"\n",
"args",
",",
"err",
":=",
"p",
".",
"Parse",
"(",
"i",
".",
"Command",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"errors",
".",
"Wrap",
"(",
"err",
",",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"child",
",",
"err",
":=",
"child",
".",
"New",
"(",
"&",
"child",
".",
"NewInput",
"{",
"Stdin",
":",
"i",
".",
"Stdin",
",",
"Stdout",
":",
"i",
".",
"Stdout",
",",
"Stderr",
":",
"i",
".",
"Stderr",
",",
"Command",
":",
"args",
"[",
"0",
"]",
",",
"Args",
":",
"args",
"[",
"1",
":",
"]",
",",
"Env",
":",
"i",
".",
"Env",
",",
"Timeout",
":",
"i",
".",
"Timeout",
",",
"ReloadSignal",
":",
"i",
".",
"ReloadSignal",
",",
"KillSignal",
":",
"i",
".",
"KillSignal",
",",
"KillTimeout",
":",
"i",
".",
"KillTimeout",
",",
"Splay",
":",
"i",
".",
"Splay",
",",
"}",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"errors",
".",
"Wrap",
"(",
"err",
",",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"if",
"err",
":=",
"child",
".",
"Start",
"(",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"<mask>",
".",
"Wrap",
"(",
"err",
",",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"return",
"child",
",",
"nil",
"\n",
"}"
]
|
18,858 | all-18859 | [
"UnmarshalJSON",
"supports",
"json",
".",
"Unmarshaler",
"interface"
]
| [
"func",
"(",
"v",
"*",
"EventDocumentUpdated",
")",
"UnmarshalJSON",
"(",
"data",
"[",
"]",
"byte",
")",
"error",
"{",
"r",
":=",
"jlexer",
".",
"Lexer",
"{",
"Data",
":",
"data",
"}",
"\n",
"easyjsonC5a4559bDecodeGithubComChromedpCdprotoDom61",
"(",
"&",
"r",
",",
"v",
")",
"\n",
"return",
"r",
".",
"<mask>",
"(",
")",
"\n",
"}"
]
|
18,859 | all-18860 | [
"retrieve",
"a",
"named",
"parameter",
"from",
"a",
"framebuffer"
]
| [
"func",
"GetFramebufferParameteriv",
"(",
"<mask>",
"uint32",
",",
"pname",
"uint32",
",",
"params",
"*",
"int32",
")",
"{",
"syscall",
".",
"Syscall",
"(",
"gpGetFramebufferParameteriv",
",",
"3",
",",
"uintptr",
"(",
"target",
")",
",",
"uintptr",
"(",
"pname",
")",
",",
"uintptr",
"(",
"unsafe",
".",
"Pointer",
"(",
"params",
")",
")",
")",
"\n",
"}"
]
|
18,860 | all-18861 | [
"ParseReference",
"converts",
"a",
"string",
"which",
"should",
"not",
"start",
"with",
"the",
"ImageTransport",
".",
"Name",
"prefix",
"into",
"an",
"ImageReference",
"."
]
| [
"func",
"(",
"t",
"ociArchiveTransport",
")",
"ParseReference",
"(",
"<mask>",
"string",
")",
"(",
"types",
".",
"ImageReference",
",",
"error",
")",
"{",
"return",
"ParseReference",
"(",
"reference",
")",
"\n",
"}"
]
|
18,861 | all-18862 | [
"saveCgo",
"extracts",
"CFLAGS",
"CPPFLAGS",
"CXXFLAGS",
"and",
"LDFLAGS",
"directives",
"from",
"a",
"comment",
"above",
"a",
"C",
"import",
".",
"This",
"is",
"intended",
"to",
"match",
"logic",
"in",
"go",
"/",
"build",
".",
"Context",
".",
"saveCgo",
"."
]
| [
"func",
"saveCgo",
"(",
"info",
"*",
"fileInfo",
",",
"rel",
"string",
",",
"cg",
"*",
"ast",
".",
"CommentGroup",
")",
"error",
"{",
"text",
":=",
"cg",
".",
"Text",
"(",
")",
"\n",
"for",
"_",
",",
"line",
":=",
"range",
"strings",
".",
"Split",
"(",
"text",
",",
"\"",
"\\n",
"\"",
")",
"{",
"orig",
":=",
"line",
"\n\n",
"// Line is",
"//\t#cgo [GOOS/GOARCH...] LDFLAGS: stuff",
"//",
"line",
"=",
"strings",
".",
"TrimSpace",
"(",
"line",
")",
"\n",
"if",
"len",
"(",
"line",
")",
"<",
"5",
"||",
"line",
"[",
":",
"4",
"]",
"!=",
"\"",
"\"",
"||",
"(",
"line",
"[",
"4",
"]",
"!=",
"' '",
"&&",
"line",
"[",
"4",
"]",
"!=",
"'\\t'",
")",
"{",
"continue",
"\n",
"}",
"\n\n",
"// Split at colon.",
"line",
"=",
"strings",
".",
"TrimSpace",
"(",
"line",
"[",
"4",
":",
"]",
")",
"\n",
"i",
":=",
"strings",
".",
"Index",
"(",
"<mask>",
",",
"\"",
"\"",
")",
"\n",
"if",
"i",
"<",
"0",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"info",
".",
"path",
",",
"orig",
")",
"\n",
"}",
"\n",
"line",
",",
"optstr",
":=",
"strings",
".",
"TrimSpace",
"(",
"line",
"[",
":",
"i",
"]",
")",
",",
"strings",
".",
"TrimSpace",
"(",
"line",
"[",
"i",
"+",
"1",
":",
"]",
")",
"\n\n",
"// Parse tags and verb.",
"f",
":=",
"strings",
".",
"Fields",
"(",
"line",
")",
"\n",
"if",
"len",
"(",
"f",
")",
"<",
"1",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"info",
".",
"path",
",",
"orig",
")",
"\n",
"}",
"\n",
"verb",
":=",
"f",
"[",
"len",
"(",
"f",
")",
"-",
"1",
"]",
"\n",
"tags",
":=",
"parseTagsInGroups",
"(",
"f",
"[",
":",
"len",
"(",
"f",
")",
"-",
"1",
"]",
")",
"\n\n",
"// Parse options.",
"opts",
",",
"err",
":=",
"splitQuoted",
"(",
"optstr",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"info",
".",
"path",
",",
"orig",
")",
"\n",
"}",
"\n",
"var",
"ok",
"bool",
"\n",
"for",
"i",
",",
"opt",
":=",
"range",
"opts",
"{",
"if",
"opt",
",",
"ok",
"=",
"expandSrcDir",
"(",
"opt",
",",
"rel",
")",
";",
"!",
"ok",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"info",
".",
"path",
",",
"orig",
")",
"\n",
"}",
"\n",
"opts",
"[",
"i",
"]",
"=",
"opt",
"\n",
"}",
"\n",
"joinedStr",
":=",
"strings",
".",
"Join",
"(",
"opts",
",",
"optSeparator",
")",
"\n\n",
"// Add tags to appropriate list.",
"switch",
"verb",
"{",
"case",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
":",
"info",
".",
"copts",
"=",
"append",
"(",
"info",
".",
"copts",
",",
"taggedOpts",
"{",
"tags",
",",
"joinedStr",
"}",
")",
"\n",
"case",
"\"",
"\"",
":",
"info",
".",
"clinkopts",
"=",
"append",
"(",
"info",
".",
"clinkopts",
",",
"taggedOpts",
"{",
"tags",
",",
"joinedStr",
"}",
")",
"\n",
"case",
"\"",
"\"",
":",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"info",
".",
"path",
",",
"orig",
")",
"\n",
"default",
":",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"info",
".",
"path",
",",
"orig",
")",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
]
|
18,862 | all-18863 | [
"GetIncreaseGood",
"returns",
"the",
"IncreaseGood",
"field",
"if",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"."
]
| [
"func",
"(",
"c",
"*",
"ChangeRequest",
")",
"GetIncreaseGood",
"(",
")",
"bool",
"{",
"if",
"c",
"==",
"nil",
"||",
"c",
".",
"IncreaseGood",
"==",
"nil",
"{",
"return",
"<mask>",
"\n",
"}",
"\n",
"return",
"*",
"c",
".",
"IncreaseGood",
"\n",
"}"
]
|
18,863 | all-18864 | [
"LogWithTime",
"will",
"log",
"a",
"message",
"at",
"the",
"provided",
"level",
"to",
"all",
"loggers",
"added",
"to",
"the",
"Base",
"associated",
"with",
"this",
"LogAdapter",
".",
"It",
"is",
"similar",
"to",
"Log",
"except",
"the",
"timestamp",
"will",
"be",
"set",
"to",
"the",
"value",
"of",
"ts",
"."
]
| [
"func",
"(",
"la",
"*",
"LogAdapter",
")",
"LogWithTime",
"(",
"level",
"LogLevel",
",",
"ts",
"time",
".",
"Time",
",",
"attrs",
"*",
"Attrs",
",",
"msg",
"string",
",",
"a",
"...",
"interface",
"{",
"}",
")",
"error",
"{",
"if",
"la",
".",
"logLevel",
"!=",
"nil",
"&&",
"level",
">",
"*",
"la",
".",
"logLevel",
"{",
"return",
"nil",
"\n",
"}",
"\n\n",
"mergedAttrs",
":=",
"la",
".",
"attrs",
".",
"clone",
"(",
")",
"\n",
"mergedAttrs",
".",
"MergeAttrs",
"(",
"attrs",
")",
"\n",
"return",
"la",
".",
"<mask>",
".",
"LogWithTime",
"(",
"level",
",",
"ts",
",",
"mergedAttrs",
",",
"msg",
",",
"a",
"...",
")",
"\n",
"}"
]
|
18,864 | all-18865 | [
"GetAuthorizationToken",
"mocks",
"base",
"method"
]
| [
"func",
"(",
"m",
"*",
"MockECRClient",
")",
"GetAuthorizationToken",
"(",
"arg0",
"string",
")",
"(",
"*",
"ecr0",
".",
"AuthorizationData",
",",
"error",
")",
"{",
"ret",
":=",
"m",
".",
"ctrl",
".",
"Call",
"(",
"m",
",",
"\"",
"\"",
",",
"arg0",
")",
"\n",
"ret0",
",",
"_",
":=",
"<mask>",
"[",
"0",
"]",
".",
"(",
"*",
"ecr0",
".",
"AuthorizationData",
")",
"\n",
"ret1",
",",
"_",
":=",
"ret",
"[",
"1",
"]",
".",
"(",
"error",
")",
"\n",
"return",
"ret0",
",",
"ret1",
"\n",
"}"
]
|
18,865 | all-18866 | [
"NodeByName",
"returns",
"the",
"node",
"with",
"the",
"given",
"name",
"."
]
| [
"func",
"(",
"c",
"*",
"ClusterTx",
")",
"NodeByName",
"(",
"name",
"string",
")",
"(",
"NodeInfo",
",",
"error",
")",
"{",
"null",
":=",
"NodeInfo",
"{",
"}",
"\n",
"nodes",
",",
"err",
":=",
"c",
".",
"nodes",
"(",
"false",
"/* not pending */",
",",
"\"",
"\"",
",",
"<mask>",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"null",
",",
"err",
"\n",
"}",
"\n",
"switch",
"len",
"(",
"nodes",
")",
"{",
"case",
"0",
":",
"return",
"null",
",",
"ErrNoSuchObject",
"\n",
"case",
"1",
":",
"return",
"nodes",
"[",
"0",
"]",
",",
"nil",
"\n",
"default",
":",
"return",
"null",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"}"
]
|
18,866 | all-18867 | [
"SetFromFile",
"()",
"is",
"a",
"wrapper",
"around",
"gtk_image_set_from_file",
"()",
"."
]
| [
"func",
"(",
"v",
"*",
"Image",
")",
"SetFromFile",
"(",
"filename",
"string",
")",
"{",
"cstr",
":=",
"C",
".",
"CString",
"(",
"filename",
")",
"\n",
"defer",
"C",
".",
"<mask>",
"(",
"unsafe",
".",
"Pointer",
"(",
"cstr",
")",
")",
"\n",
"C",
".",
"gtk_image_set_from_file",
"(",
"v",
".",
"native",
"(",
")",
",",
"(",
"*",
"C",
".",
"gchar",
")",
"(",
"cstr",
")",
")",
"\n",
"}"
]
|
18,867 | all-18868 | [
"NewWebURLButton",
"creates",
"a",
"button",
"used",
"in",
"ButtonTemplate",
"that",
"redirects",
"user",
"to",
"external",
"address",
"upon",
"clicking",
"the",
"URL"
]
| [
"func",
"NewWebURLButton",
"(",
"title",
"string",
",",
"url",
"string",
")",
"Button",
"{",
"return",
"Button",
"{",
"Type",
":",
"ButtonTypeWebURL",
",",
"Title",
":",
"title",
",",
"URL",
":",
"<mask>",
",",
"}",
"\n",
"}"
]
|
18,868 | all-18869 | [
"getUser",
"finds",
"a",
"user"
]
| [
"func",
"(",
"c",
"*",
"Client",
")",
"getUser",
"(",
"id",
"string",
")",
"(",
"*",
"ex",
".",
"User",
",",
"error",
")",
"{",
"u",
":=",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"c",
".",
"Host",
",",
"id",
")",
"\n",
"req",
",",
"err",
":=",
"http",
".",
"NewRequest",
"(",
"\"",
"\"",
",",
"u",
",",
"nil",
")",
"\n\n",
"// NOTE: by default, request bodies are expected to be sent with a Content-Type",
"// of application/json. If you don't explicitly set the content-type, you",
"// will get a mismatch during Verification.",
"req",
".",
"Header",
".",
"Set",
"(",
"\"",
"\"",
",",
"\"",
"\"",
")",
"\n",
"req",
".",
"Header",
".",
"Set",
"(",
"\"",
"\"",
",",
"c",
".",
"token",
")",
"\n\n",
"<mask>",
",",
"err",
":=",
"http",
".",
"DefaultClient",
".",
"Do",
"(",
"req",
")",
"\n\n",
"if",
"res",
".",
"StatusCode",
"!=",
"200",
"||",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"data",
",",
"err",
":=",
"ioutil",
".",
"ReadAll",
"(",
"res",
".",
"Body",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"var",
"response",
"ex",
".",
"User",
"\n",
"err",
"=",
"json",
".",
"Unmarshal",
"(",
"data",
",",
"&",
"response",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"return",
"&",
"response",
",",
"err",
"\n",
"}"
]
|
18,869 | all-18870 | [
"ImagesGetExpired",
"returns",
"the",
"names",
"of",
"all",
"images",
"that",
"have",
"expired",
"since",
"the",
"given",
"time",
"."
]
| [
"func",
"(",
"c",
"*",
"Cluster",
")",
"ImagesGetExpired",
"(",
"expiry",
"int64",
")",
"(",
"[",
"]",
"string",
",",
"error",
")",
"{",
"q",
":=",
"`SELECT fingerprint, last_use_date, upload_date FROM images WHERE cached=1`",
"\n\n",
"var",
"fpStr",
"string",
"\n",
"var",
"useStr",
"string",
"\n",
"var",
"uploadStr",
"string",
"\n\n",
"inargs",
":=",
"[",
"]",
"interface",
"{",
"}",
"{",
"}",
"\n",
"outfmt",
":=",
"[",
"]",
"interface",
"{",
"}",
"{",
"fpStr",
",",
"useStr",
",",
"uploadStr",
"}",
"\n",
"dbResults",
",",
"err",
":=",
"queryScan",
"(",
"c",
".",
"db",
",",
"q",
",",
"inargs",
",",
"outfmt",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"[",
"]",
"string",
"{",
"}",
",",
"err",
"\n",
"}",
"\n\n",
"results",
":=",
"[",
"]",
"string",
"{",
"}",
"\n",
"for",
"_",
",",
"r",
":=",
"range",
"dbResults",
"{",
"// Figure out the expiry",
"timestamp",
":=",
"r",
"[",
"2",
"]",
"\n",
"if",
"r",
"[",
"1",
"]",
"!=",
"\"",
"\"",
"{",
"timestamp",
"=",
"r",
"[",
"1",
"]",
"\n",
"}",
"\n\n",
"var",
"imageExpiry",
"time",
".",
"Time",
"\n",
"err",
"=",
"imageExpiry",
".",
"UnmarshalText",
"(",
"[",
"]",
"byte",
"(",
"timestamp",
".",
"(",
"string",
")",
")",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"[",
"]",
"string",
"{",
"}",
",",
"err",
"\n",
"}",
"\n",
"imageExpiry",
"=",
"imageExpiry",
".",
"Add",
"(",
"time",
".",
"Duration",
"(",
"expiry",
"*",
"24",
")",
"*",
"<mask>",
".",
"Hour",
")",
"\n\n",
"// Check if expired",
"if",
"imageExpiry",
".",
"After",
"(",
"time",
".",
"Now",
"(",
")",
")",
"{",
"continue",
"\n",
"}",
"\n\n",
"results",
"=",
"append",
"(",
"results",
",",
"r",
"[",
"0",
"]",
".",
"(",
"string",
")",
")",
"\n",
"}",
"\n\n",
"return",
"results",
",",
"nil",
"\n",
"}"
]
|
18,870 | all-18871 | [
"initKeyHandler",
"starts",
"the",
"internal",
"key",
"handler",
".",
"Must",
"be",
"called",
"with",
"mutex",
"held",
"and",
"as",
"a",
"go",
"routine",
"."
]
| [
"func",
"initKeyHandler",
"(",
")",
"{",
"for",
"{",
"switch",
"ev",
":=",
"termbox",
".",
"PollEvent",
"(",
")",
";",
"ev",
".",
"Type",
"{",
"case",
"termbox",
".",
"EventKey",
":",
"e",
":=",
"ev",
"\n",
"Queue",
"(",
"func",
"(",
")",
"{",
"var",
"(",
"widget",
"Widgeter",
"\n",
"<mask>",
"Windower",
"\n",
")",
"\n",
"if",
"focus",
"!=",
"nil",
"{",
"var",
"used",
"bool",
"\n",
"used",
",",
"window",
",",
"widget",
"=",
"focus",
".",
"keyHandler",
"(",
"e",
")",
"\n",
"if",
"used",
"{",
"flush",
"(",
")",
"\n",
"return",
"\n",
"}",
"\n",
"}",
"\n\n",
"// forward to global application handler",
"keyC",
"<-",
"Key",
"{",
"Mod",
":",
"e",
".",
"Mod",
",",
"Key",
":",
"e",
".",
"Key",
",",
"Ch",
":",
"e",
".",
"Ch",
",",
"Window",
":",
"window",
",",
"Widget",
":",
"widget",
",",
"}",
"\n",
"// XXX this is a terrible workaround!!",
"// the app is racing this channel",
"// we need to somehow block here before doing",
"// anything else",
"//time.Sleep(25 * time.Millisecond)",
"}",
")",
"\n\n",
"case",
"termbox",
".",
"EventResize",
":",
"Queue",
"(",
"func",
"(",
")",
"{",
"resizeAndRender",
"(",
"focus",
")",
"\n",
"}",
")",
"\n",
"case",
"termbox",
".",
"EventMouse",
":",
"case",
"termbox",
".",
"EventError",
":",
"return",
"\n",
"}",
"\n",
"}",
"\n",
"}"
]
|
18,871 | all-18872 | [
"GetTitleOk",
"returns",
"a",
"tuple",
"with",
"the",
"Title",
"field",
"if",
"it",
"s",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"and",
"a",
"boolean",
"to",
"check",
"if",
"the",
"value",
"has",
"been",
"set",
"."
]
| [
"func",
"(",
"l",
"*",
"LogStreamDefinition",
")",
"GetTitleOk",
"(",
")",
"(",
"string",
",",
"bool",
")",
"{",
"if",
"l",
"==",
"nil",
"||",
"l",
".",
"Title",
"==",
"nil",
"{",
"return",
"\"",
"\"",
",",
"<mask>",
"\n",
"}",
"\n",
"return",
"*",
"l",
".",
"Title",
",",
"true",
"\n",
"}"
]
|
18,872 | all-18873 | [
"Image",
"retrieves",
"a",
"detailed",
"view",
"of",
"one",
"image"
]
| [
"func",
"(",
"c",
"*",
"Client",
")",
"Image",
"(",
"identifier",
"string",
")",
"(",
"*",
"Image",
",",
"error",
")",
"{",
"<mask>",
":=",
"new",
"(",
"Image",
")",
"\n",
"_",
",",
"err",
":=",
"c",
".",
"MakeApiRequest",
"(",
"\"",
"\"",
",",
"\"",
"\"",
"+",
"identifier",
",",
"nil",
",",
"image",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"return",
"image",
",",
"err",
"\n",
"}"
]
|
18,873 | all-18874 | [
"Encode",
"in",
"little",
"endian"
]
| [
"func",
"(",
"d",
"*",
"digest",
")",
"Sum",
"(",
"in",
"[",
"]",
"byte",
")",
"[",
"]",
"byte",
"{",
"s",
":=",
"d",
".",
"Sum64",
"(",
")",
"\n",
"in",
"=",
"append",
"(",
"in",
",",
"byte",
"(",
"s",
")",
")",
"\n",
"in",
"=",
"append",
"(",
"in",
",",
"byte",
"(",
"s",
">>",
"8",
")",
")",
"\n",
"in",
"=",
"<mask>",
"(",
"in",
",",
"byte",
"(",
"s",
">>",
"16",
")",
")",
"\n",
"in",
"=",
"append",
"(",
"in",
",",
"byte",
"(",
"s",
">>",
"24",
")",
")",
"\n",
"in",
"=",
"append",
"(",
"in",
",",
"byte",
"(",
"s",
">>",
"32",
")",
")",
"\n",
"in",
"=",
"append",
"(",
"in",
",",
"byte",
"(",
"s",
">>",
"40",
")",
")",
"\n",
"in",
"=",
"append",
"(",
"in",
",",
"byte",
"(",
"s",
">>",
"48",
")",
")",
"\n",
"in",
"=",
"append",
"(",
"in",
",",
"byte",
"(",
"s",
">>",
"56",
")",
")",
"\n",
"return",
"in",
"\n",
"}"
]
|
18,874 | all-18875 | [
"ActiveControl",
"returns",
"the",
"active",
"child",
"of",
"the",
"parent",
"or",
"nil",
"if",
"no",
"child",
"is",
"active"
]
| [
"func",
"ActiveControl",
"(",
"parent",
"<mask>",
")",
"Control",
"{",
"fnActive",
":=",
"func",
"(",
"c",
"Control",
")",
"bool",
"{",
"return",
"c",
".",
"Active",
"(",
")",
"\n",
"}",
"\n",
"return",
"FindFirstControl",
"(",
"parent",
",",
"fnActive",
")",
"\n",
"}"
]
|
18,875 | all-18876 | [
"Get",
"does",
"nothing",
"on",
"a",
"dry",
"-",
"run",
"client"
]
| [
"func",
"(",
"c",
"*",
"dryRunProwJobClient",
")",
"Get",
"(",
"name",
"string",
",",
"<mask>",
"metav1",
".",
"GetOptions",
")",
"(",
"*",
"prowapi",
".",
"ProwJob",
",",
"error",
")",
"{",
"return",
"nil",
",",
"nil",
"\n",
"}"
]
|
18,876 | all-18877 | [
"WithValidateThrottle",
"sets",
"the",
"upper",
"bound",
"on",
"the",
"number",
"of",
"active",
"validation",
"goroutines",
"."
]
| [
"func",
"WithValidateThrottle",
"(",
"n",
"int",
")",
"Option",
"{",
"return",
"func",
"(",
"ps",
"*",
"PubSub",
")",
"error",
"{",
"<mask>",
".",
"validateThrottle",
"=",
"make",
"(",
"chan",
"struct",
"{",
"}",
",",
"n",
")",
"\n",
"return",
"nil",
"\n",
"}",
"\n",
"}"
]
|
18,877 | all-18878 | [
"/",
"1",
".",
"0",
"/",
"storage",
"-",
"pools",
"/",
"{",
"name",
"}",
"Get",
"a",
"single",
"storage",
"pool",
"."
]
| [
"func",
"storagePoolGet",
"(",
"d",
"*",
"Daemon",
",",
"r",
"*",
"http",
".",
"Request",
")",
"Response",
"{",
"// If a target was specified, forward the request to the relevant node.",
"response",
":=",
"ForwardedResponseIfTargetIsRemote",
"(",
"d",
",",
"r",
")",
"\n",
"if",
"response",
"!=",
"nil",
"{",
"return",
"response",
"\n",
"}",
"\n\n",
"poolName",
":=",
"mux",
".",
"Vars",
"(",
"r",
")",
"[",
"\"",
"\"",
"]",
"\n\n",
"// Get the existing storage pool.",
"poolID",
",",
"pool",
",",
"err",
":=",
"d",
".",
"cluster",
".",
"StoragePoolGet",
"(",
"poolName",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"SmartError",
"(",
"err",
")",
"\n",
"}",
"\n\n",
"// Get all users of the storage pool.",
"poolUsedBy",
",",
"err",
":=",
"storagePoolUsedByGet",
"(",
"d",
".",
"State",
"(",
")",
",",
"poolID",
",",
"poolName",
")",
"\n",
"if",
"err",
"!=",
"nil",
"&&",
"err",
"!=",
"<mask>",
".",
"ErrNoSuchObject",
"{",
"return",
"SmartError",
"(",
"err",
")",
"\n",
"}",
"\n",
"pool",
".",
"UsedBy",
"=",
"poolUsedBy",
"\n\n",
"targetNode",
":=",
"queryParam",
"(",
"r",
",",
"\"",
"\"",
")",
"\n\n",
"clustered",
",",
"err",
":=",
"cluster",
".",
"Enabled",
"(",
"d",
".",
"db",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"SmartError",
"(",
"err",
")",
"\n",
"}",
"\n\n",
"// If no target node is specified and the daemon is clustered, we omit",
"// the node-specific fields.",
"if",
"targetNode",
"==",
"\"",
"\"",
"&&",
"clustered",
"{",
"for",
"_",
",",
"key",
":=",
"range",
"db",
".",
"StoragePoolNodeConfigKeys",
"{",
"delete",
"(",
"pool",
".",
"Config",
",",
"key",
")",
"\n",
"}",
"\n",
"}",
"\n\n",
"etag",
":=",
"[",
"]",
"interface",
"{",
"}",
"{",
"pool",
".",
"Name",
",",
"pool",
".",
"Driver",
",",
"pool",
".",
"Config",
"}",
"\n\n",
"return",
"SyncResponseETag",
"(",
"true",
",",
"&",
"pool",
",",
"etag",
")",
"\n",
"}"
]
|
18,878 | all-18879 | [
"RunPath",
"returns",
"the",
"path",
"to",
"the",
"GCS",
"directory",
"for",
"the",
"job",
"run",
"specified",
"in",
"src",
"."
]
| [
"func",
"(",
"s",
"*",
"Spyglass",
")",
"RunPath",
"(",
"src",
"string",
")",
"(",
"string",
",",
"error",
")",
"{",
"src",
"=",
"strings",
".",
"TrimSuffix",
"(",
"src",
",",
"\"",
"\"",
")",
"\n",
"keyType",
",",
"key",
",",
"err",
":=",
"splitSrc",
"(",
"src",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"\"",
"\"",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"src",
")",
"\n",
"}",
"\n",
"switch",
"keyType",
"{",
"<mask>",
"gcsKeyType",
":",
"return",
"key",
",",
"nil",
"\n",
"case",
"prowKeyType",
":",
"return",
"s",
".",
"prowToGCS",
"(",
"key",
")",
"\n",
"default",
":",
"return",
"\"",
"\"",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"src",
")",
"\n",
"}",
"\n",
"}"
]
|
18,879 | all-18880 | [
"Bool",
"adds",
"a",
"bool",
"-",
"valued",
"key",
":",
"value",
"pair",
"to",
"a",
"Span",
".",
"LogFields",
"()",
"record"
]
| [
"func",
"Bool",
"(",
"key",
"string",
",",
"val",
"bool",
")",
"Field",
"{",
"var",
"numericVal",
"int64",
"\n",
"if",
"val",
"{",
"numericVal",
"=",
"1",
"\n",
"}",
"\n",
"return",
"Field",
"{",
"key",
":",
"<mask>",
",",
"fieldType",
":",
"boolType",
",",
"numericVal",
":",
"numericVal",
",",
"}",
"\n",
"}"
]
|
18,880 | all-18881 | [
"KnownVersions",
"mocks",
"base",
"method"
]
| [
"func",
"(",
"m",
"*",
"MockDockerClient",
")",
"KnownVersions",
"(",
")",
"[",
"]",
"dockerclient",
".",
"DockerVersion",
"{",
"<mask>",
":=",
"m",
".",
"ctrl",
".",
"Call",
"(",
"m",
",",
"\"",
"\"",
")",
"\n",
"ret0",
",",
"_",
":=",
"ret",
"[",
"0",
"]",
".",
"(",
"[",
"]",
"dockerclient",
".",
"DockerVersion",
")",
"\n",
"return",
"ret0",
"\n",
"}"
]
|
18,881 | all-18882 | [
"NewObject",
"creates",
"a",
"new",
"object",
"."
]
| [
"func",
"NewObject",
"(",
"name",
"string",
",",
"t",
"string",
",",
"st",
"string",
",",
"content",
"[",
"]",
"byte",
")",
"*",
"Object",
"{",
"if",
"len",
"(",
"<mask>",
")",
">",
"MaxObjectContentLen",
"{",
"content",
"=",
"content",
"[",
":",
"MaxObjectContentLen",
"]",
"\n",
"}",
"\n",
"o",
":=",
"&",
"Object",
"{",
"Type",
":",
"t",
",",
"SubType",
":",
"st",
",",
"Name",
":",
"name",
",",
"Content",
":",
"content",
",",
"Metadata",
":",
"make",
"(",
"map",
"[",
"string",
"]",
"MetadataData",
")",
",",
"PrimaryKeyHash",
":",
"nil",
",",
"}",
"\n",
"return",
"o",
"\n",
"}"
]
|
18,882 | all-18883 | [
"From",
"returns",
"a",
"FROM",
"statement",
".",
"A",
"table",
"name",
"will",
"be",
"determined",
"from",
"name",
"of",
"struct",
"of",
"arg",
".",
"If",
"arg",
"argument",
"is",
"not",
"struct",
"type",
"it",
"panics",
"."
]
| [
"func",
"(",
"db",
"*",
"DB",
")",
"From",
"(",
"arg",
"interface",
"{",
"}",
")",
"*",
"From",
"{",
"t",
":=",
"reflect",
".",
"Indirect",
"(",
"reflect",
".",
"ValueOf",
"(",
"arg",
")",
")",
".",
"<mask>",
"(",
")",
"\n",
"if",
"t",
".",
"Kind",
"(",
")",
"!=",
"reflect",
".",
"Struct",
"{",
"panic",
"(",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"t",
")",
")",
"\n",
"}",
"\n",
"return",
"&",
"From",
"{",
"TableName",
":",
"db",
".",
"tableName",
"(",
"t",
")",
"}",
"\n",
"}"
]
|
18,883 | all-18884 | [
"SetInconsistent",
"is",
"a",
"wrapper",
"around",
"gtk_check_menu_item_set_inconsistent",
"()",
"."
]
| [
"func",
"(",
"v",
"*",
"CheckMenuItem",
")",
"SetInconsistent",
"(",
"<mask>",
"bool",
")",
"{",
"C",
".",
"gtk_check_menu_item_set_inconsistent",
"(",
"v",
".",
"native",
"(",
")",
",",
"gbool",
"(",
"setting",
")",
")",
"\n",
"}"
]
|
18,884 | all-18885 | [
"This",
"performs",
"all",
"non",
"-",
"db",
"related",
"work",
"needed",
"to",
"create",
"the",
"pool",
"."
]
| [
"func",
"doStoragePoolCreateInternal",
"(",
"state",
"*",
"state",
".",
"State",
",",
"poolName",
",",
"poolDescription",
"string",
",",
"driver",
"string",
",",
"config",
"map",
"[",
"string",
"]",
"string",
",",
"isNotification",
"bool",
")",
"error",
"{",
"tryUndo",
":=",
"true",
"\n",
"s",
",",
"err",
":=",
"storagePoolInit",
"(",
"state",
",",
"poolName",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"// If this is a clustering notification for a ceph storage, we don't",
"// want this node to actually create the pool, as it's already been",
"// done by the node that triggered this notification. We just need to",
"// create the storage pool directory.",
"if",
"s",
",",
"ok",
":=",
"s",
".",
"(",
"*",
"storageCeph",
")",
";",
"ok",
"&&",
"isNotification",
"{",
"volumeMntPoint",
":=",
"getStoragePoolVolumeMountPoint",
"(",
"s",
".",
"pool",
".",
"Name",
",",
"s",
".",
"volume",
".",
"Name",
")",
"\n",
"return",
"os",
".",
"MkdirAll",
"(",
"volumeMntPoint",
",",
"0711",
")",
"\n\n",
"}",
"\n",
"err",
"=",
"s",
".",
"StoragePoolCreate",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"defer",
"func",
"(",
")",
"{",
"if",
"!",
"tryUndo",
"{",
"return",
"\n",
"}",
"\n",
"s",
".",
"StoragePoolDelete",
"(",
")",
"\n",
"}",
"(",
")",
"\n\n",
"// In case the storage pool config was changed during the pool creation,",
"// we need to update the database to reflect this change. This can e.g.",
"// happen, when we create a loop file image. This means we append \".img\"",
"// to the path the user gave us and update the config in the storage",
"// callback. So diff the config here to see if something like this has",
"// happened.",
"postCreateConfig",
":=",
"s",
".",
"GetStoragePoolWritable",
"(",
")",
".",
"Config",
"\n",
"configDiff",
",",
"_",
":=",
"storageConfigDiff",
"(",
"config",
",",
"postCreateConfig",
")",
"\n",
"if",
"len",
"(",
"configDiff",
")",
">",
"0",
"{",
"// Create the database entry for the storage pool.",
"err",
"=",
"state",
".",
"Cluster",
".",
"StoragePoolUpdate",
"(",
"poolName",
",",
"poolDescription",
",",
"postCreateConfig",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"poolName",
",",
"err",
")",
"\n",
"}",
"\n",
"}",
"\n\n",
"// Success, update the closure to mark that the changes should be kept.",
"tryUndo",
"=",
"<mask>",
"\n\n",
"return",
"nil",
"\n",
"}"
]
|
18,885 | all-18886 | [
"maybeUpdate",
"returns",
"false",
"if",
"the",
"given",
"n",
"index",
"comes",
"from",
"an",
"outdated",
"message",
".",
"Otherwise",
"it",
"updates",
"the",
"progress",
"and",
"returns",
"true",
"."
]
| [
"func",
"(",
"pr",
"*",
"Progress",
")",
"maybeUpdate",
"(",
"n",
"uint64",
")",
"bool",
"{",
"<mask>",
"updated",
"bool",
"\n",
"if",
"pr",
".",
"Match",
"<",
"n",
"{",
"pr",
".",
"Match",
"=",
"n",
"\n",
"updated",
"=",
"true",
"\n",
"pr",
".",
"resume",
"(",
")",
"\n",
"}",
"\n",
"if",
"pr",
".",
"Next",
"<",
"n",
"+",
"1",
"{",
"pr",
".",
"Next",
"=",
"n",
"+",
"1",
"\n",
"}",
"\n",
"return",
"updated",
"\n",
"}"
]
|
18,886 | all-18887 | [
"Locator",
"returns",
"a",
"locator",
"for",
"the",
"given",
"resource"
]
| [
"func",
"(",
"r",
"*",
"MultiCloudImage",
")",
"Locator",
"(",
"api",
"*",
"API",
")",
"*",
"MultiCloudImageLocator",
"{",
"for",
"_",
",",
"l",
":=",
"<mask>",
"r",
".",
"Links",
"{",
"if",
"l",
"[",
"\"",
"\"",
"]",
"==",
"\"",
"\"",
"{",
"return",
"api",
".",
"MultiCloudImageLocator",
"(",
"l",
"[",
"\"",
"\"",
"]",
")",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
]
|
18,887 | all-18888 | [
"StartLogger",
"initializes",
"the",
"log",
"file",
"."
]
| [
"func",
"StartLogger",
"(",
")",
"{",
"var",
"err",
"error",
"\n\n",
"if",
"BOOT",
"{",
"if",
"logFile",
",",
"err",
"=",
"<mask>",
".",
"OpenFile",
"(",
"_LOG_FILE",
",",
"os",
".",
"O_WRONLY",
"|",
"os",
".",
"O_TRUNC",
",",
"0",
")",
";",
"err",
"!=",
"nil",
"{",
"log",
".",
"Print",
"(",
"err",
")",
"\n",
"}",
"else",
"{",
"Log",
"=",
"log",
".",
"New",
"(",
"logFile",
",",
"\"",
"\"",
",",
"log",
".",
"Lshortfile",
")",
"\n",
"}",
"\n",
"}",
"else",
"{",
"if",
"Log",
",",
"err",
"=",
"syslog",
".",
"NewLogger",
"(",
"syslog",
".",
"LOG_NOTICE",
",",
"log",
".",
"Lshortfile",
")",
";",
"err",
"!=",
"nil",
"{",
"log",
".",
"Fatal",
"(",
"err",
")",
"\n",
"}",
"\n",
"}",
"\n",
"}"
]
|
18,888 | all-18889 | [
"GetTerminalReason",
"mocks",
"base",
"method"
]
| [
"func",
"(",
"m",
"*",
"MockTaskResource",
")",
"GetTerminalReason",
"(",
")",
"string",
"{",
"ret",
":=",
"m",
".",
"ctrl",
".",
"Call",
"(",
"m",
",",
"\"",
"\"",
")",
"\n",
"ret0",
",",
"_",
":=",
"<mask>",
"[",
"0",
"]",
".",
"(",
"string",
")",
"\n",
"return",
"ret0",
"\n",
"}"
]
|
18,889 | all-18890 | [
"_MSet",
"sets",
"multiple",
"values",
"named",
"by",
"the",
"keys",
"in",
"the",
"given",
"filename",
"."
]
| [
"func",
"_MSet",
"(",
"filename",
"string",
",",
"keys",
",",
"values",
"[",
"]",
"string",
")",
"error",
"{",
"if",
"len",
"(",
"keys",
")",
"!=",
"len",
"(",
"values",
")",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"// Check if the key is already used.",
"conf",
",",
"err",
":=",
"shconf",
".",
"ParseFile",
"(",
"<mask>",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"if",
"err",
"!=",
"os",
".",
"ErrNotExist",
"{",
"return",
"err",
"\n",
"}",
"\n",
"println",
"(",
"\"",
"\"",
")",
"//TODO: remove",
"\n",
"}",
"\n\n",
"var",
"buf",
"bytes",
".",
"Buffer",
"\n",
"for",
"i",
",",
"key",
":=",
"range",
"keys",
"{",
"if",
"_",
",",
"err",
"=",
"conf",
".",
"Get",
"(",
"key",
")",
";",
"err",
"!=",
"nil",
"{",
"continue",
"// TODO: log key already set.",
"\n",
"}",
"\n\n",
"buf",
".",
"WriteString",
"(",
"key",
")",
"\n",
"buf",
".",
"Write",
"(",
"conf",
".",
"Separator",
"(",
")",
")",
"\n",
"buf",
".",
"WriteString",
"(",
"values",
"[",
"i",
"]",
")",
"\n",
"buf",
".",
"WriteByte",
"(",
"'\\n'",
")",
"\n",
"}",
"\n\n",
"return",
"file",
".",
"Append",
"(",
"filename",
",",
"buf",
".",
"Bytes",
"(",
")",
")",
"\n",
"}"
]
|
18,890 | all-18891 | [
"CdromApplyOperation",
"processes",
"an",
"apply",
"operation",
"for",
"all",
"disks",
"in",
"the",
"resource",
".",
"The",
"function",
"takes",
"the",
"root",
"resource",
"s",
"ResourceData",
"the",
"provider",
"connection",
"and",
"the",
"device",
"list",
"as",
"known",
"to",
"vSphere",
"at",
"the",
"start",
"of",
"this",
"operation",
".",
"All",
"disk",
"operations",
"are",
"carried",
"out",
"with",
"both",
"the",
"complete",
"updated",
"VirtualDeviceList",
"and",
"the",
"complete",
"list",
"of",
"changes",
"returned",
"as",
"a",
"slice",
"of",
"BaseVirtualDeviceConfigSpec",
"."
]
| [
"func",
"CdromApplyOperation",
"(",
"d",
"*",
"schema",
".",
"ResourceData",
",",
"c",
"*",
"govmomi",
".",
"Client",
",",
"l",
"object",
".",
"VirtualDeviceList",
")",
"(",
"object",
".",
"VirtualDeviceList",
",",
"[",
"]",
"types",
".",
"BaseVirtualDeviceConfigSpec",
",",
"error",
")",
"{",
"log",
".",
"Printf",
"(",
"\"",
"\"",
")",
"\n",
"// While we are currently only restricting CD devices to one device, we have",
"// to actually account for the fact that someone could add multiple CD drives",
"// out of band. So this workflow is similar to the multi-device workflow that",
"// exists for network devices.",
"o",
",",
"n",
":=",
"d",
".",
"GetChange",
"(",
"subresourceTypeCdrom",
")",
"\n",
"ods",
":=",
"o",
".",
"(",
"[",
"]",
"interface",
"{",
"}",
")",
"\n",
"nds",
":=",
"n",
".",
"(",
"[",
"]",
"interface",
"{",
"}",
")",
"\n\n",
"var",
"spec",
"[",
"]",
"types",
".",
"BaseVirtualDeviceConfigSpec",
"\n\n",
"// Our old and new sets now have an accurate description of devices that may",
"// have been added, removed, or changed. Look for removed devices first.",
"<mask>",
".",
"Printf",
"(",
"\"",
"\"",
")",
"\n",
"nextOld",
":",
"for",
"n",
",",
"oe",
":=",
"range",
"ods",
"{",
"om",
":=",
"oe",
".",
"(",
"map",
"[",
"string",
"]",
"interface",
"{",
"}",
")",
"\n",
"for",
"_",
",",
"ne",
":=",
"range",
"nds",
"{",
"nm",
":=",
"ne",
".",
"(",
"map",
"[",
"string",
"]",
"interface",
"{",
"}",
")",
"\n",
"if",
"om",
"[",
"\"",
"\"",
"]",
"==",
"nm",
"[",
"\"",
"\"",
"]",
"{",
"continue",
"nextOld",
"\n",
"}",
"\n",
"}",
"\n",
"r",
":=",
"NewCdromSubresource",
"(",
"c",
",",
"d",
",",
"om",
",",
"nil",
",",
"n",
")",
"\n",
"dspec",
",",
"err",
":=",
"r",
".",
"Delete",
"(",
"l",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"r",
".",
"Addr",
"(",
")",
",",
"err",
")",
"\n",
"}",
"\n",
"l",
"=",
"applyDeviceChange",
"(",
"l",
",",
"dspec",
")",
"\n",
"spec",
"=",
"append",
"(",
"spec",
",",
"dspec",
"...",
")",
"\n",
"}",
"\n\n",
"// Now check for creates and updates. The results of this operation are",
"// committed to state after the operation completes.",
"var",
"updates",
"[",
"]",
"interface",
"{",
"}",
"\n",
"log",
".",
"Printf",
"(",
"\"",
"\"",
")",
"\n",
"for",
"n",
",",
"ne",
":=",
"range",
"nds",
"{",
"nm",
":=",
"ne",
".",
"(",
"map",
"[",
"string",
"]",
"interface",
"{",
"}",
")",
"\n",
"if",
"n",
"<",
"len",
"(",
"ods",
")",
"{",
"// This is an update",
"oe",
":=",
"ods",
"[",
"n",
"]",
"\n",
"om",
":=",
"oe",
".",
"(",
"map",
"[",
"string",
"]",
"interface",
"{",
"}",
")",
"\n",
"if",
"nm",
"[",
"\"",
"\"",
"]",
"!=",
"om",
"[",
"\"",
"\"",
"]",
"{",
"return",
"nil",
",",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"subresourceTypeCdrom",
",",
"n",
",",
"nm",
"[",
"\"",
"\"",
"]",
".",
"(",
"int",
")",
",",
"om",
"[",
"\"",
"\"",
"]",
".",
"(",
"int",
")",
")",
"\n",
"}",
"\n",
"if",
"reflect",
".",
"DeepEqual",
"(",
"nm",
",",
"om",
")",
"{",
"// no change is a no-op",
"updates",
"=",
"append",
"(",
"updates",
",",
"nm",
")",
"\n",
"log",
".",
"Printf",
"(",
"\"",
"\"",
",",
"nm",
"[",
"\"",
"\"",
"]",
".",
"(",
"int",
")",
")",
"\n",
"continue",
"\n",
"}",
"\n",
"r",
":=",
"NewCdromSubresource",
"(",
"c",
",",
"d",
",",
"nm",
",",
"om",
",",
"n",
")",
"\n",
"uspec",
",",
"err",
":=",
"r",
".",
"Update",
"(",
"l",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"r",
".",
"Addr",
"(",
")",
",",
"err",
")",
"\n",
"}",
"\n",
"l",
"=",
"applyDeviceChange",
"(",
"l",
",",
"uspec",
")",
"\n",
"spec",
"=",
"append",
"(",
"spec",
",",
"uspec",
"...",
")",
"\n",
"updates",
"=",
"append",
"(",
"updates",
",",
"r",
".",
"Data",
"(",
")",
")",
"\n",
"continue",
"\n",
"}",
"\n",
"// New device",
"r",
":=",
"NewCdromSubresource",
"(",
"c",
",",
"d",
",",
"nm",
",",
"nil",
",",
"n",
")",
"\n",
"cspec",
",",
"err",
":=",
"r",
".",
"Create",
"(",
"l",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"r",
".",
"Addr",
"(",
")",
",",
"err",
")",
"\n",
"}",
"\n",
"l",
"=",
"applyDeviceChange",
"(",
"l",
",",
"cspec",
")",
"\n",
"spec",
"=",
"append",
"(",
"spec",
",",
"cspec",
"...",
")",
"\n",
"updates",
"=",
"append",
"(",
"updates",
",",
"r",
".",
"Data",
"(",
")",
")",
"\n",
"}",
"\n\n",
"log",
".",
"Printf",
"(",
"\"",
"\"",
",",
"subresourceListString",
"(",
"updates",
")",
")",
"\n",
"// We are now done! Return the updated device list and config spec. Save updates as well.",
"if",
"err",
":=",
"d",
".",
"Set",
"(",
"subresourceTypeCdrom",
",",
"updates",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"nil",
",",
"err",
"\n",
"}",
"\n",
"log",
".",
"Printf",
"(",
"\"",
"\"",
",",
"DeviceListString",
"(",
"l",
")",
")",
"\n",
"log",
".",
"Printf",
"(",
"\"",
"\"",
",",
"DeviceChangeString",
"(",
"spec",
")",
")",
"\n",
"log",
".",
"Printf",
"(",
"\"",
"\"",
")",
"\n",
"return",
"l",
",",
"spec",
",",
"nil",
"\n",
"}"
]
|
18,891 | all-18892 | [
"BeTemporally",
"compares",
"time",
".",
"Time",
"s",
"like",
"BeNumerically",
"Actual",
"and",
"expected",
"must",
"be",
"time",
".",
"Time",
".",
"The",
"comparators",
"are",
"the",
"same",
"as",
"for",
"BeNumerically",
"Expect",
"(",
"time",
".",
"Now",
"()",
")",
".",
"Should",
"(",
"BeTemporally",
"(",
">",
"time",
".",
"Time",
"{}",
"))",
"Expect",
"(",
"time",
".",
"Now",
"()",
")",
".",
"Should",
"(",
"BeTemporally",
"(",
"~",
"time",
".",
"Now",
"()",
"time",
".",
"Second",
"))"
]
| [
"func",
"BeTemporally",
"(",
"comparator",
"string",
",",
"compareTo",
"time",
".",
"Time",
",",
"threshold",
"...",
"<mask>",
".",
"Duration",
")",
"types",
".",
"GomegaMatcher",
"{",
"return",
"&",
"matchers",
".",
"BeTemporallyMatcher",
"{",
"Comparator",
":",
"comparator",
",",
"CompareTo",
":",
"compareTo",
",",
"Threshold",
":",
"threshold",
",",
"}",
"\n",
"}"
]
|
18,892 | all-18893 | [
"DeleteHeader",
"deletes",
"given",
"header",
"."
]
| [
"func",
"(",
"e",
"*",
"Envelope",
")",
"DeleteHeader",
"(",
"name",
"string",
")",
"error",
"{",
"if",
"name",
"==",
"\"",
"\"",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"e",
".",
"header",
".",
"Del",
"(",
"<mask>",
")",
"\n",
"return",
"nil",
"\n",
"}"
]
|
18,893 | all-18894 | [
"Opens",
"the",
"node",
"-",
"level",
"database",
"with",
"the",
"correct",
"parameters",
"for",
"LXD",
"."
]
| [
"func",
"sqliteOpen",
"(",
"path",
"string",
")",
"(",
"*",
"sql",
".",
"DB",
",",
"error",
")",
"{",
"timeout",
":=",
"5",
"// TODO - make this command-line configurable?",
"\n\n",
"// These are used to tune the transaction BEGIN behavior instead of using the",
"// similar \"locking_mode\" pragma (locking for the whole database connection).",
"openPath",
":=",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"<mask>",
",",
"timeout",
"*",
"1000",
")",
"\n\n",
"// Open the database. If the file doesn't exist it is created.",
"return",
"sql",
".",
"Open",
"(",
"\"",
"\"",
",",
"openPath",
")",
"\n",
"}"
]
|
18,894 | all-18895 | [
"ClusterToCtx",
"converts",
"the",
"prow",
"job",
"s",
"cluster",
"to",
"a",
"cluster",
"context"
]
| [
"func",
"ClusterToCtx",
"(",
"cluster",
"<mask>",
")",
"string",
"{",
"if",
"cluster",
"==",
"kube",
".",
"InClusterContext",
"{",
"return",
"kube",
".",
"DefaultClusterAlias",
"\n",
"}",
"\n",
"return",
"cluster",
"\n",
"}"
]
|
18,895 | all-18896 | [
"/",
"*",
"GetMat",
"returns",
"the",
"matrix",
"header",
"for",
"an",
"image",
"."
]
| [
"func",
"(",
"img",
"*",
"IplImage",
")",
"GetMat",
"(",
")",
"*",
"Mat",
"{",
"<mask>",
"null",
"C",
".",
"int",
"\n",
"tmp",
":=",
"CreateMat",
"(",
"img",
".",
"Height",
"(",
")",
",",
"img",
".",
"Width",
"(",
")",
",",
"CV_32S",
")",
"\n",
"m",
":=",
"C",
".",
"cvGetMat",
"(",
"unsafe",
".",
"Pointer",
"(",
"img",
")",
",",
"(",
"*",
"C",
".",
"CvMat",
")",
"(",
"tmp",
")",
",",
"&",
"null",
",",
"C",
".",
"int",
"(",
"0",
")",
")",
"\n",
"return",
"(",
"*",
"Mat",
")",
"(",
"m",
")",
"\n",
"}"
]
|
18,896 | all-18897 | [
"DescribeEntries",
"calls",
"DescribeEntry",
"for",
"each",
"Entry",
"adding",
"a",
"newline",
"to",
"each",
"."
]
| [
"func",
"DescribeEntries",
"(",
"ents",
"[",
"]",
"<mask>",
".",
"Entry",
",",
"f",
"EntryFormatter",
")",
"string",
"{",
"var",
"buf",
"bytes",
".",
"Buffer",
"\n",
"for",
"_",
",",
"e",
":=",
"range",
"ents",
"{",
"_",
",",
"_",
"=",
"buf",
".",
"WriteString",
"(",
"DescribeEntry",
"(",
"e",
",",
"f",
")",
"+",
"\"",
"\\n",
"\"",
")",
"\n",
"}",
"\n",
"return",
"buf",
".",
"String",
"(",
")",
"\n",
"}"
]
|
18,897 | all-18898 | [
"UnmarshalJSON",
"supports",
"json",
".",
"Unmarshaler",
"interface"
]
| [
"func",
"(",
"v",
"*",
"GetDatabaseTableNamesReturns",
")",
"UnmarshalJSON",
"(",
"data",
"[",
"]",
"byte",
")",
"error",
"{",
"r",
":=",
"jlexer",
".",
"Lexer",
"{",
"Data",
":",
"<mask>",
"}",
"\n",
"easyjsonC5a4559bDecodeGithubComChromedpCdprotoDatabase",
"(",
"&",
"r",
",",
"v",
")",
"\n",
"return",
"r",
".",
"Error",
"(",
")",
"\n",
"}"
]
|
18,898 | all-18899 | [
"UnmarshalJSON",
"supports",
"json",
".",
"Unmarshaler",
"interface"
]
| [
"func",
"(",
"v",
"*",
"TrackIndexedDBForOriginParams",
")",
"UnmarshalJSON",
"(",
"<mask>",
"[",
"]",
"byte",
")",
"error",
"{",
"r",
":=",
"jlexer",
".",
"Lexer",
"{",
"Data",
":",
"data",
"}",
"\n",
"easyjsonC5a4559bDecodeGithubComChromedpCdprotoStorage3",
"(",
"&",
"r",
",",
"v",
")",
"\n",
"return",
"r",
".",
"Error",
"(",
")",
"\n",
"}"
]
|
18,899 | all-18900 | [
"WithBrowserContextID",
"browserContext",
"to",
"reset",
"permissions",
".",
"When",
"omitted",
"default",
"browser",
"context",
"is",
"used",
"."
]
| [
"func",
"(",
"p",
"ResetPermissionsParams",
")",
"WithBrowserContextID",
"(",
"browserContextID",
"<mask>",
".",
"BrowserContextID",
")",
"*",
"ResetPermissionsParams",
"{",
"p",
".",
"BrowserContextID",
"=",
"browserContextID",
"\n",
"return",
"&",
"p",
"\n",
"}"
]
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.