id
int32 0
25.3k
| idx
stringlengths 5
9
| nl_tokens
sequencelengths 1
418
| pl_tokens
sequencelengths 22
4.98k
|
---|---|---|---|
10,700 | all-10701 | [
"SetSocketTimeout",
"sets",
"the",
"amount",
"of",
"time",
"to",
"wait",
"for",
"a",
"non",
"-",
"responding",
"socket",
"to",
"the",
"database",
"before",
"it",
"is",
"forcefully",
"closed",
"."
] | [
"func",
"(",
"s",
"*",
"Session",
")",
"SetSocketTimeout",
"(",
"d",
"<mask>",
".",
"Duration",
")",
"{",
"s",
".",
"m",
".",
"Lock",
"(",
")",
"\n",
"s",
".",
"sockTimeout",
"=",
"d",
"\n",
"if",
"s",
".",
"masterSocket",
"!=",
"nil",
"{",
"s",
".",
"masterSocket",
".",
"SetTimeout",
"(",
"d",
")",
"\n",
"}",
"\n",
"if",
"s",
".",
"slaveSocket",
"!=",
"nil",
"{",
"s",
".",
"slaveSocket",
".",
"SetTimeout",
"(",
"d",
")",
"\n",
"}",
"\n",
"s",
".",
"m",
".",
"Unlock",
"(",
")",
"\n",
"}"
] |
10,701 | all-10702 | [
"GetHardMargins",
"()",
"is",
"a",
"wrapper",
"around",
"gtk_print_context_get_hard_margins",
"()",
"."
] | [
"func",
"(",
"pc",
"*",
"PrintContext",
")",
"GetHardMargins",
"(",
")",
"(",
"float64",
",",
"float64",
",",
"float64",
",",
"float64",
",",
"error",
")",
"{",
"var",
"top",
",",
"bottom",
",",
"left",
",",
"right",
"C",
".",
"gdouble",
"\n",
"c",
":=",
"C",
".",
"gtk_print_context_get_hard_margins",
"(",
"pc",
".",
"native",
"(",
")",
",",
"&",
"top",
",",
"&",
"bottom",
",",
"&",
"left",
",",
"&",
"right",
")",
"\n",
"if",
"gobool",
"(",
"c",
")",
"==",
"false",
"{",
"return",
"0.0",
",",
"0.0",
",",
"0.0",
",",
"0.0",
",",
"errors",
".",
"New",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"return",
"float64",
"(",
"top",
")",
",",
"float64",
"(",
"<mask>",
")",
",",
"float64",
"(",
"left",
")",
",",
"float64",
"(",
"right",
")",
",",
"nil",
"\n",
"}"
] |
10,702 | all-10703 | [
"NewTemplate",
"from",
"the",
"input",
"string",
".",
"Adds",
"all",
"of",
"the",
"global",
"helper",
"functions",
"from",
"Helpers",
"this",
"function",
"does",
"not",
"cache",
"the",
"template",
"."
] | [
"func",
"NewTemplate",
"(",
"input",
"string",
")",
"(",
"*",
"Template",
",",
"error",
")",
"{",
"t",
":=",
"&",
"Template",
"{",
"Input",
":",
"<mask>",
",",
"}",
"\n",
"err",
":=",
"t",
".",
"Parse",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"t",
",",
"err",
"\n",
"}",
"\n",
"return",
"t",
",",
"nil",
"\n",
"}"
] |
10,703 | all-10704 | [
"Discover",
"queries",
"Hyperbahn",
"for",
"a",
"list",
"of",
"peers",
"that",
"are",
"currently",
"advertised",
"with",
"the",
"specified",
"service",
"name",
"."
] | [
"func",
"(",
"c",
"*",
"Client",
")",
"Discover",
"(",
"serviceName",
"string",
")",
"(",
"[",
"]",
"string",
",",
"error",
")",
"{",
"ctx",
",",
"cancel",
":=",
"thrift",
".",
"NewContext",
"(",
"time",
".",
"Second",
")",
"\n",
"defer",
"cancel",
"(",
")",
"\n\n",
"result",
",",
"err",
":=",
"c",
".",
"hyperbahnClient",
".",
"Discover",
"(",
"ctx",
",",
"&",
"hyperbahn",
".",
"DiscoveryQuery",
"{",
"ServiceName",
":",
"serviceName",
"}",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"var",
"hostPorts",
"[",
"]",
"string",
"\n",
"for",
"_",
",",
"peer",
":=",
"range",
"result",
".",
"GetPeers",
"(",
")",
"{",
"hostPorts",
"=",
"<mask>",
"(",
"hostPorts",
",",
"servicePeerToHostPort",
"(",
"peer",
")",
")",
"\n",
"}",
"\n\n",
"return",
"hostPorts",
",",
"nil",
"\n",
"}"
] |
10,704 | all-10705 | [
"Respond",
"without",
"doing",
"anything",
".",
"This",
"endpoint",
"is",
"used",
"to",
"check",
"that",
"the",
"service",
"is",
"up",
".",
"See",
"#ping"
] | [
"func",
"(",
"index",
"*",
"Index",
")",
"Ping",
"(",
")",
"error",
"{",
"cd",
":=",
"tcclient",
".",
"<mask>",
"(",
"*",
"index",
")",
"\n",
"_",
",",
"_",
",",
"err",
":=",
"(",
"&",
"cd",
")",
".",
"APICall",
"(",
"nil",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"nil",
",",
"nil",
")",
"\n",
"return",
"err",
"\n",
"}"
] |
10,705 | all-10706 | [
"SetContainerInstanceARN",
"mocks",
"base",
"method"
] | [
"func",
"(",
"m",
"*",
"MockManager",
")",
"SetContainerInstanceARN",
"(",
"arg0",
"<mask>",
")",
"{",
"m",
".",
"ctrl",
".",
"Call",
"(",
"m",
",",
"\"",
"\"",
",",
"arg0",
")",
"\n",
"}"
] |
10,706 | all-10707 | [
"NewReader",
"returns",
"a",
"Reader",
"which",
"generates",
"strings",
"of",
"characters",
"."
] | [
"func",
"NewReader",
"(",
"rand",
"*",
"rand",
".",
"Rand",
",",
"bytes",
"int64",
")",
"io",
".",
"Reader",
"{",
"return",
"&",
"<mask>",
"{",
"rand",
":",
"rand",
",",
"bytes",
":",
"bytes",
",",
"}",
"\n",
"}"
] |
10,707 | all-10708 | [
"Add",
"will",
"add",
"an",
"index",
"to",
"the",
"internal",
"index",
"list",
".",
"Fields",
"that",
"are",
"prefixed",
"with",
"a",
"dash",
"will",
"result",
"in",
"an",
"descending",
"index",
".",
"See",
"the",
"MongoDB",
"documentation",
"for",
"more",
"details",
"."
] | [
"func",
"(",
"i",
"*",
"Indexer",
")",
"Add",
"(",
"model",
"Model",
",",
"unique",
"bool",
",",
"expireAfter",
"time",
".",
"Duration",
",",
"fields",
"...",
"string",
")",
"{",
"// construct key from fields",
"var",
"key",
"[",
"]",
"string",
"\n",
"for",
"_",
",",
"f",
":=",
"range",
"fields",
"{",
"key",
"=",
"append",
"(",
"key",
",",
"F",
"(",
"model",
",",
"f",
")",
")",
"\n",
"}",
"\n\n",
"// add index",
"i",
".",
"AddRaw",
"(",
"C",
"(",
"model",
")",
",",
"mgo",
".",
"Index",
"{",
"Key",
":",
"key",
",",
"Unique",
":",
"unique",
",",
"ExpireAfter",
":",
"expireAfter",
",",
"Background",
":",
"<mask>",
",",
"}",
")",
"\n",
"}"
] |
10,708 | all-10709 | [
"Read",
"reads",
"the",
"snapshot",
"named",
"by",
"snapname",
"and",
"returns",
"the",
"snapshot",
"."
] | [
"func",
"Read",
"(",
"lg",
"*",
"zap",
".",
"Logger",
",",
"snapname",
"string",
")",
"(",
"*",
"raftpb",
".",
"Snapshot",
",",
"error",
")",
"{",
"b",
",",
"err",
":=",
"ioutil",
".",
"ReadFile",
"(",
"snapname",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"if",
"lg",
"!=",
"nil",
"{",
"lg",
".",
"Warn",
"(",
"\"",
"\"",
",",
"zap",
".",
"String",
"(",
"\"",
"\"",
",",
"snapname",
")",
",",
"zap",
".",
"Error",
"(",
"err",
")",
")",
"\n",
"}",
"else",
"{",
"plog",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"snapname",
",",
"err",
")",
"\n",
"}",
"\n",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"if",
"len",
"(",
"b",
")",
"==",
"0",
"{",
"if",
"lg",
"!=",
"nil",
"{",
"lg",
".",
"Warn",
"(",
"\"",
"\"",
",",
"zap",
".",
"String",
"(",
"\"",
"\"",
",",
"snapname",
")",
")",
"\n",
"}",
"else",
"{",
"plog",
".",
"Errorf",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"return",
"nil",
",",
"ErrEmptySnapshot",
"\n",
"}",
"\n\n",
"var",
"serializedSnap",
"snappb",
".",
"Snapshot",
"\n",
"if",
"err",
"=",
"serializedSnap",
".",
"Unmarshal",
"(",
"b",
")",
";",
"err",
"!=",
"nil",
"{",
"if",
"lg",
"!=",
"nil",
"{",
"lg",
".",
"Warn",
"(",
"\"",
"\"",
",",
"zap",
".",
"<mask>",
"(",
"\"",
"\"",
",",
"snapname",
")",
",",
"zap",
".",
"Error",
"(",
"err",
")",
")",
"\n",
"}",
"else",
"{",
"plog",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"snapname",
",",
"err",
")",
"\n",
"}",
"\n",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"if",
"len",
"(",
"serializedSnap",
".",
"Data",
")",
"==",
"0",
"||",
"serializedSnap",
".",
"Crc",
"==",
"0",
"{",
"if",
"lg",
"!=",
"nil",
"{",
"lg",
".",
"Warn",
"(",
"\"",
"\"",
",",
"zap",
".",
"String",
"(",
"\"",
"\"",
",",
"snapname",
")",
")",
"\n",
"}",
"else",
"{",
"plog",
".",
"Errorf",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"return",
"nil",
",",
"ErrEmptySnapshot",
"\n",
"}",
"\n\n",
"crc",
":=",
"crc32",
".",
"Update",
"(",
"0",
",",
"crcTable",
",",
"serializedSnap",
".",
"Data",
")",
"\n",
"if",
"crc",
"!=",
"serializedSnap",
".",
"Crc",
"{",
"if",
"lg",
"!=",
"nil",
"{",
"lg",
".",
"Warn",
"(",
"\"",
"\"",
",",
"zap",
".",
"String",
"(",
"\"",
"\"",
",",
"snapname",
")",
",",
"zap",
".",
"Uint32",
"(",
"\"",
"\"",
",",
"serializedSnap",
".",
"Crc",
")",
",",
"zap",
".",
"Uint32",
"(",
"\"",
"\"",
",",
"crc",
")",
",",
")",
"\n",
"}",
"else",
"{",
"plog",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"snapname",
")",
"\n",
"}",
"\n",
"return",
"nil",
",",
"ErrCRCMismatch",
"\n",
"}",
"\n\n",
"var",
"snap",
"raftpb",
".",
"Snapshot",
"\n",
"if",
"err",
"=",
"snap",
".",
"Unmarshal",
"(",
"serializedSnap",
".",
"Data",
")",
";",
"err",
"!=",
"nil",
"{",
"if",
"lg",
"!=",
"nil",
"{",
"lg",
".",
"Warn",
"(",
"\"",
"\"",
",",
"zap",
".",
"String",
"(",
"\"",
"\"",
",",
"snapname",
")",
",",
"zap",
".",
"Error",
"(",
"err",
")",
")",
"\n",
"}",
"else",
"{",
"plog",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"snapname",
",",
"err",
")",
"\n",
"}",
"\n",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"return",
"&",
"snap",
",",
"nil",
"\n",
"}"
] |
10,709 | all-10710 | [
"diskLabelOrName",
"is",
"a",
"helper",
"method",
"that",
"returns",
"the",
"unique",
"label",
"for",
"a",
"disk",
"-",
"either",
"its",
"label",
"or",
"name",
".",
"An",
"error",
"is",
"returned",
"if",
"both",
"are",
"defined",
".",
"TODO",
":",
"This",
"method",
"will",
"be",
"removed",
"in",
"future",
"releases",
"."
] | [
"func",
"diskLabelOrName",
"(",
"data",
"map",
"[",
"string",
"]",
"interface",
"{",
"}",
")",
"(",
"string",
",",
"error",
")",
"{",
"var",
"label",
",",
"name",
"string",
"\n",
"if",
"v",
",",
"ok",
":=",
"data",
"[",
"\"",
"\"",
"]",
";",
"ok",
"&&",
"v",
"!=",
"nil",
"{",
"label",
"=",
"v",
".",
"(",
"string",
")",
"\n",
"}",
"\n",
"if",
"v",
",",
"ok",
":=",
"data",
"[",
"\"",
"\"",
"]",
";",
"ok",
"&&",
"v",
"!=",
"nil",
"{",
"name",
"=",
"v",
".",
"(",
"string",
")",
"\n",
"}",
"\n",
"if",
"name",
"!=",
"\"",
"\"",
"{",
"name",
"=",
"path",
".",
"Base",
"(",
"name",
")",
"\n",
"}",
"\n\n",
"log",
".",
"Printf",
"(",
"\"",
"\"",
",",
"label",
",",
"name",
")",
"\n",
"switch",
"{",
"case",
"label",
"==",
"\"",
"\"",
"&&",
"name",
"==",
"\"",
"\"",
":",
"return",
"\"",
"\"",
",",
"errors",
".",
"New",
"(",
"\"",
"\"",
")",
"\n",
"case",
"label",
"!=",
"\"",
"\"",
"&&",
"name",
"!=",
"\"",
"\"",
":",
"return",
"\"",
"\"",
",",
"errors",
".",
"New",
"(",
"\"",
"\"",
")",
"\n",
"case",
"label",
"!=",
"\"",
"\"",
":",
"log",
".",
"Printf",
"(",
"\"",
"\"",
",",
"label",
")",
"\n",
"return",
"label",
",",
"nil",
"\n",
"}",
"\n",
"log",
".",
"Printf",
"(",
"\"",
"\"",
",",
"<mask>",
")",
"\n",
"return",
"name",
",",
"nil",
"\n",
"}"
] |
10,710 | all-10711 | [
"Not",
"goroutine",
"safe",
"."
] | [
"func",
"(",
"sw",
"*",
"Switch",
")",
"AddListener",
"(",
"l",
"Listener",
")",
"{",
"sw",
".",
"listeners",
"=",
"<mask>",
"(",
"sw",
".",
"listeners",
",",
"l",
")",
"\n",
"}"
] |
10,711 | all-10712 | [
"add",
"invokes",
"the",
"ADD",
"command",
"of",
"the",
"given",
"plugin"
] | [
"func",
"(",
"<mask>",
"*",
"cniClient",
")",
"add",
"(",
"runtimeConfig",
"libcni",
".",
"RuntimeConf",
",",
"cfg",
"*",
"Config",
",",
"pluginConfigFunc",
"func",
"(",
"*",
"Config",
")",
"(",
"string",
",",
"*",
"libcni",
".",
"NetworkConfig",
",",
"error",
")",
")",
"(",
"cnitypes",
".",
"Result",
",",
"error",
")",
"{",
"deviceName",
",",
"networkConfig",
",",
"err",
":=",
"pluginConfigFunc",
"(",
"cfg",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"runtimeConfig",
".",
"IfName",
"=",
"deviceName",
"\n\n",
"return",
"client",
".",
"libcni",
".",
"AddNetwork",
"(",
"networkConfig",
",",
"&",
"runtimeConfig",
")",
"\n",
"}"
] |
10,712 | all-10713 | [
"Older",
"returns",
"true",
"if",
"this",
"version",
"s",
"product",
"is",
"the",
"same",
"and",
"composite",
"of",
"the",
"version",
"and",
"build",
"numbers",
"are",
"older",
"than",
"the",
"supplied",
"version",
"s",
"information",
"."
] | [
"func",
"(",
"v",
"VSphereVersion",
")",
"Older",
"(",
"other",
"VSphereVersion",
")",
"bool",
"{",
"if",
"!",
"v",
".",
"ProductEqual",
"(",
"other",
")",
"{",
"return",
"false",
"\n",
"}",
"\n",
"if",
"v",
".",
"olderVersion",
"(",
"other",
")",
"{",
"return",
"true",
"\n",
"}",
"\n\n",
"// Double check this version is not actually newer by version number before",
"// moving on to the build number",
"if",
"v",
".",
"newerVersion",
"(",
"other",
")",
"{",
"return",
"false",
"\n",
"}",
"\n\n",
"if",
"v",
".",
"Build",
"<",
"other",
".",
"Build",
"{",
"return",
"<mask>",
"\n",
"}",
"\n",
"return",
"false",
"\n",
"}"
] |
10,713 | all-10714 | [
"diffOldNew",
"returns",
"any",
"elements",
"of",
"old",
"that",
"were",
"missing",
"in",
"new",
"."
] | [
"func",
"(",
"p",
"*",
"tagDiffProcessor",
")",
"diffOldNew",
"(",
")",
"[",
"]",
"string",
"{",
"<mask>",
"p",
".",
"diff",
"(",
"p",
".",
"oldTagIDs",
",",
"p",
".",
"newTagIDs",
")",
"\n",
"}"
] |
10,714 | all-10715 | [
"GetIconSize",
"is",
"a",
"wrapper",
"around",
"gtk_toolbar_get_icon_size",
"()",
"."
] | [
"func",
"(",
"v",
"*",
"Toolbar",
")",
"GetIconSize",
"(",
")",
"IconSize",
"{",
"c",
":=",
"C",
".",
"gtk_toolbar_get_icon_size",
"(",
"v",
".",
"native",
"(",
")",
")",
"\n",
"<mask>",
"IconSize",
"(",
"c",
")",
"\n",
"}"
] |
10,715 | all-10716 | [
"HTTPStatusToType",
"infers",
"the",
"error",
"Type",
"from",
"a",
"HTTP",
"Status",
"code"
] | [
"func",
"HTTPStatusToType",
"(",
"status",
"int",
")",
"Type",
"{",
"switch",
"<mask>",
"{",
"case",
"http",
".",
"StatusBadRequest",
":",
"return",
"InvalidArgument",
"\n",
"case",
"http",
".",
"StatusNotFound",
":",
"return",
"NotFound",
"\n",
"case",
"http",
".",
"StatusConflict",
":",
"return",
"Conflict",
"\n",
"case",
"http",
".",
"StatusUnauthorized",
":",
"return",
"Unauthorized",
"\n",
"case",
"http",
".",
"StatusForbidden",
":",
"return",
"PermissionDenied",
"\n",
"case",
"http",
".",
"StatusRequestTimeout",
":",
"return",
"Timeout",
"\n",
"case",
"http",
".",
"StatusNotImplemented",
":",
"return",
"NotImplemented",
"\n",
"case",
"http",
".",
"StatusBadGateway",
":",
"case",
"http",
".",
"StatusServiceUnavailable",
":",
"return",
"TemporarilyUnavailable",
"\n",
"case",
"http",
".",
"StatusGone",
":",
"return",
"PermanentlyUnavailable",
"\n",
"case",
"http",
".",
"StatusTooManyRequests",
":",
"return",
"ResourceExhausted",
"\n",
"case",
"http",
".",
"StatusInternalServerError",
":",
"return",
"Unknown",
"\n",
"}",
"\n",
"return",
"Unknown",
"\n",
"}"
] |
10,716 | all-10717 | [
"StatsTags",
"returns",
"the",
"common",
"tags",
"that",
"should",
"be",
"used",
"when",
"reporting",
"stats",
".",
"It",
"returns",
"a",
"new",
"map",
"for",
"each",
"call",
"."
] | [
"func",
"(",
"ch",
"*",
"Channel",
")",
"StatsTags",
"(",
")",
"<mask>",
"[",
"string",
"]",
"string",
"{",
"m",
":=",
"make",
"(",
"map",
"[",
"string",
"]",
"string",
")",
"\n",
"for",
"k",
",",
"v",
":=",
"range",
"ch",
".",
"commonStatsTags",
"{",
"m",
"[",
"k",
"]",
"=",
"v",
"\n",
"}",
"\n",
"return",
"m",
"\n",
"}"
] |
10,717 | all-10718 | [
"GetCustomFgColorOk",
"returns",
"a",
"tuple",
"with",
"the",
"CustomFgColor",
"field",
"if",
"it",
"s",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"and",
"a",
"boolean",
"to",
"check",
"if",
"the",
"value",
"has",
"been",
"set",
"."
] | [
"func",
"(",
"w",
"*",
"WidgetConditionalFormat",
")",
"GetCustomFgColorOk",
"(",
")",
"(",
"string",
",",
"bool",
")",
"{",
"if",
"w",
"==",
"nil",
"||",
"w",
".",
"CustomFgColor",
"==",
"nil",
"{",
"return",
"\"",
"\"",
",",
"false",
"\n",
"}",
"\n",
"return",
"*",
"w",
".",
"CustomFgColor",
",",
"<mask>",
"\n",
"}"
] |
10,718 | all-10719 | [
"GetChildAt",
"()",
"is",
"a",
"wrapper",
"around",
"gtk_grid_get_child_at",
"()",
"."
] | [
"func",
"(",
"v",
"*",
"Grid",
")",
"GetChildAt",
"(",
"left",
",",
"<mask>",
"int",
")",
"(",
"*",
"Widget",
",",
"error",
")",
"{",
"c",
":=",
"C",
".",
"gtk_grid_get_child_at",
"(",
"v",
".",
"native",
"(",
")",
",",
"C",
".",
"gint",
"(",
"left",
")",
",",
"C",
".",
"gint",
"(",
"top",
")",
")",
"\n",
"if",
"c",
"==",
"nil",
"{",
"return",
"nil",
",",
"nilPtrErr",
"\n",
"}",
"\n",
"obj",
":=",
"glib",
".",
"Take",
"(",
"unsafe",
".",
"Pointer",
"(",
"c",
")",
")",
"\n",
"return",
"wrapWidget",
"(",
"obj",
")",
",",
"nil",
"\n",
"}"
] |
10,719 | all-10720 | [
"newDisconnectionTimer",
"creates",
"a",
"new",
"time",
"object",
"with",
"a",
"callback",
"to",
"disconnect",
"from",
"ACS",
"on",
"inactivity"
] | [
"func",
"newDisconnectionTimer",
"(",
"<mask>",
"wsclient",
".",
"ClientServer",
",",
"timeout",
"time",
".",
"Duration",
",",
"jitter",
"time",
".",
"Duration",
")",
"ttime",
".",
"Timer",
"{",
"timer",
":=",
"time",
".",
"AfterFunc",
"(",
"retry",
".",
"AddJitter",
"(",
"timeout",
",",
"jitter",
")",
",",
"func",
"(",
")",
"{",
"seelog",
".",
"Warn",
"(",
"\"",
"\"",
")",
"\n",
"if",
"err",
":=",
"client",
".",
"Close",
"(",
")",
";",
"err",
"!=",
"nil",
"{",
"seelog",
".",
"Warnf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"}",
"\n",
"seelog",
".",
"Info",
"(",
"\"",
"\"",
")",
"\n",
"}",
")",
"\n\n",
"return",
"timer",
"\n",
"}"
] |
10,720 | all-10721 | [
"lintName",
"returns",
"a",
"different",
"name",
"if",
"it",
"should",
"be",
"different",
"."
] | [
"func",
"lintName",
"(",
"name",
"string",
",",
"initialisms",
"map",
"[",
"string",
"]",
"bool",
")",
"(",
"should",
"string",
")",
"{",
"// A large part of this function is copied from",
"// github.com/golang/lint, Copyright (c) 2013 The Go Authors,",
"// licensed under the BSD 3-clause license.",
"// Fast path for simple cases: \"_\" and all lowercase.",
"if",
"name",
"==",
"\"",
"\"",
"{",
"return",
"name",
"\n",
"}",
"\n",
"if",
"strings",
".",
"IndexFunc",
"(",
"name",
",",
"func",
"(",
"r",
"rune",
")",
"bool",
"{",
"return",
"!",
"unicode",
".",
"IsLower",
"(",
"r",
")",
"}",
")",
"==",
"-",
"1",
"{",
"return",
"name",
"\n",
"}",
"\n\n",
"// Split camelCase at any lower->upper transition, and split on underscores.",
"// Check each word for common initialisms.",
"runes",
":=",
"[",
"]",
"rune",
"(",
"name",
")",
"\n",
"w",
",",
"i",
":=",
"0",
",",
"0",
"// index of start of word, scan",
"\n",
"for",
"i",
"+",
"1",
"<=",
"len",
"(",
"runes",
")",
"{",
"eow",
":=",
"false",
"// whether we hit the end of a word",
"\n",
"if",
"i",
"+",
"1",
"==",
"len",
"(",
"runes",
")",
"{",
"eow",
"=",
"true",
"\n",
"}",
"else",
"if",
"runes",
"[",
"i",
"+",
"1",
"]",
"==",
"'_'",
"&&",
"i",
"+",
"1",
"!=",
"len",
"(",
"runes",
")",
"-",
"1",
"{",
"// underscore; shift the remainder forward over any run of underscores",
"eow",
"=",
"true",
"\n",
"n",
":=",
"1",
"\n",
"for",
"i",
"+",
"n",
"+",
"1",
"<",
"len",
"(",
"runes",
")",
"&&",
"runes",
"[",
"i",
"+",
"n",
"+",
"1",
"]",
"==",
"'_'",
"{",
"n",
"++",
"\n",
"}",
"\n\n",
"// Leave at most one underscore if the underscore is between two digits",
"if",
"i",
"+",
"n",
"+",
"1",
"<",
"len",
"(",
"runes",
")",
"&&",
"unicode",
".",
"IsDigit",
"(",
"runes",
"[",
"i",
"]",
")",
"&&",
"unicode",
".",
"IsDigit",
"(",
"runes",
"[",
"i",
"+",
"n",
"+",
"1",
"]",
")",
"{",
"n",
"--",
"\n",
"}",
"\n\n",
"copy",
"(",
"runes",
"[",
"i",
"+",
"1",
":",
"]",
",",
"runes",
"[",
"i",
"+",
"n",
"+",
"1",
":",
"]",
")",
"\n",
"runes",
"=",
"runes",
"[",
":",
"len",
"(",
"runes",
")",
"-",
"n",
"]",
"\n",
"}",
"else",
"if",
"unicode",
".",
"IsLower",
"(",
"runes",
"[",
"i",
"]",
")",
"&&",
"!",
"unicode",
".",
"IsLower",
"(",
"runes",
"[",
"i",
"+",
"1",
"]",
")",
"{",
"// lower->non-lower",
"eow",
"=",
"true",
"\n",
"}",
"\n",
"i",
"++",
"\n",
"if",
"!",
"eow",
"{",
"<mask>",
"\n",
"}",
"\n\n",
"// [w,i) is a word.",
"word",
":=",
"string",
"(",
"runes",
"[",
"w",
":",
"i",
"]",
")",
"\n",
"if",
"u",
":=",
"strings",
".",
"ToUpper",
"(",
"word",
")",
";",
"initialisms",
"[",
"u",
"]",
"{",
"// Keep consistent case, which is lowercase only at the start.",
"if",
"w",
"==",
"0",
"&&",
"unicode",
".",
"IsLower",
"(",
"runes",
"[",
"w",
"]",
")",
"{",
"u",
"=",
"strings",
".",
"ToLower",
"(",
"u",
")",
"\n",
"}",
"\n",
"// All the common initialisms are ASCII,",
"// so we can replace the bytes exactly.",
"// TODO(dh): this won't be true once we allow custom initialisms",
"copy",
"(",
"runes",
"[",
"w",
":",
"]",
",",
"[",
"]",
"rune",
"(",
"u",
")",
")",
"\n",
"}",
"else",
"if",
"w",
">",
"0",
"&&",
"strings",
".",
"ToLower",
"(",
"word",
")",
"==",
"word",
"{",
"// already all lowercase, and not the first word, so uppercase the first character.",
"runes",
"[",
"w",
"]",
"=",
"unicode",
".",
"ToUpper",
"(",
"runes",
"[",
"w",
"]",
")",
"\n",
"}",
"\n",
"w",
"=",
"i",
"\n",
"}",
"\n",
"return",
"string",
"(",
"runes",
")",
"\n",
"}"
] |
10,721 | all-10722 | [
"Log",
"writes",
"std",
"log",
"event"
] | [
"func",
"(",
"g",
"*",
"Glg",
")",
"Log",
"(",
"val",
"...",
"interface",
"{",
"}",
")",
"error",
"{",
"return",
"g",
".",
"<mask>",
"(",
"LOG",
",",
"blankFormat",
"(",
"len",
"(",
"val",
")",
")",
",",
"val",
"...",
")",
"\n",
"}"
] |
10,722 | all-10723 | [
"GetCustomUnit",
"returns",
"the",
"CustomUnit",
"field",
"if",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"."
] | [
"func",
"(",
"g",
"*",
"GraphDefinition",
")",
"GetCustomUnit",
"(",
")",
"<mask>",
"{",
"if",
"g",
"==",
"nil",
"||",
"g",
".",
"CustomUnit",
"==",
"nil",
"{",
"return",
"\"",
"\"",
"\n",
"}",
"\n",
"return",
"*",
"g",
".",
"CustomUnit",
"\n",
"}"
] |
10,723 | all-10724 | [
"GetContainerSnapshot",
"returns",
"a",
"Snapshot",
"struct",
"for",
"the",
"provided",
"container",
"and",
"snapshot",
"names"
] | [
"func",
"(",
"r",
"*",
"ProtocolLXD",
")",
"GetContainerSnapshot",
"(",
"containerName",
"string",
",",
"<mask>",
"string",
")",
"(",
"*",
"api",
".",
"ContainerSnapshot",
",",
"string",
",",
"error",
")",
"{",
"snapshot",
":=",
"api",
".",
"ContainerSnapshot",
"{",
"}",
"\n\n",
"// Fetch the raw value",
"etag",
",",
"err",
":=",
"r",
".",
"queryStruct",
"(",
"\"",
"\"",
",",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"url",
".",
"QueryEscape",
"(",
"containerName",
")",
",",
"url",
".",
"QueryEscape",
"(",
"name",
")",
")",
",",
"nil",
",",
"\"",
"\"",
",",
"&",
"snapshot",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"\"",
"\"",
",",
"err",
"\n",
"}",
"\n\n",
"return",
"&",
"snapshot",
",",
"etag",
",",
"nil",
"\n",
"}"
] |
10,724 | all-10725 | [
"Do",
"executes",
"Profiler",
".",
"start",
"against",
"the",
"provided",
"context",
"."
] | [
"func",
"(",
"p",
"*",
"StartParams",
")",
"Do",
"(",
"ctx",
"<mask>",
".",
"Context",
")",
"(",
"err",
"error",
")",
"{",
"return",
"cdp",
".",
"Execute",
"(",
"ctx",
",",
"CommandStart",
",",
"nil",
",",
"nil",
")",
"\n",
"}"
] |
10,725 | all-10726 | [
"Get",
"role",
"defination"
] | [
"func",
"(",
"role",
"*",
"<mask>",
")",
"Get",
"(",
"name",
"string",
")",
"(",
"Checker",
",",
"bool",
")",
"{",
"fc",
",",
"ok",
":=",
"role",
".",
"definitions",
"[",
"name",
"]",
"\n",
"return",
"fc",
",",
"ok",
"\n",
"}"
] |
10,726 | all-10727 | [
"GetResource",
"returns",
"the",
"Resource",
"field",
"if",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"."
] | [
"func",
"(",
"c",
"*",
"<mask>",
")",
"GetResource",
"(",
")",
"string",
"{",
"if",
"c",
"==",
"nil",
"||",
"c",
".",
"Resource",
"==",
"nil",
"{",
"return",
"\"",
"\"",
"\n",
"}",
"\n",
"return",
"*",
"c",
".",
"Resource",
"\n",
"}"
] |
10,727 | all-10728 | [
"GetCertificate",
"returns",
"the",
"certificate",
"entry",
"for",
"the",
"provided",
"fingerprint"
] | [
"func",
"(",
"r",
"*",
"ProtocolLXD",
")",
"GetCertificate",
"(",
"fingerprint",
"string",
")",
"(",
"*",
"api",
".",
"Certificate",
",",
"string",
",",
"error",
")",
"{",
"certificate",
":=",
"api",
".",
"Certificate",
"{",
"}",
"\n\n",
"// Fetch the raw value",
"etag",
",",
"err",
":=",
"r",
".",
"queryStruct",
"(",
"\"",
"\"",
",",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"<mask>",
".",
"QueryEscape",
"(",
"fingerprint",
")",
")",
",",
"nil",
",",
"\"",
"\"",
",",
"&",
"certificate",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"\"",
"\"",
",",
"err",
"\n",
"}",
"\n\n",
"return",
"&",
"certificate",
",",
"etag",
",",
"nil",
"\n",
"}"
] |
10,728 | all-10729 | [
"HasComparator",
"returns",
"a",
"boolean",
"if",
"a",
"field",
"has",
"been",
"set",
"."
] | [
"func",
"(",
"c",
"*",
"ConditionalFormat",
")",
"HasComparator",
"(",
")",
"bool",
"{",
"if",
"c",
"!=",
"nil",
"&&",
"c",
".",
"Comparator",
"!=",
"nil",
"{",
"return",
"<mask>",
"\n",
"}",
"\n\n",
"return",
"false",
"\n",
"}"
] |
10,729 | all-10730 | [
"ZipHandler",
"响应下载文件请求,返回zip文件"
] | [
"func",
"(",
"ctx",
"*",
"Context",
")",
"ZipHandler",
"(",
"fileName",
"string",
",",
"file",
"[",
"]",
"byte",
")",
"{",
"zipName",
":=",
"fileName",
"+",
"\"",
"\"",
"\n",
"rw",
":=",
"ctx",
".",
"ResponseWriter",
"\n",
"// 设置header信息中的ctontent-type,对于zip可选以下两种",
"// rw.Header().Set(\"Content-Type\", \"application/octet-stream\")",
"rw",
".",
"Header",
"(",
")",
".",
"Set",
"(",
"\"",
"\"",
",",
"\"",
"\"",
")",
"\n",
"// 设置header信息中的Content-Disposition为attachment类型",
"rw",
".",
"Header",
"(",
")",
".",
"Set",
"(",
"\"",
"\"",
",",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\\\"",
"\\\"",
"\"",
",",
"zipName",
")",
")",
"\n",
"// 向rw中写入zip文件",
"// 创建zip.Writer",
"zipW",
":=",
"zip",
".",
"NewWriter",
"(",
"rw",
")",
"\n",
"defer",
"zipW",
".",
"Close",
"(",
")",
"\n\n",
"// 向zip中添加文件",
"f",
",",
"err",
":=",
"zipW",
".",
"Create",
"(",
"fileName",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"log",
".",
"WithFields",
"(",
"log",
".",
"Fields",
"{",
"\"",
"\"",
":",
"ctx",
".",
"Request",
".",
"URL",
".",
"<mask>",
"}",
")",
".",
"Warnln",
"(",
"err",
".",
"Error",
"(",
")",
")",
"\n",
"}",
"\n",
"// 向文件中写入文件内容",
"f",
".",
"Write",
"(",
"file",
")",
"\n",
"}"
] |
10,730 | all-10731 | [
"Do",
"executes",
"Memory",
".",
"setPressureNotificationsSuppressed",
"against",
"the",
"provided",
"context",
"."
] | [
"func",
"(",
"p",
"*",
"SetPressureNotificationsSuppressedParams",
")",
"Do",
"(",
"ctx",
"<mask>",
".",
"Context",
")",
"(",
"err",
"error",
")",
"{",
"return",
"cdp",
".",
"Execute",
"(",
"ctx",
",",
"CommandSetPressureNotificationsSuppressed",
",",
"p",
",",
"nil",
")",
"\n",
"}"
] |
10,731 | all-10732 | [
"ServeTLS",
"serves",
"HTTPS",
"requests",
"from",
"the",
"given",
"net",
".",
"Listener",
"using",
"the",
"given",
"handler",
".",
"certFile",
"and",
"keyFile",
"are",
"paths",
"to",
"TLS",
"certificate",
"and",
"key",
"files",
"."
] | [
"func",
"ServeTLS",
"(",
"ln",
"<mask>",
".",
"Listener",
",",
"certFile",
",",
"keyFile",
"string",
",",
"handler",
"RequestHandler",
")",
"error",
"{",
"s",
":=",
"&",
"Server",
"{",
"Handler",
":",
"handler",
",",
"}",
"\n",
"return",
"s",
".",
"ServeTLS",
"(",
"ln",
",",
"certFile",
",",
"keyFile",
")",
"\n",
"}"
] |
10,732 | all-10733 | [
"To",
"be",
"unix",
"y",
"we",
"translate",
"flagnames",
"to",
"their",
"uppercase",
"equivalents",
"."
] | [
"func",
"flagAsEnv",
"(",
"name",
"string",
")",
"string",
"{",
"name",
"=",
"strings",
".",
"ToUpper",
"(",
"EnvPrefix",
"+",
"name",
")",
"\n",
"name",
"=",
"strings",
".",
"Replace",
"(",
"<mask>",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"-",
"1",
")",
"\n",
"name",
"=",
"strings",
".",
"Replace",
"(",
"name",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"-",
"1",
")",
"\n",
"return",
"name",
"\n",
"}"
] |
10,733 | all-10734 | [
"Write",
"Satisfy",
"the",
"http",
".",
"ResponseWriter",
"interface"
] | [
"func",
"(",
"w",
"*",
"StatusResponseWriter",
")",
"Write",
"(",
"<mask>",
"[",
"]",
"byte",
")",
"(",
"int",
",",
"error",
")",
"{",
"w",
".",
"length",
"=",
"len",
"(",
"data",
")",
"\n",
"return",
"w",
".",
"ResponseWriter",
".",
"Write",
"(",
"data",
")",
"\n",
"}"
] |
10,734 | all-10735 | [
"MenuItemNew",
"is",
"a",
"wrapper",
"around",
"g_menu_item_new",
"()",
"."
] | [
"func",
"MenuItemNew",
"(",
"<mask>",
",",
"detailed_action",
"string",
")",
"*",
"MenuItem",
"{",
"cstr1",
":=",
"(",
"*",
"C",
".",
"gchar",
")",
"(",
"C",
".",
"CString",
"(",
"label",
")",
")",
"\n",
"defer",
"C",
".",
"free",
"(",
"unsafe",
".",
"Pointer",
"(",
"cstr1",
")",
")",
"\n\n",
"cstr2",
":=",
"(",
"*",
"C",
".",
"gchar",
")",
"(",
"C",
".",
"CString",
"(",
"detailed_action",
")",
")",
"\n",
"defer",
"C",
".",
"free",
"(",
"unsafe",
".",
"Pointer",
"(",
"cstr2",
")",
")",
"\n\n",
"c",
":=",
"C",
".",
"g_menu_item_new",
"(",
"cstr1",
",",
"cstr2",
")",
"\n",
"if",
"c",
"==",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n",
"return",
"wrapMenuItem",
"(",
"wrapObject",
"(",
"unsafe",
".",
"Pointer",
"(",
"c",
")",
")",
")",
"\n",
"}"
] |
10,735 | all-10736 | [
"GetValue",
"returns",
"the",
"Value",
"field",
"if",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"."
] | [
"func",
"(",
"g",
"*",
"GraphDefinitionMarker",
")",
"GetValue",
"(",
")",
"string",
"{",
"if",
"g",
"==",
"nil",
"||",
"g",
".",
"<mask>",
"==",
"nil",
"{",
"return",
"\"",
"\"",
"\n",
"}",
"\n",
"return",
"*",
"g",
".",
"Value",
"\n",
"}"
] |
10,736 | all-10737 | [
"DisableLevelColor",
"disables",
"color",
"output"
] | [
"func",
"(",
"g",
"*",
"Glg",
")",
"DisableLevelColor",
"(",
"lv",
"LEVEL",
")",
"*",
"Glg",
"{",
"ins",
",",
"<mask>",
":=",
"g",
".",
"logger",
".",
"Load",
"(",
"lv",
")",
"\n",
"if",
"ok",
"{",
"l",
":=",
"ins",
".",
"(",
"*",
"logger",
")",
"\n",
"l",
".",
"isColor",
"=",
"false",
"\n",
"l",
".",
"updateMode",
"(",
")",
"\n",
"g",
".",
"logger",
".",
"Store",
"(",
"lv",
",",
"l",
")",
"\n",
"}",
"\n",
"return",
"g",
"\n",
"}"
] |
10,737 | all-10738 | [
"Remove",
"removes",
"a",
"point",
"."
] | [
"func",
"(",
"index",
"*",
"ClusteringIndex",
")",
"Remove",
"(",
"id",
"string",
")",
"{",
"index",
".",
"streetLevel",
".",
"Remove",
"(",
"id",
")",
"\n",
"index",
".",
"cityLevel",
".",
"Remove",
"(",
"id",
")",
"\n",
"<mask>",
".",
"worldLevel",
".",
"Remove",
"(",
"id",
")",
"\n",
"}"
] |
10,738 | all-10739 | [
"GetProgressPulseStep",
"()",
"is",
"a",
"wrapper",
"around",
"gtk_entry_get_progress_pulse_step",
"()",
"."
] | [
"func",
"(",
"v",
"*",
"<mask>",
")",
"GetProgressPulseStep",
"(",
")",
"float64",
"{",
"c",
":=",
"C",
".",
"gtk_entry_get_progress_pulse_step",
"(",
"v",
".",
"native",
"(",
")",
")",
"\n",
"return",
"float64",
"(",
"c",
")",
"\n",
"}"
] |
10,739 | all-10740 | [
"Text",
"returns",
"a",
"copy",
"of",
"MailBuilder",
"that",
"will",
"use",
"the",
"provided",
"bytes",
"for",
"its",
"text",
"/",
"plain",
"Part",
"."
] | [
"func",
"(",
"p",
"MailBuilder",
")",
"Text",
"(",
"body",
"[",
"]",
"byte",
")",
"MailBuilder",
"{",
"p",
".",
"text",
"=",
"<mask>",
"\n",
"return",
"p",
"\n",
"}"
] |
10,740 | all-10741 | [
"cachedCreateFromType",
"creates",
"an",
"instance",
"of",
"the",
"given",
"type"
] | [
"func",
"(",
"di",
"*",
"dependencyInjector",
")",
"cachedCreateFromType",
"(",
"atype",
"reflect",
".",
"<mask>",
")",
"reflect",
".",
"Value",
"{",
"_",
",",
"exists",
":=",
"di",
".",
"instances",
"[",
"atype",
"]",
"\n\n",
"if",
"!",
"exists",
"{",
"di",
".",
"instances",
"[",
"atype",
"]",
"=",
"di",
".",
"createFromType",
"(",
"atype",
")",
"\n",
"}",
"\n\n",
"return",
"di",
".",
"instances",
"[",
"atype",
"]",
"\n",
"}"
] |
10,741 | all-10742 | [
"QuicHeadersHandler",
"should",
"be",
"used",
"as",
"a",
"middleware",
"to",
"set",
"quic",
"related",
"headers",
"to",
"TCP",
"server",
"that",
"suggest",
"alternative",
"svc",
"."
] | [
"func",
"(",
"s",
"*",
"Server",
")",
"QuicHeadersHandler",
"(",
"h",
"http",
".",
"Handler",
")",
"http",
".",
"<mask>",
"{",
"return",
"http",
".",
"HandlerFunc",
"(",
"func",
"(",
"w",
"http",
".",
"ResponseWriter",
",",
"r",
"*",
"http",
".",
"Request",
")",
"{",
"s",
".",
"SetQuicHeaders",
"(",
"w",
".",
"Header",
"(",
")",
")",
"\n",
"h",
".",
"ServeHTTP",
"(",
"w",
",",
"r",
")",
"\n",
"}",
")",
"\n",
"}"
] |
10,742 | all-10743 | [
"WithBaseDir",
"sets",
"the",
"directory",
"in",
"which",
"template",
"files",
"are",
"stored",
"."
] | [
"func",
"WithBaseDir",
"(",
"dir",
"string",
")",
"Option",
"{",
"return",
"func",
"(",
"o",
"*",
"<mask>",
")",
"{",
"o",
".",
"fileFindFunc",
"=",
"func",
"(",
"f",
"string",
")",
"string",
"{",
"return",
"filepath",
".",
"Join",
"(",
"dir",
",",
"f",
")",
"\n",
"}",
"\n",
"}",
"\n",
"}"
] |
10,743 | all-10744 | [
"extractCmdLineParams",
"generates",
"flags",
"for",
"the",
"command",
"line"
] | [
"func",
"extractCmdLineParams",
"(",
"a",
"*",
"gen",
".",
"ActionParam",
",",
"root",
"string",
",",
"seen",
"map",
"[",
"string",
"]",
"*",
"[",
"]",
"*",
"gen",
".",
"ActionParam",
",",
"parentNotMandatory",
"bool",
")",
"[",
"]",
"*",
"gen",
".",
"ActionParam",
"{",
"switch",
"t",
":=",
"a",
".",
"Type",
".",
"(",
"type",
")",
"{",
"case",
"*",
"gen",
".",
"BasicDataType",
",",
"*",
"gen",
".",
"EnumerableDataType",
",",
"*",
"gen",
".",
"UploadDataType",
":",
"dup",
":=",
"gen",
".",
"ActionParam",
"{",
"Name",
":",
"a",
".",
"Name",
",",
"QueryName",
":",
"root",
",",
"Description",
":",
"a",
".",
"Description",
",",
"VarName",
":",
"a",
".",
"VarName",
",",
"<mask>",
":",
"a",
".",
"Location",
",",
"Type",
":",
"a",
".",
"Type",
",",
"Mandatory",
":",
"a",
".",
"Mandatory",
"&&",
"!",
"parentNotMandatory",
",",
"// yay for double negations!",
"NonBlank",
":",
"a",
".",
"NonBlank",
",",
"Regexp",
":",
"a",
".",
"Regexp",
",",
"ValidValues",
":",
"a",
".",
"ValidValues",
",",
"Min",
":",
"a",
".",
"Min",
",",
"Max",
":",
"a",
".",
"Max",
",",
"}",
"\n",
"return",
"[",
"]",
"*",
"gen",
".",
"ActionParam",
"{",
"&",
"dup",
"}",
"\n",
"case",
"*",
"gen",
".",
"ArrayDataType",
":",
"p",
":=",
"t",
".",
"ElemType",
"\n",
"eq",
",",
"ok",
":=",
"seen",
"[",
"p",
".",
"Name",
"]",
"\n",
"if",
"!",
"ok",
"{",
"eq",
"=",
"&",
"[",
"]",
"*",
"gen",
".",
"ActionParam",
"{",
"}",
"\n",
"seen",
"[",
"p",
".",
"Name",
"]",
"=",
"eq",
"\n",
"*",
"eq",
"=",
"extractCmdLineParams",
"(",
"p",
",",
"root",
"+",
"\"",
"\"",
",",
"seen",
",",
"parentNotMandatory",
"||",
"!",
"a",
".",
"Mandatory",
")",
"\n",
"}",
"\n",
"return",
"*",
"eq",
"\n",
"case",
"*",
"gen",
".",
"ObjectDataType",
":",
"params",
":=",
"[",
"]",
"*",
"gen",
".",
"ActionParam",
"{",
"}",
"\n",
"for",
"_",
",",
"f",
":=",
"range",
"t",
".",
"Fields",
"{",
"eq",
",",
"ok",
":=",
"seen",
"[",
"f",
".",
"Name",
"]",
"\n",
"if",
"!",
"ok",
"{",
"eq",
"=",
"&",
"[",
"]",
"*",
"gen",
".",
"ActionParam",
"{",
"}",
"\n",
"seen",
"[",
"f",
".",
"Name",
"]",
"=",
"eq",
"\n",
"*",
"eq",
"=",
"extractCmdLineParams",
"(",
"f",
",",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"root",
",",
"f",
".",
"Name",
")",
",",
"seen",
",",
"parentNotMandatory",
"||",
"!",
"a",
".",
"Mandatory",
")",
"\n",
"}",
"\n",
"params",
"=",
"append",
"(",
"params",
",",
"*",
"eq",
"...",
")",
"\n",
"}",
"\n",
"return",
"params",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
] |
10,744 | all-10745 | [
"NewReporter",
"returns",
"a",
"reporter",
"client"
] | [
"func",
"NewReporter",
"(",
"gc",
"<mask>",
".",
"GitHubClient",
",",
"cfg",
"config",
".",
"Getter",
",",
"reportAgent",
"v1",
".",
"ProwJobAgent",
")",
"*",
"Client",
"{",
"return",
"&",
"Client",
"{",
"gc",
":",
"gc",
",",
"config",
":",
"cfg",
",",
"reportAgent",
":",
"reportAgent",
",",
"}",
"\n",
"}"
] |
10,745 | all-10746 | [
"Left",
"pads",
"a",
"string",
"to",
"a",
"given",
"with",
"using",
"0",
".",
"If",
"the",
"string",
"begins",
"with",
"a",
"negative",
"-",
"character",
"then",
"padding",
"is",
"inserted",
"between",
"the",
"-",
"and",
"the",
"remaining",
"characters",
"."
] | [
"func",
"zfillString",
"(",
"src",
"string",
",",
"z",
"int",
")",
"string",
"{",
"size",
":=",
"len",
"(",
"src",
")",
"\n",
"if",
"size",
">=",
"z",
"{",
"return",
"src",
"\n",
"}",
"\n\n",
"fill",
":=",
"strings",
".",
"Repeat",
"(",
"\"",
"\"",
",",
"z",
"-",
"size",
")",
"\n",
"if",
"strings",
".",
"HasPrefix",
"(",
"src",
",",
"\"",
"\"",
")",
"{",
"return",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"fill",
",",
"src",
"[",
"1",
":",
"]",
")",
"\n",
"}",
"\n",
"return",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"<mask>",
",",
"src",
")",
"\n",
"}"
] |
10,746 | all-10747 | [
"applyKindMappings",
"returns",
"a",
"copy",
"of",
"LoadInfo",
"that",
"includes",
"c",
".",
"KindMap",
"."
] | [
"func",
"applyKindMappings",
"(",
"mappedKinds",
"[",
"]",
"config",
".",
"MappedKind",
",",
"loads",
"[",
"]",
"rule",
".",
"LoadInfo",
")",
"[",
"]",
"rule",
".",
"LoadInfo",
"{",
"if",
"len",
"(",
"mappedKinds",
")",
"==",
"0",
"{",
"return",
"loads",
"\n",
"}",
"\n\n",
"// Add new RuleInfos or replace existing ones with merged ones.",
"mappedLoads",
":=",
"make",
"(",
"[",
"]",
"rule",
".",
"LoadInfo",
",",
"len",
"(",
"loads",
")",
")",
"\n",
"<mask>",
"(",
"mappedLoads",
",",
"loads",
")",
"\n",
"for",
"_",
",",
"mappedKind",
":=",
"range",
"mappedKinds",
"{",
"mappedLoads",
"=",
"appendOrMergeKindMapping",
"(",
"mappedLoads",
",",
"mappedKind",
")",
"\n",
"}",
"\n",
"return",
"mappedLoads",
"\n",
"}"
] |
10,747 | all-10748 | [
"Wrapf",
"is",
"Wrap",
"with",
"extra",
"info",
"."
] | [
"func",
"Wrapf",
"(",
"err",
"error",
",",
"format",
"string",
",",
"args",
"...",
"interface",
"{",
"}",
")",
"error",
"{",
"if",
"!",
"debugMode",
"{",
"if",
"err",
"==",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n",
"return",
"fmt",
".",
"Errorf",
"(",
"format",
"+",
"\"",
"\"",
",",
"append",
"(",
"args",
",",
"err",
")",
"...",
")",
"\n",
"}",
"\n",
"return",
"errors",
".",
"Wrapf",
"(",
"err",
",",
"<mask>",
",",
"args",
"...",
")",
"\n",
"}"
] |
10,748 | all-10749 | [
"SetBodyStream",
"sets",
"request",
"body",
"stream",
"and",
"optionally",
"body",
"size",
".",
"If",
"bodySize",
"is",
">",
"=",
"0",
"then",
"the",
"bodyStream",
"must",
"provide",
"exactly",
"bodySize",
"bytes",
"before",
"returning",
"io",
".",
"EOF",
".",
"If",
"bodySize",
"<",
"0",
"then",
"bodyStream",
"is",
"read",
"until",
"io",
".",
"EOF",
".",
"bodyStream",
".",
"Close",
"()",
"is",
"called",
"after",
"finishing",
"reading",
"all",
"body",
"data",
"if",
"it",
"implements",
"io",
".",
"Closer",
".",
"Note",
"that",
"GET",
"and",
"HEAD",
"requests",
"cannot",
"have",
"body",
".",
"See",
"also",
"SetBodyStreamWriter",
"."
] | [
"func",
"(",
"req",
"*",
"Request",
")",
"SetBodyStream",
"(",
"bodyStream",
"io",
".",
"Reader",
",",
"bodySize",
"int",
")",
"{",
"req",
".",
"ResetBody",
"(",
")",
"\n",
"req",
".",
"bodyStream",
"=",
"bodyStream",
"\n",
"req",
".",
"<mask>",
".",
"SetContentLength",
"(",
"bodySize",
")",
"\n",
"}"
] |
10,749 | all-10750 | [
"Unmarshal",
"assigns",
"values",
"into",
"the",
"pointer",
"to",
"struct",
"given",
"by",
"out",
"for",
"the",
"keys",
"found",
".",
"The",
"valid",
"types",
"in",
"the",
"struct",
"fields",
"for",
"the",
"matched",
"keys",
"are",
":",
"bool",
"int",
"uint",
"float64",
"string",
".",
"The",
"errors",
"that",
"Unmarshal",
"return",
"can",
"be",
"ErrStructPtr",
"or",
"TypeError",
"."
] | [
"func",
"(",
"c",
"*",
"Config",
")",
"Unmarshal",
"(",
"out",
"interface",
"{",
"}",
")",
"error",
"{",
"valueof",
":=",
"reflect",
".",
"ValueOf",
"(",
"out",
")",
"\n",
"if",
"valueof",
".",
"Kind",
"(",
")",
"!=",
"reflect",
".",
"Ptr",
"{",
"return",
"ErrStructPtr",
"\n",
"}",
"\n",
"valueof",
"=",
"valueof",
".",
"Elem",
"(",
")",
"\n",
"if",
"valueof",
".",
"Kind",
"(",
")",
"!=",
"reflect",
".",
"Struct",
"{",
"return",
"ErrStructPtr",
"\n",
"}",
"\n\n",
"typeof",
":=",
"valueof",
".",
"Type",
"(",
")",
"\n\n",
"for",
"i",
":=",
"0",
";",
"i",
"<",
"valueof",
".",
"NumField",
"(",
")",
";",
"i",
"++",
"{",
"fieldT",
":=",
"typeof",
".",
"Field",
"(",
"i",
")",
"\n",
"fieldV",
":=",
"valueof",
".",
"Field",
"(",
"i",
")",
"\n\n",
"if",
"value",
",",
"found",
":=",
"c",
".",
"data",
"[",
"fieldT",
".",
"Name",
"]",
";",
"found",
"{",
"switch",
"fieldV",
".",
"Kind",
"(",
")",
"{",
"case",
"reflect",
".",
"Bool",
":",
"v",
",",
"_",
":=",
"strconv",
".",
"ParseBool",
"(",
"value",
")",
"\n",
"fieldV",
".",
"SetBool",
"(",
"v",
")",
"\n\n",
"case",
"reflect",
".",
"Int",
":",
"v",
",",
"_",
":=",
"strconv",
".",
"ParseInt",
"(",
"value",
",",
"10",
",",
"0",
")",
"\n",
"fieldV",
".",
"SetInt",
"(",
"v",
")",
"\n",
"<mask>",
"reflect",
".",
"Uint",
":",
"v",
",",
"_",
":=",
"strconv",
".",
"ParseUint",
"(",
"value",
",",
"10",
",",
"0",
")",
"\n",
"fieldV",
".",
"SetUint",
"(",
"v",
")",
"\n\n",
"case",
"reflect",
".",
"Float64",
":",
"v",
",",
"_",
":=",
"strconv",
".",
"ParseFloat",
"(",
"value",
",",
"64",
")",
"\n",
"fieldV",
".",
"SetFloat",
"(",
"v",
")",
"\n",
"/*case reflect.Float32:\n\t\t\t\tv, _ := strconv.ParseFloat(value, 32)\n\t\t\t\tfieldV.SetFloat(v)*/",
"case",
"reflect",
".",
"String",
":",
"fieldV",
".",
"SetString",
"(",
"value",
")",
"\n\n",
"default",
":",
"return",
"TypeError",
"(",
"fieldV",
".",
"Kind",
"(",
")",
".",
"String",
"(",
")",
")",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
] |
10,750 | all-10751 | [
"NewMockFile",
"creates",
"a",
"new",
"mock",
"instance"
] | [
"func",
"NewMockFile",
"(",
"ctrl",
"*",
"gomock",
".",
"<mask>",
")",
"*",
"MockFile",
"{",
"mock",
":=",
"&",
"MockFile",
"{",
"ctrl",
":",
"ctrl",
"}",
"\n",
"mock",
".",
"recorder",
"=",
"&",
"MockFileMockRecorder",
"{",
"mock",
"}",
"\n",
"return",
"mock",
"\n",
"}"
] |
10,751 | all-10752 | [
"GetSentStatus",
"safely",
"returns",
"the",
"SentStatus",
"of",
"the",
"task"
] | [
"func",
"(",
"<mask>",
"*",
"Task",
")",
"GetSentStatus",
"(",
")",
"apitaskstatus",
".",
"TaskStatus",
"{",
"task",
".",
"lock",
".",
"RLock",
"(",
")",
"\n",
"defer",
"task",
".",
"lock",
".",
"RUnlock",
"(",
")",
"\n\n",
"return",
"task",
".",
"SentStatusUnsafe",
"\n",
"}"
] |
10,752 | all-10753 | [
"BuildKeypad",
"builds",
"the",
"Keypad",
"Graph"
] | [
"func",
"BuildKeypad",
"(",
")",
"<mask>",
"{",
"data",
",",
"err",
":=",
"data",
".",
"Asset",
"(",
"\"",
"\"",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"panic",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"return",
"getAdjancencyGraphFromFile",
"(",
"data",
",",
"\"",
"\"",
")",
"\n",
"}"
] |
10,753 | all-10754 | [
"Len",
"returns",
"the",
"number",
"of",
"values",
"remaining",
"to",
"be",
"read",
"from",
"the",
"stream",
"which",
"may",
"be",
"-",
"1",
"if",
"the",
"underlying",
"format",
"doesn",
"t",
"provide",
"this",
"information",
".",
"If",
"an",
"error",
"occurred",
"while",
"decoding",
"the",
"stream",
"the",
"method",
"returns",
"zero",
"because",
"no",
"more",
"values",
"can",
"be",
"read",
"."
] | [
"func",
"(",
"d",
"*",
"StreamDecoder",
")",
"Len",
"(",
")",
"int",
"{",
"if",
"d",
".",
"err",
"!=",
"nil",
"{",
"return",
"0",
"\n",
"}",
"\n\n",
"if",
"d",
".",
"typ",
"==",
"Unknown",
"{",
"if",
"d",
".",
"init",
"(",
")",
"!=",
"nil",
"{",
"return",
"0",
"\n",
"}",
"\n",
"}",
"\n\n",
"return",
"d",
".",
"<mask>",
"-",
"d",
".",
"cnt",
"\n",
"}"
] |
10,754 | all-10755 | [
"Send",
"calls",
"f",
"(",
"from",
"to",
"msg",
")",
"."
] | [
"func",
"(",
"f",
"SendFunc",
")",
"Send",
"(",
"from",
"string",
",",
"to",
"[",
"]",
"string",
",",
"msg",
"<mask>",
".",
"WriterTo",
")",
"error",
"{",
"return",
"f",
"(",
"from",
",",
"to",
",",
"msg",
")",
"\n",
"}"
] |
10,755 | all-10756 | [
"goroutine",
"that",
"cycles",
"through",
"the",
"list",
"of",
"paths",
"and",
"checks",
"for",
"updates",
"."
] | [
"func",
"(",
"w",
"*",
"Watcher",
")",
"watch",
"(",
"sndch",
"chan",
"<-",
"*",
"Notification",
")",
"{",
"defer",
"func",
"(",
")",
"{",
"recover",
"(",
")",
"\n",
"}",
"(",
")",
"\n",
"for",
"{",
"<-",
"time",
".",
"After",
"(",
"WatchDelay",
")",
"\n",
"for",
"_",
",",
"wi",
":=",
"<mask>",
"w",
".",
"paths",
"{",
"if",
"wi",
".",
"Update",
"(",
")",
"&&",
"w",
".",
"shouldNotify",
"(",
"wi",
")",
"{",
"sndch",
"<-",
"wi",
".",
"Notification",
"(",
")",
"\n",
"}",
"\n\n",
"if",
"wi",
".",
"LastEvent",
"==",
"NOEXIST",
"&&",
"w",
".",
"auto_watch",
"{",
"delete",
"(",
"w",
".",
"paths",
",",
"wi",
".",
"Path",
")",
"\n",
"}",
"\n\n",
"if",
"len",
"(",
"w",
".",
"paths",
")",
"==",
"0",
"{",
"w",
".",
"Stop",
"(",
")",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n",
"}"
] |
10,756 | all-10757 | [
"String",
"returns",
"a",
"human",
"readable",
"string",
"representation",
"of",
"this",
"object"
] | [
"func",
"(",
"change",
"*",
"TaskStateChange",
")",
"String",
"(",
")",
"string",
"{",
"res",
":=",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"change",
".",
"TaskARN",
",",
"change",
".",
"Status",
".",
"String",
"(",
")",
")",
"\n",
"if",
"change",
".",
"Task",
"!=",
"nil",
"{",
"res",
"+=",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"change",
".",
"Task",
".",
"GetSentStatus",
"(",
")",
".",
"<mask>",
"(",
")",
",",
"change",
".",
"Task",
".",
"GetPullStartedAt",
"(",
")",
",",
"change",
".",
"Task",
".",
"GetPullStoppedAt",
"(",
")",
",",
"change",
".",
"Task",
".",
"GetExecutionStoppedAt",
"(",
")",
")",
"\n",
"}",
"\n",
"if",
"change",
".",
"Attachment",
"!=",
"nil",
"{",
"res",
"+=",
"\"",
"\"",
"+",
"change",
".",
"Attachment",
".",
"String",
"(",
")",
"\n",
"}",
"\n",
"for",
"_",
",",
"containerChange",
":=",
"range",
"change",
".",
"Containers",
"{",
"res",
"+=",
"\"",
"\"",
"+",
"containerChange",
".",
"String",
"(",
")",
"\n",
"}",
"\n\n",
"return",
"res",
"\n",
"}"
] |
10,757 | all-10758 | [
"Deprecated",
":",
"see",
"NamedValueChecker",
".",
"func",
"(",
"s",
"*",
"bulkInsertStmt",
")",
"ColumnConverter",
"(",
"idx",
"int",
")",
"driver",
".",
"ValueConverter",
"{",
"}",
"CheckNamedValue",
"implements",
"NamedValueChecker",
"interface",
"."
] | [
"func",
"(",
"s",
"*",
"bulkInsertStmt",
")",
"CheckNamedValue",
"(",
"nv",
"*",
"<mask>",
".",
"NamedValue",
")",
"error",
"{",
"return",
"checkNamedValue",
"(",
"s",
".",
"prmFieldSet",
",",
"nv",
")",
"\n",
"}"
] |
10,758 | all-10759 | [
"UnmarshalJSON",
"supports",
"json",
".",
"Unmarshaler",
"interface"
] | [
"func",
"(",
"v",
"*",
"EventFrameStartedLoading",
")",
"UnmarshalJSON",
"(",
"data",
"[",
"]",
"byte",
")",
"error",
"{",
"r",
":=",
"jlexer",
".",
"Lexer",
"{",
"Data",
":",
"<mask>",
"}",
"\n",
"easyjsonC5a4559bDecodeGithubComChromedpCdprotoPage61",
"(",
"&",
"r",
",",
"v",
")",
"\n",
"return",
"r",
".",
"Error",
"(",
")",
"\n",
"}"
] |
10,759 | all-10760 | [
"Next",
"returns",
"the",
"next",
"page",
"of",
"resources",
".",
"If",
"there",
"are",
"no",
"more",
"resources",
"NoMoreResults",
"is",
"returned",
"."
] | [
"func",
"(",
"c",
"*",
"TranscriptionPageIterator",
")",
"Next",
"(",
"ctx",
"context",
".",
"Context",
")",
"(",
"*",
"TranscriptionPage",
",",
"error",
")",
"{",
"cp",
":=",
"<mask>",
"(",
"TranscriptionPage",
")",
"\n",
"err",
":=",
"c",
".",
"p",
".",
"Next",
"(",
"ctx",
",",
"cp",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"c",
".",
"p",
".",
"SetNextPageURI",
"(",
"cp",
".",
"NextPageURI",
")",
"\n",
"return",
"cp",
",",
"nil",
"\n",
"}"
] |
10,760 | all-10761 | [
"render",
"multiple",
"sets",
"of",
"primitives",
"from",
"array",
"data",
"taking",
"parameters",
"from",
"memory"
] | [
"func",
"MultiDrawArraysIndirect",
"(",
"<mask>",
"uint32",
",",
"indirect",
"unsafe",
".",
"Pointer",
",",
"drawcount",
"int32",
",",
"stride",
"int32",
")",
"{",
"syscall",
".",
"Syscall6",
"(",
"gpMultiDrawArraysIndirect",
",",
"4",
",",
"uintptr",
"(",
"mode",
")",
",",
"uintptr",
"(",
"indirect",
")",
",",
"uintptr",
"(",
"drawcount",
")",
",",
"uintptr",
"(",
"stride",
")",
",",
"0",
",",
"0",
")",
"\n",
"}"
] |
10,761 | all-10762 | [
"UnmarshalJSON",
"satisfies",
"json",
".",
"Unmarshaler",
"."
] | [
"func",
"(",
"t",
"*",
"Subtype",
")",
"UnmarshalJSON",
"(",
"buf",
"[",
"]",
"<mask>",
")",
"error",
"{",
"return",
"easyjson",
".",
"Unmarshal",
"(",
"buf",
",",
"t",
")",
"\n",
"}"
] |
10,762 | all-10763 | [
"MarshalJSON",
"supports",
"json",
".",
"Marshaler",
"interface"
] | [
"func",
"(",
"v",
"PerformSearchReturns",
")",
"MarshalJSON",
"(",
")",
"(",
"[",
"]",
"<mask>",
",",
"error",
")",
"{",
"w",
":=",
"jwriter",
".",
"Writer",
"{",
"}",
"\n",
"easyjsonC5a4559bEncodeGithubComChromedpCdprotoDom27",
"(",
"&",
"w",
",",
"v",
")",
"\n",
"return",
"w",
".",
"Buffer",
".",
"BuildBytes",
"(",
")",
",",
"w",
".",
"Error",
"\n",
"}"
] |
10,763 | all-10764 | [
"Create",
"a",
"new",
"azureResource",
"object",
"from",
"an",
"ID",
"string",
"."
] | [
"func",
"newAzureResourceFromID",
"(",
"id",
"string",
",",
"logger",
"log",
".",
"Logger",
")",
"(",
"azureResource",
",",
"error",
")",
"{",
"// Resource IDs have the following format.",
"// /subscriptions/SUBSCRIPTION_ID/resourceGroups/RESOURCE_GROUP/providers/PROVIDER/TYPE/NAME",
"// or if embedded resource then",
"// /subscriptions/SUBSCRIPTION_ID/resourceGroups/RESOURCE_GROUP/providers/PROVIDER/TYPE/NAME/TYPE/NAME",
"s",
":=",
"strings",
".",
"Split",
"(",
"id",
",",
"\"",
"\"",
")",
"\n",
"if",
"len",
"(",
"s",
")",
"!=",
"9",
"&&",
"len",
"(",
"s",
")",
"!=",
"11",
"{",
"err",
":=",
"errors",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"<mask>",
")",
"\n",
"level",
".",
"Error",
"(",
"logger",
")",
".",
"Log",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"return",
"azureResource",
"{",
"}",
",",
"err",
"\n",
"}",
"\n\n",
"return",
"azureResource",
"{",
"Name",
":",
"strings",
".",
"ToLower",
"(",
"s",
"[",
"8",
"]",
")",
",",
"ResourceGroup",
":",
"strings",
".",
"ToLower",
"(",
"s",
"[",
"4",
"]",
")",
",",
"}",
",",
"nil",
"\n",
"}"
] |
10,764 | all-10765 | [
"DefaultCredentials",
"returns",
"the",
"credentials",
"associated",
"with",
"the",
"instance",
"iam",
"role"
] | [
"func",
"(",
"c",
"*",
"ec2MetadataClientImpl",
")",
"DefaultCredentials",
"(",
")",
"(",
"*",
"RoleCredentials",
",",
"error",
")",
"{",
"securityCredential",
",",
"err",
":=",
"c",
".",
"client",
".",
"GetMetadata",
"(",
"SecurityCrednetialsResource",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"securityCredentialList",
":=",
"strings",
".",
"Split",
"(",
"strings",
".",
"TrimSpace",
"(",
"securityCredential",
")",
",",
"\"",
"\\n",
"\"",
")",
"\n",
"if",
"len",
"(",
"securityCredentialList",
")",
"==",
"0",
"{",
"return",
"nil",
",",
"errors",
".",
"New",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"defaultCredentialName",
":=",
"securityCredentialList",
"[",
"0",
"]",
"\n\n",
"defaultCredentialStr",
",",
"err",
":=",
"c",
".",
"client",
".",
"GetMetadata",
"(",
"SecurityCrednetialsResource",
"+",
"defaultCredentialName",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"var",
"credential",
"RoleCredentials",
"\n",
"err",
"=",
"json",
".",
"Unmarshal",
"(",
"[",
"]",
"<mask>",
"(",
"defaultCredentialStr",
")",
",",
"&",
"credential",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"return",
"&",
"credential",
",",
"nil",
"\n",
"}"
] |
10,765 | all-10766 | [
"ValidEnum",
"validates",
"a",
"proposed",
"value",
"for",
"this",
"enum",
".",
"Implements",
"the",
"Enum",
"interface",
"for",
"MessageType"
] | [
"func",
"(",
"e",
"MessageType",
")",
"ValidEnum",
"(",
"v",
"int32",
")",
"bool",
"{",
"_",
",",
"<mask>",
":=",
"messageTypeMap",
"[",
"v",
"]",
"\n",
"return",
"ok",
"\n",
"}"
] |
10,766 | all-10767 | [
"NotBefore",
"is",
"an",
"Option",
"for",
"setting",
"the",
"identity",
"s",
"certificate",
"s",
"NotBefore",
"."
] | [
"func",
"NotBefore",
"(",
"<mask>",
"time",
".",
"Time",
")",
"Option",
"{",
"return",
"func",
"(",
"c",
"*",
"configuration",
")",
"{",
"c",
".",
"notBefore",
"=",
"&",
"value",
"\n",
"}",
"\n",
"}"
] |
10,767 | all-10768 | [
"MarshalJSON",
"supports",
"json",
".",
"Marshaler",
"interface"
] | [
"func",
"(",
"v",
"StopWorkerParams",
")",
"MarshalJSON",
"(",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"w",
":=",
"jwriter",
".",
"Writer",
"{",
"}",
"\n",
"easyjsonC5a4559bEncodeGithubComChromedpCdprotoServiceworker3",
"(",
"&",
"w",
",",
"v",
")",
"\n",
"return",
"w",
".",
"<mask>",
".",
"BuildBytes",
"(",
")",
",",
"w",
".",
"Error",
"\n",
"}"
] |
10,768 | all-10769 | [
"Copies",
"all",
"unexpired",
"items",
"in",
"the",
"cache",
"into",
"a",
"new",
"map",
"and",
"returns",
"it",
"."
] | [
"func",
"(",
"c",
"*",
"cache",
")",
"Items",
"(",
")",
"<mask>",
"[",
"string",
"]",
"Item",
"{",
"c",
".",
"mu",
".",
"RLock",
"(",
")",
"\n",
"defer",
"c",
".",
"mu",
".",
"RUnlock",
"(",
")",
"\n",
"m",
":=",
"make",
"(",
"map",
"[",
"string",
"]",
"Item",
",",
"len",
"(",
"c",
".",
"items",
")",
")",
"\n",
"now",
":=",
"time",
".",
"Now",
"(",
")",
".",
"UnixNano",
"(",
")",
"\n",
"for",
"k",
",",
"v",
":=",
"range",
"c",
".",
"items",
"{",
"// \"Inlining\" of Expired",
"if",
"v",
".",
"Expiration",
">",
"0",
"{",
"if",
"now",
">",
"v",
".",
"Expiration",
"{",
"continue",
"\n",
"}",
"\n",
"}",
"\n",
"m",
"[",
"k",
"]",
"=",
"v",
"\n",
"}",
"\n",
"return",
"m",
"\n",
"}"
] |
10,769 | all-10770 | [
"ChangeCustomHostVar",
"creates",
"a",
"new",
"CHANGE_CUSTOM_HOST_VAR",
"Nagios",
"command",
".",
"Changes",
"the",
"value",
"of",
"a",
"custom",
"host",
"variable",
"."
] | [
"func",
"ChangeCustomHostVar",
"(",
"host_name",
"string",
",",
"varname",
"string",
",",
"varvalue",
"<mask>",
",",
")",
"*",
"livestatus",
".",
"Command",
"{",
"return",
"livestatus",
".",
"NewCommand",
"(",
"\"",
"\"",
",",
"stringifyArg",
"(",
"\"",
"\"",
",",
"\"",
"\"",
",",
"host_name",
")",
",",
"stringifyArg",
"(",
"\"",
"\"",
",",
"\"",
"\"",
",",
"varname",
")",
",",
"stringifyArg",
"(",
"\"",
"\"",
",",
"\"",
"\"",
",",
"varvalue",
")",
",",
")",
"\n",
"}"
] |
10,770 | all-10771 | [
"Groups",
"lists",
"the",
"groups",
"of",
"a",
"domain"
] | [
"func",
"(",
"dom",
"*",
"Domain",
")",
"Groups",
"(",
")",
"(",
"[",
"]",
"*",
"<mask>",
",",
"error",
")",
"{",
"var",
"vl",
"valueList",
"\n",
"err",
":=",
"dom",
".",
"cgp",
".",
"request",
"(",
"listGroups",
"{",
"Domain",
":",
"dom",
".",
"Name",
"}",
",",
"&",
"vl",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"[",
"]",
"*",
"Group",
"{",
"}",
",",
"err",
"\n",
"}",
"\n",
"vals",
":=",
"vl",
".",
"compact",
"(",
")",
"\n",
"grps",
":=",
"make",
"(",
"[",
"]",
"*",
"Group",
",",
"len",
"(",
"vals",
")",
")",
"\n",
"for",
"i",
",",
"v",
":=",
"range",
"vals",
"{",
"g",
",",
"err",
":=",
"dom",
".",
"GetGroup",
"(",
"v",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"grps",
",",
"err",
"\n",
"}",
"\n",
"grps",
"[",
"i",
"]",
"=",
"g",
"\n",
"}",
"\n",
"return",
"grps",
",",
"nil",
"\n",
"}"
] |
10,771 | all-10772 | [
"HasCustomFgColor",
"returns",
"a",
"boolean",
"if",
"a",
"field",
"has",
"been",
"set",
"."
] | [
"func",
"(",
"d",
"*",
"DashboardConditionalFormat",
")",
"HasCustomFgColor",
"(",
")",
"bool",
"{",
"if",
"d",
"!=",
"nil",
"&&",
"d",
".",
"CustomFgColor",
"!=",
"nil",
"{",
"return",
"true",
"\n",
"}",
"\n\n",
"return",
"<mask>",
"\n",
"}"
] |
10,772 | all-10773 | [
"/",
"*",
"Infom",
"uses",
"msg",
"as",
"a",
"format",
"string",
"with",
"subsequent",
"parameters",
"as",
"values",
"and",
"logs",
"the",
"resulting",
"message",
"to",
"all",
"added",
"loggers",
"at",
"LogLevel",
".",
"LevelInfo",
".",
"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",
"(",
"la",
"*",
"LogAdapter",
")",
"Infom",
"(",
"m",
"*",
"Attrs",
",",
"msg",
"string",
",",
"a",
"...",
"<mask>",
"{",
"}",
")",
"error",
"{",
"return",
"la",
".",
"Log",
"(",
"LevelInfo",
",",
"m",
",",
"msg",
",",
"a",
"...",
")",
"\n",
"}"
] |
10,773 | all-10774 | [
"UnmarshalJSON",
"supports",
"json",
".",
"Unmarshaler",
"interface"
] | [
"func",
"(",
"v",
"*",
"SynthesizeTapGestureParams",
")",
"UnmarshalJSON",
"(",
"data",
"[",
"]",
"byte",
")",
"error",
"{",
"r",
":=",
"jlexer",
".",
"Lexer",
"{",
"Data",
":",
"data",
"}",
"\n",
"easyjsonC5a4559bDecodeGithubComChromedpCdprotoInput1",
"(",
"&",
"r",
",",
"v",
")",
"\n",
"return",
"r",
".",
"<mask>",
"(",
")",
"\n",
"}"
] |
10,774 | all-10775 | [
"Md5",
"functions"
] | [
"func",
"(",
"p",
"*",
"putter",
")",
"hashContent",
"(",
"r",
"io",
".",
"ReadSeeker",
")",
"(",
"string",
",",
"string",
",",
"string",
",",
"error",
")",
"{",
"m",
":=",
"md5",
".",
"New",
"(",
")",
"\n",
"s",
":=",
"sha256",
".",
"New",
"(",
")",
"\n",
"mw",
":=",
"io",
".",
"MultiWriter",
"(",
"m",
",",
"s",
",",
"p",
".",
"md5",
")",
"\n",
"if",
"_",
",",
"err",
":=",
"io",
".",
"Copy",
"(",
"mw",
",",
"r",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"err",
"\n",
"}",
"\n",
"md5Sum",
":=",
"m",
".",
"Sum",
"(",
"nil",
")",
"\n",
"shaSum",
":=",
"hex",
".",
"EncodeToString",
"(",
"s",
".",
"Sum",
"(",
"nil",
")",
")",
"\n",
"etag",
":=",
"<mask>",
".",
"EncodeToString",
"(",
"md5Sum",
")",
"\n",
"// add to checksum of all parts for verification on upload completion",
"if",
"_",
",",
"err",
":=",
"p",
".",
"md5OfParts",
".",
"Write",
"(",
"md5Sum",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"err",
"\n",
"}",
"\n",
"return",
"base64",
".",
"StdEncoding",
".",
"EncodeToString",
"(",
"md5Sum",
")",
",",
"shaSum",
",",
"etag",
",",
"nil",
"\n",
"}"
] |
10,775 | all-10776 | [
"GetApplicationName",
"is",
"a",
"wrapper",
"around",
"g_get_application_name",
"()",
"."
] | [
"func",
"GetApplicationName",
"(",
")",
"string",
"{",
"c",
":=",
"C",
".",
"g_get_application_name",
"(",
")",
"\n\n",
"return",
"C",
".",
"GoString",
"(",
"(",
"*",
"C",
".",
"<mask>",
")",
"(",
"c",
")",
")",
"\n",
"}"
] |
10,776 | all-10777 | [
"DialToTLS",
"makes",
"a",
"(",
"secure",
")",
"TELNETS",
"client",
"connection",
"to",
"the",
"the",
"address",
"specified",
"by",
"addr",
"."
] | [
"func",
"DialToTLS",
"(",
"addr",
"string",
",",
"tlsConfig",
"*",
"tls",
".",
"Config",
")",
"(",
"*",
"Conn",
",",
"error",
")",
"{",
"const",
"network",
"=",
"\"",
"\"",
"\n\n",
"if",
"\"",
"\"",
"==",
"addr",
"{",
"addr",
"=",
"\"",
"\"",
"\n",
"}",
"\n\n",
"conn",
",",
"err",
":=",
"tls",
".",
"Dial",
"(",
"<mask>",
",",
"addr",
",",
"tlsConfig",
")",
"\n",
"if",
"nil",
"!=",
"err",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"dataReader",
":=",
"newDataReader",
"(",
"conn",
")",
"\n",
"dataWriter",
":=",
"newDataWriter",
"(",
"conn",
")",
"\n\n",
"clientConn",
":=",
"Conn",
"{",
"conn",
":",
"conn",
",",
"dataReader",
":",
"dataReader",
",",
"dataWriter",
":",
"dataWriter",
",",
"}",
"\n\n",
"return",
"&",
"clientConn",
",",
"nil",
"\n",
"}"
] |
10,777 | all-10778 | [
"GetPrivateKeyID",
"returns",
"the",
"PrivateKeyID",
"field",
"if",
"non",
"-",
"nil",
"zero",
"value",
"otherwise",
"."
] | [
"func",
"(",
"i",
"*",
"IntegrationGCPCreateRequest",
")",
"GetPrivateKeyID",
"(",
")",
"<mask>",
"{",
"if",
"i",
"==",
"nil",
"||",
"i",
".",
"PrivateKeyID",
"==",
"nil",
"{",
"return",
"\"",
"\"",
"\n",
"}",
"\n",
"return",
"*",
"i",
".",
"PrivateKeyID",
"\n",
"}"
] |
10,778 | all-10779 | [
"UnmarshalJSON",
"supports",
"json",
".",
"Unmarshaler",
"interface"
] | [
"func",
"(",
"v",
"*",
"EventIssueUpdated",
")",
"UnmarshalJSON",
"(",
"data",
"[",
"]",
"byte",
")",
"error",
"{",
"r",
":=",
"jlexer",
".",
"Lexer",
"{",
"Data",
":",
"data",
"}",
"\n",
"easyjsonC5a4559bDecodeGithubComChromedpCdprotoCast4",
"(",
"&",
"r",
",",
"v",
")",
"\n",
"return",
"r",
".",
"<mask>",
"(",
")",
"\n",
"}"
] |
10,779 | all-10780 | [
"UnmarshalJSON",
"supports",
"json",
".",
"Unmarshaler",
"interface"
] | [
"func",
"(",
"v",
"*",
"EventJavascriptDialogClosed",
")",
"UnmarshalJSON",
"(",
"<mask>",
"[",
"]",
"byte",
")",
"error",
"{",
"r",
":=",
"jlexer",
".",
"Lexer",
"{",
"Data",
":",
"data",
"}",
"\n",
"easyjsonC5a4559bDecodeGithubComChromedpCdprotoPage57",
"(",
"&",
"r",
",",
"v",
")",
"\n",
"return",
"r",
".",
"Error",
"(",
")",
"\n",
"}"
] |
10,780 | all-10781 | [
"/",
"*",
"SetData",
"assigns",
"user",
"data",
"to",
"the",
"image",
"header"
] | [
"func",
"(",
"img",
"*",
"IplImage",
")",
"SetData",
"(",
"data",
"unsafe",
".",
"Pointer",
",",
"step",
"int",
")",
"{",
"C",
".",
"cvSetData",
"(",
"unsafe",
".",
"Pointer",
"(",
"img",
")",
",",
"<mask>",
",",
"C",
".",
"int",
"(",
"step",
")",
")",
"\n",
"}"
] |
10,781 | all-10782 | [
"First",
"retrieves",
"just",
"the",
"first",
"item",
"in",
"the",
"list",
"or",
"returns",
"an",
"error",
"if",
"there",
"are",
"no",
"elements",
"in",
"the",
"array",
"."
] | [
"func",
"First",
"(",
"subject",
"Enumerable",
")",
"(",
"retval",
"interface",
"{",
"}",
",",
"err",
"error",
")",
"{",
"done",
":=",
"<mask>",
"(",
"chan",
"struct",
"{",
"}",
")",
"\n\n",
"err",
"=",
"errNoElements",
"\n\n",
"var",
"isOpen",
"bool",
"\n\n",
"if",
"retval",
",",
"isOpen",
"=",
"<-",
"subject",
".",
"Enumerate",
"(",
"done",
")",
";",
"isOpen",
"{",
"err",
"=",
"nil",
"\n",
"}",
"\n",
"close",
"(",
"done",
")",
"\n\n",
"return",
"\n",
"}"
] |
10,782 | all-10783 | [
"IsAuthor",
"checks",
"if",
"a",
"user",
"is",
"the",
"author",
"of",
"the",
"issue",
"."
] | [
"func",
"(",
"i",
"Issue",
")",
"IsAuthor",
"(",
"login",
"string",
")",
"bool",
"{",
"return",
"NormLogin",
"(",
"i",
".",
"<mask>",
".",
"Login",
")",
"==",
"NormLogin",
"(",
"login",
")",
"\n",
"}"
] |
10,783 | all-10784 | [
"AddBuiltin",
"registers",
"a",
"builtin",
"kind",
"with",
"its",
"info",
"."
] | [
"func",
"(",
"mr",
"*",
"metaResolver",
")",
"AddBuiltin",
"(",
"kindName",
"<mask>",
",",
"resolver",
"resolve",
".",
"Resolver",
")",
"{",
"mr",
".",
"builtins",
"[",
"kindName",
"]",
"=",
"resolver",
"\n",
"}"
] |
10,784 | all-10785 | [
"tryCopyImage",
"iterates",
"through",
"the",
"source",
"server",
"URLs",
"until",
"one",
"lets",
"it",
"download",
"the",
"image"
] | [
"func",
"(",
"r",
"*",
"ProtocolLXD",
")",
"tryCopyImage",
"(",
"req",
"api",
".",
"ImagesPost",
",",
"urls",
"[",
"]",
"string",
")",
"(",
"RemoteOperation",
",",
"error",
")",
"{",
"if",
"len",
"(",
"urls",
")",
"==",
"0",
"{",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"rop",
":=",
"remoteOperation",
"{",
"chDone",
":",
"make",
"(",
"chan",
"bool",
")",
",",
"}",
"\n\n",
"// For older servers, apply the aliases after copy",
"if",
"!",
"r",
".",
"HasExtension",
"(",
"\"",
"\"",
")",
"&&",
"req",
".",
"Aliases",
"!=",
"nil",
"{",
"rop",
".",
"chPost",
"=",
"make",
"(",
"chan",
"bool",
")",
"\n\n",
"go",
"func",
"(",
")",
"{",
"defer",
"close",
"(",
"rop",
".",
"chPost",
")",
"\n\n",
"// Wait for the main operation to finish",
"<-",
"rop",
".",
"chDone",
"\n",
"if",
"rop",
".",
"err",
"!=",
"nil",
"{",
"return",
"\n",
"}",
"\n\n",
"// Get the operation data",
"op",
",",
"err",
":=",
"rop",
".",
"GetTarget",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"\n",
"}",
"\n\n",
"// Extract the fingerprint",
"fingerprint",
":=",
"op",
".",
"Metadata",
"[",
"\"",
"\"",
"]",
".",
"(",
"string",
")",
"\n\n",
"// Add the aliases",
"for",
"_",
",",
"entry",
":=",
"range",
"req",
".",
"Aliases",
"{",
"alias",
":=",
"api",
".",
"ImageAliasesPost",
"{",
"}",
"\n",
"alias",
".",
"Name",
"=",
"entry",
".",
"Name",
"\n",
"alias",
".",
"Target",
"=",
"fingerprint",
"\n\n",
"r",
".",
"CreateImageAlias",
"(",
"alias",
")",
"\n",
"}",
"\n",
"}",
"(",
")",
"\n",
"}",
"\n\n",
"// Forward targetOp to remote op",
"go",
"func",
"(",
")",
"{",
"success",
":=",
"false",
"\n",
"<mask>",
":=",
"map",
"[",
"string",
"]",
"error",
"{",
"}",
"\n",
"for",
"_",
",",
"serverURL",
":=",
"range",
"urls",
"{",
"req",
".",
"Source",
".",
"Server",
"=",
"serverURL",
"\n\n",
"op",
",",
"err",
":=",
"r",
".",
"CreateImage",
"(",
"req",
",",
"nil",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"errors",
"[",
"serverURL",
"]",
"=",
"err",
"\n",
"continue",
"\n",
"}",
"\n\n",
"rop",
".",
"targetOp",
"=",
"op",
"\n\n",
"for",
"_",
",",
"handler",
":=",
"range",
"rop",
".",
"handlers",
"{",
"rop",
".",
"targetOp",
".",
"AddHandler",
"(",
"handler",
")",
"\n",
"}",
"\n\n",
"err",
"=",
"rop",
".",
"targetOp",
".",
"Wait",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"errors",
"[",
"serverURL",
"]",
"=",
"err",
"\n",
"continue",
"\n",
"}",
"\n\n",
"success",
"=",
"true",
"\n",
"break",
"\n",
"}",
"\n\n",
"if",
"!",
"success",
"{",
"rop",
".",
"err",
"=",
"remoteOperationError",
"(",
"\"",
"\"",
",",
"errors",
")",
"\n",
"}",
"\n\n",
"close",
"(",
"rop",
".",
"chDone",
")",
"\n",
"}",
"(",
")",
"\n\n",
"return",
"&",
"rop",
",",
"nil",
"\n",
"}"
] |
10,785 | all-10786 | [
"Post",
"adds",
"the",
"route",
"pattern",
"that",
"matches",
"a",
"POST",
"http",
"method",
"to",
"execute",
"the",
"handlerFn",
"http",
".",
"HandlerFunc",
"."
] | [
"func",
"(",
"mx",
"*",
"Mux",
")",
"Post",
"(",
"pattern",
"string",
",",
"handlerFn",
"http",
".",
"HandlerFunc",
")",
"{",
"mx",
".",
"<mask>",
"(",
"mPOST",
",",
"pattern",
",",
"handlerFn",
")",
"\n",
"}"
] |
10,786 | all-10787 | [
"AddShare",
"adds",
"a",
"share"
] | [
"func",
"(",
"c",
"*",
"Client",
")",
"AddShare",
"(",
"groupid",
"string",
",",
"resourceid",
"string",
",",
"share",
"Share",
")",
"(",
"*",
"Share",
",",
"error",
")",
"{",
"url",
":=",
"umGroupSharePath",
"(",
"groupid",
",",
"resourceid",
")",
"+",
"`?depth=`",
"+",
"c",
".",
"client",
".",
"depth",
"+",
"`&pretty=`",
"+",
"strconv",
".",
"FormatBool",
"(",
"c",
".",
"client",
".",
"pretty",
")",
"\n",
"ret",
":=",
"&",
"Share",
"{",
"}",
"\n",
"err",
":=",
"c",
".",
"client",
".",
"Post",
"(",
"url",
",",
"share",
",",
"ret",
",",
"<mask>",
".",
"StatusAccepted",
")",
"\n",
"return",
"ret",
",",
"err",
"\n",
"}"
] |
10,787 | all-10788 | [
"/",
"*",
"Reshape",
"changes",
"shape",
"of",
"the",
"matrix",
"without",
"copying",
"data",
".",
"A",
"value",
"of",
"0",
"means",
"that",
"channels",
"or",
"rows",
"remain",
"unchanged",
"."
] | [
"func",
"(",
"m",
"*",
"Mat",
")",
"Reshape",
"(",
"channels",
",",
"rows",
"int",
")",
"*",
"Mat",
"{",
"total",
":=",
"m",
".",
"Cols",
"(",
")",
"*",
"m",
".",
"Rows",
"(",
")",
"\n",
"n",
":=",
"CreateMat",
"(",
"rows",
",",
"total",
"/",
"rows",
",",
"m",
".",
"Type",
"(",
")",
")",
"\n",
"C",
".",
"cvReshape",
"(",
"unsafe",
".",
"Pointer",
"(",
"m",
")",
",",
"(",
"*",
"C",
".",
"CvMat",
")",
"(",
"n",
")",
",",
"C",
".",
"int",
"(",
"channels",
")",
",",
"C",
".",
"int",
"(",
"<mask>",
")",
")",
"\n",
"return",
"n",
"\n",
"}"
] |
10,788 | all-10789 | [
"GetHeadContexts",
"returns",
"the",
"status",
"checks",
"contexts",
"of",
"the",
"head",
"commit",
"of",
"the",
"PR",
"."
] | [
"func",
"(",
"da",
"*",
"DashboardAgent",
")",
"GetHeadContexts",
"(",
"ghc",
"githubClient",
",",
"pr",
"PullRequest",
")",
"(",
"[",
"]",
"Context",
",",
"error",
")",
"{",
"org",
":=",
"string",
"(",
"pr",
".",
"Repository",
".",
"Owner",
".",
"Login",
")",
"\n",
"repo",
":=",
"string",
"(",
"pr",
".",
"Repository",
".",
"<mask>",
")",
"\n",
"combined",
",",
"err",
":=",
"ghc",
".",
"GetCombinedStatus",
"(",
"org",
",",
"repo",
",",
"string",
"(",
"pr",
".",
"HeadRefOID",
")",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"err",
")",
"\n",
"}",
"\n",
"contexts",
":=",
"make",
"(",
"[",
"]",
"Context",
",",
"0",
",",
"len",
"(",
"combined",
".",
"Statuses",
")",
")",
"\n",
"for",
"_",
",",
"status",
":=",
"range",
"combined",
".",
"Statuses",
"{",
"contexts",
"=",
"append",
"(",
"contexts",
",",
"Context",
"{",
"Context",
":",
"status",
".",
"Context",
",",
"Description",
":",
"status",
".",
"Description",
",",
"State",
":",
"strings",
".",
"ToUpper",
"(",
"status",
".",
"State",
")",
",",
"}",
",",
")",
"\n",
"}",
"\n",
"return",
"contexts",
",",
"nil",
"\n",
"}"
] |
10,789 | all-10790 | [
"FromCommandLine",
"builds",
"a",
"client",
"from",
"the",
"command",
"line",
"."
] | [
"func",
"FromCommandLine",
"(",
"cmdLine",
"*",
"cmd",
".",
"CommandLine",
")",
"(",
"*",
"API",
",",
"error",
")",
"{",
"api",
",",
"err",
":=",
"rsapi",
".",
"FromCommandLine",
"(",
"cmdLine",
")",
"\n",
"if",
"<mask>",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"api",
".",
"Host",
"=",
"apiHostFromLogin",
"(",
"cmdLine",
".",
"Host",
")",
"\n",
"api",
".",
"Metadata",
"=",
"GenMetadata",
"\n",
"return",
"&",
"API",
"{",
"api",
"}",
",",
"nil",
"\n",
"}"
] |
10,790 | all-10791 | [
"isPtrFromHeap",
"reports",
"whether",
"the",
"inferior",
"at",
"address",
"a",
"contains",
"a",
"pointer",
".",
"a",
"must",
"be",
"somewhere",
"in",
"the",
"heap",
"."
] | [
"func",
"(",
"p",
"*",
"Process",
")",
"isPtrFromHeap",
"(",
"a",
"core",
".",
"<mask>",
")",
"bool",
"{",
"return",
"p",
".",
"findHeapInfo",
"(",
"a",
")",
".",
"IsPtr",
"(",
"a",
",",
"p",
".",
"proc",
".",
"PtrSize",
"(",
")",
")",
"\n",
"}"
] |
10,791 | all-10792 | [
"Exec",
"executes",
"a",
"sql",
"statement",
"."
] | [
"func",
"(",
"s",
"*",
"Session",
")",
"Exec",
"(",
"id",
"uint64",
",",
"prmFieldSet",
"*",
"ParameterFieldSet",
",",
"args",
"[",
"]",
"driver",
".",
"NamedValue",
")",
"(",
"<mask>",
".",
"Result",
",",
"error",
")",
"{",
"s",
".",
"mu",
".",
"Lock",
"(",
")",
"\n",
"defer",
"s",
".",
"mu",
".",
"Unlock",
"(",
")",
"\n\n",
"s",
".",
"statementID",
".",
"id",
"=",
"&",
"id",
"\n",
"if",
"err",
":=",
"s",
".",
"writeRequest",
"(",
"mtExecute",
",",
"!",
"s",
".",
"conn",
".",
"inTx",
",",
"s",
".",
"statementID",
",",
"newInputParameters",
"(",
"prmFieldSet",
".",
"inputFields",
"(",
")",
",",
"args",
")",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"if",
"err",
":=",
"s",
".",
"readReply",
"(",
"nil",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"var",
"result",
"driver",
".",
"Result",
"\n",
"if",
"s",
".",
"sh",
".",
"functionCode",
"==",
"fcDDL",
"{",
"result",
"=",
"driver",
".",
"ResultNoRows",
"\n",
"}",
"else",
"{",
"result",
"=",
"driver",
".",
"RowsAffected",
"(",
"s",
".",
"rowsAffected",
".",
"total",
"(",
")",
")",
"\n",
"}",
"\n\n",
"if",
"err",
":=",
"s",
".",
"writeLobStream",
"(",
"prmFieldSet",
",",
"nil",
",",
"args",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"return",
"result",
",",
"nil",
"\n",
"}"
] |
10,792 | all-10793 | [
"FromCommandLine",
"builds",
"an",
"API",
"client",
"from",
"the",
"command",
"line",
"."
] | [
"func",
"FromCommandLine",
"(",
"cmdLine",
"*",
"cmd",
".",
"CommandLine",
")",
"(",
"*",
"API",
",",
"error",
")",
"{",
"var",
"client",
"*",
"API",
"\n",
"<mask>",
":=",
"strings",
".",
"HasPrefix",
"(",
"cmdLine",
".",
"Command",
",",
"\"",
"\"",
")",
"\n",
"if",
"cmdLine",
".",
"RL10",
"{",
"var",
"err",
"error",
"\n",
"if",
"client",
",",
"err",
"=",
"NewRL10",
"(",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"}",
"else",
"if",
"cmdLine",
".",
"OAuthToken",
"!=",
"\"",
"\"",
"{",
"auth",
":=",
"NewOAuthAuthenticator",
"(",
"cmdLine",
".",
"OAuthToken",
",",
"cmdLine",
".",
"Account",
")",
"\n",
"if",
"ss",
"{",
"auth",
"=",
"NewSSAuthenticator",
"(",
"auth",
",",
"cmdLine",
".",
"Account",
")",
"\n",
"}",
"\n",
"client",
"=",
"New",
"(",
"cmdLine",
".",
"Host",
",",
"auth",
")",
"\n",
"}",
"else",
"if",
"cmdLine",
".",
"OAuthAccessToken",
"!=",
"\"",
"\"",
"{",
"auth",
":=",
"NewTokenAuthenticator",
"(",
"cmdLine",
".",
"OAuthAccessToken",
",",
"cmdLine",
".",
"Account",
")",
"\n",
"if",
"ss",
"{",
"auth",
"=",
"NewSSAuthenticator",
"(",
"auth",
",",
"cmdLine",
".",
"Account",
")",
"\n",
"}",
"\n",
"client",
"=",
"New",
"(",
"cmdLine",
".",
"Host",
",",
"auth",
")",
"\n",
"}",
"else",
"if",
"cmdLine",
".",
"APIToken",
"!=",
"\"",
"\"",
"{",
"auth",
":=",
"NewInstanceAuthenticator",
"(",
"cmdLine",
".",
"APIToken",
",",
"cmdLine",
".",
"Account",
")",
"\n",
"if",
"ss",
"{",
"auth",
"=",
"NewSSAuthenticator",
"(",
"auth",
",",
"cmdLine",
".",
"Account",
")",
"\n",
"}",
"\n",
"client",
"=",
"New",
"(",
"cmdLine",
".",
"Host",
",",
"auth",
")",
"\n",
"}",
"else",
"if",
"cmdLine",
".",
"Username",
"!=",
"\"",
"\"",
"&&",
"cmdLine",
".",
"Password",
"!=",
"\"",
"\"",
"{",
"auth",
":=",
"NewBasicAuthenticator",
"(",
"cmdLine",
".",
"Username",
",",
"cmdLine",
".",
"Password",
",",
"cmdLine",
".",
"Account",
")",
"\n",
"if",
"ss",
"{",
"auth",
"=",
"NewSSAuthenticator",
"(",
"auth",
",",
"cmdLine",
".",
"Account",
")",
"\n",
"}",
"\n",
"client",
"=",
"New",
"(",
"cmdLine",
".",
"Host",
",",
"auth",
")",
"\n",
"}",
"else",
"{",
"// No auth, used by tests",
"client",
"=",
"New",
"(",
"cmdLine",
".",
"Host",
",",
"nil",
")",
"\n",
"httpclient",
".",
"Insecure",
"=",
"true",
"\n",
"}",
"\n",
"if",
"!",
"cmdLine",
".",
"ShowHelp",
"&&",
"!",
"cmdLine",
".",
"NoAuth",
"{",
"if",
"cmdLine",
".",
"OAuthToken",
"==",
"\"",
"\"",
"&&",
"cmdLine",
".",
"OAuthAccessToken",
"==",
"\"",
"\"",
"&&",
"cmdLine",
".",
"APIToken",
"==",
"\"",
"\"",
"&&",
"cmdLine",
".",
"Username",
"==",
"\"",
"\"",
"&&",
"!",
"cmdLine",
".",
"RL10",
"{",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"if",
"cmdLine",
".",
"Verbose",
"||",
"cmdLine",
".",
"Dump",
"==",
"\"",
"\"",
"{",
"httpclient",
".",
"DumpFormat",
"=",
"httpclient",
".",
"Debug",
"\n",
"}",
"\n",
"if",
"cmdLine",
".",
"Dump",
"==",
"\"",
"\"",
"{",
"httpclient",
".",
"DumpFormat",
"=",
"httpclient",
".",
"JSON",
"\n",
"}",
"\n",
"if",
"cmdLine",
".",
"Dump",
"==",
"\"",
"\"",
"{",
"httpclient",
".",
"DumpFormat",
"=",
"httpclient",
".",
"JSON",
"|",
"httpclient",
".",
"Record",
"\n",
"}",
"\n",
"if",
"cmdLine",
".",
"Verbose",
"{",
"httpclient",
".",
"DumpFormat",
"|=",
"httpclient",
".",
"Verbose",
"\n",
"}",
"\n",
"client",
".",
"FetchLocationResource",
"=",
"cmdLine",
".",
"FetchResource",
"\n",
"}",
"\n",
"return",
"client",
",",
"nil",
"\n",
"}"
] |
10,793 | all-10794 | [
"MarshalJSON",
"supports",
"json",
".",
"Marshaler",
"interface"
] | [
"func",
"(",
"v",
"TerminateExecutionParams",
")",
"MarshalJSON",
"(",
")",
"(",
"[",
"]",
"<mask>",
",",
"error",
")",
"{",
"w",
":=",
"jwriter",
".",
"Writer",
"{",
"}",
"\n",
"easyjsonC5a4559bEncodeGithubComChromedpCdprotoRuntime",
"(",
"&",
"w",
",",
"v",
")",
"\n",
"return",
"w",
".",
"Buffer",
".",
"BuildBytes",
"(",
")",
",",
"w",
".",
"Error",
"\n",
"}"
] |
10,794 | all-10795 | [
"doneReading",
"shuts",
"down",
"the",
"message",
"exchange",
"for",
"this",
"call",
".",
"For",
"outgoing",
"calls",
"the",
"last",
"message",
"is",
"reading",
"the",
"call",
"response",
"."
] | [
"func",
"(",
"response",
"*",
"OutboundCallResponse",
")",
"doneReading",
"(",
"unexpected",
"error",
")",
"{",
"now",
":=",
"response",
".",
"timeNow",
"(",
")",
"\n\n",
"isSuccess",
":=",
"unexpected",
"==",
"nil",
"&&",
"!",
"response",
".",
"ApplicationError",
"(",
")",
"\n",
"lastAttempt",
":=",
"isSuccess",
"||",
"!",
"response",
".",
"requestState",
".",
"HasRetries",
"(",
"unexpected",
")",
"\n\n",
"// TODO how should this work with retries?",
"if",
"<mask>",
":=",
"response",
".",
"span",
";",
"span",
"!=",
"nil",
"{",
"if",
"unexpected",
"!=",
"nil",
"{",
"span",
".",
"LogEventWithPayload",
"(",
"\"",
"\"",
",",
"unexpected",
")",
"\n",
"}",
"\n",
"if",
"!",
"isSuccess",
"&&",
"lastAttempt",
"{",
"ext",
".",
"Error",
".",
"Set",
"(",
"span",
",",
"true",
")",
"\n",
"}",
"\n",
"span",
".",
"FinishWithOptions",
"(",
"opentracing",
".",
"FinishOptions",
"{",
"FinishTime",
":",
"now",
"}",
")",
"\n",
"}",
"\n\n",
"latency",
":=",
"now",
".",
"Sub",
"(",
"response",
".",
"startedAt",
")",
"\n",
"response",
".",
"statsReporter",
".",
"RecordTimer",
"(",
"\"",
"\"",
",",
"response",
".",
"commonStatsTags",
",",
"latency",
")",
"\n",
"if",
"lastAttempt",
"{",
"requestLatency",
":=",
"response",
".",
"requestState",
".",
"SinceStart",
"(",
"now",
",",
"latency",
")",
"\n",
"response",
".",
"statsReporter",
".",
"RecordTimer",
"(",
"\"",
"\"",
",",
"response",
".",
"commonStatsTags",
",",
"requestLatency",
")",
"\n",
"}",
"\n",
"if",
"retryCount",
":=",
"response",
".",
"requestState",
".",
"RetryCount",
"(",
")",
";",
"retryCount",
">",
"0",
"{",
"retryTags",
":=",
"cloneTags",
"(",
"response",
".",
"commonStatsTags",
")",
"\n",
"retryTags",
"[",
"\"",
"\"",
"]",
"=",
"fmt",
".",
"Sprint",
"(",
"retryCount",
")",
"\n",
"response",
".",
"statsReporter",
".",
"IncCounter",
"(",
"\"",
"\"",
",",
"retryTags",
",",
"1",
")",
"\n",
"}",
"\n\n",
"if",
"unexpected",
"!=",
"nil",
"{",
"// TODO(prashant): Report the error code type as per metrics doc and enable.",
"// response.statsReporter.IncCounter(\"outbound.calls.system-errors\", response.commonStatsTags, 1)",
"}",
"else",
"if",
"response",
".",
"ApplicationError",
"(",
")",
"{",
"// TODO(prashant): Figure out how to add \"type\" to tags, which TChannel does not know about.",
"response",
".",
"statsReporter",
".",
"IncCounter",
"(",
"\"",
"\"",
",",
"response",
".",
"commonStatsTags",
",",
"1",
")",
"\n",
"if",
"lastAttempt",
"{",
"response",
".",
"statsReporter",
".",
"IncCounter",
"(",
"\"",
"\"",
",",
"response",
".",
"commonStatsTags",
",",
"1",
")",
"\n",
"}",
"\n",
"}",
"else",
"{",
"response",
".",
"statsReporter",
".",
"IncCounter",
"(",
"\"",
"\"",
",",
"response",
".",
"commonStatsTags",
",",
"1",
")",
"\n",
"}",
"\n\n",
"response",
".",
"mex",
".",
"shutdown",
"(",
")",
"\n",
"}"
] |
10,795 | all-10796 | [
"Add",
"adds",
"the",
"given",
"delta",
"to",
"the",
"waitgroup",
"at",
"the",
"given",
"sequence"
] | [
"func",
"(",
"s",
"*",
"SequentialWaitGroup",
")",
"Add",
"(",
"sequence",
"int64",
",",
"delta",
"int",
")",
"{",
"s",
".",
"mutex",
".",
"Lock",
"(",
")",
"\n",
"defer",
"s",
".",
"mutex",
".",
"Unlock",
"(",
")",
"\n\n",
"_",
",",
"ok",
":=",
"s",
".",
"semaphores",
"[",
"sequence",
"]",
"\n",
"if",
"ok",
"{",
"s",
".",
"semaphores",
"[",
"sequence",
"]",
"+=",
"delta",
"\n",
"}",
"else",
"{",
"s",
".",
"semaphores",
"[",
"sequence",
"]",
"=",
"delta",
"\n",
"}",
"\n",
"if",
"s",
".",
"semaphores",
"[",
"<mask>",
"]",
"<=",
"0",
"{",
"delete",
"(",
"s",
".",
"semaphores",
",",
"sequence",
")",
"\n",
"s",
".",
"change",
".",
"Broadcast",
"(",
")",
"\n",
"}",
"\n",
"}"
] |
10,796 | all-10797 | [
"/",
"*",
"To",
"the",
"land",
"of",
"Middle",
"-",
"ware",
"Earth",
":"
] | [
"func",
"Bind",
"(",
"obj",
"interface",
"{",
"}",
",",
"ifacePtr",
"...",
"interface",
"{",
"}",
")",
"martini",
".",
"Handler",
"{",
"return",
"func",
"(",
"context",
"martini",
".",
"Context",
",",
"req",
"*",
"http",
".",
"Request",
")",
"{",
"contentType",
":=",
"req",
".",
"Header",
".",
"Get",
"(",
"\"",
"\"",
")",
"\n\n",
"if",
"strings",
".",
"Contains",
"(",
"contentType",
",",
"\"",
"\"",
")",
"{",
"context",
".",
"Invoke",
"(",
"Form",
"(",
"obj",
",",
"ifacePtr",
"...",
")",
")",
"\n",
"}",
"else",
"if",
"strings",
".",
"Contains",
"(",
"contentType",
",",
"\"",
"\"",
")",
"{",
"context",
".",
"Invoke",
"(",
"MultipartForm",
"(",
"obj",
",",
"ifacePtr",
"...",
")",
")",
"\n",
"}",
"else",
"if",
"strings",
".",
"Contains",
"(",
"contentType",
",",
"\"",
"\"",
")",
"{",
"context",
".",
"Invoke",
"(",
"Json",
"(",
"obj",
",",
"ifacePtr",
"...",
")",
")",
"\n",
"}",
"else",
"{",
"context",
".",
"Invoke",
"(",
"Json",
"(",
"obj",
",",
"ifacePtr",
"...",
")",
")",
"\n",
"if",
"getErrors",
"(",
"context",
")",
".",
"Count",
"(",
")",
">",
"0",
"{",
"<mask>",
".",
"Invoke",
"(",
"Form",
"(",
"obj",
",",
"ifacePtr",
"...",
")",
")",
"\n",
"}",
"\n",
"}",
"\n\n",
"context",
".",
"Invoke",
"(",
"ErrorHandler",
")",
"\n",
"}",
"\n",
"}"
] |
10,797 | all-10798 | [
"ParseForwarded",
"parses",
"the",
"value",
"of",
"the",
"X",
"-",
"Forwarded",
"-",
"For",
"Header",
"and",
"returns",
"the",
"IP",
"address",
"."
] | [
"func",
"ParseForwarded",
"(",
"ipList",
"string",
")",
"string",
"{",
"for",
"_",
",",
"ip",
":=",
"range",
"strings",
".",
"Split",
"(",
"ipList",
",",
"\"",
"\"",
")",
"{",
"<mask>",
"=",
"strings",
".",
"TrimSpace",
"(",
"ip",
")",
"\n\n",
"if",
"parsed",
":=",
"net",
".",
"ParseIP",
"(",
"ip",
")",
";",
"parsed",
"!=",
"nil",
"&&",
"IsPublicIP",
"(",
"parsed",
")",
"{",
"return",
"ip",
"\n",
"}",
"\n",
"}",
"\n\n",
"return",
"\"",
"\"",
"\n",
"}"
] |
10,798 | all-10799 | [
"Specify",
"the",
"value",
"of",
"a",
"uniform",
"variable",
"for",
"a",
"specified",
"program",
"object"
] | [
"func",
"ProgramUniform2uiv",
"(",
"program",
"uint32",
",",
"location",
"int32",
",",
"count",
"int32",
",",
"value",
"*",
"uint32",
")",
"{",
"C",
".",
"glowProgramUniform2uiv",
"(",
"gpProgramUniform2uiv",
",",
"(",
"C",
".",
"GLuint",
")",
"(",
"program",
")",
",",
"(",
"C",
".",
"GLint",
")",
"(",
"location",
")",
",",
"(",
"C",
".",
"GLsizei",
")",
"(",
"<mask>",
")",
",",
"(",
"*",
"C",
".",
"GLuint",
")",
"(",
"unsafe",
".",
"Pointer",
"(",
"value",
")",
")",
")",
"\n",
"}"
] |
10,799 | all-10800 | [
"UnmarshalJSON",
"supports",
"json",
".",
"Unmarshaler",
"interface"
] | [
"func",
"(",
"v",
"*",
"ClearBrowserCacheParams",
")",
"UnmarshalJSON",
"(",
"<mask>",
"[",
"]",
"byte",
")",
"error",
"{",
"r",
":=",
"jlexer",
".",
"Lexer",
"{",
"Data",
":",
"data",
"}",
"\n",
"easyjsonC5a4559bDecodeGithubComChromedpCdprotoNetwork65",
"(",
"&",
"r",
",",
"v",
")",
"\n",
"return",
"r",
".",
"Error",
"(",
")",
"\n",
"}"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.