id
int32
0
25.3k
idx
stringlengths
5
9
nl_tokens
listlengths
1
418
pl_tokens
listlengths
22
4.98k
18,600
all-18601
[ "startTlsIfRequired", "examines", "the", "server", "s", "stream", "features", "and", "if", "STARTTLS", "is", "required", "or", "supported", "performs", "the", "TLS", "handshake", ".", "f", "will", "be", "updated", "if", "the", "handshake", "completes", "as", "the", "new", "stream", "s", "features", "are", "typically", "different", "from", "the", "original", "." ]
[ "func", "(", "c", "*", "Client", ")", "startTLSIfRequired", "(", "f", "*", "streamFeatures", ",", "o", "*", "Options", ",", "domain", "string", ")", "(", "*", "streamFeatures", ",", "error", ")", "{", "// whether we start tls is a matter of opinion: the server's and the user's.", "switch", "{", "case", "f", ".", "StartTLS", "==", "nil", ":", "// the server does not support STARTTLS", "return", "f", ",", "nil", "\n", "case", "!", "o", ".", "StartTLS", "&&", "f", ".", "StartTLS", ".", "Required", "==", "nil", ":", "return", "f", ",", "nil", "\n", "case", "f", ".", "StartTLS", ".", "Required", "!=", "nil", ":", "// the server requires STARTTLS.", "case", "!", "o", ".", "StartTLS", ":", "// the user wants STARTTLS and the server supports it.", "}", "\n", "var", "err", "error", "\n\n", "fmt", ".", "Fprintf", "(", "c", ".", "conn", ",", "\"", "\\n", "\"", ")", "\n", "var", "k", "tlsProceed", "\n", "if", "err", "=", "c", ".", "p", ".", "DecodeElement", "(", "&", "k", ",", "nil", ")", ";", "err", "!=", "nil", "{", "return", "f", ",", "errors", ".", "New", "(", "\"", "\"", "+", "err", ".", "Error", "(", ")", ")", "\n", "}", "\n\n", "tc", ":=", "o", ".", "TLSConfig", "\n", "if", "tc", "==", "nil", "{", "tc", "=", "new", "(", "tls", ".", "Config", ")", "\n", "*", "tc", "=", "DefaultConfig", "\n", "//TODO(scott): we should consider using the server's address or reverse lookup", "tc", ".", "ServerName", "=", "domain", "\n", "}", "\n", "t", ":=", "tls", ".", "Client", "(", "c", ".", "conn", ",", "tc", ")", "\n\n", "if", "err", "=", "t", ".", "Handshake", "(", ")", ";", "err", "!=", "nil", "{", "return", "f", ",", "errors", ".", "New", "(", "\"", "\"", "+", "err", ".", "<mask>", "(", ")", ")", "\n", "}", "\n", "c", ".", "conn", "=", "t", "\n\n", "// restart our declaration of XMPP stream intentions.", "tf", ",", "err", ":=", "c", ".", "startStream", "(", "o", ",", "domain", ")", "\n", "if", "err", "!=", "nil", "{", "return", "f", ",", "err", "\n", "}", "\n", "return", "tf", ",", "nil", "\n", "}" ]
18,601
all-18602
[ "SendOrg", "sends", "the", "original", "text", "without", "being", "wrapped", "in", "an", "XMPP", "message", "stanza", "." ]
[ "func", "(", "c", "*", "<mask>", ")", "SendOrg", "(", "org", "string", ")", "(", "n", "int", ",", "err", "error", ")", "{", "return", "fmt", ".", "Fprint", "(", "c", ".", "conn", ",", "org", ")", "\n", "}" ]
18,602
all-18603
[ "newImageSource", "sets", "up", "an", "image", "for", "reading", "." ]
[ "func", "newImageSource", "(", "imageRef", "storageReference", ")", "(", "*", "storageImageSource", ",", "error", ")", "{", "// First, locate the image.", "img", ",", "err", ":=", "imageRef", ".", "resolveImage", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "// Build the reader object.", "image", ":=", "&", "storageImageSource", "{", "imageRef", ":", "imageRef", ",", "image", ":", "img", ",", "layerPosition", ":", "<mask>", "(", "map", "[", "digest", ".", "Digest", "]", "int", ")", ",", "SignatureSizes", ":", "[", "]", "int", "{", "}", ",", "}", "\n", "if", "img", ".", "Metadata", "!=", "\"", "\"", "{", "if", "err", ":=", "json", ".", "Unmarshal", "(", "[", "]", "byte", "(", "img", ".", "Metadata", ")", ",", "image", ")", ";", "err", "!=", "nil", "{", "return", "nil", ",", "errors", ".", "Wrap", "(", "err", ",", "\"", "\"", ")", "\n", "}", "\n", "}", "\n", "return", "image", ",", "nil", "\n", "}" ]
18,603
all-18604
[ "New", "creates", "IrcText", "object", "and", "take", "your", "text", "as", "argument", "." ]
[ "func", "New", "(", "s", "string", ")", "*", "IrcText", "{", "return", "&", "IrcText", "{", "<mask>", ":", "s", ",", "bgColor", ":", "None", ",", "fgColor", ":", "None", "}", "\n", "}" ]
18,604
all-18605
[ "EnsureSchema", "applies", "all", "relevant", "schema", "updates", "to", "the", "node", "-", "local", "database", ".", "Return", "the", "initial", "schema", "version", "found", "before", "starting", "the", "update", "along", "with", "any", "error", "occurred", "." ]
[ "func", "EnsureSchema", "(", "db", "*", "sql", ".", "<mask>", ",", "dir", "string", ",", "hook", "schema", ".", "Hook", ")", "(", "int", ",", "error", ")", "{", "backupDone", ":=", "false", "\n\n", "schema", ":=", "Schema", "(", ")", "\n", "schema", ".", "File", "(", "filepath", ".", "Join", "(", "dir", ",", "\"", "\"", ")", ")", "// Optional custom queries", "\n", "schema", ".", "Hook", "(", "func", "(", "version", "int", ",", "tx", "*", "sql", ".", "Tx", ")", "error", "{", "if", "!", "backupDone", "{", "logger", ".", "Infof", "(", "\"", "\\\"", "\\\"", "\"", ")", "\n", "path", ":=", "filepath", ".", "Join", "(", "dir", ",", "\"", "\"", ")", "\n", "err", ":=", "shared", ".", "FileCopy", "(", "path", ",", "path", "+", "\"", "\"", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "backupDone", "=", "true", "\n", "}", "\n\n", "if", "version", "==", "-", "1", "{", "logger", ".", "Debugf", "(", "\"", "\"", ")", "\n", "}", "else", "{", "logger", ".", "Debugf", "(", "\"", "\"", ",", "version", ",", "version", "+", "1", ")", "\n", "}", "\n\n", "// Run the given hook only against actual update versions, not", "// when a custom query file is passed (signaled by version == -1).", "if", "hook", "!=", "nil", "&&", "version", "!=", "-", "1", "{", "err", ":=", "hook", "(", "version", ",", "tx", ")", "\n", "if", "err", "!=", "nil", "{", "}", "\n", "}", "\n\n", "return", "nil", "\n", "}", ")", "\n", "return", "schema", ".", "Ensure", "(", "db", ")", "\n", "}" ]
18,605
all-18606
[ "Shutdown", "gracefully", "shuts", "down", "the", "server", "without", "interrupting", "any", "active", "connections", ".", "Shutdown", "works", "by", "first", "closing", "all", "open", "listeners", "and", "then", "waiting", "indefinitely", "for", "all", "connections", "to", "return", "to", "idle", "and", "then", "shut", "down", ".", "When", "Shutdown", "is", "called", "Serve", "ListenAndServe", "and", "ListenAndServeTLS", "immediately", "return", "nil", ".", "Make", "sure", "the", "program", "doesn", "t", "exit", "and", "waits", "instead", "for", "Shutdown", "to", "return", ".", "Shutdown", "does", "not", "close", "keepalive", "connections", "so", "its", "recommended", "to", "set", "ReadTimeout", "to", "something", "else", "than", "0", "." ]
[ "func", "(", "s", "*", "Server", ")", "Shutdown", "(", ")", "error", "{", "s", ".", "mu", ".", "Lock", "(", ")", "\n", "defer", "s", ".", "mu", ".", "Unlock", "(", ")", "\n\n", "atomic", ".", "StoreInt32", "(", "&", "s", ".", "stop", ",", "1", ")", "\n", "defer", "atomic", ".", "StoreInt32", "(", "&", "s", ".", "stop", ",", "0", ")", "\n\n", "if", "s", ".", "ln", "==", "nil", "{", "return", "nil", "\n", "}", "\n\n", "if", "err", ":=", "s", ".", "ln", ".", "Close", "(", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "if", "s", ".", "<mask>", "!=", "nil", "{", "close", "(", "s", ".", "done", ")", "\n", "}", "\n\n", "// Closing the listener will make Serve() call Stop on the worker pool.", "// Setting .stop to 1 will make serveConn() break out of its loop.", "// Now we just have to wait until all workers are done.", "for", "{", "if", "open", ":=", "atomic", ".", "LoadInt32", "(", "&", "s", ".", "open", ")", ";", "open", "==", "0", "{", "break", "\n", "}", "\n", "// This is not an optimal solution but using a sync.WaitGroup", "// here causes data races as it's hard to prevent Add() to be called", "// while Wait() is waiting.", "time", ".", "Sleep", "(", "time", ".", "Millisecond", "*", "100", ")", "\n", "}", "\n\n", "s", ".", "ln", "=", "nil", "\n", "return", "nil", "\n", "}" ]
18,606
all-18607
[ "GetRanges", "composes", "the", "CIDR", "IP", "ranges", "following", "RFC", "4632", "and", "RFC", "4291", "of", "the", "given", "IPs", "with", "a", "given", "IPv4", "CIDR", "and", "IPv6", "CIDR" ]
[ "func", "GetRanges", "(", "ips", "[", "]", "string", ",", "ip4_cidr", "string", ",", "ip6_cidr", "string", ")", "(", "[", "]", "net", ".", "IPNet", ",", "error", ")", "{", "net_out", ":=", "make", "(", "[", "]", "net", ".", "IPNet", ",", "0", ")", "\n\n", "for", "_", ",", "ip", ":=", "range", "ips", "{", "cidr", ":=", "\"", "\"", "\n", "if", "strings", ".", "Contains", "(", "ip", ",", "\"", "\"", ")", "{", "// IPv6", "cidr", "=", "ip6_cidr", "\n", "if", "cidr", "==", "\"", "\"", "{", "cidr", "=", "\"", "\"", "\n", "}", "\n", "if", "c", ",", "err", ":=", "strconv", ".", "ParseInt", "(", "cidr", ",", "10", ",", "16", ")", ";", "err", "!=", "nil", "||", "c", "<", "0", "||", "c", ">", "128", "{", "return", "nil", ",", "&", "PermError", "{", "\"", "\"", "+", "cidr", "}", "\n", "}", "\n\n", "}", "else", "{", "// IPv4", "cidr", "=", "ip4_cidr", "\n", "if", "cidr", "==", "\"", "\"", "{", "cidr", "=", "\"", "\"", "\n", "}", "\n", "if", "c", ",", "err", ":=", "strconv", ".", "ParseInt", "(", "cidr", ",", "10", ",", "16", ")", ";", "err", "!=", "nil", "||", "c", "<", "0", "||", "c", ">", "32", "{", "return", "nil", ",", "&", "PermError", "{", "\"", "\"", "+", "cidr", "}", "\n", "}", "\n", "}", "\n", "ip", "+=", "\"", "\"", "+", "cidr", "\n\n", "_", ",", "ipnet", ",", "err", ":=", "<mask>", ".", "ParseCIDR", "(", "ip", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "net_out", "=", "append", "(", "net_out", ",", "*", "ipnet", ")", "\n\n", "}", "\n\n", "return", "net_out", ",", "nil", "\n", "}" ]
18,607
all-18608
[ "establish", "the", "data", "storage", "format", "dimensions", "and", "number", "of", "samples", "of", "a", "multisample", "texture", "s", "image" ]
[ "func", "TexImage3DMultisample", "(", "target", "uint32", ",", "samples", "int32", ",", "internalformat", "uint32", ",", "width", "int32", ",", "height", "int32", ",", "depth", "int32", ",", "fixedsamplelocations", "bool", ")", "{", "syscall", ".", "Syscall9", "(", "gpTexImage3DMultisample", ",", "7", ",", "uintptr", "(", "target", ")", ",", "uintptr", "(", "samples", ")", ",", "uintptr", "(", "internalformat", ")", ",", "uintptr", "(", "width", ")", ",", "uintptr", "(", "height", ")", ",", "uintptr", "(", "<mask>", ")", ",", "boolToUintptr", "(", "fixedsamplelocations", ")", ",", "0", ",", "0", ")", "\n", "}" ]
18,608
all-18609
[ "flattenVMwareDVSPortSetting", "reads", "various", "fields", "from", "a", "VMwareDVSPortSetting", "into", "the", "passed", "in", "ResourceData", "." ]
[ "func", "flattenVMwareDVSPortSetting", "(", "d", "*", "schema", ".", "ResourceData", ",", "obj", "*", "<mask>", ".", "VMwareDVSPortSetting", ")", "error", "{", "if", "obj", "==", "nil", "{", "return", "nil", "\n", "}", "\n\n", "structure", ".", "SetBoolPolicy", "(", "d", ",", "\"", "\"", ",", "obj", ".", "Blocked", ")", "\n", "structure", ".", "SetBoolPolicy", "(", "d", ",", "\"", "\"", ",", "obj", ".", "IpfixEnabled", ")", "\n", "structure", ".", "SetBoolPolicy", "(", "d", ",", "\"", "\"", ",", "obj", ".", "TxUplink", ")", "\n", "structure", ".", "SetBoolPolicy", "(", "d", ",", "\"", "\"", ",", "obj", ".", "VmDirectPathGen2Allowed", ")", "\n\n", "if", "err", ":=", "flattenDVSTrafficShapingPolicyIngress", "(", "d", ",", "obj", ".", "InShapingPolicy", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "if", "err", ":=", "flattenDVSTrafficShapingPolicyEgress", "(", "d", ",", "obj", ".", "OutShapingPolicy", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "if", "err", ":=", "flattenBaseVmwareDistributedVirtualSwitchVlanSpec", "(", "d", ",", "obj", ".", "Vlan", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "if", "err", ":=", "flattenVmwareUplinkPortTeamingPolicy", "(", "d", ",", "obj", ".", "UplinkTeamingPolicy", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "if", "err", ":=", "flattenDVSSecurityPolicy", "(", "d", ",", "obj", ".", "SecurityPolicy", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "if", "err", ":=", "flattenVMwareUplinkLacpPolicy", "(", "d", ",", "obj", ".", "LacpPolicy", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "return", "nil", "\n", "}" ]
18,609
all-18610
[ "MustProcess", "is", "the", "same", "as", "Process", "but", "panics", "if", "an", "error", "occurs" ]
[ "func", "MustProcess", "(", "prefix", "string", ",", "spec", "interface", "{", "}", ")", "{", "if", "err", ":=", "Process", "(", "<mask>", ",", "spec", ")", ";", "err", "!=", "nil", "{", "panic", "(", "err", ")", "\n", "}", "\n", "}" ]
18,610
all-18611
[ "UnmarshalJSON", "supports", "json", ".", "Unmarshaler", "interface" ]
[ "func", "(", "v", "*", "RemoveDOMStorageItemParams", ")", "UnmarshalJSON", "(", "data", "[", "]", "byte", ")", "error", "{", "r", ":=", "jlexer", ".", "Lexer", "{", "Data", ":", "data", "}", "\n", "easyjsonC5a4559bDecodeGithubComChromedpCdprotoDomstorage2", "(", "&", "r", ",", "v", ")", "\n", "return", "r", ".", "<mask>", "(", ")", "\n", "}" ]
18,611
all-18612
[ "UnmarshalJSON", "supports", "json", ".", "Unmarshaler", "interface" ]
[ "func", "(", "v", "*", "MediaQuery", ")", "UnmarshalJSON", "(", "data", "[", "]", "byte", ")", "error", "{", "r", ":=", "jlexer", ".", "Lexer", "{", "Data", ":", "<mask>", "}", "\n", "easyjsonC5a4559bDecodeGithubComChromedpCdprotoCss30", "(", "&", "r", ",", "v", ")", "\n", "return", "r", ".", "Error", "(", ")", "\n", "}" ]
18,612
all-18613
[ "ElementAt", "retreives", "an", "item", "at", "a", "particular", "position", "in", "an", "Enumerator", "." ]
[ "func", "ElementAt", "(", "iter", "Enumerable", ",", "n", "uint", ")", "interface", "{", "}", "{", "done", ":=", "make", "(", "chan", "struct", "{", "}", ")", "\n", "defer", "close", "(", "<mask>", ")", "\n", "return", "iter", ".", "Enumerate", "(", "done", ")", ".", "ElementAt", "(", "n", ")", "\n", "}" ]
18,613
all-18614
[ "New", "returns", "a", "new", "Client", "." ]
[ "func", "New", "(", "opts", "...", "Option", ")", "(", "*", "Client", ",", "error", ")", "{", "// The default configuration.", "conf", ":=", "&", "config", "{", "Client", ":", "clientConfig", "{", "Rate", ":", "1", ",", "}", ",", "Conn", ":", "connConfig", "{", "Addr", ":", "\"", "\"", ",", "FlushPeriod", ":", "100", "*", "time", ".", "Millisecond", ",", "// Worst-case scenario:", "// Ethernet MTU - IPv6 Header - TCP Header = 1500 - 40 - 20 = 1440", "MaxPacketSize", ":", "1440", ",", "Network", ":", "\"", "\"", ",", "}", ",", "}", "\n", "for", "_", ",", "o", ":=", "range", "opts", "{", "o", "(", "conf", ")", "\n", "}", "\n\n", "conn", ",", "err", ":=", "newConn", "(", "conf", ".", "Conn", ",", "conf", ".", "Client", ".", "Muted", ")", "\n", "c", ":=", "&", "<mask>", "{", "conn", ":", "conn", ",", "muted", ":", "conf", ".", "Client", ".", "Muted", ",", "}", "\n", "if", "err", "!=", "nil", "{", "c", ".", "muted", "=", "true", "\n", "return", "c", ",", "err", "\n", "}", "\n", "c", ".", "rate", "=", "conf", ".", "Client", ".", "Rate", "\n", "c", ".", "prefix", "=", "conf", ".", "Client", ".", "Prefix", "\n", "c", ".", "tags", "=", "joinTags", "(", "conf", ".", "Conn", ".", "TagFormat", ",", "conf", ".", "Client", ".", "Tags", ")", "\n", "return", "c", ",", "nil", "\n", "}" ]
18,614
all-18615
[ "SetDeviceName", "sets", "the", "DeviceName", "field", "s", "value", "." ]
[ "func", "(", "s", "*", "InferenceAccelerator", ")", "SetDeviceName", "(", "v", "<mask>", ")", "*", "InferenceAccelerator", "{", "s", ".", "DeviceName", "=", "&", "v", "\n", "return", "s", "\n", "}" ]
18,615
all-18616
[ "ExecNum", "is", "like", "Exec", "except", "it", "will", "attempt", "to", "convert", "the", "result", "to", "its", "number", "value", "." ]
[ "func", "(", "xp", "XPathExec", ")", "ExecNum", "(", "t", "tree", ".", "Node", ",", "opts", "...", "FuncOpts", ")", "(", "float64", ",", "error", ")", "{", "res", ",", "err", ":=", "xp", ".", "Exec", "(", "t", ",", "opts", "...", ")", "\n", "if", "err", "!=", "nil", "{", "return", "0", ",", "err", "\n", "}", "\n\n", "n", ",", "ok", ":=", "res", ".", "(", "<mask>", ".", "IsNum", ")", "\n", "if", "!", "ok", "{", "return", "0", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ")", "\n", "}", "\n\n", "return", "float64", "(", "n", ".", "Num", "(", ")", ")", ",", "nil", "\n", "}" ]
18,616
all-18617
[ "NewKeyProvider", "provide", "a", "simple", "passphrase", "key", "provider", "." ]
[ "func", "NewKeyProvider", "(", "key", "interface", "{", "}", ")", "SecretProvider", "{", "return", "SecretProviderFunc", "(", "func", "(", "_", "*", "<mask>", ".", "Request", ")", "(", "interface", "{", "}", ",", "error", ")", "{", "return", "key", ",", "nil", "\n", "}", ")", "\n", "}" ]
18,617
all-18618
[ "Set", "skip", "+", "limit", "on", "the", "current", "query", "and", "generates", "a", "PaginationInfo", "struct", "with", "info", "for", "your", "front", "end" ]
[ "func", "(", "r", "*", "ResultSet", ")", "Paginate", "(", "perPage", ",", "page", "int", ")", "(", "*", "PaginationInfo", ",", "error", ")", "{", "info", ":=", "new", "(", "PaginationInfo", ")", "\n\n", "// Get count on a different session to avoid blocking", "sess", ":=", "r", ".", "Collection", ".", "Connection", ".", "Session", ".", "Copy", "(", ")", "\n\n", "count", ",", "err", ":=", "sess", ".", "DB", "(", "r", ".", "Collection", ".", "Database", ")", ".", "C", "(", "r", ".", "Collection", ".", "Name", ")", ".", "Find", "(", "r", ".", "Params", ")", ".", "Count", "(", ")", "\n", "sess", ".", "Close", "(", ")", "\n\n", "if", "err", "!=", "nil", "{", "return", "info", ",", "err", "\n", "}", "\n\n", "// Calculate how many pages", "totalPages", ":=", "int", "(", "math", ".", "Ceil", "(", "float64", "(", "count", ")", "/", "float64", "(", "perPage", ")", ")", ")", "\n\n", "if", "page", "<", "1", "{", "page", "=", "1", "\n", "}", "else", "if", "page", ">", "totalPages", "{", "page", "=", "totalPages", "\n", "}", "\n\n", "skip", ":=", "(", "page", "-", "1", ")", "*", "perPage", "\n\n", "r", ".", "Query", ".", "Skip", "(", "skip", ")", ".", "Limit", "(", "perPage", ")", "\n\n", "info", ".", "TotalPages", "=", "totalPages", "\n", "info", ".", "PerPage", "=", "perPage", "\n", "info", ".", "Current", "=", "page", "\n", "info", ".", "TotalRecords", "=", "<mask>", "\n\n", "if", "info", ".", "Current", "<", "info", ".", "TotalPages", "{", "info", ".", "RecordsOnPage", "=", "info", ".", "PerPage", "\n", "}", "else", "{", "info", ".", "RecordsOnPage", "=", "int", "(", "math", ".", "Mod", "(", "float64", "(", "count", ")", ",", "float64", "(", "perPage", ")", ")", ")", "\n\n", "if", "info", ".", "RecordsOnPage", "==", "0", "&&", "count", ">", "0", "{", "info", ".", "RecordsOnPage", "=", "perPage", "\n", "}", "\n\n", "}", "\n\n", "return", "info", ",", "nil", "\n", "}" ]
18,618
all-18619
[ "NullNotification", "is", "the", "builder", "for", "tests", "where", "no", "side", "effects", "are", "desired" ]
[ "func", "NullNotification", "(", "<mask>", ",", "message", "string", ")", "GNotifier", "{", "config", ":=", "&", "Config", "{", "title", ",", "message", ",", "5000", ",", "\"", "\"", "}", "\n", "n", ":=", "&", "nullNotifier", "{", "Config", ":", "config", "}", "\n", "return", "n", "\n", "}" ]
18,619
all-18620
[ "NewEdit", "opens", "a", "file", "to", "edit", ";", "it", "is", "created", "a", "backup", "." ]
[ "func", "NewEdit", "(", "filename", "string", ")", "(", "*", "edit", ",", "error", ")", "{", "if", "err", ":=", "Backup", "(", "filename", ")", ";", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "<mask>", ",", "err", ":=", "os", ".", "OpenFile", "(", "filename", ",", "os", ".", "O_RDWR", ",", "0666", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "return", "&", "edit", "{", "_editDefault", ",", "file", ",", "bufio", ".", "NewReadWriter", "(", "bufio", ".", "NewReader", "(", "file", ")", ",", "bufio", ".", "NewWriter", "(", "file", ")", ")", ",", "}", ",", "nil", "\n", "}" ]
18,620
all-18621
[ "ToTable", "turns", "StringData", "type", "into", "a", "TabularData", "type" ]
[ "func", "(", "s", "StringData", ")", "ToTable", "(", ")", "TabularData", "{", "var", "tabData", "TabularData", "\n", "lines", ":=", "strings", ".", "Split", "(", "string", "(", "s", ")", ",", "\"", "\\n", "\"", ")", "\n", "for", "_", ",", "line", ":=", "range", "lines", "{", "row", ":=", "strings", ".", "Split", "(", "<mask>", ",", "\"", "\"", ")", "\n", "row", "=", "row", "[", "1", ":", "len", "(", "row", ")", "-", "1", "]", "\n", "for", "i", ",", "c", ":=", "range", "row", "{", "row", "[", "i", "]", "=", "strings", ".", "TrimSpace", "(", "c", ")", "\n", "}", "\n", "tabData", "=", "append", "(", "tabData", ",", "row", ")", "\n", "}", "\n", "return", "tabData", "\n", "}" ]
18,621
all-18622
[ "Int64Range", "param", "must", "be", "a", "integer", "and", "range", "is", "[", "n", "m", "]" ]
[ "func", "(", "c", "*", "Controller", ")", "Int64Range", "(", "fieldName", "string", ",", "p", "interface", "{", "}", ",", "n", "int64", ",", "m", "int64", ")", "int64", "{", "if", "p", "==", "nil", "{", "p", "=", "0", "\n", "}", "\n", "value", ",", "<mask>", ":=", "c", ".", "toNumber64", "(", "p", ")", "\n\n", "if", "ok", "==", "false", "{", "panic", "(", "(", "&", "ValidationError", "{", "}", ")", ".", "New", "(", "fieldName", "+", "\"", "", "", "", "\n", "}", "\n", "b", ":=", "c", ".", "Validate", ".", "Range64", "(", "value", ",", "n", ",", "m", ")", "\n", "if", "b", "==", "false", "{", "panic", "(", "(", "&", "ValidationError", "{", "}", ")", ".", "New", "(", "fieldName", "+", "\"", "r", "a", "Int(n, ", "1", "0) + \" 到 ", "\"", " ", "+", "st", "r", "o", "v", "a", "I", "t(m, 10", ")", "))", "", "", "", "", "", "", "", "\n", "}", "\n", "return", "value", "\n", "}" ]
18,622
all-18623
[ "AddNamed", "is", "a", "wrapper", "around", "gtk_stack_add_named", "()", "." ]
[ "func", "(", "v", "*", "Stack", ")", "AddNamed", "(", "<mask>", "IWidget", ",", "name", "string", ")", "{", "cstr", ":=", "C", ".", "CString", "(", "name", ")", "\n", "defer", "C", ".", "free", "(", "unsafe", ".", "Pointer", "(", "cstr", ")", ")", "\n", "C", ".", "gtk_stack_add_named", "(", "v", ".", "native", "(", ")", ",", "child", ".", "toWidget", "(", ")", ",", "(", "*", "C", ".", "gchar", ")", "(", "cstr", ")", ")", "\n", "}" ]
18,623
all-18624
[ "Set", "records", "the", "value", "passed" ]
[ "func", "(", "s", "*", "Strings", ")", "Set", "(", "value", "string", ")", "error", "{", "if", "!", "s", ".", "beenSet", "{", "s", ".", "beenSet", "=", "true", "\n", "// Value is being set, don't use default.", "s", ".", "vals", "=", "nil", "\n", "}", "\n", "s", ".", "vals", "=", "<mask>", "(", "s", ".", "vals", ",", "value", ")", "\n", "return", "nil", "\n", "}" ]
18,624
all-18625
[ "TODO", "Test" ]
[ "func", "AddToIPRangeCounts", "(", "counts", "map", "[", "string", "]", "int", ",", "ip", "string", ")", "map", "[", "string", "]", "int", "{", "changes", ":=", "make", "(", "map", "[", "string", "]", "int", ")", "\n", "ipParts", ":=", "strings", ".", "Split", "(", "ip", ",", "\"", "\"", ")", "\n", "for", "i", ":=", "1", ";", "i", "<", "len", "(", "ipParts", ")", ";", "i", "++", "{", "prefix", ":=", "strings", ".", "Join", "(", "ipParts", "[", ":", "i", "]", ",", "\"", "\"", ")", "\n", "counts", "[", "prefix", "]", "+=", "1", "\n", "<mask>", "[", "prefix", "]", "=", "counts", "[", "prefix", "]", "\n", "}", "\n", "return", "changes", "\n", "}" ]
18,625
all-18626
[ "Client", "returns", "a", "ClientInterface", "based", "on", "the", "flags", "provided", "." ]
[ "func", "(", "o", "*", "KubernetesClientOptions", ")", "Client", "(", "t", "<mask>", ")", "(", "ClientInterface", ",", "error", ")", "{", "if", "o", ".", "inMemory", "{", "return", "newDummyClient", "(", "t", ")", ",", "nil", "\n", "}", "\n", "return", "o", ".", "newCRDClient", "(", "t", ")", "\n", "}" ]
18,626
all-18627
[ "PopFrame", "pops", "the", "frame", "from", "the", "top", "of", "the", "frame", "stack" ]
[ "func", "(", "st", "*", "State", ")", "PopFrame", "(", ")", "*", "<mask>", ".", "Frame", "{", "x", ":=", "st", ".", "frames", ".", "Pop", "(", ")", "\n", "if", "x", "==", "nil", "{", "return", "nil", "\n", "}", "\n", "f", ":=", "x", ".", "(", "*", "frame", ".", "Frame", ")", "\n", "for", "i", ":=", "st", ".", "framestack", ".", "Size", "(", ")", ";", "i", ">", "f", ".", "Mark", "(", ")", ";", "i", "--", "{", "st", ".", "framestack", ".", "Pop", "(", ")", "\n", "}", "\n", "return", "f", "\n", "}" ]
18,627
all-18628
[ "/", "*", "Generates", "a", "formatted", "matcher", "success", "/", "failure", "message", "of", "the", "form", ":" ]
[ "func", "Message", "(", "actual", "interface", "{", "}", ",", "message", "string", ",", "expected", "...", "interface", "{", "}", ")", "string", "{", "if", "len", "(", "expected", ")", "==", "0", "{", "return", "fmt", ".", "Sprintf", "(", "\"", "\\n", "\\n", "\"", ",", "Object", "(", "actual", ",", "1", ")", ",", "message", ")", "\n", "}", "\n", "return", "fmt", ".", "Sprintf", "(", "\"", "\\n", "\\n", "\\n", "\"", ",", "Object", "(", "actual", ",", "1", ")", ",", "message", ",", "<mask>", "(", "expected", "[", "0", "]", ",", "1", ")", ")", "\n", "}" ]
18,628
all-18629
[ "determine", "if", "a", "name", "corresponds", "to", "a", "vertex", "array", "object" ]
[ "func", "IsVertexArray", "(", "array", "uint32", ")", "bool", "{", "<mask>", ":=", "C", ".", "glowIsVertexArray", "(", "gpIsVertexArray", ",", "(", "C", ".", "GLuint", ")", "(", "array", ")", ")", "\n", "return", "ret", "==", "TRUE", "\n", "}" ]
18,629
all-18630
[ "UnmarshalJSON", "supports", "json", ".", "Unmarshaler", "interface" ]
[ "func", "(", "v", "*", "UnbindParams", ")", "UnmarshalJSON", "(", "<mask>", "[", "]", "byte", ")", "error", "{", "r", ":=", "jlexer", ".", "Lexer", "{", "Data", ":", "data", "}", "\n", "easyjsonC5a4559bDecodeGithubComChromedpCdprotoTethering", "(", "&", "r", ",", "v", ")", "\n", "return", "r", ".", "Error", "(", ")", "\n", "}" ]
18,630
all-18631
[ "Add", "adds", "a", "relay", "item", "." ]
[ "func", "(", "r", "*", "relayItems", ")", "Add", "(", "id", "uint32", ",", "item", "relayItem", ")", "{", "r", ".", "Lock", "(", ")", "\n", "r", ".", "<mask>", "[", "id", "]", "=", "item", "\n", "r", ".", "Unlock", "(", ")", "\n", "}" ]
18,631
all-18632
[ "match", "reports", "whether", "the", "file", "path", "matches", "the", "regexp", "." ]
[ "func", "(", "f", "*", "filepathPat", ")", "match", "(", "path", "string", ")", "bool", "{", "return", "f", ".", "regexp", ".", "MatchString", "(", "<mask>", ")", "\n", "}" ]
18,632
all-18633
[ "Monitor", "mocks", "base", "method" ]
[ "func", "(", "m", "*", "MockUdev", ")", "Monitor", "(", "arg0", "chan", "*", "udev", ".", "UEvent", ")", "chan", "bool", "{", "<mask>", ":=", "m", ".", "ctrl", ".", "Call", "(", "m", ",", "\"", "\"", ",", "arg0", ")", "\n", "ret0", ",", "_", ":=", "ret", "[", "0", "]", ".", "(", "chan", "bool", ")", "\n", "return", "ret0", "\n", "}" ]
18,633
all-18634
[ "Set", "sets", "the", "EWMA", "s", "value", "." ]
[ "func", "(", "e", "*", "VariableEWMA", ")", "Set", "(", "value", "float64", ")", "{", "e", ".", "value", "=", "<mask>", "\n", "if", "e", ".", "count", "<=", "WARMUP_SAMPLES", "{", "e", ".", "count", "=", "WARMUP_SAMPLES", "+", "1", "\n", "}", "\n", "}" ]
18,634
all-18635
[ "title", ":", "delete", "provisioner", "cluster", "path", ":", "/", "provisioner", "/", "clusters", "/", "{", "name", "}", "method", ":", "DELETE", "consume", ":", "application", "/", "x", "-", "www", "-", "form", "-", "urlencoded", "produce", ":", "application", "/", "x", "-", "json", "-", "stream", "responses", ":", "200", ":", "Ok", "401", ":", "Unauthorized", "404", ":", "Cluster", "not", "found" ]
[ "func", "deleteCluster", "(", "w", "http", ".", "ResponseWriter", ",", "r", "*", "http", ".", "Request", ",", "t", "auth", ".", "<mask>", ")", "(", "err", "error", ")", "{", "allowed", ":=", "permission", ".", "Check", "(", "t", ",", "permission", ".", "PermClusterDelete", ")", "\n", "if", "!", "allowed", "{", "return", "permission", ".", "ErrUnauthorized", "\n", "}", "\n\n", "clusterName", ":=", "r", ".", "URL", ".", "Query", "(", ")", ".", "Get", "(", "\"", "\"", ")", "\n", "evt", ",", "err", ":=", "event", ".", "New", "(", "&", "event", ".", "Opts", "{", "Target", ":", "event", ".", "Target", "{", "Type", ":", "event", ".", "TargetTypeCluster", ",", "Value", ":", "clusterName", "}", ",", "Kind", ":", "permission", ".", "PermClusterDelete", ",", "Owner", ":", "t", ",", "CustomData", ":", "event", ".", "FormToCustomData", "(", "InputFields", "(", "r", ")", ")", ",", "Allowed", ":", "event", ".", "Allowed", "(", "permission", ".", "PermClusterReadEvents", ")", ",", "}", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "defer", "func", "(", ")", "{", "evt", ".", "Done", "(", "err", ")", "}", "(", ")", "\n", "streamResponse", ":=", "strings", ".", "HasPrefix", "(", "r", ".", "Header", ".", "Get", "(", "\"", "\"", ")", ",", "\"", "\"", ")", "\n", "if", "streamResponse", "{", "w", ".", "Header", "(", ")", ".", "Set", "(", "\"", "\"", ",", "\"", "\"", ")", "\n", "keepAliveWriter", ":=", "tsuruIo", ".", "NewKeepAliveWriter", "(", "w", ",", "30", "*", "time", ".", "Second", ",", "\"", "\"", ")", "\n", "defer", "keepAliveWriter", ".", "Stop", "(", ")", "\n", "writer", ":=", "&", "tsuruIo", ".", "SimpleJsonMessageEncoderWriter", "{", "Encoder", ":", "json", ".", "NewEncoder", "(", "keepAliveWriter", ")", "}", "\n", "evt", ".", "SetLogWriter", "(", "writer", ")", "\n", "}", "\n", "err", "=", "servicemanager", ".", "Cluster", ".", "Delete", "(", "provTypes", ".", "Cluster", "{", "Name", ":", "clusterName", ",", "Writer", ":", "evt", "}", ")", "\n", "if", "err", "!=", "nil", "{", "if", "errors", ".", "Cause", "(", "err", ")", "==", "provTypes", ".", "ErrClusterNotFound", "{", "return", "&", "tsuruErrors", ".", "HTTP", "{", "Code", ":", "http", ".", "StatusNotFound", ",", "Message", ":", "err", ".", "Error", "(", ")", ",", "}", "\n", "}", "\n", "return", "err", "\n", "}", "\n", "return", "nil", "\n", "}" ]
18,635
all-18636
[ "DockerClientVersion", "returns", "the", "version", "of", "the", "Docker", "client", "on", "the", "host", "that", "ssh", "is", "connected", "to", "e", ".", "g", ".", "1", ".", "12", ".", "1", "." ]
[ "func", "DockerClientVersion", "(", "ssh", "SSHCommander", ")", "(", "string", ",", "error", ")", "{", "// `docker version --format {{.Client.Version}}` would be preferable, but", "// that fails if the server isn't running yet.", "//", "// output is expected to be something like", "//", "// Docker version 1.12.1, build 7a86f89", "output", ",", "err", ":=", "ssh", ".", "SSHCommand", "(", "\"", "\"", ")", "\n", "if", "err", "!=", "nil", "{", "return", "\"", "\"", ",", "err", "\n", "}", "\n\n", "words", ":=", "strings", ".", "Fields", "(", "output", ")", "\n", "if", "len", "(", "words", ")", "<", "3", "||", "words", "[", "0", "]", "!=", "\"", "\"", "||", "words", "[", "1", "]", "!=", "\"", "\"", "{", "return", "\"", "\"", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "<mask>", ")", "\n", "}", "\n\n", "return", "strings", ".", "TrimRight", "(", "words", "[", "2", "]", ",", "\"", "\"", ")", ",", "nil", "\n", "}" ]
18,636
all-18637
[ "/", "*", "DecodeImageMem", "decodes", "an", "image", "from", "an", "in", "memory", "byte", "buffer", "." ]
[ "func", "DecodeImageMem", "(", "data", "[", "]", "<mask>", ")", "*", "IplImage", "{", "buf", ":=", "CreateMatHeader", "(", "1", ",", "len", "(", "data", ")", ",", "CV_8U", ")", "\n", "buf", ".", "SetData", "(", "unsafe", ".", "Pointer", "(", "&", "data", "[", "0", "]", ")", ",", "CV_AUTOSTEP", ")", "\n", "defer", "buf", ".", "Release", "(", ")", "\n\n", "return", "DecodeImage", "(", "unsafe", ".", "Pointer", "(", "buf", ")", ",", "CV_LOAD_IMAGE_UNCHANGED", ")", "\n", "}" ]
18,637
all-18638
[ "PaperSizeGetDefault", "()", "is", "a", "wrapper", "around", "gtk_paper_size_get_default", "()", "." ]
[ "func", "PaperSizeGetDefaultRightMargin", "(", "unit", "Unit", ")", "string", "{", "c", ":=", "C", ".", "gtk_paper_size_get_default", "(", ")", "\n", "return", "C", ".", "GoString", "(", "(", "*", "C", ".", "<mask>", ")", "(", "c", ")", ")", "\n", "}" ]
18,638
all-18639
[ "GetOrder", "gets", "a", "particular", "order", "referenced", "by", "id" ]
[ "func", "(", "c", "Client", ")", "GetOrder", "(", "<mask>", "string", ")", "(", "*", "order", ",", "error", ")", "{", "holder", ":=", "orderHolder", "{", "}", "\n", "if", "err", ":=", "c", ".", "Get", "(", "\"", "\"", "+", "id", ",", "nil", ",", "&", "holder", ")", ";", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "if", "err", ":=", "checkApiErrors", "(", "holder", ".", "response", ",", "\"", "\"", ")", ";", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "return", "&", "holder", ".", "Order", ",", "nil", "\n", "}" ]
18,639
all-18640
[ "Plans", "returns", "the", "service", "plans", ".", "The", "api", "should", "be", "prepared", "to", "receive", "the", "request", "like", "below", ":", "GET", "/", "resources", "/", "plans" ]
[ "func", "(", "c", "*", "endpointClient", ")", "Plans", "(", "requestID", "string", ")", "(", "[", "]", "Plan", ",", "error", ")", "{", "url", ":=", "\"", "\"", "\n", "resp", ",", "err", ":=", "c", ".", "issueRequest", "(", "url", ",", "\"", "\"", ",", "nil", ",", "requestID", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "defer", "resp", ".", "Body", ".", "Close", "(", ")", "\n", "if", "resp", ".", "StatusCode", "!=", "http", ".", "StatusOK", "{", "return", "nil", ",", "nil", "\n", "}", "\n", "result", ":=", "[", "]", "Plan", "{", "}", "\n", "err", "=", "c", ".", "jsonFromResponse", "(", "resp", ",", "&", "result", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "return", "<mask>", ",", "nil", "\n", "}" ]
18,640
all-18641
[ "jitteredBackoff", "implements", "the", "FullJitter", "algorithm", "presented", "in", "https", ":", "//", "aws", ".", "amazon", ".", "com", "/", "blogs", "/", "architecture", "/", "exponential", "-", "backoff", "-", "and", "-", "jitter", "/" ]
[ "func", "jitteredBackoff", "(", "rand", "*", "rand", ".", "Rand", ",", "attempt", "int", ",", "min", ",", "max", "time", ".", "Duration", ",", "coeff", "float64", ")", "time", ".", "Duration", "{", "d", ":=", "time", ".", "Duration", "(", "float64", "(", "min", ")", "*", "math", ".", "Pow", "(", "coeff", ",", "float64", "(", "attempt", ")", ")", ")", "\n", "if", "d", ">", "max", "||", "d", "<=", "0", "/* overflow */", "{", "d", "=", "max", "\n", "}", "\n", "return", "<mask>", "+", "time", ".", "Duration", "(", "rand", ".", "Int63n", "(", "int64", "(", "d", "-", "min", ")", ")", ")", "\n", "}" ]
18,641
all-18642
[ "List", "the", "caches", "for", "this", "provisionerId", "/", "workerType", "that", "should", "to", "be", "purged", "if", "they", "are", "from", "before", "the", "time", "given", "in", "the", "response", ".", "This", "is", "intended", "to", "be", "used", "by", "workers", "to", "determine", "which", "caches", "to", "purge", ".", "See", "#purgeRequests" ]
[ "func", "(", "purgeCache", "*", "PurgeCache", ")", "PurgeRequests", "(", "provisionerId", ",", "workerType", ",", "since", "string", ")", "(", "*", "OpenPurgeRequestList", ",", "error", ")", "{", "v", ":=", "<mask>", ".", "Values", "{", "}", "\n", "if", "since", "!=", "\"", "\"", "{", "v", ".", "Add", "(", "\"", "\"", ",", "since", ")", "\n", "}", "\n", "cd", ":=", "tcclient", ".", "Client", "(", "*", "purgeCache", ")", "\n", "responseObject", ",", "_", ",", "err", ":=", "(", "&", "cd", ")", ".", "APICall", "(", "nil", ",", "\"", "\"", ",", "\"", "\"", "+", "url", ".", "QueryEscape", "(", "provisionerId", ")", "+", "\"", "\"", "+", "url", ".", "QueryEscape", "(", "workerType", ")", ",", "new", "(", "OpenPurgeRequestList", ")", ",", "v", ")", "\n", "return", "responseObject", ".", "(", "*", "OpenPurgeRequestList", ")", ",", "err", "\n", "}" ]
18,642
all-18643
[ "UnmarshalJSON", "supports", "json", ".", "Unmarshaler", "interface" ]
[ "func", "(", "v", "*", "RequestDatabaseNamesReturns", ")", "UnmarshalJSON", "(", "data", "[", "]", "<mask>", ")", "error", "{", "r", ":=", "jlexer", ".", "Lexer", "{", "Data", ":", "data", "}", "\n", "easyjsonC5a4559bDecodeGithubComChromedpCdprotoIndexeddb2", "(", "&", "r", ",", "v", ")", "\n", "return", "r", ".", "Error", "(", ")", "\n", "}" ]
18,643
all-18644
[ "Read", "loads", "the", "Pachyderm", "config", "on", "this", "machine", ".", "If", "an", "existing", "configuration", "cannot", "be", "found", "it", "sets", "up", "the", "defaults", ".", "Read", "returns", "a", "nil", "Config", "if", "and", "only", "if", "it", "returns", "a", "non", "-", "nil", "error", "." ]
[ "func", "Read", "(", ")", "(", "*", "Config", ",", "error", ")", "{", "var", "c", "*", "Config", "\n\n", "// Read json file", "p", ":=", "configPath", "(", ")", "\n", "if", "raw", ",", "err", ":=", "ioutil", ".", "ReadFile", "(", "p", ")", ";", "err", "==", "nil", "{", "err", "=", "json", ".", "Unmarshal", "(", "<mask>", ",", "&", "c", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "}", "else", "if", "os", ".", "IsNotExist", "(", "err", ")", "{", "// File doesn't exist, so create a new config", "fmt", ".", "Println", "(", "\"", "\"", ",", "p", ")", "\n", "c", "=", "&", "Config", "{", "}", "\n", "}", "else", "{", "return", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "p", ",", "err", ")", "\n", "}", "\n", "if", "c", ".", "UserID", "==", "\"", "\"", "{", "fmt", ".", "Printf", "(", "\"", "\"", "+", "\"", "\\n", "\"", ",", "p", ")", "\n", "uuid", ",", "err", ":=", "uuid", ".", "NewV4", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "c", ".", "UserID", "=", "uuid", ".", "String", "(", ")", "\n", "if", "err", ":=", "c", ".", "Write", "(", ")", ";", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "}", "\n", "return", "c", ",", "nil", "\n", "}" ]
18,644
all-18645
[ "String", "returns", "the", "peer", "name", "and", "nickname", "." ]
[ "func", "(", "<mask>", "*", "Peer", ")", "String", "(", ")", "string", "{", "return", "fmt", ".", "Sprint", "(", "peer", ".", "Name", ",", "\"", "\"", ",", "peer", ".", "NickName", ",", "\"", "\"", ")", "\n", "}" ]
18,645
all-18646
[ "Grant", "adds", "a", "set", "of", "permissions", "to", "the", "permission", "object", "on", "which", "it", "is", "called", "returning", "a", "new", "permission", "object", "." ]
[ "func", "(", "rw", "RWPermission", ")", "Grant", "(", "n", "RWPermission", ")", "(", "RWPermission", ",", "error", ")", "{", "var", "<mask>", "RWPermission", "\n", "currentRead", ":=", "types", ".", "NewUnsafeSet", "(", "rw", ".", "Read", "...", ")", "\n", "for", "_", ",", "r", ":=", "range", "n", ".", "Read", "{", "if", "currentRead", ".", "Contains", "(", "r", ")", "{", "return", "out", ",", "authErr", "(", "http", ".", "StatusConflict", ",", "\"", "\"", ",", "r", ")", "\n", "}", "\n", "currentRead", ".", "Add", "(", "r", ")", "\n", "}", "\n", "currentWrite", ":=", "types", ".", "NewUnsafeSet", "(", "rw", ".", "Write", "...", ")", "\n", "for", "_", ",", "w", ":=", "range", "n", ".", "Write", "{", "if", "currentWrite", ".", "Contains", "(", "w", ")", "{", "return", "out", ",", "authErr", "(", "http", ".", "StatusConflict", ",", "\"", "\"", ",", "w", ")", "\n", "}", "\n", "currentWrite", ".", "Add", "(", "w", ")", "\n", "}", "\n", "out", ".", "Read", "=", "currentRead", ".", "Values", "(", ")", "\n", "out", ".", "Write", "=", "currentWrite", ".", "Values", "(", ")", "\n", "sort", ".", "Strings", "(", "out", ".", "Read", ")", "\n", "sort", ".", "Strings", "(", "out", ".", "Write", ")", "\n", "return", "out", ",", "nil", "\n", "}" ]
18,646
all-18647
[ "addSelectorExpr", "adds", "an", "accessor", "for", "an", "identifier", "selector", "expression", "for", "a", "given", "receiver", "and", "field" ]
[ "func", "(", "t", "*", "templateData", ")", "addSelectorExpr", "(", "x", "*", "ast", ".", "SelectorExpr", ",", "receiverType", ",", "fieldName", "string", ")", "{", "if", "strings", ".", "ToLower", "(", "fieldName", "[", ":", "1", "]", ")", "==", "fieldName", "[", ":", "1", "]", "{", "// non-exported field", "return", "\n", "}", "\n\n", "var", "xX", "string", "\n", "if", "<mask>", ",", "ok", ":=", "x", ".", "X", ".", "(", "*", "ast", ".", "Ident", ")", ";", "ok", "{", "xX", "=", "xx", ".", "String", "(", ")", "\n", "}", "\n\n", "switch", "xX", "{", "case", "\"", "\"", ",", "\"", "\"", ":", "if", "xX", "==", "\"", "\"", "{", "t", ".", "Imports", "[", "\"", "\"", "]", "=", "\"", "\"", "\n", "}", "else", "{", "t", ".", "Imports", "[", "xX", "]", "=", "xX", "\n", "}", "\n", "fieldType", ":=", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "xX", ",", "x", ".", "Sel", ".", "Name", ")", "\n", "zeroValue", ":=", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "xX", ",", "x", ".", "Sel", ".", "Name", ")", "\n", "if", "xX", "==", "\"", "\"", "&&", "x", ".", "Sel", ".", "Name", "==", "\"", "\"", "{", "zeroValue", "=", "`\"\"`", "\n", "}", "\n", "if", "xX", "==", "\"", "\"", "&&", "x", ".", "Sel", ".", "Name", "==", "\"", "\"", "{", "zeroValue", "=", "\"", "\"", "\n", "}", "\n", "t", ".", "Accessors", "=", "append", "(", "t", ".", "Accessors", ",", "newAccessor", "(", "receiverType", ",", "fieldName", ",", "fieldType", ",", "zeroValue", ")", ")", "\n", "default", ":", "logf", "(", "\"", "\"", ",", "xX", ",", "receiverType", ",", "fieldName", ",", "x", ")", "\n", "}", "\n", "}" ]
18,647
all-18648
[ "Funcs", "register", "Funcs", "for", "tmpl" ]
[ "func", "(", "tmpl", "*", "Template", ")", "Funcs", "(", "funcMap", "template", ".", "FuncMap", ")", "*", "<mask>", "{", "tmpl", ".", "funcMap", "=", "funcMap", "\n", "return", "tmpl", "\n", "}" ]
18,648
all-18649
[ "Len", "derives", "the", "scalar", "scalar", "length", "of", "the", "vector", ".", "(", "len", ")" ]
[ "func", "(", "v", "Vec2", ")", "Len", "(", ")", "float32", "{", "<mask>", "math32", ".", "Sqrt", "(", "v", "[", "0", "]", "*", "v", "[", "0", "]", "+", "v", "[", "1", "]", "*", "v", "[", "1", "]", ")", "\n", "}" ]
18,649
all-18650
[ "Get", "gets", "the", "value", "from", "the", "specified", "section", "and", "key", "name", "or", "the", "empty", "string", "if", "either", "the", "section", "or", "the", "key", "is", "missing", "." ]
[ "func", "(", "c", "*", "Config", ")", "Get", "(", "section", ",", "key", "string", ")", "string", "{", "for", "_", ",", "sect", ":=", "range", "c", ".", "sections", "{", "if", "sect", ".", "name", "==", "section", "{", "for", "_", ",", "opt", ":=", "range", "sect", ".", "options", "{", "if", "opt", ".", "name", "==", "key", "{", "return", "<mask>", ".", "value", "\n", "}", "\n", "}", "\n", "return", "\"", "\"", "\n", "}", "\n", "}", "\n", "return", "\"", "\"", "\n", "}" ]
18,650
all-18651
[ "New", "creates", "a", "new", "consumer", "to", "a", "trafficcontroller", "." ]
[ "func", "New", "(", "trafficControllerUrl", "string", ",", "tlsConfig", "*", "tls", ".", "Config", ",", "proxy", "func", "(", "*", "http", ".", "Request", ")", "(", "*", "url", ".", "URL", ",", "error", ")", ")", "*", "Consumer", "{", "if", "proxy", "==", "nil", "{", "proxy", "=", "<mask>", ".", "ProxyFromEnvironment", "\n", "}", "\n\n", "return", "&", "Consumer", "{", "trafficControllerUrl", ":", "trafficControllerUrl", ",", "debugPrinter", ":", "nullDebugPrinter", "{", "}", ",", "client", ":", "&", "http", ".", "Client", "{", "Transport", ":", "&", "http", ".", "Transport", "{", "Proxy", ":", "proxy", ",", "TLSClientConfig", ":", "tlsConfig", ",", "TLSHandshakeTimeout", ":", "internal", ".", "Timeout", ",", "DisableKeepAlives", ":", "true", ",", "}", ",", "Timeout", ":", "internal", ".", "Timeout", ",", "}", ",", "minRetryDelay", ":", "int64", "(", "DefaultMinRetryDelay", ")", ",", "maxRetryDelay", ":", "int64", "(", "DefaultMaxRetryDelay", ")", ",", "maxRetryCount", ":", "int64", "(", "DefaultMaxRetryCount", ")", ",", "dialer", ":", "websocket", ".", "Dialer", "{", "HandshakeTimeout", ":", "internal", ".", "Timeout", ",", "Proxy", ":", "proxy", ",", "TLSClientConfig", ":", "tlsConfig", ",", "}", ",", "recentPathBuilder", ":", "defaultRecentPathBuilder", ",", "streamPathBuilder", ":", "defaultStreamPathBuilder", ",", "}", "\n", "}" ]
18,651
all-18652
[ "GetQuery", "returns", "the", "Query", "field", "if", "non", "-", "nil", "zero", "value", "otherwise", "." ]
[ "func", "(", "e", "*", "EventTimelineDefinition", ")", "GetQuery", "(", ")", "string", "{", "if", "e", "==", "nil", "||", "e", ".", "Query", "==", "nil", "{", "return", "\"", "\"", "\n", "}", "\n", "return", "*", "e", ".", "<mask>", "\n", "}" ]
18,652
all-18653
[ "Do", "executes", "CacheStorage", ".", "requestCacheNames", "against", "the", "provided", "context", ".", "returns", ":", "caches", "-", "Caches", "for", "the", "security", "origin", "." ]
[ "func", "(", "p", "*", "RequestCacheNamesParams", ")", "Do", "(", "ctx", "context", ".", "Context", ")", "(", "caches", "[", "]", "*", "Cache", ",", "err", "error", ")", "{", "// execute", "<mask>", "res", "RequestCacheNamesReturns", "\n", "err", "=", "cdp", ".", "Execute", "(", "ctx", ",", "CommandRequestCacheNames", ",", "p", ",", "&", "res", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "return", "res", ".", "Caches", ",", "nil", "\n", "}" ]
18,653
all-18654
[ "NewStack", "instantiates", "a", "new", "FILO", "structure", "." ]
[ "func", "NewStack", "(", "entries", "...", "interface", "{", "}", ")", "*", "Stack", "{", "retval", ":=", "&", "Stack", "{", "}", "\n", "retval", ".", "underlyer", "=", "NewLinkedList", "(", ")", "\n\n", "for", "_", ",", "<mask>", ":=", "range", "entries", "{", "retval", ".", "Push", "(", "entry", ")", "\n", "}", "\n", "return", "retval", "\n", "}" ]
18,654
all-18655
[ "Append", "is", "a", "wrapper", "around", "gtk_menu_shell_append", "()", "." ]
[ "func", "(", "v", "*", "MenuShell", ")", "Append", "(", "<mask>", "IMenuItem", ")", "{", "C", ".", "gtk_menu_shell_append", "(", "v", ".", "native", "(", ")", ",", "child", ".", "toWidget", "(", ")", ")", "\n", "}" ]
18,655
all-18656
[ "updateAppliedStatusUnsafe", "updates", "the", "resource", "transitioning", "status" ]
[ "func", "(", "secret", "*", "ASMSecretResource", ")", "updateAppliedStatusUnsafe", "(", "knownStatus", "resourcestatus", ".", "ResourceStatus", ")", "{", "if", "<mask>", ".", "appliedStatus", "==", "resourcestatus", ".", "ResourceStatus", "(", "ASMSecretStatusNone", ")", "{", "return", "\n", "}", "\n\n", "// Check if the resource transition has already finished", "if", "secret", ".", "appliedStatus", "<=", "knownStatus", "{", "secret", ".", "appliedStatus", "=", "resourcestatus", ".", "ResourceStatus", "(", "ASMSecretStatusNone", ")", "\n", "}", "\n", "}" ]
18,656
all-18657
[ "GetPullSucceeded", "safely", "returns", "the", "PullSucceeded", "of", "the", "imageState" ]
[ "func", "(", "imageState", "*", "ImageState", ")", "GetPullSucceeded", "(", ")", "bool", "{", "imageState", ".", "<mask>", ".", "RLock", "(", ")", "\n", "defer", "imageState", ".", "lock", ".", "RUnlock", "(", ")", "\n\n", "return", "imageState", ".", "PullSucceeded", "\n", "}" ]
18,657
all-18658
[ "SetSortColumnId", "()", "is", "a", "wrapper", "around", "gtk_tree_sortable_set_sort_column_id", "()", "." ]
[ "func", "(", "v", "*", "TreeStore", ")", "SetSortColumnId", "(", "column", "int", ",", "order", "SortType", ")", "{", "sort", ":=", "C", ".", "toGtkTreeSortable", "(", "unsafe", ".", "Pointer", "(", "v", ".", "Native", "(", ")", ")", ")", "\n", "C", ".", "gtk_tree_sortable_set_sort_column_id", "(", "<mask>", ",", "C", ".", "gint", "(", "column", ")", ",", "C", ".", "GtkSortType", "(", "order", ")", ")", "\n", "}" ]
18,658
all-18659
[ "Warn", "formats", "a", "given", "message", "according", "to", "given", "params", "to", "log", "with", "level", "Warn", "." ]
[ "func", "(", "dl", "*", "DefaultLogger", ")", "Warn", "(", "message", "string", ",", "params", "...", "interface", "{", "}", ")", "{", "dl", ".", "logger", ".", "Warnf", "(", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "caller", "(", ")", ",", "<mask>", ")", ",", "params", "...", ")", "\n", "}" ]
18,659
all-18660
[ "SearchAcknowledgements", "returns", "acknowledgements", "matching", "the", "specified", "search", "query", "and", "/", "or", "filter", ".", "If", "nil", "is", "passed", "for", "both", "parameters", "all", "acknowledgements", "will", "be", "returned", "." ]
[ "func", "(", "a", "*", "API", ")", "SearchAcknowledgements", "(", "searchCriteria", "*", "SearchQueryType", ",", "filterCriteria", "*", "SearchFilterType", ")", "(", "*", "[", "]", "Acknowledgement", ",", "error", ")", "{", "q", ":=", "<mask>", ".", "Values", "{", "}", "\n\n", "if", "searchCriteria", "!=", "nil", "&&", "*", "searchCriteria", "!=", "\"", "\"", "{", "q", ".", "Set", "(", "\"", "\"", ",", "string", "(", "*", "searchCriteria", ")", ")", "\n", "}", "\n\n", "if", "filterCriteria", "!=", "nil", "&&", "len", "(", "*", "filterCriteria", ")", ">", "0", "{", "for", "filter", ",", "criteria", ":=", "range", "*", "filterCriteria", "{", "for", "_", ",", "val", ":=", "range", "criteria", "{", "q", ".", "Add", "(", "filter", ",", "val", ")", "\n", "}", "\n", "}", "\n", "}", "\n\n", "if", "q", ".", "Encode", "(", ")", "==", "\"", "\"", "{", "return", "a", ".", "FetchAcknowledgements", "(", ")", "\n", "}", "\n\n", "reqURL", ":=", "url", ".", "URL", "{", "Path", ":", "config", ".", "AcknowledgementPrefix", ",", "RawQuery", ":", "q", ".", "Encode", "(", ")", ",", "}", "\n\n", "result", ",", "err", ":=", "a", ".", "Get", "(", "reqURL", ".", "String", "(", ")", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "err", ")", "\n", "}", "\n\n", "var", "acknowledgements", "[", "]", "Acknowledgement", "\n", "if", "err", ":=", "json", ".", "Unmarshal", "(", "result", ",", "&", "acknowledgements", ")", ";", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "return", "&", "acknowledgements", ",", "nil", "\n", "}" ]
18,660
all-18661
[ "MarshalJSON", "supports", "json", ".", "Marshaler", "interface" ]
[ "func", "(", "v", "CachedResource", ")", "MarshalJSON", "(", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "w", ":=", "jwriter", ".", "Writer", "{", "}", "\n", "easyjsonC5a4559bEncodeGithubComChromedpCdprotoNetwork66", "(", "&", "w", ",", "v", ")", "\n", "return", "w", ".", "<mask>", ".", "BuildBytes", "(", ")", ",", "w", ".", "Error", "\n", "}" ]
18,661
all-18662
[ "draw", "multiple", "instances", "of", "a", "range", "of", "elements", "with", "offset", "applied", "to", "instanced", "attributes" ]
[ "func", "DrawArraysInstancedBaseInstance", "(", "mode", "uint32", ",", "first", "int32", ",", "count", "int32", ",", "instancecount", "int32", ",", "baseinstance", "uint32", ")", "{", "C", ".", "glowDrawArraysInstancedBaseInstance", "(", "gpDrawArraysInstancedBaseInstance", ",", "(", "C", ".", "GLenum", ")", "(", "mode", ")", ",", "(", "C", ".", "GLint", ")", "(", "<mask>", ")", ",", "(", "C", ".", "GLsizei", ")", "(", "count", ")", ",", "(", "C", ".", "GLsizei", ")", "(", "instancecount", ")", ",", "(", "C", ".", "GLuint", ")", "(", "baseinstance", ")", ")", "\n", "}" ]
18,662
all-18663
[ "LoadDirectory", "reads", "all", "the", "schema", "files", "from", "a", "directory", "." ]
[ "func", "LoadDirectory", "(", "dir", "string", ",", "<mask>", "Parser", ")", "(", "err", "error", ")", "{", "// Open dir for reading", "d", ",", "err", ":=", "os", ".", "Open", "(", "dir", ")", "\n", "if", "err", "!=", "nil", "{", "return", "\n", "}", "\n\n", "// Iterate over all the files in the directory.", "for", "{", "// Only read 128 files at a time.", "if", "fis", ",", "err", ":=", "d", ".", "Readdir", "(", "128", ")", ";", "err", "==", "nil", "{", "// Read each entry", "for", "_", ",", "fi", ":=", "range", "fis", "{", "// fmt.Println(\"%#v\", fi)", "// If the FileInfo is a directory, read the directory.", "// Otherwise, read the file.", "switch", "fi", ".", "IsDir", "(", ")", "{", "case", "true", ":", "// return error if there is one", "if", "err", ":=", "LoadDirectory", "(", "fi", ".", "Name", "(", ")", ",", "parser", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "case", "false", ":", "// All schema files should end with .nt", "if", "!", "strings", ".", "HasSuffix", "(", "fi", ".", "Name", "(", ")", ",", "\"", "\"", ")", "{", "break", "\n", "}", "\n\n", "// Read the file", "if", "_", ",", "err", ":=", "LoadFile", "(", "filepath", ".", "Join", "(", "dir", ",", "fi", ".", "Name", "(", ")", ")", ",", "parser", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "}", "\n", "}", "\n", "}", "else", "if", "err", "==", "io", ".", "EOF", "{", "// If there are no more files in the directory, break.", "break", "\n", "}", "else", "{", "// If there is any other error, return it.", "return", "err", "\n", "}", "\n", "}", "\n\n", "// If you have reached this far, you are done.", "return", "nil", "\n", "}" ]
18,663
all-18664
[ "query", "the", "location", "of", "a", "named", "resource", "within", "a", "program" ]
[ "func", "GetProgramResourceLocation", "(", "program", "uint32", ",", "programInterface", "uint32", ",", "<mask>", "*", "uint8", ")", "int32", "{", "ret", ",", "_", ",", "_", ":=", "syscall", ".", "Syscall", "(", "gpGetProgramResourceLocation", ",", "3", ",", "uintptr", "(", "program", ")", ",", "uintptr", "(", "programInterface", ")", ",", "uintptr", "(", "unsafe", ".", "Pointer", "(", "name", ")", ")", ")", "\n", "return", "(", "int32", ")", "(", "ret", ")", "\n", "}" ]
18,664
all-18665
[ "Validate", "ensures", "that", "the", "set", "of", "options", "are", "self", "-", "consistent", "and", "valid" ]
[ "func", "(", "o", "*", "<mask>", ")", "Validate", "(", ")", "error", "{", "ents", ":=", "o", ".", "entries", "(", ")", "\n", "if", "len", "(", "ents", ")", "==", "0", "{", "return", "errors", ".", "New", "(", "\"", "\"", ")", "\n", "}", "\n", "for", "i", ",", "e", ":=", "range", "ents", "{", "if", "err", ":=", "e", ".", "Validate", "(", ")", ";", "err", "!=", "nil", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "i", ",", "err", ")", "\n", "}", "\n", "}", "\n\n", "return", "o", ".", "GcsOptions", ".", "Validate", "(", ")", "\n", "}" ]
18,665
all-18666
[ "ListSecretsPages", "mocks", "base", "method" ]
[ "func", "(", "m", "*", "MockSecretsManagerAPI", ")", "ListSecretsPages", "(", "arg0", "*", "secretsmanager", ".", "ListSecretsInput", ",", "arg1", "func", "(", "*", "secretsmanager", ".", "ListSecretsOutput", ",", "bool", ")", "bool", ")", "error", "{", "<mask>", ":=", "m", ".", "ctrl", ".", "Call", "(", "m", ",", "\"", "\"", ",", "arg0", ",", "arg1", ")", "\n", "ret0", ",", "_", ":=", "ret", "[", "0", "]", ".", "(", "error", ")", "\n", "return", "ret0", "\n", "}" ]
18,666
all-18667
[ "LimitChan", "returns", "a", "rate", "-", "limiting", "channel", ".", "it", "is", "the", "usual", "simple", "golang", "-", "idiomatic", "rate", "-", "limiting", "semaphore", ".", "This", "function", "merely", "initializes", "it", "with", "certain", "buffer", "size", "and", "sends", "that", "many", "values", "so", "it", "is", "ready", "to", "be", "used", "." ]
[ "func", "LimitChan", "(", "limit", "int", ")", "chan", "struct", "{", "}", "{", "limitch", ":=", "make", "(", "chan", "struct", "{", "}", ",", "limit", ")", "\n", "for", "i", ":=", "0", ";", "i", "<", "<mask>", ";", "i", "++", "{", "limitch", "<-", "struct", "{", "}", "{", "}", "\n", "}", "\n", "return", "limitch", "\n", "}" ]
18,667
all-18668
[ "New", "creates", "a", "BasicUI", ".", "This", "should", "be", "the", "first", "function", "you", "call", ".", "This", "is", "not", "thread", "safe", "and", "should", "only", "be", "used", "in", "serial", "applications", "." ]
[ "func", "New", "(", "reader", "io", ".", "Reader", ",", "writer", ",", "errorWriter", "io", ".", "<mask>", ")", "*", "BasicUI", "{", "return", "&", "BasicUI", "{", "Reader", ":", "reader", ",", "Writer", ":", "writer", ",", "ErrorWriter", ":", "errorWriter", ",", "}", "\n", "}" ]
18,668
all-18669
[ "CloseRecv", "closes", "the", "receive", "channel" ]
[ "func", "(", "s", "*", "Stream", ")", "CloseRecv", "(", ")", "{", "s", ".", "mu", ".", "Lock", "(", ")", "\n", "if", "s", ".", "recvBuffer", "!=", "nil", "{", "<mask>", "(", "s", ".", "recvBuffer", ")", "\n", "s", ".", "recvBuffer", "=", "nil", "\n", "}", "\n", "s", ".", "mu", ".", "Unlock", "(", ")", "\n", "}" ]
18,669
all-18670
[ "Approvers", "returns", "ALL", "of", "the", "users", "who", "are", "approvers", "for", "the", "requested", "file", "(", "including", "approvers", "in", "parent", "dirs", "OWNERS", ")", ".", "If", "pkg", "/", "OWNERS", "has", "user1", "and", "pkg", "/", "util", "/", "OWNERS", "has", "user2", "this", "will", "return", "both", "user1", "and", "user2", "for", "the", "path", "pkg", "/", "util", "/", "sets", "/", "file", ".", "go" ]
[ "func", "(", "o", "*", "RepoOwners", ")", "Approvers", "(", "<mask>", "string", ")", "sets", ".", "String", "{", "return", "o", ".", "entriesForFile", "(", "path", ",", "o", ".", "approvers", ",", "false", ")", "\n", "}" ]
18,670
all-18671
[ "/", "*", "deprecated", "since", "version", "3", ".", "14", "and", "should", "not", "be", "used", "in", "newly", "-", "written", "code", "ResizeGripIsVisible", "is", "a", "wrapper", "around", "gtk_window_resize_grip_is_visible", "()", "." ]
[ "func", "(", "v", "*", "Window", ")", "ResizeGripIsVisible", "(", ")", "bool", "{", "c", ":=", "C", ".", "gtk_window_resize_grip_is_visible", "(", "v", ".", "native", "(", ")", ")", "\n", "<mask>", "gobool", "(", "c", ")", "\n", "}" ]
18,671
all-18672
[ "Using", "the", "EZ", "API", "posts", "a", "count", "to", "a", "stat", "at", "a", "specific", "time", "." ]
[ "func", "(", "r", "*", "BasicReporter", ")", "PostEZCountTime", "(", "statName", ",", "ezkey", "string", ",", "count", "int", ",", "timestamp", "int64", ")", "error", "{", "x", ":=", "newEZStatCount", "(", "statName", ",", "ezkey", ",", "count", ")", "\n", "x", ".", "Timestamp", "=", "timestamp", "\n", "r", ".", "<mask>", "(", "x", ")", "\n", "return", "nil", "\n", "}" ]
18,672
all-18673
[ "Shorthand", "for", "kind", "-", "switches", "." ]
[ "func", "unsizedKind", "(", "v", "reflect", ".", "Value", ")", "reflect", ".", "Kind", "{", "switch", "v", ".", "Kind", "(", ")", "{", "case", "reflect", ".", "Int", ",", "reflect", ".", "Int8", ",", "reflect", ".", "Int16", ",", "reflect", ".", "Int32", ",", "reflect", ".", "Int64", ":", "return", "reflect", ".", "Int64", "\n", "case", "reflect", ".", "Uint", ",", "reflect", ".", "Uint8", ",", "reflect", ".", "Uint16", ",", "reflect", ".", "Uint32", ",", "reflect", ".", "Uint64", ",", "reflect", ".", "Uintptr", ":", "return", "reflect", ".", "Uint64", "\n", "<mask>", "reflect", ".", "Float64", ",", "reflect", ".", "Float32", ":", "return", "reflect", ".", "Float64", "\n", "case", "reflect", ".", "Complex128", ",", "reflect", ".", "Complex64", ":", "return", "reflect", ".", "Complex128", "\n", "}", "\n", "return", "v", ".", "Kind", "(", ")", "\n", "}" ]
18,673
all-18674
[ "RequestURI", "returns", "RequestURI", "-", "i", ".", "e", ".", "URI", "without", "Scheme", "and", "Host", "." ]
[ "func", "(", "u", "*", "URI", ")", "RequestURI", "(", ")", "[", "]", "byte", "{", "dst", ":=", "appendQuotedPath", "(", "u", ".", "requestURI", "[", ":", "0", "]", ",", "u", ".", "Path", "(", ")", ")", "\n", "if", "u", ".", "queryArgs", ".", "Len", "(", ")", ">", "0", "{", "dst", "=", "append", "(", "dst", ",", "'?'", ")", "\n", "dst", "=", "u", ".", "queryArgs", ".", "AppendBytes", "(", "dst", ")", "\n", "}", "else", "if", "len", "(", "u", ".", "queryString", ")", ">", "0", "{", "dst", "=", "append", "(", "dst", ",", "'?'", ")", "\n", "dst", "=", "append", "(", "dst", ",", "u", ".", "queryString", "...", ")", "\n", "}", "\n", "if", "len", "(", "u", ".", "hash", ")", ">", "0", "{", "dst", "=", "append", "(", "dst", ",", "'#'", ")", "\n", "dst", "=", "append", "(", "dst", ",", "u", ".", "<mask>", "...", ")", "\n", "}", "\n", "u", ".", "requestURI", "=", "dst", "\n", "return", "u", ".", "requestURI", "\n", "}" ]
18,674
all-18675
[ "Seek", "is", "implementation", "of", "io", ".", "Seeker", "s", "Seek", "." ]
[ "func", "(", "s", "*", "Stream", ")", "Seek", "(", "offset", "int64", ",", "whence", "int", ")", "(", "int64", ",", "error", ")", "{", "if", "s", ".", "resampling", "!=", "nil", "{", "return", "s", ".", "resampling", ".", "Seek", "(", "offset", ",", "whence", ")", "\n", "}", "\n", "return", "s", ".", "orig", ".", "Seek", "(", "<mask>", ",", "whence", ")", "\n", "}" ]
18,675
all-18676
[ "TODO", ":", "gtk_assistant_set_forward_page_func", "SetPageType", "is", "a", "wrapper", "around", "gtk_assistant_set_page_type", "()", "." ]
[ "func", "(", "v", "*", "Assistant", ")", "SetPageType", "(", "<mask>", "IWidget", ",", "ptype", "AssistantPageType", ")", "{", "C", ".", "gtk_assistant_set_page_type", "(", "v", ".", "native", "(", ")", ",", "page", ".", "toWidget", "(", ")", ",", "C", ".", "GtkAssistantPageType", "(", "ptype", ")", ")", "\n", "}" ]
18,676
all-18677
[ "NewImageDestination", "returns", "a", "types", ".", "ImageDestination", "for", "this", "reference", ".", "The", "caller", "must", "call", ".", "Close", "()", "on", "the", "returned", "ImageDestination", "." ]
[ "func", "(", "ref", "ostreeReference", ")", "NewImageDestination", "(", "ctx", "<mask>", ".", "Context", ",", "sys", "*", "types", ".", "SystemContext", ")", "(", "types", ".", "ImageDestination", ",", "error", ")", "{", "var", "tmpDir", "string", "\n", "if", "sys", "==", "nil", "||", "sys", ".", "OSTreeTmpDirPath", "==", "\"", "\"", "{", "tmpDir", "=", "os", ".", "TempDir", "(", ")", "\n", "}", "else", "{", "tmpDir", "=", "sys", ".", "OSTreeTmpDirPath", "\n", "}", "\n", "return", "newImageDestination", "(", "ref", ",", "tmpDir", ")", "\n", "}" ]
18,677
all-18678
[ "CreateStatus", "creates", "or", "updates", "the", "status", "of", "a", "commit", ".", "See", "https", ":", "//", "developer", ".", "github", ".", "com", "/", "v3", "/", "repos", "/", "statuses", "/", "#create", "-", "a", "-", "status" ]
[ "func", "(", "c", "*", "Client", ")", "CreateStatus", "(", "org", ",", "repo", ",", "SHA", "string", ",", "s", "Status", ")", "error", "{", "c", ".", "<mask>", "(", "\"", "\"", ",", "org", ",", "repo", ",", "SHA", ",", "s", ")", "\n", "_", ",", "err", ":=", "c", ".", "request", "(", "&", "request", "{", "method", ":", "http", ".", "MethodPost", ",", "path", ":", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "org", ",", "repo", ",", "SHA", ")", ",", "requestBody", ":", "&", "s", ",", "exitCodes", ":", "[", "]", "int", "{", "201", "}", ",", "}", ",", "nil", ")", "\n", "return", "err", "\n", "}" ]
18,678
all-18679
[ "ContainerNextSnapshot", "returns", "the", "index", "the", "next", "snapshot", "of", "the", "container", "with", "the", "given", "name", "and", "pattern", "should", "have", "." ]
[ "func", "(", "c", "*", "Cluster", ")", "ContainerNextSnapshot", "(", "project", "string", ",", "name", "string", ",", "pattern", "string", ")", "int", "{", "base", ":=", "name", "+", "shared", ".", "SnapshotDelimiter", "\n", "length", ":=", "len", "(", "base", ")", "\n", "q", ":=", "`\nSELECT containers.name\n FROM containers\n JOIN projects ON projects.id = containers.project_id\n WHERE projects.name=? AND containers.type=? AND SUBSTR(containers.name,1,?)=?`", "\n", "var", "numstr", "string", "\n", "inargs", ":=", "[", "]", "interface", "{", "}", "{", "project", ",", "CTypeSnapshot", ",", "length", ",", "<mask>", "}", "\n", "outfmt", ":=", "[", "]", "interface", "{", "}", "{", "numstr", "}", "\n", "results", ",", "err", ":=", "queryScan", "(", "c", ".", "db", ",", "q", ",", "inargs", ",", "outfmt", ")", "\n", "if", "err", "!=", "nil", "{", "return", "0", "\n", "}", "\n", "max", ":=", "0", "\n\n", "for", "_", ",", "r", ":=", "range", "results", "{", "snapOnlyName", ":=", "strings", ".", "SplitN", "(", "r", "[", "0", "]", ".", "(", "string", ")", ",", "shared", ".", "SnapshotDelimiter", ",", "2", ")", "[", "1", "]", "\n", "fields", ":=", "strings", ".", "SplitN", "(", "pattern", ",", "\"", "\"", ",", "2", ")", "\n\n", "var", "num", "int", "\n", "count", ",", "err", ":=", "fmt", ".", "Sscanf", "(", "snapOnlyName", ",", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "fields", "[", "0", "]", ",", "fields", "[", "1", "]", ")", ",", "&", "num", ")", "\n", "if", "err", "!=", "nil", "||", "count", "!=", "1", "{", "continue", "\n", "}", "\n", "if", "num", ">=", "max", "{", "max", "=", "num", "+", "1", "\n", "}", "\n", "}", "\n\n", "return", "max", "\n", "}" ]
18,679
all-18680
[ "parseUint", "parses", "a", "string", "into", "a", "base", "10", "int" ]
[ "func", "parseUint", "(", "s", "string", ")", "(", "uint64", ",", "error", ")", "{", "if", "s", "==", "\"", "\"", "{", "return", "0", ",", "nil", "\n", "}", "\n\n", "result", ",", "err", ":=", "strconv", ".", "ParseUint", "(", "s", ",", "10", ",", "64", ")", "\n", "if", "err", "!=", "nil", "{", "return", "0", ",", "errors", ".", "Wrap", "(", "err", ",", "\"", "\"", ")", "\n", "}", "\n", "return", "<mask>", ",", "nil", "\n", "}" ]
18,680
all-18681
[ "ReadCommand", "reads", "cmd", "from", "r", "or", "returns", "an", "error", "if", "no", "commands", "could", "be", "read", "." ]
[ "func", "ReadCommand", "(", "r", "*", "bufio", ".", "Reader", ")", "(", "cmd", "Command", ",", "err", "error", ")", "{", "var", "line", "string", "\n\n", "if", "<mask>", ",", "err", "=", "r", ".", "ReadString", "(", "'\\n'", ")", ";", "err", "!=", "nil", "{", "return", "\n", "}", "\n\n", "parts", ":=", "strings", ".", "Split", "(", "strings", ".", "TrimSpace", "(", "line", ")", ",", "\"", "\"", ")", "\n\n", "if", "len", "(", "parts", ")", "==", "0", "{", "err", "=", "makeErrInvalid", "(", "\"", "\"", ")", "\n", "return", "\n", "}", "\n\n", "switch", "name", ",", "args", ":=", "parts", "[", "0", "]", ",", "parts", "[", "1", ":", "]", ";", "name", "{", "case", "\"", "\"", ":", "return", "readPing", "(", "args", "...", ")", "\n\n", "case", "\"", "\"", ":", "return", "readIdentify", "(", "r", ",", "args", "...", ")", "\n\n", "case", "\"", "\"", ":", "return", "readRegister", "(", "args", "...", ")", "\n\n", "case", "\"", "\"", ":", "return", "readUnregister", "(", "args", "...", ")", "\n\n", "default", ":", "err", "=", "makeErrInvalid", "(", "\"", "\"", ",", "name", ")", "\n", "return", "\n", "}", "\n", "}" ]
18,681
all-18682
[ "QueryableClient", "returns", "a", "storage", ".", "Queryable", "which", "queries", "the", "given", "Client", "to", "select", "series", "sets", "." ]
[ "func", "QueryableClient", "(", "c", "*", "Client", ")", "storage", ".", "Queryable", "{", "remoteReadQueries", ".", "WithLabelValues", "(", "c", ".", "Name", "(", ")", ")", "\n", "return", "storage", ".", "QueryableFunc", "(", "func", "(", "ctx", "context", ".", "Context", ",", "mint", ",", "maxt", "int64", ")", "(", "<mask>", ".", "Querier", ",", "error", ")", "{", "return", "&", "querier", "{", "ctx", ":", "ctx", ",", "mint", ":", "mint", ",", "maxt", ":", "maxt", ",", "client", ":", "c", ",", "}", ",", "nil", "\n", "}", ")", "\n", "}" ]
18,682
all-18683
[ "PaperSizeGetPaperSizes", "()", "is", "a", "wrapper", "around", "gtk_paper_size_get_paper_sizes", "()", "." ]
[ "func", "PaperSizeGetPaperSizes", "(", "includeCustom", "bool", ")", "*", "glib", ".", "List", "{", "clist", ":=", "C", ".", "gtk_paper_size_get_paper_sizes", "(", "gbool", "(", "includeCustom", ")", ")", "\n", "if", "clist", "==", "nil", "{", "return", "nil", "\n", "}", "\n\n", "glist", ":=", "glib", ".", "WrapList", "(", "uintptr", "(", "unsafe", ".", "Pointer", "(", "clist", ")", ")", ")", "\n", "glist", ".", "DataWrapper", "(", "func", "(", "ptr", "unsafe", ".", "Pointer", ")", "interface", "{", "}", "{", "return", "&", "PaperSize", "{", "(", "*", "C", ".", "GtkPaperSize", ")", "(", "ptr", ")", "}", "\n", "}", ")", "\n\n", "runtime", ".", "SetFinalizer", "(", "glist", ",", "func", "(", "glist", "*", "glib", ".", "<mask>", ")", "{", "glist", ".", "FreeFull", "(", "func", "(", "item", "interface", "{", "}", ")", "{", "ps", ":=", "item", ".", "(", "*", "PaperSize", ")", "\n", "C", ".", "gtk_paper_size_free", "(", "ps", ".", "GtkPaperSize", ")", "\n", "}", ")", "\n", "}", ")", "\n\n", "return", "glist", "\n", "}" ]
18,683
all-18684
[ "Select", "may", "be", "called", "on", "a", "selection", "of", "any", "number", "of", "<select", ">", "elements", "to", "select", "any", "<option", ">", "elements", "under", "those", "<select", ">", "elements", "that", "match", "the", "provided", "text", "." ]
[ "func", "(", "s", "*", "Selection", ")", "Select", "(", "<mask>", "string", ")", "error", "{", "return", "s", ".", "forEachElement", "(", "func", "(", "selectedElement", "element", ".", "Element", ")", "error", "{", "optionXPath", ":=", "fmt", ".", "Sprintf", "(", "`./option[normalize-space()=\"%s\"]`", ",", "text", ")", "\n", "optionToSelect", ":=", "target", ".", "Selector", "{", "Type", ":", "target", ".", "XPath", ",", "Value", ":", "optionXPath", "}", "\n", "options", ",", "err", ":=", "selectedElement", ".", "GetElements", "(", "optionToSelect", ".", "API", "(", ")", ")", "\n", "if", "err", "!=", "nil", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "s", ",", "err", ")", "\n", "}", "\n\n", "if", "len", "(", "options", ")", "==", "0", "{", "return", "fmt", ".", "Errorf", "(", "`no options with text \"%s\" found for %s`", ",", "text", ",", "s", ")", "\n", "}", "\n\n", "for", "_", ",", "option", ":=", "range", "options", "{", "if", "err", ":=", "option", ".", "Click", "(", ")", ";", "err", "!=", "nil", "{", "return", "fmt", ".", "Errorf", "(", "`failed to click on option with text \"%s\" for %s: %s`", ",", "text", ",", "s", ",", "err", ")", "\n", "}", "\n", "}", "\n", "return", "nil", "\n", "}", ")", "\n", "}" ]
18,684
all-18685
[ "GetTitleOk", "returns", "a", "tuple", "with", "the", "Title", "field", "if", "it", "s", "non", "-", "nil", "zero", "value", "otherwise", "and", "a", "boolean", "to", "check", "if", "the", "value", "has", "been", "set", "." ]
[ "func", "(", "s", "*", "Screenboard", ")", "GetTitleOk", "(", ")", "(", "string", ",", "bool", ")", "{", "if", "s", "==", "nil", "||", "s", ".", "Title", "==", "nil", "{", "return", "\"", "\"", ",", "<mask>", "\n", "}", "\n", "return", "*", "s", ".", "Title", ",", "true", "\n", "}" ]
18,685
all-18686
[ "HasTitleSize", "returns", "a", "boolean", "if", "a", "field", "has", "been", "set", "." ]
[ "func", "(", "s", "*", "ScatterplotDefinition", ")", "HasTitleSize", "(", ")", "bool", "{", "if", "s", "!=", "nil", "&&", "s", ".", "TitleSize", "!=", "nil", "{", "return", "true", "\n", "}", "\n\n", "return", "<mask>", "\n", "}" ]
18,686
all-18687
[ "UnmarshalJSON", "supports", "json", ".", "Unmarshaler", "interface" ]
[ "func", "(", "v", "*", "SignedExchangeHeader", ")", "UnmarshalJSON", "(", "data", "[", "]", "byte", ")", "error", "{", "r", ":=", "jlexer", ".", "Lexer", "{", "Data", ":", "data", "}", "\n", "easyjsonC5a4559bDecodeGithubComChromedpCdprotoNetwork7", "(", "&", "r", ",", "v", ")", "\n", "return", "r", ".", "<mask>", "(", ")", "\n", "}" ]
18,687
all-18688
[ "Unique", "is", "a", "helper", "to", "get", "a", "unique", "list", "of", "object", "ids", "." ]
[ "func", "Unique", "(", "<mask>", "[", "]", "bson", ".", "ObjectId", ")", "[", "]", "bson", ".", "ObjectId", "{", "// prepare map", "m", ":=", "make", "(", "map", "[", "bson", ".", "ObjectId", "]", "bool", ")", "\n", "l", ":=", "make", "(", "[", "]", "bson", ".", "ObjectId", ",", "0", ",", "len", "(", "ids", ")", ")", "\n\n", "for", "_", ",", "id", ":=", "range", "ids", "{", "if", "_", ",", "ok", ":=", "m", "[", "id", "]", ";", "!", "ok", "{", "m", "[", "id", "]", "=", "true", "\n", "l", "=", "append", "(", "l", ",", "id", ")", "\n", "}", "\n", "}", "\n\n", "return", "l", "\n", "}" ]
18,688
all-18689
[ "NewResourcesFromConfig", "parse", "the", "a", "ResourceEntry", "into", "a", "list", "of", "resources" ]
[ "func", "NewResourcesFromConfig", "(", "e", "ResourceEntry", ")", "[", "]", "Resource", "{", "<mask>", "resources", "[", "]", "Resource", "\n", "for", "_", ",", "name", ":=", "range", "e", ".", "Names", "{", "resources", "=", "append", "(", "resources", ",", "NewResource", "(", "name", ",", "e", ".", "Type", ",", "e", ".", "State", ",", "\"", "\"", ",", "time", ".", "Time", "{", "}", ")", ")", "\n", "}", "\n", "return", "resources", "\n", "}" ]
18,689
all-18690
[ "SetRightMargin", "is", "a", "wrapper", "around", "gtk_text_view_set_right_margin", "()", "." ]
[ "func", "(", "v", "*", "TextView", ")", "SetRightMargin", "(", "margin", "int", ")", "{", "C", ".", "gtk_text_view_set_right_margin", "(", "v", ".", "native", "(", ")", ",", "C", ".", "gint", "(", "<mask>", ")", ")", "\n", "}" ]
18,690
all-18691
[ "newAttachENIHandler", "returns", "an", "instance", "of", "the", "attachENIHandler", "struct" ]
[ "func", "newAttachENIHandler", "(", "ctx", "context", ".", "Context", ",", "cluster", "string", ",", "containerInstanceArn", "string", ",", "acsClient", "wsclient", ".", "ClientServer", ",", "taskEngineState", "dockerstate", ".", "TaskEngineState", ",", "saver", "statemanager", ".", "Saver", ")", "attachENIHandler", "{", "// Create a cancelable context from the parent context", "derivedContext", ",", "cancel", ":=", "<mask>", ".", "WithCancel", "(", "ctx", ")", "\n", "return", "attachENIHandler", "{", "messageBuffer", ":", "make", "(", "chan", "*", "ecsacs", ".", "AttachTaskNetworkInterfacesMessage", ")", ",", "ctx", ":", "derivedContext", ",", "cancel", ":", "cancel", ",", "cluster", ":", "aws", ".", "String", "(", "cluster", ")", ",", "containerInstance", ":", "aws", ".", "String", "(", "containerInstanceArn", ")", ",", "acsClient", ":", "acsClient", ",", "state", ":", "taskEngineState", ",", "saver", ":", "saver", ",", "}", "\n", "}" ]
18,691
all-18692
[ "Acquire", "marks", "enter", "of", "an", "accessor", "in", "the", "skiplist" ]
[ "func", "(", "ab", "*", "AccessBarrier", ")", "Acquire", "(", ")", "*", "BarrierSession", "{", "if", "ab", ".", "<mask>", "{", "retry", ":", "bs", ":=", "(", "*", "BarrierSession", ")", "(", "atomic", ".", "LoadPointer", "(", "&", "ab", ".", "session", ")", ")", "\n", "liveCount", ":=", "atomic", ".", "AddInt32", "(", "bs", ".", "liveCount", ",", "1", ")", "\n", "if", "liveCount", ">", "barrierFlushOffset", "{", "ab", ".", "Release", "(", "bs", ")", "\n", "goto", "retry", "\n", "}", "\n\n", "return", "bs", "\n", "}", "\n\n", "return", "nil", "\n", "}" ]
18,692
all-18693
[ "HasType", "returns", "a", "boolean", "if", "a", "field", "has", "been", "set", "." ]
[ "func", "(", "i", "*", "ImageDefinition", ")", "HasType", "(", ")", "bool", "{", "if", "i", "!=", "nil", "&&", "i", ".", "Type", "!=", "nil", "{", "return", "true", "\n", "}", "\n\n", "return", "<mask>", "\n", "}" ]
18,693
all-18694
[ "getHostPublicIPv4AddressFromEC2Metadata", "will", "retrieve", "the", "PublicIPAddress", "(", "IPv4", ")", "of", "this", "instance", "through", "the", "EC2", "API" ]
[ "func", "(", "agent", "*", "ecsAgent", ")", "getHostPublicIPv4AddressFromEC2Metadata", "(", ")", "string", "{", "// Get instance ID from ec2 metadata client.", "hostPublicIPv4Address", ",", "err", ":=", "<mask>", ".", "ec2MetadataClient", ".", "PublicIPv4Address", "(", ")", "\n", "if", "err", "!=", "nil", "{", "seelog", ".", "Errorf", "(", "\"", "\"", ",", "err", ")", "\n", "return", "\"", "\"", "\n", "}", "\n", "return", "hostPublicIPv4Address", "\n", "}" ]
18,694
all-18695
[ "Helper", "that", "runs", "command", "line", "with", "give", "command", "client" ]
[ "func", "runCommand", "(", "client", "cmd", ".", "CommandClient", ",", "cmdLine", "*", "cmd", ".", "CommandLine", ")", "(", "resp", "*", "<mask>", ".", "Response", ",", "err", "error", ")", "{", "cmds", ":=", "strings", ".", "Split", "(", "cmdLine", ".", "Command", ",", "\"", "\"", ")", "\n", "if", "cmdLine", ".", "ShowHelp", "{", "err", "=", "client", ".", "ShowCommandHelp", "(", "cmdLine", ".", "Command", ")", "\n", "}", "else", "if", "len", "(", "cmds", ")", ">", "1", "&&", "cmds", "[", "1", "]", "==", "\"", "\"", "{", "err", "=", "client", ".", "ShowAPIActions", "(", "cmdLine", ".", "Command", ")", "\n", "}", "else", "{", "resp", ",", "err", "=", "client", ".", "RunCommand", "(", "cmdLine", ".", "Command", ")", "\n", "}", "\n", "return", "\n", "}" ]
18,695
all-18696
[ "GetIncreaseGood", "returns", "the", "IncreaseGood", "field", "if", "non", "-", "nil", "zero", "value", "otherwise", "." ]
[ "func", "(", "t", "*", "TileDefRequest", ")", "GetIncreaseGood", "(", ")", "bool", "{", "if", "t", "==", "nil", "||", "t", ".", "IncreaseGood", "==", "nil", "{", "return", "<mask>", "\n", "}", "\n", "return", "*", "t", ".", "IncreaseGood", "\n", "}" ]
18,696
all-18697
[ "UnmarshalJSON", "supports", "json", ".", "Unmarshaler", "interface" ]
[ "func", "(", "v", "*", "ResolveBlobParams", ")", "UnmarshalJSON", "(", "<mask>", "[", "]", "byte", ")", "error", "{", "r", ":=", "jlexer", ".", "Lexer", "{", "Data", ":", "data", "}", "\n", "easyjsonC5a4559bDecodeGithubComChromedpCdprotoIo1", "(", "&", "r", ",", "v", ")", "\n", "return", "r", ".", "Error", "(", ")", "\n", "}" ]
18,697
all-18698
[ "GetAPIToken", "returns", "the", "APIToken", "field", "if", "non", "-", "nil", "zero", "value", "otherwise", "." ]
[ "func", "(", "i", "*", "integrationPD", ")", "GetAPIToken", "(", ")", "string", "{", "if", "i", "==", "nil", "||", "i", ".", "APIToken", "==", "nil", "{", "<mask>", "\"", "\"", "\n", "}", "\n", "return", "*", "i", ".", "APIToken", "\n", "}" ]
18,698
all-18699
[ "PathFromNewRoot", "takes", "the", "datacenter", "path", "for", "a", "specific", "entity", "and", "then", "appends", "the", "new", "particle", "supplied", "with", "the", "new", "relative", "path", ".", "As", "an", "example", "consider", "a", "supplied", "host", "path", "/", "dc1", "/", "host", "/", "cluster1", "/", "esxi1", "and", "a", "supplied", "datastore", "folder", "relative", "path", "of", "/", "foo", "/", "bar", ".", "This", "function", "will", "split", "off", "the", "datacenter", "section", "of", "the", "path", "(", "/", "dc1", ")", "and", "combine", "it", "with", "the", "datastore", "folder", "with", "the", "proper", "delimiter", ".", "The", "resulting", "path", "will", "be", "/", "dc1", "/", "datastore", "/", "foo", "/", "bar", "." ]
[ "func", "(", "p", "RootPathParticle", ")", "PathFromNewRoot", "(", "inventoryPath", "string", ",", "newParticle", "RootPathParticle", ",", "relative", "string", ")", "(", "string", ",", "error", ")", "{", "rootPath", ",", "err", ":=", "p", ".", "NewRootFromPath", "(", "inventoryPath", ",", "newParticle", ")", "\n", "if", "err", "!=", "nil", "{", "return", "inventoryPath", ",", "err", "\n", "}", "\n", "return", "path", ".", "Clean", "(", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "rootPath", ",", "<mask>", ")", ")", ",", "nil", "\n", "}" ]
18,699
all-18700
[ "TokenFromMetadata", "gets", "the", "token", "from", "the", "metadata", "or", "returns", "ErrNoToken" ]
[ "func", "TokenFromMetadata", "(", "md", "metadata", ".", "MD", ")", "(", "string", ",", "error", ")", "{", "token", ",", "ok", ":=", "<mask>", "[", "\"", "\"", "]", "\n", "if", "!", "ok", "||", "len", "(", "token", ")", "==", "0", "{", "return", "\"", "\"", ",", "ErrNoToken", "\n", "}", "\n", "return", "token", "[", "0", "]", ",", "nil", "\n", "}" ]