text stringlengths 11 6.3k | embedding listlengths 768 768 |
|---|---|
func (ma *MessageAccumulator) AddAll(other *MessageAccumulator) {
if other.msgs == nil {
return
}
for _, msg := range *other.msgs {
ma.Add(msg)
}
} | [
0.8118951916694641,
0.28123682737350464,
0.8895262479782104,
0.705333411693573,
-0.11510779708623886,
0.18807430565357208,
-0.7144216895103455,
-0.9696903824806213,
0.50208580493927,
-0.43086138367652893,
0.8002569079399109,
0.8803458213806152,
-0.2187844067811966,
2.3494584560394287,
-0... |
func (ma *MessageAccumulator) Require(predicate bool, msg string, args ...interface{}) {
if !predicate {
ma.Add(fmt.Sprintf(msg, args...))
}
} | [
0.20291078090667725,
1.1675877571105957,
0.3807348310947418,
-0.4358384907245636,
-0.0908404216170311,
0.6122740507125854,
-0.10916993021965027,
0.4928108751773834,
-0.777581512928009,
-0.07329023629426956,
0.5855224132537842,
0.7186838388442993,
-0.41774439811706543,
1.7270467281341553,
... |
func (t TwitchAPI) NewRequest(method string, uri string, id int) (*http.Request, error) {
fullUri := fmt.Sprintf("%s%v?client_id=%s", uri, id, t.ClientID)
req, err := http.NewRequest(method, fullUri, nil)
if err != nil {
return nil, err
}
req.Header.Add("Accept", t.AcceptHeader)
return req, nil
} | [
-0.19075363874435425,
0.07951363176107407,
0.6087144017219543,
-0.3748738467693329,
-0.35944855213165283,
-0.08439771085977554,
-1.0207246541976929,
-0.39959073066711426,
-0.34769976139068604,
0.31442198157310486,
1.0640500783920288,
0.8117022514343262,
-0.047853052616119385,
-0.3202856481... |
func (t TwitchAPI) GetChannel(id int) (GetChannelResponse, error) {
client := &http.Client{}
result := GetChannelResponse{ID: id}
req, err := t.NewRequest("GET", t.GetChannelURI, id)
if err != nil {
return result, err
}
fmt.Printf("Sent %v\n", req)
resp, err := client.Do(req)
if err != nil {
return resul... | [
-0.9287614822387695,
0.04897657781839371,
0.6917954683303833,
-0.5796869397163391,
0.7084001302719116,
-0.7432528734207153,
-0.005745122209191322,
-0.8162777423858643,
0.12590612471103668,
-0.024507887661457062,
-0.004470417741686106,
1.458308458328247,
-1.167016625404358,
0.12837707996368... |
func failAfter(threshold int) Circuit {
count := 0
// Service function. Fails after 5 tries.
return func(ctx context.Context) (string, error) {
count++
if count > threshold {
return "", errors.New("INTENTIONAL FAIL!")
}
return "Success", nil
}
} | [
0.06812664866447449,
0.22404557466506958,
0.24598082900047302,
-0.44121456146240234,
-1.7339866161346436,
-0.23001132905483246,
-0.2045074850320816,
-1.6948912143707275,
-0.25505468249320984,
-0.16674184799194336,
0.010213564150035381,
-0.07520989328622818,
-0.30267268419265747,
0.62222343... |
func TestCircuitBreakerFailAfter5(t *testing.T) {
circuit := failAfter(5)
ctx := context.Background()
for count := 1; count <= 5; count++ {
_, err := circuit(ctx)
t.Logf("attempt %d: %v", count, err)
switch {
case count <= 5 && err != nil:
t.Error("expected no error; got", err)
case count > 5 && err ... | [
-0.2408658266067505,
0.49221986532211304,
0.27377429604530334,
-0.22190527617931366,
-0.49305808544158936,
0.08855199068784714,
0.899795651435852,
-0.8772003650665283,
-0.7362266778945923,
-0.5809862017631531,
-0.8381641507148743,
-0.16483257710933685,
-0.8932187557220459,
0.59325700998306... |
func TestCircuitBreaker(t *testing.T) {
// Service function. Fails after 5 tries.
circuit := failAfter(5)
// A circuit breaker that opens after one failed attempt.
breaker := Breaker(circuit, 1)
ctx := context.Background()
circuitOpen := false
doesCircuitOpen := false
doesCircuitReclose := false
count := 0
... | [
-0.8953281044960022,
0.5593714118003845,
0.33582034707069397,
0.1681092381477356,
-0.21320892870426178,
-0.19723960757255554,
1.2632578611373901,
-0.1312250941991806,
-0.19832037389278412,
-0.8377014994621277,
-0.5669416189193726,
0.1854940503835678,
-0.41972461342811584,
0.551199436187744... |
func TestCircuitBreakerDataRace(t *testing.T) {
ctx := context.Background()
circuit := waitAndContinue()
breaker := Breaker(circuit, 1)
wg := sync.WaitGroup{}
for count := 1; count <= 20; count++ {
wg.Add(1)
go func(count int) {
defer wg.Done()
time.Sleep(50 * time.Millisecond)
_, err := breaker... | [
-0.3368355929851532,
1.0287128686904907,
0.501370906829834,
0.06898961961269379,
0.10978927463293076,
-0.07295297086238861,
0.9836710691452026,
-0.05740100517868996,
-0.4084227979183197,
-0.48973941802978516,
-0.7091278433799744,
0.4368421137332916,
-0.8444262146949768,
0.6632115244865417,... |
func New(db *bolt.DB, bucketNames ...string) (bb *Bucketeer) {
bb = &Bucketeer{
db: db,
path: NewPath(bucketNames...),
}
return
} | [
-0.2584754526615143,
-0.3416821360588074,
0.201622873544693,
0.17488090693950653,
-0.12623167037963867,
0.6531257629394531,
-0.4844425618648529,
0.2849106192588806,
-1.5575745105743408,
-0.2393030971288681,
-0.6133411526679993,
0.06745895743370056,
0.00048039943794719875,
0.486589163541793... |
func ForPath(db *bolt.DB, path Path) (bb *Bucketeer) {
bb = &Bucketeer{
db: db,
path: path,
}
return
} | [
0.627684473991394,
0.21097394824028015,
0.13002383708953857,
-0.5767576098442078,
-0.5747952461242676,
0.5625963807106018,
-0.4977831244468689,
-0.38476240634918213,
-1.0185154676437378,
-0.394765168428421,
-0.14620144665241241,
-0.01294486504048109,
-0.17199093103408813,
-0.30290880799293... |
func (bb *Bucketeer) EnsurePathBuckets() error {
return EnsurePathBuckets(bb.db, bb.path)
} | [
0.8466677069664001,
0.13196110725402832,
0.32053080201148987,
0.25244003534317017,
0.8551449775695801,
0.9072453379631042,
0.6024479866027832,
-1.0541695356369019,
-0.26671406626701355,
0.1972319632768631,
-0.5671250224113464,
-1.1907751560211182,
-0.4072769284248352,
0.2975746691226959,
... |
func (bb *Bucketeer) EnsureNestedBucket(bucket string) error {
return EnsureNestedBucket(bb.db, bb.path, bucket)
} | [
0.7501234412193298,
0.4836750626564026,
0.3961070775985718,
0.278048038482666,
0.5622081160545349,
0.2513290047645569,
-0.0014297431334853172,
-0.8362163305282593,
0.10540377348661423,
-1.3213469982147217,
-0.8456830978393555,
0.20203551650047302,
-0.7155155539512634,
0.8897847533226013,
... |
func (bb *Bucketeer) InNestedBucket(bucket string) *Bucketeer {
return ForPath(bb.db, bb.path.Nest(bucket))
} | [
0.03598865494132042,
-0.0469292551279068,
0.43358510732650757,
-0.6715095043182373,
0.475706547498703,
0.15902675688266754,
-0.03415547311306,
-0.7687000632286072,
-1.1207919120788574,
-1.2160438299179077,
-0.2315226048231125,
0.2712860107421875,
-0.7232239842414856,
0.6231624484062195,
... |
func (bb *Bucketeer) DeleteNestedBucket(bucket string) error {
bf := func(b *bolt.Bucket) error {
return b.DeleteBucket([]byte(bucket))
}
return bb.Update(bf)
} | [
0.48365268111228943,
0.13778550922870636,
0.4249032735824585,
0.5624368786811829,
0.15990406274795532,
0.200331911444664,
-0.14298656582832336,
-0.15224683284759521,
-0.023813938722014427,
-1.5012480020523071,
-0.8221899271011353,
0.7799801230430603,
-1.020265817642212,
0.6675357222557068,... |
func (bb *Bucketeer) GetBucketStats() (stats bolt.BucketStats, err error) {
bf := func(b *bolt.Bucket) (err error) {
stats = b.Stats()
return
}
err = bb.View(bf)
return
} | [
-0.07840582728385925,
0.6000669002532959,
0.5075449347496033,
-0.02575705014169216,
0.35165607929229736,
-0.3852395713329315,
-0.1314515918493271,
-1.03699791431427,
-0.13340048491954803,
-1.031264066696167,
0.1532188206911087,
0.7974576354026794,
0.2831357419490814,
0.2967320680618286,
... |
func (bb *Bucketeer) View(viewFunc func(b *bolt.Bucket) error) error {
return ViewInBucket(bb.db, bb.path, viewFunc)
} | [
-0.20511053502559662,
0.2499309629201889,
0.16181108355522156,
-0.8889769315719604,
-0.22368931770324707,
-0.3682113587856293,
0.4964773654937744,
0.423714280128479,
-0.5304548144340515,
-1.0813674926757812,
0.1414826363325119,
1.1139111518859863,
0.35820117592811584,
-0.2500773072242737,
... |
func (bb *Bucketeer) Update(updateFunc func(b *bolt.Bucket) error) error {
return UpdateInBucket(bb.db, bb.path, updateFunc)
} | [
-0.4481317102909088,
-0.389902800321579,
0.36295005679130554,
0.15811817348003387,
-0.3002558946609497,
0.43360546231269836,
-0.022417128086090088,
0.41237568855285645,
-0.9501935839653015,
0.31921952962875366,
-0.3785737454891205,
0.19851066172122955,
0.09738462418317795,
0.18152207136154... |
func (bb *Bucketeer) UpdateWithSequence(updateFunc func(b *bolt.Bucket, sequence uint64) error) (sequence uint64, err error) {
bf := func(b *bolt.Bucket) (err error) {
if sequence, err = b.NextSequence(); err != nil {
return
}
err = updateFunc(b, sequence)
return
}
err = bb.Update(bf)
return
} | [
-1.1401264667510986,
-0.7997118830680847,
0.728631317615509,
0.12371587008237839,
-0.8465731739997864,
-1.230267882347107,
-0.042397383600473404,
-0.20450226962566376,
0.29802727699279785,
0.9446356892585754,
-0.948004424571991,
-0.1401510089635849,
0.15328019857406616,
-0.3195508718490600... |
func (bb *Bucketeer) ForKey(key Key) *Keyfarer {
return NewKeyfarer(bb, key.KeyBytes())
} | [
0.07317785173654556,
0.5703486204147339,
0.41337230801582336,
0.7038493156433105,
0.03776738792657852,
-0.7689616084098816,
-0.5684500932693481,
-0.978796124458313,
-0.32583755254745483,
0.13938994705677032,
-0.7841593027114868,
0.36353468894958496,
-0.08842488378286362,
1.3681721687316895... |
func (bb *Bucketeer) ForByteKey(key []byte) *Keyfarer {
return bb.ForKey(NewByteKey(key))
} | [
0.16264793276786804,
0.20045404136180878,
0.2539149224758148,
0.031140750274062157,
0.27411502599716187,
-0.8815722465515137,
-0.8013966083526611,
-0.6462759971618652,
-0.06366720795631409,
0.009074343368411064,
-0.5078814029693604,
0.08876756578683853,
0.37750044465065,
1.4155144691467285... |
func (bb *Bucketeer) ForStringKey(key string) *Keyfarer {
return bb.ForKey(NewStringKey(key))
} | [
-0.24209192395210266,
-0.5231953859329224,
0.2197747826576233,
-0.4160066545009613,
-0.2876550257205963,
-0.8060566782951355,
-0.6953561902046204,
-0.49174681305885315,
-1.0056697130203247,
-0.1838102638721466,
-0.27214086055755615,
-0.06725850701332092,
-0.06910935789346695,
0.21858532726... |
func (bb *Bucketeer) ForUint64Key(key uint64) *Keyfarer {
return bb.ForKey(NewUint64Key(key))
} | [
-1.212485909461975,
0.03986677527427673,
0.21271489560604095,
0.7333657145500183,
0.16282759606838226,
-0.9301644563674927,
-0.3498195707798004,
0.16192378103733063,
-0.4252904951572418,
-0.49894148111343384,
0.10333869606256485,
-0.7905215620994568,
0.8366603851318359,
1.4561642408370972,... |
func (bb *Bucketeer) ForInt64Key(key int64) *Keyfarer {
return bb.ForKey(NewInt64Key(key))
} | [
-1.1158775091171265,
0.20732896029949188,
0.2204507440328598,
0.6834129095077515,
-0.4860328733921051,
-0.8350188136100769,
-0.0783342495560646,
-0.6940893530845642,
-0.5022890567779541,
0.5260617733001709,
0.06592089682817459,
-0.640820324420929,
0.19280707836151123,
0.850372850894928,
... |
func (bb *Bucketeer) ForTextKey(keyObj encoding.TextMarshaler) *Keyfarer {
return bb.ForKey(NewTextKey(keyObj))
} | [
0.07784558832645416,
-0.006753489375114441,
0.18069331347942352,
0.15683390200138092,
-0.3393062651157379,
-1.3042157888412476,
-1.233028531074524,
-0.4249842166900635,
-0.5999717712402344,
0.42085501551628113,
-0.2273247241973877,
-0.32976317405700684,
-0.13986122608184814,
1.082390427589... |
func (bb *Bucketeer) ForBinaryKey(keyObj encoding.BinaryMarshaler) *Keyfarer {
return bb.ForKey(NewBinaryKey(keyObj))
} | [
0.22909219563007355,
-0.0529036782681942,
0.22609448432922363,
0.5644179582595825,
0.1960129290819168,
-0.9278709888458252,
-0.10248076170682907,
-0.6605563163757324,
-0.9388692378997803,
-0.7255064249038696,
-0.7688722610473633,
0.10393104702234268,
0.18459610641002655,
1.4996970891952515... |
func (bb *Bucketeer) ForJsonKey(keyObj interface{}) *Keyfarer {
return bb.ForKey(NewJsonKey(keyObj))
} | [
-0.9880870580673218,
0.011371040716767311,
0.3884255290031433,
0.38591402769088745,
-0.5012898445129395,
-1.3201904296875,
-0.33830520510673523,
-1.0990548133850098,
-0.2440490573644638,
-0.01886584423482418,
-0.13375318050384521,
0.35345327854156494,
0.8391942977905273,
0.9824771881103516... |
func EnsurePathBuckets(db *bolt.DB, path Path) (err error) {
if len(path) == 0 {
panic("Path must have at least one element")
}
txf := func(tx *bolt.Tx) (err error) {
var b *bolt.Bucket
b, err = tx.CreateBucketIfNotExists(path[0])
if err != nil || b == nil || len(path) == 1 {
return
}
for _, bucket :=... | [
-0.07166672497987747,
0.4672674834728241,
1.0051196813583374,
0.43754348158836365,
1.1708372831344604,
0.7485069632530212,
0.2314525693655014,
-0.990696132183075,
-0.5905197262763977,
0.3641291558742523,
-0.9306689500808716,
-1.4687955379486084,
-0.34269681572914124,
0.32953140139579773,
... |
func EnsureNestedBucket(db *bolt.DB, path Path, bucket string) (err error) {
txf := func(tx *bolt.Tx) (err error) {
var b *bolt.Bucket
if b = GetBucket(tx, path); b == nil {
err = fmt.Errorf("Did not find one or more path buckets: %s", path.String())
return
}
_, err = b.CreateBucketIfNotExists([]byte(buc... | [
0.6655080914497375,
0.4269546568393707,
0.8052218556404114,
-0.13719826936721802,
0.7451357841491699,
0.1923048496246338,
-0.17808209359645844,
-0.7957050800323486,
-0.9141980409622192,
-0.748029887676239,
-0.7328273057937622,
-0.2116028070449829,
-0.31248825788497925,
-0.10855202376842499... |
func GetBucket(tx *bolt.Tx, path Path) (b *bolt.Bucket) {
if len(path) == 0 {
panic("Path must have at least one element")
}
b = tx.Bucket(path[0])
if len(path) == 1 || b == nil {
return
}
for _, bucket := range path[1:] {
if b = b.Bucket(bucket); b == nil {
return
}
}
return
} | [
0.16620999574661255,
1.2149336338043213,
0.811108410358429,
1.355865240097046,
0.3106280565261841,
-0.6892250180244446,
0.575797975063324,
-0.9382546544075012,
-0.6654105186462402,
-0.016035769134759903,
0.23354431986808777,
0.5340208411216736,
-0.005959087051451206,
-0.40573352575302124,
... |
func ViewInBucket(db *bolt.DB, path Path, viewFunc func(b *bolt.Bucket) error) (err error) {
txf := func(tx *bolt.Tx) (err error) {
if b := GetBucket(tx, path); b != nil {
err = viewFunc(b)
}
return
}
err = db.View(txf)
return
} | [
0.2171863466501236,
0.3871647119522095,
0.5605241656303406,
-0.7836368083953857,
-0.5937760472297668,
-0.8982102274894714,
0.20230542123317719,
-0.006913668941706419,
-0.46873798966407776,
-0.6107614636421204,
0.15490572154521942,
1.3067667484283447,
0.5741300582885742,
-0.3399398028850555... |
func UpdateInBucket(db *bolt.DB, path Path, updateFunc func(b *bolt.Bucket) error) (err error) {
txf := func(tx *bolt.Tx) (err error) {
if b := GetBucket(tx, path); b != nil {
err = updateFunc(b)
}
return
}
err = db.Update(txf)
return
} | [
-0.09676259756088257,
-0.2869150638580322,
0.8012268543243408,
-0.3794669210910797,
-0.7750112414360046,
-0.5152060389518738,
-0.16457052528858185,
-0.09160998463630676,
-0.7364854216575623,
0.5720471739768982,
-0.2736300230026245,
0.6854993104934692,
0.18272337317466736,
-0.43826729059219... |
func legacyServerMain(ctx context.Context, osArgs []string, flagStartupConfig *StartupConfig) error {
base.WarnfCtx(ctx, "Running in legacy config mode")
lc, err := setupServerConfig(osArgs)
if err != nil {
return err
}
sc := DefaultStartupConfig(defaultLogFilePath)
lc.DisablePersistentConfig = base.BoolPtr(... | [
0.2444489449262619,
-0.268726110458374,
1.2121586799621582,
0.30201393365859985,
-0.23466263711452484,
0.36334338784217834,
0.11143182218074799,
0.8119915723800659,
0.24179807305335999,
0.3904707431793213,
-0.646865725517273,
-0.08710172027349472,
-0.24334941804409027,
0.7958200573921204,
... |
func New(config ...Config) fiber.Handler {
// Set default config
cfg := configDefault(config...)
// Return new handler
return func(c *fiber.Ctx) error {
// Don't execute middleware if Next returns true
if cfg.Next != nil && cfg.Next(c) {
return c.Next()
}
// Abort if we can't trust the early-data heade... | [
-0.04095466807484627,
-0.16456535458564758,
0.3758174777030945,
0.5110149383544922,
-1.0729596614837646,
0.23351570963859558,
0.11454693228006363,
0.21219947934150696,
-0.8122836947441101,
-0.41909003257751465,
0.5128186941146851,
0.2702409625053406,
0.020098624750971794,
0.485736131668090... |
func estimateCost(i interface{}) (min, max int64) {
c, ok := i.(Coster)
if !ok {
return 0, math.MaxInt64
}
return c.Cost()
} | [
-0.7499976754188538,
0.3332068622112274,
0.34316715598106384,
0.5951822996139526,
-0.37004879117012024,
-0.8709685206413269,
-0.18639132380485535,
-0.33602583408355713,
0.35471242666244507,
0.5188464522361755,
-0.15014635026454926,
-0.5272016525268555,
-0.5637017488479614,
0.66437584161758... |
func Example_callSimpleOut() {
const procOut = `create procedure %s (out message nvarchar(1024))
language SQLSCRIPT as
begin
message := 'Hello World!';
end
`
db := sql.OpenDB(DefaultTestConnector())
defer db.Close()
procedure := RandomIdentifier("procOut_")
if _, err := db.Exec(fmt.Sprintf(procOut, procedur... | [
0.5820465683937073,
0.4493328034877777,
0.8021911382675171,
-0.5064920783042908,
-0.465327650308609,
-0.016498683020472527,
-0.29406654834747314,
-0.49485084414482117,
0.33994749188423157,
0.526917040348053,
-0.2962503433227539,
0.055657871067523956,
0.008211699314415455,
0.015238441526889... |
func Example_callTableOut() {
const procTable = `create procedure %[1]s (out t %[2]s)
language SQLSCRIPT as
begin
create local temporary table #test like %[2]s;
insert into #test values('Hello, 世界');
insert into #test values('SAP HANA');
insert into #test values('Go driver');
t = select * from #test;
drop ... | [
0.3058640956878662,
0.40681618452072144,
0.999576985836029,
0.674125075340271,
-0.895700216293335,
-0.15012434124946594,
0.33278989791870117,
-0.48823097348213196,
-0.060457564890384674,
0.5349348783493042,
-0.12251405417919159,
0.050061166286468506,
0.2620559632778168,
0.45911726355552673... |
func NewActivity(metadata *activity.Metadata) activity.Activity {
return &MyActivity{metadata: metadata}
} | [
0.5254675149917603,
-1.2250394821166992,
0.07614469528198242,
0.38101768493652344,
-0.5346868634223938,
-0.05096015706658363,
-0.028699614107608795,
-0.4048473834991455,
-0.09228713810443878,
-0.7047272324562073,
0.9237696528434753,
0.4914596676826477,
-0.19386348128318787,
-0.948610663414... |
func ResolveSets(m *Model) error {
if len(m.Sets) == 0 {
return nil
}
nullable := Nullable(m)
rules := rules(m)
// Create a reverse index of the rules' content.
index := make(map[lalr.Sym][]usage)
defs := make(map[lalr.Sym][]int) // sym -> rules
for rule, r := range rules {
defs[r.lhs] = append(defs[r.lhs... | [
-0.09669249504804611,
0.7235878109931946,
0.7603737711906433,
-0.4890953302383423,
-0.8499951958656311,
-0.8585793375968933,
-0.08684621006250381,
-0.06018802523612976,
-0.2776133418083191,
-0.1752074956893921,
-0.05134105682373047,
-0.27182501554489136,
0.5275415182113647,
-0.087689571082... |
func rules(m *Model) []oneRule {
seen := make(map[int]bool)
var queue []int
enqueue := func(nonterm int) {
if !seen[nonterm] {
seen[nonterm] = true
queue = append(queue, nonterm)
}
}
for _, inp := range m.Inputs {
if !inp.NoEoi {
enqueue(inp.Nonterm)
break
}
}
var ret []oneRule
for len(queu... | [
-0.6401512622833252,
0.348432332277298,
0.7838013172149658,
-0.5195298194885254,
-0.07513704895973206,
0.49287837743759155,
0.14124634861946106,
-0.431347131729126,
-0.40256989002227783,
0.5326038002967834,
0.2814110517501831,
0.5176653861999512,
0.24058279395103455,
0.47793444991111755,
... |
func NewDictExpr(
scanner parser.Scanner,
allowDupKeys bool,
dictExprAlways bool,
entryExprs ...DictEntryTupleExpr,
) (Expr, error) {
entries := make([]DictEntryTuple, 0, len(entryExprs))
for _, expr := range entryExprs {
if !dictExprAlways {
if at, is := exprIsValue(expr.at); is {
if value, is := exprIs... | [
-0.6343474984169006,
-0.11234641075134277,
0.6483098268508911,
0.25192657113075256,
-1.5449362993240356,
0.03668219968676567,
-0.25422048568725586,
0.5088968276977539,
-0.35628822445869446,
0.36688485741615295,
0.2326793074607849,
-0.13509292900562286,
0.021865518763661385,
0.7872089743614... |
func (e DictExpr) String() string {
var b bytes.Buffer
b.WriteByte('{')
for i, expr := range e.entryExprs {
if i > 0 {
b.WriteString(", ")
}
fmt.Fprintf(&b, "%v: %v", expr.at.String(), expr.value.String())
}
b.WriteByte('}')
return b.String()
} | [
-0.08147037029266357,
-0.8735052347183228,
0.4952163100242615,
-1.063272476196289,
-0.7010028958320618,
0.4396858215332031,
0.005070803686976433,
-0.14896747469902039,
-1.0934178829193115,
0.6342254281044006,
0.497734010219574,
0.915985643863678,
0.14565642178058624,
0.17237119376659393,
... |
func (e DictExpr) Eval(ctx context.Context, local Scope) (Value, error) {
entryExprs := make([]DictEntryTuple, 0, len(e.entryExprs))
for _, expr := range e.entryExprs {
at, err := expr.at.Eval(ctx, local)
if err != nil {
return nil, WrapContextErr(err, e, local)
}
value, err := expr.value.Eval(ctx, local)
... | [
-0.7416910529136658,
-0.10220126062631607,
0.4976535737514496,
-0.714086651802063,
-0.4695839285850525,
0.19866956770420074,
0.13370154798030853,
0.8637849688529968,
-0.11601787805557251,
0.6104034185409546,
-0.0031849697697907686,
0.4091780185699463,
0.8841341733932495,
0.3285899758338928... |
func Execute() {
if err := rootCmd.Execute(); err != nil {
fmt.Println(err)
os.Exit(1)
}
} | [
0.8741579055786133,
-0.631639301776886,
0.8534528017044067,
1.2026909589767456,
0.42606523633003235,
0.8930875062942505,
-0.11484168469905853,
0.11600733548402786,
-0.7203778028488159,
-0.3646620810031891,
0.6552295088768005,
0.16867855191230774,
-0.38348233699798584,
0.8589836955070496,
... |
func MakeProtocol(fluidBackup *FluidBackup, port int) *Protocol {
this := new(Protocol)
this.port = port
this.rpc = rpc.NewServer()
this.rpc.Register(this)
l, e := net.Listen("tcp", fmt.Sprintf(":%d", port))
this.l = l
if e != nil {
Log.Error.Printf("Error while initializing RPC handler: %s", e.Error())
ret... | [
-0.035211969166994095,
-0.2088363617658615,
0.7820671200752258,
-0.4728613495826721,
-0.16775739192962646,
0.17683249711990356,
-0.0032294876873493195,
0.01728803478181362,
-0.36268168687820435,
-0.7844346165657043,
-0.5292680263519287,
-1.0017714500427246,
-0.9678677916526794,
-1.11103677... |
func (this *Protocol) GetMe() PeerId {
ifaces, err := net.Interfaces()
if err != nil {
Log.Warn.Println(err)
}
for _, i := range ifaces {
addrs, err := i.Addrs()
if err == nil {
for _, addr := range addrs {
switch addr.(type) {
case *net.IPAddr:
return PeerId{Address: addr.String(), Port: t... | [
-0.580222487449646,
0.13048551976680756,
0.6858041286468506,
-0.6521698832511902,
0.3489694595336914,
0.3713570237159729,
0.6429915428161621,
0.07675022631883621,
-0.5972238779067993,
0.35140472650527954,
0.4839094579219818,
-0.004378607962280512,
-1.0857901573181152,
0.0428951121866703,
... |
func (this *Protocol) call(peerId PeerId, fn string, args interface{}, reply interface{}) bool {
c := make(chan bool, 1)
go func() {
client, errx := rpc.Dial("tcp", peerId.String())
if errx != nil {
c <- false
return
}
defer client.Close()
err := client.Call("Protocol.Handle"+fn, args, reply)
if e... | [
-0.12387228012084961,
0.3581686019897461,
0.8179551362991333,
-0.048219770193099976,
0.22475048899650574,
0.9634091258049011,
-1.305517315864563,
-0.7706543803215027,
-0.5283172130584717,
0.0405845008790493,
0.643011748790741,
-0.2846825122833252,
-1.6267145872116089,
-0.5267072916030884,
... |
func (this *Protocol) ping(peerId PeerId) bool {
args := &PingArgs{Me: this.GetMe()}
var reply PingReply
success := this.call(peerId, "Ping", args, &reply)
return success
} | [
-1.4581915140151978,
0.5328171849250793,
0.5397436618804932,
0.0833771750330925,
0.7214390635490417,
0.6831485033035278,
-0.20627461373806,
-0.050177741795778275,
0.37868496775627136,
0.6977243423461914,
0.09316685050725937,
-0.7990253567695618,
-1.8850674629211426,
0.3078693747520447,
-... |
func (this *Protocol) proposeAgreement(peerId PeerId, localBytes int, remoteBytes int) bool {
args := &ProposeAgreementArgs{
Me: this.GetMe(),
MyBytes: localBytes,
YourBytes: remoteBytes,
}
var reply ProposeAgreementReply
success := this.call(peerId, "ProposeAgreement", args, &reply)
Log.Debug.Print... | [
-0.7354424595832825,
-0.1092335507273674,
0.8225042819976807,
-1.1844918727874756,
-0.3494737446308136,
0.14187279343605042,
-0.8573224544525146,
0.5436054468154907,
-0.6097036600112915,
1.0115891695022583,
0.02579347975552082,
0.4272953271865845,
-1.6764475107192993,
0.6087461709976196,
... |
func (this *Protocol) storeShard(peerId PeerId, label int64, bytes []byte) int {
args := &StoreShardArgs{
Me: this.GetMe(),
Label: label,
Bytes: bytes,
}
var reply StoreShardReply
success := this.call(peerId, "StoreShard", args, &reply)
this.peerList.UpdateTrustPostStorage(peerId, success && reply.Confirm... | [
-0.7652357220649719,
0.88126140832901,
0.5620822906494141,
0.36441582441329956,
0.03131797909736633,
0.5881505012512207,
0.0802639052271843,
-0.9244471192359924,
0.04442866891622543,
0.4705093801021576,
-1.5001294612884521,
-0.04766940325498581,
-2.0124964714050293,
-0.5633243918418884,
... |
func (this *Protocol) retrieveShard(peerId PeerId, label int64) ([]byte, bool) {
args := &RetrieveShardArgs{
Me: this.GetMe(),
Label: label,
}
var reply RetrieveShardReply
success := this.call(peerId, "RetrieveShard", args, &reply)
this.peerList.UpdateTrustPostRetrieval(peerId, success)
if !success {
ret... | [
-0.14087283611297607,
0.9560372829437256,
0.8323536515235901,
-0.05539702996611595,
0.11368570476770401,
-0.08644203841686249,
-0.7922435998916626,
-0.9749667644500732,
0.4497721195220947,
0.06873848289251328,
-1.017423391342163,
0.0913989469408989,
-1.910414695739746,
-0.2868369519710541,... |
func (this *Protocol) HandlePing(args *PingArgs, reply *PingReply) error {
if this.peerList != nil {
this.peerList.DiscoveredPeer(args.Me)
}
return nil
} | [
-0.3169928193092346,
0.3488622009754181,
0.42482829093933105,
0.4736246168613434,
1.4190675020217896,
0.6787802577018738,
-0.03209453076124191,
0.5338014960289001,
0.3220764398574829,
0.0005149510107003152,
-0.2202456295490265,
-1.0284303426742554,
-1.2060914039611816,
0.6658034324645996,
... |
func (this *Protocol) HandleProposeAgreement(args *ProposeAgreementArgs, reply *ProposeAgreementReply) error {
if this.peerList == nil {
reply.Accept = false
} else {
reply.Accept = this.peerList.HandleProposeAgreement(args.Me, args.YourBytes, args.MyBytes)
}
return nil
} | [
-0.742618203163147,
-0.2680954337120056,
0.6635960340499878,
-0.4086141586303711,
-0.21355772018432617,
0.25843149423599243,
-0.08267679065465927,
0.9680822491645813,
-0.1994837075471878,
1.2340599298477173,
0.4035767614841461,
-0.43495985865592957,
-1.6376316547393799,
0.7092830538749695,... |
func (this *Protocol) HandleStoreShard(args *StoreShardArgs, reply *StoreShardReply) error {
if this.peerList == nil {
reply.Confirm = false
} else {
reply.Confirm = this.peerList.HandleStoreShard(args.Me, args.Label, args.Bytes)
}
return nil
} | [
0.08525089919567108,
0.6036216616630554,
0.3805788457393646,
0.12168516963720322,
0.8654946088790894,
0.44225743412971497,
-0.10662386566400528,
-0.37193119525909424,
0.6937550902366638,
0.22969359159469604,
-0.6361242532730103,
0.12637564539909363,
-1.5255720615386963,
0.3272742033004761,... |
func (this *Protocol) HandleDeleteShard(args *DeleteShardArgs, reply *DeleteShardReply) error {
if this.peerList != nil {
this.peerList.HandleDeleteShard(args.Me, args.Label)
}
return nil
} | [
0.34844931960105896,
-0.04482521116733551,
0.37789401412010193,
0.07970798760652542,
0.8159230947494507,
0.4399718642234802,
-0.0173045601695776,
-0.25919273495674133,
0.833454966545105,
-0.37366577982902527,
-0.35766342282295227,
0.15117903053760529,
-0.5835643410682678,
0.313753962516784... |
func (this *Protocol) HandleRetrieveShard(args *RetrieveShardArgs, reply *RetrieveShardReply) error {
if this.peerList == nil {
reply.Bytes = nil
} else {
reply.Bytes = this.peerList.HandleRetrieveShard(args.Me, args.Label)
}
return nil
} | [
0.6141178607940674,
0.29736393690109253,
0.469899445772171,
0.019638273864984512,
1.0767452716827393,
0.21851584315299988,
-0.0519552119076252,
-0.43857914209365845,
0.6289200782775879,
-0.3576824963092804,
-0.5719203352928162,
0.23502199351787567,
-1.03207528591156,
-0.25728124380111694,
... |
func (this *Protocol) askForPeers(peerId PeerId, num int) []PeerId {
args := &ShareNewPeersArgs{}
var reply ShareNewPeersReply
args.Me = this.GetMe()
args.Num = num
success := this.call(peerId, "ShareNewPeers", args, &reply)
if success {
return reply.SharedPeers
}
return nil
} | [
-1.005486249923706,
0.26761186122894287,
0.6282758116722107,
0.22127319872379303,
0.17711141705513,
-0.39120566844940186,
0.048529066145420074,
-0.6049957275390625,
0.2613195478916168,
0.08887793868780136,
-0.6574077606201172,
0.4196450710296631,
-1.5805885791778564,
0.6722589135169983,
... |
func (this *Protocol) HandleShareNewPeers(args *ShareNewPeersArgs, reply *ShareNewPeersReply) error {
asker := args.Me
peerList := this.peerList.HandleShareNewPeers(asker, args.Num)
reply.SharedPeers = peerList
return nil
} | [
-0.8266162276268005,
-0.03266104683279991,
0.35800305008888245,
0.205665722489357,
0.5871700048446655,
0.566460371017456,
0.646974503993988,
-0.37072086334228516,
0.510372519493103,
0.3516601324081421,
-1.248807668685913,
-0.29533374309539795,
-1.481283187866211,
0.3723984360694885,
-0.1... |
func Load() *template.Template {
return template.Must(
template.New(
"index.html",
).Parse(
string(MustAsset("index.html")),
),
)
} | [
0.15579983592033386,
0.09490478038787842,
0.2827252149581909,
-0.4568367898464203,
-0.5409444570541382,
0.1915406435728073,
-0.05610787868499756,
-0.17574481666088104,
0.22001981735229492,
-0.2819858491420746,
-0.23375913500785828,
-0.4475564956665039,
-0.29153987765312195,
-1.348942518234... |
func (l *List) Visit(f func(n *Node)) {
p := l.head
for p != nil {
f(p)
p = p.next
}
} | [
-0.9173534512519836,
1.3858788013458252,
0.46178266406059265,
-0.26715195178985596,
-0.13111485540866852,
-0.5954378843307495,
-0.12607412040233612,
0.5832639336585999,
-0.3239786922931671,
0.5463905334472656,
-0.48003822565078735,
0.6056411862373352,
0.21143200993537903,
0.775357007980346... |
func (l *List) Append(values ...interface{}) {
for _, v := range values {
if l.head == nil {
l.head = &Node{v, nil}
continue
}
p := l.head
for p.next != nil {
p = p.next
}
p.next = &Node{v, nil}
}
} | [
-0.16016265749931335,
1.0630650520324707,
0.3454001545906067,
0.04831888899207115,
0.4816945195198059,
0.2019640952348709,
-0.6671622395515442,
0.45197832584381104,
0.5980275869369507,
-0.44881847500801086,
-0.5569076538085938,
0.12332663685083389,
-0.3262864351272583,
1.824114441871643,
... |
func (l *List) Push(v interface{}) {
l.head = &Node{v, l.head}
} | [
-0.5956718921661377,
0.9638556241989136,
0.09718671441078186,
-0.07818201929330826,
-0.3038153350353241,
0.18754440546035767,
-0.13578259944915771,
0.22369810938835144,
1.2956405878067017,
0.7937520742416382,
-1.201392412185669,
1.153775930404663,
-0.23885118961334229,
1.1345328092575073,
... |
func (l *List) Insert(pos int, v interface{}) error {
if pos == 0 {
l.head = &Node{v, l.head}
return nil
}
p := l.head
i := pos - 1
for i != 0 {
if p.next == nil {
return fmt.Errorf("%v is not a valid position for a %v long list", pos, pos-i)
}
p = p.next
i--
}
p.next = &Node{v, p.next}
return ... | [
-0.594078540802002,
1.104852557182312,
0.33742013573646545,
-0.5821260809898376,
-0.037650059908628464,
-0.27517423033714294,
-0.41963472962379456,
1.1119619607925415,
0.41229790449142456,
0.2789677679538727,
-1.454870581626892,
-0.4550934433937073,
-1.0051918029785156,
0.2215329110622406,... |
func (l *List) Clear() {
l.head = nil
} | [
-0.4583372473716736,
0.46657446026802063,
0.006614281330257654,
0.27693358063697815,
-0.09070319682359695,
0.6797487735748291,
-0.5373449921607971,
0.1074410155415535,
0.8510668277740479,
-0.22396114468574524,
-0.403131365776062,
0.7198930382728577,
0.16284455358982086,
1.458763599395752,
... |
func (l *List) Search(pred Predicate) (*Node, error) {
p := l.head
for p != nil {
if pred(p.value) {
return p, nil
}
p = p.next
}
return nil, fmt.Errorf("Value not found")
} | [
-0.2297559529542923,
0.9126220345497131,
0.48147958517074585,
-0.05857511982321739,
-0.81536465883255,
0.46782124042510986,
-0.2538057863712311,
0.4176090657711029,
0.12080938369035721,
0.10219565033912659,
0.2438778430223465,
0.5146427154541016,
-0.3561233878135681,
0.8613231778144836,
... |
func newEmptyBoard() *FixBoard {
b := &FixBoard{
Gophers: make([]*pieces.Gopher, 0),
Goals: make([]pieces.Goal, 0),
}
return b
} | [
-0.39063504338264465,
0.354496568441391,
0.33438345789909363,
0.5669801831245422,
-0.41066911816596985,
0.31890302896499634,
0.46724191308021545,
0.4398312568664551,
-0.19388949871063232,
-0.18530623614788055,
-1.1402379274368286,
0.5817797780036926,
-0.8983706831932068,
0.1063881292939186... |
func (b *FixBoard) SetWall(s int, w int) {
b.modifySpace(s, w)
} | [
0.21694675087928772,
0.822844386100769,
0.35980626940727234,
0.9632173180580139,
-0.14116981625556946,
0.3551040291786194,
1.040242314338684,
-0.03937782719731331,
0.19134430587291718,
-1.0804439783096313,
-0.5855714678764343,
0.9209790229797363,
-0.14537720382213593,
1.6062862873077393,
... |
func (b *FixBoard) SetWalls(s int, left bool, top bool, right bool, bottom bool) {
modifier := 0
if left {
modifier |= DirLeft
}
if top {
modifier |= DirTop
}
if right {
modifier |= DirRight
}
if bottom {
modifier |= DirBottom
}
b.modifySpace(s, modifier)
} | [
-0.3765294551849365,
1.0269665718078613,
0.37145674228668213,
0.25359416007995605,
-0.4237310290336609,
-0.14701226353645325,
0.48095864057540894,
-0.4564116597175598,
0.039760660380125046,
-0.11783669888973236,
-1.164839744567871,
0.11381471902132034,
-0.44081827998161316,
1.1796000003814... |
func (b *FixBoard) modifySpace(s int, w int) {
row := s / 16
column := s % 16
// Left - Only if not in leftmost column
if column > 0 && (w&DirLeft) > 0 {
b.setBit(row, uint(31-(column-1)))
}
// Top - Only if not in topmost row
if row > 0 && (w&DirTop) > 0 {
b.setBit(row-1, uint(15-column))
}
// Right - ... | [
-0.4852997958660126,
0.32116711139678955,
0.834178626537323,
-0.2340601235628128,
-0.04355880990624428,
0.06314913928508759,
0.8247097730636597,
-0.4866175949573517,
1.351981520652771,
-0.4560191035270691,
0.28639891743659973,
0.2623068690299988,
-0.49334716796875,
1.6732678413391113,
0.... |
func (b *FixBoard) setBit(i int, l uint) {
if i < 0 {
return
}
b.Spaces[i] |= 1 << l
} | [
-0.23096320033073425,
1.1805602312088013,
0.29778748750686646,
0.7385861277580261,
0.0414360873401165,
1.312696933746338,
0.1388043314218521,
-0.20386293530464172,
-0.8218443393707275,
-0.3411334753036499,
-0.8003749251365662,
-0.3201691210269928,
-0.4727460443973541,
1.1558481454849243,
... |
func (b *FixBoard) hasBit(i int, l uint) bool {
if i < 0 {
return true
}
return b.Spaces[i]&(1<<l) > 0
} | [
0.35516995191574097,
1.0568355321884155,
0.5546164512634277,
0.7099528312683105,
-0.03832511976361275,
1.0440902709960938,
-0.05876445770263672,
0.02678133361041546,
-0.7746499180793762,
-0.9074251651763916,
-0.6644619107246399,
-0.6800014972686768,
-0.7233030200004578,
0.9092515110969543,... |
func (b *FixBoard) HasWall(s int, w int) bool {
row := s / 16
column := s % 16
if w == DirLeft {
return b.hasBit(row, uint(31-(column-1))) || column == 0
}
if w == DirTop {
return b.hasBit(row-1, uint(15-column)) || row == 0
}
if w == DirRight {
return b.hasBit(row, uint(31-column)) || column == 15
}
... | [
0.21103854477405548,
0.7664698362350464,
0.8495539426803589,
0.3390810787677765,
-0.4379194676876068,
-0.22361686825752258,
0.9853301048278809,
-0.7645488381385803,
0.01052368339151144,
-0.884506106376648,
-0.18577679991722107,
0.3481740653514862,
-0.4280399680137634,
1.2625240087509155,
... |
func (b *FixBoard) MoveGopher(g byte, d int) {
for _, v := range b.Gophers {
if v.Type != g {
continue
}
var smod int
s := v.Location
if d == DirLeft {
smod = -1
} else if d == DirTop {
smod = -16
} else if d == DirRight {
smod = 1
} else if d == DirBottom {
smod = 16
}
// canMove... | [
-0.9947174787521362,
0.5178132057189941,
0.6627359390258789,
0.19153764843940735,
-0.11681877076625824,
0.3696088194847107,
1.4836454391479492,
0.2035936415195465,
-0.034688591957092285,
1.212984561920166,
-1.0887264013290405,
0.6983014941215515,
-0.8774669170379639,
0.3633422255516052,
... |
func (b *FixBoard) canMove(s int, d int, i bool) bool {
var smod int
if d == DirLeft {
smod = -1
} else if d == DirTop {
smod = -16
} else if d == DirRight {
smod = 1
} else if d == DirBottom {
smod = 16
}
proposed := s + smod
if !i {
for _, v := range b.Gophers {
if v.Location == proposed {
... | [
-0.3537829518318176,
0.9391037225723267,
0.5339154601097107,
0.5477499961853027,
-0.5024577975273132,
0.26348876953125,
0.7941327691078186,
0.658759355545044,
-0.5034295320510864,
0.5892893075942993,
0.04282533749938011,
0.16281524300575256,
-0.43941259384155273,
-0.08594450354576111,
-0... |
func (b *FixBoard) MoveCheck(s int, d int, l []int) int {
var smod int
result := s
if d == DirLeft {
smod = -1
} else if d == DirTop {
smod = -16
} else if d == DirRight {
smod = 1
} else if d == DirBottom {
smod = 16
}
canMove := b.canMove(s, d, true)
proposed := s + smod
for _, v := range l {
i... | [
-0.6968623399734497,
1.0114115476608276,
0.8294997215270996,
0.8209231495857239,
-0.2561212182044983,
-0.4891970455646515,
0.8982798457145691,
0.24267181754112244,
-0.0894162580370903,
0.2894628643989563,
-0.19077450037002563,
0.06521178036928177,
-0.20132657885551453,
0.5693751573562622,
... |
func NewRepository(conf *Configuration) (storage.Repository, error) {
// Set client options
clientOptions := options.Client().
ApplyURI(conf.ConnectionString)
if conf.Username != "" {
clientOptions = clientOptions.
SetAuth(options.Credential{
Username: conf.Username,
Password: conf.Password,
})
}... | [
0.00772951589897275,
-0.18259018659591675,
0.32101672887802124,
0.5666786432266235,
0.2457943558692932,
-0.2505475580692291,
0.00296633318066597,
0.47705674171447754,
0.018262533470988274,
0.7880752682685852,
-0.5147803425788879,
-0.4409945011138916,
-0.8463613390922546,
0.1537179946899414... |
func ExampleManagementGroupSubscriptionsClient_Create() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armmanagementgroups.NewClientFactory(cred, nil)
if err != nil {
log.Fatalf("... | [
0.8175048232078552,
0.37912365794181824,
0.518916130065918,
-0.1064576655626297,
-0.331798791885376,
-0.18403391540050507,
0.039974357932806015,
-0.9003639817237854,
-0.6895074248313904,
-0.039932701736688614,
-0.08332908898591995,
0.6040547490119934,
-0.2609318494796753,
0.027831196784973... |
func ExampleManagementGroupSubscriptionsClient_Delete() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armmanagementgroups.NewClientFactory(cred, nil)
if err != nil {
log.Fatalf("... | [
1.1960210800170898,
0.17809253931045532,
0.49615371227264404,
-0.1452760100364685,
-0.5022748112678528,
-0.4379656910896301,
0.26552969217300415,
-0.21817825734615326,
-0.5495287179946899,
0.7443954348564148,
0.37002575397491455,
1.1063436269760132,
-0.6713701486587524,
0.0905640497803688,... |
func ExampleManagementGroupSubscriptionsClient_GetSubscription() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armmanagementgroups.NewClientFactory(cred, nil)
if err != nil {
log... | [
0.7393454313278198,
0.025605689734220505,
0.5873980522155762,
-0.09061885625123978,
-0.4092412292957306,
-0.6648714542388916,
-0.01397270243614912,
-0.7915846705436707,
-0.3244663178920746,
0.2072291523218155,
0.0029338435269892216,
1.1427873373031616,
-0.40330711007118225,
-0.202414363622... |
func ExampleManagementGroupSubscriptionsClient_NewGetSubscriptionsUnderManagementGroupPager() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armmanagementgroups.NewClientFactory(cred... | [
0.7809737324714661,
-0.04104491323232651,
0.5035755634307861,
-0.24802440404891968,
-0.5641489624977112,
-0.30012035369873047,
-0.3347369432449341,
-0.6403188705444336,
-0.5139010548591614,
0.0209413543343544,
0.4287712872028351,
0.9773430824279785,
-0.022020312026143074,
0.804717361927032... |
func BenchmarkInMemo_Insert(b *testing.B) {
inMemo := &memory.InMemo{
KeyPairs: map[string]*repository.KeyPair{},
}
const (
matchingEncKey = "matchingEncKey"
matchingDecKey = "matchingDecKey"
matchingCipherText = "matchingCiphertext"
)
insertReqs := []struct {
key string
mode str... | [
-0.3630461096763611,
0.8183950185775757,
0.7320902347564697,
-0.3135543763637543,
-0.1669131964445114,
-0.22974517941474915,
0.33511513471603394,
0.25424090027809143,
-0.5494877099990845,
0.6320955157279968,
-0.8607156276702881,
0.0043609123677015305,
-1.5367721319198608,
0.169875577092170... |
func BenchmarkInMemo_InsertBulk(b *testing.B) {
inMemo := &memory.InMemo{
KeyPairs: map[string]*repository.KeyPair{},
}
const (
matchingEncKey = "matchingEncKey"
matchingDecKey = "matchingDecKey"
matchingCipherText = "matchingCiphertext"
)
insertReqs := []repository.InsertBulkRequest{
{
Key:... | [
-0.5540879368782043,
1.1990550756454468,
0.7494537830352783,
0.13375596702098846,
0.5107325911521912,
-0.45822378993034363,
0.322274386882782,
0.11181867867708206,
-0.27463483810424805,
0.16895851492881775,
-1.1468505859375,
0.15511590242385864,
-1.2928576469421387,
0.4747067391872406,
-... |
func NewHTTPClient(timeout time.Duration) *http.Client {
return &http.Client{
Timeout: timeout,
}
} | [
0.09229487925767899,
-0.6927972435951233,
0.29332277178764343,
0.5104982852935791,
-1.400120735168457,
0.6100112199783325,
-1.0159262418746948,
0.2837955355644226,
-0.4426754117012024,
0.3724714517593384,
-0.1846986562013626,
0.8721006512641907,
-0.032622430473566055,
-0.6668332815170288,
... |
func ReconcileK8SVersionInSpec(rawKluster []byte, current *v1.Kluster, clients config.Clients, factories config.Factories) (err error) {
if current.Spec.Version != current.Status.ApiserverVersion {
if current.Status.ApiserverVersion == "" {
return errors.New("No kubernetes version found in status")
}
current... | [
-0.21874497830867767,
-1.1817824840545654,
0.40594416856765747,
0.200901061296463,
0.23007293045520782,
0.4892679750919342,
-0.5459363460540771,
0.7131908535957336,
-0.014462485909461975,
1.546449899673462,
0.3393152058124542,
0.1933353692293167,
-0.18993066251277924,
0.13225628435611725,
... |
func NewWriter(addr []string) (*Writer, error) {
var err error
w := new(Writer)
addrIdx := rand.Intn(len(addr))
if w.conn, err = net.Dial("tcp", addr[addrIdx]); err != nil {
return nil, err
}
return w, nil
} | [
-0.7323178052902222,
0.4922631084918976,
0.45459237694740295,
0.272858202457428,
-0.2104673981666565,
-0.5221028923988342,
0.38054418563842773,
-0.28888002038002014,
0.6821070909500122,
0.6338401436805725,
0.5755694508552551,
-0.5902897715568542,
-0.46588248014450073,
-0.1795060634613037,
... |
func (w *Writer) WriteMessage(m *Message) (err error) {
mBytes, err := json.Marshal(m)
if err != nil {
return err
}
buff := bytes.NewBuffer(mBytes)
buff.Grow(1)
buff.WriteByte(delimiter)
record := buff.String()
w.mu.Lock()
n, err := w.conn.Write([]byte(record))
if err != nil {
log.Printf("error: %v", er... | [
-0.8739067316055298,
0.6488779187202454,
0.9108569622039795,
-0.05067003518342972,
0.4642430543899536,
-0.3451012372970581,
-0.03146614506840706,
-0.004228801932185888,
-0.42582327127456665,
0.4623483419418335,
-0.3160907030105591,
-0.3002408742904663,
-1.234113097190857,
0.549699366092681... |
func (*Route) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) {
return _Route_OneofMarshaler, _Route_OneofUnmarshaler, _Route_OneofSizer, []interface{}{
(*Route_Route)(nil),
(*Ro... | [
-0.6239070892333984,
0.7463001608848572,
0.5536924600601196,
-0.5487513542175293,
0.756710410118103,
-0.8391595482826233,
0.6563472151756287,
-0.8043094873428345,
0.3674621880054474,
-0.5952070355415344,
-0.43861162662506104,
-0.25263360142707825,
0.05476244539022446,
0.7327067852020264,
... |
func (*RouteMatch) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) {
return _RouteMatch_OneofMarshaler, _RouteMatch_OneofUnmarshaler, _RouteMatch_OneofSizer, []interface{}{
(*Route... | [
-0.6051093935966492,
0.7465463280677795,
0.5294281840324402,
-0.5447916984558105,
0.5835580229759216,
-0.6902913451194763,
0.6755159497261047,
-0.07686576247215271,
0.39950305223464966,
-0.474882572889328,
-0.5942183136940002,
-0.31548839807510376,
-0.7603043913841248,
0.41858094930648804,... |
func (*RouteAction) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) {
return _RouteAction_OneofMarshaler, _RouteAction_OneofUnmarshaler, _RouteAction_OneofSizer, []interface{}{
(*R... | [
-0.7993330359458923,
0.3867266774177551,
0.5925520062446594,
-0.6779990792274475,
0.9605110883712769,
-0.8765881061553955,
1.522855520248413,
-0.8474876284599304,
0.4588029682636261,
0.30021703243255615,
-0.5428656935691833,
0.4015457034111023,
-0.6977182030677795,
0.6835815906524658,
-0... |
func (*RouteAction_HashPolicy) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) {
return _RouteAction_HashPolicy_OneofMarshaler, _RouteAction_HashPolicy_OneofUnmarshaler, _RouteAction... | [
0.05966540053486824,
0.3799193501472473,
0.6237127780914307,
-0.503417432308197,
1.130232334136963,
-0.10045749694108963,
0.8115960955619812,
-0.5668924450874329,
0.4727977216243744,
0.28183048963546753,
-0.11215534061193466,
-0.08015482872724533,
-0.41873154044151306,
0.06434709578752518,... |
func (*RateLimit_Action) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) {
return _RateLimit_Action_OneofMarshaler, _RateLimit_Action_OneofUnmarshaler, _RateLimit_Action_OneofSizer, ... | [
0.05741395428776741,
0.46655645966529846,
0.47211164236068726,
-0.509362518787384,
0.8821848630905151,
-0.4669798016548157,
0.8302428722381592,
-1.080527901649475,
0.6248284578323364,
0.5273451209068298,
-0.4676345884799957,
0.4723256528377533,
-0.6093397736549377,
-0.19489724934101105,
... |
func generateCode(length int) string {
code := ""
for i := 0; i < length; i++ {
code += string(codeChars[rand.Intn(len(codeChars))])
}
if isDirty(code) {
return generateCode(length)
}
// make sure code isn't already in use
if _, ok := Find(code); ok {
return generateCode(length)
}
return code
} | [
-0.6806465983390808,
0.4289921820163727,
0.6350674033164978,
-0.051458943635225296,
-0.10017233341932297,
-0.48071712255477905,
-0.27258557081222534,
-0.37225833535194397,
0.9604524374008179,
0.022402212023735046,
0.18303754925727844,
-0.17493431270122528,
-0.7206112742424011,
0.6158156991... |
func RiderStationReducer(dao simulation.EventDAO) redux.Reducer {
return func(state redux.State, action redux.Action) redux.State {
switch action.Type {
case "RIDER_SHOWS_UP_STATION":
stations := state["stations"].([]simulation.Station)
logicalTime := action.Value.(int64)
simulatedTime := logicalTimeToRea... | [
-0.4737583100795746,
-0.1845260113477707,
0.6389692425727844,
-0.1578618437051773,
-0.49619466066360474,
-0.3384932279586792,
0.11285022646188736,
0.3254990577697754,
0.46262264251708984,
0.9464877247810364,
-0.05039201304316521,
-0.40647390484809875,
0.6317800879478455,
0.2173220515251159... |
func TrainStationReducer(state redux.State, action redux.Action) redux.State {
// for each train: move it to next location in the train line
switch action.Type {
case "TRAIN_DEPARTURE":
// IDEA: move train based on geo location with its accelocation rather teleporting to next station
trains := state["trains"].([... | [
-1.057249903678894,
0.3675755262374878,
0.5078203678131104,
-0.18996144831180573,
-0.18732453882694244,
0.11707675457000732,
0.009078806266188622,
0.5215990543365479,
-0.06995028257369995,
0.791605532169342,
-0.3060331642627716,
-1.09345281124115,
1.2699795961380005,
-0.22387729585170746,
... |
func RiderTrainReducer(dao simulation.EventDAO) redux.Reducer {
return func(state redux.State, action redux.Action) redux.State {
// for each rider in the station with a train, decide if rider want to hop on the train
switch action.Type {
case "RIDER_ARRIVAL_TRAIN":
logicalTime := action.Value.(int64)
simu... | [
0.12650758028030396,
0.2508482336997986,
0.8573650121688843,
-0.3979301452636719,
-0.395408034324646,
-0.47632473707199097,
0.18795211613178253,
0.3642973005771637,
-0.57380211353302,
1.2214819192886353,
-0.22635281085968018,
-0.8511577844619751,
0.5727818012237549,
0.5121466517448425,
0... |
func PersistStateReducer(state redux.State, action redux.Action) redux.State {
switch action.Type {
case "PERSIST_STATE":
logicalTime := action.Value.(int64)
actualTime := logicalTimeToRealTime(initialActualTime, actualDuration, logicalTime)
state["counter"] = logicalTime
state["time"] = actualTime
currentS... | [
-0.6145657896995544,
-0.03444686532020569,
0.7615818977355957,
-0.37640970945358276,
-0.32584846019744873,
-0.0916518121957779,
0.302815705537796,
0.36461085081100464,
0.727072536945343,
0.7604654431343079,
0.10514988750219345,
-0.39261868596076965,
0.19910255074501038,
0.5152291655540466,... |
func logicalTimeToRealTime(initialTime time.Time, duration time.Duration, logicalTime int64) time.Time {
return initialTime.Add(time.Duration(logicalTime) * duration)
} | [
0.43676096200942993,
-0.19672958552837372,
0.3350771367549896,
-0.032067712396383286,
-0.6750593781471252,
0.3076651692390442,
-1.063747525215149,
1.2618638277053833,
0.4236084222793579,
1.14410400390625,
0.5508007407188416,
0.19196324050426483,
-0.45267945528030396,
-0.6107663512229919,
... |
func (s *userExternalAccounts) Get(ctx context.Context, id int32) (*extsvc.ExternalAccount, error) {
if Mocks.ExternalAccounts.Get != nil {
return Mocks.ExternalAccounts.Get(id)
}
return s.getBySQL(ctx, sqlf.Sprintf("WHERE id=%d AND deleted_at IS NULL LIMIT 1", id))
} | [
-0.3089761435985565,
0.1711607724428177,
0.5737972259521484,
-0.21336223185062408,
-0.15641279518604279,
-0.34201544523239136,
-0.3308798372745514,
-0.038582101464271545,
0.6589237451553345,
-0.24439585208892822,
0.18937605619430542,
0.8692945837974548,
-0.504802942276001,
-0.2932495772838... |
func (s *userExternalAccounts) LookupUserAndSave(ctx context.Context, spec extsvc.ExternalAccountSpec, data extsvc.ExternalAccountData) (userID int32, err error) {
if Mocks.ExternalAccounts.LookupUserAndSave != nil {
return Mocks.ExternalAccounts.LookupUserAndSave(spec, data)
}
err = dbconn.Global.QueryRowContext... | [
0.017001278698444366,
-0.09943375736474991,
0.7488265037536621,
-0.45688408613204956,
-1.0408662557601929,
0.48074859380722046,
0.4476129710674286,
-0.06603936851024628,
0.7454541921615601,
-0.12191437929868698,
-0.13702452182769775,
0.23939165472984314,
-0.061254989355802536,
0.3431831300... |
func (s *userExternalAccounts) AssociateUserAndSave(ctx context.Context, userID int32, spec extsvc.ExternalAccountSpec, data extsvc.ExternalAccountData) (err error) {
if Mocks.ExternalAccounts.AssociateUserAndSave != nil {
return Mocks.ExternalAccounts.AssociateUserAndSave(userID, spec, data)
}
// This "upsert" m... | [
-0.2860054075717926,
0.12491090595722198,
0.7204404473304749,
-0.2205267995595932,
-0.32511112093925476,
-0.14148856699466705,
1.0666329860687256,
-0.18120647966861725,
0.8580068945884705,
0.6293171048164368,
-0.13137225806713104,
-0.17163215577602386,
0.2025432586669922,
0.594071388244628... |
func (s *userExternalAccounts) CreateUserAndSave(ctx context.Context, newUser NewUser, spec extsvc.ExternalAccountSpec, data extsvc.ExternalAccountData) (createdUserID int32, err error) {
if Mocks.ExternalAccounts.CreateUserAndSave != nil {
return Mocks.ExternalAccounts.CreateUserAndSave(newUser, spec, data)
}
//... | [
-0.2602328360080719,
-0.09980868548154831,
0.6339004039764404,
-0.07940328121185303,
-0.28597450256347656,
0.5905561447143555,
0.9390691518783569,
-0.0945686474442482,
0.2971579134464264,
0.3707239031791687,
-0.45874378085136414,
-0.6528553366661072,
-0.41866403818130493,
0.628624498844146... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.