text stringlengths 11 6.3k | embedding listlengths 768 768 |
|---|---|
func zerrlqt(path string, _t *testing.T) {
var i, j, nmax int
var err error
w := cvf(2)
a := cmf(2, 2, opts)
c := cmf(2, 2, opts)
t := cmf(2, 2, opts)
nmax = 2
errt := &gltest.Common.Infoc.Errt
ok := &gltest.Common.Infoc.Ok
srnamt := &gltest.Common.Srnamc.Srnamt
// Set the variables to innocuous value... | [
0.5242495536804199,
-0.5855526328086853,
0.6354064345359802,
-1.091176152229309,
-0.9385470151901245,
-0.14230969548225403,
0.0015916666015982628,
-1.1370407342910767,
-0.08025319129228592,
0.08356580883264542,
-0.32984495162963867,
-0.10590316355228424,
-0.36221155524253845,
0.38390180468... |
func TokenRealm(tokenRealmString string) (*url.URL, error) {
if len(tokenRealmString) == 0 {
// If not specified, default to "/openshift/token", auto-detecting the scheme and host
return &url.URL{Path: defaultTokenPath}, nil
}
tokenRealm, err := url.Parse(tokenRealmString)
if err != nil {
return nil, fmt.Err... | [
-0.1928529441356659,
-0.006108599249273539,
0.6629663109779358,
0.08284252882003784,
0.08152786642313004,
-0.24442628026008606,
0.5569982528686523,
0.5786576867103577,
-0.1954534947872162,
-0.44639578461647034,
0.20832481980323792,
0.0026584963779896498,
-0.4344569146633148,
-0.39653995633... |
func Parse(rd io.Reader) (*configuration.Configuration, *Configuration, error) {
in, err := ioutil.ReadAll(rd)
if err != nil {
return nil, nil, err
}
// We don't want to change the version from the environment variables.
if err := os.Unsetenv("REGISTRY_OPENSHIFT_VERSION"); err != nil {
return nil, nil, err
}... | [
-0.22887767851352692,
-0.1711026132106781,
0.7439792156219482,
-0.17297083139419556,
-0.0775599479675293,
-0.35970813035964966,
0.28220850229263306,
0.0323115810751915,
-0.08407681435346603,
0.7619661092758179,
-0.5599830150604248,
0.4455080032348633,
0.2217923402786255,
0.8934252262115479... |
func Many(combiner ResultCombiner, parser Parser) Parser {
if combiner == nil {
combiner = SliceCombiner
}
return ParserFunc(func(s Scanner) (Result, Scanner) {
var results []Result
next := s
for {
r, maybeNext := parser.Parse(next)
if !r.Matched() {
break
}
next = maybeNext
results = a... | [
-0.4422788918018341,
0.015254391357302666,
0.6008750200271606,
0.5121347308158875,
-0.1291963905096054,
-0.9869635105133057,
-0.3510057032108307,
0.26244303584098816,
-0.08840887248516083,
-0.6399297714233398,
-0.0698561891913414,
-1.3099340200424194,
-0.034782201051712036,
0.9910874962806... |
func ManyRunes(parser Parser) Parser {
return ParserFunc(func(s Scanner) (Result, Scanner) {
next := s
for {
r, maybeNext := parser.Parse(next)
if !r.Matched() {
break
}
next = maybeNext
}
return Result{
Runes: s.Between(next),
}, next
})
} | [
0.20119211077690125,
-0.31751158833503723,
0.7234218716621399,
-0.20783193409442902,
-0.9148736596107483,
-0.752764880657196,
-0.7064322829246521,
-0.08511219918727875,
0.03243187069892883,
-0.8452607989311218,
0.08848956972360611,
-0.7241583466529846,
-0.9837131500244141,
0.76133984327316... |
func OnePlus(combiner ResultCombiner, parser Parser) Parser {
if combiner == nil {
combiner = SliceCombiner
}
return ParserFunc(func(s Scanner) (Result, Scanner) {
r, next := parser.Parse(s)
if !r.Matched() {
return r, next
}
results := []Result{r}
for {
r, maybeNext := parser.Parse(next)
if ... | [
-0.615494430065155,
-0.0018307262798771262,
0.5164689421653748,
-0.20198731124401093,
-0.5758441090583801,
-1.090712308883667,
-0.0937924012541771,
0.37698855996131897,
1.0398590564727783,
-0.6989277005195618,
-0.020438970997929573,
-0.8026744723320007,
-0.27816078066825867,
0.476077169179... |
func OnePlusRunes(parser Parser) Parser {
return ParserFunc(func(s Scanner) (Result, Scanner) {
r, next := parser.Parse(s)
if !r.Matched() {
return r, next
}
for {
r, maybeNext := parser.Parse(next)
if !r.Matched() {
break
}
next = maybeNext
}
return Result{
Runes: s.Between(next),
... | [
0.24361677467823029,
0.14178544282913208,
0.6952580213546753,
-0.7915171980857849,
-1.0581105947494507,
-0.3164580166339874,
-0.24134455621242523,
0.39709487557411194,
0.7616701126098633,
-0.7205343246459961,
0.22147279977798462,
-0.6876716017723083,
-0.9747868776321411,
-0.015103561803698... |
func (in *CF1535A) Run() {
t := in.NextInt()
for ; t > 0; t-- {
s1, s2, s3, s4 := in.NextInt(), in.NextInt(), in.NextInt(), in.NextInt()
arr := []int{s1, s2, s3, s4}
sort.Ints(arr)
ans := "YES"
if (arr[3] == s1 && arr[2] == s2) || (arr[3] == s2 && arr[2] == s1) {
ans = "NO"
} else if (arr[3] == s3 &&... | [
-0.6130228638648987,
-0.015745095908641815,
0.7567667961120605,
-0.3242599666118622,
-0.6941659450531006,
0.12644533812999725,
1.2555493116378784,
-0.37491101026535034,
-0.503727912902832,
-0.12008069455623627,
-0.6011942625045776,
0.31752094626426697,
-0.7079624533653259,
0.20606110990047... |
func Add(mgr manager.Manager) error {
return add(mgr, newReconciler(mgr))
} | [
-0.24057555198669434,
0.12229465693235397,
0.46777674555778503,
-0.6655282378196716,
0.4479011595249176,
-0.17455056309700012,
-0.48020607233047485,
0.6828829646110535,
0.19666412472724915,
-0.7739230394363403,
0.224630668759346,
0.617239773273468,
-1.010264277458191,
1.3228338956832886,
... |
func newReconciler(mgr manager.Manager) reconcile.Reconciler {
return &ReconcileFloatingIPSet{
Client: mgr.GetClient(),
scheme: mgr.GetScheme(),
recorder: mgr.GetRecorder("floatingipassociate-controller"),
}
} | [
-0.015303941443562508,
-0.16578710079193115,
0.4396336078643799,
-1.1266074180603027,
-0.6512956023216248,
-0.3809928297996521,
0.47739070653915405,
0.7035122513771057,
-0.43246057629585266,
-0.3972915709018707,
0.9908050298690796,
-0.7141444087028503,
-0.2864910662174225,
0.64266932010650... |
func add(mgr manager.Manager, r reconcile.Reconciler) error {
// Create a new controller
c, err := controller.New("floatingipset-controller", mgr, controller.Options{Reconciler: r})
if err != nil {
return err
}
// Watch for changes to FloatingIPSet
err = c.Watch(&source.Kind{Type: &openstackv1beta1.FloatingIPS... | [
-0.18106085062026978,
-0.43739739060401917,
0.7840219140052795,
-0.7731269001960754,
0.11328979581594467,
-0.026307865977287292,
-0.03653270751237869,
-0.03223497048020363,
0.10515112429857254,
-0.29903486371040344,
0.7103443145751953,
-0.00386650743894279,
-0.1775597482919693,
0.847047388... |
func (r *ReconcileFloatingIPSet) Reconcile(request reconcile.Request) (reconcile.Result, error) {
fmt.Println("Reconcile")
ctx := context.Background()
// Fetch the FloatingIPSet instance
instance := openstackv1beta1.FloatingIPSet{}
err := r.Get(context.TODO(), request.NamespacedName, &instance)
if err != nil {
... | [
-1.31278395652771,
-0.11138695478439331,
0.993061900138855,
-0.6200117468833923,
0.181491881608963,
-0.34550514817237854,
-0.060280606150627136,
-0.0823226124048233,
-0.4944831430912018,
0.2521023154258728,
0.7818654179573059,
-0.10672997683286667,
-0.4949152171611786,
0.6987699866294861,
... |
func TestNewValue(t *testing.T) {
v := NewValue(int(1))
if _, ok := v.(IntValue); !ok {
t.Errorf("Expected IntValue but received %T", v)
}
v = NewValue(float64(1.0))
if _, ok := v.(NumberValue); !ok {
t.Errorf("Expected NumberValue but received %T", v)
}
v = NewValue(true)
if v, ok := v.(BoolValue); !ok {... | [
-0.25266993045806885,
0.5257890820503235,
0.7841485738754272,
-0.3047390282154083,
0.046942055225372314,
0.4295770823955536,
-0.24974794685840607,
-0.5638959407806396,
0.07833581417798996,
-0.2036449909210205,
-0.386676549911499,
0.3842856287956238,
0.2375224232673645,
0.6200370192527771,
... |
func FreePort() (int, error) {
addr, err := net.ResolveTCPAddr("tcp", "localhost:0")
if err != nil {
return 0, err
}
listen, err := net.ListenTCP("tcp", addr)
if err != nil {
return 0, err
}
defer listen.Close()
return listen.Addr().(*net.TCPAddr).Port, nil
} | [
0.9609030485153198,
0.07198899984359741,
0.64518803358078,
-0.9332849979400635,
-0.14990372955799103,
-0.31208741664886475,
0.7106420397758484,
0.13618122041225433,
0.33190855383872986,
-0.0780201107263565,
0.1759701371192932,
0.08175390958786011,
-0.7643135190010071,
0.47028663754463196,
... |
func (s PowerControl) Describe(ch chan<- *prometheus.Desc) {
ch <- config.C_powercontrol
} | [
1.09583580493927,
0.46599438786506653,
0.34538349509239197,
-0.6668655872344971,
0.8260142803192139,
0.7293180227279663,
-0.3544142544269562,
-0.3529216945171356,
-0.8248397707939148,
-0.492317795753479,
0.09163546562194824,
1.1079435348510742,
-0.049770187586545944,
0.6445470452308655,
... |
func (s PowerControl) Collect(ch chan<- prometheus.Metric) {
metric := config.GOFISH.Service
chass, _ := metric.Chassis()
for _, v := range chass {
powers, _ := v.Power()
if powers != nil {
for _, p := range powers.PowerControl {
ch <- prometheus.MustNewConstMetric(config.C_powercontrol, prometheus.Gaug... | [
0.31405654549598694,
-0.5977280139923096,
0.49875569343566895,
-0.6072875261306763,
0.5853329300880432,
0.5040606260299683,
-0.20336875319480896,
-0.6662076115608215,
-1.4739688634872437,
0.38766080141067505,
0.5347069501876831,
0.6599567532539368,
0.6748175024986267,
1.4902068376541138,
... |
func NewTransferTx(nonce uint64, fee *transaction.Fee, xfer *Transfer) *transaction.Transaction {
return transaction.NewTransaction(nonce, fee, MethodTransfer, xfer)
} | [
0.9336680173873901,
0.7958464026451111,
0.55023193359375,
-0.16085802018642426,
-0.45643889904022217,
-0.2408195585012436,
-1.278471827507019,
-0.5734415054321289,
0.23495344817638397,
-0.13355271518230438,
-0.33256790041923523,
-0.05610263720154762,
-0.6231164336204529,
0.1042024791240692... |
func NewBurnTx(nonce uint64, fee *transaction.Fee, burn *Burn) *transaction.Transaction {
return transaction.NewTransaction(nonce, fee, MethodBurn, burn)
} | [
0.5650418400764465,
0.3150208592414856,
0.3191375136375427,
0.7221447229385376,
-0.7312517762184143,
-1.0098755359649658,
-0.8445645570755005,
-0.2930228114128113,
0.22277790307998657,
-0.13707290589809418,
-0.3015938103199005,
0.23296494781970978,
-0.467934250831604,
0.13493500649929047,
... |
func NewAddEscrowTx(nonce uint64, fee *transaction.Fee, escrow *Escrow) *transaction.Transaction {
return transaction.NewTransaction(nonce, fee, MethodAddEscrow, escrow)
} | [
0.2990334928035736,
0.8700572848320007,
0.522960901260376,
0.4481360614299774,
-0.022727802395820618,
0.0063736941665410995,
-0.36222296953201294,
-0.177851602435112,
-0.21487803757190704,
-0.47860410809516907,
0.2634653151035309,
-0.3976753056049347,
0.40871578454971313,
0.512753963470459... |
func NewReclaimEscrowTx(nonce uint64, fee *transaction.Fee, reclaim *ReclaimEscrow) *transaction.Transaction {
return transaction.NewTransaction(nonce, fee, MethodReclaimEscrow, reclaim)
} | [
1.3996237516403198,
0.35858747363090515,
0.5311920046806335,
0.28858673572540283,
-0.2012515664100647,
-0.6712265014648438,
-0.17517513036727905,
0.033565275371074677,
0.34257733821868896,
-0.6557561755180359,
-0.6317287683486938,
-0.07697681337594986,
-0.01863383688032627,
0.2452755570411... |
func NewAmendCommissionScheduleTx(nonce uint64, fee *transaction.Fee, amend *AmendCommissionSchedule) *transaction.Transaction {
return transaction.NewTransaction(nonce, fee, MethodAmendCommissionSchedule, amend)
} | [
0.742633581161499,
0.48580488562583923,
0.6042958498001099,
-0.25527361035346985,
-1.0847856998443604,
0.1129789724946022,
-1.1743029356002808,
0.5797703862190247,
-0.39233362674713135,
0.7906006574630737,
0.330468088388443,
0.48121899366378784,
-0.2093649059534073,
0.7731796503067017,
-... |
func (p *SharePool) sharesForTokens(amount *quantity.Quantity) (*quantity.Quantity, error) {
if p.TotalShares.IsZero() {
// No existing shares, exchange rate is 1:1.
return amount.Clone(), nil
}
if p.Balance.IsZero() {
// This can happen if the pool has no balance due to
// losing everything through slashing... | [
0.4556486904621124,
0.18806104362010956,
0.30441081523895264,
-1.2124288082122803,
0.5266004800796509,
-0.43728911876678467,
-0.1330849975347519,
-1.099568486213684,
0.7679662108421326,
-0.946255624294281,
0.37746259570121765,
-0.3687187433242798,
0.05436762049794197,
-0.39553236961364746,... |
func (p *SharePool) Deposit(shareDst, tokenSrc, tokenAmount *quantity.Quantity) error {
shares, err := p.sharesForTokens(tokenAmount)
if err != nil {
return err
}
if err = quantity.Move(&p.Balance, tokenSrc, tokenAmount); err != nil {
return err
}
if err = p.TotalShares.Add(shares); err != nil {
return er... | [
-0.06661347299814224,
0.1330561339855194,
0.7161577939987183,
-0.728294312953949,
0.3808300793170929,
0.5472247004508972,
0.8114780783653259,
-0.6210359334945679,
-0.3723534941673279,
-0.2628149688243866,
-0.03458352014422417,
-0.06725530326366425,
0.12548378109931946,
0.2892310321331024,
... |
func (p *SharePool) tokensForShares(amount *quantity.Quantity) (*quantity.Quantity, error) {
if amount.IsZero() || p.Balance.IsZero() || p.TotalShares.IsZero() {
// No existing shares or no balance means no tokens.
return quantity.NewQuantity(), nil
}
// Exchange rate is based on issued shares and the total bal... | [
0.3690569996833801,
-0.09092359244823456,
0.2563621401786804,
-0.9697859883308411,
0.11451154202222824,
-0.6829065680503845,
0.25917375087738037,
-0.02324494533240795,
1.1081591844558716,
-0.8356711864471436,
0.523622453212738,
-0.1049618124961853,
0.4845910966396332,
-0.12061292678117752,... |
func (p *SharePool) Withdraw(tokenDst, shareSrc, shareAmount *quantity.Quantity) error {
tokens, err := p.tokensForShares(shareAmount)
if err != nil {
return err
}
if err = shareSrc.Sub(shareAmount); err != nil {
return err
}
if err = p.TotalShares.Sub(shareAmount); err != nil {
return err
}
if err = q... | [
-0.21335242688655853,
0.1012180745601654,
0.6823726296424866,
-0.8922849893569946,
0.019774671643972397,
0.03404746949672699,
0.4863108694553375,
0.06052524968981743,
0.019389502704143524,
-0.6431530714035034,
0.14543239772319794,
0.5919922590255737,
0.06321541219949722,
-0.800480306148529... |
func (k ThresholdKind) String() string {
switch k {
case KindEntity:
return "entity"
case KindNodeValidator:
return "validator node"
case KindNodeCompute:
return "compute node"
case KindNodeStorage:
return "storage node"
case KindNodeKeyManager:
return "key manager node"
case KindRuntimeCompute:
retu... | [
0.5730868577957153,
-0.9737673401832581,
0.24182693660259247,
-0.14650557935237885,
-0.24149759113788605,
0.5107232928276062,
-0.5988807082176208,
-1.509852647781372,
-1.148177981376648,
0.6120246052742004,
0.4309464693069458,
1.1790393590927124,
-0.25863757729530334,
0.16232959926128387,
... |
func (sa *StakeAccumulator) AddClaimUnchecked(claim StakeClaim, thresholds []ThresholdKind) {
if sa.Claims == nil {
sa.Claims = make(map[StakeClaim][]ThresholdKind)
}
sa.Claims[claim] = thresholds
} | [
0.7333593964576721,
-0.08792737126350403,
0.47246840596199036,
-0.20057865977287292,
0.3298737108707428,
0.16879154741764069,
-0.4726111888885498,
0.07784371823072433,
0.4242679476737976,
-0.7564408779144287,
0.5234897136688232,
0.34944337606430054,
0.40560808777809143,
0.1983712613582611,... |
func (sa *StakeAccumulator) RemoveClaim(claim StakeClaim) error {
if sa.Claims == nil || sa.Claims[claim] == nil {
return fmt.Errorf("staking: claim does not exist: %s", claim)
}
delete(sa.Claims, claim)
return nil
} | [
0.7457372546195984,
0.4738638997077942,
0.33918052911758423,
0.13818520307540894,
-0.4354729950428009,
-0.6252739429473877,
-0.19796045124530792,
0.5347111225128174,
0.5805227160453796,
0.024543093517422676,
0.46103668212890625,
-0.29824313521385193,
0.03506987541913986,
0.6540369987487793... |
func (sa *StakeAccumulator) TotalClaims(thresholds map[ThresholdKind]quantity.Quantity, exclude *StakeClaim) (*quantity.Quantity, error) {
if sa == nil || sa.Claims == nil {
return quantity.NewQuantity(), nil
}
var total quantity.Quantity
for id, claim := range sa.Claims {
if exclude != nil && id == *exclude {... | [
0.7358332276344299,
0.019235923886299133,
0.6602232456207275,
0.30710282921791077,
-0.5426545739173889,
0.020794954150915146,
0.09169457852840424,
-0.21944758296012878,
0.6771183013916016,
0.20924712717533112,
0.6631050705909729,
0.3364527225494385,
-0.17703571915626526,
-0.060149285942316... |
func (e *EscrowAccount) CheckStakeClaims(tm map[ThresholdKind]quantity.Quantity) error {
totalClaims, err := e.StakeAccumulator.TotalClaims(tm, nil)
if err != nil {
return err
}
if e.Active.Balance.Cmp(totalClaims) < 0 {
return ErrInsufficientStake
}
return nil
} | [
0.4489569067955017,
-0.35652822256088257,
0.47582387924194336,
-0.0044517843052744865,
-0.08210291713476181,
0.4673149585723877,
0.5075433254241943,
-0.40473732352256775,
0.01039213128387928,
-0.08644966781139374,
0.08976978063583374,
0.21604347229003906,
0.07205718755722046,
0.42289909720... |
func (e *EscrowAccount) AddStakeClaim(tm map[ThresholdKind]quantity.Quantity, claim StakeClaim, thresholds []ThresholdKind) error {
// Compute total amount of claims excluding the claim that we are just adding. This is needed
// in case the claim is being updated to avoid counting it twice.
totalClaims, err := e.Sta... | [
0.26902875304222107,
-0.05637415871024132,
0.5986299514770508,
0.17538608610630035,
0.23008333146572113,
-0.2606288492679596,
-0.11444046348333359,
-0.14898568391799927,
-0.4458801746368408,
0.03151298686861992,
0.10749965906143188,
-0.3650824725627899,
0.2397976517677307,
0.11922808736562... |
func (e *EscrowAccount) RemoveStakeClaim(claim StakeClaim) error {
return e.StakeAccumulator.RemoveClaim(claim)
} | [
0.2894657254219055,
0.042075756937265396,
0.3905509412288666,
0.31590065360069275,
-0.9289341568946838,
-0.4045077860355377,
0.27215155959129333,
0.7988118529319763,
0.3059406876564026,
0.45932143926620483,
-0.3854682147502899,
0.1927207112312317,
-0.34533455967903137,
-0.09986402094364166... |
func roundDownCapacityPretty(capacityBytes int64) int64 {
easyToReadUnitsBytes := []int64{gib, mib}
// Round down to the nearest easy to read unit
// such that there are at least 10 units at that size.
for _, easyToReadUnitBytes := range easyToReadUnitsBytes {
// Round down the capacity to the nearest unit.
s... | [
-0.1521277278661728,
-0.49130985140800476,
0.6164350509643555,
-1.5702414512634277,
-0.008201994001865387,
-0.2739710509777069,
0.8722646832466125,
0.27719271183013916,
0.11901470273733139,
-0.10050712525844574,
0.6223582029342651,
0.16800440847873688,
-0.695232093334198,
-0.14591598510742... |
func CreateVolume(base, volID string) error {
path := filepath.Join(base, volID)
err := os.MkdirAll(path, 0777)
if err != nil {
return err
}
klog.V(4).Infof("adding hostpath volume: %s", volID)
return nil
} | [
1.1605587005615234,
0.018344338983297348,
0.4130714535713196,
0.5955637693405151,
1.2530403137207031,
0.7649092674255371,
0.12239748239517212,
0.014418251812458038,
-0.9436863660812378,
-0.7015636563301086,
0.2570980191230774,
-0.5692655444145203,
-0.3826148509979248,
0.7296504974365234,
... |
func DeleteVolume(base, volID string) error {
klog.V(4).Infof("starting to delete hostpath volume: %s", volID)
path := filepath.Join(base, volID)
if err := os.RemoveAll(path); err != nil && !os.IsNotExist(err) {
return err
}
klog.V(4).Infof("deleted hostpath volume: %s", volID)
return nil
} | [
0.9192635416984558,
-0.7614682912826538,
0.6188805103302002,
0.33828306198120117,
1.134047031402588,
0.3339597284793854,
0.042895663529634476,
0.6094000935554504,
-0.8566403388977051,
-0.5371198058128357,
0.2448427528142929,
-0.17553332448005676,
-0.47923988103866577,
0.9487423300743103,
... |
func IndexOfString(value string, list []string) int {
for i, match := range list {
if match == value {
return i
}
}
return -1
} | [
-0.3620518445968628,
-1.1202337741851807,
0.35198718309402466,
-0.2813567817211151,
-0.8109689950942993,
-0.4583151042461395,
0.07854530960321426,
-0.06408853828907013,
-0.07992668449878693,
0.7542042136192322,
-0.08684265613555908,
-0.5383186340332031,
-0.40772363543510437,
-0.67972785234... |
func BenchmarkFib(b *testing.B) {
b.Run("Fib1", func(b *testing.B) {
for i := 0; i < b.N; i++ {
fib1(20)
}
})
b.Run("Fib2", func(b *testing.B) {
for i := 0; i < b.N; i++ {
fib2(20)
}
})
b.Run("Fib3", func(b *testing.B) {
for i := 0; i < b.N; i++ {
fib3(20)
}
})
} | [
0.6992143988609314,
0.6872095465660095,
0.5396073460578918,
0.5265149474143982,
0.9308127164840698,
-0.20192429423332214,
1.1227002143859863,
0.051155027002096176,
-0.30996131896972656,
0.19347140192985535,
-0.5393069982528687,
-0.44642069935798645,
-0.6846503019332886,
1.1916520595550537,... |
func GetInstallPath(version string) string {
return goos.GetInstallPath(version)
} | [
0.3278534412384033,
-0.8745843768119812,
0.3880409300327301,
0.8778818845748901,
-0.30349063873291016,
0.4407043159008026,
1.1463545560836792,
0.19931983947753906,
0.3846803307533264,
1.0953152179718018,
-0.10940323770046234,
-0.3786477744579315,
-0.5353460311889648,
0.4580627679824829,
... |
func DownloadAndInstall(version string) (string, error) {
releaseTag := GetReleaseTagFromVersion(version)
return goos.DownloadTokBinary(releaseTag)
} | [
0.09554969519376755,
-1.379305124282837,
0.5427590608596802,
0.6600287556648254,
-0.5335637927055359,
-0.4194382131099701,
0.07658077031373978,
0.01407424733042717,
0.6252448558807373,
0.44585445523262024,
-1.2597198486328125,
-0.3476516604423523,
-0.03574059158563614,
1.0024998188018799,
... |
func GetReleaseTagFromVersion(version string) (releaseTag string) {
// Check version exists in GH
// Get the URL for the version
ghr := []github.ReleaseBody{}
body, err := github.GetAllReleases()
if err != nil {
fmt.Println("Unexpected error retrieving list of available Tokaido releases: " + err.Error())
os.Ex... | [
-0.04609407112002373,
-0.737891435623169,
0.350971519947052,
-0.36957916617393494,
0.08754246681928635,
0.045765869319438934,
-0.10105956345796585,
0.4031500220298767,
-0.5626107454299927,
0.949852705001831,
-0.30909937620162964,
-0.4269194006919861,
-0.40104472637176514,
1.550476551055908... |
func StartGameServer() {
// some initialization to use game library
InitAPI()
// default gin router (logger and recovery functions)
r := gin.Default()
// just need one post handler to submit movement and get outcome
r.POST("/play", PlayGame)
r.Run(port)
} | [
-0.5032840371131897,
-0.46463921666145325,
0.7881731390953064,
1.091704249382019,
1.3215683698654175,
0.7262451648712158,
0.27215105295181274,
-0.08731585741043091,
-0.6594076752662659,
-0.1904570758342743,
-0.6635410189628601,
0.26244425773620605,
-0.6066520810127258,
0.6147117614746094,
... |
func InitAPI() {
// we need to do that to use the library game later
rand.Seed(time.Now().Unix())
} | [
-0.34729212522506714,
-0.7252674102783203,
0.5210902094841003,
-0.06905058771371841,
0.666144609451294,
0.7513505220413208,
0.20171208679676056,
0.13064511120319366,
0.05336892977356911,
0.2604883015155792,
-0.39703357219696045,
-0.05367948114871979,
-0.49510690569877625,
0.560654520988464... |
func PlayGame(c *gin.Context) {
body := c.Request.Body
reqJSON, err := ioutil.ReadAll(body)
if err != nil {
log.Println("body from post request could not be read:", err)
c.JSON(http.StatusBadRequest, gin.H{"error": "request body could not be processed"})
return
}
playerMove, err := MakeMoveFromJSON(reqJSON)
... | [
-0.35799920558929443,
-0.11973102390766144,
1.0059069395065308,
0.653410792350769,
0.10833723098039627,
0.47796767950057983,
-0.34474122524261475,
-0.35592272877693176,
-0.19947102665901184,
0.8996721506118774,
0.32784131169319153,
-0.4752250015735626,
-1.0701220035552979,
0.02463388070464... |
func MakeMoveFromJSON(reqJSON []byte) (game.Move, error) {
var throw PlayRequest
err := json.Unmarshal(reqJSON, &throw)
if err != nil {
return 0, err
}
for i := 0; i < int(game.MovesLength); i++ {
m := game.Move(i)
if strings.ToLower(throw.Throw) == m.String() {
return m, nil
}
}
return 0, fmt.Errorf(... | [
-0.2878272235393524,
-0.7480588555335999,
0.645893394947052,
-0.2104099839925766,
-0.38050535321235657,
-0.014631195925176144,
-0.30150339007377625,
-0.8331343531608582,
0.5672642588615417,
0.1684238463640213,
0.4358374774456024,
-0.35238614678382874,
-1.199042558670044,
-0.294139474630355... |
func init() {
file, err := ioutil.ReadFile("./token.json")
if err != nil {
log.Fatal("File doesn't exist")
}
if err := json.Unmarshal(file, &BotKey); err != nil {
log.Fatal("Cannot parse token.json")
}
} | [
-0.0013455634471029043,
-0.682408332824707,
0.7307710647583008,
-0.9666357636451721,
0.13452008366584778,
0.7355861067771912,
-0.5110713243484497,
0.9048267006874084,
-1.3775829076766968,
0.24727313220500946,
-0.5460773706436157,
0.9587701559066772,
0.5266704559326172,
-0.02687342092394828... |
func NewEvent(x, y float64, button, event string) Event {
return Event{
Point2: floatgeom.Point2{x, y},
Button: button,
Event: event,
}
} | [
1.6879849433898926,
-0.8347964882850647,
0.26274898648262024,
0.5441172122955322,
-0.6326018571853638,
0.8755500316619873,
-0.31369727849960327,
-0.19545336067676544,
-0.16034626960754395,
0.16595947742462158,
-0.33295682072639465,
0.4985863268375397,
0.8905608654022217,
-0.482232332229614... |
func NewZeroEvent(x, y float64) Event {
return NewEvent(x, y, "", "")
} | [
0.7152860760688782,
-0.3117939829826355,
0.3140593469142914,
0.10149843245744705,
-0.824755072593689,
-0.2820203900337219,
-0.8165194392204285,
-0.6733102798461914,
-0.42248278856277466,
-0.5039223432540894,
-0.018116939812898636,
1.014298915863037,
0.2561744153499603,
0.17309869825839996,... |
func (e Event) ToSpace() *collision.Space {
return collision.NewUnassignedSpace(e.X(), e.Y(), 0.1, 0.1)
} | [
1.0169007778167725,
-0.2748834490776062,
0.6360328197479248,
0.254855751991272,
0.5173134803771973,
0.33902639150619507,
0.6317706108093262,
-0.3858424425125122,
0.9018475413322449,
0.19257213175296783,
-0.03456232696771622,
-0.4768288731575012,
0.15459302067756653,
-0.23951806128025055,
... |
func NewClient(owner string, url string) *Client {
client := &Client{
url: url,
owner: owner,
}
return client
} | [
0.21340671181678772,
-0.3610472083091736,
0.17124052345752716,
0.5672563910484314,
-0.5953094363212585,
-0.008789843879640102,
0.13791732490062714,
0.21190166473388672,
-0.2199181467294693,
-0.8324559330940247,
-0.2978282570838928,
1.2848373651504517,
0.21765495836734772,
-1.50471782684326... |
func (c *Client) Acquire(rtype string, state string, dest string) (string, error) {
r, err := c.acquire(rtype, state, dest)
if err != nil {
return "", err
}
c.lock.Lock()
defer c.lock.Unlock()
if r != "" {
c.resources = append(c.resources, r)
}
return r, nil
} | [
-0.6608142256736755,
-0.3670891523361206,
0.7166119813919067,
-0.30245161056518555,
0.25131767988204956,
-0.575630784034729,
-0.500954270362854,
-0.5556203722953796,
0.28367796540260315,
-0.35976696014404297,
0.44454577565193176,
0.29182177782058716,
-0.4875740110874176,
0.0555907897651195... |
func (c *Client) ReleaseAll(dest string) error {
c.lock.Lock()
if len(c.resources) == 0 {
c.lock.Unlock()
return fmt.Errorf("No holding resource")
}
c.lock.Unlock()
for {
r, ok := c.popResource()
if !ok {
break
}
if err := c.release(r, dest); err != nil {
return err
}
}
return nil
} | [
0.24442142248153687,
-0.007663923315703869,
0.6934847831726074,
-0.1338314712047577,
-0.2989062964916229,
0.19942481815814972,
-0.31748849153518677,
-0.2411768138408661,
-0.49367761611938477,
0.3352721929550171,
0.5325841307640076,
-0.12908929586410522,
-0.23267540335655212,
1.040655970573... |
func (c *Client) ReleaseOne(name string, dest string) error {
c.lock.Lock()
defer c.lock.Unlock()
for idx, r := range c.resources {
if r == name {
c.resources[idx] = c.resources[len(c.resources)-1]
c.resources = c.resources[:len(c.resources)-1]
if err := c.release(r, dest); err != nil {
return err
... | [
-0.6373463869094849,
0.13431379199028015,
0.7672894597053528,
-0.8777173757553101,
-0.3827548623085022,
-0.30272939801216125,
-0.1454949826002121,
-0.2655909061431885,
-0.7276642918586731,
1.0727492570877075,
-0.6137134432792664,
-0.4109940528869629,
-0.8705644011497498,
0.1274445205926895... |
func (c *Client) UpdateAll(state string) error {
c.lock.Lock()
defer c.lock.Unlock()
if len(c.resources) == 0 {
return fmt.Errorf("No holding resource")
}
for _, r := range c.resources {
if err := c.update(r, state); err != nil {
return err
}
}
return nil
} | [
0.10626824200153351,
-0.57087242603302,
0.7848505973815918,
-0.20096677541732788,
0.03899925574660301,
0.5913263559341431,
-0.47022804617881775,
0.04835040494799614,
-0.33061981201171875,
0.15683764219284058,
0.5766634941101074,
0.21579398214817047,
-0.3247598111629486,
0.5461530685424805,... |
func (c *Client) UpdateOne(name string, state string) error {
c.lock.Lock()
defer c.lock.Unlock()
for _, r := range c.resources {
if r == name {
if err := c.update(r, state); err != nil {
return err
}
return nil
}
}
return fmt.Errorf("No resource name %v", name)
} | [
-0.5905622839927673,
-0.08318696916103363,
0.8306534290313721,
-0.37236249446868896,
-0.13513131439685822,
-0.1449015885591507,
-0.19682207703590393,
-0.18821834027767181,
-0.6782699227333069,
1.3284409046173096,
-0.5185956954956055,
-0.5765489339828491,
-0.7486512064933777,
-0.24605430662... |
func (ma *MockAuthorizer) Authorize(r *http.Request) bool {
return ma.Called(r).Bool(0)
} | [
-1.6333194971084595,
0.5311792492866516,
0.4842948317527771,
0.5900924801826477,
0.3440650403499603,
0.16707812249660492,
0.5489822030067444,
0.3334934413433075,
0.20179545879364014,
0.6735396981239319,
0.09009978920221329,
-0.6349682807922363,
-0.6139799952507019,
0.7677501440048218,
-0... |
func envamize(key string) string {
return strings.Replace(strings.ToUpper(key), ".", "_", -1)
} | [
-1.8347007036209106,
0.5043696165084839,
0.732700765132904,
-0.7904558777809143,
-0.3878100514411926,
0.0009605147643014789,
-0.9640682935714722,
-0.31956347823143005,
-0.7106069326400757,
1.3994076251983643,
-0.12065208703279495,
0.16589893400669098,
-0.6291439533233643,
0.343302130699157... |
func (self *EnvSource) Bind(input ...string) (err error) {
var key, envkey string
if len(input) == 0 {
return fmt.Errorf("BindEnv missing key to bind to")
}
if len(input) == 1 {
key = input[0]
} else {
key = input[1]
}
envkey = envamize(key)
jww.TRACE.Println(key, "Bound to", envkey)
self.index[strin... | [
-1.5596598386764526,
-0.24079075455665588,
0.5858682990074158,
-0.07836566120386124,
0.5440215468406677,
0.44910600781440735,
0.03826439753174782,
-0.13724693655967712,
-0.3233797252178192,
0.2527185380458832,
-0.5073063969612122,
0.9071024656295776,
-0.35233476758003235,
0.735090911388397... |
func (self *EnvSource) Get(key string) (val interface{}, exists bool) {
envkey, exists := self.index[key]
if exists {
jww.TRACE.Println(key, "registered as env var", envkey)
}
if val = os.Getenv(envkey); val != "" {
jww.TRACE.Println(envkey, "found in environment with val:", val)
return val, true
} else {
... | [
-1.1381480693817139,
0.4480549991130829,
0.7802507281303406,
-1.1206648349761963,
0.1403406858444214,
-0.06605637073516846,
-0.11257641762495041,
-0.3899347484111786,
-0.4064282178878784,
1.0804052352905273,
-0.4139260947704315,
0.2832375466823578,
-0.5555248260498047,
0.3770941495895386,
... |
func NewDatabaseConnection(uri string, dbName string) (*mongo.Database, error) {
client, err := mongo.NewClient(options.Client().ApplyURI(uri))
if err != nil {
return nil, err
}
err = client.Connect(context.Background())
if err != nil {
return nil, err
}
err = client.Ping(context.Background(), readpref.Pri... | [
-0.7584649324417114,
0.544804573059082,
0.4117675721645355,
0.7517827749252319,
-0.1590399593114853,
-0.6809718608856201,
-0.336224764585495,
-0.3862191140651703,
0.1080365777015686,
0.479169100522995,
0.14295536279678345,
0.19288122653961182,
-1.3652774095535278,
0.3267708420753479,
0.0... |
func spawnAlbControllerAndCloud(vcd *TestVCD, check *C) (*NsxtAlbController, *NsxtAlbCloud) {
skipNoNsxtAlbConfiguration(vcd, check)
albController := spawnAlbController(vcd, check)
check.Assert(albController, NotNil)
importableCloud, err := albController.GetAlbImportableCloudByName(vcd.config.VCD.Nsxt.NsxtAlbImpo... | [
1.1204688549041748,
-0.12417054176330566,
0.6983878016471863,
-0.024668071419000626,
0.27138441801071167,
0.8773320913314819,
-0.35644394159317017,
-0.5967662930488586,
0.7030767202377319,
0.38750794529914856,
0.16979530453681946,
-0.43064048886299133,
0.3138486444950104,
0.305001676082611... |
func (manager *mockFileSystemManager) CreateFileSystem(ctx context.Context, groupName string, filesystemName string, timeout *int32, xMsDate string, datalakeName string) (*autorest.Response, error) {
fs := fileSystemResource{
resourceGroupName: groupName,
storageAccountName: datalakeName,
filesystemName: fi... | [
-0.37185922265052795,
-0.06828467547893524,
0.3430527448654175,
-0.2885206341743469,
0.3100854456424713,
-0.11225128173828125,
0.16319206357002258,
-0.6216585040092468,
0.4379958212375641,
-0.6030077338218689,
-0.11670675128698349,
-0.4897514879703522,
-1.0978349447250366,
0.51013350486755... |
func init() {
phpctx.RegisterExt(&phpctx.Ext{
Name: "bz2",
Version: core.VERSION,
Classes: []phpv.ZClass{},
Functions: map[string]*phpctx.ExtFunction{
"bzdecompress": &phpctx.ExtFunction{Func: fncBzDecompress, Args: []*phpctx.ExtFunctionArg{}},
},
Constants: map[phpv.ZString]phpv.Val{},
})
} | [
0.2646605372428894,
0.10898707062005997,
0.4931357800960541,
0.35821980237960815,
0.15537172555923462,
0.06420687586069107,
-0.8178398013114929,
0.34238511323928833,
-0.016565078869462013,
-0.3311724364757538,
-1.1494626998901367,
0.37908780574798584,
-0.5041215419769287,
0.74474036693573,... |
func NewOperator(host string, port int, user, password string, threads int) (Operator, error) {
cfg := mysql.NewConfig()
cfg.User = user
cfg.Passwd = password
cfg.Net = "tcp"
cfg.Addr = fmt.Sprintf("%s:%d", host, port)
cfg.InterpolateParams = true
cfg.ParseTime = true
cfg.Timeout = 5 * time.Second
cfg.ReadTime... | [
-0.721758246421814,
0.2515687048435211,
0.6677010655403137,
-0.061104487627744675,
-1.1811928749084473,
-0.23600448668003082,
-0.25852087140083313,
0.3313733637332916,
-0.16998670995235443,
-0.020810499787330627,
-0.03740498423576355,
-0.7218226790428162,
-1.070844054222107,
-0.09242354333... |
func LogHeap() {
logHeap(os.Stderr)
} | [
1.1199325323104858,
-0.1369655728340149,
0.3482232987880707,
-0.37586984038352966,
0.34611186385154724,
0.4097920358181,
-0.4261193573474884,
-0.15037205815315247,
0.26637569069862366,
-0.2832717001438141,
0.3486705422401428,
1.3130912780761719,
0.3779851496219635,
0.3640754222869873,
0.... |
func GCWorkflowArtifacts(log logr.Logger, s3Client s3.Client, wf *argov1.Workflow) (reconcile.Result, error) {
if s3Client == nil {
log.V(3).Info("skip garbage collection of artifacts")
return reconcile.Result{}, nil
}
for _, node := range wf.Status.Nodes {
if node.Outputs == nil {
continue
}
for _, art... | [
0.01096144039183855,
-0.651904284954071,
0.828794538974762,
-0.5293468832969666,
0.2641819715499878,
0.22232231497764587,
0.8982403874397278,
-0.23498935997486115,
0.12208430469036102,
0.8105521202087402,
0.29819226264953613,
0.1043100580573082,
-0.5443256497383118,
0.16056956350803375,
... |
func CleanWorkflowPods(c client.Client, wf *argov1.Workflow) error {
var result *multierror.Error
if testmachinery.CleanWorkflowPods() {
for nodeName, node := range wf.Status.Nodes {
if node.Type == argov1.NodeTypePod {
if err := deletePod(c, testmachinery.GetNamespace(), nodeName); err != nil {
result ... | [
-0.6406716108322144,
-0.3645680248737335,
0.3354327380657196,
0.059392694383859634,
0.70516037940979,
-0.27284330129623413,
0.7103624939918518,
-0.5540908575057983,
-0.20436736941337585,
0.8799427151679993,
0.5506592988967896,
-0.10615827888250351,
-0.7800354957580566,
0.684552788734436,
... |
func (mc *mockCheck) ConfigSource() string { return mc.cfgSource } | [
0.11212068796157837,
0.5676354169845581,
-0.07869533449411392,
0.7434782981872559,
-0.4419628083705902,
-0.2833692133426666,
0.5131000876426697,
0.846066415309906,
0.07166679203510284,
0.5273732542991638,
-0.7475327849388123,
-0.9234992265701294,
-1.2798258066177368,
0.6319910883903503,
... |
func (self *Sax) normalize(measureList []float64) []float64 {
var err error
if len(measureList) < 1 {
return measureList
}
s2 := float64(1)
m2 := float64(0)
m1 := mean(measureList)
if err != nil {
panic(err)
}
s1 := stdDev(measureList, m1)
if err != nil {
panic(err)
}
stdMultiplier... | [
-0.28001001477241516,
0.5419654846191406,
0.7301233410835266,
1.4755550622940063,
-0.14201611280441284,
0.30295151472091675,
-0.04403289780020714,
0.2901422679424286,
0.33862704038619995,
0.6836548447608948,
-0.005921517498791218,
0.12822560966014862,
-1.133736252784729,
1.1305551528930664... |
func (self *Sax) ToLetterRepresentation(x []float64) (string, [][]int) {
paaX, indices := self.toPaa(self.normalize(x))
self.scalingFactor = math.Sqrt(float64((len(x) * 1.0) / (self.wordSize * 1.0)))
return self.alphabetize(paaX), indices
} | [
-0.7512122392654419,
-0.13556146621704102,
0.4721093475818634,
-1.2830926179885864,
-0.7321825623512268,
-0.6899029016494751,
-0.04785435274243355,
-0.18986612558364868,
1.1628410816192627,
1.5725754499435425,
-0.1785682886838913,
0.16354279220104218,
-0.1495901197195053,
0.075330838561058... |
func (self *Sax) toPaa(x []float64) (approximation []float64, indices [][]int) {
n := len(x)
stepFloat := float64(n) / float64(self.wordSize)
step := int(math.Ceil(stepFloat))
frameStart := 0
approximation = []float64{}
indices = [][]int{}
i := 0
for frameStart <= n - step {
thisFrame := x[frameSta... | [
-0.5744336843490601,
0.25495630502700806,
0.9001433849334717,
-1.0468828678131104,
-0.9172693490982056,
-0.8473121523857117,
0.6504368185997009,
-0.4764385521411896,
0.6679869890213013,
1.394048810005188,
0.05653984099626541,
0.5242235064506531,
-0.07811681181192398,
0.6947155594825745,
... |
func (self *Sax) alphabetize(paaX []float64) string {
alphabetizedX := ""
for i := 0; i < len(paaX); i++ {
letterFound := false
for j := 0; j < len(self.beta); j++ {
if paaX[i] < self.beta[j] {
alphabetizedX += string(rune(int(self.aOffset) + j))
letterFound = true
break
... | [
-0.09770213067531586,
-0.29296934604644775,
0.7271655797958374,
-0.7408294081687927,
-0.6881166696548462,
0.6728484630584717,
-0.31182289123535156,
-1.5358729362487793,
0.08800822496414185,
0.8546702265739441,
0.8339909315109253,
0.2746736705303192,
-0.756062924861908,
-0.00964748952537775... |
func (self *Sax) CompareStrings(list_letters_a, list_letters_b []byte) (float64, error) {
if len(list_letters_a) != len(list_letters_b) {
return 0, ErrStringsAreDifferentLength
}
mindist := 0.0
for i := 0; i < len(list_letters_a); i++ {
mindist += math.Pow(self.compare_letters(rune(list_letters_a[i]), r... | [
-0.13243795931339264,
-0.47882115840911865,
0.6474195718765259,
-0.45503300428390503,
-0.3965352773666382,
-0.6437469720840454,
-1.0147291421890259,
-0.20598742365837097,
0.01371760293841362,
0.8129494190216064,
0.09124142676591873,
0.8079742193222046,
-1.555810570716858,
0.924352884292602... |
func (self *Sax) compare_letters(la, lb rune) float64 {
return self.compareDict[string(la) + string(lb)]
} | [
-0.23758280277252197,
-0.777793824672699,
0.37542590498924255,
-1.3469022512435913,
-0.372763067483902,
0.2546517848968506,
-0.8424136638641357,
-0.9563780426979065,
-0.2800750434398651,
0.9089007377624512,
0.2422139048576355,
0.8064867258071899,
-1.2243765592575073,
0.6969471573829651,
... |
func (self *Sax) build_letter_compare_dict() {
number_rep := rangeIntArray(0, self.alphabetSize)
letters := make([]string, len(number_rep)) // [chr(x + self.aOffset) for x in number_rep]
for i, x := range number_rep {
letters[i] = string(rune(x + int(self.aOffset)))
}
self.compareDict = make(map[string]... | [
-0.5769728422164917,
-0.8247931003570557,
0.7593616247177124,
-1.381940245628357,
-0.8335496783256531,
0.659870445728302,
0.545141875743866,
-0.21823091804981232,
-0.4341373145580292,
0.3738354444503784,
-0.636002242565155,
0.2956428825855255,
-1.0754728317260742,
0.23021046817302704,
-0... |
func (a *SessionManagementApiService) GetLoginFlows(ctx context.Context) (InlineResponse20019, *http.Response, error) {
var (
localVarHttpMethod = http.MethodGet
localVarPostBody interface{}
localVarFormFileName string
localVarFileName string
localVarFileBytes []byte
localVarReturnValue Inlin... | [
-1.000258207321167,
-0.9339372515678406,
1.1545015573501587,
-0.3407626748085022,
-0.8740591406822205,
-0.16606752574443817,
0.29600790143013,
-0.7283203601837158,
0.2915419340133667,
-0.10669737309217453,
-0.059736769646406174,
0.7373978495597839,
-1.5511935949325562,
-0.2528262734413147,... |
func TestScannerSet(t *T) {
c := dial()
key := randStr()
fullMap := map[string]bool{}
for i := 0; i < 100; i++ {
elem := strconv.Itoa(i)
fullMap[elem] = true
require.Nil(t, c.Do(Cmd(nil, "SADD", key, elem)))
}
// make sure we get all results when scanning an existing set
sc := NewScanner(c, ScanOpts{Comm... | [
-0.8003837466239929,
0.30608871579170227,
0.5357504487037659,
-0.2388816922903061,
0.377539724111557,
0.4224216639995575,
-0.24785450100898743,
-0.40635746717453003,
0.44772911071777344,
-0.6899818778038025,
-0.09477826207876205,
-0.37248677015304565,
-0.26577621698379517,
0.77765768766403... |
func TestCloseReader(t *testing.T) {
s, err := newLoopbackStack()
if err != nil {
t.Fatalf("newLoopbackStack() = %v", err)
}
defer func() {
s.Close()
s.Wait()
}()
addr := tcpip.FullAddress{
NIC: NICID,
Addr: tcpip.AddrFromSlice(net.IPv4(169, 254, 10, 1).To4()),
Port: 11211,
}
protocolAddr := tcpip... | [
0.45351454615592957,
-0.027502523735165596,
0.909574568271637,
-0.45221254229545593,
-0.26090705394744873,
0.048895809799432755,
0.6802016496658325,
-0.45417022705078125,
-0.5023113489151001,
-0.27902254462242126,
1.1148415803909302,
-0.8946229219436646,
-0.5368815660476685,
0.402475416660... |
func TestCloseReaderWithForwarder(t *testing.T) {
s, err := newLoopbackStack()
if err != nil {
t.Fatalf("newLoopbackStack() = %v", err)
}
defer func() {
s.Close()
s.Wait()
}()
addr := tcpip.FullAddress{
NIC: NICID,
Addr: tcpip.AddrFromSlice(net.IPv4(169, 254, 10, 1).To4()),
Port: 11211,
}
protocol... | [
0.38961082696914673,
0.0793524906039238,
0.8345966339111328,
-0.4616897404193878,
-0.1827959418296814,
0.24463406205177307,
0.6320584416389465,
-0.7055807113647461,
-0.6135013103485107,
-0.4176681339740753,
0.8912171125411987,
-0.05977763235569,
-0.30155324935913086,
0.5189332365989685,
... |
func TestCloseStack(t *testing.T) {
s, err := newLoopbackStack()
if err != nil {
t.Fatalf("newLoopbackStack() = %v", err)
}
addr := tcpip.FullAddress{
NIC: NICID,
Addr: tcpip.AddrFromSlice(net.IPv4(169, 254, 10, 1).To4()),
Port: 11211,
}
protocolAddr := tcpip.ProtocolAddress{
Protocol: ipv4.P... | [
0.3156292736530304,
0.5009365081787109,
0.9436681866645813,
-0.0893443301320076,
0.38683435320854187,
-0.13895529508590698,
0.9952983856201172,
-1.03606116771698,
-0.5361818075180054,
-0.14363433420658112,
0.7341687679290771,
-0.13590019941329956,
-0.9134320020675659,
-0.19158416986465454,... |
func TestDeadlineChange(t *testing.T) {
s, err := newLoopbackStack()
if err != nil {
t.Fatalf("newLoopbackStack() = %v", err)
}
defer func() {
s.Close()
s.Wait()
}()
addr := tcpip.FullAddress{
NIC: NICID,
Addr: tcpip.AddrFromSlice(net.IPv4(169, 254, 10, 1).To4()),
Port: 11211,
}
protocolAddr := t... | [
0.5922192931175232,
0.31705284118652344,
0.8084377646446228,
-0.5181516408920288,
0.36828136444091797,
-0.06576818227767944,
0.35869771242141724,
-0.4311031401157379,
-0.2679429054260254,
-0.2133331000804901,
-0.05268741026520729,
-0.19672048091888428,
-0.32772454619407654,
0.1438575237989... |
func TestInterruptListender(t *testing.T) {
for _, test := range []struct {
name string
stop func(l *TCPListener) error
}{
{
"Close",
(*TCPListener).Close,
},
{
"Shutdown",
func(l *TCPListener) error {
l.Shutdown()
return nil
},
},
{
"Double Shutdown",
func(l *TCPListener) e... | [
0.4361436367034912,
0.31646353006362915,
0.9057720899581909,
-0.7377400994300842,
0.06598605215549469,
0.3895992636680603,
0.630182147026062,
-0.6945114135742188,
-0.38842764496803284,
0.24499468505382538,
-0.1492460072040558,
-0.7183699011802673,
-0.40291309356689453,
0.012545784935355186... |
func RectToHitbox(rect pixel.Rect, scale float64, pos pixel.Vec) *hitbox {
return &hitbox{
minX: rect.Min.X - pos.X - (6 * scale),
minY: rect.Min.Y - pos.Y - (9 * scale),
maxX: (rect.Max.X - pos.X) * scale,
maxY: (rect.Max.Y - pos.Y) * scale,
radius: 0,
}
} | [
-0.0225214883685112,
-0.7430813908576965,
0.6864306330680847,
-1.0820555686950684,
-0.3541252315044403,
-0.6908197402954102,
-0.4397689998149872,
-1.3091456890106201,
-0.5121561288833618,
0.010671759955585003,
-0.7057822942733765,
-0.09566731005907059,
1.172495722770691,
-0.940910875797271... |
func (g *GameObject) SetScale(scale float64) {
g.Hitbox.maxX *= scale / g.Scale
g.Hitbox.maxY *= scale / g.Scale
g.Scale = scale
} | [
-0.30737683176994324,
-0.3106951117515564,
0.6604530811309814,
0.8995135426521301,
0.601145327091217,
-0.08853708207607269,
-0.3698233962059021,
-0.8789282441139221,
-0.8623246550559998,
0.2730477750301361,
-0.6514217853546143,
-0.7044861316680908,
0.30301612615585327,
0.3884105682373047,
... |
func (pq *priorityQueue) Push(x interface{}) {
n := len(*pq)
item := x.(*Item)
item.index = n
*pq = append(*pq, item)
} | [
-0.7378948926925659,
0.3674948215484619,
0.273908406496048,
-0.27891111373901367,
-0.1534983515739441,
1.2748358249664307,
-1.0210767984390259,
-0.40888965129852295,
0.8276805877685547,
0.513155996799469,
-1.58438241481781,
0.43458834290504456,
-0.06352610141038895,
0.12200786918401718,
... |
func (pq *priorityQueue) Pop() interface{} {
old := *pq
n := len(old)
item := old[n-1]
old[n-1] = nil // avoid memory leak
item.index = -1 // for safety
*pq = old[0 : n-1]
return item
} | [
-0.39478978514671326,
0.008972333744168282,
0.7019709944725037,
-0.10558152943849564,
-0.47761237621307373,
0.33808422088623047,
-0.22273890674114227,
-0.024548903107643127,
0.22442767024040222,
1.0819487571716309,
-0.08031958341598511,
-0.37665748596191406,
-0.6950313448905945,
-0.3167276... |
func quote(str string, quote byte) string {
if strings.IndexByte(str, '\n') < 0 {
buf := []byte{quote}
buf = appendEscaped(buf, str, quote, true)
buf = append(buf, quote)
return string(buf)
}
buf := []byte{quote, quote, quote}
buf = append(buf, multiSep...)
buf = appendEscapeMulti(buf, str, quote)
buf = a... | [
0.8881600499153137,
-0.5090330243110657,
0.5595867037773132,
0.6328778862953186,
-0.7097771167755127,
-0.6598763465881348,
-1.2036769390106201,
-0.0841568186879158,
0.7320165634155273,
0.21518945693969727,
0.021972129121422768,
0.26344606280326843,
-0.43792739510536194,
0.42866086959838867... |
func (m *GitignoreLang) Validate(formats strfmt.Registry) error {
var res []error
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
} | [
0.5274927616119385,
0.42283275723457336,
0.12247586995363235,
-0.6455188989639282,
0.14455756545066833,
0.06651508063077927,
0.09147097915410995,
-0.09593822807073593,
-0.4572661817073822,
0.5317996740341187,
-0.18089181184768677,
-0.3601413071155548,
-1.6511784791946411,
0.317361980676651... |
func main() {
go doSignal()
port := flag.String("port", "7654", "The port to listen to udp traffic on")
passthrough := flag.Bool("passthrough", false, "Get listening port from the SDK, rather than use the 'port' value")
readyOnStart := flag.Bool("ready", true, "Mark this GameServer as Ready on startup")
flag.Pars... | [
-0.6763690114021301,
0.04426835477352142,
1.243701457977295,
-0.09163807332515717,
0.6008723378181458,
0.33284658193588257,
0.35101982951164246,
0.18666189908981323,
0.06884501129388809,
-0.3327992558479309,
-0.23509223759174347,
0.14732123911380768,
0.5716890692710876,
-0.1849683970212936... |
func doSignal() {
stop := signals.NewStopChannel()
<-stop
log.Println("Exit signal received. Shutting down.")
os.Exit(0)
} | [
-0.8935979008674622,
-0.49885132908821106,
0.4266008734703064,
0.15972517430782318,
0.7600854635238647,
0.8563997149467468,
-0.04556107521057129,
0.022275811061263084,
-0.995631992816925,
0.7169223427772522,
-0.7166334986686707,
0.25876379013061523,
0.35426267981529236,
0.30990612506866455... |
func ready(s *sdk.SDK) {
err := s.Ready()
if err != nil {
log.Fatalf("Could not send ready message")
}
} | [
0.4130011796951294,
0.9063430428504944,
0.30609992146492004,
0.31431666016578674,
-0.008929364383220673,
-0.3529490530490875,
-0.19553448259830475,
0.041745249181985855,
0.3917582333087921,
0.36033937335014343,
-0.6909681558609009,
1.213602066040039,
0.6619244813919067,
0.8023585081100464,... |
func allocate(s *sdk.SDK) {
err := s.Allocate()
if err != nil {
log.Fatalf("could not allocate gameserver: %v", err)
}
} | [
-0.082871213555336,
1.1974656581878662,
0.5231947302818298,
0.5677636861801147,
0.941265344619751,
-0.036443497985601425,
-0.013875993900001049,
-0.9644667506217957,
0.49396035075187683,
-0.24699988961219788,
1.0065022706985474,
0.2893163859844208,
0.1302175372838974,
0.08081304281949997,
... |
func reserve(s *sdk.SDK) {
if err := s.Reserve(10 * time.Second); err != nil {
log.Fatalf("could not reserve gameserver: %v", err)
}
} | [
0.36425819993019104,
1.2272530794143677,
0.32831278443336487,
-0.13790273666381836,
1.5104763507843018,
-0.30292806029319763,
-0.8668956756591797,
-0.708832859992981,
-0.24385787546634674,
0.12036414444446564,
-0.1827290952205658,
0.07503962516784668,
-0.4035837948322296,
0.077164798974990... |
func readPacket(conn net.PacketConn, b []byte) (net.Addr, string) {
n, sender, err := conn.ReadFrom(b)
if err != nil {
log.Fatalf("Could not read from udp stream: %v", err)
}
txt := strings.TrimSpace(string(b[:n]))
log.Printf("Received packet from %v: %v", sender.String(), txt)
return sender, txt
} | [
-0.13944101333618164,
-0.17503909766674042,
0.782229483127594,
-0.571047306060791,
-0.6853283047676086,
-0.4446105360984802,
-0.7950512766838074,
0.513202428817749,
-0.09992685168981552,
-0.5192688703536987,
0.08837509900331497,
0.48560646176338196,
0.40249359607696533,
-0.5340681672096252... |
func respond(conn net.PacketConn, sender net.Addr, txt string) {
for _, sendaddr := range addrs {
if _, err := conn.WriteTo([]byte(txt), sendaddr); err != nil {
log.Fatalf("Could not write to udp stream: %v", err)
}
}
} | [
-0.06172661483287811,
0.12221180647611618,
0.39209744334220886,
-0.19383609294891357,
-0.02784145437180996,
-0.48632848262786865,
-0.3413113057613373,
0.6451959609985352,
0.11035730689764023,
0.08607209473848343,
-0.061940789222717285,
-0.4653831720352173,
-0.4366215169429779,
0.0117694484... |
func exit(s *sdk.SDK) {
log.Printf("Received EXIT command. Exiting.")
// This tells Agones to shutdown this Game Server
shutdownErr := s.Shutdown()
if shutdownErr != nil {
log.Printf("Could not shutdown")
}
os.Exit(0)
} | [
-0.16706885397434235,
0.3739067614078522,
0.4107685685157776,
0.05054421350359917,
0.7592461109161377,
0.04803827032446861,
-0.3223908543586731,
-0.32005468010902405,
-0.12751488387584686,
0.3863432705402374,
0.41043198108673096,
-0.07285436987876892,
-0.17518724501132965,
0.99824541807174... |
func gameServerName(s *sdk.SDK) string {
var gs *coresdk.GameServer
gs, err := s.GameServer()
if err != nil {
log.Fatalf("Could not retrieve GameServer: %v", err)
}
var j []byte
j, err = json.Marshal(gs)
if err != nil {
log.Fatalf("error mashalling GameServer to JSON: %v", err)
}
log.Printf("GameServer: %s... | [
-1.316202998161316,
-0.6651824712753296,
0.7363492846488953,
-0.8364099860191345,
-0.47144007682800293,
-0.016002463176846504,
-0.8394214510917664,
-0.5665908455848694,
-0.5209246873855591,
1.5789824724197388,
-0.8106076717376709,
0.4078545570373535,
0.019026221707463264,
0.269551753997802... |
func watchGameServerEvents(s *sdk.SDK) {
err := s.WatchGameServer(func(gs *coresdk.GameServer) {
j, err := json.Marshal(gs)
if err != nil {
log.Fatalf("error mashalling GameServer to JSON: %v", err)
}
log.Printf("GameServer Event: %s \n", string(j))
})
if err != nil {
log.Fatalf("Could not watch Game Se... | [
-0.12013519555330276,
-0.4943676292896271,
0.5280788540840149,
-0.6944279074668884,
0.029235132038593292,
-0.19633720815181732,
-0.11469283699989319,
-0.7126848697662354,
-0.5616598725318909,
0.6434472799301147,
-1.2050846815109253,
1.0495914220809937,
0.13993985950946808,
0.55220025777816... |
func setAnnotation(s *sdk.SDK, key, value string) {
log.Printf("Setting annotation %v=%v", key, value)
err := s.SetAnnotation(key, value)
if err != nil {
log.Fatalf("could not set annotation: %v", err)
}
} | [
-0.26939600706100464,
0.19840635359287262,
0.28662770986557007,
0.8470386862754822,
-0.3574022650718689,
-0.26055067777633667,
-0.07635960727930069,
0.38457778096199036,
0.17385467886924744,
0.7360049486160278,
-0.6145946979522705,
0.5232098698616028,
0.19987618923187256,
0.760920703411102... |
func setLabel(s *sdk.SDK, key, value string) {
log.Printf("Setting label %v=%v", key, value)
// label values can only be alpha, - and .
err := s.SetLabel(key, value)
if err != nil {
log.Fatalf("could not set label: %v", err)
}
} | [
-0.4133431911468506,
0.18416666984558105,
0.3463859260082245,
0.4140551686286926,
-0.24825544655323029,
0.9917009472846985,
-0.8100244402885437,
0.11918293684720993,
0.29117879271507263,
0.5306872129440308,
0.39390137791633606,
0.6428965330123901,
-0.007780289277434349,
0.6101358532905579,... |
func doHealth(sdk *sdk.SDK, stop <-chan struct{}) {
tick := time.Tick(2 * time.Second)
for {
err := sdk.Health()
if err != nil {
log.Fatalf("Could not send health ping, %v", err)
}
select {
case <-stop:
log.Print("Stopped health pings")
return
case <-tick:
}
}
} | [
-0.744947075843811,
0.2581246495246887,
0.7535316944122314,
0.5111508369445801,
0.03660199046134949,
0.6796826124191284,
-0.06625620275735855,
-1.1642407178878784,
-0.12083844840526581,
0.2614637315273285,
0.30800679326057434,
0.025526609271764755,
-0.06601884961128235,
0.00464048702269792... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.