id
int32
0
25.3k
idx
stringlengths
5
9
nl_tokens
sequence
pl_tokens
sequence
200
all-201
[ "ReadArgsV2", "reads", "arg2", "and", "arg3", "from", "a", "reader", "." ]
[ "func", "ReadArgsV2", "(", "r", "tchannel", ".", "ArgReadable", ")", "(", "[", "]", "byte", ",", "[", "]", "byte", ",", "error", ")", "{", "<mask>", "arg2", ",", "arg3", "[", "]", "byte", "\n\n", "if", "err", ":=", "tchannel", ".", "NewArgReader", "(", "r", ".", "Arg2Reader", "(", ")", ")", ".", "Read", "(", "&", "arg2", ")", ";", "err", "!=", "nil", "{", "return", "nil", ",", "nil", ",", "err", "\n", "}", "\n\n", "if", "err", ":=", "tchannel", ".", "NewArgReader", "(", "r", ".", "Arg3Reader", "(", ")", ")", ".", "Read", "(", "&", "arg3", ")", ";", "err", "!=", "nil", "{", "return", "nil", ",", "nil", ",", "err", "\n", "}", "\n\n", "return", "arg2", ",", "arg3", ",", "nil", "\n", "}" ]
201
all-202
[ "WithNodeID", "ID", "of", "the", "node", "to", "resolve", "." ]
[ "func", "(", "p", "ResolveNodeParams", ")", "WithNodeID", "(", "nodeID", "cdp", ".", "NodeID", ")", "*", "ResolveNodeParams", "{", "p", ".", "NodeID", "=", "nodeID", "\n", "<mask>", "&", "p", "\n", "}" ]
202
all-203
[ "New", "creates", "a", "store", "where", "the", "given", "namespaces", "will", "be", "created", "as", "initial", "directories", "." ]
[ "func", "New", "(", "namespaces", "...", "string", ")", "<mask>", "{", "s", ":=", "newStore", "(", "namespaces", "...", ")", "\n", "s", ".", "clock", "=", "clockwork", ".", "NewRealClock", "(", ")", "\n", "return", "s", "\n", "}" ]
203
all-204
[ "Verify", "creates", "a", "signature", "for", "buf", "comparing", "it", "against", "the", "URL", "-", "safe", "base64", "encoded", "sig", "and", "returning", "the", "decoded", "signature", ".", "If", "the", "sig", "is", "invalid", "then", "ErrInvalidSignature", "will", "be", "returned", "." ]
[ "func", "(", "es", "*", "EccSigner", ")", "Verify", "(", "buf", ",", "sig", "[", "]", "byte", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "<mask>", "err", "error", "\n\n", "// decode", "dec", ",", "err", ":=", "b64", ".", "DecodeString", "(", "string", "(", "sig", ")", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "// verify", "err", "=", "es", ".", "VerifyBytes", "(", "buf", ",", "dec", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "return", "dec", ",", "nil", "\n", "}" ]
204
all-205
[ "AddHandler", "registers", "a", "new", "RPC", "handler", "in", "a", "given", "namespace", "." ]
[ "func", "(", "s", "*", "Server", ")", "AddHandler", "(", "namespace", "string", ",", "<mask>", "interface", "{", "}", ")", "error", "{", "return", "s", ".", "rpcsrv", ".", "RegisterName", "(", "namespace", ",", "handler", ")", "\n", "}" ]
205
all-206
[ "Start", "starts", "a", "client", "s", "connection", "and", "registers", ".", "The", "client", "responds", "to", "PING", "commands", ".", "All", "messages", "received", "from", "the", "server", "will", "be", "sent", "on", "the", "receive", "channel", ".", "Messages", "you", "send", "to", "the", "send", "channel", "will", "be", "sent", "to", "the", "server", ".", "If", "an", "error", "occurs", "we", "send", "a", "message", "on", "the", "error", "channel", ".", "If", "you", "receive", "a", "message", "on", "that", "channel", "you", "must", "stop", "the", "client", ".", "The", "caller", "must", "call", "Stop", "()", "to", "clean", "up", "the", "client", "." ]
[ "func", "(", "c", "*", "Client", ")", "Start", "(", ")", "(", "<-", "chan", "irc", ".", "Message", ",", "chan", "<-", "irc", ".", "Message", ",", "<-", "chan", "error", ",", "error", ",", ")", "{", "if", "err", ":=", "c", ".", "connect", "(", ")", ";", "err", "!=", "nil", "{", "return", "nil", ",", "nil", ",", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "err", ")", "\n", "}", "\n\n", "if", "err", ":=", "c", ".", "writeMessage", "(", "irc", ".", "Message", "{", "Command", ":", "\"", "\"", ",", "Params", ":", "[", "]", "string", "{", "c", ".", "nick", "}", ",", "}", ")", ";", "err", "!=", "nil", "{", "_", "=", "c", ".", "conn", ".", "Close", "(", ")", "\n", "return", "nil", ",", "nil", ",", "nil", ",", "err", "\n", "}", "\n\n", "if", "err", ":=", "c", ".", "writeMessage", "(", "irc", ".", "Message", "{", "Command", ":", "\"", "\"", ",", "Params", ":", "[", "]", "string", "{", "c", ".", "nick", ",", "\"", "\"", ",", "\"", "\"", ",", "c", ".", "nick", "}", ",", "}", ")", ";", "err", "!=", "nil", "{", "_", "=", "c", ".", "conn", ".", "Close", "(", ")", "\n", "return", "nil", ",", "nil", ",", "nil", ",", "err", "\n", "}", "\n\n", "c", ".", "recvChan", "=", "make", "(", "chan", "irc", ".", "Message", ",", "512", ")", "\n", "c", ".", "sendChan", "=", "make", "(", "chan", "irc", ".", "Message", ",", "512", ")", "\n", "c", ".", "errChan", "=", "make", "(", "chan", "error", ",", "512", ")", "\n", "c", ".", "doneChan", "=", "<mask>", "(", "chan", "struct", "{", "}", ")", "\n\n", "c", ".", "wg", "=", "&", "sync", ".", "WaitGroup", "{", "}", "\n\n", "c", ".", "wg", ".", "Add", "(", "1", ")", "\n", "go", "c", ".", "reader", "(", "c", ".", "recvChan", ")", "\n\n", "c", ".", "wg", ".", "Add", "(", "1", ")", "\n", "go", "c", ".", "writer", "(", "c", ".", "sendChan", ")", "\n\n", "return", "c", ".", "recvChan", ",", "c", ".", "sendChan", ",", "c", ".", "errChan", ",", "nil", "\n", "}" ]
206
all-207
[ "excerpt", "replaces", "middle", "part", "with", "ellipsis", "and", "returns", "a", "double", "-", "quoted", "string", "safely", "escaped", "with", "Go", "syntax", "." ]
[ "func", "excerpt", "(", "str", "<mask>", ",", "pre", ",", "suf", "int", ")", "string", "{", "if", "pre", "+", "suf", ">", "len", "(", "str", ")", "{", "return", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "str", ")", "\n", "}", "\n", "return", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "str", "[", ":", "pre", "]", ",", "str", "[", "len", "(", "str", ")", "-", "suf", ":", "]", ")", "\n", "}" ]
207
all-208
[ "find", "unix", "home", "directory" ]
[ "func", "homeDir", "(", ")", "(", "string", ",", "error", ")", "{", "if", "h", ":=", "os", ".", "Getenv", "(", "\"", "\"", ")", ";", "h", "!=", "\"", "\"", "{", "return", "h", ",", "nil", "\n", "}", "\n", "h", ",", "err", ":=", "<mask>", ".", "Command", "(", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ")", ".", "Output", "(", ")", "\n", "if", "err", "==", "nil", "&&", "len", "(", "h", ")", ">", "0", "{", "return", "strings", ".", "TrimSpace", "(", "string", "(", "h", ")", ")", ",", "nil", "\n", "}", "\n", "return", "\"", "\"", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ")", "\n", "}" ]
208
all-209
[ "convertDockerImageReference", "takes", "an", "image", "API", "DockerImageReference", "value", "and", "returns", "a", "reference", "we", "can", "actually", "use", ";", "currently", "OpenShift", "stores", "the", "cluster", "-", "internal", "service", "IPs", "here", "which", "are", "unusable", "from", "the", "outside", "." ]
[ "func", "(", "c", "*", "openshiftClient", ")", "convertDockerImageReference", "(", "ref", "string", ")", "(", "string", ",", "error", ")", "{", "<mask>", ":=", "strings", ".", "SplitN", "(", "ref", ",", "\"", "\"", ",", "2", ")", "\n", "if", "len", "(", "parts", ")", "!=", "2", "{", "return", "\"", "\"", ",", "errors", ".", "Errorf", "(", "\"", "\"", ",", "ref", ")", "\n", "}", "\n", "return", "reference", ".", "Domain", "(", "c", ".", "ref", ".", "dockerReference", ")", "+", "\"", "\"", "+", "parts", "[", "1", "]", ",", "nil", "\n", "}" ]
209
all-210
[ "kubeEnv", "transforms", "a", "mapping", "of", "environment", "variables", "into", "their", "serialized", "form", "for", "a", "PodSpec", "sorting", "by", "the", "name", "of", "the", "env", "vars" ]
[ "func", "kubeEnv", "(", "environment", "map", "[", "string", "]", "string", ")", "[", "]", "coreapi", ".", "EnvVar", "{", "var", "keys", "[", "]", "string", "\n", "for", "key", ":=", "range", "environment", "{", "keys", "=", "append", "(", "keys", ",", "key", ")", "\n", "}", "\n", "sort", ".", "Strings", "(", "keys", ")", "\n\n", "var", "kubeEnvironment", "[", "]", "coreapi", ".", "EnvVar", "\n", "for", "_", ",", "key", ":=", "range", "keys", "{", "kubeEnvironment", "=", "append", "(", "kubeEnvironment", ",", "coreapi", ".", "EnvVar", "{", "Name", ":", "key", ",", "Value", ":", "environment", "[", "<mask>", "]", ",", "}", ")", "\n", "}", "\n\n", "return", "kubeEnvironment", "\n", "}" ]
210
all-211
[ "selectTransferEncoding", "scans", "content", "for", "non", "-", "ASCII", "characters", "and", "selects", "b", "or", "q", "encoding", "." ]
[ "func", "selectTransferEncoding", "(", "<mask>", "[", "]", "byte", ",", "quoteLineBreaks", "bool", ")", "transferEncoding", "{", "if", "len", "(", "content", ")", "==", "0", "{", "return", "te7Bit", "\n", "}", "\n", "// Binary chars remaining before we choose b64 encoding.", "threshold", ":=", "b64Percent", "*", "len", "(", "content", ")", "/", "100", "\n", "bincount", ":=", "0", "\n", "for", "_", ",", "b", ":=", "range", "content", "{", "if", "(", "b", "<", "' '", "||", "'~'", "<", "b", ")", "&&", "b", "!=", "'\\t'", "{", "if", "!", "quoteLineBreaks", "&&", "(", "b", "==", "'\\r'", "||", "b", "==", "'\\n'", ")", "{", "continue", "\n", "}", "\n", "bincount", "++", "\n", "if", "bincount", ">=", "threshold", "{", "return", "teBase64", "\n", "}", "\n", "}", "\n", "}", "\n", "if", "bincount", "==", "0", "{", "return", "te7Bit", "\n", "}", "\n", "return", "teQuoted", "\n", "}" ]
211
all-212
[ "HasAuthProviderX509CertURL", "returns", "a", "boolean", "if", "a", "field", "has", "been", "set", "." ]
[ "func", "(", "i", "*", "IntegrationGCPCreateRequest", ")", "HasAuthProviderX509CertURL", "(", ")", "bool", "{", "if", "i", "!=", "nil", "&&", "i", ".", "AuthProviderX509CertURL", "!=", "nil", "{", "return", "true", "\n", "}", "\n\n", "return", "<mask>", "\n", "}" ]
212
all-213
[ "InitPlugin", "creates", "an", "instance", "of", "the", "named", "plugin", "." ]
[ "func", "InitDbProvider", "(", "name", "string", ",", "configFilePath", "string", ")", "(", "DbInterface", ",", "error", ")", "{", "var", "dbprovider", "DbInterface", "\n\n", "if", "name", "==", "\"", "\"", "{", "logger", ".", "Get", "(", ")", ".", "Info", "(", "\"", "\"", ")", "\n", "return", "nil", ",", "nil", "\n", "}", "\n\n", "var", "err", "error", "\n\n", "if", "configFilePath", "!=", "\"", "\"", "{", "config", ",", "err", ":=", "os", ".", "Open", "(", "configFilePath", ")", "\n", "if", "err", "!=", "nil", "{", "logger", ".", "Get", "(", ")", ".", "Critical", "(", "\"", "\"", ",", "configFilePath", ",", "err", ")", "\n", "}", "\n\n", "defer", "config", ".", "Close", "(", ")", "\n", "dbprovider", ",", "err", "=", "GetDbProvider", "(", "<mask>", ",", "config", ")", "\n", "}", "else", "{", "// Pass explicit nil so providers can actually check for nil. See", "// \"Why is my nil error value not equal to nil?\" in golang.org/doc/faq.", "dbprovider", ",", "err", "=", "GetDbProvider", "(", "name", ",", "nil", ")", "\n", "}", "\n\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "name", ",", "err", ")", "\n", "}", "\n", "if", "dbprovider", "==", "nil", "{", "return", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "name", ")", "\n", "}", "\n\n", "return", "dbprovider", ",", "nil", "\n", "}" ]
213
all-214
[ "/", "*", "Signal", "sends", "the", "running", "command", "the", "passed", "in", "signal", ".", "It", "does", "not", "wait", "for", "the", "process", "to", "exit", "." ]
[ "func", "(", "s", "*", "Session", ")", "Signal", "(", "signal", "os", ".", "Signal", ")", "*", "Session", "{", "if", "s", ".", "processIsAlive", "(", ")", "{", "s", ".", "Command", ".", "<mask>", ".", "Signal", "(", "signal", ")", "\n", "}", "\n", "return", "s", "\n", "}" ]
214
all-215
[ "Restart", "restarts", "a", "machine", "which", "is", "known", "to", "be", "running", "." ]
[ "func", "(", "d", "*", "Driver", ")", "Restart", "(", ")", "error", "{", "if", "err", ":=", "d", ".", "Stop", "(", ")", ";", "<mask>", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "return", "d", ".", "Start", "(", ")", "\n", "}" ]
215
all-216
[ "GetMulti", "is", "a", "batch", "version", "of", "Get", ".", "The", "returned", "map", "from", "keys", "to", "items", "may", "have", "fewer", "elements", "than", "the", "input", "slice", "due", "to", "memcache", "cache", "misses", ".", "Each", "key", "must", "be", "at", "most", "250", "bytes", "in", "length", "." ]
[ "func", "GetMulti", "(", "c", "context", ".", "Context", ",", "key", "[", "]", "string", ")", "(", "map", "[", "string", "]", "*", "Item", ",", "error", ")", "{", "if", "len", "(", "<mask>", ")", "==", "0", "{", "return", "nil", ",", "nil", "\n", "}", "\n", "keyAsBytes", ":=", "make", "(", "[", "]", "[", "]", "byte", ",", "len", "(", "key", ")", ")", "\n", "for", "i", ",", "k", ":=", "range", "key", "{", "keyAsBytes", "[", "i", "]", "=", "[", "]", "byte", "(", "k", ")", "\n", "}", "\n", "req", ":=", "&", "pb", ".", "MemcacheGetRequest", "{", "Key", ":", "keyAsBytes", ",", "ForCas", ":", "proto", ".", "Bool", "(", "true", ")", ",", "}", "\n", "res", ":=", "&", "pb", ".", "MemcacheGetResponse", "{", "}", "\n", "if", "err", ":=", "internal", ".", "Call", "(", "c", ",", "\"", "\"", ",", "\"", "\"", ",", "req", ",", "res", ")", ";", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "m", ":=", "make", "(", "map", "[", "string", "]", "*", "Item", ",", "len", "(", "res", ".", "Item", ")", ")", "\n", "for", "_", ",", "p", ":=", "range", "res", ".", "Item", "{", "t", ":=", "protoToItem", "(", "p", ")", "\n", "m", "[", "t", ".", "Key", "]", "=", "t", "\n", "}", "\n", "return", "m", ",", "nil", "\n", "}" ]
216
all-217
[ "Host", "lets", "you", "specify", "the", "host", "(", "s", ")", "the", "route", "is", "available", "for" ]
[ "func", "(", "r", "*", "Router", ")", "Host", "(", "hosts", "...", "string", ")", "*", "Router", "{", "c", ":=", "r", ".", "route", ".", "<mask>", "(", ")", "\n", "c", ".", "Hosts", "=", "hosts", "\n", "return", "r", ".", "clone", "(", "c", ")", "\n", "}" ]
217
all-218
[ "Exec", "executes", "the", "XPath", "expression", "xp", "against", "the", "tree", "t", "with", "the", "namespace", "mappings", "ns", "." ]
[ "func", "Exec", "(", "n", "*", "parser", ".", "Node", ",", "t", "tree", ".", "Node", ",", "ns", "map", "[", "string", "]", "string", ",", "fns", "map", "[", "xml", ".", "Name", "]", "<mask>", ".", "Wrap", ",", "v", "map", "[", "string", "]", "tree", ".", "Result", ")", "(", "tree", ".", "Result", ",", "error", ")", "{", "f", ":=", "xpFilt", "{", "t", ":", "t", ",", "ns", ":", "ns", ",", "ctx", ":", "tree", ".", "NodeSet", "{", "t", "}", ",", "fns", ":", "fns", ",", "variables", ":", "v", ",", "}", "\n\n", "return", "exec", "(", "&", "f", ",", "n", ")", "\n", "}" ]
218
all-219
[ "HasOverallStateModified", "returns", "a", "boolean", "if", "a", "field", "has", "been", "set", "." ]
[ "func", "(", "m", "*", "Monitor", ")", "HasOverallStateModified", "(", ")", "bool", "{", "if", "m", "!=", "nil", "&&", "m", ".", "OverallStateModified", "!=", "nil", "{", "return", "true", "\n", "}", "\n\n", "return", "<mask>", "\n", "}" ]
219
all-220
[ "attach", "a", "range", "of", "a", "buffer", "object", "s", "data", "store", "to", "a", "buffer", "texture", "object" ]
[ "func", "TexBufferRange", "(", "target", "uint32", ",", "internalformat", "uint32", ",", "buffer", "uint32", ",", "offset", "int", ",", "size", "int", ")", "{", "C", ".", "glowTexBufferRange", "(", "gpTexBufferRange", ",", "(", "C", ".", "GLenum", ")", "(", "target", ")", ",", "(", "C", ".", "GLenum", ")", "(", "internalformat", ")", ",", "(", "C", ".", "GLuint", ")", "(", "buffer", ")", ",", "(", "C", ".", "GLintptr", ")", "(", "offset", ")", ",", "(", "C", ".", "GLsizeiptr", ")", "(", "<mask>", ")", ")", "\n", "}" ]
220
all-221
[ "dropMetricName", "is", "a", "cached", "version", "of", "dropMetricName", "." ]
[ "func", "(", "enh", "*", "EvalNodeHelper", ")", "dropMetricName", "(", "l", "labels", ".", "Labels", ")", "labels", ".", "Labels", "{", "if", "enh", ".", "dmn", "==", "nil", "{", "enh", ".", "dmn", "=", "make", "(", "map", "[", "uint64", "]", "labels", ".", "Labels", ",", "len", "(", "enh", ".", "out", ")", ")", "\n", "}", "\n", "h", ":=", "l", ".", "Hash", "(", ")", "\n", "ret", ",", "<mask>", ":=", "enh", ".", "dmn", "[", "h", "]", "\n", "if", "ok", "{", "return", "ret", "\n", "}", "\n", "ret", "=", "dropMetricName", "(", "l", ")", "\n", "enh", ".", "dmn", "[", "h", "]", "=", "ret", "\n", "return", "ret", "\n", "}" ]
221
all-222
[ "WithURLRegex", "regex", "pattern", "for", "the", "URLs", "of", "the", "resources", "to", "set", "breakpoints", "on", ".", "Either", "url", "or", "urlRegex", "must", "be", "specified", "." ]
[ "func", "(", "p", "SetBreakpointByURLParams", ")", "WithURLRegex", "(", "urlRegex", "<mask>", ")", "*", "SetBreakpointByURLParams", "{", "p", ".", "URLRegex", "=", "urlRegex", "\n", "return", "&", "p", "\n", "}" ]
222
all-223
[ "Offset", "adds", "OFFSET", "clause", "to", "the", "Condition", "and", "returns", "it", "for", "method", "chain", "." ]
[ "func", "(", "c", "*", "Condition", ")", "Offset", "(", "<mask>", "int", ")", "*", "Condition", "{", "return", "c", ".", "appendQuery", "(", "700", ",", "Offset", ",", "offset", ")", "\n", "}" ]
223
all-224
[ "IsVmdkDatastorePath", "ensures", "that", "a", "string", "can", "be", "parsed", "as", "a", "datastore", "path", "pointing", "to", "a", "virtual", "disk", ".", "This", "only", "checks", "the", "validity", "of", "the", "path", "not", "whether", "or", "not", "the", "file", "exists", "." ]
[ "func", "IsVmdkDatastorePath", "(", "p", "string", ")", "bool", "{", "dp", ",", "success", ":=", "DatastorePathFromString", "(", "p", ")", "\n", "if", "!", "success", "{", "log", ".", "Printf", "(", "\"", "\"", ",", "p", ")", "\n", "return", "false", "\n", "}", "\n", "isVMDK", ":=", "<mask>", ".", "IsVMDK", "(", ")", "\n", "log", ".", "Printf", "(", "\"", "\"", ",", "p", ",", "structure", ".", "LogCond", "(", "isVMDK", ",", "\"", "\"", ",", "\"", "\"", ")", ")", "\n", "return", "isVMDK", "\n", "}" ]
224
all-225
[ "Readlink", "returns", "the", "file", "pointed", "to", "by", "the", "given", "soft", "link", "or", "an", "error", "of", "type", "PathError", "otherwise", ".", "This", "mimics", "the", "os", ".", "Readlink", "()", "function", "but", "works", "around", "a", "bug", "we", "ve", "seen", "in", "CentOS", "5", ".", "10", "(", "kernel", "2", ".", "6", ".", "27", ".", "10", "on", "x86_64", ")", "where", "the", "underlying", "OS", "function", "readlink", "()", "returns", "a", "wrong", "number", "of", "bytes", "for", "the", "result", "(", "see", "man", "readlink", ")", ".", "Here", "we", "don", "t", "rely", "blindly", "on", "that", "value", ";", "if", "there", "s", "a", "zero", "byte", "among", "that", "number", "of", "bytes", "then", "we", "keep", "only", "up", "to", "that", "point", ".", "NOTE", ":", "We", "chose", "not", "to", "use", "os", ".", "Readlink", "()", "and", "then", "search", "on", "its", "result", "to", "avoid", "an", "extra", "overhead", "of", "converting", "back", "to", "[]", "byte", ".", "The", "function", "to", "search", "for", "a", "byte", "over", "the", "string", "itself", "(", "strings", ".", "IndexByte", "()", ")", "is", "only", "available", "starting", "with", "Go", "1", ".", "2", ".", "Also", "we", "re", "not", "searching", "at", "every", "iteration", "to", "save", "some", "CPU", "time", "even", "though", "that", "could", "mean", "extra", "iterations", "for", "systems", "affected", "with", "this", "bug", ".", "But", "it", "s", "wiser", "to", "optimize", "for", "the", "general", "case", "(", "i", ".", "e", ".", "those", "not", "affected", ")", "." ]
[ "func", "Readlink", "(", "name", "string", ")", "(", "string", ",", "error", ")", "{", "for", "len", ":=", "128", ";", ";", "len", "*=", "2", "{", "b", ":=", "<mask>", "(", "[", "]", "byte", ",", "len", ")", "\n", "n", ",", "e", ":=", "syscall", ".", "Readlink", "(", "name", ",", "b", ")", "\n", "if", "e", "!=", "nil", "{", "return", "\"", "\"", ",", "&", "os", ".", "PathError", "{", "\"", "\"", ",", "name", ",", "e", "}", "\n", "}", "\n", "if", "n", "<", "len", "{", "if", "z", ":=", "bytes", ".", "IndexByte", "(", "b", "[", ":", "n", "]", ",", "0", ")", ";", "z", ">=", "0", "{", "n", "=", "z", "\n", "}", "\n", "return", "string", "(", "b", "[", ":", "n", "]", ")", ",", "nil", "\n", "}", "\n", "}", "\n", "}" ]
225
all-226
[ "Unmarshal", "unmarshals", "the", "item", "in", "an", "event", "into", "a", "protobuf", "message", "." ]
[ "func", "(", "e", "*", "Event", ")", "Unmarshal", "(", "key", "*", "string", ",", "val", "proto", ".", "Message", ")", "error", "{", "if", "err", ":=", "CheckType", "(", "e", ".", "Template", ",", "val", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "*", "key", "=", "string", "(", "e", ".", "Key", ")", "\n", "return", "proto", ".", "Unmarshal", "(", "e", ".", "<mask>", ",", "val", ")", "\n", "}" ]
226
all-227
[ "Inspect", "returns", "various", "information", "for", "(", "skopeo", "inspect", ")", "parsed", "from", "the", "manifest", "and", "configuration", "." ]
[ "func", "(", "m", "*", "Schema2", ")", "Inspect", "(", "configGetter", "func", "(", "types", ".", "BlobInfo", ")", "(", "[", "]", "byte", ",", "error", ")", ")", "(", "*", "types", ".", "ImageInspectInfo", ",", "error", ")", "{", "config", ",", "err", ":=", "configGetter", "(", "m", ".", "ConfigInfo", "(", ")", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "s2", ":=", "&", "Schema2Image", "{", "}", "\n", "if", "err", ":=", "json", ".", "Unmarshal", "(", "config", ",", "s2", ")", ";", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "i", ":=", "&", "types", ".", "ImageInspectInfo", "{", "<mask>", ":", "\"", "\"", ",", "Created", ":", "&", "s2", ".", "Created", ",", "DockerVersion", ":", "s2", ".", "DockerVersion", ",", "Architecture", ":", "s2", ".", "Architecture", ",", "Os", ":", "s2", ".", "OS", ",", "Layers", ":", "layerInfosToStrings", "(", "m", ".", "LayerInfos", "(", ")", ")", ",", "}", "\n", "if", "s2", ".", "Config", "!=", "nil", "{", "i", ".", "Labels", "=", "s2", ".", "Config", ".", "Labels", "\n", "}", "\n", "return", "i", ",", "nil", "\n", "}" ]
227
all-228
[ "publishEntries", "writes", "committed", "log", "entries", "to", "commit", "channel", "and", "returns", "whether", "all", "entries", "could", "be", "published", "." ]
[ "func", "(", "rc", "*", "raftNode", ")", "publishEntries", "(", "ents", "[", "]", "raftpb", ".", "Entry", ")", "bool", "{", "for", "i", ":=", "range", "ents", "{", "switch", "ents", "[", "i", "]", ".", "Type", "{", "case", "raftpb", ".", "EntryNormal", ":", "if", "len", "(", "ents", "[", "i", "]", ".", "Data", ")", "==", "0", "{", "// ignore empty messages", "break", "\n", "}", "\n", "s", ":=", "string", "(", "ents", "[", "i", "]", ".", "Data", ")", "\n", "select", "{", "case", "rc", ".", "commitC", "<-", "&", "s", ":", "case", "<-", "rc", ".", "stopc", ":", "return", "false", "\n", "}", "\n\n", "case", "raftpb", ".", "EntryConfChange", ":", "var", "cc", "raftpb", ".", "ConfChange", "\n", "cc", ".", "Unmarshal", "(", "ents", "[", "i", "]", ".", "Data", ")", "\n", "rc", ".", "confState", "=", "*", "rc", ".", "node", ".", "ApplyConfChange", "(", "cc", ")", "\n", "switch", "cc", ".", "Type", "{", "case", "raftpb", ".", "ConfChangeAddNode", ":", "if", "len", "(", "cc", ".", "Context", ")", ">", "0", "{", "rc", ".", "transport", ".", "AddPeer", "(", "types", ".", "ID", "(", "cc", ".", "NodeID", ")", ",", "[", "]", "string", "{", "string", "(", "cc", ".", "Context", ")", "}", ")", "\n", "}", "\n", "case", "raftpb", ".", "ConfChangeRemoveNode", ":", "if", "cc", ".", "NodeID", "==", "uint64", "(", "rc", ".", "id", ")", "{", "<mask>", ".", "Println", "(", "\"", "\"", ")", "\n", "return", "false", "\n", "}", "\n", "rc", ".", "transport", ".", "RemovePeer", "(", "types", ".", "ID", "(", "cc", ".", "NodeID", ")", ")", "\n", "}", "\n", "}", "\n\n", "// after commit, update appliedIndex", "rc", ".", "appliedIndex", "=", "ents", "[", "i", "]", ".", "Index", "\n\n", "// special nil commit to signal replay has finished", "if", "ents", "[", "i", "]", ".", "Index", "==", "rc", ".", "lastIndex", "{", "select", "{", "case", "rc", ".", "commitC", "<-", "nil", ":", "case", "<-", "rc", ".", "stopc", ":", "return", "false", "\n", "}", "\n", "}", "\n", "}", "\n", "return", "true", "\n", "}" ]
228
all-229
[ "Create", "a", "new", "workManager", "with", "input", "and", "output", "channels", "with", "a", "given", "list", "of", "options" ]
[ "func", "NewWorkManager", "(", ")", "*", "workManager", "{", "<mask>", "fileopts", "[", "]", "fileseq", ".", "FileOption", "\n", "if", "Options", ".", "AllFiles", "{", "fileopts", "=", "append", "(", "fileopts", ",", "fileseq", ".", "HiddenFiles", ")", "\n", "}", "\n", "if", "!", "Options", ".", "SeqsOnly", "{", "fileopts", "=", "append", "(", "fileopts", ",", "fileseq", ".", "SingleFiles", ")", "\n", "}", "\n\n", "s", ":=", "&", "workManager", "{", "inDirs", ":", "make", "(", "chan", "string", ")", ",", "inSeqs", ":", "make", "(", "chan", "*", "fileseq", ".", "FileSequence", ")", ",", "outSeqs", ":", "make", "(", "chan", "fileseq", ".", "FileSequences", ")", ",", "fileOpts", ":", "fileopts", ",", "}", "\n", "return", "s", "\n", "}" ]
229
all-230
[ "attach", "multiple", "buffer", "objects", "to", "a", "vertex", "array", "object" ]
[ "func", "VertexArrayVertexBuffers", "(", "vaobj", "uint32", ",", "<mask>", "uint32", ",", "count", "int32", ",", "buffers", "*", "uint32", ",", "offsets", "*", "int", ",", "strides", "*", "int32", ")", "{", "C", ".", "glowVertexArrayVertexBuffers", "(", "gpVertexArrayVertexBuffers", ",", "(", "C", ".", "GLuint", ")", "(", "vaobj", ")", ",", "(", "C", ".", "GLuint", ")", "(", "first", ")", ",", "(", "C", ".", "GLsizei", ")", "(", "count", ")", ",", "(", "*", "C", ".", "GLuint", ")", "(", "unsafe", ".", "Pointer", "(", "buffers", ")", ")", ",", "(", "*", "C", ".", "GLintptr", ")", "(", "unsafe", ".", "Pointer", "(", "offsets", ")", ")", ",", "(", "*", "C", ".", "GLsizei", ")", "(", "unsafe", ".", "Pointer", "(", "strides", ")", ")", ")", "\n", "}" ]
230
all-231
[ "WatchByIndex", "watches", "items", "in", "a", "collection", "that", "match", "a", "particular", "index" ]
[ "func", "(", "c", "*", "readonlyCollection", ")", "WatchByIndex", "(", "index", "*", "<mask>", ",", "val", "interface", "{", "}", ")", "(", "watch", ".", "Watcher", ",", "error", ")", "{", "eventCh", ":=", "make", "(", "chan", "*", "watch", ".", "Event", ")", "\n", "done", ":=", "make", "(", "chan", "struct", "{", "}", ")", "\n", "watcher", ",", "err", ":=", "watch", ".", "NewWatcher", "(", "c", ".", "ctx", ",", "c", ".", "etcdClient", ",", "c", ".", "prefix", ",", "c", ".", "indexDir", "(", "index", ",", "val", ")", ",", "c", ".", "template", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "go", "func", "(", ")", "(", "retErr", "error", ")", "{", "defer", "func", "(", ")", "{", "if", "retErr", "!=", "nil", "{", "eventCh", "<-", "&", "watch", ".", "Event", "{", "Type", ":", "watch", ".", "EventError", ",", "Err", ":", "retErr", ",", "}", "\n", "watcher", ".", "Close", "(", ")", "\n", "}", "\n", "close", "(", "eventCh", ")", "\n", "}", "(", ")", "\n", "for", "{", "var", "ev", "*", "watch", ".", "Event", "\n", "var", "ok", "bool", "\n", "select", "{", "case", "ev", ",", "ok", "=", "<-", "watcher", ".", "Watch", "(", ")", ":", "case", "<-", "done", ":", "watcher", ".", "Close", "(", ")", "\n", "return", "nil", "\n", "}", "\n", "if", "!", "ok", "{", "watcher", ".", "Close", "(", ")", "\n", "return", "nil", "\n", "}", "\n\n", "var", "directEv", "*", "watch", ".", "Event", "\n", "switch", "ev", ".", "Type", "{", "case", "watch", ".", "EventError", ":", "// pass along the error", "return", "ev", ".", "Err", "\n", "case", "watch", ".", "EventPut", ":", "resp", ",", "err", ":=", "c", ".", "get", "(", "c", ".", "Path", "(", "path", ".", "Base", "(", "string", "(", "ev", ".", "Key", ")", ")", ")", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "if", "len", "(", "resp", ".", "Kvs", ")", "==", "0", "{", "// this happens only if the item was deleted shortly after", "// we receive this event.", "continue", "\n", "}", "\n", "directEv", "=", "&", "watch", ".", "Event", "{", "Key", ":", "[", "]", "byte", "(", "path", ".", "Base", "(", "string", "(", "ev", ".", "Key", ")", ")", ")", ",", "Value", ":", "resp", ".", "Kvs", "[", "0", "]", ".", "Value", ",", "Type", ":", "ev", ".", "Type", ",", "Template", ":", "c", ".", "template", ",", "}", "\n", "case", "watch", ".", "EventDelete", ":", "directEv", "=", "&", "watch", ".", "Event", "{", "Key", ":", "[", "]", "byte", "(", "path", ".", "Base", "(", "string", "(", "ev", ".", "Key", ")", ")", ")", ",", "Type", ":", "ev", ".", "Type", ",", "Template", ":", "c", ".", "template", ",", "}", "\n", "}", "\n", "eventCh", "<-", "directEv", "\n", "}", "\n", "}", "(", ")", "\n", "return", "watch", ".", "MakeWatcher", "(", "eventCh", ",", "done", ")", ",", "nil", "\n", "}" ]
231
all-232
[ "HasTimeRange", "returns", "a", "boolean", "if", "a", "field", "has", "been", "set", "." ]
[ "func", "(", "q", "*", "QueryConfig", ")", "HasTimeRange", "(", ")", "bool", "{", "if", "q", "!=", "nil", "&&", "q", ".", "TimeRange", "!=", "nil", "{", "return", "true", "\n", "}", "\n\n", "return", "<mask>", "\n", "}" ]
232
all-233
[ "Close", "is", "used", "to", "stop", "the", "network", "transport", "." ]
[ "func", "(", "n", "*", "NetworkTransport", ")", "Close", "(", ")", "error", "{", "n", ".", "shutdownLock", ".", "Lock", "(", ")", "\n", "defer", "n", ".", "shutdownLock", ".", "Unlock", "(", ")", "\n\n", "if", "!", "n", ".", "shutdown", "{", "<mask>", "(", "n", ".", "shutdownCh", ")", "\n", "n", ".", "stream", ".", "Close", "(", ")", "\n", "n", ".", "shutdown", "=", "true", "\n", "}", "\n", "return", "nil", "\n", "}" ]
233
all-234
[ "validate", "ensures", "that", "this", "configuration", "is", "well", "-", "formed", "." ]
[ "func", "(", "c", "*", "ConsumerConfig", ")", "validate", "(", ")", "error", "{", "if", "len", "(", "c", ".", "Topic", ")", "==", "0", "{", "return", "errors", ".", "New", "(", "\"", "\"", ")", "\n", "}", "\n\n", "if", "len", "(", "c", ".", "<mask>", ")", "==", "0", "{", "return", "errors", ".", "New", "(", "\"", "\"", ")", "\n", "}", "\n\n", "return", "nil", "\n", "}" ]
234
all-235
[ "CreatePod", "creates", "a", "pod", "in", "the", "client", "s", "specified", "namespace", ".", "Analogous", "to", "kubectl", "create", "pod", "--", "namespace", "=", "client", ".", "namespace" ]
[ "func", "(", "c", "*", "Client", ")", "CreatePod", "(", "p", "v1", ".", "Pod", ")", "(", "Pod", ",", "error", ")", "{", "c", ".", "log", "(", "\"", "\"", ",", "p", ")", "\n", "var", "retPod", "Pod", "\n", "err", ":=", "c", ".", "request", "(", "&", "request", "{", "method", ":", "http", ".", "MethodPost", ",", "<mask>", ":", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "c", ".", "namespace", ")", ",", "requestBody", ":", "&", "p", ",", "}", ",", "&", "retPod", ")", "\n", "return", "retPod", ",", "err", "\n", "}" ]
235
all-236
[ "configureEnvironmentForInstall", "sets", "GOPATH", "and", "GOBIN", "so", "that", "vendored", "linters", "can", "be", "installed" ]
[ "func", "configureEnvironmentForInstall", "(", ")", "{", "if", "config", ".", "Update", "{", "warning", "(", "`Linters are now vendored by default, --update ignored. The original\nbehaviour can be re-enabled with --no-vendored-linters.\n\nTo request an update for a vendored linter file an issue at:\nhttps://github.com/alecthomas/gometalinter/issues/new\n`", ")", "\n", "}", "\n", "gopaths", ":=", "getGoPathList", "(", ")", "\n", "vendorRoot", ":=", "findVendoredLinters", "(", ")", "\n", "if", "vendorRoot", "==", "\"", "\"", "{", "kingpin", ".", "Fatalf", "(", "\"", "\"", ",", "getGoPath", "(", ")", ")", "\n", "}", "\n", "debug", "(", "\"", "\"", ",", "vendorRoot", ")", "\n\n", "gobin", ":=", "<mask>", ".", "Getenv", "(", "\"", "\"", ")", "\n", "if", "gobin", "==", "\"", "\"", "{", "gobin", "=", "filepath", ".", "Join", "(", "gopaths", "[", "0", "]", ",", "\"", "\"", ")", "\n", "}", "\n", "setEnv", "(", "\"", "\"", ",", "gobin", ")", "\n\n", "// \"go install\" panics when one GOPATH element is beneath another, so set", "// GOPATH to the vendor root", "setEnv", "(", "\"", "\"", ",", "vendorRoot", ")", "\n", "debugPrintEnv", "(", ")", "\n", "}" ]
236
all-237
[ "NewLogger", "creates", "and", "returns", "new", "logger", "instance", "with", "provided", "name", "log", "level", "handlers", "and", "buffer", "length", ".", "If", "a", "logger", "with", "the", "same", "name", "already", "exists", "it", "will", "be", "replaced", "with", "a", "new", "one", ".", "Log", "level", "is", "lowest", "level", "or", "log", "record", "that", "this", "logger", "will", "handle", ".", "Log", "records", "(", "above", "defined", "log", "level", ")", "will", "be", "passed", "to", "all", "log", "handlers", "for", "processing", "." ]
[ "func", "NewLogger", "(", "name", "string", ",", "<mask>", "Level", ",", "handlers", "[", "]", "Handler", ",", "bufferLength", "int", ")", "(", "l", "*", "Logger", ")", "{", "l", "=", "&", "Logger", "{", "Name", ":", "name", ",", "Level", ":", "level", ",", "Handlers", ":", "handlers", ",", "buffer", ":", "ring", ".", "New", "(", "bufferLength", ")", ",", "stateChannel", ":", "make", "(", "chan", "uint8", ",", "0", ")", ",", "recordChannel", ":", "make", "(", "chan", "*", "Record", ",", "2048", ")", ",", "lock", ":", "sync", ".", "RWMutex", "{", "}", ",", "countOut", ":", "0", ",", "countIn", ":", "0", ",", "}", "\n", "go", "l", ".", "run", "(", ")", "\n", "if", "name", "==", "\"", "\"", "{", "defaultLogger", "=", "l", "\n", "}", "\n", "lock", ".", "Lock", "(", ")", "\n", "loggers", "[", "name", "]", "=", "l", "\n", "lock", ".", "Unlock", "(", ")", "\n", "return", "\n", "}" ]
237
all-238
[ "UpdateCheck", "determines", "if", "the", "check", "needs", "to", "be", "updated", "(", "new", "metrics", "tags", "etc", ".", ")" ]
[ "func", "(", "cm", "*", "CheckManager", ")", "UpdateCheck", "(", "newMetrics", "<mask>", "[", "string", "]", "*", "api", ".", "CheckBundleMetric", ")", "{", "// only if check manager is enabled", "if", "!", "cm", ".", "enabled", "{", "return", "\n", "}", "\n\n", "// only if checkBundle has been populated", "if", "cm", ".", "checkBundle", "==", "nil", "{", "return", "\n", "}", "\n\n", "// only if there is *something* to update", "if", "!", "cm", ".", "forceCheckUpdate", "&&", "len", "(", "newMetrics", ")", "==", "0", "&&", "len", "(", "cm", ".", "metricTags", ")", "==", "0", "{", "return", "\n", "}", "\n\n", "// refresh check bundle (in case there were changes made by other apps or in UI)", "cid", ":=", "cm", ".", "checkBundle", ".", "CID", "\n", "checkBundle", ",", "err", ":=", "cm", ".", "apih", ".", "FetchCheckBundle", "(", "api", ".", "CIDType", "(", "&", "cid", ")", ")", "\n", "if", "err", "!=", "nil", "{", "cm", ".", "Log", ".", "Printf", "(", "\"", "\"", ",", "err", ")", "\n", "return", "\n", "}", "\n", "cm", ".", "cbmu", ".", "Lock", "(", ")", "\n", "cm", ".", "checkBundle", "=", "checkBundle", "\n", "cm", ".", "cbmu", ".", "Unlock", "(", ")", "\n\n", "// check metric_limit and see if it’s 0, if so, don't even bother to try to update the check.", "cm", ".", "addNewMetrics", "(", "newMetrics", ")", "\n\n", "if", "len", "(", "cm", ".", "metricTags", ")", ">", "0", "{", "// note: if a tag has been added (queued) for a metric which never gets sent", "// the tags will be discarded. (setting tags does not *create* metrics.)", "for", "metricName", ",", "metricTags", ":=", "range", "cm", ".", "metricTags", "{", "for", "metricIdx", ",", "metric", ":=", "range", "cm", ".", "checkBundle", ".", "Metrics", "{", "if", "metric", ".", "Name", "==", "metricName", "{", "cm", ".", "checkBundle", ".", "Metrics", "[", "metricIdx", "]", ".", "Tags", "=", "metricTags", "\n", "break", "\n", "}", "\n", "}", "\n", "cm", ".", "mtmu", ".", "Lock", "(", ")", "\n", "delete", "(", "cm", ".", "metricTags", ",", "metricName", ")", "\n", "cm", ".", "mtmu", ".", "Unlock", "(", ")", "\n", "}", "\n", "cm", ".", "forceCheckUpdate", "=", "true", "\n", "}", "\n\n", "if", "cm", ".", "forceCheckUpdate", "{", "newCheckBundle", ",", "err", ":=", "cm", ".", "apih", ".", "UpdateCheckBundle", "(", "cm", ".", "checkBundle", ")", "\n", "if", "err", "!=", "nil", "{", "cm", ".", "Log", ".", "Printf", "(", "\"", "\"", ",", "err", ")", "\n", "return", "\n", "}", "\n\n", "cm", ".", "forceCheckUpdate", "=", "false", "\n", "cm", ".", "cbmu", ".", "Lock", "(", ")", "\n", "cm", ".", "checkBundle", "=", "newCheckBundle", "\n", "cm", ".", "cbmu", ".", "Unlock", "(", ")", "\n", "cm", ".", "inventoryMetrics", "(", ")", "\n", "}", "\n\n", "}" ]
238
all-239
[ "===", "predict_linear", "(", "node", "ValueTypeMatrix", "k", "ValueTypeScalar", ")", "Vector", "===" ]
[ "func", "funcPredictLinear", "(", "vals", "[", "]", "Value", ",", "args", "Expressions", ",", "enh", "*", "EvalNodeHelper", ")", "<mask>", "{", "mat", ":=", "vals", "[", "0", "]", ".", "(", "Matrix", ")", "\n", "duration", ":=", "vals", "[", "1", "]", ".", "(", "Vector", ")", "[", "0", "]", ".", "V", "\n\n", "for", "_", ",", "samples", ":=", "range", "mat", "{", "// No sense in trying to predict anything without at least two points.", "// Drop this Vector element.", "if", "len", "(", "samples", ".", "Points", ")", "<", "2", "{", "continue", "\n", "}", "\n", "slope", ",", "intercept", ":=", "linearRegression", "(", "samples", ".", "Points", ",", "enh", ".", "ts", ")", "\n\n", "enh", ".", "out", "=", "append", "(", "enh", ".", "out", ",", "Sample", "{", "Point", ":", "Point", "{", "V", ":", "slope", "*", "duration", "+", "intercept", "}", ",", "}", ")", "\n", "}", "\n", "return", "enh", ".", "out", "\n", "}" ]
239
all-240
[ "POST", "/", "api", "/", "manager", "/", "projects", "/", ":", "project_id", "/", "scheduled_actions", "Create", "a", "new", "ScheduledAction", "resource", "." ]
[ "func", "(", "loc", "*", "ScheduledActionLocator", ")", "Create", "(", "action", "string", ",", "executionId", "string", ",", "firstOccurrence", "*", "time", ".", "Time", ",", "options", "rsapi", ".", "APIParams", ")", "(", "*", "ScheduledActionLocator", ",", "error", ")", "{", "var", "res", "*", "ScheduledActionLocator", "\n", "if", "action", "==", "\"", "\"", "{", "return", "res", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ")", "\n", "}", "\n", "if", "executionId", "==", "\"", "\"", "{", "return", "res", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ")", "\n", "}", "\n", "var", "params", "rsapi", ".", "APIParams", "\n", "var", "p", "rsapi", ".", "APIParams", "\n", "p", "=", "rsapi", ".", "APIParams", "{", "\"", "\"", ":", "action", ",", "\"", "\"", ":", "executionId", ",", "\"", "\"", ":", "firstOccurrence", ",", "}", "\n", "var", "nameOpt", "=", "options", "[", "\"", "\"", "]", "\n", "if", "nameOpt", "!=", "nil", "{", "p", "[", "\"", "\"", "]", "=", "nameOpt", "\n", "}", "\n", "var", "operationOpt", "=", "options", "[", "\"", "\"", "]", "\n", "if", "operationOpt", "!=", "nil", "{", "p", "[", "\"", "\"", "]", "=", "operationOpt", "\n", "}", "\n", "var", "recurrenceOpt", "=", "options", "[", "\"", "\"", "]", "\n", "if", "recurrenceOpt", "!=", "nil", "{", "p", "[", "\"", "\"", "]", "=", "recurrenceOpt", "\n", "}", "\n", "var", "timezoneOpt", "=", "options", "[", "\"", "\"", "]", "\n", "if", "timezoneOpt", "!=", "nil", "{", "p", "[", "\"", "\"", "]", "=", "timezoneOpt", "\n", "}", "\n", "uri", ",", "err", ":=", "loc", ".", "ActionPath", "(", "\"", "\"", ",", "\"", "\"", ")", "\n", "if", "err", "!=", "nil", "{", "return", "res", ",", "err", "\n", "}", "\n", "req", ",", "err", ":=", "loc", ".", "api", ".", "BuildHTTPRequest", "(", "uri", ".", "HTTPMethod", ",", "uri", ".", "Path", ",", "APIVersion", ",", "params", ",", "p", ")", "\n", "if", "err", "!=", "nil", "{", "return", "res", ",", "err", "\n", "}", "\n", "resp", ",", "err", ":=", "loc", ".", "api", ".", "PerformRequest", "(", "req", ")", "\n", "if", "err", "!=", "nil", "{", "return", "res", ",", "err", "\n", "}", "\n", "defer", "resp", ".", "Body", ".", "Close", "(", ")", "\n", "if", "resp", ".", "StatusCode", "<", "200", "||", "resp", ".", "StatusCode", ">", "299", "{", "respBody", ",", "_", ":=", "ioutil", ".", "ReadAll", "(", "resp", ".", "Body", ")", "\n", "sr", ":=", "string", "(", "respBody", ")", "\n", "if", "sr", "!=", "\"", "\"", "{", "<mask>", "=", "\"", "\"", "+", "sr", "\n", "}", "\n", "return", "res", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "resp", ".", "Status", ",", "sr", ")", "\n", "}", "\n", "location", ":=", "resp", ".", "Header", ".", "Get", "(", "\"", "\"", ")", "\n", "if", "len", "(", "location", ")", "==", "0", "{", "return", "res", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ")", "\n", "}", "else", "{", "return", "&", "ScheduledActionLocator", "{", "Href", "(", "location", ")", ",", "loc", ".", "api", "}", ",", "nil", "\n", "}", "\n", "}" ]
240
all-241
[ "buildAndSelectGuestIPs", "builds", "a", "list", "of", "IP", "addresses", "known", "to", "VMware", "tools", ".", "From", "this", "list", "it", "selects", "the", "first", "IP", "address", "it", "seems", "that", "s", "associated", "with", "a", "default", "gateway", "-", "first", "IPv4", "and", "then", "IPv6", "if", "criteria", "can", "t", "be", "satisfied", "-", "and", "sets", "that", "as", "the", "default_ip_address", "and", "also", "the", "IP", "address", "used", "for", "provisioning", ".", "The", "full", "list", "of", "IP", "addresses", "is", "saved", "to", "guest_ip_addresses", "." ]
[ "func", "buildAndSelectGuestIPs", "(", "d", "*", "schema", ".", "ResourceData", ",", "guest", "types", ".", "GuestInfo", ")", "error", "{", "log", ".", "Printf", "(", "\"", "\"", ",", "resourceVSphereVirtualMachineIDString", "(", "d", ")", ")", "\n", "var", "v4primary", ",", "v6primary", ",", "v4gw", ",", "v6gw", "net", ".", "IP", "\n", "var", "v4addrs", ",", "v6addrs", "[", "]", "string", "\n\n", "// Fetch gateways first.", "for", "_", ",", "s", ":=", "<mask>", "guest", ".", "IpStack", "{", "if", "s", ".", "IpRouteConfig", "!=", "nil", "{", "for", "_", ",", "r", ":=", "range", "s", ".", "IpRouteConfig", ".", "IpRoute", "{", "switch", "r", ".", "Network", "{", "case", "\"", "\"", ":", "v4gw", "=", "net", ".", "ParseIP", "(", "r", ".", "Gateway", ".", "IpAddress", ")", "\n", "case", "\"", "\"", ":", "v6gw", "=", "net", ".", "ParseIP", "(", "r", ".", "Gateway", ".", "IpAddress", ")", "\n", "}", "\n", "}", "\n", "}", "\n", "}", "\n\n", "// Now fetch all IP addresses, checking at the same time to see if the IP", "// address is eligible to be a primary IP address.", "for", "_", ",", "n", ":=", "range", "guest", ".", "Net", "{", "if", "n", ".", "IpConfig", "!=", "nil", "{", "for", "_", ",", "addr", ":=", "range", "n", ".", "IpConfig", ".", "IpAddress", "{", "ip", ":=", "net", ".", "ParseIP", "(", "addr", ".", "IpAddress", ")", "\n", "var", "mask", "net", ".", "IPMask", "\n", "if", "ip", ".", "To4", "(", ")", "!=", "nil", "{", "v4addrs", "=", "append", "(", "v4addrs", ",", "addr", ".", "IpAddress", ")", "\n", "mask", "=", "net", ".", "CIDRMask", "(", "int", "(", "addr", ".", "PrefixLength", ")", ",", "32", ")", "\n", "if", "ip", ".", "Mask", "(", "mask", ")", ".", "Equal", "(", "v4gw", ".", "Mask", "(", "mask", ")", ")", "&&", "v4primary", "==", "nil", "{", "v4primary", "=", "ip", "\n", "}", "\n", "}", "else", "{", "v6addrs", "=", "append", "(", "v6addrs", ",", "addr", ".", "IpAddress", ")", "\n", "mask", "=", "net", ".", "CIDRMask", "(", "int", "(", "addr", ".", "PrefixLength", ")", ",", "128", ")", "\n", "if", "ip", ".", "Mask", "(", "mask", ")", ".", "Equal", "(", "v6gw", ".", "Mask", "(", "mask", ")", ")", "&&", "v6primary", "==", "nil", "{", "v6primary", "=", "ip", "\n", "}", "\n", "}", "\n", "}", "\n", "}", "\n", "}", "\n\n", "addrs", ":=", "make", "(", "[", "]", "string", ",", "0", ")", "\n", "addrs", "=", "append", "(", "addrs", ",", "v4addrs", "...", ")", "\n", "addrs", "=", "append", "(", "addrs", ",", "v6addrs", "...", ")", "\n\n", "// Fall back to the IpAddress property in GuestInfo directly when the", "// IpStack and Net properties are not populated. This generally means that", "// an older version of VMTools is in use.", "if", "len", "(", "addrs", ")", "<", "1", "&&", "guest", ".", "IpAddress", "!=", "\"", "\"", "{", "addrs", "=", "append", "(", "addrs", ",", "guest", ".", "IpAddress", ")", "\n", "}", "\n\n", "if", "len", "(", "addrs", ")", "<", "1", "{", "// No IP addresses were discovered. This more than likely means that the VM", "// is powered off, or VMware tools is not installed. We can return here,", "// setting the empty set of addresses to avoid spurious diffs.", "log", ".", "Printf", "(", "\"", "\"", ",", "resourceVSphereVirtualMachineIDString", "(", "d", ")", ")", "\n", "return", "d", ".", "Set", "(", "\"", "\"", ",", "addrs", ")", "\n", "}", "\n", "var", "primary", "string", "\n", "switch", "{", "case", "v4primary", "!=", "nil", ":", "primary", "=", "v4primary", ".", "String", "(", ")", "\n", "case", "v6primary", "!=", "nil", ":", "primary", "=", "v6primary", ".", "String", "(", ")", "\n", "default", ":", "primary", "=", "addrs", "[", "0", "]", "\n", "}", "\n", "log", ".", "Printf", "(", "\"", "\"", ",", "resourceVSphereVirtualMachineIDString", "(", "d", ")", ",", "primary", ")", "\n", "d", ".", "Set", "(", "\"", "\"", ",", "primary", ")", "\n", "log", ".", "Printf", "(", "\"", "\"", ",", "resourceVSphereVirtualMachineIDString", "(", "d", ")", ",", "strings", ".", "Join", "(", "addrs", ",", "\"", "\"", ")", ")", "\n", "if", "err", ":=", "d", ".", "Set", "(", "\"", "\"", ",", "addrs", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "d", ".", "SetConnInfo", "(", "map", "[", "string", "]", "string", "{", "\"", "\"", ":", "\"", "\"", ",", "\"", "\"", ":", "primary", ",", "}", ")", "\n\n", "return", "nil", "\n", "}" ]
241
all-242
[ "Clean", "by", "janitor", "script" ]
[ "func", "janitorClean", "(", "resource", "*", "common", ".", "Resource", ",", "flags", "[", "]", "string", ")", "error", "{", "args", ":=", "append", "(", "[", "]", "string", "{", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "format", "(", "resource", ".", "Type", ")", ",", "resource", ".", "Name", ")", "}", ",", "flags", "...", ")", "\n", "logrus", ".", "Infof", "(", "\"", "\"", ",", "*", "janitorPath", ",", "strings", ".", "Join", "(", "args", ",", "\"", "\"", ")", ")", "\n", "cmd", ":=", "exec", ".", "Command", "(", "*", "janitorPath", ",", "args", "...", ")", "\n", "b", ",", "err", ":=", "cmd", ".", "CombinedOutput", "(", ")", "\n", "if", "err", "!=", "nil", "{", "logrus", ".", "WithError", "(", "err", ")", ".", "Errorf", "(", "\"", "\"", ",", "resource", ".", "Name", ",", "string", "(", "b", ")", ")", "\n", "}", "else", "{", "logrus", ".", "Tracef", "(", "\"", "\"", ",", "string", "(", "b", ")", ")", "\n", "logrus", ".", "Infof", "(", "\"", "\"", ",", "<mask>", ".", "Name", ")", "\n", "}", "\n", "return", "err", "\n", "}" ]
242
all-243
[ "HasY", "returns", "a", "boolean", "if", "a", "field", "has", "been", "set", "." ]
[ "func", "(", "s", "*", "ScatterplotRequests", ")", "HasY", "(", ")", "bool", "{", "if", "s", "!=", "nil", "&&", "s", ".", "Y", "!=", "nil", "{", "return", "true", "\n", "}", "\n\n", "return", "<mask>", "\n", "}" ]
243
all-244
[ "Do", "executes", "CSS", ".", "setEffectivePropertyValueForNode", "against", "the", "provided", "context", "." ]
[ "func", "(", "p", "*", "SetEffectivePropertyValueForNodeParams", ")", "Do", "(", "ctx", "context", ".", "<mask>", ")", "(", "err", "error", ")", "{", "return", "cdp", ".", "Execute", "(", "ctx", ",", "CommandSetEffectivePropertyValueForNode", ",", "p", ",", "nil", ")", "\n", "}" ]
244
all-245
[ "newConnectionMaker", "returns", "a", "usable", "ConnectionMaker", "seeded", "with", "peers", "making", "outbound", "connections", "from", "localAddr", "and", "listening", "on", "port", ".", "If", "discovery", "is", "true", "ConnectionMaker", "will", "attempt", "to", "initiate", "new", "connections", "with", "peers", "it", "s", "not", "directly", "connected", "to", "." ]
[ "func", "newConnectionMaker", "(", "ourself", "*", "localPeer", ",", "peers", "*", "Peers", ",", "localAddr", "string", ",", "port", "int", ",", "discovery", "bool", ",", "logger", "Logger", ")", "*", "connectionMaker", "{", "actionChan", ":=", "make", "(", "chan", "connectionMakerAction", ",", "ChannelSize", ")", "\n", "cm", ":=", "&", "connectionMaker", "{", "ourself", ":", "ourself", ",", "peers", ":", "peers", ",", "localAddr", ":", "localAddr", ",", "port", ":", "port", ",", "discovery", ":", "discovery", ",", "directPeers", ":", "peerAddrs", "{", "}", ",", "targets", ":", "make", "(", "map", "[", "string", "]", "*", "target", ")", ",", "connections", ":", "<mask>", "(", "map", "[", "Connection", "]", "struct", "{", "}", ")", ",", "actionChan", ":", "actionChan", ",", "logger", ":", "logger", ",", "}", "\n", "go", "cm", ".", "queryLoop", "(", "actionChan", ")", "\n", "return", "cm", "\n", "}" ]
245
all-246
[ "getCache", "returns", "the", "cached", "template", "." ]
[ "func", "getCache", "(", "name", "string", ")", "(", "<mask>", ".", "Template", ",", "bool", ")", "{", "cacheMutex", ".", "RLock", "(", ")", "\n", "tpl", ",", "ok", ":=", "cache", "[", "name", "]", "\n", "cacheMutex", ".", "RUnlock", "(", ")", "\n", "return", "tpl", ",", "ok", "\n", "}" ]
246
all-247
[ "UnmarshalEasyJSON", "satisfies", "easyjson", ".", "Unmarshaler", "." ]
[ "func", "(", "t", "*", "KeyType", ")", "UnmarshalEasyJSON", "(", "in", "*", "jlexer", ".", "Lexer", ")", "{", "switch", "KeyType", "(", "<mask>", ".", "String", "(", ")", ")", "{", "case", "KeyDown", ":", "*", "t", "=", "KeyDown", "\n", "case", "KeyUp", ":", "*", "t", "=", "KeyUp", "\n", "case", "KeyRawDown", ":", "*", "t", "=", "KeyRawDown", "\n", "case", "KeyChar", ":", "*", "t", "=", "KeyChar", "\n\n", "default", ":", "in", ".", "AddError", "(", "errors", ".", "New", "(", "\"", "\"", ")", ")", "\n", "}", "\n", "}" ]
247
all-248
[ "operationsByZone", "segments", "a", "slice", "of", "RecordOperations", "by", "their", "zone", "." ]
[ "func", "operationsByZone", "(", "zones", "map", "[", "string", "]", "*", "dns", ".", "ZoneSummary", ",", "ops", "[", "]", "dns", ".", "RecordOperation", ")", "map", "[", "string", "]", "[", "]", "dns", ".", "RecordOperation", "{", "changes", ":=", "make", "(", "map", "[", "string", "]", "[", "]", "dns", ".", "RecordOperation", ")", "\n\n", "zoneNameIDMapper", ":=", "zoneIDName", "{", "}", "\n", "for", "_", ",", "z", ":=", "range", "zones", "{", "zoneNameIDMapper", ".", "Add", "(", "*", "z", ".", "Id", ",", "*", "z", ".", "Name", ")", "\n", "changes", "[", "*", "z", ".", "Id", "]", "=", "[", "]", "dns", ".", "RecordOperation", "{", "}", "\n", "}", "\n\n", "for", "_", ",", "op", ":=", "range", "ops", "{", "if", "zoneID", ",", "_", ":=", "zoneNameIDMapper", ".", "FindZone", "(", "*", "op", ".", "Domain", ")", ";", "zoneID", "!=", "\"", "\"", "{", "changes", "[", "zoneID", "]", "=", "append", "(", "changes", "[", "zoneID", "]", ",", "op", ")", "\n", "}", "else", "{", "log", ".", "Warnf", "(", "\"", "\"", ",", "op", ")", "\n", "}", "\n", "}", "\n\n", "// Remove zones that don't have any changes.", "for", "zone", ",", "ops", ":=", "range", "<mask>", "{", "if", "len", "(", "ops", ")", "==", "0", "{", "delete", "(", "changes", ",", "zone", ")", "\n", "}", "\n", "}", "\n\n", "return", "changes", "\n", "}" ]
248
all-249
[ "newBuffer", "returns", "a", "new", "buffer", "reading", "from", "r", "at", "the", "given", "offset", "." ]
[ "func", "newBuffer", "(", "r", "io", ".", "Reader", ",", "offset", "int64", ")", "*", "buffer", "{", "return", "&", "<mask>", "{", "r", ":", "r", ",", "offset", ":", "offset", ",", "buf", ":", "make", "(", "[", "]", "byte", ",", "0", ",", "4096", ")", ",", "allowObjptr", ":", "true", ",", "allowStream", ":", "true", ",", "}", "\n", "}" ]
249
all-250
[ "GetTagsAsUniqueStrings", "gets", "all", "tags", "as", "a", "slice", "of", "unique", "strings", ".", "This", "is", "here", "to", "have", "a", "means", "of", "being", "somewhat", "backwards", "compatible", "with", "previous", "versions", "of", "mention" ]
[ "func", "GetTagsAsUniqueStrings", "(", "prefix", "rune", ",", "str", "string", ",", "terminator", "...", "rune", ")", "(", "strs", "[", "]", "string", ")", "{", "tags", ":=", "GetTags", "(", "prefix", ",", "str", ",", "terminator", "...", ")", "\n", "for", "_", ",", "<mask>", ":=", "range", "tags", "{", "strs", "=", "append", "(", "strs", ",", "tag", ".", "Tag", ")", "\n", "}", "\n", "return", "uniquify", "(", "strs", ")", "\n", "}" ]
250
all-251
[ "FetchAnnotations", "retrieves", "all", "annotations", "available", "to", "the", "API", "Token", "." ]
[ "func", "(", "a", "*", "API", ")", "FetchAnnotations", "(", ")", "(", "*", "[", "]", "Annotation", ",", "error", ")", "{", "result", ",", "err", ":=", "a", ".", "Get", "(", "config", ".", "AnnotationPrefix", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "<mask>", "annotations", "[", "]", "Annotation", "\n", "if", "err", ":=", "json", ".", "Unmarshal", "(", "result", ",", "&", "annotations", ")", ";", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "return", "&", "annotations", ",", "nil", "\n", "}" ]
251
all-252
[ "MarshalJSON", "supports", "json", ".", "Marshaler", "interface" ]
[ "func", "(", "v", "GetMetadataParams", ")", "MarshalJSON", "(", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "w", ":=", "jwriter", ".", "Writer", "{", "}", "\n", "easyjsonC5a4559bEncodeGithubComChromedpCdprotoIndexeddb12", "(", "&", "w", ",", "v", ")", "\n", "return", "w", ".", "Buffer", ".", "BuildBytes", "(", ")", ",", "w", ".", "<mask>", "\n", "}" ]
252
all-253
[ "render", "indexed", "primitives", "from", "array", "data", "taking", "parameters", "from", "memory" ]
[ "func", "MultiDrawElementsIndirect", "(", "<mask>", "uint32", ",", "xtype", "uint32", ",", "indirect", "unsafe", ".", "Pointer", ",", "drawcount", "int32", ",", "stride", "int32", ")", "{", "C", ".", "glowMultiDrawElementsIndirect", "(", "gpMultiDrawElementsIndirect", ",", "(", "C", ".", "GLenum", ")", "(", "mode", ")", ",", "(", "C", ".", "GLenum", ")", "(", "xtype", ")", ",", "indirect", ",", "(", "C", ".", "GLsizei", ")", "(", "drawcount", ")", ",", "(", "C", ".", "GLsizei", ")", "(", "stride", ")", ")", "\n", "}" ]
253
all-254
[ "Search", "the", "network", "for", "SSDP", "devices", "using", "the", "given", "search", "string", "and", "duration", "to", "discover", "new", "devices", ".", "This", "function", "will", "return", "an", "array", "of", "SearchReponses", "discovered", "." ]
[ "func", "Search", "(", "st", "string", ",", "mx", "time", ".", "Duration", ")", "(", "[", "]", "SearchResponse", ",", "error", ")", "{", "<mask>", ",", "err", ":=", "listenForSearchResponses", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "defer", "conn", ".", "Close", "(", ")", "\n\n", "searchBytes", ",", "broadcastAddr", ":=", "buildSearchRequest", "(", "st", ",", "mx", ")", "\n", "// Write search bytes on the wire so all devices can respond", "_", ",", "err", "=", "conn", ".", "WriteTo", "(", "searchBytes", ",", "broadcastAddr", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "return", "readSearchResponses", "(", "conn", ",", "mx", ")", "\n", "}" ]
254
all-255
[ "Arbitrary", "numbers", "used", "to", "do", "a", "simple", "topological", "sort", "of", "resources", "." ]
[ "func", "depTier", "(", "disco", "discovery", ".", "OpenAPISchemaInterface", ",", "mapper", "meta", ".", "RESTMapper", ",", "o", "schema", ".", "ObjectKind", ")", "(", "int", ",", "error", ")", "{", "gvk", ":=", "o", ".", "GroupVersionKind", "(", ")", "\n", "if", "gk", ":=", "gvk", ".", "GroupKind", "(", ")", ";", "gk", "==", "gkTpr", "||", "gk", "==", "gkCrd", "{", "// Special case: these create other types", "return", "10", ",", "nil", "\n", "}", "\n\n", "mapping", ",", "err", ":=", "mapper", ".", "RESTMapping", "(", "gvk", ".", "GroupKind", "(", ")", ",", "gvk", ".", "<mask>", ")", "\n", "if", "err", "!=", "nil", "{", "log", ".", "Debugf", "(", "\"", "\"", ",", "gvk", ",", "err", ")", "\n", "return", "50", ",", "nil", "\n", "}", "\n\n", "if", "mapping", ".", "Scope", ".", "Name", "(", ")", "==", "meta", ".", "RESTScopeNameRoot", "{", "// Place global before namespaced", "return", "20", ",", "nil", "\n", "}", "else", "if", "containsPodSpec", "(", "disco", ",", "gvk", ")", "{", "// (Potentially) starts a pod, so place last", "return", "100", ",", "nil", "\n", "}", "else", "{", "// Everything else", "return", "50", ",", "nil", "\n", "}", "\n", "}" ]
255
all-256
[ "ParseVersion", "parses", "a", "version", "of", "the", "form", "12", ".", "34", ".", "56", "-", "abcd", ".", "Non", "-", "negative", "integer", "components", "are", "separated", "by", "dots", ".", "An", "arbitrary", "suffix", "may", "appear", "after", "-", "which", "is", "ignored", "." ]
[ "func", "ParseVersion", "(", "vs", "string", ")", "(", "Version", ",", "error", ")", "{", "i", ":=", "strings", ".", "IndexByte", "(", "vs", ",", "'-'", ")", "\n", "if", "i", ">=", "0", "{", "vs", "=", "vs", "[", ":", "i", "]", "\n", "}", "\n", "cstrs", ":=", "strings", ".", "Split", "(", "vs", ",", "\"", "\"", ")", "\n", "v", ":=", "make", "(", "Version", ",", "len", "(", "cstrs", ")", ")", "\n", "for", "i", ",", "cstr", ":=", "<mask>", "cstrs", "{", "cn", ",", "err", ":=", "strconv", ".", "Atoi", "(", "cstr", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "cstr", ")", "\n", "}", "\n", "if", "cn", "<", "0", "{", "return", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "cstr", ")", "\n", "}", "\n", "v", "[", "i", "]", "=", "cn", "\n", "}", "\n", "return", "v", ",", "nil", "\n", "}" ]
256
all-257
[ "Flush", "the", "response" ]
[ "func", "(", "w", "*", "<mask>", ")", "Flush", "(", ")", "{", "if", "f", ",", "ok", ":=", "w", ".", "ResponseWriter", ".", "(", "http", ".", "Flusher", ")", ";", "ok", "{", "f", ".", "Flush", "(", ")", "\n", "}", "\n", "}" ]
257
all-258
[ "flattenClusterHostGroup", "saves", "a", "ClusterHostGroup", "into", "the", "supplied", "ResourceData", "." ]
[ "func", "flattenClusterHostGroup", "(", "d", "*", "schema", ".", "ResourceData", ",", "obj", "*", "types", ".", "ClusterHostGroup", ")", "error", "{", "var", "hostIDs", "[", "]", "string", "\n", "for", "_", ",", "v", ":=", "range", "obj", ".", "Host", "{", "hostIDs", "=", "append", "(", "hostIDs", ",", "v", ".", "Value", ")", "\n", "}", "\n\n", "return", "structure", ".", "SetBatch", "(", "d", ",", "map", "[", "string", "]", "<mask>", "{", "}", "{", "\"", "\"", ":", "hostIDs", ",", "}", ")", "\n", "}" ]
258
all-259
[ "determine", "if", "a", "name", "corresponds", "to", "a", "program", "pipeline", "object" ]
[ "func", "IsProgramPipeline", "(", "pipeline", "uint32", ")", "bool", "{", "<mask>", ":=", "C", ".", "glowIsProgramPipeline", "(", "gpIsProgramPipeline", ",", "(", "C", ".", "GLuint", ")", "(", "pipeline", ")", ")", "\n", "return", "ret", "==", "TRUE", "\n", "}" ]
259
all-260
[ "Copy", "returns", "a", "deep", "copy", "of", "this", "configuration", "." ]
[ "func", "(", "c", "*", "RetryConfig", ")", "Copy", "(", ")", "*", "RetryConfig", "{", "if", "c", "==", "nil", "{", "return", "nil", "\n", "}", "\n\n", "<mask>", "o", "RetryConfig", "\n\n", "o", ".", "Attempts", "=", "c", ".", "Attempts", "\n\n", "o", ".", "Backoff", "=", "c", ".", "Backoff", "\n\n", "o", ".", "MaxBackoff", "=", "c", ".", "MaxBackoff", "\n\n", "o", ".", "Enabled", "=", "c", ".", "Enabled", "\n\n", "return", "&", "o", "\n", "}" ]
260
all-261
[ "UnmarshalJSON", "supports", "json", ".", "Unmarshaler", "interface" ]
[ "func", "(", "v", "*", "CreateStyleSheetReturns", ")", "UnmarshalJSON", "(", "data", "[", "]", "<mask>", ")", "error", "{", "r", ":=", "jlexer", ".", "Lexer", "{", "Data", ":", "data", "}", "\n", "easyjsonC5a4559bDecodeGithubComChromedpCdprotoCss58", "(", "&", "r", ",", "v", ")", "\n", "return", "r", ".", "Error", "(", ")", "\n", "}" ]
261
all-262
[ "set", "front", "and", "/", "or", "back", "function", "and", "reference", "value", "for", "stencil", "testing" ]
[ "func", "StencilFuncSeparate", "(", "face", "uint32", ",", "xfunc", "uint32", ",", "ref", "int32", ",", "mask", "uint32", ")", "{", "syscall", ".", "Syscall6", "(", "gpStencilFuncSeparate", ",", "4", ",", "uintptr", "(", "face", ")", ",", "uintptr", "(", "xfunc", ")", ",", "uintptr", "(", "ref", ")", ",", "uintptr", "(", "<mask>", ")", ",", "0", ",", "0", ")", "\n", "}" ]
262
all-263
[ "DeleteSnapshot", "deletes", "a", "specified", "snapshot" ]
[ "func", "(", "c", "*", "Client", ")", "DeleteSnapshot", "(", "snapshotID", "string", ")", "(", "*", "http", ".", "Header", ",", "error", ")", "{", "url", ":=", "snapshotColPath", "(", ")", "+", "slash", "(", "snapshotID", ")", "+", "`?depth=`", "+", "c", ".", "client", ".", "depth", "+", "`&pretty=`", "+", "strconv", ".", "FormatBool", "(", "c", ".", "<mask>", ".", "pretty", ")", "\n", "ret", ":=", "&", "http", ".", "Header", "{", "}", "\n", "err", ":=", "c", ".", "client", ".", "Delete", "(", "url", ",", "ret", ",", "http", ".", "StatusAccepted", ")", "\n", "return", "ret", ",", "err", "\n", "}" ]
263
all-264
[ "IsEquivalent", "returns", "true", "if", "other", "represents", "the", "same", "data", "type", "as", "the", "target", "." ]
[ "func", "(", "o", "*", "ObjectDataType", ")", "IsEquivalent", "(", "other", "DataType", ")", "bool", "{", "a", ",", "ok", ":=", "other", ".", "(", "*", "ObjectDataType", ")", "\n", "if", "!", "ok", "{", "return", "false", "\n", "}", "\n", "if", "o", ".", "TypeName", "!=", "a", ".", "TypeName", "{", "return", "false", "\n", "}", "\n", "if", "len", "(", "o", ".", "Fields", ")", "!=", "len", "(", "a", ".", "Fields", ")", "{", "return", "false", "\n", "}", "\n", "for", "i", ",", "f", ":=", "range", "o", ".", "Fields", "{", "if", "!", "f", ".", "IsEquivalent", "(", "a", ".", "Fields", "[", "i", "]", ")", "{", "return", "<mask>", "\n", "}", "\n", "}", "\n", "return", "true", "\n", "}" ]
264
all-265
[ "SelectPath", "is", "a", "wrapper", "around", "gtk_icon_view_select_path", "()", "." ]
[ "func", "(", "v", "*", "IconView", ")", "SelectPath", "(", "<mask>", "*", "TreePath", ")", "{", "C", ".", "gtk_icon_view_select_path", "(", "v", ".", "native", "(", ")", ",", "path", ".", "native", "(", ")", ")", "\n", "}" ]
265
all-266
[ "UnmarshalJSON", "supports", "json", ".", "Unmarshaler", "interface" ]
[ "func", "(", "v", "*", "CreateStyleSheetParams", ")", "UnmarshalJSON", "(", "data", "[", "]", "byte", ")", "error", "{", "r", ":=", "jlexer", ".", "Lexer", "{", "Data", ":", "<mask>", "}", "\n", "easyjsonC5a4559bDecodeGithubComChromedpCdprotoCss59", "(", "&", "r", ",", "v", ")", "\n", "return", "r", ".", "Error", "(", ")", "\n", "}" ]
266
all-267
[ "LoadFromPngFile", "Open", "a", "png", "file" ]
[ "func", "LoadFromPngFile", "(", "filePath", "string", ")", "(", "<mask>", ".", "Image", ",", "error", ")", "{", "// Open file", "f", ",", "err", ":=", "os", ".", "OpenFile", "(", "filePath", ",", "0", ",", "0", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "defer", "f", ".", "Close", "(", ")", "\n", "b", ":=", "bufio", ".", "NewReader", "(", "f", ")", "\n", "img", ",", "err", ":=", "png", ".", "Decode", "(", "b", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "return", "img", ",", "nil", "\n", "}" ]
267
all-268
[ "Locator", "returns", "a", "locator", "for", "the", "given", "resource" ]
[ "func", "(", "r", "*", "Permission", ")", "Locator", "(", "api", "*", "API", ")", "*", "PermissionLocator", "{", "for", "_", ",", "l", ":=", "<mask>", "r", ".", "Links", "{", "if", "l", "[", "\"", "\"", "]", "==", "\"", "\"", "{", "return", "api", ".", "PermissionLocator", "(", "l", "[", "\"", "\"", "]", ")", "\n", "}", "\n", "}", "\n", "return", "nil", "\n", "}" ]
268
all-269
[ "hideConsoleWindowOnWindows", "will", "hide", "the", "console", "window", "that", "is", "showing", "when", "compiling", "on", "Windows", "without", "specifying", "the", "-", "ldflags", "-", "Hwindowsgui", "flag", "." ]
[ "func", "hideConsoleWindowOnWindows", "(", ")", "{", "<mask>", ",", "err", ":=", "getCurrentProcessId", "(", ")", "\n", "if", "err", "!=", "nil", "{", "// Ignore errors because:", "// 1. It is not critical if the console can't be hid.", "// 2. There is nothing to do when errors happen.", "return", "\n", "}", "\n", "w", ",", "err", ":=", "getConsoleWindow", "(", ")", "\n", "if", "err", "!=", "nil", "{", "// Ignore errors", "return", "\n", "}", "\n", "// Get the process ID of the console's creator.", "cpid", ",", "err", ":=", "getWindowThreadProcessId", "(", "w", ")", "\n", "if", "err", "!=", "nil", "{", "// Ignore errors", "return", "\n", "}", "\n", "if", "pid", "==", "cpid", "{", "// The current process created its own console. Hide this.", "showWindowAsync", "(", "w", ",", "windows", ".", "SW_HIDE", ")", "\n", "}", "\n", "}" ]
269
all-270
[ "NewStorage", "returns", "a", "remote", ".", "Storage", "." ]
[ "func", "NewStorage", "(", "l", "log", ".", "Logger", ",", "reg", "prometheus", ".", "Registerer", ",", "stCallback", "startTimeCallback", ",", "walDir", "string", ",", "flushDeadline", "time", ".", "Duration", ")", "*", "Storage", "{", "if", "l", "==", "nil", "{", "l", "=", "log", ".", "NewNopLogger", "(", ")", "\n", "}", "\n", "s", ":=", "&", "Storage", "{", "logger", ":", "logging", ".", "Dedupe", "(", "l", ",", "1", "*", "time", ".", "Minute", ")", ",", "localStartTimeCallback", ":", "stCallback", ",", "flushDeadline", ":", "flushDeadline", ",", "samplesIn", ":", "newEWMARate", "(", "ewmaWeight", ",", "shardUpdateDuration", ")", ",", "walDir", ":", "walDir", ",", "}", "\n", "go", "s", ".", "<mask>", "(", ")", "\n", "return", "s", "\n", "}" ]
270
all-271
[ "New", "generator", "to", "generate", "refresh", "templates" ]
[ "func", "New", "(", "opts", "*", "<mask>", ")", "(", "*", "genny", ".", "Generator", ",", "error", ")", "{", "g", ":=", "genny", ".", "New", "(", ")", "\n", "if", "err", ":=", "opts", ".", "Validate", "(", ")", ";", "err", "!=", "nil", "{", "return", "g", ",", "err", "\n", "}", "\n", "g", ".", "Box", "(", "packr", ".", "New", "(", "\"", "\"", ",", "\"", "\"", ")", ")", "\n\n", "ctx", ":=", "plush", ".", "NewContext", "(", ")", "\n", "ctx", ".", "Set", "(", "\"", "\"", ",", "opts", ".", "App", ")", "\n", "g", ".", "Transformer", "(", "plushgen", ".", "Transformer", "(", "ctx", ")", ")", "\n", "g", ".", "Transformer", "(", "genny", ".", "Dot", "(", ")", ")", "\n", "return", "g", ",", "nil", "\n", "}" ]
271
all-272
[ "ShouldPullWithASMAuth", "returns", "true", "if", "this", "container", "needs", "to", "retrieve", "private", "registry", "authentication", "data", "from", "ASM" ]
[ "func", "(", "c", "*", "Container", ")", "ShouldPullWithASMAuth", "(", ")", "bool", "{", "c", ".", "<mask>", ".", "RLock", "(", ")", "\n", "defer", "c", ".", "lock", ".", "RUnlock", "(", ")", "\n\n", "return", "c", ".", "RegistryAuthentication", "!=", "nil", "&&", "c", ".", "RegistryAuthentication", ".", "Type", "==", "AuthTypeASM", "&&", "c", ".", "RegistryAuthentication", ".", "ASMAuthData", "!=", "nil", "\n", "}" ]
272
all-273
[ "creates", "and", "initializes", "a", "buffer", "object", "s", "data", "store" ]
[ "func", "BufferData", "(", "<mask>", "uint32", ",", "size", "int", ",", "data", "unsafe", ".", "Pointer", ",", "usage", "uint32", ")", "{", "syscall", ".", "Syscall6", "(", "gpBufferData", ",", "4", ",", "uintptr", "(", "target", ")", ",", "uintptr", "(", "size", ")", ",", "uintptr", "(", "data", ")", ",", "uintptr", "(", "usage", ")", ",", "0", ",", "0", ")", "\n", "}" ]
273
all-274
[ "Fatal", "records", "the", "log", "with", "fatal", "level", "and", "exits" ]
[ "func", "(", "l", "*", "Logger", ")", "Fatal", "(", "args", "...", "interface", "{", "}", ")", "{", "l", ".", "Output", "(", "2", ",", "LevelFatal", ",", "fmt", ".", "Sprint", "(", "args", "...", ")", ")", "\n", "<mask>", ".", "Exit", "(", "1", ")", "\n", "}" ]
274
all-275
[ "encoding", "::", "=", "<", "(", "function", ")", "name", ">", "<bare", "-", "function", "-", "type", ">", "<", "(", "data", ")", "name", ">", "<special", "-", "name", ">" ]
[ "func", "(", "st", "*", "state", ")", "encoding", "(", "params", "bool", ",", "local", "forLocalNameType", ")", "AST", "{", "if", "len", "(", "st", ".", "str", ")", "<", "1", "{", "st", ".", "fail", "(", "\"", "\"", ")", "\n", "}", "\n\n", "if", "st", ".", "str", "[", "0", "]", "==", "'G'", "||", "st", ".", "str", "[", "0", "]", "==", "'T'", "{", "return", "st", ".", "specialName", "(", ")", "\n", "}", "\n\n", "a", ":=", "st", ".", "name", "(", ")", "\n", "a", "=", "simplify", "(", "a", ")", "\n\n", "if", "!", "params", "{", "// Don't demangle the parameters.", "// Strip CV-qualifiers, as they apply to the 'this'", "// parameter, and are not output by the standard", "// demangler without parameters.", "if", "mwq", ",", "ok", ":=", "a", ".", "(", "*", "MethodWithQualifiers", ")", ";", "<mask>", "{", "a", "=", "mwq", ".", "Method", "\n", "}", "\n\n", "// If this is a local name, there may be CV-qualifiers", "// on the name that really apply to the top level, and", "// therefore must be discarded when discarding", "// parameters. This can happen when parsing a class", "// that is local to a function.", "if", "q", ",", "ok", ":=", "a", ".", "(", "*", "Qualified", ")", ";", "ok", "&&", "q", ".", "LocalName", "{", "p", ":=", "&", "q", ".", "Name", "\n", "if", "da", ",", "ok", ":=", "(", "*", "p", ")", ".", "(", "*", "DefaultArg", ")", ";", "ok", "{", "p", "=", "&", "da", ".", "Arg", "\n", "}", "\n", "if", "mwq", ",", "ok", ":=", "(", "*", "p", ")", ".", "(", "*", "MethodWithQualifiers", ")", ";", "ok", "{", "*", "p", "=", "mwq", ".", "Method", "\n", "}", "\n", "}", "\n\n", "return", "a", "\n", "}", "\n\n", "if", "len", "(", "st", ".", "str", ")", "==", "0", "||", "st", ".", "str", "[", "0", "]", "==", "'E'", "{", "// There are no parameters--this is a data symbol, not", "// a function symbol.", "return", "a", "\n", "}", "\n\n", "check", ":=", "a", "\n", "mwq", ",", "_", ":=", "check", ".", "(", "*", "MethodWithQualifiers", ")", "\n", "if", "mwq", "!=", "nil", "{", "check", "=", "mwq", ".", "Method", "\n", "}", "\n", "template", ",", "_", ":=", "check", ".", "(", "*", "Template", ")", "\n", "if", "template", "!=", "nil", "{", "st", ".", "templates", "=", "append", "(", "st", ".", "templates", ",", "template", ")", "\n", "}", "\n\n", "ft", ":=", "st", ".", "bareFunctionType", "(", "hasReturnType", "(", "a", ")", ")", "\n\n", "if", "template", "!=", "nil", "{", "st", ".", "templates", "=", "st", ".", "templates", "[", ":", "len", "(", "st", ".", "templates", ")", "-", "1", "]", "\n", "}", "\n\n", "ft", "=", "simplify", "(", "ft", ")", "\n\n", "// For a local name, discard the return type, so that it", "// doesn't get confused with the top level return type.", "if", "local", "==", "forLocalName", "{", "if", "functype", ",", "ok", ":=", "ft", ".", "(", "*", "FunctionType", ")", ";", "ok", "{", "functype", ".", "Return", "=", "nil", "\n", "}", "\n", "}", "\n\n", "// Any top-level qualifiers belong to the function type.", "if", "mwq", "!=", "nil", "{", "a", "=", "mwq", ".", "Method", "\n", "mwq", ".", "Method", "=", "ft", "\n", "ft", "=", "mwq", "\n", "}", "\n", "if", "q", ",", "ok", ":=", "a", ".", "(", "*", "Qualified", ")", ";", "ok", "&&", "q", ".", "LocalName", "{", "p", ":=", "&", "q", ".", "Name", "\n", "if", "da", ",", "ok", ":=", "(", "*", "p", ")", ".", "(", "*", "DefaultArg", ")", ";", "ok", "{", "p", "=", "&", "da", ".", "Arg", "\n", "}", "\n", "if", "mwq", ",", "ok", ":=", "(", "*", "p", ")", ".", "(", "*", "MethodWithQualifiers", ")", ";", "ok", "{", "*", "p", "=", "mwq", ".", "Method", "\n", "mwq", ".", "Method", "=", "ft", "\n", "ft", "=", "mwq", "\n", "}", "\n", "}", "\n\n", "return", "&", "Typed", "{", "Name", ":", "a", ",", "Type", ":", "ft", "}", "\n", "}" ]
275
all-276
[ "GetIconName", "is", "a", "wrapper", "around", "gtk_tool_button_get_icon_name", "()", "." ]
[ "func", "(", "v", "*", "ToolButton", ")", "GetIconName", "(", ")", "<mask>", "{", "c", ":=", "C", ".", "gtk_tool_button_get_icon_name", "(", "v", ".", "native", "(", ")", ")", "\n", "return", "goString", "(", "c", ")", "\n", "}" ]
276
all-277
[ "PachdDeployment", "returns", "a", "pachd", "k8s", "Deployment", "." ]
[ "func", "PachdDeployment", "(", "opts", "*", "AssetOpts", ",", "objectStoreBackend", "backend", ",", "hostPath", "string", ")", "*", "apps", ".", "Deployment", "{", "// set port defaults", "if", "opts", ".", "PachdPort", "==", "0", "{", "opts", ".", "PachdPort", "=", "650", "\n", "}", "\n", "if", "opts", ".", "TracePort", "==", "0", "{", "opts", ".", "TracePort", "=", "651", "\n", "}", "\n", "if", "opts", ".", "HTTPPort", "==", "0", "{", "opts", ".", "HTTPPort", "=", "652", "\n", "}", "\n", "if", "opts", ".", "PeerPort", "==", "0", "{", "opts", ".", "PeerPort", "=", "653", "\n", "}", "\n", "mem", ":=", "resource", ".", "MustParse", "(", "opts", ".", "BlockCacheSize", ")", "\n", "mem", ".", "Add", "(", "resource", ".", "MustParse", "(", "opts", ".", "PachdNonCacheMemRequest", ")", ")", "\n", "cpu", ":=", "resource", ".", "MustParse", "(", "opts", ".", "PachdCPURequest", ")", "\n", "<mask>", ":=", "AddRegistry", "(", "opts", ".", "Registry", ",", "versionedPachdImage", "(", "opts", ")", ")", "\n", "volumes", ":=", "[", "]", "v1", ".", "Volume", "{", "{", "Name", ":", "\"", "\"", ",", "}", ",", "}", "\n", "volumeMounts", ":=", "[", "]", "v1", ".", "VolumeMount", "{", "{", "Name", ":", "\"", "\"", ",", "MountPath", ":", "\"", "\"", ",", "}", ",", "}", "\n\n", "// Set up storage options", "var", "backendEnvVar", "string", "\n", "var", "storageHostPath", "string", "\n", "switch", "objectStoreBackend", "{", "case", "localBackend", ":", "storageHostPath", "=", "filepath", ".", "Join", "(", "hostPath", ",", "\"", "\"", ")", "\n", "volumes", "[", "0", "]", ".", "HostPath", "=", "&", "v1", ".", "HostPathVolumeSource", "{", "Path", ":", "storageHostPath", ",", "}", "\n", "backendEnvVar", "=", "pfs", ".", "LocalBackendEnvVar", "\n", "case", "minioBackend", ":", "backendEnvVar", "=", "pfs", ".", "MinioBackendEnvVar", "\n", "case", "amazonBackend", ":", "backendEnvVar", "=", "pfs", ".", "AmazonBackendEnvVar", "\n", "case", "googleBackend", ":", "backendEnvVar", "=", "pfs", ".", "GoogleBackendEnvVar", "\n", "case", "microsoftBackend", ":", "backendEnvVar", "=", "pfs", ".", "MicrosoftBackendEnvVar", "\n", "}", "\n", "volume", ",", "mount", ":=", "GetBackendSecretVolumeAndMount", "(", "backendEnvVar", ")", "\n", "volumes", "=", "append", "(", "volumes", ",", "volume", ")", "\n", "volumeMounts", "=", "append", "(", "volumeMounts", ",", "mount", ")", "\n", "if", "opts", ".", "TLS", "!=", "nil", "{", "volumes", "=", "append", "(", "volumes", ",", "v1", ".", "Volume", "{", "Name", ":", "tlsVolumeName", ",", "VolumeSource", ":", "v1", ".", "VolumeSource", "{", "Secret", ":", "&", "v1", ".", "SecretVolumeSource", "{", "SecretName", ":", "tlsSecretName", ",", "}", ",", "}", ",", "}", ")", "\n", "volumeMounts", "=", "append", "(", "volumeMounts", ",", "v1", ".", "VolumeMount", "{", "Name", ":", "tlsVolumeName", ",", "MountPath", ":", "grpcutil", ".", "TLSVolumePath", ",", "}", ")", "\n", "}", "\n", "resourceRequirements", ":=", "v1", ".", "ResourceRequirements", "{", "Requests", ":", "v1", ".", "ResourceList", "{", "v1", ".", "ResourceCPU", ":", "cpu", ",", "v1", ".", "ResourceMemory", ":", "mem", ",", "}", ",", "}", "\n", "if", "!", "opts", ".", "NoGuaranteed", "{", "resourceRequirements", ".", "Limits", "=", "v1", ".", "ResourceList", "{", "v1", ".", "ResourceCPU", ":", "cpu", ",", "v1", ".", "ResourceMemory", ":", "mem", ",", "}", "\n", "}", "\n", "return", "&", "apps", ".", "Deployment", "{", "TypeMeta", ":", "metav1", ".", "TypeMeta", "{", "Kind", ":", "\"", "\"", ",", "APIVersion", ":", "\"", "\"", ",", "}", ",", "ObjectMeta", ":", "objectMeta", "(", "pachdName", ",", "labels", "(", "pachdName", ")", ",", "nil", ",", "opts", ".", "Namespace", ")", ",", "Spec", ":", "apps", ".", "DeploymentSpec", "{", "Replicas", ":", "replicas", "(", "1", ")", ",", "Selector", ":", "&", "metav1", ".", "LabelSelector", "{", "MatchLabels", ":", "labels", "(", "pachdName", ")", ",", "}", ",", "Template", ":", "v1", ".", "PodTemplateSpec", "{", "ObjectMeta", ":", "objectMeta", "(", "pachdName", ",", "labels", "(", "pachdName", ")", ",", "map", "[", "string", "]", "string", "{", "IAMAnnotation", ":", "opts", ".", "IAMRole", "}", ",", "opts", ".", "Namespace", ")", ",", "Spec", ":", "v1", ".", "PodSpec", "{", "Containers", ":", "[", "]", "v1", ".", "Container", "{", "{", "Name", ":", "pachdName", ",", "Image", ":", "image", ",", "Env", ":", "append", "(", "[", "]", "v1", ".", "EnvVar", "{", "{", "Name", ":", "\"", "\"", ",", "Value", ":", "\"", "\"", "}", ",", "{", "Name", ":", "\"", "\"", ",", "Value", ":", "opts", ".", "EtcdPrefix", "}", ",", "{", "Name", ":", "\"", "\"", ",", "Value", ":", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "opts", ".", "PachdShards", ")", "}", ",", "{", "Name", ":", "\"", "\"", ",", "Value", ":", "backendEnvVar", "}", ",", "{", "Name", ":", "\"", "\"", ",", "Value", ":", "storageHostPath", "}", ",", "{", "Name", ":", "\"", "\"", ",", "Value", ":", "AddRegistry", "(", "opts", ".", "Registry", ",", "versionedWorkerImage", "(", "opts", ")", ")", "}", ",", "{", "Name", ":", "\"", "\"", ",", "Value", ":", "opts", ".", "ImagePullSecret", "}", ",", "{", "Name", ":", "\"", "\"", ",", "Value", ":", "image", "}", ",", "{", "Name", ":", "\"", "\"", ",", "Value", ":", "\"", "\"", "}", ",", "{", "Name", ":", "\"", "\"", ",", "Value", ":", "opts", ".", "Version", "}", ",", "{", "Name", ":", "\"", "\"", ",", "Value", ":", "strconv", ".", "FormatBool", "(", "opts", ".", "Metrics", ")", "}", ",", "{", "Name", ":", "\"", "\"", ",", "Value", ":", "opts", ".", "LogLevel", "}", ",", "{", "Name", ":", "\"", "\"", ",", "Value", ":", "opts", ".", "BlockCacheSize", "}", ",", "{", "Name", ":", "\"", "\"", ",", "Value", ":", "opts", ".", "IAMRole", "}", ",", "{", "Name", ":", "\"", "\"", ",", "Value", ":", "strconv", ".", "FormatBool", "(", "opts", ".", "NoExposeDockerSocket", ")", "}", ",", "{", "Name", ":", "auth", ".", "DisableAuthenticationEnvVar", ",", "Value", ":", "strconv", ".", "FormatBool", "(", "opts", ".", "DisableAuthentication", ")", "}", ",", "{", "Name", ":", "\"", "\"", ",", "ValueFrom", ":", "&", "v1", ".", "EnvVarSource", "{", "FieldRef", ":", "&", "v1", ".", "ObjectFieldSelector", "{", "APIVersion", ":", "\"", "\"", ",", "FieldPath", ":", "\"", "\"", ",", "}", ",", "}", ",", "}", ",", "{", "Name", ":", "\"", "\"", ",", "ValueFrom", ":", "&", "v1", ".", "EnvVarSource", "{", "ResourceFieldRef", ":", "&", "v1", ".", "ResourceFieldSelector", "{", "ContainerName", ":", "\"", "\"", ",", "Resource", ":", "\"", "\"", ",", "}", ",", "}", ",", "}", ",", "{", "Name", ":", "\"", "\"", ",", "Value", ":", "strconv", ".", "FormatBool", "(", "opts", ".", "ExposeObjectAPI", ")", "}", ",", "}", ",", "GetSecretEnvVars", "(", "\"", "\"", ")", "...", ")", ",", "Ports", ":", "[", "]", "v1", ".", "ContainerPort", "{", "{", "ContainerPort", ":", "opts", ".", "PachdPort", ",", "// also set in cmd/pachd/main.go", "Protocol", ":", "\"", "\"", ",", "Name", ":", "\"", "\"", ",", "}", ",", "{", "ContainerPort", ":", "opts", ".", "TracePort", ",", "// also set in cmd/pachd/main.go", "Name", ":", "\"", "\"", ",", "}", ",", "{", "ContainerPort", ":", "opts", ".", "HTTPPort", ",", "// also set in cmd/pachd/main.go", "Protocol", ":", "\"", "\"", ",", "Name", ":", "\"", "\"", ",", "}", ",", "{", "ContainerPort", ":", "opts", ".", "PeerPort", ",", "// also set in cmd/pachd/main.go", "Protocol", ":", "\"", "\"", ",", "Name", ":", "\"", "\"", ",", "}", ",", "{", "ContainerPort", ":", "githook", ".", "GitHookPort", ",", "Protocol", ":", "\"", "\"", ",", "Name", ":", "\"", "\"", ",", "}", ",", "{", "ContainerPort", ":", "auth", ".", "SamlPort", ",", "Protocol", ":", "\"", "\"", ",", "Name", ":", "\"", "\"", ",", "}", ",", "}", ",", "VolumeMounts", ":", "volumeMounts", ",", "ImagePullPolicy", ":", "\"", "\"", ",", "Resources", ":", "resourceRequirements", ",", "ReadinessProbe", ":", "&", "v1", ".", "Probe", "{", "Handler", ":", "v1", ".", "Handler", "{", "Exec", ":", "&", "v1", ".", "ExecAction", "{", "Command", ":", "[", "]", "string", "{", "\"", "\"", ",", "\"", "\"", "}", ",", "}", ",", "}", ",", "}", ",", "}", ",", "}", ",", "ServiceAccountName", ":", "ServiceAccountName", ",", "Volumes", ":", "volumes", ",", "ImagePullSecrets", ":", "imagePullSecrets", "(", "opts", ")", ",", "}", ",", "}", ",", "}", ",", "}", "\n", "}" ]
277
all-278
[ "filterRecordsForPlan", "removes", "records", "that", "are", "not", "relevant", "to", "the", "planner", ".", "Currently", "this", "just", "removes", "TXT", "records", "to", "prevent", "them", "from", "being", "deleted", "erroneously", "by", "the", "planner", "(", "only", "the", "TXT", "registry", "should", "do", "this", ".", ")", "Per", "RFC", "1034", "CNAME", "records", "conflict", "with", "all", "other", "records", "-", "it", "is", "the", "only", "record", "with", "this", "property", ".", "The", "behavior", "of", "the", "planner", "may", "need", "to", "be", "made", "more", "sophisticated", "to", "codify", "this", "." ]
[ "func", "filterRecordsForPlan", "(", "records", "[", "]", "*", "endpoint", ".", "Endpoint", ")", "[", "]", "*", "endpoint", ".", "Endpoint", "{", "filtered", ":=", "[", "]", "*", "endpoint", ".", "Endpoint", "{", "}", "\n\n", "for", "_", ",", "record", ":=", "<mask>", "records", "{", "// Explicitly specify which records we want to use for planning.", "// TODO: Add AAAA records as well when they are supported.", "switch", "record", ".", "RecordType", "{", "case", "endpoint", ".", "RecordTypeA", ",", "endpoint", ".", "RecordTypeCNAME", ":", "filtered", "=", "append", "(", "filtered", ",", "record", ")", "\n", "default", ":", "continue", "\n", "}", "\n", "}", "\n\n", "return", "filtered", "\n", "}" ]
278
all-279
[ "NewPatternFromRGBA", "is", "a", "wrapper", "around", "cairo_pattern_create_rgba", "()", "." ]
[ "func", "NewPatternFromRGBA", "(", "red", ",", "green", ",", "blue", ",", "alpha", "float64", ")", "(", "*", "Pattern", ",", "error", ")", "{", "c", ":=", "C", ".", "cairo_pattern_create_rgba", "(", "C", ".", "double", "(", "red", ")", ",", "C", ".", "double", "(", "green", ")", ",", "C", ".", "double", "(", "blue", ")", ",", "C", ".", "double", "(", "<mask>", ")", ")", "\n", "return", "newPatternFromNative", "(", "c", ")", "\n", "}" ]
279
all-280
[ "List", "lists", "all", "ProwJobs", "in", "the", "indexer", "." ]
[ "func", "(", "s", "*", "prowJobLister", ")", "List", "(", "selector", "labels", ".", "Selector", ")", "(", "<mask>", "[", "]", "*", "v1", ".", "ProwJob", ",", "err", "error", ")", "{", "err", "=", "cache", ".", "ListAll", "(", "s", ".", "indexer", ",", "selector", ",", "func", "(", "m", "interface", "{", "}", ")", "{", "ret", "=", "append", "(", "ret", ",", "m", ".", "(", "*", "v1", ".", "ProwJob", ")", ")", "\n", "}", ")", "\n", "return", "ret", ",", "err", "\n", "}" ]
280
all-281
[ "simulateLF", "simulates", "a", "LF", "or", "CR", "+", "LF", "by", "scrolling", "if", "necessary", "to", "handle", "the", "current", "cursor", "position", "and", "scroll", "region", "settings", "in", "which", "case", "it", "returns", "true", ".", "If", "no", "special", "handling", "is", "necessary", "then", "it", "does", "nothing", "and", "returns", "false", ".", "In", "the", "false", "case", "the", "caller", "should", "ensure", "that", "a", "carriage", "return", "and", "line", "feed", "are", "inserted", "or", "that", "the", "text", "is", "otherwise", "wrapped", "." ]
[ "func", "(", "h", "*", "windowsAnsiEventHandler", ")", "simulateLF", "(", "includeCR", "bool", ")", "(", "bool", ",", "error", ")", "{", "if", "h", ".", "wrapNext", "{", "if", "err", ":=", "h", ".", "Flush", "(", ")", ";", "err", "!=", "nil", "{", "return", "false", ",", "err", "\n", "}", "\n", "h", ".", "clearWrap", "(", ")", "\n", "}", "\n", "pos", ",", "info", ",", "err", ":=", "h", ".", "getCurrentInfo", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "false", ",", "err", "\n", "}", "\n", "sr", ":=", "h", ".", "effectiveSr", "(", "info", ".", "Window", ")", "\n", "if", "pos", ".", "Y", "==", "sr", ".", "bottom", "{", "// Scrolling is necessary. Let Windows automatically scroll if the scrolling region", "// is the full window.", "if", "sr", ".", "top", "==", "info", ".", "Window", ".", "Top", "&&", "sr", ".", "bottom", "==", "info", ".", "Window", ".", "Bottom", "{", "if", "includeCR", "{", "pos", ".", "X", "=", "0", "\n", "h", ".", "updatePos", "(", "pos", ")", "\n", "}", "\n", "return", "false", ",", "nil", "\n", "}", "\n\n", "// A custom scroll region is active. Scroll the window manually to simulate", "// the LF.", "if", "err", ":=", "h", ".", "Flush", "(", ")", ";", "err", "!=", "nil", "{", "return", "false", ",", "err", "\n", "}", "\n", "h", ".", "logf", "(", "\"", "\"", ")", "\n", "if", "err", ":=", "h", ".", "scrollUp", "(", "1", ")", ";", "err", "!=", "nil", "{", "return", "false", ",", "err", "\n", "}", "\n", "if", "includeCR", "{", "pos", ".", "X", "=", "0", "\n", "if", "err", ":=", "SetConsoleCursorPosition", "(", "h", ".", "fd", ",", "pos", ")", ";", "err", "!=", "nil", "{", "return", "false", ",", "err", "\n", "}", "\n", "}", "\n", "return", "true", ",", "nil", "\n\n", "}", "else", "if", "pos", ".", "Y", "<", "info", ".", "Window", ".", "Bottom", "{", "// Let Windows handle the LF.", "pos", ".", "Y", "++", "\n", "if", "includeCR", "{", "<mask>", ".", "X", "=", "0", "\n", "}", "\n", "h", ".", "updatePos", "(", "pos", ")", "\n", "return", "false", ",", "nil", "\n", "}", "else", "{", "// The cursor is at the bottom of the screen but outside the scroll", "// region. Skip the LF.", "h", ".", "logf", "(", "\"", "\"", ")", "\n", "if", "includeCR", "{", "if", "err", ":=", "h", ".", "Flush", "(", ")", ";", "err", "!=", "nil", "{", "return", "false", ",", "err", "\n", "}", "\n", "pos", ".", "X", "=", "0", "\n", "if", "err", ":=", "SetConsoleCursorPosition", "(", "h", ".", "fd", ",", "pos", ")", ";", "err", "!=", "nil", "{", "return", "false", ",", "err", "\n", "}", "\n", "}", "\n", "return", "true", ",", "nil", "\n", "}", "\n", "}" ]
281
all-282
[ "Copy", "an", "lvm", "container", "." ]
[ "func", "(", "s", "*", "storageLvm", ")", "copyContainer", "(", "target", "<mask>", ",", "source", "container", ",", "refresh", "bool", ")", "error", "{", "targetPool", ",", "err", ":=", "target", ".", "StoragePool", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "targetContainerMntPoint", ":=", "getContainerMountPoint", "(", "target", ".", "Project", "(", ")", ",", "targetPool", ",", "target", ".", "Name", "(", ")", ")", "\n", "err", "=", "createContainerMountpoint", "(", "targetContainerMntPoint", ",", "target", ".", "Path", "(", ")", ",", "target", ".", "IsPrivileged", "(", ")", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "sourcePool", ",", "err", ":=", "source", ".", "StoragePool", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "if", "s", ".", "useThinpool", "&&", "targetPool", "==", "sourcePool", "&&", "!", "refresh", "{", "// If the storage pool uses a thinpool we can have snapshots of", "// snapshots.", "err", "=", "s", ".", "copyContainerThinpool", "(", "target", ",", "source", ",", "false", ")", "\n", "}", "else", "{", "// If the storage pools does not use a thinpool we need to", "// perform full copies.", "err", "=", "s", ".", "copyContainerLv", "(", "target", ",", "source", ",", "false", ",", "refresh", ")", "\n", "}", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "err", "=", "target", ".", "TemplateApply", "(", "\"", "\"", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "return", "nil", "\n", "}" ]
282
all-283
[ "ListenAndServeTLSEmbed", "serves", "HTTPS", "requests", "from", "the", "given", "TCP4", "addr", ".", "certData", "and", "keyData", "must", "contain", "valid", "TLS", "certificate", "and", "key", "data", ".", "Pass", "custom", "listener", "to", "Serve", "if", "you", "need", "listening", "on", "arbitrary", "media", "such", "as", "IPv6", ".", "If", "the", "certFile", "or", "keyFile", "has", "not", "been", "provided", "the", "server", "structure", "the", "function", "will", "use", "previously", "added", "TLS", "configuration", ".", "Accepted", "connections", "are", "configured", "to", "enable", "TCP", "keep", "-", "alives", "." ]
[ "func", "(", "s", "*", "Server", ")", "ListenAndServeTLSEmbed", "(", "addr", "string", ",", "certData", ",", "keyData", "[", "]", "byte", ")", "error", "{", "ln", ",", "err", ":=", "<mask>", ".", "Listen", "(", "\"", "\"", ",", "addr", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "if", "s", ".", "TCPKeepalive", "{", "if", "tcpln", ",", "ok", ":=", "ln", ".", "(", "*", "net", ".", "TCPListener", ")", ";", "ok", "{", "return", "s", ".", "ServeTLSEmbed", "(", "tcpKeepaliveListener", "{", "TCPListener", ":", "tcpln", ",", "keepalivePeriod", ":", "s", ".", "TCPKeepalivePeriod", ",", "}", ",", "certData", ",", "keyData", ")", "\n", "}", "\n", "}", "\n", "return", "s", ".", "ServeTLSEmbed", "(", "ln", ",", "certData", ",", "keyData", ")", "\n", "}" ]
283
all-284
[ "Move", "a", "container", "using", "special", "POST", "/", "containers", "/", "<name", ">", "?target", "=", "<member", ">", "API", "." ]
[ "func", "moveClusterContainer", "(", "conf", "*", "config", ".", "Config", ",", "sourceResource", ",", "destResource", ",", "target", "string", ")", "error", "{", "// Parse the source.", "sourceRemote", ",", "sourceName", ",", "err", ":=", "conf", ".", "ParseRemote", "(", "sourceResource", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "// Parse the destination.", "_", ",", "destName", ",", "err", ":=", "conf", ".", "ParseRemote", "(", "destResource", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "// Make sure we have a container or snapshot name.", "if", "sourceName", "==", "\"", "\"", "{", "return", "fmt", ".", "Errorf", "(", "i18n", ".", "G", "(", "\"", "\"", ")", ")", "\n", "}", "\n\n", "// The destination name is optional.", "if", "destName", "==", "\"", "\"", "{", "destName", "=", "sourceName", "\n", "}", "\n\n", "// Connect to the source host", "source", ",", "err", ":=", "conf", ".", "GetContainerServer", "(", "sourceRemote", ")", "\n", "if", "err", "!=", "nil", "{", "return", "errors", ".", "Wrap", "(", "err", ",", "i18n", ".", "G", "(", "\"", "\"", ")", ")", "\n", "}", "\n\n", "// Check that it's a cluster", "if", "!", "source", ".", "IsClustered", "(", ")", "{", "return", "fmt", ".", "Errorf", "(", "i18n", ".", "G", "(", "\"", "\"", ")", ")", "\n", "}", "\n\n", "// The migrate API will do the right thing when passed a target.", "source", "=", "source", ".", "UseTarget", "(", "target", ")", "\n", "req", ":=", "api", ".", "ContainerPost", "{", "Name", ":", "destName", ",", "Migration", ":", "true", "}", "\n", "op", ",", "err", ":=", "<mask>", ".", "MigrateContainer", "(", "sourceName", ",", "req", ")", "\n", "if", "err", "!=", "nil", "{", "return", "errors", ".", "Wrap", "(", "err", ",", "i18n", ".", "G", "(", "\"", "\"", ")", ")", "\n", "}", "\n\n", "err", "=", "op", ".", "Wait", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "errors", ".", "Wrap", "(", "err", ",", "i18n", ".", "G", "(", "\"", "\"", ")", ")", "\n", "}", "\n\n", "return", "nil", "\n", "}" ]
284
all-285
[ "GetPrivateKeyOk", "returns", "a", "tuple", "with", "the", "PrivateKey", "field", "if", "it", "s", "non", "-", "nil", "zero", "value", "otherwise", "and", "a", "boolean", "to", "check", "if", "the", "value", "has", "been", "set", "." ]
[ "func", "(", "i", "*", "IntegrationGCPCreateRequest", ")", "GetPrivateKeyOk", "(", ")", "(", "string", ",", "bool", ")", "{", "if", "i", "==", "nil", "||", "i", ".", "PrivateKey", "==", "nil", "{", "return", "\"", "\"", ",", "<mask>", "\n", "}", "\n", "return", "*", "i", ".", "PrivateKey", ",", "true", "\n", "}" ]
285
all-286
[ "SetShowDefault", "()", "is", "a", "wrapper", "around", "gtk_app_chooser_widget_set_show_default", "()", "." ]
[ "func", "(", "v", "*", "AppChooserWidget", ")", "SetShowDefault", "(", "<mask>", "bool", ")", "{", "C", ".", "gtk_app_chooser_widget_set_show_default", "(", "v", ".", "native", "(", ")", ",", "gbool", "(", "setting", ")", ")", "\n", "}" ]
286
all-287
[ "ForwardedOperationResponse", "creates", "a", "response", "that", "forwards", "the", "metadata", "of", "an", "operation", "created", "on", "another", "node", "." ]
[ "func", "ForwardedOperationResponse", "(", "project", "string", ",", "op", "*", "api", ".", "Operation", ")", "Response", "{", "return", "&", "forwardedOperationResponse", "{", "op", ":", "op", ",", "<mask>", ":", "project", ",", "}", "\n", "}" ]
287
all-288
[ "ClearData", "removes", "all", "bar", "from", "chart" ]
[ "func", "(", "b", "*", "BarChart", ")", "ClearData", "(", ")", "{", "b", ".", "mtx", ".", "Lock", "(", ")", "\n", "defer", "b", ".", "mtx", ".", "Unlock", "(", ")", "\n\n", "b", ".", "<mask>", "=", "make", "(", "[", "]", "BarData", ",", "0", ")", "\n", "}" ]
288
all-289
[ "UnmarshalJSON", "supports", "json", ".", "Unmarshaler", "interface" ]
[ "func", "(", "v", "*", "SetBreakpointParams", ")", "UnmarshalJSON", "(", "data", "[", "]", "byte", ")", "error", "{", "r", ":=", "jlexer", ".", "Lexer", "{", "Data", ":", "data", "}", "\n", "easyjsonC5a4559bDecodeGithubComChromedpCdprotoDebugger11", "(", "&", "r", ",", "v", ")", "\n", "return", "r", ".", "<mask>", "(", ")", "\n", "}" ]
289
all-290
[ "Stability", ":", "***", "EXPERIMENTAL", "***", "Add", "the", "given", "address", "to", "the", "notification", "denylist", ".", "The", "address", "can", "be", "of", "either", "of", "the", "three", "supported", "address", "type", "namely", "pulse", "email", "or", "IRC", "(", "user", "or", "channel", ")", ".", "Addresses", "in", "the", "denylist", "will", "be", "ignored", "by", "the", "notification", "service", ".", "Required", "scopes", ":", "notify", ":", "manage", "-", "denylist", "See", "#addDenylistAddress" ]
[ "func", "(", "notify", "*", "Notify", ")", "AddDenylistAddress", "(", "payload", "*", "NotificationTypeAndAddress", ")", "error", "{", "<mask>", ":=", "tcclient", ".", "Client", "(", "*", "notify", ")", "\n", "_", ",", "_", ",", "err", ":=", "(", "&", "cd", ")", ".", "APICall", "(", "payload", ",", "\"", "\"", ",", "\"", "\"", ",", "nil", ",", "nil", ")", "\n", "return", "err", "\n", "}" ]
290
all-291
[ "Do", "executes", "CacheStorage", ".", "deleteCache", "against", "the", "provided", "context", "." ]
[ "func", "(", "p", "*", "DeleteCacheParams", ")", "Do", "(", "ctx", "<mask>", ".", "Context", ")", "(", "err", "error", ")", "{", "return", "cdp", ".", "Execute", "(", "ctx", ",", "CommandDeleteCache", ",", "p", ",", "nil", ")", "\n", "}" ]
291
all-292
[ "signature", "computes", "and", "returns", "signature", "." ]
[ "func", "signature", "(", "key", "*", "ecdsa", ".", "PrivateKey", ",", "msg", "[", "]", "byte", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "hash", ":=", "ethcrypto", ".", "Keccak256", "(", "msg", ")", "\n", "sig", ",", "err", ":=", "ethcrypto", ".", "Sign", "(", "<mask>", ",", "key", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "sig", "=", "sig", "[", ":", "len", "(", "sig", ")", "-", "1", "]", "\n", "return", "sig", ",", "nil", "\n", "}" ]
292
all-293
[ "Import", "takes", "a", "json", "byte", "array", "and", "inserts", "the", "key", "value", "pairs", "into", "consul", "prefixed", "by", "the", "namespace" ]
[ "func", "(", "c", "*", "cachedLoader", ")", "Import", "(", "data", "[", "]", "byte", ")", "error", "{", "conf", ":=", "make", "(", "map", "[", "string", "]", "interface", "{", "}", ")", "\n", "err", ":=", "json", ".", "Unmarshal", "(", "data", ",", "&", "conf", ")", "\n", "if", "err", "!=", "nil", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "err", ")", "\n", "}", "\n", "kvMap", ",", "err", ":=", "c", ".", "compileKeyValues", "(", "conf", ",", "c", ".", "namespace", ")", "\n", "if", "err", "!=", "nil", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "err", ")", "\n", "}", "\n\n", "if", "err", "!=", "nil", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "err", ")", "\n", "}", "\n", "for", "k", ",", "v", ":=", "range", "kvMap", "{", "p", ":=", "&", "api", ".", "KVPair", "{", "<mask>", ":", "k", ",", "Value", ":", "v", "}", "\n", "_", ",", "err", "=", "c", ".", "consulKV", ".", "Put", "(", "p", ",", "nil", ")", "\n", "if", "err", "!=", "nil", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "k", ",", "v", ",", "err", ")", "\n", "}", "\n", "}", "\n", "return", "nil", "\n", "}" ]
293
all-294
[ "AddItem", "is", "a", "wrapper", "around", "gtk_recent_manager_add_item", "()", "." ]
[ "func", "(", "v", "*", "RecentManager", ")", "AddItem", "(", "fileURI", "string", ")", "bool", "{", "cstr", ":=", "C", ".", "CString", "(", "fileURI", ")", "\n", "defer", "C", ".", "<mask>", "(", "unsafe", ".", "Pointer", "(", "cstr", ")", ")", "\n", "cok", ":=", "C", ".", "gtk_recent_manager_add_item", "(", "v", ".", "native", "(", ")", ",", "(", "*", "C", ".", "gchar", ")", "(", "cstr", ")", ")", "\n", "return", "gobool", "(", "cok", ")", "\n", "}" ]
294
all-295
[ "datacenterPathFromHostSystemID", "returns", "the", "datacenter", "section", "of", "a", "HostSystem", "s", "inventory", "path", "." ]
[ "func", "datacenterPathFromHostSystemID", "(", "<mask>", "*", "govmomi", ".", "Client", ",", "hsID", "string", ")", "(", "string", ",", "error", ")", "{", "hs", ",", "err", ":=", "hostsystem", ".", "FromID", "(", "client", ",", "hsID", ")", "\n", "if", "err", "!=", "nil", "{", "return", "\"", "\"", ",", "err", "\n", "}", "\n", "return", "RootPathParticleHost", ".", "SplitDatacenter", "(", "hs", ".", "InventoryPath", ")", "\n", "}" ]
295
all-296
[ "SubscribeChan", "sends", "all", "events", "to", "the", "provided", "channel" ]
[ "func", "(", "c", "*", "Client", ")", "SubscribeChan", "(", "stream", "string", ",", "ch", "chan", "*", "Event", ")", "error", "{", "var", "connected", "bool", "\n", "errch", ":=", "make", "(", "chan", "error", ")", "\n", "c", ".", "mu", ".", "Lock", "(", ")", "\n", "c", ".", "subscribed", "[", "ch", "]", "=", "make", "(", "chan", "bool", ")", "\n", "c", ".", "mu", ".", "Unlock", "(", ")", "\n\n", "go", "func", "(", ")", "{", "operation", ":=", "func", "(", ")", "error", "{", "resp", ",", "err", ":=", "c", ".", "request", "(", "stream", ")", "\n", "if", "err", "!=", "nil", "{", "c", ".", "cleanup", "(", "resp", ",", "ch", ")", "\n", "return", "err", "\n", "}", "\n\n", "if", "resp", ".", "StatusCode", "!=", "200", "{", "c", ".", "cleanup", "(", "resp", ",", "ch", ")", "\n", "return", "errors", ".", "New", "(", "\"", "\"", ")", "\n", "}", "\n\n", "if", "!", "connected", "{", "errch", "<-", "nil", "\n", "connected", "=", "true", "\n", "}", "\n\n", "<mask>", ":=", "NewEventStreamReader", "(", "resp", ".", "Body", ")", "\n\n", "for", "{", "// Read each new line and process the type of event", "event", ",", "err", ":=", "reader", ".", "ReadEvent", "(", ")", "\n", "if", "err", "!=", "nil", "{", "if", "err", "==", "io", ".", "EOF", "{", "c", ".", "cleanup", "(", "resp", ",", "ch", ")", "\n", "return", "nil", "\n", "}", "\n\n", "// run user specified disconnect function", "if", "c", ".", "disconnectcb", "!=", "nil", "{", "c", ".", "disconnectcb", "(", "c", ")", "\n", "}", "\n\n", "return", "err", "\n", "}", "\n\n", "// If we get an error, ignore it.", "if", "msg", ",", "err", ":=", "c", ".", "processEvent", "(", "event", ")", ";", "err", "==", "nil", "{", "if", "len", "(", "msg", ".", "ID", ")", ">", "0", "{", "c", ".", "EventID", "=", "string", "(", "msg", ".", "ID", ")", "\n", "}", "else", "{", "msg", ".", "ID", "=", "[", "]", "byte", "(", "c", ".", "EventID", ")", "\n", "}", "\n\n", "select", "{", "case", "<-", "c", ".", "subscribed", "[", "ch", "]", ":", "c", ".", "cleanup", "(", "resp", ",", "ch", ")", "\n", "return", "nil", "\n", "case", "ch", "<-", "msg", ":", "// message sent", "}", "\n", "}", "\n", "}", "\n", "}", "\n\n", "err", ":=", "backoff", ".", "Retry", "(", "operation", ",", "backoff", ".", "NewExponentialBackOff", "(", ")", ")", "\n", "if", "err", "!=", "nil", "&&", "!", "connected", "{", "errch", "<-", "err", "\n", "}", "\n", "}", "(", ")", "\n", "err", ":=", "<-", "errch", "\n", "close", "(", "errch", ")", "\n\n", "return", "err", "\n", "}" ]
296
all-297
[ "WithArguments", "call", "arguments", ".", "All", "call", "arguments", "must", "belong", "to", "the", "same", "JavaScript", "world", "as", "the", "target", "object", "." ]
[ "func", "(", "p", "CallFunctionOnParams", ")", "WithArguments", "(", "arguments", "[", "]", "*", "CallArgument", ")", "*", "CallFunctionOnParams", "{", "p", ".", "Arguments", "=", "arguments", "\n", "<mask>", "&", "p", "\n", "}" ]
297
all-298
[ "DetachCDDVD", "detaches", "a", "CD", "/", "DVD", "device", "from", "the", "virtual", "machine", "." ]
[ "func", "(", "v", "*", "VM", ")", "DetachCDDVD", "(", "drive", "*", "CDDVDDrive", ")", "error", "{", "if", "running", ",", "_", ":=", "v", ".", "IsRunning", "(", ")", ";", "running", "{", "return", "&", "Error", "{", "Operation", ":", "\"", "\"", ",", "Code", ":", "200002", ",", "Text", ":", "\"", "\"", ",", "}", "\n", "}", "\n\n", "// Loads VMX file in memory", "err", ":=", "v", ".", "vmxfile", ".", "Read", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "model", ":=", "v", ".", "vmxfile", ".", "model", "\n\n", "switch", "drive", ".", "Bus", "{", "case", "vmx", ".", "IDE", ":", "for", "i", ",", "device", ":=", "range", "model", ".", "IDEDevices", "{", "if", "drive", ".", "ID", "==", "device", ".", "VMXID", "{", "// This method of removing the element avoids memory leaks", "copy", "(", "model", ".", "IDEDevices", "[", "i", ":", "]", ",", "model", ".", "IDEDevices", "[", "i", "+", "1", ":", "]", ")", "\n", "model", ".", "IDEDevices", "[", "len", "(", "model", ".", "IDEDevices", ")", "-", "1", "]", "=", "vmx", ".", "IDEDevice", "{", "}", "\n", "model", ".", "IDEDevices", "=", "model", ".", "IDEDevices", "[", ":", "len", "(", "model", ".", "IDEDevices", ")", "-", "1", "]", "\n", "}", "\n", "}", "\n", "case", "vmx", ".", "SCSI", ":", "for", "i", ",", "device", ":=", "range", "model", ".", "SCSIDevices", "{", "if", "drive", ".", "<mask>", "==", "device", ".", "VMXID", "{", "copy", "(", "model", ".", "SCSIDevices", "[", "i", ":", "]", ",", "model", ".", "SCSIDevices", "[", "i", "+", "1", ":", "]", ")", "\n", "model", ".", "SCSIDevices", "[", "len", "(", "model", ".", "SCSIDevices", ")", "-", "1", "]", "=", "vmx", ".", "SCSIDevice", "{", "}", "\n", "model", ".", "SCSIDevices", "=", "model", ".", "SCSIDevices", "[", ":", "len", "(", "model", ".", "SCSIDevices", ")", "-", "1", "]", "\n", "}", "\n", "}", "\n", "case", "vmx", ".", "SATA", ":", "for", "i", ",", "device", ":=", "range", "model", ".", "SATADevices", "{", "if", "drive", ".", "ID", "==", "device", ".", "VMXID", "{", "copy", "(", "model", ".", "SATADevices", "[", "i", ":", "]", ",", "model", ".", "SATADevices", "[", "i", "+", "1", ":", "]", ")", "\n", "model", ".", "SATADevices", "[", "len", "(", "model", ".", "SATADevices", ")", "-", "1", "]", "=", "vmx", ".", "SATADevice", "{", "}", "\n", "model", ".", "SATADevices", "=", "model", ".", "SATADevices", "[", ":", "len", "(", "model", ".", "SATADevices", ")", "-", "1", "]", "\n", "}", "\n", "}", "\n", "default", ":", "return", "&", "Error", "{", "Operation", ":", "\"", "\"", ",", "Code", ":", "200003", ",", "Text", ":", "fmt", ".", "Sprintf", "(", "\"", "\\n", "\"", ",", "drive", ".", "Bus", ")", ",", "}", "\n", "}", "\n\n", "return", "v", ".", "vmxfile", ".", "Write", "(", ")", "\n", "}" ]
298
all-299
[ "NewNode", "returns", "a", "new", "node", "discovery", "." ]
[ "func", "NewNode", "(", "l", "log", ".", "Logger", ",", "inf", "<mask>", ".", "SharedInformer", ")", "*", "Node", "{", "if", "l", "==", "nil", "{", "l", "=", "log", ".", "NewNopLogger", "(", ")", "\n", "}", "\n", "n", ":=", "&", "Node", "{", "logger", ":", "l", ",", "informer", ":", "inf", ",", "store", ":", "inf", ".", "GetStore", "(", ")", ",", "queue", ":", "workqueue", ".", "NewNamed", "(", "\"", "\"", ")", "}", "\n", "n", ".", "informer", ".", "AddEventHandler", "(", "cache", ".", "ResourceEventHandlerFuncs", "{", "AddFunc", ":", "func", "(", "o", "interface", "{", "}", ")", "{", "eventCount", ".", "WithLabelValues", "(", "\"", "\"", ",", "\"", "\"", ")", ".", "Inc", "(", ")", "\n", "n", ".", "enqueue", "(", "o", ")", "\n", "}", ",", "DeleteFunc", ":", "func", "(", "o", "interface", "{", "}", ")", "{", "eventCount", ".", "WithLabelValues", "(", "\"", "\"", ",", "\"", "\"", ")", ".", "Inc", "(", ")", "\n", "n", ".", "enqueue", "(", "o", ")", "\n", "}", ",", "UpdateFunc", ":", "func", "(", "_", ",", "o", "interface", "{", "}", ")", "{", "eventCount", ".", "WithLabelValues", "(", "\"", "\"", ",", "\"", "\"", ")", ".", "Inc", "(", ")", "\n", "n", ".", "enqueue", "(", "o", ")", "\n", "}", ",", "}", ")", "\n", "return", "n", "\n", "}" ]
299
all-300
[ "GetTitleAlign", "returns", "the", "TitleAlign", "field", "if", "non", "-", "nil", "zero", "value", "otherwise", "." ]
[ "func", "(", "d", "*", "DistributionDefinition", ")", "GetTitleAlign", "(", ")", "<mask>", "{", "if", "d", "==", "nil", "||", "d", ".", "TitleAlign", "==", "nil", "{", "return", "\"", "\"", "\n", "}", "\n", "return", "*", "d", ".", "TitleAlign", "\n", "}" ]