id
int32
0
25.3k
idx
stringlengths
5
9
nl_tokens
sequencelengths
1
418
pl_tokens
sequencelengths
22
4.98k
10,800
all-10801
[ "GetEmailOk", "returns", "a", "tuple", "with", "the", "Email", "field", "if", "it", "s", "non", "-", "nil", "zero", "value", "otherwise", "and", "a", "boolean", "to", "check", "if", "the", "value", "has", "been", "set", "." ]
[ "func", "(", "u", "*", "<mask>", ")", "GetEmailOk", "(", ")", "(", "string", ",", "bool", ")", "{", "if", "u", "==", "nil", "||", "u", ".", "Email", "==", "nil", "{", "return", "\"", "\"", ",", "false", "\n", "}", "\n", "return", "*", "u", ".", "Email", ",", "true", "\n", "}" ]
10,801
all-10802
[ "===", "clamp_max", "(", "Vector", "ValueTypeVector", "max", "Scalar", ")", "Vector", "===" ]
[ "func", "funcClampMax", "(", "vals", "[", "]", "Value", ",", "args", "Expressions", ",", "enh", "*", "EvalNodeHelper", ")", "Vector", "{", "vec", ":=", "vals", "[", "0", "]", ".", "(", "Vector", ")", "\n", "max", ":=", "vals", "[", "1", "]", ".", "(", "Vector", ")", "[", "0", "]", ".", "<mask>", ".", "V", "\n", "for", "_", ",", "el", ":=", "range", "vec", "{", "enh", ".", "out", "=", "append", "(", "enh", ".", "out", ",", "Sample", "{", "Metric", ":", "enh", ".", "dropMetricName", "(", "el", ".", "Metric", ")", ",", "Point", ":", "Point", "{", "V", ":", "math", ".", "Min", "(", "max", ",", "el", ".", "V", ")", "}", ",", "}", ")", "\n", "}", "\n", "return", "enh", ".", "out", "\n", "}" ]
10,802
all-10803
[ "Merge", "merges", "a", "PR", ".", "See", "https", ":", "//", "developer", ".", "github", ".", "com", "/", "v3", "/", "pulls", "/", "#merge", "-", "a", "-", "pull", "-", "request", "-", "merge", "-", "button" ]
[ "func", "(", "c", "*", "Client", ")", "Merge", "(", "org", ",", "repo", "string", ",", "pr", "int", ",", "<mask>", "MergeDetails", ")", "error", "{", "c", ".", "log", "(", "\"", "\"", ",", "org", ",", "repo", ",", "pr", ",", "details", ")", "\n", "ge", ":=", "githubError", "{", "}", "\n", "ec", ",", "err", ":=", "c", ".", "request", "(", "&", "request", "{", "method", ":", "http", ".", "MethodPut", ",", "path", ":", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "org", ",", "repo", ",", "pr", ")", ",", "requestBody", ":", "&", "details", ",", "exitCodes", ":", "[", "]", "int", "{", "200", ",", "405", ",", "409", "}", ",", "}", ",", "&", "ge", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "if", "ec", "==", "405", "{", "if", "strings", ".", "Contains", "(", "ge", ".", "Message", ",", "\"", "\"", ")", "{", "return", "UnmergablePRBaseChangedError", "(", "ge", ".", "Message", ")", "\n", "}", "\n", "if", "strings", ".", "Contains", "(", "ge", ".", "Message", ",", "\"", "\"", ")", "{", "return", "UnauthorizedToPushError", "(", "ge", ".", "Message", ")", "\n", "}", "\n", "if", "strings", ".", "Contains", "(", "ge", ".", "Message", ",", "\"", "\"", ")", "{", "return", "MergeCommitsForbiddenError", "(", "ge", ".", "Message", ")", "\n", "}", "\n", "return", "UnmergablePRError", "(", "ge", ".", "Message", ")", "\n", "}", "else", "if", "ec", "==", "409", "{", "return", "ModifiedHeadError", "(", "ge", ".", "Message", ")", "\n", "}", "\n\n", "return", "nil", "\n", "}" ]
10,803
all-10804
[ "DoHidden", "is", "equivalent", "to", "Do", "with", "the", "exception", "that", "nothing", "gets", "logged", "unless", "DumpFormat", "is", "set", "to", "Verbose", "." ]
[ "func", "(", "d", "*", "dumpClient", ")", "DoHidden", "(", "req", "*", "http", ".", "Request", ")", "(", "*", "http", ".", "<mask>", ",", "error", ")", "{", "return", "d", ".", "doImp", "(", "req", ",", "true", ",", "nil", ")", "\n", "}" ]
10,804
all-10805
[ "parseDockerReferences", "converts", "two", "reference", "strings", "into", "parsed", "entities", "failing", "on", "any", "error" ]
[ "func", "parseDockerReferences", "(", "s1", ",", "s2", "string", ")", "(", "<mask>", ".", "Named", ",", "reference", ".", "Named", ",", "error", ")", "{", "r1", ",", "err", ":=", "reference", ".", "ParseNormalizedNamed", "(", "s1", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "nil", ",", "err", "\n", "}", "\n", "r2", ",", "err", ":=", "reference", ".", "ParseNormalizedNamed", "(", "s2", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "nil", ",", "err", "\n", "}", "\n", "return", "r1", ",", "r2", ",", "nil", "\n", "}" ]
10,805
all-10806
[ "Build", "builds", "the", "URL", "host", "using", "the", "given", "positional", "and", "named", "variables", "and", "writes", "it", "to", "the", "given", "URL", "." ]
[ "func", "(", "m", "*", "GorillaHost", ")", "Build", "(", "u", "*", "url", ".", "URL", ",", "values", "url", ".", "Values", ")", "error", "{", "host", ",", "err", ":=", "m", ".", "RevertValid", "(", "<mask>", ")", "\n", "if", "err", "==", "nil", "{", "if", "u", ".", "Scheme", "==", "\"", "\"", "{", "u", ".", "Scheme", "=", "\"", "\"", "\n", "}", "\n", "u", ".", "Host", "=", "host", "\n", "}", "\n", "return", "err", "\n", "}" ]
10,806
all-10807
[ "GetReader", "gets", "HTTP", "header", "value", "as", "defined", "by", "current", "instance", "from", "Request", "Header", "and", "sets", "to", "current", "instance", "." ]
[ "func", "(", "s", "*", "HttpHeader", ")", "GetReader", "(", "h", "<mask>", ".", "Header", ")", "*", "HttpHeader", "{", "s", ".", "Value", "=", "h", ".", "Get", "(", "s", ".", "Name", ")", "\n", "return", "s", "\n", "}" ]
10,807
all-10808
[ "envFunc", "returns", "a", "function", "which", "checks", "the", "value", "of", "an", "environment", "variable", ".", "Invokers", "can", "specify", "their", "own", "environment", "which", "takes", "precedences", "over", "any", "real", "environment", "variables" ]
[ "func", "envFunc", "(", "env", "[", "]", "string", ")", "func", "(", "string", ")", "(", "string", ",", "error", ")", "{", "return", "func", "(", "s", "string", ")", "(", "string", ",", "error", ")", "{", "for", "_", ",", "e", ":=", "range", "env", "{", "split", ":=", "strings", ".", "SplitN", "(", "e", ",", "\"", "\"", ",", "2", ")", "\n", "k", ",", "v", ":=", "split", "[", "0", "]", ",", "<mask>", "[", "1", "]", "\n", "if", "k", "==", "s", "{", "return", "v", ",", "nil", "\n", "}", "\n", "}", "\n", "return", "os", ".", "Getenv", "(", "s", ")", ",", "nil", "\n", "}", "\n", "}" ]
10,808
all-10809
[ "makeLocalConnectionStatusSlice", "takes", "a", "snapshot", "of", "the", "active", "local", "connections", "in", "the", "ConnectionMaker", "." ]
[ "func", "makeLocalConnectionStatusSlice", "(", "cm", "*", "connectionMaker", ")", "[", "]", "LocalConnectionStatus", "{", "resultChan", ":=", "make", "(", "chan", "[", "]", "LocalConnectionStatus", ")", "\n", "cm", ".", "actionChan", "<-", "func", "(", ")", "bool", "{", "var", "slice", "[", "]", "LocalConnectionStatus", "\n", "for", "conn", ":=", "range", "cm", ".", "connections", "{", "state", ":=", "\"", "\"", "\n", "if", "conn", ".", "isEstablished", "(", ")", "{", "state", "=", "\"", "\"", "\n", "}", "\n", "lc", ",", "_", ":=", "conn", ".", "(", "*", "LocalConnection", ")", "\n", "attrs", ":=", "lc", ".", "OverlayConn", ".", "Attrs", "(", ")", "\n", "name", ",", "ok", ":=", "attrs", "[", "\"", "\"", "]", "\n", "if", "!", "ok", "{", "name", "=", "\"", "\"", "\n", "}", "\n", "info", ":=", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "name", ",", "conn", ".", "Remote", "(", ")", ")", "\n", "if", "lc", ".", "router", ".", "usingPassword", "(", ")", "{", "if", "lc", ".", "untrusted", "(", ")", "{", "info", "=", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "\"", "\"", ",", "info", ")", "\n", "if", "attrs", "!=", "nil", "{", "attrs", "[", "\"", "\"", "]", "=", "true", "\n", "}", "\n", "}", "else", "{", "info", "=", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "\"", "\"", ",", "info", ")", "\n", "}", "\n", "}", "\n", "slice", "=", "append", "(", "slice", ",", "LocalConnectionStatus", "{", "conn", ".", "remoteTCPAddress", "(", ")", ",", "conn", ".", "isOutbound", "(", ")", ",", "state", ",", "info", ",", "attrs", "}", ")", "\n", "}", "\n", "for", "address", ",", "target", ":=", "range", "cm", ".", "targets", "{", "add", ":=", "func", "(", "state", ",", "info", "string", ")", "{", "slice", "=", "append", "(", "slice", ",", "LocalConnectionStatus", "{", "address", ",", "true", ",", "state", ",", "info", ",", "nil", "}", ")", "\n", "}", "\n", "switch", "<mask>", ".", "state", "{", "case", "targetWaiting", ":", "until", ":=", "\"", "\"", "\n", "if", "!", "target", ".", "tryAfter", ".", "IsZero", "(", ")", "{", "until", "=", "target", ".", "tryAfter", ".", "String", "(", ")", "\n", "}", "\n", "if", "target", ".", "lastError", "==", "nil", "{", "// shouldn't happen", "add", "(", "\"", "\"", ",", "\"", "\"", "+", "until", ")", "\n", "}", "else", "{", "add", "(", "\"", "\"", ",", "target", ".", "lastError", ".", "Error", "(", ")", "+", "\"", "\"", "+", "until", ")", "\n", "}", "\n", "case", "targetAttempting", ":", "if", "target", ".", "lastError", "==", "nil", "{", "add", "(", "\"", "\"", ",", "\"", "\"", ")", "\n", "}", "else", "{", "add", "(", "\"", "\"", ",", "target", ".", "lastError", ".", "Error", "(", ")", ")", "\n", "}", "\n", "case", "targetConnected", ":", "case", "targetSuspended", ":", "}", "\n", "}", "\n", "resultChan", "<-", "slice", "\n", "return", "false", "\n", "}", "\n", "return", "<-", "resultChan", "\n", "}" ]
10,809
all-10810
[ "IsPtr", "reports", "whether", "the", "inferior", "at", "address", "a", "contains", "a", "pointer", "." ]
[ "func", "(", "p", "*", "Process", ")", "IsPtr", "(", "a", "core", ".", "Address", ")", "bool", "{", "h", ":=", "p", ".", "findHeapInfo", "(", "a", ")", "\n", "if", "h", "!=", "nil", "{", "return", "h", ".", "IsPtr", "(", "a", ",", "p", ".", "proc", ".", "PtrSize", "(", ")", ")", "\n", "}", "\n", "for", "_", ",", "m", ":=", "range", "p", ".", "modules", "{", "for", "_", ",", "s", ":=", "range", "[", "2", "]", "string", "{", "\"", "\"", ",", "\"", "\"", "}", "{", "min", ":=", "core", ".", "<mask>", "(", "m", ".", "r", ".", "Field", "(", "s", ")", ".", "Uintptr", "(", ")", ")", "\n", "max", ":=", "core", ".", "Address", "(", "m", ".", "r", ".", "Field", "(", "\"", "\"", "+", "s", ")", ".", "Uintptr", "(", ")", ")", "\n", "if", "a", "<", "min", "||", "a", ">=", "max", "{", "continue", "\n", "}", "\n", "gc", ":=", "m", ".", "r", ".", "Field", "(", "\"", "\"", "+", "s", "+", "\"", "\"", ")", ".", "Field", "(", "\"", "\"", ")", ".", "Address", "(", ")", "\n", "i", ":=", "a", ".", "Sub", "(", "min", ")", "\n", "return", "p", ".", "proc", ".", "ReadUint8", "(", "gc", ".", "Add", "(", "i", "/", "8", ")", ")", ">>", "uint", "(", "i", "%", "8", ")", "!=", "0", "\n", "}", "\n", "}", "\n", "// Everywhere else can't be a pointer. At least, not a pointer into the Go heap.", "// TODO: stacks?", "// TODO: finalizers?", "return", "false", "\n", "}" ]
10,810
all-10811
[ "Issue", "issues", "a", "new", "Identity", "with", "this", "one", "as", "its", "parent", "." ]
[ "func", "(", "<mask>", "*", "Identity", ")", "Issue", "(", "opts", "...", "Option", ")", "*", "Identity", "{", "opts", "=", "append", "(", "opts", ",", "Issuer", "(", "id", ")", ")", "\n", "return", "New", "(", "opts", "...", ")", "\n", "}" ]
10,811
all-10812
[ "MOIDForUUID", "returns", "the", "managed", "object", "reference", "ID", "for", "a", "specific", "virtual", "machine", "UUID", "and", "returns", "a", "MOIDForUUIDResult", "with", "the", "appropriate", "association", "." ]
[ "func", "MOIDForUUID", "(", "client", "*", "govmomi", ".", "Client", ",", "uuid", "string", ")", "(", "MOIDForUUIDResult", ",", "error", ")", "{", "vm", ",", "err", ":=", "FromUUID", "(", "<mask>", ",", "uuid", ")", "\n", "if", "err", "!=", "nil", "{", "return", "MOIDForUUIDResult", "{", "}", ",", "err", "\n", "}", "\n", "return", "MOIDForUUIDResult", "{", "UUID", ":", "uuid", ",", "MOID", ":", "vm", ".", "Reference", "(", ")", ".", "Value", ",", "}", ",", "nil", "\n", "}" ]
10,812
all-10813
[ "str", "generates", "a", "string", "version", "of", "the", "CNI", "plugin", "version", "Example", ":", "{", "version", ":", "2017", ".", "06", ".", "0", "dirty", ":", "true", "gitShortHash", ":", "226db36", "}", "=", ">" ]
[ "func", "(", "<mask>", "*", "cniPluginVersion", ")", "str", "(", ")", "string", "{", "ver", ":=", "\"", "\"", "\n", "if", "version", ".", "Dirty", "{", "ver", "=", "\"", "\"", "\n", "}", "\n", "return", "ver", "+", "version", ".", "Hash", "+", "\"", "\"", "+", "version", ".", "Version", "\n", "}" ]
10,813
all-10814
[ "warning", "log" ]
[ "func", "(", "f", "*", "FileLogger", ")", "Warn", "(", "format", "string", ",", "v", "...", "interface", "{", "}", ")", "{", "_", ",", "file", ",", "line", ",", "_", ":=", "runtime", ".", "Caller", "(", "2", ")", "//calldepth=3", "\n", "if", "f", ".", "logLevel", "<=", "WARN", "{", "f", ".", "logChan", "<-", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "shortFileName", "(", "<mask>", ")", ",", "line", ")", "+", "fmt", ".", "Sprintf", "(", "\"", "\\033", "\"", "+", "format", "+", "\"", "\\033", "\"", ",", "v", "...", ")", "\n", "}", "\n", "}" ]
10,814
all-10815
[ "VerifyBillingLags", "checks", "all", "active", "channels", "for", "billing", "lags", "and", "schedules", "suspending", "of", "those", "who", "are", "suffering", "from", "billing", "lags", "." ]
[ "func", "(", "m", "*", "Monitor", ")", "VerifyBillingLags", "(", ")", "error", "{", "// Checking billing lags.", "// All channels, that are not suspended and are not terminated,", "// but are suffering from the billing lags - must be suspended.", "<mask>", ":=", "`\n SELECT channels.id :: text\n\t\tFROM channels\n LEFT JOIN sessions ses\n ON channels.id = ses.channel\n\n LEFT JOIN offerings offer\n ON channels.offering = offer.id\n\n INNER JOIN accounts acc\n ON channels.agent = acc.eth_addr\n WHERE channels.service_status IN ('pending', 'active')\n AND channels.channel_status NOT IN ('pending')\n AND acc.in_use\n GROUP BY channels.id, offer.billing_interval,\n offer.setup_price, offer.unit_price,\n offer.max_billing_unit_lag\n HAVING COALESCE(SUM(ses.units_used), 0) /\n\t offer.billing_interval - (channels.receipt_balance - offer.setup_price ) /\n\t offer.unit_price > offer.max_billing_unit_lag;`", "\n\n", "return", "m", ".", "processEachChannel", "(", "query", ",", "m", ".", "suspendService", ")", "\n", "}" ]
10,815
all-10816
[ "NewTx", "returns", "a", "new", "transaction", "." ]
[ "func", "NewTx", "(", "name", "string", ")", "*", "tx", "{", "return", "&", "tx", "{", "Tracer", ":", "&", "NRTxTracer", "{", "}", ",", "Reporter", ":", "&", "NRTxReporter", "{", "}", ",", "<mask>", ":", "name", ",", "txnType", ":", "WebTransaction", ",", "ss", ":", "NewSegmentStack", "(", ")", ",", "mtx", ":", "&", "sync", ".", "Mutex", "{", "}", ",", "}", "\n", "}" ]
10,816
all-10817
[ "shouldDropMetricName", "returns", "whether", "the", "metric", "name", "should", "be", "dropped", "in", "the", "result", "of", "the", "op", "operation", "." ]
[ "func", "shouldDropMetricName", "(", "op", "ItemType", ")", "bool", "{", "switch", "op", "{", "case", "ItemADD", ",", "ItemSUB", ",", "ItemDIV", ",", "ItemMUL", ",", "ItemPOW", ",", "ItemMOD", ":", "return", "true", "\n", "default", ":", "return", "<mask>", "\n", "}", "\n", "}" ]
10,817
all-10818
[ "Do", "allows", "you", "to", "do", "something", "with", "a", "grpc", ".", "ClientConn", ".", "Errors", "returned", "from", "f", "will", "be", "returned", "by", "Do", "." ]
[ "func", "(", "p", "*", "Pool", ")", "Do", "(", "ctx", "context", ".", "Context", ",", "f", "func", "(", "cc", "*", "grpc", ".", "ClientConn", ")", "error", ")", "error", "{", "var", "conn", "*", "connCount", "\n", "if", "err", ":=", "func", "(", ")", "error", "{", "p", ".", "connsLock", ".", "Lock", "(", ")", "\n", "defer", "p", ".", "connsLock", ".", "Unlock", "(", ")", "\n", "for", "{", "for", "addr", ",", "mapConn", ":=", "range", "p", ".", "conns", "{", "if", "mapConn", ".", "cc", "==", "nil", "{", "cc", ",", "err", ":=", "grpc", ".", "DialContext", "(", "ctx", ",", "addr", ",", "p", ".", "opts", "...", ")", "\n", "if", "err", "!=", "nil", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "addr", ",", "err", ")", "\n", "}", "\n", "mapConn", ".", "cc", "=", "cc", "\n", "conn", "=", "mapConn", "\n", "// We break because this conn has a count of 0 which we know", "// we're not beating", "break", "\n", "}", "else", "{", "mapConnCount", ":=", "atomic", ".", "LoadInt64", "(", "&", "mapConn", ".", "count", ")", "\n", "if", "mapConnCount", "<", "p", ".", "queueSize", "&&", "(", "conn", "==", "nil", "||", "mapConnCount", "<", "atomic", ".", "LoadInt64", "(", "&", "<mask>", ".", "count", ")", ")", "{", "conn", "=", "mapConn", "\n", "}", "\n", "}", "\n", "}", "\n", "if", "conn", "==", "nil", "{", "p", ".", "connsCond", ".", "Wait", "(", ")", "\n", "}", "else", "{", "atomic", ".", "AddInt64", "(", "&", "conn", ".", "count", ",", "1", ")", "\n", "break", "\n", "}", "\n", "}", "\n", "return", "nil", "\n", "}", "(", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "defer", "p", ".", "connsCond", ".", "Broadcast", "(", ")", "\n", "defer", "atomic", ".", "AddInt64", "(", "&", "conn", ".", "count", ",", "-", "1", ")", "\n", "return", "f", "(", "conn", ".", "cc", ")", "\n", "}" ]
10,818
all-10819
[ "expandHostNetworkSecurityPolicy", "reads", "certain", "ResourceData", "keys", "and", "returns", "a", "HostNetworkSecurityPolicy", "." ]
[ "func", "expandHostNetworkSecurityPolicy", "(", "d", "*", "schema", ".", "ResourceData", ")", "*", "types", ".", "HostNetworkSecurityPolicy", "{", "obj", ":=", "&", "types", ".", "HostNetworkSecurityPolicy", "{", "}", "\n", "if", "v", ",", "ok", ":=", "d", ".", "GetOkExists", "(", "\"", "\"", ")", ";", "<mask>", "{", "obj", ".", "AllowPromiscuous", "=", "structure", ".", "BoolPtr", "(", "v", ".", "(", "bool", ")", ")", "\n", "}", "\n", "if", "v", ",", "ok", ":=", "d", ".", "GetOkExists", "(", "\"", "\"", ")", ";", "ok", "{", "obj", ".", "ForgedTransmits", "=", "structure", ".", "BoolPtr", "(", "v", ".", "(", "bool", ")", ")", "\n", "}", "\n", "if", "v", ",", "ok", ":=", "d", ".", "GetOkExists", "(", "\"", "\"", ")", ";", "ok", "{", "obj", ".", "MacChanges", "=", "structure", ".", "BoolPtr", "(", "v", ".", "(", "bool", ")", ")", "\n", "}", "\n", "return", "obj", "\n", "}" ]
10,819
all-10820
[ "AppendCertEmbed", "does", "the", "same", "as", "AppendCert", "but", "using", "in", "-", "memory", "data", "." ]
[ "func", "(", "s", "*", "Server", ")", "AppendCertEmbed", "(", "certData", ",", "keyData", "[", "]", "<mask>", ")", "error", "{", "if", "len", "(", "certData", ")", "==", "0", "&&", "len", "(", "keyData", ")", "==", "0", "{", "return", "errNoCertOrKeyProvided", "\n", "}", "\n\n", "cert", ",", "err", ":=", "tls", ".", "X509KeyPair", "(", "certData", ",", "keyData", ")", "\n", "if", "err", "!=", "nil", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "len", "(", "certData", ")", ",", "len", "(", "keyData", ")", ",", "err", ")", "\n", "}", "\n\n", "s", ".", "configTLS", "(", ")", "\n\n", "s", ".", "tlsConfig", ".", "Certificates", "=", "append", "(", "s", ".", "tlsConfig", ".", "Certificates", ",", "cert", ")", "\n", "return", "nil", "\n", "}" ]
10,820
all-10821
[ "PartialSuccess", "is", "an", "option", "that", "toggles", "whether", "or", "not", "to", "write", "partial", "log", "entries", "." ]
[ "func", "PartialSuccess", "(", "<mask>", "bool", ")", "Option", "{", "return", "func", "(", "sh", "*", "StackdriverHook", ")", "error", "{", "sh", ".", "partialSuccess", "=", "enabled", "\n", "return", "nil", "\n", "}", "\n", "}" ]
10,821
all-10822
[ "restoreBuildFilesInRepo", "copies", "BUILD", ".", "in", "and", "BUILD", ".", "bazel", ".", "in", "files", "and", "copies", "them", "to", "BUILD", "and", "BUILD", ".", "bazel", "." ]
[ "func", "restoreBuildFilesInRepo", "(", ")", "{", "err", ":=", "filepath", ".", "Walk", "(", "\"", "\"", ",", "func", "(", "<mask>", "string", ",", "info", "os", ".", "FileInfo", ",", "err", "error", ")", "error", "{", "if", "err", "!=", "nil", "{", "log", ".", "Print", "(", "err", ")", "\n", "return", "nil", "\n", "}", "\n", "restoreBuildFilesInDir", "(", "path", ")", "\n", "return", "nil", "\n", "}", ")", "\n", "if", "err", "!=", "nil", "{", "log", ".", "Print", "(", "err", ")", "\n", "}", "\n", "}" ]
10,822
all-10823
[ "dvsFromUUID", "gets", "a", "DVS", "object", "from", "its", "UUID", "." ]
[ "func", "dvsFromUUID", "(", "<mask>", "*", "govmomi", ".", "Client", ",", "uuid", "string", ")", "(", "*", "object", ".", "VmwareDistributedVirtualSwitch", ",", "error", ")", "{", "dvsm", ":=", "types", ".", "ManagedObjectReference", "{", "Type", ":", "\"", "\"", ",", "Value", ":", "\"", "\"", "}", "\n", "req", ":=", "&", "types", ".", "QueryDvsByUuid", "{", "This", ":", "dvsm", ",", "Uuid", ":", "uuid", ",", "}", "\n", "resp", ",", "err", ":=", "methods", ".", "QueryDvsByUuid", "(", "context", ".", "TODO", "(", ")", ",", "client", ",", "req", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "return", "dvsFromMOID", "(", "client", ",", "resp", ".", "Returnval", ".", "Reference", "(", ")", ".", "Value", ")", "\n", "}" ]
10,823
all-10824
[ "HasType", "returns", "a", "boolean", "if", "a", "field", "has", "been", "set", "." ]
[ "func", "(", "r", "*", "Recurrence", ")", "HasType", "(", ")", "bool", "{", "if", "r", "!=", "nil", "&&", "r", ".", "<mask>", "!=", "nil", "{", "return", "true", "\n", "}", "\n\n", "return", "false", "\n", "}" ]
10,824
all-10825
[ "Note", ":", "you", "must", "implement", "this", "function", "for", "your", "discovery", "implementation", "as", "part", "of", "the", "Discoverer", "interface", ".", "Here", "you", "should", "query", "your", "SD", "for", "it", "s", "list", "of", "known", "targets", "determine", "which", "of", "those", "targets", "you", "care", "about", "(", "for", "example", "which", "of", "Consuls", "known", "services", "do", "you", "want", "to", "scrape", "for", "metrics", ")", "and", "then", "send", "those", "targets", "as", "a", "target", ".", "TargetGroup", "to", "the", "ch", "channel", "." ]
[ "func", "(", "d", "*", "discovery", ")", "Run", "(", "ctx", "context", ".", "Context", ",", "ch", "chan", "<-", "[", "]", "*", "targetgroup", ".", "Group", ")", "{", "for", "c", ":=", "time", ".", "Tick", "(", "time", ".", "Duration", "(", "d", ".", "refreshInterval", ")", "*", "time", ".", "Second", ")", ";", ";", "{", "var", "srvs", "map", "[", "string", "]", "[", "]", "string", "\n", "resp", ",", "err", ":=", "http", ".", "Get", "(", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "d", ".", "address", ")", ")", "\n\n", "if", "err", "!=", "nil", "{", "level", ".", "Error", "(", "d", ".", "logger", ")", ".", "<mask>", "(", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "err", ")", "\n", "time", ".", "Sleep", "(", "time", ".", "Duration", "(", "d", ".", "refreshInterval", ")", "*", "time", ".", "Second", ")", "\n", "continue", "\n", "}", "\n\n", "dec", ":=", "json", ".", "NewDecoder", "(", "resp", ".", "Body", ")", "\n", "err", "=", "dec", ".", "Decode", "(", "&", "srvs", ")", "\n", "resp", ".", "Body", ".", "Close", "(", ")", "\n", "if", "err", "!=", "nil", "{", "level", ".", "Error", "(", "d", ".", "logger", ")", ".", "Log", "(", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "err", ")", "\n", "time", ".", "Sleep", "(", "time", ".", "Duration", "(", "d", ".", "refreshInterval", ")", "*", "time", ".", "Second", ")", "\n", "continue", "\n", "}", "\n\n", "var", "tgs", "[", "]", "*", "targetgroup", ".", "Group", "\n", "// Note that we treat errors when querying specific consul services as fatal for this", "// iteration of the time.Tick loop. It's better to have some stale targets than an incomplete", "// list of targets simply because there may have been a timeout. If the service is actually", "// gone as far as consul is concerned, that will be picked up during the next iteration of", "// the outer loop.", "newSourceList", ":=", "make", "(", "map", "[", "string", "]", "bool", ")", "\n", "for", "name", ":=", "range", "srvs", "{", "if", "name", "==", "\"", "\"", "{", "continue", "\n", "}", "\n", "resp", ",", "err", ":=", "http", ".", "Get", "(", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "d", ".", "address", ",", "name", ")", ")", "\n", "if", "err", "!=", "nil", "{", "level", ".", "Error", "(", "d", ".", "logger", ")", ".", "Log", "(", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "name", ",", "\"", "\"", ",", "err", ")", "\n", "break", "\n", "}", "\n", "tg", ",", "err", ":=", "d", ".", "parseServiceNodes", "(", "resp", ",", "name", ")", "\n", "if", "err", "!=", "nil", "{", "level", ".", "Error", "(", "d", ".", "logger", ")", ".", "Log", "(", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "name", ",", "\"", "\"", ",", "err", ")", "\n", "break", "\n", "}", "\n", "tgs", "=", "append", "(", "tgs", ",", "tg", ")", "\n", "newSourceList", "[", "tg", ".", "Source", "]", "=", "true", "\n", "}", "\n", "// When targetGroup disappear, send an update with empty targetList.", "for", "key", ":=", "range", "d", ".", "oldSourceList", "{", "if", "!", "newSourceList", "[", "key", "]", "{", "tgs", "=", "append", "(", "tgs", ",", "&", "targetgroup", ".", "Group", "{", "Source", ":", "key", ",", "}", ")", "\n", "}", "\n", "}", "\n", "d", ".", "oldSourceList", "=", "newSourceList", "\n", "if", "err", "==", "nil", "{", "// We're returning all Consul services as a single targetgroup.", "ch", "<-", "tgs", "\n", "}", "\n", "// Wait for ticker or exit when ctx is closed.", "select", "{", "case", "<-", "c", ":", "continue", "\n", "case", "<-", "ctx", ".", "Done", "(", ")", ":", "return", "\n", "}", "\n", "}", "\n", "}" ]
10,825
all-10826
[ "GetSourceType", "returns", "the", "SourceType", "field", "if", "non", "-", "nil", "zero", "value", "otherwise", "." ]
[ "func", "(", "e", "*", "<mask>", ")", "GetSourceType", "(", ")", "string", "{", "if", "e", "==", "nil", "||", "e", ".", "SourceType", "==", "nil", "{", "return", "\"", "\"", "\n", "}", "\n", "return", "*", "e", ".", "SourceType", "\n", "}" ]
10,826
all-10827
[ "Do", "executes", "Overlay", ".", "getHighlightObjectForTest", "against", "the", "provided", "context", ".", "returns", ":", "highlight", "-", "Highlight", "data", "for", "the", "node", "." ]
[ "func", "(", "p", "*", "GetHighlightObjectForTestParams", ")", "Do", "(", "ctx", "context", ".", "Context", ")", "(", "highlight", "easyjson", ".", "RawMessage", ",", "err", "error", ")", "{", "// execute", "var", "res", "GetHighlightObjectForTestReturns", "\n", "err", "=", "cdp", ".", "Execute", "(", "ctx", ",", "CommandGetHighlightObjectForTest", ",", "p", ",", "&", "res", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "return", "<mask>", ".", "Highlight", ",", "nil", "\n", "}" ]
10,827
all-10828
[ "CreateUser", "creates", "an", "user", "account", "for", "an", "email", "address" ]
[ "func", "(", "self", "*", "Client", ")", "CreateUser", "(", "handle", ",", "name", "*", "string", ")", "(", "*", "User", ",", "error", ")", "{", "in", ":=", "struct", "{", "Handle", "*", "string", "`json:\"handle\"`", "\n", "Name", "*", "string", "`json:\"name\"`", "\n", "}", "{", "Handle", ":", "handle", ",", "Name", ":", "name", ",", "}", "\n\n", "out", ":=", "struct", "{", "*", "User", "`json:\"user\"`", "\n", "}", "{", "}", "\n", "if", "err", ":=", "self", ".", "doJsonRequest", "(", "\"", "\"", ",", "\"", "\"", ",", "in", ",", "&", "<mask>", ")", ";", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "return", "out", ".", "User", ",", "nil", "\n", "}" ]
10,828
all-10829
[ "NewQueryStats", "makes", "a", "QueryStats", "struct", "with", "all", "QueryTimings", "found", "in", "the", "given", "TimerGroup", "." ]
[ "func", "NewQueryStats", "(", "tg", "*", "QueryTimers", ")", "*", "QueryStats", "{", "var", "qt", "queryTimings", "\n\n", "for", "s", ",", "timer", ":=", "range", "tg", ".", "TimerGroup", ".", "timers", "{", "switch", "s", "{", "case", "EvalTotalTime", ":", "qt", ".", "EvalTotalTime", "=", "timer", ".", "Duration", "(", ")", "\n", "case", "ResultSortTime", ":", "qt", ".", "ResultSortTime", "=", "timer", ".", "Duration", "(", ")", "\n", "case", "QueryPreparationTime", ":", "qt", ".", "QueryPreparationTime", "=", "timer", ".", "Duration", "(", ")", "\n", "case", "InnerEvalTime", ":", "qt", ".", "InnerEvalTime", "=", "timer", ".", "Duration", "(", ")", "\n", "case", "ExecQueueTime", ":", "qt", ".", "ExecQueueTime", "=", "timer", ".", "Duration", "(", ")", "\n", "<mask>", "ExecTotalTime", ":", "qt", ".", "ExecTotalTime", "=", "timer", ".", "Duration", "(", ")", "\n", "}", "\n", "}", "\n\n", "qs", ":=", "QueryStats", "{", "Timings", ":", "qt", "}", "\n", "return", "&", "qs", "\n", "}" ]
10,829
all-10830
[ "UpdateService", "updates", "the", "specified", "service", "with", "information", "from", "provided", "endpoint", "." ]
[ "func", "(", "p", "*", "AWSSDProvider", ")", "UpdateService", "(", "<mask>", "*", "sd", ".", "Service", ",", "ep", "*", "endpoint", ".", "Endpoint", ")", "error", "{", "log", ".", "Infof", "(", "\"", "\\\"", "\\\"", "\"", ",", "*", "service", ".", "Name", ")", "\n\n", "srvType", ":=", "p", ".", "serviceTypeFromEndpoint", "(", "ep", ")", "\n\n", "ttl", ":=", "int64", "(", "sdDefaultRecordTTL", ")", "\n", "if", "ep", ".", "RecordTTL", ".", "IsConfigured", "(", ")", "{", "ttl", "=", "int64", "(", "ep", ".", "RecordTTL", ")", "\n", "}", "\n\n", "if", "!", "p", ".", "dryRun", "{", "_", ",", "err", ":=", "p", ".", "client", ".", "UpdateService", "(", "&", "sd", ".", "UpdateServiceInput", "{", "Id", ":", "service", ".", "Id", ",", "Service", ":", "&", "sd", ".", "ServiceChange", "{", "Description", ":", "aws", ".", "String", "(", "ep", ".", "Labels", "[", "endpoint", ".", "AWSSDDescriptionLabel", "]", ")", ",", "DnsConfig", ":", "&", "sd", ".", "DnsConfigChange", "{", "DnsRecords", ":", "[", "]", "*", "sd", ".", "DnsRecord", "{", "{", "Type", ":", "aws", ".", "String", "(", "srvType", ")", ",", "TTL", ":", "aws", ".", "Int64", "(", "ttl", ")", ",", "}", "}", ",", "}", "}", "}", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "}", "\n\n", "return", "nil", "\n", "}" ]
10,830
all-10831
[ "writeRequests", "is", "called", "serially", "by", "only", "one", "goroutine", "." ]
[ "func", "(", "db", "*", "DB", ")", "writeRequests", "(", "reqs", "[", "]", "*", "request", ")", "error", "{", "if", "len", "(", "reqs", ")", "==", "0", "{", "return", "nil", "\n", "}", "\n\n", "done", ":=", "func", "(", "err", "error", ")", "{", "for", "_", ",", "r", ":=", "range", "reqs", "{", "r", ".", "Err", "=", "err", "\n", "r", ".", "Wg", ".", "Done", "(", ")", "\n", "}", "\n", "}", "\n", "db", ".", "elog", ".", "Printf", "(", "\"", "\"", ")", "\n\n", "err", ":=", "db", ".", "vlog", ".", "write", "(", "reqs", ")", "\n", "if", "err", "!=", "nil", "{", "done", "(", "err", ")", "\n", "return", "err", "\n", "}", "\n\n", "db", ".", "elog", ".", "Printf", "(", "\"", "\"", ")", "\n", "var", "<mask>", "int", "\n", "for", "_", ",", "b", ":=", "range", "reqs", "{", "if", "len", "(", "b", ".", "Entries", ")", "==", "0", "{", "continue", "\n", "}", "\n", "count", "+=", "len", "(", "b", ".", "Entries", ")", "\n", "var", "i", "uint64", "\n", "for", "err", "=", "db", ".", "ensureRoomForWrite", "(", ")", ";", "err", "==", "errNoRoom", ";", "err", "=", "db", ".", "ensureRoomForWrite", "(", ")", "{", "i", "++", "\n", "if", "i", "%", "100", "==", "0", "{", "db", ".", "elog", ".", "Printf", "(", "\"", "\"", ")", "\n", "}", "\n", "// We need to poll a bit because both hasRoomForWrite and the flusher need access to s.imm.", "// When flushChan is full and you are blocked there, and the flusher is trying to update s.imm,", "// you will get a deadlock.", "time", ".", "Sleep", "(", "10", "*", "time", ".", "Millisecond", ")", "\n", "}", "\n", "if", "err", "!=", "nil", "{", "done", "(", "err", ")", "\n", "return", "errors", ".", "Wrap", "(", "err", ",", "\"", "\"", ")", "\n", "}", "\n", "if", "err", ":=", "db", ".", "writeToLSM", "(", "b", ")", ";", "err", "!=", "nil", "{", "done", "(", "err", ")", "\n", "return", "errors", ".", "Wrap", "(", "err", ",", "\"", "\"", ")", "\n", "}", "\n", "db", ".", "updateHead", "(", "b", ".", "Ptrs", ")", "\n", "}", "\n", "done", "(", "nil", ")", "\n", "db", ".", "elog", ".", "Printf", "(", "\"", "\"", ",", "count", ")", "\n", "return", "nil", "\n", "}" ]
10,831
all-10832
[ "startACSSession", "starts", "a", "session", "with", "ACS", ".", "It", "adds", "request", "handlers", "for", "various", "kinds", "of", "messages", "expected", "from", "ACS", ".", "It", "returns", "on", "server", "disconnection", "or", "when", "the", "context", "is", "cancelled" ]
[ "func", "(", "acsSession", "*", "session", ")", "startACSSession", "(", "client", "wsclient", ".", "ClientServer", ")", "error", "{", "cfg", ":=", "acsSession", ".", "agentConfig", "\n\n", "refreshCredsHandler", ":=", "newRefreshCredentialsHandler", "(", "acsSession", ".", "ctx", ",", "cfg", ".", "Cluster", ",", "acsSession", ".", "containerInstanceARN", ",", "client", ",", "acsSession", ".", "credentialsManager", ",", "acsSession", ".", "taskEngine", ")", "\n", "defer", "refreshCredsHandler", ".", "clearAcks", "(", ")", "\n", "refreshCredsHandler", ".", "start", "(", ")", "\n", "defer", "refreshCredsHandler", ".", "stop", "(", ")", "\n\n", "<mask>", ".", "AddRequestHandler", "(", "refreshCredsHandler", ".", "handlerFunc", "(", ")", ")", "\n\n", "// Add handler to ack ENI attach message", "eniAttachHandler", ":=", "newAttachENIHandler", "(", "acsSession", ".", "ctx", ",", "cfg", ".", "Cluster", ",", "acsSession", ".", "containerInstanceARN", ",", "client", ",", "acsSession", ".", "state", ",", "acsSession", ".", "stateManager", ",", ")", "\n", "eniAttachHandler", ".", "start", "(", ")", "\n", "defer", "eniAttachHandler", ".", "stop", "(", ")", "\n\n", "client", ".", "AddRequestHandler", "(", "eniAttachHandler", ".", "handlerFunc", "(", ")", ")", "\n\n", "// Add request handler for handling payload messages from ACS", "payloadHandler", ":=", "newPayloadRequestHandler", "(", "acsSession", ".", "ctx", ",", "acsSession", ".", "taskEngine", ",", "acsSession", ".", "ecsClient", ",", "cfg", ".", "Cluster", ",", "acsSession", ".", "containerInstanceARN", ",", "client", ",", "acsSession", ".", "stateManager", ",", "refreshCredsHandler", ",", "acsSession", ".", "credentialsManager", ",", "acsSession", ".", "taskHandler", ")", "\n", "// Clear the acks channel on return because acks of messageids don't have any value across sessions", "defer", "payloadHandler", ".", "clearAcks", "(", ")", "\n", "payloadHandler", ".", "start", "(", ")", "\n", "defer", "payloadHandler", ".", "stop", "(", ")", "\n\n", "client", ".", "AddRequestHandler", "(", "payloadHandler", ".", "handlerFunc", "(", ")", ")", "\n\n", "// Ignore heartbeat messages; anyMessageHandler gets 'em", "client", ".", "AddRequestHandler", "(", "func", "(", "*", "ecsacs", ".", "HeartbeatMessage", ")", "{", "}", ")", "\n\n", "updater", ".", "AddAgentUpdateHandlers", "(", "client", ",", "cfg", ",", "acsSession", ".", "stateManager", ",", "acsSession", ".", "taskEngine", ")", "\n\n", "err", ":=", "client", ".", "Connect", "(", ")", "\n", "if", "err", "!=", "nil", "{", "seelog", ".", "Errorf", "(", "\"", "\"", ",", "err", ")", "\n", "return", "err", "\n", "}", "\n", "seelog", ".", "Info", "(", "\"", "\"", ")", "\n", "// Start inactivity timer for closing the connection", "timer", ":=", "newDisconnectionTimer", "(", "client", ",", "acsSession", ".", "heartbeatTimeout", "(", ")", ",", "acsSession", ".", "heartbeatJitter", "(", ")", ")", "\n", "// Any message from the server resets the disconnect timeout", "client", ".", "SetAnyRequestHandler", "(", "anyMessageHandler", "(", "timer", ",", "client", ")", ")", "\n", "defer", "timer", ".", "Stop", "(", ")", "\n\n", "acsSession", ".", "resources", ".", "connectedToACS", "(", ")", "\n\n", "backoffResetTimer", ":=", "time", ".", "AfterFunc", "(", "retry", ".", "AddJitter", "(", "acsSession", ".", "heartbeatTimeout", "(", ")", ",", "acsSession", ".", "heartbeatJitter", "(", ")", ")", ",", "func", "(", ")", "{", "// If we do not have an error connecting and remain connected for at", "// least 1 or so minutes, reset the backoff. This prevents disconnect", "// errors that only happen infrequently from damaging the reconnect", "// delay as significantly.", "acsSession", ".", "backoff", ".", "Reset", "(", ")", "\n", "}", ")", "\n", "defer", "backoffResetTimer", ".", "Stop", "(", ")", "\n\n", "serveErr", ":=", "make", "(", "chan", "error", ",", "1", ")", "\n", "go", "func", "(", ")", "{", "serveErr", "<-", "client", ".", "Serve", "(", ")", "\n", "}", "(", ")", "\n\n", "for", "{", "select", "{", "case", "<-", "acsSession", ".", "ctx", ".", "Done", "(", ")", ":", "// Stop receiving and sending messages from and to ACS when", "// the context received from the main function is canceled", "return", "acsSession", ".", "ctx", ".", "Err", "(", ")", "\n", "case", "err", ":=", "<-", "serveErr", ":", "// Stop receiving and sending messages from and to ACS when", "// client.Serve returns an error. This can happen when the", "// the connection is closed by ACS or the agent", "return", "err", "\n", "}", "\n", "}", "\n", "}" ]
10,832
all-10833
[ "HandleResolvedAddrs", "implements", "grpc", "/", "balancer", ".", "Balancer", "interface", ".", "gRPC", "sends", "initial", "or", "updated", "resolved", "addresses", "from", "Build", "." ]
[ "func", "(", "bb", "*", "baseBalancer", ")", "HandleResolvedAddrs", "(", "addrs", "[", "]", "resolver", ".", "<mask>", ",", "err", "error", ")", "{", "if", "err", "!=", "nil", "{", "bb", ".", "lg", ".", "Warn", "(", "\"", "\"", ",", "zap", ".", "String", "(", "\"", "\"", ",", "bb", ".", "id", ")", ",", "zap", ".", "Error", "(", "err", ")", ")", "\n", "return", "\n", "}", "\n", "bb", ".", "lg", ".", "Info", "(", "\"", "\"", ",", "zap", ".", "String", "(", "\"", "\"", ",", "bb", ".", "id", ")", ",", "zap", ".", "Strings", "(", "\"", "\"", ",", "addrsToStrings", "(", "addrs", ")", ")", ")", "\n\n", "bb", ".", "mu", ".", "Lock", "(", ")", "\n", "defer", "bb", ".", "mu", ".", "Unlock", "(", ")", "\n\n", "resolved", ":=", "make", "(", "map", "[", "resolver", ".", "Address", "]", "struct", "{", "}", ")", "\n", "for", "_", ",", "addr", ":=", "range", "addrs", "{", "resolved", "[", "addr", "]", "=", "struct", "{", "}", "{", "}", "\n", "if", "_", ",", "ok", ":=", "bb", ".", "addrToSc", "[", "addr", "]", ";", "!", "ok", "{", "sc", ",", "err", ":=", "bb", ".", "currentConn", ".", "NewSubConn", "(", "[", "]", "resolver", ".", "Address", "{", "addr", "}", ",", "balancer", ".", "NewSubConnOptions", "{", "}", ")", "\n", "if", "err", "!=", "nil", "{", "bb", ".", "lg", ".", "Warn", "(", "\"", "\"", ",", "zap", ".", "String", "(", "\"", "\"", ",", "bb", ".", "id", ")", ",", "zap", ".", "Error", "(", "err", ")", ",", "zap", ".", "String", "(", "\"", "\"", ",", "addr", ".", "Addr", ")", ")", "\n", "continue", "\n", "}", "\n", "bb", ".", "addrToSc", "[", "addr", "]", "=", "sc", "\n", "bb", ".", "scToAddr", "[", "sc", "]", "=", "addr", "\n", "bb", ".", "scToSt", "[", "sc", "]", "=", "connectivity", ".", "Idle", "\n", "sc", ".", "Connect", "(", ")", "\n", "}", "\n", "}", "\n\n", "for", "addr", ",", "sc", ":=", "range", "bb", ".", "addrToSc", "{", "if", "_", ",", "ok", ":=", "resolved", "[", "addr", "]", ";", "!", "ok", "{", "// was removed by resolver or failed to create subconn", "bb", ".", "currentConn", ".", "RemoveSubConn", "(", "sc", ")", "\n", "delete", "(", "bb", ".", "addrToSc", ",", "addr", ")", "\n\n", "bb", ".", "lg", ".", "Info", "(", "\"", "\"", ",", "zap", ".", "String", "(", "\"", "\"", ",", "bb", ".", "id", ")", ",", "zap", ".", "String", "(", "\"", "\"", ",", "addr", ".", "Addr", ")", ",", "zap", ".", "String", "(", "\"", "\"", ",", "scToString", "(", "sc", ")", ")", ",", ")", "\n\n", "// Keep the state of this sc in bb.scToSt until sc's state becomes Shutdown.", "// The entry will be deleted in HandleSubConnStateChange.", "// (DO NOT) delete(bb.scToAddr, sc)", "// (DO NOT) delete(bb.scToSt, sc)", "}", "\n", "}", "\n", "}" ]
10,833
all-10834
[ "storagePoolVolumeSnapshotsGet", "returns", "a", "list", "of", "snapshots", "of", "the", "form", "<volume", ">", "/", "<snapshot", "-", "name", ">", "." ]
[ "func", "storagePoolVolumeSnapshotsGet", "(", "s", "*", "<mask>", ".", "State", ",", "pool", "string", ",", "volume", "string", ",", "volType", "int", ")", "(", "[", "]", "string", ",", "error", ")", "{", "poolID", ",", "err", ":=", "s", ".", "Cluster", ".", "StoragePoolGetID", "(", "pool", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "snapshots", ",", "err", ":=", "s", ".", "Cluster", ".", "StoragePoolVolumeSnapshotsGetType", "(", "volume", ",", "volType", ",", "poolID", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "return", "snapshots", ",", "nil", "\n", "}" ]
10,834
all-10835
[ "NextCreatePipelineRequest", "gets", "the", "next", "request", "from", "the", "manifest", "reader", "." ]
[ "func", "(", "r", "*", "PipelineManifestReader", ")", "NextCreatePipelineRequest", "(", ")", "(", "*", "ppsclient", ".", "CreatePipelineRequest", ",", "error", ")", "{", "var", "result", "ppsclient", ".", "CreatePipelineRequest", "\n", "if", "err", ":=", "jsonpb", ".", "UnmarshalNext", "(", "r", ".", "decoder", ",", "&", "result", ")", ";", "err", "!=", "nil", "{", "if", "err", "==", "io", ".", "EOF", "{", "return", "nil", ",", "err", "\n", "}", "\n", "return", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "err", ")", "\n", "}", "\n", "return", "&", "<mask>", ",", "nil", "\n", "}" ]
10,835
all-10836
[ "Update", "takes", "the", "representation", "of", "a", "prowJob", "and", "updates", "it", ".", "Returns", "the", "server", "s", "representation", "of", "the", "prowJob", "and", "an", "error", "if", "there", "is", "any", "." ]
[ "func", "(", "c", "*", "FakeProwJobs", ")", "Update", "(", "prowJob", "*", "prowjobsv1", ".", "ProwJob", ")", "(", "result", "*", "prowjobsv1", ".", "ProwJob", ",", "err", "error", ")", "{", "obj", ",", "err", ":=", "c", ".", "Fake", ".", "Invokes", "(", "testing", ".", "NewUpdateAction", "(", "prowjobsResource", ",", "c", ".", "<mask>", ",", "prowJob", ")", ",", "&", "prowjobsv1", ".", "ProwJob", "{", "}", ")", "\n\n", "if", "obj", "==", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "return", "obj", ".", "(", "*", "prowjobsv1", ".", "ProwJob", ")", ",", "err", "\n", "}" ]
10,836
all-10837
[ "DefinedContainer", "returns", "true", "if", "the", "container", "is", "defined", "in", "MAAS" ]
[ "func", "(", "c", "*", "Controller", ")", "DefinedContainer", "(", "name", "string", ")", "(", "bool", ",", "error", ")", "{", "devs", ",", "err", ":=", "c", ".", "machine", ".", "Devices", "(", "gomaasapi", ".", "DevicesArgs", "{", "Hostname", ":", "[", "]", "string", "{", "name", "}", "}", ")", "\n", "if", "err", "!=", "nil", "{", "return", "false", ",", "err", "\n", "}", "\n\n", "if", "len", "(", "devs", ")", "==", "1", "{", "return", "<mask>", ",", "nil", "\n", "}", "\n\n", "return", "false", ",", "nil", "\n", "}" ]
10,837
all-10838
[ "/", "*", "This", "is", "used", "for", "both", "profiles", "post", "and", "profile", "put" ]
[ "func", "profilesGet", "(", "d", "*", "Daemon", ",", "r", "*", "http", ".", "Request", ")", "Response", "{", "project", ":=", "projectParam", "(", "r", ")", "\n\n", "recursion", ":=", "util", ".", "IsRecursionRequest", "(", "r", ")", "\n\n", "var", "result", "interface", "{", "}", "\n", "err", ":=", "d", ".", "cluster", ".", "Transaction", "(", "func", "(", "tx", "*", "db", ".", "ClusterTx", ")", "error", "{", "hasProfiles", ",", "err", ":=", "tx", ".", "ProjectHasProfiles", "(", "project", ")", "\n", "if", "err", "!=", "nil", "{", "return", "errors", ".", "Wrap", "(", "err", ",", "\"", "\"", ")", "\n", "}", "\n\n", "if", "!", "hasProfiles", "{", "project", "=", "\"", "\"", "\n", "}", "\n\n", "filter", ":=", "db", ".", "ProfileFilter", "{", "Project", ":", "project", ",", "}", "\n", "if", "recursion", "{", "profiles", ",", "err", ":=", "<mask>", ".", "ProfileList", "(", "filter", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "apiProfiles", ":=", "make", "(", "[", "]", "*", "api", ".", "Profile", ",", "len", "(", "profiles", ")", ")", "\n", "for", "i", ",", "profile", ":=", "range", "profiles", "{", "apiProfiles", "[", "i", "]", "=", "db", ".", "ProfileToAPI", "(", "&", "profile", ")", "\n", "}", "\n\n", "result", "=", "apiProfiles", "\n", "}", "else", "{", "result", ",", "err", "=", "tx", ".", "ProfileURIs", "(", "filter", ")", "\n", "}", "\n", "return", "err", "\n", "}", ")", "\n", "if", "err", "!=", "nil", "{", "return", "SmartError", "(", "err", ")", "\n", "}", "\n\n", "return", "SyncResponse", "(", "true", ",", "result", ")", "\n", "}" ]
10,838
all-10839
[ "resourceVSphereDatastoreClusterSaveNameAndPath", "saves", "the", "name", "and", "path", "of", "a", "StoragePod", "into", "the", "supplied", "ResourceData", "." ]
[ "func", "resourceVSphereDatastoreClusterSaveNameAndPath", "(", "d", "*", "schema", ".", "ResourceData", ",", "pod", "*", "object", ".", "StoragePod", ")", "error", "{", "<mask>", ".", "Printf", "(", "\"", "\"", ",", "resourceVSphereDatastoreClusterIDString", "(", "d", ")", ",", "pod", ".", "InventoryPath", ",", ")", "\n\n", "if", "err", ":=", "d", ".", "Set", "(", "\"", "\"", ",", "pod", ".", "Name", "(", ")", ")", ";", "err", "!=", "nil", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "err", ")", "\n", "}", "\n\n", "f", ",", "err", ":=", "folder", ".", "RootPathParticleDatastore", ".", "SplitRelativeFolder", "(", "pod", ".", "InventoryPath", ")", "\n", "if", "err", "!=", "nil", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "pod", ".", "InventoryPath", ",", "err", ")", "\n", "}", "\n", "if", "err", ":=", "d", ".", "Set", "(", "\"", "\"", ",", "folder", ".", "NormalizePath", "(", "f", ")", ")", ";", "err", "!=", "nil", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "err", ")", "\n", "}", "\n", "return", "nil", "\n", "}" ]
10,839
all-10840
[ "GetCreator", "returns", "the", "Creator", "field", "if", "non", "-", "nil", "zero", "value", "otherwise", "." ]
[ "func", "(", "m", "*", "Monitor", ")", "GetCreator", "(", ")", "Creator", "{", "if", "m", "==", "nil", "||", "m", ".", "Creator", "==", "nil", "{", "<mask>", "Creator", "{", "}", "\n", "}", "\n", "return", "*", "m", ".", "Creator", "\n", "}" ]
10,840
all-10841
[ "Validate", "ensures", "all", "the", "values", "set", "in", "the", "GCSConfiguration", "are", "valid", "." ]
[ "func", "(", "g", "*", "GCSConfiguration", ")", "Validate", "(", ")", "error", "{", "if", "g", ".", "PathStrategy", "!=", "PathStrategyLegacy", "&&", "g", ".", "PathStrategy", "!=", "PathStrategyExplicit", "&&", "g", ".", "PathStrategy", "!=", "PathStrategySingle", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "PathStrategyLegacy", ",", "PathStrategyExplicit", ",", "PathStrategySingle", ")", "\n", "}", "\n", "if", "g", ".", "PathStrategy", "!=", "PathStrategyExplicit", "&&", "(", "g", ".", "DefaultOrg", "==", "\"", "\"", "||", "g", ".", "DefaultRepo", "==", "\"", "\"", ")", "{", "<mask>", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "g", ".", "PathStrategy", ")", "\n", "}", "\n", "return", "nil", "\n", "}" ]
10,841
all-10842
[ "DropPort", "drops", "all", "tcp", "packets", "that", "are", "received", "from", "the", "given", "port", "and", "sent", "to", "the", "given", "port", "." ]
[ "func", "DropPort", "(", "port", "int", ")", "error", "{", "cmdStr", ":=", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "<mask>", ")", "\n", "if", "_", ",", "err", ":=", "exec", ".", "Command", "(", "\"", "\"", ",", "\"", "\"", ",", "cmdStr", ")", ".", "Output", "(", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "cmdStr", "=", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "port", ")", "\n", "_", ",", "err", ":=", "exec", ".", "Command", "(", "\"", "\"", ",", "\"", "\"", ",", "cmdStr", ")", ".", "Output", "(", ")", "\n", "return", "err", "\n", "}" ]
10,842
all-10843
[ "SearchGraphs", "returns", "graphs", "matching", "the", "specified", "search", "query", "and", "/", "or", "filter", ".", "If", "nil", "is", "passed", "for", "both", "parameters", "all", "graphs", "will", "be", "returned", "." ]
[ "func", "(", "a", "*", "API", ")", "SearchGraphs", "(", "searchCriteria", "*", "SearchQueryType", ",", "filterCriteria", "*", "SearchFilterType", ")", "(", "*", "[", "]", "<mask>", ",", "error", ")", "{", "q", ":=", "url", ".", "Values", "{", "}", "\n\n", "if", "searchCriteria", "!=", "nil", "&&", "*", "searchCriteria", "!=", "\"", "\"", "{", "q", ".", "Set", "(", "\"", "\"", ",", "string", "(", "*", "searchCriteria", ")", ")", "\n", "}", "\n\n", "if", "filterCriteria", "!=", "nil", "&&", "len", "(", "*", "filterCriteria", ")", ">", "0", "{", "for", "filter", ",", "criteria", ":=", "range", "*", "filterCriteria", "{", "for", "_", ",", "val", ":=", "range", "criteria", "{", "q", ".", "Add", "(", "filter", ",", "val", ")", "\n", "}", "\n", "}", "\n", "}", "\n\n", "if", "q", ".", "Encode", "(", ")", "==", "\"", "\"", "{", "return", "a", ".", "FetchGraphs", "(", ")", "\n", "}", "\n\n", "reqURL", ":=", "url", ".", "URL", "{", "Path", ":", "config", ".", "GraphPrefix", ",", "RawQuery", ":", "q", ".", "Encode", "(", ")", ",", "}", "\n\n", "result", ",", "err", ":=", "a", ".", "Get", "(", "reqURL", ".", "String", "(", ")", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "err", ")", "\n", "}", "\n\n", "var", "graphs", "[", "]", "Graph", "\n", "if", "err", ":=", "json", ".", "Unmarshal", "(", "result", ",", "&", "graphs", ")", ";", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "return", "&", "graphs", ",", "nil", "\n", "}" ]
10,843
all-10844
[ "Select", "returns", "a", "set", "of", "series", "that", "matches", "the", "given", "label", "matchers", "." ]
[ "func", "(", "q", "*", "mergeQuerier", ")", "Select", "(", "params", "*", "SelectParams", ",", "matchers", "...", "*", "labels", ".", "Matcher", ")", "(", "SeriesSet", ",", "Warnings", ",", "error", ")", "{", "seriesSets", ":=", "make", "(", "[", "]", "SeriesSet", ",", "0", ",", "len", "(", "q", ".", "queriers", ")", ")", "\n", "<mask>", "warnings", "Warnings", "\n", "for", "_", ",", "querier", ":=", "range", "q", ".", "queriers", "{", "set", ",", "wrn", ",", "err", ":=", "querier", ".", "Select", "(", "params", ",", "matchers", "...", ")", "\n", "q", ".", "setQuerierMap", "[", "set", "]", "=", "querier", "\n", "if", "wrn", "!=", "nil", "{", "warnings", "=", "append", "(", "warnings", ",", "wrn", "...", ")", "\n", "}", "\n", "if", "err", "!=", "nil", "{", "q", ".", "failedQueriers", "[", "querier", "]", "=", "struct", "{", "}", "{", "}", "\n", "// If the error source isn't the primary querier, return the error as a warning and continue.", "if", "querier", "!=", "q", ".", "primaryQuerier", "{", "warnings", "=", "append", "(", "warnings", ",", "err", ")", "\n", "continue", "\n", "}", "else", "{", "return", "nil", ",", "nil", ",", "err", "\n", "}", "\n", "}", "\n", "seriesSets", "=", "append", "(", "seriesSets", ",", "set", ")", "\n", "}", "\n", "return", "NewMergeSeriesSet", "(", "seriesSets", ",", "q", ")", ",", "warnings", ",", "nil", "\n", "}" ]
10,844
all-10845
[ "DeepCopy", "is", "an", "autogenerated", "deepcopy", "function", "copying", "the", "receiver", "creating", "a", "new", "ProwJobList", "." ]
[ "func", "(", "in", "*", "ProwJobList", ")", "DeepCopy", "(", ")", "*", "ProwJobList", "{", "if", "in", "==", "nil", "{", "return", "nil", "\n", "}", "\n", "out", ":=", "new", "(", "ProwJobList", ")", "\n", "<mask>", ".", "DeepCopyInto", "(", "out", ")", "\n", "return", "out", "\n", "}" ]
10,845
all-10846
[ "prowjobStateToGitHubStatus", "maps", "prowjob", "status", "to", "github", "states", ".", "GitHub", "states", "can", "be", "one", "of", "error", "failure", "pending", "or", "success", ".", "https", ":", "//", "developer", ".", "github", ".", "com", "/", "v3", "/", "repos", "/", "statuses", "/", "#create", "-", "a", "-", "status" ]
[ "func", "prowjobStateToGitHubStatus", "(", "pjState", "prowapi", ".", "ProwJobState", ")", "(", "string", ",", "error", ")", "{", "switch", "pjState", "{", "case", "prowapi", ".", "TriggeredState", ":", "return", "github", ".", "StatusPending", ",", "nil", "\n", "case", "prowapi", ".", "PendingState", ":", "return", "github", ".", "StatusPending", ",", "nil", "\n", "<mask>", "prowapi", ".", "SuccessState", ":", "return", "github", ".", "StatusSuccess", ",", "nil", "\n", "case", "prowapi", ".", "ErrorState", ":", "return", "github", ".", "StatusError", ",", "nil", "\n", "case", "prowapi", ".", "FailureState", ":", "return", "github", ".", "StatusFailure", ",", "nil", "\n", "case", "prowapi", ".", "AbortedState", ":", "return", "github", ".", "StatusFailure", ",", "nil", "\n", "}", "\n", "return", "\"", "\"", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "pjState", ")", "\n", "}" ]
10,846
all-10847
[ "replaceRecord", "replaces", "all", "existing", "records", "pf", "the", "given", "type", "for", "the", "Endpoint", ".", "DNSName", "with", "1", "API", "call" ]
[ "func", "(", "d", "*", "dynProviderState", ")", "replaceRecord", "(", "client", "*", "dynect", ".", "Client", ",", "ep", "*", "endpoint", ".", "Endpoint", ")", "error", "{", "link", ",", "record", ":=", "d", ".", "buildRecordRequest", "(", "ep", ")", "\n", "if", "link", "==", "\"", "\"", "{", "return", "nil", "\n", "}", "\n\n", "response", ":=", "dynect", ".", "RecordResponse", "{", "}", "\n", "err", ":=", "apiRetryLoop", "(", "func", "(", ")", "error", "{", "return", "client", ".", "Do", "(", "\"", "\"", ",", "<mask>", ",", "record", ",", "&", "response", ")", "\n", "}", ")", "\n\n", "log", ".", "Debugf", "(", "\"", "\"", ",", "link", ",", "errorOrValue", "(", "err", ",", "&", "response", ")", ")", "\n", "return", "err", "\n", "}" ]
10,847
all-10848
[ "Allows", "CORS", "for", "requests", "those", "match", "the", "provided", "options", "." ]
[ "func", "Allow", "(", "opts", "*", "Options", ")", "http", ".", "HandlerFunc", "{", "return", "func", "(", "res", "http", ".", "ResponseWriter", ",", "req", "*", "http", ".", "Request", ")", "{", "var", "(", "origin", "=", "req", ".", "Header", ".", "Get", "(", "headerOrigin", ")", "\n", "requestedMethod", "=", "req", ".", "Header", ".", "Get", "(", "headerRequestMethod", ")", "\n", "requestedHeaders", "=", "req", ".", "Header", ".", "Get", "(", "headerRequestHeaders", ")", "\n", "// additional headers to be added", "// to the response.", "headers", "<mask>", "[", "string", "]", "string", "\n", ")", "\n\n", "if", "req", ".", "Method", "==", "\"", "\"", "&&", "(", "requestedMethod", "!=", "\"", "\"", "||", "requestedHeaders", "!=", "\"", "\"", ")", "{", "// TODO: if preflight, respond with exact headers if allowed", "headers", "=", "opts", ".", "PreflightHeader", "(", "origin", ",", "requestedMethod", ",", "requestedHeaders", ")", "\n", "}", "else", "{", "headers", "=", "opts", ".", "Header", "(", "origin", ")", "\n", "}", "\n\n", "for", "key", ",", "value", ":=", "range", "headers", "{", "res", ".", "Header", "(", ")", ".", "Set", "(", "key", ",", "value", ")", "\n", "}", "\n", "}", "\n", "}" ]
10,848
all-10849
[ "GetMonitorPlugName", "is", "a", "wrapper", "around", "gdk_screen_get_monitor_plug_name", "()", "." ]
[ "func", "(", "v", "*", "Screen", ")", "GetMonitorPlugName", "(", "m", "int", ")", "(", "string", ",", "<mask>", ")", "{", "return", "toString", "(", "C", ".", "gdk_screen_get_monitor_plug_name", "(", "v", ".", "native", "(", ")", ",", "C", ".", "gint", "(", "m", ")", ")", ")", "\n", "}" ]
10,849
all-10850
[ "SetCursorOnCell", "is", "a", "wrapper", "around", "gtk_tree_view_set_cursor_on_cell", "()", "." ]
[ "func", "(", "v", "*", "TreeView", ")", "SetCursorOnCell", "(", "<mask>", "*", "TreePath", ",", "focusColumn", "*", "TreeViewColumn", ",", "focusCell", "*", "CellRenderer", ",", "startEditing", "bool", ")", "{", "C", ".", "gtk_tree_view_set_cursor_on_cell", "(", "v", ".", "native", "(", ")", ",", "path", ".", "native", "(", ")", ",", "focusColumn", ".", "native", "(", ")", ",", "focusCell", ".", "native", "(", ")", ",", "gbool", "(", "startEditing", ")", ")", "\n", "}" ]
10,850
all-10851
[ "MarshalJSON", "supports", "json", ".", "Marshaler", "interface" ]
[ "func", "(", "v", "Database", ")", "MarshalJSON", "(", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "w", ":=", "jwriter", ".", "<mask>", "{", "}", "\n", "easyjsonC5a4559bEncodeGithubComChromedpCdprotoDatabase8", "(", "&", "w", ",", "v", ")", "\n", "return", "w", ".", "Buffer", ".", "BuildBytes", "(", ")", ",", "w", ".", "Error", "\n", "}" ]
10,851
all-10852
[ "With", "returns", "a", "copy", "of", "db", "that", "uses", "session", "s", "." ]
[ "func", "(", "<mask>", "*", "Database", ")", "With", "(", "s", "*", "Session", ")", "*", "Database", "{", "newdb", ":=", "*", "db", "\n", "newdb", ".", "Session", "=", "s", "\n", "return", "&", "newdb", "\n", "}" ]
10,852
all-10853
[ "HasAuthorHandle", "returns", "a", "boolean", "if", "a", "field", "has", "been", "set", "." ]
[ "func", "(", "b", "*", "Board", ")", "HasAuthorHandle", "(", ")", "bool", "{", "if", "b", "!=", "nil", "&&", "b", ".", "AuthorHandle", "!=", "nil", "{", "return", "true", "\n", "}", "\n\n", "return", "<mask>", "\n", "}" ]
10,853
all-10854
[ "WithPostData", "if", "set", "this", "allows", "postData", "to", "be", "set", ".", "Must", "not", "be", "set", "in", "response", "to", "an", "authChallenge", "." ]
[ "func", "(", "p", "ContinueInterceptedRequestParams", ")", "WithPostData", "(", "postData", "<mask>", ")", "*", "ContinueInterceptedRequestParams", "{", "p", ".", "PostData", "=", "postData", "\n", "return", "&", "p", "\n", "}" ]
10,854
all-10855
[ "GetDefaultHTTPClient", "returns", "a", "httpClient", "with", "configured", "timeout" ]
[ "func", "GetDefaultHTTPClient", "(", "timeout", "<mask>", ".", "Duration", ")", "IHTTPClient", "{", "client", ":=", "http", ".", "Client", "{", "Timeout", ":", "timeout", ",", "}", "\n", "return", "IHTTPClient", "(", "&", "client", ")", "\n", "}" ]
10,855
all-10856
[ "DeleteSpace", "-", "deletes", "a", "space", "based", "on", "GUID" ]
[ "func", "(", "m", "*", "DefaultManager", ")", "DeleteSpace", "(", "space", "cfclient", ".", "Space", ",", "orgName", "string", ")", "error", "{", "if", "m", ".", "Peek", "{", "lo", ".", "G", ".", "Infof", "(", "\"", "\"", ",", "space", ".", "Name", ",", "orgName", ")", "\n", "return", "nil", "\n", "}", "\n", "lo", ".", "G", ".", "Infof", "(", "\"", "\"", ",", "space", ".", "Name", ",", "orgName", ")", "\n", "return", "m", ".", "Client", ".", "DeleteSpace", "(", "space", ".", "Guid", ",", "<mask>", ",", "false", ")", "\n", "}" ]
10,856
all-10857
[ "Contains", "decides", "whether", "(", "lat", "lng", ")", "is", "contained", "in", "the", "box", ".", "The", "containment", "test", "is", "inclusive", "of", "the", "edges", "and", "corners", "." ]
[ "func", "(", "b", "Box", ")", "Contains", "(", "lat", ",", "lng", "float64", ")", "bool", "{", "return", "(", "b", ".", "MinLat", "<=", "<mask>", "&&", "lat", "<=", "b", ".", "MaxLat", "&&", "b", ".", "MinLng", "<=", "lng", "&&", "lng", "<=", "b", ".", "MaxLng", ")", "\n", "}" ]
10,857
all-10858
[ "Serve", "begins", "serving", "requests", "using", "previously", "registered", "handlers", "(", "see", "AddRequestHandler", ")", ".", "All", "request", "handlers", "should", "be", "added", "prior", "to", "making", "this", "call", "as", "unhandled", "requests", "will", "be", "discarded", "." ]
[ "func", "(", "cs", "*", "clientServer", ")", "Serve", "(", ")", "error", "{", "seelog", ".", "Debug", "(", "\"", "\"", ")", "\n", "if", "!", "cs", ".", "IsReady", "(", ")", "{", "return", "errors", ".", "New", "(", "\"", "\"", ")", "\n", "}", "\n", "return", "<mask>", ".", "ConsumeMessages", "(", ")", "\n", "}" ]
10,858
all-10859
[ "split", "splits", "int", "float", "into", "[", "int", "float", "]", "and", "splits", "into", "[]", "." ]
[ "func", "split", "(", "s", "string", ")", "[", "]", "string", "{", "out", ":=", "[", "]", "string", "{", "}", "\n", "i", ":=", "0", "// current type being scanned is s[i:j].", "\n", "nparen", ":=", "0", "\n", "for", "j", ":=", "0", ";", "j", "<", "len", "(", "s", ")", ";", "j", "++", "{", "switch", "s", "[", "j", "]", "{", "case", "' '", ":", "if", "i", "==", "j", "{", "i", "++", "\n", "}", "\n", "case", "'('", ":", "nparen", "++", "\n", "case", "')'", ":", "nparen", "--", "\n", "if", "nparen", "<", "0", "{", "// probably can't happen", "return", "nil", "\n", "}", "\n", "case", "','", ":", "if", "nparen", "==", "0", "{", "if", "i", "<", "j", "{", "out", "=", "append", "(", "out", ",", "s", "[", "i", ":", "j", "]", ")", "\n", "}", "\n", "i", "=", "j", "+", "1", "\n", "}", "\n", "}", "\n", "}", "\n", "if", "nparen", "!=", "0", "{", "// probably can't happen", "return", "nil", "\n", "}", "\n", "if", "i", "<", "len", "(", "s", ")", "{", "<mask>", "=", "append", "(", "out", ",", "s", "[", "i", ":", "]", ")", "\n", "}", "\n", "return", "out", "\n", "}" ]
10,859
all-10860
[ "addConnection", "adds", "an", "active", "connection", "to", "the", "peer", "s", "connection", "list", ".", "If", "a", "connection", "is", "not", "active", "returns", "ErrInvalidConnectionState", "." ]
[ "func", "(", "p", "*", "Peer", ")", "addConnection", "(", "c", "*", "<mask>", ",", "direction", "connectionDirection", ")", "error", "{", "conns", ":=", "p", ".", "connectionsFor", "(", "direction", ")", "\n\n", "if", "c", ".", "readState", "(", ")", "!=", "connectionActive", "{", "return", "ErrInvalidConnectionState", "\n", "}", "\n\n", "p", ".", "Lock", "(", ")", "\n", "*", "conns", "=", "append", "(", "*", "conns", ",", "c", ")", "\n", "p", ".", "Unlock", "(", ")", "\n\n", "// Inform third parties that a peer gained a connection.", "p", ".", "onStatusChanged", "(", "p", ")", "\n\n", "return", "nil", "\n", "}" ]
10,860
all-10861
[ "AddMetricTags", "updates", "check", "bundle", "metrics", "with", "tags" ]
[ "func", "(", "cm", "*", "CheckManager", ")", "AddMetricTags", "(", "metricName", "string", ",", "tags", "[", "]", "string", ",", "appendTags", "bool", ")", "bool", "{", "tagsUpdated", ":=", "false", "\n\n", "if", "appendTags", "&&", "len", "(", "tags", ")", "==", "0", "{", "return", "tagsUpdated", "\n", "}", "\n\n", "currentTags", ",", "exists", ":=", "cm", ".", "metricTags", "[", "metricName", "]", "\n", "if", "!", "exists", "{", "foundMetric", ":=", "false", "\n\n", "if", "cm", ".", "checkBundle", "!=", "nil", "{", "for", "_", ",", "metric", ":=", "range", "cm", ".", "checkBundle", ".", "Metrics", "{", "if", "metric", ".", "Name", "==", "metricName", "{", "foundMetric", "=", "true", "\n", "currentTags", "=", "metric", ".", "Tags", "\n", "break", "\n", "}", "\n", "}", "\n", "}", "\n\n", "if", "!", "foundMetric", "{", "currentTags", "=", "[", "]", "string", "{", "}", "\n", "}", "\n", "}", "\n\n", "action", ":=", "\"", "\"", "\n", "if", "appendTags", "{", "numNewTags", ":=", "countNewTags", "(", "currentTags", ",", "tags", ")", "\n", "if", "numNewTags", ">", "0", "{", "action", "=", "\"", "\"", "\n", "currentTags", "=", "append", "(", "currentTags", ",", "tags", "...", ")", "\n", "tagsUpdated", "=", "true", "\n", "}", "\n", "}", "else", "{", "if", "len", "(", "tags", ")", "!=", "len", "(", "currentTags", ")", "{", "action", "=", "\"", "\"", "\n", "currentTags", "=", "tags", "\n", "tagsUpdated", "=", "true", "\n", "}", "else", "{", "numNewTags", ":=", "countNewTags", "(", "currentTags", ",", "tags", ")", "\n", "if", "numNewTags", ">", "0", "{", "action", "=", "\"", "\"", "\n", "currentTags", "=", "tags", "\n", "tagsUpdated", "=", "true", "\n", "}", "\n", "}", "\n", "}", "\n\n", "if", "tagsUpdated", "{", "cm", ".", "metricTags", "[", "metricName", "]", "=", "currentTags", "\n", "}", "\n\n", "if", "cm", ".", "Debug", "&&", "action", "!=", "\"", "\"", "{", "cm", ".", "Log", ".", "Printf", "(", "\"", "\\n", "\"", ",", "action", ",", "metricName", ",", "<mask>", ")", "\n", "}", "\n\n", "return", "tagsUpdated", "\n", "}" ]
10,861
all-10862
[ "End", "returns", "the", "end", "of", "the", "range", ".", "This", "value", "may", "be", "different", "from", "the", "end", "value", "given", "when", "the", "range", "was", "first", "initialized", "since", "it", "takes", "into", "account", "the", "stepping", "value", ".", "The", "end", "value", "may", "be", "shifted", "to", "the", "closest", "valid", "value", "within", "the", "stepped", "range", "." ]
[ "func", "(", "r", "*", "InclusiveRange", ")", "End", "(", ")", "int", "{", "if", "r", ".", "isEndCached", "{", "return", "r", ".", "cachedEnd", "\n", "}", "\n\n", "r", ".", "isEndCached", "=", "true", "\n\n", "// If we aren't stepping, or we don't have", "// a full range, then just use the end value", "if", "r", ".", "step", "==", "1", "||", "r", ".", "step", "==", "-", "1", "||", "r", ".", "start", "==", "r", ".", "end", "{", "r", ".", "cachedEnd", "=", "r", ".", "end", "\n", "return", "r", ".", "cachedEnd", "\n", "}", "\n\n", "// If the step is in the wrong direction,", "// compared to the range direction, then", "// just use the start as the end.", "if", "(", "r", ".", "end", "<", "r", ".", "start", ")", "&&", "r", ".", "step", "<", "(", "r", ".", "end", "-", "r", ".", "start", ")", "{", "r", ".", "cachedEnd", "=", "r", ".", "start", "\n", "return", "r", ".", "cachedEnd", "\n\n", "}", "else", "if", "(", "r", ".", "end", ">", "r", ".", "start", ")", "&&", "r", ".", "step", ">", "(", "r", ".", "end", "-", "r", ".", "start", ")", "{", "r", ".", "cachedEnd", "=", "r", ".", "start", "\n", "return", "r", ".", "cachedEnd", "\n", "}", "\n\n", "// Calculate the end, taking into account the stepping", "r", ".", "cachedEnd", "=", "r", ".", "closestInRange", "(", "r", ".", "end", ",", "r", ".", "start", ",", "r", ".", "end", ",", "r", ".", "<mask>", ")", "\n", "return", "r", ".", "cachedEnd", "\n", "}" ]
10,862
all-10863
[ "FrameNew", "is", "a", "wrapper", "around", "gtk_frame_new", "()", "." ]
[ "func", "FrameNew", "(", "label", "string", ")", "(", "*", "Frame", ",", "error", ")", "{", "var", "cstr", "*", "C", ".", "char", "\n", "if", "<mask>", "!=", "\"", "\"", "{", "cstr", "=", "C", ".", "CString", "(", "label", ")", "\n", "defer", "C", ".", "free", "(", "unsafe", ".", "Pointer", "(", "cstr", ")", ")", "\n", "}", "\n", "c", ":=", "C", ".", "gtk_frame_new", "(", "(", "*", "C", ".", "gchar", ")", "(", "cstr", ")", ")", "\n", "if", "c", "==", "nil", "{", "return", "nil", ",", "nilPtrErr", "\n", "}", "\n", "obj", ":=", "glib", ".", "Take", "(", "unsafe", ".", "Pointer", "(", "c", ")", ")", "\n", "return", "wrapFrame", "(", "obj", ")", ",", "nil", "\n", "}" ]
10,863
all-10864
[ "UnmarshalJSON", "supports", "json", ".", "Unmarshaler", "interface" ]
[ "func", "(", "v", "*", "AuthChallengeResponse", ")", "UnmarshalJSON", "(", "<mask>", "[", "]", "byte", ")", "error", "{", "r", ":=", "jlexer", ".", "Lexer", "{", "Data", ":", "data", "}", "\n", "easyjsonC5a4559bDecodeGithubComChromedpCdprotoNetwork67", "(", "&", "r", ",", "v", ")", "\n", "return", "r", ".", "Error", "(", ")", "\n", "}" ]
10,864
all-10865
[ "Get", "a", "shared", "access", "signature", "(", "SAS", ")", "string", "for", "use", "with", "a", "specific", "Azure", "Table", "Storage", "table", ".", "The", "level", "parameter", "can", "be", "read", "-", "write", "or", "read", "-", "only", "and", "determines", "which", "type", "of", "credentials", "are", "returned", ".", "If", "level", "is", "read", "-", "write", "it", "will", "create", "the", "table", "if", "it", "doesn", "t", "already", "exist", ".", "Required", "scopes", ":", "If", "levelIsReadOnly", ":", "Any", "of", ":", "-", "auth", ":", "azure", "-", "table", ":", "read", "-", "only", ":", "<account", ">", "/", "<table", ">", "-", "auth", ":", "azure", "-", "table", ":", "read", "-", "write", ":", "<account", ">", "/", "<table", ">", "See", "#azureTableSAS" ]
[ "func", "(", "auth", "*", "Auth", ")", "AzureTableSAS", "(", "account", ",", "table", ",", "level", "string", ")", "(", "*", "AzureTableSharedAccessSignature", ",", "error", ")", "{", "cd", ":=", "tcclient", ".", "Client", "(", "*", "auth", ")", "\n", "responseObject", ",", "_", ",", "err", ":=", "(", "&", "cd", ")", ".", "APICall", "(", "nil", ",", "\"", "\"", ",", "\"", "\"", "+", "url", ".", "QueryEscape", "(", "account", ")", "+", "\"", "\"", "+", "url", ".", "QueryEscape", "(", "<mask>", ")", "+", "\"", "\"", "+", "url", ".", "QueryEscape", "(", "level", ")", ",", "new", "(", "AzureTableSharedAccessSignature", ")", ",", "nil", ")", "\n", "return", "responseObject", ".", "(", "*", "AzureTableSharedAccessSignature", ")", ",", "err", "\n", "}" ]
10,865
all-10866
[ "Catering", "related", "functions", "and", "methods", "Create", "a", "Catering" ]
[ "func", "NewCatering", "(", "tournament", "uuid", ".", "UUID", ",", "ci", "Info", ")", "(", "*", "Catering", ",", "error", ")", "{", "c", ":=", "new", "(", "Catering", ")", "\n", "c", ".", "UUID", ",", "_", "=", "uuid", ".", "V4", "(", ")", "\n", "c", ".", "Tournament", "=", "tournament", "\n", "if", "err", ":=", "mergo", ".", "MergeWithOverwrite", "(", "&", "c", ".", "Info", ",", "ci", ")", ";", "err", "!=", "nil", "{", "return", "nil", ",", "errors", ".", "New", "(", "err", ".", "Error", "(", ")", "+", "\"", "\"", ")", "\n", "}", "\n", "if", "err", ":=", "storage", ".", "Store", "(", "c", ")", ";", "err", "!=", "nil", "{", "return", "nil", ",", "errors", ".", "New", "(", "err", ".", "<mask>", "(", ")", "+", "\"", "\"", ")", "\n", "}", "\n", "return", "c", ",", "nil", "\n", "}" ]
10,866
all-10867
[ "WriteBool", "writes", "a", "boolean", "." ]
[ "func", "(", "w", "*", "<mask>", ")", "WriteBool", "(", "v", "bool", ")", "{", "if", "w", ".", "err", "!=", "nil", "{", "return", "\n", "}", "\n", "if", "v", "{", "w", ".", "wr", ".", "WriteByte", "(", "1", ")", "\n", "}", "else", "{", "w", ".", "wr", ".", "WriteByte", "(", "0", ")", "\n", "}", "\n", "}" ]
10,867
all-10868
[ "AuthenticateServicePrincipal", "uses", "given", "service", "principal", "credentials", "to", "return", "a", "service", "principal", "token", ".", "Generated", "token", "is", "not", "stored", "in", "a", "cache", "file", "or", "refreshed", "." ]
[ "func", "AuthenticateServicePrincipal", "(", "env", "azure", ".", "Environment", ",", "subscriptionID", ",", "spID", ",", "spPassword", "string", ")", "(", "*", "azure", ".", "ServicePrincipalToken", ",", "error", ")", "{", "tenantID", ",", "err", ":=", "loadOrFindTenantID", "(", "env", ",", "subscriptionID", ")", "\n", "if", "<mask>", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "oauthCfg", ",", "err", ":=", "env", ".", "OAuthConfigForTenant", "(", "tenantID", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "err", ")", "\n", "}", "\n\n", "spt", ",", "err", ":=", "azure", ".", "NewServicePrincipalToken", "(", "*", "oauthCfg", ",", "spID", ",", "spPassword", ",", "getScope", "(", "env", ")", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "err", ")", "\n", "}", "\n", "return", "spt", ",", "nil", "\n", "}" ]
10,868
all-10869
[ "==", "Editing", "Add", "adds", "a", "new", "shadowed", "user", ".", "If", "the", "key", "is", "not", "nil", "generates", "a", "hashed", "password", ".", "It", "is", "created", "a", "backup", "before", "of", "modify", "the", "original", "file", "." ]
[ "func", "(", "s", "*", "Shadow", ")", "Add", "(", "key", "[", "]", "byte", ")", "(", "err", "error", ")", "{", "loadConfig", "(", ")", "\n\n", "shadow", ",", "err", ":=", "LookupShadow", "(", "s", ".", "Name", ")", "\n", "if", "err", "!=", "nil", "{", "if", "_", ",", "ok", ":=", "err", ".", "(", "NoFoundError", ")", ";", "!", "ok", "{", "return", "\n", "}", "\n", "}", "\n", "if", "shadow", "!=", "nil", "{", "return", "ErrUserExist", "\n", "}", "\n\n", "if", "s", ".", "Name", "==", "\"", "\"", "{", "return", "RequiredError", "(", "\"", "\"", ")", "\n", "}", "\n", "if", "s", ".", "Max", "==", "0", "{", "return", "RequiredError", "(", "\"", "\"", ")", "\n", "}", "\n", "if", "s", ".", "Warn", "==", "0", "{", "return", "RequiredError", "(", "\"", "\"", ")", "\n", "}", "\n\n", "// Backup", "if", "err", "=", "backup", "(", "_SHADOW_FILE", ")", ";", "err", "!=", "nil", "{", "return", "\n", "}", "\n\n", "db", ",", "err", ":=", "openDBFile", "(", "_SHADOW_FILE", ",", "os", ".", "O_WRONLY", "|", "os", ".", "O_APPEND", ")", "\n", "if", "err", "!=", "nil", "{", "return", "\n", "}", "\n", "defer", "func", "(", ")", "{", "e", ":=", "db", ".", "close", "(", ")", "\n", "if", "e", "!=", "nil", "&&", "err", "==", "nil", "{", "err", "=", "e", "\n", "}", "\n", "}", "(", ")", "\n\n", "if", "key", "!=", "nil", "{", "s", ".", "password", ",", "_", "=", "config", ".", "crypter", ".", "Generate", "(", "key", ",", "nil", ")", "\n", "if", "s", ".", "changed", "==", "_ENABLE_AGING", "{", "s", ".", "setChange", "(", ")", "\n", "}", "\n", "}", "else", "{", "s", ".", "password", "=", "\"", "\"", "// Password disabled.", "\n", "}", "\n\n", "_", ",", "err", "=", "<mask>", ".", "file", ".", "WriteString", "(", "s", ".", "String", "(", ")", ")", "\n", "return", "\n", "}" ]
10,869
all-10870
[ "NumPendingOutbound", "returns", "the", "number", "of", "pending", "outbound", "calls", "." ]
[ "func", "(", "p", "*", "Peer", ")", "NumPendingOutbound", "(", ")", "int", "{", "count", ":=", "0", "\n", "p", ".", "RLock", "(", ")", "\n", "for", "_", ",", "c", ":=", "range", "p", ".", "outboundConnections", "{", "count", "+=", "c", ".", "outbound", ".", "count", "(", ")", "\n", "}", "\n\n", "for", "_", ",", "c", ":=", "<mask>", "p", ".", "inboundConnections", "{", "count", "+=", "c", ".", "outbound", ".", "count", "(", ")", "\n", "}", "\n", "p", ".", "RUnlock", "(", ")", "\n", "return", "count", "\n", "}" ]
10,870
all-10871
[ "intToIP4", "converts", "an", "integer", "IP", "representation", "into", "a", "4", "-", "byte", "net", ".", "IP", "struct" ]
[ "func", "intToIP4", "(", "ip", "uint32", ")", "net", ".", "IP", "{", "return", "net", ".", "IP", "{", "byte", "(", "ip", ">>", "24", "&", "0xff", ")", ",", "byte", "(", "<mask>", ">>", "16", "&", "0xff", ")", ",", "byte", "(", "ip", ">>", "8", "&", "0xff", ")", ",", "byte", "(", "ip", "&", "0xff", ")", ",", "}", "\n", "}" ]
10,871
all-10872
[ "UnmarshalJSON", "supports", "json", ".", "Unmarshaler", "interface" ]
[ "func", "(", "v", "*", "SetExtraHTTPHeadersParams", ")", "UnmarshalJSON", "(", "<mask>", "[", "]", "byte", ")", "error", "{", "r", ":=", "jlexer", ".", "Lexer", "{", "Data", ":", "data", "}", "\n", "easyjsonC5a4559bDecodeGithubComChromedpCdprotoNetwork11", "(", "&", "r", ",", "v", ")", "\n", "return", "r", ".", "Error", "(", ")", "\n", "}" ]
10,872
all-10873
[ "NewRecordingRule", "returns", "a", "new", "recording", "rule", "." ]
[ "func", "NewRecordingRule", "(", "name", "string", ",", "vector", "promql", ".", "Expr", ",", "lset", "labels", ".", "Labels", ")", "*", "RecordingRule", "{", "return", "&", "RecordingRule", "{", "name", ":", "name", ",", "<mask>", ":", "vector", ",", "health", ":", "HealthUnknown", ",", "labels", ":", "lset", ",", "}", "\n", "}" ]
10,873
all-10874
[ "Warn", "calls", "UI", ".", "Warn", "to", "write", ".", "Useful", "when", "you", "want", "separate", "colors", "or", "prefixes", ".", "WarnPrefix", "is", "used", "to", "prefix", "message", "." ]
[ "func", "(", "ui", "*", "PrefixUI", ")", "Warn", "(", "<mask>", "string", ")", "{", "if", "ui", ".", "WarnPrefix", "==", "\"", "\"", "{", "//Lets keep the space if they want one", "message", "=", "ui", ".", "WarnPrefix", "+", "message", "\n", "}", "else", "if", "ui", ".", "WarnPrefix", "!=", "\"", "\"", "{", "message", "=", "ui", ".", "WarnPrefix", "+", "\"", "\"", "+", "message", "\n", "}", "\n", "ui", ".", "UI", ".", "Warn", "(", "message", ")", "\n", "}" ]
10,874
all-10875
[ "Err", "returns", "an", "error", "that", "is", "set", "by", "RunLoop", "()", ".", "It", "must", "be", "called", "after", "RunLoop", "()", ".", "If", "not", "it", "causes", "panic", "." ]
[ "func", "(", "p", "*", "Pinger", ")", "Err", "(", ")", "error", "{", "p", ".", "mu", ".", "Lock", "(", ")", "\n", "defer", "p", ".", "mu", ".", "Unlock", "(", ")", "\n", "return", "p", ".", "ctx", ".", "<mask>", "\n", "}" ]
10,875
all-10876
[ "SetCookieBytesKV", "sets", "key", ":", "value", "cookies", "." ]
[ "func", "(", "h", "*", "RequestHeader", ")", "SetCookieBytesKV", "(", "<mask>", ",", "value", "[", "]", "byte", ")", "{", "h", ".", "SetCookie", "(", "b2s", "(", "key", ")", ",", "b2s", "(", "value", ")", ")", "\n", "}" ]
10,876
all-10877
[ "Extract", "the", "given", "query", "parameter", "directly", "from", "the", "URL", "never", "from", "an", "encoded", "body", "." ]
[ "func", "queryParam", "(", "request", "*", "http", ".", "Request", ",", "key", "string", ")", "string", "{", "var", "values", "url", ".", "Values", "\n", "var", "err", "error", "\n\n", "if", "request", ".", "URL", "!=", "nil", "{", "<mask>", ",", "err", "=", "url", ".", "ParseQuery", "(", "request", ".", "URL", ".", "RawQuery", ")", "\n", "if", "err", "!=", "nil", "{", "logger", ".", "Warnf", "(", "\"", "\"", ",", "request", ".", "URL", ".", "RawQuery", ",", "err", ")", "\n", "return", "\"", "\"", "\n", "}", "\n", "}", "\n\n", "if", "values", "==", "nil", "{", "values", "=", "make", "(", "url", ".", "Values", ")", "\n", "}", "\n\n", "return", "values", ".", "Get", "(", "key", ")", "\n", "}" ]
10,877
all-10878
[ "GetAllowTrustResult", "retrieves", "the", "AllowTrustResult", "value", "from", "the", "union", "returning", "ok", "if", "the", "union", "s", "switch", "indicated", "the", "value", "is", "valid", "." ]
[ "func", "(", "u", "OperationResultTr", ")", "GetAllowTrustResult", "(", ")", "(", "<mask>", "AllowTrustResult", ",", "ok", "bool", ")", "{", "armName", ",", "_", ":=", "u", ".", "ArmForSwitch", "(", "int32", "(", "u", ".", "Type", ")", ")", "\n\n", "if", "armName", "==", "\"", "\"", "{", "result", "=", "*", "u", ".", "AllowTrustResult", "\n", "ok", "=", "true", "\n", "}", "\n\n", "return", "\n", "}" ]
10,878
all-10879
[ "Find", "the", "price", "in", "the", "given", "package", "with", "the", "specified", "size" ]
[ "func", "FindPerformanceSpacePrice", "(", "productPackage", "datatypes", ".", "Product_Package", ",", "size", "int", ")", "(", "datatypes", ".", "Product_Item_Price", ",", "error", ")", "{", "for", "_", ",", "item", ":=", "range", "productPackage", ".", "Items", "{", "if", "int", "(", "*", "item", ".", "Capacity", ")", "!=", "size", "{", "<mask>", "\n", "}", "\n", "for", "_", ",", "price", ":=", "range", "item", ".", "Prices", "{", "// Only collect prices from valid location groups.", "if", "price", ".", "LocationGroupId", "!=", "nil", "{", "continue", "\n", "}", "\n", "if", "!", "hasCategory", "(", "price", ".", "Categories", ",", "\"", "\"", ")", "{", "continue", "\n", "}", "\n", "return", "price", ",", "nil", "\n", "}", "\n", "}", "\n", "return", "datatypes", ".", "Product_Item_Price", "{", "}", ",", "bosherr", ".", "Errorf", "(", "\"", "\"", ",", "size", ")", "\n", "}" ]
10,879
all-10880
[ "generateDiskImage", "creates", "a", "small", "fixed", "vhd", "put", "the", "tar", "in", "convert", "to", "dynamic", "then", "resize" ]
[ "func", "(", "d", "*", "Driver", ")", "generateDiskImage", "(", ")", "(", "string", ",", "error", ")", "{", "diskImage", ":=", "d", ".", "ResolveStorePath", "(", "\"", "\"", ")", "\n", "fixed", ":=", "d", ".", "ResolveStorePath", "(", "\"", "\"", ")", "\n\n", "// Resizing vhds requires administrator privileges", "// incase the user is only a hyper-v admin then create the disk at the target size to avoid resizing.", "isWindowsAdmin", ",", "err", ":=", "isWindowsAdministrator", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "\"", "\"", ",", "err", "\n", "}", "\n", "fixedDiskSize", ":=", "\"", "\"", "\n", "if", "!", "isWindowsAdmin", "{", "fixedDiskSize", "=", "toMb", "(", "d", ".", "DiskSize", ")", "\n", "}", "\n\n", "log", ".", "Infof", "(", "\"", "\"", ")", "\n", "if", "err", ":=", "cmd", "(", "\"", "\\\\", "\"", ",", "\"", "\"", ",", "<mask>", "(", "fixed", ")", ",", "\"", "\"", ",", "fixedDiskSize", ",", "\"", "\"", ")", ";", "err", "!=", "nil", "{", "return", "\"", "\"", ",", "err", "\n", "}", "\n\n", "tarBuf", ",", "err", ":=", "mcnutils", ".", "MakeDiskImage", "(", "d", ".", "publicSSHKeyPath", "(", ")", ")", "\n", "if", "err", "!=", "nil", "{", "return", "\"", "\"", ",", "err", "\n", "}", "\n\n", "file", ",", "err", ":=", "os", ".", "OpenFile", "(", "fixed", ",", "os", ".", "O_WRONLY", ",", "0644", ")", "\n", "if", "err", "!=", "nil", "{", "return", "\"", "\"", ",", "err", "\n", "}", "\n", "defer", "file", ".", "Close", "(", ")", "\n\n", "file", ".", "Seek", "(", "0", ",", "os", ".", "SEEK_SET", ")", "\n", "_", ",", "err", "=", "file", ".", "Write", "(", "tarBuf", ".", "Bytes", "(", ")", ")", "\n", "if", "err", "!=", "nil", "{", "return", "\"", "\"", ",", "err", "\n", "}", "\n", "file", ".", "Close", "(", ")", "\n\n", "if", "err", ":=", "cmd", "(", "\"", "\\\\", "\"", ",", "\"", "\"", ",", "quote", "(", "fixed", ")", ",", "\"", "\"", ",", "quote", "(", "diskImage", ")", ",", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ")", ";", "err", "!=", "nil", "{", "return", "\"", "\"", ",", "err", "\n", "}", "\n\n", "if", "isWindowsAdmin", "{", "if", "err", ":=", "cmd", "(", "\"", "\\\\", "\"", ",", "\"", "\"", ",", "quote", "(", "diskImage", ")", ",", "\"", "\"", ",", "toMb", "(", "d", ".", "DiskSize", ")", ")", ";", "err", "!=", "nil", "{", "return", "\"", "\"", ",", "err", "\n", "}", "\n", "}", "\n\n", "return", "diskImage", ",", "nil", "\n", "}" ]
10,880
all-10881
[ "CallOptions", "returns", "a", "CallOptions", "struct", "suitable", "for", "forwarding", "a", "request", "." ]
[ "func", "(", "<mask>", "*", "InboundCall", ")", "CallOptions", "(", ")", "*", "CallOptions", "{", "return", "&", "CallOptions", "{", "callerName", ":", "call", ".", "CallerName", "(", ")", ",", "Format", ":", "call", ".", "Format", "(", ")", ",", "ShardKey", ":", "call", ".", "ShardKey", "(", ")", ",", "RoutingDelegate", ":", "call", ".", "RoutingDelegate", "(", ")", ",", "RoutingKey", ":", "call", ".", "RoutingKey", "(", ")", ",", "}", "\n", "}" ]
10,881
all-10882
[ "Asset", "get", "content", "from", "AssetFS", "by", "name" ]
[ "func", "(", "render", "*", "Render", ")", "Asset", "(", "name", "string", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "return", "render", ".", "AssetFileSystem", ".", "Asset", "(", "<mask>", ")", "\n", "}" ]
10,882
all-10883
[ "signaturePath", "returns", "a", "path", "for", "a", "signature", "within", "a", "ostree", "using", "our", "conventions", "." ]
[ "func", "(", "ref", "ostreeReference", ")", "signaturePath", "(", "<mask>", "int", ")", "string", "{", "return", "filepath", ".", "Join", "(", "\"", "\"", ",", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "index", "+", "1", ")", ")", "\n", "}" ]
10,883
all-10884
[ "AsArray", "accepts", "an", "[]", "byte", "encoded", "json", "array", "as", "an", "input", "and", "returns", "the", "array", "s", "elements" ]
[ "func", "AsArray", "(", "in", "[", "]", "byte", ",", "pos", "int", ")", "(", "[", "]", "[", "]", "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", "pos", "++", "\n\n", "// clean initial spaces", "pos", ",", "err", "=", "skipSpace", "(", "in", ",", "pos", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "if", "in", "[", "pos", "]", "==", "']'", "{", "return", "[", "]", "[", "]", "byte", "{", "}", ",", "nil", "\n", "}", "\n\n", "// 1. Count the number of elements in the array", "start", ":=", "pos", "\n\n", "elements", ":=", "<mask>", "(", "[", "]", "[", "]", "byte", ",", "0", ",", "256", ")", "\n", "for", "{", "pos", ",", "err", "=", "skipSpace", "(", "in", ",", "pos", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "start", "=", "pos", "\n\n", "// data", "pos", ",", "err", "=", "Any", "(", "in", ",", "pos", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n", "elements", "=", "append", "(", "elements", ",", "in", "[", "start", ":", "pos", "]", ")", "\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", "elements", ",", "nil", "\n", "}", "\n", "}", "\n", "}" ]
10,884
all-10885
[ "ToLogRecord", "converts", "a", "deprecated", "LogData", "to", "a", "non", "-", "deprecated", "LogRecord" ]
[ "func", "(", "ld", "*", "LogData", ")", "ToLogRecord", "(", ")", "LogRecord", "{", "var", "literalTimestamp", "time", ".", "Time", "\n", "if", "ld", ".", "Timestamp", ".", "IsZero", "(", ")", "{", "literalTimestamp", "=", "time", ".", "Now", "(", ")", "\n", "}", "else", "{", "literalTimestamp", "=", "ld", ".", "Timestamp", "\n", "}", "\n", "rval", ":=", "LogRecord", "{", "Timestamp", ":", "literalTimestamp", ",", "}", "\n", "if", "ld", ".", "Payload", "==", "nil", "{", "rval", ".", "Fields", "=", "[", "]", "log", ".", "Field", "{", "log", ".", "<mask>", "(", "\"", "\"", ",", "ld", ".", "Event", ")", ",", "}", "\n", "}", "else", "{", "rval", ".", "Fields", "=", "[", "]", "log", ".", "Field", "{", "log", ".", "String", "(", "\"", "\"", ",", "ld", ".", "Event", ")", ",", "log", ".", "Object", "(", "\"", "\"", ",", "ld", ".", "Payload", ")", ",", "}", "\n", "}", "\n", "return", "rval", "\n", "}" ]
10,885
all-10886
[ "MarshalJSON", "supports", "json", ".", "Marshaler", "interface" ]
[ "func", "(", "v", "EventLoadingFinished", ")", "MarshalJSON", "(", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "w", ":=", "jwriter", ".", "Writer", "{", "}", "\n", "easyjsonC5a4559bEncodeGithubComChromedpCdprotoNetwork53", "(", "&", "w", ",", "v", ")", "\n", "return", "w", ".", "Buffer", ".", "BuildBytes", "(", ")", ",", "w", ".", "<mask>", "\n", "}" ]
10,886
all-10887
[ "handle", "registers", "a", "http", ".", "Handler", "in", "the", "routing", "tree", "for", "a", "particular", "http", "method", "and", "routing", "pattern", "." ]
[ "func", "(", "mx", "*", "Mux", ")", "handle", "(", "<mask>", "methodTyp", ",", "pattern", "string", ",", "handler", "http", ".", "Handler", ")", "*", "node", "{", "if", "len", "(", "pattern", ")", "==", "0", "||", "pattern", "[", "0", "]", "!=", "'/'", "{", "panic", "(", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "pattern", ")", ")", "\n", "}", "\n\n", "// Build the final routing handler for this Mux.", "if", "!", "mx", ".", "inline", "&&", "mx", ".", "handler", "==", "nil", "{", "mx", ".", "buildRouteHandler", "(", ")", "\n", "}", "\n\n", "// Build endpoint handler with inline middlewares for the route", "var", "h", "http", ".", "Handler", "\n", "if", "mx", ".", "inline", "{", "mx", ".", "handler", "=", "http", ".", "HandlerFunc", "(", "mx", ".", "routeHTTP", ")", "\n", "h", "=", "Chain", "(", "mx", ".", "middlewares", "...", ")", ".", "Handler", "(", "handler", ")", "\n", "}", "else", "{", "h", "=", "handler", "\n", "}", "\n\n", "// Add the endpoint to the tree and return the node", "return", "mx", ".", "tree", ".", "InsertRoute", "(", "method", ",", "pattern", ",", "h", ")", "\n", "}" ]
10,887
all-10888
[ "Initialize", "GenMetadata", "from", "each", "CA", "API", "generated", "metadata" ]
[ "func", "setupMetadata", "(", ")", "(", "result", "map", "[", "string", "]", "*", "metadata", ".", "Resource", ")", "{", "result", "=", "<mask>", "(", "map", "[", "string", "]", "*", "metadata", ".", "Resource", ")", "\n", "for", "n", ",", "r", ":=", "range", "cac", ".", "GenMetadata", "{", "result", "[", "n", "]", "=", "r", "\n", "}", "\n", "return", "\n", "}" ]
10,888
all-10889
[ "HasMetricQuery", "returns", "a", "boolean", "if", "a", "field", "has", "been", "set", "." ]
[ "func", "(", "h", "*", "HeatmapRequest", ")", "HasMetricQuery", "(", ")", "bool", "{", "if", "h", "!=", "nil", "&&", "h", ".", "MetricQuery", "!=", "nil", "{", "return", "true", "\n", "}", "\n\n", "return", "<mask>", "\n", "}" ]
10,889
all-10890
[ "GetChannels", "retrieves", "the", "IRC", "channels", "the", "client", "is", "on", "." ]
[ "func", "(", "c", "Client", ")", "GetChannels", "(", ")", "[", "]", "string", "{", "<mask>", "channels", "[", "]", "string", "\n", "c", ".", "mutex", ".", "Lock", "(", ")", "\n", "for", "k", ":=", "range", "c", ".", "channels", "{", "channels", "=", "append", "(", "channels", ",", "k", ")", "\n", "}", "\n", "c", ".", "mutex", ".", "Unlock", "(", ")", "\n", "return", "channels", "\n", "}" ]
10,890
all-10891
[ "export", "FileSequence_Start" ]
[ "func", "FileSequence_Start", "(", "id", "FileSeqId", ")", "C", ".", "int", "{", "fs", ",", "ok", ":=", "sFileSeqs", ".", "Get", "(", "id", ")", "\n", "if", "!", "<mask>", "{", "return", "0", "\n", "}", "\n", "return", "C", ".", "int", "(", "fs", ".", "Start", "(", ")", ")", "\n", "}" ]
10,891
all-10892
[ "keyDiff", "returns", "a", "suffix", "of", "newKey", "that", "is", "different", "from", "b", ".", "baseKey", "." ]
[ "func", "(", "b", "<mask>", ")", "keyDiff", "(", "newKey", "[", "]", "byte", ")", "[", "]", "byte", "{", "var", "i", "int", "\n", "for", "i", "=", "0", ";", "i", "<", "len", "(", "newKey", ")", "&&", "i", "<", "len", "(", "b", ".", "baseKey", ")", ";", "i", "++", "{", "if", "newKey", "[", "i", "]", "!=", "b", ".", "baseKey", "[", "i", "]", "{", "break", "\n", "}", "\n", "}", "\n", "return", "newKey", "[", "i", ":", "]", "\n", "}" ]
10,892
all-10893
[ "NewService", "creates", "a", "new", "configured", "PKI", "controller", "." ]
[ "func", "NewService", "(", "config", "ServiceConfig", ")", "(", "<mask>", ",", "error", ")", "{", "// Dependencies.", "if", "config", ".", "VaultClient", "==", "nil", "{", "return", "nil", ",", "microerror", ".", "Maskf", "(", "invalidConfigError", ",", "\"", "\"", ")", "\n", "}", "\n\n", "newService", ":=", "&", "service", "{", "ServiceConfig", ":", "config", ",", "}", "\n\n", "return", "newService", ",", "nil", "\n", "}" ]
10,893
all-10894
[ "Given", "its", "relative", "path", "with", "respect", "to", "the", "LXD", "surce", "tree", "return", "the", "full", "path", "of", "a", "file", "." ]
[ "func", "absPath", "(", "path", "string", ")", "string", "{", "// We expect to be called by code within the lxd package itself.", "_", ",", "filename", ",", "_", ",", "_", ":=", "runtime", ".", "Caller", "(", "1", ")", "\n\n", "elems", ":=", "strings", ".", "Split", "(", "<mask>", ",", "string", "(", "filepath", ".", "Separator", ")", ")", "\n", "for", "i", ":=", "len", "(", "elems", ")", "-", "1", ";", "i", ">=", "0", ";", "i", "--", "{", "if", "elems", "[", "i", "]", "==", "\"", "\"", "{", "elems", "=", "append", "(", "[", "]", "string", "{", "string", "(", "filepath", ".", "Separator", ")", "}", ",", "elems", "[", ":", "i", "]", "...", ")", "\n", "elems", "=", "append", "(", "elems", ",", "path", ")", "\n", "return", "filepath", ".", "Join", "(", "elems", "...", ")", "\n", "}", "\n", "}", "\n\n", "log", ".", "Fatalf", "(", "\"", "\"", ")", "\n\n", "return", "\"", "\"", "\n", "}" ]
10,894
all-10895
[ "Increment", "atomically", "increments", "the", "decimal", "value", "in", "the", "given", "key", "by", "delta", "and", "returns", "the", "new", "value", ".", "The", "value", "must", "fit", "in", "a", "uint64", ".", "Overflow", "wraps", "around", "and", "underflow", "is", "capped", "to", "zero", ".", "The", "provided", "delta", "may", "be", "negative", ".", "If", "the", "key", "doesn", "t", "exist", "in", "memcache", "the", "provided", "initial", "value", "is", "used", "to", "atomically", "populate", "it", "before", "the", "delta", "is", "applied", ".", "The", "key", "must", "be", "at", "most", "250", "bytes", "in", "length", "." ]
[ "func", "Increment", "(", "c", "context", ".", "<mask>", ",", "key", "string", ",", "delta", "int64", ",", "initialValue", "uint64", ")", "(", "newValue", "uint64", ",", "err", "error", ")", "{", "return", "incr", "(", "c", ",", "key", ",", "delta", ",", "&", "initialValue", ")", "\n", "}" ]
10,895
all-10896
[ "uncompressedDigest", "implements", "BlobInfoCache", ".", "UncompressedDigest", "within", "the", "provided", "read", "-", "only", "transaction", "." ]
[ "func", "(", "bdc", "*", "cache", ")", "uncompressedDigest", "(", "<mask>", "*", "bolt", ".", "Tx", ",", "anyDigest", "digest", ".", "Digest", ")", "digest", ".", "Digest", "{", "if", "b", ":=", "tx", ".", "Bucket", "(", "uncompressedDigestBucket", ")", ";", "b", "!=", "nil", "{", "if", "uncompressedBytes", ":=", "b", ".", "Get", "(", "[", "]", "byte", "(", "anyDigest", ".", "String", "(", ")", ")", ")", ";", "uncompressedBytes", "!=", "nil", "{", "d", ",", "err", ":=", "digest", ".", "Parse", "(", "string", "(", "uncompressedBytes", ")", ")", "\n", "if", "err", "==", "nil", "{", "return", "d", "\n", "}", "\n", "// FIXME? Log err (but throttle the log volume on repeated accesses)?", "}", "\n", "}", "\n", "// Presence in digestsByUncompressedBucket implies that anyDigest must already refer to an uncompressed digest.", "// This way we don't have to waste storage space with trivial (uncompressed, uncompressed) mappings", "// when we already record a (compressed, uncompressed) pair.", "if", "b", ":=", "tx", ".", "Bucket", "(", "digestByUncompressedBucket", ")", ";", "b", "!=", "nil", "{", "if", "b", "=", "b", ".", "Bucket", "(", "[", "]", "byte", "(", "anyDigest", ".", "String", "(", ")", ")", ")", ";", "b", "!=", "nil", "{", "c", ":=", "b", ".", "Cursor", "(", ")", "\n", "if", "k", ",", "_", ":=", "c", ".", "First", "(", ")", ";", "k", "!=", "nil", "{", "// The bucket is non-empty", "return", "anyDigest", "\n", "}", "\n", "}", "\n", "}", "\n", "return", "\"", "\"", "\n", "}" ]
10,896
all-10897
[ "Run", "will", "watch", "for", "the", "process", "being", "wrapped", "to", "exit", "and", "then", "post", "the", "status", "of", "that", "process", "and", "any", "artifacts", "to", "cloud", "storage", "." ]
[ "func", "(", "o", "Options", ")", "Run", "(", "ctx", "context", ".", "Context", ")", "(", "int", ",", "error", ")", "{", "spec", ",", "err", ":=", "downwardapi", ".", "ResolveSpecFromEnv", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "0", ",", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "err", ")", "\n", "}", "\n\n", "ctx", ",", "cancel", ":=", "<mask>", ".", "WithCancel", "(", "ctx", ")", "\n\n", "// If we are being asked to terminate by the kubelet but we have", "// NOT seen the test process exit cleanly, we need a to start", "// uploading artifacts to GCS immediately. If we notice the process", "// exit while doing this best-effort upload, we can race with the", "// second upload but we can tolerate this as we'd rather get SOME", "// data into GCS than attempt to cancel these uploads and get none.", "interrupt", ":=", "make", "(", "chan", "os", ".", "Signal", ")", "\n", "signal", ".", "Notify", "(", "interrupt", ",", "os", ".", "Interrupt", ",", "syscall", ".", "SIGTERM", ")", "\n", "go", "func", "(", ")", "{", "select", "{", "case", "s", ":=", "<-", "interrupt", ":", "logrus", ".", "Errorf", "(", "\"", "\"", ",", "s", ")", "\n", "cancel", "(", ")", "\n", "case", "<-", "ctx", ".", "Done", "(", ")", ":", "}", "\n", "}", "(", ")", "\n\n", "if", "o", ".", "DeprecatedWrapperOptions", "!=", "nil", "{", "// This only fires if the prowjob controller and sidecar are at different commits", "logrus", ".", "Warnf", "(", "\"", "\"", ")", "\n", "}", "\n", "entries", ":=", "o", ".", "entries", "(", ")", "\n", "passed", ",", "aborted", ",", "failures", ":=", "wait", "(", "ctx", ",", "entries", ")", "\n\n", "cancel", "(", ")", "\n", "// If we are being asked to terminate by the kubelet but we have", "// seen the test process exit cleanly, we need a chance to upload", "// artifacts to GCS. The only valid way for this program to exit", "// after a SIGINT or SIGTERM in this situation is to finish", "// uploading, so we ignore the signals.", "signal", ".", "Ignore", "(", "os", ".", "Interrupt", ",", "syscall", ".", "SIGTERM", ")", "\n\n", "buildLog", ":=", "logReader", "(", "entries", ")", "\n", "metadata", ":=", "combineMetadata", "(", "entries", ")", "\n", "return", "failures", ",", "o", ".", "doUpload", "(", "spec", ",", "passed", ",", "aborted", ",", "metadata", ",", "buildLog", ")", "\n", "}" ]
10,897
all-10898
[ "ListenAndServeTLS", "serves", "HTTPS", "requests", "from", "the", "given", "TCP", "addr", "using", "the", "given", "handler", ".", "certFile", "and", "keyFile", "are", "paths", "to", "TLS", "certificate", "and", "key", "files", "." ]
[ "func", "ListenAndServeTLS", "(", "addr", ",", "certFile", ",", "keyFile", "string", ",", "handler", "RequestHandler", ")", "error", "{", "s", ":=", "&", "Server", "{", "Handler", ":", "<mask>", ",", "}", "\n", "return", "s", ".", "ListenAndServeTLS", "(", "addr", ",", "certFile", ",", "keyFile", ")", "\n", "}" ]
10,898
all-10899
[ "unaryExpr", "parses", "a", "unary", "expression", ".", "<Vector_selector", ">", "|", "<Matrix_selector", ">", "|", "(", "+", "|", "-", ")", "<number_literal", ">", "|", "(", "<expr", ">", ")" ]
[ "func", "(", "p", "*", "parser", ")", "unaryExpr", "(", ")", "Expr", "{", "switch", "t", ":=", "p", ".", "peek", "(", ")", ";", "t", ".", "typ", "{", "case", "ItemADD", ",", "ItemSUB", ":", "p", ".", "next", "(", ")", "\n", "e", ":=", "p", ".", "unaryExpr", "(", ")", "\n\n", "// Simplify unary expressions for number literals.", "if", "nl", ",", "ok", ":=", "e", ".", "(", "*", "NumberLiteral", ")", ";", "<mask>", "{", "if", "t", ".", "typ", "==", "ItemSUB", "{", "nl", ".", "Val", "*=", "-", "1", "\n", "}", "\n", "return", "nl", "\n", "}", "\n", "return", "&", "UnaryExpr", "{", "Op", ":", "t", ".", "typ", ",", "Expr", ":", "e", "}", "\n\n", "case", "ItemLeftParen", ":", "p", ".", "next", "(", ")", "\n", "e", ":=", "p", ".", "expr", "(", ")", "\n", "p", ".", "expect", "(", "ItemRightParen", ",", "\"", "\"", ")", "\n\n", "return", "&", "ParenExpr", "{", "Expr", ":", "e", "}", "\n", "}", "\n", "e", ":=", "p", ".", "primaryExpr", "(", ")", "\n\n", "// Expression might be followed by a range selector.", "if", "p", ".", "peek", "(", ")", ".", "typ", "==", "ItemLeftBracket", "{", "e", "=", "p", ".", "subqueryOrRangeSelector", "(", "e", ",", "true", ")", "\n", "}", "\n\n", "// Parse optional offset.", "if", "p", ".", "peek", "(", ")", ".", "typ", "==", "ItemOffset", "{", "offset", ":=", "p", ".", "offset", "(", ")", "\n\n", "switch", "s", ":=", "e", ".", "(", "type", ")", "{", "case", "*", "VectorSelector", ":", "s", ".", "Offset", "=", "offset", "\n", "case", "*", "MatrixSelector", ":", "s", ".", "Offset", "=", "offset", "\n", "case", "*", "SubqueryExpr", ":", "s", ".", "Offset", "=", "offset", "\n", "default", ":", "p", ".", "errorf", "(", "\"", "\"", ",", "e", ")", "\n", "}", "\n", "}", "\n\n", "return", "e", "\n", "}" ]
10,899
all-10900
[ "SetCreatedAt", "mocks", "base", "method" ]
[ "func", "(", "m", "*", "MockTaskResource", ")", "SetCreatedAt", "(", "arg0", "<mask>", ".", "Time", ")", "{", "m", ".", "ctrl", ".", "Call", "(", "m", ",", "\"", "\"", ",", "arg0", ")", "\n", "}" ]