id
int32
0
25.3k
idx
stringlengths
5
9
nl_tokens
sequencelengths
1
418
pl_tokens
sequencelengths
22
4.98k
4,600
all-4601
[ "MustManageDataOp", "retrieves", "the", "ManageDataOp", "value", "from", "the", "union", "panicing", "if", "the", "value", "is", "not", "set", "." ]
[ "func", "(", "u", "OperationBody", ")", "MustManageDataOp", "(", ")", "ManageDataOp", "{", "val", ",", "<mask>", ":=", "u", ".", "GetManageDataOp", "(", ")", "\n\n", "if", "!", "ok", "{", "panic", "(", "\"", "\"", ")", "\n", "}", "\n\n", "return", "val", "\n", "}" ]
4,601
all-4602
[ "FetchBrokers", "returns", "all", "brokers", "available", "to", "the", "API", "Token", "." ]
[ "func", "(", "a", "*", "API", ")", "FetchBrokers", "(", ")", "(", "*", "[", "]", "Broker", ",", "error", ")", "{", "result", ",", "err", ":=", "a", ".", "Get", "(", "config", ".", "BrokerPrefix", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "var", "response", "[", "]", "Broker", "\n", "if", "err", ":=", "json", ".", "Unmarshal", "(", "result", ",", "&", "response", ")", ";", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "return", "&", "<mask>", ",", "nil", "\n", "}" ]
4,602
all-4603
[ "QueryString", "returns", "query", "string", "for", "the", "args", ".", "The", "returned", "value", "is", "valid", "until", "the", "next", "call", "to", "Args", "methods", "." ]
[ "func", "(", "a", "*", "Args", ")", "QueryString", "(", ")", "[", "]", "<mask>", "{", "a", ".", "buf", "=", "a", ".", "AppendBytes", "(", "a", ".", "buf", "[", ":", "0", "]", ")", "\n", "return", "a", ".", "buf", "\n", "}" ]
4,603
all-4604
[ "UnmarshalText", "unmarshals", "text", "to", "offset", ".", "It", "handles", "newest", "and", "oldest", "oterwise", "fallbacks", "to", "time", ".", "ParseDuration", "." ]
[ "func", "(", "o", "*", "Offset", ")", "UnmarshalText", "(", "text", "[", "]", "byte", ")", "error", "{", "offsetName", ":=", "string", "(", "<mask>", ")", "\n\n", "switch", "strings", ".", "ToLower", "(", "offsetName", ")", "{", "case", "\"", "\"", ":", "*", "o", "=", "OffsetNewest", "\n", "case", "\"", "\"", ":", "*", "o", "=", "OffsetOldest", "\n", "default", ":", "d", ",", "err", ":=", "time", ".", "ParseDuration", "(", "offsetName", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "*", "o", "=", "Offset", "(", "time", ".", "Now", "(", ")", ".", "Add", "(", "d", ")", ".", "UnixNano", "(", ")", ")", "\n", "}", "\n", "return", "nil", "\n", "}" ]
4,604
all-4605
[ "HandlerFunc", "builds", "and", "returns", "a", "http", ".", "Handler", "from", "the", "chain", "of", "middlewares", "with", "h", "http", ".", "Handler", "as", "the", "final", "handler", "." ]
[ "func", "(", "mws", "Middlewares", ")", "HandlerFunc", "(", "h", "<mask>", ".", "HandlerFunc", ")", "http", ".", "Handler", "{", "return", "&", "ChainHandler", "{", "mws", ",", "h", ",", "chain", "(", "mws", ",", "h", ")", "}", "\n", "}" ]
4,605
all-4606
[ "NewConfig", "returns", "a", "new", "configuration", "instance", "with", "sane", "defaults", "." ]
[ "func", "NewConfig", "(", ")", "*", "Config", "{", "c", ":=", "&", "Config", "{", "Config", ":", "*", "sarama", ".", "NewConfig", "(", ")", ",", "}", "\n", "c", ".", "Group", ".", "PartitionStrategy", "=", "StrategyRange", "\n", "c", ".", "Group", ".", "Offsets", ".", "Retry", ".", "Max", "=", "3", "\n", "c", ".", "Group", ".", "Offsets", ".", "Synchronization", ".", "DwellTime", "=", "c", ".", "Consumer", ".", "MaxProcessingTime", "\n", "c", ".", "Group", ".", "Session", ".", "Timeout", "=", "30", "*", "time", ".", "Second", "\n", "c", ".", "<mask>", ".", "Heartbeat", ".", "Interval", "=", "3", "*", "time", ".", "Second", "\n", "c", ".", "Config", ".", "Version", "=", "minVersion", "\n", "return", "c", "\n", "}" ]
4,606
all-4607
[ "parseSeriesDesc", "parses", "the", "description", "of", "a", "time", "series", "." ]
[ "func", "parseSeriesDesc", "(", "input", "string", ")", "(", "labels", ".", "Labels", ",", "[", "]", "sequenceValue", ",", "error", ")", "{", "p", ":=", "newParser", "(", "input", ")", "\n", "p", ".", "lex", ".", "seriesDesc", "=", "<mask>", "\n\n", "return", "p", ".", "parseSeriesDesc", "(", ")", "\n", "}" ]
4,607
all-4608
[ "PasswordCheck", "validates", "the", "provided", "password", "against", "the", "encoded", "secret" ]
[ "func", "PasswordCheck", "(", "secret", "string", ",", "password", "string", ")", "error", "{", "// No password set", "if", "secret", "==", "\"", "\"", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ")", "\n", "}", "\n\n", "// Compare the password", "buff", ",", "err", ":=", "hex", ".", "DecodeString", "(", "<mask>", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "salt", ":=", "buff", "[", "0", ":", "32", "]", "\n", "hash", ",", "err", ":=", "scrypt", ".", "Key", "(", "[", "]", "byte", "(", "password", ")", ",", "salt", ",", "1", "<<", "14", ",", "8", ",", "1", ",", "64", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "if", "!", "bytes", ".", "Equal", "(", "hash", ",", "buff", "[", "32", ":", "]", ")", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ")", "\n", "}", "\n\n", "return", "nil", "\n", "}" ]
4,608
all-4609
[ "PopAttributes", "restores", "saved", "with", "PushAttributes", "colors", ".", "Function", "does", "nothing", "if", "there", "is", "no", "saved", "colors" ]
[ "func", "PopAttributes", "(", ")", "{", "if", "len", "(", "canvas", ".", "attrStack", ")", "==", "0", "{", "return", "\n", "}", "\n", "a", ":=", "canvas", ".", "attrStack", "[", "len", "(", "canvas", ".", "attrStack", ")", "-", "1", "]", "\n", "canvas", ".", "attrStack", "=", "canvas", ".", "attrStack", "[", ":", "len", "(", "canvas", ".", "attrStack", ")", "-", "1", "]", "\n", "SetTextColor", "(", "a", ".", "<mask>", ")", "\n", "SetBackColor", "(", "a", ".", "back", ")", "\n", "}" ]
4,609
all-4610
[ "HasLabel", "returns", "a", "boolean", "if", "a", "field", "has", "been", "set", "." ]
[ "func", "(", "t", "*", "TileDefMarker", ")", "HasLabel", "(", ")", "bool", "{", "if", "t", "!=", "nil", "&&", "t", ".", "<mask>", "!=", "nil", "{", "return", "true", "\n", "}", "\n\n", "return", "false", "\n", "}" ]
4,610
all-4611
[ "ConsulStringToStructFunc", "checks", "if", "the", "value", "set", "for", "the", "key", "should", "actually", "be", "a", "struct", "and", "sets", "the", "appropriate", "value", "in", "the", "struct", ".", "This", "is", "for", "backwards", "-", "compatability", "with", "older", "versions", "of", "Consul", "Template", "." ]
[ "func", "ConsulStringToStructFunc", "(", ")", "mapstructure", ".", "DecodeHookFunc", "{", "return", "func", "(", "f", "reflect", ".", "Type", ",", "t", "reflect", ".", "Type", ",", "data", "interface", "{", "}", ")", "(", "interface", "{", "}", ",", "error", ")", "{", "if", "t", "==", "reflect", ".", "TypeOf", "(", "ConsulConfig", "{", "}", ")", "&&", "f", ".", "Kind", "(", ")", "==", "reflect", ".", "String", "{", "log", ".", "Println", "(", "\"", "\"", "+", "\"", "\\\"", "\\\"", "\"", "+", "\"", "\"", ")", "\n", "return", "&", "ConsulConfig", "{", "Address", ":", "String", "(", "data", ".", "(", "string", ")", ")", ",", "}", ",", "nil", "\n", "}", "\n\n", "return", "<mask>", ",", "nil", "\n", "}", "\n", "}" ]
4,611
all-4612
[ "UnmarshalJSON", "supports", "json", ".", "Unmarshaler", "interface" ]
[ "func", "(", "v", "*", "StopLoadingParams", ")", "UnmarshalJSON", "(", "<mask>", "[", "]", "byte", ")", "error", "{", "r", ":=", "jlexer", ".", "Lexer", "{", "Data", ":", "data", "}", "\n", "easyjsonC5a4559bDecodeGithubComChromedpCdprotoPage4", "(", "&", "r", ",", "v", ")", "\n", "return", "r", ".", "Error", "(", ")", "\n", "}" ]
4,612
all-4613
[ "newProwJobs", "returns", "a", "ProwJobs" ]
[ "func", "newProwJobs", "(", "c", "*", "ProwV1Client", ",", "namespace", "string", ")", "*", "prowJobs", "{", "return", "&", "prowJobs", "{", "<mask>", ":", "c", ".", "RESTClient", "(", ")", ",", "ns", ":", "namespace", ",", "}", "\n", "}" ]
4,613
all-4614
[ "Set", "adds", "a", "uint16", "tag", "to", "the", "span" ]
[ "func", "(", "tag", "uint16TagName", ")", "Set", "(", "span", "opentracing", ".", "Span", ",", "value", "uint16", ")", "{", "span", ".", "SetTag", "(", "string", "(", "<mask>", ")", ",", "value", ")", "\n", "}" ]
4,614
all-4615
[ "NewClient", "creates", "a", "client", "with", "the", "given", "address", "URI", "or", "cluster", "and", "options", "." ]
[ "func", "NewClient", "(", "addrURIOrCluster", "interface", "{", "}", ",", "options", "...", "ClientOption", ")", "(", "*", "Client", ",", "error", ")", "{", "var", "cluster", "*", "Cluster", "\n", "clientOptions", ":=", "&", "ClientOptions", "{", "}", "\n", "err", ":=", "clientOptions", ".", "addOptions", "(", "options", "...", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "switch", "u", ":=", "addrURIOrCluster", ".", "(", "type", ")", "{", "case", "string", ":", "uri", ",", "err", ":=", "NewURIFromAddress", "(", "u", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "return", "newClientWithURI", "(", "uri", ",", "clientOptions", ")", ",", "nil", "\n", "case", "[", "]", "string", ":", "if", "len", "(", "u", ")", "==", "1", "{", "uri", ",", "err", ":=", "NewURIFromAddress", "(", "u", "[", "0", "]", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "return", "newClientWithURI", "(", "uri", ",", "clientOptions", ")", ",", "nil", "\n", "}", "else", "if", "clientOptions", ".", "manualServerAddress", "{", "return", "nil", ",", "ErrSingleServerAddressRequired", "\n", "}", "\n", "return", "newClientFromAddresses", "(", "u", ",", "clientOptions", ")", "\n", "case", "*", "URI", ":", "uriCopy", ":=", "*", "u", "\n", "return", "newClientWithURI", "(", "&", "uriCopy", ",", "clientOptions", ")", ",", "nil", "\n", "case", "[", "]", "*", "URI", ":", "if", "len", "(", "u", ")", "==", "1", "{", "uriCopy", ":=", "*", "u", "[", "0", "]", "\n", "return", "newClientWithURI", "(", "&", "uriCopy", ",", "clientOptions", ")", ",", "nil", "\n", "}", "else", "if", "clientOptions", ".", "manualServerAddress", "{", "return", "nil", ",", "ErrSingleServerAddressRequired", "\n", "}", "\n", "cluster", "=", "NewClusterWithHost", "(", "u", "...", ")", "\n", "case", "*", "Cluster", ":", "cluster", "=", "u", "\n", "case", "nil", ":", "cluster", "=", "NewClusterWithHost", "(", ")", "\n", "<mask>", ":", "return", "nil", ",", "ErrAddrURIClusterExpected", "\n", "}", "\n\n", "return", "newClientWithCluster", "(", "cluster", ",", "clientOptions", ")", ",", "nil", "\n", "}" ]
4,615
all-4616
[ "AppendEntriesPipeline", "returns", "an", "interface", "that", "can", "be", "used", "to", "pipeline", "AppendEntries", "requests", "." ]
[ "func", "(", "n", "*", "NetworkTransport", ")", "AppendEntriesPipeline", "(", "id", "ServerID", ",", "target", "ServerAddress", ")", "(", "AppendPipeline", ",", "error", ")", "{", "// Get a connection", "conn", ",", "err", ":=", "n", ".", "getConnFromAddressProvider", "(", "<mask>", ",", "target", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "// Create the pipeline", "return", "newNetPipeline", "(", "n", ",", "conn", ")", ",", "nil", "\n", "}" ]
4,616
all-4617
[ "Generate", "API", "client", "code", "drives", "the", "code", "writer", "." ]
[ "func", "generateClient", "(", "descriptor", "*", "gen", ".", "APIDescriptor", ",", "codegen", "string", ")", "error", "{", "f", ",", "err", ":=", "os", ".", "Create", "(", "codegen", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "c", ",", "err", ":=", "writers", ".", "NewClientWriter", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "kingpin", ".", "FatalIfError", "(", "c", ".", "WriteHeader", "(", "\"", "\"", ",", "\"", "\"", ",", "false", "/*needTime*/", ",", "true", "/*needJSON*/", ",", "f", ")", ",", "\"", "\"", ")", "\n", "for", "_", ",", "name", ":=", "range", "descriptor", ".", "ResourceNames", "{", "resource", ":=", "descriptor", ".", "Resources", "[", "<mask>", "]", "\n", "c", ".", "WriteResourceHeader", "(", "name", ",", "f", ")", "\n", "kingpin", ".", "FatalIfError", "(", "c", ".", "WriteResource", "(", "resource", ",", "f", ")", ",", "\"", "\"", ")", "\n", "}", "\n", "c", ".", "WriteTypeSectionHeader", "(", "f", ")", "\n", "for", "_", ",", "name", ":=", "range", "descriptor", ".", "TypeNames", "{", "t", ":=", "descriptor", ".", "Types", "[", "name", "]", "\n", "c", ".", "WriteType", "(", "t", ",", "f", ")", "\n", "}", "\n", "f", ".", "Close", "(", ")", "\n", "o", ",", "err", ":=", "exec", ".", "Command", "(", "\"", "\"", ",", "\"", "\"", ",", "codegen", ")", ".", "CombinedOutput", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\\n", "\"", ",", "o", ")", "\n", "}", "\n", "return", "nil", "\n", "}" ]
4,617
all-4618
[ "Eval", "evaluates", "the", "rule", "expression", "and", "then", "creates", "pending", "alerts", "and", "fires", "or", "removes", "previously", "pending", "alerts", "accordingly", "." ]
[ "func", "(", "r", "*", "AlertingRule", ")", "Eval", "(", "ctx", "context", ".", "Context", ",", "ts", "time", ".", "Time", ",", "query", "QueryFunc", ",", "externalURL", "*", "url", ".", "URL", ")", "(", "promql", ".", "Vector", ",", "error", ")", "{", "res", ",", "err", ":=", "query", "(", "ctx", ",", "r", ".", "vector", ".", "String", "(", ")", ",", "ts", ")", "\n", "if", "err", "!=", "nil", "{", "r", ".", "SetHealth", "(", "HealthBad", ")", "\n", "r", ".", "SetLastError", "(", "err", ")", "\n", "return", "nil", ",", "err", "\n", "}", "\n\n", "r", ".", "mtx", ".", "Lock", "(", ")", "\n", "defer", "r", ".", "mtx", ".", "Unlock", "(", ")", "\n\n", "// Create pending alerts for any new vector elements in the alert expression", "// or update the expression value for existing elements.", "resultFPs", ":=", "map", "[", "uint64", "]", "struct", "{", "}", "{", "}", "\n\n", "var", "vec", "promql", ".", "Vector", "\n", "for", "_", ",", "smpl", ":=", "range", "res", "{", "// Provide the alert information to the template.", "l", ":=", "make", "(", "map", "[", "string", "]", "string", ",", "len", "(", "smpl", ".", "Metric", ")", ")", "\n", "for", "_", ",", "lbl", ":=", "range", "smpl", ".", "Metric", "{", "l", "[", "lbl", ".", "Name", "]", "=", "lbl", ".", "Value", "\n", "}", "\n\n", "tmplData", ":=", "template", ".", "AlertTemplateData", "(", "l", ",", "r", ".", "externalLabels", ",", "smpl", ".", "V", ")", "\n", "// Inject some convenience variables that are easier to remember for users", "// who are not used to Go's templating system.", "defs", ":=", "[", "]", "string", "{", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "}", "\n\n", "expand", ":=", "func", "(", "text", "string", ")", "string", "{", "tmpl", ":=", "template", ".", "NewTemplateExpander", "(", "ctx", ",", "strings", ".", "Join", "(", "append", "(", "defs", ",", "text", ")", ",", "\"", "\"", ")", ",", "\"", "\"", "+", "r", ".", "Name", "(", ")", ",", "tmplData", ",", "model", ".", "Time", "(", "timestamp", ".", "FromTime", "(", "ts", ")", ")", ",", "template", ".", "QueryFunc", "(", "query", ")", ",", "externalURL", ",", ")", "\n", "result", ",", "err", ":=", "tmpl", ".", "Expand", "(", ")", "\n", "if", "err", "!=", "nil", "{", "result", "=", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "err", ")", "\n", "level", ".", "Warn", "(", "r", ".", "logger", ")", ".", "<mask>", "(", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "err", ",", "\"", "\"", ",", "tmplData", ")", "\n", "}", "\n", "return", "result", "\n", "}", "\n\n", "lb", ":=", "labels", ".", "NewBuilder", "(", "smpl", ".", "Metric", ")", ".", "Del", "(", "labels", ".", "MetricName", ")", "\n\n", "for", "_", ",", "l", ":=", "range", "r", ".", "labels", "{", "lb", ".", "Set", "(", "l", ".", "Name", ",", "expand", "(", "l", ".", "Value", ")", ")", "\n", "}", "\n", "lb", ".", "Set", "(", "labels", ".", "AlertName", ",", "r", ".", "Name", "(", ")", ")", "\n\n", "annotations", ":=", "make", "(", "labels", ".", "Labels", ",", "0", ",", "len", "(", "r", ".", "annotations", ")", ")", "\n", "for", "_", ",", "a", ":=", "range", "r", ".", "annotations", "{", "annotations", "=", "append", "(", "annotations", ",", "labels", ".", "Label", "{", "Name", ":", "a", ".", "Name", ",", "Value", ":", "expand", "(", "a", ".", "Value", ")", "}", ")", "\n", "}", "\n\n", "lbs", ":=", "lb", ".", "Labels", "(", ")", "\n", "h", ":=", "lbs", ".", "Hash", "(", ")", "\n", "resultFPs", "[", "h", "]", "=", "struct", "{", "}", "{", "}", "\n\n", "// Check whether we already have alerting state for the identifying label set.", "// Update the last value and annotations if so, create a new alert entry otherwise.", "if", "alert", ",", "ok", ":=", "r", ".", "active", "[", "h", "]", ";", "ok", "&&", "alert", ".", "State", "!=", "StateInactive", "{", "alert", ".", "Value", "=", "smpl", ".", "V", "\n", "alert", ".", "Annotations", "=", "annotations", "\n", "continue", "\n", "}", "\n\n", "r", ".", "active", "[", "h", "]", "=", "&", "Alert", "{", "Labels", ":", "lbs", ",", "Annotations", ":", "annotations", ",", "ActiveAt", ":", "ts", ",", "State", ":", "StatePending", ",", "Value", ":", "smpl", ".", "V", ",", "}", "\n", "}", "\n\n", "// Check if any pending alerts should be removed or fire now. Write out alert timeseries.", "for", "fp", ",", "a", ":=", "range", "r", ".", "active", "{", "if", "_", ",", "ok", ":=", "resultFPs", "[", "fp", "]", ";", "!", "ok", "{", "// If the alert was previously firing, keep it around for a given", "// retention time so it is reported as resolved to the AlertManager.", "if", "a", ".", "State", "==", "StatePending", "||", "(", "!", "a", ".", "ResolvedAt", ".", "IsZero", "(", ")", "&&", "ts", ".", "Sub", "(", "a", ".", "ResolvedAt", ")", ">", "resolvedRetention", ")", "{", "delete", "(", "r", ".", "active", ",", "fp", ")", "\n", "}", "\n", "if", "a", ".", "State", "!=", "StateInactive", "{", "a", ".", "State", "=", "StateInactive", "\n", "a", ".", "ResolvedAt", "=", "ts", "\n", "}", "\n", "continue", "\n", "}", "\n\n", "if", "a", ".", "State", "==", "StatePending", "&&", "ts", ".", "Sub", "(", "a", ".", "ActiveAt", ")", ">=", "r", ".", "holdDuration", "{", "a", ".", "State", "=", "StateFiring", "\n", "a", ".", "FiredAt", "=", "ts", "\n", "}", "\n\n", "if", "r", ".", "restored", "{", "vec", "=", "append", "(", "vec", ",", "r", ".", "sample", "(", "a", ",", "ts", ")", ")", "\n", "vec", "=", "append", "(", "vec", ",", "r", ".", "forStateSample", "(", "a", ",", "ts", ",", "float64", "(", "a", ".", "ActiveAt", ".", "Unix", "(", ")", ")", ")", ")", "\n", "}", "\n", "}", "\n\n", "// We have already acquired the lock above hence using SetHealth and", "// SetLastError will deadlock.", "r", ".", "health", "=", "HealthGood", "\n", "r", ".", "lastError", "=", "err", "\n", "return", "vec", ",", "nil", "\n", "}" ]
4,618
all-4619
[ "AddUserToGroup", "adds", "a", "user", "to", "a", "group" ]
[ "func", "(", "c", "*", "Client", ")", "AddUserToGroup", "(", "groupid", "string", ",", "userid", "string", ")", "(", "*", "User", ",", "error", ")", "{", "<mask>", "usr", "User", "\n", "usr", ".", "ID", "=", "userid", "\n", "url", ":=", "umGroupUsers", "(", "groupid", ")", "+", "`?depth=`", "+", "c", ".", "client", ".", "depth", "+", "`&pretty=`", "+", "strconv", ".", "FormatBool", "(", "c", ".", "client", ".", "pretty", ")", "\n", "ret", ":=", "&", "User", "{", "}", "\n", "err", ":=", "c", ".", "client", ".", "Post", "(", "url", ",", "usr", ",", "ret", ",", "http", ".", "StatusAccepted", ")", "\n", "return", "ret", ",", "err", "\n", "}" ]
4,619
all-4620
[ "SizeOfSlice", "returns", "the", "XDR", "encoded", "size", "of", "the", "given", "[]", "T", ".", "Supported", "types", "for", "T", "are", "string", "[]", "byte", "and", "types", "implementing", "XDRSizer", ".", "SizeOfSlice", "panics", "if", "the", "parameter", "is", "not", "a", "slice", "or", "if", "T", "is", "not", "one", "of", "the", "supported", "types", ".", "This", "function", "is", "used", "by", "the", "generated", "marshalling", "code", "." ]
[ "func", "SizeOfSlice", "(", "ss", "interface", "{", "}", ")", "int", "{", "l", ":=", "0", "\n", "switch", "ss", ":=", "ss", ".", "(", "<mask>", ")", "{", "case", "[", "]", "string", ":", "for", "_", ",", "s", ":=", "range", "ss", "{", "l", "+=", "4", "+", "len", "(", "s", ")", "+", "Padding", "(", "len", "(", "s", ")", ")", "\n", "}", "\n\n", "case", "[", "]", "[", "]", "byte", ":", "for", "_", ",", "s", ":=", "range", "ss", "{", "l", "+=", "4", "+", "len", "(", "s", ")", "+", "Padding", "(", "len", "(", "s", ")", ")", "\n", "}", "\n\n", "default", ":", "v", ":=", "reflect", ".", "ValueOf", "(", "ss", ")", "\n", "for", "i", ":=", "0", ";", "i", "<", "v", ".", "Len", "(", ")", ";", "i", "++", "{", "l", "+=", "v", ".", "Index", "(", "i", ")", ".", "Interface", "(", ")", ".", "(", "XDRSizer", ")", ".", "XDRSize", "(", ")", "\n", "}", "\n", "}", "\n\n", "return", "l", "\n", "}" ]
4,620
all-4621
[ "MoveToFolder", "is", "a", "complex", "method", "that", "moves", "a", "datastore", "to", "a", "given", "relative", "datastore", "folder", "path", ".", "Relative", "here", "means", "relative", "to", "a", "datacenter", "which", "is", "discovered", "from", "the", "current", "datastore", "path", "." ]
[ "func", "MoveToFolder", "(", "client", "*", "govmomi", ".", "<mask>", ",", "ds", "*", "object", ".", "Datastore", ",", "relative", "string", ")", "error", "{", "f", ",", "err", ":=", "folder", ".", "DatastoreFolderFromObject", "(", "client", ",", "ds", ",", "relative", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "return", "folder", ".", "MoveObjectTo", "(", "ds", ".", "Reference", "(", ")", ",", "f", ")", "\n", "}" ]
4,621
all-4622
[ "PutSecretValueWithContext", "mocks", "base", "method" ]
[ "func", "(", "m", "*", "MockSecretsManagerAPI", ")", "PutSecretValueWithContext", "(", "arg0", "aws", ".", "Context", ",", "arg1", "*", "secretsmanager", ".", "PutSecretValueInput", ",", "arg2", "...", "request", ".", "Option", ")", "(", "*", "secretsmanager", ".", "PutSecretValueOutput", ",", "error", ")", "{", "varargs", ":=", "[", "]", "<mask>", "{", "}", "{", "arg0", ",", "arg1", "}", "\n", "for", "_", ",", "a", ":=", "range", "arg2", "{", "varargs", "=", "append", "(", "varargs", ",", "a", ")", "\n", "}", "\n", "ret", ":=", "m", ".", "ctrl", ".", "Call", "(", "m", ",", "\"", "\"", ",", "varargs", "...", ")", "\n", "ret0", ",", "_", ":=", "ret", "[", "0", "]", ".", "(", "*", "secretsmanager", ".", "PutSecretValueOutput", ")", "\n", "ret1", ",", "_", ":=", "ret", "[", "1", "]", ".", "(", "error", ")", "\n", "return", "ret0", ",", "ret1", "\n", "}" ]
4,622
all-4623
[ "Use", "load", "to", "read", "a", ".", "gitattributes", "file", "and", "populate", "g", "with", "the", "commands", ".", "Each", "line", "in", "gitattributes", "file", "is", "of", "form", ":", "pattern", "attr1", "attr2", "...", "That", "is", "a", "pattern", "followed", "by", "an", "attributes", "list", "separated", "by", "whitespaces", "." ]
[ "func", "(", "g", "*", "<mask>", ")", "load", "(", "r", "io", ".", "Reader", ")", "error", "{", "s", ":=", "bufio", ".", "NewScanner", "(", "r", ")", "\n", "for", "s", ".", "Scan", "(", ")", "{", "// Leading and trailing whitespaces are ignored.", "l", ":=", "strings", ".", "TrimSpace", "(", "s", ".", "Text", "(", ")", ")", "\n", "// Lines that begin with # are ignored.", "if", "l", "==", "\"", "\"", "||", "l", "[", "0", "]", "==", "'#'", "{", "continue", "\n", "}", "\n\n", "fs", ":=", "strings", ".", "Fields", "(", "l", ")", "\n", "if", "len", "(", "fs", ")", "<", "2", "{", "continue", "\n", "}", "\n\n", "// When the pattern matches the path in question, the attributes listed on the line are given to the path.", "attributes", ":=", "sets", ".", "NewString", "(", "fs", "[", "1", ":", "]", "...", ")", "\n", "if", "attributes", ".", "Has", "(", "\"", "\"", ")", "{", "p", ",", "err", ":=", "parsePattern", "(", "fs", "[", "0", "]", ")", "\n", "if", "err", "!=", "nil", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "err", ")", "\n", "}", "\n", "g", ".", "LinguistGeneratedPatterns", "=", "append", "(", "g", ".", "LinguistGeneratedPatterns", ",", "p", ")", "\n", "}", "\n", "}", "\n\n", "if", "err", ":=", "s", ".", "Err", "(", ")", ";", "err", "!=", "nil", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "err", ")", "\n", "}", "\n\n", "return", "nil", "\n", "}" ]
4,623
all-4624
[ "Execute", "-", "deletes", "space", "from", "config" ]
[ "func", "(", "c", "*", "DeleteSpaceConfigurationCommand", ")", "Execute", "(", "[", "]", "string", ")", "<mask>", "{", "if", "err", ":=", "config", ".", "NewManager", "(", "c", ".", "ConfigDirectory", ")", ".", "DeleteSpaceConfig", "(", "c", ".", "OrgName", ",", "c", ".", "SpaceName", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "fmt", ".", "Printf", "(", "\"", "\"", ",", "c", ".", "OrgName", ",", "c", ".", "SpaceName", ")", "\n", "return", "nil", "\n", "}" ]
4,624
all-4625
[ "detectAttachmentHeader", "returns", "true", "if", "the", "given", "header", "defines", "an", "attachment", ".", "First", "it", "checks", "if", "the", "Content", "-", "Disposition", "header", "defines", "an", "attachement", "or", "inline", "attachment", ".", "If", "this", "test", "is", "false", "the", "Content", "-", "Type", "header", "is", "checked", "for", "attachment", "but", "not", "inline", ".", "Email", "clients", "use", "inline", "for", "their", "text", "bodies", ".", "Valid", "Attachment", "-", "Headers", ":", "-", "Content", "-", "Disposition", ":", "attachment", ";", "filename", "=", "frog", ".", "jpg", "-", "Content", "-", "Disposition", ":", "inline", ";", "filename", "=", "frog", ".", "jpg", "-", "Content", "-", "Type", ":", "attachment", ";", "filename", "=", "frog", ".", "jpg" ]
[ "func", "detectAttachmentHeader", "(", "header", "textproto", ".", "MIMEHeader", ")", "bool", "{", "mediatype", ",", "params", ",", "_", ",", "_", ":=", "parseMediaType", "(", "header", ".", "Get", "(", "hnContentDisposition", ")", ")", "\n", "if", "strings", ".", "ToLower", "(", "mediatype", ")", "==", "cdAttachment", "||", "(", "strings", ".", "ToLower", "(", "mediatype", ")", "==", "cdInline", "&&", "len", "(", "params", ")", ">", "0", ")", "{", "return", "true", "\n", "}", "\n\n", "mediatype", ",", "_", ",", "_", ",", "_", "=", "parseMediaType", "(", "<mask>", ".", "Get", "(", "hnContentType", ")", ")", "\n", "return", "strings", ".", "ToLower", "(", "mediatype", ")", "==", "cdAttachment", "\n", "}" ]
4,625
all-4626
[ "void", "pango_cairo_error_underline_path", "(", "cairo_t", "*", "cr", "double", "x", "double", "y", "double", "width", "double", "height", ")", ";" ]
[ "func", "CairoErrorUnderlinePath", "(", "cr", "*", "cairo", ".", "Context", ",", "x", ",", "y", ",", "width", ",", "height", "float64", ")", "{", "C", ".", "pango_cairo_error_underline_path", "(", "cairo_context", "(", "cr", ")", ",", "C", ".", "double", "(", "x", ")", ",", "C", ".", "double", "(", "y", ")", ",", "C", ".", "double", "(", "<mask>", ")", ",", "C", ".", "double", "(", "height", ")", ")", "\n", "}" ]
4,626
all-4627
[ "Do", "executes", "Runtime", ".", "globalLexicalScopeNames", "against", "the", "provided", "context", ".", "returns", ":", "names" ]
[ "func", "(", "p", "*", "GlobalLexicalScopeNamesParams", ")", "Do", "(", "ctx", "<mask>", ".", "Context", ")", "(", "names", "[", "]", "string", ",", "err", "error", ")", "{", "// execute", "var", "res", "GlobalLexicalScopeNamesReturns", "\n", "err", "=", "cdp", ".", "Execute", "(", "ctx", ",", "CommandGlobalLexicalScopeNames", ",", "p", ",", "&", "res", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "return", "res", ".", "Names", ",", "nil", "\n", "}" ]
4,627
all-4628
[ "UnmarshalText", "hydrates", "this", "instance", "from", "text" ]
[ "func", "(", "u", "*", "UUID5", ")", "UnmarshalText", "(", "data", "[", "]", "byte", ")", "error", "{", "// validation is performed later on", "*", "u", "=", "UUID5", "(", "string", "(", "<mask>", ")", ")", "\n", "return", "nil", "\n", "}" ]
4,628
all-4629
[ "Keep", "finds", "all", "revisions", "to", "be", "kept", "for", "a", "Compaction", "at", "the", "given", "rev", "." ]
[ "func", "(", "ti", "*", "treeIndex", ")", "Keep", "(", "rev", "int64", ")", "map", "[", "revision", "]", "struct", "{", "}", "{", "available", ":=", "make", "(", "map", "[", "revision", "]", "struct", "{", "}", ")", "\n", "ti", ".", "RLock", "(", ")", "\n", "defer", "ti", ".", "RUnlock", "(", ")", "\n", "ti", ".", "tree", ".", "Ascend", "(", "func", "(", "i", "btree", ".", "Item", ")", "bool", "{", "keyi", ":=", "i", ".", "(", "*", "keyIndex", ")", "\n", "keyi", ".", "keep", "(", "<mask>", ",", "available", ")", "\n", "return", "true", "\n", "}", ")", "\n", "return", "available", "\n", "}" ]
4,629
all-4630
[ "Bucket", "returns", "a", "bucket", "on", "s3", "Bucket", "Config", "is", "initialized", "to", "DefaultConfig" ]
[ "func", "(", "s", "*", "S3", ")", "Bucket", "(", "<mask>", "string", ")", "*", "Bucket", "{", "return", "&", "Bucket", "{", "S3", ":", "s", ",", "Name", ":", "name", ",", "Config", ":", "DefaultConfig", ",", "}", "\n", "}" ]
4,630
all-4631
[ "UponReceiving", "specifies", "the", "name", "of", "the", "test", "case", ".", "This", "becomes", "the", "name", "of", "the", "consumer", "/", "provider", "pair", "in", "the", "Pact", "file", ".", "Mandatory", "." ]
[ "func", "(", "i", "*", "Interaction", ")", "UponReceiving", "(", "<mask>", "string", ")", "*", "Interaction", "{", "i", ".", "Description", "=", "description", "\n\n", "return", "i", "\n", "}" ]
4,631
all-4632
[ "InspectImage", "mocks", "base", "method" ]
[ "func", "(", "m", "*", "MockDockerClient", ")", "InspectImage", "(", "arg0", "string", ")", "(", "*", "types", ".", "ImageInspect", ",", "error", ")", "{", "<mask>", ":=", "m", ".", "ctrl", ".", "Call", "(", "m", ",", "\"", "\"", ",", "arg0", ")", "\n", "ret0", ",", "_", ":=", "ret", "[", "0", "]", ".", "(", "*", "types", ".", "ImageInspect", ")", "\n", "ret1", ",", "_", ":=", "ret", "[", "1", "]", ".", "(", "error", ")", "\n", "return", "ret0", ",", "ret1", "\n", "}" ]
4,632
all-4633
[ "NewMockBackoff", "creates", "a", "new", "mock", "instance" ]
[ "func", "NewMockBackoff", "(", "ctrl", "*", "gomock", ".", "<mask>", ")", "*", "MockBackoff", "{", "mock", ":=", "&", "MockBackoff", "{", "ctrl", ":", "ctrl", "}", "\n", "mock", ".", "recorder", "=", "&", "MockBackoffMockRecorder", "{", "mock", "}", "\n", "return", "mock", "\n", "}" ]
4,633
all-4634
[ "SetHeader", "is", "a", "wrapper", "around", "gtk_list_box_row_get_header", "()", "." ]
[ "func", "(", "v", "*", "ListBoxRow", ")", "SetHeader", "(", "<mask>", "IWidget", ")", "{", "C", ".", "gtk_list_box_row_set_header", "(", "v", ".", "native", "(", ")", ",", "header", ".", "toWidget", "(", ")", ")", "\n", "}" ]
4,634
all-4635
[ "expandDVSSecurityPolicy", "reads", "certain", "ResourceData", "keys", "and", "returns", "a", "DVSSecurityPolicy", "." ]
[ "func", "expandDVSSecurityPolicy", "(", "d", "*", "schema", ".", "ResourceData", ")", "*", "types", ".", "DVSSecurityPolicy", "{", "obj", ":=", "&", "<mask>", ".", "DVSSecurityPolicy", "{", "AllowPromiscuous", ":", "structure", ".", "GetBoolPolicy", "(", "d", ",", "\"", "\"", ")", ",", "MacChanges", ":", "structure", ".", "GetBoolPolicy", "(", "d", ",", "\"", "\"", ")", ",", "ForgedTransmits", ":", "structure", ".", "GetBoolPolicy", "(", "d", ",", "\"", "\"", ")", ",", "}", "\n\n", "if", "structure", ".", "AllFieldsEmpty", "(", "obj", ")", "{", "return", "nil", "\n", "}", "\n", "return", "obj", "\n", "}" ]
4,635
all-4636
[ "MarshalJSON", "overrides", "the", "logic", "for", "JSON", "-", "encoding", "the", "ContainerHealthStatus", "type" ]
[ "func", "(", "healthStatus", "*", "ContainerHealthStatus", ")", "MarshalJSON", "(", ")", "(", "[", "]", "<mask>", ",", "error", ")", "{", "if", "healthStatus", "==", "nil", "{", "return", "nil", ",", "nil", "\n", "}", "\n", "return", "[", "]", "byte", "(", "`\"`", "+", "healthStatus", ".", "String", "(", ")", "+", "`\"`", ")", ",", "nil", "\n", "}" ]
4,636
all-4637
[ "GetGroupOk", "returns", "a", "tuple", "with", "the", "Group", "field", "if", "it", "s", "non", "-", "nil", "zero", "value", "otherwise", "and", "a", "boolean", "to", "check", "if", "the", "value", "has", "been", "set", "." ]
[ "func", "(", "c", "*", "CheckStatusDefinition", ")", "GetGroupOk", "(", ")", "(", "string", ",", "bool", ")", "{", "if", "c", "==", "nil", "||", "c", ".", "Group", "==", "nil", "{", "return", "\"", "\"", ",", "<mask>", "\n", "}", "\n", "return", "*", "c", ".", "Group", ",", "true", "\n", "}" ]
4,637
all-4638
[ "getGitHubClient", "create", "the", "github", "client", "that", "we", "use", "to", "communicate", "with", "github" ]
[ "func", "(", "client", "*", "Client", ")", "getGitHubClient", "(", ")", "(", "*", "github", ".", "Client", ",", "error", ")", "{", "if", "client", ".", "githubClient", "!=", "nil", "{", "return", "client", ".", "githubClient", ",", "nil", "\n", "}", "\n", "token", ":=", "client", ".", "Token", "\n", "if", "len", "(", "token", ")", "==", "0", "&&", "len", "(", "client", ".", "TokenFile", ")", "!=", "0", "{", "data", ",", "err", ":=", "ioutil", ".", "ReadFile", "(", "client", ".", "TokenFile", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "token", "=", "strings", ".", "TrimSpace", "(", "string", "(", "data", ")", ")", "\n", "}", "\n\n", "if", "len", "(", "<mask>", ")", ">", "0", "{", "ts", ":=", "oauth2", ".", "StaticTokenSource", "(", "&", "oauth2", ".", "Token", "{", "AccessToken", ":", "token", "}", ")", "\n", "tc", ":=", "oauth2", ".", "NewClient", "(", "oauth2", ".", "NoContext", ",", "ts", ")", "\n", "client", ".", "githubClient", "=", "github", ".", "NewClient", "(", "tc", ")", "\n", "}", "else", "{", "client", ".", "githubClient", "=", "github", ".", "NewClient", "(", "nil", ")", "\n", "}", "\n", "return", "client", ".", "githubClient", ",", "nil", "\n", "}" ]
4,638
all-4639
[ "Vec2", "functions", "Vec2Add", "performs", "a", "vector", "addition", ".", "dest", "=", "v1", "+", "v2", "dest", "[", "out", "]", "The", "result", "vector", ".", "v1", "[", "in", "]", "The", "base", "vector", ".", "v2", "[", "in", "]", "The", "vector", "to", "add", "to", "v1", "." ]
[ "func", "Vec2Add", "(", "dest", ",", "v1", ",", "v2", "Vec2", ")", "{", "<mask>", "[", "0", "]", "=", "v1", "[", "0", "]", "+", "v2", "[", "0", "]", "\n", "dest", "[", "1", "]", "=", "v1", "[", "1", "]", "+", "v2", "[", "1", "]", "\n", "}" ]
4,639
all-4640
[ "countUses", "returns", "the", "number", "of", "uses", "of", "the", "identifier", "x", "in", "scope", "." ]
[ "func", "countUses", "(", "x", "*", "ast", ".", "Ident", ",", "scope", "[", "]", "ast", ".", "Stmt", ")", "int", "{", "count", ":=", "0", "\n", "ff", ":=", "func", "(", "n", "interface", "{", "}", ")", "{", "if", "n", ",", "ok", ":=", "n", ".", "(", "ast", ".", "Node", ")", ";", "ok", "&&", "refersTo", "(", "n", ",", "x", ")", "{", "count", "++", "\n", "}", "\n", "}", "\n", "for", "_", ",", "n", ":=", "<mask>", "scope", "{", "walk", "(", "n", ",", "ff", ")", "\n", "}", "\n", "return", "count", "\n", "}" ]
4,640
all-4641
[ "RecordKnownLocation", "records", "that", "a", "blob", "with", "the", "specified", "digest", "exists", "within", "the", "specified", "(", "transport", "scope", ")", "scope", "and", "can", "be", "reused", "given", "the", "opaque", "location", "data", "." ]
[ "func", "(", "mem", "*", "cache", ")", "RecordKnownLocation", "(", "transport", "types", ".", "ImageTransport", ",", "scope", "<mask>", ".", "BICTransportScope", ",", "blobDigest", "digest", ".", "Digest", ",", "location", "types", ".", "BICLocationReference", ")", "{", "mem", ".", "mutex", ".", "Lock", "(", ")", "\n", "defer", "mem", ".", "mutex", ".", "Unlock", "(", ")", "\n", "key", ":=", "locationKey", "{", "transport", ":", "transport", ".", "Name", "(", ")", ",", "scope", ":", "scope", ",", "blobDigest", ":", "blobDigest", "}", "\n", "locationScope", ",", "ok", ":=", "mem", ".", "knownLocations", "[", "key", "]", "\n", "if", "!", "ok", "{", "locationScope", "=", "map", "[", "types", ".", "BICLocationReference", "]", "time", ".", "Time", "{", "}", "\n", "mem", ".", "knownLocations", "[", "key", "]", "=", "locationScope", "\n", "}", "\n", "locationScope", "[", "location", "]", "=", "time", ".", "Now", "(", ")", "// Possibly overwriting an older entry.", "\n", "}" ]
4,641
all-4642
[ "Send", "sends", "an", "HTTP", "request", "and", "returns", "a", "server", "response", "." ]
[ "func", "Send", "(", "req", "*", "<mask>", ".", "Request", ")", "(", "*", "Response", ",", "error", ")", "{", "client", ":=", "&", "http", ".", "Client", "{", "}", "\n\n", "resp", ",", "err", ":=", "client", ".", "Do", "(", "req", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "defer", "resp", ".", "Body", ".", "Close", "(", ")", "\n\n", "var", "resp2", "Response", "\n", "if", "err", "=", "json", ".", "NewDecoder", "(", "resp", ".", "Body", ")", ".", "Decode", "(", "&", "resp2", ")", ";", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "return", "&", "resp2", ",", "nil", "\n", "}" ]
4,642
all-4643
[ "putFile", "puts", "a", "file", "with", "random", "contents", "into", "a", "random", "open", "commit", "(", "or", "exits", "early", "if", "there", "are", "none", ")" ]
[ "func", "(", "w", "*", "worker", ")", "putFile", "(", "c", "*", "client", ".", "APIClient", ")", "error", "{", "if", "len", "(", "w", ".", "started", ")", "==", "0", "{", "return", "nil", "\n", "}", "\n", "commit", ":=", "w", ".", "started", "[", "w", ".", "rand", ".", "Intn", "(", "len", "(", "w", ".", "started", ")", ")", "]", "\n", "if", "_", ",", "err", ":=", "c", ".", "PutFile", "(", "<mask>", ".", "Repo", ".", "Name", ",", "commit", ".", "ID", ",", "w", ".", "randString", "(", "10", ")", ",", "w", ".", "reader", "(", ")", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "return", "nil", "\n", "}" ]
4,643
all-4644
[ "SetRequestURIBytes", "sets", "RequestURI", "for", "the", "first", "HTTP", "request", "line", ".", "RequestURI", "must", "be", "properly", "encoded", ".", "Use", "URI", ".", "RequestURI", "for", "constructing", "proper", "RequestURI", "if", "unsure", "." ]
[ "func", "(", "h", "*", "RequestHeader", ")", "SetRequestURIBytes", "(", "requestURI", "[", "]", "byte", ")", "{", "h", ".", "requestURI", "=", "<mask>", "(", "h", ".", "requestURI", "[", ":", "0", "]", ",", "requestURI", "...", ")", "\n", "}" ]
4,644
all-4645
[ "SetPageTitle", "is", "a", "wrapper", "around", "gtk_assistant_set_page_title", "()", "." ]
[ "func", "(", "v", "*", "Assistant", ")", "SetPageTitle", "(", "<mask>", "IWidget", ",", "title", "string", ")", "{", "cstr", ":=", "C", ".", "CString", "(", "title", ")", "\n", "defer", "C", ".", "free", "(", "unsafe", ".", "Pointer", "(", "cstr", ")", ")", "\n", "C", ".", "gtk_assistant_set_page_title", "(", "v", ".", "native", "(", ")", ",", "page", ".", "toWidget", "(", ")", ",", "(", "*", "C", ".", "gchar", ")", "(", "cstr", ")", ")", "\n", "}" ]
4,645
all-4646
[ "failed", "marks", "the", "writer", "as", "having", "failed" ]
[ "func", "(", "w", "*", "reqResWriter", ")", "failed", "(", "err", "error", ")", "error", "{", "w", ".", "<mask>", ".", "Debugf", "(", "\"", "\"", ",", "err", ",", "w", ".", "err", ")", "\n", "if", "w", ".", "err", "!=", "nil", "{", "return", "w", ".", "err", "\n", "}", "\n\n", "w", ".", "mex", ".", "shutdown", "(", ")", "\n", "w", ".", "err", "=", "err", "\n", "return", "w", ".", "err", "\n", "}" ]
4,646
all-4647
[ "resourceVSphereDatastoreClusterVMAntiAffinityRuleFetchObjects", "fetches", "the", "objects", "for", "a", "cluster", "rule", ".", "This", "is", "currently", "just", "the", "cluster", "object", "as", "the", "rule", "key", "a", "static", "value", "and", "a", "pass", "-", "through", "-", "this", "is", "to", "keep", "its", "workflow", "consistent", "with", "other", "cluster", "-", "dependent", "resources", "that", "derive", "from", "ArrayUpdateSpec", "that", "have", "managed", "object", "as", "keys", "such", "as", "VM", "and", "host", "overrides", "." ]
[ "func", "resourceVSphereDatastoreClusterVMAntiAffinityRuleFetchObjects", "(", "meta", "interface", "{", "}", ",", "podID", "string", ",", "key", "int32", ",", ")", "(", "*", "object", ".", "StoragePod", ",", "int32", ",", "error", ")", "{", "<mask>", ",", "err", ":=", "resourceVSphereDatastoreClusterVMAntiAffinityRuleClient", "(", "meta", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "0", ",", "err", "\n", "}", "\n\n", "pod", ",", "err", ":=", "storagepod", ".", "FromID", "(", "client", ",", "podID", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "0", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "err", ")", "\n", "}", "\n\n", "return", "pod", ",", "key", ",", "nil", "\n", "}" ]
4,647
all-4648
[ "GetNextAlertsInRange", "retrieves", "the", "page", "at", "the", "nextPageURI", "and", "continues", "retrieving", "pages", "until", "any", "results", "are", "found", "in", "the", "range", "given", "by", "start", "or", "end", "or", "we", "determine", "there", "are", "no", "more", "records", "to", "be", "found", "in", "that", "range", ".", "If", "AlertPage", "is", "non", "-", "nil", "it", "will", "have", "at", "least", "one", "result", "." ]
[ "func", "(", "a", "*", "AlertService", ")", "GetNextAlertsInRange", "(", "start", "time", ".", "Time", ",", "end", "time", ".", "Time", ",", "nextPageURI", "string", ")", "AlertPageIterator", "{", "if", "nextPageURI", "==", "\"", "\"", "{", "panic", "(", "\"", "\"", ")", "\n", "}", "\n", "iter", ":=", "NewNextPageIterator", "(", "a", ".", "client", ",", "callsPathPart", ")", "\n", "iter", ".", "SetNextPageURI", "(", "types", ".", "NullString", "{", "Valid", ":", "true", ",", "String", ":", "nextPageURI", "}", ")", "\n", "return", "&", "alertDateIterator", "{", "start", ":", "<mask>", ",", "end", ":", "end", ",", "p", ":", "iter", ",", "}", "\n", "}" ]
4,648
all-4649
[ "handleCallReqContinue", "handles", "the", "continuation", "of", "a", "call", "request", "forwarding", "it", "to", "the", "request", "channel", "for", "that", "request", "where", "it", "can", "be", "pulled", "during", "defragmentation" ]
[ "func", "(", "c", "*", "Connection", ")", "handleCallReqContinue", "(", "<mask>", "*", "Frame", ")", "bool", "{", "if", "err", ":=", "c", ".", "inbound", ".", "forwardPeerFrame", "(", "frame", ")", ";", "err", "!=", "nil", "{", "// If forward fails, it's due to a timeout. We can free this frame.", "return", "true", "\n", "}", "\n", "return", "false", "\n", "}" ]
4,649
all-4650
[ "NewAuthServer", "returns", "an", "implementation", "of", "authclient", ".", "APIServer", "." ]
[ "func", "NewAuthServer", "(", "env", "*", "serviceenv", ".", "ServiceEnv", ",", "etcdPrefix", "string", ",", "public", "bool", ")", "(", "authclient", ".", "APIServer", ",", "error", ")", "{", "s", ":=", "&", "apiServer", "{", "env", ":", "env", ",", "pachLogger", ":", "log", ".", "NewLogger", "(", "\"", "\"", ")", ",", "adminCache", ":", "make", "(", "map", "[", "string", "]", "struct", "{", "}", ")", ",", "tokens", ":", "col", ".", "NewCollection", "(", "env", ".", "GetEtcdClient", "(", ")", ",", "path", ".", "Join", "(", "etcdPrefix", ",", "tokensPrefix", ")", ",", "nil", ",", "&", "authclient", ".", "TokenInfo", "{", "}", ",", "nil", ",", "nil", ",", ")", ",", "authenticationCodes", ":", "col", ".", "NewCollection", "(", "env", ".", "GetEtcdClient", "(", ")", ",", "path", ".", "Join", "(", "etcdPrefix", ",", "authenticationCodesPrefix", ")", ",", "nil", ",", "&", "authclient", ".", "OTPInfo", "{", "}", ",", "nil", ",", "nil", ",", ")", ",", "acls", ":", "col", ".", "NewCollection", "(", "env", ".", "GetEtcdClient", "(", ")", ",", "path", ".", "Join", "(", "etcdPrefix", ",", "aclsPrefix", ")", ",", "nil", ",", "&", "authclient", ".", "ACL", "{", "}", ",", "nil", ",", "nil", ",", ")", ",", "admins", ":", "col", ".", "NewCollection", "(", "env", ".", "GetEtcdClient", "(", ")", ",", "path", ".", "Join", "(", "etcdPrefix", ",", "adminsPrefix", ")", ",", "nil", ",", "&", "types", ".", "BoolValue", "{", "}", ",", "// smallest value that etcd actually stores", "nil", ",", "nil", ",", ")", ",", "members", ":", "col", ".", "NewCollection", "(", "env", ".", "GetEtcdClient", "(", ")", ",", "path", ".", "Join", "(", "etcdPrefix", ",", "membersPrefix", ")", ",", "nil", ",", "&", "authclient", ".", "Groups", "{", "}", ",", "nil", ",", "nil", ",", ")", ",", "groups", ":", "col", ".", "NewCollection", "(", "env", ".", "GetEtcdClient", "(", ")", ",", "path", ".", "Join", "(", "etcdPrefix", ",", "groupsPrefix", ")", ",", "nil", ",", "&", "authclient", ".", "Users", "{", "}", ",", "nil", ",", "nil", ",", ")", ",", "authConfig", ":", "col", ".", "NewCollection", "(", "env", ".", "GetEtcdClient", "(", ")", ",", "path", ".", "Join", "(", "etcdPrefix", ",", "configKey", ")", ",", "nil", ",", "&", "authclient", ".", "AuthConfig", "{", "}", ",", "nil", ",", "nil", ",", ")", ",", "public", ":", "public", ",", "}", "\n", "go", "s", ".", "retrieveOrGeneratePPSToken", "(", ")", "\n", "go", "s", ".", "watchAdmins", "(", "<mask>", ".", "Join", "(", "etcdPrefix", ",", "adminsPrefix", ")", ")", "\n\n", "if", "public", "{", "// start SAML service (won't respond to", "// anything until config is set)", "go", "s", ".", "serveSAML", "(", ")", "\n", "}", "\n", "// Watch for new auth config options", "go", "s", ".", "watchConfig", "(", ")", "\n", "return", "s", ",", "nil", "\n", "}" ]
4,650
all-4651
[ "PowerOff", "powers", "off", "a", "virtual", "machine", ".", "Parameters", ":", "options", ":", "Set", "of", "VMPowerOption", "flags", "to", "consider", "when", "powering", "off", "the", "virtual", "machine", ".", "Remarks", ":", "*", "If", "you", "call", "this", "function", "while", "the", "virtual", "machine", "is", "suspended", "or", "powered", "off", "the", "operation", "returns", "a", "VIX_E_VM_NOT_RUNNING", "error", ".", "If", "suspended", "the", "virtual", "machine", "remains", "suspended", "and", "is", "not", "powered", "off", ".", "If", "powered", "off", "you", "can", "safely", "ignore", "the", "error", ".", "*", "If", "you", "pass", "VMPOWEROP_NORMAL", "as", "an", "option", "the", "virtual", "machine", "is", "powered", "off", "at", "the", "hardware", "level", ".", "Any", "state", "of", "the", "guest", "that", "was", "not", "committed", "to", "disk", "will", "be", "lost", ".", "*", "If", "you", "pass", "VMPOWEROP_FROM_GUEST", "as", "an", "option", "the", "function", "tries", "to", "power", "off", "the", "guest", "OS", "ensuring", "a", "clean", "shutdown", "of", "the", "guest", ".", "This", "option", "requires", "that", "VMware", "Tools", "be", "installed", "and", "running", "in", "the", "guest", ".", "*", "After", "VMware", "Tools", "begin", "running", "in", "the", "guest", "and", "VM", ".", "WaitForToolsInGuest", "()", "returns", "there", "is", "a", "short", "delay", "before", "VMPOWEROP_FROM_GUEST", "becomes", "available", ".", "During", "this", "time", "a", "job", "may", "return", "error", "3009", "VIX_E_POWEROP_SCRIPTS_NOT_AVAILABLE", ".", "As", "a", "workaround", "add", "a", "short", "sleep", "after", "the", "WaitForTools", "call", ".", "*", "On", "a", "Solaris", "guest", "with", "UFS", "file", "system", "on", "the", "root", "partition", "the", "VMPOWEROP_NORMAL", "parameter", "causes", "an", "error", "screen", "at", "next", "power", "on", "which", "requires", "user", "intervention", "to", "update", "the", "Solaris", "boot", "archive", "by", "logging", "into", "the", "failsafe", "boot", "session", "from", "the", "GRUB", "menu", ".", "Hence", "although", "UFS", "file", "systems", "are", "supported", "VMware", "recommends", "using", "the", "ZFS", "file", "system", "for", "Solaris", "guests", ".", "Since", "VMware", "Server", "1", ".", "0" ]
[ "func", "(", "v", "*", "VM", ")", "PowerOff", "(", "options", "VMPowerOption", ")", "error", "{", "<mask>", "jobHandle", "C", ".", "VixHandle", "=", "C", ".", "VIX_INVALID_HANDLE", "\n", "var", "err", "C", ".", "VixError", "=", "C", ".", "VIX_OK", "\n\n", "jobHandle", "=", "C", ".", "VixVM_PowerOff", "(", "v", ".", "handle", ",", "C", ".", "VixVMPowerOpOptions", "(", "options", ")", ",", "// powerOptions,", "nil", ",", "// callbackProc,", "nil", ")", "// clientData", "\n\n", "defer", "C", ".", "Vix_ReleaseHandle", "(", "jobHandle", ")", "\n\n", "err", "=", "C", ".", "vix_job_wait", "(", "jobHandle", ")", "\n", "if", "C", ".", "VIX_OK", "!=", "err", "{", "return", "&", "Error", "{", "Operation", ":", "\"", "\"", ",", "Code", ":", "int", "(", "err", "&", "0xFFFF", ")", ",", "Text", ":", "C", ".", "GoString", "(", "C", ".", "Vix_GetErrorText", "(", "err", ",", "nil", ")", ")", ",", "}", "\n", "}", "\n\n", "return", "nil", "\n", "}" ]
4,651
all-4652
[ "CallerStackHandler", "returns", "a", "Handler", "that", "adds", "a", "stack", "trace", "to", "the", "context", "with", "key", "stack", ".", "The", "stack", "trace", "is", "formated", "as", "a", "space", "separated", "list", "of", "call", "sites", "inside", "matching", "[]", "s", ".", "The", "most", "recent", "call", "site", "is", "listed", "first", ".", "Each", "call", "site", "is", "formatted", "according", "to", "format", ".", "See", "the", "documentation", "of", "log15", "/", "stack", ".", "Call", ".", "Format", "for", "the", "list", "of", "supported", "formats", "." ]
[ "func", "CallerStackHandler", "(", "format", "string", ",", "h", "Handler", ")", "<mask>", "{", "return", "FuncHandler", "(", "func", "(", "r", "*", "Record", ")", "error", "{", "s", ":=", "stack", ".", "Callers", "(", ")", ".", "TrimBelow", "(", "stack", ".", "Call", "(", "r", ".", "CallPC", "[", "0", "]", ")", ")", ".", "TrimRuntime", "(", ")", "\n", "if", "len", "(", "s", ")", ">", "0", "{", "buf", ":=", "&", "bytes", ".", "Buffer", "{", "}", "\n", "buf", ".", "WriteByte", "(", "'['", ")", "\n", "for", "i", ",", "pc", ":=", "range", "s", "{", "if", "i", ">", "0", "{", "buf", ".", "WriteByte", "(", "' '", ")", "\n", "}", "\n", "fmt", ".", "Fprintf", "(", "buf", ",", "format", ",", "pc", ")", "\n", "}", "\n", "buf", ".", "WriteByte", "(", "']'", ")", "\n", "r", ".", "Ctx", "=", "append", "(", "r", ".", "Ctx", ",", "\"", "\"", ",", "buf", ".", "String", "(", ")", ")", "\n", "}", "\n", "return", "h", ".", "Log", "(", "r", ")", "\n", "}", ")", "\n", "}" ]
4,652
all-4653
[ "Locator", "returns", "a", "locator", "for", "the", "given", "resource" ]
[ "func", "(", "r", "*", "SshKey", ")", "Locator", "(", "api", "*", "API", ")", "*", "SshKeyLocator", "{", "for", "_", ",", "l", ":=", "<mask>", "r", ".", "Links", "{", "if", "l", "[", "\"", "\"", "]", "==", "\"", "\"", "{", "return", "api", ".", "SshKeyLocator", "(", "l", "[", "\"", "\"", "]", ")", "\n", "}", "\n", "}", "\n", "return", "nil", "\n", "}" ]
4,653
all-4654
[ "nextVolName", "updates", "name", "to", "the", "next", "filename", "in", "the", "archive", "." ]
[ "func", "(", "v", "*", "volume", ")", "nextVolName", "(", ")", "{", "if", "v", ".", "num", "==", "0", "{", "// check file extensions", "i", ":=", "strings", ".", "LastIndex", "(", "v", ".", "file", ",", "\"", "\"", ")", "\n", "if", "i", "<", "0", "{", "// no file extension, add one", "i", "=", "len", "(", "v", ".", "file", ")", "\n", "v", ".", "<mask>", "+=", "\"", "\"", "\n", "}", "else", "{", "ext", ":=", "strings", ".", "ToLower", "(", "v", ".", "file", "[", "i", "+", "1", ":", "]", ")", "\n", "// replace with .rar for empty extensions & self extracting archives", "if", "ext", "==", "\"", "\"", "||", "ext", "==", "\"", "\"", "||", "ext", "==", "\"", "\"", "{", "v", ".", "file", "=", "v", ".", "file", "[", ":", "i", "+", "1", "]", "+", "\"", "\"", "\n", "}", "\n", "}", "\n", "if", "a", ",", "ok", ":=", "v", ".", "fileBlockReader", ".", "(", "*", "archive15", ")", ";", "ok", "{", "v", ".", "old", "=", "a", ".", "old", "\n", "}", "\n", "// new naming scheme must have volume number in filename", "if", "!", "v", ".", "old", "&&", "reDigits", ".", "FindStringIndex", "(", "v", ".", "file", ")", "==", "nil", "{", "v", ".", "old", "=", "true", "\n", "}", "\n", "// For old style naming if 2nd and 3rd character of file extension is not a digit replace", "// with \"00\" and ignore any trailing characters.", "if", "v", ".", "old", "&&", "(", "len", "(", "v", ".", "file", ")", "<", "i", "+", "4", "||", "v", ".", "file", "[", "i", "+", "2", "]", "<", "'0'", "||", "v", ".", "file", "[", "i", "+", "2", "]", ">", "'9'", "||", "v", ".", "file", "[", "i", "+", "3", "]", "<", "'0'", "||", "v", ".", "file", "[", "i", "+", "3", "]", ">", "'9'", ")", "{", "v", ".", "file", "=", "v", ".", "file", "[", ":", "i", "+", "2", "]", "+", "\"", "\"", "\n", "return", "\n", "}", "\n", "}", "\n", "// new style volume naming", "if", "!", "v", ".", "old", "{", "// find all numbers in volume name", "m", ":=", "reDigits", ".", "FindAllStringIndex", "(", "v", ".", "file", ",", "-", "1", ")", "\n", "if", "l", ":=", "len", "(", "m", ")", ";", "l", ">", "1", "{", "// More than 1 match so assume name.part###of###.rar style.", "// Take the last 2 matches where the first is the volume number.", "m", "=", "m", "[", "l", "-", "2", ":", "l", "]", "\n", "if", "strings", ".", "Contains", "(", "v", ".", "file", "[", "m", "[", "0", "]", "[", "1", "]", ":", "m", "[", "1", "]", "[", "0", "]", "]", ",", "\"", "\"", ")", "||", "!", "strings", ".", "Contains", "(", "v", ".", "file", "[", ":", "m", "[", "0", "]", "[", "0", "]", "]", ",", "\"", "\"", ")", "{", "// Didn't match above style as volume had '.' between the two numbers or didnt have a '.'", "// before the first match. Use the second number as volume number.", "m", "=", "m", "[", "1", ":", "]", "\n", "}", "\n", "}", "\n", "// extract and increment volume number", "lo", ",", "hi", ":=", "m", "[", "0", "]", "[", "0", "]", ",", "m", "[", "0", "]", "[", "1", "]", "\n", "n", ",", "err", ":=", "strconv", ".", "Atoi", "(", "v", ".", "file", "[", "lo", ":", "hi", "]", ")", "\n", "if", "err", "!=", "nil", "{", "n", "=", "0", "\n", "}", "else", "{", "n", "++", "\n", "}", "\n", "// volume number must use at least the same number of characters as previous volume", "vol", ":=", "fmt", ".", "Sprintf", "(", "\"", "\"", "+", "fmt", ".", "Sprint", "(", "hi", "-", "lo", ")", "+", "\"", "\"", ",", "n", ")", "\n", "v", ".", "file", "=", "v", ".", "file", "[", ":", "lo", "]", "+", "vol", "+", "v", ".", "file", "[", "hi", ":", "]", "\n", "return", "\n", "}", "\n", "// old style volume naming", "i", ":=", "strings", ".", "LastIndex", "(", "v", ".", "file", ",", "\"", "\"", ")", "\n", "// get file extension", "b", ":=", "[", "]", "byte", "(", "v", ".", "file", "[", "i", "+", "1", ":", "]", ")", "\n", "// start incrementing volume number digits from rightmost", "for", "j", ":=", "2", ";", "j", ">=", "0", ";", "j", "--", "{", "if", "b", "[", "j", "]", "!=", "'9'", "{", "b", "[", "j", "]", "++", "\n", "break", "\n", "}", "\n", "// digit overflow", "if", "j", "==", "0", "{", "// last character before '.'", "b", "[", "j", "]", "=", "'A'", "\n", "}", "else", "{", "// set to '0' and loop to next character", "b", "[", "j", "]", "=", "'0'", "\n", "}", "\n", "}", "\n", "v", ".", "file", "=", "v", ".", "file", "[", ":", "i", "+", "1", "]", "+", "string", "(", "b", ")", "\n", "}" ]
4,654
all-4655
[ "MarshalEasyJSON", "writes", "the", "IPv6", "to", "a", "easyjson", ".", "Writer" ]
[ "func", "(", "u", "IPv6", ")", "MarshalEasyJSON", "(", "w", "*", "jwriter", ".", "<mask>", ")", "{", "w", ".", "String", "(", "string", "(", "u", ")", ")", "\n", "}" ]
4,655
all-4656
[ "RouteTableLocator", "builds", "a", "locator", "from", "the", "given", "href", "." ]
[ "func", "(", "api", "*", "API", ")", "RouteTableLocator", "(", "href", "<mask>", ")", "*", "RouteTableLocator", "{", "return", "&", "RouteTableLocator", "{", "Href", "(", "href", ")", ",", "api", "}", "\n", "}" ]
4,656
all-4657
[ "/", "*", "Allocates", "and", "initalizes", "CvMat", "header" ]
[ "func", "CreateMatHeader", "(", "<mask>", ",", "cols", ",", "type_", "int", ")", "*", "Mat", "{", "mat", ":=", "C", ".", "cvCreateMatHeader", "(", "C", ".", "int", "(", "rows", ")", ",", "C", ".", "int", "(", "cols", ")", ",", "C", ".", "int", "(", "type_", ")", ",", ")", "\n", "return", "(", "*", "Mat", ")", "(", "mat", ")", "\n", "}" ]
4,657
all-4658
[ "ReachabilityTo", "checks", "whenever", "o", "can", "be", "reached", "from", "na", "." ]
[ "func", "(", "na", "*", "NetAddress", ")", "ReachabilityTo", "(", "o", "*", "NetAddress", ")", "int", "{", "const", "(", "Unreachable", "=", "0", "\n", "<mask>", "=", "iota", "\n", "Teredo", "\n", "Ipv6_weak", "\n", "Ipv4", "\n", "Ipv6_strong", "\n", "Private", "\n", ")", "\n", "if", "!", "na", ".", "Routable", "(", ")", "{", "return", "Unreachable", "\n", "}", "else", "if", "na", ".", "RFC4380", "(", ")", "{", "if", "!", "o", ".", "Routable", "(", ")", "{", "return", "Default", "\n", "}", "else", "if", "o", ".", "RFC4380", "(", ")", "{", "return", "Teredo", "\n", "}", "else", "if", "o", ".", "IP", ".", "To4", "(", ")", "!=", "nil", "{", "return", "Ipv4", "\n", "}", "else", "{", "// ipv6", "return", "Ipv6_weak", "\n", "}", "\n", "}", "else", "if", "na", ".", "IP", ".", "To4", "(", ")", "!=", "nil", "{", "if", "o", ".", "Routable", "(", ")", "&&", "o", ".", "IP", ".", "To4", "(", ")", "!=", "nil", "{", "return", "Ipv4", "\n", "}", "\n", "return", "Default", "\n", "}", "else", "/* ipv6 */", "{", "var", "tunnelled", "bool", "\n", "// Is our v6 is tunnelled?", "if", "o", ".", "RFC3964", "(", ")", "||", "o", ".", "RFC6052", "(", ")", "||", "o", ".", "RFC6145", "(", ")", "{", "tunnelled", "=", "true", "\n", "}", "\n", "if", "!", "o", ".", "Routable", "(", ")", "{", "return", "Default", "\n", "}", "else", "if", "o", ".", "RFC4380", "(", ")", "{", "return", "Teredo", "\n", "}", "else", "if", "o", ".", "IP", ".", "To4", "(", ")", "!=", "nil", "{", "return", "Ipv4", "\n", "}", "else", "if", "tunnelled", "{", "// only prioritise ipv6 if we aren't tunnelling it.", "return", "Ipv6_weak", "\n", "}", "\n", "return", "Ipv6_strong", "\n", "}", "\n", "}" ]
4,658
all-4659
[ "flattenDvsHostInfrastructureTrafficResource", "reads", "various", "fields", "from", "a", "DvsHostInfrastructureTrafficResource", "and", "sets", "appropriate", "keys", "in", "the", "supplied", "ResourceData", "." ]
[ "func", "flattenDvsHostInfrastructureTrafficResource", "(", "d", "*", "schema", ".", "ResourceData", ",", "obj", "types", ".", "DvsHostInfrastructureTrafficResource", ",", "key", "string", ")", "error", "{", "shareLevelKey", ":=", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "strings", ".", "ToLower", "(", "key", ")", ")", "\n", "shareCountKey", ":=", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "strings", ".", "ToLower", "(", "key", ")", ")", "\n", "maxMbitKey", ":=", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "strings", ".", "ToLower", "(", "key", ")", ")", "\n", "resMbitKey", ":=", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "strings", ".", "ToLower", "(", "key", ")", ")", "\n\n", "structure", ".", "SetInt64Ptr", "(", "d", ",", "maxMbitKey", ",", "obj", ".", "AllocationInfo", ".", "Limit", ")", "\n", "structure", ".", "SetInt64Ptr", "(", "d", ",", "resMbitKey", ",", "obj", ".", "AllocationInfo", ".", "Reservation", ")", "\n", "if", "obj", ".", "AllocationInfo", ".", "Shares", "!=", "nil", "{", "d", ".", "<mask>", "(", "shareLevelKey", ",", "obj", ".", "AllocationInfo", ".", "Shares", ".", "Level", ")", "\n", "d", ".", "Set", "(", "shareCountKey", ",", "obj", ".", "AllocationInfo", ".", "Shares", ".", "Shares", ")", "\n", "}", "\n", "return", "nil", "\n", "}" ]
4,659
all-4660
[ "GetObject", "is", "a", "wrapper", "around", "gtk_builder_get_object", "()", ".", "The", "returned", "result", "is", "an", "IObject", "so", "it", "will", "need", "to", "be", "type", "-", "asserted", "to", "the", "appropriate", "type", "before", "being", "used", ".", "For", "example", "to", "get", "an", "object", "and", "type", "assert", "it", "as", "a", "window", ":", "obj", "err", ":", "=", "builder", ".", "GetObject", "(", "window", ")", "if", "err", "!", "=", "nil", "{", "//", "object", "not", "found", "return", "}", "if", "w", "ok", ":", "=", "obj", ".", "(", "*", "gtk", ".", "Window", ")", ";", "ok", "{", "//", "do", "stuff", "with", "w", "here", "}", "else", "{", "//", "not", "a", "*", "gtk", ".", "Window", "}" ]
[ "func", "(", "b", "*", "Builder", ")", "GetObject", "(", "<mask>", "string", ")", "(", "glib", ".", "IObject", ",", "error", ")", "{", "cstr", ":=", "C", ".", "CString", "(", "name", ")", "\n", "defer", "C", ".", "free", "(", "unsafe", ".", "Pointer", "(", "cstr", ")", ")", "\n", "c", ":=", "C", ".", "gtk_builder_get_object", "(", "b", ".", "native", "(", ")", ",", "(", "*", "C", ".", "gchar", ")", "(", "cstr", ")", ")", "\n", "if", "c", "==", "nil", "{", "return", "nil", ",", "errors", ".", "New", "(", "\"", "\"", "+", "name", "+", "\"", "\"", ")", "\n", "}", "\n", "obj", ",", "err", ":=", "cast", "(", "c", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "return", "obj", ",", "nil", "\n", "}" ]
4,660
all-4661
[ "LowerCaseFilter", "creates", "a", "filter", "that", "only", "get", "passed", "lowercase", "field", "names" ]
[ "func", "LowerCaseFilter", "(", "filter", "Filter", ")", "Filter", "{", "return", "FilterFunc", "(", "func", "(", "k", "string", ",", "v", "<mask>", "{", "}", ")", "interface", "{", "}", "{", "return", "filter", ".", "Filter", "(", "strings", ".", "ToLower", "(", "k", ")", ",", "v", ")", "\n", "}", ")", "\n", "}" ]
4,661
all-4662
[ "dflSignal", "sets", "the", "given", "signal", "to", "SIG_DFL" ]
[ "func", "dflSignal", "(", "sig", "syscall", ".", "Signal", ")", "{", "// clearing out the sigact sets the signal to SIG_DFL", "<mask>", "sigactBuf", "[", "32", "]", "uint64", "\n", "ptr", ":=", "unsafe", ".", "Pointer", "(", "&", "sigactBuf", ")", "\n", "syscall", ".", "Syscall6", "(", "uintptr", "(", "syscall", ".", "SYS_RT_SIGACTION", ")", ",", "uintptr", "(", "sig", ")", ",", "uintptr", "(", "ptr", ")", ",", "0", ",", "8", ",", "0", ",", "0", ")", "\n", "}" ]
4,662
all-4663
[ "hostPortGroupFromName", "locates", "a", "port", "group", "on", "the", "supplied", "HostNetworkSystem", "by", "name", "." ]
[ "func", "hostPortGroupFromName", "(", "client", "*", "govmomi", ".", "Client", ",", "ns", "*", "object", ".", "HostNetworkSystem", ",", "name", "string", ")", "(", "*", "types", ".", "HostPortGroup", ",", "error", ")", "{", "var", "mns", "mo", ".", "HostNetworkSystem", "\n", "pc", ":=", "client", ".", "PropertyCollector", "(", ")", "\n", "ctx", ",", "cancel", ":=", "context", ".", "WithTimeout", "(", "context", ".", "Background", "(", ")", ",", "defaultAPITimeout", ")", "\n", "defer", "cancel", "(", ")", "\n", "if", "err", ":=", "pc", ".", "RetrieveOne", "(", "ctx", ",", "ns", ".", "Reference", "(", ")", ",", "[", "]", "string", "{", "\"", "\"", "}", ",", "&", "mns", ")", ";", "err", "!=", "nil", "{", "return", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "err", ")", "\n", "}", "\n\n", "for", "_", ",", "pg", ":=", "range", "mns", ".", "NetworkInfo", ".", "Portgroup", "{", "if", "pg", ".", "Spec", ".", "Name", "==", "name", "{", "return", "&", "pg", ",", "nil", "\n", "}", "\n", "}", "\n\n", "return", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "<mask>", ")", "\n", "}" ]
4,663
all-4664
[ "YesError", "checks", "for", "an", "error", "." ]
[ "func", "YesError", "(", "tb", "testing", ".", "TB", ",", "err", "error", ",", "msgAndArgs", "...", "<mask>", "{", "}", ")", "{", "tb", ".", "Helper", "(", ")", "\n", "if", "err", "==", "nil", "{", "fatal", "(", "tb", ",", "msgAndArgs", ",", "\"", "\"", ",", "err", ")", "\n", "}", "\n", "}" ]
4,664
all-4665
[ "GetLens", "returns", "a", "Lens", "by", "name", "if", "it", "exists", ";", "otherwise", "it", "returns", "an", "error", "." ]
[ "func", "GetLens", "(", "<mask>", "string", ")", "(", "Lens", ",", "error", ")", "{", "lens", ",", "ok", ":=", "lensReg", "[", "name", "]", "\n", "if", "!", "ok", "{", "return", "nil", ",", "ErrInvalidLensName", "\n", "}", "\n", "return", "lens", ",", "nil", "\n", "}" ]
4,665
all-4666
[ "MarshalJSON", "supports", "json", ".", "Marshaler", "interface" ]
[ "func", "(", "v", "EventInterstitialShown", ")", "MarshalJSON", "(", ")", "(", "[", "]", "<mask>", ",", "error", ")", "{", "w", ":=", "jwriter", ".", "Writer", "{", "}", "\n", "easyjsonC5a4559bEncodeGithubComChromedpCdprotoPage58", "(", "&", "w", ",", "v", ")", "\n", "return", "w", ".", "Buffer", ".", "BuildBytes", "(", ")", ",", "w", ".", "Error", "\n", "}" ]
4,666
all-4667
[ "Inc", "implements", "Inc", "method", "from", "QuotaService", "interface" ]
[ "func", "(", "s", "*", "QuotaService", ")", "Inc", "(", "appName", "string", ",", "quantity", "int", ")", "error", "{", "quota", ",", "err", ":=", "s", ".", "<mask>", ".", "Get", "(", "appName", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "err", "=", "s", ".", "checkLimit", "(", "quota", ",", "quantity", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "return", "s", ".", "Storage", ".", "Inc", "(", "appName", ",", "quantity", ")", "\n", "}" ]
4,667
all-4668
[ "ListDatum", "returns", "info", "about", "all", "datums", "in", "a", "Job" ]
[ "func", "(", "c", "APIClient", ")", "ListDatum", "(", "jobID", "string", ",", "pageSize", "int64", ",", "page", "int64", ")", "(", "*", "pps", ".", "ListDatumResponse", ",", "error", ")", "{", "client", ",", "err", ":=", "c", ".", "PpsAPIClient", ".", "ListDatumStream", "(", "c", ".", "Ctx", "(", ")", ",", "&", "pps", ".", "ListDatumRequest", "{", "Job", ":", "NewJob", "(", "jobID", ")", ",", "PageSize", ":", "pageSize", ",", "Page", ":", "page", ",", "}", ",", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "grpcutil", ".", "ScrubGRPC", "(", "err", ")", "\n", "}", "\n", "resp", ":=", "&", "pps", ".", "ListDatumResponse", "{", "}", "\n", "first", ":=", "true", "\n", "for", "{", "r", ",", "err", ":=", "client", ".", "Recv", "(", ")", "\n", "if", "err", "==", "io", ".", "EOF", "{", "break", "\n", "}", "else", "if", "err", "!=", "nil", "{", "return", "nil", ",", "grpcutil", ".", "ScrubGRPC", "(", "err", ")", "\n", "}", "\n", "if", "first", "{", "resp", ".", "TotalPages", "=", "r", ".", "TotalPages", "\n", "resp", ".", "Page", "=", "r", ".", "Page", "\n", "first", "=", "false", "\n", "}", "\n", "resp", ".", "DatumInfos", "=", "<mask>", "(", "resp", ".", "DatumInfos", ",", "r", ".", "DatumInfo", ")", "\n", "}", "\n", "return", "resp", ",", "nil", "\n", "}" ]
4,668
all-4669
[ "UpdateBranch", "updates", "the", "branch", "with", "the", "specified", "configuration" ]
[ "func", "(", "p", "*", "protector", ")", "UpdateBranch", "(", "orgName", ",", "repo", "string", ",", "branchName", "string", ",", "branch", "config", ".", "Branch", ",", "protected", "bool", ")", "error", "{", "bp", ",", "err", ":=", "p", ".", "cfg", ".", "GetPolicy", "(", "orgName", ",", "repo", ",", "branchName", ",", "branch", ")", "\n", "if", "err", "!=", "nil", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "err", ")", "\n", "}", "\n", "if", "bp", "==", "nil", "||", "bp", ".", "Protect", "==", "nil", "{", "return", "nil", "\n", "}", "\n", "if", "!", "protected", "&&", "!", "*", "bp", ".", "Protect", "{", "logrus", ".", "Infof", "(", "\"", "\"", ",", "orgName", ",", "repo", ",", "branchName", ")", "\n", "return", "nil", "\n", "}", "\n", "var", "req", "*", "github", ".", "BranchProtectionRequest", "\n", "if", "*", "bp", ".", "Protect", "{", "r", ":=", "makeRequest", "(", "*", "bp", ")", "\n", "req", "=", "&", "r", "\n", "}", "\n", "p", ".", "updates", "<-", "requirements", "{", "Org", ":", "orgName", ",", "Repo", ":", "repo", ",", "Branch", ":", "branchName", ",", "<mask>", ":", "req", ",", "}", "\n", "return", "nil", "\n", "}" ]
4,669
all-4670
[ "NewImage", "returns", "an", "empty", "image", ".", "If", "width", "or", "height", "is", "less", "than", "1", "or", "more", "than", "device", "-", "dependent", "maximum", "size", "NewImage", "panics", ".", "filter", "argument", "is", "just", "for", "backward", "compatibility", ".", "If", "you", "are", "not", "sure", "specify", "FilterDefault", ".", "Error", "returned", "by", "NewImage", "is", "always", "nil", "as", "of", "1", ".", "5", ".", "0", "-", "alpha", "." ]
[ "func", "NewImage", "(", "width", ",", "height", "int", ",", "filter", "Filter", ")", "(", "*", "Image", ",", "error", ")", "{", "s", ":=", "shareable", ".", "NewImage", "(", "width", ",", "<mask>", ")", "\n", "i", ":=", "&", "Image", "{", "mipmap", ":", "newMipmap", "(", "s", ")", ",", "filter", ":", "filter", ",", "}", "\n", "i", ".", "addr", "=", "i", "\n", "return", "i", ",", "nil", "\n", "}" ]
4,670
all-4671
[ "PullTree", "pulls", "from", "a", "raw", "HashTree", "rather", "than", "a", "repo", "." ]
[ "func", "(", "p", "*", "Puller", ")", "PullTree", "(", "client", "*", "pachclient", ".", "APIClient", ",", "root", "string", ",", "tree", "hashtree", ".", "HashTree", ",", "pipes", "bool", ",", "concurrency", "int", ")", "error", "{", "limiter", ":=", "<mask>", ".", "New", "(", "concurrency", ")", "\n", "var", "eg", "errgroup", ".", "Group", "\n", "if", "err", ":=", "tree", ".", "Walk", "(", "\"", "\"", ",", "func", "(", "path", "string", ",", "node", "*", "hashtree", ".", "NodeProto", ")", "error", "{", "if", "node", ".", "FileNode", "!=", "nil", "{", "path", ":=", "filepath", ".", "Join", "(", "root", ",", "path", ")", "\n", "var", "hashes", "[", "]", "string", "\n", "for", "_", ",", "object", ":=", "range", "node", ".", "FileNode", ".", "Objects", "{", "hashes", "=", "append", "(", "hashes", ",", "object", ".", "Hash", ")", "\n", "}", "\n", "if", "pipes", "{", "return", "p", ".", "makePipe", "(", "path", ",", "func", "(", "w", "io", ".", "Writer", ")", "error", "{", "return", "client", ".", "GetObjects", "(", "hashes", ",", "0", ",", "0", ",", "uint64", "(", "node", ".", "SubtreeSize", ")", ",", "w", ")", "\n", "}", ")", "\n", "}", "\n", "limiter", ".", "Acquire", "(", ")", "\n", "eg", ".", "Go", "(", "func", "(", ")", "(", "retErr", "error", ")", "{", "defer", "limiter", ".", "Release", "(", ")", "\n", "return", "p", ".", "makeFile", "(", "path", ",", "func", "(", "w", "io", ".", "Writer", ")", "error", "{", "return", "client", ".", "GetObjects", "(", "hashes", ",", "0", ",", "0", ",", "uint64", "(", "node", ".", "SubtreeSize", ")", ",", "w", ")", "\n", "}", ")", "\n", "}", ")", "\n", "}", "\n", "return", "nil", "\n", "}", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "return", "eg", ".", "Wait", "(", ")", "\n", "}" ]
4,671
all-4672
[ "New", "initalize", "the", "render", "struct", "." ]
[ "func", "New", "(", "config", "*", "Config", ",", "viewPaths", "...", "string", ")", "*", "Render", "{", "if", "config", "==", "nil", "{", "config", "=", "&", "Config", "{", "}", "\n", "}", "\n\n", "if", "config", ".", "DefaultLayout", "==", "\"", "\"", "{", "config", ".", "DefaultLayout", "=", "DefaultLayout", "\n", "}", "\n\n", "if", "config", ".", "AssetFileSystem", "==", "nil", "{", "config", ".", "AssetFileSystem", "=", "assetfs", ".", "AssetFS", "(", ")", ".", "NameSpace", "(", "\"", "\"", ")", "\n", "}", "\n\n", "config", ".", "ViewPaths", "=", "append", "(", "append", "(", "config", ".", "ViewPaths", ",", "viewPaths", "...", ")", ",", "DefaultViewPath", ")", "\n\n", "render", ":=", "&", "Render", "{", "funcMaps", ":", "map", "[", "string", "]", "interface", "{", "}", "{", "}", ",", "Config", ":", "config", "}", "\n\n", "for", "_", ",", "viewPath", ":=", "range", "config", ".", "ViewPaths", "{", "render", ".", "RegisterViewPath", "(", "viewPath", ")", "\n", "}", "\n\n", "return", "<mask>", "\n", "}" ]
4,672
all-4673
[ "DeleteStaleComments", "deletes", "comments", "flagged", "by", "isStale", "." ]
[ "func", "(", "f", "*", "FakeClient", ")", "DeleteStaleComments", "(", "org", ",", "repo", "string", ",", "number", "int", ",", "comments", "[", "]", "github", ".", "IssueComment", ",", "isStale", "func", "(", "github", ".", "IssueComment", ")", "bool", ")", "error", "{", "if", "comments", "==", "nil", "{", "comments", ",", "_", "=", "f", ".", "ListIssueComments", "(", "org", ",", "repo", ",", "number", ")", "\n", "}", "\n", "for", "_", ",", "comment", ":=", "range", "comments", "{", "if", "isStale", "(", "comment", ")", "{", "if", "err", ":=", "f", ".", "DeleteComment", "(", "org", ",", "repo", ",", "<mask>", ".", "ID", ")", ";", "err", "!=", "nil", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "comment", ".", "ID", ")", "\n", "}", "\n", "}", "\n", "}", "\n", "return", "nil", "\n", "}" ]
4,673
all-4674
[ "CooperativeClose", "calls", "cooperativeClose", "method", "of", "Privatix", "service", "contract", "." ]
[ "func", "(", "b", "*", "backendInstance", ")", "CooperativeClose", "(", "opts", "*", "<mask>", ".", "TransactOpts", ",", "agent", "common", ".", "Address", ",", "block", "uint32", ",", "offeringHash", "[", "common", ".", "HashLength", "]", "byte", ",", "balance", "uint64", ",", "balanceSig", ",", "closingSig", "[", "]", "byte", ")", "(", "*", "types", ".", "Transaction", ",", "error", ")", "{", "ctx2", ",", "cancel", ":=", "b", ".", "addTimeout", "(", "opts", ".", "Context", ")", "\n", "defer", "cancel", "(", ")", "\n\n", "opts", ".", "Context", "=", "ctx2", "\n\n", "tx", ",", "err", ":=", "b", ".", "psc", ".", "CooperativeClose", "(", "opts", ",", "agent", ",", "block", ",", "offeringHash", ",", "balance", ",", "balanceSig", ",", "closingSig", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "err", ")", "\n", "}", "\n", "return", "tx", ",", "nil", "\n", "}" ]
4,674
all-4675
[ "Returns", "the", "location", "of", "an", "attribute", "variable" ]
[ "func", "GetAttribLocation", "(", "program", "uint32", ",", "name", "*", "uint8", ")", "int32", "{", "ret", ",", "_", ",", "_", ":=", "syscall", ".", "Syscall", "(", "gpGetAttribLocation", ",", "2", ",", "uintptr", "(", "program", ")", ",", "uintptr", "(", "unsafe", ".", "Pointer", "(", "name", ")", ")", ",", "0", ")", "\n", "return", "(", "int32", ")", "(", "<mask>", ")", "\n", "}" ]
4,675
all-4676
[ "HandlerWithError", "implements", "Handler", "by", "calling", "the", "func", "for", "each", "request", "and", "handling", "returned", "errors", "and", "results", "." ]
[ "func", "HandlerWithError", "(", "handleFunc", "func", "(", "context", ".", "Context", ",", "*", "Conn", ",", "*", "Request", ")", "(", "<mask>", "interface", "{", "}", ",", "err", "error", ")", ")", "*", "HandlerWithErrorConfigurer", "{", "return", "&", "HandlerWithErrorConfigurer", "{", "handleFunc", ":", "handleFunc", "}", "\n", "}" ]
4,676
all-4677
[ "ReadResponse", "reads", "a", "server", "response", "into", "the", "received", "o", "." ]
[ "func", "(", "o", "*", "DeleteVMReader", ")", "ReadResponse", "(", "response", "runtime", ".", "ClientResponse", ",", "consumer", "runtime", ".", "Consumer", ")", "(", "interface", "{", "}", ",", "error", ")", "{", "switch", "response", ".", "Code", "(", ")", "{", "case", "204", ":", "result", ":=", "NewDeleteVMNoContent", "(", ")", "\n", "if", "err", ":=", "result", ".", "readResponse", "(", "response", ",", "consumer", ",", "o", ".", "formats", ")", ";", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "return", "result", ",", "nil", "\n\n", "case", "404", ":", "result", ":=", "NewDeleteVMNotFound", "(", ")", "\n", "if", "err", ":=", "result", ".", "readResponse", "(", "response", ",", "consumer", ",", "o", ".", "formats", ")", ";", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "return", "nil", ",", "result", "\n\n", "default", ":", "result", ":=", "NewDeleteVMDefault", "(", "response", ".", "Code", "(", ")", ")", "\n", "if", "err", ":=", "result", ".", "readResponse", "(", "response", ",", "consumer", ",", "o", ".", "formats", ")", ";", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "return", "nil", ",", "<mask>", "\n", "}", "\n", "}" ]
4,677
all-4678
[ "ExecuteFuncString", "calls", "f", "on", "each", "template", "tag", "(", "placeholder", ")", "occurrence", "and", "substitutes", "it", "with", "the", "data", "written", "to", "TagFunc", "s", "w", ".", "Returns", "the", "resulting", "string", ".", "This", "function", "is", "optimized", "for", "constantly", "changing", "templates", ".", "Use", "Template", ".", "ExecuteFuncString", "for", "frozen", "templates", "." ]
[ "func", "ExecuteFuncString", "(", "template", ",", "startTag", ",", "endTag", "string", ",", "f", "TagFunc", ")", "string", "{", "tagsCount", ":=", "<mask>", ".", "Count", "(", "unsafeString2Bytes", "(", "template", ")", ",", "unsafeString2Bytes", "(", "startTag", ")", ")", "\n", "if", "tagsCount", "==", "0", "{", "return", "template", "\n", "}", "\n\n", "bb", ":=", "byteBufferPool", ".", "Get", "(", ")", "\n", "if", "_", ",", "err", ":=", "ExecuteFunc", "(", "template", ",", "startTag", ",", "endTag", ",", "bb", ",", "f", ")", ";", "err", "!=", "nil", "{", "panic", "(", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "err", ")", ")", "\n", "}", "\n", "s", ":=", "string", "(", "bb", ".", "B", ")", "\n", "bb", ".", "Reset", "(", ")", "\n", "byteBufferPool", ".", "Put", "(", "bb", ")", "\n", "return", "s", "\n", "}" ]
4,678
all-4679
[ "Interceptor", "automatically", "restarts", "streams", "on", "non", "-", "expected", "errors", "To", "do", "so", "the", "application", "should", "create", "a", "for", "-", "loop", "around", "RecvMsg", "which", "returns", "the", "same", "errors", "that", "are", "received", "from", "the", "server", ".", "An", "io", ".", "EOF", "indicates", "the", "end", "of", "the", "stream", "To", "stop", "the", "reconnect", "behaviour", "you", "have", "to", "cancel", "the", "context" ]
[ "func", "Interceptor", "(", "settings", "Settings", ")", "grpc", ".", "StreamClientInterceptor", "{", "return", "func", "(", "ctx", "context", ".", "Context", ",", "desc", "*", "grpc", ".", "StreamDesc", ",", "cc", "*", "grpc", ".", "ClientConn", ",", "method", "string", ",", "streamer", "grpc", ".", "Streamer", ",", "opts", "...", "grpc", ".", "CallOption", ")", "(", "stream", "grpc", ".", "ClientStream", ",", "err", "error", ")", "{", "s", ":=", "&", "restartingStream", "{", "log", ":", "log", ".", "Get", "(", ")", ".", "WithField", "(", "\"", "\"", ",", "method", ")", ",", "ctx", ":", "ctx", ",", "desc", ":", "desc", ",", "<mask>", ":", "cc", ",", "method", ":", "method", ",", "streamer", ":", "streamer", ",", "opts", ":", "opts", ",", "retryableCodes", ":", "settings", ".", "RetryableCodes", ",", "backoff", ":", "settings", ".", "Backoff", ",", "retries", ":", "-", "1", ",", "}", "\n\n", "err", "=", "s", ".", "start", "(", ")", "\n\n", "stream", "=", "s", "\n", "return", "\n", "}", "\n", "}" ]
4,679
all-4680
[ "UpdateSecretVersionStageWithContext", "mocks", "base", "method" ]
[ "func", "(", "m", "*", "MockSecretsManagerAPI", ")", "UpdateSecretVersionStageWithContext", "(", "arg0", "aws", ".", "Context", ",", "arg1", "*", "secretsmanager", ".", "UpdateSecretVersionStageInput", ",", "arg2", "...", "request", ".", "Option", ")", "(", "*", "secretsmanager", ".", "UpdateSecretVersionStageOutput", ",", "error", ")", "{", "varargs", ":=", "[", "]", "interface", "{", "}", "{", "arg0", ",", "arg1", "}", "\n", "for", "_", ",", "a", ":=", "range", "arg2", "{", "varargs", "=", "append", "(", "varargs", ",", "a", ")", "\n", "}", "\n", "ret", ":=", "m", ".", "ctrl", ".", "Call", "(", "m", ",", "\"", "\"", ",", "varargs", "...", ")", "\n", "ret0", ",", "_", ":=", "<mask>", "[", "0", "]", ".", "(", "*", "secretsmanager", ".", "UpdateSecretVersionStageOutput", ")", "\n", "ret1", ",", "_", ":=", "ret", "[", "1", "]", ".", "(", "error", ")", "\n", "return", "ret0", ",", "ret1", "\n", "}" ]
4,680
all-4681
[ "Cloud", "-" ]
[ "func", "Cloud", "(", "config", "CloudConfig", ")", "(", "result", "string", ",", "err", "error", ")", "{", "var", "cloudConfigManifest", "CloudConfigManifest", "\n", "cloudConfigManifest", "=", "config", ".", "GetManifest", "(", ")", "\n", "<mask>", "ccfgYaml", "[", "]", "byte", "\n", "if", "ccfgYaml", ",", "err", "=", "yaml", ".", "Marshal", "(", "cloudConfigManifest", ")", ";", "err", "==", "nil", "{", "result", "=", "string", "(", "ccfgYaml", ")", "\n", "}", "\n", "return", "\n", "}" ]
4,681
all-4682
[ "This", "is", "run", "for", "each", "new", "request", "perf", "is", "important", "." ]
[ "func", "escapedPath", "(", "urlObj", "*", "url", ".", "<mask>", ")", "string", "{", "// the escape method of url.URL should be public", "// that would avoid this split.", "parts", ":=", "strings", ".", "SplitN", "(", "urlObj", ".", "RequestURI", "(", ")", ",", "\"", "\"", ",", "2", ")", "\n", "return", "parts", "[", "0", "]", "\n", "}" ]
4,682
all-4683
[ "NewBundledStates", "is", "the", "constructor", "for", "BundledStates" ]
[ "func", "NewBundledStates", "(", "<mask>", "string", ")", "BundledStates", "{", "return", "BundledStates", "{", "description", ":", "description", ",", "states", ":", "map", "[", "string", "]", "State", "{", "}", ",", "}", "\n", "}" ]
4,683
all-4684
[ "newParser", "returns", "a", "new", "parser", "." ]
[ "func", "newParser", "(", "input", "string", ")", "*", "<mask>", "{", "p", ":=", "&", "parser", "{", "lex", ":", "lex", "(", "input", ")", ",", "}", "\n", "return", "p", "\n", "}" ]
4,684
all-4685
[ "Send", "sends", "the", "time", "elapsed", "since", "the", "creation", "of", "the", "Timing", "." ]
[ "func", "(", "t", "Timing", ")", "Send", "(", "bucket", "string", ")", "{", "t", ".", "c", ".", "Timing", "(", "bucket", ",", "int", "(", "t", ".", "Duration", "(", ")", "/", "<mask>", ".", "Millisecond", ")", ")", "\n", "}" ]
4,685
all-4686
[ "fromContext", "returns", "the", "App", "Engine", "context", "or", "nil", "if", "ctx", "is", "not", "derived", "from", "an", "App", "Engine", "context", "." ]
[ "func", "fromContext", "(", "ctx", "netcontext", ".", "Context", ")", "*", "<mask>", "{", "c", ",", "_", ":=", "ctx", ".", "Value", "(", "&", "contextKey", ")", ".", "(", "*", "context", ")", "\n", "return", "c", "\n", "}" ]
4,686
all-4687
[ "GetKeysInDirMeta", "returns", "the", "metadata", "for", "the", "keys", "and", "subdirectories", "within", "the", "directory", "at", "the", "given", "keystore", "path", "." ]
[ "func", "(", "c", "*", "Client", ")", "GetKeysInDirMeta", "(", "<mask>", "string", ")", "(", "[", "]", "KeyMeta", ",", "error", ")", "{", "r", ":=", "&", "keyMetaListContents", "{", "}", "\n", "err", ":=", "c", ".", "get", "(", "[", "]", "string", "{", "\"", "\"", ",", "\"", "\"", ",", "path", "}", ",", "nil", ",", "r", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "return", "r", ".", "Keys", ",", "nil", "\n", "}" ]
4,687
all-4688
[ "Total", "errors", "is", "the", "sum", "of", "errors", "with", "the", "request", "overall", "and", "errors", "on", "individual", "fields", "." ]
[ "func", "(", "self", "Errors", ")", "Count", "(", ")", "int", "{", "return", "len", "(", "<mask>", ".", "Overall", ")", "+", "len", "(", "self", ".", "Fields", ")", "\n", "}" ]
4,688
all-4689
[ "Specify", "the", "value", "of", "a", "uniform", "variable", "for", "a", "specified", "program", "object" ]
[ "func", "ProgramUniform4i", "(", "program", "uint32", ",", "location", "int32", ",", "v0", "int32", ",", "v1", "int32", ",", "v2", "int32", ",", "v3", "int32", ")", "{", "syscall", ".", "Syscall6", "(", "gpProgramUniform4i", ",", "6", ",", "uintptr", "(", "<mask>", ")", ",", "uintptr", "(", "location", ")", ",", "uintptr", "(", "v0", ")", ",", "uintptr", "(", "v1", ")", ",", "uintptr", "(", "v2", ")", ",", "uintptr", "(", "v3", ")", ")", "\n", "}" ]
4,689
all-4690
[ "for", "drag", "-", "data", "-", "get" ]
[ "func", "SetData", "(", "pointer", "uintptr", ",", "atom", "gdk", ".", "Atom", ",", "data", "[", "]", "byte", ")", "{", "c", ":=", "(", "*", "C", ".", "GValue", ")", "(", "unsafe", ".", "Pointer", "(", "pointer", ")", ")", "\n", "p", ":=", "(", "*", "C", ".", "GtkSelectionData", ")", "(", "unsafe", ".", "Pointer", "(", "c", ")", ")", "\n", "C", ".", "gtk_selection_data_set", "(", "p", ",", "C", ".", "GdkAtom", "(", "unsafe", ".", "Pointer", "(", "atom", ")", ")", ",", "C", ".", "gint", "(", "8", ")", ",", "(", "*", "C", ".", "guchar", ")", "(", "unsafe", ".", "Pointer", "(", "&", "<mask>", "[", "0", "]", ")", ")", ",", "C", ".", "gint", "(", "len", "(", "data", ")", ")", ")", "\n", "}" ]
4,690
all-4691
[ "WithPanicResponseHandler", "sets", "http", ".", "Handler", "that", "will", "be", "executed", "on", "panic", "event", ".", "It", "is", "useful", "when", "the", "response", "has", "dynamic", "content", ".", "If", "the", "content", "is", "static", "it", "is", "better", "to", "use", "WithPanicResponse", "option", "instead", ".", "This", "option", "has", "a", "precedence", "upon", "WithPanicResponse", "." ]
[ "func", "WithPanicResponseHandler", "(", "h", "<mask>", ".", "Handler", ")", "Option", "{", "return", "func", "(", "o", "*", "Handler", ")", "{", "o", ".", "panicResponseHandler", "=", "h", "}", "\n", "}" ]
4,691
all-4692
[ "UnmarshalJSON", "supports", "json", ".", "Unmarshaler", "interface" ]
[ "func", "(", "v", "*", "StopRuleUsageTrackingParams", ")", "UnmarshalJSON", "(", "<mask>", "[", "]", "byte", ")", "error", "{", "r", ":=", "jlexer", ".", "Lexer", "{", "Data", ":", "data", "}", "\n", "easyjsonC5a4559bDecodeGithubComChromedpCdprotoCss7", "(", "&", "r", ",", "v", ")", "\n", "return", "r", ".", "Error", "(", ")", "\n", "}" ]
4,692
all-4693
[ "HasPeriod", "returns", "a", "boolean", "if", "a", "field", "has", "been", "set", "." ]
[ "func", "(", "r", "*", "Recurrence", ")", "HasPeriod", "(", ")", "bool", "{", "if", "r", "!=", "nil", "&&", "r", ".", "Period", "!=", "nil", "{", "return", "<mask>", "\n", "}", "\n\n", "return", "false", "\n", "}" ]
4,693
all-4694
[ "ImportAccountFromHex", "imports", "private", "key", "from", "hex", "creates", "account", "and", "initiates", "JobAccountUpdateBalances", "job", "." ]
[ "func", "(", "h", "*", "Handler", ")", "ImportAccountFromHex", "(", "tkn", "string", ",", "params", "*", "AccountParamsWithHexKey", ")", "(", "*", "string", ",", "error", ")", "{", "logger", ":=", "h", ".", "logger", ".", "Add", "(", "\"", "\"", ",", "\"", "\"", ")", "\n\n", "if", "!", "h", ".", "token", ".", "Check", "(", "tkn", ")", "{", "logger", ".", "Warn", "(", "\"", "\"", ")", "\n", "return", "nil", ",", "ErrAccessDenied", "\n", "}", "\n\n", "makeECDSAFunc", ":=", "h", ".", "hexPrivateKeyToECDSA", "(", "params", ".", "PrivateKeyHex", ")", "\n\n", "account", ":=", "params", ".", "prefilledAccount", "(", ")", "\n\n", "id", ",", "err", ":=", "h", ".", "fillAndSaveAccount", "(", "logger", ",", "account", ",", "makeECDSAFunc", ",", "<mask>", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "return", "&", "id", ",", "nil", "\n", "}" ]
4,694
all-4695
[ "DeleteMaintenanceWindow", "deletes", "passed", "maintenance", "[", "window", "]", "." ]
[ "func", "(", "a", "*", "API", ")", "DeleteMaintenanceWindow", "(", "cfg", "*", "Maintenance", ")", "(", "bool", ",", "error", ")", "{", "if", "cfg", "==", "nil", "{", "return", "<mask>", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ")", "\n", "}", "\n", "return", "a", ".", "DeleteMaintenanceWindowByCID", "(", "CIDType", "(", "&", "cfg", ".", "CID", ")", ")", "\n", "}" ]
4,695
all-4696
[ "Addr", "returns", "the", "resource", "address", "for", "this", "subresource", "." ]
[ "func", "(", "r", "*", "Subresource", ")", "Addr", "(", ")", "string", "{", "return", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "r", ".", "srtype", ",", "r", ".", "<mask>", ")", "\n", "}" ]
4,696
all-4697
[ "Throttle", "is", "a", "middleware", "that", "limits", "number", "of", "currently", "processed", "requests", "at", "a", "time", "." ]
[ "func", "Throttle", "(", "limit", "int", ")", "func", "(", "http", ".", "Handler", ")", "<mask>", ".", "Handler", "{", "return", "ThrottleBacklog", "(", "limit", ",", "0", ",", "defaultBacklogTimeout", ")", "\n", "}" ]
4,697
all-4698
[ "errorf", "formats", "the", "error", "and", "terminates", "processing", "." ]
[ "func", "(", "p", "*", "parser", ")", "errorf", "(", "<mask>", "string", ",", "args", "...", "interface", "{", "}", ")", "{", "p", ".", "error", "(", "errors", ".", "Errorf", "(", "format", ",", "args", "...", ")", ")", "\n", "}" ]
4,698
all-4699
[ "ListEnvVars", "list", "environment", "variable", "to", "the", "specified", "project", "Returns", "the", "env", "vars", "(", "the", "value", "will", "be", "masked", ")" ]
[ "func", "(", "c", "*", "Client", ")", "ListEnvVars", "(", "<mask>", ",", "repo", "string", ")", "(", "[", "]", "EnvVar", ",", "error", ")", "{", "envVar", ":=", "[", "]", "EnvVar", "{", "}", "\n\n", "err", ":=", "c", ".", "request", "(", "\"", "\"", ",", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "account", ",", "repo", ")", ",", "&", "envVar", ",", "nil", ",", "nil", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "return", "envVar", ",", "nil", "\n", "}" ]
4,699
all-4700
[ "Accept", "implements", "net", ".", "Listener", "s", "Accept", ".", "It", "is", "safe", "calling", "Accept", "from", "concurrently", "running", "goroutines", ".", "Accept", "returns", "new", "connection", "per", "each", "Dial", "call", "." ]
[ "func", "(", "ln", "*", "InmemoryListener", ")", "Accept", "(", ")", "(", "<mask>", ".", "Conn", ",", "error", ")", "{", "c", ",", "ok", ":=", "<-", "ln", ".", "conns", "\n", "if", "!", "ok", "{", "return", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ")", "\n", "}", "\n", "close", "(", "c", ".", "accepted", ")", "\n", "return", "c", ".", "conn", ",", "nil", "\n", "}" ]