anchor dict | positive dict | negative dict |
|---|---|---|
{
"audio": "",
"image": "",
"text": "func (e *Encoder) RegisterEncoder(value interface{}, encoder func(reflect.Value) string) {\n",
"video": ""
} | {
"audio": "",
"image": "",
"text": "\te.regenc[reflect.TypeOf(value)] = encoder\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": " (interface{}, error)) *Init {\n\treturn ini.Branch(func() (interface{}, error) {\n\t\treturn ini.withTimeout(timeout, f)\n\t})\n}",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "func isValidStructPointer(v reflect.Value) bool {\n\treturn v.Type().Kind()",
"video": ""
} | {
"audio": "",
"image": "",
"text": " == reflect.Ptr && v.Elem().IsValid() && v.Elem().Type().Kind() == reflect.Struct\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": " a pointer to the value.\n\t\trv2 := reflect.New(rv.Type())\n\t\trv2.Elem().Set(rv)\n\t\tv = rv2.Interface()\n\tcase reflect.Ptr:\n\t\t// Represent slice types as the value itself.\n\t\tswitch rv.Type().Elem().Kind() {\n\t\tcase reflect.Slice:\n\t\t\tif rv.IsNil() {\n\t\t\t\tv... |
{
"audio": "",
"image": "",
"text": "func Or(conds ...Cond) Cond {\n\tvar result = make(condOr, 0, len(conds))\n\tfor _, cond :=",
"video": ""
} | {
"audio": "",
"image": "",
"text": " range conds {\n\t\tif cond == nil || !cond.IsValid() {\n\t\t\tcontinue\n\t\t}\n\t\tresult = append(result, cond)\n\t}\n\treturn result\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": "\tLastTransitionTime: cond.LastTransitionTime,\n\t\tLastUpdateTime: cond.LastTransitionTime,\n\t\tReason: cond.Reason,\n\t\tMessage: cond.Message,\n\t}\n}",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "func (o condOr) WriteTo(w Writer) error {\n\tfor i, cond := range o {\n\t\tvar needQuote bool\n\t\tswitch cond.(type) {\n\t\tcase condAnd, expr:\n\t\t\tneedQuote = true\n\t\tcase Eq:\n\t\t\tneedQuote = (len(cond.(Eq)) > 1)\n\t\tcase Neq:\n\t\t\tneedQuote = (len(cond.(Neq)) > 1... | {
"audio": "",
"image": "",
"text": " cond.WriteTo(w)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tif needQuote {\n\t\t\tfmt.Fprint(w, \")\")\n\t\t}\n\n\t\tif i != len(o)-1 {\n\t\t\tfmt.Fprint(w, \" OR \")\n\t\t}\n\t}\n\n\treturn nil\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": "\tLastTransitionTime: cond.LastTransitionTime,\n\t\tLastUpdateTime: cond.LastTransitionTime,\n\t\tReason: cond.Reason,\n\t\tMessage: cond.Message,\n\t}\n}",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "func (b *StringBuilder) WriteByte(c byte) error {\n\tb.copyCheck()",
"video": ""
} | {
"audio": "",
"image": "",
"text": "\n\tb.buf = append(b.buf, c)\n\treturn nil\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": " = b\n\tps.buf.WriteByte(b)\n}",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "func (b *StringBuilder) WriteRune(r rune) (int, error) {\n\tb.copyCheck()\n\tif r < utf8.RuneSelf {\n\t\tb.buf = append(b.buf, byte(r))\n\t\treturn 1, nil\n\t}\n\tl := len(b.buf)\n\tif cap(b.buf)-l < utf8.UTFMax {\n",
"video": ""
} | {
"audio": "",
"image": "",
"text": "\t\tb.grow(utf8.UTFMax)\n\t}\n\tn := utf8.EncodeRune(b.buf[l:l+utf8.UTFMax], r)\n\tb.buf = b.buf[:l+n]\n\treturn n, nil\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": " []byte\n\t\t\tcount := copy(temp, b.s[b.r:b.w])\n\t\t\tif count == 0 {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tcopy(b.s, temp)\n\t\t\tb.w = b.r - b.w\n\t\t\tb.r = 0\n\t\t}\n\t}\n\treturn\n}",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "func (b *StringBuilder) WriteString(s string) (int,",
"video": ""
} | {
"audio": "",
"image": "",
"text": " error) {\n\tb.copyCheck()\n\tb.buf = append(b.buf, s...)\n\treturn len(s), nil\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": "\t\tif idx != len(arr)-1 {\n\t\t\tbuf.WriteString(\", \")\n\t\t}\n\t}\n\n\tbuf.WriteString(\"], Hex: [\")\n\n\tfor idx, b := range arr {\n\t\tbuf.WriteString(fmt.Sprintf(\"%X\", b))\n\t\tif idx != len(arr)-1 {\n\t\t\tbuf.WriteString(\" \")\n\t\t}\n\t}\n\n\tbuf.WriteString(\"],... |
{
"audio": "",
"image": "",
"text": "func Delete(conds ...Cond) *Builder {\n\tbuilder := &Builder{cond: NewCond()}\n",
"video": ""
} | {
"audio": "",
"image": "",
"text": "\treturn builder.Delete(conds...)\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": " range conds {\n\t\tif cond == nil || !cond.IsValid() {\n\t\t\tcontinue\n\t\t}\n\t\tresult = append(result, cond)\n\t}\n\treturn result\n}",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "func If(condition bool, condTrue Cond, condFalse ...Cond) Cond {\n\tvar c = condIf{\n\t\tcondition: condition,\n\t\tcondTrue: condTrue,",
"video": ""
} | {
"audio": "",
"image": "",
"text": "\n\t}\n\tif len(condFalse) > 0 {\n\t\tc.condFalse = condFalse[0]\n\t}\n\treturn c\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": "\tLastTransitionTime: cond.LastTransitionTime,\n\t\tLastUpdateTime: cond.LastTransitionTime,\n\t\tReason: cond.Reason,\n\t\tMessage: cond.Message,\n\t}\n}",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "func Dialect(dialect string) *Builder {\n\tbuilder",
"video": ""
} | {
"audio": "",
"image": "",
"text": " := &Builder{cond: NewCond(), dialect: dialect}\n\treturn builder\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": "\n\t_, err := mg.db.Exec(mg.dialect.dropTableSql(tn))\n\tif err != nil && !mg.dialect.catchMigrationError(err) {\n\t\tpanic(err)\n\t}\n}",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "func (b *Builder) Where(cond Cond) *Builder {\n\tif b.cond.IsValid() {\n\t\tb.cond",
"video": ""
} | {
"audio": "",
"image": "",
"text": " = b.cond.And(cond)\n\t} else {\n\t\tb.cond = cond\n\t}\n\treturn b\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": "\tLastTransitionTime: cond.LastTransitionTime,\n\t\tLastUpdateTime: cond.LastTransitionTime,\n\t\tReason: cond.Reason,\n\t\tMessage: cond.Message,\n\t}\n}",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "func (b *Builder) TableName() string {\n\tif b.optype == insertType {",
"video": ""
} | {
"audio": "",
"image": "",
"text": "\n\t\treturn b.into\n\t}\n\treturn b.from\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": " *Builder {\n\tb.tableName = tableName\n\treturn b\n}",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "func (b *Builder) Join(joinType, joinTable string, joinCond interface{}) *Builder {\n\tswitch joinCond.(type) {\n\tcase Cond:\n\t\tb.joins = append(b.joins, join{joinType, joinTable, joinCond.(Cond)})\n",
"video": ""
} | {
"audio": "",
"image": "",
"text": "\tcase string:\n\t\tb.joins = append(b.joins, join{joinType, joinTable, Expr(joinCond.(string))})\n\t}\n\n\treturn b\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": " *Builder {\n\tb.tableName = tableName\n\treturn b\n}",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "func (b *Builder) Union(unionTp string, unionCond *Builder) *Builder {\n\tvar builder *Builder\n\tif b.optype != unionType {\n\t\tbuilder = &Builder{cond: NewCond()}\n\t\tbuilder.optype = unionType\n\t\tbuilder.dialect = b.dialect\n\t\tbuilder.selects = b.selects\n\n\t\tcurren... | {
"audio": "",
"image": "",
"text": "\n\t} else {\n\t\tbuilder = b\n\t}\n\n\tif unionCond != nil {\n\t\tif unionCond.dialect == \"\" && builder.dialect != \"\" {\n\t\t\tunionCond.dialect = builder.dialect\n\t\t}\n\n\t\tbuilder.unions = append(builder.unions, union{unionTp, unionCond})\n\t}\n\n\treturn builder\n}"... | {
"audio": "",
"image": "",
"text": " {\n\tbuilder.protobuf.RangeMin = []byte(strconv.FormatInt(min, 10))\n\tbuilder.protobuf.RangeMax = []byte(strconv.FormatInt(max, 10))\n\treturn builder\n}",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "func (b *Builder) Limit(limitN int, offset ...int) *Builder {\n\tb.limitation = &limit{limitN: limitN}\n\n\tif len(offset) > 0",
"video": ""
} | {
"audio": "",
"image": "",
"text": " {\n\t\tb.limitation.offset = offset[0]\n\t}\n\n\treturn b\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": " *Builder {\n\tb.tableName = tableName\n\treturn b\n}",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "func (b *Builder) InnerJoin(joinTable string, joinCond interface{}) *Builder {\n",
"video": ""
} | {
"audio": "",
"image": "",
"text": "\treturn b.Join(\"INNER\", joinTable, joinCond)\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": " *Builder {\n\tb.tableName = tableName\n\treturn b\n}",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "func (b *Builder) LeftJoin(joinTable string, joinCond interface{}) *Builder {\n",
"video": ""
} | {
"audio": "",
"image": "",
"text": "\treturn b.Join(\"LEFT\", joinTable, joinCond)\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": " *Builder {\n\tb.tableName = tableName\n\treturn b\n}",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "func (b *Builder) RightJoin(joinTable string, joinCond interface{}) *Builder {\n",
"video": ""
} | {
"audio": "",
"image": "",
"text": "\treturn b.Join(\"RIGHT\", joinTable, joinCond)\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": " *Builder {\n\tb.tableName = tableName\n\treturn b\n}",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "func (b *Builder) CrossJoin(joinTable string, joinCond interface{}) *Builder {\n",
"video": ""
} | {
"audio": "",
"image": "",
"text": "\treturn b.Join(\"CROSS\", joinTable, joinCond)\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": " *Builder {\n\tb.tableName = tableName\n\treturn b\n}",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "func (b *Builder) FullJoin(joinTable string, joinCond interface{}) *Builder {\n",
"video": ""
} | {
"audio": "",
"image": "",
"text": "\treturn b.Join(\"FULL\", joinTable, joinCond)\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": " *Builder {\n\tb.tableName = tableName\n\treturn b\n}",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "func (b *Builder) And(cond Cond) *Builder {\n\tb.cond =",
"video": ""
} | {
"audio": "",
"image": "",
"text": " And(b.cond, cond)\n\treturn b\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": "\tLastTransitionTime: cond.LastTransitionTime,\n\t\tLastUpdateTime: cond.LastTransitionTime,\n\t\tReason: cond.Reason,\n\t\tMessage: cond.Message,\n\t}\n}",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "func (b *Builder) Or(cond Cond) *Builder {\n\tb.cond =",
"video": ""
} | {
"audio": "",
"image": "",
"text": " Or(b.cond, cond)\n\treturn b\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": "\tLastTransitionTime: cond.LastTransitionTime,\n\t\tLastUpdateTime: cond.LastTransitionTime,\n\t\tReason: cond.Reason,\n\t\tMessage: cond.Message,\n\t}\n}",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "func (b *Builder) Delete(conds ...Cond) *Builder {\n\tb.cond =",
"video": ""
} | {
"audio": "",
"image": "",
"text": " b.cond.And(conds...)\n\tb.optype = deleteType\n\treturn b\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": " *Builder {\n\tb.tableName = tableName\n\treturn b\n}",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "func And(conds ...Cond) Cond {\n\tvar result = make(condAnd, 0, len(conds))\n\tfor _, cond :=",
"video": ""
} | {
"audio": "",
"image": "",
"text": " range conds {\n\t\tif cond == nil || !cond.IsValid() {\n\t\t\tcontinue\n\t\t}\n\t\tresult = append(result, cond)\n\t}\n\treturn result\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": " range conds {\n\t\tif cond == nil || !cond.IsValid() {\n\t\t\tcontinue\n\t\t}\n\t\tresult = append(result, cond)\n\t}\n\treturn result\n}",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "func Update(updates ...Eq) *Builder {\n\tbuilder := &Builder{cond: NewCond()}\n",
"video": ""
} | {
"audio": "",
"image": "",
"text": "\treturn builder.Update(updates...)\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": "\tupdates := getMigrations(versions, curVersion)\n\treturn t.db.Update(func(tx *bbolt.Tx) error {\n\t\tfor _, update := range updates {\n\t\t\tif update.migration == nil {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tlog.Infof(\"Applying migration #%d\", update.number)\n\n\t\t\terr := ... |
{
"audio": "",
"image": "",
"text": "func (between Between) And(conds ...Cond) Cond {\n\treturn",
"video": ""
} | {
"audio": "",
"image": "",
"text": " And(between, And(conds...))\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": " range conds {\n\t\tif cond == nil || !cond.IsValid() {\n\t\t\tcontinue\n\t\t}\n\t\tresult = append(result, cond)\n\t}\n\treturn result\n}",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "func (between Between) Or(conds ...Cond) Cond {\n\treturn",
"video": ""
} | {
"audio": "",
"image": "",
"text": " Or(between, Or(conds...))\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": " range conds {\n\t\tif cond == nil || !cond.IsValid() {\n\t\t\tcontinue\n\t\t}\n\t\tresult = append(result, cond)\n\t}\n\treturn result\n}",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "func Select(cols ...string) *Builder {\n\tbuilder := &Builder{cond: NewCond()}\n",
"video": ""
} | {
"audio": "",
"image": "",
"text": "\treturn builder.Select(cols...)\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": " < length; i++ {\n\t\t\tbuffer.WriteString(builder.ph())\n\n\t\t\tif i < length-1 {\n\t\t\t\tbuffer.WriteString(\",\")\n\t\t\t}\n\t\t}\n\t\tbuffer.WriteString(\")\")\n\t}\n\n\tif builder.returnField != \"\" {\n\t\tbuffer.WriteString(\" RETURNING \")\n\t\tbuffer.WriteString(bui... |
{
"audio": "",
"image": "",
"text": "func (b *Builder) OrderBy(orderBy string)",
"video": ""
} | {
"audio": "",
"image": "",
"text": " *Builder {\n\tb.orderBy = orderBy\n\treturn b\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": "\t\t\treturn true\n\t\t}\n\t}\n\tif sel.Having != nil {\n\t\tif ast.HasAggFlag(sel.Having.Expr) {\n\t\t\treturn true\n\t\t}\n\t}\n\tif sel.OrderBy != nil {\n\t\tfor _, item := range sel.OrderBy.Items {\n\t\t\tif ast.HasAggFlag(item.Expr) {\n\t\t\t\treturn true\n\t\t\t}\n\t\t}\... |
{
"audio": "",
"image": "",
"text": "func (b *Builder) GroupBy(groupby string)",
"video": ""
} | {
"audio": "",
"image": "",
"text": " *Builder {\n\tb.groupBy = groupby\n\treturn b\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": " *Builder {\n\tb.tableName = tableName\n\treturn b\n}",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "func (b *Builder) Having(having string)",
"video": ""
} | {
"audio": "",
"image": "",
"text": " *Builder {\n\tb.having = having\n\treturn b\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": "\t\t\treturn true\n\t\t}\n\t}\n\tif sel.Having != nil {\n\t\tif ast.HasAggFlag(sel.Having.Expr) {\n\t\t\treturn true\n\t\t}\n\t}\n\tif sel.OrderBy != nil {\n\t\tfor _, item := range sel.OrderBy.Items {\n\t\t\tif ast.HasAggFlag(item.Expr) {\n\t\t\t\treturn true\n\t\t\t}\n\t\t}\... |
{
"audio": "",
"image": "",
"text": "func Insert(eq ...interface{}) *Builder {\n\tbuilder := &Builder{cond:",
"video": ""
} | {
"audio": "",
"image": "",
"text": " NewCond()}\n\treturn builder.Insert(eq...)\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": " *Builder {\n\tb.tableName = tableName\n\treturn b\n}",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "func (s *BytesWriter) Write(buf []byte) (int, error) {\n",
"video": ""
} | {
"audio": "",
"image": "",
"text": "\treturn s.writer.Write(buf)\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": " (n int, err error) {\n\treturn w.terminal.write(data, w.ws)\n}",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "func (s *BytesWriter) Append(args ...interface{})",
"video": ""
} | {
"audio": "",
"image": "",
"text": " {\n\ts.args = append(s.args, args...)\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": " CommandTarget), we can emit it on either side.\n\tif !cl.Target.followsFlagSeparator() {\n\t\targs = append(args, targetArgs...)\n\t\targs = append(args, flagSeparator...)\n\t} else {\n\t\targs = append(args, flagSeparator...)\n\t\targs = append(args, targetArgs...)\n\t}\n\n\... |
{
"audio": "",
"image": "",
"text": "func ToSQL(cond interface{}) (string, []interface{}, error) {\n\tswitch cond.(type) {\n\tcase Cond:\n\t\treturn condToSQL(cond.(Cond))\n\tcase *Builder:\n",
"video": ""
} | {
"audio": "",
"image": "",
"text": "\t\treturn cond.(*Builder).ToSQL()\n\t}\n\treturn \"\", nil, ErrNotSupportType\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": "\tLastTransitionTime: cond.LastTransitionTime,\n\t\tLastUpdateTime: cond.LastTransitionTime,\n\t\tReason: cond.Reason,\n\t\tMessage: cond.Message,\n\t}\n}",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "func ToBoundSQL(cond interface{}) (string, error) {\n\tswitch cond.(type) {\n\tcase Cond:\n\t\treturn condToBoundSQL(cond.(Cond))\n\tcase *Builder:\n\t",
"video": ""
} | {
"audio": "",
"image": "",
"text": "\treturn cond.(*Builder).ToBoundSQL()\n\t}\n\treturn \"\", ErrNotSupportType\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": "\tLastTransitionTime: cond.LastTransitionTime,\n\t\tLastUpdateTime: cond.LastTransitionTime,\n\t\tReason: cond.Reason,\n\t\tMessage: cond.Message,\n\t}\n}",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "func ConvertToBoundSQL(sql string, args []interface{}) (string, error) {\n\tbuf := StringBuilder{}\n\tvar i, j, start int\n\tfor ; i < len(sql); i++ {\n\t\tif sql[i] == '?' {\n\t\t\t_, err := buf.WriteString(sql[start:i])\n\t\t\tif err != nil {\n\t\t\t\treturn \"\", err\n\t\t\... | {
"audio": "",
"image": "",
"text": "\n\t\t\t}\n\n\t\t\tif noSQLQuoteNeeded(arg) {\n\t\t\t\t_, err = fmt.Fprint(&buf, arg)\n\t\t\t} else {\n\t\t\t\t_, err = fmt.Fprintf(&buf, \"'%v'\", arg)\n\t\t\t}\n\t\t\tif err != nil {\n\t\t\t\treturn \"\", err\n\t\t\t}\n\t\t\tj = j + 1\n\t\t}\n\t}\n\t_, err := buf.WriteString... | {
"audio": "",
"image": "",
"text": "\n\t// Move head of each bucket into buf, removing buckets that become empty.\n\tvar i, j int\n\tfor ; i < len(buf); i, j = i+1, (j+1)%len(buckets) {\n\t\tb := buckets[j]\n\t\tbuf[i] = &(*b[0])\n\t\tbuckets[j] = b[1:]\n\t\tif len(b) == 1 {\n\t\t\tbuckets = append(buckets[:j], ... |
{
"audio": "",
"image": "",
"text": "func (coff *Coff) Freeze() {\n\tswitch coff.SectionHeader32.Name",
"video": ""
} | {
"audio": "",
"image": "",
"text": " {\n\tcase STRING_RSRC:\n\t\tcoff.freezeRSRC()\n\tcase STRING_RDATA:\n\t\tcoff.freezeRDATA()\n\t}\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": " {\n\t\to.pkgauthor = parts[1]\n\t\to.Name(parts[2])\n\t\tswitch parts[0] {\n\t\tcase \"github.com\", \"bitbucket.org\":\n\t\t\to.pkgrepo = \"https://\" + strings.Join(parts[0:3], \"/\")\n\t\t}\n\t}\n\n\treturn o\n}",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "func Max(input Float64Data) (max float64, err error) {\n\n\t// Return an error if there are no numbers\n\tif input.Len() == 0 {\n\t\treturn math.NaN(), EmptyInputErr\n\t}\n\n\t// Get the first value as the starting point\n\tmax = input.Get(0)\n",
"video": ""
} | {
"audio": "",
"image": "",
"text": "\n\t// Loop and replace higher values\n\tfor i := 1; i < input.Len(); i++ {\n\t\tif input.Get(i) > max {\n\t\t\tmax = input.Get(i)\n\t\t}\n\t}\n\n\treturn max, nil\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": "\t\t\tmin = mid + 1\n\t\t} else {\n\t\t\tmax = mid\n\t\t}\n\t}\n\tif max < 0 || s.Set[min].Less(q) {\n\t\treturn len(s.Set), false // q is the new largest value\n\t}\n\treturn min, s.Set[min].Contains(q)\n}",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "func PercentileNearestRank(input Float64Data, percent float64) (percentile float64, err error) {\n\n\t// Find the length of items in the slice\n\til := input.Len()\n\n\t// Return an error for empty slices\n\tif il == 0 {\n\t\treturn math.NaN(), EmptyInputErr\n\t}\n\n\t// Retur... | {
"audio": "",
"image": "",
"text": "\n\t// Return the last item\n\tif percent == 100.0 {\n\t\treturn c[il-1], nil\n\t}\n\n\t// Find ordinal ranking\n\tor := int(math.Ceil(float64(il) * percent / 100))\n\n\t// Return the item that is in the place of the ordinal rank\n\tif or == 0 {\n\t\treturn c[0], nil\n\t}\n\tr... | {
"audio": "",
"image": "",
"text": " == 0 {\n\t\treturn teleport.CertificateFormatStandard\n\t}\n\n\t// sort the slice so the most permissive is the first element\n\tsort.Slice(formats, func(i, j int) bool {\n\t\treturn certificatePriority(formats[i]) < certificatePriority(formats[j])\n\t})\n\n\treturn formats[0... |
{
"audio": "",
"image": "",
"text": "func QuartileOutliers(input Float64Data) (Outliers, error) {\n\tif input.Len() == 0 {\n\t\treturn Outliers{}, EmptyInputErr\n\t}\n\n\t// Start by sorting a copy of the slice\n\tcopy := sortedCopy(input)\n\n\t// Calculate the quartiles and interquartile range\n\tqs, _ := Quarti... | {
"audio": "",
"image": "",
"text": " := qs.Q1 - (1.5 * iqr)\n\tuif := qs.Q3 + (1.5 * iqr)\n\tlof := qs.Q1 - (3 * iqr)\n\tuof := qs.Q3 + (3 * iqr)\n\n\t// Find the data points that are outside of the\n\t// inner and upper fences and add them to mild\n\t// and extreme outlier slices\n\tvar mild Float64Data\n\tvar ... | {
"audio": "",
"image": "",
"text": " read full sections and the last possibly partial section from the input buffer\n\tfor smax < l {\n\t\t// section complete; push to tree asynchronously\n\t\tgo h.writeSection(t.cursor, t.section, true, false)\n\t\t// reset section\n\t\tt.section = make([]byte, secsize)\n\t\t//... |
{
"audio": "",
"image": "",
"text": "func Quartile(input Float64Data) (Quartiles, error) {\n\n\til := input.Len()\n\tif il == 0 {\n\t\treturn Quartiles{}, EmptyInputErr\n\t}\n\n\t// Start by sorting a copy of the slice\n\tcopy := sortedCopy(input)\n\n\t// Find the cutoff places depeding on if\n\t// the input slic... | {
"audio": "",
"image": "",
"text": "\tc2 = il / 2\n\t} else {\n\t\tc1 = (il - 1) / 2\n\t\tc2 = c1 + 1\n\t}\n\n\t// Find the Medians with the cutoff points\n\tQ1, _ := Median(copy[:c1])\n\tQ2, _ := Median(copy)\n\tQ3, _ := Median(copy[c2:])\n\n\treturn Quartiles{Q1, Q2, Q3}, nil\n\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": " \t\tC0 [T0/P0, T1/P1]\n\t// \t\tC1 [T0/P1, T1/P0]\n\t//\n\t// Even though the later is still round robin, the partitions are crossed\n\t//\n\tfor _, members := range membersByTopic {\n\t\tsort.Slice(members, func(i, j int) bool {\n\t\t\treturn members[i].MemberID < members[j]... |
{
"audio": "",
"image": "",
"text": "func InterQuartileRange(input Float64Data) (float64, error) {\n\tif input.Len() == 0 {\n\t\treturn math.NaN(), EmptyInputErr\n",
"video": ""
} | {
"audio": "",
"image": "",
"text": "\t}\n\tqs, _ := Quartile(input)\n\tiqr := qs.Q3 - qs.Q1\n\treturn iqr, nil\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": " error {\n\td.kv.Delete(schedPrefix + \"/\" + input.UUID)\n\treturn nil\n}",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "func Midhinge(input Float64Data) (float64, error) {\n\tif input.Len() == 0 {\n\t\treturn math.NaN(), EmptyInputErr\n\t}\n\tqs,",
"video": ""
} | {
"audio": "",
"image": "",
"text": " _ := Quartile(input)\n\tmh := (qs.Q1 + qs.Q3) / 2\n\treturn mh, nil\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": " error {\n\td.kv.Delete(schedPrefix + \"/\" + input.UUID)\n\treturn nil\n}",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "func Trimean(input Float64Data) (float64, error) {\n\tif input.Len() == 0 {\n\t\treturn math.NaN(), EmptyInputErr\n\t}\n\n\tc := sortedCopy(input)",
"video": ""
} | {
"audio": "",
"image": "",
"text": "\n\tq, _ := Quartile(c)\n\n\treturn (q.Q1 + (q.Q2 * 2) + q.Q3) / 4, nil\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": "\t\tPort uint16 `json:\"port,omitempty\"`\n\t}\n\tif err := json.Unmarshal(b, &input); err != nil {\n\t\treturn err\n\t}\n\tu.Scheme = input.Scheme\n\tu.Host = input.Host\n\tu.Port = input.Port\n\treturn nil\n}",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "func Min(input Float64Data) (min float64, err error) {\n\n\t// Get the count of numbers in the slice\n\tl := input.Len()\n\n\t// Return an error if there are no numbers\n\tif l == 0 {\n\t\treturn math.NaN(), EmptyInputErr\n\t}\n\n\t// Get the first value as the starting",
"v... | {
"audio": "",
"image": "",
"text": " point\n\tmin = input.Get(0)\n\n\t// Iterate until done checking for a lower value\n\tfor i := 1; i < l; i++ {\n\t\tif input.Get(i) < min {\n\t\t\tmin = input.Get(i)\n\t\t}\n\t}\n\treturn min, nil\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": " == 0 {\n\t\treturn teleport.CertificateFormatStandard\n\t}\n\n\t// sort the slice so the most permissive is the first element\n\tsort.Slice(formats, func(i, j int) bool {\n\t\treturn certificatePriority(formats[i]) < certificatePriority(formats[j])\n\t})\n\n\treturn formats[0... |
{
"audio": "",
"image": "",
"text": "func Round(input float64, places int) (rounded float64, err error) {\n\n\t// If the float is not a number\n\tif math.IsNaN(input) {\n\t\treturn math.NaN(), NaNErr\n\t}\n\n\t// Find out the actual sign and correct the input for later\n\tsign := 1.0\n\tif input < 0 {\n\t\tsign =... | {
"audio": "",
"image": "",
"text": " be compared\n\t_, decimal := math.Modf(digit)\n\n\t// If the decimal is less than .5 we round down otherwise up\n\tif decimal >= 0.5 {\n\t\trounded = math.Ceil(digit)\n\t} else {\n\t\trounded = math.Floor(digit)\n\t}\n\n\t// Finally we do the math to actually create a rounded... | {
"audio": "",
"image": "",
"text": " buffer\n\t\t\t\tbuf.WriteString(read)\n\t\t\t}\n\n\t\t\t// Advance the cursor in the input string to account for\n\t\t\t// bytes consumed to read the variable name expression\n\t\t\tcursor += advance\n\n\t\t\t// Advance the checkpoint in the input string\n\t\t\tcheckpoint = c... |
{
"audio": "",
"image": "",
"text": "func Entropy(input Float64Data) (float64, error) {\n\tinput, err := normalize(input)\n\tif err != nil {\n\t\treturn math.NaN(), err\n\t}\n\tvar result float64\n\tfor i := 0; i < input.Len(); i++ {\n",
"video": ""
} | {
"audio": "",
"image": "",
"text": "\t\tv := input.Get(i)\n\t\tif v == 0 {\n\t\t\tcontinue\n\t\t}\n\t\tresult += (v * math.Log(v))\n\t}\n\treturn -result, nil\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": " := func() error {\n\t\t\tfor i := range indices {\n\t\t\t\terr := bt.readyWorker(\n\t\t\t\t\tgroupCtx, id, bcache, rp, bps, pathsFromRoot, makeSync,\n\t\t\t\t\ti, level, &lock, oldPtrs, donePtrs)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn... |
{
"audio": "",
"image": "",
"text": "func CumulativeSum(input Float64Data) ([]float64, error) {\n\n\tif input.Len() == 0 {\n\t\treturn Float64Data{}, EmptyInput\n\t}\n\n\tcumSum := make([]float64, input.Len())\n\n\tfor i, val := range input {\n\t\tif",
"video": ""
} | {
"audio": "",
"image": "",
"text": " i == 0 {\n\t\t\tcumSum[i] = val\n\t\t} else {\n\t\t\tcumSum[i] = cumSum[i-1] + val\n\t\t}\n\t}\n\n\treturn cumSum, nil\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": "\t\tPort uint16 `json:\"port,omitempty\"`\n\t}\n\tif err := json.Unmarshal(b, &input); err != nil {\n\t\treturn err\n\t}\n\tu.Scheme = input.Scheme\n\tu.Host = input.Host\n\tu.Port = input.Port\n\treturn nil\n}",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "func SoftMax(input Float64Data) ([]float64, error) {\n\tif input.Len() == 0 {\n\t\treturn Float64Data{}, EmptyInput\n\t}\n\n\ts := 0.0\n\tc, _ := Max(input)\n\tfor _, e := range input {\n\t\ts += math.Exp(e",
"video": ""
} | {
"audio": "",
"image": "",
"text": " - c)\n\t}\n\n\tsm := make([]float64, len(input))\n\tfor i, v := range input {\n\t\tsm[i] = math.Exp(v-c) / s\n\t}\n\n\treturn sm, nil\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": "\t\tPort uint16 `json:\"port,omitempty\"`\n\t}\n\tif err := json.Unmarshal(b, &input); err != nil {\n\t\treturn err\n\t}\n\tu.Scheme = input.Scheme\n\tu.Host = input.Host\n\tu.Port = input.Port\n\treturn nil\n}",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "func MedianAbsoluteDeviationPopulation(input Float64Data) (mad float64, err error) {\n\tif input.Len() == 0 {\n\t\treturn",
"video": ""
} | {
"audio": "",
"image": "",
"text": " math.NaN(), EmptyInputErr\n\t}\n\n\ti := copyslice(input)\n\tm, _ := Median(i)\n\n\tfor key, value := range i {\n\t\ti[key] = math.Abs(value - m)\n\t}\n\n\treturn Median(i)\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": "\t\tPort uint16 `json:\"port,omitempty\"`\n\t}\n\tif err := json.Unmarshal(b, &input); err != nil {\n\t\treturn err\n\t}\n\tu.Scheme = input.Scheme\n\tu.Host = input.Host\n\tu.Port = input.Port\n\treturn nil\n}",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "func StandardDeviationPopulation(input Float64Data) (sdev float64, err error) {\n\n\tif input.Len() == 0 {\n\t\treturn math.NaN(), EmptyInputErr\n\t}\n\n\t// Get the population",
"video": ""
} | {
"audio": "",
"image": "",
"text": " variance\n\tvp, _ := PopulationVariance(input)\n\n\t// Return the population standard deviation\n\treturn math.Pow(vp, 0.5), nil\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": "\t\tPort uint16 `json:\"port,omitempty\"`\n\t}\n\tif err := json.Unmarshal(b, &input); err != nil {\n\t\treturn err\n\t}\n\tu.Scheme = input.Scheme\n\tu.Host = input.Host\n\tu.Port = input.Port\n\treturn nil\n}",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "func StandardDeviationSample(input Float64Data) (sdev float64, err error) {\n\n\tif input.Len() == 0 {\n\t\treturn math.NaN(), EmptyInputErr\n\t}\n\n\t// Get the sample",
"video": ""
} | {
"audio": "",
"image": "",
"text": " variance\n\tvs, _ := SampleVariance(input)\n\n\t// Return the sample standard deviation\n\treturn math.Pow(vs, 0.5), nil\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": "\t\tPort uint16 `json:\"port,omitempty\"`\n\t}\n\tif err := json.Unmarshal(b, &input); err != nil {\n\t\treturn err\n\t}\n\tu.Scheme = input.Scheme\n\tu.Host = input.Host\n\tu.Port = input.Port\n\treturn nil\n}",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "func validateData(dataPointX, dataPointY Float64Data) error {\n\tif len(dataPointX) == 0 || len(dataPointY) == 0 {\n\t\treturn EmptyInputErr",
"video": ""
} | {
"audio": "",
"image": "",
"text": "\n\t}\n\n\tif len(dataPointX) != len(dataPointY) {\n\t\treturn SizeErr\n\t}\n\treturn nil\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": " nil || len(right.Start) == 0\n\t}\n\tif right == nil {\n\t\treturn len(left.Start) == 0\n\t}\n\treturn bytes.Equal(left.Start, right.Start)\n}",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "func ChebyshevDistance(dataPointX, dataPointY Float64Data) (distance float64, err error) {\n\terr = validateData(dataPointX, dataPointY)\n\tif err != nil {\n\t\treturn math.NaN(), err\n\t}\n\tvar tempDistance float64\n\tfor i := 0; i < len(dataPointY); i++ {",
"video": ""
} | {
"audio": "",
"image": "",
"text": "\n\t\ttempDistance = math.Abs(dataPointX[i] - dataPointY[i])\n\t\tif distance < tempDistance {\n\t\t\tdistance = tempDistance\n\t\t}\n\t}\n\treturn distance, nil\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": " := func() error {\n\t\t\tfor i := range indices {\n\t\t\t\terr := bt.readyWorker(\n\t\t\t\t\tgroupCtx, id, bcache, rp, bps, pathsFromRoot, makeSync,\n\t\t\t\t\ti, level, &lock, oldPtrs, donePtrs)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn... |
{
"audio": "",
"image": "",
"text": "func EuclideanDistance(dataPointX, dataPointY Float64Data) (distance float64, err error) {\n\n\terr = validateData(dataPointX, dataPointY)\n\tif err != nil {\n\t\treturn math.NaN(), err\n\t}\n\tdistance = 0\n\tfor i := 0;",
"video": ""
} | {
"audio": "",
"image": "",
"text": " i < len(dataPointX); i++ {\n\t\tdistance = distance + ((dataPointX[i] - dataPointY[i]) * (dataPointX[i] - dataPointY[i]))\n\t}\n\treturn math.Sqrt(distance), nil\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": " := func() error {\n\t\t\tfor i := range indices {\n\t\t\t\terr := bt.readyWorker(\n\t\t\t\t\tgroupCtx, id, bcache, rp, bps, pathsFromRoot, makeSync,\n\t\t\t\t\ti, level, &lock, oldPtrs, donePtrs)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn... |
{
"audio": "",
"image": "",
"text": "func Mean(input Float64Data) (float64, error) {\n\n\tif input.Len() == 0 {\n\t\treturn math.NaN(), EmptyInputErr\n\t}\n\n",
"video": ""
} | {
"audio": "",
"image": "",
"text": "\tsum, _ := input.Sum()\n\n\treturn sum / float64(input.Len()), nil\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": " error {\n\td.kv.Delete(schedPrefix + \"/\" + input.UUID)\n\treturn nil\n}",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "func GeometricMean(input Float64Data) (float64, error) {\n\n\tl := input.Len()\n\tif l == 0 {\n\t\treturn math.NaN(), EmptyInputErr\n\t}\n\n\t// Get the product",
"video": ""
} | {
"audio": "",
"image": "",
"text": " of all the numbers\n\tvar p float64\n\tfor _, n := range input {\n\t\tif p == 0 {\n\t\t\tp = n\n\t\t} else {\n\t\t\tp *= n\n\t\t}\n\t}\n\n\t// Calculate the geometric mean\n\treturn math.Pow(p, 1/float64(l)), nil\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": " invalids types.Transactions\n\n\tif l.strict && len(removed) > 0 {\n\t\tlowest := uint64(math.MaxUint64)\n\t\tfor _, tx := range removed {\n\t\t\tif nonce := tx.Nonce(); lowest > nonce {\n\t\t\t\tlowest = nonce\n\t\t\t}\n\t\t}\n\t\tinvalids = l.txs.Filter(func(tx *types.Trans... |
{
"audio": "",
"image": "",
"text": "func HarmonicMean(input Float64Data) (float64, error) {\n\n\tl := input.Len()\n\tif l == 0 {\n\t\treturn math.NaN(), EmptyInputErr\n\t}\n\n\t// Get the sum of all the numbers reciprocals and return an\n\t// error for values that cannot be included in harmonic mean\n\tvar p flo... | {
"audio": "",
"image": "",
"text": "\treturn math.NaN(), NegativeErr\n\t\t} else if n == 0 {\n\t\t\treturn math.NaN(), ZeroErr\n\t\t}\n\t\tp += (1 / n)\n\t}\n\n\treturn float64(l) / p, nil\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": "\tvar sum float64\n\tfor _, v := range values {\n\t\td := float64(v) - m\n\t\tsum += d * d\n\t}\n\treturn sum / float64(len(values))\n}",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "func Sum(input Float64Data) (sum float64, err error) {\n\n\tif input.Len() == 0 {",
"video": ""
} | {
"audio": "",
"image": "",
"text": "\n\t\treturn math.NaN(), EmptyInputErr\n\t}\n\n\t// Add em up\n\tfor _, n := range input {\n\t\tsum += n\n\t}\n\n\treturn sum, nil\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": " sortedDurations {\n\t\tsum += d\n\t}\n\n\tlength := int64(len(sortedDurations))\n\tif length == 0 {\n\t\treturn 0\n\t}\n\n\treturn uint32(sum.Nanoseconds()/length) / 1000000\n}",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "func LinearRegression(s Series) (regressions Series, err error) {\n\n\tif len(s) == 0 {\n\t\treturn nil, EmptyInputErr\n\t}\n\n\t// Placeholder for the math to be done\n\tvar sum [5]float64\n\n\t// Loop over data keeping index in place\n\ti := 0\n\tfor ; i < len(s); i++ {\n\t\... | {
"audio": "",
"image": "",
"text": " / (f*sum[2] - sum[0]*sum[0])\n\tintercept := (sum[1] / f) - (gradient * sum[0] / f)\n\n\t// Create the new regression series\n\tfor j := 0; j < len(s); j++ {\n\t\tregressions = append(regressions, Coordinate{\n\t\t\tX: s[j].X,\n\t\t\tY: s[j].X*gradient + intercept,\n\t\t})\n\... | {
"audio": "",
"image": "",
"text": " := 0; i < a.Length(); i++ {\n\t\ts[i] = a.Index(i).String()\n\t}\n\treturn s\n}",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "func ExponentialRegression(s Series) (regressions Series, err error) {\n\n\tif len(s) == 0 {\n\t\treturn nil, EmptyInputErr\n\t}\n\n\tvar sum [6]float64\n\n\tfor i := 0; i < len(s); i++ {\n\t\tif s[i].Y < 0 {\n\t\t\treturn nil, YCoordErr\n\t\t}\n\t\tsum[0] += s[i].X\n\t\tsum[1... | {
"audio": "",
"image": "",
"text": " (sum[2]*sum[3]-sum[5]*sum[4])/denominator)\n\tb := (sum[1]*sum[4] - sum[5]*sum[3]) / denominator\n\n\tfor j := 0; j < len(s); j++ {\n\t\tregressions = append(regressions, Coordinate{\n\t\t\tX: s[j].X,\n\t\t\tY: a * math.Exp(b*s[j].X),\n\t\t})\n\t}\n\n\treturn regressions, nil... | {
"audio": "",
"image": "",
"text": " out.Y <= min {\n\t\ty = min\n\t} else {\n\t\ty = max\n\t}\n\tx := in.X + dx*(y-in.Y)/dy\n\tp.X, p.Y = x, y\n\tp.DeltaX, p.DeltaY = math.NaN(), math.NaN()\n\treturn\n}",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "func LogarithmicRegression(s Series) (regressions Series, err error) {\n\n\tif len(s) == 0 {\n\t\treturn nil, EmptyInputErr\n\t}\n\n\tvar sum [4]float64\n\n\ti := 0\n\tfor ; i < len(s); i++ {\n\t\tsum[0] += math.Log(s[i].X)\n\t\tsum[1] += s[i].Y * math.Log(s[i].X)\n\t",
"vid... | {
"audio": "",
"image": "",
"text": "\tsum[2] += s[i].Y\n\t\tsum[3] += math.Pow(math.Log(s[i].X), 2)\n\t}\n\n\tf := float64(i)\n\ta := (f*sum[1] - sum[2]*sum[0]) / (f*sum[3] - sum[0]*sum[0])\n\tb := (sum[2] - a*sum[0]) / f\n\n\tfor j := 0; j < len(s); j++ {\n\t\tregressions = append(regressions, Coordinate{\n\t\t... | {
"audio": "",
"image": "",
"text": " := 0; i < a.Length(); i++ {\n\t\ts[i] = a.Index(i).String()\n\t}\n\treturn s\n}",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "func Median(input Float64Data) (median float64, err error) {\n\n\t// Start by sorting a copy of the slice\n\tc := sortedCopy(input)\n\n\t// No math is needed if there are no numbers\n\t// For even numbers we add the two",
"video": ""
} | {
"audio": "",
"image": "",
"text": " middle numbers\n\t// and divide by two using the mean function above\n\t// For odd numbers we just use the middle number\n\tl := len(c)\n\tif l == 0 {\n\t\treturn math.NaN(), EmptyInputErr\n\t} else if l%2 == 0 {\n\t\tmedian, _ = Mean(c[l/2-1 : l/2+1])\n\t} else {\n\t\tmedian... | {
"audio": "",
"image": "",
"text": " here since we are\n\t// closing the conns which is the only externally visible sideeffect of that\n\t// goroutine running and there should be no way for it to hang or leak once\n\t// the conns are closed so we can save the extra coordination.\n\tatomic.StoreInt32(&c.stopping,... |
{
"audio": "",
"image": "",
"text": "func _variance(input Float64Data, sample int) (variance float64, err error) {\n\n\tif input.Len() == 0 {\n\t\treturn math.NaN(), EmptyInputErr\n\t}\n\n\t// Sum the square of the mean subtracted from each number\n\tm, _ := Mean(input)\n\n\tfor _, n := range input {\n\t\tvarianc... | {
"audio": "",
"image": "",
"text": "\n\t// \"sample\" will allow us to know if it's a sample\n\t// or population and wether to subtract by one or not\n\treturn variance / float64((input.Len() - (1 * sample))), nil\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": "\t// Calculate the number of slots already finished\n\tfinished := 0\n\tfor _, result := range q.resultCache[:limit] {\n\t\tif result == nil {\n\t\t\tbreak\n\t\t}\n\t\tif _, ok := donePool[result.Hash]; ok {\n\t\t\tfinished++\n\t\t}\n\t}\n\t// Calculate the number of slots cur... |
{
"audio": "",
"image": "",
"text": "func PopulationVariance(input Float64Data) (pvar float64, err error) {\n\n\tv, err := _variance(input, 0)\n",
"video": ""
} | {
"audio": "",
"image": "",
"text": "\tif err != nil {\n\t\treturn math.NaN(), err\n\t}\n\n\treturn v, nil\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": " 0 {\n\t\tt.month = uint8(month)\n\t\treturn remain, true\n\t}\n\treturn input, false\n}",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "func SampleVariance(input Float64Data) (svar float64, err error) {\n\n\tv, err := _variance(input, 1)\n",
"video": ""
} | {
"audio": "",
"image": "",
"text": "\tif err != nil {\n\t\treturn math.NaN(), err\n\t}\n\n\treturn v, nil\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": " r.getKey(reflect.Float64, column)\n\tif err != nil {\n\t\treturn false, err\n\t}\n\n\treturn v == 1.0, nil\n}",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "func Sigmoid(input Float64Data) ([]float64, error) {\n\tif input.Len() == 0 {\n\t\treturn Float64Data{}, EmptyInput\n\t}\n\ts := make([]float64, len(input))\n",
"video": ""
} | {
"audio": "",
"image": "",
"text": "\tfor i, v := range input {\n\t\ts[i] = 1 / (1 + math.Exp(-v))\n\t}\n\treturn s, nil\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": "\t\tPort uint16 `json:\"port,omitempty\"`\n\t}\n\tif err := json.Unmarshal(b, &input); err != nil {\n\t\treturn err\n\t}\n\tu.Scheme = input.Scheme\n\tu.Host = input.Host\n\tu.Port = input.Port\n\treturn nil\n}",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "func float64ToInt(input float64) (output int) {\n\tr,",
"video": ""
} | {
"audio": "",
"image": "",
"text": " _ := Round(input, 0)\n\treturn int(r)\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": " -1 {\n\t\treturn formulaTable[fmtForms(FormsTable[idx].Value)]\n\t}\n\treturn func(n int) int {\n\t\treturn n\n\t}\n}",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "func copyslice(input Float64Data) Float64Data {\n\ts :=",
"video": ""
} | {
"audio": "",
"image": "",
"text": " make(Float64Data, input.Len())\n\tcopy(s, input)\n\treturn s\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": "\t\tPort uint16 `json:\"port,omitempty\"`\n\t}\n\tif err := json.Unmarshal(b, &input); err != nil {\n\t\treturn err\n\t}\n\tu.Scheme = input.Scheme\n\tu.Host = input.Host\n\tu.Port = input.Port\n\treturn nil\n}",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "func sortedCopyDif(input Float64Data) (copy Float64Data) {\n\tif sort.Float64sAreSorted(input)",
"video": ""
} | {
"audio": "",
"image": "",
"text": " {\n\t\treturn input\n\t}\n\tcopy = copyslice(input)\n\tsort.Float64s(copy)\n\treturn\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": "\t\tPort uint16 `json:\"port,omitempty\"`\n\t}\n\tif err := json.Unmarshal(b, &input); err != nil {\n\t\treturn err\n\t}\n\tu.Scheme = input.Scheme\n\tu.Host = input.Host\n\tu.Port = input.Port\n\treturn nil\n}",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "func (f Float64Data) PercentileNearestRank(p float64) (float64, error) {",
"video": ""
} | {
"audio": "",
"image": "",
"text": "\n\treturn PercentileNearestRank(f, p)\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": "\n\treturn func(f *Forwarder) error {\n\t\tf.httpForwarder.flushInterval = flushInterval\n\t\treturn nil\n\t}\n}",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "func (f Float64Data) Pearson(d Float64Data) (float64, error)",
"video": ""
} | {
"audio": "",
"image": "",
"text": " {\n\treturn Pearson(f, d)\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": "\n\treturn func(f *Forwarder) error {\n\t\tf.httpForwarder.flushInterval = flushInterval\n\t\treturn nil\n\t}\n}",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "func (f Float64Data) CovariancePopulation(d Float64Data) (float64, error) {\n",
"video": ""
} | {
"audio": "",
"image": "",
"text": "\treturn CovariancePopulation(f, d)\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": "\n\treturn func(f *Forwarder) error {\n\t\tf.httpForwarder.flushInterval = flushInterval\n\t\treturn nil\n\t}\n}",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "func (f *LevelFilter) Check(line []byte) bool {\n\tf.once.Do(f.init)\n\n\t// Check for a log level\n\tvar level LogLevel\n\tx := bytes.IndexByte(line, '[')\n\tif x >= 0 {\n\t\ty := bytes.IndexByte(line[x:], ']')\n\t\tif y",
"video": ""
} | {
"audio": "",
"image": "",
"text": " >= 0 {\n\t\t\tlevel = LogLevel(line[x+1 : x+y])\n\t\t}\n\t}\n\n\t_, ok := f.badLevels[level]\n\treturn !ok\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": "\n\t} else {\n\t\tf.x = f.w + x\n\t}\n}",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "func (f *LevelFilter) SetMinLevel(min",
"video": ""
} | {
"audio": "",
"image": "",
"text": " LogLevel) {\n\tf.MinLevel = min\n\tf.init()\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": "\t\tVariadicType: ast.TypeFloat,\n\t\tCallback: func(args []interface{}) (interface{}, error) {\n\t\t\tmin := args[0].(float64)\n\n\t\t\tfor i := 1; i < len(args); i++ {\n\t\t\t\tmin = math.Min(min, args[i].(float64))\n\t\t\t}\n\n\t\t\treturn min, nil\n\t\t},\n\t}\n}",
"vide... |
{
"audio": "",
"image": "",
"text": "func mkArgs(paths []string) string {\n\tescaped := make([]string, len(paths))\n\tfor i, s := range paths {\n",
"video": ""
} | {
"audio": "",
"image": "",
"text": "\t\tescaped[i] = quotePath(realRel(s))\n\t}\n\treturn strings.Join(escaped, \" \")\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": " []string\n\tfor _, h := range hosts {\n\t\tfor _, p := range paths {\n\t\t\tpatterns = append(patterns, h+p)\n\t\t}\n\t}\n\treturn patterns, nil\n}",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "func (v *VarCmd) get(name string) (string, error) {\n\tif val, ok := v.Vars[name]; ok {\n\t\treturn val, nil\n\t}\n\tif (name == \"@mods\" || name == \"@dirmods\") && v.Block != nil {\n\t\tvar modified []string\n\t\tif v.Modified == nil {\n\t\t\tvar err error\n\t\t\tmodified, ... | {
"audio": "",
"image": "",
"text": "\t\t\tmodified = v.Modified\n\t\t}\n\t\tv.Vars[\"@mods\"] = mkArgs(modified)\n\t\tv.Vars[\"@dirmods\"] = mkArgs(getDirs(modified))\n\t\treturn v.Vars[name], nil\n\t}\n\treturn \"\", fmt.Errorf(\"No such variable: %s\", name)\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": "\treturn v.Get(name)\n\tcase Set:\n\t\tif v.Contains(name) {\n\t\t\treturn name\n\t\t}\n\t}\n\treturn nil\n}",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "func (v *VarCmd) Render(cmd string) (string, error) {\n\tvar err error\n\tcmd = string(\n\t\tname.ReplaceAllFunc(\n\t\t\t[]byte(cmd),\n\t\t\tfunc(key []byte) []byte {\n\t\t\t\tcnt := 0\n\t\t\t\tfor _, c := range key {\n\t\t\t\t\tif c != esc {\n\t\t\t\t\t\tbreak\n\t\t\t\t\t}\n\... | {
"audio": "",
"image": "",
"text": "\t\tif errv != nil {\n\t\t\t\t\terr = fmt.Errorf(\"No such variable: %s\", ks)\n\t\t\t\t\treturn nil\n\t\t\t\t}\n\t\t\t\tval = strings.Repeat(string(esc), cnt/2) + val\n\t\t\t\treturn []byte(val)\n\t\t\t},\n\t\t),\n\t)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\treturn cm... | {
"audio": "",
"image": "",
"text": " {\n\t\tData []struct {\n\t\t\tComponent string `json:\"component\"`\n\t\t\tKey string `json:\"param\"`\n\t\t\tValue string `json:\"value\"`\n\t\t} `json:\"data\"`\n\t}\n\tif err := json.Unmarshal([]byte(out), &ksParams); err != nil {\n\t\treturn nil, err\n\t}\n\tvar... |
{
"audio": "",
"image": "",
"text": "func (GrowlNotifier) Push(title string, text string, iconPath string) {\n\tcmd := exec.Command(\n\t\t\"growlnotify\", \"-n\",",
"video": ""
} | {
"audio": "",
"image": "",
"text": " prog, \"-d\", prog, \"-m\", text, prog,\n\t)\n\tgo cmd.Run()\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": " string, _ string) (string, error) {\n\treturn \"\", nil\n}",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "func RunProc(cmd string, shellMethod string, dir string, log termlog.Stream) error {\n\tlog.Header()\n\tex, err := shell.NewExecutor(shellMethod, cmd, dir)\n\tif err != nil {\n\t\treturn err\n\t}\n",
"video": ""
} | {
"audio": "",
"image": "",
"text": "\tstart := time.Now()\n\terr, estate := ex.Run(log, true)\n\tif err != nil {\n\t\treturn err\n\t} else if estate.Error != nil {\n\t\tlog.Shout(\"%s\", estate.Error)\n\t\treturn ProcError{estate.Error.Error(), estate.ErrOutput}\n\t}\n\tlog.Notice(\">> done (%s)\", time.Since(st... | {
"audio": "",
"image": "",
"text": " string, _ string) (string, error) {\n\treturn \"\", nil\n}",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "func RunPreps(\n\tb conf.Block,\n\tvars map[string]string,\n\tmod *moddwatch.Mod,\n\tlog termlog.TermLog,\n\tnotifiers []notify.Notifier,\n\tinitial bool,\n) error {\n\tsh, err := shell.GetShellName(vars[shellVarName])\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tvar modified ... | {
"audio": "",
"image": "",
"text": "\tcontinue\n\t\t}\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\terr = RunProc(cmd, sh, b.InDir, log.Stream(niceHeader(\"prep: \", cmd)))\n\t\tif err != nil {\n\t\t\tif pe, ok := err.(ProcError); ok {\n\t\t\t\tfor _, n := range notifiers {\n\t\t\t\t\tn.Push(\"modd error\",... | {
"audio": "",
"image": "",
"text": " nil {\n\t\treturn nil, err\n\t}\n\n\tc.addRequestCreds(host, req)\n\treq.Header.Set(xTerraformVersion, tfVersion)\n\n\tresp, err := c.client.Do(req)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer resp.Body.Close()\n\n\tswitch resp.StatusCode {\n\tcase http.StatusOK:\n\... |
{
"audio": "",
"image": "",
"text": "func (l *lexer) acceptFunc(match func(rune) bool) {\n\tfor",
"video": ""
} | {
"audio": "",
"image": "",
"text": " match(l.peek()) {\n\t\tl.next()\n\t}\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": " bool {\n\treturn func(err error) bool {\n\t\treturn Cause(err) == cause\n\t}\n}",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "func (l *lexer) maybeSpace() rune {\n\tfor {\n\t\tn := l.next()\n\t\tif any(n, whitespace) {\n\t\t\tl.acceptRun(whitespace)\n\t\t",
"video": ""
} | {
"audio": "",
"image": "",
"text": "\tl.emit(itemSpace)\n\t\t} else {\n\t\t\treturn n\n\t\t}\n\t}\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": " q)\n\t}\n\n\tl.mutex.Lock()\n\tdefer l.mutex.Unlock()\n\n\tl.maxQuota = q\n\tif l.quota > q {\n\t\tl.quota = q\n\t}\n\n\tif l.maxQuota == 0 {\n\t\tl.cond.Broadcast()\n\t}\n\n\treturn nil\n}",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "func (l *lexer) eatSpaceAndComments() rune {\n\tfor {\n\t\tn := l.next()\n\t\tif n == '#' {\n\t\t\tl.acceptLine(false)\n",
"video": ""
} | {
"audio": "",
"image": "",
"text": "\t\t\tl.emit(itemComment)\n\t\t} else if any(n, whitespace) {\n\t\t\tl.acceptRun(whitespace)\n\t\t\tl.emit(itemSpace)\n\t\t} else {\n\t\t\treturn n\n\t\t}\n\t}\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": "\tif l.defaultDomain == \"\" {\n\t\tl.defaultDomain = dom\n\t}\n\tl.Domains[dom] = tr\n\n\tl.Unlock()\n}",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "func (l *lexer) nextSignificantItem() item {\n\tfor {\n\t\titem := l.nextItem()\n\t\tswitch item.typ {\n\t\tcase itemSpace:\n\t",
"video": ""
} | {
"audio": "",
"image": "",
"text": "\t\tcontinue\n\t\tcase itemComment:\n\t\t\tcontinue\n\t\tdefault:\n\t\t\treturn item\n\t\t}\n\t}\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": "\n\tif item.id != \"\" {\n\t\tout[\"id\"] = item.id\n\t}\n\tif item.prevId != \"\" {\n\t\tout[\"prev-id\"] = item.prevId\n\t}\n\tfor _, format := range item.formats {\n\t\tout[format.Name()] = format.Export()\n\t}\n\treturn out, nil\n}",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "func (l *lexer) acceptLine(permitEscaping bool) {\n\tescaped := false\n\tfor {\n\t\tif !permitEscaping {\n\t\t\tescaped = false\n\t\t}\n\t\tnxt := l.peek()\n\t\tswitch nxt {\n\t\tcase '\\n':\n\t\t\tl.next()\n\t\t\tif !escaped {\n\t\t\t\treturn\n\t\t\t}\n\t\tcase eof:\n\t\t\tre... | {
"audio": "",
"image": "",
"text": "\n\t\tcase '\\\\':\n\t\t\tescaped = true\n\t\t\tl.next()\n\t\t\tcontinue\n\t\tdefault:\n\t\t\tl.next()\n\t\t}\n\t\tescaped = false\n\t}\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": " range constraints {\n\t\tif constraintTargetEscapes(c.LTarget) || constraintTargetEscapes(c.RTarget) {\n\t\t\tescaped = append(escaped, c)\n\t\t}\n\t}\n\n\treturn escaped\n}",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "func (l *lexer) acceptBareString() {\n\tl.acceptFunc(\n\t\tfunc(r",
"video": ""
} | {
"audio": "",
"image": "",
"text": " rune) bool {\n\t\t\treturn !any(r, bareStringDisallowed) && r != eof\n\t\t},\n\t)\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": " 0, &reheap\n\tl.all.Range(func(hash common.Hash, tx *types.Transaction) bool {\n\t\t*l.items = append(*l.items, tx)\n\t\treturn true\n\t})\n\theap.Init(l.items)\n}",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "func (l *lexer) acceptWord() {\n\tl.acceptFunc(\n\t\tfunc(r rune) bool {\n\t\t",
"video": ""
} | {
"audio": "",
"image": "",
"text": "\treturn any(r, wordRunes)\n\t\t},\n\t)\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": " 0, &reheap\n\tl.all.Range(func(hash common.Hash, tx *types.Transaction) bool {\n\t\t*l.items = append(*l.items, tx)\n\t\treturn true\n\t})\n\theap.Init(l.items)\n}",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "func (l *lexer) acceptQuotedString(quote rune) error {\nLoop:\n\tfor {\n\t\tswitch l.next() {\n\t\tcase '\\\\':\n\t\t\tif r := l.next(); r != eof {\n\t\t\t\tbreak\n\t\t\t}\n\t\t\tfallthrough",
"video": ""
} | {
"audio": "",
"image": "",
"text": "\n\t\tcase eof:\n\t\t\treturn fmt.Errorf(\"unterminated quoted string\")\n\t\tcase quote:\n\t\t\tbreak Loop\n\t\t}\n\t}\n\treturn nil\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": "\n\t\tcase '\\\\':\n\t\t\tescaped = true\n\t\t\tl.next()\n\t\t\tcontinue\n\t\tdefault:\n\t\t\tl.next()\n\t\t}\n\t\tescaped = false\n\t}\n}",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "func lexPatterns(l *lexer) stateFn {\n\tfor {\n\t\tn := l.eatSpaceAndComments()\n\t\tif n == eof {\n\t\t\tl.emit(itemEOF)\n\t\t\treturn nil\n\t\t} else if n == '!' {\n\t\t\tpk := l.next()\n\t\t\tif any(pk, quotes) {\n\t\t\t\terr := l.acceptQuotedString(pk)\n\t\t\t\tif err != n... | {
"audio": "",
"image": "",
"text": "\t\t\t\treturn nil\n\t\t\t}\n\t\t} else if any(n, quotes) {\n\t\t\terr := l.acceptQuotedString(n)\n\t\t\tif err != nil {\n\t\t\t\tl.errorf(\"%s\", err)\n\t\t\t\treturn nil\n\t\t\t}\n\t\t\tl.emit(itemQuotedString)\n\t\t} else if !any(n, bareStringDisallowed) {\n\t\t\tl.acceptBa... | {
"audio": "",
"image": "",
"text": "\n\tif diff >= 0 && diff < hgt {\n\t\treturn\n\t}\n\n\tif diff < 0 {\n\t\tl.topRow = l.selectedRow\n\t} else {\n\t\ttop := l.selectedRow - hgt + 1\n\t\tif length-top > hgt {\n\t\t\tl.topRow = top\n\t\t} else {\n\t\t\tl.topRow = length - hgt\n\t\t}\n\t}\n}",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "func lexVariables(l *lexer) stateFn {\n\tfor {\n\t\tn := l.eatSpaceAndComments()\n\t\tif n == '@' {\n\t\t\tl.acceptWord()\n\t\t\tl.emit(itemVarName)\n\t\t\tn = l.maybeSpace()\n\t\t\tif n == '=' {\n\t\t\t\tl.emit(itemEquals)\n\t\t\t}\n\t\t\tn = l.maybeSpace()\n\t\t\tif n == eof... | {
"audio": "",
"image": "",
"text": "\tl.errorf(\"%s\", err)\n\t\t\t\t\treturn nil\n\t\t\t\t}\n\t\t\t\tl.emit(itemQuotedString)\n\t\t\t} else if !any(n, bareStringDisallowed) {\n\t\t\t\tl.acceptLine(true)\n\t\t\t\tl.emit(itemBareString)\n\t\t\t} else {\n\t\t\t\tl.errorf(\"= must be followed by a string\")\n\t\t\t... | {
"audio": "",
"image": "",
"text": " q)\n\t}\n\n\tl.mutex.Lock()\n\tdefer l.mutex.Unlock()\n\n\tl.maxQuota = q\n\tif l.quota > q {\n\t\tl.quota = q\n\t}\n\n\tif l.maxQuota == 0 {\n\t\tl.cond.Broadcast()\n\t}\n\n\treturn nil\n}",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "func lexOptions(l *lexer) stateFn {\n\tfor {\n\t\tn := l.next()\n\t\tif any(n, spaces) {\n\t\t\tl.acceptRun(spaces)\n\t\t\tl.emit(itemSpace)\n\t\t} else if n == ':' {\n\t\t\tl.emit(itemColon)\n\t\t\treturn lexCommand\n\t\t} else",
"video": ""
} | {
"audio": "",
"image": "",
"text": " if n == '+' {\n\t\t\tl.acceptWord()\n\t\t\tl.emit(itemBareString)\n\t\t} else {\n\t\t\tl.errorf(\"invalid command option\")\n\t\t\treturn nil\n\t\t}\n\t}\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": "\t\tr = l.next()\n\t}\n\tl.backup()\n\tl.emit(ItemComment)\n\treturn lexStatements\n}",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "func lexCommand(l *lexer) stateFn {\n\tfor {\n\t\tn := l.next()\n\t\tif n == '\\n' {\n\t\t\tl.errorf(\"empty command specification\")\n\t\t\treturn nil\n\t\t} else if any(n, quotes) {\n\t\t\terr := l.acceptQuotedString(n)\n\t\t\tif err != nil {\n\t\t\t\tl.errorf(\"%s\", err)\n... | {
"audio": "",
"image": "",
"text": " else if any(n, spaces) {\n\t\t\tl.acceptRun(spaces)\n\t\t\tl.emit(itemSpace)\n\t\t} else {\n\t\t\tl.acceptLine(true)\n\t\t\tl.emit(itemBareString)\n\t\t\treturn lexInside\n\t\t}\n\t}\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": " != nil {\n\t\treturn false, false, fmt.Errorf(\"error getting pull request labels: %v\", err)\n\t}\n\n\tfor _, l := range labels {\n\t\tif l.Name == dcoYesLabel {\n\t\t\thasYesLabel = true\n\t\t}\n\t\tif l.Name == dcoNoLabel {\n\t\t\thasNoLabel = true\n\t\t}\n\t}\n\n\treturn ... |
{
"audio": "",
"image": "",
"text": "func NewModRunner(confPath string, log termlog.TermLog, notifiers []notify.Notifier, confreload bool) (*ModRunner, error) {\n\tmr := &ModRunner{\n\t\tLog: log,\n\t\tConfPath: ",
"video": ""
} | {
"audio": "",
"image": "",
"text": " confPath,\n\t\tConfReload: confreload,\n\t\tNotifiers: notifiers,\n\t}\n\terr := mr.ReadConfig()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn mr, nil\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": " &PostgresAdapter{\n\t\tLog: log,\n\t\tSchema: schema,\n\t}\n}",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "func (mr *ModRunner) ReadConfig() error {\n\tret, err := ioutil.ReadFile(mr.ConfPath)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"Error reading config file %s: %s\", mr.ConfPath, err)\n\t}\n\tnewcnf, err := conf.Parse(mr.ConfPath, string(ret))\n\tif err != nil {\n\t\treturn fm... | {
"audio": "",
"image": "",
"text": "\n\t}\n\n\tif _, err := shell.GetShellName(newcnf.GetVariables()[shellVarName]); err != nil {\n\t\treturn err\n\t}\n\n\tnewcnf.CommonExcludes(CommonExcludes)\n\tmr.Config = newcnf\n\treturn nil\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": "\n\t\treturn nil, ErrInvalidParams()\n\t}\n\n\tmr.m.RLock()\n\tmd, ok := mr.r[r.Method]\n\tmr.m.RUnlock()\n\tif !ok {\n\t\treturn nil, ErrMethodNotFound()\n\t}\n\n\treturn md.Handler, nil\n}",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "func (mr *ModRunner) PrepOnly(initial bool) error {\n\tfor _, b := range mr.Config.Blocks {\n",
"video": ""
} | {
"audio": "",
"image": "",
"text": "\t\terr := RunPreps(b, mr.Config.GetVariables(), nil, mr.Log, mr.Notifiers, initial)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": "\n\t\treturn nil, ErrInvalidParams()\n\t}\n\n\tmr.m.RLock()\n\tmd, ok := mr.r[r.Method]\n\tmr.m.RUnlock()\n\tif !ok {\n\t\treturn nil, ErrMethodNotFound()\n\t}\n\n\treturn md.Handler, nil\n}",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "func (mr *ModRunner) runOnChan(modchan chan *moddwatch.Mod, readyCallback func()) error {\n\tdworld, err := NewDaemonWorld(mr.Config, mr.Log)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer dworld.Shutdown(os.Kill)\n\n\tc := make(chan os.Signal, 1)\n\tsignal.Notify(c, os.Inte... | {
"audio": "",
"image": "",
"text": "\tfor mod := range modchan {\n\t\tif mod == nil {\n\t\t\tbreak\n\t\t}\n\t\tif mr.ConfReload && mod.Has(mr.ConfPath) {\n\t\t\tmr.Log.Notice(\"Reloading config %s\", mr.ConfPath)\n\t\t\terr := mr.ReadConfig()\n\t\t\tif err != nil {\n\t\t\t\tmr.Log.Warn(\"%s\", err)\n\t\t\t\tcont... | {
"audio": "",
"image": "",
"text": "\tc := make(chan os.Signal, 1)\n\t\tsignal.Notify(c, os.Interrupt)\n\t\treturn c\n\t}\n\treturn nil\n}",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "func (mr *ModRunner) Run() error {\n\tfor {\n\t\tmodchan := make(chan *moddwatch.Mod, 1024)\n\t\terr",
"video": ""
} | {
"audio": "",
"image": "",
"text": " := mr.runOnChan(modchan, func() {})\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": "\n\t\tmsgc: make(chan *rfc5424.Message, 1000),\n\t\tpausec: make(chan struct{}),\n\t}\n\tgo a.run()\n\treturn a\n}",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "func (d *daemon) Restart() {\n\td.Lock()\n\tdefer d.Unlock()\n\tif d.ex == nil {\n\t\tex, err := shell.NewExecutor(d.shell, d.conf.Command, d.indir)\n\t\tif err != nil {\n\t\t\td.log.Shout(\"Could not create executor: %s\", err)\n\t\t}\n\t\td.ex = ex\n\t\tgo d.Run()\n\t} else ... | {
"audio": "",
"image": "",
"text": "\n\t\td.log.Notice(\">> sending signal %s\", d.conf.RestartSignal)\n\t\terr := d.ex.Signal(d.conf.RestartSignal)\n\t\tif err != nil {\n\t\t\td.log.Warn(\n\t\t\t\t\"failed to send %s signal to %s: %v\", d.conf.RestartSignal, d.conf.Command, err,\n\t\t\t)\n\t\t}\n\t}\n}",
"vid... | {
"audio": "",
"image": "",
"text": " {\n\t\td.Lock()\n\t\tdelete(d.filesystemsCache, name)\n\t\td.Unlock()\n\t}\n\treturn err\n}",
"video": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.