text stringlengths 11 6.3k | embedding listlengths 768 768 |
|---|---|
func AttachLeaves(group int) error {
// Create new spinner to show activity of attach
s := spinner.New(spinner.CharSets[14], 100*time.Millisecond)
// Get a list of leaves
leaves, err := util.DBShowLeaves()
if err != nil {
return err
}
leafCount := len(leaves)
// Attach leaves in a specified AG (host, port)
... | [
0.3146434724330902,
-0.8417879343032837,
0.825738251209259,
-0.20516222715377808,
-0.44070178270339966,
0.6731436848640442,
-0.08764093369245529,
0.04143432527780533,
-0.18143299221992493,
0.4757234454154968,
0.4346006214618683,
0.08479540050029755,
-0.7354894280433655,
0.6923942565917969,... |
func ListHosts(paging commonModel.Paging) ([]*model.HostsResult, *commonModel.Paging) {
var result []*model.HostsResult
var funcTxLoader gormExt.TxCallbackFunc = func(txGormDb *gorm.DB) commonDb.TxFinale {
var dbListHosts = txGormDb.Model(&model.HostsResult{}).
Select(`SQL_CALC_FOUND_ROWS
host.hostname,
... | [
-0.1115243136882782,
-0.07804985344409943,
0.5674649477005005,
-0.14847582578659058,
-0.250264436006546,
-0.41811272501945496,
0.4104129374027252,
-0.5850673317909241,
-1.0760878324508667,
0.42747166752815247,
0.4754500091075897,
-0.17738160490989685,
-0.3351311981678009,
1.100216269493103... |
func ListHostgroups(paging commonModel.Paging) ([]*model.HostgroupsResult, *commonModel.Paging) {
var result []*model.HostgroupsResult
var funcTxLoader gormExt.TxCallbackFunc = func(txGormDb *gorm.DB) commonDb.TxFinale {
var dbListHosts = txGormDb.Model(&model.HostgroupsResult{}).
Select(`SQL_CALC_FOUND_ROWS
... | [
-0.27954331040382385,
-0.17434264719486237,
0.47705960273742676,
-0.25873270630836487,
-0.46668756008148193,
-0.9459789395332336,
0.4340927004814148,
-0.4053651988506317,
-1.0818190574645996,
0.327176034450531,
-0.23880991339683533,
-0.1901727020740509,
-0.47166451811790466,
1.129968881607... |
func getDb(ctx context.Context) *DataStoreMongo {
db.Wipe()
ds := NewDataStoreMongoWithClient(db.Client())
ds = ds.WithAutomigrate().(*DataStoreMongo)
ds.Migrate(ctx, DbVersion)
return ds
} | [
-0.11132346093654633,
1.4306790828704834,
0.15133704245090485,
0.8569089770317078,
0.2604632079601288,
0.2694018483161926,
-0.24055974185466766,
-0.30951398611068726,
0.7107452154159546,
0.01102190650999546,
-0.29865437746047974,
0.9113063812255859,
0.17440740764141083,
-0.0119409887120127... |
func compareDevices(expected *model.Device, actual *model.Device, t *testing.T) {
assert.Equal(t, expected.Id, actual.Id)
assert.Equal(t, expected.PubKey, actual.PubKey)
assert.Equal(t, expected.IdData, actual.IdData)
assert.Equal(t, expected.IdDataStruct, actual.IdDataStruct)
assert.Equal(t, expected.IdDataSha256... | [
-1.053831696510315,
-0.4370686411857605,
0.4415111243724823,
-0.4084815979003906,
0.6943938732147217,
0.6426545977592468,
0.1279863566160202,
0.06555072218179703,
-0.48183196783065796,
-0.26125726103782654,
-0.8407748937606812,
0.12654227018356323,
0.08823858946561813,
0.38125425577163696,... |
func compareTime(expected time.Time, actual time.Time, t *testing.T) {
assert.Equal(t, expected.Unix(), actual.Unix())
} | [
0.1724444180727005,
-0.7691447138786316,
0.4247792661190033,
0.18618597090244293,
1.2347246408462524,
0.9201221466064453,
-0.8689168095588684,
0.3536258935928345,
-0.6965135335922241,
-0.002110392553731799,
0.23227733373641968,
-0.08781549334526062,
0.24546568095684052,
0.6147228479385376,... |
func compareAuthSet(expected *model.AuthSet, actual *model.AuthSet, t *testing.T) {
assert.Equal(t, expected.IdData, actual.IdData)
assert.Equal(t, expected.PubKey, actual.PubKey)
assert.Equal(t, expected.DeviceId, actual.DeviceId)
assert.Equal(t, expected.IdDataStruct, actual.IdDataStruct)
assert.Equal(t, expecte... | [
-0.3678632080554962,
-0.4498884975910187,
0.2985575497150421,
-0.613841712474823,
0.18942837417125702,
0.5779611468315125,
0.030914636328816414,
-1.1352221965789795,
-0.33987873792648315,
-0.3962078094482422,
-0.45431745052337646,
0.8653106093406677,
0.7063336372375488,
-0.0917933359742164... |
func getDevsWithStatuses(accepted, preauthorized, pending, rejected, noauth int) map[*model.Device][]model.AuthSet {
total := accepted + preauthorized + pending + rejected + noauth
res := make(map[*model.Device][]model.AuthSet)
for i := 0; i < total; i++ {
status := "pending"
if i < accepted {
status = "acc... | [
-0.678166389465332,
0.5147969722747803,
0.5589585900306702,
-0.5105462670326233,
-1.2543104887008667,
0.24496877193450928,
0.05825080722570419,
-0.2773374319076538,
-0.0882808044552803,
-0.8737969398498535,
-0.06364861875772476,
0.46339529752731323,
0.7473641633987427,
0.39823392033576965,... |
func getAuthSetsForStatus(dev *model.Device, status string) []model.AuthSet {
n := rand.Intn(4) + 1
asets := make([]model.AuthSet, 0, n)
// create "rejected" auth sets, then populate
// with some accepted/pending, depending on the target status
for i := 0; i < n; i++ {
set := model.AuthSet{
IdData: dev.I... | [
-0.894269585609436,
0.4168052077293396,
0.4720214307308197,
-0.31938081979751587,
-0.6464974880218506,
0.4624103009700775,
-0.808489978313446,
-0.2965613305568695,
0.6620802879333496,
-0.290665864944458,
0.3684026896953583,
0.7433438897132874,
0.42902901768684387,
0.3040188252925873,
0.8... |
func (*KindTagWhere) Descriptor() ([]byte, []int) {
return file_kindTagService_proto_rawDescGZIP(), []int{0}
} | [
1.4360214471817017,
-0.12867458164691925,
0.5284581780433655,
0.5017731189727783,
-0.019143570214509964,
-0.9716050624847412,
-0.2266772985458374,
-0.266602098941803,
-1.8118245601654053,
0.09782277792692184,
-0.395491361618042,
0.27347543835639954,
0.12128417193889618,
0.8208858966827393,... |
func (*KindTag) Descriptor() ([]byte, []int) {
return file_kindTagService_proto_rawDescGZIP(), []int{1}
} | [
0.5091449618339539,
0.49887117743492126,
0.2137395143508911,
0.15147526562213898,
0.0408933199942112,
-0.46342700719833374,
0.12954428791999817,
-0.3216233551502228,
-0.896760106086731,
0.06665737926959991,
-0.5924235582351685,
0.983859658241272,
-0.010474317707121372,
1.4887405633926392,
... |
func (*KindTagResponse) Descriptor() ([]byte, []int) {
return file_kindTagService_proto_rawDescGZIP(), []int{2}
} | [
0.7797409296035767,
0.055498313158750534,
0.022223368287086487,
-0.01558428630232811,
0.5027240514755249,
-1.4520388841629028,
0.26113396883010864,
-0.8939897418022156,
-0.6735352873802185,
-0.14664754271507263,
-0.8069214224815369,
0.054061517119407654,
-0.5908516645431519,
0.481622278690... |
func Deposit(accID string, amount int64) error {
if amount <= 0 {
return fmt.Errorf("invalid amount; %d", amount)
}
var accs []*share.Account
err := client.GetByNames(ctx, share.KindAccount, []string{accID, "Cash"}, &accs)
if err != nil {
return fmt.Errorf("get accounts error; %v", err)
}
accs[0].Balance +=... | [
-0.17941780388355255,
-0.03250797465443611,
0.8969776630401611,
-0.09845304489135742,
0.16051265597343445,
0.5921640396118164,
1.1030248403549194,
-0.49441125988960266,
-0.6912859678268433,
0.153529092669487,
-0.3763826787471771,
-0.5187538266181946,
0.23069241642951965,
0.7922930121421814... |
func Withdraw(accID string, amount int64) error {
if amount <= 0 {
return fmt.Errorf("invalid amount; %d", amount)
}
var accs []*share.Account
err := client.GetByNames(ctx, share.KindAccount, []string{accID, "Cash"}, &accs)
if err != nil {
return fmt.Errorf("get accounts error; %v", err)
}
if accs[0].Balan... | [
-0.4062347412109375,
0.12870661914348602,
0.7734125852584839,
-0.1334797441959381,
0.26175814867019653,
0.2444383054971695,
1.0191459655761719,
-0.413885235786438,
-0.12876519560813904,
0.005459894426167011,
-0.4156404435634613,
-0.04814022779464722,
-0.023983582854270935,
0.08805158734321... |
func Transfer(from, to string, amount int64) error {
if amount <= 0 {
return fmt.Errorf("invalid amount; %d", amount)
}
var accs []*share.Account
err := client.GetByNames(ctx, share.KindAccount, []string{from, to}, &accs)
if err != nil {
return fmt.Errorf("get accounts error; %v", err)
}
if accs[0].Balance... | [
-0.39773979783058167,
-0.06178301200270653,
1.0393452644348145,
-0.03661182150244713,
0.15854091942310333,
0.5719650387763977,
0.5613884329795837,
-0.5001519918441772,
-0.44735586643218994,
0.3955940306186676,
-0.48940813541412354,
-0.21647316217422485,
-0.06716661155223846,
-0.24199925363... |
func (*File) ReadDir(args rpc.Args, result *[]FileInfo) error {
path, ok := args.Args.(string)
if !ok {
return errors.New("args should is a string")
}
r := make([]FileInfo, 0)
if path == "/" || path == "\\" {
for k,v := range share.GetDirs() {
f, err := os.Stat(filepath.Join(v, k))
if err != nil {
if... | [
-0.05685323476791382,
-0.03486943989992142,
0.8495462536811829,
0.7092130780220032,
0.16816018521785736,
0.2286195307970047,
0.8377268314361572,
-0.20177948474884033,
-0.6506125330924988,
-0.3488985598087311,
0.6102511882781982,
0.04509100690484047,
-0.1820327788591385,
1.2963734865188599,... |
func (c *Circle) Min() Coord {
return c.Center.AddScalar(-c.Radius)
} | [
0.06480776518583298,
-0.8663127422332764,
0.2954498827457428,
-0.7698137164115906,
-0.6245720386505127,
0.29011237621307373,
-0.13186955451965332,
-1.1223191022872925,
0.08276595920324326,
-0.8567459583282471,
-0.05311240255832672,
-0.26041480898857117,
-0.8797488212585449,
-0.321639001369... |
func (c *Circle) Max() Coord {
return c.Center.AddScalar(c.Radius)
} | [
0.12885449826717377,
0.08747214823961258,
0.5184155106544495,
-0.36497801542282104,
0.10156665742397308,
0.041583724319934845,
-0.5251957178115845,
-0.35309943556785583,
-0.022351812571287155,
-0.1195438876748085,
-0.33874237537384033,
0.5622313618659973,
-0.40069469809532166,
-0.144488602... |
func (c *Circle) Contains(coord Coord) bool {
return coord.Dist(c.Center) <= c.Radius
} | [
0.7749776244163513,
-0.36183807253837585,
0.3047827184200287,
-1.254779577255249,
-0.7656631469726562,
0.7096373438835144,
-0.48572278022766113,
-0.9740801453590393,
-0.4171922504901886,
0.33136242628097534,
-0.36998996138572693,
0.4950181841850281,
-0.6996804475784302,
-0.2446115463972091... |
func (c *Circle) FirstRayCollision(r *Ray) (RayCollision, bool) {
var res RayCollision
var ok bool
c.RayCollisions(r, func(rc RayCollision) {
// Collisions are sorted from first to last.
if !ok {
res = rc
ok = true
}
})
return res, ok
} | [
0.1738692969083786,
-0.07975978404283524,
0.8610703349113464,
-0.3423311710357666,
0.291154146194458,
-0.779727578163147,
0.5571871995925903,
-1.4342964887619019,
-0.458759605884552,
0.7734919786453247,
-0.27762165665626526,
-1.0984493494033813,
-0.40669533610343933,
0.9578871130943298,
... |
func (c *Circle) RayCollisions(r *Ray, f func(RayCollision)) int {
// Want to find where ||(o+a*d)-c||^2 = r^2
// Let's call o = (o-c) for the rest of this.
// ||a*d+o||^2 = r^2
// a^2*d^2 + 2*a*d*o + o^2 = r^2
// a^2*(d^2) + a*(2*d*o) + (o^2 - r^2) = 0
// quadratic equation: a=(d^2), b=(2*d*o), c = (o^2 - r^2)
... | [
0.10002665966749191,
-0.0628988966345787,
1.05226731300354,
-0.21453092992305756,
-0.6358944177627563,
-0.7564533352851868,
0.8151519894599915,
-0.21900290250778198,
-0.6357245445251465,
0.5296556353569031,
-0.4619264304637909,
-0.5077053308486938,
0.22177506983280182,
-0.02314458973705768... |
func (c *Circle) CircleCollision(center Coord, r float64) bool {
return math.Abs(c.SDF(center)) <= r
} | [
0.00042038087849505246,
-0.18613368272781372,
0.5824767351150513,
-0.005164990201592445,
-0.6001068353652954,
0.1396230310201645,
0.06205815449357033,
-0.14743800461292267,
-0.16805477440357208,
0.9793941974639893,
0.4391333758831024,
-0.8600594997406006,
-0.4596088230609894,
-0.1328969597... |
func (c *Circle) SDF(coord Coord) float64 {
return c.Radius - coord.Dist(c.Center)
} | [
0.3206414580345154,
0.027941279113292694,
0.30070289969444275,
-0.7452834844589233,
-0.3967103064060211,
-0.3700869381427765,
-0.08753804117441177,
-0.4253232777118683,
-0.23226989805698395,
-0.43941017985343933,
-0.8527613878250122,
-0.339834600687027,
-0.11396478116512299,
-0.12953121960... |
func (c *Circle) PointSDF(coord Coord) (Coord, float64) {
direction := coord.Sub(c.Center)
if norm := direction.Norm(); norm == 0 {
// Pick an arbitrary point
return c.Center.Add(X(c.Radius)), c.Radius
} else {
return c.Center.Add(direction.Scale(c.Radius / norm)), c.SDF(coord)
}
} | [
0.12826968729496002,
0.126264289021492,
0.29276901483535767,
-0.4124514162540436,
-0.20828543603420258,
-0.6963731646537781,
0.08318856358528137,
0.4273514747619629,
0.7650598883628845,
-0.3153631389141083,
0.772119402885437,
-0.19985447824001312,
0.5016505718231201,
0.5015924572944641,
... |
func (c *Circle) NormalSDF(coord Coord) (Coord, float64) {
direction := coord.Sub(c.Center)
if norm := direction.Norm(); norm == 0 {
// Pick an arbitrary normal
return X(1), c.Radius
} else {
return direction.Scale(1 / norm), c.SDF(coord)
}
} | [
-0.39093130826950073,
-0.2092127650976181,
0.3112051486968994,
-0.3601855933666229,
-1.4982643127441406,
-0.7912143468856812,
-0.16018657386302948,
0.0722627192735672,
0.5475502610206604,
-0.22515253722667694,
-0.34843748807907104,
-0.4198613166809082,
-0.39550623297691345,
-0.267719626426... |
func (c *Circle) MetaballField(coord Coord) float64 {
return -c.SDF(coord)
} | [
0.04749922826886177,
0.9460435509681702,
0.2583724558353424,
-0.8593015670776367,
-0.3448210656642914,
0.7864564061164856,
-0.15439888834953308,
-0.4900400638580322,
-0.010361606255173683,
0.3447949290275574,
-0.8108952045440674,
-0.42249795794487,
-0.256860613822937,
-0.7132558822631836,
... |
func (c *Circle) MetaballDistBound(d float64) float64 {
return d
} | [
0.16668500006198883,
-0.27523812651634216,
0.2463565170764923,
-0.24324782192707062,
-0.3593807816505432,
0.989355742931366,
0.07707270234823227,
-0.2734544575214386,
0.8693867921829224,
0.41510534286499023,
-0.3783957362174988,
0.3611310124397278,
0.6920761466026306,
0.49262309074401855,
... |
func NewRect(min, max Coord) *Rect {
return &Rect{MinVal: min, MaxVal: max}
} | [
0.3352901339530945,
-0.5649389028549194,
0.5690877437591553,
-0.08790190517902374,
-1.2800757884979248,
-0.03232637047767639,
-1.0256671905517578,
-0.735661506652832,
-0.5589570999145508,
-1.3349106311798096,
0.028526216745376587,
1.0435794591903687,
0.562857985496521,
-1.1904135942459106,... |
func BoundsRect(b Bounder) *Rect {
return NewRect(b.Min(), b.Max())
} | [
0.32564347982406616,
-0.8847233057022095,
0.6243279576301575,
0.8562769293785095,
-0.8001726865768433,
0.10501810908317566,
-0.9129745960235596,
-0.7454456686973572,
0.3132988512516022,
-1.947967290878296,
-0.13094350695610046,
0.5413621068000793,
-0.1639043688774109,
-0.3763822317123413,
... |
func (r *Rect) Contains(c Coord) bool {
return c.Min(r.MinVal) == r.MinVal && c.Max(r.MaxVal) == r.MaxVal
} | [
0.22522085905075073,
-0.8637574315071106,
0.4552302062511444,
-0.6899014711380005,
-0.8582077622413635,
0.7721347808837891,
-0.4747125506401062,
-1.4497690200805664,
-0.2986232340335846,
-1.1540155410766602,
-0.8714306950569153,
0.5404513478279114,
-0.23997139930725098,
-0.0056506679393351... |
func (r *Rect) FirstRayCollision(ray *Ray) (RayCollision, bool) {
tMin, tMax := rayCollisionWithBounds(ray, r.MinVal, r.MaxVal)
if tMax < tMin || tMax < 0 {
return RayCollision{}, false
}
t := tMin
if t < 0 {
t = tMax
}
return RayCollision{
Scale: t,
Normal: r.normalAt(ray.Origin.Add(ray.Direction.Sca... | [
-0.0776798278093338,
-0.6025572419166565,
1.037800908088684,
-0.4206470847129822,
-0.6229970455169678,
-0.2718406617641449,
-0.831177294254303,
-1.0772900581359863,
-0.3352035582065582,
0.7071993350982666,
0.15797261893749237,
-0.8996683955192566,
0.13291503489017487,
0.773245096206665,
... |
func (r *Rect) RayCollisions(ray *Ray, f func(RayCollision)) int {
tMin, tMax := rayCollisionWithBounds(ray, r.MinVal, r.MaxVal)
if tMax < tMin || tMax < 0 {
return 0
}
var count int
for _, t := range []float64{tMin, tMax} {
if t < 0 {
continue
}
count++
if f != nil {
f(RayCollision{
Scale: t... | [
-0.7630993127822876,
0.2564420700073242,
0.8173710703849792,
-0.0015389361651614308,
-0.41828423738479614,
-0.5231489539146423,
-0.03079260140657425,
-0.6323765516281128,
-0.9455394148826599,
0.19500845670700073,
-0.25525179505348206,
-0.5225553512573242,
0.11868317425251007,
0.26451277732... |
func (r *Rect) CircleCollision(c Coord, radius float64) bool {
return math.Abs(r.SDF(c)) <= radius
} | [
-0.032925304025411606,
-0.22273603081703186,
0.633666455745697,
-0.39997124671936035,
-0.4914531409740448,
0.20095817744731903,
0.0925271138548851,
-0.6342968344688416,
-0.5924064517021179,
0.7174522280693054,
0.43973976373672485,
-0.7748710513114929,
-0.24213185906410217,
-0.0502492152154... |
func (r *Rect) SDF(c Coord) float64 {
return r.genericSDF(c, nil, nil)
} | [
0.08175040781497955,
0.35686159133911133,
0.22718515992164612,
-0.5033246874809265,
-0.27774640917778015,
-0.42711523175239563,
-0.0953298881649971,
-0.514941394329071,
-0.07690311968326569,
-0.8651710152626038,
-0.8607462644577026,
-0.448994904756546,
0.4743035137653351,
0.488886564970016... |
func (r *Rect) PointSDF(c Coord) (Coord, float64) {
var p Coord
res := r.genericSDF(c, nil, &p)
return p, res
} | [
-0.010872626677155495,
0.5506332516670227,
0.18517297506332397,
-0.45130351185798645,
0.49132010340690613,
-0.37498652935028076,
-0.13818255066871643,
-0.11974375694990158,
-0.10790091007947922,
-0.7293768525123596,
0.06991036236286163,
-0.513469934463501,
0.7522799372673035,
0.84992736577... |
func (r *Rect) NormalSDF(c Coord) (Coord, float64) {
var n Coord
res := r.genericSDF(c, &n, nil)
return n, res
} | [
-0.43659740686416626,
0.1414790153503418,
0.2038167119026184,
-0.7547950744628906,
-1.111182451248169,
-0.654762864112854,
-0.3323913514614105,
-0.47050008177757263,
-0.17984434962272644,
-0.6704494953155518,
-0.8428815007209778,
-0.41062894463539124,
0.007558668497949839,
0.14717166125774... |
func (r *Rect) MetaballField(coord Coord) float64 {
return -r.SDF(coord)
} | [
0.2938319444656372,
0.7529165148735046,
0.27373892068862915,
-0.7764149904251099,
-0.2710005044937134,
0.9994087815284729,
-0.5030186772346497,
-0.6199446320533752,
0.16546989977359772,
0.21668581664562225,
-0.6834362149238586,
-0.4460262358188629,
-0.01809810847043991,
-0.6761940121650696... |
func (r *Rect) MetaballDistBound(d float64) float64 {
return d
} | [
0.39056679606437683,
-0.4493825435638428,
0.34375905990600586,
0.0010696749668568373,
-0.3289591073989868,
1.0598411560058594,
-0.34579920768737793,
-0.3385075032711029,
0.9997445940971375,
0.3120424449443817,
-0.15837538242340088,
0.12237875908613205,
1.0186114311218262,
0.526602327823638... |
func (r *Rect) Expand(delta float64) *Rect {
return &Rect{
MinVal: r.MinVal.AddScalar(-delta),
MaxVal: r.MaxVal.AddScalar(delta),
}
} | [
0.23161156475543976,
0.40206703543663025,
0.6486405730247498,
0.10981077700853348,
-0.7330572009086609,
0.6452115178108215,
0.0019215059000998735,
-0.3797410726547241,
0.06910204142332077,
-1.8765593767166138,
0.08326797932386398,
-0.34576424956321716,
-0.04529904946684837,
-0.117147088050... |
func (c *Capsule) Min() Coord {
return c.P1.Min(c.P2).AddScalar(-c.Radius)
} | [
-0.39686059951782227,
-1.4450290203094482,
0.5001673698425293,
-0.07037943601608276,
-0.7243791222572327,
0.435626745223999,
-0.984997570514679,
-1.1745463609695435,
0.03722236305475235,
-1.0299092531204224,
0.21392998099327087,
-0.31532320380210876,
-0.3297683596611023,
-0.251516640186309... |
func (c *Capsule) Max() Coord {
return c.P1.Max(c.P2).AddScalar(c.Radius)
} | [
-0.43972381949424744,
-0.6616849899291992,
0.6783598065376282,
0.23083479702472687,
0.07487443834543228,
0.3105300962924957,
-1.2566672563552856,
-0.2936186194419861,
-0.19518707692623138,
-0.2823237180709839,
0.007853655144572258,
0.25691261887550354,
0.1752675622701645,
-0.22702284157276... |
func (c *Capsule) Contains(coord Coord) bool {
segment := Segment{c.P1, c.P2}
return segment.Dist(coord) <= c.Radius
} | [
-0.1244884803891182,
-0.897352933883667,
0.5365403890609741,
-0.7061510682106018,
-0.5276803970336914,
0.8909309506416321,
-0.9201043248176575,
-1.0671765804290771,
-0.4475478231906891,
-0.1276860237121582,
-0.38587722182273865,
0.1278306096792221,
-0.18708989024162292,
-0.2430278956890106... |
func (c *Capsule) FirstRayCollision(r *Ray) (RayCollision, bool) {
var res RayCollision
var ok bool
c.RayCollisions(r, func(rc RayCollision) {
if !ok || rc.Scale < res.Scale {
res = rc
ok = true
}
})
return res, ok
} | [
0.2560120224952698,
-0.674321174621582,
1.0422505140304565,
-0.17486146092414856,
0.05655132606625557,
-0.5957633852958679,
-0.45273128151893616,
-1.402144432067871,
-0.335419625043869,
0.7255116701126099,
0.09560888260602951,
-0.8658152222633362,
-0.29302674531936646,
1.2630352973937988,
... |
func (c *Capsule) RayCollisions(r *Ray, f func(RayCollision)) int {
var colls []RayCollision
for _, p := range []Coord{c.P1, c.P2} {
circle := &Circle{Center: p, Radius: c.Radius}
circle.RayCollisions(r, func(rc RayCollision) {
colls = append(colls, rc)
})
}
// Borrowed from Cylinder.RayCollisions.
v := ... | [
-0.21154727041721344,
0.016374636441469193,
1.0420657396316528,
0.09373065829277039,
-0.3773408532142639,
-0.7189224362373352,
0.4786171019077301,
-0.6203342080116272,
-0.6953571438789368,
0.43730825185775757,
-0.08178971707820892,
-0.11700384318828583,
0.08309108763933182,
0.1435752213001... |
func (c *Capsule) CircleCollision(center Coord, r float64) bool {
return math.Abs(c.SDF(center)) <= r
} | [
-0.0384434312582016,
-0.603657066822052,
0.599704384803772,
-0.04126262664794922,
-0.569454550743103,
0.13794884085655212,
-0.34649208188056946,
-0.17170219123363495,
0.03566118702292442,
0.888067901134491,
0.5648705959320068,
-0.6867586970329285,
-0.3341754376888275,
-0.018783260136842728... |
func (c *Capsule) SDF(coord Coord) float64 {
return c.genericSDF(coord, nil, nil)
} | [
-0.3906477391719818,
0.3571731448173523,
0.3379911780357361,
-0.024174246937036514,
-0.5351561307907104,
-0.5689903497695923,
-0.9362491369247437,
-0.3485555052757263,
-0.005680152215063572,
-0.8517279028892517,
-0.48383015394210815,
-0.35347679257392883,
0.5335817933082581,
0.255713433027... |
func (c *Capsule) PointSDF(coord Coord) (Coord, float64) {
var p Coord
res := c.genericSDF(coord, nil, &p)
return p, res
} | [
-0.22911006212234497,
0.6279415488243103,
0.24897991120815277,
-0.17098405957221985,
0.1964951604604721,
-0.49535465240478516,
-0.8355286717414856,
0.09172307699918747,
0.10355052351951599,
-0.5481211543083191,
0.2779924273490906,
-0.19484904408454895,
0.7881096601486206,
0.588363051414489... |
func (c *Capsule) NormalSDF(coord Coord) (Coord, float64) {
var n Coord
res := c.genericSDF(coord, &n, nil)
return n, res
} | [
-0.660511314868927,
0.18859730660915375,
0.33784201741218567,
-0.3753795325756073,
-1.4132813215255737,
-0.7338451743125916,
-0.9282388687133789,
-0.2101672738790512,
-0.0687631368637085,
-0.518042802810669,
-0.7270365953445435,
-0.1978267878293991,
0.016375325620174408,
0.0373242422938346... |
func (c *Capsule) MetaballField(coord Coord) float64 {
return -c.SDF(coord)
} | [
0.09311654418706894,
0.6892533898353577,
0.3548845648765564,
-0.557987630367279,
-0.4058515131473541,
0.9876673817634583,
-0.714909017086029,
-0.36917752027511597,
0.21034549176692963,
0.21436092257499695,
-0.6888794898986816,
-0.42648443579673767,
-0.13308925926685333,
-0.6316418051719666... |
func (c *Capsule) MetaballDistBound(d float64) float64 {
return d
} | [
0.23144647479057312,
-0.5083504915237427,
0.3444470763206482,
0.16429604589939117,
-0.3812531530857086,
1.1440576314926147,
-0.44238927960395813,
-0.043025560677051544,
1.1086852550506592,
0.1710546612739563,
-0.16356812417507172,
0.3671814203262329,
0.7853466868400574,
0.5604001879692078,... |
func NewTriangle(p1, p2, p3 Coord) *Triangle {
v1 := p2.Sub(p1)
v2 := p3.Sub(p1)
mat := NewMatrix2Columns(v1, v2)
// Handle degenerate triangles using a pseudoinverse.
// This will result in non-NaN (but possibly incorrect)
// barycentric coordinates.
maxDet := math.Sqrt(v1.NormSquared() * v2.NormSquared())
co... | [
0.3148164451122284,
0.3681648373603821,
0.42979615926742554,
0.10526882112026215,
-0.1740238070487976,
0.46929121017456055,
-0.7541311383247375,
0.21795929968357086,
-0.5161188840866089,
-0.43651819229125977,
0.35489559173583984,
0.20260398089885712,
-0.016273273155093193,
-1.4271178245544... |
func (t *Triangle) Coords() [3]Coord {
return t.coords
} | [
-0.25959035754203796,
0.31733256578445435,
0.14408819377422333,
-0.26484915614128113,
0.43131449818611145,
0.8187130689620972,
-0.12072960287332535,
-0.06971143931150436,
0.2839024066925049,
-0.5577313303947449,
-0.5625160336494446,
-0.4951300024986267,
0.05918136611580849,
-1.508568048477... |
func (t *Triangle) Min() Coord {
return t.min
} | [
0.24328480660915375,
-0.8911998867988586,
0.09343555569648743,
-0.43303734064102173,
-0.5141497850418091,
1.1417433023452759,
0.0808568149805069,
-1.0571959018707275,
-0.36990779638290405,
-0.9677094221115112,
0.1812511384487152,
-0.3290749192237854,
0.23914247751235962,
-1.277557849884033... |
func (t *Triangle) Max() Coord {
return t.max
} | [
0.18601514399051666,
-0.0519547164440155,
0.42180195450782776,
-0.05560716614127159,
0.2528790533542633,
1.2230640649795532,
-0.21708336472511292,
-0.43566980957984924,
-0.47481897473335266,
-0.16746364533901215,
-0.0851467177271843,
0.1895046979188919,
0.7222967147827148,
-1.1123973131179... |
func (t *Triangle) Contains(c Coord) bool {
if !InBounds(t, c) {
return false
}
solution := t.invMat.MulColumn(c.Sub(t.coords[0]))
if solution.X < 0 || solution.Y < 0 || solution.X+solution.Y > 1 {
return false
}
return true
} | [
0.25778770446777344,
-0.07501620799303055,
0.34936758875846863,
-0.5354113578796387,
-0.5468099117279053,
0.961418092250824,
0.0067272065207362175,
-0.9178953766822815,
-0.33209487795829773,
-0.0458245724439621,
-0.35574662685394287,
-0.06141059473156929,
0.025650804862380028,
-0.472357511... |
func (t *Triangle) Barycentric(c Coord) [3]float64 {
solution := t.invMat.MulColumn(c.Sub(t.coords[0]))
return [3]float64{
1 - (solution.X + solution.Y),
solution.X,
solution.Y,
}
} | [
0.508482813835144,
0.1982353776693344,
0.4315808415412903,
0.008817167952656746,
0.6031902432441711,
-0.17720969021320343,
0.031607046723365784,
-0.5958243608474731,
-1.2783619165420532,
0.20657981932163239,
-0.7614186406135559,
-0.15267698466777802,
0.3971756398677826,
-1.114162564277649,... |
func (t *Triangle) AtBarycentric(c [3]float64) Coord {
var res Coord
for i, v := range t.coords {
res = res.Add(v.Scale(c[i]))
}
return res
} | [
0.5217808485031128,
-0.002137446543201804,
0.4069855809211731,
-0.5244804620742798,
0.485042542219162,
-0.09851224720478058,
-0.3151443600654602,
-1.3106937408447266,
-1.4710549116134644,
0.6368473172187805,
-0.21608424186706543,
0.28935378789901733,
0.23283064365386963,
-1.334108591079712... |
func (t *Triangle) Area() float64 {
c := t.coords
return math.Abs(NewMatrix2Columns(c[1].Sub(c[0]), c[2].Sub(c[0])).Det() / 2)
} | [
-0.28447285294532776,
-0.7006409764289856,
0.2731243968009949,
-0.22321248054504395,
-0.056643348187208176,
0.1705051213502884,
0.4991534650325775,
0.24968566000461578,
0.21522890031337738,
0.6567729115486145,
0.836236298084259,
-0.6496955752372742,
0.7616238594055176,
-0.25979703664779663... |
func (t *Triangle) FirstRayCollision(r *Ray) (RayCollision, bool) {
var res RayCollision
var ok bool
t.RayCollisions(r, func(rc RayCollision) {
if !ok || rc.Scale < res.Scale {
res = rc
ok = true
}
})
return res, ok
} | [
0.603713870048523,
-0.4387502670288086,
0.9721904993057251,
-0.44446825981140137,
0.16224385797977448,
-0.3118028938770294,
-0.10335826128721237,
-1.4794074296951294,
-0.4797666668891907,
1.005300760269165,
0.280903697013855,
-0.8623303174972534,
-0.06389827281236649,
0.6610926389694214,
... |
func (t *Triangle) RayCollisions(r *Ray, f func(RayCollision)) int {
n := 0
for i := 0; i < 3; i++ {
seg := Segment{t.coords[i], t.coords[(i+1)%3]}
rc, ok := seg.FirstRayCollision(r)
if ok {
n++
if f != nil {
rc.Extra = t
f(rc)
}
}
}
return n
} | [
-0.1779317855834961,
0.7469105124473572,
0.6393654942512512,
-0.3085060715675354,
0.08953897655010223,
-0.7109663486480713,
0.4843381345272064,
-0.26258474588394165,
-0.5540171265602112,
0.263556569814682,
-0.4303293526172638,
-0.9956339001655579,
-0.12579959630966187,
-0.40626388788223267... |
func (t *Triangle) CircleCollision(center Coord, r float64) bool {
return math.Abs(t.SDF(center)) <= r
} | [
0.28835320472717285,
-0.2762890160083771,
0.53583824634552,
-0.27934959530830383,
-0.5468271374702454,
0.4426422119140625,
0.1354445219039917,
-0.16238966584205627,
-0.24944858253002167,
1.2218632698059082,
0.6033021807670593,
-0.8686164617538452,
-0.034442998468875885,
-0.6640109419822693... |
func (t *Triangle) SDF(c Coord) float64 {
return t.genericSDF(c, nil, nil, nil)
} | [
0.3553846478462219,
0.7123897671699524,
0.18690188229084015,
-0.649876058101654,
-0.261871337890625,
0.10742950439453125,
0.04005986452102661,
-0.24875803291797638,
-0.05183347687125206,
-0.6762464642524719,
-0.8291018009185791,
-0.43568310141563416,
0.7197058796882629,
-0.18381267786026,
... |
func (t *Triangle) PointSDF(c Coord) (Coord, float64) {
var p Coord
res := t.genericSDF(c, nil, &p, nil)
return p, res
} | [
0.21862435340881348,
0.8195045590400696,
0.1266767680644989,
-0.6066446900367737,
0.5047175884246826,
0.017817525193095207,
0.034677956253290176,
0.13896934688091278,
-0.04635890573263168,
-0.5501470565795898,
0.28935909271240234,
-0.4064287841320038,
0.8519867658615112,
0.2018949389457702... |
func (t *Triangle) NormalSDF(c Coord) (Coord, float64) {
var n Coord
res := t.genericSDF(c, &n, nil, nil)
return n, res
} | [
-0.2512524127960205,
0.492922842502594,
0.1986439973115921,
-0.8368560671806335,
-1.250836968421936,
-0.1942611187696457,
-0.14027953147888184,
-0.2146420180797577,
-0.25281041860580444,
-0.4233108162879944,
-0.8091607689857483,
-0.29376116394996643,
0.18263864517211914,
-0.406319886445999... |
func (t *Triangle) BarycentricSDF(c Coord) ([3]float64, float64) {
var bary [3]float64
res := t.genericSDF(c, nil, nil, &bary)
return bary, res
} | [
0.290255069732666,
0.271626353263855,
0.19927892088890076,
-0.6197681427001953,
0.5361838340759277,
-0.3670421540737152,
0.15902261435985565,
-0.5162413120269775,
-1.4605607986450195,
-0.9809312224388123,
-0.6368113160133362,
-0.03368973731994629,
-0.025556448847055435,
-0.4179200530052185... |
func (t *Triangle) MetaballField(coord Coord) float64 {
return -t.SDF(coord)
} | [
0.3479013442993164,
0.9657889604568481,
0.2547556161880493,
-0.8130633234977722,
-0.14288555085659027,
1.3366150856018066,
-0.32115116715431213,
-0.2908312678337097,
-0.029404601082205772,
0.39913684129714966,
-0.6628645658493042,
-0.446595162153244,
0.25907641649246216,
-1.351458311080932... |
func (t *Triangle) MetaballDistBound(d float64) float64 {
return d
} | [
0.4575289189815521,
-0.22166398167610168,
0.26638686656951904,
-0.06589547544717789,
-0.14358386397361755,
1.506706953048706,
-0.04001997038722038,
-0.19772645831108093,
0.9607793092727661,
0.44359731674194336,
-0.08380569517612457,
0.37859949469566345,
0.9989935159683228,
0.02703250572085... |
func SymbolToOffset(path, symbol string) (uint32, error) {
f, err := elf.Open(path)
if err != nil {
return 0, fmt.Errorf("could not open elf file to resolve symbol offset: %w", err)
}
syms, err := f.Symbols()
if err != nil {
return 0, fmt.Errorf("could not open symbol section to resolve symbol offset: %w", er... | [
-0.34739458560943604,
0.030068743973970413,
1.0046871900558472,
-1.19732666015625,
-0.562559962272644,
-0.22934019565582275,
1.421890377998352,
-0.37300774455070496,
-0.6964879035949707,
0.2537030875682831,
0.201999232172966,
0.3427071273326874,
-0.09798674285411835,
0.7688249349594116,
... |
func (deploy *Deployer) uninstallMeteringPVCs() error {
// Attempt to get a list of PVCs that match the hdfs or hive labels
pvcs, err := deploy.client.CoreV1().PersistentVolumeClaims(deploy.config.Namespace).List(metav1.ListOptions{
LabelSelector: "app in (hdfs,hive-metastore)",
})
if err != nil {
return fmt.Er... | [
0.04239007830619812,
-0.6032753586769104,
0.45609068870544434,
-0.7529869675636292,
0.34991416335105896,
-0.19198226928710938,
-0.8706260919570923,
0.2800987958908081,
-0.16125930845737457,
0.3280413746833801,
0.6718071103096008,
-0.4659903943538666,
-1.0730960369110107,
0.4787350296974182... |
func NewLoggerHook(logger log.Interface, opts ...LoggerHookOption) bun.QueryHook {
h := &loggerHook{
logger: logger,
}
for _, opt := range opts {
opt(h)
}
return h
} | [
-0.5064918398857117,
0.3952724039554596,
0.2700505256652832,
0.45119085907936096,
-0.40323755145072937,
0.10294494777917862,
-0.7965410351753235,
0.05844772607088089,
0.1932542324066162,
-0.10718471556901932,
0.2638814151287079,
0.06939288973808289,
-0.885871171951294,
-0.01561352331191301... |
func (*loggerHook) BeforeQuery(ctx context.Context, _ *bun.QueryEvent) context.Context {
return ctx
} | [
0.8137401938438416,
-0.6885834336280823,
0.46724528074264526,
-0.19618678092956543,
-0.1453598588705063,
0.3586573600769043,
0.002590812975540757,
-0.3068400025367737,
1.3439908027648926,
-0.20806242525577545,
1.2315140962600708,
0.12680885195732117,
-0.7705503106117249,
-0.143877953290939... |
func (h *loggerHook) AfterQuery(_ context.Context, event *bun.QueryEvent) {
operation := event.Operation()
switch operation {
case "BEGIN", "COMMIT", "ROLLBACK":
return
}
logFields := log.Fields(
"operation", event.Operation(),
"duration", time.Since(event.StartTime).Round(time.Microsecond),
"query", event... | [
0.4982962906360626,
-0.20007561147212982,
0.5987393260002136,
-0.25652876496315,
-0.1680925488471985,
-0.2847904562950134,
0.5835445523262024,
0.4915456175804138,
0.44853875041007996,
0.5154039859771729,
0.4489317238330841,
0.09021592140197754,
-0.04650046303868294,
0.10229816287755966,
... |
func byteSliceTox3dhPub(pub []byte) (x3dh.PublicKey, error) {
var x3dhPub x3dh.PublicKey
if len(pub) != 32 {
return x3dhPub, errors.New("got invalid x3dh public key (must have 32 bytes length)")
}
copy(x3dhPub[:], pub[:])
return x3dhPub, nil
} | [
0.5540117621421814,
0.5204058885574341,
0.38286635279655457,
-0.2458685040473938,
0.5936566591262817,
1.0015028715133667,
-1.300278663635254,
0.0834956243634224,
0.20368875563144684,
1.0360287427902222,
-0.8904021978378296,
0.7163106203079224,
-0.7494437098503113,
0.24011465907096863,
-1... |
func TestResourceAckHappyPath(t *testing.T) {
ctrl := gomock.NewController(t)
defer ctrl.Finish()
confirmAttachmentMessageCopy := *testConfirmAttachmentMessage
ackSent := make(chan *ecsacs.AckRequest)
_, err := validateAttachmentAndReturnProperties(&confirmAttachmentMessageCopy)
require.NoError(t, err)
// Wa... | [
0.8841338753700256,
-0.4369342625141144,
0.7792688608169556,
-0.08449306339025497,
0.25715622305870056,
0.9315218329429626,
1.6703566312789917,
-1.3253095149993896,
0.16179634630680084,
-0.6689623594284058,
0.2864292562007904,
-0.10645919293165207,
0.4662989377975464,
0.44861310720443726,
... |
func EnsureFilePath(path string) error {
if _, err := os.Stat(path); os.IsNotExist(err) {
return os.MkdirAll(path, 0777)
}
return nil
} | [
0.9399500489234924,
0.6047852039337158,
0.534589409828186,
0.28578174114227295,
1.0382733345031738,
1.1324347257614136,
0.17305801808834076,
-0.3823581039905548,
0.7137800455093384,
-0.3436329662799835,
-0.5670497417449951,
-0.9025427103042603,
0.042175937443971634,
0.3018447160720825,
-... |
func (m *ModelUserUnbanCreateRequestV3) Validate(formats strfmt.Registry) error {
var res []error
if err := m.validateBanID(formats); err != nil {
res = append(res, err)
}
if err := m.validateUserID(formats); err != nil {
res = append(res, err)
}
if len(res) > 0 {
return errors.CompositeValidationError(re... | [
0.34816601872444153,
0.14452335238456726,
0.5702331066131592,
-0.0710664764046669,
-0.06708794832229614,
0.2610343396663666,
0.3551376760005951,
-0.850190281867981,
-0.49757254123687744,
0.39145198464393616,
0.3740823566913605,
0.4390222728252411,
-0.38570284843444824,
0.013729015365242958... |
func NewProfile(email string, photo string, accessToken string) *Profile {
profile := &Profile{}
profile.Email = email
profile.Photo = photo
profile.AccessToken = accessToken
return profile
} | [
0.9162840247154236,
-0.13445252180099487,
0.375110387802124,
0.5250639319419861,
0.1450825035572052,
0.16582907736301422,
-1.2780036926269531,
-0.230777770280838,
-0.0725879818201065,
-0.30896857380867004,
-0.28749629855155945,
0.5454114675521851,
-0.8182990550994873,
-0.869525671005249,
... |
func ToJwt(profile *Profile) (string, error) {
profData, err := json.Marshal(&profile)
if (err != nil) {
return "", fmt.Errorf("Unable to marshall profile to json")
}
token := jwt.NewWithClaims(jwt.SigningMethodHS256, jwt.MapClaims{
"profile": string(profData),
"created": time.Now().Unix(),
})
tokenString... | [
0.05560917779803276,
-0.6218426823616028,
0.8052599430084229,
-0.18692877888679504,
-0.5705936551094055,
0.00830729492008686,
0.27353528141975403,
-0.19831103086471558,
0.08164868503808975,
0.4414490759372711,
-0.7243068814277649,
0.21829654276371002,
0.562646746635437,
-0.4931216239929199... |
func ToProfile(tokenString string) (*Profile, int64, error) {
var resp Profile
var created int64
if tokenString == "" {
return nil,0,nil
}
// Parse takes the token string and a function for looking up the key. The latter is especially
// useful if you use multiple keys for your application. The standard is to... | [
0.5702072978019714,
0.13376803696155548,
0.9312149882316589,
-0.5762770771980286,
-0.08699224144220352,
-1.0519105195999146,
-0.555048406124115,
-0.45098263025283813,
-0.24448305368423462,
0.3333513140678406,
-0.22927846014499664,
-0.392744779586792,
-0.2992001473903656,
-0.182042986154556... |
func NewColumns(levels ...ColLevel) Columns {
if levels == nil {
return Columns{Levels: make([]ColLevel, 0), NameMap: make(LabelMap)}
}
col := Columns{
Levels: levels,
}
col.updateNameMap()
return col
} | [
-0.6807858943939209,
-0.4891010522842407,
0.4033736288547516,
0.046174418181180954,
-0.35283029079437256,
0.14023730158805847,
-0.12505832314491272,
-0.7436379194259644,
-0.7102056741714478,
-0.2782231271266937,
-1.0849676132202148,
-0.04652111232280731,
-0.37079954147338867,
-0.0162828583... |
func NewColumnsFromConfig(config Config, n int) (Columns, error) {
var columns Columns
// both nil: return default index
if len(config.Col) == 0 && len(config.MultiCol) == 0 {
cols := NewDefaultColLevel(n, config.ColName)
return NewColumns(cols), nil
}
// both not nil: return error
if len(config.Col) != 0 &... | [
-0.0984182059764862,
-0.32546547055244446,
0.576411247253418,
0.6884114742279053,
-0.1927153617143631,
-0.15636898577213287,
0.27683717012405396,
-0.7813126444816589,
-0.11297915130853653,
-0.03860319405794144,
-1.377515435218811,
-0.26850441098213196,
0.18519264459609985,
0.53890335559844... |
func CreateMultiCol(cols [][]string, colNames []string) Columns {
var newLevels []ColLevel
for i := 0; i < len(cols); i++ {
var levelName string
if i < len(colNames) {
levelName = colNames[i]
}
newLevel := NewColLevel(cols[i], levelName)
newLevels = append(newLevels, newLevel)
}
return NewColumns(newLe... | [
0.017581505700945854,
-0.30465295910835266,
0.8226851224899292,
0.5780752301216125,
-0.21955299377441406,
-0.23448815941810608,
-0.5616905689239502,
-1.035323977470398,
-0.9100642800331116,
0.8178734183311462,
-0.8303468823432922,
-0.152044415473938,
-0.0916159451007843,
-0.216923788189888... |
func NewDefaultColumns(n int) Columns {
return NewColumns(NewDefaultColLevel(n, ""))
} | [
-0.019112491980195045,
0.4088226854801178,
0.121624656021595,
0.7995611429214478,
0.39338070154190063,
-0.7723642587661743,
0.3948225975036621,
-1.6704754829406738,
0.3751741945743561,
-0.6682150959968567,
-1.6470489501953125,
-0.6807226538658142,
-0.36825859546661377,
0.35864272713661194,... |
func (col Columns) Len() int {
if col.NumLevels() == 0 {
return 0
}
return col.Levels[0].Len()
} | [
-0.12492715567350388,
0.6755192279815674,
0.2311369925737381,
0.2164878398180008,
0.9598484635353088,
-0.07745213061571121,
1.1990165710449219,
0.3255872130393982,
-0.959181010723114,
-0.2456730157136917,
-0.9434909224510193,
0.016930093988776207,
-0.040916476398706436,
-0.1731930226087570... |
func (col Columns) NumLevels() int {
return len(col.Levels)
} | [
0.2848963439464569,
0.70355623960495,
0.15465521812438965,
0.1293124556541443,
-0.22570422291755676,
0.475340336561203,
0.03553027659654617,
-0.42885622382164,
-0.23227891325950623,
-0.2004457414150238,
-1.3078991174697876,
-0.9969697594642639,
0.11955694854259491,
0.17328660190105438,
-... |
func (col Columns) MultiNames() [][]string {
names := make([][]string, col.Len())
for k := 0; k < col.Len(); k++ {
nameSlice := make([]string, col.NumLevels())
for j := 0; j < col.NumLevels(); j++ {
nameSlice[j] = col.Levels[j].Labels[k]
}
names[k] = nameSlice
}
return names
} | [
-0.9581613540649414,
0.10789280384778976,
0.787691593170166,
-0.17880503833293915,
-0.4022757112979889,
-0.07151595503091812,
-0.8463859558105469,
-0.710554838180542,
-0.25061967968940735,
1.3047932386398315,
-0.7267725467681885,
0.26932859420776367,
0.15631137788295746,
0.851363480091095,... |
func (col Columns) Names() []string {
names := make([]string, col.Len())
for i, mn := range col.MultiNames() {
name := strings.Join(mn, values.GetMultiColNameSeparator())
names[i] = name
}
return names
} | [
-0.8089082837104797,
0.1273583620786667,
0.5863425731658936,
-0.040110666304826736,
-0.21728764474391937,
0.03982928767800331,
-0.730099618434906,
-0.8680424094200134,
-0.6620449423789978,
1.011016607284546,
-1.4827930927276611,
-0.32428959012031555,
0.38668790459632874,
0.4143085777759552... |
func (col Columns) Name(column int) string {
if col.NumLevels() == 0 {
return ""
}
return col.Names()[column]
} | [
-0.9831885695457458,
0.041336797177791595,
0.5409913063049316,
0.40922147035598755,
-0.7027003169059753,
-0.18820428848266602,
0.48987361788749695,
-1.3066694736480713,
-0.36227694153785706,
1.0751157999038696,
-0.5846952199935913,
-0.5238749980926514,
-0.3403070867061615,
0.05461413785815... |
func (col Columns) MultiName(column int) []string {
if col.NumLevels() == 0 {
return []string{}
}
return col.MultiNames()[column]
} | [
-1.049513816833496,
0.5486263036727905,
0.7395929098129272,
1.3000588417053223,
-0.690473735332489,
-0.9172388315200806,
-1.0309271812438965,
-0.47149866819381714,
0.7982997894287109,
0.9114227294921875,
-1.3477805852890015,
0.022999681532382965,
0.04466421529650688,
0.9232099056243896,
... |
func (col Columns) MaxNameWidth() int {
var max int
for k := range col.NameMap {
if length := len(fmt.Sprint(k)); length > max {
max = length
}
}
return max
} | [
-0.18598684668540955,
0.1918628066778183,
0.5169857144355774,
-0.01659318245947361,
-0.6934173703193665,
-0.12276641279459,
-1.4199835062026978,
-0.4014529287815094,
0.05939726158976555,
0.008470910601317883,
-0.5881286859512329,
-0.5003783702850342,
-0.35214152932167053,
0.839167475700378... |
func (col *Columns) Refresh() {
col.updateNameMap()
for i := 0; i < len(col.Levels); i++ {
col.Levels[i].Refresh()
}
} | [
-0.48933500051498413,
-0.530669093132019,
0.40554895997047424,
0.5882908701896667,
-0.007402235642075539,
0.5675874948501587,
-0.2633555829524994,
-1.4979612827301025,
-1.180871605873108,
0.22716090083122253,
-0.18797874450683594,
-0.22520577907562256,
0.12007161974906921,
0.81692242622375... |
func (col Columns) ensureLevelPositions(positions []int) error {
for _, pos := range positions {
len := col.NumLevels()
if pos >= len {
return fmt.Errorf("invalid position: %d (max %v)", pos, len-1)
}
}
return nil
} | [
0.32283470034599304,
0.6562120318412781,
0.6119717359542847,
0.6451892256736755,
1.0256189107894897,
0.24397969245910645,
-0.19840049743652344,
-0.5576200485229492,
-0.7203847169876099,
0.40658265352249146,
-0.6994667053222656,
-1.4336518049240112,
-0.588112473487854,
0.8276590704917908,
... |
func (col *Columns) InsertLevel(pos int, labels []string, name string) error {
if pos > col.NumLevels() {
return fmt.Errorf("invalid column level: %d (max: %v)", pos, col.NumLevels()-1)
}
lvl := NewColLevel(labels, name)
if len(labels) != col.Len() {
return fmt.Errorf("col.InsertLevel(): len(labels) must equal ... | [
-0.8398351669311523,
0.5367021560668945,
0.7523211240768433,
-0.204987034201622,
0.44063064455986023,
0.28712478280067444,
-0.12214016169309616,
-0.3096018433570862,
-1.237794041633606,
0.47283849120140076,
-1.3492040634155273,
-0.9299694299697876,
-0.8889484405517578,
-0.34376534819602966... |
func (col *Columns) SubsetLevels(levelPositions []int) error {
err := col.ensureLevelPositions(levelPositions)
if err != nil {
return fmt.Errorf("col.SubsetLevels(): %v", err)
}
if len(levelPositions) == 0 {
return fmt.Errorf("col.SubsetLevels(): no levels provided")
}
levels := make([]ColLevel, 0)
for _, p... | [
-0.3768864572048187,
0.028240179643034935,
0.3181281089782715,
0.4269171953201294,
-0.24667589366436005,
0.2783749997615814,
0.34953340888023376,
-0.5122507214546204,
-0.5215852856636047,
0.7774975299835205,
-0.6016193628311157,
-0.47900280356407166,
-0.4938613176345825,
-0.213884189724922... |
func (col *Columns) DropLevel(level int) error {
if err := col.ensureLevelPositions([]int{level}); err != nil {
return fmt.Errorf("Columns.DropLevel(): %v", err)
}
if col.NumLevels() == 1 {
col.Levels = append(col.Levels, NewDefaultColLevel(col.Len(), ""))
}
col.Levels = append(col.Levels[:level], col.Levels[l... | [
-0.8517225980758667,
0.9429766535758972,
0.7805917263031006,
0.019614623859524727,
0.8510442972183228,
0.5337015986442566,
0.5218413472175598,
-0.9068542122840881,
-0.24443300068378448,
0.21445192396640778,
-1.1590017080307007,
-0.6001313328742981,
-0.7283523082733154,
0.0820029154419899,
... |
func NewDefaultColLevel(n int, name string) ColLevel {
colsInt := values.MakeStringRange(0, n)
lvl := ColLevel{Labels: colsInt, DataType: options.Int64, Name: name, IsDefault: true}
lvl.Refresh()
return lvl
} | [
-0.14663170278072357,
0.12089427560567856,
0.35116881132125854,
0.15090899169445038,
-0.24033741652965546,
-0.246259868144989,
-0.7030261158943176,
-1.5329489707946777,
-0.26617223024368286,
0.008371052332222462,
-1.2921442985534668,
-0.2946566641330719,
-0.33878642320632935,
0.41228368878... |
func NewColLevel(labels []string, name string) ColLevel {
if len(labels) == 0 {
return ColLevel{}
}
lvl := ColLevel{
Labels: labels,
Name: name,
DataType: options.String,
}
lvl.Refresh()
return lvl
} | [
-0.1343863159418106,
-0.45893529057502747,
0.3786431849002838,
0.3898959755897522,
-0.6609020233154297,
0.10572414845228195,
-0.7114487290382385,
-0.9747912287712097,
-0.054933659732341766,
0.5555365681648254,
-0.7391158938407898,
0.514843761920929,
-0.535189151763916,
0.06062246859073639,... |
func (lvl ColLevel) Len() int {
return len(lvl.Labels)
} | [
-0.5844442248344421,
-0.8988124132156372,
0.5159749388694763,
-0.5700340270996094,
0.36643683910369873,
0.031119154766201973,
0.37630143761634827,
0.44660434126853943,
-0.9243893027305603,
0.17546233534812927,
-1.4999465942382812,
0.24819175899028778,
-0.05293412134051323,
0.18757781386375... |
func (lvl *ColLevel) Refresh() {
lvl.updateLabelMap()
} | [
-0.9630692005157471,
-1.4282654523849487,
0.3482373356819153,
0.12458796799182892,
-0.03343256190419197,
0.6618197560310364,
-0.6712253093719482,
-0.7686424851417542,
-0.658171534538269,
0.17884990572929382,
-0.09417985379695892,
0.426837295293808,
-0.04526166245341301,
0.6379013061523438,... |
func (lvl *ColLevel) Duplicate(n int) {
archive := make([]string, len(lvl.Labels))
copy(archive, lvl.Labels)
for i := 0; i < n; i++ {
lvl.Labels = append(lvl.Labels, archive...)
lvl.Refresh()
}
} | [
-1.4936516284942627,
0.04097792133688927,
0.6045739650726318,
-0.2891068756580353,
-0.04575436934828758,
0.5188039541244507,
-0.2176390439271927,
-1.007293939590454,
0.02022743970155716,
0.5460485219955444,
-1.1545579433441162,
0.6477481126785278,
-0.09244535118341446,
0.7609708309173584,
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.