id
int32
0
25.3k
idx
stringlengths
5
9
nl_tokens
sequencelengths
1
418
pl_tokens
sequencelengths
22
4.98k
9,100
all-9101
[ "NewSelectiveStringValue", "creates", "a", "new", "string", "flag", "for", "which", "any", "one", "of", "the", "given", "strings", "is", "a", "valid", "value", "and", "any", "other", "value", "is", "an", "error", ".", "valids", "[", "0", "]", "will", "be", "default", "value", ".", "Caller", "must", "be", "sure", "len", "(", "valids", ")", "!", "=", "0", "or", "it", "will", "panic", "." ]
[ "func", "NewSelectiveStringValue", "(", "valids", "...", "string", ")", "*", "SelectiveStringValue", "{", "vm", ":=", "<mask>", "(", "map", "[", "string", "]", "struct", "{", "}", ")", "\n", "for", "_", ",", "v", ":=", "range", "valids", "{", "vm", "[", "v", "]", "=", "struct", "{", "}", "{", "}", "\n", "}", "\n", "return", "&", "SelectiveStringValue", "{", "valids", ":", "vm", ",", "v", ":", "valids", "[", "0", "]", "}", "\n", "}" ]
9,101
all-9102
[ "PreferLocalStorageFilter", "returns", "a", "QueryableFunc", "which", "creates", "a", "NoopQuerier", "if", "requested", "timeframe", "can", "be", "answered", "completely", "by", "the", "local", "TSDB", "and", "reduces", "maxt", "if", "the", "timeframe", "can", "be", "partially", "answered", "by", "TSDB", "." ]
[ "func", "PreferLocalStorageFilter", "(", "next", "storage", ".", "Queryable", ",", "cb", "startTimeCallback", ")", "storage", ".", "Queryable", "{", "return", "storage", ".", "QueryableFunc", "(", "func", "(", "ctx", "context", ".", "Context", ",", "mint", ",", "maxt", "int64", ")", "(", "storage", ".", "Querier", ",", "error", ")", "{", "localStartTime", ",", "err", ":=", "cb", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "cmaxt", ":=", "maxt", "\n", "// Avoid queries whose timerange is later than the first timestamp in local DB.", "if", "mint", ">", "localStartTime", "{", "return", "<mask>", ".", "NoopQuerier", "(", ")", ",", "nil", "\n", "}", "\n", "// Query only samples older than the first timestamp in local DB.", "if", "maxt", ">", "localStartTime", "{", "cmaxt", "=", "localStartTime", "\n", "}", "\n", "return", "next", ".", "Querier", "(", "ctx", ",", "mint", ",", "cmaxt", ")", "\n", "}", ")", "\n", "}" ]
9,102
all-9103
[ "Marshal", "passes", "a", "Field", "instance", "through", "to", "the", "appropriate", "field", "-", "type", "-", "specific", "method", "of", "an", "Encoder", "." ]
[ "func", "(", "lf", "Field", ")", "Marshal", "(", "visitor", "Encoder", ")", "{", "switch", "lf", ".", "fieldType", "{", "case", "stringType", ":", "visitor", ".", "EmitString", "(", "lf", ".", "key", ",", "lf", ".", "stringVal", ")", "\n", "case", "boolType", ":", "visitor", ".", "EmitBool", "(", "lf", ".", "key", ",", "lf", ".", "numericVal", "!=", "0", ")", "\n", "case", "intType", ":", "visitor", ".", "EmitInt", "(", "lf", ".", "key", ",", "int", "(", "lf", ".", "numericVal", ")", ")", "\n", "case", "int32Type", ":", "visitor", ".", "EmitInt32", "(", "lf", ".", "key", ",", "int32", "(", "lf", ".", "numericVal", ")", ")", "\n", "case", "int64Type", ":", "visitor", ".", "EmitInt64", "(", "lf", ".", "key", ",", "int64", "(", "lf", ".", "numericVal", ")", ")", "\n", "case", "uint32Type", ":", "visitor", ".", "EmitUint32", "(", "lf", ".", "key", ",", "uint32", "(", "lf", ".", "numericVal", ")", ")", "\n", "case", "uint64Type", ":", "visitor", ".", "EmitUint64", "(", "lf", ".", "key", ",", "uint64", "(", "lf", ".", "numericVal", ")", ")", "\n", "case", "float32Type", ":", "visitor", ".", "EmitFloat32", "(", "lf", ".", "key", ",", "math", ".", "Float32frombits", "(", "uint32", "(", "lf", ".", "numericVal", ")", ")", ")", "\n", "case", "float64Type", ":", "visitor", ".", "EmitFloat64", "(", "lf", ".", "key", ",", "math", ".", "Float64frombits", "(", "uint64", "(", "lf", ".", "numericVal", ")", ")", ")", "\n", "case", "errorType", ":", "if", "err", ",", "ok", ":=", "lf", ".", "interfaceVal", ".", "(", "error", ")", ";", "ok", "{", "visitor", ".", "EmitString", "(", "lf", ".", "key", ",", "err", ".", "Error", "(", ")", ")", "\n", "}", "else", "{", "visitor", ".", "EmitString", "(", "lf", ".", "<mask>", ",", "\"", "\"", ")", "\n", "}", "\n", "case", "objectType", ":", "visitor", ".", "EmitObject", "(", "lf", ".", "key", ",", "lf", ".", "interfaceVal", ")", "\n", "case", "lazyLoggerType", ":", "visitor", ".", "EmitLazyLogger", "(", "lf", ".", "interfaceVal", ".", "(", "LazyLogger", ")", ")", "\n", "case", "noopType", ":", "// intentionally left blank", "}", "\n", "}" ]
9,103
all-9104
[ "Destroy", "cleans", "up", "the", "on", "disk", "structures", "for", "the", "hashtree", "." ]
[ "func", "(", "h", "*", "dbHashTree", ")", "Destroy", "(", ")", "error", "{", "path", ":=", "h", ".", "<mask>", "(", ")", "\n", "if", "err", ":=", "h", ".", "Close", "(", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "return", "os", ".", "Remove", "(", "path", ")", "\n", "}" ]
9,104
all-9105
[ "update", "returns", "runs", "the", "specified", "fn", "within", "a", "read", "-", "write", "transaction", "on", "the", "database", "." ]
[ "func", "(", "bdc", "*", "cache", ")", "update", "(", "fn", "func", "(", "tx", "*", "bolt", ".", "Tx", ")", "error", ")", "(", "retErr", "error", ")", "{", "lockPath", "(", "bdc", ".", "path", ")", "\n", "defer", "unlockPath", "(", "bdc", ".", "path", ")", "\n", "<mask>", ",", "err", ":=", "bolt", ".", "Open", "(", "bdc", ".", "path", ",", "0600", ",", "nil", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "defer", "func", "(", ")", "{", "if", "err", ":=", "db", ".", "Close", "(", ")", ";", "retErr", "==", "nil", "&&", "err", "!=", "nil", "{", "retErr", "=", "err", "\n", "}", "\n", "}", "(", ")", "\n\n", "return", "db", ".", "Update", "(", "fn", ")", "\n", "}" ]
9,105
all-9106
[ "SetHeader", "sets", "a", "value", "to", "the", "given", "header", "field", "." ]
[ "func", "(", "m", "*", "Message", ")", "SetHeader", "(", "field", "string", ",", "value", "...", "string", ")", "{", "m", ".", "encodeHeader", "(", "value", ")", "\n", "m", ".", "<mask>", "[", "field", "]", "=", "value", "\n", "}" ]
9,106
all-9107
[ "UintVar", "defines", "a", "uint", "flag", "with", "specified", "name", "default", "value", "and", "usage", "string", ".", "The", "argument", "p", "points", "to", "a", "uint", "variable", "in", "which", "to", "store", "the", "value", "of", "the", "flag", "." ]
[ "func", "UintVar", "(", "p", "*", "uint", ",", "name", "string", ",", "value", "uint", ",", "usage", "string", ")", "{", "EnvironmentFlags", ".", "UintVar", "(", "p", ",", "name", ",", "value", ",", "<mask>", ")", "\n", "}" ]
9,107
all-9108
[ "/", "*", "The", "same", "as", "client", ".", "Trigger", "except", "one", "passes", "in", "a", "slice", "of", "channels", "as", "the", "first", "parameter", ".", "The", "maximum", "length", "of", "channels", "is", "100", ".", "client", ".", "TriggerMulti", "(", "[]", "string", "{", "a_channel", "another_channel", "}", "event", "data", ")" ]
[ "func", "(", "c", "*", "Client", ")", "TriggerMulti", "(", "channels", "[", "]", "string", ",", "eventName", "string", ",", "data", "interface", "{", "}", ")", "(", "*", "BufferedEvents", ",", "error", ")", "{", "return", "c", ".", "<mask>", "(", "channels", ",", "eventName", ",", "data", ",", "nil", ")", "\n", "}" ]
9,108
all-9109
[ "GetPage", "retrieves", "an", "IncomingPhoneNumberPage", "filtered", "by", "the", "given", "data", "." ]
[ "func", "(", "ins", "*", "IncomingNumberService", ")", "GetPage", "(", "ctx", "context", ".", "Context", ",", "<mask>", "url", ".", "Values", ")", "(", "*", "IncomingPhoneNumberPage", ",", "error", ")", "{", "iter", ":=", "ins", ".", "GetPageIterator", "(", "data", ")", "\n", "return", "iter", ".", "Next", "(", "ctx", ")", "\n", "}" ]
9,109
all-9110
[ "NewManager", "is", "the", "Discovery", "Manager", "constructor", "." ]
[ "func", "NewManager", "(", "ctx", "context", ".", "Context", ",", "logger", "log", ".", "Logger", ",", "options", "...", "func", "(", "*", "<mask>", ")", ")", "*", "Manager", "{", "if", "logger", "==", "nil", "{", "logger", "=", "log", ".", "NewNopLogger", "(", ")", "\n", "}", "\n", "mgr", ":=", "&", "Manager", "{", "logger", ":", "logger", ",", "syncCh", ":", "make", "(", "chan", "map", "[", "string", "]", "[", "]", "*", "targetgroup", ".", "Group", ")", ",", "targets", ":", "make", "(", "map", "[", "poolKey", "]", "map", "[", "string", "]", "*", "targetgroup", ".", "Group", ")", ",", "discoverCancel", ":", "[", "]", "context", ".", "CancelFunc", "{", "}", ",", "ctx", ":", "ctx", ",", "updatert", ":", "5", "*", "time", ".", "Second", ",", "triggerSend", ":", "make", "(", "chan", "struct", "{", "}", ",", "1", ")", ",", "}", "\n", "for", "_", ",", "option", ":=", "range", "options", "{", "option", "(", "mgr", ")", "\n", "}", "\n", "return", "mgr", "\n", "}" ]
9,110
all-9111
[ "TakeWhile", "creates", "a", "reusable", "stream", "which", "will", "halt", "once", "some", "criteria", "is", "no", "longer", "met", "." ]
[ "func", "TakeWhile", "(", "subject", "Enumerable", ",", "criteria", "func", "(", "<mask>", "{", "}", ",", "uint", ")", "bool", ")", "Enumerable", "{", "return", "takeWhiler", "{", "original", ":", "subject", ",", "criteria", ":", "criteria", ",", "}", "\n", "}" ]
9,111
all-9112
[ "RemoveAttribute", "removes", "attribute", "with", "given", "name", "from", "an", "element", "with", "given", "id", ".", "See", ":", "https", ":", "//", "chromedevtools", ".", "github", ".", "io", "/", "devtools", "-", "protocol", "/", "tot", "/", "DOM#method", "-", "removeAttribute", "parameters", ":", "nodeID", "-", "Id", "of", "the", "element", "to", "remove", "attribute", "from", ".", "name", "-", "Name", "of", "the", "attribute", "to", "remove", "." ]
[ "func", "RemoveAttribute", "(", "nodeID", "cdp", ".", "NodeID", ",", "name", "string", ")", "*", "RemoveAttributeParams", "{", "return", "&", "RemoveAttributeParams", "{", "NodeID", ":", "nodeID", ",", "<mask>", ":", "name", ",", "}", "\n", "}" ]
9,112
all-9113
[ "GetApmQueryOk", "returns", "a", "tuple", "with", "the", "ApmQuery", "field", "if", "it", "s", "non", "-", "nil", "zero", "value", "otherwise", "and", "a", "boolean", "to", "check", "if", "the", "value", "has", "been", "set", "." ]
[ "func", "(", "q", "*", "QueryValueRequest", ")", "GetApmQueryOk", "(", ")", "(", "WidgetApmOrLogQuery", ",", "bool", ")", "{", "if", "q", "==", "nil", "||", "q", ".", "ApmQuery", "==", "nil", "{", "return", "WidgetApmOrLogQuery", "{", "}", ",", "false", "\n", "}", "\n", "return", "*", "q", ".", "ApmQuery", ",", "<mask>", "\n", "}" ]
9,113
all-9114
[ "Registers", "a", "signal", "handler", "to", "execute", "the", "specified", "Tracer", "upon", "receipt", "of", "any", "signal", "in", "the", "set", "specified", "by", "TracerSig", ".", "Sigset", "()", ".", "If", "the", "GlobalConfiguration", "value", "ResendSignal", "is", "true", "then", "when", "a", "signal", "is", "received", "through", "this", "handler", "all", "handlers", "for", "that", "signal", "will", "be", "reset", "with", "signal", ".", "Reset", "(", "s", ")", "after", "tracer", "execution", "completes", ".", "The", "signal", "will", "then", "be", "resent", "to", "the", "default", "Go", "handler", "for", "that", "signal", "." ]
[ "func", "Register", "(", "t", "TracerSig", ")", "{", "ss", ":=", "t", ".", "Sigset", "(", ")", "\n", "if", "ss", "==", "nil", "||", "len", "(", "ss", ")", "==", "0", "{", "t", ".", "Logf", "(", "LogError", ",", "\"", "\"", "+", "\"", "\\n", "\"", ")", "\n", "return", "\n", "}", "\n\n", "c", ":=", "t", ".", "Sigchan", "(", ")", "\n", "if", "c", "!=", "nil", "{", "unregisterInternal", "(", "t", ",", "c", ")", "\n", "}", "\n\n", "c", "=", "make", "(", "chan", "os", ".", "Signal", ",", "len", "(", "ss", ")", ")", "\n", "t", ".", "SetSigchan", "(", "c", ")", "\n\n", "signal", ".", "Notify", "(", "c", ",", "ss", "...", ")", "\n\n", "t", ".", "Logf", "(", "LogDebug", ",", "\"", "\\n", "\"", ",", "t", ",", "ss", ")", "\n\n", "state", ".", "m", ".", "RLock", "(", ")", "\n", "<mask>", ":=", "state", ".", "c", ".", "ResendSignal", "\n", "state", ".", "m", ".", "RUnlock", "(", ")", "\n\n", "go", "func", "(", "t", "TracerSig", ")", "{", "for", "s", ":=", "range", "c", "{", "t", ".", "Logf", "(", "LogDebug", ",", "\"", "\\n", "\"", ",", "s", ")", "\n\n", "Trace", "(", "t", ",", "&", "signalError", "{", "s", "}", ",", "nil", ")", "\n\n", "if", "!", "rs", "{", "continue", "\n", "}", "\n\n", "t", ".", "Logf", "(", "LogDebug", ",", "\"", "\\n", "\"", ",", "s", ")", "\n\n", "// Re-handle the signal with the default Go behavior.", "signal", ".", "Reset", "(", "s", ")", "\n", "p", ",", "err", ":=", "os", ".", "FindProcess", "(", "os", ".", "Getpid", "(", ")", ")", "\n", "if", "err", "!=", "nil", "{", "t", ".", "Logf", "(", "LogError", ",", "\"", "\"", "+", "\"", "\"", ")", "\n", "return", "\n", "}", "\n\n", "p", ".", "Signal", "(", "s", ")", "\n", "}", "\n\n", "t", ".", "Logf", "(", "LogDebug", ",", "\"", "\\n", "\"", ")", "\n", "}", "(", "t", ")", "\n\n", "return", "\n", "}" ]
9,114
all-9115
[ "Check", "scans", "the", "Path", "for", "any", "recursive", "transformers", "and", "panics", "when", "any", "recursive", "transformers", "are", "detected", ".", "Note", "that", "the", "presence", "of", "a", "recursive", "Transformer", "does", "not", "necessarily", "imply", "an", "infinite", "cycle", ".", "As", "such", "this", "check", "only", "activates", "after", "some", "minimal", "number", "of", "path", "steps", "." ]
[ "func", "(", "rc", "*", "recChecker", ")", "Check", "(", "p", "Path", ")", "{", "const", "minLen", "=", "1", "<<", "16", "\n", "if", "rc", ".", "next", "==", "0", "{", "rc", ".", "next", "=", "minLen", "\n", "}", "\n", "if", "len", "(", "p", ")", "<", "rc", ".", "next", "{", "return", "\n", "}", "\n", "rc", ".", "next", "<<=", "1", "\n\n", "// Check whether the same transformer has appeared at least twice.", "var", "ss", "[", "]", "string", "\n", "m", ":=", "map", "[", "Option", "]", "int", "{", "}", "\n", "for", "_", ",", "<mask>", ":=", "range", "p", "{", "if", "t", ",", "ok", ":=", "ps", ".", "(", "Transform", ")", ";", "ok", "{", "t", ":=", "t", ".", "Option", "(", ")", "\n", "if", "m", "[", "t", "]", "==", "1", "{", "// Transformer was used exactly once before", "tf", ":=", "t", ".", "(", "*", "transformer", ")", ".", "fnc", ".", "Type", "(", ")", "\n", "ss", "=", "append", "(", "ss", ",", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "t", ",", "tf", ".", "In", "(", "0", ")", ",", "tf", ".", "Out", "(", "0", ")", ")", ")", "\n", "}", "\n", "m", "[", "t", "]", "++", "\n", "}", "\n", "}", "\n", "if", "len", "(", "ss", ")", ">", "0", "{", "const", "warning", "=", "\"", "\"", "\n", "const", "help", "=", "\"", "\"", "\n", "set", ":=", "strings", ".", "Join", "(", "ss", ",", "\"", "\\n", "\\t", "\"", ")", "\n", "panic", "(", "fmt", ".", "Sprintf", "(", "\"", "\\n", "\\t", "\\n", "\"", ",", "warning", ",", "set", ",", "help", ")", ")", "\n", "}", "\n", "}" ]
9,115
all-9116
[ "GetPrinter", "()", "is", "a", "wrapper", "around", "gtk_print_settings_get_printer", "()", "." ]
[ "func", "(", "<mask>", "*", "PrintSettings", ")", "GetPrinter", "(", ")", "string", "{", "c", ":=", "C", ".", "gtk_print_settings_get_printer", "(", "ps", ".", "native", "(", ")", ")", "\n", "return", "C", ".", "GoString", "(", "(", "*", "C", ".", "char", ")", "(", "c", ")", ")", "\n", "}" ]
9,116
all-9117
[ "GetMetricQueryOk", "returns", "a", "tuple", "with", "the", "MetricQuery", "field", "if", "it", "s", "non", "-", "nil", "zero", "value", "otherwise", "and", "a", "boolean", "to", "check", "if", "the", "value", "has", "been", "set", "." ]
[ "func", "(", "d", "*", "DistributionRequest", ")", "GetMetricQueryOk", "(", ")", "(", "string", ",", "bool", ")", "{", "if", "d", "==", "nil", "||", "d", ".", "MetricQuery", "==", "nil", "{", "return", "\"", "\"", ",", "<mask>", "\n", "}", "\n", "return", "*", "d", ".", "MetricQuery", ",", "true", "\n", "}" ]
9,117
all-9118
[ "retrieve", "information", "about", "the", "set", "of", "active", "atomic", "counter", "buffers", "for", "a", "program" ]
[ "func", "GetActiveAtomicCounterBufferiv", "(", "<mask>", "uint32", ",", "bufferIndex", "uint32", ",", "pname", "uint32", ",", "params", "*", "int32", ")", "{", "C", ".", "glowGetActiveAtomicCounterBufferiv", "(", "gpGetActiveAtomicCounterBufferiv", ",", "(", "C", ".", "GLuint", ")", "(", "program", ")", ",", "(", "C", ".", "GLuint", ")", "(", "bufferIndex", ")", ",", "(", "C", ".", "GLenum", ")", "(", "pname", ")", ",", "(", "*", "C", ".", "GLint", ")", "(", "unsafe", ".", "Pointer", "(", "params", ")", ")", ")", "\n", "}" ]
9,118
all-9119
[ "Handle", "registers", "a", "new", "request", "handle", "with", "the", "given", "pattern", "method", "and", "handlers", "." ]
[ "func", "(", "r", "*", "Router", ")", "Handle", "(", "method", "string", ",", "pattern", "string", ",", "handlers", "[", "]", "Handler", ")", "*", "Route", "{", "if", "len", "(", "r", ".", "groups", ")", ">", "0", "{", "groupPattern", ":=", "\"", "\"", "\n", "h", ":=", "make", "(", "[", "]", "Handler", ",", "0", ")", "\n", "for", "_", ",", "g", ":=", "range", "r", ".", "groups", "{", "groupPattern", "+=", "g", ".", "pattern", "\n", "h", "=", "append", "(", "h", ",", "g", ".", "handlers", "...", ")", "\n", "}", "\n\n", "pattern", "=", "groupPattern", "+", "pattern", "\n", "h", "=", "append", "(", "h", ",", "handlers", "...", ")", "\n", "handlers", "=", "h", "\n", "}", "\n", "handlers", "=", "validateAndWrapHandlers", "(", "handlers", ",", "r", ".", "handlerWrapper", ")", "\n\n", "return", "r", ".", "handle", "(", "method", ",", "pattern", ",", "func", "(", "resp", "http", ".", "ResponseWriter", ",", "req", "*", "<mask>", ".", "Request", ",", "params", "Params", ")", "{", "c", ":=", "r", ".", "m", ".", "createContext", "(", "resp", ",", "req", ")", "\n", "c", ".", "params", "=", "params", "\n", "c", ".", "handlers", "=", "make", "(", "[", "]", "Handler", ",", "0", ",", "len", "(", "r", ".", "m", ".", "handlers", ")", "+", "len", "(", "handlers", ")", ")", "\n", "c", ".", "handlers", "=", "append", "(", "c", ".", "handlers", ",", "r", ".", "m", ".", "handlers", "...", ")", "\n", "c", ".", "handlers", "=", "append", "(", "c", ".", "handlers", ",", "handlers", "...", ")", "\n", "c", ".", "run", "(", ")", "\n", "}", ")", "\n", "}" ]
9,119
all-9120
[ "Name", "of", "go", "type", "for", "resource", "with", "given", "name", "It", "should", "always", "be", "the", "same", "(", "camelized", ")", "but", "there", "are", "some", "resources", "that", "don", "t", "have", "a", "media", "type", "so", "for", "these", "we", "use", "a", "map", "." ]
[ "func", "resourceType", "(", "resName", "string", ")", "string", "{", "if", "resName", "==", "\"", "\"", "{", "return", "\"", "\"", "\n", "}", "\n", "if", "_", ",", "<mask>", ":=", "noMediaTypeResources", "[", "resName", "]", ";", "ok", "{", "return", "\"", "\"", "\n", "}", "\n", "return", "inflect", ".", "Singularize", "(", "resName", ")", "\n", "}" ]
9,120
all-9121
[ "FetchRuleSets", "retrieves", "all", "rule", "sets", "available", "to", "API", "Token", "." ]
[ "func", "(", "a", "*", "API", ")", "FetchRuleSets", "(", ")", "(", "*", "[", "]", "RuleSet", ",", "error", ")", "{", "result", ",", "err", ":=", "a", ".", "Get", "(", "config", ".", "RuleSetPrefix", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "<mask>", "rulesets", "[", "]", "RuleSet", "\n", "if", "err", ":=", "json", ".", "Unmarshal", "(", "result", ",", "&", "rulesets", ")", ";", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "return", "&", "rulesets", ",", "nil", "\n", "}" ]
9,121
all-9122
[ "UnmarshalJSON", "supports", "json", ".", "Unmarshaler", "interface" ]
[ "func", "(", "v", "*", "GetAppManifestParams", ")", "UnmarshalJSON", "(", "data", "[", "]", "byte", ")", "error", "{", "r", ":=", "jlexer", ".", "Lexer", "{", "Data", ":", "data", "}", "\n", "easyjsonC5a4559bDecodeGithubComChromedpCdprotoPage43", "(", "&", "r", ",", "v", ")", "\n", "return", "r", ".", "<mask>", "(", ")", "\n", "}" ]
9,122
all-9123
[ "title", ":", "run", "commands", "path", ":", "/", "apps", "/", "{", "app", "}", "/", "run", "consume", ":", "application", "/", "x", "-", "www", "-", "form", "-", "urlencoded", "produce", ":", "application", "/", "x", "-", "json", "-", "stream", "method", ":", "POST", "responses", ":", "200", ":", "Ok", "401", ":", "Unauthorized", "404", ":", "App", "not", "found" ]
[ "func", "runCommand", "(", "w", "http", ".", "ResponseWriter", ",", "r", "*", "<mask>", ".", "Request", ",", "t", "auth", ".", "Token", ")", "(", "err", "error", ")", "{", "msg", ":=", "\"", "\"", "\n", "command", ":=", "InputValue", "(", "r", ",", "\"", "\"", ")", "\n", "if", "len", "(", "command", ")", "<", "1", "{", "return", "&", "errors", ".", "HTTP", "{", "Code", ":", "http", ".", "StatusBadRequest", ",", "Message", ":", "msg", "}", "\n", "}", "\n", "appName", ":=", "r", ".", "URL", ".", "Query", "(", ")", ".", "Get", "(", "\"", "\"", ")", "\n", "once", ":=", "InputValue", "(", "r", ",", "\"", "\"", ")", "\n", "isolated", ":=", "InputValue", "(", "r", ",", "\"", "\"", ")", "\n", "a", ",", "err", ":=", "getAppFromContext", "(", "appName", ",", "r", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "allowed", ":=", "permission", ".", "Check", "(", "t", ",", "permission", ".", "PermAppRun", ",", "contextsForApp", "(", "&", "a", ")", "...", ",", ")", "\n", "if", "!", "allowed", "{", "return", "permission", ".", "ErrUnauthorized", "\n", "}", "\n", "evt", ",", "err", ":=", "event", ".", "New", "(", "&", "event", ".", "Opts", "{", "Target", ":", "appTarget", "(", "appName", ")", ",", "Kind", ":", "permission", ".", "PermAppRun", ",", "Owner", ":", "t", ",", "CustomData", ":", "event", ".", "FormToCustomData", "(", "InputFields", "(", "r", ")", ")", ",", "Allowed", ":", "event", ".", "Allowed", "(", "permission", ".", "PermAppReadEvents", ",", "contextsForApp", "(", "&", "a", ")", "...", ")", ",", "}", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "defer", "func", "(", ")", "{", "evt", ".", "Done", "(", "err", ")", "}", "(", ")", "\n", "w", ".", "Header", "(", ")", ".", "Set", "(", "\"", "\"", ",", "\"", "\"", ")", "\n", "keepAliveWriter", ":=", "tsuruIo", ".", "NewKeepAliveWriter", "(", "w", ",", "30", "*", "time", ".", "Second", ",", "\"", "\"", ")", "\n", "defer", "keepAliveWriter", ".", "Stop", "(", ")", "\n", "writer", ":=", "&", "tsuruIo", ".", "SimpleJsonMessageEncoderWriter", "{", "Encoder", ":", "json", ".", "NewEncoder", "(", "keepAliveWriter", ")", "}", "\n", "evt", ".", "SetLogWriter", "(", "writer", ")", "\n", "onceBool", ",", "_", ":=", "strconv", ".", "ParseBool", "(", "once", ")", "\n", "isolatedBool", ",", "_", ":=", "strconv", ".", "ParseBool", "(", "isolated", ")", "\n", "args", ":=", "provision", ".", "RunArgs", "{", "Once", ":", "onceBool", ",", "Isolated", ":", "isolatedBool", "}", "\n", "return", "a", ".", "Run", "(", "command", ",", "evt", ",", "args", ")", "\n", "}" ]
9,123
all-9124
[ "NewSyncFolderFontCache", "creates", "SyncFolderFontCache" ]
[ "func", "NewSyncFolderFontCache", "(", "folder", "string", ")", "*", "SyncFolderFontCache", "{", "return", "&", "SyncFolderFontCache", "{", "fonts", ":", "make", "(", "map", "[", "string", "]", "*", "truetype", ".", "Font", ")", ",", "folder", ":", "<mask>", ",", "namer", ":", "FontFileName", ",", "}", "\n", "}" ]
9,124
all-9125
[ "Serve", "starts", "all", "added", "servers", ".", "New", "new", "servers", "must", "be", "added", "after", "this", "methid", "is", "called", "." ]
[ "func", "(", "s", "*", "Servers", ")", "Serve", "(", ")", "(", "err", "error", ")", "{", "lns", ":=", "make", "(", "[", "]", "net", ".", "Listener", ",", "len", "(", "s", ".", "servers", ")", ")", "\n", "conns", ":=", "make", "(", "[", "]", "*", "net", ".", "UDPConn", ",", "len", "(", "s", ".", "servers", ")", ")", "\n", "for", "i", ",", "srv", ":=", "range", "s", ".", "servers", "{", "if", "_", ",", "yes", ":=", "srv", ".", "isTCP", "(", ")", ";", "yes", "{", "ln", ",", "err", ":=", "net", ".", "Listen", "(", "\"", "\"", ",", "srv", ".", "address", ")", "\n", "if", "err", "!=", "nil", "{", "for", "_", ",", "l", ":=", "range", "lns", "{", "if", "l", "==", "nil", "{", "continue", "\n", "}", "\n", "if", "err", ":=", "l", ".", "Close", "(", ")", ";", "err", "!=", "nil", "{", "s", ".", "logger", ".", "Errorf", "(", "\"", "\"", ",", "srv", ".", "label", "(", ")", ",", "srv", ".", "address", ",", "err", ")", "\n", "}", "\n", "}", "\n", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "srv", ".", "label", "(", ")", ",", "srv", ".", "address", ",", "err", ")", "\n", "}", "\n", "lns", "[", "i", "]", "=", "ln", "\n", "}", "\n", "if", "_", ",", "yes", ":=", "srv", ".", "isUDP", "(", ")", ";", "yes", "{", "addr", ",", "err", ":=", "net", ".", "ResolveUDPAddr", "(", "\"", "\"", ",", "srv", ".", "address", ")", "\n", "if", "err", "!=", "nil", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "srv", ".", "label", "(", ")", ",", "srv", ".", "address", ",", "err", ")", "\n", "}", "\n", "conn", ",", "err", ":=", "<mask>", ".", "ListenUDP", "(", "\"", "\"", ",", "addr", ")", "\n", "if", "err", "!=", "nil", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "srv", ".", "label", "(", ")", ",", "srv", ".", "address", ",", "err", ")", "\n", "}", "\n", "conns", "[", "i", "]", "=", "conn", "\n", "}", "\n", "}", "\n", "for", "i", ",", "srv", ":=", "range", "s", ".", "servers", "{", "if", "tcpSrv", ",", "yes", ":=", "srv", ".", "isTCP", "(", ")", ";", "yes", "{", "go", "func", "(", "srv", "*", "server", ",", "ln", "net", ".", "Listener", ")", "{", "defer", "s", ".", "recover", "(", ")", "\n\n", "s", ".", "mu", ".", "Lock", "(", ")", "\n", "srv", ".", "tcpAddr", "=", "ln", ".", "Addr", "(", ")", ".", "(", "*", "net", ".", "TCPAddr", ")", "\n", "s", ".", "mu", ".", "Unlock", "(", ")", "\n\n", "s", ".", "logger", ".", "Infof", "(", "\"", "\"", ",", "srv", ".", "label", "(", ")", ",", "srv", ".", "tcpAddr", ".", "String", "(", ")", ")", "\n", "if", "err", ":=", "tcpSrv", ".", "ServeTCP", "(", "ln", ")", ";", "err", "!=", "nil", "{", "s", ".", "logger", ".", "Errorf", "(", "\"", "\"", ",", "srv", ".", "label", "(", ")", ",", "srv", ".", "tcpAddr", ".", "String", "(", ")", ",", "err", ")", "\n", "}", "\n", "}", "(", "srv", ",", "lns", "[", "i", "]", ")", "\n", "}", "\n", "if", "udpSrv", ",", "yes", ":=", "srv", ".", "isUDP", "(", ")", ";", "yes", "{", "go", "func", "(", "srv", "*", "server", ",", "conn", "*", "net", ".", "UDPConn", ")", "{", "defer", "s", ".", "recover", "(", ")", "\n\n", "s", ".", "mu", ".", "Lock", "(", ")", "\n", "srv", ".", "udpAddr", "=", "conn", ".", "LocalAddr", "(", ")", ".", "(", "*", "net", ".", "UDPAddr", ")", "\n", "s", ".", "mu", ".", "Unlock", "(", ")", "\n\n", "s", ".", "logger", ".", "Infof", "(", "\"", "\"", ",", "srv", ".", "label", "(", ")", ",", "srv", ".", "tcpAddr", ".", "String", "(", ")", ")", "\n", "if", "err", ":=", "udpSrv", ".", "ServeUDP", "(", "conn", ")", ";", "err", "!=", "nil", "{", "s", ".", "logger", ".", "Errorf", "(", "\"", "\"", ",", "srv", ".", "label", "(", ")", ",", "srv", ".", "tcpAddr", ".", "String", "(", ")", ",", "err", ")", "\n", "}", "\n", "}", "(", "srv", ",", "conns", "[", "i", "]", ")", "\n", "}", "\n", "}", "\n", "return", "nil", "\n", "}" ]
9,125
all-9126
[ "GetKubernetesClient", "retrieves", "the", "Kubernetes", "cluster", "client", "from", "within", "the", "cluster" ]
[ "func", "GetProwJobClient", "(", "masterURL", ",", "kubeConfig", "<mask>", ")", "(", "prowjobclientset", ".", "Interface", ",", "error", ")", "{", "config", ",", "err", ":=", "loadClusterConfig", "(", "masterURL", ",", "kubeConfig", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "prowjobClient", ",", "err", ":=", "prowjobclientset", ".", "NewForConfig", "(", "config", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "logrus", ".", "Info", "(", "\"", "\"", ")", "\n", "return", "prowjobClient", ",", "nil", "\n", "}" ]
9,126
all-9127
[ "Size", "returns", "the", "size", "of", "x", "in", "bytes", "." ]
[ "func", "(", "p", "*", "Process", ")", "Size", "(", "x", "<mask>", ")", "int64", "{", "return", "p", ".", "findHeapInfo", "(", "core", ".", "Address", "(", "x", ")", ")", ".", "size", "\n", "}" ]
9,127
all-9128
[ "See", "the", "documentation", "for", "Index", "for", "details", "." ]
[ "func", "(", "c", "*", "collection", ")", "indexDir", "(", "index", "*", "Index", ",", "indexVal", "interface", "{", "}", ")", "string", "{", "var", "indexValStr", "string", "\n", "if", "marshaller", ",", "ok", ":=", "indexVal", ".", "(", "proto", ".", "Marshaler", ")", ";", "<mask>", "{", "if", "indexValBytes", ",", "err", ":=", "marshaller", ".", "Marshal", "(", ")", ";", "err", "==", "nil", "{", "// use marshalled proto as index. This way we can rename fields without", "// breaking our index.", "indexValStr", "=", "string", "(", "indexValBytes", ")", "\n", "}", "else", "{", "// log error but keep going (this used to be the only codepath)", "log", ".", "Printf", "(", "\"", "\"", ",", "err", ")", "\n", "indexValStr", "=", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "indexVal", ")", "\n", "}", "\n", "}", "else", "{", "indexValStr", "=", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "indexVal", ")", "\n", "}", "\n", "return", "path", ".", "Join", "(", "c", ".", "indexRoot", "(", "index", ")", ",", "indexValStr", ")", "\n", "}" ]
9,128
all-9129
[ "SetBSON", "sets", "the", "Base64", "from", "raw", "bson", "data" ]
[ "func", "(", "b", "*", "Base64", ")", "SetBSON", "(", "raw", "bson", ".", "Raw", ")", "error", "{", "var", "m", "bson", ".", "M", "\n", "if", "err", ":=", "raw", ".", "Unmarshal", "(", "&", "m", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "if", "data", ",", "ok", ":=", "m", "[", "\"", "\"", "]", ".", "(", "string", ")", ";", "ok", "{", "*", "b", "=", "Base64", "(", "<mask>", ")", "\n", "return", "nil", "\n", "}", "\n\n", "return", "errors", ".", "New", "(", "\"", "\"", ")", "\n", "}" ]
9,129
all-9130
[ "StringPolicy", "converts", "a", "string", "into", "a", "VMware", "StringPolicy", "value", "." ]
[ "func", "StringPolicy", "(", "s", "string", ")", "*", "types", ".", "StringPolicy", "{", "sp", ":=", "&", "<mask>", ".", "StringPolicy", "{", "Value", ":", "s", ",", "}", "\n", "return", "sp", "\n", "}" ]
9,130
all-9131
[ "newPRSignedBaseLayer", "is", "NewPRSignedBaseLayer", "except", "it", "returns", "the", "private", "type", "." ]
[ "func", "newPRSignedBaseLayer", "(", "baseLayerIdentity", "PolicyReferenceMatch", ")", "(", "*", "prSignedBaseLayer", ",", "error", ")", "{", "if", "baseLayerIdentity", "==", "nil", "{", "return", "nil", ",", "InvalidPolicyFormatError", "(", "\"", "\"", ")", "\n", "}", "\n", "return", "&", "prSignedBaseLayer", "{", "prCommon", ":", "prCommon", "{", "<mask>", ":", "prTypeSignedBaseLayer", "}", ",", "BaseLayerIdentity", ":", "baseLayerIdentity", ",", "}", ",", "nil", "\n", "}" ]
9,131
all-9132
[ "UnmarshalJSON", "supports", "json", ".", "Unmarshaler", "interface" ]
[ "func", "(", "v", "*", "EventLoadingFinished", ")", "UnmarshalJSON", "(", "data", "[", "]", "<mask>", ")", "error", "{", "r", ":=", "jlexer", ".", "Lexer", "{", "Data", ":", "data", "}", "\n", "easyjsonC5a4559bDecodeGithubComChromedpCdprotoNetwork53", "(", "&", "r", ",", "v", ")", "\n", "return", "r", ".", "Error", "(", ")", "\n", "}" ]
9,132
all-9133
[ "DeviceToUser", "is", "a", "wrapper", "around", "cairo_device_to_user", "." ]
[ "func", "(", "v", "*", "<mask>", ")", "DeviceToUser", "(", "x", ",", "y", "float64", ")", "(", "float64", ",", "float64", ")", "{", "C", ".", "cairo_device_to_user", "(", "v", ".", "native", "(", ")", ",", "(", "*", "C", ".", "double", ")", "(", "&", "x", ")", ",", "(", "*", "C", ".", "double", ")", "(", "&", "y", ")", ")", "\n", "return", "x", ",", "y", "\n", "}" ]
9,133
all-9134
[ "Transaction", "groups", "the", "creation", "of", "a", "new", "TransactionBuilder", "with", "a", "call", "to", "Mutate", "." ]
[ "func", "<mask>", "(", "muts", "...", "TransactionMutator", ")", "(", "result", "*", "TransactionBuilder", ")", "{", "result", "=", "&", "TransactionBuilder", "{", "}", "\n", "result", ".", "Mutate", "(", "muts", "...", ")", "\n", "result", ".", "Mutate", "(", "Defaults", "{", "}", ")", "\n", "return", "\n", "}" ]
9,134
all-9135
[ "We", "start", "by", "dealing", "with", "each", "of", "the", "primitive", "types", "in", "turn", ".", "BOOLEAN" ]
[ "func", "parseBool", "(", "bytes", "[", "]", "byte", ")", "(", "ret", "bool", ",", "err", "error", ")", "{", "if", "len", "(", "<mask>", ")", "!=", "1", "{", "err", "=", "asn1", ".", "SyntaxError", "{", "Msg", ":", "\"", "\"", "}", "\n", "return", "\n", "}", "\n\n", "// DER demands that \"If the encoding represents the boolean value TRUE,", "// its single contents octet shall have all eight bits set to one.\"", "// Thus only 0 and 255 are valid encoded values.", "switch", "bytes", "[", "0", "]", "{", "case", "0", ":", "ret", "=", "false", "\n", "case", "0xff", ":", "ret", "=", "true", "\n", "default", ":", "err", "=", "asn1", ".", "SyntaxError", "{", "Msg", ":", "\"", "\"", "}", "\n", "}", "\n\n", "return", "\n", "}" ]
9,135
all-9136
[ "WriteMatrix", "writes", "a", "visual", "representation", "of", "the", "given", "matrix", "for", "the", "given", "strings", "to", "the", "given", "writer", "." ]
[ "func", "WriteMatrix", "(", "source", "[", "]", "rune", ",", "target", "[", "]", "rune", ",", "matrix", "[", "]", "[", "]", "int", ",", "writer", "io", ".", "Writer", ")", "{", "fmt", ".", "Fprintf", "(", "writer", ",", "\"", "\"", ")", "\n", "for", "_", ",", "targetRune", ":=", "range", "target", "{", "fmt", ".", "Fprintf", "(", "writer", ",", "\"", "\"", ",", "targetRune", ")", "\n", "}", "\n", "fmt", ".", "Fprintf", "(", "writer", ",", "\"", "\\n", "\"", ")", "\n", "fmt", ".", "Fprintf", "(", "writer", ",", "\"", "\"", ",", "matrix", "[", "0", "]", "[", "0", "]", ")", "\n", "for", "j", ",", "_", ":=", "range", "target", "{", "fmt", ".", "Fprintf", "(", "writer", ",", "\"", "\"", ",", "matrix", "[", "0", "]", "[", "j", "+", "1", "]", ")", "\n", "}", "\n", "fmt", ".", "Fprintf", "(", "writer", ",", "\"", "\\n", "\"", ")", "\n", "for", "i", ",", "sourceRune", ":=", "range", "source", "{", "fmt", ".", "Fprintf", "(", "writer", ",", "\"", "\"", ",", "sourceRune", ",", "matrix", "[", "i", "+", "1", "]", "[", "0", "]", ")", "\n", "for", "j", ",", "_", ":=", "range", "target", "{", "fmt", ".", "Fprintf", "(", "<mask>", ",", "\"", "\"", ",", "matrix", "[", "i", "+", "1", "]", "[", "j", "+", "1", "]", ")", "\n", "}", "\n", "fmt", ".", "Fprintf", "(", "writer", ",", "\"", "\\n", "\"", ")", "\n", "}", "\n", "}" ]
9,136
all-9137
[ "SubscribeCommit", "is", "like", "ListCommit", "but", "it", "keeps", "listening", "for", "commits", "as", "they", "come", "in", "." ]
[ "func", "(", "c", "APIClient", ")", "SubscribeCommit", "(", "repo", "string", ",", "branch", "string", ",", "from", "string", ",", "state", "pfs", ".", "CommitState", ")", "(", "CommitInfoIterator", ",", "error", ")", "{", "ctx", ",", "cancel", ":=", "context", ".", "WithCancel", "(", "c", ".", "Ctx", "(", ")", ")", "\n", "req", ":=", "&", "pfs", ".", "SubscribeCommitRequest", "{", "Repo", ":", "NewRepo", "(", "repo", ")", ",", "Branch", ":", "branch", ",", "State", ":", "state", ",", "}", "\n", "if", "from", "!=", "\"", "\"", "{", "req", ".", "From", "=", "NewCommit", "(", "repo", ",", "from", ")", "\n", "}", "\n", "stream", ",", "err", ":=", "c", ".", "PfsAPIClient", ".", "SubscribeCommit", "(", "ctx", ",", "req", ")", "\n", "if", "err", "!=", "nil", "{", "cancel", "(", ")", "\n", "return", "nil", ",", "grpcutil", ".", "ScrubGRPC", "(", "err", ")", "\n", "}", "\n", "return", "&", "commitInfoIterator", "{", "<mask>", ",", "cancel", "}", ",", "nil", "\n", "}" ]
9,137
all-9138
[ "MarshalEasyJSON", "writes", "the", "UUID3", "to", "a", "easyjson", ".", "Writer" ]
[ "func", "(", "u", "UUID3", ")", "MarshalEasyJSON", "(", "w", "*", "jwriter", ".", "Writer", ")", "{", "w", ".", "<mask>", "(", "string", "(", "u", ")", ")", "\n", "}" ]
9,138
all-9139
[ "prune", "removes", "any", "cached", "file", "changes", "that", "were", "not", "used", "since", "the", "last", "prune", "." ]
[ "func", "(", "c", "*", "changedFilesAgent", ")", "prune", "(", ")", "{", "c", ".", "Lock", "(", ")", "\n", "defer", "c", ".", "Unlock", "(", ")", "\n", "c", ".", "changeCache", "=", "c", ".", "nextChangeCache", "\n", "c", ".", "nextChangeCache", "=", "<mask>", "(", "map", "[", "changeCacheKey", "]", "[", "]", "string", ")", "\n", "}" ]
9,139
all-9140
[ "PostsubmitToJobSpec", "generates", "a", "downwardapi", ".", "JobSpec", "out", "of", "a", "Postsubmit", ".", "Useful", "for", "figuring", "out", "GCS", "paths", "when", "parsing", "jobs", "out", "of", "a", "prow", "config", "." ]
[ "func", "PostsubmitToJobSpec", "(", "<mask>", "config", ".", "Postsubmit", ")", "*", "downwardapi", ".", "JobSpec", "{", "return", "&", "downwardapi", ".", "JobSpec", "{", "Type", ":", "prowapi", ".", "PostsubmitJob", ",", "Job", ":", "post", ".", "Name", ",", "}", "\n", "}" ]
9,140
all-9141
[ "createBridgeNetworkConfigWithIPAM", "creates", "the", "config", "of", "bridge", "for", "ADD", "command", "where", "bridge", "plugin", "acquires", "the", "IP", "and", "route", "information", "from", "IPAM" ]
[ "func", "(", "client", "*", "cniClient", ")", "createBridgeNetworkConfigWithIPAM", "(", "cfg", "*", "Config", ")", "(", "string", ",", "*", "libcni", ".", "NetworkConfig", ",", "error", ")", "{", "// Create the bridge config first", "bridgeConfig", ":=", "client", ".", "createBridgeConfig", "(", "cfg", ")", "\n\n", "// Create the ipam config", "ipamConfig", ",", "err", ":=", "client", ".", "createIPAMConfig", "(", "cfg", ")", "\n", "if", "err", "!=", "nil", "{", "return", "\"", "\"", ",", "nil", ",", "<mask>", ".", "Wrap", "(", "err", ",", "\"", "\"", ")", "\n", "}", "\n\n", "bridgeConfig", ".", "IPAM", "=", "ipamConfig", "\n\n", "networkConfig", ",", "err", ":=", "client", ".", "constructNetworkConfig", "(", "bridgeConfig", ",", "ECSBridgePluginName", ")", "\n", "if", "err", "!=", "nil", "{", "return", "\"", "\"", ",", "nil", ",", "errors", ".", "Wrap", "(", "err", ",", "\"", "\"", ")", "\n", "}", "\n", "return", "defaultVethName", ",", "networkConfig", ",", "nil", "\n", "}" ]
9,141
all-9142
[ "pipelineMeta", "builds", "the", "pipeline", "metadata", "from", "prow", "job", "definition" ]
[ "func", "pipelineMeta", "(", "pj", "prowjobv1", ".", "ProwJob", ")", "metav1", ".", "ObjectMeta", "{", "labels", ",", "annotations", ":=", "decorate", ".", "LabelsAndAnnotationsForJob", "(", "pj", ")", "\n", "return", "metav1", ".", "ObjectMeta", "{", "Annotations", ":", "annotations", ",", "Name", ":", "pj", ".", "<mask>", ",", "Namespace", ":", "pj", ".", "Spec", ".", "Namespace", ",", "Labels", ":", "labels", ",", "}", "\n", "}" ]
9,142
all-9143
[ "FakeNewCollectionDialer", "-" ]
[ "func", "FakeNewCollectionDialer", "(", "c", "taskmanager", ".", "<mask>", ")", "func", "(", "url", ",", "dbname", ",", "collectionname", "string", ")", "(", "col", "integrations", ".", "Collection", ",", "err", "error", ")", "{", "return", "func", "(", "url", ",", "dbname", ",", "collectionname", "string", ")", "(", "col", "integrations", ".", "Collection", ",", "err", "error", ")", "{", "col", "=", "&", "FakeCollection", "{", "ControlTask", ":", "c", ",", "}", "\n", "return", "\n", "}", "\n", "}" ]
9,143
all-9144
[ "UnmarshalJSON", "supports", "json", ".", "Unmarshaler", "interface" ]
[ "func", "(", "v", "*", "GetFlattenedDocumentReturns", ")", "UnmarshalJSON", "(", "<mask>", "[", "]", "byte", ")", "error", "{", "r", ":=", "jlexer", ".", "Lexer", "{", "Data", ":", "data", "}", "\n", "easyjsonC5a4559bDecodeGithubComChromedpCdprotoDom42", "(", "&", "r", ",", "v", ")", "\n", "return", "r", ".", "Error", "(", ")", "\n", "}" ]
9,144
all-9145
[ "Body", "returns", "the", "body", "text", "of", "the", "github", "issue", "and", "*", "must", "*", "contain", "the", "output", "of", "ID", "()", ".", "closedIssues", "is", "a", "(", "potentially", "empty", ")", "slice", "containing", "all", "closed", "issues", "authored", "by", "this", "bot", "that", "contain", "ID", "()", "in", "their", "body", ".", "If", "Body", "returns", "an", "empty", "string", "no", "issue", "is", "created", "." ]
[ "func", "(", "fj", "*", "FlakyJob", ")", "Body", "(", "closedIssues", "[", "]", "*", "githubapi", ".", "Issue", ")", "string", "{", "// First check that the most recently closed issue (if any exist) was closed", "// at least a week ago (since that is the sliding window size used by the flake metric).", "cutoffTime", ":=", "time", ".", "Now", "(", ")", ".", "AddDate", "(", "0", ",", "0", ",", "-", "7", ")", "\n", "for", "_", ",", "closed", ":=", "range", "closedIssues", "{", "if", "closed", ".", "ClosedAt", ".", "After", "(", "cutoffTime", ")", "{", "return", "\"", "\"", "\n", "}", "\n", "}", "\n\n", "// Print stats about the flaky job.", "var", "buf", "bytes", ".", "Buffer", "\n", "fmt", ".", "Fprintf", "(", "&", "buf", ",", "\"", "\\n", "\\n", "\\n", "\"", ",", "fj", ".", "ID", "(", ")", ",", "*", "fj", ".", "FlakeCount", ",", "*", "fj", ".", "Consistency", "*", "100", ")", "\n", "if", "len", "(", "fj", ".", "FlakyTests", ")", ">", "0", "{", "fmt", ".", "Fprint", "(", "&", "buf", ",", "\"", "\\n", "\\n", "\\n", "\\n", "\"", ")", "\n", "for", "_", ",", "testName", ":=", "range", "fj", ".", "TestsSorted", "(", ")", "{", "fmt", ".", "Fprintf", "(", "&", "buf", ",", "\"", "\\n", "\"", ",", "testName", ",", "fj", ".", "FlakyTests", "[", "testName", "]", ")", "\n", "}", "\n", "}", "\n", "// List previously closed issues if there are any.", "if", "len", "(", "closedIssues", ")", ">", "0", "{", "fmt", ".", "Fprint", "(", "&", "buf", ",", "\"", "\\n", "\\n", "\"", ")", "\n", "for", "_", ",", "closed", ":=", "range", "closedIssues", "{", "fmt", ".", "Fprintf", "(", "&", "buf", ",", "\"", "\"", ",", "*", "closed", ".", "Number", ")", "\n", "}", "\n", "fmt", ".", "Fprint", "(", "&", "buf", ",", "\"", "\\n", "\"", ")", "\n", "}", "\n\n", "// Create /assign command.", "testsSorted", ":=", "fj", ".", "TestsSorted", "(", ")", "\n", "ownersMap", ":=", "fj", ".", "reporter", ".", "<mask>", ".", "TestsOwners", "(", "testsSorted", ")", "\n", "if", "len", "(", "ownersMap", ")", ">", "0", "{", "fmt", ".", "Fprint", "(", "&", "buf", ",", "\"", "\\n", "\"", ")", "\n", "for", "user", ":=", "range", "ownersMap", "{", "fmt", ".", "Fprintf", "(", "&", "buf", ",", "\"", "\"", ",", "user", ")", "\n", "}", "\n", "fmt", ".", "Fprint", "(", "&", "buf", ",", "\"", "\\n", "\"", ")", "\n", "}", "\n\n", "// Explain why assignees were assigned and why sig labels were applied.", "fmt", ".", "Fprintf", "(", "&", "buf", ",", "\"", "\\n", "\"", ",", "fj", ".", "reporter", ".", "creator", ".", "ExplainTestAssignments", "(", "testsSorted", ")", ")", "\n\n", "fmt", ".", "Fprintf", "(", "&", "buf", ",", "\"", "\\n", "\\n", "\"", ",", "fj", ".", "reporter", ".", "flakyJobDataURL", ")", "\n\n", "fmt", ".", "Fprintf", "(", "&", "buf", ",", "\"", "\\n", "\\n", "\"", ")", "\n\n", "return", "buf", ".", "String", "(", ")", "\n", "}" ]
9,145
all-9146
[ "RemoveSnapshot", "deletes", "all", "saved", "states", "for", "the", "snapshot", ".", "Parameters", ":", "snapshot", ":", "A", "Snapshot", "instance", ".", "Call", "VM", ".", "RootSnapshot", "()", "to", "get", "a", "snapshot", "instance", ".", "Remarks", ":", "*", "This", "function", "deletes", "all", "saved", "states", "for", "the", "specified", "snapshot", ".", "If", "the", "snapshot", "was", "based", "on", "another", "snapshot", "the", "base", "snapshot", "becomes", "the", "new", "root", "snapshot", ".", "*", "The", "VMware", "Server", "release", "of", "the", "VIX", "API", "can", "manage", "only", "a", "single", "snapshot", "for", "each", "virtual", "machine", ".", "A", "virtual", "machine", "imported", "from", "another", "VMware", "product", "can", "have", "more", "than", "one", "snapshot", "at", "the", "time", "it", "is", "imported", ".", "In", "that", "case", "you", "can", "delete", "only", "a", "snapshot", "subsequently", "added", "using", "the", "VIX", "API", ".", "*", "Starting", "in", "VMware", "Workstation", "6", ".", "5", "snapshot", "operations", "are", "allowed", "on", "virtual", "machines", "that", "are", "part", "of", "a", "team", ".", "Previously", "this", "operation", "failed", "with", "error", "code", "VIX_PROPERTY_VM_IN_VMTEAM", ".", "Team", "members", "snapshot", "independently", "so", "they", "can", "have", "different", "and", "inconsistent", "snapshot", "states", ".", "*", "This", "function", "is", "not", "supported", "when", "using", "the", "VMWARE_PLAYER", "provider", "*", "If", "the", "virtual", "machine", "is", "open", "and", "powered", "off", "in", "the", "UI", "this", "function", "may", "close", "the", "virtual", "machine", "in", "the", "UI", "before", "deleting", "the", "snapshot", ".", "Since", "VMware", "Server", "1", ".", "0" ]
[ "func", "(", "v", "*", "VM", ")", "RemoveSnapshot", "(", "snapshot", "*", "Snapshot", ",", "options", "RemoveSnapshotOption", ")", "error", "{", "<mask>", "jobHandle", "C", ".", "VixHandle", "=", "C", ".", "VIX_INVALID_HANDLE", "\n", "var", "err", "C", ".", "VixError", "=", "C", ".", "VIX_OK", "\n\n", "jobHandle", "=", "C", ".", "VixVM_RemoveSnapshot", "(", "v", ".", "handle", ",", "//vmHandle", "snapshot", ".", "handle", ",", "//snapshotHandle", "C", ".", "VixRemoveSnapshotOptions", "(", "options", ")", ",", "//options", "nil", ",", "//callbackProc", "nil", ")", "//clientData", "\n\n", "defer", "C", ".", "Vix_ReleaseHandle", "(", "jobHandle", ")", "\n\n", "err", "=", "C", ".", "vix_job_wait", "(", "jobHandle", ")", "\n", "if", "C", ".", "VIX_OK", "!=", "err", "{", "return", "&", "Error", "{", "Operation", ":", "\"", "\"", ",", "Code", ":", "int", "(", "err", "&", "0xFFFF", ")", ",", "Text", ":", "C", ".", "GoString", "(", "C", ".", "Vix_GetErrorText", "(", "err", ",", "nil", ")", ")", ",", "}", "\n", "}", "\n\n", "return", "nil", "\n", "}" ]
9,146
all-9147
[ "Start", "starts", "the", "app", "calling", "the", "provisioner", ".", "Start", "method", "and", "changing", "the", "units", "state", "to", "StatusStarted", "." ]
[ "func", "(", "app", "*", "App", ")", "Start", "(", "w", "io", ".", "Writer", ",", "process", "string", ")", "error", "{", "w", "=", "app", ".", "withLogWriter", "(", "w", ")", "\n", "msg", ":=", "fmt", ".", "Sprintf", "(", "\"", "\\n", "\"", ",", "process", ")", "\n", "if", "process", "==", "\"", "\"", "{", "msg", "=", "fmt", ".", "Sprintf", "(", "\"", "\\n", "\"", ",", "app", ".", "<mask>", ")", "\n", "}", "\n", "fmt", ".", "Fprintf", "(", "w", ",", "\"", "\\n", "\"", ",", "msg", ")", "\n", "prov", ",", "err", ":=", "app", ".", "getProvisioner", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "err", "=", "prov", ".", "Start", "(", "app", ",", "process", ")", "\n", "if", "err", "!=", "nil", "{", "log", ".", "Errorf", "(", "\"", "\"", ",", "app", ".", "Name", ",", "err", ")", "\n", "return", "err", "\n", "}", "\n", "rebuild", ".", "RoutesRebuildOrEnqueue", "(", "app", ".", "Name", ")", "\n", "return", "err", "\n", "}" ]
9,147
all-9148
[ "Get", "returns", "an", "interface", "value", "for", "a", "specific", "column", "." ]
[ "func", "(", "r", "Record", ")", "Get", "(", "column", "string", ")", "(", "interface", "{", "}", ",", "error", ")", "{", "v", ",", "<mask>", ":=", "r", "[", "column", "]", "\n", "if", "!", "ok", "{", "return", "nil", ",", "ErrUnknownColumn", "\n", "}", "\n\n", "return", "v", ",", "nil", "\n", "}" ]
9,148
all-9149
[ "GroupHas", "reports", "whether", "the", "group", "has", "all", "given", "permissions", "." ]
[ "func", "(", "i", "*", "info", ")", "GroupHas", "(", "p", "...", "perm", ")", "bool", "{", "mode", ":=", "i", ".", "fi", ".", "Mode", "(", ")", "\n\n", "for", "_", ",", "v", ":=", "range", "p", "{", "switch", "v", "{", "case", "R", ":", "if", "mode", "&", "modeRGroup", "==", "0", "{", "return", "false", "\n", "}", "\n", "<mask>", "W", ":", "if", "mode", "&", "modeWGroup", "==", "0", "{", "return", "false", "\n", "}", "\n", "case", "X", ":", "if", "mode", "&", "modeXGroup", "==", "0", "{", "return", "false", "\n", "}", "\n", "}", "\n", "}", "\n", "return", "true", "\n", "}" ]
9,149
all-9150
[ "SetNodeName", "sets", "node", "name", "for", "a", "node", "with", "given", "id", ".", "See", ":", "https", ":", "//", "chromedevtools", ".", "github", ".", "io", "/", "devtools", "-", "protocol", "/", "tot", "/", "DOM#method", "-", "setNodeName", "parameters", ":", "nodeID", "-", "Id", "of", "the", "node", "to", "set", "name", "for", ".", "name", "-", "New", "node", "s", "name", "." ]
[ "func", "SetNodeName", "(", "nodeID", "cdp", ".", "NodeID", ",", "name", "string", ")", "*", "SetNodeNameParams", "{", "return", "&", "SetNodeNameParams", "{", "NodeID", ":", "nodeID", ",", "Name", ":", "<mask>", ",", "}", "\n", "}" ]
9,150
all-9151
[ "UnmarshalJSON", "satisfies", "json", ".", "Unmarshaler", "." ]
[ "func", "(", "t", "*", "TransferMode", ")", "UnmarshalJSON", "(", "buf", "[", "]", "<mask>", ")", "error", "{", "return", "easyjson", ".", "Unmarshal", "(", "buf", ",", "t", ")", "\n", "}" ]
9,151
all-9152
[ "ValidatePassword", "checks", "if", "a", "given", "password", "hash", "and", "salt", "are", "matching", "." ]
[ "func", "ValidatePassword", "(", "hash", "Base64String", ",", "password", ",", "salt", "string", ")", "error", "{", "salted", ":=", "[", "]", "byte", "(", "fmt", ".", "Sprint", "(", "<mask>", ",", "salt", ")", ")", "\n", "hashB", ",", "err", ":=", "ToBytes", "(", "hash", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "return", "bcrypt", ".", "CompareHashAndPassword", "(", "hashB", ",", "salted", ")", "\n", "}" ]
9,152
all-9153
[ "ParseSource", "parses", "the", "source", "and", "returns", "the", "result", "." ]
[ "func", "ParseSource", "(", "src", "*", "source", ",", "opts", "*", "Options", ")", "(", "*", "result", ",", "error", ")", "{", "// Initialize the options.", "opts", "=", "InitializeOptions", "(", "opts", ")", "\n\n", "rslt", ":=", "newResult", "(", "nil", ",", "nil", ",", "nil", ")", "\n\n", "base", ",", "err", ":=", "parseBytes", "(", "src", ".", "base", ".", "data", ",", "rslt", ",", "src", ",", "opts", ",", "src", ".", "base", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "inner", ",", "err", ":=", "parseBytes", "(", "src", ".", "inner", ".", "data", ",", "rslt", ",", "src", ",", "opts", ",", "src", ".", "inner", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "includes", ":=", "make", "(", "map", "[", "string", "]", "[", "]", "element", ")", "\n\n", "for", "_", ",", "f", ":=", "range", "src", ".", "includes", "{", "includes", "[", "f", ".", "path", "]", ",", "err", "=", "parseBytes", "(", "f", ".", "<mask>", ",", "rslt", ",", "src", ",", "opts", ",", "f", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "}", "\n\n", "rslt", ".", "base", "=", "base", "\n", "rslt", ".", "inner", "=", "inner", "\n", "rslt", ".", "includes", "=", "includes", "\n\n", "return", "rslt", ",", "nil", "\n", "}" ]
9,153
all-9154
[ "UnmarshalYAML", "implements", "the", "yaml", ".", "Unmarshaler", "interface", "." ]
[ "func", "(", "c", "*", "NamespaceDiscovery", ")", "UnmarshalYAML", "(", "unmarshal", "func", "(", "<mask>", "{", "}", ")", "error", ")", "error", "{", "*", "c", "=", "NamespaceDiscovery", "{", "}", "\n", "type", "plain", "NamespaceDiscovery", "\n", "return", "unmarshal", "(", "(", "*", "plain", ")", "(", "c", ")", ")", "\n", "}" ]
9,154
all-9155
[ "ArchiveBuildCmds", "build", "a", "image", "using", "the", "archive", "method", "." ]
[ "func", "ArchiveBuildCmds", "(", "app", "provision", ".", "App", ",", "archiveURL", "<mask>", ")", "[", "]", "string", "{", "return", "buildCmds", "(", "app", ",", "\"", "\"", ",", "\"", "\"", ",", "archiveURL", ")", "\n", "}" ]
9,155
all-9156
[ "NewClient", "returns", "a", "new", "OpenGDPR", "client", "." ]
[ "func", "NewClient", "(", "opts", "*", "ClientOptions", ")", "*", "Client", "{", "cli", ":=", "opts", ".", "Client", "\n", "if", "cli", "==", "nil", "{", "cli", "=", "<mask>", ".", "DefaultClient", "\n", "}", "\n", "client", ":=", "&", "Client", "{", "caller", ":", "&", "defaultCaller", "{", "client", ":", "cli", ",", "headers", ":", "map", "[", "string", "]", "string", "{", "\"", "\"", ":", "ApiVersion", ",", "\"", "\"", ":", "\"", "\"", ",", "}", ",", "}", ",", "endpoint", ":", "opts", ".", "Endpoint", ",", "verifier", ":", "opts", ".", "Verifier", ",", "}", "\n", "return", "client", "\n", "}" ]
9,156
all-9157
[ "Do", "executes", "Animation", ".", "setPaused", "against", "the", "provided", "context", "." ]
[ "func", "(", "p", "*", "SetPausedParams", ")", "Do", "(", "ctx", "context", ".", "<mask>", ")", "(", "err", "error", ")", "{", "return", "cdp", ".", "Execute", "(", "ctx", ",", "CommandSetPaused", ",", "p", ",", "nil", ")", "\n", "}" ]
9,157
all-9158
[ "Read", "function", "reads", "configurations", "from", "the", "file", "defined", "in", "Config", ".", "filename", "." ]
[ "func", "(", "c", "*", "Config", ")", "Read", "(", ")", "error", "{", "in", ",", "err", ":=", "os", ".", "Open", "(", "c", ".", "filename", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "defer", "<mask>", ".", "Close", "(", ")", "\n", "scanner", ":=", "bufio", ".", "NewScanner", "(", "in", ")", "\n", "line", ":=", "\"", "\"", "\n", "section", ":=", "\"", "\"", "\n", "for", "scanner", ".", "Scan", "(", ")", "{", "if", "scanner", ".", "Text", "(", ")", "==", "\"", "\"", "{", "continue", "\n", "}", "\n", "if", "line", "==", "\"", "\"", "{", "sec", ",", "ok", ":=", "checkSection", "(", "scanner", ".", "Text", "(", ")", ")", "\n", "if", "ok", "{", "section", "=", "sec", "\n", "continue", "\n", "}", "\n", "}", "\n", "if", "checkComment", "(", "scanner", ".", "Text", "(", ")", ")", "{", "continue", "\n", "}", "\n", "line", "+=", "scanner", ".", "Text", "(", ")", "\n", "if", "strings", ".", "HasSuffix", "(", "line", ",", "\"", "\\\\", "\"", ")", "{", "line", "=", "line", "[", ":", "len", "(", "line", ")", "-", "1", "]", "\n", "continue", "\n", "}", "\n", "key", ",", "value", ",", "ok", ":=", "checkLine", "(", "line", ")", "\n", "if", "!", "ok", "{", "return", "errors", ".", "New", "(", "\"", "\"", "+", "line", ")", "\n", "}", "\n", "c", ".", "Set", "(", "section", ",", "key", ",", "value", ")", "\n", "line", "=", "\"", "\"", "\n", "}", "\n", "return", "nil", "\n", "}" ]
9,158
all-9159
[ "NewDiscovery", "returns", "a", "new", "AzureDiscovery", "which", "periodically", "refreshes", "its", "targets", "." ]
[ "func", "NewDiscovery", "(", "cfg", "*", "SDConfig", ",", "logger", "log", ".", "Logger", ")", "*", "Discovery", "{", "if", "logger", "==", "nil", "{", "logger", "=", "log", ".", "NewNopLogger", "(", ")", "\n", "}", "\n", "d", ":=", "&", "Discovery", "{", "cfg", ":", "cfg", ",", "port", ":", "cfg", ".", "Port", ",", "logger", ":", "logger", ",", "}", "\n", "d", ".", "Discovery", "=", "refresh", ".", "NewDiscovery", "(", "logger", ",", "\"", "\"", ",", "<mask>", ".", "Duration", "(", "cfg", ".", "RefreshInterval", ")", ",", "d", ".", "refresh", ",", ")", "\n", "return", "d", "\n", "}" ]
9,159
all-9160
[ "GetLSBRelease", "returns", "a", "map", "with", "Linux", "distribution", "information" ]
[ "func", "GetLSBRelease", "(", ")", "(", "map", "[", "string", "]", "string", ",", "error", ")", "{", "osRelease", ",", "err", ":=", "getLSBRelease", "(", "\"", "\"", ")", "\n", "if", "<mask>", ".", "IsNotExist", "(", "err", ")", "{", "return", "getLSBRelease", "(", "\"", "\"", ")", "\n", "}", "\n", "return", "osRelease", ",", "err", "\n", "}" ]
9,160
all-9161
[ "GetType", "returns", "the", "Type", "field", "if", "non", "-", "nil", "zero", "value", "otherwise", "." ]
[ "func", "(", "i", "*", "IntegrationGCPCreateRequest", ")", "GetType", "(", ")", "string", "{", "if", "i", "==", "nil", "||", "i", ".", "<mask>", "==", "nil", "{", "return", "\"", "\"", "\n", "}", "\n", "return", "*", "i", ".", "Type", "\n", "}" ]
9,161
all-9162
[ "CreateStatus", "adds", "a", "status", "context", "to", "a", "commit", "." ]
[ "func", "(", "f", "*", "FakeClient", ")", "CreateStatus", "(", "owner", ",", "repo", ",", "SHA", "string", ",", "s", "github", ".", "Status", ")", "error", "{", "if", "f", ".", "CreatedStatuses", "==", "nil", "{", "f", ".", "CreatedStatuses", "=", "make", "(", "map", "[", "string", "]", "[", "]", "github", ".", "Status", ")", "\n", "}", "\n", "statuses", ":=", "f", ".", "CreatedStatuses", "[", "SHA", "]", "\n", "<mask>", "updated", "bool", "\n", "for", "i", ":=", "range", "statuses", "{", "if", "statuses", "[", "i", "]", ".", "Context", "==", "s", ".", "Context", "{", "statuses", "[", "i", "]", "=", "s", "\n", "updated", "=", "true", "\n", "}", "\n", "}", "\n", "if", "!", "updated", "{", "statuses", "=", "append", "(", "statuses", ",", "s", ")", "\n", "}", "\n", "f", ".", "CreatedStatuses", "[", "SHA", "]", "=", "statuses", "\n", "return", "nil", "\n", "}" ]
9,162
all-9163
[ "Verify", "parses", "unverifiedSignature", "and", "returns", "the", "content", "and", "the", "signer", "s", "identity" ]
[ "func", "(", "m", "*", "openpgpSigningMechanism", ")", "Verify", "(", "unverifiedSignature", "[", "]", "byte", ")", "(", "contents", "[", "]", "byte", ",", "keyIdentity", "string", ",", "err", "error", ")", "{", "md", ",", "err", ":=", "openpgp", ".", "ReadMessage", "(", "bytes", ".", "NewReader", "(", "unverifiedSignature", ")", ",", "m", ".", "keyring", ",", "nil", ",", "nil", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "\"", "\"", ",", "err", "\n", "}", "\n", "if", "!", "md", ".", "IsSigned", "{", "return", "nil", ",", "\"", "\"", ",", "errors", ".", "New", "(", "\"", "\"", ")", "\n", "}", "\n", "content", ",", "err", ":=", "ioutil", ".", "ReadAll", "(", "md", ".", "UnverifiedBody", ")", "\n", "if", "err", "!=", "nil", "{", "// Coverage: md.UnverifiedBody.Read only fails if the body is encrypted", "// (and possibly also signed, but it _must_ be encrypted) and the signing", "// “modification detection code” detects a mismatch. But in that case,", "// we would expect the signature verification to fail as well, and that is checked", "// first. Besides, we are not supplying any decryption keys, so we really", "// can never reach this “encrypted data MDC mismatch” path.", "return", "nil", ",", "\"", "\"", ",", "err", "\n", "}", "\n", "if", "md", ".", "SignatureError", "!=", "nil", "{", "return", "nil", ",", "\"", "\"", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "md", ".", "SignatureError", ")", "\n", "}", "\n", "if", "<mask>", ".", "SignedBy", "==", "nil", "{", "return", "nil", ",", "\"", "\"", ",", "InvalidSignatureError", "{", "msg", ":", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "md", ".", "Signature", ")", "}", "\n", "}", "\n", "if", "md", ".", "Signature", "!=", "nil", "{", "if", "md", ".", "Signature", ".", "SigLifetimeSecs", "!=", "nil", "{", "expiry", ":=", "md", ".", "Signature", ".", "CreationTime", ".", "Add", "(", "time", ".", "Duration", "(", "*", "md", ".", "Signature", ".", "SigLifetimeSecs", ")", "*", "time", ".", "Second", ")", "\n", "if", "time", ".", "Now", "(", ")", ".", "After", "(", "expiry", ")", "{", "return", "nil", ",", "\"", "\"", ",", "InvalidSignatureError", "{", "msg", ":", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "expiry", ")", "}", "\n", "}", "\n", "}", "\n", "}", "else", "if", "md", ".", "SignatureV3", "==", "nil", "{", "// Coverage: If md.SignedBy != nil, the final md.UnverifiedBody.Read() either sets one of md.Signature or md.SignatureV3,", "// or sets md.SignatureError.", "return", "nil", ",", "\"", "\"", ",", "InvalidSignatureError", "{", "msg", ":", "\"", "\"", "}", "\n", "}", "\n\n", "// Uppercase the fingerprint to be compatible with gpgme", "return", "content", ",", "strings", ".", "ToUpper", "(", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "md", ".", "SignedBy", ".", "PublicKey", ".", "Fingerprint", ")", ")", ",", "nil", "\n", "}" ]
9,163
all-9164
[ "NewLongThen", "creates", "a", "new", "long", "running", "Then", "comand", "." ]
[ "func", "NewLongThen", "(", "command", "string", ",", "args", "...", "string", ")", "Then", "{", "return", "&", "gitCmd", "{", "<mask>", ":", "command", ",", "args", ":", "args", ",", "background", ":", "true", ",", "haltChan", ":", "make", "(", "chan", "struct", "{", "}", ")", "}", "\n", "}" ]
9,164
all-9165
[ "MarshalJSON", "supports", "json", ".", "Marshaler", "interface" ]
[ "func", "(", "v", "GetDatabaseTableNamesParams", ")", "MarshalJSON", "(", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "w", ":=", "jwriter", ".", "Writer", "{", "}", "\n", "easyjsonC5a4559bEncodeGithubComChromedpCdprotoDatabase1", "(", "&", "w", ",", "v", ")", "\n", "return", "w", ".", "<mask>", ".", "BuildBytes", "(", ")", ",", "w", ".", "Error", "\n", "}" ]
9,165
all-9166
[ "ParseReference", "converts", "a", "string", "which", "should", "not", "start", "with", "the", "ImageTransport", ".", "Name", "prefix", "into", "an", "Docker", "ImageReference", "." ]
[ "func", "ParseReference", "(", "refString", "string", ")", "(", "types", ".", "ImageReference", ",", "error", ")", "{", "if", "!", "strings", ".", "HasPrefix", "(", "refString", ",", "\"", "\"", ")", "{", "return", "nil", ",", "errors", ".", "Errorf", "(", "\"", "\"", ",", "refString", ")", "\n", "}", "\n", "ref", ",", "err", ":=", "reference", ".", "ParseNormalizedNamed", "(", "strings", ".", "TrimPrefix", "(", "refString", ",", "\"", "\"", ")", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "ref", "=", "reference", ".", "TagNameOnly", "(", "ref", ")", "\n", "return", "NewReference", "(", "<mask>", ")", "\n", "}" ]
9,166
all-9167
[ "ReorderChild", "()", "is", "a", "wrapper", "around", "gtk_box_reorder_child", "()", "." ]
[ "func", "(", "v", "*", "Box", ")", "ReorderChild", "(", "child", "IWidget", ",", "position", "int", ")", "{", "C", ".", "gtk_box_reorder_child", "(", "v", ".", "native", "(", ")", ",", "<mask>", ".", "toWidget", "(", ")", ",", "C", ".", "gint", "(", "position", ")", ")", "\n", "}" ]
9,167
all-9168
[ "edges1", "calls", "fn", "for", "the", "edges", "found", "in", "an", "object", "of", "type", "t", "living", "at", "offset", "off", "in", "the", "root", "r", ".", "If", "fn", "returns", "false", "return", "immediately", "with", "false", "." ]
[ "func", "edges1", "(", "p", "*", "Process", ",", "r", "*", "Root", ",", "off", "int64", ",", "t", "*", "Type", ",", "fn", "func", "(", "int64", ",", "Object", ",", "int64", ")", "bool", ")", "bool", "{", "switch", "t", ".", "Kind", "{", "case", "KindBool", ",", "KindInt", ",", "KindUint", ",", "KindFloat", ",", "KindComplex", ":", "// no edges here", "case", "KindIface", ",", "KindEface", ":", "// The first word is a type or itab.", "// Itabs are never in the heap.", "// Types might be, though.", "a", ":=", "r", ".", "Addr", ".", "Add", "(", "off", ")", "\n", "if", "r", ".", "Frame", "==", "nil", "||", "r", ".", "Frame", ".", "Live", "[", "a", "]", "{", "dst", ",", "off2", ":=", "p", ".", "FindObject", "(", "p", ".", "proc", ".", "ReadPtr", "(", "a", ")", ")", "\n", "if", "dst", "!=", "0", "{", "if", "!", "fn", "(", "off", ",", "dst", ",", "off2", ")", "{", "return", "false", "\n", "}", "\n", "}", "\n", "}", "\n", "// Treat second word like a pointer.", "off", "+=", "p", ".", "proc", ".", "PtrSize", "(", ")", "\n", "fallthrough", "\n", "case", "KindPtr", ",", "KindString", ",", "KindSlice", ",", "KindFunc", ":", "a", ":=", "r", ".", "Addr", ".", "Add", "(", "off", ")", "\n", "if", "r", ".", "Frame", "==", "nil", "||", "r", ".", "Frame", ".", "Live", "[", "a", "]", "{", "dst", ",", "off2", ":=", "p", ".", "FindObject", "(", "p", ".", "proc", ".", "ReadPtr", "(", "a", ")", ")", "\n", "if", "dst", "!=", "0", "{", "if", "!", "fn", "(", "off", ",", "dst", ",", "off2", ")", "{", "return", "false", "\n", "}", "\n", "}", "\n", "}", "\n", "case", "KindArray", ":", "s", ":=", "t", ".", "Elem", ".", "Size", "\n", "for", "i", ":=", "int64", "(", "0", ")", ";", "i", "<", "t", ".", "Count", ";", "i", "++", "{", "if", "!", "edges1", "(", "p", ",", "r", ",", "off", "+", "i", "*", "s", ",", "t", ".", "Elem", ",", "fn", ")", "{", "return", "false", "\n", "}", "\n", "}", "\n", "<mask>", "KindStruct", ":", "for", "_", ",", "f", ":=", "range", "t", ".", "Fields", "{", "if", "!", "edges1", "(", "p", ",", "r", ",", "off", "+", "f", ".", "Off", ",", "f", ".", "Type", ",", "fn", ")", "{", "return", "false", "\n", "}", "\n", "}", "\n", "}", "\n", "return", "true", "\n", "}" ]
9,168
all-9169
[ "MarshalJSON", "supports", "json", ".", "Marshaler", "interface" ]
[ "func", "(", "v", "Event", ")", "MarshalJSON", "(", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "w", ":=", "jwriter", ".", "<mask>", "{", "}", "\n", "easyjsonC5a4559bEncodeGithubComChromedpCdprotoBackgroundservice6", "(", "&", "w", ",", "v", ")", "\n", "return", "w", ".", "Buffer", ".", "BuildBytes", "(", ")", ",", "w", ".", "Error", "\n", "}" ]
9,169
all-9170
[ "ListAll", "populates", "a", "set", "will", "all", "available", "NATGateway", "resources", "." ]
[ "func", "(", "NATGateway", ")", "ListAll", "(", "sess", "*", "session", ".", "Session", ",", "acct", ",", "region", "string", ")", "(", "*", "Set", ",", "error", ")", "{", "svc", ":=", "ec2", ".", "New", "(", "sess", ",", "&", "aws", ".", "Config", "{", "Region", ":", "aws", ".", "String", "(", "region", ")", "}", ")", "\n", "set", ":=", "NewSet", "(", "0", ")", "\n", "inp", ":=", "&", "ec2", ".", "DescribeNatGatewaysInput", "{", "}", "\n\n", "err", ":=", "svc", ".", "DescribeNatGatewaysPages", "(", "inp", ",", "func", "(", "page", "*", "ec2", ".", "DescribeNatGatewaysOutput", ",", "_", "bool", ")", "bool", "{", "for", "_", ",", "gw", ":=", "range", "page", ".", "NatGateways", "{", "now", ":=", "time", ".", "Now", "(", ")", "\n", "arn", ":=", "natGateway", "{", "Account", ":", "acct", ",", "Region", ":", "region", ",", "ID", ":", "*", "gw", ".", "NatGatewayId", ",", "}", ".", "ARN", "(", ")", "\n\n", "<mask>", ".", "firstSeen", "[", "arn", "]", "=", "now", "\n", "}", "\n\n", "return", "true", "\n", "}", ")", "\n\n", "return", "set", ",", "errors", ".", "Wrapf", "(", "err", ",", "\"", "\"", ",", "acct", ",", "region", ")", "\n", "}" ]
9,170
all-9171
[ "title", ":", "move", "container", "path", ":", "/", "docker", "/", "container", "/", "{", "id", "}", "/", "move", "method", ":", "POST", "consume", ":", "application", "/", "x", "-", "www", "-", "form", "-", "urlencoded", "produce", ":", "application", "/", "x", "-", "json", "-", "stream", "responses", ":", "200", ":", "Ok", "400", ":", "Invalid", "data", "401", ":", "Unauthorized", "404", ":", "Not", "found" ]
[ "func", "moveContainerHandler", "(", "w", "http", ".", "ResponseWriter", ",", "r", "*", "http", ".", "Request", ",", "t", "auth", ".", "Token", ")", "(", "err", "error", ")", "{", "params", ":=", "map", "[", "string", "]", "string", "{", "}", "\n", "err", "=", "api", ".", "ParseInput", "(", "r", ",", "&", "params", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "contId", ":=", "r", ".", "URL", ".", "Query", "(", ")", ".", "Get", "(", "\"", "\"", ")", "\n", "to", ":=", "params", "[", "\"", "\"", "]", "\n", "if", "to", "==", "\"", "\"", "{", "return", "&", "tsuruErrors", ".", "ValidationError", "{", "Message", ":", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "contId", ",", "to", ")", "}", "\n", "}", "\n", "cont", ",", "err", ":=", "mainDockerProvisioner", ".", "GetContainer", "(", "contId", ")", "\n", "if", "err", "!=", "nil", "{", "return", "&", "tsuruErrors", ".", "HTTP", "{", "Code", ":", "http", ".", "StatusNotFound", ",", "Message", ":", "err", ".", "Error", "(", ")", "}", "\n", "}", "\n", "permContexts", ",", "err", ":=", "moveContainersPermissionContexts", "(", "cont", ".", "HostAddr", ",", "to", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "if", "!", "permission", ".", "Check", "(", "t", ",", "permission", ".", "PermNodeUpdateMoveContainer", ",", "permContexts", "...", ")", "{", "return", "permission", ".", "ErrUnauthorized", "\n", "}", "\n", "evt", ",", "err", ":=", "event", ".", "New", "(", "&", "event", ".", "Opts", "{", "Target", ":", "event", ".", "Target", "{", "Type", ":", "event", ".", "TargetTypeContainer", ",", "Value", ":", "contId", "}", ",", "Kind", ":", "permission", ".", "PermNodeUpdateMoveContainer", ",", "Owner", ":", "t", ",", "CustomData", ":", "<mask>", ".", "FormToCustomData", "(", "r", ".", "Form", ")", ",", "Allowed", ":", "event", ".", "Allowed", "(", "permission", ".", "PermPoolReadEvents", ",", "permContexts", "...", ")", ",", "}", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "defer", "func", "(", ")", "{", "evt", ".", "Done", "(", "err", ")", "}", "(", ")", "\n", "w", ".", "Header", "(", ")", ".", "Set", "(", "\"", "\"", ",", "\"", "\"", ")", "\n", "keepAliveWriter", ":=", "tsuruIo", ".", "NewKeepAliveWriter", "(", "w", ",", "15", "*", "time", ".", "Second", ",", "\"", "\"", ")", "\n", "defer", "keepAliveWriter", ".", "Stop", "(", ")", "\n", "writer", ":=", "&", "tsuruIo", ".", "SimpleJsonMessageEncoderWriter", "{", "Encoder", ":", "json", ".", "NewEncoder", "(", "keepAliveWriter", ")", "}", "\n", "evt", ".", "SetLogWriter", "(", "writer", ")", "\n", "_", ",", "err", "=", "mainDockerProvisioner", ".", "moveContainer", "(", "contId", ",", "to", ",", "evt", ")", "\n", "if", "err", "!=", "nil", "{", "return", "errors", ".", "Wrap", "(", "err", ",", "\"", "\"", ")", "\n", "}", "\n", "fmt", ".", "Fprintf", "(", "writer", ",", "\"", "\\n", "\"", ")", "\n", "return", "nil", "\n", "}" ]
9,171
all-9172
[ "DeepCopy", "is", "an", "autogenerated", "deepcopy", "function", "copying", "the", "receiver", "creating", "a", "new", "DNSEndpointList", "." ]
[ "func", "(", "in", "*", "DNSEndpointList", ")", "DeepCopy", "(", ")", "*", "DNSEndpointList", "{", "if", "in", "==", "nil", "{", "return", "nil", "\n", "}", "\n", "out", ":=", "new", "(", "DNSEndpointList", ")", "\n", "<mask>", ".", "DeepCopyInto", "(", "out", ")", "\n", "return", "out", "\n", "}" ]
9,172
all-9173
[ "Read", "fetches", "and", "decodes", "K8s", "objects", "by", "path", ".", "TODO", ":", "Replace", "this", "with", "something", "supporting", "more", "sophisticated", "content", "negotiation", "." ]
[ "func", "Read", "(", "vm", "*", "jsonnet", ".", "VM", ",", "path", "string", ")", "(", "[", "]", "runtime", ".", "Object", ",", "error", ")", "{", "ext", ":=", "filepath", ".", "Ext", "(", "path", ")", "\n", "if", "ext", "==", "\"", "\"", "{", "f", ",", "err", ":=", "os", ".", "Open", "(", "path", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "defer", "f", ".", "Close", "(", ")", "\n", "return", "jsonReader", "(", "f", ")", "\n", "}", "else", "if", "ext", "==", "\"", "\"", "{", "f", ",", "err", ":=", "os", ".", "Open", "(", "path", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "defer", "f", ".", "Close", "(", ")", "\n", "return", "yamlReader", "(", "f", ")", "\n", "}", "else", "if", "ext", "==", "\"", "\"", "{", "return", "jsonnetReader", "(", "vm", ",", "path", ")", "\n", "}", "\n\n", "return", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "<mask>", ")", "\n", "}" ]
9,173
all-9174
[ "DeleteRuleSet", "deletes", "passed", "rule", "set", "." ]
[ "func", "(", "a", "*", "API", ")", "DeleteRuleSet", "(", "cfg", "*", "RuleSet", ")", "(", "bool", ",", "error", ")", "{", "if", "cfg", "==", "nil", "{", "return", "<mask>", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ")", "\n", "}", "\n", "return", "a", ".", "DeleteRuleSetByCID", "(", "CIDType", "(", "&", "cfg", ".", "CID", ")", ")", "\n", "}" ]
9,174
all-9175
[ "Print", "outputs", "Print", "log" ]
[ "func", "(", "g", "*", "Glg", ")", "Print", "(", "val", "...", "interface", "{", "}", ")", "error", "{", "return", "g", ".", "<mask>", "(", "PRINT", ",", "blankFormat", "(", "len", "(", "val", ")", ")", ",", "val", "...", ")", "\n", "}" ]
9,175
all-9176
[ "Error", "returns", "the", "string", "representation", "of", "a", "Bambou", "Error", "(", "making", "it", "an", "error", ")", "Valid", "JSON", "formatted" ]
[ "func", "(", "be", "*", "Error", ")", "<mask>", "(", ")", "string", "{", "// return fmt.Sprintf(\"%+v\", *be)", "return", "fmt", ".", "Sprintf", "(", "\"", "\\\"", "\\\"", "\\\"", "\\\"", "\\\"", "\\\"", "\\\"", "\\\"", "\"", ",", "be", ".", "Title", ",", "be", ".", "Description", ")", "\n", "}" ]
9,176
all-9177
[ "Tag", "gets", "the", "tag", "value", "for", "a", "specified", "key", "." ]
[ "func", "(", "s", "*", "DeploymentManifest", ")", "Tag", "(", "<mask>", "string", ")", "string", "{", "if", "s", ".", "Tags", "==", "nil", "{", "return", "\"", "\"", "\n", "}", "\n", "return", "s", ".", "Tags", "[", "key", "]", "\n", "}" ]
9,177
all-9178
[ "Get", "returns", "the", "status", "code", "and", "body", "of", "url", ".", "The", "contents", "of", "dst", "will", "be", "replaced", "by", "the", "body", "and", "returned", "if", "the", "dst", "is", "too", "small", "a", "new", "slice", "will", "be", "allocated", ".", "The", "function", "follows", "redirects", ".", "Use", "Do", "*", "for", "manually", "handling", "redirects", "." ]
[ "func", "Get", "(", "dst", "[", "]", "byte", ",", "url", "string", ")", "(", "statusCode", "int", ",", "body", "[", "]", "<mask>", ",", "err", "error", ")", "{", "return", "defaultClient", ".", "Get", "(", "dst", ",", "url", ")", "\n", "}" ]
9,178
all-9179
[ "SetExecutionStoppedAt", "sets", "the", "ExecutionStoppedAt", "timestamp", "of", "the", "task" ]
[ "func", "(", "<mask>", "*", "Task", ")", "SetExecutionStoppedAt", "(", "timestamp", "time", ".", "Time", ")", "bool", "{", "task", ".", "lock", ".", "Lock", "(", ")", "\n", "defer", "task", ".", "lock", ".", "Unlock", "(", ")", "\n\n", "if", "task", ".", "ExecutionStoppedAtUnsafe", ".", "IsZero", "(", ")", "{", "task", ".", "ExecutionStoppedAtUnsafe", "=", "timestamp", "\n", "return", "true", "\n", "}", "\n", "return", "false", "\n", "}" ]
9,179
all-9180
[ "Token", "is", "an", "implementation", "for", "oauth2", ".", "TokenSource", "interface", "." ]
[ "func", "(", "s", "*", "reloadingTokenSource", ")", "Token", "(", ")", "(", "*", "oauth2", ".", "Token", ",", "error", ")", "{", "return", "&", "oauth2", ".", "<mask>", "{", "AccessToken", ":", "string", "(", "s", ".", "getToken", "(", ")", ")", ",", "}", ",", "nil", "\n", "}" ]
9,180
all-9181
[ "Escape", "in", "string", "to", "be", "wrapped", "in", "them" ]
[ "func", "escapeBackticks", "(", "d", "string", ")", "string", "{", "elems", ":=", "strings", ".", "Split", "(", "d", ",", "\"", "\"", ")", "\n", "<mask>", "strings", ".", "Join", "(", "elems", ",", "\"", "\"", ")", "\n", "}" ]
9,181
all-9182
[ "GetMessage", "returns", "the", "Message", "field", "if", "non", "-", "nil", "zero", "value", "otherwise", "." ]
[ "func", "(", "h", "*", "HostActionMute", ")", "GetMessage", "(", ")", "string", "{", "if", "h", "==", "nil", "||", "h", ".", "<mask>", "==", "nil", "{", "return", "\"", "\"", "\n", "}", "\n", "return", "*", "h", ".", "Message", "\n", "}" ]
9,182
all-9183
[ "GobValue", "retrieves", "a", "value", "written", "by", "PutGob", "and", "decode", "it", "." ]
[ "func", "(", "b", "Bucket", ")", "GobValue", "(", "k", "[", "]", "[", "]", "byte", ",", "f", "func", "(", "interface", "{", "}", ")", "error", ")", "error", "{", "return", "b", ".", "Value", "(", "k", ",", "func", "(", "bs", "bytesp", ".", "Slice", ")", "error", "{", "var", "v", "<mask>", "{", "}", "\n", "if", "err", ":=", "gob", ".", "NewDecoder", "(", "&", "bs", ")", ".", "Decode", "(", "&", "v", ")", ";", "err", "!=", "nil", "{", "return", "errorsp", ".", "WithStacksAndMessage", "(", "err", ",", "\"", "\"", ",", "len", "(", "bs", ")", ")", "\n", "}", "\n", "return", "f", "(", "v", ")", "\n", "}", ")", "\n", "}" ]
9,183
all-9184
[ "SendEvents", "streams", "events", "from", "specified", "channels", "as", "Server", "Sent", "Events", "packets" ]
[ "func", "SendEvents", "(", "w", "http", ".", "ResponseWriter", ",", "r", "*", "http", ".", "Request", ",", "channels", "[", "]", "string", ")", "{", "// make sure that the writer supports flushing", "flusher", ",", "ok", ":=", "w", ".", "(", "http", ".", "Flusher", ")", "\n\n", "if", "!", "ok", "{", "log", ".", "Error", "(", "\"", "\"", ",", "w", ")", "\n", "http", ".", "Error", "(", "w", ",", "\"", "\"", ",", "http", ".", "StatusInternalServerError", ")", "\n", "return", "\n", "}", "\n\n", "closeNotifier", ",", "ok", ":=", "w", ".", "(", "http", ".", "CloseNotifier", ")", "\n", "if", "!", "ok", "{", "log", ".", "Error", "(", "\"", "\"", ",", "w", ")", "\n", "http", ".", "Error", "(", "w", ",", "\"", "\"", ",", "http", ".", "StatusInternalServerError", ")", "\n", "return", "\n", "}", "\n\n", "sub", ",", "err", ":=", "pubsub", ".", "Subscribe", "(", "channels", ")", "\n", "if", "err", "!=", "nil", "{", "log", ".", "Error", "(", "\"", "\"", ",", "err", ")", "\n", "http", ".", "<mask>", "(", "w", ",", "err", ".", "Error", "(", ")", ",", "http", ".", "StatusInternalServerError", ")", "\n", "return", "\n", "}", "\n\n", "// set the headers related to event streaming", "w", ".", "Header", "(", ")", ".", "Set", "(", "\"", "\"", ",", "\"", "\"", ")", "\n", "w", ".", "Header", "(", ")", ".", "Set", "(", "\"", "\"", ",", "\"", "\"", ")", "\n", "w", ".", "Header", "(", ")", ".", "Set", "(", "\"", "\"", ",", "\"", "\"", ")", "\n\n", "// channel to send data to client", "var", "send", "=", "make", "(", "chan", "[", "]", "byte", ")", "\n", "var", "closeConn", "=", "closeNotifier", ".", "CloseNotify", "(", ")", "\n", "var", "heartbeatTicker", "=", "time", ".", "NewTicker", "(", "10", "*", "time", ".", "Second", ")", "// TODO get from config", "\n", "var", "heatbeat", "=", "[", "]", "byte", "{", "}", "\n\n", "var", "stop", "=", "func", "(", ")", "{", "log", ".", "Info", "(", "\"", "\"", ")", "\n", "heartbeatTicker", ".", "Stop", "(", ")", "\n", "sub", ".", "Close", "(", ")", "\n", "close", "(", "send", ")", "\n", "}", "\n\n", "// goroutine to listen all room events", "go", "func", "(", ")", "{", "defer", "func", "(", ")", "{", "if", "err", ":=", "recover", "(", ")", ";", "err", "!=", "nil", "{", "log", ".", "Error", "(", "\"", "\"", ",", "err", ")", "\n", "debug", ".", "PrintStack", "(", ")", "\n", "}", "\n", "}", "(", ")", "\n\n", "log", ".", "Info", "(", "\"", "\"", ")", "\n\n", "for", "{", "select", "{", "case", "msg", ":=", "<-", "sub", ".", "Read", "(", ")", ":", "var", "err", "error", "\n", "var", "data", ",", "ok", "=", "msg", ".", "(", "[", "]", "byte", ")", "\n", "if", "!", "ok", "{", "data", ",", "err", "=", "json", ".", "Marshal", "(", "msg", ")", "\n", "if", "err", "!=", "nil", "{", "// TODO should we ignore error messages?", "log", ".", "Error", "(", "\"", "\"", ",", "err", ")", "\n", "continue", "\n", "}", "\n", "}", "\n", "if", "len", "(", "data", ")", "==", "0", "{", "log", ".", "Warning", "(", "\"", "\"", ")", "\n", "continue", "\n", "}", "\n", "send", "<-", "data", "\n", "// listen to connection close and un-register message channel", "case", "<-", "sub", ".", "CloseNotify", "(", ")", ":", "log", ".", "Info", "(", "\"", "\"", ")", "\n", "stop", "(", ")", "\n", "return", "\n", "case", "<-", "closeConn", ":", "stop", "(", ")", "\n", "return", "\n", "case", "<-", "heartbeatTicker", ".", "C", ":", "send", "<-", "heatbeat", "\n", "}", "\n", "}", "\n", "}", "(", ")", "\n\n", "for", "{", "var", "data", ",", "ok", "=", "<-", "send", "\n", "if", "!", "ok", "{", "log", ".", "Info", "(", "\"", "\"", ",", "channels", ")", "\n", "return", "\n", "}", "\n\n", "if", "len", "(", "data", ")", "==", "0", "{", "fmt", ".", "Fprint", "(", "w", ",", "\"", "\\n", "\\n", "\"", ")", "\n", "}", "else", "{", "fmt", ".", "Fprintf", "(", "w", ",", "\"", "\\n", "\\n", "\"", ",", "data", ")", "\n", "}", "\n\n", "flusher", ".", "Flush", "(", ")", "\n", "}", "\n", "}" ]
9,184
all-9185
[ "RemoveAllAuthentication", "deletes", "all", "the", "credentials", "stored", "in", "auth", ".", "json" ]
[ "func", "RemoveAllAuthentication", "(", "sys", "*", "types", ".", "SystemContext", ")", "error", "{", "return", "modifyJSON", "(", "sys", ",", "func", "(", "auths", "*", "dockerConfigFile", ")", "(", "bool", ",", "error", ")", "{", "auths", ".", "CredHelpers", "=", "<mask>", "(", "map", "[", "string", "]", "string", ")", "\n", "auths", ".", "AuthConfigs", "=", "make", "(", "map", "[", "string", "]", "dockerAuthConfig", ")", "\n", "return", "true", ",", "nil", "\n", "}", ")", "\n", "}" ]
9,185
all-9186
[ "Debugln", "records", "the", "log", "with", "debug", "level" ]
[ "func", "(", "l", "*", "Logger", ")", "Debugln", "(", "args", "...", "<mask>", "{", "}", ")", "{", "l", ".", "Output", "(", "2", ",", "LevelDebug", ",", "fmt", ".", "Sprintln", "(", "args", "...", ")", ")", "\n", "}" ]
9,186
all-9187
[ "Delete", "deletes", "a", "blob", "." ]
[ "func", "Delete", "(", "c", "context", ".", "<mask>", ",", "blobKey", "appengine", ".", "BlobKey", ")", "error", "{", "return", "DeleteMulti", "(", "c", ",", "[", "]", "appengine", ".", "BlobKey", "{", "blobKey", "}", ")", "\n", "}" ]
9,187
all-9188
[ "DefaultRulesPath", "return", "the", "default", "PATH", "that", "contains", "rules", "." ]
[ "func", "DefaultRulesPath", "(", ")", "string", "{", "rulesPath", ":=", "<mask>", ".", "Getenv", "(", "\"", "\"", ")", "\n", "if", "rulesPath", "==", "\"", "\"", "{", "rulesPath", "=", "os", ".", "ExpandEnv", "(", "defaultRulesDir", ")", "\n", "}", "\n", "return", "rulesPath", "\n", "}" ]
9,188
all-9189
[ "GetRelatedId", "returns", "the", "RelatedId", "field", "if", "non", "-", "nil", "zero", "value", "otherwise", "." ]
[ "func", "(", "c", "*", "<mask>", ")", "GetRelatedId", "(", ")", "int", "{", "if", "c", "==", "nil", "||", "c", ".", "RelatedId", "==", "nil", "{", "return", "0", "\n", "}", "\n", "return", "*", "c", ".", "RelatedId", "\n", "}" ]
9,189
all-9190
[ "New", "function", "for", "initialize", "the", "service", "for", "generating", "the", "Endpoint", "Message", "." ]
[ "func", "New", "(", "db", "*", "reform", ".", "<mask>", ",", "logger", "log", ".", "Logger", ",", "payAddr", "string", ",", "timeout", "uint", ")", "(", "*", "Service", ",", "error", ")", "{", "return", "&", "Service", "{", "db", ":", "db", ",", "msgChan", ":", "make", "(", "chan", "*", "req", ")", ",", "payAddr", ":", "payAddr", ",", "timeout", ":", "time", ".", "Duration", "(", "timeout", ")", "*", "time", ".", "Millisecond", ",", "logger", ":", "logger", ".", "Add", "(", "\"", "\"", ",", "\"", "\"", ")", ",", "}", ",", "nil", "\n", "}" ]
9,190
all-9191
[ "PutFile", "writes", "a", "file", "to", "PFS", "from", "a", "reader", "." ]
[ "func", "(", "c", "*", "putFileClient", ")", "PutFile", "(", "repoName", "string", ",", "commitID", "string", ",", "<mask>", "string", ",", "reader", "io", ".", "Reader", ")", "(", "_", "int", ",", "retErr", "error", ")", "{", "return", "c", ".", "PutFileSplit", "(", "repoName", ",", "commitID", ",", "path", ",", "pfs", ".", "Delimiter_NONE", ",", "0", ",", "0", ",", "0", ",", "false", ",", "reader", ")", "\n", "}" ]
9,191
all-9192
[ "GetURL", "returns", "a", "server", "URL", "for", "a", "given", "path", "." ]
[ "func", "GetURL", "(", "conf", "*", "Config", ",", "path", "string", ")", "string", "{", "var", "proto", "=", "\"", "\"", "\n", "if", "conf", ".", "TLS", "!=", "nil", "{", "proto", "+=", "\"", "\"", "\n", "}", "\n\n", "return", "proto", "+", "\"", "\"", "+", "conf", ".", "Addr", "+", "<mask>", "\n", "}" ]
9,192
all-9193
[ "GetDesiredStatus", "safely", "returns", "the", "desired", "status", "of", "the", "task" ]
[ "func", "(", "secret", "*", "ASMSecretResource", ")", "GetDesiredStatus", "(", ")", "resourcestatus", ".", "ResourceStatus", "{", "secret", ".", "lock", ".", "RLock", "(", ")", "\n", "defer", "secret", ".", "<mask>", ".", "RUnlock", "(", ")", "\n\n", "return", "secret", ".", "desiredStatusUnsafe", "\n", "}" ]
9,193
all-9194
[ "GetRegistries", "returns", "an", "array", "of", "strings", "that", "contain", "the", "names", "of", "the", "registries", "as", "defined", "in", "the", "system", "-", "wide", "registries", "file", ".", "it", "returns", "an", "empty", "array", "if", "none", "are", "defined" ]
[ "func", "GetRegistries", "(", "sys", "*", "<mask>", ".", "SystemContext", ")", "(", "[", "]", "string", ",", "error", ")", "{", "config", ",", "err", ":=", "loadRegistryConf", "(", "sys", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "return", "config", ".", "Registries", ".", "Search", ".", "Registries", ",", "nil", "\n", "}" ]
9,194
all-9195
[ "GetContainerLogfiles", "returns", "a", "list", "of", "logfiles", "for", "the", "container" ]
[ "func", "(", "r", "*", "ProtocolLXD", ")", "GetContainerLogfiles", "(", "name", "string", ")", "(", "[", "]", "string", ",", "error", ")", "{", "urls", ":=", "[", "]", "string", "{", "}", "\n\n", "// Fetch the raw value", "_", ",", "err", ":=", "r", ".", "queryStruct", "(", "\"", "\"", ",", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "url", ".", "QueryEscape", "(", "<mask>", ")", ")", ",", "nil", ",", "\"", "\"", ",", "&", "urls", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "// Parse it", "logfiles", ":=", "[", "]", "string", "{", "}", "\n", "for", "_", ",", "uri", ":=", "range", "logfiles", "{", "fields", ":=", "strings", ".", "Split", "(", "uri", ",", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "url", ".", "QueryEscape", "(", "name", ")", ")", ")", "\n", "logfiles", "=", "append", "(", "logfiles", ",", "fields", "[", "len", "(", "fields", ")", "-", "1", "]", ")", "\n", "}", "\n\n", "return", "logfiles", ",", "nil", "\n", "}" ]
9,195
all-9196
[ "MatchLabels", "returns", "a", "subset", "of", "Labels", "that", "matches", "/", "does", "not", "match", "with", "the", "provided", "label", "names", "based", "on", "the", "on", "boolean", ".", "If", "on", "is", "set", "to", "true", "it", "returns", "the", "subset", "of", "labels", "that", "match", "with", "the", "provided", "label", "names", "and", "its", "inverse", "when", "on", "is", "set", "to", "false", "." ]
[ "func", "(", "ls", "Labels", ")", "MatchLabels", "(", "on", "bool", ",", "names", "...", "string", ")", "Labels", "{", "matchedLabels", ":=", "Labels", "{", "}", "\n\n", "nameSet", ":=", "map", "[", "string", "]", "struct", "{", "}", "{", "}", "\n", "for", "_", ",", "n", ":=", "range", "names", "{", "nameSet", "[", "n", "]", "=", "struct", "{", "}", "{", "}", "\n", "}", "\n\n", "for", "_", ",", "v", ":=", "range", "ls", "{", "if", "_", ",", "ok", ":=", "nameSet", "[", "v", ".", "Name", "]", ";", "on", "==", "<mask>", "{", "matchedLabels", "=", "append", "(", "matchedLabels", ",", "v", ")", "\n", "}", "\n", "}", "\n\n", "return", "matchedLabels", "\n", "}" ]
9,196
all-9197
[ "CharAt", "returns", "a", "string", "from", "the", "character", "at", "the", "specified", "position", "." ]
[ "func", "CharAt", "(", "s", "string", ",", "<mask>", "int", ")", "string", "{", "l", ":=", "len", "(", "s", ")", "\n", "shortcut", ":=", "index", "<", "0", "||", "index", ">", "l", "-", "1", "||", "l", "==", "0", "\n", "if", "shortcut", "{", "return", "\"", "\"", "\n", "}", "\n", "return", "s", "[", "index", ":", "index", "+", "1", "]", "\n", "}" ]
9,197
all-9198
[ "Records", "returns", "the", "endpoints", "this", "provider", "knows", "about" ]
[ "func", "(", "p", "*", "NS1Provider", ")", "Records", "(", ")", "(", "[", "]", "*", "endpoint", ".", "Endpoint", ",", "error", ")", "{", "zones", ",", "err", ":=", "p", ".", "zonesFiltered", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "var", "endpoints", "[", "]", "*", "endpoint", ".", "Endpoint", "\n\n", "for", "_", ",", "zone", ":=", "<mask>", "zones", "{", "// TODO handle Header Codes", "zoneData", ",", "_", ",", "err", ":=", "p", ".", "client", ".", "GetZone", "(", "zone", ".", "String", "(", ")", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "for", "_", ",", "record", ":=", "range", "zoneData", ".", "Records", "{", "if", "supportedRecordType", "(", "record", ".", "Type", ")", "{", "endpoints", "=", "append", "(", "endpoints", ",", "endpoint", ".", "NewEndpointWithTTL", "(", "record", ".", "Domain", ",", "record", ".", "Type", ",", "endpoint", ".", "TTL", "(", "record", ".", "TTL", ")", ",", "record", ".", "ShortAns", "...", ",", ")", ",", ")", "\n", "}", "\n", "}", "\n", "}", "\n\n", "return", "endpoints", ",", "nil", "\n", "}" ]
9,198
all-9199
[ "ServeTCP", "executes", "http", ".", "Server", ".", "Serve", "method", ".", "If", "the", "provided", "listener", "is", "net", ".", "TCPListener", "keep", "alive", "will", "be", "enabled", ".", "If", "server", "is", "configured", "with", "TLS", "a", "tls", ".", "Listener", "will", "be", "created", "with", "provided", "listener", "." ]
[ "func", "(", "s", "*", "Server", ")", "ServeTCP", "(", "ln", "net", ".", "Listener", ")", "(", "err", "error", ")", "{", "if", "l", ",", "ok", ":=", "ln", ".", "(", "*", "net", ".", "TCPListener", ")", ";", "ok", "{", "ln", "=", "tcpKeepAliveListener", "{", "TCPListener", ":", "l", "}", "\n", "}", "\n", "if", "s", ".", "TLSConfig", "!=", "nil", "{", "ln", "=", "tls", ".", "NewListener", "(", "ln", ",", "s", ".", "TLSConfig", ")", "\n", "}", "\n\n", "err", "=", "s", ".", "Server", ".", "Serve", "(", "ln", ")", "\n", "if", "err", "==", "<mask>", ".", "ErrServerClosed", "{", "return", "nil", "\n", "}", "\n", "return", "\n", "}" ]
9,199
all-9200
[ "ForeachKey", "conforms", "to", "the", "TextMapReader", "interface", "." ]
[ "func", "(", "c", "TextMapCarrier", ")", "ForeachKey", "(", "handler", "func", "(", "key", ",", "val", "string", ")", "error", ")", "error", "{", "for", "k", ",", "v", ":=", "<mask>", "c", "{", "if", "err", ":=", "handler", "(", "k", ",", "v", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "}", "\n", "return", "nil", "\n", "}" ]