id
int32
0
25.3k
idx
stringlengths
5
9
nl_tokens
listlengths
1
418
pl_tokens
listlengths
22
4.98k
20,800
all-20801
[ "VolumeCreate", "mocks", "base", "method" ]
[ "func", "(", "m", "*", "MockClient", ")", "VolumeCreate", "(", "arg0", "context", ".", "Context", ",", "arg1", "volume", ".", "VolumeCreateBody", ")", "(", "types", ".", "Volume", ",", "error", ")", "{", "ret", ":=", "m", ".", "ctrl", ".", "Call", "(", "m", ",", "\"", "\"", ",", "arg0", ",", "arg1", ")", "\n", "ret0", ",", "_", ":=", "<mask>", "[", "0", "]", ".", "(", "types", ".", "Volume", ")", "\n", "ret1", ",", "_", ":=", "ret", "[", "1", "]", ".", "(", "error", ")", "\n", "return", "ret0", ",", "ret1", "\n", "}" ]
20,801
all-20802
[ "WithField", "adds", "a", "field", "to", "the", "logger" ]
[ "func", "(", "n", "*", "Namespaced", ")", "WithField", "(", "k", "string", ",", "v", "interface", "{", "}", ")", "log", ".", "Interface", "{", "if", "k", "==", "NamespaceKey", "{", "if", "str", ",", "ok", ":=", "v", ".", "(", "string", ")", ";", "<mask>", "{", "return", "&", "Namespaced", "{", "Interface", ":", "n", ".", "Interface", ",", "namespaces", ":", "n", ".", "namespaces", ",", "namespace", ":", "str", ",", "}", "\n", "}", "\n", "}", "\n\n", "return", "&", "Namespaced", "{", "Interface", ":", "n", ".", "Interface", ".", "WithField", "(", "k", ",", "v", ")", ",", "namespaces", ":", "n", ".", "namespaces", ",", "namespace", ":", "n", ".", "namespace", ",", "}", "\n", "}" ]
20,802
all-20803
[ "Update", "the", "rule", "manager", "s", "state", "as", "the", "config", "requires", ".", "If", "loading", "the", "new", "rules", "failed", "the", "old", "rule", "set", "is", "restored", "." ]
[ "func", "(", "m", "*", "<mask>", ")", "Update", "(", "interval", "time", ".", "Duration", ",", "files", "[", "]", "string", ",", "externalLabels", "labels", ".", "Labels", ")", "error", "{", "m", ".", "mtx", ".", "Lock", "(", ")", "\n", "defer", "m", ".", "mtx", ".", "Unlock", "(", ")", "\n\n", "groups", ",", "errs", ":=", "m", ".", "LoadGroups", "(", "interval", ",", "externalLabels", ",", "files", "...", ")", "\n", "if", "errs", "!=", "nil", "{", "for", "_", ",", "e", ":=", "range", "errs", "{", "level", ".", "Error", "(", "m", ".", "logger", ")", ".", "Log", "(", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "e", ")", "\n", "}", "\n", "return", "errors", ".", "New", "(", "\"", "\"", ")", "\n", "}", "\n", "m", ".", "restored", "=", "true", "\n\n", "var", "wg", "sync", ".", "WaitGroup", "\n\n", "for", "_", ",", "newg", ":=", "range", "groups", "{", "wg", ".", "Add", "(", "1", ")", "\n\n", "// If there is an old group with the same identifier, stop it and wait for", "// it to finish the current iteration. Then copy it into the new group.", "gn", ":=", "groupKey", "(", "newg", ".", "name", ",", "newg", ".", "file", ")", "\n", "oldg", ",", "ok", ":=", "m", ".", "groups", "[", "gn", "]", "\n", "delete", "(", "m", ".", "groups", ",", "gn", ")", "\n\n", "go", "func", "(", "newg", "*", "Group", ")", "{", "if", "ok", "{", "oldg", ".", "stop", "(", ")", "\n", "newg", ".", "CopyState", "(", "oldg", ")", "\n", "}", "\n", "go", "func", "(", ")", "{", "// Wait with starting evaluation until the rule manager", "// is told to run. This is necessary to avoid running", "// queries against a bootstrapping storage.", "<-", "m", ".", "block", "\n", "newg", ".", "run", "(", "m", ".", "opts", ".", "Context", ")", "\n", "}", "(", ")", "\n", "wg", ".", "Done", "(", ")", "\n", "}", "(", "newg", ")", "\n", "}", "\n\n", "// Stop remaining old groups.", "for", "_", ",", "oldg", ":=", "range", "m", ".", "groups", "{", "oldg", ".", "stop", "(", ")", "\n", "}", "\n\n", "wg", ".", "Wait", "(", ")", "\n", "m", ".", "groups", "=", "groups", "\n\n", "return", "nil", "\n", "}" ]
20,803
all-20804
[ "PopupAtPointer", "()", "is", "a", "wrapper", "for", "gtk_menu_popup_at_pointer", "()", "on", "older", "versions", "it", "uses", "PopupAtMouseCursor" ]
[ "func", "(", "v", "*", "Menu", ")", "PopupAtPointer", "(", "_", "*", "gdk", ".", "<mask>", ")", "{", "C", ".", "gtk_menu_popup", "(", "v", ".", "native", "(", ")", ",", "nil", ",", "nil", ",", "nil", ",", "nil", ",", "C", ".", "guint", "(", "0", ")", ",", "C", ".", "gtk_get_current_event_time", "(", ")", ")", "\n", "}" ]
20,804
all-20805
[ "Parse", "parses", "f", "and", "returns", "a", "list", "of", "actions", ".", "An", "action", "may", "either", "be", "a", "literal", "string", "or", "a", "Verb", "." ]
[ "func", "Parse", "(", "f", "string", ")", "(", "[", "]", "interface", "{", "}", ",", "error", ")", "{", "var", "out", "[", "]", "interface", "{", "}", "\n", "for", "len", "(", "f", ")", ">", "0", "{", "if", "f", "[", "0", "]", "==", "'%'", "{", "v", ",", "n", ",", "err", ":=", "ParseVerb", "(", "f", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "f", "=", "f", "[", "n", ":", "]", "\n", "<mask>", "=", "append", "(", "out", ",", "v", ")", "\n", "}", "else", "{", "n", ":=", "strings", ".", "IndexByte", "(", "f", ",", "'%'", ")", "\n", "if", "n", ">", "-", "1", "{", "out", "=", "append", "(", "out", ",", "f", "[", ":", "n", "]", ")", "\n", "f", "=", "f", "[", "n", ":", "]", "\n", "}", "else", "{", "out", "=", "append", "(", "out", ",", "f", ")", "\n", "f", "=", "\"", "\"", "\n", "}", "\n", "}", "\n", "}", "\n\n", "return", "out", ",", "nil", "\n", "}" ]
20,805
all-20806
[ "purgeFile", "is", "the", "internal", "implementation", "for", "PurgeFile", "which", "can", "post", "purged", "files", "to", "purgec", "if", "non", "-", "nil", "." ]
[ "func", "purgeFile", "(", "lg", "*", "zap", ".", "Logger", ",", "dirname", "string", ",", "suffix", "string", ",", "max", "uint", ",", "interval", "time", ".", "Duration", ",", "stop", "<-", "chan", "struct", "{", "}", ",", "purgec", "chan", "<-", "string", ")", "<-", "chan", "error", "{", "errC", ":=", "make", "(", "chan", "error", ",", "1", ")", "\n", "go", "func", "(", ")", "{", "for", "{", "fnames", ",", "err", ":=", "ReadDir", "(", "dirname", ")", "\n", "if", "err", "!=", "nil", "{", "errC", "<-", "err", "\n", "return", "\n", "}", "\n", "newfnames", ":=", "make", "(", "[", "]", "string", ",", "0", ")", "\n", "for", "_", ",", "fname", ":=", "range", "fnames", "{", "if", "strings", ".", "HasSuffix", "(", "fname", ",", "suffix", ")", "{", "newfnames", "=", "append", "(", "newfnames", ",", "fname", ")", "\n", "}", "\n", "}", "\n", "sort", ".", "Strings", "(", "newfnames", ")", "\n", "fnames", "=", "newfnames", "\n", "for", "len", "(", "newfnames", ")", ">", "int", "(", "max", ")", "{", "f", ":=", "filepath", ".", "Join", "(", "dirname", ",", "newfnames", "[", "0", "]", ")", "\n", "l", ",", "err", ":=", "TryLockFile", "(", "f", ",", "os", ".", "O_WRONLY", ",", "PrivateFileMode", ")", "\n", "if", "err", "!=", "nil", "{", "break", "\n", "}", "\n", "if", "err", "=", "<mask>", ".", "Remove", "(", "f", ")", ";", "err", "!=", "nil", "{", "errC", "<-", "err", "\n", "return", "\n", "}", "\n", "if", "err", "=", "l", ".", "Close", "(", ")", ";", "err", "!=", "nil", "{", "if", "lg", "!=", "nil", "{", "lg", ".", "Warn", "(", "\"", "\"", ",", "zap", ".", "String", "(", "\"", "\"", ",", "l", ".", "Name", "(", ")", ")", ",", "zap", ".", "Error", "(", "err", ")", ")", "\n", "}", "else", "{", "plog", ".", "Errorf", "(", "\"", "\"", ",", "l", ".", "Name", "(", ")", ",", "err", ")", "\n", "}", "\n", "errC", "<-", "err", "\n", "return", "\n", "}", "\n", "if", "lg", "!=", "nil", "{", "lg", ".", "Info", "(", "\"", "\"", ",", "zap", ".", "String", "(", "\"", "\"", ",", "f", ")", ")", "\n", "}", "else", "{", "plog", ".", "Infof", "(", "\"", "\"", ",", "f", ")", "\n", "}", "\n", "newfnames", "=", "newfnames", "[", "1", ":", "]", "\n", "}", "\n", "if", "purgec", "!=", "nil", "{", "for", "i", ":=", "0", ";", "i", "<", "len", "(", "fnames", ")", "-", "len", "(", "newfnames", ")", ";", "i", "++", "{", "purgec", "<-", "fnames", "[", "i", "]", "\n", "}", "\n", "}", "\n", "select", "{", "case", "<-", "time", ".", "After", "(", "interval", ")", ":", "case", "<-", "stop", ":", "return", "\n", "}", "\n", "}", "\n", "}", "(", ")", "\n", "return", "errC", "\n", "}" ]
20,806
all-20807
[ "NewWithLogger", "creates", "a", "bare", "bones", "Macaron", "instance", ".", "Use", "this", "method", "if", "you", "want", "to", "have", "full", "control", "over", "the", "middleware", "that", "is", "used", ".", "You", "can", "specify", "logger", "output", "writer", "with", "this", "function", "." ]
[ "func", "NewWithLogger", "(", "out", "io", ".", "Writer", ")", "*", "Macaron", "{", "m", ":=", "&", "Macaron", "{", "Injector", ":", "inject", ".", "New", "(", ")", ",", "action", ":", "func", "(", ")", "{", "}", ",", "Router", ":", "NewRouter", "(", ")", ",", "logger", ":", "log", ".", "New", "(", "<mask>", ",", "\"", "\"", ",", "0", ")", ",", "}", "\n", "m", ".", "Router", ".", "m", "=", "m", "\n", "m", ".", "Map", "(", "m", ".", "logger", ")", "\n", "m", ".", "Map", "(", "defaultReturnHandler", "(", ")", ")", "\n", "m", ".", "NotFound", "(", "http", ".", "NotFound", ")", "\n", "m", ".", "InternalServerError", "(", "func", "(", "rw", "http", ".", "ResponseWriter", ",", "err", "error", ")", "{", "http", ".", "Error", "(", "rw", ",", "err", ".", "Error", "(", ")", ",", "500", ")", "\n", "}", ")", "\n", "return", "m", "\n", "}" ]
20,807
all-20808
[ "UpsertId", "is", "a", "convenience", "helper", "equivalent", "to", ":", "info", "err", ":", "=", "collection", ".", "Upsert", "(", "bson", ".", "M", "{", "_id", ":", "id", "}", "update", ")", "See", "the", "Upsert", "method", "for", "more", "details", "." ]
[ "func", "(", "c", "*", "Collection", ")", "UpsertId", "(", "id", "interface", "{", "}", ",", "update", "interface", "{", "}", ")", "(", "<mask>", "*", "ChangeInfo", ",", "err", "error", ")", "{", "return", "c", ".", "Upsert", "(", "bson", ".", "D", "{", "{", "\"", "\"", ",", "id", "}", "}", ",", "update", ")", "\n", "}" ]
20,808
all-20809
[ "Remove", "key", "from", "queue" ]
[ "func", "(", "q", "*", "Queue", ")", "delete", "(", "key", "[", "]", "<mask>", ")", "{", "err", ":=", "q", ".", "db", ".", "Delete", "(", "[", "]", "byte", "(", "key", ")", ",", "nil", ")", "\n", "atomic", ".", "AddUint32", "(", "&", "q", ".", "stat", ".", "deleteCount", ",", "1", ")", "\n", "if", "err", "!=", "nil", "{", "atomic", ".", "AddUint32", "(", "&", "q", ".", "stat", ".", "deleteErrors", ",", "1", ")", "\n", "q", ".", "logger", ".", "Error", "(", "\"", "\"", ",", "zap", ".", "Error", "(", "err", ")", ")", "\n", "}", "\n", "}" ]
20,809
all-20810
[ "PutFileSplit", "writes", "a", "file", "to", "PFS", "from", "a", "reader", "delimiter", "is", "used", "to", "tell", "PFS", "how", "to", "break", "the", "input", "into", "blocks" ]
[ "func", "(", "c", "*", "putFileClient", ")", "PutFileSplit", "(", "repoName", "string", ",", "commitID", "string", ",", "<mask>", "string", ",", "delimiter", "pfs", ".", "Delimiter", ",", "targetFileDatums", "int64", ",", "targetFileBytes", "int64", ",", "headerRecords", "int64", ",", "overwrite", "bool", ",", "reader", "io", ".", "Reader", ")", "(", "_", "int", ",", "retErr", "error", ")", "{", "writer", ",", "err", ":=", "c", ".", "PutFileSplitWriter", "(", "repoName", ",", "commitID", ",", "path", ",", "delimiter", ",", "targetFileDatums", ",", "targetFileBytes", ",", "headerRecords", ",", "overwrite", ")", "\n", "if", "err", "!=", "nil", "{", "return", "0", ",", "grpcutil", ".", "ScrubGRPC", "(", "err", ")", "\n", "}", "\n", "defer", "func", "(", ")", "{", "if", "err", ":=", "writer", ".", "Close", "(", ")", ";", "err", "!=", "nil", "&&", "retErr", "==", "nil", "{", "retErr", "=", "err", "\n", "}", "\n", "}", "(", ")", "\n", "buf", ":=", "grpcutil", ".", "GetBuffer", "(", ")", "\n", "defer", "grpcutil", ".", "PutBuffer", "(", "buf", ")", "\n", "written", ",", "err", ":=", "io", ".", "CopyBuffer", "(", "writer", ",", "reader", ",", "buf", ")", "\n", "return", "int", "(", "written", ")", ",", "grpcutil", ".", "ScrubGRPC", "(", "err", ")", "\n", "}" ]
20,810
all-20811
[ "NewEnterpriseClient", "creates", "a", "new", "GitHub", "GraphQL", "API", "v4", "client", "for", "the", "GitHub", "Enterprise", "instance", "with", "the", "specified", "GraphQL", "endpoint", "URL", "using", "the", "provided", "http", ".", "Client", ".", "If", "httpClient", "is", "nil", "then", "http", ".", "DefaultClient", "is", "used", ".", "Note", "that", "GitHub", "GraphQL", "API", "v4", "requires", "authentication", "so", "the", "provided", "http", ".", "Client", "is", "expected", "to", "take", "care", "of", "that", "." ]
[ "func", "NewEnterpriseClient", "(", "url", "string", ",", "httpClient", "*", "<mask>", ".", "Client", ")", "*", "Client", "{", "return", "&", "Client", "{", "client", ":", "graphql", ".", "NewClient", "(", "url", ",", "httpClient", ")", ",", "}", "\n", "}" ]
20,811
all-20812
[ "UnmarshalJSON", "supports", "json", ".", "Unmarshaler", "interface" ]
[ "func", "(", "v", "*", "EventWebSocketWillSendHandshakeRequest", ")", "UnmarshalJSON", "(", "data", "[", "]", "byte", ")", "error", "{", "r", ":=", "jlexer", ".", "Lexer", "{", "Data", ":", "data", "}", "\n", "easyjsonC5a4559bDecodeGithubComChromedpCdprotoNetwork40", "(", "&", "r", ",", "v", ")", "\n", "return", "r", ".", "<mask>", "(", ")", "\n", "}" ]
20,812
all-20813
[ "Dump", "produces", "printable", "debug", "representation", "of", "byte", "array", "as", "string" ]
[ "func", "Dump", "(", "arr", "[", "]", "byte", ")", "string", "{", "var", "buf", "bytes", ".", "<mask>", "\n\n", "buf", ".", "WriteString", "(", "\"", "\"", ")", "\n", "buf", ".", "WriteString", "(", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "len", "(", "arr", ")", ")", ")", "\n", "buf", ".", "WriteString", "(", "\"", "\"", ")", "\n\n", "for", "idx", ",", "b", ":=", "range", "arr", "{", "buf", ".", "WriteString", "(", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "b", ")", ")", "\n", "if", "idx", "!=", "len", "(", "arr", ")", "-", "1", "{", "buf", ".", "WriteString", "(", "\"", "\"", ")", "\n", "}", "\n", "}", "\n\n", "buf", ".", "WriteString", "(", "\"", "\"", ")", "\n\n", "for", "idx", ",", "b", ":=", "range", "arr", "{", "buf", ".", "WriteString", "(", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "b", ")", ")", "\n", "if", "idx", "!=", "len", "(", "arr", ")", "-", "1", "{", "buf", ".", "WriteString", "(", "\"", "\"", ")", "\n", "}", "\n", "}", "\n\n", "buf", ".", "WriteString", "(", "\"", "\"", ")", "\n", "buf", ".", "WriteString", "(", "base64url", ".", "Encode", "(", "arr", ")", ")", "\n\n", "return", "buf", ".", "String", "(", ")", "\n", "}" ]
20,813
all-20814
[ "Return", "a", "list", "of", "SQL", "statements", "that", "can", "be", "used", "to", "create", "all", "tables", "in", "the", "database", "." ]
[ "func", "selectTablesSQL", "(", "tx", "*", "sql", ".", "Tx", ")", "(", "[", "]", "string", ",", "error", ")", "{", "statement", ":=", "`\nSELECT sql FROM sqlite_master WHERE\n type IN ('table', 'index', 'view') AND\n name != 'schema' AND\n name NOT LIKE 'sqlite_%'\nORDER BY name\n`", "\n", "return", "query", ".", "SelectStrings", "(", "tx", ",", "<mask>", ")", "\n", "}" ]
20,814
all-20815
[ "query", "the", "name", "of", "an", "indexed", "resource", "within", "a", "program" ]
[ "func", "GetProgramResourceName", "(", "program", "uint32", ",", "programInterface", "uint32", ",", "index", "uint32", ",", "bufSize", "int32", ",", "length", "*", "int32", ",", "name", "*", "uint8", ")", "{", "C", ".", "glowGetProgramResourceName", "(", "gpGetProgramResourceName", ",", "(", "C", ".", "GLuint", ")", "(", "<mask>", ")", ",", "(", "C", ".", "GLenum", ")", "(", "programInterface", ")", ",", "(", "C", ".", "GLuint", ")", "(", "index", ")", ",", "(", "C", ".", "GLsizei", ")", "(", "bufSize", ")", ",", "(", "*", "C", ".", "GLsizei", ")", "(", "unsafe", ".", "Pointer", "(", "length", ")", ")", ",", "(", "*", "C", ".", "GLchar", ")", "(", "unsafe", ".", "Pointer", "(", "name", ")", ")", ")", "\n", "}" ]
20,815
all-20816
[ "validateClusterInfo", "is", "a", "modified", "copy", "of", "k8s", ".", "io", "/", "kubernetes", "/", "pkg", "/", "client", "/", "unversioned", "/", "clientcmd", ".", "DirectClientConfig", ".", "validateClusterInfo", ".", "validateClusterInfo", "looks", "for", "conflicts", "and", "errors", "in", "the", "cluster", "info" ]
[ "func", "validateClusterInfo", "(", "clusterName", "string", ",", "clusterInfo", "clientcmdCluster", ")", "[", "]", "error", "{", "var", "validationErrors", "[", "]", "error", "\n\n", "if", "reflect", ".", "DeepEqual", "(", "clientcmdCluster", "{", "}", ",", "clusterInfo", ")", "{", "return", "[", "]", "error", "{", "errEmptyCluster", "}", "\n", "}", "\n\n", "if", "len", "(", "clusterInfo", ".", "Server", ")", "==", "0", "{", "if", "len", "(", "clusterName", ")", "==", "0", "{", "validationErrors", "=", "append", "(", "validationErrors", ",", "errors", ".", "Errorf", "(", "\"", "\"", ")", ")", "\n", "}", "else", "{", "validationErrors", "=", "append", "(", "validationErrors", ",", "errors", ".", "Errorf", "(", "\"", "\"", ",", "clusterName", ")", ")", "\n", "}", "\n", "}", "\n", "// Make sure CA data and CA file aren't both specified", "if", "len", "(", "clusterInfo", ".", "CertificateAuthority", ")", "!=", "0", "&&", "len", "(", "clusterInfo", ".", "CertificateAuthorityData", ")", "!=", "0", "{", "validationErrors", "=", "<mask>", "(", "validationErrors", ",", "errors", ".", "Errorf", "(", "\"", "\"", ",", "clusterName", ")", ")", "\n", "}", "\n", "if", "len", "(", "clusterInfo", ".", "CertificateAuthority", ")", "!=", "0", "{", "clientCertCA", ",", "err", ":=", "os", ".", "Open", "(", "clusterInfo", ".", "CertificateAuthority", ")", "\n", "defer", "clientCertCA", ".", "Close", "(", ")", "\n", "if", "err", "!=", "nil", "{", "validationErrors", "=", "append", "(", "validationErrors", ",", "errors", ".", "Errorf", "(", "\"", "\"", ",", "clusterInfo", ".", "CertificateAuthority", ",", "clusterName", ",", "err", ")", ")", "\n", "}", "\n", "}", "\n\n", "return", "validationErrors", "\n", "}" ]
20,816
all-20817
[ "Start", "issues", "a", "power", "on", "for", "the", "virtual", "machine", "instance", "." ]
[ "func", "(", "d", "*", "Driver", ")", "Start", "(", ")", "error", "{", "if", "err", ":=", "d", ".", "checkLegacyDriver", "(", "<mask>", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "c", ",", "err", ":=", "d", ".", "newAzureClient", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "return", "c", ".", "StartVirtualMachine", "(", "d", ".", "ResourceGroup", ",", "d", ".", "naming", "(", ")", ".", "VM", "(", ")", ")", "\n", "}" ]
20,817
all-20818
[ "Reset", "resets", "the", "message", "so", "it", "can", "be", "reused", ".", "The", "message", "keeps", "its", "previous", "settings", "so", "it", "is", "in", "the", "same", "state", "that", "after", "a", "call", "to", "NewMessage", "." ]
[ "func", "(", "m", "*", "Message", ")", "Reset", "(", ")", "{", "for", "k", ":=", "<mask>", "m", ".", "header", "{", "delete", "(", "m", ".", "header", ",", "k", ")", "\n", "}", "\n", "m", ".", "parts", "=", "nil", "\n", "m", ".", "attachments", "=", "nil", "\n", "m", ".", "embedded", "=", "nil", "\n", "}" ]
20,818
all-20819
[ "Returns", "the", "current", "stage", "in", "the", "daemonization", "process", "that", "s", "kept", "in", "an", "environment", "variable", ".", "The", "variable", "is", "instrumented", "with", "a", "digital", "signature", "to", "avoid", "misbehavior", "if", "it", "was", "present", "in", "the", "user", "s", "environment", ".", "The", "original", "value", "is", "restored", "after", "the", "last", "stage", "so", "that", "there", "s", "no", "final", "effect", "on", "the", "environment", "the", "application", "receives", "." ]
[ "func", "getStage", "(", ")", "(", "stage", "int", ",", "advanceStage", "func", "(", ")", "error", ",", "resetEnv", "func", "(", ")", "error", ")", "{", "var", "origValue", "string", "\n", "stage", "=", "0", "\n\n", "daemonStage", ":=", "os", ".", "Getenv", "(", "stageVar", ")", "\n", "stageTag", ":=", "strings", ".", "SplitN", "(", "daemonStage", ",", "\"", "\"", ",", "2", ")", "\n", "stageInfo", ":=", "strings", ".", "SplitN", "(", "stageTag", "[", "0", "]", ",", "\"", "\"", ",", "3", ")", "\n\n", "if", "len", "(", "stageInfo", ")", "==", "3", "{", "stageStr", ",", "tm", ",", "check", ":=", "stageInfo", "[", "0", "]", ",", "stageInfo", "[", "1", "]", ",", "stageInfo", "[", "2", "]", "\n\n", "hash", ":=", "sha1", ".", "New", "(", ")", "\n", "hash", ".", "Write", "(", "[", "]", "byte", "(", "stageStr", "+", "\"", "\"", "+", "tm", "+", "\"", "\"", ")", ")", "\n\n", "if", "check", "!=", "hex", ".", "EncodeToString", "(", "hash", ".", "Sum", "(", "[", "]", "byte", "{", "}", ")", ")", "{", "// This whole chunk is original data", "origValue", "=", "daemonStage", "\n", "}", "else", "{", "stage", ",", "_", "=", "strconv", ".", "Atoi", "(", "stageStr", ")", "\n\n", "if", "len", "(", "stageTag", ")", "==", "2", "{", "origValue", "=", "stageTag", "[", "1", "]", "\n", "}", "\n", "}", "\n", "}", "else", "{", "origValue", "=", "daemonStage", "\n", "}", "\n\n", "advanceStage", "=", "func", "(", ")", "error", "{", "base", ":=", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "<mask>", "+", "1", ",", "time", ".", "Now", "(", ")", ".", "Nanosecond", "(", ")", ")", "\n", "hash", ":=", "sha1", ".", "New", "(", ")", "\n", "hash", ".", "Write", "(", "[", "]", "byte", "(", "base", ")", ")", "\n", "tag", ":=", "base", "+", "hex", ".", "EncodeToString", "(", "hash", ".", "Sum", "(", "[", "]", "byte", "{", "}", ")", ")", "\n\n", "if", "err", ":=", "os", ".", "Setenv", "(", "stageVar", ",", "tag", "+", "\"", "\"", "+", "origValue", ")", ";", "err", "!=", "nil", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "stageVar", ",", "err", ")", "\n", "}", "\n", "return", "nil", "\n", "}", "\n", "resetEnv", "=", "func", "(", ")", "error", "{", "return", "os", ".", "Setenv", "(", "stageVar", ",", "origValue", ")", "\n", "}", "\n\n", "return", "stage", ",", "advanceStage", ",", "resetEnv", "\n", "}" ]
20,819
all-20820
[ "DiscoverPollEndpoint", "indicates", "an", "expected", "call", "of", "DiscoverPollEndpoint" ]
[ "func", "(", "mr", "*", "MockECSClientMockRecorder", ")", "DiscoverPollEndpoint", "(", "arg0", "<mask>", "{", "}", ")", "*", "gomock", ".", "Call", "{", "return", "mr", ".", "mock", ".", "ctrl", ".", "RecordCallWithMethodType", "(", "mr", ".", "mock", ",", "\"", "\"", ",", "reflect", ".", "TypeOf", "(", "(", "*", "MockECSClient", ")", "(", "nil", ")", ".", "DiscoverPollEndpoint", ")", ",", "arg0", ")", "\n", "}" ]
20,820
all-20821
[ "New", "returns", "the", "location", "middleware", "with", "user", "-", "defined", "custom", "configuration", "." ]
[ "func", "New", "(", "config", "Config", ")", "gin", ".", "HandlerFunc", "{", "location", ":=", "newLocation", "(", "config", ")", "\n\n", "return", "func", "(", "c", "*", "gin", ".", "<mask>", ")", "{", "location", ".", "applyToContext", "(", "c", ")", "\n", "}", "\n", "}" ]
20,821
all-20822
[ "Next", "returns", "the", "ID", "of", "the", "next", "result", ".", "When", "there", "are", "no", "more", "results", "Done", "is", "returned", "as", "the", "error", ".", "dst", "must", "be", "a", "non", "-", "nil", "struct", "pointer", "implement", "the", "FieldLoadSaver", "interface", "or", "be", "a", "nil", "interface", "value", ".", "If", "a", "non", "-", "nil", "dst", "is", "provided", "it", "will", "be", "filled", "with", "the", "indexed", "fields", ".", "dst", "is", "ignored", "if", "this", "iterator", "was", "created", "with", "an", "IDsOnly", "option", "." ]
[ "func", "(", "t", "*", "Iterator", ")", "Next", "(", "dst", "interface", "{", "}", ")", "(", "string", ",", "error", ")", "{", "t", ".", "fetchMore", "(", ")", "\n", "if", "t", ".", "err", "!=", "nil", "{", "return", "\"", "\"", ",", "t", ".", "err", "\n", "}", "\n\n", "var", "doc", "*", "pb", ".", "Document", "\n", "var", "exprs", "[", "]", "*", "pb", ".", "Field", "\n", "switch", "{", "case", "len", "(", "t", ".", "listRes", ")", "!=", "0", ":", "doc", "=", "t", ".", "listRes", "[", "0", "]", "\n", "t", ".", "listRes", "=", "t", ".", "listRes", "[", "1", ":", "]", "\n", "case", "len", "(", "t", ".", "searchRes", ")", "!=", "0", ":", "doc", "=", "t", ".", "searchRes", "[", "0", "]", ".", "<mask>", "\n", "exprs", "=", "t", ".", "searchRes", "[", "0", "]", ".", "Expression", "\n", "t", ".", "searchCursor", "=", "t", ".", "searchRes", "[", "0", "]", ".", "Cursor", "\n", "t", ".", "searchRes", "=", "t", ".", "searchRes", "[", "1", ":", "]", "\n", "default", ":", "return", "\"", "\"", ",", "Done", "\n", "}", "\n", "if", "doc", "==", "nil", "{", "return", "\"", "\"", ",", "errors", ".", "New", "(", "\"", "\"", ")", "\n", "}", "\n", "if", "!", "t", ".", "idsOnly", "&&", "dst", "!=", "nil", "{", "if", "err", ":=", "loadDoc", "(", "dst", ",", "doc", ",", "exprs", ")", ";", "err", "!=", "nil", "{", "return", "\"", "\"", ",", "err", "\n", "}", "\n", "}", "\n", "return", "doc", ".", "GetId", "(", ")", ",", "nil", "\n", "}" ]
20,822
all-20823
[ "UnColorizeText", "removes", "all", "color", "-", "related", "tags", "from", "the", "string", ".", "Tags", "to", "remove", ":", "<", "(", "f|t|b|c", ")", ":", ".", "*", ">" ]
[ "func", "UnColorizeText", "(", "str", "string", ")", "<mask>", "{", "rx", ":=", "regexp", ".", "MustCompile", "(", "\"", "\"", ")", "\n\n", "return", "rx", ".", "ReplaceAllString", "(", "str", ",", "\"", "\"", ")", "\n", "}" ]
20,823
all-20824
[ "SetDefaultResponse", "()", "is", "a", "wrapper", "around", "gtk_dialog_set_default_response", "()", "." ]
[ "func", "(", "v", "*", "Dialog", ")", "SetDefaultResponse", "(", "id", "ResponseType", ")", "{", "C", ".", "gtk_dialog_set_default_response", "(", "v", ".", "native", "(", ")", ",", "C", ".", "gint", "(", "<mask>", ")", ")", "\n", "}" ]
20,824
all-20825
[ "Output", "simply", "writes", "to", "Writer", "." ]
[ "func", "(", "ui", "*", "BasicUI", ")", "Output", "(", "message", "string", ")", "{", "fmt", ".", "Fprint", "(", "ui", ".", "Writer", ",", "<mask>", ")", "\n", "fmt", ".", "Fprint", "(", "ui", ".", "Writer", ",", "\"", "\\n", "\"", ")", "\n", "}" ]
20,825
all-20826
[ "Set", "indicates", "an", "expected", "call", "of", "Set" ]
[ "func", "(", "mr", "*", "MockCacheMockRecorder", ")", "<mask>", "(", "arg0", ",", "arg1", "interface", "{", "}", ")", "*", "gomock", ".", "Call", "{", "return", "mr", ".", "mock", ".", "ctrl", ".", "RecordCallWithMethodType", "(", "mr", ".", "mock", ",", "\"", "\"", ",", "reflect", ".", "TypeOf", "(", "(", "*", "MockCache", ")", "(", "nil", ")", ".", "Set", ")", ",", "arg0", ",", "arg1", ")", "\n", "}" ]
20,826
all-20827
[ "SetTerminalReason", "sets", "the", "terminalReason", "string", "and", "this", "can", "only", "be", "set", "once", "per", "the", "task", "s", "lifecycle", ".", "This", "field", "does", "not", "accept", "updates", "." ]
[ "func", "(", "task", "*", "Task", ")", "SetTerminalReason", "(", "reason", "string", ")", "{", "seelog", ".", "Infof", "(", "\"", "\"", ",", "task", ".", "Arn", ",", "reason", ")", "\n", "task", ".", "terminalReasonOnce", ".", "Do", "(", "func", "(", ")", "{", "seelog", ".", "Infof", "(", "\"", "\"", ",", "task", ".", "Arn", ",", "reason", ")", "\n\n", "// Converts the first letter of terminal reason into capital letter", "words", ":=", "strings", ".", "Fields", "(", "reason", ")", "\n", "words", "[", "0", "]", "=", "strings", ".", "Title", "(", "words", "[", "0", "]", ")", "\n", "task", ".", "terminalReason", "=", "strings", ".", "Join", "(", "<mask>", ",", "\"", "\"", ")", "\n", "}", ")", "\n", "}" ]
20,827
all-20828
[ "WrapBuffaloHandler", "wraps", "a", "buffalo", ".", "Handler", "to", "standard", "http", ".", "Handler" ]
[ "func", "WrapBuffaloHandler", "(", "h", "Handler", ")", "<mask>", ".", "Handler", "{", "a", ":=", "New", "(", "Options", "{", "}", ")", "\n", "// it doesn't matter what we actually map it", "// GET, POST, etc... we just need the underlying", "// RouteInfo, which implements http.Handler", "ri", ":=", "a", ".", "GET", "(", "\"", "\"", ",", "h", ")", "\n", "return", "ri", "\n", "}" ]
20,828
all-20829
[ "configureTeamMembers", "will", "add", "/", "update", "people", "to", "the", "appropriate", "role", "on", "the", "team", "and", "remove", "anyone", "else", "." ]
[ "func", "configureTeamMembers", "(", "client", "teamMembersClient", ",", "gt", "github", ".", "Team", ",", "team", "org", ".", "Team", ")", "error", "{", "// Get desired state", "wantMaintainers", ":=", "sets", ".", "NewString", "(", "team", ".", "Maintainers", "...", ")", "\n", "wantMembers", ":=", "sets", ".", "NewString", "(", "team", ".", "Members", "...", ")", "\n\n", "// Get current state", "haveMaintainers", ":=", "sets", ".", "String", "{", "}", "\n", "haveMembers", ":=", "sets", ".", "String", "{", "}", "\n\n", "members", ",", "err", ":=", "client", ".", "ListTeamMembers", "(", "gt", ".", "ID", ",", "github", ".", "RoleMember", ")", "\n", "if", "err", "!=", "nil", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "gt", ".", "ID", ",", "gt", ".", "Name", ",", "err", ")", "\n", "}", "\n", "for", "_", ",", "m", ":=", "range", "members", "{", "haveMembers", ".", "Insert", "(", "m", ".", "Login", ")", "\n", "}", "\n\n", "maintainers", ",", "err", ":=", "client", ".", "ListTeamMembers", "(", "gt", ".", "ID", ",", "github", ".", "RoleMaintainer", ")", "\n", "if", "err", "!=", "nil", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "gt", ".", "ID", ",", "gt", ".", "Name", ",", "err", ")", "\n", "}", "\n", "for", "_", ",", "m", ":=", "range", "maintainers", "{", "haveMaintainers", ".", "Insert", "(", "m", ".", "Login", ")", "\n", "}", "\n\n", "invitees", ",", "err", ":=", "teamInvitations", "(", "client", ",", "gt", ".", "ID", ")", "\n", "if", "err", "!=", "nil", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "gt", ".", "ID", ",", "gt", ".", "Name", ",", "err", ")", "\n", "}", "\n\n", "adder", ":=", "func", "(", "user", "string", ",", "super", "bool", ")", "error", "{", "if", "invitees", ".", "Has", "(", "user", ")", "{", "logrus", ".", "Infof", "(", "\"", "\"", ",", "user", ",", "gt", ".", "ID", ",", "gt", ".", "Name", ")", "\n", "return", "nil", "\n", "}", "\n", "role", ":=", "github", ".", "RoleMember", "\n", "if", "super", "{", "role", "=", "github", ".", "RoleMaintainer", "\n", "}", "\n", "tm", ",", "err", ":=", "client", ".", "UpdateTeamMembership", "(", "gt", ".", "ID", ",", "user", ",", "super", ")", "\n", "if", "err", "!=", "nil", "{", "logrus", ".", "WithError", "(", "err", ")", ".", "Warnf", "(", "\"", "\"", ",", "gt", ".", "ID", ",", "gt", ".", "Name", ",", "user", ",", "super", ")", "\n", "}", "else", "if", "tm", ".", "State", "==", "github", ".", "StatePending", "{", "logrus", ".", "Infof", "(", "\"", "\"", ",", "<mask>", ",", "gt", ".", "ID", ",", "gt", ".", "Name", ",", "role", ")", "\n", "}", "else", "{", "logrus", ".", "Infof", "(", "\"", "\"", ",", "user", ",", "role", ",", "gt", ".", "ID", ",", "gt", ".", "Name", ")", "\n", "}", "\n", "return", "err", "\n", "}", "\n\n", "remover", ":=", "func", "(", "user", "string", ")", "error", "{", "err", ":=", "client", ".", "RemoveTeamMembership", "(", "gt", ".", "ID", ",", "user", ")", "\n", "if", "err", "!=", "nil", "{", "logrus", ".", "WithError", "(", "err", ")", ".", "Warnf", "(", "\"", "\"", ",", "gt", ".", "ID", ",", "gt", ".", "Name", ",", "user", ")", "\n", "}", "else", "{", "logrus", ".", "Infof", "(", "\"", "\"", ",", "user", ",", "gt", ".", "ID", ",", "gt", ".", "Name", ")", "\n", "}", "\n", "return", "err", "\n", "}", "\n\n", "want", ":=", "memberships", "{", "members", ":", "wantMembers", ",", "super", ":", "wantMaintainers", "}", "\n", "have", ":=", "memberships", "{", "members", ":", "haveMembers", ",", "super", ":", "haveMaintainers", "}", "\n", "return", "configureMembers", "(", "have", ",", "want", ",", "invitees", ",", "adder", ",", "remover", ")", "\n", "}" ]
20,829
all-20830
[ "attach", "a", "range", "of", "a", "buffer", "object", "s", "data", "store", "to", "a", "buffer", "texture", "object" ]
[ "func", "TextureBufferRange", "(", "texture", "uint32", ",", "internalformat", "uint32", ",", "buffer", "uint32", ",", "offset", "int", ",", "size", "int", ")", "{", "syscall", ".", "Syscall6", "(", "gpTextureBufferRange", ",", "5", ",", "uintptr", "(", "texture", ")", ",", "uintptr", "(", "internalformat", ")", ",", "uintptr", "(", "<mask>", ")", ",", "uintptr", "(", "offset", ")", ",", "uintptr", "(", "size", ")", ",", "0", ")", "\n", "}" ]
20,830
all-20831
[ "submitChanges", "takes", "a", "zone", "and", "a", "collection", "of", "Changes", "and", "sends", "them", "as", "a", "single", "transaction", "." ]
[ "func", "(", "p", "*", "DigitalOceanProvider", ")", "submitChanges", "(", "changes", "[", "]", "*", "DigitalOceanChange", ")", "error", "{", "// return early if there is nothing to change", "if", "len", "(", "changes", ")", "==", "0", "{", "return", "nil", "\n", "}", "\n\n", "zones", ",", "err", ":=", "p", ".", "Zones", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "// separate into per-zone change sets to be passed to the API.", "changesByZone", ":=", "digitalOceanChangesByZone", "(", "zones", ",", "changes", ")", "\n", "for", "zoneName", ",", "changes", ":=", "range", "changesByZone", "{", "records", ",", "err", ":=", "p", ".", "fetchRecords", "(", "zoneName", ")", "\n", "if", "err", "!=", "nil", "{", "log", ".", "Errorf", "(", "\"", "\"", ",", "zoneName", ")", "\n", "continue", "\n", "}", "\n", "for", "_", ",", "change", ":=", "range", "changes", "{", "logFields", ":=", "log", ".", "Fields", "{", "\"", "\"", ":", "change", ".", "ResourceRecordSet", ".", "Name", ",", "\"", "\"", ":", "change", ".", "ResourceRecordSet", ".", "Type", ",", "\"", "\"", ":", "change", ".", "ResourceRecordSet", ".", "TTL", ",", "\"", "\"", ":", "change", ".", "Action", ",", "\"", "\"", ":", "zoneName", ",", "}", "\n\n", "log", ".", "WithFields", "(", "logFields", ")", ".", "Info", "(", "\"", "\"", ")", "\n\n", "if", "p", ".", "DryRun", "{", "continue", "\n", "}", "\n\n", "change", ".", "ResourceRecordSet", ".", "Name", "=", "strings", ".", "TrimSuffix", "(", "change", ".", "ResourceRecordSet", ".", "Name", ",", "\"", "\"", "+", "zoneName", ")", "\n\n", "// record at the root should be defined as @ instead of", "// the full domain name", "if", "change", ".", "ResourceRecordSet", ".", "Name", "==", "zoneName", "{", "change", ".", "ResourceRecordSet", ".", "Name", "=", "\"", "\"", "\n", "}", "\n\n", "// for some reason the DO API requires the '.' at the end of \"data\" in case of CNAME request", "// Example: {\"type\":\"CNAME\",\"name\":\"hello\",\"data\":\"www.example.com.\"}", "if", "change", ".", "ResourceRecordSet", ".", "Type", "==", "endpoint", ".", "RecordTypeCNAME", "{", "change", ".", "ResourceRecordSet", ".", "Data", "+=", "\"", "\"", "\n", "}", "\n\n", "<mask>", "change", ".", "Action", "{", "case", "DigitalOceanCreate", ":", "_", ",", "_", ",", "err", "=", "p", ".", "Client", ".", "CreateRecord", "(", "context", ".", "TODO", "(", ")", ",", "zoneName", ",", "&", "godo", ".", "DomainRecordEditRequest", "{", "Data", ":", "change", ".", "ResourceRecordSet", ".", "Data", ",", "Name", ":", "change", ".", "ResourceRecordSet", ".", "Name", ",", "Type", ":", "change", ".", "ResourceRecordSet", ".", "Type", ",", "TTL", ":", "change", ".", "ResourceRecordSet", ".", "TTL", ",", "}", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "case", "DigitalOceanDelete", ":", "recordID", ":=", "p", ".", "getRecordID", "(", "records", ",", "change", ".", "ResourceRecordSet", ")", "\n", "_", ",", "err", "=", "p", ".", "Client", ".", "DeleteRecord", "(", "context", ".", "TODO", "(", ")", ",", "zoneName", ",", "recordID", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "case", "DigitalOceanUpdate", ":", "recordID", ":=", "p", ".", "getRecordID", "(", "records", ",", "change", ".", "ResourceRecordSet", ")", "\n", "_", ",", "_", ",", "err", "=", "p", ".", "Client", ".", "EditRecord", "(", "context", ".", "TODO", "(", ")", ",", "zoneName", ",", "recordID", ",", "&", "godo", ".", "DomainRecordEditRequest", "{", "Data", ":", "change", ".", "ResourceRecordSet", ".", "Data", ",", "Name", ":", "change", ".", "ResourceRecordSet", ".", "Name", ",", "Type", ":", "change", ".", "ResourceRecordSet", ".", "Type", ",", "TTL", ":", "change", ".", "ResourceRecordSet", ".", "TTL", ",", "}", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "}", "\n", "}", "\n", "}", "\n", "return", "nil", "\n", "}" ]
20,831
all-20832
[ "Commit", "executes", "a", "database", "commit", "." ]
[ "func", "(", "s", "*", "Session", ")", "Commit", "(", ")", "error", "{", "s", ".", "mu", ".", "Lock", "(", ")", "\n", "defer", "s", ".", "mu", ".", "Unlock", "(", ")", "\n\n", "if", "err", ":=", "s", ".", "writeRequest", "(", "mtCommit", ",", "<mask>", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "if", "err", ":=", "s", ".", "readReply", "(", "nil", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "if", "trace", "{", "outLogger", ".", "Printf", "(", "\"", "\"", ",", "s", ".", "txFlags", ")", "\n", "}", "\n\n", "s", ".", "conn", ".", "inTx", "=", "false", "\n", "return", "nil", "\n", "}" ]
20,832
all-20833
[ "Make", "a", "boot2docker", "VM", "disk", "image", "." ]
[ "func", "(", "c", "*", "defaultDiskCreator", ")", "Create", "(", "size", "int", ",", "publicSSHKeyPath", ",", "diskPath", "string", ")", "error", "{", "log", ".", "Debugf", "(", "\"", "\"", ",", "size", ")", "\n\n", "tarBuf", ",", "err", ":=", "mcnutils", ".", "MakeDiskImage", "(", "publicSSHKeyPath", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "<mask>", ".", "Debug", "(", "\"", "\"", ")", "\n\n", "return", "createDiskImage", "(", "diskPath", ",", "size", ",", "tarBuf", ")", "\n", "}" ]
20,833
all-20834
[ "GetSelectionBounds", "is", "a", "wrapper", "around", "gtk_label_get_selection_bounds", "()", "." ]
[ "func", "(", "v", "*", "Label", ")", "GetSelectionBounds", "(", ")", "(", "<mask>", ",", "end", "int", ",", "nonEmpty", "bool", ")", "{", "var", "cstart", ",", "cend", "C", ".", "gint", "\n", "c", ":=", "C", ".", "gtk_label_get_selection_bounds", "(", "v", ".", "native", "(", ")", ",", "&", "cstart", ",", "&", "cend", ")", "\n", "return", "int", "(", "cstart", ")", ",", "int", "(", "cend", ")", ",", "gobool", "(", "c", ")", "\n", "}" ]
20,834
all-20835
[ "VolumeTypeLocator", "builds", "a", "locator", "from", "the", "given", "href", "." ]
[ "func", "(", "api", "*", "API", ")", "VolumeTypeLocator", "(", "href", "string", ")", "*", "VolumeTypeLocator", "{", "<mask>", "&", "VolumeTypeLocator", "{", "Href", "(", "href", ")", ",", "api", "}", "\n", "}" ]
20,835
all-20836
[ "title", ":", "update", "nodes", "path", ":", "/", "{", "provisioner", "}", "/", "node", "method", ":", "PUT", "consume", ":", "application", "/", "x", "-", "www", "-", "form", "-", "urlencoded", "responses", ":", "200", ":", "Ok", "400", ":", "Invalid", "data", "401", ":", "Unauthorized", "404", ":", "Not", "found" ]
[ "func", "updateNodeHandler", "(", "w", "http", ".", "ResponseWriter", ",", "r", "*", "<mask>", ".", "Request", ",", "t", "auth", ".", "Token", ")", "(", "err", "error", ")", "{", "var", "params", "provision", ".", "UpdateNodeOptions", "\n", "err", "=", "ParseInput", "(", "r", ",", "&", "params", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "if", "params", ".", "Disable", "&&", "params", ".", "Enable", "{", "return", "&", "tsuruErrors", ".", "HTTP", "{", "Code", ":", "http", ".", "StatusBadRequest", ",", "Message", ":", "\"", "\"", ",", "}", "\n", "}", "\n", "if", "params", ".", "Address", "==", "\"", "\"", "{", "return", "&", "tsuruErrors", ".", "HTTP", "{", "Code", ":", "http", ".", "StatusBadRequest", ",", "Message", ":", "\"", "\"", "}", "\n", "}", "\n", "prov", ",", "node", ",", "err", ":=", "node", ".", "FindNode", "(", "params", ".", "Address", ")", "\n", "if", "err", "!=", "nil", "{", "if", "err", "==", "provision", ".", "ErrNodeNotFound", "{", "return", "&", "tsuruErrors", ".", "HTTP", "{", "Code", ":", "http", ".", "StatusNotFound", ",", "Message", ":", "err", ".", "Error", "(", ")", ",", "}", "\n", "}", "\n", "return", "err", "\n", "}", "\n", "nodeProv", ":=", "prov", ".", "(", "provision", ".", "NodeProvisioner", ")", "\n", "oldPool", ":=", "node", ".", "Pool", "(", ")", "\n", "allowedOldPool", ":=", "permission", ".", "Check", "(", "t", ",", "permission", ".", "PermNodeUpdate", ",", "permission", ".", "Context", "(", "permTypes", ".", "CtxPool", ",", "oldPool", ")", ",", ")", "\n", "if", "!", "allowedOldPool", "{", "return", "permission", ".", "ErrUnauthorized", "\n", "}", "\n", "var", "ok", "bool", "\n", "params", ".", "Pool", ",", "ok", "=", "params", ".", "Metadata", "[", "provision", ".", "PoolMetadataName", "]", "\n", "if", "ok", "{", "delete", "(", "params", ".", "Metadata", ",", "provision", ".", "PoolMetadataName", ")", "\n", "allowedNewPool", ":=", "permission", ".", "Check", "(", "t", ",", "permission", ".", "PermNodeUpdate", ",", "permission", ".", "Context", "(", "permTypes", ".", "CtxPool", ",", "params", ".", "Pool", ")", ",", ")", "\n", "if", "!", "allowedNewPool", "{", "return", "permission", ".", "ErrUnauthorized", "\n", "}", "\n", "}", "\n", "evt", ",", "err", ":=", "event", ".", "New", "(", "&", "event", ".", "Opts", "{", "Target", ":", "event", ".", "Target", "{", "Type", ":", "event", ".", "TargetTypeNode", ",", "Value", ":", "node", ".", "Address", "(", ")", "}", ",", "Kind", ":", "permission", ".", "PermNodeUpdate", ",", "Owner", ":", "t", ",", "CustomData", ":", "event", ".", "FormToCustomData", "(", "InputFields", "(", "r", ")", ")", ",", "Allowed", ":", "event", ".", "Allowed", "(", "permission", ".", "PermPoolReadEvents", ",", "permission", ".", "Context", "(", "permTypes", ".", "CtxPool", ",", "oldPool", ")", ",", "permission", ".", "Context", "(", "permTypes", ".", "CtxPool", ",", "params", ".", "Pool", ")", ",", ")", ",", "}", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "defer", "func", "(", ")", "{", "evt", ".", "Done", "(", "err", ")", "}", "(", ")", "\n", "return", "nodeProv", ".", "UpdateNode", "(", "params", ")", "\n", "}" ]
20,836
all-20837
[ "MarshalJSON", "supports", "json", ".", "Marshaler", "interface" ]
[ "func", "(", "v", "EventFrameNavigated", ")", "MarshalJSON", "(", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "w", ":=", "jwriter", ".", "<mask>", "{", "}", "\n", "easyjsonC5a4559bEncodeGithubComChromedpCdprotoPage64", "(", "&", "w", ",", "v", ")", "\n", "return", "w", ".", "Buffer", ".", "BuildBytes", "(", ")", ",", "w", ".", "Error", "\n", "}" ]
20,837
all-20838
[ "UnmarshalText", "implements", "TextUnmarsheler" ]
[ "func", "(", "t", "*", "Type", ")", "UnmarshalText", "(", "text", "[", "]", "byte", ")", "error", "{", "e", ",", "err", ":=", "fromString", "(", "string", "(", "<mask>", ")", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "*", "t", "=", "e", "\n\n", "return", "nil", "\n", "}" ]
20,838
all-20839
[ "UniqueURLsFromFlag", "returns", "a", "slice", "from", "urls", "got", "from", "the", "flag", "." ]
[ "func", "UniqueURLsFromFlag", "(", "fs", "*", "flag", ".", "FlagSet", ",", "urlsFlagName", "string", ")", "[", "]", "url", ".", "URL", "{", "return", "(", "*", "fs", ".", "Lookup", "(", "urlsFlagName", ")", ".", "<mask>", ".", "(", "*", "UniqueURLs", ")", ")", ".", "uss", "\n", "}" ]
20,839
all-20840
[ "injectEnvironment", "will", "add", "rawEnv", "to", "the", "build", "steps", "and", "/", "or", "template", "arguments", "." ]
[ "func", "injectEnvironment", "(", "b", "*", "buildv1alpha1", ".", "Build", ",", "rawEnv", "<mask>", "[", "string", "]", "string", ")", "{", "for", "i", ":=", "range", "b", ".", "Spec", ".", "Steps", "{", "// Inject environment variables to each step", "defaultEnv", "(", "&", "b", ".", "Spec", ".", "Steps", "[", "i", "]", ",", "rawEnv", ")", "\n", "}", "\n", "if", "b", ".", "Spec", ".", "Template", "!=", "nil", "{", "// Also add it as template arguments", "defaultArguments", "(", "b", ".", "Spec", ".", "Template", ",", "rawEnv", ")", "\n", "}", "\n", "}" ]
20,840
all-20841
[ "HasMessage", "returns", "a", "boolean", "if", "a", "field", "has", "been", "set", "." ]
[ "func", "(", "s", "*", "SyntheticsTest", ")", "HasMessage", "(", ")", "bool", "{", "if", "s", "!=", "nil", "&&", "s", ".", "<mask>", "!=", "nil", "{", "return", "true", "\n", "}", "\n\n", "return", "false", "\n", "}" ]
20,841
all-20842
[ "PutFile", "puts", "a", "file", "in", "the", "hashtree", "." ]
[ "func", "(", "u", "*", "Unordered", ")", "PutFile", "(", "path", "string", ",", "hash", "[", "]", "byte", ",", "size", "int64", ",", "blockRefs", "...", "*", "pfs", ".", "BlockRef", ")", "{", "path", "=", "join", "(", "u", ".", "root", ",", "<mask>", ")", "\n", "nodeProto", ":=", "&", "NodeProto", "{", "Name", ":", "base", "(", "path", ")", ",", "Hash", ":", "hash", ",", "SubtreeSize", ":", "size", ",", "FileNode", ":", "&", "FileNodeProto", "{", "BlockRefs", ":", "blockRefs", ",", "}", ",", "}", "\n", "u", ".", "fs", "[", "path", "]", "=", "nodeProto", "\n", "u", ".", "createParents", "(", "path", ")", "\n", "}" ]
20,842
all-20843
[ "HasValue", "returns", "a", "boolean", "if", "a", "field", "has", "been", "set", "." ]
[ "func", "(", "t", "*", "TileDefMarker", ")", "HasValue", "(", ")", "bool", "{", "if", "t", "!=", "nil", "&&", "t", ".", "Value", "!=", "nil", "{", "return", "<mask>", "\n", "}", "\n\n", "return", "false", "\n", "}" ]
20,843
all-20844
[ "returnConn", "returns", "a", "connection", "back", "to", "the", "pool", "." ]
[ "func", "(", "n", "*", "NetworkTransport", ")", "returnConn", "(", "conn", "*", "netConn", ")", "{", "n", ".", "connPoolLock", ".", "Lock", "(", ")", "\n", "defer", "n", ".", "connPoolLock", ".", "Unlock", "(", ")", "\n\n", "key", ":=", "<mask>", ".", "target", "\n", "conns", ",", "_", ":=", "n", ".", "connPool", "[", "key", "]", "\n\n", "if", "!", "n", ".", "IsShutdown", "(", ")", "&&", "len", "(", "conns", ")", "<", "n", ".", "maxPool", "{", "n", ".", "connPool", "[", "key", "]", "=", "append", "(", "conns", ",", "conn", ")", "\n", "}", "else", "{", "conn", ".", "Release", "(", ")", "\n", "}", "\n", "}" ]
20,844
all-20845
[ "ToString", "converts", "the", "host", "into", "a", "nicely", "formatted", "string" ]
[ "func", "(", "h", "Host", ")", "ToString", "(", ")", "(", "out", "string", ")", "{", "out", "+=", "fmt", ".", "Sprintf", "(", "\"", "\\n", "\"", ",", "h", ".", "Address", ",", "h", ".", "State", ")", "\n", "if", "len", "(", "h", ".", "Hostnames", ")", "!=", "0", "{", "out", "+=", "\"", "\\n", "\"", "\n", "for", "_", ",", "hostname", ":=", "range", "h", ".", "Hostnames", "{", "out", "+=", "fmt", ".", "Sprintf", "(", "\"", "\\n", "\"", ",", "hostname", ".", "Name", ",", "hostname", ".", "Type", ")", "\n", "}", "\n", "}", "\n", "if", "len", "(", "h", ".", "Ports", ")", "!=", "0", "{", "out", "+=", "\"", "\\n", "\"", "\n", "for", "_", ",", "port", ":=", "range", "h", ".", "Ports", "{", "for", "_", ",", "line", ":=", "range", "strings", ".", "Split", "(", "<mask>", ".", "ToString", "(", ")", ",", "\"", "\\n", "\"", ")", "{", "if", "line", "!=", "\"", "\"", "{", "out", "+=", "fmt", ".", "Sprintf", "(", "\"", "\\n", "\"", ",", "line", ")", "\n", "}", "\n", "}", "\n", "}", "\n", "}", "\n", "return", "\n", "}" ]
20,845
all-20846
[ "ReifyMessage", "takes", "a", "structured", "object", "potentially", "containing", "nested", "Matchers", "and", "returns", "an", "object", "with", "just", "the", "example", "(", "generated", ")", "content", "The", "object", "may", "be", "a", "simple", "JSON", "primitive", "e", ".", "g", ".", "string", "or", "number", "or", "a", "complex", "object" ]
[ "func", "(", "p", "*", "mockClient", ")", "ReifyMessage", "(", "request", "*", "types", ".", "PactReificationRequest", ")", "(", "res", "*", "<mask>", ".", "ReificationResponse", ",", "err", "error", ")", "{", "return", "p", ".", "ReifyMessageResponse", ",", "p", ".", "ReifyMessageError", "\n", "}" ]
20,846
all-20847
[ "Rewind", "seeks", "to", "first", "element", "(", "or", "last", "element", "for", "reverse", "iterator", ")", "." ]
[ "func", "(", "s", "*", "MergeIterator", ")", "Rewind", "(", ")", "{", "for", "_", ",", "itr", ":=", "range", "s", ".", "<mask>", "{", "itr", ".", "Rewind", "(", ")", "\n", "}", "\n", "s", ".", "initHeap", "(", ")", "\n", "}" ]
20,847
all-20848
[ "CC", "returns", "a", "copy", "of", "MailBuilder", "with", "this", "name", "&", "address", "appended", "to", "the", "CC", "header", ".", "name", "may", "be", "empty", "." ]
[ "func", "(", "p", "MailBuilder", ")", "CC", "(", "<mask>", ",", "addr", "string", ")", "MailBuilder", "{", "p", ".", "cc", "=", "append", "(", "p", ".", "cc", ",", "mail", ".", "Address", "{", "Name", ":", "name", ",", "Address", ":", "addr", "}", ")", "\n", "return", "p", "\n", "}" ]
20,848
all-20849
[ "Ptr", "takes", "a", "slice", "or", "pointer", "(", "to", "a", "singular", "scalar", "value", "or", "the", "first", "element", "of", "an", "array", "or", "slice", ")", "and", "returns", "its", "GL", "-", "compatible", "address", ".", "For", "example", ":", "var", "data", "[]", "uint8", "...", "gl", ".", "TexImage2D", "(", "gl", ".", "TEXTURE_2D", "...", "gl", ".", "UNSIGNED_BYTE", "gl", ".", "Ptr", "(", "&data", "[", "0", "]", "))" ]
[ "func", "Ptr", "(", "data", "<mask>", "{", "}", ")", "unsafe", ".", "Pointer", "{", "if", "data", "==", "nil", "{", "return", "unsafe", ".", "Pointer", "(", "nil", ")", "\n", "}", "\n", "var", "addr", "unsafe", ".", "Pointer", "\n", "v", ":=", "reflect", ".", "ValueOf", "(", "data", ")", "\n", "switch", "v", ".", "Type", "(", ")", ".", "Kind", "(", ")", "{", "case", "reflect", ".", "Ptr", ":", "e", ":=", "v", ".", "Elem", "(", ")", "\n", "switch", "e", ".", "Kind", "(", ")", "{", "case", "reflect", ".", "Int", ",", "reflect", ".", "Int8", ",", "reflect", ".", "Int16", ",", "reflect", ".", "Int32", ",", "reflect", ".", "Int64", ",", "reflect", ".", "Uint", ",", "reflect", ".", "Uint8", ",", "reflect", ".", "Uint16", ",", "reflect", ".", "Uint32", ",", "reflect", ".", "Uint64", ",", "reflect", ".", "Float32", ",", "reflect", ".", "Float64", ":", "addr", "=", "unsafe", ".", "Pointer", "(", "e", ".", "UnsafeAddr", "(", ")", ")", "\n", "default", ":", "panic", "(", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "e", ".", "Kind", "(", ")", ")", ")", "\n", "}", "\n", "case", "reflect", ".", "Uintptr", ":", "addr", "=", "unsafe", ".", "Pointer", "(", "v", ".", "Pointer", "(", ")", ")", "\n", "case", "reflect", ".", "Slice", ":", "addr", "=", "unsafe", ".", "Pointer", "(", "v", ".", "Index", "(", "0", ")", ".", "UnsafeAddr", "(", ")", ")", "\n", "default", ":", "panic", "(", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "v", ".", "Type", "(", ")", ")", ")", "\n", "}", "\n", "return", "addr", "\n", "}" ]
20,849
all-20850
[ "getBrokeredService", "retrieves", "the", "service", "information", "from", "a", "service", "that", "is", "offered", "by", "a", "broker", ".", "name", "is", "in", "the", "format", "<broker", ">", "serviceNameBrokerSep<service", ">", "." ]
[ "func", "getBrokeredService", "(", "name", "string", ")", "(", "Service", ",", "error", ")", "{", "catalogName", ",", "serviceName", ",", "err", ":=", "splitBrokerService", "(", "name", ")", "\n", "if", "err", "!=", "nil", "{", "return", "<mask>", "{", "}", ",", "err", "\n", "}", "\n", "client", ",", "err", ":=", "newBrokeredServiceClient", "(", "name", ")", "\n", "if", "err", "!=", "nil", "{", "return", "Service", "{", "}", ",", "err", "\n", "}", "\n", "s", ",", "_", ",", "err", ":=", "client", ".", "getService", "(", "serviceName", ",", "catalogName", ")", "\n", "return", "s", ",", "err", "\n", "}" ]
20,850
all-20851
[ "ArmForSwitch", "returns", "which", "field", "name", "should", "be", "used", "for", "storing", "the", "value", "for", "an", "instance", "of", "AllowTrustResult" ]
[ "func", "(", "u", "AllowTrustResult", ")", "ArmForSwitch", "(", "sw", "int32", ")", "(", "string", ",", "bool", ")", "{", "switch", "AllowTrustResultCode", "(", "sw", ")", "{", "case", "AllowTrustResultCodeAllowTrustSuccess", ":", "return", "\"", "\"", ",", "true", "\n", "default", ":", "return", "\"", "\"", ",", "<mask>", "\n", "}", "\n", "}" ]
20,851
all-20852
[ "RotateSecretRequest", "mocks", "base", "method" ]
[ "func", "(", "m", "*", "MockSecretsManagerAPI", ")", "RotateSecretRequest", "(", "arg0", "*", "secretsmanager", ".", "RotateSecretInput", ")", "(", "*", "<mask>", ".", "Request", ",", "*", "secretsmanager", ".", "RotateSecretOutput", ")", "{", "ret", ":=", "m", ".", "ctrl", ".", "Call", "(", "m", ",", "\"", "\"", ",", "arg0", ")", "\n", "ret0", ",", "_", ":=", "ret", "[", "0", "]", ".", "(", "*", "request", ".", "Request", ")", "\n", "ret1", ",", "_", ":=", "ret", "[", "1", "]", ".", "(", "*", "secretsmanager", ".", "RotateSecretOutput", ")", "\n", "return", "ret0", ",", "ret1", "\n", "}" ]
20,852
all-20853
[ "GetRandomPasswordRequest", "mocks", "base", "method" ]
[ "func", "(", "m", "*", "MockSecretsManagerAPI", ")", "GetRandomPasswordRequest", "(", "arg0", "*", "secretsmanager", ".", "GetRandomPasswordInput", ")", "(", "*", "request", ".", "Request", ",", "*", "secretsmanager", ".", "GetRandomPasswordOutput", ")", "{", "ret", ":=", "m", ".", "ctrl", ".", "Call", "(", "m", ",", "\"", "\"", ",", "arg0", ")", "\n", "ret0", ",", "_", ":=", "ret", "[", "0", "]", ".", "(", "*", "<mask>", ".", "Request", ")", "\n", "ret1", ",", "_", ":=", "ret", "[", "1", "]", ".", "(", "*", "secretsmanager", ".", "GetRandomPasswordOutput", ")", "\n", "return", "ret0", ",", "ret1", "\n", "}" ]
20,853
all-20854
[ "Address", "returns", "the", "strkey", "encoded", "form", "of", "this", "AccountId", ".", "This", "method", "will", "panic", "if", "the", "accountid", "is", "backed", "by", "a", "public", "key", "of", "an", "unknown", "type", "." ]
[ "func", "(", "aid", "*", "AccountId", ")", "Address", "(", ")", "string", "{", "if", "aid", "==", "nil", "{", "return", "\"", "\"", "\n", "}", "\n\n", "<mask>", "aid", ".", "Type", "{", "case", "CryptoKeyTypeKeyTypeEd25519", ":", "ed", ":=", "aid", ".", "MustEd25519", "(", ")", "\n", "raw", ":=", "make", "(", "[", "]", "byte", ",", "32", ")", "\n", "copy", "(", "raw", ",", "ed", "[", ":", "]", ")", "\n", "return", "strkey", ".", "MustEncode", "(", "strkey", ".", "VersionByteAccountID", ",", "raw", ")", "\n", "default", ":", "panic", "(", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "aid", ".", "Type", ")", ")", "\n", "}", "\n", "}" ]
20,854
all-20855
[ "title", ":", "token", "list", "path", ":", "/", "tokens", "method", ":", "GET", "produce", ":", "application", "/", "json", "responses", ":", "200", ":", "List", "tokens", "204", ":", "No", "content", "401", ":", "Unauthorized" ]
[ "func", "tokenList", "(", "w", "http", ".", "ResponseWriter", ",", "r", "*", "<mask>", ".", "Request", ",", "t", "auth", ".", "Token", ")", "error", "{", "tokens", ",", "err", ":=", "servicemanager", ".", "TeamToken", ".", "FindByUserToken", "(", "t", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "if", "len", "(", "tokens", ")", "==", "0", "{", "w", ".", "WriteHeader", "(", "http", ".", "StatusNoContent", ")", "\n", "return", "nil", "\n", "}", "\n", "w", ".", "Header", "(", ")", ".", "Set", "(", "\"", "\"", ",", "\"", "\"", ")", "\n", "return", "json", ".", "NewEncoder", "(", "w", ")", ".", "Encode", "(", "tokens", ")", "\n", "}" ]
20,855
all-20856
[ "HasTriggeringValue", "returns", "a", "boolean", "if", "a", "field", "has", "been", "set", "." ]
[ "func", "(", "g", "*", "GroupData", ")", "HasTriggeringValue", "(", ")", "bool", "{", "if", "g", "!=", "nil", "&&", "g", ".", "TriggeringValue", "!=", "nil", "{", "return", "true", "\n", "}", "\n\n", "return", "<mask>", "\n", "}" ]
20,856
all-20857
[ "Place", "moves", "the", "cursor", "to", "the", "absolute", "array", "index", "specified", "by", "position" ]
[ "func", "(", "c", "*", "Cursor", ")", "Place", "(", "position", "int", ")", "{", "c", ".", "Position", "=", "<mask>", "\n", "c", ".", "correctPosition", "(", ")", "\n", "}" ]
20,857
all-20858
[ "String", "returns", "the", "name", "of", "e" ]
[ "func", "(", "e", "EnvelopeType", ")", "String", "(", ")", "string", "{", "<mask>", ",", "_", ":=", "envelopeTypeMap", "[", "int32", "(", "e", ")", "]", "\n", "return", "name", "\n", "}" ]
20,858
all-20859
[ "KeepAlive", "is", "meant", "to", "run", "as", "a", "goroutine", ".", "It", "sends", "a", "single", "whitespace", "character", "to", "HipChat", "every", "60", "seconds", ".", "This", "keeps", "the", "connection", "from", "idling", "after", "150", "seconds", "." ]
[ "func", "(", "c", "*", "Client", ")", "KeepAlive", "(", ")", "{", "for", "_", "=", "range", "time", ".", "Tick", "(", "60", "*", "time", ".", "Second", ")", "{", "c", ".", "<mask>", ".", "KeepAlive", "(", ")", "\n", "}", "\n", "}" ]
20,859
all-20860
[ "Private", "function", "for", "now" ]
[ "func", "(", "n", "*", "node", ")", "printDebug", "(", "level", "int", ")", "{", "level", "++", "\n", "// *splat branch", "if", "n", ".", "SplatChild", "!=", "nil", "{", "printFPadding", "(", "level", ",", "\"", "\\n", "\"", ")", "\n", "n", ".", "SplatChild", ".", "printDebug", "(", "level", ")", "\n", "}", "\n", "// :param branch", "if", "n", ".", "ParamChild", "!=", "nil", "{", "printFPadding", "(", "level", ",", "\"", "\\n", "\"", ")", "\n", "n", ".", "ParamChild", ".", "printDebug", "(", "level", ")", "\n", "}", "\n", "// #param branch", "if", "n", ".", "RelaxedChild", "!=", "nil", "{", "printFPadding", "(", "<mask>", ",", "\"", "\\n", "\"", ")", "\n", "n", ".", "RelaxedChild", ".", "printDebug", "(", "level", ")", "\n", "}", "\n", "// main branch", "for", "key", ",", "node", ":=", "range", "n", ".", "Children", "{", "printFPadding", "(", "level", ",", "\"", "\\\"", "\\\"", "\\n", "\"", ",", "key", ")", "\n", "node", ".", "printDebug", "(", "level", ")", "\n", "}", "\n", "}" ]
20,860
all-20861
[ "StoragePoolVolumesGetType", "get", "all", "storage", "volumes", "attached", "to", "a", "given", "storage", "pool", "of", "a", "given", "volume", "type", "on", "the", "given", "node", "." ]
[ "func", "(", "c", "*", "Cluster", ")", "StoragePoolVolumesGetType", "(", "project", "string", ",", "volumeType", "int", ",", "poolID", ",", "nodeID", "int64", ")", "(", "[", "]", "string", ",", "error", ")", "{", "var", "poolName", "string", "\n", "query", ":=", "`\nSELECT storage_volumes.name\n FROM storage_volumes\n JOIN projects ON projects.id=storage_volumes.project_id\n WHERE (projects.name=? OR storage_volumes.type=?) AND storage_pool_id=? AND node_id=? AND type=?\n`", "\n", "inargs", ":=", "[", "]", "interface", "{", "}", "{", "project", ",", "StoragePoolVolumeTypeCustom", ",", "poolID", ",", "nodeID", ",", "volumeType", "}", "\n", "outargs", ":=", "[", "]", "interface", "{", "}", "{", "poolName", "}", "\n\n", "result", ",", "err", ":=", "queryScan", "(", "c", ".", "db", ",", "query", ",", "inargs", ",", "outargs", ")", "\n", "if", "err", "!=", "nil", "{", "return", "[", "]", "string", "{", "}", ",", "err", "\n", "}", "\n\n", "response", ":=", "[", "]", "string", "{", "}", "\n", "for", "_", ",", "r", ":=", "range", "result", "{", "<mask>", "=", "append", "(", "response", ",", "r", "[", "0", "]", ".", "(", "string", ")", ")", "\n", "}", "\n\n", "return", "response", ",", "nil", "\n", "}" ]
20,861
all-20862
[ "title", ":", "service", "create", "path", ":", "/", "services", "method", ":", "POST", "consume", ":", "application", "/", "x", "-", "www", "-", "form", "-", "urlencoded", "responses", ":", "201", ":", "Service", "created", "400", ":", "Invalid", "data", "401", ":", "Unauthorized", "409", ":", "Service", "already", "exists" ]
[ "func", "serviceCreate", "(", "w", "http", ".", "ResponseWriter", ",", "r", "*", "http", ".", "Request", ",", "t", "auth", ".", "Token", ")", "(", "err", "error", ")", "{", "s", ":=", "service", ".", "Service", "{", "Name", ":", "InputValue", "(", "r", ",", "\"", "\"", ")", ",", "Username", ":", "InputValue", "(", "r", ",", "\"", "\"", ")", ",", "Endpoint", ":", "map", "[", "string", "]", "string", "{", "\"", "\"", ":", "InputValue", "(", "r", ",", "\"", "\"", ")", "}", ",", "Password", ":", "InputValue", "(", "r", ",", "\"", "\"", ")", ",", "}", "\n", "team", ":=", "InputValue", "(", "r", ",", "\"", "\"", ")", "\n", "if", "team", "==", "\"", "\"", "{", "team", ",", "err", "=", "permission", ".", "TeamForPermission", "(", "t", ",", "permission", ".", "PermServiceCreate", ")", "\n", "if", "err", "==", "permission", ".", "ErrTooManyTeams", "{", "return", "&", "errors", ".", "HTTP", "{", "Code", ":", "http", ".", "StatusBadRequest", ",", "Message", ":", "\"", "\"", ",", "}", "\n", "}", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "}", "\n", "s", ".", "OwnerTeams", "=", "[", "]", "string", "{", "team", "}", "\n", "allowed", ":=", "permission", ".", "Check", "(", "t", ",", "permission", ".", "PermServiceCreate", ",", "permission", ".", "<mask>", "(", "permTypes", ".", "CtxTeam", ",", "s", ".", "OwnerTeams", "[", "0", "]", ")", ",", ")", "\n", "if", "!", "allowed", "{", "return", "permission", ".", "ErrUnauthorized", "\n", "}", "\n", "delete", "(", "r", ".", "Form", ",", "\"", "\"", ")", "\n", "evt", ",", "err", ":=", "event", ".", "New", "(", "&", "event", ".", "Opts", "{", "Target", ":", "serviceTarget", "(", "s", ".", "Name", ")", ",", "Kind", ":", "permission", ".", "PermServiceCreate", ",", "Owner", ":", "t", ",", "CustomData", ":", "event", ".", "FormToCustomData", "(", "InputFields", "(", "r", ")", ")", ",", "Allowed", ":", "event", ".", "Allowed", "(", "permission", ".", "PermServiceReadEvents", ",", "contextsForServiceProvision", "(", "&", "s", ")", "...", ")", ",", "}", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "defer", "func", "(", ")", "{", "evt", ".", "Done", "(", "err", ")", "}", "(", ")", "\n", "err", "=", "service", ".", "Create", "(", "s", ")", "\n", "if", "err", "!=", "nil", "{", "if", "err", "==", "service", ".", "ErrServiceAlreadyExists", "{", "return", "&", "errors", ".", "HTTP", "{", "Code", ":", "http", ".", "StatusConflict", ",", "Message", ":", "err", ".", "Error", "(", ")", "}", "\n", "}", "\n", "return", "err", "\n", "}", "\n", "w", ".", "WriteHeader", "(", "http", ".", "StatusCreated", ")", "\n", "fmt", ".", "Fprint", "(", "w", ",", "\"", "\"", ")", "\n", "return", "nil", "\n", "}" ]
20,862
all-20863
[ "With", "returns", "a", "copy", "of", "c", "that", "uses", "session", "s", "." ]
[ "func", "(", "c", "*", "Collection", ")", "With", "(", "s", "*", "Session", ")", "*", "Collection", "{", "newdb", ":=", "*", "c", ".", "<mask>", "\n", "newdb", ".", "Session", "=", "s", "\n", "newc", ":=", "*", "c", "\n", "newc", ".", "Database", "=", "&", "newdb", "\n", "return", "&", "newc", "\n", "}" ]
20,863
all-20864
[ "string" ]
[ "func", "convertNvString", "(", "v", "<mask>", "{", "}", ")", "(", "driver", ".", "Value", ",", "error", ")", "{", "if", "v", "==", "nil", "{", "return", "v", ",", "nil", "\n", "}", "\n\n", "switch", "v", ":=", "v", ".", "(", "type", ")", "{", "case", "string", ",", "[", "]", "byte", ":", "return", "v", ",", "nil", "\n", "}", "\n\n", "rv", ":=", "reflect", ".", "ValueOf", "(", "v", ")", "\n\n", "switch", "rv", ".", "Kind", "(", ")", "{", "case", "reflect", ".", "String", ":", "return", "rv", ".", "String", "(", ")", ",", "nil", "\n\n", "case", "reflect", ".", "Slice", ":", "if", "rv", ".", "Type", "(", ")", "==", "typeOfBytes", "{", "return", "rv", ".", "Bytes", "(", ")", ",", "nil", "\n", "}", "\n\n", "case", "reflect", ".", "Ptr", ":", "// indirect pointers", "if", "rv", ".", "IsNil", "(", ")", "{", "return", "nil", ",", "nil", "\n", "}", "\n", "return", "convertNvString", "(", "rv", ".", "Elem", "(", ")", ".", "Interface", "(", ")", ")", "\n", "}", "\n\n", "if", "rv", ".", "Type", "(", ")", ".", "ConvertibleTo", "(", "typeOfBytes", ")", "{", "bv", ":=", "rv", ".", "Convert", "(", "typeOfBytes", ")", "\n", "return", "bv", ".", "Interface", "(", ")", ".", "(", "[", "]", "byte", ")", ",", "nil", "\n", "}", "\n\n", "return", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "v", ")", "\n", "}" ]
20,864
all-20865
[ "Print", "the", "most", "recent", "inner", "type", ".", "If", "save", "is", "not", "nil", "only", "print", "prefixes", "." ]
[ "func", "(", "ps", "*", "printState", ")", "printOneInner", "(", "save", "*", "[", "]", "AST", ")", "{", "if", "len", "(", "ps", ".", "inner", ")", "==", "0", "{", "panic", "(", "\"", "\"", ")", "\n", "}", "\n", "ln", ":=", "len", "(", "ps", ".", "inner", ")", "\n", "a", ":=", "ps", ".", "inner", "[", "ln", "-", "1", "]", "\n", "ps", ".", "inner", "=", "ps", ".", "inner", "[", ":", "ln", "-", "1", "]", "\n\n", "if", "save", "!=", "nil", "{", "if", "_", ",", "ok", ":=", "a", ".", "(", "*", "MethodWithQualifiers", ")", ";", "<mask>", "{", "*", "save", "=", "append", "(", "*", "save", ",", "a", ")", "\n", "return", "\n", "}", "\n", "}", "\n\n", "if", "ip", ",", "ok", ":=", "a", ".", "(", "innerPrinter", ")", ";", "ok", "{", "ip", ".", "printInner", "(", "ps", ")", "\n", "}", "else", "{", "ps", ".", "print", "(", "a", ")", "\n", "}", "\n", "}" ]
20,865
all-20866
[ "PTCIncreaseApproval", "calls", "increaseApproval", "method", "of", "Privatix", "token", "contract", "." ]
[ "func", "(", "b", "*", "backendInstance", ")", "PTCIncreaseApproval", "(", "opts", "*", "bind", ".", "TransactOpts", ",", "spender", "common", ".", "Address", ",", "addedVal", "*", "big", ".", "Int", ")", "(", "*", "<mask>", ".", "Transaction", ",", "error", ")", "{", "ctx2", ",", "cancel", ":=", "b", ".", "addTimeout", "(", "opts", ".", "Context", ")", "\n", "defer", "cancel", "(", ")", "\n\n", "opts", ".", "Context", "=", "ctx2", "\n\n", "tx", ",", "err", ":=", "b", ".", "ptc", ".", "IncreaseApproval", "(", "opts", ",", "spender", ",", "addedVal", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "err", ")", "\n", "}", "\n", "return", "tx", ",", "nil", "\n", "}" ]
20,866
all-20867
[ "squashCgoLibrary", "removes", "cgo_library", "rules", "with", "the", "default", "name", "and", "merges", "their", "attributes", "with", "go_library", "with", "the", "default", "name", ".", "If", "no", "go_library", "rule", "exists", "a", "new", "one", "will", "be", "created", ".", "Note", "that", "the", "library", "attribute", "is", "disregarded", "so", "cgo_library", "and", "go_library", "attributes", "will", "be", "squashed", "even", "if", "the", "cgo_library", "was", "unlinked", ".", "MergeFile", "will", "remove", "unused", "values", "and", "attributes", "later", "." ]
[ "func", "squashCgoLibrary", "(", "c", "*", "config", ".", "Config", ",", "f", "*", "rule", ".", "File", ")", "{", "// Find the default cgo_library and go_library rules.", "var", "cgoLibrary", ",", "goLibrary", "*", "rule", ".", "Rule", "\n", "for", "_", ",", "r", ":=", "range", "f", ".", "Rules", "{", "if", "r", ".", "Kind", "(", ")", "==", "\"", "\"", "&&", "r", ".", "Name", "(", ")", "==", "\"", "\"", "&&", "!", "r", ".", "ShouldKeep", "(", ")", "{", "if", "cgoLibrary", "!=", "nil", "{", "log", ".", "Printf", "(", "\"", "\"", ",", "f", ".", "Path", ")", "\n", "continue", "\n", "}", "\n", "cgoLibrary", "=", "r", "\n", "continue", "\n", "}", "\n", "if", "r", ".", "Kind", "(", ")", "==", "\"", "\"", "&&", "r", ".", "Name", "(", ")", "==", "defaultLibName", "{", "if", "goLibrary", "!=", "nil", "{", "log", ".", "Printf", "(", "\"", "\"", ",", "f", ".", "Path", ")", "\n", "}", "\n", "goLibrary", "=", "r", "\n", "<mask>", "\n", "}", "\n", "}", "\n\n", "if", "cgoLibrary", "==", "nil", "{", "return", "\n", "}", "\n", "if", "!", "c", ".", "ShouldFix", "{", "log", ".", "Printf", "(", "\"", "\"", ",", "f", ".", "Path", ")", "\n", "return", "\n", "}", "\n\n", "if", "goLibrary", "==", "nil", "{", "cgoLibrary", ".", "SetKind", "(", "\"", "\"", ")", "\n", "cgoLibrary", ".", "SetName", "(", "defaultLibName", ")", "\n", "cgoLibrary", ".", "SetAttr", "(", "\"", "\"", ",", "true", ")", "\n", "return", "\n", "}", "\n\n", "if", "err", ":=", "rule", ".", "SquashRules", "(", "cgoLibrary", ",", "goLibrary", ",", "f", ".", "Path", ")", ";", "err", "!=", "nil", "{", "log", ".", "Print", "(", "err", ")", "\n", "return", "\n", "}", "\n", "goLibrary", ".", "DelAttr", "(", "\"", "\"", ")", "\n", "goLibrary", ".", "SetAttr", "(", "\"", "\"", ",", "true", ")", "\n", "cgoLibrary", ".", "Delete", "(", ")", "\n", "}" ]
20,867
all-20868
[ "non", "-", "blocking", "push" ]
[ "func", "(", "s", "*", "State", ")", "gopush", "(", ")", "{", "s", ".", "push", ".", "mut", ".", "Lock", "(", ")", "\n", "t0", ":=", "time", ".", "Now", "(", ")", "\n", "//queue cleanup", "defer", "func", "(", ")", "{", "//measure time passed, ensure we wait at least Throttle time", "tdelta", ":=", "time", ".", "Now", "(", ")", ".", "Sub", "(", "t0", ")", "\n", "if", "t", ":=", "s", ".", "Throttle", "-", "tdelta", ";", "t", ">", "0", "{", "<mask>", ".", "Sleep", "(", "t", ")", "\n", "}", "\n", "//push complete", "s", ".", "push", ".", "mut", ".", "Unlock", "(", ")", "\n", "atomic", ".", "StoreUint32", "(", "&", "s", ".", "push", ".", "ing", ",", "0", ")", "\n", "//if queued, auto-push again", "if", "atomic", ".", "CompareAndSwapUint32", "(", "&", "s", ".", "push", ".", "queued", ",", "1", ",", "0", ")", "{", "s", ".", "Push", "(", ")", "\n", "}", "\n", "}", "(", ")", "\n", "//calculate new json state", "l", ",", "hasLock", ":=", "s", ".", "gostruct", ".", "(", "sync", ".", "Locker", ")", "\n", "if", "hasLock", "{", "l", ".", "Lock", "(", ")", "\n", "}", "\n", "newBytes", ",", "err", ":=", "json", ".", "Marshal", "(", "s", ".", "gostruct", ")", "\n", "if", "hasLock", "{", "l", ".", "Unlock", "(", ")", "\n", "}", "\n", "if", "err", "!=", "nil", "{", "log", ".", "Printf", "(", "\"", "\"", ",", "err", ")", "\n", "return", "\n", "}", "\n", "//if changed, then calculate change set", "if", "!", "bytes", ".", "Equal", "(", "s", ".", "data", ".", "bytes", ",", "newBytes", ")", "{", "//calculate change set from last version", "ops", ",", "_", ":=", "jsonpatch", ".", "CreatePatch", "(", "s", ".", "data", ".", "bytes", ",", "newBytes", ")", "\n", "if", "len", "(", "s", ".", "data", ".", "bytes", ")", ">", "0", "&&", "len", "(", "ops", ")", ">", "0", "{", "//changes! bump version", "s", ".", "data", ".", "mut", ".", "Lock", "(", ")", "\n", "s", ".", "data", ".", "delta", ",", "_", "=", "json", ".", "Marshal", "(", "ops", ")", "\n", "s", ".", "data", ".", "bytes", "=", "newBytes", "\n", "s", ".", "data", ".", "version", "++", "\n", "s", ".", "data", ".", "mut", ".", "Unlock", "(", ")", "\n", "}", "\n", "}", "\n", "//send this new change to each subscriber", "s", ".", "connMut", ".", "Lock", "(", ")", "\n", "for", "_", ",", "c", ":=", "range", "s", ".", "conns", "{", "if", "c", ".", "version", "!=", "s", ".", "data", ".", "version", "{", "go", "c", ".", "push", "(", ")", "\n", "}", "\n", "}", "\n", "s", ".", "connMut", ".", "Unlock", "(", ")", "\n", "//defered cleanup()", "}" ]
20,868
all-20869
[ "WithHeaders", "returns", "a", "Context", "that", "can", "be", "used", "to", "make", "a", "call", "with", "request", "headers", "." ]
[ "func", "WithHeaders", "(", "ctx", "<mask>", ".", "Context", ",", "headers", "map", "[", "string", "]", "string", ")", "Context", "{", "return", "tchannel", ".", "WrapWithHeaders", "(", "ctx", ",", "headers", ")", "\n", "}" ]
20,869
all-20870
[ "InstallSnapshot", "implements", "the", "Transport", "interface", "." ]
[ "func", "(", "n", "*", "NetworkTransport", ")", "InstallSnapshot", "(", "id", "ServerID", ",", "target", "ServerAddress", ",", "args", "*", "InstallSnapshotRequest", ",", "resp", "*", "InstallSnapshotResponse", ",", "data", "io", ".", "Reader", ")", "error", "{", "// Get a conn, always close for InstallSnapshot", "<mask>", ",", "err", ":=", "n", ".", "getConnFromAddressProvider", "(", "id", ",", "target", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "defer", "conn", ".", "Release", "(", ")", "\n\n", "// Set a deadline, scaled by request size", "if", "n", ".", "timeout", ">", "0", "{", "timeout", ":=", "n", ".", "timeout", "*", "time", ".", "Duration", "(", "args", ".", "Size", "/", "int64", "(", "n", ".", "TimeoutScale", ")", ")", "\n", "if", "timeout", "<", "n", ".", "timeout", "{", "timeout", "=", "n", ".", "timeout", "\n", "}", "\n", "conn", ".", "conn", ".", "SetDeadline", "(", "time", ".", "Now", "(", ")", ".", "Add", "(", "timeout", ")", ")", "\n", "}", "\n\n", "// Send the RPC", "if", "err", "=", "sendRPC", "(", "conn", ",", "rpcInstallSnapshot", ",", "args", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "// Stream the state", "if", "_", ",", "err", "=", "io", ".", "Copy", "(", "conn", ".", "w", ",", "data", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "// Flush", "if", "err", "=", "conn", ".", "w", ".", "Flush", "(", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "// Decode the response, do not return conn", "_", ",", "err", "=", "decodeResponse", "(", "conn", ",", "resp", ")", "\n", "return", "err", "\n", "}" ]
20,870
all-20871
[ "setBrancherRegexes", "compiles", "and", "validates", "all", "the", "regular", "expressions", "for", "the", "provided", "branch", "specifiers", "." ]
[ "func", "setBrancherRegexes", "(", "br", "Brancher", ")", "(", "Brancher", ",", "error", ")", "{", "if", "len", "(", "br", ".", "Branches", ")", ">", "0", "{", "if", "re", ",", "err", ":=", "regexp", ".", "Compile", "(", "strings", ".", "Join", "(", "br", ".", "Branches", ",", "`|`", ")", ")", ";", "err", "==", "nil", "{", "br", ".", "re", "=", "re", "\n", "}", "else", "{", "return", "br", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "err", ")", "\n", "}", "\n", "}", "\n", "if", "len", "(", "br", ".", "SkipBranches", ")", ">", "0", "{", "if", "re", ",", "err", ":=", "regexp", ".", "Compile", "(", "strings", ".", "Join", "(", "br", ".", "SkipBranches", ",", "`|`", ")", ")", ";", "err", "==", "nil", "{", "br", ".", "reSkip", "=", "re", "\n", "}", "else", "{", "return", "<mask>", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "err", ")", "\n", "}", "\n", "}", "\n", "return", "br", ",", "nil", "\n", "}" ]
20,871
all-20872
[ "UpdateBytes", "updates", "uri", ".", "The", "following", "newURI", "types", "are", "accepted", ":", "*", "Absolute", "i", ".", "e", ".", "http", ":", "//", "foobar", ".", "com", "/", "aaa", "/", "bb?cc", ".", "In", "this", "case", "the", "original", "uri", "is", "replaced", "by", "newURI", ".", "*", "Absolute", "without", "scheme", "i", ".", "e", ".", "//", "foobar", ".", "com", "/", "aaa", "/", "bb?cc", ".", "In", "this", "case", "the", "original", "scheme", "is", "preserved", ".", "*", "Missing", "host", "i", ".", "e", ".", "/", "aaa", "/", "bb?cc", ".", "In", "this", "case", "only", "RequestURI", "part", "of", "the", "original", "uri", "is", "replaced", ".", "*", "Relative", "path", "i", ".", "e", ".", "xx?yy", "=", "abc", ".", "In", "this", "case", "the", "original", "RequestURI", "is", "updated", "according", "to", "the", "new", "relative", "path", "." ]
[ "func", "(", "u", "*", "URI", ")", "UpdateBytes", "(", "newURI", "[", "]", "<mask>", ")", "{", "u", ".", "requestURI", "=", "u", ".", "updateBytes", "(", "newURI", ",", "u", ".", "requestURI", ")", "\n", "}" ]
20,872
all-20873
[ "GrantPermissions", "grant", "specific", "permissions", "to", "the", "given", "origin", "and", "reject", "all", "others", ".", "See", ":", "https", ":", "//", "chromedevtools", ".", "github", ".", "io", "/", "devtools", "-", "protocol", "/", "tot", "/", "Browser#method", "-", "grantPermissions", "parameters", ":", "origin", "permissions" ]
[ "func", "GrantPermissions", "(", "<mask>", "string", ",", "permissions", "[", "]", "PermissionType", ")", "*", "GrantPermissionsParams", "{", "return", "&", "GrantPermissionsParams", "{", "Origin", ":", "origin", ",", "Permissions", ":", "permissions", ",", "}", "\n", "}" ]
20,873
all-20874
[ "Load", "indicates", "an", "expected", "call", "of", "Load" ]
[ "func", "(", "mr", "*", "MockCgroupFactoryMockRecorder", ")", "Load", "(", "arg0", ",", "arg1", "<mask>", "{", "}", ")", "*", "gomock", ".", "Call", "{", "return", "mr", ".", "mock", ".", "ctrl", ".", "RecordCallWithMethodType", "(", "mr", ".", "mock", ",", "\"", "\"", ",", "reflect", ".", "TypeOf", "(", "(", "*", "MockCgroupFactory", ")", "(", "nil", ")", ".", "Load", ")", ",", "arg0", ",", "arg1", ")", "\n", "}" ]
20,874
all-20875
[ "Where", "iterates", "over", "a", "list", "and", "returns", "only", "the", "elements", "that", "satisfy", "a", "predicate", "." ]
[ "func", "(", "iter", "Enumerator", ")", "Where", "(", "predicate", "Predicate", ")", "Enumerator", "{", "retval", ":=", "make", "(", "chan", "interface", "{", "}", ")", "\n", "<mask>", "func", "(", ")", "{", "for", "item", ":=", "range", "iter", "{", "if", "predicate", "(", "item", ")", "{", "retval", "<-", "item", "\n", "}", "\n", "}", "\n", "close", "(", "retval", ")", "\n", "}", "(", ")", "\n\n", "return", "retval", "\n", "}" ]
20,875
all-20876
[ "Match", "processes", "the", "given", "string", "until", "it", "has", "its", "suffix", "in", "the", "next", "or", "encounters", "a", "rune", "that", "doesn", "t", "match", "." ]
[ "func", "(", "m", "*", "SuffixMatcher", ")", "Match", "(", "str", "string", ")", "(", "<mask>", "int", ",", "matchStr", "string", ")", "{", "offset", "=", "-", "1", "\n\n", "// at least 1 character is required to match suffix and matcher", "d", ":=", "len", "(", "str", ")", "-", "len", "(", "m", ".", "suffix", ")", "\n", "if", "d", "<", "1", "{", "return", "\n", "}", "\n\n", "for", "i", ",", "r", ":=", "range", "str", "{", "if", "i", ">", "d", "{", "return", "\n", "}", "\n\n", "// peek string to match to suffix pattern", "if", "i", "!=", "0", "&&", "m", ".", "suffix", "==", "str", "[", "i", ":", "i", "+", "len", "(", "m", ".", "suffix", ")", "]", "{", "offset", "=", "i", "+", "len", "(", "m", ".", "suffix", ")", "\n", "matchStr", "=", "str", "[", ":", "i", "]", "\n", "return", "\n", "}", "\n\n", "if", "!", "m", ".", "matcher", ".", "MatchRune", "(", "r", ")", "{", "return", "\n", "}", "\n", "}", "\n", "return", "\n", "}" ]
20,876
all-20877
[ "Dump", "-", "will", "dump", "a", "mysql", "to", "the", "given", "writer" ]
[ "func", "(", "s", "*", "MysqlDump", ")", "Dump", "(", "<mask>", "io", ".", "Writer", ")", "(", "err", "error", ")", "{", "err", "=", "s", ".", "Caller", ".", "Execute", "(", "dest", ",", "s", ".", "getDumpCommand", "(", ")", ")", "\n", "lo", ".", "G", ".", "Debug", "(", "\"", "\"", ")", "\n", "return", "\n", "}" ]
20,877
all-20878
[ "return", "a", "compressed", "texture", "image" ]
[ "func", "GetCompressedTextureImage", "(", "texture", "uint32", ",", "level", "int32", ",", "bufSize", "int32", ",", "pixels", "unsafe", ".", "Pointer", ")", "{", "syscall", ".", "Syscall6", "(", "gpGetCompressedTextureImage", ",", "4", ",", "uintptr", "(", "texture", ")", ",", "uintptr", "(", "<mask>", ")", ",", "uintptr", "(", "bufSize", ")", ",", "uintptr", "(", "pixels", ")", ",", "0", ",", "0", ")", "\n", "}" ]
20,878
all-20879
[ "SetStyleSheetText", "sets", "the", "new", "stylesheet", "text", ".", "See", ":", "https", ":", "//", "chromedevtools", ".", "github", ".", "io", "/", "devtools", "-", "protocol", "/", "tot", "/", "CSS#method", "-", "setStyleSheetText", "parameters", ":", "styleSheetID", "text" ]
[ "func", "SetStyleSheetText", "(", "styleSheetID", "StyleSheetID", ",", "<mask>", "string", ")", "*", "SetStyleSheetTextParams", "{", "return", "&", "SetStyleSheetTextParams", "{", "StyleSheetID", ":", "styleSheetID", ",", "Text", ":", "text", ",", "}", "\n", "}" ]
20,879
all-20880
[ "SyncConfig", "syncs", "current", "cronAgent", "with", "current", "prow", "config", "which", "add", "/", "delete", "jobs", "accordingly", "." ]
[ "func", "(", "c", "*", "Cron", ")", "SyncConfig", "(", "cfg", "*", "config", ".", "Config", ")", "error", "{", "c", ".", "lock", ".", "Lock", "(", ")", "\n", "defer", "c", ".", "<mask>", ".", "Unlock", "(", ")", "\n\n", "for", "_", ",", "p", ":=", "range", "cfg", ".", "Periodics", "{", "if", "err", ":=", "c", ".", "addPeriodic", "(", "p", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "}", "\n\n", "periodicNames", ":=", "sets", ".", "NewString", "(", ")", "\n", "for", "_", ",", "p", ":=", "range", "cfg", ".", "AllPeriodics", "(", ")", "{", "periodicNames", ".", "Insert", "(", "p", ".", "Name", ")", "\n", "}", "\n\n", "existing", ":=", "sets", ".", "NewString", "(", ")", "\n", "for", "k", ":=", "range", "c", ".", "jobs", "{", "existing", ".", "Insert", "(", "k", ")", "\n", "}", "\n\n", "var", "removalErrors", "[", "]", "error", "\n", "for", "_", ",", "job", ":=", "range", "existing", ".", "Difference", "(", "periodicNames", ")", ".", "List", "(", ")", "{", "if", "err", ":=", "c", ".", "removeJob", "(", "job", ")", ";", "err", "!=", "nil", "{", "removalErrors", "=", "append", "(", "removalErrors", ",", "err", ")", "\n", "}", "\n", "}", "\n\n", "return", "errorutil", ".", "NewAggregate", "(", "removalErrors", "...", ")", "\n", "}" ]
20,880
all-20881
[ "UnparsedInstance", "returns", "a", "types", ".", "UnparsedImage", "implementation", "for", "(", "source", "instanceDigest", ")", ".", "If", "instanceDigest", "is", "not", "nil", "it", "contains", "a", "digest", "of", "the", "specific", "manifest", "instance", "to", "retrieve", "(", "when", "the", "primary", "manifest", "is", "a", "manifest", "list", ")", ".", "The", "UnparsedImage", "must", "not", "be", "used", "after", "the", "underlying", "ImageSource", "is", "Close", "()", "d", "." ]
[ "func", "UnparsedInstance", "(", "src", "<mask>", ".", "ImageSource", ",", "instanceDigest", "*", "digest", ".", "Digest", ")", "*", "UnparsedImage", "{", "return", "&", "UnparsedImage", "{", "src", ":", "src", ",", "instanceDigest", ":", "instanceDigest", ",", "}", "\n", "}" ]
20,881
all-20882
[ "FileSize", "returns", "the", "size", "of", "a", "file", "or", "zero", "in", "case", "of", "an", "error", "." ]
[ "func", "FileSize", "(", "filename", "string", ")", "int64", "{", "info", ",", "err", ":=", "os", ".", "Stat", "(", "filename", ")", "\n", "if", "err", "!=", "nil", "{", "return", "0", "\n", "}", "\n", "return", "<mask>", ".", "Size", "(", ")", "\n", "}" ]
20,882
all-20883
[ "Context", "returns", "a", "new", "context", "with", "the", "latest", "span", "stored", "as", "a", "reference", "for", "handlers", "that", "will", "call", "NewTracerFromRequest", "or", "similar", "." ]
[ "func", "(", "t", "*", "Tracer", ")", "Context", "(", "ctx", "<mask>", ".", "Context", ")", "context", ".", "Context", "{", "return", "opentracing", ".", "ContextWithSpan", "(", "ctx", ",", "t", ".", "Last", "(", ")", ")", "\n", "}" ]
20,883
all-20884
[ "getStructCodec", "returns", "the", "structCodec", "for", "the", "given", "struct", "type", "." ]
[ "func", "getStructCodec", "(", "t", "reflect", ".", "<mask>", ")", "(", "*", "structCodec", ",", "error", ")", "{", "structCodecsMutex", ".", "Lock", "(", ")", "\n", "defer", "structCodecsMutex", ".", "Unlock", "(", ")", "\n", "return", "getStructCodecLocked", "(", "t", ")", "\n", "}" ]
20,884
all-20885
[ "SetMediaType", "()", "is", "a", "wrapper", "around", "gtk_print_settings_set_media_type", "()", "." ]
[ "func", "(", "<mask>", "*", "PrintSettings", ")", "SetMediaType", "(", "mediaType", "string", ")", "{", "cstr", ":=", "C", ".", "CString", "(", "mediaType", ")", "\n", "defer", "C", ".", "free", "(", "unsafe", ".", "Pointer", "(", "cstr", ")", ")", "\n", "C", ".", "gtk_print_settings_set_media_type", "(", "ps", ".", "native", "(", ")", ",", "(", "*", "C", ".", "gchar", ")", "(", "cstr", ")", ")", "\n", "}" ]
20,885
all-20886
[ "MergeAttrs", "accepts", "another", "existing", "Attrs", "and", "merges", "the", "attributes", "into", "its", "own", "." ]
[ "func", "(", "a", "*", "Attrs", ")", "MergeAttrs", "(", "attrs", "*", "Attrs", ")", "{", "if", "attrs", "==", "nil", "{", "return", "\n", "}", "\n", "a", ".", "attrsLock", ".", "Lock", "(", ")", "\n", "defer", "a", ".", "attrsLock", ".", "Unlock", "(", ")", "\n", "for", "hash", ",", "val", ":=", "range", "attrs", ".", "attrs", "{", "a", ".", "attrs", "[", "<mask>", "]", "=", "val", "\n", "}", "\n", "}" ]
20,886
all-20887
[ "FromSource", "returns", "a", "types", ".", "ImageCloser", "implementation", "for", "the", "default", "instance", "of", "source", ".", "If", "source", "is", "a", "manifest", "list", ".", "Manifest", "()", "still", "returns", "the", "manifest", "list", "but", "other", "methods", "transparently", "return", "data", "from", "an", "appropriate", "image", "instance", ".", "The", "caller", "must", "call", ".", "Close", "()", "on", "the", "returned", "ImageCloser", ".", "FromSource", "“takes", "ownership”", "of", "the", "input", "ImageSource", "and", "will", "call", "src", ".", "Close", "()", "when", "the", "image", "is", "closed", ".", "(", "This", "does", "not", "prevent", "callers", "from", "using", "both", "the", "Image", "and", "ImageSource", "objects", "simultaneously", "but", "it", "means", "that", "they", "only", "need", "to", "the", "Image", ".", ")", "NOTE", ":", "If", "any", "kind", "of", "signature", "verification", "should", "happen", "build", "an", "UnparsedImage", "from", "the", "value", "returned", "by", "NewImageSource", "verify", "that", "UnparsedImage", "and", "convert", "it", "into", "a", "real", "Image", "via", "image", ".", "FromUnparsedImage", "instead", "of", "calling", "this", "function", "." ]
[ "func", "FromSource", "(", "ctx", "context", ".", "<mask>", ",", "sys", "*", "types", ".", "SystemContext", ",", "src", "types", ".", "ImageSource", ")", "(", "types", ".", "ImageCloser", ",", "error", ")", "{", "img", ",", "err", ":=", "FromUnparsedImage", "(", "ctx", ",", "sys", ",", "UnparsedInstance", "(", "src", ",", "nil", ")", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "return", "&", "imageCloser", "{", "Image", ":", "img", ",", "src", ":", "src", ",", "}", ",", "nil", "\n", "}" ]
20,887
all-20888
[ "FinalHandler", "is", "a", "helper", "function", "to", "wrap", "the", "last", "http", ".", "Handler", "element", "in", "the", "ChainHandlers", "function", "." ]
[ "func", "FinalHandler", "(", "h", "http", ".", "Handler", ")", "func", "(", "http", ".", "<mask>", ")", "http", ".", "Handler", "{", "return", "func", "(", "_", "http", ".", "Handler", ")", "http", ".", "Handler", "{", "return", "h", "\n", "}", "\n", "}" ]
20,888
all-20889
[ "Update", "updates", "the", "bytes", "in", "the", "buffer" ]
[ "func", "(", "ref", "BytesRef", ")", "Update", "(", "b", "[", "]", "byte", ")", "{", "if", "ref", "!=", "nil", "{", "copy", "(", "<mask>", ",", "b", ")", "\n", "}", "\n", "}" ]
20,889
all-20890
[ "MarshalJSON", "supports", "json", ".", "Marshaler", "interface" ]
[ "func", "(", "v", "GetInstallabilityErrorsReturns", ")", "MarshalJSON", "(", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "w", ":=", "jwriter", ".", "Writer", "{", "}", "\n", "easyjsonC5a4559bEncodeGithubComChromedpCdprotoPage38", "(", "&", "w", ",", "v", ")", "\n", "return", "w", ".", "Buffer", ".", "BuildBytes", "(", ")", ",", "w", ".", "<mask>", "\n", "}" ]
20,890
all-20891
[ "Eventually", "is", "used", "to", "make", "asynchronous", "assertions", ".", "See", "documentation", "for", "Eventually", "." ]
[ "func", "(", "g", "*", "WithT", ")", "Eventually", "(", "actual", "<mask>", "{", "}", ",", "intervals", "...", "interface", "{", "}", ")", "AsyncAssertion", "{", "timeoutInterval", ":=", "defaultEventuallyTimeout", "\n", "pollingInterval", ":=", "defaultEventuallyPollingInterval", "\n", "if", "len", "(", "intervals", ")", ">", "0", "{", "timeoutInterval", "=", "toDuration", "(", "intervals", "[", "0", "]", ")", "\n", "}", "\n", "if", "len", "(", "intervals", ")", ">", "1", "{", "pollingInterval", "=", "toDuration", "(", "intervals", "[", "1", "]", ")", "\n", "}", "\n", "return", "asyncassertion", ".", "New", "(", "asyncassertion", ".", "AsyncAssertionTypeEventually", ",", "actual", ",", "testingtsupport", ".", "BuildTestingTGomegaFailWrapper", "(", "g", ".", "t", ")", ",", "timeoutInterval", ",", "pollingInterval", ",", "0", ")", "\n", "}" ]
20,891
all-20892
[ "Seek", "advances", "to", "the", "first", "entry", "with", "a", "key", ">", "=", "target", "." ]
[ "func", "(", "s", "*", "Iterator", ")", "Seek", "(", "target", "[", "]", "byte", ")", "{", "s", ".", "n", ",", "_", "=", "s", ".", "<mask>", ".", "findNear", "(", "target", ",", "false", ",", "true", ")", "// find >=.", "\n", "}" ]
20,892
all-20893
[ "CreateStoragePoolVolume", "defines", "a", "new", "storage", "volume" ]
[ "func", "(", "r", "*", "ProtocolLXD", ")", "CreateStoragePoolVolume", "(", "pool", "string", ",", "volume", "api", ".", "StorageVolumesPost", ")", "error", "{", "if", "!", "r", ".", "HasExtension", "(", "\"", "\"", ")", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\\\"", "\\\"", "\"", ")", "\n", "}", "\n\n", "// Send the request", "path", ":=", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "url", ".", "QueryEscape", "(", "pool", ")", ",", "<mask>", ".", "QueryEscape", "(", "volume", ".", "Type", ")", ")", "\n", "_", ",", "_", ",", "err", ":=", "r", ".", "query", "(", "\"", "\"", ",", "path", ",", "volume", ",", "\"", "\"", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "return", "nil", "\n", "}" ]
20,893
all-20894
[ "FromAbsolutePath", "returns", "an", "*", "object", ".", "Folder", "from", "a", "given", "absolute", "path", ".", "If", "no", "such", "folder", "is", "found", "an", "appropriate", "error", "will", "be", "returned", "." ]
[ "func", "FromAbsolutePath", "(", "client", "*", "govmomi", ".", "Client", ",", "path", "string", ")", "(", "*", "object", ".", "Folder", ",", "error", ")", "{", "finder", ":=", "find", ".", "NewFinder", "(", "client", ".", "<mask>", ",", "false", ")", "\n", "ctx", ",", "cancel", ":=", "context", ".", "WithTimeout", "(", "context", ".", "Background", "(", ")", ",", "provider", ".", "DefaultAPITimeout", ")", "\n", "defer", "cancel", "(", ")", "\n", "folder", ",", "err", ":=", "finder", ".", "Folder", "(", "ctx", ",", "path", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "return", "folder", ",", "nil", "\n", "}" ]
20,894
all-20895
[ "VerifyFormKV", "returns", "a", "handler", "that", "verifies", "a", "request", "contains", "a", "form", "key", "with", "the", "specified", "values", ".", "It", "is", "a", "convenience", "wrapper", "around", "VerifyForm", "that", "lets", "you", "avoid", "having", "to", "create", "a", "url", ".", "Values", "object", "." ]
[ "func", "VerifyFormKV", "(", "<mask>", "string", ",", "values", "...", "string", ")", "http", ".", "HandlerFunc", "{", "return", "VerifyForm", "(", "url", ".", "Values", "{", "key", ":", "values", "}", ")", "\n", "}" ]
20,895
all-20896
[ "LoadPivnetRelease", "creates", "an", "initialized", "pivnetRelease", "instance", "from", "the", "specified", ".", "pivotal", "file", "." ]
[ "func", "LoadPivnetRelease", "(", "releaseRepo", "pull", ".", "Release", ",", "path", "string", ")", "(", "release", "*", "PivnetRelease", ",", "err", "error", ")", "{", "<mask>", "=", "&", "PivnetRelease", "{", "}", "\n", "var", "localPath", "string", "\n", "localPath", ",", "err", "=", "releaseRepo", ".", "Pull", "(", "path", ")", "\n", "if", "err", "!=", "nil", "{", "return", "\n", "}", "\n", "release", "=", "&", "PivnetRelease", "{", "BoshRelease", ":", "make", "(", "map", "[", "string", "]", "*", "BoshRelease", ")", ",", "}", "\n", "err", "=", "release", ".", "readPivnetRelease", "(", "localPath", ")", "\n", "return", "\n", "}" ]
20,896
all-20897
[ "Get", "returns", "a", "peer", "for", "the", "given", "hostPort", "if", "it", "exists", "." ]
[ "func", "(", "l", "*", "RootPeerList", ")", "Get", "(", "hostPort", "string", ")", "(", "*", "Peer", ",", "bool", ")", "{", "l", ".", "RLock", "(", ")", "\n", "p", ",", "<mask>", ":=", "l", ".", "peersByHostPort", "[", "hostPort", "]", "\n", "l", ".", "RUnlock", "(", ")", "\n", "return", "p", ",", "ok", "\n", "}" ]
20,897
all-20898
[ "UnmarshalEasyJSON", "satisfies", "easyjson", ".", "Unmarshaler", "." ]
[ "func", "(", "t", "*", "TransitionType", ")", "UnmarshalEasyJSON", "(", "in", "*", "jlexer", ".", "Lexer", ")", "{", "switch", "TransitionType", "(", "in", ".", "String", "(", ")", ")", "{", "<mask>", "TransitionTypeLink", ":", "*", "t", "=", "TransitionTypeLink", "\n", "case", "TransitionTypeTyped", ":", "*", "t", "=", "TransitionTypeTyped", "\n", "case", "TransitionTypeAddressBar", ":", "*", "t", "=", "TransitionTypeAddressBar", "\n", "case", "TransitionTypeAutoBookmark", ":", "*", "t", "=", "TransitionTypeAutoBookmark", "\n", "case", "TransitionTypeAutoSubframe", ":", "*", "t", "=", "TransitionTypeAutoSubframe", "\n", "case", "TransitionTypeManualSubframe", ":", "*", "t", "=", "TransitionTypeManualSubframe", "\n", "case", "TransitionTypeGenerated", ":", "*", "t", "=", "TransitionTypeGenerated", "\n", "case", "TransitionTypeAutoToplevel", ":", "*", "t", "=", "TransitionTypeAutoToplevel", "\n", "case", "TransitionTypeFormSubmit", ":", "*", "t", "=", "TransitionTypeFormSubmit", "\n", "case", "TransitionTypeReload", ":", "*", "t", "=", "TransitionTypeReload", "\n", "case", "TransitionTypeKeyword", ":", "*", "t", "=", "TransitionTypeKeyword", "\n", "case", "TransitionTypeKeywordGenerated", ":", "*", "t", "=", "TransitionTypeKeywordGenerated", "\n", "case", "TransitionTypeOther", ":", "*", "t", "=", "TransitionTypeOther", "\n\n", "default", ":", "in", ".", "AddError", "(", "errors", ".", "New", "(", "\"", "\"", ")", ")", "\n", "}", "\n", "}" ]
20,898
all-20899
[ "GenerateKeyPair", "is", "used", "during", "encrypted", "protocol", "introduction", "." ]
[ "func", "generateKeyPair", "(", ")", "(", "publicKey", ",", "privateKey", "*", "[", "32", "]", "byte", ",", "err", "error", ")", "{", "return", "box", ".", "GenerateKey", "(", "<mask>", ".", "Reader", ")", "\n", "}" ]
20,899
all-20900
[ "Can", "we", "change", "this", "to", "be", "an", "io", ".", "ReadCloser", "return" ]
[ "func", "(", "e", "*", "FileCacheEntry", ")", "readCloser", "(", ")", "(", "*", "CachedFile", ",", "error", ")", "{", "var", "f", "*", "os", ".", "File", "\n", "var", "err", "error", "\n\n", "if", "e", ".", "fileDoesNotExist", "(", ")", "{", "f", ",", "err", "=", "os", ".", "Create", "(", "e", ".", "FilePath", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "err", "=", "compressor", ".", "WriteTar", "(", "e", ".", "ExpandedDirectoryPath", "+", "\"", "\"", ",", "f", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "// If the directory is not used remove it", "if", "e", ".", "directoryInUseCount", "==", "0", "{", "err", "=", "os", ".", "RemoveAll", "(", "e", ".", "ExpandedDirectoryPath", ")", "\n", "if", "err", "!=", "nil", "{", "fmt", ".", "Fprintln", "(", "os", ".", "Stderr", ",", "\"", "\"", ",", "err", ")", "\n", "}", "\n", "}", "else", "{", "// Double the size to account for both assets", "e", ".", "Size", "=", "e", ".", "Size", "*", "2", "\n", "}", "\n", "}", "else", "{", "f", ",", "err", "=", "os", ".", "Open", "(", "e", ".", "FilePath", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "}", "\n\n", "e", ".", "incrementFileInUseCount", "(", ")", "\n\n", "if", "_", ",", "err", ":=", "f", ".", "Seek", "(", "0", ",", "os", ".", "SEEK_SET", ")", ";", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "readCloser", ":=", "NewFileCloser", "(", "f", ",", "func", "(", "filePath", "string", ")", "{", "<mask>", ".", "Lock", "(", ")", "\n", "e", ".", "decrementFileInUseCount", "(", ")", "\n", "lock", ".", "Unlock", "(", ")", "\n", "}", ")", "\n\n", "return", "readCloser", ",", "nil", "\n", "}" ]