id
int32
0
25.3k
idx
stringlengths
5
9
nl_tokens
listlengths
1
418
pl_tokens
listlengths
22
4.98k
19,700
all-19701
[ "HasClientSubscribed", "-", "True", "if", "a", "client", "subscribed", "to", "this", "server", "with", "the", "same", "topic" ]
[ "func", "(", "server", "*", "Server", ")", "HasClientSubscribed", "(", "arg", "*", "SubscribeArg", ")", "bool", "{", "if", "topicSubscribers", ",", "ok", ":=", "server", ".", "subscribers", "[", "arg", ".", "Topic", "]", ";", "<mask>", "{", "for", "_", ",", "topicSubscriber", ":=", "range", "topicSubscribers", "{", "if", "*", "topicSubscriber", "==", "*", "arg", "{", "return", "true", "\n", "}", "\n", "}", "\n", "}", "\n", "return", "false", "\n", "}" ]
19,701
all-19702
[ "ModuleHostname", "returns", "a", "hostname", "of", "a", "module", "instance", ".", "If", "module", "is", "the", "empty", "string", "it", "refers", "to", "the", "module", "of", "the", "current", "instance", ".", "If", "version", "is", "empty", "it", "refers", "to", "the", "version", "of", "the", "current", "instance", "if", "valid", "or", "the", "default", "version", "of", "the", "module", "of", "the", "current", "instance", ".", "If", "instance", "is", "empty", "ModuleHostname", "returns", "the", "load", "-", "balancing", "hostname", "." ]
[ "func", "ModuleHostname", "(", "c", "context", ".", "Context", ",", "module", ",", "version", ",", "instance", "string", ")", "(", "string", ",", "error", ")", "{", "req", ":=", "&", "modpb", ".", "GetHostnameRequest", "{", "}", "\n", "if", "module", "!=", "\"", "\"", "{", "req", ".", "Module", "=", "&", "module", "\n", "}", "\n", "if", "version", "!=", "\"", "\"", "{", "req", ".", "<mask>", "=", "&", "version", "\n", "}", "\n", "if", "instance", "!=", "\"", "\"", "{", "req", ".", "Instance", "=", "&", "instance", "\n", "}", "\n", "res", ":=", "&", "modpb", ".", "GetHostnameResponse", "{", "}", "\n", "if", "err", ":=", "internal", ".", "Call", "(", "c", ",", "\"", "\"", ",", "\"", "\"", ",", "req", ",", "res", ")", ";", "err", "!=", "nil", "{", "return", "\"", "\"", ",", "err", "\n", "}", "\n", "return", "*", "res", ".", "Hostname", ",", "nil", "\n", "}" ]
19,702
all-19703
[ "HasQuery", "returns", "a", "boolean", "if", "a", "field", "has", "been", "set", "." ]
[ "func", "(", "l", "*", "LogStreamDefinition", ")", "HasQuery", "(", ")", "bool", "{", "if", "l", "!=", "nil", "&&", "l", ".", "<mask>", "!=", "nil", "{", "return", "true", "\n", "}", "\n\n", "return", "false", "\n", "}" ]
19,703
all-19704
[ "Stop", "a", "Service", "and", "returns", "the", "exit", "status", "." ]
[ "func", "(", "s", "*", "ServiceMock", ")", "Stop", "(", "<mask>", "int", ")", "(", "bool", ",", "error", ")", "{", "s", ".", "ServiceStopCount", "++", "\n", "return", "s", ".", "ServiceStopResult", ",", "s", ".", "ServiceStopError", "\n", "}" ]
19,704
all-19705
[ "renderSpyglass", "returns", "a", "pre", "-", "rendered", "Spyglass", "page", "from", "the", "given", "source", "string" ]
[ "func", "renderSpyglass", "(", "sg", "*", "spyglass", ".", "Spyglass", ",", "cfg", "config", ".", "Getter", ",", "src", "string", ",", "o", "options", ")", "(", "string", ",", "error", ")", "{", "renderStart", ":=", "time", ".", "Now", "(", ")", "\n\n", "src", "=", "strings", ".", "TrimSuffix", "(", "src", ",", "\"", "\"", ")", "\n", "realPath", ",", "err", ":=", "sg", ".", "ResolveSymlink", "(", "src", ")", "\n", "if", "err", "!=", "nil", "{", "return", "\"", "\"", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "err", ")", "\n", "}", "\n", "src", "=", "realPath", "\n\n", "artifactNames", ",", "err", ":=", "sg", ".", "ListArtifacts", "(", "src", ")", "\n", "if", "err", "!=", "nil", "{", "return", "\"", "\"", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "err", ")", "\n", "}", "\n", "if", "len", "(", "artifactNames", ")", "==", "0", "{", "return", "\"", "\"", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "src", ")", "\n", "}", "\n\n", "viewerCache", ":=", "map", "[", "string", "]", "[", "]", "string", "{", "}", "\n", "viewersRegistry", ":=", "cfg", "(", ")", ".", "Deck", ".", "Spyglass", ".", "Viewers", "\n", "regexCache", ":=", "cfg", "(", ")", ".", "Deck", ".", "Spyglass", ".", "RegexCache", "\n\n", "for", "re", ",", "viewerNames", ":=", "range", "viewersRegistry", "{", "matches", ":=", "[", "]", "string", "{", "}", "\n", "for", "_", ",", "a", ":=", "range", "artifactNames", "{", "if", "regexCache", "[", "re", "]", ".", "MatchString", "(", "a", ")", "{", "matches", "=", "append", "(", "matches", ",", "a", ")", "\n", "}", "\n", "}", "\n", "if", "len", "(", "matches", ")", ">", "0", "{", "for", "_", ",", "vName", ":=", "<mask>", "viewerNames", "{", "viewerCache", "[", "vName", "]", "=", "matches", "\n", "}", "\n", "}", "\n", "}", "\n\n", "ls", ":=", "sg", ".", "Lenses", "(", "viewerCache", ")", "\n", "lensNames", ":=", "[", "]", "string", "{", "}", "\n", "for", "_", ",", "l", ":=", "range", "ls", "{", "lensNames", "=", "append", "(", "lensNames", ",", "l", ".", "Config", "(", ")", ".", "Name", ")", "\n", "}", "\n\n", "jobHistLink", ":=", "\"", "\"", "\n", "jobPath", ",", "err", ":=", "sg", ".", "JobPath", "(", "src", ")", "\n", "if", "err", "==", "nil", "{", "jobHistLink", "=", "path", ".", "Join", "(", "\"", "\"", ",", "jobPath", ")", "\n", "}", "\n\n", "artifactsLink", ":=", "\"", "\"", "\n", "gcswebPrefix", ":=", "cfg", "(", ")", ".", "Deck", ".", "Spyglass", ".", "GCSBrowserPrefix", "\n", "if", "gcswebPrefix", "!=", "\"", "\"", "{", "runPath", ",", "err", ":=", "sg", ".", "RunPath", "(", "src", ")", "\n", "if", "err", "==", "nil", "{", "artifactsLink", "=", "gcswebPrefix", "+", "runPath", "\n", "// gcsweb wants us to end URLs with a trailing slash", "if", "!", "strings", ".", "HasSuffix", "(", "artifactsLink", ",", "\"", "\"", ")", "{", "artifactsLink", "+=", "\"", "\"", "\n", "}", "\n", "}", "\n", "}", "\n\n", "prHistLink", ":=", "\"", "\"", "\n", "org", ",", "repo", ",", "number", ",", "err", ":=", "sg", ".", "RunToPR", "(", "src", ")", "\n", "if", "err", "==", "nil", "{", "prHistLink", "=", "\"", "\"", "+", "org", "+", "\"", "\"", "+", "repo", "+", "\"", "\"", "+", "strconv", ".", "Itoa", "(", "number", ")", "\n", "}", "\n\n", "jobName", ",", "buildID", ",", "err", ":=", "sg", ".", "KeyToJob", "(", "src", ")", "\n", "if", "err", "!=", "nil", "{", "return", "\"", "\"", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "err", ")", "\n", "}", "\n\n", "announcement", ":=", "\"", "\"", "\n", "if", "cfg", "(", ")", ".", "Deck", ".", "Spyglass", ".", "Announcement", "!=", "\"", "\"", "{", "announcementTmpl", ",", "err", ":=", "template", ".", "New", "(", "\"", "\"", ")", ".", "Parse", "(", "cfg", "(", ")", ".", "Deck", ".", "Spyglass", ".", "Announcement", ")", "\n", "if", "err", "!=", "nil", "{", "return", "\"", "\"", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "err", ")", "\n", "}", "\n", "runPath", ",", "err", ":=", "sg", ".", "RunPath", "(", "src", ")", "\n", "if", "err", "!=", "nil", "{", "runPath", "=", "\"", "\"", "\n", "}", "\n", "var", "announcementBuf", "bytes", ".", "Buffer", "\n", "err", "=", "announcementTmpl", ".", "Execute", "(", "&", "announcementBuf", ",", "struct", "{", "ArtifactPath", "string", "\n", "}", "{", "ArtifactPath", ":", "runPath", ",", "}", ")", "\n", "if", "err", "!=", "nil", "{", "return", "\"", "\"", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "err", ")", "\n", "}", "\n", "announcement", "=", "announcementBuf", ".", "String", "(", ")", "\n", "}", "\n\n", "tgLink", ",", "err", ":=", "sg", ".", "TestGridLink", "(", "src", ")", "\n", "if", "err", "!=", "nil", "{", "tgLink", "=", "\"", "\"", "\n", "}", "\n\n", "extraLinks", ",", "err", ":=", "sg", ".", "ExtraLinks", "(", "src", ")", "\n", "if", "err", "!=", "nil", "{", "logrus", ".", "WithError", "(", "err", ")", ".", "WithField", "(", "\"", "\"", ",", "src", ")", ".", "Warn", "(", "\"", "\"", ")", "\n", "extraLinks", "=", "nil", "\n", "}", "\n\n", "var", "viewBuf", "bytes", ".", "Buffer", "\n", "type", "lensesTemplate", "struct", "{", "Lenses", "[", "]", "lenses", ".", "Lens", "\n", "LensNames", "[", "]", "string", "\n", "Source", "string", "\n", "LensArtifacts", "map", "[", "string", "]", "[", "]", "string", "\n", "JobHistLink", "string", "\n", "ArtifactsLink", "string", "\n", "PRHistLink", "string", "\n", "Announcement", "template", ".", "HTML", "\n", "TestgridLink", "string", "\n", "JobName", "string", "\n", "BuildID", "string", "\n", "ExtraLinks", "[", "]", "spyglass", ".", "ExtraLink", "\n", "}", "\n", "lTmpl", ":=", "lensesTemplate", "{", "Lenses", ":", "ls", ",", "LensNames", ":", "lensNames", ",", "Source", ":", "src", ",", "LensArtifacts", ":", "viewerCache", ",", "JobHistLink", ":", "jobHistLink", ",", "ArtifactsLink", ":", "artifactsLink", ",", "PRHistLink", ":", "prHistLink", ",", "Announcement", ":", "template", ".", "HTML", "(", "announcement", ")", ",", "TestgridLink", ":", "tgLink", ",", "JobName", ":", "jobName", ",", "BuildID", ":", "buildID", ",", "ExtraLinks", ":", "extraLinks", ",", "}", "\n", "t", ":=", "template", ".", "New", "(", "\"", "\"", ")", "\n\n", "if", "_", ",", "err", ":=", "prepareBaseTemplate", "(", "o", ",", "cfg", ",", "t", ")", ";", "err", "!=", "nil", "{", "return", "\"", "\"", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "err", ")", "\n", "}", "\n", "t", ",", "err", "=", "t", ".", "ParseFiles", "(", "path", ".", "Join", "(", "o", ".", "templateFilesLocation", ",", "\"", "\"", ")", ")", "\n", "if", "err", "!=", "nil", "{", "return", "\"", "\"", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "err", ")", "\n", "}", "\n\n", "if", "err", "=", "t", ".", "Execute", "(", "&", "viewBuf", ",", "lTmpl", ")", ";", "err", "!=", "nil", "{", "return", "\"", "\"", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "err", ")", "\n", "}", "\n", "renderElapsed", ":=", "time", ".", "Since", "(", "renderStart", ")", "\n", "logrus", ".", "WithFields", "(", "logrus", ".", "Fields", "{", "\"", "\"", ":", "renderElapsed", ".", "String", "(", ")", ",", "\"", "\"", ":", "src", ",", "}", ")", ".", "Info", "(", "\"", "\"", ")", "\n", "return", "viewBuf", ".", "String", "(", ")", ",", "nil", "\n", "}" ]
19,705
all-19706
[ "EventConfigureNewFromEvent", "returns", "an", "EventConfigure", "from", "an", "Event", ".", "Using", "widget", ".", "Connect", "()", "for", "the", "configure", "-", "event", "signal", "results", "in", "a", "*", "Event", "being", "passed", "as", "the", "callback", "s", "second", "argument", ".", "The", "argument", "is", "actually", "a", "*", "EventConfigure", ".", "EventConfigureNewFromEvent", "provides", "a", "means", "of", "creating", "an", "EventConfigure", "from", "the", "Event", "." ]
[ "func", "EventConfigureNewFromEvent", "(", "event", "*", "Event", ")", "*", "EventConfigure", "{", "ee", ":=", "(", "*", "C", ".", "GdkEvent", ")", "(", "unsafe", ".", "Pointer", "(", "<mask>", ".", "native", "(", ")", ")", ")", "\n", "ev", ":=", "Event", "{", "ee", "}", "\n", "return", "&", "EventConfigure", "{", "&", "ev", "}", "\n", "}" ]
19,706
all-19707
[ "AddEvents", "is", "a", "wrapper", "around", "gtk_widget_add_events", "()", "." ]
[ "func", "(", "v", "*", "Widget", ")", "AddEvents", "(", "<mask>", "int", ")", "{", "C", ".", "gtk_widget_add_events", "(", "v", ".", "native", "(", ")", ",", "C", ".", "gint", "(", "events", ")", ")", "\n", "}" ]
19,707
all-19708
[ "Comparer", "returns", "an", "Option", "that", "determines", "whether", "two", "values", "are", "equal", "to", "each", "other", ".", "The", "comparer", "f", "must", "be", "a", "function", "func", "(", "T", "T", ")", "bool", "and", "is", "implicitly", "filtered", "to", "input", "values", "assignable", "to", "T", ".", "If", "T", "is", "an", "interface", "it", "is", "possible", "that", "f", "is", "called", "with", "two", "values", "of", "different", "concrete", "types", "that", "both", "implement", "T", ".", "The", "equality", "function", "must", "be", ":", "•", "Symmetric", ":", "equal", "(", "x", "y", ")", "==", "equal", "(", "y", "x", ")", "•", "Deterministic", ":", "equal", "(", "x", "y", ")", "==", "equal", "(", "x", "y", ")", "•", "Pure", ":", "equal", "(", "x", "y", ")", "does", "not", "modify", "x", "or", "y" ]
[ "func", "Comparer", "(", "f", "interface", "{", "}", ")", "Option", "{", "v", ":=", "reflect", ".", "ValueOf", "(", "f", ")", "\n", "if", "!", "function", ".", "IsType", "(", "v", ".", "Type", "(", ")", ",", "function", ".", "Equal", ")", "||", "v", ".", "IsNil", "(", ")", "{", "panic", "(", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "f", ")", ")", "\n", "}", "\n", "cm", ":=", "&", "comparer", "{", "fnc", ":", "v", "}", "\n", "if", "ti", ":=", "v", ".", "<mask>", "(", ")", ".", "In", "(", "0", ")", ";", "ti", ".", "Kind", "(", ")", "!=", "reflect", ".", "Interface", "||", "ti", ".", "NumMethod", "(", ")", ">", "0", "{", "cm", ".", "typ", "=", "ti", "\n", "}", "\n", "return", "cm", "\n", "}" ]
19,708
all-19709
[ "DictionaryEntropy", "calculates", "the", "entropy", "of", "a", "dictionary", "match" ]
[ "func", "DictionaryEntropy", "(", "match", "match", ".", "Match", ",", "rank", "float64", ")", "float64", "{", "baseEntropy", ":=", "math", ".", "Log2", "(", "<mask>", ")", "\n", "upperCaseEntropy", ":=", "extraUpperCaseEntropy", "(", "match", ")", "\n", "//TODO: L33t", "return", "baseEntropy", "+", "upperCaseEntropy", "\n", "}" ]
19,709
all-19710
[ "ReadJSONFile", "reads", "and", "parses", "a", "JSON", "file", "filling", "a", "given", "data", "instance", "." ]
[ "func", "ReadJSONFile", "(", "name", "string", ",", "data", "interface", "{", "}", ")", "error", "{", "file", ",", "err", ":=", "<mask>", ".", "Open", "(", "name", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "defer", "file", ".", "Close", "(", ")", "\n\n", "return", "json", ".", "NewDecoder", "(", "file", ")", ".", "Decode", "(", "data", ")", "\n", "}" ]
19,710
all-19711
[ "NewNetworkTransportWithLogger", "creates", "a", "new", "network", "transport", "with", "the", "given", "logger", "dialer", "and", "listener", ".", "The", "maxPool", "controls", "how", "many", "connections", "we", "will", "pool", ".", "The", "timeout", "is", "used", "to", "apply", "I", "/", "O", "deadlines", ".", "For", "InstallSnapshot", "we", "multiply", "the", "timeout", "by", "(", "SnapshotSize", "/", "TimeoutScale", ")", "." ]
[ "func", "NewNetworkTransportWithLogger", "(", "stream", "StreamLayer", ",", "maxPool", "int", ",", "timeout", "<mask>", ".", "Duration", ",", "logger", "*", "log", ".", "Logger", ",", ")", "*", "NetworkTransport", "{", "config", ":=", "&", "NetworkTransportConfig", "{", "Stream", ":", "stream", ",", "MaxPool", ":", "maxPool", ",", "Timeout", ":", "timeout", ",", "Logger", ":", "logger", "}", "\n", "return", "NewNetworkTransportWithConfig", "(", "config", ")", "\n", "}" ]
19,711
all-19712
[ "Email", "returns", "the", "forwarder", "email", "on", "the", "primary", "domain" ]
[ "func", "(", "f", "Forwarder", ")", "Email", "(", ")", "string", "{", "return", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "f", ".", "Name", ",", "f", ".", "<mask>", ".", "Name", ")", "\n", "}" ]
19,712
all-19713
[ "Read", "decodes", "data", "and", "stores", "it", "in", "p", "." ]
[ "func", "(", "d", "*", "decodeReader", ")", "Read", "(", "p", "[", "]", "byte", ")", "(", "n", "int", ",", "err", "error", ")", "{", "if", "len", "(", "d", ".", "outbuf", ")", "==", "0", "{", "// no filter output, see if we need to create more", "if", "d", ".", "win", ".", "buffered", "(", ")", "==", "0", "{", "// fill empty window", "d", ".", "fill", "(", ")", "\n", "if", "d", ".", "win", ".", "buffered", "(", ")", "==", "0", "{", "return", "0", ",", "d", ".", "readErr", "(", ")", "\n", "}", "\n", "}", "else", "if", "len", "(", "d", ".", "filters", ")", ">", "0", "{", "f", ":=", "d", ".", "filters", "[", "0", "]", "\n", "if", "f", ".", "offset", "==", "0", "&&", "f", ".", "<mask>", ">", "d", ".", "win", ".", "buffered", "(", ")", "{", "d", ".", "fill", "(", ")", "// filter at current offset needs more data", "\n", "}", "\n", "}", "\n", "if", "len", "(", "d", ".", "filters", ")", ">", "0", "{", "if", "err", ":=", "d", ".", "processFilters", "(", ")", ";", "err", "!=", "nil", "{", "return", "0", ",", "err", "\n", "}", "\n", "}", "\n", "}", "\n", "if", "len", "(", "d", ".", "outbuf", ")", ">", "0", "{", "// copy filter output into p", "n", "=", "copy", "(", "p", ",", "d", ".", "outbuf", ")", "\n", "d", ".", "outbuf", "=", "d", ".", "outbuf", "[", "n", ":", "]", "\n", "}", "else", "if", "len", "(", "d", ".", "filters", ")", ">", "0", "{", "f", ":=", "d", ".", "filters", "[", "0", "]", "\n", "if", "f", ".", "offset", "<", "len", "(", "p", ")", "{", "// only read data up to beginning of next filter", "p", "=", "p", "[", ":", "f", ".", "offset", "]", "\n", "}", "\n", "n", "=", "d", ".", "win", ".", "read", "(", "p", ")", "// read directly from window", "\n", "f", ".", "offset", "-=", "n", "// adjust first filter offset by bytes just read", "\n", "}", "else", "{", "n", "=", "d", ".", "win", ".", "read", "(", "p", ")", "// read directly from window", "\n", "}", "\n", "d", ".", "tot", "+=", "int64", "(", "n", ")", "\n", "return", "n", ",", "nil", "\n", "}" ]
19,713
all-19714
[ "New", "returns", "a", "API", "client", "that", "uses", "the", "given", "authenticator", ".", "host", "may", "be", "blank", "in", "which", "case", "client", "attempts", "to", "resolve", "it", "using", "auth", "." ]
[ "func", "New", "(", "host", "string", ",", "auth", "Authenticator", ")", "*", "API", "{", "client", ":=", "httpclient", ".", "New", "(", ")", "\n", "if", "strings", ".", "HasPrefix", "(", "host", ",", "\"", "\"", ")", "{", "host", "=", "host", "[", "7", ":", "]", "\n", "}", "else", "if", "strings", ".", "HasPrefix", "(", "<mask>", ",", "\"", "\"", ")", "{", "host", "=", "host", "[", "8", ":", "]", "\n", "}", "\n", "a", ":=", "&", "API", "{", "Auth", ":", "auth", ",", "Host", ":", "host", ",", "Client", ":", "client", ",", "}", "\n", "if", "auth", "!=", "nil", "{", "auth", ".", "SetHost", "(", "host", ")", "\n", "}", "\n", "return", "a", "\n", "}" ]
19,714
all-19715
[ "SetDiscardTs", "sets", "a", "timestamp", "at", "or", "below", "which", "any", "invalid", "or", "deleted", "versions", "can", "be", "discarded", "from", "the", "LSM", "tree", "and", "thence", "from", "the", "value", "log", "to", "reclaim", "disk", "space", ".", "Can", "only", "be", "used", "with", "managed", "transactions", "." ]
[ "func", "(", "db", "*", "DB", ")", "SetDiscardTs", "(", "ts", "uint64", ")", "{", "if", "!", "db", ".", "opt", ".", "managedTxns", "{", "panic", "(", "\"", "\"", ")", "\n", "}", "\n", "db", ".", "orc", ".", "setDiscardTs", "(", "<mask>", ")", "\n", "}" ]
19,715
all-19716
[ "WriteDeflate", "writes", "response", "with", "deflated", "body", "to", "w", ".", "The", "method", "deflates", "response", "body", "and", "sets", "Content", "-", "Encoding", ":", "deflate", "header", "before", "writing", "response", "to", "w", ".", "WriteDeflate", "doesn", "t", "flush", "response", "to", "w", "for", "performance", "reasons", "." ]
[ "func", "(", "resp", "*", "<mask>", ")", "WriteDeflate", "(", "w", "*", "bufio", ".", "Writer", ")", "error", "{", "return", "resp", ".", "WriteDeflateLevel", "(", "w", ",", "CompressDefaultCompression", ")", "\n", "}" ]
19,716
all-19717
[ "LayoutIndexToTextIndex", "()", "is", "a", "wrapper", "around", "gtk_entry_layout_index_to_text_index", "()", "." ]
[ "func", "(", "v", "*", "<mask>", ")", "LayoutIndexToTextIndex", "(", "layoutIndex", "int", ")", "int", "{", "c", ":=", "C", ".", "gtk_entry_layout_index_to_text_index", "(", "v", ".", "native", "(", ")", ",", "C", ".", "gint", "(", "layoutIndex", ")", ")", "\n", "return", "int", "(", "c", ")", "\n", "}" ]
19,717
all-19718
[ "IsErrBadToken", "returns", "true", "if", "err", "is", "a", "ErrBadToken" ]
[ "func", "IsErrBadToken", "(", "err", "error", ")", "bool", "{", "if", "err", "==", "nil", "{", "return", "false", "\n", "}", "\n", "return", "strings", ".", "Contains", "(", "err", ".", "Error", "(", ")", ",", "<mask>", ".", "Convert", "(", "ErrBadToken", ")", ".", "Message", "(", ")", ")", "\n", "}" ]
19,718
all-19719
[ "Attaches", "a", "shader", "object", "to", "a", "program", "object" ]
[ "func", "AttachShader", "(", "program", "uint32", ",", "shader", "uint32", ")", "{", "C", ".", "glowAttachShader", "(", "gpAttachShader", ",", "(", "C", ".", "GLuint", ")", "(", "<mask>", ")", ",", "(", "C", ".", "GLuint", ")", "(", "shader", ")", ")", "\n", "}" ]
19,719
all-19720
[ "UpdateSecretWithContext", "mocks", "base", "method" ]
[ "func", "(", "m", "*", "MockSecretsManagerAPI", ")", "UpdateSecretWithContext", "(", "arg0", "aws", ".", "Context", ",", "arg1", "*", "secretsmanager", ".", "UpdateSecretInput", ",", "arg2", "...", "<mask>", ".", "Option", ")", "(", "*", "secretsmanager", ".", "UpdateSecretOutput", ",", "error", ")", "{", "varargs", ":=", "[", "]", "interface", "{", "}", "{", "arg0", ",", "arg1", "}", "\n", "for", "_", ",", "a", ":=", "range", "arg2", "{", "varargs", "=", "append", "(", "varargs", ",", "a", ")", "\n", "}", "\n", "ret", ":=", "m", ".", "ctrl", ".", "Call", "(", "m", ",", "\"", "\"", ",", "varargs", "...", ")", "\n", "ret0", ",", "_", ":=", "ret", "[", "0", "]", ".", "(", "*", "secretsmanager", ".", "UpdateSecretOutput", ")", "\n", "ret1", ",", "_", ":=", "ret", "[", "1", "]", ".", "(", "error", ")", "\n", "return", "ret0", ",", "ret1", "\n", "}" ]
19,720
all-19721
[ "A", "is", "a", "short", "-", "hand", "function", "to", "construct", "an", "authorizer", ".", "It", "will", "also", "add", "tracing", "code", "around", "the", "execution", "of", "the", "authorizer", "." ]
[ "func", "A", "(", "name", "string", ",", "m", "fire", ".", "Matcher", ",", "h", "Handler", ")", "*", "Authorizer", "{", "// panic if matcher or handler is not set", "if", "m", "==", "nil", "||", "h", "==", "nil", "{", "panic", "(", "\"", "\"", ")", "\n", "}", "\n\n", "// construct and return authorizer", "return", "&", "Authorizer", "{", "Matcher", ":", "m", ",", "<mask>", ":", "func", "(", "ctx", "*", "fire", ".", "Context", ")", "(", "[", "]", "*", "Enforcer", ",", "error", ")", "{", "// begin trace", "ctx", ".", "Tracer", ".", "Push", "(", "name", ")", "\n\n", "// call handler", "enforcers", ",", "err", ":=", "h", "(", "ctx", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "// finish trace", "ctx", ".", "Tracer", ".", "Pop", "(", ")", "\n\n", "return", "enforcers", ",", "nil", "\n", "}", ",", "}", "\n", "}" ]
19,721
all-19722
[ "MetadataFromContainer", "translates", "dockerContainer", "into", "DockerContainerMetadata" ]
[ "func", "MetadataFromContainer", "(", "dockerContainer", "*", "types", ".", "ContainerJSON", ")", "DockerContainerMetadata", "{", "var", "bindings", "[", "]", "apicontainer", ".", "PortBinding", "\n", "var", "err", "apierrors", ".", "NamedError", "\n", "if", "dockerContainer", ".", "NetworkSettings", "!=", "nil", "{", "// Convert port bindings into the format our container expects", "bindings", ",", "err", "=", "apicontainer", ".", "PortBindingFromDockerPortBinding", "(", "dockerContainer", ".", "NetworkSettings", ".", "Ports", ")", "\n", "if", "err", "!=", "nil", "{", "seelog", ".", "Criticalf", "(", "\"", "\"", ",", "err", ")", "\n", "return", "DockerContainerMetadata", "{", "Error", ":", "apierrors", ".", "NamedError", "(", "err", ")", "}", "\n", "}", "\n", "}", "\n\n", "createdTime", ",", "_", ":=", "time", ".", "Parse", "(", "time", ".", "RFC3339", ",", "dockerContainer", ".", "Created", ")", "\n", "startedTime", ":=", "time", ".", "Time", "{", "}", "\n", "finishedTime", ":=", "time", ".", "Time", "{", "}", "\n", "// Need to check for nil to make sure we do not try to access fields of nil pointer", "if", "dockerContainer", ".", "State", "!=", "nil", "{", "startedTime", ",", "_", "=", "<mask>", ".", "Parse", "(", "time", ".", "RFC3339", ",", "dockerContainer", ".", "State", ".", "StartedAt", ")", "\n", "finishedTime", ",", "_", "=", "time", ".", "Parse", "(", "time", ".", "RFC3339", ",", "dockerContainer", ".", "State", ".", "FinishedAt", ")", "\n", "}", "\n\n", "metadata", ":=", "DockerContainerMetadata", "{", "DockerID", ":", "dockerContainer", ".", "ID", ",", "PortBindings", ":", "bindings", ",", "Volumes", ":", "dockerContainer", ".", "Mounts", ",", "CreatedAt", ":", "createdTime", ",", "StartedAt", ":", "startedTime", ",", "FinishedAt", ":", "finishedTime", ",", "}", "\n\n", "if", "dockerContainer", ".", "NetworkSettings", "!=", "nil", "{", "metadata", ".", "NetworkSettings", "=", "dockerContainer", ".", "NetworkSettings", "\n", "}", "\n\n", "if", "dockerContainer", ".", "HostConfig", "!=", "nil", "{", "metadata", ".", "NetworkMode", "=", "string", "(", "dockerContainer", ".", "HostConfig", ".", "NetworkMode", ")", "\n", "}", "\n\n", "if", "dockerContainer", ".", "Config", "!=", "nil", "{", "metadata", ".", "Labels", "=", "dockerContainer", ".", "Config", ".", "Labels", "\n", "}", "\n\n", "if", "dockerContainer", ".", "State", "==", "nil", "{", "return", "metadata", "\n", "}", "\n", "if", "!", "dockerContainer", ".", "State", ".", "Running", "&&", "!", "finishedTime", ".", "IsZero", "(", ")", "{", "// Only record an exitcode if it has exited", "metadata", ".", "ExitCode", "=", "&", "dockerContainer", ".", "State", ".", "ExitCode", "\n", "}", "\n", "if", "dockerContainer", ".", "State", ".", "Error", "!=", "\"", "\"", "{", "metadata", ".", "Error", "=", "NewDockerStateError", "(", "dockerContainer", ".", "State", ".", "Error", ")", "\n", "}", "\n", "if", "dockerContainer", ".", "State", ".", "OOMKilled", "{", "metadata", ".", "Error", "=", "OutOfMemoryError", "{", "}", "\n", "}", "\n", "// Health field in Docker SDK is a pointer, need to check before not nil before dereference.", "if", "dockerContainer", ".", "State", ".", "Health", "==", "nil", "||", "dockerContainer", ".", "State", ".", "Health", ".", "Status", "==", "\"", "\"", "||", "dockerContainer", ".", "State", ".", "Health", ".", "Status", "==", "healthCheckStarting", "{", "return", "metadata", "\n", "}", "\n", "// Record the health check information if exists", "metadata", ".", "Health", "=", "getMetadataHealthCheck", "(", "dockerContainer", ")", "\n", "return", "metadata", "\n", "}" ]
19,722
all-19723
[ "QueryStrings", "returns", "a", "list", "of", "results", "by", "given", "query", "name", "." ]
[ "func", "(", "ctx", "*", "Context", ")", "QueryStrings", "(", "name", "string", ")", "[", "]", "string", "{", "ctx", ".", "parseForm", "(", ")", "\n\n", "vals", ",", "ok", ":=", "ctx", ".", "Req", ".", "Form", "[", "<mask>", "]", "\n", "if", "!", "ok", "{", "return", "[", "]", "string", "{", "}", "\n", "}", "\n", "return", "vals", "\n", "}" ]
19,723
all-19724
[ "Close", "closes", "the", "encoder", "by", "writing", "any", "remaining", "data", ".", "It", "does", "not", "write", "a", "stream", "terminating", "string", "...", "." ]
[ "func", "(", "e", "*", "Encoder", ")", "Close", "(", ")", "(", "err", "<mask>", ")", "{", "defer", "handleErr", "(", "&", "err", ")", "\n", "e", ".", "encoder", ".", "finish", "(", ")", "\n", "return", "nil", "\n", "}" ]
19,724
all-19725
[ "Dbgf", "is", "a", "short", "-", "hand", "version", "of", "Debugf" ]
[ "func", "(", "la", "*", "LogAdapter", ")", "Dbgf", "(", "<mask>", "string", ",", "a", "...", "interface", "{", "}", ")", "error", "{", "return", "la", ".", "Debugf", "(", "msg", ",", "a", "...", ")", "\n", "}" ]
19,725
all-19726
[ "Next", "returns", "the", "next", "page", "of", "resources", ".", "If", "there", "are", "no", "more", "resources", "NoMoreResults", "is", "returned", "." ]
[ "func", "(", "a", "*", "alertPageIterator", ")", "Next", "(", "ctx", "context", ".", "<mask>", ")", "(", "*", "AlertPage", ",", "error", ")", "{", "ap", ":=", "new", "(", "AlertPage", ")", "\n", "err", ":=", "a", ".", "p", ".", "Next", "(", "ctx", ",", "ap", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "a", ".", "p", ".", "SetNextPageURI", "(", "ap", ".", "Meta", ".", "NextPageURL", ")", "\n", "return", "ap", ",", "nil", "\n", "}" ]
19,726
all-19727
[ "longestConnected", "chooses", "the", "member", "with", "longest", "active", "-", "since", "-", "time", ".", "It", "returns", "false", "if", "nothing", "is", "active", "." ]
[ "func", "longestConnected", "(", "tp", "rafthttp", ".", "Transporter", ",", "membs", "[", "]", "types", ".", "ID", ")", "(", "types", ".", "ID", ",", "bool", ")", "{", "var", "longest", "types", ".", "ID", "\n", "var", "oldest", "time", ".", "Time", "\n", "for", "_", ",", "id", ":=", "range", "membs", "{", "tm", ":=", "tp", ".", "ActiveSince", "(", "id", ")", "\n", "if", "tm", ".", "IsZero", "(", ")", "{", "// inactive", "<mask>", "\n", "}", "\n\n", "if", "oldest", ".", "IsZero", "(", ")", "{", "// first longest candidate", "oldest", "=", "tm", "\n", "longest", "=", "id", "\n", "}", "\n\n", "if", "tm", ".", "Before", "(", "oldest", ")", "{", "oldest", "=", "tm", "\n", "longest", "=", "id", "\n", "}", "\n", "}", "\n", "if", "uint64", "(", "longest", ")", "==", "0", "{", "return", "longest", ",", "false", "\n", "}", "\n", "return", "longest", ",", "true", "\n", "}" ]
19,727
all-19728
[ "FindKey", "accepts", "a", "JSON", "object", "and", "returns", "the", "value", "associated", "with", "the", "key", "specified" ]
[ "func", "FindKey", "(", "in", "[", "]", "byte", ",", "pos", "int", ",", "k", "[", "]", "byte", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "pos", ",", "err", ":=", "skipSpace", "(", "in", ",", "pos", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "if", "v", ":=", "in", "[", "pos", "]", ";", "v", "!=", "'{'", "{", "return", "nil", ",", "newError", "(", "pos", ",", "v", ")", "\n", "}", "\n", "<mask>", "++", "\n\n", "for", "{", "pos", ",", "err", "=", "skipSpace", "(", "in", ",", "pos", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "keyStart", ":=", "pos", "\n", "// key", "pos", ",", "err", "=", "String", "(", "in", ",", "pos", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "key", ":=", "in", "[", "keyStart", "+", "1", ":", "pos", "-", "1", "]", "\n", "match", ":=", "bytes", ".", "Equal", "(", "k", ",", "key", ")", "\n\n", "// leading spaces", "pos", ",", "err", "=", "skipSpace", "(", "in", ",", "pos", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "// colon", "pos", ",", "err", "=", "expect", "(", "in", ",", "pos", ",", "':'", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "pos", ",", "err", "=", "skipSpace", "(", "in", ",", "pos", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "valueStart", ":=", "pos", "\n", "// data", "pos", ",", "err", "=", "Any", "(", "in", ",", "pos", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "if", "match", "{", "return", "in", "[", "valueStart", ":", "pos", "]", ",", "nil", "\n", "}", "\n\n", "pos", ",", "err", "=", "skipSpace", "(", "in", ",", "pos", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "switch", "in", "[", "pos", "]", "{", "case", "','", ":", "pos", "++", "\n", "case", "'}'", ":", "return", "nil", ",", "errKeyNotFound", "\n", "}", "\n", "}", "\n", "}" ]
19,728
all-19729
[ "GetNetwork", "returns", "a", "Network", "entry", "for", "the", "provided", "name" ]
[ "func", "(", "r", "*", "ProtocolLXD", ")", "GetNetwork", "(", "name", "string", ")", "(", "*", "api", ".", "Network", ",", "string", ",", "error", ")", "{", "if", "!", "r", ".", "HasExtension", "(", "\"", "\"", ")", "{", "return", "nil", ",", "\"", "\"", ",", "fmt", ".", "Errorf", "(", "\"", "\\\"", "\\\"", "\"", ")", "\n", "}", "\n\n", "network", ":=", "api", ".", "Network", "{", "}", "\n\n", "// Fetch the raw value", "etag", ",", "err", ":=", "r", ".", "queryStruct", "(", "\"", "\"", ",", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "<mask>", ".", "QueryEscape", "(", "name", ")", ")", ",", "nil", ",", "\"", "\"", ",", "&", "network", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "\"", "\"", ",", "err", "\n", "}", "\n\n", "return", "&", "network", ",", "etag", ",", "nil", "\n", "}" ]
19,729
all-19730
[ "Contains", "returns", "true", "if", "Network", "covers", "o", "false", "otherwise" ]
[ "func", "(", "n", "Network", ")", "Covers", "(", "o", "Network", ")", "bool", "{", "if", "len", "(", "n", ".", "Number", ")", "!=", "len", "(", "o", ".", "Number", ")", "{", "return", "<mask>", "\n", "}", "\n", "nMaskSize", ",", "_", ":=", "n", ".", "IPNet", ".", "Mask", ".", "Size", "(", ")", "\n", "oMaskSize", ",", "_", ":=", "o", ".", "IPNet", ".", "Mask", ".", "Size", "(", ")", "\n", "return", "n", ".", "Contains", "(", "o", ".", "Number", ")", "&&", "nMaskSize", "<=", "oMaskSize", "\n", "}" ]
19,730
all-19731
[ "RemoveCredentials", "removes", "credentials", "from", "the", "credentials", "manager" ]
[ "func", "(", "<mask>", "*", "credentialsManager", ")", "RemoveCredentials", "(", "id", "string", ")", "{", "manager", ".", "taskCredentialsLock", ".", "Lock", "(", ")", "\n", "defer", "manager", ".", "taskCredentialsLock", ".", "Unlock", "(", ")", "\n\n", "delete", "(", "manager", ".", "idToTaskCredentials", ",", "id", ")", "\n", "}" ]
19,731
all-19732
[ "LoadMacroFile", "loads", "a", "bzl", "file", "from", "disk", "parses", "it", "then", "scans", "for", "the", "load", "statements", "and", "the", "rules", "called", "from", "the", "given", "Starlark", "function", ".", "If", "there", "is", "no", "matching", "function", "name", "then", "a", "new", "function", "with", "that", "name", "will", "be", "created", ".", "The", "function", "s", "syntax", "tree", "will", "be", "returned", "within", "File", "and", "can", "be", "modified", "by", "Sync", "and", "Save", "calls", "." ]
[ "func", "LoadMacroFile", "(", "path", ",", "pkg", ",", "defName", "string", ")", "(", "*", "<mask>", ",", "error", ")", "{", "data", ",", "err", ":=", "ioutil", ".", "ReadFile", "(", "path", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "return", "LoadMacroData", "(", "path", ",", "pkg", ",", "defName", ",", "data", ")", "\n", "}" ]
19,732
all-19733
[ "Next", "returns", "the", "next", "Token", "." ]
[ "func", "(", "s", "*", "Scanner", ")", "Next", "(", ")", "rune", "{", "s", ".", "b", ".", "Reset", "(", ")", "\n\n", "ch", ":=", "s", ".", "next", "(", ")", "\n\n", "for", "unicode", ".", "IsSpace", "(", "ch", ")", "{", "ch", "=", "s", ".", "next", "(", ")", "\n", "}", "\n\n", "tok", ":=", "ch", "\n\n", "switch", "{", "default", ":", "tok", "=", "Undefined", "\n", "ch", "=", "s", ".", "next", "(", ")", "\n\n", "case", "ch", "==", "EOF", ":", "break", "\n\n", "case", "isOperator", "(", "ch", ")", ":", "tok", "=", "Operator", "\n", "ch", "=", "s", ".", "scanOperator", "(", "ch", ")", "\n\n", "case", "isDelimiter", "(", "ch", ")", ":", "tok", "=", "Delimiter", "\n", "s", ".", "b", ".", "WriteRune", "(", "ch", ")", "\n", "ch", "=", "s", ".", "next", "(", ")", "\n\n", "case", "isNameDelimiter", "(", "ch", ")", ":", "tok", "=", "IdentifierDelimiter", "\n", "s", ".", "b", ".", "WriteRune", "(", "ch", ")", "\n", "ch", "=", "s", ".", "next", "(", ")", "\n\n", "case", "isIdentifier", "(", "ch", ")", ":", "tok", "=", "Identifier", "\n", "s", ".", "b", ".", "WriteRune", "(", "ch", ")", "\n", "ch", "=", "s", ".", "scanAlpha", "(", ")", "\n\n", "case", "isSingleQuote", "(", "ch", ")", ":", "tok", "=", "String", "\n", "ch", "=", "s", ".", "scanQuotedIdentifier", "(", "ch", ")", "\n\n", "case", "isDoubleQuote", "(", "ch", ")", ":", "tok", "=", "QuotedIdentifier", "\n", "ch", "=", "s", ".", "scanQuotedIdentifier", "(", "ch", ")", "\n\n", "case", "isQuestionMark", "(", "ch", ")", ":", "tok", "=", "Variable", "\n", "ch", "=", "s", ".", "<mask>", "(", ")", "\n\n", "case", "isColon", "(", "ch", ")", ":", "ch", "=", "s", ".", "peek", "(", ")", "\n", "if", "isDigit", "(", "ch", ")", "{", "tok", "=", "PosVariable", "\n", "ch", "=", "s", ".", "scanNumeric", "(", ")", "\n", "}", "else", "{", "tok", "=", "NamedVariable", "\n", "ch", "=", "s", ".", "scanAlpha", "(", ")", "\n", "}", "\n\n", "case", "isNumber", "(", "ch", ")", ":", "tok", "=", "Number", "\n", "ch", "=", "s", ".", "scanNumber", "(", ")", "\n", "}", "\n\n", "s", ".", "ch", "=", "ch", "\n", "s", ".", "rd", ".", "UnreadRune", "(", ")", "\n\n", "if", "ch", "==", "Error", "{", "return", "ch", "\n", "}", "\n\n", "return", "tok", "\n", "}" ]
19,733
all-19734
[ "Returns", "the", "text", "color", "(", "whether", "black", "or", "white", ")", "given", "the", "background", "color", ".", "Details", ":", "https", ":", "//", "www", ".", "w3", ".", "org", "/", "TR", "/", "WCAG20", "/", "#contrastratio" ]
[ "func", "getTextColor", "(", "backgroundColor", "string", ")", "(", "string", ",", "error", ")", "{", "d", ",", "err", ":=", "<mask>", ".", "DecodeString", "(", "backgroundColor", ")", "\n", "if", "err", "!=", "nil", "||", "len", "(", "d", ")", "!=", "3", "{", "return", "\"", "\"", ",", "errors", ".", "New", "(", "\"", "\"", ")", "\n", "}", "\n\n", "// Calculate the relative luminance (L) of a color", "// L = 0.2126 * R + 0.7152 * G + 0.0722 * B", "// Formula details at: https://www.w3.org/TR/WCAG20/#relativeluminancedef", "color", ":=", "[", "3", "]", "float64", "{", "}", "\n", "for", "i", ",", "v", ":=", "range", "d", "{", "color", "[", "i", "]", "=", "float64", "(", "v", ")", "/", "255.0", "\n", "if", "color", "[", "i", "]", "<=", "0.03928", "{", "color", "[", "i", "]", "=", "color", "[", "i", "]", "/", "12.92", "\n", "}", "else", "{", "color", "[", "i", "]", "=", "math", ".", "Pow", "(", "(", "color", "[", "i", "]", "+", "0.055", ")", "/", "1.055", ",", "2.4", ")", "\n", "}", "\n", "}", "\n", "L", ":=", "0.2126", "*", "color", "[", "0", "]", "+", "0.7152", "*", "color", "[", "1", "]", "+", "0.0722", "*", "color", "[", "2", "]", "\n\n", "if", "(", "L", "+", "0.05", ")", "/", "(", "0.0", "+", "0.05", ")", ">", "(", "1.0", "+", "0.05", ")", "/", "(", "L", "+", "0.05", ")", "{", "return", "\"", "\"", ",", "nil", "\n", "}", "else", "{", "return", "\"", "\"", ",", "nil", "\n", "}", "\n", "}" ]
19,734
all-19735
[ "SetAcceptLabel", "is", "a", "wrapper", "around", "gtk_file_chooser_native_set_accept_label", "()", "." ]
[ "func", "(", "v", "*", "FileChooserNativeDialog", ")", "SetAcceptLabel", "(", "accept_label", "string", ")", "{", "cstr", ":=", "C", ".", "CString", "(", "accept_label", ")", "\n", "defer", "C", ".", "free", "(", "unsafe", ".", "Pointer", "(", "cstr", ")", ")", "\n", "C", ".", "gtk_file_chooser_native_set_accept_label", "(", "v", ".", "native", "(", ")", ",", "(", "*", "C", ".", "<mask>", ")", "(", "cstr", ")", ")", "\n", "}" ]
19,735
all-19736
[ "GetHandle", "returns", "the", "Handle", "field", "if", "non", "-", "nil", "zero", "value", "otherwise", "." ]
[ "func", "(", "c", "*", "CreatedBy", ")", "GetHandle", "(", ")", "<mask>", "{", "if", "c", "==", "nil", "||", "c", ".", "Handle", "==", "nil", "{", "return", "\"", "\"", "\n", "}", "\n", "return", "*", "c", ".", "Handle", "\n", "}" ]
19,736
all-19737
[ "Do", "executes", "Database", ".", "getDatabaseTableNames", "against", "the", "provided", "context", ".", "returns", ":", "tableNames" ]
[ "func", "(", "p", "*", "GetDatabaseTableNamesParams", ")", "Do", "(", "ctx", "context", ".", "Context", ")", "(", "tableNames", "[", "]", "string", ",", "err", "error", ")", "{", "// execute", "var", "res", "GetDatabaseTableNamesReturns", "\n", "err", "=", "cdp", ".", "Execute", "(", "ctx", ",", "CommandGetDatabaseTableNames", ",", "p", ",", "&", "res", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "return", "<mask>", ".", "TableNames", ",", "nil", "\n", "}" ]
19,737
all-19738
[ "CollapseRow", "is", "a", "wrapper", "around", "gtk_tree_view_collapse_row", "()", "." ]
[ "func", "(", "v", "*", "TreeView", ")", "CollapseRow", "(", "path", "*", "TreePath", ")", "bool", "{", "return", "gobool", "(", "C", ".", "gtk_tree_view_collapse_row", "(", "v", ".", "native", "(", ")", ",", "<mask>", ".", "native", "(", ")", ")", ")", "\n", "}" ]
19,738
all-19739
[ "UnmarshalJSON", "supports", "json", ".", "Unmarshaler", "interface" ]
[ "func", "(", "v", "*", "SetFontSizesParams", ")", "UnmarshalJSON", "(", "data", "[", "]", "<mask>", ")", "error", "{", "r", ":=", "jlexer", ".", "Lexer", "{", "Data", ":", "data", "}", "\n", "easyjsonC5a4559bDecodeGithubComChromedpCdprotoPage9", "(", "&", "r", ",", "v", ")", "\n", "return", "r", ".", "Error", "(", ")", "\n", "}" ]
19,739
all-19740
[ "Properties", "is", "a", "convenience", "method", "that", "wraps", "fetching", "the", "VirtualMachine", "MO", "from", "its", "higher", "-", "level", "object", "." ]
[ "func", "Properties", "(", "vm", "*", "object", ".", "VirtualMachine", ")", "(", "*", "mo", ".", "VirtualMachine", ",", "error", ")", "{", "<mask>", ".", "Printf", "(", "\"", "\"", ",", "vm", ".", "InventoryPath", ")", "\n", "ctx", ",", "cancel", ":=", "context", ".", "WithTimeout", "(", "context", ".", "Background", "(", ")", ",", "provider", ".", "DefaultAPITimeout", ")", "\n", "defer", "cancel", "(", ")", "\n", "var", "props", "mo", ".", "VirtualMachine", "\n", "if", "err", ":=", "vm", ".", "Properties", "(", "ctx", ",", "vm", ".", "Reference", "(", ")", ",", "nil", ",", "&", "props", ")", ";", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "return", "&", "props", ",", "nil", "\n", "}" ]
19,740
all-19741
[ "Address", "sets", "the", "address", "of", "the", "StatsD", "daemon", ".", "By", "default", ":", "8125", "is", "used", ".", "This", "option", "is", "ignored", "in", "Client", ".", "Clone", "()", "." ]
[ "func", "<mask>", "(", "addr", "string", ")", "Option", "{", "return", "Option", "(", "func", "(", "c", "*", "config", ")", "{", "c", ".", "Conn", ".", "Addr", "=", "addr", "\n", "}", ")", "\n", "}" ]
19,741
all-19742
[ "MiddlewareFunc", "registers", "middleware", "function", "to", "handle", "incoming", "request", "messages", "." ]
[ "func", "(", "s", "*", "Server", ")", "MiddlewareFunc", "(", "middleware", "...", "func", "(", "ctx", "*", "ReqCtx", ")", "error", ")", "{", "s", ".", "middleware", "=", "<mask>", "(", "s", ".", "middleware", ",", "middleware", "...", ")", "\n", "}" ]
19,742
all-19743
[ "CreateOrgQuotas", "-" ]
[ "func", "(", "m", "*", "Manager", ")", "CreateOrgQuotas", "(", ")", "error", "{", "quotas", ",", "err", ":=", "m", ".", "ListAllOrgQuotas", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "orgQuotas", ",", "err", ":=", "m", ".", "Cfg", ".", "GetOrgQuotas", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "for", "_", ",", "orgQuotaConfig", ":=", "range", "orgQuotas", "{", "err", "=", "m", ".", "createOrgQuota", "(", "orgQuotaConfig", ",", "quotas", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "}", "\n", "orgs", ",", "err", ":=", "m", ".", "Cfg", ".", "GetOrgConfigs", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "for", "_", ",", "input", ":=", "<mask>", "orgs", "{", "if", "input", ".", "NamedQuota", "!=", "\"", "\"", "&&", "input", ".", "EnableOrgQuota", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "input", ".", "NamedQuota", ",", "input", ".", "Org", ")", "\n", "}", "\n", "if", "input", ".", "EnableOrgQuota", "||", "input", ".", "NamedQuota", "!=", "\"", "\"", "{", "org", ",", "err", ":=", "m", ".", "OrgMgr", ".", "FindOrg", "(", "input", ".", "Org", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "if", "input", ".", "EnableOrgQuota", "{", "quotaDef", ":=", "input", ".", "GetQuota", "(", ")", "\n", "err", "=", "m", ".", "createOrgQuota", "(", "quotaDef", ",", "quotas", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "input", ".", "NamedQuota", "=", "input", ".", "Org", "\n", "}", "\n", "orgQuota", ":=", "quotas", "[", "input", ".", "NamedQuota", "]", "\n", "if", "org", ".", "QuotaDefinitionGuid", "!=", "orgQuota", ".", "Guid", "{", "if", "err", "=", "m", ".", "AssignQuotaToOrg", "(", "org", ",", "orgQuota", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "}", "\n", "}", "\n", "}", "\n", "return", "nil", "\n", "}" ]
19,743
all-19744
[ "PrintCommitInfo", "pretty", "-", "prints", "commit", "info", "." ]
[ "func", "PrintCommitInfo", "(", "w", "io", ".", "Writer", ",", "commitInfo", "*", "pfs", ".", "CommitInfo", ",", "fullTimestamps", "bool", ")", "{", "fmt", ".", "Fprintf", "(", "w", ",", "\"", "\\t", "\"", ",", "commitInfo", ".", "Commit", ".", "Repo", ".", "<mask>", ")", "\n", "fmt", ".", "Fprintf", "(", "w", ",", "\"", "\\t", "\"", ",", "commitInfo", ".", "Branch", ".", "Name", ")", "\n", "fmt", ".", "Fprintf", "(", "w", ",", "\"", "\\t", "\"", ",", "commitInfo", ".", "Commit", ".", "ID", ")", "\n", "if", "commitInfo", ".", "ParentCommit", "!=", "nil", "{", "fmt", ".", "Fprintf", "(", "w", ",", "\"", "\\t", "\"", ",", "commitInfo", ".", "ParentCommit", ".", "ID", ")", "\n", "}", "else", "{", "fmt", ".", "Fprint", "(", "w", ",", "\"", "\\t", "\"", ")", "\n", "}", "\n", "if", "fullTimestamps", "{", "fmt", ".", "Fprintf", "(", "w", ",", "\"", "\\t", "\"", ",", "commitInfo", ".", "Started", ".", "String", "(", ")", ")", "\n", "}", "else", "{", "fmt", ".", "Fprintf", "(", "w", ",", "\"", "\\t", "\"", ",", "pretty", ".", "Ago", "(", "commitInfo", ".", "Started", ")", ")", "\n", "}", "\n", "if", "commitInfo", ".", "Finished", "!=", "nil", "{", "fmt", ".", "Fprintf", "(", "w", ",", "fmt", ".", "Sprintf", "(", "\"", "\\t", "\"", ",", "pretty", ".", "TimeDifference", "(", "commitInfo", ".", "Started", ",", "commitInfo", ".", "Finished", ")", ")", ")", "\n", "fmt", ".", "Fprintf", "(", "w", ",", "\"", "\\t", "\\n", "\"", ",", "units", ".", "BytesSize", "(", "float64", "(", "commitInfo", ".", "SizeBytes", ")", ")", ")", "\n", "}", "else", "{", "fmt", ".", "Fprintf", "(", "w", ",", "\"", "\\t", "\"", ")", "\n", "// Open commits don't have meaningful size information", "fmt", ".", "Fprintf", "(", "w", ",", "\"", "\\t", "\\n", "\"", ")", "\n", "}", "\n", "}" ]
19,744
all-19745
[ "MarshalJSON", "supports", "json", ".", "Marshaler", "interface" ]
[ "func", "(", "v", "SetEmitTouchEventsForMouseParams", ")", "MarshalJSON", "(", ")", "(", "[", "]", "<mask>", ",", "error", ")", "{", "w", ":=", "jwriter", ".", "Writer", "{", "}", "\n", "easyjsonC5a4559bEncodeGithubComChromedpCdprotoEmulation10", "(", "&", "w", ",", "v", ")", "\n", "return", "w", ".", "Buffer", ".", "BuildBytes", "(", ")", ",", "w", ".", "Error", "\n", "}" ]
19,745
all-19746
[ "Delete", "deletes", "a", "document", "from", "the", "index", "." ]
[ "func", "(", "x", "*", "Index", ")", "Delete", "(", "c", "context", ".", "Context", ",", "<mask>", "string", ")", "error", "{", "return", "x", ".", "DeleteMulti", "(", "c", ",", "[", "]", "string", "{", "id", "}", ")", "\n", "}" ]
19,746
all-19747
[ "CreateFirewallRule", "creates", "a", "new", "firewall", "rule", ".", "It", "takes", "a", "FirewallRuleOptions", "struct", "for", "specifying", "name", "and", "other", "attributes", ".", "Not", "all", "attributes", "can", "be", "specified", "at", "create", "time", "(", "such", "as", "Id", "which", "is", "allocated", "for", "you", ")" ]
[ "func", "(", "c", "*", "Client", ")", "CreateFirewallRule", "(", "ruleOptions", "*", "FirewallRuleOptions", ")", "(", "*", "FirewallRule", ",", "error", ")", "{", "rule", ":=", "new", "(", "FirewallRule", ")", "\n", "_", ",", "err", ":=", "c", ".", "MakeApiRequest", "(", "\"", "\"", ",", "\"", "\"", ",", "ruleOptions", ",", "&", "rule", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "return", "<mask>", ",", "nil", "\n", "}" ]
19,747
all-19748
[ "Render", "returns", "the", "map", "as", "an", "encoded", "image", "." ]
[ "func", "(", "m", "*", "Map", ")", "Render", "(", "opts", "RenderOpts", ")", "(", "[", "]", "<mask>", ",", "error", ")", "{", "scaleFactor", ":=", "opts", ".", "ScaleFactor", "\n", "if", "scaleFactor", "==", "0.0", "{", "scaleFactor", "=", "1.0", "\n", "}", "\n", "i", ":=", "C", ".", "mapnik_map_render_to_image", "(", "m", ".", "m", ",", "C", ".", "double", "(", "opts", ".", "Scale", ")", ",", "C", ".", "double", "(", "scaleFactor", ")", ")", "\n", "if", "i", "==", "nil", "{", "return", "nil", ",", "m", ".", "lastError", "(", ")", "\n", "}", "\n", "defer", "C", ".", "mapnik_image_free", "(", "i", ")", "\n", "if", "opts", ".", "Format", "==", "\"", "\"", "{", "size", ":=", "0", "\n", "raw", ":=", "C", ".", "mapnik_image_to_raw", "(", "i", ",", "(", "*", "C", ".", "size_t", ")", "(", "unsafe", ".", "Pointer", "(", "&", "size", ")", ")", ")", "\n", "return", "C", ".", "GoBytes", "(", "unsafe", ".", "Pointer", "(", "raw", ")", ",", "C", ".", "int", "(", "size", ")", ")", ",", "nil", "\n", "}", "\n", "var", "format", "*", "C", ".", "char", "\n", "if", "opts", ".", "Format", "!=", "\"", "\"", "{", "format", "=", "C", ".", "CString", "(", "opts", ".", "Format", ")", "\n", "}", "else", "{", "format", "=", "C", ".", "CString", "(", "\"", "\"", ")", "\n", "}", "\n", "b", ":=", "C", ".", "mapnik_image_to_blob", "(", "i", ",", "format", ")", "\n", "if", "b", "==", "nil", "{", "return", "nil", ",", "errors", ".", "New", "(", "\"", "\"", "+", "C", ".", "GoString", "(", "C", ".", "mapnik_image_last_error", "(", "i", ")", ")", ")", "\n", "}", "\n", "C", ".", "free", "(", "unsafe", ".", "Pointer", "(", "format", ")", ")", "\n", "defer", "C", ".", "mapnik_image_blob_free", "(", "b", ")", "\n", "return", "C", ".", "GoBytes", "(", "unsafe", ".", "Pointer", "(", "b", ".", "ptr", ")", ",", "C", ".", "int", "(", "b", ".", "len", ")", ")", ",", "nil", "\n", "}" ]
19,748
all-19749
[ "/", "*", "ListVM", "lists", "vms", "of", "the", "pool" ]
[ "func", "(", "a", "*", "Client", ")", "ListVM", "(", "params", "*", "ListVMParams", ")", "(", "*", "ListVMOK", ",", "error", ")", "{", "// TODO: Validate the params before sending", "if", "params", "==", "nil", "{", "params", "=", "NewListVMParams", "(", ")", "\n", "}", "\n\n", "<mask>", ",", "err", ":=", "a", ".", "transport", ".", "Submit", "(", "&", "runtime", ".", "ClientOperation", "{", "ID", ":", "\"", "\"", ",", "Method", ":", "\"", "\"", ",", "PathPattern", ":", "\"", "\"", ",", "ProducesMediaTypes", ":", "[", "]", "string", "{", "\"", "\"", "}", ",", "ConsumesMediaTypes", ":", "[", "]", "string", "{", "\"", "\"", "}", ",", "Schemes", ":", "[", "]", "string", "{", "\"", "\"", "}", ",", "Params", ":", "params", ",", "Reader", ":", "&", "ListVMReader", "{", "formats", ":", "a", ".", "formats", "}", ",", "Context", ":", "params", ".", "Context", ",", "}", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "return", "result", ".", "(", "*", "ListVMOK", ")", ",", "nil", "\n\n", "}" ]
19,749
all-19750
[ "Do", "executes", "Emulation", ".", "clearDeviceMetricsOverride", "against", "the", "provided", "context", "." ]
[ "func", "(", "p", "*", "ClearDeviceMetricsOverrideParams", ")", "Do", "(", "ctx", "context", ".", "<mask>", ")", "(", "err", "error", ")", "{", "return", "cdp", ".", "Execute", "(", "ctx", ",", "CommandClearDeviceMetricsOverride", ",", "nil", ",", "nil", ")", "\n", "}" ]
19,750
all-19751
[ "MarshalJSON", "supports", "json", ".", "Marshaler", "interface" ]
[ "func", "(", "v", "CallFunctionOnReturns", ")", "MarshalJSON", "(", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "w", ":=", "jwriter", ".", "Writer", "{", "}", "\n", "easyjsonC5a4559bEncodeGithubComChromedpCdprotoRuntime46", "(", "&", "w", ",", "v", ")", "\n", "return", "w", ".", "<mask>", ".", "BuildBytes", "(", ")", ",", "w", ".", "Error", "\n", "}" ]
19,751
all-19752
[ "ResolveTask", "mocks", "base", "method" ]
[ "func", "(", "m", "*", "MockContainerMetadataResolver", ")", "ResolveTask", "(", "arg0", "string", ")", "(", "*", "task", ".", "Task", ",", "error", ")", "{", "ret", ":=", "m", ".", "ctrl", ".", "Call", "(", "m", ",", "\"", "\"", ",", "arg0", ")", "\n", "ret0", ",", "_", ":=", "<mask>", "[", "0", "]", ".", "(", "*", "task", ".", "Task", ")", "\n", "ret1", ",", "_", ":=", "ret", "[", "1", "]", ".", "(", "error", ")", "\n", "return", "ret0", ",", "ret1", "\n", "}" ]
19,752
all-19753
[ "SetMaxStructPoolSize", "sets", "the", "struct", "pools", "max", "size", ".", "this", "may", "be", "usefull", "for", "fine", "grained", "performance", "tuning", "towards", "your", "application", "however", "the", "default", "should", "be", "fine", "for", "nearly", "all", "cases", ".", "only", "increase", "if", "you", "have", "a", "deeply", "nested", "struct", "structure", ".", "NOTE", ":", "this", "method", "is", "not", "thread", "-", "safe", "NOTE", ":", "this", "is", "only", "here", "to", "keep", "compatibility", "with", "v5", "in", "v6", "the", "method", "will", "be", "removed" ]
[ "func", "(", "v", "*", "Validate", ")", "SetMaxStructPoolSize", "(", "max", "int", ")", "{", "structPool", "=", "&", "<mask>", ".", "Pool", "{", "New", ":", "newStructErrors", "}", "\n", "}" ]
19,753
all-19754
[ "Region", "returns", "the", "service", "region", "infering", "it", "from", "S3", "domain", "." ]
[ "func", "(", "s", "*", "S3", ")", "Region", "(", ")", "string", "{", "region", ":=", "os", ".", "Getenv", "(", "\"", "\"", ")", "\n", "switch", "s", ".", "<mask>", "{", "case", "\"", "\"", ",", "\"", "\"", ":", "return", "\"", "\"", "\n", "case", "\"", "\"", ":", "if", "region", "==", "\"", "\"", "{", "panic", "(", "\"", "\"", ")", "\n", "}", "\n", "return", "region", "\n", "default", ":", "regions", ":=", "regionMatcher", ".", "FindStringSubmatch", "(", "s", ".", "Domain", ")", "\n", "if", "len", "(", "regions", ")", "<", "2", "{", "if", "region", "==", "\"", "\"", "{", "panic", "(", "\"", "\"", ")", "\n", "}", "\n", "return", "region", "\n", "}", "\n", "return", "regions", "[", "1", "]", "\n", "}", "\n", "}" ]
19,754
all-19755
[ "Queues", "a", "message", "to", "be", "sent", "to", "channel", ".", "Nonblocking", "returns", "true", "if", "successful", "." ]
[ "func", "(", "c", "*", "MConnection", ")", "TrySend", "(", "chID", "byte", ",", "<mask>", "interface", "{", "}", ")", "bool", "{", "if", "!", "c", ".", "IsRunning", "(", ")", "{", "return", "false", "\n", "}", "\n\n", "log", ".", "Debug", "(", "\"", "\"", ",", "\"", "\"", ",", "chID", ",", "\"", "\"", ",", "c", ",", "\"", "\"", ",", "msg", ")", "\n\n", "// Send message to channel.", "channel", ",", "ok", ":=", "c", ".", "channelsIdx", "[", "chID", "]", "\n", "if", "!", "ok", "{", "log", ".", "Error", "(", "cmn", ".", "Fmt", "(", "\"", "\"", ",", "chID", ")", ")", "\n", "return", "false", "\n", "}", "\n\n", "ok", "=", "channel", ".", "trySendBytes", "(", "wire", ".", "BinaryBytes", "(", "msg", ")", ")", "\n", "if", "ok", "{", "// Wake up sendRoutine if necessary", "select", "{", "case", "c", ".", "send", "<-", "struct", "{", "}", "{", "}", ":", "default", ":", "}", "\n", "}", "\n\n", "return", "ok", "\n", "}" ]
19,755
all-19756
[ "MarshalJSON", "supports", "json", ".", "Marshaler", "interface" ]
[ "func", "(", "v", "MakeSnapshotParams", ")", "MarshalJSON", "(", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "w", ":=", "jwriter", ".", "Writer", "{", "}", "\n", "easyjsonC5a4559bEncodeGithubComChromedpCdprotoLayertree11", "(", "&", "w", ",", "v", ")", "\n", "return", "w", ".", "<mask>", ".", "BuildBytes", "(", ")", ",", "w", ".", "Error", "\n", "}" ]
19,756
all-19757
[ "ParseRequest", "parses", "request", "handling", "possible", "errors", "." ]
[ "func", "(", "s", "*", "Server", ")", "ParseRequest", "(", "logger", "log", ".", "Logger", ",", "w", "http", ".", "ResponseWriter", ",", "r", "*", "http", ".", "Request", ",", "args", "interface", "{", "}", ")", "bool", "{", "var", "req", "Request", "\n", "if", "err", ":=", "json", ".", "NewDecoder", "(", "r", ".", "Body", ")", ".", "Decode", "(", "&", "req", ")", ";", "err", "!=", "nil", "{", "logger", ".", "Warn", "(", "\"", "\"", "+", "err", ".", "<mask>", "(", ")", ")", "\n", "s", ".", "RespondError", "(", "logger", ",", "w", ",", "ErrFailedToParseRequest", ")", "\n", "return", "false", "\n", "}", "\n", "r", ".", "Body", ".", "Close", "(", ")", "\n\n", "if", "err", ":=", "json", ".", "Unmarshal", "(", "req", ".", "Args", ",", "args", ")", ";", "err", "!=", "nil", "{", "logger", ".", "Add", "(", "\"", "\"", ",", "req", ".", "Args", ")", ".", "Warn", "(", "\"", "\"", "+", "err", ".", "Error", "(", ")", ")", "\n", "s", ".", "RespondError", "(", "logger", ",", "w", ",", "ErrFailedToParseRequest", ")", "\n", "return", "false", "\n", "}", "\n\n", "return", "true", "\n", "}" ]
19,757
all-19758
[ "GetCriticalOk", "returns", "a", "tuple", "with", "the", "Critical", "field", "if", "it", "s", "non", "-", "nil", "zero", "value", "otherwise", "and", "a", "boolean", "to", "check", "if", "the", "value", "has", "been", "set", "." ]
[ "func", "(", "t", "*", "ThresholdCount", ")", "GetCriticalOk", "(", ")", "(", "json", ".", "Number", ",", "bool", ")", "{", "if", "t", "==", "nil", "||", "t", ".", "Critical", "==", "nil", "{", "return", "\"", "\"", ",", "false", "\n", "}", "\n", "return", "*", "t", ".", "Critical", ",", "<mask>", "\n", "}" ]
19,758
all-19759
[ "um_group_users_path", "returns", "the", "string", "/", "groups", "/", "groupid", "/", "users", "/", "userid" ]
[ "func", "umGroupUsersPath", "(", "grpid", "string", ",", "usrid", "string", ")", "<mask>", "{", "return", "um", "(", ")", "+", "slash", "(", "\"", "\"", ")", "+", "slash", "(", "grpid", ")", "+", "slash", "(", "\"", "\"", ")", "+", "slash", "(", "usrid", ")", "\n", "}" ]
19,759
all-19760
[ "/", "*", "Shift", "a", "uid", "from", "the", "host", "into", "the", "container", "I", ".", "e", ".", "0", "-", ">", "1000", "-", ">", "101000" ]
[ "func", "(", "e", "*", "IdmapEntry", ")", "shift_into_ns", "(", "id", "int64", ")", "(", "int64", ",", "error", ")", "{", "if", "id", "<", "e", ".", "Nsid", "||", "<mask>", ">=", "e", ".", "Nsid", "+", "e", ".", "Maprange", "{", "// this mapping doesn't apply", "return", "0", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ")", "\n", "}", "\n\n", "return", "id", "-", "e", ".", "Nsid", "+", "e", ".", "Hostid", ",", "nil", "\n", "}" ]
19,760
all-19761
[ "StopPipeline", "prevents", "a", "pipeline", "from", "processing", "things", "it", "can", "be", "restarted", "with", "StartPipeline", "." ]
[ "func", "(", "c", "APIClient", ")", "StopPipeline", "(", "name", "string", ")", "error", "{", "_", ",", "err", ":=", "c", ".", "PpsAPIClient", ".", "StopPipeline", "(", "c", ".", "Ctx", "(", ")", ",", "&", "pps", ".", "StopPipelineRequest", "{", "Pipeline", ":", "NewPipeline", "(", "<mask>", ")", ",", "}", ",", ")", "\n", "return", "grpcutil", ".", "ScrubGRPC", "(", "err", ")", "\n", "}" ]
19,761
all-19762
[ "/", "*", "Set2D", "sets", "a", "particular", "element", "in", "them", "matrix" ]
[ "func", "(", "m", "*", "Mat", ")", "Set2D", "(", "x", ",", "y", "int", ",", "value", "Scalar", ")", "{", "C", ".", "cvSet2D", "(", "unsafe", ".", "Pointer", "(", "m", ")", ",", "C", ".", "int", "(", "x", ")", ",", "C", ".", "int", "(", "y", ")", ",", "(", "C", ".", "CvScalar", ")", "(", "<mask>", ")", ")", "\n", "}" ]
19,762
all-19763
[ "retrieve", "information", "about", "the", "set", "of", "active", "atomic", "counter", "buffers", "for", "a", "program" ]
[ "func", "GetActiveAtomicCounterBufferiv", "(", "<mask>", "uint32", ",", "bufferIndex", "uint32", ",", "pname", "uint32", ",", "params", "*", "int32", ")", "{", "syscall", ".", "Syscall6", "(", "gpGetActiveAtomicCounterBufferiv", ",", "4", ",", "uintptr", "(", "program", ")", ",", "uintptr", "(", "bufferIndex", ")", ",", "uintptr", "(", "pname", ")", ",", "uintptr", "(", "unsafe", ".", "Pointer", "(", "params", ")", ")", ",", "0", ",", "0", ")", "\n", "}" ]
19,763
all-19764
[ "MarshalJSON", "supports", "json", ".", "Marshaler", "interface" ]
[ "func", "(", "v", "SignedExchangeHeader", ")", "MarshalJSON", "(", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "w", ":=", "jwriter", ".", "Writer", "{", "}", "\n", "easyjsonC5a4559bEncodeGithubComChromedpCdprotoNetwork7", "(", "&", "w", ",", "v", ")", "\n", "return", "w", ".", "Buffer", ".", "BuildBytes", "(", ")", ",", "w", ".", "<mask>", "\n", "}" ]
19,764
all-19765
[ "UnmarshalEasyJSON", "satisfies", "easyjson", ".", "Unmarshaler", "." ]
[ "func", "(", "t", "*", "CookieSameSite", ")", "UnmarshalEasyJSON", "(", "in", "*", "jlexer", ".", "Lexer", ")", "{", "switch", "CookieSameSite", "(", "<mask>", ".", "String", "(", ")", ")", "{", "case", "CookieSameSiteStrict", ":", "*", "t", "=", "CookieSameSiteStrict", "\n", "case", "CookieSameSiteLax", ":", "*", "t", "=", "CookieSameSiteLax", "\n", "case", "CookieSameSiteExtended", ":", "*", "t", "=", "CookieSameSiteExtended", "\n", "case", "CookieSameSiteNone", ":", "*", "t", "=", "CookieSameSiteNone", "\n\n", "default", ":", "in", ".", "AddError", "(", "errors", ".", "New", "(", "\"", "\"", ")", ")", "\n", "}", "\n", "}" ]
19,765
all-19766
[ "label", "a", "named", "object", "identified", "within", "a", "namespace" ]
[ "func", "ObjectLabel", "(", "identifier", "uint32", ",", "name", "uint32", ",", "length", "int32", ",", "label", "*", "uint8", ")", "{", "C", ".", "glowObjectLabel", "(", "gpObjectLabel", ",", "(", "C", ".", "GLenum", ")", "(", "identifier", ")", ",", "(", "C", ".", "GLuint", ")", "(", "name", ")", ",", "(", "C", ".", "GLsizei", ")", "(", "length", ")", ",", "(", "*", "C", ".", "GLchar", ")", "(", "unsafe", ".", "Pointer", "(", "<mask>", ")", ")", ")", "\n", "}" ]
19,766
all-19767
[ "SharedFolderState", "returns", "the", "state", "of", "a", "shared", "folder", "mounted", "in", "the", "virtual", "machine", ".", "Parameters", ":", "index", ":", "Identifies", "the", "shared", "folder", "Remarks", ":", "*", "Shared", "folders", "are", "indexed", "from", "0", "to", "n", "-", "1", "where", "n", "is", "the", "number", "of", "shared", "folders", ".", "Use", "the", "function", "VM", ".", "NumSharedFolders", "()", "to", "get", "the", "value", "of", "n", ".", "*", "Shared", "folders", "are", "not", "supported", "for", "the", "following", "guest", "operating", "systems", ":", "Windows", "ME", "Windows", "98", "Windows", "95", "Windows", "3", ".", "x", "and", "DOS", ".", "*", "In", "this", "release", "this", "function", "requires", "the", "virtual", "machine", "to", "be", "powered", "on", "with", "VMware", "Tools", "installed", ".", "Since", "VMware", "Workstation", "6", ".", "0" ]
[ "func", "(", "v", "*", "VM", ")", "SharedFolderState", "(", "index", "int", ")", "(", "string", ",", "string", ",", "int", ",", "error", ")", "{", "var", "jobHandle", "C", ".", "VixHandle", "=", "C", ".", "VIX_INVALID_HANDLE", "\n", "var", "err", "C", ".", "VixError", "=", "C", ".", "VIX_OK", "\n", "var", "(", "folderName", ",", "folderHostPath", "*", "C", ".", "<mask>", "\n", "folderFlags", "*", "C", ".", "int", "\n", ")", "\n\n", "jobHandle", "=", "C", ".", "VixVM_GetSharedFolderState", "(", "v", ".", "handle", ",", "//vmHandle", "C", ".", "int", "(", "index", ")", ",", "//index", "nil", ",", "//callbackProc", "nil", ")", "//clientData", "\n\n", "defer", "C", ".", "Vix_ReleaseHandle", "(", "jobHandle", ")", "\n\n", "err", "=", "C", ".", "get_shared_folder", "(", "jobHandle", ",", "folderName", ",", "folderHostPath", ",", "folderFlags", ")", "\n", "defer", "C", ".", "Vix_FreeBuffer", "(", "unsafe", ".", "Pointer", "(", "folderName", ")", ")", "\n", "defer", "C", ".", "Vix_FreeBuffer", "(", "unsafe", ".", "Pointer", "(", "folderHostPath", ")", ")", "\n\n", "if", "C", ".", "VIX_OK", "!=", "err", "{", "return", "\"", "\"", ",", "\"", "\"", ",", "0", ",", "&", "Error", "{", "Operation", ":", "\"", "\"", ",", "Code", ":", "int", "(", "err", "&", "0xFFFF", ")", ",", "Text", ":", "C", ".", "GoString", "(", "C", ".", "Vix_GetErrorText", "(", "err", ",", "nil", ")", ")", ",", "}", "\n", "}", "\n\n", "C", ".", "Vix_ReleaseHandle", "(", "v", ".", "handle", ")", "\n", "return", "C", ".", "GoString", "(", "folderName", ")", ",", "C", ".", "GoString", "(", "folderHostPath", ")", ",", "int", "(", "*", "folderFlags", ")", ",", "nil", "\n", "}" ]
19,767
all-19768
[ "Delete", "removes", "a", "container", "backup" ]
[ "func", "(", "b", "*", "backup", ")", "Delete", "(", ")", "error", "{", "return", "doBackupDelete", "(", "b", ".", "state", ",", "b", ".", "name", ",", "b", ".", "container", ".", "<mask>", "(", ")", ")", "\n", "}" ]
19,768
all-19769
[ "newWatcher", "is", "used", "to", "nest", "the", "return", "of", "the", "UdevWatcher", "struct" ]
[ "func", "newWatcher", "(", "ctx", "context", ".", "Context", ",", "primaryMAC", "string", ",", "nlWrap", "netlinkwrapper", ".", "NetLink", ",", "udevWrap", "udevwrapper", ".", "Udev", ",", "state", "dockerstate", ".", "TaskEngineState", ",", "stateChangeEvents", "chan", "<-", "statechange", ".", "Event", ")", "*", "UdevWatcher", "{", "derivedContext", ",", "cancel", ":=", "<mask>", ".", "WithCancel", "(", "ctx", ")", "\n", "return", "&", "UdevWatcher", "{", "ctx", ":", "derivedContext", ",", "cancel", ":", "cancel", ",", "netlinkClient", ":", "nlWrap", ",", "udevMonitor", ":", "udevWrap", ",", "events", ":", "make", "(", "chan", "*", "udev", ".", "UEvent", ")", ",", "agentState", ":", "state", ",", "eniChangeEvent", ":", "stateChangeEvents", ",", "primaryMAC", ":", "primaryMAC", ",", "}", "\n", "}" ]
19,769
all-19770
[ "title", ":", "service", "list", "path", ":", "/", "services", "method", ":", "GET", "produce", ":", "application", "/", "json", "responses", ":", "200", ":", "List", "services", "204", ":", "No", "content", "401", ":", "Unauthorized" ]
[ "func", "serviceList", "(", "w", "http", ".", "ResponseWriter", ",", "r", "*", "<mask>", ".", "Request", ",", "t", "auth", ".", "Token", ")", "error", "{", "contexts", ":=", "permission", ".", "ContextsForPermission", "(", "t", ",", "permission", ".", "PermServiceRead", ")", "\n", "services", ",", "err", ":=", "provisionReadableServices", "(", "t", ",", "contexts", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "sInstances", ",", "err", ":=", "service", ".", "GetServiceInstancesByServices", "(", "services", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "results", ":=", "make", "(", "[", "]", "service", ".", "ServiceModel", ",", "len", "(", "services", ")", ")", "\n", "for", "i", ",", "s", ":=", "range", "services", "{", "results", "[", "i", "]", ".", "Service", "=", "s", ".", "Name", "\n", "for", "_", ",", "si", ":=", "range", "sInstances", "{", "if", "si", ".", "ServiceName", "==", "s", ".", "Name", "{", "results", "[", "i", "]", ".", "Instances", "=", "append", "(", "results", "[", "i", "]", ".", "Instances", ",", "si", ".", "Name", ")", "\n", "results", "[", "i", "]", ".", "ServiceInstances", "=", "append", "(", "results", "[", "i", "]", ".", "ServiceInstances", ",", "si", ")", "\n", "}", "\n", "}", "\n", "}", "\n", "if", "len", "(", "results", ")", "==", "0", "{", "w", ".", "WriteHeader", "(", "http", ".", "StatusNoContent", ")", "\n", "return", "nil", "\n", "}", "\n", "w", ".", "Header", "(", ")", ".", "Set", "(", "\"", "\"", ",", "\"", "\"", ")", "\n", "return", "json", ".", "NewEncoder", "(", "w", ")", ".", "Encode", "(", "results", ")", "\n", "}" ]
19,770
all-19771
[ "HasWidth", "returns", "a", "boolean", "if", "a", "field", "has", "been", "set", "." ]
[ "func", "(", "s", "*", "Screenboard", ")", "HasWidth", "(", ")", "bool", "{", "if", "s", "!=", "nil", "&&", "s", ".", "Width", "!=", "nil", "{", "return", "true", "\n", "}", "\n\n", "return", "<mask>", "\n", "}" ]
19,771
all-19772
[ "New", "creates", "a", "new", "Reader", ".", "The", "filename", "is", "a", "list", "of", "mimetypes", "and", "extensions", ".", "If", "utf8", "is", "true", ";", "charset", "=", "utf", "-", "8", "will", "be", "added", "when", "setting", "http", "headers", "." ]
[ "func", "New", "(", "<mask>", "string", ",", "utf8", "bool", ")", "*", "Reader", "{", "return", "&", "Reader", "{", "filename", ",", "utf8", ",", "nil", ",", "sync", ".", "Mutex", "{", "}", "}", "\n", "}" ]
19,772
all-19773
[ "FromStrings", "creates", "new", "labels", "from", "pairs", "of", "strings", "." ]
[ "func", "FromStrings", "(", "ss", "...", "string", ")", "Labels", "{", "if", "len", "(", "ss", ")", "%", "2", "!=", "0", "{", "panic", "(", "\"", "\"", ")", "\n", "}", "\n", "var", "res", "Labels", "\n", "for", "i", ":=", "0", ";", "i", "<", "len", "(", "ss", ")", ";", "i", "+=", "2", "{", "res", "=", "append", "(", "res", ",", "Label", "{", "Name", ":", "<mask>", "[", "i", "]", ",", "Value", ":", "ss", "[", "i", "+", "1", "]", "}", ")", "\n", "}", "\n\n", "sort", ".", "Sort", "(", "res", ")", "\n", "return", "res", "\n", "}" ]
19,773
all-19774
[ "schemaVirtualMachineResourceAllocation", "returns", "the", "respective", "schema", "keys", "for", "the", "various", "kinds", "of", "resource", "allocation", "settings", "available", "to", "a", "virtual", "machine", ".", "This", "is", "an", "abridged", "version", "of", "ResourceAllocationInfo", "with", "only", "the", "keys", "present", "that", "make", "sense", "for", "virtual", "machines", "." ]
[ "func", "schemaVirtualMachineResourceAllocation", "(", ")", "<mask>", "[", "string", "]", "*", "schema", ".", "Schema", "{", "s", ":=", "make", "(", "map", "[", "string", "]", "*", "schema", ".", "Schema", ")", "\n", "shareLevelFmt", ":=", "\"", "\"", "\n", "shareCountFmt", ":=", "\"", "\"", "\n", "limitFmt", ":=", "\"", "\"", "\n", "reservationFmt", ":=", "\"", "\"", "\n\n", "for", "_", ",", "t", ":=", "range", "virtualMachineResourceAllocationTypeValues", "{", "shareLevelKey", ":=", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "t", ")", "\n", "shareCountKey", ":=", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "t", ")", "\n", "limitKey", ":=", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "t", ")", "\n", "reservationKey", ":=", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "t", ")", "\n\n", "s", "[", "shareLevelKey", "]", "=", "&", "schema", ".", "Schema", "{", "Type", ":", "schema", ".", "TypeString", ",", "Optional", ":", "true", ",", "Default", ":", "string", "(", "types", ".", "SharesLevelNormal", ")", ",", "Description", ":", "fmt", ".", "Sprintf", "(", "shareLevelFmt", ",", "t", ")", ",", "ValidateFunc", ":", "validation", ".", "StringInSlice", "(", "sharesLevelAllowedValues", ",", "false", ")", ",", "}", "\n", "s", "[", "shareCountKey", "]", "=", "&", "schema", ".", "Schema", "{", "Type", ":", "schema", ".", "TypeInt", ",", "Optional", ":", "true", ",", "Computed", ":", "true", ",", "Description", ":", "fmt", ".", "Sprintf", "(", "shareCountFmt", ",", "t", ")", ",", "ValidateFunc", ":", "validation", ".", "IntAtLeast", "(", "0", ")", ",", "}", "\n", "s", "[", "limitKey", "]", "=", "&", "schema", ".", "Schema", "{", "Type", ":", "schema", ".", "TypeInt", ",", "Optional", ":", "true", ",", "Default", ":", "-", "1", ",", "Description", ":", "fmt", ".", "Sprintf", "(", "limitFmt", ",", "t", ")", ",", "ValidateFunc", ":", "validation", ".", "IntAtLeast", "(", "-", "1", ")", ",", "}", "\n", "s", "[", "reservationKey", "]", "=", "&", "schema", ".", "Schema", "{", "Type", ":", "schema", ".", "TypeInt", ",", "Optional", ":", "true", ",", "Description", ":", "fmt", ".", "Sprintf", "(", "reservationFmt", ",", "t", ")", ",", "ValidateFunc", ":", "validation", ".", "IntAtLeast", "(", "0", ")", ",", "}", "\n", "}", "\n\n", "return", "s", "\n", "}" ]
19,774
all-19775
[ "ListSecretsWithContext", "mocks", "base", "method" ]
[ "func", "(", "m", "*", "MockSecretsManagerAPI", ")", "ListSecretsWithContext", "(", "arg0", "aws", ".", "Context", ",", "arg1", "*", "secretsmanager", ".", "ListSecretsInput", ",", "arg2", "...", "request", ".", "Option", ")", "(", "*", "secretsmanager", ".", "ListSecretsOutput", ",", "error", ")", "{", "varargs", ":=", "[", "]", "interface", "{", "}", "{", "arg0", ",", "arg1", "}", "\n", "for", "_", ",", "a", ":=", "range", "arg2", "{", "varargs", "=", "<mask>", "(", "varargs", ",", "a", ")", "\n", "}", "\n", "ret", ":=", "m", ".", "ctrl", ".", "Call", "(", "m", ",", "\"", "\"", ",", "varargs", "...", ")", "\n", "ret0", ",", "_", ":=", "ret", "[", "0", "]", ".", "(", "*", "secretsmanager", ".", "ListSecretsOutput", ")", "\n", "ret1", ",", "_", ":=", "ret", "[", "1", "]", ".", "(", "error", ")", "\n", "return", "ret0", ",", "ret1", "\n", "}" ]
19,775
all-19776
[ "Metadata", "returns", "type", "and", "help", "metadata", "for", "the", "given", "metric", "." ]
[ "func", "(", "t", "*", "Target", ")", "Metadata", "(", "metric", "string", ")", "(", "MetricMetadata", ",", "bool", ")", "{", "t", ".", "mtx", ".", "RLock", "(", ")", "\n", "defer", "t", ".", "mtx", ".", "RUnlock", "(", ")", "\n\n", "if", "t", ".", "<mask>", "==", "nil", "{", "return", "MetricMetadata", "{", "}", ",", "false", "\n", "}", "\n", "return", "t", ".", "metadata", ".", "getMetadata", "(", "metric", ")", "\n", "}" ]
19,776
all-19777
[ "New", "Api" ]
[ "func", "(", "s", "ScribbleStore", ")", "All", "(", "count", "int", ",", "skip", "int", ",", "store", "string", ")", "(", "ObjectRows", ",", "error", ")", "{", "_rows", ",", "err", ":=", "s", ".", "<mask>", ".", "ReadAll", "(", "store", ")", "\n", "if", "err", "!=", "nil", "{", "if", "_", ",", "ok", ":=", "err", ".", "(", "*", "os", ".", "PathError", ")", ";", "ok", "{", "return", "nil", ",", "ErrNotFound", "\n", "}", "\n", "return", "nil", ",", "err", "\n", "}", "\n", "return", "ScribbleRows", "{", "_rows", ",", "0", ",", "len", "(", "_rows", ")", "}", ",", "nil", "\n", "}" ]
19,777
all-19778
[ "addTasks", "adds", "the", "tasks", "to", "the", "task", "engine", "based", "on", "the", "skipAddTask", "condition", "This", "is", "used", "to", "add", "non", "-", "stopped", "tasks", "before", "adding", "stopped", "tasks" ]
[ "func", "(", "payloadHandler", "*", "payloadRequestHandler", ")", "addTasks", "(", "payload", "*", "ecsacs", ".", "PayloadMessage", ",", "tasks", "[", "]", "*", "apitask", ".", "Task", ",", "skipAddTask", "skipAddTaskComparatorFunc", ")", "(", "[", "]", "*", "ecsacs", ".", "IAMRoleCredentialsAckRequest", ",", "bool", ")", "{", "allTasksOK", ":=", "true", "\n", "var", "credentialsAcks", "[", "]", "*", "ecsacs", ".", "IAMRoleCredentialsAckRequest", "\n", "for", "_", ",", "task", ":=", "range", "tasks", "{", "if", "skipAddTask", "(", "task", ".", "GetDesiredStatus", "(", ")", ")", "{", "continue", "\n", "}", "\n", "payloadHandler", ".", "taskEngine", ".", "AddTask", "(", "<mask>", ")", "\n\n", "ackCredentials", ":=", "func", "(", "id", "string", ",", "description", "string", ")", "{", "ack", ",", "err", ":=", "payloadHandler", ".", "ackCredentials", "(", "payload", ".", "MessageId", ",", "id", ")", "\n", "if", "err", "!=", "nil", "{", "allTasksOK", "=", "false", "\n", "seelog", ".", "Errorf", "(", "\"", "\"", ",", "description", ",", "task", ".", "String", "(", ")", ",", "err", ")", "\n", "return", "\n", "}", "\n", "credentialsAcks", "=", "append", "(", "credentialsAcks", ",", "ack", ")", "\n", "}", "\n\n", "// Generate an ack request for the credentials in the task, if the", "// task is associated with an IAM role or the execution role", "taskCredentialsID", ":=", "task", ".", "GetCredentialsID", "(", ")", "\n", "if", "taskCredentialsID", "!=", "\"", "\"", "{", "ackCredentials", "(", "taskCredentialsID", ",", "\"", "\"", ")", "\n", "}", "\n\n", "taskExecutionCredentialsID", ":=", "task", ".", "GetExecutionCredentialsID", "(", ")", "\n", "if", "taskExecutionCredentialsID", "!=", "\"", "\"", "{", "ackCredentials", "(", "taskExecutionCredentialsID", ",", "\"", "\"", ")", "\n", "}", "\n", "}", "\n", "return", "credentialsAcks", ",", "allTasksOK", "\n", "}" ]
19,778
all-19779
[ "SetMaximized", "opens", "the", "view", "to", "full", "screen", "or", "restores", "its", "previous", "size" ]
[ "func", "(", "w", "*", "Window", ")", "SetMaximized", "(", "maximize", "bool", ")", "{", "if", "maximize", "==", "w", ".", "maximized", "{", "return", "\n", "}", "\n\n", "if", "maximize", "{", "w", ".", "origX", ",", "w", ".", "origY", "=", "w", ".", "Pos", "(", ")", "\n", "w", ".", "origWidth", ",", "w", ".", "origHeight", "=", "w", ".", "Size", "(", ")", "\n", "w", ".", "maximized", "=", "true", "\n", "w", ".", "SetPos", "(", "0", ",", "0", ")", "\n", "width", ",", "<mask>", ":=", "ScreenSize", "(", ")", "\n", "w", ".", "SetSize", "(", "width", ",", "height", ")", "\n", "}", "else", "{", "w", ".", "maximized", "=", "false", "\n", "w", ".", "SetPos", "(", "w", ".", "origX", ",", "w", ".", "origY", ")", "\n", "w", ".", "SetSize", "(", "w", ".", "origWidth", ",", "w", ".", "origHeight", ")", "\n", "}", "\n", "w", ".", "ResizeChildren", "(", ")", "\n", "w", ".", "PlaceChildren", "(", ")", "\n", "}" ]
19,779
all-19780
[ "determineReleaseNoteLabel", "returns", "the", "label", "to", "be", "added", "based", "on", "the", "contents", "of", "the", "release", "-", "note", "section", "of", "a", "PR", "s", "body", "text", "." ]
[ "func", "determineReleaseNoteLabel", "(", "body", "string", ")", "string", "{", "composedReleaseNote", ":=", "strings", ".", "ToLower", "(", "strings", ".", "TrimSpace", "(", "getReleaseNote", "(", "<mask>", ")", ")", ")", "\n\n", "if", "composedReleaseNote", "==", "\"", "\"", "{", "return", "ReleaseNoteLabelNeeded", "\n", "}", "\n", "if", "noneRe", ".", "MatchString", "(", "composedReleaseNote", ")", "{", "return", "releaseNoteNone", "\n", "}", "\n", "if", "strings", ".", "Contains", "(", "composedReleaseNote", ",", "actionRequiredNote", ")", "{", "return", "releaseNoteActionRequired", "\n", "}", "\n", "return", "releaseNote", "\n", "}" ]
19,780
all-19781
[ "Pull", "downloads", "the", "specified", "Release", "to", "the", "local", "cache", "dir" ]
[ "func", "(", "r", "*", "Release", ")", "Pull", "(", "releaseLocation", "string", ")", "(", "filename", "string", ",", "err", "error", ")", "{", "u", ",", "uerr", ":=", "url", ".", "Parse", "(", "releaseLocation", ")", "\n", "if", "uerr", "!=", "nil", "||", "!", "(", "u", ".", "Scheme", "==", "\"", "\"", "||", "u", ".", "Scheme", "==", "\"", "\"", ")", "{", "// assume a local file, ensure it exists", "if", "_", ",", "ferr", ":=", "os", ".", "Stat", "(", "releaseLocation", ")", ";", "<mask>", ".", "IsNotExist", "(", "ferr", ")", "{", "err", "=", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "releaseLocation", ")", "\n", "return", "\n", "}", "\n", "filename", "=", "releaseLocation", "\n", "}", "else", "{", "// remote file, ensure its in the local cache", "filename", "=", "r", ".", "CacheDir", "+", "\"", "\"", "+", "path", ".", "Base", "(", "releaseLocation", ")", "\n", "if", "_", ",", "err", "=", "os", ".", "Stat", "(", "filename", ")", ";", "os", ".", "IsNotExist", "(", "err", ")", "{", "fmt", ".", "Println", "(", "\"", "\"", ")", "\n", "err", "=", "r", ".", "download", "(", "releaseLocation", ",", "filename", ")", "\n", "}", "\n", "}", "\n", "return", "\n", "}" ]
19,781
all-19782
[ "NewExponentialBackOffConfig", "creates", "an", "exponential", "back", "-", "off", "config", "with", "longer", "wait", "times", "than", "the", "default", "." ]
[ "func", "NewExponentialBackOffConfig", "(", ")", "*", "backoff", ".", "ExponentialBackOff", "{", "config", ":=", "backoff", ".", "NewExponentialBackOff", "(", ")", "\n", "// We want to backoff more aggressively (i.e. wait longer) than the default", "config", ".", "InitialInterval", "=", "1", "*", "<mask>", ".", "Second", "\n", "config", ".", "Multiplier", "=", "2", "\n", "config", ".", "MaxInterval", "=", "15", "*", "time", ".", "Minute", "\n", "return", "config", "\n", "}" ]
19,782
all-19783
[ "TokenString", "returns", "a", "printable", "string", "for", "a", "token", "or", "Unicode", "character", "." ]
[ "func", "TokenString", "(", "tok", "rune", ")", "string", "{", "if", "s", ",", "<mask>", ":=", "tokenString", "[", "tok", "]", ";", "ok", "{", "return", "s", "\n", "}", "\n", "return", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "string", "(", "tok", ")", ")", "\n", "}" ]
19,783
all-19784
[ "IsActive", "checks", "whether", "the", "container", "state", "indicates", "the", "container", "is", "active" ]
[ "func", "(", "c", "Container", ")", "IsActive", "(", ")", "bool", "{", "switch", "c", ".", "StatusCode", "{", "case", "Stopped", ":", "return", "false", "\n", "case", "Error", ":", "return", "false", "\n", "<mask>", ":", "return", "true", "\n", "}", "\n", "}" ]
19,784
all-19785
[ "moveLocations", "fixes", "labels", "within", "$", "(", "location", ")", "and", "$", "(", "locations", ")", "expansions", "." ]
[ "func", "moveLocations", "(", "from", ",", "to", ",", "str", "string", ")", "string", "{", "matches", ":=", "locationsRegexp", ".", "FindAllStringSubmatchIndex", "(", "str", ",", "-", "1", ")", "\n", "buf", ":=", "new", "(", "bytes", ".", "Buffer", ")", "\n", "pos", ":=", "0", "\n", "for", "_", ",", "match", ":=", "range", "matches", "{", "buf", ".", "WriteString", "(", "str", "[", "pos", ":", "match", "[", "2", "]", "]", ")", "\n", "label", ":=", "str", "[", "match", "[", "2", "]", ":", "match", "[", "3", "]", "]", "\n", "moved", ":=", "moveLabel", "(", "from", ",", "to", ",", "label", ")", "\n", "buf", ".", "WriteString", "(", "moved", ")", "\n", "buf", ".", "WriteString", "(", "str", "[", "match", "[", "3", "]", ":", "match", "[", "1", "]", "]", ")", "\n", "pos", "=", "match", "[", "1", "]", "\n", "}", "\n", "buf", ".", "WriteString", "(", "str", "[", "<mask>", ":", "]", ")", "\n", "return", "buf", ".", "String", "(", ")", "\n", "}" ]
19,785
all-19786
[ "GetAlerts", "returns", "a", "slice", "of", "all", "alerts", "." ]
[ "func", "(", "client", "*", "Client", ")", "GetAlerts", "(", ")", "(", "[", "]", "Alert", ",", "error", ")", "{", "var", "<mask>", "reqAlerts", "\n", "if", "err", ":=", "client", ".", "doJsonRequest", "(", "\"", "\"", ",", "\"", "\"", ",", "nil", ",", "&", "out", ")", ";", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "return", "out", ".", "Alerts", ",", "nil", "\n", "}" ]
19,786
all-19787
[ "ReadPublic", "loads", "rsa", ".", "PublicKey", "from", "PKIX", "or", "PKCS1", "X509", "blobs" ]
[ "func", "ReadPublic", "(", "raw", "[", "]", "byte", ")", "(", "key", "*", "rsa", ".", "PublicKey", ",", "err", "error", ")", "{", "var", "encoded", "*", "pem", ".", "Block", "\n", "if", "encoded", ",", "_", "=", "pem", ".", "Decode", "(", "raw", ")", ";", "encoded", "==", "nil", "{", "return", "nil", ",", "errors", ".", "New", "(", "\"", "\"", ")", "\n", "}", "\n", "var", "parsedKey", "interface", "{", "}", "\n", "var", "cert", "*", "x509", ".", "Certificate", "\n", "if", "parsedKey", ",", "err", "=", "x509", ".", "ParsePKIXPublicKey", "(", "encoded", ".", "Bytes", ")", ";", "err", "!=", "nil", "{", "if", "cert", ",", "err", "=", "x509", ".", "ParseCertificate", "(", "encoded", ".", "Bytes", ")", ";", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "parsedKey", "=", "cert", ".", "PublicKey", "\n", "}", "\n", "var", "ok", "bool", "\n", "if", "key", ",", "ok", "=", "parsedKey", ".", "(", "*", "rsa", ".", "PublicKey", ")", ";", "!", "ok", "{", "return", "nil", ",", "errors", ".", "New", "(", "\"", "\"", ")", "\n", "}", "\n", "return", "<mask>", ",", "nil", "\n", "}" ]
19,787
all-19788
[ "DescribeSecret", "mocks", "base", "method" ]
[ "func", "(", "m", "*", "MockSecretsManagerAPI", ")", "DescribeSecret", "(", "arg0", "*", "secretsmanager", ".", "DescribeSecretInput", ")", "(", "*", "secretsmanager", ".", "DescribeSecretOutput", ",", "error", ")", "{", "ret", ":=", "m", ".", "ctrl", ".", "Call", "(", "m", ",", "\"", "\"", ",", "arg0", ")", "\n", "ret0", ",", "_", ":=", "<mask>", "[", "0", "]", ".", "(", "*", "secretsmanager", ".", "DescribeSecretOutput", ")", "\n", "ret1", ",", "_", ":=", "ret", "[", "1", "]", ".", "(", "error", ")", "\n", "return", "ret0", ",", "ret1", "\n", "}" ]
19,788
all-19789
[ "WithObjectGroup", "symbolic", "group", "name", "that", "can", "be", "used", "to", "release", "multiple", "objects", "." ]
[ "func", "(", "p", "GetObjectByHeapObjectIDParams", ")", "WithObjectGroup", "(", "objectGroup", "<mask>", ")", "*", "GetObjectByHeapObjectIDParams", "{", "p", ".", "ObjectGroup", "=", "objectGroup", "\n", "return", "&", "p", "\n", "}" ]
19,789
all-19790
[ "UnmarshalJSON", "supports", "json", ".", "Unmarshaler", "interface" ]
[ "func", "(", "v", "*", "EventDomContentEventFired", ")", "UnmarshalJSON", "(", "<mask>", "[", "]", "byte", ")", "error", "{", "r", ":=", "jlexer", ".", "Lexer", "{", "Data", ":", "data", "}", "\n", "easyjsonC5a4559bDecodeGithubComChromedpCdprotoPage68", "(", "&", "r", ",", "v", ")", "\n", "return", "r", ".", "Error", "(", ")", "\n", "}" ]
19,790
all-19791
[ "Pick", "is", "called", "for", "every", "client", "request", "." ]
[ "func", "(", "rb", "*", "rrBalanced", ")", "Pick", "(", "ctx", "<mask>", ".", "Context", ",", "opts", "balancer", ".", "PickOptions", ")", "(", "balancer", ".", "SubConn", ",", "func", "(", "balancer", ".", "DoneInfo", ")", ",", "error", ")", "{", "rb", ".", "mu", ".", "RLock", "(", ")", "\n", "n", ":=", "len", "(", "rb", ".", "scs", ")", "\n", "rb", ".", "mu", ".", "RUnlock", "(", ")", "\n", "if", "n", "==", "0", "{", "return", "nil", ",", "nil", ",", "balancer", ".", "ErrNoSubConnAvailable", "\n", "}", "\n\n", "rb", ".", "mu", ".", "Lock", "(", ")", "\n", "cur", ":=", "rb", ".", "next", "\n", "sc", ":=", "rb", ".", "scs", "[", "cur", "]", "\n", "picked", ":=", "rb", ".", "scToAddr", "[", "sc", "]", ".", "Addr", "\n", "rb", ".", "next", "=", "(", "rb", ".", "next", "+", "1", ")", "%", "len", "(", "rb", ".", "scs", ")", "\n", "rb", ".", "mu", ".", "Unlock", "(", ")", "\n\n", "rb", ".", "lg", ".", "Debug", "(", "\"", "\"", ",", "zap", ".", "String", "(", "\"", "\"", ",", "picked", ")", ",", "zap", ".", "Int", "(", "\"", "\"", ",", "cur", ")", ",", "zap", ".", "Int", "(", "\"", "\"", ",", "n", ")", ",", ")", "\n\n", "doneFunc", ":=", "func", "(", "info", "balancer", ".", "DoneInfo", ")", "{", "// TODO: error handling?", "fss", ":=", "[", "]", "zapcore", ".", "Field", "{", "zap", ".", "Error", "(", "info", ".", "Err", ")", ",", "zap", ".", "String", "(", "\"", "\"", ",", "picked", ")", ",", "zap", ".", "Bool", "(", "\"", "\"", ",", "info", ".", "Err", "==", "nil", ")", ",", "zap", ".", "Bool", "(", "\"", "\"", ",", "info", ".", "BytesSent", ")", ",", "zap", ".", "Bool", "(", "\"", "\"", ",", "info", ".", "BytesReceived", ")", ",", "}", "\n", "if", "info", ".", "Err", "==", "nil", "{", "rb", ".", "lg", ".", "Debug", "(", "\"", "\"", ",", "fss", "...", ")", "\n", "}", "else", "{", "rb", ".", "lg", ".", "Warn", "(", "\"", "\"", ",", "fss", "...", ")", "\n", "}", "\n", "}", "\n", "return", "sc", ",", "doneFunc", ",", "nil", "\n", "}" ]
19,791
all-19792
[ "ValidateIncomingRequest", "returns", "an", "error", "if", "the", "incoming", "req", "could", "not", "be", "validated", "as", "coming", "from", "Twilio", ".", "This", "process", "is", "frequently", "error", "prone", "especially", "if", "you", "are", "running", "behind", "a", "proxy", "or", "Twilio", "is", "making", "requests", "with", "a", "port", "in", "the", "URL", ".", "See", "https", ":", "//", "www", ".", "twilio", ".", "com", "/", "docs", "/", "security#validating", "-", "requests", "for", "more", "information" ]
[ "func", "ValidateIncomingRequest", "(", "host", "string", ",", "authToken", "string", ",", "req", "*", "http", ".", "Request", ")", "(", "err", "error", ")", "{", "err", "=", "req", ".", "ParseForm", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "\n", "}", "\n", "err", "=", "validateIncomingRequest", "(", "host", ",", "authToken", ",", "req", ".", "URL", ".", "String", "(", ")", ",", "req", ".", "Form", ",", "req", ".", "<mask>", ".", "Get", "(", "\"", "\"", ")", ")", "\n", "if", "err", "!=", "nil", "{", "return", "\n", "}", "\n\n", "return", "\n", "}" ]
19,792
all-19793
[ "UnmarshalJSON", "supports", "json", ".", "Unmarshaler", "interface" ]
[ "func", "(", "v", "*", "MakeSnapshotReturns", ")", "UnmarshalJSON", "(", "data", "[", "]", "byte", ")", "error", "{", "r", ":=", "jlexer", ".", "Lexer", "{", "Data", ":", "data", "}", "\n", "easyjsonC5a4559bDecodeGithubComChromedpCdprotoLayertree10", "(", "&", "r", ",", "v", ")", "\n", "return", "r", ".", "<mask>", "(", ")", "\n", "}" ]
19,793
all-19794
[ "PutManifest", "writes", "manifest", "to", "the", "destination", ".", "FIXME?", "This", "should", "also", "receive", "a", "MIME", "type", "if", "known", "to", "differentiate", "between", "schema", "versions", ".", "If", "the", "destination", "is", "in", "principle", "available", "refuses", "this", "manifest", "type", "(", "e", ".", "g", ".", "it", "does", "not", "recognize", "the", "schema", ")", "but", "may", "accept", "a", "different", "manifest", "type", "the", "returned", "error", "must", "be", "an", "ManifestTypeRejectedError", "." ]
[ "func", "(", "d", "*", "ociImageDestination", ")", "PutManifest", "(", "ctx", "context", ".", "Context", ",", "m", "[", "]", "byte", ")", "error", "{", "digest", ",", "err", ":=", "manifest", ".", "Digest", "(", "m", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "desc", ":=", "imgspecv1", ".", "Descriptor", "{", "}", "\n", "desc", ".", "Digest", "=", "digest", "\n", "// TODO(runcom): beaware and add support for OCI manifest list", "desc", ".", "MediaType", "=", "imgspecv1", ".", "MediaTypeImageManifest", "\n", "desc", ".", "Size", "=", "int64", "(", "len", "(", "m", ")", ")", "\n\n", "blobPath", ",", "err", ":=", "d", ".", "ref", ".", "blobPath", "(", "digest", ",", "d", ".", "sharedBlobDir", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "if", "err", ":=", "ensureParentDirectoryExists", "(", "blobPath", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "if", "err", ":=", "ioutil", ".", "WriteFile", "(", "blobPath", ",", "m", ",", "0644", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "if", "d", ".", "ref", ".", "image", "!=", "\"", "\"", "{", "annotations", ":=", "make", "(", "map", "[", "string", "]", "string", ")", "\n", "annotations", "[", "\"", "\"", "]", "=", "d", ".", "ref", ".", "image", "\n", "desc", ".", "Annotations", "=", "annotations", "\n", "}", "\n", "desc", ".", "Platform", "=", "&", "imgspecv1", ".", "<mask>", "{", "Architecture", ":", "runtime", ".", "GOARCH", ",", "OS", ":", "runtime", ".", "GOOS", ",", "}", "\n", "d", ".", "addManifest", "(", "&", "desc", ")", "\n\n", "return", "nil", "\n", "}" ]
19,794
all-19795
[ "NewPart", "creates", "a", "new", "Part", "object", "." ]
[ "func", "NewPart", "(", "contentType", "string", ")", "*", "Part", "{", "return", "&", "Part", "{", "Header", ":", "<mask>", "(", "textproto", ".", "MIMEHeader", ")", ",", "ContentType", ":", "contentType", ",", "}", "\n", "}" ]
19,795
all-19796
[ "Barrier", "is", "used", "to", "issue", "a", "command", "that", "blocks", "until", "all", "preceeding", "operations", "have", "been", "applied", "to", "the", "FSM", ".", "It", "can", "be", "used", "to", "ensure", "the", "FSM", "reflects", "all", "queued", "writes", ".", "An", "optional", "timeout", "can", "be", "provided", "to", "limit", "the", "amount", "of", "time", "we", "wait", "for", "the", "command", "to", "be", "started", ".", "This", "must", "be", "run", "on", "the", "leader", "or", "it", "will", "fail", "." ]
[ "func", "(", "r", "*", "Raft", ")", "Barrier", "(", "timeout", "time", ".", "Duration", ")", "Future", "{", "metrics", ".", "IncrCounter", "(", "[", "]", "string", "{", "\"", "\"", ",", "\"", "\"", "}", ",", "1", ")", "\n", "var", "timer", "<-", "chan", "time", ".", "Time", "\n", "if", "timeout", ">", "0", "{", "timer", "=", "<mask>", ".", "After", "(", "timeout", ")", "\n", "}", "\n\n", "// Create a log future, no index or term yet", "logFuture", ":=", "&", "logFuture", "{", "log", ":", "Log", "{", "Type", ":", "LogBarrier", ",", "}", ",", "}", "\n", "logFuture", ".", "init", "(", ")", "\n\n", "select", "{", "case", "<-", "timer", ":", "return", "errorFuture", "{", "ErrEnqueueTimeout", "}", "\n", "case", "<-", "r", ".", "shutdownCh", ":", "return", "errorFuture", "{", "ErrRaftShutdown", "}", "\n", "case", "r", ".", "applyCh", "<-", "logFuture", ":", "return", "logFuture", "\n", "}", "\n", "}" ]
19,796
all-19797
[ "GetCanceledOk", "returns", "a", "tuple", "with", "the", "Canceled", "field", "if", "it", "s", "non", "-", "nil", "zero", "value", "otherwise", "and", "a", "boolean", "to", "check", "if", "the", "value", "has", "been", "set", "." ]
[ "func", "(", "d", "*", "Downtime", ")", "GetCanceledOk", "(", ")", "(", "int", ",", "bool", ")", "{", "if", "d", "==", "nil", "||", "d", ".", "Canceled", "==", "nil", "{", "return", "0", ",", "false", "\n", "}", "\n", "return", "*", "d", ".", "Canceled", ",", "<mask>", "\n", "}" ]
19,797
all-19798
[ "OnSend", "causes", "all", "requests", "sent", "on", "conn", "to", "invoke", "f", "(", "req", "nil", ")", "and", "all", "responses", "to", "invoke", "f", "(", "nil", "resp", ")" ]
[ "func", "OnSend", "(", "f", "func", "(", "*", "Request", ",", "*", "<mask>", ")", ")", "ConnOpt", "{", "return", "func", "(", "c", "*", "Conn", ")", "{", "c", ".", "onSend", "=", "append", "(", "c", ".", "onSend", ",", "f", ")", "}", "\n", "}" ]
19,798
all-19799
[ "getRequiredSecrets", "returns", "the", "requiredSecrets", "field", "of", "asmsecret", "task", "resource" ]
[ "func", "(", "secret", "*", "ASMSecretResource", ")", "getRequiredSecrets", "(", ")", "map", "[", "string", "]", "apicontainer", ".", "Secret", "{", "secret", ".", "<mask>", ".", "RLock", "(", ")", "\n", "defer", "secret", ".", "lock", ".", "RUnlock", "(", ")", "\n\n", "return", "secret", ".", "requiredSecrets", "\n", "}" ]
19,799
all-19800
[ "IgnoreFields", "returns", "an", "Option", "that", "ignores", "exported", "fields", "of", "the", "given", "names", "on", "a", "single", "struct", "type", ".", "The", "struct", "type", "is", "specified", "by", "passing", "in", "a", "value", "of", "that", "type", ".", "The", "name", "may", "be", "a", "dot", "-", "delimited", "string", "(", "e", ".", "g", ".", "Foo", ".", "Bar", ")", "to", "ignore", "a", "specific", "sub", "-", "field", "that", "is", "embedded", "or", "nested", "within", "the", "parent", "struct", ".", "This", "does", "not", "handle", "unexported", "fields", ";", "use", "IgnoreUnexported", "instead", "." ]
[ "func", "IgnoreFields", "(", "typ", "interface", "{", "}", ",", "names", "...", "string", ")", "cmp", ".", "Option", "{", "sf", ":=", "newStructFilter", "(", "typ", ",", "<mask>", "...", ")", "\n", "return", "cmp", ".", "FilterPath", "(", "sf", ".", "filter", ",", "cmp", ".", "Ignore", "(", ")", ")", "\n", "}" ]