id
int32 0
25.3k
| idx
stringlengths 5
9
| nl_tokens
sequencelengths 1
418
| pl_tokens
sequencelengths 22
4.98k
|
---|---|---|---|
4,800 | all-4801 | [
"Using",
"the",
"classic",
"API",
"posts",
"a",
"value",
"to",
"a",
"stat",
"."
] | [
"func",
"(",
"r",
"*",
"BasicReporter",
")",
"PostValue",
"(",
"statKey",
",",
"userKey",
"string",
",",
"value",
"float64",
")",
"error",
"{",
"r",
".",
"add",
"(",
"newClassicStatValue",
"(",
"statKey",
",",
"userKey",
",",
"<mask>",
")",
")",
"\n",
"return",
"nil",
"\n",
"}"
] |
4,801 | all-4802 | [
"Verify",
"creates",
"a",
"signature",
"for",
"buf",
"comparing",
"it",
"against",
"the",
"URL",
"-",
"safe",
"base64",
"encoded",
"sig",
"and",
"returning",
"the",
"decoded",
"signature",
".",
"If",
"the",
"sig",
"is",
"invalid",
"then",
"ErrInvalidSignature",
"will",
"be",
"returned",
"."
] | [
"func",
"(",
"rs",
"*",
"RSASigner",
")",
"Verify",
"(",
"buf",
",",
"sig",
"[",
"]",
"byte",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"var",
"err",
"error",
"\n\n",
"// decode",
"dec",
",",
"err",
":=",
"b64",
".",
"DecodeString",
"(",
"string",
"(",
"sig",
")",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"// verify",
"err",
"=",
"<mask>",
".",
"VerifyBytes",
"(",
"buf",
",",
"dec",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"return",
"dec",
",",
"nil",
"\n",
"}"
] |
4,802 | all-4803 | [
"UnmarshalJSON",
"supports",
"json",
".",
"Unmarshaler",
"interface"
] | [
"func",
"(",
"v",
"*",
"ObjectPreview",
")",
"UnmarshalJSON",
"(",
"data",
"[",
"]",
"byte",
")",
"error",
"{",
"r",
":=",
"jlexer",
".",
"Lexer",
"{",
"Data",
":",
"<mask>",
"}",
"\n",
"easyjsonC5a4559bDecodeGithubComChromedpCdprotoRuntime17",
"(",
"&",
"r",
",",
"v",
")",
"\n",
"return",
"r",
".",
"Error",
"(",
")",
"\n",
"}"
] |
4,803 | all-4804 | [
"Dial",
"a",
"list",
"of",
"seeds",
"asynchronously",
"in",
"random",
"order"
] | [
"func",
"(",
"sw",
"*",
"Switch",
")",
"DialSeeds",
"(",
"addrBook",
"*",
"AddrBook",
",",
"seeds",
"[",
"]",
"string",
")",
"error",
"{",
"netAddrs",
",",
"err",
":=",
"NewNetAddressStrings",
"(",
"seeds",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"if",
"addrBook",
"!=",
"nil",
"{",
"// add seeds to `addrBook`",
"ourAddrS",
":=",
"sw",
".",
"nodeInfo",
".",
"ListenAddr",
"\n",
"ourAddr",
",",
"_",
":=",
"NewNetAddressString",
"(",
"ourAddrS",
")",
"\n",
"for",
"_",
",",
"netAddr",
":=",
"range",
"netAddrs",
"{",
"// do not add ourselves",
"if",
"netAddr",
".",
"Equals",
"(",
"ourAddr",
")",
"{",
"<mask>",
"\n",
"}",
"\n",
"addrBook",
".",
"AddAddress",
"(",
"netAddr",
",",
"ourAddr",
")",
"\n",
"}",
"\n",
"addrBook",
".",
"Save",
"(",
")",
"\n",
"}",
"\n\n",
"// permute the list, dial them in random order.",
"perm",
":=",
"rand",
".",
"Perm",
"(",
"len",
"(",
"netAddrs",
")",
")",
"\n",
"for",
"i",
":=",
"0",
";",
"i",
"<",
"len",
"(",
"perm",
")",
";",
"i",
"++",
"{",
"go",
"func",
"(",
"i",
"int",
")",
"{",
"time",
".",
"Sleep",
"(",
"time",
".",
"Duration",
"(",
"rand",
".",
"Int63n",
"(",
"3000",
")",
")",
"*",
"time",
".",
"Millisecond",
")",
"\n",
"j",
":=",
"perm",
"[",
"i",
"]",
"\n",
"sw",
".",
"dialSeed",
"(",
"netAddrs",
"[",
"j",
"]",
")",
"\n",
"}",
"(",
"i",
")",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
] |
4,804 | all-4805 | [
"validateHostFolder",
"checks",
"to",
"make",
"sure",
"the",
"folder",
"is",
"a",
"host",
"folder",
"and",
"returns",
"it",
"if",
"it",
"is",
"or",
"an",
"error",
"if",
"it",
"isn",
"t",
"."
] | [
"func",
"validateHostFolder",
"(",
"folder",
"*",
"object",
".",
"Folder",
")",
"(",
"*",
"object",
".",
"Folder",
",",
"error",
")",
"{",
"ft",
",",
"err",
":=",
"FindType",
"(",
"<mask>",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"if",
"ft",
"!=",
"VSphereFolderTypeHost",
"{",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"folder",
".",
"InventoryPath",
")",
"\n",
"}",
"\n",
"return",
"folder",
",",
"nil",
"\n",
"}"
] |
4,805 | all-4806 | [
"Do",
"executes",
"Network",
".",
"setDataSizeLimitsForTest",
"against",
"the",
"provided",
"context",
"."
] | [
"func",
"(",
"p",
"*",
"SetDataSizeLimitsForTestParams",
")",
"Do",
"(",
"ctx",
"<mask>",
".",
"Context",
")",
"(",
"err",
"error",
")",
"{",
"return",
"cdp",
".",
"Execute",
"(",
"ctx",
",",
"CommandSetDataSizeLimitsForTest",
",",
"p",
",",
"nil",
")",
"\n",
"}"
] |
4,806 | all-4807 | [
"CreateResource",
"makes",
"a",
"POST",
"request",
"to",
"the",
"given",
"resource",
"."
] | [
"func",
"(",
"c",
"*",
"Client",
")",
"CreateResource",
"(",
"ctx",
"context",
".",
"Context",
",",
"pathPart",
"string",
",",
"data",
"url",
".",
"Values",
",",
"v",
"<mask>",
"{",
"}",
")",
"error",
"{",
"return",
"c",
".",
"MakeRequest",
"(",
"ctx",
",",
"\"",
"\"",
",",
"pathPart",
",",
"data",
",",
"v",
")",
"\n",
"}"
] |
4,807 | all-4808 | [
"WithSpeed",
"swipe",
"speed",
"in",
"pixels",
"per",
"second",
"(",
"default",
":",
"800",
")",
"."
] | [
"func",
"(",
"p",
"SynthesizeScrollGestureParams",
")",
"WithSpeed",
"(",
"speed",
"int64",
")",
"*",
"SynthesizeScrollGestureParams",
"{",
"p",
".",
"Speed",
"=",
"<mask>",
"\n",
"return",
"&",
"p",
"\n",
"}"
] |
4,808 | all-4809 | [
"MarshalEasyJSON",
"writes",
"the",
"RGBColor",
"to",
"a",
"easyjson",
".",
"Writer"
] | [
"func",
"(",
"r",
"RGBColor",
")",
"MarshalEasyJSON",
"(",
"w",
"*",
"jwriter",
".",
"<mask>",
")",
"{",
"w",
".",
"String",
"(",
"string",
"(",
"r",
")",
")",
"\n",
"}"
] |
4,809 | all-4810 | [
"Logf",
"logs",
"provided",
"message",
"with",
"formatting",
"."
] | [
"func",
"(",
"logger",
"*",
"Logger",
")",
"Logf",
"(",
"level",
"Level",
",",
"format",
"string",
",",
"a",
"...",
"interface",
"{",
"}",
")",
"{",
"logger",
".",
"log",
"(",
"<mask>",
",",
"format",
",",
"a",
"...",
")",
"\n",
"}"
] |
4,810 | all-4811 | [
"Update",
"--",
"Safe",
"way",
"to",
"update",
"a",
"task"
] | [
"func",
"(",
"s",
"*",
"Task",
")",
"Update",
"(",
"update",
"func",
"(",
"*",
"<mask>",
")",
"interface",
"{",
"}",
")",
"interface",
"{",
"}",
"{",
"s",
".",
"mutex",
".",
"Lock",
"(",
")",
"\n",
"var",
"ret",
"=",
"update",
"(",
"s",
")",
"\n",
"s",
".",
"taskManager",
".",
"SaveTask",
"(",
"s",
")",
"\n",
"s",
".",
"mutex",
".",
"Unlock",
"(",
")",
"\n",
"return",
"ret",
"\n",
"}"
] |
4,811 | all-4812 | [
"MenuItemNewFromModel",
"is",
"a",
"wrapper",
"around",
"g_menu_item_new_from_model",
"()",
"."
] | [
"func",
"MenuItemNewFromModel",
"(",
"model",
"*",
"MenuModel",
",",
"index",
"int",
")",
"*",
"MenuItem",
"{",
"c",
":=",
"C",
".",
"g_menu_item_new_from_model",
"(",
"model",
".",
"native",
"(",
")",
",",
"C",
".",
"gint",
"(",
"<mask>",
")",
")",
"\n",
"if",
"c",
"==",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n",
"return",
"wrapMenuItem",
"(",
"wrapObject",
"(",
"unsafe",
".",
"Pointer",
"(",
"c",
")",
")",
")",
"\n",
"}"
] |
4,812 | all-4813 | [
"Column",
"returns",
"the",
"name",
"of",
"the",
"database",
"column",
"the",
"field",
"maps",
"to",
".",
"The",
"type",
"code",
"of",
"the",
"field",
"must",
"be",
"TypeColumn",
"."
] | [
"func",
"(",
"f",
"*",
"Field",
")",
"Column",
"(",
")",
"string",
"{",
"if",
"f",
".",
"Type",
".",
"Code",
"!=",
"TypeColumn",
"{",
"panic",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"column",
":=",
"lex",
".",
"Snake",
"(",
"f",
".",
"Name",
")",
"\n\n",
"join",
":=",
"f",
".",
"Config",
".",
"Get",
"(",
"\"",
"\"",
")",
"\n",
"if",
"join",
"!=",
"\"",
"\"",
"{",
"column",
"=",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"<mask>",
",",
"column",
")",
"\n\n",
"}",
"\n\n",
"return",
"column",
"\n",
"}"
] |
4,813 | all-4814 | [
"GetAggregationOk",
"returns",
"a",
"tuple",
"with",
"the",
"Aggregation",
"field",
"if",
"it",
"s",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"and",
"a",
"boolean",
"to",
"check",
"if",
"the",
"value",
"has",
"been",
"set",
"."
] | [
"func",
"(",
"e",
"*",
"<mask>",
")",
"GetAggregationOk",
"(",
")",
"(",
"string",
",",
"bool",
")",
"{",
"if",
"e",
"==",
"nil",
"||",
"e",
".",
"Aggregation",
"==",
"nil",
"{",
"return",
"\"",
"\"",
",",
"false",
"\n",
"}",
"\n",
"return",
"*",
"e",
".",
"Aggregation",
",",
"true",
"\n",
"}"
] |
4,814 | all-4815 | [
"closeNetwork",
"closes",
"the",
"network",
"connection",
"and",
"all",
"network",
"-",
"related",
"channels",
".",
"This",
"should",
"only",
"be",
"done",
"in",
"response",
"to",
"a",
"fatal",
"connection",
"or",
"protocol",
"error",
"or",
"after",
"all",
"pending",
"frames",
"have",
"been",
"sent",
"."
] | [
"func",
"(",
"c",
"*",
"Connection",
")",
"closeNetwork",
"(",
")",
"{",
"// NB(mmihic): The sender goroutine will exit once the connection is",
"// closed; no need to close the send channel (and closing the send",
"// channel would be dangerous since other goroutine might be sending)",
"c",
".",
"log",
".",
"Debugf",
"(",
"\"",
"\"",
")",
"\n",
"c",
".",
"stopHealthCheck",
"(",
")",
"\n",
"c",
".",
"closeNetworkCalled",
".",
"Store",
"(",
"true",
")",
"\n",
"if",
"err",
":=",
"c",
".",
"<mask>",
".",
"Close",
"(",
")",
";",
"err",
"!=",
"nil",
"{",
"c",
".",
"log",
".",
"WithFields",
"(",
"LogField",
"{",
"\"",
"\"",
",",
"c",
".",
"remotePeerInfo",
"}",
",",
"ErrField",
"(",
"err",
")",
",",
")",
".",
"Warn",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"}"
] |
4,815 | all-4816 | [
"colorWrite"
] | [
"func",
"cW",
"(",
"w",
"io",
".",
"Writer",
",",
"useColor",
"bool",
",",
"color",
"[",
"]",
"byte",
",",
"s",
"string",
",",
"args",
"...",
"interface",
"{",
"}",
")",
"{",
"if",
"isTTY",
"&&",
"useColor",
"{",
"w",
".",
"Write",
"(",
"<mask>",
")",
"\n",
"}",
"\n",
"fmt",
".",
"Fprintf",
"(",
"w",
",",
"s",
",",
"args",
"...",
")",
"\n",
"if",
"isTTY",
"&&",
"useColor",
"{",
"w",
".",
"Write",
"(",
"reset",
")",
"\n",
"}",
"\n",
"}"
] |
4,816 | all-4817 | [
"SetDesiredStatus",
"safely",
"sets",
"the",
"desired",
"status",
"of",
"the",
"resource"
] | [
"func",
"(",
"auth",
"*",
"ASMAuthResource",
")",
"SetDesiredStatus",
"(",
"status",
"resourcestatus",
".",
"ResourceStatus",
")",
"{",
"auth",
".",
"lock",
".",
"Lock",
"(",
")",
"\n",
"defer",
"auth",
".",
"<mask>",
".",
"Unlock",
"(",
")",
"\n\n",
"auth",
".",
"desiredStatusUnsafe",
"=",
"status",
"\n",
"}"
] |
4,817 | all-4818 | [
"newEphemeralGPGSigningMechanism",
"returns",
"a",
"new",
"GPG",
"/",
"OpenPGP",
"signing",
"mechanism",
"which",
"recognizes",
"_only_",
"public",
"keys",
"from",
"the",
"supplied",
"blob",
"and",
"returns",
"the",
"identities",
"of",
"these",
"keys",
".",
"The",
"caller",
"must",
"call",
".",
"Close",
"()",
"on",
"the",
"returned",
"SigningMechanism",
"."
] | [
"func",
"newEphemeralGPGSigningMechanism",
"(",
"blob",
"[",
"]",
"<mask>",
")",
"(",
"SigningMechanism",
",",
"[",
"]",
"string",
",",
"error",
")",
"{",
"dir",
",",
"err",
":=",
"ioutil",
".",
"TempDir",
"(",
"\"",
"\"",
",",
"\"",
"\"",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"nil",
",",
"err",
"\n",
"}",
"\n",
"removeDir",
":=",
"true",
"\n",
"defer",
"func",
"(",
")",
"{",
"if",
"removeDir",
"{",
"os",
".",
"RemoveAll",
"(",
"dir",
")",
"\n",
"}",
"\n",
"}",
"(",
")",
"\n",
"ctx",
",",
"err",
":=",
"newGPGMEContext",
"(",
"dir",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"nil",
",",
"err",
"\n",
"}",
"\n",
"mech",
":=",
"&",
"gpgmeSigningMechanism",
"{",
"ctx",
":",
"ctx",
",",
"ephemeralDir",
":",
"dir",
",",
"}",
"\n",
"keyIdentities",
",",
"err",
":=",
"mech",
".",
"importKeysFromBytes",
"(",
"blob",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"removeDir",
"=",
"false",
"\n",
"return",
"mech",
",",
"keyIdentities",
",",
"nil",
"\n",
"}"
] |
4,818 | all-4819 | [
"MarshalJSON",
"supports",
"json",
".",
"Marshaler",
"interface"
] | [
"func",
"(",
"v",
"WaitForDebuggerParams",
")",
"MarshalJSON",
"(",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"w",
":=",
"jwriter",
".",
"Writer",
"{",
"}",
"\n",
"easyjsonC5a4559bEncodeGithubComChromedpCdprotoPage",
"(",
"&",
"w",
",",
"v",
")",
"\n",
"return",
"w",
".",
"<mask>",
".",
"BuildBytes",
"(",
")",
",",
"w",
".",
"Error",
"\n",
"}"
] |
4,819 | all-4820 | [
"AppendDeflateBytesLevel",
"appends",
"deflated",
"src",
"to",
"dst",
"using",
"the",
"given",
"compression",
"level",
"and",
"returns",
"the",
"resulting",
"dst",
".",
"Supported",
"compression",
"levels",
"are",
":",
"*",
"CompressNoCompression",
"*",
"CompressBestSpeed",
"*",
"CompressBestCompression",
"*",
"CompressDefaultCompression",
"*",
"CompressHuffmanOnly"
] | [
"func",
"AppendDeflateBytesLevel",
"(",
"dst",
",",
"src",
"[",
"]",
"byte",
",",
"level",
"int",
")",
"[",
"]",
"<mask>",
"{",
"w",
":=",
"&",
"byteSliceWriter",
"{",
"dst",
"}",
"\n",
"WriteDeflateLevel",
"(",
"w",
",",
"src",
",",
"level",
")",
"\n",
"return",
"w",
".",
"b",
"\n",
"}"
] |
4,820 | all-4821 | [
"setAuthHeader",
"sets",
"the",
"Swift",
"Authorization",
"header",
"to",
"r",
"using",
"the",
"access",
"token",
"in",
"t",
"."
] | [
"func",
"setAuthHeader",
"(",
"t",
"*",
"oauth2",
".",
"Token",
",",
"r",
"*",
"http",
".",
"Request",
")",
"{",
"r",
".",
"Header",
".",
"<mask>",
"(",
"\"",
"\"",
",",
"t",
".",
"AccessToken",
")",
"\n",
"}"
] |
4,821 | all-4822 | [
"NewListener",
"returns",
"a",
"listener",
"for",
"raft",
"message",
"transfer",
"between",
"peers",
".",
"It",
"uses",
"timeout",
"listener",
"to",
"identify",
"broken",
"streams",
"promptly",
"."
] | [
"func",
"NewListener",
"(",
"u",
"url",
".",
"<mask>",
",",
"tlsinfo",
"*",
"transport",
".",
"TLSInfo",
")",
"(",
"net",
".",
"Listener",
",",
"error",
")",
"{",
"return",
"transport",
".",
"NewTimeoutListener",
"(",
"u",
".",
"Host",
",",
"u",
".",
"Scheme",
",",
"tlsinfo",
",",
"ConnReadTimeout",
",",
"ConnWriteTimeout",
")",
"\n",
"}"
] |
4,822 | all-4823 | [
"GetTextLength",
"()",
"is",
"a",
"wrapper",
"around",
"gtk_entry_get_text_length",
"()",
"."
] | [
"func",
"(",
"v",
"*",
"<mask>",
")",
"GetTextLength",
"(",
")",
"uint16",
"{",
"c",
":=",
"C",
".",
"gtk_entry_get_text_length",
"(",
"v",
".",
"native",
"(",
")",
")",
"\n",
"return",
"uint16",
"(",
"c",
")",
"\n",
"}"
] |
4,823 | all-4824 | [
"Sign",
"returns",
"the",
"signature",
"of",
"the",
"input",
"data"
] | [
"func",
"(",
"ePriv",
"*",
"ECDSAPrivateKey",
")",
"Sign",
"(",
"data",
"[",
"]",
"<mask>",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"hash",
":=",
"sha256",
".",
"Sum256",
"(",
"data",
")",
"\n",
"r",
",",
"s",
",",
"err",
":=",
"ecdsa",
".",
"Sign",
"(",
"rand",
".",
"Reader",
",",
"ePriv",
".",
"priv",
",",
"hash",
"[",
":",
"]",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"return",
"asn1",
".",
"Marshal",
"(",
"ECDSASig",
"{",
"R",
":",
"r",
",",
"S",
":",
"s",
",",
"}",
")",
"\n",
"}"
] |
4,824 | all-4825 | [
"calculatePorts",
"is",
"a",
"utility",
"function",
"that",
"returns",
"a",
"set",
"of",
"port",
"data",
"."
] | [
"func",
"calculatePorts",
"(",
"<mask>",
"[",
"]",
"types",
".",
"HostPortGroupPort",
")",
"*",
"schema",
".",
"Set",
"{",
"s",
":=",
"make",
"(",
"[",
"]",
"interface",
"{",
"}",
",",
"0",
")",
"\n",
"for",
"_",
",",
"port",
":=",
"range",
"ports",
"{",
"m",
":=",
"make",
"(",
"map",
"[",
"string",
"]",
"interface",
"{",
"}",
")",
"\n",
"m",
"[",
"\"",
"\"",
"]",
"=",
"port",
".",
"Key",
"\n",
"m",
"[",
"\"",
"\"",
"]",
"=",
"structure",
".",
"SliceStringsToInterfaces",
"(",
"port",
".",
"Mac",
")",
"\n",
"m",
"[",
"\"",
"\"",
"]",
"=",
"port",
".",
"Type",
"\n",
"s",
"=",
"append",
"(",
"s",
",",
"m",
")",
"\n",
"}",
"\n",
"return",
"schema",
".",
"NewSet",
"(",
"schema",
".",
"HashResource",
"(",
"portGroupPortSchema",
"(",
")",
")",
",",
"s",
")",
"\n",
"}"
] |
4,825 | all-4826 | [
"virtualSwitchIDsFromResourceID",
"passes",
"a",
"resource",
"s",
"ID",
"through",
"splitHostVirtualSwitchID",
"."
] | [
"func",
"virtualSwitchIDsFromResourceID",
"(",
"d",
"*",
"schema",
".",
"ResourceData",
")",
"(",
"string",
",",
"string",
",",
"error",
")",
"{",
"return",
"splitHostVirtualSwitchID",
"(",
"d",
".",
"<mask>",
"(",
")",
")",
"\n",
"}"
] |
4,826 | all-4827 | [
"Create",
"path",
"pattern",
"from",
"HTTP",
"verb",
"and",
"request",
"path"
] | [
"func",
"toPattern",
"(",
"verb",
",",
"path",
"string",
")",
"*",
"gen",
".",
"PathPattern",
"{",
"pattern",
":=",
"gen",
".",
"PathPattern",
"{",
"HTTPMethod",
":",
"verb",
",",
"Path",
":",
"path",
",",
"Pattern",
":",
"pathVariablesRegexp",
".",
"ReplaceAllLiteralString",
"(",
"<mask>",
",",
"\"",
"\"",
")",
",",
"Regexp",
":",
"pathVariablesRegexp",
".",
"ReplaceAllLiteralString",
"(",
"regexp",
".",
"QuoteMeta",
"(",
"path",
")",
",",
"`/([^/]+)`",
")",
",",
"}",
"\n",
"matches",
":=",
"pathVariablesRegexp",
".",
"FindAllStringSubmatch",
"(",
"path",
",",
"-",
"1",
")",
"\n",
"if",
"len",
"(",
"matches",
")",
">",
"0",
"{",
"pattern",
".",
"Variables",
"=",
"make",
"(",
"[",
"]",
"string",
",",
"len",
"(",
"matches",
")",
")",
"\n",
"for",
"i",
",",
"m",
":=",
"range",
"matches",
"{",
"pattern",
".",
"Variables",
"[",
"i",
"]",
"=",
"m",
"[",
"1",
"]",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"&",
"pattern",
"\n",
"}"
] |
4,827 | all-4828 | [
"Create",
"a",
"reader",
"that",
"limits",
"the",
"bandwidth",
"of",
"reads",
"made",
"from",
"r",
"according",
"to",
"the",
"supplied",
"throttler",
".",
"Reads",
"are",
"assumed",
"to",
"be",
"made",
"under",
"the",
"supplied",
"context",
"."
] | [
"func",
"ThrottledReader",
"(",
"ctx",
"context",
".",
"Context",
",",
"r",
"<mask>",
".",
"Reader",
",",
"throttle",
"Throttle",
")",
"io",
".",
"Reader",
"{",
"return",
"&",
"throttledReader",
"{",
"ctx",
":",
"ctx",
",",
"wrapped",
":",
"r",
",",
"throttle",
":",
"throttle",
",",
"}",
"\n",
"}"
] |
4,828 | all-4829 | [
"writeFrames",
"is",
"the",
"main",
"loop",
"that",
"pulls",
"frames",
"from",
"the",
"send",
"channel",
"and",
"writes",
"them",
"to",
"the",
"connection",
"."
] | [
"func",
"(",
"c",
"*",
"<mask>",
")",
"writeFrames",
"(",
"_",
"uint32",
")",
"{",
"for",
"{",
"select",
"{",
"case",
"f",
":=",
"<-",
"c",
".",
"sendCh",
":",
"if",
"c",
".",
"log",
".",
"Enabled",
"(",
"LogLevelDebug",
")",
"{",
"c",
".",
"log",
".",
"Debugf",
"(",
"\"",
"\"",
",",
"f",
".",
"Header",
")",
"\n",
"}",
"\n\n",
"c",
".",
"updateLastActivity",
"(",
"f",
")",
"\n",
"err",
":=",
"f",
".",
"WriteOut",
"(",
"c",
".",
"conn",
")",
"\n",
"c",
".",
"opts",
".",
"FramePool",
".",
"Release",
"(",
"f",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"c",
".",
"connectionError",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"return",
"\n",
"}",
"\n",
"case",
"<-",
"c",
".",
"stopCh",
":",
"// If there are frames in sendCh, we want to drain them.",
"if",
"len",
"(",
"c",
".",
"sendCh",
")",
">",
"0",
"{",
"continue",
"\n",
"}",
"\n",
"// Close the network once we're no longer writing frames.",
"c",
".",
"closeNetwork",
"(",
")",
"\n",
"return",
"\n",
"}",
"\n",
"}",
"\n",
"}"
] |
4,829 | all-4830 | [
"GetBlob",
"returns",
"a",
"stream",
"for",
"the",
"specified",
"blob",
"and",
"the",
"blob’s",
"size",
"(",
"or",
"-",
"1",
"if",
"unknown",
")",
".",
"The",
"Digest",
"field",
"in",
"BlobInfo",
"is",
"guaranteed",
"to",
"be",
"provided",
"Size",
"may",
"be",
"-",
"1",
"and",
"MediaType",
"may",
"be",
"optionally",
"provided",
".",
"May",
"update",
"BlobInfoCache",
"preferably",
"after",
"it",
"knows",
"for",
"certain",
"that",
"a",
"blob",
"truly",
"exists",
"at",
"a",
"specific",
"location",
"."
] | [
"func",
"(",
"s",
"*",
"openshiftImageSource",
")",
"GetBlob",
"(",
"ctx",
"context",
".",
"Context",
",",
"info",
"types",
".",
"BlobInfo",
",",
"cache",
"types",
".",
"BlobInfoCache",
")",
"(",
"io",
".",
"ReadCloser",
",",
"int64",
",",
"error",
")",
"{",
"if",
"err",
":=",
"s",
".",
"ensureImageIsResolved",
"(",
"ctx",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"0",
",",
"err",
"\n",
"}",
"\n",
"return",
"s",
".",
"docker",
".",
"GetBlob",
"(",
"ctx",
",",
"<mask>",
",",
"cache",
")",
"\n",
"}"
] |
4,830 | all-4831 | [
"Put",
"puts",
"an",
"id",
"/",
"hashtree",
"pair",
"in",
"the",
"cache",
"and",
"reads",
"the",
"hashtree",
"from",
"the",
"passed",
"in",
"io",
".",
"Reader",
"."
] | [
"func",
"(",
"c",
"*",
"MergeCache",
")",
"Put",
"(",
"id",
"int64",
",",
"tree",
"io",
".",
"Reader",
")",
"(",
"retErr",
"error",
")",
"{",
"return",
"c",
".",
"Cache",
".",
"Put",
"(",
"fmt",
".",
"Sprint",
"(",
"id",
")",
",",
"<mask>",
")",
"\n",
"}"
] |
4,831 | all-4832 | [
"Recv",
"returns",
"a",
"buffered",
"channel",
"(",
"of",
"the",
"size",
"given",
"to",
"New",
")",
"that",
"receives",
"messages",
"from",
"the",
"stream",
".",
"The",
"given",
"recv",
"func",
"should",
"return",
"a",
"new",
"proto",
"of",
"the",
"type",
"that",
"you",
"want",
"to",
"receive",
"If",
"you",
"want",
"to",
"receive",
"Recv",
"()",
"must",
"be",
"called",
"BEFORE",
"Run",
"()"
] | [
"func",
"(",
"s",
"*",
"Stream",
")",
"Recv",
"(",
"recv",
"func",
"(",
")",
"interface",
"{",
"}",
")",
"<-",
"chan",
"interface",
"{",
"}",
"{",
"s",
".",
"mu",
".",
"Lock",
"(",
")",
"\n",
"s",
".",
"recvFunc",
"=",
"recv",
"\n",
"buf",
":=",
"<mask>",
"(",
"chan",
"interface",
"{",
"}",
",",
"cap",
"(",
"s",
".",
"sendBuffer",
")",
")",
"\n",
"s",
".",
"recvBuffer",
"=",
"buf",
"\n",
"s",
".",
"mu",
".",
"Unlock",
"(",
")",
"\n",
"return",
"buf",
"\n",
"}"
] |
4,832 | all-4833 | [
"Add",
"adds",
"a",
"query",
"to",
"the",
"batch",
"."
] | [
"func",
"(",
"q",
"*",
"PQLBatchQuery",
")",
"Add",
"(",
"query",
"PQLQuery",
")",
"{",
"err",
":=",
"query",
".",
"Error",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"q",
".",
"err",
"=",
"err",
"\n",
"}",
"\n",
"serializedQuery",
":=",
"<mask>",
".",
"Serialize",
"(",
")",
"\n",
"q",
".",
"hasKeys",
"=",
"q",
".",
"hasKeys",
"||",
"serializedQuery",
".",
"HasWriteKeys",
"(",
")",
"\n",
"q",
".",
"queries",
"=",
"append",
"(",
"q",
".",
"queries",
",",
"serializedQuery",
".",
"String",
"(",
")",
")",
"\n",
"}"
] |
4,833 | all-4834 | [
"GetShowLegendOk",
"returns",
"a",
"tuple",
"with",
"the",
"ShowLegend",
"field",
"if",
"it",
"s",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"and",
"a",
"boolean",
"to",
"check",
"if",
"the",
"value",
"has",
"been",
"set",
"."
] | [
"func",
"(",
"t",
"*",
"TimeseriesDefinition",
")",
"GetShowLegendOk",
"(",
")",
"(",
"bool",
",",
"bool",
")",
"{",
"if",
"t",
"==",
"nil",
"||",
"t",
".",
"ShowLegend",
"==",
"nil",
"{",
"return",
"false",
",",
"<mask>",
"\n",
"}",
"\n",
"return",
"*",
"t",
".",
"ShowLegend",
",",
"true",
"\n",
"}"
] |
4,834 | all-4835 | [
"RunScript",
"allows",
"for",
"pure",
"plush",
"scripts",
"to",
"be",
"executed",
"."
] | [
"func",
"RunScript",
"(",
"input",
"string",
",",
"ctx",
"hctx",
".",
"Context",
")",
"error",
"{",
"input",
"=",
"\"",
"\"",
"+",
"input",
"+",
"\"",
"\"",
"\n\n",
"ctx",
"=",
"ctx",
".",
"New",
"(",
")",
"\n",
"ctx",
".",
"Set",
"(",
"\"",
"\"",
",",
"func",
"(",
"i",
"<mask>",
"{",
"}",
")",
"{",
"fmt",
".",
"Print",
"(",
"i",
")",
"\n",
"}",
")",
"\n",
"ctx",
".",
"Set",
"(",
"\"",
"\"",
",",
"func",
"(",
"i",
"interface",
"{",
"}",
")",
"{",
"fmt",
".",
"Println",
"(",
"i",
")",
"\n",
"}",
")",
"\n\n",
"_",
",",
"err",
":=",
"Render",
"(",
"input",
",",
"ctx",
")",
"\n",
"return",
"err",
"\n",
"}"
] |
4,835 | all-4836 | [
"MarshalJSON",
"supports",
"json",
".",
"Marshaler",
"interface"
] | [
"func",
"(",
"v",
"GetComputedStyleForNodeReturns",
")",
"MarshalJSON",
"(",
")",
"(",
"[",
"]",
"<mask>",
",",
"error",
")",
"{",
"w",
":=",
"jwriter",
".",
"Writer",
"{",
"}",
"\n",
"easyjsonC5a4559bEncodeGithubComChromedpCdprotoCss45",
"(",
"&",
"w",
",",
"v",
")",
"\n",
"return",
"w",
".",
"Buffer",
".",
"BuildBytes",
"(",
")",
",",
"w",
".",
"Error",
"\n",
"}"
] |
4,836 | all-4837 | [
"SetFromStock",
"is",
"a",
"wrapper",
"around",
"gtk_image_set_from_stock",
"()",
"."
] | [
"func",
"(",
"v",
"*",
"Image",
")",
"SetFromStock",
"(",
"stock",
"Stock",
",",
"size",
"IconSize",
")",
"{",
"cstr",
":=",
"C",
".",
"CString",
"(",
"string",
"(",
"stock",
")",
")",
"\n",
"defer",
"C",
".",
"free",
"(",
"unsafe",
".",
"Pointer",
"(",
"cstr",
")",
")",
"\n",
"C",
".",
"gtk_image_set_from_stock",
"(",
"v",
".",
"native",
"(",
")",
",",
"(",
"*",
"C",
".",
"gchar",
")",
"(",
"cstr",
")",
",",
"C",
".",
"GtkIconSize",
"(",
"<mask>",
")",
")",
"\n",
"}"
] |
4,837 | all-4838 | [
"GenerateClientCertificate",
"will",
"generate",
"the",
"needed",
"client",
".",
"crt",
"and",
"client",
".",
"key",
"if",
"needed"
] | [
"func",
"(",
"c",
"*",
"Config",
")",
"GenerateClientCertificate",
"(",
")",
"error",
"{",
"if",
"c",
".",
"HasClientCertificate",
"(",
")",
"{",
"return",
"nil",
"\n",
"}",
"\n\n",
"certf",
":=",
"c",
".",
"ConfigPath",
"(",
"\"",
"\"",
")",
"\n",
"keyf",
":=",
"c",
".",
"ConfigPath",
"(",
"\"",
"\"",
")",
"\n\n",
"return",
"shared",
".",
"FindOrGenCert",
"(",
"certf",
",",
"keyf",
",",
"<mask>",
")",
"\n",
"}"
] |
4,838 | all-4839 | [
"ServeTLS",
"serves",
"HTTPS",
"requests",
"from",
"the",
"given",
"listener",
".",
"certFile",
"and",
"keyFile",
"are",
"paths",
"to",
"TLS",
"certificate",
"and",
"key",
"files",
".",
"If",
"the",
"certFile",
"or",
"keyFile",
"has",
"not",
"been",
"provided",
"the",
"server",
"structure",
"the",
"function",
"will",
"use",
"previously",
"added",
"TLS",
"configuration",
"."
] | [
"func",
"(",
"s",
"*",
"<mask>",
")",
"ServeTLS",
"(",
"ln",
"net",
".",
"Listener",
",",
"certFile",
",",
"keyFile",
"string",
")",
"error",
"{",
"err",
":=",
"s",
".",
"AppendCert",
"(",
"certFile",
",",
"keyFile",
")",
"\n",
"if",
"err",
"!=",
"nil",
"&&",
"err",
"!=",
"errNoCertOrKeyProvided",
"{",
"return",
"err",
"\n",
"}",
"\n",
"if",
"s",
".",
"tlsConfig",
"==",
"nil",
"{",
"return",
"errNoCertOrKeyProvided",
"\n",
"}",
"\n",
"s",
".",
"tlsConfig",
".",
"BuildNameToCertificate",
"(",
")",
"\n\n",
"return",
"s",
".",
"Serve",
"(",
"tls",
".",
"NewListener",
"(",
"ln",
",",
"s",
".",
"tlsConfig",
")",
",",
")",
"\n",
"}"
] |
4,839 | all-4840 | [
"ReadByte",
"returns",
"the",
"next",
"byte",
"from",
"the",
"buffer",
"."
] | [
"func",
"(",
"r",
"*",
"ReadBuffer",
")",
"ReadByte",
"(",
")",
"(",
"<mask>",
",",
"error",
")",
"{",
"if",
"r",
".",
"err",
"!=",
"nil",
"{",
"return",
"0",
",",
"r",
".",
"err",
"\n",
"}",
"\n\n",
"if",
"len",
"(",
"r",
".",
"remaining",
")",
"<",
"1",
"{",
"r",
".",
"err",
"=",
"ErrEOF",
"\n",
"return",
"0",
",",
"r",
".",
"err",
"\n",
"}",
"\n\n",
"b",
":=",
"r",
".",
"remaining",
"[",
"0",
"]",
"\n",
"r",
".",
"remaining",
"=",
"r",
".",
"remaining",
"[",
"1",
":",
"]",
"\n",
"return",
"b",
",",
"nil",
"\n",
"}"
] |
4,840 | all-4841 | [
"NewTCPRawRelay",
"creates",
"a",
"relay",
"that",
"just",
"pipes",
"data",
"from",
"one",
"connection",
"to",
"another",
"directly",
"."
] | [
"func",
"NewTCPRawRelay",
"(",
"dests",
"[",
"]",
"string",
")",
"(",
"Relay",
",",
"error",
")",
"{",
"return",
"newTCPRelay",
"(",
"dests",
",",
"func",
"(",
"_",
"bool",
",",
"src",
",",
"dst",
"<mask>",
".",
"Conn",
")",
"{",
"io",
".",
"Copy",
"(",
"src",
",",
"dst",
")",
"\n",
"}",
")",
"\n",
"}"
] |
4,841 | all-4842 | [
"VerifyHeader",
"returns",
"a",
"handler",
"that",
"verifies",
"the",
"request",
"contains",
"the",
"passed",
"in",
"headers",
".",
"The",
"passed",
"in",
"header",
"keys",
"are",
"first",
"canonicalized",
"via",
"http",
".",
"CanonicalHeaderKey",
".",
"The",
"request",
"must",
"contain",
"*",
"all",
"*",
"the",
"passed",
"in",
"headers",
"but",
"it",
"is",
"allowed",
"to",
"have",
"additional",
"headers",
"beyond",
"the",
"passed",
"in",
"set",
"."
] | [
"func",
"VerifyHeader",
"(",
"header",
"http",
".",
"Header",
")",
"http",
".",
"HandlerFunc",
"{",
"return",
"func",
"(",
"w",
"http",
".",
"ResponseWriter",
",",
"req",
"*",
"http",
".",
"Request",
")",
"{",
"for",
"key",
",",
"values",
":=",
"range",
"header",
"{",
"key",
"=",
"http",
".",
"CanonicalHeaderKey",
"(",
"key",
")",
"\n",
"Expect",
"(",
"req",
".",
"Header",
"[",
"key",
"]",
")",
".",
"Should",
"(",
"Equal",
"(",
"values",
")",
",",
"\"",
"\"",
",",
"<mask>",
")",
"\n",
"}",
"\n",
"}",
"\n",
"}"
] |
4,842 | all-4843 | [
"GetImageFile",
"downloads",
"an",
"image",
"from",
"the",
"server",
"returning",
"an",
"ImageFileRequest",
"struct"
] | [
"func",
"(",
"r",
"*",
"ProtocolLXD",
")",
"GetImageFile",
"(",
"fingerprint",
"string",
",",
"req",
"ImageFileRequest",
")",
"(",
"*",
"ImageFileResponse",
",",
"<mask>",
")",
"{",
"return",
"r",
".",
"GetPrivateImageFile",
"(",
"fingerprint",
",",
"\"",
"\"",
",",
"req",
")",
"\n",
"}"
] |
4,843 | all-4844 | [
"TimeoutErrorWithCode",
"sets",
"response",
"body",
"to",
"msg",
"and",
"response",
"status",
"code",
"to",
"statusCode",
".",
"All",
"response",
"modifications",
"after",
"TimeoutErrorWithCode",
"call",
"are",
"ignored",
".",
"TimeoutErrorWithCode",
"MUST",
"be",
"called",
"before",
"returning",
"from",
"RequestHandler",
"if",
"there",
"are",
"references",
"to",
"ctx",
"and",
"/",
"or",
"its",
"members",
"in",
"other",
"goroutines",
"remain",
".",
"Usage",
"of",
"this",
"function",
"is",
"discouraged",
".",
"Prefer",
"eliminating",
"ctx",
"references",
"from",
"pending",
"goroutines",
"instead",
"of",
"using",
"this",
"function",
"."
] | [
"func",
"(",
"ctx",
"*",
"RequestCtx",
")",
"TimeoutErrorWithCode",
"(",
"msg",
"string",
",",
"statusCode",
"int",
")",
"{",
"var",
"resp",
"Response",
"\n",
"resp",
".",
"SetStatusCode",
"(",
"statusCode",
")",
"\n",
"resp",
".",
"SetBodyString",
"(",
"<mask>",
")",
"\n",
"ctx",
".",
"TimeoutErrorWithResponse",
"(",
"&",
"resp",
")",
"\n",
"}"
] |
4,844 | all-4845 | [
"GetPreferredWidth",
"is",
"a",
"wrapper",
"around",
"gtk_widget_get_preferred_width",
"()",
"."
] | [
"func",
"(",
"v",
"*",
"Widget",
")",
"GetPreferredWidth",
"(",
")",
"(",
"int",
",",
"int",
")",
"{",
"<mask>",
"minimum",
",",
"natural",
"C",
".",
"gint",
"\n",
"C",
".",
"gtk_widget_get_preferred_width",
"(",
"v",
".",
"native",
"(",
")",
",",
"&",
"minimum",
",",
"&",
"natural",
")",
"\n",
"return",
"int",
"(",
"minimum",
")",
",",
"int",
"(",
"natural",
")",
"\n",
"}"
] |
4,845 | all-4846 | [
"ReadResponse",
"reads",
"a",
"server",
"response",
"into",
"the",
"received",
"o",
"."
] | [
"func",
"(",
"o",
"*",
"UpdateVMReader",
")",
"ReadResponse",
"(",
"response",
"runtime",
".",
"ClientResponse",
",",
"consumer",
"runtime",
".",
"Consumer",
")",
"(",
"interface",
"{",
"}",
",",
"error",
")",
"{",
"switch",
"response",
".",
"Code",
"(",
")",
"{",
"case",
"200",
":",
"result",
":=",
"NewUpdateVMOK",
"(",
")",
"\n",
"if",
"err",
":=",
"result",
".",
"readResponse",
"(",
"response",
",",
"consumer",
",",
"o",
".",
"formats",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"return",
"result",
",",
"nil",
"\n\n",
"case",
"404",
":",
"result",
":=",
"NewUpdateVMNotFound",
"(",
")",
"\n",
"if",
"err",
":=",
"result",
".",
"readResponse",
"(",
"response",
",",
"consumer",
",",
"o",
".",
"formats",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"return",
"nil",
",",
"result",
"\n\n",
"default",
":",
"result",
":=",
"NewUpdateVMDefault",
"(",
"response",
".",
"Code",
"(",
")",
")",
"\n",
"if",
"err",
":=",
"<mask>",
".",
"readResponse",
"(",
"response",
",",
"consumer",
",",
"o",
".",
"formats",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"return",
"nil",
",",
"result",
"\n",
"}",
"\n",
"}"
] |
4,846 | all-4847 | [
"UnmarshalJSON",
"supports",
"json",
".",
"Unmarshaler",
"interface"
] | [
"func",
"(",
"v",
"*",
"DisposeBrowserContextParams",
")",
"UnmarshalJSON",
"(",
"data",
"[",
"]",
"byte",
")",
"error",
"{",
"r",
":=",
"jlexer",
".",
"Lexer",
"{",
"Data",
":",
"<mask>",
"}",
"\n",
"easyjsonC5a4559bDecodeGithubComChromedpCdprotoTarget20",
"(",
"&",
"r",
",",
"v",
")",
"\n",
"return",
"r",
".",
"Error",
"(",
")",
"\n",
"}"
] |
4,847 | all-4848 | [
"MarshalJSON",
"supports",
"json",
".",
"Marshaler",
"interface"
] | [
"func",
"(",
"v",
"GetDocumentParams",
")",
"MarshalJSON",
"(",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"w",
":=",
"jwriter",
".",
"Writer",
"{",
"}",
"\n",
"easyjsonC5a4559bEncodeGithubComChromedpCdprotoDom47",
"(",
"&",
"w",
",",
"v",
")",
"\n",
"return",
"w",
".",
"Buffer",
".",
"BuildBytes",
"(",
")",
",",
"w",
".",
"<mask>",
"\n",
"}"
] |
4,848 | all-4849 | [
"ToAsset",
"converts",
"a",
"to",
"a",
"proper",
"xdr",
".",
"Asset"
] | [
"func",
"(",
"a",
"AllowTrustOpAsset",
")",
"ToAsset",
"(",
"issuer",
"AccountId",
")",
"(",
"ret",
"Asset",
")",
"{",
"var",
"err",
"error",
"\n\n",
"switch",
"a",
".",
"Type",
"{",
"case",
"AssetTypeAssetTypeCreditAlphanum4",
":",
"ret",
",",
"err",
"=",
"NewAsset",
"(",
"AssetTypeAssetTypeCreditAlphanum4",
",",
"AssetAlphaNum4",
"{",
"AssetCode",
":",
"a",
".",
"MustAssetCode4",
"(",
")",
",",
"Issuer",
":",
"issuer",
",",
"}",
")",
"\n",
"<mask>",
"AssetTypeAssetTypeCreditAlphanum12",
":",
"ret",
",",
"err",
"=",
"NewAsset",
"(",
"AssetTypeAssetTypeCreditAlphanum12",
",",
"AssetAlphaNum12",
"{",
"AssetCode",
":",
"a",
".",
"MustAssetCode12",
"(",
")",
",",
"Issuer",
":",
"issuer",
",",
"}",
")",
"\n",
"default",
":",
"err",
"=",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"a",
".",
"Type",
")",
"\n",
"}",
"\n\n",
"if",
"err",
"!=",
"nil",
"{",
"panic",
"(",
"err",
")",
"\n",
"}",
"\n",
"return",
"\n",
"}"
] |
4,849 | all-4850 | [
"Next",
"would",
"advance",
"the",
"iterator",
"by",
"one",
".",
"Always",
"check",
"it",
".",
"Valid",
"()",
"after",
"a",
"Next",
"()",
"to",
"ensure",
"you",
"have",
"access",
"to",
"a",
"valid",
"it",
".",
"Item",
"()",
"."
] | [
"func",
"(",
"it",
"*",
"Iterator",
")",
"Next",
"(",
")",
"{",
"// Reuse current item",
"it",
".",
"item",
".",
"wg",
".",
"Wait",
"(",
")",
"// Just cleaner to wait before pushing to avoid doing ref counting.",
"\n",
"it",
".",
"waste",
".",
"push",
"(",
"it",
".",
"item",
")",
"\n\n",
"// Set next item to current",
"it",
".",
"item",
"=",
"it",
".",
"data",
".",
"<mask>",
"(",
")",
"\n\n",
"for",
"it",
".",
"iitr",
".",
"Valid",
"(",
")",
"{",
"if",
"it",
".",
"parseItem",
"(",
")",
"{",
"// parseItem calls one extra next.",
"// This is used to deal with the complexity of reverse iteration.",
"break",
"\n",
"}",
"\n",
"}",
"\n",
"}"
] |
4,850 | all-4851 | [
"PreCreateCheck",
"validates",
"if",
"driver",
"values",
"are",
"valid",
"to",
"create",
"the",
"machine",
"."
] | [
"func",
"(",
"d",
"*",
"Driver",
")",
"PreCreateCheck",
"(",
")",
"(",
"err",
"error",
")",
"{",
"if",
"d",
".",
"CustomDataFile",
"!=",
"\"",
"\"",
"{",
"if",
"_",
",",
"err",
":=",
"os",
".",
"Stat",
"(",
"d",
".",
"CustomDataFile",
")",
";",
"os",
".",
"IsNotExist",
"(",
"err",
")",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"d",
".",
"CustomDataFile",
")",
"\n",
"}",
"\n",
"}",
"\n\n",
"c",
",",
"err",
":=",
"d",
".",
"newAzureClient",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"// Register used resource providers with current Azure subscription.",
"if",
"err",
":=",
"c",
".",
"RegisterResourceProviders",
"(",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"// Validate if firewall rules can be read correctly",
"d",
".",
"ctx",
".",
"FirewallRules",
",",
"err",
"=",
"d",
".",
"getSecurityRules",
"(",
"d",
".",
"OpenPorts",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"// Check if virtual machine exists. An existing virtual machine cannot be updated.",
"<mask>",
".",
"Debug",
"(",
"\"",
"\"",
")",
"\n",
"if",
"exists",
",",
"err",
":=",
"c",
".",
"VirtualMachineExists",
"(",
"d",
".",
"ResourceGroup",
",",
"d",
".",
"naming",
"(",
")",
".",
"VM",
"(",
")",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"else",
"if",
"exists",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"d",
".",
"naming",
"(",
")",
".",
"VM",
"(",
")",
",",
"d",
".",
"ResourceGroup",
")",
"\n",
"}",
"\n\n",
"// NOTE(ahmetalpbalkan) we could have done more checks here but Azure often",
"// returns meaningful error messages and it would be repeating the backend",
"// logic on the client side. Some examples:",
"// - Deployment of a machine to an existing Virtual Network fails if",
"// virtual network is in a different region.",
"// - Changing IP Address space of a subnet would fail if there are machines",
"// running in the Virtual Network.",
"log",
".",
"Info",
"(",
"\"",
"\"",
")",
"\n",
"return",
"nil",
"\n",
"}"
] |
4,851 | all-4852 | [
"Fetch",
"queries",
"the",
"Consul",
"API",
"defined",
"by",
"the",
"given",
"client",
"and",
"returns",
"a",
"slice",
"of",
"CatalogService",
"objects",
"."
] | [
"func",
"(",
"d",
"*",
"CatalogServiceQuery",
")",
"Fetch",
"(",
"clients",
"*",
"ClientSet",
",",
"opts",
"*",
"QueryOptions",
")",
"(",
"interface",
"{",
"}",
",",
"*",
"ResponseMetadata",
",",
"error",
")",
"{",
"select",
"{",
"case",
"<-",
"d",
".",
"stopCh",
":",
"return",
"nil",
",",
"nil",
",",
"ErrStopped",
"\n",
"default",
":",
"}",
"\n\n",
"opts",
"=",
"opts",
".",
"Merge",
"(",
"&",
"QueryOptions",
"{",
"Datacenter",
":",
"d",
".",
"dc",
",",
"Near",
":",
"d",
".",
"near",
",",
"}",
")",
"\n\n",
"u",
":=",
"&",
"url",
".",
"URL",
"{",
"Path",
":",
"\"",
"\"",
"+",
"d",
".",
"name",
",",
"RawQuery",
":",
"opts",
".",
"String",
"(",
")",
",",
"}",
"\n",
"if",
"d",
".",
"tag",
"!=",
"\"",
"\"",
"{",
"q",
":=",
"u",
".",
"Query",
"(",
")",
"\n",
"q",
".",
"Set",
"(",
"\"",
"\"",
",",
"d",
".",
"tag",
")",
"\n",
"u",
".",
"RawQuery",
"=",
"q",
".",
"Encode",
"(",
")",
"\n",
"}",
"\n",
"log",
".",
"Printf",
"(",
"\"",
"\"",
",",
"d",
",",
"u",
")",
"\n\n",
"entries",
",",
"qm",
",",
"err",
":=",
"clients",
".",
"Consul",
"(",
")",
".",
"Catalog",
"(",
")",
".",
"Service",
"(",
"d",
".",
"name",
",",
"d",
".",
"tag",
",",
"opts",
".",
"ToConsulOpts",
"(",
")",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"nil",
",",
"errors",
".",
"Wrap",
"(",
"err",
",",
"d",
".",
"String",
"(",
")",
")",
"\n",
"}",
"\n\n",
"log",
".",
"Printf",
"(",
"\"",
"\"",
",",
"d",
",",
"len",
"(",
"entries",
")",
")",
"\n\n",
"var",
"list",
"[",
"]",
"*",
"CatalogService",
"\n",
"for",
"_",
",",
"s",
":=",
"range",
"entries",
"{",
"list",
"=",
"append",
"(",
"list",
",",
"&",
"CatalogService",
"{",
"ID",
":",
"s",
".",
"ID",
",",
"Node",
":",
"s",
".",
"Node",
",",
"<mask>",
":",
"s",
".",
"Address",
",",
"Datacenter",
":",
"s",
".",
"Datacenter",
",",
"TaggedAddresses",
":",
"s",
".",
"TaggedAddresses",
",",
"NodeMeta",
":",
"s",
".",
"NodeMeta",
",",
"ServiceID",
":",
"s",
".",
"ServiceID",
",",
"ServiceName",
":",
"s",
".",
"ServiceName",
",",
"ServiceAddress",
":",
"s",
".",
"ServiceAddress",
",",
"ServiceTags",
":",
"ServiceTags",
"(",
"deepCopyAndSortTags",
"(",
"s",
".",
"ServiceTags",
")",
")",
",",
"ServiceMeta",
":",
"s",
".",
"ServiceMeta",
",",
"ServicePort",
":",
"s",
".",
"ServicePort",
",",
"}",
")",
"\n",
"}",
"\n\n",
"rm",
":=",
"&",
"ResponseMetadata",
"{",
"LastIndex",
":",
"qm",
".",
"LastIndex",
",",
"LastContact",
":",
"qm",
".",
"LastContact",
",",
"}",
"\n\n",
"return",
"list",
",",
"rm",
",",
"nil",
"\n",
"}"
] |
4,852 | all-4853 | [
"/",
"*",
"Fatalm",
"uses",
"msg",
"as",
"a",
"format",
"string",
"with",
"subsequent",
"parameters",
"as",
"values",
"and",
"logs",
"the",
"resulting",
"message",
"to",
"all",
"added",
"loggers",
"at",
"LogLevel",
".",
"LevelFatal",
".",
"It",
"will",
"also",
"merge",
"all",
"attributes",
"passed",
"in",
"m",
"with",
"any",
"attributes",
"added",
"to",
"Base",
"and",
"include",
"them",
"with",
"the",
"message",
"if",
"the",
"Logger",
"supports",
"it",
"."
] | [
"func",
"(",
"b",
"*",
"<mask>",
")",
"Fatalm",
"(",
"m",
"*",
"Attrs",
",",
"msg",
"string",
",",
"a",
"...",
"interface",
"{",
"}",
")",
"error",
"{",
"return",
"b",
".",
"Log",
"(",
"LevelFatal",
",",
"m",
",",
"msg",
",",
"a",
"...",
")",
"\n",
"}"
] |
4,853 | all-4854 | [
"NewMockSSMClient",
"creates",
"a",
"new",
"mock",
"instance"
] | [
"func",
"NewMockSSMClient",
"(",
"ctrl",
"*",
"gomock",
".",
"<mask>",
")",
"*",
"MockSSMClient",
"{",
"mock",
":=",
"&",
"MockSSMClient",
"{",
"ctrl",
":",
"ctrl",
"}",
"\n",
"mock",
".",
"recorder",
"=",
"&",
"MockSSMClientMockRecorder",
"{",
"mock",
"}",
"\n",
"return",
"mock",
"\n",
"}"
] |
4,854 | all-4855 | [
"ErrUnsupportedIdentity",
"indicates",
"the",
"processor",
"does",
"not",
"support",
"the",
"given",
"identity",
"type",
"."
] | [
"func",
"ErrUnsupportedIdentity",
"(",
"<mask>",
"Identity",
")",
"error",
"{",
"return",
"ErrorResponse",
"{",
"Code",
":",
"http",
".",
"StatusNotImplemented",
",",
"Message",
":",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"id",
".",
"Type",
",",
"id",
".",
"Format",
")",
",",
"}",
"\n",
"}"
] |
4,855 | all-4856 | [
"manifestDigest",
"returns",
"a",
"digest",
"of",
"the",
"manifest",
"from",
"instanceDigest",
"if",
"non",
"-",
"nil",
";",
"or",
"from",
"the",
"supplied",
"reference",
"or",
"finally",
"from",
"a",
"fetched",
"manifest",
"."
] | [
"func",
"(",
"s",
"*",
"dockerImageSource",
")",
"manifestDigest",
"(",
"ctx",
"context",
".",
"Context",
",",
"instanceDigest",
"*",
"digest",
".",
"Digest",
")",
"(",
"digest",
".",
"Digest",
",",
"error",
")",
"{",
"if",
"instanceDigest",
"!=",
"nil",
"{",
"return",
"*",
"instanceDigest",
",",
"nil",
"\n",
"}",
"\n",
"if",
"digested",
",",
"ok",
":=",
"s",
".",
"ref",
".",
"ref",
".",
"(",
"<mask>",
".",
"Digested",
")",
";",
"ok",
"{",
"d",
":=",
"digested",
".",
"Digest",
"(",
")",
"\n",
"if",
"d",
".",
"Algorithm",
"(",
")",
"==",
"digest",
".",
"Canonical",
"{",
"return",
"d",
",",
"nil",
"\n",
"}",
"\n",
"}",
"\n",
"if",
"err",
":=",
"s",
".",
"ensureManifestIsLoaded",
"(",
"ctx",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"\"",
"\"",
",",
"err",
"\n",
"}",
"\n",
"return",
"manifest",
".",
"Digest",
"(",
"s",
".",
"cachedManifest",
")",
"\n",
"}"
] |
4,856 | all-4857 | [
"UnmarshalJSON",
"satisfies",
"json",
".",
"Unmarshaler",
"."
] | [
"func",
"(",
"t",
"*",
"BackendNodeID",
")",
"UnmarshalJSON",
"(",
"buf",
"[",
"]",
"<mask>",
")",
"error",
"{",
"return",
"easyjson",
".",
"Unmarshal",
"(",
"buf",
",",
"t",
")",
"\n",
"}"
] |
4,857 | all-4858 | [
"New",
"creates",
"a",
"new",
"Kubernetes",
"discovery",
"for",
"the",
"given",
"role",
"."
] | [
"func",
"New",
"(",
"l",
"log",
".",
"Logger",
",",
"conf",
"*",
"SDConfig",
")",
"(",
"*",
"Discovery",
",",
"error",
")",
"{",
"if",
"l",
"==",
"nil",
"{",
"l",
"=",
"log",
".",
"NewNopLogger",
"(",
")",
"\n",
"}",
"\n",
"var",
"(",
"kcfg",
"*",
"rest",
".",
"Config",
"\n",
"err",
"error",
"\n",
")",
"\n",
"if",
"conf",
".",
"APIServer",
".",
"<mask>",
"==",
"nil",
"{",
"// Use the Kubernetes provided pod service account",
"// as described in https://kubernetes.io/docs/admin/service-accounts-admin/",
"kcfg",
",",
"err",
"=",
"rest",
".",
"InClusterConfig",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"level",
".",
"Info",
"(",
"l",
")",
".",
"Log",
"(",
"\"",
"\"",
",",
"\"",
"\"",
")",
"\n",
"}",
"else",
"{",
"rt",
",",
"err",
":=",
"config_util",
".",
"NewRoundTripperFromConfig",
"(",
"conf",
".",
"HTTPClientConfig",
",",
"\"",
"\"",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"kcfg",
"=",
"&",
"rest",
".",
"Config",
"{",
"Host",
":",
"conf",
".",
"APIServer",
".",
"String",
"(",
")",
",",
"Transport",
":",
"rt",
",",
"}",
"\n",
"}",
"\n\n",
"kcfg",
".",
"UserAgent",
"=",
"\"",
"\"",
"\n\n",
"c",
",",
"err",
":=",
"kubernetes",
".",
"NewForConfig",
"(",
"kcfg",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"return",
"&",
"Discovery",
"{",
"client",
":",
"c",
",",
"logger",
":",
"l",
",",
"role",
":",
"conf",
".",
"Role",
",",
"namespaceDiscovery",
":",
"&",
"conf",
".",
"NamespaceDiscovery",
",",
"discoverers",
":",
"make",
"(",
"[",
"]",
"discoverer",
",",
"0",
")",
",",
"}",
",",
"nil",
"\n",
"}"
] |
4,858 | all-4859 | [
"SetApplication",
"is",
"a",
"wrapper",
"around",
"gtk_window_set_application",
"()",
"."
] | [
"func",
"(",
"v",
"*",
"Window",
")",
"SetApplication",
"(",
"a",
"*",
"<mask>",
")",
"{",
"C",
".",
"gtk_window_set_application",
"(",
"v",
".",
"native",
"(",
")",
",",
"a",
".",
"native",
"(",
")",
")",
"\n",
"}"
] |
4,859 | all-4860 | [
"ThemeInfo",
"returns",
"detailed",
"info",
"about",
"theme"
] | [
"func",
"ThemeInfo",
"(",
"name",
"string",
")",
"ThemeDesc",
"{",
"themeManager",
".",
"loadTheme",
"(",
"name",
")",
"\n\n",
"thememtx",
".",
"RLock",
"(",
")",
"\n",
"defer",
"thememtx",
".",
"RUnlock",
"(",
")",
"\n\n",
"var",
"theme",
"ThemeDesc",
"\n",
"if",
"t",
",",
"ok",
":=",
"themeManager",
".",
"themes",
"[",
"name",
"]",
";",
"!",
"ok",
"{",
"theme",
".",
"parent",
"=",
"t",
".",
"<mask>",
"\n",
"theme",
".",
"title",
"=",
"t",
".",
"title",
"\n",
"theme",
".",
"version",
"=",
"t",
".",
"version",
"\n",
"}",
"\n",
"return",
"theme",
"\n",
"}"
] |
4,860 | all-4861 | [
"Logf",
"logs",
"provided",
"message",
"with",
"formatting",
"with",
"default",
"logger",
"."
] | [
"func",
"Logf",
"(",
"level",
"Level",
",",
"format",
"string",
",",
"a",
"...",
"interface",
"{",
"}",
")",
"{",
"getDefaultLogger",
"(",
")",
".",
"log",
"(",
"level",
",",
"<mask>",
",",
"a",
"...",
")",
"\n",
"}"
] |
4,861 | all-4862 | [
"UpExpire",
"refresh",
"session",
"expire"
] | [
"func",
"(",
"rp",
"*",
"redisProvider",
")",
"UpExpire",
"(",
"sid",
"string",
")",
"error",
"{",
"var",
"err",
"error",
"\n",
"redisPool",
".",
"Exec",
"(",
"func",
"(",
"c",
"*",
"redis",
".",
"<mask>",
")",
"{",
"err",
"=",
"c",
".",
"Expire",
"(",
"sid",
",",
"sessExpire",
")",
".",
"Err",
"(",
")",
"\n",
"}",
")",
"\n",
"return",
"err",
"\n",
"}"
] |
4,862 | all-4863 | [
"MustBeRunning",
"will",
"return",
"an",
"error",
"if",
"the",
"machine",
"is",
"not",
"in",
"a",
"running",
"state",
"."
] | [
"func",
"MustBeRunning",
"(",
"d",
"Driver",
")",
"error",
"{",
"s",
",",
"err",
":=",
"d",
".",
"GetState",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"if",
"s",
"!=",
"<mask>",
".",
"Running",
"{",
"return",
"ErrHostIsNotRunning",
"\n",
"}",
"\n\n",
"return",
"nil",
"\n",
"}"
] |
4,863 | all-4864 | [
"returns",
"the",
"call",
"price",
"by",
"number"
] | [
"func",
"(",
"nvps",
"*",
"NumberVoicePriceService",
")",
"Get",
"(",
"ctx",
"<mask>",
".",
"Context",
",",
"number",
"string",
")",
"(",
"*",
"VoiceNumberPrice",
",",
"error",
")",
"{",
"voiceNumPrice",
":=",
"new",
"(",
"VoiceNumberPrice",
")",
"\n",
"err",
":=",
"nvps",
".",
"client",
".",
"GetResource",
"(",
"ctx",
",",
"voicePathPart",
"+",
"\"",
"\"",
",",
"number",
",",
"voiceNumPrice",
")",
"\n",
"return",
"voiceNumPrice",
",",
"err",
"\n",
"}"
] |
4,864 | all-4865 | [
"ResolveRows",
"resolves",
"a",
"[]",
"PlanValue",
"as",
"rows",
"based",
"on",
"the",
"supplied",
"bindvars",
"."
] | [
"func",
"ResolveRows",
"(",
"pvs",
"[",
"]",
"PlanValue",
",",
"bindVars",
"map",
"[",
"string",
"]",
"*",
"querypb",
".",
"BindVariable",
")",
"(",
"[",
"]",
"[",
"]",
"Value",
",",
"error",
")",
"{",
"count",
",",
"err",
":=",
"rowCount",
"(",
"pvs",
",",
"bindVars",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"// Allocate the rows.",
"rows",
":=",
"make",
"(",
"[",
"]",
"[",
"]",
"Value",
",",
"count",
")",
"\n",
"for",
"i",
":=",
"range",
"rows",
"{",
"rows",
"[",
"i",
"]",
"=",
"make",
"(",
"[",
"]",
"Value",
",",
"len",
"(",
"pvs",
")",
")",
"\n",
"}",
"\n\n",
"// Using j becasue we're resolving by columns.",
"for",
"j",
",",
"pv",
":=",
"range",
"pvs",
"{",
"<mask>",
"{",
"case",
"pv",
".",
"Key",
"!=",
"\"",
"\"",
":",
"bv",
",",
"err",
":=",
"pv",
".",
"lookupValue",
"(",
"bindVars",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"for",
"i",
":=",
"range",
"rows",
"{",
"rows",
"[",
"i",
"]",
"[",
"j",
"]",
"=",
"MakeTrusted",
"(",
"bv",
".",
"Type",
",",
"bv",
".",
"Value",
")",
"\n",
"}",
"\n",
"case",
"!",
"pv",
".",
"Value",
".",
"IsNull",
"(",
")",
":",
"for",
"i",
":=",
"range",
"rows",
"{",
"rows",
"[",
"i",
"]",
"[",
"j",
"]",
"=",
"pv",
".",
"Value",
"\n",
"}",
"\n",
"case",
"pv",
".",
"ListKey",
"!=",
"\"",
"\"",
":",
"bv",
",",
"err",
":=",
"pv",
".",
"lookupList",
"(",
"bindVars",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"// This code is unreachable because pvRowCount already checks this.",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"for",
"i",
":=",
"range",
"rows",
"{",
"rows",
"[",
"i",
"]",
"[",
"j",
"]",
"=",
"MakeTrusted",
"(",
"bv",
".",
"Values",
"[",
"i",
"]",
".",
"Type",
",",
"bv",
".",
"Values",
"[",
"i",
"]",
".",
"Value",
")",
"\n",
"}",
"\n",
"case",
"pv",
".",
"Values",
"!=",
"nil",
":",
"for",
"i",
":=",
"range",
"rows",
"{",
"rows",
"[",
"i",
"]",
"[",
"j",
"]",
",",
"err",
"=",
"pv",
".",
"Values",
"[",
"i",
"]",
".",
"ResolveValue",
"(",
"bindVars",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"}",
"\n",
"// default case is a NULL value, which the row values are already initialized to.",
"}",
"\n",
"}",
"\n",
"return",
"rows",
",",
"nil",
"\n",
"}"
] |
4,865 | all-4866 | [
"ApplyChanges",
"applies",
"a",
"given",
"set",
"of",
"changes",
"in",
"a",
"given",
"zone",
"."
] | [
"func",
"(",
"r",
"rfc2136Provider",
")",
"ApplyChanges",
"(",
"changes",
"*",
"plan",
".",
"Changes",
")",
"error",
"{",
"log",
".",
"Debugf",
"(",
"\"",
"\"",
")",
"\n\n",
"for",
"_",
",",
"ep",
":=",
"range",
"<mask>",
".",
"Create",
"{",
"if",
"!",
"r",
".",
"domainFilter",
".",
"Match",
"(",
"ep",
".",
"DNSName",
")",
"{",
"log",
".",
"Debugf",
"(",
"\"",
"\"",
",",
"ep",
".",
"DNSName",
")",
"\n",
"continue",
"\n",
"}",
"\n\n",
"r",
".",
"AddRecord",
"(",
"ep",
")",
"\n",
"}",
"\n",
"for",
"_",
",",
"ep",
":=",
"range",
"changes",
".",
"UpdateNew",
"{",
"if",
"!",
"r",
".",
"domainFilter",
".",
"Match",
"(",
"ep",
".",
"DNSName",
")",
"{",
"log",
".",
"Debugf",
"(",
"\"",
"\"",
",",
"ep",
".",
"DNSName",
")",
"\n",
"continue",
"\n",
"}",
"\n\n",
"r",
".",
"UpdateRecord",
"(",
"ep",
")",
"\n",
"}",
"\n",
"for",
"_",
",",
"ep",
":=",
"range",
"changes",
".",
"Delete",
"{",
"if",
"!",
"r",
".",
"domainFilter",
".",
"Match",
"(",
"ep",
".",
"DNSName",
")",
"{",
"log",
".",
"Debugf",
"(",
"\"",
"\"",
",",
"ep",
".",
"DNSName",
")",
"\n",
"continue",
"\n",
"}",
"\n\n",
"r",
".",
"RemoveRecord",
"(",
"ep",
")",
"\n",
"}",
"\n\n",
"return",
"nil",
"\n",
"}"
] |
4,866 | all-4867 | [
"Execute",
"-",
"creates",
"spaces"
] | [
"func",
"(",
"c",
"*",
"CreateSpacesCommand",
")",
"Execute",
"(",
"[",
"]",
"string",
")",
"error",
"{",
"<mask>",
"cfMgmt",
"*",
"CFMgmt",
"\n",
"var",
"err",
"error",
"\n",
"if",
"cfMgmt",
",",
"err",
"=",
"InitializePeekManagers",
"(",
"c",
".",
"BaseCFConfigCommand",
",",
"c",
".",
"Peek",
")",
";",
"err",
"==",
"nil",
"{",
"err",
"=",
"cfMgmt",
".",
"SpaceManager",
".",
"CreateSpaces",
"(",
")",
"\n",
"}",
"\n",
"return",
"err",
"\n",
"}"
] |
4,867 | all-4868 | [
"addIdent",
"adds",
"an",
"accessor",
"for",
"an",
"identifier",
"for",
"a",
"given",
"receiver",
"and",
"field"
] | [
"func",
"(",
"t",
"*",
"templateData",
")",
"addIdent",
"(",
"x",
"*",
"ast",
".",
"Ident",
",",
"receiverType",
",",
"fieldName",
"string",
")",
"{",
"<mask>",
"zeroValue",
"string",
"\n",
"switch",
"x",
".",
"String",
"(",
")",
"{",
"case",
"\"",
"\"",
":",
"zeroValue",
"=",
"\"",
"\"",
"\n",
"case",
"\"",
"\"",
":",
"zeroValue",
"=",
"`\"\"`",
"\n",
"case",
"\"",
"\"",
":",
"zeroValue",
"=",
"\"",
"\"",
"\n",
"case",
"\"",
"\"",
":",
"zeroValue",
"=",
"\"",
"\"",
"\n",
"case",
"\"",
"\"",
":",
"zeroValue",
"=",
"\"",
"\"",
"\n",
"case",
"\"",
"\"",
":",
"zeroValue",
"=",
"`\"\"`",
"\n",
"default",
":",
"zeroValue",
"=",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"x",
".",
"String",
"(",
")",
")",
"\n",
"}",
"\n\n",
"t",
".",
"Accessors",
"=",
"append",
"(",
"t",
".",
"Accessors",
",",
"newAccessor",
"(",
"receiverType",
",",
"fieldName",
",",
"x",
".",
"String",
"(",
")",
",",
"zeroValue",
")",
")",
"\n",
"}"
] |
4,868 | all-4869 | [
"GetCustomBgColorOk",
"returns",
"a",
"tuple",
"with",
"the",
"CustomBgColor",
"field",
"if",
"it",
"s",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"and",
"a",
"boolean",
"to",
"check",
"if",
"the",
"value",
"has",
"been",
"set",
"."
] | [
"func",
"(",
"w",
"*",
"WidgetConditionalFormat",
")",
"GetCustomBgColorOk",
"(",
")",
"(",
"string",
",",
"bool",
")",
"{",
"if",
"w",
"==",
"nil",
"||",
"w",
".",
"CustomBgColor",
"==",
"nil",
"{",
"return",
"\"",
"\"",
",",
"false",
"\n",
"}",
"\n",
"return",
"*",
"w",
".",
"CustomBgColor",
",",
"<mask>",
"\n",
"}"
] |
4,869 | all-4870 | [
"UnmarshalYAML",
"implements",
"Unmarshaler",
".",
"Avoid",
"use",
"of",
"env",
"in",
"the",
"YAML",
"file",
"."
] | [
"func",
"(",
"se",
"*",
"SMTPEnvironment",
")",
"UnmarshalYAML",
"(",
"unmarshal",
"func",
"(",
"interface",
"{",
"}",
")",
"error",
")",
"error",
"{",
"var",
"aux",
"struct",
"{",
"Env",
"map",
"[",
"string",
"]",
"struct",
"{",
"Config",
"Config",
"`yaml:\"smtp\"`",
"\n",
"}",
"\n",
"}",
"\n",
"if",
"err",
":=",
"unmarshal",
"(",
"&",
"aux",
".",
"Env",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"se",
".",
"Env",
"=",
"make",
"(",
"<mask>",
"[",
"string",
"]",
"Config",
")",
"\n",
"for",
"env",
",",
"conf",
":=",
"range",
"aux",
".",
"Env",
"{",
"se",
".",
"Env",
"[",
"env",
"]",
"=",
"conf",
".",
"Config",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
] |
4,870 | all-4871 | [
"WithTimeout",
"adds",
"the",
"timeout",
"to",
"the",
"find",
"vms",
"by",
"deployment",
"params"
] | [
"func",
"(",
"o",
"*",
"FindVmsByDeploymentParams",
")",
"WithTimeout",
"(",
"timeout",
"<mask>",
".",
"Duration",
")",
"*",
"FindVmsByDeploymentParams",
"{",
"o",
".",
"SetTimeout",
"(",
"timeout",
")",
"\n",
"return",
"o",
"\n",
"}"
] |
4,871 | all-4872 | [
"Performs",
"a",
"git",
"commit",
"and",
"push",
"of",
"the",
"current",
"cluster",
"changes",
"."
] | [
"func",
"(",
"git",
"*",
"JSONGitStore",
")",
"Commit",
"(",
"c",
"*",
"cluster",
".",
"Cluster",
")",
"error",
"{",
"if",
"c",
"==",
"nil",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"bytes",
",",
"err",
":=",
"json",
".",
"Marshal",
"(",
"c",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"//writes latest changes to git repo.",
"<mask>",
".",
"Write",
"(",
"state",
".",
"ClusterJSONFile",
",",
"bytes",
")",
"\n\n",
"//commits the changes",
"r",
",",
"err",
":=",
"g",
".",
"NewFilesystemRepository",
"(",
"state",
".",
"ClusterJSONFile",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"// Add a new remote, with the default fetch refspec",
"_",
",",
"err",
"=",
"r",
".",
"CreateRemote",
"(",
"&",
"config",
".",
"RemoteConfig",
"{",
"Name",
":",
"git",
".",
"ClusterName",
",",
"URL",
":",
"git",
".",
"options",
".",
"CommitConfig",
".",
"Remote",
",",
"}",
")",
"\n",
"_",
",",
"err",
"=",
"r",
".",
"Commits",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
] |
4,872 | all-4873 | [
"UnmarshalJSON",
"unmarshals",
"JSON",
"strings",
"coming",
"from",
"OpenTSDB",
"into",
"Go",
"strings",
"by",
"applying",
"the",
"inverse",
"of",
"what",
"is",
"described",
"for",
"the",
"MarshalJSON",
"method",
"."
] | [
"func",
"(",
"<mask>",
"*",
"TagValue",
")",
"UnmarshalJSON",
"(",
"json",
"[",
"]",
"byte",
")",
"error",
"{",
"escapeLevel",
":=",
"0",
"// How many bytes after '_'.",
"\n",
"var",
"parsedByte",
"byte",
"\n\n",
"// Might need fewer bytes, but let's avoid realloc.",
"result",
":=",
"bytes",
".",
"NewBuffer",
"(",
"make",
"(",
"[",
"]",
"byte",
",",
"0",
",",
"len",
"(",
"json",
")",
"-",
"2",
")",
")",
"\n\n",
"for",
"i",
",",
"b",
":=",
"range",
"json",
"{",
"if",
"i",
"==",
"0",
"{",
"if",
"b",
"!=",
"'\"'",
"{",
"return",
"errors",
".",
"Errorf",
"(",
"\"",
"\\\"",
"\"",
",",
"b",
")",
"\n",
"}",
"\n",
"continue",
"\n",
"}",
"\n",
"if",
"i",
"==",
"len",
"(",
"json",
")",
"-",
"1",
"{",
"if",
"b",
"!=",
"'\"'",
"{",
"return",
"errors",
".",
"Errorf",
"(",
"\"",
"\\\"",
"\"",
",",
"b",
")",
"\n",
"}",
"\n",
"break",
"\n",
"}",
"\n",
"switch",
"escapeLevel",
"{",
"case",
"0",
":",
"if",
"b",
"==",
"'_'",
"{",
"escapeLevel",
"=",
"1",
"\n",
"continue",
"\n",
"}",
"\n",
"result",
".",
"WriteByte",
"(",
"b",
")",
"\n",
"case",
"1",
":",
"switch",
"{",
"case",
"b",
"==",
"'_'",
":",
"result",
".",
"WriteByte",
"(",
"'_'",
")",
"\n",
"escapeLevel",
"=",
"0",
"\n",
"case",
"b",
"==",
"'.'",
":",
"result",
".",
"WriteByte",
"(",
"':'",
")",
"\n",
"escapeLevel",
"=",
"0",
"\n",
"case",
"b",
">=",
"'0'",
"&&",
"b",
"<=",
"'9'",
":",
"parsedByte",
"=",
"(",
"b",
"-",
"48",
")",
"<<",
"4",
"\n",
"escapeLevel",
"=",
"2",
"\n",
"case",
"b",
">=",
"'A'",
"&&",
"b",
"<=",
"'F'",
":",
"// A-F",
"parsedByte",
"=",
"(",
"b",
"-",
"55",
")",
"<<",
"4",
"\n",
"escapeLevel",
"=",
"2",
"\n",
"default",
":",
"return",
"errors",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"i",
",",
"b",
",",
")",
"\n",
"}",
"\n",
"case",
"2",
":",
"switch",
"{",
"case",
"b",
">=",
"'0'",
"&&",
"b",
"<=",
"'9'",
":",
"parsedByte",
"+=",
"b",
"-",
"48",
"\n",
"case",
"b",
">=",
"'A'",
"&&",
"b",
"<=",
"'F'",
":",
"// A-F",
"parsedByte",
"+=",
"b",
"-",
"55",
"\n",
"default",
":",
"return",
"errors",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"i",
",",
"b",
",",
")",
"\n",
"}",
"\n",
"result",
".",
"WriteByte",
"(",
"parsedByte",
")",
"\n",
"escapeLevel",
"=",
"0",
"\n",
"default",
":",
"panic",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"}",
"\n",
"*",
"tv",
"=",
"TagValue",
"(",
"result",
".",
"String",
"(",
")",
")",
"\n",
"return",
"nil",
"\n",
"}"
] |
4,873 | all-4874 | [
"Generate",
"the",
"name",
"the",
"runtime",
"uses",
"for",
"a",
"dwarf",
"type",
".",
"The",
"DWARF",
"generator",
"and",
"the",
"runtime",
"use",
"slightly",
"different",
"names",
"for",
"the",
"same",
"underlying",
"type",
"."
] | [
"func",
"runtimeName",
"(",
"dt",
"dwarf",
".",
"Type",
")",
"string",
"{",
"switch",
"x",
":=",
"dt",
".",
"(",
"type",
")",
"{",
"case",
"*",
"dwarf",
".",
"PtrType",
":",
"if",
"_",
",",
"<mask>",
":=",
"x",
".",
"Type",
".",
"(",
"*",
"dwarf",
".",
"VoidType",
")",
";",
"ok",
"{",
"return",
"\"",
"\"",
"\n",
"}",
"\n",
"return",
"\"",
"\"",
"+",
"runtimeName",
"(",
"x",
".",
"Type",
")",
"\n",
"case",
"*",
"dwarf",
".",
"ArrayType",
":",
"return",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"x",
".",
"Count",
",",
"runtimeName",
"(",
"x",
".",
"Type",
")",
")",
"\n",
"case",
"*",
"dwarf",
".",
"StructType",
":",
"if",
"!",
"strings",
".",
"HasPrefix",
"(",
"x",
".",
"StructName",
",",
"\"",
"\"",
")",
"{",
"// This is a named type, return that name.",
"return",
"stripPackagePath",
"(",
"x",
".",
"StructName",
")",
"\n",
"}",
"\n",
"// Figure out which fields have anonymous names.",
"var",
"anon",
"[",
"]",
"bool",
"\n",
"for",
"_",
",",
"f",
":=",
"range",
"strings",
".",
"Split",
"(",
"x",
".",
"StructName",
"[",
"8",
":",
"len",
"(",
"x",
".",
"StructName",
")",
"-",
"1",
"]",
",",
"\"",
"\"",
")",
"{",
"f",
"=",
"strings",
".",
"TrimSpace",
"(",
"f",
")",
"\n",
"anon",
"=",
"append",
"(",
"anon",
",",
"!",
"strings",
".",
"Contains",
"(",
"f",
",",
"\"",
"\"",
")",
")",
"\n",
"// TODO: this isn't perfect. If the field type has a space in it,",
"// then this logic doesn't work. Need to search for keyword for",
"// field type, like \"interface\", \"struct\", ...",
"}",
"\n",
"// Make sure anon is long enough. This probably never triggers.",
"for",
"len",
"(",
"anon",
")",
"<",
"len",
"(",
"x",
".",
"Field",
")",
"{",
"anon",
"=",
"append",
"(",
"anon",
",",
"false",
")",
"\n",
"}",
"\n\n",
"// Build runtime name from the DWARF fields.",
"s",
":=",
"\"",
"\"",
"\n",
"first",
":=",
"true",
"\n",
"for",
"_",
",",
"f",
":=",
"range",
"x",
".",
"Field",
"{",
"if",
"!",
"first",
"{",
"s",
"+=",
"\"",
"\"",
"\n",
"}",
"\n",
"name",
":=",
"f",
".",
"Name",
"\n",
"if",
"i",
":=",
"strings",
".",
"Index",
"(",
"name",
",",
"\"",
"\"",
")",
";",
"i",
">=",
"0",
"{",
"name",
"=",
"name",
"[",
"i",
"+",
"1",
":",
"]",
"\n",
"}",
"\n",
"if",
"anon",
"[",
"0",
"]",
"{",
"s",
"+=",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"runtimeName",
"(",
"f",
".",
"Type",
")",
")",
"\n",
"}",
"else",
"{",
"s",
"+=",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"name",
",",
"runtimeName",
"(",
"f",
".",
"Type",
")",
")",
"\n",
"}",
"\n",
"first",
"=",
"false",
"\n",
"anon",
"=",
"anon",
"[",
"1",
":",
"]",
"\n",
"}",
"\n",
"s",
"+=",
"\"",
"\"",
"\n",
"return",
"s",
"\n",
"default",
":",
"return",
"stripPackagePath",
"(",
"dt",
".",
"String",
"(",
")",
")",
"\n",
"}",
"\n",
"}"
] |
4,874 | all-4875 | [
"GetPopup",
"()",
"is",
"a",
"wrapper",
"around",
"gtk_scale_button_get_popup",
"()",
"."
] | [
"func",
"(",
"v",
"*",
"ScaleButton",
")",
"GetPopup",
"(",
")",
"(",
"*",
"Widget",
",",
"<mask>",
")",
"{",
"c",
":=",
"C",
".",
"gtk_scale_button_get_popup",
"(",
"v",
".",
"native",
"(",
")",
")",
"\n",
"if",
"c",
"==",
"nil",
"{",
"return",
"nil",
",",
"nilPtrErr",
"\n",
"}",
"\n",
"return",
"wrapWidget",
"(",
"glib",
".",
"Take",
"(",
"unsafe",
".",
"Pointer",
"(",
"c",
")",
")",
")",
",",
"nil",
"\n",
"}"
] |
4,875 | all-4876 | [
"Len",
"returns",
"the",
"total",
"number",
"of",
"values",
"across",
"all",
"ranges"
] | [
"func",
"(",
"l",
"*",
"InclusiveRanges",
")",
"Len",
"(",
")",
"int",
"{",
"var",
"totalLen",
"int",
"\n",
"for",
"_",
",",
"b",
":=",
"range",
"l",
".",
"<mask>",
"{",
"totalLen",
"+=",
"b",
".",
"Len",
"(",
")",
"\n",
"}",
"\n",
"return",
"totalLen",
"\n",
"}"
] |
4,876 | all-4877 | [
"EndOfMinute",
"end",
"of",
"minute"
] | [
"func",
"(",
"now",
"*",
"Now",
")",
"EndOfMinute",
"(",
")",
"time",
".",
"Time",
"{",
"return",
"<mask>",
".",
"BeginningOfMinute",
"(",
")",
".",
"Add",
"(",
"time",
".",
"Minute",
"-",
"time",
".",
"Nanosecond",
")",
"\n",
"}"
] |
4,877 | all-4878 | [
"HasTitleAlign",
"returns",
"a",
"boolean",
"if",
"a",
"field",
"has",
"been",
"set",
"."
] | [
"func",
"(",
"q",
"*",
"QueryValueDefinition",
")",
"HasTitleAlign",
"(",
")",
"bool",
"{",
"if",
"q",
"!=",
"nil",
"&&",
"q",
".",
"TitleAlign",
"!=",
"nil",
"{",
"return",
"true",
"\n",
"}",
"\n\n",
"return",
"<mask>",
"\n",
"}"
] |
4,878 | all-4879 | [
"UnixSocket",
"returns",
"a",
"new",
"Listener",
"on",
"that",
"address"
] | [
"func",
"UnixSocket",
"(",
"addr",
"string",
")",
"(",
"*",
"Listener",
",",
"error",
")",
"{",
"listener",
",",
"err",
":=",
"net",
".",
"Listen",
"(",
"\"",
"\"",
",",
"addr",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"return",
"&",
"Listener",
"{",
"<mask>",
":",
"&",
"http",
".",
"Server",
"{",
"}",
",",
"Listener",
":",
"listener",
",",
"}",
",",
"nil",
"\n",
"}"
] |
4,879 | all-4880 | [
"ContainerGetSnapshots",
"returns",
"the",
"names",
"of",
"all",
"snapshots",
"of",
"the",
"container",
"in",
"the",
"given",
"project",
"with",
"the",
"given",
"name",
"."
] | [
"func",
"(",
"c",
"*",
"Cluster",
")",
"ContainerGetSnapshots",
"(",
"project",
",",
"name",
"string",
")",
"(",
"[",
"]",
"string",
",",
"error",
")",
"{",
"result",
":=",
"[",
"]",
"string",
"{",
"}",
"\n\n",
"regexp",
":=",
"name",
"+",
"shared",
".",
"SnapshotDelimiter",
"\n",
"length",
":=",
"len",
"(",
"regexp",
")",
"\n",
"q",
":=",
"`\nSELECT containers.name\n FROM containers\n JOIN projects ON projects.id = containers.project_id\nWHERE projects.name=? AND containers.type=? AND SUBSTR(containers.name,1,?)=?\n`",
"\n",
"inargs",
":=",
"[",
"]",
"interface",
"{",
"}",
"{",
"project",
",",
"CTypeSnapshot",
",",
"length",
",",
"regexp",
"}",
"\n",
"outfmt",
":=",
"[",
"]",
"interface",
"{",
"}",
"{",
"name",
"}",
"\n",
"dbResults",
",",
"err",
":=",
"queryScan",
"(",
"c",
".",
"db",
",",
"q",
",",
"inargs",
",",
"outfmt",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"result",
",",
"err",
"\n",
"}",
"\n\n",
"for",
"_",
",",
"r",
":=",
"range",
"dbResults",
"{",
"result",
"=",
"<mask>",
"(",
"result",
",",
"r",
"[",
"0",
"]",
".",
"(",
"string",
")",
")",
"\n",
"}",
"\n\n",
"return",
"result",
",",
"nil",
"\n",
"}"
] |
4,880 | all-4881 | [
"MustParseLevel",
"is",
"a",
"convience",
"function",
"that",
"parses",
"the",
"passed",
"in",
"string",
"as",
"a",
"log",
"level",
"and",
"sets",
"the",
"log",
"level",
"of",
"the",
"apexInterfaceWrapper",
"to",
"the",
"parsed",
"level",
".",
"If",
"an",
"error",
"occurs",
"it",
"will",
"handle",
"it",
"with",
"w",
".",
"Fatal"
] | [
"func",
"(",
"w",
"*",
"apexInterfaceWrapper",
")",
"MustParseLevel",
"(",
"s",
"string",
")",
"{",
"<mask>",
",",
"err",
":=",
"ParseLevel",
"(",
"s",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"w",
".",
"WithError",
"(",
"err",
")",
".",
"WithField",
"(",
"\"",
"\"",
",",
"s",
")",
".",
"Fatal",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"w",
".",
"Level",
"=",
"level",
"\n",
"}"
] |
4,881 | all-4882 | [
"PrependSection",
"is",
"a",
"wrapper",
"around",
"g_menu_prepend_section",
"()",
"."
] | [
"func",
"(",
"v",
"*",
"Menu",
")",
"PrependSection",
"(",
"label",
"string",
",",
"<mask>",
"*",
"MenuModel",
")",
"{",
"cstr1",
":=",
"(",
"*",
"C",
".",
"gchar",
")",
"(",
"C",
".",
"CString",
"(",
"label",
")",
")",
"\n",
"defer",
"C",
".",
"free",
"(",
"unsafe",
".",
"Pointer",
"(",
"cstr1",
")",
")",
"\n\n",
"C",
".",
"g_menu_prepend_section",
"(",
"v",
".",
"native",
"(",
")",
",",
"cstr1",
",",
"section",
".",
"native",
"(",
")",
")",
"\n",
"}"
] |
4,882 | all-4883 | [
"Hash",
"generates",
"the",
"hash",
"for",
"the",
"current",
"period",
"and",
"client",
"."
] | [
"func",
"(",
"h",
"PerSecondHasher",
")",
"Hash",
"(",
"id",
"string",
")",
"string",
"{",
"if",
"h",
".",
"Clock",
"==",
"nil",
"{",
"h",
".",
"Clock",
"=",
"<mask>",
".",
"New",
"(",
")",
"\n",
"}",
"\n\n",
"return",
"id",
"+",
"\"",
"\"",
"+",
"strconv",
".",
"FormatInt",
"(",
"h",
".",
"Clock",
".",
"Now",
"(",
")",
".",
"Unix",
"(",
")",
",",
"10",
")",
"\n",
"}"
] |
4,883 | all-4884 | [
"String",
"returns",
"the",
"name",
"of",
"e"
] | [
"func",
"(",
"e",
"LedgerUpgradeType",
")",
"String",
"(",
")",
"string",
"{",
"name",
",",
"_",
":=",
"ledgerUpgradeTypeMap",
"[",
"int32",
"(",
"e",
")",
"]",
"\n",
"return",
"<mask>",
"\n",
"}"
] |
4,884 | all-4885 | [
"GetSignatures",
"()",
"parses",
"the",
"image",
"s",
"signatures",
"blob",
"into",
"a",
"slice",
"of",
"byte",
"slices",
"."
] | [
"func",
"(",
"s",
"*",
"storageImageSource",
")",
"GetSignatures",
"(",
"ctx",
"context",
".",
"Context",
",",
"instanceDigest",
"*",
"digest",
".",
"Digest",
")",
"(",
"signatures",
"[",
"]",
"[",
"]",
"byte",
",",
"err",
"error",
")",
"{",
"if",
"instanceDigest",
"!=",
"nil",
"{",
"return",
"nil",
",",
"ErrNoManifestLists",
"\n",
"}",
"\n",
"<mask>",
"offset",
"int",
"\n",
"sigslice",
":=",
"[",
"]",
"[",
"]",
"byte",
"{",
"}",
"\n",
"signature",
":=",
"[",
"]",
"byte",
"{",
"}",
"\n",
"if",
"len",
"(",
"s",
".",
"SignatureSizes",
")",
">",
"0",
"{",
"signatureBlob",
",",
"err",
":=",
"s",
".",
"imageRef",
".",
"transport",
".",
"store",
".",
"ImageBigData",
"(",
"s",
".",
"image",
".",
"ID",
",",
"\"",
"\"",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"errors",
".",
"Wrapf",
"(",
"err",
",",
"\"",
"\"",
",",
"s",
".",
"image",
".",
"ID",
")",
"\n",
"}",
"\n",
"signature",
"=",
"signatureBlob",
"\n",
"}",
"\n",
"for",
"_",
",",
"length",
":=",
"range",
"s",
".",
"SignatureSizes",
"{",
"sigslice",
"=",
"append",
"(",
"sigslice",
",",
"signature",
"[",
"offset",
":",
"offset",
"+",
"length",
"]",
")",
"\n",
"offset",
"+=",
"length",
"\n",
"}",
"\n",
"if",
"offset",
"!=",
"len",
"(",
"signature",
")",
"{",
"return",
"nil",
",",
"errors",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"len",
"(",
"signatures",
")",
"-",
"offset",
")",
"\n",
"}",
"\n",
"return",
"sigslice",
",",
"nil",
"\n",
"}"
] |
4,885 | all-4886 | [
"RunLight",
"creates",
"a",
"light",
"instance",
"of",
"MongoDB",
"image",
"."
] | [
"func",
"(",
"s",
"*",
"ImageMongoDB",
")",
"RunLight",
"(",
"cfg",
"*",
"RunConfig",
")",
"(",
"*",
"<mask>",
",",
"error",
")",
"{",
"cfg",
".",
"AddArgs",
"(",
"\"",
"\"",
",",
"\"",
"\"",
")",
"\n",
"return",
"s",
".",
"Image",
".",
"Run",
"(",
"cfg",
")",
"\n",
"}"
] |
4,886 | all-4887 | [
"ContainerBackupCreate",
"creates",
"a",
"new",
"backup"
] | [
"func",
"(",
"c",
"*",
"Cluster",
")",
"ContainerBackupCreate",
"(",
"args",
"ContainerBackupArgs",
")",
"error",
"{",
"_",
",",
"err",
":=",
"c",
".",
"ContainerBackupID",
"(",
"args",
".",
"Name",
")",
"\n",
"if",
"err",
"==",
"nil",
"{",
"return",
"ErrAlreadyDefined",
"\n",
"}",
"\n\n",
"err",
"=",
"c",
".",
"<mask>",
"(",
"func",
"(",
"tx",
"*",
"ClusterTx",
")",
"error",
"{",
"containerOnlyInt",
":=",
"0",
"\n",
"if",
"args",
".",
"ContainerOnly",
"{",
"containerOnlyInt",
"=",
"1",
"\n",
"}",
"\n\n",
"optimizedStorageInt",
":=",
"0",
"\n",
"if",
"args",
".",
"OptimizedStorage",
"{",
"optimizedStorageInt",
"=",
"1",
"\n",
"}",
"\n\n",
"str",
":=",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
")",
"\n",
"stmt",
",",
"err",
":=",
"tx",
".",
"tx",
".",
"Prepare",
"(",
"str",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"defer",
"stmt",
".",
"Close",
"(",
")",
"\n",
"result",
",",
"err",
":=",
"stmt",
".",
"Exec",
"(",
"args",
".",
"ContainerID",
",",
"args",
".",
"Name",
",",
"args",
".",
"CreationDate",
".",
"Unix",
"(",
")",
",",
"args",
".",
"ExpiryDate",
".",
"Unix",
"(",
")",
",",
"containerOnlyInt",
",",
"optimizedStorageInt",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"_",
",",
"err",
"=",
"result",
".",
"LastInsertId",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"args",
".",
"Name",
")",
"\n",
"}",
"\n\n",
"return",
"nil",
"\n",
"}",
")",
"\n\n",
"return",
"err",
"\n",
"}"
] |
4,887 | all-4888 | [
"CanPageDown",
"returns",
"whether",
"a",
"list",
"can",
"still",
"PageDown",
"()",
"."
] | [
"func",
"(",
"l",
"*",
"<mask>",
")",
"CanPageDown",
"(",
")",
"bool",
"{",
"max",
":=",
"len",
"(",
"l",
".",
"scope",
")",
"\n",
"return",
"l",
".",
"start",
"+",
"l",
".",
"size",
"<",
"max",
"\n",
"}"
] |
4,888 | all-4889 | [
"UnmarshalJSON",
"supports",
"json",
".",
"Unmarshaler",
"interface"
] | [
"func",
"(",
"v",
"*",
"RequestCacheNamesParams",
")",
"UnmarshalJSON",
"(",
"<mask>",
"[",
"]",
"byte",
")",
"error",
"{",
"r",
":=",
"jlexer",
".",
"Lexer",
"{",
"Data",
":",
"data",
"}",
"\n",
"easyjsonC5a4559bDecodeGithubComChromedpCdprotoCachestorage5",
"(",
"&",
"r",
",",
"v",
")",
"\n",
"return",
"r",
".",
"Error",
"(",
")",
"\n",
"}"
] |
4,889 | all-4890 | [
"MarshalJSON",
"supports",
"json",
".",
"Marshaler",
"interface"
] | [
"func",
"(",
"v",
"EventIndexedDBContentUpdated",
")",
"MarshalJSON",
"(",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"w",
":=",
"jwriter",
".",
"<mask>",
"{",
"}",
"\n",
"easyjsonC5a4559bEncodeGithubComChromedpCdprotoStorage8",
"(",
"&",
"w",
",",
"v",
")",
"\n",
"return",
"w",
".",
"Buffer",
".",
"BuildBytes",
"(",
")",
",",
"w",
".",
"Error",
"\n",
"}"
] |
4,890 | all-4891 | [
"ImageAliasDelete",
"deletes",
"the",
"alias",
"with",
"the",
"given",
"name",
"."
] | [
"func",
"(",
"c",
"*",
"Cluster",
")",
"ImageAliasDelete",
"(",
"project",
",",
"name",
"string",
")",
"error",
"{",
"err",
":=",
"c",
".",
"Transaction",
"(",
"func",
"(",
"tx",
"*",
"ClusterTx",
")",
"error",
"{",
"enabled",
",",
"err",
":=",
"tx",
".",
"ProjectHasImages",
"(",
"<mask>",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"errors",
".",
"Wrap",
"(",
"err",
",",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"if",
"!",
"enabled",
"{",
"project",
"=",
"\"",
"\"",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"err",
"=",
"exec",
"(",
"c",
".",
"db",
",",
"`\nDELETE\n FROM images_aliases\n WHERE project_id = (SELECT id FROM projects WHERE name = ?) AND name = ?\n`",
",",
"project",
",",
"name",
")",
"\n",
"return",
"err",
"\n",
"}"
] |
4,891 | all-4892 | [
"GetFontSize",
"returns",
"the",
"FontSize",
"field",
"if",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"."
] | [
"func",
"(",
"w",
"*",
"Widget",
")",
"GetFontSize",
"(",
")",
"<mask>",
"{",
"if",
"w",
"==",
"nil",
"||",
"w",
".",
"FontSize",
"==",
"nil",
"{",
"return",
"\"",
"\"",
"\n",
"}",
"\n",
"return",
"*",
"w",
".",
"FontSize",
"\n",
"}"
] |
4,892 | all-4893 | [
"New",
"returns",
"a",
"client",
"/",
"server",
"to",
"bidirectionally",
"communicate",
"with",
"ACS",
"The",
"returned",
"struct",
"should",
"have",
"both",
"Connect",
"and",
"Serve",
"called",
"upon",
"it",
"before",
"being",
"used",
"."
] | [
"func",
"New",
"(",
"url",
"string",
",",
"cfg",
"*",
"config",
".",
"Config",
",",
"credentialProvider",
"*",
"credentials",
".",
"Credentials",
",",
"rwTimeout",
"time",
".",
"Duration",
")",
"wsclient",
".",
"ClientServer",
"{",
"cs",
":=",
"&",
"clientServer",
"{",
"}",
"\n",
"cs",
".",
"URL",
"=",
"<mask>",
"\n",
"cs",
".",
"CredentialProvider",
"=",
"credentialProvider",
"\n",
"cs",
".",
"AgentConfig",
"=",
"cfg",
"\n",
"cs",
".",
"ServiceError",
"=",
"&",
"acsError",
"{",
"}",
"\n",
"cs",
".",
"RequestHandlers",
"=",
"make",
"(",
"map",
"[",
"string",
"]",
"wsclient",
".",
"RequestHandler",
")",
"\n",
"cs",
".",
"TypeDecoder",
"=",
"NewACSDecoder",
"(",
")",
"\n",
"cs",
".",
"RWTimeout",
"=",
"rwTimeout",
"\n",
"return",
"cs",
"\n",
"}"
] |
4,893 | all-4894 | [
"newStructFLS",
"returns",
"a",
"FieldLoadSaver",
"for",
"the",
"struct",
"pointer",
"p",
"."
] | [
"func",
"newStructFLS",
"(",
"p",
"<mask>",
"{",
"}",
")",
"(",
"FieldLoadSaver",
",",
"error",
")",
"{",
"v",
":=",
"reflect",
".",
"ValueOf",
"(",
"p",
")",
"\n",
"if",
"v",
".",
"Kind",
"(",
")",
"!=",
"reflect",
".",
"Ptr",
"||",
"v",
".",
"IsNil",
"(",
")",
"||",
"v",
".",
"Elem",
"(",
")",
".",
"Kind",
"(",
")",
"!=",
"reflect",
".",
"Struct",
"{",
"return",
"nil",
",",
"ErrInvalidDocumentType",
"\n",
"}",
"\n",
"codec",
",",
"err",
":=",
"loadCodec",
"(",
"v",
".",
"Elem",
"(",
")",
".",
"Type",
"(",
")",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"return",
"structFLS",
"{",
"v",
".",
"Elem",
"(",
")",
",",
"codec",
"}",
",",
"nil",
"\n",
"}"
] |
4,894 | all-4895 | [
"FetchMaintenanceWindows",
"retrieves",
"all",
"maintenance",
"[",
"windows",
"]",
"available",
"to",
"API",
"Token",
"."
] | [
"func",
"(",
"a",
"*",
"API",
")",
"FetchMaintenanceWindows",
"(",
")",
"(",
"*",
"[",
"]",
"Maintenance",
",",
"error",
")",
"{",
"<mask>",
",",
"err",
":=",
"a",
".",
"Get",
"(",
"config",
".",
"MaintenancePrefix",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"var",
"windows",
"[",
"]",
"Maintenance",
"\n",
"if",
"err",
":=",
"json",
".",
"Unmarshal",
"(",
"result",
",",
"&",
"windows",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"return",
"&",
"windows",
",",
"nil",
"\n",
"}"
] |
4,895 | all-4896 | [
"Errorf",
"logging"
] | [
"func",
"(",
"l",
"*",
"StdLevelLogger",
")",
"Errorf",
"(",
"msg",
"string",
",",
"args",
"...",
"<mask>",
"{",
"}",
")",
"{",
"l",
".",
"logfFunc",
"(",
"ErrorLevel",
",",
"l",
".",
"context",
",",
"msg",
",",
"args",
"...",
")",
"\n",
"}"
] |
4,896 | all-4897 | [
"initializeASMAuthResource",
"builds",
"the",
"resource",
"dependency",
"map",
"for",
"the",
"ASM",
"auth",
"resource"
] | [
"func",
"(",
"task",
"*",
"Task",
")",
"initializeASMAuthResource",
"(",
"credentialsManager",
"credentials",
".",
"Manager",
",",
"resourceFields",
"*",
"taskresource",
".",
"ResourceFields",
")",
"{",
"asmAuthResource",
":=",
"asmauth",
".",
"NewASMAuthResource",
"(",
"task",
".",
"Arn",
",",
"task",
".",
"getAllASMAuthDataRequirements",
"(",
")",
",",
"task",
".",
"ExecutionCredentialsID",
",",
"credentialsManager",
",",
"resourceFields",
".",
"ASMClientCreator",
")",
"\n",
"task",
".",
"AddResource",
"(",
"asmauth",
".",
"ResourceName",
",",
"asmAuthResource",
")",
"\n",
"for",
"_",
",",
"<mask>",
":=",
"range",
"task",
".",
"Containers",
"{",
"if",
"container",
".",
"ShouldPullWithASMAuth",
"(",
")",
"{",
"container",
".",
"BuildResourceDependency",
"(",
"asmAuthResource",
".",
"GetName",
"(",
")",
",",
"resourcestatus",
".",
"ResourceStatus",
"(",
"asmauth",
".",
"ASMAuthStatusCreated",
")",
",",
"apicontainerstatus",
".",
"ContainerPulled",
")",
"\n",
"}",
"\n",
"}",
"\n",
"}"
] |
4,897 | all-4898 | [
"PortBindingFromDockerPortBinding",
"constructs",
"a",
"PortBinding",
"slice",
"from",
"a",
"docker",
"NetworkSettings",
".",
"Ports",
"map",
"."
] | [
"func",
"PortBindingFromDockerPortBinding",
"(",
"dockerPortBindings",
"nat",
".",
"PortMap",
")",
"(",
"[",
"]",
"PortBinding",
",",
"apierrors",
".",
"NamedError",
")",
"{",
"portBindings",
":=",
"<mask>",
"(",
"[",
"]",
"PortBinding",
",",
"0",
",",
"len",
"(",
"dockerPortBindings",
")",
")",
"\n\n",
"for",
"port",
",",
"bindings",
":=",
"range",
"dockerPortBindings",
"{",
"containerPort",
",",
"err",
":=",
"nat",
".",
"ParsePort",
"(",
"port",
".",
"Port",
"(",
")",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"&",
"apierrors",
".",
"DefaultNamedError",
"{",
"Name",
":",
"UnparseablePortErrorName",
",",
"Err",
":",
"\"",
"\"",
"+",
"err",
".",
"Error",
"(",
")",
"}",
"\n",
"}",
"\n",
"protocol",
",",
"err",
":=",
"NewTransportProtocol",
"(",
"port",
".",
"Proto",
"(",
")",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"&",
"apierrors",
".",
"DefaultNamedError",
"{",
"Name",
":",
"UnrecognizedTransportProtocolErrorName",
",",
"Err",
":",
"err",
".",
"Error",
"(",
")",
"}",
"\n",
"}",
"\n\n",
"for",
"_",
",",
"binding",
":=",
"range",
"bindings",
"{",
"hostPort",
",",
"err",
":=",
"strconv",
".",
"Atoi",
"(",
"binding",
".",
"HostPort",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"&",
"apierrors",
".",
"DefaultNamedError",
"{",
"Name",
":",
"UnparseablePortErrorName",
",",
"Err",
":",
"\"",
"\"",
"+",
"err",
".",
"Error",
"(",
")",
"}",
"\n",
"}",
"\n",
"portBindings",
"=",
"append",
"(",
"portBindings",
",",
"PortBinding",
"{",
"ContainerPort",
":",
"uint16",
"(",
"containerPort",
")",
",",
"HostPort",
":",
"uint16",
"(",
"hostPort",
")",
",",
"BindIP",
":",
"binding",
".",
"HostIP",
",",
"Protocol",
":",
"protocol",
",",
"}",
")",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"portBindings",
",",
"nil",
"\n",
"}"
] |
4,898 | all-4899 | [
"unreachable",
"notices",
"the",
"picker",
"that",
"the",
"given",
"url",
"is",
"unreachable",
"and",
"it",
"should",
"use",
"other",
"possible",
"urls",
"."
] | [
"func",
"(",
"p",
"*",
"urlPicker",
")",
"unreachable",
"(",
"u",
"<mask>",
".",
"URL",
")",
"{",
"p",
".",
"mu",
".",
"Lock",
"(",
")",
"\n",
"defer",
"p",
".",
"mu",
".",
"Unlock",
"(",
")",
"\n",
"if",
"u",
"==",
"p",
".",
"urls",
"[",
"p",
".",
"picked",
"]",
"{",
"p",
".",
"picked",
"=",
"(",
"p",
".",
"picked",
"+",
"1",
")",
"%",
"len",
"(",
"p",
".",
"urls",
")",
"\n",
"}",
"\n",
"}"
] |
4,899 | all-4900 | [
"Now",
"mocks",
"base",
"method"
] | [
"func",
"(",
"m",
"*",
"MockTime",
")",
"Now",
"(",
")",
"time",
".",
"Time",
"{",
"<mask>",
":=",
"m",
".",
"ctrl",
".",
"Call",
"(",
"m",
",",
"\"",
"\"",
")",
"\n",
"ret0",
",",
"_",
":=",
"ret",
"[",
"0",
"]",
".",
"(",
"time",
".",
"Time",
")",
"\n",
"return",
"ret0",
"\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.