id
int32 0
25.3k
| idx
stringlengths 5
9
| nl_tokens
sequencelengths 1
418
| pl_tokens
sequencelengths 22
4.98k
|
---|---|---|---|
3,000 | all-3001 | [
"ReadResponse",
"reads",
"a",
"server",
"response",
"into",
"the",
"received",
"o",
"."
] | [
"func",
"(",
"o",
"*",
"OrderVMByFilterReader",
")",
"ReadResponse",
"(",
"response",
"runtime",
".",
"ClientResponse",
",",
"consumer",
"runtime",
".",
"Consumer",
")",
"(",
"interface",
"{",
"}",
",",
"error",
")",
"{",
"switch",
"response",
".",
"Code",
"(",
")",
"{",
"case",
"200",
":",
"result",
":=",
"NewOrderVMByFilterOK",
"(",
")",
"\n",
"if",
"err",
":=",
"result",
".",
"readResponse",
"(",
"response",
",",
"consumer",
",",
"o",
".",
"formats",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"return",
"result",
",",
"nil",
"\n\n",
"case",
"404",
":",
"<mask>",
":=",
"NewOrderVMByFilterNotFound",
"(",
")",
"\n",
"if",
"err",
":=",
"result",
".",
"readResponse",
"(",
"response",
",",
"consumer",
",",
"o",
".",
"formats",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"return",
"nil",
",",
"result",
"\n\n",
"default",
":",
"result",
":=",
"NewOrderVMByFilterDefault",
"(",
"response",
".",
"Code",
"(",
")",
")",
"\n",
"if",
"err",
":=",
"result",
".",
"readResponse",
"(",
"response",
",",
"consumer",
",",
"o",
".",
"formats",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"return",
"nil",
",",
"result",
"\n",
"}",
"\n",
"}"
] |
3,001 | all-3002 | [
"GetCreatedAtOk",
"returns",
"a",
"tuple",
"with",
"the",
"CreatedAt",
"field",
"if",
"it",
"s",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"and",
"a",
"boolean",
"to",
"check",
"if",
"the",
"value",
"has",
"been",
"set",
"."
] | [
"func",
"(",
"s",
"*",
"SyntheticsTest",
")",
"GetCreatedAtOk",
"(",
")",
"(",
"string",
",",
"bool",
")",
"{",
"if",
"s",
"==",
"nil",
"||",
"s",
".",
"CreatedAt",
"==",
"nil",
"{",
"return",
"\"",
"\"",
",",
"false",
"\n",
"}",
"\n",
"return",
"*",
"s",
".",
"CreatedAt",
",",
"<mask>",
"\n",
"}"
] |
3,002 | all-3003 | [
"GetOrderDirectionOk",
"returns",
"a",
"tuple",
"with",
"the",
"OrderDirection",
"field",
"if",
"it",
"s",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"and",
"a",
"boolean",
"to",
"check",
"if",
"the",
"value",
"has",
"been",
"set",
"."
] | [
"func",
"(",
"g",
"*",
"GraphDefinitionRequest",
")",
"GetOrderDirectionOk",
"(",
")",
"(",
"string",
",",
"bool",
")",
"{",
"if",
"g",
"==",
"nil",
"||",
"g",
".",
"OrderDirection",
"==",
"nil",
"{",
"return",
"\"",
"\"",
",",
"false",
"\n",
"}",
"\n",
"return",
"*",
"g",
".",
"OrderDirection",
",",
"<mask>",
"\n",
"}"
] |
3,003 | all-3004 | [
"check",
"the",
"completeness",
"status",
"of",
"a",
"framebuffer"
] | [
"func",
"CheckFramebufferStatus",
"(",
"target",
"uint32",
")",
"uint32",
"{",
"ret",
",",
"_",
",",
"_",
":=",
"syscall",
".",
"Syscall",
"(",
"gpCheckFramebufferStatus",
",",
"1",
",",
"uintptr",
"(",
"<mask>",
")",
",",
"0",
",",
"0",
")",
"\n",
"return",
"(",
"uint32",
")",
"(",
"ret",
")",
"\n",
"}"
] |
3,004 | all-3005 | [
"Return",
"value",
"has",
"type",
"C",
".",
"GLVULKANPROCNV",
"."
] | [
"func",
"GetVkProcAddrNV",
"(",
"<mask>",
"*",
"uint8",
")",
"unsafe",
".",
"Pointer",
"{",
"ret",
",",
"_",
",",
"_",
":=",
"syscall",
".",
"Syscall",
"(",
"gpGetVkProcAddrNV",
",",
"1",
",",
"uintptr",
"(",
"unsafe",
".",
"Pointer",
"(",
"name",
")",
")",
",",
"0",
",",
"0",
")",
"\n",
"return",
"(",
"unsafe",
".",
"Pointer",
")",
"(",
"ret",
")",
"\n",
"}"
] |
3,005 | all-3006 | [
"diskRelocateString",
"prints",
"out",
"information",
"from",
"a",
"VirtualMachineRelocateSpecDiskLocator",
"in",
"a",
"friendly",
"way",
".",
"The",
"format",
"depends",
"on",
"whether",
"or",
"not",
"a",
"backing",
"has",
"been",
"defined",
"."
] | [
"func",
"diskRelocateString",
"(",
"relocate",
"types",
".",
"VirtualMachineRelocateSpecDiskLocator",
")",
"string",
"{",
"key",
":=",
"relocate",
".",
"DiskId",
"\n",
"var",
"locstring",
"string",
"\n",
"if",
"backing",
",",
"<mask>",
":=",
"relocate",
".",
"DiskBackingInfo",
".",
"(",
"*",
"types",
".",
"VirtualDiskFlatVer2BackingInfo",
")",
";",
"ok",
"&&",
"backing",
"!=",
"nil",
"{",
"locstring",
"=",
"backing",
".",
"FileName",
"\n",
"}",
"else",
"{",
"locstring",
"=",
"relocate",
".",
"Datastore",
".",
"Value",
"\n",
"}",
"\n",
"return",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"key",
",",
"locstring",
")",
"\n",
"}"
] |
3,006 | all-3007 | [
"ParseTemplateConfig",
"parses",
"a",
"string",
"in",
"the",
"form",
"source",
":",
"destination",
":",
"command",
"into",
"a",
"TemplateConfig",
"."
] | [
"func",
"ParseTemplateConfig",
"(",
"s",
"string",
")",
"(",
"*",
"TemplateConfig",
",",
"error",
")",
"{",
"if",
"len",
"(",
"strings",
".",
"TrimSpace",
"(",
"s",
")",
")",
"<",
"1",
"{",
"return",
"nil",
",",
"ErrTemplateStringEmpty",
"\n",
"}",
"\n\n",
"var",
"source",
",",
"destination",
",",
"command",
"string",
"\n",
"parts",
":=",
"configTemplateRe",
".",
"FindAllString",
"(",
"s",
",",
"-",
"1",
")",
"\n\n",
"switch",
"len",
"(",
"parts",
")",
"{",
"case",
"1",
":",
"source",
"=",
"parts",
"[",
"0",
"]",
"\n",
"case",
"2",
":",
"source",
",",
"destination",
"=",
"<mask>",
"[",
"0",
"]",
",",
"parts",
"[",
"1",
"]",
"\n",
"case",
"3",
":",
"source",
",",
"destination",
",",
"command",
"=",
"parts",
"[",
"0",
"]",
",",
"parts",
"[",
"1",
"]",
",",
"parts",
"[",
"2",
"]",
"\n",
"default",
":",
"source",
",",
"destination",
"=",
"parts",
"[",
"0",
"]",
",",
"parts",
"[",
"1",
"]",
"\n",
"command",
"=",
"strings",
".",
"Join",
"(",
"parts",
"[",
"2",
":",
"]",
",",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"var",
"sourcePtr",
",",
"destinationPtr",
",",
"commandPtr",
"*",
"string",
"\n",
"if",
"source",
"!=",
"\"",
"\"",
"{",
"sourcePtr",
"=",
"String",
"(",
"source",
")",
"\n",
"}",
"\n",
"if",
"destination",
"!=",
"\"",
"\"",
"{",
"destinationPtr",
"=",
"String",
"(",
"destination",
")",
"\n",
"}",
"\n",
"if",
"command",
"!=",
"\"",
"\"",
"{",
"commandPtr",
"=",
"String",
"(",
"command",
")",
"\n",
"}",
"\n\n",
"return",
"&",
"TemplateConfig",
"{",
"Source",
":",
"sourcePtr",
",",
"Destination",
":",
"destinationPtr",
",",
"Command",
":",
"commandPtr",
",",
"}",
",",
"nil",
"\n",
"}"
] |
3,007 | all-3008 | [
"FromFile",
"loads",
"Google",
"service",
"account",
"credentials",
"from",
"a",
"reader",
"."
] | [
"func",
"FromFile",
"(",
"<mask>",
"string",
",",
"opts",
"...",
"Option",
")",
"(",
"*",
"GServiceAccount",
",",
"error",
")",
"{",
"buf",
",",
"err",
":=",
"ioutil",
".",
"ReadFile",
"(",
"path",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"return",
"FromJSON",
"(",
"buf",
",",
"opts",
"...",
")",
"\n",
"}"
] |
3,008 | all-3009 | [
"newEphemeralKV",
"creates",
"a",
"new",
"key",
"/",
"value",
"pair",
"associated",
"with",
"a",
"session",
"lease"
] | [
"func",
"newEphemeralKV",
"(",
"s",
"*",
"concurrency",
".",
"Session",
",",
"<mask>",
",",
"val",
"string",
")",
"(",
"*",
"EphemeralKV",
",",
"error",
")",
"{",
"k",
",",
"err",
":=",
"newKV",
"(",
"s",
".",
"Client",
"(",
")",
",",
"key",
",",
"val",
",",
"s",
".",
"Lease",
"(",
")",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"return",
"&",
"EphemeralKV",
"{",
"*",
"k",
"}",
",",
"nil",
"\n",
"}"
] |
3,009 | all-3010 | [
"Contains",
"returns",
"whether",
"the",
"set",
"contains",
"the",
"given",
"value"
] | [
"func",
"(",
"us",
"*",
"unsafeSet",
")",
"Contains",
"(",
"<mask>",
"string",
")",
"(",
"exists",
"bool",
")",
"{",
"_",
",",
"exists",
"=",
"us",
".",
"d",
"[",
"value",
"]",
"\n",
"return",
"exists",
"\n",
"}"
] |
3,010 | all-3011 | [
"GetSpanNameOk",
"returns",
"a",
"tuple",
"with",
"the",
"SpanName",
"field",
"if",
"it",
"s",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"and",
"a",
"boolean",
"to",
"check",
"if",
"the",
"value",
"has",
"been",
"set",
"."
] | [
"func",
"(",
"t",
"*",
"TraceServiceDefinition",
")",
"GetSpanNameOk",
"(",
")",
"(",
"string",
",",
"bool",
")",
"{",
"if",
"t",
"==",
"nil",
"||",
"t",
".",
"SpanName",
"==",
"nil",
"{",
"return",
"\"",
"\"",
",",
"<mask>",
"\n",
"}",
"\n",
"return",
"*",
"t",
".",
"SpanName",
",",
"true",
"\n",
"}"
] |
3,011 | all-3012 | [
"GetUrl",
"returns",
"the",
"Url",
"field",
"if",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"."
] | [
"func",
"(",
"e",
"*",
"<mask>",
")",
"GetUrl",
"(",
")",
"string",
"{",
"if",
"e",
"==",
"nil",
"||",
"e",
".",
"Url",
"==",
"nil",
"{",
"return",
"\"",
"\"",
"\n",
"}",
"\n",
"return",
"*",
"e",
".",
"Url",
"\n",
"}"
] |
3,012 | all-3013 | [
"OptQueryExcludeColumns",
"enables",
"discarding",
"columns",
"from",
"a",
"result"
] | [
"func",
"OptQueryExcludeColumns",
"(",
"enable",
"bool",
")",
"QueryOption",
"{",
"return",
"func",
"(",
"options",
"*",
"QueryOptions",
")",
"error",
"{",
"options",
".",
"ExcludeColumns",
"=",
"<mask>",
"\n",
"return",
"nil",
"\n",
"}",
"\n",
"}"
] |
3,013 | all-3014 | [
"MarshalJSON",
"implements",
"json",
".",
"Marshaler",
".",
"It",
"will",
"encode",
"null",
"if",
"this",
"time",
"is",
"null",
"."
] | [
"func",
"(",
"t",
"Time",
")",
"MarshalJSON",
"(",
")",
"(",
"[",
"]",
"<mask>",
",",
"error",
")",
"{",
"if",
"!",
"t",
".",
"Valid",
"{",
"return",
"[",
"]",
"byte",
"(",
"\"",
"\"",
")",
",",
"nil",
"\n",
"}",
"\n",
"return",
"t",
".",
"Time",
".",
"MarshalJSON",
"(",
")",
"\n",
"}"
] |
3,014 | all-3015 | [
"NewSSMClient",
"mocks",
"base",
"method"
] | [
"func",
"(",
"m",
"*",
"MockSSMClientCreator",
")",
"NewSSMClient",
"(",
"arg0",
"string",
",",
"arg1",
"credentials",
".",
"IAMRoleCredentials",
")",
"ssm",
".",
"SSMClient",
"{",
"<mask>",
":=",
"m",
".",
"ctrl",
".",
"Call",
"(",
"m",
",",
"\"",
"\"",
",",
"arg0",
",",
"arg1",
")",
"\n",
"ret0",
",",
"_",
":=",
"ret",
"[",
"0",
"]",
".",
"(",
"ssm",
".",
"SSMClient",
")",
"\n",
"return",
"ret0",
"\n",
"}"
] |
3,015 | all-3016 | [
"specify",
"a",
"two",
"-",
"dimensional",
"texture",
"subimage"
] | [
"func",
"TexSubImage2D",
"(",
"target",
"uint32",
",",
"level",
"int32",
",",
"xoffset",
"int32",
",",
"yoffset",
"int32",
",",
"width",
"int32",
",",
"height",
"int32",
",",
"format",
"uint32",
",",
"xtype",
"uint32",
",",
"pixels",
"unsafe",
".",
"Pointer",
")",
"{",
"syscall",
".",
"Syscall9",
"(",
"gpTexSubImage2D",
",",
"9",
",",
"uintptr",
"(",
"<mask>",
")",
",",
"uintptr",
"(",
"level",
")",
",",
"uintptr",
"(",
"xoffset",
")",
",",
"uintptr",
"(",
"yoffset",
")",
",",
"uintptr",
"(",
"width",
")",
",",
"uintptr",
"(",
"height",
")",
",",
"uintptr",
"(",
"format",
")",
",",
"uintptr",
"(",
"xtype",
")",
",",
"uintptr",
"(",
"pixels",
")",
")",
"\n",
"}"
] |
3,016 | all-3017 | [
"buildState",
"is",
"used",
"to",
"build",
"a",
"state",
"of",
"the",
"system",
"for",
"reconciliation"
] | [
"func",
"(",
"udevWatcher",
"*",
"UdevWatcher",
")",
"buildState",
"(",
"links",
"[",
"]",
"netlink",
".",
"Link",
")",
"map",
"[",
"string",
"]",
"string",
"{",
"state",
":=",
"make",
"(",
"map",
"[",
"string",
"]",
"string",
")",
"\n",
"for",
"_",
",",
"link",
":=",
"range",
"links",
"{",
"if",
"link",
".",
"Type",
"(",
")",
"!=",
"linkTypeDevice",
"{",
"// We only care about netlink.Device types. These are created",
"// by udev like 'lo' and 'eth0'. Ignore other link types",
"continue",
"\n",
"}",
"\n",
"if",
"link",
".",
"Attrs",
"(",
")",
".",
"EncapType",
"==",
"encapTypeLoopback",
"{",
"// Ignore localhost",
"continue",
"\n",
"}",
"\n",
"macAddress",
":=",
"link",
".",
"Attrs",
"(",
")",
".",
"HardwareAddr",
".",
"String",
"(",
")",
"\n",
"if",
"macAddress",
"!=",
"\"",
"\"",
"&&",
"macAddress",
"!=",
"udevWatcher",
".",
"primaryMAC",
"{",
"state",
"[",
"macAddress",
"]",
"=",
"link",
".",
"Attrs",
"(",
")",
".",
"<mask>",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"state",
"\n",
"}"
] |
3,017 | all-3018 | [
"UnmarshalJSON",
"supports",
"json",
".",
"Unmarshaler",
"interface"
] | [
"func",
"(",
"v",
"*",
"EventRecordingStateChanged",
")",
"UnmarshalJSON",
"(",
"<mask>",
"[",
"]",
"byte",
")",
"error",
"{",
"r",
":=",
"jlexer",
".",
"Lexer",
"{",
"Data",
":",
"data",
"}",
"\n",
"easyjsonC5a4559bDecodeGithubComChromedpCdprotoBackgroundservice3",
"(",
"&",
"r",
",",
"v",
")",
"\n",
"return",
"r",
".",
"Error",
"(",
")",
"\n",
"}"
] |
3,018 | all-3019 | [
"NewDeployServer",
"creates",
"a",
"deploy",
"server"
] | [
"func",
"NewDeployServer",
"(",
"kubeClient",
"*",
"kube",
".",
"Clientset",
",",
"kubeNamespace",
"<mask>",
")",
"deploy",
".",
"APIServer",
"{",
"return",
"&",
"apiServer",
"{",
"kubeClient",
":",
"kubeClient",
",",
"kubeNamespace",
":",
"kubeNamespace",
",",
"}",
"\n",
"}"
] |
3,019 | all-3020 | [
"NewStringsValue",
"implements",
"string",
"slice",
"as",
"flag",
".",
"Value",
"interface",
".",
"Given",
"value",
"is",
"to",
"be",
"separated",
"by",
"comma",
"."
] | [
"func",
"NewStringsValue",
"(",
"s",
"string",
")",
"(",
"ss",
"*",
"StringsValue",
")",
"{",
"if",
"s",
"==",
"\"",
"\"",
"{",
"return",
"&",
"StringsValue",
"{",
"}",
"\n",
"}",
"\n",
"<mask>",
"=",
"new",
"(",
"StringsValue",
")",
"\n",
"if",
"err",
":=",
"ss",
".",
"Set",
"(",
"s",
")",
";",
"err",
"!=",
"nil",
"{",
"plog",
".",
"Panicf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"}",
"\n",
"return",
"ss",
"\n",
"}"
] |
3,020 | all-3021 | [
"Close",
"will",
"close",
"the",
"stream",
"."
] | [
"func",
"(",
"s",
"*",
"Stream",
")",
"Close",
"(",
")",
"{",
"// get mutex",
"s",
".",
"mutex",
".",
"Lock",
"(",
")",
"\n",
"defer",
"s",
".",
"mutex",
".",
"Unlock",
"(",
")",
"\n\n",
"// set flag",
"s",
".",
"closed",
"=",
"true",
"\n\n",
"// close active change stream",
"if",
"s",
".",
"current",
"!=",
"nil",
"{",
"_",
"=",
"s",
".",
"<mask>",
".",
"Close",
"(",
")",
"\n",
"}",
"\n",
"}"
] |
3,021 | all-3022 | [
"UnmarshalJSON",
"supports",
"json",
".",
"Unmarshaler",
"interface"
] | [
"func",
"(",
"v",
"*",
"SetNodeValueParams",
")",
"UnmarshalJSON",
"(",
"<mask>",
"[",
"]",
"byte",
")",
"error",
"{",
"r",
":=",
"jlexer",
".",
"Lexer",
"{",
"Data",
":",
"data",
"}",
"\n",
"easyjsonC5a4559bDecodeGithubComChromedpCdprotoDom3",
"(",
"&",
"r",
",",
"v",
")",
"\n",
"return",
"r",
".",
"Error",
"(",
")",
"\n",
"}"
] |
3,022 | all-3023 | [
"toTOML",
"converts",
"the",
"given",
"structure",
"into",
"a",
"deeply",
"nested",
"TOML",
"string",
"."
] | [
"func",
"toTOML",
"(",
"m",
"map",
"[",
"string",
"]",
"interface",
"{",
"}",
")",
"(",
"string",
",",
"error",
")",
"{",
"buf",
":=",
"bytes",
".",
"NewBuffer",
"(",
"[",
"]",
"byte",
"{",
"}",
")",
"\n",
"enc",
":=",
"toml",
".",
"NewEncoder",
"(",
"buf",
")",
"\n",
"if",
"err",
":=",
"enc",
".",
"Encode",
"(",
"m",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"\"",
"\"",
",",
"<mask>",
".",
"Wrap",
"(",
"err",
",",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"result",
",",
"err",
":=",
"ioutil",
".",
"ReadAll",
"(",
"buf",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"\"",
"\"",
",",
"errors",
".",
"Wrap",
"(",
"err",
",",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"return",
"string",
"(",
"bytes",
".",
"TrimSpace",
"(",
"result",
")",
")",
",",
"nil",
"\n",
"}"
] |
3,023 | all-3024 | [
"CreateRandom",
"returns",
"a",
"random",
"byte",
"string",
"of",
"given",
"length",
"from",
"given",
"byte",
"string"
] | [
"func",
"CreateRandom",
"(",
"bs",
"[",
"]",
"byte",
",",
"length",
"int",
")",
"[",
"]",
"byte",
"{",
"filled",
":=",
"make",
"(",
"[",
"]",
"<mask>",
",",
"length",
")",
"\n",
"max",
":=",
"len",
"(",
"bs",
")",
"\n\n",
"for",
"i",
":=",
"0",
";",
"i",
"<",
"length",
";",
"i",
"++",
"{",
"Shuffle",
"(",
"bs",
")",
"\n",
"filled",
"[",
"i",
"]",
"=",
"bs",
"[",
"random",
"(",
"0",
",",
"max",
")",
"]",
"\n",
"}",
"\n\n",
"return",
"filled",
"\n",
"}"
] |
3,024 | all-3025 | [
"flattenDistributedVirtualSwitchHostMemberConfigSpec",
"reads",
"various",
"fields",
"from",
"a",
"DistributedVirtualSwitchHostMemberConfigSpec",
"and",
"returns",
"a",
"Set",
"object",
"map",
".",
"This",
"is",
"the",
"flatten",
"counterpart",
"to",
"expandDistributedVirtualSwitchHostMemberConfigSpec",
"."
] | [
"func",
"flattenDistributedVirtualSwitchHostMember",
"(",
"obj",
"types",
".",
"DistributedVirtualSwitchHostMember",
")",
"map",
"[",
"string",
"]",
"interface",
"{",
"}",
"{",
"d",
":=",
"make",
"(",
"map",
"[",
"string",
"]",
"interface",
"{",
"}",
")",
"\n",
"d",
"[",
"\"",
"\"",
"]",
"=",
"obj",
".",
"Config",
".",
"Host",
".",
"Value",
"\n\n",
"var",
"devices",
"[",
"]",
"string",
"\n",
"backing",
":=",
"obj",
".",
"Config",
".",
"Backing",
".",
"(",
"*",
"types",
".",
"DistributedVirtualSwitchHostMemberPnicBacking",
")",
"\n",
"for",
"_",
",",
"spec",
":=",
"range",
"backing",
".",
"PnicSpec",
"{",
"devices",
"=",
"append",
"(",
"<mask>",
",",
"spec",
".",
"PnicDevice",
")",
"\n",
"}",
"\n\n",
"d",
"[",
"\"",
"\"",
"]",
"=",
"devices",
"\n\n",
"return",
"d",
"\n",
"}"
] |
3,025 | all-3026 | [
"Finish",
"constructs",
"the",
"import",
"index",
"and",
"performs",
"any",
"other",
"necessary",
"indexing",
"actions",
"after",
"all",
"rules",
"have",
"been",
"added",
".",
"This",
"step",
"is",
"necessary",
"because",
"a",
"rule",
"may",
"be",
"indexed",
"differently",
"based",
"on",
"what",
"rules",
"are",
"added",
"later",
".",
"Finish",
"must",
"be",
"called",
"after",
"all",
"AddRule",
"calls",
"and",
"before",
"any",
"FindRulesByImport",
"calls",
"."
] | [
"func",
"(",
"ix",
"*",
"RuleIndex",
")",
"Finish",
"(",
")",
"{",
"for",
"_",
",",
"r",
":=",
"<mask>",
"ix",
".",
"rules",
"{",
"ix",
".",
"collectEmbeds",
"(",
"r",
")",
"\n",
"}",
"\n",
"ix",
".",
"buildImportIndex",
"(",
")",
"\n",
"}"
] |
3,026 | all-3027 | [
"GetCursorHAdjustment",
"()",
"is",
"a",
"wrapper",
"around",
"gtk_entry_get_cursor_hadjustment",
"()",
"."
] | [
"func",
"(",
"v",
"*",
"<mask>",
")",
"GetCursorHAdjustment",
"(",
")",
"(",
"*",
"Adjustment",
",",
"error",
")",
"{",
"c",
":=",
"C",
".",
"gtk_entry_get_cursor_hadjustment",
"(",
"v",
".",
"native",
"(",
")",
")",
"\n",
"if",
"c",
"==",
"nil",
"{",
"return",
"nil",
",",
"nilPtrErr",
"\n",
"}",
"\n",
"obj",
":=",
"glib",
".",
"Take",
"(",
"unsafe",
".",
"Pointer",
"(",
"c",
")",
")",
"\n",
"return",
"&",
"Adjustment",
"{",
"glib",
".",
"InitiallyUnowned",
"{",
"obj",
"}",
"}",
",",
"nil",
"\n",
"}"
] |
3,027 | all-3028 | [
"buildImportIndex",
"constructs",
"the",
"map",
"used",
"by",
"FindRulesByImport",
"."
] | [
"func",
"(",
"ix",
"*",
"RuleIndex",
")",
"buildImportIndex",
"(",
")",
"{",
"ix",
".",
"importMap",
"=",
"make",
"(",
"map",
"[",
"ImportSpec",
"]",
"[",
"]",
"*",
"ruleRecord",
")",
"\n",
"for",
"_",
",",
"r",
":=",
"<mask>",
"ix",
".",
"rules",
"{",
"if",
"r",
".",
"embedded",
"{",
"continue",
"\n",
"}",
"\n",
"indexed",
":=",
"make",
"(",
"map",
"[",
"ImportSpec",
"]",
"bool",
")",
"\n",
"for",
"_",
",",
"imp",
":=",
"range",
"r",
".",
"importedAs",
"{",
"if",
"indexed",
"[",
"imp",
"]",
"{",
"continue",
"\n",
"}",
"\n",
"indexed",
"[",
"imp",
"]",
"=",
"true",
"\n",
"ix",
".",
"importMap",
"[",
"imp",
"]",
"=",
"append",
"(",
"ix",
".",
"importMap",
"[",
"imp",
"]",
",",
"r",
")",
"\n",
"}",
"\n",
"}",
"\n",
"}"
] |
3,028 | all-3029 | [
"FindFirstActiveControl",
"returns",
"the",
"first",
"active",
"control",
"of",
"a",
"parent"
] | [
"func",
"FindFirstActiveControl",
"(",
"parent",
"Control",
")",
"Control",
"{",
"for",
"_",
",",
"curr",
":=",
"<mask>",
"getLinearControlList",
"(",
"parent",
",",
"nil",
")",
"{",
"if",
"curr",
".",
"Active",
"(",
")",
"{",
"return",
"curr",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
] |
3,029 | all-3030 | [
"NewGRPCLoggerV2FromZapCore",
"creates",
"grpclog",
".",
"LoggerV2",
"from",
"zap",
".",
"Core",
"and",
"zapcore",
".",
"WriteSyncer",
".",
"It",
"discards",
"all",
"INFO",
"level",
"logging",
"in",
"gRPC",
"if",
"debug",
"level",
"is",
"not",
"enabled",
"in",
"*",
"zap",
".",
"Logger",
"."
] | [
"func",
"NewGRPCLoggerV2FromZapCore",
"(",
"cr",
"zapcore",
".",
"Core",
",",
"syncer",
"zapcore",
".",
"WriteSyncer",
")",
"grpclog",
".",
"LoggerV2",
"{",
"// \"AddCallerSkip\" to annotate caller outside of \"logutil\"",
"lg",
":=",
"zap",
".",
"New",
"(",
"cr",
",",
"zap",
".",
"AddCaller",
"(",
")",
",",
"zap",
".",
"AddCallerSkip",
"(",
"1",
")",
",",
"zap",
".",
"ErrorOutput",
"(",
"syncer",
")",
")",
"\n",
"<mask>",
"&",
"zapGRPCLogger",
"{",
"lg",
":",
"lg",
",",
"sugar",
":",
"lg",
".",
"Sugar",
"(",
")",
"}",
"\n",
"}"
] |
3,030 | all-3031 | [
"String",
"returns",
"the",
"string",
"representation",
"of",
"the",
"FetchingInfo",
"."
] | [
"func",
"(",
"f",
"*",
"FetchingInfo",
")",
"<mask>",
"(",
")",
"string",
"{",
"return",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"f",
".",
"Page",
",",
"f",
".",
"PageSize",
",",
"f",
".",
"TotalCount",
")",
"\n",
"}"
] |
3,031 | all-3032 | [
"Match",
"processes",
"the",
"given",
"string",
"until",
"it",
"encounters",
"a",
"rune",
"that",
"doesn",
"t",
"match",
"."
] | [
"func",
"(",
"f",
"RuneMatcherFunc",
")",
"Match",
"(",
"str",
"string",
")",
"(",
"offset",
"int",
",",
"matchStr",
"string",
")",
"{",
"offset",
"=",
"-",
"1",
"\n",
"length",
":=",
"len",
"(",
"str",
")",
"\n",
"if",
"length",
"==",
"0",
"{",
"return",
"\n",
"}",
"\n\n",
"for",
"i",
",",
"r",
":=",
"range",
"str",
"{",
"if",
"f",
"(",
"r",
")",
"{",
"continue",
"\n",
"}",
"\n",
"if",
"i",
"!=",
"0",
"{",
"offset",
"=",
"i",
"\n",
"matchStr",
"=",
"str",
"[",
":",
"i",
"]",
"\n",
"return",
"\n",
"}",
"\n",
"return",
"\n",
"}",
"\n\n",
"offset",
"=",
"<mask>",
"\n",
"matchStr",
"=",
"str",
"\n",
"return",
"\n",
"}"
] |
3,032 | all-3033 | [
"UUID",
"s",
"8",
"13",
"23",
"18",
"is",
"-",
"e",
".",
"g",
".",
"9E242A66",
"-",
"4EA6",
"-",
"4323",
"-",
"AD5C",
"-",
"66A76F4472FE"
] | [
"func",
"hasUUIDPrefix",
"(",
"s",
"string",
")",
"bool",
"{",
"if",
"len",
"(",
"s",
")",
"<",
"36",
"{",
"return",
"false",
"\n",
"}",
"\n",
"var",
"count",
"int",
"\n",
"for",
"i",
",",
"r",
":=",
"range",
"s",
"{",
"// should not be multi byte char",
"if",
"count",
"!=",
"i",
"{",
"return",
"false",
"\n",
"}",
"\n",
"switch",
"count",
"{",
"case",
"8",
",",
"13",
",",
"18",
",",
"23",
":",
"if",
"r",
"!=",
"'-'",
"{",
"return",
"false",
"\n",
"}",
"\n",
"default",
":",
"if",
"!",
"isHex",
"(",
"r",
")",
"{",
"return",
"<mask>",
"\n",
"}",
"\n",
"}",
"\n",
"if",
"count",
"==",
"35",
"{",
"return",
"true",
"\n",
"}",
"\n",
"count",
"+=",
"1",
"\n",
"}",
"\n\n",
"// should not run here",
"return",
"false",
"\n",
"}"
] |
3,033 | all-3034 | [
"APICall",
"is",
"the",
"generic",
"REST",
"API",
"calling",
"method",
"which",
"performs",
"all",
"REST",
"API",
"calls",
"for",
"this",
"library",
".",
"Each",
"auto",
"-",
"generated",
"REST",
"API",
"method",
"simply",
"is",
"a",
"wrapper",
"around",
"this",
"method",
"calling",
"it",
"with",
"specific",
"specific",
"arguments",
"."
] | [
"func",
"(",
"client",
"*",
"Client",
")",
"APICall",
"(",
"payload",
"interface",
"{",
"}",
",",
"method",
",",
"route",
"string",
",",
"result",
"interface",
"{",
"}",
",",
"query",
"<mask>",
".",
"Values",
")",
"(",
"interface",
"{",
"}",
",",
"*",
"CallSummary",
",",
"error",
")",
"{",
"rawPayload",
":=",
"[",
"]",
"byte",
"{",
"}",
"\n",
"var",
"err",
"error",
"\n",
"if",
"reflect",
".",
"ValueOf",
"(",
"payload",
")",
".",
"IsValid",
"(",
")",
"&&",
"!",
"reflect",
".",
"ValueOf",
"(",
"payload",
")",
".",
"IsNil",
"(",
")",
"{",
"rawPayload",
",",
"err",
"=",
"json",
".",
"Marshal",
"(",
"payload",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"cs",
":=",
"&",
"CallSummary",
"{",
"HTTPRequestObject",
":",
"payload",
",",
"}",
"\n",
"return",
"result",
",",
"cs",
",",
"&",
"APICallException",
"{",
"CallSummary",
":",
"cs",
",",
"RootCause",
":",
"err",
",",
"}",
"\n",
"}",
"\n",
"}",
"\n",
"callSummary",
",",
"err",
":=",
"client",
".",
"Request",
"(",
"rawPayload",
",",
"method",
",",
"route",
",",
"query",
")",
"\n",
"callSummary",
".",
"HTTPRequestObject",
"=",
"payload",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"// If context failed during this request, then we should just return that error",
"if",
"client",
".",
"Context",
"!=",
"nil",
"&&",
"client",
".",
"Context",
".",
"Err",
"(",
")",
"!=",
"nil",
"{",
"return",
"result",
",",
"callSummary",
",",
"client",
".",
"Context",
".",
"Err",
"(",
")",
"\n",
"}",
"\n",
"return",
"result",
",",
"callSummary",
",",
"&",
"APICallException",
"{",
"CallSummary",
":",
"callSummary",
",",
"RootCause",
":",
"err",
",",
"}",
"\n",
"}",
"\n",
"// if result is passed in as nil, it means the API defines no response body",
"// json",
"if",
"reflect",
".",
"ValueOf",
"(",
"result",
")",
".",
"IsValid",
"(",
")",
"&&",
"!",
"reflect",
".",
"ValueOf",
"(",
"result",
")",
".",
"IsNil",
"(",
")",
"{",
"err",
"=",
"json",
".",
"Unmarshal",
"(",
"[",
"]",
"byte",
"(",
"callSummary",
".",
"HTTPResponseBody",
")",
",",
"&",
"result",
")",
"\n",
"}",
"\n\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"result",
",",
"callSummary",
",",
"&",
"APICallException",
"{",
"CallSummary",
":",
"callSummary",
",",
"RootCause",
":",
"err",
",",
"}",
"\n",
"}",
"\n",
"return",
"result",
",",
"callSummary",
",",
"nil",
"\n",
"}"
] |
3,034 | all-3035 | [
"Index",
"returns",
"the",
"index",
"for",
"a",
"hashtree",
"writer",
"."
] | [
"func",
"(",
"w",
"*",
"Writer",
")",
"Index",
"(",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"buf",
":=",
"&",
"bytes",
".",
"<mask>",
"{",
"}",
"\n",
"pbw",
":=",
"pbutil",
".",
"NewWriter",
"(",
"buf",
")",
"\n",
"for",
"_",
",",
"idx",
":=",
"range",
"w",
".",
"idxs",
"{",
"if",
"_",
",",
"err",
":=",
"pbw",
".",
"Write",
"(",
"idx",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"buf",
".",
"Bytes",
"(",
")",
",",
"nil",
"\n",
"}"
] |
3,035 | all-3036 | [
"SetMultipartFormBoundaryBytes",
"sets",
"the",
"following",
"Content",
"-",
"Type",
":",
"multipart",
"/",
"form",
"-",
"data",
";",
"boundary",
"=",
"...",
"where",
"...",
"is",
"substituted",
"by",
"the",
"given",
"boundary",
"."
] | [
"func",
"(",
"h",
"*",
"RequestHeader",
")",
"SetMultipartFormBoundaryBytes",
"(",
"boundary",
"[",
"]",
"byte",
")",
"{",
"h",
".",
"parseRawHeaders",
"(",
")",
"\n\n",
"b",
":=",
"h",
".",
"bufKV",
".",
"value",
"[",
":",
"0",
"]",
"\n",
"b",
"=",
"<mask>",
"(",
"b",
",",
"strMultipartFormData",
"...",
")",
"\n",
"b",
"=",
"append",
"(",
"b",
",",
"';'",
",",
"' '",
")",
"\n",
"b",
"=",
"append",
"(",
"b",
",",
"strBoundary",
"...",
")",
"\n",
"b",
"=",
"append",
"(",
"b",
",",
"'='",
")",
"\n",
"b",
"=",
"append",
"(",
"b",
",",
"boundary",
"...",
")",
"\n",
"h",
".",
"bufKV",
".",
"value",
"=",
"b",
"\n\n",
"h",
".",
"SetContentTypeBytes",
"(",
"h",
".",
"bufKV",
".",
"value",
")",
"\n",
"}"
] |
3,036 | all-3037 | [
"Do",
"executes",
"CSS",
".",
"addRule",
"against",
"the",
"provided",
"context",
".",
"returns",
":",
"rule",
"-",
"The",
"newly",
"created",
"rule",
"."
] | [
"func",
"(",
"p",
"*",
"AddRuleParams",
")",
"Do",
"(",
"ctx",
"context",
".",
"Context",
")",
"(",
"<mask>",
"*",
"Rule",
",",
"err",
"error",
")",
"{",
"// execute",
"var",
"res",
"AddRuleReturns",
"\n",
"err",
"=",
"cdp",
".",
"Execute",
"(",
"ctx",
",",
"CommandAddRule",
",",
"p",
",",
"&",
"res",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"return",
"res",
".",
"Rule",
",",
"nil",
"\n",
"}"
] |
3,037 | all-3038 | [
"Info",
"logging"
] | [
"func",
"(",
"l",
"*",
"StdLevelLogger",
")",
"Info",
"(",
"args",
"...",
"interface",
"{",
"}",
")",
"{",
"l",
".",
"logFunc",
"(",
"InfoLevel",
",",
"l",
".",
"<mask>",
",",
"args",
"...",
")",
"\n",
"}"
] |
3,038 | all-3039 | [
"MutateSetOptions",
"for",
"Signer",
"sets",
"the",
"SetOptionsOp",
"s",
"signer",
"field"
] | [
"func",
"(",
"m",
"Signer",
")",
"MutateSetOptions",
"(",
"o",
"*",
"xdr",
".",
"SetOptionsOp",
")",
"(",
"err",
"error",
")",
"{",
"<mask>",
"signer",
"xdr",
".",
"Signer",
"\n",
"signer",
".",
"Weight",
"=",
"xdr",
".",
"Uint32",
"(",
"m",
".",
"Weight",
")",
"\n",
"err",
"=",
"setAccountId",
"(",
"m",
".",
"PublicKey",
",",
"&",
"signer",
".",
"PubKey",
")",
"\n",
"o",
".",
"Signer",
"=",
"&",
"signer",
"\n",
"return",
"\n",
"}"
] |
3,039 | all-3040 | [
"New",
"returns",
"a",
"new",
"Random",
"in",
"most",
"cases",
"you",
"can",
"also",
"just",
"use",
"the",
"global",
"funcs"
] | [
"func",
"New",
"(",
"seed",
"int64",
")",
"<mask>",
".",
"Interface",
"{",
"return",
"&",
"TTNRandom",
"{",
"Interface",
":",
"&",
"random",
".",
"TTNRandom",
"{",
"Source",
":",
"rand",
".",
"New",
"(",
"rand",
".",
"NewSource",
"(",
"seed",
")",
")",
",",
"}",
",",
"}",
"\n",
"}"
] |
3,040 | all-3041 | [
"Data",
"contains",
"all",
"the",
"values",
"set",
"through",
"Get",
"/",
"Set",
"."
] | [
"func",
"(",
"d",
"*",
"DefaultContext",
")",
"Data",
"(",
")",
"map",
"[",
"string",
"]",
"interface",
"{",
"}",
"{",
"d",
".",
"moot",
".",
"Lock",
"(",
")",
"\n",
"m",
":=",
"map",
"[",
"string",
"]",
"<mask>",
"{",
"}",
"{",
"}",
"\n",
"for",
"k",
",",
"v",
":=",
"range",
"d",
".",
"data",
"{",
"m",
"[",
"k",
"]",
"=",
"v",
"\n",
"}",
"\n",
"d",
".",
"moot",
".",
"Unlock",
"(",
")",
"\n",
"return",
"m",
"\n",
"}"
] |
3,041 | all-3042 | [
"initLocales",
"initializes",
"language",
"type",
"list",
"and",
"Accept",
"-",
"Language",
"header",
"matcher",
"."
] | [
"func",
"initLocales",
"(",
"opt",
"Options",
")",
"language",
".",
"Matcher",
"{",
"tags",
":=",
"make",
"(",
"[",
"]",
"language",
".",
"Tag",
",",
"len",
"(",
"opt",
".",
"Langs",
")",
")",
"\n",
"for",
"i",
",",
"lang",
":=",
"range",
"opt",
".",
"Langs",
"{",
"tags",
"[",
"i",
"]",
"=",
"language",
".",
"Raw",
".",
"Make",
"(",
"lang",
")",
"\n",
"fname",
":=",
"fmt",
".",
"Sprintf",
"(",
"opt",
".",
"Format",
",",
"lang",
")",
"\n",
"// Append custom locale file.",
"custom",
":=",
"[",
"]",
"interface",
"{",
"}",
"{",
"}",
"\n",
"customPath",
":=",
"path",
".",
"Join",
"(",
"opt",
".",
"CustomDirectory",
",",
"fname",
")",
"\n",
"if",
"com",
".",
"IsFile",
"(",
"customPath",
")",
"{",
"custom",
"=",
"append",
"(",
"custom",
",",
"customPath",
")",
"\n",
"}",
"\n\n",
"var",
"locale",
"<mask>",
"{",
"}",
"\n",
"if",
"data",
",",
"ok",
":=",
"opt",
".",
"Files",
"[",
"fname",
"]",
";",
"ok",
"{",
"locale",
"=",
"data",
"\n",
"}",
"else",
"{",
"locale",
"=",
"path",
".",
"Join",
"(",
"opt",
".",
"Directory",
",",
"fname",
")",
"\n",
"}",
"\n\n",
"err",
":=",
"i18n",
".",
"SetMessageWithDesc",
"(",
"lang",
",",
"opt",
".",
"Names",
"[",
"i",
"]",
",",
"locale",
",",
"custom",
"...",
")",
"\n",
"if",
"err",
"!=",
"nil",
"&&",
"err",
"!=",
"i18n",
".",
"ErrLangAlreadyExist",
"{",
"panic",
"(",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"lang",
",",
"err",
")",
")",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"language",
".",
"NewMatcher",
"(",
"tags",
")",
"\n",
"}"
] |
3,042 | all-3043 | [
"SetLogger",
"sets",
"the",
"logger",
"for",
"this",
"streambuffer"
] | [
"func",
"(",
"s",
"*",
"Stream",
")",
"SetLogger",
"(",
"<mask>",
"ttnlog",
".",
"Interface",
")",
"{",
"s",
".",
"mu",
".",
"Lock",
"(",
")",
"\n",
"s",
".",
"log",
"=",
"log",
"\n",
"s",
".",
"mu",
".",
"Unlock",
"(",
")",
"\n",
"}"
] |
3,043 | all-3044 | [
"buildEgressIgnoredPorts",
"creates",
"egress",
"ignored",
"ports",
"from",
"proxy",
"config"
] | [
"func",
"buildEgressIgnoredPorts",
"(",
"proxyConfig",
"*",
"ecsacs",
".",
"ProxyConfiguration",
")",
"[",
"]",
"string",
"{",
"<mask>",
"inputEgressIgnoredPorts",
"[",
"]",
"string",
"\n",
"if",
"proxyConfig",
".",
"Properties",
"[",
"egressIgnoredPorts",
"]",
"!=",
"nil",
"{",
"inputEgressIgnoredPorts",
"=",
"strings",
".",
"Split",
"(",
"*",
"proxyConfig",
".",
"Properties",
"[",
"egressIgnoredPorts",
"]",
",",
"splitter",
")",
"\n",
"}",
"\n",
"return",
"inputEgressIgnoredPorts",
"\n",
"}"
] |
3,044 | all-3045 | [
"Disk",
"device",
"handling"
] | [
"func",
"(",
"c",
"*",
"containerLXC",
")",
"createDiskDevice",
"(",
"name",
"string",
",",
"m",
"types",
".",
"Device",
")",
"(",
"string",
",",
"error",
")",
"{",
"// source paths",
"relativeDestPath",
":=",
"strings",
".",
"TrimPrefix",
"(",
"m",
"[",
"\"",
"\"",
"]",
",",
"\"",
"\"",
")",
"\n",
"devName",
":=",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"strings",
".",
"Replace",
"(",
"<mask>",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"-",
"1",
")",
",",
"strings",
".",
"Replace",
"(",
"relativeDestPath",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"-",
"1",
")",
")",
"\n",
"devPath",
":=",
"filepath",
".",
"Join",
"(",
"c",
".",
"DevicesPath",
"(",
")",
",",
"devName",
")",
"\n",
"srcPath",
":=",
"shared",
".",
"HostPath",
"(",
"m",
"[",
"\"",
"\"",
"]",
")",
"\n\n",
"// Check if read-only",
"isOptional",
":=",
"shared",
".",
"IsTrue",
"(",
"m",
"[",
"\"",
"\"",
"]",
")",
"\n",
"isReadOnly",
":=",
"shared",
".",
"IsTrue",
"(",
"m",
"[",
"\"",
"\"",
"]",
")",
"\n",
"isRecursive",
":=",
"shared",
".",
"IsTrue",
"(",
"m",
"[",
"\"",
"\"",
"]",
")",
"\n\n",
"isFile",
":=",
"false",
"\n",
"if",
"m",
"[",
"\"",
"\"",
"]",
"==",
"\"",
"\"",
"{",
"isFile",
"=",
"!",
"shared",
".",
"IsDir",
"(",
"srcPath",
")",
"&&",
"!",
"deviceIsBlockdev",
"(",
"srcPath",
")",
"\n",
"}",
"else",
"{",
"// Deal with mounting storage volumes created via the storage",
"// api. Extract the name of the storage volume that we are",
"// supposed to attach. We assume that the only syntactically",
"// valid ways of specifying a storage volume are:",
"// - <volume_name>",
"// - <type>/<volume_name>",
"// Currently, <type> must either be empty or \"custom\". We do not",
"// yet support container mounts.",
"if",
"filepath",
".",
"IsAbs",
"(",
"m",
"[",
"\"",
"\"",
"]",
")",
"{",
"return",
"\"",
"\"",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\\\"",
"\\\"",
"\\\"",
"\\\"",
"\"",
")",
"\n",
"}",
"\n\n",
"volumeTypeName",
":=",
"\"",
"\"",
"\n",
"volumeName",
":=",
"filepath",
".",
"Clean",
"(",
"m",
"[",
"\"",
"\"",
"]",
")",
"\n",
"slash",
":=",
"strings",
".",
"Index",
"(",
"volumeName",
",",
"\"",
"\"",
")",
"\n",
"if",
"(",
"slash",
">",
"0",
")",
"&&",
"(",
"len",
"(",
"volumeName",
")",
">",
"slash",
")",
"{",
"// Extract volume name.",
"volumeName",
"=",
"m",
"[",
"\"",
"\"",
"]",
"[",
"(",
"slash",
"+",
"1",
")",
":",
"]",
"\n",
"// Extract volume type.",
"volumeTypeName",
"=",
"m",
"[",
"\"",
"\"",
"]",
"[",
":",
"slash",
"]",
"\n",
"}",
"\n\n",
"switch",
"volumeTypeName",
"{",
"case",
"storagePoolVolumeTypeNameContainer",
":",
"return",
"\"",
"\"",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
")",
"\n",
"case",
"\"",
"\"",
":",
"// We simply received the name of a storage volume.",
"volumeTypeName",
"=",
"storagePoolVolumeTypeNameCustom",
"\n",
"fallthrough",
"\n",
"case",
"storagePoolVolumeTypeNameCustom",
":",
"srcPath",
"=",
"shared",
".",
"VarPath",
"(",
"\"",
"\"",
",",
"m",
"[",
"\"",
"\"",
"]",
",",
"volumeTypeName",
",",
"volumeName",
")",
"\n",
"case",
"storagePoolVolumeTypeNameImage",
":",
"return",
"\"",
"\"",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
")",
"\n",
"default",
":",
"return",
"\"",
"\"",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\\\"",
"\\\"",
"\"",
",",
"volumeTypeName",
")",
"\n",
"}",
"\n\n",
"// Initialize a new storage interface and check if the",
"// pool/volume is mounted. If it is not, mount it.",
"volumeType",
",",
"_",
":=",
"storagePoolVolumeTypeNameToType",
"(",
"volumeTypeName",
")",
"\n",
"s",
",",
"err",
":=",
"storagePoolVolumeAttachInit",
"(",
"c",
".",
"state",
",",
"m",
"[",
"\"",
"\"",
"]",
",",
"volumeName",
",",
"volumeType",
",",
"c",
")",
"\n",
"if",
"err",
"!=",
"nil",
"&&",
"!",
"isOptional",
"{",
"return",
"\"",
"\"",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\\\"",
"\\\"",
"\\\"",
"\\\"",
"\\\"",
"\\\"",
"\"",
",",
"volumeName",
",",
"volumeTypeName",
",",
"m",
"[",
"\"",
"\"",
"]",
",",
"err",
")",
"\n",
"}",
"else",
"if",
"err",
"==",
"nil",
"{",
"_",
",",
"err",
"=",
"s",
".",
"StoragePoolVolumeMount",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"msg",
":=",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\\\"",
"\\\"",
"\\\"",
"\\\"",
"\\\"",
"\\\"",
"\"",
",",
"volumeName",
",",
"volumeTypeName",
",",
"m",
"[",
"\"",
"\"",
"]",
",",
"err",
")",
"\n",
"if",
"!",
"isOptional",
"{",
"logger",
".",
"Errorf",
"(",
"msg",
")",
"\n",
"return",
"\"",
"\"",
",",
"err",
"\n",
"}",
"\n",
"logger",
".",
"Warnf",
"(",
"msg",
")",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n\n",
"// Check if the source exists",
"if",
"!",
"shared",
".",
"PathExists",
"(",
"srcPath",
")",
"{",
"if",
"isOptional",
"{",
"return",
"\"",
"\"",
",",
"nil",
"\n",
"}",
"\n",
"return",
"\"",
"\"",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"srcPath",
",",
"name",
")",
"\n",
"}",
"\n\n",
"// Create the devices directory if missing",
"if",
"!",
"shared",
".",
"PathExists",
"(",
"c",
".",
"DevicesPath",
"(",
")",
")",
"{",
"err",
":=",
"os",
".",
"Mkdir",
"(",
"c",
".",
"DevicesPath",
"(",
")",
",",
"0711",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"\"",
"\"",
",",
"err",
"\n",
"}",
"\n",
"}",
"\n\n",
"// Clean any existing entry",
"if",
"shared",
".",
"PathExists",
"(",
"devPath",
")",
"{",
"err",
":=",
"os",
".",
"Remove",
"(",
"devPath",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"\"",
"\"",
",",
"err",
"\n",
"}",
"\n",
"}",
"\n\n",
"// Create the mount point",
"if",
"isFile",
"{",
"f",
",",
"err",
":=",
"os",
".",
"Create",
"(",
"devPath",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"\"",
"\"",
",",
"err",
"\n",
"}",
"\n\n",
"f",
".",
"Close",
"(",
")",
"\n",
"}",
"else",
"{",
"err",
":=",
"os",
".",
"Mkdir",
"(",
"devPath",
",",
"0700",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"\"",
"\"",
",",
"err",
"\n",
"}",
"\n",
"}",
"\n\n",
"// Mount the fs",
"err",
":=",
"deviceMountDisk",
"(",
"srcPath",
",",
"devPath",
",",
"isReadOnly",
",",
"isRecursive",
",",
"m",
"[",
"\"",
"\"",
"]",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"\"",
"\"",
",",
"err",
"\n",
"}",
"\n\n",
"return",
"devPath",
",",
"nil",
"\n",
"}"
] |
3,045 | all-3046 | [
"GetMustShowErrors",
"returns",
"the",
"MustShowErrors",
"field",
"if",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"."
] | [
"func",
"(",
"w",
"*",
"Widget",
")",
"GetMustShowErrors",
"(",
")",
"bool",
"{",
"if",
"w",
"==",
"nil",
"||",
"w",
".",
"MustShowErrors",
"==",
"nil",
"{",
"return",
"<mask>",
"\n",
"}",
"\n",
"return",
"*",
"w",
".",
"MustShowErrors",
"\n",
"}"
] |
3,046 | all-3047 | [
"DelCookie",
"removes",
"cookie",
"under",
"the",
"given",
"key",
"from",
"response",
"header",
".",
"Note",
"that",
"DelCookie",
"doesn",
"t",
"remove",
"the",
"cookie",
"from",
"the",
"client",
".",
"Use",
"DelClientCookie",
"instead",
"."
] | [
"func",
"(",
"h",
"*",
"ResponseHeader",
")",
"DelCookie",
"(",
"key",
"string",
")",
"{",
"h",
".",
"cookies",
"=",
"delAllArgs",
"(",
"h",
".",
"cookies",
",",
"<mask>",
")",
"\n",
"}"
] |
3,047 | all-3048 | [
"GetPageWidth",
"()",
"is",
"a",
"wrapper",
"around",
"gtk_page_setup_get_page_width",
"()",
"."
] | [
"func",
"(",
"ps",
"*",
"PageSetup",
")",
"GetPageWidth",
"(",
"unit",
"Unit",
")",
"float64",
"{",
"c",
":=",
"C",
".",
"gtk_page_setup_get_page_width",
"(",
"<mask>",
".",
"native",
"(",
")",
",",
"C",
".",
"GtkUnit",
"(",
"unit",
")",
")",
"\n",
"return",
"float64",
"(",
"c",
")",
"\n",
"}"
] |
3,048 | all-3049 | [
"UnmarshalEasyJSON",
"satisfies",
"easyjson",
".",
"Unmarshaler",
"."
] | [
"func",
"(",
"t",
"*",
"ScreencastFormat",
")",
"UnmarshalEasyJSON",
"(",
"in",
"*",
"jlexer",
".",
"Lexer",
")",
"{",
"<mask>",
"ScreencastFormat",
"(",
"in",
".",
"String",
"(",
")",
")",
"{",
"case",
"ScreencastFormatJpeg",
":",
"*",
"t",
"=",
"ScreencastFormatJpeg",
"\n",
"case",
"ScreencastFormatPng",
":",
"*",
"t",
"=",
"ScreencastFormatPng",
"\n\n",
"default",
":",
"in",
".",
"AddError",
"(",
"errors",
".",
"New",
"(",
"\"",
"\"",
")",
")",
"\n",
"}",
"\n",
"}"
] |
3,049 | all-3050 | [
"Cancel",
"cancels",
"the",
"given",
"subscription",
"."
] | [
"func",
"(",
"s",
"*",
"PubSubSubscription",
")",
"Cancel",
"(",
")",
"<mask>",
"{",
"if",
"s",
".",
"resp",
".",
"Output",
"==",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n\n",
"return",
"s",
".",
"resp",
".",
"Output",
".",
"Close",
"(",
")",
"\n",
"}"
] |
3,050 | all-3051 | [
"Set",
"or",
"change",
"an",
"individual",
"key",
".",
"Empty",
"string",
"means",
"delete",
"this",
"value",
"and",
"effectively",
"revert",
"it",
"to",
"the",
"default",
".",
"Return",
"a",
"boolean",
"indicating",
"whether",
"the",
"value",
"has",
"changed",
"and",
"error",
"if",
"something",
"went",
"wrong",
"."
] | [
"func",
"(",
"m",
"*",
"Map",
")",
"<mask>",
"(",
"name",
"string",
",",
"value",
"string",
",",
"initial",
"bool",
")",
"(",
"bool",
",",
"error",
")",
"{",
"key",
",",
"ok",
":=",
"m",
".",
"schema",
"[",
"name",
"]",
"\n",
"if",
"!",
"ok",
"{",
"return",
"false",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"err",
":=",
"key",
".",
"validate",
"(",
"value",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"false",
",",
"err",
"\n",
"}",
"\n\n",
"// Normalize boolan values, so the comparison below works fine.",
"current",
":=",
"m",
".",
"GetRaw",
"(",
"name",
")",
"\n",
"if",
"key",
".",
"Type",
"==",
"Bool",
"{",
"value",
"=",
"normalizeBool",
"(",
"value",
")",
"\n",
"current",
"=",
"normalizeBool",
"(",
"current",
")",
"\n",
"}",
"\n\n",
"// Compare the new value with the current one, and return now if they",
"// are equal.",
"if",
"value",
"==",
"current",
"{",
"return",
"false",
",",
"nil",
"\n",
"}",
"\n\n",
"// Trigger the Setter if this is not an initial load and the key's",
"// schema has declared it.",
"if",
"!",
"initial",
"&&",
"key",
".",
"Setter",
"!=",
"nil",
"{",
"value",
",",
"err",
"=",
"key",
".",
"Setter",
"(",
"value",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"false",
",",
"err",
"\n",
"}",
"\n",
"}",
"\n\n",
"if",
"value",
"==",
"\"",
"\"",
"{",
"delete",
"(",
"m",
".",
"values",
",",
"name",
")",
"\n",
"}",
"else",
"{",
"m",
".",
"values",
"[",
"name",
"]",
"=",
"value",
"\n",
"}",
"\n\n",
"return",
"true",
",",
"nil",
"\n",
"}"
] |
3,051 | all-3052 | [
"Done",
"is",
"called",
"on",
"a",
"completed",
"request"
] | [
"func",
"(",
"NopTracer",
")",
"Done",
"(",
"re",
"*",
"Response",
",",
"err",
"error",
")",
"(",
"*",
"<mask>",
",",
"error",
")",
"{",
"return",
"re",
",",
"err",
"\n",
"}"
] |
3,052 | all-3053 | [
"Warn",
"logging"
] | [
"func",
"(",
"l",
"*",
"StdLevelLogger",
")",
"Warn",
"(",
"args",
"...",
"<mask>",
"{",
"}",
")",
"{",
"l",
".",
"logFunc",
"(",
"WarnLevel",
",",
"l",
".",
"context",
",",
"args",
"...",
")",
"\n",
"}"
] |
3,053 | all-3054 | [
"Screenshot",
"takes",
"a",
"screenshot",
"and",
"saves",
"it",
"to",
"the",
"provided",
"filename",
".",
"The",
"provided",
"filename",
"may",
"be",
"an",
"absolute",
"or",
"relative",
"path",
"."
] | [
"func",
"(",
"p",
"*",
"Page",
")",
"Screenshot",
"(",
"<mask>",
"string",
")",
"error",
"{",
"absFilePath",
",",
"err",
":=",
"filepath",
".",
"Abs",
"(",
"filename",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"}",
"\n\n",
"screenshot",
",",
"err",
":=",
"p",
".",
"session",
".",
"GetScreenshot",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"}",
"\n\n",
"if",
"err",
":=",
"ioutil",
".",
"WriteFile",
"(",
"absFilePath",
",",
"screenshot",
",",
"0666",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"}",
"\n\n",
"return",
"nil",
"\n",
"}"
] |
3,054 | all-3055 | [
"makeTrustedSubnetsSlice",
"makes",
"a",
"human",
"-",
"readable",
"copy",
"of",
"the",
"trustedSubnets",
"."
] | [
"func",
"makeTrustedSubnetsSlice",
"(",
"trustedSubnets",
"[",
"]",
"*",
"net",
".",
"IPNet",
")",
"[",
"]",
"string",
"{",
"trustedSubnetStrs",
":=",
"[",
"]",
"string",
"{",
"}",
"\n",
"for",
"_",
",",
"trustedSubnet",
":=",
"<mask>",
"trustedSubnets",
"{",
"trustedSubnetStrs",
"=",
"append",
"(",
"trustedSubnetStrs",
",",
"trustedSubnet",
".",
"String",
"(",
")",
")",
"\n",
"}",
"\n",
"return",
"trustedSubnetStrs",
"\n",
"}"
] |
3,055 | all-3056 | [
"Left",
"returns",
"the",
"left",
"substring",
"of",
"length",
"n",
"."
] | [
"func",
"Left",
"(",
"s",
"<mask>",
",",
"n",
"int",
")",
"string",
"{",
"if",
"n",
"<",
"0",
"{",
"return",
"Right",
"(",
"s",
",",
"-",
"n",
")",
"\n",
"}",
"\n",
"return",
"Substr",
"(",
"s",
",",
"0",
",",
"n",
")",
"\n",
"}"
] |
3,056 | all-3057 | [
"GetGeometry",
"is",
"a",
"wrapper",
"around",
"gdk_monitor_get_geometry",
"()",
"."
] | [
"func",
"(",
"v",
"*",
"Monitor",
")",
"GetGeometry",
"(",
")",
"*",
"Rectangle",
"{",
"<mask>",
"rect",
"C",
".",
"GdkRectangle",
"\n\n",
"C",
".",
"gdk_monitor_get_geometry",
"(",
"v",
".",
"native",
"(",
")",
",",
"&",
"rect",
")",
"\n\n",
"return",
"WrapRectangle",
"(",
"uintptr",
"(",
"unsafe",
".",
"Pointer",
"(",
"&",
"rect",
")",
")",
")",
"\n",
"}"
] |
3,057 | all-3058 | [
"MarshalJSON",
"supports",
"json",
".",
"Marshaler",
"interface"
] | [
"func",
"(",
"v",
"GetAllCookiesParams",
")",
"MarshalJSON",
"(",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"w",
":=",
"jwriter",
".",
"<mask>",
"{",
"}",
"\n",
"easyjsonC5a4559bEncodeGithubComChromedpCdprotoNetwork39",
"(",
"&",
"w",
",",
"v",
")",
"\n",
"return",
"w",
".",
"Buffer",
".",
"BuildBytes",
"(",
")",
",",
"w",
".",
"Error",
"\n",
"}"
] |
3,058 | all-3059 | [
"AddTag",
"adds",
"a",
"key",
"-",
"value",
"pair",
"to",
"be",
"sent",
"to",
"the",
"CPI",
"for",
"VM",
"tagging",
".",
"This",
"feature",
"is",
"available",
"in",
"bosh",
"release",
"v258",
"+",
".",
"https",
":",
"//",
"bosh",
".",
"io",
"/",
"docs",
"/",
"manifest",
"-",
"v2",
".",
"html#tags"
] | [
"func",
"(",
"s",
"*",
"DeploymentManifest",
")",
"AddTag",
"(",
"key",
",",
"value",
"string",
")",
"{",
"if",
"s",
".",
"Tags",
"==",
"nil",
"{",
"s",
".",
"Tags",
"=",
"<mask>",
"(",
"map",
"[",
"string",
"]",
"string",
")",
"\n",
"}",
"\n",
"s",
".",
"Tags",
"[",
"key",
"]",
"=",
"value",
"\n",
"}"
] |
3,059 | all-3060 | [
"UnmarshalJSON",
"supports",
"json",
".",
"Unmarshaler",
"interface"
] | [
"func",
"(",
"v",
"*",
"GetTargetsParams",
")",
"UnmarshalJSON",
"(",
"data",
"[",
"]",
"<mask>",
")",
"error",
"{",
"r",
":=",
"jlexer",
".",
"Lexer",
"{",
"Data",
":",
"data",
"}",
"\n",
"easyjsonC5a4559bDecodeGithubComChromedpCdprotoTarget7",
"(",
"&",
"r",
",",
"v",
")",
"\n",
"return",
"r",
".",
"Error",
"(",
")",
"\n",
"}"
] |
3,060 | all-3061 | [
"SanitizerEnabled",
"will",
"enable",
"the",
"input",
"sanitizer",
"which",
"passes",
"the",
"URL",
"path",
"through",
"a",
"strict",
"whitelist",
"."
] | [
"func",
"SanitizerEnabled",
"(",
"sanitizerEnabled",
"bool",
")",
"ClientParam",
"{",
"return",
"func",
"(",
"c",
"*",
"<mask>",
")",
"error",
"{",
"c",
".",
"sanitizerEnabled",
"=",
"sanitizerEnabled",
"\n",
"return",
"nil",
"\n",
"}",
"\n",
"}"
] |
3,061 | all-3062 | [
"reduceUncommittedSize",
"accounts",
"for",
"the",
"newly",
"committed",
"entries",
"by",
"decreasing",
"the",
"uncommitted",
"entry",
"size",
"limit",
"."
] | [
"func",
"(",
"r",
"*",
"raft",
")",
"reduceUncommittedSize",
"(",
"ents",
"[",
"]",
"pb",
".",
"<mask>",
")",
"{",
"if",
"r",
".",
"uncommittedSize",
"==",
"0",
"{",
"// Fast-path for followers, who do not track or enforce the limit.",
"return",
"\n",
"}",
"\n\n",
"var",
"s",
"uint64",
"\n",
"for",
"_",
",",
"e",
":=",
"range",
"ents",
"{",
"s",
"+=",
"uint64",
"(",
"PayloadSize",
"(",
"e",
")",
")",
"\n",
"}",
"\n",
"if",
"s",
">",
"r",
".",
"uncommittedSize",
"{",
"// uncommittedSize may underestimate the size of the uncommitted Raft",
"// log tail but will never overestimate it. Saturate at 0 instead of",
"// allowing overflow.",
"r",
".",
"uncommittedSize",
"=",
"0",
"\n",
"}",
"else",
"{",
"r",
".",
"uncommittedSize",
"-=",
"s",
"\n",
"}",
"\n",
"}"
] |
3,062 | all-3063 | [
"GatherInfo",
"gathers",
"information",
"about",
"the",
"specified",
"struct"
] | [
"func",
"gatherInfo",
"(",
"prefix",
"string",
",",
"spec",
"interface",
"{",
"}",
")",
"(",
"[",
"]",
"varInfo",
",",
"error",
")",
"{",
"s",
":=",
"reflect",
".",
"ValueOf",
"(",
"spec",
")",
"\n\n",
"if",
"s",
".",
"Kind",
"(",
")",
"!=",
"reflect",
".",
"Ptr",
"{",
"return",
"nil",
",",
"ErrInvalidSpecification",
"\n",
"}",
"\n",
"s",
"=",
"s",
".",
"Elem",
"(",
")",
"\n",
"if",
"s",
".",
"Kind",
"(",
")",
"!=",
"reflect",
".",
"Struct",
"{",
"return",
"nil",
",",
"ErrInvalidSpecification",
"\n",
"}",
"\n",
"typeOfSpec",
":=",
"s",
".",
"Type",
"(",
")",
"\n\n",
"// over allocate an info array, we will extend if needed later",
"infos",
":=",
"make",
"(",
"[",
"]",
"varInfo",
",",
"0",
",",
"s",
".",
"NumField",
"(",
")",
")",
"\n",
"for",
"i",
":=",
"0",
";",
"i",
"<",
"s",
".",
"NumField",
"(",
")",
";",
"i",
"++",
"{",
"f",
":=",
"s",
".",
"Field",
"(",
"i",
")",
"\n",
"ftype",
":=",
"typeOfSpec",
".",
"Field",
"(",
"i",
")",
"\n",
"if",
"!",
"f",
".",
"CanSet",
"(",
")",
"||",
"isTrue",
"(",
"ftype",
".",
"Tag",
".",
"Get",
"(",
"\"",
"\"",
")",
")",
"{",
"continue",
"\n",
"}",
"\n\n",
"for",
"f",
".",
"Kind",
"(",
")",
"==",
"reflect",
".",
"Ptr",
"{",
"if",
"f",
".",
"IsNil",
"(",
")",
"{",
"if",
"f",
".",
"Type",
"(",
")",
".",
"Elem",
"(",
")",
".",
"Kind",
"(",
")",
"!=",
"reflect",
".",
"Struct",
"{",
"// nil pointer to a non-struct: leave it alone",
"break",
"\n",
"}",
"\n",
"// nil pointer to struct: create a zero instance",
"f",
".",
"Set",
"(",
"reflect",
".",
"New",
"(",
"f",
".",
"Type",
"(",
")",
".",
"Elem",
"(",
")",
")",
")",
"\n",
"}",
"\n",
"f",
"=",
"f",
".",
"Elem",
"(",
")",
"\n",
"}",
"\n\n",
"// Capture information about the config variable",
"info",
":=",
"varInfo",
"{",
"Name",
":",
"ftype",
".",
"Name",
",",
"Field",
":",
"f",
",",
"Tags",
":",
"ftype",
".",
"Tag",
",",
"Alt",
":",
"strings",
".",
"ToUpper",
"(",
"ftype",
".",
"Tag",
".",
"Get",
"(",
"\"",
"\"",
")",
")",
",",
"}",
"\n\n",
"// Default to the field name as the env var name (will be upcased)",
"<mask>",
".",
"Key",
"=",
"info",
".",
"Name",
"\n\n",
"// Best effort to un-pick camel casing as separate words",
"if",
"isTrue",
"(",
"ftype",
".",
"Tag",
".",
"Get",
"(",
"\"",
"\"",
")",
")",
"{",
"words",
":=",
"gatherRegexp",
".",
"FindAllStringSubmatch",
"(",
"ftype",
".",
"Name",
",",
"-",
"1",
")",
"\n",
"if",
"len",
"(",
"words",
")",
">",
"0",
"{",
"var",
"name",
"[",
"]",
"string",
"\n",
"for",
"_",
",",
"words",
":=",
"range",
"words",
"{",
"name",
"=",
"append",
"(",
"name",
",",
"words",
"[",
"0",
"]",
")",
"\n",
"}",
"\n\n",
"info",
".",
"Key",
"=",
"strings",
".",
"Join",
"(",
"name",
",",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"}",
"\n",
"if",
"info",
".",
"Alt",
"!=",
"\"",
"\"",
"{",
"info",
".",
"Key",
"=",
"info",
".",
"Alt",
"\n",
"}",
"\n",
"if",
"prefix",
"!=",
"\"",
"\"",
"{",
"info",
".",
"Key",
"=",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"prefix",
",",
"info",
".",
"Key",
")",
"\n",
"}",
"\n",
"info",
".",
"Key",
"=",
"strings",
".",
"ToUpper",
"(",
"info",
".",
"Key",
")",
"\n",
"infos",
"=",
"append",
"(",
"infos",
",",
"info",
")",
"\n\n",
"if",
"f",
".",
"Kind",
"(",
")",
"==",
"reflect",
".",
"Struct",
"{",
"// honor Decode if present",
"if",
"decoderFrom",
"(",
"f",
")",
"==",
"nil",
"&&",
"setterFrom",
"(",
"f",
")",
"==",
"nil",
"&&",
"textUnmarshaler",
"(",
"f",
")",
"==",
"nil",
"&&",
"binaryUnmarshaler",
"(",
"f",
")",
"==",
"nil",
"{",
"innerPrefix",
":=",
"prefix",
"\n",
"if",
"!",
"ftype",
".",
"Anonymous",
"{",
"innerPrefix",
"=",
"info",
".",
"Key",
"\n",
"}",
"\n\n",
"embeddedPtr",
":=",
"f",
".",
"Addr",
"(",
")",
".",
"Interface",
"(",
")",
"\n",
"embeddedInfos",
",",
"err",
":=",
"gatherInfo",
"(",
"innerPrefix",
",",
"embeddedPtr",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"infos",
"=",
"append",
"(",
"infos",
"[",
":",
"len",
"(",
"infos",
")",
"-",
"1",
"]",
",",
"embeddedInfos",
"...",
")",
"\n\n",
"continue",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"infos",
",",
"nil",
"\n",
"}"
] |
3,063 | all-3064 | [
"getPath",
"gets",
"the",
"path",
"of",
"the",
"auth",
".",
"json",
"file",
"The",
"path",
"can",
"be",
"overriden",
"by",
"the",
"user",
"if",
"the",
"overwrite",
"-",
"path",
"flag",
"is",
"set",
"If",
"the",
"flag",
"is",
"not",
"set",
"and",
"XDG_RUNTIME_DIR",
"is",
"set",
"the",
"auth",
".",
"json",
"file",
"is",
"saved",
"in",
"XDG_RUNTIME_DIR",
"/",
"containers",
"Otherwise",
"the",
"auth",
".",
"json",
"file",
"is",
"stored",
"in",
"/",
"run",
"/",
"containers",
"/",
"UID"
] | [
"func",
"getPathToAuth",
"(",
"sys",
"*",
"types",
".",
"SystemContext",
")",
"(",
"string",
",",
"error",
")",
"{",
"if",
"sys",
"!=",
"nil",
"{",
"if",
"sys",
".",
"AuthFilePath",
"!=",
"\"",
"\"",
"{",
"return",
"sys",
".",
"AuthFilePath",
",",
"nil",
"\n",
"}",
"\n",
"if",
"sys",
".",
"RootForImplicitAbsolutePaths",
"!=",
"\"",
"\"",
"{",
"return",
"filepath",
".",
"Join",
"(",
"sys",
".",
"RootForImplicitAbsolutePaths",
",",
"fmt",
".",
"Sprintf",
"(",
"defaultPerUIDPathFormat",
",",
"os",
".",
"Getuid",
"(",
")",
")",
")",
",",
"nil",
"\n",
"}",
"\n",
"}",
"\n\n",
"runtimeDir",
":=",
"os",
".",
"Getenv",
"(",
"\"",
"\"",
")",
"\n",
"if",
"runtimeDir",
"!=",
"\"",
"\"",
"{",
"// This function does not in general need to separately check that the returned path exists; that’s racy, and callers will fail accessing the file anyway.",
"// We are checking for os.IsNotExist here only to give the user better guidance what to do in this special case.",
"_",
",",
"err",
":=",
"os",
".",
"Stat",
"(",
"runtimeDir",
")",
"\n",
"if",
"<mask>",
".",
"IsNotExist",
"(",
"err",
")",
"{",
"// This means the user set the XDG_RUNTIME_DIR variable and either forgot to create the directory",
"// or made a typo while setting the environment variable,",
"// so return an error referring to $XDG_RUNTIME_DIR instead of xdgRuntimeDirPath inside.",
"return",
"\"",
"\"",
",",
"errors",
".",
"Wrapf",
"(",
"err",
",",
"\"",
"\"",
",",
"runtimeDir",
")",
"\n",
"}",
"// else ignore err and let the caller fail accessing xdgRuntimeDirPath.",
"\n",
"return",
"filepath",
".",
"Join",
"(",
"runtimeDir",
",",
"xdgRuntimeDirPath",
")",
",",
"nil",
"\n",
"}",
"\n",
"return",
"fmt",
".",
"Sprintf",
"(",
"defaultPerUIDPathFormat",
",",
"os",
".",
"Getuid",
"(",
")",
")",
",",
"nil",
"\n",
"}"
] |
3,064 | all-3065 | [
"native",
"returns",
"a",
"pointer",
"to",
"the",
"underlying",
"GtkFrame",
"."
] | [
"func",
"(",
"v",
"*",
"Frame",
")",
"native",
"(",
")",
"*",
"C",
".",
"GtkFrame",
"{",
"if",
"v",
"==",
"nil",
"||",
"v",
".",
"GObject",
"==",
"nil",
"{",
"<mask>",
"nil",
"\n",
"}",
"\n",
"p",
":=",
"unsafe",
".",
"Pointer",
"(",
"v",
".",
"GObject",
")",
"\n",
"return",
"C",
".",
"toGtkFrame",
"(",
"p",
")",
"\n",
"}"
] |
3,065 | all-3066 | [
"GetId",
"returns",
"the",
"Id",
"field",
"if",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"."
] | [
"func",
"(",
"d",
"*",
"DashboardLite",
")",
"GetId",
"(",
")",
"int",
"{",
"if",
"d",
"==",
"nil",
"||",
"d",
".",
"Id",
"==",
"nil",
"{",
"return",
"0",
"\n",
"}",
"\n",
"return",
"*",
"d",
".",
"<mask>",
"\n",
"}"
] |
3,066 | all-3067 | [
"map",
"all",
"of",
"a",
"buffer",
"object",
"s",
"data",
"store",
"into",
"the",
"client",
"s",
"address",
"space"
] | [
"func",
"MapNamedBuffer",
"(",
"buffer",
"uint32",
",",
"access",
"uint32",
")",
"unsafe",
".",
"Pointer",
"{",
"<mask>",
":=",
"C",
".",
"glowMapNamedBuffer",
"(",
"gpMapNamedBuffer",
",",
"(",
"C",
".",
"GLuint",
")",
"(",
"buffer",
")",
",",
"(",
"C",
".",
"GLenum",
")",
"(",
"access",
")",
")",
"\n",
"return",
"(",
"unsafe",
".",
"Pointer",
")",
"(",
"ret",
")",
"\n",
"}"
] |
3,067 | all-3068 | [
"imagePullRequired",
"returns",
"true",
"if",
"pulling",
"image",
"is",
"required",
"or",
"return",
"false",
"if",
"local",
"image",
"cache",
"should",
"be",
"used",
"by",
"inspecting",
"the",
"agent",
"pull",
"behavior",
"variable",
"defined",
"in",
"config",
".",
"The",
"caller",
"has",
"to",
"make",
"sure",
"the",
"container",
"passed",
"in",
"is",
"not",
"an",
"internal",
"container",
"."
] | [
"func",
"(",
"engine",
"*",
"DockerTaskEngine",
")",
"imagePullRequired",
"(",
"imagePullBehavior",
"config",
".",
"ImagePullBehaviorType",
",",
"container",
"*",
"apicontainer",
".",
"Container",
",",
"taskArn",
"string",
")",
"bool",
"{",
"switch",
"imagePullBehavior",
"{",
"case",
"config",
".",
"ImagePullOnceBehavior",
":",
"// If this image has been pulled successfully before, don't pull the image,",
"// otherwise pull the image as usual, regardless whether the image exists or not",
"// (the image can be prepopulated with the AMI and never be pulled).",
"imageState",
",",
"ok",
":=",
"engine",
".",
"imageManager",
".",
"GetImageStateFromImageName",
"(",
"container",
".",
"Image",
")",
"\n",
"if",
"ok",
"&&",
"imageState",
".",
"GetPullSucceeded",
"(",
")",
"{",
"seelog",
".",
"Infof",
"(",
"\"",
"\"",
",",
"taskArn",
",",
"container",
".",
"Image",
",",
"container",
".",
"Name",
")",
"\n",
"return",
"false",
"\n",
"}",
"\n",
"return",
"true",
"\n",
"case",
"config",
".",
"ImagePullPreferCachedBehavior",
":",
"// If the behavior is prefer cached, don't pull if we found cached image",
"// by inspecting the image.",
"_",
",",
"err",
":=",
"engine",
".",
"client",
".",
"InspectImage",
"(",
"container",
".",
"Image",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"true",
"\n",
"}",
"\n",
"seelog",
".",
"Infof",
"(",
"\"",
"\"",
",",
"taskArn",
",",
"container",
".",
"<mask>",
",",
"container",
".",
"Name",
")",
"\n",
"return",
"false",
"\n",
"default",
":",
"// Need to pull the image for always and default agent pull behavior",
"return",
"true",
"\n",
"}",
"\n",
"}"
] |
3,068 | all-3069 | [
"Copy",
"returns",
"a",
"deep",
"copy",
"of",
"this",
"configuration",
"."
] | [
"func",
"(",
"c",
"*",
"DedupConfig",
")",
"Copy",
"(",
")",
"*",
"DedupConfig",
"{",
"if",
"c",
"==",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n\n",
"<mask>",
"o",
"DedupConfig",
"\n",
"o",
".",
"Enabled",
"=",
"c",
".",
"Enabled",
"\n",
"o",
".",
"MaxStale",
"=",
"c",
".",
"MaxStale",
"\n",
"o",
".",
"Prefix",
"=",
"c",
".",
"Prefix",
"\n",
"o",
".",
"TTL",
"=",
"c",
".",
"TTL",
"\n",
"return",
"&",
"o",
"\n",
"}"
] |
3,069 | all-3070 | [
"aggregateContainersBy",
"aggregates",
"and",
"counts",
"how",
"many",
"containers",
"exist",
"each",
"node",
"that",
"matches",
"received",
"filters"
] | [
"func",
"(",
"s",
"*",
"segregatedScheduler",
")",
"aggregateContainersBy",
"(",
"matcher",
"bson",
".",
"M",
")",
"(",
"map",
"[",
"string",
"]",
"int",
",",
"error",
")",
"{",
"coll",
":=",
"s",
".",
"provisioner",
".",
"Collection",
"(",
")",
"\n",
"defer",
"coll",
".",
"Close",
"(",
")",
"\n",
"<mask>",
":=",
"coll",
".",
"Pipe",
"(",
"[",
"]",
"bson",
".",
"M",
"{",
"matcher",
",",
"{",
"\"",
"\"",
":",
"bson",
".",
"M",
"{",
"\"",
"\"",
":",
"\"",
"\"",
",",
"\"",
"\"",
":",
"bson",
".",
"M",
"{",
"\"",
"\"",
":",
"1",
"}",
"}",
"}",
",",
"}",
")",
"\n",
"var",
"results",
"[",
"]",
"nodeAggregate",
"\n",
"err",
":=",
"pipe",
".",
"All",
"(",
"&",
"results",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"countMap",
":=",
"make",
"(",
"map",
"[",
"string",
"]",
"int",
")",
"\n",
"for",
"_",
",",
"result",
":=",
"range",
"results",
"{",
"countMap",
"[",
"result",
".",
"HostAddr",
"]",
"=",
"result",
".",
"Count",
"\n",
"}",
"\n",
"return",
"countMap",
",",
"nil",
"\n",
"}"
] |
3,070 | all-3071 | [
"title",
":",
"remove",
"key",
"path",
":",
"/",
"users",
"/",
"keys",
"/",
"{",
"key",
"}",
"method",
":",
"DELETE",
"responses",
":",
"200",
":",
"Ok",
"400",
":",
"Invalid",
"data",
"401",
":",
"Unauthorized",
"404",
":",
"Not",
"found"
] | [
"func",
"removeKeyFromUser",
"(",
"w",
"http",
".",
"ResponseWriter",
",",
"r",
"*",
"http",
".",
"Request",
",",
"t",
"auth",
".",
"Token",
")",
"(",
"err",
"error",
")",
"{",
"key",
":=",
"repository",
".",
"Key",
"{",
"<mask>",
":",
"r",
".",
"URL",
".",
"Query",
"(",
")",
".",
"Get",
"(",
"\"",
"\"",
")",
",",
"}",
"\n",
"if",
"key",
".",
"Name",
"==",
"\"",
"\"",
"{",
"return",
"&",
"errors",
".",
"HTTP",
"{",
"Code",
":",
"http",
".",
"StatusBadRequest",
",",
"Message",
":",
"\"",
"\"",
"}",
"\n",
"}",
"\n",
"allowed",
":=",
"permission",
".",
"Check",
"(",
"t",
",",
"permission",
".",
"PermUserUpdateKeyRemove",
",",
"permission",
".",
"Context",
"(",
"permTypes",
".",
"CtxUser",
",",
"t",
".",
"GetUserName",
"(",
")",
")",
",",
")",
"\n",
"if",
"!",
"allowed",
"{",
"return",
"permission",
".",
"ErrUnauthorized",
"\n",
"}",
"\n",
"evt",
",",
"err",
":=",
"event",
".",
"New",
"(",
"&",
"event",
".",
"Opts",
"{",
"Target",
":",
"userTarget",
"(",
"t",
".",
"GetUserName",
"(",
")",
")",
",",
"Kind",
":",
"permission",
".",
"PermUserUpdateKeyRemove",
",",
"Owner",
":",
"t",
",",
"CustomData",
":",
"event",
".",
"FormToCustomData",
"(",
"InputFields",
"(",
"r",
")",
")",
",",
"Allowed",
":",
"event",
".",
"Allowed",
"(",
"permission",
".",
"PermUserReadEvents",
",",
"permission",
".",
"Context",
"(",
"permTypes",
".",
"CtxUser",
",",
"t",
".",
"GetUserName",
"(",
")",
")",
")",
",",
"}",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"defer",
"func",
"(",
")",
"{",
"evt",
".",
"Done",
"(",
"err",
")",
"}",
"(",
")",
"\n",
"u",
",",
"err",
":=",
"auth",
".",
"ConvertNewUser",
"(",
"t",
".",
"User",
"(",
")",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"err",
"=",
"u",
".",
"RemoveKey",
"(",
"key",
")",
"\n",
"if",
"err",
"==",
"authTypes",
".",
"ErrKeyDisabled",
"{",
"return",
"&",
"errors",
".",
"HTTP",
"{",
"Code",
":",
"http",
".",
"StatusBadRequest",
",",
"Message",
":",
"err",
".",
"Error",
"(",
")",
"}",
"\n",
"}",
"\n",
"if",
"err",
"==",
"repository",
".",
"ErrKeyNotFound",
"{",
"return",
"&",
"errors",
".",
"HTTP",
"{",
"Code",
":",
"http",
".",
"StatusNotFound",
",",
"Message",
":",
"\"",
"\"",
"}",
"\n",
"}",
"\n",
"return",
"err",
"\n",
"}"
] |
3,071 | all-3072 | [
"Init",
"prepares",
"ctx",
"for",
"passing",
"to",
"RequestHandler",
".",
"remoteAddr",
"and",
"logger",
"are",
"optional",
".",
"They",
"are",
"used",
"by",
"RequestCtx",
".",
"Logger",
"()",
".",
"This",
"function",
"is",
"intended",
"for",
"custom",
"Server",
"implementations",
"."
] | [
"func",
"(",
"ctx",
"*",
"RequestCtx",
")",
"Init",
"(",
"req",
"*",
"Request",
",",
"remoteAddr",
"<mask>",
".",
"Addr",
",",
"logger",
"Logger",
")",
"{",
"if",
"remoteAddr",
"==",
"nil",
"{",
"remoteAddr",
"=",
"zeroTCPAddr",
"\n",
"}",
"\n",
"c",
":=",
"&",
"fakeAddrer",
"{",
"laddr",
":",
"zeroTCPAddr",
",",
"raddr",
":",
"remoteAddr",
",",
"}",
"\n",
"if",
"logger",
"==",
"nil",
"{",
"logger",
"=",
"defaultLogger",
"\n",
"}",
"\n",
"ctx",
".",
"Init2",
"(",
"c",
",",
"logger",
",",
"true",
")",
"\n",
"req",
".",
"CopyTo",
"(",
"&",
"ctx",
".",
"Request",
")",
"\n",
"}"
] |
3,072 | all-3073 | [
"title",
":",
"token",
"create",
"path",
":",
"/",
"tokens",
"method",
":",
"POST",
"produce",
":",
"application",
"/",
"json",
"responses",
":",
"201",
":",
"Token",
"created",
"401",
":",
"Unauthorized",
"409",
":",
"Token",
"already",
"exists"
] | [
"func",
"tokenCreate",
"(",
"w",
"http",
".",
"ResponseWriter",
",",
"r",
"*",
"http",
".",
"Request",
",",
"t",
"auth",
".",
"Token",
")",
"(",
"err",
"error",
")",
"{",
"var",
"args",
"authTypes",
".",
"TeamTokenCreateArgs",
"\n",
"err",
"=",
"ParseInput",
"(",
"r",
",",
"&",
"args",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"if",
"args",
".",
"Team",
"==",
"\"",
"\"",
"{",
"args",
".",
"Team",
",",
"err",
"=",
"autoTeamOwner",
"(",
"t",
",",
"permission",
".",
"PermTeamTokenCreate",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"}",
"\n",
"allowed",
":=",
"permission",
".",
"Check",
"(",
"t",
",",
"permission",
".",
"PermTeamTokenCreate",
",",
"permission",
".",
"Context",
"(",
"permTypes",
".",
"CtxTeam",
",",
"args",
".",
"Team",
")",
",",
")",
"\n",
"if",
"!",
"allowed",
"{",
"return",
"permission",
".",
"ErrUnauthorized",
"\n",
"}",
"\n",
"evt",
",",
"err",
":=",
"event",
".",
"New",
"(",
"&",
"event",
".",
"Opts",
"{",
"Target",
":",
"teamTarget",
"(",
"args",
".",
"Team",
")",
",",
"Kind",
":",
"permission",
".",
"PermTeamTokenCreate",
",",
"Owner",
":",
"t",
",",
"CustomData",
":",
"event",
".",
"FormToCustomData",
"(",
"InputFields",
"(",
"r",
")",
")",
",",
"Allowed",
":",
"event",
".",
"Allowed",
"(",
"permission",
".",
"PermTeamReadEvents",
",",
"permission",
".",
"Context",
"(",
"permTypes",
".",
"CtxTeam",
",",
"args",
".",
"Team",
")",
")",
",",
"}",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"defer",
"func",
"(",
")",
"{",
"evt",
".",
"Done",
"(",
"err",
")",
"}",
"(",
")",
"\n",
"token",
",",
"err",
":=",
"servicemanager",
".",
"TeamToken",
".",
"Create",
"(",
"args",
",",
"t",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"if",
"err",
"==",
"authTypes",
".",
"ErrTeamTokenAlreadyExists",
"{",
"return",
"&",
"errors",
".",
"HTTP",
"{",
"Code",
":",
"<mask>",
".",
"StatusConflict",
",",
"Message",
":",
"err",
".",
"Error",
"(",
")",
",",
"}",
"\n",
"}",
"\n",
"return",
"err",
"\n",
"}",
"\n",
"w",
".",
"WriteHeader",
"(",
"http",
".",
"StatusCreated",
")",
"\n",
"return",
"json",
".",
"NewEncoder",
"(",
"w",
")",
".",
"Encode",
"(",
"token",
")",
"\n",
"}"
] |
3,073 | all-3074 | [
"GetDashboardOk",
"returns",
"a",
"tuple",
"with",
"the",
"Dashboard",
"field",
"if",
"it",
"s",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"and",
"a",
"boolean",
"to",
"check",
"if",
"the",
"value",
"has",
"been",
"set",
"."
] | [
"func",
"(",
"r",
"*",
"reqGetDashboard",
")",
"GetDashboardOk",
"(",
")",
"(",
"Dashboard",
",",
"bool",
")",
"{",
"if",
"r",
"==",
"nil",
"||",
"r",
".",
"Dashboard",
"==",
"nil",
"{",
"return",
"Dashboard",
"{",
"}",
",",
"false",
"\n",
"}",
"\n",
"return",
"*",
"r",
".",
"Dashboard",
",",
"<mask>",
"\n",
"}"
] |
3,074 | all-3075 | [
"FetchChecks",
"retrieves",
"all",
"checks",
"available",
"to",
"the",
"API",
"Token",
"."
] | [
"func",
"(",
"a",
"*",
"API",
")",
"FetchChecks",
"(",
")",
"(",
"*",
"[",
"]",
"Check",
",",
"error",
")",
"{",
"<mask>",
",",
"err",
":=",
"a",
".",
"Get",
"(",
"config",
".",
"CheckPrefix",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"var",
"checks",
"[",
"]",
"Check",
"\n",
"if",
"err",
":=",
"json",
".",
"Unmarshal",
"(",
"result",
",",
"&",
"checks",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"return",
"&",
"checks",
",",
"nil",
"\n",
"}"
] |
3,075 | all-3076 | [
"GetJobsForProject",
"returns",
"the",
"full",
"job",
"details",
"of",
"the",
"jobs",
"belonging",
"to",
"the",
"named",
"project",
"."
] | [
"func",
"(",
"c",
"*",
"Client",
")",
"GetJobsForProject",
"(",
"projectName",
"string",
")",
"(",
"[",
"]",
"JobDetail",
",",
"error",
")",
"{",
"jobList",
":=",
"&",
"jobDetailList",
"{",
"}",
"\n",
"err",
":=",
"c",
".",
"<mask>",
"(",
"[",
"]",
"string",
"{",
"\"",
"\"",
",",
"\"",
"\"",
"}",
",",
"map",
"[",
"string",
"]",
"string",
"{",
"\"",
"\"",
":",
"projectName",
"}",
",",
"jobList",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"return",
"jobList",
".",
"Jobs",
",",
"nil",
"\n",
"}"
] |
3,076 | all-3077 | [
"Capitalize",
"all",
"Y",
"s",
"preceded",
"by",
"vowels",
"or",
"starting",
"a",
"word"
] | [
"func",
"capitalizeYs",
"(",
"word",
"*",
"snowballword",
".",
"SnowballWord",
")",
"(",
"numCapitalizations",
"int",
")",
"{",
"for",
"i",
",",
"r",
":=",
"<mask>",
"word",
".",
"RS",
"{",
"// (Note: Y & y unicode code points = 89 & 121)",
"if",
"r",
"==",
"121",
"&&",
"(",
"i",
"==",
"0",
"||",
"isLowerVowel",
"(",
"word",
".",
"RS",
"[",
"i",
"-",
"1",
"]",
")",
")",
"{",
"word",
".",
"RS",
"[",
"i",
"]",
"=",
"89",
"\n",
"numCapitalizations",
"+=",
"1",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"\n",
"}"
] |
3,077 | all-3078 | [
"With",
"returns",
"a",
"new",
"list",
"with",
"keyvals",
"appended",
".",
"The",
"original",
"list",
"(",
"l",
")",
"is",
"not",
"modified",
"."
] | [
"func",
"(",
"l",
"List",
")",
"With",
"(",
"keyvals",
"...",
"interface",
"{",
"}",
")",
"List",
"{",
"keyvals",
"=",
"flattenFix",
"(",
"keyvals",
")",
"\n",
"list",
":=",
"l",
".",
"clone",
"(",
"len",
"(",
"l",
")",
"+",
"len",
"(",
"keyvals",
")",
")",
"\n",
"list",
"=",
"append",
"(",
"list",
",",
"keyvals",
"...",
")",
"\n",
"return",
"<mask>",
"\n",
"}"
] |
3,078 | all-3079 | [
"MarshalJSON",
"supports",
"json",
".",
"Marshaler",
"interface"
] | [
"func",
"(",
"v",
"ProcessInfo",
")",
"MarshalJSON",
"(",
")",
"(",
"[",
"]",
"<mask>",
",",
"error",
")",
"{",
"w",
":=",
"jwriter",
".",
"Writer",
"{",
"}",
"\n",
"easyjsonC5a4559bEncodeGithubComChromedpCdprotoSysteminfo",
"(",
"&",
"w",
",",
"v",
")",
"\n",
"return",
"w",
".",
"Buffer",
".",
"BuildBytes",
"(",
")",
",",
"w",
".",
"Error",
"\n",
"}"
] |
3,079 | all-3080 | [
"connectionCloseStateChange",
"is",
"called",
"when",
"a",
"connection",
"s",
"close",
"state",
"changes",
"."
] | [
"func",
"(",
"ch",
"*",
"Channel",
")",
"connectionCloseStateChange",
"(",
"c",
"*",
"Connection",
")",
"{",
"ch",
".",
"removeClosedConn",
"(",
"c",
")",
"\n",
"if",
"peer",
",",
"ok",
":=",
"ch",
".",
"RootPeers",
"(",
")",
".",
"Get",
"(",
"c",
".",
"remotePeerInfo",
".",
"HostPort",
")",
";",
"ok",
"{",
"peer",
".",
"connectionCloseStateChange",
"(",
"c",
")",
"\n",
"ch",
".",
"updatePeer",
"(",
"peer",
")",
"\n",
"}",
"\n",
"if",
"c",
".",
"outboundHP",
"!=",
"\"",
"\"",
"&&",
"c",
".",
"outboundHP",
"!=",
"c",
".",
"remotePeerInfo",
".",
"HostPort",
"{",
"// Outbound connections may be in multiple peers.",
"if",
"peer",
",",
"ok",
":=",
"ch",
".",
"RootPeers",
"(",
")",
".",
"Get",
"(",
"c",
".",
"outboundHP",
")",
";",
"ok",
"{",
"<mask>",
".",
"connectionCloseStateChange",
"(",
"c",
")",
"\n",
"ch",
".",
"updatePeer",
"(",
"peer",
")",
"\n",
"}",
"\n",
"}",
"\n\n",
"chState",
":=",
"ch",
".",
"State",
"(",
")",
"\n",
"if",
"chState",
"!=",
"ChannelStartClose",
"&&",
"chState",
"!=",
"ChannelInboundClosed",
"{",
"return",
"\n",
"}",
"\n\n",
"ch",
".",
"mutable",
".",
"RLock",
"(",
")",
"\n",
"minState",
":=",
"ch",
".",
"getMinConnectionState",
"(",
")",
"\n",
"ch",
".",
"mutable",
".",
"RUnlock",
"(",
")",
"\n\n",
"var",
"updateTo",
"ChannelState",
"\n",
"if",
"minState",
">=",
"connectionClosed",
"{",
"updateTo",
"=",
"ChannelClosed",
"\n",
"}",
"else",
"if",
"minState",
">=",
"connectionInboundClosed",
"&&",
"chState",
"==",
"ChannelStartClose",
"{",
"updateTo",
"=",
"ChannelInboundClosed",
"\n",
"}",
"\n\n",
"var",
"updatedToState",
"ChannelState",
"\n",
"if",
"updateTo",
">",
"0",
"{",
"ch",
".",
"mutable",
".",
"Lock",
"(",
")",
"\n",
"// Recheck the state as it's possible another goroutine changed the state",
"// from what we expected, and so we might make a stale change.",
"if",
"ch",
".",
"mutable",
".",
"state",
"==",
"chState",
"{",
"ch",
".",
"mutable",
".",
"state",
"=",
"updateTo",
"\n",
"updatedToState",
"=",
"updateTo",
"\n",
"}",
"\n",
"ch",
".",
"mutable",
".",
"Unlock",
"(",
")",
"\n",
"chState",
"=",
"updateTo",
"\n",
"}",
"\n\n",
"c",
".",
"log",
".",
"Debugf",
"(",
"\"",
"\"",
",",
"chState",
",",
"minState",
")",
"\n\n",
"if",
"updatedToState",
"==",
"ChannelClosed",
"{",
"ch",
".",
"onClosed",
"(",
")",
"\n",
"}",
"\n",
"}"
] |
3,080 | all-3081 | [
"ServeHTTP",
"implements",
"http",
".",
"Handler",
"interface",
"."
] | [
"func",
"(",
"h",
"Handler",
")",
"ServeHTTP",
"(",
"w",
"http",
".",
"ResponseWriter",
",",
"r",
"*",
"http",
".",
"Request",
")",
"{",
"defer",
"func",
"(",
")",
"{",
"if",
"err",
":=",
"recover",
"(",
")",
";",
"err",
"!=",
"nil",
"{",
"debugMsg",
":=",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\\n",
"\\n",
"\\n",
"\\n",
"\"",
",",
"<mask>",
".",
"Stack",
"(",
")",
",",
"r",
".",
"URL",
",",
"r",
".",
"Header",
",",
")",
"\n",
"if",
"h",
".",
"label",
"!=",
"\"",
"\"",
"{",
"debugMsg",
"=",
"h",
".",
"label",
"+",
"\"",
"\\n",
"\\n",
"\"",
"+",
"debugMsg",
"\n",
"}",
"\n",
"h",
".",
"logf",
"(",
"\"",
"\\n",
"\"",
",",
"r",
".",
"Method",
",",
"r",
".",
"URL",
".",
"String",
"(",
")",
",",
"err",
",",
"debugMsg",
")",
"\n\n",
"if",
"h",
".",
"notifier",
"!=",
"nil",
"{",
"go",
"func",
"(",
")",
"{",
"defer",
"func",
"(",
")",
"{",
"if",
"err",
":=",
"recover",
"(",
")",
";",
"err",
"!=",
"nil",
"{",
"h",
".",
"logf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"}",
"\n",
"}",
"(",
")",
"\n\n",
"if",
"err",
":=",
"h",
".",
"notifier",
".",
"Notify",
"(",
"fmt",
".",
"Sprint",
"(",
"\"",
"\"",
",",
"r",
".",
"Method",
",",
"\"",
"\"",
",",
"r",
".",
"URL",
".",
"String",
"(",
")",
",",
"\"",
"\"",
",",
"err",
",",
")",
",",
"debugMsg",
",",
")",
";",
"err",
"!=",
"nil",
"{",
"h",
".",
"logf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"}",
"\n",
"}",
"(",
")",
"\n",
"}",
"\n\n",
"if",
"h",
".",
"panicResponseHandler",
"!=",
"nil",
"{",
"h",
".",
"panicResponseHandler",
".",
"ServeHTTP",
"(",
"w",
",",
"r",
")",
"\n",
"return",
"\n",
"}",
"\n\n",
"if",
"h",
".",
"panicContentType",
"!=",
"\"",
"\"",
"{",
"w",
".",
"Header",
"(",
")",
".",
"Set",
"(",
"\"",
"\"",
",",
"h",
".",
"panicContentType",
")",
"\n",
"}",
"\n",
"w",
".",
"WriteHeader",
"(",
"http",
".",
"StatusInternalServerError",
")",
"\n",
"if",
"h",
".",
"panicBody",
"!=",
"\"",
"\"",
"{",
"fmt",
".",
"Fprintln",
"(",
"w",
",",
"h",
".",
"panicBody",
")",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"(",
")",
"\n\n",
"h",
".",
"handler",
".",
"ServeHTTP",
"(",
"w",
",",
"r",
")",
"\n",
"}"
] |
3,081 | all-3082 | [
"Dial",
"initializes",
"a",
"new",
"connection",
"and",
"releases",
"a",
"blocked",
"call",
"to",
"Accept",
"()"
] | [
"func",
"(",
"l",
"*",
"TestListener",
")",
"Dial",
"(",
"context",
".",
"Context",
",",
"string",
",",
"string",
")",
"(",
"<mask>",
".",
"Conn",
",",
"error",
")",
"{",
"l",
".",
"connMu",
".",
"Lock",
"(",
")",
"\n",
"defer",
"l",
".",
"connMu",
".",
"Unlock",
"(",
")",
"\n",
"if",
"l",
".",
"conn",
"!=",
"nil",
"{",
"return",
"nil",
",",
"errors",
".",
"New",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"// Initialize logging pipe",
"p",
":=",
"newLoggingPipe",
"(",
")",
"\n",
"l",
".",
"conn",
"=",
"p",
".",
"serverConn",
"(",
")",
"\n\n",
"// send serverConn to Accept() and close l.connCh (so future callers to",
"// Accept() get nothing)",
"l",
".",
"connCh",
"<-",
"p",
".",
"serverConn",
"(",
")",
"\n",
"close",
"(",
"l",
".",
"connCh",
")",
"\n",
"return",
"p",
".",
"clientConn",
"(",
")",
",",
"nil",
"\n",
"}"
] |
3,082 | all-3083 | [
"Build",
"creates",
"or",
"reuses",
"an",
"etcd",
"resolver",
"for",
"the",
"etcd",
"cluster",
"name",
"identified",
"by",
"the",
"authority",
"part",
"of",
"the",
"target",
"."
] | [
"func",
"(",
"b",
"*",
"builder",
")",
"Build",
"(",
"target",
"resolver",
".",
"Target",
",",
"cc",
"resolver",
".",
"ClientConn",
",",
"opts",
"resolver",
".",
"BuildOption",
")",
"(",
"resolver",
".",
"Resolver",
",",
"error",
")",
"{",
"if",
"len",
"(",
"target",
".",
"Authority",
")",
"<",
"1",
"{",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"id",
":=",
"target",
".",
"Authority",
"\n",
"es",
",",
"err",
":=",
"b",
".",
"getResolverGroup",
"(",
"id",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"}",
"\n",
"r",
":=",
"&",
"Resolver",
"{",
"endpointID",
":",
"id",
",",
"<mask>",
":",
"cc",
",",
"}",
"\n",
"es",
".",
"addResolver",
"(",
"r",
")",
"\n",
"return",
"r",
",",
"nil",
"\n",
"}"
] |
3,083 | all-3084 | [
"MapFilter",
"lifts",
"the",
"filter",
"to",
"also",
"work",
"on",
"maps",
".",
"It",
"loses",
"the",
"type",
"information",
"of",
"the",
"map",
"fields"
] | [
"func",
"MapFilter",
"(",
"filter",
"Filter",
")",
"Filter",
"{",
"return",
"FilterFunc",
"(",
"func",
"(",
"k",
"string",
",",
"v",
"interface",
"{",
"}",
")",
"interface",
"{",
"}",
"{",
"r",
":=",
"reflect",
".",
"ValueOf",
"(",
"v",
")",
"\n",
"if",
"r",
".",
"Kind",
"(",
")",
"==",
"reflect",
".",
"Map",
"{",
"// res will be the filtered map",
"res",
":=",
"make",
"(",
"map",
"[",
"string",
"]",
"interface",
"{",
"}",
",",
"r",
".",
"Len",
"(",
")",
")",
"\n",
"for",
"_",
",",
"key",
":=",
"<mask>",
"r",
".",
"MapKeys",
"(",
")",
"{",
"str",
":=",
"key",
".",
"String",
"(",
")",
"\n",
"val",
":=",
"r",
".",
"MapIndex",
"(",
"key",
")",
".",
"Interface",
"(",
")",
"\n",
"res",
"[",
"str",
"]",
"=",
"filter",
".",
"Filter",
"(",
"str",
",",
"val",
")",
"\n",
"}",
"\n\n",
"return",
"res",
"\n",
"}",
"\n\n",
"return",
"v",
"\n",
"}",
")",
"\n",
"}"
] |
3,084 | all-3085 | [
"NewRL10",
"returns",
"a",
"RL10",
"client",
"that",
"uses",
"the",
"information",
"stored",
"in",
"/",
"var",
"/",
"run",
"/",
"rightlink",
"/",
"secret",
"to",
"do",
"auth",
"and",
"configure",
"the",
"host",
".",
"The",
"client",
"behaves",
"identically",
"to",
"the",
"one",
"returned",
"by",
"New",
"in",
"all",
"other",
"aspects",
"."
] | [
"func",
"NewRL10",
"(",
")",
"(",
"*",
"API",
",",
"error",
")",
"{",
"<mask>",
",",
"err",
":=",
"rsapi",
".",
"NewRL10",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"return",
"fromAPI",
"(",
"raw",
")",
",",
"nil",
"\n",
"}"
] |
3,085 | all-3086 | [
"RemoveHistogram",
"removes",
"a",
"histogram"
] | [
"func",
"(",
"m",
"*",
"CirconusMetrics",
")",
"RemoveHistogram",
"(",
"metric",
"string",
")",
"{",
"m",
".",
"hm",
".",
"Lock",
"(",
")",
"\n",
"<mask>",
"(",
"m",
".",
"histograms",
",",
"metric",
")",
"\n",
"m",
".",
"hm",
".",
"Unlock",
"(",
")",
"\n",
"}"
] |
3,086 | all-3087 | [
"HasFrom",
"returns",
"a",
"boolean",
"if",
"a",
"field",
"has",
"been",
"set",
"."
] | [
"func",
"(",
"t",
"*",
"TimeRange",
")",
"HasFrom",
"(",
")",
"bool",
"{",
"if",
"t",
"!=",
"nil",
"&&",
"t",
".",
"From",
"!=",
"nil",
"{",
"return",
"<mask>",
"\n",
"}",
"\n\n",
"return",
"false",
"\n",
"}"
] |
3,087 | all-3088 | [
"MoveBefore",
"()",
"is",
"a",
"wrapper",
"around",
"gtk_list_store_move_before",
"()",
"."
] | [
"func",
"(",
"v",
"*",
"ListStore",
")",
"MoveBefore",
"(",
"iter",
",",
"<mask>",
"*",
"TreeIter",
")",
"{",
"C",
".",
"gtk_list_store_move_before",
"(",
"v",
".",
"native",
"(",
")",
",",
"iter",
".",
"native",
"(",
")",
",",
"position",
".",
"native",
"(",
")",
")",
"\n",
"}"
] |
3,088 | all-3089 | [
"Locator",
"returns",
"a",
"locator",
"for",
"the",
"given",
"resource"
] | [
"func",
"(",
"r",
"*",
"<mask>",
")",
"Locator",
"(",
"api",
"*",
"API",
")",
"*",
"OperationLocator",
"{",
"return",
"api",
".",
"OperationLocator",
"(",
"r",
".",
"Href",
")",
"\n",
"}"
] |
3,089 | all-3090 | [
"GetExistingAliases",
"returns",
"the",
"intersection",
"between",
"a",
"list",
"of",
"aliases",
"and",
"all",
"the",
"existing",
"ones",
"."
] | [
"func",
"GetExistingAliases",
"(",
"aliases",
"[",
"]",
"string",
",",
"allAliases",
"[",
"]",
"api",
".",
"ImageAliasesEntry",
")",
"[",
"]",
"api",
".",
"ImageAliasesEntry",
"{",
"existing",
":=",
"[",
"]",
"api",
".",
"ImageAliasesEntry",
"{",
"}",
"\n",
"for",
"_",
",",
"alias",
":=",
"range",
"allAliases",
"{",
"name",
":=",
"alias",
".",
"Name",
"\n",
"pos",
":=",
"sort",
".",
"SearchStrings",
"(",
"aliases",
",",
"name",
")",
"\n",
"if",
"pos",
"<",
"len",
"(",
"aliases",
")",
"&&",
"aliases",
"[",
"pos",
"]",
"==",
"name",
"{",
"existing",
"=",
"append",
"(",
"<mask>",
",",
"alias",
")",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"existing",
"\n",
"}"
] |
3,090 | all-3091 | [
"GetTerminalReason",
"retrieves",
"the",
"terminalReason",
"string"
] | [
"func",
"(",
"task",
"*",
"Task",
")",
"GetTerminalReason",
"(",
")",
"string",
"{",
"task",
".",
"<mask>",
".",
"RLock",
"(",
")",
"\n",
"defer",
"task",
".",
"lock",
".",
"RUnlock",
"(",
")",
"\n\n",
"return",
"task",
".",
"terminalReason",
"\n",
"}"
] |
3,091 | all-3092 | [
"waitLeader",
"waits",
"until",
"given",
"members",
"agree",
"on",
"the",
"same",
"leader",
"."
] | [
"func",
"(",
"c",
"*",
"cluster",
")",
"waitLeader",
"(",
"t",
"testing",
".",
"TB",
",",
"membs",
"[",
"]",
"*",
"member",
")",
"int",
"{",
"possibleLead",
":=",
"make",
"(",
"map",
"[",
"uint64",
"]",
"bool",
")",
"\n",
"var",
"lead",
"uint64",
"\n",
"for",
"_",
",",
"m",
":=",
"range",
"membs",
"{",
"possibleLead",
"[",
"uint64",
"(",
"m",
".",
"s",
".",
"ID",
"(",
")",
")",
"]",
"=",
"true",
"\n",
"}",
"\n",
"cc",
":=",
"MustNewHTTPClient",
"(",
"t",
",",
"getMembersURLs",
"(",
"membs",
")",
",",
"nil",
")",
"\n",
"kapi",
":=",
"client",
".",
"NewKeysAPI",
"(",
"cc",
")",
"\n\n",
"// ensure leader is up via linearizable get",
"for",
"{",
"ctx",
",",
"cancel",
":=",
"context",
".",
"WithTimeout",
"(",
"context",
".",
"Background",
"(",
")",
",",
"10",
"*",
"tickDuration",
"+",
"time",
".",
"Second",
")",
"\n",
"_",
",",
"err",
":=",
"kapi",
".",
"Get",
"(",
"ctx",
",",
"\"",
"\"",
",",
"&",
"client",
".",
"GetOptions",
"{",
"Quorum",
":",
"true",
"}",
")",
"\n",
"cancel",
"(",
")",
"\n",
"if",
"err",
"==",
"nil",
"||",
"strings",
".",
"Contains",
"(",
"err",
".",
"Error",
"(",
")",
",",
"\"",
"\"",
")",
"{",
"break",
"\n",
"}",
"\n",
"}",
"\n\n",
"for",
"lead",
"==",
"0",
"||",
"!",
"possibleLead",
"[",
"lead",
"]",
"{",
"lead",
"=",
"0",
"\n",
"for",
"_",
",",
"m",
":=",
"range",
"membs",
"{",
"select",
"{",
"case",
"<-",
"m",
".",
"s",
".",
"StopNotify",
"(",
")",
":",
"<mask>",
"\n",
"default",
":",
"}",
"\n",
"if",
"lead",
"!=",
"0",
"&&",
"lead",
"!=",
"m",
".",
"s",
".",
"Lead",
"(",
")",
"{",
"lead",
"=",
"0",
"\n",
"time",
".",
"Sleep",
"(",
"10",
"*",
"tickDuration",
")",
"\n",
"break",
"\n",
"}",
"\n",
"lead",
"=",
"m",
".",
"s",
".",
"Lead",
"(",
")",
"\n",
"}",
"\n",
"}",
"\n\n",
"for",
"i",
",",
"m",
":=",
"range",
"membs",
"{",
"if",
"uint64",
"(",
"m",
".",
"s",
".",
"ID",
"(",
")",
")",
"==",
"lead",
"{",
"return",
"i",
"\n",
"}",
"\n",
"}",
"\n\n",
"return",
"-",
"1",
"\n",
"}"
] |
3,092 | all-3093 | [
"Do",
"executes",
"Debugger",
".",
"evaluateOnCallFrame",
"against",
"the",
"provided",
"context",
".",
"returns",
":",
"result",
"-",
"Object",
"wrapper",
"for",
"the",
"evaluation",
"result",
".",
"exceptionDetails",
"-",
"Exception",
"details",
"."
] | [
"func",
"(",
"p",
"*",
"EvaluateOnCallFrameParams",
")",
"Do",
"(",
"ctx",
"context",
".",
"Context",
")",
"(",
"result",
"*",
"runtime",
".",
"RemoteObject",
",",
"exceptionDetails",
"*",
"runtime",
".",
"ExceptionDetails",
",",
"err",
"error",
")",
"{",
"// execute",
"<mask>",
"res",
"EvaluateOnCallFrameReturns",
"\n",
"err",
"=",
"cdp",
".",
"Execute",
"(",
"ctx",
",",
"CommandEvaluateOnCallFrame",
",",
"p",
",",
"&",
"res",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"return",
"res",
".",
"Result",
",",
"res",
".",
"ExceptionDetails",
",",
"nil",
"\n",
"}"
] |
3,093 | all-3094 | [
"newImageSource",
"returns",
"an",
"ImageSource",
"for",
"reading",
"from",
"an",
"existing",
"directory",
"."
] | [
"func",
"newImageSource",
"(",
"sys",
"*",
"types",
".",
"SystemContext",
",",
"ref",
"ociReference",
")",
"(",
"types",
".",
"ImageSource",
",",
"error",
")",
"{",
"tr",
":=",
"tlsclientconfig",
".",
"NewTransport",
"(",
")",
"\n",
"tr",
".",
"TLSClientConfig",
"=",
"tlsconfig",
".",
"ServerDefault",
"(",
")",
"\n\n",
"if",
"sys",
"!=",
"nil",
"&&",
"sys",
".",
"OCICertPath",
"!=",
"\"",
"\"",
"{",
"if",
"err",
":=",
"tlsclientconfig",
".",
"SetupCertificates",
"(",
"sys",
".",
"OCICertPath",
",",
"tr",
".",
"TLSClientConfig",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"tr",
".",
"TLSClientConfig",
".",
"InsecureSkipVerify",
"=",
"sys",
".",
"OCIInsecureSkipTLSVerify",
"\n",
"}",
"\n\n",
"client",
":=",
"&",
"http",
".",
"<mask>",
"{",
"}",
"\n",
"client",
".",
"Transport",
"=",
"tr",
"\n",
"descriptor",
",",
"err",
":=",
"ref",
".",
"getManifestDescriptor",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"d",
":=",
"&",
"ociImageSource",
"{",
"ref",
":",
"ref",
",",
"descriptor",
":",
"descriptor",
",",
"client",
":",
"client",
"}",
"\n",
"if",
"sys",
"!=",
"nil",
"{",
"// TODO(jonboulle): check dir existence?",
"d",
".",
"sharedBlobDir",
"=",
"sys",
".",
"OCISharedBlobDirPath",
"\n",
"}",
"\n",
"return",
"d",
",",
"nil",
"\n",
"}"
] |
3,094 | all-3095 | [
"New",
"creates",
"a",
"nodetable",
"instance"
] | [
"func",
"New",
"(",
"hfn",
"HashFn",
",",
"kfn",
"EqualKeyFn",
")",
"*",
"NodeTable",
"{",
"nt",
":=",
"&",
"NodeTable",
"{",
"fastHT",
":",
"<mask>",
"(",
"map",
"[",
"uint32",
"]",
"uint64",
")",
",",
"slowHT",
":",
"make",
"(",
"map",
"[",
"uint32",
"]",
"[",
"]",
"uint64",
")",
",",
"hash",
":",
"hfn",
",",
"keyEqual",
":",
"kfn",
",",
"}",
"\n\n",
"buf",
":=",
"dbInstances",
".",
"MakeBuf",
"(",
")",
"\n",
"defer",
"dbInstances",
".",
"FreeBuf",
"(",
"buf",
")",
"\n",
"dbInstances",
".",
"Insert",
"(",
"unsafe",
".",
"Pointer",
"(",
"nt",
")",
",",
"CompareNodeTable",
",",
"buf",
",",
"&",
"dbInstances",
".",
"Stats",
")",
"\n\n",
"return",
"nt",
"\n",
"}"
] |
3,095 | all-3096 | [
"Endpoints",
"collects",
"endpoints",
"from",
"its",
"wrapped",
"source",
"and",
"returns",
"them",
"without",
"duplicates",
"."
] | [
"func",
"(",
"ms",
"*",
"dedupSource",
")",
"Endpoints",
"(",
")",
"(",
"[",
"]",
"*",
"endpoint",
".",
"Endpoint",
",",
"error",
")",
"{",
"result",
":=",
"[",
"]",
"*",
"endpoint",
".",
"Endpoint",
"{",
"}",
"\n",
"collected",
":=",
"map",
"[",
"string",
"]",
"bool",
"{",
"}",
"\n\n",
"endpoints",
",",
"err",
":=",
"ms",
".",
"source",
".",
"Endpoints",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"for",
"_",
",",
"ep",
":=",
"<mask>",
"endpoints",
"{",
"identifier",
":=",
"ep",
".",
"DNSName",
"+",
"\"",
"\"",
"+",
"ep",
".",
"Targets",
".",
"String",
"(",
")",
"\n\n",
"if",
"_",
",",
"ok",
":=",
"collected",
"[",
"identifier",
"]",
";",
"ok",
"{",
"log",
".",
"Debugf",
"(",
"\"",
"\"",
",",
"ep",
")",
"\n",
"continue",
"\n",
"}",
"\n\n",
"collected",
"[",
"identifier",
"]",
"=",
"true",
"\n",
"result",
"=",
"append",
"(",
"result",
",",
"ep",
")",
"\n",
"}",
"\n\n",
"return",
"result",
",",
"nil",
"\n",
"}"
] |
3,096 | all-3097 | [
"resourceVSphereDPMHostOverrideFlattenID",
"makes",
"an",
"ID",
"for",
"the",
"vsphere_dpm_host_override",
"resource",
"."
] | [
"func",
"resourceVSphereDPMHostOverrideFlattenID",
"(",
"cluster",
"*",
"object",
".",
"ClusterComputeResource",
",",
"host",
"*",
"object",
".",
"HostSystem",
")",
"(",
"string",
",",
"error",
")",
"{",
"return",
"strings",
".",
"Join",
"(",
"[",
"]",
"string",
"{",
"cluster",
".",
"Reference",
"(",
")",
".",
"<mask>",
",",
"host",
".",
"Reference",
"(",
")",
".",
"Value",
"}",
",",
"\"",
"\"",
")",
",",
"nil",
"\n",
"}"
] |
3,097 | all-3098 | [
"handleRequestJobViews",
"handles",
"requests",
"to",
"get",
"all",
"available",
"artifact",
"views",
"for",
"a",
"given",
"job",
".",
"The",
"url",
"must",
"specify",
"a",
"storage",
"key",
"type",
"such",
"as",
"prowjob",
"or",
"gcs",
":",
"/",
"view",
"/",
"<key",
"-",
"type",
">",
"/",
"<key",
">",
"Examples",
":",
"-",
"/",
"view",
"/",
"gcs",
"/",
"kubernetes",
"-",
"jenkins",
"/",
"pr",
"-",
"logs",
"/",
"pull",
"/",
"test",
"-",
"infra",
"/",
"9557",
"/",
"pull",
"-",
"test",
"-",
"infra",
"-",
"verify",
"-",
"gofmt",
"/",
"15688",
"/",
"-",
"/",
"view",
"/",
"prowjob",
"/",
"echo",
"-",
"test",
"/",
"1046875594609922048"
] | [
"func",
"handleRequestJobViews",
"(",
"sg",
"*",
"spyglass",
".",
"Spyglass",
",",
"cfg",
"config",
".",
"Getter",
",",
"o",
"options",
")",
"http",
".",
"HandlerFunc",
"{",
"return",
"func",
"(",
"w",
"http",
".",
"ResponseWriter",
",",
"r",
"*",
"http",
".",
"Request",
")",
"{",
"start",
":=",
"time",
".",
"Now",
"(",
")",
"\n",
"setHeadersNoCaching",
"(",
"w",
")",
"\n",
"src",
":=",
"strings",
".",
"TrimPrefix",
"(",
"r",
".",
"URL",
".",
"Path",
",",
"\"",
"\"",
")",
"\n\n",
"page",
",",
"err",
":=",
"renderSpyglass",
"(",
"sg",
",",
"cfg",
",",
"src",
",",
"o",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"logrus",
".",
"WithError",
"(",
"err",
")",
".",
"Error",
"(",
"\"",
"\"",
")",
"\n",
"message",
":=",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"http",
".",
"Error",
"(",
"w",
",",
"message",
",",
"http",
".",
"StatusInternalServerError",
")",
"\n",
"return",
"\n",
"}",
"\n\n",
"fmt",
".",
"Fprint",
"(",
"w",
",",
"<mask>",
")",
"\n",
"elapsed",
":=",
"time",
".",
"Since",
"(",
"start",
")",
"\n",
"logrus",
".",
"WithFields",
"(",
"logrus",
".",
"Fields",
"{",
"\"",
"\"",
":",
"elapsed",
".",
"String",
"(",
")",
",",
"\"",
"\"",
":",
"r",
".",
"URL",
".",
"Path",
",",
"\"",
"\"",
":",
"src",
",",
"}",
")",
".",
"Info",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"}"
] |
3,098 | all-3099 | [
"NewService",
"creates",
"a",
"new",
"PublishService",
"with",
"default",
"settings",
".",
"Arguments",
"allowed",
":",
"--",
"provider",
"-",
"base",
"-",
"url",
"--",
"pact",
"-",
"urls",
"--",
"provider",
"-",
"states",
"-",
"url",
"--",
"provider",
"-",
"states",
"-",
"setup",
"-",
"url",
"--",
"broker",
"-",
"username",
"--",
"broker",
"-",
"password",
"--",
"publish",
"-",
"verification",
"-",
"results",
"--",
"provider",
"-",
"app",
"-",
"version",
"--",
"custom",
"-",
"provider",
"-",
"headers"
] | [
"func",
"(",
"v",
"*",
"PublishService",
")",
"NewService",
"(",
"args",
"[",
"]",
"string",
")",
"Service",
"{",
"log",
".",
"Printf",
"(",
"\"",
"\\n",
"\"",
",",
"args",
")",
"\n\n",
"v",
".",
"Args",
"=",
"[",
"]",
"string",
"{",
"\"",
"\"",
",",
"}",
"\n\n",
"v",
".",
"Args",
"=",
"<mask>",
"(",
"v",
".",
"Args",
",",
"args",
"...",
")",
"\n",
"v",
".",
"Cmd",
"=",
"getPublisherCommandPath",
"(",
")",
"\n\n",
"return",
"v",
"\n",
"}"
] |
3,099 | all-3100 | [
"Update",
"updates",
"the",
"one",
"record",
".",
"The",
"obj",
"must",
"be",
"struct",
"and",
"must",
"have",
"field",
"that",
"specified",
"pk",
"struct",
"tag",
".",
"Update",
"will",
"try",
"to",
"update",
"record",
"which",
"searched",
"by",
"value",
"of",
"primary",
"key",
"in",
"obj",
".",
"Update",
"returns",
"the",
"number",
"of",
"rows",
"affected",
"by",
"an",
"update",
"."
] | [
"func",
"(",
"db",
"*",
"DB",
")",
"Update",
"(",
"obj",
"interface",
"{",
"}",
")",
"(",
"affected",
"int64",
",",
"err",
"error",
")",
"{",
"rv",
",",
"rtype",
",",
"tableName",
",",
"err",
":=",
"db",
".",
"tableValueOf",
"(",
"\"",
"\"",
",",
"obj",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"-",
"1",
",",
"err",
"\n",
"}",
"\n",
"if",
"hook",
",",
"ok",
":=",
"obj",
".",
"(",
"BeforeUpdater",
")",
";",
"ok",
"{",
"if",
"err",
":=",
"hook",
".",
"BeforeUpdate",
"(",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"-",
"1",
",",
"err",
"\n",
"}",
"\n",
"}",
"\n",
"fieldIndexes",
":=",
"db",
".",
"collectFieldIndexes",
"(",
"rtype",
",",
"nil",
")",
"\n",
"pkIdx",
":=",
"db",
".",
"findPKIndex",
"(",
"rtype",
",",
"nil",
")",
"\n",
"if",
"len",
"(",
"pkIdx",
")",
"<",
"1",
"{",
"return",
"-",
"1",
",",
"fmt",
".",
"Errorf",
"(",
"`Update: fields of struct doesn't have primary key: \"pk\" struct tag must be specified for update`",
")",
"\n",
"}",
"\n",
"sets",
":=",
"make",
"(",
"[",
"]",
"string",
",",
"len",
"(",
"fieldIndexes",
")",
")",
"\n",
"var",
"args",
"[",
"]",
"<mask>",
"{",
"}",
"\n",
"for",
"i",
",",
"index",
":=",
"range",
"fieldIndexes",
"{",
"col",
":=",
"db",
".",
"columnFromTag",
"(",
"rtype",
".",
"FieldByIndex",
"(",
"index",
")",
")",
"\n",
"sets",
"[",
"i",
"]",
"=",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"db",
".",
"dialect",
".",
"Quote",
"(",
"col",
")",
",",
"db",
".",
"dialect",
".",
"PlaceHolder",
"(",
"i",
")",
")",
"\n",
"args",
"=",
"append",
"(",
"args",
",",
"rv",
".",
"FieldByIndex",
"(",
"index",
")",
".",
"Interface",
"(",
")",
")",
"\n",
"}",
"\n",
"query",
":=",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"db",
".",
"dialect",
".",
"Quote",
"(",
"tableName",
")",
",",
"strings",
".",
"Join",
"(",
"sets",
",",
"\"",
"\"",
")",
",",
"db",
".",
"dialect",
".",
"Quote",
"(",
"db",
".",
"columnFromTag",
"(",
"rtype",
".",
"FieldByIndex",
"(",
"pkIdx",
")",
")",
")",
",",
"db",
".",
"dialect",
".",
"PlaceHolder",
"(",
"len",
"(",
"fieldIndexes",
")",
")",
")",
"\n",
"args",
"=",
"append",
"(",
"args",
",",
"rv",
".",
"FieldByIndex",
"(",
"pkIdx",
")",
".",
"Interface",
"(",
")",
")",
"\n",
"stmt",
",",
"err",
":=",
"db",
".",
"prepare",
"(",
"query",
",",
"args",
"...",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"-",
"1",
",",
"err",
"\n",
"}",
"\n",
"defer",
"stmt",
".",
"Close",
"(",
")",
"\n",
"result",
",",
"err",
":=",
"stmt",
".",
"Exec",
"(",
"args",
"...",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"-",
"1",
",",
"err",
"\n",
"}",
"\n",
"affected",
",",
"_",
"=",
"result",
".",
"RowsAffected",
"(",
")",
"\n",
"if",
"hook",
",",
"ok",
":=",
"obj",
".",
"(",
"AfterUpdater",
")",
";",
"ok",
"{",
"if",
"err",
":=",
"hook",
".",
"AfterUpdate",
"(",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"affected",
",",
"err",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"affected",
",",
"nil",
"\n",
"}"
] |
Subsets and Splits
No saved queries yet
Save your SQL queries to embed, download, and access them later. Queries will appear here once saved.