id
int32
0
25.3k
idx
stringlengths
5
9
nl_tokens
listlengths
1
418
pl_tokens
listlengths
22
4.98k
20,200
all-20201
[ "Write", "writes", "argument", "data", "breaking", "it", "into", "fragments", "as", "needed" ]
[ "func", "(", "w", "*", "fragmentingWriter", ")", "Write", "(", "b", "[", "]", "byte", ")", "(", "int", ",", "error", ")", "{", "if", "w", ".", "err", "!=", "nil", "{", "return", "0", ",", "w", ".", "err", "\n", "}", "\n\n", "if", "!", "w", ".", "<mask>", ".", "isWritingArgument", "(", ")", "{", "w", ".", "err", "=", "errNotWritingArgument", "\n", "return", "0", ",", "w", ".", "err", "\n", "}", "\n\n", "totalWritten", ":=", "0", "\n", "for", "{", "bytesWritten", ":=", "w", ".", "curChunk", ".", "writeAsFits", "(", "b", ")", "\n", "totalWritten", "+=", "bytesWritten", "\n", "if", "bytesWritten", "==", "len", "(", "b", ")", "{", "// The whole thing fit, we're done", "return", "totalWritten", ",", "nil", "\n", "}", "\n\n", "// There was more data than fit into the fragment, so flush the current fragment,", "// start a new fragment and chunk, and continue writing", "if", "w", ".", "err", "=", "w", ".", "Flush", "(", ")", ";", "w", ".", "err", "!=", "nil", "{", "return", "totalWritten", ",", "w", ".", "err", "\n", "}", "\n\n", "b", "=", "b", "[", "bytesWritten", ":", "]", "\n", "}", "\n", "}" ]
20,201
all-20202
[ "GetPalette", "returns", "the", "Palette", "field", "if", "non", "-", "nil", "zero", "value", "otherwise", "." ]
[ "func", "(", "w", "*", "WidgetRequestStyle", ")", "GetPalette", "(", ")", "<mask>", "{", "if", "w", "==", "nil", "||", "w", ".", "Palette", "==", "nil", "{", "return", "\"", "\"", "\n", "}", "\n", "return", "*", "w", ".", "Palette", "\n", "}" ]
20,202
all-20203
[ "EnterExclusive", "acquires", "a", "lock", "on", "the", "cluster", "db", "so", "any", "successive", "call", "to", "Transaction", "will", "block", "until", "ExitExclusive", "has", "been", "called", "." ]
[ "func", "(", "c", "*", "Cluster", ")", "EnterExclusive", "(", ")", "error", "{", "logger", ".", "Debug", "(", "\"", "\"", ")", "\n\n", "ch", ":=", "<mask>", "(", "chan", "struct", "{", "}", ")", "\n", "go", "func", "(", ")", "{", "c", ".", "mu", ".", "Lock", "(", ")", "\n", "ch", "<-", "struct", "{", "}", "{", "}", "\n", "}", "(", ")", "\n\n", "timeout", ":=", "20", "*", "time", ".", "Second", "\n", "select", "{", "case", "<-", "ch", ":", "return", "nil", "\n", "case", "<-", "time", ".", "After", "(", "timeout", ")", ":", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "timeout", ")", "\n", "}", "\n", "}" ]
20,203
all-20204
[ "Commit", "commits", "a", "previous", "tx", "and", "begins", "a", "new", "writable", "one", "." ]
[ "func", "(", "t", "*", "batchTx", ")", "Commit", "(", ")", "{", "t", ".", "Lock", "(", ")", "\n", "t", ".", "commit", "(", "<mask>", ")", "\n", "t", ".", "Unlock", "(", ")", "\n", "}" ]
20,204
all-20205
[ "processExternalLabels", "merges", "externalLabels", "into", "ls", ".", "If", "ls", "contains", "a", "label", "in", "externalLabels", "the", "value", "in", "ls", "wins", "." ]
[ "func", "processExternalLabels", "(", "ls", "tsdbLabels", ".", "Labels", ",", "externalLabels", "labels", ".", "Labels", ")", "labels", ".", "Labels", "{", "i", ",", "j", ",", "result", ":=", "0", ",", "0", ",", "make", "(", "labels", ".", "Labels", ",", "0", ",", "len", "(", "ls", ")", "+", "len", "(", "externalLabels", ")", ")", "\n", "for", "i", "<", "len", "(", "ls", ")", "&&", "j", "<", "len", "(", "externalLabels", ")", "{", "if", "ls", "[", "i", "]", ".", "Name", "<", "externalLabels", "[", "j", "]", ".", "Name", "{", "result", "=", "append", "(", "result", ",", "labels", ".", "Label", "{", "Name", ":", "ls", "[", "i", "]", ".", "Name", ",", "Value", ":", "ls", "[", "i", "]", ".", "Value", ",", "}", ")", "\n", "i", "++", "\n", "}", "else", "if", "ls", "[", "i", "]", ".", "Name", ">", "externalLabels", "[", "j", "]", ".", "Name", "{", "result", "=", "append", "(", "result", ",", "externalLabels", "[", "j", "]", ")", "\n", "j", "++", "\n", "}", "else", "{", "result", "=", "append", "(", "result", ",", "labels", ".", "Label", "{", "Name", ":", "ls", "[", "i", "]", ".", "Name", ",", "Value", ":", "ls", "[", "i", "]", ".", "Value", ",", "}", ")", "\n", "i", "++", "\n", "j", "++", "\n", "}", "\n", "}", "\n", "for", ";", "i", "<", "len", "(", "ls", ")", ";", "i", "++", "{", "result", "=", "<mask>", "(", "result", ",", "labels", ".", "Label", "{", "Name", ":", "ls", "[", "i", "]", ".", "Name", ",", "Value", ":", "ls", "[", "i", "]", ".", "Value", ",", "}", ")", "\n", "}", "\n", "result", "=", "append", "(", "result", ",", "externalLabels", "[", "j", ":", "]", "...", ")", "\n", "return", "result", "\n", "}" ]
20,205
all-20206
[ "Error", "calls", "fmt", ".", "Println", "for", "of", "every", "error", "in", "the", "list", "and", "returns", "the", "concernated", "text", ".", "Can", "be", "called", "for", "a", "nil", "ErrorList", "." ]
[ "func", "(", "list", "ErrorList", ")", "<mask>", "(", ")", "string", "{", "if", "len", "(", "list", ")", "==", "0", "{", "return", "\"", "\"", "\n", "}", "\n", "var", "b", "strings", ".", "Builder", "\n", "for", "_", ",", "err", ":=", "range", "list", "{", "fmt", ".", "Fprintln", "(", "&", "b", ",", "err", ")", "\n", "}", "\n", "return", "b", ".", "String", "(", ")", "\n", "}" ]
20,206
all-20207
[ "baseConfig", "is", "called", "on", "initial", "TLS", "handshake", "start", ".", "Previously", "1", ".", "Server", "has", "non", "-", "empty", "(", "*", "tls", ".", "Config", ")", ".", "Certificates", "on", "client", "hello", "2", ".", "Server", "calls", "(", "*", "tls", ".", "Config", ")", ".", "GetCertificate", "iff", ":", "-", "Server", "s", "(", "*", "tls", ".", "Config", ")", ".", "Certificates", "is", "not", "empty", "or", "-", "Client", "supplies", "SNI", ";", "non", "-", "empty", "(", "*", "tls", ".", "ClientHelloInfo", ")", ".", "ServerName", "When", "(", "*", "tls", ".", "Config", ")", ".", "Certificates", "is", "always", "populated", "on", "initial", "handshake", "client", "is", "expected", "to", "provide", "a", "valid", "matching", "SNI", "to", "pass", "the", "TLS", "verification", "thus", "trigger", "server", "(", "*", "tls", ".", "Config", ")", ".", "GetCertificate", "to", "reload", "TLS", "assets", ".", "However", "a", "cert", "whose", "SAN", "field", "does", "not", "include", "domain", "names", "but", "only", "IP", "addresses", "has", "empty", "(", "*", "tls", ".", "ClientHelloInfo", ")", ".", "ServerName", "thus", "it", "was", "never", "able", "to", "trigger", "TLS", "reload", "on", "initial", "handshake", ";", "first", "ceritifcate", "object", "was", "being", "used", "never", "being", "updated", ".", "Now", "(", "*", "tls", ".", "Config", ")", ".", "Certificates", "is", "created", "empty", "on", "initial", "TLS", "client", "handshake", "in", "order", "to", "trigger", "(", "*", "tls", ".", "Config", ")", ".", "GetCertificate", "and", "populate", "rest", "of", "the", "certificates", "on", "every", "new", "TLS", "connection", "even", "when", "client", "SNI", "is", "empty", "(", "e", ".", "g", ".", "cert", "only", "includes", "IPs", ")", "." ]
[ "func", "(", "info", "TLSInfo", ")", "baseConfig", "(", ")", "(", "*", "tls", ".", "Config", ",", "error", ")", "{", "if", "info", ".", "KeyFile", "==", "\"", "\"", "||", "info", ".", "CertFile", "==", "\"", "\"", "{", "return", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "info", ".", "KeyFile", ",", "info", ".", "CertFile", ")", "\n", "}", "\n", "if", "info", ".", "Logger", "==", "nil", "{", "<mask>", ".", "Logger", "=", "zap", ".", "NewNop", "(", ")", "\n", "}", "\n\n", "_", ",", "err", ":=", "tlsutil", ".", "NewCert", "(", "info", ".", "CertFile", ",", "info", ".", "KeyFile", ",", "info", ".", "parseFunc", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "cfg", ":=", "&", "tls", ".", "Config", "{", "MinVersion", ":", "tls", ".", "VersionTLS12", ",", "ServerName", ":", "info", ".", "ServerName", ",", "}", "\n\n", "if", "len", "(", "info", ".", "CipherSuites", ")", ">", "0", "{", "cfg", ".", "CipherSuites", "=", "info", ".", "CipherSuites", "\n", "}", "\n\n", "if", "info", ".", "AllowedCN", "!=", "\"", "\"", "{", "cfg", ".", "VerifyPeerCertificate", "=", "func", "(", "rawCerts", "[", "]", "[", "]", "byte", ",", "verifiedChains", "[", "]", "[", "]", "*", "x509", ".", "Certificate", ")", "error", "{", "for", "_", ",", "chains", ":=", "range", "verifiedChains", "{", "if", "len", "(", "chains", ")", "!=", "0", "{", "if", "info", ".", "AllowedCN", "==", "chains", "[", "0", "]", ".", "Subject", ".", "CommonName", "{", "return", "nil", "\n", "}", "\n", "}", "\n", "}", "\n", "return", "errors", ".", "New", "(", "\"", "\"", ")", "\n", "}", "\n", "}", "\n\n", "// this only reloads certs when there's a client request", "// TODO: support server-side refresh (e.g. inotify, SIGHUP), caching", "cfg", ".", "GetCertificate", "=", "func", "(", "clientHello", "*", "tls", ".", "ClientHelloInfo", ")", "(", "cert", "*", "tls", ".", "Certificate", ",", "err", "error", ")", "{", "cert", ",", "err", "=", "tlsutil", ".", "NewCert", "(", "info", ".", "CertFile", ",", "info", ".", "KeyFile", ",", "info", ".", "parseFunc", ")", "\n", "if", "os", ".", "IsNotExist", "(", "err", ")", "{", "if", "info", ".", "Logger", "!=", "nil", "{", "info", ".", "Logger", ".", "Warn", "(", "\"", "\"", ",", "zap", ".", "String", "(", "\"", "\"", ",", "info", ".", "CertFile", ")", ",", "zap", ".", "String", "(", "\"", "\"", ",", "info", ".", "KeyFile", ")", ",", "zap", ".", "Error", "(", "err", ")", ",", ")", "\n", "}", "\n", "}", "else", "if", "err", "!=", "nil", "{", "if", "info", ".", "Logger", "!=", "nil", "{", "info", ".", "Logger", ".", "Warn", "(", "\"", "\"", ",", "zap", ".", "String", "(", "\"", "\"", ",", "info", ".", "CertFile", ")", ",", "zap", ".", "String", "(", "\"", "\"", ",", "info", ".", "KeyFile", ")", ",", "zap", ".", "Error", "(", "err", ")", ",", ")", "\n", "}", "\n", "}", "\n", "return", "cert", ",", "err", "\n", "}", "\n", "cfg", ".", "GetClientCertificate", "=", "func", "(", "unused", "*", "tls", ".", "CertificateRequestInfo", ")", "(", "cert", "*", "tls", ".", "Certificate", ",", "err", "error", ")", "{", "cert", ",", "err", "=", "tlsutil", ".", "NewCert", "(", "info", ".", "CertFile", ",", "info", ".", "KeyFile", ",", "info", ".", "parseFunc", ")", "\n", "if", "os", ".", "IsNotExist", "(", "err", ")", "{", "if", "info", ".", "Logger", "!=", "nil", "{", "info", ".", "Logger", ".", "Warn", "(", "\"", "\"", ",", "zap", ".", "String", "(", "\"", "\"", ",", "info", ".", "CertFile", ")", ",", "zap", ".", "String", "(", "\"", "\"", ",", "info", ".", "KeyFile", ")", ",", "zap", ".", "Error", "(", "err", ")", ",", ")", "\n", "}", "\n", "}", "else", "if", "err", "!=", "nil", "{", "if", "info", ".", "Logger", "!=", "nil", "{", "info", ".", "Logger", ".", "Warn", "(", "\"", "\"", ",", "zap", ".", "String", "(", "\"", "\"", ",", "info", ".", "CertFile", ")", ",", "zap", ".", "String", "(", "\"", "\"", ",", "info", ".", "KeyFile", ")", ",", "zap", ".", "Error", "(", "err", ")", ",", ")", "\n", "}", "\n", "}", "\n", "return", "cert", ",", "err", "\n", "}", "\n", "return", "cfg", ",", "nil", "\n", "}" ]
20,207
all-20208
[ "Trending", "returns", "a", "list", "of", "venues", "near", "the", "current", "location", "with", "the", "most", "people", "currently", "checked", "in", ".", "https", ":", "//", "developer", ".", "foursquare", ".", "com", "/", "docs", "/", "api", "/", "venues", "/", "trending" ]
[ "func", "(", "s", "*", "VenueService", ")", "Trending", "(", "params", "*", "VenueTrendingParams", ")", "(", "[", "]", "Venue", ",", "*", "http", ".", "Response", ",", "error", ")", "{", "venues", ":=", "new", "(", "venueTrendingResp", ")", "\n", "response", ":=", "new", "(", "Response", ")", "\n\n", "resp", ",", "err", ":=", "s", ".", "sling", ".", "New", "(", ")", ".", "Get", "(", "\"", "\"", ")", ".", "QueryStruct", "(", "params", ")", ".", "Receive", "(", "response", ",", "response", ")", "\n", "if", "err", "==", "nil", "{", "json", ".", "Unmarshal", "(", "<mask>", ".", "Response", ",", "venues", ")", "\n", "}", "\n\n", "return", "venues", ".", "Venues", ",", "resp", ",", "relevantError", "(", "err", ",", "*", "response", ")", "\n", "}" ]
20,208
all-20209
[ "Commit", "marks", "the", "process", "of", "storing", "the", "image", "as", "successful", "and", "asks", "for", "the", "image", "to", "be", "persisted", ".", "WARNING", ":", "This", "does", "not", "have", "any", "transactional", "semantics", ":", "-", "Uploaded", "data", "MAY", "be", "visible", "to", "others", "before", "Commit", "()", "is", "called", "-", "Uploaded", "data", "MAY", "be", "removed", "or", "MAY", "remain", "around", "if", "Close", "()", "is", "called", "without", "Commit", "()", "(", "i", ".", "e", ".", "rollback", "is", "allowed", "but", "not", "guaranteed", ")" ]
[ "func", "(", "d", "*", "archiveImageDestination", ")", "Commit", "(", "ctx", "<mask>", ".", "Context", ")", "error", "{", "return", "d", ".", "Destination", ".", "Commit", "(", "ctx", ")", "\n", "}" ]
20,209
all-20210
[ "GetDoubleWithDefault", "()", "is", "a", "wrapper", "around", "gtk_print_settings_get_double_with_default", "()", "." ]
[ "func", "(", "ps", "*", "PrintSettings", ")", "GetDoubleWithDefault", "(", "<mask>", "string", ",", "def", "float64", ")", "float64", "{", "cstr", ":=", "C", ".", "CString", "(", "key", ")", "\n", "defer", "C", ".", "free", "(", "unsafe", ".", "Pointer", "(", "cstr", ")", ")", "\n", "c", ":=", "C", ".", "gtk_print_settings_get_double_with_default", "(", "ps", ".", "native", "(", ")", ",", "(", "*", "C", ".", "gchar", ")", "(", "cstr", ")", ",", "C", ".", "gdouble", "(", "def", ")", ")", "\n", "return", "float64", "(", "c", ")", "\n", "}" ]
20,210
all-20211
[ "UnmarshalJSON", "supports", "json", ".", "Unmarshaler", "interface" ]
[ "func", "(", "v", "*", "RemoveNodeParams", ")", "UnmarshalJSON", "(", "data", "[", "]", "byte", ")", "error", "{", "r", ":=", "jlexer", ".", "Lexer", "{", "Data", ":", "data", "}", "\n", "easyjsonC5a4559bDecodeGithubComChromedpCdprotoDom15", "(", "&", "r", ",", "v", ")", "\n", "return", "r", ".", "<mask>", "(", ")", "\n", "}" ]
20,211
all-20212
[ "HasLabel", "checks", "if", "an", "issue", "has", "a", "given", "label", "." ]
[ "func", "(", "i", "Issue", ")", "HasLabel", "(", "labelToFind", "string", ")", "bool", "{", "for", "_", ",", "label", ":=", "range", "i", ".", "Labels", "{", "if", "strings", ".", "ToLower", "(", "label", ".", "Name", ")", "==", "strings", ".", "ToLower", "(", "labelToFind", ")", "{", "return", "<mask>", "\n", "}", "\n", "}", "\n", "return", "false", "\n", "}" ]
20,212
all-20213
[ "NewManageOfferSuccessResultOffer", "creates", "a", "new", "ManageOfferSuccessResultOffer", "." ]
[ "func", "NewManageOfferSuccessResultOffer", "(", "effect", "ManageOfferEffect", ",", "value", "interface", "{", "}", ")", "(", "result", "ManageOfferSuccessResultOffer", ",", "err", "error", ")", "{", "result", ".", "Effect", "=", "effect", "\n", "switch", "ManageOfferEffect", "(", "effect", ")", "{", "case", "ManageOfferEffectManageOfferCreated", ":", "tv", ",", "ok", ":=", "value", ".", "(", "OfferEntry", ")", "\n", "if", "!", "ok", "{", "err", "=", "fmt", ".", "Errorf", "(", "\"", "\"", ")", "\n", "return", "\n", "}", "\n", "result", ".", "Offer", "=", "&", "tv", "\n", "case", "ManageOfferEffectManageOfferUpdated", ":", "tv", ",", "ok", ":=", "value", ".", "(", "OfferEntry", ")", "\n", "if", "!", "ok", "{", "err", "=", "fmt", ".", "Errorf", "(", "\"", "\"", ")", "\n", "return", "\n", "}", "\n", "<mask>", ".", "Offer", "=", "&", "tv", "\n", "default", ":", "// void", "}", "\n", "return", "\n", "}" ]
20,213
all-20214
[ "creates", "and", "initializes", "a", "buffer", "object", "s", "immutable", "data", "store" ]
[ "func", "BufferStorage", "(", "target", "uint32", ",", "size", "int", ",", "data", "unsafe", ".", "Pointer", ",", "flags", "uint32", ")", "{", "C", ".", "glowBufferStorage", "(", "gpBufferStorage", ",", "(", "C", ".", "GLenum", ")", "(", "target", ")", ",", "(", "C", ".", "GLsizeiptr", ")", "(", "size", ")", ",", "data", ",", "(", "C", ".", "GLbitfield", ")", "(", "<mask>", ")", ")", "\n", "}" ]
20,214
all-20215
[ "GetMessage", "returns", "the", "Message", "field", "if", "non", "-", "nil", "zero", "value", "otherwise", "." ]
[ "func", "(", "s", "*", "SyntheticsTest", ")", "GetMessage", "(", ")", "string", "{", "if", "s", "==", "nil", "||", "s", ".", "<mask>", "==", "nil", "{", "return", "\"", "\"", "\n", "}", "\n", "return", "*", "s", ".", "Message", "\n", "}" ]
20,215
all-20216
[ "Giving", "a", "value", "a", "multi", "-", "index", "and", "the", "key", "of", "the", "item", "return", "the", "paths", "under", "which", "the", "multi", "-", "index", "items", "should", "be", "stored", "." ]
[ "func", "(", "c", "*", "readWriteCollection", ")", "getMultiIndexPaths", "(", "val", "<mask>", "{", "}", ",", "index", "*", "Index", ",", "key", "string", ")", "[", "]", "string", "{", "var", "indexPaths", "[", "]", "string", "\n", "field", ":=", "reflect", ".", "Indirect", "(", "reflect", ".", "ValueOf", "(", "val", ")", ")", ".", "FieldByName", "(", "index", ".", "Field", ")", "\n", "for", "i", ":=", "0", ";", "i", "<", "field", ".", "Len", "(", ")", ";", "i", "++", "{", "indexPaths", "=", "append", "(", "indexPaths", ",", "c", ".", "indexPath", "(", "index", ",", "field", ".", "Index", "(", "i", ")", ".", "Interface", "(", ")", ",", "key", ")", ")", "\n", "}", "\n", "return", "indexPaths", "\n", "}" ]
20,216
all-20217
[ "contextsToStrings", "converts", "a", "list", "Context", "to", "a", "list", "of", "string" ]
[ "func", "contextsToStrings", "(", "contexts", "[", "]", "Context", ")", "[", "]", "string", "{", "<mask>", "names", "[", "]", "string", "\n", "for", "_", ",", "c", ":=", "range", "contexts", "{", "names", "=", "append", "(", "names", ",", "string", "(", "c", ".", "Context", ")", ")", "\n", "}", "\n", "return", "names", "\n", "}" ]
20,217
all-20218
[ "MutatePayment", "for", "Asset", "sets", "the", "PaymentOp", "s", "Asset", "field" ]
[ "func", "(", "m", "CreditAmount", ")", "MutatePayment", "(", "o", "interface", "{", "}", ")", "(", "err", "error", ")", "{", "switch", "o", ":=", "o", ".", "(", "type", ")", "{", "default", ":", "err", "=", "errors", ".", "New", "(", "\"", "\"", ")", "\n", "case", "*", "xdr", ".", "PaymentOp", ":", "o", ".", "Amount", ",", "err", "=", "amount", ".", "Parse", "(", "m", ".", "Amount", ")", "\n", "if", "err", "!=", "nil", "{", "return", "\n", "}", "\n\n", "o", ".", "<mask>", ",", "err", "=", "createAlphaNumAsset", "(", "m", ".", "Code", ",", "m", ".", "Issuer", ")", "\n", "case", "*", "xdr", ".", "PathPaymentOp", ":", "o", ".", "DestAmount", ",", "err", "=", "amount", ".", "Parse", "(", "m", ".", "Amount", ")", "\n", "if", "err", "!=", "nil", "{", "return", "\n", "}", "\n\n", "o", ".", "DestAsset", ",", "err", "=", "createAlphaNumAsset", "(", "m", ".", "Code", ",", "m", ".", "Issuer", ")", "\n", "}", "\n", "return", "\n", "}" ]
20,218
all-20219
[ "ParseRange", "returns", "a", "new", "range", "object", "and", "nil", "if", "the", "given", "range", "definition", "was", "valid", "or", "nil", "and", "an", "error", "if", "it", "was", "invalid", "." ]
[ "func", "ParseRange", "(", "rangeStr", "string", ")", "(", "*", "Range", ",", "error", ")", "{", "// Set defaults", "t", ":=", "&", "Range", "{", "Start", ":", "0", ",", "End", ":", "math", ".", "Inf", "(", "1", ")", ",", "AlertOnInside", ":", "false", ",", "}", "\n", "// Remove leading and trailing whitespace", "rangeStr", "=", "strings", ".", "Trim", "(", "rangeStr", ",", "\"", "\\n", "\\r", "\"", ")", "\n\n", "// Check for inverted semantics", "if", "rangeStr", "[", "0", "]", "==", "'@'", "{", "t", ".", "AlertOnInside", "=", "true", "\n", "rangeStr", "=", "rangeStr", "[", "1", ":", "]", "\n", "}", "\n\n", "// Parse lower limit", "endPos", ":=", "strings", ".", "Index", "(", "rangeStr", ",", "\"", "\"", ")", "\n", "if", "endPos", ">", "-", "1", "{", "if", "rangeStr", "[", "0", "]", "==", "'~'", "{", "t", ".", "Start", "=", "math", ".", "Inf", "(", "-", "1", ")", "\n", "}", "else", "{", "<mask>", ",", "err", ":=", "strconv", ".", "ParseFloat", "(", "rangeStr", "[", "0", ":", "endPos", "]", ",", "64", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "err", ")", "\n", "}", "\n", "t", ".", "Start", "=", "min", "\n", "}", "\n", "rangeStr", "=", "rangeStr", "[", "endPos", "+", "1", ":", "]", "\n", "}", "\n\n", "// Parse upper limit", "if", "len", "(", "rangeStr", ")", ">", "0", "{", "max", ",", "err", ":=", "strconv", ".", "ParseFloat", "(", "rangeStr", ",", "64", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "err", ")", "\n", "}", "\n", "t", ".", "End", "=", "max", "\n", "}", "\n\n", "if", "t", ".", "End", "<", "t", ".", "Start", "{", "return", "nil", ",", "errors", ".", "New", "(", "\"", "\"", ")", "\n", "}", "\n\n", "// OK", "return", "t", ",", "nil", "\n", "}" ]
20,219
all-20220
[ "Use", "the", "leafHash", "and", "innerHashes", "to", "get", "the", "root", "merkle", "hash", ".", "If", "the", "length", "of", "the", "innerHashes", "slice", "isn", "t", "exactly", "correct", "the", "result", "is", "nil", ".", "Recursive", "impl", "." ]
[ "func", "computeHashFromAunts", "(", "index", "int", ",", "total", "int", ",", "leafHash", "[", "]", "byte", ",", "innerHashes", "[", "]", "[", "]", "byte", ")", "[", "]", "byte", "{", "if", "index", ">=", "total", "||", "index", "<", "0", "||", "total", "<=", "0", "{", "return", "nil", "\n", "}", "\n", "switch", "total", "{", "case", "0", ":", "panic", "(", "\"", "\"", ")", "\n", "<mask>", "1", ":", "if", "len", "(", "innerHashes", ")", "!=", "0", "{", "return", "nil", "\n", "}", "\n", "return", "leafHash", "\n", "default", ":", "if", "len", "(", "innerHashes", ")", "==", "0", "{", "return", "nil", "\n", "}", "\n", "numLeft", ":=", "(", "total", "+", "1", ")", "/", "2", "\n", "if", "index", "<", "numLeft", "{", "leftHash", ":=", "computeHashFromAunts", "(", "index", ",", "numLeft", ",", "leafHash", ",", "innerHashes", "[", ":", "len", "(", "innerHashes", ")", "-", "1", "]", ")", "\n", "if", "leftHash", "==", "nil", "{", "return", "nil", "\n", "}", "\n", "return", "SimpleHashFromTwoHashes", "(", "leftHash", ",", "innerHashes", "[", "len", "(", "innerHashes", ")", "-", "1", "]", ")", "\n", "}", "\n", "rightHash", ":=", "computeHashFromAunts", "(", "index", "-", "numLeft", ",", "total", "-", "numLeft", ",", "leafHash", ",", "innerHashes", "[", ":", "len", "(", "innerHashes", ")", "-", "1", "]", ")", "\n", "if", "rightHash", "==", "nil", "{", "return", "nil", "\n", "}", "\n", "return", "SimpleHashFromTwoHashes", "(", "innerHashes", "[", "len", "(", "innerHashes", ")", "-", "1", "]", ",", "rightHash", ")", "\n", "}", "\n", "}" ]
20,220
all-20221
[ "ReadResponse", "reads", "a", "http", ".", "Response", "from", "the", "given", "readers", "." ]
[ "func", "ReadResponse", "(", "call", "tchannel", ".", "ArgReadable", ")", "(", "*", "http", ".", "Response", ",", "error", ")", "{", "var", "arg2", "[", "]", "byte", "\n", "if", "err", ":=", "tchannel", ".", "NewArgReader", "(", "call", ".", "Arg2Reader", "(", ")", ")", ".", "Read", "(", "&", "arg2", ")", ";", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "rb", ":=", "typed", ".", "NewReadBuffer", "(", "arg2", ")", "\n", "statusCode", ":=", "rb", ".", "ReadUint16", "(", ")", "\n", "message", ":=", "readVarintString", "(", "rb", ")", "\n\n", "response", ":=", "&", "http", ".", "Response", "{", "StatusCode", ":", "int", "(", "statusCode", ")", ",", "Status", ":", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "statusCode", ",", "message", ")", ",", "Proto", ":", "\"", "\"", ",", "ProtoMajor", ":", "1", ",", "ProtoMinor", ":", "1", ",", "<mask>", ":", "make", "(", "http", ".", "Header", ")", ",", "}", "\n", "readHeaders", "(", "rb", ",", "response", ".", "Header", ")", "\n", "if", "err", ":=", "rb", ".", "Err", "(", ")", ";", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "arg3Reader", ",", "err", ":=", "call", ".", "Arg3Reader", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "response", ".", "Body", "=", "arg3Reader", "\n", "return", "response", ",", "nil", "\n", "}" ]
20,221
all-20222
[ "loadTemplate", "parses", "the", "specified", "template", "and", "returns", "it" ]
[ "func", "(", "r", "*", "Render", ")", "loadTemplate", "(", "name", "string", ")", "*", "template", ".", "Template", "{", "tpl", ",", "err", ":=", "<mask>", ".", "ParseFiles", "(", "r", ".", "Files", "[", "name", "]", "...", ")", "\n", "if", "err", "!=", "nil", "{", "panic", "(", "name", "+", "\"", "\"", ")", "\n", "}", "\n", "return", "template", ".", "Must", "(", "tpl", ",", "err", ")", "\n", "}" ]
20,222
all-20223
[ "BackendStatus", "maps", "the", "internal", "container", "status", "in", "the", "agent", "to", "that", "in", "the", "backend" ]
[ "func", "(", "cs", "*", "ContainerStatus", ")", "BackendStatus", "(", "steadyStateStatus", "ContainerStatus", ")", "ContainerStatus", "{", "if", "*", "cs", "==", "steadyStateStatus", "{", "return", "ContainerRunning", "\n", "}", "\n\n", "if", "*", "<mask>", "==", "ContainerStopped", "{", "return", "ContainerStopped", "\n", "}", "\n\n", "return", "ContainerStatusNone", "\n", "}" ]
20,223
all-20224
[ "iinfo", ":", "TypeInfo", "for", "the", "interface", "for", "which", "we", "must", "decode", "a", "concrete", "type", "with", "prefix", "bytes", "pb", "." ]
[ "func", "(", "cdc", "*", "Codec", ")", "getTypeInfoFromPrefix_rlock", "(", "iinfo", "*", "TypeInfo", ",", "pb", "PrefixBytes", ")", "(", "info", "*", "TypeInfo", ",", "err", "error", ")", "{", "// We do not use defer cdc.mtx.Unlock() here due to performance overhead of", "// defer in go1.11 (and prior versions). Ensure new code paths unlock the", "// mutex.", "cdc", ".", "mtx", ".", "RLock", "(", ")", "\n\n", "infos", ",", "ok", ":=", "iinfo", ".", "Implementers", "[", "pb", "]", "\n", "if", "!", "ok", "{", "err", "=", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "pb", ")", "\n", "cdc", ".", "mtx", ".", "RUnlock", "(", ")", "\n", "return", "\n", "}", "\n", "if", "len", "(", "infos", ")", ">", "1", "{", "err", "=", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "pb", ",", "infos", "[", "0", "]", ".", "Type", ",", "infos", "[", "1", "]", ".", "Type", ")", "\n", "cdc", ".", "mtx", ".", "RUnlock", "(", ")", "\n", "return", "\n", "}", "\n", "<mask>", "=", "infos", "[", "0", "]", "\n", "cdc", ".", "mtx", ".", "RUnlock", "(", ")", "\n", "return", "\n", "}" ]
20,224
all-20225
[ "layerPath", "returns", "a", "path", "for", "a", "layer", "tarball", "within", "a", "directory", "using", "our", "conventions", "." ]
[ "func", "(", "<mask>", "dirReference", ")", "layerPath", "(", "digest", "digest", ".", "Digest", ")", "string", "{", "// FIXME: Should we keep the digest identification?", "return", "filepath", ".", "Join", "(", "ref", ".", "path", ",", "digest", ".", "Hex", "(", ")", ")", "\n", "}" ]
20,225
all-20226
[ "Start", "creates", "goroutines", "to", "monitor", "the", "files", "that", "contain", "the", "secret", "value", "." ]
[ "func", "(", "a", "*", "Agent", ")", "Start", "(", "paths", "[", "]", "string", ")", "error", "{", "secretsMap", ",", "err", ":=", "LoadSecrets", "(", "paths", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "a", ".", "secretsMap", "=", "secretsMap", "\n\n", "// Start one goroutine for each file to monitor and update the secret's values.", "for", "secretPath", ":=", "range", "secretsMap", "{", "<mask>", "a", ".", "reloadSecret", "(", "secretPath", ")", "\n", "}", "\n\n", "return", "nil", "\n", "}" ]
20,226
all-20227
[ "createMapKeyValueExpression", "creates", "a", "new", "map", "key", "value", "function", "expression", "of", "the", "form", "{{", "name", "}}", ":", "func", "()", "{", "{{", "namedImport", "}}", ".", "{{", "amalgomatedMain", "}}", "()", "}", ".", "In", "most", "cases", "name", "and", "namedImport", "will", "be", "the", "same", "but", "if", "multiple", "commands", "refer", "to", "the", "same", "package", "then", "the", "commands", "that", "are", "lexicographically", "later", "should", "refer", "to", "the", "named", "import", "of", "the", "first", "command", "." ]
[ "func", "createMapKeyValueExpression", "(", "<mask>", ",", "namedImport", "string", ")", "*", "ast", ".", "KeyValueExpr", "{", "return", "&", "ast", ".", "KeyValueExpr", "{", "Key", ":", "&", "ast", ".", "BasicLit", "{", "Kind", ":", "token", ".", "STRING", ",", "Value", ":", "fmt", ".", "Sprintf", "(", "`\"%v\"`", ",", "name", ")", ",", "}", ",", "Value", ":", "&", "ast", ".", "FuncLit", "{", "Type", ":", "&", "ast", ".", "FuncType", "{", "Params", ":", "&", "ast", ".", "FieldList", "{", "}", ",", "}", ",", "Body", ":", "&", "ast", ".", "BlockStmt", "{", "List", ":", "[", "]", "ast", ".", "Stmt", "{", "&", "ast", ".", "ExprStmt", "{", "X", ":", "&", "ast", ".", "CallExpr", "{", "Fun", ":", "&", "ast", ".", "SelectorExpr", "{", "X", ":", "ast", ".", "NewIdent", "(", "namedImport", ")", ",", "Sel", ":", "ast", ".", "NewIdent", "(", "amalgomatedMain", ")", ",", "}", ",", "}", ",", "}", ",", "}", ",", "}", ",", "}", ",", "}", "\n", "}" ]
20,227
all-20228
[ "WithExecutionContextID", "execution", "context", "in", "which", "to", "resolve", "the", "node", "." ]
[ "func", "(", "p", "ResolveNodeParams", ")", "WithExecutionContextID", "(", "executionContextID", "runtime", ".", "ExecutionContextID", ")", "*", "ResolveNodeParams", "{", "p", ".", "ExecutionContextID", "=", "executionContextID", "\n", "<mask>", "&", "p", "\n", "}" ]
20,228
all-20229
[ "Hash", "is", "an", "option", "for", "Dag", ".", "Put", "which", "specifies", "the", "hash", "function", "to", "use" ]
[ "func", "(", "dagOpts", ")", "Hash", "(", "<mask>", "string", ")", "DagPutOption", "{", "return", "func", "(", "opts", "*", "DagPutSettings", ")", "error", "{", "opts", ".", "Hash", "=", "hash", "\n", "return", "nil", "\n", "}", "\n", "}" ]
20,229
all-20230
[ "ProcessHostCheckResult", "creates", "a", "new", "PROCESS_HOST_CHECK_RESULT", "Nagios", "command", ".", "This", "is", "used", "to", "submit", "a", "passive", "check", "result", "for", "a", "particular", "host", ".", "The", "status_code", "indicates", "the", "state", "of", "the", "host", "check", "and", "should", "be", "one", "of", "the", "following", ":", "0", "=", "UP", "1", "=", "DOWN", "2", "=", "UNREACHABLE", ".", "The", "plugin_output", "argument", "contains", "the", "text", "returned", "from", "the", "host", "check", "along", "with", "optional", "performance", "data", "." ]
[ "func", "ProcessHostCheckResult", "(", "host_name", "string", ",", "status_code", "int", ",", "plugin_output", "<mask>", ",", ")", "*", "livestatus", ".", "Command", "{", "return", "livestatus", ".", "NewCommand", "(", "\"", "\"", ",", "stringifyArg", "(", "\"", "\"", ",", "\"", "\"", ",", "host_name", ")", ",", "stringifyArg", "(", "\"", "\"", ",", "\"", "\"", ",", "status_code", ")", ",", "stringifyArg", "(", "\"", "\"", ",", "\"", "\"", ",", "plugin_output", ")", ",", ")", "\n", "}" ]
20,230
all-20231
[ "FilterValues", "returns", "a", "new", "Option", "where", "opt", "is", "only", "evaluated", "if", "filter", "f", "which", "is", "a", "function", "of", "the", "form", "func", "(", "T", "T", ")", "bool", "returns", "true", "for", "the", "current", "pair", "of", "values", "being", "compared", ".", "If", "either", "value", "is", "invalid", "or", "the", "type", "of", "the", "values", "is", "not", "assignable", "to", "T", "then", "this", "filter", "implicitly", "returns", "false", ".", "The", "filter", "function", "must", "be", "symmetric", "(", "i", ".", "e", ".", "agnostic", "to", "the", "order", "of", "the", "inputs", ")", "and", "deterministic", "(", "i", ".", "e", ".", "produces", "the", "same", "result", "when", "given", "the", "same", "inputs", ")", ".", "If", "T", "is", "an", "interface", "it", "is", "possible", "that", "f", "is", "called", "with", "two", "values", "with", "different", "concrete", "types", "that", "both", "implement", "T", ".", "The", "option", "passed", "in", "may", "be", "an", "Ignore", "Transformer", "Comparer", "Options", "or", "a", "previously", "filtered", "Option", "." ]
[ "func", "FilterValues", "(", "f", "interface", "{", "}", ",", "opt", "Option", ")", "Option", "{", "v", ":=", "reflect", ".", "ValueOf", "(", "f", ")", "\n", "if", "!", "function", ".", "IsType", "(", "v", ".", "Type", "(", ")", ",", "<mask>", ".", "ValueFilter", ")", "||", "v", ".", "IsNil", "(", ")", "{", "panic", "(", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "f", ")", ")", "\n", "}", "\n", "if", "opt", ":=", "normalizeOption", "(", "opt", ")", ";", "opt", "!=", "nil", "{", "vf", ":=", "&", "valuesFilter", "{", "fnc", ":", "v", ",", "opt", ":", "opt", "}", "\n", "if", "ti", ":=", "v", ".", "Type", "(", ")", ".", "In", "(", "0", ")", ";", "ti", ".", "Kind", "(", ")", "!=", "reflect", ".", "Interface", "||", "ti", ".", "NumMethod", "(", ")", ">", "0", "{", "vf", ".", "typ", "=", "ti", "\n", "}", "\n", "return", "vf", "\n", "}", "\n", "return", "nil", "\n", "}" ]
20,231
all-20232
[ "DeepCopy", "copies", "the", "receiver", "into", "a", "new", "Base64", "." ]
[ "func", "(", "b", "*", "Base64", ")", "DeepCopy", "(", ")", "*", "Base64", "{", "if", "b", "==", "nil", "{", "return", "nil", "\n", "}", "\n", "out", ":=", "<mask>", "(", "Base64", ")", "\n", "b", ".", "DeepCopyInto", "(", "out", ")", "\n", "return", "out", "\n", "}" ]
20,232
all-20233
[ "InputName", "computes", "the", "name", "of", "an", "Input", "." ]
[ "func", "InputName", "(", "input", "*", "Input", ")", "string", "{", "switch", "{", "case", "input", "==", "nil", ":", "return", "\"", "\"", "\n", "case", "input", ".", "Pfs", "!=", "nil", ":", "return", "input", ".", "Pfs", ".", "Name", "\n", "case", "input", ".", "Cross", "!=", "nil", ":", "if", "len", "(", "<mask>", ".", "Cross", ")", ">", "0", "{", "return", "InputName", "(", "input", ".", "Cross", "[", "0", "]", ")", "\n", "}", "\n", "case", "input", ".", "Union", "!=", "nil", ":", "if", "len", "(", "input", ".", "Union", ")", ">", "0", "{", "return", "InputName", "(", "input", ".", "Union", "[", "0", "]", ")", "\n", "}", "\n", "}", "\n", "return", "\"", "\"", "\n", "}" ]
20,233
all-20234
[ "MarshalJSON", "supports", "json", ".", "Marshaler", "interface" ]
[ "func", "(", "v", "GetEncodedResponseReturns", ")", "MarshalJSON", "(", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "w", ":=", "jwriter", ".", "<mask>", "{", "}", "\n", "easyjsonC5a4559bEncodeGithubComChromedpCdprotoAudits", "(", "&", "w", ",", "v", ")", "\n", "return", "w", ".", "Buffer", ".", "BuildBytes", "(", ")", ",", "w", ".", "Error", "\n", "}" ]
20,234
all-20235
[ "AppendHTMLEscape", "appends", "html", "-", "escaped", "s", "to", "dst", "and", "returns", "the", "extended", "dst", "." ]
[ "func", "AppendHTMLEscape", "(", "dst", "[", "]", "byte", ",", "s", "string", ")", "[", "]", "byte", "{", "if", "strings", ".", "IndexByte", "(", "s", ",", "'<'", ")", "<", "0", "&&", "strings", ".", "IndexByte", "(", "s", ",", "'>'", ")", "<", "0", "&&", "strings", ".", "IndexByte", "(", "s", ",", "'\"'", ")", "<", "0", "&&", "strings", ".", "IndexByte", "(", "s", ",", "'\\''", ")", "<", "0", "{", "// fast path - nothing to escape", "return", "append", "(", "dst", ",", "s", "...", ")", "\n", "}", "\n\n", "// slow path", "var", "prev", "int", "\n", "var", "sub", "string", "\n", "for", "i", ",", "n", ":=", "0", ",", "len", "(", "s", ")", ";", "i", "<", "n", ";", "i", "++", "{", "sub", "=", "\"", "\"", "\n", "switch", "s", "[", "i", "]", "{", "case", "'<'", ":", "sub", "=", "\"", "\"", "\n", "case", "'>'", ":", "<mask>", "=", "\"", "\"", "\n", "case", "'\"'", ":", "sub", "=", "\"", "\"", "\n", "case", "'\\''", ":", "sub", "=", "\"", "\"", "\n", "}", "\n", "if", "len", "(", "sub", ")", ">", "0", "{", "dst", "=", "append", "(", "dst", ",", "s", "[", "prev", ":", "i", "]", "...", ")", "\n", "dst", "=", "append", "(", "dst", ",", "sub", "...", ")", "\n", "prev", "=", "i", "+", "1", "\n", "}", "\n", "}", "\n", "return", "append", "(", "dst", ",", "s", "[", "prev", ":", "]", "...", ")", "\n", "}" ]
20,235
all-20236
[ "DropPrefix", "would", "drop", "all", "the", "keys", "with", "the", "provided", "prefix", ".", "It", "does", "this", "in", "the", "following", "way", ":", "-", "Stop", "accepting", "new", "writes", ".", "-", "Stop", "memtable", "flushes", "and", "compactions", ".", "-", "Flush", "out", "all", "memtables", "skipping", "over", "keys", "with", "the", "given", "prefix", "Kp", ".", "-", "Write", "out", "the", "value", "log", "header", "to", "memtables", "when", "flushing", "so", "we", "don", "t", "accidentally", "bring", "Kp", "back", "after", "a", "restart", ".", "-", "Compact", "L0", "-", ">", "L1", "skipping", "over", "Kp", ".", "-", "Compact", "rest", "of", "the", "levels", "Li", "-", ">", "Li", "picking", "tables", "which", "have", "Kp", ".", "-", "Resume", "memtable", "flushes", "compactions", "and", "writes", "." ]
[ "func", "(", "db", "*", "DB", ")", "DropPrefix", "(", "prefix", "[", "]", "byte", ")", "error", "{", "db", ".", "opt", ".", "Infof", "(", "\"", "\"", ",", "hex", ".", "Dump", "(", "prefix", ")", ")", "\n", "f", ":=", "<mask>", ".", "prepareToDrop", "(", ")", "\n", "defer", "f", "(", ")", "\n\n", "// Block all foreign interactions with memory tables.", "db", ".", "Lock", "(", ")", "\n", "defer", "db", ".", "Unlock", "(", ")", "\n\n", "db", ".", "imm", "=", "append", "(", "db", ".", "imm", ",", "db", ".", "mt", ")", "\n", "for", "_", ",", "memtable", ":=", "range", "db", ".", "imm", "{", "if", "memtable", ".", "Empty", "(", ")", "{", "memtable", ".", "DecrRef", "(", ")", "\n", "continue", "\n", "}", "\n", "task", ":=", "flushTask", "{", "mt", ":", "memtable", ",", "// Ensure that the head of value log gets persisted to disk.", "vptr", ":", "db", ".", "vhead", ",", "dropPrefix", ":", "prefix", ",", "}", "\n", "db", ".", "opt", ".", "Debugf", "(", "\"", "\"", ")", "\n", "if", "err", ":=", "db", ".", "handleFlushTask", "(", "task", ")", ";", "err", "!=", "nil", "{", "db", ".", "opt", ".", "Errorf", "(", "\"", "\"", ",", "err", ")", "\n", "return", "err", "\n", "}", "\n", "memtable", ".", "DecrRef", "(", ")", "\n", "}", "\n", "db", ".", "imm", "=", "db", ".", "imm", "[", ":", "0", "]", "\n", "db", ".", "mt", "=", "skl", ".", "NewSkiplist", "(", "arenaSize", "(", "db", ".", "opt", ")", ")", "\n\n", "// Drop prefixes from the levels.", "if", "err", ":=", "db", ".", "lc", ".", "dropPrefix", "(", "prefix", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "db", ".", "opt", ".", "Infof", "(", "\"", "\"", ")", "\n", "return", "nil", "\n", "}" ]
20,236
all-20237
[ "pushByte", "puts", "a", "byte", "on", "the", "heap", "and", "returns", "a", "state", ".", "succ", "index", "that", "can", "be", "used", "to", "retrieve", "it", "." ]
[ "func", "(", "a", "*", "subAllocator", ")", "pushByte", "(", "c", "byte", ")", "int32", "{", "si", ":=", "a", ".", "heap1Lo", "/", "6", "// state index", "\n", "oi", ":=", "a", ".", "heap1Lo", "%", "6", "// byte position in state", "\n", "switch", "oi", "{", "case", "0", ":", "a", ".", "states", "[", "si", "]", ".", "sym", "=", "c", "\n", "case", "1", ":", "a", ".", "states", "[", "si", "]", ".", "freq", "=", "c", "\n", "default", ":", "n", ":=", "(", "uint", "(", "oi", ")", "-", "2", ")", "*", "8", "\n", "mask", ":=", "^", "(", "uint32", "(", "0xFF", ")", "<<", "n", ")", "\n", "succ", ":=", "uint32", "(", "a", ".", "states", "[", "si", "]", ".", "succ", ")", "&", "<mask>", "\n", "succ", "|=", "uint32", "(", "c", ")", "<<", "n", "\n", "a", ".", "states", "[", "si", "]", ".", "succ", "=", "int32", "(", "succ", ")", "\n", "}", "\n", "a", ".", "heap1Lo", "++", "\n", "if", "a", ".", "heap1Lo", ">=", "a", ".", "heap1Hi", "{", "return", "0", "\n", "}", "\n", "return", "-", "a", ".", "heap1Lo", "\n", "}" ]
20,237
all-20238
[ "CONTRACT", ":", "rv", ".", "CanAddr", "()", "is", "true", "." ]
[ "func", "(", "cdc", "*", "Codec", ")", "decodeReflectJSONArray", "(", "bz", "[", "]", "byte", ",", "info", "*", "TypeInfo", ",", "rv", "reflect", ".", "Value", ",", "fopts", "FieldOptions", ")", "(", "err", "error", ")", "{", "if", "!", "rv", ".", "CanAddr", "(", ")", "{", "panic", "(", "\"", "\"", ")", "\n", "}", "\n", "if", "printLog", "{", "fmt", ".", "Println", "(", "\"", "\"", ")", "\n", "defer", "func", "(", ")", "{", "fmt", ".", "Printf", "(", "\"", "\\n", "\"", ",", "err", ")", "\n", "}", "(", ")", "\n", "}", "\n", "ert", ":=", "info", ".", "Type", ".", "Elem", "(", ")", "\n", "length", ":=", "info", ".", "Type", ".", "Len", "(", ")", "\n\n", "<mask>", "ert", ".", "Kind", "(", ")", "{", "case", "reflect", ".", "Uint8", ":", "// Special case: byte array", "var", "buf", "[", "]", "byte", "\n", "err", "=", "json", ".", "Unmarshal", "(", "bz", ",", "&", "buf", ")", "\n", "if", "err", "!=", "nil", "{", "return", "\n", "}", "\n", "if", "len", "(", "buf", ")", "!=", "length", "{", "err", "=", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "len", "(", "buf", ")", ",", "length", ")", "\n", "}", "\n", "reflect", ".", "Copy", "(", "rv", ",", "reflect", ".", "ValueOf", "(", "buf", ")", ")", "\n", "return", "\n\n", "default", ":", "// General case.", "var", "einfo", "*", "TypeInfo", "\n", "einfo", ",", "err", "=", "cdc", ".", "getTypeInfo_wlock", "(", "ert", ")", "\n", "if", "err", "!=", "nil", "{", "return", "\n", "}", "\n\n", "// Read into rawSlice.", "var", "rawSlice", "[", "]", "json", ".", "RawMessage", "\n", "if", "err", "=", "json", ".", "Unmarshal", "(", "bz", ",", "&", "rawSlice", ")", ";", "err", "!=", "nil", "{", "return", "\n", "}", "\n", "if", "len", "(", "rawSlice", ")", "!=", "length", "{", "err", "=", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "len", "(", "rawSlice", ")", ",", "length", ")", "\n", "return", "\n", "}", "\n\n", "// Decode each item in rawSlice.", "for", "i", ":=", "0", ";", "i", "<", "length", ";", "i", "++", "{", "erv", ":=", "rv", ".", "Index", "(", "i", ")", "\n", "ebz", ":=", "rawSlice", "[", "i", "]", "\n", "err", "=", "cdc", ".", "decodeReflectJSON", "(", "ebz", ",", "einfo", ",", "erv", ",", "fopts", ")", "\n", "if", "err", "!=", "nil", "{", "return", "\n", "}", "\n", "}", "\n", "return", "\n", "}", "\n", "}" ]
20,238
all-20239
[ "SetMetadataFileUpdated", "sets", "the", "container", "s", "MetadataFileUpdated", "status", "to", "true" ]
[ "func", "(", "c", "*", "Container", ")", "SetMetadataFileUpdated", "(", ")", "{", "c", ".", "lock", ".", "Lock", "(", ")", "\n", "defer", "c", ".", "<mask>", ".", "Unlock", "(", ")", "\n\n", "c", ".", "MetadataFileUpdated", "=", "true", "\n", "}" ]
20,239
all-20240
[ "TagResourceRequest", "mocks", "base", "method" ]
[ "func", "(", "m", "*", "MockSecretsManagerAPI", ")", "TagResourceRequest", "(", "arg0", "*", "secretsmanager", ".", "TagResourceInput", ")", "(", "*", "request", ".", "Request", ",", "*", "secretsmanager", ".", "TagResourceOutput", ")", "{", "ret", ":=", "m", ".", "ctrl", ".", "Call", "(", "m", ",", "\"", "\"", ",", "arg0", ")", "\n", "ret0", ",", "_", ":=", "ret", "[", "0", "]", ".", "(", "*", "request", ".", "<mask>", ")", "\n", "ret1", ",", "_", ":=", "ret", "[", "1", "]", ".", "(", "*", "secretsmanager", ".", "TagResourceOutput", ")", "\n", "return", "ret0", ",", "ret1", "\n", "}" ]
20,240
all-20241
[ "DeriveConcatKDF", "implements", "NIST", "SP", "800", "-", "56A", "Concatenation", "Key", "Derivation", "Function", ".", "Derives", "key", "material", "of", "keydatalen", "bits", "size", "given", "Z", "(", "sharedSecret", ")", "OtherInfo", "(", "AlgorithmID", "|", "PartyUInfo", "|", "PartyVInfo", "|", "SuppPubInfo", "|", "SuppPrivInfo", ")", "and", "hash", "function" ]
[ "func", "DeriveConcatKDF", "(", "keydatalen", "int", ",", "sharedSecret", ",", "algId", ",", "partyUInfo", ",", "partyVInfo", ",", "suppPubInfo", ",", "suppPrivInfo", "[", "]", "byte", ",", "h", "hash", ".", "Hash", ")", "[", "]", "byte", "{", "otherInfo", ":=", "arrays", ".", "Concat", "(", "algId", ",", "partyUInfo", ",", "partyVInfo", ",", "suppPubInfo", ",", "suppPrivInfo", ")", "\n", "keyLenBytes", ":=", "keydatalen", ">>", "3", "\n", "reps", ":=", "int", "(", "math", ".", "Ceil", "(", "float64", "(", "keyLenBytes", ")", "/", "float64", "(", "h", ".", "Size", "(", ")", ")", ")", ")", "\n", "if", "reps", ">", "MaxInt", "{", "panic", "(", "\"", "\"", ")", "\n", "}", "\n", "dk", ":=", "make", "(", "[", "]", "byte", ",", "0", ",", "keyLenBytes", ")", "\n", "for", "<mask>", ":=", "1", ";", "counter", "<=", "reps", ";", "counter", "++", "{", "h", ".", "Reset", "(", ")", "\n\n", "counterBytes", ":=", "arrays", ".", "UInt32ToBytes", "(", "uint32", "(", "counter", ")", ")", "\n", "h", ".", "Write", "(", "counterBytes", ")", "\n", "h", ".", "Write", "(", "sharedSecret", ")", "\n", "h", ".", "Write", "(", "otherInfo", ")", "\n", "dk", "=", "h", ".", "Sum", "(", "dk", ")", "\n", "}", "\n\n", "return", "dk", "[", ":", "keyLenBytes", "]", "\n", "}" ]
20,241
all-20242
[ "WaitIsTargetAvailable", "is", "a", "wrapper", "around", "gtk_clipboard_wait_is_target_available" ]
[ "func", "(", "v", "*", "Clipboard", ")", "WaitIsTargetAvailable", "(", "target", "gdk", ".", "Atom", ")", "bool", "{", "c", ":=", "C", ".", "gtk_clipboard_wait_is_target_available", "(", "v", ".", "native", "(", ")", ",", "C", ".", "GdkAtom", "(", "unsafe", ".", "Pointer", "(", "<mask>", ")", ")", ")", "\n", "return", "gobool", "(", "c", ")", "\n", "}" ]
20,242
all-20243
[ "UnmarshalJSON", "supports", "json", ".", "Unmarshaler", "interface" ]
[ "func", "(", "v", "*", "EvaluateParams", ")", "UnmarshalJSON", "(", "<mask>", "[", "]", "byte", ")", "error", "{", "r", ":=", "jlexer", ".", "Lexer", "{", "Data", ":", "data", "}", "\n", "easyjsonC5a4559bDecodeGithubComChromedpCdprotoRuntime38", "(", "&", "r", ",", "v", ")", "\n", "return", "r", ".", "Error", "(", ")", "\n", "}" ]
20,243
all-20244
[ "VerifyMessageProvider", "accepts", "an", "instance", "of", "*", "testing", ".", "T", "running", "provider", "message", "verification", "with", "granular", "test", "reporting", "and", "automatic", "failure", "reporting", "for", "nice", "simple", "tests", ".", "A", "Message", "Producer", "is", "analagous", "to", "Consumer", "in", "the", "HTTP", "Interaction", "model", ".", "It", "is", "the", "initiator", "of", "an", "interaction", "and", "expects", "something", "on", "the", "other", "end", "of", "the", "interaction", "to", "respond", "-", "just", "in", "this", "case", "not", "immediately", "." ]
[ "func", "(", "p", "*", "Pact", ")", "VerifyMessageProvider", "(", "t", "*", "testing", ".", "T", ",", "request", "VerifyMessageRequest", ")", "(", "res", "types", ".", "ProviderVerifierResponse", ",", "err", "error", ")", "{", "res", ",", "err", "=", "p", ".", "VerifyMessageProviderRaw", "(", "request", ")", "\n\n", "for", "_", ",", "example", ":=", "range", "<mask>", ".", "Examples", "{", "t", ".", "Run", "(", "example", ".", "Description", ",", "func", "(", "st", "*", "testing", ".", "T", ")", "{", "st", ".", "Log", "(", "example", ".", "FullDescription", ")", "\n", "if", "example", ".", "Status", "!=", "\"", "\"", "{", "st", ".", "Errorf", "(", "\"", "\\n", "\"", ",", "example", ".", "Exception", ".", "Message", ")", "\n", "st", ".", "Error", "(", "\"", "\"", ")", "\n", "}", "\n", "}", ")", "\n", "}", "\n\n", "return", "\n", "}" ]
20,244
all-20245
[ "#define", "cvGetSubArr", "cvGetSubRect", "/", "*", "Selects", "row", "span", "of", "the", "input", "array", ":", "arr", "(", "start_row", ":", "delta_row", ":", "end_row", ":", ")", "(", "end_row", "is", "not", "included", "into", "the", "span", ")", "." ]
[ "func", "GetRows", "(", "arr", "Arr", ",", "submat", "*", "Mat", ",", "start_row", ",", "end_row", ",", "delta_row", "int", ")", "*", "Mat", "{", "mat_new", ":=", "C", ".", "cvGetRows", "(", "unsafe", ".", "Pointer", "(", "arr", ")", ",", "(", "*", "C", ".", "CvMat", ")", "(", "submat", ")", ",", "C", ".", "int", "(", "start_row", ")", ",", "C", ".", "int", "(", "end_row", ")", ",", "C", ".", "int", "(", "delta_row", ")", ",", ")", "\n", "<mask>", "(", "*", "Mat", ")", "(", "mat_new", ")", "\n", "}" ]
20,245
all-20246
[ "Type", "returns", "the", "package", "-", "level", "type", "of", "the", "specified", "name", "or", "nil", "if", "not", "found", "." ]
[ "func", "(", "p", "*", "Package", ")", "<mask>", "(", "name", "string", ")", "(", "t", "*", "Type", ")", "{", "t", ",", "_", "=", "p", ".", "Members", "[", "name", "]", ".", "(", "*", "Type", ")", "\n", "return", "\n", "}" ]
20,246
all-20247
[ "Error", "writes", "message", "to", "ErrorWriter", "." ]
[ "func", "(", "ui", "*", "BasicUI", ")", "Error", "(", "message", "string", ")", "{", "if", "ui", ".", "ErrorWriter", "!=", "nil", "{", "fmt", ".", "Fprint", "(", "ui", ".", "ErrorWriter", ",", "message", ")", "\n", "fmt", ".", "Fprint", "(", "ui", ".", "ErrorWriter", ",", "\"", "\\n", "\"", ")", "\n", "}", "else", "{", "fmt", ".", "Fprint", "(", "ui", ".", "<mask>", ",", "message", ")", "\n", "fmt", ".", "Fprint", "(", "ui", ".", "Writer", ",", "\"", "\\n", "\"", ")", "\n", "}", "\n", "}" ]
20,247
all-20248
[ "New", "creates", "a", "new", "client", "with", "your", "personal", "API", "key", "." ]
[ "func", "New", "(", "apikey", "string", ")", "*", "Client", "{", "endpoint", ":=", "Endpoint", "{", "URL", ":", "EndpointURL", "}", "\n", "return", "&", "<mask>", "{", "apikey", ",", "http", ".", "DefaultClient", ",", "endpoint", "}", "\n", "}" ]
20,248
all-20249
[ "WriteMetadata", "writes", "the", "data", "structures", "that", "describe", "the", "API", "resources", "and", "actions", "." ]
[ "func", "(", "c", "*", "MetadataWriter", ")", "WriteMetadata", "(", "d", "*", "gen", ".", "APIDescriptor", ",", "w", "io", ".", "Writer", ")", "error", "{", "resources", ":=", "make", "(", "[", "]", "*", "<mask>", ".", "Resource", ",", "len", "(", "d", ".", "ResourceNames", ")", ")", "\n", "for", "i", ",", "n", ":=", "range", "d", ".", "ResourceNames", "{", "resources", "[", "i", "]", "=", "d", ".", "Resources", "[", "n", "]", "\n", "}", "\n", "return", "c", ".", "resourceTmpl", ".", "Execute", "(", "w", ",", "resources", ")", "\n", "}" ]
20,249
all-20250
[ "formatMapKey", "formats", "v", "as", "if", "it", "were", "a", "map", "key", ".", "The", "result", "is", "guaranteed", "to", "be", "a", "single", "line", "." ]
[ "func", "formatMapKey", "(", "v", "reflect", ".", "<mask>", ")", "string", "{", "var", "opts", "formatOptions", "\n", "opts", ".", "TypeMode", "=", "elideType", "\n", "opts", ".", "AvoidStringer", "=", "true", "\n", "opts", ".", "ShallowPointers", "=", "true", "\n", "s", ":=", "opts", ".", "FormatValue", "(", "v", ",", "visitedPointers", "{", "}", ")", ".", "String", "(", ")", "\n", "return", "strings", ".", "TrimSpace", "(", "s", ")", "\n", "}" ]
20,250
all-20251
[ "WithObjectID", "JavaScript", "object", "id", "of", "the", "node", "wrapper", "." ]
[ "func", "(", "p", "DescribeNodeParams", ")", "WithObjectID", "(", "objectID", "runtime", ".", "RemoteObjectID", ")", "*", "DescribeNodeParams", "{", "p", ".", "ObjectID", "=", "objectID", "\n", "<mask>", "&", "p", "\n", "}" ]
20,251
all-20252
[ "Specify", "the", "value", "of", "a", "uniform", "variable", "for", "the", "current", "program", "object" ]
[ "func", "UniformMatrix3x4fv", "(", "location", "int32", ",", "<mask>", "int32", ",", "transpose", "bool", ",", "value", "*", "float32", ")", "{", "C", ".", "glowUniformMatrix3x4fv", "(", "gpUniformMatrix3x4fv", ",", "(", "C", ".", "GLint", ")", "(", "location", ")", ",", "(", "C", ".", "GLsizei", ")", "(", "count", ")", ",", "(", "C", ".", "GLboolean", ")", "(", "boolToInt", "(", "transpose", ")", ")", ",", "(", "*", "C", ".", "GLfloat", ")", "(", "unsafe", ".", "Pointer", "(", "value", ")", ")", ")", "\n", "}" ]
20,252
all-20253
[ "error", "log" ]
[ "func", "(", "f", "*", "FileLogger", ")", "Error", "(", "<mask>", "string", ",", "v", "...", "interface", "{", "}", ")", "{", "_", ",", "file", ",", "line", ",", "_", ":=", "runtime", ".", "Caller", "(", "2", ")", "//calldepth=3", "\n", "if", "f", ".", "logLevel", "<=", "ERROR", "{", "f", ".", "logChan", "<-", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "shortFileName", "(", "file", ")", ",", "line", ")", "+", "fmt", ".", "Sprintf", "(", "\"", "\\033", "\"", "+", "format", "+", "\"", "\\033", "\"", ",", "v", "...", ")", "\n", "}", "\n", "}" ]
20,253
all-20254
[ "AddMulti", "is", "a", "batch", "version", "of", "Add", ".", "appengine", ".", "MultiError", "may", "be", "returned", "." ]
[ "func", "(", "cd", "Codec", ")", "AddMulti", "(", "c", "context", ".", "<mask>", ",", "items", "[", "]", "*", "Item", ")", "error", "{", "return", "cd", ".", "set", "(", "c", ",", "items", ",", "pb", ".", "MemcacheSetRequest_ADD", ")", "\n", "}" ]
20,254
all-20255
[ "RegisterDriver", "registers", "driver", "with", "given", "names", "." ]
[ "func", "RegisterDriver", "(", "d", "Driver", ",", "knownNames", "...", "string", ")", "{", "for", "_", ",", "k", ":=", "range", "knownNames", "{", "drivers", "[", "strings", ".", "ToLower", "(", "k", ")", "]", "=", "d", "\n", "}", "\n", "<mask>", ".", "Info", "(", "\"", "\"", ",", "knownNames", ")", "\n", "}" ]
20,255
all-20256
[ "IssueHandlers", "returns", "a", "map", "of", "plugin", "names", "to", "handlers", "for", "the", "repo", "." ]
[ "func", "(", "pa", "*", "ConfigAgent", ")", "IssueHandlers", "(", "owner", ",", "repo", "string", ")", "map", "[", "string", "]", "IssueHandler", "{", "pa", ".", "mut", ".", "Lock", "(", ")", "\n", "defer", "pa", ".", "mut", ".", "Unlock", "(", ")", "\n\n", "hs", ":=", "map", "[", "string", "]", "IssueHandler", "{", "}", "\n", "for", "_", ",", "p", ":=", "range", "<mask>", ".", "getPlugins", "(", "owner", ",", "repo", ")", "{", "if", "h", ",", "ok", ":=", "issueHandlers", "[", "p", "]", ";", "ok", "{", "hs", "[", "p", "]", "=", "h", "\n", "}", "\n", "}", "\n", "return", "hs", "\n", "}" ]
20,256
all-20257
[ "WriteJSONToResponse", "writes", "the", "header", "JSON", "response", "to", "a", "ResponseWriter", "and", "log", "the", "error", "if", "necessary", "." ]
[ "func", "WriteJSONToResponse", "(", "w", "http", ".", "ResponseWriter", ",", "httpStatusCode", "int", ",", "responseJSON", "[", "]", "byte", ",", "requestType", "string", ")", "{", "w", ".", "<mask>", "(", ")", ".", "Set", "(", "\"", "\"", ",", "\"", "\"", ")", "\n", "w", ".", "WriteHeader", "(", "httpStatusCode", ")", "\n", "_", ",", "err", ":=", "w", ".", "Write", "(", "responseJSON", ")", "\n", "if", "err", "!=", "nil", "{", "seelog", ".", "Errorf", "(", "\"", "\"", ",", "requestType", ")", "\n", "}", "\n", "}" ]
20,257
all-20258
[ "StringToWaitDurationHookFunc", "returns", "a", "function", "that", "converts", "strings", "to", "wait", "value", ".", "This", "is", "designed", "to", "be", "used", "with", "mapstructure", "for", "parsing", "out", "a", "wait", "value", "." ]
[ "func", "StringToWaitDurationHookFunc", "(", ")", "mapstructure", ".", "DecodeHookFunc", "{", "return", "func", "(", "f", "reflect", ".", "<mask>", ",", "t", "reflect", ".", "Type", ",", "data", "interface", "{", "}", ")", "(", "interface", "{", "}", ",", "error", ")", "{", "if", "f", ".", "Kind", "(", ")", "!=", "reflect", ".", "String", "{", "return", "data", ",", "nil", "\n", "}", "\n", "if", "t", "!=", "reflect", ".", "TypeOf", "(", "WaitConfig", "{", "}", ")", "{", "return", "data", ",", "nil", "\n", "}", "\n\n", "// Convert it by parsing", "return", "ParseWaitConfig", "(", "data", ".", "(", "string", ")", ")", "\n", "}", "\n", "}" ]
20,258
all-20259
[ "TODO", "(", "c4milo", ")", ":", "Legacy", "function", "this", "is", "to", "be", "removed", "once", "we", "migrate", "the", "dependant", "code" ]
[ "func", "readVmx", "(", "path", "string", ")", "(", "map", "[", "string", "]", "string", ",", "error", ")", "{", "data", ",", "err", ":=", "ioutil", ".", "ReadFile", "(", "path", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "vmx", ":=", "make", "(", "map", "[", "string", "]", "string", ")", "\n\n", "for", "_", ",", "line", ":=", "range", "strings", ".", "Split", "(", "string", "(", "data", ")", ",", "\"", "\\n", "\"", ")", "{", "<mask>", ":=", "strings", ".", "Split", "(", "line", ",", "\"", "\"", ")", "\n", "if", "len", "(", "values", ")", "==", "2", "{", "vmx", "[", "strings", ".", "TrimSpace", "(", "values", "[", "0", "]", ")", "]", "=", "strings", ".", "Trim", "(", "strings", ".", "TrimSpace", "(", "values", "[", "1", "]", ")", ",", "`\"`", ")", "\n", "}", "\n", "}", "\n\n", "return", "vmx", ",", "nil", "\n", "}" ]
20,259
all-20260
[ "ItemsFunc", "returns", "slice", "of", "all", "items", "that", "when", "passed", "to", "f", "f", "returns", "true", ".", "Modification", "to", "the", "returned", "slice", "does", "not", "affect", "the", "structure", "of", "the", "set", ".", "However", "any", "item", "in", "the", "set", "that", "is", "a", "pointer", "will", "be", "affected", "if", "modified", "." ]
[ "func", "(", "s", "*", "Set", ")", "ItemsFunc", "(", "f", "func", "(", "value", "interface", "{", "}", ")", "bool", ")", "[", "]", "interface", "{", "}", "{", "s", ".", "RLock", "(", ")", "\n", "defer", "s", ".", "RUnlock", "(", ")", "\n", "items", ":=", "[", "]", "interface", "{", "}", "{", "}", "\n", "for", "k", ":=", "<mask>", "s", ".", "m", "{", "if", "f", "(", "k", ")", "{", "items", "=", "append", "(", "items", ",", "k", ")", "\n", "}", "\n", "}", "\n", "return", "items", "\n", "}" ]
20,260
all-20261
[ "AllTasks", "mocks", "base", "method" ]
[ "func", "(", "m", "*", "MockTaskEngineState", ")", "AllTasks", "(", ")", "[", "]", "*", "task", ".", "Task", "{", "<mask>", ":=", "m", ".", "ctrl", ".", "Call", "(", "m", ",", "\"", "\"", ")", "\n", "ret0", ",", "_", ":=", "ret", "[", "0", "]", ".", "(", "[", "]", "*", "task", ".", "Task", ")", "\n", "return", "ret0", "\n", "}" ]
20,261
all-20262
[ "transform", "YAML", "to", "JSON" ]
[ "func", "transform", "(", "in", "interface", "{", "}", ")", "(", "_", "interface", "{", "}", ",", "err", "error", ")", "{", "switch", "in", ".", "(", "type", ")", "{", "case", "map", "[", "interface", "{", "}", "]", "interface", "{", "}", ":", "o", ":=", "make", "(", "map", "[", "string", "]", "interface", "{", "}", ")", "\n", "for", "k", ",", "v", ":=", "range", "in", ".", "(", "map", "[", "interface", "{", "}", "]", "interface", "{", "}", ")", "{", "sk", ":=", "\"", "\"", "\n", "switch", "k", ".", "(", "type", ")", "{", "case", "string", ":", "sk", "=", "k", ".", "(", "string", ")", "\n", "case", "int", ":", "sk", "=", "strconv", ".", "Itoa", "(", "k", ".", "(", "int", ")", ")", "\n", "default", ":", "return", "nil", ",", "errors", ".", "New", "(", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "k", ")", ")", "\n", "}", "\n", "v", ",", "err", "=", "transform", "(", "v", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "o", "[", "sk", "]", "=", "v", "\n", "}", "\n", "return", "o", ",", "nil", "\n", "case", "[", "]", "interface", "{", "}", ":", "in1", ":=", "in", ".", "(", "[", "]", "interface", "{", "}", ")", "\n", "len1", ":=", "len", "(", "in1", ")", "\n", "o", ":=", "make", "(", "[", "]", "interface", "{", "}", ",", "len1", ")", "\n", "for", "i", ":=", "0", ";", "i", "<", "len1", ";", "i", "++", "{", "o", "[", "i", "]", ",", "err", "=", "transform", "(", "in1", "[", "i", "]", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "}", "\n", "return", "o", ",", "nil", "\n", "<mask>", ":", "return", "in", ",", "nil", "\n", "}", "\n", "}" ]
20,262
all-20263
[ "WithQuality", "the", "quality", "of", "the", "encoding", "(", "0", "-", "1", ")", ".", "(", "defaults", "to", "1", ")", "." ]
[ "func", "(", "p", "GetEncodedResponseParams", ")", "WithQuality", "(", "quality", "float64", ")", "*", "GetEncodedResponseParams", "{", "p", ".", "Quality", "=", "<mask>", "\n", "return", "&", "p", "\n", "}" ]
20,263
all-20264
[ "Read", "reads", "into", "b", "the", "next", "available", "data", "from", "the", "file", "and", "returns", "the", "number", "of", "bytes", "written", "and", "an", "error", "in", "case", "something", "wrong", "happened", ".", "At", "the", "end", "of", "the", "file", "n", "will", "be", "zero", "and", "err", "will", "be", "set", "to", "os", ".", "EOF", ".", "The", "parameters", "and", "behavior", "of", "this", "function", "turn", "the", "file", "into", "an", "io", ".", "Reader", "." ]
[ "func", "(", "file", "*", "GridFile", ")", "Read", "(", "b", "[", "]", "byte", ")", "(", "n", "int", ",", "err", "error", ")", "{", "file", ".", "assertMode", "(", "gfsReading", ")", "\n", "file", ".", "m", ".", "Lock", "(", ")", "\n", "debugf", "(", "\"", "\"", ",", "file", ",", "file", ".", "offset", ",", "len", "(", "b", ")", ")", "\n", "defer", "file", ".", "m", ".", "Unlock", "(", ")", "\n", "if", "<mask>", ".", "offset", "==", "file", ".", "doc", ".", "Length", "{", "return", "0", ",", "io", ".", "EOF", "\n", "}", "\n", "for", "err", "==", "nil", "{", "i", ":=", "copy", "(", "b", ",", "file", ".", "rbuf", ")", "\n", "n", "+=", "i", "\n", "file", ".", "offset", "+=", "int64", "(", "i", ")", "\n", "file", ".", "rbuf", "=", "file", ".", "rbuf", "[", "i", ":", "]", "\n", "if", "i", "==", "len", "(", "b", ")", "||", "file", ".", "offset", "==", "file", ".", "doc", ".", "Length", "{", "break", "\n", "}", "\n", "b", "=", "b", "[", "i", ":", "]", "\n", "file", ".", "rbuf", ",", "err", "=", "file", ".", "getChunk", "(", ")", "\n", "}", "\n", "return", "n", ",", "err", "\n", "}" ]
20,264
all-20265
[ "Send", "broadcasts", "a", "message", "to", "every", "one", "of", "a", "Group", "s", "members", "." ]
[ "func", "(", "g", "*", "Group", ")", "Send", "(", "val", "interface", "{", "}", ")", "{", "g", ".", "in", "<-", "<mask>", "{", "sender", ":", "nil", ",", "payload", ":", "val", "}", "\n", "}" ]
20,265
all-20266
[ "PutManifest", "writes", "the", "manifest", "to", "the", "destination", "." ]
[ "func", "(", "s", "*", "storageImageDestination", ")", "PutManifest", "(", "ctx", "context", ".", "<mask>", ",", "manifestBlob", "[", "]", "byte", ")", "error", "{", "if", "s", ".", "imageRef", ".", "named", "!=", "nil", "{", "if", "digested", ",", "ok", ":=", "s", ".", "imageRef", ".", "named", ".", "(", "reference", ".", "Digested", ")", ";", "ok", "{", "matches", ",", "err", ":=", "manifest", ".", "MatchesDigest", "(", "manifestBlob", ",", "digested", ".", "Digest", "(", ")", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "if", "!", "matches", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "digested", ".", "Digest", "(", ")", ")", "\n", "}", "\n", "}", "\n", "}", "\n\n", "s", ".", "manifest", "=", "make", "(", "[", "]", "byte", ",", "len", "(", "manifestBlob", ")", ")", "\n", "copy", "(", "s", ".", "manifest", ",", "manifestBlob", ")", "\n", "return", "nil", "\n", "}" ]
20,266
all-20267
[ "GetDialPeerTimeout", "returns", "the", "current", "DialPeer", "timeout", "(", "or", "the", "default", ")", "." ]
[ "func", "GetDialPeerTimeout", "(", "ctx", "context", ".", "Context", ")", "time", ".", "Duration", "{", "if", "to", ",", "ok", ":=", "ctx", ".", "Value", "(", "dialPeerTimeoutCtxKey", "{", "}", ")", ".", "(", "<mask>", ".", "Duration", ")", ";", "ok", "{", "return", "to", "\n", "}", "\n", "return", "DialPeerTimeout", "\n", "}" ]
20,267
all-20268
[ "Despite", "returning", "a", "uint64", "this", "actually", "reads", "a", "uint32", ".", "All", "table", "indices", "and", "lengths", "are", "stored", "as", "uint32", "values", "." ]
[ "func", "(", "b", "*", "sliceReader", ")", "ReadInt", "(", ")", "uint64", "{", "return", "uint64", "(", "<mask>", ".", "LittleEndian", ".", "Uint32", "(", "b", ".", "Read", "(", "4", ")", ")", ")", "\n", "}" ]
20,268
all-20269
[ "MarshalJSON", "returns", "the", "ObjectId", "as", "JSON" ]
[ "func", "(", "id", "*", "ObjectId", ")", "MarshalJSON", "(", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "<mask>", "w", "jwriter", ".", "Writer", "\n", "id", ".", "MarshalEasyJSON", "(", "&", "w", ")", "\n", "return", "w", ".", "BuildBytes", "(", ")", "\n", "}" ]
20,269
all-20270
[ "RefreshTrap", "check", "when", "the", "last", "time", "the", "URL", "was", "reset", "reset", "if", "needed" ]
[ "func", "(", "cm", "*", "CheckManager", ")", "RefreshTrap", "(", ")", "error", "{", "if", "cm", ".", "trapURL", "==", "\"", "\"", "{", "return", "nil", "\n", "}", "\n\n", "if", "<mask>", ".", "Since", "(", "cm", ".", "trapLastUpdate", ")", ">=", "cm", ".", "trapMaxURLAge", "{", "return", "cm", ".", "ResetTrap", "(", ")", "\n", "}", "\n\n", "return", "nil", "\n", "}" ]
20,270
all-20271
[ "void", "pango_font_descriptions_free", "(", "PangoFontDescription", "**", "descs", "int", "n_descs", ")", ";", "func", "(", "v", "*", "FontDescription", ")", "FontDescriptionsFree", "(", "n_descs", "int", ")", "{", "C", ".", "pango_font_descriptions_free", "(", "v", ".", "native", "()", "C", ".", "int", "(", "n_descs", "))", "}", "void", "pango_font_description_set_family", "(", "PangoFontDescription", "*", "desc", "const", "char", "*", "family", ")", ";" ]
[ "func", "(", "v", "*", "FontDescription", ")", "SetFamily", "(", "family", "string", ")", "{", "cstr", ":=", "C", ".", "CString", "(", "family", ")", "\n", "defer", "C", ".", "<mask>", "(", "unsafe", ".", "Pointer", "(", "cstr", ")", ")", "\n", "C", ".", "pango_font_description_set_family", "(", "v", ".", "native", "(", ")", ",", "(", "*", "C", ".", "char", ")", "(", "cstr", ")", ")", "\n", "}" ]
20,271
all-20272
[ "MarshalJSON", "supports", "json", ".", "Marshaler", "interface" ]
[ "func", "(", "v", "GetCategoriesReturns", ")", "MarshalJSON", "(", ")", "(", "[", "]", "<mask>", ",", "error", ")", "{", "w", ":=", "jwriter", ".", "Writer", "{", "}", "\n", "easyjsonC5a4559bEncodeGithubComChromedpCdprotoTracing6", "(", "&", "w", ",", "v", ")", "\n", "return", "w", ".", "Buffer", ".", "BuildBytes", "(", ")", ",", "w", ".", "Error", "\n", "}" ]
20,272
all-20273
[ "SetWidthChars", "()", "is", "a", "wrapper", "around", "gtk_entry_set_width_chars", "()", "." ]
[ "func", "(", "v", "*", "<mask>", ")", "SetWidthChars", "(", "nChars", "int", ")", "{", "C", ".", "gtk_entry_set_width_chars", "(", "v", ".", "native", "(", ")", ",", "C", ".", "gint", "(", "nChars", ")", ")", "\n", "}" ]
20,273
all-20274
[ "MarshalJSON", "supports", "json", ".", "Marshaler", "interface" ]
[ "func", "(", "v", "SelectorList", ")", "MarshalJSON", "(", ")", "(", "[", "]", "<mask>", ",", "error", ")", "{", "w", ":=", "jwriter", ".", "Writer", "{", "}", "\n", "easyjsonC5a4559bEncodeGithubComChromedpCdprotoCss22", "(", "&", "w", ",", "v", ")", "\n", "return", "w", ".", "Buffer", ".", "BuildBytes", "(", ")", ",", "w", ".", "Error", "\n", "}" ]
20,274
all-20275
[ "parseSequenceOf", "is", "used", "for", "SEQUENCE", "OF", "and", "SET", "OF", "values", ".", "It", "tries", "to", "parse", "a", "number", "of", "ASN", ".", "1", "values", "from", "the", "given", "byte", "slice", "and", "returns", "them", "as", "a", "slice", "of", "Go", "values", "of", "the", "given", "type", "." ]
[ "func", "parseSequenceOf", "(", "bytes", "[", "]", "byte", ",", "sliceType", "reflect", ".", "Type", ",", "elemType", "reflect", ".", "Type", ")", "(", "ret", "reflect", ".", "Value", ",", "err", "error", ")", "{", "expectedTag", ",", "compoundType", ",", "ok", ":=", "getUniversalType", "(", "elemType", ")", "\n", "if", "!", "ok", "{", "err", "=", "asn1", ".", "StructuralError", "{", "Msg", ":", "\"", "\"", "}", "\n", "return", "\n", "}", "\n\n", "// First we iterate over the input and count the number of elements,", "// checking that the types are correct in each case.", "numElements", ":=", "0", "\n", "for", "offset", ":=", "0", ";", "offset", "<", "len", "(", "bytes", ")", ";", "{", "var", "t", "tagAndLength", "\n", "t", ",", "offset", ",", "err", "=", "parseTagAndLength", "(", "bytes", ",", "offset", ")", "\n", "if", "err", "!=", "nil", "{", "return", "\n", "}", "\n", "switch", "t", ".", "tag", "{", "case", "tagIA5String", ",", "tagGeneralString", ",", "tagT61String", ",", "tagUTF8String", ":", "// We pretend that various other string types are", "// PRINTABLE STRINGs so that a sequence of them can be", "// parsed into a []string.", "t", ".", "tag", "=", "tagPrintableString", "\n", "case", "tagGeneralizedTime", ",", "tagUTCTime", ":", "// Likewise, both time types are treated the same.", "t", ".", "tag", "=", "tagUTCTime", "\n", "}", "\n\n", "if", "t", ".", "class", "!=", "classUniversal", "||", "t", ".", "isCompound", "!=", "compoundType", "||", "t", ".", "tag", "!=", "expectedTag", "{", "err", "=", "asn1", ".", "StructuralError", "{", "Msg", ":", "\"", "\"", "}", "\n", "return", "\n", "}", "\n", "if", "invalidLength", "(", "offset", ",", "t", ".", "length", ",", "len", "(", "bytes", ")", ")", "{", "err", "=", "asn1", ".", "SyntaxError", "{", "Msg", ":", "\"", "\"", "}", "\n", "return", "\n", "}", "\n", "offset", "+=", "t", ".", "length", "\n", "numElements", "++", "\n", "}", "\n", "ret", "=", "reflect", ".", "MakeSlice", "(", "sliceType", ",", "numElements", ",", "numElements", ")", "\n", "params", ":=", "fieldParameters", "{", "}", "\n", "offset", ":=", "0", "\n", "for", "i", ":=", "0", ";", "i", "<", "numElements", ";", "i", "++", "{", "<mask>", ",", "err", "=", "parseField", "(", "ret", ".", "Index", "(", "i", ")", ",", "bytes", ",", "offset", ",", "params", ")", "\n", "if", "err", "!=", "nil", "{", "return", "\n", "}", "\n", "}", "\n", "return", "\n", "}" ]
20,275
all-20276
[ "Close", "removes", "resources", "associated", "with", "an", "initialized", "ImageDestination", "if", "any", "." ]
[ "func", "(", "d", "*", "daemonImageDestination", ")", "Close", "(", ")", "error", "{", "if", "!", "d", ".", "committed", "{", "logrus", ".", "Debugf", "(", "\"", "\"", ")", "\n", "// In principle, goroutineCancel() should abort the HTTP request and stop the process from continuing.", "// In practice, though, various HTTP implementations used by client.Client.ImageLoad() (including", "// https://github.com/golang/net/blob/master/context/ctxhttp/ctxhttp_pre17.go and the", "// net/http version with native Context support in Go 1.7) do not always actually immediately cancel", "// the operation: they may process the HTTP request, or a part of it, to completion in a goroutine, and", "// return early if the context is canceled without terminating the goroutine at all.", "// So we need this CloseWithError to terminate sending the HTTP request Body", "// immediately, and hopefully, through terminating the sending which uses \"Transfer-Encoding: chunked\"\" without sending", "// the terminating zero-length chunk, prevent the docker daemon from processing the tar stream at all.", "// Whether that works or not, closing the PipeWriter seems desirable in any case.", "d", ".", "<mask>", ".", "CloseWithError", "(", "errors", ".", "New", "(", "\"", "\"", ")", ")", "\n", "}", "\n", "d", ".", "goroutineCancel", "(", ")", "\n\n", "return", "nil", "\n", "}" ]
20,276
all-20277
[ "EnsureIndexes", "will", "ensure", "that", "the", "required", "indexes", "exist", "." ]
[ "func", "EnsureIndexes", "(", "store", "*", "coal", ".", "<mask>", ")", "error", "{", "// ensure model indexes", "err", ":=", "indexer", ".", "Ensure", "(", "store", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "return", "nil", "\n", "}" ]
20,277
all-20278
[ "HasQuery", "returns", "a", "boolean", "if", "a", "field", "has", "been", "set", "." ]
[ "func", "(", "w", "*", "WidgetEvent", ")", "HasQuery", "(", ")", "bool", "{", "if", "w", "!=", "nil", "&&", "w", ".", "<mask>", "!=", "nil", "{", "return", "true", "\n", "}", "\n\n", "return", "false", "\n", "}" ]
20,278
all-20279
[ "Next", "generates", "a", "id", "that", "is", "unique", "." ]
[ "func", "(", "g", "*", "Generator", ")", "Next", "(", ")", "uint64", "{", "suffix", ":=", "atomic", ".", "AddUint64", "(", "&", "g", ".", "suffix", ",", "1", ")", "\n", "id", ":=", "g", ".", "prefix", "|", "lowbit", "(", "suffix", ",", "suffixLen", ")", "\n", "return", "<mask>", "\n", "}" ]
20,279
all-20280
[ "HasTextAlign", "returns", "a", "boolean", "if", "a", "field", "has", "been", "set", "." ]
[ "func", "(", "q", "*", "QueryValueDefinition", ")", "HasTextAlign", "(", ")", "bool", "{", "if", "q", "!=", "nil", "&&", "q", ".", "TextAlign", "!=", "nil", "{", "return", "<mask>", "\n", "}", "\n\n", "return", "false", "\n", "}" ]
20,280
all-20281
[ "HasIncreaseGood", "returns", "a", "boolean", "if", "a", "field", "has", "been", "set", "." ]
[ "func", "(", "c", "*", "ChangeRequest", ")", "HasIncreaseGood", "(", ")", "bool", "{", "if", "c", "!=", "nil", "&&", "c", ".", "IncreaseGood", "!=", "nil", "{", "return", "true", "\n", "}", "\n\n", "return", "<mask>", "\n", "}" ]
20,281
all-20282
[ "WithContext", "adds", "the", "context", "to", "the", "get", "apps", "app", "routes", "params" ]
[ "func", "(", "o", "*", "GetAppsAppRoutesParams", ")", "WithContext", "(", "ctx", "context", ".", "<mask>", ")", "*", "GetAppsAppRoutesParams", "{", "o", ".", "SetContext", "(", "ctx", ")", "\n", "return", "o", "\n", "}" ]
20,282
all-20283
[ "NewImage", "returns", "a", "types", ".", "ImageCloser", "for", "this", "reference", "possibly", "specialized", "for", "this", "ImageTransport", ".", "The", "caller", "must", "call", ".", "Close", "()", "on", "the", "returned", "ImageCloser", ".", "NOTE", ":", "If", "any", "kind", "of", "signature", "verification", "should", "happen", "build", "an", "UnparsedImage", "from", "the", "value", "returned", "by", "NewImageSource", "verify", "that", "UnparsedImage", "and", "convert", "it", "into", "a", "real", "Image", "via", "image", ".", "FromUnparsedImage", ".", "WARNING", ":", "This", "may", "not", "do", "the", "right", "thing", "for", "a", "manifest", "list", "see", "image", ".", "FromSource", "for", "details", "." ]
[ "func", "(", "ref", "archiveReference", ")", "NewImage", "(", "ctx", "context", ".", "Context", ",", "sys", "*", "types", ".", "SystemContext", ")", "(", "<mask>", ".", "ImageCloser", ",", "error", ")", "{", "src", ",", "err", ":=", "newImageSource", "(", "ctx", ",", "ref", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "return", "ctrImage", ".", "FromSource", "(", "ctx", ",", "sys", ",", "src", ")", "\n", "}" ]
20,283
all-20284
[ "hashToken", "converts", "a", "token", "to", "a", "cryptographic", "hash", ".", "We", "don", "t", "want", "to", "store", "tokens", "verbatim", "in", "the", "database", "as", "then", "whoever", "that", "has", "access", "to", "the", "database", "has", "access", "to", "all", "tokens", "." ]
[ "func", "hashToken", "(", "<mask>", "string", ")", "string", "{", "sum", ":=", "sha256", ".", "Sum256", "(", "[", "]", "byte", "(", "token", ")", ")", "\n", "return", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "sum", ")", "\n", "}" ]
20,284
all-20285
[ "Do", "executes", "Overlay", ".", "setShowHitTestBorders", "against", "the", "provided", "context", "." ]
[ "func", "(", "p", "*", "SetShowHitTestBordersParams", ")", "Do", "(", "ctx", "<mask>", ".", "Context", ")", "(", "err", "error", ")", "{", "return", "cdp", ".", "Execute", "(", "ctx", ",", "CommandSetShowHitTestBorders", ",", "p", ",", "nil", ")", "\n", "}" ]
20,285
all-20286
[ "fillOffering", "fills", "offerings", "nonce", "status", "hash", "and", "signature", "." ]
[ "func", "(", "h", "*", "Handler", ")", "fillOffering", "(", "logger", "log", ".", "Logger", ",", "offering", "*", "data", ".", "Offering", ")", "error", "{", "agent", ":=", "&", "data", ".", "Account", "{", "}", "\n", "// TODO: This is definitely wrong, should be:", "// `h.findByColumn(..., \"eth_addr\", offering.Agent)`", "if", "err", ":=", "h", ".", "findByPrimaryKey", "(", "logger", ",", "ErrAccountNotFound", ",", "agent", ",", "string", "(", "offering", ".", "Agent", ")", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "template", ":=", "&", "data", ".", "Template", "{", "}", "\n", "if", "err", ":=", "h", ".", "findByPrimaryKey", "(", "logger", ",", "ErrTemplateNotFound", ",", "<mask>", ",", "offering", ".", "Template", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "offering", ".", "ID", "=", "util", ".", "NewUUID", "(", ")", "\n", "offering", ".", "Status", "=", "data", ".", "OfferEmpty", "\n", "offering", ".", "Agent", "=", "agent", ".", "EthAddr", "\n", "offering", ".", "BlockNumberUpdated", "=", "1", "\n", "offering", ".", "CurrentSupply", "=", "offering", ".", "Supply", "\n", "// TODO: remove once prepaid is implemented.", "offering", ".", "BillingType", "=", "data", ".", "BillingPostpaid", "\n\n", "return", "h", ".", "setOfferingHash", "(", "logger", ",", "offering", ",", "template", ",", "agent", ")", "\n", "}" ]
20,286
all-20287
[ "WithDetailed", "collect", "block", "-", "based", "coverage", "." ]
[ "func", "(", "p", "StartPreciseCoverageParams", ")", "WithDetailed", "(", "detailed", "bool", ")", "*", "StartPreciseCoverageParams", "{", "p", ".", "Detailed", "=", "detailed", "\n", "<mask>", "&", "p", "\n", "}" ]
20,287
all-20288
[ "OpenType", "opens", "a", "specified", "GeoIP", "database", "type", "in", "the", "default", "location", "with", "the", "specified", "GeoIPOptions", "flag", ".", "Constants", "are", "defined", "for", "each", "database", "type", "(", "for", "example", "GEOIP_COUNTRY_EDITION", ")", "." ]
[ "func", "OpenTypeFlag", "(", "dbType", "int", ",", "flag", "int", ")", "(", "*", "GeoIP", ",", "error", ")", "{", "g", ":=", "&", "GeoIP", "{", "}", "\n", "runtime", ".", "SetFinalizer", "(", "g", ",", "(", "*", "GeoIP", ")", ".", "free", ")", "\n\n", "var", "err", "error", "\n\n", "g", ".", "db", ",", "err", "=", "C", ".", "GeoIP_open_type", "(", "C", ".", "int", "(", "dbType", ")", ",", "C", ".", "int", "(", "flag", ")", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "dbType", ",", "err", ")", "\n", "}", "\n\n", "if", "g", ".", "<mask>", "==", "nil", "{", "return", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "dbType", ")", "\n", "}", "\n\n", "C", ".", "GeoIP_set_charset", "(", "g", ".", "db", ",", "C", ".", "GEOIP_CHARSET_UTF8", ")", "\n\n", "return", "g", ",", "nil", "\n", "}" ]
20,288
all-20289
[ "UnmarshalJSON", "supports", "json", ".", "Unmarshaler", "interface" ]
[ "func", "(", "v", "*", "RemoteObject", ")", "UnmarshalJSON", "(", "<mask>", "[", "]", "byte", ")", "error", "{", "r", ":=", "jlexer", ".", "Lexer", "{", "Data", ":", "data", "}", "\n", "easyjsonC5a4559bDecodeGithubComChromedpCdprotoRuntime9", "(", "&", "r", ",", "v", ")", "\n", "return", "r", ".", "Error", "(", ")", "\n", "}" ]
20,289
all-20290
[ "GetBSON", "returns", "the", "hex", "representation", "of", "the", "ObjectId", "as", "a", "bson", ".", "M", "{}", "map", "." ]
[ "func", "(", "id", "*", "ObjectId", ")", "GetBSON", "(", ")", "(", "<mask>", "{", "}", ",", "error", ")", "{", "return", "bson", ".", "M", "{", "\"", "\"", ":", "bson", ".", "ObjectId", "(", "*", "id", ")", ".", "Hex", "(", ")", "}", ",", "nil", "\n", "}" ]
20,290
all-20291
[ "GetProject", "returns", "a", "Project", "entry", "for", "the", "provided", "name" ]
[ "func", "(", "r", "*", "ProtocolLXD", ")", "GetProject", "(", "name", "string", ")", "(", "*", "api", ".", "Project", ",", "string", ",", "error", ")", "{", "if", "!", "r", ".", "HasExtension", "(", "\"", "\"", ")", "{", "return", "nil", ",", "\"", "\"", ",", "fmt", ".", "Errorf", "(", "\"", "\\\"", "\\\"", "\"", ")", "\n", "}", "\n\n", "project", ":=", "api", ".", "Project", "{", "}", "\n\n", "// Fetch the raw value", "etag", ",", "err", ":=", "r", ".", "queryStruct", "(", "\"", "\"", ",", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "<mask>", ".", "QueryEscape", "(", "name", ")", ")", ",", "nil", ",", "\"", "\"", ",", "&", "project", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "\"", "\"", ",", "err", "\n", "}", "\n\n", "return", "&", "project", ",", "etag", ",", "nil", "\n", "}" ]
20,291
all-20292
[ "SetFromIconName", "is", "a", "wrapper", "around", "gtk_status_icon_set_from_icon_name", "()" ]
[ "func", "(", "v", "*", "StatusIcon", ")", "SetFromIconName", "(", "iconName", "string", ")", "{", "cstr", ":=", "C", ".", "CString", "(", "iconName", ")", "\n", "defer", "C", ".", "<mask>", "(", "unsafe", ".", "Pointer", "(", "cstr", ")", ")", "\n", "C", ".", "gtk_status_icon_set_from_icon_name", "(", "v", ".", "native", "(", ")", ",", "(", "*", "C", ".", "gchar", ")", "(", "cstr", ")", ")", "\n", "}" ]
20,292
all-20293
[ "flattenVMwareDVSPortgroupPolicy", "reads", "various", "fields", "from", "a", "VMwareDVSPortgroupPolicy", "into", "the", "passed", "in", "ResourceData", "." ]
[ "func", "flattenVMwareDVSPortgroupPolicy", "(", "d", "*", "schema", ".", "ResourceData", ",", "obj", "*", "types", ".", "VMwareDVSPortgroupPolicy", ")", "error", "{", "d", ".", "Set", "(", "\"", "\"", ",", "obj", ".", "BlockOverrideAllowed", ")", "\n", "d", ".", "Set", "(", "\"", "\"", ",", "obj", ".", "ShapingOverrideAllowed", ")", "\n", "d", ".", "Set", "(", "\"", "\"", ",", "obj", ".", "LivePortMovingAllowed", ")", "\n", "d", ".", "Set", "(", "\"", "\"", ",", "obj", ".", "PortConfigResetAtDisconnect", ")", "\n", "d", ".", "<mask>", "(", "\"", "\"", ",", "obj", ".", "VlanOverrideAllowed", ")", "\n", "d", ".", "Set", "(", "\"", "\"", ",", "obj", ".", "UplinkTeamingOverrideAllowed", ")", "\n", "d", ".", "Set", "(", "\"", "\"", ",", "obj", ".", "SecurityPolicyOverrideAllowed", ")", "\n\n", "structure", ".", "SetBoolPtr", "(", "d", ",", "\"", "\"", ",", "obj", ".", "NetworkResourcePoolOverrideAllowed", ")", "\n", "structure", ".", "SetBoolPtr", "(", "d", ",", "\"", "\"", ",", "obj", ".", "TrafficFilterOverrideAllowed", ")", "\n", "structure", ".", "SetBoolPtr", "(", "d", ",", "\"", "\"", ",", "obj", ".", "IpfixOverrideAllowed", ")", "\n", "return", "nil", "\n", "}" ]
20,293
all-20294
[ "AccountLocator", "builds", "a", "locator", "from", "the", "given", "href", "." ]
[ "func", "(", "api", "*", "API", ")", "AccountLocator", "(", "href", "<mask>", ")", "*", "AccountLocator", "{", "return", "&", "AccountLocator", "{", "Href", "(", "href", ")", ",", "api", "}", "\n", "}" ]
20,294
all-20295
[ "TargetsAll", "returns", "active", "and", "dropped", "targets", "grouped", "by", "job_name", "." ]
[ "func", "(", "m", "*", "Manager", ")", "TargetsAll", "(", ")", "map", "[", "string", "]", "[", "]", "*", "Target", "{", "m", ".", "mtxScrape", ".", "Lock", "(", ")", "\n", "defer", "m", ".", "mtxScrape", ".", "Unlock", "(", ")", "\n\n", "targets", ":=", "make", "(", "map", "[", "string", "]", "[", "]", "*", "Target", ",", "len", "(", "m", ".", "scrapePools", ")", ")", "\n", "for", "tset", ",", "sp", ":=", "range", "m", ".", "scrapePools", "{", "targets", "[", "tset", "]", "=", "<mask>", "(", "sp", ".", "ActiveTargets", "(", ")", ",", "sp", ".", "DroppedTargets", "(", ")", "...", ")", "\n\n", "}", "\n", "return", "targets", "\n", "}" ]
20,295
all-20296
[ "Validate", "implements", "the", "fire", ".", "ValidatableModel", "interface", "." ]
[ "func", "(", "t", "*", "<mask>", ")", "Validate", "(", ")", "error", "{", "// check id", "if", "!", "t", ".", "ID", "(", ")", ".", "Valid", "(", ")", "{", "return", "fire", ".", "E", "(", "\"", "\"", ")", "\n", "}", "\n\n", "// check expires at", "if", "t", ".", "ExpiresAt", ".", "IsZero", "(", ")", "{", "return", "fire", ".", "E", "(", "\"", "\"", ")", "\n", "}", "\n\n", "return", "nil", "\n", "}" ]
20,296
all-20297
[ "Reset", "called", "each", "time", "the", "entry", "is", "expired", "and", "the", "handler", "calls", "this", "after", "the", "original", "handler", "executed", "to", "re", "-", "set", "the", "response", "with", "the", "new", "handler", "s", "content", "result" ]
[ "func", "(", "e", "*", "Entry", ")", "Reset", "(", "statusCode", "int", ",", "contentType", "string", ",", "body", "[", "]", "byte", ",", "lifeChanger", "LifeChanger", ")", "{", "if", "e", ".", "response", "==", "nil", "{", "e", ".", "response", "=", "&", "Response", "{", "}", "\n", "}", "\n", "if", "statusCode", ">", "0", "{", "e", ".", "response", ".", "statusCode", "=", "statusCode", "\n", "}", "\n\n", "if", "contentType", "!=", "\"", "\"", "{", "e", ".", "response", ".", "contentType", "=", "contentType", "\n", "}", "\n\n", "e", ".", "response", ".", "<mask>", "=", "body", "\n", "// check if a given life changer provided", "// and if it does then execute the change life time", "if", "lifeChanger", "!=", "nil", "{", "e", ".", "ChangeLifetime", "(", "lifeChanger", ")", "\n", "}", "\n", "e", ".", "expiresAt", "=", "time", ".", "Now", "(", ")", ".", "Add", "(", "e", ".", "life", ")", "\n", "}" ]
20,297
all-20298
[ "UncompressBlock", "uncompresses", "the", "source", "buffer", "into", "the", "destination", "one", "and", "returns", "the", "uncompressed", "size", ".", "The", "destination", "buffer", "must", "be", "sized", "appropriately", ".", "An", "error", "is", "returned", "if", "the", "source", "data", "is", "invalid", "or", "the", "destination", "buffer", "is", "too", "small", "." ]
[ "func", "UncompressBlock", "(", "src", ",", "dst", "[", "]", "<mask>", ")", "(", "di", "int", ",", "err", "error", ")", "{", "sn", ":=", "len", "(", "src", ")", "\n", "if", "sn", "==", "0", "{", "return", "0", ",", "nil", "\n", "}", "\n\n", "di", "=", "decodeBlock", "(", "dst", ",", "src", ")", "\n", "if", "di", "<", "0", "{", "return", "0", ",", "ErrInvalidSourceShortBuffer", "\n", "}", "\n", "return", "di", ",", "nil", "\n", "}" ]
20,298
all-20299
[ "StoragePoolGet", "returns", "a", "single", "storage", "pool", "." ]
[ "func", "(", "c", "*", "Cluster", ")", "StoragePoolGet", "(", "poolName", "string", ")", "(", "int64", ",", "*", "api", ".", "StoragePool", ",", "error", ")", "{", "var", "poolDriver", "string", "\n", "poolID", ":=", "int64", "(", "-", "1", ")", "\n", "description", ":=", "sql", ".", "NullString", "{", "}", "\n", "var", "state", "int", "\n\n", "query", ":=", "\"", "\"", "\n", "inargs", ":=", "[", "]", "interface", "{", "}", "{", "poolName", "}", "\n", "outargs", ":=", "[", "]", "interface", "{", "}", "{", "&", "poolID", ",", "&", "poolDriver", ",", "&", "description", ",", "&", "state", "}", "\n\n", "err", ":=", "dbQueryRowScan", "(", "c", ".", "db", ",", "<mask>", ",", "inargs", ",", "outargs", ")", "\n", "if", "err", "!=", "nil", "{", "if", "err", "==", "sql", ".", "ErrNoRows", "{", "return", "-", "1", ",", "nil", ",", "ErrNoSuchObject", "\n", "}", "\n", "return", "-", "1", ",", "nil", ",", "err", "\n", "}", "\n\n", "config", ",", "err", ":=", "c", ".", "StoragePoolConfigGet", "(", "poolID", ")", "\n", "if", "err", "!=", "nil", "{", "return", "-", "1", ",", "nil", ",", "err", "\n", "}", "\n\n", "storagePool", ":=", "api", ".", "StoragePool", "{", "Name", ":", "poolName", ",", "Driver", ":", "poolDriver", ",", "}", "\n", "storagePool", ".", "Description", "=", "description", ".", "String", "\n", "storagePool", ".", "Config", "=", "config", "\n\n", "switch", "state", "{", "case", "storagePoolPending", ":", "storagePool", ".", "Status", "=", "\"", "\"", "\n", "case", "storagePoolCreated", ":", "storagePool", ".", "Status", "=", "\"", "\"", "\n", "default", ":", "storagePool", ".", "Status", "=", "\"", "\"", "\n", "}", "\n\n", "nodes", ",", "err", ":=", "c", ".", "storagePoolNodes", "(", "poolID", ")", "\n", "if", "err", "!=", "nil", "{", "return", "-", "1", ",", "nil", ",", "err", "\n", "}", "\n", "storagePool", ".", "Locations", "=", "nodes", "\n\n", "return", "poolID", ",", "&", "storagePool", ",", "nil", "\n", "}" ]
20,299
all-20300
[ "Connect", "is", "a", "convenience", "around", "lxd", ".", "ConnectLXD", "that", "configures", "the", "client", "with", "the", "correct", "parameters", "for", "node", "-", "to", "-", "node", "communication", ".", "If", "notify", "switch", "is", "true", "then", "the", "user", "agent", "will", "be", "set", "to", "the", "special", "value", "lxd", "-", "cluster", "-", "notifier", "which", "can", "be", "used", "in", "some", "cases", "to", "distinguish", "between", "a", "regular", "client", "request", "and", "an", "internal", "cluster", "request", "." ]
[ "func", "Connect", "(", "address", "string", ",", "cert", "*", "shared", ".", "CertInfo", ",", "notify", "bool", ")", "(", "lxd", ".", "ContainerServer", ",", "error", ")", "{", "args", ":=", "&", "lxd", ".", "ConnectionArgs", "{", "TLSServerCert", ":", "string", "(", "<mask>", ".", "PublicKey", "(", ")", ")", ",", "TLSClientCert", ":", "string", "(", "cert", ".", "PublicKey", "(", ")", ")", ",", "TLSClientKey", ":", "string", "(", "cert", ".", "PrivateKey", "(", ")", ")", ",", "SkipGetServer", ":", "true", ",", "}", "\n", "if", "notify", "{", "args", ".", "UserAgent", "=", "\"", "\"", "\n", "}", "\n\n", "url", ":=", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "address", ")", "\n", "return", "lxd", ".", "ConnectLXD", "(", "url", ",", "args", ")", "\n", "}" ]