id
stringlengths
2
7
text
stringlengths
17
51.2k
title
stringclasses
1 value
c7600
e.regenc[reflect.TypeOf(value)] = encoder }
c7601
== reflect.Ptr && v.Elem().IsValid() && v.Elem().Type().Kind() == reflect.Struct }
c7602
range conds { if cond == nil || !cond.IsValid() { continue } result = append(result, cond) } return result }
c7603
cond.WriteTo(w) if err != nil { return err } if needQuote { fmt.Fprint(w, ")") } if i != len(o)-1 { fmt.Fprint(w, " OR ") } } return nil }
c7604
b.buf = append(b.buf, c) return nil }
c7605
b.grow(utf8.UTFMax) } n := utf8.EncodeRune(b.buf[l:l+utf8.UTFMax], r) b.buf = b.buf[:l+n] return n, nil }
c7606
error) { b.copyCheck() b.buf = append(b.buf, s...) return len(s), nil }
c7607
return builder.Delete(conds...) }
c7608
} if len(condFalse) > 0 { c.condFalse = condFalse[0] } return c }
c7609
:= &Builder{cond: NewCond(), dialect: dialect} return builder }
c7610
= b.cond.And(cond) } else { b.cond = cond } return b }
c7611
return b.into } return b.from }
c7612
case string: b.joins = append(b.joins, join{joinType, joinTable, Expr(joinCond.(string))}) } return b }
c7613
} else { builder = b } if unionCond != nil { if unionCond.dialect == "" && builder.dialect != "" { unionCond.dialect = builder.dialect } builder.unions = append(builder.unions, union{unionTp, unionCond}) } return builder }
c7614
{ b.limitation.offset = offset[0] } return b }
c7615
return b.Join("INNER", joinTable, joinCond) }
c7616
return b.Join("LEFT", joinTable, joinCond) }
c7617
return b.Join("RIGHT", joinTable, joinCond) }
c7618
return b.Join("CROSS", joinTable, joinCond) }
c7619
return b.Join("FULL", joinTable, joinCond) }
c7620
And(b.cond, cond) return b }
c7621
Or(b.cond, cond) return b }
c7622
b.cond.And(conds...) b.optype = deleteType return b }
c7623
range conds { if cond == nil || !cond.IsValid() { continue } result = append(result, cond) } return result }
c7624
return builder.Update(updates...) }
c7625
And(between, And(conds...)) }
c7626
Or(between, Or(conds...)) }
c7627
return builder.Select(cols...) }
c7628
*Builder { b.orderBy = orderBy return b }
c7629
*Builder { b.groupBy = groupby return b }
c7630
*Builder { b.having = having return b }
c7631
NewCond()} return builder.Insert(eq...) }
c7632
return s.writer.Write(buf) }
c7633
{ s.args = append(s.args, args...) }
c7634
return cond.(*Builder).ToSQL() } return "", nil, ErrNotSupportType }
c7635
return cond.(*Builder).ToBoundSQL() } return "", ErrNotSupportType }
c7636
} if noSQLQuoteNeeded(arg) { _, err = fmt.Fprint(&buf, arg) } else { _, err = fmt.Fprintf(&buf, "'%v'", arg) } if err != nil { return "", err } j = j + 1 } } _, err := buf.WriteString(sql[start:]) if err != nil { return "", err } return buf.String(), nil }
c7637
{ case STRING_RSRC: coff.freezeRSRC() case STRING_RDATA: coff.freezeRDATA() } }
c7638
// Loop and replace higher values for i := 1; i < input.Len(); i++ { if input.Get(i) > max { max = input.Get(i) } } return max, nil }
c7639
// Return the last item if percent == 100.0 { return c[il-1], nil } // Find ordinal ranking or := int(math.Ceil(float64(il) * percent / 100)) // Return the item that is in the place of the ordinal rank if or == 0 { return c[0], nil } return c[or-1], nil }
c7640
:= qs.Q1 - (1.5 * iqr) uif := qs.Q3 + (1.5 * iqr) lof := qs.Q1 - (3 * iqr) uof := qs.Q3 + (3 * iqr) // Find the data points that are outside of the // inner and upper fences and add them to mild // and extreme outlier slices var mild Float64Data var extreme Float64Data for _, v := range copy { if v < lof ...
c7641
c2 = il / 2 } else { c1 = (il - 1) / 2 c2 = c1 + 1 } // Find the Medians with the cutoff points Q1, _ := Median(copy[:c1]) Q2, _ := Median(copy) Q3, _ := Median(copy[c2:]) return Quartiles{Q1, Q2, Q3}, nil }
c7642
} qs, _ := Quartile(input) iqr := qs.Q3 - qs.Q1 return iqr, nil }
c7643
_ := Quartile(input) mh := (qs.Q1 + qs.Q3) / 2 return mh, nil }
c7644
q, _ := Quartile(c) return (q.Q1 + (q.Q2 * 2) + q.Q3) / 4, nil }
c7645
point min = input.Get(0) // Iterate until done checking for a lower value for i := 1; i < l; i++ { if input.Get(i) < min { min = input.Get(i) } } return min, nil }
c7646
be compared _, decimal := math.Modf(digit) // If the decimal is less than .5 we round down otherwise up if decimal >= 0.5 { rounded = math.Ceil(digit) } else { rounded = math.Floor(digit) } // Finally we do the math to actually create a rounded number return rounded / precision * sign, nil }
c7647
v := input.Get(i) if v == 0 { continue } result += (v * math.Log(v)) } return -result, nil }
c7648
i == 0 { cumSum[i] = val } else { cumSum[i] = cumSum[i-1] + val } } return cumSum, nil }
c7649
- c) } sm := make([]float64, len(input)) for i, v := range input { sm[i] = math.Exp(v-c) / s } return sm, nil }
c7650
math.NaN(), EmptyInputErr } i := copyslice(input) m, _ := Median(i) for key, value := range i { i[key] = math.Abs(value - m) } return Median(i) }
c7651
variance vp, _ := PopulationVariance(input) // Return the population standard deviation return math.Pow(vp, 0.5), nil }
c7652
variance vs, _ := SampleVariance(input) // Return the sample standard deviation return math.Pow(vs, 0.5), nil }
c7653
} if len(dataPointX) != len(dataPointY) { return SizeErr } return nil }
c7654
tempDistance = math.Abs(dataPointX[i] - dataPointY[i]) if distance < tempDistance { distance = tempDistance } } return distance, nil }
c7655
i < len(dataPointX); i++ { distance = distance + ((dataPointX[i] - dataPointY[i]) * (dataPointX[i] - dataPointY[i])) } return math.Sqrt(distance), nil }
c7656
sum, _ := input.Sum() return sum / float64(input.Len()), nil }
c7657
of all the numbers var p float64 for _, n := range input { if p == 0 { p = n } else { p *= n } } // Calculate the geometric mean return math.Pow(p, 1/float64(l)), nil }
c7658
return math.NaN(), NegativeErr } else if n == 0 { return math.NaN(), ZeroErr } p += (1 / n) } return float64(l) / p, nil }
c7659
return math.NaN(), EmptyInputErr } // Add em up for _, n := range input { sum += n } return sum, nil }
c7660
/ (f*sum[2] - sum[0]*sum[0]) intercept := (sum[1] / f) - (gradient * sum[0] / f) // Create the new regression series for j := 0; j < len(s); j++ { regressions = append(regressions, Coordinate{ X: s[j].X, Y: s[j].X*gradient + intercept, }) } return regressions, nil }
c7661
(sum[2]*sum[3]-sum[5]*sum[4])/denominator) b := (sum[1]*sum[4] - sum[5]*sum[3]) / denominator for j := 0; j < len(s); j++ { regressions = append(regressions, Coordinate{ X: s[j].X, Y: a * math.Exp(b*s[j].X), }) } return regressions, nil }
c7662
sum[2] += s[i].Y sum[3] += math.Pow(math.Log(s[i].X), 2) } f := float64(i) a := (f*sum[1] - sum[2]*sum[0]) / (f*sum[3] - sum[0]*sum[0]) b := (sum[2] - a*sum[0]) / f for j := 0; j < len(s); j++ { regressions = append(regressions, Coordinate{ X: s[j].X, Y: b + a*math.Log(s[j].X), }) } return regres...
c7663
middle numbers // and divide by two using the mean function above // For odd numbers we just use the middle number l := len(c) if l == 0 { return math.NaN(), EmptyInputErr } else if l%2 == 0 { median, _ = Mean(c[l/2-1 : l/2+1]) } else { median = c[l/2] } return median, nil }
c7664
// "sample" will allow us to know if it's a sample // or population and wether to subtract by one or not return variance / float64((input.Len() - (1 * sample))), nil }
c7665
if err != nil { return math.NaN(), err } return v, nil }
c7666
if err != nil { return math.NaN(), err } return v, nil }
c7667
for i, v := range input { s[i] = 1 / (1 + math.Exp(-v)) } return s, nil }
c7668
_ := Round(input, 0) return int(r) }
c7669
make(Float64Data, input.Len()) copy(s, input) return s }
c7670
{ return input } copy = copyslice(input) sort.Float64s(copy) return }
c7671
return PercentileNearestRank(f, p) }
c7672
{ return Pearson(f, d) }
c7673
return CovariancePopulation(f, d) }
c7674
>= 0 { level = LogLevel(line[x+1 : x+y]) } } _, ok := f.badLevels[level] return !ok }
c7675
LogLevel) { f.MinLevel = min f.init() }
c7676
escaped[i] = quotePath(realRel(s)) } return strings.Join(escaped, " ") }
c7677
modified = v.Modified } v.Vars["@mods"] = mkArgs(modified) v.Vars["@dirmods"] = mkArgs(getDirs(modified)) return v.Vars[name], nil } return "", fmt.Errorf("No such variable: %s", name) }
c7678
if errv != nil { err = fmt.Errorf("No such variable: %s", ks) return nil } val = strings.Repeat(string(esc), cnt/2) + val return []byte(val) }, ), ) if err != nil { return "", err } return cmd, nil }
c7679
prog, "-d", prog, "-m", text, prog, ) go cmd.Run() }
c7680
start := time.Now() err, estate := ex.Run(log, true) if err != nil { return err } else if estate.Error != nil { log.Shout("%s", estate.Error) return ProcError{estate.Error.Error(), estate.ErrOutput} } log.Notice(">> done (%s)", time.Since(start)) return nil }
c7681
continue } if err != nil { return err } err = RunProc(cmd, sh, b.InDir, log.Stream(niceHeader("prep: ", cmd))) if err != nil { if pe, ok := err.(ProcError); ok { for _, n := range notifiers { n.Push("modd error", pe.Output, "") } } return err } } return nil }
c7682
match(l.peek()) { l.next() } }
c7683
l.emit(itemSpace) } else { return n } } }
c7684
l.emit(itemComment) } else if any(n, whitespace) { l.acceptRun(whitespace) l.emit(itemSpace) } else { return n } } }
c7685
continue case itemComment: continue default: return item } } }
c7686
case '\\': escaped = true l.next() continue default: l.next() } escaped = false } }
c7687
rune) bool { return !any(r, bareStringDisallowed) && r != eof }, ) }
c7688
return any(r, wordRunes) }, ) }
c7689
case eof: return fmt.Errorf("unterminated quoted string") case quote: break Loop } } return nil }
c7690
return nil } } else if any(n, quotes) { err := l.acceptQuotedString(n) if err != nil { l.errorf("%s", err) return nil } l.emit(itemQuotedString) } else if !any(n, bareStringDisallowed) { l.acceptBareString() l.emit(itemBareString) } else { l.backup() return lexBlockStart }...
c7691
l.errorf("%s", err) return nil } l.emit(itemQuotedString) } else if !any(n, bareStringDisallowed) { l.acceptLine(true) l.emit(itemBareString) } else { l.errorf("= must be followed by a string") return nil } } else { l.backup() return lexPatterns } } }
c7692
if n == '+' { l.acceptWord() l.emit(itemBareString) } else { l.errorf("invalid command option") return nil } } }
c7693
else if any(n, spaces) { l.acceptRun(spaces) l.emit(itemSpace) } else { l.acceptLine(true) l.emit(itemBareString) return lexInside } } }
c7694
confPath, ConfReload: confreload, Notifiers: notifiers, } err := mr.ReadConfig() if err != nil { return nil, err } return mr, nil }
c7695
} if _, err := shell.GetShellName(newcnf.GetVariables()[shellVarName]); err != nil { return err } newcnf.CommonExcludes(CommonExcludes) mr.Config = newcnf return nil }
c7696
err := RunPreps(b, mr.Config.GetVariables(), nil, mr.Log, mr.Notifiers, initial) if err != nil { return err } } return nil }
c7697
for mod := range modchan { if mod == nil { break } if mr.ConfReload && mod.Has(mr.ConfPath) { mr.Log.Notice("Reloading config %s", mr.ConfPath) err := mr.ReadConfig() if err != nil { mr.Log.Warn("%s", err) continue } else { return nil } } mr.Log.SayAs("debug", "Delta: \n%s", mod...
c7698
:= mr.runOnChan(modchan, func() {}) if err != nil { return err } } }
c7699
d.log.Notice(">> sending signal %s", d.conf.RestartSignal) err := d.ex.Signal(d.conf.RestartSignal) if err != nil { d.log.Warn( "failed to send %s signal to %s: %v", d.conf.RestartSignal, d.conf.Command, err, ) } } }