id
int32
0
25.3k
idx
stringlengths
5
9
nl_tokens
sequencelengths
1
418
pl_tokens
sequencelengths
22
4.98k
1,200
all-1201
[ "NewArgWriter", "wraps", "the", "result", "of", "calling", "ArgXWriter", "to", "provider", "a", "simpler", "interface", "for", "writing", "arguments", "." ]
[ "func", "NewArgWriter", "(", "writer", "io", ".", "WriteCloser", ",", "err", "error", ")", "ArgWriteHelper", "{", "return", "ArgWriteHelper", "{", "<mask>", ",", "err", "}", "\n", "}" ]
1,201
all-1202
[ "HasCustomUnit", "returns", "a", "boolean", "if", "a", "field", "has", "been", "set", "." ]
[ "func", "(", "q", "*", "QueryValueDefinition", ")", "HasCustomUnit", "(", ")", "bool", "{", "if", "q", "!=", "nil", "&&", "q", ".", "CustomUnit", "!=", "nil", "{", "return", "<mask>", "\n", "}", "\n\n", "return", "false", "\n", "}" ]
1,202
all-1203
[ "Debugf", "outputs", "formatted", "Debug", "level", "log" ]
[ "func", "Debugf", "(", "format", "string", ",", "val", "...", "interface", "{", "}", ")", "error", "{", "return", "glg", ".", "<mask>", "(", "DEBG", ",", "format", ",", "val", "...", ")", "\n", "}" ]
1,203
all-1204
[ "Render", "loads", "the", "template", "specified", "by", "the", "given", "name", "string", ".", "By", "default", "Xslate", "looks", "for", "files", "in", "the", "local", "file", "system", "and", "caches", "the", "generated", "bytecode", "too", ".", "If", "you", "wish", "to", "for", "example", "load", "the", "templates", "from", "a", "database", "you", "can", "change", "the", "generated", "loader", "object", "by", "providing", "a", "ConfigureLoader", "parameter", "in", "the", "xslate", ".", "New", "()", "function", ":", "xslate", ".", "New", "(", "Args", "{", "ConfigureLoader", ":", "func", "(", "tx", "*", "Xslate", "args", "Args", ")", "{", "tx", ".", "Loader", "=", "....", "//", "your", "custom", "loader", "}", "}", ")", "Render", "()", "returns", "the", "resulting", "text", "from", "processing", "the", "template", ".", "err", "is", "nil", "on", "success", "otherwise", "it", "contains", "an", "error", "value", "." ]
[ "func", "(", "tx", "Xslate", ")", "Render", "(", "name", "string", ",", "vars", "Vars", ")", "(", "string", ",", "error", ")", "{", "buf", ":=", "rbpool", ".", "Get", "(", ")", "\n", "defer", "rbpool", ".", "Release", "(", "buf", ")", "\n\n", "err", ":=", "tx", ".", "RenderInto", "(", "buf", ",", "name", ",", "vars", ")", "\n", "if", "err", "!=", "nil", "{", "return", "\"", "\"", ",", "<mask>", ".", "Wrap", "(", "err", ",", "\"", "\"", ")", "\n", "}", "\n\n", "return", "buf", ".", "String", "(", ")", ",", "nil", "\n", "}" ]
1,204
all-1205
[ "IterateForward", "-", "iterate", "over", "hole", "stack", "segment", "-", "by", "-", "segment", "from", "begining", "to", "end", ".", "If", "all", "segments", "iterated", "stack", "may", "be", "repaired" ]
[ "func", "(", "s", "*", "Stack", ")", "IterateForward", "(", "handler", "func", "(", "depth", "int", ",", "header", "io", ".", "Reader", ",", "body", "io", ".", "Reader", ")", "bool", ")", "error", "{", "// This operation does not relies on depth counter, so can be used for repare", "s", ".", "guard", ".", "Lock", "(", ")", "\n", "defer", "s", ".", "guard", ".", "Unlock", "(", ")", "\n", "s", ".", "lastAccess", "=", "time", ".", "Now", "(", ")", "\n", "file", ",", "err", ":=", "s", ".", "getFile", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "//Get file size", "fileSize", ",", "err", ":=", "file", ".", "Seek", "(", "0", ",", "os", ".", "SEEK_END", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "_", ",", "err", "=", "<mask>", ".", "Seek", "(", "0", ",", "os", ".", "SEEK_SET", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "defer", "file", ".", "Seek", "(", "0", ",", "os", ".", "SEEK_END", ")", "\n", "var", "(", "currentBlock", "fileBlock", "// Current block description", "\n", "currentBlockOffset", "uint64", "// Current block offset from begining of file", "\n", ")", "\n", "var", "depth", "int", "\n", "for", "currentBlock", ".", "NextBlockPoint", "(", ")", "<", "fileSize", "{", "newPos", ":=", "currentBlock", ".", "NextBlockPoint", "(", ")", "\n", "if", "newPos", ">", "fileSize", "{", "log", ".", "Println", "(", "\"", "\"", ",", "currentBlockOffset", ",", "\"", "\"", ")", "\n", "file", ".", "Truncate", "(", "int64", "(", "currentBlockOffset", ")", ")", "\n", "break", "\n", "}", "\n", "block", ",", "err", ":=", "readBlockAt", "(", "file", ",", "newPos", ")", "\n", "// Non-full meta-info?", "if", "err", "==", "io", ".", "EOF", "{", "log", ".", "Println", "(", "\"", "\"", ",", "newPos", ",", "\"", "\"", ")", "\n", "file", ".", "Truncate", "(", "newPos", ")", "\n", "break", "\n", "}", "\n", "// I/O error", "if", "err", "!=", "nil", "{", "log", ".", "Println", "(", "\"", "\"", ",", "newPos", ")", "\n", "return", "err", "\n", "}", "\n", "// Check back-ref", "if", "block", ".", "PrevBlock", "!=", "currentBlockOffset", "{", "log", ".", "Println", "(", "\"", "\"", ",", "block", ".", "PrevBlock", ",", "\"", "\"", ",", "currentBlockOffset", ",", "\"", "\"", ")", "\n", "block", ".", "PrevBlock", "=", "currentBlockOffset", "\n", "block", ".", "writeTo", "(", "file", ",", "newPos", ")", "\n", "}", "\n", "// Update current state", "currentBlockOffset", "=", "uint64", "(", "newPos", ")", "\n", "currentBlock", "=", "block", "\n", "body", ":=", "io", ".", "NewSectionReader", "(", "file", ",", "int64", "(", "currentBlock", ".", "DataPoint", ")", ",", "int64", "(", "currentBlock", ".", "DataSize", ")", ")", "\n", "header", ":=", "io", ".", "NewSectionReader", "(", "file", ",", "int64", "(", "currentBlock", ".", "HeaderPoint", ")", ",", "int64", "(", "currentBlock", ".", "HeaderSize", ")", ")", "\n", "// invoke block processor", "if", "handler", "!=", "nil", "&&", "!", "handler", "(", "depth", ",", "header", ",", "body", ")", "{", "return", "nil", "\n", "}", "\n", "depth", "++", "\n", "}", "\n", "s", ".", "depth", "=", "depth", "\n", "s", ".", "currentBlock", "=", "currentBlock", "\n", "s", ".", "currentBlockPos", "=", "int64", "(", "currentBlockOffset", ")", "\n", "return", "nil", "\n", "}" ]
1,205
all-1206
[ "Parse", "parses", "the", "given", "template", "and", "creates", "an", "AST" ]
[ "func", "(", "p", "*", "Kolonish", ")", "Parse", "(", "<mask>", "string", ",", "template", "[", "]", "byte", ")", "(", "*", "parser", ".", "AST", ",", "error", ")", "{", "return", "p", ".", "ParseString", "(", "name", ",", "string", "(", "template", ")", ")", "\n", "}" ]
1,206
all-1207
[ "bind", "an", "existing", "texture", "object", "to", "the", "specified", "texture", "unit" ]
[ "func", "BindTextureUnit", "(", "unit", "uint32", ",", "texture", "uint32", ")", "{", "syscall", ".", "Syscall", "(", "gpBindTextureUnit", ",", "2", ",", "uintptr", "(", "<mask>", ")", ",", "uintptr", "(", "texture", ")", ",", "0", ")", "\n", "}" ]
1,207
all-1208
[ "GetHideValueOk", "returns", "a", "tuple", "with", "the", "HideValue", "field", "if", "it", "s", "non", "-", "nil", "zero", "value", "otherwise", "and", "a", "boolean", "to", "check", "if", "the", "value", "has", "been", "set", "." ]
[ "func", "(", "w", "*", "WidgetConditionalFormat", ")", "GetHideValueOk", "(", ")", "(", "bool", ",", "bool", ")", "{", "if", "w", "==", "nil", "||", "w", ".", "HideValue", "==", "nil", "{", "return", "false", ",", "<mask>", "\n", "}", "\n", "return", "*", "w", ".", "HideValue", ",", "true", "\n", "}" ]
1,208
all-1209
[ "Rename", "the", "label", "(", "will", "also", "update", "color", ")" ]
[ "func", "rename", "(", "repo", "string", ",", "previous", ",", "wanted", "Label", ")", "Update", "{", "logrus", ".", "WithField", "(", "\"", "\"", ",", "repo", ")", ".", "WithField", "(", "\"", "\"", ",", "previous", ".", "<mask>", ")", ".", "WithField", "(", "\"", "\"", ",", "wanted", ".", "Name", ")", ".", "Info", "(", "\"", "\"", ")", "\n", "return", "Update", "{", "Why", ":", "\"", "\"", ",", "Current", ":", "&", "previous", ",", "Wanted", ":", "&", "wanted", ",", "repo", ":", "repo", "}", "\n", "}" ]
1,209
all-1210
[ "SetVertexBytes", "sets", "a", "block", "of", "data", "for", "the", "vertex", "function", ".", "Reference", ":", "https", ":", "//", "developer", ".", "apple", ".", "com", "/", "documentation", "/", "metal", "/", "mtlrendercommandencoder", "/", "1515846", "-", "setvertexbytes", "." ]
[ "func", "(", "rce", "RenderCommandEncoder", ")", "SetVertexBytes", "(", "<mask>", "unsafe", ".", "Pointer", ",", "length", "uintptr", ",", "index", "int", ")", "{", "C", ".", "RenderCommandEncoder_SetVertexBytes", "(", "rce", ".", "commandEncoder", ",", "bytes", ",", "C", ".", "size_t", "(", "length", ")", ",", "C", ".", "uint_t", "(", "index", ")", ")", "\n", "}" ]
1,210
all-1211
[ "IsKeyPressed", "returns", "a", "boolean", "indicating", "whether", "key", "is", "pressed", ".", "Known", "issue", ":", "On", "Edge", "browser", "some", "keys", "don", "t", "work", "well", ":", "-", "KeyKPEnter", "and", "KeyKPEqual", "are", "recognized", "as", "KeyEnter", "and", "KeyEqual", ".", "-", "KeyPrintScreen", "is", "only", "treated", "at", "keyup", "event", ".", "IsKeyPressed", "is", "concurrent", "-", "safe", "." ]
[ "func", "IsKeyPressed", "(", "key", "Key", ")", "bool", "{", "return", "uiDriver", "(", ")", ".", "Input", "(", ")", ".", "IsKeyPressed", "(", "driver", ".", "Key", "(", "<mask>", ")", ")", "\n", "}" ]
1,211
all-1212
[ "Deref", "loads", "from", "a", "pointer", ".", "r", "must", "contain", "a", "pointer", "." ]
[ "func", "(", "r", "region", ")", "Deref", "(", ")", "<mask>", "{", "if", "r", ".", "typ", ".", "Kind", "!=", "KindPtr", "{", "panic", "(", "\"", "\"", "+", "r", ".", "typ", ".", "Name", ")", "\n", "}", "\n", "if", "r", ".", "typ", ".", "Elem", "==", "nil", "{", "panic", "(", "\"", "\"", ")", "\n", "}", "\n", "p", ":=", "r", ".", "p", ".", "proc", ".", "ReadPtr", "(", "r", ".", "a", ")", "\n", "return", "region", "{", "p", ":", "r", ".", "p", ",", "a", ":", "p", ",", "typ", ":", "r", ".", "typ", ".", "Elem", "}", "\n", "}" ]
1,212
all-1213
[ "Paint", "satisfies", "the", "Painter", "interface", "by", "painting", "ss", "onto", "an", "image", ".", "RGBA", "." ]
[ "func", "(", "p", "*", "Painter", ")", "Paint", "(", "ss", "[", "]", "raster", ".", "Span", ",", "done", "bool", ")", "{", "//gl.Begin(gl.LINES)", "sslen", ":=", "len", "(", "ss", ")", "\n", "clenrequired", ":=", "sslen", "*", "8", "\n", "vlenrequired", ":=", "sslen", "*", "4", "\n", "if", "clenrequired", ">=", "(", "cap", "(", "p", ".", "colors", ")", "-", "len", "(", "p", ".", "colors", ")", ")", "{", "p", ".", "Flush", "(", ")", "\n\n", "if", "clenrequired", ">=", "cap", "(", "p", ".", "colors", ")", "{", "p", ".", "vertices", "=", "make", "(", "[", "]", "int32", ",", "0", ",", "vlenrequired", "+", "(", "vlenrequired", "/", "2", ")", ")", "\n", "p", ".", "colors", "=", "make", "(", "[", "]", "uint8", ",", "0", ",", "clenrequired", "+", "(", "clenrequired", "/", "2", ")", ")", "\n", "}", "\n", "}", "\n", "vi", ":=", "len", "(", "p", ".", "vertices", ")", "\n", "ci", ":=", "len", "(", "p", ".", "colors", ")", "\n", "p", ".", "vertices", "=", "p", ".", "vertices", "[", "0", ":", "vi", "+", "vlenrequired", "]", "\n", "p", ".", "colors", "=", "p", ".", "colors", "[", "0", ":", "ci", "+", "clenrequired", "]", "\n", "var", "(", "colors", "[", "]", "uint8", "\n", "vertices", "[", "]", "int32", "\n", ")", "\n", "for", "_", ",", "s", ":=", "range", "<mask>", "{", "a", ":=", "uint8", "(", "(", "s", ".", "Alpha", "*", "p", ".", "ca", "/", "M16", ")", ">>", "8", ")", "\n\n", "colors", "=", "p", ".", "colors", "[", "ci", ":", "]", "\n", "colors", "[", "0", "]", "=", "p", ".", "cr", "\n", "colors", "[", "1", "]", "=", "p", ".", "cg", "\n", "colors", "[", "2", "]", "=", "p", ".", "cb", "\n", "colors", "[", "3", "]", "=", "a", "\n", "colors", "[", "4", "]", "=", "p", ".", "cr", "\n", "colors", "[", "5", "]", "=", "p", ".", "cg", "\n", "colors", "[", "6", "]", "=", "p", ".", "cb", "\n", "colors", "[", "7", "]", "=", "a", "\n", "ci", "+=", "8", "\n", "vertices", "=", "p", ".", "vertices", "[", "vi", ":", "]", "\n", "vertices", "[", "0", "]", "=", "int32", "(", "s", ".", "X0", ")", "\n", "vertices", "[", "1", "]", "=", "int32", "(", "s", ".", "Y", ")", "\n", "vertices", "[", "2", "]", "=", "int32", "(", "s", ".", "X1", ")", "\n", "vertices", "[", "3", "]", "=", "int32", "(", "s", ".", "Y", ")", "\n", "vi", "+=", "4", "\n", "}", "\n", "}" ]
1,213
all-1214
[ "GetTaskENI", "returns", "the", "eni", "of", "task", "for", "now", "task", "can", "only", "have", "one", "enis" ]
[ "func", "(", "task", "*", "<mask>", ")", "GetTaskENI", "(", ")", "*", "apieni", ".", "ENI", "{", "task", ".", "lock", ".", "RLock", "(", ")", "\n", "defer", "task", ".", "lock", ".", "RUnlock", "(", ")", "\n\n", "return", "task", ".", "ENI", "\n", "}" ]
1,214
all-1215
[ "ConnectLXDUnix", "lets", "you", "connect", "to", "a", "remote", "LXD", "daemon", "over", "a", "local", "unix", "socket", ".", "If", "the", "path", "argument", "is", "empty", "then", "$LXD_SOCKET", "will", "be", "used", "if", "unset", "$LXD_DIR", "/", "unix", ".", "socket", "will", "be", "used", "and", "if", "that", "one", "isn", "t", "set", "either", "then", "the", "path", "will", "default", "to", "/", "var", "/", "lib", "/", "lxd", "/", "unix", ".", "socket", "." ]
[ "func", "ConnectLXDUnix", "(", "path", "string", ",", "args", "*", "ConnectionArgs", ")", "(", "ContainerServer", ",", "error", ")", "{", "logger", ".", "Debugf", "(", "\"", "\"", ")", "\n\n", "// Use empty args if not specified", "if", "args", "==", "nil", "{", "args", "=", "&", "ConnectionArgs", "{", "}", "\n", "}", "\n\n", "// Initialize the client struct", "server", ":=", "ProtocolLXD", "{", "httpHost", ":", "\"", "\"", ",", "httpUnixPath", ":", "path", ",", "httpProtocol", ":", "\"", "\"", ",", "httpUserAgent", ":", "args", ".", "UserAgent", ",", "}", "\n\n", "// Determine the socket path", "if", "path", "==", "\"", "\"", "{", "path", "=", "os", ".", "Getenv", "(", "\"", "\"", ")", "\n", "if", "path", "==", "\"", "\"", "{", "lxdDir", ":=", "os", ".", "Getenv", "(", "\"", "\"", ")", "\n", "if", "lxdDir", "==", "\"", "\"", "{", "lxdDir", "=", "\"", "\"", "\n", "}", "\n\n", "path", "=", "filepath", ".", "Join", "(", "lxdDir", ",", "\"", "\"", ")", "\n", "}", "\n", "}", "\n\n", "// Setup the HTTP client", "httpClient", ",", "err", ":=", "unixHTTPClient", "(", "args", ".", "HTTPClient", ",", "path", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "server", ".", "<mask>", "=", "httpClient", "\n\n", "// Test the connection and seed the server information", "if", "!", "args", ".", "SkipGetServer", "{", "serverStatus", ",", "_", ",", "err", ":=", "server", ".", "GetServer", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "// Record the server certificate", "server", ".", "httpCertificate", "=", "serverStatus", ".", "Environment", ".", "Certificate", "\n", "}", "\n\n", "return", "&", "server", ",", "nil", "\n", "}" ]
1,215
all-1216
[ "SelectStrings", "executes", "a", "statement", "which", "must", "yield", "rows", "with", "a", "single", "string", "column", ".", "It", "returns", "the", "list", "of", "column", "values", "." ]
[ "func", "SelectStrings", "(", "tx", "*", "sql", ".", "Tx", ",", "query", "string", ",", "args", "...", "interface", "{", "}", ")", "(", "[", "]", "string", ",", "error", ")", "{", "values", ":=", "[", "]", "string", "{", "}", "\n", "scan", ":=", "func", "(", "rows", "*", "sql", ".", "Rows", ")", "error", "{", "<mask>", "value", "string", "\n", "err", ":=", "rows", ".", "Scan", "(", "&", "value", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "values", "=", "append", "(", "values", ",", "value", ")", "\n", "return", "nil", "\n", "}", "\n\n", "err", ":=", "scanSingleColumn", "(", "tx", ",", "query", ",", "args", ",", "\"", "\"", ",", "scan", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "return", "values", ",", "nil", "\n", "}" ]
1,216
all-1217
[ "UnmarshalEasyJSON", "satisfies", "easyjson", ".", "Unmarshaler", "." ]
[ "func", "(", "t", "*", "MediaSource", ")", "UnmarshalEasyJSON", "(", "<mask>", "*", "jlexer", ".", "Lexer", ")", "{", "switch", "MediaSource", "(", "in", ".", "String", "(", ")", ")", "{", "case", "MediaSourceMediaRule", ":", "*", "t", "=", "MediaSourceMediaRule", "\n", "case", "MediaSourceImportRule", ":", "*", "t", "=", "MediaSourceImportRule", "\n", "case", "MediaSourceLinkedSheet", ":", "*", "t", "=", "MediaSourceLinkedSheet", "\n", "case", "MediaSourceInlineSheet", ":", "*", "t", "=", "MediaSourceInlineSheet", "\n\n", "default", ":", "in", ".", "AddError", "(", "errors", ".", "New", "(", "\"", "\"", ")", ")", "\n", "}", "\n", "}" ]
1,217
all-1218
[ "MarshalEasyJSON", "writes", "the", "MAC", "to", "a", "easyjson", ".", "Writer" ]
[ "func", "(", "u", "MAC", ")", "MarshalEasyJSON", "(", "w", "*", "jwriter", ".", "Writer", ")", "{", "w", ".", "<mask>", "(", "string", "(", "u", ")", ")", "\n", "}" ]
1,218
all-1219
[ "EmbedConfig", "returns", "etcd", "embed", ".", "Config", "." ]
[ "func", "(", "e", "*", "Etcd", ")", "EmbedConfig", "(", ")", "(", "cfg", "*", "embed", ".", "Config", ",", "err", "error", ")", "{", "var", "lcURLs", "types", ".", "URLs", "\n", "lcURLs", ",", "err", "=", "types", ".", "NewURLs", "(", "e", ".", "ListenClientURLs", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "var", "acURLs", "types", ".", "URLs", "\n", "acURLs", ",", "err", "=", "types", ".", "NewURLs", "(", "e", ".", "AdvertiseClientURLs", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "var", "lpURLs", "types", ".", "URLs", "\n", "lpURLs", ",", "err", "=", "types", ".", "NewURLs", "(", "e", ".", "ListenPeerURLs", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "<mask>", "apURLs", "types", ".", "URLs", "\n", "apURLs", ",", "err", "=", "types", ".", "NewURLs", "(", "e", ".", "AdvertisePeerURLs", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "cfg", "=", "embed", ".", "NewConfig", "(", ")", "\n", "cfg", ".", "Name", "=", "e", ".", "Name", "\n", "cfg", ".", "Dir", "=", "e", ".", "DataDir", "\n", "cfg", ".", "WalDir", "=", "e", ".", "WALDir", "\n", "cfg", ".", "TickMs", "=", "uint", "(", "e", ".", "HeartbeatIntervalMs", ")", "\n", "cfg", ".", "ElectionMs", "=", "uint", "(", "e", ".", "ElectionTimeoutMs", ")", "\n\n", "cfg", ".", "LCUrls", "=", "lcURLs", "\n", "cfg", ".", "ACUrls", "=", "acURLs", "\n", "cfg", ".", "ClientAutoTLS", "=", "e", ".", "ClientAutoTLS", "\n", "cfg", ".", "ClientTLSInfo", "=", "transport", ".", "TLSInfo", "{", "ClientCertAuth", ":", "e", ".", "ClientCertAuth", ",", "CertFile", ":", "e", ".", "ClientCertFile", ",", "KeyFile", ":", "e", ".", "ClientKeyFile", ",", "TrustedCAFile", ":", "e", ".", "ClientTrustedCAFile", ",", "}", "\n\n", "cfg", ".", "LPUrls", "=", "lpURLs", "\n", "cfg", ".", "APUrls", "=", "apURLs", "\n", "cfg", ".", "PeerAutoTLS", "=", "e", ".", "PeerAutoTLS", "\n", "cfg", ".", "PeerTLSInfo", "=", "transport", ".", "TLSInfo", "{", "ClientCertAuth", ":", "e", ".", "PeerClientCertAuth", ",", "CertFile", ":", "e", ".", "PeerCertFile", ",", "KeyFile", ":", "e", ".", "PeerKeyFile", ",", "TrustedCAFile", ":", "e", ".", "PeerTrustedCAFile", ",", "}", "\n\n", "cfg", ".", "InitialCluster", "=", "e", ".", "InitialCluster", "\n", "cfg", ".", "ClusterState", "=", "e", ".", "InitialClusterState", "\n", "cfg", ".", "InitialClusterToken", "=", "e", ".", "InitialClusterToken", "\n\n", "cfg", ".", "SnapshotCount", "=", "uint64", "(", "e", ".", "SnapshotCount", ")", "\n", "cfg", ".", "QuotaBackendBytes", "=", "e", ".", "QuotaBackendBytes", "\n\n", "cfg", ".", "PreVote", "=", "e", ".", "PreVote", "\n", "cfg", ".", "ExperimentalInitialCorruptCheck", "=", "e", ".", "InitialCorruptCheck", "\n\n", "cfg", ".", "Logger", "=", "e", ".", "Logger", "\n", "cfg", ".", "LogOutputs", "=", "e", ".", "LogOutputs", "\n", "cfg", ".", "Debug", "=", "e", ".", "Debug", "\n\n", "return", "cfg", ",", "nil", "\n", "}" ]
1,219
all-1220
[ "Deserialize", "deserializes", "a", "hashtree", "." ]
[ "func", "(", "h", "*", "dbHashTree", ")", "Deserialize", "(", "_r", "io", ".", "Reader", ")", "error", "{", "r", ":=", "pbutil", ".", "NewReader", "(", "_r", ")", "\n", "hdr", ":=", "&", "BucketHeader", "{", "}", "\n", "batchSize", ":=", "10000", "\n\n", "kvs", ":=", "make", "(", "chan", "*", "keyValue", ",", "batchSize", "/", "10", ")", "\n", "// create cancellable ctx in case bolt writer encounters error", "eg", ",", "copyCtx", ":=", "errgroup", ".", "WithContext", "(", "context", ".", "Background", "(", ")", ")", "\n", "eg", ".", "Go", "(", "func", "(", ")", "error", "{", "var", "bucket", "[", "]", "byte", "\n", "for", "{", "count", ":=", "0", "\n", "if", "err", ":=", "h", ".", "Update", "(", "func", "(", "tx", "*", "bolt", ".", "Tx", ")", "error", "{", "if", "bucket", "!=", "nil", "{", "tx", ".", "Bucket", "(", "bucket", ")", ".", "FillPercent", "=", "1", "\n", "}", "\n", "for", "kv", ":=", "range", "kvs", "{", "if", "kv", ".", "k", "==", "nil", "{", "bucket", "=", "kv", ".", "v", "\n", "continue", "\n", "}", "\n", "if", "err", ":=", "tx", ".", "Bucket", "(", "bucket", ")", ".", "Put", "(", "kv", ".", "k", ",", "kv", ".", "v", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "<mask>", "++", "\n", "if", "count", ">=", "batchSize", "{", "return", "nil", "\n", "}", "\n", "}", "\n", "return", "nil", "\n", "}", ")", ";", "err", "!=", "nil", "||", "copyCtx", ".", "Err", "(", ")", "!=", "nil", "{", "return", "err", "// may return nil if copyCtx was closed", "\n", "}", "\n", "if", "count", "<=", "0", "{", "return", "nil", "\n", "}", "\n", "}", "\n", "}", ")", "\n", "eg", ".", "Go", "(", "func", "(", ")", "error", "{", "defer", "close", "(", "kvs", ")", "\n", "for", "{", "hdr", ".", "Reset", "(", ")", "\n", "// TODO(msteffen): don't block on Read if copyCtx() is cancelled?", "if", "err", ":=", "r", ".", "Read", "(", "hdr", ")", ";", "err", "!=", "nil", "{", "if", "err", "==", "io", ".", "EOF", "{", "break", "\n", "}", "\n", "return", "err", "\n", "}", "\n", "bucket", ":=", "b", "(", "hdr", ".", "Bucket", ")", "\n", "select", "{", "case", "kvs", "<-", "&", "keyValue", "{", "nil", ",", "bucket", "}", ":", "case", "<-", "copyCtx", ".", "Done", "(", ")", ":", "return", "nil", "\n", "}", "\n", "for", "{", "_k", ",", "err", ":=", "r", ".", "ReadBytes", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "if", "bytes", ".", "Equal", "(", "_k", ",", "SentinelByte", ")", "{", "break", "\n", "}", "\n", "// we need to make copies of k and v because the memory will be reused", "k", ":=", "make", "(", "[", "]", "byte", ",", "len", "(", "_k", ")", ")", "\n", "copy", "(", "k", ",", "_k", ")", "\n", "_v", ",", "err", ":=", "r", ".", "ReadBytes", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "v", ":=", "make", "(", "[", "]", "byte", ",", "len", "(", "_v", ")", ")", "\n", "copy", "(", "v", ",", "_v", ")", "\n", "select", "{", "case", "kvs", "<-", "&", "keyValue", "{", "k", ",", "v", "}", ":", "case", "<-", "copyCtx", ".", "Done", "(", ")", ":", "return", "nil", "\n", "}", "\n", "}", "\n", "}", "\n", "return", "nil", "\n", "}", ")", "\n", "return", "eg", ".", "Wait", "(", ")", "\n", "}" ]
1,220
all-1221
[ "UnmarshalJSON", "supports", "json", ".", "Unmarshaler", "interface" ]
[ "func", "(", "v", "*", "GetStackTraceParams", ")", "UnmarshalJSON", "(", "data", "[", "]", "<mask>", ")", "error", "{", "r", ":=", "jlexer", ".", "Lexer", "{", "Data", ":", "data", "}", "\n", "easyjsonC5a4559bDecodeGithubComChromedpCdprotoDebugger32", "(", "&", "r", ",", "v", ")", "\n", "return", "r", ".", "Error", "(", ")", "\n", "}" ]
1,221
all-1222
[ "viewportSize", "must", "be", "called", "from", "the", "main", "thread", "." ]
[ "func", "(", "i", "*", "Image", ")", "viewportSize", "(", ")", "(", "int", ",", "int", ")", "{", "if", "i", ".", "screen", "{", "return", "i", ".", "<mask>", ",", "i", ".", "height", "\n", "}", "\n", "return", "graphics", ".", "InternalImageSize", "(", "i", ".", "width", ")", ",", "graphics", ".", "InternalImageSize", "(", "i", ".", "height", ")", "\n", "}" ]
1,222
all-1223
[ "HaveCSS", "passes", "when", "the", "expected", "CSS", "property", "and", "value", "are", "present", "on", "the", "element", ".", "This", "matcher", "only", "matches", "exact", "calculated", "CSS", "values", "though", "there", "is", "support", "for", "parsing", "colors", ".", "Example", ":", "blue", "and", "#00f", "will", "both", "match", "rgba", "(", "0", "0", "255", "1", ")", "This", "matcher", "will", "fail", "if", "the", "provided", "selection", "refers", "to", "more", "than", "one", "element", "." ]
[ "func", "HaveCSS", "(", "property", "string", ",", "value", "string", ")", "types", ".", "GomegaMatcher", "{", "return", "&", "<mask>", ".", "HaveCSSMatcher", "{", "ExpectedProperty", ":", "property", ",", "ExpectedValue", ":", "value", "}", "\n", "}" ]
1,223
all-1224
[ "Stability", ":", "***", "EXPERIMENTAL", "***", "Get", "a", "worker", "from", "a", "worker", "-", "type", ".", "See", "#getWorker" ]
[ "func", "(", "<mask>", "*", "Queue", ")", "GetWorker", "(", "provisionerId", ",", "workerType", ",", "workerGroup", ",", "workerId", "string", ")", "(", "*", "WorkerResponse", ",", "error", ")", "{", "cd", ":=", "tcclient", ".", "Client", "(", "*", "queue", ")", "\n", "responseObject", ",", "_", ",", "err", ":=", "(", "&", "cd", ")", ".", "APICall", "(", "nil", ",", "\"", "\"", ",", "\"", "\"", "+", "url", ".", "QueryEscape", "(", "provisionerId", ")", "+", "\"", "\"", "+", "url", ".", "QueryEscape", "(", "workerType", ")", "+", "\"", "\"", "+", "url", ".", "QueryEscape", "(", "workerGroup", ")", "+", "\"", "\"", "+", "url", ".", "QueryEscape", "(", "workerId", ")", ",", "new", "(", "WorkerResponse", ")", ",", "nil", ")", "\n", "return", "responseObject", ".", "(", "*", "WorkerResponse", ")", ",", "err", "\n", "}" ]
1,224
all-1225
[ "Strs", "takes", "a", "list", "of", "Go", "strings", "(", "with", "or", "without", "null", "-", "termination", ")", "and", "returns", "their", "C", "counterpart", ".", "The", "returned", "free", "function", "must", "be", "called", "once", "you", "are", "done", "using", "the", "strings", "in", "order", "to", "free", "the", "memory", ".", "If", "no", "strings", "are", "provided", "as", "a", "parameter", "this", "function", "will", "panic", "." ]
[ "func", "Strs", "(", "strs", "...", "string", ")", "(", "cstrs", "*", "*", "uint8", ",", "free", "func", "(", ")", ")", "{", "if", "len", "(", "strs", ")", "==", "0", "{", "panic", "(", "\"", "\"", ")", "\n", "}", "\n\n", "var", "pinned", "[", "]", "string", "\n", "var", "ptrs", "[", "]", "*", "uint8", "\n", "for", "_", ",", "str", ":=", "range", "strs", "{", "if", "!", "strings", ".", "HasSuffix", "(", "str", ",", "\"", "\\x00", "\"", ")", "{", "str", "+=", "\"", "\\x00", "\"", "\n", "}", "\n", "pinned", "=", "append", "(", "pinned", ",", "str", ")", "\n", "ptrs", "=", "<mask>", "(", "ptrs", ",", "Str", "(", "str", ")", ")", "\n", "}", "\n\n", "return", "&", "ptrs", "[", "0", "]", ",", "func", "(", ")", "{", "runtime", ".", "KeepAlive", "(", "pinned", ")", "\n", "pinned", "=", "nil", "\n", "}", "\n", "}" ]
1,225
all-1226
[ "expandClusterProactiveDrsConfigInfo", "reads", "certain", "ResourceData", "keys", "and", "returns", "a", "ClusterProactiveDrsConfigInfo", "." ]
[ "func", "expandClusterProactiveDrsConfigInfo", "(", "d", "*", "schema", ".", "ResourceData", ")", "*", "types", ".", "ClusterProactiveDrsConfigInfo", "{", "obj", ":=", "&", "<mask>", ".", "ClusterProactiveDrsConfigInfo", "{", "Enabled", ":", "structure", ".", "GetBool", "(", "d", ",", "\"", "\"", ")", ",", "}", "\n\n", "return", "obj", "\n", "}" ]
1,226
all-1227
[ "native", "returns", "a", "pointer", "to", "the", "underlying", "GObject", "as", "a", "GtkNativeDialog", "." ]
[ "func", "(", "v", "*", "NativeDialog", ")", "native", "(", ")", "*", "C", ".", "GtkNativeDialog", "{", "if", "v", "==", "nil", "||", "v", ".", "GObject", "==", "nil", "{", "return", "nil", "\n", "}", "\n", "p", ":=", "unsafe", ".", "Pointer", "(", "v", ".", "GObject", ")", "\n", "<mask>", "C", ".", "toGtkNativeDialog", "(", "p", ")", "\n", "}" ]
1,227
all-1228
[ "ContainerCreate", "adds", "a", "new", "container", "to", "the", "database", "." ]
[ "func", "(", "c", "*", "ClusterTx", ")", "ContainerCreate", "(", "object", "Container", ")", "(", "int64", ",", "error", ")", "{", "// Check if a container with the same key exists.", "exists", ",", "err", ":=", "c", ".", "ContainerExists", "(", "object", ".", "Project", ",", "object", ".", "Name", ")", "\n", "if", "err", "!=", "nil", "{", "return", "-", "1", ",", "errors", ".", "Wrap", "(", "err", ",", "\"", "\"", ")", "\n", "}", "\n", "if", "exists", "{", "return", "-", "1", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ")", "\n", "}", "\n\n", "args", ":=", "make", "(", "[", "]", "interface", "{", "}", ",", "11", ")", "\n\n", "// Populate the statement arguments.", "args", "[", "0", "]", "=", "object", ".", "Project", "\n", "args", "[", "1", "]", "=", "object", ".", "Name", "\n", "args", "[", "2", "]", "=", "object", ".", "Node", "\n", "args", "[", "3", "]", "=", "object", ".", "Type", "\n", "args", "[", "4", "]", "=", "object", ".", "Architecture", "\n", "args", "[", "5", "]", "=", "object", ".", "Ephemeral", "\n", "args", "[", "6", "]", "=", "object", ".", "CreationDate", "\n", "args", "[", "7", "]", "=", "object", ".", "Stateful", "\n", "args", "[", "8", "]", "=", "object", ".", "LastUseDate", "\n", "args", "[", "9", "]", "=", "object", ".", "Description", "\n", "args", "[", "10", "]", "=", "object", ".", "ExpiryDate", "\n\n", "// Prepared statement to use.", "stmt", ":=", "c", ".", "stmt", "(", "containerCreate", ")", "\n\n", "// Execute the statement.", "<mask>", ",", "err", ":=", "stmt", ".", "Exec", "(", "args", "...", ")", "\n", "if", "err", "!=", "nil", "{", "return", "-", "1", ",", "errors", ".", "Wrap", "(", "err", ",", "\"", "\"", ")", "\n", "}", "\n\n", "id", ",", "err", ":=", "result", ".", "LastInsertId", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "-", "1", ",", "errors", ".", "Wrap", "(", "err", ",", "\"", "\"", ")", "\n", "}", "\n\n", "// Insert config reference.", "stmt", "=", "c", ".", "stmt", "(", "containerCreateConfigRef", ")", "\n", "for", "key", ",", "value", ":=", "range", "object", ".", "Config", "{", "_", ",", "err", ":=", "stmt", ".", "Exec", "(", "id", ",", "key", ",", "value", ")", "\n", "if", "err", "!=", "nil", "{", "return", "-", "1", ",", "errors", ".", "Wrap", "(", "err", ",", "\"", "\"", ")", "\n", "}", "\n", "}", "\n\n", "// Insert devices reference.", "for", "name", ",", "config", ":=", "range", "object", ".", "Devices", "{", "typ", ",", "ok", ":=", "config", "[", "\"", "\"", "]", "\n", "if", "!", "ok", "{", "return", "-", "1", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "name", ")", "\n", "}", "\n", "typCode", ",", "err", ":=", "dbDeviceTypeToInt", "(", "typ", ")", "\n", "if", "err", "!=", "nil", "{", "return", "-", "1", ",", "errors", ".", "Wrapf", "(", "err", ",", "\"", "\"", ",", "typ", ")", "\n", "}", "\n", "stmt", "=", "c", ".", "stmt", "(", "containerCreateDevicesRef", ")", "\n", "result", ",", "err", ":=", "stmt", ".", "Exec", "(", "id", ",", "name", ",", "typCode", ")", "\n", "if", "err", "!=", "nil", "{", "return", "-", "1", ",", "errors", ".", "Wrapf", "(", "err", ",", "\"", "\"", ",", "name", ")", "\n", "}", "\n", "deviceID", ",", "err", ":=", "result", ".", "LastInsertId", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "-", "1", ",", "errors", ".", "Wrap", "(", "err", ",", "\"", "\"", ")", "\n", "}", "\n", "stmt", "=", "c", ".", "stmt", "(", "containerCreateDevicesConfigRef", ")", "\n", "for", "key", ",", "value", ":=", "range", "config", "{", "_", ",", "err", ":=", "stmt", ".", "Exec", "(", "deviceID", ",", "key", ",", "value", ")", "\n", "if", "err", "!=", "nil", "{", "return", "-", "1", ",", "errors", ".", "Wrap", "(", "err", ",", "\"", "\"", ")", "\n", "}", "\n", "}", "\n", "}", "\n\n", "// Insert profiles reference.", "err", "=", "ContainerProfilesInsert", "(", "c", ".", "tx", ",", "int", "(", "id", ")", ",", "object", ".", "Project", ",", "object", ".", "Profiles", ")", "\n", "if", "err", "!=", "nil", "{", "return", "-", "1", ",", "errors", ".", "Wrap", "(", "err", ",", "\"", "\"", ")", "\n", "}", "\n", "return", "id", ",", "nil", "\n", "}" ]
1,228
all-1229
[ "MarshalJSON", "supports", "json", ".", "Marshaler", "interface" ]
[ "func", "(", "v", "EventEventSourceMessageReceived", ")", "MarshalJSON", "(", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "w", ":=", "jwriter", ".", "<mask>", "{", "}", "\n", "easyjsonC5a4559bEncodeGithubComChromedpCdprotoNetwork55", "(", "&", "w", ",", "v", ")", "\n", "return", "w", ".", "Buffer", ".", "BuildBytes", "(", ")", ",", "w", ".", "Error", "\n", "}" ]
1,229
all-1230
[ "PutSecretValueRequest", "mocks", "base", "method" ]
[ "func", "(", "m", "*", "MockSecretsManagerAPI", ")", "PutSecretValueRequest", "(", "arg0", "*", "secretsmanager", ".", "PutSecretValueInput", ")", "(", "*", "request", ".", "Request", ",", "*", "secretsmanager", ".", "PutSecretValueOutput", ")", "{", "ret", ":=", "m", ".", "ctrl", ".", "Call", "(", "m", ",", "\"", "\"", ",", "arg0", ")", "\n", "ret0", ",", "_", ":=", "<mask>", "[", "0", "]", ".", "(", "*", "request", ".", "Request", ")", "\n", "ret1", ",", "_", ":=", "ret", "[", "1", "]", ".", "(", "*", "secretsmanager", ".", "PutSecretValueOutput", ")", "\n", "return", "ret0", ",", "ret1", "\n", "}" ]
1,230
all-1231
[ "Get", "loads", "the", "document", "with", "the", "given", "ID", "into", "dst", ".", "The", "ID", "is", "a", "human", "-", "readable", "ASCII", "string", ".", "It", "must", "be", "non", "-", "empty", "contain", "no", "whitespace", "characters", "and", "not", "start", "with", "!", ".", "dst", "must", "be", "a", "non", "-", "nil", "struct", "pointer", "or", "implement", "the", "FieldLoadSaver", "interface", ".", "ErrFieldMismatch", "is", "returned", "when", "a", "field", "is", "to", "be", "loaded", "into", "a", "different", "type", "than", "the", "one", "it", "was", "stored", "from", "or", "when", "a", "field", "is", "missing", "or", "unexported", "in", "the", "destination", "struct", ".", "ErrFieldMismatch", "is", "only", "returned", "if", "dst", "is", "a", "struct", "pointer", ".", "It", "is", "up", "to", "the", "callee", "to", "decide", "whether", "this", "error", "is", "fatal", "recoverable", "or", "ignorable", "." ]
[ "func", "(", "x", "*", "Index", ")", "Get", "(", "c", "context", ".", "Context", ",", "id", "string", ",", "dst", "interface", "{", "}", ")", "error", "{", "if", "id", "==", "\"", "\"", "||", "!", "validIndexNameOrDocID", "(", "id", ")", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "<mask>", ")", "\n", "}", "\n", "req", ":=", "&", "pb", ".", "ListDocumentsRequest", "{", "Params", ":", "&", "pb", ".", "ListDocumentsParams", "{", "IndexSpec", ":", "&", "x", ".", "spec", ",", "StartDocId", ":", "proto", ".", "String", "(", "id", ")", ",", "Limit", ":", "proto", ".", "Int32", "(", "1", ")", ",", "}", ",", "}", "\n", "res", ":=", "&", "pb", ".", "ListDocumentsResponse", "{", "}", "\n", "if", "err", ":=", "internal", ".", "Call", "(", "c", ",", "\"", "\"", ",", "\"", "\"", ",", "req", ",", "res", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "if", "res", ".", "Status", "==", "nil", "||", "res", ".", "Status", ".", "GetCode", "(", ")", "!=", "pb", ".", "SearchServiceError_OK", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "res", ".", "Status", ".", "GetCode", "(", ")", ",", "res", ".", "Status", ".", "GetErrorDetail", "(", ")", ")", "\n", "}", "\n", "if", "len", "(", "res", ".", "Document", ")", "!=", "1", "||", "res", ".", "Document", "[", "0", "]", ".", "GetId", "(", ")", "!=", "id", "{", "return", "ErrNoSuchDocument", "\n", "}", "\n", "return", "loadDoc", "(", "dst", ",", "res", ".", "Document", "[", "0", "]", ",", "nil", ")", "\n", "}" ]
1,231
all-1232
[ "SetQuality", "()", "is", "a", "wrapper", "around", "gtk_print_settings_set_quality", "()", "." ]
[ "func", "(", "ps", "*", "PrintSettings", ")", "SetQuality", "(", "<mask>", "PrintQuality", ")", "{", "C", ".", "gtk_print_settings_set_quality", "(", "ps", ".", "native", "(", ")", ",", "C", ".", "GtkPrintQuality", "(", "quality", ")", ")", "\n", "}" ]
1,232
all-1233
[ "NewBuilder", "returns", "a", "new", "LabelsBuilder" ]
[ "func", "NewBuilder", "(", "base", "Labels", ")", "*", "Builder", "{", "return", "&", "Builder", "{", "<mask>", ":", "base", ",", "del", ":", "make", "(", "[", "]", "string", ",", "0", ",", "5", ")", ",", "add", ":", "make", "(", "[", "]", "Label", ",", "0", ",", "5", ")", ",", "}", "\n", "}" ]
1,233
all-1234
[ "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", "(", "r", "*", "Rule", ")", "GetColorOk", "(", ")", "(", "string", ",", "bool", ")", "{", "if", "r", "==", "nil", "||", "r", ".", "<mask>", "==", "nil", "{", "return", "\"", "\"", ",", "false", "\n", "}", "\n", "return", "*", "r", ".", "Color", ",", "true", "\n", "}" ]
1,234
all-1235
[ "WithCondition", "expression", "to", "use", "as", "a", "breakpoint", "condition", ".", "When", "specified", "debugger", "will", "only", "stop", "on", "the", "breakpoint", "if", "this", "expression", "evaluates", "to", "true", "." ]
[ "func", "(", "p", "SetBreakpointParams", ")", "WithCondition", "(", "condition", "string", ")", "*", "SetBreakpointParams", "{", "p", ".", "Condition", "=", "<mask>", "\n", "return", "&", "p", "\n", "}" ]
1,235
all-1236
[ "QueryMetrics", "takes", "as", "input", "from", "to", "(", "seconds", "from", "Unix", "Epoch", ")", "and", "query", "string", "and", "then", "requests", "timeseries", "data", "for", "that", "time", "peried" ]
[ "func", "(", "client", "*", "Client", ")", "QueryMetrics", "(", "from", ",", "to", "int64", ",", "<mask>", "string", ")", "(", "[", "]", "Series", ",", "error", ")", "{", "v", ":=", "url", ".", "Values", "{", "}", "\n", "v", ".", "Add", "(", "\"", "\"", ",", "strconv", ".", "FormatInt", "(", "from", ",", "10", ")", ")", "\n", "v", ".", "Add", "(", "\"", "\"", ",", "strconv", ".", "FormatInt", "(", "to", ",", "10", ")", ")", "\n", "v", ".", "Add", "(", "\"", "\"", ",", "query", ")", "\n\n", "var", "out", "reqMetrics", "\n", "err", ":=", "client", ".", "doJsonRequest", "(", "\"", "\"", ",", "\"", "\"", "+", "v", ".", "Encode", "(", ")", ",", "nil", ",", "&", "out", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "return", "out", ".", "Series", ",", "nil", "\n", "}" ]
1,236
all-1237
[ "AppendHookOnBeforeUpdate", "appends", "a", "hook", "function", "that", "is", "run", "before", "the", "main", "update", "function", "every", "frame", "." ]
[ "func", "AppendHookOnBeforeUpdate", "(", "f", "func", "(", ")", "error", ")", "{", "m", ".", "Lock", "(", ")", "\n", "onBeforeUpdateHooks", "=", "<mask>", "(", "onBeforeUpdateHooks", ",", "f", ")", "\n", "m", ".", "Unlock", "(", ")", "\n", "}" ]
1,237
all-1238
[ "GetItemRow", "is", "a", "wrapper", "around", "gtk_icon_view_get_item_row", "()", "." ]
[ "func", "(", "v", "*", "IconView", ")", "GetItemRow", "(", "<mask>", "*", "TreePath", ")", "int", "{", "return", "int", "(", "C", ".", "gtk_icon_view_get_item_row", "(", "v", ".", "native", "(", ")", ",", "path", ".", "native", "(", ")", ")", ")", "\n", "}" ]
1,238
all-1239
[ "Debugf", "formats", "its", "arguments", "according", "to", "the", "format", "analogous", "to", "fmt", ".", "Printf", "and", "records", "the", "text", "as", "a", "log", "message", "at", "Debug", "level", ".", "The", "message", "will", "be", "associated", "with", "the", "request", "linked", "with", "the", "provided", "context", "." ]
[ "func", "Debugf", "(", "ctx", "context", ".", "<mask>", ",", "format", "string", ",", "args", "...", "interface", "{", "}", ")", "{", "internal", ".", "Logf", "(", "ctx", ",", "0", ",", "format", ",", "args", "...", ")", "\n", "}" ]
1,239
all-1240
[ "Restore", "restores", "the", "images", ".", "Restoring", "means", "to", "make", "all", "*", "graphicscommand", ".", "Image", "objects", "have", "their", "textures", "and", "framebuffers", "." ]
[ "func", "Restore", "(", ")", "error", "{", "if", "<mask>", ":=", "graphicscommand", ".", "ResetGraphicsDriverState", "(", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "return", "theImages", ".", "restore", "(", ")", "\n", "}" ]
1,240
all-1241
[ "Infoln", "logs", "a", "line", "with", "an", "INFO", "prefix", "." ]
[ "func", "(", "l", "*", "logger", ")", "Infoln", "(", "vals", "...", "<mask>", "{", "}", ")", "{", "l", ".", "mut", ".", "Lock", "(", ")", "\n", "defer", "l", ".", "mut", ".", "Unlock", "(", ")", "\n", "s", ":=", "fmt", ".", "Sprintln", "(", "vals", "...", ")", "\n", "l", ".", "logger", ".", "Output", "(", "2", ",", "\"", "\"", "+", "s", ")", "\n", "l", ".", "callHandlers", "(", "LevelInfo", ",", "s", ")", "\n", "}" ]
1,241
all-1242
[ "Plain", "renders", "the", "named", "files", "using", "the", "text", "/", "plain", "content", "type", "and", "the", "github", ".", "com", "/", "gobuffalo", "/", "plush", "package", "for", "templating", ".", "If", "more", "than", "1", "file", "is", "provided", "the", "second", "file", "will", "be", "considered", "a", "layout", "file", "and", "the", "first", "file", "will", "be", "the", "content", "file", "which", "will", "be", "placed", "into", "the", "layout", "using", "<%", "=", "yield", "%", ">", "." ]
[ "func", "(", "e", "*", "Engine", ")", "Plain", "(", "names", "...", "string", ")", "Renderer", "{", "hr", ":=", "&", "templateRenderer", "{", "Engine", ":", "e", ",", "contentType", ":", "\"", "\"", ",", "<mask>", ":", "names", ",", "}", "\n", "return", "hr", "\n", "}" ]
1,242
all-1243
[ "PieceDroppable", "returns", "a", "boolean", "value", "indicating", "whether", "the", "piece", "at", "(", "x", "y", ")", "with", "the", "given", "angle", "can", "drop", "." ]
[ "func", "(", "f", "*", "Field", ")", "PieceDroppable", "(", "piece", "*", "Piece", ",", "x", ",", "y", "int", ",", "<mask>", "Angle", ")", "bool", "{", "return", "!", "piece", ".", "collides", "(", "f", ",", "x", ",", "y", "+", "1", ",", "angle", ")", "\n", "}" ]
1,243
all-1244
[ "HasTitleAlign", "returns", "a", "boolean", "if", "a", "field", "has", "been", "set", "." ]
[ "func", "(", "t", "*", "TimeseriesDefinition", ")", "HasTitleAlign", "(", ")", "bool", "{", "if", "t", "!=", "nil", "&&", "t", ".", "TitleAlign", "!=", "nil", "{", "return", "true", "\n", "}", "\n\n", "return", "<mask>", "\n", "}" ]
1,244
all-1245
[ "Bool", "looks", "up", "the", "value", "of", "a", "bool", "flag", "returns", "false", "if", "no", "bool", "flag", "exists" ]
[ "func", "(", "f", "Flags", ")", "Bool", "(", "<mask>", "string", ")", "bool", "{", "return", "f", ".", "C", ".", "Bool", "(", "name", ")", "\n", "}" ]
1,245
all-1246
[ "Reads", "the", "entire", "method", "name", "(", "arg1", ")", "from", "the", "request", "stream", "." ]
[ "func", "(", "call", "*", "InboundCall", ")", "readMethod", "(", ")", "error", "{", "var", "arg1", "[", "]", "byte", "\n", "if", "err", ":=", "NewArgReader", "(", "call", ".", "arg1Reader", "(", ")", ")", ".", "Read", "(", "&", "arg1", ")", ";", "err", "!=", "nil", "{", "return", "call", ".", "<mask>", "(", "err", ")", "\n", "}", "\n\n", "call", ".", "method", "=", "arg1", "\n", "call", ".", "methodString", "=", "string", "(", "arg1", ")", "\n", "return", "nil", "\n", "}" ]
1,246
all-1247
[ "Get", "read", "redis", "session", "by", "sid" ]
[ "func", "(", "rp", "*", "redisProvider", ")", "Get", "(", "sid", "string", ")", "(", "*", "redisStore", ",", "error", ")", "{", "var", "rs", "=", "&", "redisStore", "{", "}", "\n", "var", "val", "map", "[", "string", "]", "string", "\n", "var", "err", "error", "\n", "redisPool", ".", "Exec", "(", "func", "(", "c", "*", "redis", ".", "<mask>", ")", "{", "val", ",", "err", "=", "c", ".", "HGetAll", "(", "sid", ")", ".", "Result", "(", ")", "\n", "rs", ".", "Values", "=", "val", "\n", "}", ")", "\n", "return", "rs", ",", "err", "\n", "}" ]
1,247
all-1248
[ "addSharedVolumes", "adds", "shared", "volume", "into", "task", "resources", "and", "updates", "container", "dependency" ]
[ "func", "(", "task", "*", "Task", ")", "addSharedVolumes", "(", "SharedVolumeMatchFullConfig", "bool", ",", "ctx", "context", ".", "Context", ",", "dockerClient", "dockerapi", ".", "DockerClient", ",", "vol", "*", "TaskVolume", ")", "error", "{", "volumeConfig", ":=", "vol", ".", "Volume", ".", "(", "*", "taskresourcevolume", ".", "DockerVolumeConfig", ")", "\n", "volumeConfig", ".", "DockerVolumeName", "=", "vol", ".", "Name", "\n", "// if autoprovision == true, we will auto-provision the volume if it does not exist already", "// else the named volume must exist", "if", "!", "volumeConfig", ".", "Autoprovision", "{", "volumeMetadata", ":=", "dockerClient", ".", "InspectVolume", "(", "ctx", ",", "vol", ".", "Name", ",", "dockerclient", ".", "InspectVolumeTimeout", ")", "\n", "if", "volumeMetadata", ".", "Error", "!=", "nil", "{", "return", "errors", ".", "Wrapf", "(", "volumeMetadata", ".", "Error", ",", "\"", "\"", ",", "vol", ".", "Name", ")", "\n", "}", "\n", "return", "nil", "\n", "}", "\n\n", "// at this point we know autoprovision = true", "// check if the volume configuration matches the one exists on the instance", "volumeMetadata", ":=", "dockerClient", ".", "InspectVolume", "(", "ctx", ",", "volumeConfig", ".", "DockerVolumeName", ",", "dockerclient", ".", "InspectVolumeTimeout", ")", "\n", "if", "volumeMetadata", ".", "Error", "!=", "nil", "{", "// Inspect the volume timed out, fail the task", "if", "_", ",", "ok", ":=", "volumeMetadata", ".", "Error", ".", "(", "*", "dockerapi", ".", "DockerTimeoutError", ")", ";", "ok", "{", "return", "volumeMetadata", ".", "Error", "\n", "}", "\n\n", "seelog", ".", "Infof", "(", "\"", "\"", ",", "task", ".", "Arn", ",", "vol", ".", "<mask>", ")", "\n", "// this resource should be created by agent", "volumeResource", ",", "err", ":=", "taskresourcevolume", ".", "NewVolumeResource", "(", "ctx", ",", "vol", ".", "Name", ",", "vol", ".", "Name", ",", "volumeConfig", ".", "Scope", ",", "volumeConfig", ".", "Autoprovision", ",", "volumeConfig", ".", "Driver", ",", "volumeConfig", ".", "DriverOpts", ",", "volumeConfig", ".", "Labels", ",", "dockerClient", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "task", ".", "AddResource", "(", "resourcetype", ".", "DockerVolumeKey", ",", "volumeResource", ")", "\n", "task", ".", "updateContainerVolumeDependency", "(", "vol", ".", "Name", ")", "\n", "return", "nil", "\n", "}", "\n\n", "seelog", ".", "Infof", "(", "\"", "\"", ",", "task", ".", "Arn", ",", "volumeConfig", ".", "DockerVolumeName", ")", "\n", "if", "!", "SharedVolumeMatchFullConfig", "{", "seelog", ".", "Infof", "(", "\"", "\"", ",", "task", ".", "Arn", ",", "volumeConfig", ".", "DockerVolumeName", ")", "\n", "return", "nil", "\n", "}", "\n\n", "// validate all the volume metadata fields match to the configuration", "if", "len", "(", "volumeMetadata", ".", "DockerVolume", ".", "Labels", ")", "==", "0", "&&", "len", "(", "volumeMetadata", ".", "DockerVolume", ".", "Labels", ")", "==", "len", "(", "volumeConfig", ".", "Labels", ")", "{", "seelog", ".", "Infof", "(", "\"", "\"", ",", "task", ".", "Arn", ",", "volumeConfig", ".", "DockerVolumeName", ")", "\n", "}", "else", "if", "!", "reflect", ".", "DeepEqual", "(", "volumeMetadata", ".", "DockerVolume", ".", "Labels", ",", "volumeConfig", ".", "Labels", ")", "{", "return", "errors", ".", "Errorf", "(", "\"", "\"", ",", "volumeMetadata", ".", "DockerVolume", ".", "Labels", ",", "volumeConfig", ".", "Labels", ")", "\n", "}", "\n\n", "if", "len", "(", "volumeMetadata", ".", "DockerVolume", ".", "Options", ")", "==", "0", "&&", "len", "(", "volumeMetadata", ".", "DockerVolume", ".", "Options", ")", "==", "len", "(", "volumeConfig", ".", "DriverOpts", ")", "{", "seelog", ".", "Infof", "(", "\"", "\"", ",", "task", ".", "Arn", ",", "volumeConfig", ".", "DockerVolumeName", ")", "\n", "}", "else", "if", "!", "reflect", ".", "DeepEqual", "(", "volumeMetadata", ".", "DockerVolume", ".", "Options", ",", "volumeConfig", ".", "DriverOpts", ")", "{", "return", "errors", ".", "Errorf", "(", "\"", "\"", ",", "volumeMetadata", ".", "DockerVolume", ".", "Options", ",", "volumeConfig", ".", "DriverOpts", ")", "\n", "}", "\n", "// Right now we are not adding shared, autoprovision = true volume to task as resource if it already exists (i.e. when this task didn't create the volume).", "// if we need to change that, make a call to task.AddResource here.", "return", "nil", "\n", "}" ]
1,248
all-1249
[ "UploadFile", "-", "allows", "us", "to", "upload", "the", "contents", "of", "the", "given", "reader" ]
[ "func", "(", "s", "*", "RemoteOperations", ")", "UploadFile", "(", "lfile", "io", ".", "Reader", ")", "(", "err", "error", ")", "{", "var", "rfile", "<mask>", ".", "WriteCloser", "\n\n", "if", "rfile", ",", "err", "=", "s", ".", "GetRemoteFile", "(", ")", ";", "err", "==", "nil", "{", "defer", "rfile", ".", "Close", "(", ")", "\n", "_", ",", "err", "=", "io", ".", "Copy", "(", "rfile", ",", "lfile", ")", "\n", "}", "\n", "return", "\n", "}" ]
1,249
all-1250
[ "title", ":", "team", "create", "path", ":", "/", "teams", "method", ":", "POST", "consume", ":", "application", "/", "x", "-", "www", "-", "form", "-", "urlencoded", "responses", ":", "201", ":", "Team", "created", "400", ":", "Invalid", "data", "401", ":", "Unauthorized", "409", ":", "Team", "already", "exists" ]
[ "func", "createTeam", "(", "w", "http", ".", "ResponseWriter", ",", "r", "*", "http", ".", "Request", ",", "t", "auth", ".", "Token", ")", "error", "{", "allowed", ":=", "permission", ".", "Check", "(", "t", ",", "permission", ".", "PermTeamCreate", ")", "\n", "if", "!", "allowed", "{", "return", "permission", ".", "ErrUnauthorized", "\n", "}", "\n", "var", "team", "authTypes", ".", "Team", "\n", "if", "err", ":=", "ParseInput", "(", "r", ",", "&", "team", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "<mask>", ",", "_", ":=", "InputValues", "(", "r", ",", "\"", "\"", ")", "\n", "team", ".", "Tags", "=", "append", "(", "team", ".", "Tags", ",", "tags", "...", ")", "// for compatibility", "\n", "evt", ",", "err", ":=", "event", ".", "New", "(", "&", "event", ".", "Opts", "{", "Target", ":", "teamTarget", "(", "team", ".", "Name", ")", ",", "Kind", ":", "permission", ".", "PermTeamCreate", ",", "Owner", ":", "t", ",", "CustomData", ":", "event", ".", "FormToCustomData", "(", "InputFields", "(", "r", ")", ")", ",", "Allowed", ":", "event", ".", "Allowed", "(", "permission", ".", "PermTeamReadEvents", ",", "permission", ".", "Context", "(", "permTypes", ".", "CtxTeam", ",", "team", ".", "Name", ")", ")", ",", "}", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "defer", "func", "(", ")", "{", "evt", ".", "Done", "(", "err", ")", "}", "(", ")", "\n", "u", ",", "err", ":=", "t", ".", "User", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "err", "=", "servicemanager", ".", "Team", ".", "Create", "(", "team", ".", "Name", ",", "team", ".", "Tags", ",", "u", ")", "\n", "switch", "err", "{", "case", "authTypes", ".", "ErrInvalidTeamName", ":", "return", "&", "errors", ".", "HTTP", "{", "Code", ":", "http", ".", "StatusBadRequest", ",", "Message", ":", "err", ".", "Error", "(", ")", "}", "\n", "case", "authTypes", ".", "ErrTeamAlreadyExists", ":", "return", "&", "errors", ".", "HTTP", "{", "Code", ":", "http", ".", "StatusConflict", ",", "Message", ":", "err", ".", "Error", "(", ")", "}", "\n", "}", "\n", "if", "err", "==", "nil", "{", "w", ".", "WriteHeader", "(", "http", ".", "StatusCreated", ")", "\n", "}", "\n", "return", "err", "\n", "}" ]
1,250
all-1251
[ "persistVote", "is", "used", "to", "persist", "our", "vote", "for", "safety", "." ]
[ "func", "(", "r", "*", "Raft", ")", "persistVote", "(", "term", "uint64", ",", "candidate", "[", "]", "byte", ")", "error", "{", "if", "err", ":=", "r", ".", "stable", ".", "SetUint64", "(", "keyLastVoteTerm", ",", "<mask>", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "if", "err", ":=", "r", ".", "stable", ".", "Set", "(", "keyLastVoteCand", ",", "candidate", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "return", "nil", "\n", "}" ]
1,251
all-1252
[ "HasRetries", "will", "return", "true", "if", "there", "are", "more", "retries", "left", "." ]
[ "func", "(", "rs", "*", "RequestState", ")", "HasRetries", "(", "err", "error", ")", "bool", "{", "if", "<mask>", "==", "nil", "{", "return", "false", "\n", "}", "\n", "rOpts", ":=", "rs", ".", "retryOpts", "\n", "return", "rs", ".", "Attempt", "<", "rOpts", ".", "MaxAttempts", "&&", "rOpts", ".", "RetryOn", ".", "CanRetry", "(", "err", ")", "\n", "}" ]
1,252
all-1253
[ "ParallelSelect", "will", "execute", "a", "Transform", "across", "all", "logical", "CPUs", "available", "to", "the", "current", "process", "." ]
[ "func", "(", "iter", "Enumerator", ")", "ParallelSelect", "(", "operation", "Transform", ")", "Enumerator", "{", "if", "cpus", ":=", "runtime", ".", "NumCPU", "(", ")", ";", "cpus", "!=", "1", "{", "intermediate", ":=", "iter", ".", "splitN", "(", "<mask>", ",", "uint", "(", "cpus", ")", ")", "\n", "return", "intermediate", "[", "0", "]", ".", "Merge", "(", "intermediate", "[", "1", ":", "]", "...", ")", "\n", "}", "\n", "return", "iter", "\n", "}" ]
1,253
all-1254
[ "HasReady", "called", "when", "RawNode", "user", "need", "to", "check", "if", "any", "Ready", "pending", ".", "Checking", "logic", "in", "this", "method", "should", "be", "consistent", "with", "Ready", ".", "containsUpdates", "()", "." ]
[ "func", "(", "rn", "*", "RawNode", ")", "HasReady", "(", ")", "bool", "{", "r", ":=", "rn", ".", "raft", "\n", "if", "!", "r", ".", "softState", "(", ")", ".", "equal", "(", "rn", ".", "prevSoftSt", ")", "{", "return", "true", "\n", "}", "\n", "if", "hardSt", ":=", "r", ".", "hardState", "(", ")", ";", "!", "IsEmptyHardState", "(", "hardSt", ")", "&&", "!", "isHardStateEqual", "(", "hardSt", ",", "rn", ".", "prevHardSt", ")", "{", "return", "<mask>", "\n", "}", "\n", "if", "r", ".", "raftLog", ".", "unstable", ".", "snapshot", "!=", "nil", "&&", "!", "IsEmptySnap", "(", "*", "r", ".", "raftLog", ".", "unstable", ".", "snapshot", ")", "{", "return", "true", "\n", "}", "\n", "if", "len", "(", "r", ".", "msgs", ")", ">", "0", "||", "len", "(", "r", ".", "raftLog", ".", "unstableEntries", "(", ")", ")", ">", "0", "||", "r", ".", "raftLog", ".", "hasNextEnts", "(", ")", "{", "return", "true", "\n", "}", "\n", "if", "len", "(", "r", ".", "readStates", ")", "!=", "0", "{", "return", "true", "\n", "}", "\n", "return", "false", "\n", "}" ]
1,254
all-1255
[ "HasInterval", "returns", "a", "boolean", "if", "a", "field", "has", "been", "set", "." ]
[ "func", "(", "s", "*", "Series", ")", "HasInterval", "(", ")", "bool", "{", "if", "s", "!=", "nil", "&&", "s", ".", "Interval", "!=", "nil", "{", "return", "true", "\n", "}", "\n\n", "return", "<mask>", "\n", "}" ]
1,255
all-1256
[ "InterfaceSlice", "converts", "a", "slice", "of", "any", "type", "into", "a", "slice", "of", "interface", "{}", "." ]
[ "func", "InterfaceSlice", "(", "slice", "interface", "{", "}", ")", "[", "]", "interface", "{", "}", "{", "v", ":=", "reflect", ".", "ValueOf", "(", "slice", ")", "\n", "if", "v", ".", "Kind", "(", ")", "!=", "reflect", ".", "Slice", "{", "panic", "(", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "slice", ")", ")", "\n", "}", "\n", "result", ":=", "make", "(", "[", "]", "interface", "{", "}", ",", "v", ".", "Len", "(", ")", ")", "\n", "for", "i", ":=", "range", "result", "{", "<mask>", "[", "i", "]", "=", "v", ".", "Index", "(", "i", ")", ".", "Interface", "(", ")", "\n", "}", "\n", "return", "result", "\n", "}" ]
1,256
all-1257
[ "Caputure", "captures", "a", "stacktrace", "for", "the", "current", "calling", "go", "program", "skip", "is", "the", "number", "of", "frames", "to", "skip" ]
[ "func", "Capture", "(", "userSkip", "int", ")", "Stacktrace", "{", "var", "(", "skip", "=", "userSkip", "+", "1", "// add one for our own function", "\n", "frames", "[", "]", "Frame", "\n", ")", "\n", "for", "i", ":=", "<mask>", ";", ";", "i", "++", "{", "pc", ",", "file", ",", "line", ",", "ok", ":=", "runtime", ".", "Caller", "(", "i", ")", "\n", "if", "!", "ok", "{", "break", "\n", "}", "\n", "frames", "=", "append", "(", "frames", ",", "NewFrame", "(", "pc", ",", "file", ",", "line", ")", ")", "\n", "}", "\n", "return", "Stacktrace", "{", "Frames", ":", "frames", ",", "}", "\n", "}" ]
1,257
all-1258
[ "newVirtualMachineCustomizationWaiter", "returns", "a", "new", "virtualMachineCustomizationWaiter", "to", "use", "to", "wait", "for", "customization", "on", ".", "This", "should", "be", "called", "**", "before", "**", "the", "start", "of", "the", "customization", "task", "to", "be", "100%", "certain", "that", "completion", "events", "are", "not", "missed", ".", "The", "timeout", "value", "is", "in", "minutes", "-", "a", "value", "of", "less", "than", "1", "disables", "the", "waiter", "and", "returns", "immediately", "without", "error", "." ]
[ "func", "newVirtualMachineCustomizationWaiter", "(", "<mask>", "*", "govmomi", ".", "Client", ",", "vm", "*", "object", ".", "VirtualMachine", ",", "timeout", "int", ")", "*", "virtualMachineCustomizationWaiter", "{", "w", ":=", "&", "virtualMachineCustomizationWaiter", "{", "done", ":", "make", "(", "chan", "struct", "{", "}", ")", ",", "}", "\n", "go", "func", "(", ")", "{", "w", ".", "err", "=", "w", ".", "wait", "(", "client", ",", "vm", ",", "timeout", ")", "\n", "close", "(", "w", ".", "done", ")", "\n", "}", "(", ")", "\n", "return", "w", "\n", "}" ]
1,258
all-1259
[ "/", "*", "resize", "/", "move", "window" ]
[ "func", "(", "win", "*", "Window", ")", "Resize", "(", "width", ",", "<mask>", "int", ")", "{", "C", ".", "cvResizeWindow", "(", "win", ".", "name_c", ",", "C", ".", "int", "(", "width", ")", ",", "C", ".", "int", "(", "height", ")", ")", "\n", "}" ]
1,259
all-1260
[ "constructor", ".", "NewAtomicFixedSizeRingBuf", "will", "allocate", "internally", "two", "buffers", "of", "size", "maxViewInBytes", "." ]
[ "func", "NewAtomicFixedSizeRingBuf", "(", "maxViewInBytes", "int", ")", "*", "AtomicFixedSizeRingBuf", "{", "n", ":=", "maxViewInBytes", "\n", "r", ":=", "&", "AtomicFixedSizeRingBuf", "{", "Use", ":", "0", ",", "// 0 or 1, whichever is actually in use at the moment.", "// If we are asked for Bytes() and we wrap, linearize into the other.", "N", ":", "n", ",", "Beg", ":", "0", ",", "readable", ":", "0", ",", "}", "\n", "r", ".", "A", "[", "0", "]", "=", "make", "(", "[", "]", "byte", ",", "n", ",", "n", ")", "\n", "r", ".", "A", "[", "1", "]", "=", "make", "(", "[", "]", "<mask>", ",", "n", ",", "n", ")", "\n\n", "return", "r", "\n", "}" ]
1,260
all-1261
[ "HasTags", "returns", "a", "boolean", "if", "a", "field", "has", "been", "set", "." ]
[ "func", "(", "r", "*", "reqGetTags", ")", "HasTags", "(", ")", "bool", "{", "if", "r", "!=", "nil", "&&", "r", ".", "Tags", "!=", "nil", "{", "return", "<mask>", "\n", "}", "\n\n", "return", "false", "\n", "}" ]
1,261
all-1262
[ "If", "logerr", "is", "true", "it", "prints", "out", "more", "error", "messages", "." ]
[ "func", "getClusterFromRemotePeers", "(", "lg", "*", "zap", ".", "Logger", ",", "urls", "[", "]", "string", ",", "timeout", "time", ".", "Duration", ",", "logerr", "bool", ",", "rt", "http", ".", "RoundTripper", ")", "(", "*", "membership", ".", "RaftCluster", ",", "error", ")", "{", "cc", ":=", "&", "http", ".", "Client", "{", "Transport", ":", "rt", ",", "Timeout", ":", "timeout", ",", "}", "\n", "for", "_", ",", "u", ":=", "range", "urls", "{", "addr", ":=", "u", "+", "\"", "\"", "\n", "resp", ",", "err", ":=", "<mask>", ".", "Get", "(", "addr", ")", "\n", "if", "err", "!=", "nil", "{", "if", "logerr", "{", "if", "lg", "!=", "nil", "{", "lg", ".", "Warn", "(", "\"", "\"", ",", "zap", ".", "String", "(", "\"", "\"", ",", "addr", ")", ",", "zap", ".", "Error", "(", "err", ")", ")", "\n", "}", "else", "{", "plog", ".", "Warningf", "(", "\"", "\"", ",", "u", ",", "err", ")", "\n", "}", "\n", "}", "\n", "continue", "\n", "}", "\n", "b", ",", "err", ":=", "ioutil", ".", "ReadAll", "(", "resp", ".", "Body", ")", "\n", "resp", ".", "Body", ".", "Close", "(", ")", "\n", "if", "err", "!=", "nil", "{", "if", "logerr", "{", "if", "lg", "!=", "nil", "{", "lg", ".", "Warn", "(", "\"", "\"", ",", "zap", ".", "String", "(", "\"", "\"", ",", "addr", ")", ",", "zap", ".", "Error", "(", "err", ")", ")", "\n", "}", "else", "{", "plog", ".", "Warningf", "(", "\"", "\"", ",", "err", ")", "\n", "}", "\n", "}", "\n", "continue", "\n", "}", "\n", "var", "membs", "[", "]", "*", "membership", ".", "Member", "\n", "if", "err", "=", "json", ".", "Unmarshal", "(", "b", ",", "&", "membs", ")", ";", "err", "!=", "nil", "{", "if", "logerr", "{", "if", "lg", "!=", "nil", "{", "lg", ".", "Warn", "(", "\"", "\"", ",", "zap", ".", "String", "(", "\"", "\"", ",", "addr", ")", ",", "zap", ".", "Error", "(", "err", ")", ")", "\n", "}", "else", "{", "plog", ".", "Warningf", "(", "\"", "\"", ",", "err", ")", "\n", "}", "\n", "}", "\n", "continue", "\n", "}", "\n", "id", ",", "err", ":=", "types", ".", "IDFromString", "(", "resp", ".", "Header", ".", "Get", "(", "\"", "\"", ")", ")", "\n", "if", "err", "!=", "nil", "{", "if", "logerr", "{", "if", "lg", "!=", "nil", "{", "lg", ".", "Warn", "(", "\"", "\"", ",", "zap", ".", "String", "(", "\"", "\"", ",", "addr", ")", ",", "zap", ".", "String", "(", "\"", "\"", ",", "resp", ".", "Header", ".", "Get", "(", "\"", "\"", ")", ")", ",", "zap", ".", "Error", "(", "err", ")", ",", ")", "\n", "}", "else", "{", "plog", ".", "Warningf", "(", "\"", "\"", ",", "err", ")", "\n", "}", "\n", "}", "\n", "continue", "\n", "}", "\n\n", "// check the length of membership members", "// if the membership members are present then prepare and return raft cluster", "// if membership members are not present then the raft cluster formed will be", "// an invalid empty cluster hence return failed to get raft cluster member(s) from the given urls error", "if", "len", "(", "membs", ")", ">", "0", "{", "return", "membership", ".", "NewClusterFromMembers", "(", "lg", ",", "\"", "\"", ",", "id", ",", "membs", ")", ",", "nil", "\n", "}", "\n", "return", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ")", "\n", "}", "\n", "return", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ")", "\n", "}" ]
1,262
all-1263
[ "release", "the", "mapping", "of", "a", "buffer", "object", "s", "data", "store", "into", "the", "client", "s", "address", "space" ]
[ "func", "UnmapBuffer", "(", "target", "uint32", ")", "bool", "{", "<mask>", ",", "_", ",", "_", ":=", "syscall", ".", "Syscall", "(", "gpUnmapBuffer", ",", "1", ",", "uintptr", "(", "target", ")", ",", "0", ",", "0", ")", "\n", "return", "ret", "!=", "0", "\n", "}" ]
1,263
all-1264
[ "NewCubeHash", "initializes", "anrd", "retuns", "Cubuhash", "struct", "." ]
[ "func", "NewCubeHash", "(", ")", "*", "CubeHash", "{", "c", ":=", "&", "CubeHash", "{", "}", "\n", "c", ".", "x0", "=", "iv", "[", "0", "]", "\n", "c", ".", "x1", "=", "iv", "[", "1", "]", "\n", "c", ".", "x2", "=", "iv", "[", "2", "]", "\n", "c", ".", "x3", "=", "iv", "[", "3", "]", "\n", "c", ".", "x4", "=", "iv", "[", "4", "]", "\n", "c", ".", "x5", "=", "iv", "[", "5", "]", "\n", "c", ".", "x6", "=", "iv", "[", "6", "]", "\n", "c", ".", "x7", "=", "iv", "[", "7", "]", "\n", "c", ".", "x8", "=", "iv", "[", "8", "]", "\n", "c", ".", "x9", "=", "iv", "[", "9", "]", "\n", "c", ".", "xa", "=", "iv", "[", "10", "]", "\n", "c", ".", "xb", "=", "iv", "[", "11", "]", "\n", "c", ".", "xc", "=", "iv", "[", "12", "]", "\n", "c", ".", "xd", "=", "iv", "[", "13", "]", "\n", "c", ".", "xe", "=", "iv", "[", "14", "]", "\n", "c", ".", "xf", "=", "iv", "[", "15", "]", "\n", "c", ".", "xg", "=", "iv", "[", "16", "]", "\n", "c", ".", "xh", "=", "iv", "[", "17", "]", "\n", "c", ".", "xi", "=", "iv", "[", "18", "]", "\n", "c", ".", "xj", "=", "iv", "[", "19", "]", "\n", "c", ".", "xk", "=", "iv", "[", "20", "]", "\n", "c", ".", "xl", "=", "iv", "[", "21", "]", "\n", "c", ".", "xm", "=", "iv", "[", "22", "]", "\n", "c", ".", "xn", "=", "iv", "[", "23", "]", "\n", "c", ".", "xo", "=", "iv", "[", "24", "]", "\n", "c", ".", "xp", "=", "iv", "[", "25", "]", "\n", "c", ".", "xq", "=", "iv", "[", "26", "]", "\n", "c", ".", "xr", "=", "iv", "[", "27", "]", "\n", "c", ".", "xs", "=", "iv", "[", "28", "]", "\n", "c", ".", "xt", "=", "iv", "[", "29", "]", "\n", "c", ".", "xu", "=", "iv", "[", "30", "]", "\n", "c", ".", "xv", "=", "<mask>", "[", "31", "]", "\n\n", "return", "c", "\n", "}" ]
1,264
all-1265
[ "create", "texture", "objects" ]
[ "func", "CreateTextures", "(", "target", "uint32", ",", "n", "int32", ",", "textures", "*", "uint32", ")", "{", "syscall", ".", "Syscall", "(", "gpCreateTextures", ",", "3", ",", "uintptr", "(", "<mask>", ")", ",", "uintptr", "(", "n", ")", ",", "uintptr", "(", "unsafe", ".", "Pointer", "(", "textures", ")", ")", ")", "\n", "}" ]
1,265
all-1266
[ "===", "sort", "(", "node", "ValueTypeVector", ")", "Vector", "===" ]
[ "func", "funcSort", "(", "vals", "[", "]", "Value", ",", "args", "Expressions", ",", "enh", "*", "EvalNodeHelper", ")", "Vector", "{", "// NaN should sort to the bottom, so take descending sort with NaN first and", "// reverse it.", "byValueSorter", ":=", "vectorByReverseValueHeap", "(", "vals", "[", "0", "]", ".", "(", "Vector", ")", ")", "\n", "sort", ".", "Sort", "(", "<mask>", ".", "Reverse", "(", "byValueSorter", ")", ")", "\n", "return", "Vector", "(", "byValueSorter", ")", "\n", "}" ]
1,266
all-1267
[ "GetHostTags", "returns", "a", "slice", "of", "tags", "for", "a", "given", "host", "and", "source", "." ]
[ "func", "(", "client", "*", "Client", ")", "GetHostTags", "(", "host", ",", "source", "string", ")", "(", "[", "]", "string", ",", "error", ")", "{", "var", "out", "reqGetHostTags", "\n", "uri", ":=", "\"", "\"", "+", "host", "\n", "if", "source", "!=", "\"", "\"", "{", "uri", "+=", "\"", "\"", "+", "source", "\n", "}", "\n", "if", "err", ":=", "client", ".", "doJsonRequest", "(", "\"", "\"", ",", "uri", ",", "nil", ",", "&", "out", ")", ";", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "return", "<mask>", ".", "Tags", ",", "nil", "\n", "}" ]
1,267
all-1268
[ "ModelValidator", "performs", "a", "validation", "of", "the", "model", "using", "the", "Validate", "method", "." ]
[ "func", "ModelValidator", "(", ")", "*", "Callback", "{", "return", "C", "(", "\"", "\"", ",", "Only", "(", "Create", ",", "Update", ")", ",", "func", "(", "ctx", "*", "Context", ")", "error", "{", "// check model", "m", ",", "<mask>", ":=", "ctx", ".", "Model", ".", "(", "ValidatableModel", ")", "\n", "if", "!", "ok", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ")", "\n", "}", "\n\n", "// validate model", "err", ":=", "m", ".", "Validate", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "return", "nil", "\n", "}", ")", "\n", "}" ]
1,268
all-1269
[ "DefaultVM", "sets", "up", "and", "assigns", "the", "default", "VM", "to", "be", "used", "by", "Xslate" ]
[ "func", "DefaultVM", "(", "tx", "*", "Xslate", ",", "args", "Args", ")", "error", "{", "dvm", ":=", "vm", ".", "NewVM", "(", ")", "\n", "dvm", ".", "Loader", "=", "<mask>", ".", "Loader", "\n", "tx", ".", "VM", "=", "dvm", "\n", "return", "nil", "\n", "}" ]
1,269
all-1270
[ "Determines", "if", "a", "name", "corresponds", "to", "a", "program", "object" ]
[ "func", "IsProgram", "(", "program", "uint32", ")", "bool", "{", "<mask>", ":=", "C", ".", "glowIsProgram", "(", "gpIsProgram", ",", "(", "C", ".", "GLuint", ")", "(", "program", ")", ")", "\n", "return", "ret", "==", "TRUE", "\n", "}" ]
1,270
all-1271
[ "GetCookieInt", "returns", "cookie", "result", "in", "int", "type", "." ]
[ "func", "(", "ctx", "*", "Context", ")", "GetCookieInt", "(", "<mask>", "string", ")", "int", "{", "return", "com", ".", "StrTo", "(", "ctx", ".", "GetCookie", "(", "name", ")", ")", ".", "MustInt", "(", ")", "\n", "}" ]
1,271
all-1272
[ "CloneRefs", "constructs", "the", "container", "and", "volumes", "necessary", "to", "clone", "the", "refs", "requested", "by", "the", "ProwJob", ".", "The", "container", "checks", "out", "repositories", "specified", "by", "the", "ProwJob", "Refs", "to", "codeMount", ".", "A", "log", "of", "what", "it", "checked", "out", "is", "written", "to", "clone", ".", "json", "in", "logMount", ".", "The", "container", "may", "need", "to", "mount", "SSH", "keys", "and", "/", "or", "cookiefiles", "in", "order", "to", "access", "private", "refs", ".", "CloneRefs", "returns", "a", "list", "of", "volumes", "containing", "these", "secrets", "required", "by", "the", "container", "." ]
[ "func", "CloneRefs", "(", "pj", "prowapi", ".", "ProwJob", ",", "codeMount", ",", "logMount", "coreapi", ".", "VolumeMount", ")", "(", "*", "coreapi", ".", "Container", ",", "[", "]", "prowapi", ".", "Refs", ",", "[", "]", "coreapi", ".", "Volume", ",", "error", ")", "{", "if", "pj", ".", "Spec", ".", "DecorationConfig", "==", "nil", "{", "return", "nil", ",", "nil", ",", "nil", ",", "nil", "\n", "}", "\n", "if", "skip", ":=", "pj", ".", "Spec", ".", "DecorationConfig", ".", "SkipCloning", ";", "skip", "!=", "nil", "&&", "*", "skip", "{", "return", "nil", ",", "nil", ",", "nil", ",", "nil", "\n", "}", "\n", "var", "cloneVolumes", "[", "]", "coreapi", ".", "Volume", "\n", "var", "refs", "[", "]", "prowapi", ".", "Refs", "// Do not return []*prowapi.Refs which we do not own", "\n", "if", "pj", ".", "Spec", ".", "Refs", "!=", "nil", "{", "refs", "=", "append", "(", "refs", ",", "*", "pj", ".", "Spec", ".", "Refs", ")", "\n", "}", "\n", "for", "_", ",", "r", ":=", "range", "pj", ".", "Spec", ".", "ExtraRefs", "{", "refs", "=", "append", "(", "refs", ",", "r", ")", "\n", "}", "\n", "if", "len", "(", "refs", ")", "==", "0", "{", "// nothing to clone", "return", "nil", ",", "nil", ",", "nil", ",", "nil", "\n", "}", "\n", "if", "codeMount", ".", "Name", "==", "\"", "\"", "||", "codeMount", ".", "MountPath", "==", "\"", "\"", "{", "return", "nil", ",", "nil", ",", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ")", "\n", "}", "\n", "if", "logMount", ".", "Name", "==", "\"", "\"", "||", "logMount", ".", "MountPath", "==", "\"", "\"", "{", "return", "nil", ",", "nil", ",", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ")", "\n", "}", "\n\n", "var", "cloneMounts", "[", "]", "coreapi", ".", "VolumeMount", "\n", "var", "sshKeyPaths", "[", "]", "string", "\n", "for", "_", ",", "secret", ":=", "range", "pj", ".", "Spec", ".", "DecorationConfig", ".", "SSHKeySecrets", "{", "volume", ",", "mount", ":=", "sshVolume", "(", "secret", ")", "\n", "cloneMounts", "=", "append", "(", "cloneMounts", ",", "mount", ")", "\n", "sshKeyPaths", "=", "<mask>", "(", "sshKeyPaths", ",", "mount", ".", "MountPath", ")", "\n", "cloneVolumes", "=", "append", "(", "cloneVolumes", ",", "volume", ")", "\n", "}", "\n\n", "var", "cloneArgs", "[", "]", "string", "\n", "var", "cookiefilePath", "string", "\n\n", "if", "cp", ":=", "pj", ".", "Spec", ".", "DecorationConfig", ".", "CookiefileSecret", ";", "cp", "!=", "\"", "\"", "{", "v", ",", "vm", ",", "vp", ":=", "cookiefileVolume", "(", "cp", ")", "\n", "cloneMounts", "=", "append", "(", "cloneMounts", ",", "vm", ")", "\n", "cloneVolumes", "=", "append", "(", "cloneVolumes", ",", "v", ")", "\n", "cookiefilePath", "=", "vp", "\n", "cloneArgs", "=", "append", "(", "cloneArgs", ",", "\"", "\"", "+", "cookiefilePath", ")", "\n", "}", "\n\n", "env", ",", "err", ":=", "cloneEnv", "(", "clonerefs", ".", "Options", "{", "CookiePath", ":", "cookiefilePath", ",", "GitRefs", ":", "refs", ",", "GitUserEmail", ":", "clonerefs", ".", "DefaultGitUserEmail", ",", "GitUserName", ":", "clonerefs", ".", "DefaultGitUserName", ",", "HostFingerprints", ":", "pj", ".", "Spec", ".", "DecorationConfig", ".", "SSHHostFingerprints", ",", "KeyFiles", ":", "sshKeyPaths", ",", "Log", ":", "CloneLogPath", "(", "logMount", ")", ",", "SrcRoot", ":", "codeMount", ".", "MountPath", ",", "}", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "nil", ",", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "err", ")", "\n", "}", "\n\n", "container", ":=", "coreapi", ".", "Container", "{", "Name", ":", "cloneRefsName", ",", "Image", ":", "pj", ".", "Spec", ".", "DecorationConfig", ".", "UtilityImages", ".", "CloneRefs", ",", "Command", ":", "[", "]", "string", "{", "cloneRefsCommand", "}", ",", "Args", ":", "cloneArgs", ",", "Env", ":", "env", ",", "VolumeMounts", ":", "append", "(", "[", "]", "coreapi", ".", "VolumeMount", "{", "logMount", ",", "codeMount", "}", ",", "cloneMounts", "...", ")", ",", "}", "\n", "return", "&", "container", ",", "refs", ",", "cloneVolumes", ",", "nil", "\n", "}" ]
1,272
all-1273
[ "Delete", "sets", "a", "header", "that", "tells", "the", "browser", "to", "remove", "the", "cookie", "with", "the", "given", "name", "." ]
[ "func", "(", "c", "*", "Cookies", ")", "Delete", "(", "name", "string", ")", "{", "ck", ":=", "http", ".", "Cookie", "{", "Name", ":", "name", ",", "Value", ":", "\"", "\"", ",", "// Setting a time in the distant past, like the unix epoch, removes the cookie,", "// since it has long expired.", "Expires", ":", "time", ".", "Unix", "(", "0", ",", "0", ")", ",", "}", "\n\n", "<mask>", ".", "SetCookie", "(", "c", ".", "res", ",", "&", "ck", ")", "\n", "}" ]
1,273
all-1274
[ "Flush", "writes", "the", "action", "history", "to", "persistent", "storage", "if", "configured", "to", "do", "so", "." ]
[ "func", "(", "h", "*", "History", ")", "Flush", "(", ")", "{", "if", "h", ".", "path", "==", "\"", "\"", "{", "return", "\n", "}", "\n", "records", ":=", "h", ".", "AllRecords", "(", ")", "\n", "start", ":=", "time", ".", "Now", "(", ")", "\n", "err", ":=", "writeHistory", "(", "h", ".", "opener", ",", "h", ".", "path", ",", "records", ")", "\n", "log", ":=", "logrus", ".", "WithFields", "(", "logrus", ".", "Fields", "{", "\"", "\"", ":", "time", ".", "Since", "(", "start", ")", ".", "String", "(", ")", ",", "\"", "\"", ":", "h", ".", "path", ",", "}", ")", "\n", "if", "err", "!=", "nil", "{", "log", ".", "WithError", "(", "err", ")", ".", "Error", "(", "\"", "\"", ")", "\n", "}", "else", "{", "<mask>", ".", "Debugf", "(", "\"", "\"", ",", "len", "(", "h", ".", "logs", ")", ")", "\n", "}", "\n", "}" ]
1,274
all-1275
[ "Panicln", "records", "the", "log", "with", "fatal", "level", "and", "panics" ]
[ "func", "Panicln", "(", "args", "...", "interface", "{", "}", ")", "{", "msg", ":=", "fmt", ".", "Sprintln", "(", "args", "...", ")", "\n", "logger", ".", "Output", "(", "2", ",", "LevelError", ",", "<mask>", ")", "\n", "panic", "(", "msg", ")", "\n", "}" ]
1,275
all-1276
[ "Kill", "sends", "the", "kill", "signal", "to", "the", "child", "process", "and", "waits", "for", "successful", "termination", ".", "If", "no", "kill", "signal", "is", "defined", "the", "process", "is", "killed", "with", "the", "most", "aggressive", "kill", "signal", ".", "If", "the", "process", "does", "not", "gracefully", "stop", "within", "the", "provided", "KillTimeout", "the", "process", "is", "force", "-", "killed", ".", "If", "a", "splay", "was", "provided", "this", "function", "will", "sleep", "for", "a", "random", "period", "of", "time", "between", "0", "and", "the", "provided", "splay", "value", "to", "reduce", "the", "thundering", "herd", "problem", ".", "This", "function", "does", "not", "return", "any", "errors", "because", "it", "guarantees", "the", "process", "will", "be", "dead", "by", "the", "return", "of", "the", "function", "call", "." ]
[ "func", "(", "c", "*", "Child", ")", "Kill", "(", ")", "{", "<mask>", ".", "Printf", "(", "\"", "\"", ")", "\n", "c", ".", "Lock", "(", ")", "\n", "defer", "c", ".", "Unlock", "(", ")", "\n", "c", ".", "kill", "(", ")", "\n", "}" ]
1,276
all-1277
[ "Lex", "is", "called", "by", "the", "parser", "generated", "by", "go", "tool", "yacc", "to", "obtain", "each", "token", ".", "The", "method", "is", "opened", "before", "the", "matching", "rules", "block", "and", "closed", "at", "the", "end", "of", "the", "file", "." ]
[ "func", "(", "l", "*", "openMetricsLexer", ")", "Lex", "(", ")", "token", "{", "if", "l", ".", "i", ">=", "len", "(", "l", ".", "b", ")", "{", "return", "tEOF", "\n", "}", "\n", "c", ":=", "l", ".", "b", "[", "l", ".", "i", "]", "\n", "l", ".", "start", "=", "l", ".", "i", "\n\n", "yystate0", ":", "switch", "yyt", ":=", "l", ".", "state", ";", "yyt", "{", "default", ":", "panic", "(", "errors", ".", "Errorf", "(", "`invalid start condition %d`", ",", "yyt", ")", ")", "\n", "case", "0", ":", "// start condition: INITIAL", "goto", "yystart1", "\n", "case", "1", ":", "// start condition: sComment", "goto", "yystart5", "\n", "case", "2", ":", "// start condition: sMeta1", "goto", "yystart25", "\n", "case", "3", ":", "// start condition: sMeta2", "goto", "yystart27", "\n", "case", "4", ":", "// start condition: sLabels", "goto", "yystart30", "\n", "case", "5", ":", "// start condition: sLValue", "goto", "yystart35", "\n", "case", "6", ":", "// start condition: sValue", "goto", "yystart39", "\n", "case", "7", ":", "// start condition: sTimestamp", "goto", "yystart43", "\n", "}", "\n\n", "goto", "yystate0", "// silence unused label error", "\n", "goto", "yystate1", "// silence unused label error", "\n", "yystate1", ":", "c", "=", "l", ".", "next", "(", ")", "\n", "yystart1", ":", "switch", "{", "default", ":", "goto", "yyabort", "\n", "case", "c", "==", "'#'", ":", "goto", "yystate2", "\n", "case", "c", "==", "':'", "||", "c", ">=", "'A'", "&&", "c", "<=", "'Z'", "||", "c", "==", "'_'", "||", "c", ">=", "'a'", "&&", "c", "<=", "'z'", ":", "goto", "yystate4", "\n", "}", "\n\n", "yystate2", ":", "c", "=", "l", ".", "next", "(", ")", "\n", "switch", "{", "default", ":", "goto", "yyabort", "\n", "case", "c", "==", "' '", ":", "goto", "yystate3", "\n", "}", "\n\n", "yystate3", ":", "c", "=", "l", ".", "<mask>", "(", ")", "\n", "goto", "yyrule1", "\n\n", "yystate4", ":", "c", "=", "l", ".", "next", "(", ")", "\n", "switch", "{", "default", ":", "goto", "yyrule8", "\n", "case", "c", ">=", "'0'", "&&", "c", "<=", "':'", "||", "c", ">=", "'A'", "&&", "c", "<=", "'Z'", "||", "c", "==", "'_'", "||", "c", ">=", "'a'", "&&", "c", "<=", "'z'", ":", "goto", "yystate4", "\n", "}", "\n\n", "goto", "yystate5", "// silence unused label error", "\n", "yystate5", ":", "c", "=", "l", ".", "next", "(", ")", "\n", "yystart5", ":", "switch", "{", "default", ":", "goto", "yyabort", "\n", "case", "c", "==", "'E'", ":", "goto", "yystate6", "\n", "case", "c", "==", "'H'", ":", "goto", "yystate10", "\n", "case", "c", "==", "'T'", ":", "goto", "yystate15", "\n", "case", "c", "==", "'U'", ":", "goto", "yystate20", "\n", "}", "\n\n", "yystate6", ":", "c", "=", "l", ".", "next", "(", ")", "\n", "switch", "{", "default", ":", "goto", "yyabort", "\n", "case", "c", "==", "'O'", ":", "goto", "yystate7", "\n", "}", "\n\n", "yystate7", ":", "c", "=", "l", ".", "next", "(", ")", "\n", "switch", "{", "default", ":", "goto", "yyabort", "\n", "case", "c", "==", "'F'", ":", "goto", "yystate8", "\n", "}", "\n\n", "yystate8", ":", "c", "=", "l", ".", "next", "(", ")", "\n", "switch", "{", "default", ":", "goto", "yyrule5", "\n", "case", "c", "==", "'\\n'", ":", "goto", "yystate9", "\n", "}", "\n\n", "yystate9", ":", "c", "=", "l", ".", "next", "(", ")", "\n", "goto", "yyrule5", "\n\n", "yystate10", ":", "c", "=", "l", ".", "next", "(", ")", "\n", "switch", "{", "default", ":", "goto", "yyabort", "\n", "case", "c", "==", "'E'", ":", "goto", "yystate11", "\n", "}", "\n\n", "yystate11", ":", "c", "=", "l", ".", "next", "(", ")", "\n", "switch", "{", "default", ":", "goto", "yyabort", "\n", "case", "c", "==", "'L'", ":", "goto", "yystate12", "\n", "}", "\n\n", "yystate12", ":", "c", "=", "l", ".", "next", "(", ")", "\n", "switch", "{", "default", ":", "goto", "yyabort", "\n", "case", "c", "==", "'P'", ":", "goto", "yystate13", "\n", "}", "\n\n", "yystate13", ":", "c", "=", "l", ".", "next", "(", ")", "\n", "switch", "{", "default", ":", "goto", "yyabort", "\n", "case", "c", "==", "' '", ":", "goto", "yystate14", "\n", "}", "\n\n", "yystate14", ":", "c", "=", "l", ".", "next", "(", ")", "\n", "goto", "yyrule2", "\n\n", "yystate15", ":", "c", "=", "l", ".", "next", "(", ")", "\n", "switch", "{", "default", ":", "goto", "yyabort", "\n", "case", "c", "==", "'Y'", ":", "goto", "yystate16", "\n", "}", "\n\n", "yystate16", ":", "c", "=", "l", ".", "next", "(", ")", "\n", "switch", "{", "default", ":", "goto", "yyabort", "\n", "case", "c", "==", "'P'", ":", "goto", "yystate17", "\n", "}", "\n\n", "yystate17", ":", "c", "=", "l", ".", "next", "(", ")", "\n", "switch", "{", "default", ":", "goto", "yyabort", "\n", "case", "c", "==", "'E'", ":", "goto", "yystate18", "\n", "}", "\n\n", "yystate18", ":", "c", "=", "l", ".", "next", "(", ")", "\n", "switch", "{", "default", ":", "goto", "yyabort", "\n", "case", "c", "==", "' '", ":", "goto", "yystate19", "\n", "}", "\n\n", "yystate19", ":", "c", "=", "l", ".", "next", "(", ")", "\n", "goto", "yyrule3", "\n\n", "yystate20", ":", "c", "=", "l", ".", "next", "(", ")", "\n", "switch", "{", "default", ":", "goto", "yyabort", "\n", "case", "c", "==", "'N'", ":", "goto", "yystate21", "\n", "}", "\n\n", "yystate21", ":", "c", "=", "l", ".", "next", "(", ")", "\n", "switch", "{", "default", ":", "goto", "yyabort", "\n", "case", "c", "==", "'I'", ":", "goto", "yystate22", "\n", "}", "\n\n", "yystate22", ":", "c", "=", "l", ".", "next", "(", ")", "\n", "switch", "{", "default", ":", "goto", "yyabort", "\n", "case", "c", "==", "'T'", ":", "goto", "yystate23", "\n", "}", "\n\n", "yystate23", ":", "c", "=", "l", ".", "next", "(", ")", "\n", "switch", "{", "default", ":", "goto", "yyabort", "\n", "case", "c", "==", "' '", ":", "goto", "yystate24", "\n", "}", "\n\n", "yystate24", ":", "c", "=", "l", ".", "next", "(", ")", "\n", "goto", "yyrule4", "\n\n", "goto", "yystate25", "// silence unused label error", "\n", "yystate25", ":", "c", "=", "l", ".", "next", "(", ")", "\n", "yystart25", ":", "switch", "{", "default", ":", "goto", "yyabort", "\n", "case", "c", "==", "':'", "||", "c", ">=", "'A'", "&&", "c", "<=", "'Z'", "||", "c", "==", "'_'", "||", "c", ">=", "'a'", "&&", "c", "<=", "'z'", ":", "goto", "yystate26", "\n", "}", "\n\n", "yystate26", ":", "c", "=", "l", ".", "next", "(", ")", "\n", "switch", "{", "default", ":", "goto", "yyrule6", "\n", "case", "c", ">=", "'0'", "&&", "c", "<=", "':'", "||", "c", ">=", "'A'", "&&", "c", "<=", "'Z'", "||", "c", "==", "'_'", "||", "c", ">=", "'a'", "&&", "c", "<=", "'z'", ":", "goto", "yystate26", "\n", "}", "\n\n", "goto", "yystate27", "// silence unused label error", "\n", "yystate27", ":", "c", "=", "l", ".", "next", "(", ")", "\n", "yystart27", ":", "switch", "{", "default", ":", "goto", "yyabort", "\n", "case", "c", "==", "' '", ":", "goto", "yystate28", "\n", "}", "\n\n", "yystate28", ":", "c", "=", "l", ".", "next", "(", ")", "\n", "switch", "{", "default", ":", "goto", "yyabort", "\n", "case", "c", "==", "'\\n'", ":", "goto", "yystate29", "\n", "case", "c", ">=", "'\\x01'", "&&", "c", "<=", "'\\t'", "||", "c", ">=", "'\\v'", "&&", "c", "<=", "'ÿ':", "", "goto", "yystate28", "\n", "}", "\n\n", "yystate29", ":", "c", "=", "l", ".", "next", "(", ")", "\n", "goto", "yyrule7", "\n\n", "goto", "yystate30", "// silence unused label error", "\n", "yystate30", ":", "c", "=", "l", ".", "next", "(", ")", "\n", "yystart30", ":", "switch", "{", "default", ":", "goto", "yyabort", "\n", "case", "c", "==", "','", ":", "goto", "yystate31", "\n", "case", "c", "==", "'='", ":", "goto", "yystate32", "\n", "case", "c", "==", "'}'", ":", "goto", "yystate34", "\n", "case", "c", ">=", "'A'", "&&", "c", "<=", "'Z'", "||", "c", "==", "'_'", "||", "c", ">=", "'a'", "&&", "c", "<=", "'z'", ":", "goto", "yystate33", "\n", "}", "\n\n", "yystate31", ":", "c", "=", "l", ".", "next", "(", ")", "\n", "goto", "yyrule13", "\n\n", "yystate32", ":", "c", "=", "l", ".", "next", "(", ")", "\n", "goto", "yyrule12", "\n\n", "yystate33", ":", "c", "=", "l", ".", "next", "(", ")", "\n", "switch", "{", "default", ":", "goto", "yyrule10", "\n", "case", "c", ">=", "'0'", "&&", "c", "<=", "'9'", "||", "c", ">=", "'A'", "&&", "c", "<=", "'Z'", "||", "c", "==", "'_'", "||", "c", ">=", "'a'", "&&", "c", "<=", "'z'", ":", "goto", "yystate33", "\n", "}", "\n\n", "yystate34", ":", "c", "=", "l", ".", "next", "(", ")", "\n", "goto", "yyrule11", "\n\n", "goto", "yystate35", "// silence unused label error", "\n", "yystate35", ":", "c", "=", "l", ".", "next", "(", ")", "\n", "yystart35", ":", "switch", "{", "default", ":", "goto", "yyabort", "\n", "case", "c", "==", "'\"'", ":", "goto", "yystate36", "\n", "}", "\n\n", "yystate36", ":", "c", "=", "l", ".", "next", "(", ")", "\n", "switch", "{", "default", ":", "goto", "yyabort", "\n", "case", "c", "==", "'\"'", ":", "goto", "yystate37", "\n", "case", "c", "==", "'\\\\'", ":", "goto", "yystate38", "\n", "case", "c", ">=", "'\\x01'", "&&", "c", "<=", "'\\t'", "||", "c", ">=", "'\\v'", "&&", "c", "<=", "'!'", "||", "c", ">=", "'#'", "&&", "c", "<=", "'['", "||", "c", ">=", "']'", "&&", "c", "<=", "'ÿ':", "", "goto", "yystate36", "\n", "}", "\n\n", "yystate37", ":", "c", "=", "l", ".", "next", "(", ")", "\n", "goto", "yyrule14", "\n\n", "yystate38", ":", "c", "=", "l", ".", "next", "(", ")", "\n", "switch", "{", "default", ":", "goto", "yyabort", "\n", "case", "c", ">=", "'\\x01'", "&&", "c", "<=", "'\\t'", "||", "c", ">=", "'\\v'", "&&", "c", "<=", "'ÿ':", "", "goto", "yystate36", "\n", "}", "\n\n", "goto", "yystate39", "// silence unused label error", "\n", "yystate39", ":", "c", "=", "l", ".", "next", "(", ")", "\n", "yystart39", ":", "switch", "{", "default", ":", "goto", "yyabort", "\n", "case", "c", "==", "' '", ":", "goto", "yystate40", "\n", "case", "c", "==", "'{'", ":", "goto", "yystate42", "\n", "}", "\n\n", "yystate40", ":", "c", "=", "l", ".", "next", "(", ")", "\n", "switch", "{", "default", ":", "goto", "yyabort", "\n", "case", "c", ">=", "'\\x01'", "&&", "c", "<=", "'\\t'", "||", "c", ">=", "'\\v'", "&&", "c", "<=", "'\\x1f'", "||", "c", ">=", "'!'", "&&", "c", "<=", "'ÿ':", "", "goto", "yystate41", "\n", "}", "\n\n", "yystate41", ":", "c", "=", "l", ".", "next", "(", ")", "\n", "switch", "{", "default", ":", "goto", "yyrule15", "\n", "case", "c", ">=", "'\\x01'", "&&", "c", "<=", "'\\t'", "||", "c", ">=", "'\\v'", "&&", "c", "<=", "'\\x1f'", "||", "c", ">=", "'!'", "&&", "c", "<=", "'ÿ':", "", "goto", "yystate41", "\n", "}", "\n\n", "yystate42", ":", "c", "=", "l", ".", "next", "(", ")", "\n", "goto", "yyrule9", "\n\n", "goto", "yystate43", "// silence unused label error", "\n", "yystate43", ":", "c", "=", "l", ".", "next", "(", ")", "\n", "yystart43", ":", "switch", "{", "default", ":", "goto", "yyabort", "\n", "case", "c", "==", "' '", ":", "goto", "yystate45", "\n", "case", "c", "==", "'\\n'", ":", "goto", "yystate44", "\n", "}", "\n\n", "yystate44", ":", "c", "=", "l", ".", "next", "(", ")", "\n", "goto", "yyrule18", "\n\n", "yystate45", ":", "c", "=", "l", ".", "next", "(", ")", "\n", "switch", "{", "default", ":", "goto", "yyabort", "\n", "case", "c", "==", "'#'", ":", "goto", "yystate47", "\n", "case", "c", ">=", "'\\x01'", "&&", "c", "<=", "'\\t'", "||", "c", ">=", "'\\v'", "&&", "c", "<=", "'\\x1f'", "||", "c", "==", "'!'", "||", "c", "==", "'\"'", "||", "c", ">=", "'$'", "&&", "c", "<=", "'ÿ':", "", "goto", "yystate46", "\n", "}", "\n\n", "yystate46", ":", "c", "=", "l", ".", "next", "(", ")", "\n", "switch", "{", "default", ":", "goto", "yyrule16", "\n", "case", "c", ">=", "'\\x01'", "&&", "c", "<=", "'\\t'", "||", "c", ">=", "'\\v'", "&&", "c", "<=", "'\\x1f'", "||", "c", ">=", "'!'", "&&", "c", "<=", "'ÿ':", "", "goto", "yystate46", "\n", "}", "\n\n", "yystate47", ":", "c", "=", "l", ".", "next", "(", ")", "\n", "switch", "{", "default", ":", "goto", "yyrule16", "\n", "case", "c", "==", "' '", ":", "goto", "yystate48", "\n", "case", "c", ">=", "'\\x01'", "&&", "c", "<=", "'\\t'", "||", "c", ">=", "'\\v'", "&&", "c", "<=", "'\\x1f'", "||", "c", ">=", "'!'", "&&", "c", "<=", "'ÿ':", "", "goto", "yystate46", "\n", "}", "\n\n", "yystate48", ":", "c", "=", "l", ".", "next", "(", ")", "\n", "switch", "{", "default", ":", "goto", "yyabort", "\n", "case", "c", "==", "'\\n'", ":", "goto", "yystate49", "\n", "case", "c", ">=", "'\\x01'", "&&", "c", "<=", "'\\t'", "||", "c", ">=", "'\\v'", "&&", "c", "<=", "'ÿ':", "", "goto", "yystate48", "\n", "}", "\n\n", "yystate49", ":", "c", "=", "l", ".", "next", "(", ")", "\n", "goto", "yyrule17", "\n\n", "yyrule1", ":", "// #{S}", "{", "l", ".", "state", "=", "sComment", "\n", "goto", "yystate0", "\n", "}", "\n", "yyrule2", ":", "// HELP{S}", "{", "l", ".", "state", "=", "sMeta1", "\n", "return", "tHelp", "\n", "goto", "yystate0", "\n", "}", "\n", "yyrule3", ":", "// TYPE{S}", "{", "l", ".", "state", "=", "sMeta1", "\n", "return", "tType", "\n", "goto", "yystate0", "\n", "}", "\n", "yyrule4", ":", "// UNIT{S}", "{", "l", ".", "state", "=", "sMeta1", "\n", "return", "tUnit", "\n", "goto", "yystate0", "\n", "}", "\n", "yyrule5", ":", "// \"EOF\"\\n?", "{", "l", ".", "state", "=", "sInit", "\n", "return", "tEofWord", "\n", "goto", "yystate0", "\n", "}", "\n", "yyrule6", ":", "// {M}({M}|{D})*", "{", "l", ".", "state", "=", "sMeta2", "\n", "return", "tMName", "\n", "goto", "yystate0", "\n", "}", "\n", "yyrule7", ":", "// {S}{C}*\\n", "{", "l", ".", "state", "=", "sInit", "\n", "return", "tText", "\n", "goto", "yystate0", "\n", "}", "\n", "yyrule8", ":", "// {M}({M}|{D})*", "{", "l", ".", "state", "=", "sValue", "\n", "return", "tMName", "\n", "goto", "yystate0", "\n", "}", "\n", "yyrule9", ":", "// \\{", "{", "l", ".", "state", "=", "sLabels", "\n", "return", "tBraceOpen", "\n", "goto", "yystate0", "\n", "}", "\n", "yyrule10", ":", "// {L}({L}|{D})*", "{", "return", "tLName", "\n", "}", "\n", "yyrule11", ":", "// \\}", "{", "l", ".", "state", "=", "sValue", "\n", "return", "tBraceClose", "\n", "goto", "yystate0", "\n", "}", "\n", "yyrule12", ":", "// =", "{", "l", ".", "state", "=", "sLValue", "\n", "return", "tEqual", "\n", "goto", "yystate0", "\n", "}", "\n", "yyrule13", ":", "// ,", "{", "return", "tComma", "\n", "}", "\n", "yyrule14", ":", "// \\\"(\\\\.|[^\\\\\"\\n])*\\\"", "{", "l", ".", "state", "=", "sLabels", "\n", "return", "tLValue", "\n", "goto", "yystate0", "\n", "}", "\n", "yyrule15", ":", "// {S}[^ \\n]+", "{", "l", ".", "state", "=", "sTimestamp", "\n", "return", "tValue", "\n", "goto", "yystate0", "\n", "}", "\n", "yyrule16", ":", "// {S}[^ \\n]+", "{", "return", "tTimestamp", "\n", "}", "\n", "yyrule17", ":", "// {S}#{S}{C}*\\n", "{", "l", ".", "state", "=", "sInit", "\n", "return", "tLinebreak", "\n", "goto", "yystate0", "\n", "}", "\n", "yyrule18", ":", "// \\n", "{", "l", ".", "state", "=", "sInit", "\n", "return", "tLinebreak", "\n", "goto", "yystate0", "\n", "}", "\n", "panic", "(", "\"", "\"", ")", "\n\n", "goto", "yyabort", "// silence unused label error", "\n\n", "yyabort", ":", "// no lexem recognized", "return", "tInvalid", "\n", "}" ]
1,277
all-1278
[ "GetClientPointer", "()", "is", "a", "wrapper", "around", "gdk_device_manager_get_client_pointer", "()", "." ]
[ "func", "(", "v", "*", "DeviceManager", ")", "GetClientPointer", "(", ")", "(", "*", "<mask>", ",", "error", ")", "{", "c", ":=", "C", ".", "gdk_device_manager_get_client_pointer", "(", "v", ".", "native", "(", ")", ")", "\n", "if", "c", "==", "nil", "{", "return", "nil", ",", "nilPtrErr", "\n", "}", "\n\n", "return", "&", "Device", "{", "glib", ".", "Take", "(", "unsafe", ".", "Pointer", "(", "c", ")", ")", "}", ",", "nil", "\n", "}" ]
1,278
all-1279
[ "powerStateFromInstanceView", "reads", "the", "instance", "view", "response", "and", "extracts", "the", "power", "state", "status", "(", "if", "exists", ")", "from", "there", ".", "If", "no", "status", "is", "found", "or", "an", "unknown", "status", "has", "occurred", "returns", "Unknown", "." ]
[ "func", "powerStateFromInstanceView", "(", "instanceView", "*", "compute", ".", "VirtualMachineInstanceView", ")", "VMPowerState", "{", "if", "instanceView", "==", "nil", "{", "log", ".", "Debug", "(", "\"", "\"", ")", "\n", "return", "Unknown", "\n", "}", "else", "if", "instanceView", ".", "Statuses", "==", "nil", "||", "len", "(", "*", "instanceView", ".", "Statuses", ")", "==", "0", "{", "log", ".", "Debug", "(", "\"", "\"", ")", "\n", "return", "Unknown", "\n", "}", "\n", "statuses", ":=", "*", "instanceView", ".", "Statuses", "\n\n", "// Filter statuses whose \"code\" starts with \"PowerState/\"", "var", "s", "*", "compute", ".", "InstanceViewStatus", "\n", "for", "_", ",", "v", ":=", "range", "statuses", "{", "log", ".", "Debugf", "(", "\"", "\"", ",", "to", ".", "String", "(", "v", ".", "Code", ")", ")", "\n", "if", "strings", ".", "HasPrefix", "(", "to", ".", "String", "(", "v", ".", "Code", ")", ",", "powerStateCodePrefix", ")", "{", "log", ".", "Debug", "(", "\"", "\"", ")", "\n", "s", "=", "&", "v", "\n", "<mask>", "\n", "}", "\n", "}", "\n", "if", "s", "==", "nil", "{", "log", ".", "Debug", "(", "\"", "\"", ")", "\n", "return", "Unknown", "\n", "}", "\n", "code", ":=", "strings", ".", "TrimPrefix", "(", "to", ".", "String", "(", "s", ".", "Code", ")", ",", "powerStateCodePrefix", ")", "\n", "switch", "code", "{", "case", "\"", "\"", ":", "return", "Stopped", "\n", "case", "\"", "\"", ":", "return", "Stopping", "\n", "case", "\"", "\"", ":", "return", "Starting", "\n", "case", "\"", "\"", ":", "return", "Running", "\n", "case", "\"", "\"", ":", "return", "Deallocated", "\n", "case", "\"", "\"", ":", "return", "Deallocating", "\n", "default", ":", "log", ".", "Warn", "(", "\"", "\"", ",", "code", ")", "\n", "return", "Unknown", "\n", "}", "\n", "}" ]
1,279
all-1280
[ "Repair", "returns", "an", "iterator", "that", "goes", "over", "all", "recovered", "documents", "in", "the", "collection", "in", "a", "best", "-", "effort", "manner", ".", "This", "is", "most", "useful", "when", "there", "are", "damaged", "data", "files", ".", "Multiple", "copies", "of", "the", "same", "document", "may", "be", "returned", "by", "the", "iterator", ".", "Repair", "is", "supported", "in", "MongoDB", "2", ".", "7", ".", "8", "and", "later", "." ]
[ "func", "(", "c", "*", "Collection", ")", "Repair", "(", ")", "*", "Iter", "{", "// Clone session and set it to Monotonic mode so that the server", "// used for the query may be safely obtained afterwards, if", "// necessary for iteration when a cursor is received.", "session", ":=", "c", ".", "Database", ".", "Session", "\n", "cloned", ":=", "session", ".", "Clone", "(", ")", "\n", "cloned", ".", "SetMode", "(", "Monotonic", ",", "false", ")", "\n", "defer", "cloned", ".", "Close", "(", ")", "\n\n", "batchSize", ":=", "int", "(", "cloned", ".", "queryConfig", ".", "op", ".", "limit", ")", "\n\n", "var", "result", "struct", "{", "Cursor", "struct", "{", "FirstBatch", "[", "]", "bson", ".", "Raw", "\"", "\"", "\n", "<mask>", "int64", "\n", "}", "\n", "}", "\n\n", "cmd", ":=", "repairCmd", "{", "RepairCursor", ":", "c", ".", "Name", ",", "Cursor", ":", "&", "repairCmdCursor", "{", "batchSize", "}", ",", "}", "\n\n", "clonedc", ":=", "c", ".", "With", "(", "cloned", ")", "\n", "err", ":=", "clonedc", ".", "Database", ".", "Run", "(", "cmd", ",", "&", "result", ")", "\n", "return", "clonedc", ".", "NewIter", "(", "session", ",", "result", ".", "Cursor", ".", "FirstBatch", ",", "result", ".", "Cursor", ".", "Id", ",", "err", ")", "\n", "}" ]
1,280
all-1281
[ "setupHostVethDevice", "configures", "a", "nic", "device", "s", "host", "side", "veth", "settings", "." ]
[ "func", "(", "c", "*", "containerLXC", ")", "setupHostVethDevice", "(", "device", "types", ".", "<mask>", ")", "error", "{", "// If not already, populate network device with host name.", "if", "device", "[", "\"", "\"", "]", "==", "\"", "\"", "{", "device", "[", "\"", "\"", "]", "=", "c", ".", "getHostInterface", "(", "device", "[", "\"", "\"", "]", ")", "\n", "}", "\n\n", "// Check whether host device resolution succeeded.", "if", "device", "[", "\"", "\"", "]", "==", "\"", "\"", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ")", "\n", "}", "\n\n", "// Refresh tc limits", "err", ":=", "c", ".", "setNetworkLimits", "(", "device", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "// Setup static routes to container", "err", "=", "c", ".", "setNetworkRoutes", "(", "device", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "return", "nil", "\n", "}" ]
1,281
all-1282
[ "getDatastore", "gets", "datastore", "object" ]
[ "func", "getDatastore", "(", "f", "*", "find", ".", "Finder", ",", "ds", "string", ")", "(", "*", "object", ".", "Datastore", ",", "error", ")", "{", "if", "ds", "!=", "\"", "\"", "{", "dso", ",", "err", ":=", "f", ".", "Datastore", "(", "context", ".", "TODO", "(", ")", ",", "<mask>", ")", "\n", "return", "dso", ",", "err", "\n", "}", "else", "{", "dso", ",", "err", ":=", "f", ".", "DefaultDatastore", "(", "context", ".", "TODO", "(", ")", ")", "\n", "return", "dso", ",", "err", "\n", "}", "\n", "}" ]
1,282
all-1283
[ "GetSignatures", "returns", "the", "image", "s", "signatures", ".", "It", "may", "use", "a", "remote", "(", "=", "slow", ")", "service", ".", "If", "instanceDigest", "is", "not", "nil", "it", "contains", "a", "digest", "of", "the", "specific", "manifest", "instance", "to", "retrieve", "signatures", "for", "(", "when", "the", "primary", "manifest", "is", "a", "manifest", "list", ")", ";", "this", "never", "happens", "if", "the", "primary", "manifest", "is", "not", "a", "manifest", "list", "(", "e", ".", "g", ".", "if", "the", "source", "never", "returns", "manifest", "lists", ")", "." ]
[ "func", "(", "s", "*", "dockerImageSource", ")", "GetSignatures", "(", "ctx", "context", ".", "Context", ",", "instanceDigest", "*", "digest", ".", "Digest", ")", "(", "[", "]", "[", "]", "byte", ",", "error", ")", "{", "if", "err", ":=", "s", ".", "c", ".", "detectProperties", "(", "ctx", ")", ";", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "switch", "{", "case", "s", ".", "c", ".", "signatureBase", "!=", "nil", ":", "return", "s", ".", "getSignaturesFromLookaside", "(", "ctx", ",", "instanceDigest", ")", "\n", "<mask>", "s", ".", "c", ".", "supportsSignatures", ":", "return", "s", ".", "getSignaturesFromAPIExtension", "(", "ctx", ",", "instanceDigest", ")", "\n", "default", ":", "return", "[", "]", "[", "]", "byte", "{", "}", ",", "nil", "\n", "}", "\n", "}" ]
1,283
all-1284
[ "Copy", "()", "is", "a", "wrapper", "around", "gtk_tree_iter_copy", "()", "." ]
[ "func", "(", "v", "*", "TreeIter", ")", "Copy", "(", ")", "(", "*", "TreeIter", ",", "error", ")", "{", "c", ":=", "C", ".", "gtk_tree_iter_copy", "(", "v", ".", "native", "(", ")", ")", "\n", "if", "c", "==", "nil", "{", "return", "nil", ",", "nilPtrErr", "\n", "}", "\n", "t", ":=", "&", "TreeIter", "{", "*", "c", "}", "\n", "runtime", ".", "SetFinalizer", "(", "t", ",", "(", "*", "TreeIter", ")", ".", "<mask>", ")", "\n", "return", "t", ",", "nil", "\n", "}" ]
1,284
all-1285
[ "Parameters", ":", "-", "Key", "-", "Value" ]
[ "func", "(", "p", "*", "KeyValueClient", ")", "<mask>", "(", "key", "string", ",", "value", "string", ")", "(", "err", "error", ")", "{", "if", "err", "=", "p", ".", "sendSet", "(", "key", ",", "value", ")", ";", "err", "!=", "nil", "{", "return", "\n", "}", "\n", "return", "p", ".", "recvSet", "(", ")", "\n", "}" ]
1,285
all-1286
[ "Add", "returns", "a", "new", "logger", "with", "added", "context", "variables", ".", "This", "function", "takes", "alternated", "key", "-", "value", "pairs", "(", "name1", "val1", "name1", "val2", "...", ")", ".", "The", "keys", "must", "be", "strings", "but", "the", "values", "can", "be", "of", "any", "type", "." ]
[ "func", "(", "l", "*", "LoggerBase", ")", "Add", "(", "vars", "...", "<mask>", "{", "}", ")", "Logger", "{", "if", "len", "(", "vars", ")", "%", "2", "==", "1", "{", "panic", "(", "\"", "\"", ")", "\n", "}", "\n\n", "ctx", ":=", "map", "[", "string", "]", "interface", "{", "}", "{", "}", "\n\n", "for", "k", ",", "v", ":=", "range", "l", ".", "ctx", "{", "ctx", "[", "k", "]", "=", "v", "\n", "}", "\n\n", "num", ":=", "len", "(", "vars", ")", "/", "2", "\n", "for", "i", ":=", "0", ";", "i", "<", "num", ";", "i", "++", "{", "name", ",", "ok", ":=", "vars", "[", "i", "*", "2", "]", ".", "(", "string", ")", "\n", "if", "!", "ok", "{", "panic", "(", "\"", "\"", ")", "\n", "}", "\n", "ctx", "[", "name", "]", "=", "vars", "[", "i", "*", "2", "+", "1", "]", "\n", "}", "\n\n", "return", "&", "LoggerBase", "{", "conf", ":", "l", ".", "conf", ",", "log", ":", "l", ".", "log", ",", "ctx", ":", "ctx", "}", "\n", "}" ]
1,286
all-1287
[ "specify", "the", "diameter", "of", "rasterized", "points" ]
[ "func", "PointSize", "(", "size", "float32", ")", "{", "syscall", ".", "Syscall", "(", "gpPointSize", ",", "1", ",", "uintptr", "(", "math", ".", "Float32bits", "(", "<mask>", ")", ")", ",", "0", ",", "0", ")", "\n", "}" ]
1,287
all-1288
[ "UnmarshalEasyJSON", "satisfies", "easyjson", ".", "Unmarshaler", "." ]
[ "func", "(", "t", "*", "APIType", ")", "UnmarshalEasyJSON", "(", "<mask>", "*", "jlexer", ".", "Lexer", ")", "{", "switch", "APIType", "(", "in", ".", "String", "(", ")", ")", "{", "case", "APITypeLog", ":", "*", "t", "=", "APITypeLog", "\n", "case", "APITypeDebug", ":", "*", "t", "=", "APITypeDebug", "\n", "case", "APITypeInfo", ":", "*", "t", "=", "APITypeInfo", "\n", "case", "APITypeError", ":", "*", "t", "=", "APITypeError", "\n", "case", "APITypeWarning", ":", "*", "t", "=", "APITypeWarning", "\n", "case", "APITypeDir", ":", "*", "t", "=", "APITypeDir", "\n", "case", "APITypeDirxml", ":", "*", "t", "=", "APITypeDirxml", "\n", "case", "APITypeTable", ":", "*", "t", "=", "APITypeTable", "\n", "case", "APITypeTrace", ":", "*", "t", "=", "APITypeTrace", "\n", "case", "APITypeClear", ":", "*", "t", "=", "APITypeClear", "\n", "case", "APITypeStartGroup", ":", "*", "t", "=", "APITypeStartGroup", "\n", "case", "APITypeStartGroupCollapsed", ":", "*", "t", "=", "APITypeStartGroupCollapsed", "\n", "case", "APITypeEndGroup", ":", "*", "t", "=", "APITypeEndGroup", "\n", "case", "APITypeAssert", ":", "*", "t", "=", "APITypeAssert", "\n", "case", "APITypeProfile", ":", "*", "t", "=", "APITypeProfile", "\n", "case", "APITypeProfileEnd", ":", "*", "t", "=", "APITypeProfileEnd", "\n", "case", "APITypeCount", ":", "*", "t", "=", "APITypeCount", "\n", "case", "APITypeTimeEnd", ":", "*", "t", "=", "APITypeTimeEnd", "\n\n", "default", ":", "in", ".", "AddError", "(", "errors", ".", "New", "(", "\"", "\"", ")", ")", "\n", "}", "\n", "}" ]
1,288
all-1289
[ "PackageJSONCheck", "will", "compare", "the", "current", "default", "Buffalo", "package", ".", "json", "against", "the", "applications", "package", ".", "json", ".", "If", "they", "are", "different", "you", "have", "the", "option", "to", "overwrite", "the", "existing", "package", ".", "json", "file", "with", "the", "new", "one", "." ]
[ "func", "PackageJSONCheck", "(", "r", "*", "Runner", ")", "error", "{", "fmt", ".", "Println", "(", "\"", "\"", ")", "\n\n", "if", "!", "r", ".", "App", ".", "WithWebpack", "{", "return", "nil", "\n", "}", "\n\n", "box", ":=", "webpack", ".", "Templates", "\n\n", "f", ",", "err", ":=", "box", ".", "FindString", "(", "\"", "\"", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "tmpl", ",", "err", ":=", "template", ".", "New", "(", "\"", "\"", ")", ".", "Parse", "(", "f", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "bb", ":=", "&", "bytes", ".", "Buffer", "{", "}", "\n", "err", "=", "tmpl", ".", "Execute", "(", "bb", ",", "map", "[", "string", "]", "interface", "{", "}", "{", "\"", "\"", ":", "&", "webpack", ".", "Options", "{", "App", ":", "r", ".", "App", ",", "}", ",", "}", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "b", ",", "err", ":=", "ioutil", ".", "ReadFile", "(", "\"", "\"", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "if", "string", "(", "b", ")", "==", "bb", ".", "String", "(", ")", "{", "return", "nil", "\n", "}", "\n\n", "if", "!", "ask", "(", "\"", "\\n", "\"", ")", "{", "fmt", ".", "Println", "(", "\"", "\\t", "\"", ")", "\n", "return", "nil", "\n", "}", "\n\n", "pf", ",", "err", ":=", "os", ".", "Create", "(", "\"", "\"", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "_", ",", "err", "=", "pf", ".", "Write", "(", "bb", ".", "Bytes", "(", ")", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "err", "=", "pf", ".", "Close", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "os", ".", "RemoveAll", "(", "filepath", ".", "Join", "(", "r", ".", "App", ".", "Root", ",", "\"", "\"", ")", ")", "\n", "var", "cmd", "*", "exec", ".", "Cmd", "\n", "if", "r", ".", "App", ".", "WithYarn", "{", "cmd", "=", "<mask>", ".", "Command", "(", "\"", "\"", ",", "\"", "\"", ")", "\n", "}", "else", "{", "cmd", "=", "exec", ".", "Command", "(", "\"", "\"", ",", "\"", "\"", ")", "\n", "}", "\n\n", "cmd", ".", "Stdin", "=", "os", ".", "Stdin", "\n", "cmd", ".", "Stdout", "=", "os", ".", "Stdout", "\n", "cmd", ".", "Stderr", "=", "os", ".", "Stderr", "\n", "return", "cmd", ".", "Run", "(", ")", "\n", "}" ]
1,289
all-1290
[ "RemoveIP", "removes", "an", "IP", "address", "from", "Pinger", ".", "ipaddr", "arg", "should", "be", "a", "string", "like", "192", ".", "0", ".", "2", ".", "1", "." ]
[ "func", "(", "p", "*", "Pinger", ")", "RemoveIP", "(", "ipaddr", "string", ")", "error", "{", "addr", ":=", "net", ".", "ParseIP", "(", "ipaddr", ")", "\n", "if", "addr", "==", "nil", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "ipaddr", ")", "\n", "}", "\n", "p", ".", "mu", ".", "Lock", "(", ")", "\n", "delete", "(", "p", ".", "addrs", ",", "addr", ".", "<mask>", "(", ")", ")", "\n", "p", ".", "mu", ".", "Unlock", "(", ")", "\n", "return", "nil", "\n", "}" ]
1,290
all-1291
[ "func", "searchString", "(", "idx", "[]", "string", "key", "string", ")", "int", "{", "return", "sort", ".", "Search", "(", "len", "(", "idx", ")", "func", "(", "i", "int", ")", "bool", "{", "numKey", "er1", ":", "=", "strconv", ".", "ParseInt", "(", "key", "10", "64", ")", "numIdx", "er2", ":", "=", "strconv", ".", "ParseInt", "(", "idx", "[", "i", "]", "10", "64", ")", "if", "er1", "==", "nil", "&&", "er2", "==", "nil", "{", "return", "numIdx", ">", "=", "numKey", "}", "return", "idx", "[", "i", "]", ">", "=", "key", "}", ")", "}" ]
[ "func", "searchString", "(", "idx", "[", "]", "string", ",", "<mask>", "string", ")", "int", "{", "return", "sort", ".", "SearchStrings", "(", "idx", ",", "key", ")", "\n", "}" ]
1,291
all-1292
[ "ToASCII", "converts", "unicode", "to", "ASCII", "by", "stripping", "accents", "and", "converting", "some", "special", "characters", "into", "their", "ASCII", "approximations", ".", "Anything", "else", "will", "be", "replaced", "with", "an", "underscore", "." ]
[ "func", "ToASCII", "(", "s", "string", ")", "string", "{", "// unicode.Mn: nonspacing marks", "tr", ":=", "transform", ".", "Chain", "(", "<mask>", ".", "NFD", ",", "runes", ".", "Remove", "(", "runes", ".", "In", "(", "unicode", ".", "Mn", ")", ")", ",", "runes", ".", "Map", "(", "mapLatinSpecial", ")", ",", "norm", ".", "NFC", ")", "\n", "r", ",", "_", ",", "_", ":=", "transform", ".", "String", "(", "tr", ",", "s", ")", "\n", "return", "r", "\n", "}" ]
1,292
all-1293
[ "NewNetAddress", "returns", "a", "new", "NetAddress", "using", "the", "provided", "TCP", "address", ".", "When", "testing", "other", "net", ".", "Addr", "(", "except", "TCP", ")", "will", "result", "in", "using", "0", ".", "0", ".", "0", ".", "0", ":", "0", ".", "When", "normal", "run", "other", "net", ".", "Addr", "(", "except", "TCP", ")", "will", "panic", ".", "TODO", ":", "socks", "proxies?" ]
[ "func", "NewNetAddress", "(", "addr", "<mask>", ".", "Addr", ")", "*", "NetAddress", "{", "tcpAddr", ",", "ok", ":=", "addr", ".", "(", "*", "net", ".", "TCPAddr", ")", "\n", "if", "!", "ok", "{", "if", "flag", ".", "Lookup", "(", "\"", "\"", ")", "==", "nil", "{", "// normal run", "cmn", ".", "PanicSanity", "(", "cmn", ".", "Fmt", "(", "\"", "\"", ",", "addr", ")", ")", "\n", "}", "else", "{", "// in testing", "return", "NewNetAddressIPPort", "(", "net", ".", "IP", "(", "\"", "\"", ")", ",", "0", ")", "\n", "}", "\n", "}", "\n", "ip", ":=", "tcpAddr", ".", "IP", "\n", "port", ":=", "uint16", "(", "tcpAddr", ".", "Port", ")", "\n", "return", "NewNetAddressIPPort", "(", "ip", ",", "port", ")", "\n", "}" ]
1,293
all-1294
[ "RawRequest", "allows", "you", "to", "make", "any", "request", "you", "want", ".", "This", "will", "automatically", "add", "the", "client", "/", "user", "tokens", ".", "Gives", "back", "exactly", "the", "response", "from", "foursquare", "." ]
[ "func", "(", "c", "*", "Client", ")", "RawRequest", "(", "url", "string", ")", "(", "*", "Response", ",", "*", "http", ".", "Response", ",", "error", ")", "{", "response", ":=", "new", "(", "Response", ")", "\n", "resp", ",", "err", ":=", "c", ".", "sling", ".", "New", "(", ")", ".", "Get", "(", "url", ")", ".", "Receive", "(", "<mask>", ",", "response", ")", "\n", "return", "response", ",", "resp", ",", "relevantError", "(", "err", ",", "*", "response", ")", "\n", "}" ]
1,294
all-1295
[ "GetError", "returns", "reader", "error", "." ]
[ "func", "(", "r", "*", "Reader", ")", "GetError", "(", ")", "error", "{", "err", ":=", "r", ".", "err", "\n", "r", ".", "err", "=", "nil", "\n", "return", "<mask>", "\n", "}" ]
1,295
all-1296
[ "UnmarshalClusterMap", "reads", "a", "map", "[", "string", "]", "Cluster", "in", "yaml", "bytes", "." ]
[ "func", "UnmarshalClusterMap", "(", "data", "[", "]", "byte", ")", "(", "map", "[", "string", "]", "Cluster", ",", "error", ")", "{", "var", "raw", "map", "[", "string", "]", "Cluster", "\n", "if", "err", ":=", "yaml", ".", "Unmarshal", "(", "data", ",", "&", "raw", ")", ";", "err", "!=", "nil", "{", "// If we failed to unmarshal the multicluster format try the single Cluster format.", "var", "singleConfig", "Cluster", "\n", "if", "err", ":=", "yaml", ".", "Unmarshal", "(", "data", ",", "&", "singleConfig", ")", ";", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "raw", "=", "<mask>", "[", "string", "]", "Cluster", "{", "DefaultClusterAlias", ":", "singleConfig", "}", "\n", "}", "\n", "return", "raw", ",", "nil", "\n", "}" ]
1,296
all-1297
[ "Start", "starts", "the", "game", "and", "returns", "immediately", ".", "Different", "from", "ebiten", ".", "Run", "this", "invokes", "only", "the", "game", "loop", "and", "not", "the", "main", "(", "UI", ")", "loop", ".", "The", "unit", "of", "width", "/", "height", "is", "device", "-", "independent", "pixel", "(", "dp", "on", "Android", "and", "point", "on", "iOS", ")", ".", "Start", "is", "concurrent", "-", "safe", ".", "Start", "always", "returns", "nil", "as", "of", "1", ".", "5", ".", "0", "-", "alpha", "." ]
[ "func", "Start", "(", "f", "func", "(", "*", "ebiten", ".", "Image", ")", "error", ",", "width", ",", "height", "int", ",", "scale", "float64", ",", "title", "string", ")", "error", "{", "mobileMutex", ".", "Lock", "(", ")", "\n", "defer", "mobileMutex", ".", "Unlock", "(", ")", "\n\n", "start", "(", "f", ",", "width", ",", "<mask>", ",", "scale", ",", "title", ")", "\n", "return", "nil", "\n", "}" ]
1,297
all-1298
[ "NewMockResponseWriter", "creates", "a", "new", "mock", "instance" ]
[ "func", "NewMockResponseWriter", "(", "ctrl", "*", "gomock", ".", "<mask>", ")", "*", "MockResponseWriter", "{", "mock", ":=", "&", "MockResponseWriter", "{", "ctrl", ":", "ctrl", "}", "\n", "mock", ".", "recorder", "=", "&", "MockResponseWriterMockRecorder", "{", "mock", "}", "\n", "return", "mock", "\n", "}" ]
1,298
all-1299
[ "ActionPath", "computes", "the", "path", "to", "the", "given", "resource", "action", ".", "For", "example", "given", "the", "href", "/", "api", "/", "servers", "/", "123", "calling", "ActionPath", "with", "resource", "servers", "and", "action", "clone", "returns", "the", "path", "/", "api", "/", "servers", "/", "123", "/", "clone", "and", "verb", "POST", ".", "The", "algorithm", "consists", "of", "extracting", "the", "variables", "from", "the", "href", "by", "looking", "up", "a", "matching", "pattern", "from", "the", "resource", "metadata", ".", "The", "variables", "are", "then", "substituted", "in", "the", "action", "path", ".", "If", "there", "are", "more", "than", "one", "pattern", "that", "match", "the", "href", "then", "the", "algorithm", "picks", "the", "one", "that", "can", "substitute", "the", "most", "variables", "." ]
[ "func", "(", "r", "*", "Href", ")", "ActionPath", "(", "rName", ",", "aName", "string", ")", "(", "*", "<mask>", ".", "ActionPath", ",", "error", ")", "{", "res", ",", "ok", ":=", "GenMetadata", "[", "rName", "]", "\n", "if", "!", "ok", "{", "return", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "rName", ")", "\n", "}", "\n", "var", "action", "*", "metadata", ".", "Action", "\n", "for", "_", ",", "a", ":=", "range", "res", ".", "Actions", "{", "if", "a", ".", "Name", "==", "aName", "{", "action", "=", "a", "\n", "break", "\n", "}", "\n", "}", "\n", "if", "action", "==", "nil", "{", "return", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "aName", ",", "rName", ")", "\n", "}", "\n", "vars", ",", "err", ":=", "res", ".", "ExtractVariables", "(", "string", "(", "*", "r", ")", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "return", "action", ".", "URL", "(", "vars", ")", "\n", "}" ]
1,299
all-1300
[ "title", ":", "role", "list", "path", ":", "/", "roles", "method", ":", "GET", "produce", ":", "application", "/", "json", "responses", ":", "200", ":", "OK", "401", ":", "Unauthorized" ]
[ "func", "listRoles", "(", "w", "http", ".", "ResponseWriter", ",", "r", "*", "http", ".", "Request", ",", "t", "auth", ".", "Token", ")", "error", "{", "if", "!", "(", "permission", ".", "Check", "(", "t", ",", "permission", ".", "PermRoleUpdate", ")", "||", "permission", ".", "Check", "(", "t", ",", "permission", ".", "PermRoleUpdateAssign", ")", "||", "permission", ".", "Check", "(", "t", ",", "permission", ".", "PermRoleUpdateDissociate", ")", "||", "permission", ".", "Check", "(", "t", ",", "permission", ".", "PermRoleCreate", ")", "||", "permission", ".", "Check", "(", "t", ",", "permission", ".", "PermRoleDelete", ")", ")", "{", "return", "permission", ".", "ErrUnauthorized", "\n", "}", "\n", "roles", ",", "err", ":=", "permission", ".", "ListRoles", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "b", ",", "err", ":=", "json", ".", "Marshal", "(", "roles", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "w", ".", "<mask>", "(", ")", ".", "Set", "(", "\"", "\"", ",", "\"", "\"", ")", "\n", "_", ",", "err", "=", "w", ".", "Write", "(", "b", ")", "\n", "return", "err", "\n", "}" ]