id
int32 0
25.3k
| idx
stringlengths 5
9
| nl_tokens
sequencelengths 1
418
| pl_tokens
sequencelengths 22
4.98k
|
---|---|---|---|
3,900 | all-3901 | [
"withStateRLock",
"performs",
"an",
"action",
"with",
"the",
"connection",
"state",
"mutex",
"rlocked",
"."
] | [
"func",
"(",
"c",
"*",
"<mask>",
")",
"withStateRLock",
"(",
"f",
"func",
"(",
")",
"error",
")",
"error",
"{",
"c",
".",
"stateMut",
".",
"RLock",
"(",
")",
"\n",
"err",
":=",
"f",
"(",
")",
"\n",
"c",
".",
"stateMut",
".",
"RUnlock",
"(",
")",
"\n\n",
"return",
"err",
"\n",
"}"
] |
3,901 | all-3902 | [
"NewView",
"constructs",
"a",
"new",
"view",
"with",
"the",
"given",
"inputs",
"."
] | [
"func",
"NewView",
"(",
"i",
"*",
"NewViewInput",
")",
"(",
"*",
"<mask>",
",",
"error",
")",
"{",
"return",
"&",
"View",
"{",
"dependency",
":",
"i",
".",
"Dependency",
",",
"clients",
":",
"i",
".",
"Clients",
",",
"maxStale",
":",
"i",
".",
"MaxStale",
",",
"once",
":",
"i",
".",
"Once",
",",
"retryFunc",
":",
"i",
".",
"RetryFunc",
",",
"stopCh",
":",
"make",
"(",
"chan",
"struct",
"{",
"}",
",",
"1",
")",
",",
"vaultGrace",
":",
"i",
".",
"VaultGrace",
",",
"}",
",",
"nil",
"\n",
"}"
] |
3,902 | all-3903 | [
"peek",
"returns",
"but",
"does",
"not",
"consume",
"the",
"next",
"token",
"."
] | [
"func",
"(",
"p",
"*",
"<mask>",
")",
"peek",
"(",
")",
"item",
"{",
"if",
"p",
".",
"peekCount",
">",
"0",
"{",
"return",
"p",
".",
"token",
"[",
"p",
".",
"peekCount",
"-",
"1",
"]",
"\n",
"}",
"\n",
"p",
".",
"peekCount",
"=",
"1",
"\n\n",
"t",
":=",
"p",
".",
"lex",
".",
"nextItem",
"(",
")",
"\n",
"// Skip comments.",
"for",
"t",
".",
"typ",
"==",
"ItemComment",
"{",
"t",
"=",
"p",
".",
"lex",
".",
"nextItem",
"(",
")",
"\n",
"}",
"\n",
"p",
".",
"token",
"[",
"0",
"]",
"=",
"t",
"\n",
"return",
"p",
".",
"token",
"[",
"0",
"]",
"\n",
"}"
] |
3,903 | all-3904 | [
"Respond",
"is",
"used",
"to",
"respond",
"with",
"a",
"response",
"error",
"or",
"both"
] | [
"func",
"(",
"r",
"*",
"RPC",
")",
"Respond",
"(",
"resp",
"<mask>",
"{",
"}",
",",
"err",
"error",
")",
"{",
"r",
".",
"RespChan",
"<-",
"RPCResponse",
"{",
"resp",
",",
"err",
"}",
"\n",
"}"
] |
3,904 | all-3905 | [
"/",
"*",
"Deterministically",
"generates",
"new",
"priv",
"-",
"key",
"bytes",
"from",
"key",
".",
"func",
"(",
"key",
"PrivKeySecp256k1",
")",
"Generate",
"(",
"index",
"int",
")",
"PrivKeySecp256k1",
"{",
"newBytes",
":",
"=",
"cdc",
".",
"BinarySha256",
"(",
"struct",
"{",
"PrivKey",
"[",
"64",
"]",
"byte",
"Index",
"int",
"}",
"{",
"key",
"index",
"}",
")",
"var",
"newKey",
"[",
"64",
"]",
"byte",
"copy",
"(",
"newKey",
"[",
":",
"]",
"newBytes",
")",
"return",
"PrivKeySecp256k1",
"(",
"newKey",
")",
"}"
] | [
"func",
"GenPrivKeySecp256k1",
"(",
")",
"PrivKeySecp256k1",
"{",
"privKeyBytes",
":=",
"[",
"32",
"]",
"<mask>",
"{",
"}",
"\n",
"copy",
"(",
"privKeyBytes",
"[",
":",
"]",
",",
"CRandBytes",
"(",
"32",
")",
")",
"\n",
"priv",
",",
"_",
":=",
"secp256k1",
".",
"PrivKeyFromBytes",
"(",
"secp256k1",
".",
"S256",
"(",
")",
",",
"privKeyBytes",
"[",
":",
"]",
")",
"\n",
"copy",
"(",
"privKeyBytes",
"[",
":",
"]",
",",
"priv",
".",
"Serialize",
"(",
")",
")",
"\n",
"return",
"PrivKeySecp256k1",
"(",
"privKeyBytes",
")",
"\n",
"}"
] |
3,905 | all-3906 | [
"SetValue",
"implements",
"storage",
"interface",
"."
] | [
"func",
"(",
"s",
"*",
"Storage",
")",
"SetValue",
"(",
"ctx",
"context",
".",
"Context",
",",
"accessToken",
"string",
",",
"key",
",",
"value",
"string",
")",
"(",
"map",
"[",
"string",
"]",
"string",
",",
"error",
")",
"{",
"span",
",",
"ctx",
":=",
"opentracing",
".",
"StartSpanFromContext",
"(",
"ctx",
",",
"\"",
"\"",
")",
"\n",
"defer",
"span",
".",
"Finish",
"(",
")",
"\n\n",
"<mask>",
"err",
"error",
"\n",
"if",
"accessToken",
"==",
"\"",
"\"",
"{",
"return",
"nil",
",",
"storage",
".",
"ErrMissingAccessToken",
"\n",
"}",
"\n\n",
"entity",
":=",
"&",
"sessionEntity",
"{",
"AccessToken",
":",
"accessToken",
",",
"}",
"\n",
"selectQuery",
":=",
"`\n\t\tSELECT bag\n\t\tFROM `",
"+",
"s",
".",
"schema",
"+",
"`.`",
"+",
"s",
".",
"table",
"+",
"`\n\t\tWHERE access_token = $1\n\t\tFOR UPDATE\n\t`",
"\n",
"updateQuery",
":=",
"`\n\t\tUPDATE `",
"+",
"s",
".",
"schema",
"+",
"`.`",
"+",
"s",
".",
"table",
"+",
"`\n\t\tSET\n\t\t\tbag = $2\n\t\tWHERE access_token = $1\n\t`",
"\n\n",
"tx",
",",
"err",
":=",
"s",
".",
"db",
".",
"BeginTx",
"(",
"ctx",
",",
"nil",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"tx",
".",
"Rollback",
"(",
")",
"\n",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"startSelect",
":=",
"time",
".",
"Now",
"(",
")",
"\n",
"err",
"=",
"tx",
".",
"QueryRowContext",
"(",
"ctx",
",",
"selectQuery",
",",
"accessToken",
")",
".",
"Scan",
"(",
"&",
"entity",
".",
"Bag",
",",
")",
"\n",
"s",
".",
"incQueries",
"(",
"prometheus",
".",
"Labels",
"{",
"\"",
"\"",
":",
"\"",
"\"",
"}",
",",
"startSelect",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"s",
".",
"incError",
"(",
"prometheus",
".",
"Labels",
"{",
"\"",
"\"",
":",
"\"",
"\"",
"}",
")",
"\n",
"tx",
".",
"Rollback",
"(",
")",
"\n",
"if",
"err",
"==",
"sql",
".",
"ErrNoRows",
"{",
"return",
"nil",
",",
"storage",
".",
"ErrSessionNotFound",
"\n",
"}",
"\n",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"entity",
".",
"Bag",
".",
"Set",
"(",
"key",
",",
"value",
")",
"\n\n",
"startUpdate",
":=",
"time",
".",
"Now",
"(",
")",
"\n",
"_",
",",
"err",
"=",
"tx",
".",
"ExecContext",
"(",
"ctx",
",",
"updateQuery",
",",
"accessToken",
",",
"entity",
".",
"Bag",
")",
"\n",
"s",
".",
"incQueries",
"(",
"prometheus",
".",
"Labels",
"{",
"\"",
"\"",
":",
"\"",
"\"",
"}",
",",
"startUpdate",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"s",
".",
"incError",
"(",
"prometheus",
".",
"Labels",
"{",
"\"",
"\"",
":",
"\"",
"\"",
"}",
")",
"\n",
"tx",
".",
"Rollback",
"(",
")",
"\n",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"tx",
".",
"Commit",
"(",
")",
"\n\n",
"return",
"entity",
".",
"Bag",
",",
"nil",
"\n",
"}"
] |
3,906 | all-3907 | [
"GetClient",
"will",
"replace",
"some",
"versions",
"of",
"Docker",
"on",
"Windows",
".",
"We",
"need",
"this",
"because",
"agent",
"assumes",
"that",
"it",
"can",
"always",
"call",
"older",
"versions",
"of",
"the",
"docker",
"API",
"."
] | [
"func",
"(",
"f",
"*",
"factory",
")",
"GetClient",
"(",
"version",
"dockerclient",
".",
"DockerVersion",
")",
"(",
"sdkclient",
".",
"Client",
",",
"error",
")",
"{",
"for",
"_",
",",
"v",
":=",
"range",
"getWindowsReplaceableVersions",
"(",
")",
"{",
"if",
"v",
"==",
"<mask>",
"{",
"version",
"=",
"minDockerAPIVersion",
"\n",
"break",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"f",
".",
"getClient",
"(",
"version",
")",
"\n",
"}"
] |
3,907 | all-3908 | [
"MetadataFromFileName",
"guesses",
"file",
"metadata",
"from",
"the",
"filename",
"and",
"a",
"simplifed",
"filename",
".",
"For",
"example",
"build",
"-",
"log",
".",
"txt",
".",
"gz",
"would",
"be",
":",
"Content",
"-",
"Type",
":",
"text",
"/",
"plain",
";",
"charset",
"=",
"utf",
"-",
"8",
"Content",
"-",
"Encoding",
":",
"gzip",
"and",
"the",
"simplified",
"filename",
"would",
"be",
"build",
"-",
"log",
".",
"txt",
"(",
"excluding",
"the",
"content",
"encoding",
"extension",
")",
"."
] | [
"func",
"MetadataFromFileName",
"(",
"filename",
"string",
")",
"(",
"string",
",",
"map",
"[",
"string",
"]",
"string",
")",
"{",
"metadata",
":=",
"make",
"(",
"map",
"[",
"string",
"]",
"string",
")",
"\n",
"segments",
":=",
"strings",
".",
"Split",
"(",
"filename",
",",
"\"",
"\"",
")",
"\n",
"index",
":=",
"len",
"(",
"segments",
")",
"-",
"1",
"\n",
"segment",
":=",
"segments",
"[",
"index",
"]",
"\n\n",
"// https://www.iana.org/assignments/http-parameters/http-parameters.xhtml#content-coding",
"switch",
"segment",
"{",
"case",
"\"",
"\"",
",",
"\"",
"\"",
":",
"metadata",
"[",
"\"",
"\"",
"]",
"=",
"\"",
"\"",
"\n",
"}",
"\n\n",
"if",
"_",
",",
"ok",
":=",
"metadata",
"[",
"\"",
"\"",
"]",
";",
"ok",
"{",
"if",
"index",
"==",
"0",
"{",
"segment",
"=",
"\"",
"\"",
"\n",
"}",
"else",
"{",
"filename",
"=",
"filename",
"[",
":",
"len",
"(",
"<mask>",
")",
"-",
"len",
"(",
"segment",
")",
"-",
"1",
"]",
"\n",
"index",
"-=",
"1",
"\n",
"segment",
"=",
"segments",
"[",
"index",
"]",
"\n",
"}",
"\n",
"}",
"\n\n",
"if",
"segment",
"!=",
"\"",
"\"",
"{",
"mediaType",
":=",
"mime",
".",
"TypeByExtension",
"(",
"\"",
"\"",
"+",
"segment",
")",
"\n",
"if",
"mediaType",
"!=",
"\"",
"\"",
"{",
"metadata",
"[",
"\"",
"\"",
"]",
"=",
"mediaType",
"\n",
"}",
"\n",
"}",
"\n\n",
"if",
"_",
",",
"ok",
":=",
"metadata",
"[",
"\"",
"\"",
"]",
";",
"!",
"ok",
"{",
"if",
"_",
",",
"ok",
":=",
"metadata",
"[",
"\"",
"\"",
"]",
";",
"ok",
"{",
"metadata",
"[",
"\"",
"\"",
"]",
"=",
"\"",
"\"",
"\n",
"delete",
"(",
"metadata",
",",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"}",
"\n\n",
"return",
"filename",
",",
"metadata",
"\n",
"}"
] |
3,908 | all-3909 | [
"Save",
"calls",
"db",
".",
"Save",
"()",
"returning",
"more",
"descriptive",
"error",
"."
] | [
"func",
"Save",
"(",
"<mask>",
"*",
"reform",
".",
"Querier",
",",
"rec",
"reform",
".",
"Record",
")",
"error",
"{",
"if",
"err",
":=",
"db",
".",
"Save",
"(",
"rec",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"rec",
",",
"err",
")",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
] |
3,909 | all-3910 | [
"ApplicationNew",
"is",
"a",
"wrapper",
"around",
"g_application_new",
"()",
"."
] | [
"func",
"ApplicationNew",
"(",
"appID",
"string",
",",
"flags",
"ApplicationFlags",
")",
"*",
"Application",
"{",
"cstr1",
":=",
"(",
"*",
"C",
".",
"gchar",
")",
"(",
"C",
".",
"CString",
"(",
"appID",
")",
")",
"\n",
"defer",
"C",
".",
"free",
"(",
"unsafe",
".",
"Pointer",
"(",
"cstr1",
")",
")",
"\n\n",
"c",
":=",
"C",
".",
"g_application_new",
"(",
"cstr1",
",",
"C",
".",
"GApplicationFlags",
"(",
"<mask>",
")",
")",
"\n",
"if",
"c",
"==",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n",
"return",
"wrapApplication",
"(",
"wrapObject",
"(",
"unsafe",
".",
"Pointer",
"(",
"c",
")",
")",
")",
"\n",
"}"
] |
3,910 | all-3911 | [
"SetRequiredVersion",
"is",
"a",
"wrapper",
"around",
"gdk_gl_context_set_required_version",
"()",
"."
] | [
"func",
"(",
"v",
"*",
"GLContext",
")",
"SetRequiredVersion",
"(",
"<mask>",
",",
"minor",
"int",
")",
"{",
"C",
".",
"gdk_gl_context_set_required_version",
"(",
"v",
".",
"native",
"(",
")",
",",
"(",
"C",
".",
"int",
")",
"(",
"major",
")",
",",
"(",
"C",
".",
"int",
")",
"(",
"minor",
")",
")",
"\n",
"}"
] |
3,911 | all-3912 | [
"Do",
"executes",
"Runtime",
".",
"getIsolateId",
"against",
"the",
"provided",
"context",
".",
"returns",
":",
"id",
"-",
"The",
"isolate",
"id",
"."
] | [
"func",
"(",
"p",
"*",
"GetIsolateIDParams",
")",
"Do",
"(",
"ctx",
"context",
".",
"<mask>",
")",
"(",
"id",
"string",
",",
"err",
"error",
")",
"{",
"// execute",
"var",
"res",
"GetIsolateIDReturns",
"\n",
"err",
"=",
"cdp",
".",
"Execute",
"(",
"ctx",
",",
"CommandGetIsolateID",
",",
"nil",
",",
"&",
"res",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"\"",
"\"",
",",
"err",
"\n",
"}",
"\n\n",
"return",
"res",
".",
"ID",
",",
"nil",
"\n",
"}"
] |
3,912 | all-3913 | [
"The",
"9",
"pass",
"functions",
"below",
"takes",
"the",
"raftpb",
".",
"Entry",
"and",
"return",
"if",
"the",
"entry",
"should",
"be",
"printed",
"and",
"the",
"type",
"of",
"entry",
"the",
"type",
"of",
"the",
"entry",
"will",
"used",
"in",
"the",
"following",
"print",
"function"
] | [
"func",
"passConfChange",
"(",
"<mask>",
"raftpb",
".",
"Entry",
")",
"(",
"bool",
",",
"string",
")",
"{",
"return",
"entry",
".",
"Type",
"==",
"raftpb",
".",
"EntryConfChange",
",",
"\"",
"\"",
"\n",
"}"
] |
3,913 | all-3914 | [
"EndpointMessage",
"returns",
"the",
"endpoint",
"message",
"object",
"."
] | [
"func",
"(",
"s",
"*",
"Service",
")",
"EndpointMessage",
"(",
"channelID",
"string",
")",
"(",
"*",
"Message",
",",
"error",
")",
"{",
"c",
":=",
"make",
"(",
"chan",
"*",
"result",
")",
"\n",
"done",
":=",
"make",
"(",
"chan",
"bool",
")",
"\n\n",
"req",
":=",
"&",
"req",
"{",
"channelID",
":",
"channelID",
",",
"callback",
":",
"c",
",",
"done",
":",
"done",
"}",
"\n\n",
"go",
"s",
".",
"processing",
"(",
"req",
")",
"\n\n",
"select",
"{",
"case",
"result",
":=",
"<-",
"c",
":",
"return",
"result",
".",
"msg",
",",
"result",
".",
"err",
"\n",
"<mask>",
"<-",
"time",
".",
"After",
"(",
"s",
".",
"timeout",
")",
":",
"close",
"(",
"done",
")",
"\n",
"return",
"nil",
",",
"ErrTimeOut",
"\n",
"}",
"\n",
"}"
] |
3,914 | all-3915 | [
"WaitForUnprocessedRecords",
"block",
"execution",
"until",
"all",
"unprocessed",
"log",
"records",
"for",
"this",
"logger",
"are",
"processed",
".",
"In",
"order",
"to",
"wait",
"for",
"processing",
"in",
"all",
"loggers",
"logging",
".",
"WaitForAllUnprocessedRecords",
"can",
"be",
"used",
"."
] | [
"func",
"(",
"logger",
"*",
"Logger",
")",
"WaitForUnprocessedRecords",
"(",
")",
"{",
"runtime",
".",
"Gosched",
"(",
")",
"\n",
"<mask>",
"(",
"diff",
"uint64",
"\n",
"diffPrev",
"uint64",
"\n",
"i",
"uint8",
"\n",
")",
"\n",
"for",
"{",
"diff",
"=",
"atomic",
".",
"LoadUint64",
"(",
"&",
"logger",
".",
"countIn",
")",
"-",
"atomic",
".",
"LoadUint64",
"(",
"&",
"logger",
".",
"countOut",
")",
"\n",
"if",
"diff",
"==",
"diffPrev",
"{",
"i",
"++",
"\n",
"}",
"\n",
"if",
"i",
">=",
"100",
"{",
"return",
"\n",
"}",
"\n",
"if",
"diff",
">",
"0",
"{",
"diffPrev",
"=",
"diff",
"\n",
"time",
".",
"Sleep",
"(",
"10",
"*",
"time",
".",
"Millisecond",
")",
"\n",
"}",
"else",
"{",
"return",
"\n",
"}",
"\n",
"}",
"\n",
"}"
] |
3,915 | all-3916 | [
"GetId",
"returns",
"the",
"Id",
"field",
"if",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"."
] | [
"func",
"(",
"s",
"*",
"SyntheticsUser",
")",
"GetId",
"(",
")",
"int",
"{",
"if",
"s",
"==",
"nil",
"||",
"s",
".",
"<mask>",
"==",
"nil",
"{",
"return",
"0",
"\n",
"}",
"\n",
"return",
"*",
"s",
".",
"Id",
"\n",
"}"
] |
3,916 | all-3917 | [
"StartExternal",
"starts",
"an",
"external",
"segment",
"."
] | [
"func",
"(",
"t",
"*",
"<mask>",
")",
"StartExternal",
"(",
"host",
",",
"name",
"string",
")",
"error",
"{",
"t",
".",
"mtx",
".",
"Lock",
"(",
")",
"\n",
"defer",
"t",
".",
"mtx",
".",
"Unlock",
"(",
")",
"\n\n",
"id",
",",
"err",
":=",
"t",
".",
"Tracer",
".",
"BeginExternalSegment",
"(",
"t",
".",
"id",
",",
"t",
".",
"ss",
".",
"Peek",
"(",
")",
",",
"host",
",",
"name",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"t",
".",
"ss",
".",
"Push",
"(",
"id",
")",
"\n",
"return",
"nil",
"\n",
"}"
] |
3,917 | all-3918 | [
"Returns",
"a",
"time",
"at",
"the",
"key",
"or",
"the",
"specified",
"value",
"if",
"it",
"doesn",
"t",
"exist",
"or",
"isn",
"t",
"a",
"time"
] | [
"func",
"(",
"t",
"Typed",
")",
"TimeOr",
"(",
"<mask>",
"string",
",",
"d",
"time",
".",
"Time",
")",
"time",
".",
"Time",
"{",
"if",
"value",
",",
"exists",
":=",
"t",
".",
"TimeIf",
"(",
"key",
")",
";",
"exists",
"{",
"return",
"value",
"\n",
"}",
"\n",
"return",
"d",
"\n",
"}"
] |
3,918 | all-3919 | [
"ProfilesGet",
"returns",
"the",
"profiles",
"with",
"the",
"given",
"names",
"in",
"the",
"given",
"project",
"."
] | [
"func",
"(",
"c",
"*",
"Cluster",
")",
"ProfilesGet",
"(",
"project",
"string",
",",
"names",
"[",
"]",
"string",
")",
"(",
"[",
"]",
"api",
".",
"Profile",
",",
"error",
")",
"{",
"profiles",
":=",
"make",
"(",
"[",
"]",
"api",
".",
"Profile",
",",
"len",
"(",
"names",
")",
")",
"\n\n",
"err",
":=",
"c",
".",
"Transaction",
"(",
"func",
"(",
"tx",
"*",
"ClusterTx",
")",
"error",
"{",
"enabled",
",",
"err",
":=",
"tx",
".",
"ProjectHasProfiles",
"(",
"project",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"errors",
".",
"Wrap",
"(",
"err",
",",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"if",
"!",
"<mask>",
"{",
"project",
"=",
"\"",
"\"",
"\n",
"}",
"\n\n",
"for",
"i",
",",
"name",
":=",
"range",
"names",
"{",
"profile",
",",
"err",
":=",
"tx",
".",
"ProfileGet",
"(",
"project",
",",
"name",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"errors",
".",
"Wrapf",
"(",
"err",
",",
"\"",
"\"",
",",
"name",
")",
"\n",
"}",
"\n",
"profiles",
"[",
"i",
"]",
"=",
"*",
"ProfileToAPI",
"(",
"profile",
")",
"\n",
"}",
"\n\n",
"return",
"nil",
"\n",
"}",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"return",
"profiles",
",",
"nil",
"\n",
"}"
] |
3,919 | all-3920 | [
"DescribeTags",
"indicates",
"an",
"expected",
"call",
"of",
"DescribeTags"
] | [
"func",
"(",
"mr",
"*",
"MockClientSDKMockRecorder",
")",
"DescribeTags",
"(",
"arg0",
"<mask>",
"{",
"}",
")",
"*",
"gomock",
".",
"Call",
"{",
"return",
"mr",
".",
"mock",
".",
"ctrl",
".",
"RecordCallWithMethodType",
"(",
"mr",
".",
"mock",
",",
"\"",
"\"",
",",
"reflect",
".",
"TypeOf",
"(",
"(",
"*",
"MockClientSDK",
")",
"(",
"nil",
")",
".",
"DescribeTags",
")",
",",
"arg0",
")",
"\n",
"}"
] |
3,920 | all-3921 | [
"MutateSetOptions",
"for",
"ClearFlag",
"sets",
"the",
"SetOptionsOp",
"s",
"ClearFlags",
"field"
] | [
"func",
"(",
"m",
"ClearFlag",
")",
"MutateSetOptions",
"(",
"o",
"*",
"xdr",
".",
"SetOptionsOp",
")",
"(",
"err",
"error",
")",
"{",
"if",
"!",
"isFlagValid",
"(",
"xdr",
".",
"AccountFlags",
"(",
"m",
")",
")",
"{",
"return",
"<mask>",
".",
"New",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"var",
"val",
"xdr",
".",
"Uint32",
"\n",
"if",
"o",
".",
"ClearFlags",
"==",
"nil",
"{",
"val",
"=",
"xdr",
".",
"Uint32",
"(",
"m",
")",
"\n",
"}",
"else",
"{",
"val",
"=",
"xdr",
".",
"Uint32",
"(",
"m",
")",
"|",
"*",
"o",
".",
"ClearFlags",
"\n",
"}",
"\n",
"o",
".",
"ClearFlags",
"=",
"&",
"val",
"\n",
"return",
"\n",
"}"
] |
3,921 | all-3922 | [
"GetDisplayTypeOk",
"returns",
"a",
"tuple",
"with",
"the",
"DisplayType",
"field",
"if",
"it",
"s",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"and",
"a",
"boolean",
"to",
"check",
"if",
"the",
"value",
"has",
"been",
"set",
"."
] | [
"func",
"(",
"t",
"*",
"TimeseriesRequest",
")",
"GetDisplayTypeOk",
"(",
")",
"(",
"string",
",",
"bool",
")",
"{",
"if",
"t",
"==",
"nil",
"||",
"t",
".",
"DisplayType",
"==",
"nil",
"{",
"return",
"\"",
"\"",
",",
"false",
"\n",
"}",
"\n",
"return",
"*",
"t",
".",
"DisplayType",
",",
"<mask>",
"\n",
"}"
] |
3,922 | all-3923 | [
"virtualMachineIPsForTag",
"is",
"a",
"higher",
"-",
"level",
"wrapper",
"that",
"calls",
"out",
"to",
"functions",
"to",
"fetch",
"all",
"of",
"the",
"virtual",
"machines",
"matching",
"a",
"certain",
"tag",
"ID",
"and",
"then",
"gets",
"all",
"of",
"the",
"IP",
"addresses",
"for",
"those",
"virtual",
"machines",
"."
] | [
"func",
"virtualMachineIPsForTag",
"(",
"ctx",
"context",
".",
"Context",
",",
"client",
"*",
"vSphereClient",
",",
"id",
"string",
")",
"(",
"[",
"]",
"string",
",",
"error",
")",
"{",
"vms",
",",
"err",
":=",
"virtualMachinesForTag",
"(",
"ctx",
",",
"client",
",",
"id",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"return",
"ipAddrsForVirtualMachines",
"(",
"ctx",
",",
"<mask>",
",",
"vms",
")",
"\n",
"}"
] |
3,923 | all-3924 | [
"title",
":",
"app",
"sleep",
"path",
":",
"/",
"apps",
"/",
"{",
"app",
"}",
"/",
"sleep",
"method",
":",
"POST",
"consume",
":",
"application",
"/",
"x",
"-",
"www",
"-",
"form",
"-",
"urlencoded",
"produce",
":",
"application",
"/",
"x",
"-",
"json",
"-",
"stream",
"responses",
":",
"200",
":",
"Ok",
"400",
":",
"Invalid",
"data",
"401",
":",
"Unauthorized",
"404",
":",
"App",
"not",
"found"
] | [
"func",
"sleep",
"(",
"w",
"http",
".",
"ResponseWriter",
",",
"r",
"*",
"http",
".",
"Request",
",",
"t",
"auth",
".",
"Token",
")",
"(",
"err",
"error",
")",
"{",
"process",
":=",
"InputValue",
"(",
"r",
",",
"\"",
"\"",
")",
"\n",
"appName",
":=",
"r",
".",
"URL",
".",
"<mask>",
"(",
")",
".",
"Get",
"(",
"\"",
"\"",
")",
"\n",
"a",
",",
"err",
":=",
"getAppFromContext",
"(",
"appName",
",",
"r",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"proxy",
":=",
"InputValue",
"(",
"r",
",",
"\"",
"\"",
")",
"\n",
"if",
"proxy",
"==",
"\"",
"\"",
"{",
"return",
"&",
"errors",
".",
"HTTP",
"{",
"Code",
":",
"http",
".",
"StatusBadRequest",
",",
"Message",
":",
"\"",
"\"",
"}",
"\n",
"}",
"\n",
"proxyURL",
",",
"err",
":=",
"url",
".",
"Parse",
"(",
"proxy",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"log",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"proxy",
")",
"\n",
"return",
"err",
"\n",
"}",
"\n",
"allowed",
":=",
"permission",
".",
"Check",
"(",
"t",
",",
"permission",
".",
"PermAppUpdateSleep",
",",
"contextsForApp",
"(",
"&",
"a",
")",
"...",
",",
")",
"\n",
"if",
"!",
"allowed",
"{",
"return",
"permission",
".",
"ErrUnauthorized",
"\n",
"}",
"\n",
"evt",
",",
"err",
":=",
"event",
".",
"New",
"(",
"&",
"event",
".",
"Opts",
"{",
"Target",
":",
"appTarget",
"(",
"appName",
")",
",",
"Kind",
":",
"permission",
".",
"PermAppUpdateSleep",
",",
"Owner",
":",
"t",
",",
"CustomData",
":",
"event",
".",
"FormToCustomData",
"(",
"InputFields",
"(",
"r",
")",
")",
",",
"Allowed",
":",
"event",
".",
"Allowed",
"(",
"permission",
".",
"PermAppReadEvents",
",",
"contextsForApp",
"(",
"&",
"a",
")",
"...",
")",
",",
"}",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"defer",
"func",
"(",
")",
"{",
"evt",
".",
"Done",
"(",
"err",
")",
"}",
"(",
")",
"\n",
"w",
".",
"Header",
"(",
")",
".",
"Set",
"(",
"\"",
"\"",
",",
"\"",
"\"",
")",
"\n",
"keepAliveWriter",
":=",
"tsuruIo",
".",
"NewKeepAliveWriter",
"(",
"w",
",",
"30",
"*",
"time",
".",
"Second",
",",
"\"",
"\"",
")",
"\n",
"defer",
"keepAliveWriter",
".",
"Stop",
"(",
")",
"\n",
"writer",
":=",
"&",
"tsuruIo",
".",
"SimpleJsonMessageEncoderWriter",
"{",
"Encoder",
":",
"json",
".",
"NewEncoder",
"(",
"keepAliveWriter",
")",
"}",
"\n",
"evt",
".",
"SetLogWriter",
"(",
"writer",
")",
"\n",
"return",
"a",
".",
"Sleep",
"(",
"evt",
",",
"process",
",",
"proxyURL",
")",
"\n",
"}"
] |
3,924 | all-3925 | [
"NewDiffCmd",
"creates",
"a",
"new",
"DiffCmd",
"instance",
"."
] | [
"func",
"NewDiffCmd",
"(",
"releaseRepo",
"<mask>",
".",
"Release",
",",
"release1",
",",
"release2",
"string",
")",
"*",
"DiffCmd",
"{",
"return",
"&",
"DiffCmd",
"{",
"releaseRepo",
":",
"releaseRepo",
",",
"release1",
":",
"release1",
",",
"release2",
":",
"release2",
",",
"}",
"\n",
"}"
] |
3,925 | all-3926 | [
"GetType",
"returns",
"the",
"Type",
"field",
"if",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"."
] | [
"func",
"(",
"c",
"*",
"CheckStatusDefinition",
")",
"GetType",
"(",
")",
"string",
"{",
"if",
"c",
"==",
"nil",
"||",
"c",
".",
"<mask>",
"==",
"nil",
"{",
"return",
"\"",
"\"",
"\n",
"}",
"\n",
"return",
"*",
"c",
".",
"Type",
"\n",
"}"
] |
3,926 | all-3927 | [
"MutatePayment",
"for",
"NativeAmount",
"sets",
"the",
"PaymentOp",
"s",
"currency",
"field",
"to",
"native",
"and",
"sets",
"its",
"amount",
"to",
"the",
"provided",
"integer"
] | [
"func",
"(",
"m",
"NativeAmount",
")",
"MutatePayment",
"(",
"o",
"interface",
"{",
"}",
")",
"(",
"err",
"error",
")",
"{",
"switch",
"o",
":=",
"o",
".",
"(",
"type",
")",
"{",
"default",
":",
"err",
"=",
"errors",
".",
"New",
"(",
"\"",
"\"",
")",
"\n",
"case",
"*",
"xdr",
".",
"PaymentOp",
":",
"o",
".",
"Amount",
",",
"err",
"=",
"amount",
".",
"Parse",
"(",
"m",
".",
"Amount",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"\n",
"}",
"\n\n",
"o",
".",
"<mask>",
",",
"err",
"=",
"xdr",
".",
"NewAsset",
"(",
"xdr",
".",
"AssetTypeAssetTypeNative",
",",
"nil",
")",
"\n",
"case",
"*",
"xdr",
".",
"PathPaymentOp",
":",
"o",
".",
"DestAmount",
",",
"err",
"=",
"amount",
".",
"Parse",
"(",
"m",
".",
"Amount",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"\n",
"}",
"\n\n",
"o",
".",
"DestAsset",
",",
"err",
"=",
"xdr",
".",
"NewAsset",
"(",
"xdr",
".",
"AssetTypeAssetTypeNative",
",",
"nil",
")",
"\n",
"}",
"\n",
"return",
"\n",
"}"
] |
3,927 | all-3928 | [
"GetOrderByOk",
"returns",
"a",
"tuple",
"with",
"the",
"OrderBy",
"field",
"if",
"it",
"s",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"and",
"a",
"boolean",
"to",
"check",
"if",
"the",
"value",
"has",
"been",
"set",
"."
] | [
"func",
"(",
"g",
"*",
"GraphDefinitionRequest",
")",
"GetOrderByOk",
"(",
")",
"(",
"string",
",",
"bool",
")",
"{",
"if",
"g",
"==",
"nil",
"||",
"g",
".",
"OrderBy",
"==",
"nil",
"{",
"return",
"\"",
"\"",
",",
"<mask>",
"\n",
"}",
"\n",
"return",
"*",
"g",
".",
"OrderBy",
",",
"true",
"\n",
"}"
] |
3,928 | all-3929 | [
"Foreach",
"acts",
"the",
"same",
"as",
"g_slist_foreach",
"()",
".",
"No",
"user_data",
"argument",
"is",
"implemented",
"because",
"of",
"Go",
"clojure",
"capabilities",
"."
] | [
"func",
"(",
"v",
"*",
"SList",
")",
"Foreach",
"(",
"fn",
"func",
"(",
"ptr",
"unsafe",
".",
"Pointer",
")",
")",
"{",
"for",
"l",
":=",
"v",
";",
"l",
"!=",
"nil",
";",
"l",
"=",
"l",
".",
"Next",
"(",
")",
"{",
"fn",
"(",
"unsafe",
".",
"Pointer",
"(",
"l",
".",
"native",
"(",
")",
".",
"<mask>",
")",
")",
"\n",
"}",
"\n",
"}"
] |
3,929 | all-3930 | [
"Get",
"obtains",
"a",
"key",
"from",
"the",
"cache",
"and",
"checks",
"if",
"the",
"key",
"is",
"expired"
] | [
"func",
"(",
"mkc",
"*",
"memoryKeyCacher",
")",
"Get",
"(",
"keyID",
"string",
")",
"(",
"*",
"jose",
".",
"JSONWebKey",
",",
"error",
")",
"{",
"searchKey",
",",
"ok",
":=",
"mkc",
".",
"entries",
"[",
"keyID",
"]",
"\n",
"if",
"<mask>",
"{",
"if",
"mkc",
".",
"maxKeyAge",
"==",
"MaxKeyAgeNoCheck",
"||",
"!",
"mkc",
".",
"keyIsExpired",
"(",
"keyID",
")",
"{",
"return",
"&",
"searchKey",
".",
"JSONWebKey",
",",
"nil",
"\n",
"}",
"\n",
"return",
"nil",
",",
"ErrKeyExpired",
"\n",
"}",
"\n",
"return",
"nil",
",",
"ErrNoKeyFound",
"\n",
"}"
] |
3,930 | all-3931 | [
"NewBackend",
"creates",
"a",
"logger",
"backend",
"from",
"a",
"Writer",
"."
] | [
"func",
"NewBackend",
"(",
"w",
"<mask>",
".",
"Writer",
",",
"opts",
"...",
"BackendOption",
")",
"*",
"Backend",
"{",
"b",
":=",
"&",
"Backend",
"{",
"w",
":",
"w",
",",
"flag",
":",
"defaultFlags",
"}",
"\n",
"for",
"_",
",",
"o",
":=",
"range",
"opts",
"{",
"o",
"(",
"b",
")",
"\n",
"}",
"\n",
"return",
"b",
"\n",
"}"
] |
3,931 | all-3932 | [
"SetContentTypeBytes",
"sets",
"response",
"Content",
"-",
"Type",
".",
"It",
"is",
"safe",
"modifying",
"contentType",
"buffer",
"after",
"function",
"return",
"."
] | [
"func",
"(",
"ctx",
"*",
"RequestCtx",
")",
"SetContentTypeBytes",
"(",
"contentType",
"[",
"]",
"byte",
")",
"{",
"ctx",
".",
"<mask>",
".",
"Header",
".",
"SetContentTypeBytes",
"(",
"contentType",
")",
"\n",
"}"
] |
3,932 | all-3933 | [
"WithSignals",
"returns",
"a",
"Process",
"that",
"will",
"Close",
"()",
"when",
"any",
"given",
"signal",
"fires",
".",
"This",
"is",
"useful",
"to",
"bind",
"Process",
"trees",
"to",
"syscall",
".",
"SIGTERM",
"SIGKILL",
"etc",
"."
] | [
"func",
"WithSignals",
"(",
"sig",
"...",
"os",
".",
"Signal",
")",
"Process",
"{",
"p",
":=",
"WithParent",
"(",
"Background",
"(",
")",
")",
"\n",
"c",
":=",
"make",
"(",
"chan",
"<mask>",
".",
"Signal",
")",
"\n",
"signal",
".",
"Notify",
"(",
"c",
",",
"sig",
"...",
")",
"\n",
"go",
"func",
"(",
")",
"{",
"<-",
"c",
"\n",
"signal",
".",
"Stop",
"(",
"c",
")",
"\n",
"p",
".",
"Close",
"(",
")",
"\n",
"}",
"(",
")",
"\n",
"return",
"p",
"\n",
"}"
] |
3,933 | all-3934 | [
"TSDBSnapshot",
"implements",
"pb",
".",
"AdminServer",
"."
] | [
"func",
"(",
"s",
"*",
"AdminDisabled",
")",
"TSDBSnapshot",
"(",
"_",
"<mask>",
".",
"Context",
",",
"_",
"*",
"pb",
".",
"TSDBSnapshotRequest",
")",
"(",
"*",
"pb",
".",
"TSDBSnapshotResponse",
",",
"error",
")",
"{",
"return",
"nil",
",",
"errAdminDisabled",
"\n",
"}"
] |
3,934 | all-3935 | [
"NewWriter",
"creates",
"an",
"io",
".",
"WriteCloser",
"for",
"a",
"stream",
"of",
"bytes",
"to",
"be",
"chunked",
".",
"Chunks",
"are",
"created",
"based",
"on",
"the",
"content",
"then",
"hashed",
"and",
"deduplicated",
"/",
"uploaded",
"to",
"object",
"storage",
".",
"The",
"callback",
"arguments",
"are",
"the",
"chunk",
"hash",
"and",
"content",
"."
] | [
"func",
"(",
"s",
"*",
"<mask>",
")",
"NewWriter",
"(",
"ctx",
"context",
".",
"Context",
")",
"*",
"Writer",
"{",
"return",
"newWriter",
"(",
"ctx",
",",
"s",
".",
"objC",
",",
"s",
".",
"prefix",
")",
"\n",
"}"
] |
3,935 | all-3936 | [
"MarshalJSON",
"supports",
"json",
".",
"Marshaler",
"interface"
] | [
"func",
"(",
"v",
"Version",
")",
"MarshalJSON",
"(",
")",
"(",
"[",
"]",
"<mask>",
",",
"error",
")",
"{",
"w",
":=",
"jwriter",
".",
"Writer",
"{",
"}",
"\n",
"easyjsonC5a4559bEncodeGithubComChromedpCdprotoServiceworker",
"(",
"&",
"w",
",",
"v",
")",
"\n",
"return",
"w",
".",
"Buffer",
".",
"BuildBytes",
"(",
")",
",",
"w",
".",
"Error",
"\n",
"}"
] |
3,936 | all-3937 | [
"NewDefaultUAAManager",
"-"
] | [
"func",
"NewDefaultUAAManager",
"(",
"sysDomain",
",",
"clientID",
",",
"clientSecret",
",",
"userAgent",
"string",
",",
"peek",
"bool",
")",
"(",
"Manager",
",",
"error",
")",
"{",
"target",
":=",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"sysDomain",
")",
"\n",
"client",
",",
"err",
":=",
"uaaclient",
".",
"NewWithClientCredentials",
"(",
"target",
",",
"\"",
"\"",
",",
"clientID",
",",
"clientSecret",
",",
"uaaclient",
".",
"OpaqueToken",
",",
"true",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"client",
".",
"UserAgent",
"=",
"userAgent",
"\n",
"return",
"&",
"DefaultUAAManager",
"{",
"<mask>",
":",
"client",
",",
"Peek",
":",
"peek",
",",
"}",
",",
"nil",
"\n",
"}"
] |
3,937 | all-3938 | [
"UnmarshalJSON",
"supports",
"json",
".",
"Unmarshaler",
"interface"
] | [
"func",
"(",
"v",
"*",
"GetFlattenedDocumentParams",
")",
"UnmarshalJSON",
"(",
"data",
"[",
"]",
"byte",
")",
"error",
"{",
"r",
":=",
"jlexer",
".",
"Lexer",
"{",
"Data",
":",
"<mask>",
"}",
"\n",
"easyjsonC5a4559bDecodeGithubComChromedpCdprotoDom43",
"(",
"&",
"r",
",",
"v",
")",
"\n",
"return",
"r",
".",
"Error",
"(",
")",
"\n",
"}"
] |
3,938 | all-3939 | [
"UnmarshalEd25519PublicKey",
"returns",
"a",
"public",
"key",
"from",
"input",
"bytes",
"."
] | [
"func",
"UnmarshalEd25519PublicKey",
"(",
"<mask>",
"[",
"]",
"byte",
")",
"(",
"PubKey",
",",
"error",
")",
"{",
"if",
"len",
"(",
"data",
")",
"!=",
"32",
"{",
"return",
"nil",
",",
"errors",
".",
"New",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"return",
"&",
"Ed25519PublicKey",
"{",
"k",
":",
"ed25519",
".",
"PublicKey",
"(",
"data",
")",
",",
"}",
",",
"nil",
"\n",
"}"
] |
3,939 | all-3940 | [
"advance",
"advances",
"the",
"current",
"string",
"offset",
"."
] | [
"func",
"(",
"st",
"*",
"state",
")",
"advance",
"(",
"<mask>",
"int",
")",
"{",
"if",
"len",
"(",
"st",
".",
"str",
")",
"<",
"add",
"{",
"panic",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"st",
".",
"str",
"=",
"st",
".",
"str",
"[",
"add",
":",
"]",
"\n",
"st",
".",
"off",
"+=",
"add",
"\n",
"}"
] |
3,940 | all-3941 | [
"handleInvalidParamException",
"removes",
"the",
"event",
"from",
"event",
"queue",
"when",
"its",
"parameters",
"are",
"invalid",
"to",
"reduce",
"redundant",
"API",
"call"
] | [
"func",
"handleInvalidParamException",
"(",
"err",
"error",
",",
"events",
"*",
"list",
".",
"List",
",",
"eventToSubmit",
"*",
"list",
".",
"Element",
")",
"{",
"if",
"utils",
".",
"IsAWSErrorCodeEqual",
"(",
"err",
",",
"ecs",
".",
"ErrCodeInvalidParameterException",
")",
"{",
"event",
":=",
"eventToSubmit",
".",
"<mask>",
".",
"(",
"*",
"sendableEvent",
")",
"\n",
"seelog",
".",
"Warnf",
"(",
"\"",
"\"",
",",
"event",
".",
"toString",
"(",
")",
")",
"\n",
"events",
".",
"Remove",
"(",
"eventToSubmit",
")",
"\n",
"}",
"\n",
"}"
] |
3,941 | all-3942 | [
"UnmarshalJSON",
"supports",
"json",
".",
"Unmarshaler",
"interface"
] | [
"func",
"(",
"v",
"*",
"Initiator",
")",
"UnmarshalJSON",
"(",
"data",
"[",
"]",
"byte",
")",
"error",
"{",
"r",
":=",
"jlexer",
".",
"Lexer",
"{",
"Data",
":",
"<mask>",
"}",
"\n",
"easyjsonC5a4559bDecodeGithubComChromedpCdprotoNetwork27",
"(",
"&",
"r",
",",
"v",
")",
"\n",
"return",
"r",
".",
"Error",
"(",
")",
"\n",
"}"
] |
3,942 | all-3943 | [
"NewDriver",
"creates",
"and",
"returns",
"a",
"new",
"instance",
"of",
"the",
"driver"
] | [
"func",
"NewDriver",
"(",
"hostName",
",",
"storePath",
"string",
")",
"drivers",
".",
"Driver",
"{",
"return",
"&",
"Driver",
"{",
"EnginePort",
":",
"<mask>",
".",
"DefaultPort",
",",
"BaseDriver",
":",
"&",
"drivers",
".",
"BaseDriver",
"{",
"MachineName",
":",
"hostName",
",",
"StorePath",
":",
"storePath",
",",
"}",
",",
"}",
"\n",
"}"
] |
3,943 | all-3944 | [
"GoString",
"defines",
"the",
"printable",
"version",
"of",
"this",
"struct",
"."
] | [
"func",
"(",
"c",
"*",
"SSLConfig",
")",
"GoString",
"(",
")",
"string",
"{",
"if",
"c",
"==",
"nil",
"{",
"return",
"\"",
"\"",
"\n",
"}",
"\n\n",
"return",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
"+",
"\"",
"\"",
"+",
"\"",
"\"",
"+",
"\"",
"\"",
"+",
"\"",
"\"",
"+",
"\"",
"\"",
"+",
"\"",
"\"",
"+",
"\"",
"\"",
"+",
"\"",
"\"",
",",
"StringGoString",
"(",
"c",
".",
"CaCert",
")",
",",
"StringGoString",
"(",
"c",
".",
"CaPath",
")",
",",
"StringGoString",
"(",
"c",
".",
"Cert",
")",
",",
"BoolGoString",
"(",
"c",
".",
"Enabled",
")",
",",
"StringGoString",
"(",
"c",
".",
"<mask>",
")",
",",
"StringGoString",
"(",
"c",
".",
"ServerName",
")",
",",
"BoolGoString",
"(",
"c",
".",
"Verify",
")",
",",
")",
"\n",
"}"
] |
3,944 | all-3945 | [
"GetFile",
"returns",
"a",
"FileResponse",
"containing",
"a",
"Path",
"string",
"needed",
"to",
"download",
"a",
"file",
".",
"You",
"will",
"have",
"to",
"construct",
"the",
"download",
"link",
"manually",
"like",
"https",
":",
"//",
"api",
".",
"telegram",
".",
"org",
"/",
"file",
"/",
"bot<token",
">",
"/",
"<file_path",
">",
"where",
"<file_path",
">",
"is",
"taken",
"from",
"the",
"response",
"."
] | [
"func",
"(",
"api",
"*",
"TelegramBotAPI",
")",
"GetFile",
"(",
"fileID",
"string",
")",
"(",
"*",
"FileResponse",
",",
"error",
")",
"{",
"resp",
":=",
"&",
"FileResponse",
"{",
"}",
"\n",
"_",
",",
"err",
":=",
"api",
".",
"c",
".",
"getQuerystring",
"(",
"getFile",
",",
"resp",
",",
"map",
"[",
"string",
"]",
"string",
"{",
"\"",
"\"",
":",
"fileID",
"}",
")",
"\n\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"err",
"=",
"<mask>",
"(",
"&",
"resp",
".",
"baseResponse",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"return",
"resp",
",",
"nil",
"\n",
"}"
] |
3,945 | all-3946 | [
"Value",
"converts",
"a",
"value",
"to",
"a",
"database",
"driver",
"value"
] | [
"func",
"(",
"u",
"ISBN13",
")",
"Value",
"(",
")",
"(",
"<mask>",
".",
"Value",
",",
"error",
")",
"{",
"return",
"driver",
".",
"Value",
"(",
"string",
"(",
"u",
")",
")",
",",
"nil",
"\n",
"}"
] |
3,946 | all-3947 | [
"Parallel",
"walk",
"the",
"root",
"paths",
"and",
"populate",
"the",
"path",
"channel",
"for",
"the",
"worker",
"routines",
"to",
"consume",
"."
] | [
"func",
"(",
"w",
"*",
"workManager",
")",
"loadRecursive",
"(",
"paths",
"[",
"]",
"string",
")",
"{",
"walkFn",
":=",
"func",
"(",
"path",
"string",
",",
"info",
"os",
".",
"FileInfo",
",",
"err",
"error",
")",
"error",
"{",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n\n",
"var",
"isDir",
"bool",
"\n\n",
"if",
"info",
".",
"IsDir",
"(",
")",
"{",
"isDir",
"=",
"true",
"\n",
"}",
"else",
"if",
"info",
",",
"err",
"=",
"os",
".",
"Stat",
"(",
"path",
")",
";",
"err",
"==",
"nil",
"&&",
"info",
".",
"IsDir",
"(",
")",
"{",
"isDir",
"=",
"true",
"\n",
"}",
"\n\n",
"if",
"isDir",
"{",
"if",
"!",
"Options",
".",
"AllFiles",
"{",
"// Skip tranversing into hidden dirs",
"if",
"len",
"(",
"info",
".",
"Name",
"(",
")",
")",
">",
"1",
"&&",
"strings",
".",
"HasPrefix",
"(",
"<mask>",
".",
"Name",
"(",
")",
",",
"\"",
"\"",
")",
"{",
"return",
"walk",
".",
"SkipDir",
"\n",
"}",
"\n",
"}",
"\n\n",
"// Add the path to the input channel for sequence scanning",
"w",
".",
"inDirs",
"<-",
"path",
"\n",
"}",
"\n\n",
"return",
"nil",
"\n",
"}",
"\n\n",
"dirs",
",",
"seqs",
":=",
"preparePaths",
"(",
"paths",
")",
"\n\n",
"for",
"_",
",",
"s",
":=",
"range",
"seqs",
"{",
"w",
".",
"inSeqs",
"<-",
"s",
"\n",
"}",
"\n\n",
"for",
"_",
",",
"r",
":=",
"range",
"dirs",
"{",
"r",
":=",
"r",
"\n",
"if",
"err",
":=",
"walk",
".",
"Walk",
"(",
"r",
",",
"walkFn",
")",
";",
"err",
"!=",
"nil",
"{",
"if",
"err",
"!=",
"walk",
".",
"SkipDir",
"{",
"fmt",
".",
"Fprintf",
"(",
"errOut",
",",
"\"",
"\\n",
"\"",
",",
"ErrorPath",
",",
"r",
",",
"err",
")",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n",
"}"
] |
3,947 | all-3948 | [
"appendReplacementCandiates",
"creates",
"prioritize",
".",
"CandidateWithTime",
"values",
"for",
"(",
"transport",
"scope",
"digest",
")",
"and",
"returns",
"the",
"result",
"of",
"appending",
"them",
"to",
"candidates",
"."
] | [
"func",
"(",
"mem",
"*",
"cache",
")",
"appendReplacementCandidates",
"(",
"candidates",
"[",
"]",
"prioritize",
".",
"CandidateWithTime",
",",
"transport",
"types",
".",
"ImageTransport",
",",
"scope",
"types",
".",
"BICTransportScope",
",",
"digest",
"digest",
".",
"Digest",
")",
"[",
"]",
"prioritize",
".",
"CandidateWithTime",
"{",
"locations",
":=",
"mem",
".",
"knownLocations",
"[",
"locationKey",
"{",
"transport",
":",
"transport",
".",
"Name",
"(",
")",
",",
"scope",
":",
"scope",
",",
"blobDigest",
":",
"digest",
"}",
"]",
"// nil if not present",
"\n",
"for",
"l",
",",
"t",
":=",
"range",
"locations",
"{",
"candidates",
"=",
"append",
"(",
"candidates",
",",
"prioritize",
".",
"CandidateWithTime",
"{",
"Candidate",
":",
"types",
".",
"BICReplacementCandidate",
"{",
"Digest",
":",
"digest",
",",
"<mask>",
":",
"l",
",",
"}",
",",
"LastSeen",
":",
"t",
",",
"}",
")",
"\n",
"}",
"\n",
"return",
"candidates",
"\n",
"}"
] |
3,948 | all-3949 | [
"NewMethod",
"return",
"a",
"new",
"method",
"code",
"snippet",
"for",
"executing",
"a",
"certain",
"mapping",
"."
] | [
"func",
"NewMethod",
"(",
"database",
",",
"pkg",
",",
"entity",
",",
"kind",
"string",
",",
"config",
"map",
"[",
"string",
"]",
"string",
")",
"(",
"*",
"Method",
",",
"error",
")",
"{",
"packages",
",",
"err",
":=",
"Packages",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"method",
":=",
"&",
"Method",
"{",
"db",
":",
"<mask>",
",",
"pkg",
":",
"pkg",
",",
"entity",
":",
"entity",
",",
"kind",
":",
"kind",
",",
"config",
":",
"config",
",",
"packages",
":",
"packages",
",",
"}",
"\n\n",
"return",
"method",
",",
"nil",
"\n",
"}"
] |
3,949 | all-3950 | [
"GetState",
"returns",
"a",
"github",
".",
"com",
"/",
"machine",
"/",
"libmachine",
"/",
"state",
".",
"State",
"representing",
"the",
"state",
"of",
"the",
"host",
"(",
"running",
"stopped",
"etc",
".",
")"
] | [
"func",
"(",
"d",
"*",
"Driver",
")",
"GetState",
"(",
")",
"(",
"state",
".",
"State",
",",
"error",
")",
"{",
"vm",
",",
"err",
":=",
"d",
".",
"virtualMachine",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"state",
".",
"Error",
",",
"err",
"\n",
"}",
"\n",
"switch",
"vm",
".",
"State",
"{",
"case",
"\"",
"\"",
":",
"return",
"state",
".",
"Starting",
",",
"nil",
"\n",
"case",
"\"",
"\"",
":",
"return",
"state",
".",
"Running",
",",
"nil",
"\n",
"case",
"\"",
"\"",
":",
"return",
"state",
".",
"Running",
",",
"nil",
"\n",
"case",
"\"",
"\"",
":",
"return",
"state",
".",
"Stopped",
",",
"nil",
"\n",
"case",
"\"",
"\"",
":",
"return",
"state",
".",
"Stopped",
",",
"nil",
"\n",
"case",
"\"",
"\"",
":",
"return",
"state",
".",
"Stopped",
",",
"nil",
"\n",
"case",
"\"",
"\"",
":",
"return",
"state",
".",
"Paused",
",",
"nil",
"\n",
"case",
"\"",
"\"",
":",
"return",
"state",
".",
"Error",
",",
"nil",
"\n",
"case",
"\"",
"\"",
":",
"return",
"state",
".",
"Error",
",",
"nil",
"\n",
"case",
"\"",
"\"",
":",
"return",
"<mask>",
".",
"Stopped",
",",
"nil",
"\n",
"}",
"\n",
"return",
"state",
".",
"None",
",",
"nil",
"\n",
"}"
] |
3,950 | all-3951 | [
"Execute",
"implements",
"https",
":",
"//",
"godoc",
".",
"org",
"/",
"golang",
".",
"org",
"/",
"x",
"/",
"sys",
"/",
"windows",
"/",
"svc#Handler",
"The",
"basic",
"way",
"that",
"this",
"implementation",
"works",
"is",
"through",
"two",
"channels",
"(",
"representing",
"the",
"requests",
"from",
"Windows",
"and",
"the",
"responses",
"we",
"re",
"sending",
"to",
"Windows",
")",
"and",
"two",
"goroutines",
"(",
"one",
"for",
"message",
"processing",
"with",
"Windows",
"and",
"the",
"other",
"to",
"actually",
"run",
"the",
"agent",
")",
".",
"Once",
"we",
"ve",
"set",
"everything",
"up",
"and",
"started",
"both",
"goroutines",
"we",
"wait",
"for",
"either",
"one",
"to",
"exit",
"(",
"the",
"Windows",
"goroutine",
"will",
"exit",
"based",
"on",
"messages",
"from",
"Windows",
"while",
"the",
"agent",
"goroutine",
"exits",
"if",
"the",
"agent",
"exits",
")",
"and",
"then",
"cancel",
"the",
"other",
".",
"Once",
"everything",
"has",
"stopped",
"running",
"this",
"function",
"returns",
"and",
"the",
"process",
"exits",
"."
] | [
"func",
"(",
"h",
"*",
"<mask>",
")",
"Execute",
"(",
"args",
"[",
"]",
"string",
",",
"requests",
"<-",
"chan",
"svc",
".",
"ChangeRequest",
",",
"responses",
"chan",
"<-",
"svc",
".",
"Status",
")",
"(",
"bool",
",",
"uint32",
")",
"{",
"defer",
"seelog",
".",
"Flush",
"(",
")",
"\n",
"// channels for communication between goroutines",
"ctx",
",",
"cancel",
":=",
"context",
".",
"WithCancel",
"(",
"context",
".",
"Background",
"(",
")",
")",
"\n",
"agentDone",
":=",
"make",
"(",
"chan",
"struct",
"{",
"}",
")",
"\n",
"windowsDone",
":=",
"make",
"(",
"chan",
"struct",
"{",
"}",
")",
"\n",
"wg",
":=",
"sync",
".",
"WaitGroup",
"{",
"}",
"\n",
"wg",
".",
"Add",
"(",
"2",
")",
"\n\n",
"go",
"func",
"(",
")",
"{",
"defer",
"close",
"(",
"windowsDone",
")",
"\n",
"defer",
"wg",
".",
"Done",
"(",
")",
"\n",
"h",
".",
"handleWindowsRequests",
"(",
"ctx",
",",
"requests",
",",
"responses",
")",
"\n",
"}",
"(",
")",
"\n\n",
"var",
"agentExitCode",
"uint32",
"\n",
"go",
"func",
"(",
")",
"{",
"defer",
"close",
"(",
"agentDone",
")",
"\n",
"defer",
"wg",
".",
"Done",
"(",
")",
"\n",
"agentExitCode",
"=",
"h",
".",
"runAgent",
"(",
"ctx",
")",
"\n",
"}",
"(",
")",
"\n\n",
"// Wait until one of the goroutines is either told to stop or fails spectacularly. Under normal conditions we will",
"// be waiting here for a long time.",
"select",
"{",
"case",
"<-",
"windowsDone",
":",
"// Service was told to stop by the Windows API. This happens either through manual intervention (i.e.,",
"// \"Stop-Service AmazonECS\") or through system shutdown. Regardless, this is a normal exit event and not an",
"// error.",
"seelog",
".",
"Info",
"(",
"\"",
"\"",
")",
"\n",
"case",
"<-",
"agentDone",
":",
"// This means that the agent stopped on its own. This is where it's appropriate to light the event log on fire",
"// and set off all the alarms.",
"seelog",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"agentExitCode",
")",
"\n",
"}",
"\n",
"cancel",
"(",
")",
"\n",
"wg",
".",
"Wait",
"(",
")",
"\n",
"seelog",
".",
"Infof",
"(",
"\"",
"\"",
",",
"agentExitCode",
")",
"\n",
"return",
"true",
",",
"agentExitCode",
"\n",
"}"
] |
3,951 | all-3952 | [
"returns",
"ZoneID",
"-",
">",
"ZoneName",
"mapping",
"for",
"zones",
"that",
"are",
"managed",
"by",
"the",
"Designate",
"and",
"match",
"domain",
"filter"
] | [
"func",
"(",
"p",
"designateProvider",
")",
"getZones",
"(",
")",
"(",
"map",
"[",
"string",
"]",
"string",
",",
"error",
")",
"{",
"result",
":=",
"map",
"[",
"string",
"]",
"string",
"{",
"}",
"\n\n",
"err",
":=",
"p",
".",
"client",
".",
"ForEachZone",
"(",
"func",
"(",
"zone",
"*",
"zones",
".",
"Zone",
")",
"error",
"{",
"if",
"<mask>",
".",
"Type",
"!=",
"\"",
"\"",
"&&",
"strings",
".",
"ToUpper",
"(",
"zone",
".",
"Type",
")",
"!=",
"\"",
"\"",
"||",
"zone",
".",
"Status",
"!=",
"\"",
"\"",
"{",
"return",
"nil",
"\n",
"}",
"\n\n",
"zoneName",
":=",
"canonicalizeDomainName",
"(",
"zone",
".",
"Name",
")",
"\n",
"if",
"!",
"p",
".",
"domainFilter",
".",
"Match",
"(",
"zoneName",
")",
"{",
"return",
"nil",
"\n",
"}",
"\n",
"result",
"[",
"zone",
".",
"ID",
"]",
"=",
"zoneName",
"\n",
"return",
"nil",
"\n",
"}",
",",
")",
"\n\n",
"return",
"result",
",",
"err",
"\n",
"}"
] |
3,952 | all-3953 | [
"SelectMonth",
"is",
"a",
"wrapper",
"around",
"gtk_calendar_select_month",
"()",
"."
] | [
"func",
"(",
"v",
"*",
"Calendar",
")",
"SelectMonth",
"(",
"month",
",",
"year",
"uint",
")",
"{",
"C",
".",
"gtk_calendar_select_month",
"(",
"v",
".",
"native",
"(",
")",
",",
"C",
".",
"guint",
"(",
"month",
")",
",",
"C",
".",
"guint",
"(",
"<mask>",
")",
")",
"\n",
"}"
] |
3,953 | all-3954 | [
"NewObserver",
"creates",
"a",
"new",
"observer",
"that",
"can",
"be",
"registered",
"to",
"make",
"observations",
"on",
"a",
"Raft",
"instance",
".",
"Observations",
"will",
"be",
"sent",
"on",
"the",
"given",
"channel",
"if",
"they",
"satisfy",
"the",
"given",
"filter",
".",
"If",
"blocking",
"is",
"true",
"the",
"observer",
"will",
"block",
"when",
"it",
"can",
"t",
"send",
"on",
"the",
"channel",
"otherwise",
"it",
"may",
"discard",
"events",
"."
] | [
"func",
"NewObserver",
"(",
"channel",
"chan",
"Observation",
",",
"blocking",
"bool",
",",
"<mask>",
"FilterFn",
")",
"*",
"Observer",
"{",
"return",
"&",
"Observer",
"{",
"channel",
":",
"channel",
",",
"blocking",
":",
"blocking",
",",
"filter",
":",
"filter",
",",
"id",
":",
"atomic",
".",
"AddUint64",
"(",
"&",
"nextObserverID",
",",
"1",
")",
",",
"}",
"\n",
"}"
] |
3,954 | all-3955 | [
"Setup",
"provides",
"a",
"mock",
"function",
"with",
"given",
"fields",
":"
] | [
"func",
"(",
"_m",
"*",
"Storage",
")",
"Setup",
"(",
")",
"error",
"{",
"ret",
":=",
"_m",
".",
"Called",
"(",
")",
"\n\n",
"var",
"r0",
"error",
"\n",
"if",
"rf",
",",
"ok",
":=",
"ret",
".",
"Get",
"(",
"0",
")",
".",
"(",
"func",
"(",
")",
"error",
")",
";",
"<mask>",
"{",
"r0",
"=",
"rf",
"(",
")",
"\n",
"}",
"else",
"{",
"r0",
"=",
"ret",
".",
"Error",
"(",
"0",
")",
"\n",
"}",
"\n\n",
"return",
"r0",
"\n",
"}"
] |
3,955 | all-3956 | [
"schemaVirtualMachineGuestInfo",
"returns",
"schema",
"items",
"for",
"the",
"relevant",
"parts",
"of",
"GuestInfo",
"that",
"vsphere_virtual_machine",
"tracks",
"(",
"mostly",
"guest",
"information",
")",
"."
] | [
"func",
"schemaVirtualMachineGuestInfo",
"(",
")",
"map",
"[",
"string",
"]",
"*",
"schema",
".",
"Schema",
"{",
"return",
"map",
"[",
"string",
"]",
"*",
"schema",
".",
"Schema",
"{",
"\"",
"\"",
":",
"{",
"Type",
":",
"schema",
".",
"TypeString",
",",
"Computed",
":",
"true",
",",
"<mask>",
":",
"\"",
"\"",
",",
"}",
",",
"\"",
"\"",
":",
"{",
"Type",
":",
"schema",
".",
"TypeList",
",",
"Computed",
":",
"true",
",",
"Description",
":",
"\"",
"\"",
",",
"Elem",
":",
"&",
"schema",
".",
"Schema",
"{",
"Type",
":",
"schema",
".",
"TypeString",
"}",
",",
"}",
",",
"}",
"\n",
"}"
] |
3,956 | all-3957 | [
"Do",
"executes",
"Debugger",
".",
"setBlackboxedRanges",
"against",
"the",
"provided",
"context",
"."
] | [
"func",
"(",
"p",
"*",
"SetBlackboxedRangesParams",
")",
"Do",
"(",
"ctx",
"<mask>",
".",
"Context",
")",
"(",
"err",
"error",
")",
"{",
"return",
"cdp",
".",
"Execute",
"(",
"ctx",
",",
"CommandSetBlackboxedRanges",
",",
"p",
",",
"nil",
")",
"\n",
"}"
] |
3,957 | all-3958 | [
"With",
"returns",
"a",
"context",
".",
"Context",
"with",
"the",
"keyvals",
"attached",
"."
] | [
"func",
"(",
"c",
"*",
"contextT",
")",
"With",
"(",
"keyvals",
"...",
"interface",
"{",
"}",
")",
"context",
".",
"<mask>",
"{",
"return",
"&",
"contextT",
"{",
"ctx",
":",
"newContext",
"(",
"c",
".",
"ctx",
",",
"keyvals",
")",
"}",
"\n",
"}"
] |
3,958 | all-3959 | [
"Do",
"executes",
"Network",
".",
"getResponseBody",
"against",
"the",
"provided",
"context",
".",
"returns",
":",
"body",
"-",
"Response",
"body",
"."
] | [
"func",
"(",
"p",
"*",
"GetResponseBodyParams",
")",
"Do",
"(",
"ctx",
"context",
".",
"Context",
")",
"(",
"body",
"[",
"]",
"byte",
",",
"err",
"error",
")",
"{",
"// execute",
"var",
"res",
"GetResponseBodyReturns",
"\n",
"err",
"=",
"cdp",
".",
"Execute",
"(",
"ctx",
",",
"CommandGetResponseBody",
",",
"p",
",",
"&",
"res",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"// decode",
"var",
"dec",
"[",
"]",
"byte",
"\n",
"if",
"res",
".",
"Base64encoded",
"{",
"dec",
",",
"err",
"=",
"base64",
".",
"StdEncoding",
".",
"DecodeString",
"(",
"res",
".",
"Body",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"}",
"else",
"{",
"dec",
"=",
"[",
"]",
"byte",
"(",
"<mask>",
".",
"Body",
")",
"\n",
"}",
"\n",
"return",
"dec",
",",
"nil",
"\n",
"}"
] |
3,959 | all-3960 | [
"FetchWorksheets",
"retrieves",
"all",
"worksheets",
"available",
"to",
"API",
"Token",
"."
] | [
"func",
"(",
"a",
"*",
"API",
")",
"FetchWorksheets",
"(",
")",
"(",
"*",
"[",
"]",
"Worksheet",
",",
"error",
")",
"{",
"result",
",",
"err",
":=",
"a",
".",
"Get",
"(",
"config",
".",
"WorksheetPrefix",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"var",
"worksheets",
"[",
"]",
"Worksheet",
"\n",
"if",
"err",
":=",
"json",
".",
"Unmarshal",
"(",
"<mask>",
",",
"&",
"worksheets",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"return",
"&",
"worksheets",
",",
"nil",
"\n",
"}"
] |
3,960 | all-3961 | [
"MarshalJSON",
"supports",
"json",
".",
"Marshaler",
"interface"
] | [
"func",
"(",
"v",
"GetTargetInfoParams",
")",
"MarshalJSON",
"(",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"w",
":=",
"jwriter",
".",
"Writer",
"{",
"}",
"\n",
"easyjsonC5a4559bEncodeGithubComChromedpCdprotoTarget9",
"(",
"&",
"w",
",",
"v",
")",
"\n",
"return",
"w",
".",
"<mask>",
".",
"BuildBytes",
"(",
")",
",",
"w",
".",
"Error",
"\n",
"}"
] |
3,961 | all-3962 | [
"EmitLazyLogger",
"belongs",
"to",
"the",
"log",
".",
"Encoder",
"interface"
] | [
"func",
"(",
"m",
"*",
"MockKeyValue",
")",
"EmitLazyLogger",
"(",
"value",
"log",
".",
"LazyLogger",
")",
"{",
"var",
"meta",
"MockKeyValue",
"\n",
"value",
"(",
"&",
"meta",
")",
"\n",
"m",
".",
"Key",
"=",
"meta",
".",
"<mask>",
"\n",
"m",
".",
"ValueKind",
"=",
"meta",
".",
"ValueKind",
"\n",
"m",
".",
"ValueString",
"=",
"meta",
".",
"ValueString",
"\n",
"}"
] |
3,962 | all-3963 | [
"MarshalJSON",
"supports",
"json",
".",
"Marshaler",
"interface"
] | [
"func",
"(",
"v",
"EventConsoleAPICalled",
")",
"MarshalJSON",
"(",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"w",
":=",
"jwriter",
".",
"<mask>",
"{",
"}",
"\n",
"easyjsonC5a4559bEncodeGithubComChromedpCdprotoRuntime35",
"(",
"&",
"w",
",",
"v",
")",
"\n",
"return",
"w",
".",
"Buffer",
".",
"BuildBytes",
"(",
")",
",",
"w",
".",
"Error",
"\n",
"}"
] |
3,963 | all-3964 | [
"RegisterCustomDecoder",
"allows",
"to",
"define",
"custom",
"type",
"decoders",
"."
] | [
"func",
"RegisterCustomDecoder",
"(",
"fn",
"CustomTypeDecoder",
",",
"types",
"[",
"]",
"interface",
"{",
"}",
",",
"fields",
"[",
"]",
"interface",
"{",
"}",
")",
"{",
"rawFunc",
":=",
"(",
"func",
"(",
"[",
"]",
"string",
")",
"(",
"interface",
"{",
"}",
",",
"error",
")",
")",
"(",
"fn",
")",
"\n",
"decoder",
".",
"RegisterCustomType",
"(",
"rawFunc",
",",
"<mask>",
",",
"fields",
")",
"\n",
"}"
] |
3,964 | all-3965 | [
"resolveStaleImages",
"resolves",
"stale",
"images",
"."
] | [
"func",
"(",
"i",
"*",
"<mask>",
")",
"resolveStaleImages",
"(",
")",
"{",
"i",
".",
"lastTarget",
"=",
"nil",
"\n",
"for",
"img",
":=",
"range",
"i",
".",
"images",
"{",
"img",
".",
"resolveStale",
"(",
")",
"\n",
"}",
"\n",
"}"
] |
3,965 | all-3966 | [
"NewPgRemoteDump",
"-",
"a",
"pgdump",
"initialized",
"for",
"remote",
"fs"
] | [
"func",
"NewPgRemoteDump",
"(",
"port",
"int",
",",
"database",
",",
"username",
",",
"password",
"string",
",",
"sshCfg",
"<mask>",
".",
"SshConfig",
")",
"(",
"*",
"PgDump",
",",
"error",
")",
"{",
"return",
"NewPgRemoteDumpWithPath",
"(",
"port",
",",
"database",
",",
"username",
",",
"password",
",",
"sshCfg",
",",
"\"",
"\"",
")",
"\n",
"}"
] |
3,966 | all-3967 | [
"Fatal",
"outputs",
"Failed",
"log",
"and",
"exit",
"program"
] | [
"func",
"(",
"g",
"*",
"Glg",
")",
"Fatal",
"(",
"val",
"...",
"interface",
"{",
"}",
")",
"{",
"err",
":=",
"g",
".",
"out",
"(",
"FATAL",
",",
"blankFormat",
"(",
"len",
"(",
"val",
")",
")",
",",
"val",
"...",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"err",
"=",
"g",
".",
"Error",
"(",
"err",
".",
"Error",
"(",
")",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"panic",
"(",
"err",
")",
"\n",
"}",
"\n",
"}",
"\n",
"<mask>",
"(",
"1",
")",
"\n",
"}"
] |
3,967 | all-3968 | [
"GroupObjectsByPrimaryKeyHash",
"returns",
"a",
"map",
"with",
"all",
"objects",
"grouped",
"by",
"the",
"primary",
"key",
"hash",
"that",
"is",
"calculated",
"from",
"all",
"metadata",
"keys",
"with",
"the",
"primary",
"attribute",
".",
"All",
"returned",
"objects",
"could",
"have",
"the",
"same",
"content",
"even",
"if",
"are",
"not",
"the",
"same",
"."
] | [
"func",
"(",
"s",
"*",
"Seekret",
")",
"GroupObjectsByPrimaryKeyHash",
"(",
")",
"map",
"[",
"string",
"]",
"[",
"]",
"<mask>",
".",
"Object",
"{",
"return",
"models",
".",
"GroupObjectsByPrimaryKeyHash",
"(",
"s",
".",
"objectList",
")",
"\n",
"}"
] |
3,968 | all-3969 | [
"SetPosition",
"()",
"is",
"a",
"wrapper",
"around",
"gtk_paned_set_position",
"()",
"."
] | [
"func",
"(",
"v",
"*",
"Paned",
")",
"SetPosition",
"(",
"position",
"int",
")",
"{",
"C",
".",
"gtk_paned_set_position",
"(",
"v",
".",
"native",
"(",
")",
",",
"C",
".",
"gint",
"(",
"<mask>",
")",
")",
"\n",
"}"
] |
3,969 | all-3970 | [
"NewPEXReactor",
"creates",
"new",
"PEX",
"reactor",
"."
] | [
"func",
"NewPEXReactor",
"(",
"b",
"*",
"AddrBook",
")",
"*",
"PEXReactor",
"{",
"r",
":=",
"&",
"PEXReactor",
"{",
"<mask>",
":",
"b",
",",
"ensurePeersPeriod",
":",
"defaultEnsurePeersPeriod",
",",
"msgCountByPeer",
":",
"cmn",
".",
"NewCMap",
"(",
")",
",",
"maxMsgCountByPeer",
":",
"defaultMaxMsgCountByPeer",
",",
"}",
"\n",
"r",
".",
"BaseReactor",
"=",
"*",
"NewBaseReactor",
"(",
"log",
",",
"\"",
"\"",
",",
"r",
")",
"\n",
"return",
"r",
"\n",
"}"
] |
3,970 | all-3971 | [
"Nil",
"checks",
"a",
"value",
"is",
"nil",
"."
] | [
"func",
"Nil",
"(",
"tb",
"testing",
".",
"TB",
",",
"object",
"interface",
"{",
"}",
",",
"msgAndArgs",
"...",
"interface",
"{",
"}",
")",
"{",
"tb",
".",
"Helper",
"(",
")",
"\n",
"if",
"object",
"==",
"nil",
"{",
"return",
"\n",
"}",
"\n",
"<mask>",
":=",
"reflect",
".",
"ValueOf",
"(",
"object",
")",
"\n",
"kind",
":=",
"value",
".",
"Kind",
"(",
")",
"\n",
"if",
"kind",
">=",
"reflect",
".",
"Chan",
"&&",
"kind",
"<=",
"reflect",
".",
"Slice",
"&&",
"value",
".",
"IsNil",
"(",
")",
"{",
"return",
"\n",
"}",
"\n\n",
"fatal",
"(",
"tb",
",",
"msgAndArgs",
",",
"\"",
"\"",
",",
"object",
")",
"\n",
"}"
] |
3,971 | all-3972 | [
"resourceVSphereDPMHostOverrideFindEntry",
"attempts",
"to",
"locate",
"an",
"existing",
"DRS",
"VM",
"config",
"in",
"a",
"cluster",
"s",
"configuration",
".",
"It",
"s",
"used",
"by",
"the",
"resource",
"s",
"read",
"functionality",
"and",
"tests",
".",
"nil",
"is",
"returned",
"if",
"the",
"entry",
"cannot",
"be",
"found",
"."
] | [
"func",
"resourceVSphereDPMHostOverrideFindEntry",
"(",
"cluster",
"*",
"<mask>",
".",
"ClusterComputeResource",
",",
"host",
"*",
"object",
".",
"HostSystem",
",",
")",
"(",
"*",
"types",
".",
"ClusterDpmHostConfigInfo",
",",
"error",
")",
"{",
"props",
",",
"err",
":=",
"clustercomputeresource",
".",
"Properties",
"(",
"cluster",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"}",
"\n\n",
"for",
"_",
",",
"info",
":=",
"range",
"props",
".",
"ConfigurationEx",
".",
"(",
"*",
"types",
".",
"ClusterConfigInfoEx",
")",
".",
"DpmHostConfig",
"{",
"if",
"info",
".",
"Key",
"==",
"host",
".",
"Reference",
"(",
")",
"{",
"log",
".",
"Printf",
"(",
"\"",
"\"",
",",
"host",
".",
"Name",
"(",
")",
",",
"cluster",
".",
"Name",
"(",
")",
")",
"\n",
"return",
"&",
"info",
",",
"nil",
"\n",
"}",
"\n",
"}",
"\n\n",
"log",
".",
"Printf",
"(",
"\"",
"\"",
",",
"host",
".",
"Name",
"(",
")",
",",
"cluster",
".",
"Name",
"(",
")",
")",
"\n",
"return",
"nil",
",",
"nil",
"\n",
"}"
] |
3,972 | all-3973 | [
"AddChildAtAnchor",
"is",
"a",
"wrapper",
"around",
"gtk_text_view_add_child_at_anchor",
"()",
"."
] | [
"func",
"(",
"v",
"*",
"TextView",
")",
"AddChildAtAnchor",
"(",
"<mask>",
"IWidget",
",",
"anchor",
"*",
"TextChildAnchor",
")",
"{",
"C",
".",
"gtk_text_view_add_child_at_anchor",
"(",
"v",
".",
"native",
"(",
")",
",",
"child",
".",
"toWidget",
"(",
")",
",",
"anchor",
".",
"native",
"(",
")",
")",
"\n",
"}"
] |
3,973 | all-3974 | [
"HasModified",
"returns",
"a",
"boolean",
"if",
"a",
"field",
"has",
"been",
"set",
"."
] | [
"func",
"(",
"d",
"*",
"DashboardLite",
")",
"HasModified",
"(",
")",
"bool",
"{",
"if",
"d",
"!=",
"nil",
"&&",
"d",
".",
"Modified",
"!=",
"nil",
"{",
"return",
"<mask>",
"\n",
"}",
"\n\n",
"return",
"false",
"\n",
"}"
] |
3,974 | all-3975 | [
"CreateRelatedComment",
"adds",
"a",
"new",
"comment",
"but",
"lets",
"you",
"specify",
"the",
"related",
"identifier",
"for",
"the",
"comment",
"."
] | [
"func",
"(",
"client",
"*",
"Client",
")",
"CreateRelatedComment",
"(",
"handle",
",",
"message",
"string",
",",
"relid",
"int",
")",
"(",
"*",
"Comment",
",",
"error",
")",
"{",
"var",
"out",
"reqComment",
"\n",
"comment",
":=",
"Comment",
"{",
"Message",
":",
"String",
"(",
"message",
")",
",",
"RelatedId",
":",
"Int",
"(",
"relid",
")",
"}",
"\n",
"if",
"len",
"(",
"<mask>",
")",
">",
"0",
"{",
"comment",
".",
"Handle",
"=",
"String",
"(",
"handle",
")",
"\n",
"}",
"\n",
"if",
"err",
":=",
"client",
".",
"doJsonRequest",
"(",
"\"",
"\"",
",",
"\"",
"\"",
",",
"&",
"comment",
",",
"&",
"out",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"return",
"out",
".",
"Comment",
",",
"nil",
"\n",
"}"
] |
3,975 | all-3976 | [
"GetColorOk",
"returns",
"a",
"tuple",
"with",
"the",
"Color",
"field",
"if",
"it",
"s",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"and",
"a",
"boolean",
"to",
"check",
"if",
"the",
"value",
"has",
"been",
"set",
"."
] | [
"func",
"(",
"w",
"*",
"Widget",
")",
"GetColorOk",
"(",
")",
"(",
"string",
",",
"bool",
")",
"{",
"if",
"w",
"==",
"nil",
"||",
"w",
".",
"Color",
"==",
"nil",
"{",
"return",
"\"",
"\"",
",",
"false",
"\n",
"}",
"\n",
"return",
"*",
"w",
".",
"<mask>",
",",
"true",
"\n",
"}"
] |
3,976 | all-3977 | [
"SetMaxIdleConnsPerAddr",
"changes",
"the",
"maximum",
"number",
"of",
"idle",
"connections",
"kept",
"per",
"server",
".",
"If",
"maxIdle",
"<",
"0",
"no",
"idle",
"connections",
"are",
"kept",
".",
"If",
"maxIdle",
"==",
"0",
"the",
"default",
"number",
"(",
"currently",
"2",
")",
"is",
"used",
"."
] | [
"func",
"(",
"c",
"*",
"Client",
")",
"SetMaxIdleConnsPerAddr",
"(",
"maxIdle",
"int",
")",
"{",
"if",
"maxIdle",
"==",
"0",
"{",
"maxIdle",
"=",
"maxIdleConnsPerAddr",
"\n",
"}",
"\n",
"c",
".",
"mu",
".",
"Lock",
"(",
")",
"\n",
"defer",
"c",
".",
"mu",
".",
"Unlock",
"(",
")",
"\n",
"c",
".",
"maxIdlePerAddr",
"=",
"maxIdle",
"\n",
"if",
"maxIdle",
">",
"0",
"{",
"freeconn",
":=",
"<mask>",
"(",
"map",
"[",
"string",
"]",
"chan",
"*",
"conn",
")",
"\n",
"for",
"k",
",",
"v",
":=",
"range",
"c",
".",
"freeconn",
"{",
"ch",
":=",
"make",
"(",
"chan",
"*",
"conn",
",",
"maxIdle",
")",
"\n",
"ChanDone",
":",
"for",
"{",
"select",
"{",
"case",
"cn",
":=",
"<-",
"v",
":",
"select",
"{",
"case",
"ch",
"<-",
"cn",
":",
"default",
":",
"cn",
".",
"nc",
".",
"Close",
"(",
")",
"\n",
"}",
"\n",
"default",
":",
"freeconn",
"[",
"k",
"]",
"=",
"ch",
"\n",
"break",
"ChanDone",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n",
"c",
".",
"freeconn",
"=",
"freeconn",
"\n",
"}",
"else",
"{",
"c",
".",
"closeIdleConns",
"(",
")",
"\n",
"c",
".",
"freeconn",
"=",
"nil",
"\n",
"}",
"\n",
"}"
] |
3,977 | all-3978 | [
"dropPrefix",
"runs",
"a",
"L0",
"-",
">",
"L1",
"compaction",
"and",
"then",
"runs",
"same",
"level",
"compaction",
"on",
"the",
"rest",
"of",
"the",
"levels",
".",
"For",
"L0",
"-",
">",
"L1",
"compaction",
"it",
"runs",
"compactions",
"normally",
"but",
"skips",
"over",
"all",
"the",
"keys",
"with",
"the",
"provided",
"prefix",
".",
"For",
"Li",
"-",
">",
"Li",
"compactions",
"it",
"picks",
"up",
"the",
"tables",
"which",
"would",
"have",
"the",
"prefix",
".",
"The",
"tables",
"who",
"only",
"have",
"keys",
"with",
"this",
"prefix",
"are",
"quickly",
"dropped",
".",
"The",
"ones",
"which",
"have",
"other",
"keys",
"are",
"run",
"through",
"MergeIterator",
"and",
"compacted",
"to",
"create",
"new",
"tables",
".",
"All",
"the",
"mechanisms",
"of",
"compactions",
"apply",
"i",
".",
"e",
".",
"level",
"sizes",
"and",
"MANIFEST",
"are",
"updated",
"as",
"in",
"the",
"normal",
"flow",
"."
] | [
"func",
"(",
"s",
"*",
"levelsController",
")",
"dropPrefix",
"(",
"prefix",
"[",
"]",
"byte",
")",
"error",
"{",
"opt",
":=",
"s",
".",
"kv",
".",
"opt",
"\n",
"for",
"_",
",",
"l",
":=",
"range",
"s",
".",
"levels",
"{",
"l",
".",
"RLock",
"(",
")",
"\n",
"if",
"l",
".",
"level",
"==",
"0",
"{",
"size",
":=",
"len",
"(",
"l",
".",
"tables",
")",
"\n",
"l",
".",
"RUnlock",
"(",
")",
"\n\n",
"if",
"size",
">",
"0",
"{",
"cp",
":=",
"compactionPriority",
"{",
"level",
":",
"0",
",",
"score",
":",
"1.74",
",",
"// A unique number greater than 1.0 does two things. Helps identify this",
"// function in logs, and forces a compaction.",
"dropPrefix",
":",
"prefix",
",",
"}",
"\n",
"if",
"err",
":=",
"s",
".",
"doCompact",
"(",
"cp",
")",
";",
"err",
"!=",
"nil",
"{",
"opt",
".",
"Warningf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"return",
"nil",
"\n",
"}",
"\n",
"}",
"\n",
"continue",
"\n",
"}",
"\n\n",
"var",
"tables",
"[",
"]",
"*",
"table",
".",
"<mask>",
"\n",
"for",
"_",
",",
"table",
":=",
"range",
"l",
".",
"tables",
"{",
"var",
"absent",
"bool",
"\n",
"switch",
"{",
"case",
"bytes",
".",
"HasPrefix",
"(",
"table",
".",
"Smallest",
"(",
")",
",",
"prefix",
")",
":",
"case",
"bytes",
".",
"HasPrefix",
"(",
"table",
".",
"Biggest",
"(",
")",
",",
"prefix",
")",
":",
"case",
"bytes",
".",
"Compare",
"(",
"prefix",
",",
"table",
".",
"Smallest",
"(",
")",
")",
">",
"0",
"&&",
"bytes",
".",
"Compare",
"(",
"prefix",
",",
"table",
".",
"Biggest",
"(",
")",
")",
"<",
"0",
":",
"default",
":",
"absent",
"=",
"true",
"\n",
"}",
"\n",
"if",
"!",
"absent",
"{",
"tables",
"=",
"append",
"(",
"tables",
",",
"table",
")",
"\n",
"}",
"\n",
"}",
"\n",
"l",
".",
"RUnlock",
"(",
")",
"\n",
"if",
"len",
"(",
"tables",
")",
"==",
"0",
"{",
"continue",
"\n",
"}",
"\n\n",
"cd",
":=",
"compactDef",
"{",
"elog",
":",
"trace",
".",
"New",
"(",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"l",
".",
"level",
")",
",",
"\"",
"\"",
")",
",",
"thisLevel",
":",
"l",
",",
"nextLevel",
":",
"l",
",",
"top",
":",
"[",
"]",
"*",
"table",
".",
"Table",
"{",
"}",
",",
"bot",
":",
"tables",
",",
"dropPrefix",
":",
"prefix",
",",
"}",
"\n",
"if",
"err",
":=",
"s",
".",
"runCompactDef",
"(",
"l",
".",
"level",
",",
"cd",
")",
";",
"err",
"!=",
"nil",
"{",
"opt",
".",
"Warningf",
"(",
"\"",
"\"",
",",
"cd",
",",
"err",
")",
"\n",
"return",
"err",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
] |
3,978 | all-3979 | [
"String",
"prints",
"out",
"the",
"device",
"sub",
"-",
"resource",
"s",
"information",
"including",
"the",
"ID",
"at",
"time",
"of",
"instantiation",
"the",
"short",
"name",
"of",
"the",
"disk",
"and",
"the",
"current",
"device",
"key",
"and",
"address",
"."
] | [
"func",
"(",
"r",
"*",
"Subresource",
")",
"<mask>",
"(",
")",
"string",
"{",
"devaddr",
":=",
"r",
".",
"Get",
"(",
"\"",
"\"",
")",
".",
"(",
"string",
")",
"\n",
"if",
"devaddr",
"==",
"\"",
"\"",
"{",
"devaddr",
"=",
"\"",
"\"",
"\n",
"}",
"\n",
"return",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"r",
".",
"Addr",
"(",
")",
",",
"r",
".",
"Get",
"(",
"\"",
"\"",
")",
".",
"(",
"int",
")",
",",
"devaddr",
")",
"\n",
"}"
] |
3,979 | all-3980 | [
"Next",
"returns",
"the",
"next",
"page",
"of",
"resources",
".",
"If",
"there",
"are",
"no",
"more",
"resources",
"NoMoreResults",
"is",
"returned",
"."
] | [
"func",
"(",
"c",
"*",
"ApplicationPageIterator",
")",
"Next",
"(",
"ctx",
"context",
".",
"<mask>",
")",
"(",
"*",
"ApplicationPage",
",",
"error",
")",
"{",
"ap",
":=",
"new",
"(",
"ApplicationPage",
")",
"\n",
"err",
":=",
"c",
".",
"p",
".",
"Next",
"(",
"ctx",
",",
"ap",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"c",
".",
"p",
".",
"SetNextPageURI",
"(",
"ap",
".",
"NextPageURI",
")",
"\n",
"return",
"ap",
",",
"nil",
"\n",
"}"
] |
3,980 | all-3981 | [
"Write",
"behaves",
"like",
"io",
".",
"Writer",
".",
"Write",
"but",
"will",
"retry",
"on",
"EAGAIN"
] | [
"func",
"(",
"ew",
"Writer",
")",
"Write",
"(",
"p",
"[",
"]",
"byte",
")",
"(",
"int",
",",
"error",
")",
"{",
"again",
":",
"n",
",",
"err",
":=",
"ew",
".",
"Writer",
".",
"Write",
"(",
"p",
")",
"\n",
"if",
"err",
"==",
"nil",
"{",
"return",
"n",
",",
"nil",
"\n",
"}",
"\n\n",
"// keep retrying on EAGAIN",
"errno",
",",
"<mask>",
":=",
"shared",
".",
"GetErrno",
"(",
"err",
")",
"\n",
"if",
"ok",
"&&",
"(",
"errno",
"==",
"syscall",
".",
"EAGAIN",
"||",
"errno",
"==",
"syscall",
".",
"EINTR",
")",
"{",
"goto",
"again",
"\n",
"}",
"\n\n",
"return",
"n",
",",
"err",
"\n",
"}"
] |
3,981 | all-3982 | [
"NewSessionCache",
"creates",
"a",
"new",
"instance",
"of",
"SessionCache",
"and",
"defines",
"a",
"lifetime",
"for",
"sessions",
"and",
"a",
"initial",
"salt",
"for",
"random",
"input",
"."
] | [
"func",
"NewSessionCache",
"(",
"d",
"time",
".",
"Duration",
",",
"salt",
"string",
")",
"*",
"SessionCache",
"{",
"return",
"&",
"SessionCache",
"{",
"<mask>",
":",
"data",
".",
"NewCache",
"(",
"d",
")",
",",
"salter",
":",
"crypt",
".",
"NewSalter",
"(",
"crypt",
".",
"NewRandomSourceListSecure",
"(",
")",
",",
"[",
"]",
"byte",
"(",
"salt",
")",
")",
",",
"}",
"\n",
"}"
] |
3,982 | all-3983 | [
"Reverse",
"a",
"string"
] | [
"func",
"Reverse",
"(",
"s",
"string",
")",
"string",
"{",
"cs",
":=",
"<mask>",
"(",
"[",
"]",
"rune",
",",
"utf8",
".",
"RuneCountInString",
"(",
"s",
")",
")",
"\n",
"i",
":=",
"len",
"(",
"cs",
")",
"\n",
"for",
"_",
",",
"c",
":=",
"range",
"s",
"{",
"i",
"--",
"\n",
"cs",
"[",
"i",
"]",
"=",
"c",
"\n",
"}",
"\n",
"return",
"string",
"(",
"cs",
")",
"\n",
"}"
] |
3,983 | all-3984 | [
"MarshalJSON",
"supports",
"json",
".",
"Marshaler",
"interface"
] | [
"func",
"(",
"v",
"NameValuePair",
")",
"MarshalJSON",
"(",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"w",
":=",
"jwriter",
".",
"<mask>",
"{",
"}",
"\n",
"easyjsonC5a4559bEncodeGithubComChromedpCdprotoHar7",
"(",
"&",
"w",
",",
"v",
")",
"\n",
"return",
"w",
".",
"Buffer",
".",
"BuildBytes",
"(",
")",
",",
"w",
".",
"Error",
"\n",
"}"
] |
3,984 | all-3985 | [
"CutPeer",
"drops",
"messages",
"to",
"the",
"specified",
"peer",
"."
] | [
"func",
"(",
"s",
"*",
"EtcdServer",
")",
"CutPeer",
"(",
"id",
"<mask>",
".",
"ID",
")",
"{",
"tr",
",",
"ok",
":=",
"s",
".",
"r",
".",
"transport",
".",
"(",
"*",
"rafthttp",
".",
"Transport",
")",
"\n",
"if",
"ok",
"{",
"tr",
".",
"CutPeer",
"(",
"id",
")",
"\n",
"}",
"\n",
"}"
] |
3,985 | all-3986 | [
"Return",
"a",
"bool",
"if",
"ip",
"/",
"host",
"combo",
"in",
"hosts",
"file",
"."
] | [
"func",
"(",
"h",
"Hosts",
")",
"Has",
"(",
"ip",
"string",
",",
"host",
"string",
")",
"bool",
"{",
"<mask>",
":=",
"h",
".",
"getHostPosition",
"(",
"ip",
",",
"host",
")",
"\n\n",
"return",
"pos",
"!=",
"-",
"1",
"\n",
"}"
] |
3,986 | all-3987 | [
"GitHubTokenToUsername",
"takes",
"a",
"OAuth",
"access",
"token",
"issued",
"by",
"GitHub",
"and",
"uses",
"it",
"discover",
"the",
"username",
"of",
"the",
"user",
"who",
"obtained",
"the",
"code",
"(",
"or",
"verify",
"that",
"the",
"code",
"belongs",
"to",
"githubUsername",
")",
".",
"This",
"is",
"how",
"Pachyderm",
"currently",
"implements",
"authorization",
"in",
"a",
"production",
"cluster"
] | [
"func",
"GitHubTokenToUsername",
"(",
"ctx",
"context",
".",
"Context",
",",
"oauthToken",
"string",
")",
"(",
"string",
",",
"error",
")",
"{",
"if",
"!",
"githubTokenRegex",
".",
"MatchString",
"(",
"oauthToken",
")",
"&&",
"<mask>",
".",
"Getenv",
"(",
"DisableAuthenticationEnvVar",
")",
"==",
"\"",
"\"",
"{",
"logrus",
".",
"Warnf",
"(",
"\"",
"\"",
"+",
"\"",
"\"",
"+",
"\"",
"\\\"",
"\\\"",
"\"",
",",
"oauthToken",
")",
"\n",
"return",
"authclient",
".",
"GitHubPrefix",
"+",
"oauthToken",
",",
"nil",
"\n",
"}",
"\n\n",
"// Initialize GitHub client with 'oauthToken'",
"ts",
":=",
"oauth2",
".",
"StaticTokenSource",
"(",
"&",
"oauth2",
".",
"Token",
"{",
"AccessToken",
":",
"oauthToken",
",",
"}",
",",
")",
"\n",
"tc",
":=",
"oauth2",
".",
"NewClient",
"(",
"ctx",
",",
"ts",
")",
"\n",
"gclient",
":=",
"github",
".",
"NewClient",
"(",
"tc",
")",
"\n\n",
"// Retrieve the caller's GitHub Username (the empty string gets us the",
"// authenticated user)",
"user",
",",
"_",
",",
"err",
":=",
"gclient",
".",
"Users",
".",
"Get",
"(",
"ctx",
",",
"\"",
"\"",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"\"",
"\"",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"}",
"\n",
"verifiedUsername",
":=",
"user",
".",
"GetLogin",
"(",
")",
"\n",
"return",
"authclient",
".",
"GitHubPrefix",
"+",
"verifiedUsername",
",",
"nil",
"\n",
"}"
] |
3,987 | all-3988 | [
"Get",
"size",
"of",
"segment",
"."
] | [
"func",
"getSegmentSize",
"(",
"dir",
"string",
",",
"index",
"int",
")",
"(",
"int64",
",",
"error",
")",
"{",
"i",
":=",
"int64",
"(",
"-",
"1",
")",
"\n",
"fi",
",",
"err",
":=",
"os",
".",
"Stat",
"(",
"wal",
".",
"SegmentName",
"(",
"dir",
",",
"<mask>",
")",
")",
"\n",
"if",
"err",
"==",
"nil",
"{",
"i",
"=",
"fi",
".",
"Size",
"(",
")",
"\n",
"}",
"\n",
"return",
"i",
",",
"err",
"\n",
"}"
] |
3,988 | all-3989 | [
"NewTransactionMeta",
"creates",
"a",
"new",
"TransactionMeta",
"."
] | [
"func",
"NewTransactionMeta",
"(",
"v",
"int32",
",",
"value",
"interface",
"{",
"}",
")",
"(",
"result",
"TransactionMeta",
",",
"err",
"error",
")",
"{",
"result",
".",
"V",
"=",
"v",
"\n",
"switch",
"int32",
"(",
"v",
")",
"{",
"<mask>",
"0",
":",
"tv",
",",
"ok",
":=",
"value",
".",
"(",
"[",
"]",
"OperationMeta",
")",
"\n",
"if",
"!",
"ok",
"{",
"err",
"=",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
")",
"\n",
"return",
"\n",
"}",
"\n",
"result",
".",
"Operations",
"=",
"&",
"tv",
"\n",
"}",
"\n",
"return",
"\n",
"}"
] |
3,989 | all-3990 | [
"countToBoolean",
"converts",
"a",
"profile",
"containing",
"hit",
"counts",
"to",
"instead",
"contain",
"only",
"1s",
"or",
"0s",
"."
] | [
"func",
"countToBoolean",
"(",
"profile",
"[",
"]",
"*",
"cover",
".",
"Profile",
")",
"[",
"]",
"*",
"cover",
".",
"Profile",
"{",
"setProfile",
":=",
"make",
"(",
"[",
"]",
"*",
"cover",
".",
"Profile",
",",
"0",
",",
"len",
"(",
"profile",
")",
")",
"\n",
"for",
"_",
",",
"p",
":=",
"range",
"profile",
"{",
"<mask>",
":=",
"deepCopyProfile",
"(",
"*",
"p",
")",
"\n",
"for",
"i",
":=",
"range",
"pc",
".",
"Blocks",
"{",
"if",
"pc",
".",
"Blocks",
"[",
"i",
"]",
".",
"Count",
">",
"0",
"{",
"pc",
".",
"Blocks",
"[",
"i",
"]",
".",
"Count",
"=",
"1",
"\n",
"}",
"\n",
"}",
"\n",
"setProfile",
"=",
"append",
"(",
"setProfile",
",",
"&",
"pc",
")",
"\n",
"}",
"\n",
"return",
"setProfile",
"\n",
"}"
] |
3,990 | all-3991 | [
"UnmarshalJSON",
"sets",
"the",
"DateTime",
"from",
"JSON"
] | [
"func",
"(",
"t",
"*",
"DateTime",
")",
"UnmarshalJSON",
"(",
"data",
"[",
"]",
"byte",
")",
"error",
"{",
"if",
"string",
"(",
"data",
")",
"==",
"jsonNull",
"{",
"return",
"nil",
"\n",
"}",
"\n",
"l",
":=",
"jlexer",
".",
"Lexer",
"{",
"Data",
":",
"data",
"}",
"\n",
"t",
".",
"UnmarshalEasyJSON",
"(",
"&",
"l",
")",
"\n",
"return",
"l",
".",
"<mask>",
"(",
")",
"\n",
"}"
] |
3,991 | all-3992 | [
"Register",
"registers",
"the",
"specified",
"methods",
"specified",
"as",
"a",
"map",
"from",
"method",
"name",
"to",
"the",
"JSON",
"handler",
"function",
".",
"The",
"handler",
"functions",
"should",
"have",
"the",
"following",
"signature",
":",
"func",
"(",
"context",
".",
"Context",
"*",
"ArgType",
")",
"(",
"*",
"ResType",
"error",
")"
] | [
"func",
"Register",
"(",
"registrar",
"tchannel",
".",
"Registrar",
",",
"funcs",
"Handlers",
",",
"onError",
"func",
"(",
"context",
".",
"Context",
",",
"error",
")",
")",
"error",
"{",
"handlers",
":=",
"make",
"(",
"map",
"[",
"string",
"]",
"*",
"<mask>",
")",
"\n\n",
"handler",
":=",
"tchannel",
".",
"HandlerFunc",
"(",
"func",
"(",
"ctx",
"context",
".",
"Context",
",",
"call",
"*",
"tchannel",
".",
"InboundCall",
")",
"{",
"h",
",",
"ok",
":=",
"handlers",
"[",
"string",
"(",
"call",
".",
"Method",
"(",
")",
")",
"]",
"\n",
"if",
"!",
"ok",
"{",
"onError",
"(",
"ctx",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"call",
".",
"Method",
"(",
")",
")",
")",
"\n",
"return",
"\n",
"}",
"\n\n",
"if",
"err",
":=",
"h",
".",
"Handle",
"(",
"ctx",
",",
"call",
")",
";",
"err",
"!=",
"nil",
"{",
"onError",
"(",
"ctx",
",",
"err",
")",
"\n",
"}",
"\n",
"}",
")",
"\n\n",
"for",
"m",
",",
"f",
":=",
"range",
"funcs",
"{",
"h",
",",
"err",
":=",
"toHandler",
"(",
"f",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"m",
",",
"err",
")",
"\n",
"}",
"\n",
"h",
".",
"tracer",
"=",
"func",
"(",
")",
"opentracing",
".",
"Tracer",
"{",
"return",
"tchannel",
".",
"TracerFromRegistrar",
"(",
"registrar",
")",
"\n",
"}",
"\n",
"handlers",
"[",
"m",
"]",
"=",
"h",
"\n",
"registrar",
".",
"Register",
"(",
"handler",
",",
"m",
")",
"\n",
"}",
"\n\n",
"return",
"nil",
"\n",
"}"
] |
3,992 | all-3993 | [
"HandlerBuilder",
"can",
"be",
"used",
"to",
"create",
"a",
"scaffold",
".",
"Handler",
"based",
"on",
"a",
"Handler"
] | [
"func",
"HandlerBuilder",
"(",
"i",
"interface",
"{",
"}",
")",
"(",
"scaffold",
".",
"<mask>",
",",
"error",
")",
"{",
"switch",
"i",
".",
"(",
"type",
")",
"{",
"case",
"Handler",
":",
"return",
"build",
"(",
"i",
".",
"(",
"Handler",
")",
")",
",",
"nil",
"\n",
"case",
"func",
"(",
"context",
".",
"Context",
",",
"http",
".",
"ResponseWriter",
",",
"*",
"http",
".",
"Request",
")",
"error",
":",
"return",
"build",
"(",
"HandlerFunc",
"(",
"i",
".",
"(",
"func",
"(",
"context",
".",
"Context",
",",
"http",
".",
"ResponseWriter",
",",
"*",
"http",
".",
"Request",
")",
"error",
")",
")",
")",
",",
"nil",
"\n",
"}",
"\n\n",
"return",
"nil",
",",
"errors",
".",
"New",
"(",
"\"",
"\"",
")",
"\n",
"}"
] |
3,993 | all-3994 | [
"Lerp",
"returns",
"the",
"result",
"vector",
"of",
"a",
"linear",
"interpolation",
"between",
"two",
"vectors",
".",
"v",
"toward",
"v1",
".",
"The",
"interpolation",
"factor",
"t",
"should",
"be",
"comprised",
"betwenn",
"0",
"and",
"1",
".",
"0",
".",
"[",
"Limits",
":",
"0",
"<",
"=",
"value",
"<",
"=",
"1",
".",
"0",
"]"
] | [
"func",
"(",
"v",
"Vec2",
")",
"Lerp",
"(",
"<mask>",
",",
"v1",
"Vec2",
",",
"t",
"float32",
")",
"Vec2",
"{",
"return",
"Vec2",
"{",
"v",
"[",
"0",
"]",
"+",
"(",
"v1",
"[",
"0",
"]",
"-",
"v",
"[",
"0",
"]",
")",
"*",
"t",
",",
"v",
"[",
"1",
"]",
"+",
"(",
"v1",
"[",
"1",
"]",
"-",
"v",
"[",
"1",
"]",
")",
"*",
"t",
",",
"}",
"\n",
"}"
] |
3,994 | all-3995 | [
"SetUInt",
"is",
"a",
"wrapper",
"around",
"g_value_set_uint",
"()",
"."
] | [
"func",
"(",
"v",
"*",
"<mask>",
")",
"SetUInt",
"(",
"val",
"uint",
")",
"{",
"C",
".",
"g_value_set_uint",
"(",
"v",
".",
"native",
"(",
")",
",",
"C",
".",
"guint",
"(",
"val",
")",
")",
"\n",
"}"
] |
3,995 | all-3996 | [
"ApplyExecutionRoleLogsAuth",
"will",
"check",
"whether",
"the",
"task",
"has",
"execution",
"role",
"credentials",
"and",
"add",
"the",
"genereated",
"credentials",
"endpoint",
"to",
"the",
"associated",
"HostConfig"
] | [
"func",
"(",
"task",
"*",
"Task",
")",
"ApplyExecutionRoleLogsAuth",
"(",
"hostConfig",
"*",
"dockercontainer",
".",
"HostConfig",
",",
"credentialsManager",
"credentials",
".",
"Manager",
")",
"*",
"apierrors",
".",
"HostConfigError",
"{",
"id",
":=",
"<mask>",
".",
"GetExecutionCredentialsID",
"(",
")",
"\n",
"if",
"id",
"==",
"\"",
"\"",
"{",
"// No execution credentials set for the task. Do not inject the endpoint environment variable.",
"return",
"&",
"apierrors",
".",
"HostConfigError",
"{",
"Msg",
":",
"\"",
"\"",
"}",
"\n",
"}",
"\n\n",
"executionRoleCredentials",
",",
"ok",
":=",
"credentialsManager",
".",
"GetTaskCredentials",
"(",
"id",
")",
"\n",
"if",
"!",
"ok",
"{",
"// Task has credentials id set, but credentials manager is unaware of",
"// the id. This should never happen as the payload handler sets",
"// credentialsId for the task after adding credentials to the",
"// credentials manager",
"return",
"&",
"apierrors",
".",
"HostConfigError",
"{",
"Msg",
":",
"\"",
"\"",
"}",
"\n",
"}",
"\n",
"credentialsEndpointRelativeURI",
":=",
"executionRoleCredentials",
".",
"IAMRoleCredentials",
".",
"GenerateCredentialsEndpointRelativeURI",
"(",
")",
"\n",
"hostConfig",
".",
"LogConfig",
".",
"Config",
"[",
"awslogsCredsEndpointOpt",
"]",
"=",
"credentialsEndpointRelativeURI",
"\n",
"return",
"nil",
"\n",
"}"
] |
3,996 | all-3997 | [
"MarshalEasyJSON",
"satisfies",
"easyjson",
".",
"Marshaler",
"."
] | [
"func",
"(",
"t",
"ResourceType",
")",
"MarshalEasyJSON",
"(",
"out",
"*",
"jwriter",
".",
"Writer",
")",
"{",
"<mask>",
".",
"String",
"(",
"string",
"(",
"t",
")",
")",
"\n",
"}"
] |
3,997 | all-3998 | [
"/",
"*",
"FileChooserNative"
] | [
"func",
"OpenFileChooserNative",
"(",
"title",
"string",
",",
"parent_window",
"*",
"Window",
")",
"*",
"string",
"{",
"c_title",
":=",
"C",
".",
"CString",
"(",
"title",
")",
"\n\n",
"var",
"native",
"*",
"C",
".",
"GtkFileChooserNative",
"\n\n",
"native",
"=",
"C",
".",
"gtk_file_chooser_native_new",
"(",
"(",
"*",
"C",
".",
"gchar",
")",
"(",
"c_title",
")",
",",
"parent_window",
".",
"native",
"(",
")",
",",
"C",
".",
"GtkFileChooserAction",
"(",
"FILE_CHOOSER_ACTION_OPEN",
")",
",",
"(",
"*",
"C",
".",
"gchar",
")",
"(",
"C",
".",
"CString",
"(",
"\"",
"\"",
")",
")",
",",
"(",
"*",
"C",
".",
"gchar",
")",
"(",
"C",
".",
"CString",
"(",
"\"",
"\"",
")",
")",
")",
"\n\n",
"p",
":=",
"unsafe",
".",
"Pointer",
"(",
"unsafe",
".",
"Pointer",
"(",
"native",
")",
")",
"\n",
"dlg",
":=",
"C",
".",
"toGtkNativeDialog",
"(",
"p",
")",
"\n",
"<mask>",
":=",
"C",
".",
"gtk_native_dialog_run",
"(",
"dlg",
")",
"\n\n",
"if",
"res",
"==",
"C",
".",
"GTK_RESPONSE_ACCEPT",
"{",
"c",
":=",
"C",
".",
"gtk_file_chooser_get_filename",
"(",
"C",
".",
"toGtkFileChooser",
"(",
"p",
")",
")",
"\n",
"s",
":=",
"goString",
"(",
"c",
")",
"\n",
"defer",
"C",
".",
"g_free",
"(",
"(",
"C",
".",
"gpointer",
")",
"(",
"c",
")",
")",
"\n\n",
"return",
"&",
"s",
"\n",
"}",
"\n\n",
"return",
"nil",
"\n",
"}"
] |
3,998 | all-3999 | [
"DeepCopyInto",
"is",
"an",
"autogenerated",
"deepcopy",
"function",
"copying",
"the",
"receiver",
"writing",
"into",
"out",
".",
"in",
"must",
"be",
"non",
"-",
"nil",
"."
] | [
"func",
"(",
"in",
"Targets",
")",
"DeepCopyInto",
"(",
"out",
"*",
"Targets",
")",
"{",
"{",
"in",
":=",
"&",
"in",
"\n",
"*",
"out",
"=",
"make",
"(",
"Targets",
",",
"len",
"(",
"*",
"in",
")",
")",
"\n",
"<mask>",
"(",
"*",
"out",
",",
"*",
"in",
")",
"\n",
"return",
"\n",
"}",
"\n",
"}"
] |
3,999 | all-4000 | [
"TODO",
"(",
"prashantv",
")",
":",
"Clean",
"up",
"json",
".",
"Call",
"*",
"interfaces",
"."
] | [
"func",
"wrapCall",
"(",
"ctx",
"Context",
",",
"call",
"*",
"tchannel",
".",
"OutboundCall",
",",
"method",
"string",
",",
"arg",
",",
"resp",
"<mask>",
"{",
"}",
")",
"error",
"{",
"var",
"respHeaders",
"map",
"[",
"string",
"]",
"string",
"\n",
"var",
"respErr",
"ErrApplication",
"\n",
"isOK",
",",
"errAt",
",",
"err",
":=",
"makeCall",
"(",
"call",
",",
"ctx",
".",
"Headers",
"(",
")",
",",
"arg",
",",
"&",
"respHeaders",
",",
"resp",
",",
"&",
"respErr",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"errAt",
",",
"err",
")",
"\n",
"}",
"\n",
"if",
"!",
"isOK",
"{",
"return",
"respErr",
"\n",
"}",
"\n\n",
"ctx",
".",
"SetResponseHeaders",
"(",
"respHeaders",
")",
"\n",
"return",
"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.