id
stringlengths
2
7
text
stringlengths
17
51.2k
title
stringclasses
1 value
c5300
for _, i := range containers { result = append(result, &lxdInstance{i.Name, m.server.ContainerServer}) } return result, nil }
c5301
by falling back to either a single "eth0", // or devices from the profile. // Ensure that the devices are represented in the cloud-init user-data. if len(networkConfig.Interfaces) == 0 { interfaces, err := InterfaceInfoFromDevices(nics) if err != nil { return ContainerSpec{}, errors.Trace(err) } networkC...
c5302
} imURL = EnsureHTTPS(imURL) remote := ServerSpec{ Name: strings.Replace(imURL, "https://", "", 1), Host: imURL, Protocol: SimpleStreamsProtocol, } // If the daily stream was configured with custom image metadata URL, // only use the Ubuntu daily as a fallback. if m.imageStream == "daily" { retu...
c5303
network.GenerateVirtualMACAddress(), netConfig.MTU), }, nil, nil } nics, err := m.server.GetNICsFromProfile(lxdDefaultProfileName) return nics, nil, errors.Trace(err) }
c5304
return m.server.GetContainerProfiles(containerName) }
c5305
i.values[reflect.TypeOf(val)] = reflect.ValueOf(val) return i }
c5306
i.values[typ] = val return i }
c5307
return allLevels } return p.AcceptedLevels }
c5308
Level: LevelDebug, Perm: "0660", } return w }
c5309
} } w.Unlock() } else { w.RUnlock() } } w.Lock() _, err := w.fileWriter.Write([]byte(msg)) if err == nil { w.maxLinesCurLines++ w.maxSizeCurSize += len(msg) } w.Unlock() return err }
c5310
= arith.PowOfTenBig(u) } if tpow { ctx := decimal.Context{Precision: precision(z)} return ctx.Set(z, z.SetMantScale(int64(adjusted(x)), 0)) } return log(z, x, true) }
c5311
// Specialized function. return ln10(z, precision(z)) } } } return log(z, x, false) }
c5312
// Rounding down the integral part automatically chops off the fractional // part. return v.Round(MaxIntegralDigits).String(), nil } if sl > MaxFractionalDigits { if !d.Round { return nil, &LengthError{Part: "fractional", N: sl, max: MaxFractionalDigits} } v.Round(dl - (sl - MaxFractionalDigits)) } re...
c5313
r := int((bits.Len64(x) * 1233) >> 12) if p, _ := Pow10(uint64(r)); x < p { return r } return r + 1 }
c5314
1 nb = (nb / overflowCutoff) + (nb % overflowCutoff) } // 0x268826A1/2^31 is an approximation of log10(2). See ilog10. // The more accurate approximation 0x268826A13EF3FE08/2^63 overflows. m += ((nb + 1) * 0x268826A1) >> 31 if x.CmpAbs(BigPow10(m)) < 0 { return int(m) } return int(m + 1) }
c5315
return uint64((x ^ m) - m) }
c5316
:= m - 1 for i > 0 && x[i] == y[i] { i-- } switch { case x[i] < y[i]: r = -1 case x[i] > y[i]: r = 1 } return }
c5317
big.Word(x >> 32)} } return []big.Word{big.Word(x)} }
c5318
zw = add(zw, xw, big.Word(y)) case len(xw) == 0: zw = setW(zw, big.Word(y)) case y == 0: zw = set(zw, xw) } return z.SetBits(zw) }
c5319
zw = sub(zw, xw, big.Word(y)) case y == 0: zw = set(zw, xw) case len(xw) == 0: panic("underflow") } return z.SetBits(zw) }
c5320
ww[0] = big.Word(z0) } else { ww[1] = big.Word(z1) ww[0] = big.Word(z0) } return z.SetBits(ww) }
c5321
z[0] = addWW(x[0], y, 0) if m > n { c = addVW(z[n:m], x[n:], c) } z[m] = c return norm(z) }
c5322
0) if m > n { c = subVW(z[n:], x[n:], c) } if c != 0 { panic("underflow") } return norm(z) }
c5323
:= range x[:len(z)] { zi := xi + c z[i] = zi c = xi &^ zi >> (bits.UintSize - 1) } return c }
c5324
one), but either // the costly call to Quo makes it difficult to notice. term.SetUint64(i) ctx.Mul(fac, fac, term) ctx.Quo(term, one, fac) prev.Copy(sum) ctx.Add(sum, sum, term) } ctx.Precision -= 5 return ctx.Set(z, sum) }
c5325
return pi(z, decimal.Context{Precision: precision(z)}) }
c5326
lasts.Copy(s) ctx.Add(n, n, na) ctx.Add(na, na, eight) ctx.Add(d, d, da) ctx.Add(da, da, thirtyTwo) ctx.Mul(t, t, n) ctx.Quo(t, t, d) ctx.Add(s, s, t) } return ctx.Round(z) // z == s }
c5327
q.QuoRem(q, c.TenInt, r) if r.Sign() != 0 { return false } } return PowOfTen(q.Uint64()) }
c5328
ctx.RoundingMode = decimal.ToNegativeInf return ctx.RoundToInt(z.Copy(x)) }
c5329
return z.Neg(Floor(z, misc.CopyNeg(z, x))) }
c5330
{ return false } } return true }
c5331
strconv.AppendUint(b[0:0], uint64(x), 10) }
c5332
} // If negative, the call to strconv.Itoa will add the minus sign for us. f.WriteByte(e) if adj > 0 { f.WriteByte('+') } f.WriteString(strconv.Itoa(adj)) }
c5333
scale, so before p "0s" and before b: 0.00000123456 default: f.WriteString(zeroRadix) io.CopyN(f, zeroReader{}, -int64(radix)) end := len(b) if f.prec < end { end = f.prec } f.Write(b[:end]) } }
c5334
0 && cap(xb) > 0 && &zb[0:cap(zb)][cap(zb)-1] != &xb[0:cap(xb)][cap(xb)-1] { return z } } return new(big.Int) }
c5335
return arith.MulBigPow10(z, x, uint64(scale)) } return z.Quo(x, arith.BigPow10(uint64(-scale))) }
c5336
} maxp := prec + 5 // extra prec to skip weird +/- 0.5 adjustments ctx.Precision = 3 for { // p := min(2*p - 2, maxp) ctx.Precision = min(2*ctx.Precision-2, maxp) // approx := .5*(approx + f/approx) ctx.Mul(z, ptFive, ctx.Add(&tmp, z, ctx.Quo(&tmp, f, z))) if ctx.Precision == maxp { break } } //...
c5337
0 { return m } return nil }
c5338
new(Big) z.Context = c return z }
c5339
z.Context.Precision = DefaultPrecision default: z.setNaN(InvalidContext, qnan, invctxpgtu) } return z }
c5340
0 && x.form^y.form == signbit { // +Inf + -Inf // -Inf + +Inf return z.setNaN(InvalidOperation, qnan, addinfinf) } // ±Inf + y // +Inf + +Inf // -Inf + -Inf return z.Set(x) } // x + ±Inf return z.Set(y) }
c5341
} return z.norm() } // NaN * NaN // NaN * y // x * NaN if z.checkNaNs(x, y, multiplication) { return z } if (x.IsInf(0) && !y.isZero()) || (y.IsInf(0) && !x.isZero()) || (y.IsInf(0) && x.IsInf(0)) { // ±Inf * y // x * ±Inf // ±Inf * ±Inf return z.SetInf(sign != 0) } // 0 * ±Inf // ±Inf * 0...
c5342
z.setTriple(zc, neg, n) } // shift < 0 } else if yc, ok := arith.Pow10(uint64(-shift)); ok { z.quo(m, z.compact, neg, yc, 0) return z } z.unscaled.SetUint64(z.compact) z.compact = cst.Inflated } if shift > 0 { arith.MulBigPow10(&z.unscaled, &z.unscaled, uint64(shift)) z.precision = arith.Big...
c5343
{ z.validate() } c.Round(z) return c.simpleReduce(z) }
c5344
20 { z.unscaled.QuoRem(&z.unscaled, cst.TenInt, &r) if r.Sign() != 0 { z.unscaled.Mul(&z.unscaled, cst.TenInt) z.unscaled.Add(&z.unscaled, &r) break } z.exp++ z.precision-- if z.unscaled.Bit(0) != 0 { break } } if z.precision >= 20 { return z.norm() } z.compact = z.unsc...
c5345
} // TODO(eric): See if we can get rid of tmp. See issue #72. var tmp Big _, z = c.quorem(&tmp, z, x, y) z.exp = min(x.exp, y.exp) tmp.exp = 0 if tmp.Precision() > precision(c) { return z.setNaN(DivisionImpossible, qnan, quointprec) } return c.round(z) } // NaN / NaN // NaN / y // x / NaN if z...
c5346
} c.Precision = z.Precision() return c.Quantize(z, 0) }
c5347
c.Round(z.Copy(x)) }
c5348
return nil, false } return c.Round(z), true }
c5349
0 && (x.form&signbit == y.form&signbit) { // -Inf - -Inf // -Inf - -Inf return z.setNaN(InvalidOperation, qnan, subinfinf) } // ±Inf - y // -Inf - +Inf // +Inf - -Inf return z.Set(x) } // x - ±Inf return z.Neg(y) }
c5350
} return -1 } if xs != 0 { return 0 } return x.CmpAbs(y) }
c5351
*decimal.Big { return z.CopySign(x, pos) }
c5352
return z.CopySign(x, pos) } return z.CopySign(x, neg) }
c5353
if v.Cmp(m) > 0 { m = v } } return m }
c5354
if v.CmpAbs(m) > 0 { m = v } } return m }
c5355
if v.Cmp(m) < 0 { m = v } } return m }
c5356
if v.CmpAbs(m) < 0 { m = v } } return m }
c5357
arith.BigPow10(uint64(n)), 1) if sign < 0 { z.Neg(z) } }
c5358
ctx.RoundingMode = decimal.ToNegativeInf ctx.Set(z, x) ctx.Sub(z, x, new(decimal.Big).SetMantScale(1, -etiny(z)+1)) z.Context.Conditions &= ctx.Conditions return z }
c5359
ctx.RoundingMode = decimal.ToPositiveInf ctx.Set(z, x) ctx.Add(z, x, new(decimal.Big).SetMantScale(1, -etiny(z)+1)) z.Context.Conditions &= ctx.Conditions return z }
c5360
{ if sign { return z.CopySign(z, neg) } return z.CopySign(z, pos) }
c5361
ctx.FMA(a, a, t.B, ctx.Mul(a_1, a_1, t.A)) a_1.Copy(z) z.Copy(b) ctx.FMA(b, b, t.B, ctx.Mul(b_1, b_1, t.A)) b_1.Copy(z) ctx.Quo(z, a, b) if ctx.Sub(p, z, p).CmpAbs(eps) <= 0 { break } p.Copy(z) } return z }
c5362
// Skip empty lines and comments. if len(p) == 0 || p[0] == '#' { continue } c, err := ParseCase(p) if err != nil { return nil, err } cases = append(cases, c) } return cases, s.Err() }
c5363
c.Op, join(c.Inputs, ", ", length), trunc(c.Output, length), c.Excep) }
c5364
i = i[1:] } return strings.EqualFold(string(i), "nan") || strings.EqualFold(string(i), "qnan") || strings.EqualFold(string(i), "snan"), i[0] == 's' || i[0] == 'S' }
c5365
if strings.EqualFold(string(i), "+Inf") { return +1, true } return 0, false }
c5366
z.invalidContext(z.Context) || z.checkNaNs(x, y, 0) }
c5367
&& !z.checkNaNs(x, x, absvalue) { z.Context.round(z.copyAbs(x)) } return z }
c5368
return +1 } return -1 } switch xs { case 0, +2, -2: return 0 default: r := cmpabs(x, y) if xs < 0 && !abs { r = -r } return r } }
c5369
} if z != x { sign := x.form & signbit z.copyAbs(x) z.form |= sign } return z }
c5370
z.compact = x.compact if x.IsFinite() && x.isInflated() { z.unscaled.Set(&x.unscaled) } } z.form = x.form & ^signbit return z }
c5371
z == y. sign := y.form & signbit z.copyAbs(x) z.form |= sign return z }
c5372
ok = xc < maxMantissa || (xc&(xc-1)) == 0 case x.exp == 0: f = float64(xc) ok = xc < maxMantissa || (xc&(xc-1)) == 0 case x.exp > 0: f = float64(x.compact) * math.Pow10(x.exp) ok = x.compact < maxMantissa && x.exp < maxPow10 case x.exp < 0: f = float64(x.compact) / math.Pow10(-x.exp) ok = x.compact < ma...
c5373
z.SetRat(x.Rat(nil)) } case pinf, ninf: z.SetInf(x.form == pinf) default: // snan, qnan, ssnan, sqnan: z.SetUint64(0) } return z }
c5374
u, ok = scalex(u, x.exp); !ok { return 0, false } } su := int64(u) if su >= 0 || x.Signbit() && su == -su { if x.Signbit() { su = -su } return su, true } return 0, false }
c5375
{ xb := x.Int(nil) return xb.Uint64(), xb.IsUint64() } b := x.compact if x.exp == 0 { return b, true } return scalex(b, x.exp) }
c5376
x.adjusted() >= x.Context.minScale() }
c5377
x.adjusted() < x.Context.minScale() }
c5378
x.unscaled if we know for a fact it's not // an integer. } else if x.unscaled.Bit(0) == 0 { v := new(big.Int).Set(&x.unscaled) r := new(big.Int) for { v.QuoRem(v, c.TenInt, r) if r.Sign() != 0 { break } exp++ } } return exp >= 0 }
c5379
!= 0 || z.Context.RoundingMode == ToNegativeInf { z.form = xform ^ signbit } } return z.Context.round(z) }
c5380
0 } if x.precision == 0 { return 1 } return x.precision }
c5381
} if x.exp > 0 { arith.MulBigPow10(num, num, uint64(x.exp)) } if x.Signbit() { num.Neg(num) } denom := c.OneInt if x.exp < 0 { denom = new(big.Int) if shift, ok := arith.Pow10(uint64(-x.exp)); ok { denom.SetUint64(shift) } else { denom.Set(arith.BigPow10(uint64(-x.exp))) } } return z.SetFrac...
c5382
return z.scan(byteReader{state}) }
c5383
z.precision = arith.BigLength(value) if z.unscaled.IsUint64() { if v := z.unscaled.Uint64(); v != c.Inflated { z.compact = v } } z.exp = -scale return z }
c5384
acc == big.Exact { z.compact = mant z.precision = arith.Length(mant) } else { z.compact = c.Inflated x0.Int(&z.unscaled) z.precision = arith.BigLength(&z.unscaled) } z.form = finite if neg { z.form |= signbit } return z }
c5385
mantissa >>= 1 shift-- } z.exp = 0 z.form = finite | form(bits>>63) if shift > 0 { z.unscaled.SetUint64(uint64(shift)) z.unscaled.Exp(c.FiveInt, &z.unscaled, nil) arith.Mul(&z.unscaled, &z.unscaled, mantissa) z.exp = -shift } else { // TODO(eric): figure out why this doesn't work for _some_ number...
c5386
else { z.form = pinf } return z }
c5387
z.exp = 0 in SetUint64 if value < 0 { z.form |= signbit } return z }
c5388
{ panic(ErrNaN{Msg: z.Context.Conditions.String()}) } return z }
c5389
z.form = qnan } z.compact = 0 // payload return z }
c5390
num.SetBigMantScale(x.Num(), 0) denom.SetBigMantScale(x.Denom(), 0) return z.Quo(&num, &denom) }
c5391
z.exp = -scale return z }
c5392
r := x.Sign() if abs && r < 0 { r = -r } return r }
c5393
{ x.validate() } return x.form&signbit != 0 }
c5394
= sciE[x.Context.OperatingMode] ) b.Grow(x.Precision()) f.format(x, normal, e) return b.String() }
c5395
{ if x.unscaled.IsUint64() && x.unscaled.Uint64() != c.Inflated { panic(fmt.Sprintf("inflated but unscaled == %d", x.unscaled.Uint64())) } if x.unscaled.Sign() < 0 { panic("x.unscaled.Sign() < 0") } if bl, xp := arith.BigLength(&x.unscaled), x.precision; bl != xp { panic(fmt.Sprintf("BigLeng...
c5396
format := fmt.Sprintf("%%0%dd", digits) return fmt.Sprintf(format, num) }
c5397
:= privateRand.Intn(high-low+1) + low format := fmt.Sprintf("%%0%dd", digits) return fmt.Sprintf(format, num) }
c5398
= randomFrom(jsonData.FemaleTitles) break default: title = FirstName(privateRand.Intn(2)) break } return title }
c5399
= randomFrom(jsonData.FirstNamesFemale) break default: name = FirstName(rand.Intn(2)) break } return name }